Datasets:
Tasks:
Question Answering
Modalities:
Image
Formats:
imagefolder
Languages:
English
Size:
100K - 1M
ArXiv:
License:
Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- md/train/-TwO99rbVRu/-TwO99rbVRu.mdAdded+331
- md/train/04cII6MumYV/04cII6MumYV.mdAdded+311
- md/train/1Fqg133qRaI/1Fqg133qRaI.mdAdded+289
- md/train/1FvkSpWosOl/1FvkSpWosOl.mdAdded+575
- md/train/1NRMmEUyXMu/1NRMmEUyXMu.mdAdded+346
- md/train/4ADnf1HqIw/4ADnf1HqIw.mdAdded+276
- md/train/4G2dEuRZ7eO/4G2dEuRZ7eO.mdAdded+290
- md/train/5FRJWsiLRmA/5FRJWsiLRmA.mdAdded+416
- md/train/B12Js_yRb/B12Js_yRb.mdAdded+342
- md/train/B1spAqUp-/B1spAqUp-.mdAdded+195
- md/train/B1x5KiCcFX/B1x5KiCcFX.mdAdded+689
- md/train/BJ6oOfqge/BJ6oOfqge.mdAdded+257
- md/train/BJ8c3f-0b/BJ8c3f-0b.mdAdded+494
- md/train/BJfguoAcFm/BJfguoAcFm.mdAdded+398
- md/train/BJgVaG-Ab/BJgVaG-Ab.mdAdded+358
- md/train/BJxh2j0qYm/BJxh2j0qYm.mdAdded+283
- md/train/BkG8sjR5Km/BkG8sjR5Km.mdAdded+395
- md/train/BkS3fnl0W/BkS3fnl0W.mdAdded
- md/train/BkbY4psgg/BkbY4psgg.mdAdded
- md/train/BkgtDsCcKQ/BkgtDsCcKQ.mdAdded
- md/train/Bkxonh4Ywr/Bkxonh4Ywr.mdAdded
- md/train/ByeSYa4KPS/ByeSYa4KPS.mdAdded
- md/train/BygdyxHFDS/BygdyxHFDS.mdAdded
- md/train/ByqFhGZCW/ByqFhGZCW.mdAdded
- md/train/ByxCrerKvS/ByxCrerKvS.mdAdded
- md/train/ByxdUySKvS/ByxdUySKvS.mdAdded
- md/train/H1Dy---0Z/H1Dy---0Z.mdAdded
- md/train/H1W1UN9gg/H1W1UN9gg.mdAdded
- md/train/H1eqviAqYX/H1eqviAqYX.mdAdded
- md/train/H1lmhaVtvr/H1lmhaVtvr.mdAdded
- md/train/H1xaJn05FQ/H1xaJn05FQ.mdAdded
- md/train/H38f_9b90BO/H38f_9b90BO.mdAdded
- md/train/HCSgyPUfeDj/HCSgyPUfeDj.mdAdded
- md/train/HJOQ7MgAW/HJOQ7MgAW.mdAdded
- md/train/HJf9ZhC9FX/HJf9ZhC9FX.mdAdded
- md/train/HJgBA2VYwH/HJgBA2VYwH.mdAdded
- md/train/HJgVisRqtX/HJgVisRqtX.mdAdded
- md/train/HJgXsjA5tQ/HJgXsjA5tQ.mdAdded
- md/train/HJgeEh09KQ/HJgeEh09KQ.mdAdded
- md/train/HJguLo0cKQ/HJguLo0cKQ.mdAdded
- md/train/Hk5elxbRW/Hk5elxbRW.mdAdded
- md/train/HkGmDsR9YQ/HkGmDsR9YQ.mdAdded
- md/train/Hkfmn5n6W/Hkfmn5n6W.mdAdded
- md/train/Hkg4TI9xl/Hkg4TI9xl.mdAdded
- md/train/HkxAAvcxx/HkxAAvcxx.mdAdded
- md/train/Hyfg5o0qtm/Hyfg5o0qtm.mdAdded
- md/train/HyxhqhVKPB/HyxhqhVKPB.mdAdded
- md/train/I55UqU-M11y/I55UqU-M11y.mdAdded
- md/train/I6NRcao1w-X/I6NRcao1w-X.mdAdded
- md/train/IQgbmaoDDjd/IQgbmaoDDjd.mdAdded
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331# PSEUDOSEG: DESIGNING PSEUDO LABELS FOR SEMANTIC SEGMENTATION
Yuliang $\mathbf { Z o u } ^ { 1 * }$ Zizhao Zhang2 Han Zhang3 Chun-Liang Li2 Xiao Bian2 Jia-Bin Huang1 Tomas Pfister2 1Virginia Tech 2Google Cloud AI 3Google Brain
# ABSTRACT
Recent advances in semi-supervised learning (SSL) demonstrate that a combination of consistency regularization and pseudo-labeling can effectively improve image classification accuracy in the low-data regime. Compared to classification, semantic segmentation tasks require much more intensive labeling costs. Thus, these tasks greatly benefit from data-efficient training methods. However, structured outputs in segmentation render particular difficulties (e.g., designing pseudo-labeling and augmentation) to apply existing SSL strategies. To address this problem, we present a simple and novel re-design of pseudo-labeling to generate well-calibrated structured pseudo labels for training with unlabeled or weaklylabeled data. Our proposed pseudo-labeling strategy is network structure agnostic to apply in a one-stage consistency training framework. We demonstrate the effectiveness of the proposed pseudo-labeling strategy in both low-data and highdata regimes. Extensive experiments have validated that pseudo labels generated from wisely fusing diverse sources and strong data augmentation are crucial to consistency training for semantic segmentation. The source code is available at https://github.com/googleinterns/wss.
# 1 INTRODUCTION
Image semantic segmentation is a core computer vision task that has been studied for decades. Compared with other vision tasks, such as image classification and object detection, human annotation of pixel-accurate segmentation is dramatically more expensive. Given sufficient pixellevel labeled training data (i.e., high-data regime), the current state-of-the-art segmentation models (e.g., DeepLabv $^ { 3 + }$ (Chen et al., 2018)) produce satisfactory segmentation prediction for common practical usage. Recent exploration demonstrates improvement over high-data regime settings with large-scale data, including self-training (Chen et al., 2020a; Zoph et al., 2020) and backbone pretraining (Zhang et al., 2020a).
In contrast to the high-data regime, the performance of segmentation models drop significantly, given very limited pixel-labeled data (i.e., low-data regime). Such ineffectiveness at the low-data regime hinders the applicability of segmentation models. Therefore, instead of improving high-data regime segmentation, our work focuses on data-efficient segmentation training that only relies on few pixellabeled data and leverages the availability of extra unlabeled or weakly annotated (e.g., image-level) data to improve performance, with the aim of narrowing the gap to the supervised models trained with fully pixel-labeled data.
Our work is inspired by the recent success in semi-supervised learning (SSL) for image classification, demonstrating promising performance given very limited labeled data and a sufficient amount of unlabeled data. Successful examples include MeanTeacher (Tarvainen & Valpola, 2017), UDA (Xie et al., 2019), MixMatch (Berthelot et al., 2019b), FeatMatch (Kuo et al., 2020), and FixMatch (Sohn et al., 2020a). One outstanding idea in this type of SSL is consistency training: making predictions consistent among multiple augmented images. FixMatch (Sohn et al., 2020a) shows that using high-confidence one-hot pseudo labels obtained from weakly-augmented unlabeled data to train strongly-augmented counterpart is the key to the success of SSL in image classification.
However, effective pseudo labels and well-designed data augmentation are non-trivial to satisfy for semantic segmentation. Although we observe that many related works explore the second condition (i.e., augmentation) for image segmentation to enable consistency training framework (French et al., 2020; Ouali et al., 2020), we show that a wise design of pseudo labels for segmentation has great veiled potentials.
In this paper, we propose PseudoSeg, a one-stage training framework to improve image semantic segmentation by leveraging additional data either with image-level labels (weakly-labeled data) or without any labels. PseudoSeg presents a novel design of pseudo-labeling to infer effective structured pseudo labels of additional data. It then optimizes the prediction of strongly-augmented data to match its corresponding pseudo labels. In summary, we make the following contributions:
• We propose a simple one-stage framework to improve semantic segmentation by using a limited amount of pixel-labeled data and sufficient unlabeled data or image-level labeled data. Our framework is simple to apply and therefore network architecture agnostic. Directly applying consistency training approaches validated in image classification renders particular challenges in segmentation. We first demonstrate how well-calibrated soft pseudo labels obtained through wise fusion of predictions from diverse sources can greatly improve consistency training for segmentation. We conduct extensive experimental studies on the PASCAL VOC 2012 and COCO datasets. Comprehensive analyses are conducted to validate the effectiveness of this method at not only the low-data regime but also the high-data regime. Our experiments study multiple important open questions about transferring SSL advances to segmentation tasks.
# 2 RELATED WORK
Semi-supervised classification. Semi-supervised learning (SSL) aims to improve model performance by incorporating a large amount of unlabeled data during training. Consistency regularization and entropy minimization are two common strategies for SSL. The intuition behind consistencybased approaches (Laine & Aila, 2016; Sajjadi et al., 2016; Miyato et al., 2018; Tarvainen & Valpola, 2017) is that, the model output should remain unchanged when the input is perturbed. On the other hand, the entropy minimization strategy (Grandvalet & Bengio, 2005) argues that the unlabeled data can be used to ensured classes are well-separated, which can be achieved by encouraging the model to output low-entropy predictions. Pseudo-labeling (Lee, 2013) is one of the methods for implicit entropy minimization. Recently, holistic approaches (Berthelot et al., 2019b;a; Sohn et al., 2020a) combining both strategies have been proposed and achieved significant improvement. By redesigning the pseudo label, we propose an efficient one-stage semi-supervised learning framework of semantic segmentation for consistency training.
Semi-supervised semantic segmentation. Collecting pixel-level annotations for semantic segmentation is costly and prone to error. Hence, leveraging unlabeled data in semantic segmentation is a natural fit. Early methods utilize a GAN-based model either to generate additional training data (Souly et al., 2017) or to learn a discriminator between the prediction and the ground truth mask (Hung et al., 2018; Mittal et al., 2019). Consistency regularization based approaches have also been proposed recently, by enforcing the predictions to be consistent, either from augmented input images (French et al., 2020; Kim et al., 2020), perturbed feature embeddings (Ouali et al., 2020), or different networks (Ke et al., 2020). Recently, Luo & Yang (2020) proposes a dual-branch training network to jointly learn from pixel-accurate and coarse labeled data, achieving good segmentation performance. To push the performance of state of the arts, iterative self-training approaches (Chen et al., 2020a; Zoph et al., 2020; Zhu et al., 2020) have been proposed. These methods usually assume the available labeled data is enough to train a good teacher model, which will be used to generate pseudo labels for the student model. However, this condition might not satisfy in the low-data regime. Our proposed method, on the other hand, realizing the ideas of both consistency regularization and pseudo-labeling in segmentation, consistently improves the supervised baseline in both low-data and high-data regimes.
Weakly-supervised semantic segmentation. Instead of supervising network training with accurate pixel-level labels, many prior works exploit weaker forms of annotations (e.g., bounding boxes (Dai et al., 2015), scribbles (Lin et al., 2016), image-level labels). Most recent approaches use imagelevel labels as the supervisory signal, which exploits the idea of class activation map (CAM) (Zhou et al., 2016). Since the vanilla CAM only focus on the most discriminative region of objects, different ways to refine CAM have been proposed, including partial image/feature erasing (Hou et al., 2018; Wei et al., 2017; Li et al., 2018), using an additional saliency estimation model (Oh et al., 2017; Huang et al., 2018; Wei et al., 2018), utilizing pixel similarity to propagate the initial score map (Ahn & Kwak, 2018; Wang et al., 2020), or mining and co-segment the same category of objects across images (Sun et al., 2020; Zhang et al., 2020b). While achieving promising results using the approaches mentioned above, most of them require a multi-stage training strategy. The refined score maps are optimized again using a dense-CRF model (Krahenb ¨ uhl & Koltun ¨ , 2011), and then used as the target to train a separate segmentation network. On the other hand, we assume there exists a small number of fully-annotated data, which allows us to learn stronger segmentation models than general methods without needing pixel-labeled data.
 Figure 1: Overview of unlabeled data training branch. Given an image, the weakly augmented version is fed into the network to get the decoder prediction and Self-attention Grad-CAM (SGC). The two sources are then combined via a calibrated fusion strategy to form the pseudo label. The network is trained to make its decoder prediction from strongly augmented image to match the pseudo label by a per-pixel cross-entropy loss.
# 3 THE PROPOSED METHOD
In analogous to SSL for classification, our training objective in PseudoSeg consists of a supervised loss $\mathcal { L } _ { \mathrm { s } }$ applied to pixel-level labeled data $\mathcal { D } _ { l }$ , and a consistency constraint $\mathcal { L } _ { \mathrm { u } }$ applied to unlabeled data $\mathcal { D } _ { u }$ 1. Specifically, the supervised loss $\mathcal { L } _ { \mathrm { s } }$ is the standard pixel-wise cross-entropy loss on the weakly augmented pixel-level labeled examples:
$$\mathcal { L } _ { \mathrm { s } } = \frac { 1 } { N \times | \mathcal { D } _ { l } | } \sum _ { x \in \mathcal { D } _ { l } } \sum _ { i = 0 } ^ { N - 1 } \mathrm { C r o s s E n t r o p y } \left( y _ { i } , f _ { \theta } ( \omega ( x _ { i } ) ) \right) ,$$
where $\theta$ represents the learnable parameters of the network function $f$ and $N$ denotes the number of valid labeled pixels in an image $\boldsymbol { x } \in \mathbb { R } ^ { H \times W \times 3 }$ . $y _ { i } \in \mathbb { R } ^ { C }$ is the ground truth label of a pixel $i$ in $H \times W$ dimensions, and $f _ { \theta } ( \omega ( x _ { i } ) ) \in \mathbb { R } ^ { C }$ is the predicted probability of pixel $i$ , where $C$ is the number of classes to predict and $\omega ( \cdot )$ denotes the weak (common) data augmentation operations used by Chen et al. (2018).
During training, the proposed PseudoSeg estimates a pseudo label $\widetilde { y } \in \mathbb { R } ^ { H \times W \times C }$ for each stronglyaugmented unlabeled data $x$ in $\mathcal { D } _ { u }$ e, which is then used for computing the cross-entropy loss. The unsupervised objective can then be written as:
$$\mathcal { L } _ { \sf u } = \frac { 1 } { N \times | \mathcal { D } _ { u } | } \sum _ { x \in \mathcal { D } _ { u } } \sum _ { i = 0 } ^ { N - 1 } \mathrm { C r o s s E n t r o p y } \left( \widetilde { y } _ { i } , f _ { \theta } ( \beta \circ \omega ( x _ { i } ) ) \right) ,$$
where $\beta ( \cdot )$ denotes a stronger data augmentation operation, which will be described in Section 3.2. We illustrate the unlabeled data training branch in Figure 1.
# 3.1 THE DESIGN OF STRUCTURED PSEUDO LABELS
The next important question is how to generate the desirable pseudo label $\widetilde { y }$ . A straightforward soluetion is directly using the decoder output of a trained segmentation model after confidence thresholding, as suggested by Sohn et al. (2020a); Zoph et al. (2020); Xie et al. (2020); Sohn et al. (2020b). However, as we demonstrate later in the experiments, the generated pseudo hard/soft labels as well as other post-processing of outputs are barely satisfactory in the low-data regime, and thus yield inferior final results. To address this issue, our design of pseudo-labeling has two key insights. First, we seek for a distinct yet efficient decision mechanisms to compensate for the potential errors of decoder outputs. Second, wisely fusing multiple sources of predictions to generate an ensemble and better-calibrated version of pseudo labels.
Starting with localization. Compared with precise segmentation, learning localization is a simpler task as it only needs to provide coarser-grained outputs than pixel level of objects in images. Based on this motivation, we improve decoder predictions from the localization perspective. Class activation map (CAM) (Zhou et al., 2016) is a popular approach to provide localization for class-specific regions. CAM-based methods (Hou et al., 2018; Wei et al., 2017; Ahn & Kwak, 2018) have been successfully adopted to tackle a different weakly supervised semantic segmentation task from us, where they assume only image-level labels are available. In practice, we adopt a variant of class activation map, Grad-CAM (Selvaraju et al., 2017) in PseudoSeg.
From localization to segmentation. CAM estimates the strength of classifier responses on local feature maps. Thus, an inherent limitation of CAM-based approaches is that it is prone to attending only to the most discriminative regions. Although many weakly-supervised segmentation approaches (Ahn & Kwak, 2018; Ahn et al., 2019; Sun et al., 2020) aim at refining CAM localization maps to segmentation masks, most of them have complicated post-processing steps, such as dense CRF (Krahenb ¨ uhl & Koltun ¨ , 2011), which increases the model complexity when used for consistency training. Here we present a computationally efficient yet effective refinement alternative, which is learnable using available pixel-labeled data.
Although CAM only localizes partial regions of interests, if we know the pairwise similarities between regions, we can propagate the CAM scores from the discriminative regions to the rest unattended regions. Actually, it has been shown in many works that the learned high-level deep features are usually good at similarity measurements of visual objects. In this paper, we find hypercolumn (Hariharan et al., 2015) with a learnable similarity measure function works fairly effective.
Given the vanilla Grad-CAM output for all $C$ classes, which can be viewed as a spatially-flatten 2-D vector of weight $m \in \mathbb { R } ^ { L \times C }$ , where each row $m _ { i }$ is the response weight per class for one region $i$ . Using a kernel function $\mathcal { K } ( \cdot , \cdot ) : \mathbb { R } ^ { H } \times \mathbb { R } ^ { H } \mathbb { R }$ that measures element-wise similarity given feature $h \in { \bar { \mathbb { R } } } ^ { H }$ of two regions, the propagated score $\hat { m } _ { i } \in \mathbb { R } ^ { C }$ can be computed as follows
$$\hat { m } _ { i } = \left( m _ { i } + \sum _ { j = 0 } ^ { L - 1 } \frac { e ^ { K ( W _ { k } h _ { i } , W _ { v } h _ { j } ) } } { \sum _ { k = 0 } ^ { L - 1 } e ^ { K ( W _ { k } h _ { i } , W _ { v } h _ { k } ) } } m _ { j } \right) \cdot W _ { c } .$$
The goal of this function is to train $\Theta = \{ W _ { k } , W _ { v } \in \mathbb { R } ^ { H \times H } , W _ { c } \in \mathbb { R } ^ { C \times C } \}$ in order to propagate the high value in $m$ to all adjacent elements in the feature space $\mathbb { R } ^ { H }$ (i.e., hypercolumn features) to region $i$ . Adding $m _ { i }$ in equation 3 indicates the skip-connection. To compute propagated score for all regions, the operations in equation 3 can be efficiently implemented with self-attention dotproduct (Vaswani et al., 2017). For brevity, we denote this efficient refinement process output as selfattention Grad-CAM (SGC) maps in $\mathbb { R } ^ { H \times H \times C }$ . Figure 6 in Appendix A specifies the architecture.
Calibrated prediction fusion. SGC maps are obtained from low-resolution feature maps. It is then resized to the desired output resolution, and thus not sufficient at delineating crisp boundaries. However, compared to the segmentation decoder, SGC is capable of generating more locally-consistent masks. Thus, we propose a novel calibrated fusion strategy to take advantage of both decoder and SCG predictions for better pseudo labels.
Specifically, given a batch of decoder outputs (pre-softmax logits) $\hat { p } = f _ { \theta } ( \omega ( x ) )$ and SGC maps $\hat { m }$ computed from weakly-augmented data $\omega ( x )$ , we generate the pseudo labels $\widetilde { y }$ by
$$\mathcal { F } ( \hat { p } , \hat { m } ) = \mathrm { S h a r p e n } \left( \gamma \operatorname { S o f t m a x } \left( \frac { \hat { p } } { \operatorname { N o r m } ( \hat { p } , \hat { m } ) } \right) + ( 1 - \gamma ) \operatorname { S o f t m a x } \left( \frac { \hat { m } } { \operatorname { N o r m } ( \hat { p } , \hat { m } ) } \right) , T \right) .$$
Two critical procedures are proposed to use here to make the fusion process successful. First, $\hat { p }$ and $\hat { m }$ are from different decision mechanisms and they could have very different degrees of overconfidence. Therefore, we introduce the operation $\begin{array} { r } { \mathrm { N o r m } ( a , b ) = \sqrt { \sum _ { i } ^ { | a | } ( a _ { i } ^ { 2 } + b _ { i } ^ { 2 } ) } } \end{array}$ as a normalization factor. It alleviates the over-confident probability after softmax, which could unfavorably dominate the resulted $\gamma$ -averaged probability. Second, the distribution sharpening operation Sharpen $\begin{array} { r } { ( a , T ) _ { i } ~ = ~ a _ { i } ^ { 1 / T } / \sum _ { j } ^ { C } a _ { j } ^ { 1 / T } } \end{array}$ adjusts the temperature scalar $T$ of categorical distribution (Berthelot et al., 2019b; Chen et al., 2020b). Figure 2 illustrates the predictions from different sources. More importantly, we investigate the pseudo-labeling from a calibration perspective (Section 4.3), demonstrating that the proposed soft pseudo label $\widetilde { y }$ leads to a better calibration metric comparing to other possible fusion alternatives, and justifying why it benefits the final segmentation performance.
 Figure 2: Visualization of pseudo labels and other predictions. The generated pseudo label by fusing the predictions from the decoder and SGC map is used to supervise the decoder (strong) predictions of the strongly-augmented counterpart.
Training. Our final training objective contains two extra losses: a classification loss $\mathcal { L } _ { x }$ , and a segmentation loss $\mathcal { L } _ { s a }$ . First, to compute Grad-CAM, we add a one-layer classification head after the segmentation backbone and a multi-label classification loss $\mathcal { L } _ { x }$ . Second, as specified in Appendix A (Figure 6), SGC maps are scaled as pixel-wise probabilities using one-layer convolution followed by softmax in equation 3. Learning $\Theta$ to predict SGC maps needs pixel-labeled data $D _ { l }$ . It is achieved by an extra segmentation loss $\mathcal { L } _ { s a }$ between SGC maps of pixel-labeled data and corresponding ground truth. All the loss terms are jointly optimized (i.e., $\mathcal { L } _ { u } + \mathcal { L } _ { s } + \mathcal { L } _ { x } + \mathcal { L } _ { s a } )$ , while $\mathcal { L } _ { s a }$ only optimizes $\Theta$ (achieved by stopping gradient). See Figure 7 in the appendix for further details.
# 3.2 INCORPORATING IMAGE-LEVEL LABELS AND AUGMENTATION
The proposed PseudoSeg can easily incorporate image-level label information (if available) into our one-stage training framework, which also leads to consistent improvement as we demonstrate in experiments. We utilize the image-level data with two following steps. First, we directly use ground truth image-level labels to generate Grad-CAMs instead of using classifier outputs. Second, they are used to increase classification supervision beyond pixel-level labels for the classifier head.
For strong data augmentation, we simply follow color jittering operations from SimCLR (Chen et al., 2020b) and remove all geometric transformations. The overall strength of augmentation can be controlled by a scalar (studied in experiments). We also apply once random CutOut (DeVries & Taylor, 2017) with a region of $5 0 \times 5 0$ pixels since we find it gives consistent though minor improvement (pixels inside CutOut regions are ignored in computing losses).
# 4 EXPERIMENTAL RESULTS
We start by specifying the experimental details. Then, we evaluate the method in the settings of using pixel-level labeled data and unlabeled data, as well as using pixel-level labeled data and image-level labeled data, respectively. Next, we conduct various ablation studies to justify our design choices. Lastly, we conduct more comparative experiments in specific settings.
To evaluate the proposed method, we conduct the main experiments and ablation studies on the PASCAL VOC 2012 dataset (VOC12) (Everingham et al., 2015), which contains 21 classes including background. The standard VOC12 dataset has 1,449 images as the training set and 1,456 images as the validation set. We randomly subsample 1/2, 1/4, 1/8, and 1/16 of images in the standard training set to construct the pixel-level labeled data. The remaining images in the standard training set, together with the images in the augmented set (Hariharan et al., 2011) (around $9 \mathrm { k }$ images), are used as unlabeled or image-level labeled data. To further verify the effectiveness of the proposed method, we also conduct experiments on the COCO dataset (Lin et al., 2014). The COCO dataset has 118,287 images as the training set, and 5,000 images as the validation set. We evaluate on the 80 foreground classes and the background, as in the object detection task. As the COCO dataset is larger than VOC12, we randomly subsample smaller ratios, 1/32, 1/64, 1/128, 1/256, 1/512, of images from the training set to construct the pixel-level labeled data. The remaining images in the training set are used as unlabeled data or image-level labeled data. We evaluate the performance using the standard mean intersection-over-union (mIoU) metric. Implementation details can be found in Appendix B.
 Figure 3: Improvement over the strong supervised baseline, in a semi-supervised setting (w/ unlabeled data) on VOC12 val (left) and COCO val (right).
# 4.1 EXPERIMENTS USING PIXEL-LEVEL LABELED DATA AND UNLABELED DATA
Improvement over a strong baseline. We first demonstrate the effectiveness of the proposed method by comparing it with the DeepLabv $^ { 3 + }$ model trained with only the pixel-level labeled data. As shown in Figure 3 (a), the proposed method consistently outperforms the supervised training baseline on VOC12, by utilizing the pixel-level labeled data and the unlabeled data. The proposed method not only achieves a large performance boost in the low-data regime (when only $6 . 2 5 \%$ pixellevel labels available), but also improves the performance when the entire training set (1.4k images) is available. In Figure 3 (b), we again observe consistent improvement on the COCO dataset.
Comparisons with the others. Next, we compare the proposed method with recent state of the arts on both the public $1 . 4 \mathrm { k } / 9 \mathrm { k }$ split (in Table 1) and the created low-data splits (in Table 2), on VOC12. Our method compares favorably with the others.
Table 1: Comparison with state of the arts on VOC12 val set (w/ pixel-level labeled data and unlabeled data). We use the official training set (1.4k) as labeled data, and the augmented set (9k) as unlabeled data.
<table><tr><td>Method</td><td>Network</td><td>mIoU (%)</td></tr><tr><td>GANSeg (Souly et al., 2017)</td><td>VGG16</td><td>64.10</td></tr><tr><td>AdvSemSeg (Hung et al., 2018)</td><td>ResNet-101</td><td>68.40</td></tr><tr><td>CCT (Ouali et al., 2020)</td><td>ResNet-50</td><td>69.40</td></tr><tr><td>PseudoSeg (Ours)</td><td>ResNet-50</td><td>71.00</td></tr><tr><td>PseudoSeg (Ours)</td><td>ResNet-101</td><td>73.23</td></tr></table>
Table 2: Comparison with state of the arts on VOC12 val set (w/ pixel-level labeled data and unlabeled data) using low-data splits. The exact numbers of pixel-labeled images are shown in brackets. All the methods use ResNet-101 as backbone except CCT (Ouali et al., 2020), which uses ResNet-50. \* indicates implementation from Ke et al. (2020), \*\* indicates implementation from French et al. (2020).
<table><tr><td>Method</td><td>1/2 (732)</td><td>1/4 (366)</td><td>1/8 (183)</td><td>1/16 (92)</td></tr><tr><td>AdvSemSeg (Hung et al., 2018)</td><td>65.27</td><td>59.97</td><td>47.58</td><td>39.69</td></tr><tr><td>CCT (Ouali et al., 2020)</td><td>62.10</td><td>58.80</td><td>47.60</td><td>33.10</td></tr><tr><td>*MT (Tarvainen & Valpola, 2017)</td><td>69.16</td><td>63.01</td><td>55.81</td><td>48.70</td></tr><tr><td>GCT (Ke et al., 2020)</td><td>70.67</td><td>64.71</td><td>54.98</td><td>46.04</td></tr><tr><td> **VAT (Miyato et al., 2018)</td><td>63.34</td><td>56.88</td><td>49.35</td><td>36.92</td></tr><tr><td>CutMix (French et al., 2020)</td><td>69.84</td><td>68.36</td><td>63.20</td><td>55.58</td></tr><tr><td>PseudoSeg (Ours)</td><td>72.41</td><td>69.14</td><td>65.50</td><td>57.60</td></tr></table>
 Figure 4: Improvement over the strong supervised baseline, in a semi-supervised setting (w/ image-level labeled data) on VOC12 val (left) and COCO val (right).
Table 3: Comparison with state of the arts on VOC12 val set (w/ pixel-level labeled data and image-level labeled data). We use the official training set (1.4k) as labeled data, and the augmented set (9k) as image-level labeled data.
<table><tr><td>Method</td><td>Model</td><td>Network</td><td>mIoU (%)</td></tr><tr><td>WSSN (Papandreou et al., 2015)</td><td>DeepLab-CRF</td><td>VGG16</td><td>64.60</td></tr><tr><td>GAIN (Li et al., 2018)</td><td>DeepLab-CRF-LFOV</td><td>VGG16</td><td>60.50</td></tr><tr><td>MDC (Wei et al.,2018)</td><td>DeepLab-CRF-LFOV</td><td>VGG16</td><td>65.70</td></tr><tr><td>DSRG (Huang et al.,2018)</td><td>DeepLabv2</td><td>VGG16</td><td>64.30</td></tr><tr><td>GANSeg (Souly et al.,2017)</td><td>FCN</td><td>VGG16</td><td>65.80</td></tr><tr><td>FickleNet (Lee et al.,2019)</td><td>DeepLabv2</td><td>ResNet-101</td><td>65.80</td></tr><tr><td>CCT (Ouali et al., 2020)</td><td>PSP-Net</td><td>ResNet-50</td><td>73.20</td></tr><tr><td>PseudoSeg (Ours)</td><td>DeepLabv3+</td><td>ResNet-50</td><td>73.80</td></tr></table>
Table 4: Comparison with state of the arts on VOC12 val set with pixel-level labeled data and image-level labeled data. Four ratios of pixel-level labeled examples are tested. Both CCT (Ouali et al., 2020) and our method use ResNet-50 as backbone.
<table><tr><td>Split</td><td>CCT</td><td>PseudoSeg</td></tr><tr><td>1/2</td><td>66.80</td><td>73.51</td></tr><tr><td>1/4</td><td>67.60</td><td>71.79</td></tr><tr><td>1/8</td><td>62.50</td><td>69.15</td></tr><tr><td>1/16</td><td>51.80</td><td>65.44</td></tr></table>
Similar to semi-supervised learning using pixel-level labeled data and unlabeled data, we first demonstrate the efficacy of our method by comparing it with a strong supervised baseline. As shown in Figure 4, the proposed method consistently improves the strong baseline on both datasets. In Table 3, we evaluate on the public $1 . 4 \mathrm { k } / 9 \mathrm { k }$ split. The proposed method compares favorably with the other methods. Moreover, we further compare to best compared CCT on the created low-data splits (in Table 4). Both experiments show that the proposed PseudoSeg is more robust than the compared method given less data. On all splits on both datasets, using pixel-level labeled data and image-labeled data shows higher mIoU than the setting using pixel-level labeled data and unlabeled data.
# 4.3 ABLATION STUDY
In this section, we conduct extensive ablation experiments on VOC12 to validate our design choices.
How to construct pseudo label? We investigate the effectiveness of the proposed pseudo labeling. Table 5 demonstrates quantitative results, indicating that using either decoder output or SGC alone gives an inferior performance. Naively using decoder output as pseudo labels can hardly work well. The proposed fusion consistently performs better, either with or without additional image-level labels. To further answer why our pseudo labels are effective, we study from the model calibration perspective. We measure the expected calibration error (ECE) (Guo et al., 2017) scores of all the intermediate steps and other fusion variants. As shown in Figure 5 (a), the proposed fusion strategy (denoted as G in the figure) achieves the lowest ECE scores, indicating that the significance of jointly using normalization with sharpening (see equation 4) compared with other fusion alternatives. We hypothesize using well-calibrated soft labels makes model training less affected by label noises. The comprehensive calibration study is left as a future exploration direction.
Using hypercolumn feature or not? In Figure 5 (b), we study the effectiveness of using hypercolumn features instead of the last feature maps in equation 3. We conduct the experiments on the 1/16 split of VOC12. As we can see, hypercolumn features substantially improve performance.
Soft or hard pseudo label? How to utilize predictions as pseudo labels remains an active question in SSL. Next, we study whether we should use soft or hard one-hot pseudo labels. We conduct the experiments in the setting where pixel-level labeled data and image-level labeled data are available. As shown in Figure 5 (c), using all predictions as soft pseudo label yields better performance than selecting confident predictions. This suggests that well-calibrated soft pseudo labels might be important in segmentation than over-simplified confidence thresholding.
Table 5: Comparison to alternative pseudo labeling strategies. We conduct experiments using 1/4, 1/8, 1/16 of the pixel-level labeled data, the exact numbers of images are shown in the brackets.
<table><tr><td>Source</td><td>Using image-level labels</td><td>1/4 (366)</td><td>1/8 (183)</td><td>1/16 (92)</td></tr><tr><td>Decoder only</td><td></td><td>70.22</td><td>69.35</td><td>53.20</td></tr><tr><td>SGC only</td><td></td><td>67.07</td><td>62.61</td><td>53.42</td></tr><tr><td>Calibrated fusion</td><td></td><td>73.79</td><td>73.13</td><td>67.06</td></tr><tr><td>Decoder only</td><td></td><td>73.95</td><td>73.05</td><td>67.54</td></tr><tr><td>SGC only</td><td></td><td>71.73</td><td>67.57</td><td>64.26</td></tr><tr><td>Calibrated fusion</td><td></td><td>75.29</td><td>74.70</td><td>71.22</td></tr></table>
 Figure 5: Ablation studies on different factors. See Section 4.3 for complete details.
Temperature sharpening or not? We study the effect of temperature sharpening in equation 4. We conduct the experiments in the setting where pixel-level labeled data and image-level labeled data are available. As shown in Figure 5 (d), temperature sharpening shows consistent and clear improvements.
Strong augmentation strength. In Figure 5 (e), we study the effects of color jittering in the strong augmentation. The magnitude of jittering strength is controlled by a scalar (Chen et al., 2020b). We conduct the experiments in the setting where pixel-level labeled data and unlabeled data are available. If the magnitude is too small, performance drops significantly, suggesting the importance of strong augmentation.
Impact of different feature backbones. In Figure 5 (f), we compare the performance of using ResNet-50, ResNet-101, and Xception-65 as backbone architectures, respectively. We conduct the experiments in the setting where pixel-level labeled data and unlabeled data are available. As we can see, the proposed method consistently improves the baseline by a substantial margin across different backbone architectures.
# 4.4 COMPARISON WITH SELF-TRAINING
Several recent approaches (Chen et al., 2020a; Zoph et al., 2020) exploit the Student-Teacher selftraining idea to improve the performance with additional unlabeled data. However, these methods only apply self-training in the high-data regime (i.e., sufficient pixel-labeled data to train teachers).
Table 6: Comparison with self-training. We use our supervised baseline as the teacher to generate one-hot pseudo labels, following Zoph et al. (2020).
<table><tr><td>Method</td><td>Using image-level labels</td><td>1/4 (366)</td><td>1/8 (183)</td><td>1/16 (92)</td></tr><tr><td>Supervised (Teacher)</td><td></td><td>70.20</td><td>64.00</td><td>56.03</td></tr><tr><td>Self-training (Student)</td><td>1</td><td>72.85</td><td>69.88</td><td>64.20</td></tr><tr><td>PseudoSeg (Ours)</td><td>-</td><td>73.79</td><td>73.13</td><td>67.06</td></tr><tr><td>PseudoSeg (Ours)</td><td>√</td><td>75.29</td><td>74.70</td><td>71.22</td></tr></table>
Here we compare these methods in the low-data regimes, where we focus on. To generate offline pseudo labels, we closely follow segmentation experiments in Zoph et al. (2020): pixels with a confidence score higher than 0.5 will be used as one-hot pseudo labels, while the remaining are treated as ignored regions. This step is considered important to suppress noisy labels. A student model is then trained using the combination of unlabeled data in VOC12 train and augmented sets with generated one-hot pseudo labels and all the available pixel-level labeled data. As shown in Table 6, although the self-training pretty well improves over the supervised baseline, it is inferior to the proposed method 2. We conjecture that the teacher model usually produces low confidence scores to pixels around boundaries, so pseudo labels of these pixels are filtered in student training. However, boundary pixels are important for improving the performance of segmentation (Kirillov et al., 2020). On the other hand, the design of our method (online soft pseudo labeling process) bypass this challenge. We will conduct more verification of this hypothesis in future work.
# 5 IMPROVING THE FULLY-SUPERVISED METHOD WITH ADDITIONAL DAT
We have validated the effectiveness of the proposed method in the low-data regime. In this section, we want to explore whether the proposed method can further improve supervised training in the full training set using additional data. We use the training set (1.4k) in VOC12 as the pixel-level labeled data. The additional data contains additional VOC 9k $( V _ { 9 k } )$ , COCO training set $( C _ { t r } )$ , and COCO unlabeled data $( C _ { u } )$ . More training details can be found in Appendix D. As shown in Table 7, the proposed PseudoSeg is able to improve upon the supervised baseline even in the high-data regime, using additional unlabeled or image-level labeled data.
Table 7: Improving fully supervised model with extra data. No test-time augmentation is used.
<table><tr><td>Method</td><td></td><td colspan="2">Baseline丨PseudoSeg (w/o image-level labels)丨PseudoSeg (w/image-level labels)</td><td colspan="2"></td></tr><tr><td>Extra data</td><td>1</td><td>Ctr+Cu</td><td>Ctr + Cu + V9k</td><td>Ctr</td><td>Ctr +Vgk</td></tr><tr><td>mIoU (%)</td><td>76.96</td><td>77.40 (+0.44)</td><td>78.20 (+1.24)</td><td>77.80 (+0.84)</td><td>79.28 (+2.32)</td></tr></table>
# 5 DISCUSSION AND CONCLUSION
The key to the good performance of our method in the low-data regime is the novel re-design of pseudo-labeling strategy, which pursues a different decision mechanism from weakly-supervised localization to “remedy” weak predictions from segmentation head. Then augmentation consistency training progressively improves segmentation head quality. For the first time, we demonstrate that, with well-calibrated soft pseudo labels, utilizing unlabeled or image-labeled data significantly improves segmentation at low-data regimes. Further exploration of fusing stronger and better-calibrated pseudo labels worth more study as future directions (e.g., multi-scaling). Although color jittering works within our method as strong data augmentation, we have extensively explored geometric augmentations (leveraging STN (Jaderberg et al., 2015) to align pixels in pseudo labels and strongly-augmented predictions) for segmentation but find it not helpful. We believe data augmentation needs re-thinking beyond current success in classification for segmentation usage.
# ACKNOWLEDGEMENT
We thank Liang-Chieh Chen and Barret Zoph for their valuable comments.
# REFERENCES
Jiwoon Ahn and Suha Kwak. Learning pixel-level semantic affinity with image-level supervision for weakly supervised semantic segmentation. In CVPR, 2018. 3, 4
Jiwoon Ahn, Sunghyun Cho, and Suha Kwak. Weakly supervised learning of instance segmentation with inter-pixel relations. In CVPR, 2019. 4, 14
David Berthelot, Nicholas Carlini, Ekin D Cubuk, Alex Kurakin, Kihyuk Sohn, Han Zhang, and Colin Raffel. Remixmatch: Semi-supervised learning with distribution matching and augmentation anchoring. In ICLR, 2019a. 2
David Berthelot, Nicholas Carlini, Ian Goodfellow, Nicolas Papernot, Avital Oliver, and Colin A Raffel. Mixmatch: A holistic approach to semi-supervised learning. In NeurIPS, 2019b. 1, 2, 5
Liang-Chieh Chen, Yukun Zhu, George Papandreou, Florian Schroff, and Hartwig Adam. Encoder-decoder with atrous separable convolution for semantic image segmentation. In ECCV, 2018. 1, 3, 15
Liang-Chieh Chen, Raphael Gontijo Lopes, Bowen Cheng, Maxwell D Collins, Ekin D Cubuk, Barret Zoph, Hartwig Adam, and Jonathon Shlens. Naive-student: Leveraging semi-supervised learning in video sequences for urban scene segmentation. In ECCV, 2020a. 1, 2, 8
Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In ICML, 2020b. 5, 8
Franc¸ois Chollet. Xception: Deep learning with depthwise separable convolutions. In CVPR, 2017. 13
Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In CVPR, 2016. 15
Jifeng Dai, Kaiming He, and Jian Sun. Boxsup: Exploiting bounding boxes to supervise convolutional networks for semantic segmentation. In ICCV, 2015. 2
Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017. 5
Mark Everingham, SM Ali Eslami, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes challenge: A retrospective. IJCV, 111(1):98–136, 2015. 5
Geoff French, Timo Aila, Samuli Laine, Michal Mackiewicz, and Graham Finlayson. Semi-supervised semantic segmentation needs strong, high-dimensional perturbations. In BMVC, 2020. 2, 6, 15
Yves Grandvalet and Yoshua Bengio. Semi-supervised learning by entropy minimization. In NeurIPS, 2005. 2
Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. ICML, 2017. 7
Bharath Hariharan, Pablo Arbelaez, Lubomir Bourdev, Subhransu Maji, and Jitendra Malik. Semantic contours ´ from inverse detectors. In ICCV, 2011. 5
Bharath Hariharan, Pablo Arbelaez, Ross Girshick, and Jitendra Malik. Hypercolumns for object segmentation ´ and fine-grained localization. In CVPR, 2015. 4
Qibin Hou, PengTao Jiang, Yunchao Wei, and Ming-Ming Cheng. Self-erasing network for integral object attention. In NeurIPS, 2018. 3, 4
Zilong Huang, Xinggang Wang, Jiasi Wang, Wenyu Liu, and Jingdong Wang. Weakly-supervised semantic segmentation network with deep seeded region growing. In CVPR, 2018. 3, 7
Wei-Chih Hung, Yi-Hsuan Tsai, Yan-Ting Liou, Yen-Yu Lin, and Ming-Hsuan Yang. Adversarial learning for semi-supervised semantic segmentation. In BMVC, 2018. 2, 6
Max Jaderberg, Karen Simonyan, Andrew Zisserman, et al. Spatial transformer networks. In NeurIPS, 2015. 9
Peng-Tao Jiang, Qibin Hou, Yang Cao, Ming-Ming Cheng, Yunchao Wei, and Hong-Kai Xiong. Integral object mining via online attention accumulation. In ICCV, 2019. 14
Zhanghan Ke, Di Qiu, Kaican Li, Qiong Yan, and Rynson WH Lau. Guided collaborative training for pixel-wise semi-supervised learning. In ECCV, 2020. 2, 6
Jongmok Kim, Jooyoung Jang, and Hyunwoo Park. Structured consistency loss for semi-supervised semantic segmentation. arXiv preprint arXiv:2001.04647, 2020. 2 Alexander Kirillov, Yuxin Wu, Kaiming He, and Ross Girshick. Pointrend: Image segmentation as rendering. In CVPR, 2020. 9 Philipp Krahenb ¨ uhl and Vladlen Koltun. Efficient inference in fully connected crfs with gaussian edge poten- ¨ tials. In NeurIPS, 2011. 3, 4 Chia-Wen Kuo, Chih-Yao Ma, Jia-Bin Huang, and Zsolt Kira. Featmatch: Feature-based augmentation for semi-supervised learning. In ECCV, 2020. 1 Samuli Laine and Timo Aila. Temporal ensembling for semi-supervised learning. In ICLR, 2016. 2 Dong-Hyun Lee. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In ICML Workshop, 2013. 2 Jungbeom Lee, Eunji Kim, Sungmin Lee, Jangho Lee, and Sungroh Yoon. Ficklenet: Weakly and semisupervised semantic image segmentation using stochastic inference. In CVPR, 2019. 7, 14 Kunpeng Li, Ziyan Wu, Kuan-Chuan Peng, Jan Ernst, and Yun Fu. Tell me where to look: Guided attention inference network. In CVPR, 2018. 3, 7 Di Lin, Jifeng Dai, Jiaya Jia, Kaiming He, and Jian Sun. Scribblesup: Scribble-supervised convolutional networks for semantic segmentation. In CVPR, 2016. 2 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 ECCV, 2014. 5 Wenfeng Luo and Meng Yang. Semi-supervised semantic segmentation via strong-weak dual-branch network. In ECCV, 2020. 2 Sudhanshu Mittal, Maxim Tatarchenko, and Thomas Brox. Semi-supervised semantic segmentation with highand low-level consistency. TPAMI, 2019. 2 Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, and Shin Ishii. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. TPAMI, 41(8):1979–1993, 2018. 2, 6 Seong Joon Oh, Rodrigo Benenson, Anna Khoreva, Zeynep Akata, Mario Fritz, and Bernt Schiele. Exploiting saliency for object segmentation from image level labels. In CVPR, 2017. 3 Yassine Ouali, Celine Hudelot, and Myriam Tami. Semi-supervised semantic segmentation with cross- ´ consistency training. In CVPR, 2020. 2, 6, 7 George Papandreou, Liang-Chieh Chen, Kevin P Murphy, and Alan L Yuille. Weakly-and semi-supervised learning of a deep convolutional network for semantic image segmentation. In ICCV, 2015. 7 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, 115(3):211–252, 2015. 13 Mehdi Sajjadi, Mehran Javanmardi, and Tolga Tasdizen. Regularization with stochastic transformations and perturbations for deep semi-supervised learning. In NeurIPS, 2016. 2 Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Visual explanations from deep networks via gradient-based localization. In ICCV, 2017. 4 Kihyuk Sohn, David Berthelot, Chun-Liang Li, Zizhao Zhang, Nicholas Carlini, Ekin D Cubuk, Alex Kurakin, Han Zhang, and Colin Raffel. Fixmatch: Simplifying semi-supervised learning with consistency and confidence. In NeurIPS, 2020a. 1, 2, 4 Kihyuk Sohn, Zizhao Zhang, Chun-Liang Li, Han Zhang, Chen-Yu Lee, and Tomas Pfister. A simple semisupervised learning framework for object detection. arXiv preprint arXiv:2005.04757, 2020b. 4 Nasim Souly, Concetto Spampinato, and Mubarak Shah. Semi supervised semantic segmentation using generative adversarial network. In ICCV, 2017. 2, 6, 7 Guolei Sun, Wenguan Wang, Jifeng Dai, and Luc Van Gool. Mining cross-image semantics for weakly supervised semantic segmentation. In ECCV, 2020. 3, 4, 14 Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In NeurIPS, 2017. 1, 2, 6 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. 4 Yude Wang, Jie Zhang, Meina Kan, Shiguang Shan, and Xilin Chen. Self-supervised equivariant attention mechanism for weakly supervised semantic segmentation. In CVPR, 2020. 3, 14 Yunchao Wei, Jiashi Feng, Xiaodan Liang, Ming-Ming Cheng, Yao Zhao, and Shuicheng Yan. Object region mining with adversarial erasing: A simple classification to semantic segmentation approach. In CVPR, 2017. 3, 4 Yunchao Wei, Huaxin Xiao, Honghui Shi, Zequn Jie, Jiashi Feng, and Thomas S Huang. Revisiting dilated convolution: A simple approach for weakly-and semi-supervised semantic segmentation. In CVPR, 2018. 3, 7 Qizhe Xie, Zihang Dai, Eduard Hovy, Minh-Thang Luong, and Quoc V. Le. Unsupervised data augmentation for consistency training. arXiv preprint arXiv:1904.12848, 2019. 1 Qizhe Xie, Minh-Thang Luong, Eduard Hovy, and Quoc V Le. Self-training with noisy student improves imagenet classification. In CVPR, 2020. 4 Hang Zhang, Chongruo Wu, Zhongyue Zhang, Yi Zhu, Zhi Zhang, Haibin Lin, Yue Sun, Tong He, Jonas Muller, R. Manmatha, Mu Li, and Alexander Smola. Resnest: Split-attention networks. arXiv preprint arXiv:2004.08955, 2020a. 1 Xiaolin Zhang, Yunchao Wei, and Yi Yang. Inter-image communication for weakly supervised localization. In ECCV, 2020b. 3 Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Learning deep features for discriminative localization. In CVPR, 2016. 2, 4 Yi Zhu, Zhongyue Zhang, Chongruo Wu, Zhi Zhang, Tong He, Hang Zhang, R Manmatha, Mu Li, and Alexander Smola. Improving semantic segmentation via self-training. arXiv preprint arXiv:2004.14960, 2020. 2 Barret Zoph, Golnaz Ghiasi, Tsung-Yi Lin, Yin Cui, Hanxiao Liu, Ekin D Cubuk, and Quoc V Le. Rethinking pre-training and self-training. arXiv preprint arXiv:2006.06882, 2020. 1, 2, 4, 8, 9
# APPENDIX
# A SELF-ATTENTION GRAD-CAM
We elaborate the detailed pipeline of generating Self-attention Grad-CAM (SGC) maps (equation 3) in Figure 6. To construct the hypercolumn feature, we extract the feature maps from the last two convolutional stages of the backbone network and concatenate them together. We then project the hypercolumn feature to two separate low-dimension embedding spaces to construct “key” and “query”, using two $1 \times 1$ convolutional layers. An attention matrix can then be computed via matrix multiplication of “key” and “query”. To construct “value”, we compute Grad-CAM for each foreground class and then concatenate them together. This results in a $H \times W \times ( C - 1 )$ score map, where the maximum score of each category is normalized to one separately. We then use image-level labels (either from classifier prediction or ground truth annotation) to set the score maps of non-existing classes to be zero. For each pixel localization, we use one to subtract the maximum score to construct the background score map, which is then concatenated with the foreground score maps to form “value” $( H \times W \times C )$ . The attention score matrix can then be used to reweight and propagate the scores in “value”. The propagated score is added back to the “value” score map, and the pass through a $1 \times 1$ convolution (w/ batch normalization) to output the SGC map.
 Figure 6: Diagram of Self-attention Grad-CAM (SGC) .
# B IMPLEMENTATION DETAILS
We implement our method on top of the publicly available official DeepLab codebase.3 Unless specified, we adopt the DeepLabv $^ { 3 + }$ model with Xception-65 (Chollet, 2017) as the feature backbone, which is pre-trained on the ImageNet dataset (Russakovsky et al., 2015). We train our model following the default hyper-parameters (e.g., an initial learning rate of 0.007 with a polynomial learning rate decay schedule, a crop size of $5 1 3 \times 5 1 3$ , and an encoder output stride of 16), using 16 GPUs 4. We use a batch size of 4 for each GPU for pixel-level labeled data, and 4 for unlabeled/image-level labeled data. For VOC12, we train the model for 30,000 iterations. For COCO, we train the model for 200,000 iterations. We set $\gamma = 0 . 5$ and $T = 0 . 5$ unless specified. We do not apply any test time augmentations.
# C LOW-DATA SAMPLING IN PASCAL VOC 2012
Unlike random sampling in image classification, it is difficult to sample uniformly in a low-data case for semantic segmentation due to the imbalance of rare classes. To avoid the missing classes at extremely low data regimes, we repeat the random sampling process for 1/16 three times (while ensuring each class has a certain amount) and report the results. We use Split 1 in the main manuscript. All splits will be released to encourage reproducibility. The results of all the three splits are shown as in Table 8.
 Figure 7: Training. For each network component, we show the loss supervision and the corresponding data.
Table 8: Full results of 1/16 split in VOC12.
<table><tr><td>Method</td><td>Using image-level labels</td><td>Split 1</td><td>Split 2</td><td>Split 3</td></tr><tr><td>Supervised</td><td>■</td><td>56.03</td><td>56.87</td><td>55.92</td></tr><tr><td>PseudoSeg (Ours)</td><td>1</td><td>67.06</td><td>64.12</td><td>66.09</td></tr><tr><td>PseudoSeg (Ours)</td><td>√</td><td>71.22</td><td>68.11</td><td>69.72</td></tr></table>
# D HIGH-DATA EXPERIMENTAL SETTINGS
Here we provide more details about the experiments in Section 4.5. Since we have a lot more unlabeled/image-level labeled data, we adopt a longer training schedule (90,000 iterations) 5. We also adopt a slightly different fusion strategy in this setting by using $T = 0 . 7$ and $\gamma = 0 . 3$ .
# E COMPARISON WITH WEAKLY-SUPERVISED APPROACHES
In Table 9, we benchmark recent weakly supervised semantic segmentation performance on PASCAL VOC 2012 val set. Instead of enforcing the consistency between different augmented images as we do, these approaches tackle the semantic segmentation task from a different perspective, by exploiting the weaker annotations (image-level labels). As we can see, by exploiting the imagelevel labels with careful designs, weakly-supervised semantic segmentation methods could achieve reasonably well performance. We believe that both perspectives are feasible and promising for low-data regime semantic segmentation tasks, and complementary to each other. Therefore, these designs could be potentially integrated into our framework to generate better pseudo labels, which leads to improved performance.
Table 9: Benchmarking state-of-the-art weakly supervised semantic segmentation methods. All the methods use image-level labels from VOC12 training (1.4k) and augmented (9k) sets.
<table><tr><td>Method</td><td>Pixel-level labeled data</td><td>mIoU (%)</td></tr><tr><td>FickleNet (Lee et al., 2019)</td><td></td><td>64.9</td></tr><tr><td>IRNet (Ahn et al., 2019)</td><td></td><td>63.5</td></tr><tr><td>OAA+ (Jiang et al., 2019)</td><td></td><td>65.2</td></tr><tr><td>SEAM (Wang et al., 2020)</td><td></td><td>64.5</td></tr><tr><td>MCIS (Sun et al., 2020)</td><td></td><td>66.2</td></tr><tr><td>PseudoSeg (Ours)</td><td>1/16 (92)</td><td>71.22</td></tr></table>
# F PERFORMANCE ANALYSIS FOR TEMPERATURE SHARPENING
We conduct an additional performance analysis for temporal sharpening. We conduct experiments over T on the 1/16 split of VOC using pixel-level labeled data and image-level labeled data. As shown in Table 10, adopting a $T < 1$ for distribution sharpening generally leads to improved performance.
Table 10: Performance analysis over T.
<table><tr><td>Temperature (T)</td><td>mIoU (%)</td></tr><tr><td>0.1</td><td>71.11</td></tr><tr><td>0.3</td><td>70.11</td></tr><tr><td>0.5 (default)</td><td>71.22</td></tr><tr><td>0.7</td><td>72.37</td></tr><tr><td>1.0 (no sharpening)</td><td>68.15</td></tr></table>
# G EXPERIMENTS ON CITYSCAPES
In this section, we conduct additional experiments on the Cityscapes dataset (Cordts et al., 2016). The Cityscapes dataset contains 50 real-world driving sequences. Among these video sequences, 2,975 frames are selected as the training set, and 500 frames are selected as the validation set. Following previous common practice, we evaluate on 19 semantic classes.
Comparison with state of the art. We compare our method with the current state-of-the-art method (French et al., 2020), in the setting of using pixel-level labeled and unlabeled data. We randomly subsample 1/4, 1/8, and 1/30 of the training set to construct the pixel-level labeled data, using the first random seed provided by French et al. (2020). Both French et al. (2020) and our method use ResNet-101 as the feature backbone and DeepLabv $^ { 3 + }$ (Chen et al., 2018) as the segmentation model. As shown in Table 11, the proposed method achieves promising results on all the three label ratios.
Table 11: Experiments on Cityscapes (w/ pixel-level labeled data and unlabeled data).
<table><tr><td>Method</td><td>1/4 (744)</td><td>1/8 (372)</td><td>1/30 (100)</td></tr><tr><td>CutMix (French et al., 2020)</td><td>68.33</td><td>65.82</td><td>55.71</td></tr><tr><td>PseudoSeg (Ours)</td><td>72.36</td><td>69.81</td><td>60.96</td></tr></table>
Per-class performance analysis. Next, we provide per-class performance break down analysis. We compare our method with the supervised baseline on the 1/30 split, using pixel-level labeled data and unlabeled data. As shown in Table 12, the distribution of the labeled pixels is severely imbalanced. Although our method does not in particular address the data imbalance issue, our method improves upon the supervised baseline on most of the classes (except for “Wall” and “Pole”).
Table 12: Per-class performance analysis on Cityscapes (w/ pixel-level labeled data and unlabeled data).
<table><tr><td>Class Pixel ratio (%)</td><td>Road 36.36</td><td>Sidewalk 5.61</td><td>Building 20.99</td><td>Wall 0.53</td><td>Fence 0.98</td><td>Pole 1.19</td><td>Traffic light 0.14</td><td>Traffic sign 0.51</td><td>Vegetation 19.61</td><td>Terrain 1.29</td></tr><tr><td>Supervised PseudoSeg (Ours)</td><td>96.03</td><td>71.26</td><td>87.53</td><td>19.75</td><td>29.11</td><td>52.19</td><td>50.19</td><td>68.09</td><td>89.93</td><td>45.79</td></tr><tr><td></td><td>96.64</td><td>75.06</td><td>88.63</td><td>19.67</td><td>34.09</td><td>51.75</td><td>58.19</td><td>69.95</td><td>90.43</td><td>50.48</td></tr><tr><td>Class</td><td>Sky</td><td>Person</td><td>Rider</td><td>Car</td><td>Truck</td><td>Bus</td><td>Train</td><td>Motorcycle</td><td>Bicycle</td><td></td></tr><tr><td>Pixel ratio (%)</td><td>3.70</td><td>1.10</td><td>0.16</td><td>6.49</td><td>0.38</td><td>0.13</td><td>0.23</td><td>0.06</td><td>0.54</td><td></td></tr><tr><td>Supervised</td><td>91.01</td><td>74.12</td><td>43.91</td><td>89.91</td><td>7.68</td><td>14.19</td><td>17.78</td><td>25.86</td><td>69.88</td><td></td></tr><tr><td>PseudoSeg (Ours)</td><td>92.99</td><td>75.16</td><td>46.09</td><td>91.60</td><td>20.39</td><td>26.30</td><td>22.13</td><td>43.96</td><td>71.30</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
Discussion. Although the scene layouts are quite similar for all the full images, it is still feasible to generate different image-level labels through a more aggressive geometric data augmentation (e.g., scaling, cropping, translation, etc.). In practice, standard segmentation preprocessing steps only crop a sub-region of the whole training images. It only contains partial images with a certain subset of image labels, making the training batches have diverse image-level labels (converted from pixellevel labels, in the fully-labeled+unlabeled setting). Moreover, in the fully-labeled+weakly-labeled setting, in practice, we can collect diverse Internet images and weakly label them, instead of weakly labeling images from Cityscapes.
# H QUALITATIVE RESULTS
We visualize several model prediction results for PASCAL VOC 2012 (Figure 8) and COCO (Figure 9). As we can see, the supervised baseline struggles to segment some of the categories and small objects, when trained in the low-data regime. On the other hand, PseudoSeg utilizes unlabeled or weakly-labeled data to generate more satisfying predictions.
 Figure 8: Qualitative results of PASCAL VOC 2012. Models are trained with 1/16 pixel-level labeled data in the training set.
 Figure 9: Qualitative results of COCO. Models are trained with 1/512 pixel-level labeled data in the training set. Note that white pixel in the ground truth indicates this pixel is not annotated for evaluation.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311# A UNIVERSAL REPRESENTATION TRANSFORMER LAYER FOR FEW-SHOT IMAGE CLASSIFICATION
Lu $\mathbf { L i u ^ { 1 , 2 * } }$ , William Hamilton $^ { 1 , 3 }$ †, Guodong Long2, Jing Jiang2, Hugo Larochelle1,4† 1 Mila, 2 Australian AI Institute, UTS, 3 McGill University, 4 Google Research, Brain Team Correspondence to lu.liu.cs@icloud.com
# ABSTRACT
Few-shot classification aims to recognize unseen classes when presented with only a small number of samples. We consider the problem of multi-domain few-shot image classification, where unseen classes and examples come from diverse data sources. This problem has seen growing interest and has inspired the development of benchmarks such as Meta-Dataset. A key challenge in this multi-domain setting is to effectively integrate the feature representations from the diverse set of training domains. Here, we propose a Universal Representation Transformer (URT) layer, that meta-learns to leverage universal features for few-shot classification by dynamically re-weighting and composing the most appropriate domain-specific representations. In experiments, we show that URT sets a new state-of-the-art result on Meta-Dataset. Specifically, it achieves top-performance on the highest number of data sources compared to competing methods. We analyze variants of URT and present a visualization of the attention score heatmaps that sheds light on how the model performs cross-domain generalization. Our code is available at https://github.com/liulu112601/URT.
# 1 INTRODUCTION
Learning tasks from small data remains a challenge for machine learning systems, which show a noticeable gap compared to the ability of humans to understand new concepts from few examples. A promising direction to address this challenge is developing methods that are capable of performing transfer learning across the collective data of many tasks. Since machine learning systems generally improve with the availability of more data, a natural assumption is that few-shot learning systems should benefit from leveraging data across many different tasks and domains—even if each individual task has limited training data available.
This research direction is well captured by the problem of multi-domain few-shot classification. In this setting, training and test data spans a number of different domains, each represented by a different source dataset. A successful approach in this multi-domain setting must not only address the regular challenge of few-shot classification—i.e., the challenge of having only a handful of examples per class. It must also discover how to leverage (or ignore) what is learned from different domains, achieving generalization and avoiding cross-domain interference.
Recently, Triantafillou et al. (2020) proposed a benchmark for multi-domain few-shot classification, Meta-Dataset, and highlighted some of the challenges that current methods face when training data is heterogeneous. Crucially, they found that methods which trained on all available domains would normally obtain improved performance on some domains at the expense of others. Following on their work, progress has been made, which includes the design of adapted hyper-parameter optimization strategies (Saikia et al., 2020) and more flexible meta-learning algorithms (Requeima et al., 2019). Most notable is SUR (Selecting Universal Representation) (Dvornik et al., 2020), a method that relies on a so-called universal representation, extracting from a collection of pre-trained and domain-specific neural network backbones. SUR prescribes a hand-crafted feature-selection procedure to infer how to weight each backbone for each task at hand, and produces an adapted representation for each task. This was shown to lead to some of the best performances on Meta-Dataset.
In SUR, the classification procedure for each task is fixed and not learned. Thus, except for the underlying universal representation, there is no transfer learning performed with regards to how classification rules are inferred across tasks and domains. Yet, cross-domain generalization might be beneficial in that area as well, in particular when tasks have only few examples per class.
Present work. To explore this question, we propose a Universal Representation Transformer (URT) layer, which can effectively learn to transform a universal representation into task-adapted representations. The URT layer is inspired from Transformer (Vaswani et al., 2017) and uses an attention mechanism to learn to retrieve or blend the appropriate backbones to use for each task. By training this layer across few-shot tasks from many domains, it can support transfer across these tasks.
We show that our URT layer on top of a universal representation’s pre-trained backbones sets a new state-of-the-art performance on Meta-Dataset. It succeeds at outperforming SUR on 4 dataset sources without impairing accuracy on the others. This leads to top performance on 7 dataset sources when comparing to a set of competing methods. To interpret the strategy that URT learns to weigh the backbones from different domains, we visualize the attention scores for both seen and unseen domains and find that our model generates meaningful weights for the pre-trained domains. A comprehensive analysis on variants and ablations of the URT layer is provided to show the importance of various components of URT, notably the number of attention heads.
# 2 FEW-SHOT CLASSIFICATION
# 2.1 PROBLEM SETTING
In this section, we will introduce the problem setting for few-shot classification and the formulation of meta-learning for few-shot classification. Few-shot classification aims to classify samples where only few examples are available for each class. We describe a few-shot learning classification task as the pair of examples, comprising of a support set $S$ to define the classification task and the query set $Q$ of samples to be classified.
Meta-learning is a technique that aims to model the problem of few-shot classification as learning to learn from instances of few-shot classification tasks. The most popular way to train a meta-learning model is with episodic training. Here, tasks $T = ( Q , S )$ are sampled from a larger dataset by taking subsets of the dataset to build a support set $S$ and a query set $Q$ for the task. A common approach is to sample $N$ -way- $K$ -shot tasks, each time selecting a random subset of $N$ classes from the original dataset and choosing only $K$ examples for each class to add to the support set $S$ .
The meta-learning problem can then be formulated by the following optimization:
$$\operatorname* { m i n } _ { \Theta } \mathbb { E } _ { ( S , Q ) \sim p ( T ) } \left[ \mathcal { L } ( S , Q , \Theta ) \right] , \ \mathcal { L } ( S , Q , \Theta ) = \frac { 1 } { | Q | } \sum _ { { ( x , y ) } \sim Q } - \log p ( y | x , S ; \Theta ) + \lambda \Omega ( \Theta ) ,$$
where $p ( T )$ is the distribution of tasks, $\Theta$ are the parameters of the model and $p ( \boldsymbol { y } | \boldsymbol { x } , S ; \Theta )$ is the probability assigned by the model to label $y$ of query example $_ { \textbf { \em x } }$ (given the support set $S$ ), and $\Omega ( \Theta )$ is an optional regularization term on the model parameters with factor $\lambda$ .
Conventional few-shot classification targets the setting of $N$ -way- $K$ -shot, where the number of classes and examples are fixed in each episode. Popular benchmarks following this approach include Omniglot (Lake et al., 2015) or benchmarks made of subsets of ImageNet, such as miniImageNet (Vinyals et al., 2016) and tieredImageNet (Ren et al., 2018). In such benchmarks, the tasks for training cover a set of classes that is disjoint from the classes in the test set of tasks. However, with the training and test sets tasks coming from a single dataset/domain, the distribution of tasks found in either sets is similar and lacks variability, which may be unrealistic in practice.
It is in this context that Triantafillou et al. (2020) proposed Meta-Dataset, as a further step towards large-scale, multi-domain few shot classification. Meta-Dataset includes ten datasets (domains), with eight of them available for training. Additionally, each task sampled in the benchmark varies in the number of classes $N$ , with each class also varying in the number of shots $K$ . As in all few-shot learning benchmarks, the classes used for training and testing do not overlap.
# 2.2 BACKGROUND AND RELATED WORK
Meta-Learning A promising approach for few-shot classification is to use meta-learning to more directly train a model to learn to perform few-shot classification, in an end-to-end way. The two most popular methods are Prototypical Networks (Snell et al., 2017) and Model Agnostic Meta-Learning (MAML) (Finn et al., 2017). Triantafillou et al. (2020) showed that prototypical networks and MAML could be combined by leveraging prototypes for the initialization of the output weights value in the inner loop. Requeima et al. (2019) also proposed Conditional Neural Adaptive Processes (CNAPs) for few-shot classification, which can be seen as extending prototypical networks with a more sophisticated architecture that allows for improved task adaptation. This architecture was later improved further by Bateni et al. (2020) with Simple CNAPS, leading to one of the current best methods on Meta-Dataset. Another line of work which leverages the idea of “transfer by fine-tuning” can be found in Appendix B.
Universal Representations In contrast, our work instead builds on that of Dvornik et al. (2020) and their method SUR (Selecting from Universal Representations). Bilen & Vedaldi (2017) introduced the term universal representation to refer to a representation that supports good performance in multiple domains. One proposal towards such a representation is to train different neural networks backbones separately on the data of each available domain, then simply to concatenate the representation learned by each. Another is to introduce some parameter sharing between the backbones, by having a single network conditioned on the domain of the provenance of each batch of training data (Rebuffi et al., 2018), e.g. using Feature-wise Linear Modulate (FiLM) (Perez et al., 2018). SUR proposes to leverage a universal representation in few-shot learning tasks with a feature selection procedure that assigns different weights to each of the domain-specific subvectors of the universal representation. The objective is to assign high weights only to the domain-specific representations that are specifically useful for each few-shot task at hand. The weights are inferred by optimizing a loss on the support set that encourages high accuracy of a nearest-centroid classifier. As such, the method does not involve any meta-learning—a choice motivated by the concern that meta-learning may struggle in generalizing to domains that are dissimilar to the training domains. SUR achieved some of the best performances on Meta-Dataset. However, a contribution of our work is to provide evidence that meta-learning can actually be used to replace SUR’s hand-designed inference procedure and improve performance further.
Task Adaptive Representations Another line of work tries to retrieve task adaptive representations for each task. Task specific representations can be conditioned on a representation of the current task (Oreshkin et al., 2018; Wang et al., 2019), projected to another space (Yoon et al., 2019), or masked based on inter-class commonality and inter-class uniqueness (Li et al., 2019). While the representation extracted from URT is also task adaptive, it is adaptive to a set of pretrained backbones and can be applied to more complicated multi-domain scenarios. Wang & Hebert (2016) proposed to improve a CNN by adding extra layers and train it using unsupervised data while our contribution mainly lies in composing representations instead of an improved CNN. Alet et al. (2018) introduced a modular meta-learning method, which learns a repertoire of modules that serves as nodes to construct a tree structure to solve a new robotic-related task. Comparatively, URT is a one-for-all layer which doesn’t need to construct different module structures for each task.
Transformer Networks Our meta-learning approach to leverage universal representations is inspired directly from Transformer networks (Vaswani et al., 2017). Our model structure is inspired by the structure of the dot-product self-attention in the Transformer, which we adapted here to multidomain few-shot learning by designing appropriate parametrizations for queries, keys and values. Self-attention was explored in the single-domain training regime by Ye et al. (2020); Liu et al. (2019b;a; 2020), however for a different purpose, where each representation of individual examples in a task support set is influenced by all other examples. Rather than using self-attention between individual examples in the support set, our model uses self-attention to select between different domain-specific backbones.
# 3 UNIVERSAL REPRESENTATION TRANSFORMER LAYER
In this section, we describe our proposed URT layer, which uses meta-learning episodic training to learn how to combine the domain-specific backbones of a universal representation for any given fewshot learning classification task. URT layer can be built on top of any set of pretrained backbones without further costly fine-tuning of the backbones. More details on how to train multiple domainspecific backbones can be found in Appendix C.
 Figure 1: Illustration of how a single-head URT layer uses a universal representation to produce a task-specific representation. This example assumes the use of four backbones, with each color illustrating their domain-specific sub-vector representation in the universal representation.
Conceptually, the proposed model views the support set $S$ of a task as providing information on how to query and retrieve from the set $\{ r _ { i } \}$ of $m$ pre-trained backbones the most appropriate backbone to build an adapted representation $\phi$ for the task.
We would like the model to support a variety of strategies on how to retrieve backbones. For example, it might be beneficial for the model to retrieve a single backbone from the set, especially if the domain of the given task matches perfectly that of a domain found in the training set. Alternatively, if some of the training domains benefit from much more training data than others, a better strategy might be to attempt some cross-domain generalization towards the few-shot learning task by blending many backbones together, even if none matches the domain of the task perfectly.
This motivates us to use dot-product self-attention, inspired by layers of Transformer networks (Vaswani et al., 2017). For this reason, we refer to our model as a Universal Representation Transformer (URT) layer. Additionally, since each class of the support set might require a different strategy, we perform attention separately for each class and their support set $S _ { c } = \{ { \pmb x } | ( { \pmb x } , y ) \in S$ and $y = c \}$ .
# 3.1 SINGLE-HEAD URT LAYER
We start by describing an URT layer consisting of a single attention head. An illustration of a singlehead URT layer is shown in Figure 1. Let $r _ { i } ( { \pmb x } )$ be the output vector of the backbone for domain $i$ . We then write the universal representation as
$$r ( \mathbf x ) = \mathrm { c o n c a t } ( r _ { 1 } ( \mathbf x ) , \hdots , r _ { m } ( \mathbf x ) ) .$$
This representation provides a natural starting point to obtain a representation of a support set class. Specifically, we will note
$$r ( S _ { c } ) = \frac { 1 } { \left| S _ { c } \right| } \sum _ { { \pmb x } \in S _ { c } } r ( { \pmb x } )$$
as the representation for the set $S _ { c }$ . From this, we can describe the URT layer by defining the queries1, keys, the attention mechanism and output of the layer:
Queries $\mathbf { q } _ { c }$ : For each class $c$ , we obtain a query through $\mathbf { q } _ { c } = \mathbf { W } ^ { q } r ( S _ { c } ) + \mathbf { b } ^ { q }$ , where we have a learnable query linear transformation represented by matrix $\mathbf { W } ^ { q }$ and bias $\mathbf { b } ^ { q }$ .
Keys $\mathbf { k } _ { i , c }$ : For each domain $i$ and class $c$ , we define keys as $\mathbf { k } _ { i , c } = \mathbf { W } ^ { k } r _ { i } ( S _ { c } ) + \mathbf { b } ^ { k }$ , using a learnable linear transformation $\mathbf { W } ^ { k }$ and $\mathbf { b } ^ { k }$ and where $r _ { i } ( S _ { c } ) = 1 / | S _ { c } | \textstyle \sum _ { { \pmb x } \in S _ { c } } r _ { i } ( { \pmb x } )$ , using a similar notation as for $r ( S _ { c } )$ .
# Algorithm 1 Training of URT layer
Input: Number of tasks $\tau _ { t o t a l }$ , $m$ pre-trained backbones ;
1: for $\tau \in \{ 1 , \cdots , \tau _ { t o t a l } \}$ do 2: Sample a few-shot task $T$ with support set $S$ and query set $Q$ ; 3: # Infer adapted representation for task from $S$ 4: For each class, obtain representation using $m$ pre-trained backbones as in Eq. (3); 5: Obtain attention scores using Eq. (4,5) for each head using support set $S$ ; 6: # Use adapted representation to predict labels in $Q$ from support set $S$ 7: Compute adapted representation of examples in $S$ and $Q$ as in Eq. (6,7); 8: Compute probabilities of label of examples in $Q$ using Prototypical Network as in Eq. (9); 9: Compute loss as in Eq. (1,8) and perform gradient descent step on URT parameters $\Theta$ ;
10: end for
Attention scores $\alpha _ { i }$ : as for regular Transformer layers, we use scaled dot-product attention
$$\alpha _ { i , c } = \frac { \exp ( \beta _ { i , c } ) } { \sum _ { i ^ { \prime } } \exp ( \beta _ { i ^ { \prime } , c } ) } , \beta _ { i , c } = \frac { { \bf q } _ { c } \mathrm { ~ } ^ { \top } { \bf k } _ { i , c } } { \sqrt { l } } ,$$
where $l$ is the dimensionality of the keys and queries. Then, these per-class scores are aggregated to obtain scores for the full support set by averaging
$$\alpha _ { i } = \frac { \sum _ { c } \alpha _ { i , c } } { N } .$$
Equipped with these attention scores, the URT layer can now produce an adapted representation for the task (for the support and query set examples) by computing
$$\phi ( { \bf x } ) = \sum _ { i } \alpha _ { i } r _ { i } ( { \bf x } ) .$$
As we can see, this approach has the flexibility of either selecting a single domain-specific backbone (by assigning $\alpha _ { i } = 1$ for a single domain) or blending different domains together (by having $\alpha _ { i } > >$ 0 for multiple backbones).
# 3.2 MULTI-HEAD URT LAYER
The URT layer described so far can only learn to retrieve a single backbone (or blending of backbones). Yet, it might be beneficial to retrieve multiple different (blended) backbones, especially for a few-shot task that would include many classes of varying complexity.
Thus, to achieve such diversity in the adapted representation, we also consider URT layers with multiple heads, i.e. where each head corresponds to the calculation of Equation 6 and each head has its own set of parameters $( \mathbf { W } ^ { q } , \mathbf { b } ^ { q } , \mathbf { W } ^ { k } , \bar { \mathbf { b } ^ { k } } )$ . Denoting each head now as $\phi _ { h }$ , a multi-head URT layer then produces as its output the concatenation of all of its heads:
$$\phi ( { \bf x } ) = \mathrm { c o n c a t } ( \phi _ { 1 } ( { \bf x } ) , \ldots , \phi _ { \mathrm { H } } ( { \bf x } ) ) .$$
Empirically we found that the randomness in the initialization of head weights alone did not lead to uniqueness and being complimentary between the heads, so inspired by Lin et al. (2017), we add a regularizer to avoid duplication of the attention scores:
$$\Omega ( \Theta ) = \| ( \mathbf { A } \mathbf { A } ^ { \top } - \mathbf { I } ) \| _ { F } ^ { 2 } ,$$
where $\| \cdot \| _ { F }$ is the Frobenius norm of a matrix and $\mathbf { A } \in \mathbb { R } ^ { n \times m }$ is the matrix for attention scores, with $\mathbf { A } _ { h }$ being the vector of all scores $\alpha _ { i }$ for head $h$ . The identity matrix I regularizes each set of attention scores to be more focused so that multiple heads can attend to different domain-specific backbones.
# 3.3 TRAINING STRATEGY
We train representations produced by the URT layer by following the approach of Prototypical Networks (Snell et al., 2017), where the probability of a label $y$ for a query example $_ { \textbf { \em x } }$ given the
Table 1: Test accuracy (mean $\pm \mathrm { C I } \% 9 5 $ ) over 600 few-shot tasks. URT and the most recent methods, which are listed in the first column, are compared on Meta-Dataset (Triantafillou et al., 2020), which are listed in the first row. The numbers in bold have intersecting confidence intervals with the most accurate method.
<table><tr><td></td><td>ILSVRC</td><td>Omniglot</td><td>Aircraft</td><td>Birds</td><td>Textures</td><td>QuickDraw</td><td>Fungi</td><td>VGGFlower</td><td>TrafficSigns</td><td></td><td>MSCOCO</td><td>avg.rank</td></tr><tr><td>MAML</td><td></td><td>37.8±1.0 83.9±1.0 76.4±0.7 62.4±1.1(</td><td></td><td></td><td></td><td>64.1±0.8</td><td>59.7±1.1</td><td>33.5±1.1</td><td>79.9±0.8</td><td>42.9±1.3</td><td>29.4±1.1</td><td>6.4</td></tr><tr><td>ProtoNet</td><td></td><td>44.5±1.1 79.6±1.1 71.1±0.9 67.0±1.0 65.2±0.8</td><td></td><td></td><td></td><td></td><td>64.9±0.9</td><td>40.3±1.1</td><td>86.9±0.7</td><td>46.5±1.0</td><td>39.9±1.1</td><td>5.7</td></tr><tr><td>ProtoMAML</td><td></td><td>46.5±1.1 82.7±1.0 75.2±0.8 69.9±1.0 68.3±0.8</td><td></td><td></td><td></td><td></td><td>66.8±0.9</td><td>42.0±1.2</td><td>88.7±0.7</td><td>52.4±1.1</td><td>41.7±1.1</td><td>4.1</td></tr><tr><td>CNAPs</td><td>50.8±1.1</td><td>91.7±0.5 83.7±0.6 73.6±0.9</td><td></td><td></td><td>59.5±0.7</td><td></td><td>74.7±0.8</td><td>50.2±1.1</td><td>88.9±0.5</td><td>56.5±1.1</td><td>39.4±1.1</td><td>3.6</td></tr><tr><td>SUR</td><td>56.1±1.1 </td><td>93.1±0.5 84.6±0.7 70.6±1.0 71.0±0.8</td><td></td><td></td><td></td><td></td><td>81.3±0.6</td><td>64.2±1.0</td><td>82.8±0.7</td><td>53.4±1.0</td><td>50.1±1.0</td><td>2.3</td></tr><tr><td>SimpleCNAPS 56.5±1.1 91.9±0.6 83.8±0.7 76.1±0.870.0±0.8</td><td></td><td></td><td></td><td></td><td></td><td></td><td>78.3±0.7</td><td>49.1±1.2</td><td>91.3±0.6</td><td>59.2±1.0</td><td>42.4±1.1</td><td>2.2</td></tr><tr><td>URT (Ours)</td><td></td><td>55.7±1.0 94.4±0.4 85.8±0.6 76.3±0.871.8±0.7</td><td></td><td></td><td></td><td></td><td>82.5±0.6</td><td>63.5±1.0</td><td>88.2±0.6</td><td>51.1±1.1</td><td>52.2±1.1</td><td>1.5</td></tr></table>
support set of a task is modeled as:
$$p ( y = c | \pmb { x } , S ; \Theta ) = \frac { \exp ( - d ( \phi ( \pmb { x } ) - \pmb { p _ { c } } ) ) } { \sum _ { c ^ { \prime } = 1 } ^ { N } \exp ( - d ( \phi ( \pmb { x } ) - \pmb { p _ { c ^ { \prime } } } ) ) } ,$$
where $d$ is a distance metric and $\pmb { p } _ { c } = 1 / | S _ { c } | \sum _ { \pmb { x } \in S _ { c } } \phi ( \pmb { x } )$ corresponds to the centroid of class $c _ { \cdot }$ referred to as its prototype. We use (negative) cosine similarity as the distance. The full training algorithm is presented in Algorithm 1.
# 4 EXPERIMENTS
In this section, we seek to answer three key experimental questions:
Q1 How does URT compare with previous state-of-the-art on Meta-Dataset for multi-domain fewshot classification? Q2 Do the URT attention heads generate interpretable and meaningful attention scores? Q3 Does the URT layer provide consistent benefits, even when pre-trained backbones are trained in different ways?
In addition, we investigate architectural choices made, such as our models for keys/queries and their regularization, and study their contribution to achieving strong performance with URT.
# 4.1 DATASETS AND SETUP
We test our methods on the large-scale few-shot learning benchmark Meta-Dataset (Triantafillou et al., 2020). It consists of ten datasets with various data distributions across different domains, including natural images (Birds, Fungi, VGG Flower), hand-written characters (Omniglot, Quick Draw), and human created objects (Traffic Signs, Aircraft). Among the ten datasets, eight provide data that can be used during either training, validation and testing (with each class assigned to only one of those sets), while two datasets are solely used for testing. Following Bateni et al. (2020); Requeima et al. (2019), we also report results on MNIST (LeCun et al., 1998), CIFAR10 and CIFAR100 (Krizhevsky et al., 2009) as additional unseen test datasets. Following Triantafillou et al. (2020), few-shot tasks are sampled with varying number of classes $N$ , varying number of shots $K$ and class imbalance. The performance is reported as the average accuracy over 600 sampled tasks. More details of Meta-Dataset can be found in Triantafillou et al. (2020).
The domain-specific backbones are pre-trained following the setup in (Dvornik et al., 2020). Then, we freeze the backbone and train the URT layer for 10,000 episodes, with an initial learning rate of 0.01 and a cosine learning rate scheduler. Following Chen et al. (2020), the training episodes have $50 \%$ probability coming from the ImageNet data source. Since different pre-trained backbones may produce representations with different vector norms, we normalize the outputs of the backbones as in Dvornik et al. (2020). URT is trained with parameter weight decay of 1e-5 and with a regularization factor $\lambda = 0 . 1$ . The number of heads ( $H$ in Equation 7), is set to 2 and the dimension of the keys and queries (l in Equation 4) is set to 1024. We choose the hyper-parameters based on the performance of the validation set. Details of the hyper-parameter selection and how the performance is influenced by them are outlined in Section 4.5. We find that the bottleneck of training URT is extracting features from CNN. Since we freeze the CNN when training the URT, we find dumping the extracted feature episodes can significantly speed up the training procedure from days to around 2 hours.
 Figure 2: Average attention scores generated by URT with two heads. Rows correspond to the domain of the test tasks and the columns correspond to the pre-trained backbones $r _ { i } ( { \pmb x } )$ trained on the eight training domains.
# 4.2 COMPARISON WITH PREVIOUS APPROACHES
Table 1 presents a comparison of URT with SUR, as well as other baselines based on transfer learning by fine-tuning (Saikia et al., 2020) or meta-learning (Prototypical Networks (Snell et al., 2017), first-order MAML (Finn et al., 2017), ProtoMAML (Triantafillou et al., 2020), CNAPs (Requeima et al., 2019)) and Simple CNAPS(Bateni et al., 2020).
We observe in Table 1 that URT establishes a new state-of-the-art on Meta-Dataset, by achieving the top performance on 8 out of the 10 dataset sources. When comparing to its predecessor, URT outperforms SUR on 4 datasets without compromising performance on others, which is challenging to achieve in the multi-domain setting. Of note, the average inference time for URT is 0.04 second per task, compared to 0.43 for SUR, on a single V100. Thus, getting rid of the optimization procedure for every episode with our meta-trained URT layer also significantly increases the latency, by more than $1 0 \times$ . More results on additional datasets can be found in Appendix A.
# 4.3 INTERPRETING AND VISUALIZING ATTENTION BY URT
To better understand how the URT model of Section 4.2 uses its two heads to build adapted representations, we visualize the attention scores produced on the test tasks of Meta-Dataset in Figure 2.
The blue (first head) and orange (second head) heatmaps summarize the values of the attention scores (Equation 5), averaged across several tasks for each test domain. Specifically, the element on row $t$ and column $i$ is the averaged attention scores $\alpha _ { i }$ computed on test set domain $t$ for the backbone from domain $i$ . Note that the last two rows are the two unseen domain datasets. We found that for datasets from the seen domains, i.e. the first eight rows, one head (right, orange) consistently puts most of its weight on the backbone pre-trained on the same domain, while the other head (left, blue) learns relatively smoother weight distributions that blend other related domains. For unseen datasets, the right head puts half of its weight on ImageNet and the left head learned to blend the representations from four backbones.
Table 2: Test accuracy (mean $\pm \mathrm { C I } \% 9 5$ ) over 600 few-shot tasks. All methods use parametric network family (pf) backbones.
<table><tr><td></td><td> SUR-pf</td><td>URT-pf</td><td>VS.</td></tr><tr><td>ILSVRC</td><td>56.0 ± 1.1</td><td>55.5 ± 1.1</td><td>二</td></tr><tr><td>Omniglot</td><td>90.0 ± 0.8</td><td>90.2 ± 0.6</td><td>二</td></tr><tr><td>Aircraft</td><td>79.7 ± 0.8</td><td>79.8 ± 0.7</td><td>=</td></tr><tr><td>Birds</td><td>75.9 ± 0.9</td><td>77.5 ± 0.8</td><td>三</td></tr><tr><td>Textures</td><td>72.5 ± 0.7</td><td>73.5 ± 0.7</td><td></td></tr><tr><td>Quick Draw</td><td>76.7 ± 0.7</td><td>75.8 ± 0.7</td><td>三 二</td></tr><tr><td>Fungi</td><td>49.8 ± 1.1</td><td>48.1 ± 0.9</td><td>+</td></tr><tr><td>VGG Flower</td><td>90.0 ± 0.6</td><td>91.9 ± 0.5</td><td>二</td></tr><tr><td>Traffic Signs</td><td>52.2 ± 0.8</td><td>52.0 ± 1.4</td><td></td></tr><tr><td>MSCOCO</td><td>50.2 ± 1.1</td><td>52.1 ± 1.0</td><td></td></tr><tr><td>MNIST</td><td>93.2 ± 0.4</td><td>93.9 ± 0.4</td><td>=</td></tr><tr><td>CIFAR10</td><td>66.4 ± 0.8</td><td>66.1 ± 0.8</td><td>三</td></tr><tr><td>CIFAR100</td><td>57.1 ± 1.0</td><td>57.3 ± 1.0</td><td>二</td></tr></table>
# 4.4 URT USING FILM MODULATED BACKBONES
As additional evidence of the benefit of URT on universal representations, we also present experiments based on a different set of backbone architectures. Following SUR (Dvornik et al., 2020), we consider the backbones from a parametric network family, obtained by training a base backbone on one dataset (ILSVRC) and then learning separate FiLM layers (Perez et al., 2018) for each other dataset, to modulate the backbone so it is adapted to the other domains. These backbones collectively have only $0 . 5 \%$ more parameters than a single backbone. More details of the backbones can be found in Appendix C.
A comparison between SUR and URT using these backbones (referred to as SUR-pf and URT-pf) is presented in Table 2. Once again, URT can improve the performance on VGG Flower without sacrificing performance on others.
# 4.5 HYPER-PARAMETER AND ABLATION STUDIES
We analyze the importance of the various components of URT’s attention mechanism structure and training strategy in Table 3. First we analyze the importance of using the support set to model queries and/or keys. To this end, we consider setting the matrices $\mathbf { W } ^ { q } / \mathbf { W } ^ { k }$ of the query / key linear transformation to 0, which only leaves the bias term. We found that the support set representation is most crucial for building the keys (row w/o $\mathbf { W } ^ { k }$ in the table) and has minor benefits for queries (row $\mathbf { w } / \mathbf { o } \mathbf { W } ^ { q } )$ in the table. This observation is possibly related to the success of attention-based models with learnable constant queries (Liu et al., 2016; Lin et al., 2017). We also found that adding a regularizer $\Omega ( \Theta )$ as in Equation 8 is important for some datasets, specifically VGG Flower and Birds.
Table 3: Meta-Dataset performance variation on ablations of elements of the URT layer.
<table><tr><td colspan="11">ILSVRC Omniglot Aircraft Birds Textures Draw Fungi Flower Signs MSCOCO</td></tr><tr><td>w/o Wq</td><td>+0.2</td><td>-0.2</td><td>-0.6</td><td>-0.1</td><td>-0.3</td><td>-0.2</td><td>0.0</td><td>-0.2</td><td>-0.8</td><td>-0.1</td></tr><tr><td>w/o Wk</td><td>-14.2</td><td>-2.8</td><td>-10.7</td><td>-18.1</td><td>-7.6</td><td>-9.3</td><td>-22.4</td><td>-3.6</td><td>-0.26</td><td>-10.9</td></tr><tr><td>w/or(Sc)</td><td>-14.2</td><td>-2.8</td><td>-10.7</td><td>-18.1</td><td>-7.6</td><td>-9.2</td><td>-22.4</td><td>-3.6</td><td>-0.26</td><td>-10.9</td></tr><tr><td>w/0 Ω(0)</td><td>0.0</td><td>-0.9</td><td>-0.4</td><td>-3.3</td><td>-1.2</td><td>-0.2</td><td>+0.3</td><td>-9.0</td><td>-2.0</td><td>0.0</td></tr></table>
An important hyper-parameter in URT is the number of heads $H$ . We chose this hyper-parameter based on the performance on validation set of tasks in Meta-Dataset. In Table 4, we show the validation performance of URT for varying number of heads. As suggested by Triantafillou et al. (2020), we considered looking at the rank of the performance achieved by each choice of $H$ for each validation domains, and taking the average across domains as a validation metric. However, since the performances when using two to four heads are similar and yield the same average rank, we instead simply consider the average accuracy as the selection criteria.
Table 4: Validation performance on Meta-Dataset using different number of heads
<table><tr><td></td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td></tr><tr><td>Average Accuracy</td><td>74.605</td><td>77.145</td><td>76.943</td><td>76.984</td><td>76.602</td><td>75.906</td><td>75.454</td><td>74.473</td></tr><tr><td>Average Rank</td><td>2.875</td><td>1.000</td><td>1.000</td><td>1.000</td><td>2.250</td><td>2.250</td><td>2.25</td><td>2.50</td></tr></table>
In general, we observe a large jump in performance when using multiple heads instead of just one. However, since the number of heads controls the capacity, predictably we also observe that having too many heads leads to overfitting.
# 5 CONCLUSION
We proposed the URT layer to effectively integrate representations from multiple domains and demonstrated improved performance in multi-domain few-shot classification. Notably, our URT approach was able to set a new state-of-the-art on Meta-Dataset, and never performs worse than its predecessor (SUR) while also being $1 0 \times$ more efficient at inference. This work suggests that combining meta-learning with pre-trained universal representations is a promising direction for new few-shot learning methods. Specifically, we hope that future work can investigate the design of richer forms of universal representations that go beyond simply pre-training a single backbone for each domain, and developing meta-learners adapted to those settings.
# REFERENCES
Ferran Alet, Tomas Lozano-P ´ erez, and Leslie P Kaelbling. Modular meta-learning. In ´ Conference on Robot Learning (CoRL), 2018.
Peyman Bateni, Raghav Goyal, Vaden Masrani, Frank Wood, and Leonid Sigal. Improved few-shot visual classification. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
Hakan Bilen and Andrea Vedaldi. Universal representations: The missing link between faces, text, planktons, and cat breeds. arXiv preprint arXiv:1701.07275, 2017.
Wei-Yu Chen, Yen-Cheng Liu, Zsolt Liu, Yu-Chiang Frank Wang, and Jia-Bin Huang. A closer look at few-shot classification. In International Conference on Learning Representations (ICLR), 2019.
Yinbo Chen, Xiaolong Wang, Zhuang Liu, Huijuan Xu, and Trevor Darrell. A new meta-baseline for few-shot learning. arXiv preprint arXiv:2003.04390, 2020.
Guneet Singh Dhillon, Pratik Chaudhari, Avinash Ravichandran, and Stefano Soatto. A baseline for few-shot image classification. In International Conference on Learning Representations (ICLR), 2020.
Nikita Dvornik, Cordelia Schmid, and Julien Mairal. Selecting relevant features from a universal representation for few-shot classification. arXiv preprint arXiv:2003.09338, 2020.
Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In The International Conference on Machine Learning (ICML), 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 (CVPR), 2016.
Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
Brenden M Lake, Ruslan Salakhutdinov, and Joshua B Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 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.
Hongyang Li, David Eigen, Samuel Dodge, Matthew Zeiler, and Xiaogang Wang. Finding taskrelevant features for few-shot learning by category traversal. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
Zhouhan Lin, Minwei Feng, Cicero Nogueira dos Santos, Mo Yu, Bing Xiang, Bowen Zhou, and Yoshua Bengio. A structured self-attentive sentence embedding. arXiv preprint arXiv:1703.03130, 2017.
Lu Liu, Tianyi Zhou, Guodong Long, Jing Jiang, Lina Yao, and Chengqi Zhang. Prototype propagation networks (PPN) for weakly-supervised few-shot learning on category graph. In International Joint Conferences on Artificial Intelligence (IJCAI), 2019a.
Lu Liu, Tianyi Zhou, Guodong Long, Jing Jiang, and Chengqi Zhang. Learning to propagate for graph meta-learning. In Neural Information Processing Systems (NeurIPS), 2019b.
Lu Liu, Tianyi Zhou, Guodong Long, Jing Jiang, and Chengqi Zhang. Attribute propagation network for graph zero-shot learning. In AAAI Conference on Artificial Intelligence (AAAI), 2020.
Yang Liu, Chengjie Sun, Lei Lin, and Xiaolong Wang. Learning natural language inference using bidirectional lstm model and inner-attention. arXiv preprint arXiv:1605.09090, 2016.
Boris Oreshkin, Pau Rodr´ıguez Lopez, and Alexandre Lacoste. Tadam: Task dependent adaptive ´ metric for improved few-shot learning. In The Conference on Neural Information Processing Systems (NeurIPS), 2018.
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 (AAAI), 2018.
Sylvestre-Alvise Rebuffi, Hakan Bilen, and Andrea Vedaldi. Efficient parametrization of multidomain deep neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
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 International Conference on Learning Representations (ICLR), 2018.
James Requeima, Jonathan Gordon, John Bronskill, Sebastian Nowozin, and Richard E Turner. Fast and flexible multi-task classification using conditional neural adaptive processes. In The Conference on Neural Information Processing Systems (NeurIPS), pp. 7957–7968, 2019.
Tonmoy Saikia, Thomas Brox, and Cordelia Schmid. Optimized generic feature learning for fewshot classification across domains. arXiv preprint arXiv:2001.07926, 2020.
Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In The Conference on Neural Information Processing Systems (NeurIPS), 2017.
Eleni Triantafillou, Tyler Zhu, Vincent Dumoulin, Pascal Lamblin, Utku Evci, Kelvin Xu, Ross Goroshin, Carles Gelada, Kevin Swersky, Pierre-Antoine Manzagol, et al. Meta-dataset: A dataset of datasets for learning to learn from few examples. In International Conference on Learning Representations (ICLR), 2020.
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), 2017.
Oriol Vinyals, Charles Blundell, Tim Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In The Conference on Neural Information Processing Systems (NeurIPS), 2016.
Xin Wang, Fisher Yu, Ruth Wang, Trevor Darrell, and Joseph E Gonzalez. Tafe-net: Task-aware feature embeddings for low shot learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
Yu-Xiong Wang and Martial Hebert. Learning from small sample sets by combining unsupervised meta-training with cnns. In The Conference on Neural Information Processing Systems (NeurIPS), 2016.
Han-Jia Ye, Hexiang Hu, De-Chuan Zhan, and Fei Sha. Few-shot learning via embedding adaptation with set-to-set functions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
Sung Whan Yoon, Jun Seo, and Jaekyun Moon. Tapnet: Neural network augmented with taskadaptive projection for few-shot learning. In The International Conference on Machine Learning (ICML), 2019.
# A EXPERIMENTS ON MORE DATASETS
We also report performances on the MNIST, CIFAR-10 and CIFAR-100 dataset sources in Table 5, and compare with the subset of methods that have reported on these datasets. There, URT neither improves nor gets worse performance than SUR, yeilding top performance on the MNIST domain but not on the CIFAR-10/CIFAR-100 domain, on which Simple CNAPS has the best performance.
Table 5: Test performance (mean $1 { + } \mathrm { C I } \% 9 5$ ) over 600 few-shot tasks on additional datasets.
<table><tr><td></td><td>MNIST CIFAR10</td><td>CIFAR100</td><td> avg. rank</td></tr><tr><td>CNAPs</td><td>92.7 ± 0.4 61.5 ± 0.7</td><td>50.1 ± 1.0</td><td>4.7</td></tr><tr><td>TaskNorm</td><td>92.3 ± 0.4 69.3 ± 0.8</td><td>54.6 ± 1.1</td><td>3.3</td></tr><tr><td>SUR</td><td>94.3 ± 0.4 66.8 ± 0.9</td><td>56.6 ± 1.0</td><td>2.3</td></tr><tr><td>SimpleCNAPS</td><td>93.9 ± 0.4 74.3± 0.7</td><td>60.5 ± 1.0</td><td>1.7</td></tr><tr><td>URT (Ours)</td><td>94.8 ± 0.4 67.3 ± 0.8</td><td>56.9 ± 1.0</td><td>2.0</td></tr></table>
# B MORE RELATED WORKS
Transfer by fine-tuning A simple and effective method for few-shot classification is to perform transfer learning by first learning a neural network classifier on all data available for training and using its representation to initialize and then fine-tune neural networks on the few-shot classification tasks found at test time (Chen et al., 2019; Triantafillou et al., 2020; Dhillon et al., 2020; Saikia et al., 2020). Specifically, Saikia et al. (2020) have shown that competitive performance can be reached using a strong hyper-parameter optimization method applied on a carefully designed validation metric appropriate for few-shot learning.
# C STRUCTURES AND TRAINING STRATEGY OF BACKBONES
Our URT layer can be built on top of a set of pretrained backbones. The structures of the backbones follow the approach in Dvornik et al. (2020). For Table 1, we use the ResNet18 architecture (He et al., 2016) for the backbones, where a separate backbone is pretrained on each domain separately using the corresponding training data in meta-dataset. The training domains include ImageNet, Omniglot, Aircraft, CU-Birds, Textures, Quick Draw, Fungi and VGG-Flower. For the parametric network family in Table 2, a base ResNet18 is first trained on ImageNet. Then a small number of modulating parameters are trained on the other domains, using their domain-specific training data, while the rest of the base backbone’s weights stay fixed. Specifically, FiLM feature modulation (Perez et al., 2018) is used. This type of parametric network family thus allows for a much reduced number of learnable parameters, by reusing the weights from the base network. In experiments, we use the pretrained backbones released by Dvornik et al. (2020) for both cases, without any further finetuning. End-to-end training of a set of backbones and the URT layers requires unaffordable computational cost, so we fix the pretrained backbones and only train the URT layer.
Implementation details for training backbones The training details of the backbones come from Dvornik et al. (2020). For optimization, SGD with momentum was used, using cosine learning rate annealing. Since the datasets come from different domains, the starting learning rate, the maximum number of training iterations and annealing frequency are set individually for each dataset. Data augmentation is applied and a constant weight decay of $\mathrm { \dot { 7 } } \times 1 0 ^ { - 4 }$ is set. For each dataset, a grid search over batch size in [8, 16, 32, 64] was run and the one that maximizes accuracy on the validation set was picked. For the parametric network family, the base ResNet18 trained on ImageNet is the same. For other backbones, cosine annealing as learning rate policy is also used, weight decay and data augmentation employed as above. Please refer to Table 4 and Table 5 in the original SUR paper (Dvornik et al., 2020) for the specific values of the hyperparameters for the individual feature networks and the parametric network family, respectively.
# D RESULTS ON TRAFFIC SIGNS
The shuffle buffer bug described in meta-dataset issue #54 (https://github.com/googleresearch/meta-dataset/issues/54) has been propagated to previous works such as CNAPs (Requeima et al., 2019). The results for the Traffic Signs dataset are considerably worse after fixing this bug. For instance, URT degrades from $6 9 . 4 { \pm } 0 . 8 $ to $5 1 . 1 { \pm } 1 . 1$ . Please visit the official meta-dataset GitHub repo for more details. The main paper shows the corrected results (for URT and competing approaches). For completeness, we also provide the tables as they were in the initial version of this paper for your reference in this Appendix. Both sets of results overall support the advantageous performance of URT over previous work.
Table 6: Test accuracy ( $\mathrm { m e a n \pm C I \% 9 5 } ,$ ) over 600 few-shot tasks. URT and the most recent methods, which are listed in the first column, are compared on Meta-Dataset (Triantafillou et al., 2020), which are listed in the first row. The numbers in bold have intersecting confidence intervals with the most accurate method.
<table><tr><td></td><td>ILSVRC</td><td>Omniglot</td><td>Aircraft</td><td>Birds</td><td>Textures</td><td>QuickDraw</td><td>Fungi</td><td>VGGFlower</td><td>TrafficSigns</td><td>MSCOCO</td><td>avg.rank</td></tr><tr><td>MAML</td><td>37.8±1.0</td><td>83.9±1.0 76.4±0.7</td><td></td><td>62.4±1.1</td><td>64.1±0.8</td><td>59.7±1.1</td><td>33.5±1.1</td><td>79.9±0.8</td><td>42.9±1.3</td><td>29.4±1.1</td><td>8.0</td></tr><tr><td>ProtoNet</td><td>44.5±1.1</td><td>79.6±1.1</td><td>71.1±0.9 67.0±1.0 65.2±0.8</td><td></td><td></td><td>64.9±0.9</td><td>40.3±1.1</td><td>86.9±0.7</td><td>46.5±1.0</td><td>39.9±1.1</td><td>7.3</td></tr><tr><td>ProtoMAML</td><td>46.5±1.1</td><td>82.7±1.0 75.2±0.8 69.9±1.0 68.3±0.8</td><td></td><td></td><td></td><td>66.8±0.9</td><td>42.0±1.2</td><td>88.7±0.7</td><td>52.4±1.1</td><td>41.7±1.1</td><td>5.4</td></tr><tr><td>CNAPs</td><td>52.3±1.0</td><td>88.4±0.7 80.5±0.6 72.2±0.9 58.3±0.7</td><td></td><td></td><td></td><td>72.5±0.8</td><td>47.4±1.0</td><td>86.0±0.5</td><td>60.2±0.9</td><td>42.6±1.1</td><td>5.1</td></tr><tr><td>BOHB-E</td><td>55.4±1.1</td><td>77.5±1.1</td><td>60.9±0.9</td><td>73.6±0.8</td><td>72.8±0.7</td><td>61.2±0.9</td><td>44.5±1.1</td><td>90.6±0.6</td><td>57.5±1.0</td><td>51.9±1.0</td><td>4.4</td></tr><tr><td>TaskNorm</td><td>50.6±1.1</td><td>90.7±0.6 83.8±0.6</td><td></td><td>574.6±0.8</td><td>62.1±0.7</td><td>74.8±0.7</td><td>48.7±1.0</td><td>89.6±0.6</td><td>67.0±0.7</td><td>43.4±1.0</td><td>3.8</td></tr><tr><td>SUR</td><td>56.3±1.1</td><td>93.1±0.5 85.4±0.7 71.4±1.0 71.5±0.8</td><td></td><td></td><td></td><td>81.3±0.6</td><td>63.1±1.0</td><td>82.8±0.7</td><td>70.4±0.8</td><td>52.4±1.1</td><td>2.5</td></tr><tr><td>SimpleCNAPS 58.6±1.1 9</td><td></td><td>91.7±0.6 82.4±0.7 74.9±0.8 67.8±0.8</td><td></td><td></td><td></td><td>77.7±0.7</td><td>46.9±1.0</td><td>90.7±0.5</td><td>73.5±0.7</td><td>46.2±1.1</td><td>2.4</td></tr><tr><td>URT(Ours)</td><td>55.7±1.0</td><td>94.4±0.4 85.8±0.6 76.3±0.8 71.8±0.7</td><td></td><td></td><td></td><td>82.5±0.6</td><td>63.5±1.0</td><td>88.2±0.6</td><td>69.4±0.8</td><td>52.2±1.1</td><td>1.6</td></tr></table>
Table 7: Test accuracy (mean $\pm \mathrm { C I } \% 9 5 $ ) over 600 few-shot tasks. All methods use parametric network family (pf) backbones.
<table><tr><td></td><td>SUR-pf</td><td>URT-pf</td><td>VS.</td></tr><tr><td>ILSVRC</td><td>56.4 ± 1.2</td><td>55.5 ± 1.1</td><td>=</td></tr><tr><td>Omniglot</td><td>88.5±0.8</td><td>90.2 ± 0.6</td><td>+</td></tr><tr><td>Aircraft</td><td>79.5 ± 0.8</td><td>79.8 ± 0.7</td><td>=</td></tr><tr><td>Birds</td><td>76.4 ± 0.9</td><td>77.5 ± 0.8</td><td>=</td></tr><tr><td>Textures</td><td>73.1 ± 0.7</td><td>73.5± 0.7</td><td>=</td></tr><tr><td>Quick Draw</td><td>75.7 ± 0.7</td><td>75.8 ± 0.7</td><td>=</td></tr><tr><td>Fungi</td><td>48.2 ± 0.9</td><td>48.1 ± 0.9</td><td>=</td></tr><tr><td>VGG Flower</td><td>90.6 ± 0.5</td><td>91.9 ± 0.5</td><td>+</td></tr><tr><td>Traffic Signs</td><td>65.1 ± 0.8</td><td>67.5 ± 0.8</td><td>+</td></tr><tr><td>MSCOCO</td><td>52.1 ± 1.0</td><td>52.1 ± 1.0</td><td>=</td></tr><tr><td>MNIST</td><td>93.2 ± 0.4</td><td>93.9 ± 0.4</td><td>=</td></tr><tr><td>CIFAR10</td><td>66.4 ± 0.8</td><td>66.1 ± 0.8</td><td>=</td></tr><tr><td>CIFAR100</td><td>57.1 ± 1.0</td><td>57.3 ±1.0</td><td>=</td></tr></table>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289# TOWARDS FASTER AND STABILIZED GAN TRAINING FOR HIGH-FIDELITY FEW-SHOT IMAGE SYNTHESIS
Bingchen ${ \bf L i u ^ { 1 , 2 } }$ , Yizhe $\mathbf { Z } \mathbf { h } \mathbf { u } ^ { 2 }$ , Kunpeng $\mathbf { S o n g ^ { 1 , 2 } }$ , Ahmed Elgammal1,2
1Playform - Artrendex Inc., USA 2Department of Computer Science, Rutgers University {bingchen.liu,yizhe.zhu,kunpeng.song}@rutgers.edu elgammal@artrendex.com
# ABSTRACT
Training Generative Adversarial Networks (GAN) on high-fidelity images usually requires large-scale GPU-clusters and a vast number of training images. In this paper, we study the few-shot image synthesis task for GAN with minimum computing cost. We propose a light-weight GAN structure that gains superior quality on $1 0 2 4 \times 1 0 2 4$ resolution. Notably, the model converges from scratch with just a few hours of training on a single RTX-2080 GPU, and has a consistent performance, even with less than 100 training samples. Two technique designs constitute our work, a skip-layer channel-wise excitation module and a self-supervised discriminator trained as a feature-encoder. With thirteen datasets covering a wide variety of image domains 1, we show our model’s superior performance compared to the state-of-the-art StyleGAN2, when data and computing budget are limited.
# 1 INTRODUCTION
The fascinating ability to synthesize images using the state-of-the-art (SOTA) Generative Adversarial Networks (GANs) (Goodfellow et al., 2014) display a great potential of GANs for many intriguing real-life applications, such as image translation, photo editing, and artistic creation. However, expensive computing cost and the vast amount of required training data limit these SOTAs in real applications with only small image sets and low computing budgets.
In real-life scenarios, the available samples to train a GAN can be minimal, such as the medical images of a rare disease, a particular celebrity’s portrait set, and a specific artist’s artworks. Transferlearning with a pre-trained model (Mo et al., 2020; Wang et al., 2020) is one solution for the lack of training images. Nevertheless, there is no guarantee to find a compatible pre-training dataset. Furthermore, if not, fine-tuning probably leads to even worse performance (Zhao et al., 2020).
 Figure 1: Synthetic results on $1 0 2 4 ^ { 2 }$ resolution of our model, trained from scratch on single RTX 2080-Ti GPU, with only 1000 images. Left: 20 hours on Nature photos; Right: 10 hours on FFHQ.
In a recent study, it was highlighted that in art creation applications, most artists prefers to train their models from scratch based on their own images to avoid biases from fine-tuned pre-trained model. Moreover, It was shown that in most cases artists want to train their models with datasets of less than
100 images (Elgammal et al., 2020). Dynamic data-augmentation (Karras et al., 2020a; Zhao et al., 2020) smooths the gap and stabilizes GAN training with fewer images. However, the computing cost from the SOTA models such as StyleGAN2 (Karras et al., 2020b) and BigGAN (Brock et al., 2019) remain to be high, especially when trained with the image resolution on $1 0 2 4 \times 1 0 2 4$ .
In this paper, our goal is to learn an unconditional GAN on high-resolution images, with low computational cost and few training samples. As summarized in Fig. 2, these training conditions expose the model to a high risk of overfitting and mode-collapse (Arjovsky & Bottou, 2017; Zhang & Khoreva, 2018). To train a GAN given the demanding training conditions, we need a generator $( G )$ that can learn fast, and a discriminator $( D )$ that can continuously provide useful signals to train $G$ . To address these challenges, we summarize our contribution as:
• We design the Skip-Layer channel-wise Excitation (SLE) module, which leverages lowscale activations to revise the channel responses on high-scale feature-maps. SLE allows a more robust gradient flow throughout the model weights for faster training. It also leads to an automated learning of a style/content disentanglement like StyleGAN2. We propose a self-supervised discriminator $D$ trained as a feature-encoder with an extra decoder. We force $D$ to learn a more descriptive feature-map covering more regions from an input image, thus yielding more comprehensive signals to train $G$ . We test multiple selfsupervision strategies for $D$ , among which we show that auto-encoding works the best. • We build a computational-efficient GAN model based on the two proposed techniques, and show the model’s robustness on multiple high-fidelity datasets, as demonstrated in Fig. 1.
# 2 RELATED WORKS
Speed up the GAN training: Speeding up the training of GAN has been approached from various perspectives. Ngxande et al. propose to reduce the computing time with depth-wise convolutions. Zhong et al. adjust the GAN objective into a min-max-min problem for a shorter optimization path. Sinha et al. suggest to prepare each batch of training samples via a coreset selection, leverage the better data preparation for a faster convergence. However, these methods only bring a limited improvement in
 Figure 2: The causes and challenges for training GAN in our studied conditions.
training speed. Moreover, the synthesis quality is not advanced within the shortened training time.
Train GAN on high resolution: High-resolution training for GAN can be problematic. Firstly, the increased model parameters lead to a more rigid gradient flow to optimize $G$ . Secondly, the target distribution formed by the images on $1 0 2 4 \times 1 0 2 4$ resolution is super sparse, making GAN much harder to converge. Denton et al. (2015); Zhang et al. (2017); Huang et al. (2017); Wang et al. (2018); Karras et al. (2019); Karnewar & Wang (2020); Karras et al. (2020b); Liu et al. (2021) develop the multi-scale GAN structures to alleviate the gradient flow issue, where $G$ outputs images and receives feedback from several resolutions simultaneously. However, all these approaches further increase the computational cost, consuming even more GPU memory and training time.
Stabilize the GAN training: Mode-collapse on $G$ is one of the big challenges when training GANs. And it becomes even more challenging given fewer training samples and a lower computational budget (a smaller batch-size). As $D$ is more likely to be overfitting on the datasets, thus unable to provide meaningful gradients to train $G$ (Gulrajani et al., 2017).
Prior works tackle the overfitting issue by seeking a good regularization for $D$ , including different objectives (Arjovsky et al., 2017; Lim & Ye, 2017; Tran et al., 2017); regularizing the gradients (Gulrajani et al., 2017; Mescheder et al., 2018); normalizing the model weights (Miyato et al., 2018); and augmenting the training data (Karras et al., 2020a; Zhao et al., 2020). However, the effects of these methods degrade fast when the training batch-size is limited, since appropriate batch statistics can hardly be calculated for the regularization (normalization) over the training iterations.
Meanwhile, self-supervision on $D$ has been shown to be an effective method to stabilize the GAN training as studied in Tran et al. (2019); Chen et al. (2019). However, the auxiliary self-supervision tasks in prior works have limited using scenario and image domain. Moreover, prior works only studied on low resolution images ( $3 2 ^ { 2 }$ to $1 2 8 ^ { 2 }$ ), and without a computing resource limitation.
# 3 METHOD
We adopt a minimalistic design for our model. In particular, we use a single conv-layer on each resolution in $G$ , and apply only three (input and output) channels for the conv-layers on the high resolutions $( \geq 5 1 2 \times 5 1 2 )$ in both $G$ and $D$ . Fig. 3 and Fig. 4 illustrate the model structure for our $G$ and $D$ , with descriptions of the component layers and forward flow. These structure designs make our GAN much smaller than SOTA models and substantially faster to train. Meanwhile, our model remains robust on small datasets due to its compact size with the two proposed techniques.
 Figure 3: The structure of the skip-layer excitation module and the Generator. Yellow boxes represent feature-maps (we show the spatial size and omit the channel number), blue box and blue arrows represent the same up-sampling structure, red box contains the SLE module as illustrated on the left.
# 3.1 SKIP-LAYER CHANNEL-WISE EXCITATION
For synthesizing higher resolution images, the generator $G$ inevitably needs to become deeper, with more conv-layers, in concert with the up-sampling needs. A deeper model with more convolution layers leads to a longer training time of GAN, due to the increased number of model parameters and a weaker gradient flow through $G$ (Zhang et al., 2017; Karras et al., 2018; Karnewar & Wang, 2020). To better train a deep model, He et al. design the Residual structure (ResBlock), which uses a skip-layer connection to strengthen the gradient signals between layers. However, while ResBlock has been widely used in GAN literature (Wang et al., 2018; Karras et al., 2020b), it also increases the computation cost.
We reformulate the skip-connection idea with two unique designs into the Skip-Layer Excitation module (SLE). First, ResBlock implements skip-connection as an element-wise addition between the activations from different conv-layers. It requires the spatial dimensions of the activations to be the same. Instead of addition, we apply channel-wise multiplications between the activations, eliminating the heavy computation of convolution (since one side of the activations now has a spatial dimension of $1 ^ { 2 }$ ). Second, in prior GAN works, skip-connections are only used within the same resolution. In contrast, we perform skip-connection between resolutions with a much longer range (e.g., $8 ^ { 2 }$ and $1 2 8 ^ { 2 }$ , $1 6 ^ { 2 }$ and $2 5 6 ^ { 2 }$ ), since an equal spatial-dimension is no longer required. The two designs make SLE inherits the advantages of ResBlock with a shortcut gradient flow, meanwhile without an extra computation burden.
Formally, we define the Skip-Layer Excitation module as:
$$\mathbf { y } = \mathcal { F } ( \mathbf { x } _ { l o w } , \{ \mathbf { W } _ { i } \} ) \cdot \mathbf { x } _ { h i g h }$$
Here $\mathbf { x }$ and $\mathbf { y }$ are the input and output feature-maps of the SLE module, the function $\mathcal { F }$ contains the operations on $\mathbf { x } _ { l o w }$ , and $\mathbf { W } _ { i }$ indicates the module weights to be learned. The left panel in Fig. 3 shows an SLE module in practice, where $\mathbf { x } _ { l o w }$ and ${ \bf x } _ { h i g h }$ are the feature-maps at $8 \times 8$ and $1 2 8 \times 1 2 8$ resolution respectively. An adaptive average-pooling layer in $\mathcal { F }$ first down-samples $\mathbf { x } _ { l o w }$ into $4 \times 4$ along the spatial-dimensions, then a conv-layer further down-samples it into $1 \times 1$ . A LeakyReLU is used to model the non-linearity, and another conv-layer projects $\mathbf { x } _ { l o w }$ to have the same channel size as ${ \bf x } _ { h i g h }$ . Finally, after a gating operation via a Sigmoid function, the output from $\mathcal { F }$ multiplies ${ \bf x } _ { h i g h }$ along the channel dimension, yielding y with the same shape as ${ \bf x } _ { h i g h }$ .
SLE partially resembles the Squeeze-and-Excitation module (SE) proposed by Hu et al.. However, SE operates within one feature-map as a self-gating module. In comparison, SLE performs between feature-maps that are far away from each other. While SLE brings the benefit of channel-wise feature re-calibration just like SE, it also strengthens the whole model’s gradient flow like ResBlock. The channel-wise multiplication in SLE also coincides with Instance Normalization (Ulyanov et al., 2016; Huang & Belongie, 2017), which is widely used in style-transfer. Similarly, we show that SLE enables $G$ to automatically disentangle the content and style attributes, just like StyleGAN (Karras et al., 2019). As SLE performs on high-resolution feature-maps, altering these feature-maps is shown to be more likely to change the style attributes of the generated image (Karras et al., 2019; Liu et al., 2021). By replacing $\mathrm { x } _ { l o w }$ in SLE from another synthesized sample, our $G$ can generate an image with the content unchanged, but in the same style of the new replacing image.
# 3.2 SELF-SUPERVISED DISCRIMINATOR
Our approach to provide a strong regularization for $D$ is surprisingly simple. We treat $D$ as an encoder and train it with small decoders. Such auto-encoding training forces $D$ to extract image features that the decoders can give good reconstructions. The decoders are optimized together with $D$ on a simple reconstruction loss, which is only trained on real samples:
$$\mathcal { L } _ { r e c o n s } = \mathbb { E } _ { { \mathbf { f } } \sim D _ { e n c o d e } ( x ) , x \sim I _ { r e a l } } [ | | \mathcal { G } ( { \mathbf { f } } ) - \mathcal { T } ( x ) | | ] ,$$
where f is the intermediate feature-maps from $D$ , the function $\mathcal { G }$ contains the processing on $\mathbf { f }$ and the decoder, and the function $\tau$ represents the processing on sample $x$ from real images $I _ { r e a l }$ .
 Figure 4: The structure and the forward flow of the Discriminator. Blue box and arrows represent the same residual down-sampling structure, green boxes mean the same decoder structure.
Our self-supervised $D$ is illustrated in Fig. 4, where we employ two decoders for the feature-maps on two scales: $\mathbf { f } _ { 1 }$ on $1 6 ^ { 2 }$ and $\mathbf { f } _ { 2 }$ on $8 ^ { 2 }$ . The decoders only have four conv-layers to produce images at $1 2 8 \times 1 2 8$ resolution, causing little extra computations (much less than other regularization methods). We randomly crop $\mathbf { f } _ { 1 }$ with $\frac { 1 } { 8 }$ of its height and width, then crop the real image on the same portion to get $I _ { p a r t }$ . We resize the real image to get $I$ . The decoders produce $I _ { p a r t } ^ { \prime }$ from the cropped $\mathbf { f } _ { 1 }$ , and $I ^ { \prime }$ from $\mathbf { f } _ { 2 }$ . Finally, $D$ and the decoders are trained together to minimize the loss in eq. 2, by matching $I _ { p a r t } ^ { \prime }$ to $I _ { p a r t }$ and $I ^ { \prime }$ to $I$ .
Such reconstructive training makes sure that $D$ extracts a more comprehensive representation from the inputs, covering both the overall compositions (from $\mathbf { f } _ { 2 }$ ) and detailed textures (from $\mathbf { f } _ { 1 }$ ). Note that the processing in $\mathcal { G }$ and $\tau$ are not limited to cropping; more operations remain to be explored for better performance. The auto-encoding approach we employ is a typical method for self-supervised learning, which has been well recognized to improve the model robustness and generalization ability (He et al., 2020; Hendrycks et al., 2019; Jing & Tian, 2020; Goyal et al., 2019). In the context of GAN, we find that a regularized $D$ via self-supervision training strategies significantly improves the synthesis quality on $G$ , among which auto-encoding brings the most performance boost.
Although our self-supervision strategy for $D$ comes in the form of an auto-encoder (AE), this approach is fundamentally different from works trying to combine GAN and AE (Larsen et al., 2016;
Guo et al., 2019; Zhao et al., 2016; Berthelot et al., 2017). The latter works mostly train $G$ as a decoder on a learned latent space from $D$ , or treat the adversarial training with $D$ as an supplementary loss besides AE’s training. In contrast, our model is a pure GAN with a much simpler training schema. The auto-encoding training is only for regularizing $D$ , where $G$ is not involved.
In sum, we employ the hinge version of the adversarial loss (Lim & Ye (2017); Tran et al. (2017)) to iteratively train our $\mathrm { D }$ and G. We find the different GAN losses make little performance difference, while hinge loss computes the fastest:
$$\begin{array} { r l } & { \mathcal { L } _ { D } = - \mathbb { E } _ { x \sim I _ { r { e a l } } } [ m i n ( 0 , - 1 + D ( x ) ) ] - \mathbb { E } _ { \hat { x } \sim G ( z ) } [ m i n ( 0 , - 1 - D ( \hat { x } ) ] + \mathcal { L } _ { r e c o n s } } \\ & { \mathcal { L } _ { G } = - \mathbb { E } _ { z \sim N } [ D ( G ( z ) ) ] , } \end{array}$$
# 4 EXPERIMENT
Datasets: We conduct experiments on multiple datasets with a wide range of content categories. On $2 5 6 \times 2 5 6$ resolution, we test on Animal-Face Dog and Cat (Si & Zhu, 2011), 100-Shot-Obama, Panda, and Grumpy-cat (Zhao et al., 2020). On $1 0 2 4 \times 1 0 2 4$ resolution, we test on Flickr-FaceHQ (FFHQ) (Karras et al., 2019), Oxford-flowers (Nilsback & Zisserman, 2006), art paintings from WikiArt (wikiart.org), photographs on natural landscape from Unsplash (unsplash.com), Pokemon (pokemon.com), anime face, skull, and shell. These datasets are designed to cover images with different characteristics: photo realistic, graphic-illustration, and art-like images.
Metrics: We use two metrics to measure the models’ synthesis performance: 1) Frechet Inception ´ Distance (FID) (Heusel et al., 2017) measures the overall semantic realism of the synthesized images. For datasets with less than 1000 images (most only have 100 images), we let $G$ generate 5000 images and compute FID between the synthesized images and the whole training set. 2) Learned perceptual similarity (LPIPS) (Zhang et al., 2018) provides a perceptual distance between two images. We use LPIPS to report the reconstruction quality when we perform latent space back-tracking on $G$ given real images, and measure the auto-encoding performance. We find it unnecessary to involve other metrics, as FID is unlikely to be inconsistent with the others, given the notable performance gap between our model and the compared ones. For all the testings, we train the models 5 times with random seeds, and report the highest scores. The relative error is less than five percent on average.
Compared Models: We compare our model with: 1) the state-of-the-art (SOTA) unconditional model, StyleGAN2, 2) a baseline model ablated from our proposed one. Note that we adopt StyleGAN2 with recent studies from (Karras et al., 2020a; Zhao et al., 2020), including the model configuration and differentiable data-augmentation, for the best training on few-sample datasets. Since StyleGAN2 requires much more computing-cost (cc) to train, we derive an extra baseline model. In sum, we compare our model with StyleGAN2 on the absolute image synthesis quality regardless of cc, and use the baseline model for the reference within a comparable cc range.
The baseline model is the strongest performer that we integrated from various GAN techniques based on DCGAN (Radford et al., 2015): 1) spectral-normalization (Miyato et al., 2018), 2) exponentialmoving-average (Yazıcı et al., 2018) optimization on $G$ , 3) differentiable-augmentation, 4) GLU (Dauphin et al., 2017) instead of ReLU in $G$ . We build our model upon the baseline with the two proposed techniques: the skip-layer excitation module and the self-supervised discriminator.
Table 1: Computational cost comparison of the models.
<table><tr><td></td><td></td><td>StyleGAN2@0.25</td><td>StyleGAN2@0.5</td><td>StyleGAN2</td><td>Baseline</td><td>Ours</td></tr><tr><td rowspan="2">Resolution: 2562 Batch-size: 8</td><td>Training time (hour/10k iter) Training vram (GB)</td><td>1</td><td>1.8</td><td>3.8</td><td>0.7</td><td>1</td></tr><tr><td>Model parameters (million)</td><td>7 27.557</td><td>16 45.029</td><td>18 108.843</td><td>5</td><td>6.5 47.363</td></tr><tr><td rowspan="2">Resolution: 10242</td><td>Training time (hour/10k iter)</td><td></td><td></td><td></td><td>44.359</td><td></td></tr><tr><td>Training vram (GB)</td><td>3.6</td><td>5</td><td>7</td><td>1.3</td><td>1.7</td></tr><tr><td rowspan="2">Batch-size: 8</td><td>Model parameters (million)</td><td>12</td><td>23</td><td>36</td><td>9</td><td>10</td></tr><tr><td></td><td>27.591</td><td>45.15</td><td>109.229</td><td>44.377</td><td>47.413</td></tr></table>
Table. 1 presents the normalized cc figures of the models on Nvidia’s RTX 2080-Ti GPU, implemented using PyTorch (Paszke et al., 2017). Importantly, the slimed StyleGAN2 with $\frac { 1 } { 4 }$ parameters cannot converge on the tested datasets at $1 0 2 4 ^ { 2 }$ resolution. We compare to the StyleGAN2 with $\frac { 1 } { 2 }$ parameters (if not specifically mentioned) in the following experiments.
# 4.1 IMAGE SYNTHESIS PERFORMANCE
Few-shot generation: Collecting large-scale image datasets are expensive, or even impossible, for a certain character, a genre, or a topic. On those few-shot datasets, a data-efficient model becomes especially valuable for the image generation task. In Table. 2 and Table. 3, we show that our model not only achieves superior performance on the few-shot datasets, but also much more computationalefficient than the compared methods. We save the checkpoints every 10k iterations during training and report the best FID from the checkpoints (happens at least after 15 hours of training for StyleGAN2 on all datasets). Among the 12 datasets, our model performs the best on 10 of them.
Please note that, due to the VRAM requirement for StyleGAN2 when trained on $1 0 2 4 ^ { 2 }$ resolution, we have to train the models in Table. 3 on a RTX TITAN GPU. In practice, 2080-TI and TITAN share a similar performance, and our model runs the same time on both GPUs.
Table 2: FID comparison at $2 5 6 ^ { 2 }$ resolution on few-sample datasets.
<table><tr><td colspan="4">Animal Face- Dog</td><td>Animal Face - Cat</td><td>Obama</td><td>Panda</td><td>Grumpy-cat</td></tr><tr><td colspan="3">Image number</td><td>389</td><td>160</td><td>100</td><td>100</td><td>100</td></tr><tr><td rowspan="5">Training time on one RTX 2080-Ti</td><td rowspan="5">20 hour</td><td>StyleGAN2</td><td>58.85</td><td>42.44</td><td>46.87</td><td>12.06</td><td>27.08</td></tr><tr><td>StyleGAN2 finetune</td><td>61.03</td><td>46.07</td><td>35.75</td><td>14.5</td><td>29.34</td></tr><tr><td>Baseline 5 hour</td><td>108.19</td><td>150.3</td><td>62.74</td><td>15.4</td><td>42.13</td></tr><tr><td>Baseline+Skip</td><td>94.21</td><td>72.97</td><td>52.50</td><td>14.39</td><td>38.17</td></tr><tr><td>Baseline+decode Ours (B+Skip+decode)</td><td>56.25 50.66</td><td>36.74 35.11</td><td>44.34 41.05</td><td>10.12 10.03</td><td>29.38 26.65</td></tr></table>
Training from scratch vs. fine-tuning: Fine-tuning from a pre-trained GAN (Mo et al., 2020; Noguchi & Harada, 2019; Wang et al., 2020) has been the go-to method for the image generation task on datasets with few samples. However, its performance highly depends on the semantic consistency between the new dataset and the available pre-trained model. According to Zhao et al., fine-tuning performs worse than training from scratch in most cases, when the content from the new dataset strays away from the original one. We confirm the limitation of current fine-tuning methods from Table. 2 and Table. 3, where we fine-tune StyleGAN2 trained on FFHQ use the Freeze-D method from Mo et al.. Among all the tested datasets, only Obama and Skull favor the fine-tuning method, making sense since the two sets share the most similar contents to FFHQ.
Module ablation study: We experiment with the two proposed modules in Table. 2, where both SLE (skip) and decoding-on- $. D$ (decode) can separately boost the model performance. It shows that the two modules are orthogonal to each other in improving the model performance, and the self-supervised $D$ makes the biggest contribution. Importantly, the baseline model and StyleGAN2 diverge fast after the listed training time. In contrast, our model is less likely to mode collapse among the tested datasets. Unlike the baseline model which usually model-collapse after trained for 10 hours, our model maintains a good synthesis quality and won’t collapse even after trained for 20 hours. We argue that it is the decoding regularization on $D$ that prevents the model from divergence.
Table 3: FID comparison at $1 0 2 4 ^ { 2 }$ resolution on few-sample datasets.
<table><tr><td></td><td></td><td></td><td>Art Paintings</td><td>FFHQ</td><td>Flower</td><td>Pokemon</td><td>Anime Face</td><td>Skull</td><td>Shell</td></tr><tr><td colspan="3">Image number</td><td>1000</td><td>1000</td><td>1000</td><td>800</td><td>120</td><td>100</td><td>60</td></tr><tr><td rowspan="2">Training time on one RTX TITAN</td><td>24 hour</td><td>StyleGAN2 StyleGAN2 finetune</td><td>74.56 N/A</td><td>25.66 N/A</td><td>45.23 36.72</td><td>190.23 60.12</td><td>152.73 61.23</td><td>127.98 107.68</td><td>241.37</td></tr><tr><td>8 hour</td><td>Baseline Ours</td><td>62.27 45.08</td><td>38.35 24.45</td><td>42.25</td><td>67.86</td><td>101.23</td><td>186.45</td><td>220.45 202.32</td></tr></table>
Table 4: FID comparison at $1 0 2 4 ^ { 2 }$ resolution on datasets with more images.
<table><tr><td rowspan="2">Model</td><td>Dataset</td><td colspan="3">Art Paintings</td><td colspan="3">FFHQ</td><td colspan="3">Nature Photograph</td></tr><tr><td>Image number</td><td>2k 5k</td><td>10k</td><td>2k</td><td>5k</td><td>10k</td><td>70k</td><td>2k</td><td>5k</td><td>10k</td></tr><tr><td colspan="2">StyleGAN2</td><td>70.02</td><td>48.36</td><td>41.23</td><td>18.38</td><td>10.45</td><td>7.86</td><td>4.4</td><td>67.12</td><td>41.47 39.05</td></tr><tr><td colspan="2">Baseline</td><td>60.02</td><td>51.23</td><td>49.38</td><td>36.45</td><td>27.86</td><td>25.12</td><td>17.62 71.47</td><td>66.05</td><td>62.28</td></tr><tr><td colspan="2">Ours</td><td>44.57</td><td>43.27</td><td>42.53</td><td>19.01</td><td>17.93</td><td>16.45</td><td>12.38 52.47</td><td>45.07</td><td>43.65</td></tr></table>
Table 5: LPIPS of back-tracking with $G$
<table><tr><td></td><td>Cat</td><td>Dog</td><td>FFHQ</td><td>Art</td></tr><tr><td>Resolution</td><td colspan="2">256</td><td colspan="2">1024</td></tr><tr><td>Baseline @ 20k iter</td><td>2.113</td><td>2.073</td><td>2.589</td><td>2.916</td></tr><tr><td>Baseline @ 40k iter</td><td>2.513</td><td>2.171</td><td>2.583</td><td>2.812</td></tr><tr><td>Ours @ 40k iter</td><td>1.821</td><td>1.918</td><td>2.425</td><td>2.624</td></tr><tr><td>Ours @ 80k iter</td><td>1.897</td><td>1.986</td><td>2.342</td><td>2.601</td></tr></table>
 Figure 6: Latent space back-tracking and interpolation.
Table 6: FID of self-supervisions for $D$
<table><tr><td></td><td>Art paintings</td><td>Nature photos</td></tr><tr><td>a. contrastive loss</td><td>47.14</td><td>57.04</td></tr><tr><td>b. predict aspect ratio</td><td>49.21</td><td>59.22</td></tr><tr><td>c.auto-encoding</td><td>42.53</td><td>43.65</td></tr><tr><td>d.a+b</td><td>46.02</td><td>54.23</td></tr><tr><td>e.a+b+c</td><td>44.21</td><td>47.65</td></tr></table>
Training with more images: For more thorough evaluation, we also test our model on datasets with more sufficient training samples, as shown in Table. 4. We train the full StyleGAN2 for around five days on the Art and Photograph dataset with a batch-size of 16 on two TITAN RTX GPUs, and use the latest official figures on FFHQ from Zhao et al.. Instead, we train our model for only 24 hours, with a batch-size of 8 on a single 2080-Ti GPU. Specifically, for FFHQ with all 70000 images, we train our model with a larger batch-size of 32, to reflect an optimal performance of our model.
In this test, we follow the common practice of computing FID by generating $5 0 \mathrm { k }$ images and use the whole training set as the reference distribution. Note that StyleGAN2 has more than double the parameters compared to our model, and trained with a much larger batch-size on FFHQ. These factors contribute to its better performances when given enough training samples and computing power. Meanwhile, our model keeps up well with StyleGAN2 across all testings with a considerably lower computing budget, showing a compelling performance even on larger-scale datasets, and a consistent performance boost over the baseline model.
Qualitative results: The advantage of our model becomes more clear from the qualitative comparisons in Fig. 5. Given the same batch-size and training time, StyleGAN2 either converges slower or suffers from mode collapse. In contrast, our model consistently generates satisfactory images. Note that the best results from our model on Flower, Shell, and Pokemon only take three hours’ training, and for the rest three datasets, the best performance is achieved at training for eight hours. For StyleGAN2 on “shell”, “anime face”, and “Pokemon”, the images shown in Fig. 5 are already from the best epoch, which they match the scores in Table. 2 and Table. 3. For the rest of the datasets, the quality increase from StyleGAN2 is also limited given more training time.
# 4.2 MORE ANALYSIS AND APPLICATIONS
Testing mode collapse with back-tracking: From a well trained GAN, one can take a real image and invert it back to a vector in the latent space of $G$ , thus editing the image’s content by altering the back-tracked vector. Despite the various back-tracking methods (Zhu et al., 2016; Lipton & Tripathi, 2017; Zhu et al., 2020; Abdal et al., 2019), a well generalized $G$ is arguably as important for the good inversions. To this end, we show that our model, although trained on limited image samples, still gets a desirable performance on real image back-tracking.
In Table 5, we split the images from each dataset with a training/testing ratio of 9:1, and train $G$ on the training set. We compute a reconstruction error between all the images from the testing set and their inversions from $G$ , after the same update of 1000 iterations on the latent vectors (to prevent the vectors from being far off the normal distribution). The baseline model’s performance is getting worse with more training iterations, which reflects mode-collapse on $G$ . In contrast, our model gives better reconstructions with consistent performance over more training iterations. Fig. 6 presents the back-tracked examples (left-most and right-most samples in the middle panel) given the real images.
 Figure 5: Qualitative comparison between our model and StyleGAN2 on $1 0 2 4 ^ { 2 }$ resolution datasets. The left-most panel shows the training images, and the right two panels show the uncurated samples from StyleGAN2 and our model. Both models are trained from scratch for 10 hours with a batch-size of 8. The samples are generated from the checkpoint with the lowest FID.
The smooth interpolations from the back-tracked latent vectors also suggest little mode-collapse of our $G$ (Radford et al., 2015; Zhao et al., 2020; Robb et al., 2020).
In addition, we show qualitative comparisons in appendix D, where our model maintains a good generation while StyleGAN2 and baseline are model-collapsed.
The self-supervision methods and generalization ability on $D$ : Apart from the auto-encoding training for $D$ , we show that $D$ with other common self-supervising strategies also boost GAN’s performance in our training settings. We test five self-supervision settings, as shown in Table 6, which all brings a substantial performance boost compared to the baseline model. Specifically, setting-a refers to contrastive learning which we treat each real image as a unique class and let $D$ classify them. For setting- $\mathbf { \sigma } . \mathbf { b }$ , we train $D$ to predict the real image’s original aspect-ratio since they are reshaped to square when fed to $D$ . Setting-c is the method we employ in our model, which trains $D$ as an encoder with a decoder to reconstruct real images. To better validate the benefit of self-supervision on $D$ , all the testings are conducted on full training sets with 10000 images, with a batch-size of 8 to be consistent with Table 4. We also tried training with a larger batch-size of 16, which the results are consistent to the batch-size of 8.
 Figure 7: Style-mixing results from our model trained for only 5 hours on single GPU.
Interestingly, according to Table 6, while setting-c performs the best, combining it with the rest two settings lead to a clear performance downgrade. The similar behavior can be found on some other self-supervision settings, e.g. when follow Chen et al. (2019) with a ”rotation-predicting” task on art-paintings and FFHQ datasets, we observe a performance downgrade even compared to the baseline model. We hypothesis the reason being that the auto-encoding forces $D$ to pay attention to more areas of the input image, thus extracts a more comprehensive feature-map to describe the input image (for a good reconstruction). In contrast, a classification task does not guarantee $D$ to cover the whole image. Instead, the task drives $D$ to only focus on small regions because the model can find class cues from small regions of the images. Focusing on limited regions (i.e., react to limited image patterns) is a typical overfitting behavior, which is also widely happening for $D$ in vanilla GANs. More discussion can be found in appendix B.
Style mixing like StyleGAN. With the channel-wise excitation module, our model gets the same functionality as StyleGAN: it learns to disentangle the images’ high-level semantic attributes (style and content) in an unsupervised way, from $G$ ’s conv-layers at different scales. The style-mixing results are displayed in Fig. 7, where the top three datasets are $2 5 6 \times 2 5 6$ resolution, and the bottom three are $1 0 2 4 \times 1 0 2 4$ resolution. While StyleGAN2 suffers from converging on the bottom high-resolution datasets, our model successfully learns the style representations along the channel dimension on the “excited” layers (i.e., for feature-maps on $2 5 6 \times 2 5 6$ , $5 1 2 \times 5 1 2$ resolution). Please refer to appendix A and C for more information on SLE and style-mixing.
# 5 CONCLUSION
We introduce two techniques that stabilize the GAN training with an improved synthesis quality, given sub-hundred high-fidelity images and a limited computing resource. On thirteen datasets with a diverse content variation, we show that a skip-layer channel-wise excitation mechanism (SLE) and a self-supervised regularization on the discriminator significantly boost the synthesis performance of GAN. Both proposed techniques require minor changes to a vanilla GAN, enhancing GAN’s practicality with a desirable plug-and-play property. We hope this work can benefit downstream tasks of GAN and provide new study perspectives for future research.
# REFERENCES
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, pp. 4432–4441, 2019.
Martin Arjovsky and Leon Bottou. Towards principled methods for training generative adversarial ´ networks. In International Conference on Learning Representations, 2017.
Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks. ´ In International conference on machine learning, pp. 214–223. PMLR, 2017.
David Berthelot, Thomas Schumm, and Luke Metz. Began: Boundary equilibrium generative adversarial networks. arXiv preprint arXiv:1703.10717, 2017.
Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale GAN training for high fidelity natural image synthesis. In International Conference on Learning Representations, 2019.
Ting Chen, Xiaohua Zhai, Marvin Ritter, Mario Lucic, and Neil Houlsby. Self-supervised gans via auxiliary rotation loss. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 12154–12163, 2019.
Yann N Dauphin, Angela Fan, Michael Auli, and David Grangier. Language modeling with gated convolutional networks. In International conference on machine learning, pp. 933–941, 2017.
Emily L Denton, Soumith Chintala, Rob Fergus, et al. Deep generative image models using a laplacian pyramid of adversarial networks. In Advances in neural information processing systems, pp. 1486–1494, 2015.
Ahmed Elgammal, Marian Mazzone, et al. Artists, artificial intelligence and machine-based creativity in playform. Artnodes, (26):1–8, 2020.
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.
Priya Goyal, Dhruv Mahajan, Abhinav Gupta, and Ishan Misra. Scaling and benchmarking selfsupervised visual representation learning. In Proceedings of the IEEE International Conference on Computer Vision, pp. 6391–6400, 2019.
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.
Yong Guo, Qi Chen, Jian Chen, Qingyao Wu, Qinfeng Shi, and Mingkui Tan. Auto-embedding generative adversarial networks for high resolution image synthesis. IEEE Transactions on Multimedia, 21(11):2726–2737, 2019.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770–778, 2016.
Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9729–9738, 2020.
Dan Hendrycks, Mantas Mazeika, Saurav Kadavath, and Dawn Song. Using self-supervised learning can improve model robustness and uncertainty. In Advances in Neural Information Processing Systems, pp. 15663–15674, 2019.
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.
Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7132–7141, 2018.
Xun Huang and Serge Belongie. Arbitrary style transfer in real-time with adaptive instance normalization. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1501– 1510, 2017.
Xun Huang, Yixuan Li, Omid Poursaeed, John Hopcroft, and Serge Belongie. Stacked generative adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5077–5086, 2017.
Longlong Jing and Yingli Tian. Self-supervised visual feature learning with deep neural networks: A survey. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020.
Animesh Karnewar and Oliver Wang. Msg-gan: Multi-scale gradients for generative adversarial networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7799–7808, 2020.
Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of GANs for improved quality, stability, and variation. In International Conference on Learning Representations, 2018.
Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4401–4410, 2019.
Tero Karras, Miika Aittala, Janne Hellsten, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Training generative adversarial networks with limited data. arXiv preprint arXiv:2006.06676, 2020a.
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, pp. 8110–8119, 2020b.
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. PMLR, 2016.
Jae Hyun Lim and Jong Chul Ye. Geometric gan. arXiv preprint arXiv:1705.02894, 2017.
Zachary C. Lipton and Subarna Tripathi. Precise recovery of latent vectors from generative adversarial networks. ICLR workshop, 2017.
Bingchen Liu, Kunpeng Song, Yizhe Zhu, Gerard de Melo, and Ahmed Elgammal. Time: Text and image mutual-translation adversarial networks. In Thirty-Fifth AAAI Conference on Artificial Intelligence, 2021.
Lars Mescheder, Andreas Geiger, and Sebastian Nowozin. Which training methods for gans do actually converge? In International conference on machine learning, pp. 3481–3490. PMLR, 2018.
Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. In International Conference on Learning Representations, 2018.
Sangwoo Mo, Minsu Cho, and Jinwoo Shin. Freeze discriminator: A simple baseline for fine-tuning gans. arXiv preprint arXiv:2002.10964, 2020.
Mkhuseli Ngxande, Jules-Raymond Tapamo, and Michael Burke. Depthwisegans: Fast training generative adversarial networks for realistic image synthesis. In 2019 Southern African Universities Power Engineering Conference/Robotics and Mechatronics/Pattern Recognition Association of South Africa (SAUPEC/RobMech/PRASA), pp. 111–116. IEEE, 2019.
Maria-Elena Nilsback and Andrew Zisserman. A visual vocabulary for flower classification. In IEEE Conference on Computer Vision and Pattern Recognition, volume 2, pp. 1447–1454, 2006.
Atsuhiro Noguchi and Tatsuya Harada. Image generation from small datasets via batch statistics adaptation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2750– 2758, 2019.
Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017.
Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
Esther Robb, Wen-Sheng Chu, Abhishek Kumar, and Jia-Bin Huang. Few-shot adaptation of generative adversarial networks. arXiv preprint arXiv:2010.11943, 2020.
Zhangzhang Si and Song-Chun Zhu. Learning hybrid image templates (hit) by information projection. IEEE Transactions on pattern analysis and machine intelligence, 34(7):1354–1367, 2011.
Samarth Sinha, Han Zhang, Anirudh Goyal, Yoshua Bengio, Hugo Larochelle, and Augustus Odena. Small-gan: Speeding up gan training using core-sets. arXiv preprint arXiv:1910.13540, 2019.
Dustin Tran, Rajesh Ranganath, and David M Blei. Deep and hierarchical implicit models. arXiv preprint arXiv:1702.08896, 7(3):13, 2017.
Ngoc-Trung Tran, Viet-Hung Tran, Bao-Ngoc Nguyen, Linxiao Yang, and Ngai-Man Man Cheung. Self-supervised gan: Analysis and improvement with multi-class minimax game. Advances in Neural Information Processing Systems, 32:13253–13264, 2019.
Dmitry Ulyanov, Andrea Vedaldi, and Victor Lempitsky. Instance normalization: The missing ingredient for fast stylization. arXiv preprint arXiv:1607.08022, 2016.
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.
Yaxing Wang, Abel Gonzalez-Garcia, David Berga, Luis Herranz, Fahad Shahbaz Khan, and Joost van de Weijer. Minegan: effective knowledge transfer from gans to target domains with few images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9332–9341, 2020.
Yasin Yazıcı, Chuan-Sheng Foo, Stefan Winkler, Kim-Hui Yap, Georgios Piliouras, and Vijay Chandrasekhar. The unusual effectiveness of averaging in gan training. arXiv preprint arXiv:1806.04498, 2018.
Dan Zhang and Anna Khoreva. Pa-gan: Improving gan training by progressive augmentation. 2018.
Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaogang Wang, Xiaolei Huang, and Dimitris N Metaxas. Stackgan: Text to photo-realistic image synthesis with stacked generative adversarial networks. In Proceedings of the IEEE international conference on computer vision, pp. 5907–5915, 2017.
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, pp. 586–595, 2018.
Junbo Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial network. arXiv preprint arXiv:1609.03126, 2016.
Shengyu Zhao, Zhijian Liu, Ji Lin, Jun-Yan Zhu, and Song Han. Differentiable augmentation for data-efficient gan training. arXiv preprint arXiv:2006.10738, 2020.
Jiachen Zhong, Xuanqing Liu, and Cho-Jui Hsieh. Improving the speed and quality of gan by adversarial training. arXiv preprint arXiv:2008.03364, 2020.
Jiapeng Zhu, Yujun Shen, Deli Zhao, and Bolei Zhou. In-domain gan inversion for real image editing. arXiv preprint arXiv:2004.00049, 2020.
Jun-Yan Zhu, Philipp Krahenb ¨ uhl, Eli Shechtman, and Alexei A Efros. Generative visual manipu- ¨ lation on the natural image manifold. In European conference on computer vision, pp. 597–613. Springer, 2016.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575# IS ATTENTION BETTER THAN MATRIX DECOMPOSITION?
Zhengyang $\mathbf { G e n g ^ { 1 , 2 } }$ , Meng-Hao $\mathbf { G u o ^ { 3 } }$ ∗, Hongxu Chen4, Xia $\mathbf { L i } ^ { 2 }$ , Ke Wei4, Zhouchen $\mathbf { L i n ^ { 2 , 5 } }$ † 1Zhejiang Lab; 2Key Lab. of Machine Perception (MoE), School of EECS, Peking University; 3Tsinghua University; 4School of Data Science, Fudan University; 5Pazhou Lab
# ABSTRACT
As an essential ingredient of modern deep learning, attention mechanism, especially self-attention, plays a vital role in the global correlation discovery. However, is hand-crafted attention irreplaceable when modeling the global context? Our intriguing finding is that self-attention is not better than the matrix decomposition (MD) model developed 20 years ago regarding the performance and computational cost for encoding the long-distance dependencies. We model the global context issue as a low-rank completion problem and show that its optimization algorithms can help design global information blocks. This paper then proposes a series of Hamburgers, in which we employ the optimization algorithms for solving MDs to factorize the input representations into sub-matrices and reconstruct a low-rank embedding. Hamburgers with different MDs can perform favorably against the popular global context module self-attention when carefully coping with gradients back-propagated through MDs. Comprehensive experiments are conducted in the vision tasks where it is crucial to learn the global context, including semantic segmentation and image generation, demonstrating significant improvements over self-attention and its variants. Code is available.
# 1 INTRODUCTION
Since self-attention and transformer (Vaswani et al., 2017) showed significant advantages over recurrent neural networks and convolutional neural networks in capturing long-distance dependencies, attention has been widely adopted by computer vision (Wang et al., 2018; Zhang et al., 2019a) and natural language processing (Devlin et al., 2019) for global information mining. However, is hand-crafted attention irreplaceable when modeling the global context?
This paper focuses on a new approach to design global context modules. The key idea is, if we formulate the inductive bias like the global context into an objective function, the optimization algorithm to minimize the objective function can construct a computational graph, i.e., the architecture we need in the networks. We particularize this idea by developing a counterpart for the most representative global context module, self-attention. Considering extracting global information in the networks as finding a dictionary and the corresponding codes to capture the inherent correlation, we model the context discovery as low-rank completion of the input tensor and solve it via matrix decomposition. This paper then proposes a global correlation block, Hamburger, by employing matrix decomposition to factorize the learned representation into sub-matrices so as to recover the clean low-rank signal subspace. The iterative optimization algorithm to solve matrix decomposition defines the central computational graph, i.e., Hamburger’s architecture.
Our work takes advantage of the matrix decomposition models as the foundation of Hamburger, including Vector Quantization (VQ) (Gray & Neuhoff, 1998), Concept Decomposition (CD) (Dhillon & Modha, 2001), and Non-negative Matrix Factorization (NMF) (Lee & Seung, 1999). Additionally, instead of directly applying Back-Propagation Through Time (BPTT) algorithm (Werbos et al., 1990) to differentiate the iterative optimization, we adopt a truncated BPTT algorithm, i.e., one-step gradient, to back-propagate the gradient effectively. We illustrate the advantages of Hamburger in the fundamental vision tasks where global information has been proven crucial, including semantic segmentation and image generation. The experiments prove that optimization-designed Hamburger can perform competitively with state-of-the-art attention models when avoiding the unstable gradient back-propagated through the iterative computational graph of MD. Hamburger sets new state-ofthe-art records on the PASCAL VOC dataset (Everingham et al., 2010) and PASCAL Context dataset (Mottaghi et al., 2014) for semantic segmentation and surpasses existing attention modules for GANs in the large scale image generation on ImageNet (Deng et al., 2009).
The contributions of this paper are listed as follows:
• We show a white-box approach to design global information blocks, i.e., by turning the optimization algorithm that minimizes an objective function, in which modeling the global correlation is formulated as a low-rank completion problem, into the architecture. We propose Hamburger, a light yet powerful global context module with ${ \mathcal { O } } ( n )$ complexity, surpassing various attention modules on semantic segmentation and image generation. We figure out that the main obstacle of applying MD in the networks is the unstable backward gradient through its iterative optimization algorithm. As a pragmatic solution, the proposed one-step gradient facilitates the training of Hamburger with MDs.
# 2 METHODOLOGY
# 2.1 WARM UP
Since matrix decomposition is pivotal to the proposed Hamburger, we first review the idea of matrix decomposition. A common view is that matrix decomposition factorizes the observed matrix into a product of several sub-matrices, e.g., Singular Value Decomposition. However, a more illuminating perspective is that, by assuming the generation process, matrix decomposition acts as the inverse of the generation, disassembling the atoms that make up the complex data. From the reconstruction of the original matrices, matrix decomposition recovers the latent structure of observed data.
Suppose that the given data are arranged as the columns of a large matrix $\pmb { X } = [ \pmb { x } _ { 1 } , \dots , \pmb { x } _ { n } ] \in \mathbb { R } ^ { d \times n }$ . A general assumption is that there is a low-dimensional subspace, or a union of multiple subspaces hidden in $\boldsymbol { X }$ . That is, there exists a dictionary matrix $D = [ \bar { \bf d } _ { 1 } , \boldsymbol { \cdot } \cdot \cdot , { \bf d } _ { r } ] \in \mathbb { R } ^ { d \times r }$ and corresponding codes $C = [ \mathbf { c } _ { 1 } , \cdot \cdot \cdot , \mathbf { c } _ { n } ] \in \mathbb { R } ^ { r \times n }$ that $\boldsymbol { X }$ can be expressed as
$$X = \overbrace { \bar { X } + E = D C } ^ { g e n e r a t i o n } + E ,$$
where $\bar { \boldsymbol { X } } \in \mathbb { R } ^ { d \times n }$ is the output low-rank reconstruction, and $\pmb { { \cal E } } \in \mathbb { R } ^ { d \times n }$ is the noise matrix to be discarded. Here we assume that the recovered matrix $\bar { X }$ has the low-rank property, such that
$$\operatorname { r a n k } ( { \bar { X } } ) \leq \operatorname* { m i n } ( \operatorname { r a n k } ( D ) , \operatorname { r a n k } ( C ) ) \leq r \ll \operatorname* { m i n } ( d , n ) .$$
Different MDs can be derived by assuming structures to matrices $\mathbf { \delta } _ { D , C }$ , and $\pmb { { \cal E } }$ (Kolda & Bader, 2009; Udell et al., 2016). MD is usually formulated as an objective with various constraints and then solved by optimization algorithms, with classic applications to image denoising (Wright et al., 2009; Lu et al., 2014), inpainting (Mairal et al., 2010), and feature extraction (Zhang et al., 2012).
# 2.2 PROPOSED METHOD
We focus on building global context modules for the networks without painstaking hand-crafted design. Before starting our discussion, we review the representative hand-designed context block self-attention pithily.
The attention mechanism aims at finding a group of concepts for further conscious reasoning from massive unconscious context (Xu et al., 2015; Bengio, 2017; Goyal et al., 2019). As a representative, self-attention (Vaswani et al., 2017) is proposed for learning long-range dependencies in machine translation,
$${ \mathrm { A t t e n t i o n } } \left( Q , K , V \right) = { \mathrm { s o f t m a x } } \left( { \frac { Q K ^ { \top } } { \sqrt { d } } } \right) V ,$$
where $Q , K , V \in \mathbb { R } ^ { n \times d }$ are features projected by linear transformations from the input. Selfattention extracts global information via attending all tokens at a time rather than the typical one-byone processing of recurrent neural networks.
 Figure 1: Overview of Hamburger
Though self-attention and its variants achieved great success, researchers are confronted with (1) developing new global context modules based on self-attention, typically via hand-crafted engineering, and (2) explaining why current attention models work. This paper bypasses both issues and finds a method to easily design global context modules via a well-defined white-box toolkit. We try to formulate the human inductive bias, like the global context, as an objective function and use the optimization algorithm to solve such a problem to design the module’s architecture. The optimization algorithm creates a computational graph, takes some input, and finally outputs the solution. We apply the computational graph of optimization algorithms for the central part of our context module.
Based on this approach, we need to model the networks’ global information issue as an optimization problem. Take the convolutional neural networks (CNN) as an example for further discussion. The networks output a tensor $\mathcal { X } \in \mathbb { R } ^ { C \times H \times W }$ after we feed into an image. Since the tensor can be seen as a set of $H W C$ -dimensional hyper-pixels, we unfold the tensor into a matrix $\pmb { X } \in \mathbb { R } ^ { C \times H W }$ . When the module learns the long-range dependencies or the global context, the hidden assumption is that the hyper-pixels are inherently correlated. For the sake of simplicity, we assume that hyper-pixels are linearly dependent, which means that each hyper-pixel in $\boldsymbol { X }$ can be expressed as the linear combination of bases whose elements are typically much less than $H W$ . In the ideal situation, the global information hidden in $\boldsymbol { X }$ can be low-rank. However, due to vanilla CNN’s poor ability to model the global context (Wang et al., 2018; Zhang et al., 2019a), the learned $\boldsymbol { X }$ is usually corrupted with redundant information or incompleteness. The above analysis suggests a potential method to model the global context, i.e., by completing the low-rank part $\bar { X }$ in the unfolded matrix $\boldsymbol { X }$ and discarding the noise part $\pmb { \cal E }$ , using the classic matrix decomposition models described in Eq. (1), which filters out the redundancy and incompleteness at the same time. We thus model learning the global context as a low-rank completion problem with matrix decomposition as its solution. Using the notion of Sec. 2.1, the general objective function of matrix decomposition is
$$\operatorname* { m i n } _ { D , C } \mathcal { L } ( X , D C ) + \mathcal { R } _ { 1 } ( D ) + \mathcal { R } _ { 2 } ( C )$$
where $\mathcal { L }$ is the reconstruction loss, $\mathcal { R } _ { 1 }$ and $\mathcal { R } _ { 2 }$ are regularization terms for the dictionary $_ D$ and the codes $C$ . Denote the optimization algorithm to minimize Eq. (4) as $\mathcal { M } . \mathcal { M }$ is the core architecture we deploy in our global context module. To help readers further understand this modeling, We also provide a more intuitive illustration in Appendix G.
In the later sections, we introduce our global context block, Hamburger, and then discuss detailed MD models and optimization algorithms for $\mathcal { M }$ . Finally, we handle the gradient issue for back-propagation through matrix decomposition.
# 2.2.1 HAMBURGER
Hamburger consists of one slice of “ham” (matrix decomposition) and two slices of “bread” (linear transformation). As the name implies, Hamburger first maps the input $\boldsymbol { Z } \in \mathbb { R } ^ { d _ { z } \times n }$ into feature space with a linear transformation $W _ { l } ^ { ' } \in \mathbb { R } ^ { d \times d _ { z } }$ , namely “lower bread”, then uses matrix decomposition $\mathcal { M }$ to solve a low-rank signal subspace, corresponding to the “ham”, and finally transforms extracted signals into the output with another linear transformation $W _ { u } \in \mathbb { R } ^ { d _ { z } \times d }$ , called “upper bread”,
$$\begin{array} { r } { \mathcal { H } ( Z ) = W _ { u } \mathcal { M } ( W _ { l } Z ) , } \end{array}$$
where $\mathcal { M }$ is matrix decomposition to recover the clear latent structure, functioning as a global nonlinearity. Detailed architectures of $\mathcal { M }$ , i.e., optimization algorithms to factorize $\boldsymbol { X }$ , are discussed in Sec. 2.2.2. Fig. 1 describes the architecture of Hamburger, where it collaborates with the networks via Batch Normalization (BN) (Ioffe & Szegedy, 2015), a skip connection, and finally outputs $\mathbf { Y }$ ,
$$\begin{array} { r } { Y = Z + \mathrm { B N } ( \mathcal { H } ( Z ) ) . } \end{array}$$
# 2.2.2 HAMS
This section describes the structure of “ham”, i.e., $\mathcal { M }$ in Eq. (5). As discussed in the previous section, by formulating the global information discovery as an optimization problem of MD, algorithms to solve MD naturally compose $\mathcal { M } , \mathcal { M }$ takes the output of “lower bread” as its input and computes a low-rank reconstruction as its output, denoted as $\boldsymbol { X }$ and $\bar { X }$ , respectively.
$$\mathcal { M } ( X ) = \bar { X } = D C .$$
We investigate two MD models for $\mathcal { M }$ , Vector Quantization (VQ), and Non-negative Matrix Factorization (NMF) to solve $_ D$ and $C$ and reconstruct $\bar { X }$ , while leaving Concept Decomposition (CD) to Appendix B. The selected MD models are introduced briefly because we endeavor to illustrate the importance of the low-rank inductive bias and the optimization-driven designing method for global context modules rather than any specific MD models. It is preferred to abstract the MD part as a whole, i.e., $\mathcal { M }$ in the context of this paper, and focus on how Hamburger can show the superiority in its entirety.
Vector Quantization Vector Quantization (VQ) (Gray & Neuhoff, 1998), a classic data compression algorithm, can be formulated as an optimization problem in term of matrix decomposition:
$$\operatorname* { m i n } _ { D , C } \| X - D C \| _ { F } \quad { \mathrm { s . t . ~ } } \mathbf { c } _ { i } \in \{ \mathbf { e } _ { 1 } , \mathbf { e } _ { 2 } , \cdot \cdot \cdot , \mathbf { e } _ { r } \} ,$$
where $e _ { i }$ is the canonical basis vector, $\mathbf { e } _ { i } = [ 0 , \cdots , 1 , \cdots , 0 ] ^ { \top }$ . The solution to minimize the ith objective in Eq. (8) is K-means (Gray & Neuhoff, 1998). However, to ensure that VQ is differentiable, we replace the hard arg min and Euclidean distance with sof tmax and cosine similarity, leading to Alg. 1, where cosine(D, X) is a similarity matrix whose entries satisfy cosine(D, X)ij = d>i xjkdkkxk , and sof tmax is applied column-wise and $T$ is the temperature. Further we can obtain a hard assignment by a one-hot vector when $T 0$ .
<table><tr><td>Algorithm 1 Ham: Soft VQ</td></tr><tr><td>Input X. Initialize D, C.</td></tr><tr><td>for k from 1 to K do</td></tr><tr><td>C ← softmax(⊥cosine(D,X))</td></tr><tr><td>D ← XCTdiag(C1n)-1</td></tr><tr><td>end for</td></tr><tr><td>Output X = DC.</td></tr></table>
<table><tr><td>Algorithm2Ham:NMF with MU</td></tr><tr><td>Input X. Initialize non-negative D, C</td></tr><tr><td>for k from 1 to K do (DTX)ij</td></tr><tr><td>Cij←Cij (DT DC)ij</td></tr><tr><td>(xCT)ij Dij←Dij</td></tr><tr><td>(DCCT)ij end for</td></tr><tr><td>Output X = DC.</td></tr></table>
Non-negative Matrix Factorization If we impose non-negative constraints on the dictionary $_ { D }$ and the codes $C$ , it leads to Non-negative Matrix Factorization (NMF) (Lee & Seung, 1999):
$$\operatorname* { m i n } _ { D , C } \| X - D C \| _ { F } \quad \mathrm { s . t . } D _ { i j } \geq 0 , C _ { j k } \geq 0 .$$
To satisfy the non-negative constraints, we add a ReLU non-linearity before putting $\boldsymbol { X }$ into NMF. We apply the Multiplicative Update (MU) rules (Lee & Seung, 2001) in Alg. 2 to solve NMF, which guarantees the convergence.
As white-box global context modules, VQ, CD, and NMF are straightforward and light, showing remarkable efficiency. They are formulated into optimization algorithms that mainly consist of matrix multiplications with the complexity $\mathcal { O } ( n d r )$ , much cheaper than complexity $\mathcal { O } ( n ^ { 2 } \bar { d } )$ in self-attention as $r \ll n$ . All three MDs are memory-friendly since they avoid generating a large $n \times n$ matrix as an intermediate variable, like the product of $Q$ and $\kappa$ of self-attention in Eq. (3). In the later section, our experiments prove MDs are at least on par with self-attention, though the architectures of $\mathcal { M }$ are created by optimization and look different from classic dot product self-attention.
# 2.3 ONE-STEP GRADIENT
Since $\mathcal { M }$ involves an optimization algorithm as its computational graph, a crux to fuse it into the networks is how the iterative algorithm back-propagates gradient. The RNN-like behavior of optimization suggests Back-Propagation Through Time (BPTT) algorithm (Werbos et al., 1990) as the standard choice to differentiate the iterative process. We first review the BPTT algorithm below. However, in practice, the unstable gradient from BPTT does harm Hamburger’s performances. Hence we build an abstract model to analyze the drawbacks of BPTT and try to find a pragmatic solution while considering MD’s nature as an optimization algorithm.
As shown in Fig. 2, x, y and $\mathbf { h } ^ { t }$ denote input, output and intermediate result at time step $t$ , respectively, while $\mathcal { F }$ and $\mathcal { G }$ are operators. At each time step, the model receives the same input $\mathbf { x }$ processed by the underlying networks.
$$\begin{array} { r } { \mathbf { h } ^ { t + 1 } = \mathcal { F } ( \mathbf { h } ^ { t } , \mathbf { x } ) . } \end{array}$$
The intermediate results $\mathbf { h } ^ { i }$ are all discarded. Only the output of the last step $\mathbf { h } ^ { t }$ is passed through $\mathcal { G }$ for output $\mathbf { y }$ ,
$$\mathbf { y } = \mathcal { G } ( \mathbf { h } ^ { t } ) .$$
In the BPPT algorithm, the gradient from output $\mathbf { y }$ to input $\mathbf { x }$ is given, according to the Chain rule:
$$\frac { \partial \mathbf { y } } { \partial \mathbf { x } } = \sum _ { i = 0 } ^ { t - 1 } \frac { \partial \mathbf { y } } { \partial \mathbf { h } ^ { t } } \left( \prod _ { j = t - i } ^ { t - 1 } \frac { \partial \mathbf { h } ^ { j + 1 } } { \partial \mathbf { h } ^ { j } } \right) \frac { \partial \mathbf { h } ^ { t - i } } { \partial \mathbf { x } } .$$
 Figure 2: One-step Gradient
A thought experiment is to consider $t \to \infty$ , leading to a fully converged result $\mathbf { h } ^ { * }$ and infinite terms in Eq. (12). We suppose
that both $\mathcal { F }$ and $\mathcal { G }$ are Lipschitz with constants $L _ { h }$ w.r.t. h, $L _ { x } w . r . t . \textbf { x }$ , and $L _ { \mathcal { G } }$ , and $L _ { h } < 1$ . Note that these assumptions apply to a large number of optimization or numerical methods. Then we have:
Proposition 1 $\{ \mathbf { h } ^ { i } \} _ { t }$ has linear convergence.
Proposition 2
Table 1: One-step Gradient & BPTT
<table><tr><td>Method</td><td>One-step</td><td>BPTT</td></tr><tr><td>VQ</td><td>77.7(77.4)</td><td>76.6(76.3)</td></tr><tr><td>CD</td><td>78.1(77.5)</td><td>75.0(74.6)</td></tr><tr><td>NMF</td><td>78.3(77.8)</td><td>77.4(77.0)</td></tr></table>
$$\begin{array} { r l } & { \underset { t \infty } { \operatorname* { l i m } } \frac { \partial \mathbf { y } } { \partial \mathbf { x } } = \frac { \partial \mathbf { y } } { \partial \mathbf { h } ^ { * } } ( I - \frac { \partial \mathcal { F } } { \partial \mathbf { h } ^ { * } } ) ^ { - 1 } \frac { \partial \mathcal { F } } { \partial \mathbf { x } } . } \\ & { \underset { t \infty } { \operatorname* { l i m } } \Vert \frac { \partial \mathbf { y } } { \partial \mathbf { h } ^ { 0 } } \Vert = 0 , \underset { t \infty } { \operatorname* { l i m } } \Vert \frac { \partial \mathbf { y } } { \partial \mathbf { x } } \Vert \leq \frac { L _ { \mathcal { G } } L _ { x } } { 1 - L _ { h } } . } \end{array}$$
Proposition 3
It is easy to incur gradient vanishing w.r.t. $\mathbf { h } ^ { 0 }$ when $L _ { h }$ is close to 0 and gradient explosion w.r.t. $\mathbf { x }$ $\begin{array} { r } { ( { I - \frac { \partial \mathcal { F } } { \partial { \bf h ^ { * } } } } ) ^ { - 1 } } \end{array}$ when $L _ { h }$ is close to 1. The Jacobian matrix when the largest eigenvalue of $\textstyle { \frac { \partial { \mathcal { F } } } { \partial \mathbf { h } } }$ , i.e., the Lipschitz constant of ∂x , moreover, suffers from an ill-conditioned term $\mathcal { F }$ w.r.t. h, approaches 1 and its minimal eigenvalue typically stays near 0, thus restricts the capability of the gradient to search the well-generalized solution in the parameter space. The erratic scale and spectrum of the gradient back through the optimization algorithm indicate the infeasibility to apply BPTT to Hamburger directly, corroborated by the experiments in Tab. 1, using the same ablation settings as Sec. 3.1.
The analysis inspires us a possible solution. Note that there are a multiplication of multiple Jacobian matrices ∂hj∂hj−1 and a summation of an infinite series in BPTT algorithm, leading to uncontrollable scales of gradients. It enlightens us to drop some minor terms in the gradient while preserving its dominant terms to ensure the direction is approximately right. Considering terms of Eq. (12) as a series, i.e., $\begin{array} { r } { \{ \frac { \partial \mathbf { y } } { \partial \mathbf { h } ^ { t } } \left( \prod _ { j = t - i } ^ { t - 1 } \frac { \partial \mathbf { h } ^ { j + 1 } } { \partial \mathbf { h } ^ { j } } \right) \frac { \partial \mathbf { h } ^ { t - i } } { \partial \mathbf { x } } \} _ { i } } \end{array}$ , it makes sense to use the first term of this series to approximate the gradient if the scale of its terms decays exponentially measured by the operator norm. The first term of the gradient is from the last step of optimization, leading to the one-step gradient,
$$\widehat { \frac { \partial \mathbf { y } } { \partial \mathbf { x } } } = \frac { \partial \mathbf { y } } { \partial \mathbf { h } ^ { t } } \frac { \partial \mathbf { h } ^ { t } } { \partial \mathbf { x } } .$$
The one-step gradient is a linear approximation of the BPTT algorithm when $t \to \infty$ according to the Proposition 2. It is easy to implement, requiring a no_grad operation in PyTorch (Paszke et al., 2019) or stop_gradient operation in TensorFlow (Abadi et al., 2016) and reducing the time and space complexity from $\mathcal { O } ( t )$ in BPTT to $\mathcal { O } ( 1 )$ . We test adding more terms to the gradient but its performance is worse than using one step. According to experimental results, one-step gradient is acceptable to back-propagate gradient through MDs.
Table 2: Ablation on components of Hamburger with NMF Ham.
<table><tr><td>Method</td><td>mIoU(%)</td><td>Params</td></tr><tr><td>baseline</td><td>75.9(75.7)</td><td>32.67M</td></tr><tr><td>basic</td><td>78.3(77.8)</td><td>+0.50M</td></tr><tr><td> - ham</td><td>75.8(75.6)</td><td>+0.50M</td></tr><tr><td>- upper bread</td><td>77.0(76.8)</td><td>+0.25M</td></tr><tr><td>- lower bread</td><td>77.3(77.2)</td><td>+0.25M</td></tr><tr><td>only ham</td><td>77.0(76.8)</td><td>+0M</td></tr></table>
# 3 EXPERIMENTS
In this section we present experimental results demonstrating the techniques described above. Two vision tasks that benefit a lot from global information and attention mechanism attract us, including semantic segmentation (over 50 papers using attention) and deep generative models like GANs (most state-of-the-art GANs adopt self-attention since SAGAN (Zhang et al., 2019a)). Both tasks are highly competitive and thus enough for comparing Hamburger with self-attention. Ablation studies show the importance of MD in Hamburger as well as the necessity of the one-step gradient. We emphasize the superiority of Hamburger on modeling global context over self-attention regarding both performance and computational cost.
# 3.1 ABLATION EXPERIMENTS
We choose to conduct all ablation experiments on the PASCAL VOC dataset (Everingham et al., 2010) for semantic segmentation, and report mIoU of 5 runs on the validation set in the form of best(mean). ResNet-50 (He et al., 2016) with output stride 16 is the backbone for all ablation experiments. We employ a $3 \times 3$ conv with BN (Ioffe & Szegedy, 2015) and ReLU to reduce channels from 2048 to 512 and then add Hamburger, the same location as popular attentions in semantic segmentation. For detailed training settings, please see Appendix E.1.
 Figure 3: Ablation on $d$ and $r$
Breads and Hams We ablate each part of the Hamburger. Removing MD (ham) causes the most severe decay in performance, attesting to the importance of MD. Even if only the parameter-free MD is added (only ham), the performance can visibly improve. Parameterization also helps the Hamburger process the extracted features. Bread, especially upper bread, contributes considerable performance.
Latent Dimension $d$ and $r$ It is worth noting that there is no simple linear relation between $d$ and $r$ with performances measured by mIoU, though $d = 8 r$ is a satisfactory choice. Experiments show that even $r = 8$ performs well, revealing that it can be very cheap for modeling the global context.
 Figure 4: Ablation on $K$
Iterations $K$ We test more optimization steps in the evaluation stage. In general, the same $K$ for training and test is recommended. $K = 6$ is enough for CD and NMF, while even $K = 1$ is acceptable for VQ. Typically $3 { \sim } 6$ steps are enough since simple MD’s prior is still biased, and full convergence can overfit it. The few iterations are cheap and act as early stopping.
# 3.2 A CLOSE LOOK AT HAMBURGER
To understand the behavior of Hamburger in the networks, we visualize the spectrums of representations before and after Hamburger on the PASCAL VOC validation set. The input and output tensors are unfolded to $\mathbb { R } ^ { C \times H W }$ . The accumulative ratio of squared largest $r$ singular values over total squared singular values of the unfolded matrix has been shown in Fig. 5. A truncated spectrum is usually observed in classic matrix decomposition models’ results due to the low-rank reconstruction. In the networks, Hamburger also promotes energy concentration while preserving informative details via the skip connection. Additionally, we visualize the feature maps before and after Hamburger in Fig. 6. MD helps Hamburger learn interpretable global information by zeroing out uninformative channels, removing irregular noises, and completing details according to the context.
 Figure 5: Accumulative Ratio
 Figure 6: Visualization of feature maps
# 3.3 A COMPARISON WITH ATTENTION
This section shows the advantages of MD-based Hamburger over attention-related context modules in computational cost, memory consumption, and inference time. We compare Hamburger (Ham) with self-attention (SA) (Vaswani et al., 2017), Dual Attention (DA) module from DANet (Fu et al., 2019), Double Attention module from $A ^ { 2 }$ Net (Chen et al., 2018b), APC module from APCNet (He et al., 2019b), DM module from DMNet (He et al., 2019a), ACF module from CFNet (Zhang et al., 2019b), reporting parameters and costs of processing a tensor $\mathcal { Z } \in \mathbb { R } ^ { 1 \times 5 1 2 \times 1 2 8 \times 1 2 8 }$ in Tab. 3. Excessive memory usage is the key bottleneck of cooperating with attention in real applications. Hence we also provide the GPU load and inference time on NVIDIA TITAN Xp. In general, Hamburger is light in computation and memory compared with attention-related global context modules.
Table 3: Comparisons between Hamburger and context modules.
<table><tr><td rowspan="2">Method</td><td rowspan="2">Params</td><td rowspan="2">MACs</td><td colspan="2">GPU Load</td><td colspan="2">GPU Time</td></tr><tr><td>Train</td><td>Infer</td><td>Train</td><td>Infer</td></tr><tr><td>SA</td><td>1.00M</td><td>292G</td><td>5253MB</td><td>2148MB</td><td>242.0ms</td><td>82.2ms</td></tr><tr><td>DA</td><td>4.82M</td><td>79.5G</td><td>2395MB</td><td>2203MB</td><td>72.6ms</td><td>64.4ms</td></tr><tr><td>A2</td><td>1.01M</td><td>25.7G</td><td>326MB</td><td>165MB</td><td>22.9ms</td><td>8.0ms</td></tr><tr><td>APC</td><td>2.03M</td><td>17.6G</td><td>458MB</td><td>264MB</td><td>26.5ms</td><td>11.6ms</td></tr><tr><td>DM</td><td>3.00M</td><td>35.1G</td><td>557MB</td><td>268MB</td><td>65.7ms</td><td>23.3ms</td></tr><tr><td>ACF</td><td>0.75M</td><td>79.5G</td><td>1380MB</td><td>627MB</td><td>71.0ms</td><td>22.6ms</td></tr><tr><td>Ham (CD)</td><td>0.50M</td><td>16.2G</td><td>162MB</td><td>102MB</td><td>20.0ms</td><td>13.0ms</td></tr><tr><td>Ham (NMF)</td><td>0.50M</td><td>17.6G</td><td>202MB</td><td>98MB</td><td>15.6ms</td><td>7.7ms</td></tr></table>
# 3.4 SEMANTIC SEGMENTATION
We benchmark Hamburger on the PASCAL VOC dataset (Everingham et al., 2010), and the PASCAL Context dataset (Mottaghi et al., 2014), against state-of-the-art attentions. We use ResNet-101 (He et al., 2016) as our backbone. The output stride of the backbone is 8. The segmentation head is the same as ablation experiments. NMF is usually better than CD and VQ in ablation studies (see Tab. 1). Therefore, we mainly test NMF in further experiments. We use HamNet to represent ResNet with Hamburger in the following section.
Results on the PASCAL VOC test set, and the PASCAL Context validation set, are illustrated in Tab. 4, and Tab. 5, respectively. We mark all attention-based models with ∗ in which diverse attentions compose the segmentation heads. Though semantic segmentation is a saturated task, and most contemporary published works have approximate performances, Hamburger shows considerable improvements over previous state-of-the-art attention modules.
Table 4: Comparisons with state-of-the-art on the PASCAL VOC test set w/o COCO pretraining.
<table><tr><td>Method</td><td>mIoU(%)</td></tr><tr><td>PSPNet (Zhao et al., 2017)</td><td>82.6</td></tr><tr><td>DFN* (Yu et al., 2018)</td><td>82.7</td></tr><tr><td>EncNet (Zhang et al., 2018)</td><td>82.9</td></tr><tr><td>DANet* (Fu et al., 2019)</td><td>82.6</td></tr><tr><td>DMNet* (He et al., 2019a)</td><td>84.4</td></tr><tr><td>APCNet* (He et al., 2019b)</td><td>84.2</td></tr><tr><td>CFNet* (Zhang et al., 2019b)</td><td>84.2</td></tr><tr><td>SpyGR* (Li et al., 2020)</td><td>84.2</td></tr><tr><td>SANet* (Zhong et al., 2020)</td><td>83.2</td></tr><tr><td>OCR* (Yuan et al., 2020)</td><td>84.3</td></tr><tr><td>HamNet</td><td>85.9</td></tr></table>
Table 5: Results on the PASCAL-Context Val set.
<table><tr><td>Method</td><td>mIoU(%)</td></tr><tr><td>PSPNet (Zhao et al., 2017)</td><td>47.8</td></tr><tr><td>SGR* (Liang et al., 2018)</td><td>50.8</td></tr><tr><td>EncNet (Zhang et al., 2018)</td><td>51.7</td></tr><tr><td>DANet* (Fu et al., 2019)</td><td>52.6</td></tr><tr><td>EMANet* (Li et al., 2019)</td><td>53.1</td></tr><tr><td>DMNet* (He et al., 2019a)</td><td>54.4</td></tr><tr><td>APCNet* (He et al., 2019b)</td><td>54.7</td></tr><tr><td>CFNet* (Zhang et al., 2019b)</td><td>54.0</td></tr><tr><td>SpyGR* (Li et al., 2020)</td><td>52.8</td></tr><tr><td>SANet* (Zhong et al., 2020)</td><td>53.0</td></tr><tr><td>OCR*(Yuan et al., 2020)</td><td>54.8</td></tr><tr><td>HamNet</td><td>55.2</td></tr></table>
# 3.5 IMAGE GENERATION
Attention presents as the global context description block in deep generative models like GANs. Most state-of-the-art GANs for conditional image generation integrate self-attention into their architectures since SAGAN (Zhang et al., 2019a), e.g., BigGAN (Brock et al., 2018), $\mathrm { S ^ { 3 } G A N }$ (Luciˇ c et al.´ , 2019), and LOGAN (Wu et al., 2019). It is convincing to benchmark MDbased Hamburger in the challenging conditional image generation task on ImageNet (Deng et al., 2009).
Table 6: Results on ImageNet $1 2 8 \times 1 2 8$ . ∗ are from Tab. 1 and Tab. 2 of Zhang et al. (2019a).
<table><tr><td>Method</td><td>FID↓</td></tr><tr><td>SNGAN-projection*</td><td>27.62</td></tr><tr><td>SAGAN*</td><td>18.28</td></tr><tr><td>HamGAN-baby</td><td>16.05</td></tr><tr><td>YLG</td><td>15.94</td></tr><tr><td>HamGAN-strong</td><td>14.77</td></tr></table>
Experiments are conducted to compare Hamburger with self-attention on ImageNet $1 2 8 \times 1 2 8$ . Selfattention is replaced by Hamburger with NMF ham in both generator and discriminator at feature resolution $3 2 \times 3 2$ , named as HamGAN-baby. HamGAN achieves an appreciable improvement in Fr´echet Inception Distance (FID) (Heusel et al., 2017) over SAGAN. Additionally, we compare Hamburger with a recently developed attention variant Your Local GAN (YLG) (Daras et al., 2020) using their codebase and the same training settings, named HamGAN-strong. HamGAN-strong offers over $5 \%$ improvement in FID while being $15 \%$ faster for the total training time and $3 . 6 \mathbf { x }$ faster for the module time (1.54 iters/sec of HamGAN, 1.31 iters/sec of YLG, and 1.65 iters/sec without both context modules, averaged from 1000 iterations) on the same TPUv3 training platform.
# 4 RELATED WORK
General Survey for Attention The last five years have witnessed a roaring success of attention mechanisms (Bahdanau et al., 2015; Mnih et al., 2014; Xu et al., 2015; Luong et al., 2015) in deep learning. Roughly speaking, the attention mechanism is a term of adaptively generating the targets’ weights to be attended according to the requests. Its architectures are diverse, and the most well-known one is dot product self-attention (Vaswani et al., 2017). The attention mechanism has a wide range of applications, from a single source (Lin et al., 2017) to multi-source inputs (Luong et al., 2015; Parikh et al., 2016), from global information discovery (Wang et al., 2018; Zhang et al., 2019a) to local feature extraction (Dai et al., 2017; Parmar et al., 2019).
Previous researchers attempt to explain the effectiveness of attention mechanisms from numerous aspects. Capturing long-range dependencies (Wang et al., 2018), sequentially decomposing visual scenes (Eslami et al., 2016; Kosiorek et al., 2018), inferring relationships between the part and the whole (Sabour et al., 2017; Hinton et al., 2018), simulating interactions between objects (Greff et al., 2017; van Steenkiste et al., 2018), and learning the dynamics of environments (Goyal et al., 2019) are often considered as the underlying mechanisms of attention.
One common idea from biology is that attention simulates the emergence of concerns in many unconscious contexts (Xu et al., 2015). Some work tries to interpret the attention mechanism by visualizing or attacking attention weights (Serrano & Smith, 2019; Jain & Wallace, 2019; Wiegreffe & Pinter, 2019), while others formulate attention into non-local operation (Wang et al., 2018) or diffusion models (Tao et al., 2018; Lu et al., 2019) or build attention-like models via Expectation Maximization (Greff et al., 2017; Hinton et al., 2018; Li et al., 2019) or Variational Inference (Eslami et al., 2016) on a mixture model. A connection between transformer and graph neural network is discussed as well (Liang et al., 2018; Zhang et al., 2019c). Overall, discussions towards attention are still far from reaching agreements or consistent conclusions.
Efficient Attention Recent works develop efficient attention modules via low-rank approximation in both computer vision (Chen et al., 2018b; Zhu et al., 2019; Chen et al., 2019; Li et al., 2019) and natural language processing (Mehta et al., 2019; Katharopoulos et al., 2020; Wang et al., 2020; Song et al., 2020). Technically, the low-rank approximation usually targets at the correlation matrix, i.e., the product of $Q$ and $\kappa$ after the sof tmax operation, using a product of two smaller matrices to approximate the correlation matrix and applying the associative law to save the memory cost and computation, where the approximation involves kernel functions or other similarity functions. Other works (Babiloni et al., 2020; Ma et al., 2019) make efforts to formulate attention into tensor form but may generate large intermediate variables. In this paper, we do not approximate attention or make it efficient. This paper formulates modeling the global context as a low-rank completion problem. The computation and memory efficiency is a by-product of the low-rank assumption on the clean signal subspace and optimization algorithms as architectures.
Matrix Decomposition in Deep Learning There is a long history of combining MD with deep learning. Researchers focus on reducing the parameters in the networks via factorization on the weights, including the softmax layer (Sainath et al., 2013), the convolutional layer (Zhong et al., 2019), and the embedding layer (Lan et al., 2019). Tariyal et al. (2016) attempts to construct deep dictionary learning for feature extraction and trains the model greedily. This paper tries to factorize the representations to recover a clean signal subspace as the global context and provide a new formulation for modeling the long-range dependencies via matrix decomposition.
# 5 CONCLUSION
This paper studies modeling long-range dependencies in the networks. We formulate learning the global context as a low-rank completion problem. Inspired by such a low-rank formulation, we develop the Hamburger module based on well-studied matrix decomposition models. By specializing matrix decomposition’s objective function, the computational graph created by its optimization algorithm naturally defines ham, Hamburger’s core architecture. Hamburger learns interpretable global context via denoising and completing its input and improves the spectrum’s concentration. It is startling that, when prudently coped with the backward gradient, even simple matrix decomposition proposed 20 years ago is as powerful as self-attention in challenging vision tasks semantic segmentation and image generation, as well as light, fast, and memory-efficient. We plan to extend Hamburger to natural language processing by integrating positional information and designing a decoder like Transformer, build a theoretical foundation for the one-step gradient trick or find a better method to differentiate MDs, and integrate advanced MDs in the future.
# ACKNOWLEDGMENTS
Zhouchen 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. We thank Google’s Tensorflow Research Cloud (TFRC) for providing us Cloud TPUs.
# REFERENCES
Martín 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 Proceedings of the 12th USENIX Conference on Operating Systems Design and Implementation, OSDI’16, pp. 265–283. USENIX Association, 2016. 5, 18
Francesca Babiloni, Ioannis Marras, Gregory Slabaugh, and Stefanos Zafeiriou. Tesa: Tensor element self-attention via matricization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020. 9
Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In 3rd International Conference on Learning Representations, ICLR 2015, 2015. 8
Yoshua Bengio. The consciousness prior. arXiv preprint arXiv:1709.08568, 2017. 2
Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale gan training for high fidelity natural image synthesis. In International Conference on Learning Representations, 2018. 8
Liang-Chieh Chen, Yukun Zhu, George Papandreou, Florian Schroff, and Hartwig Adam. Encoderdecoder with atrous separable convolution for semantic image segmentation. In Proceedings of the European conference on computer vision (ECCV), pp. 801–818, 2018a. 17, 18
Yunpeng Chen, Yannis Kalantidis, Jianshu Li, Shuicheng Yan, and Jiashi Feng. $\mathbf { A } \hat { \mathbf { \xi } } ^ { 2 }$ -nets: Double attention networks. In Advances in Neural Information Processing Systems 31, pp. 352–361. Curran Associates, Inc., 2018b. 7, 9
Yunpeng Chen, Marcus Rohrbach, Zhicheng Yan, Yan Shuicheng, Jiashi Feng, and Yannis Kalantidis. Graph-based global reasoning networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2019. 9
Jifeng Dai, Haozhi Qi, Yuwen Xiong, Yi Li, Guodong Zhang, Han Hu, and Yichen Wei. Deformable convolutional networks. In Proceedings of the IEEE international conference on computer vision, pp. 764–773, 2017. 9
Giannis Daras, Augustus Odena, Han Zhang, and A. Dimakis. Your local gan: Designing two dimensional local attention mechanisms for generative models. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 14519–14527, 2020. 8, 18
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. 2, 8, 17, 18
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, 2019. 1
Inderjit S. Dhillon and Dharmendra S. Modha. Concept decompositions for large sparse text data using clustering. Machine Learning, 42(1):143–175, Jan 2001. ISSN 1573-0565. doi: 10.1023/A:1007612920971. 1, 15
S. M. Ali Eslami, Nicolas Heess, Theophane Weber, Yuval Tassa, David Szepesvari, koray kavukcuoglu, and Geoffrey E Hinton. Attend, infer, repeat: Fast scene understanding with generative models. In Advances in Neural Information Processing Systems 29, pp. 3225–3233. Curran Associates, Inc., 2016. 9
Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. International journal of computer vision, 88(2): 303–338, 2010. 2, 6, 8, 17
Jun Fu, Jing Liu, Haijie Tian, Yong Li, Yongjun Bao, Zhiwei Fang, and Hanqing Lu. Dual attention network for scene segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3146–3154, 2019. 7, 8, 17
Anirudh Goyal, Alex Lamb, Jordan Hoffmann, Shagun Sodhani, Sergey Levine, Yoshua Bengio, and Bernhard Schölkopf. Recurrent independent mechanisms. arXiv preprint arXiv:1909.10893, 2019. 2, 9
R. M. Gray and D. L. Neuhoff. Quantization. IEEE Transactions on Information Theory, 44(6): 2325–2383, Oct 1998. doi: 10.1109/18.720541. 1, 4
Klaus Greff, Sjoerd van Steenkiste, and Jürgen Schmidhuber. Neural expectation maximization. In Advances in Neural Information Processing Systems 30, pp. 6691–6701. Curran Associates, Inc., 2017. 9
Junjun He, Zhongying Deng, and Yu Qiao. Dynamic multi-scale filters for semantic segmentation. 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 3561–3571, 2019a. 7, 8
Junjun He, Zhongying Deng, L. Zhou, Yali Wang, and Yu Qiao. Adaptive pyramid context network for semantic segmentation. 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 7511–7520, 2019b. 7, 8
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2016. 6, 8, 17
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, 2017. 8, 18
Geoffrey E Hinton, Sara Sabour, and Nicholas Frosst. Matrix capsules with EM routing. In International Conference on Learning Representations, 2018. 9
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. 4, 6
Sarthak Jain and Byron C Wallace. Attention is not explanation. 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. 3543–3556, 2019. 9
Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and Franccois Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. ArXiv, abs/2006.16236, 2020. 9
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2015. 18
Tamara G. Kolda and Brett W. Bader. Tensor decompositions and applications. SIAM Review, 51(3): 455–500, 2009. doi: 10.1137/07070111X. 2
Adam Kosiorek, Hyunjik Kim, Yee Whye Teh, and Ingmar Posner. Sequential attend, infer, repeat: Generative modelling of moving objects. In Advances in Neural Information Processing Systems, pp. 8606–8616, 2018. 9
Karol Kurach, M. Lucic, Xiaohua Zhai, M. Michalski, and S. Gelly. A large-scale study on regularization and normalization in gans. In ICML, 2019. 18
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 International Conference on Learning Representations, 2019. 9
Daniel D Lee and H Sebastian Seung. Learning the parts of objects by non-negative matrix factorization. Nature, 401(6755):788, 1999. 1, 4
Daniel D. Lee and H. Sebastian Seung. Algorithms for non-negative matrix factorization. In Advances in Neural Information Processing Systems 13. MIT Press, 2001. 4
Xia Li, Zhisheng Zhong, Jianlong Wu, Yibo Yang, Zhouchen Lin, and Hong Liu. Expectationmaximization attention networks for semantic segmentation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 9167–9176, 2019. 8, 9, 17
Xia Li, Y. Yang, Qijie Zhao, Tian cheng Shen, Zhouchen Lin, and Hong-Cheu Liu. Spatial pyramid based graph reasoning for semantic segmentation. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 8947–8956, 2020. 8
Xiaodan Liang, Zhiting Hu, Hao Zhang, Liang Lin, and Eric P Xing. Symbolic graph reasoning meets convolutions. In Advances in Neural Information Processing Systems, pp. 1853–1863, 2018. 8, 9
Zhouhan Lin, Minwei Feng, Cicero Nogueira dos Santos, Mo Yu, Bing Xiang, Bowen Zhou, and Yoshua Bengio. A structured self-attentive sentence embedding. arXiv preprint arXiv:1703.03130, 2017. 9
Canyi Lu, Jinhui Tang, Shuicheng Yan, and Zhouchen Lin. Generalized nonconvex nonsmooth low-rank minimization. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4130–4137, 2014. 2
Yiping Lu, Zhuohan Li, Di He, Zhiqing Sun, Bin Dong, Tao Qin, Liwei Wang, and Tie-Yan Liu. Understanding and improving transformer from a multi-particle dynamic system point of view. arXiv preprint arXiv:1906.02762, 2019. 9
Mario Luciˇ c, Michael Tschannen, Marvin Ritter, Xiaohua Zhai, Olivier Bachem, and Sylvain ´ Gelly. High-fidelity image generation with fewer labels. In International Conference on Machine Learning, pp. 4183–4192, 2019. 8
Minh-Thang Luong, Hieu Pham, and Christopher D Manning. Effective approaches to attention-based neural machine translation. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 1412–1421, 2015. 8, 9
Xindian Ma, Peng Zhang, Shuai Zhang, Nan Duan, Yuexian Hou, Ming Zhou, and Dawei Song. A tensorized transformer for language modeling. In Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. 9
Julien Mairal, Francis Bach, Jean Ponce, and Guillermo Sapiro. Online learning for matrix factorization and sparse coding. Journal of Machine Learning Research, 11(Jan):19–60, 2010. 2
Sneha Mehta, H. Rangwala, and N. Ramakrishnan. Low rank factorization for compact multi-head self-attention. ArXiv, abs/1912.00835, 2019. 9
Takeru Miyato and Masanori Koyama. cGANs with projection discriminator. In International Conference on Learning Representations, 2018. 17, 18
Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. In International Conference on Learning Representations, 2018. 18
Volodymyr Mnih, Nicolas Heess, Alex Graves, et al. Recurrent models of visual attention. In Advances in neural information processing systems, pp. 2204–2212, 2014. 8
Pavlo Molchanov, Stephen Tyree, Tero Karras, Timo Aila, and Jan Kautz. Pruning convolutional neural networks for resource efficient inference. arXiv preprint arXiv:1611.06440, 2016. 17
Roozbeh Mottaghi, Xianjie Chen, Xiaobai Liu, Nam-Gyu Cho, Seong-Whan Lee, Sanja Fidler, Raquel Urtasun, and Alan Yuille. The role of context for object detection and semantic segmentation in the wild. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 891–898, 2014. 2, 8, 17
Ankur Parikh, Oscar Täckström, Dipanjan Das, and Jakob Uszkoreit. A decomposable attention model for natural language inference. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 2249–2255, 2016. 9
Niki Parmar, Prajit Ramachandran, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jon Shlens. Stand-alone self-attention in vision models. In Advances in Neural Information Processing Systems, pp. 68–80, 2019. 9
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 Advances in Neural Information Processing Systems, pp. 8024–8035, 2019. 5
Sara Sabour, Nicholas Frosst, and Geoffrey E Hinton. Dynamic routing between capsules. In Advances in neural information processing systems, pp. 3856–3866, 2017. 9
T. Sainath, Brian Kingsbury, V. Sindhwani, E. Arisoy, and B. Ramabhadran. Low-rank matrix factorization for deep neural network training with high-dimensional output targets. 2013 IEEE International Conference on Acoustics, Speech and Signal Processing, pp. 6655–6659, 2013. 9
Sofia Serrano and Noah A Smith. Is attention interpretable? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2931–2951, 2019. 9
Kyungwoo Song, Yohan Jung, Dong-Jun Kim, and I. Moon. Implicit kernel attention. ArXiv, abs/2006.06147, 2020. 9
Yunzhe Tao, Qi Sun, Qiang Du, and Wei Liu. Nonlocal neural networks, nonlocal diffusion and nonlocal modeling. In Advances in Neural Information Processing Systems 31, pp. 496–506. Curran Associates, Inc., 2018. 9
Snigdha Tariyal, A. Majumdar, R. Singh, and Mayank Vatsa. Deep dictionary learning. IEEE Access, 4:10096–10109, 2016. 9
Madeleine Udell, Corinne Horn, Reza Zadeh, and Stephen Boyd. Generalized low rank models. Foundations and Trends in Machine Learning, 9(1):1–118, 2016. ISSN 1935-8237. doi: 10.1561/ 2200000055. 2
Sjoerd van Steenkiste, Michael Chang, Klaus Greff, and Jürgen Schmidhuber. Relational neural expectation maximization: Unsupervised discovery of objects and their interactions. In International Conference on Learning Representations, 2018. 9
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, pp. 5998–6008. Curran Associates, Inc., 2017. 1, 2, 7, 9
Sinong Wang, Belinda Z. Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-attention with linear complexity. ArXiv, abs/2006.04768, 2020. 9
Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7794–7803, 2018. 1, 3, 9
Paul J Werbos et al. Backpropagation through time: what it does and how to do it. Proceedings of the IEEE, 78(10):1550–1560, 1990. 1, 5
Sarah Wiegreffe and Yuval Pinter. Attention is not not explanation. 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. 11–20, 2019. 9
John Wright, Arvind Ganesh, Shankar Rao, Yigang Peng, and Yi Ma. Robust principal component analysis: Exact recovery of corrupted low-rank matrices via convex optimization. In Advances in neural information processing systems, pp. 2080–2088, 2009. 2
Yan Wu, Jeff Donahue, David Balduzzi, Karen Simonyan, and Timothy P. Lillicrap. Logan: Latent optimisation for generative adversarial networks. ArXiv, abs/1912.00953, 2019. 8
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 International conference on machine learning, pp. 2048–2057, 2015. 2, 8, 9
Changqian Yu, Jingbo Wang, Chao Peng, Changxin Gao, Gang Yu, and Nong Sang. Learning a discriminative feature network for semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1857–1866, 2018. 8
Yuhui Yuan and Jingdong Wang. Ocnet: Object context network for scene parsing. arXiv preprint arXiv:1809.00916, 2018. 17
Yuhui Yuan, Xilin Chen, and Jingdong Wang. Object-contextual representations for semantic segmentation. arXiv preprint arXiv:1909.11065, 2020. 8, 17
Han Zhang, Ian Goodfellow, Dimitris Metaxas, and Augustus Odena. Self-attention generative adversarial networks. ICML, 2019a. 1, 3, 6, 8, 9, 17, 18
Han Zhang, Zizhao Zhang, Augustus Odena, and Honglak Lee. Consistency regularization for generative adversarial networks. ArXiv, abs/1910.12027, 2020. 18
Hang Zhang, Kristin Dana, Jianping Shi, Zhongyue Zhang, Xiaogang Wang, Ambrish Tyagi, and Amit Agrawal. Context encoding for semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7151–7160, 2018. 8
Hang Zhang, Han Zhang, Chenguang Wang, and Junyuan Xie. Co-occurrent features in semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 548–557, 2019b. 7, 8, 17
Songyang Zhang, Shipeng Yan, and Xuming He. LatentGNN: Learning efficient non-local relations for visual recognition. In Proceedings of the 36th International Conference on Machine Learning(ICML), volume 97 of Proceedings of Machine Learning Research, pp. 7374–7383. PMLR, 2019c. 9
Zhengdong Zhang, Arvind Ganesh, Xiao Liang, and Yi Ma. Tilt: Transform invariant low-rank textures. International journal of computer vision, 99(1):1–24, 2012. 2
Hengshuang Zhao, Jianping Shi, Xiaojuan Qi, Xiaogang Wang, and Jiaya Jia. Pyramid scene parsing network. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2881–2890, 2017. 8, 18
Zhisheng Zhong, Fangyin Wei, Zhouchen Lin, and Chao Zhang. Ada-tucker: Compressing deep neural networks via adaptive dimension adjustment tucker decomposition. Neural networks : the official journal of the International Neural Network Society, 110:104–115, 2019. 9
Zilong Zhong, Zhong Qiu Lin, Rene Bidart, Xiaodan Hu, Ibrahim Ben Daya, Zhifeng Li, WeiShi Zheng, Jonathan Li, and Alexander Wong. Squeeze-and-attention networks for semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020. 8
Zhen Zhu, Mengde Xu, Song Bai, Tengteng Huang, and Xiang Bai. Asymmetric non-local neural networks for semantic segmentation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 593–602, 2019. 9
# A TABLE OF NOTION
Table 7: Summary of notations in this paper
<table><tr><td rowspan=1 colspan=2>βXXZ</td><td rowspan=1 colspan=1>A scalar.A vector.A matrix.A tensor.</td></tr><tr><td rowspan=1 colspan=2>1nXiht8</td><td rowspan=1 colspan=1>A vector whose n elements are all 1.i-th column of matrix X.Vector h at time step t.Jacobian matrix of y W.r.t. X.</td></tr><tr><td rowspan=1 colspan=1>XX||F</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Operator norm.Frobenius norm.</td></tr><tr><td rowspan=1 colspan=2>diagcosinesoftmaxnormalize</td><td rowspan=1 colspan=1>Map a vector to a diagonal matrix.Cosine similarity used in Alg.1.Column-wise softmax function.Column-wise normalization by L2 norm.</td></tr></table>
# B HAMS
Additionally, we introduce another type of ham adopted by Hamburger, Concept Decomposition.
Concept Decomposition We first enhance Concept Decomposition (Dhillon & Modha, 2001) to the following form:
$$\begin{array} { l } { \displaystyle \operatorname* { m i n } _ { D , C } \| X - D C \| _ { F } ^ { 2 } + \beta \| C \| _ { F } ^ { 2 } } \\ { \displaystyle \mathrm { s . t . } D \in \arg \operatorname* { m a x } _ { D } \mathcal { Q } \left( D , X \right) . } \end{array}$$
This problem has a closed solution w.r.t. $C$ under a given $_ { D }$ , i.e., $\pmb { C } = ( \pmb { D } ^ { \top } \pmb { D } + \beta \pmb { I } ) ^ { - 1 } \pmb { D } ^ { \top } \pmb { X }$ . Since $D ^ { \top } D + \beta I$ is a positive definite matrix with a regularized conditional number, the inverse can be more numerically stable than the original one where a semi-positive definite matrix $D ^ { \top } D$ is given under $\beta = 0$ . In practice, 0.01 or 0.1 makes no difference for $\beta$ .
<table><tr><td>Algorithm 3 Ham: Soft CD</td></tr><tr><td>Input X. Initialize D, C</td></tr><tr><td>for k from 1 to K do</td></tr><tr><td>C ← softmax(Tcosine(D,X))</td></tr><tr><td>D ← normalize(XCT)</td></tr><tr><td>end for</td></tr><tr><td>C ← (DD+ βI)-1DTX</td></tr><tr><td>Output X = DC.</td></tr></table>
The dictionary in CD is given by spherical $\mathbf { K }$ -means (Dhillon & Modha, 2001) with objective $\mathcal { Q } \left( D , X \right)$ , as mentioned in Eq. (14).
$$\begin{array} { r l } { \arg \operatorname* { m a x } } & { \sum _ { j = 1 } ^ { r } \sum _ { \mathbf { x } \in \pi _ { j } } c o s i n e \left( \mathbf { x } , \mathbf { d } _ { j } \right) } \\ { D , \{ \pi _ { j } \} _ { r } } & { \phantom { \sum _ { j = 1 } ^ { r } \sum _ { \mathbf { x } \in \pi _ { j } } c o s i n e \left( \mathbf { x } , \mathbf { d } _ { j } \right) } } \\ { \mathrm { s . t . } } & { \| \mathbf { d } _ { j } \| = 1 . } \end{array}$$
The same strategy as VQ is adopted to make the whole algorithm differentiable, however, in which each column of $_ { D }$ is normalized to be a unit vector and thus differs from VQ.
# C PROOF OF PROPOSITIONS
We investigate an abstract RNN model inspired by numerical methods to understand the drawbacks of BPTT algorithm in differentiating the optimization algorithm of MDs, $\mathcal { M }$ . We show the propositions in Sec. 2.3 to illustrate the unstable gradient from $\mathcal { M }$ when using BPTT algorithm, considering MDs’ nature as optimization algorithms.
Proposition 1 The iterations of $\mathcal { F }$ have linear convergence.
Proof. It is obvious that $\mathcal { F }$ is a contraction mapping w.r.t. h under arbitrary given $\mathbf { x }$ . We can then conclude $\{ \mathbf { h } ^ { t } \}$ is a Cauthy sequence and $\mathcal { F } ( * , \mathbf { x } )$ admits a unique fixed point $\mathbf { h } ^ { * }$ due to Banach Fixed Point Theorem.
$$\begin{array} { r l } & { \| \mathbf { h } ^ { t + 1 } - \mathbf { h } ^ { * } \| = \| \mathcal { F } ( \mathbf { h } ^ { t } , \mathbf { x } ) - \mathcal { F } ( \mathbf { h } ^ { * } , \mathbf { x } ) \| } \\ & { \qquad \leq L _ { h } \| \mathbf { h } ^ { t } - \mathbf { h } ^ { * } \| } \end{array}$$
Eq. (16) shows the linear convergence.
Proposition 2 $\begin{array} { r } { \operatorname* { l i m } _ { t \infty } \frac { \partial \mathbf { y } } { \partial \mathbf { x } } = \frac { \partial \mathbf { y } } { \partial \mathbf { h } ^ { \ast } } ( \pmb { I } - \frac { \partial \mathcal { F } } { \partial \mathbf { h } ^ { \ast } } ) ^ { - 1 } \frac { \partial \mathcal { F } } { \partial \mathbf { x } } . } \end{array}$
Proof. Note that $\mathcal { F } ( \ast , { \mathbf { x } } )$ admits a unique fixed point $\mathbf { h } ^ { * }$ under arbitrary given $\mathbf { x }$ , i.e.,
$$\mathbf { h } ^ { * } = \mathcal { F } ( \mathbf { h } ^ { * } , \mathbf { x } ) \quad \Longrightarrow \quad \mathbf { h } ^ { * } - \mathcal { F } ( \mathbf { h } ^ { * } , \mathbf { x } ) = \mathbf { 0 }$$
By differentiating the above equation, we can obtain
$$( I - \frac { \partial \mathcal { F } } { \partial \mathbf { h } ^ { * } } ) \frac { \partial \mathbf { h } ^ { * } } { \partial \mathbf { x } } = \frac { \partial \mathcal { F } } { \partial \mathbf { x } }$$
The Jacobian matrix $\begin{array} { r } { I - \frac { \partial \mathcal { F } } { \partial \mathbf { h } ^ { * } } } \end{array}$ is invertible, which implies the existence of the implicit function $\mathbf { h } ^ { * } ( \mathbf { x } )$ . Immediately, we have
$$\operatorname* { l i m } _ { t \to \infty } \frac { \partial \mathbf { y } } { \partial \mathbf { x } } = \frac { \partial \mathbf { y } } { \partial \mathbf { h } ^ { * } } \frac { \partial \mathbf { h } ^ { * } } { \partial \mathbf { x } } = \frac { \partial \mathbf { y } } { \partial \mathbf { h } ^ { * } } ( \pmb { I } - \frac { \partial \mathcal { F } } { \partial \mathbf { h } ^ { * } } ) ^ { - 1 } \frac { \partial \mathcal { F } } { \partial \mathbf { x } } ,$$
which completes the proof.
Proposition 3 $\begin{array} { r } { \underset { t \infty } { \operatorname* { l i m } } \Vert \frac { \partial \mathbf { y } } { \partial \mathbf { h } ^ { 0 } } \Vert = 0 , \underset { t \infty } { \operatorname* { l i m } } \Vert \frac { \partial \mathbf { y } } { \partial \mathbf { x } } \Vert \leq \frac { L _ { \mathcal { G } } L _ { x } } { 1 - L _ { h } } . } \end{array}$
Proof.
$$\| \frac { \partial \mathbf { y } } { \partial \mathbf { h } ^ { 0 } } \| = \| \frac { \partial \mathbf { y } } { \partial \mathbf { h } ^ { t } } \prod _ { i = 1 } ^ { t } \frac { \partial \mathbf { h } ^ { i } } { \partial \mathbf { h } ^ { i - 1 } } \| \leq \| \frac { \partial \mathbf { y } } { \partial \mathbf { h } ^ { t } } \| \prod _ { i = 1 } ^ { t } \| \frac { \partial \mathbf { h } ^ { i } } { \partial \mathbf { h } ^ { i - 1 } } \| \leq L _ { \mathcal { G } } L _ { h } ^ { t }$$
Then we have:
$$\operatorname* { l i m } _ { t \infty } \lVert \frac { \partial \mathbf { y } } { \partial \mathbf { h } ^ { 0 } } \rVert = 0 .$$
$$\begin{array} { r l } & { \| \displaystyle \frac { \partial \mathbf { y } } { \partial \mathbf { x } } \| = \| \sum _ { i = 0 } ^ { t } \frac { \partial \mathbf { y } } { \partial \mathbf { h } ^ { t } } \| \prod _ { j = i + 1 } ^ { t } \frac { \partial \mathbf { h } ^ { j } } { \partial \mathbf { h } ^ { j - 1 } } \frac { \partial \mathbf { h } ^ { i } } { \partial \mathbf { x } } \| } \\ & { \qquad \le \displaystyle \sum _ { i = 0 } ^ { t } \| \frac { \partial \mathbf { y } } { \partial \mathbf { h } ^ { t } } \| \prod _ { j = i + 1 } ^ { t } \| \frac { \partial \mathbf { h } ^ { j } } { \partial \mathbf { h } ^ { j - 1 } } \| \| \frac { \partial \mathbf { h } ^ { i } } { \partial \mathbf { x } } \| } \\ & { \qquad \le L { \mathcal { C } } ( \displaystyle \sum _ { i = 0 } ^ { t - 1 } L _ { n } ^ { i } ) L _ { x } } \\ & { \qquad = \displaystyle \frac { L _ { G } L _ { x } ( 1 - L _ { h } ^ { t } ) } { 1 - L _ { h } } } \end{array}$$
Then we have:
$$\operatorname* { l i m } _ { t \to \infty } \| \frac { \partial \mathbf { y } } { \partial \mathbf { x } } \| \leq \frac { L _ { \mathcal { G } } L _ { x } } { 1 - L _ { h } } .$$
# D DATASETS
PASCAL VOC The PASCAL VOC dataset (Everingham et al., 2010) is a widely used dataset in both semantic segmentation and detection. For segmentation, it contains 10,582 images for training, 1,449 images for validation and 1,456 images for testing. PASCAL VOC dataset involves 20 foreground object classes and a background class for segmentation and detection.
PASCAL Context The PASCAL Context dataset (Mottaghi et al., 2014) is a challenging dataset in semantic segmentation, which provides detailed labels and involves 59 foreground object classes and a background class for segmentation. It consists of 4,998 and 5,105 images in training and validation set, respectively.
ILSVRC 2012 The ILSVRC 2012 (ImageNet) (Deng et al., 2009) dataset contains 1.3M training samples and $5 0 \mathrm { k }$ test images, categorized into 1000 object classes. We resize images to resolution $1 2 8 \times 1 2 8$ , as done in SNGAN with projection (Miyato & Koyama, 2018) and SAGAN (Zhang et al., 2019a).
# E DETAILS OF EXPERIMENTS
# E.1 ABALATION EXPERIMENTS
We use dilated ResNet-50 (He et al., 2016) with the output stride 16 as the backbone. The backbone is pre-trained on ImageNet (Deng et al., 2009). We apply a poly-learning rate policy under batch size 12 and 30k iterations (about 35 epochs) for fast experiments (less than 12 hours using 1 NVIDIA TITAN Xp GPU). The initial learning rate is set to 0.009, multiplied by $\begin{array} { r } { ( 1 - \frac { i t e r } { i t e r _ { m a x } } ) ^ { \tilde { 0 . } 9 } } \end{array}$ )0.9 after each iteration, with momentum 0.9 and weight decay 0.0001. Hyperparameters of Hamburger are the same as Appendix E.3.
# E.2 A COMPARISON WITH ATTENTION MECHANISM
We report MACs according to Molchanov et al. (2016), using torchprofile1, a more accurate profiler for Pytorch. Real-time cost is measured by built-in Pytorch memory tools on NVIDIA TITAN Xp GPU with a input tensor $\mathcal { Z } \in \mathbb { R } ^ { 1 \times 5 1 2 \times 1 2 8 \times 1 2 8 }$ . Inference times are averaged results from 20 repeats of 100 runs.
# E.3 SEMANTIC SEGMENTATION
Architectures We use ResNet-101 (He et al., 2016) with the ouptput strid 8 as our backbone. We adopt dilated convolution (Chen et al., 2018a) to preserve more detail spatial information and enlarge receptive field as done in the backbone of state-of-the-art attention models ( $\mathrm { F u }$ et al., 2019; Li et al., 2019; Zhang et al., 2019b). We employ a $3 \times 3$ convolution layer with BN and ReLU to reduce channels from 2048 to 512 and then add Hamburger on the top of the backbone. Note that the input of Hamburger is a tensor $\mathcal { Z } \in \mathbb { R } ^ { C \times H \times W }$ . We unfold $\mathcal { Z }$ to a matrix $\boldsymbol { Z } \in \mathbb { R } ^ { C \times H W }$ and set $d _ { z } = C$ and $n = H W$ for Hamburger. Latent dimension $d$ and $r$ , i.e., the column vectors’ dimension of the input matrix $\pmb { X } \in \mathbb { R } ^ { d \times n }$ to $\mathcal { M }$ and the number of atoms in the dictionary $\pmb { D } \in \mathbb { R } ^ { r \times d }$ , are set to 512 and 64. The iterations of MD’s optimization algorithm, $K$ , are set to 6. Non-negative Matrix Factorization (NMF) is our default ham for semantic segmentation.
Data augmentation In the training stage, we apply random left-right flipping, random scaling (from 0.5 to 2), and cropping to augment the training data. Images are resized to $5 1 3 \times 5 1 3$ for the PASCAL VOC dataset and the PASCAL Context dataset. In the test stage, the multi-scale and flipping strategy is applied as other state-of-the-art attention-based models ( $\mathrm { F u }$ et al., 2019; Yuan & Wang, 2018; Yuan et al., 2020).
Optimization We use mini-batch SGD with momentum 0.9 to train HamNet. Synchronized Batch Normalization is adopted in experiments on semantic segmentation. All backbones are fine-tuned from ImageNet (Deng et al., 2009) pre-training. Following previous works (Zhao et al., 2017; Chen et al., 2018a), we apply a poly-learning rate policy. The initial learning rate is multiplied by $\begin{array} { r } { ( 1 - \frac { i t e r } { i t e r _ { m a x } } ) ^ { 0 . 9 } } \end{array}$ )0.9. For the PASCAL VOC dataset, learning rate, weight decay, batch size, iterations are set to 0.009, 0.0001, 16, and $6 0 \mathrm { k }$ , respectively. We fine-tune HamNet on the PASCAL VOC trainval set with the learning rate down to a tenth. The learning rate, weight decay, batch size, iterations are 0.002, 0.0001, 16, and 25k for the PASCAL-Context dataset.
# E.4 IMAGE GENERATION
We use the official GAN codebase2 from Tensorflow (Abadi et al., 2016) and TF-GAN to train HamGAN and evaluate FID.
Architectures Experiments on ImageNet are conducted using the same architecture as SAGAN (Zhang et al., 2019a), and YLG (Daras et al., 2020), including Spectral Normalization (Miyato et al., 2018) in both the generator and the discriminator, conditional Batch Normalization in the generator, and class projection in the discriminator (Miyato & Koyama, 2018). Hamburger with NMF ham is placed at feature resolution $3 2 \times 3 2$ in both the generator and the discriminator where self-attention can obtain the best FID according to Zhang et al. (2019a). We use $d = 8 r$ for Hamburger, and $d$ is the same as the input channels, while the optimization steps $K$ are 6. Restricted to expenditures of training GANs on ImageNet, $d , r$ , and $K$ are decided according to the ablation experiments on semantic segmentation without new ablation experiments.
Optimization For all models, we use Adam (Kingma & Ba, 2015) optimizer with TTUR (Heusel et al., 2017). HamGAN employs the same training settings as SAGAN (Miyato et al., 2018) and YLG (Daras et al., 2020), respectively.
Evaluation metrics The quality of images generated by GANs are evaluated by Fr´echet Inception Distance (FID) (Heusel et al., 2017). Lower FID indicates that the model can generate higher-fidelity images. In our experiments, $5 0 \mathrm { k }$ images are sampled from the generator to compute FID. We evaluate HamGAN for 6 runs and report the best FID to approximately match the convention in the modern GAN research like Kurach et al. (2019) and CR-GAN (Zhang et al., 2020), reporting top $5 \% / 1 5 \%$ results in the experiments.
# F FURTHER RESULTS FROM ABLATION EXPERIMENTS
Table 8: Ablation on initializations.
<table><tr><td>Init</td><td>NMF</td><td>CD</td><td>VQ</td></tr><tr><td>fixed</td><td>77.4(77.3)</td><td>77.7(77.4)</td><td>77.3(76.9)</td></tr><tr><td>learned</td><td>76.8(76.5)</td><td>75.0(73.7)</td><td>75.9(75.8)</td></tr><tr><td>random</td><td>78.3(77.8)</td><td>77.9(77.3)</td><td>77.7(77.4)</td></tr><tr><td>online</td><td>77.8(77.5)</td><td>78.1(77.5)</td><td>78.0(77.2)</td></tr></table>
Initialization We test four types of initialization for the dictionary $_ { D }$ , including fixed initialization, learned initialization, random initialization, and warm start with online update. Usually, random initialization is the best choice that means we can sample each entry of $_ { D }$ from a given distribution like Uniform $( 0 , 1 )$ as the initialization of the optimization algorithm $\mathcal { M }$ . For NMF, after initializing $_ { D }$ , we initialize $\begin{array} { r } { \dot { \mathbf { C } } = s o f t m a x ( \frac { 1 } { T } c o s i n e ( \mathbf { D } , \mathbf { \dot { X } } ) ) } \end{array}$ since $\mathbf { K }$ -means is usually applied for initializing NMF and this initialization for $\bar { C }$ is equivalent to a single update in Spherical K-means. A special reminder is that it is not suitable to initialize either $_ D$ or $C$ to values too close to 0 due to the property of the MU rule. So the temperature $T$ is recommended to be a higher value like 1 in this initialization for $C$ . Random initialization also works for $C$ in NMF with scores 77.8(77.6) when sampling $C _ { i j } \sim \mathrm { U n i f o r m } ( 0 , 1 )$ . Note that learned initialization is always the worst one since the BPTT algorithm is employed to learn the initialization that the gradient from $\mathcal { M }$ may impede the training of the backbone, instead of the one-step gradient. Warm start benefits MD with unit vectors in the dictionary $_ { D }$ like CD. In general, random initialization is good enough for all three selected MD models. A possible reason is that it can enforce the network to adapt to the results solved by different initializations during the training process, acting like an inner augmentation.
Temperature $T$ As we have claimed, when $T$ approaches 0, we can get a solution close to the original problem in both VQ and CD. In VQ and CD experiments, a relatively low temperature $T$ is more recommended to solve a better $_ { D }$ for MD. However, it will not receive more gains but increase the variance during training if we further lower $T$ .
Table 9: Influence of temperature $T$ with CD ham.
<table><tr><td>Temperature T</td><td>mIoU(%)</td></tr><tr><td>1</td><td>77.1(77.0)</td></tr><tr><td>0.1</td><td>78.2(77.5)</td></tr><tr><td>0.01</td><td>78.1(77.5)</td></tr></table>
Iterations $K$ We take the iterations $K$ of optimization algorithms $\mathcal { M }$ for all three MD models, NMF, CD, and VQ, into our consideration. More iterations and even fully converged results for $\mathcal { M }$ are tested in the evaluation stage but worse than little optimization steps. The smaller $K$ , ranging from 1 to 8, can be treated as early stopping for the optimization algorithm $\mathcal { M }$ , obtaining satisfactory performances. For a detailed visualization, see Fig. 7, Fig. 8, Fig. 9.
 Figure 7: Impacts of $K$ on NMF
 Figure 8: Impacts of $K$ on CD
 Figure 9: Impacts of $K$ on VQ
# G AN INTUITIVE ILLUSTRATION
In this section, we hope to give an example to help our readers develop insight into why the low-rank assumption is useful for modeling the representations’ global context.
The low-rank assumption helps because it represents the inductive bias that the low-level representations contain limited and much less high-level concepts than the scale of the representations themselves. Imagine an image in which a person works on the road. Many hyper-pixels extracted by the backbone CNN will describe the road. Note that the road can be considered as repeats of small road patches, which means that we can represent the road via modeling the basic road patches and repeat them. Mathematically, it is equivalent to finding a small set of bases $_ D$ corresponding to different road patches and a coefficient matrix $C$ that captures the relation between the elementary road patches and the hyper-pixels. This example illustrates that the high-level concepts, i.e., the global context, can be low-rank in the ideal situation.
The hyper-pixels describing the road patches have close semantic attributes. However, due to the vanilla CNN’s inefficiency for modeling the long-range dependencies, the learned representation contains too many local details and incorrect information, lacking global guidance. Imagine that the person in the image wears gloves. When we see the gloves patch locally, we think that this patch describes gloves. When we consider the global context, we can understand that this patch is a part of a person. The semantic information is hierarchical, depending on at which level we hope to comprehend. This work aims at enabling the networks to understand the context globally via the low-rank completion formulation. We thus model the incorrect information, namely the redundancies and incompleteness, as a noise matrix. To emphasize the global context, we decompose the representations into two parts, a low-rank global information matrix and a noise matrix, by employing the optimization algorithm to recover the clean signal subspace, discard the noises, and enhance the global information via the skip connection. It could be learned from the data on how much global information the networks need for a specific task.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346# WORLD MODEL AS A GRAPH: LEARNING LATENT LANDMARKS FOR PLANNING
Anonymous authors Paper under double-blind review
# ABSTRACT
Planning, the ability to analyze the structure of a problem in the large and decompose it into interrelated subproblems, is a hallmark of human intelligence. While deep reinforcement learning (RL) has shown great promise for solving relatively straightforward control tasks, it remains an open problem how to best incorporate planning into existing deep RL paradigms to handle increasingly complex environments. One prominent framework, Model-Based RL, learns a world model and plans using step-by-step virtual rollouts. This type of world model quickly diverges from reality when the planning horizon increases, thus struggling at long-horizon planning. How can we learn world models that endow agents with the ability to do temporally extended reasoning? In this work, we propose to learn graph-structured world models composed of sparse, multi-step transitions. We devise a novel algorithm to learn latent landmarks that are scattered (in terms of reachability) across the goal space as the nodes on the graph. In this same graph, the edges are the reachability estimates distilled from Q-functions. On a variety of high-dimensional continuous control tasks ranging from robotic manipulation to navigation, we demonstrate that our method, named $L ^ { 3 } P$ , significantly outperforms prior work, and is oftentimes the only method capable of leveraging both the robustness of model-free RL and generalization of graph-search algorithms. We believe our work is an important step towards scalable planning in reinforcement learning.
# 1 INTRODUCTION
An intelligent agent should be able to solve difficult problems by breaking them down into sequences of simpler problems. Classically, planning algorithms have been the tool of choice for endowing AI agents with the ability to reason over complex long-horizon problems (Doran & Michie, 1966; Hart et al., 1968). Recent years have seen an uptick in monographs examining the intersection of classical planning techniques – which excel at temporal abstraction – with deep reinforcement learning (RL) algorithms – which excel at state abstraction. Perhaps the ripest fruit born of this relationship is the AlphaGo algorithm, wherein a model free policy is combined with a MCTS (Coulom, 2006) planning algorithm to achieve superhuman performance on the game of Go (Silver et al., 2016a).
In the field of robotics, progress on combining planning and reinforcement learning has been somewhat less rapid, although still resolute. Indeed, the laws of physics in the real world are infinitely more complex than the simple rules of Go. Unlike board games such as chess and Go, which have deterministic and known dynamics and discrete action space, robots have to deal with a probabilistic and unpredictable world, and the action space for robots is oftentimes continuous. As a result, planning in robotics presents a much harder problem. One general class of methods (Sutton, 1991) seeks to combine model-based planning and deep RL. These methods can be thought of as an extension of model-predictive control (MPC) algorithms, with the key difference being that the agent is trained over hypothetical experience in addition to the actually collected experience. The primary shortcoming of this class of methods is that, like MCTS in AlphaGo, they resort to planning with action sequences – forcing the robot to plan for each action at every hundred milliseconds. Planning on the level of action sequences is fundamentally bottlenecked by the accuracy of the learned dynamics model and the horizon of a task, as the learned world model quickly diverges over a long horizon. This limitation shows that world models in the traditional Model-based RL (MBRL) setting often fail to deliver the promise of planning.
 Figure 1: MBRL versus $L ^ { 3 } P$ (World Model as a Graph). MBRL does step-by-step virtual rollouts with the world model and quickly diverges from reality when the planning horizon increases. $L ^ { 3 } P$ models the world as a graph of sparse multi-step transitions, where the nodes are learned latent landmarks and the edges are reachability estimates. $L ^ { 3 } P$ succeeds at temporally extended reasoning.
Another general class of methods, Hierarchical RL (HRL), introduces a higher-level learner to address the problem of planning (Dayan & Hinton, 1993; Vezhnevets et al., 2017; Nachum et al., 2018). In this scenario, a goal-based RL agent serves as the worker, and a manager learns what sequences of goals it must set for the worker to achieve a complex task. While this is apparently a sound solution to the problem of planning, hierarchical learners neither explicitly learn a higher-level model of the world nor take advantage of the graph structure inherent to the problem of search.
To better combine classical planning and reinforcement learning, we propose to learn graph-structured world models composed of sparse multi-step transitions. To model the world as a graph, we borrow a concept from the navigation literature – the idea of landmarks (Wang et al., 2008). Landmarks are essentially states that an agent can navigate between in order to complete tasks. However, rather than simply using previously seen states as landmarks, as is traditionally done, we will instead develop a novel algorithm to learn the landmarks used for planning. Our key insight is that by mapping previously achieved goals into a latent space that captures the temporal distance between goals, we can perform clustering in the latent space to group together goals that are easily reachable from one another. Subsequently, we can then decode the latent centroids to obtain a set of goals scattered (in terms of reachability) across the goal space. Since our learned landmarks are obtained from latent clustering, we call them latent landmarks. The chief algorithmic contribution of this paper is a new method for planning over learned latent landmarks for high-dimensional continuous control domains, which we name Learning Latent Landmarks for Planning $( L ^ { 3 } P )$ .
The idea of reducing planning in RL to a graph search problem has enjoyed some attention recently (Savinov et al., 2018a; Eysenbach et al., 2019; Huang et al., 2019; Liu et al., 2019; Yang et al., 2020; Laskin et al., 2020). A key difference between those works and $L ^ { 3 } P$ is that our use of latent landmarks allows us to substantially reduce the size of the search space. What’s more, we make improvements to the graph search module and the online planning algorithm to improve the robustness and sample efficiency of our method. As a result of those decisions, our algorithm is able to achieve superior performance on a variety of robotics domains involving both navigation and manipulation. In addition to the results presented in Section 5, videos of our algorithm’s performance, and an analysis of the sub-tasks discovered by the latent landmarks, may be found at https://sites.google.com/view/latent-landmarks/.
# 2 RELATED WORKS
The problem of learning landmarks to aid in robotics problems has a long and rich history (Gillner & Mallot, 1998; Wang & Spelke, 2002; Wang et al., 2008). Prior art has been deeply rooted in the classical planning literature. For example, traditional methods would utilize Dijkstra et al. (1959) to plan over generated waypoints, SLAM (Durrant-Whyte & Bailey, 2006) to simultaneously integrate mapping, or the RRT algorithm (LaValle, 1998) for explicit path planning. The $\mathbf { A } ^ { * }$ algorithm (Hart et al., 1968) further improved the computational efficiency of Dijkstra. Those types of methods often heavily rely on a hand-crafted configuration space that provides prior knowledge.
Planning is intimately related to model-based RL (MBRL), as the core ideas underlying learned models and planners can enjoy considerable overlap. Perhaps the most clear instance of this overlap is Model Predictive Control (MPC), and the related Dyna algorithm (Sutton, 1991). When combined with modern techniques (Kurutach et al., 2018; Luo et al., 2018; Nagabandi et al., 2018; Ha & Schmidhuber, 2018; Hafner et al., 2019; Wang & Ba, 2019; Janner et al., 2019), MBRL is able to achieve some level of success. Corneil et al. (2018) and Hafner et al. (2020) also learn a discrete latent representation of the environment in the MBRL framework. As discussed in the introduction, planning on action sequences will fundamentally struggle to scale in robotics.
Our method will make extensive use of a parametric goal-based RL agent to accomplish low-level navigation between states. This area has seen rapid progress recently, largely stemming from the success of Hindsight Experience Replay (HER) (Andrychowicz et al., 2017). Several improvements to HER augment the goal relabeling and sampling strategies to improve performance (Nair et al., 2018; Pong et al., 2018; 2019; Zhao et al., 2019; Pitis et al., 2020). There have also been attempts at incorporating search as inductive biases within the value function (Silver et al., 2016b; Tamar et al., 2016; Farquhar et al., 2017; Racaniere et al., 2017; Lee et al., 2018; Srinivas et al., 2018). The focus \` of this line of work is to improve the low-level policy and is thus orthogonal to our work.
Recent work in Hierarchical RL (HRL) builds upon goal-based RL by learning a high-level parametric manager that feeds goals to the low-level goal-based agent (Dayan & Hinton, 1993; Vezhnevets et al., 2017; Nachum et al., 2018). This can be viewed as a parametric alternative to classical planning, as discussed in the introduction. Recently, Jurgenson et al. (2020); Pertsch et al. (2020) have derived HRL methods that are intimately tied to tree search algorithms. These papers are further connected to a recent trend in the literature wherein classical search methods are combined with parametric control (Savinov et al., 2018a; Eysenbach et al., 2019; Huang et al., 2019; Liu et al., 2019; Yang et al., 2020; Laskin et al., 2020). Several of these articles will be discussed throughout this paper. LEAP (Nasiriany et al., 2019) also considers the problem of proposing sub-goals for a goal-conditioned agent: it uses a VAE (Kingma & Welling, 2013) and does CEM on the prior distribution to form the landmarks. Our method constrains the latent space with temporal reachability between goals, a concept previously explored in Savinov et al. (2018b), and uses latent clustering and graph search rather than sampling-based methods to learn and propose sub-goals.
# 3 BACKGROUND
We consider the problem of Multi-Goal RL under a Markov Decision Process (MDP) that is parameterized by $( S , A , \bar { \mathbb { P } } , G , \Psi , R , \rho _ { 0 } )$ . $S$ and $A$ are the state and action space. The probability distribution of the initial states is given by $\rho _ { 0 } ( s )$ , and $\mathbb { P } ( s ^ { \prime } | s , a )$ is the transition probability. $\Psi : S \mapsto G$ is a mapping from the state space to the goal space, which assumes that every state $s$ can be mapped to a corresponding achieved goal $g$ . The reward function $R$ can be defined as $R ( s , a , s ^ { \prime } , g ) = - \mathbb { 1 } \{ \Psi ( s ^ { \prime } ) \neq g \}$ . We further assume that each episode has a fixed horizon $T$ .
The goal-conditioned policy is a probability distribution $\pi : S \times G \times A \to \mathbb { R } ^ { + }$ . The policy gives rise to trajectory samples of the form $\tau = \{ s _ { 0 } , a _ { 0 } , g , s _ { 1 } , \cdot \cdot \cdot s _ { T } \}$ . The purpose of the policy $\pi$ is to learn how to reach the goals drawn from the goal distribution $p _ { g }$ , which means maximizing the cumulative rewards. Together with a discount factor $\gamma \in ( 0 , 1 )$ , the objective is to maximize $\begin{array} { r } { \mathcal { I } ( \pi ) = \mathbb { E } _ { g \sim p _ { g } , \tau \sim \pi ( g ) } [ \sum _ { t = 0 } ^ { T - 1 } \gamma ^ { t } \cdot R ( s _ { t } , a _ { t } , s _ { t + 1 } , g ) ] } \end{array}$ . Q-learning provides a sample-efficient way to optimize the above objective by utilizing off-policy data stored in a replay buffer $B$ . $Q ( s , a , g )$ estimates the reward-to-go under the current policy $\pi$ conditioned upon the given goal. An additional technique, called Hindsight Experience Replay, or HER (Andrychowicz et al., 2017), uses hindsight relabelling to drastically speed up training. This relabeling crucially relies upon the mapping $\Psi : S \mapsto G$ in the multi-goal MDP setting. We can write the the joint objective of multi-goal Q-learning with HER as minimizing:
$$\begin{array} { r l } & { \underset { Q } { \operatorname* { m i n } } \mathbb { E } _ { \mathrm { } } _ { \mathrm { } \mathrm { } \tau \sim { \cal B } , t \sim \{ 0 \cdot \tau - 1 \} } \ \Biggl ( Q ( s _ { t } , a _ { t } , g ) - \Bigl ( R ( s _ { t } , a _ { t } , s _ { t + 1 } , g ) + \gamma \cdot Q ( s _ { t + 1 } , a ^ { \prime } , g ) \Bigr ) \Biggr ) ^ { 2 } } \\ & { \qquad k \sim \{ t + 1 \cdots T \} , g = \Psi ( s _ { t } ) } \\ & { \qquad a ^ { \prime } \sim \pi ( \cdot | s _ { t + 1 } , g ) } \end{array}$$
 Figure 2: An overview of $L ^ { 3 } P$ , which learns a small number of latent landmarks for planning. The main components of our method are: learning reachability estimates (via Q-learning and regression), learning a latent space (via an auto-encoder with reachability constraints), learning latent landmarks (via clustering in the latent space), graph search on the world model and online planning.
# 4 THE $L ^ { 3 } P$ ALGORITHM
Our overall objective in this section is to derive an algorithm that learns a small number of landmarks scattered across goal space in terms of reachability and use those learned landmarks for planning. There are three chief difficulties we must overcome when considering such an algorithm. First, how can we group together goals that are easily reachable from one another? The answer is to embed goals into a latent space, where the latent representation captures some notion of temporal distance between goals – in the sense that goals that would take many timesteps to navigate between are further apart in latent space. Second, we need to find a way to learn a sparse set of landmarks used for planning. Our method performs clustering on the constrained latent space, and decodes the learned centroids as the landmarks we seek. Finally, we need to develop a non-parametric planning algorithm responsible for selecting sequences of landmarks the agent must traverse to accomplish its high-level goal. The proposed online planning algorithm is simple, scalable, and robust.
# 4.1 LEARNING A LATENT SPACE
Let us consider the following question: “How should we go about learning a latent space of goals where the metric reflects reachability?” Suppose we have an auto-encoder (AE) in the agent’s goal space, with deterministic encoder $f _ { E }$ and decoder $f _ { D }$ . As usual, the reconstruction loss is given by $\begin{array} { r } { \bar { \mathcal { L } } _ { r e c } ( g ) = \left\| f _ { D } \big ( f _ { E } ( g ) \big ) - g \right\| _ { 2 } ^ { 2 } } \end{array}$ . We want to make sure that the distance between two latent codes would roughly correspond to the number of steps it would take the policy to go from one goal to another. Concretely, for any pair of goals $( g _ { 1 } , g _ { 2 } )$ , we optimize the following loss:
$$\mathcal { L } _ { l a t e n t } ( g _ { 1 } , g _ { 2 } ) = \Bigg ( \big \| f _ { E } ( g _ { 1 } ) - f _ { E } ( g _ { 2 } ) \big \| _ { 2 } ^ { 2 } - \frac { 1 } { 2 } \Big ( V ( g _ { 1 } , g _ { 2 } ) + V ( g _ { 2 } , g _ { 1 } ) \Big ) \Bigg ) ^ { 2 }$$
Where $V : G \times G \to \mathbb { R } ^ { + }$ is a mapping that estimates how many steps it would take the policy $\pi$ to go from one goal to another goal on average. By adding this constraint and solving a joint optimization $\mathcal { L } _ { r e c } + \lambda \cdot \mathcal { L } _ { l a t e n t }$ , the encoding-decoding mapping can no longer be arbitrary, giving more structure to the latent space. Goals that are close by in terms of reachability will be naturally clustered in the latent space, and interpolations between latent codes will lead to meaningful results.
Of course, the constraint in Equation 2 is quite meaningless if we do not have a way to estimate the mapping $V$ . We will proceed towards this objective by noting the following interesting connection between multi-goal Q-functions and reachability. In the multi-goal RL framework considered in the background section, the reward is binary in nature. The agent receives a reward of $- 1$ until it reaches the goal, and then 0 when it reaches the desired goal. In this setting, the Q-function is implicitly estimating the number of steps it takes to reach the goal $g$ from the current state $s$ after the action $a$ is taken. Denote this quantity as $D ( s , a , g )$ , the Q-function can be re-written as:
$$Q ( s , a , g ) = \sum _ { t = 0 } ^ { D ( s , a , g ) - 1 } \gamma ^ { t } \cdot ( - 1 ) + \sum _ { t = D ( s , a , g ) } ^ { T - 1 } \gamma ^ { t } \cdot 0 = - \frac { 1 - \gamma ^ { D ( s , a , g ) } } { 1 - \gamma }$$
Choosing to parameterize Q-functions in this way disentangles the effect of $\gamma$ on multi-goal Qlearning. It also provides us with access the direct distance estimation function $D ( s , a , g )$ . We note
that this distance is not a mathematical distance in the sense of a metric. Instead, we use the word distance to refer to the number of steps the policy $\pi$ needs to take in the environment.
Given our tractable estimate of $D$ , it is now a straightforward matter to estimate the desired quantity $V$ , which approximates how many steps it takes the policy to transition between goals. To get the desired estimate, we regress $V$ towards $D$ as follows
$$\displaystyle \operatorname* { m i n } _ { V } \mathbb { E } _ { \tau \sim B , t \sim \{ 0 \cdots T - 1 \} } \Biggl ( D \bigl ( s _ { t } , a _ { t } , \Psi ( s _ { k } ) \bigr ) - V \bigl ( \Psi ( s _ { t + 1 } ) , \Psi ( s _ { k } ) \bigr ) \Biggr ) ^ { 2 }$$
where $\Psi$ is given by the environment to map the states to the goal space. One crucial detail is the use of $\Psi ( s _ { t + 1 } )$ rather than $\Psi ( s _ { t } )$ in the inputs to $V$ . This is due to the fact that $D : S \times A \times G \to \mathbb { R }$ outputs the number of steps to go after an action is taken, when the state has transitioned into $s _ { t + 1 }$ . The objective above provides an unbiased estimate of the average number of steps between two goals.
The estimates $D$ and $V$ will prove useful beyond helping to optimize the auto-encoder in Equation 2. They will prove essential in weighting and planning over latent landmark nodes in Section 4.3.
# 4.2 LEARNING LATENT LANDMARKS
Planning on a graph can be expensive, as the number of edges can grow quadratically with the number of nodes. To battle this issue in scalability, we use the constrained latent space to learn a sparse set of landmarks. A landmark can be thought of as a waypoint that the agent can pass through enroute to achieve a desired goal. Ideally, goals that are easily reachable from one another should be grouped to form one single landmark. Since our latent representation captures the temporal reachability between goals, this can be achieved by doing clustering in the latent space. The cluster centroids, when decoded from the decoder, will be precisely the latent landmarks we are seeking.
Clustering proceeds as follows. For $N$ clusters to be learned, we define a mixture of Gaussians in the latent space with $N$ trainable latent centroids, $\{ \mathbf { c } _ { 1 } \cdots \mathbf { c } _ { N } \}$ , and a shared trainable variance vector $\pmb { \sigma }$ We maximize the evidence lower bound (ELBO) with a uniform prior $p ( \mathbf { c } )$ :
$$\log p \Big ( z = f _ { E } ( g ) \Big ) \ge \mathbb { E } _ { q ( \mathbf { c } \mid z ) } \Big [ \log p ( z \mid \mathbf { c } ) \Big ] - D _ { K L } \Big ( q ( \mathbf { c } \mid z ) \mid \mid p ( \mathbf { c } ) \Big )$$
Ideally, we would like each batch of data given to the latent clustering model to be representative of the whole replay buffer, such that the centroids will quickly learn to scatter out. To this end, we propose to use the Greedy Latent Sparsification (GLS) algorithm (Algorithm 2 in the Appendix) on each batch of data sampled from the replay before taking a gradient step with the batch. GLS is inspired by kmeans $^ { + + }$ (Arthur & Vassilvitskii, 2007), with several key differences: this sparsification process is used for both training and initialization, it uses a neural metric for determining the distance between data points, and that it is compatible with mini-batch-style gradient-based training.
# 4.3 PLANNING WITH LATENT LANDMARKS
Having derived a latent encoding algorithm and an algorithm for learning latent landmarks, we at last turn our attention to planning. While prior works simply solve for the shortest path, we employ a soft version of the Floyd algorithm, where the soft relaxation operations can be seen as a soft value iteration procedure (see Equation 7 in the Appendix).
To construct a weight matrix that at first provides a raw distance estimate between latent landmarks, we begin by decoding the learned centroids in the latent space into the nodes in the graph $\{ f _ { D } ( \mathbf { c } _ { 1 } ) \cdot \cdot \cdot \bar { f _ { D } } ( \mathbf { c } _ { N } ) \}$ . To build the graph, we add two edges directed in reverse orders for every pair of latent landmarks. For instance, for an edge going from $f _ { D } ( \mathbf { c } _ { i } )$ to $f _ { D } ( \mathbf { c } _ { j } )$ , the weight on that edge is $- V ( f _ { D } ( { \bf c } _ { i } ) , f _ { D } ( { \bf c } _ { j } ) )$ . Notice that the distances are negated to be negative. At the start of an episode, the agent receives a goal $g$ , and we construct the following matrix of size $( N + 1 ) \times ( N + 1 ) ^ { \top }$ :
$$W = \left( \begin{array} { c c c c } { { 0 } } & { { \ldots } } & { { - V ( f _ { D } ( \mathbf { c } _ { 1 } ) , f _ { D } ( \mathbf { c } _ { N } ) ) } } & { { - V ( f _ { D } ( \mathbf { c } _ { 1 } ) , g ) } } \\ { { \vdots } } & { { \ddots } } & { { \vdots } } & { { \vdots } } \\ { { - V ( f _ { D } ( \mathbf { c } _ { N } ) , f _ { D } ( \mathbf { c } _ { 1 } ) ) } } & { { \ldots } } & { { 0 } } & { { - V ( f _ { D } ( \mathbf { c } _ { N } ) , g ) } } \\ { { - \infty } } & { { \ldots } } & { { - \infty } } & { { 0 } } \end{array} \right)$$
 Figure 3: For both Point and Ant, during training, the initialization state distribution and the goal proposal distribution are uniform around the maze. During test time, the agent is asked to traverse the longest path in the maze. The success rate on the test environment is reported in Figure 4. This environment demonstrates $L ^ { 3 } P$ ’s ability to generalize to longer horizon goals during test time.
# Algorithm 1 Online Planning in $L ^ { 3 } P$
Given: Environment env, initial state $s$ , goal $g$
1: $\mathrm { { C n t } = 0 }$ . Sub $\Game = \mathbb { N } \mathrm { o n e }$ . 2: Solve for $d _ { c g }$ with graph search. 3: for $t = 1$ to $T$ do $\triangleright$ One episode 4: if Cnt $\geq 1 . 0$ then 5: $\mathtt { C n t } = \mathtt { C n t } - 1$ 6: else . We do not re-plan at every step 7: Calculate ds→c. 8: d ← ds→c + dc→g 9: if SubG 6= None then 10: $d [ \mathrm { { S u b G } ] - \infty }$ 11: end if . Remove the immediate previous landmark 12: SubG, Cnt ← arg max d, − max d 13: end if 14: $a \sim \pi ( s , \mathtt { S u b G } )$ ; $s \gets \in \mathrm { n v }$ .step(a). 15: end for
For online planning, when the agent receives a goal at the start of an episode, we use graph search to solve for $d _ { c g }$ (which is fixed throughout an episode). For an observation state $s$ , the algorithm calculates $d _ { s c }$ :
$$\begin{array} { r } { d _ { s c } = ( \begin{array} { c } { - D \big ( s , \pi ( s , f _ { D } ( \mathbf { c } _ { 1 } ) ) , f _ { D } ( \mathbf { c } _ { 1 } ) \big ) } \\ { \vdots } \\ { - D \big ( s , \pi ( s , f _ { D } ( \mathbf { c } _ { N } ) ) , f _ { D } ( \mathbf { c } _ { N } ) \big ) } \\ { - D \big ( s , \pi ( s , g ) , g \big ) } \end{array} ) } \end{array}$$
The chosen landmark is subgoal $\gets$ arg $\operatorname* { m a x } ( d _ { s \to c } + d _ { c \to g } )$ . To further provide temporal abstraction and robustness, the agent will be asked to consistently pursue subgoal for $- d _ { s c } [ \mathsf { s u b g o a l } ]$ number of steps, which is how many steps it thinks it will need. The proposed goal does not change during this period.
The algorithm makes sure that the agent does not re-plan at every step, and this mechanism for temporal abstraction is crucial to its robustness. After this many steps, the agent will decide on the next landmark to pursue by re-calculating $d _ { s c }$ , but the immediate previous landmark will not be considered as a candidate landmark. The reason is that, if the agent has failed to reach a self-proposed landmark within the reachability limit it has set for itself, then the agent should try something new for the immediate next goal rather than stick to the immediate previous landmark for another round. We have found that this simple algorithm helps the agent avoid getting stuck and improves the overall robustness of the agent.
In summary, we have derived an algorithm that learns a sparse set of latent landmarks scattered across goal space in terms of reachability, and uses those learned landmarks for robust planning.
# 5 EXPERIMENTS AND EVALUATION
We investigate the impact of $L ^ { 3 } P$ in a variety of robotic manipulation and navigation environments. These include standard benchmarks such as Fetch-PickAndPlace, and more difficult environments such as AntMaze-Hard and Place-Inside-Box that have been engineered to require test-time generalization. Videos of our algorithm in action are available here: https: //sites.google.com/view/latent-landmarks/.
# 5.1 BASELINES
We compare our method with a variety of baselines. HER (Andrychowicz et al., 2017) is a model-free RL algorithm. SORB (Eysenbach et al., 2019) is a method that combines RL and graph search by using the entire replay buffer. Mapping State Space (MSS Huang et al. 2019) reduces the number
 Figure 4: Test time success rate vs. total number of timesteps, on maze and robotic manipulation environments. During test time, new more difficult goals are selected. $L ^ { 3 } P$ shows more robust generalization much more quickly than other methods. For every environment except PointmMaze, $\bar { L } ^ { 3 } P$ is the only algorithm that consistently solves the task.
 Figure 5: Visualizing planning on AntMaze at test time. Read images from upper left to bottom right. The blue dots are the learned latent landmarks decoded from the latent centroids. The orange dot represents the ant’s present location in the maze. The red dot is the final goal that the agent needs to reach. At each step, the blue star indicates the landmark chosen by our planning algorithm. Whereas MSS and SORB sample 400 and hundreds of thousands of landmarks (respectively), our method obtains a lean graph that only contain 50 landmarks. $L ^ { 3 } P$ is the only method capable of achieving over $80 \%$ test success rate on AntMaze-Hard within 3M timesteps.
 Figure 6: We consider two environments involving a fetch robot, a block, and a box. In Box-asidePickAndPlace, the fetch must learn to pick and place the block while avoiding collision with the box. In Place-Inside-Box, the fetch must pick the block and place it inside the box. We visualize the fetch states corresponding to learned landmarks in the second row of images.
of vertices by sub-sampling the replay buffer. $L ^ { 3 } P$ , SORB, and MSS all use the same hindsight relabelling strategy proposed in HER. All of the domains are continuous control tasks, so we adopt DDPG (Lillicrap et al., 2015) as the learning algorithm for the low-level actor.
# 5.2 GENERALIZATION TO LONGER HORIZONS
The PointMaze-Hard and AntMaze-Hard environments introduced in Figure 5 are designed to test an agent’s ability to generalize to longer horizons. While PointMaze and AntMaze have been previously used in Duan et al. (2016); Huang et al. (2019); Pitis et al. (2020), we make slight changes to those environments in order to increase their difficulty. We use a short, 200-timestep time horizon during training and a $\rho _ { 0 }$ that is uniform in the maze. At test time, we always initialize the agent on one end of the maze, and set the goal on the other end. The horizon of the test environment is 500 steps. Crucially, no prior knowledge on the shape of the maze is given to the agent. We also set a much stricter threshold for determining whether an agent has reached the goal. In Figure 4, we see $L ^ { 3 } P$ is the only algorithm capable of solving AntMaze-Hard consistently.
We observe an interesting trend where the success rates for other graph search methods crash and then slowly recover after making some initial progress. We postulate this occurs because methods that are based on using the entire replay or sub-sampling the replay for landmark selection will struggle as the buffer size increases. In contrast to these methods, $L ^ { 3 } \bar { P }$ does not exhibit such undesirable instability. The online planning algorithm in $L ^ { 3 } P$ , which effectively leverages temporal abstraction to improve robustness, also contributes to the asymptotic success rate. The result convincingly shows that, at least on the navigation tasks considered, $\bar { L } ^ { 3 } P$ is most effective at taking advantage of the problem’s inherent graph structure, and that learning latent landmarks is significantly more sample efficient and scalable than directly using or sub-sampling the replay buffer to build the graph.
# 5.3 ROBOTIC MANIPULATION TASKS
We also benchmark challenging robotic manipulations tasks with a Fetch robot introduced in Plappert et al. (2018); Andrychowicz et al. (2017). In Figure 6, we introduce two pick and place tasks involving a box on a table. In the Place-Inside-Box environment, we design a simple curriculum to cope with the difficulty of the task. During training, the goal distribution has $80 \%$ regular pick-and-place goals, enabling the agent to first learn how to fetch in general. Meanwhile, only $20 \%$ of the goals are inside the box, which is the harder part of the task. During testing, we evaluate the ability of the agent to pick the object from the table and place it inside the box. Our method achieves dominant performance in both learning speed and test-time generalization. We note that on those manipulation tasks considered, many prior planning methods hurt the performance of the model-free agent. Our method is the only one that is able to help the model-free agent learn faster and generalize better.
# 5.4 UNDERSTANDING MODEL CHOICES IN $L ^ { 3 } P$
We investigate $L ^ { 3 } P$ ’s sensitivity to different hyper-parameters and design choices via a set of ablation studies. More specifically, we study how the following factors affect the performance of $L ^ { 3 } P$ : number of latent landmarks, the choice of (online) planning algorithms, the choice of graph search algorithms, and edge cutoff threshold in graph search (a key hyper-parameter in the search module).
The first question we try to understand is whether $L ^ { 3 } P$ is robust to the number of latent landmarks. In contrast to prior methods, $L ^ { 3 } P$ is able to learn the landmarks used for graph search from the agent’s own experience. We vary the number of learned landmarks in the challenging AntMaze-Hard environment, and we find that $L ^ { 3 } P$ is robust against a decreasing number of landmarks. This is expected, because the landmarks in the latent space of $L ^ { 3 } P$ will try to be equally scattered across the goal space according to the reachability metric. As the number of landmarks decreases, the learning procedure will automatically push the landmarks to be further away from one another.


A key component in $L ^ { 3 } P$ is the online planning algorithm described in Algorithm 1. We find this algorithm to bear special importance to the good performance of $\dot { L ^ { 3 } } P$ . Our planning algorithm in $L ^ { 3 } P$ can take advantage of the temporal abstraction provided by the graph-structured world model. It does not re-plan at every step, but instead uses the reachability estimates to dynamically decide when to re-plan, striking a balance between adaptability and consistency in planning. This planner is also more tolerant of
errors: it removes the immediate previous landmark when it re-plans, so that the agent will be less prone to getting stuck. A naive planner, on the other hand, simply re-calculates the shortest path at every step. The curve on the left shows that this planning algorithm is crucial to the success of $L ^ { 3 } P$ .
The particular choice of graph search seems to have a small effect on the stability of learning. As explained Section 4.3 and Appendix A.2, we find that while employing the Floyd algorithm for graph search, a soft operation for relaxation leads to better stability during training. On the right, we show that a hard version of relaxation helps the agent take off faster but suffers from greater instability during policy improvement. The likely reason is that neural distance estimates are not entirely accurate, and in the presence of occasional bad edges, softmax in

Equation 7 improves robustness. We therefore use soft relaxation in our graph search module.

One of the most important hyper-parameters when combining RL with graph search is d max, the clipping threshold for the edges on the graph (Savinov et al., 2018a; Eysenbach et al., 2019; Huang et al., 2019; Laskin et al., 2020). The motivation for introducing this commonly used hyper-parameter is two-fold. Firstly, we only trust distance estimates when they are local. Secondly, we want the graph search module to produce sub-goals that are nearby. The d max value determines the maximum distance for each edge on the graph and masks out longer
edges. One weakness of our current approach is that it is still quite sensitive to this hyper-parameter; a small change to $d$ max can have considerable impacts on learning. As this weakness is common to this class of approaches, we believe that further research is required to find other ways of encouraging search to be local. See Appendix A.2 for more details on implementing this clipping threshold.
# 6 CLOSING REMARKS
In this work, we introduce a way of learning graph-structured world models that endow agents with the ability to do temporally extended reasoning. The algorithm, $L ^ { 3 } P$ , learns a set of latent landmarks scattered across the goal space to enable scalable planning. We demonstrate that $L ^ { 3 } P$ achieves significantly better sample efficiency, higher asymptotic performance, and better generalization on a range of challenging robotic navigation and manipulation tasks. We hope that this work inspires more research in the direction of combining deep RL with classical planning.
# REFERENCES
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.
David Arthur and Sergei Vassilvitskii. k-means $^ { + + }$ : The advantages of careful seeding. Proceedings of the eighteenth annual ACM-SIAM symposium on Discrete algorithms, 2007.
Dane Corneil, Wulfram Gerstner, and Johanni Brea. Efficient model-based deep reinforcement learning with variational state tabulation. arXiv preprint arXiv:1802.04325, 2018.
Remi Coulom. Efficient selectivity and backup operators in monte-carlo tree search. In ´ International conference on computers and games, pp. 72–83. Springer, 2006.
Peter Dayan and Geoffrey E Hinton. Feudal reinforcement learning. In Advances in neural information processing systems, pp. 271–278, 1993.
Edsger W Dijkstra et al. A note on two problems in connexion with graphs. Numerische mathematik, 1(1):269–271, 1959.
James E Doran and Donald Michie. Experiments with the graph traverser program. Proceedings of the Royal Society of London. Series A. Mathematical and Physical Sciences, 294(1437):235–259, 1966.
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.
Hugh Durrant-Whyte and Tim Bailey. Simultaneous localization and mapping: part i. IEEE robotics & automation magazine, 13(2):99–110, 2006.
Ben Eysenbach, Russ R Salakhutdinov, and Sergey Levine. Search on the replay buffer: Bridging planning and reinforcement learning. In Advances in Neural Information Processing Systems, pp. 15246–15257, 2019.
Gregory Farquhar, Tim Rocktaschel, Maximilian Igl, and Shimon Whiteson. Treeqn and atreec: ¨ Differentiable tree-structured models for deep reinforcement learning. October 2017. URL http://arxiv.org/abs/1710.11417.
Sabine Gillner and Hanspeter A Mallot. Navigation and acquisition of spatial knowledge in a virtual maze. Journal of cognitive neuroscience, 10(4):445–463, 1998.
David Ha and Jurgen Schmidhuber. Recurrent world models facilitate policy evolution. In ¨ Advances in Neural Information Processing Systems, pp. 2450–2462, 2018.
Danijar Hafner, Timothy Lillicrap, Ian Fischer, Ruben Villegas, David Ha, Honglak Lee, and James Davidson. Learning latent dynamics for planning from pixels. In International Conference on Machine Learning, pp. 2555–2565. PMLR, 2019.
Danijar Hafner, Timothy Lillicrap, Mohammad Norouzi, and Jimmy Ba. Mastering atari with discrete world models. arXiv preprint arXiv:2010.02193, 2020.
Peter E Hart, Nils J Nilsson, and Bertram Raphael. A formal basis for the heuristic determination of minimum cost paths. IEEE transactions on Systems Science and Cybernetics, 4(2):100–107, 1968.
Zhiao Huang, Fangchen Liu, and Hao Su. Mapping state space using landmarks for universal goal reaching. In Advances in Neural Information Processing Systems, pp. 1942–1952, 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.
Tom Jurgenson, Or Avner, Edward Groshev, and Aviv Tamar. Sub-goal trees–a framework for goal-based reinforcement learning. arXiv preprint arXiv:2002.12361, 2020.
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. arXiv preprint arXiv:1312.6114, 2013.
Thanard Kurutach, Ignasi Clavera, Yan Duan, Aviv Tamar, and Pieter Abbeel. Model-ensemble trust-region policy optimization. arXiv preprint arXiv:1802.10592, 2018.
Michael Laskin, Scott Emmons, Ajay Jain, Thanard Kurutach, Pieter Abbeel, and Deepak Pathak. Sparse graphical memory for robust planning. arXiv preprint arXiv:2003.06417, 2020.
Steven M LaValle. Rapidly-exploring random trees: A new tool for path planning. 1998.
Lisa Lee, Emilio Parisotto, Devendra Singh Chaplot, Eric Xing, and Ruslan Salakhutdinov. Gated path planning networks. June 2018. URL http://arxiv.org/abs/1806.06408.
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.
Kara Liu, Thanard Kurutach, Christine Kit-Ching Tung, Pieter Abbeel, and Aviv Tamar. Hallucinative topological memory for zero-shot visual planning. ArXiv, 2019. URL https://www.semanticscholar.org/paper/ b8f0417844523d788630bb28a600dfeb74914e2d.
Yuping Luo, Huazhe Xu, Yuanzhi Li, Yuandong Tian, Trevor Darrell, and Tengyu Ma. Algorithmic framework for model-based deep reinforcement learning with theoretical guarantees. arXiv preprint arXiv:1807.03858, 2018.
Ofir Nachum, Shixiang Shane Gu, Honglak Lee, and Sergey Levine. Data-efficient hierarchical reinforcement learning. In Advances in Neural Information Processing Systems, pp. 3303–3313, 2018.
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.
Ashvin V Nair, Vitchyr Pong, Murtaza Dalal, Shikhar Bahl, Steven Lin, and Sergey Levine. Visual reinforcement learning with imagined goals. In Advances in Neural Information Processing Systems, pp. 9191–9200, 2018.
Soroush Nasiriany, Vitchyr Pong, Steven Lin, and Sergey Levine. Planning with goal-conditioned policies. In Advances in Neural Information Processing Systems, pp. 14843–14854, 2019.
Karl Pertsch, Oleh Rybkin, Frederik Ebert, Chelsea Finn, Dinesh Jayaraman, and Sergey Levine. Long-horizon visual planning with goal-conditioned hierarchical predictors. arXiv preprint arXiv:2006.13205, 2020.
Silviu Pitis, Harris Chan, Stephen Zhao, Bradly Stadie, and Jimmy Ba. Maximum entropy gain exploration for long horizon multi-goal reinforcement learning. arXiv preprint arXiv:2007.02832, 2020.
Matthias Plappert, Marcin Andrychowicz, Alex Ray, Bob McGrew, Bowen Baker, Glenn Powell, Jonas Schneider, Josh Tobin, Maciek Chociej, Peter Welinder, et al. Multi-goal reinforcement learning: Challenging robotics environments and request for research. arXiv preprint arXiv:1802.09464, 2018.
Vitchyr Pong, Shixiang Gu, Murtaza Dalal, and Sergey Levine. Temporal difference models: Modelfree deep rl for model-based control. arXiv preprint arXiv:1802.09081, 2018.
Vitchyr H Pong, Murtaza Dalal, Steven Lin, Ashvin Nair, Shikhar Bahl, and Sergey Levine. Skew-fit: State-covering self-supervised reinforcement learning. arXiv preprint arXiv:1903.03698, 2019.
Sebastien Racani ´ ere, Theophane Weber, David Reichert, Lars Buesing, Arthur Guez, Danilo \` Jimenez Rezende, Adria Puigdom \` enech Badia, Oriol Vinyals, Nicolas Heess, Yujia Li, Razvan Pas- \` canu, Peter Battaglia, Demis Hassabis, David Silver, and Daan Wierstra. Imagination-augmented agents for deep reinforcement learning. In I Guyon, U V Luxburg, S Bengio, H Wallach, R Fergus, S Vishwanathan, and R Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 5690–5701. Curran Associates, Inc., 2017. URL http://papers.nips.cc/paper/ 7152-imagination-augmented-agents-for-deep-reinforcement-learning. pdf.
Nikolay Savinov, Alexey Dosovitskiy, and Vladlen Koltun. Semi-parametric topological memory for navigation. arXiv preprint arXiv:1803.00653, 2018a.
Nikolay Savinov, Anton Raichuk, Raphael Marinier, Damien Vincent, Marc Pollefeys, Timothy Lilli- ¨ crap, and Sylvain Gelly. Episodic curiosity through reachability. arXiv preprint arXiv:1810.02274, 2018b.
David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. nature, 529(7587):484–489, 2016a.
David Silver, Hado van Hasselt, Matteo Hessel, Tom Schaul, Arthur Guez, Tim Harley, Gabriel DulacArnold, David Reichert, Neil Rabinowitz, Andre Barreto, and Thomas Degris. The predictron: End-to-end learning and planning. December 2016b. URL http://arxiv.org/abs/1612. 08810.
Aravind Srinivas, Allan Jabri, Pieter Abbeel, Sergey Levine, and Chelsea Finn. Universal planning networks. April 2018. URL http://arxiv.org/abs/1804.00645.
Richard S Sutton. Dyna, an integrated architecture for learning, planning, and reacting. ACM Sigart Bulletin, 2(4):160–163, 1991.
Aviv Tamar, Yi Wu, Garrett Thomas, Sergey Levine, and Pieter Abbeel. Value iteration networks. February 2016. URL http://arxiv.org/abs/1602.02867.
Alexander Sasha Vezhnevets, Simon Osindero, Tom Schaul, Nicolas Heess, Max Jaderberg, David Silver, and Koray Kavukcuoglu. Feudal networks for hierarchical reinforcement learning. arXiv preprint arXiv:1703.01161, 2017.
Ranxiao Frances Wang and Elizabeth S Spelke. Human spatial representation: Insights from animals. Trends in cognitive sciences, 6(9):376–382, 2002.
Tingwu Wang and Jimmy Ba. Exploring model-based planning with policy networks. arXiv preprint arXiv:1906.08649, 2019.
Yang Wang, David Mulvaney, Ian Sillitoe, and Erick Swere. Robot navigation by waypoints. Journal of Intelligent and Robotic Systems, 52(2):175–207, 2008.
Ge Yang, Amy Zhang, Ari S. Morcos, Joelle Pineau, Pieter Abbeel, and Roberto Calandra. Plan2vec: Unsupervised representation learning by latent plans. In Proceedings of The 2nd Annual Conference on Learning for Dynamics and Control, volume 120 of Proceedings of Machine Learning Research, pp. 1–12, 2020. arXiv:2005.03648.
Rui Zhao, Xudong Sun, and Volker Tresp. Maximum entropy-regularized multi-goal reinforcement learning. arXiv preprint arXiv:1905.08786, 2019.
# A APPENDIX
A.1 GREEDY LATENT SPARSIFICATION
Algorithm 2 Greedy Latent Sparsification (GLS) for Latent Cluster Training Given: Replay Buffer $B$ , Encoder $f _ { E }$ . Initialize: LatentEmbeds $= \{ \}$ . $\triangleright$ Set of embeddings selected. 1: Sample $K$ achieved goals from $B$ . 2: Sample $k \sim \{ 0 \cdots K - 1 \}$ . 3: dist $= [ \| f _ { E } ( g _ { 1 } ) - f _ { E } ( \bar { g } _ { k } ) \| _ { 2 } ^ { 2 } , \cdot \cdot \cdot , \| f _ { E } ( g _ { K } ) - f _ { E } ( g _ { k } ) \| _ { 2 } ^ { 2 } ]$ 4: for $\mathrm { i } = 1$ to $M$ do . Sub-sampling 5: $k $ arg max dist $[ k ]$ 6: Add $f _ { E } ( g _ { k } )$ to LatentEmbeds. 7: NEWdist = [kfE(g1) − fE(gk)k22, · · · , kfE(gK ) − fE(gk)k22] 8: dist = ElementwiseMin(dist, NEWdist) 9: end for 10: Optimize equation 5 on LatentEmbeds.
The Greedy Latent Sparsification (GLS) algorithm sub-samples a large batch by sparsification. GLS first randomly selects a latent embedding from the batch, and then greedily chooses the next embedding that is furthest away from already selected embeddings. After collecting some warm-up trajectories before planning starts (see Table 2) during training, we first use GLS to initialize the latent centroids, and then continue to use it to sample the batches used to train the latent clusters. As mentioned in Section 4.2, GLS is strongly inspired by Arthur & Vassilvitskii (2007), and this type of approach is known to improve clustering.
# A.2 GRAPH SEARCH VIA SOFT VALUE ITERATIONS
In this paper, we employ a soft version of Floyd algorithm, which we find to empirically work well. Rather than simply using the min operation to do relaxation, the soft value iteration procedure uses a sof t min operation when doing an update (note that, since we negated the distances to be negative in the weight matrix of the graph, which is Equation 6, the operations we use are actually max and softmax). The reason is that neural distances can be inconsistent and inaccurate at times, and using a soft operation makes the whole procedure more robust. More concretely, we repeat the following update on the weight matrix for $S$ steps with temperature $\beta$ :
$$w _ { i , j } \gets \sum _ { k = 1 } ^ { N + 1 } \frac { \exp \frac { 1 } { \beta } ( w _ { i , k } + w _ { k , j } ) } { \sum _ { k ^ { \prime } = 1 } ^ { N + 1 } \exp \frac { 1 } { \beta } ( w _ { i , k ^ { \prime } } + w _ { k ^ { \prime } , j } ) } \Big ( w _ { i , k } + w _ { k , j } \Big )$$
Following the practice in Eysenbach et al. (2019); Huang et al. (2019), we do the following initialization to the matrix in Equation 6: for entries smaller than the negative of $d _ { - } m a x$ , we penalize the entry by adding $- \infty$ to it (in this paper, we use $- 1 0 ^ { 6 }$ as the $- \infty$ value). The essential idea is that we only trust a neural estimate when it is local, and we rely on graph search to solve for global, longer-horizon distances. The $- \infty$ penalty effectively masks out those entries with large negative values in the softmax operation above. If we replace softmax with a hard max, we recover the original update in Floyd algorithm; we can interpolate between a hard Floyd and a soft Floyd by tuning the temperature $\beta$ .
# A.3 HYPER-PARAMETERS
Table 1 lists the common hyper-parameters across all environments. Table 2 lists the hyper-parameters that differ across the environments.
Table 1: Hyper-parameters in Common
<table><tr><td rowspan=1 colspan=2>Parameter</td><td rowspan=1 colspan=1>Value</td></tr><tr><td rowspan=2 colspan=2>DDPGoptimizernumber of hidden layers (all networks)number of hidden units per layernonlinearitypolyak for target network(T)target update intervalratio between env vs optimization stepsRandom action probabilityInitial random trajs per workerHindsight relabelling ratio</td><td rowspan=2 colspan=1>Adam (Kingma & Ba, 2014)3256ReLU0.9951020.21000.85</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>256</td></tr><tr><td rowspan=1 colspan=2>LatentLandmarks&Auto-encodernumber of hidden layersnumber of hidden units per layernonlinearityembedding size入 for reachability constraint losslearning rate</td><td rowspan=1 colspan=1>2128ReLU161.03e-4</td></tr><tr><td rowspan=1 colspan=2>Graph Searchprobability of using search during trainS (number of soft value iterations)β (temperature)</td><td rowspan=1 colspan=1>0.5201.1</td></tr></table>
Table 2: Hyper-parameters for Each Environment
<table><tr><td colspan="4">Point-Maze Ant-Maze</td></tr><tr><td colspan="4">DDPG</td></tr><tr><td>Learning rate</td><td>2e-4</td><td>2e-4</td><td>1e-3 12</td></tr><tr><td>Number of workers Batch size</td><td>1 512</td><td>3 1024</td><td>1024</td></tr><tr><td>Action L2</td><td>0.5</td><td>0.05</td><td>0.01</td></tr><tr><td>Gamma</td><td>0.98</td><td>0.98</td><td>0.99</td></tr><tr><td>Action noise</td><td>0.2</td><td>0.2</td><td>0.1</td></tr><tr><td>Hindsight relabelling range</td><td>80</td><td>100</td><td>50</td></tr><tr><td colspan="4">LatentLandmarks&Auto-encoder</td></tr><tr><td>Number of latent landmarks</td><td>50</td><td>50</td><td>80</td></tr><tr><td>Number of warm-up trajectories</td><td>500</td><td>500</td><td>6000</td></tr><tr><td>Batch size</td><td>256</td><td>256</td><td>150</td></tr><tr><td colspan="4">Graph Search</td></tr><tr><td>d_max (clipping threshold for distances)</td><td>20.0</td><td>20.0</td><td>15.0</td></tr><tr><td>Random landmarks added during train</td><td>150</td><td>150</td><td>20</td></tr></table>
• We find that having a centralized replay for all parallel workers is significantly more sample efficient than having separate replays for each worker and simply averaging the gradients across workers. • For Ant-Maze environment, we do grad norm clipping by a value of 15.0 for all networks. For Fetch tasks, we normalize the inputs by running means and standard deviations per input dimensions. • Since $L ^ { 3 } P$ is able to decompose a long-horizon goal into many short-horizon goals, we shorten the range of future steps where we do hindsight relabelling; as a result, the agent can focus its optimization effort on more immediate goals. This corresponds to the hyperparameter: Hindsight relabelling range. • During training, we collect $5 0 \%$ of the data without the planning module, and the other $5 0 \%$ of the data with planning. This corresponds to the hyper-parameter: probability of using search during train. • At train time, to encourage exploration during planning, we temporarily add a small number of random landmarks from GLS (Algorithm 2) to the existing latent landmarks. A new set of random landmarks is selected for each episode before graph search starts (Algorithm 1). This corresponds to the hyper-parameter: Random landmarks added during train. • We find that collecting a certain number of warm-up trajectories for every worker before the planning procedure starts (during training) and before GLS (Algorithm 2) is used for initialization to help improve the planning results. This corresponds to the hyper-parameter: Number of warm-up trajectories.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276# RECOVERING GEOMETRIC INFORMATION WITH LEARNED TEXTURE PERTURBATIONS
Anonymous authors Paper under double-blind review
# ABSTRACT
Regularization is used to avoid overfitting when training a neural network; unfortunately, this reduces the attainable level of detail hindering the ability to capture high-frequency information present in the training data. Even though various approaches may be used to re-introduce high-frequency detail, it typically does not match the training data and is often not time coherent. In the case of network inferred cloth, these sentiments manifest themselves via either a lack of detailed wrinkles or unnaturally appearing and/or time incoherent surrogate wrinkles. Thus, we propose a general strategy whereby high-frequency information is procedurally embedded into low-frequency data so that when the latter is smeared out by the network the former still retains its high-frequency detail. We illustrate this approach by learning texture coordinates which when smeared do not in turn smear out the high-frequency detail in the texture itself but merely smoothly distort it. Notably, we prescribe perturbed texture coordinates that are subsequently used to correct the over-smoothed appearance of inferred cloth, and correcting the appearance from multiple camera views naturally recovers lost geometric information.
# 1 INTRODUCTION
Since neural networks are trained to generalize to unseen data, regularization is important for reducing overfitting, see e.g. Goodfellow et al. (2016); Scholkopf & Smola (2001). However, regularization also removes some of the high variance characteristic of much of the physical world. Even though high-quality ground truth data can be collected or generated to reflect the desired complexity of the outputs, regularization will inevitably smooth network predictions. Rather than attempting to directly infer highfrequency features, we alternatively propose to learn a low-frequency space in which such features can be embedded.
We focus on the specific task of adding highfrequency wrinkles to virtual clothing, noting that the idea of learning a low-frequency embedding may be generalized to other tasks. Because cloth wrinkles/folds are high-frequency features,
 Figure 1: Texture coordinate perturbations (texture sliding) reduce shape inference errors: ground truth (blue), prediction (orange).
existing deep neural networks (DNNs) trained to infer cloth shape tend to predict overly smooth meshes Alldieck et al. (2019a); Daneˇˇrek et al. (2017); Guan et al. (2012); Gundogdu et al. (2019); Jin et al. (2020); Lahner et al. (2018); Natsume et al. (2019); Santesteban et al. (2019); Wang et al. (2018); Patel et al. (2020). Rather than attempting to amend such errors directly, we perturb texture so that the rendered cloth mesh appears to more closely match the ground truth. See Figure 1. Then given texture perturbations from at least two unique camera views, 3D geometry can be accurately reconstructed Hartley & Sturm (1997) to recover high-frequency wrinkles. Similarly, for AR/VR applications, correcting visual appearance from two views (one for each eye) is enough to allow the viewer to accurately discern 3D geometry. Our proposed texture coordinate perturbations are highly dependent on the camera view. Thus, we demonstrate that one can train a separate texture sliding neural network (TSNN) for each of a finite number of cameras laid out into an array and use nearby networks to interpolate results valid for any view enveloped by the array. Although an approach similar in spirit might be pursued for various lighting conditions, this limitation is left as future work since there are a great deal of applications where the light is ambient/diffuse/non-directional/etc. In such situations, this further complication may be ignored without significant repercussion.
# 2 RELATED WORK
Cloth: While physically-based cloth simulation has matured as a field over the last few decades Baraff & Witkin (1998); Baraff et al. (2003); Bridson et al. (2002; 2003); Selle et al. (2008), datadriven methods are attractive for many applications. There is a rich body of work in reconstructing cloth from multiple views or 3D scans, see e.g. Bradley et al. (2008b); Franco et al. (2006); Vlasic et al. (2008). More recently, optimization-based methods have been used to generate higher resolution reconstructions Huang et al. (2015); Pons-Moll et al. (2017); Wu et al. (2012); Yang et al. (2016). Some of the most interesting work focuses on reconstructing the body and cloth separately Balan & ˘ Black (2008); Neophytou & Hilton (2014); Yang et al. (2018); Zhang et al. (2017). With advances in deep learning, one can aim to reconstruct 3D cloth meshes from single views. A number of approaches reconstruct a joint cloth/body mesh from a single RGB image Alldieck et al. (2019a;b); Natsume et al. (2019); Onizuka et al. (2020); Saito et al. (2019; 2020), RGB-D image Yu et al. (2019), or video Alldieck et al. (2018a;b); Habermann et al. (2019); Xu et al. (2018). To reduce the dimensionality of the output space, DNNs are often trained to predict the pose/shape parameters of human body models such as SCAPE Anguelov et al. (2005) or SMPL Loper et al. (2015) (see also Pavlakos et al. (2019)). Habermann et al. (2019); Natsume et al. (2019); Varol et al. (2018) leverage predicted pose information to infer shape. When only the garment shape is predicted, a number of recent works output predictions in UV space to represent geometric information as pixels Daneˇˇrek et al. (2017); Jin et al. (2020); Lahner et al. (2018), although others Gundogdu et al. (2019); Santesteban et al. (2019); Patel et al. (2020) define loss functions directly in terms of the 3D cloth vertices.
Wrinkles and Folds: Cloth realism can be improved by introducing wrinkles and folds. In the graphics community, researchers have explored both procedural and data-driven methods for generating wrinkles De Aguiar et al. (2010); Guan et al. (2012); Hahn et al. (2014); Müller & Chentanez (2010); Rohmer et al. (2010); Wang et al. (2010). Other works add real-world wrinkles as a postprocessing step to improve smooth captured cloth: Popa et al. (2009) extracts the edges of cloth folds and then applies space-time deformations, Robertini et al. (2014) solves for shape deformations directly by optimizing over all frames of a video sequence. Recently, Lahner et al. (2018) used a conditional Generative Adversarial Network Mirza & Osindero (2014) to generate normal maps as proxies for wrinkles on captured cloth.
Geometry: More broadly, deep learning on 3D meshes falls under the umbrella of geometric deep learning, which was coined by Bronstein et al. (2017) to characterize learning in non-Euclidean domains. Scarselli et al. (2008) was one of the earliest works in this area and introduced the notion of a Graph Neural Network (GNN) in relation to CNNs. Subsequent works similarly extend the CNN architecture to graphs and manifolds Boscaini et al. (2016); Maron et al. (2017); Masci et al. (2015); Monti et al. (2017). Kostrikov et al. (2018) introduces a latent representation that explicitly incorporates the Dirac operator to detect principal curvature directions. Tan et al. (2018) trains a mesh generative model to generate novel meshes outside an original dataset. Returning to the specific application of virtual cloth, Jin et al. (2020) embeds a non-Euclidean cloth mesh into a Euclidean pixel space, making it possible to directly use CNNs to make non-Euclidean predictions.
# 3 METHODS
We define texture sliding as the changing of texture coordinates on a per-camera basis such that any point which is visible from some stereo pair of cameras can be triangulated back to its ground truth position. Other stereo reconstruction techniques can also be used in place of triangulation because the images we generate are consistent with the ground truth geometry. See e.g. Bradley et al. (2008a); Hartley & Sturm (1997); Seitz et al. (2006).
# 3.1 PER-VERTEX DISCRETIZATION
Since the cloth mesh is discretized into vertices and triangles, we take a per-vertex, not a per-point, approach to texture sliding. Our proposed method (see Section 4.1) computes per-vertex texture coordinates on the inferred cloth that match those of the ground truth as seen by the camera under consideration. Then during 3D reconstruction, barycentric interpolation is used to find the subtriangle locations of the texture coordinates corresponding to ground truth cloth vertices. This assumes linearity, which is only valid when the triangles are small enough to capture the inherent nonlinearities in a piecewise linear sense; moreover, folds and wrinkles can create significant nonlinearity. See Figure 2.
# 3.2 OCCLUSION BOUNDARIES
Accurate 3D reconstruction requires that a vertex of the ground truth mesh be visible from at least two cameras and that camera projections of the vertex to the inferred cloth exist and are valid. However, occlusions can derail these assumptions.
First, consider things from the standpoint of the inferred cloth. For a given camera view, some inferred cloth triangles will not contain any visible pixels, and we denote a vertex as occluded when none of its incident triangles contain any visible pixels. Although we do not assign perturbed texture coordinates to occluded vertices (i.e. they keep their original texture coordinates, or a perturbation of zero), we do aim to keep the texture coordinate perturbation function smooth (see Section 4.2). In addition, there will be so called non-occluded vertices in the inferred cloth that do not project to visible pixels of the ground truth cloth. This often occurs near silhouette boundaries where the inferred cloth silhouette is sometimes wider than the ground truth cloth silhouette. These vertices are also treated as occluded, similar to those around the back side of the cloth behind the silhouette, essentially treating some extra vertices near occlusion boundaries as also being occluded. See Figure 3a.
Next, consider things from the standpoint of the ground truth cloth. For example, consider the case where all the cameras are in the front, and vertices on the back side of the ground truth cloth are not visible from any camera. The best one can do in reconstructing these occluded vertices is to use the inferred cloth vertex positions; however, care should be taken near occlusion boundaries to smoothly taper between our texture sliding 3D reconstruction and the inferred cloth prediction. A simple approach is to extrapolate/smooth the geometric difference between our texture sliding 3D reconstruction and the inferred cloth prediction to occluded regions of the mesh. Once again, the definition of occluded vertices needs to be broadened for silhouette consideration. Not only will vertices not visible from at least two cameras have to be considered occluded, but vertices that don’t project to the interior of an inferred cloth triangle with valid texture coordinate perturbations will also have to be considered occluded. See Figure 3b.
 Figure 2: Consider an extreme case, where the inferred cloth has a quite large triangle (shown in red). That triangle should encompass the nonlinear texture region outlined in yellow (shown in pattern space). Note: the yellow curve was generated by sampling the ground truth cloth’s texture coordinates along the projected edges of the red triangle. The linearity assumption implied by barycentric interpolation instead uses the region outlined in green.
 Figure 3: The method discussed in Section 4.1 can fail near silhouettes of the inferred and ground truth cloth meshes, in which case smoothness assumptions are used (see Section 4.2). In (a), inferred triangles with at least one vertex falling outside the silhouette of the ground truth mesh are colored red. In (b), ground truth triangles with at least one vertex falling outside the silhouette of the inferred mesh are colored blue.
# 4 DATASET GENERATION
Let $C = \{ X , T \}$ be a cloth triangulated surface with $n$ vertices $X \in \mathbb { R } ^ { 3 n }$ and texture coordinates $T \in \mathbb { R } ^ { 2 n }$ . We assume that mesh connectivity remains fixed throughout. The ground truth cloth mesh $C _ { G } ( \theta ) = \{ X _ { G } ( \theta ) , T _ { G } \}$ depends on the pose $\theta$ . Given a pre-trained DNN (we use the network from Jin et al. (2020)), the inferred cloth $C _ { N } ^ { \phantom { } } ( \theta ) = \{ X _ { N } ( \theta ) , T _ { G } \}$ is also a function of the pose $\theta$ . Our objective is to replace the ground truth texture coordinates $T _ { G }$ with perturbed texture coordinates $T _ { N } ( \boldsymbol { \theta } , \boldsymbol { v } )$ , i.e. to compute $\bar { C _ { N } ^ { \prime } } ( \theta , v ) = \{ X _ { N } ( \theta ) , T _ { N } ( \theta , v ) \}$ where $T _ { N } ( \boldsymbol { \theta } , \boldsymbol { v } )$ depends on both the pose $\theta$ and the view $v$ . Even though $T _ { N } ( \boldsymbol { \theta } , \boldsymbol { v } )$ is in principle valid for all $v$ using interpolation (see Section 6.3), training data $T _ { N } ( \theta , v _ { p } )$ is only required for a finite number of camera views $v _ { p }$ . For each camera $p$ , we also only require training data for finite number of poses $\theta _ { k }$ , i.e. we require $\dot { T } _ { N } ( \theta _ { k } , v _ { p } )$ , which is computed from $T _ { G }$ using $\bar { X _ { G } } ( \theta _ { k } )$ , $X _ { N } ( \theta _ { k } )$ , and $v _ { p }$ .
# 4.1 TEXTURE COORDINATE PROJECTION
We project texture coordinates to the inferred cloth vertices $X _ { N } ( \theta _ { k } )$ from the ground truth cloth mesh $C _ { G } ( \theta _ { k } )$ using ray intersection. For each inferred cloth vertex in $X _ { N } ( \theta _ { k } )$ , we cast a ray from camera $p$ ’s aperture through the vertex and find the first intersection with the ground truth mesh $C _ { G } ( \theta _ { k } )$ ; subsequently, $T _ { G }$ is barycentrically interpolated to the point of intersection and assigned to the inferred cloth vertex as its $T _ { N } ( \theta _ { k } , v _ { p } )$ value. See Figure 4. Rays are only cast for inferred cloth vertices that have at least one incident triangle with a nonzero area subregion visible to camera $p$ . Also, a ground truth texture coordinate value is only assigned to an inferred cloth vertex when the point of intersection with the ground truth mesh is visible to camera $p$ . We store and learn texture coordinate displacements $d _ { v _ { p } } ( \theta _ { k } ) = T _ { N } ( \theta _ { k } , v _ { p } ) - T _ { G }$ . Af
 Figure 4: Illustration of the ray intersection method for transferring texture coordinates to the inferred cloth from the ground truth cloth. Texture coordinates for the inferred cloth vertex (red cross) are interpolated from the ground truth mesh to the point of ray intersection (red circle).
ter this procedure, any remaining vertices of the inferred cloth that have not been assigned $d _ { v _ { p } } ( \theta _ { k } )$ values are treated as occluded and handled via smoothness considerations as discussed in Section 4.2.
# 4.2 OCCLUSION HANDLING
Some vertices of the inferred cloth mesh remain unassigned with $d _ { v _ { v } } ( \theta _ { k } ) = 0$ after executing the algorithm outlined in Section 4.1. This creates a discontinuity in $\dot { d } _ { v _ { p } } ( \theta _ { k } )$ which excites high frequencies that require a more complex network architecture to capture. In order to alleviate demands on the network, we smooth $\bar { d } _ { v _ { p } } ( \theta _ { k } )$ as follows. First, we use the Fast Marching Method on triangulated surfaces Kimmel & Sethian (1998) to generate a signed distance field. Then, we extrapolate $d _ { v _ { p } } ( \theta _ { k } )$ normal to the distance field into the unassigned region, see e.g. Osher & Fedkiw (2002). Finally, a bit of averaging is used to provide smoothness, while keeping the assigned values of $d _ { v _ { p } } ( \theta _ { k } )$ unchanged. Alternatively, one could solve a Poisson equation as in Cong et al. (2015) while using the assigned $d _ { v _ { p } } ( \theta _ { k } )$ as Dirichlet boundary conditions.
# 5 NETWORK ARCHITECTURE
A separate texture sliding neural network (TSNN) is trained for each camera $p$ ; thus, we drop the $v _ { p }$ notation in this section. The loss is defined over all poses $\theta _ { k }$ in the training set
$$\mathcal { L } = \sum _ { \theta _ { k } } \left\| d ( \theta _ { k } ) - \hat { d } ( \theta _ { k } ) \right\| _ { 2 }$$
to minimize the difference between the desired displacements $d ( \theta _ { k } )$ and predicted displacements $\hat { d } ( \theta _ { k } )$ . The inferred cloth data we chose to correct are predictions of the T-shirt meshes from Jin et al. (2020), each of which contains about 3,000 vertices. The dataset spans about 10,000 different poses generated from a scanned garment using physically-based simulation, and includes texture coordinates for the garment mesh. To improve the resolution, we up-sampled each cloth mesh by subdividing each triangle into four subtriangles. Notably, our texture sliding approach can be used to augment the results of any dataset for which ground truth and inferred training examples are available. Moreover, it is trivial to increase the resolution of any such dataset simply by subdividing triangles. Note that perturbations of the subdivided geometry are unnecessary, as we merely desire more sample points (to address Figure 2). Finally, we applied an 80-10-10 training-validation-test set split.
Similar to Jin et al. (2020), the displacements $d ( \theta _ { k } )$ are stored as pixel-based cloth images for the front and back sides of the T-shirt, though we still output per-vertex texture coordinate displacements in UV space. See Figure 5 for an overview of the network architecture. Given input joint transformation matrices of shape $1 \times 1 \times 9 0$ , TSNN applies a series of transpose convolution, batch normalization, and ReLU activation layers to upsample the input to $5 1 2 \times 5 1 2 \times 4$ . The first two dimensions of the output tensor represent the predicted displacements for the front side of the T-shirt, and the remaining two dimensions represent those for the back side.
 Figure 5: Texture sliding neural network (TSNN) architecture.
# 6 EXPERIMENTS
In Section 6.1, we quantify the data generation approach of Section 4 and highlight the advantages of mesh subdivision for up-sampling. In Section 6.2, we evaluate the predictions made by our trained texture sliding neural network (TSNN). In Section 6.3, we demonstrate the interpolation of texture sliding results to novel views between a finite number of cameras. Finally, in Section 6.4, we use multi-view texture sliding to reconstruct 3D geometry.
# 6.1 DATASET GENERATION AND EVALUATION
We aim to have the material coordinates of the cloth be in the correct locations as viewed by multiple cameras, so that the material can be accurately 3D reconstructed with point-wise accuracy. As such, our error metric is a bit more stringent than that commonly used because our aim is to reproduce the actual material behavior, not merely to mimic its look (e.g. , by perturbing normal vectors to create shading consistent with wrinkles in spite of the cloth being smooth, as in Lahner et al. (2018)). In order to elucidate this, consider a two-step approach where one first approximates a smooth cloth mesh and then perturbs that mesh to add wrinkles (similar to Santesteban et al. (2019)). In order to preserve area and achieve the correct material behavior, material in the vicinity of a newly forming wrinkle should slide laterally towards that wrinkle as it is formed. Merely non-physically stretching the material in order to create a wrinkle may look plausible, but does not admit the correct material behavior. In fact, the texture would be unrealistically stretched as well, although this is less apparent visually when using simple textures.
Since texture coordinates provide a proxy surface parameterization for material coordinates, we measure texture coordinate errors in a per-pixel fashion comparing between the ground truth and inferred cloth at the center of each pixel. Figure 6a shows results typical for cloth inferred using the network from Jin et al. (2020), and Figure 6b shows the highly improved results obtained on the same inferred geometry using our texture sliding approach (with 1 level of subdivision). Note that the vast majority of the errors in Figure 6b occur near the wrinkles where the nonlinearities illustrated in Figure 2 are most prevalent. In Figure 6c, we deform the vertices of the inferred cloth mesh so that they lie exactly on the ground truth mesh in order to mimic a two-step approach (as discussed above). Note how our error metric captures the still rather large errors in the material coordinates (and thus cloth vertex positions) in spite of the mesh in Figure 6c appearing to have the same wrinkles and folds as the ground truth mesh. Figure 7 compares the local compression and extension energies of the ground truth mesh (Figure 7a), the inferred cloth mesh (Figure 7b), and the result of this two-step process (Figure $\mathrm { 7 c }$ ). In spite of the untextured mesh in Figure 7c bearing visual similarity to the ground truth in Figure 7a, it still has rather large errors in deformation energy.
 Figure 6: Per-pixel texture coordinate errors before (a) and after (b) applying texture sliding to the inferred cloth output by the network of Jin et al. (2020). The result of a two-step process (c) may well match the ground truth in a visual sense, whilst still having quite large errors in material coordinates. Blue $= 0$ , red $\geq 0 . 0 4$ . Figure 7: Local compression (blue) and extension (red) energies for a sample pose, comparing the ground truth cloth (a), the inferred cloth (b), and the result of a two-step process (c). In spite of the cloth mesh in (c) bearing visual resemblance to the ground truth in (a), it still has quite erroneous deformation energies.
Figure 8 illustrates the efficacy of subdividing the cloth mesh to get more samples for texture sliding. The particular ground truth cloth wrinkle shown in Figure 8e is not captured by the inferred cloth geometry shown in Figure 8a. The texture sliding result shown in Figure 8b better represents the ground truth cloth. Figures 8c and 8d show how subdividing the inferred cloth mesh one and two times (respectively) progressively alleviates errors emanating from the linearity assumption illustrated in Figure 2. Table 1 shows quantitative results comparing the inferred cloth to texture sliding with and without subdivision.
Table 1: Per-pixel square root of mean squared error (SqrtMSE) for the entire dataset.
<table><tr><td>Method</td><td>SqrtMSE(×10 3)</td></tr><tr><td>Jin et al. (2020) TS</td><td>24.496± 6.9536 5.2662 士 2.2320</td></tr><tr><td>TS + subdivision</td><td>3.5645 士 1.6617</td></tr></table>
 Figure 8: As the inferred cloth mesh (a) is subdivided, texture sliding (b-d) moves the inferred mesh’s appearance closer to the ground truth (e).
# 6.2 NETWORK TRAINING AND INFERENCE
The network was trained using the Adam optimizer Kingma & Ba (2014) with a $1 0 ^ { - 3 }$ learning rate in PyTorch Paszke et al. (2017). As mentioned earlier, we subdivided the mesh triangles once. Figure 9 shows a typical prediction on a test set example, including the per-pixel errors in predicted texture coordinates. While the TSNN is able to recover the majority of the shirt, it struggles near wrinkles. Figure 10 highlights a particular wrinkle comparing the inferred cloth (Figure 10a) and the results of the TSNN before (Figure 10b) and after (Figure 10c) subdivision to the ground truth (Figure 10d). Table 2 shows quantitative results comparing the inferred cloth to TSNN results with and without subdivision.
 Figure 9: A typical test set example prediction. (a) $\hat { C } _ { N } ^ { \prime }$ ) . $C _ { N } ^ { \prime }$ . (c) Per-pixel errors (blue $= 0$ , red $\geq 0 . 0 4 )$
Table 2: Per-pixel SqrtMSE for the test set. Inspite of Table 1 demonstrating that subdivision improves the ground truth TS data, the improvements are not uniformly realized by the TSNN (which we discuss in the supplemental material).
<table><tr><td>Network</td><td>SqrtMSE(×10 3)</td></tr><tr><td>Jin et al. (2020) TSNN TSNN + subdivision</td><td>24.871 士 7.0613 13.335 士 4.2924 13.591 士 4.5194</td></tr></table>
 Figure 10: The results of the TSNN before (b) and after (c) subdivision, as compared to the ground truth (d). In spite of Table 2, some wrinkles are better resolved by the TSNN after subdivision. The inferred mesh with ground truth texture coordinates is shown in (a).
# 6.3 INTERPOLATING TO NOVEL VIEWS
Given a finite number of camera views $v _ { p }$ , one can specify a new view enveloped by the array using a variety of interpolation methods. For the sake of demonstration, we take a simple approach assuming that one can interpolate via $\begin{array} { r } { \boldsymbol { v } = \sum _ { p } w _ { p } \boldsymbol { v } _ { p } } \end{array}$ , and then use these same weights to compute $\begin{array} { r } { T _ { N } ( \theta _ { k } , v ) = \sum _ { p } w _ { p } T _ { N } ( \theta _ { k } , v _ { p } ) , } \end{array}$ . This same equation is also used for $\hat { T } _ { N } ( \theta _ { k } , v )$ . Figure 11 shows the results obtained by linearly interpolating between two camera views. Note how the largest errors appear near areas occluded by wrinkles, where one (or both) of the cameras has no valid texture sliding results and instead uses the inferred cloth textures. This can be alleviated by using more cameras placed closer together.
 Figure 11: Given two camera views (far left and far right images), texture sliding can be linearly interpolated to novel views between them. The top row shows per-pixel errors (blue $= 0$ , red $\geq 0 . 0 4 $ ), and the bottom row shows the cloth from a fixed front-facing view to illustrate how the interpolated texture changes as a function of the chosen novel view.
# 6.4 3D RECONSTRUCTION
In order to reconstruct the 3D position of a vertex of the ground truth mesh, we take the usual approach of finding rays that pass through that vertex and the camera aperture for a number of cameras. Then given at least two rays, one can triangulate a 3D point that is minimal distance from all the rays. We can do this without solving the typical image to image correspondence problem because we know the ground truth texture coordinates for any given vertex. Thus, we merely have to find the ray that passes through the camera aperture and the ground truth texture coordinate for the vertex under consideration.
To find a ground truth texture coordinate on a texture corrected inferred cloth mesh $C _ { N } ^ { \prime } ( \theta _ { k } , v )$ , or $\hat { C } _ { N } ^ { \prime } ( \theta _ { k } , v )$ , we first find the triangle containing that texture coordinate. This can be done quickly by using a hierarchical bounding box structure where the base level boxes around each triangle are defined using the min/max texture coordinates at the three vertices. Then one can write the barycentric interpolation formula that interpolates the triangle vertex texture coordinates to obtain the given ground truth texture coordinate, and subsequently invert the matrix to solve for the weights. These weights determine the sub-triangle position of the vertex under consideration (taking care to note that different answers are obtained in 3D space versus screen space, since the camera projection is nonlinear). Figure 12 shows the 3D reconstruction of a test set example using texture sliding (Figure 12c) and the TSNN (Figure 12d). To remove reconstruction noise generated by network inference errors in Figure 12d, we used the postprocess from Geng et al. (2020); although, there are many other smoothing options in the literature that one might also consider. Figure 13 compares the per-pixel errors and local compression/extension energies of Figures 12c and 12d.
 Figure 12: The ground truth (a) and inferred cloth (b) compared to the 3D reconstructions obtained using texture sliding (c) and the TSNN (d). Figure 13: Per-pixel errors (top) and local compression/extension energies (bottom) for Figure $1 2 \mathrm { c }$ (a) and Figure 12d (b).
# 7 DISCUSSION AND FUTURE WORK
There are many disparate applications for clothing including for example video games, AR/VR, Hollywood special effects, virtual try-on and shopping, scene acquisition and understanding, and even bullet proof vests and soft armor. Various scenarios define accuracy or fidelity in vastly different ways. So while it is typical to state that one cares about more than just the visual appearance (or “graphics”), often those aiming for predictive capability still make concessions. For example, wherein Santesteban et al. (2019) proposes a network that well predicts wrinkles mapped to new body types, the discussion in Lahner et al. (2018) implies that the horizontal wrinkles predicted by Santesteban et al. (2019) are more characteristic of inaccurate physical simulation than real-world behavior. Instead, Lahner et al. (2018) strives for more vertical wrinkles to better match their data, but they accomplish this by predicting lighting to match an image while accepting overly smooth geometry. And as we have shown in Figure 7c, predicting the correct geometry still allows for rather large errors in the deformation (see Geng et al. (2020)).
In light of this, we state the problem of most interest to us: Our aim is to study the efficacy of using deep neural networks to aid in the modeling of material behavior, especially for those materials for which predictive methods do not currently exist because of various unknowns including friction, material parameters (for cloth and body), etc. Given this goal, we focus on the accurate prediction of material coordinates, which are a super set of deformation, geometry, lighting, visual plausibility, etc.
As demonstrated by the remarkably accurate 3D reconstruction in Figure 12c (see 13a), our approach to encoding high frequency wrinkles into lower frequency texture coordinates (i.e. texture sliding) works quite well. It can be used as a post-process to any existing neural network to capture lost details (as long as ground truth and inferred training examples are available); moreover, we showed that trivial subdivision could be used to increase the sampling resolution to limit linearization artifacts. One needs to take care when training the texture sliding neural network (TSNN) since inference errors can cause reconstruction noise. Thus, as future work, we plan on experimenting with the network architecture, the size of the image used in the CNN, the smoothing methods near occlusion boundaries, the amount of subdivision, etc. In addition, it would be interesting to consider more savvy multiview 3D reconstruction methods (particularly ones that employ DNNs; then, one might train the whole process end-to-end).
# REFERENCES
Thiemo Alldieck, Marcus Magnor, Weipeng Xu, Christian Theobalt, and Gerard Pons-Moll. Detailed human avatars from monocular video. In 2018 International Conference on 3D Vision (3DV), pp. 98–109. IEEE, 2018a.
Thiemo Alldieck, Marcus Magnor, Weipeng Xu, Christian Theobalt, and Gerard Pons-Moll. Video based reconstruction of 3d people models. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8387–8397, 2018b.
Thiemo Alldieck, Marcus Magnor, Bharat Lal Bhatnagar, Christian Theobalt, and Gerard Pons-Moll. Learning to reconstruct people in clothing from a single rgb camera. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1175–1186, 2019a.
Thiemo Alldieck, Gerard Pons-Moll, Christian Theobalt, and Marcus Magnor. Tex2shape: Detailed full human body geometry from a single image. In Proceedings of the International Conference on Computer Vision (ICCV). IEEE, 2019b.
Dragomir Anguelov, Praveen Srinivasan, Daphne Koller, Sebastian Thrun, Jim Rodgers, and James Davis. Scape: shape completion and animation of people. In ACM transactions on graphics (TOG), volume 24, pp. 408–416. ACM, 2005.
Alexandru O Balan and Michael J Black. The naked truth: Estimating body shape under clothing. In ˘ European Conference on Computer Vision, pp. 15–29. Springer, 2008.
David Baraff and Andrew Witkin. Large steps in cloth simulation. In Proceedings of the 25th annual conference on Computer graphics and interactive techniques, pp. 43–54. ACM, 1998.
David Baraff, Andrew Witkin, and Michael Kass. Untangling cloth. In ACM Transactions on Graphics (TOG), volume 22, pp. 862–870. ACM, 2003.
Davide Boscaini, Jonathan Masci, Emanuele Rodolà, and Michael Bronstein. Learning shape correspondence with anisotropic convolutional neural networks. In Advances in Neural Information Processing Systems, pp. 3189–3197, 2016.
Derek Bradley, Tamy Boubekeur, and Wolfgang Heidrich. Accurate multi-view reconstruction using robust binocular stereo and surface meshing. In 2008 IEEE Conference on Computer Vision and Pattern Recognition, pp. 1–8. IEEE, 2008a.
Derek Bradley, Tiberiu Popa, Alla Sheffer, Wolfgang Heidrich, and Tamy Boubekeur. Markerless garment capture. In ACM Transactions on Graphics (TOG), volume 27, pp. 99. ACM, 2008b.
Robert Bridson, Ronald Fedkiw, and John Anderson. Robust treatment of collisions, contact and friction for cloth animation. In ACM Transactions on Graphics (ToG), volume 21, pp. 594–603. ACM, 2002.
Robert Bridson, Sebastian Marino, and Ronald Fedkiw. Simulation of clothing with folds and wrinkles. In Proceedings of the 2003 ACM SIGGRAPH/Eurographics Symposium on Computer Animation, pp. 28–36. ACM, 2003.
Michael M Bronstein, Joan Bruna, Yann LeCun, Arthur Szlam, and Pierre Vandergheynst. Geometric deep learning: going beyond euclidean data. IEEE Signal Processing Magazine, 34(4):18–42, 2017.
Matthew Cong, Michael Bao, Jane L E, Kiran S Bhat, and Ronald Fedkiw. Fully automatic generation of anatomical face simulation models. In Proceedings of the 14th ACM SIGGRAPH/Eurographics Symposium on Computer Animation, pp. 175–183. ACM, 2015.
R Daneˇˇrek, Endri Dibra, Cengiz Öztireli, Remo Ziegler, and Markus Gross. Deepgarment: 3d garment shape estimation from a single image. In Computer Graphics Forum, volume 36, pp. 269–280. Wiley Online Library, 2017.
Edilson De Aguiar, Leonid Sigal, Adrien Treuille, and Jessica K Hodgins. Stable spaces for real-time clothing. In ACM Transactions on Graphics (TOG), volume 29, pp. 106. ACM, 2010.
Jean-Sébastien Franco, Marc Lapierre, and Edmond Boyer. Visual shapes of silhouette sets. In Third International Symposium on 3D Data Processing, Visualization, and Transmission (3DPVT’06), pp. 397–404. IEEE, 2006.
Zhenglin Geng, Daniel Johnson, and Ronald Fedkiw. Coercing machine learning to output physically accurate results. Journal of Computational Physics, 406:109099, 2020.
Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep learning. MIT press, 2016.
Peng Guan, Loretta Reiss, David A Hirshberg, Alexander Weiss, and Michael J Black. Drape: Dressing any person. ACM Trans. Graph., 31(4):35–1, 2012.
Erhan Gundogdu, Victor Constantin, Amrollah Seifoddini, Minh Dang, Mathieu Salzmann, and Pascal Fua. Garnet: A two-stream network for fast and accurate 3d cloth draping. In Proceedings of the IEEE International Conference on Computer Vision, pp. 8739–8748, 2019.
Marc Habermann, Weipeng Xu, Michael Zollhoefer, Gerard Pons-Moll, and Christian Theobalt. Livecap: Real-time human performance capture from monocular video. ACM Transactions on Graphics (TOG), 38(2):14, 2019.
Fabian Hahn, Bernhard Thomaszewski, Stelian Coros, Robert W Sumner, Forrester Cole, Mark Meyer, Tony DeRose, and Markus Gross. Subspace clothing simulation using adaptive bases. ACM Transactions on Graphics (TOG), 33(4):105, 2014.
Richard I Hartley and Peter Sturm. Triangulation. Computer vision and image understanding, 68(2): 146–157, 1997.
Peng Huang, Margara Tejera, John Collomosse, and Adrian Hilton. Hybrid skeletal-surface motion graphs for character animation from 4d performance capture. ACM Transactions on Graphics (ToG), 34(2):17, 2015.
Ning Jin, Yilin Zhu, Zhenglin Geng, and Ronald Fedkiw. A pixel-based framework for data-driven clothing. In Proceedings of the 19th ACM SIGGRAPH / Eurographics Symposium on Computer Animation, volume 39. Association for Computing Machinery, 2020.
Ron Kimmel and James A Sethian. Computing geodesic paths on manifolds. Proceedings of the national academy of Sciences, 95(15):8431–8435, 1998.
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
Ilya Kostrikov, Zhongshi Jiang, Daniele Panozzo, Denis Zorin, and Joan Bruna. Surface networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2540–2548, 2018.
Zorah Lahner, Daniel Cremers, and Tony Tung. Deepwrinkles: Accurate and realistic clothing modeling. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 667–684, 2018.
Matthew Loper, Naureen Mahmood, Javier Romero, Gerard Pons-Moll, and Michael J Black. Smpl: A skinned multi-person linear model. ACM transactions on graphics (TOG), 34(6):248, 2015.
Haggai Maron, Meirav Galun, Noam Aigerman, Miri Trope, Nadav Dym, Ersin Yumer, Vladimir G Kim, and Yaron Lipman. Convolutional neural networks on surfaces via seamless toric covers. ACM Trans. Graph., 36(4):71–1, 2017.
Jonathan Masci, Davide Boscaini, Michael Bronstein, and Pierre Vandergheynst. Geodesic convolutional neural networks on riemannian manifolds. In Proceedings of the IEEE international conference on computer vision workshops, pp. 37–45, 2015.
Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. arXiv preprint arXiv:1411.1784, 2014.
Federico Monti, Davide Boscaini, Jonathan Masci, Emanuele Rodola, Jan Svoboda, and Michael M Bronstein. Geometric deep learning on graphs and manifolds using mixture model cnns. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5115–5124, 2017.
Matthias Müller and Nuttapong Chentanez. Wrinkle meshes. In Proceedings of the 2010 ACM SIGGRAPH/Eurographics symposium on computer animation, pp. 85–92. Eurographics Association, 2010.
Ryota Natsume, Shunsuke Saito, Zeng Huang, Weikai Chen, Chongyang Ma, Hao Li, and Shigeo Morishima. Siclope: Silhouette-based clothed people. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4480–4490, 2019.
Alexandros Neophytou and Adrian Hilton. A layered model of human body and garment deformation. In 2014 2nd International Conference on 3D Vision, volume 1, pp. 171–178. IEEE, 2014.
Hayato Onizuka, Zehra Hayirci, Diego Thomas, Akihiro Sugimoto, Hideaki Uchiyama, and Rinichiro Taniguchi. Tetratsdf: 3d human reconstruction from a single image with a tetrahedral outer shell. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6011–6020, 2020.
Stanley Osher and Ronald Fedkiw. Level Set Methods and Dynamic Implicit Surfaces. Springer, New York, 2002.
Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017.
Chaitanya Patel, Zhouyingcheng Liao, and Gerard Pons-Moll. Tailornet: Predicting clothing in 3d as a function of human pose, shape and garment style. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7365–7375, 2020.
Georgios Pavlakos, Vasileios Choutas, Nima Ghorbani, Timo Bolkart, Ahmed AA Osman, Dimitrios Tzionas, and Michael J Black. Expressive body capture: 3d hands, face, and body from a single image. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 10975–10985, 2019.
Gerard Pons-Moll, Sergi Pujades, Sonny Hu, and Michael J Black. Clothcap: Seamless 4d clothing capture and retargeting. ACM Transactions on Graphics (TOG), 36(4):73, 2017.
Tiberiu Popa, Quan Zhou, Derek Bradley, Vladislav Kraevoy, Hongbo Fu, Alla Sheffer, and Wolfgang Heidrich. Wrinkling captured garments using space-time data-driven deformation. In Computer Graphics Forum, volume 28, pp. 427–435. Wiley Online Library, 2009.
Nadia Robertini, Edilson De Aguiar, Thomas Helten, and Christian Theobalt. Efficient multi-view performance capture of fine-scale surface detail. In 2014 2nd International Conference on 3D Vision, volume 1, pp. 5–12. IEEE, 2014.
Damien Rohmer, Tiberiu Popa, Marie-Paule Cani, Stefanie Hahmann, and Alla Sheffer. Animation wrinkling: augmenting coarse cloth simulations with realistic-looking wrinkles. In ACM Transactions on Graphics (TOG), volume 29, pp. 157. ACM, 2010.
Shunsuke Saito, Zeng Huang, Ryota Natsume, Shigeo Morishima, Angjoo Kanazawa, and Hao Li. Pifu: Pixel-aligned implicit function for high-resolution clothed human digitization. In Proceedings of the International Conference on Computer Vision (ICCV). IEEE, 2019.
Shunsuke Saito, Tomas Simon, Jason Saragih, and Hanbyul Joo. Pifuhd: Multi-level pixel-aligned implicit function for high-resolution 3d human digitization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 84–93, 2020.
Igor Santesteban, Miguel A Otaduy, and Dan Casas. Learning-based animation of clothing for virtual try-on. In Computer Graphics Forum, volume 38, pp. 355–366. Wiley Online Library, 2019.
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, 2008.
Bernhard Scholkopf and Alexander J Smola. Learning with kernels: support vector machines, regularization, optimization, and beyond. MIT press, 2001.
Steven M Seitz, Brian Curless, James Diebel, Daniel Scharstein, and Richard Szeliski. A comparison and evaluation of multi-view stereo reconstruction algorithms. In 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’06), volume 1, pp. 519–528. IEEE, 2006.
Andrew Selle, Jonathan Su, Geoffrey Irving, and Ronald Fedkiw. Robust high-resolution cloth using parallelism, history-based collisions, and accurate friction. IEEE transactions on visualization and computer graphics, 15(2):339–350, 2008.
Qingyang Tan, Lin Gao, Yu-Kun Lai, and Shihong Xia. Variational autoencoders for deforming 3d mesh models. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5841–5850, 2018.
Gul Varol, Duygu Ceylan, Bryan Russell, Jimei Yang, Ersin Yumer, Ivan Laptev, and Cordelia Schmid. Bodynet: Volumetric inference of 3d human body shapes. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 20–36, 2018.
Daniel Vlasic, Ilya Baran, Wojciech Matusik, and Jovan Popovic. Articulated mesh animation from´ multi-view silhouettes. In ACM Transactions on Graphics (TOG), volume 27, pp. 97. ACM, 2008.
Huamin Wang, Florian Hecht, Ravi Ramamoorthi, and James F O’Brien. Example-based wrinkle synthesis for clothing animation. In Acm Transactions on Graphics (TOG), volume 29, pp. 107. ACM, 2010.
Tuanfeng Y Wang, Duygu Ceylan, Jovan Popovic, and Niloy J Mitra. Learning a shared shape space ´ for multimodal garment design. In SIGGRAPH Asia 2018 Technical Papers, pp. 203. ACM, 2018.
Chenglei Wu, Kiran Varanasi, and Christian Theobalt. Full body performance capture under uncontrolled and varying illumination: A shading-based approach. In European Conference on Computer Vision, pp. 757–770. Springer, 2012.
Weipeng Xu, Avishek Chatterjee, Michael Zollhöfer, Helge Rhodin, Dushyant Mehta, Hans-Peter Seidel, and Christian Theobalt. Monoperfcap: Human performance capture from monocular video. ACM Transactions on Graphics (ToG), 37(2):27, 2018.
Jinlong Yang, Jean-Sébastien Franco, Franck Hétroy-Wheeler, and Stefanie Wuhrer. Estimation of human body shape in motion with wide clothing. In European Conference on Computer Vision, pp. 439–454. Springer, 2016.
Jinlong Yang, Jean-Sébastien Franco, Franck Hétroy-Wheeler, and Stefanie Wuhrer. Analyzing clothing layer deformation statistics of 3d human motions. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 237–253, 2018.
Tao Yu, Zerong Zheng, Yuan Zhong, Jianhui Zhao, Qionghai Dai, Gerard Pons-Moll, and Yebin Liu. Simulcap: Single-view human performance capture with cloth simulation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2019.
Chao Zhang, Sergi Pujades, Michael J Black, and Gerard Pons-Moll. Detailed, accurate, human shape estimation from clothed 3d scan sequences. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4191–4200, 2017.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290# Progressive Coordinate Transforms for Monocular 3D Object Detection
Li Wang1∗ Li Zhang1† Yi Zhu2 Zhi Zhang2 Tong He2 Mu Li2 Xiangyang Xue1 1Fudan University 2Amazon Inc.
# Abstract
Recognizing and localizing objects in the 3D space is a crucial ability for an AI agent to perceive its surrounding environment. While significant progress has been achieved with expensive LiDAR point clouds, it poses a great challenge for 3D object detection given only a monocular image. While there exist different alternatives for tackling this problem, it is found that they are either equipped with heavy networks to fuse RGB and depth information or empirically ineffective to process millions of pseudo-LiDAR points. With in-depth examination, we realize that these limitations are rooted in inaccurate object localization. In this paper, we propose a novel and lightweight approach, dubbed Progressive Coordinate Transforms (PCT) to facilitate learning coordinate representations. Specifically, a localization boosting mechanism with confidence-aware loss is introduced to progressively refine the localization prediction. In addition, semantic image representation is also exploited to compensate for the usage of patch proposals. Despite being lightweight and simple, our strategy leads to superior improvements on the KITTI and Waymo Open Dataset monocular 3D detection benchmarks. At the same time, our proposed PCT shows great generalization to most coordinatebased 3D detection frameworks. The code is available at: https://github.com/ amazon-research/progressive-coordinate-transforms.
# 1 Introduction
Object detection is a fundamental and challenging task in scene understanding applications. Recently, 3D object detection has received increasing attention and found applications in a wide range of scenarios such as autonomous driving, robotics, visual navigation and mixed reality. Despite the great progress from the area of 2D object detection [34, 49, 40, 18, 4], 3D object detection remains a largely unsolved problem as it aims to predict the object location in the 3D space alongside 3D object dimension and orientation.
Existing prevalent approaches [50, 44, 35, 10, 11] for 3D object detection largely rely on LiDAR sensors, which provide accurate 3D point clouds of the scene. Although these approaches achieve superior performance, the dependence on expensive equipment severely limits their applicability to generic 3D perception. There also exists a cheaper alternative that takes a single-view RGB image as input, termed as monocular 3D object detection. However, its performance is far from satisfactory as itself is an ill-posed problem due to the loss of depth information in 2D image planes. Hence, several recent attempts introduce depth information to help monocular 3D detection. Such attempts can be roughly categorized into two directions, pixel-based and coordinate-based. Pixel-based approaches [9, 36, 31, 41] turn to use estimated depth map as additional input for improved detection performance. But at the same time, this leads to heavy computational burden and large memory footprint since they often operate on the entire image. Coordinated-based approaches [42, 29, 46, 27] pursue the coordinate representations as in LiDAR-based methods. They use the predicted depth map to convert the monocular image pixels to 3D coordinate representations, then apply a 3D detector on the converted coordinates. In particular, they are often lightweight since their network inputs are object proposals generated by 2D detectors [29, 27]. However, the performance of coordinated-based methods lags far behind LiDAR-based methods. So we ask, can we identify the bottleneck that holds back the 3D detection accuracy of coordinate-based methods and how can we improve them?
Table 1: Probing investigation on coordinate-based methods, PatchNet [27] and Pseudo-LiDAR [42]. We examine the potential improvement by replacing the predicted factor with the corresponding ground truth. $^ *$ indicates our reproduced performance. We can see that coordinate-based methods mostly suffer from inaccurate localization.
<table><tr><td rowspan="2">Factor</td><td colspan="3">PatchNet*[AP3D/APBEV]</td><td colspan="3">Pseudo-LiDAR*[AP3D/APBEv]</td></tr><tr><td>Mod.</td><td>Easy</td><td>Hard</td><td>Mod.</td><td>Easy</td><td>Hard</td></tr><tr><td>Baseline</td><td>26.31/34.14</td><td>36.40/46.80</td><td>21.07/28.04</td><td>23.04/31.06</td><td>32.27/42.45</td><td>19.67/25.67</td></tr><tr><td>dimension</td><td>27.26/34.62</td><td>40.32/47.24</td><td>24.29/28.38</td><td>25.88/31.97</td><td>36.09/44.35</td><td>20.88/26.60</td></tr><tr><td>rotation</td><td>26.25/34.04</td><td>36.09/46.25</td><td>23.49/27.99</td><td>23.88/31.31</td><td>32.42/42.74</td><td>19.85/26.07</td></tr><tr><td>X</td><td>32.80/41.43</td><td>45.60/56.22</td><td>27.38/34.63</td><td>28.36/36.77</td><td>39.69/50.78</td><td>25.08/29.92</td></tr><tr><td>y</td><td>30.16/34.14</td><td>40.94/46.80</td><td>24.58/28.04</td><td>25.53/31.06</td><td>35.19/42.45</td><td>20.69/25.67</td></tr><tr><td>Z</td><td>42.42/53.48</td><td>55.42/68.29</td><td>35.54/45.60</td><td>38.37/50.81</td><td>50.04/63.96</td><td>32.24/43.32</td></tr><tr><td>location(xyz)</td><td>72.58/75.27</td><td>81.41/85.14</td><td>57.69/66.10</td><td>64.36/73.37</td><td>79.13/83.77</td><td>55.64/58.27</td></tr></table>
In order to determine the bottleneck, we conduct an investigation on two widely adopted coordinatebased methods, PatchNet [27] and Pseudo-LiDAR [42]. Specifically, for each prediction target, we examine the potential improvement by replacing its value with the corresponding ground truth, and then re-compute the 3D detection accuracy. As shown in Table 1, using ground truth dimension and rotation do not bring significant improvements over the baseline. But using ground truth location (i.e., x/y/z values of the objects) almost triples detection accuracy. This indicates that coordinate-based methods mostly suffer from inaccurate localization even with the assistance of estimated depth maps.
Based on this observation, we focus on improving the accuracy of 3D center localization. In this work, we propose a lightweight and generalized approach, called Progressive Coordinate Transforms (PCT), to enhance the localization capability for coordinate-based methods. First of all, since the localization regression network in most coordinate-based methods is less accurate but lightweight, we propose to progressively refine its prediction similar to gradient boosting [12, 13]. To be specific, a localization regression network can be seen as a weak learner, and we progressively train multiple consecutive networks such that each network fits the regression residual from the previous networks. These networks share the same lightweight structure so that the computation overhead is negligible. We also predict a confidence score for each network to help stabilize the end-to-end training. We term this progressive refining strategy as confidence-aware localization boosting (CLB). Compared to image-only or pixel-based methods, coordinated-based methods suffer from the problem of missing global context information due to the use of patched input. In order to further improve the localization accuracy, we exploit semantic image representations from 2D detector. We term this module as global context encoding (GCE). We find that GCE can not only improve center localization accuracy, but also contribute to the final 3D box estimation.
Through extensive experiments, our progressive coordinate transforms, consisting of CLB and GCE, is shown to improve popular coordinate-based models [42, 27] by generating more accurate localization. Without bells and whistles, we achieve state-of-the-art monocular 3D detection performance on KITTI [16, 17, 15] with a strong base method [27]. Additionally, this also leads to superior improvements on Waymo Open Dataset [38] compared with the base method PatchNet.
# 2 Related work
# 2.1 Monocular 3D object detection
Existing paradigms for monocular 3D object detection can be categorized into two types: image-only methods and depth-assisted methods.
For image-only methods, they often adapt architectures and good practices from popular 2D detectors [34, 49, 40]. However, locating objects in 3D space is much more challenging without depth information. Hence, several works [30, 2, 25, 6, 49] integrate geometry consistency into the training strategy to constrain the localization prediction. Deep3DBox [30] divides orientation into multi-bins to stably regress them, and combines the 2D-3D box constraint to recover accurate 3D object pose. M3D-RPN [2] utilizes the geometric relationship between 2D and 3D perspectives by sharing the prior anchors and classification targets. MonoPair [6] leverages the spatial relationships between paired objects to improve accuracy on occluded objects. To further improve the performance of truncated objects, MonoFlex [48] decouples the features learning and prediction of truncated objects, and formulates an depth estimation to adaptively combine independent estimator based on uncertainty. [33] designs CaDDN as a fully differentiable end-to-end approach for joint depth estimation and object detection.
Depth-assisted methods often estimate a depth map given a input image, and use it in different ways. Some pixel-based approaches [9, 26] directly feed images and estimated depth maps into networks to generate depth-aware features and enhance the 3D detection performance. Some other coordinatebased approaches first transform the pixels of input images to 3D coordinates by leveraging the depth and camera information, then feed the coordinate proposals to a 3D detector. Pioneering work Pseudo-LiDAR [42] imitates the process of LiDAR-based approaches, which uses LiDAR-based 3D detector upon coordinates proposals. AM3D [29] explores the multi-modal input fusion to embed the complementary RGB cue into the network. Recently, PatchNet [27] points out that the efficacy of pseudo-LiDAR representation comes from the coordinate transform, instead of sophisticated LiDAR-based networks. Hence, they design a simple 2D CNN to perform 3D detection. In this work, we follow the research of coordinate-based methods [42, 27]. Instead of regressing 3D localization directly with a single lightweight network, we propose to progressively refine the prediction inspired by gradient boosting. We also incorporate RGB image information to complement patch proposals and enhance global context modeling. Different from AM3D [29], we utilize the RGB features from the 2D detector directly which can share the same context, and we do not need to train another RGB network from scratch.
# 2.2 Gradient boosting
Gradient boosting is a well-known greedy algorithm proposed in [7], which trains a sequence of learners and progressively improves the prediction results. It is a general learning framework, and has been verified to be a formidable force when applied with lightweight learners. Meanwhile, when each learner in the sequence is heavy, the computation cost becomes high and the performance is not beneficial [24]. Early works in 2D detection area [19, 21, 22] also adopt the boosting mechanism following a standard cascade paradigm, and achieve improved performance. Li et al. [21] treat face detection as an image retrieval task and improve it with a boosted exemplar-based face detector. Karianakis et al. [19] and Li et al. [22] feed convolutional features of proposals instead of hand-crafted features to boosted classifiers and distinguish objects from backgrounds. We can also find the usage of gradient boosting in other computer vision tasks [37, 51].
To our best knowledge, we are the first to explore the boosting mechanism in coordinate-based methods for 3D object detection. We perform this mechanism in two folds. First, instead of the entire 3D detection pipeline, we only progressively boost the localization regression network as its computational cost is insignificant comparing to the entire pipeline. Second, we refine the localization with an additional confidence score in the boosting procedure, such that the loss is balanced. These choices greatly improves the performance with small extra parameters.
# 3 Background
Before diving into the details, we first revisit recent coordinate-based monocular 3D detection methods and present a visual depiction of its common pipeline in Figure 1. The framework usually consists of four main components: 2D bounding box generation, depth map estimation, data transformation and 3D box estimation. Specifically, given an image $I$ , the process can be described as:
2D bounding box generation. An off-the-shelf 2D object detector $F _ { 2 d }$ such as Faster R-CNN [34] is employed on image $I$ to generate region of interests (RoIs), $\mathscr { R } = F _ { 2 d } ( I )$ .
 Figure 1: A common pipeline of coordinate-based monocular 3D detectors. It consists of four steps to predict the final 3D boxes: 2D bounding box generation, depth map estimation, data transformation and 3D box estimation. In this work, we focus on improving the last step: 3D box estimation.
Depth map estimation. An off-the-shelf depth estimator $F _ { z }$ such as DORN [14] is applied on image $I$ to predict its depth map, $\mathcal { Z } = F _ { z } ( I )$ .
Data transformation. To convert a pixel $( u , v )$ within a RoI to 3D space, the associated depth $z = \mathcal { Z } ( u , v )$ is used to transform it into its 3D coordinates $\left( c _ { x } , c _ { y } , c _ { z } \right)$ by
$$c _ { x } = { \frac { ( u - u ^ { \prime } ) \times z } { f _ { u } } } ; \quad c _ { y } = { \frac { ( v - v ^ { \prime } ) \times z } { f _ { v } } } ; \quad c _ { z } = z$$
Here, $\left( c _ { x } , c _ { y } , c _ { z } \right)$ is a pixel in the generated 3D coordinate patch $c$ . $( u ^ { \prime } , v ^ { \prime } )$ is the camera principal point. $f _ { u }$ and $f _ { v }$ are the focal length along horizontal and vertical axis, respectively. $u ^ { \prime } , v ^ { \prime } , \bar { f } _ { u } , f _ { v }$ are usually provided by the datasets.
3D box estimation. Once the 3D coordinates for each RoI are available, the final step is to predict 3D boxes with their center location, rotation and dimension. Different networks $F _ { 3 d }$ such as Frustum PointNet [32] can be employed to conduct 3D box prediction, $\boldsymbol { B } = F _ { 3 d } ( \boldsymbol { c } )$ . Here, $\boldsymbol { B }$ includes the center location $( x , y , z )$ , rotation $( \theta )$ , and dimensions $( w , h , l )$ of the 3D box.
Since the first two steps use off-the-shelf models and the third step can be computed analytically, in this paper, we focus on improving the last step of coordinated-based methods. In particular, our goal is to improve the accuracy of localization prediction motivated by the observation in Table 1.
# 4 Method
In this section, we present our progressive coordinate transforms (PCT) for improved 3D detection. In order to obtain more accurate localization predictions, we introduce a confidence-aware localization boosting mechanism (CLB) in Sec. 4.1 to progressively refine the prediction. Then in Sec. 4.2, we incorporate RGB image information by a global context encoding (GCE) strategy to compensate for the drawbacks of using patch proposals. In the end, we illustrate the overall framework of PCT in Figure 2 (a).
# 4.1 Confidence-aware localization boosting
Following Frustum PointNet [32], most coordinate-based methods [42, 45, 27, 43] divide the last step of 3D box estimation into two major components. The first component is a lightweight 3D localization regressor $F$ , whose input is 3D coordinate proposals generated from data transformation. The second component is a relatively heavy network $G$ used to regress the final 3D box $\boldsymbol { B }$ . Recalling the results in Table 1, 3D localization performance is the weakest point of a coordinate-based model, accounting for up to 50 AP loss when all other modules keep intact. Therefore, can we find an efficient way to improve the accuracy of localization prediction and also generalizes to other coordinated-based methods?
Gradient boosting [12, 13] is a general learning framework that combines multiple weak learners into a single strong one in an iterative fashion. Let $\mathcal { L } ( x )$ be the risk of ensemble models, the algorithm devotes to seek an approximation $h ( x )$ to minimize $\mathcal { L } ( y ^ { \ast } , x ) = \Psi ( y ^ { \ast } , h ( x ) )$ , where $y ^ { * }$ is a target value, $\Psi ( \cdot )$ is the loss function. $h ( x )$ is a linear combination of a set of weak (base) learners $f _ { t } ( x )$ from some class $\mathcal { F }$ , i.e., $\begin{array} { r } { h ( x ) = \sum _ { t = 1 } ^ { t = T } \gamma _ { t } f _ { t } ( x ) + c o n s t } \end{array}$ . Here, $T$ is the total training iterations and $\gamma _ { t }$ is the corresponding weight for each weak learner. To minimize the empirical risk, the algorithm starts with a model $h _ { 0 } ( x )$ , and then incrementally expands it in a greedy manner. This process manages to fit a new weak learner to the residual errors made by the previous set of learners. Mathematically, the
 Figure 2: (a) Schematic illustration of proposed Coordinate Transforms (PCT). We treat $F$ as a weaker learner, and perform coordinate transform $T$ steps via confidence-aware localization boosting (CLB module) to obtain a better localization. Then the refined coordinate proposals combined with corresponding encoded RGB features (GCE module) are fed into network $\mathbf { G }$ to generate final 3D bounding boxes. (b) The data flow of CLB mechanism in detail. For step $t$ , it takes refined coordinate patches $c _ { t - 1 }$ as input, which is transformed based on predicted $\Delta ( x _ { t - 1 } , y _ { t - 1 } , z _ { t - 1 } )$ . Then network $F _ { t }$ generate the residual localization for the next step, and confidence $s _ { t }$ is also generated during the training process.
optimization can be formulated as
$$\begin{array} { r l } & { h _ { 0 } ( x ) = \underset { \gamma _ { 0 } } { \arg \operatorname* { m i n } } \mathcal { L } _ { 0 } ( y ^ { * } , x ) ; } \\ & { ~ \quad \quad \cdots } \\ & { h _ { t } ( x ) = h _ { t - 1 } ( x ) + \underset { f _ { t } \in \mathcal { F } } { \arg \operatorname* { m i n } } \mathcal { L } _ { t } ( y ^ { * } , h _ { t - 1 } ( x ) + f _ { t } ( x ) ) . } \end{array}$$
Inspired by gradient boosting, we imitate its optimization procedure to progressively adapt localization prediction by multiple localization regressors instead of a single one used in previous works [42, 29, 46, 27]. To be specific, we treat localization network $F$ as a weak learner and stack multiple of them as shown in Figure 2 (b). Given $F$ is a lightweight network, the extra computational cost brought by gradient boosting is insignificant. After the data transformation step, each 2D bounding box obtains its corresponding coordinate patch $c$ . We take the coordinate patch as the input of weak learner $F$ to regress the center localization residual $\Delta ( x , y , z )$ based on the prediction from previous stage,
$$\Delta ( x _ { t } , y _ { t } , z _ { t } ) = F _ { t } ( c _ { t - 1 } ) ; { \mathrm { ~ w h e r e ~ } } c _ { t - 1 } = c _ { 0 } - \gamma _ { 0 } ( x _ { 0 } , y _ { 0 } , z _ { 0 } ) - \sum _ { i = 1 } ^ { t - 1 } \gamma _ { i } \Delta ( x _ { i } , y _ { i } , z _ { i } ) .$$
We denote $c _ { 0 }$ and $( x _ { 0 } , y _ { 0 } , z _ { 0 } )$ to be the initial coordinate input patch and object location, respectively. Coordinate input patch $c _ { t - 1 }$ is then transformed according to the localization residual prediction, and fed into the next weak learner.
Thus the risk at stage $t$ can be written as,
$$\mathcal { L } _ { F _ { t } } ( ( x ^ { * } , y ^ { * } , z ^ { * } ) , c _ { t - 1 } ) = \Psi ( ( x ^ { * } , y ^ { * } , z ^ { * } ) , \gamma _ { 0 } ( x _ { 0 } , y _ { 0 } , z _ { 0 } ) + \sum _ { i = 1 } ^ { t - 1 } \gamma _ { i } \Delta ( x _ { i } , y _ { i } , z _ { i } ) )$$
where $( x ^ { * } , y ^ { * } , z ^ { * } )$ indicates the ground truth location. At this point, we can easily see that $\mathrm { E q 4 }$ is a natural derivation from $\operatorname { E q } 2$ . After $T$ iterations, the final adjusted prediction $c _ { T }$ is fed into the network $G$ to estimate the 3D box $\boldsymbol { B }$ $3 , i . e . B = G ( c _ { T } )$ .
Confidence-aware network loss In the case that the target of weak learner $f$ is differentiable, gradient boosting solves the optimization problem in a forward greedy manner as shown in Eq 2. For each iteration, it first fits the weak learner $f$ to the residual error, and then the optimal value of the coefficient weight $\gamma$ is determined for this weak learner. The optimization procedures train iteratively for $T$ iterations.
However, for our center regression task, we would like to train $T$ weak localization networks $F _ { t } ( c _ { t - 1 } ) , t \in { 1 , . . . , T }$ and a 3D box prediction network $G$ in an end-to-end manner instead of bootstrapping. This is challenging in terms of both computational cost and optimization stability, given the simultaneous training of a set of weak learners and their coefficient weights. Therefore, we first simplify the problem by treating all $\gamma _ { t }$ the same and only focus on optimizing the localization networks. However, the contribution from each weak learner $F$ may not be the same during end-toend training, which leads to unstable optimization. Hence, we tailor a confidence-aware boosting loss to facilitate network training, by learning confidence score $s _ { t }$ for each localization loss function $\mathcal { L } _ { F _ { t } }$ . The confidence score $s _ { t }$ is learned from a small decoder and followed a self-balancing formulation closely coupled to the network loss. The overall loss function is defined as
$$\mathcal { L } ( \boldsymbol { B } ^ { * } , \boldsymbol { c } _ { 0 } ) = \sum _ { t = 1 } ^ { T } s _ { t } \ast \mathcal { L } _ { \boldsymbol { F } _ { t } } ( ( \boldsymbol { x } ^ { * } , \boldsymbol { y } ^ { * } , \boldsymbol { z } ^ { * } ) , \boldsymbol { c } _ { t - 1 } ) + \lambda _ { s } \prod _ { t = 1 } ^ { T } ( 1 - s _ { t } ) + \mathcal { L } _ { G } ( \boldsymbol { B } ^ { * } , \boldsymbol { c } _ { T } ) ,$$
where $B ^ { * }$ is the 3D box ground truth, $( x ^ { \ast } , y ^ { \ast } , z ^ { \ast } ) \in B ^ { \ast }$ and $\lambda _ { s }$ is the balance weight. $s _ { t }$ is the prediction after sigmoid, which represents the confidence of the localization regression loss at $t ^ { t h }$ stage, and $\textstyle \prod _ { t = 1 } ^ { T } ( 1 - s _ { t } )$ is the penalty on the network uncertainty. In other words, if $s _ { t }$ is approaching 1, which means the network is confident about localization refinement at $t ^ { t h }$ stage, then no penalty will be applied. Otherwise, the uncertainty of regression loss is high, thus triggers a higher penalty.
# 4.2 Global context encoding
Typical coordinate-based methods [42, 45, 27, 43] perform 3D detection based on 2D RoIs, which is similar to two-stage 2D detection frameworks, such as Faster R-CNN [34]. In a two-stage 2D object detection framework, the second stage reuses the features from the first stage via RoIPooling [34] or RoIAlign operators [18] guided by ROI proposals, and then a small decoder is used for localization refinement. However, in 3D detection, only cropped patches with coordinates information are fed to the network for 3D box regression. Neither RGB information nor global context is included.
Considering that the RGB information is a vital visual clue, we explore its aggregation in the last 3D box estimation step. Similar to two-stage 2D detectors, we obtain the RGB information by directly cropping the corresponding features from a 2D detector $F _ { 2 d }$ . Then the input to 3D box estimator $G$ can be formulated as $\bar { c \mathbf { \eta } } = \{ [ \mathcal { D } ( { \boldsymbol u } , { \boldsymbol v } ) , \mathcal { A } ( { \boldsymbol u } , { \boldsymbol v } ) ] , \forall ( { \boldsymbol u } , { \boldsymbol v } ) \in \mathcal { R } \}$ . Here, $\mathcal { D } ( \cdot )$ represents the data transformation function and $\boldsymbol { \mathcal { A } } ( \cdot )$ represents the RoIAlign operation. Both operations are performed upon the generated regions of interest from $\mathcal { R }$ .
After RoIAlign operation, features are of size $C \times K \times K$ , where $C$ is the number of channels and $K \times K$ is the corresponding width and height, respectively. A small feature encoder is then used to encode cropped features into vectors with the dimension of $C$ . A feature fusion is followed to integrate coordinate representations with the obtained image representations. Benefiting from the large receptive fields of image feature representations, 3D box estimator can now have access to global context. Besides, directly cropping on RGB features also avoids learning image representations of RoIs from scratch and reduces the overall network parameters.
# 5 Experiments
Two monocular 3D detection benchmarks are introduced in Sec. 5.1 and Sec. 5.2, while experimental implementation details are described in Sec. 5.3. In Sec. 5.4, we conduct main analysis on KITTI dataset [16, 17, 15] with base method PatchNet [27] given its current best performance. More experiments on Waymo Open Dataset [38] are also demonstrated to further verify the generality of our proposed PCT in Sec. 5.5.
# 5.1 KITTI setup
We first evaluate our method on the KITTI benchmark [16, 17, 15], which contains 7,481 and 7,518 images for training and testing respectively. We follow [5] to split the 7,481 training images into 3712 for training and 3,769 for validation.
Table 2: Ablative analysis on KITTI validation set for $\mathrm { A P _ { 3 D } }$ and $\mathrm { A P _ { B E V } }$ at $\mathrm { I o U } = 0 . 7$ . Experiment Group (I) is the baseline method. Different experiment settings are explored: (II) applying localization boosting without confidence constraint, (III) performing confidence-aware localization boosting algorithm, (IV) adding global context encoding on Group (II), (V) our full approach.
<table><tr><td rowspan="2">Group</td><td rowspan="2">Localization Boosting</td><td rowspan="2">Uncertainty</td><td rowspan="2">GCE</td><td colspan="3">AP3D</td><td colspan="3">APBEV</td></tr><tr><td>Mod.</td><td>Easy</td><td>Hard</td><td>Mod.</td><td>Easy</td><td>Hard</td></tr><tr><td>I</td><td>-</td><td>-</td><td>1</td><td>25.88</td><td>36.07</td><td>20.99</td><td>33.34</td><td>46.39</td><td>27.54</td></tr><tr><td>Ⅱ</td><td>√</td><td></td><td>1</td><td>26.78</td><td>37.29</td><td>24.11</td><td>34.39</td><td>47.08</td><td>28.28</td></tr><tr><td>Ⅲ</td><td>√</td><td>√</td><td>=</td><td>27.24</td><td>38.32</td><td>24.39</td><td>33.92</td><td>46.77</td><td>27.98</td></tr><tr><td>IV</td><td>√</td><td></td><td></td><td>27.12</td><td>37.38</td><td>24.11</td><td>34.46</td><td>46.70</td><td>28.32</td></tr><tr><td>V</td><td>√</td><td>√</td><td></td><td>27.53</td><td>38.39</td><td>24.44</td><td>34.65</td><td>47.16</td><td>28.47</td></tr></table>
Precision-recall curves are adopted for evaluation, and we report the average precision (AP) results of 3D and Bird’s eye view (BEV) object detection on KITTI validation and test set. For fair comparison to previous literature, the 40 recall positions-based metric $A P | _ { R 4 0 }$ is reported on test set while $\bar { A } P | _ { R 1 1 }$ is reported on validation set. Three levels of difficulty are defined in the benchmark according to the 2D bounding box height, occlusion, and truncation degree, namely, “Easy”, “Mod.”, and “Hard”. The KITTI benchmark ranks all methods based on the $\mathrm { A P _ { 3 D } }$ of “Mod.”. In particular, we focus on the “Car” category as in [42, 27], and we adopt $\mathrm { I o U } = 0 . 7$ as threshold for evaluation.
# 5.2 Waymo setup
We also carry out experiments on large-scale, high quality and diverse dataset, Waymo open dataset [38]. It provides pre-defined 798 training sequences and 202 validation sequences from different scenes, and another 150 test sequences without labels. The dataset contains camera images from five high-resolution pinhole cameras, and we only consider images with their 3D labels from front camera for monocular 3D detection task. We sample every third frame from the training sequences (total 52,386 images) as in CaDDN [33] to form the training set due to its large scale. And validation set contains all the 39,848 images from 202 different scenes.
For evaluation, we adopt the officially released evaluation [39] to calculate the mean average precision (mAP) and the mean average precision weighted by heading (mAPH). Two levels are included according to difficulty rating, which are defined by LiDAR points. 3D labels without any points are ignored, LEVEL_2 is assigned to examples when it contains equal or lesser than 5 points, while the rest of the examples are assigned to LEVEL_1. Additionally, three distances (0 - 30m, 30 - 50m, $5 0 \mathrm { m }$ $- \infty )$ ) to sensor are considered during evaluation.
# 5.3 Implementation details
Our overall framework of PCT can be visualized in Figure 2. In terms of implementation details, we instantiate our algorithm on two widely adopted coordinate-based methods with public released code [28], PatchNet and Pseudo LiDAR. Bearing efficiency in mind, we use a real-time 2D detector RTM3D [23] with DLA-34 [47] as backbone. For the sake of fair comparison, we adopt depth predictor DORN [14] on KITTI dataset as in most depth-assisted literature. Since there is no published depth results on Waymo open dataset, we adopt a most recent monocular depth estimator AdaBins [1] trained on Waymo training set. For the CLB mechanism, we inherit the original localization regression framework in each method. Each $F _ { t }$ shares the same structure. The corresponding confidence is generated following the last convolutional layers of $F _ { t }$ with three linear layers and a Sigmoid function. $T = 3$ and $\lambda _ { s } = 1$ are set for the following experiments except for the ablation study on boosting iterations. For GCE module, we get the corresponding input image features by performing RoIAlign on the features from last convolutional layer of 2D detector. We set the output of RoIAlign as $1 6 \times 1 6$ . As 2D detector use DLA-34 as backbone, the obtained image feature representations have the size of $6 4 \times 1 6 \times 1 6$ and entitle arbitrary sized receptive field theoretically due to the embedded deformable convolution [8]. The structure of feature encoder in global context module is two common $6 4 \times 3 \times 3$ convolutional layers (stride $^ { = 4 }$ ) and a $6 4 \times 1 \times 1$ convolutional layer (stride ${ \mathop : } = 1$ ). Hence, image feature representations are encoded to a vector with 64-dim. The obtained features are then concatenated with the coordinate feature vectors from the final global pooling of box prediction network $G$ . With the lightweight structure, we are able to optimize the network end-to-end on a single Nvidia V100
 Figure 3: The statistic analysis and comparison on different Localization boosting stage when $T = 3$ . The vertical axis of the chart represents the number of samples after normalization. “loc. $1 / 2 / 3 ^ { \circ }$ denotes the $1 / 2 / 3 ^ { t h }$ step of localization errors in $F$ and “loc. $. 4 \ "$ is the final localization errors in $G$ . Note that when the curve is more thin, tall, and closer to zeros, the localization is more accurate.
GPU with 16G memory. The training criterion for network $F$ and $G$ and other training settings follow the corresponding base methods for fair comparison.
# 5.4 Method analysis on KITTI dataset
Main ablative analysis In Table 2, we conduct ablation studies to analyze the effectiveness of our contributions: I) Without any localization regression network $F$ , network $G$ generates 3D box prediction directly. II) This configuration only contains localization boosting part without confidence constraint. III) The entire CLB mechanism is included to progressively regress center localization. IV) GCE module is added to the network based on the localization boosting block without confidence constraint since the feature fusion can be performed on either the localization regression networks $F$ or 3D box prediction network $G$ . V) Our full method with all the components.
As depicted in Table 2, we can observe that the performance continues to grow with the addition of every component. From group II, localization boosting brings a noticeable improvement on all settings especially “Hard” set, which confirms its effectiveness in increasing localization accuracy. Group III shows that balancing training loss by adding confidence leads to better and more stable optimization. Group IV reveals that the proposed GCE module can effectively equip RGB information and global context with 3D coordinate representations. In the end, Group V demonstrates the complementarity of the proposed CLB mechanism and GCE module, leading to an improvement from 25.88/36.07/20.99 to 27.53/38.39/24.44 compared with Group I.
Table 3: Comparison of different boosting iteration settings on KITTI validation split set.
<table><tr><td rowspan="2">Localization Boost (T)</td><td colspan="3">AP3D/APBEV</td></tr><tr><td>Mod.</td><td>Easy</td><td>Hard</td></tr><tr><td>1</td><td>25.88/33.34</td><td>36.07/46.39</td><td>20.99/27.54</td></tr><tr><td>1</td><td>26.31/34.14</td><td>36.40/46.80</td><td>21.07/28.04</td></tr><tr><td>2</td><td>26.69/34.06</td><td>37.17/46.42</td><td>24.04/28.03</td></tr><tr><td>3</td><td>26.78/34.39</td><td>37.29/47.08</td><td>24.11/28.28</td></tr><tr><td>4</td><td>26.77/34.21</td><td>37.12/47.00</td><td>23.48/28.23</td></tr><tr><td>5</td><td>26.64/34.43</td><td>37.24/47.04</td><td>23.89/28.27</td></tr></table>
Table 4: Evaluation of different coordinate feature fusion with GCE on KITTI validation set. Baseline is the Group (II) in Table 2.
<table><tr><td>Method</td><td colspan="3">AP3D</td></tr><tr><td>Baseline</td><td>Mod. 26.78</td><td>Easy 37.29</td><td>Hard 24.11</td></tr><tr><td>F+GCE</td><td>27.08</td><td>37.33</td><td>24.07</td></tr><tr><td>G+GCE</td><td>27.12</td><td>37.38</td><td>24.11</td></tr><tr><td>All + GCE</td><td>27.07</td><td>37.43</td><td>24.18</td></tr></table>
Localization boosting iteration settings We explore the effect of different localization boosting iteration settings in this part. For a fair comparison, we do not perform the confidence constraint on regression loss. As illustrated in Table 3, when boosting iteration $T = 3$ , we achieve the best 3D detection performance. More iterations of boosting do not bring improvements, which might be caused by overfitting with the increasing of network parameters.
To verify the improvement of each step in boosting procedure, we conduct the comparison of localization errors at iteration $T = 3$ on the specific metrics (location “xyz”) of the ground truth. In particular, three stacked localization networks $F$ generate intermediate localization $^ { \bullet \bullet } \mathrm { l o c . } 1 / 2 / 3 ^ { \bullet \bullet }$ and $G$ output the final localization “loc.4”. As shown in Figure 3, we can see that the distributions of $\mathbf { \ddot { x } } ^ { , 5 }$ , “y” and “z” errors tend to distributed to zero with localization boosting iterating. For instance, the red line in left chart is narrow and tall near zero along horizontal axis compared with other lines, which means that the corresponding x coordinate is more accurate than others. This further suggests that localization boosting is useful for object localization. The corresponding BEV visualization will be shown in Supplementary Material.
 Figure 4: Qualitative comparison of ground truth (green), base method PatchNet (blue), and our method (red) on KITTI val set. The first and second rows show RGB and BEV images respectively.
Table 5: Comparison of generalization on KITTI validation set. $^ *$ denotes that the method is reproduced by ourselves.
<table><tr><td rowspan="2">Method</td><td colspan="3">AP3D</td><td colspan="3">APBEV</td></tr><tr><td>Mod.</td><td>Easy</td><td>Hard</td><td>Mod.</td><td>Easy</td><td>Hard</td></tr><tr><td>Pseudo-LiDAR*[42]</td><td>23.04</td><td>32.27</td><td>19.67</td><td>31.06</td><td>42.45</td><td>25.67</td></tr><tr><td>Pseudo-LiDAR+ CLB</td><td>24.14</td><td>34.46</td><td>20.16</td><td>32.41</td><td>44.98</td><td>26.82</td></tr><tr><td>Pseudo-LiDAR + CLB +GCE</td><td>24.43</td><td>34.34</td><td>20.18</td><td>32.50</td><td>45.35</td><td>26.91</td></tr></table>
Impact of global context encoding We also explore where the global context representation fusion operates. We take Group II as the baseline, and perform feature fusion on localization regression network $F$ (row one), 3D estimation network $G$ (row two) or on both (final row). RoI features are encoded into a vector with GCE and then concatenate with the feature vectors from network ( $F$ or $G$ ) global pooling. As shown in Table 4, the operation on $G$ outperforms it on $F$ , which indicates that image representation is more suitable for the overall box prediction rather than only localization as it contains the additional semantic appearance information. Although operation on all networks achieves a lightly higher than it on $G$ on the “Easy” and “Hard” set, introducing parameters is much larger due to operation on stacked localization networks. Hence, we only apply GCE on network $G$ in our approach for a lightweight network and avoid overfitting during training.
Generally applicable to other coordinate-based algorithm In this section, we demonstrate the generalization capability of our algorithm to classic coordinate-based methods Pseudo-LiDAR [42]. As shown in Table 5, each component of our algorithm improves the original methods a lot. Specially, our approach improves Pseudo-LiDAR by 1.43/2.06/0.51 while 1.22/1.99/3.36 gains on PatchNet.
Comparison with state-of-the-arts We build our test detector on the current state-of-the-art coordinate-based method PatchNet, and results are shown in Table 6. Quantitatively, our method achieves the highest performance on “Mod.” set with 22 FPS on NvidiaTesla v100 including 2D detector inference time, which is the main setting for ranking on the benchmark. Specially, large margins, 2.25/5.32/1.14 on 3D detection and 2.17/6.68/0.95 on BEV, are observed over the base method PatchNet with only additional 3.41M parameters. Besides, our methods also outperforms the pixel-based state-of-the-arts methods Liu et al. [26] especially on “Hard” set.
Qualitative comparisons are shown in Figure 4. The ground truth, base method (PatchNet), and our method are colored in green, blue, and red, respectively. For better visualization, the first and second rows show RGB images and BEV images, respectively. Compared with the base method, our algorithm can produce higher-quality 3D bounding boxes in different kinds of scenes.
Table 6: Comparison with SoTA methods on the KITTI test set at $\mathrm { I o U } = 0 . 7$ . Our algorithm achieves new SoTA performance. “Depth” means if the method belongs to depth-assisted methods or not. “Type” indicates the method input pattern, “Pixel” denotes the methods with image as inputs directly while “Coordinate” means the coordinate-based methods with 3D coordinates as inputs.
<table><tr><td rowspan="2">Method</td><td rowspan="2">Depth</td><td rowspan="2">Type</td><td colspan="3">AP3D</td><td colspan="3">APBEV</td></tr><tr><td>Mod.</td><td>Easy</td><td>Hard</td><td>Mod.</td><td>Easy</td><td>Hard</td></tr><tr><td>AM3D [29]</td><td>yes</td><td>Coordinate</td><td>10.74</td><td>16.50</td><td>9.52</td><td>17.32</td><td>25.30</td><td>14.91</td></tr><tr><td>PatchNet [27]</td><td>yes</td><td>Coordinate</td><td>11.12</td><td>15.68</td><td>10.17</td><td>16.86</td><td>22.97</td><td>14.97</td></tr><tr><td>GrooMeD-NMS[20]</td><td>no</td><td>Pixel</td><td>12.32</td><td>18.10</td><td>9.65</td><td>18.27</td><td>26.19</td><td>14.05</td></tr><tr><td>Kinematic3D[3]</td><td>yes</td><td>Pixel</td><td>12.72</td><td>19.07</td><td>9.17</td><td>17.52</td><td>26.69</td><td>13.10</td></tr><tr><td>DDMP-3D[41]</td><td>yes</td><td>Pixel</td><td>12.78</td><td>19.71</td><td>9.80</td><td>17.89</td><td>28.08</td><td>13.44</td></tr><tr><td>Liu et al. [26]</td><td>yes</td><td>Pixel</td><td>13.25</td><td>21.65</td><td>9.91</td><td>17.98</td><td>29.81</td><td>13.08</td></tr><tr><td>PCT</td><td>yes</td><td>Coordinate</td><td>13.37</td><td>21.00</td><td>11.31</td><td>19.03</td><td>29.65</td><td>15.92</td></tr></table>
# 5.5 Results on Waymo Open Dataset
Table 7 shows the results of base method PatchNet [27] and our proposed PCT. It can be observed that our method consistently outperforms the base method on mAP/mAPH of $0 . 5 0 \% / 0 . 5 1 \%$ and $0 . 2 8 \% / 0 . 3 0 \%$ on the LEVEL_1 and LEVEL_2 difficulties respectively under $\mathrm { I o U } = 0 . 7$ . Again, our method is efficient, e.g, it takes 5 days to complete training on large scale Waymo dataset with a 8-GPU node. More qualitative results can be seen at Supplementary Material.
Table 7: 3D performance on Waymo validation set. We demonstrate results of base method PatchNet [27] and corresponding PCT at $\mathrm { I o U } = 0 . 7$ and $\mathrm { I 0 U } = 0 . 5$ . Our proposed PCT achieves consistent improvements on all settings.
<table><tr><td rowspan="2">Difficulty</td><td rowspan="2">Threshold</td><td rowspan="2">Method</td><td colspan="4">3D mAP/3D mAPH</td></tr><tr><td>Overall</td><td>0-30m</td><td>30-50m</td><td>50-8</td></tr><tr><td rowspan="3">LEVEL_1</td><td>IoU=0.7</td><td>PatchNet PCT</td><td>0.39/0.37 0.89 / 0.88</td><td>1.67 / 1.63 3.18 / 3.15</td><td>0.13/0.12</td><td>0.03/0.03 0.07 /0.07</td></tr><tr><td rowspan="2">IoU=0.5</td><td>PatchNet</td><td>2.92/2.74</td><td>10.03/9.75</td><td>0.27 / 0.27 1.09/ 0.96</td><td>0.23/0.18</td></tr><tr><td>PCT</td><td>4.20 /4.15</td><td>14.70 / 14.54</td><td>1.78 / 1.75</td><td>0.39 / 0.39</td></tr><tr><td rowspan="3">LEVEL_2</td><td>IoU=0.7</td><td>PatchNet</td><td>0.38/0.36</td><td>1.67 / 1.63</td><td>0.13/0.11</td><td>0.03/0.03</td></tr><tr><td rowspan="2">IoU=0.5</td><td>PCT PatchNet</td><td>0.66 / 0.66</td><td>3.18 /3.15</td><td>0.27 /0.26</td><td>0.07 /0.07</td></tr><tr><td></td><td>2.42/2.28</td><td>10.01/9.73</td><td>1.07 /0.94</td><td>0.22/0.16</td></tr><tr><td></td><td></td><td>PCT</td><td>4.03 /3.99</td><td>14.67 / 14.51</td><td>1.74 / 1.71</td><td>0.36 / 0.35</td></tr></table>
# 6 Conclusions
In this paper, we have introduced a novel approach PCT to address the inaccurate localization problem for monocular 3D object detection. This is achieved by iteratively transforming the coordinate representation with a confidence-aware booting mechanism. Meanwhile, global context is introduced to compensate for the missing of semantic image representation in coordinated-based methods. Through extensive experiments, we have shown that our proposed PCT substantially improve the performance of the coordinate-based model by a large margin, and achieve state-of-the-art monocular 3D detection performance on KITTI test set. Moreover, we also show consistent improvements compared to the strong baseline on the large-scale Waymo Open dataset.
There are several limitations that could indicate the possible directions for future work. First, the performance of off-the-shelf 2D detector directly influences the accuracy of coordinate-based methods, hence how to effectively design the 3D box estimation algorithm to fit with existing 2D detectors is important. Second, we only concentrate on the lightweight coordinate-based methods. It requires further exploration to extend our approach to pixel-based methods. Finally, our proposed global context encoding is a simple module. Despite working well, a more tailored feature fusion strategy between coordinate representation and RGB image representation is worth exploring.
Potential impacts. Our method focuses on the monocular 3D detection which can be applied in autonomous driving field. One potential social problem of our work is that it may aggravate the employment crisis of human servants and drivers, which replaces human with autonomous robots and intelligent systems.
# Acknowledgments
This work was supported by Shanghai Municipal Science and Technology Major Projects (No.2021SHZDZX0103 and No.2018SHZDZX01).
# References
[1] Shariq Farooq Bhat, Ibraheem Alhashim, and Peter Wonka. Adabins: Depth estimation using adaptive bins. In CVPR, 2021. [2] Garrick Brazil and Xiaoming Liu. M3d-rpn: Monocular 3d region proposal network for object detection. In ICCV, 2019. [3] Garrick Brazil, Gerard Pons-Moll, Xiaoming Liu, and Bernt Schiele. Kinematic 3d object detection in monocular video. arXiv preprint, 2020. [4] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, 2020. [5] Xiaozhi Chen, Kaustav Kundu, Yukun Zhu, Andrew G Berneshawi, Huimin Ma, Sanja Fidler, and Raquel Urtasun. 3d object proposals for accurate object class detection. In NeurIPS, 2015. [6] Yongjian Chen, Lei Tai, Kai Sun, and Mingyang Li. Monopair: Monocular 3d object detection using pairwise spatial relationships. In CVPR, 2020. [7] Corinna Cortes, Mehryar Mohri, and Umar Syed. Deep boosting. In ICML, 2014. [8] Jifeng Dai, Haozhi Qi, Yuwen Xiong, Yi Li, Guodong Zhang, Han Hu, and Yichen Wei. Deformable convolutional networks. In ICCV, 2017. [9] Mingyu Ding, Yuqi Huo, Hongwei Yi, Zhe Wang, Jianping Shi, Zhiwu Lu, and Ping Luo. Learning depth-guided convolutions for monocular 3d object detection. In CVPR, 2019. [10] Liang Du, Xiaoqing Ye, Xiao Tan, Jianfeng Feng, Zhenbo Xu, Errui Ding, and Shilei Wen. Associate-3ddet: Perceptual-to-conceptual association for 3d point cloud object detection. In CVPR, 2020. [11] Liang Du, Xiaoqing Ye, Xiao Tan, Edward Johns, Bo Chen, Errui Ding, Xiangyang Xue, and Jianfeng Feng. Ago-net: Association-guided 3d point cloud object detection network. TPAMI, 2021. [12] Jerome H Friedman. Greedy function approximation: a gradient boosting machine. Annals of statistics, 2001. [13] Jerome H Friedman. Stochastic gradient boosting. Computational statistics & data analysis, 2002. [14] Huan Fu, Mingming Gong, Chaohui Wang, Kayhan Batmanghelich, and Dacheng Tao. Deep ordinal regression network for monocular depth estimation. In CVPR, 2018. [15] Andreas Geiger, Philip Lenz, Christoph Stiller, and Raquel Urtasun. http://www.cvlibs. net/datasets/kitti/eval_object.php?obj_benchmark $\cdot ^ { = }$ 3d. 2013. [16] Andreas Geiger, Philip Lenz, Christoph Stiller, and Raquel Urtasun. Vision meets robotics: The kitti dataset. IJRR, 2013. [17] Andreas Geiger, Philip Lenz, and Raquel Urtasun. Are we ready for autonomous driving? the kitti vision benchmark suite. In CVPR, 2012. [18] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In ICCV, 2017. [19] Nikolaos Karianakis, Thomas J Fuchs, and Stefano Soatto. Boosting convolutional features for robust object proposals. arXiv preprint, 2015. [20] Abhinav Kumar, Garrick Brazil, and Xiaoming Liu. Groomed-nms: Grouped mathematically differentiable nms for monocular 3d object detection. In CVPR, pages 8973–8983, 2021. [21] Haoxiang Li, Zhe Lin, Jonathan Brandt, Xiaohui Shen, and Gang Hua. Efficient boosted exemplar-based face detection. In CVPR, 2014. [22] Haoxiang Li, Zhe Lin, Xiaohui Shen, Jonathan Brandt, and Gang Hua. A convolutional neural network cascade for face detection. In CVPR, 2015. [23] Peixuan Li, Huaici Zhao, Pengfei Liu, and Feidao Cao. Rtm3d: Real-time monocular 3d detection from object keypoints for autonomous driving. In ECCV, 2020. [24] Xuchun Li, Lei Wang, and Eric Sung. A study of adaboost with svm based weak learners. In IJCNN, 2005. [25] Lijie Liu, Jiwen Lu, Chunjing Xu, Qi Tian, and Jie Zhou. Deep fitting degree scoring network for monocular 3d object detection. In CVPR, 2019. [26] Y. Liu, Y. Yuan, and M. Liu. Ground-aware monocular 3d object detection for autonomous driving. IEEE Robotics and Automation Letters, 2021. [27] Xinzhu Ma, Shinan Liu, Zhiyi Xia, Hongwen Zhang, Xingyu Zeng, and Wanli Ouyang. Rethinking pseudo-lidar representation. In ECCV, 2020. [28] Xinzhu Ma, Shinan Liu, Zhiyi Xia, Hongwen Zhang, Xingyu Zeng, and Wanli Ouyang. https: //github.com/xinzhuma/patchnet. 2020. [29] Xinzhu Ma, Zhihui Wang, Haojie Li, Pengbo Zhang, Wanli Ouyang, and Xin Fan. Accurate monocular 3d object detection via color-embedded 3d reconstruction for autonomous driving. In ICCV, 2019. [30] Arsalan Mousavian, Dragomir Anguelov, John Flynn, and Jana Kosecka. 3d bounding box estimation using deep learning and geometry. In CVPR, 2017. [31] Erli Ouyang, Li Zhang, Mohan Chen, Anurag Arnab, and Yanwei Fu. Dynamic depth fusion and transformation for monocular 3d object detection. In ACCV, 2020. [32] Charles R Qi, Wei Liu, Chenxia Wu, Hao Su, and Leonidas J Guibas. Frustum pointnets for 3d object detection from rgb-d data. In CVPR, 2018. [33] Cody Reading, Ali Harakeh, Julia Chae, and Steven L. Waslander. Categorical depth distributionnetwork for monocular 3d object detection. In CVPR, 2021. [34] Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In NeurIPS, 2015. [35] Shaoshuai Shi, Xiaogang Wang, and Hongsheng Li. Pointrcnn: 3d object proposal generation and detection from point cloud. In CVPR, 2019. [36] Xuepeng Shi, Zhixiang Chen, and Tae-Kyun Kim. Distance-normalized unified representation for monocular 3d object detection. In ECCV, 2020. [37] Jeany Son, Ilchae Jung, Kayoung Park, and Bohyung Han. Tracking-by-segmentation with online gradient boosting decision tree. In ICCV, 2015. [38] Pei Sun, Henrik Kretzschmar, Xerxes Dotiwalla, Aurelien Chouard, Vijaysai Patnaik, Paul Tsui, James Guo, Yin Zhou, Yuning Chai, Benjamin Caine, et al. Scalability in perception for autonomous driving: Waymo open dataset. In CVPR, 2020. [39] Pei Sun, Henrik Kretzschmar, Xerxes Dotiwalla, Aurelien Chouard, Vijaysai Patnaik, Paul Tsui, James Guo, Yin Zhou, Yuning Chai, Benjamin Caine, et al. https://github.com/ waymo-research/waymo-open-dataset. 2020. [40] Zhi Tian, Chunhua Shen, Hao Chen, and Tong He. Fcos: Fully convolutional one-stage object detection. In ICCV, 2019. [41] Li Wang, Liang Du, Xiaoqing Ye, Yanwei Fu, Guodong Guo, Xiangyang Xue, Jianfeng Feng, and Li Zhang. Depth-conditioned dynamic message propagation for monocular 3d object detection. In CVPR, 2021. [42] Yan Wang, Wei-Lun Chao, Divyansh Garg, Bharath Hariharan, Mark Campbell, and Kilian Q Weinberger. Pseudo-lidar from visual depth estimation: Bridging the gap in 3d object detection for autonomous driving. In CVPR, 2019. [43] Xinshuo Weng and Kris Kitani. Monocular 3d object detection with pseudo-lidar point cloud. In ICCV workshops, 2019. [44] Yan Yan, Yuxing Mao, and Bo Li. Second: Sparsely embedded convolutional detection. Sensors, 2018. [45] Xiaoqing Ye, Liang Du, Yifeng Shi, Yingying Li, Xiao Tan, Jianfeng Feng, Errui Ding, and Shilei Wen. Monocular 3d object detection via feature domain adaptation. In ECCV, 2020. [46] Yurong You, Yan Wang, Wei-Lun Chao, Divyansh Garg, Geoff Pleiss, Bharath Hariharan, Mark Campbell, and Kilian Q Weinberger. Pseudo-lidar++: Accurate depth for 3d object detection in autonomous driving. arXiv preprint, 2019. [47] Fisher Yu, Dequan Wang, Evan Shelhamer, and Trevor Darrell. Deep layer aggregation. In CVPR, 2018. [48] Yunpeng Zhang, Jiwen Lu, and Jie Zhou. Objects are different: Flexible monocular 3d object detection. In CVPR, 2021. [49] Xingyi Zhou, Dequan Wang, and Philipp Krähenbühl. Objects as points. arXiv preprint, 2019. [50] Yin Zhou and Oncel Tuzel. Voxelnet: End-to-end learning for point cloud based 3d object detection. In CVPR, 2018. [51] Yi Zhu, Zhongyue Zhang, Chongruo Wu, Zhi Zhang, Tong He, Hang Zhang, R. Manmatha, Mu Li, and Alexander Smola. Improving semantic segmentation via self-training. arXiv preprint arXiv:2004.14960, 2020.
# 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] We have described exactly in abstract section and Sec. 1. (b) Did you describe the limitations of your work? [Yes] See Sec. 6. (c) Did you discuss any potential negative societal impacts of your work? [Yes] See Sec. 6. (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] We demonstrate the codes in Github website. The dataset is public and URL [15, 39] is also attached in Sec. 5. (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Sec. 5.3. (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We report experiments results at the fixed seed.
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] The type of resources can be seen at Sec. 5.3. And each GPU can run two experiments, thus, our included experiments (total number of 15) in paper require about 8 Nvidia Tesla v100 GPUs (16G).
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 Sec. 5 (b) Did you mention the license of the assets? [Yes] We conduct experiments on KITTI (license: CC BY-NC-SA 3.0) and Waymo (license: Custom (non-commercial)). (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] (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? [No] We conduct experiments only on public 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]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416# RESERVOIR TRANSFORMERS
Anonymous authors Paper under double-blind review
# ABSTRACT
We demonstrate that transformers obtain impressive performance even when some of the layers are randomly initialized and never updated. Inspired by old and wellestablished ideas in machine learning, we explore a variety of non-linear “reservoir” layers interspersed with regular transformer layers, and show improvements in wall-clock compute time until convergence, as well as overall performance, on various machine translation and (masked) language modelling tasks.
# 1 INTRODUCTION
Transformers (Vaswani et al., 2017) have dominated natural language processing (NLP) in recent years, from large scale machine translation (Ott et al., 2018) to pre-trained (masked) language modeling (Devlin et al., 2018; Radford et al., 2018), and are becoming more popular in other fields as well, from reinforcement learning (Vinyals et al., 2019) to speech recognition (Baevski et al., 2019) and computer vision (Carion et al., 2020). Their success is enabled in part by ever increasing computational demands, which has naturally led to an increased interest in improving their efficiency. Scalability gains in transformers could facilitate bigger, deeper networks with longer contexts (Kitaev et al., 2020; Wang et al., 2020; Beltagy et al., 2020; Kaplan et al., 2020; Tay et al., 2020b). Conversely, improved efficiency could reduce environmental costs (Strubell et al., 2019) and hopefully help democratize the technology.
In this work, we explore a simple question: if some layers of the transformer are kept frozen—i.e., never updated after random initialization—can we match the performance of fully learned transformers, while being more efficient? Surprisingly, the answer is resoundingly yes; and what is more, we find that freezing layers may actually improve performance.
Beyond desirable efficiency gains, random layers are interesting for several additional reasons. Fixed randomly initialized networks (Gallicchio & Scardapane, 2020) converge to Gaussian processes in the limit of infinite width (Daniely et al., 2016), have intriguing interpretations in metric learning (Rosenfeld & Tsotsos, 2019; Giryes et al., 2016), and have been shown to provide excellent “priors” either for subsequent learning (Ulyanov et al., 2018) or pruning (Frankle & Carbin, 2018). Fixed layers allow for efficient low-cost hardware implementations (Schrauwen et al., 2007) and can be characterized using only a random number generator and its seed, which might have repercussions in distributed training and enables highly efficient deployment to edge devices. The strong performance of networks with fixed layers also sheds new light on the inner workings of BERT (Devlin et al., 2018), and layer-wise interpretations of such models (Rogers et al., 2020; Tenney et al., 2019). It appears that “not all layers are created equal” (Zhang et al., 2019) is true to such an extent that some layers can simply remain random and fixed.
These ideas have a long history in machine learning. By Cover’s theorem (Cover, 1965), any highdimensional non-linear transformation is more likely to be linearly separable than its lower-or-equaldimensional input space. By Johnson-Lindenstrauss (Johnson & Lindenstrauss, 1984), random projections distort Euclidean distances very little under mild assumptions, which is useful e.g. for dimensionality reduction and random indexing (Sahlgren, 2005). Fixed random layers in neural networks pre-date deep learning by far (Gamba et al., 1961; Baum, 1988). Indeed, random kernel methods have been an impactful idea in machine learning (Rahimi & Recht, 2008; 2009).
One way to think of such layers is as “reservoirs” (Lukosevi ˇ cius & Jaeger, 2009), where a highly ˇ non-linear high-dimensional black box representation is provided to a lightweight “readout” network, as in echo state networks (Jaeger, 2003) and liquid state machines (Maass et al., 2002). The benefit of such an approach is that the reservoir has fixed parameters and is computationally efficient, as it can be pre-computed and does not (necessarily) require backpropagation.
In NLP, Wieting & Kiela (2019) showed that random sentence encoders present a strong baseline for text classification, with subsequent work showing applications in a variety of NLP tasks (Enguehard et al., 2019; Garg et al., 2020; Pilault et al., 2020). To our knowledge, this work is the first to examine this phenomenon in transformers, and the first to recursively alternate reservoirs with subsequent transformer layers acting as readout functions. We introduce “reservoir transformers”, wherein fixed random reservoir layers are interspersed with regular updateable transformer layers. The goal of this work is not necessarily to set a new state of the art, but to put our understanding of transformer models on a more solid footing by providing empirical evidence of their capabilities even when some of their parameters are fixed. Our contributions are as follows:
• We introduce a new area under the convergence curve metric for measuring performanceefficiency trade-offs, and show that replacing regular transformer layers with reservoir layers leads to better results on that metric. • We show that the addition of reservoir layers in fact leads to improved test set generalization on a variety of tasks in a variety of settings. We show that pre-trained masked language modelling architectures like BERT and RoBERTa (Liu et al., 2019) can benefit from having some of their layers frozen, both during pre-training as well as when fine-tuning on downstream tasks. • In addition, we experiment with different types of reservoir layers, including convolutional and recurrent neural network-based ones. We also show empirical evidence that the backward pass can be entirely skipped by approximating top-layer gradients using an approach we call backskipping, with a relatively small sacrifice in performance.
# 2 APPROACH
This paper is based on a very simple idea. Neural networks are trained via backpropagation, which involves consecutive steps of matrix addition and multiplication, i.e.,
$$\theta _ { t + 1 } \theta _ { t } - \eta \frac { \partial J } { \partial \theta _ { t } } ; \frac { \partial J } { \partial \theta _ { t } } = \frac { \partial J } { \partial L _ { n } } \frac { \partial L _ { n } } { \partial L _ { n - 1 } } \cdot \cdot \cdot \frac { \partial L _ { 1 } } { \partial L _ { 0 } } \frac { \partial L _ { 0 } } { \partial x }$$
for some objective $J$ , parameterization $\theta$ and learning rate $\eta$ , with the gradient computed via the chain rule, where $L _ { i }$ is the $i$ -th layer of the neural network and $x$ is the input. Let $L \ =$ Transformer $( X )$ be a single layer in a Transformer network (Vaswani et al., 2017), i.e.,
$$\begin{array} { r } { H = \mathbf { M } \mathbf { u } ] \mathrm { t i } \mathbf { H e a d } \mathbf { S e l f A t t n } ( \mathbf { L a y e r N o r m } ( X ) ) + X } \\ { L = \mathbf { F F N } ( \mathbf { L a y e r N o r m } ( H ) ) + H } \end{array}$$
Now, during every “backward pass”, we compute the Jacobian for parameters $\theta ^ { L }$ at layer $L$ , which are used to update the parameters of $L$ , $\theta _ { t } ^ { L }$ , as well as to compute the next layer’s Jacobian, thus back-propagating the gradients. In this work however, for some of the layers, we still backpropagate through them to compute gradients for earlier layers, but we never update their parameters. As a result, these layers stay fixed at their random initialization, saving computational resources.
# 2.1 BACKGROUND
Naturally, never updating some of the parameters is computationally more efficient, as some matrix addition operations can be skipped in the backward pass, but why is this not detrimental to the performance of the network?
In the early days of neural networks, the bottom layers were often kept fixed as “associators” (Block, 1962), or what Minsky & Papert (2017) called the Gamba perceptron (Gamba et al., 1961; Borsellino & Gamba, 1961). Fixed random networks (Baum, 1988; Schmidt et al., 1992; Pao et al., 1994) have been explored from many angles, including as “random kitchen sink” kernel machines (Rahimi & Recht, 2008; 2009), “extreme learning machines” (Huang et al., 2006) and reservoir computing (Jaeger, 2003; Maass et al., 2002; Lukosevi ˇ cius & Jaeger, 2009). In reservoir computing, in- ˇ put data are represented through fixed random high-dimensional non-linear representations, called “reservoirs”, which are followed by a regular (often but not necessarily linear) “readout” network to make the final classification decision.
The theoretical justification for these approaches lies in two well-known results in machine learning: Cover’s theorem (Cover, 1965) on the separability of patterns states that high-dimensional non-linear transformations are more likely to be linearly separable; and the Johnson-Lindenstrauss lemma (Johnson & Lindenstrauss, 1984) shows that random projections distort Euclidean distances very little under mild assumptions.
Practically, random layers can be seen as a cheap way to increase network depth. There are interesting advantages to this approach. Fixed layers are known to have particularly low-cost hardware requirements and can be easily implemented on high-bandwidth FPGAs with low power consumption (Hadaeghi et al., 2017; Tanaka et al., 2019), or on optical devices (Hicke et al., 2013). This might yield interesting possibilities for training in a distributed fashion across multiple devices, as well as for neurmorphic hardware (Neftci et al., 2017). This approach also facilitates lower-latency deployment of neural networks to edge devices, since weights can be shared simply by sending the seed number, assuming the random number generator is known on both ends.
# 2.2 RESERVOIR TRANSFORMERS
This work explores inserting random non-linear transformations, or what we call reservoir layers, into transformer networks. Specifically, we experiment with a variety of reservoir layers:
• Transformer Reservoir: The standard transformer layer as described above, but with all parameters fixed after initialization, including the self-attention module. • FFN Reservoir: A transformer-style fixed feed-forward layer without any self-attention, i.e., FFN(LayerNorm(Previous layer)) $^ +$ Previous layer. • BiGRU Reservoir: A fixed bidirectional Gated Recurrent Unit (Cho et al., 2014) layer, which is closer in spirit to previous work on reservoir computing, most of which builds on recurrent neural network architectures. CNN Reservoir: A fixed Convolutional Neural Network (LeCun et al., 1998) layer, specifically light dynamical convolution layers (Wu et al., 2019), which are known to be competitive with transformers in sequence-to-sequence tasks.
We find that all these approaches work well, to a certain extent. For clarity, we focus primarily on the first two reservoir layers, but include a broader comparison in Appendix A.
In each case, contrary to traditional reservoir computing, our reservoir layers are interspersed throughout a regular transformer network, or what we call a reservoir transformer. A good justification for this approach is that while random projections are not learned and might introduce noise, subsequent normal transformer “readout” layers might allow us to recover from any adverse effects of randomness. For example, previous work has shown that ResNets, with all of their parameters fixed except for the scale and shift parameters of batch normalization, can still achieve high performance, simply by scaling and shifting random features (Frankle et al., 2020). Adding noise to the parameters of neural networks is also known to help convergence and generalization (Jim et al., 1995; 1996; Gulcehre et al., 2016; Noh et al., 2017).
# 3 EVALUATION
We evaluate the proposed approach on a variety of well-known tasks in natural language processing, namely: machine translation, language modelling and masked language model pre-training.
In this work, we are not necessarily interested in obtaining the state of the art on any task or even in improving overall task performance via this method. The main objective is to examine efficiency, i.e. the relationship between compute time and task performance. This is closely related to efforts in Green AI, which are concerned with the trade-offs between compute, data, and performance (Schwartz et al., 2019). We propose a new metric for our purposes, the area under the convergence curve (AUCC): similarly to how the area under the receiver operating characteristic (Bradley, 1997, AUC-ROC) measures a classifier’s performance independent of the classification threshold, AUCC measures a model’s performance independent of the specific compute budget. Specifically, AUCC is computed as follows:
 Figure 1: Validation BLEU AUCC and test BLEU for IWSLT (high is good). Comparison of regular transformer and reservoir transformer with FFN or Transformer reservoir layers added.
$$\int _ { t = 0 } ^ { \hat { T } } \sum _ { x , y \in \mathcal { D } } g _ { t } ( f ( x ) , y )$$
where $f$ is the network and $g$ is the evaluation metric, measured until convergence time $\hat { T }$ , which is the maximum convergence time of all models included in the comparison. Note that time here is wall-clock time, not iterations. By convergence, we mean that validation performance has stopped improving, and hence the convergence curve whose area we measure plots the desired metric over time. Runs are averaged over multiple seeds and reported with standard deviation. We normalize raw AUCC scores by their maximum score to ensure a more easily interpretable $[ 0 - 1 ]$ range.
One potential downside of this approach is that the AUCC metric could lead to higher scores for a model that converges quickly but to ultimately worse performance, if measured in a small window. We account for this by making sure that $\hat { T }$ is set sufficiently high. We include the raw validation curves in the appendix and also report test set generalization in each experiment.
# 3.1 EXPERIMENTAL SETTINGS AND IMPLEMENTATION DETAILS
We evaluate on IWSLT de-en (Cettolo et al., 2015) and WMT en-de (Bojar et al., 2014) for machine translation; enwiki8 (LLC, 2009) for language modelling; and experiment with RoBERTa (Liu et al., 2019) in our pretraining experiments. For IWSLT, we follow the pre-processing steps in Edunov et al. (2018). The train/val/test split is $\_$ sentences. For WMT, we follow the pre-processing steps in Ott et al. (2018). The train/val/test split is $4 . 5 \mathrm { M } / 1 6 . 5 \mathrm { k } / 3 \mathrm { k }$ sentences. For enwiki8, we follow the pre-processing steps in Dai et al. (2019). The train/val/test split is 1M/54k/56k sentences. For RoBERTa pretraining, we follow the pre-processing steps in Liu et al. (2019).
We use 8 Volta V100 GPUs for WMT and enwik8, 32 V100 GPUs for RoBERTa and a single V100 for IWSLT. The hyperparameters for IWSLT14 and WMT16 were set to the best-performing values from Ott et al. (2018) and Kasai et al. (2020) respectively. The enwik8 experiment settings followed Bachlechner et al. (2020) and the RoBERTa experiments followed Liu et al. (2019). All experiments were conducted using fairseq (Ott et al., 2019). Our code and experimental settings will be made open source at [ANONYMIZED-GITHUB-URL].
Table 1: Wall-clock time (averaged over multiple runs) saved for IWSLT for different model types and encoder depths. Max BLEU is for validation. Number of layers is for encoder, decoder depth is kept fixed at 2. Ratio is computed compared to comparable number of layers in the normal case.
<table><tr><td>Model</td><td>#Layers</td><td>Frozen</td><td>Max BLEU</td><td>Train time until max (in hours)</td><td>Ratio</td><td># Params Trainable (Total)</td><td>Train Time each epoch (in seconds)</td></tr><tr><td rowspan="4">Transformer</td><td>6</td><td>0</td><td>34.52 ± 0.07</td><td>2.548 ± 0.06</td><td>1</td><td>26.8M</td><td>122.73 ± 1.16</td></tr><tr><td>8</td><td>0</td><td>34.59 ± 0.11</td><td>2.557 ± 0.05</td><td>1</td><td>31.1M</td><td>142.28 ± 1.87</td></tr><tr><td>10</td><td>0</td><td>34.56 ± 0.05</td><td>3.173 ± 0.04</td><td>1</td><td>35.3M</td><td>161.66 ± 1.54</td></tr><tr><td>12</td><td>0</td><td>34.29 ± 0.12</td><td>3.521 ± 0.09</td><td>1</td><td>39.5M</td><td>172.45 ± 1.98</td></tr><tr><td rowspan="4">TReservoir</td><td>6</td><td>2</td><td>34.37 ± 0.12</td><td>2.422 ± 0.03</td><td>0.95</td><td>22.6M (26.8M)</td><td>120.59 ± 1.32</td></tr><tr><td>8</td><td>2</td><td>34.80 ± 0.07</td><td>2.450 ± 0.06</td><td>0.96</td><td>26.8M (31.1M)</td><td>134.49 ± 1.76</td></tr><tr><td>10</td><td>2</td><td>34.70 ± 0.03</td><td>2.831 ± 0.05</td><td>0.89</td><td>31.1M (35.3M)</td><td>144.42 ± 1.98</td></tr><tr><td>12</td><td>2</td><td>34.78 ± 0.04</td><td>3.476 ± 0.04</td><td>0.98</td><td>35.3M (39.5M)</td><td>159.43 ± 1.67</td></tr><tr><td rowspan="4">FFN Reservoir</td><td>6</td><td>2</td><td>34.43 ± 0.15</td><td>2.120 ± 0.04</td><td>0.83</td><td>22.6M (25.8M)</td><td>107.71 ± 1.73</td></tr><tr><td>8</td><td>2</td><td>34.56 ± 0.16</td><td>2.203 ± 0.06</td><td>0.86</td><td>26.8M (29.1M)</td><td>120.07 ± 1.65</td></tr><tr><td>10</td><td>2</td><td>34.66 ± 0.02</td><td>2.493 ± 0.05</td><td>0.79</td><td>31.1M (33.3M)</td><td>130.11 ± 1.43</td></tr><tr><td>12</td><td>2</td><td>34.76 ± 0.03</td><td>3.241 ± 0.04</td><td>0.92</td><td>35.3M (37.5M)</td><td>156.32 ± 1.87</td></tr><tr><td rowspan="4">LayerDrop</td><td>6</td><td>2</td><td>34.59 ± 0.15</td><td>2.364 ± 0.08</td><td>0.92</td><td>22.6M (26.8M)</td><td>119.30 ± 1.36</td></tr><tr><td>8</td><td>2</td><td>34.58 ± 0.16</td><td>2.554 ± 0.05</td><td>0.99</td><td>26.8M (31.1M)</td><td>138.62 ± 1.44</td></tr><tr><td>10</td><td>2</td><td>34.57 ± 0.07</td><td>3.404 ± 0.06</td><td>1.07</td><td>31.1M (35.3M)</td><td>140.88 ± 1.62</td></tr><tr><td>12</td><td>2</td><td>33.65 ± 0.24</td><td>3.251 ± 0.04</td><td>0.92</td><td>35.3M (39.5M)</td><td>160.85 ± 1.49</td></tr></table>
All the experiments in this paper were run with 3 random seeds and the mean and standard deviation are reported. For the relatively small IWSLT, the $\hat { T }$ value in the AUCC metric was set to 4 hours. For WMT, which is larger, we set it to 20 hours. For enwiki8, it was 30 hours; and for the RoBERTa pre-training experiments, it was set to 60 hours.
The projection weights in random layers were initialized using orthogonal initialization (Saxe et al., 2013), which makes sense since random orthogonal projections should be most informationpreserving, and which was found to work well empirically for initializing fixed random representations in previous work (Wieting & Kiela, 2019). Biases and layer norm parameters were initialized using their respective PyTorch defaults (based on Xavier init; Glorot & Bengio, 2010).
We intersperse reservoir layers in alternating fashion starting from the middle. Specifically, we alternate one reservoir layer with one transformer layer, and place the alternating block in the middle. For example: a 7-layer encoder LLLLLLL in which we replace three layers with reservoirs becomes LRLRLRL, and with two becomes LLRLRLL. See Appendix C for a study comparing this strategy to alternative approaches (e.g., freezing in the bottom, middle or top).
# 4 EXPERIMENTS
In what follows, we first show our main result: reservoir transformers often have better AUCC metrics, less training time per epoch, less convergence time until the best validation performance is achieved, and even improved test set generalization metrics, on a variety of tasks. As a strong baseline method, we compare to LayerDrop (Fan et al., 2019). LayerDrop can also be seen as a method that dynamically bypasses parts of the computation during Transformer training in an attempt to improve efficiency, and is a suitable comparison to examine our methods.. We also examine whether we can minimize the expectation over the gradients of upper layers in the transformer network such that we do not have to pass the true gradients through the reservoir for further efficiency.
# 4.1 MACHINE TRANSLATION
Machine translation (MT) is one of the core tasks of NLP. We demonstrate on two well-known MT datasets, IWSLT’14 German-English and WMT’16 English-German, that reservoir transformers obtain a better AUCC. For the raw validation plots over time that were used to calculate the AUCC, please refer to Appendix F.
Following Kasai et al. (2020), the architecture of the network is an N-layer reservoir transformer encoder, followed by a regular shallow one- or two-layer decoder. This design choice has been shown to lead to very good speed and efficiency trade-offs, and serves as a good baseline for our experiments. Moreover, shallow decoders make it easier to decide where to place reservoir layers (in the encoder) and makes it more straightforward to identify where performance gains come from.
 Figure 2: Validation BLEU AUCC and test BLEU for WMT (high is good). Comparison of regular transformer and reservoir transformer with FFN or Transformer reservoir layers added.
 Figure 3: Validation BPC AUCC and test BPC on the enwik8 language modelling task (low is good). Comparison of regular and reservoir transformers for varying depths.
Figure 1 shows the results for IWSLT. On the y-axis we show validation AUCC for the BLEU metric; on the $\mathbf { X } ^ { } -$ -axis we show the number of updatable layers in the encoder. The performance of a regular transformer encoder with 6 layers and a reservoir transformer encoder with 6 layers plus N additional reservoir layers are plotted for the same $\mathbf { X }$ -axis value to show the total number of updated layers. Plots for the total number of layers (updatable plus not-updatable, so essentially shifted versions) are shown in Appendix E. Table 1 shows the time it took to achieve the maximum validation BLEU score and how that relates to the regular transformer, demonstrating that reservoir transformers consistently converge faster in terms of wall-clock time, up to $22 \%$ as much with the same number of updateable layers. We save as much as $27 \%$ time until convergence a 24 layer model on WMT, as shown in Table 3. One other noticeable point is that we can see that the T Reservoir achieves similar performance to LayerDrop on IWSLT and WMT in terms of wall-clock per epoch and wall-clock time to the best performance. However, on both tasks, FFN Reservoir performs much better than LayerDrop in terms of efficiency per epoch and achieves better/similar performance in less time in each case. As a point of reference, a half hour gain on IWSLT translates to a gain of several days in the training of bigger transformer models like GPT-3 (Brown et al., 2020).
We observe that reservoir transformers consistently perform better than, or are competitive to, regular transformers, both in terms of validation BLEU AUCC as well as test time BLEU, for all examined encoder depths.
 Figure 4: Downstream RoBERTa performance on SST-2 (left) and MultiNLI-matched (right).
Figure 2 shows a similar trend for WMT. WMT is much larger and requires a much deeper encoder, as illustrated by the fact that a certain minimum depth is required for reservoir transformers to achieve a comparable validation AUCC. At test time, reservoir transformers outperform regular transformers for almost all encoder depths. The FFN reservoir transformer seems to work best in both cases, which is surprising because it does not have any self-attention component at all. This finding shows that self-attention, or the mechanism to summarize context information, should be learned if present. Once the context features have been gathered, a random projection via a fixed FFN module appears to be beneficial, at least for MT.
# 4.2 LANGUAGE MODELLING
To examine whether the same findings hold for other tasks, we evaluate on the enwiki8 (LLC, 2009) language modelling task. We examine the BPC (bits per character) rate for a variety of network depths (since the task is language modelling, these layers are in the decoder). The results show that we obtain consistently better BPC for lower depths, except for the 64-layer regular transformer, which appears to be particularly optimal for this task. We observe similar trends during test time.
# 4.3 MASKED LANGUAGE MODEL PRETRAINING
We train RoBERTa (Liu et al., 2019) models from scratch at a variety of depths, both in the normal and reservoir setting. We find that these networks show minor differences in their best perplexity and similar AUCC perplexity (see Appendix D). We then examine the performance of these models when fine-tuned on downstream tasks, specifically the well known SST-2 (Socher et al., 2013) and MultiNLI1 (Williams et al., 2017) tasks. When fine-tuning the reservoir models, we keep the reservoir layers fixed (including them in fine-tuning did not work very well, see Appendix D).
Figure 4 shows the results of fine-tuning. We observe that the reservoir transformer outperforms normal RoBERTa at all depths in both tasks. At lower depth, the improvements are substantial. As a sanity check, we also experiment with freezing some of the layers in normal RoBERTa during fine-tuning (Transformer frozen finetuned) and show that this helps a little but is still outperformed by the reservoir transformer.
These findings suggest that you can train a RoBERTa model without updating all of the layers, achieve similar perplexity at a similar computational cost, but with better downstream performance. The fact that some layers can be kept random and entirely fixed during training, without sacrificing any performance, raises intriguing questions for “BERTology” (Rogers et al., 2020) and for the study of what different layers in transformers learn.
 Figure 5: IWSLT comparison of normal v frozen v backskipped
# 4.4 BACKSKIPPING
With the reservoir transformers as described above, we obtain better efficiency by skipping the “gradient application” matrix addition step in some of the layers (i.e., updating the weights). One step further would be to investigate skipping the entire backward pass for reservoirs altogether, which would save us from having to do the much more expensive matrix multiplication for these layers that is required for the propagation of gradients. We report on preliminary experiments where in the backward pass we replace the gradients for the layer $L _ { i }$ going into the reservoir $L _ { i + 1 }$ with a noisy estimate (Jaderberg et al., 2017; Czarnecki et al., 2017). Promisingly, Oktay et al. (2020) recently asked “why spend resources on exact gradients when we’re going to use stochastic optimization?” and show that you can do randomized auto-differentiation quite successfully.
Here, rather than minimizing the actual gradients $\frac { \partial L _ { i } } { \partial \theta ^ { L _ { i } } }$ , we minimize their expectation and train via continuous-action REINFORCE (Williams, 1992). That is, $L _ { i }$ becomes a policy $\pi _ { a }$ : $s \mu$ whei.e., $\textstyle { \frac { 1 } { n } } \sum _ { i = 0 } ^ { n } ( { \dot { R } } ^ { i } - V ^ { i } ( a ) ) ^ { 2 }$ $a \sim \mathcal { N } ( \mu , 1 )$ . We train to miniREINFORCE loss $\mathbb { E } _ { a } \left[ \log ( { \bar { a } } ) \left( R - { \bar { V } } ( a ) \right) \right]$ ion loss via MSE,, where the value network $V$ acts as the baseline. $R$ is defined as the mean of the gradients of the top layer $L _ { i + 2 }$ , with the sign flipped. Thus, simply put, we train to minimize the expectation of the true gradients at the layer directly following the reservoir. We employ an annealing scheme where we first train the value network and propagate the true gradients during warmup. Afterwards, we anneal the probability of backskipping rather than performing a true backward pass (multiplying the probability by 0.99 every iteration until we only backskip). We experimented with setting $R$ to the negation of the total loss as well but found the current reward to work better. We call this approach backskipping.
Figure 5 shows the results as validation BLEU over time. We observe that this approach helps especially during the earlier stages of training. Although it does not match the performance of the approach with true gradients quite yet, it actually performs competitively. Backskipping looks promising as an approach to further reduce computational costs, and would be even more efficient from a hardware perspective since the circuitry for such layers (which do not need to propagate gradients) can effectively be hardwired entirely.
# 5 RELATED WORK
Recent work has shown that modern NLP models are able to function with different numbers of layers for different examples (Elbayad et al., 2019; Fan et al., 2019); that different layers specialize for different purposes (Zhang et al., 2019); that layers can be compressed (Li et al., 2020); and, that layers can be reordered (Press et al., 2019). There is a growing body of work in efficient self-attention networks (Tay et al., 2020b), such as linear attention (Wang et al., 2020), on how to process long context information (Beltagy et al., 2020) and on approximations to make transformers more scalable (Kitaev et al., 2020; Katharopoulos et al., 2020). BigBIRD (Zaheer et al., 2020) provides random keys as additional inputs to its attention mechanism. Locality sensitive hashing (LSH) as employed e.g. in Reformer (Kitaev et al., 2020) utilizes a fixed random projection. Performer (Choromanski et al., 2020) computes the transformer’s multi-head attention weights as a fixed orthogonal random projection. Closely related to this work, Tay et al. (2020a) showed that randomized alignment matrices in their “Synthesizer” architecture are sufficient for many NLP tasks. While these works focus on random attention, we show that entire layers can be random and fixed. We also show that entire layers can be replaced by fixed random projections that do not have any attention whatsoever.
Beyond transformers, random features have been extensively explored. Examples of this include FreezeOut (Brock et al., 2017), deep reservoir computing networks (Scardapane & Wang, 2017; Gallicchio & Micheli, 2017), as well as applications in domains as varied as text classification (Conneau et al., 2017; Zhang & Bowman, 2018; Wieting & Kiela, 2019) or music classification (Pons & Serra, 2019). It is well known that randomly initialized networks can display impressive performance on their own (Ulyanov et al., 2018; Rosenfeld & Tsotsos, 2019; Ramanujan et al., 2020), which underlies, for example, the recently popularized lottery ticket hypothesis (Frankle & Carbin, 2018; Zhou et al., 2019). We know that learning deep overparameterized networks appears to help in general (Li & Liang, 2018; Du et al., 2019). Our method represents an easy and cheap way to add both depth and parameters to transformer networks.
# 6 CONCLUSION
This work demonstrated that state-of-the-art transformer architectures can be trained without updating all of the layers. This complements a long history in machine learning of harnessing the power of random features. In most cases, “reservoir transformers” achieve better performance-efficiency trade-offs as measured by our newly introduced AUCC metric, and better test set generalization, on a variety of tasks and in a variety of settings. Future work includes further investigating hybrid networks and backskipping architectures, as well as utilizing pruning strategies at inference time, in order to try to obtain even better performance/efficiency trade-offs.
# REFERENCES
Thomas Bachlechner, Bodhisattwa Prasad Majumder, Huanru Henry Mao, Garrison W Cottrell, and Julian McAuley. Rezero is all you need: Fast convergence at large depth. arXiv preprint arXiv:2003.04887, 2020. Alexei Baevski, Steffen Schneider, and Michael Auli. vq-wav2vec: Self-supervised learning of discrete speech representations. arXiv preprint arXiv:1910.05453, 2019. Eric B Baum. On the capabilities of multilayer perceptrons. Journal of complexity, 4(3):193–215, 1988. Iz Beltagy, Matthew E Peters, and Arman Cohan. Longformer: The long-document transformer. arXiv preprint arXiv:2004.05150, 2020. Hans-Dieter Block. The perceptron: A model for brain functioning. i. Reviews of Modern Physics, 34(1):123, 1962. Ondˇrej Bojar, Christian Buck, Christian Federmann, Barry Haddow, Philipp Koehn, Johannes Leveling, Christof Monz, Pavel Pecina, Matt Post, Herve Saint-Amand, Radu Soricut, Lucia Specia, and Ales Tamchyna. Findings of the 2014 workshop on statistical machine translation. In ˇ Proceedings of the Ninth Workshop on Statistical Machine Translation, Baltimore, Maryland, USA, June 2014. Association for Computational Linguistics. A Borsellino and A Gamba. An outline of a mathematical theory of papa. Il Nuovo Cimento (1955- 1965), 20(2):221–231, 1961. Andrew P Bradley. The use of the area under the roc curve in the evaluation of machine learning algorithms. Pattern recognition, 30(7):1145–1159, 1997. Andrew Brock, Theodore Lim, James M Ritchie, and Nick Weston. Freezeout: Accelerate training by progressively freezing layers. arXiv preprint arXiv:1706.04983, 2017. 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.
Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. arXiv preprint arXiv:2005.12872, 2020.
M. Cettolo, J. Niehues, S. Stuker, L. Bentivogli, and Marcello Federico. Report on the 11 th iwslt ¨ evaluation campaign , iwslt 2014. In Proceedings of IWSLT, 2015.
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. arXiv preprint arXiv:1406.1078, 2014.
Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Jared Davis, Tamas Sarlos, David Belanger, Lucy Colwell, and Adrian Weller. Masked language modeling for proteins via linearly scalable long-context transformers. arXiv preprint arXiv:2006.03555, 2020.
Alexis Conneau, Douwe Kiela, Holger Schwenk, Loic Barrault, and Antoine Bordes. Supervised learning of universal sentence representations from natural language inference data. arXiv preprint arXiv:1705.02364, 2017.
Thomas M Cover. Geometrical and statistical properties of systems of linear inequalities with applications in pattern recognition. IEEE transactions on electronic computers, (3):326–334, 1965.
Wojciech Marian Czarnecki, Grzegorz Swirszcz, Max Jaderberg, Simon Osindero, Oriol Vinyals, ´ and Koray Kavukcuoglu. Understanding synthetic gradients and decoupled neural interfaces. arXiv preprint arXiv:1703.00522, 2017.
Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc Le, and Ruslan Salakhutdinov. Transformer-XL: Attentive language models beyond a fixed-length context. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, Florence, Italy, July 2019. Association for Computational Linguistics.
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.
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.
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.
Sergey Edunov, Myle Ott, Michael Auli, David Grangier, and Marc’Aurelio Ranzato. 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), New Orleans, Louisiana, June 2018. Association for Computational Linguistics.
Maha Elbayad, Jiatao Gu, Edouard Grave, and Michael Auli. Depth-adaptive transformer. arXiv preprint arXiv:1910.10073, 2019.
Joseph Enguehard, Dan Busbridge, Vitalii Zhelezniak, and Nils Hammerla. Neural language priors. arXiv preprint arXiv:1910.03492, 2019.
Angela Fan, Edouard Grave, and Armand Joulin. Reducing transformer depth on demand with structured dropout. arXiv preprint arXiv:1909.11556, 2019.
Jonathan Frankle and Michael Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. arXiv preprint arXiv:1803.03635, 2018.
Jonathan Frankle, David J Schwab, and Ari S Morcos. Training batchnorm and only batchnorm: On the expressive power of random features in cnns. arXiv preprint arXiv:2003.00152, 2020.
Claudio Gallicchio and Alessio Micheli. Echo state property of deep reservoir computing networks. Cognitive Computation, 9(3):337–350, 2017.
Claudio Gallicchio and Simone Scardapane. Deep randomized neural networks. In Recent Trends in Learning From Data, pp. 43–68. Springer, 2020.
A. Gamba, L. Gamberini, G. Palmieri, and R. Sanna. Further experiments with papa. Il Nuovo Cimento (1955-1965), 20(2):112–115, 1961.
Ankush Garg, Yuan Cao, and Qi Ge. Echo state neural machine translation. arXiv preprint arXiv:2002.11847, 2020.
Raja Giryes, Guillermo Sapiro, and Alex M Bronstein. Deep neural networks with random gaussian weights: A universal classification strategy? IEEE Transactions on Signal Processing, 64(13): 3444–3457, 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.
Caglar Gulcehre, Marcin Moczulski, Misha Denil, and Yoshua Bengio. Noisy activation functions. In International conference on machine learning, pp. 3059–3068, 2016.
Fatemeh Hadaeghi, Xu He, and Herbert Jaeger. Unconventional Information Processing Systems, Novel Hardware: A Tour D’Horizon. 2017.
Konstantin Hicke, Miguel Escalona-Moran, Daniel Brunner, Miguel Soriano, Ingo Fischer, and Claudio Mirasso. Information processing using transient dynamics of semiconductor lasers subject to delayed feedback. Selected Topics in Quantum Electronics, IEEE Journal of, 19:1501610– 1501610, 07 2013. doi: 10.1109/JSTQE.2013.2241738.
Guang-Bin Huang, Qin-Yu Zhu, and Chee-Kheong Siew. Extreme learning machine: theory and applications. Neurocomputing, 70(1-3):489–501, 2006.
Max Jaderberg, Wojciech Marian Czarnecki, Simon Osindero, Oriol Vinyals, Alex Graves, David Silver, and Koray Kavukcuoglu. Decoupled neural interfaces using synthetic gradients. In International Conference on Machine Learning, pp. 1627–1635. PMLR, 2017.
Herbert Jaeger. Adaptive nonlinear system identification with echo state networks. In Advances in neural information processing systems, 2003.
Ganesh Jawahar, Benoˆıt Sagot, and Djame Seddah. What does BERT learn about the structure of ´ language? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, 2019.
Kam Jim, Bill G Horne, and C Lee Giles. Effects of noise on convergence and generalization in recurrent networks. In Advances in neural information processing systems, pp. 649–656, 1995.
Kam-Chuen Jim, C Lee Giles, and Bill G Horne. An analysis of noise in recurrent neural networks: convergence and generalization. IEEE Transactions on neural networks, 7(6):1424–1438, 1996.
William B Johnson and Joram Lindenstrauss. Extensions of lipschitz mappings into a hilbert space. Contemporary mathematics, 26(189-206):1, 1984.
Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
Jungo Kasai, Nikolaos Pappas, Hao Peng, James Cross, and Noah A Smith. Deep encoder, shallow decoder: Reevaluating the speed-quality tradeoff in machine translation. arXiv preprint arXiv:2006.10369, 2020.
Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and Franc¸ois Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. arXiv preprint arXiv:2006.16236, 2020.
Yoon Kim. Convolutional neural networks for sentence classification. arXiv preprint arXiv:1408.5882, 2014.
Nikita Kitaev, Łukasz Kaiser, and Anselm Levskaya. Reformer: The efficient transformer. arXiv preprint arXiv:2001.04451, 2020.
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.
Yuanzhi Li and Yingyu Liang. Learning overparameterized neural networks via stochastic gradient descent on structured data. In Advances in Neural Information Processing Systems, pp. 8157– 8166, 2018.
Zhuohan Li, Eric Wallace, Sheng Shen, Kevin Lin, Kurt Keutzer, Dan Klein, and Joseph E Gonzalez. Train large, then compress: Rethinking model size for efficient training and inference of transformers. arXiv preprint arXiv:2002.11794, 2020.
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.
MultiMedia LLC. Large text compression benchmark. 2009.
Mantas Lukosevi ˇ cius and Herbert Jaeger. Reservoir computing approaches to recurrent neural net- ˇ work training. Computer Science Review, 3(3), 2009.
Wolfgang Maass, Thomas Natschlager, and Henry Markram. Real-time computing without stable ¨ states: A new framework for neural computation based on perturbations. Neural computation, 14 (11):2531–2560, 2002.
Marvin Minsky and Seymour A Papert. Perceptrons: An introduction to computational geometry. MIT press, 2017.
Emre O Neftci, Charles Augustine, Somnath Paul, and Georgios Detorakis. Event-driven random back-propagation: Enabling neuromorphic deep learning machines. Frontiers in neuroscience, 11:324, 2017.
Hyeonwoo Noh, Tackgeun You, Jonghwan Mun, and Bohyung Han. Regularizing deep neural networks by noise: Its interpretation and optimization. In Advances in Neural Information Processing Systems, pp. 5109–5118, 2017.
Deniz Oktay, Nick McGreivy, Joshua Aduol, Alex Beatson, and Ryan P Adams. Randomized automatic differentiation. arXiv preprint arXiv:2007.10412, 2020.
Myle Ott, Sergey Edunov, David Grangier, and Michael Auli. Scaling neural machine translation. arXiv preprint arXiv:1806.00187, 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-HLT 2019: Demonstrations, 2019.
Yoh-Han Pao, Gwang-Hoon Park, and Dejan J Sobajic. Learning and generalization characteristics of the random vector functional-link net. Neurocomputing, 6(2):163–180, 1994.
Jonathan Pilault, Jaehong Park, and Christopher Pal. On the impressive performance of randomly weighted encoders in summarization tasks. arXiv preprint arXiv:2002.09084, 2020.
Jordi Pons and Xavier Serra. Randomly weighted cnns for (music) audio classification. In ICASSP 2019-2019 IEEE international conference on acoustics, speech and signal processing (ICASSP), pp. 336–340. IEEE, 2019.
Ofir Press, Noah A Smith, and Omer Levy. Improving transformer models by reordering their sublayers. arXiv preprint arXiv:1911.03864, 2019.
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2018.
Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In Advances in neural information processing systems, pp. 1177–1184, 2008.
Ali Rahimi and Benjamin Recht. Weighted sums of random kitchen sinks: Replacing minimization with randomization in learning. In Advances in neural information processing systems, pp. 1313– 1320, 2009.
Vivek Ramanujan, Mitchell Wortsman, Aniruddha Kembhavi, Ali Farhadi, and Mohammad Rastegari. What’s hidden in a randomly weighted neural network? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11893–11902, 2020.
Anna Rogers, Olga Kovaleva, and Anna Rumshisky. A primer in bertology: What we know about how bert works. arXiv preprint arXiv:2002.12327, 2020.
Amir Rosenfeld and John K Tsotsos. Intriguing properties of randomly weighted networks: Generalizing while learning next to nothing. In 2019 16th Conference on Computer and Robot Vision (CRV), pp. 9–16. IEEE, 2019.
Magnus Sahlgren. An introduction to random indexing. In Methods and applications of semantic indexing workshop at the 7th international conference on terminology and knowledge engineering, 2005.
Andrew M Saxe, James L McClelland, and Surya Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. arXiv preprint arXiv:1312.6120, 2013.
Simone Scardapane and Dianhui Wang. Randomness in neural networks: an overview. Wiley Interdisciplinary Reviews: Data Mining and Knowledge Discovery, 7(2):e1200, 2017.
Wouter F Schmidt, Martin A Kraaijveld, and Robert PW Duin. Feedforward neural networks with random weights. In Proceedings of the 11th International Conference on Pattern Recognition, 1992. Vol. II. Conference B: Pattern Recognition Methodology and Systems, pp. 1–4, 1992.
Benjamin Schrauwen, Michiel D’Haene, David Verstraeten, and Jan Campenhout. Compact hardware for real-time speech recognition using a liquid state machine. pp. 1097 – 1102, 09 2007. doi: 10.1109/IJCNN.2007.4371111.
Roy Schwartz, Jesse Dodge, Noah A Smith, and Oren Etzioni. Green ai. arXiv preprint arXiv:1907.10597, 2019.
Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Y 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.
Emma Strubell, Ananya Ganesh, and Andrew McCallum. Energy and policy considerations for deep learning in nlp. arXiv preprint arXiv:1906.02243, 2019.
Gouhei Tanaka, Toshiyuki Yamane, Jean Benoit Heroux, Ryosho Nakane, Naoki Kanazawa, Seiji ´ Takeda, Hidetoshi Numata, Daiju Nakano, and Akira Hirose. Recent advances in physical reservoir computing: A review. Neural Networks, 115:100 – 123, 2019.
Yi Tay, Dara Bahri, Donald Metzler, Da-Cheng Juan, Zhe Zhao, and Che Zheng. Synthesizer: Rethinking self-attention in transformer models. arXiv preprint arXiv:2005.00743, 2020a.
Yi Tay, Mostafa Dehghani, Dara Bahri, and Donald Metzler. Efficient transformers: A survey. arXiv preprint arXiv:2009.06732, 2020b.
Ian Tenney, Dipanjan Das, and Ellie Pavlick. Bert rediscovers the classical nlp pipeline. arXiv preprint arXiv:1905.05950, 2019.
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.
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.
Oriol Vinyals, Igor Babuschkin, Wojciech M. Czarnecki, Michael Mathieu, Andrew Dudzik, Juny- ¨ oung Chung, David H. Choi, Richard Powell, Timo Ewalds, Petko Georgiev, Junhyuk Oh, Dan Horgan, Manuel Kroiss, Ivo Danihelka, Aja Huang, Laurent Sifre, Trevor Cai, John P. Agapiou, Max Jaderberg, Alexander S. Vezhnevets, Remi Leblond, Tobias Pohlen, Valentin Dalibard, David ´ Budden, Yury Sulsky, James Molloy, Tom L. Paine, Caglar Gulcehre, Ziyu Wang, Tobias Pfaff, Yuhuai Wu, Roman Ring, Dani Yogatama, Dario Wunsch, Katrina McKinney, Oliver Smith, Tom ¨ Schaul, Timothy Lillicrap, Koray Kavukcuoglu, Demis Hassabis, Chris Apps, and David Silver. Grandmaster level in StarCraft II using multi-agent reinforcement learning. Nature, 575(7782): 350–354, November 2019.
Sinong Wang, Belinda Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768, 2020.
John Wieting and Douwe Kiela. No training required: Exploring random encoders for sentence classification. arXiv preprint arXiv:1901.10444, 2019.
Adina Williams, Nikita Nangia, and Samuel R Bowman. A broad-coverage challenge corpus for sentence understanding through inference. arXiv preprint arXiv:1704.05426, 2017.
Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
Felix Wu, Angela Fan, Alexei Baevski, Yann N Dauphin, and Michael Auli. Pay less attention with lightweight and dynamic convolutions. arXiv preprint arXiv:1901.10430, 2019.
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.
Chiyuan Zhang, Samy Bengio, and Yoram Singer. Are all layers created equal? arXiv preprint arXiv:1902.01996, 2019.
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.
Hattie Zhou, Janice Lan, Rosanne Liu, and Jason Yosinski. Deconstructing lottery tickets: Zeros, signs, and the supermask. In Advances in Neural Information Processing Systems, pp. 3597–3607, 2019.
 Figure 6: IWSLT comparison of different hybrid architectures with different reservoir layers.
 Figure 7: IWSLT validation AUCC and test BLEU with 6-layer decoder.
A HYBRID NETWORKS AND NON-TRANSFORMER RESERVOIRS
We investigate whether reservoir layers need to be transformer-based (or transformers-withoutattention, i.e., FFN). We examine two different alternatives: bidirectional Gated Recurrent Units (Cho et al., 2014) and Convolutional Neural Networks (LeCun et al., 1998; Kim, 2014), specifically light dynamical convolutions (Wu et al., 2019). Figure 6 shows the results for these hybrids: depending on the setting, they may obtain a better AUCC than the regular transformer, but this is less consistent than with the other reservoir layers, most likely because these layers have different computational properties. It’s possible that these hybrids simply require further tuning, as we found e.g. up-projecting to help for BiGRUs, but studying this is outside of the scope of the current work.
# B DEEP DECODERS
We show that the same results hold for a 6-layer decoder on IWSLT (although less pronounced for AUCC, probably because the decoder is computationally heavier). See Figure 7 and Table 2.
# C FREEZING STRATEGY
We explored different strategies for the placement of reservoir layers and found the “alternating” strategy reported in the main body of the paper to work best. Generally, we found repetitive application of reservoirs to yield diminishing returns, as might be expected. See Figure 8.
Table 2: Wall-clock time (averaged over multiple runs) saved for IWSLT for different model types and encoder depths. Max BLEU is for validation. Number of layers is for encoder, decoder depth is kept fixed at 6. Ratio is computed compared to comparable number of layers in the normal case.
<table><tr><td>Model</td><td>#Layers</td><td>Frozen</td><td>Max BLEU</td><td>Train time until max (in hours)</td><td>Ratio</td><td># Params Trainable (Total)</td><td>Train Time each epoch (in seconds)</td></tr><tr><td rowspan="4">Transformer</td><td>6</td><td>0</td><td>34.97 ± 0.05</td><td>1.984 ± 0.02</td><td>1</td><td>39.5M</td><td>177.84 ± 2.98</td></tr><tr><td>8</td><td>0</td><td>34.99 ± 0.08</td><td>2.161 ± 0.03</td><td>1</td><td>43.7M</td><td>206.59 ± 3.47</td></tr><tr><td>10</td><td>0</td><td>34.98 ± 0.04</td><td>2.345± 0.02</td><td>1</td><td>47.9M</td><td>236.72 ± 3.52</td></tr><tr><td>12</td><td>0</td><td>34.78 ± 0.11</td><td>2.535 ± 0.05</td><td>1</td><td>52.0M</td><td>265.90 ± 4.97</td></tr><tr><td rowspan="4">TReservoir</td><td>6</td><td>2</td><td>34.73 ± 0.11</td><td>1.838 ± 0.01</td><td>0.92</td><td>35.3M (39.5M)</td><td>166.11 ± 2.21</td></tr><tr><td>8</td><td>2</td><td>35.07 ± 0.05</td><td>1.912 ± 0.03</td><td>0.88</td><td>39.5M (43.7M)</td><td>190.08 ± 3.73</td></tr><tr><td>10</td><td>2</td><td>35.02 ± 0.01</td><td>1.970 ± 0.04</td><td>0.84</td><td>43.7M (47.9M)</td><td>204.42 ± 2.89</td></tr><tr><td>12</td><td>2</td><td>35.06 ± 0.02</td><td>2.429 ± 0.02</td><td>0.95</td><td>47.8M (52.0M)</td><td>236.41 ± 4.35</td></tr><tr><td rowspan="4">FFN Reservoir</td><td>6</td><td>2</td><td>34.85 ± 0.10</td><td>1.729 ± 0.03</td><td>0.87</td><td>35.3M (37.4M)</td><td>161.72 ± 2.32</td></tr><tr><td>8</td><td>2</td><td>34.99 ± 0.11</td><td>1.751 ± 0.02</td><td>0.81</td><td>39.5M (41.6M)</td><td>180.21 ± 2.68</td></tr><tr><td>10</td><td>2</td><td>34.92 ± 0.03</td><td>1.907 ± 0.02</td><td>0.81</td><td>43.7M (45.8M)</td><td>191.40 ± 2.49</td></tr><tr><td>12</td><td>2</td><td>35.16 ± 0.04</td><td>2.395 ± 0.01</td><td>0.94</td><td>47.8M (49.9M)</td><td>216.08 ± 2.57</td></tr><tr><td rowspan="4">LayerDrop</td><td>6</td><td>22</td><td>34.51 ± 0.12</td><td>1.908 ± 0.04</td><td>0.96</td><td>35.3M (39.5M)</td><td>169.62 ± 3.16</td></tr><tr><td>8</td><td></td><td>34.77 ± 0.11</td><td>2.023 ± 0.02</td><td>0.94</td><td>39.5M (43.7M)</td><td>186.71 ± 2.17</td></tr><tr><td>10</td><td>2</td><td>34.06 ± 0.05</td><td>1.912 ± 0.02</td><td>0.97</td><td>43.7M (47.9M)</td><td>205.52 ± 3.31</td></tr><tr><td>12</td><td>2</td><td>34.08 ± 0.13</td><td>2.524 ± 0.01</td><td>0.99</td><td>47.8M (52.0M)</td><td>222.45 ± 2.21</td></tr></table>
<table><tr><td>Model</td><td> # Layers</td><td>Frozen</td><td>Max BLEU</td><td>Train time until max (in hours)</td><td>Ratio</td><td># Params Trainable (Total)</td><td>Train Time each epoch (in hours)</td></tr><tr><td rowspan="4">Transformer</td><td>12</td><td>0</td><td>24.46 ± 0.04</td><td>15.15 ± 0.15</td><td>1</td><td>75.6M</td><td>0.505 ± 0.005</td></tr><tr><td>16</td><td>0</td><td>24.52 ± 0.03</td><td>16.05 ± 0.18</td><td></td><td>88.2M</td><td>0.643 ± 0.006</td></tr><tr><td>24</td><td>0</td><td>24.69 ± 0.05</td><td>17.61 ± 0.85</td><td>1</td><td>113.4M</td><td>0.877 ± 0.029</td></tr><tr><td>32</td><td>0</td><td>24.83 ± 0.04</td><td>18.42 ± 0.28</td><td>1</td><td>138.6M</td><td>1.036 ± 0.010</td></tr><tr><td rowspan="4">TReservoir</td><td>12</td><td>4</td><td>24.26 ± 0.08</td><td>14.11 ± 0.21</td><td>0.93</td><td>72.4M (75.6M)</td><td>0.472 ± 0.007</td></tr><tr><td>16</td><td>4</td><td>24.50 ± 0.05</td><td>15.25 ± 0.28</td><td>0.95</td><td>75.6M (88.2M)</td><td>0.596 ± 0.009</td></tr><tr><td>24</td><td>4</td><td>25.11 ± 0.07</td><td>15.89 ± 0.74</td><td>0.90</td><td>100.8M (113.4M)</td><td>0.776 ± 0.024</td></tr><tr><td>32</td><td>4</td><td>24.66 ± 0.04</td><td>16.38 ± 0.24</td><td>0.88</td><td>126.0M (138.6M)</td><td>0.998 ± 0.009</td></tr><tr><td rowspan="4">FFN Reservoir</td><td>12</td><td>4</td><td>24.42 ± 0.05</td><td>14.01 ± 0.09</td><td>0.92</td><td>72.4M (71.4M)</td><td>0.441 ± 0.003</td></tr><tr><td>16</td><td>4</td><td>24.65 ± 0.07</td><td>14.53 ± 0.17</td><td>0.91</td><td>75.6M (83.9M)</td><td>0.524 ± 0.006</td></tr><tr><td>24</td><td>4</td><td>24.93 ± 0.04</td><td>12.62 ± 1.53</td><td>0.71</td><td>100.8M (109.2M)</td><td>0.743 ± 0.018</td></tr><tr><td>32</td><td>4</td><td>24.98 ± 0.03</td><td>13.96 ± 0.19</td><td>0.73</td><td>126.0M (134.4M)</td><td>0.964 ± 0.007</td></tr><tr><td rowspan="4">LayerDrop</td><td>12</td><td>4</td><td>24.27 ± 0.03</td><td>14.61 ± 0.14</td><td>0.96</td><td>72.4M (75.6M)</td><td>0.489 ± 0.006</td></tr><tr><td>16</td><td>4</td><td>24.15 ± 0.06</td><td>15.55 ± 0.54</td><td>0.97</td><td>75.6M (88.2M)</td><td>0.597 ± 0.017</td></tr><tr><td>24</td><td>4</td><td>24.37 ± 0.05</td><td>16.25 ± 0.36</td><td>0.92</td><td>100.8M (113.4M)</td><td>0.823 ± 0.013</td></tr><tr><td>32</td><td>4</td><td>23.84 ± 0.03</td><td>15.27 ± 0.38</td><td>0.83</td><td>126.0M (138.6M)</td><td>1.028 ± 0.012</td></tr></table>
Table 3: Wall-clock time (averaged over multiple runs) saved for WMT for different model types and encoder depths. Max BLEU is for validation. Number of layers is for encoder, decoder depth is kept fixed at 1. Ratio is computed compared to comparable number of layers in the normal case.
# D ROBERTA RESULTS
Here we present the additional RoBERTa results for convergence plot and AUCC in various decoder depth setting in Figure 10. As stated in the main paper, the difference of AUCC / Convergence Plot between RoBERTa model with or without Reservoir layers are limited. Moreover, we plot the downstream task performance for SST-2 and MNLI compared to the pretraining wall-clock time in Figure 9. It can be seen that the FFN Reservoir can achieve up to $\cdot$ and $10 \%$ pretraining time savings while matching the best performance of vanilla transformers for MNLI-m and SST2, respectively.
# E RESERVOIR RESULTS FOR TOTAL LAYERS
Here we present the shifted Reservoir Results for IWSLT14, WMT16, Enwik8 and RoBERTa finetuning in Figure 11, 12, 13, 14, respectively. We show the same results also hold when it comes to replace normal transformer blocks with Reservoir blocks at least for MT.
Table 4: Wall-clock time (averaged over multiple runs) saved for IWSLT/WMT for different model types and encoder depths. $\cdot$ Max BLEU is for validation.
<table><tr><td>Mode1</td><td>#Layers</td><td>IWSLT-Dec2 Train time until 95% max (in hours)</td><td>Max BLEU (95%)</td><td>#Layers</td><td>IWSLT-Dec6 Train time until 95% max (in hours)</td><td>Max BLEU (95%)</td><td>#Layers</td><td>WMT-Dec1 Train time until 95% max (in hours)</td><td>Max BLEU (95%)</td></tr><tr><td rowspan="6">Transformer</td><td>6</td><td>0.647 ± 0.03</td><td>32.89 ± 0.04</td><td>6</td><td>0.642 ± 0.02</td><td>33.36 ± 0.03</td><td>16</td><td>3.788 ± 0.053</td><td>23.36 ± 0.06</td></tr><tr><td></td><td>0.711 ± 0.05</td><td>33.04 ± 0.03</td><td>8</td><td>0.765 ± 0.03</td><td>33.41 ± 0.08</td><td></td><td>3.820 ± 0.072</td><td>23.41 ± 0.05</td></tr><tr><td></td><td>0.808 ± 0.02</td><td>33.96 ± 0.08</td><td>10</td><td>0.898 ± 0.04</td><td>33.32 ± 0.07</td><td></td><td>5.262 ± 0.607</td><td>23.50 ± 0.03</td></tr><tr><td>12</td><td>1.037 ± 0.03</td><td>33.07 ± 0.09</td><td>12</td><td>1.037 ± 0.03</td><td>33.07 ± 0.11</td><td>五</td><td>6.212 ± 0.232</td><td>23.81 ±0.04</td></tr><tr><td></td><td>0.569 ± 0.02</td><td>32.78 ±0.03</td><td>6</td><td>0.599 ± 0.01</td><td>33.09 ± 0.05</td><td></td><td>3.563 ± 0.061</td><td>23.21 ± 0.04</td></tr><tr><td>8</td><td>0.619 ± 0.04</td><td>33.12 ± 0.05</td><td>8</td><td>0.726 ± 0.02</td><td>33.38 ± 0.09</td><td>1</td><td>3.603 ± 0.056</td><td>23.80 ± 0.06</td></tr><tr><td rowspan="5">T Reservoir</td><td></td><td>0.729 ± 0.04</td><td>33.13 ± 0.07</td><td>10</td><td>0.738 ± 0.03</td><td>33.37 ± 0.04</td><td>24</td><td>4.923 ± 0.771</td><td>23.75 ± 0.02</td></tr><tr><td>12</td><td>0.982 ± 0.02</td><td>33.03 ± 0.11</td><td>12</td><td>0.958 ± 0.01</td><td>33.46± 0.09</td><td>32</td><td>5.780 ± 0.214</td><td>23.71 ±0.03</td></tr><tr><td>6</td><td>0.521 ± 0.05</td><td>32.85 ± 0.02</td><td>6</td><td>0.594 ± 0.03</td><td>33.13 ± 0.04</td><td>12</td><td>3.417 ± 0.046</td><td>23.22 ± 0.07</td></tr><tr><td>8</td><td>0.533 ± 0.03</td><td>33.84 ± 0.04</td><td>8</td><td>0.651 ± 0.04</td><td>33.36 ± 0.06</td><td>16</td><td>3.527 ± 0.063</td><td>23.54 ± 0.05</td></tr><tr><td>10</td><td>0.614 ± 0.01</td><td>33.05 ± 0.08</td><td>10</td><td>0.627 ± 0.05</td><td>33.26 ± 0.03</td><td>24</td><td>4.197 ± 0.697</td><td>23.74 ± 0.06</td></tr><tr><td rowspan="5">LayerDrop</td><td>12</td><td>0.811 ± 0.02</td><td>33.26 ± 0.10</td><td>12</td><td>0.780 ± 0.02</td><td>33.46 ± 0.08</td><td>32</td><td>4.984 ± 0.321</td><td>23.82 ± 0.02</td></tr><tr><td></td><td>0.837 ±0.08</td><td>32.87 ± 0.05</td><td>6</td><td>0.706 ±0.01</td><td>33.08 ± 0.03</td><td>12</td><td>3.912 ± 0.068</td><td>23.33 ± 0.08</td></tr><tr><td>6</td><td>0.934 ± 0.07</td><td>33.12 ± 0.03</td><td>8</td><td>0.753 ± 0.04</td><td>33.14 ± 0.05</td><td>16</td><td>3.581 ± 0.076</td><td>23.17 ± 0.04</td></tr><tr><td>10</td><td>0.901 ± 0.06</td><td>33.18 ±0.02</td><td>10</td><td>0.691 ± 0.03</td><td>32.39 ± 0.05</td><td>3</td><td>4.875 ± 0.728</td><td>23.43 ± 0.07</td></tr><tr><td>12</td><td>0.914 ± 0.01</td><td>32.33 ± 0.06</td><td>12</td><td>0.803 ± 0.02</td><td>32.94 ± 0.10</td><td></td><td>5.980 ± 0.219</td><td>22.97 ± 0.08</td></tr></table>
<table><tr><td rowspan="2">Model</td><td rowspan="2">#Layers</td><td colspan="3">IWSLT-Dec2 Train time</td><td colspan="3">IWSLT-Dec6</td><td rowspan="2"></td><td colspan="2">WMT-Dec1</td></tr><tr><td>until 99 % max (in hours)</td><td>Max BLEU (99%)</td><td>#Layers</td><td>Train time until 99 % max (in hours)</td><td>Max BLEU (99%)</td><td>#Layers</td><td>Train time until 99 % max (in hours)</td><td>Max BLEU (99%)</td></tr><tr><td rowspan="5">Transformer</td><td></td><td>1.454 ± 0.06</td><td>34.24 ± 0.05</td><td>6</td><td>1.297 ± 0.03</td><td>34.69 ± 0.05</td><td>1</td><td>9.961 ± 0.053</td><td></td><td>24.27 ± 0.04</td></tr><tr><td></td><td>1.475 ± 0.09</td><td>34.32 ± 0.09</td><td>8</td><td>1.390 ± 0.02</td><td></td><td></td><td></td><td>12.623 ± 0.072</td><td>24.35 ± 0.06</td></tr><tr><td>10</td><td>1.526 ± 0.04</td><td>34.25 ± 0.04</td><td></td><td></td><td>1.622 ± 0.05</td><td>34.75 ± 0.09 34.64 ± 0.03</td><td>3</td><td>13.412 ± 0.837</td><td>24.49 ± 0.07</td></tr><tr><td>12</td><td>2.259 ± 0.07</td><td>34.24 ± 0.11</td><td>10 12</td><td></td><td>1.748 ± 0.01</td><td>34.66 ± 0.08</td><td></td><td>15.117 ± 0.232</td><td>24.56 ± 0.02</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="5">TReservoir</td><td></td><td>1.257 ± 0.04</td><td>34.05 ± 0.09</td><td>6</td><td>1.291 ± 0.03</td><td>34.51 ± 0.10</td><td>1</td><td>8.314 ± 0.062</td><td></td><td>24.15 ± 0.06</td></tr><tr><td>10</td><td>1.472 ± 0.06</td><td>34.47 ± 0.05</td><td></td><td>1.339 ± 0.03</td><td>34.80 ± 0.04</td><td></td><td></td><td>9.221 ± 0.073</td><td>24.41 ± 0.05</td></tr><tr><td>12</td><td>1.530 ± 0.03</td><td>34.36 ± 0.02</td><td>10</td><td>1.419 ± 0.04</td><td></td><td>34.72 ± 0.03</td><td></td><td>10.413 ± 0.580</td><td>24.56 ± 0.03</td></tr><tr><td></td><td>2.043 ± 0.05</td><td>34.53 ± 0.07</td><td>12</td><td>1.642 ± 0.02</td><td></td><td>34.87 ± 0.02</td><td>3</td><td>11.465 ± 0.227</td><td>24.49 ±0.01</td></tr><tr><td>680</td><td>1.138 ± 0.03</td><td>34.10 ± 0.13</td><td>6</td><td>1.169 ± 0.02</td><td></td><td>34.71 ± 0.09</td><td></td><td>7.407 ± 0.087</td><td>24.33 ± 0.08</td></tr><tr><td rowspan="5">FFN Reservoir</td><td></td><td>1.101 ± 0.07</td><td>34.32 ± 0.11 34.36 ± 0.03</td><td>8 10</td><td>1.201 ± 0.03 1.276 ± 0.03</td><td>34.79 ±0.08 34.63 ± 0.03</td><td></td><td></td><td>9.336 ± 0.036</td><td>24.42 ± 0.05</td></tr><tr><td>12</td><td>1.281 ± 0.01</td><td></td><td></td><td></td><td></td><td></td><td></td><td>9.978 ± 0.546</td><td>24.91 ± 0.07</td></tr><tr><td></td><td>1.785 ± 0.03</td><td>34.42 ± 0.06</td><td>12</td><td>1.440 ± 0.01</td><td>34.87 ± 0.02</td><td></td><td></td><td>10.524 ± 0.341</td><td>24.96 ± 0.01</td></tr><tr><td>8</td><td>1.363 ± 0.05</td><td>34.58 ± 0.14</td><td>6</td><td>1.253 ± 0.01</td><td></td><td>34.42 ± 0.10</td><td></td><td>8.372 ± 0.059</td><td>24.17 ± 0.04</td></tr><tr><td></td><td>1.468 ± 0.03</td><td>34.50 ± 0.12</td><td>8</td><td>1.244 ± 0.04</td><td>34.44 ± 0.09</td><td></td><td></td><td>9.741 ± 0.043</td><td>23.93 ± 0.08</td></tr><tr><td rowspan="4">LayerDrop</td><td>10</td><td>1.678 ± 0.04</td><td>34.52 ± 0.07</td><td>10</td><td></td><td></td><td>33.83 ±0.06</td><td>16 3</td><td>10.145 ± 0.628</td><td>24.07 ± 0.09</td></tr><tr><td>12</td><td>2.071 ± 0.02</td><td>33.45 ± 0.23</td><td>12</td><td>1.343 ± 0.04 1.423 ± 0.02</td><td>33.97 ± 0.12</td><td></td><td></td><td>10.168 ± 0.329</td><td>23.81 ± 0.03</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
Table 5: Wall-clock time (averaged over multiple runs) saved for IWSLT/WMT for different model types and encoder depths. $9 9 \%$ Max BLEU is for validation.
# F VALIDATION PLOTS
Here we present the validation plots for training a 8-layer encoder, 2-layer decoder model for IWSLT14, a 24-layer encoder, 1-layer decoder model for WMT14, a 48-layer decoder model for enwik8 and a 12-layer decoder model for RoBERTa for detailed steps to calculate the AUCC. It can be clearly observed that given the configurations from Section 3.1, all the models have converged. So when we compute the area under the convergence curve, this depicts the training efficiency of the model (basically time x performance) until convergence. Specifically, we set T sufficiently high for computing the AUCC, which is 4h for IWSLT, 20h for WMT, 30h for enwik8 and 60h for RoBERTa pretraning. From the training plot in the appendix, we can see that each model has converged at that point. The Reservoir model in Figure 15 has 2 layers frozen for IWSLT14, 8 layers frozen for enwik8, and 4 layers frozen for WMT14 and RoBERTa.
# G ROBERTA PROBING
We follow Jawahar et al. (2019) and investigate what the frozen layers in the Reservoir Transformer have actually “learned” (while being forzen) as measured by probing tasks, reported in Table 6. The results are gathered over 3 random seeds for reporting the mean and standard deviation. From the table, we can see that generally probing performance is quite similar between Transformer and the T Reservoir model. We also noticed that the representations collected after the frozen layer (3, 5, 7, 9) in the T Reservoir actually have significantly better performance over the regular Transformer representations across all the probing tasks. This has interesting repercussions for the study of “BERTology”, as it clearly shows, somewhat confusingly, that even completely random and frozen layers represent linguistic phenomena.
 Figure 8: IWSLT with 2-layer decoder using different freezing strategy.
 Figure 9: RoBERTa Reservoir Results, Pre-training versus downstream task plot for 12 layer RoBERTa. MNLI-m (left). SST-2 (right).
 Figure 10: RoBERTa Reservoir Results, Training plot for 12 layer RoBERTa (left). AUCC result (right).
 Figure 11: Validation BLEU AUCC and test BLEU for IWSLT (high is good). Comparison of regular transformer and reservoir transformer with FFN or Transformer reservoir layers added.
 Figure 12: Validation BLEU AUCC and test BLEU for WMT (high is good). Comparison of regular transformer and reservoir transformer with FFN or Transformer reservoir layers added.
 Figure 13: Validation BPC AUCC and test BPC on the enwik8 language modelling task (low is good). Comparison of regular and reservoir transformers for varying depths.
 Figure 14: Downstream RoBERTa performance on SST-2 (left) and MultiNLI-matched (right).
 Figure 15: IWSLT with 2-layer decoder validation plot (upper left). WMT with 24-layer decoder validation plot (upper right). Enwik8 with 48-layer decoder validation plot (lower left). RoBERTa with 12-layer decoder validation plot (lower right).
<table><tr><td>Model</td><td>Layer</td><td>SentLen (Surface)</td><td>TreeDepth (Syntactic)</td><td>TopConst (Syntactic)</td><td>BShift (Syntactic)</td><td>Tense (Semantic)</td><td>SubjNum (Semantic)</td><td>ObjNum (Semantic)</td><td>SOMO (Semantic)</td><td>CoordInv (Semantic)</td></tr><tr><td rowspan="14">Transformer</td><td></td><td>84.56 ± 0.54</td><td>32.30 ± 0.41</td><td>54.40 ± 0.33</td><td>49.99 ± 0.01</td><td>80.98 ± 0.32</td><td>76.26 ± 0.09</td><td>50.01 ± 0.19</td><td>76.38 ± 0.61</td><td>54.33 ± 0.47</td></tr><tr><td></td><td>87.22 ± 0.07</td><td>33.63 ± 0.57</td><td>58.38 ± 0.20</td><td>50.12 ± 0.17</td><td>82.84 ± 0.68</td><td>78.65 ± 0.19</td><td>51.47 ± 0.53</td><td>78.00 ± 1.12</td><td>54.66 ± 0.55</td></tr><tr><td></td><td>84.25 ± 0.16</td><td>32.60 ± 0.17</td><td>54.41 ± 0.10</td><td>50.02 ± 0.01</td><td>81.72 ± 0.59</td><td>77.00 ± 0.13</td><td>51.32 ± 0.64</td><td>76.57 ± 1.13</td><td>54.13 ± 0.51</td></tr><tr><td></td><td>87.37 ± 0.20</td><td>32.59 ± 0.29</td><td>50.06 ± 0.21</td><td>69.76 ± 0.26</td><td>81.63 ± 1.17</td><td>76.47 ± 0.09</td><td>52.41 ± 1.49</td><td>76.15 ± 0.84</td><td>52.62 ± 1.34</td></tr><tr><td>5</td><td>84.61 ± 0.24</td><td>31.14 ± 0.48</td><td>44.76 ± 0.38</td><td>74.82 ± 0.11</td><td>80.16 ± 0.19</td><td>73.66 ± 0.16</td><td>52.95 ± 1.77</td><td>72.90 ± 0.21</td><td>51.26 ± 1.14</td></tr><tr><td>6</td><td>82.56 ± 0.25</td><td>30.31 ± 0.40</td><td>39.30 ± 0.40</td><td>78.80 ±0.38</td><td>81.88 ± 0.47</td><td>75.30 ± 0.07</td><td>56.21 ± 1.26</td><td>74.37 ± 0.16</td><td>51.44 ± 1.04</td></tr><tr><td></td><td>70.85 ± 0.13</td><td>26.65 ± 0.72</td><td>40.70 ± 0.13</td><td>78.98 ± 0.32</td><td>85.11 ± 0.31</td><td>72.03 ± 0.46</td><td>58.15 ± 0.46</td><td>68.71 ± 0.91</td><td>55.39 ± 0.27</td></tr><tr><td>8</td><td>66.23 ± 1.33</td><td>23.46 ± 0.44</td><td>25.19 ± 1.02</td><td>77.42 ± 0.27</td><td>80.35 ± 0.45</td><td>67.55 ± 0.99</td><td>54.94 ± 2.04</td><td>63.69 ± 2.32</td><td>50.58 ± 0.83</td></tr><tr><td>9</td><td>71.17 ± 0.29</td><td>31.21 ± 0.31</td><td>58.42 ± 0.29</td><td>85.55 ± 0.44</td><td>86.77 ± 0.19</td><td>80.30 ± 0.08</td><td>64.36 ± 1.20</td><td>81.68 ± 0.45</td><td>66.90 ± 0.49</td></tr><tr><td>10</td><td>73.19 ± 0.50</td><td>27.74 ± 0.53</td><td>41.01 ± 0.22</td><td>83.56 ± 0.96</td><td>86.13 ± 0.35</td><td>83.04 ± 0.04</td><td>62.01 ± 0.59</td><td>79.73 ± 0.21</td><td>62.60 ± 1.04</td></tr><tr><td>11</td><td>71.37 ± 0.42</td><td>30.22 ± 0.28</td><td>48.58 ± 0.35</td><td>84.40 ± 0.44</td><td>87.28 ± 0.59</td><td>82.34 ± 0.15</td><td>61.10 ± 0.14</td><td>80.00 ± 0.40</td><td>64.44 ± 0.38</td></tr><tr><td>12</td><td>71.66 ± 0.12</td><td>33.43 ± 0.18</td><td>64.38 ± 0.20</td><td>87.38 ± 0.02</td><td>88.41 ± 0.09</td><td>84.46 ± 0.25</td><td>63.01 ± 0.05</td><td>81.80 ± 0.27</td><td>65.72 ± 0.16</td></tr><tr><td></td><td>87.75 ± 0.10</td><td>31.60 ± 0.21</td><td>50.38 ± 0.23</td><td>50.00 ± 0.00</td><td>80.40 ± 0.18</td><td>76.47 ± 0.20</td><td>50.53 ± 0.14</td><td>73.48 ± 0.15</td><td></td></tr><tr><td rowspan="14">TReservoir</td><td>2</td><td>81.28 ± 0.23</td><td>34.20 ± 0.41</td><td></td><td>60.64 ± 0.65</td><td></td><td></td><td></td><td></td><td>53.55 ± 0.70</td></tr><tr><td></td><td></td><td></td><td>61.41 ± 0.42</td><td></td><td>81.50 ± 0.77</td><td>76.33 ± 0.08</td><td>50.73 ± 0.34</td><td>74.28 ± 0.67</td><td>56.82 ± 0.10</td></tr><tr><td>3</td><td>89.28 ± 0.09</td><td>36.42 ± 0.11</td><td>67.36 ± 0.45</td><td>75.64 ± 0.52</td><td>85.42 ± 0.18</td><td>80.53 ± 0.02</td><td>52.50 ± 1.80</td><td>78.47 ± 1.81</td><td>57.16 ± 0.27</td></tr><tr><td></td><td>74.31 ± 0.32</td><td>32.42 ± 0.83</td><td>55.19 ± 0.33</td><td>73.41 ± 0.00</td><td>79.56 ± 0.00</td><td>75.15 ± 0.08</td><td>53.68 ± 0.66</td><td>75.02 ± 0.19</td><td>56.89 ± 0.08</td></tr><tr><td></td><td>88.03 ± 0.22 74.55 ± 0.37</td><td>38.34 ± 0.64 33.13 ± 0.29</td><td>68.65 ± 0.29</td><td>82.25 ± 0.12</td><td>86.80 ± 0.02</td><td>82.27 ± 0.33</td><td>57.95 ± 0.24</td><td>80.82 ± 0.91</td><td>58.05 ± 0.10</td></tr><tr><td></td><td></td><td></td><td>52.70 ± 0.81</td><td>79.21 ± 0.13</td><td>85.70 ± 0.36</td><td>77.43 ± 0.03</td><td>57.26 ± 0.19</td><td>75.38 ± 0.66</td><td>51.95 ± 1.30</td></tr><tr><td></td><td>85.82 ± 0.37 71.69 ± 0.71</td><td>37.63 ± 0.13 30.32 ± 0.01</td><td>70.43 ± 0.05 48.44 ± 0.30</td><td>84.12 ± 0.35 79.12 ± 0.12</td><td>86.88 ± 0.07</td><td>82.86 ± 0.30</td><td>61.17 ± 0.21</td><td>80.79 ± 0.17</td><td>61.83 ± 0.95</td></tr><tr><td>8 9</td><td>85.86 ± 0.12</td><td>37.89 ± 0.03</td><td>69.53 ± 0.37</td><td>85.55 ± 0.12</td><td>84.75 ± 0.09 87.98 ± 0.22</td><td>79.23 ± 0.11 84.13 ± 0.01</td><td>59.53 ± 0.16</td><td>76.80 ± 0.41</td><td>57.34 ± 0.14</td></tr><tr><td></td><td>69.22 ± 0.23</td><td>25.58 ± 0.35</td><td>29.20 ± 0.58</td><td>78.57 ± 0.09</td><td></td><td></td><td>63.06± 0.01</td><td>82.55 ± 0.31</td><td>66.07 ± 0.05</td></tr><tr><td>10</td><td></td><td></td><td>47.56 ± 0.02</td><td></td><td>85.02 ± 0.03</td><td>75.68 ± 0.16</td><td>57.55 ± 1.57</td><td>74.70 ± 0.02</td><td>55.02 ± 0.64</td></tr><tr><td>11</td><td>65.70 ± 0.05</td><td>30.57 ± 0.03</td><td></td><td>81.20 ± 0.00</td><td>86.78 ± 0.02</td><td>83.73 ± 0.05</td><td>60.38 ± 0.17</td><td>80.59 ± 0.15</td><td>62.50 ± 0.11</td></tr><tr><td>12</td><td>70.61 ± 0.18</td><td>34.45± 0.20</td><td>64.19 ± 0.10</td><td>84.53 ± 0.03</td><td>87.48 ± 0.16</td><td>84.86 ± 0.14</td><td>62.75 ± 0.14</td><td>82.08 ± 0.03</td><td>64.73 ± 0.06</td></tr></table>
Table 6: RoBERTa Probing Results. The line in bold text are the the frozen layers in the T Reservoir.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342# LEARNING TO COUNT OBJECTS IN NATURAL IMAGES FOR VISUAL QUESTION ANSWERING
Yan Zhang & Jonathon Hare & Adam Prugel-Bennett ¨
Department of Electronics and Computer Science University of Southampton {yz5n12,jsh2,apb}@ecs.soton.ac.uk
# ABSTRACT
Visual Question Answering (VQA) models have struggled with counting objects in natural images so far. We identify a fundamental problem due to soft attention in these models as a cause. To circumvent this problem, we propose a neural network component that allows robust counting from object proposals. Experiments on a toy task show the effectiveness of this component and we obtain state-of-theart accuracy on the number category of the VQA v2 dataset without negatively affecting other categories, even outperforming ensemble models with our single model. On a difficult balanced pair metric, the component gives a substantial improvement in counting over a strong baseline by $6 . 6 \%$ .
# 1 INTRODUCTION
Consider the problem of counting how many cats there are in Figure 1. Solving this involves several rough steps: understanding what instances of that type can look like, finding them in the image, and adding them up. This is a common task in Visual Question Answering (VQA) – answering questions about images – and is rated as among the tasks requiring the lowest human age to be able to answer (Antol et al., 2015). However, current models for VQA on natural images struggle to answer any counting questions successfully outside of dataset biases (Jabri et al., 2016).
One reason for this is the presence of a fundamental problem with counting in the widely-used soft attention mechanisms (section 3). Another reason is that unlike standard counting tasks, there is no ground truth labeling of where the objects to count are. Coupled with the fact that models need to be able to count a large variety of objects and that, ideally, performance on non-counting questions should not be compromised, the task of counting in VQA seems very challenging.
To make this task easier, we can use object proposals – pairs of a bounding box and object features – from object detection networks as input instead of learning from pixels directly. In any moderately complex scene, this runs into the issue of double-counting overlapping object proposals. This is a problem present in many natural images, which leads to inaccurate counting in real-world scenarios.
Our main contribution is a differentiable neural network component that tackles this problem and consequently can learn to count (section 4). Used alongside an attention mechanism, this component avoids a fundamental limitation of soft attention while producing strong counting features. We provide experimental evidence of the effectiveness of this component (section 5). On a toy dataset, we demonstrate that this component enables robust counting in a variety of scenarios. On the number category of the VQA v2 Open-Ended dataset (Goyal et al., 2017), a relatively simple baseline model using the counting component outperforms all previous models – including large ensembles of state-of-the-art methods – without degrading performance on other categories.
# 2 RELATED WORK
Usually, greedy non-maximum suppression (NMS) is used to eliminate duplicate bounding boxes. The main problem with using it as part of a model is that its gradient is piecewise constant. Various differentiable variants such as by Azadi et al. (2017), Hosang et al. (2017), and Henderson & Ferrari (2017) exist. The main difference is that, since we are interested in counting, our component does not need to make discrete decisions about which bounding boxes to keep; it outputs counting features, not a smaller set of bounding boxes. Our component is also easily integrated into standard VQA models that utilize soft attention without any need for other network architecture changes and can be used without using true bounding boxes for supervision.
On the VQA v2 dataset (Goyal et al., 2017) that we apply our method on, only few advances on counting questions have been made. The main improvement in accuracy is due to the use of object proposals in the visual processing pipeline, proposed by Anderson et al. (2017). Their object proposal network is trained with classes in singular and plural forms, for example “tree” versus “trees”, which only allows primitive counting information to be present in the object features after region-of-interest pooling. Our approach differs in the way that instead of relying on counting features being present in the input, we create counting features using information present in the attention map over object proposals. This has the benefit of being able to count anything that the attention mechanism can discriminate instead of only objects that belong to the predetermined set of classes that had plural forms.
Using these object proposals, Trott et al. (2018) train a sequential counting mechanism with a reinforcement learning loss on the counting question subsets of VQA v2 and Visual Genome. They achieve a small increase in accuracy and can obtain an interpretable set of objects that their model counted, but it is unclear whether their method can be integrated into traditional VQA models due to their loss not applying to non-counting questions. Since they evaluate on their own dataset, their results can not be easily compared to existing results in VQA.
Methods such as by Santoro et al. (2017) and Perez et al. (2017) can count on the synthetic CLEVR VQA dataset (Johnson et al., 2017) successfully without bounding boxes and supervision of where the objects to count are. They also use more training data ${ \sim } 2 5 0 { , } 0 0 0$ counting questions in the CLEVR training set versus $\sim 5 0 { , } 0 0 0$ counting questions in the VQA v2 training set), much simpler objects, and synthetic question structures.
More traditional approaches based on Lempitsky & Zisserman (2010) learn to produce a target density map, from which a count is computed by integrating over it. In this setting, Cohen et al. (2017) make use of overlaps of convolutional receptive fields to improve counting performance. Chattopadhyay et al. (2017) use an approach that divides the image into smaller non-overlapping chunks, each of which is counted individually and combined together at the end. In both of these contexts, the convolutional receptive fields or chunks can be seen as sets of bounding boxes with a fixed structure in their positioning. Note that while Chattopadhyay et al. (2017) evaluate their models on a small subset of counting questions in VQA, major differences in training setup make their results not comparable to our work.
# 3 PROBLEMS WITH SOFT ATTENTION
The main message in this section is that using the feature vectors obtained after the attention mechanism is not enough to be able to count; the attention maps themselves should be used, which is what we do in our counting component.
Models in VQA have consistently benefited from the use of soft attention (Mnih et al., 2014; Bahdanau et al., 2015) on the image, commonly implemented with a shallow convolutional network. It learns to output a weight for the feature vector at each spatial position in the feature map, which is first normalized and then used for performing a weighted sum over the spatial positions to produce a single feature vector. However, soft spatial attention severely limits the ability for a model to count.
Consider the task of counting the number of cats for two images: an image showing a single cat on a clean background and an image that consists of two side-by-side copies of the first image. What we will describe applies to both spatial feature maps and sets of object proposals as input, but we focus on the latter case for simplicity. With an object detection network, we detect one cat in the first image and two cats in the second image, producing the same feature vector for all three detections. The attention mechanism then assigns all three instances of the same cat the same weight.
 Figure 1: Simplified example about counting the number of cats. The light-colored cat is detected twice and results in a duplicate proposal. This shows the conversion from the attention weights a to a graph representation A and the eventual goal of this component with exactly one proposal per true object. There are 4 proposals (vertices) capturing 3 underlying objects (groups in dotted lines). There are 3 relevant proposals (black with weight 1) and 1 irrelevant proposal (white with weight 0). Red edges mark intra-object edges between duplicate proposals and blue edges mark the main inter-object duplicate edges. In graph form, the object groups, coloring of edges, and shading of vertices serve illustration purposes only; the model does not have these access to these directly.
The usual normalization used for the attention weights is the softmax function, which normalizes the weights to sum to 1. Herein lies the problem: the cat in the first image receives a normalized weight of 1, but the two cats in the second image now each receive a weight of 0.5. After the weighted sum, we are effectively averaging the two cats in the second image back to a single cat. As a consequence, the feature vector obtained after the weighted sum is exactly the same between the two images and we have lost all information about a possible count from the attention map. Any method that normalizes the weights to sum to 1 suffers from this issue.
Multiple glimpses (Larochelle & Hinton, 2010) – sets of attention weights that the attention mechanism outputs – or several steps of attention (Yang et al., 2016; Lu et al., 2016) do not circumvent this problem. Each glimpse or step can not separate out an object each, since the attention weight given to one feature vector does not depend on the other feature vectors to be attended over. Hard attention (Ba et al., 2015; Mnih et al., 2014) and structured attention (Kim et al., 2017) may be possible solutions to this, though no significant improvement in counting ability has been found for the latter so far (Zhu et al., 2017). Ren & Zemel (2017) circumvent the problem by limiting attention to only work within one bounding box at a time, remotely similar to our approach of using object proposal features.
Without normalization of weights to sum to one, the scale of the output features depends on the number of objects detected. In an image with 10 cats, the output feature vector is scaled up by 10. Since deep neural networks are typically very scale-sensitive – the scale of weight initializations and activations is generally considered quite important (Mishkin & Matas, 2016) – and the classifier would have to learn that joint scaling of all features is somehow related to count, this approach is not reasonable for counting objects. This is evidenced in Teney et al. (2017) where they provide evidence that sigmoid normalization not only degrades accuracy on non-number questions slightly, but also does not help with counting.
# 4 COUNTING COMPONENT
In this section, we describe a differentiable mechanism for counting from attention weights, while also dealing with the problem of overlapping object proposals to reduce double-counting of objects. This involves some nontrivial details to produce counts that are as accurate as possible. The main idea is illustrated in Figure 1 with the two main steps shown in Figure 2 and Figure 3. The use of this component allows a model to count while still being able to exploit the benefits of soft attention.
Our key idea for dealing with overlapping object proposals is to turn these object proposals into a graph that is based on how they overlap. We then remove and scale edges in a specific way such that an estimate of the number of underlying objects is recovered.
Our general strategy is to primarily design the component for the unrealistic extreme cases of perfect attention maps and bounding boxes that are either fully overlapping or fully distinct. By introducing some parameters and only using differentiable operations, we give the ability for the module to interpolate between the correct behaviours for these extreme cases to handle the more realistic cases.
These parameters are responsible for handling variations in attention weights and partial bounding box overlaps in a manner suitable for a given dataset.
To achieve this, we use several piecewise linear functions $f _ { 1 } , \ldots , f _ { 8 }$ as activation functions (defined in Appendix A), approximating arbitrary functions with domain and range [0, 1]. The shapes of these functions are learned to handle the specific nonlinear interactions necessary for dealing with overlapping proposals. Through their parametrization we enforce that $f _ { k } ( 0 ) = 0$ , $f _ { k } ( 1 ) = 1$ , and that they are monotonically increasing. The first two properties are required so that the extreme cases that we explicitly handle are left unchanged. In those cases, $f _ { k }$ is only applied to values of 0 or 1, so the activation functions can be safely ignored for understanding how the component handles them. By enforcing monotonicity, we can make sure that, for example, an increased value in an attention map should never result in the prediction of the count to decrease.
# 4.1 INPUT
Given a set of features from object proposals, an attention mechanism produces a weight for each proposal based on the question. The counting component takes as input the $n$ largest attention weights $\mathbf { \bar { a } } = [ a _ { 1 } , \ldots , a _ { n } ] ^ { \mathsf { T } }$ and their corresponding bounding boxes $\mathbf { b } = [ b _ { 1 } , \ldots , b _ { n } ] ^ { \mathsf { T } }$ . We assume that the weights lie in the interval $[ 0 , 1 ]$ , which can easily be achieved by applying a logistic function.
In the extreme cases that we explicitly handle, we assume that the attention mechanism assigns a value of 1 to $a _ { i }$ whenever the ith proposal contains a relevant object and a value of 0 whenever it does not. This is in line with what usual soft attention mechanisms learn, as they produce higher weights for relevant inputs. We also assume that either two object proposals fully overlap (in which case they must be showing the same object and thus receive the same attention weight) or that they are fully distinct (in which case they show different objects). Keep in mind that while we make these assumptions to make reasoning about the behaviour easier, the learned parameters in the activation functions are intended to handle the more realistic scenarios when the assumptions do not apply.
Instead of partially overlapping proposals, the problem now becomes the handling of exact duplicate proposals of underlying objects in a differentiable manner.
# 4.2 DEDUPLICATION
We start by changing the vector of attention weights a into a graph representation in which bounding boxes can be utilized more easily. Hence, we compute the outer product of the attention weights to obtain an attention matrix.
$$\mathbf { A } = \mathbf { a } \mathbf { a } ^ { \mathsf { T } }$$
$\mathbf { A } \in \mathbb { R } ^ { n \times n }$ can be interpreted as an adjacency matrix for a weighted directed graph. In this graph, the ith vertex represents the object proposal associated with $a _ { i }$ and the edge between any pair of vertices $( i , j )$ has weight $a _ { i } a _ { j }$ . In the extreme case where $a _ { i }$ is virtually 0 or 1, products are equivalent to logical AND operators. It follows that the subgraph containing only the vertices satisfying $a _ { i } = 1$ is a complete digraph with self-loops.
In this representation, our objective is to eliminate edges in such a way that, conceptually, the underlying true objects – instead of proposals thereof – are the vertices of that complete subgraph. In order to then turn that graph into a count, recall that the number of edges $| E |$ in a complete digraph with self-loops relates to the number of vertices $| V |$ through $| E | = | V | ^ { 2 }$ . $| E |$ can be computed by summing over the entries in an adjacency matrix and $| V |$ is then the count. Notice how when $| E |$ is set to the sum over A, ${ \sqrt { \textstyle | E | } } = \sum _ { i } a _ { i }$ holds. This convenient property implies that when all proposals are fully distinct, the component can output the same as simply summing over the original attention weights by default.
There are two types of duplicate edges to eliminate to achieve our objective: intra-object edges and inter-object edges.
# 4.2.1 INTRA-OBJECT EDGES
First, we eliminate intra-object edges between duplicate proposals of a single underlying object.

 Figure 2: Removal of intra-object edges by masking the edges of the attention matrix A with the distance matrix D. The black vertices now form a graph without self-loops. The self-loops need to be added back in later. Figure 3: Removal of duplicate inter-object edges by computing a scaling factor for each vertex and scaling $\tilde { \mathbf { A } } ^ { \prime }$ accordingly. $\bar { \mathbf { A } } ^ { \prime }$ is $\tilde { \mathbf { A } }$ with self-loops already added back in. The scaling factor for one vertex is computed by counting how many vertices have outgoing edges to the same set of vertices; all edges of the two proposals on the right are scaled by 0.5. This can be seen as averaging proposals within each object and is equivalent to removing duplicate proposals altogether under a sum.
To compare two bounding boxes, we use the usual intersection-over-union (IoU) metric. We define the distance matrix $\mathbf { D } \in \bar { \mathbb { R } } ^ { n \times n }$ to be
$$D _ { i j } = 1 - \mathrm { I o U } ( b _ { i } , b _ { j } )$$
$\mathbf { D }$ can also be interpreted as an adjacency matrix. It represents a graph that has edges everywhere except when the two bounding boxes that an edge connects would overlap.
Intra-object edges are removed by elementwise multiplying $( \odot )$ the distance matrix with the attention matrix (Figure 2).
$$\tilde { \mathbf { A } } = f _ { 1 } ( \mathbf { A } ) \odot f _ { 2 } ( \mathbf { D } )$$
$\tilde { \mathbf { A } }$ no longer has self-loops, so we need to add them back in at a later point to still satisfy $| E | = | V | ^ { 2 }$ Notice that we start making use of the activation functions mentioned earlier to handle intermediate values in the interval $( 0 , 1 )$ for both A and $\mathbf { D }$ . They regulate the influence of attention weights that are not close to 0 or 1 and the influence of partial overlaps.
# 4.2.2 INTER-OBJECT EDGES
Second, we eliminate inter-object edges between duplicate proposals of different underlying objects.
The main idea (depicted in Figure 3) is to count the number of proposals associated to each invidual object, then scale down the weight of their associated edges by that number. If there are two proposals of a single object, the edges involving those proposals should be scaled by 0.5. In essence, this averages over the proposals within each underlying object because we only use the sum over the edge weights to compute the count at the end. Conceptually, this reduces multiple proposals of an object down to one as desired. Since we do not know how many proposals belong to an object, we have to estimate this. We do this by using the fact that proposals of the same object are similar.
Keep in mind that $\tilde { \mathbf { A } }$ has no self-loops nor edges between proposals of the same object. As a consequence, two nonzero rows in $\tilde { \mathbf { A } }$ are the same if and only if the proposals are the same. If the two rows differ in at least one entry, then one proposal overlaps a proposal that the other proposal does not overlap, so they must be different proposals. This means for comparing rows, we need a similarity function that satisfies the criteria of taking the value 1 when they differ in no places and 0 if they differ in at least one place. We define a differentiable similarity between proposals $i$ and $j$ as
$$\mathrm { S i m } _ { i j } = f _ { 3 } ( 1 - | a _ { i } - a _ { j } | ) \prod _ { k } f _ { 3 } ( 1 - | X _ { i k } - X _ { j k } | )$$
where $\mathbf { X } = f _ { 4 } ( \mathbf { A } ) \odot f _ { 5 } ( \mathbf { D } )$ is the same as $\tilde { \mathbf { A } }$ except with different activation functions. The $\prod$ term compares the rows of proposals $i$ and $j$ . Using this term instead of $f _ { 4 } ( 1 - D _ { i j } )$ was more robust to inaccurate bounding boxes in initial experiments.
Note that the $f _ { 3 } ( 1 - | a _ { i } - a _ { j } | )$ term handles the edge case when there is only one proposal to count. Since $\mathbf { X }$ does not have self-loops, $\mathbf { X }$ contains only zeros in that case, which causes the row corresponding to $a _ { i } = 1$ to be incorrectly similar to the rows where $a _ { j \neq i } = 0$ . By comparing the attention weights through that term as well, this issue is avoided.
Now that we can check how similar two proposals are, we count the number of times any row is the same as any other row and compute a scaling factor $s _ { i }$ for each vertex $i$ .
$$s _ { i } = 1 / \sum _ { j } \mathrm { S i m } _ { i j }$$
The time complexity of computing $\mathbf { s } = [ s _ { 1 } , \ldots , s _ { n } ] ^ { \mathsf { T } }$ is $\Theta ( n ^ { 3 } )$ as there are $n ^ { 2 }$ pairs of rows and $\Theta ( n )$ operations to compute the similarity of any pair of rows.
Since these scaling factors apply to each vertex, we have to expand s into a matrix using the outer product in order to scale both incoming and outgoing edges of each vertex. We can also add self-loops back in, which need to be scaled by s as well. Then, the count matrix $\mathbf { C }$ is
$$\mathbf { C } = \tilde { \mathbf { A } } \odot \mathbf { s s } ^ { \mathsf { T } } + \mathrm { { d i a g } } ( \mathbf { s } \odot f _ { 1 } ( \mathbf { a } \odot \mathbf { a } ) )$$
where $\mathrm { d i a g ( \cdot ) }$ expands a vector into a diagonal matrix with the vector on the diagonal.
The scaling of self-loops involves a non-obvious detail. Recall that the diagonal that was removed when going from $\mathbf { A }$ to $\tilde { \mathbf { A } }$ contains the entries $f _ { 1 } ( \mathbf { a } \odot \mathbf { a } )$ . Notice however that we are scaling this diagonal by s and not s $\odot$ s. This is because the number of inter-object edges scales quadratically with respect to the number of proposals per object, but the number of self-loops only scales linearly.
# 4.3 OUTPUT
Under a sum, $\mathbf { C }$ is now equivalent to a complete graph with self-loops that involves all relevant objects instead of relevant proposals as originally desired.
To turn $\mathbf { C }$ into a count $c$ , we set $\begin{array} { r } { | E | = \sum _ { i , j } C _ { i j } } \end{array}$ as mentioned and
$$c = | V | = \sqrt { | E | }$$
We verified experimentally that when our extreme case assumptions hold, $c$ is always an integer and equal to the correct count, regardless of the number of duplicate object proposals.
To avoid issues with scale when the number of objects is large, we turn this single feature into several classes, one for each possible number. Since we only used the object proposals with the largest $n$ weights, the predicted count $c$ can be at most $n$ . We define the output $\mathbf { o } ^ { \mathsf { ^ { - } } } = [ o _ { 0 } , o _ { 1 } , \ldots , o _ { n } ] ^ { \mathsf { T } }$ to be
$$o _ { i } = \operatorname* { m a x } ( 0 , 1 - | c - i | )$$
This results in a vector that is 1 at the index of the count and 0 everywhere else when $c$ is exactly an integer, and a linear interpolation between the two corresponding one-hot vectors when the count falls inbetween two integers.
# 4.3.1 OUTPUT CONFIDENCE
Finally, we might consider a prediction made from values of a and $\mathbf { D }$ that are either close to 0 or close to 1 to be more reliable – we explicitly handle these after all – than when many values are close to 0.5. To incorporate this idea, we scale $\mathbf { o }$ by a confidence value in the interval $[ 0 , 1 ]$ .
We define $p _ { \mathbf { a } }$ and $p _ { \mathbf { D } }$ to be the average distances to 0.5. The choice of 0.5 is not important, because the module can learn to change it by changing where $f _ { 6 } ( x ) = 0 . 5$ and $f _ { 7 } ( x ) = 0 . 5$ .
$$\begin{array} { l } { { \displaystyle p _ { \mathbf { a } } = \frac { 1 } { n } \sum _ { i } \left. f _ { 6 } ( a _ { i } ) - 0 . 5 \right. } } \\ { { \displaystyle p _ { \mathbf { D } } = \frac { 1 } { n ^ { 2 } } \sum _ { i , j } \left. f _ { 7 } ( D _ { i j } ) - 0 . 5 \right. } } \end{array}$$
Then, the output of the component with confidence scaling is
$$\tilde { \mathbf { o } } = f _ { 8 } ( p _ { \mathbf { a } } + p _ { \mathbf { D } } ) \cdot \mathbf { o }$$
In summary, we only used diffentiable operations to deduplicate object proposals and obtain a feature vector that represents the predicted count. This allows easy integration into any model with soft attention, enabling a model to count from an attention map.
# 5 EXPERIMENTS
# 5.1 TOY TASK
First, we design a simple toy task to evaluate counting ability. This dataset is intended to only evaluate the performance of counting; thus, we skip any processing steps that are not directly related such as the processing of an input image. Samples from this dataset are given in Appendix D
The classification task is to predict an integer count $\hat { c }$ of true objects, uniformly drawn from 0 to 10 inclusive, from a set of bounding boxes and the associated attention weights. 10 square bounding boxes with side length $l \in ( 0 , 1 \bar { ] }$ are placed in a square image with unit side length. The $\mathbf { X }$ and y coordinates of their top left corners are uniformly drawn from $U ( 0 , 1 - l )$ so that the boxes do not extend beyond the image border. $l$ is used to control the overlapping of bounding boxes: a larger $l$ leads to the fixed number of objects to be more tightly packed, increasing the chance of overlaps. $\hat { c }$ number of these boxes are randomly chosen to be true bounding boxes. The score of a bounding box is the maximum IoU overlap of it with any true bounding box. Then, the attention weight is a linear interpolation between the score and a noise value drawn from $U ( 0 , 1 )$ , with $q \in [ 0 , 1 ]$ controlling this trade-off. $q$ is the attention noise parameter: when $q$ is 0, there is no noise and when $q$ is 1, there is no signal. Increasing $q$ also indirectly simulates imprecise placements of bounding boxes.
We compare the counting component against a simple baseline that simply sums the attention weights and turns the sum into a feature vector with Equation 8. Both models are followed by a linear projection to the classes 0 to 10 inclusive and a softmax activation. They are trained with crossentropy loss for 1000 iterations using Adam (Kingma & Ba, 2015) with a learning rate of 0.01 and a batch size of 1024.
# 5.1.1 RESULTS
The results of varying $l$ while keeping $q$ fixed at various values and vice versa are shown in Figure 4. Regardless of $l$ and $q$ , the counting component performs better than the baseline in most cases, often significantly so. Particularly when the noise is low, the component can deal with high values for $l$ very successfully, showing that it accomplishes the goal of increased robustness to overlapping proposals. The component also handles moderate noise levels decently as long as the overlaps are limited. The performance when both $l$ and $q$ are high is closely matched by the baseline, likely due to the high difficulty of those parametrizations leaving little information to extract in the first place.
We can also look at the shape of the activation functions themselves, shown in Figure 5 and Appendix C, to understand how the behaviour changes with varying dataset parameters. For simplicity, we limit our description to the two easiest-to-interpret functions: $f _ { 1 }$ for the attention weights and $f _ { 2 }$ for the bounding box distances.
 Figure 4: Accuracies on the toy task as side length $l$ and noise $q$ are varied in 0.01 step sizes.
 Figure 5: Shapes of trained activation functions $f _ { 1 }$ (attention weights) and $f _ { 2 }$ (bounding box distances) for varying bounding box side lengths (left) or the noise (right) in the dataset, varied in 0.01 step sizes. Best viewed in color.
When increasing the side length, the height of the “step” in $f _ { 1 }$ decreases to compensate for the generally greater degree of overlapping bounding boxes. A similar effect is seen with $f _ { 2 }$ : it varies over requiring a high pairwise distance when $l$ is low – when partial overlaps are most likely spurious – and considering small distances enough for proposals to be considered different when $l$ is high. At the highest values for $l$ , there is little signal in the overlaps left since everything overlaps with everything, which explains why $f _ { 2 }$ returns to its default linear initialization for those parameters.
When varying the amount of noise, without noise $f _ { 1 }$ resembles a step function where the step starts close to $x = 1$ and takes a value of close to 1 after the step. Since a true proposal will always have a weight of 1 when there is no noise, anything below this can be safely zeroed out. With increasing noise, this step moves away from 1 for both $x$ and $f _ { 1 } ( x )$ , capturing the uncertainty when a bounding box belongs to a true object. With lower $q$ , $f _ { 2 }$ considers a pair of proposals to be distinct for lower distances, whereas with higher $q$ , $f _ { 2 }$ follows a more sigmoidal shape. This can be explained by the model taking the increased uncertainty of the precise bounding box placements into account by requiring higher distances for proposals to be considered completely different.
# 5.2 VQA
VQA v2 (Goyal et al., 2017) is the updated version of the VQA v1 dataset (Antol et al., 2015) where greater care has been taken to reduce dataset biases through balanced pairs: for each question, a pair of images is identified where the answer to that question differs. The standard accuracy metric on this dataset accounts for disagreements in human answers by averaging $\mathrm { m i n } ( \textstyle { \frac { 1 } { 3 } }$ agreeing, 1) over all 10-choose-9 subsets of human answers, where agreeing is the number of human answers that agree with the given answer. This can be shown to be equal to $\operatorname* { m i n } ( 0 . 3 a g r e e i n g , 1 )$ without averaging.
We use an improved version of the strong VQA baseline by Kazemi & Elqursh (2017) as baseline model (details in Appendix B). We have not performed any tuning of this baseline to maximize the performance difference between it and the baseline with counting module. To augment this model with the counting component, we extract the attention weights of the first attention glimpse (there are two in the baseline) before softmax normalization, and feed them into the counting component after applying a logistic function. Since object proposal features from Anderson et al. (2017) vary from 10 to 100 per image, a natural choice for the number of top- $^ n$ proposals to use is 10. The output of the component is linearly projected into the same space as the hidden layer of the classifier, followed by ReLU activation, batch normalization, and addition with the features in the hidden layer.
Table 1: Results on VQA v2 of the top models along with our results. Entries marked with (Ens.) are ensembles of models. At the time of writing, our model with the counting module places third among all entries. All models listed here use object proposal features and are trained on the training and validation sets. The top-performing ensemble models use additional pre-trained word embeddings, which we do not use.
<table><tr><td></td><td colspan="4">VQA v2 test-dev</td><td colspan="4">VQA v2 test</td></tr><tr><td>Model</td><td>Yes/No</td><td>Number</td><td>Other</td><td>All</td><td>Yes/No</td><td>Number</td><td>Other</td><td>All</td></tr><tr><td>Teney et al. (2017)</td><td>81.82</td><td>44.21</td><td>56.05</td><td>65.32</td><td>82.20</td><td>43.90</td><td>56.26</td><td>65.67</td></tr><tr><td>Teney et al. (2017) (Ens.)</td><td>86.08</td><td>48.99</td><td>60.80</td><td>69.87</td><td>86.60</td><td>48.64</td><td>61.15</td><td>70.34</td></tr><tr><td>Zhou et al. (2017)</td><td>84.27</td><td>49.56</td><td>59.89</td><td>68.76</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>Zhou et al. (2017) (Ens.)</td><td>1</td><td>1</td><td>1</td><td>1</td><td>86.65</td><td>51.13</td><td>61.75</td><td>70.92</td></tr><tr><td>Baseline</td><td>82.98</td><td>46.88</td><td>58.99</td><td>67.50</td><td>83.21</td><td>46.60</td><td>59.20</td><td>67.78</td></tr><tr><td>+ counting module</td><td>83.14</td><td>51.62</td><td>58.97</td><td>68.09</td><td>83.56</td><td>51.39</td><td>59.11</td><td>68.41</td></tr></table>
Table 2: Results on the VQA v2 validation set with models trained only on the training set. Reported are the mean accuracies and sample standard deviations $( \pm )$ over 4 random initializations.
<table><tr><td></td><td colspan="3">VQA accuracy</td><td colspan="3">Balanced pair accuracy</td></tr><tr><td>Model</td><td>Number</td><td>Count</td><td>All</td><td>Number</td><td>Count</td><td>All</td></tr><tr><td>Baseline</td><td>44.83±0.2</td><td>51.69±0.2</td><td>64.80±0.0</td><td>17.34±0.2</td><td>20.02±0.2</td><td>36.44±0.1</td></tr><tr><td>+ NMS</td><td>44.60±0.1</td><td>51.41±0.1</td><td>64.80±0.1</td><td>17.06±0.1</td><td>19.72±0.1</td><td>36.44±0.2</td></tr><tr><td> + counting module</td><td>49.36±0.1</td><td>57.03±0.0</td><td>65.42±0.1</td><td>23.10±0.2</td><td>26.63±0.2</td><td>37.19±0.1</td></tr></table>
# 5.2.1 RESULTS
Table 1 shows the results on the official VQA v2 leaderboard. The baseline with our component has a significantly higher accuracy on number questions without compromising accuracy on other categories compared to the baseline result. Despite our single-model baseline being substantially worse than the state-of-the-art, by simply adding the counting component we outperform even the 8-model ensemble in Zhou et al. (2017) on the number category. We expect further improvements in number accuracy when incorporating their techniques to improve the quality of attention weights, especially since the current state-of-the-art models suffer from the problems with counting that we mention in section 3. Some qualitative examples of inputs and activations within the counting component are shown in Appendix E.
We also evaluate our models on the validation set of VQA v2, shown in Table 2. This allows us to consider only the counting questions within number questions, since number questions include questions such as ”what time is it?” as well. We treat any question starting with the words ”how many” as a counting question. As we expect, the benefit of using the counting module on the counting question subset is higher than on number questions in general. Additionally, we try an approach where we simply replace the counting module with NMS, using the average of the attention glimpses as scoring, and one-hot encoding the number of proposals left. The NMS-based approach, using an IoU threshold of 0.5 and no score thresholding based on validation set performance, does not improve on the baseline, which suggests that the piecewise gradient of NMS is a major problem for learning to count in VQA and that conversely, there is a substantial benefit to being able to differentiate through the counting module.
Additionally, we can evaluate the accuracy over balanced pairs as proposed by Teney et al. (2017): the ratio of balanced pairs on which the VQA accuracy for both questions is 1.0. This is a much more difficult metric, since it requires the model to find the subtle details between images instead of being able to rely on question biases in the dataset. First, notice how all balanced pair accuracies are greatly reduced compared to their respective VQA accuracy. More importantly, the absolute accuracy improvement of the counting module is still fully present with the more challenging metric, which is further evidence that the component can properly count rather than simply fitting better to dataset biases.
When looking at the activation functions of the trained model, shown in Figure 9, we find that some characteristics of them are shared with high-noise parametrizations of the toy dataset. This suggests that the current attention mechanisms and object proposal network are still very inaccurate, which explains the perhaps small-seeming increase in counting performance. This provides further evidence that the balanced pair accuracy is maybe a more reflective measure of how well current VQA models perform than the overall VQA accuracies of over $70 \%$ of the current top models.
# 6 CONCLUSION
After understanding why VQA models struggle to count, we designed a counting component that alleviates this problem through differentiable bounding box deduplication. The component can readily be used alongside any future improvements in VQA models, as long as they still use soft attention as all current top models on VQA v2 do. It has uses outside of VQA as well: for many counting tasks, it can allow an object-proposal-based approach to work without ground-truth objects available as long as there is a – possibly learned – per-proposal scoring (for example using a classification score) and a notion of how dissimilar a pair of proposals are. Since each step in the component has a clear purpose and interpretation, the learned weights of the activation functions are also interpretable. The design of the counting component is an example showing how by encoding inductive biases into a deep learning model, challenging problems such as counting of arbitrary objects can be approached when only relatively little supervisory information is available.
For future research, it should be kept in mind that VQA v2 requires a versatile skill set that current models do not have. To make progress on this dataset, we advocate focusing on understanding of what the current shortcomings of models are and finding ways to mitigate them.
# REFERENCES
Peter Anderson, Xiaodong He, Chris Buehler, Damien Teney, Mark Johnson, Stephen Gould, and Lei Zhang. Bottom-up and top-down attention for image captioning and VQA. CoRR, arXiv:1707.07998, 2017. Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C. Lawrence Zitnick, and Devi Parikh. VQA: Visual Question Answering. In ICCV, 2015. Samaneh Azadi, Jiashi Feng, and Trevor Darrell. Learning detection with diverse proposals. In CVPR, 2017. Jimmy Ba, Volodymyr Mnih, and Koray Kavukcuoglu. Multiple object recognition with visual attention. In ICLR, 2015. Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015. Prithvijit Chattopadhyay, Ramakrishna Vedantam, Ramprasaath R. Selvaraju, Dhruv Batra, and Devi Parikh. Counting everyday objects in everyday scenes. In CVPR, 2017. Kyunghyun Cho, B van Merrienboer, Dzmitry Bahdanau, and Yoshua Bengio. On the properties of neural machine translation: Encoder-decoder approaches. In SSST@EMNLP, 2014. Joseph Paul Cohen, Henry Z. Lo, and Yoshua Bengio. Count-ception: Counting by fully convolutional redundant counting. CoRR, arXiv:1703.08710, 2017. 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 CVPR, 2017.
Paul Henderson and Vittorio Ferrari. End-to-end training of object class detectors for mean average precision. In ACCV, 2017.
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Computation, 1997.
Jan Hosang, Rodrigo Benenson, and Bernt Schiele. Learning non-maximum suppression. In CVPR, 2017.
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
Allan Jabri, Armand Joulin, and Laurens van der Maaten. Revisiting visual question answering baselines. In ECCV, 2016.
Max Jaderberg, Karen Simonyan, Andrew Zisserman, and Koray Kavukcuoglu. Spatial transformer networks. In NIPS, 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 CVPR, 2017.
Vahid Kazemi and Ali Elqursh. Show, ask, attend, and answer: A strong baseline for visual question answering. CoRR, arXiv:1704.03162, 2017.
Yoon Kim, Carl Denton, Luong Hoang, and Alexander M. Rush. Structured attention networks. In ICLR, 2017.
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
Hugo Larochelle and Geoffrey E Hinton. Learning to combine foveal glimpses with a third-order boltzmann machine. In NIPS, 2010.
Victor Lempitsky and Andrew Zisserman. Learning to count objects in images. In NIPS, 2010.
Jiasen Lu, Jianwei Yang, Dhruv Batra, and Devi Parikh. Hierarchical question-image co-attention for visual question answering. In NIPS, 2016.
Dmytro Mishkin and Jiri Matas. All you need is a good init. In ICLR, 2016.
Volodymyr Mnih, Nicolas Heess, Alex Graves, and Koray Kavukcuoglu. Recurrent models of visual attention. In NIPS, 2014.
Ethan Perez, Florian Strub, Harm de Vries, Vincent Dumoulin, and Aaron Courville. FiLM: Visual reasoning with a general conditioning layer. CoRR, arXiv:1709.07871, 2017.
Mengye Ren and Richard S. Zemel. End-to-end instance segmentation with recurrent attention. In CVPR, 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 NIPS, 2017.
Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. JMLR, 2014.
Damien Teney, Peter Anderson, Xiaodong He, and Anton van den Hengel. Tips and tricks for visual question answering: Learnings from the 2017 challenge. CoRR, arXiv:1708.02711, 2017.
Alexander Trott, Caiming Xiong, and Richard Socher. Interpretable counting for visual question answering. In ICLR, 2018.
Zichao Yang, Xiaodong He, Jianfeng Gao, Li Deng, and Alexander J. Smola. Stacked attention networks for image question answering. In CVPR, 2016.
Seungil You, David Ding, Kevin Canini, Jan Pfeifer, and Maya Gupta. Deep Lattice Networks and Partial Monotonic Functions. In NIPS, 2017.
Yu Zhou, Yu Jun, Xiang Chenchao, Fan Jianping, and Tao Dacheng. Beyond bilinear: Generalized multi-modal factorized high-order pooling for visual question answering. CoRR, arXiv:1708.03619, 2017.
Chen Zhu, Yanpeng Zhao, Shuaiyi Huang, Kewei Tu, and Yi Ma. Structured attentions for visual question answering. CoRR, arXiv:1708.02071, 2017.
# A PIECEWISE LINEAR ACTIVATION FUNCTION
Intuitively, the interval $[ 0 , 1 ]$ is split into $d$ equal size intervals. Each contains a line segment that is connected to the neighboring line segments at the boundaries of the intervals. These line segments form the shape of the activation function.
For each function $f _ { k }$ , there are $d$ weights $w _ { k 1 } , \ldots , w _ { k d }$ , where the weight $w _ { k i }$ is the gradient for the interval $[ \textstyle { \frac { i - 1 } { d } } , \textstyle { \frac { i } { d } } )$ . We arbitrarily fix $d$ to be 16 in this paper, observing no significant difference when changing it to 8 and 32 in preliminary experiments. All $w _ { k i }$ are enforced to be non-negative by always using the absolute value of them, which yields the monotonicity property. Dividing the weights by $\Sigma _ { m } ^ { d } \mid w _ { k m } \mid$ yields the property that $f ( 1 ) = 1$ . The function can be written as
$$f _ { k } ( x ) = \sum _ { i = 1 } ^ { d } \operatorname* { m a x } ( 0 , 1 - | d x - i | ) \frac { \sum _ { j = 1 } ^ { i } | w _ { k j } | } { \sum _ { m = 1 } ^ { d } | w _ { k m } | }$$
In essence, the max term selects the two nearest boundary values of an interval, which are normalized cumulative sums over the $w _ { k }$ weights, and linearly interpolates between the two. This approach is similar to the subgradient approach by Jaderberg et al. (2015) to make sampling from indices differentiable. All $w _ { k i }$ are initialized to 1, which makes the functions linear on initialization. When applying $f _ { k } ( { \bf x } )$ to a vector-valued input $\mathbf { x }$ , it is assumed to be applied elementwise. By caching the normalized cumulative sum $\begin{array} { r } { \sum _ { j } ^ { i } | w _ { k j } | / \sum _ { m } ^ { d } | w _ { k m } | } \end{array}$ , this function has linear time complexity with respect to $d$ and is efficiently implementable on GPUs.
Extensions to this are possible through Deep Lattice Networks (You et al., 2017), which preserve monotonicity across several nonlinear neural network layers. They would allow A and $\mathbf { D }$ to be combined in more sophisticated ways beyond an elementwise product, possibly improving counting performance as long as the property of the range lying within $[ 0 , 1 ]$ is still enforced in some way.
# B BASELINE ARCHITECTURE
This model is based on the work of Kazemi & Elqursh (2017), who outperformed most previous VQA models on the VQA v1 dataset with a simple baseline architecture. We adapt the model to the VQA v2 dataset and make various tweaks that improve validation accuracy slightly. The architecture is illustrated in Figure 6. Details not mentioned here can be assumed to be the same as in their paper.
The most significant change that we make is the use of object proposal features by Anderson et al. (2017) as previously mentioned. The following tweaks were made without considering the performance impact on the counting component; only the validation accuracy of the baseline was optimized.
To fuse vision features $\mathbf { x }$ and question features y, the baseline concatenates and linearly projects them, followed by a ReLU activation. This is equivalent to ReLU $( \mathbf { W } _ { x } \mathbf { x } + \mathbf { W } _ { y } \mathbf { y } )$ . We include an additional term that measures how different the projected $\mathbf { x }$ is from the projected y, changing the fusion mechanism to $\mathbf { x } \odot \mathbf { y } = \operatorname { R e L U } ( \mathbf { W } _ { x } \mathbf { x } + \mathbf { W } _ { y } \mathbf { y } ) - ( \mathbf { W } _ { x } \mathbf { x } - \mathbf { W } _ { y } \mathbf { y } ) ^ { 2 }$ .
The LSTM (Hochreiter & Schmidhuber, 1997) for question encoding is replaced with a GRU (Cho et al., 2014) with the same hidden size with dynamic per-example unrolling instead of a fixed 14 words per question. We apply batch normalization (Ioffe & Szegedy, 2015) before the last linear projection in the classifier to the 3000 classes. The learning rate is increased from 0.001 to 0.0015 and the batch size is doubled to 256. The model is trained for 100 epochs (1697 iterations per epoch to train on the training set, 2517 iterations per epoch to train on both training and validation sets) instead of 100,000 iterations, roughly in line with the doubling of dataset size when going from VQA v1 to VQA v2.
Note that this single-model baseline is regularized with dropout (Srivastava et al., 2014), while the other current top models skip this and rely on ensembling to reduce overfitting. This explains why our single-model baseline outperforms most single-model results of the state-of-the-art models. We found ensembling of the regularized baseline to provide a much smaller benefit in preliminary experiments compared to the results of ensembling unregularized networks reported in Teney et al. (2017).
 Figure 6: Schematic view of a model using our counting component. The modifications made to the baseline model when including the counting component are marked in red. Blue blocks mark components with trainable parameters, gray blocks mark components without trainable parameters. White $\textsuperscript { \textregistered }$ mark linear layers, either linear projections or convolutions with a spatial size of 1 depending on the context. Dropout with drop probability 0.5 is applied before the GRU and every $\textsuperscript { \textregistered }$ , except before the $\textsuperscript { \textregistered }$ after the counting component. $\diamond$ stands for the fusion function we define in Appendix B, BN stands for batch normalization, $\sigma$ stands for a logistic, and Embedding is a word embedding that has been fed through a tanh function. The two glimpses of the attention mechanism are represented with the two lines exiting the $\textsuperscript { \textregistered }$ . Note that one of the two glimpses is shared with the counting component.
 Figure 7: Shape of activation functions as $l$ is varied for $q = 0 . 5$ on the toy dataset. Each line shows the shape of the activation function when $l$ is set to the value associated to its color. Best viewed in color.
 Figure 8: Shape of activation functions as $q$ is varied for $l = 0 . 5$ on the toy dataset. Each line shows the shape of the activation function when $q$ is set to the value associated to its color. Best viewed in color.
 Figure 9: Shape of activation functions for a model trained on the train and validation sets of VQA v2 (thick black), compared against the shapes when parametrizing the toy dataset with $q$ around 0.4 (green), 0.7 (orange), or 1.0 (red) with fixed $l = 0 . 2$ . Best viewed in color.
 Figure 10: Example toy dataset data for varying bounding box side lengths $l$ and noise $q$ . The ground truth column shows bounding boxes of randomly placed true objects (blue) and of irrelevant objects (red). The data column visualizes the samples that are actually used as input (dark blues represent weights close to 1, dark reds represent weights close to 0, lighter colors represent weights closer to 0.5). The weight of the ith bounding box $b _ { i }$ is defined as $a _ { i } = ( 1 - q )$ score $+ q z$ where the score is the maximum overlap of $b _ { i }$ with any true bounding box or 0 if there are no true bounding boxes and $z$ is drawn from $U ( 0 , 1 )$ . Note how this turns red bounding boxes that overlap a lot with a blue bounding box in the ground truth column into a blue bounding box in the data column, which simulates the duplicate proposal that we have to deal with. Best viewed in color.
 Figure 11: Selection of validation images with overlaid bounding boxes, values of the attention matrix A, distance matrix D, and the resulting count matrix C. White entries represent values close to 1, black entries represent values close to 0. The count $c$ is the usual square root of the sum over the elements of C. Notice how particularly in the third example, A clearly contains more rows/columns with high activations than there are actual objects (a sign of overlapping bounding boxes) and the counting module successfully removes intra- and inter-object edges to arrive at the correct prediction regardless. The prediction is not necessarily – though often is – the rounded value of $c$ .123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195# PIXEL DECONVOLUTIONAL NETWORKS
Anonymous authors Paper under double-blind review
# ABSTRACT
Deconvolutional layers have been widely used in a variety of deep models for up-sampling, including encoder-decoder networks for semantic segmentation and deep generative models for unsupervised learning. One of the key limitations of deconvolutional operations is that they result in the so-called checkerboard problem. This is caused by the fact that no direct relationship exists among adjacent pixels on the output feature map. To address this problem, we propose the pixel deconvolutional layer (PixelDCL) to establish direct relationships among adjacent pixels on the up-sampled feature map. Our method is based on a fresh interpretation of the regular deconvolution operation. The resulting PixelDCL can be used to replace any deconvolutional layer in a plug-and-play manner without compromising the fully trainable capabilities of original models. The proposed PixelDCL may result in slight decrease in efficiency, but this can be overcome by an implementation trick. Experimental results on semantic segmentation demonstrate that PixelDCL can consider spatial features such as edges and shapes and yields more accurate segmentation outputs than deconvolutional layers. When used in image generation tasks, our PixelDCL can largely overcome the checkerboard problem suffered by regular deconvolution operations.
# 1 INTRODUCTION
Deep learning methods have shown great promise in a variety of artificial intelligence tasks such as image classification (Krizhevsky et al., 2012; Simonyan & Zisserman, 2014), semantic segmentation (Noh et al., 2015; Shelhamer et al., 2016; Ronneberger et al., 2015), and natural image generation (Goodfellow et al., 2014; Kingma & Welling, 2014; Oord et al., 2016). Some key network layers, such as convolutional layers (LeCun et al., 1998), pooling layers, fully connected layers and deconvolutional layers, have been frequently used to create deep models for different tasks. Deconvolutional layers, also known as transposed convolutional layers (Vedaldi & Lenc, 2015), are initially proposed in (Zeiler et al., 2010; 2011). They have been primarily used in deep models that require up-sampling of feature maps, such as generative models (Radford et al., 2015; Makhzani & Frey, 2015; Rezende et al., 2014) and encoder-decoder architectures (Ronneberger et al., 2015; Noh et al., 2015). Although deconvolutional layers are capable of producing larger feature maps from smaller ones, they suffer from the problem of checkerboard artifacts (Odena et al., 2016). This greatly limits deep model’s capabilities in generating photo-realistic images and producing smooth outputs on semantic segmentation. To date, very little efforts have been devoted to improving the deconvolution operation.
In this work, we propose a simple, efficient, yet effective method, known as the pixel deconvolutional layer (PixelDCL), to address the checkerboard problem suffered by deconvolution operations. Our method is motivated from a fresh interpretation of deconvolution operations, which clearly pinpoints the root of checkerboard artifacts. That is, the up-sampled feature map generated by deconvolution can be considered as the result of periodical shuffling of multiple intermediate feature maps computed from the input feature map by independent convolutions. As a result, adjacent pixels on the output feature map are not directly related, leading to the checkerboard artifacts. To overcome this problem, we propose the pixel deconvolutional operation to be used in PixelDCL. In this new layer, the intermediate feature maps are generated sequentially so that feature maps generated in a later stage are required to depend on previously generated ones. In this way, direct relationships among adjacent pixels on the output feature map have been established. Sequential generation of intermediate feature maps in PixelDCL may result in slight decrease in computational efficiency, but we show that this can be largely overcome by an implementation trick. Experimental results on semantic segmentation (samples in Figure 1) and image generation tasks demonstrate that the proposed PixelDCL can effectively overcome the checkerboard problem and improve predictive and generative performance.
 Figure 1: Comparison of semantic segmentation results. The first and second rows are images and ground true labels, respectively. The third and fourth rows are the results of using regular deconvolution and our proposed pixel deconvolution PixelDCL, respectively.
Our work is related to the pixel recurrent neural networks (PixelRNNs) (Oord et al., 2016) and PixelCNNs (van den Oord et al., 2016; Reed et al., 2017), which are generative models that consider the relationship among units on the same feature map. They belong to a more general class of autoregressive methods for probability density estimation (Germain et al., 2015; Gregor et al., 2015; Larochelle & Murray, 2011). By using masked convolutions in training, the training time of PixelRNNs and PixelCNNs is comparable to that of other generative models such as generative adversarial networks (GANs) (Goodfellow et al., 2014; Reed et al., 2016) and variational autoencoders (VAEs) (Kingma & Welling, 2014; Johnson et al., 2016). However, the prediction time of PixelRNNs or PixelCNNs is very slow since it has to generate images pixel by pixel. In contrast, our PixelDCL can be used to replace any deconvolutional layer in a plug-and-play manner, and the slight decrease in efficiency can be largely overcome by an implementation trick.
# 2 PIXEL DECONVOLUTIONAL LAYERS AND NETWORKS
We introduce deconvolutional layers and analyze the cause of checkerboard artifacts in this section. We then propose the pixel deconvolutional layers and the implementation trick to improve efficiency.
# 2.1 DECONVOLUTIONAL LAYERS
Deconvolutional networks and deconvolutional layers are proposed in (Zeiler et al., 2010; 2011). They have been widely used in deep models for applications such as semantic segmentation (Noh et al., 2015) and generative models (Kingma & Welling, 2014; Goodfellow et al., 2014; Oord et al., 2016). Many encoder-decoder architectures use deconvolutional layers in decoders for up-sampling. One way of understanding deconvolutional operations is that the up-sampled output feature map is obtained by periodical shuffling of multiple intermediate feature maps obtained by applying multiple convolutional operations on the input feature maps (Shi et al., 2016).
This interpretation of deconvolution in 1D and 2D is illustrated in Figures 2 and 3, respectively. It is clear from these illustrations that standard deconvolutional operation can be decomposed into several convolutional operations depending on the up-sampling factor. In the following, we assume the up-sampling factor is two, though deconvolution operations can be applied to more generic settings. Formally, given an input feature map $F _ { i n }$ , a deconvolutional layer can be used to generate
 Figure 2: Illustration of 1D deconvolutional operation. In this deconvolutional layer, a $4 \times 1$ feature map is up-sampled to an $8 \times 1$ feature map. The left figure shows that each input unit passes through an $1 \times 4$ kernel. The output feature map is obtained as the sum of values in each column. It can be seen from this figure that the purple outputs are only related to (1, 3) entries in the kernel, while the orange outputs are only related to (2, 4) entries in the kernel. Therefore, 1D deconvolution can be decomposed as two convolutional operations shown in the right figure. The two intermediate feature maps generated by convolutional operations are dilated and combined to obtain the final output. This indicates that the standard deconvolutional operation can be decomposed into multiple convolutional operations.
 Figure 3: Illustration of 2D deconvolutional operation. In this deconvolutional layer, a $4 \times 4$ feature map is up-sampled to an $8 \times 8$ feature map. Four intermediate feature maps (purple, orange, blue, and red) are generated using four different convolutional kernels. Then these four intermediate feature maps are shuffled and combined to produce the final $8 \times 8$ feature map. Note that the four intermediate feature maps rely on the input feature map but with no direct relationship among them.
an up-sampled output $F _ { o u t }$ as follows:
$$\begin{array} { r l r l r l } { F _ { 1 } = F _ { i n } \oplus k _ { 1 } , } & { } & { F _ { 2 } = F _ { i n } \oplus k _ { 2 } , } & { } & { F _ { 3 } = F _ { i n } \oplus k _ { 3 } , } & { } & { F _ { 4 } = F _ { i n } \oplus k _ { 4 } , } \\ & { } & { F _ { o u t } = F _ { 1 } \oplus F _ { 2 } \oplus F _ { 3 } \oplus F _ { 4 } , } & { } & { F _ { o u t } = F _ { i n } \oplus k _ { 2 } , } \end{array}$$
where $\circledast$ denotes the convolutional operation and $\oplus$ denotes the periodical shuffling and combination operation as in Figure 3, $F _ { i }$ is the intermediate feature map generated by the corresponding convolutional kernel $k _ { i }$ for $i = 1 , \cdots , 4$ .
It is clear from the above interpretation of deconvolution that there is no direct relationship among these intermediate feature maps since they are generated by independent convolutional kernels. Although pixels of the same position on intermediate feature maps depend on the same receptive field of the input feature map, they are not directly related to each other. Due to the periodical shuffling operation, adjacent pixels on the output feature map are from different intermediate feature maps. This implies that the values of adjacent pixels can be significantly different from each other, resulting in the problem of checkerboard artifacts (Odena et al., 2016) as illustrated in Figure 4. One way to alleviate checkerboard artifacts is to apply post-processing such as smoothing (Li et al., 2001), but this adds additional complexity to the network and makes the entire network not fully trainable. In this work, we propose the pixel deconvolutional operation to add direct dependencies among intermediate feature maps, thereby making the values of adjacent pixels close to each other and effectively solving the checkerboard artifact problem. In addition, our pixel deconvolutional layers can be easily used to replace any deconvolutional layers without compromising the fully trainable capability.
 Figure 4: Illustration of the checkerboard problem in semantic segmentation using deconvolutional layers. The first and second rows are the original images and semantic segmentation results, respectively.
# 2.2 PIXEL DECONVOLUTIONAL LAYERS
To solve the checkerboard problem in deconvolutional layers, we propose the pixel deconvolutional layers (PixelDCL) that can add dependencies among intermediate feature maps. As adjacent pixels are from different intermediate feature maps, PixelDCL can build direct relationships among them, thus solving the checkerboard problem. In this method, intermediate feature maps are generated sequentially instead of simultaneously. The intermediate feature maps generated in a later stage are required to depend on previously generated ones. The primary purpose of sequential generation is to add dependencies among intermediate feature maps and thus adjacent pixels in final output feature maps. Finally, these intermediate feature maps are shuffled and combined to produce final output feature maps. Compared to Eqn. 1, $F _ { o u t }$ is obtained as follows:
$$\begin{array} { r l r l } & { F _ { 1 } = F _ { i n } \oplus k _ { 1 } , } & & { F _ { 2 } = [ F _ { i n } , F _ { 1 } ] \oplus k _ { 2 } , } \\ & { F _ { 3 } = [ F _ { i n } , F _ { 1 } , F _ { 2 } ] \oplus k _ { 3 } , } & & { F _ { 4 } = [ F _ { i n } , F _ { 1 } , F _ { 2 } , F _ { 3 } ] \oplus k _ { 4 } , } \\ & { F _ { o u t } = F _ { 1 } \oplus F _ { 2 } \oplus F _ { 3 } \oplus F _ { 4 } , } \end{array}$$
where $[ \cdot , \cdot ]$ denotes the juxtaposition of feature maps. Note that in Eqn. 2, $k _ { i }$ denotes a set of kernels as it involves convolution with the juxtaposition of multiple feature maps. Since the intermediate feature maps in Eqn. 2 depend on both the input feature map and the previously generated ones, we term it input pixel deconvolutional layer (iPixelDCL). Through this process, pixels on output feature maps will be conditioned not only on input feature maps but also on adjacent pixels. Since there are direct relationships among intermediate feature maps and adjacent pixels, iPixelDCL is expected to solve the checkerboard problem to some extent. Note that the relationships among intermediate feature maps can be very flexible. The intermediate feature maps generated later on can rely on part or all of previously generated intermediate feature maps. This depends on the design of pixel dependencies in final output feature maps. Figure 5 illustrates a specific design of sequential dependencies among intermediate feature maps.
In iPixelDCL, we add dependencies among generated intermediate feature maps, thereby making adjacent pixels on final output feature maps directly related to each other. In this process, the information of the input feature map is repeatedly used when generating intermediate feature maps. When generating the intermediate feature maps, information from both the input feature map and previous intermediate feature maps is used. Since previous intermediate feature maps already contain information of the input feature map, the dependencies on the input feature map can be removed. Removing such dependencies for some intermediate feature maps can not only improve the computational efficiency but also reduce the number of trainable parameters in deep models.
In this simplified pixel deconvolutional layer, only the first intermediate feature map will depend on the input feature map. The intermediate feature maps generated afterwards will only depend on previously generated intermediate feature maps. This will simplify the dependencies among pixels on final output feature map. In this work, we use PixelDCL to denote this simplified design. Our experimental results show that PixelDCL yields better performance than iPixelDCL and regular deconvolution. Compared to Eqn. 2, $F _ { o u t }$ in PixelDCL is obtained as follows:
 Figure 5: Illustration of iPixelDCL and PixelDCL described in section 2.2. In iPixelDCL, there are additional dependencies among intermediate feature maps. Specifically, the four intermediate feature maps are generated sequentially. The purple feature map is generated from the input feature map (blue). The orange feature map is conditioned on both the input feature map and the purple feature map that has been generated previously. In this way, the green feature map relies on the input feature map, purple and orange intermediate feature maps. The red feature map is generated based on the input feature map, purple, orange, and green intermediate feature maps. We also propose to move one step further and allow only the first intermediate feature map to depend on the input feature map. This gives rise to PixelDCL. That is, the connections indicated by dashed lines are removed to avoid repeated influence of the input feature map. In this way, only the first feature map is generated from the input and other feature maps do not directly rely on the input. In PixelDCL, the orange feature map only depends on the purple feature map. The green feature map relies on the purple and orange feature maps. The red feature map is conditioned on the purple, orange, and green feature maps. The information of the input feature map is delivered to other intermediate feature maps through the first intermediate feature map (purple).
$$\begin{array} { c c } { { F _ { 1 } = F _ { i n } \oplus k _ { 1 } , } } & { { F _ { 2 } = F _ { 1 } \oplus k _ { 2 } , } } \\ { { F _ { 3 } = [ F _ { 1 } , F _ { 2 } ] \oplus k _ { 3 } , } } & { { F _ { 4 } = [ F _ { 1 } , F _ { 2 } , F _ { 3 } ] \oplus k _ { 4 } , } } \\ { { F _ { o u t } = F _ { 1 } \oplus F _ { 2 } \oplus F _ { 3 } \oplus F _ { 4 } . } } & { { } } \end{array}$$
PixelDCL is illustrated in Figure 5 by removing the connections denoted with dash lines. When analyzing the relationships of pixels on output feature maps, it is clear that each pixel will still rely on adjacent pixels. Therefore, the checkerboard problem can be solved with even better computational efficiency. Meanwhile, our experimental results demonstrate that the performance of models with these simplified dependencies is even better than that with complete connections. This demonstrates that repeated dependencies on the input may not be necessary.
# 2.3 PIXEL DECONVOLUTIONAL NETWORKS
Pixel deconvolutional layers can be applied to replace any deconvolutional layers in various models involving up-sampling operations such as U-Net (Ronneberger et al., 2015), VAEs (Kingma & Welling, 2014) and GANs (Goodfellow et al., 2014). By replacing deconvolutional layers with pixel deconvolutional layers, deconvolutional networks become pixel deconvolutional networks (PixelDCN). In U-Net for semantic segmentation, pixel deconvolutional layers can be used to upsample from low-resolution feature maps to high-resolution ones. In VAEs, they can be applied in decoders for image reconstruction. The generator networks in GANs typically use deep model (Radford et al., 2015) and thus can employ pixel deconvolutional layers to generate large images. In our experiments, we evaluate pixel deconvolutional layers in U-Net and VAEs. The results show that the performance of pixel deconvolutional layers outperforms deconvolutional layers in these networks.
In practice, the most frequently used up-sampling operation is to increase the height and width of input feature maps by a factor of two, e.g., from $2 \times 2$ to $4 \times 4$ . In this case, the pixels on output feature maps can be divided into four groups as in Eqn. 1. The dependencies can be defined as in Figure 5. When implementing pixel deconvolutional layers, we design a simplified version to reduce sequential dependencies for better parallel computation and training efficiency as illustrated in Figure 6.
 Figure 6: An efficient implementation of the pixel deconvolutional layer. In this layer, a $4 \times 4$ feature map is up-sampled to a $8 \times 8$ feature map. The purple feature map is generated through a $3 \times 3$ convolutional operation from the input feature map (step 1). After that, another $3 \times 3$ convolutional operation is applied on the purple feature map to produce the orange feature map (step 2). The purple and orange feature maps are dilated and added together to form a larger feature map (step 3). Since there is no relationship between the last two intermediate feature maps, we can apply a masked $3 \times 3$ convolutional operation, instead of two separate $3 \times 3$ convolutional operations (step 4). Finally, the two large feature maps are combined to generate the final output feature map (step 5).
In this design, there are four intermediate feature maps. The first intermediate feature map depends on the input feature map. The second intermediate feature map relies on the first intermediate feature map. The third and fourth intermediate feature maps are based on both the first and the second feature maps. Such simplified relationships enable the parallel computation for the third and fourth intermediate feature maps, since there is no dependency between them. In addition, the masked convolutional operation can be used to generate the last two intermediate feature maps. As has been mentioned already, a variety of different dependencies relations can be imposed on the intermediate feature maps. Our simplified design achieves reasonable balance between efficiency and performance.
# 3 EXPERIMENTAL STUDIES
In this section, we evaluate the proposed pixel deconvolutional methods on semantic segmentation and image generation tasks in comparison to the regular deconvolution method. Results show that the use of the new pixel deconvolutional layers improves performance consistently in both supervised and unsupervised learning settings.
# 3.1 SEMANTIC SEGMENTATION
Experimental Setup: We use the PASCAL 2012 segmentation dataset (Everingham et al., 2010) and MSCOCO 2015 detection dataset (Lin et al., 2014) to evaluate the proposed pixel deconvolutional methods in semantic segmentation tasks. For both datasets, the images are resized to $2 5 6 \times 2 5 6 \times 3$ for batch training. Our models directly predict the label for each pixel without any post-processing. Here we examine our models in two ways: training from scratch and fine-tuning from state-of-art model such as DeepLab-ResNet.
For the training from scratch experiments, we use the U-Net architecture (Ronneberger et al., 2015) as our base model as it has been successfully applied in various image segmentation tasks. The network consists of four blocks in the encoder path and four corresponding blocks in the decoder path. Within each decoder block, there is a deconvolutional layer followed by two convolutional layers. The final output layer is adjusted based on the number of classes in the dataset. The PASCAL 2012 segmentation dataset has 21 classes while the MSCOCO 2015 detection dataset has 81 classes. As the MSCOCO 2015 detection dataset has more classes than the PASCAL 2012 segmentation dataset, the number of feature maps in each layer for this dataset is doubled to accommodate more output channels. The baseline U-Net model employs deconvolutional layers within the decoder path to up-sample the feature maps. We replace the deconvolutional layers with our proposed pixel deconvolutional layers (iPixelDCL) and their simplified version (PixelDCL) while keeping all other variables unchanged. The kernel size in DCL is $6 \times 6$ , which has the same number of parameters as iPixelDCL with 4 sets of $3 \times 3$ kernels, and more parameters than PixelDCL with 2 sets of $3 \times 3$ and 1 set of $2 \times 2$ kernels. This will enable us to evaluate the new pixel deconvolutional layers against the regular deconvolutional layers while controlling all other factors.
 Figure 7: Sample segmentation results on the PASCAL 2012 segmentation dataset using training from scratch models. The first and second rows are the original images and the corresponding ground truth, respectively. The third, fourth, and fifth rows are the segmentation results of models using deconvolutional layers, iPixelDCL, and PixelDCL, respectively.
For the fine-tuning experiments, we fine-tune our models based on the architecture of DeepLabResNet (Chen et al., 2016). The DeepLab-ResNet model is fine-tuned from ResNet101 (He et al., 2016) and also use external data for training. The strategy of using external training data and finetuning from classic ResNet101 greatly boosts the performance of the model on both accuracy and mean IOU. The output of DeepLab-ResNet is eight times smaller than the input image on the height and width dimensions. In order to recover the original dimensions, we add three up-sampling blocks, each of which up-samples the feature maps by a factor of 2. For each up-sampling block, there is a deconvolutional layer followed by a convolutional layer. By employing the same strategy, we replace the deconvolutional layer by PixelDCL and iPixelDCL using kernels of the same size as in the training from scratch experiments.
Analysis of Results: Some sample segmentation results of U-Net using deconvolutional layers (DCL), iPixelDCL, and PixelDCL on the PASCAL 2012 segmentation dataset and the MSCOCO 2015 detection dataset are given in Figures 7 and 8, respectively. We can see that U-Net models using iPixelDCL and PixelDCL can better capture the local information of images than the same base model using regular deconvolutional layers. By using pixel deconvolutional layers, more spacial features such as edges and shapes are considered when predicting the labels of adjacent pixels.
Moreover, the semantic segmentation results demonstrate that the proposed models tend to produce smoother outputs than the model using deconvolution. We also observe that, when the training epoch is small (e.g., 50 epochs), the model that employs PixelDCL has better segmentation outputs than the model using iPixelDCL. When the training epoch is large enough (e.g., 100 epochs), they have similar performance, though PixelDCL still outperforms iPixelDCL in most cases. This indicates that PixelDCL is more efficient and effective, since it has much fewer parameters to learn.
Table 1 shows the evaluation results in terms of pixel accuracy and mean IOU on the two datasets. The U-Net models using iPixelDCL and PixelDCL yield better performance than the same base model using regular deconvolution. The model using PixelDCL slightly outperforms the model using iPixelDCL. For the models fine-tuned from Deeplab-ResNet, the models using iPixelDCL and PixelDCL have better performance than the model using DCL, with iPixelDCL performs the best. In semantic segmentation, mean IOU is a more accuracy evaluation measure than pixel accuracy (Everingham et al., 2010). The models using pixel deconvolution have better evaluation results on mean IOU than the base model using deconvolution.
 Figure 8: Sample segmentation results on the MSCOCO 2015 detection dataset using training from scratch models. The first and second rows are the original images and the corresponding ground truth, respectively. The third, fourth, and fifth rows are the segmentation results of models using deconvolutional layers, iPixelDCL, and PixelDCL, respectively.
Table 1: Semantic segmentation results on the PASCAL 2012 segmentation dataset and MSCOCO 2015 detection dataset. We compare the same base U-Net model and fine-tuned DeepLab-ResNet using three different up-sampling methods in decoders; namely regular deconvolution layer (DCL), the proposed input pixel deconvolutional layer (iPixelDCL) and pixel deconvolutional layer (PixelDCL). The pixel accuracy and mean IOU are used as performance measures.
<table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Pixel Accuracy</td><td rowspan=1 colspan=1>Mean IOU</td></tr><tr><td rowspan=1 colspan=1>PASCAL 2012</td><td rowspan=1 colspan=1>U-Net + DCLU-Net+iPixelDCLU-Net + PixelDCL</td><td rowspan=1 colspan=1>0.8161610.8171290.822591</td><td rowspan=1 colspan=1>0.4151780.4488170.455972</td></tr><tr><td rowspan=1 colspan=1>MSCOCO 2015</td><td rowspan=1 colspan=1>U-Net + DCLU-Net+iPixelDCLU-Net + PixelDCL</td><td rowspan=1 colspan=1>0.8093270.8092390.811575</td><td rowspan=1 colspan=1>0.3497690.3602160.371805</td></tr><tr><td rowspan=1 colspan=1>PASCAL 2012</td><td rowspan=1 colspan=1>DeepLab-ResNet + DCLDeepLab-ResNet+iPixelDCLDeepLab-ResNet + PixelDCL</td><td rowspan=1 colspan=1>0.9295620.9344930.931287</td><td rowspan=1 colspan=1>0.7270360.7385520.735585</td></tr></table>
# 3.2 IMAGE GENERATION
Experimental Setup: The dataset used for image generation is the celebFaces attributes (CelebA) dataset (Liu et al., 2015). To avoid the influence of background, the images have been preprocessed so that only facial information is retained. The image generation task is to reconstruct the faces excluding backgrounds in training images. The size of images is $6 4 \times 6 4 \times 3$ . We use the standard variational auto-encoder (VAE) (Kingma & Welling, 2014) as our base model for image generation. The decoder part in standard VAE employs deconvolutional layers for up-sampling. We apply our proposed PixelDCL to replace deconvolutional layers in decoder while keeping all other components the same. The kernel size in DCL is $6 \times 6 .$ , which has more parameters than PixelDCL with 2 sets of $3 \times 3$ and 1 set of $2 \times 2$ kernels.
Analysis of Results: Figure 9 shows the generated faces using VAEs with regular deconvolution (baseline) and PixelDCL in decoders. Some images generated by the baseline model suffer from apparent checkerboard artifacts, while none is found on the images generated by the model with PixelDCL. This demonstrates that the proposed pixel deconvolutional layers are able to establish direct relationships among adjacent pixels on generated feature maps and images, thereby effectively overcoming the checkerboard problem. Our results demonstrate that PixelDCL is very useful for generative models since it can consider local spatial information and produce photo-realistic images without the checkerboard problem.
 Figure 9: Sample face images generated by VAEs when trained on the CelebA dataset. The first two rows are images generated by a standard VAE with deconvolutional layers for up-sampling. The last two rows generated by the same VAE model, but using PixelDCL for up-sampling.
Table 2: Training and prediction time on semantic segmentation using the PASCAL 2012 segmentation dataset on a Tesla K40 GPU. We compare the training time of 10 epochs and prediction time of 2109 images for the same base U-Net model using three different methods for up-sampling in the decoders; namely DCL, iPixelDCL, and PixelDCL.
<table><tr><td>Model</td><td>Training time</td><td>Prediction time</td></tr><tr><td>U-Net + DCL</td><td>365m26s</td><td>2m42s</td></tr><tr><td>U-Net+iPixelDCL</td><td>511m19s</td><td>4m13s</td></tr><tr><td>U-Net + PixelDCL</td><td>464m31s</td><td>3m27s</td></tr></table>
# 3.3 TIMING COMPARISON
Table 2 shows the comparison of the training and prediction time of the U-Net models using DCL, iPixelDCL, and PixelDCL for up-sampling. We can see that the U-Net models using iPixelDCL and PixelDCL take slightly more time during training and prediction than the model using DCL, since the intermediate feature maps are generated sequentially. The model using PixelDCL is more efficient due to reduced dependencies and efficient implementation discussed in Section 2.3. Overall, the increase in training and prediction time is not dramatic, and thus we do not expect this to be a major bottleneck of the proposed methods.
# 4 CONCLUSION
In this work, we propose pixel deconvolutional layers that can solve the checkerboard problem in deconvolutional layers. The checkerboard problem is caused by the fact that there is no direct relationship among intermediate feature maps generated in deconvolutional layers. PixelDCL proposed here try to add direct dependencies among these generated intermediate feature maps. PixelDCL generates intermediate feature maps sequentially so that the intermediate feature maps generated in a later stage are required to depend on previously generated ones. The establishment of dependencies in PixelDCL can ensure adjacent pixels on output feature maps are directly related. Experimental results on semantic segmentation and image generation tasks show that PixelDCL is effective in overcoming the checkerboard artifacts. Results on semantic segmentation also show that PixelDCL is able to consider local spatial features such as edges and shapes, leading to better segmentation results. In the future, we plan to employ our PixelDCL in a broader class of models, such as the generative adversarial networks (GANs).
# REFERENCES
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:1606.00915, 2016.
Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. International journal of computer vision, 88(2): 303–338, 2010.
Mathieu Germain, Karol Gregor, Iain Murray, and Hugo Larochelle. Made: Masked autoencoder for distribution estimation. In Proceedings of The 32nd International Conference on Machine Learning, pp. 881–889, 2015.
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.
Karol Gregor, Ivo Danihelka, Alex Graves, Danilo Rezende, and Daan Wierstra. Draw: A recurrent neural network for image generation. In Proceedings of the 32nd International Conference on Machine Learning (ICML-15), pp. 1462–1471, 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.
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.
Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
Diederik P Kingma and Max Welling. Stochastic gradient vb and the variational auto-encoder. In Second International Conference on Learning Representations, ICLR, 2014.
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.
Hugo Larochelle and Iain Murray. The neural autoregressive distribution estimator. In International Conference on Artificial Intelligence and Statistics, pp. 29–37, 2011.
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.
Q Li, GP Steven, and YM Xie. A simple checkerboard suppression algorithm for evolutionary structural optimization. Structural and Multidisciplinary Optimization, 22(3):230–239, 2001.
Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ European Conference on Computer Vision, pp. 740–755. Springer, 2014.
Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), 2015.
Alireza Makhzani and Brendan J Frey. Winner-take-all autoencoders. In Advances in Neural Information Processing Systems, pp. 2791–2799, 2015.
Hyeonwoo Noh, Seunghoon Hong, and Bohyung Han. Learning deconvolution network for semantic segmentation. In IEEE International Conference on Computer Vision, 2015.
Augustus Odena, Vincent Dumoulin, and Chris Olah. Deconvolution and checkerboard artifacts. Distill, 2016. doi: 10.23915/distill.00003. URL http://distill.pub/2016/ deconv-checkerboard.
Aaron Van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. In Proceedings of The 33rd International Conference on Machine Learning, pp. 1747–1756, 2016.
Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text to image synthesis. In Proceedings of The 33rd International Conference on Machine Learning, volume 3, 2016.
Scott Reed, Aaron van den Oord, Nal Kalchbrenner, Sergio G ¨ omez Colmenarejo, Ziyu Wang, Dan ´ Belov, and Nando de Freitas. Parallel multiscale autoregressive density estimation. arXiv preprint arXiv:1703.03664, 2017.
Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In Proceedings of The 31st International Conference on Machine Learning, pp. 1278–1286, 2014.
Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 234–241. Springer, 2015.
Evan Shelhamer, Jonathon Long, and Trevor Darrell. Fully convolutional networks for semantic segmentation. IEEE transactions on pattern analysis and machine intelligence, 2016.
Wenzhe Shi, Jose Caballero, Ferenc Huszar, Johannes Totz, Andrew P Aitken, Rob Bishop, Daniel ´ Rueckert, and Zehan Wang. Real-time single image and video super-resolution using an efficient sub-pixel convolutional neural network. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1874–1883, 2016.
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
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.
Andrea Vedaldi and Karel Lenc. Matconvnet: Convolutional neural networks for matlab. In Proceedings of the 23rd ACM international conference on Multimedia, pp. 689–692. ACM, 2015.
Matthew D Zeiler, Dilip Krishnan, Graham W Taylor, and Rob Fergus. Deconvolutional networks. In Computer Vision and Pattern Recognition (CVPR), 2010 IEEE Conference on, pp. 2528–2535. IEEE, 2010.
Matthew D Zeiler, Graham W Taylor, and Rob Fergus. Adaptive deconvolutional networks for mid and high level feature learning. In Computer Vision (ICCV), 2011 IEEE International Conference on, pp. 2018–2025. IEEE, 2011.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689# UNDERSTANDING GANS VIA GENERALIZATION ANALYSIS FOR DISCONNECTED SUPPORT
Anonymous authors Paper under double-blind review
# ABSTRACT
This paper provides theoretical analysis of generative adversarial networks (GANs) to explain its advantages over other standard methods of learning probability measures. GANs learn a probability through observations, using the objective function with a generator and a discriminator. While many empirical results indicate that GANs can generate realistic samples, the reason for such successful performance remains unelucidated. This paper focuses the situation where the target probability measure satisfies the disconnected support property, which means a separate support of a probability, and relates it with the advantage of GANs. It is theoretically shown that, unlike other popular models, GANs do not suffer from the decrease of generalization performance caused by the disconnected support property. We rigorously quantify the generalization performance of GANs of a given architecture, and compare it with the performance of the other models. Based on the theory, we also provide a guideline for selecting deep network architecture for GANs. We demonstrate some numerical examples which support our results.
# 1 INTRODUCTION
Generative Adversarial Networks (GANs) (Goodfellow et al., 2014) attract much attention as technology for learning a distribution and generating data. The purpose of GANs is to learn a probability measure from a given dataset and generate samples from the learned measure. It is often seen that samples generated by GANs can extract effectively features in the real world; it is difficult, for instance, to distinguish real images and generated images. By practical successes, a countless number of variations of GANs have been developed (Dziugaite et al., 2015; Arjovsky et al., 2017; Li et al., 2015; Nowozin et al., 2016; Gulrajani et al., 2017; Zhao et al., 2016), and applied to a wide range of tasks (Reed et al., 2016; Zhu et al., 2017; Gauthier, 2014).
Understanding the remarkable performance of GANs is, however, still a challenging problem. There are active discussions on the role of generators in its learning scheme (Goodfellow, 2016; Arjovsky & Bottou, 2017; Arora et al., 2018; Creswell et al., 2018), and adversarial structures with discriminators are also a target of interest (Lotter et al., 2015; Zhang et al., 2018). A gaming structure between generators and discriminators is also regarded as a useful factor in the mechanism of GANs (Mescheder et al., 2017; Arora et al., 2017; Heusel et al., 2017). Generalization performance of GANs has been investigated in several studies (Liang, 2017; Liu et al., 2017; Tolstikhin et al., 2017). In spite of these studies, it is not yet clear why GANs can generate well-extracted data better than other standard methods.
This paper introduces the disconnected support property, and explains an advantage of GANs in connection with this notion. The disconnected support property refers to a probability measures of which the support is divided into several disjoint sets, allowing non-differentiable density on the boundary. The property makes a probability measure be complex, hence it can be an obstacle for standard methods to learn the measure effectively. This property, however, is popularly seen in many real data, especially data with cluster structure, as demonstrated in Section 3.
We investigate in detail the approximation and estimation ability of GANs and some other methods, and provide novel generalization analysis of probability measures with disconnected support. Firstly, we show that the other methods suffer worse generalization performance due to complex structures of disconnected supports (Proposition 1 and Lemma 2). Secondly, our generalization analysis reveals that GANs can learn the probability measure without loss of efficiency under the the disconnected supports (Theorem 1, Corollary 1 and ??). Additionally, we derive a guideline for choosing the number of layers or connections of the generator and discriminator from the generalization analysis. Numerical results support our theoretical findings.
We remark that the disconnected support property is different from the low-dimensional supports studied in Arjovsky & Bottou (2017), where the support of a measure generated by neural networks is disjoint to the measure of observations. In contrast, this paper considers the case in which the support of the observation measure is divided into disjoint subsets. The problem of disconnected supports is complement to the low-dimensionality, hence these two problems can be investigated separately. In this paper, to simplify the discussion, we assume that the support of a probability measure is not low-dimensional.
The contributions of this paper are summarized as follows:
1. We show that GANs perform better than other standard methods of estimating probability measures when the measure satisfies the disconnected support property. 2. We provide a new generalization error bound under a general formulation of GANs by analyzing an approximation error. The result is thus applicable to a wide range of variations of GANs. 3. Based on the generalization bound, we provide a theoretical guideline for selecting architectures of generators and discriminators.
All the proofs are given in Supplementary materials.
# 2 PRELIMINARIES
# 2.1 NOTATION
We use notations $I : = [ 0 , 1 ]$ . A $j$ -th element of a vector $b$ is denoted by $b _ { j }$ , and $\begin{array} { r } { \| b \| _ { q } : = ( \sum _ { j } b _ { j } ^ { q } ) ^ { 1 / q } } \end{array}$ is the $q$ -norm $( q \in [ 0 , \infty ] )$ . $\mathrm { v e c } ( \cdot )$ is a vectorization operator for matrices. For $z \in \mathbb { N } , [ z ] : =$ $\{ 1 , 2 , \ldots , z \}$ is a set of positive integers no more than $z$ . For $\alpha \in \mathbb { R }$ , $\lfloor \alpha \rfloor$ denotes the largest integer which is not larger than ş $\alpha$ . For a domain $\Omega$ in a Euclidean space and a function $f : \Omega \mathbb { R }$ , $\Vert f \Vert _ { L ^ { p } } : = ( \int _ { \Omega } | f ( t ) | ^ { p } d t ) ^ { 1 / p }$ denotes the $L ^ { p }$ norm for $p \in [ 0 , \infty ]$ . For $f : \Omega \to \mathbb { R } ^ { D }$ with a multidimensional output, $f _ { d }$ denotes a $d$ -th coordinate of $\boldsymbol { f } ( \boldsymbol { x } ) = ( f _ { 1 } ( \boldsymbol { x } ) , . . . , f _ { D } ( \boldsymbol { x } ) ) ^ { \top } ,$ . Let $H ^ { \beta } ( \Omega )$ be the Hölder space for $\beta > 0$ such as a set of $\beta$ -smooth functions $f : \Omega \to { \mathbb { R } }$ , namely, $f$ is $C ^ { \lfloor \beta \rfloor }$ -class and its $\lfloor \beta \rfloor$ -th derivative is $\beta - \lfloor \beta \rfloor$ -Hölder continuous. $\otimes$ denotes a tensor product, and $\bigcirc$ a composition of functions, namely, for functions $f$ and $f ^ { \prime }$ , $f \circ f ^ { \prime } = f ( f ^ { \prime } ( \cdot ) )$ . A Borel $\sigma$ -algebra of $\Omega$ is denoted as $\sigma ( \Omega )$ . For a measurable mapping $f : \Omega \to \Omega ^ { \prime }$ and $B ^ { \prime } \subset \Omega ^ { \prime }$ , a pre-image of $f$ is defined as $f ^ { - 1 } ( B ^ { \prime } ) : = \{ t \in \Omega \mid B ^ { \prime } \ni f ( t ) \}$ . Let $I _ { \Omega } : x \mapsto \{ 0 , 1 \}$ be an indicator function such that $\pmb { I } _ { \Omega } ( x ) = 1$ if $x \in \Omega$ , and $\pmb { I } _ { \Omega } ( x ) = 0$ otherwise.
# 2.2 GENERAL FRAMEWORK OF GANS
We provide a general formulation of a learning problem with generative adversarial networks $( G A N s )$ following Liu et al. (2017). In this paper, we consider a probability measure $P ^ { * }$ on a measurable space $( I ^ { \breve { D } } , \Sigma )$ with a dimensionality $D \in \mathbb { N }$ and $\Sigma : = \sigma ( I ^ { \hat { D } } )$ . Here, we set $D \geqslant 3$ . Suppose we have a set of $n$ observations ř ${ \mathcal { D } } : = \{ X _ { 1 } , . . . , X _ { n } \}$ which is independently and identically generated from $P ^ { * }$ . Let $\begin{array} { r } { P _ { n } : = \frac { 1 } { n } \sum _ { i \in [ n ] } \delta _ { X _ { i } } } \end{array}$ be an empirical measure where $\delta _ { x }$ is the Dirac measure at $x$ .
The goal of generative networks is to estimate $P ^ { * }$ from $\mathcal { D }$ . To this end, we construct a probability measure by generators. Let $P _ { Z }$ be the uniform distribution on $( I ^ { D } , \Sigma )$ . For a measurable mapping $g : I ^ { D } \to { \bf \check { \cal I } } ^ { \check { D } }$ , we define $P _ { g }$ as the pushforward measure: i.e., $\begin{array} { r } { P _ { g } ( B ) = P _ { Z } ( g ^ { - 1 } ( B ) ) } \end{array}$ for $B \in \Sigma$ . We call $g$ as a generator and use $\mathcal { G }$ for a set of generators.
GANs employ a learning scheme with a metric with discriminators (Goodfellow et al., 2014). Let $\mathcal { F } = \{ f : \mathbf { \bar { \chi } } _ { I } D ^ { \bullet } \mathbb { R } \}$ be a a set of discriminators. This paper considers a general metric for GANs (Liu et al., 2017),
$$d _ { \mathcal { F } } ( P , P ^ { \prime } ) : = \operatorname* { s u p } _ { f \in \mathcal { F } } \mathbb { E } _ { X \sim P } [ f ( X ) ] - \mathbb { E } _ { X \sim P ^ { \prime } } [ f ( X ) ] ,$$
between probability measures $P$ and $P ^ { \prime }$ .
For the learning process, we generate $m$ noise samples $\widetilde { Z } _ { 1 } , . . . , \widetilde { Z } _ { m }$ from $P _ { Z }$ and obtain generated samples as $\tilde { X } _ { j } : = g ( \tilde { Z } _ { j } )$ with $g \in { \mathcal { G } }$ for $j \in [ m ]$ . Let $\begin{array} { r } { P _ { g , m } : = \frac { 1 } { m } \sum _ { j \in [ m ] } \delta _ { \widetilde { X } _ { j } } } \end{array}$ denote the sampling measure. GANs construct an estimator $P _ { \hat { g } }$ for $P ^ { * }$ by learning $\widehat g$ with the following optimization problem
$${ \widehat { g } } \in \mathop { \mathrm { a r g m i n } } _ { g \in { \mathcal { G } } } d _ { { \mathcal { F } } } \left( P _ { n } , P _ { g , m } \right) .$$
The metric (1) covers a wide variety of GANs by selecting $\mathcal { F }$ . Among others, the original GAN (Goodfellow et al., 2014) is realized if $\mathcal { F }$ contains a logarithm of density ratio; Wasserstein-GAN (Arjovsky et al., 2017), MMD-GAN (Dziugaite et al., 2015; Li et al., 2017) and Energy-Based GAN (Zhao et al., 2016) are given if $\mathcal { F }$ is the set of 1-Lipschitz functions, a reproducing kernel Hilbert space, and the bounded continuous functions, respectively. The $f$ -GAN (Nowozin et al., 2016) also belongs to this class.
We assume that $\mathcal { F }$ is large enough to contain functions which can work as a discriminator, namely, we assume that the following holds:
$$d _ { \mathcal { F } } ( P , P ^ { \prime } ) = 0 \Leftrightarrow P = P ^ { \prime } .$$
A sufficient condition for (3) is investigated in Zhang et al. (2018).
# 2.3 DEEP NEURAL NETWORKS FOR GENERATORS AND DISCRIMINATORS
In the schemes of GANs, $\mathcal { F }$ and $\mathcal { G }$ are realized by deep neural networks (DNNs). For further discussion, we formulate the function class given by DNNs.
Let $L \in \mathbb { N }$ be a number of layers in DNNs, and $D _ { \ell } ^ { \prime } \in \mathbb { N }$ be a dimensionality of variables in an $\ell \cdot$ -th layer for $\ell \in \left[ L + 1 \right]$ . Here, we set $D _ { L + 1 } ^ { \prime } = D$ for generators and $D _ { L + 1 } ^ { \prime } = \mathrm { \bar { 1 } }$ for discriminators. We introduce $A _ { \ell } \in \mathbb { R } ^ { D _ { \ell + 1 } ^ { \prime } \times D _ { \ell } ^ { \prime } }$ and $b _ { \ell } \in \mathbb { R } ^ { D _ { \ell } ^ { \prime } }$ as matrix and vector parametersof the $\ell$ -th layer. An architecture $\Theta$ of DNNs is defined as a set of $L$ pairs of $\left( A _ { \ell } , b _ { \ell } \right)$ as $\bar { \Theta : = ( ( A _ { 1 } , b _ { 1 } ) , . . . , ( A _ { L } , \bar { b } _ { L } ) ) }$ . We define notations for $\Theta$ as follow: $| \Theta | : = L$ as the number of layers, $\begin{array} { r } { \| \Theta \| _ { 0 } : = \sum _ { \ell \in [ L ] } \| \operatorname { v e c } ( A _ { \ell } ) \| _ { 0 } + \| b _ { \ell } \| _ { 0 } } \end{array}$ as the number of non-zero elements in $\Theta$ , and $\begin{array} { r } { \| \Theta \| _ { \infty } : = \operatorname* { m a x } \{ \operatorname* { m a x } _ { \ell \in [ L ] } \| \mathrm { v e c } ( \mathring { A } _ { \ell } ) \| _ { \infty } , \operatorname* { m a x } _ { \ell \in [ L ] } \| b _ { \ell } \| _ { \infty } \} } \end{array}$ be the scale of parameters in $\Theta$ . We employ the ReLU activation function $\eta : \mathbb { R } ^ { D ^ { \prime } } \to \mathbb { R } ^ { D ^ { \prime } }$ for each $D ^ { \prime } \in \mathbb { N }$ such as $\eta ( x ) = ( \operatorname* { m a x } \{ x _ { d } , 0 \} ) _ { d \in [ D ^ { \prime } ] }$ .
We define functions of DNNs with an architecture $\Theta$ as $\xi [ \Theta ] : \mathbb { R } ^ { D ^ { \prime } } \mathbb { R } ^ { D ^ { \prime \prime } }$ by
$$\xi [ \Theta ] ( x ) = x ^ { ( L + 1 ) } , x ^ { ( 1 ) } : = x , x ^ { ( \ell + 1 ) } : = \eta ( A _ { \ell } x ^ { ( \ell ) } + b _ { \ell } ) , \mathrm { f o r } \ell \in [ L ] .$$
The function class of DNNs is thus given by
$$\Xi ( S , B , L ) : = \Big \{ \xi [ \Theta ] : I ^ { D } \to \mathbb { R } \ | \ \| \Theta \| _ { 0 } \leqslant S , \| \Theta \| _ { \infty } \leqslant B , | \Theta | \leqslant L \Big \} ,$$
where $S \in \mathbb { N } , B > 0$ , and $L \in \mathbb { N }$ are hyper-parameters. Here, $S$ bounds the number of non-zero parameters of DNNs, namely, it controls the sparseness of DNNs. $B$ is a bound for scales of parameters.
# 3 DISCONNECTED SUPPORT PROPERTY
# 3.1 INTRODUCTION AND EXAMPLE
It is often observed that data in real world data the support of its probability measure may not be connected but a union of disjoint subsets. This is typical if the data has cluster structures, as seen in many data sets for classification tasks. Moreover, the density function of the probability measure may not be smooth at a boundary of the support. Figures 1 (MNIST, (LeCun et al., 1998)) and 2 (Shelter Animal, Center) illustrate such examples in the real world. They are projected onto a 2-dimensional Euclidean space by t-SNE (Maaten & Hinton, 2008) so that they preserve the original distance structure among points. We can see that both of the data are concentrated on several disjoint subsets and there are a clear gap or empty regions between some of the subsets. This observation suggests that the disconnected property of probability measures should be addressed in discussing estimation of probability measures, while standard analysis does not consider this phenomenon. In fact, this paper will show that the disconnected supports property has an important role in showing an advantage of GANs over standard estimation methods.
 Figure 1: Plot of the MNIST data.
 Figure 2: Plot of the animal data.
# 3.2 MATHEMATICAL FORMULATION OF DISCONNECTED SUPPORTS
Here we make a rigorous definition of disconnected supports. The property of smoothness (i.e. differentiability) is involved, which is a key factor to analyze generalization performance in the fields of the statistics (Stone, 1982; Tsybakov, 2009); Stone (1982) shows, for instance, that smoothness and a dimension of data are sufficient to characterize an optimal convergence of generalization errors.
We first prepare a family of subsets as a component in the disconnected supports:
$\begin{array} { r } { S _ { \alpha , J } : = \left\{ S \subset I ^ { D } \ \right| } \end{array}$ A boundary of $S$ is $J$ combination of $\alpha$ -smooth hyper surfaces .
The supplementary material will provide a more rigorous definition.
Now, we define the disconnected support property of probability measures as well as a probability measure with global support, i.e., with no the disconnected support property. Let $\operatorname { S u p p } ( P )$ be the support of $P$ ., i.e, ${ \dot { \operatorname { S u p p } } } ( P ) : = \{ x \in I ^ { D } \mid P ( V _ { x } ) > 0$ for all open neighborhood $V _ { x }$ of $x \}$ Hereafter, $M \geqslant 2$ is the number of disjoint components of a support.
Definition 1. (Disconnected Supports / Global Support) Let $M \geqslant 2$ . A probability measure $P$ on $( I ^ { D } , \bar { \Sigma } )$ has $M$ disconnected supports, if there exist nonempty disjoint sets ${ \cal S } _ { 1 } , . . . , { \cal S } _ { M } \in { \cal S } _ { \alpha , J }$ such that
$$\operatorname { S u p p } ( P ) = \bigcup _ { m \in [ M ] } S _ { m } .$$
A probability measure $P$ on $( I ^ { D } , \Sigma )$ has a global support, if $\operatorname { S u p p } ( P ) = I ^ { D }$ .
Figure 3 illustrates the disconnected support property.
We next formulate a notion of smoothness for $P$ with disconnected supports. Let $\beta \geqslant 1$ be a parameter for a degree of smoothness of $P$ .
Definition 2. (Local Smoothness)
A probability measure $P$ with $M$ disconnected support is locally $\beta$ -smooth, if there exist $M$ pairs $( \widetilde { S } _ { m } , S _ { m } ) \in \mathrm { ~ \cal { S } ~ } _ { 2 \beta , J } \times S _ { 2 \beta , J }$ and $\beta + 1$ -smooth bijective measurable maps $\gamma _ { m } : \widetilde { S } _ { m } S _ { m }$ as
$$P ( B ) = P _ { Z } ( \gamma _ { m } ^ { - 1 } ( B ) ) , \forall B \in \sigma ( S _ { m } ) ,$$
for $m \in [ M ]$
This definition of local smoothness says that a probability measure $P$ with disconnected supports can be generated by sufficiently smooth mappings $\gamma _ { m }$ . It is used for considering a smooth density function of $P$ restricted on $S _ { m }$ .
Lemma 1. (Locally Smooth Density Functions) If a probability measure $P$ with $M$ disconnected support is locally $\beta$ -smooth, then there exists a function $p _ { m } : S _ { m } \to \mathbb { R } _ { + }$ such that
$$P ( B ) = \int _ { B } p _ { m } ( x ) d \lambda , B \in \sigma ( S _ { m } ) ,$$
where $\lambda$ is the Lebesgue measure, and $p _ { m }$ is $\beta$ -smooth for all $m \in [ M ]$ .
We call $p _ { m }$ as a local density function.
Note that, since Ť $P$ with disconnected supports is not absolutely continuous to the Lebesgue measure on $\textstyle I ^ { D } \backslash \bigcup _ { m \in [ M ] } S _ { m }$ , an ordinary density function cannot be defined. Instead, a localized version of density functions for each $S _ { m }$ is introduced, which is guaranteed by the local smoothness.
 Figure 3: Illustration of a probability measure $P$ with a disconnected support. $\operatorname { S u p p } ( P )$ is a union of two disjoint sets $S _ { 1 }$ and $S _ { 2 }$ .
 Figure 4: Illustration of a generator $g$ . To represent discontinuous $S _ { 1 }$ and $S _ { 2 }$ , $g$ should be discontinuous.
# 3.3 DIFFICULTY WITH DISCONNECTED SUPPORTS
As shown in this subsection, the generalization performance of many standard estimation methods is worsened with disconnected supports. We consider popular nonparametric methods, for which the generalization performance is well-studied in the asymptotics of the observation size $n$ . The considered methods are the kernel density estimator (KDE) (Nadaraya, 1964), the nonparametric Bayes (NB) by the Dirichlet mixtures of normal distributions (Ferguson, 1973), the series density estimator (SDE) (Efromovich et al., 2008; Efromovich, 2010) and the density estimator with Gaussian process (GP) (Leonard, 1978). Bounds of the generalization errors for these methods are already known (Tsybakov, 2009; Ghosal et al., 2007; van der Vaart $\&$ van Zanten, 2008), and they are optimal in the minimax sense. Here, their performance is evaluated with respect to a root of an expected squared loss with respect to the $L ^ { 2 }$ -norm, namely, $d _ { 2 } ( P , P ^ { \prime } ) : = \mathbb { E } [ \| p - p ^ { \prime } \| _ { L ^ { 2 } } ^ { 2 } ] ^ { 1 / 2 }$ where $p$ and $p ^ { \prime }$ are densities for $P$ and $P ^ { \prime }$ .
We show the deterioration of their performance by the disconnected support property. Let $\hat { P }$ be an estimator for $P ^ { * }$ by KDE, NB, SDE, or GP. If $P ^ { * }$ has a global support and a $\beta$ -smooth density, the existing studies (Tsybakov, 2009; Ghosal et al., 2007; van der Vaart $\&$ van Zanten, 2008) show that
$$d _ { 2 } ( P ^ { * } , \widehat { P } ) = O \left( n ^ { - \beta / ( 2 \beta + D ) } \right) .$$
These bounds are sufficiently tight, since these bounds corresponds to an optimal rate (Stone, 1982), and the performance of the methods can be improved as the density for $P ^ { * }$ is smoother (larger $\beta$ ).
On the other hand, we consider a case in which $P ^ { * }$ has the disconnected support property.
Proposition 1. (Deterioration of other standard methods) There exists $P ^ { * }$ of the disconnected support property and locally $\beta$ -smooth such that
$$d _ { 2 } ( P ^ { * } , \widehat { P } ) = { \cal O } \left( n ^ { - 1 / ( 2 + D ) } \right) .$$
When $P ^ { * }$ has disconnected supports, the errors are worse than those for the global support, independent of $\beta$ . This worse generalization error can be understood by the non-smoothness or discontinuity of the density functions on the boundaries of the disconnected sets (see Figure 3).
We next discuss other generative models for estimating a probability measure. To the best of our knowledge, other probabilistic generative methods (Koller et al., 2009) and the variational autoencoder (Kingma & Welling, 2013), their statistical generalization property is not well investigated. Here we provide a property of generators for probability measures with disconnected supports.
Lemma 2. (Discontinuous Generators for Disconnected Supports) If $P ^ { * }$ has disconnected supports and $P ^ { * } = P _ { g ^ { * } }$ with a generator $g ^ { * }$ , then $g ^ { * }$ is not uniformly continuous.
Lemma 2 states that a generator must be discontinuous to construct a probability measure with disconnected support sets. Intuitively, to make $P _ { g ^ { * } } ( B ) = 0$ for $B \in I ^ { D }$ with $\lambda ( B ) > 0$ , the slope of $g ^ { * }$ at $z \in I ^ { D }$ should be close to infinite for $z \in g ^ { * , - 1 } ( B )$ , hence $g ^ { * }$ cannot be uniformly continuous (see Figure 4). Because of the discontinuity, generative models with smooth functions, such as an adversarial generative model with kernel generators (Sinn & Rawat, 2018), cannot work well with disconnected supports.
# 4 GENERALIZATION BY GANS
We provide generalization analysis for GANs for probability measures with and without disconnected supports. For the purpose, we employ a metric $d _ { \mathcal { F } }$ with properly selected discriminators $\mathcal { F }$ and evaluate the generalization error $d _ { \mathcal { F } } ( P ^ { \ast } , P _ { \hat { g } } )$ with respect to an observation size $n$ and a sampling size $m$ . We assume $\mathcal { F }$ is realized by DNNs as $\mathcal { F } = \Xi ( S _ { f } , B _ { f } , L _ { f } ) \cap \widetilde { \mathcal { F } }$ with parameters $S _ { f } , B _ { f } , L _ { f }$ , where $\tilde { \mathcal { F } }$ is a specified functional class; for an example, $\tilde { \mathcal { F } }$ is 1-Lipschitz functions for WassersteinGAN. Here, we consider settings that all $f \in { \mathcal { F } }$ are $L _ { 1 }$ -Lipschitz continuous and $\| f \| _ { L ^ { \infty } } \leqslant B _ { F }$ with constants $L _ { 1 } , B _ { F } > 0 .$ Generators are also constructed by DNNs as $\mathcal { G } = \Xi ( S _ { g } , B _ { g } , L _ { g } )$ with parameters $S _ { g } , B _ { g } , L _ { g }$ .
A standard line of discussing generalization, we should consider statistical errors and approximation errors. We define a measure of the complexity of $\mathcal { F }$
$$\Upsilon _ { n } ( \mathcal { F } ) : = \operatorname* { i n f } _ { \eta > 0 } 4 \eta + 1 2 n ^ { - 1 / 2 } \int _ { \eta } ^ { c } \log \mathcal { N } ( ( L _ { 1 } + 1 ) ^ { - 1 } \epsilon , \mathcal { F } , \| \cdot \| _ { n } ) ^ { 1 / 2 } d \epsilon ,$$
where $c > 0$ is a constant depends on $\mathcal { F }$ and $\mathcal { N } ( \epsilon , \tilde { \mathcal { F } } , \| \cdot \| )$ is a covering number of $\tilde { \mathcal { F } }$ with respect to an empirical norm $\| \cdot \|$ . We note that $\Upsilon _ { n } ( \mathcal { F } )$ bounds an expectation of the Rademacher complexity as
$$\Upsilon _ { n } ( \mathcal { F } ) \geqslant \mathbb { E } \left[ \operatorname* { s u p } _ { f \in \mathcal { F } } \frac { 1 } { n } \left| \sum _ { i \in [ n ] } \tau _ { i } f ( X _ { i } ) \right| \right] ,$$
where $\tau _ { i }$ is the i.i.d. Rademacher random variables; $\operatorname* { P r } ( \tau _ { i } = 1 ) = \operatorname* { P r } ( \tau _ { i } = 1 ) = 1 / 2$ , and the expectation is about $X _ { i }$ and $\tau _ { i }$ . Using the statistics and learning theory van der Vaart & Wellner (1996); Bartlett et al. (2005), we can apply a bound for $\Upsilon _ { n } ( \mathcal { F } )$ as
$$\Upsilon _ { n } ( \mathcal { F } ) \leqslant C _ { \mathcal { F } } n ^ { - 1 / \kappa } ,$$
with some constants $C _ { \mathcal { F } } > 0$ and $\kappa \geqslant 2$ .
Regarding approximation errors, we need to consider approximation of a discontinuous function; since Lemma 2 shows that a discontinuous generator is necessary to represent disconnected supports. To approximate such generators, DNNs in GANs has an advantage.
Lemma 3. (Approximation for Discontinuous $g$ by DNNs) Suppose $P ^ { * }$ has $M$ disconnected supports and locally $\beta$ -smooth, and also $P ^ { * } = P _ { g ^ { * } }$ holds with some $g ^ { * }$ . Then, for any $S _ { g }$ , there exist $\mathcal { G }$ , ${ \dot { g } } \in { \mathcal { G } }$ , and a constant $c _ { g } = c _ { g } ( B _ { g } , L _ { g } ) > 0$ such that
$$\lVert \dot { \boldsymbol g } _ { d } - \boldsymbol g _ { d } ^ { * } \rVert _ { L ^ { 2 } } \leqslant c _ { g } M S _ { g } ^ { - \beta / D } , \forall d \in [ D ] .$$
Furthermore, if $P ^ { * } = P _ { g ^ { * } }$ has a global support and it is $\beta$ -smooth, (4) holds with $M = 1$
Lemma 3 shows that $\mathcal { G }$ for GANs can approximate $g ^ { * }$ for disconnected supports with the rate $\left( - \beta / D \right)$ by $S _ { g }$ , and the rate is same in the case of global support. This implies an advantage of GANs in comparison with the other standard methods (Proposition 1).
Based on Lemma 3, we obtain the main theorem for generalization analysis.
Theorem 1. (Generalization of GANs) Suppose that $P ^ { * }$ has $M$ disconnected supports and locally $\beta$ -smooth, and we have n observations and m samplings. Then, with $\mathcal { F }$ , an existing $\mathcal { G }$ , an estimator $P _ { \hat { g } }$ by (2), and finite constants $c _ { 1 } =$ $c _ { 1 } ( L _ { f } , B _ { f } , L _ { g } , B _ { g } ) , c _ { 2 } , c _ { 3 } = c _ { 3 } ( L _ { f } , B _ { f } ) > 0$ , the following inequality holds with high probability,
$$d _ { \mathcal { F } } \big ( P ^ { * } , P _ { \widehat { g } } \big ) \leqslant \underbrace { \Upsilon _ { m } ( \widetilde { \mathcal { F } } ) + c _ { 1 } \frac { \sqrt { S _ { g } } + \sqrt { S _ { f } } } { \sqrt { m } } } _ { = : I } + \underbrace { c _ { 2 } M D S _ { g } ^ { - \beta / D } } _ { = : I I } + \underbrace { \Upsilon _ { n } ( \widetilde { \mathcal { F } } ) + c _ { 3 } \sqrt { \frac { S _ { f } } { n } } } _ { = : I I I } .$$
Furthermore, $i f P ^ { * }$ has a global support and it is $\beta$ -smooth, (5) holds with $M = 1$
Each of the terms $I , I I$ and $I I I$ has the following role: $I$ bounds an error by the $m$ samplings, $I I$ bounds an error from approximation by $\mathcal { G }$ , and $I I I$ bounds an error by $n$ observations.
Proof Outline: By the definition of $P _ { \hat { g } }$ in (2) and standard calculation, we obtain the inequality
$$d _ { \mathcal { F } } ( P ^ { * } , P _ { \hat { g } } ) \leqslant \underbrace { 2 \operatorname* { s u p } _ { g \in \mathcal { G } } \operatorname* { s u p } _ { f \in \mathcal { F } } \big | \mathbb { E } _ { P _ { g , m } } [ f ( X ) ] - \mathbb { E } _ { P _ { g } } [ f ( X ) ] \big | } _ { = : i } + \underbrace { \operatorname* { i n f } _ { g \in \mathcal { G } } d _ { \mathcal { F } } ( P _ { g } , P ^ { * } ) } _ { = : i i } + \underbrace { 2 d _ { \mathcal { F } } ( P _ { n } , P _ { 0 } ) } _ { = : i i i } .$$
To obtain $i \leqslant I$ and $i i i \leqslant I I I$ , we apply an empirical process technique (van der Vaart & Wellner, 1996), especially convergence of integral probability measures (Sriperumbudur et al., 2012) and the entropy control technique (Lemma 4 and 5 in the supplementary material). To show $i i \leqslant I I$ , we employ recent results on approximation ability of DNNs (Yarotsky, 2017; Petersen & Voigtlaender, 2017; Imaizumi & Fukumizu, 2018) and obtain an approximation bound for $d _ { \mathcal { F } } ( P _ { g } , P ^ { * } )$ (Lemma 3). Combining these results, we obtain the statement of Theorem 1. □
Theorem 1 provides two trade-off relations with respect to $S _ { g }$ and $S _ { f }$ . The generator class $\mathcal { G }$ controls uncertainty by sampling and the approximation error, while $S _ { f }$ controls uncertainty of observations and discrimination. For balancing the trade-offs, we select the number of parameters (connections of DNNs) with some constants $c _ { g } , c _ { f } > 0$ as
$$S _ { g } = c _ { g } m ^ { D / ( 2 \beta + D ) } , ~ \mathrm { a n d } ~ S _ { f } = c _ { f } n ^ { ( \kappa - 2 ) / \kappa } ,$$
for optimizing the bound (5). We then obtain the following corollary.
Corollary 1. (Convergence Rate of GANs) Make the same assumptions as Theorem $^ { l }$ , and set $S _ { f }$ and $S _ { g }$ as in (6). Then, with high probability converging to 1, we obtain
$$d _ { \mathcal { F } } ( P ^ { \ast } , P _ { \hat { g } } ) = O \left( n ^ { - 1 / \kappa } \right) + O \left( m ^ { - 1 / \kappa } + m ^ { - \beta / ( 2 \beta + D ) } \right) .$$
A selection of $\tilde { \mathcal { F } }$ determines the first term in (7), since \` $\kappa$ depends on ˘ $\tilde { \mathcal { F } }$ . For an example, when $\mathcal { F }$ is a set of 1-Lipschitz functions, the first term is $O \left( n ^ { - 1 / \left( 2 + 2 D \right) } \right)$ (Sriperumbudur et al., 2012).
Remark 1. (Heterogeneous Smoothness)
Corollary 1 can be extended when $P ^ { * }$ has different smoothness for each $m \in [ M ]$ , i.e., $P ^ { * }$ is locally $\beta _ { m }$ -smooth on a set $S _ { m }$ . In this case, we can easily extend our analysis in Theorem 1 and Corollary 1, and obtain the following convergence rate.
$$d _ { \mathcal { F } } ( P ^ { \ast } , P _ { \hat { g } } ) = O \left( n ^ { - 1 / \kappa } \right) + O \left( m ^ { - 1 / \kappa } + m ^ { - \widetilde { \beta } / ( 2 \widetilde { \beta } + D ) } \right) ,$$
where $\widetilde { \beta } : = \operatorname* { m i n } _ { m \in \left[ M \right] } \beta _ { m }$
# 5 DISCUSSION
We emphasize the theoretical results show that GANs do not suffer from the effect of disconnected supports. A larger $\beta$ improves performance of GANs even with disconnected supports, as shown in Theorem 1 and Corollary 1. This phenomenon is different from the result of the other methods discussed in Proposition 1. Hence, we can state that GANs have advantages over the other methods which are deteriorated by the disconnected property (Section 3.3). In other words, when data are generated from a probability measure with disconnected supports and sufficiently smooth in each of the sets, only GANs can estimate the measure effectively and the other methdos cannot. This advantage of GANs comes from the approximation power for discontinuous generators shown in Lemma 3.
The results (5) and (7) provide interpretation about performance of GANs. About convergence with $n$ the complexity of $\tilde { \mathcal { F } }$ and $S _ { f }$ control a trade-off between convergence and a power of discrimination. While smaller $S _ { f }$ reduce the errors in terms of $d _ { \mathcal { F } }$ , too small $S _ { f }$ can lose the power of discrimination to satisfy (1). Hence, setting $S _ { f }$ as in (6) can keep the discrimination power and does not worsen the overall rate of convergence $O ( n ^ { - 1 / \kappa } )$ . About convergence with $m$ , $S _ { g }$ controls the trade-off between the bias and variance of the estimator. An optimal way to select $S _ { g }$ is provided in (6) which depends on $\beta$ and $D$ , and it is more important when $\kappa$ is small (e.g. $\kappa = 2$ as MMD-GAN). Based on the interpretation and the selection rule (6), our study can provide a guideline for a design of the architecture of DNNs.
# 5.1 RELATED WORKS
Compared with studies for understanding GANs (Dziugaite et al., 2015; Liang, 2017; Liu et al., 2017; Zhang et al., 2018; Biau et al., 2018; Arora et al., 2017), we show that GANs can avoid influences of disconnected supports, unlike the other methods, hence it is a source of the advantage of GANs. This paper is the first work to focus on the disconnected support property, while several discussions (Goodfellow, 2016; Liang, 2017; Creswell et al., 2018) focus on models and metrics of the learning scheme of GANs.
It is important to compare our result with other studies for generalization analysis. Although some existing studies (Dziugaite et al., 2015; Liang, 2017; Liu et al., 2017; Zhang et al., 2018; Biau et al., 2018; Arora et al., 2017) provide generalization analysis, they do not analyze an approximation effect, namely, they evaluate $\begin{array} { r } { d _ { \mathcal { F } } ( P ^ { * } , P _ { \hat { g } } ) - \operatorname* { i n f } _ { g \in \mathcal { G } } ( P ^ { * } , P _ { g } ) } \end{array}$ . Since we analyze the term ${ \operatorname* { i n f } } _ { g \in { \mathcal { G } } } ( P ^ { * } , P _ { g } )$ , we can provide a more general bound and discuss the effect of disconnected support.
As we mentioned in the introduction, this paper is not along with studies for low-dimensional supports (Arjovsky & Bottou, 2017). We also note that an optimization aspect and gaming aspect of GANs are out of concerns of this paper. We focus on the statistical aspects of GANs such as sample complexity.
# 6 NUMERICAL EXPERIMENTS
We compare the numerical performance of GANs and the other methods with toy data with. We generate synthetic data from the following two settings: (A) Gaussian distribution restricted on a compact set (global support), and (B) a probability measure with two disconnected supports (density function is the black solid line in Figure 6). We generate $n = 5 0 0$ , 1000, ..., 5000 observations and estimate the true probability measures with Wasserstein GAN, MMD-GAN, KDE (the Gaussian kernel and the Epanechnikov kernel), SDE (Fourier basis), and NB (Dirichlet process prior). Hyperparameters for these methods are selected by cross-validation. For GANs, we set $m = n$ . We use $d _ { \mathcal { F } }$ to evaluate errors by GANs, and a root of the expected squared errors with the $L ^ { 2 }$ -norm for the other methods. The plots are the mean of 30 replications.
Figure 5 shows generalization errors by the methods. With the disconnected support case (B), we plot the estimated density in Figure 6. The black line shows the true density, the dashed line is by estimated densities of the other methods, and bars are histograms by GANs. The results by Wasserstein-GAN and MMD-GAN are almost same, so we omit the result by Wasserstein-GAN.
In Figure 5, we see that in the case of global support (A), the error of GANs and the other methods are comparable. In contrast, in the case of disconnected supports (B), the other standard methods show worse generalization and only GANs keep the high performance. From Figure 6, we can see that GANs can reveal the disconnected supports, while some of the other methods fail to fit. KDE with the Gaussian kernel represents the disconnected support by employing a small bandwidth. However, the small bandwidth yields a too sharp density, tending to worsen the generalization performance.

 Figure 5: Generalization errors. Figure 6: Estimated density functions with the case (B).
# 7 CONCLUSION
We investigate a generalization performance of GANs with a situation such that a support of real probability measures is divided into several sets. We find that GANs do not suffer from the division of supports, while some of the other nonparametric methods loss their efficiency by the division. Since real data are often distributed on such divided supports, the finding in this paper is related to the question of why GANs perform well with real datasets.
# REFERENCES
Martin Arjovsky and Léon Bottou. Towards principled methods for training generative adversarial networks. arXiv preprint arXiv:1701.04862, 2017. Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein gan. arXiv preprint arXiv:1701.07875, 2017. Sanjeev Arora, Rong Ge, Yingyu Liang, Tengyu Ma, and Yi Zhang. Generalization and equilibrium in generative adversarial nets (gans). arXiv preprint arXiv:1703.00573, 2017. Sanjeev Arora, Andrej Risteski, and Yi Zhang. Do gans learn the distribution? some theory and empirics. 2018. Peter L Bartlett, Olivier Bousquet, Shahar Mendelson, et al. Local rademacher complexities. The Annals of Statistics, 33(4):1497–1537, 2005. G Biau, B Cadre, M Sangnier, and U Tanielian. Some theoretical properties of gans. arXiv preprint arXiv:1803.07819, 2018. Austin Animal Center. Shelter animal outcomes. http://www.austintexas.gov/ department/aac. Antonia Creswell, Tom White, Vincent Dumoulin, Kai Arulkumaran, Biswa Sengupta, and Anil A Bharath. Generative adversarial networks: An overview. IEEE Signal Processing Magazine, 35(1): 53–65, 2018. Gintare Karolina Dziugaite, Daniel M Roy, and Zoubin Ghahramani. Training generative neural networks via maximum mean discrepancy optimization. In Proceedings of the Thirty-First Conference on Uncertainty in Artificial Intelligence, pp. 258–267. AUAI Press, 2015. Sam Efromovich. Orthogonal series density estimation. Wiley Interdisciplinary Reviews: Computational Statistics, 2(4):467–476, 2010.
Sam Efromovich et al. Adaptive estimation of and oracle inequalities for probability densities and characteristic functions. The Annals of Statistics, 36(3):1127–1155, 2008.
Thomas S Ferguson. A bayesian analysis of some nonparametric problems. The annals of statistics, pp. 209–230, 1973.
Jon Gauthier. Conditional generative adversarial nets for convolutional face generation. Class Project for Stanford CS231N: Convolutional Neural Networks for Visual Recognition, Winter semester, 2014(5):2, 2014.
Subhashis Ghosal, Aad Van Der Vaart, et al. Posterior convergence rates of dirichlet mixtures at smooth densities. The Annals of Statistics, 35(2):697–723, 2007.
Ian Goodfellow. Nips 2016 tutorial: Generative adversarial networks. arXiv preprint arXiv:1701.00160, 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.
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. 5769–5779, 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 Advances in Neural Information Processing Systems, pp. 6629–6640, 2017.
Masaaki Imaizumi and Kenji Fukumizu. Deep neural networks learn non-smooth functions effectively. arXiv preprint arXiv:1802.04474, 2018.
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
Daphne Koller, Nir Friedman, and Francis Bach. Probabilistic graphical models: principles and techniques. MIT press, 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.
Tom Leonard. Density estimation, stochastic processes and prior information. Journal of the Royal Statistical Society. Series B (Methodological), pp. 113–146, 1978.
Chun-Liang Li, Wei-Cheng Chang, Yu Cheng, Yiming Yang, and Barnabás Póczos. Mmd gan: Towards deeper understanding of moment matching network. In Advances in Neural Information Processing Systems, pp. 2200–2210, 2017.
Yujia Li, Kevin Swersky, and Rich Zemel. Generative moment matching networks. In International Conference on Machine Learning, pp. 1718–1727, 2015.
Tengyuan Liang. How well can generative adversarial networks (gan) learn densities: A nonparametric view. arXiv preprint arXiv:1712.08244, 2017.
Shuang Liu, Olivier Bousquet, and Kamalika Chaudhuri. Approximation and convergence properties of generative adversarial learning. In Advances in Neural Information Processing Systems, pp. 5551–5559, 2017.
William Lotter, Gabriel Kreiman, and David Cox. Unsupervised learning of visual structure using predictive generative networks. arXiv preprint arXiv:1511.06380, 2015.
Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(Nov):2579–2605, 2008.
Pascal Massart. Some applications of concentration inequalities to statistics. In Annales-Faculte des Sciences Toulouse Mathematiques, volume 9, pp. 245–303. Université Paul Sabatier, 2000.
Lars Mescheder, Sebastian Nowozin, and Andreas Geiger. The numerics of gans. In Advances in Neural Information Processing Systems, pp. 1823–1833, 2017.
James R Munkres. Topology. Prentice Hall, 2000.
Elizbar A Nadaraya. On estimating regression. Theory of Probability & Its Applications, 9(1): 141–142, 1964.
Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-gan: Training generative neural samplers using variational divergence minimization. In Advances in Neural Information Processing Systems, pp. 271–279, 2016.
Philipp Petersen and Felix Voigtlaender. Optimal approximation of piecewise smooth functions using deep relu neural networks. arXiv preprint arXiv:1709.05289, 2017.
Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative adversarial text to image synthesis. arXiv preprint arXiv:1605.05396, 2016.
Johannes Schmidt-Hieber. Nonparametric regression using deep neural networks with relu activation function. arXiv preprint arXiv:1708.06633, 2017.
Mathieu Sinn and Ambrish Rawat. Non-parametric estimation of jensen-shannon divergence in generative adversarial network training. In International Conference on Artificial Intelligence and Statistics, pp. 642–651, 2018.
Bharath K Sriperumbudur, Kenji Fukumizu, Arthur Gretton, Bernhard Schölkopf, Gert RG Lanckriet, et al. On the empirical estimation of integral probability metrics. Electronic Journal of Statistics, 6:1550–1599, 2012.
Elias M Stein. Singular integrals and differentiability properties of functions (PMS-30), volume 30. Princeton university press, 2016.
Ingo Steinwart and Andreas Christmann. Support vector machines. Springer Science & Business Media, 2008.
CJ Stone. Optimal global rates of convergence for nonparametric regression. The Annals of Statistics, 10:1040–1053, 1982.
Ilya O Tolstikhin, Sylvain Gelly, Olivier Bousquet, Carl-Johann Simon-Gabriel, and Bernhard Schölkopf. Adagan: Boosting generative models. In Advances in Neural Information Processing Systems, pp. 5430–5439, 2017.
Alexandre B Tsybakov. Introduction to nonparametric estimation, 2009.
AW van der Vaart and JH van Zanten. Rates of contraction of posterior distributions based on gaussian process priors. The Annals of Statistics, 36(3):1435–1463, 2008.
AW van der Vaart and Jon Wellner. Weak Convergence and Empirical Processes: With Applications to Statistics. Springer Science & Business Media, 1996.
Dmitry Yarotsky. Error bounds for approximations with deep relu networks. Neural Networks, 94: 103–114, 2017.
Pengchuan Zhang, Qiang Liu, Dengyong Zhou, Tao Xu, and Xiaodong He. On the discriminationgeneralization tradeoff in gans. Proceedings of International Conference on Learning Representations, 2018.
Junbo Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial network. arXiv preprint arXiv:1609.03126, 2016.
Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. arXiv preprint arXiv:1703.10593, 2017.
# Supplementary Materials for “Understanding GANs via disconnected Support Detection”
We introduce a new notation $P f : = \mathbb { E } _ { X \sim P } [ f ( X ) ]$ with a probability measure $P$ and a function $f$ . For a set $\Omega$ with equipped distance $d$ , let $\mathcal { N } ( \epsilon , \Omega , d )$ be a covering number which is a minimum number of $\epsilon$ -balls to cover $\Omega$ .
# A SOME ADDITIONAL INFORMATION
# A Rigorous Definition of $S _ { \alpha , J }$
We consider a set represented by a combination of multiple horizon functions, which has been used in Petersen & Voigtlaender (2017). Given $\alpha$ -smooth function $h \in \check { H ^ { \alpha } } ( I ^ { D - 1 } )$ with $\alpha \geqslant 1$ , a horizon function $\Psi _ { h } : I ^ { D } \overset { \sim } { } \{ 0 , 1 \}$ is defined for some $d \in [ D ]$ as
$$\Psi _ { h } = \Psi ( x _ { 1 } , \ldots , x _ { d - 1 } , x _ { d } \pm h ( x _ { 1 } , \ldots , x _ { d - 1 } , x _ { d + 1 } , \ldots , x _ { D } ) , x _ { d + 1 } , . . . , x _ { D } ) ,$$
where $\Psi$ is the Heaviside function; $\Psi ( x ) = I _ { \{ x \in I ^ { D } | x _ { d } \geqslant 0 \} }$ . We define a set by the intersection of $J$ horizon functions $\Psi _ { h _ { 1 } } , . . . , \Psi _ { h _ { J } }$ ; namely the family of sets is defined by
$$S _ { \alpha , J } : = \left\{ S \subset [ 0 , 1 ] ^ { D } \mid { \cal I } _ { S } = \Psi _ { h _ { 1 } } \otimes \cdot \cdot \cdot \otimes \Psi _ { h _ { J } } \right\} .$$
Intuitively, $h$ is regarded as an $\alpha$ -smooth curved surface in $I ^ { D }$ , and $\Psi _ { h }$ describes a set which is one side of the surface. Also, $S \in S _ { \alpha , J }$ is a set which is a intersection of $J$ sets by $\Psi _ { h _ { 1 } } , . . . , \Psi _ { h _ { J } }$ .
# A Support of Probability Measures
Let $N _ { x }$ denote an open neighborhood of $x \in I ^ { D }$ , and For a probability measure $P$ , a support of $P$ is defined as
$$\mathrm { S u p p } ( P ) : = \bigg \{ x \in I ^ { D } \ | \ P ( N _ { x } ) > 0 , \forall N _ { x } \in \Sigma \bigg \} .$$
# B PROOFS
# B.1 PROOF OF LEMMA 1
Fix $m \in [ M ]$ and a corresponding $\widetilde { S } _ { m } , S _ { m }$ and $g _ { m }$ . For any $B \in \sigma ( S _ { m } )$ , the definition of $\gamma _ { m }$ yields
$$P _ { X } ( B ) = P _ { Z } ( \gamma _ { m } ^ { - 1 } ( B ) ) = \int _ { \gamma _ { m } ^ { - 1 } ( B ) } p _ { Z } ( z ) d z ,$$
where $p _ { Z }$ is a density function of a uniform measure $P _ { Z }$ . By changing variables $x = \gamma _ { m } ( z )$ , we have
$$\int _ { \gamma _ { m } ^ { - 1 } ( B ) } p _ { Z } ( z ) d z = \int _ { B } p _ { Z } ( \gamma _ { m } ^ { - 1 } ( x ) ) J _ { \gamma _ { m } } ( x ) d x ,$$
where $J _ { \gamma _ { m } } ( x ) = | \operatorname* { d e t } \nabla g _ { m } ^ { - 1 } ( x ) |$ . Using $p _ { Z } ( z ) = 1$ for all $z \in I ^ { D }$ , we obtain the following form of $P _ { X } ( B )$ using a function $p _ { m } : \widetilde { S } _ { m } S _ { m }$ as
$$P _ { X } ( B ) = \int _ { B } J _ { g _ { m } } ( x ) d x = : \int _ { B } p _ { m } ( x ) d x ,$$
and $p _ { m }$ is $\beta$ -smooth since $\gamma _ { m }$ is $\beta + 1$ -smooth and bijective.
# B.2 PROOF OF LEMMA 2
Firstly, we show the first points. Suppose that $g$ is a continuous mapping. By the generalized intermediate value theorem (Theorem 24.3 in Munkres (2000)), we know that $g ( I ^ { D } )$ is connected since $I ^ { D }$ is a connected set. Thus, a support of $P _ { g }$ is connected. However, $P _ { g }$ has a disconnected support, thus there is a contradiction. □
In this proof, $a \lesssim b$ denotes that $b$ is larger than $a$ up to a finite constant. $a = b$ denotes that $a \lesssim b$ and $a \gtrsim b$ hold.
By the definition of $\{ g _ { m } \} _ { m \in [ M ] }$ for the measure with local smoothness, we consider an explicit form of $g _ { m }$ . By Stein (2016), we can extend $g _ { m } : \widetilde { S } _ { m } S _ { m }$ to $\tilde { g } _ { m } : I ^ { D } \to S _ { m }$ since boundaries of $\widetilde { S } _ { m }$ are Lipschitz continuous. Then, we provide the following formulation
$$\widetilde { \boldsymbol { g } } _ { m } ( \boldsymbol { x } ) = ( \gamma _ { m , 1 } ( \boldsymbol { x } ) , . . . , \gamma _ { m , D } ( \boldsymbol { x } ) ) ^ { \top } ,$$
where $\gamma _ { m , d } \in H ^ { \beta } ( I ^ { D } )$ . Then, we obtain the form of $g ^ { * }$ as
$$g ^ { * } = \sum _ { m \in [ M ] } \widetilde { g } _ { m } \otimes \pmb { I } _ { \widetilde { S } _ { m } } .$$
Also, by the definition of $\mathcal { S } _ { 2 \beta , J }$ which contains $\widetilde { S } _ { m }$ , we obtain the form
$${ \cal I } _ { { \widetilde { \cal S } } _ { m } } = \bigotimes _ { j \in [ J ] } \psi _ { h _ { m , j } } ,$$
with existing $\psi _ { h _ { m , j } }$ . Then, we have
$$g ^ { * } = \sum _ { m \in [ M ] } \widetilde { g } _ { m } \bigotimes _ { j \in [ J ] } \psi _ { h _ { m , j } } .$$
Preliminarily, we apply sub-neural networks from Yarotsky (2017) and Petersen & Voigtlaenderř (2017). Let $\zeta [ \Theta _ { + } ]$ be a network for summation such that $\begin{array} { r } { { \bf \Pi } \dot { \zeta } [ \Theta _ { + } ] ( x _ { 1 } , . . . , x _ { D ^ { \prime } } ) = \sum _ { d \in [ D ^ { \prime } ] } x _ { d } } \end{array}$ , and $\zeta [ \Theta _ { \times } ]$ be a network for approximate multiplication such as $| \zeta [ \Theta _ { \times } ] ( x _ { 1 } , . . . , x _ { D ^ { \prime } } ) - \prod _ { d \in [ D ^ { \prime } ] } x _ { d } | < \epsilon$ with some $\epsilon > 0$ for all $x , x ^ { \prime } \in I$ (Proposition 3 in Yarotsky (2017) and Lemma 1 in Imaizumi $\&$ Fukumizu (2018)).
We consider approximation $\begin{array} { r } { \sum _ { m \in [ M ] } \gamma _ { m , d } \bigotimes _ { j \in [ J ] } \psi _ { h _ { m , j } } } \end{array}$ for each $d \in \mathsf { \Gamma } [ D ]$ . Let $\zeta [ \Theta _ { \gamma , d , m } ]$ and $\zeta [ \Theta _ { h , m , j } ]$ for $d \in [ D ] , m \in [ M ]$ and $j \in [ J ]$ , and we will specify the networks later. Also, let $\zeta \bar { [ \Theta _ { S , m } ] } ^ { - } = \zeta [ \Theta _ { \times } ] ( \bar { \zeta } [ \bar { \Theta } _ { h , m , 1 } ] \bar { ( \cdot ) } , \cdot . . . , \zeta [ \Theta _ { h , m , 1 } ] \bar { ( \cdot ) } )$ .
We consider a neural network
$$\zeta [ \Theta _ { d } ] = \zeta [ \Theta _ { + } ] ( \zeta [ \Theta _ { \times } ] ( \zeta [ \Theta _ { \gamma , d , 1 } ] ( \cdot ) , \zeta [ \Theta _ { S , 1 } ] ( \cdot ) ) , . . . , \zeta [ \Theta _ { \times } ] ( \zeta [ \Theta _ { \gamma , d , M } ] ( \cdot ) , \zeta [ \Theta _ { S , M } ] ( \cdot ) ) ) .$$
Then, an approximation error is evaluated as
$$\begin{array} { r l } & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \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}$$
where the last inequality follows the Hölder’s inequality.
About $T _ { 1 , m }$ , there exists a corresponding $\zeta [ \Theta _ { \gamma , d , m } ]$ such that
$$\begin{array} { r } { \| \gamma _ { m , d } - \zeta [ \Theta _ { \gamma , d , m } ] \| _ { L ^ { 2 } } \lesssim \| \Theta _ { \gamma , d , m } \| _ { 1 } ^ { - ( \beta + 1 ) / D } , } \end{array}$$
by following Theorem A.8 in Petersen & Voigtlaender (2017). Also, since $\gamma _ { m , d }$ is bounded by its smoothness and compact support, we have $\| \gamma _ { m , d } \| _ { L ^ { \infty } } < \infty$ hence
$$T _ { 1 , m } \lesssim \| \Theta _ { \gamma , d , m } \| _ { 1 } ^ { - ( \beta + 1 ) / D } .$$
For $T _ { 2 , m }$ , we specify $\zeta [ \Theta _ { h , m , j } ]$ as Theorem 3.1 in Petersen & Voigtlaender (2017). Then, we evaluate the following as
$$\begin{array} { r l } & { \| \gamma _ { m , d } - \zeta [ \Theta _ { \gamma , d , m } ] \| _ { L ^ { 2 } } } \\ & { \leqslant \| \displaystyle \bigoplus _ { j \in [ J ] } \psi _ { h _ { m , j } } - \zeta [ \Theta _ { \star } ] ( \zeta [ \Theta _ { h , m , 1 } ] ( \cdot ) , \ldots , \zeta [ \Theta _ { h , m , 1 } ] ( \cdot ) ) \| _ { L ^ { 2 } } } \\ & { \leqslant \| \displaystyle \bigoplus _ { j \in [ J ] } \psi _ { h _ { m , j } } - \zeta [ \Theta _ { h , m , j } ] \| _ { L ^ { 2 } } + \| \displaystyle \bigotimes _ { j \in [ J ] } \psi _ { h _ { m , j } } - \zeta [ \Theta _ { \star } ] ( \zeta [ \Theta _ { h , m , 1 } ] ( \cdot ) , \ldots , \zeta [ \Theta _ { h , m , 1 } ] ( \cdot ) ) \| _ { L ^ { 2 } } } \\ & { \leqslant \displaystyle \sum _ { j \in [ J ] } \prod _ { j \in [ J ] } \prod _ { l = \delta , j } ( | \psi _ { h _ { m , j } } , | \| _ { L ^ { 2 } } \forall [ \Theta _ { h , m , j } ] \| _ { L ^ { 2 } } ) \| \psi _ { h _ { m , j } } - \zeta [ \Theta _ { h , m , j } ] \| _ { L ^ { 2 } } + \epsilon _ { \times } } \\ & { \leqslant \displaystyle \sum _ { j \in [ J ] } \| \psi _ { h _ { m , j } } - \zeta [ \Theta _ { h , m , j } ] \| _ { L ^ { 2 } } + \epsilon _ { \times } . } \end{array}$$
Here, the last inequality follows the boundedness of $\psi _ { h _ { m , j ^ { \prime } } }$ and $\zeta [ \Theta _ { h , m , j } ]$ by Theorem 3.1 in Petersen & Voigtlaender (2017). Also, Theorem 3.1 in Petersen $\&$ Voigtlaender (2017) provides an existence of $[ \Theta _ { h , m , j }$ such that
$$\begin{array} { r } { \| \psi _ { h _ { m , j } } - \zeta [ \Theta _ { h , m , j } ] \| _ { L ^ { 2 } } \leqslant \| \Theta _ { h , m , j } \| _ { 1 } ^ { - \beta / ( D - 1 ) } . } \end{array}$$
We apply the boundedness of $\zeta [ \Theta _ { h , m , j } ]$ , we have
$$T _ { 2 , m } \lesssim \sum _ { j \in [ J ] } \| \Theta _ { h , m , j } \| _ { 1 } ^ { - \beta / ( D - 1 ) } + \epsilon _ { \times } .$$
Combining the bounds for $T _ { 1 , m }$ and $T _ { 2 , m }$ , we bound
$$\begin{array} { r l } & { \left\| \displaystyle \sum _ { m \in [ M ] } \gamma _ { m , d } \bigotimes \psi _ { h _ { m , j } } - \zeta [ \Theta _ { d } ] \right\| _ { L ^ { 2 } } } \\ & { \leqslant \displaystyle \sum _ { m \in [ M ] } \| \Theta _ { \gamma , d , m } \| _ { 1 } ^ { - ( \beta + 1 ) / D } + \displaystyle \sum _ { m \in [ M ] } \sum _ { j \in [ J ] } \| \Theta _ { h , m , j } \| _ { 1 } ^ { - \beta / ( D - 1 ) } + ( M + 1 ) \epsilon _ { \times } . } \end{array}$$
Here, we consider a parameter $\begin{array} { r } { S = \sum _ { d \in [ D ] } \| \Theta _ { d } \| _ { 1 } } \end{array}$ such that $S = \| \Theta _ { \gamma , d , m } \| _ { 1 } \asymp \| \Theta _ { h , m , j } \| _ { 1 } \asymp \| \Theta _ { \times } \| _ { 1 }$ Also, following Yarotsky (2017) and Petersen & Voigtlaender (2017), a proper selection of $L = | \Theta _ { \times } |$ and $B = \| \Theta _ { \times } \| _ { \infty }$ provides $\epsilon _ { \times } \lesssim \| \Theta _ { \times } \| _ { 0 } ^ { - \beta / D }$ }´β{D0 . Then, we have
$$\left. \sum _ { m \in [ M ] } \gamma _ { m , d } \bigotimes _ { j \in [ J ] } \psi _ { h _ { m , j } } - \zeta [ \Theta _ { d } ] \right. _ { L ^ { 2 } } \lesssim M J S ^ { - \beta / D } .$$
Since $J$ is finite, we obtain the result.
# B.4 PROOF OF THEOREM 1
By the definition of $\widehat g$ in (2), the following inequality holds
$$d _ { \mathcal { F } } ( P _ { n } , P _ { \hat { g } , m } ) = \operatorname* { s u p } _ { f \in \mathcal { F } } ( P _ { n } f - P _ { \hat { g } , m } f ) \leqslant d _ { \mathcal { F } } ( P _ { n } , P _ { g , m } ) = \operatorname* { s u p } _ { f \in \mathcal { F } } ( P _ { n } f - P _ { g , m } f ) ,$$
for arbitrary $g \in { \mathcal { G } }$ .
We consider a bound for $d _ { \mathcal { F } } ( P ^ { \ast } , P _ { \hat { g } } )$ as
$$\begin{array} { r l } & { d _ { \mathcal { F } } \big ( P ^ { * } , P _ { \hat { g } } \big ) = \underset { f \in \mathcal { F } } { \operatorname* { s u p } } \big ( P ^ { * } f - P _ { \hat { g } } f \big ) } \\ & { \quad \quad = \underset { f \in \mathcal { F } } { \operatorname* { s u p } } \big ( P ^ { * } f - P _ { n } f + P _ { n } f - P _ { \hat { g } , m } f + P _ { \hat { g } , m } f - P _ { \hat { g } } f \big ) } \\ & { \quad \quad \leqslant \underset { f \in \mathcal { F } } { \operatorname* { s u p } } \big ( P ^ { * } f - P _ { n } f + P _ { \hat { g } , m } f - P _ { \hat { g } } f \big ) + \underset { f \in \mathcal { F } } { \operatorname* { s u p } } \big ( P _ { n } f - P _ { \hat { g } , m } f \big ) , } \end{array}$$
where the inequality follows (9) with an existing ${ \dot { g } } \in { \mathcal { G } }$ . We will provide a detailed construction of $g ^ { * }$ . We continue the bound as
$$\begin{array} { r l } & { d _ { \mathcal { F } } ( P ^ { * } , P _ { \widehat { g } } ) } \\ & { \leqslant \underset { f \in \mathcal { F } } { \operatorname* { s u p } } ( P ^ { * } f - P _ { n } f + P _ { \widehat { g } , m } f - P _ { \widehat { g } } f ) + \underset { f \in \mathcal { F } } { \operatorname* { s u p } } ( P _ { n } f - P ^ { * } f + P ^ { * } f - P _ { \widehat { g } } f + P _ { \widehat { g } } f - P _ { \widehat { g } , m } f ) } \\ & { \leqslant 2 \underset { g \in \mathcal { G } } { \operatorname* { s u p } } \underset { f \in \mathcal { F } } { \operatorname* { s u p } } | P _ { g , m } f - P _ { g } f | + \underset { f \in \mathcal { F } } { \operatorname* { s u p } } ( P ^ { * } f - P _ { \widehat { g } } f ) + 2 \underset { f \in \mathcal { F } } { \operatorname* { s u p } } | P _ { n } f - P ^ { * } f | } \\ & { = : i + i i + i i i . } \end{array}$$
Here, $i$ denotes an effect from $m$ samplings, $\romannumeral 2$ denotes an approximation error, and iii denotes an uncertainty with the $n$ observations.
To evaluate $i$ and $i i i$ , we provide the following lemma. This result follows a standard technique of the empirical process theory and we provide its outline for a sake of completeness.
Lemma 4. Let $\mathcal { H }$ be a some set of measurable functions and $X _ { 1 } , . . . , X _ { n } \sim P$ be i.i.d. n observations. Suppose that $\mathbb { E } _ { P } [ h ^ { 2 } ( X ) ] \leqslant \sigma ^ { 2 }$ and $\| h \| _ { L ^ { \infty } } < C _ { h }$ hold with finite parameters $\sigma ^ { 2 } > 0$ and $C _ { h } > 0$ . Then, there exists a constant $C _ { \theta }$ and we obtain
$$\begin{array} { r l r } { { \operatorname* { s u p } _ { h \in \mathcal { H } } | \frac { 1 } { n } \sum _ { i \in [ n ] } h ( X _ { i } ) - \mathbb { E } _ { P } [ h ( X ) ] | } } \\ & { } & { \leqslant \operatorname* { i n f } _ { \eta > 0 } \{ 4 \eta + 1 2 \int _ { \eta } ^ { C _ { h } } \sqrt { \frac { \log \mathcal { N } ( \epsilon , \mathcal { H } , \| \cdot \| _ { L ^ { \infty } } ) } { n } } d \epsilon + \sqrt { \frac { 2 \tau \sigma ^ { 2 } + 4 C _ { \theta } } { n } } + \frac { \tau C _ { h } } { n } ( \frac { 2 } { 3 } + C _ { \theta } ) \} } \end{array}$$
with probability at least $1 - 2 \exp ( - \tau )$ for all $\tau > 0$ .
Proof. At the beginning, we bound an expectation of the empirical process (Steinwart & Christmann, 2008; Bartlett et al., 2005; Massart, 2000; Sriperumbudur et al., 2012). Afterward, we evaluate a concentration of the empirical process around the expectation.
By applying the symmetrization and concentration techniques (Proposition 7.10 in Steinwart & Christmann (2008)), we obtain
$$\mathbb { E } _ { P ^ { \otimes n } } \left[ \operatorname* { s u p } _ { h \in \mathcal { H } } \left| \frac { 1 } { n } \sum _ { i \in [ n ] } h ( X _ { i } ) - \mathbb { E } [ h ( X ) ] \right| \right] \leqslant 2 \mathbb { E } _ { P ^ { \otimes n } \otimes \nu ^ { \otimes n } } \left[ \operatorname* { s u p } _ { h \in \mathcal { H } } \left| \frac { 1 } { n } \sum _ { i \in [ n ] } u _ { i } h ( X _ { i } ) \right| \right] ,$$
where $u _ { i } \sim \nu$ is the Rademacher variable which takes 0 or 1 with probability 0.5. Combining this bound with the Taralgand’s inequality (Theorem A.9.1 in Steinwart $\&$ Christmann (2008)), we obtain the following inequality
$$\begin{array} { r l } & { \displaystyle \operatorname* { s u p } _ { h \in \mathcal { H } } \left| \frac { 1 } { n } \sum _ { i \in [ n ] } h ( X _ { i } ) - \mathbb { E } _ { P } [ h ( X ) ] \right| } \\ & { \leqslant ( 1 + \theta ) \mathbb { E } _ { P ^ { \otimes n } \otimes \nu ^ { \otimes n } } \left[ \displaystyle \operatorname* { s u p } _ { h \in \mathcal { H } } \left| \frac { 1 } { n } \sum _ { i \in [ n ] } u _ { i } h ( X _ { i } ) \right| \right] + \sqrt { \frac { 2 \tau \sigma ^ { 2 } } { n } } + \frac { \tau C _ { h } } { n } \left( \frac { 2 } { 3 } + \displaystyle \frac { 1 } { \theta } \right) , } \end{array}$$
with probability at least $1 - \exp ( - \tau )$ for all $\tau > 0$ and $\theta > 0$ .
About the term with the Rademacher variable, we also apply a similar strategy (Lemma A.4 in Bartlett et al. (2005)), then obtain
$$\mathbb { E } _ { P \hat { \otimes } n } \otimes _ { \mathcal { V } } \otimes n ^ { \prime } \left[ \operatorname* { s u p } _ { h \in \mathcal { H } } \left| \frac { 1 } { n } \sum _ { i \in [ n ] } u _ { i } h ( X _ { i } ) \right| \right] \leqslant \frac { 1 } { 1 - \theta ^ { \prime } } \mathbb { E } _ { \nu } \otimes n \left[ \operatorname* { s u p } _ { h \in \mathcal { H } } \left| \frac { 1 } { n } \sum _ { i \in [ n ] } u _ { i } h ( X _ { i } ) \right| \right] + \frac { \tau ^ { \prime } C _ { h } } { n \theta ^ { \prime } ( 1 - \theta ^ { \prime } ) } ,$$
with probability at least $1 - \exp ( - \tau ^ { \prime } )$ for all $\tau ^ { \prime } > 0$ and $\theta ^ { \prime } > 0$ .
Let $\| { \bf \nabla } \cdot { \bf \nabla } \| _ { n }$ be an empirical norm as ˇ ˇı $\begin{array} { r l r } { \| f \| _ { n } ^ { 2 } } & { { } = } & { n ^ { - 1 } \sum _ { i \in [ n ] } f ( X _ { i } ) ^ { 2 } } \end{array}$ . About the term $\begin{array} { r } { \mathbb { E } _ { \nu \otimes n } \left[ \operatorname* { s u p } _ { h \in \mathcal { H } } \left| \frac { 1 } { n } \sum _ { i \in [ n ] } u _ { i } h ( X _ { i } ) \right| \right] } \end{array}$ , we apply the chaining technique and obtain
$$\begin{array} { r } { \mathbb { E } _ { \boldsymbol \nu \otimes \boldsymbol n } \left[ \displaystyle \operatorname* { s u p } _ { h \in \mathcal { H } } \left| \frac { 1 } { n } \sum _ { i \in [ n ] } u _ { i } h ( X _ { i } ) \right| \right] \leqslant \displaystyle \operatorname* { i n f } _ { \boldsymbol \theta ^ { \prime \prime } > 0 } \left\{ 4 \boldsymbol \theta ^ { \prime \prime } + 1 2 \int _ { \boldsymbol \theta ^ { \prime \prime } } ^ { \tilde { C } _ { h } } \sqrt { \frac { \log \mathcal { N } ( \epsilon , \mathcal { H } , \| \cdot \| _ { n } ) } { n } } d \epsilon \right\} } \\ { \leqslant \displaystyle \operatorname* { i n f } _ { \boldsymbol \theta ^ { \prime \prime } > 0 } \left\{ 4 \boldsymbol \theta ^ { \prime \prime } + 1 2 \int _ { \boldsymbol \theta ^ { \prime \prime } } ^ { C _ { h } } \sqrt { \frac { \log \mathcal { N } ( \epsilon , \mathcal { H } , \| \cdot \| _ { L ^ { \infty } } ) } { n } } d \epsilon \right\} , } \end{array}$$
where the last inequality follows a bound for an empirical norm and the boundedness of $\mathcal { H }$ .
Combining (10), (11) and (12) and changing variables, we obtain the result.
To bound $I$ with $\widetilde { X } _ { 1 } , . . . , \widetilde { X } _ { m } \sim P _ { g }$ , we consider the following value
$$\begin{array} { r l } & { \underset { g \in \mathcal { G } } { \operatorname* { s u p } } \underset { f \in \mathcal { F } } { \operatorname* { s u p } } \left| \frac { 1 } { m } \sum _ { i \in [ m ] } f ( \widetilde { X } _ { i } ) - \mathbb { E } _ { P _ { g } } [ h ( X ) ] \right| = \underset { g \in \mathcal { G } } { \operatorname* { s u p } } \underset { f \in \mathcal { F } } { \operatorname* { s u p } } \left| \frac { 1 } { m } \sum _ { i \in [ m ] } f \circ g ( Z _ { i } ) - \mathbb { E } _ { P _ { \mathcal { Z } } } [ f \circ g ( X ) ] \right| } \\ & { \qquad = : \underset { h \in \mathcal { H } } { \operatorname* { s u p } } \left| \frac { 1 } { m } \sum _ { i \in [ m ] } h ( Z _ { i } ) - \mathbb { E } _ { P _ { \mathcal { Z } } } [ h ( X ) ] \right| , } \end{array}$$
where we define $\mathcal { H } = \left\{ h = f \circ g \vert f \in \mathcal { F } , g \in \mathcal { G } \right\}$ . To apply Lemma 4, we investigate a covering number $\mathcal { N } ( \epsilon , \mathcal { H } , \| \cdot \| _ { L ^ { \infty } } )$ .
Lemma 5. Assume that $f \in { \mathcal { F } }$ is $L _ { 1 }$ -Lipschitz continuous. We obtain
$$\log \mathcal { N } ( \epsilon , \mathcal { H } , \| \cdot \| _ { L ^ { \infty } } ) \leqslant \log \mathcal { N } ( ( 1 + L _ { 1 } ) ^ { - 1 } \epsilon , \mathcal { G } , \| \cdot \| _ { L ^ { \infty } } ) + \log \mathcal { N } ( ( 1 + L _ { 1 } ) ^ { - 1 } \epsilon , \mathcal { F } , \| \cdot \| _ { L ^ { \infty } } )$$
Proof. Fix $\epsilon > 0$ . Let $G \subset { \mathcal { G } }$ and $F \subset { \mathcal { F } }$ be covering sets as a set of centers of $\epsilon$ -balls for the covering $\mathcal { G }$ and $\mathcal { F }$ . Obviously, $| G | = \mathcal { N } ( \epsilon , \mathcal { G } , \| \cdot \| _ { L ^ { \infty } } )$ and $| F | = \mathcal { N } ( \epsilon , \mathcal { F } , \| \cdot \| _ { L ^ { \infty } } )$ . We define a subset
$$H : = \left\{ h = f \circ g \vert g \in G , h \in F \right\} \subset \mathcal { H } ,$$
and we known $| H | = | G | \times | F |$ .
For any $h \in \mathcal H$ , there exist $g \in { \mathcal { G } }$ and $f \in { \mathcal { F } }$ , then $f = f \circ g$ holds. Also, by the definition of covering sets, there exist $f ^ { \prime } \in F$ and $g ^ { \prime } \in G$ such that $\| f - f ^ { \prime } \| _ { L ^ { \infty } } \leqslant \epsilon$ and $\| g - g ^ { \prime } \| _ { L ^ { \infty } } \leqslant \epsilon$ . Let $h ^ { \prime } = f ^ { \prime } \circ g ^ { \prime }$ , and we measure the distance
$$\begin{array} { r l } & { \| h - h ^ { \prime } \| _ { L ^ { \infty } } \leqslant \| f \circ g - f ^ { \prime } \circ g ^ { \prime } \| _ { L ^ { \infty } } } \\ & { \qquad = \| f \circ g - f \circ g ^ { \prime } + f \circ g ^ { \prime } - f ^ { \prime } \circ g ^ { \prime } \| _ { L ^ { \infty } } } \\ & { \qquad \leqslant \| f \circ g - f \circ g ^ { \prime } \| _ { L ^ { \infty } } + \| f \circ g ^ { \prime } - f ^ { \prime } \circ g ^ { \prime } \| _ { L ^ { \infty } } } \\ & { \qquad \leqslant L _ { 1 } \| g - g ^ { \prime } \| _ { L ^ { \infty } } + \| f - f ^ { \prime } \| _ { L ^ { \infty } } } \\ & { \qquad \leqslant ( L _ { 1 } + 1 ) \epsilon . } \end{array}$$
Here, the third inequality follows the Lipschitz property of $f \in { \mathcal { F } }$ . Here, we know that $\mathcal { H }$ is covered by $( L _ { 1 } + 1 ) \epsilon$ -balls with the center $H$ . Since $| H | = | G | \times | F |$ , the result holds. □
Now, we have the following entropy bound
$$\begin{array} { r l } & { \log \mathcal { N } ( \epsilon , \mathcal { H } , \| \cdot \| _ { L ^ { \infty } } ) } \\ & { \leqslant \log { \mathcal { N } ( ( 1 + L _ { 1 } ) ^ { - 1 } \epsilon , \mathcal { G } , \| \cdot \| _ { L ^ { \infty } } ) } + \log \mathcal { N } ( ( 1 + L _ { 1 } ) ^ { - 1 } \epsilon , \mathcal { F } , \| \cdot \| _ { L ^ { \infty } } ) } \\ & { \leqslant ( S _ { g } + 1 ) \log ( 2 ( L _ { 1 } + 1 ) \epsilon ^ { - 1 } ( L _ { g } + 1 ) D _ { g } B _ { g } ) } \\ & { \quad + \operatorname* { m i n } \Biggl \{ ( S _ { f } + 1 ) \log ( 2 ( L _ { 1 } + 1 ) \epsilon ^ { - 1 } ( L _ { f } + 1 ) D _ { f } B _ { f } ) , C _ { \kappa } ( 1 + L _ { 1 } ) \epsilon ^ { - \kappa } \Biggr \} } \end{array}$$
with $\begin{array} { r } { D _ { g } : = \prod _ { \ell \in [ L _ { g } + 1 ] } ( D _ { \ell } + 1 ) } \end{array}$ and $\begin{array} { r } { D _ { f } : = \prod _ { \ell \in [ L _ { f } + 1 ] } ( D _ { \ell } + 1 ) } \end{array}$ . Let $\Gamma _ { f } : = 2 ( L _ { f } + 1 ) D _ { f } B _ { f }$ , and $N _ { \epsilon } ( \widetilde { \mathcal { F } } ) : = \log \mathcal { N } ( \epsilon , \widetilde { \mathcal { F } } , \| \cdot \| _ { n } )$ for brevity. Here, we apply Lemma 8 in Schmidt-Hieber (2017) for the entropy bound for $\mathcal { G }$ and $\mathcal { F }$ . Using the entropy bound and Lemma 4, we obtain
$$\begin{array} { r l r } { { 2 \operatorname* { s u p } _ { j \in \mathcal { T } } \big | P _ { n } f - P ^ { * } f \big | } } \\ & { \leqslant 4 \eta + \frac { 1 2 } { n ^ { 1 / 2 } } \int _ { \eta } ^ { \infty } \operatorname* { m i n } \Big \{ N _ { c } ( \widetilde { \mathcal { F } } ) , ( S _ { f } + 1 ) \log ( \Gamma _ { f } \epsilon ^ { - 1 } ) \Big \} ^ { 1 / 2 } d \epsilon } \\ & { } & { + \frac { ( 2 \tau \sigma ^ { 2 } + C _ { \theta } ) ^ { 1 / 2 } } { n ^ { 1 / 2 } } + \frac { \tau C _ { h } ( 2 / 3 + C _ { \theta } ) } { n } } \\ & { \leqslant 4 \eta + \frac { 1 2 } { n ^ { 1 / 2 } } \int _ { \eta } ^ { \infty } N _ { c } ( \widetilde { \mathcal { F } } ) ^ { 1 / 2 } d \epsilon + \frac { 1 2 } { n ^ { 1 / 2 } } ( S _ { f } + 1 ) ^ { 1 / 2 } ( \log ^ { 1 / 2 } \Gamma _ { f } + C _ { \widetilde { \mathcal { F } } } \log ^ { 1 / 2 } C _ { \widetilde { \mathcal { F } } } - \eta \log ^ { 1 / 2 } \eta ) } \\ & { } & { + \frac { ( 2 7 \sigma ^ { 2 } + C _ { \theta } ) ^ { 1 / 2 } } { n ^ { 1 / 2 } } + \frac { \tau C _ { h } ( 2 / 3 + C _ { \theta } ) } { n } } \\ & { \leqslant \Upsilon _ { n } ( \widetilde { \mathcal { F } } ) + \frac { 1 } { n ^ { 1 / 2 } } ( ( S _ { f } + 1 ) ^ { 1 / 2 } A _ { 1 } + A _ { 2 } ) + \frac { A _ { 3 } } { n } , \qquad \mathrm { ~ o ~ } } \end{array}$$
with some $\eta > 0$ , $A _ { 1 } = 1 2 \log ^ { 1 / 2 } \Gamma _ { f } , A _ { 2 } = C _ { \tilde { \pi } } \log ^ { 1 / 2 } C _ { \tilde { \pi } } + ( 2 \tau \sigma ^ { 2 } + C _ { \theta } ) ^ { 1 / 2 }$ , and $A _ { 3 } = \tau C _ { h } ( 2 / 3 +$ $C _ { \theta }$ q. Also, we set $\begin{array} { r } { \Upsilon _ { n } ( \widetilde { \mathcal { F } } ) = 4 \eta + \frac { 1 2 } { n ^ { 1 / 2 } } \int _ { \eta } ^ { C _ { \widetilde { \mathcal { F } } } } N _ { ( L _ { 1 } + 1 ) ^ { - 1 } \epsilon } ( \widetilde { \mathcal { F } } ) ^ { 1 / 2 } d \epsilon } \end{array}$ . Then, we have
$$i i i \leqslant \Upsilon _ { n } ( \widetilde { \mathcal { F } } ) + \frac { 1 } { n ^ { 1 / 2 } } \left( ( S _ { f } + 1 ) ^ { 1 / 2 } A _ { 1 } + A _ { 2 } \right) + \frac { A _ { 3 } } { n } .$$
About $I$ , we define $\Gamma _ { g } : = 2 ( L _ { f } + 1 ) D _ { g } B _ { g }$ and obtain a similar bound as
$$\begin{array} { r l r } & { } & { i \leqslant \Upsilon _ { m } ( \widetilde { \mathcal { F } } ) + \displaystyle \frac { 1 } { m ^ { 1 / 2 } } \left( ( S _ { g } + 1 ) ^ { 1 / 2 } A _ { 1 } ^ { \prime } + A _ { 2 } ^ { \prime } \right) + \displaystyle \frac { A _ { 3 } ^ { \prime } } { m } , } \\ & { } & { A _ { 1 } ^ { \prime } = \smash { 1 2 ( \log ^ { 1 / 2 } \Gamma _ { f } + \log ^ { 1 / 2 } \Gamma _ { g } ) } , A _ { 2 } = C _ { \widetilde { \mathcal { F } } } \log ^ { 1 / 2 } C _ { \widetilde { \mathcal { F } } } + C _ { \mathcal { G } } \log ^ { 1 / 2 } C _ { \mathcal { G } } + 2 ( 2 \tau \sigma ^ { 2 } + C _ { \theta } ) ^ { 1 / 2 } , } \end{array}$$
where and $A _ { 3 } \stackrel { - } { = } 2 \tau C _ { h } ( 2 / 3 + \check { C } _ { \theta } )$ .
About $\romannumeral 2$ , we evaluate the error from approximation by constructing a specific deep neural network for generators. We apply Lemma 3 and let $\dot { \boldsymbol g } = ( \dot { g } _ { 1 } , . . . , \dot { g } _ { D } )$ be a generator specified in Lemma 3.
$$\begin{array} { r l } & { \mathrm { i } i = P _ { g } \ast f - P _ { g } f } \\ & { = \displaystyle \int \big ( f o { g ^ { \ast } } - f o \bar { g } i \big ) d P _ { Z } } \\ & { \lesssim L \displaystyle \int \big | \displaystyle { g ^ { \ast } } - \bar { g } \big | | d P _ { Z } } \\ & { \lesssim L _ { 1 } \left( \displaystyle \sum _ { i \neq [ D ] } \left\lceil g _ { i } ^ { \ast } ( x ) - \bar { g } _ { d } ( x ) \right\rceil ^ { 2 } d P _ { Z } ( x ) \right) ^ { 1 / 2 } } \\ & { - L _ { 1 } \left( \displaystyle \sum _ { i \neq [ D ] } \| g _ { i } ^ { \ast } - \bar { g } _ { d } \| _ { L ^ { 2 } } ^ { 2 } \right) ^ { 1 / 2 } } \\ & { \lesssim \epsilon _ { g , L } \displaystyle L _ { 1 } D M _ { S } e ^ { \frac { 1 } { g } / D } , } \end{array}$$
which follows $L _ { 1 }$ -Lipschitz continuity of $f$ , the Jensen’s inequality, the Cauchy-Schwartz inequality, compactness of the support $I ^ { D }$ , and uniformity of $P _ { Z }$ . Then, we have
$$\begin{array} { r } { i i \leqslant c _ { 2 } M D S _ { g } ^ { - \beta / D } . } \end{array}$$
Combining the result, we obtain the result of Theorem 1.
# B.5 PROOF OF PROPOSITION 1
When $P$ are globally smooth, we obtain a $\beta$ -smooth density function on $I ^ { D }$ by its definition. Due to the smoothness, the studies for nonparametric statistics (Nadaraya, 1964; Ghosal et al., 2007; Efromovich, 2010; van der Vaart $\&$ van Zanten, 2008; Tsybakov, 2009) guarantees that the methods (KDE,NB,SDE, and GP) obtain the rate $O ( n ^ { - \beta / ( 2 \beta + D ) } )$ with respect to the roof of $L ^ { 2 }$ norm.
When $P$ have disconnected supports and locally smooth, we consider a following specific $P$ . Fix $M = 2$ . Let us define supports as $S _ { 1 } = \widetilde { S } _ { 1 } = \{ x \in I ^ { D } \mid x _ { 1 } \leqslant 0 . 5 \} \subset I ^ { D }$ and $S _ { 2 } = \bar { S } _ { 2 } = \{ x \in I ^ { D } \mid $ $x _ { 1 } \leqslant 0 . 5 \} \subset I ^ { D }$ . Also, $g _ { 1 } ( z ) = z$ and $g _ { 2 } : \widetilde { S } _ { 2 } S _ { 2 }$ as
$$g _ { 2 } ( z ) = ( g _ { 2 , 1 } ( z _ { 1 } ) , . . . , g _ { 2 , D } ( z _ { D } ) ) ^ { \top } ,$$
where $g _ { 2 , 1 } ( z _ { 1 } ) = 0 . 6 + c ( z _ { 1 } - 0 . 5 ) ^ { 1 / 3 }$ and $g _ { 2 , d } ( z _ { d } ) = z _ { d }$ for $d \in [ D ] \backslash \{ 1 \}$ with a constant $c$ . Then, by the proof of Lemma 1, $p _ { 2 } ( x )$ on $S _ { 2 }$ is a quadratic function with respect to $z _ { 1 }$ is 1-times differentiable but not twice-differentiable at the boundary $\{ x \in I ^ { D } \mid x _ { 1 } = 0 . 6 \dot \}$ . Hence, the studies (Nadaraya, 1964; Ghosal et al., 2007; Efromovich, 2010; van der Vaart & van Zanten, 2008; Tsybakov, 2009) provides that the generalization error of the methods is bounded by $O ( n ^ { - \beta / ( 2 \beta + D ) } )$ with $\beta = 1$ .123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257# TEMPORAL ENSEMBLING FOR SEMI-SUPERVISEDLEARNING
Samuli Laine NVIDIA slaine@nvidia.com Timo Aila NVIDIA taila@nvidia.com
# ABSTRACT
In this paper, we present a simple and efficient method for training deep neural networks in a semi-supervised setting where only a small portion of training data is labeled. We introduce self-ensembling, where we form a consensus prediction of the unknown labels using the outputs of the network-in-training on different epochs, and most importantly, under different regularization and input augmentation conditions. This ensemble prediction can be expected to be a better predictor for the unknown labels than the output of the network at the most recent training epoch, and can thus be used as a target for training. Using our method, we set new records for two standard semi-supervised learning benchmarks, reducing the (non-augmented) classification error rate from $1 8 . 4 4 \%$ to $7 . 0 5 \%$ in SVHN with 500 labels and from $1 8 . 6 3 \%$ to $1 6 . 5 5 \%$ in CIFAR-10 with 4000 labels, and further to $5 . 1 2 \%$ and $1 2 . 1 6 \%$ by enabling the standard augmentations. We additionally obtain a clear improvement in CIFAR-100 classification accuracy by using random images from the Tiny Images dataset as unlabeled extra inputs during training. Finally, we demonstrate good tolerance to incorrect labels.
# 1 INTRODUCTION
It has long been known that an ensemble of multiple neural networks generally yields better predictions than a single network in the ensemble. This effect has also been indirectly exploited when training a single network through dropout (Srivastava et al., 2014), dropconnect (Wan et al., 2013), or stochastic depth (Huang et al., 2016) regularization methods, and in swapout networks (Singh et al., 2016), where training always focuses on a particular subset of the network, and thus the complete network can be seen as an implicit ensemble of such trained sub-networks. We extend this idea by forming ensemble predictions during training, using the outputs of a single network on different training epochs and under different regularization and input augmentation conditions. Our training still operates on a single network, but the predictions made on different epochs correspond to an ensemble prediction of a large number of individual sub-networks because of dropout regularization.
This ensemble prediction can be exploited for semi-supervised learning where only a small portion of training data is labeled. If we compare the ensemble prediction to the current output of the network being trained, the ensemble prediction is likely to be closer to the correct, unknown labels of the unlabeled inputs. Therefore the labels inferred this way can be used as training targets for the unlabeled inputs. Our method relies heavily on dropout regularization and versatile input augmentation. Indeed, without neither, there would be much less reason to place confidence in whatever labels are inferred for the unlabeled training data.
We describe two ways to implement self-ensembling, Π-model and temporal ensembling. Both approaches surpass prior state-of-the-art results in semi-supervised learning by a considerable margin. We furthermore observe that self-ensembling improves the classification accuracy in fully labeled cases as well, and provides tolerance against incorrect labels.
The recently introduced transform/stability loss of Sajjadi et al. (2016b) is based on the same principle as our work, and the $\Pi$ -model can be seen as a special case of it. The Π-model can also be seen as a simplification of the $\Gamma$ -model of the ladder network by Rasmus et al. (2015), a previously presented network architecture for semi-supervised learning. Our temporal ensembling method has connections to the bootstrapping method of Reed et al. (2014) targeted for training with noisy labels.
#
 Figure 1: Structure of the training pass in our methods. Top: $\Pi$ -model. Bottom: temporal ensembling. Labels $y _ { i }$ are available only for the labeled inputs, and the associated cross-entropy loss component is evaluated only for those.
# Algorithm 1 Π-model pseudocode.
<table><tr><td colspan="2">Require: xi = training stimuli</td></tr><tr><td colspan="2">Require: L = set of training input indices with known labels Require:yi =labels for labeled inputs i∈L</td></tr><tr><td colspan="2"></td></tr><tr><td colspan="2">Require: w(t) = unsupervised weight ramp-up function</td></tr><tr><td colspan="2">Require: J fe(x)= stochastic neural network with trainable parameters 0</td></tr><tr><td colspan="2">Require: g(x) = stochastic input augmentation function</td></tr><tr><td colspan="2">for t in [1, num_epochs] do</td></tr><tr><td colspan="2">for each minibatch B do</td></tr><tr><td>Zi∈B←fe(g(xi∈B))</td><td>> evaluate network outputs for augmented inputs</td></tr><tr><td>ZieB←fo(g(xi∈B))</td><td>V again,with different dropout and augmentation</td></tr><tr><td>loss ←-∑ie(BnL)log Zilyi]</td><td> supervised loss component</td></tr><tr><td>+w(t)oB∑ieBllzi-zll2</td><td>> unsupervised loss component</td></tr><tr><td></td><td></td></tr><tr><td>update θ using, e.g., ADAM</td><td>D update network parameters</td></tr><tr><td>end for</td><td></td></tr><tr><td>end for</td><td></td></tr><tr><td>return θ</td><td></td></tr></table>
# 2 SELF-ENSEMBLING DURING TRAINING
We present two implementations of self-ensembling during training. The first one, $\Pi$ -model, encourages consistent network output between two realizations of the same input stimulus, under two different dropout conditions. The second method, temporal ensembling, simplifies and extends this by taking into account the network predictions over multiple previous training epochs.
We shall describe our methods in the context of traditional image classification networks. Let the training data consist of total of $N$ inputs, out of which $M$ are labeled. The input stimuli, available for all training data, are denoted $x _ { i }$ , where $i \in \{ 1 \ldots N \}$ . Let set $L$ contain the indices of the labeled inputs, $| L | = M$ . For every $i \in L$ , we have a known correct label $y _ { i } \in \{ 1 \ldots C \}$ , where $C$ is the number of different classes.
# 2.1 Π-MODEL
The structure of $\Pi$ -model is shown in Figure 1 (top), and the pseudocode in Algorithm 1. During training, we evaluate the network for each training input $x _ { i }$ twice, resulting in prediction vectors $z _ { i }$ and $\tilde { z } _ { i }$ . Our loss function consists of two components. The first component is the standard crossentropy loss, evaluated for labeled inputs only. The second component, evaluated for all inputs, penalizes different predictions for the same training input $x _ { i }$ by taking the mean square difference between the prediction vectors $z _ { i }$ and $\tilde { z } _ { i }$ .1 To combine the supervised and unsupervised loss terms, we scale the latter by time-dependent weighting function $w ( t )$ . By comparing the entire output vectors $z _ { i }$ and $\tilde { z } _ { i }$ , we effectively ask the “dark knowledge” (Hinton et al., 2015) between the two evaluations to be close, which is a much stronger requirement compared to asking that only the final classification remains the same, which is what happens in traditional training.
It is important to notice that, because of dropout regularization, the network output during training is a stochastic variable. Thus two evaluations of the same input $x _ { i }$ under same network weights $\theta$ yield different results. In addition, Gaussian noise and augmentations such as random translation are evaluated twice, resulting in additional variation. The combination of these effects explains the difference between the prediction vectors $z _ { i }$ and $\tilde { z } _ { i }$ . This difference can be seen as an error in classification, given that the original input $x _ { i }$ was the same, and thus minimizing it is a reasonable goal.
In our implementation, the unsupervised loss weighting function $w ( t )$ ramps up, starting from zero, along a Gaussian curve during the first 80 training epochs. See Appendix A for further details about this and other training parameters. In the beginning the total loss and the learning gradients are thus dominated by the supervised loss component, i.e., the labeled data only. We have found it to be very important that the ramp-up of the unsupervised loss component is slow enough—otherwise, the network gets easily stuck in a degenerate solution where no meaningful classification of the data is obtained.
Our approach is somewhat similar to the $\Gamma$ -model of the ladder network by Rasmus et al. (2015), but conceptually simpler. In the $\Pi$ -model, the comparison is done directly on network outputs, i.e., after softmax activation, and there is no auxiliary mapping between the two branches such as the learned denoising functions in the ladder network architecture. Furthermore, instead of having one “clean” and one “corrupted” branch as in $\Gamma$ -model, we apply equal augmentation and noise to the inputs for both branches.
As shown in Section 3, the $\Pi$ -model combined with a good convolutional network architecture provides a significant improvement over prior art in classification accuracy.
# 2.2 TEMPORAL ENSEMBLING
Analyzing how the Π-model works, we could equally well split the evaluation of the two branches in two separate phases: first classifying the training set once without updating the weights $\theta$ , and then training the network on the same inputs under different augmentations and dropout, using the just obtained predictions as targets for the unsupervised loss component. As the training targets obtained this way are based on a single evaluation of the network, they can be expected to be noisy. Temporal ensembling alleviates this by aggregating the predictions of multiple previous network evaluations into an ensemble prediction. It also lets us evaluate the network only once during training, gaining an approximate $2 \mathbf { x }$ speedup over the $\Pi$ -model.
The structure of our temporal ensembling method is shown in Figure 1 (bottom), and the pseudocode in Algorithm 2. The main difference to the $\Pi$ -model is that the network and augmentations are evaluated only once per input per epoch, and the target vectors $\tilde { z }$ for the unsupervised loss component are based on prior network evaluations instead of a second evaluation of the network.
After every training epoch, the network outputs $z _ { i }$ are accumulated into ensemble outputs $Z _ { i }$ by updating $Z _ { i } \gets \alpha Z _ { i } + ( 1 - \alpha ) z _ { i }$ , where $\alpha$ is a momentum term that controls how far the ensemble reaches into training history. Because of dropout regularization and stochastic augmentation, $Z$ thus contains a weighted average of the outputs of an ensemble of networks $f$ from previous training epochs, with recent epochs having larger weight than distant epochs. For generating the training targets $\tilde { z }$ , we need to correct for the startup bias in $Z$ by dividing by factor $( 1 - \alpha ^ { \bar { t } } )$ . A similar bias correction has been used in, e.g., Adam (Kingma & Ba, 2014) and mean-only batch normalization (Salimans & Kingma, 2016). On the first training epoch, $Z$ and $\tilde { z }$ are zero as no data from previous epochs is available. For this reason, we specify the unsupervised weight ramp-up function $w ( t )$ to also be zero on the first training epoch.
Algorithm 2 Temporal ensembling pseudocode. Note that the updates of $Z$ and $\tilde { z }$ could equally well be done inside the minibatch loop; in this pseudocode they occur between epochs for clarity.
<table><tr><td>Require: xi = training stimuli</td><td></td></tr><tr><td></td><td>Require: L = set of training input indices with known labels</td></tr><tr><td></td><td></td></tr><tr><td></td><td>Require: Yi = labels for labeled inputs i ∈ L</td></tr><tr><td></td><td>Require: α =ensembling momentum, O ≤α<1</td></tr><tr><td></td><td>Require: w(t) = unsupervised weight ramp-up function Require: fe(x) = stochastic neural network with trainable parameters 0</td></tr><tr><td></td><td>Require: g(x) = stochastic input augmentation function</td></tr><tr><td>Z←O[N×C]</td><td>Dinitialize ensemble predictions</td></tr><tr><td>←O[N×C]</td><td>>initialize target vectors</td></tr><tr><td>for t in'[1, num-epochs] do</td><td></td></tr><tr><td>for each minibatch B do</td><td></td></tr><tr><td>Zi∈B←fe(g(xi∈B,t))</td><td>> evaluate network outputs for augmented inputs</td></tr><tr><td>loss ←-∑ie(BnL)log zi[yi]</td><td> supervised loss component</td></tr><tr><td>+ w(t)B∑ieBllzi -ill2</td><td>unsupervised loss component</td></tr><tr><td>update 0 using, e.g.,ADAM</td><td>update network parameters</td></tr><tr><td>end for Z←αZ+(1-α)z</td><td></td></tr><tr><td></td><td>>accumulate ensemble predictions</td></tr><tr><td>←Z/(1-at)</td><td>V construct target vectors by bias correction</td></tr><tr><td>end for</td><td></td></tr><tr><td>return θ</td><td></td></tr></table>
The benefits of temporal ensembling compared to $\Pi$ -model are twofold. First, the training is faster because the network is evaluated only once per input on each epoch. Second, the training targets $\tilde { z }$ can be expected to be less noisy than with $\Pi$ -model. As shown in Section 3, we indeed obtain somewhat better results with temporal ensembling than with Π-model in the same number of training epochs. The downside compared to $\Pi$ -model is the need to store auxiliary data across epochs, and the new hyperparameter $\alpha$ . While the matrix $Z$ can be fairly large when the dataset contains a large number of items and categories, its elements are accessed relatively infrequently. Thus it can be stored, e.g., in a memory mapped file.
An intriguing additional possibility of temporal ensembling is collecting other statistics from the network predictions $z _ { i }$ besides the mean. For example, by tracking the second raw moment of the network outputs, we can estimate the variance of each output component $z _ { i , j }$ . This makes it possible to reason about the uncertainty of network outputs in a principled way (Gal & Ghahramani, 2016). Based on this information, we could, e.g., place more weight on more certain predictions vs. uncertain ones in the unsupervised loss term. However, we leave the exploration of these avenues as future work.
# 3 RESULTS
Our network structure is given in Table 5, and the test setup and all training parameters are detailed in Appendix A. We test the Π-model and temporal ensembling in two image classification tasks, CIFAR-10 and SVHN, and report the mean and standard deviation of 10 runs using different random seeds.
Although it is rarely stated explicitly, we believe that our comparison methods do not use input augmentation, i.e., are limited to dropout and other forms of permutation-invariant noise. Therefore we report the error rates without augmentation, unless explicitly stated otherwise. Given that the ability of an algorithm to extract benefit from augmentation is also an important property, we report the classification accuracy using a standard set of augmentations as well. In purely supervised training the de facto standard way of augmenting the CIFAR-10 dataset includes horizontal flips and random translations, while SVHN is limited to random translations. By using these same augmentations we can compare against the best fully supervised results as well. After all, the fully supervised results should indicate the upper bound of obtainable accuracy.
Table 1: CIFAR-10 results with 4000 labels, averages of 10 runs (4 runs for all labels).
<table><tr><td></td><td colspan="2">Errorrate(%)with#labels</td></tr><tr><td>Supervised-only</td><td>4000 35.56 ±1.59</td><td>All (50000) 7.33 ± 0.04</td></tr><tr><td>with augmentation Conv-Large, I-model (Rasmus et al., 2015)</td><td>34.85 ± 1.65 20.40 ± 0.47</td><td>6.05 ± 0.15</td></tr><tr><td>CatGAN (Springenberg,2016) GAN of Salimans et al. (2016)</td><td>19.58 ± 0.58</td><td></td></tr><tr><td>II-model</td><td>18.63 ± 2.32</td><td></td></tr><tr><td>II-model with augmentation</td><td>16.55 ± 0.29</td><td>6.90±0.07</td></tr><tr><td>Temporal ensembling with augmentation</td><td>12.36 ± 0.31 12.16 ± 0.24</td><td>5.56 ± 0.10 5.60 ± 0.10</td></tr></table>
Table 2: SVHN results for 500 and 1000 labels, averages of 10 runs (4 runs for all labels).
<table><tr><td rowspan="2">Model</td><td colspan="3">Error rate(%)with # labels</td></tr><tr><td>500</td><td>1000</td><td>All (73257)</td></tr><tr><td>Supervised-only with augmentation</td><td>35.18 ± 5.61 31.59 ± 3.60</td><td>20.47± 2.64 19.30 ± 3.89</td><td>3.05± 0.07 2.88 ±0.03</td></tr><tr><td>DGN (Kingma et al., 2014) Virtual Adversarial (Miyato et al., 2016)</td><td></td><td>36.02 ± 0.10</td><td></td></tr><tr><td>ADGM (Maalge et al., 2016)</td><td></td><td>24.63 22.86</td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>SDGM (Maalge et al., 2016)</td><td></td><td>16.61 ± 0.24</td><td></td></tr><tr><td>GAN of Salimans et al. (2016)</td><td>18.44 ± 4.8</td><td>8.11 ± 1.3</td><td></td></tr><tr><td>II-model</td><td>7.05 ± 0.30</td><td>5.43 ± 0.25</td><td>2.78 ± 0.03</td></tr><tr><td>II-model with augmentation</td><td>6.65 ± 0.53</td><td></td><td></td></tr><tr><td></td><td></td><td>4.82 ± 0.17</td><td>2.54 ± 0.04</td></tr><tr><td>Temporal ensembling with augmentation</td><td>5.12 ± 0.13</td><td>4.42 ± 0.16</td><td>2.74± 0.06</td></tr></table>
# 3.1 CIFAR-10
CIFAR-10 is a dataset consisting of $3 2 \times 3 2$ pixel RGB images from ten classes. Table 1 shows a 2.1 percentage point reduction in classification error rate with 4000 labels (400 per class) compared to earlier methods for the non-augmented $\Pi$ -model.
Enabling the standard set of augmentations further reduces the error rate by 4.2 percentage points to $1 2 . 3 6 \%$ . Temporal ensembling is slightly better still at $1 2 . 1 6 \%$ , while being twice as fast to train. This small improvement conceals the subtle fact that random horizontal flips need to be done independently for each epoch in temporal ensembling, while $\Pi$ -model can randomize once per a pair of evaluations, which according to our measurements is ${ \sim } 0 . 5$ percentage points better than independent flips.
A principled comparison with Sajjadi et al. (2016b) is difficult due to several reasons. They provide results only for a fairly extreme set of augmentations (translations, flipping, rotations, stretching, and shearing) on top of fractional max pooling (Graham, 2014), which introduces random, local stretching inside the network, and is known to improve classification results substantially. They quote an error rate of only $1 3 . 6 0 \%$ for supervised-only training with 4000 labels, while our corresponding baseline is $3 4 . 8 5 \%$ . This gap indicates a huge benefit from versatile augmentations and fractional max pooling—in fact, their baseline result is already better than any previous semisupervised results. By enabling semi-supervised learning they achieve a $17 \%$ drop in classification error rate (from $1 3 . 6 0 \%$ to $1 1 . 2 9 \%$ ), while we see a much larger relative drop of $65 \%$ (from $3 4 . 8 5 \%$ to $1 2 . 1 6 \%$ ).
# 3.2 SVHN
The street view house numbers (SVHN) dataset consists of $3 2 \times 3 2$ pixel RGB images of real-world house numbers, and the task is to classify the centermost digit. In SVHN we chose to use only the official 73257 training examples following Salimans et al. (2016). Even with this choice our error rate with all labels is only $3 . { \bar { 0 } } 5 \%$ without augmentation.
Table 3: CIFAR-100 results with 10000 labels, averages of 10 runs (4 runs for all labels).
<table><tr><td></td><td colspan="2">Error rate(%)with#labels</td></tr><tr><td>Supervised-only</td><td>10000 51.21 ± 0.33</td><td>All (50000) 29.14±0.25</td></tr><tr><td>with augmentation</td><td>44.56 ± 0.30</td><td>26.42 ± 0.17</td></tr><tr><td>II-model II-model with augmentation Temporal ensembling with augmentation</td><td>43.43± 0.54 39.19 ± 0.36 38.65 ± 0.51</td><td>29.06 ± 0.21 26.32 ± 0.04 26.30 ± 0.15</td></tr></table>
Table 4: CIFAR- $1 0 0 +$ Tiny Images results, averages of 10 runs.
<table><tr><td rowspan="2"></td><td colspan="2">Error rate(%) with # unlabeled auxiliary inputs from Tiny Images</td></tr><tr><td>Random 500k</td><td>Restricted 237k</td></tr><tr><td>I-model with augmentation</td><td>25.79 ± 0.17</td><td>25.43 ± 0.32</td></tr><tr><td>Temporal ensembling with augmentation</td><td>23.62 ± 0.23</td><td>23.79 ± 0.24</td></tr></table>
Table 2 compares our method to the previous state-of-the-art. With the most commonly used 1000 labels we observe an improvement of 2.7 percentage points, from $8 . 1 1 \%$ to $5 . 4 3 \%$ without augmentation, and further to $4 . { \bar { 4 } } 2 \%$ with standard augmentations.
We also investigated the behavior with 500 labels, where we obtained an error rate less than half of Salimans et al. (2016) without augmentations, with a significantly lower standard deviation as well. When augmentations were enabled, temporal ensembling further reduced the error rate to $5 . 1 2 \%$ . In this test the difference between $\Pi$ -model and temporal ensembling was quite significant at 1.5 percentage points.
In SVHN Sajjadi et al. (2016b) provide results without augmentation, with the caveat that they use fractional max pooling, which is a very augmentation-like technique due to the random, local stretching it introduces inside the network. It leads to a superb error rate of $2 . 2 8 \%$ in supervisedonly training, while our corresponding baseline is $3 . 0 5 \%$ (or $2 . 8 8 \%$ with translations). Given that in a separate experiment our network matched the best published result for non-augmented SVHN when extra data is used $1 . 6 9 \%$ from Lee et al. (2015)), this gap is quite surprising, and leads us to conclude that fractional max pooling leads to a powerful augmentation of the dataset, well beyond what simple translations can achieve. Our temporal ensembling technique obtains better error rates for both 500 and 1000 labels $5 . 1 2 \%$ and $4 . 4 2 \%$ , respectively) compared to the $6 . 0 3 \%$ reported by Sajjadi et al. for 732 labels.
# 3.3 CIFAR-100 AND TINY IMAGES
The CIFAR-100 dataset consists of $3 2 \times 3 2$ pixel RGB images from a hundred classes. We are not aware of previous semi-supervised results in this dataset, and chose 10000 labels for our experiments. Table 3 shows error rates of $4 3 . 4 3 \%$ and $3 8 . 6 5 \%$ without and with augmentation, respectively. These correspond to 7.8 and 5.9 percentage point improvements compared to supervised learning with labeled inputs only.
We ran two additional tests using unlabeled extra data from Tiny Images dataset (Torralba et al., 2008): one with randomly selected $5 0 0 \mathrm { k }$ extra images, most not corresponding to any of the CIFAR100 categories, and another with a restricted set of 237k images from the categories that correspond to those found in the CIFAR-100 dataset (see appendix A for details). The results are shown in Table 4. The addition of randomly selected, unlabeled extra images improved the error rate by 2.7 percentage points (from $2 6 . 3 0 \%$ to $2 3 . 6 3 \%$ ), indicating a desirable ability to learn from random natural images. Temporal ensembling benefited much more from the extra data than the $\Pi$ -model. Interestingly, restricting the extra data to categories that are present in CIFAR-100 did not improve the classification accuracy further. This indicates that in order to train a better classifier by adding extra data as unlabeled inputs, it is enough to have the extra data roughly in the same space as the actual inputs—in our case, natural images. We hypothesize that it may even be possible to use properly crafted synthetic data as unlabeled inputs to obtain improved classifiers.
 Figure 2: Percentage of correct SVHN classifications as a function of training epoch when a part of the labels is randomized. With standard supervised training (left) the classification accuracy suffers when even a small portion of the labels give disinformation, and the situation worsens quickly as the portion of randomized labels increases to $50 \%$ or more. On the other hand, temporal ensembling (right) shows almost perfect resistance to disinformation when half of the labels are random, and retains over ninety percent classification accuracy even when $80 \%$ of the labels are random.
In order to keep the training times tolerable, we limited the number of unlabeled inputs to $5 0 \mathrm { k }$ per epoch in these tests, i.e., on every epoch we trained using all $5 0 \mathrm { k }$ labeled inputs from CIFAR-100 and $5 0 \mathrm { k }$ additional unlabeled inputs from Tiny Images. The $5 0 \mathrm { k }$ unlabeled inputs were chosen randomly on each epoch from the $5 0 0 \mathrm { k }$ or 237k extra inputs. In temporal ensembling, after each epoch we updated only the rows of $Z$ that corresponded to inputs used on that epoch.
# 3.4 SUPERVISED LEARNING
When all labels are used for traditional supervised training, our network approximately matches the state-of-the-art error rate for a single model in CIFAR-10 with augmentation (Lee et al., 2015; Mishkin & Matas, 2016) at $6 . 0 5 \%$ , and without augmentation (Salimans & Kingma, 2016) at $7 . 3 3 \%$ . The same is probably true for SVHN as well, but there the best published results rely on extra data that we chose not to use.
Given this premise, it is perhaps somewhat surprising that our methods reduce the error rate also when all labels are used (Tables 1 and 2). We believe that this is an indication that the consistency requirement adds a degree of resistance to ambiguous labels that are fairly common in many classification tasks, and that it encourages features to be more invariant to stochastic sampling.
# 3.5 TOLERANCE TO INCORRECT LABELS
In a further test we studied the hypothesis that our methods add tolerance to incorrect labels by assigning a random label to a certain percentage of the training set before starting to train. Figure 2 shows the classification error graphs for standard supervised training and temporal ensembling.
Clearly our methods provide considerable resistance to wrong labels, and we believe this is because the unsupervised loss term encourages the mapping function implemented by the network to be flat in the vicinity of all input data points, whereas the supervised loss term enforces the mapping function to have a specific value in the vicinity of the labeled input data points. This means that even the wrongly labeled inputs play a role in shaping the mapping function—the unsupervised loss term smooths the mapping function and thus also the decision boundaries, effectively fusing the inputs into coherent clusters, whereas the excess of correct labels in each class is sufficient for locking the clusters to the right output vectors through the supervised loss term. The difference to classical regularizers is that we induce smoothness only on the manifold of likely inputs instead of over the entire input domain. For further analysis about the importance of the gradient of the mapping function, see Simard et al. (1998).
# 4 RELATED WORK
There is a large body of previous work on semi-supervised learning (Zhu, 2005). In here we will concentrate on the ones that are most directly connected to our work.
$\Gamma$ -model is a subset of a ladder network (Rasmus et al., 2015) that introduces lateral connections into an encoder-decoder type network architecture, targeted at semi-supervised learning. In $\Gamma \cdot$ -model, all but the highest lateral connections in the ladder network are removed, and after pruning the unnecessary stages, the remaining network consists of two parallel, identical branches. One of the branches takes the original training inputs, whereas the other branch is given the same input corrupted with noise. The unsupervised loss term is computed as the squared difference between the (pre-activation) output of the clean branch and a denoised (pre-activation) output of the corrupted branch. The denoised estimate is computed from the output of the corrupted branch using a parametric nonlinearity that has 10 auxiliary trainable parameters per unit. Our Π-model differs from the $\Gamma$ -model in removing the parametric nonlinearity and denoising, having two corrupted paths, and comparing the outputs of the network instead of pre-activation data of the final layer.
Sajjadi et al. (2016b) recently introduced a new loss function for semi-supervised learning, so called transform/stability loss, which is founded on the same principle as our work. During training, they run augmentation and network evaluation $n$ times for each minibatch, and then compute an unsupervised loss term as the sum of all pairwise squared distances between the obtained $n$ network outputs. As such, their technique follows the general pseudo-ensemble agreement (PEA) regularization framework of Bachman et al. (2014). In addition, they employ a mutual exclusivity loss term (Sajjadi et al., 2016a) that we do not use. Our $\Pi$ -model can be seen as a special case of the transform/stability loss obtained by setting $n = 2$ . The computational cost of training with transform/stability loss increases linearly as a function of $n$ , whereas the efficiency of our temporal ensembling technique remains constant regardless of how large effective ensemble we obtain via the averaging of previous epochs’ predictions.
In bootstrap aggregating, or bagging, multiple networks are trained independently based on subsets of training data (Breiman, 1996). This results in an ensemble that is more stable and accurate than the individual networks. Our approach can be seen as pulling the predictions from an implicit ensemble that is based on a single network, and the variability is a result of evaluating it under different dropout and augmentation conditions instead of training on different subsets of data. In work parallel to ours, Huang et al. (2017) store multiple snapshots of the network during training, hopefully corresponding to different local minima, and use them as an explicit ensemble.
The general technique of inferring new labels from partially labeled data is often referred to as bootstrapping or self-training, and it was first proposed by Yarowsky (1995) in the context of linguistic analysis. Whitney & Sarkar (2012) analyze Yarowsky’s algorithm and propose a novel graph-based label propagation approach. Similarly, label propagation methods (Zhu & Ghahramani, 2002) infer labels for unlabeled training data by comparing the associated inputs to labeled training inputs using a suitable distance metric. Our approach differs from this in two important ways. Firstly, we never compare training inputs against each other, but instead only rely on the unknown labels remaining constant, and secondly, we let the network produce the likely classifications for the unlabeled inputs instead of providing them through an outside process.
In addition to partially labeled data, considerable amount of effort has been put into dealing with densely but inaccurately labeled data. This can be seen as a semi-supervised learning task where part of the training process is to identify the labels that are not to be trusted. For recent work in this area, see, e.g., Sukhbaatar et al. (2014) and Patrini et al. (2016). In this context of noisy labels, Reed et al. (2014) presented a simple bootstrapping method that trains a classifier with the target composed of a convex combination of the previous epoch output and the known but potentially noisy labels. Our temporal ensembling differs from this by taking into account the evaluations over multiple epochs.
Generative Adversarial Networks (GAN) have been recently used for semi-supervised learning with promising results (Maaløe et al., 2016; Springenberg, 2016; Odena, 2016; Salimans et al., 2016). It
Table 5: The network architecture used in all of our tests.
<table><tr><td>NAME input</td><td>DESCRIPTION 32×32 RGB image</td></tr><tr><td>noise convla conv1b conv1c pool1 drop1 conv2a conv2b conv2c pool2 drop2 conv3a conv3b conv3c pool3 dense output</td><td>Additive Gaussian noise g = 0.15 128 filters,3 × 3,pad = 'same',LReLU(α = 0.1) 128 filters,3 × 3,pad= 'same',LReLU(α = 0.1) 128 filters,3 × 3,pad = 'same',LReLU(α = 0.1) Maxpool 2 × 2 pixels Dropout, p = 0.5 256 filters,3 × 3,pad= 'same',LReLU(α = 0.1) 256 filters,3 × 3,pad = 'same',LReLU(α = 0.1) 256 filters,3 × 3,pad='same',LReLU(α = 0.1) Maxpool 2 × 2 pixels Dropout, p = 0.5 512 filters,3 × 3,pad ='valid,LReLU(α = 0.1) 256 filters,1 × 1,LReLU(α = 0.1) 128 filters,1 × 1,LReLU(α = 0.1) Global average pool (6 × 6 -→ 1×1 pixels) Fully connected 128 →10 Softmax</td></tr></table>
could be an interesting avenue for future work to incorporate a generative component to our solution. We also envision that our methods could be applied to regression-type learning tasks.
# 5 ACKNOWLEDGEMENTS
We thank the anonymous reviewers, Tero Karras, Pekka Janis, Tim Salimans, Ian Goodfellow, as ¨ well as Harri Valpola and his colleagues at Curious AI for valuable suggestions that helped to improve this article.
# REFERENCES
Philip Bachman, Ouais Alsharif, and Doina Precup. Learning with pseudo-ensembles. In Advances in Neural Information Processing Systems 27 (NIPS). 2014.
Leo Breiman. Bagging predictors. Machine Learning, 24(2), 1996.
Sander Dieleman, Jan Schluter, Colin Raffel, Eben Olson, Søren Kaae Sønderby, et al. Lasagne: ¨ First release., 2015.
Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. CoRR, abs/1506.02142, 2016.
Benjamin Graham. Fractional max-pooling. CoRR, abs/1412.6071, 2014.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. CoRR, abs/1502.01852, 2015.
G. E. Hinton, O. Vinyals, and J. Dean. Distilling the knowledge in a neural network. CoRR, abs/1503.02531, 2015.
Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q. Weinberger. Deep networks with stochastic depth. CoRR, abs/1603.09382, 2016.
Gao Huang, Yixuan Li, Geoff Pleiss, Zhuang Liu, John E. Hopcroft, and Kilian Q. Weinberger. Snapshot Ensembles: Train 1, get M for free. In Proc. International Conference on Learning Representations (ICLR), 2017.
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014.
Diederik P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In Advances in Neural Information Processing Systems 27 (NIPS). 2014.
Chen-Yu Lee, Patrick W. Gallagher, and Zhuowen Tu. Generalizing pooling functions in convolutional neural networks: Mixed, gated, and tree. CoRR, abs/1509.08985, 2015.
Lars Maaløe, Casper Kaae Sønderby, Søren Kaae Sønderby, and Ole Winther. Auxiliary deep generative models. CoRR, abs/1602.05473, 2016.
Andrew L Maas, Awni Y Hannun, and Andrew Ng. Rectifier nonlinearities improve neural network acoustic models. In Proc. International Conference on Machine Learning (ICML), volume 30, 2013.
Dmytro Mishkin and Jiri Matas. All you need is a good init. In Proc. International Conference on Learning Representations (ICLR), 2016.
Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, Ken Nakae, and Shin Ishii. Distributional smoothing with virtual adversarial training. In Proc. International Conference on Learning Representations (ICLR), 2016.
Augustus Odena. Semi-supervised learning with generative adversarial networks. Data Efficient Machine Learning workshop at ICML 2016, 2016.
Giorgio Patrini, Alessandro Rozza, Aditya Menon, Richard Nock, and Lizhen Qu. Making neural networks robust to label noise: a loss correction approach. CoRR, abs/1609.03683, 2016.
Antti Rasmus, Mathias Berglund, Mikko Honkala, Harri Valpola, and Tapani Raiko. Semisupervised learning with ladder networks. In Advances in Neural Information Processing Systems 28 (NIPS). 2015.
Scott E. Reed, Honglak Lee, Dragomir Anguelov, Christian Szegedy, Dumitru Erhan, and Andrew Rabinovich. Training deep neural networks on noisy labels with bootstrapping. CoRR, abs/1412.6596, 2014.
Mehdi Sajjadi, Mehran Javanmardi, and Tolga Tasdizen. Mutual exclusivity loss for semi-supervised deep learning. In 2016 IEEE International Conference on Image Processing, ICIP 2016, pp. 1908–1912, 2016a.
Mehdi Sajjadi, Mehran Javanmardi, and Tolga Tasdizen. Regularization with stochastic transformations and perturbations for deep semi-supervised learning. In Advances in Neural Information Processing Systems 29 (NIPS). 2016b.
Tim Salimans and Diederik P. Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. CoRR, abs/1602.07868, 2016.
Tim Salimans, Ian J. Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training GANs. CoRR, abs/1606.03498, 2016.
Patrice Y. Simard, Yann A. LeCun, John S. Denker, and Bernard Victorri. Transformation Invariance in Pattern Recognition — Tangent Distance and Tangent Propagation, pp. 239–274. 1998.
Saurabh Singh, Derek Hoiem, and David A. Forsyth. Swapout: Learning an ensemble of deep architectures. CoRR, abs/1605.06465, 2016.
Jost Tobias Springenberg. Unsupervised and semi-supervised learning with categorical generative adversarial networks. In Proc. International Conference on Learning Representations (ICLR), 2016.
Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin A. Riedmiller. Striving for simplicity: The all convolutional net. CoRR, abs/1412.6806, 2014.
Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15:1929–1958, 2014.
Sainbayar Sukhbaatar, Joan Bruna, Manohar Paluri, Lubomir Bourdev, and Rob Fergus. Training convolutional networks with noisy labels. CoRR, abs/1406.2080, 2014.
Theano Development Team. Theano: A Python framework for fast computation of mathematical expressions. CoRR, abs/1605.02688, May 2016.
A. Torralba, R. Fergus, and W. T. Freeman. 80 million tiny images: A large data set for nonparametric object and scene recognition. IEEE TPAMI, 30(11):1958–1970, 2008.
Li Wan, Matthew Zeiler, Sixin Zhang, Yann L. Cun, and Rob Fergus. Regularization of neural networks using dropconnect. Proc. International Conference on Machine Learning (ICML), 28 (3):1058–1066, 2013.
Max Whitney and Anoop Sarkar. Bootstrapping via graph propagation. In Proceedings of the 50th Annual Meeting of the Association for Computational Linguistics: Long Papers - Volume 1, ACL ’12, 2012.
David Yarowsky. Unsupervised word sense disambiguation rivaling supervised methods. In Proceedings of the 33rd Annual Meeting on Association for Computational Linguistics, ACL ’95, 1995.
Xiaojin Zhu. Semi-supervised learning literature survey. Technical Report 1530, Computer Sciences, University of Wisconsin-Madison, 2005.
Xiaojin Zhu and Zoubin Ghahramani. Learning from labeled and unlabeled data with label propagation. Technical Report CMU-CALD-02-107, Carnegie Mellon University, 2002.
A NETWORK ARCHITECTURE, TEST SETUP, AND TRAINING PARAMETERS
Table 5 details the network architecture used in all of our tests. It is heavily inspired by ConvPoolCNN-C (Springenberg et al., 2014) and the improvements made by Salimans & Kingma (2016). All data layers were initialized following He et al. (2015), and we applied weight normalization and mean-only batch normalization (Salimans & Kingma, 2016) with momentum 0.999 to all of them. We used leaky ReLU (Maas et al., 2013) with $\alpha = 0 . 1$ as the non-linearity, and chose to use max pooling instead of strided convolutions because it gave consistently better results in our experiments.
All networks were trained using Adam (Kingma & Ba, 2014) with a maximum learning rate of $\lambda _ { m a x } = 0 . 0 0 3$ , except for temporal ensembling in the SVHN case where a maximum learning rate of $\lambda _ { m a x } = 0 . 0 0 1$ worked better. Adam momentum parameters were set to $\beta _ { 1 } = 0 . 9$ and $\beta _ { 2 } = 0 . 9 9 9$ as suggested in the paper. The maximum value for the unsupervised loss component was set to $w _ { m a x } \cdot M / N$ , where $M$ is the number of labeled inputs and $N$ is the total number of training inputs. For $\Pi$ -model runs, we used $w _ { m a x } = 1 0 0$ in all runs except for CIFAR-100 with Tiny Images where we set $w _ { m a x } = 3 0 0$ . For temporal ensembling we used $w _ { m a x } = 3 0$ in most runs. For the corrupted label test in Section 3.5 we used $w _ { m a x } = 3 0 0$ for $0 \%$ and $20 \%$ corruption, and $w _ { m a x } = 3 0 0 0$ for corruption of $50 \%$ and higher. For basic CIFAR-100 runs we used $w _ { m a x } = 1 0 0$ , and for CIFAR-100 with Tiny Images we used $w _ { m a x } = 1 0 0 0$ . The accumulation decay constant of temporal ensembling was set to $\alpha = 0 . 6$ in all runs.
In all runs we ramped up both the learning rate $\lambda$ and unsupervised loss component weight $w$ during the first 80 epochs using a Gaussian ramp-up curve $\exp [ - 5 ( 1 - T ) ^ { 2 } ]$ , where $T$ advances linearly from zero to one during the ramp-up period. In addition to ramp-up, we annealed the learning rate $\lambda$ to zero and Adam $\beta _ { 1 }$ to 0.5 during the last 50 epochs, but otherwise we did not decay them during training. The ramp-down curve was similar to the ramp-up curve but time-reversed and with a scaling constant of 12.5 instead of 5. All networks were trained for 300 epochs with minibatch size of 100.
CIFAR-10 Following previous work in fully supervised learning, we pre-processed the images using ZCA and augmented the dataset using horizontal flips and random translations. The translations were drawn from $[ - 2 , 2 ]$ pixels, and were independently applied to both branches in the Π-model.
SVHN We pre-processed the input images by biasing and scaling each input image to zero mean and unit variance. We used only the 73257 items in the official training set, i.e., did not use the provided 531131 extra items. The training setups were otherwise similar to CIFAR-10 except that horizontal flips were not used.
Implementation Our implementation is written in Python using Theano (Theano Development Team, 2016) and Lasagne (Dieleman et al., 2015), and is available at https://github.com/smlaine2/tempens.
Model convergence As discussed in Section 2.1, a slow ramp-up of the unsupervised cost is very important for getting the models to converge. Furthermore, in our very preliminary tests with 250 labels in SVHN we noticed that optimization tended to explode during the ramp-up period, and we eventually found that using a lower value for Adam $\beta _ { 2 }$ parameter (e.g., 0.99 instead of 0.999) seems to help in this regard.
We do not attempt to guarantee that the occurrence of labeled inputs during training would be somehow stratified; with bad luck there might be several consecutive minibatches without any labeled inputs when the label density is very low. Some previous work has identified this as a weakness, and have solved the issue by shuffling the input sequences in such a way that stratification is guaranteed, e.g. Rasmus et al. (2015) (confirmed from the authors). This kind of stratification might further improve the convergence of our methods as well.
Tiny Images, extra data from restricted categories The restricted extra data in Section 3.3 was extracted from Tiny Images by picking all images with labels corresponding to the 100 categories used in CIFAR-100. As the Tiny Images dataset does not contain CIFAR-100 categories aquarium fish and maple tree, we used images with labels fish and maple instead. The result was a total of 237 203 images that were used as unlabeled extra data. Table 6 shows the composition of this extra data set.
It is worth noting that the CIFAR-100 dataset itself is a subset of Tiny Images, and we did not explicitly prevent overlap between this extra set and CIFAR-100. This led to approximately a third of the CIFAR-100 training and test images being present as unlabeled inputs in the extra set. The other test with $5 0 0 \mathrm { k }$ extra entries picked randomly out of all 79 million images had a negligible overlap with CIFAR-100.
Table 6: The Tiny Images (Torralba et al., 2008) labels and image counts used in the CIFAR-100 plus restricted extra data tests (rightmost column of Table 4). Note that the extra input images were supplied as unlabeled data for our networks, and the labels were used only for narrowing down the full set of 79 million images.
<table><tr><td>Label</td><td>#</td><td>Label #</td><td>Label</td><td>#</td><td>Label #</td></tr><tr><td>apple</td><td>2242</td><td>baby 2771</td><td>bear</td><td>2242</td><td>beaver 2116</td></tr><tr><td>bed</td><td>2767</td><td>bee 2193</td><td>beetle</td><td>2173</td><td>bicycle 2599</td></tr><tr><td>bottle</td><td>2212</td><td>bowl 2707</td><td>boy</td><td>2234</td><td>bridge 2274</td></tr><tr><td>bus</td><td>3068</td><td>butterfly 3036</td><td>camel</td><td>2121 can</td><td>2461</td></tr><tr><td>castle</td><td>3094</td><td>caterpillar 2382</td><td>cattle</td><td>2089</td><td>chair 2552</td></tr><tr><td>chimpanzee</td><td>1706</td><td>clock 2375</td><td>cloud</td><td>2390</td><td>cockroach 2318</td></tr><tr><td>couch</td><td>2171</td><td>crab 2735</td><td>crocodile</td><td>2712 cup</td><td>2287</td></tr><tr><td>dinosaur</td><td>2045</td><td>dolphin 2504</td><td>elephant</td><td>2794 fish*</td><td>3082</td></tr><tr><td>flatfish</td><td>1504</td><td>forest 2244</td><td>fox</td><td>2684 girl</td><td>2204</td></tr><tr><td>hamster</td><td>2294</td><td>house 2320</td><td>kangaroo</td><td>2563</td><td>keyboard 1948</td></tr><tr><td>lamp</td><td>2242</td><td>lawn_mower 1929</td><td>leopard</td><td>2139 lion</td><td>3045</td></tr><tr><td>lizard</td><td>2130</td><td>lobster 2136</td><td>man</td><td>2248</td><td>maple* 2149</td></tr><tr><td>motorcycle</td><td>2168</td><td>mountain 2249</td><td>mouse</td><td>2128</td><td>mushroom 2390</td></tr><tr><td>oak_tree</td><td>1995</td><td>orange 2650</td><td>orchid</td><td>1902</td><td>otter 2073</td></tr><tr><td>palm_tree</td><td>2107</td><td>pear 2120</td><td>pickup_truck</td><td>2478</td><td>pine_tree 2341</td></tr><tr><td>plain</td><td>2198</td><td>plate 3109</td><td>poppy</td><td>2730</td><td>porcupine 1900</td></tr><tr><td>possum</td><td>2008</td><td>rabbit 2408</td><td>raccoon</td><td>2587 ray</td><td>2564</td></tr><tr><td>road</td><td>2862</td><td>rocket 2180</td><td>rose</td><td>2237 sea</td><td>2122</td></tr><tr><td>seal</td><td>2159</td><td>shark 2157</td><td>shrew</td><td>1826</td><td>skunk 2450</td></tr><tr><td>skyscraper</td><td>2298</td><td>snail 2369</td><td>snake</td><td>2989</td><td>spider 3024</td></tr><tr><td>squirrel</td><td>2374</td><td>streetcar 1905</td><td>sunflower</td><td>2761</td><td>sweet-pepper 1983</td></tr><tr><td>table</td><td>3137</td><td>tank 1897</td><td>telephone</td><td>1889</td><td>television 2973</td></tr><tr><td>tiger</td><td>2603</td><td>tractor 1848</td><td>train</td><td>3020</td><td>trout 2726</td></tr><tr><td>tulip</td><td>2160</td><td>turtle 2438</td><td>wardrobe</td><td>2029</td><td>whale 2597</td></tr><tr><td>willow_tree</td><td>2040</td><td>wolf 2423</td><td>woman</td><td>2446</td><td>worm 2945</td></tr></table>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494# AUTO-ENCODING SEQUENTIAL MONTE CARLO
Tuan Anh $\mathbf { L e } ^ { \dagger }$ , Maximilian $\mathbf { I g } \mathbf { I } ^ { \dagger }$ , Tom Rainforth‡, Tom $\mathbf { J i n } ^ { \dagger , \ S }$ , Frank Wood† †Department of Engineering Science, University of Oxford ‡Department of Statistics, University of Oxford §Department of Statistics, University of Warwick {tuananh,igl,jin,fwood}@robots.ox.ac.uk,
# ABSTRACT
We build on auto-encoding sequential Monte Carlo (AESMC):1 a method for model and proposal learning based on maximizing the lower bound to the log marginal likelihood in a broad family of structured probabilistic models. Our approach relies on the efficiency of sequential Monte Carlo (SMC) for performing inference in structured probabilistic models and the flexibility of deep neural networks to model complex conditional probability distributions. We develop additional theoretical insights and experiment with a new training procedure which can improve both model and proposal learning. We demonstrate that our approach provides a fast, easy-to-implement and scalable means for simultaneous model learning and proposal adaptation in deep generative models.
# 1 INTRODUCTION
We build upon AESMC (Le et al., 2017), a method for model learning that itself builds on variational auto-encoders (VAEs) (Kingma & Welling, 2014; Rezende et al., 2014) and importance weighted auto-encoders (IWAEs) (Burda et al., 2016). AESMC is similarly based on maximizing a lower bound to the log marginal likelihood, but uses SMC (Doucet & Johansen, 2009) as the underlying marginal likelihood estimator instead of importance sampling (IS). For a very wide array of models, particularly those with sequential structure, SMC forms a substantially more powerful inference method than IS, typically returning lower variance estimates for the marginal likelihood. Consequently, by using SMC for its marginal likelihood estimation, AESMC often leads to improvements in model learning compared with VAEs and IWAEs. We provide experiments on structured time-series data that show that AESMC based learning was able to learn useful representations of the latent space for both reconstruction and prediction more effectively than the IWAE counterpart.
AESMC was introduced in an earlier preprint (Le et al., 2017) concurrently with the closely related methods of Maddison et al. (2017); Naesseth et al. (2017). In this work we take these ideas further by providing new theoretical insights for the resulting evidence lower bounds (ELBOs), extending these to explore the relative efficiency of different approaches to proposal learning, and using our results to develop a new and improved training procedure. In particular, we introduce a method for expressing the gap between an ELBO and the log marginal likelihood as a Kullback-Leibler (KL) divergence between two distributions on an extended sampling space. Doing so allows us to investigate the behavior of this family of algorithms when the objective is maximized perfectly, which occurs only if the KL divergence becomes zero. In the IWAE case, this implies that the proposal distributions are equal to the posterior distributions under the learned model. In the AESMC case, it has implications for both the proposal distributions and the intermediate set of targets that are learned. We demonstrate that, somewhat counter-intuitively, using lower variance estimates for the marginal likelihood can actually be harmful to proposal learning. Using these insights, we experiment with an adaptation to the AESMC algorithm, which we call alternating ELBOs, that uses different lower bounds for updating the model parameters and proposal parameters. We observe that this adaptation can, in some cases, improve model learning and proposal adaptation.
# 2 BACKGROUND
# 2.1 STATE-SPACE MODELS
State-space models (SSMs) are probabilistic models over a set of latent variables $x _ { 1 : T }$ and observed variables $y _ { 1 : T }$ . Given parameters $\theta$ , a $\mathbf { S } \mathbf { S } \mathbf { M }$ is characterized by an initial density $\mu _ { \theta } ( x _ { 1 } )$ , a series of transition densities $f _ { t , \theta } { \big ( } x _ { t } | x _ { 1 : t - 1 } { \big ) }$ , and a series of emission densities $g _ { t , \theta } ( y _ { t } | x _ { 1 : t } )$ with the joint density being $\begin{array} { r } { p _ { \theta } ( x _ { 1 : T } , y _ { 1 : T } ) = \mu _ { \theta } ( x _ { 1 } ) \prod _ { t = 2 } ^ { T } f _ { t , \theta } ( x _ { t } | x _ { 1 : t - 1 } ) \prod _ { t = 1 } ^ { T } g _ { t , \theta } ( y _ { t } | x _ { 1 : t } ) . } \end{array}$ .
We are usually interested in approximating the posterior $p _ { \theta } ( x _ { 1 : T } | y _ { 1 : T } )$ or the expectation of some test function $\varphi$ under this posterior $\begin{array} { r } { I ( \varphi ) : = \bar { \int } \varphi ( \bar { x _ { 1 : T } } ) p _ { \theta } ( \bar { x _ { 1 : T } } | y _ { 1 : T } ) \mathrm { d } x _ { 1 : T } } \end{array}$ . We refer to these two tasks as inference. Inference in models which are non-linear, non-discrete, and non-Gaussian is difficult and one must resort to approximate methods, for which SMC has been shown to be one of the most powerful approaches (Doucet & Johansen, 2009).
We will consider model learning as a problem of maximizing the marginal likelihood $p _ { \theta } ( y _ { 1 : T } ) =$ $\begin{array} { r } { \int p _ { \theta } \big ( x _ { 1 : T } , y _ { 1 : T } \big ) \mathrm { d } x _ { 1 : T } } \end{array}$ in the family of models parameterized by $\theta$ .
# 2.2 SEQUENTIAL MONTE CARLO
SMC performs approximate inference on a sequence of target distributions $( \pi _ { t } ( x _ { 1 : t } ) ) _ { t = 1 } ^ { T }$ . In the context of SSMs, the target distributions are often taken to be $( p _ { \theta } ( \underline { { x } } _ { 1 : t } | y _ { 1 : t } ) ) _ { t = 1 } ^ { T }$ . Given a parameter $\phi$ and proposal distributions $q _ { 1 , \phi } ( x _ { 1 } | y _ { 1 } )$ and $( q _ { t , \phi } ( x _ { t } | y _ { 1 : t } , x _ { 1 : t - 1 } ) ) _ { t = 2 } ^ { T }$ from which we can sample and whose densities we can evaluate, SMC is described in Algorithm 1.
Using the set of weighted particles $( \tilde { x } _ { 1 : T } ^ { k } , w _ { T } ^ { k } ) _ { k = 1 } ^ { K }$ at the last time step, we can approximate the posterior as $\begin{array} { r } { \sum _ { k = 1 } ^ { K } \bar { w } _ { T } ^ { k } \delta _ { \tilde { x } _ { 1 : T } ^ { k } } ( x _ { 1 : T } ) } \end{array}$ and the integral $I _ { \varphi }$ as $\begin{array} { r } { \sum _ { k = 1 } ^ { K } \hat { w } _ { T } ^ { k } \varphi ( \tilde { x } _ { 1 : T } ^ { k } ) } \end{array}$ , where $\begin{array} { r } { \bar { w } _ { T } ^ { k } : = w _ { T } ^ { k } / \sum _ { j } w _ { T } ^ { j } } \end{array}$ is the normalized weight and $\delta _ { z }$ is a Dirac measure centered on $z$ . Furthermore, one can obtain an unbiased estimator of the marginal likelihood $p _ { \theta } ( y _ { 1 : T } )$ using the intermediate particle weights:
$$\hat { Z } _ { \mathrm { S M C } } : = \prod _ { t = 1 } ^ { T } \left[ \frac { 1 } { K } \sum _ { k = 1 } ^ { K } w _ { t } ^ { k } \right] .$$
# Algorithm 1: Sequential Monte Carlo
Data: observed values $y _ { 1 : T }$ , model parameters $\theta$ , proposal parameters $\phi$ begin
Sample initial particle values $x _ { 1 } ^ { k } \sim q _ { 1 , \phi } ( \cdot | y _ { 1 } )$
Compute and normalize weights:
$$w _ { 1 } ^ { k } = \frac { \mu _ { \theta } ( x _ { 1 } ^ { k } ) g _ { 1 , \theta } ( y _ { 1 } | x _ { 1 } ^ { k } ) } { q _ { 1 , \phi } ( x _ { 1 } ^ { k } | y _ { 1 } ) } , \qquad \quad \bar { w } _ { 1 } ^ { k } = \frac { w _ { 1 } ^ { k } } { \sum _ { \ell = 1 } ^ { K } w _ { 1 } ^ { \ell } } .$$
Initialize particle set: $\tilde { x } _ { 1 } ^ { k } \gets x _ { 1 } ^ { k }$ for $t = 2 , 3 , \dots , T$ do
Sample ancestor index $a _ { t - 1 } ^ { k } \sim \mathrm { D i s c r e t e } ( \cdot | \bar { w } _ { t - 1 } ^ { 1 } , \dots , \bar { w } _ { t - 1 } ^ { K } )$
$x _ { t } ^ { k } \sim q _ { t , \phi } ( \cdot | y _ { 1 : t } , \tilde { x } _ { 1 : t - 1 } ^ { a _ { t - 1 } ^ { k } } )$
$\tilde { x } _ { 1 : t } ^ { k } \gets ( \tilde { x } _ { 1 : t - 1 } ^ { a _ { t - 1 } ^ { k } } , x _ { t } ^ { k } )$
Compute and normalize weights:
$$w _ { t } ^ { k } = \frac { f _ { t , \theta } ( x _ { t } ^ { k } | \tilde { x } _ { 1 : t - 1 } ^ { a _ { t - 1 } ^ { k } } ) g _ { t , \theta } ( y _ { t } | \tilde { x } _ { 1 : t } ^ { k } ) } { q _ { t , \phi } ( x _ { t } ^ { k } | y _ { 1 : t } , \tilde { x } _ { 1 : t - 1 } ^ { a _ { t - 1 } ^ { k } } ) } ,$$
$$\bar { w } _ { t } ^ { k } = \frac { w _ { t } ^ { k } } { \sum _ { \ell = 1 } ^ { K } w _ { t } ^ { \ell } } .$$
Compute marginal likelihood: $\begin{array} { r } { \hat { Z } _ { \mathrm { S M C } } = \prod _ { t = 1 } ^ { T } \frac { 1 } { K } \sum _ { k = 1 } ^ { K } w _ { t } ^ { k } } \end{array}$ return particles $( \tilde { x } _ { 1 : T } ^ { k } ) _ { k = 1 } ^ { K }$ , weights $( w _ { T } ^ { k } ) _ { k = 1 } ^ { K }$ , marginal likelihood estimate $\hat { Z } _ { S M C }$
The sequential nature of SMC and the resampling step are crucial in making SMC scalable to large $T$ . The former makes it easier to design efficient proposal distributions as each step need only target the next set of variables $x _ { t }$ . The resampling step allows the algorithm to focus on promising particles in light of new observations, avoiding the exponential divergence between the weights of different samples that occurs for importance sampling as $T$ increases. This can be demonstrated both empirically and theoretically (Del Moral, 2004, Chapter 9). We refer the reader to (Doucet & Johansen, 2009) for an in-depth treatment of SMC.
# 2.3 IMPORTANCE WEIGHTED AUTO-ENCODERS
Given a dataset of observations $( y ^ { ( n ) } ) _ { n = 1 } ^ { N }$ , a generative network $p _ { \theta } ( x , y )$ and an inference network $q _ { \phi } ( x | y )$ , IWAEs (Burda et al., 2016) maximize $\begin{array} { r } { \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \operatorname { E L B O } _ { \mathrm { I S } } ( \theta , \phi , y ^ { ( n ) } ) } \end{array}$ where, for a given observation $y$ , the ELBOIS (with $K$ particles) is a lower bound on $\log p _ { \theta } ( y )$ by Jensen’s inequality:
$$\begin{array} { r l } & { \displaystyle \mathrm { E L B O } _ { \mathrm { I S } } ( \theta , \phi , y ) = \int Q _ { \mathrm { I S } } ( x ^ { 1 : K } ) \log \hat { Z } _ { \mathrm { I S } } ( x ^ { 1 : K } ) \mathrm { d } x ^ { 1 : K } \leq \log p _ { \theta } ( y ) \mathrm { , ~ w h e r e ~ } } \\ & { \displaystyle Q _ { \mathrm { I S } } ( x ^ { 1 : K } ) = \prod _ { k = 1 } ^ { K } q _ { \phi } ( x ^ { k } | y ) , \hat { Z } _ { \mathrm { I S } } ( x ^ { 1 : K } ) = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \frac { p _ { \theta } ( x ^ { k } , y ) } { q _ { \phi } ( x ^ { k } | y ) } . } \end{array}$$
Note that for $K = 1$ particle, this objective reduces to a VAE (Kingma & Welling, 2014; Rezende et al., 2014) objective we will refer to as
$$\operatorname { E L B O v a g } ( \theta , \phi , y ) = \int q _ { \phi } ( x | y ) ( \log p _ { \theta } ( x , y ) - \log q _ { \phi } ( x | y ) ) \mathrm { d } x .$$
The IWAE optimization is performed using stochastic gradient ascent (SGA) where a sample from $\scriptstyle \left( \prod _ { k = 1 } ^ { K } q _ { \phi } ( x ^ { k } | y ^ { ( n ) } ) \right)$ is obtained using the reparameterization trick (Kingma & Welling, 2014) and the gradient $\begin{array} { r } { \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \nabla _ { \theta , \phi } \log \left( \sum _ { k = 1 } ^ { K } \frac { p _ { \theta } ( x ^ { k } , y ^ { ( n ) } ) } { q _ { \phi } ( x ^ { k } | y ^ { ( n ) } ) } \right) } \end{array}$ is used to perform an optimization step.
# 3 AUTO-ENCODING SEQUENTIAL MONTE CARLO
AESMC implements model learning, proposal adaptation, and inference amortization in a similar manner to the VAE and the IWAE: it uses SGA on an empirical average of the ELBO over observations. However, it varies in the form of this ELBO. In this section, we will introduce the AESMC ELBO, explain how gradients of it can be estimated, and discuss the implications of these changes.
# 3.1 OBJECTIVE FUNCTION
Consider a family of SSMs $\{ p _ { \theta } ( x _ { 1 : T } , y _ { 1 : T } ) ~ : ~ \theta ~ \in ~ \Theta \}$ and a family of proposal distributions $\begin{array} { r } { \{ q _ { \phi } ( x _ { 1 : T } | y _ { 1 : T } ) = q _ { 1 , \phi } ( x _ { 1 } | y _ { 1 } ) \prod _ { t = 2 } ^ { T } q _ { t , \phi } ( x _ { t } | x _ { 1 : t - 1 } , y _ { 1 : t } ) : \phi \in \Phi \} } \end{array}$ . AESMC uses an ELBO objective based on the SMC marginal likelihood estimator (1). In particular, for a given $y _ { 1 : T }$ , the objective is defined as
$$\mathrm { E L B O } _ { \mathrm { S M C } } ( \theta , \phi , y _ { 1 : T } ) : = \int Q _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) \log \hat { Z } _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) \mathrm { d } x _ { 1 : T } ^ { 1 : K } \mathrm { d } a _ { 1 : T - 1 } ^ { 1 : K } ,$$
where $\hat { Z } _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } )$ is defined in (1) and $Q _ { \mathrm { S M C } }$ is the sampling distribution of SMC,
$$Q _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) = \left( \prod _ { k = 1 } ^ { K } q _ { 1 , \phi } ( x _ { 1 } ^ { k } ) \right) \left( \prod _ { t = 2 } ^ { T } \prod _ { k = 1 } ^ { K } q _ { t , \phi } ( x _ { t } ^ { k } | \tilde { x } _ { 1 : t - 1 } ^ { a _ { t - 1 } ^ { k } } ) \cdot \operatorname { D i s c r e t e } ( a _ { t - 1 } ^ { k } | w _ { t - 1 } ^ { 1 : K } ) \right) .$$
and the unbiasedness of the marginal likelihood estimator. Hence, given a dataset $\mathbf { E L B O } _ { \mathbf { S M C } }$ forms a lower bound to the log marginal likelihood $\log p _ { \theta } ( y _ { 1 : T } )$ due to Jensen’s inequality $( y _ { 1 : T } ^ { ( n ) } ) _ { n = 1 } ^ { N }$ , we can perform model learning based on maximizing the lower bound of $\begin{array} { r } { \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \log p _ { \theta } ( y _ { 1 : T } ^ { ( n ) } ) } \end{array}$ as a
$$\mathcal { I } ( \theta , \phi ) : = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \mathrm { E L B O } _ { \mathrm { S M C } } \big ( \theta , \phi , y _ { 1 : T } ^ { ( n ) } \big ) .$$
For notational convenience, we will talk about optimizing ELBOs in the rest of this section. However, we note that the main intended use of AESMC is to amortize over datasets, for which the ELBO is replaced by the dataset average ${ \mathcal { I } } ( \theta , \phi )$ in the optimization target. Nonetheless, rather than using the full dataset for each gradient update, will we instead use minibatches, noting that this forms unbiased estimator.
# 3.2 GRADIENT ESTIMATION
We describe a gradient estimator used for optimizing $\mathbf { \Theta } _ { \mathrm { E L B O } _ { \mathrm { S M C } } } ( \theta , \phi , y _ { 1 : T } )$ using SGA. The SMC sampler in Algorithm 1 proceeds by sampling $x _ { 1 } ^ { 1 : K } , \bar { a _ { 1 } ^ { 1 : K } } , x _ { 2 } ^ { 1 : K } ,$ : K , a 1: K1 , . . . sequentially from their respective distributions $\textstyle \prod _ { k = 1 } ^ { K } q _ { 1 } ( x _ { 1 } ^ { k } )$ , $\textstyle \prod _ { k = 1 } ^ { K }$ Discrete $( a _ { 1 } ^ { k } | w _ { 1 } ^ { 1 : K } )$ , $\begin{array} { r } { \prod _ { k = 1 } ^ { K } q _ { 2 } ( x _ { 2 } ^ { k } | x _ { 1 } ^ { a _ { 1 } ^ { k } } ) , . . . } \end{array}$ until the whole k=1 particle-weight trajectory $( x _ { 1 : K } ^ { 1 : T } , a _ { 1 : T - 1 } ^ { 1 : K } )$ 1 | 1 k=1 2 | 1 is sampled. From this trajectory, using equation (1), we can
Assuming that the sampling of latent variables $x _ { 1 : T } ^ { 1 : K }$ is reparameterizable, we can make their sampling independent of $( \theta , \phi )$ . In particular, assume that there exists a set of auxiliary random variables 1:T t ∼by first sampling $\epsilon _ { 1 : T } ^ { 1 : K }$ where $\epsilon _ { t } ^ { k } \sim s _ { t }$ $\begin{array} { r } { \epsilon _ { 1 } ^ { 1 : K } \sim \prod _ { k = 1 } ^ { K } s _ { 1 } } \end{array}$ and a set of reparameterization functions and setting K $x _ { 1 } ^ { k } = r _ { 1 } ( \epsilon _ { 1 } ^ { k } )$ and . We can simulate the SMC sampler $\tilde { x } _ { 1 } ^ { k } = x _ { 1 } ^ { k }$ , then for K $t = 2 , \dots , T$ cycling through sampling $\begin{array} { r } { a _ { t - 1 } ^ { 1 : K } \sim \prod _ { k = 1 } ^ { K } } \end{array}$ Q k=1 Discrete $\left( a _ { t - 1 } ^ { k } | w _ { t - 1 } ^ { 1 : K } \right)$ and $\begin{array} { r } { \epsilon _ { t } ^ { 1 : K } \sim \prod _ { k = 1 } ^ { K } s _ { t } } \end{array}$ , and setting $x _ { t } ^ { k } = r _ { t } ( \epsilon _ { t } ^ { k } , \tilde { x } _ { 1 : t - 1 } ^ { a _ { t - 1 } ^ { k } } )$ and $\tilde { x } _ { 1 : t } ^ { k } \ = \ ( \tilde { x } _ { 1 : t - 1 } ^ { a _ { t - 1 } ^ { k } } , x _ { t } ^ { k } )$ . We use the resulting reparameterized sample of $( x _ { 1 : K } ^ { 1 : T } , a _ { 1 : T - 1 } ^ { 1 : K } )$ 1:t−1 1: 1:t−1 to evaluate the gradient estimator $\nabla _ { \theta , \phi } \log \hat { Z } _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } )$ .
To account for the discrete choices of ancestor indices $a _ { t } ^ { k }$ one could additionally use the REINFORCE (Williams, 1992) trick, however in practice, we found that the additional term in the estimator has problematically high variance. We explore various other possible gradient estimators and empirical assessments of their variances in Appendix A. This exploration confirms that including the additional REINFORCE terms leads to problematically high variance, justifying our decision to omit them, despite introducing a small bias into the gradient estimates.
# 3.3 BIAS & IMPLICATIONS ON THE PROPOSALS
In this section, we express the gap between ELBOs and the log marginal likelihood as a KL divergence and study implications on the proposal distributions. We present a set of claims and propositions whose full proofs are in Appendix B. These give insight into the behavior of AESMC and show the advantages, and disadvantages, of using our different ELBO. This insight motivates Section 4 which proposes an algorithm for improving proposal learning.
Definition 1. Given an unnormalized target density ${ \tilde { P } } : { \mathcal { X } } \to [ 0 , \infty )$ with normalizing constant $Z _ { P } > 0$ , $P : = { \tilde { P } } / { Z _ { P } }$ , and $a$ proposal density $Q : \mathcal { X } [ 0 , \infty )$ , then
$$\mathtt { E L B O } : = \int Q ( x ) \log \frac { \tilde { P } ( x ) } { Q ( x ) } \mathrm { d } x ,$$
is a lower bound on $\log Z _ { P }$ and satisfies
$$\begin{array} { r } { { \bf E L B O } = \log Z _ { P } - { \bf K L } \left( { Q } \vert \vert { P } \right) . } \end{array}$$
This is a standard identity used in variational inference and VAEs. In the case of VAEs, applying Definition 1 with $P$ being $p _ { \theta } ( x | y )$ , $\tilde { P }$ being $p _ { \theta } ( x , y )$ , $Z _ { P }$ being $p _ { \theta } ( y )$ , and $Q$ being $q _ { \phi } ( x | y )$ , we can directly rewrite (4) as $\begin{array} { r } { \mathrm { E L B O } _ { \mathrm { V A E } } ( \theta , \phi , y ) = \log p _ { \theta } ( y ) - \mathrm { K L } \left( q _ { \phi } ( x | y ) | | p _ { \theta } ( x | y ) \right) } \end{array}$ .
The key observation for expressing such a bound for general ELBOs such as $_ { \mathrm { E L B O _ { I S } } }$ and ELBOSMC is that the target density $P$ and the proposal density $Q$ need not directly correspond to $p _ { \theta } ( x | y )$ and $q _ { \phi } ( x | y )$ . This allows us to view the underlying sampling distributions of the marginal likelihood Monte Carlo estimators such as $Q _ { \mathrm { I S } }$ in (3) and $Q _ { \mathrm { S M C } }$ in (6) as proposal distributions on an extended space $\mathcal { X }$ . The following claim uses this observation to express the bound between a general ELBO and the log marginal likelihood as KL divergence from the extended space sampling distribution to a corresponding target distribution.
Claim 1. Given a non-negative unbiased estimator $\hat { Z } _ { P } ( x ) \geq 0$ of the normalizing constant $Z _ { P }$ where x is distributed according to the proposal distribution $Q ( x )$ , the following holds:
$$\begin{array} { r l } & { \displaystyle \mathrm { E L B O } = \int Q ( { \boldsymbol x } ) \log \hat { Z } _ { P } ( { \boldsymbol x } ) \mathrm { d } { \boldsymbol x } = \log Z _ { P } - \mathrm { K L } \left( Q | | P \right) , } \\ { { \boldsymbol w h e r e } } & { P ( { \boldsymbol x } ) = \displaystyle \frac { Q ( { \boldsymbol x } ) \hat { Z } _ { P } ( { \boldsymbol x } ) } { Z _ { P } } } \end{array}$$
is the implied normalized target density.
In the case of IWAEs, we can apply Claim 1 with $Q$ and $\hat { Z } _ { P }$ being $Q _ { \mathrm { I S } }$ and $\hat { Z } _ { \mathrm { I S } }$ respectively as defined in (3) and $Z _ { P }$ being $p _ { \theta } ( y )$ . This yields
$$\begin{array} { r } { \begin{array} { r l } & { \mathrm { E L B O } _ { \mathrm { I S } } ( \theta , \phi , y ) = \log p _ { \theta } ( y ) - \mathrm { K L } \left( Q _ { \mathrm { I S } } | | P _ { \mathrm { I S } } \right) , \mathrm { ~ w h e r e } } \\ & { \qquad P _ { \mathrm { I S } } ( x ^ { 1 : K } ) = \displaystyle \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \left( q _ { \phi } ( x ^ { 1 } | y ) \cdots q _ { \phi } ( x ^ { k - 1 } | y ) p _ { \theta } ( x ^ { k } | y ) q _ { \phi } ( x ^ { k + 1 } | y ) \cdots q _ { \phi } ( x ^ { K } | y ) \right) . } \end{array} } \end{array}$$
Similarly, in the case of AESMC, we obtain
$$\begin{array} { r l } & { \mathrm { E L B O } _ { \mathrm { S M C } } ( \theta , \phi , y _ { 1 : T } ) = \log p _ { \theta } ( y _ { 1 : T } ) - \mathrm { K L } \left( Q _ { \mathrm { S M C } } | | P _ { \mathrm { S M C } } \right) , \mathrm { ~ w h e r e } } \\ & { P _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) = Q _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) \hat { Z } _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) / p _ { \theta } ( y _ { 1 : T } ) . } \end{array}$$
Having expressions for the target distribution $P$ and the sampling distribution $Q$ for a given ELBO allows us to investigate what happens when we maximize that ELBO, remembering that the KL term is strictly non-negative and zero if and only if $P = Q$ . For the VAE and IWAE cases then, provided the proposal is sufficiently flexible, one can always perfectly maximize the ELBO by setting $\bar { p } _ { \theta } ( x | y ) = \bar { q _ { \phi } } ( \bar { x | y } )$ for all $x$ . The reverse implication also holds: if $\mathtt { E L B O } _ { \mathrm { V A E } } = \log Z _ { P }$ then it must be the case that $p _ { \theta } ( x | y ) = q _ { \phi } ( x | y )$ . However, for AESMC, achieving $\mathtt { E L B O } = \log Z _ { P }$ is only possible when one also has sufficient flexibility to learn a particular series of intermediate target distributions, namely the marginals of the final target distribution. In other words, it is necessary to learn a particular factorization of the generative model, not just the correct individual proposals, to achieve $P = Q$ and thus $\mathtt { E L B O } _ { \mathtt { S M C } } = Z _ { P }$ . These observations are formalized in Propositions 1 and 2 below.
Proposition 1. $Q _ { I S } ( x ^ { 1 : K } ) = P _ { I S } ( x ^ { 1 : K } )$ for all $x ^ { 1 : K }$ if and only if $q ( x | y ) = p ( x | y )$ for all $x$
Proposition 2. If $K > 1$ , then $P _ { S M C } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) = Q _ { S M C } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } )$ for all $( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) i f$ and only if
$\begin{array} { r } { l . ~ \pi _ { t } ( x _ { 1 : t } ) = \int p ( x _ { 1 : T } | y _ { 1 : T } ) \mathrm { d } x _ { t + 1 : T } = p ( x _ { 1 : t } | y _ { 1 : T } ) , } \end{array}$ for all $x _ { 1 : t }$ and $t = 1 , \dots , T$ , and 2. $q _ { 1 } ( x _ { 1 } | y _ { 1 } ) = p ( x _ { 1 } | y _ { 1 : T } )$ for all $x _ { 1 }$ and $q _ { t } ( x _ { t } | x _ { 1 : t - 1 } , y _ { 1 : t } ) = p ( x _ { 1 : t } | y _ { 1 : T } ) / p ( x _ { 1 : t - 1 } | y _ { 1 : T } )$ for $t = 2 , \ldots , T$ for all $x _ { 1 : t }$ ,
where $\pi _ { t } ( x _ { 1 : t } )$ are the intermediate targets used by SMC.
Proposition 2 has the consequence that if the family of generative models is such that the first condition does not hold, we will not be able to make the bound tight. This means that, except for a very small class of models, then, for most convenient parameterizations, it will be impossible to learn a perfect proposal that gives a tight bound, i.e. there will be no $\theta$ and $\phi$ such that the above conditions can be satisfied. However, it also means that ELBOSMC encodes important additional information about the implications the factorization of the generative model has on the inference—the model depends only on the final target $\pi _ { T } ( x _ { 1 : T } ) = p _ { \theta } ( x _ { 1 : T } | y _ { 1 : T } )$ , but some choices of the intermediate targets $\pi _ { t } ( x _ { 1 : t } )$ will lead to much more efficient inference than others. Perhaps more importantly, SMC is usually a far more powerful inference algorithm than importance sampling and so the AESMC setup allows for more ambitious model learning problems to be effectively tackled than the VAE or IWAE. After all, even though it is well known in the SMC literature that, unlike for IS, most problems have no perfect set of SMC proposals which will generate exact samples from the posterior (Doucet & Johansen, 2009), SMC still gives superior performance on most problems with more than a few dimensions. These intuitions are backed up by our experiments that show that using ELBOSMC regularly learns better models than using ELBOIS.
# 4 IMPROVING PROPOSAL LEARNING
In practice, one is rarely able to perfectly drive the divergence to zero and achieve a perfect proposal. In addition to the implications of the previous section, this occurs because $q _ { \phi } ( x _ { 1 : T } | y _ { 1 : T } )$ may not be sufficiently expressive to represent $p _ { \theta } ( x _ { 1 : T } | y _ { 1 : T } )$ exactly and because of the inevitable sub-optimality of the optimization process, remembering that we are aiming to learn an amortized inference artifact, rather than a single posterior representation. Consequently, to accurately assess the merits of different ELBOs for proposal learning, it is necessary to consider their finite-time performance. We therefore now consider the effect the number of particles $K$ has on the gradient estimators for ELBOIS and ELBOSMC.
Counter-intuitively, it transpires that the tighter bounds implied by using a larger $K$ is often harmful to proposal learning for both IWAE and AESMC. At a high-level, this is because an accurate estimate for $\hat { Z } _ { P }$ can be achieved for a wide range of proposal parameters $\phi$ and so the magnitude of $\nabla _ { \phi }$ ELBO reduces as $K$ increases. Typically, this shrinkage happens faster than increasing $K$ reduces the standard deviation of the estimate and so the standard deviation of the gradient estimate relative to the problem scaling (i.e. as a ratio of true gradient $\nabla _ { \phi }$ ELBO) actually increases. This effect is demonstrated in Figure 1 which shows a kernel density estimator for the distribution of the gradient estimate for different $K$ and the model given in Section 5.2. Here we see that as we increase $K$ , both the expected gradient estimate (which is equal to the true gradient by unbiasedness) and standard deviation of the estimate decrease. However, the former decreases faster and so the relative standard deviation increases. This is perhaps easiest to appreciate by noting that for $K > 1 0$ , there is a roughly equal probability of the estimate being positive or negative, such that we are equally likely to increase or decrease the parameter value at the next SGA iteration, inevitably leading to poor performance. On the other hand, when $K = 1$ , it is far more likely that the gradient estimate is positive than negative, and so there is clear drift to the gradient steps. We add to the empirical evidence for this behavior in Section 5. Note the critical difference for model learning is that $\nabla _ { \theta }$ ELBO does not, in general, decrease in magnitude as $K$ increases. Note also that using a larger $K$ should always give better performance at test time; it may though be better to learn $\phi$ using a smaller $K$ .
 Figure 1: Density estimate of $\nabla _ { \phi }$ ELBO for different $K$
In simultaneously developed work (Rainforth et al., 2017), we formalized this intuition in the IWAE setting by showing that the estimator of $\nabla _ { \phi } \operatorname { E L B O } _ { \mathrm { I S } } ( \theta , \phi , x )$ with $K$ particles, denoted by $I _ { K }$ , has the following signal-to-noise ratio (SNR):
$$\mathrm { { s N R } } : = { \frac { \mathbb { E } [ I _ { K } ] } { \sqrt { \operatorname { V a r } [ I _ { K } ] } } } = O \left( { \sqrt { \frac { 1 } { K } } } \right) .$$
We thus see that increasing $K$ reduces the SNR and so the gradient updates for the proposal will degrade towards pure noise if $K$ is set too high.
# 4.1 ALTERNATING ELBOS
To address these issues, we suggest and investigate the alternating ELBOs (ALT) algorithm which updates $( \theta , \phi )$ in a coordinate descent fashion using different ELBOs, and thus gradient estimates, for each. We pick a $\theta$ -optimizing pair and a $\phi$ -optimizing pair $( A _ { \theta } , K _ { \theta } ) , ( A _ { \phi } , K _ { \phi } ) \in \{ \mathrm { I S } , \mathrm { S M C } \} \times$ $\{ 1 , 2 , \dots \}$ , corresponding to an inference type and number of particles. In an optimization step, we obtain an estimator for $\nabla _ { \theta } \operatorname { E L B O } _ { A _ { \theta } }$ with $K _ { \theta }$ particles and an estimator for $\nabla _ { \phi } \operatorname { E L B O } _ { A _ { \phi } }$ with $K _ { \phi }$ particles which we call $g _ { \boldsymbol { \theta } }$ and $g _ { \phi }$ respectively. We use $g _ { \theta }$ to update the current $\theta$ and $g _ { \phi }$ to update the current $\phi$ . The results from the previous sections suggest that using $A _ { \theta } = \mathsf { s M C }$ and $A _ { \phi } = \mathrm { I S }$ with a large $K _ { \theta }$ and a small $K _ { \phi }$ may perform better model and proposal learning than just fixing $( A _ { \theta } , K _ { \theta } ) = ( A _ { \phi } , K _ { \phi } )$ to (SMC, large) since using $A _ { \phi } = \mathrm { I S }$ with small $K _ { \phi }$ helps learning $\phi$ (at least in terms of the SNR) and using $A _ { \theta } = \mathsf { s M C }$ with large $K _ { \theta }$ helps learning $\theta$ . We experimentally observe that this procedure can in some cases improve both model and proposal learning.
# 5 EXPERIMENTS
We now present a series of experiments designed to answer the following questions: 1) Does tightening the bound by using either more particles or a better inference procedure lead to an adverse effect on proposal learning? 2) Can AESMC, despite this effect, outperform IWAE? 3) Can we further improve the learned model and proposal by using ALT?
First we investigate a linear Gaussian state space model (LGSSM) for model learning and a latent variable model for proposal adaptation. This allows us to compare the learned parameters to the optimal ones. Doing so, we confirm our conclusions for this simple problem.
We then extend those results to more complex, high dimensional observation spaces that require models and proposals parameterized by neural networks. We do so by investigating the Moving Agents dataset, a set of partially occluded video sequences.
# 5.1 LINEAR GAUSSIAN STATE SPACE MODEL
Given the following LGSSM
$$\begin{array} { r l } & { p ( x _ { 1 } ) = \mathrm { N o r m a l } \left( x _ { 1 } ; 0 , 1 ^ { 2 } \right) , } \\ & { p ( x _ { t } | x _ { t - 1 } ) = \mathrm { N o r m a l } \left( x _ { t } ; \theta _ { 1 } x _ { t - 1 } , 1 ^ { 2 } \right) , } \\ & { ~ p ( y _ { t } | x _ { t } ) = \mathrm { N o r m a l } \left( y _ { t } ; \theta _ { 2 } x _ { t } , \sqrt { 0 . 1 } ^ { 2 } \right) , ~ t = 1 , \dots , T , } \end{array}$$
we find that optimizing $\mathrm { E L B O } _ { \mathrm { S M C } } ( \theta , \phi , y _ { 1 : T } )$ w.r.t. $\theta$ leads to better generative models than optimizing $\mathrm { E L B O _ { I S } } ( \theta , \phi , y _ { 1 : T } )$ . The same is true for using more particles.
We generate a sequence $y _ { 1 : T }$ for $T = 2 0 0$ by sampling from the model with $\theta = ( \theta _ { 1 } , \theta _ { 2 } ) = ( 0 . 9 , 1 . 0 )$ . We then optimize the different ELBOs w.r.t. $\theta$ using the bootstrap proposal $q _ { 1 } ( x _ { 1 } | y _ { 1 } ) = \mu _ { \theta } ( x _ { 1 } )$ and $q _ { t } ( x _ { t } | x _ { 1 : t - 1 } , y _ { 1 : t } ) = f _ { t , \theta } ( x _ { t } | x _ { 1 : t - 1 } )$ . Because we use the bootstrap proposal, gradients w.r.t. to $\theta$ are not backpropagated through $q$ .
We use a fixed learning rate of 0.01 and optimize for 500 steps using SGA. Figure 2 shows that the convergence of both $\log p _ { \theta } ( y _ { 1 : T } )$ to $\operatorname* { m a x } _ { \theta } \log p _ { \theta } ( y _ { 1 : T } )$ and $\theta$ to argmax $\cdot \theta$ $\log p _ { \theta } ( y _ { 1 : T } )$ is faster when $\mathbf { E L B O } _ { \mathbf { S M C } }$ and more particles are used.
 Figure 2: (Left) Log marginal likelihood analytically evaluated at every $\theta$ during optimization; the black line indicates $\operatorname { m a x } _ { \theta }$ $\arg p _ { \theta } ( y _ { 1 : T } )$ obtained by the expectation maximization (EM) algorithm. (Right) learning of model parameters; the black line indicates argmax $\scriptstyle { \dot { \theta } }$ $\log p _ { \theta } ( y _ { 1 : T } )$ obtained by the EM algorithm.
# 5.2 PROPOSAL LEARNING
We now investigate how learning $\phi$ , i.e. the proposal, is affected by the the choice of ELBO and the number of particles.
Consider a simple, fixed generative model $p ( \mu ) p ( x | \mu ) = \mathrm { N o r m a l } ( \mu ; 0 , 1 ^ { 2 } ) \mathrm { N o r m a l } ( x ; \mu , 1 ^ { 2 } )$ where $\mu$ and $x$ are the latent and observed variables respectively and a family of proposal distributions $q _ { \phi } ( \mu ) = \mathrm { N o r m a l } ( \mu ; \mu _ { q } , \sigma _ { q } ^ { 2 } )$ parameterized by $\phi \overset { \cdot } { = } ( \mu _ { q } , \operatorname { l o g } \sigma _ { q } ^ { 2 } )$ . For a fixed observation $x = 2 . 3$ , we initialize $\phi = ( 0 . 0 1 , 0 . 0 1 )$ and optimize $_ { \mathrm { E L B O _ { I S } } }$ with respect to $\phi$ . We investigate the quality of the learned parameter $\phi$ as we increase the number of particles $K$ during training. Figure 3 (left) clearly demonstrates that the quality of $\phi$ compared to the analytic posterior decreases as we increase $K$ .
Similar behavior is observed in Figure 3 (middle, right) where we optimize $\mathrm { E L B O } _ { \mathrm { S M C } }$ with respect to both $\theta$ and $\phi$ for the LGSSM described in Section 5.1. We see that using more particles helps model learning but makes proposal learning worse. Using our ALT algorithm alleviates this problem and at the same time makes model learning faster as it profits from a more accurate proposal distribution. We provide more extensive experiments exploring proposal learning with different ELBOs and number of particles in Appendix C.3.
 Figure 3: (Left) Optimizing $_ { \mathrm { E L B O _ { I S } } }$ for the Gaussian unknown mean model with respect to $\phi$ results in worse $\phi$ as we increase number of particles $K$ . (Middle, right) Optimizing ELBOSMC with respect to $( \theta , \phi )$ for LGSSM and using the ALT algorithm for updating $( \theta , \phi )$ with $( A _ { \theta } , K _ { \theta } ) = ( \mathrm { s M C } , 1 0 0 0 )$ and $( A _ { \phi } , K _ { \phi } ) = ( \mathrm { { I S } , 1 0 ) }$ . Right measures the quality of $\phi$ by showing $\sqrt { \sum _ { t = 1 } ^ { T } ( \mu _ { t } ^ { \mathrm { k a l m a n } } - \mu _ { t } ^ { \mathrm { a p p r o x } } ) ^ { 2 } }$ where $\mu _ { t } ^ { \mathrm { k a l m a n } }$ is the marginal mean obtained from the Kalman smoothing algorithm under the model twith EM-optimized parameters and $\mu _ { t } ^ { \mathrm { a p p r o x } }$ is an marginal mean obtained from the set of $1 0 \ \mathrm { { s u c } }$ particles with learned/bootstrap proposal.
# 5.3 MOVING AGENTS
To show that our results are applicable to complex, high dimensional data we compare AESMC and IWAE on stochastic, partially observable video sequences. Figure 7 in Appendix C.2 shows an example of such a sequence.
The dataset consists of $N = 5 0 0 0$ sequences of images $( y _ { 1 : T } ^ { ( n ) } ) _ { n = 1 } ^ { N }$ of which 1000 are randomly held out as test set. Each sequence contains $T = 4 0$ images represented as a 2 dimensional array of size $3 2 \times 3 2$ . In each sequence there is one agent, represented as circle, whose starting position is sampled randomly along the top and bottom of the image. The dataset is inspired by (Ondrúška & Posner, 2016), however with the crucial difference that the movement of the agent is stochastic. The agent performs a directed random walk through the image. At each timestep, it moves according to
$$\begin{array} { r l } & { y _ { t + 1 } \sim \mathrm { N o r m a l } ( y _ { t + 1 } ; y _ { t } + 0 . 1 5 , 0 . 0 2 ^ { 2 } ) } \\ & { x _ { t + 1 } \sim \mathrm { N o r m a l } ( x _ { t + 1 } ; 0 , 0 . 0 2 ^ { 2 } ) } \end{array}$$
where $( x _ { t } , y _ { t } )$ are the coordinates in frame $t$ in a unit square that is then projected onto $3 2 \times 3 2$ pixels. In addition to the stochasticity of the movement, half of the image is occluded, preventing the agent from being observed.
For the generative model and proposal distribution we use a Variational Recurrent Neural Network (VRNN) (Chung et al., 2015). It extends recurrent neural networks (RNNs) by introducing a stochastic latent state $x _ { t }$ at each timestep $t$ . Together with the observation $y _ { t }$ , this state conditions the deterministic transition of the RNN. By introducing this unobserved stochastic state, the VRNN is able to better model complex long range variability in stochastic sequences. Architecture and hyperparameter details are given in Appendix C.1.
Figure 4 shows $\mathrm { \ m a x { ( E L B O _ { I S } } }$ , $\mathrm { E L B O } _ { \mathrm { S M C } }$ ) for models trained with IWAE and AESMC for different particle numbers. The lines correspond to the mean over three different random seeds and the shaded areas indicate the standard deviation. The same number of particles was used for training and testing, additional hyperparameter settings are given in the appendix. One can see that models trained using AESMC outperform IWAE and using more particles improves the ELBO for both. In Appendix C.2, we inspect different learned generative models by using them for prediction, confirming the results presented here. We also tested ALT on this task, but found that while it did occasionally improve performance, it was much less stable than IWAE and AESMC.
 Figure 4: (Left) Rolling mean over 5 epochs of max(ELBOSMC, ELBOIS) on the test set, lines indicate the average over 3 random seeds and shaded areas indicate standard deviation. The color indicates the number of particles, the line style the used algorithm. (Right) The table shows the final max(ELBOSMC, ELBOIS) for each learned model.
<table><tr><td>Particles</td><td>Method</td><td> Moving Agents</td></tr><tr><td rowspan="2">10</td><td>IWAE</td><td>-357.3</td></tr><tr><td>AESMC</td><td>-356.7</td></tr><tr><td rowspan="2">20</td><td>IWAE</td><td>-356.6</td></tr><tr><td>AESMC</td><td>-356.1</td></tr><tr><td rowspan="2">40</td><td>IWAE</td><td>-356.2</td></tr><tr><td>AESMC</td><td>-356.1</td></tr></table>
# 6 CONCLUSIONS
We have developed AESMC—a method for performing model learning using a new ELBO objective which is based on the SMC marginal likelihood estimator. This ELBO objective is optimized using SGA and the reparameterization trick. Our approach utilizes the efficiency of SMC in models with intermediate observations and hence is suitable for highly structured models. We experimentally demonstrated that this objective leads to better generative model training than the IWAE objective for structured problems, due to the superior inference and tighter bound provided by using SMC instead of importance sampling.
Additionally, in Claim 1, we provide a simple way to express the bias of objectives induced by log of marginal likelihood estimators as a KL divergence on an extended space. In Propositions 1 and 2, we investigate the implications of these KLs being zero in the case of IWAE and AESMC. In the latter case, we find that we can achieve zero KL only if we are able to learn SMC intermediate target distributions corresponding to marginals of the target distribution. Using our assertion that tighter variational bounds are not necessarily better, we then introduce and test a new method, alternating ELBOs, that addresses some of these issues and observe that, in some cases, this improves both model and proposal learning.
# ACKNOWLEDGMENTS
TAL is supported by EPSRC DTA and Google (project code DF6700) studentships. MI is supported by the UK EPSRC CDT in Autonomous Intelligent Machines and Systems. TR is supported by the European Research Council under the European Union’s Seventh Framework Programme (FP7/2007- 2013) ERC grant agreement no. 617071; majority of TR’s work was undertaken while he was in the Department of Engineering Science, University of Oxford, and was supported by a BP industrial grant. TJ is supported by the UK EPSRC and MRC CDT in Statistical Science. FW is supported by The Alan Turing Institute under the EPSRC grant EP/N510129/1; DARPA PPAML through the U.S. AFRL under Cooperative Agreement FA8750-14-2-0006; Intel and DARPA D3M, under Cooperative Agreement FA8750-17-2-0093.
# REFERENCES
Yuri Burda, Roger Grosse, and Ruslan Salakhutdinov. Importance weighted autoencoders. In ICLR, 2016.
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.
P Del Moral. Feynman-Kac formulae: genealogical and interacting particle systems with applications. Probability and its applications, 2004.
Arnaud Doucet and Adam M Johansen. A tutorial on particle filtering and smoothing: Fifteen years later. Handbook of nonlinear filtering, 12(656-704):3, 2009.
Diederik P Kingma and Max Welling. Auto-encoding variational Bayes. In ICLR, 2014.
Tuan Anh Le, Maximilian Igl, Tom Jin, Tom Rainforth, and Frank Wood. Auto-encoding sequential Monte Carlo. arXiv preprint arXiv:1705.10306v1, 2017.
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. 6576–6586, 2017.
Christian A Naesseth, Scott W Linderman, Rajesh Ranganath, and David M Blei. Variational sequential Monte Carlo. arXiv preprint arXiv:1705.11140, 2017.
Peter Ondrúška and Ingmar Posner. Deep tracking: Seeing beyond seeing using recurrent neural networks. In Thirtieth AAAI Conference on Artificial Intelligence, 2016.
Tom Rainforth, Tuan Anh Le, Maximilian Igl, Chris J Maddison, Yee Whye Teh, and Frank Wood. Tighter variational bounds are not necessarily better. NIPS Workshop on Bayesian Deep Learning, 2017.
Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In ICML, 2014.
Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
# A GRADIENTS
The goal is to obtain an unbiased estimator for the gradient
$$\nabla _ { \theta , \phi } \int Q _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) \log \hat { Z } _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) \mathrm { d } x _ { 1 : T } ^ { 1 : K } \mathrm { d } a _ { 1 : T - 1 } ^ { 1 : K } .$$
# A.1 FULL REINFORCE
We express the required quantity as
$$\begin{array} { r l } & { \nabla _ { \theta , \phi } \int Q _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) \log \hat { Z } _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) \mathrm { d } x _ { 1 : T } ^ { 1 : K } \mathrm { d } a _ { 1 : T - 1 } ^ { 1 : K } } \\ & { = \displaystyle \int \nabla _ { \theta , \phi } Q _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) \log \hat { Z } _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) + } \\ & { \qquad Q _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) \nabla _ { \theta , \phi } \log \hat { Z } _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) \mathrm { d } x _ { 1 : T } ^ { 1 : K } \mathrm { d } a _ { 1 : T - 1 } ^ { 1 : K } } \\ & { = \displaystyle \int Q _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) \left[ \nabla _ { \theta , \phi } \log Q _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) \log \hat { Z } _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) + \right. } \\ & { \qquad \left. \nabla _ { \theta , \phi } \log \hat { Z } _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) \right] \mathrm { d } x _ { 1 : T } ^ { 1 : K } \mathrm { d } a _ { 1 : T - 1 } ^ { 1 : K } , } \end{array}$$
which we can estimate by sampling $( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } )$ directly from $Q _ { \mathrm { S M C } }$ and evaluating $\begin{array} { r } { \left[ \nabla _ { \theta , \phi } \log Q _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) \log \hat { Z } _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) + \nabla _ { \theta , \phi } \log \hat { Z } _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) \right] . } \end{array}$
# A.2 REINFORCE & REPARAMETERIZATION
We express the required quantity as
$$\begin{array} { r l } { \nabla _ { \Phi , \Phi } \int Q _ { \mathrm { A W } } ( z _ { 1 , 1 } ^ { ( 1 ) K } , z _ { 1 } ^ { ( 1 ) K } - 1 ) \mathrm { i } \simeq \widetilde \chi _ { \Phi , \Phi } ( z _ { 1 , 1 } ^ { ( 1 ) K } , z _ { 1 } ^ { ( 1 ) K } - 1 ) \mathrm { d } z _ { 1 , 1 } ^ { ( 1 ) K } \mathrm { d } z _ { 1 , 1 } ^ { ( 1 ) K } - } & { \ : \ : \ : \ : \ : \ : \ : \ : \ : } \\ & { = \nabla _ { \Phi , \Phi } \int \left( \displaystyle \prod _ { k = 1 } ^ { 1 } \sigma _ { k } ( \boldsymbol { \bar { \epsilon } } ^ { ( 1 ) K } ) \right) \left( \displaystyle \prod _ { k = 2 } ^ { 1 } \| Q _ { \boldsymbol { k } } ( z _ { 1 , k } ^ { ( 1 ) K } | \boldsymbol { \bar { \epsilon } } _ { k - 1 } ^ { ( 2 ) K } ) - 1 ) \mathrm { d } z _ { 1 , k } ^ { ( 1 ) K } \mathrm { d } z _ { 1 , 1 } ^ { ( 1 ) K } \right) } \\ & { \ : \ : \ : \ : \ : \ : \ : \ : \ : \ : } \\ & { = \nabla _ { \Phi , \Phi } \int \left( \displaystyle \prod _ { k = 1 } ^ { 1 } \sigma _ { k } ( \boldsymbol { \bar { \epsilon } } _ { k - 1 } ^ { ( K ) } , z _ { 1 - k } ^ { ( K ) } - 1 ) \mathrm { d } z _ { 1 , k } ^ { ( 1 ) K } \mathrm { d } z _ { 1 , 1 } ^ { ( K ) } - 1 \right. } \\ & { \ : \ : \ : \ : \ : \ : \ : \ : \ : \ : \left. \lVert \prod _ { k = 1 } ^ { 1 } \sigma _ { k } ( z _ { 1 , k } ^ { ( 1 ) K } ) \right) \left( \displaystyle \prod _ { k = 2 } ^ { 1 } \| Q _ { \boldsymbol { k } } ( z _ { 1 , k } ^ { ( 1 ) K } - 1 ) \mathrm { d } z _ { 1 , k } ^ { ( 1 ) K } \| \boldsymbol { \bar { \epsilon } } _ { k - 1 } ^ { ( K ) } \right) } \\ & \ : \ : \ : \ : \ : \ : \ : \ : \mathrm { i n f } \left( \displaystyle \prod _ { k = 1 } ^ { 1 } \sigma _ { k } ( z _ { 1 , k } ^ { ( 1 ) K } ) \right) \ : \ : \ : \ : \ : \ : \mathrm { d } z _ { 1 , k } ^ { ( 1 ) K } \sigma _ { k } ( \boldsymbol { \bar { \epsilon } } ^ { ( 1 ) K } , 1 ) \ : \ : \end{array}$$
$$\begin{array} { l } { \displaystyle = \int \left( \prod _ { t = 1 } ^ { T } \prod _ { k = 1 } ^ { K } s _ { t } ( \epsilon _ { t } ^ { k } ) \right) \left( \prod _ { t = 2 } ^ { T } \prod _ { k = 1 } ^ { K } \mathrm { D i s c r e t e } ( a _ { t - 1 } ^ { k } | w _ { t - 1 } ^ { 1 ; K } ) \right) \cdot } \\ { \displaystyle \left[ \nabla _ { \theta , \phi } \log \left( \prod _ { t = 2 } ^ { T } \prod _ { k = 1 } ^ { K } \mathrm { D i s c r e t e } ( a _ { t - 1 } ^ { k } | w _ { t - 1 } ^ { 1 ; K } ) \right) \log \hat { Z } _ { \mathrm { S M C } } ( r ( \epsilon _ { 1 : T } ^ { 1 ; K } ) , a _ { 1 : T - 1 } ^ { 1 ; K } ) + \right. } \\ { \displaystyle \left. \nabla _ { \theta , \phi } \log \hat { Z } _ { \mathrm { S M C } } ( r ( \epsilon _ { 1 : T } ^ { 1 ; K } ) , a _ { 1 : T - 1 } ^ { 1 ; K } ) \right] \mathrm { d } \epsilon _ { 1 : T } ^ { 1 ; K } \mathrm { d } a _ { 1 : T - 1 } ^ { 1 ; K } , } \end{array}$$
where $r \big ( \epsilon _ { 1 : T } ^ { 1 : K } \big )$ denotes a sample with identical distribution as $x _ { 1 : T } ^ { 1 : K }$ obtained by passing the auxiliary samples $\epsilon _ { 1 : T } ^ { 1 : K }$ through the reparameterization function. We can thus estimate the gradient by sampling $\epsilon _ { 1 : T } ^ { 1 : K }$ from the auxiliary distribution, reparameterizing and evaluating h $\begin{array} { r } { \overset { \cdot } { \nabla } \varrho _ { \theta , \phi } \log \Big ( \prod _ { t = 2 } ^ { \bar { T } } \prod _ { k = 1 } ^ { \bar { K } } \bar { \mathrm { D i s c r e t e } ( a _ { t - 1 } ^ { k } | w _ { t - 1 } ^ { 1 : K } ) } \Big ) \log \hat { Z } _ { \mathrm { S M C } } ( r ( \epsilon _ { 1 : T } ^ { 1 : K } ) , a _ { 1 : T - 1 } ^ { 1 : K } ) + \nabla \varrho _ { \theta , \phi } \log \hat { Z } _ { \mathrm { S M C } } ( r ( \epsilon _ { 1 : T } ^ { 1 : K } ) , } \end{array}$ a1:K1:T −1 )i. In Figure 5, we demonstrate that the estimator in (31) has much higher variance if we include the first term.
 Figure 5: $T = 2 0 0$ model described in Section 5.1. Kernel density estimation (KDE) of $\nabla _ { \theta _ { 1 } }$ ELBOSMC evaluated at $\theta _ { 1 } = 0 . 1$ with $K = 1 6$ using 100 samples.
# B PROOFS FOR BIAS & IMPLICATIONS ON THE PROPOSALS
Derivation of (9).
$$\begin{array} { r l } & { \displaystyle \mathrm { E L B O } = \int Q ( x ) \log \frac { Z _ { P } P ( x ) } { Q ( x ) } \mathrm { d } x } \\ & { \qquad = \displaystyle \int Q ( x ) \log Z _ { P } \mathrm { d } x - \int Q ( x ) \log \frac { Q ( x ) } { P ( x ) } \mathrm { d } x } \\ & { \qquad = \log Z _ { P } - \mathrm { K L } \left( Q | | P \right) . } \end{array}$$
Proof of Claim $I$ . Since $\hat { Z } _ { P } ( x ) \geq 0$ , $Q ( x ) \geq 0$ and $\begin{array} { r } { \int Q ( x ) \hat { Z } _ { P } ( x ) \mathrm { d } x = Z _ { P } } \end{array}$ , we can let the unnormalized target density in Definition 1 be $\tilde { P } ( x ) = Q ( x ) \hat { Z } _ { P } ( x )$ . Hence, the normalized target density is $P ( x ) = Q ( x ) \hat { Z } _ { P } ( x ) / Z _ { P }$ . Substituting these quantities into (8) and (9) yields the two equalities in (10). □
Proof of Proposition $^ { l }$ . $( \implies$ ) Substituting for $Q _ { \mathrm { I S } } ( x ^ { 1 : K } ) = P _ { \mathrm { I S } } ( x ^ { 1 : K } )$ , we obtain
$$\begin{array} { l } { \displaystyle \prod _ { k = 1 } ^ { K } q ( x ^ { k } | y ) = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \frac { \prod _ { \ell = 1 } ^ { K } q ( x ^ { \ell } | y ) } { q ( x ^ { k } | y ) } p ( x ^ { k } | y ) } \\ { \displaystyle \qquad = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \left[ q ( x ^ { 1 } | y ) \cdot \cdot \cdot q ( x ^ { k - 1 } | y ) p ( x ^ { k } | y ) q ( x ^ { k + 1 } | y ) \cdot \cdot \cdot q ( x ^ { K } | y ) \right] . } \end{array}$$
Integrating both sides with respect to $( x ^ { 2 } , \ldots , x ^ { K } )$ over the whole support (i.e. marginalizing out everything except $x ^ { 1 }$ ), we obtain:
$$q ( x ^ { 1 } | y ) = { \frac { 1 } { K } } \left[ p ( x ^ { 1 } | y ) + \sum _ { k = 2 } ^ { K } q ( x ^ { 1 } | y ) \right] .$$
Rearranging gives us $q ( x ^ { 1 } | y ) = p ( x ^ { 1 } | y )$ for all $x ^ { 1 }$ .
( $\Longleftarrow )$ Substituting $p ( x ^ { k } | y ) = q ( x ^ { k } | y )$ , we obtain
$$\begin{array} { l } { \displaystyle P _ { \mathrm { I S } } ( \boldsymbol { x } ^ { 1 : K } ) = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } \frac { Q _ { \mathrm { I S } } ( \boldsymbol { x } ^ { 1 : K } ) } { q ( \boldsymbol { x } ^ { k } | \boldsymbol { y } ) } p ( \boldsymbol { x } ^ { k } | \boldsymbol { y } ) } \\ { \displaystyle ~ = \frac { 1 } { K } \sum _ { k = 1 } ^ { K } Q _ { \mathrm { I S } } ( \boldsymbol { x } ^ { 1 : K } ) } \\ { \displaystyle ~ = Q _ { \mathrm { I S } } ( \boldsymbol { x } ^ { 1 : K } ) . } \end{array}$$
Proof of Proposition 2. We consider the general sequence of target distributions $\pi _ { t } ( x _ { 1 : t } )$ $( p _ { \theta } ( x _ { 1 : t } | y _ { 1 : t } )$ in the case of SSMs), their unnormalized versions $\gamma _ { t } ( x _ { 1 : t } \bar { ) } \left( p _ { \theta } ( x _ { 1 : t } , y _ { 1 : t } ) \right.$ in the case of SSMs), their normalizing constants $\begin{array} { r } { Z _ { t } = \int \gamma _ { t } ( x _ { 1 : t } ) \mathrm { d } x _ { 1 : t } } \end{array}$ $( p _ { \theta } ( y _ { 1 : t } )$ in the case of SSMs), where $Z = Z _ { T } = p ( y _ { 1 : T } )$ .
$( \Longrightarrow )$ ) It suffices to show that $\hat { Z } _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) = Z$ for all $( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } )$ implies 1 and 2 in Proposal 2 due to equation (11).
We first prove that $\hat { Z } _ { \mathrm { S M C } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) = Z$ for all $( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } )$ implies that the weights
$$\begin{array} { l } { { w _ { 1 } ( x _ { 1 } ) : = \displaystyle \frac { \gamma _ { 1 } ( x _ { 1 } ) } { q _ { 1 } ( x _ { 1 } ) } } } \\ { { w _ { t } ( x _ { 1 : t } ) : = \displaystyle \frac { \gamma _ { t } ( x _ { 1 : t } ) } { \gamma _ { t - 1 } ( x _ { 1 : t - 1 } ) q _ { t } ( x _ { t } | x _ { 1 : t - 1 } ) } \qquad \mathrm { f o r } t = 2 , \ldots , T } } \end{array}$$
are constant with respect to $x _ { 1 : t }$
Pick sets $t \in \{ 1 , \ldots , T \}$ $k , \ell \in \{ 1 , \dots , K \}$ Also, pick , illustrate $x _ { 1 : t }$ and Figu $x ^ { \prime } { _ { 1 : t } }$ . Now, consider twosuch that $( \bar { x } _ { 1 : T } ^ { 1 : K } , \bar { a } _ { 1 : T - 1 } ^ { 1 : K } )$ $( \tilde { x } _ { 1 : T } ^ { 1 : K } , \tilde { a } _ { 1 : T - 1 } ^ { 1 : K } )$
$$\bar { x } _ { \tau } ^ { \kappa } = \left\{ \begin{array} { l l } { x ^ { \prime } { } _ { \tau } } & { \mathrm { ~ i f ~ } \kappa = \ell \mathrm { ~ a n d ~ } { } \tau < t } \\ { x ^ { \prime } { } _ { \tau } } & { \mathrm { ~ i f ~ } ( \kappa , \tau ) = ( k , t ) } \\ { x _ { \tau } } & { \mathrm { ~ i f ~ } \kappa = k \mathrm { ~ a n d ~ } { } \tau < t } \\ { x _ { \tau } ^ { \kappa } } & { \mathrm { ~ o t h e r w i s e } } \end{array} \right.$$
$$\mathrm { f o r } \tau = 1 , \dots , T , \kappa = 1 , \dots , K ,$$
$${ \bar { a } } _ { \tau } ^ { \kappa } = \left\{ { \begin{array} { l l } { \ell } & { { \mathrm { ~ i f ~ } } ( \kappa , \tau ) = ( k , t - 1 ) { \mathrm { ~ o r ~ } } ( k , t ) } \\ { \kappa } & { { \mathrm { ~ o t h e r w i s e } } } \end{array} } \right.$$
$$\mathrm { f o r } \tau = 1 , \dots , T - 1 , \kappa = 1 , \dots , K ,$$
$$\tilde { x } _ { \tau } ^ { \kappa } = \left\{ \begin{array} { l l } { x _ { \tau } ^ { \prime } } & { \mathrm { ~ i f ~ } \kappa = \ell \mathrm { ~ a n d ~ } \tau < t } \\ { x _ { \tau } } & { \mathrm { ~ i f ~ } ( \kappa , \tau ) = ( k , t ) } \\ { x _ { \tau } } & { \mathrm { ~ i f ~ } \kappa = k \mathrm { ~ a n d ~ } \tau < t } \\ { x _ { \tau } ^ { \kappa } } & { \mathrm { ~ o t h e r w i s e ~ } } \end{array} \right.$$
$$\mathfrak { r } \tau = 1 , \dots , T , \kappa = 1 , \dots , K ,$$
$$\tilde { \boldsymbol { a } } _ { \tau } ^ { \kappa } = \left\{ \begin{array} { l l } { \ell } & { \mathrm { i f } \left( \kappa , \tau \right) = \left( k , t \right) } \\ { \boldsymbol { \kappa } } & { \mathrm { o t h e r w i s e } } \end{array} \right.$$
 Figure 6: (Left) particle set $( \bar { x } _ { 1 : T } ^ { 1 : K } , \bar { a } _ { 1 : T - 1 } ^ { 1 : K } )$ and (right) particle set $( \tilde { x } _ { 1 : T } ^ { 1 : K } , \tilde { a } _ { 1 : T - 1 } ^ { 1 : K } )$ . Lines indicate ancestor indices.
The weights $\bar { w } _ { \tau } ^ { \kappa }$ and $\tilde { w } _ { \tau } ^ { \kappa }$ for the respective particle sets are identical except when $( \tau , \kappa ) = ( t , k )$ where
$$\begin{array} { r } { \bar { w } _ { t } ^ { k } = w _ { t } ( x _ { 1 : t } ^ { \prime } ) , } \\ { \tilde { w } _ { t } ^ { k } = w _ { t } ( x _ { 1 : t } ) . } \end{array}$$
Since $\hat { Z } ( \bar { x } _ { 1 : T } ^ { 1 : K } , \bar { a } _ { 1 : T - 1 } ^ { 1 : K } ) = \hat { Z } ( \tilde { x } _ { 1 : T } ^ { 1 : K } , \tilde { a } _ { 1 : T - 1 } ^ { 1 : K } )$ , we have $w _ { t } ( x ^ { \prime } _ { 1 : t } ) = w _ { t } ( x _ { 1 : t } )$ . As this holds for any arbitrary $t$ and $x _ { 1 : t }$ , it follows that $w _ { t } ( x _ { 1 : t } )$ must be constant with respect to $x _ { 1 : t }$ for all $t = 1 , \dots , T$ .
Now, for $x _ { 1 : t }$ , consider the implied proposal by rearranging (41) and (42)
$$\begin{array} { r l } { q _ { 1 } ( x _ { 1 } ) = \frac { \gamma _ { 1 } ( x _ { 1 } ) } { w _ { 1 } } } \\ { q _ { t } ( x _ { t } | x _ { 1 : t - 1 } ) = \frac { \gamma _ { t } ( x _ { 1 : t } ) } { \gamma _ { t - 1 } ( x _ { 1 : t - 1 } ) w _ { t } } \qquad } & { \mathrm { f o r } t = 2 , \dots , T , } \end{array}$$
where $w _ { t } : = w _ { t } ( x _ { 1 : t } )$ is constant from our previous results. For this to be a normalized density with respect to $x _ { t }$ , we must have
$$w _ { 1 } = \int \gamma _ { 1 } ( x _ { 1 } ) \mathrm { d } x _ { 1 } = Z _ { 1 } , $$
and for $t = 2 , \ldots , T$ :
$$\begin{array} { r l } & { w _ { t } = \displaystyle \int \frac { \gamma _ { t } \big ( x _ { 1 : t } \big ) } { \gamma _ { t - 1 } \big ( x _ { 1 : t - 1 } \big ) } \mathrm { d } x _ { t } } \\ & { \quad = \displaystyle \frac { \int \gamma _ { t } \big ( x _ { 1 : t } \big ) \mathrm { d } x _ { t } } { \gamma _ { t - 1 } \big ( x _ { 1 : t - 1 } \big ) } } \\ & { \quad = \displaystyle \frac { Z _ { t } } { Z _ { t - 1 } } \cdot \frac { \int \pi _ { t } \big ( x _ { 1 : t } \big ) \mathrm { d } x _ { t } } { \pi _ { t - 1 } \big ( x _ { 1 : t - 1 } \big ) } . } \end{array}$$
Since $\textstyle \int \pi _ { t + 1 } ( x _ { 1 : t + 1 } ) \mathrm { d } x _ { t + 1 }$ and $\pi _ { t } ( x _ { 1 : t } )$ are both normalized densities, we must have $\pi _ { t } ( x _ { 1 : t } ) =$ $\textstyle \int \pi _ { t + 1 } ( x _ { 1 : t + 1 } ) \mathrm { d } x _ { t + 1 }$ for all $t = 1 , \dots , T - 1$ for all $x _ { 1 : t }$ . For a given $t \in \{ 1 , \ldots , T - 1 \}$ and $x _ { 1 : t }$ , applying this repeatedly yields
$$\tau _ { t } ( x _ { 1 : t } ) = \int \pi _ { t + 1 } ( x _ { 1 : t + 1 } ) \mathrm { d } x _ { t + 1 } = \int \int \pi _ { t + 2 } ( x _ { 1 : t + 2 } ) \mathrm { d } x _ { t + 2 } \mathrm { d } x _ { t + 1 } = \cdot \cdot = \int \pi _ { T } ( x _ { 1 : T } ) \mathrm { d } x _ { t + 1 : T } ,$$
such that each $\pi _ { t } ( x _ { 1 : t } )$ must be the corresponding marginal of the final target. We also have
$$\begin{array} { r l r } & { w _ { 1 } ( x _ { 1 } ) = Z _ { 1 } , } \\ & { w _ { t } ( x _ { 1 : t } ) = \displaystyle \frac { Z _ { t } } { Z _ { t - 1 } } , } & { t = 2 , \ldots , T , } \\ & { q _ { 1 } ( x _ { 1 } ) = \pi _ { 1 } ( x _ { 1 } ) = \pi _ { T } ( x _ { 1 } ) , } \\ & { q _ { t } ( x _ { t } | x _ { 1 : t - 1 } ) = \displaystyle \frac { \pi _ { t } ( x _ { 1 : t } ) } { \pi _ { t - 1 } ( x _ { 1 : t - 1 } ) } = \displaystyle \frac { \pi _ { T } ( x _ { 1 : t } ) } { \pi _ { T } ( x _ { 1 : t - 1 } ) } , } & { t = 2 , \ldots , T . } \end{array}$$
( $\Longleftarrow )$ To complete the proof, we now simply substitute identities in 1 and 2 of Proposal 2 back to the expression of $\hat { Z } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } )$ to obtain $\bar { \hat { Z } } ( x _ { 1 : T } ^ { 1 : K } , a _ { 1 : T - 1 } ^ { 1 : K } ) = Z$ . □
# C EXPERIMENTS
# C.1 VRNN
In the following we give the details of our VRNN architecture. The generative model is given by:
$$p ( x _ { 1 : T } , h _ { 0 : T } , y _ { 1 : T } ) = p ( h _ { 0 } ) \prod _ { t } p ( x _ { t } | h _ { t - 1 } ) p ( y _ { t } | h _ { t - 1 } , x _ { t } ) p ( h _ { t } | h _ { t - 1 } , x _ { t } , y _ { t } )$$
where
$$\begin{array} { r } { p ( h _ { 0 } ) = \mathrm { N o r m a l } ( h _ { 0 } ; 0 , I ) \qquad } \\ { p ( x _ { t } | h _ { t - 1 } ) = \mathrm { N o r m a l } ( x _ { t } ; \mu _ { \theta } ^ { x } ( h _ { t - 1 } ) , \sigma _ { \theta } ^ { x } ( h _ { t - 1 } ) ^ { 2 } ) } \\ { p ( y _ { t } | h _ { t - 1 } , x _ { t } ) = \mathrm { B e r n o u l l i } ( y _ { t } ; \mu _ { \theta } ^ { y } ( \varphi _ { \theta } ^ { x } ( x _ { t } ) , h _ { t - 1 } ) ) } \\ { p ( h _ { t } | h _ { t - 1 } , x _ { t } , y _ { t } ) = \delta _ { f ( h _ { t - 1 } , \varphi _ { \theta } ^ { x } ( x _ { t } ) , \varphi _ { \theta } ^ { y } ( y _ { t } ) ) } ( h _ { t } ) } \end{array}$$
and the proposal distribution is given by
$$p ( x _ { t } | y _ { t } , h _ { t - 1 } ) = \mathrm { N o r m a l } ( x _ { t } ; \mu _ { \phi } ^ { p } ( \varphi _ { \phi } ^ { y } ( y _ { t } ) , h _ { t - 1 } ) , \sigma _ { \phi } ^ { p 2 } ( \varphi _ { \phi } ^ { y } ( y _ { t } ) , h _ { t - 1 } ) )$$
The functions $\mu _ { \theta } ^ { x }$ and $\sigma _ { \theta } ^ { x }$ are computed by networks with two fully connected layers of size 128 whose first layer is shared. $\varphi _ { \theta } ^ { x }$ is one fully connected layer of size 128.
For visual input, the encoding $\varphi _ { \theta } ^ { y }$ is a convolutional network with conv-4x4-2-1-32, conv-4x4-2-1-64, conv-4x4-2-1-128 where conv-wxh-s-p-n denotes a convolutional network with $n$ filters of size $w \times h$ , stride $s$ , padding $p$ . Between convolutions we use leaky ReLUs with slope 0.2 as nonlinearity and batch norms. The decoding $\mu _ { \boldsymbol { \theta } } ^ { y }$ uses transposed convolutions of the same dimensions but in reversed order, however with stride $s = 1$ and padding $p = 0$ for the first layer.
A Gated Recurrent Unit (GRU) is used as RNN and if not stated otherwise ReLUs are used in between fully connected layers.
For the proposal distribution, the functions $\mu _ { \phi } ^ { p }$ and $\sigma _ { \phi } ^ { p }$ are neural networks with three fully connected layers of size 128 that are sharing the first two layers. Sigmoid and softplus functions are used where values in $( 0 , 1 )$ or $\mathbb { R } ^ { + }$ are required. We use a minibatch size of 25.
For the moving agents dataset we use ADAM with a learning rate of $1 0 ^ { - 3 }$ .
A specific feature of the VRNN architecture is that the proposal and the generative model share the component $\varphi _ { \phi , \theta } ^ { y }$ . Consequently, we set $\phi = \theta$ for the parameters belonging to this module and train it using gradients for both and $\phi$ .
# C.2 MOVING AGENTS
In Figure 7 we investigate the quality of the generative model by comparing visual predictions. We do so for models learned by IWAE $( t o p )$ and AESMC (bottom). The models were learned using ten particles but for easier visualization we only predict using five particles.
The first row in each graphic shows the ground truth. The second row shows the averaged predictions of all five particles. The next five rows show the predictions made by each particle individually.
The observations (i.e. the top row) up to $t = 1 9$ are shown to the model. Up to this timestep the latent values $x _ { \mathrm { 0 : 1 9 } }$ are drawn from the proposal distribution $q ( x _ { t } | y _ { t } , h _ { t - 1 } )$ . From $t = 2 0$ onwards the latent values $x _ { 2 0 : 3 7 }$ are drawn from the generative model $p ( x _ { t } | x _ { t - 1 } )$ . Consequently, the model predicts the partially occluded, stochastic movement over 17 timesteps into the future.
We note that most particles predict a viable future trajectory. However, the model learned by IWAE is not as consistent in the quality of its predictions, often ’forgetting’ the particle. This does not happen in every predicted sequence but the behavior shown here is very typical. Models learned by AESMC are much more consistent in the quality of their predictions.
# C.3 OPTIMIZING ONLY PROPOSAL PARAMETERS
We have run experiments where we optimize various ELBO objectives with respect to $\phi$ with $\theta$ fixed in order to see how various objectives have an effect on proposal learning. In particular, we train $_ { \mathrm { E L B O _ { I S } } }$ and $\mathrm { E L B O } _ { \mathrm { S M C } }$ with number of particles $K \in \{ 1 0 , 1 0 0 , 1 0 0 0 \}$ . Once the training is done, we use the trained proposal network to perform inference using both IS and SMC with number of particles $K _ { \mathrm { t e s t } } \in \{ 1 0 , 1 0 0 , 1 0 0 0 \}$ .
In Figure 8, we see experimental results for the LGSSM described in Section 5.1. We measure the quality of the inference network using a proxy $\begin{array} { r } { \sqrt { \sum _ { t = 1 } ^ { T } ( \mu _ { t } ^ { \mathrm { k a l m a n } } - \mu _ { t } ^ { \mathrm { a p p r o x } } ) ^ { 2 } } } \end{array}$ where $\mu _ { t } ^ { \mathrm { k a l m a n } }$ is the true marginal mean $\mathbb { E } _ { p ( x _ { 1 : T } | y _ { 1 : T } ) } [ x _ { t } ]$ obtained from the Kalman smoothing algorithm and $\begin{array} { r } { \mu _ { t } ^ { \mathrm { a p p r o x } } = \left( \sum _ { k = 1 } ^ { K } w _ { T } ^ { k } x _ { t } \right) / \left( \sum _ { k = 1 } ^ { K } w _ { T } ^ { k } \right) } \end{array}$ is an approximate marginal mean obtained from the proposal parameterized by $\phi$ .
 Figure 7: Visualisation of the learned model. Ground truth observations (top row in each sub figure) are only revealed to the algorithm up until $_ { \mathrm { t = } 1 9 }$ inclusive. The second row shows the prediction averaged over all particles, all following rows show the prediction made by a single particle. (Top) IWAE. (Bottom) AESMC.
We see that if we train using ELBOSMC with $K _ { \mathrm { t r a i n } } = 1 0 0 0$ , the performance for inference using SMC (with whichever $K _ { \mathrm { t e s t } } \in \{ 1 0 , 1 0 0 , 1 0 0 0 \} )$ is worse than if we train with $\mathrm { E L B O _ { I S } }$ with any number of particles $K _ { \mathrm { t r a i n } } \in \{ 1 0 , 1 0 0 , 1 0 0 0 \}$ . Examining the other axes of variation:
• Increasing $K _ { \mathrm { t e s t } }$ (moving up in Figure 8 (Right)) improves inference. • Increasing $K _ { \mathrm { t r a i n } }$ (moving to the right in Figure 8 (Right)) worsens inference. • Among different possible combinations of (training algorithm, testing algorithm), (IS, SMC) $\begin{array} { r } { \succ ( \mathrm { S M C } , \mathrm { S M C } ) \succ ( \mathrm { I S } , \mathrm { I S } ) \succ ( \mathrm { S M C } , \mathrm { I S } ) , } \end{array}$ where we use “ $\mathbf { \boldsymbol { a } } \succ \mathbf { \boldsymbol { b } } ^ { \prime }$ to denote that the combination $a$ results in better inference than combination $b$ .

Figure 8: (Left) Optimizing ELBO with respect to $\phi$ for LGSSM. (Right) The lengths of the squares are proportional (with a constant factor) to $\begin{array} { r } { \sqrt { \sum _ { t = 1 } ^ { T } ( \mu _ { t } ^ { \mathrm { k a l m a n } } - \mu _ { t } ^ { \mathrm { a p p r o x } } ) ^ { 2 } } } \end{array}$ which is a proxy for inference quality of $\phi$ described in the main text. The larger the square, the worse the inference.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398# LEARNING KOLMOGOROV MODELS FOR BINARY RANDOM VARIABLES
Anonymous authors Paper under double-blind review
# ABSTRACT
We propose a framework for learning a Kolmogorov model, for a collection of binary random variables. More specifically, we derive conditions that link (in the sense of implications in mathematical logic) outcomes of specific random variables and extract valuable relations from the data. We also propose an efficient algorithm for computing the model and show its first-order optimality, despite the combinatorial nature of the learning problem. We exemplify our general framework to recommendation systems and gene expression data. We believe that the work is a significant step toward interpretable machine learning.
# 1 INTRODUCTION
Machine learning and artificial intelligence method have permeated a large number of areas (Marr, Sept 2016). These methods are based on machine learning models, which consist of learning an input-output mapping for a given dataset. Despite the plethora of such models (e.g., matrix factorization (Koren et al., 2009), SVD-based models (Koren, 2008), deep neural networks (LeCun et al., 2015), and models inspired from physics (Stark, 2016b)), they lack interpretability: they are not capable of offering insight about the data, nor the underlying process. The lack of interpretablity may have serious consequences in mission-critical systems, ethics, and validation of computeraided diagnosis (Doshi-Velez & Kim, 2017). While there is no consensus around the definition of interpretability, causality (Lipton, 2016) is a vital component: it refers to causal relations within the data and insight about the underlying data-generating process. We thus adopt a generalized version of causality using implication in mathematical logic as our ‘definition’ of interpretable models.
To this end, we propose learning a so-called Kolmogorov Model (KM) associated with a set of binary Random Variables (RVs). In addition to prediction, the interpretability of the model (as defined above) enables learning causal relations.1 We derive a sufficient condition under which the realization of one RV’s outcome (causally) implies the outcome of the other. In the context of recommendation systems, causal relations identify groups of items, for which a user liking one item implies that he/she likes all other items in the group. In gene expression analysis, the same relations identify groups of DNA locations for which the expression of a gene in one of them implies its expression in all other locations. The foundation of our approach is to model binary RVs as elementary events on a Kolmogorov space, by an inner product of two vectors (formally stated in Section 2.1), which is based on established results from classical probability theory. To our best knowledge, this specific formulation is novel in the context of learning representation.
The inner product of our formulation is reminiscent of factorization methods such as, matrix factorization (Koren, 2008), non-negative matrix factorization (Lee & Seung, 2001), SVD (Cai et al., 2010), and physics-inspired techniques, non-negative models (Stark, 2016a). It should be noted that the inner product components of these methods is usually based on strong intuition about the data, provided and validated by a human expert. In contrast, the proposed KM is a fully automated approach, deeply rooted in probability theory, which finds an interpretable model (as defined above) of the data without any human intervention. Thus, both the model and the causal relations within the data have a strong mathematical basis. Moreover, in most of the existing approaches, we may need to have one pipeline for learning the representation and another one for mining these relations. However, our approach requires only a single pipeline for both tasks. This is very appealing on a conceptual level, and it can drastically simplify coding and validation. Our method also generalizes K-means and some of its variants. Detailed discussions of the relation between our proposed method and these prior works is in Appendix A.3.
In an abstract sense, we formulate a KM learning problem as a coupled combinatorial program, decompose it into two subproblems using the Block-Coordinate Descent (BCD) method, and obtain provably optimal solutions for both. For the first one, we exploit the structure of linear programs on the unit simplex and use low-complexity (yet optimal) Frank-Wolfe algorithm (Frank & Wolfe, 1956). To bypass the inherent complexity of the second subproblem (combinatorial and NP-hard), we propose a semidefinite relaxation, and show its quasi-optimality in recovering the optimal solution of the combinatorial subproblem. Finally, we show the convergence of our algorithm to a stationary point of the original problem. We propose a simple algorithm for mining the causal relations. All the proofs and additional discussions are available in Authors (Oct 2017).
# 2 SYSTEM MODEL
Notation: Lowercase letter $a$ , uppercase bold letter $\pmb { A }$ , and calligraphic letter $\mathcal { A }$ denote vectors, matrices, and sets, respectively. $[ A ] _ { i , j }$ and $A ^ { T }$ denote element $( i , j )$ and the transpose of $\pmb { A }$ . $\operatorname { s u p p } ( a )$ denotes the support set of $\textbf { \em a }$ . The inequality $\mathbf { \Delta } x \leq \mathbf { \Delta } y$ holds element-wise. $\pmb { I }$ denotes the identity matrix, 1 and 0 the all-one and all-zero vectors (of appropriate dimension). $e _ { n }$ is the $n$ th elementary basis, $\mathcal { P } = \{ \pmb { p } \in \mathbb { R } _ { + } ^ { D } \ | \ \mathbf { 1 } ^ { T } \pmb { p } = 1 \}$ the unit simplex, and ${ \bar { \{ n \} } } : = \{ 1 , \cdots , n \}$ .
# 2.1 PROBLEM FORMULATION
Consider a double-indexed set of binary Random Variables $( R V s )$ , $X _ { u , i } \in \mathcal { A } = \{ 1 , 2 \}$ , taken from a dataset $\mathcal { D } = \{ ( u , i ) \mid ( u , i ) \in \mathcal { U } \times \mathcal { \bar { Z } } \}$ . Each RV is defined on a sample space $\Omega$ , consisting of elementary events $\Omega = \{ \omega _ { d } \mid 1 \leq d \leq D \}$ . We denote by $\mathbb { P } [ X _ { u , i } = z ]$ , $z \in { \mathcal { A } }$ , the probability that RV $X _ { u , i }$ takes the value $z \in { \mathcal { A } }$ ; see example in Section 2.2. Since $X _ { u , i }$ is binary, it is fully characterized by considering one outcome. Thus, we write the Kolmogorov Model $( K M )$ for $X _ { u , i }$ as
$$\mathrm { K M : } \quad \mathbb { P } [ X _ { u , i } = 1 ] = \pmb { \theta } _ { u } ^ { T } \pmb { \psi } _ { i } .$$
Thus, each RV $X _ { u , i }$ is associated with (characterized by) a Probability Mass Function $( P M F )$ $\theta _ { u } , u \in \mathcal { U }$ , and an indicator vector $\psi _ { i } , i \in \mathcal { T }$ . The model follows from established results in classical probability theory (Kolmogorov, 1957),(Gray, 2009) (formalized in Appendix A.2). Notice that the model in (1) can approximate with arbitrarily small accuracy the measure corresponding to $\mathbb { P } [ \cdot ]$ for a large enough $D$ .
Problem 1 (Problem Statement) Let $p _ { u , i }$ denote the empirical value of $\mathbb { P } [ X _ { u , i } = 1 ]$ . We assume that $\{ p _ { u , i } \}$ are known for elements of a training set $\kappa \subseteq \mathcal { D }$ , where $\mathcal { K } = \{ ( u , i ) | ( u , i ) \in \mathcal { U } \times \mathcal { T } \}$ . 2 Given samples coming from the model in (1), we wish to infer the parameters of underlying probability distribution: find parameters of the KM, i.e., $\{ \psi _ { i } , \pmb \theta _ { u } \}$ that best describe $\{ p _ { u , i } ~ | ~ ( \bar { u } , i ) \bar { \in } \mathcal { K } \}$ . The resulting problem is a fully parametric statistical inference task. For tractability, we address it using the minimum mean-squared error as a point estimator. The corresponding optimization problem is
$$\begin{array} { r } { ( Q ) : \quad \{ \psi _ { i } ^ { \star } , \theta _ { u } ^ { \star } \} \in \left\{ \begin{array} { l l } { \displaystyle \operatorname { a r g m i n } _ { \{ \psi _ { i } \} , \{ \theta _ { u } \} } \sum _ { ( u , i ) \in { \mathcal K } } \left( \theta _ { u } ^ { T } \psi _ { i } - p _ { u , i } \right) ^ { 2 } \triangleq { \mathcal E } ( \{ \psi _ { i } \} , \{ \theta _ { u } \} ) } \\ { \mathrm { s . ~ t . ~ } \theta _ { u } \in { \mathcal P } \mathrm { ~ , ~ } \psi _ { i } \in { \mathbb B } ^ { D } , \forall ( u , i ) \in { \mathcal K } } \end{array} \right. \ . } \end{array}$$
We present our solution to this coupled non-convex conspiratorial optimization in the next section. The obtained solution to $( Q )$ can be used for prediction on a test set, as well as extracting causality structures within training set (see Section 4).
Proposed Approach: While the proposal to model binary RVs as elementary events on a Kolmogorov space is based on established results, the specific learning formulation (Problem 1) is novel. Because this model is rooted in probability theory, (1) defines the outcome of a RV in the strict Kolmogorov sense, and the resulting causal relations (Section 4) also hold from a strict analytical perspective. Note that causal relations (a.k.a. association rules) may still be extracted using existing methods, e.g., (non-negative) Matrix Factorization (MF) and their variants, SVD, binary MF, and K-means. However, these relations are not based on causality and the formal relations that (mathematically) follow from the KM in (1), but rather on intuitions/heuristics, which may yield different relations. Naturally, we wish the explore further in this work the causal relations that arise from the proposed model. Additionally, unlike existing methods, the prediction and causal relations mining are done in ’one-shot’, thereby simplifying the implementation/validation; see Appendix A.3.
# 2.2 ILLUSTRATIVE EXAMPLE: RECOMMENDATION SYSTEMS
In this context, $\mathcal { U }$ and $\mathcal { T }$ denote the set of users and items respectively, and $X _ { u , i }$ models the preference of user $u$ for item $i$ , $( u , i ) \in \mathcal { K }$ . Thus, $\mathbb { P } [ X _ { u , i } = 1 ]$ (or $\mathbb { P } [ X _ { u , i } = 2 ]$ ) is the probability that user $u$ likes (or dislikes) item $i$ . Moreover, $\theta _ { u }$ determines the profile/taste of user $u$ , $\psi _ { i }$ is related to item $i$ (depending on genre, price, etc.), and the elementary events denote movie genres (e.g., $\omega _ { 1 } =$ “Action”, $\omega _ { 2 } = { } ^ { \mathrm { 6 5 } } \mathrm { s c i F i } ^ { \mathrm { 3 } }$ , etc.). The training set, consisting of an empirical probability that user $\cdot$ likes item $i$ , $\cdot$ . We obtain this probability using $\_$ , where $\cdot$ denotes the rating that user $u$ has provided for item $i$ , and $R _ { \mathrm { m a x } }$ the maximum rating (Stark, 2015). For instance, if user $\cdot$ rates item $i$ with a score of $\cdot$ (where the maximum rating is 10), then $\cdot$ ; Other approaches may be used to obtain $\cdot$ depending on the specific application.
As a concrete illustrative example, consider a 10-star “recommendation system”, having 2 users and 2 items. We then find the $D$ -dimensional ( $D = 3$ ) KM factorization to obtain , $\{ \psi _ { i } ^ { \star } \} _ { i = 1 } ^ { 2 }$ and $\lbrace \theta _ { u } ^ { \star } \rbrace _ { u = 1 } ^ { 2 }$ is the size of the Kolmogorov space $\Omega$ , the number of elementary events, and the dimension of the factorization (selected via cross-validation to minimize the test error). Solving $( Q )$ results in finding $\{ \psi _ { i } ^ { \star } \} _ { i = 1 } ^ { 2 }$ and $\lbrace \pmb { \theta } _ { u } ^ { \star } \rbrace _ { u = 1 } ^ { 2 }$ . An example result is given below:
$$\underbrace { \left[ 0 . 3 \quad 1 \right] } _ { \{ p _ { u , i } \} } = \left[ \pmb { \theta } _ { 1 } ^ { \star ^ { T } } \Big \{ 0 . 2 \quad 0 . 3 \quad 0 . 5 \Big ] _ { \pmb { \theta } _ { 2 } ^ { \star ^ { T } } } \left[ \underbrace { 0 \quad 1 \quad 1 } _ { \psi _ { 1 } ^ { \star } } \quad \frac \} { \psi _ { 2 } ^ { \star } } \right] \mathrm { B c t i e n } \right]$$
To showcase the model’s intuition, note that $p _ { 1 , 1 }$ , the probability that user 1 likes movie 1, is represented as $\psi _ { 1 } ^ { T } \pmb { \theta } _ { 1 }$ . It is thus expressed as convex/stochastic mixture of movie genres, since elementary events are movie genres in this scenario. We underline that this high degree of interpretability is not artificially enforced but rather context-dependent. More generally, a KM represents a set of observed outcomes for RVs as (context-dependent) mixtures of elementary events. The approach consists of learning a (hidden) latent model by jointly optimizing the PMF and binary indicator vectors. Thus, interpreting elements of the indicator vectors as movie genres requires a context-dependent map, from the elements of $\cdot$ to movie genres. Another way to find such an interpretation is when this context-dependent map is known apriori. In this setting, each item is already tagged with its movie genres, and $\cdot$ need not be optimized; Alas, having this context-dependent map comes at the expense of a loss in training/test (see Appendix A.4). However, recall that the primary interest of this work is not this facet of interpretability, but rather by that of the causal relations.
# 3 PROPOSED ALGORITHM
To approach a solution for problem (2), we use the block-coordinate descent $( B C D )$ method to split $( Q )$ into two sub-problems. Here, we derive our solution approach to each. We first refine the current PMF estimation $\pmb { \theta } _ { u }$ , and then that of the indicator $\psi _ { i }$ . Given $\{ \psi _ { i } ^ { ( n ) } \}$ at iteration $n$ , we pose the PMF refinement, $\theta$ -step, as
$$\begin{array} { r } { ( Q _ { 1 } ) : \theta _ { u } ^ { ( n + 1 ) } \in \underset { \theta _ { u } \in \mathcal { P } } { \mathrm { a r g m i n } } f ( \theta _ { u } ) \triangleq \theta _ { u } ^ { T } \underbrace { Q _ { u } ^ { ( n ) } } _ { : = \sum _ { i \in \mathcal { Z } _ { K } } \psi _ { i } ^ { ( n ) } \psi _ { i } ^ { ( n ) ^ { T } } } \theta _ { u } - 2 \theta _ { u } ^ { T } \underbrace { r _ { u } ^ { ( n ) } } _ { : = \sum _ { i \in \mathcal { Z } _ { K } } \psi _ { i } ^ { ( n ) } p _ { u , i } } . } \end{array}$$
We then pose the indicator vector refinement, $\psi$ -step, as
$$\begin{array} { r } { ( Q _ { 2 } ) : \psi _ { i } ^ { ( n + 1 ) } \in \underset { \psi _ { i } \in \mathbb { B } ^ { D } } { \mathrm { a r g m i n } } g ( \psi _ { i } ) \triangleq \psi _ { i } ^ { T } \underbrace { S _ { i } ^ { ( n + 1 ) } } _ { : = \sum _ { u \in \mathcal { U } _ { K } } \theta _ { u } ^ { ( n + 1 ) } \theta _ { u } ^ { ( n + 1 ) T } } \psi _ { i } - 2 \psi _ { i } ^ { T } \underbrace { v _ { i } ^ { ( n + 1 ) } } _ { : = \sum _ { u \in \mathcal { U } _ { K } } \theta _ { u } ^ { ( n + 1 ) } p _ { u , i } } . } \end{array}$$
Table 1: $\theta$ -step solution using FW
<table><tr><td>function[0*]=FW(Qu,ru,∈) for k=1,2,...,IFw do dk) = ej*, j*=argmin[Vf(0(k)]j</td></tr><tr><td>1≤j≤D 0(k+1)=(1-ak��� ()0() +a(dk</td></tr><tr><td>Stopif|/(+1)-/≤e end for</td></tr></table>
Table 2: $\psi$ -step solution using SDR
function $[ \hat { \psi } _ { i } ] = \mathrm { S D R } \left( \vphantom { \sum _ { i } } S _ { i } , t _ { i } , M _ { r n d } \right)$ , // Repeat to approximate each $\psi _ { i } ^ { \star } , \forall i \in \mathcal { I } _ { K }$ Solve (5) to find X(SDR)i Factorize as $X _ { i } ^ { ( \mathrm { S D R } ) } = { \pmb { L } } _ { i } ^ { T } { \pmb { L } } _ { i }$ for $m = 1 , 2 , . . . , M _ { r n d }$ do Gen. zero-mean i.i.d Gaussian vector $\pmb { u } _ { i } ^ { ( m ) }$ Compute $\hat { \pmb { u } } _ { i } ^ { ( m ) } = \mathrm { s i g n } [ { \pmb { L } } _ { i } ^ { T } { \pmb { u } } _ { i } ^ { ( m ) } .$ end for $\begin{array} { r } { \mathbf { \Lambda } ^ { m ^ { \star } } = \operatorname * { a r g m i n } _ { 1 \leq m \leq D + 1 } \ \hat { \pmb u } _ { i } ^ { ( m ) ^ { T } } \tilde { \pmb S } _ { i } \hat { \pmb u } _ { i } ^ { ( m ) } } \end{array}$ Compute $\hat { z } _ { i } = [ \pmb { u } _ { i } ^ { ( m ^ { \star } ) } ] _ { 1 : D } ^ { - } [ \pmb { u } _ { i } ^ { ( m ^ { \star } ) } ] _ { D + 1 }$ Approximate $\psi _ { i } ^ { \star }$ , as $\hat { \psi } _ { i } = ( \hat { z } _ { i } + \mathbf { 1 } ) / 2$ end function
Moreover, $\boldsymbol { \mathcal { U } } _ { K }$ and $\mathcal { T } _ { K }$ are defined as $\mathcal { K } = \{ ( u , i ) \mid u \in \mathcal { U } _ { K } \subseteq \mathcal { U }$ , $i \in \mathcal { T } _ { K } \subseteq \mathcal { T } \}$ . Recall that having globally optimal solutions for both $\left( Q _ { 1 } \right)$ and $\left( Q _ { 2 } \right)$ is necessary to show the convergence of BCD (Tseng, 2001) - a challenging task due to the NP-hardness of $\left( Q _ { 2 } \right)$ .
# 3.1 $\theta$ -STEP: REFINE PMF ESTIMATE
We use the Frank-Wolfe (FW) algorithm (Frank & Wolfe, 1956) to solve $\left( Q _ { 1 } \right)$ as a succession of Linear Programs (LPs) over the unit simplex. While LP solvers generally have similar complexity as quadratic program solvers, solving an LP reduces to searching for the minimum index - which is computationally efficient, when the LP is over the unit simplex. We summarized this FW variant for solving $\left( Q _ { 1 } \right)$ ; see also Jaggi (2013)[Algorithm 1]. Here, we drop the BCD iteration index, $n$ , and just keep the FW iteration number, $k$ , for notation simplicity. We first determine the descent direction: $\begin{array} { r } { \pmb { d } _ { \boldsymbol { u } } ^ { ( k ) } \in \operatorname * { a r g m i n } _ { \boldsymbol { s } \in \mathcal { P } } \left( \nabla f ( \pmb { \theta } _ { \boldsymbol { u } } ^ { ( k ) } ) \right) ^ { T } \boldsymbol { s } } \end{array}$ . The constraint $s \in \mathcal { P }$ greatly simplifies the above LP and yields: $\begin{array} { r } { \pmb { d } _ { u } ^ { ( k ) } = \pmb { e } _ { j ^ { \star } , \_ j } j ^ { \star } \in \mathrm { a r g m i n } _ { 1 \leq j \leq { D } } [ \nabla f ( \pmb { \theta } _ { u } ^ { ( k ) } ) ] _ { j } } \end{array}$ ; see Proposition 2 (Appendix A.6). The solution follows from LPs over the unit probability simplex. Thus, finding the descent direction reduces to searching over the $D$ -dimensional gradient vector (done in $\mathcal { O } ( D ) .$ ). Then, the current value is updated using a simple step size rule, $\alpha _ { u } ^ { ( k ) } = k / ( k + 1 )$ . Table 1 shows the $\theta$ -step solution, and Proposition 3 in Appendix A.6 characterizes its convergence.
# 3.2 $\psi$ -STEP: REFINE INDICATOR ESTIMATE
To address the NP-hard nature of $\left( Q _ { 2 } \right)$ , we propose a solution based on Semi-Definite Relaxation and Randomization $( S D R )$ , and establish its quasi-optimality. We use the results of Ma et al. (2002)[Sec IV-C]) and a series of reformulations to rewrite $\left( Q _ { 2 } \right)$ in the following equivalent form (see Authors (Oct 2017) for all the derivations):
$\begin{array} { r } { \pmb { X } _ { i } ^ { \star } \in \mathrm { a r g m i n } _ { \pmb { X } _ { i } } \mathrm { ~ t r } ( \tilde { S } _ { i } \pmb { X } _ { i } ) , \mathrm { ~ s . ~ t . ~ } \pmb { X } _ { i } \succeq \mathbf { 0 } , [ \pmb { X } _ { i } ] _ { k , k } = 1 , \forall k , \mathrm { r a n k } ( \pmb { X } _ { i } ) = 1 } \end{array}$ where $\pmb { X } _ { i } = \pmb { x } _ { i } \pmb { x } _ { i } ^ { T }$ $\begin{array} { r } { \mathbf { \Xi } _ { i } ^ { T } , \tilde { S } _ { i } = \left[ \begin{array} { c c } { ( 1 / 4 ) S _ { i } } & { - \tilde { t } _ { i } / 2 } \\ { - \tilde { t } _ { i } ^ { T } / 2 } & { 0 } \end{array} \right] , \mathbf { \Psi } _ { x _ { i } } = \left[ \begin{array} { c } { z _ { i } } \\ { w _ { i } } \end{array} \right] , z _ { i } = 2 \psi _ { i } - 1 , w _ { i } \in \{ - 1 , + 1 \} \mathrm { i s } } \end{array}$ an auxiliary variable, and $\tilde { \pmb { t } } _ { i } \triangleq ( \pmb { v } _ { i } - ( 1 / 2 ) \pmb { S } _ { i } \mathbf { 1 } )$ . The problem is then relaxed into a convex program,
$${ \pmb X } _ { i } ^ { ( \mathrm { S D R } ) } \in \ \mathrm { a r g m i n } _ { { \pmb X } _ { i } } \ \mathrm { t r } ( \tilde { S } _ { i } { \pmb X } _ { i } ) , \mathrm { s . t . } \ X _ { i } \succeq { \bf 0 } , [ { \pmb X } _ { i } ] _ { k , k } = 1 , \forall k$$
X (SDR)i may be solved using generic solvers. Then, a randomization procedure (Ma et al., 2002) extracts an approximate (binary) solution for $\left( Q _ { 2 } \right)$ ; see Table 2. This evidently raises the issue of the sub-optimality gap for SDR. Based on the results of Tan $\&$ Rasmussen (2001) and Luo et al. (2010), we show in Proposition 4 (see Appendix A.6) that SDR (Table 2) is optimal (asymptotically in $D$ ) in recovering the binary solution of $\left( Q _ { 2 } \right)$ .
We highlight that the performance bound in Proposition 4 compares the quality of both the approximate binary solution offered by SDR (with respect to the optimal binary solution of $( Q _ { 2 } ) )$ ), as well as their respective cost functions. The asymptotic optimality is empirically validated in Appendix A.7.
# 3.3 ALGORITHM DESCRIPTION
The BCD-based algorithm alternates between refining the indicator and PMF vectors; see Algorithm 1. Lemma 2 (Appendix A.6) shows its convergence to a stationary point of $( Q )$ .
# Algorithm 1 Iterative computation of KMs
// Randomly Initialize $\{ \pmb { \theta } _ { u } ^ { ( 1 ) } \in \mathcal { P } \}$ for $n = 1 , 2 , \dots \mathbf { d o }$ Compute S(n)i and $\mathbf { \Delta } \mathbf { \mathbf { \mathbf { t } } } _ { i } ^ { ( n ) }$ using (4) Call $\hat { \psi } _ { i } ^ { ( n ) } = \mathrm { S D R } ( S _ { i } ^ { ( n ) } , t _ { i } ^ { ( n ) } , M _ { r n d } ) , \forall i \in \mathcal { T } _ { K }$ Compute $Q _ { u } ^ { ( n ) }$ and $\boldsymbol { r } _ { u } ^ { ( n ) }$ using (3) // Initialize FW with $\{ \pmb { \theta } _ { u } ^ { ( n - 1 ) } \}$ , from previous iteration Call $\pmb { \theta } _ { u } ^ { ( n ) ^ { \star } } = \mathrm { F W } ( \pmb { Q } _ { u } ^ { ( n ) } , \pmb { r } _ { u } ^ { ( n ) } , \bar { \epsilon } )$ , for all $u \in \mathcal { U } _ { K }$ end for
# 4 INTERPRETABILITY VIA CAUSAL RELATION
# 4.1 CAUSAL RELATIONS
Once a solution is found using Algorithm 1, here, we propose a method to find causal relations among the RVs. More specifically, we compare the support set of each pair of RVs from the training set, $\cdot$ and $X _ { u , j }$ , and check if there is any ‘overlap’ between their support set. Intuitively, this condition means that some of the elementary events (see Section 2.1) of one RV might be ‘contained’ in the elementary events of another. Consequently, the RVs are mutually related by causality, and the outcome of one determines that of the other. This insight is formalized here.
Proposition 1 (Inclusion of Support Set) Consider two random variables $X _ { u , i }$ and $X _ { u , j }$ (belonging to the training set) whose KM are given by the model in (1). $I f \operatorname { s u p p } ( \psi _ { j } ) \subseteq \operatorname { s u p p } ( \psi _ { i } )$ , then the following two causal relations hold:
$$X _ { u , i } = \mathrm { 1 \ i m p l i e s \ } X _ { u , j } = 1 \ , \ \mathrm { a n d \ } X _ { u , j } = 2 \ \mathrm { i m p l i e s \ } X _ { u , i } = 2 .$$
Proof: See Authors (Oct 2017) for the proof.
Stated plainly, when the support set condition holds, the first outcome of $X _ { u , i }$ implies the same outcome for $X _ { u , j }$ , and the second outcome for $X _ { u , j }$ implies the second one for $X _ { u , i }$ , thereby implying a mutual causal relation among them (since $X _ { u , i }$ influences $X _ { u , j }$ and vice-versa). Note that our above definition of causality and causal relations is different than conventional ones in Pearl (2009)[Chap 2.8]. Moreover, our definition is distinct from Granger causality, due to the mutual coupling among the RVs in question.
We present next a special case of Proposition 1. When $\psi _ { i } ~ = ~ { \bf 1 }$ , then $\mathsf { s u p p } ( \psi _ { i } ) = \{ D \}$ , and $\operatorname { s u p p } ( \psi _ { j } ) \subseteq \operatorname { s u p p } ( \psi _ { i } )$ holds, for any choice of $\psi _ { j } , \forall j \in \mathcal { I } _ { K }$ , where $\mathcal { T } _ { K }$ defined in Section 3.
Corollary 1 (Maximally Supported RVs) Let $\{ \psi _ { i } , ~ \pmb \theta _ { u } \} _ { ( u , i ) \in \mathcal K }$ denote the KM associated with $\{ \mathbb { P } [ X _ { u , i } = 1 ] \} _ { ( u , i ) \in \mathcal { K } }$ . We define $\mathcal { M }$ as set of RVs for which the support set of the indicator vector is one, i.e., $\mathcal { M } = \{ i \mid \psi _ { i } = { \bf 1 } \}$ . Then, the condition $\operatorname { s u p p } ( \psi _ { j } ) \subseteq \operatorname { s u p p } ( \psi _ { i } )$ (Proposition $^ { l }$ ) holds trivially $\forall j \ \in \mathcal { I } _ { K }$ . Thus, the causal relations in (6) hold, for every $i \in \mathcal { M }$ .
For maximally supported RVs, the realization of one outcome, $X _ { u , i } = 1$ , determines that of all $R V s$ of the set $\{ X _ { u , j } = 1 | \forall j \in \mathbb { Z } _ { K } \}$ .
Example 1 (Causal Relations in Recommendation Systems) In addition to prediction, recommendation systems are designed to accurately mine for association rules: if a user likes item $i$ will he/she like another item $j ?$ Thus, the causal relations of Proposition 1 and Corollary 1 will be quite powerful, as we shall see. In the example of Section 2.2, note that $\operatorname { s u p p } ( \psi _ { 1 } ) \subseteq \operatorname { s u p p } ( \psi _ { 2 } )$ . Then, Proposition 1 yields: if user 1 (or user 2) likes movie 2 implies he/she also likes movie 1. Moreover, $X _ { 1 , 2 }$ and $X _ { 2 , 2 }$ are maximally supported RVs, since $\psi _ { 2 } = { \bf 1 }$ . Thus, Corollary 1 reads: If any user likes item 2, then this causally implies that he/she likes all other items in the training set.
 Figure 1: Algorithm for CRM (toy example)
Thus, our approach provides association rules that follow from causal relations between different RVs. Consequently, these relations are stricter (as they are rooted in Kolmogorov probability) than other methods for mining association rules, which are not based on causality.
# 4.2 CAUSAL RELATIONS MINING (CRM)
We provide an efficient algorithmic approach to automatically mine the above relations. In a nutshell, the algorithm does a pairwise check of the support set condition (Proposition 1), for pairs of RVs $X _ { u , i }$ and $X _ { u , j }$ , $\forall ( i , j ) \in \mathcal { T } _ { K } \times \mathcal { T } _ { K }$ . The method is illustrated in Figure 1, for the illustrative example of Section 2.2. The above causal relations can be modeled conveniently using the adjacency matrix $A \in \mathbb { B } ^ { | \mathcal { T } _ { K } | \times | \mathcal { T } _ { K } | }$ , defined as
$$-$$
Stated differently, $[ A ] _ { i , j } = 1$ if the support of $X _ { u , j }$ is contained in that of $X _ { u , i }$ . Note that when $\pmb { A }$ is sparse (resp. dense) is an indication for a dataset in which few (resp. many) casual relations exist. To quantify the sparsity level, we define an influence score, $\beta _ { i } = | \mathcal { T } _ { K } | ^ { \bar { - } 1 } \sum _ { j \in \mathcal { I } _ { K } } [ \pmb { A } ] _ { i , j }$ , which measures the normalized number of pairs $X _ { u , i }$ and $X _ { u , j }$ , satisfying the support set condition. These steps are summarized in the Algorithm 2 (illustrated in Figure 1). Moreover, its complexity is dominated by the pairwise search over $\mathcal { T } _ { K }$ (see Step 1), which comes at $\mathcal { O } ( \vert \mathcal { Z } _ { K } \vert ^ { 2 } - \vert \mathcal { T } _ { K } \vert ) \overset { \cdot } { \approx } \mathcal { O } ( \vert \dot { \mathcal { T } } _ { K } \vert ^ { 2 } )$ operations.
# Algorithm 2 Causal Relations Mining (CRM)
1. Check the support set condition, via a pairwise search to check for pairs $\psi _ { i }$ and $\psi _ { j }$ satisfying $\operatorname { s u p p } ( \psi _ { j } ) \subseteq \operatorname { s u p p } ( \psi _ { i } )$ , $\forall ( i , j ) \in \mathcal { T } _ { K } \times \mathcal { T } _ { K }$ , $i \neq j$ (done over the training set $\kappa$ ) 2. Build the adjacency matrix $\pmb { A }$ , in (7) , and compute the influence score $\beta _ { i }$ , $\forall i \in \mathcal { T } _ { K }$ 3. Find all pairs $( i , j )$ such that $a _ { i , j } = 1$ . For each of these pairs it holds that (Proposition 1), $X _ { u , i }$ and $X _ { u , j }$ are causally related, i.e.,
$$X _ { u , i } = 1 { \mathrm { ~ i m p l i e s ~ } } X _ { u , j } = 1 , { \mathrm { ~ a n d ~ } } X _ { u , j } = 1 { \mathrm { ~ i m p l i e s ~ } } X _ { u , i } = 1$$
4. Identify (if possible) maximally supported RVs (Corollary 1), $\mathcal { M } = \{ i \mid \psi _ { i } = { \bf 1 } \}$ . For each of them, the relations in (8) hold for all $i \in \mathcal { I } _ { K }$
# 5 SPECIAL CASES AND APPLICATIONS
We highlight relevant special cases and applications of our approach.
Special Case: Unsupervised Learning Setting. Note that Algorithm 1 is equally applicable to an unsupervised learning task (no prediction needed). Moreover, if the training set has no missing data, i.e., $\kappa = \mathcal { D }$ , then an alternate solution to $( Q )$ may be obtained using the binary matrix factorization (MF) (Slawski et al., 2013) method. However, it is not applicable when factorizing a training set $\kappa$ (where $\kappa \subset D$ ). Unlike Algorithm 1, binary MF does not offer prediction.
Application: Analysis of Gene Expression. The ability to analyze gene expression data is critical to DNA research (Zhang et al., 2009). This task can be formulated in our proposed framework as follows: $\mathbb { P } [ X _ { u , i } = \bar { 1 } ]$ denotes the probability that the genes being studied are expressed in sample $u \in \mathcal { U }$ at location $i \in \mathcal { T }$ of the DNA. In this setting, the set Kolmogorov elementary events, $\{ \omega _ { 1 } , \cdot \cdot \cdot , \omega _ { D } \}$ , represents the various genes that might be involved. Consequently, our approach models the probability that a set of genes is expressed as a convex mixture of $D$ various genes. We recall that this intuition follows from our model and is not enforced explicitly. More importantly, the causal relations can identify groups of DNA locations for which the expression of a gene (or its absence) in a given location implies its presence (or its absence) for all other locations in the group. We will numerically show the usefulness of these relations to DNA analysis, in Section 7.2.
 (a) Normalized Training RMSE vs Itera-(b) Normalized Training RMSE for KM (c) Influence score $\beta _ { i }$ tions (Setting 1) vs NNM (Setting 2) ( $D = 8$ , Setting 2) Figure 2: Performance of proposed method
# 6 PRACTICAL CONSIDERATIONS
Overfitting: Regularization parameters (to mitigate overfitting) can be included without any changes to the solution method. An $\ell _ { 2 }$ −regularization can be included in $\left( Q _ { 1 } \right)$ : $f ( \pmb { \theta } _ { u } ) ~ =$ $\pmb { \theta } _ { u } ^ { T } ( \tilde { \pmb { Q } } _ { u } + \lambda _ { u } \pmb { I } _ { D } ) \pmb { \theta } _ { u } - 2 \pmb { \theta } _ { u } ^ { T } \pmb { r } _ { u } + \gamma _ { u }$ , where the regularizer $\lambda _ { u } \geq 0$ is absorbed into a “new” matrix $( Q _ { u } + \lambda _ { u } I _ { D } )$ . Note that an $\ell _ { 1 }$ −regularization for $\theta _ { u }$ would not work, since $\pmb { \theta } _ { u } \in \mathcal { P }$ . Similarly, an $\ell _ { 1 }$ -regularization for $\left( Q _ { 2 } \right)$ is: $g ( \psi _ { i } \bar { ) = } \psi _ { i } ^ { T } S _ { i } \psi _ { i } - 2 ( v _ { i } - ( \mu _ { i } / 2 ) \mathbf { 1 } ) ^ { T } \psi _ { i } + \gamma _ { i }$ , where the regularizer $\mu _ { i } \geq 0$ is absorbed into the linear term, since $\mu _ { i } \| \psi _ { i } \| _ { 1 } = \mu _ { i } \mathbf { 1 } ^ { T } \psi _ { i }$ , for $\psi _ { i }$ binary.
Optimality Gap: We recall that the proposed SDR method was shown to be quasi-optimal in providing approximate binary solutions to $\left( Q _ { 2 } \right)$ . Thus, the relaxation does not affect the interpretability, in the sense that Proposition 1 and Corollary 1 still hold. While the derivations pertaining to causal relations (Section 4) assume globally optimal solutions to $( Q )$ - an NP-hard problem, Algorithm 1 guarantees locally optimal ones. Thus, a bound on the gap between these solutions is needed. We highlight this issue as an interesting topic for further investigation.
# 6.1 LIMITATIONS
Computational Complexity: The computational complexity of Algorithm 1 is dominated by the solution in (5), which is $\cdot$ operations per iteration of Algorithm 1 (recalling the negligible cost of the FW method). Notice that the additional complexity compared to matrix factorization (its extensions), for which the complexity is $\mathcal { O } ( D ^ { 3 } )$ (e.g., $D \leq 1 6$ in all numerical results). Moreover, we are already investigating complexity reduction techniques leveraging the structure of the SDP, and distributed solutions to $\cdot$ to enable parallelization. Finally, the computational complexity of Algorithm 2 consists mainly of step 1, which has $\approx \mathcal { O } ( | \mathcal { T } _ { K } | ^ { 2 } )$ operations.
Learning a non-stationary distribution: The proposed method assumes that distributions of the RVs in the training set are stationary: Indeed, scenarios with time-varying distributions are a limitation (and interesting future directions). However, in learning it is quite common to assume that the datagenerating distribution is stationary.
# 7 NUMERICAL RESULTS
# 7.1 APPLICATION TO RECOMMENDATION SYSTEMS
Experimental Setup: We evaluate the performance of Algorithm 1 under the following. We opted to not have a stopping criterion based on the prediction error of the algorithm (on a validation set), since we are primarily interested in the model that we learn in the training phase. Nonetheless, as we have reported in Appendix A.7, there is not loss in the predictive performance of the model. Hereafter, “Prop.” refers to the proposed method.
Setting 1: An artificial training dataset, where $p _ { u , i } \in \mathcal { K } = \{ U = 2 0 \} \times \{ I = 4 0 \}$ , where $\{ p _ { u , i } \}$ are i.i.d. and uniformly chosen on the unit interval. We benchmark against a variant on Algorithm 1, where the $\psi$ -step for $Q _ { 2 }$ is replaced by an exhaustive search. As the data is artificial (unsupervised learning setting), we include the Binary $M F$ in Slawski et al. (2013)[Algorithm 2].
Setting 2: The training set $\kappa$ , is chosen as the MovieLens 100K, with $U = 9 4 3$ users and $I = 1 6 8 2$ items, split into $8 0 \%$ for training and $2 0 \%$ for testing. Let $\{ \hat { \psi } _ { i } \} , \{ \hat { \theta } _ { u } \}$ the output of Algorithm 1, after 5 iterations. We benchmark against matrix factorization $( M F )$ (Koren et al., 2009), non-negative MF (NMF) (Lee & Seung, 2001), $S V D + +$ (Koren, 2008) (ensuring the dimension of the factorization, $k$ , is close to $D$ ), non-negative models (NNM) Stark (2015), and the $K$ -means $( K { \cdot } M )$ algorithm. The implementation and results use the MyMediaLite package (Gantner et al., 2011).
Training Performance for Unsupervised Learning (Setting 1): Fig 2a shows the resulting normalized training $\begin{array} { r } { \mathrm { R M S E } = ( \sum _ { ( u , i ) \in { \mathcal K } } | p _ { u , i } - \hat { \theta } _ { u } ^ { T } \hat { \psi } _ { i } | ^ { 2 } / | { \cal K } | ) ^ { 1 / 2 } } \end{array}$ . We observe that the monotone convergence in Lemma 2 is validated numerically, and that the training error decays with increasing model size, $D$ . Note that the training performance of Algorithm 1 is indistinguishable from its exhaustive search variant. Moreover, Algorithm 1 converges to solution whose performance is similar to Binary MF, with a few iterations (except for $D = 8$ where Algorithm 1 outperforms Binary MF).
Training Performance for Supervised Learning (Setting 2): Recall that Binary MF is not applicable here, due to the supervised learning setting. The same conclusions hold when testing Algorithm 1 on the ML100K (Figure 2b). We underline that while NNMs yield better training performance over Algorithm 1, the latter will have better test performance (since NNMs are indeed defined by relaxing KMs). In Table 4 (Appendix A.7), we empirically verify that the test performance of the proposed method outperforms the benchmarks in Setting 2.
Interpretability via Causal Relations (Setting 2): We numerically evaluate the relations of Algorithm 2. The influence score for each item in the training set, $\beta _ { i }$ , is shown in Figure 2c where we displayed items with ‘high’ influence score, $\beta _ { i } ~ \geq ~ 0 . 5$ . Note that each of these high influence items is causally related to at least half of the items in the training set. This confirms the effectiveness of Algorithm 2 for finding causal relations, and that a sparse adjacency matrix is uncommon. We next identify the set of items corresponding to maximally supported RVs, M = {119, 814, 1188, 1190, 1290, 1393, 1462, 1486, 1494, 1530, 1590, 1638}. For each of these items, a user liking one given item, implies he/she likes all other items in the training set. Interestingly, these results remain the same when $D = 2 4$ , thereby suggesting that procedure for mining causal relations is quite stable.
# 7.2 APPLICATION TO GENE EXPRESSION
Experimental Setup: Following the problem statement in Section 5, we show the usefulness Algorithm 2 for gene expression. We first define another setting.
Setting 3: We use the REGED0 dataset 3. Element $( u , i )$ in the input matrix, $\cdot$ represents the level of gene expression for sample $\cdot$ at location $i$ of the DNA, and is reported as integer between 0 and $\cdot$ . Similarly to recommendation systems (Section 2.2), the training set is obtained as $\_$ . Thus, $\cdot$ denotes the (empirical) probability that the gene is expressed in sample $u$ at location $\cdot$ . 4 After running Algorithm 1, we use Algorithm 2 to mine causal relations. As this is unsupervised learning setting, we include the binary MF (Slawski et al., 2013) method.
Results: While Fig 3a shows the training performance for several values of $D$ , Figure 3b plots the corresponding influence score that is obtained with our method. Fig 3a reveals a huge gap $\approx 3 \times$ less) between the training error of Algorithm 1 and Binary MF (unlike Figure 2a where both algorithms yield similar performance). This drastic degradation in the performance of binary MF compared to the small artificial of Figure 2a may be attributed to increasing the data/problem size (though we were unable to empirically verify this claim). Thus, we opted to use the solution of Algorithm 1 as
 Figure 3: Training performance of proposed method for REGED0 dataset
 (b) Influence score for each DNA location (Setting 3)
(a) Normalized Training RMSE as a function of iterations (Setting 3)
a basis for finding causal relations. We identified 10 DNA locations corresponding to the highest $\beta _ { i }$ as: {813, 250, 774, 706, 380, 49, 477, 162, 740, 702}. For instance, the highest influence score of .1612 at DNA location 813 allowed to identify a set, $s$ , of 161 different locations which are causally related to DNA location 813. More specifically, the expression (or absence) of a given gene in location 813 implies its expression (or absence) in all other DNA locations in $s$ . While similar relations are possible using gene analysis methods, the above causal relations follow from our rigorous mathematical framework.
We also ran experiments on the ML 1M dataset ( $\cdot$ larger that ML 100K) and observed that main conclusions were the same. For lack of space, we instead opted to include different datasets such as the REGED0 dataset $\cdot$ larger than ML 100K) to exemplify another application of the approach. However, we note that a large-scale implementation of the method may be challenging at this stage. As mentioned earlier, we are currently investigating complexity reduction methods before running experiments involving large datasets. Rather, the current work is intended a proof of concept of the usefulness of such an approach.
# 8 CONCLUSION
We have proposed a framework for learning a Kolmogorov model, associated with a collection of binary random variables. Interpretability of the model (as defined by logical implication and causality) was harnessed by deriving causal relations, i.e., by finding sufficient conditions that bind outcomes of certain random variables. We also proposed an algorithm for computing a Kolmogorov model, a combinatorial non-convex problem, and showed its convergence to a stationary point of the problem using results from block-coordinate descent. The combinatorial nature of the problem was addressed using a semi-definite relaxation. We also proposed an efficient algorithm to mine for the causal relations inherent to our model. Our results suggest that increased interpretability and improved prediction, do not cause a significant increase in complexity. We highlight several key issues for future work, e.g., complexity reduction for (5) (leveraging that its dual is piece-wise linear), and a sufficient condition for identifiability (by adapting that of Fu et al. (2017))
# REFERENCES
Anonymous Authors. Learning elementary representations of random variables. Technical Report, Oct 2017. URL https://tinyurl.com/y7gpu4dc.
Jian-Feng Cai, Emmanuel J. Cands, and Zuowei Shen. A singular value thresholding algorithm for matrix completion. SIAM Journal on Optimization, 20(4):1956–1982, 2010. doi: 10.1137/ 080738970.
Mark Davenport and Justin Romberg. An overview of low-rank matrix recovery from incomplete observations. IEEE Journal of Selected Topics in Signal Processing, 10(4):608–622, June 2016. ISSN 1932-4553. doi: 10.1109/JSTSP.2016.2539100.
Finale Doshi-Velez and Been Kim. Towards a rigorous science of interpretable machine learning. arXiv, 2017.
Marguerite Frank and Philip Wolfe. An algorithm for quadratic programming. Naval Research Logistics Quarterly, 3(1-2):95–110, 1956. ISSN 1931-9193.
Xiao Fu, Kejun Huang, and Nicholas D. Sidiropoulos. On identifiability of nonnegative matrix factorization. CoRR, abs/1709.00614, 2017.
Zeno Gantner, Steffen Rendle, Christoph Freudenthaler, and Lars Schmidt-Thieme. Mymedialite: A free recommender system library. In Proceedings of the Fifth ACM Conference on Recommender Systems, RecSys ’11, pp. 305–308. ACM, 2011. ISBN 978-1-4503-0683-6.
Robert M. Gray. Probability, Random Processes, and Ergodic Properties. Springer, 2nd edition, 2009. ISBN 1441910891, 9781441910899.
Patrik O. Hoyer. Non-negative matrix factorization with sparseness constraints. CoRR, cs.LG/0408058, 2004.
Martin Jaggi. Revisiting Frank-Wolfe: Projection-free sparse convex optimization. In Proceedings of the 30th International Conference on Machine Learning, volume 28, pp. 427–435, 2013.
Andrei Nikolaevich Kolmogorov. On the representation of continuous functions of many variables by superposition of continuous functions of one variable and addition. In Doklady Akademii Nauk, volume 114, pp. 953–956. Russian Academy of Sciences, 1957.
Y. Koren, Robert Bell, and Chris Volinsky. Matrix factorization techniques for recommender systems. Computer, 42(8):30–37, Aug 2009. ISSN 0018-9162. doi: 10.1109/MC.2009.263.
Yehuda Koren. Factorization meets the neighborhood: A multifaceted collaborative filtering model. In Proceedings of the 14th ACM International Conference on Knowledge Discovery and Data Mining, KDD, pp. 426–434. ACM, 2008. ISBN 978-1-60558-193-4.
Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521, 2015. doi: 10.1038/nature14539.
Daniel Lee and Sebastian Seung. Algorithms for non-negative matrix factorization. In Advances in Neural Information Processing Systems (NIPS), pp. 556–562. MIT Press, 2001.
Zachary Chase Lipton. The mythos of model interpretability. CoRR, abs/1606.03490, 2016.
Stuart Lloyd. Least squares quantization in PCM. IEEE Trans. Inf. Theor., 28(2):129–137, September 2006. ISSN 0018-9448. doi: 10.1109/TIT.1982.1056489.
Zhi-Quan Luo, Wing-Kin Ma, A.M.-C. So, Yinyu Ye, and Shuzhong Zhang. Semidefinite relaxation of quadratic optimization problems. IEEE Signal Processing Magazine,, 27(3):20–34, May 2010. ISSN 1053-5888. doi: 10.1109/MSP.2010.936019.
Wing-Kin Ma, T. N. Davidson, Kon Max Wong, Zhi-Quan Luo, and Pak-Chung Ching. Quasimaximum-likelihood multiuser detection using semi-definite relaxation with application to synchronous CDMA. IEEE Transactions on Signal Processing, 50(4):912–922, April 2002.
Bill Marr. The top 10 AI and machine learning use cases everyone should know about. Forbes Magazine, Sept 2016.
Judea Pearl. Causality: Models, Reasoning and Inference. Cambridge University Press, New York, NY, USA, 2nd edition, 2009. ISBN 052189560X, 9780521895606.
Martin Slawski, Matthias Hein, and Pavlo Lutsik. Matrix factorization with binary components. In Advances in Neural Information Processing Systems (NIPS), pp. 3210–3218, 2013.
Cyril J. Stark. Expressive recommender systems through normalized nonnegative models. CoRR, abs/1511.04775, 2015.
Cyril J. Stark. Expressive recommender systems through normalized nonnegative models. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, pp. 1081–1087, 2016a.
Cyril J. Stark. Recommender systems inspired by the structure of quantum theory. CoRR, abs/1601.06035, 2016b.
Peng Hui Tan and L. K. Rasmussen. The application of semidefinite programming for detection in CDMA. IEEE Journal on Selected Areas in Communications, 19(8):1442–1449, Aug 2001. ISSN 0733-8716. doi: 10.1109/49.942507.
P. Tseng. Convergence of a block coordinate descent method for nondifferentiable minimization. Journal of Optimization Theory and Applications, 109(3):475–494, 2001. ISSN 0022-3239. doi: 10.1023/A:1017501703105.
Joyce Jiyoung Whang, Inderjit S. Dhillon, and David F. Gleich. Non-exhaustive, overlapping k-means. In Proceedings of the 2015 SIAM International Conference on Data Mining, pp. 936–944, 2015. doi: 10.1137/1.9781611974010.105.
Zhong-Yuan Zhang, Tao Li, Chris Ding, Xian-Wen Ren, and Xiang-Sun Zhang. Binary matrix factorization for analyzing gene expression data. Data Mining and Knowledge Discovery, 20(1): 28, 2009. ISSN 1573-756X. doi: 10.1007/s10618-009-0145-2. URL http://dx.doi.org/ 10.1007/s10618-009-0145-2.
# A SUPPLEMENTARY MATERIAL FORLEARNING KOLMOGOROV MODELS FOR BINARY RANDOM VARIABLES
A.1 DEFINITIONS
A.2 KOLMOGOROV MODEL FOR A RANDOM VARIABLE
Let $( \Omega , { \mathcal { M } } , \mu )$ be a finite probability space. Here $\Omega$ is the sample space, the event class $\mathcal { M }$ is the power set of $\Omega$ , and $\mu$ assigns probabilities to the sets in $\mathcal { M }$ . Let $X _ { u , i }$ denote a doubly-indexed set of random variables on the given probability space, having output alphabet in $\mathcal { A }$ , where elements of $\mathcal { A }$ are indexed by $z$ , i.e., $\boldsymbol { \mathcal { A } } ( \boldsymbol { z } )$ represents the $z$ th element in $\mathcal { A }$ . Also, let $\mathbb { P } [ X _ { u , i } = \mathcal { A } ( z ) ] \in [ 0 , 1 ]$ denote the probability that outcome $\boldsymbol { \mathcal { A } } ( \boldsymbol { z } )$ occurs, for $1 \leq z \leq | { \mathcal { A } } |$ . We let $\Omega = \{ \omega _ { d } \mid 1 \leq d \leq D \} .$ where $\left\{ \omega _ { d } \right\}$ the set of all $D$ -elementary events. Since $X _ { u , i }$ is binary, i.e., $\mathcal { A } = \{ 1 , 2 \}$ , we write the KM for $X _ { u , i }$ as,
$$\begin{array} { r l } & { \mathbb { P } [ X _ { u , i } = 1 ] = \pmb { \theta } _ { u } ^ { T } \psi _ { i , 1 } } \\ & { \mathbb { P } [ X _ { u , i } = 2 ] = \pmb { \theta } _ { u } ^ { T } \psi _ { i , 2 } = 1 - \pmb { \theta } _ { u } ^ { T } \psi _ { i , 1 } , } \end{array}$$
where $\theta _ { u }$ is a Probability Mass Function $( P M F )$ vector on the unit simplex, $\mathcal { P }$ , and $\{ \psi _ { i , 1 } , \psi _ { i , 2 } \} \in \mathbb { B } ^ { D }$ are binary indicator vectors representing the support of its probability measure. Moreover, the last equality follows from $\psi _ { i , 1 } + \psi _ { i , 2 } = { \bf 1 }$ , which in turn follows from the outcomes of each RV summing to one. Since $X _ { u , i }$ is binary, it is fully characterized by considering one outcome,
$$\mathbb { P } [ X _ { u , i } = 1 ] = \pmb { \theta } _ { u } ^ { T } \psi _ { i } ,$$
# A.3 RELATED WORK
Matrix Factorization Methods: Note that, $( Q )$ can be re-written as a low-rank matrix factorization problem, over the set of binary and stochastic matrices (see Appendix A.5. Thus, the proposed approach is connected to factorization methods: Matrix Factorization (MF) (Koren et al., 2009), Nonnegative Matrix Factorization (Lee & Seung, 2001), SVD (Cai et al., 2010) (and their many variants/extensions) have gained widespread applicability, covering areas in sound processing, (medical) image reconstruction, recommendation systems and prediction problems (Davenport & Romberg, 2016). These techniques model elements of the training set as inner product of two arbitrary vectors: Despite their success, the performance is inherently tied to the validity of that model, and consequently the extent to which these assumption hold. However, this inner product does not represent a RV (in a mathematical sense), when viewed in the context of the proposed model (see Section 2.1). Consequently, the analytical guarantees of Section 4, which underpin the causal relations, do not hold for general factorization methods.
Nonnegative Sparse MF: Hoyer (2004) numerically showed that the two low-rank components that are offered by sparse nonnegative MF (a variant of MF) provide insights on the data they model. While our proposed method also provides insight among the data (via the causal relations), the proposed KM and the resulting causal relations are based on established axioms in probability. Unlike the relations offered by nonnegative sparse MF which are shown empirically for a handful of examples, the causal relations (Section 4) hold analytically.
Binary MF: We underline that most MF methods also rely on BCD methods (alternating minimization), for which globally optimal solutions to each subproblem are needed for convergence. Thus, these methods cannot be directly applied to $( Q )$ , due to the binary constraints on $\psi _ { i }$ . The authors are unaware generic solution approaches for $( Q )$ . Nonetheless, the Binary $M F$ method (Slawski et al., 2013) can solve $( Q )$ when the problem is feasible and the training set spans the entire data set, i.e., $\kappa = \mathcal { D }$ . However, the method operates in the unsupervised learning setting only, without providing prediction (see Section 5). This indeed limits the applicability of binary MF to practical scenarios, since real-world data will have missing/erroneous data.
Clustering Methods: Consider a special case of $( Q )$ , where $\psi _ { i }$ is constrained to have one nonzero element. The resulting problem becomes the well-known $K$ -means clustering (Lloyd, 2006). The K-means algorithms (and its variants $\mathbf { K }$ -medoids, fuzzy K-means and K-SVD), have become pervasive in an abundance of applications such as clustering, classification, image segmentation,
DNA analysis, online dictionary learning, source coding, etc. Our approach generalizes $K$ -means, by allowing for overlapping clusters. While a similar generalization of the classical K-means algorithm was considered in (Whang et al., 2015), the number of points per cluster is determined explicitly.
Nonnegative Models: Non-Negative Models (NNMs) (Stark, 2016a) are recent attempts at interpretable models. For reasons of computational tractability (Stark, 2016a), NNMs are defined by relaxing $\psi _ { i }$ in (1). However, this relaxation impairs the highly interpretable nature of the model in (1), making causal relations less accurate.
# A.4 KNOWN CONTEXT-DEPENDENT MAP
Consider the case where the elementary events correspond to each of the movie genres, i.e., $\Omega =$ $\{ \omega _ { 1 } , \cdot \cdot \cdot , \omega _ { D } \} = \{ { } ^ { \ast \cdot } \mathrm { A c t i o n } ^ { , , } , \cdot \cdot \cdot , { } ^ { \ast \cdot } \mathrm { S c i F i } ^ { , , } \}$ . We refer to this as a known context-dependent map: $\mathbb { P } [ X _ { u , i } = 1 ] = \psi _ { i } ^ { T } \pmb { \theta } _ { u } = t _ { i } ^ { T } \pmb { \theta } _ { u }$ is expressed as a convex/stochastic mixture of movie genres. These models are a ’holy grail’ for recommendation systems, due to the direct interpretation that they provide. In this case, $\cdot$ is a binary genre tag vector with $[ t _ { i } ] _ { m } = 1 , \forall m \in \{ D \}$ , if movie $\cdot$ belongs to movie genre $\cdot$ , and zero otherwise. Now consider a genie-aided setting, where the set of movie genre tags $\{ t _ { i } \}$ , are known (and consequently $\cdot$ are known as well). Then, one can revisit the optimization problem for determining the KM, ( $\cdot$ ), where the indicator vectors are given, $\{ \psi _ { i } = t _ { i } \}$ , and the optimization is performed over the PMF vectors only $\cdot$ :
$$\operatorname* { m i n } _ { \theta _ { u } \in \mathcal { P } } \mathcal { E } ( \{ t _ { i } \} , \{ \theta _ { u } \} )$$
However, numerical result reveal that the training and test performance of these representations is quite poor. We tested the performance of this highly interpretable model, by extracting the tag vectors $\{ t _ { i } \}$ from the ML 100K dataset, and using them to optimize the corresponding PMF vectors. We set $\cdot$ to match the total number of movie genres for the ML 100K dataset. As seen in Table 3, the
<table><tr><td>TrainingRMSE</td><td>Test RMSE</td></tr><tr><td>0.4468</td><td>0.4468</td></tr></table>
Table 3: Normalized errors metrics when the context-dependent map is known (ML100K)
known context-dependent map have poor performance. This suggests the existence of a trade-off between the having this content-dependent map, and training/test performance.
# A.5 PROBLEM FORMULATION IN MATRIX FORM
Let $\Psi = [ \psi _ { 1 } , \cdot \cdot \cdot , \psi _ { I } ]$ , $\Psi \in \mathbb { B } ^ { D \times I }$ denote the aggregate indicator matrix (containing all the individual indicator vectors), $\boldsymbol { \Theta } = [ \pmb { \theta } _ { 1 } , \cdots , \pmb { \theta } _ { U } ]$ , $\Theta \in \mathbb { R } _ { + } ^ { \tilde { D } \times U }$ the aggregate matrix of PMF vectors, and $[ \pmb { P } ] _ { ( u , i ) } = p _ { ( u , i ) } , \forall ( u , i ) \in \mathcal { U } \times \mathcal { T }$ , $P \in \mathbb { R } _ { + } ^ { U \times I }$ the aggregate matrix of known probabilities. Then, $( Q )$ can be written in equivalent matrix form,
$$\{ \underset { \Psi , \Theta } { \operatorname* { m i n } } \ \mathcal { E } ( \Psi , \Theta ) = \lVert M \circ ( \Theta ^ { T } \Psi - P ) \rVert _ { F } ^ { 2 } \qquad \\ \mathrm { ~ s . ~ t . ~ } \Psi \in \mathbb { B } ^ { D \times I } , \ \Theta \in \mathbb { R } _ { + } ^ { D \times U } , \ \Theta ^ { T } \mathbf { 1 } = \mathbf { 1 } \ .$$
where $\circ$ denotes the Hadamard product, and $M \in \mathbb { B } ^ { U \times I }$ is a mask matrix having $M _ { u , i } = 1 , \forall ( u , i ) \in$ $\kappa$ .
# A.6 MAIN RESULTS
Below, we summarized the results used in the paper; see Authors (Oct 2017) for the proofs.
We use following known result to find the descent direction for the FW method (the proof is known).
Proposition 2 Consider the following Linear Program $( L P )$ ,
$$\left( P _ { P S } \right) \ \pmb { x } ^ { \star } = \underset { \pmb { x } \in \mathbb { R } ^ { n } } { \mathrm { a r g m i n } } c ^ { T } \pmb { x } , \ \mathrm { ~ s . ~ t . ~ } \ \mathbf { 1 } ^ { T } \pmb { x } = 1 , \ \pmb { x } \geq \mathbf { 0 }$$
Its optimal solution is given by
$${ \pmb x } ^ { \star } = { \pmb e } _ { j ^ { \star } } \ , \mathrm { w h e r e } j ^ { \star } = \ \mathrm { a r g m i n } _ { 1 \leq j \leq n } { \pmb c } ^ { T } { \pmb e } _ { j }$$
Thus, the solution reduces to searching over the vector $^ c$ .
We show the convergence of the FW algorithm (Table 1).
Proposition 3 Let $\pmb { \theta } _ { u } ^ { \star }$ be the optimal solution to $\left( Q _ { 1 } \right)$ . Then the sequence of iterates $\{ \pmb \theta _ { u } ^ { ( k ) } \}$ satisfies (Jaggi, 2013)[Theorem $I J ,$
$$\| f ( \pmb \theta _ { u } ^ { ( k + 1 ) } ) - f ( \pmb \theta _ { u } ^ { \star } ) \| _ { 2 } \leq \mathcal { O } ( 1 / k ) , k = 1 , 2 , \cdots \boxed { }$$
Proof: The linear convergence rate for all FW variants, was proved in Jaggi (2013)[Theorem 1].
Quasi-optimality of SDR: The question was studied extensively in the context of binary detection for multi-antenna communication (Tan & Rasmussen, 2001). Interestingly, $\left( Q _ { 2 } \right)$ can be recast as a noiseless binary detection problem, where SDR has been to be optimal. The results is formalized below.
Proposition 4 Let $g ( \psi _ { i } ^ { \star } )$ and $g ( \hat { \psi } _ { i } )$ denote the optimal solutions to the binary $Q P$ in $\left( Q _ { 2 } \right)$ , and its SDR after randomization (Table 2), respectively. The approximation quality is defined as (Luo et al., 2010),
$$\eta \leq g ( \psi _ { i } ^ { \star } ) / g ( \hat { \psi } _ { i } ) \leq 1 .$$
It holds that $\eta = 1$ , with probability $1 - \exp ^ { - \mathcal { O } ( D ) }$ , asymptotically in $D$ . Thus, the relaxation is quasi-optimal.
Proof: See (Authors, Oct 2017).
Lemma 2 Let $t _ { n } \triangleq \mathcal { E } ( \{ \psi _ { i } ^ { ( n ) } \} , \{ \pmb { \theta } _ { u } ^ { ( n ) } \} )$ , $n = 1 , 2 , \ldots$ be the sequence of iterates, resulting from the updates in Algorithm $^ { l }$ . Then, $\{ t _ { n } \}$ is non-increasing in $n$ , and converges to a stationary point of $( Q )$ in (2), almost surely.
Proof: The convergence is shown in (Authors, Oct 2017).
# A.7 ADDITIONAL NUMERICAL RESULTS
Prediction Performance (Setting 2): Since the range of the predicted variable is different for MF/NMF/SVD++, and KM/NNM, we use the normalized test RMSE, i.e., NRMSE $=$ $\begin{array} { r } { \eta ( \sum _ { ( u , i ) \in \bar { \mathcal { K } } } | [ R ] _ { ( u , i ) } - \hat { R } _ { u , i } | ^ { 2 } / | \bar { \mathcal { K } } | ) ^ { 1 / 2 } } \end{array}$ where $\bar { \kappa }$ is the test set, and $\eta = ( R _ { \mathrm { m a x } } - R _ { \mathrm { m i n } } ) ^ { - 1 } = 1 / 4$ is the normalization for MF/NMF/SVD++. For KMs/NNMs the same metric reduces to ${ \mathrm { N R M S E } } =$ $\begin{array} { r } { \left( \sum _ { ( u , i ) \in \bar { \mathcal { K } } } | [ \boldsymbol { R } ] _ { ( u , i ) } / R _ { \operatorname* { m a x } } - \hat { \theta } _ { u } ^ { T } \hat { \psi } _ { i } | ^ { 2 } / | \bar { \mathcal { K } } | \right) ^ { 1 / 2 } } \end{array}$ . The best values for $\lambda _ { u }$ and $\mu _ { i }$ , were picked from a coarse two-dimensional grid by cross-validation, using a held-out validation set. The Normalized RMSE results are shown in Table 4. We observe a significant gap between KMs, and well known collaborative filtering methods, especially as $D$ increases. Moreover, the drop in performance for NNMs for increasing $D$ may be due to over-fitting.
Asymptotic optimality of SDR for $\psi$ -step solution: Table 5 is a numerical validation of Proposition 4 where we computed the error rate of SDR (compared to the exhaustive search), aggregated over all iterations. We observe that the approximation error decreases, with increasing $D$ (following Proposition 4).
Table 4: Normalized Test RMSE (Setting 2). The dimension of factorization for $\mathbf { M F / S V D + + }$ , $k$ , is equal to $D$ (unless stated in the corresponding entry). The normalized test RMSE for all other methods are taken from the following repository: http://www.mymedialite.net/examples/datasets.html ( $\cdot _ { - } ,$ indicates the unavailability of the correspond test RMSE from the repository.
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>D=4</td><td rowspan=1 colspan=1>D=8</td><td rowspan=1 colspan=1>D=16</td><td rowspan=1 colspan=1>D=24</td></tr><tr><td rowspan=2 colspan=1>KMNNMMFSVD++K-MNMF</td><td rowspan=1 colspan=1>0.199</td><td rowspan=1 colspan=1>0.2013</td><td rowspan=1 colspan=1>0.1900</td><td rowspan=2 colspan=1>0.18610.21180.226(k = 40)0.226(k = 50)0.21050.192(k = 100)</td></tr><tr><td rowspan=1 colspan=1>0.1940.2290.2280.210一</td><td rowspan=1 colspan=1>0.22550.228(k = 10)0.227(k = 10).2096</td><td rowspan=1 colspan=1>0.20570.227(k = 20)0.2105</td></tr></table>
Table 5: Error rate for SDR (Artificial Dataset, $U = 2 0 , I = 4 0 )$ .
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>D=4</td><td rowspan=1 colspan=1>D=8</td><td rowspan=1 colspan=1>D=10</td></tr><tr><td rowspan=1 colspan=1>SDR Accuracy ×10-3</td><td rowspan=1 colspan=1>7.5</td><td rowspan=1 colspan=1>4.4</td><td rowspan=1 colspan=1>4.0</td></tr></table>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358# AUTOMATA GUIDED HIERARCHICAL REINFORCEMENT LEARNING FOR ZERO-SHOT SKILL COMPOSITION
Anonymous authors Paper under double-blind review
# ABSTRACT
An obstacle that prevents the wide adoption of (deep) reinforcement learning (RL) in control systems is its need for a large number of interactions with the environment in order to master a skill. The learned skill usually generalizes poorly across domains and re-training is often necessary when presented with a new task. We present a framework that combines techniques in formal methods with hierarchical reinforcement learning (HRL). The set of techniques we provide allows for the convenient specification of tasks with logical expressions, learns hierarchical policies (meta-controller and low-level controllers) with well-defined intrinsic rewards using any RL methods and is able to construct new skills from existing ones without additional learning. We evaluate the proposed methods in a simple grid world simulation as well as simulation on a Baxter robot.
# 1 INTRODUCTION
Reinforcement learning has received much attention in the recent years because of its achievements in games Mnih et al. (2015), Silver et al. (2016), robotics manipulation Jang et al., Levine et al. (2016), Gu et al. (2016) and autonomous driving Isele et al. (2017), Madrigal (2017). However, training a policy that sufficiently masters a skill requires an enormous amount of interactions with the environment and acquiring such experience can be difficult on physical systems. Moreover, most learned policies are tailored to mastering one skill (by maximizing the reward) and are hardly reusable on a new skill.
Skill composition is the idea of constructing new skills out of existing skills (and hence their policies) with little to no additional learning. In stochastic optimal control, this idea has been adopted by authors of Todorov (2009) and Da Silva et al. (2009) to construct provably optimal control laws based on linearly solvable Markov decision processes. Authors of Haarnoja et al. (2017), Tang & Haarnoja have showed in simulated manipulation tasks that approximately optimal policies can result from adding the Q-functions of the existing policies.
Hierarchical reinforcement learning is an effective means of achieving transfer among tasks. The goal is to obtain task-invariant low-level policies, and by re-training the meta-policy that schedules over the low-level policies, different skills can be obtain with less samples than training from scratch. Authors of Heess et al. (2016) have adopted this idea in learning locomotor controllers and have shown successful transfer among simulated locomotion tasks. Authors of Oh et al. (2017) have utilized a deep hierarchical architecture for multi-task learning using natural language instructions.
Temporal logic is a formal language commonly used in software and digital circuit verification Baier & Katoen (2008) as well as formal synthesis Belta et al. (2017). It allows for convenient expression of complex behaviors and causal relationships. TL has been used by Sadraddini & Belta (2015), Leahy et al. (2015) to synthesize provably correct control policies. Authors of Aksaray et al. (2016) have also combined TL with Q-learning to learn satisfiable policies in discrete state and action spaces.
In this work, we focus on hierarchical skill acquisition and zero-shot skill composition. Once a set of skills is acquired, we provide a technique that can synthesize new skills without the need to further interact with the environment (given the state and action spaces as well as the transition remain the same). We adopt temporal logic as the task specification language. Compared to most heuristic reward structures used in the RL literature to specify tasks, formal specification language excels at its semantic rigor and interpretability of specified behaviors. Our main contributions are:
• We take advantage of the transformation between TL formula and finite state automata (FSA) to construct deterministic meta-controllers directly from the task specification without the necessity for additional learning. We show that by adding one discrete dimension to the original state space, structurally simple parameterized policies such as feed-forward neural networks can be used to learn tasks that require complex temporal reasoning. Intrinsic motivation has been shown to help RL agents learn complicated behaviors with less interactions with the environment Singh et al. (2004), Kulkarni et al. (2016), Jaderberg et al. (2016). However, designing a well-behaved intrinsic reward that aligns with the extrinsic reward takes effort and experience. In our work, we construct intrinsic rewards directly from the input alphabets of the FSA (a component of the automaton), which guarantees that maximizing each intrinsic reward makes positive progress towards satisfying the entire task specification. From a user’s perspective, the intrinsic rewards are constructed automatically from the TL formula. • In our framework, each FSA represents a hierarchical policy with low-level controllers that can be re-modulated to achieve different tasks. Skill composition is achieved by manipulating the FSA that results from their TL specifications in a deterministic fashion. Instead of interpolating/extrapolating among existing skills, we present a simple policy switching scheme based on graph manipulation of the FSA. Therefore, the compositional outcome is much more transparent. We introduce a method that allows learning of such hierarchical policies with any non-hierarchical RL algorithm. Compared with previous work on skill composition, we impose no constraints on the policy representation or the problem class.
# 2 PRELIMINARIES
2.1 THE OPTIONS FRAMEWORK IN HIERARCHICAL REINFORCEMENT LEARNING
In this section, we briefly introduce the options framework Sutton et al. (1998), especially the terminologies that we will inherit in later sections. We start with the definition of a Markov Decision Process.
Definition 1. An MDP is defined as a tuple $\mathcal { M } = \langle S , A , p ( \cdot | \cdot , \cdot ) , R ( \cdot , \cdot , \cdot ) \rangle$ , where $S \subseteq \mathbb { R } ^ { n }$ is the state space ; $A \subseteq \mathbb { R } ^ { m }$ is the action space ( $S$ and $A$ can also be discrete sets); $p : S \times A \times S [ 0 , 1 ]$ is the transition function with $p ( s ^ { \prime } | s , a )$ being the conditional probability density of taking action $a \in A$ at state $s \in S$ and ending up in state $s ^ { \prime } \in S$ ; $R : S \times A \times S \mathbb { R }$ is the reward function. let $T$ be the length of a fixed time horizon. The goal is to find a policy $\pi ^ { \star } : S A ( o r \pi ^ { \star } : S \times A [ 0 , 1 ]$ for stochastic policies) that maximizes the expected return, i.e.
$$\pi ^ { \star } = \arg \operatorname* { m a x } _ { \pi } \mathbb { E } ^ { \pi } [ R ( \tau _ { T } ) ]$$
where $\tau _ { T } = ( s _ { 0 } , a _ { 0 } , . . . , s _ { T } , )$ denotes the state-action trajectory from time 0 to $T$
The options framework exploits temporal abstractions over the action space. An option is defined as a tuple $o = \langle \mathcal { Z } , \pi ^ { o } , \beta \rangle$ where $\mathcal { T }$ is the set of states that option $o$ can be initiated (here we let ${ \mathcal { T } } = S$ for all options), $\pi ^ { o } : S A$ is an options policy and $\beta : S [ 0 , 1 ] .$ is the termination probability for the option at state $s$ . In addition, there is a policy over options $\bar { \pi ^ { h } } : S O$ (where $O$ is a set of available options) that schedules among options. At a given time step $t$ , an option $o$ is chosen according to $\pi ^ { h } \dot { ( } s _ { t } )$ and the options policy $\pi ^ { o }$ is followed until the termination probability $\beta ( s ) >$ threshold at time $t + k$ , and the next option is chosen by $\pi ^ { h } ( s _ { t + k } )$ .
We consider tasks specified with Truncated Linear Temporal Logic (TLTL). We restrict the set of allowed operators to be
$$\begin{array} { r } { \phi : = \top \mid f ( s ) < c \mid \neg \phi \mid \phi \land \psi \mid \phi \lor \psi \mid } \\ { \big \langle \phi \mid \phi \mid \phi \mathcal { U } \psi \mid \phi \mathcal { T } \psi \mid \big \langle \phi \phi \mid \phi \Rightarrow \psi } \end{array}$$
where $f ( s ) < c$ is a predicate, $\neg$ (negation/not), $\wedge$ (conjunction/and), and $\vee$ (disjunction/or) are Boolean connectives, and $\diamondsuit$ (eventually), $\mathcal { U }$ (until), $\tau$ (then), $\bigcirc$ (next), are temporal operators. Implication is denoted by $\Rightarrow$ (implication). Essentially we excluded the Always operator $( \sqsubseteq )$ with reasons similar to Kupferman $\&$ Vardi (2001). We refer to this restricted TLTL as syntactically co-safe TLTL (scTLTL) (Vasile et al. (2017) used similar idea for LTL). There exists a real-value function $\rho ( s _ { 0 : T } , \phi )$ called robustness degree that measures the level of satisfaction of trajectory $s _ { 0 : T }$ with respective to $\phi$ . $\rho ( s _ { 0 : T } , \phi ) > 0$ indicates that $s _ { 0 : T }$ satisfies $\phi$ and vice versa. Definitions for the boolean semantics and robustness degree are provided in Appendix E.
Any scTLTL formula can be translated into a finite state automata (FSA) with the following definition:
Definition 2. An FSA is defined as a tuple $\mathcal { A } _ { \phi } = \langle Q _ { \phi } , \Psi _ { \phi } , q ^ { 0 } , p _ { \phi } ( \cdot | \cdot ) , \mathcal { F } _ { \phi } \rangle$ , where $Q _ { \phi }$ is a set of automaton states; $\Psi _ { \phi }$ is an input alphabet, we denote $\psi _ { q _ { i } , q _ { j } } \in \Psi _ { \phi }$ the predicate guarding the transition from $q _ { i }$ to $q _ { j }$ (as illustrated in Figure $I$ ); $q ^ { 0 } \in Q _ { \phi }$ is the initial state; $p _ { \phi } : Q _ { \phi } \times Q _ { \phi } $ $[ 0 , 1 ]$ is a conditional probability defined as
$$p _ { \phi } ( q _ { j } | q _ { i } ) = \left\{ \begin{array} { l l } { 1 } & { \psi _ { q _ { i } , q _ { j } } \ i s \ t r u e } \\ { 0 } & { o t h e r w i s e . } \end{array} \right.$$
In addition, given an MDP state $s$ , we can calculate the transition in automata states at $s$ by
$$p _ { \phi } ( q _ { j } | q _ { i } , s ) = \left\{ \begin{array} { r l } { 1 } & { { } \rho ( s , \psi _ { q _ { i } , q _ { j } } ) > 0 } \\ { 0 } & { { } o t h e r w i s e . } \end{array} \right.$$
We abuse the notation $p _ { \phi }$ to represent both kinds of transitions when the context is clear. $\mathcal { F } _ { \phi }$ is a set of final automaton states.
The translation from TLTL formula to FSA to can be done automatically with available packages like Lomap Ulusoy (2017).
Example 1. Figure $^ { l }$ (left) illustrates the FSA resulting from formula $\phi = \lnot b u \scriptscriptstyle ($ a. In English, $\phi$ entails during a run, $b$ cannot be true until $a$ is true and a needs to be true at least once. The FSA has three automaton states $Q _ { \phi } = \{ q _ { 0 } , q _ { f } , t r a p \}$ with $q _ { 0 }$ being the input(initial) state (here $q _ { i }$ serves to track the progress in satisfying $\phi$ ). The input alphabet is defined as the $\Psi _ { \phi } = \{ \neg a \land \neg b , \neg a \land$ $b , a \land \lnot b , a \land b \}$ . Shorthands are used in the figure, for example $a = ( a \wedge b ) \vee ( a \wedge \neg b )$ . $\Psi _ { \phi }$ represents the power set of $\{ a , b \}$ , i.e. $\Psi _ { \phi } = 2 ^ { \{ a , b \} }$ . During execution, the FSA always starts from state $q _ { 0 }$ and transitions according to Equation (3) or (4). The specification is satisfied when $q _ { f }$ is reached and violated when trap is reached. In this example, $q _ { f }$ is reached only when a becomes true before $b$ becomes true.
# 3 PROBLEM FORMULATION AND APPROACH
We start with the following problem definition:
Problem 1. Given an MDP in Definition $^ { l }$ with unknown transition dynamics $p ( s ^ { \prime } | s , a )$ and $a$ scTLTL specification $\phi$ over state predicates (along with its FSA $\mathcal { A } _ { \phi }$ ) as in Definition 2. Find $a$ policy $\pi _ { \phi } ^ { \star }$ such that
$$\pi _ { \phi } ^ { \star } = \underset { \pi _ { \phi } } { \arg \operatorname* { m a x } } \mathbb { E } ^ { \pi _ { \phi } } \big [ \mathbb { 1 } \big ( \rho \big ( s _ { 0 : T } , \phi \big ) > 0 \big ) \big ] .$$
where $\mathbb { 1 } ( \rho ( s _ { 0 : T } , \phi ) > 0 )$ is an indicator function with value 1 if $\rho ( s _ { 0 : T } , \phi ) > 0$ and 0 otherwise.
Problem 1 defines a policy search problem where the trajectories resulting from following the optimal policy should satisfy the given scTLTL formula in expectation.
Problem 2. Given two scTLTL formula $\phi _ { 1 }$ and $\phi _ { 2 }$ along with policy $\pi _ { \phi _ { 1 } }$ that satisfies $\phi _ { 1 }$ and $\pi _ { \phi _ { 2 } }$ that satisfies $\phi _ { 2 }$ . Obtain a policy $\pi _ { \phi }$ that satisfies $\phi = \phi _ { 1 } \wedge \phi _ { 2 }$ .
Problem 2 defines the problem of task composition. Given two policies each satisfying a scTLTL specification, construct the policy that satisfies the conjunction of the given specifications. Solving this problem is useful when we want to break a complex task into simple and manageable components, learn a policy that satisfies each component and ”stitch” all the components together so that the original task is satisfied. It can also be the case that as the scope of the task grows with time, the original task specification is amended with new items. Instead of having to re-learn the task from scratch, we can only learn a policy that satisfies the new items and combine them with the old policy.
We propose to solve Problem 1 by constructing a product MDP from the given MDP and FSA that can be solved using any state-of-the-art RL algorithm. The idea of using product automaton for control synthesis has been adopted in various literature Leahy et al. (2015), Chen et al. (2012). However, the methods proposed in these works are restricted to discrete state and actions spaces. We extend this idea to continuous state-action spaces and show its applicability on robotics systems.
For Problem 2, we propose a policy switching scheme that satisfies the compositional task specification. The switching policy takes advantage of the characteristics of FSA and uses robustness comparison at each step for decision making.
# 4 FSA AUGMENTED MDP
Problem 1 can be solved with any episode-based RL algorithm. However, doing so the agent suffers from sparse feedback because a reward signal can only be obtained at the end of each episode. To address this problem as well as setting up ground for automata guided HRL, we introduce the FSA augmented MDP
Definition 3. An FSA augmented MDP corresponding to scTLTL formula $\phi$ is defined as $\mathcal { M } _ { \phi } =$ $\langle \tilde { S } , A , \tilde { p } ( \cdot | \cdot , \cdot ) , \tilde { R } ( \cdot , \cdot ) \rangle$ where ${ \tilde { S } } \subseteq S \times Q _ { \phi }$ , $A$ is the same as the original MDP. $\tilde { p } ( \tilde { s } ^ { \prime } | \tilde { s } , a )$ is the probability of transitioning to $\widetilde { s } ^ { \prime }$ given s˜ and $a$ , in particular
$$\begin{array} { r l } & { \tilde { p } ( \tilde { s } ^ { \prime } | \tilde { s } , a ) = p \big ( ( s ^ { \prime } , q ^ { \prime } ) | ( s , q ) , a \big ) } \\ & { = \left\{ \begin{array} { l l } { p ( s ^ { \prime } | s , a ) } & { p _ { \phi } ( q ^ { \prime } | q , s ) = 1 } \\ { 0 } & { o t h e r w i s e . } \end{array} \right. } \end{array}$$
Here $p _ { \phi }$ is defined in Equation (4). $\tilde { R } : \tilde { S } \times \tilde { S } \mathbb { R }$ is the FSA augmented reward function, defined by
$$\tilde { R } ( \tilde { s } , \tilde { s } ^ { \prime } ) = \mathbb { 1 } \big ( \rho ( s ^ { \prime } , \mathrm { D } _ { \phi } ^ { q } ) > 0 \big ) ^ { 1 }$$
where $\Omega _ { q }$ is the set of automata states that are connected with $q$ through outgoing edges. $D _ { \phi } ^ { q } =$ $\mathsf { V } _ { q ^ { \prime } \in \Omega _ { q } } \psi _ { q , q ^ { \prime } }$ represents the disjunction of all predicates guarding the transitions that originate from $q$ . The goal is to find the optimal policy that maximizes the expected sum of discounted return, i.e.
$$\pi ^ { \star } = \arg \operatorname* { m a x } _ { \pi } \mathbb { E } ^ { \pi } \left[ \sum _ { t = 0 } ^ { T - 1 } \gamma ^ { t + 1 } \tilde { R } ( s _ { t } , s _ { t + 1 } ) \right] ,$$
where $\gamma < 1$ is the discount factor, $T$ is the time horizon.
As a quick example to the notation $D _ { \phi } ^ { q }$ , consider the state $q _ { 0 }$ in the FSA in Figure 1 , $\Omega _ { q _ { 0 } } \ =$ $\{ t r a p , q _ { f } \}$ , $D _ { \phi } ^ { q _ { 0 } } = \psi _ { q _ { 0 } , t r a p } \vee \psi _ { q _ { 0 } , q f } = b \vee a$ . The goal is then to find a policy $\pi : { \tilde { S } } A$ that maximizes the expected sum of $\tilde { R }$ over the horizon $T$ .
 Figure 1 : FSA constructed from $\phi = \neg b \ : \mathcal { U } \ : a$ . (right): Specification amendment example. $\mathcal { A } _ { \phi _ { 1 } }$ is constructed from $\phi _ { 1 } = \diamondsuit a \diamond \diamond b$ . $\mathcal { A } _ { \phi _ { 2 } }$ is constructed from $\phi _ { 2 } ~ = ~ \neg b \mathcal { U } a$ . $\mathcal { A } _ { \phi }$ is constructed from $\phi = \phi _ { 1 } \wedge \phi _ { 2 }$ . The automaton state pair in parenthesis denote the corresponding states from $Q _ { \phi _ { 1 } }$ and $Q _ { \phi _ { 2 } }$ that the product state is constructed from. $q _ { i } ^ { 0 }$ denotes the initial state of $\mathcal { A } _ { \phi _ { i } }$ , $q _ { i , j }$ denotes the $j ^ { t h }$ state of $Q _ { \phi _ { i } }$ .
The FSA augmented MDP can be constructed with any standard MDP and a scTLTL formula. And it can be solved with any off-the-shelf RL algorithm. By directly learning the flat policy $\pi$ we bypass the need to learn multiple options policies separately. After obtaining the optimal policy $\pi ^ { \star }$ , the optimal options policy for any option $o _ { q } \mathrm { c a n }$ be extracted by executing $\pi ^ { \star } ( a | s , q )$ without transitioning the automata state, i.e. keeping $q _ { i }$ fixed (denoted $\pi _ { q } ^ { \star }$ ). And $\pi _ { q } ^ { \star }$ satisfies
$$\pi _ { q _ { i } } ^ { \star } = \underset { \pi _ { q _ { i } } } { \arg \operatorname* { m a x } } \mathbb { E } ^ { \pi _ { q _ { 1 } } } \left[ \sum _ { t = 0 } ^ { T - 1 } \gamma ^ { t + 1 } \mathbb { 1 } \left( \rho ( s _ { t + 1 } , D _ { \phi } ^ { q _ { i } } ) > 0 \right) \right] .$$
In other words, the purpose of $\pi _ { q _ { i } }$ is to activate one of the outgoing edges of $q _ { i }$ as soon as possible and by doing so repeatedly eventually reach $q _ { f }$ .
The reward function in Equation (7) encourages the system to exit the current automata state and move on to the next, and by doing so eventually reach the final state $q _ { f }$ . However, this reward does not distinguish between the trap state and other states and therefore will also promote entering of the trap state. One way to address this issue is to impose a terminal reward on both $q _ { f }$ and trap. Because the reward is an indicator function with maximum value of 1, we assign terminal rewards $R _ { q _ { f } } = 2$ and $R _ { t r a p } = - 2$ .
Appendix D describes the typical learning routine using FSA augmented MDP. The algorithm utilizes memory replay which is popular among off-policy RL methods (DQN, A3C, etc) but this is not a requirement for learning with $\tilde { M } _ { \phi }$ . On-policy methods can also be used.
# 5 AUTOMATA GUIDED TASK COMPOSITION
In section, we provide a solution for Problem 2 by constructing the FSA of $\phi$ from that of $\phi _ { 1 }$ and $\phi _ { 2 }$ and using $\phi$ to synthesize the policy for the combined skill. We start with the following definition.
Definition 4. Given $\begin{array} { c c l } { A _ { \phi _ { 1 } } } & { = } & { \langle Q _ { \phi _ { 1 } } , \Psi _ { \phi _ { 1 } } , q _ { 1 } ^ { 0 } , p _ { \phi _ { 1 } } , \mathcal { F } _ { \phi _ { 1 } } \rangle } \end{array}$ and $\begin{array} { c c l } { { A _ { \phi _ { 2 } } } } & { { = } } & { { \langle Q _ { \phi _ { 2 } } , \Psi _ { \phi _ { 2 } } , q _ { 2 } ^ { 0 } , p _ { \phi _ { 2 } } , { \mathcal F } _ { \phi _ { 2 } } \rangle } } \end{array}$ , The FSA of $\phi$ is the product automaton of $\mathcal { A } _ { \phi _ { 1 } }$ and $\mathcal { A } _ { \phi _ { 1 } }$ , i.e. ${ \mathcal A } _ { \phi = \phi _ { 1 } \wedge \phi _ { 2 } } \ = \ { \mathcal A } _ { \phi _ { 1 } } \times { \mathcal A } _ { \phi _ { 2 } } \ =$ $\langle Q _ { \phi } , \Psi _ { \phi } , q ^ { 0 } , p _ { \phi } , \mathcal { F } _ { \phi } \rangle$ where $Q _ { \phi } \subseteq Q _ { \phi _ { 1 } } \times Q _ { \phi _ { 2 } }$ is the set of product automaton, states, $q ^ { 0 } = ( q _ { 1 } ^ { 0 } , q _ { 2 } ^ { 0 } )$ is the product initial state, $\mathcal { F } \subseteq \mathcal { F } _ { \phi _ { 1 } } \cap \mathcal { F } _ { \phi _ { 2 } }$ is the final accepting states. Following Definition 2, for states $q = ( q _ { 1 } , q _ { 2 } ) \in Q _ { \phi }$ and $q ^ { \prime } = ( q _ { 1 } ^ { \prime } , q _ { 2 } ^ { \prime } ) \in Q _ { \phi }$ , the transition probability $p _ { \phi }$ is defined as
$$p _ { \phi } ( q ^ { \prime } | q ) = \left\{ \begin{array} { r l } { 1 } & { p _ { \phi _ { 1 } } ( q _ { 1 } ^ { \prime } | q _ { 1 } ) p _ { \phi _ { 2 } } ( q _ { 2 } ^ { \prime } | q _ { 2 } ) = 1 } \\ { 0 } & { o t h e r w i s e . } \end{array} \right.$$
Example 2. Figure $^ { l }$ (right) illustrates the FSA of $\mathcal { A } _ { \phi _ { 1 } }$ and $\mathcal { A } _ { \phi _ { 2 } }$ and their product automaton $\mathcal { A } _ { \phi }$ . Here $\phi _ { 1 } = \diamondsuit a \land \diamondsuit b$ which entails that both a and $b$ needs to be true at least once (order does not matter), and $\phi _ { 2 } = \neg b \ : \mathcal { U }$ a which is the same as Example $^ { l }$ . The resultant product corresponds to the formula $\phi = ( \diamondsuit a \land \diamondsuit b ) \land ( \neg b \varkappa a )$ which dictates that a and $b$ need to be true at least once, and a needs to be true before $b$ becomes true (an ordered visit). We can see that the trap state occurs in $\mathcal { A } _ { \phi _ { 2 } }$ and $\mathcal { A } _ { \phi }$ , this is because if $b$ is ever true before $a$ is true, the specification is violated and $q _ { f }$ can never be reached. In the product automaton, we aggregate all state pairs with a trap state component into one trap state.
For $q = ( q _ { 1 } , q _ { 2 } ) \in Q _ { \phi }$ , let $\Psi _ { q }$ , $\Psi _ { q 1 }$ and $\Psi _ { q _ { 2 } }$ denote the set of predicates guarding the outgoing edges of $q , q _ { 1 }$ and $q _ { 2 }$ respectively. Equation (10) entails that a transition at $q$ in the product automaton $\mathcal { A } _ { \phi }$ exists only if corresponding transitions at $q _ { 1 }$ , $q _ { \mathrm { 2 } } \mathrm { e x i s t }$ in $\mathcal { A } _ { \phi _ { 1 } }$ and $\mathcal { A } _ { \phi _ { 2 } }$ respectively. Therefore, $\psi _ { q , q ^ { \prime } } = \psi _ { q _ { 1 } , q _ { 1 } ^ { \prime } } \wedge \psi _ { q _ { 2 } , q _ { 2 } ^ { \prime } }$ , for $\psi _ { q , q ^ { \prime } } \in \Psi _ { q } , \psi _ { q _ { 1 } , q _ { 1 } ^ { \prime } } \in \Psi _ { q _ { 1 } } , \psi _ { q _ { 2 } , q _ { 2 } ^ { \prime } } \in \Psi _ { q _ { 2 } }$ (here $q _ { i } ^ { \prime }$ is a state such that $p _ { \phi _ { i } } ( q _ { i } ^ { \prime } | q _ { i } ) = \bar { 1 } \bar { \mathrm { ~ } }$ ). Following Equation (9),
$$\pi _ { q } ^ { \star } = \underset { \pi _ { q } } { \arg \operatorname* { m a x } } \mathbb { E } ^ { \pi _ { q } } \big [ \sum _ { t = 0 } ^ { T - 1 } \gamma ^ { t + 1 } \mathbb { 1 } \big ( \rho ( s _ { t + 1 } , D _ { \phi } ^ { q } ) > 0 \big ) \big ] ,$$
Repeatedly applying the distributive law $\left( \Delta \wedge \Omega _ { 1 } \right) \vee \left( \Delta \wedge \Omega _ { 2 } \right) = \Delta \wedge \left( \Omega _ { 1 } \vee \Omega _ { 2 } \right)$ to the logic formula $D _ { \phi } ^ { q }$ transforms the formula to
$$D _ { \phi } ^ { q } = \big ( \bigvee _ { q _ { 1 } ^ { \prime } } { \psi _ { q _ { 1 } , q _ { 1 } ^ { \prime } } } \big ) \wedge \big ( \bigvee _ { q _ { 2 } ^ { \prime } } { \psi _ { q _ { 2 } , q _ { 2 } ^ { \prime } } } \big ) = D _ { \phi _ { 1 } } ^ { q _ { 1 } } \wedge D _ { \phi _ { 2 } } ^ { q _ { 2 } } .$$
Therefore,
$$\begin{array} { r l } & { \pi _ { q } ^ { \star } = \underset { \pi _ { q } } { \arg \operatorname* { m a x } } \mathbb { E } ^ { \pi _ { q } } \big [ \displaystyle \sum _ { t = 0 } ^ { T - 1 } \gamma ^ { t + 1 } \mathbb { 1 } \big ( \rho ( s _ { t + 1 } , D _ { \phi _ { 1 } } ^ { q _ { 1 } } \wedge D _ { \phi _ { 2 } } ^ { q _ { 2 } } ) > 0 \big ) \big ) \big ] } \\ & { \quad = \underset { \pi _ { q } } { \arg \operatorname* { m a x } } \mathbb { E } ^ { \pi _ { q } } \big [ \displaystyle \sum _ { t = 0 } ^ { T - 1 } \gamma ^ { t + 1 } \mathbb { 1 } \big ( \operatorname* { m i n } ( \rho ( s _ { t + 1 } , D _ { \phi _ { 1 } } ^ { q _ { 1 } } ) , \rho ( s _ { t + 1 } , D _ { \phi _ { 2 } } ^ { q _ { 2 } } ) ) > 0 \big ) \big ) \big ] } \end{array}$$
The second step in Equation (13) follows the robustness definition. Recall that the optimal options policies for $q _ { 1 }$ and $q _ { 2 }$ satisfy
$$\pi _ { q _ { i } } ^ { \star } = \underset { \pi _ { q _ { i } } } { \arg \operatorname* { m a x } } \mathbb { E } ^ { \pi _ { \phi _ { i } } } \big [ \sum _ { t = 0 } ^ { T - 1 } \gamma ^ { t + 1 } \mathbb { 1 } \left( \rho ( s _ { t + 1 } , D _ { \phi _ { i } } ^ { q _ { i } } ) > 0 ) \right) \big ] , i = 1 , 2 .$$
Equation (13) provides a relationship among $\pi _ { q _ { . } } ^ { \star }$ , $\pi _ { q 1 } ^ { \star }$ and $\pi _ { q _ { 2 } } ^ { \star }$ . Given this relationship, We propose a simple switching policy based on stepwise robustness comparison that satisfies $\phi = \phi _ { 1 } \wedge \phi _ { 2 }$ as follows
$$\pi _ { \phi } ( s , q ) = \left\{ \begin{array} { l l } { { \pi _ { \phi _ { 1 } } ( s , q _ { 1 } ) } } & { { \rho ( s _ { t } , D _ { \phi _ { 1 } } ^ { q _ { 1 } } ) < \rho ( s _ { t } , D _ { \phi _ { 2 } } ^ { q _ { 2 } } ) } } \\ { { \pi _ { \phi _ { 2 } } ( s , q _ { 2 } ) } } & { { o t h e r w i s e } } \end{array} \right.$$
We show empirically the use of this switching policy for skill composition and discuss its limitations in the following sections.
# 6 EXPERIMENTS AND DISCUSSION
# 6.1 GRID WORLD SIMULATION
In this section, we provide a simple grid world navigation example to illustrate the techniques presented in Sections 4 and 5. Here we have a robot navigating in a discrete 1 dimensional space. Its
 Figure $\mathbf { \mathfrak { z } } :$ upper left: Optimal policy for $\phi _ { 1 } = \diamondsuit a \land \diamondsuit b$ trained using Q-Learning. The arrows represent the action at each state and the dot represents stay still at that state. (upper right): Optimal policy for $\phi _ { 2 } = \lnot b \ u \ a$ . (lower left):Optimal policy for $\bar { \phi } = ( \diamondsuit a \land \diamondsuit b ) \land ( \neg b \varkappa a )$ . (lower right ): Robustness comparison used for construction of policy $\pi _ { \phi _ { 1 } \wedge \phi _ { 2 } } ^ { \star }$ . The robustness value is zero for states where bars disappear.
MDP state space $S = \{ s | s \in [ - 5 , 5 ) , s$ is discrete}, its action space $A = \{ l e f t , s t a y , r i g h t \}$ . The robot navigates in the commanded direction with probability 0.8, and with probability 0.2 it randomly chooses to go in the opposite direction or stay in the same place. The robot stays in the same place if the action leads it to go out of bounds.
We define two regions $a : - 3 < s < - 1$ and $b : 2 < s < 4$ . For the first task, the scTLTL specification $\phi _ { 1 } = \diamondsuit a \diamond \diamond b$ needs to be satisfied. In English, $\phi _ { 1 }$ entails that the robot needs to visit regions $a$ and $b$ at least once. To learn a deterministic optimal policy $\pi _ { \phi _ { 1 } } ^ { \star } : S \times Q A$ , we use standard Q-Learning Watkins (1989) on the FSA augmented MDP for this problem. We used a learning rate of 0.1, a discount factor of 0.99, epsilon-greedy exploration strategy with $\epsilon$ decaying linearly from 0.0 to 0.01 in 1500 steps. The episode horizon is $T = 5 0$ and trained for 500 iterations. All Q-values are initialized to zero. The resultant optimal policy is illustrated in Figure 2 .
We can observe from the figure above that the policy on each automaton state $q$ serves a specific purpose. $\pi _ { q _ { 0 } } ^ { \star }$ tries to reach region $a$ or $b$ depending on which is closer. $\pi _ { q 1 } ^ { \star }$ always proceeds to region $a$ . $\pi _ { q _ { 2 } } ^ { \star }$ always proceeds to region $b$ . This agrees with the definition in Equation 9. The robot can start anywhere on the $s$ axis but must always start at automata state $q _ { 0 }$ . Following $\pi _ { \phi _ { 1 } }$ , the robot will first reach region $a$ or $b$ (whichever is nearer), and then aim for the other region which in turn satisfies $\phi$ . The states that have stay as their action are either goal regions (states $( - 2 , q _ { 0 } ) , ( 3 , q _ { 1 } )$ , etc) where a transition on $q$ happens or states that are never reached (states $( - 3 , q _ { 1 } ) , ( - 4 , q _ { 2 } )$ , etc) because a transition on $q$ occurs before they can be reached.
To illustrate automata guided task composition described in Example 2, instead of learning the task described by $\phi$ from scratch, we can simply learn policy $\pi _ { \phi _ { 2 } }$ for the added requirement $\phi _ { 2 } = $ $\neg b \ u \ a$ . We use the same learning setup and the resultant optimal policy is depicted in Figure 4 . It can be observed that $\pi _ { \phi _ { 2 } }$ tries to reach $a$ while avoiding $b$ . This behavior agrees with the specification $\phi _ { 2 }$ and its FSA provided in Figure 2 . The action at $s = 4$ is stay because in order for the robot to reach $a$ it has to pass through $b$ , therefore it prefers to obtain a low reward over violating the task.
Having learned policies $\pi _ { \phi _ { 1 } }$ and $\pi _ { \phi _ { 2 } }$ , we can now use Equation 15 to construct policy $\pi _ { \phi _ { 1 } \wedge \phi _ { 2 } }$ . The resulting policy for $\pi _ { \phi _ { 1 } \wedge \phi _ { 2 } }$ is illustrated in Figure 2 (upper right). This policy guides the robot to first reach $a$ (except for state $s = 4$ ) and then go to $b$ which agrees with the specification.
Looking at Figure 1 , the FSA of $\phi = \phi _ { 1 } \wedge \phi _ { 2 }$ have two options policies $\pi _ { \phi } ( \cdot , q _ { 0 } )$ and $\pi _ { \phi } \big ( \cdot , q _ { 1 } \big ) ^ { 2 } ( t r a p$ state and $q _ { f }$ are terminal states which don’t have options). State $q _ { 1 }$ has only one outgoing edge with the guarding predicate $\psi _ { q _ { 1 } , q _ { f } } : b$ , which means $\pi _ { \phi } ( \cdot , q _ { 1 } ) = \pi _ { \phi _ { 1 } } ( \cdot , q _ { 2 } )$ (they have the same guarding predicate). Policy $\pi _ { \phi } ( \cdot , q _ { 0 } )$ is a switching policy between $\pi _ { \phi _ { 1 } } ( \cdot , q _ { 0 } )$ and $\pi _ { \phi _ { 2 } } ( \cdot , q _ { 0 } )$ . Figure 2 (lower left) shows the robustness comparison at each state. The policy with lower robustness is chosen following Equation (15). We can see that the robustness of both policies are the same from $s = - 5$ to $s = 0$ . And their policies agree in this range (Figures 3 and 4 ). As $s$ becomes larger, disagreement emerge because $\pi _ { \phi _ { 1 } } ( \cdot , q _ { 0 } )$ wants to stay closer to $b$ but $\pi _ { \phi _ { 2 } } ( \cdot , q _ { 0 } )$ wants otherwise. To maximize the robustness of their conjunction, the decisions of $\pi _ { \phi _ { 2 } } ( \cdot , q _ { 0 } )$ are chosen for states $s > 0$ .
 Figure $\ 3 : \ ( l e f t )$ : Baxter simulation Environment with three square regions (black,red, blue), two circular regions (red, blue), two boxes (red, blue) that the robot can manipulate and an interactive ball that the user can place anywhere on the table. Tasks are specified using these elements in Appendix A. (upper right): Learning curve for task $\phi _ { 1 }$ over 5 random seeds. (lower right): Policy deployment success rate
# 6.2 SIMULATED BAXTER
In this section, we construct a set of more complicated tasks that require temporal reasoning and evaluate the proposed techniques on a simulated Baxter robot. The environment is shown in Figure 3 (left). In front of the robot are three square regions and two circular regions. An object with planar coordinates $p = ( x , y )$ can use predicates $S _ { r e d } ( p ) , S _ { b l u e } ( p ) , S _ { b l a c k } ( p )$ , $\mathcal { C } _ { r e d } ( p ) , \mathcal { C } _ { b l u e } ( p )$ to evaluate whether or not it is within the each region. The predicates are defined by $S : ( x _ { m i n } < x < x _ { m a x } ) \wedge$ $( y _ { m i n } < y < y _ { m a x } )$ and $\mathcal { C } : d i s t ( ( x , y ) , ( x , y ) _ { c e n t e r } ) < r$ . $( x _ { m i n } , y _ { m i n } )$ and $( x _ { m a x } , y _ { m a x } )$ are the boundary coordinates of the square region, $( x , y ) _ { c e n t e r }$ and $r$ are the center and radius of the circular region. There are also two boxes which planar positions are denoted as $p _ { r e d b o x } = ( x , y ) _ { r e d b o x }$ and $p _ { b l u e b o x } = ( x , y ) _ { b l u e b o x }$ . And lastly there is an interactive ball that a user can move in space which 2D coordinate is denoted as $p _ { s p h e r e } = ( x , y ) _ { s p h e r e }$ (all objects move in the table plane).
We design seven tasks each specified by a scTLTL formula. The task specifications and their English translations are provided in Appendix A. Throughout the experiments in this section, we use proximal policy search Schulman et al. (2017) as the policy optimization method. The hyperparameters are kept fixed across the experiments and are listed in Appendix B. The policy is a Gaussian distribution parameterized by a feed-forward neural network with 2 hidden layers, each layer has 64 relu units. The state and action spaces vary across tasks and comparison cases, and are described in Appendix C.
We use the first task $\phi _ { 1 }$ to evaluate the learning outcome using the FSA augmented MDP. As comparisons, we design two other rewards structures. The first is to use the robustness $\rho ( s _ { 0 : T } , \phi )$ as the terminal reward for each episode and zero everywhere else, the second is a heuristic reward that aims to align with $\phi _ { 1 }$ . The heuristic reward consists of a state that keeps track of whether the sphere is in a region and a set of quadratic distance functions. For $\phi _ { 1 }$ , the heuristic reward is
$$r _ { \phi _ { 1 } } = \left\{ \begin{array} { l l } { { - d i s t ( p _ { r e d b o x } , p _ { r e d s q u a r e c e n t e r } ) } } & { { p _ { s p h e r e } \mathrm { i s ~ i n ~ r e d ~ c i r c l e } } } \\ { { - d i s t ( p _ { r e d b o x } , P _ { \mathrm { b l a c k ~ s q u a r e ~ c e n t e r } } ) } } & { { \mathrm { o t h e r w i s e } . } } \end{array} \right.$$
Heuristic rewards for other tasks are defined in a similar manner and are not presented explicitly.
 Figure 4 : (left): Learning curves for tasks $\phi _ { 6 }$ and $\phi _ { 7 }$ (task definitions provided in Appendix A). (right): Policy deployment success rate for tasks $\phi _ { 6 }$ and $\phi _ { 7 }$
The results are illustrated in Figure 3 (right). The upper right plot shows the average robustness over training iterations. Robustness is chosen as the comparison metric for its semantic rigor (robustness greater than zero satisfies the task specification). The reported values are averaged over 60 episodes and the plot shows the mean and 2 standard deviations over 5 random seeds. From the plot we can observe that the FSA augmented MDP and the terminal robustness reward performed comparatively in terms of convergence rate, whereas the heuristic reward fails to learn the task. The FSA augmented MDP also learns a policy with lower variance in final performance.
We deploy the learned policy on the robot in simulation and record the task success rate. For each of the three cases, we deploy the 5 policies learned from 5 random seeds on the robot and perform 10 sets of tests with randomly initialized states resulting in 50 test trials for each case. The average success rate is presented in Figure 3 (lower right). From the results we can see that the FSA augmented MDP is able to achieve the highest rate of success and this advantage over the robustness reward is due to the low variance of its final policy.
To evaluate the policy switching technique for skill composition, we first learn four relatively simple policies $\pi _ { \phi _ { 2 } } , \pi _ { \phi _ { 3 } } , \pi _ { \phi _ { 4 } } , \pi _ { \phi _ { 5 } }$ using the FSA augmented MDP. Then we construct $\pi _ { \phi _ { 6 } } = \pi _ { \phi _ { 2 } \wedge \phi _ { 3 } }$ and $\pi _ { \phi _ { 7 } } = \pi _ { \phi _ { 2 } \wedge \phi _ { 3 } \wedge \phi _ { 4 } \wedge \phi _ { 4 } } \mathrm { u s i n g }$ Equation (15) (It is worth mentioning that the policies learned by the robustness and heuristic rewards do not have an automaton state in them, therefore the skill composition technique does not apply). We deploy $\pi _ { \phi _ { 6 } }$ and $\pi _ { \phi _ { 7 } }$ on tasks 6 and 7 for 10 trials and record the average robustness of the resulting trajectories. As comparisons, we also learn tasks 6 and 7 from scratch using terminal robustness rewards and heuristic rewards, the results are presented in Figure 4 . We can observe from the plots that as the complexity of the tasks increase, using the robustness and heuristic rewards fail to learn a policy that satisfies the specifications while the constructed policy can reliably achieve a robustness of greater than zero. We perform the same deployment test as previously described and looking at Figure 4 (right) we can see that for both tasks 6 and 7, only the policies constructed by skill composition are able to consistently complete the tasks.
# 7 CONCLUSION
In this paper, we proposed the FSA augmented MDP, a product MDP that enables effective learning of hierarchical policies using any RL algorithm for tasks specified by scTLTL. We also introduced automata guided skill composition, a technique that combines existing skills to create new skills without additional learning. We show in robotic simulations that using the proposed methods we enable simple policies to perform logically complex tasks.
Limitations of the current framework include discontinuity at the point of switching (for Equation (15)), which makes this method suitable for high level decision tasks but not for low level control tasks. The technique only compares robustness at the current step and chooses to follow a sub-policy for one time-step, making the switching policy short-sighted and may miss long term opportunities. One way to address this is to impose a termination condition for following each subpolicy and terminate only when the condition is triggered (as in the original options framework). This termination condition can be hand designed or learned
# REFERENCES
Derya Aksaray, Austin Jones, Zhaodan Kong, Mac Schwager, and Calin Belta. Q-learning for robust satisfaction of signal temporal logic specifications. In Decision and Control (CDC), 2016 IEEE 55th Conference on, pp. 6565–6570. IEEE, 2016.
Christel Baier and Joost-Pieter Katoen. Principles Of Model Checking, volume 950. 2008.
Calin Belta, Boyan Yordanov, and Ebru Aydin Gol. Formal methods for discrete-time dynamical systems, 2017.
Yushan Chen, Kun Deng, and Calin Belta. Multi-agent persistent monitoring in stochastic environments with temporal logic constraints. In Decision and Control (CDC), 2012 IEEE 51st Annual Conference on, pp. 2801–2806. IEEE, 2012.
Marco Da Silva, Fredo Durand, and Jovan Popovi ´ c. Linear bellman combination for control of ´ character animation. Acm transactions on graphics (tog), 28(3):82, 2009.
Shixiang Gu, Ethan Holly, Timothy Lillicrap, and Sergey Levine. Deep reinforcement learning for robotic manipulation with asynchronous off-policy updates. arXiv preprint arXiv:1610.00633, 2016.
Tuomas Haarnoja, Haoran Tang, Pieter Abbeel, and Sergey Levine. Reinforcement learning with deep energy-based policies. arXiv preprint arXiv:1702.08165, 2017.
Nicolas Heess, Greg Wayne, Yuval Tassa, Timothy Lillicrap, Martin Riedmiller, and David Silver. Learning and transfer of modulated locomotor controllers. arXiv preprint arXiv:1610.05182, 2016.
David Isele, Akansel Cosgun, Kaushik Subramanian, and Kikuo Fujimura. Navigating Intersections with Autonomous Vehicles using Deep Reinforcement Learning. may 2017. URL http:// arxiv.org/abs/1705.01196.
Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. arXiv preprint arXiv:1611.05397, 2016.
Eric Jang, Google Brain, Sudheendra Vijayanarasimhan, Peter Pastor, Julian Ibarz, and Sergey Levine. End-to-End Learning of Semantic Grasping. URL https://arxiv.org/pdf/ 1707.01932.pdf.
Tejas D. Kulkarni, Karthik R. Narasimhan, Ardavan Saeedi, and Joshua B. Tenenbaum. Hierarchical Deep Reinforcement Learning: Integrating Temporal Abstraction and Intrinsic Motivation. 2016. URL http://arxiv.org/abs/1604.06057.
Orna Kupferman and Moshe Y Vardi. Model checking of safety properties. Formal Methods in System Design, 19(3):291–314, 2001.
Kevin Leahy, Austin Jones, Mac Schwager, and Calin Belta. Distributed information gathering policies under temporal logic constraints. In Decision and Control (CDC), 2015 IEEE 54th Annual Conference on, pp. 6803–6808. IEEE, 2015.
Sergey Levine, Peter Pastor, Alex Krizhevsky, and Deirdre Quillen. Learning Hand-Eye Coordination for Robotic Grasping with Deep Learning and Large-Scale Data Collection. arXiv, 2016. doi: 10.1145/2835776.2835844. URL http://arxiv.org/abs/1603.02199v1.
Xiao Li, Cristian-Ioan Vasile, and Calin Belta. Reinforcement learning with temporal logic rewards. arXiv preprint arXiv:1612.03471, 2016.
Alexis C Madrigal. Inside Waymo’s Secret World for Training Self-Driving Cars, 2017. URL https://www.theatlantic.com/technology/archive/2017/08/ inside-waymos-secret-testing-and-simulation-facilities/537648/.
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei a Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015. doi: 10.1038/nature14236.
Junhyuk Oh, Satinder Singh, Honglak Lee, and Pushmeet Kohli. Zero-Shot Task Generalization with Multi-Task Deep Reinforcement Learning. 2017.
Sadra Sadraddini and Calin Belta. Robust Temporal Logic Model Predictive Control. 53rd Annual Conference on Communication, Control, and Computing (Allerton), 2015.
John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy Lillicrap, Madeleine Leach, and Koray Kavukcuoglu. Mastering the game of Go with deep neural networks and tree search. Nature, 529(7585):484–489, 2016. ISSN 0028-0836. doi: 10.1038/nature16961. URL http://dx.doi.org/10.1038/nature16961.
S. Singh, A.G. Barto, and N. Chentanez. Intrinsically motivated reinforcement learning. 18th Annual Conference on Neural Information Processing Systems (NIPS), 17(2):1281–1288, 2004. ISSN 1943-0604. doi: 10.1109/TAMD.2010.2051031.
Richard S Sutton, Doina Precup, and Satinder Singh. Between MDPs and Semi-MDPs: Learning, Planning, and Representing Knowledge at Multiple Temporal Scales. Artificial Intelligence, 1 (98-74):1–39, 1998.
Haoran Tang and Tuomas Haarnoja. Learning Diverse Skills via Maximum Entropy Deep Reinforcement Learning. URL http://bair.berkeley.edu/blog/2017/10/06/ soft-q-learning/.
Emanuel Todorov. Compositionality of optimal control laws. In Advances in Neural Information Processing Systems, pp. 1856–1864, 2009.
A Ulusoy. Ltl optimal multi-agent planner (lomap). Github repository, 2017.
Cristian-Ioan Vasile, Jana Tumova, Sertac Karaman, Calin Belta, and Daniela Rus. Minimumviolation scltl motion planning for mobility-on-demand. In Robotics and Automation (ICRA), 2017 IEEE International Conference on, pp. 1481–1488. IEEE, 2017.
Christopher John Cornish Hellaby Watkins. Learning From Delayed Rewards. PhD thesis, King’s College, Cambridge, England, 1989.
# Appendix
# A TASK SPECIFICATIONS
Task scTLTL Formula English Description If ball in red circle, $\begin{array} { r l } & { \left( \mathcal { C } _ { r e d } ( p _ { b a l l } ) \to \langle \rangle S _ { r e d } ( p _ { r e d b o x } ) \right) \Lambda } \\ & { \left( \neg \mathcal { C } _ { r e d } ( p _ { b a l l } ) \to \langle \rangle S _ { b l a c k } ( p _ { r e d b o x } ) \right) } \end{array}$ then red box eventually in $\phi _ { 1 }$ red square. Otherwise red box eventually in black square If ball in red circle, then red box eventually in $\begin{array} { c } { { ( \mathcal { C } _ { r e d } ( p _ { b a l l } ) \bigotimes S _ { r e d } ( p _ { r e d b o x } ) ) \wedge } } \\ { { ( \neg ( \mathcal { C } _ { r e d } ( p _ { b a l l } ) \vee ( S _ { b a c k } ( p _ { b a l l } ) ) \bigodot S _ { b l a c k } ( p _ { r e d b o x } ) ) } } \end{array}$ red square. If ball is $\phi _ { 2 }$ not in red circle or black square, then red box eventually in black square If ball in blue circle, then blue box eventually in $\begin{array} { r l r } { \phi _ { 3 } } & { } & { ( \mathcal { C } _ { b l u e } ( p _ { b a l l } ) \langle \rangle S _ { b l u e } ( p _ { b l u e b o x } ) ) \wedge } \\ { \phi _ { 3 } } & { } & { ( \neg ( \mathcal { C } _ { r e d } ( p _ { b a l l } ) \vee ( S _ { b a c k } ( p _ { b a l l } ) ) \langle \rangle S _ { b l a c k } ( p _ { b l u e b o x } ) ) } \end{array}$ blue square. If red ball is not in blue circle or black square, then blue box eventually in black square If ball in black square, $\phi _ { 4 }$ $\begin{array} { c } { { S _ { b l a c k } ( p _ { b a l l } ) \diamond S _ { b l u e } ( p _ { r e d b o x } ) } } \\ { { \ } } \\ { { S _ { b l a c k } ( p _ { b a l l } ) \diamond S _ { r e d } ( p _ { b l u e b o x } ) } } \\ { { \ } } \\ { { \phi _ { 2 } \wedge \phi _ { 3 } } } \\ { { \phi _ { 2 } \wedge \phi _ { 3 } \wedge \phi _ { 4 } \wedge \phi _ { 5 } } } \end{array}$ then eventually red box in blue square If ball in black square, $\phi _ { 5 }$ then eventually blue box in red square $\phi _ { 6 }$ Conjunction of task 2 and 3 $\phi _ { 7 }$ Conjunction of tasks 2, 3, 4, 5
B HYPERPARAMETERS FOR PROXIMAL POLICY OPTIMIZATION
<table><tr><td rowspan=1 colspan=1>Hyperparameter Value</td></tr><tr><td rowspan=1 colspan=1>Num.Hidden Layers 2Num.Units per layer 64Activation Relu</td></tr><tr><td rowspan=1 colspan=1>Policy Learning Rate 0.009</td></tr><tr><td rowspan=1 colspan=1>Value Learning Rate 0.009</td></tr><tr><td rowspan=1 colspan=1>Discount 0.99</td></tr><tr><td rowspan=1 colspan=1>Batch Size 60</td></tr><tr><td rowspan=1 colspan=1>GAE parameter 0.99</td></tr><tr><td rowspan=1 colspan=1>Num.Iterations 100</td></tr><tr><td rowspan=1 colspan=1>Num. Epochs 20</td></tr><tr><td rowspan=1 colspan=1>Clipping Parameter E 0.2</td></tr><tr><td rowspan=1 colspan=1>Horizon 20</td></tr></table>
# C STATE AND ACTION SPACES
For experiments with the simulated Baxter robot, we delegate low level control to motion planning packages and only learn high level decisions. Depending on the task, the states are the planar positions of objects (red box, blue box, ball) and the automata state. The actions are the target positions of the objects. We assume that the low level controller can take objects to the desired target position with minor uncertainty that will be dealt with by the learning agent. The table below shows state and action spaces used for each task. $s _ { \mathcal { M } }$ and $a _ { \mathcal { M } }$ denote the spaces for regular MDP (used for terminal robustness rewards and heuristic rewards). $^ s \tilde { \mathcal { M } }$ and $a _ { \tilde { \mathcal { M } } }$ denote the spaces for FSA augmented MDP. $q$ denotes the automata state.
<table><tr><td>Task</td><td> State Space</td><td>Action Space</td></tr><tr><td colspan="3"></td></tr><tr><td>1</td><td>S M = (Pball, Ppredbox) SM = (pball,Predbox,q)</td><td>aM/M = (predbox)target</td></tr><tr><td>2</td><td>SM=(Pball,Predbox) SM = (Pball,Predbox,q)</td><td>aM/M = (predbox)target</td></tr><tr><td>3</td><td>SM= (pball,Pbluebox) SM = (Pball, Pbluebox,q)</td><td>aM/M = (pbluebox)target</td></tr><tr><td>4</td><td>SM=(pball,Predbox) SM = (Pball, Predbox,q)</td><td>aM/M = (predbox)target</td></tr><tr><td>5</td><td>SM = (Pball, Pbluebox) SM = (Pball, Pbluebox, q)</td><td>aM/M = (pbluebox)target</td></tr><tr><td>6</td><td>S M = (pball, Predbox, Pbluebox) SM = (Pbal,Predbox,Pbluebox,qΦ2,qΦ3)</td><td>aM/M = (p,d)target</td></tr><tr><td colspan="3">SM= (Pball,Predbox,Pbluebox) 7 SM = (Pball,Predbox, Pbluebox,qΦ2,qΦ3,q,5)</td></tr></table>
For tasks $\phi _ { 6 }$ and $\phi _ { 7 }$ , the action space is three dimensional, the first two dimension $p = ( x , y )$ is a target position, the third dimension $d$ controls which object should be placed at $p$ . If $d < 0 . 5$ , then $p = p _ { r e d b o x }$ and if $d > 0 . 5$ , then $p = p _ { b l u e b o x }$ .
# Algorithm 1 Automata Guided RL (off-policy version)
1: Inputs: Episode horizon $T$ , $\tilde { M } _ { \phi }$ (consisting of an MDP and FSA $\mathcal { A } _ { \phi }$ ), maximum size for replay pool $N$ 2: Initialize parameterized policy $\pi ^ { \theta }$ $\triangleright \theta$ is the policy parameters 3: Initialize replay pool $B \gets \{ \}$ 4: for $n = 1$ to number of training episodes do 5: Select initial state $\tilde { s } _ { 0 } = ( s _ { 0 } , q _ { 0 } )$ $\triangleright \ s _ { 0 }$ can be randomly selected, $q _ { 0 }$ is always the initial automaton state $q ^ { 0 }$ 6: for $\mathrm { { t } = 0 }$ to T do $a _ { t } = \pi ( \tilde { s } _ { t } )$ 7: $\tilde { s } _ { t + 1 } = \mathrm { G e t N e x t S t a t e } ( \tilde { s } _ { t } , a _ { t } )$ 8: if $q _ { t + 1 } = = q _ { f }$ then 9: r˜t = 2 . terminal reward for satisfying $\phi$ 10: break . $\phi$ is satisfied, restart episode 11: else if $q _ { t + 1 } = = t r a p$ then 12: $\tilde { r } _ { t } = - 2$ $\triangleright$ terminal reward for violating $\phi$ 13: break . $\phi$ is violated, restart episode 14: else 15: $\boldsymbol { \tilde { r } } _ { t } = \mathbf { G e t R e w a r d } ( \tilde { s } _ { t } , \tilde { s } _ { t + 1 } )$ . using Equation 7 16: 17: end if 18: $\boldsymbol { B } \gets ( \tilde { s } _ { t } , a _ { t } , \tilde { s } _ { t + 1 } , \tilde { r } _ { t } )$ . store experience in replay pool 19: if $s i z e ( B ) > N$ then 20: $\boldsymbol { \mathrm { p o p } } ( B [ 0 ] )$ 21: end if 22: $\theta \gets$ UpdatePolicy $( B )$ . this can be any RL update rule and doesn’t necessarily have to occur at this location 23: end for 24: end for
# E SEMANTICS FOR SCTLTL
Following the syntax for scTLTL provided in Section 2.2, here we define the semantics for the language. We denote $s _ { t } \in S$ to be the state at time $t$ , and $s _ { t : t + k }$ to be a sequence of states (state trajectory) from time $t$ to $t + k$ , i.e., $s _ { t : t + k } = s _ { t } s _ { t + 1 } . . . s _ { t + k }$ . The Boolean semantics of scTLTL is defined as:
$$\begin{array} { r l r l } { s _ { t t + k } \pm | \pmb { \mathscr { f } } ( s ) < c } & { \Leftrightarrow } & { f ( s _ { t } ) < c , } \\ { s _ { t t + k } \pmb { \mathscr { b } } = - \phi } & { \Leftrightarrow } & { - ( s _ { t t + k } \mp e ) , } \\ { s _ { t t + k } \pmb { \mathscr { b } } = \phi \circ \psi } & { \Leftrightarrow } & { ( s _ { t t + k } \pmb { \mathscr { b } } + \phi ) \mp ( s _ { t t + k } \mp e ) , } \\ { s _ { t t + k } \pmb { \mathscr { b } } = \phi \wedge \pmb { \mathscr { b } } } & { \Leftrightarrow } & { ( s _ { t t + k } \pmb { \mathscr { b } } + \phi ) \wedge ( s _ { t t + k } \mp e ) , } \\ { s _ { t t + k } \pmb { \mathscr { b } } = \phi \vee \psi } & { \Leftrightarrow } & { ( s _ { t t + k } \pmb { \mathscr { b } } + \phi ) \vee ( s _ { t t + k } \mp e ) , } \\ { s _ { t t + k } \pmb { \mathscr { b } } = \bigotimes \phi } & { \Leftrightarrow } & { ( s _ { t t + k + k } \pmb { \mathscr { b } } ) \wedge ( \pmb { \mathscr { b } } > 0 ) , } \\ { s _ { t t + k + k } \pmb { \mathscr { b } } = \phi \circ } & { \Leftrightarrow } & { \pmb { \mathscr { a } } \notin [ \pmb { \mathscr { b } } , t + k ) s _ { v ( t + k } \mp e , } \\ { s _ { t t + k } \pmb { \mathscr { b } } = \phi \pmb { \mathscr { b } } } & { \Leftrightarrow } & { \wedge ( \forall t , t + k ) s _ { t } , s _ { v ( t + k ) } \pmb { \mathscr { b } } = \psi , } \\ { s _ { t t + k } \pmb { \mathscr { b } } = \phi \mathscr { U } } & { \Leftrightarrow } & { \wedge ( \forall t ^ { \prime } \in [ t , t ] ^ { \prime } s _ { t t } ^ { \prime } \circ \sigma _ { v ^ { t } , t } ^ { \prime } \Rightarrow \phi ) , } \\ { s _ { t t + k } \pmb { \mathscr { b } } = \phi \mathscr { T } \psi } & { \Leftrightarrow } & { \mathscr { a } t ^ { \prime } \in [ t , t ] s , t s _ { v ( t + k ) } \mp \psi } \\ { s _ { t t + k } \pmb { \mathscr { b } } = \phi \mathscr { T } \psi } & { \Leftrightarrow } & { \mathscr { a } t ^ { \prime } \in [ t , t ] ^ { \prime } s _ { t t } ^ { \prime } \circ \psi , } \end{array}$$
A trajectory $s$ of horizon $T$ is said to satisfy formula $\phi$ if $s _ { 0 : T } \models \phi$ .
We also define the quantitative semantics for scTLTL (robustness degree) , i.e., a real-valued function $\rho ( s _ { t : t + k } , \phi )$ of state trajectory $s _ { t : t + k }$ and a scTLTL specification $\phi$ that indicates how far $s _ { t : t + k }$ is from satisfying or violating the specification $\phi$ . The quantitative semantics of scTLTL is defined as follows:
$$\begin{array} { r l r l } { \rho ( s _ { \mathrm { G r a t } } ^ { \prime } | s _ { \star } , \gamma ) } & { = } & { \rho _ { \mathrm { G r a t } } , } \\ { \rho ( s _ { \mathrm { G r a t } , \hdots , \hdots , \hdots , \hdots , \rho } ) } & { = } & { - \rho ( s _ { \mathrm { g r a t } , \hdots , \hdots , \hdots , \hdots , \rho } ) , } \\ { \rho ( s _ { \mathrm { G r a t } , \hdots , \phi } ) } & { = } & { - \rho ( s _ { \mathrm { g r a t } , \hdots , \phi } ) , } \\ { \rho ( s _ { \mathrm { G r a t } , \hdots , \phi } ) } & { = } & { \operatorname* { m a x } \{ \rho ( s _ { \mathrm { G r a t } , \hdots , \phi } ) , \rho ( s _ { \mathrm { t r a t } , \hdots , \phi } ) \} } \\ { \rho ( s _ { \mathrm { G r a t } , \hdots , \phi } ) } & { = } & { \operatorname* { m a x } \{ \rho ( s _ { \mathrm { G r a t } , \hdots , \phi } ) , \rho ( s _ { \mathrm { t r a t } , \hdots , \phi } ) \} , } \\ { \rho ( s _ { \mathrm { G r a t } , \hdots , \phi } ) } & { = } & { \operatorname* { m a x } \{ \rho ( s _ { \mathrm { G r a t } , \hdots , \phi } ) , \rho ( s _ { \mathrm { t r a t } , \hdots , \phi } ) \} , } \\ { \rho ( s _ { \mathrm { G r a t } , \hdots , \phi } ) } & { = } & { \rho ( s _ { \mathrm { G r a t } , \hdots , \phi } ) \{ \xi > 0 \} , } \\ { \rho ( s _ { \mathrm { G r a t } , \hdots , \phi } ) } & { = } & { \rho _ { \mathrm { G r a t } , \phi } \{ \rho ( s _ { \mathrm { g r a t } , \hdots , \phi } ) \} , } \\ { \rho ( s _ { \mathrm { G r a t } , \hdots , \phi } ) } & { = } & { \rho _ { \mathrm { G r a t } , \phi } \{ \rho ( s _ { \mathrm { g r a t } , \hdots , \phi } ) \} , } \\ { \rho ( s _ { \mathrm { G r a t } , \hdots , \phi } ) } & { = } & { \rho _ { \mathrm { G r a t } , \phi } \{ \rho ( s _ { \mathrm { g r a t } , \phi } ) \} , } \\ { \rho ( s _ { \mathrm { G r a t } , \hdots , \phi } ) } & { = } & \rho _ { \mathrm { G r a t } , \phi } \{ \rho ( s _ \end{array}$$
where $\rho _ { m a x }$ represents the maximum robustness value. Moreover, $\rho ( s _ { t : t + k } , \phi ) > 0 \Rightarrow s _ { t : t + k } \mid = \phi$ and $\rho ( s _ { t : t + k } , \bar { \phi } ) \ : < \ : 0 \ : \Rightarrow \ : s _ { t : t + k } \ : \forall \ : \phi ,$ , which implies that the robustness degree can substitute Boolean semantics in order to enforce the specification $\phi$ (refer to Li et al. (2016) for a more detailed description of TLTL and robustness).123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283# Dynamic Channel Pruning: Feature Boosting and Suppression
Xitong Gao $\bot$ ∗, Yiren Zhao $^ 2$ ∗, Lukasz Dudziak $^ 3$ , Robert Mullins4, Cheng-zhong $\mathbf { X u } ^ { \mathrm { 5 } }$
1 Shenzhen Institutes of Advanced Technology, Shenzhen, China 2,3,4 University of Cambridge, Cambridge, UK 5 University of Macau, Macau, China 1 xt.gao@siat.ac.cn, 2 yaz21@cam.ac.uk
# Abstract
Making deep convolutional neural networks more accurate typically comes at the cost of increased computational and memory resources. In this paper, we reduce this cost by exploiting the fact that the importance of features computed by convolutional layers is highly input-dependent, and propose feature boosting and suppression (FBS), a new method to predictively amplify salient convolutional channels and skip unimportant ones at run-time. FBS introduces small auxiliary connections to existing convolutional layers. In contrast to channel pruning methods which permanently remove channels, it preserves the full network structures and accelerates convolution by dynamically skipping unimportant input and output channels. FBS-augmented networks are trained with conventional stochastic gradient descent, making it readily available for many state-of-the-art CNNs. We compare FBS to a range of existing channel pruning and dynamic execution schemes and demonstrate large improvements on ImageNet classification. Experiments show that FBS can respectively provide $5 \times$ and $2 \times$ savings in compute on VGG-16 and ResNet-18, both with less than $0 . 6 \%$ top-5 accuracy loss.
# 1 Introduction
State-of-the-art vision and image-based tasks such as image classification (Krizhevsky et al., 2012; Simonyan & Zisserman, 2015; He et al., 2016), object detection (Ren et al., 2017; Huang et al., 2017) and segmentation (Long et al., 2015) are all built upon deep convolutional neural networks (CNNs). While CNN architectures have evolved to become more efficient, the general trend has been to use larger models with greater memory utilization, bandwidth and compute requirements to achieve higher accuracy. The formidable amount of computational resources used by CNNs present a great challenge in the deployment of CNNs in both cost-sensitive cloud services and low-powered edge computing applications.
One common approach to reduce the memory, bandwidth and compute costs is to prune over-parameterized CNNs. If performed in a coarse-grain manner this approach is known as channel pruning (Ye et al., 2018; He et al., 2017; Liu et al., 2017; Wen et al., 2016). Channel pruning evaluates channel saliency measures and removes all input and output connections from unimportant channels— generating a smaller dense model. A saliency-based pruning method, however, has threefold disadvantages. Firstly, by removing channels, the capabilities of CNNs are permanently lost, and the resulting CNN may never regain its accuracy for difficult inputs for which the removed channels were responsible. Secondly, despite the fact that channel pruning may drastically shrink model size, without careful design, computational resources cannot be effectively reduced in a CNN without a detrimental impact on its accuracy. Finally, the saliency of a neuron is not static, which can be illustrated by the feature visualization in Figure 1. Here, a CNN is shown a set of input images, certain channel neurons in a convolutional output may get highly excited, whereas another set of images elicit little response from the same channels. This is in line with our understanding of CNNs that neurons in a convolutional layer specialize in recognizing distinct features, and the relative importance of a neuron depends heavily on the inputs.
The above shortcomings prompt the question: why should we prune by static importance, if the importance is highly input-dependent? Surely, a more promising alternative is to prune dynamically depending on the current input. A dynamic channel pruning strategy allows the network to learn to prioritize certain convolutional channels and ignore irrelevant ones. Instead of simply reducing model size at the cost of accuracy with pruning, we can accelerate convolution by selectively computing only a subset of channels predicted to be important at run-time, while considering the sparse input from the preceding convolution layer. In effect, the amount of cached activations and the number of read, write and arithmetic operations used by a well-designed dynamic model can be almost identical to an equivalently sparse statically pruned one. In addition to saving computational resources, a dynamic model preserves all neurons of the full model, which minimizes the impact on task accuracy.
In this paper, we propose feature boosting and suppression (FBS) to dynamically amplify and suppress output channels computed by the convolutional layer. Intuitively, we can imagine that the flow of information of each output channel can be amplified or restricted under the control of a “valve”. This allows salient information to flow freely while we stop all information from unimportant channels and skip their computation. Unlike pruning statically, the valves use features from the previous layer to predict the saliency of output channels. With conventional stochastic gradient descent (SGD) methods, the predictor can learn to adapt itself by observing the input and output features of the convolution operation.
FBS introduces tiny auxiliary connections to existing convolutional layers. The minimal overhead added to the existing model is thus negligible when compared to the potential speed up provided by the dynamic sparsity. Existing dynamic computation strategies in CNNs (Lin et al., 2017; Odena et al., 2017; Bolukbasi et al., 2017) produce on/off pruning decisions or execution path selections. Training them thus often resorts to reinforcement learning, which in practice is often computationally expensive. Even though FBS similarly use non-differentiable functions, contrary to these methods, the unified losses are still wellminimized with conventional SGD.
We apply FBS to a custom CIFAR-10 (Krizhevsky et al., 2014) classifier and popular CNN models such as VGG-16 (Simonyan & Zisserman, 2015) and ResNet-18 (He et al., 2016) trained on the ImageNet dataset (Deng et al., 2009). Empirical results show that under the same speed-ups, FBS can produce models with validation accuracies surpassing all other channel pruning and dynamic conditional execution methods examined in the paper.
 Figure 1: When images from the ImageNet validation dataset are shown to a pre-trained ResNet-18 (He et al., 2016), the outputs from certain channel neurons may vary drastically. The top rows in (a) and (b) are found respectively to greatly excite neurons in channels 114 and 181 of layer block 3b/conv2, whereas the bottom images elicit little activation from the same channel neurons. The number below each image indicate the maximum values observed in the channel before adding the shortcut and activation. Finally, (c) shows the distribution of maximum activations observed in the first 20 channels.
# 2 Related Work
# 2.1 Structured Sparsity
Since LeCun et al. (1990) introduced optimal brain damage, the idea of creating more compact and efficient CNNs by removing connections or neurons has received significant attention. Early literature on pruning deep CNNs zero out individual weight parameters (Hassibi et al., 1994; Guo et al., 2016). This results in highly irregular sparse connections, which were notoriously difficult for GPUs to exploit. This has prompted custom accelerator solutions that exploit sparse weights (Parashar et al., 2017; Han et al., 2016). Although supporting both sparse and dense convolutions efficiently normally involves some compromises in terms of efficiency or performance.
Alternatively, recent work has thus increasingly focused on introducing structured sparsity (Wen et al., 2016; Ye et al., 2018; Alvarez & Salzmann, 2016; Zhou et al., 2016), which can be exploited by GPUs and allows custom accelerators to focus solely on efficient dense operations. Wen et al. (2016) added group Lasso on channel weights to the model’s training loss function. This has the effect of reducing the magnitude of channel weights to diminish during training, and remove connections from zeroed-out channels. To facilitate this process, Alvarez & Salzmann (2016) additionally used proximal gradient descent, while Li et al. (2017) and He et al. (2018a) proposed to prune channels by thresholds, i.e. they set unimportant channels to zero, and fine-tune the resulting CNN. The objective to induce sparsity in groups of weights may present difficulties for gradient-based methods, given the large number of weights that need to be optimized. A common approach to overcome this is to solve (He et al., 2017) or learn (Liu et al., 2017; Ye et al., 2018) channel saliencies to drive the sparsification of CNNs. He et al. (2017) solved an optimization problem which limits the number of active convolutional channels while minimizing the reconstruction error on the convolutional output. Liu et al. (2017) used Lasso regularization on channel saliencies to induce sparsity and prune channels with a global threshold. Ye et al. (2018) learned to sparsify CNNs with an iterative shrinkage/thresholding algorithm applied to the scaling factors in batch normalization. There are methods (Luo et al., 2017; Zhuang et al., 2018) that use greedy algorithms for channel selection. Huang et al. (2018) and He et al. (2018b) adopted reinforcement learning to train agents to produce channel pruning decisions. PerforatedCNNs, proposed by Figurnov et al. (2016), use predefined masks that are model-agnostic to skip the output pixels in convolutional layers.
# 2.2 Dynamic Execution
In a pruned model produced by structured sparsity methods, the capabilities of the pruned neurons and connections are permanently lost. Therefore, many propose to use dynamic networks as an alternative to structured sparsity. During inference, a dynamic network can use the input data to choose parts of the network to evaluate.
Convolutional layers are usually spatially sparse, i.e. their activation outputs may contain only small patches of salient regions. A number of recent publications exploit this for acceleration. Dong et al. (2017) introduced low-cost collaborative layers which induce spatial sparsity in cheap convolutions, so that the main expensive ones can use the same sparsity information. Figurnov et al. (2017) proposed spatially adaptive computation time for residual networks (He et al., 2016), which learns the number of residual blocks required to compute a certain spatial location. Almahairi et al. (2016) presented dynamic capacity networks, which use the gradient of a coarse output’s entropy to select salient locations in the input image for refinement. Ren et al. (2018) assumed the availability of $a$ priori spatial sparsity in the input image, and accelerated the convolutional layer by computing non-sparse regions.
There are dynamic networks that make binary decisions or multiple choices for the inference paths taken. BlockDrop, proposed by Wu et al. (2018), trains a policy network to skip blocks in residual networks. Liu & Deng (2018) proposed conditional branches in deep neural networks (DNNs), and used Q-learning to train the branching policies. Odena et al. (2017) designed a DNN with layers containing multiple modules, and decided which module to use with a recurrent neural network (RNN). Lin et al. (2017) learned an RNN to adaptively prune channels in convolutional layers. The on/off decisions commonly used in these networks cannot be represented by differentiable functions, hence the gradients are not well-defined. Consequently, the dynamic networks above train their policy functions by reinforcement learning. There exist, however, methods that workaround such limitations. Shazeer et al. (2017) introduced sparsely-gated mixture-of-experts and used a noisy ranking on the backpropagate-able gating networks to select the expensive experts to evaluate. Bolukbasi et al. (2017) trained differentiable policy functions to implement early exits in a DNN. Hua et al. (2018) learned binary policies that decide whether partial or all input channels are used for convolution, but approximate the gradients of the non-differentiable policy functions with continuous ones.
# 3 Feature Boosting and Suppression
We start with a high-level illustration (Figure 2) of how FBS accelerates a convolutional layer with batch normalization (BN). The auxiliary components (in red) predict the importance of each output channel based on the input features, and amplify the output features accordingly. Moreover, certain output channels are predicted to be entirely suppressed (or zero-valued as represented by $\varTheta$ ), such output sparsity information can advise the convolution operation to skip the computation of these channels, as indicated by the dashed arrow. It is notable that the expensive convolution can be doubly accelerated by skipping the inactive channels from both the input features and the predicted output channel saliencies. The rest of this section provides detailed explanation of the components in Figure 2.
 Figure 2: A high level view of a convolutional layer with FBS. By way of illustration, we use the $l ^ { \mathrm { t h } }$ layer with 8-channel input and output features, where channels are colored to indicate different saliencies, and the white blocks $( \boxed { \mathcal { Q } } )$ represent all-zero channels.
# 3.1 Preliminaries
For simplicity, we consider a deep sequential batch-normalized (Ioffe & Szegedy, 2015) CNN with $L$ convolutional layers, i.e ${ \bf \therefore } \ { \bf x } _ { L } = F ( { \bf x } _ { 0 } ) = f _ { L } \left( \cdot \cdot \cdot f _ { 2 } ( f _ { 1 } ( { \bf x } _ { 0 } ) \right) \cdot \cdot \cdot { \bf \cdot } ) $ , where the $l ^ { \mathrm { t h } }$ layer $f _ { l } : \mathbb { R } ^ { C _ { l - 1 } \times H _ { l - 1 } \times W _ { l - 1 } } \to \mathbb { R } ^ { C _ { l } \times H _ { l } \times W _ { l } }$ computes the features $\mathbf { x } _ { l } \in \mathbb { R } ^ { C _ { l } \times H _ { l } \times W _ { l } }$ , which comprise of $C _ { l }$ channels of features with height $H _ { l }$ and width $W _ { l }$ . The $l ^ { \mathrm { t h } }$ layer is thus defined as:
$$f _ { l } \left( \mathbf { x } _ { l - 1 } \right) = ( \gamma _ { l } \cdot \mathsf { n o r m } \left( \mathsf { c o n v } _ { l } \left( \mathbf { x } _ { l - 1 } , \pmb { \theta } _ { l } \right) \right) + \beta _ { l } ) _ { + } .$$
Here, additions $( + )$ and multiplications $( \cdot )$ are element-wise, $( \mathbf { z } ) _ { + } = \operatorname* { m a x } \left( \mathbf { z } , 0 \right)$ denotes the ReLU activation, $\gamma _ { l } , \beta _ { l } \in \mathbb { R } ^ { C _ { l } }$ are trainable parameters, norm $\mathbf { \rho } ( \mathbf { z } )$ normalizes each channel of features $\mathbf { z }$ across the population of $\mathbf { z }$ , with $\mu _ { \mathbf { z } } , \pmb { \sigma } _ { \mathbf { z } } ^ { 2 } \in \mathbb { R } ^ { C _ { l } }$ respectively containing the population mean and variance of each channel, and a small $\epsilon$ prevents division by zero:
$$\mathsf { n o r m } \left( \mathbf { z } \right) = \frac { \mathbf { z } - \mu _ { \mathbf { z } } } { \sqrt { \pmb { \sigma } _ { \mathbf { z } } ^ { 2 } + \epsilon } } .$$
Additionally, convl $\left( \mathbf { x } _ { l - 1 } , \pmb { \theta } _ { l } \right)$ computes the convolution of input features using the weight tensor $\pmb { \theta } _ { l } \in \mathbb { R } ^ { C ^ { l } \times C ^ { l - 1 } \times k ^ { 2 } }$ , where $k$ −is the kernel size. Specifically, FBS concerns the
optimization of convl $\left( \mathbf { x } _ { l - 1 } , \pmb { \theta } _ { l } \right)$ functions, as a CNN spends the majority of its inference time in them, using $k ^ { 2 } C _ { l - 1 } C _ { l } H _ { l } W _ { l }$ multiply-accumulate operations (MACs) for the $l ^ { \mathrm { t h } }$ layer.
# 3.2 Designing a Dynamic Layer
Consider the following generalization of a layer with dynamic execution:
$$\hat { f } \left( \mathbf { x } , \cdots \right) = f \left( \mathbf { x } , \pmb { \theta } , \cdots \right) \cdot \pi \left( \mathbf { x } , \pmb { \phi } , \cdots \right) ,$$
where $f$ and $\pi$ respectively use weight parameters $\pmb { \theta }$ and $\phi$ and may have additional inputs, and compute tensors of the same output shape, denoted by $\mathbf { F }$ and $\mathbf { G }$ . Intuitively, the expensive $\mathbf { F } ^ { [ \mathbf { i } ] }$ can always be skipped for any index i whenever the cost-effective $\mathbf { G } ^ { [ \mathbf { i } ] }$ evaluates to $\mathbf { 0 }$ . Here, the superscript [i] is used to index the $\mathbf { i } ^ { \mathrm { t h } }$ slice of the tensor. For example, if we have features $\mathbf { F } \in \mathbb { R } ^ { C \times H \times W }$ containing $C$ channels of $H$ -by- $W$ features, $\mathbf { F } ^ { \left\lfloor c \right\rfloor } \in \mathbb { R } ^ { H \times W }$ retrieves the $c ^ { \mathrm { t h } }$ feature image. We can further sparsify and accelerate the layer by adding, for instance, a Lasso on $\pi$ to the total loss, where $\mathbb { E } _ { \mathbf { x } } \left[ \mathbf { z } \right]$ is the expectation of $\mathbf { z }$ over $\mathbf { x }$ :
$$\mathcal { R } \left( \mathbf { x } \right) = \mathbb { E } _ { \mathbf { x } } \left[ \left. \pi \left( \mathbf { x } , \phi , \cdot \cdot \cdot \right) \right. _ { 1 } \right] ,$$
Despite the simplicity of this formulation, it is however very tricky to design $\hat { f }$ properly. Under the right conditions, we can arbitrarily minimize the Lasso while maintaining the same output from the layer by scaling parameters. For example, in low-cost collaborative layers (Dong et al., 2017), $f$ and $\pi$ are simply convolutions (with or without ReLU activation) that respectively have weights $\pmb { \theta }$ and $\phi$ . Since $f$ and $\pi$ are homogeneous functions, one can always halve $\phi$ and double $\pmb { \theta }$ to decrease (4) while the network output remains the same. In other words, the optimal network must have $\| \phi \| _ { \infty } 0$ , which is infeasible in finiteprecision arithmetic. For the above reasons, Dong et al. (2017) observed that the additional loss in (4) always degrades the CNN’s task performance. Ye et al. (2018) pointed out that gradient-based training algorithms are highly inefficient in exploring such reparameterization patterns, and channel pruning methods may experience similar difficulties. Shazeer et al. (2017) avoided this limitation by finishing $\pi$ with a softmax normalization, but (4) can no longer be used as the softmax renders the $\ell ^ { 1 }$ -norm, which now evaluates to 1, useless. In addition, similar to sigmoid, softmax (without the cross entropy) is easily saturated, and thus may equally suffer from vanishing gradients. Many instead design $\pi$ to produce on/off decisions and train them with reinforcement learning as discussed in Section 2.
# 3.3 Feature Boosting and Suppression with Channel Saliencies
Instead of imposing sparsity on features or convolutional weight parameters (e.g. Wen et al. (2016); Alvarez & Salzmann (2016); Li et al. (2017); He et al. (2018a)), recent channel pruning methods (Liu et al., 2017; Ye et al., 2018) induce sparsity on the BN scaling factors $\gamma _ { l }$ . Inspired by them, FBS similarly generates a channel-wise importance measure. Yet contrary to them, instead of using the constant BN scaling factors $\gamma _ { l }$ , we predict channel importance and dynamically amplify or suppress channels with a parametric function $\pi ( \mathbf { x } _ { l - 1 } )$ dependent on the output from the previous layer $\mathbf x l - 1$ . Here, we propose to replace the layer definition $f _ { l } \left( \mathbf { x } _ { l - 1 } \right)$ for each of $l \in [ 1 , L ]$ with $\hat { f } _ { l } \left( \mathbf { x } _ { l - 1 } \right)$ which employs dynamic channel pruning:
$$\hat { f } _ { l } \left( \mathbf { x } _ { l - 1 } \right) = \left( \pi _ { l } \left( \mathbf { x } _ { l - 1 } \right) \cdot \left( \mathsf { n o r m } \left( \mathsf { c o n v } _ { l } \left( \mathbf { x } _ { l - 1 } , \pmb { \theta } _ { l } \right) \right) + \beta _ { l } \right) \right) _ { + } ,$$
where a low-overhead policy $\pi _ { l } \left( \mathbf { x } _ { l - 1 } \right)$ evaluates the pruning decisions for the computationally demanding conv $\left( \mathbf { x } _ { l - 1 } , \pmb { \theta } _ { l } \right)$ :
$$\pi _ { l } \left( \mathbf { x } _ { l - 1 } \right) = \mathsf { w t a } _ { \lceil d C _ { l } \rceil } \left( g _ { l } \left( \mathbf { x } _ { l - 1 } \right) \right) .$$
Here, ${ \mathsf { w t a } } _ { k } ( { \mathbf { z } } )$ is a $k$ -winners-take-all function, i.e. it returns a tensor identical to $\mathbf { z }$ , except that we zero out entries in $\mathbf { z }$ that are smaller than the $k$ largest entries in absolute magnitude. In other words, $\mathsf { w t a } _ { \lceil d C _ { l } \rceil } \bigl ( g _ { l } \bigl ( \mathbf { x } _ { l - 1 } \bigr ) \bigr )$ provides a pruning strategy that computes only $\lceil d C _ { l } \rceil$ most salient channels predicted by $g _ { l } ( \mathbf { x } _ { l - 1 } )$ , and suppresses the remaining channels with zeros. In Section 3.4, we provide a detailed explanation of how we design a cheap $g _ { l } ( \mathbf { x } _ { l - 1 } )$ that learns to predict channel saliencies.
It is notable that our strategy prunes $C _ { l } - \lceil d C _ { l } \rceil$ least salient output channels from $l ^ { \mathrm { t h } }$ layer, where the density $d \in ] 0 , 1 ]$ can be varied to sweep the trade-off relationship between performance and accuracy. Moreover, pruned channels contain all-zero values. This allows the subsequent $( l + 1 ) ^ { \mathrm { t h } }$ layer to trivially make use of input-side sparsity, since all-zero features can be safely skipped even for zero-padded layers. Because all convolutions can exploit both input- and output-side sparsity, the speed-up gained from pruning is quadratic with respect to the pruning ratio. For instance, dynamically pruning half of the channels in all layers gives rise to a dynamic CNN that uses approximately $\frac { 1 } { 4 }$ of the original MACs.
Theoretically, FBS does not introduce the reparameterization discussed in Section 3.2. By batch normalizing the convolution output, the convolution kernel $\theta _ { l }$ is invariant to scaling. Computationally, it is more efficient to train. Many alternative methods use nondifferentiable $\pi$ functions that produce on/off decisions. In general, DNNs with these policy functions are incompatible with SGD, and resort to reinforcement learning for training. In contrast, (6) allows end-to-end training, as wta is a piecewise differentiable and continuous function like ReLU. Srivastava et al. (2015) suggested that in general, a network is easier and faster to train for complex tasks and less prone to catastrophic forgetting, if it uses functions such as wta that promote local competition between many subnetworks.
# 3.4 Learning to Predict Channel Saliencies
This section explains the design of the channel saliency predictor $g _ { l } ( \mathbf { x } _ { l - 1 } )$ . To avoid significant computational cost in $g _ { l }$ , we subsample $\mathbf x _ { l - 1 }$ by reducing the spatial dimensions of each channel to a scalar using the following function $\mathsf { s s } : \mathbb { R } ^ { C \times H \times W } \to \mathbb { R } ^ { C }$ :
$$\mathfrak { s s } \left( \mathbf { x } _ { l - 1 } \right) = \frac { 1 } { H W } \left[ \mathfrak { s } \left( \mathbf { x } _ { l - 1 } ^ { [ 1 ] } \right) \ \mathfrak { s } \left( \mathbf { x } _ { l - 1 } ^ { [ 2 ] } \right) \ \cdot \ \cdot \ \mathfrak { s } \left( \mathbf { x } _ { l - 1 } ^ { [ C ] } \right) \right] ,$$
where $\mathsf { s } \left( \mathbf { x } _ { l - 1 } ^ { [ c ] } \right)$ reduces the $c ^ { \mathrm { t h } }$ channel of $\mathbf { z }$ to a scalar using, for instance, the $\ell ^ { 1 }$ -norm $\| \mathbf { x } _ { l - 1 } ^ { [ c ] } \| _ { 1 }$ , $\ell ^ { 2 }$ -norm, $\ell ^ { \infty }$ -norm, or the variance of $\mathbf { x } _ { l - 1 } ^ { [ c ] }$ . The results in Section 4 use the $\ell ^ { 1 }$ - − − norm by default, which is equivalent to global average pooling for the ReLU activated $\mathbf x l - 1$ . We then design $g _ { l } ( \mathbf { x } _ { l - 1 } )$ − to predict channel saliencies with a fully connected layer following −the subsampled activations $\mathsf { s s } \left( \mathbf { x } _ { l - 1 } \right)$ , where $\phi _ { l } \in \mathbb { R } ^ { C ^ { l } \times C ^ { l - 1 } }$ is the weight tensor of the layer:
$$g _ { l } \left( \mathbf { x } _ { l - 1 } \right) = \left( \mathsf { s s } \left( \mathbf { x } _ { l - 1 } \right) \phi _ { l } + \pmb { \rho } _ { l } \right) _ { + } .$$
We generally initialize $\rho _ { l }$ with $1$ and apply He et al. (2015)’s initialization to $\phi _ { l }$ . Similar to how Liu et al. (2017) and Ye et al. (2018) induced sparsity in the BN scaling factors, we regularize all layers with the Lasso on $g _ { l } ( \mathbf { x } _ { l - 1 } )$ : $\begin{array} { r l } { { \lambda \sum _ { l = 1 } ^ { L } \mathbb { E } _ { \mathbf { x } } [ g _ { l } ( \mathbf { x } _ { l - 1 } ) _ { 1 } ] } \quad } & { { } } \end{array}$ in the total loss, where $\lambda = 1 0 ^ { - 8 }$ in our experiments.
# 4 Experiments
We ran extensive experiments on CIFAR-10 (Krizhevsky et al., 2014) and the ImageNet ILSVRC2012 (Deng et al., 2009), two popular image classification datasets. We use MCifarNet (Zhao et al., 2018), a custom 8-layer CNN for CIFAR-10 (see Appendix A for its structure), using only 1.3 M parameters with 91.37% and 99.67% top-1 and top-5 accuracies respectively. M-CifarNet is much smaller than a VGG-16 on CIFAR-10 (Liu et al., 2017), which uses $2 0 \mathrm { M }$ parameters and only $2 . 2 9 \%$ more accurate. Because of its compactness, our CNN is more challenging to accelerate. By faithfully reimplementing Network Slimming (NS) (Liu et al., 2017), we closely compare FBS with NS under various speedup constraints. For ILSVRC2012, we augment two popular CNN variants, ResNet-18 (He et al., 2016) and VGG-16 (Simonyan & Zisserman, 2015), and provide detailed accuracy/MACs trade-off comparison against recent structured pruning and dynamic execution methods.
Our method begins by first replacing all convolutional layer computations with (5), and initializing the new convolutional kernels with previous parameters. Initially, we do not suppress any channel computations by using density $d = 1$ in (6) and fine-tune the resulting network. For fair comparison against NS, we then follow Liu et al. (2017) by iteratively decrementing the overall density $d$ of the network by 10% in each step, and thus gradually using fewer channels to sweep the accuracy/performance trade-off. The difference is that NS prunes channels by ranking globally, while FBS prunes around $1 - d$ of each layer.
# 4.1 CIFAR-10
 Figure 3: Experimental results on M-CifarNet. We compare in (a) the accuracy/MACs trade-off between FBS, NS and FBS $^ +$ NS. The baseline is emphasized by the circle $\bigcirc$ . The heat map in (b) reveals the individual probability of skipping a channel for each channel ( $x$ -axis), when an image of a category ( $y$ -axis) is shown to the network with $d = 1$ .
By respectively applying NS and FBS to our CIFAR-10 classifier and incrementally increasing sparsity, we produce the trade-off relationships between number of operations (measured in MACs) and the classification accuracy as shown in Figure 3a. FBS clearly surpasses NS in its ability to retain the task accuracy under an increasingly stringent computational budget. Besides comparing FBS against NS, we are interested in combining both methods, which demonstrates the effectiveness of FBS if the model is already less redundant, i.e. it cannot be pruned further using NS without degrading the accuracy by more than $1 \%$ . The composite method (NS+FBS) is shown to successfully regain most of the lost accuracy due to NS, producing a trade-off curve closely matching FBS. It is notable that under the same $9 0 . 5 0 \%$ accuracy constraints, FBS, NS+FBS, and NS respectively achieve $3 . 9 3 \times$ , $3 . 2 2 \times$ , and $1 . 1 9 \times$ speed-up ratios. Conversely for a $2 \times$ speed-up target, they respectively produce models with accuracies not lower than $9 1 . 5 5 \%$ , $9 0 . 9 0 \%$ and $8 7 . 5 4 \%$ .
Figure 3b demonstrates that our FBS can effectively learn to amplify and suppress channels when dealing with different input images. The 8 heat maps respectively represent the channel skipping probabilities of the 8 convolutional layers. The brightness of the pixel at location $( x , y )$ denotes the probability of skipping the $x ^ { \mathrm { t h } }$ channel when looking at an image of the $y ^ { \mathrm { t h } }$ category. The heat maps verify our belief that the auxiliary network learned to predict which channels specialize to which features, as channels may have drastically distinct probabilites of being used for images of different categories. The model here is a M-CifarNet using FBS with $d = 0 . 5$ , which has a top-1 accuracy of $9 0 . 5 9 \%$ (top-5 $9 9 . 6 5 \%$ ). Moreover, channels in the heat maps are sorted so the channels that are on average least frequently evaluated are placed on the left, and channels shaded in stripes are never evaluated. The network in Figure 3b is not only approximately $4 \times$ faster than the original, by removing the unused channels, we also reduce the number of weights by 2.37 $\times$ . This reveals that FBS naturally subsumes channel pruning strategies such as NS, as we can simply prune away channels that are skipped regardless of the input. It is notable that even though we specified a universal density $d$ , FBS learned to adjust its dynamicity across all layers, and prune different ratios of channels from the convolutional layers.
# 4.2 ImageNet ILSVRC2012 Classification
By applying FBS and NS respectively to ResNet-18, we saw that the ILSVRC2012 validation accuracy of FBS consistently outperforms NS under different speed-up constraints (see Appendix B for the implementation details and trade-off curves). For instance, at $d = 0 . 7$ , it utilizes only 1.12 G MACs (1.62 $\times$ fewer) to achieve a top-1 error rate of $3 1 . 5 4 \%$ , while NS requires 1.51 G MACs (1.21 $\times$ fewer) for a similar error rate of $3 1 . 7 0 \%$ . When compared across recent dynamic execution methods examined in Table 1, FBS demonstrates simultaneously the highest possible speed-up and the lowest error rates. It is notable that the baseline accuracies for FBS refer to a network that has been augmented with the auxiliary layers featuring FBS but suppress no channels, i.e. $d = 1$ . We found that this method brings immediate accuracy improvements, an increase of $1 . 7 3 \%$ in top-1 and $0 . 4 6 \%$ in top-5 accuracies, to the baseline network, which is in line with our observation on M-CifarNet.
In Table 2, we compare different structured pruning and dynamic execution methods to FBS for VGG-16 (see Appendix B for the setup). At a speed-up of 3.01 $\times$ , FBS shows a minimal increase of $0 . 4 4 \%$ and $0 . 0 4 \%$ in top-1 and top-5 errors respectively. At $5 . 2 3 \times$ speed-up, it only degrades the top-1 error by $1 . 0 8 \%$ and the top-5 by $0 . 5 9 \%$ .
Not only does FBS use much fewer MACs, it also demonstrates significant reductions in bandwidth and memory requirements. In Table 3, we observe a large reduction in the number of memory accesses in single image inference as we simply do not access suppressed weights and activations. Because these memory operations are often costly DRAM accesses, minimizing them leads to power-savings. Table 3 further reveals that in diverse application scenarios such as low-end and cloud environments, the peak memory usages by the optimized models are much smaller than the originals, which in general improves cache utilization.
Table 1: Comparisons of error rates of the baseline and accelerated ResNet-18 models.
<table><tr><td rowspan="2">Method</td><td rowspan="2">Dynamic</td><td colspan="2">Baseline</td><td colspan="2">Accelerated</td><td rowspan="2">MAC saving</td></tr><tr><td>Top-1</td><td>Top-5</td><td>Top-1</td><td>Top-5</td></tr><tr><td>Soft Filter Pruning (He et al., 2018a)</td><td></td><td>29.72</td><td>10.37</td><td>32.90</td><td>12.22</td><td>1.72×</td></tr><tr><td>Network Slimming (Liu et al. (20l7),our implementation)</td><td></td><td>31.02</td><td>11.32</td><td>32.79</td><td>12.61</td><td>1.39×</td></tr><tr><td>Discrimination-aware Channel Pruning (Zhuang et al., 2018)</td><td></td><td>30.36</td><td>11.02</td><td>32.65</td><td>12.40</td><td>1.89×</td></tr><tr><td>Low-cost Collaborative Layers (Dong et al., 2017)</td><td></td><td>30.02</td><td>10.76</td><td>33.67</td><td>13.06</td><td>1.53×</td></tr><tr><td>Channel Gating Neural Networks (Hua et al., 2018)</td><td>广</td><td>30.98</td><td>11.16</td><td>32.60</td><td>12.19</td><td>1.61×</td></tr><tr><td>Feature Boosting and Suppression (FBS)</td><td>√</td><td>29.29</td><td>10.32</td><td>31.83</td><td>11.78</td><td>1.98×</td></tr></table>
Table 2: Comparisons of top-5 error rate increases for VGG-16 on ILSVRC2012 validation set under 3 $\times$ , 4 $\times$ and $5 \times$ speed-up constraints. The baseline has a $1 0 . 1 \%$ top-5 error rate. Results from He et al. (2017) only show numbers with one digit after the decimal point.
<table><tr><td>Method</td><td>Dynamic</td><td>△ top-5 errors 3× 4×</td><td></td><td>(%) 5×</td></tr><tr><td>Filter Pruning (Li et al. (20l7),reproduced by He et al. (2017))</td><td rowspan="10"></td><td></td><td>8.6</td><td>14.6</td></tr><tr><td>Perforated CNNs (Figurnov et al., 2016)</td><td>3.7</td><td>5.5</td><td></td></tr><tr><td>Network Slimming (Liu et al. (20i7),our implementation)</td><td>1.37</td><td>3.26</td><td>5.18</td></tr><tr><td>Runtime Neural Pruning (Lin et al., 2017)</td><td>2.32</td><td>3.23</td><td>3.58</td></tr><tr><td>Channel Pruning (He et al., 2017)</td><td>0.0</td><td>1.0</td><td>1.7</td></tr><tr><td>AutoML for Model Compression (He et al., 2018b)</td><td></td><td></td><td>1.4</td></tr><tr><td>ThiNet-Conv (Luo et al., 2017)</td><td>0.37</td><td></td><td></td></tr><tr><td>Feature Boosting and Suppression (FBS)</td><td></td><td>0.04 0.52</td><td>0.59</td></tr></table>
<table><tr><td rowspan="2">Model</td><td colspan="2">Total Memory Accesses</td><td colspan="2">PeakMemory Usage</td></tr><tr><td>Weights</td><td>Activations</td><td>Edge (1 image)</td><td>Cloud (128 images)</td></tr><tr><td>VGG-16</td><td>56.2MB</td><td>86.5MB</td><td>24.6MB</td><td>3.09GB</td></tr><tr><td>VGG-16 3×</td><td>23.9 MB (2.35x)</td><td>40.8MB (2.12×)</td><td>9.97MB (2.47×)</td><td>1.24 GB (2.47×)</td></tr><tr><td>ResNet-18</td><td>44.6MB</td><td>17.8MB</td><td>9.19MB</td><td>0.47 GB</td></tr><tr><td>ResNet-18 2×</td><td>20.5MB (2.18×)</td><td>12.3 MB (1.45×)</td><td>4.68MB (1.96x)</td><td>0.31GB (1.49×)</td></tr></table>
Table 3: Comparisons of the memory accesses and peak memory usage of the ILSVRC2012 classifiers with FBS respectively under $3 \times$ and $2 \times$ inference speed-ups. The Weights and Activations columns respectively show the total amount of weight and activation accesses required by all convolutions for a single image inference. The Peak Memory Usage columns show the peak memory usages with different batch sizes.
# 5 Conclusion
In summary, we proposed feature boosting and suppression that helps CNNs to achieve significant reductions in the compute required while maintaining high accuracies. FBS fully preserves the capabilities of CNNs and predictively boosts important channels to help the accelerated models retain high accuracies. We demonstrated that FBS achieves around 2 $\times$ and $5 \times$ savings in computation respectively on ResNet-18 and VGG-16 within $0 . 6 \%$ loss of top-5 accuracy. Under the same performance constraints, the accuracy gained by FBS surpasses all recent structured pruning and dynamic execution methods examined in this paper. In addition, it can serve as an off-the-shelf technique for accelerating many popular CNN networks and the fine-tuning process is unified in the traditional SGD which requires no algorithmic changes in training. Finally, the implementation of FBS and the optimized networks are fully open source and released to the public1.
# Acknowledgements
This work is supported in part by the National Key R&D Program of China (No. 2018YFB1004804), the National Natural Science Foundation of China (No. 61806192). We thank EPSRC for providing Yiren Zhao his doctoral scholarship.
# References
Amjad Almahairi, Nicolas Ballas, Tim Cooijmans, Yin Zheng, Hugo Larochelle, and Aaron Courville. Dynamic capacity networks. In Proceedings of the 33rd International Conference on International Conference on Machine Learning (ICML), pp. 2549–2558, 2016.
Jose M Alvarez and Mathieu Salzmann. Learning the number of neurons in deep networks. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems (NIPS), pp. 2270–2278. 2016.
Tolga Bolukbasi, Joseph Wang, Ofer Dekel, and Venkatesh Saligrama. Adaptive neural networks for efficient inference. In Proceedings of the 34th International Conference on Machine Learning (ICML), pp. 527–536, 2017.
J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A large-scale hierarchical image database. In IEEE Conference on Computer Vision and Pattern Recognition, 2009.
Xuanyi Dong, Junshi Huang, Yi Yang, and Shuicheng Yan. More is less: A more complicated network with less inference complexity. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
Michael Figurnov, Maxwell D. Collins, Yukun Zhu, Li Zhang, Jonathan Huang, Dmitry Vetrov, and Ruslan Salakhutdinov. Spatially adaptive computation time for residual networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
Mikhail Figurnov, Aizhan Ibraimova, Dmitry P Vetrov, and Pushmeet Kohli. PerforatedCNNs: Acceleration through elimination of redundant convolutions. In Advances in Neural Information Processing Systems (NIPS), pp. 947–955, 2016.
Yiwen Guo, Anbang Yao, and Yurong Chen. Dynamic network surgery for efficient DNNs. In Advances in Neural Information Processing Systems (NIPS), 2016.
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. In Computer Architecture (ISCA), 2016 ACM/IEEE 43rd Annual International Symposium on, pp. 243–254. IEEE, 2016.
Babak Hassibi, David G. Stork, and Gregory Wolff. Optimal brain surgeon: Extensions and performance comparisons. In J. D. Cowan, G. Tesauro, and J. Alspector (eds.), Advances in Neural Information Processing Systems (NIPS), pp. 263–270. 1994.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the 2015 IEEE International Conference on Computer Vision (ICCV), ICCV ’15, pp. 1026– 1034, Washington, DC, USA, 2015. IEEE Computer Society. ISBN 978-1-4673-8391-2. doi: 10.1109/ICCV.2015.123.
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
Yang He, Guoliang Kang, Xuanyi Dong, Yanwei Fu, and Yi Yang. Soft filter pruning for accelerating deep convolutional neural networks. In International Joint Conference on Artificial Intelligence (IJCAI), pp. 2234–2240, 2018a.
Yihui He, Xiangyu Zhang, and Jian Sun. Channel pruning for accelerating very deep neural networks. IEEE International Conference on Computer Vision (ICCV), pp. 1398–1406, 2017.
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), pp. 784–800, 2018b.
Weizhe Hua, Christopher De Sa, Zhiru Zhang, and G. Edward Suh. Channel gating neural networks. CoRR, abs/1805.12549, 2018. URL http://arxiv.org/abs/1805.12549.
J. Huang, V. Rathod, C. Sun, M. Zhu, A. Korattikara, A. Fathi, I. Fischer, Z. Wojna, Y. Song, S. Guadarrama, and K. Murphy. Speed/accuracy trade-offs for modern convolutional object detectors. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3296–3297, July 2017.
Qiangui Huang, Kevin Zhou, Suya You, and Ulrich Neumann. Learning to prune filters in convolutional neural networks. In IEEE Winter Conference on Computer Vision. 2018.
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Proceedings of the 32Nd International Conference on International Conference on Machine Learning (ICML), 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 (NIPS). 2012.
Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. The CIFAR-10 and CIFAR-100 datasets. http://www.cs.toronto.edu/ kriz/cifar.html, 2014.
Yann LeCun, John S. Denker, and Sara A. Solla. Optimal brain damage. In Advances in Neural Information Processing Systems (NIPS), pp. 598–605. 1990.
Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. 2017.
Ji Lin, Yongming Rao, Jiwen Lu, and Jie Zhou. Runtime neural pruning. In Advances in Neural Information Processing Systems (NIPS), pp. 2181–2191. 2017.
Lanlan Liu and Jia Deng. Dynamic deep neural networks: Optimizing accuracy-efficiency trade-offs by selective execution. 2018.
Zhuang Liu, Jianguo Li, Zhiqiang Shen, Gao Huang, Shoumeng Yan, and Changshui Zhang. Learning efficient convolutional networks through network slimming. In International Conference on Computer Vision (ICCV), 2017.
J. Long, E. Shelhamer, and T. Darrell. Fully convolutional networks for semantic segmentation. In 2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3431–3440, June 2015.
Jian-Hao Luo, Jianxin Wu, and Weiyao Lin. ThiNet: A filter level pruning method for deep neural network compression. In ICCV, pp. 5058–5066, 2017.
Augustus Odena, Dieterich Lawson, and Christopher Olah. Changing model behavior at test-time using reinforcement learning. 2017.
Angshuman Parashar, Minsoo Rhu, Anurag Mukkara, Antonio Puglielli, Rangharajan Venkatesan, Brucek Khailany, Joel Emer, Stephen W Keckler, and William J Dally. Scnn: An accelerator for compressed-sparse convolutional neural networks. In ACM SIGARCH Computer Architecture News, volume 45, pp. 27–40. ACM, 2017.
Mengye Ren, Andrei Pokrovsky, Bin Yang, and Raquel Urtasun. SBNet: Sparse blocks network for fast inference. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
S. Ren, K. He, R. Girshick, and J. Sun. Faster R-CNN: Towards real-time object detection with region proposal networks. IEEE Transactions on Pattern Analysis and Machine Intelligence, 39(6):1137–1149, June 2017.
Noam Shazeer, Azalia Mirhoseini, Krzysztof Maziarz, Andy Davis, Quoc Le, Geoffrey Hinton, and Jeff Dean. Outrageously large neural networks: The sparsely-gated mixture-ofexperts layer. 2017.
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations (ICLR), 2015.
Rupesh Kumar Srivastava, Jonathan Masci, Faustino J. Gomez, and J¨urgen Schmidhuber. Understanding locally competitive networks. In International Conference on Learning Representations (ICLR), 2015.
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 (NIPS), pp. 2074–2082. 2016.
Zuxuan Wu, Tushar Nagarajan, Abhishek Kumar, Steven Rennie, Larry S. Davis, Kristen Grauman, and Rogerio Feris. BlockDrop: Dynamic inference paths in residual networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
Jianbo Ye, Xin Lu, Zhe L. Lin, and James Z. Wang. Rethinking the smaller-norm-lessinformative assumption in channel pruning of convolution layers. In International Conference on Learning Representations (ICLR), 2018.
Yiren Zhao, Xitong Gao, Robert Mullins, and Chengzhong Xu. Mayo: A framework for autogenerating hardware friendly deep neural networks. In Proceedings of 2nd International Workshop on Embedded and Mobile Deep Learning, EMDL ’18. ACM, 2018. doi: 10.1145/ 3212725.3212726. URL http://doi.acm.org/10.1145/3212725.3212726.
Hao Zhou, Jose M. Alvarez, and Fatih Porikli. Less is more: Towards compact cnns. In Bastian Leibe, Jiri Matas, Nicu Sebe, and Max Welling (eds.), Computer Vision – ECCV 2016, pp. 662–677, Cham, 2016. Springer International Publishing. ISBN 978-3-319- 46493-0.
Zhuangwei Zhuang, Mingkui Tan, Bohan Zhuang, Jing Liu, Yong Guo, Qingyao Wu, Junzhou Huang, and Jinhui Zhu. Discrimination-aware channel pruning for deep neural networks. In Advances in Neural Information Processing Systems (NIPS). 2018.
# A Details of M-CifarNet on CIFAR-10
For the CIFAR-10 classification task, we use M-CifarNet, a custom designed CNN, with less than 1.30 M parameters and takes 174 M MACs to perform inference for a 32-by-32 RGB image. The architecture is illustrated in Table 4, where all convolutional layers use $3 \times 3$ kernels, the Shape column shows the shapes of each layer’s features, and pool7 is a global average pooling layer.
We trained M-CifarNet (see Appendix A) with a 0.01 learning rate and a 256 batch size. We reduced the learning rate by a factor of $1 0 \times$ for every 100 epochs. To compare FBS against NS fairly, every model with a new target MACs budget were consecutively initialized with the previous model, and trained for a maximum of 300 epochs, which is enough for all models to converge to the best obtainable accuracies. For NS, we follow Liu et al. (2017) and start training with an $\ell ^ { 1 }$ -norm sparsity regularization weighted by $1 0 ^ { - 5 }$ on the BN scaling factors. We then prune at 150 epochs and fine-tune the resulting network without the sparsity regularization.
We additionally employed image augmentation procedures from Krizhevsky et al. (2012) to preprocess each training example. Each CIFAR-10 example was randomly horizontal flipped and slightly perturbed in the brightness, saturation and hue.
Table 4 additionally provides further comparisons of layer-wise compute costs between FBS, NS, and the composition of the two methods (NS $^ +$ FBS). It is notable that the FBS column has two different output channel counts, where the former is the number of computed channels for each inference, and the latter is the number of channels remaining in the layer after removing the unused channels.
Table 4: The network structure of M-CifarNet for CIFAR-10 classification. In addition, we provide a detailed per-layer MACs comparison between FBS, NS, and the composition of them (NS+FBS). We minimize the models generated by the three methods while maintaining a classification accuracy of at least $9 0 . 5 \%$ .
<table><tr><td>Layer</td><td>Shape</td><td colspan="4">Number of MACs (Output Channels) Original NS FBS</td></tr><tr><td>convo</td><td>30 × 30</td><td></td><td></td><td>893k</td><td>NS+FBS</td></tr><tr><td>conv1</td><td>30 × 30</td><td>1.5 M (64)</td><td>1.3M (52) 27.0M (64)</td><td>(32/62) 8.4M (32/42)</td><td>860k (32) 10.2M (39)</td></tr><tr><td>conv2</td><td>15 ×15</td><td>33.2M (64)</td><td></td><td>4.2M</td><td>5.9M</td></tr><tr><td></td><td>15×15</td><td>16.6M (128)</td><td>15.9 M (123)</td><td>(64/67) 8.3M</td><td>(74 11.6 M</td></tr><tr><td>conv3</td><td>15 ×15</td><td>33.2M (128)</td><td>31.9M (128)</td><td>(64/79)</td><td>(77)</td></tr><tr><td>conv4 conv5</td><td>8×8</td><td>33.2M (128) 14.1M</td><td>33.1M (128) 13.4M (182)</td><td>8.3M (64/83)</td><td>12.1M (77)</td></tr><tr><td>conv6</td><td>8×8</td><td>(192) (192)</td><td>11.6 M (111)</td><td>3.6 M (96/128)</td><td>4.9M (110) 4.3M (67)</td></tr><tr><td>conv7</td><td>8×8</td><td>21.2M 21.2M</td><td>12.3 M</td><td>5.4M (96/152)</td><td></td></tr><tr><td>pool7</td><td></td><td>(192)</td><td>(192)</td><td>5.4 M (96/96)</td><td>4.5M (116)</td></tr><tr><td>fc</td><td>1×1 1×1</td><td>1.9k (10)</td><td>1.9k (10)</td><td>960 (10)</td><td>1.1k (10)</td></tr><tr><td></td><td></td><td>174.3M</td><td>146.5M</td><td></td><td></td></tr><tr><td>Total Saving</td><td></td><td>1</td><td>1.19×</td><td>44.3M 3.93×</td><td>54.2M 3.21×</td></tr></table>
Figure 4 shows how the skipping probabilites heat maps of the convolutional layer conv4 evolve as we fine-tune FBS-augmented M-CifarNet. The network was trained for 12 epochs, and we saved the model at every epoch. The heat maps are generated with the saved models in sequence, where we apply the same reordering to all heat map channels with the sorted result from the first epoch. It can be observed that as we train the network, the channel skipping probabilites become more pronounced.
 Figure 4: The training history of a convolutional layer conv4 in M-CifarNet. The history is visualized by the 12 skipping probabilites heat maps, where the heights denote the 10 categories in CIFAR-10, and channels in conv4 occupy the width.
# B Details of the ILSVRC2012 classifiers
ILSVRC2012 classifiers, i.e. ResNet-18 and VGG-16, were trained with a procedure similar to Appendix A. The difference was that they were trained for a maximum of 35 epochs, the learning rate was decayed for every 20 epochs, and NS models were all pruned at 15 epochs. For image preprocessing, we additionally cropped and stretched/squeezed images randomly following Krizhevsky et al. (2012).
Since VGG-16 is computationally intensive with over 15 G MACs, We first applied NS on VGG-16 to reduce the computational and memory requirements, and ease the training of the FBS-augmented variant. We assigned a $1 \%$ budget in top-5 accuracy degradation and compressed the network using NS, which gave us a smaller VGG-16 with $2 0 \%$ of all channels pruned. The resulting network is a lot less redundant, which almost halves the compute requirements, with only 7.90 G MACs remaining. We then apply FBS to the well-compressed network.
Residual networks (He et al., 2016), such as ResNet-18, adopt sequential structure of residual blocks: $\mathbf { x } _ { b } = K \left( \mathbf { x } _ { b - 1 } \right) + F \left( \mathbf { x } _ { b - 1 } \right)$ , where $\mathbf { x } _ { b }$ is the output of the $b ^ { \mathrm { t h } }$ block, $K$ is either an identity function or a downsampling convolution, and $F ^ { \prime }$ consists of a sequence of convolutions. For residual networks, we directly apply FBS to all convolutional layers, with a difference in the way we handle the feature summation. Because the $\left( b + 1 \right) ^ { \mathrm { t h } }$ block receives as input the sum of the two features with sparse channels $K \left( \mathbf { x } _ { b - 1 } \right)$ and $F \left( \mathbf { x } _ { b - 1 } \right)$ , a certain channel of this sum is treated as sparse when the same channels in both features are simultaneously sparse.
Figure 5 compares the accuracy/performance trade-off curves between FBS and NS for ResNet-18.
 Figure 5: The accuracy/performance trade-off comparison between NS and FBS for ResNet18 on the ImageNet ILSVRC2012 validation set.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395# EMERGENT COORDINATION THROUGH COMPETITION
Siqi Liu∗, Guy Lever∗, Josh Merel, Saran Tunyasuvunakool, Nicolas Heess, Thore Graepel DeepMind London, United Kingdom {liusiqi,guylever,jsmerel,stunya,heess,thore}@google.com
# ABSTRACT
We study the emergence of cooperative behaviors in reinforcement learning agents by introducing a challenging competitive multi-agent soccer environment with continuous simulated physics. We demonstrate that decentralized, populationbased training with co-play can lead to a progression in agents’ behaviors: from random, to simple ball chasing, and finally showing evidence of cooperation. Our study highlights several of the challenges encountered in large scale multi-agent training in continuous control. In particular, we demonstrate that the automatic optimization of simple shaping rewards, not themselves conducive to co-operative behavior, can lead to long-horizon team behavior. We further apply an evaluation scheme, grounded by game theoretic principals, that can assess agent performance in the absence of pre-defined evaluation tasks or human baselines.
# 1 INTRODUCTION
Competitive games have been grand challenges for artificial intelligence research since at least the 1950s (Samuel, 1959; Tesauro, 1995; Campbell et al., 2002; Vinyals et al., 2017). In recent years, a number of breakthroughs in AI have been made in these domains by combining deep reinforcement learning (RL) with self-play, achieving superhuman performance at Go and Poker (Silver et al., 2016; Moravk et al., 2017). In continuous control domains, competitive games possess a natural curriculum property, as observed in Bansal et al. (2017), where complex behaviors have the potential to emerge in simple environments as a result of competition between agents, rather than due to increasing difficulty of manually designed tasks. Challenging collaborative-competitive multi-agent environments have only recently been addressed using end-to-end RL by Jaderberg et al. (2018), which learns visually complex first-person 2v2 video games to human level. One longstanding challenge in AI has been robot soccer (Kitano et al., 1997), including simulated leagues, which has been tackled with machine learning techniques (Riedmiller et al., 2009; MacAlpine & Stone, 2018) but not yet mastered by end-to-end reinforcement learning.
We investigate the emergence of co-operative behaviors through multi-agent competitive games. We design a simple research environment with simulated physics in which complexity arises primarily through competition between teams of learning agents. We introduce a challenging multi-agent soccer environment, using MuJoCo (Todorov et al., 2012) which embeds soccer in a wider universe of possible environments with consistent simulated physics, already used extensively in the machine learning research community (Heess et al., 2016; 2017; Bansal et al., 2017; Brockman et al., 2016; Tassa et al., 2018; Riedmiller et al., 2018). We focus here on multi-agent interaction by using relatively simple bodies with a 3-dimensional action space (though the environment is scalable to more agents and more complex bodies).1 We use this environment to examine continuous multiagent reinforcement learning and some of its challenges including coordination, use of shaping rewards, exploitability and evaluation.
We study a framework for continuous multi-agent RL based on decentralized population-based training (PBT) of independent RL learners (Jaderberg et al., 2017; 2018), where individual agents learn off-policy with recurrent memory and decomposed shaping reward channels. In contrast to some recent work where some degree of centralized learning was essential for multi-agent coordinated behaviors (e.g. Lowe et al., 2017; Foerster et al., 2016), we demonstrate that end-to-end PBT can lead to emergent cooperative behaviors in our soccer domain. While designing shaping rewards that induce desired cooperative behavior is difficult, PBT provides a mechanism for automatically evolving simple shaping rewards over time, driven directly by competitive match results. We further suggest to decompose reward into separate weighted channels, with individual discount factors and automatically optimize reward weights and corresponding discounts online. We demonstrate that PBT is able to evolve agents’ shaping rewards from myopically optimizing dense individual shaping rewards through to focusing relatively more on long-horizon game rewards, i.e. individual agent’s rewards automatically align more with the team objective over time. Their behavior correspondingly evolves from random, through simple ball chasing early in the learning process, to more co-operative and strategic behaviors showing awareness of other agents. These behaviors are demonstrated visually and we provide quantitative evidence for coordination using game statistics, analysis of value functions and a new method of analyzing agents’ counterfactual policy divergence.
Finally, evaluation in competitive multi-agent domains remains largely an open question. Traditionally, multi-agent research in competitive domains relies on handcrafted bots or established human baselines (Jaderberg et al., 2018; Silver et al., 2016), but these are often unavailable and difficult to design. In this paper, we highlight that diversity and exploitability of evaluators is an issue, by observing non-transitivities in the agents pairwise rankings using tournaments between trained teams. We apply an evaluation scheme based on Nash averaging (Balduzzi et al., 2018) and evaluate our agents based on performance against pre-trained agents in the support set of the Nash average.
# 2 PRELIMINARIES
We treat our soccer domain as a multi-agent reinforcement learning problem (MARL) which models a collection of agents interacting with an environment and learning, from these interactions, to optimize individual cumulative reward. MARL can be cooperative, competitive or some mixture of the two (as is the case in soccer), depending upon the alignment of agents’ rewards. MARL is typically modelled as a Markov game (Shapley, 1953; Littman, 1994), which comprises: a state space $s$ , $n$ agents with observation and action sets $O ^ { 1 } , . . . , O ^ { n }$ and $\mathcal { A } ^ { 1 } , . . . , \mathcal { A } ^ { n }$ ; a (possibly stochastic) reward function $R ^ { i } : \mathcal { S } \times \mathcal { A } ^ { i } \mathbb { R }$ for each agent; observation functions $\phi ^ { i } : { \bar { \cal S } } { \bar { \cal O } } ^ { i }$ ; a transition function $P$ which defines the conditional distribution over successor states given previous state-actions: $P ( S _ { t + 1 } | S _ { t } , A _ { t } ^ { 1 } , . . . , A _ { t } ^ { n } )$ , which satisfies the Markov property $P ( S _ { t + 1 } \bar { | } S _ { \tau } , \dot { A _ { \tau } ^ { 1 } } , . . . , A _ { \tau } ^ { n } , \forall \tau \leq t ) =$ $P ( S _ { t + 1 } | S _ { t } , A _ { t } ^ { 1 } , . . . , A _ { t } ^ { n } )$ ; and a start state distribution $P _ { 0 } ( S _ { 0 } )$ on $s$ . In our application the state and action sets are continuous, and the transition distributions should be thought of as densities. Each agent $i$ sequentially chooses actions, $a _ { t } ^ { i }$ , at each timestep $t$ , based on their observations, $\phi _ { t } ^ { i } = \phi ^ { i } ( s _ { t } )$ , and these interactions give rise to a trajectory $\bigl ( \bigl ( s _ { t } , a _ { t } ^ { 1 } , . . . , a _ { t } ^ { n } , r _ { t } ^ { 1 } , . . . , r _ { t } ^ { n } \bigr ) \bigr ) _ { t = 1 , 2 , . . . , H }$ , over a horizon $H$ , where at each time step $S _ { t + 1 } \sim P ( \cdot | s _ { t } , a _ { t } ^ { 1 } , . . . , a _ { t } ^ { n } )$ , and $r _ { t } ^ { i } = R ^ { i } ( s _ { t } , a _ { t } ^ { i } )$ . Each agent aims to maximize expected cumulative reward, $\mathbb { E } [ \sum _ { t = 0 } ^ { H } \gamma ^ { t } r _ { t } ^ { i } ]$ (discounted by a factor $\gamma < 1$ to ensure convergence when $H$ is infinite), and chooses actions according to a policy $a _ { t } ^ { i } \sim \pi ^ { i } ( \cdot | x _ { t } ^ { i } )$ , which in general can be any function of the history $\ v { x } _ { t } ^ { i }$ of the agent’s prior observations and actions at time $t$ , $\overline { { x } } _ { t } ^ { i } : = ( \phi ^ { i } ( s _ { 1 } ) , a _ { 1 } ^ { i } , . . . , \phi ^ { i } ( s _ { t - 1 } ) , a _ { t - 1 } ^ { i } , \phi ^ { i } \bar { ( s _ { t } ) } )$ . The special case of a Markov game with one agent is a partially-observed Markov decision process (POMDP) (Sutton & Barto, 1998). In this work all players have the same action and observation space.
# 3 METHODS
We seek a method of training agents which addresses the exploitability issues of competitive games, arising from overfitting to a single opponents policy, and provides a method of automatically optimizing hyperparameters and shaping rewards online, which are otherwise hard to tune. Following Jaderberg et al. (2018), we combine algorithms for single-agent RL (in our case, SVG0 for continuous control) with population-based training (PBT) (Jaderberg et al., 2017). We describe the individual components of this framework, and several additional novel algorithmic components introduced in this paper.
# 3.1 POPULATION BASED TRAINING
Population Based Training (PBT) (Jaderberg et al., 2017) was proposed as a method to optimize hyperparameters via a population of simultaneously learning agents: during training, poor performing agents, according to some fitness function, inherit network parameters and some hyperparameters from stronger agents, with additional mutation. Hyperparameters can continue to evolve during training, rather than committing to a single fixed value (we show that this is indeed the case in Section 5.1). PBT was extended to incorporate co-play (Jaderberg et al., 2018) as a method of optimizing agents for MARL: subsets of agents are selected from the population to play together in multi-agent games. In any such game each agent in the population effectively treats the other agents as part of their environment and learns a policy $\pi _ { \theta }$ to optimize their expected return, averaged over such games. In any game in which $\pi _ { \theta }$ controls player $i$ in the game, if we denote by $\overline { { { \pi } } } _ { \backslash i } : = \{ \pi ^ { j } \} _ { j \in \{ 1 , 2 , . . . , n \} , j \neq i }$ the policies of the other agents $j \neq i$ , we can write the expected cumulative return over a game as
Algorithm 1 Population-based Training for Multi-Agent RL.
<table><tr><td colspan="2">1: procedure PBT-MARL</td></tr><tr><td>2: 3:</td><td>{Ai}i∈[1.,N] N independent agents forming a population. for agent Ai in {Ai}i∈[1.,N] do</td></tr><tr><td>4:</td><td>Initialize agent network parameters 0i and agent rating ri to fixed initial rating Rinit.</td></tr><tr><td>5: 6:</td><td>Sample initial hyper-parameter 0' from the initial hyper-parameter distribution.</td></tr><tr><td>end for</td><td></td></tr><tr><td>7: while true do</td><td></td></tr><tr><td>8:</td><td>Agents play TrainingMatches and update network parameters by Retrace-SVG0.</td></tr><tr><td>9:</td><td>for match result (si,sj) ∈ TrainingMatches do</td></tr><tr><td>10:</td><td>UpdateRating(ri,rj,Si,Sj) See Appendix B.1</td></tr><tr><td>11: 12:</td><td>end for</td></tr><tr><td>13:</td><td>for agent Ai E {Ai}ie[1,., N] do Evolution Procedure</td></tr><tr><td>14:</td><td>if Eligible(Ai) then > See Appendix B.2</td></tr><tr><td>15:</td><td>Aj←Select(Ai,{Ai}iε∈[1..,N];i≠j) See Appendix B.3</td></tr><tr><td>16:</td><td>if Aj ≠ NULL then</td></tr><tr><td>17:</td><td>Inherit(0,0,,) >Ai inherits from Aj,See Appendix B.4</td></tr><tr><td>18:</td><td>←Mutate(0) See Appendix B.5</td></tr><tr><td>19:</td><td>end if</td></tr><tr><td>20:</td><td>end if</td></tr><tr><td>21:</td><td>end for</td></tr><tr><td>22:</td><td>end while</td></tr><tr><td>end procedure</td><td></td></tr></table>
$$J ^ { i } ( \pi _ { \theta } ; \pi _ { \setminus i } ) : = \mathbb { E } \left[ \sum _ { t = 0 } ^ { H } \gamma ^ { t } r _ { t } ^ { i } | \pi ^ { i } = \pi _ { \theta } , \pi _ { \setminus i } \right]$$
where the expectation is w.r.t. the environment dynamics and conditioned on the actions being drawn from policies $\pi _ { \theta }$ and $\pi _ { \backslash i }$ . Each agent in the population attempts to optimize (1) averaged over the draw of all agents from the population $\mathcal { P }$ , leading to the PBT objective $J ( \pi _ { \theta } ) : =$ $\bar { \mathbb { E } _ { i } } [ \mathbb { E } _ { \pi _ { \backslash i } \sim \mathcal { P } } [ J ^ { i } ( \pi _ { \theta } ; \pi _ { \setminus i } ) | \pi ^ { i } = \pi _ { \theta } ] ]$ , where the outer expectation is w.r.t. the probability that the agent with policy $\pi _ { \theta }$ controls player $i$ in the environment, and the inner expectation is the expectation over the draw of other agents, conditioned on $\pi _ { \theta }$ controlling player $i$ in the game. PBT achieves some robustness to exploitability by training a population of learning agents against each other. Algorithm 1 describes PBT-MARL for a population of $N$ agents $\{ A _ { i } \} _ { i \in [ 1 , \ldots , N ] }$ , employed in this work.
# 3.2 RETRACE-SVG0
Throughout our experiments we use Stochastic Value Gradients (SVG0) (Heess et al., 2015b) as our reinforcement learning algorithm for continuous control. This is an actor-critic policy gradient algorithm, which in our setting is used to estimate gradients $\textstyle { \frac { \partial } { \partial \theta } } J ^ { i } ( \pi _ { \theta } ; \pi _ { \setminus i } )$ of the objective (1) for each game. Averaging these gradients over games will effectively optimize the PBT objective $J ( \pi _ { \theta } )$ . Policies are additionally regularized with an entropy loss $H ( \pi )$ i.e. we maximize ${ \hat { J } } ( \pi _ { \theta } ) : = { }$ $J ( \pi _ { \theta } ) + \alpha H ( \pi _ { \theta } )$ using the Adam optimizer (Kingma & Ba, 2014) to apply gradient updates where $\alpha$ represents a multiplicative entropy cost factor. A derivation of SVG0 is provided in Appendix A.
SVG utilizes a differentiable Q-critic. Our critic is learned using experience replay, minimizing a $k$ -step TD-error with off-policy retrace corrections (Munos et al., 2016), using a separate target network for bootstrapping, as is also described in Hausman et al. (2018); Riedmiller et al. (2018). The identity of other agents $\pi _ { \backslash i }$ in a game are not explicitly revealed but are potentially vital for accurate action-value estimation (value will differ when playing against weak rather than strong opponents). Thus, we use a recurrent critic to enable the $Q$ -function to implicitly condition on other players observed behavior, better estimate the correct value for the current game, and generalize over the diversity of players in the population of PBT, and, to some extent, the diversity of behaviors in replay. We find in practice that a recurrent $Q$ -function, learned from partial unrolls, performs very well. Details of our Q-critic updates, including how memory states are incorporated into replay, are given in Appendix A.2.
# 3.3 DECOMPOSED DISCOUNTS AND ACTION-VALUE ESTIMATION FOR REWARD SHAPING
Reinforcement learning agents learning in environments with sparse rewards often require additional reward signal to provide more feedback to the optimizer. Reward can be provided to encourage agents to explore novel states for instance (e.g. Brafman & Tennenholtz, 2001), or some other form of intrinsic motivation. Reward shaping is particularly challenging in continuous control (e.g. Popov et al., 2017) where obtaining sparse rewards is often highly unlikely with random exploration, but shaping can perturb objectives (e.g. Bagnell & Ng, 2005) resulting in degenerate behaviors. Reward shaping is yet more complicated in the cooperative multi-agent setting in which independent agents must optimize a joint objective. Team rewards can be difficult to co-optimize due to complex credit assignment, and can result in degenerate behavior where one agent learns a reasonable policy before its teammate, discouraging exploration which could interfere with the first agent’s behavior as observed by Hausknecht (2016). On the other hand, it is challenging to design shaping rewards which induce desired co-operative behavior.
We design $n _ { r }$ shaping reward functions $\{ r _ { j } : \mathcal { S } \times \mathcal { A } \mathbb { R } \} _ { j = 1 , \dots , n _ { r } }$ , weighted so that $r ( \cdot ) : =$ Pnrj=1 $\begin{array} { r } { \sum _ { j = 1 } ^ { n _ { r } } \alpha _ { j } r _ { j } ( \cdot ) } \end{array}$ is the agent’s internal reward and, as in Jaderberg et al. (2018), we use populationbased training to optimize the relative weighting $\{ \alpha _ { j } \} _ { j = 1 , \ldots , n _ { r } }$ . Our shaping rewards are simple individual rewards to help with exploration, but which would induce degenerate behaviors if badly scaled. Since the fitness function used in PBT will typically be the true environment reward (in our case win/loss signal in soccer), the weighting of shaping rewards can in principle be automatically optimized online using the environment reward signal. One enhancement we introduce is to optimize separate discount factors is then (recalling Equati $\{ \gamma _ { j } \} _ { j = 1 , \dots , n _ { r } }$ $\begin{array} { r } { J ( \pi _ { \theta } ; \pi _ { \setminus i } ) : = \mathbb { E } \big [ \sum _ { j = 1 } ^ { n _ { r } } \alpha _ { j } \sum _ { t = 0 } ^ { H } \gamma _ { j } ^ { t } r _ { j } \big ( s _ { t } , a _ { t } ^ { 1 } , . . . , a _ { t } ^ { n } \big ) \big | \pi ^ { i } = \pi _ { \theta } , \pi _ { \setminus i } \big ] } \end{array}$ . This separation of discount factors enables agents to learn to optimize the sparse environment reward far in the future with a high discount factor, but optimize dense shaping rewards myopically, which would also make value-learning easier. This would be impossible if discounts were confounded. The specific shaping rewards used for soccer are detailed in Section 5.1.
# 4 EXPERIMENTAL SETUP
# 4.1 MUJOCO SOCCER ENVIRONMENT
We simulate 2v2 soccer using the MuJoCo physics engine (Todorov et al., 2012). The 4 players in the game are a single sphere (the body) with 2 fixed arms, and a box head, and have a 3-dimensional action space: accelerate the body forwards/backwards, torque can be applied around the vertical axis to rotate, and apply downwards force to “jump”. Applying torque makes the player spin, gently for steering, or with more force in order to “kick” the football with its arms. At each timestep, proprioception (position, velocity, accelerometer information), task (egocentric ball position, velocity and angular velocity, goal and corner positions) and teammate and opponent (orientation, position and velocity) features are observed making a 93-dimensional input observation vector. Each soccer match lasts upto 45 seconds, and is terminated when the first team scores. We disable contacts between the players, but enable contacts between the players, the pitch and the ball. This makes it impossible for players to foul and avoids the need for a complicated contact rules, and led to more dynamic matches. There is a small border around the pitch which players can enter, but when the ball is kicked out-of-bounds it is reset by automatic “throw in” a small random distance towards the center of the pitch, and no penalty is incurred. The players choose a new action every 0.05 seconds. At the start of an episode the players and ball are positioned uniformly at random on the pitch. We train agents on a field whose dimensions are randomized in the range $2 0 m \times 1 5 m$ to $2 8 m \times 2 1 m$ , with fixed aspect ratio, and are tested on a field of fixed size $2 4 m \times 1 8 m$ . We show an example frame of the game in Figure 1.
 Figure 1: Top-down view with individual camera views of 2v2 multi-agent soccer environment.
# 4.2 PBT SETTINGS
We use population-based training with 32 agents in the population, an agent is chosen for evolution if its expected win rate against another chosen agent drops below 0.47. The $\mathbf { k }$ -factor learning rate for Elo is 0.1 (this is low, due to the high stochasticity in the game results). Following evolution there is a grace period where the agent does not learn while its replay buffer refills with fresh data, and a further “burn-in” period before the agent can evolve again or before its weights can be copied into another agent, in order to limit the frequency of evolution and maintain diversity in the population. For each 2v2 training match 4 agents were selected uniformly at random from the population of 32 agents, so that agents are paired with diverse teammates and opponents.
# 4.3 EVALUATION
Unlike multi-agent domains where we possess hand-crafted bots or human baselines, evaluating agent performance in novel domains where we do not possess such knowledge remains an open question. A number of solutions have been proposed: for competitive board games, there exits evaluation metrics such as Elo (Elo, 1978) where ratings of two players should translate to their relative win-rates; in professional team sports, head-to-head tournaments are typically used to measure team performance; in Al-Shedivat et al. (2017), survival-of-the-fittest is directly translated to multiagent learning as a proxy to relative agent performance. Unfortunately, as shown in Balduzzi et al. (2018), in a simple game of rock-paper-scissors, a rock-playing agent will attain high Elo score if we simply introduce more scissor-play agents into a tournament. Survival-of-the-fittest analysis as shown in Al-Shedivat et al. (2017) would lead to a cycle, and agent ranking would depend on when measurements are taken (Tuyls et al., 2018).
Nash-Averaging Evaluators: One desirable property for multi-agent evaluation is invariance to redundant agents: i.e. the presence of multiple agents with similar strategies should not bias the ranking. In this work, we apply Nash-averaging which possesses this property. Nash-Averaging consists of a meta-game played using a pair-wise win-rate matrix between $_ \mathrm { N }$ agents. A row player and a column player simultaneously pick distributions over agents for a mixed strategy, aiming for a non-exploitable strategy (see Balduzzi et al., 2018).
In order to meaningfully evaluate our learned agents, we need to bootstrap our evaluation process. Concretely, we choose a set of fixed evaluation teams by Nash-averaging from a population of 10 teams previously produced by diverse training schemes, with 25B frames of learning experience each. We collected 1M tournament matches between the set of 10 agents. Figure 2 shows the pairwise expected goal difference among the 3 agents in the support set. Nash Averaging assigned nonzero weights to 3 teams that exhibit diverse policies with non-transitive performance which would not have been apparent under alternative evaluation schemes: agent A wins or draws against agent B on $5 9 . 7 \%$ of the games; agent B wins or draws against agent C on $7 1 . 1 \%$ of the games and agent C wins or draws against agent A on $6 5 . 3 \%$ of the matches. We show recordings of example tournament matches between agent A, B and C to demonstrate qualitatively the diversity in their policies (video 3 on the website 2). Elo rating alone would yield a different picture: agent $B$ is the best agent in the tournament with an Elo rating of 1084.27, followed by $C$ at 1068.85; Agent $A$ ranks 5th at 1016.48 and we would have incorrectly concluded that agent $\pmb { B }$ ought to beat agent A with a win-rate of $62 \%$ . All variants of agents presented in the experimental section are evaluated against the set of 3 agents in terms of their pair-wise expected difference in score, weighted by support weights.
 Figure $2 \colon L I$ : selected set of agents in Nash support set with their respective support weights. $L 2$ : pair-wise expected goal difference among evaluator agents. $L 3$ : Elo ratings for all agents computed from tournament matches. $L 4$ : pair-wise expected goal difference among all agents.
# 5 RESULTS
We describe in this section a set of experimental results. We first present the incremental effect of various algorithmic components. We further show that population-based training with co-play and reward shaping induces a progression from random to simple ball chasing and finally coordinated behaviors. A tournament between all trained agents is provided in Appendix D.
# 5.1 ABLATION STUDY
We incrementally introduce algorithmic components and show the effect of each by evaluating them against the set of 3 evaluation agents. We compare agent performance using expected goal difference weighted according to the Nash averaging procedure. We annotate a number of algorithmic components as follows: ff: feedforward policy and action-value estimator; evo: population-based training with agents evolving within the population; rwd shp: providing dense shaping rewards on top of sparse environment scoring/conceding rewards; lstm: recurrent policy with recurrent action-value estimator; lstm q: feedforward policy with recurrent action-value estimator; channels: decomposed action-value estimation for each reward component; each with its own, individually evolving discount factor.
Population-based Training with Evolution: We first introduce PBT with evolution. Figure 3 (ff vs $\mathbf { f } \mathbf { f } + \mathbf { e v } \mathbf { o } { \mathrm { ~ , ~ } }$ ) shows that Evolution kicks in at 2B steps, which quickly improves agent performance at the population level. We show in Figure 4 that Population-based training coupled with evolution yields a natural progression of learning rates, entropy costs as well as the discount factor. Critic learning rate gradually decreases as training progresses, while discount factor increases over time, focusing increasingly on long-term return. Entropy costs slowly decreases which reflects a shift from exploration to exploitation over the course training.
Reward Shaping: We introduced two simple dense shaping rewards in addition to the sparse scoring and conceding environment rewards: vel-to-ball: player’s linear velocity projected onto its unit direction vector towards the ball, thresholded at zero; vel-ball-to-goal: ball’s linear velocity projected onto its unit direction vector towards the center of opponent’s goal. Furthermore the sparse goal reward and concede penalty are separately evolved, and so can receive separate weight that trades off between the importance of scoring versus conceding.
 Figure 3: Weighted expected goal difference shown in blue line. Agents’ expected goal difference against each evaluator agent in point plot. A dummy evaluator that takes random actions has been introduced to show learning progress early in the training, with zero weight in the performance computation.
 Figure 4: Evolution of hyper-parameters. Hyperparameters of individual agents within the population in gray.
Dense shaping rewards make learning significantly easier early in training. This is reflected by agents’ performance against the dummy evaluator where agents with dense shaping rewards quickly start to win games from the start (Figure 3, $\mathbf { f } \mathbf { f } + \mathbf { e } \mathbf { v } \mathbf { 0 }$ vs $\mathbf { f f } + \mathbf { e v 0 } +$ rwd shp). On the other hand, shaping rewards tend to induce sub-optimal policies $\mathrm { N g }$ et al., 1999; Popov et al., 2017); We show in Figure 5 however that this is mitigated by coupling training with hyper-parameter evolution which adaptively adjusts the importance of shaping rewards. Early on in the training, the population as a whole decreases the penalty of conceding a goal which evolves towards zero, assigning this reward relatively lower weight than scoring. This trend is subsequently reversed towards the end of training, where the agents evolved to pay more attention to conceding goals: i.e. agents first learn to optimize scoring and then incorporate defending. The dense shaping reward vel-to-ball however quickly decreases in relative importance which is mirrored in their changing behavior, see Section 5.2.
Recurrence: The introduction of recurrence in the action-value function has a significant impact on agents’ performance as shown in Figure 3 $\mathbf { f f } + \mathbf { e v 0 } +$ rwd shp vs $\mathbf { l s t m + e v 0 + }$ rwd shp reaching weighted expected goal difference of 0 at 22B vs 35B steps). A recurrent policy seems to underperform its feedforward counterpart in the presence of a recurrent action-value function. This could be due to out-of-sample evaluators which suggests that recurrent policy might overfit to the behaviors of agents from its own population while feedforward policy cannot.
Decomposed Action-Value Function: While we observed empirically that the discount factor increases over time during the evolution process, we hypothesize that different reward components require different discount factor. We show in Figure 6 that this is indeed the case, for sparse environment rewards and vel-ball-to-goal, the agents focus on increasingly long planning horizon. In contrast, agents quickly evolve to pay attention to short-term returns on vel-to-ball, once they learned the basic movements. Note that although this agent underperforms l $\mathbf { s t m + e v 0 + }$ rwd shp asymptotically, it achieved faster learning in comparison (reaching 0.2 at 15B vs 35B). This agent also attains the highest Elo in a tournament between all of our trained agents, see Appendix D. This indicates that the training population is less diverse than the Nash-averaging evaluation set, motivating future work on introducing diversity as part of training regime.
 Figure 5: Evolution of relative importance of dense shaping rewards over the course of training. Hyperparameters of individual agents within the population in gray.
 Figure 6: Evolution of discount factor for each reward component. We show hyperparameters of individual agents within the population in gray.
# 5.2 EMERGENT MULTI-AGENT BEHAVIORS
Assessing cooperative behavior in soccer is difficult. We present several indicators ranging from behavior statistics, policy analysis to behavior probing and qualitative game play in order to demonstrate the level of cooperation between agents.
We provide birds-eye view videos on the website2 (video 1), where each agent’s value-function is also plotted, along with a bar plot showing the value-functions for each weighted shaping reward component. Early in the matches the 2 dense shaping rewards (rightmost channels) dominate the value, until it becomes apparent that one team has an advantage at which point all agent’s value functions become dominated by the sparse conceding/scoring reward (first and second channels) indicating that PBT has learned a balance between sparse environment and dense shaping rewards so that positions with a clear advantage to score will be preferred. There are recurring motifs in the videos: for example, evidence that agents have learned a “cross” pass from the sideline to a teammate in the centre (see Appendix F for example traces), and frequently appear to anticipate this and change direction to receive. Another camera angle is provided on the website2 (video 2) showing representative, consecutive games played between two fixed teams. These particular agents generally kick the ball upfield, avoiding opponents and towards teammates.
# 5.2.1 BEHAVIOR STATISTICS
Statistics collected during matches are shown in Figure 7. The vel-to-ball plot shows the agents average velocity towards the ball as training progresses: early in the learning process agents quickly maximize their velocity towards the ball (optimizing their shaping reward) but gradually fixate less on simple ball chasing as they learn more useful behaviors, such as kicking the ball upfield. The teammate-spread-out shows the evolution of the spread of teammates position on the pitch. This shows the percentage of timesteps where the teammates are spread at least $5 \mathrm { m }$ apart: both agents quickly learn to hog the ball, driving this lower, but over time learn more useful behaviors which result in diverse player distributions. pass/interception shows that pass, where players from the same team consecutively kicked the ball and interception, where players from the opposing teams kicked the ball in sequence, both remain flat throughout training. To pass is the more difficult behavior as it requires two teammates to coordinate whereas interception only requires one of the two opponents to position correctly. pass/interception-10m logs pass/interception events over more than $1 0 \mathrm { m }$ , and here we see a dramatic increase in pass-10m while interception-10m remains flat, i.e. long range passes become increasingly common over the course of training, reaching equal frequency as long-range interception.
 Figure 7: Behavior statistics evolution.
 Figure 8: $L l$ : agent’s average velocity towards the ball. $L 2$ : percentage of time when players within a team are spread out. $L 3$ : KL divergence incurred by replacing a subset of state with counterfactual information.
# 5.2.2 COUNTERFACTUAL POLICY DIVERGENCE
In addition to analyzing behavior statistics, we could ask the following: “had a subset of the observation been different, how much would I have changed my policy?”. This reveals the extent to which an agent’s policy is dependent on this subset of the observation space. To quantify this, we analyze counterfactual policy divergence: at each step, we replace a subset of the observation with 10 valid alternatives, drawn from a fixed distribution, and we measure the KL divergence incurred in agents’ policy distributions. This cannot be measured for a recurrent policy due to recurrent states and we investigate $\mathbf { f f } + \mathbf { e v 0 } +$ rwd shp instead (Figure 3), where the policy network is feedforward. We study the effect of five types of counterfactual information over the course of training.
ball-position has a strong impact on agent’s policy distribution, more so than player and opponent positions. Interestingly, ball-position initially reaches its peak quickly while divergence incurred by counterfactual player/opponent positions plateau until reaching 5B training steps. This phase coincides with agent’s greedy optimization of shaping rewards, as reflected in Figure 8. Counterfactual teammate/opponent position increasingly affect agents’ policies from 5B steps, as they spread out more and run less directly towards the ball. Opponent-0/1-position incur less divergence than teammate position individually, suggesting that teammate position has relatively large impact than any single opponent, and increasingly so during 5B-20B steps. This suggests that comparatively players learn to leverage a coordinating teammate first, before paying attention to competing opponents. The gap between teammate-position and opponents-position eventually widens, as opponents become increasingly relevant to the game dynamics. The progression observed in counterfactual policy divergence provides evidence for emergent cooperative behaviors among the players.
# 5.2.3 MULTI-AGENT BEHAVIOR PROBING
Qualitatively, we could ask the following question: would agents coordinate in scenarios where it’s clearly advantageous to do so? To this end, we designed a probe task, to test our trained agents for coordination, where blue0 possesses the ball, while the two opponents are centered on the pitch in front. A teammate blue1 is introduced to either left or right side. In Figure 9 we show typical traces of agents’ behaviors (additional probe task video shown at Video 4 on our website2): at 5B steps, when agents play more individualistically, we observe that blue0 always tries to dribble the ball by itself, regardless of the position of blue1. Later on in the training, blue0 actively seeks to pass and its behavior is driven by the configuration of its teammate, showing a high-level of coordination. In “8e10 left” in particular, we observe two consecutive pass (blue0 to blue1 and back), in the spirit of 2-on-1 passes that emerge frequently in human soccer games.
 Figure 9: L1: Comparison between two snapshots (5B vs 80B) of the same agent. $L 2$ : number of successful passes and interception occurred in the first 100 timesteps, aggregated over 100 episodes.
<table><tr><td></td><td>pass</td><td>intercept</td></tr><tr><td>5B_left</td><td>0</td><td>100</td></tr><tr><td>5B_right</td><td>31</td><td>90</td></tr><tr><td>80B_left</td><td>76</td><td>24</td></tr><tr><td>80B_right</td><td>56</td><td>27</td></tr></table>
# 6 RELATED WORK
The population-based training we use here was introduced by Jaderberg et al. (2018) for the capturethe-flag domain, whereas our implementation is for continuous control in simulated physics which is less visually rich but arguably more open-ended, with potential for sophisticated behaviors generally and allows us to focus on complex multi-agent interactions, which may often be physically observable and interpretable (as is the case with passing in soccer). Other recent related approaches to multi-agent training include PSRO (Lanctot et al., 2017) and NFSP (Heinrich & Silver, 2016), which are motivated by game-theoretic methods (fictitious play and double oracle) for solving matrix games, aiming for some robustness by playing previous best response policies, rather than the (more data efficient and parallelizable) approach of playing against simultaneous learning agents in a population. The RoboCup competition is a grand challenge in AI and some top-performing teams have used elements of reinforcement learning (Riedmiller et al., 2009; MacAlpine & Stone, 2018), but are not end-to-end RL. Our environment is intended as a research platform, and easily extendable along several lines of complexity: complex bodies; more agents; multi-task, transfer and continual learning. Coordination and cooperation has been studied recently in deepRL in, for example, Lowe et al. (2017); Foerster et al. (2018; 2016); Sukhbaatar et al. (2016); Mordatch & Abbeel (2018), but all of these require some degree of centralization. Agents in our framework perform fully independent asynchronous learning yet demonstrate evidence of complex coordinated behaviors. Bansal et al. (2017); Al-Shedivat et al. (2017) introduce a MuJoCo Sumo domain with similar motivation to ours, and observe emergent complexity from competition, in a 1v1 domain. We are explicitly interested in cooperation within teams as well as competition. Other attempts at optimizing rewards for multi-agent teams include Liu et al. (2012).
# 7 CONCLUSIONS AND FUTURE WORK
We have introduced a new 2v2 soccer domain with simulated physics for continuous multi-agent reinforcement learning research, and used competition between agents in this simple domain to train teams of independent RL agents, demonstrating coordinated behavior, including repeated passing motifs. We demonstrated that a framework of distributed population-based-training with continuous control, combined with automatic optimization of shaping reward channels, can learn in this environment end-to-end. We introduced the idea of automatically optimizing separate discount factors for the shaping rewards, to facilitate the transition from myopically optimizing shaping rewards towards alignment with the sparse long-horizon team rewards and corresponding cooperative behavior. We have introduced novel method of counterfactual policy divergence to analyze agent behavior. Our evaluation has highlighted non-transitivities in pairwise match results and the practical need for robustness, which is a topic for future work. Our environment can serve as a platform for multiagent research with continuous physical worlds, and can be easily scaled to more agents and more complex bodies, which we leave for future research.
# REFERENCES
Maruan Al-Shedivat, Trapit Bansal, Yuri Burda, Ilya Sutskever, Igor Mordatch, and Pieter Abbeel. Continuous adaptation via meta-learning in nonstationary and competitive environments. arXiv preprint arXiv:1710.03641, 2017.
J. Andrew Bagnell and Andrew Y. Ng. On local rewards and scaling distributed reinforcement learning. In Advances in Neural Information Processing Systems 18 [Neural Information Processing Systems, NIPS 2005, December 5-8, 2005, Vancouver, British Columbia, Canada], pp. 91–98, 2005.
David Balduzzi, Karl Tuyls, Julien Perolat, and Thore Graepel. Re-evaluating evaluation. arXiv preprint arXiv:1806.02643, 2018.
Trapit Bansal, Jakub Pachocki, Szymon Sidor, Ilya Sutskever, and Igor Mordatch. Emergent complexity via multi-agent competition. arXiv preprint arXiv:1710.03748, 2017.
Ronen I. Brafman and Moshe Tennenholtz. R-MAX - A general polynomial time algorithm for nearoptimal reinforcement learning. In Proceedings of the Seventeenth International Joint Conference on Artificial Intelligence, IJCAI 2001, Seattle, Washington, USA, August 4-10, 2001, pp. 953–958, 2001.
Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. CoRR, abs/1606.01540, 2016.
Murray Campbell, A. Joseph Hoane Jr., and Feng-hsiung Hsu. Deep blue. Artif. Intell., 134(1-2): 57–83, 2002.
Djork-Arne Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network ´ learning by exponential linear units (elus). CoRR, abs/1511.07289, 2015.
Arpad E. Elo. The rating of chessplayers, past and present. Arco Pub., New York, 1978. ISBN 0668047216 9780668047210. URL http://www.amazon.com/ Rating-Chess-Players-Past-Present/dp/0668047216.
Jakob N. Foerster, Yannis M. Assael, Nando de Freitas, and Shimon Whiteson. Learning to communicate with deep multi-agent reinforcement learning. In Advances in Neural Information Processing Systems 29: Annual Conference on Neural Information Processing Systems 2016, December 5-10, 2016, Barcelona, Spain, pp. 2137–2145, 2016.
Jakob N. Foerster, Nantas Nardelli, Gregory Farquhar, Triantafyllos Afouras, Philip H. S. Torr, Pushmeet Kohli, and Shimon Whiteson. Stabilising experience replay for deep multi-agent reinforcement learning. In Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017, pp. 1146–1155, 2017.
Jakob N. Foerster, Gregory Farquhar, Triantafyllos Afouras, Nantas Nardelli, and Shimon Whiteson. Counterfactual multi-agent policy gradients. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, New Orleans, Louisiana, USA, February 2-7, 2018, 2018.
Matthew John Hausknecht. Cooperation and communication in multiagent deep reinforcement learning. PhD thesis, University of Texas at Austin, Austin, USA, 2016.
Karol Hausman, Jost Tobias Springenberg, Ziyu Wang, Nicolas Heess, and Martin Riedmiller. Learning an embedding space for transferable robot skills. In International Conference on Learning Representations, 2018.
Nicolas Heess, Jonathan J. Hunt, Timothy P. Lillicrap, and David Silver. Memory-based control with recurrent neural networks. CoRR, abs/1512.04455, 2015a.
Nicolas Heess, Gregory Wayne, David Silver, Tim Lillicrap, Tom Erez, and Yuval Tassa. Learning continuous control policies by stochastic value gradients. In Advances in Neural Information Processing Systems, pp. 2944–2952, 2015b.
Nicolas Heess, Gregory Wayne, Yuval Tassa, Timothy P. Lillicrap, Martin A. Riedmiller, and David Silver. Learning and transfer of modulated locomotor controllers. CoRR, abs/1610.05182, 2016. URL http://arxiv.org/abs/1610.05182.
Nicolas Heess, Dhruva TB, Srinivasan Sriram, Jay Lemmon, Josh Merel, Greg Wayne, Yuval Tassa, Tom Erez, Ziyu Wang, S. M. Ali Eslami, Martin A. Riedmiller, and David Silver. Emergence of locomotion behaviours in rich environments. CoRR, abs/1707.02286, 2017. URL http: //arxiv.org/abs/1707.02286.
Johannes Heinrich and David Silver. Deep reinforcement learning from self-play in imperfectinformation games. CoRR, abs/1603.01121, 2016.
Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
Max Jaderberg, Valentin Dalibard, Simon Osindero, Wojciech M Czarnecki, Jeff Donahue, Ali Razavi, Oriol Vinyals, Tim Green, Iain Dunning, Karen Simonyan, et al. Population based training of neural networks. arXiv preprint arXiv:1711.09846, 2017.
Max Jaderberg, Wojciech Czarnecki, Iain Dunning, Luke Marris, Guy Lever, Antonio Garc´ıa Castaneda, Charles Beattie, Neil C. Rabinowitz, Ari S. Morcos, Avraham Ruderman, Nico- ˜ las Sonnerat, Tim Green, Louise Deason, Joel Z. Leibo, David Silver, Demis Hassabis, Koray Kavukcuoglu, and Thore Graepel. Human-level performance in first-person multiplayer games with population-based deep reinforcement learning. CoRR, abs/1807.01281, 2018.
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014. URL http://arxiv.org/abs/1412.6980.
Hiroaki Kitano, Minoru Asada, Yasuo Kuniyoshi, Itsuki Noda, and Eiichi Osawa. Robocup: The robot world cup initiative. In Agents, pp. 340–347, 1997.
Marc Lanctot, Vin´ıcius Flores Zambaldi, Audrunas Gruslys, Angeliki Lazaridou, Karl Tuyls, Julien Perolat, David Silver, and Thore Graepel. A unified game-theoretic approach to multiagent re- ´ inforcement learning. 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. 4193–4206, 2017.
Michael L. Littman. Markov games as a framework for multi-agent reinforcement learning. In In Proceedings of the Eleventh International Conference on Machine Learning, pp. 157–163. Morgan Kaufmann, 1994.
Bingyao Liu, Satinder P. Singh, Richard L. Lewis, and Shiyin Qin. Optimal rewards in multiagent teams. In 2012 IEEE International Conference on Development and Learning and Epigenetic Robotics, ICDL-EPIROB 2012, San Diego, CA, USA, November 7-9, 2012, pp. 1–8, 2012.
Ryan Lowe, Yi Wu, Aviv Tamar, Jean Harb, OpenAI Pieter Abbeel, and Igor Mordatch. Multi-agent actor-critic for mixed cooperative-competitive environments. In Advances in Neural Information Processing Systems, pp. 6379–6390, 2017.
Patrick MacAlpine and Peter Stone. Overlapping layered learning. Artif. Intell., 254:21–43, 2018. doi: 10.1016/j.artint.2017.09.001. URL https://doi.org/10.1016/j.artint.2017. 09.001.
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin A. Riedmiller, Andreas Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
Matej Moravk, Martin Schmid, Neil Burch, Viliam Lis, Dustin Morrill, Nolan Bard, Trevor Davis, Kevin Waugh, Michael Johanson, and Michael Bowling. Deepstack: Expert-level artificial intelligence in no-limit poker. 356, 01 2017.
Igor Mordatch and Pieter Abbeel. Emergence of grounded compositional language in multi-agent populations. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, New Orleans, Louisiana, USA, February 2-7, 2018, 2018.
Remi Munos, Tom Stepleton, Anna Harutyunyan, and Marc Bellemare. Safe and efficient off-policy ´ reinforcement learning. In Advances in Neural Information Processing Systems, pp. 1054–1062, 2016.
Andrew Y. Ng, Daishi Harada, and Stuart J. Russell. Policy invariance under reward transformations: Theory and application to reward shaping. In Proceedings of the Sixteenth International Conference on Machine Learning (ICML 1999), Bled, Slovenia, June 27 - 30, 1999, pp. 278–287, 1999.
Ivaylo Popov, Nicolas Heess, Timothy P. Lillicrap, Roland Hafner, Gabriel Barth-Maron, Matej Vecerik, Thomas Lampe, Yuval Tassa, Tom Erez, and Martin A. Riedmiller. Data-efficient deep reinforcement learning for dexterous manipulation. CoRR, abs/1704.03073, 2017.
Martin Riedmiller, Roland Hafner, Thomas Lampe, Michael Neunert, Jonas Degrave, Tom Van de Wiele, Volodymyr Mnih, Nicolas Heess, and Jost Tobias Springenberg. Learning by playingsolving sparse reward tasks from scratch. arXiv preprint arXiv:1802.10567, 2018.
Martin A. Riedmiller, Thomas Gabel, Roland Hafner, and Sascha Lange. Reinforcement learning for robot soccer. Auton. Robots, 27(1):55–73, 2009.
A. L. Samuel. Some studies in machine learning using the game of checkers. IBM J. Res. Dev., 3 (3):210–229, July 1959. ISSN 0018-8646.
L. S. Shapley. Stochastic games. Proceedings of the National Academy of Sciences of the United States of America, 39(10):1095–1100, 1953.
David Silver, Guy Lever, Nicolas Heess, Thomas Degris, Daan Wierstra, and Martin A. Riedmiller. Deterministic policy gradient algorithms. In Proceedings of the 31th International Conference on Machine Learning, ICML 2014, Beijing, China, 21-26 June 2014, pp. 387–395, 2014.
David Silver, Aja Huang, Chris J. Maddison, Arthur Guez, Laurent Sifre, George van den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Vedavyas Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy P. Lillicrap, Madeleine Leach, Koray Kavukcuoglu, Thore Graepel, and Demis Hassabis. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
Sainbayar Sukhbaatar, Arthur Szlam, and Rob Fergus. Learning multiagent communication with backpropagation. In Advances in Neural Information Processing Systems 29: Annual Conference on Neural Information Processing Systems 2016, December 5-10, 2016, Barcelona, Spain, pp. 2244–2252, 2016.
R. Sutton and A. Barto. Reinforcement Learning: An Introduction. MIT Press, 1998.
Yuval Tassa, Yotam Doron, Alistair Muldal, Tom Erez, Yazhe Li, Diego de Las Casas, David Budden, Abbas Abdolmaleki, Josh Merel, Andrew Lefrancq, Timothy P. Lillicrap, and Martin A. Riedmiller. Deepmind control suite. CoRR, abs/1801.00690, 2018.
G. Tesauro. Temporal difference learning and td-gammon. Commun. ACM, 38(3):58–68, March 1995.
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, IROS 2012, Vilamoura, Algarve, Portugal, October 7-12, 2012, pp. 5026–5033, 2012.
Karl Tuyls, Julien Perolat, Marc Lanctot, Joel Z Leibo, and Thore Graepel. A generalised method for empirical game theoretic analysis. arXiv preprint arXiv:1803.06376, 2018.
Oriol Vinyals, Timo Ewalds, Sergey Bartunov, Petko Georgiev, Alexander Sasha Vezhnevets, Michelle Yeo, Alireza Makhzani, Heinrich Kuttler, John Agapiou, Julian Schrittwieser, John ¨ Quan, Stephen Gaffney, Stig Petersen, Karen Simonyan, Tom Schaul, Hado van Hasselt, David Silver, Timothy P. Lillicrap, Kevin Calderone, Paul Keet, Anthony Brunasso, David Lawrence, Anders Ekermo, Jacob Repp, and Rodney Tsing. Starcraft II: A new challenge for reinforcement learning. CoRR, abs/1708.04782, 2017.
# A OFF-POLICY SVG0 ALGORITHM
# A.1 POLICY UPDATES
The Stochastic Value Gradients (SVG0) algorithm used throughout this work is a special case of the family of policy gradient algorithms provided by Heess et al. (2015b) in which the gradient of a value function used to compute the policy gradient, and is closely related to the Deterministic Policy Gradient algorithm (DPG) (Silver et al., 2014), which is itself a special case of SVG0. For clarity we provide the specific derivation of SVG0 here.
Using the reparametrization method of Heess et al. (2015b) we write a stochastic policy $\pi _ { \boldsymbol { \theta } } ( \cdot | \boldsymbol { s } )$ as a deterministic policy $\mu _ { \theta } : { \mathcal { S } } \times \mathbb { R } \to { \mathcal { A } }$ further conditioned on a random variable $\eta \in \mathbb { R } ^ { p }$ , so that $a \sim \pi _ { \theta } ( \cdot | s )$ is equivalent to $a \sim \mu _ { \theta } ( s , \eta )$ , where $\eta \sim \rho$ for some distribution $\rho$ . Then,
$$\begin{array} { r l } & { \begin{array} { r l } & { Q ^ { \pi _ { \theta } } ( s , a ) = r ( s , a ) + \gamma \mathbb { E } _ { s ^ { \prime } \sim P ( \cdot \vert s , a ) } [ \mathbb { E } _ { a ^ { \prime } \sim \pi ( \cdot \vert s ^ { \prime } ) } [ Q ^ { \pi _ { \theta } } ( s ^ { \prime } , a ^ { \prime } ) ] ] } \\ & { \quad \quad \quad \quad \quad \quad = r ( s , a ) + \gamma \mathbb { E } _ { s ^ { \prime } \sim P ( \cdot \vert s , a ) } [ \mathbb { E } _ { \eta ^ { \prime } \sim \rho } [ Q ^ { \pi _ { \theta } } ( s ^ { \prime } , \mu _ { \theta } ( s ^ { \prime } , \eta ^ { \prime } ) ) ] ] } \end{array} } \\ & { \begin{array} { r l } & { \underline { { \mathcal { Q } } } ^ { \pi _ { \theta } } ( s , a ) = \gamma \mathbb { E } _ { s ^ { \prime } \sim P ( \cdot \vert s , a ) } [ \mathbb { E } _ { \eta ^ { \prime } \sim \rho } [ \underline { { \partial } } \theta Q ^ { \pi _ { \theta } } ( s ^ { \prime } , \mu _ { \theta } ( s ^ { \prime } , \eta ^ { \prime } ) ) ] ] } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \end{array} } \\ & { = \gamma \mathbb { E } _ { s ^ { \prime } \sim P ( \cdot \vert s , a ) } [ \mathbb { E } _ { \eta ^ { \prime } \sim \rho } [ \underline { { \partial } } Q ^ { \pi _ { \theta } } ( s ^ { \prime } , a ^ { \prime } ) ] _ { a ^ { \prime } = \mu _ { \theta } ( s ^ { \prime } , \eta ^ { \prime } ) } + \frac { \partial } { \partial a ^ { \prime } } Q ^ { \pi _ { \theta } } ( s ^ { \prime } , a ^ { \prime } ) ] _ { a ^ { \prime } = \mu _ { \theta } ( s ^ { \prime } , \eta ^ { \prime } ) } \frac { \partial } { \partial \theta } \mu _ { \theta } ( s ^ { \prime } , \eta ^ { \prime } ) ] } \end{array}$$
from which we obtain a recursion for $\frac { \partial Q ^ { \pi _ { \theta } } ( s , a ) } { \partial \theta }$ . Expanding the recursion we obtain the policy gradient
$$\begin{array} { c } { { \displaystyle \frac { \partial Q ^ { \pi _ { \theta } } ( s _ { 0 } , a _ { 0 } ) } { \partial \theta } = \sum _ { t = 1 } ^ { \infty } \gamma ^ { t } \mathbb { E } _ { s _ { t } \sim P ( \cdot | s _ { t - 1 } , a _ { t - 1 } ) } \Biggl [ \mathbb { E } _ { \eta _ { t } \sim \rho } \biggl [ \displaystyle \frac { \partial } { \partial a _ { t } } Q ^ { \pi _ { \theta } } ( s _ { t } , a _ { t } ) \biggr | _ { a _ { t } = \mu _ { \theta } ( s _ { t } , \eta _ { t } ) } \times } } \\ { { \displaystyle \left. \frac { \partial } { \partial \theta } \mu _ { \theta } ( s _ { t } , \eta _ { t } ) \right] \biggl | s _ { 0 } , a _ { 0 } , a _ { \tau } = \mu _ { \theta } ( s _ { \tau } , \eta _ { \tau } ) , \eta _ { \tau } \sim \rho \forall \tau < t \biggr ] } } \\ { { \displaystyle = \int _ { \mathcal { S } } \int _ { \mathbb { R } ^ { p } } \zeta ( s , \eta ) \displaystyle \frac { \partial } { \partial a } Q ^ { \pi _ { \theta } } ( s , a ) \Biggl | _ { a = \mu _ { \theta } ( s , \eta ) } \displaystyle \frac { \partial } { \partial \theta } \mu _ { \theta } ( s , \eta ) d \eta d s } } \end{array}$$
where $\begin{array} { r } { \zeta ( s , \eta ) : = \sum _ { t = 1 } ^ { \infty } \gamma ^ { t } p _ { t } ( s , \eta ) } \end{array}$ and where $p _ { t } ( s , \eta )$ is the joint density over (state, $\eta$ ) at timestep $t$ following the policy. Typically $\gamma$ is replaced with 1 in the definition of $\zeta$ to avoid discounting terms depending on future states in the gradient too severely. This suggests Algorithm 3 given in Heess et al. (2015b). For details on recurrent policies see Heess et al. (2015a).
# Algorithm 2 Off-policy SVG0 algorithm (Heess et al., 2015b).
1: initialize replay buffer $B = \varnothing$ 2: sample initial state $s _ { 0 }$ from environment 3: for t $\scriptstyle \mathbf { d o } = 0$ to $\infty$ do 4: sample action from current policy $a _ { t } = \mu _ { \theta } ( \cdot | s _ { t } , \eta )$ , $\eta \sim \rho$ 5: observe reward and state observation $r _ { t } , s _ { t }$ 6: 7: $\begin{array} { r } { \theta \gets \theta + \alpha \frac { \partial } { \partial a } Q ^ { \pi _ { \theta } } ( s _ { t } , a ; \psi ) \big | _ { a = \mu _ { \theta } ( s _ { t } , \eta _ { t } ) } \frac { \partial } { \partial \theta } \mu _ { \theta } ( s _ { t } , \eta _ { t } ) } \end{array}$ $Q ^ { \pi _ { \theta } } ( \cdot , \cdot ; \psi )$ $\boldsymbol { B }$ ) 8: end for
# A.2 Q-VALUE UPDATES
As in Section 3.1, in any given game, by treating all other players as part of the environment dynamics, we can define action-value function for policy $\pi _ { \theta }$ controlling player $i$ :
$$Q ^ { \pi _ { \theta } , i } ( s , a ; \pi _ { \backslash i } ) : = \mathbb { E } \big [ \sum _ { t = 0 } ^ { H } \gamma ^ { t } r _ { t } ^ { i } \big | s _ { 0 } = s , a _ { 0 } ^ { i } = a ; \pi ^ { i } = \pi _ { \theta } , \pi _ { \backslash i } \big ]$$
In our soccer environment the reward is invariant over player and we can drop the dependence on $i$
SVG requires the critic to learn a differentiable Q-function. The true state of the game $s$ and the identity of other agents $\pi _ { \backslash i }$ , are not revealed during a game and so identities must be inferred from their behavior, for example. Further, as noted in Foerster et al. (2017), off-policy replay is not always fully sound in multi-agent environments since the effective dynamics from any single agent’s perspective changes as the other agent’s policies change. Because of this, we generally model $Q$ as a function of an agents history of observations - typically keeping a low dimensional summary in the internal state of an LSTM: $Q ^ { \pi _ { \theta } } ( \cdot , \cdot ; \psi ) : \mathcal { X } \times \mathcal { A } \mathbb { R }$ , where $\mathcal { X }$ denotes the space of possible histories or internal memory state, parameterized by a neural network with weights $\psi$ . This enables the $Q$ -function to implicitly condition on other players observed behavior and generalize over the diversity of players in the population and diversity of behaviors in replay, $Q$ is learned using trajectory data stored in an experience replay buffer $\boldsymbol { B }$ , by minimizing the $k$ -step return TD-error with off-policy retrace correction (Munos et al., 2016), using a separate target network for bootstrapping, as is also described in Hausman et al. (2018); Riedmiller et al. (2018). Specifically we minimize:
$$L ( \psi ) : = \mathbb { E } _ { \xi \sim \mathcal { B } } \left[ ( Q ^ { \pi _ { \theta } } ( x _ { i } , a _ { i } ; \psi ) - Q _ { \tt r e t r a c e } ( \xi ) ) ^ { 2 } \right]$$
where $\xi : = ( ( s _ { t } , a _ { t } , r _ { t } ) ) _ { t = i } ^ { i + k }$ is a $\mathrm { k }$ -step trajectory snippet, where $i$ denotes the timestep of the first state in the snippet, sampled uniformly from the replay buffer of prior experience, and $Q _ { \tt r e t r a c e }$ is the off-policy corrected retrace target:
$$\begin{array} { l } { { Q _ { \mathrm { r e t r a c e } } ( \xi ) : = \displaystyle \hat { Q } ( x _ { i } , a _ { i } ; \hat { \psi } ) + \sum _ { t = 0 } ^ { k } \gamma ^ { t } \left( \prod _ { s = i + 1 } ^ { t + i } c _ { s } \right) \left( r ( s _ { i + t } , a _ { i + t } ) + \right. } } \\ { { \left. \qquad \gamma \mathbb { E } _ { a \sim \hat { \pi } ( \cdot \vert x _ { i + t + 1 } ) } [ \hat { Q } ( x _ { i + t + 1 } , a ; \hat { \psi } ) ] - \hat { Q } ( x _ { i + t } , a _ { i + t } ; \hat { \psi } ) \right) } } \end{array}$$
where, for stability, $\hat { Q } ( \cdot , \cdot ; \hat { \psi } ) : \mathcal { X } \times \mathcal { A } \mathbb { R }$ and $\hat { \pi }$ are target network and policies (Mnih et al., 2015) periodically synced with the online action-value critic and policy (in our experiments we sync after every 100 gradient steps), and $\begin{array} { r } { c _ { s } : = m i n ( 1 , \frac { \pi ( a _ { s } | x _ { s } ) } { \beta ( a _ { s } | x _ { s } ) } ) } \end{array}$ , where $\beta$ denotes the behavior policy which generated the trajectory snippet $\xi$ sampled from $\boldsymbol { B }$ , and $\textstyle \prod _ { s = i \pm 1 } ^ { i } c _ { s } : = 1$ . In our soccer experiments $k = 4 0$ . Though we use off-policy corrections, the replay buffer has a threshold, to ensure that data is relatively recent.
When modelling $Q$ using an LSTM the agent’s internal memory state at the first timestep of the snippet is stored in replay, along with the trajectory data. When replaying the experience the LSTM is primed with this stored internal state but then updates its own state during replay of the snippet. LSTMs are optimized using backpropagation through time with unrolls truncated to length 40 in our experiments.
# B POPULATION-BASED TRAINING PROCEDURE
# B.1 FITNESS
We use Elo rating (Elo (1978)), introduced to evaluate the strength of human chess players, to measure an agent’s performance within the population of learning agents and determine eligibility for evolution. Elo is updated from pairwise match results and can be used to predict expected win rates against the other members of the population.
For a given pair of agents $i , j$ (or a pair of agent teams), $s _ { e l o }$ estimates the expected win rate of agent $i$ playing against agent $j$ . We show in Algorithm 3 the update rule for a two player competitive game for simplicity, for a team of multiple players, we use their average Elo score instead.
By using Elo as the fitness function, driving the evolution of the population’s hyperparamters, the agents’ internal hyperparameters (see Section 3.3) can be automatically optimized for the objective we are ultimately interested in - the win rate against other agents. Individual shaping rewards would otherwise be difficult to handcraft without biasing this objective.
# Algorithm 3 Iterative Elo rating update.
1: Initialize rating $r _ { i }$ for each agent in the agent population. 2: $K$ : step size of Elo rating update given one match result. 3: $s _ { i } , s _ { j }$ : score for agent $i , j$ in a given match. 4: procedure UPDATERATIN $\mathsf { I G } ( r _ { i } , r _ { j } , s _ { i } , s _ { j } )$ 5: $s \gets ( \mathrm { s i g n } ( s _ { i } - s _ { j } ) + 1 ) / 2$ 6: selo ← 1/(1 + 10(rj−ri)/400) 7: $r _ { i } r _ { i } + K ( s - s _ { e l o } )$ 8: $r _ { j } r _ { j } - K ( s - s _ { e l o } )$ 9: end procedure
# B.2 EVOLUTION ELIGIBILITY
To limit the frequency of evolution and prevent premature convergence of the population, we adopted the same eligibility criteria introduced in Jaderberg et al. (2017). In particular, we consider an agent $i$ eligible for evolution if it has:
1. processed $2 \times 1 0 ^ { 9 }$ frames for learning since the beginning of training; and 2. processed $4 \times 1 0 ^ { 8 }$ frames for learning since the last time it became eligible for evolution. and agent $j$ can be a parent if agent $j$ has 1. processed $4 \times 1 0 ^ { 8 }$ frames for learning since it last evolved. which we refer to as a “burn-in” period.
# B.3 SELECTION
When an agent $i$ becomes eligible for evolution, it is compared against another agent $j$ who has finished its “burn-in” period for evolution selection. We describe this procedure in Algorithm 4.
Algorithm 4 Given agent $i$ , select an agent $j$ to evolve to.
1: $T _ { s e l e c t }$ : win rate selection threshold below which $A _ { i }$ should evolve to $A _ { j }$ . 2: $r _ { i } , r _ { j }$ : Elo ratings of agents $i , j$ . 3: procedure $\operatorname { S E L E C T } ( A _ { i } , \{ A _ { i } \} _ { i \in [ 1 , \dots , N ] ; i \neq j } )$ 4: Choose $A _ { j }$ uniformly at random from $\{ A _ { i } \} _ { i \in [ 1 , . . , N ] ; i \neq j }$ . 5: selo ← 1/(1 + 10(rj−ri)/400) 6: if $s _ { e l o } < T _ { s e l e c t }$ then 7: return $A _ { j }$ 8: else 9: return NULL 10: end if 11: end procedure
# B.4 INHERITANCE
Upon selection for evolution, agent $i$ inherits hyperparameters from agent $j$ by “cross-over” meaning that hyperparameters are either inherited or not independently with probability 0.5 as described in Algorithm 5:
# B.5 MUTATION
Upon each evolution action the child agent mutates its hyper-parameters with mutation probability $p _ { m u t a t e }$ at a multiplicative perturbation scale $p _ { p e r t u r b }$ . In this work, we apply a mutation probability of $p _ { m u t a t e } = 0 . 1$ and $p _ { p e r t u r b } = 0 . 2$ for all experiments. We limit a subset of hyperparameters to bounded ranges (e.g. discount factor) such that their values remain valid throughout training.
Algorithm 5 Agent $i$ inherits from agent $j$ by cross-over.
1: Agent $i , j$ with respective network parameters $\theta _ { i } , \theta _ { j }$ and hyper-parameters $\theta _ { i } ^ { h } , \theta _ { j } ^ { h }$ . 2: procedure INHERIT $\cdot ( \theta _ { i } , \theta _ { j } , \theta _ { i } ^ { h } , \theta _ { j } ^ { h } )$ 3: ${ \theta _ { i } \theta _ { j } }$ 4: $m = ( m _ { k } ) _ { k }$ , mk ∼ bernouilli(0.5) 5: $\theta _ { i } ^ { h } m \theta _ { i } ^ { h } + ( 1 - m ) \theta _ { j } ^ { h }$ 6: end procedure
# C FURTHER ENVIRONMENT DETAILS AND AGENT PARAMETERIZATION
# C.1 POLICY PARAMETRIZATION AND OPTIMIZATION
We parametrize each agent’s policy and critic using neural networks. Observation preprocessing is first applied to each raw teammate and opponent feature using a shared 2-layer network with 32 and 16 neurons and Elu activations (Clevert et al., 2015) to embed each individual player’s data into a consistent, learned 16 dimensional embedding space. The maximum, minimum and mean of each dimension is then passed as input to the remainder of the network, where it is concatenated with the ball and pitch features. This preprocessing makes the network architecture invariant to the order of teammates and opponents features.
Both critic and actor then apply 2 feed-forward, elu-activated, layers of size 512 and 256, followed by a final layer of 256 neurons which is either feed-forward or made recurrent using an LSTM (Hochreiter & Schmidhuber, 1997). Weights are not shared between critic and actor networks.
We learn the parametrized gaussian policies using SVG0 as detailed in Appendix A, and the critic as described in Section A.2, with the Adam optimizer (Kingma & Ba, 2014) used to apply gradient updates.
# D HEAD-TO-HEAD TOURNAMENT OF TRAINED AGENTS
We also ran a round robin tournament with 50,000 matches between the best teams from 5 populations of agents (selected by Elo within their population), all trained for 5e10 agent steps - i.e. each learner had processed at least 5e10 frames from the replay buffer, though the number of raw environment steps would be much lower than that) and computed the Elo score. This shows the advantage of including shaping rewards, adding a recurrent critic and separate reward and discount channels, and the further (marginal) contribution of a recurrent actor. The full win rate matrix for this tournament is given in Figure 10. Note that the agent with full recurrence and separate reward channels attains the highest Elo in this tournament, though performance against our Nash evaluators in Section 5.1 is more mixed. This highlights the possibility for non-transitivities in this domain and the practical need for robustness to opponents.
# E HYPERPARAMETER EVOLUTION
To assess the relative importance of hyperparameters we replicated a single experiment (using a feed-forward policy and critic network) with 3 different seeds, see Figure 11. Critic learning rate and entropy regularizer evolve consistently over the three training runs. In particular the critic learning rate tends to be reduced over time. If a certain hyperparameter was not important to agent performance we would expect less consistency in its evolution across seeds, as selection would be driven by other hyperparameters: thus indicating performance is more sensitive to critic learning rate than actor learning rate.
 Figure 10: Win rate matrix for the Tournament between teams: from top to bottom, ordered by Elo, ascending: $\mathbf { f } \mathbf { f } + \mathbf { e v } \mathbf { o }$ ; $\mathbf { f f } + \mathbf { e v 0 } +$ rwd shp; lstm $\mathbf { q } + \mathbf { e v } \mathbf { 0 } +$ rwd shp; lstm $\mathbf { q } + \mathbf { e v } \mathbf { 0 } +$ rwd shp $^ +$ channels; $\mathbf { l s t m + e v 0 + }$ rwd shp $^ +$ channels. ELo derived from the tournament is given in the table.
 Figure 11: Hyperparameter evolution for three separate seeds, displayed over three separate rows.
# F BEHAVIOR VISUALIZATIONS
As well as the videos at the website3, we provide visualizations of traces of the agent behavior, in the repeated “cross pass” motif, see Figure 12.
 Figure 12: On the left red agent 0 has passed to agent 1, who apparently ran into position to receive. On the right blue agent 1 has passed to agent 0.md/train/-TwO99rbVRu/-TwO99rbVRu.mdAdded+331
md/train/04cII6MumYV/04cII6MumYV.mdAdded+311
md/train/1Fqg133qRaI/1Fqg133qRaI.mdAdded+289
md/train/1FvkSpWosOl/1FvkSpWosOl.mdAdded+575
md/train/1NRMmEUyXMu/1NRMmEUyXMu.mdAdded+346
md/train/4ADnf1HqIw/4ADnf1HqIw.mdAdded+276
md/train/4G2dEuRZ7eO/4G2dEuRZ7eO.mdAdded+290
md/train/5FRJWsiLRmA/5FRJWsiLRmA.mdAdded+416
md/train/B12Js_yRb/B12Js_yRb.mdAdded+342
md/train/B1spAqUp-/B1spAqUp-.mdAdded+195
md/train/B1x5KiCcFX/B1x5KiCcFX.mdAdded+689
md/train/BJ6oOfqge/BJ6oOfqge.mdAdded+257
md/train/BJ8c3f-0b/BJ8c3f-0b.mdAdded+494
md/train/BJfguoAcFm/BJfguoAcFm.mdAdded+398
md/train/BJgVaG-Ab/BJgVaG-Ab.mdAdded+358
md/train/BJxh2j0qYm/BJxh2j0qYm.mdAdded+283
md/train/BkG8sjR5Km/BkG8sjR5Km.mdAdded+395
md/train/BkS3fnl0W/BkS3fnl0W.mdAdded
md/train/BkbY4psgg/BkbY4psgg.mdAdded
md/train/BkgtDsCcKQ/BkgtDsCcKQ.mdAdded
md/train/Bkxonh4Ywr/Bkxonh4Ywr.mdAdded
md/train/ByeSYa4KPS/ByeSYa4KPS.mdAdded
md/train/BygdyxHFDS/BygdyxHFDS.mdAdded
md/train/ByqFhGZCW/ByqFhGZCW.mdAdded
md/train/ByxCrerKvS/ByxCrerKvS.mdAdded
md/train/ByxdUySKvS/ByxdUySKvS.mdAdded
md/train/H1Dy---0Z/H1Dy---0Z.mdAdded
md/train/H1W1UN9gg/H1W1UN9gg.mdAdded
md/train/H1eqviAqYX/H1eqviAqYX.mdAdded
md/train/H1lmhaVtvr/H1lmhaVtvr.mdAdded
md/train/H1xaJn05FQ/H1xaJn05FQ.mdAdded
md/train/H38f_9b90BO/H38f_9b90BO.mdAdded
md/train/HCSgyPUfeDj/HCSgyPUfeDj.mdAdded
md/train/HJOQ7MgAW/HJOQ7MgAW.mdAdded
md/train/HJf9ZhC9FX/HJf9ZhC9FX.mdAdded
md/train/HJgBA2VYwH/HJgBA2VYwH.mdAdded
md/train/HJgVisRqtX/HJgVisRqtX.mdAdded
md/train/HJgXsjA5tQ/HJgXsjA5tQ.mdAdded
md/train/HJgeEh09KQ/HJgeEh09KQ.mdAdded
md/train/HJguLo0cKQ/HJguLo0cKQ.mdAdded
md/train/Hk5elxbRW/Hk5elxbRW.mdAdded
md/train/HkGmDsR9YQ/HkGmDsR9YQ.mdAdded
md/train/Hkfmn5n6W/Hkfmn5n6W.mdAdded
md/train/Hkg4TI9xl/Hkg4TI9xl.mdAdded
md/train/HkxAAvcxx/HkxAAvcxx.mdAdded
md/train/Hyfg5o0qtm/Hyfg5o0qtm.mdAdded
md/train/HyxhqhVKPB/HyxhqhVKPB.mdAdded
md/train/I55UqU-M11y/I55UqU-M11y.mdAdded
md/train/I6NRcao1w-X/I6NRcao1w-X.mdAdded
md/train/IQgbmaoDDjd/IQgbmaoDDjd.mdAdded