ZHANGYUXUAN-zR commited on
Commit
04c7d67
·
verified ·
1 Parent(s): 195a797

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. md/train/6Ab68Ip4Mu/6Ab68Ip4Mu.md +247 -0
  2. md/train/70kOIgjKhbA/70kOIgjKhbA.md +276 -0
  3. md/train/7uVcpu-gMD/7uVcpu-gMD.md +0 -0
  4. md/train/B1xsqj09Fm/B1xsqj09Fm.md +492 -0
  5. md/train/BJ0Ee8cxx/BJ0Ee8cxx.md +267 -0
  6. md/train/BJ46w6Ule/BJ46w6Ule.md +344 -0
  7. md/train/BJe1E2R5KX/BJe1E2R5KX.md +0 -0
  8. md/train/BJlAzTEKwS/BJlAzTEKwS.md +383 -0
  9. md/train/Bk9nkMa4G/Bk9nkMa4G.md +250 -0
  10. md/train/BkgXT24tDS/BkgXT24tDS.md +337 -0
  11. md/train/BkxtNaEYDr/BkxtNaEYDr.md +0 -0
  12. md/train/ByxtC2VtPB/ByxtC2VtPB.md +409 -0
  13. md/train/GOfGGASIUkg/GOfGGASIUkg.md +447 -0
  14. md/train/H1gBhkBFDH/H1gBhkBFDH.md +0 -0
  15. md/train/H1gEP6NFwr/H1gEP6NFwr.md +371 -0
  16. md/train/H1gR5iR5FX/H1gR5iR5FX.md +406 -0
  17. md/train/H1gX8C4YPr/H1gX8C4YPr.md +375 -0
  18. md/train/HJGkisCcKm/HJGkisCcKm.md +260 -0
  19. md/train/HkGzUjR5tQ/HkGzUjR5tQ.md +290 -0
  20. md/train/HkgXteBYPB/HkgXteBYPB.md +235 -0
  21. md/train/Hkx7_1rKwS/Hkx7_1rKwS.md +0 -0
  22. md/train/HkxKH2AcFm/HkxKH2AcFm.md +329 -0
  23. md/train/HyXBcYg0b/HyXBcYg0b.md +254 -0
  24. md/train/IkYEJ5Cps5H/IkYEJ5Cps5H.md +227 -0
  25. md/train/K5YasWXZT3O/K5YasWXZT3O.md +0 -0
  26. md/train/L80PLIixPIXTH/L80PLIixPIXTH.md +321 -0
  27. md/train/LOHyqjfyra/LOHyqjfyra.md +182 -0
  28. md/train/LoUdcqLuPej/LoUdcqLuPej.md +360 -0
  29. md/train/MIDckA56aD/MIDckA56aD.md +0 -0
  30. md/train/OmtmcPkkhT/OmtmcPkkhT.md +258 -0
  31. md/train/S1emOTNKvS/S1emOTNKvS.md +431 -0
  32. md/train/S1x4ghC9tQ/S1x4ghC9tQ.md +345 -0
  33. md/train/SJgaRA4FPH/SJgaRA4FPH.md +470 -0
  34. md/train/Skeq30NFPr/Skeq30NFPr.md +0 -0
  35. md/train/SyOvg6jxx/SyOvg6jxx.md +372 -0
  36. md/train/SyYe6k-CW/SyYe6k-CW.md +0 -0
  37. md/train/_4VxORHq-0g/_4VxORHq-0g.md +219 -0
  38. md/train/foNTMJHXHXC/foNTMJHXHXC.md +0 -0
  39. md/train/gG4j9PybfwI/gG4j9PybfwI.md +452 -0
  40. md/train/pAbm1qfheGk/pAbm1qfheGk.md +416 -0
  41. md/train/r1eIiCNYwS/r1eIiCNYwS.md +421 -0
  42. md/train/rJgBd2NYPH/rJgBd2NYPH.md +370 -0
  43. md/train/rk9eAFcxg/rk9eAFcxg.md +316 -0
  44. md/train/rklMnyBtPB/rklMnyBtPB.md +428 -0
  45. md/train/ryacTMZRZ/ryacTMZRZ.md +256 -0
  46. md/train/rylkma4twr/rylkma4twr.md +0 -0
  47. md/train/ryxnY3NYPS/ryxnY3NYPS.md +335 -0
  48. md/train/u8X280hw1Mt/u8X280hw1Mt.md +379 -0
  49. md/train/vrCiOrqgl3B/vrCiOrqgl3B.md +683 -0
  50. md/train/w6iVxEdh6bi/w6iVxEdh6bi.md +342 -0
md/train/6Ab68Ip4Mu/6Ab68Ip4Mu.md ADDED
@@ -0,0 +1,247 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ResT: An Efficient Transformer for Visual Recognition
2
+
3
+ Qing-Long Zhang, Yu-Bin Yang State Key Laboratory for Novel Software Technology Nanjing University, Nanjing 21023, China wofmanaf@smail.nju.edu.cn, yangyubin@nju.edu.cn
4
+
5
+ # Abstract
6
+
7
+ This paper presents an efficient multi-scale vision Transformer, called ResT, that capably served as a general-purpose backbone for image recognition. Unlike existing Transformer methods, which employ standard Transformer blocks to tackle raw images with a fixed resolution, our ResT have several advantages: (1) A memory-efficient multi-head self-attention is built, which compresses the memory by a simple depth-wise convolution, and projects the interaction across the attention-heads dimension while keeping the diversity ability of multi-heads; (2) Positional encoding is constructed as spatial attention, which is more flexible and can tackle with input images of arbitrary size without interpolation or fine-tune; (3) Instead of the straightforward tokenization at the beginning of each stage, we design the patch embedding as a stack of overlapping convolution operation with stride on the token map. We comprehensively validate ResT on image classification and downstream tasks. Experimental results show that the proposed ResT can outperform the recently state-of-the-art backbones by a large margin, demonstrating the potential of ResT as strong backbones. The code and models will be made publicly available at https://github.com/wofmanaf/ResT.
8
+
9
+ # 1 Introduction
10
+
11
+ Deep learning backbone architectures have been evolved for years and boost the performance of computer vision tasks such as classification [5, 26, 33, 11], object detection [2, 41, 18, 25], and instance segmentation [10, 24, 31], etc.
12
+
13
+ There are mainly two types of backbone architectures most commonly applied in computer vision: convolutional network (CNN) architectures [11, 38] and Transformer ones [6, 5, 33, 39]. Both of them capture feature information by stacking multiple blocks. The CNN block is generally a bottleneck structure [11], which can be defined as a stack of $1 \times 1$ , $3 \times 3$ , and $1 \times 1$ convolution layers with residual learning (shown in Figure 1a). The $1 \times 1$ layers are responsible for reducing and then increasing channel dimensions, leaving the $3 \times 3$ layer a bottleneck with smaller input/output channel dimensions. The CNN backbones are generally faster and require less inference time thanks to parameter sharing, local information aggregation, and dimension reduction. However, due to the limited and fixed receptive field, CNN blocks may be less effective in scenarios that require modeling long-range dependencies. For example, in instance segmentation, being able to collect and associate scene information from a large neighborhood can be useful in learning relationships across objects [23].
14
+
15
+ To overcome these limitations, Transformer backbones are recently explored for their ability to capture long-distance information [5, 33, 26, 19]. Unlike CNN backbones, the Transformer ones first split an image into a sequence of patches (i.e., tokens), then sum these tokens with positional encoding to represent coarse spatial information, and finally adopt a stack of Transformer blocks to capture feature information. A standard Transformer block [28] comprises a multi-head self-attention (MSA) that employs a query-key-value decomposition to model global relationships between sequence tokens, and a feed-forward network (FFN) to learn wider representations (shown in Figure 1b). As a result, Transformer blocks can dynamically adapt the receptive field according to the image content.
16
+
17
+ ![](images/ecebca4c72535a3184b584598b6840672657f74e4f42f10132664f255a460d0a.jpg)
18
+ Figure 1: Examples of backbone blocks. Left: A standard ResNet Bottleneck Block [11]. Middle: A Standard Transformer Block. Right: The proposed Efficient Transformer Block. The only difference compared with standard Transformer block is the replacement of the Multi-Head Self-Attention (MSA) with Efficient Multi-head Self-Attention (EMSA).
19
+
20
+ Despite showing great potential than CNNs, the Transformer backbones still have four major shortcomings: (1) It is difficult to extract the low-level features which form some fundamental structures in images (e.g., corners and edges) since existing Transformer backbones direct perform tokenization of patches from raw input images. (2) The memory and computation for MSA in Transformer blocks scale quadratically with spatial or embedding dimensions (i.e., the number of channels), causing vast overheads for training and inference. (3) Each head in MSA is responsible for only a subset of embedding dimensions, which may impair the performance of the network, particularly when the tokens embedding dimension (for each head) is short, making the dot product of query and key unable to constitute an informative function. (4) The input tokens and positional encoding in existing Transformer backbones are all of a fixed scale, which are unsuitable for vision tasks that require dense prediction.
21
+
22
+ In this paper, we proposed an efficient general-purpose backbone ResT (named after ResNet [11]) for computer vision, which can remedy the above issues. As illustrated in Figure 2, ResT shares exactly the same pipeline of ResNet, i.e., a stem module applied for extracting low-level information and strengthening locality, followed by four stages to construct hierarchical feature maps, and finally a head module for classification. Each stage consists of a patch embedding, a positional encoding module, and multiple Transformer blocks with specific spatial resolution and channel dimension. The patch embedding module creates a multi-scale pyramid of features by hierarchically expanding the channel capacity while reducing the spatial resolution with overlapping convolution operations. Unlike the conventional methods which can only tackle images with a fixed scale, our positional encoding module is constructed as spatial attention which is conditioned on the local neighborhood of the input token. By doing this, the proposed method is more flexible and can process input images of arbitrary size without interpolation or fine-tune. Besides, to improve the efficiency of the MSA, we build an efficient multi-head self-attention (EMSA), which significantly reduce the computation cost by a simple overlapping Depth-wise Conv2d. In addition, we compensate short-length limitations of the input token for each head by projecting the interaction across the attention-heads dimension while keeping the diversity ability of multi-heads.
23
+
24
+ We comprehensively validate the effectiveness of the proposed ResT on the commonly used benchmarks, including image classification on ImageNet-1k and downstream tasks, such as object detection, and instance segmentation on MS COCO2017. Experimental results demonstrate the effectiveness and generalization ability of the proposed ResT compared with the recently state-of-the-art Vision Transformers and CNNs. For example, with a similar model size as ResNet-18 $( 6 9 . 7 \% )$ and PVT-Tiny $( 7 5 . 1 \% )$ , our ResT-Small obtains a Top-1 accuracy of $7 9 . 6 \%$ on ImageNet-1k.
25
+
26
+ ![](images/65f7ce2f5ce3b94e45385c7067a52cb9a89e2cc7a73b9ebc0de61169161309fe.jpg)
27
+ Figure 2: The pipeline of the proposed ResT. Similar to ResNet [11], ResT build stages with stacked blocks, making it flexible to serve as the backbone of downstream tasks, such as Object detection, Person ReID, and Instance Segmentation, etc.
28
+
29
+ # 2 ResT
30
+
31
+ As illustrated in Figure 2, ResT shares exactly the same pipeline as ResNet [11], i.e., a stem module applied to extract low-level information, followed by four stages to capture multi-scale feature maps. Each stage consists of three components, one patch embedding module (or stem module), one positional encoding module, and a set of $L$ efficient Transformer blocks. Specifically, at the beginning of each stage, the patch embedding module is adopted to reduce the resolution of the input token and expanding the channel dimension. The positional encoding module is fused to restrain position information and strengthen the feature extracting ability of patch embedding. After that, the input token is fed to the efficient Transformer blocks (illustrated in Figure 1c). In the following sections, we will introduce the intuition behind ResT.
32
+
33
+ # 2.1 Rethinking of Transformer Block
34
+
35
+ The standard Transformer block consists of two sub-layers of MSA and FFN. A residual connection is employed around each sub-layer. Before MSA and FFN, layer normalization (LN [1]) is applied. For a token input $\mathbf { x } \in \mathbb { R } ^ { n \times d _ { m } }$ , where $n$ , $d _ { m }$ indicates the spatial dimension, channel dimension, respectively. The output for each Transformer block is:
36
+
37
+ $$
38
+ \mathrm { y } { = } \mathrm { x } ^ { \prime } + \mathrm { F F N } ( \mathrm { L N } ( \mathrm { x } ^ { \prime } ) ) , \mathrm { a n d } \mathrm { x } ^ { \prime } { = } \mathrm { x } + \mathrm { M S A } ( \mathrm { L N } ( \mathrm { x } ) )
39
+ $$
40
+
41
+ MSA. MSA first obtains query $\mathbf { Q }$ , key $\mathbf { K }$ , and value $\mathbf { V }$ by applying three sets of projections to the input, each consisting of $k$ linear layers (i.e., heads) that map the $d _ { m }$ dimensional input into a $d _ { k }$ dimensional space, where $d _ { k } = d _ { m } / k$ is the head dimension. For the convenience of description, we assume $k = 1$ , then MSA can be simplified to single-head self-attention (SA). The global relationship between the token sequence can be defined as
42
+
43
+ $$
44
+ \mathrm { S A } ( \mathbf { Q } , \mathbf { K } , \mathbf { V } ) = \mathrm { S o f t m a x } ( \frac { \mathbf { Q } \mathbf { K } ^ { \mathrm { T } } } { \sqrt { d _ { k } } } ) \mathbf { V }
45
+ $$
46
+
47
+ The output values of each head are then concatenated and linearly projected to form the final output. The computation costs of MSA are $\mathcal { O } ( 2 d _ { m } n ^ { 2 } + 4 d _ { m } ^ { 2 } n )$ , which scale quadratically with spatial dimension or embedding dimensions according to the input token.
48
+
49
+ FFN. The FFN is applied for feature transformation and non-linearity. It consists of two linear layers with a non-linearity activation. The first layer expands the embedding dimensions of the input from $d _ { m }$ to $d _ { f }$ and the second layer reduce the dimensions from $d _ { f }$ to $d _ { m }$ .
50
+
51
+ $$
52
+ \mathrm { F F N ( x ) } = \sigma ( \mathbf { x W } _ { 1 } + \mathbf { b } _ { 1 } ) \mathbf { W } _ { 2 } + \mathbf { b } _ { 2 }
53
+ $$
54
+
55
+ where $\mathbf { W } _ { 1 } \in \mathbb { R } ^ { d _ { m } \times d _ { f } }$ and $\mathbf { W } _ { 2 } \in \mathbb { R } ^ { d _ { f } \times d _ { m } }$ are weights of the two Linear layers respectively, $\mathbf { b } _ { 1 } \in \mathbb { R } ^ { d _ { f } }$ and $\mathbf { b } _ { 2 } \in \mathbb { R } ^ { d _ { m } }$ are the bias terms, and $\sigma ( \cdot )$ is the activation function GELU [12]. In standard Transformer block, the channel dimensions are expanded by a factor of 4, i.e., $d _ { f } = 4 d _ { m }$ . The computation costs of FFN are $8 n d _ { m } ^ { 2 }$ .
56
+
57
+ # 2.2 Efficient Transformer Block
58
+
59
+ As analyzed above, MSA has two shortcomings: (1) The computation scales quadratically with $d _ { m }$ or $n$ according to the input token, causing vast overheads for training and inference; (2) Each head in
60
+
61
+ MSA only responsible for a subset of embedding dimensions, which may impair the performance of the network, particularly when the tokens embedding dimension (for each head) is short.
62
+
63
+ ![](images/b78afb503a0c86e0027a7ef1fc7151b9522925a2052042ae657c6241bf6cf9d9.jpg)
64
+ Figure 3: Efficient Multi-Head Self-Attention.
65
+
66
+ To remedy these issues, we propose an efficient multi-head self-attention module (illustrated in Figure 3). Here, we make some explanations.
67
+
68
+ (1) Similar to MSA, EMSA first adopt a set of projections to obtain query $\mathbf { Q }$ .
69
+
70
+ (2) To compress memory, the 2D input token $\mathbf { x } \in \mathbb { R } ^ { n \times d _ { m } }$ is reshaped to 3D one along the spatial dimension (i.e., $\hat { \mathbf { x } } \in \mathbb { R } ^ { d _ { m } \times h \times w } )$ and then feed to a depth-wise convolution operation to reduce the height and width dimension by a factor $s$ . To make simple, $s$ is adaptive set by the feature map size or the stage number. The kernel size, stride and padding are $s + 1 , s$ , and $s / 2$ respectively.
71
+
72
+ (3) The new token map after spatial reduction $\hat { \mathbf { x } } \in \mathbb { R } ^ { d _ { m } \times h / s \times w / s }$ is then reshaped to 2D one, i.e., $\hat { \mathbf { x } } \in \mathbb { R } ^ { n ^ { \prime } \times d _ { m } }$ , $n ^ { \prime } = h / s \times w / s$ . Then $\hat { \bf x }$ is feed to two sets of projection to get key $\mathbf { K }$ and value $\mathbf { V }$ .
73
+
74
+ (4) After that, we adopt Eq. 4 to compute the attention function on query Q, $\mathbf { K }$ and value $\mathbf { V }$ .
75
+
76
+ $$
77
+ \operatorname { E M S A } ( \mathbf { Q } , \mathbf { K } , \mathbf { V } ) = \operatorname { I N } ( \operatorname { S o f t m a x } ( \operatorname { C o n v } ( { \frac { \mathbf { Q } \mathbf { K } ^ { \mathrm { T } } } { \sqrt { d _ { k } } } } ) ) ) \mathbf { V }
78
+ $$
79
+
80
+ Here, $\mathrm { C o n v } ( \cdot )$ is a standard $1 \times 1$ convolutional operation, which model the interactions among different heads. As a result, attention function of each head can depend on all of the keys and queries. However, this will impair the ability of MSA to jointly attend to information from different representation subsets at different positions. To restore this diversity ability, we add an Instance Normalization [27] (i.e, IN(·)) for the dot product matrix (after Softmax).
81
+
82
+ (5) Finally, the output values of each head are then concatenated and linearly projected to form the final output.
83
+
84
+ The computation costs of EMSA are O( 2dmn2s2 + 2d2mn(1 + 1s2 ) + dmn (s+1)2s2 + s2 , much lowerhigher. $s > 1$ $s$
85
+
86
+ Also, we add FFN after EMSA for feature transformation and non-linearity. The output for each efficient Transformer block is:
87
+
88
+ $$
89
+ \begin{array} { r } { \mathrm { y } { = } \mathrm { x } ^ { \prime } + \mathrm { F F N } ( \mathrm { L N } ( \mathrm { x } ^ { \prime } ) ) , \mathrm { a n d } \mathrm { x } ^ { \prime } { = } \mathrm { x } + \mathrm { E M S A } ( \mathrm { L N } ( \mathrm { x } ) ) } \end{array}
90
+ $$
91
+
92
+ # 2.3 Patch Embedding
93
+
94
+ The standard Transformer receives a sequence of token embeddings as input. Take ViT [5] as an example, the input image $\mathbf { x } \in \mathbb { R } ^ { 3 \times h \times w }$ is split with a patch size of $p \times p$ . These patches are flattened into 2D ones and then mapped to latent embeddings with a size of $c$ , i.e, $\mathbf { x } \in \mathbb { R } ^ { n \times c }$ , where $n = h w / p ^ { 2 }$ . However, this straightforward tokenization is failed to capture low-level feature information (such as edges and corners) [33]. In addition, the length of tokens in ViT are all of a fixed size in different blocks, making it unsuitable for downstream vision tasks such as object detection and instance segmentation that require multi-scale feature map representations.
95
+
96
+ Here, we build an efficient multi-scale backbone, calling ResT, for dense prediction. As introduced above, the efficient Transformer block in each stage operates on the same scale with identical resolution across the channel and spatial dimensions. Therefore, the patch embedding modules are required to progressively expand the channel dimension, while simultaneously reducing the spatial resolution throughout the network.
97
+
98
+ Similar to ResNet, the stem module (can be seen as the first patch embedding module) are adopted to shrunk both the height and width dimension with a reduction factor of 4. To effectively capture the low-feature information with few parameters, here we introduce a simple but effective way, i.e, stacking three $3 \times 3$ standard convolution layers (all with padding 1) with stride 2, stride 1, and stride 2, respectively. Batch Normalization [14] and ReLU activation [7] are applied for the first two layers. In stage 2, stage 3, and stage 4, the patch embedding module is adopted to down-sample the spatial dimension by $4 \times$ and increase the channel dimension by $2 \times$ . This can be done by a standard $3 \times 3$ convolution with stride 2 and padding 1. For example, patch embedding module in stage 2 changes resolution from $h / 4 \times w / 4 \times c$ to $h / 8 \times w / 8 \times 2 c$ (shown in Figure 2).
99
+
100
+ # 2.4 Positional Encoding
101
+
102
+ Positional encodings are crucial to exploiting the order of sequence. In ViT [5], a set of learnable parameters are added into the input tokens to encode positions. Let $\mathbf { x } \in \mathbb { R } ^ { n \times c }$ be the input, $\theta \in \mathbb { R } ^ { n \times c }$ be position parameters, then the encoded input can be represent as
103
+
104
+ $$
105
+ \hat { \mathbf { x } } = \mathbf { x } + \boldsymbol { \theta }
106
+ $$
107
+
108
+ However, the length of positions is exactly the same as the input tokens length, which limits the application scenarios.
109
+
110
+ To remedy this issue, the new positional encodings are required to have variable lengths according to input tokens. Let us look closer to Eq. 6, the summation operation is much like assigning pixel-wise weights to the input. Assume $\theta$ is related with x, i.e., $\theta = \operatorname { G L } ( { \bar { \mathbf { x } } } )$ , where $\mathrm { { G L } } \bar { ( } \cdot \bar { ) }$ is the group linear operation with the group number of $c$ . Then Eq. 6 can be modified to
111
+
112
+ $$
113
+ \hat { \mathbf { x } } = \mathbf { x } + \mathbf { G } \mathbf { L } ( \mathbf { x } )
114
+ $$
115
+
116
+ ![](images/2a1cb68bb31b2ecc0ecddcac99b1c7a749b83516085391718f916cd5bfb8182f.jpg)
117
+ Figure 4: Patch and PE in ResT.
118
+
119
+ Besides Eq. 7, $\theta$ can also be obtained by more flexible spatial attention mechanisms. Here, we propose a simple yet effective spatial attention module calling PA(pixel-attention) to encode positions. Specifically, PA applies a $3 \times 3$ depth-wise convolution (with padding 1) operation to get the pixel-wise weight and then scaled by a sigmoid function $\sigma ( \cdot )$ . The positional encoding with PA module can then be represented as
120
+
121
+ $$
122
+ \hat { \mathbf { x } } = \mathrm { P A } ( \mathrm { x } ) = \mathrm { x } * \sigma ( \mathrm { D W C o n v ( x ) } )
123
+ $$
124
+
125
+ Since the input token in each stage is also obtained by a convolution operation, we can embed the positional encoding into the patch embedding module. The whole structure of stage $i$ can be illustrated in Figure 4. Note that PA can be replaced by any spatial attention modules, making the positional encoding flexible in ResT.
126
+
127
+ # 2.5 Classification Head
128
+
129
+ The classification head is performed by a global average pooling layer on the output feature map of the last stage, followed by a linear classifier. The detailed ResT architecture for ImageNet-1k is shown
130
+
131
+ in Table 1, which contains four models, i.e., ResT-Lite, ResT-Small and ResT-Base and ResT-Large, which are bench-marked to ResNet-18, ResNet-18, ResNet-50, and ResNet-101, respectively.
132
+
133
+ Table 1: Architectures for ImageNet-1k. Here, we make some definitions. $\mathrm { \cdot C o n v } - k _ { - } c _ { - } s ^ { \prime }$ " means convolution layers with kernel size $k$ , output channel $c$ and stride $s$ . “MLP_ $. c "$ is the FFN structure with hidden channel $_ { 4 c }$ and output channel $c$ . And “EMSA_ $\boldsymbol { \it n \_ r ^ { \prime \prime } }$ is the EMSA operation with the number of heads $n$ and reduction $r$ . “ $\mathbf { C " }$ is 64 for ResT-Lite and ResT-Small, and 96 for ResT-Base and ResT-Large.“PA" is short for pixel-wise attention, which are introduced in Section 2.4.
134
+
135
+ <table><tr><td>Name</td><td>| Output |</td><td>Lite</td><td></td><td>Small</td><td></td><td>Base</td><td></td><td>Large</td><td></td></tr><tr><td>stem</td><td>[56×56|</td><td colspan="9">patch_embed: Conv-3_C/2_2,Conv-3_C/2_1,Conv-3_C_2,PA</td></tr><tr><td>stage1</td><td>56×56</td><td>EMSA_1_8 MLP_64</td><td>×2</td><td>EMSA_1_8 MLP_64</td><td>×2</td><td>EMSA_1_8 MLP_96</td><td>×2</td><td></td><td>EMSA_1_8 MLP_96</td><td>×2</td></tr><tr><td rowspan="2">stage2</td><td rowspan="2">28×28</td><td colspan="7">patch_embed: Conv-3_2C_2,PA</td><td rowspan="2"></td><td></td></tr><tr><td>EMSA_2_4 MLP_128</td><td>×2</td><td>EMSA_2_4 MLP_128</td><td>×2</td><td>EMSA_2_4 MLP_192</td><td>×2</td><td>EMSA_2_4 MLP_192</td><td>×2</td></tr><tr><td rowspan="2">stage3</td><td rowspan="2">|14× 14|</td><td colspan="8">patch_embed: Conv-3_4C_2,PA</td></tr><tr><td>EMSA_4_2 MLP_256</td><td>×2</td><td>EMSA_4_2 MLP_256</td><td></td><td>×6</td><td>EMSA_4_2 MLP_384</td><td>×6</td><td>EMSA_4_2 MLP_384</td><td>×18</td></tr><tr><td rowspan="2">stage4</td><td rowspan="2">7×7</td><td colspan="8">patch_embed: Conv-3_8C_2,PA</td></tr><tr><td>EMSA_8_1 MLP_512</td><td>×2</td><td>EMSA_8_1 MLP_512</td><td>×2</td><td>MLP_768</td><td>EMSA_8_1</td><td>×2</td><td>EMSA_8_1</td><td>×2</td></tr><tr><td>Classifier|</td><td>[1×1|</td><td colspan="8">MLP_768 average pool,100od fully-connected</td></tr><tr><td colspan="2">GFLOPs</td><td colspan="6">1.4 1.94</td><td colspan="2">7.91</td></tr></table>
136
+
137
+ # 3 Experiments
138
+
139
+ In this section, we conduct experiments on common-used benchmarks, including ImageNet-1k for classification, MS COCO2017 for object detection, and instance segmentation. In the following subsections, we first compared the proposed ResT with the previous state-of-the-arts on the three tasks. Then we adopt ablation studies to validate the important design elements of ResT.
140
+
141
+ # 3.1 Image Classification on ImageNet-1k
142
+
143
+ Settings. For image classification, we benchmark the proposed ResT on ImageNet-1k, which contains 1.28M training images and 50k validation images from 1,000 classes. The setting mostly follows [26]. Specifically, we employ the AdamW [20] optimizer for 300 epochs using a cosine decay learning rate scheduler and 5 epochs of linear warm-up. A batch size of 2048 (using 8 GPUs with 256 images per GPU), an initial learning rate of 5e-4, a weight decay of 0.05, and gradient clipping with a max norm of 5 are used. We include most of the augmentation and regularization strategies of [26] in training, including RandAugment [4], Mixup [35], Cutmix [34], Random erasing [40], and stochastic depth [13]. An increasing degree of stochastic depth augmentation is employed for larger models, i.e., 0.1, 0.1, 0.2, 0.3 for ResT-Lite, Rest-Small, ResT-Base, and ResT-Large, respectively. For the testing on the validation set, the shorter side of an input image is first resized to 256, and a center crop of $2 2 4 \times 2 2 4$ is used for evaluation.
144
+
145
+ Results. Table 2 presents comparisons to other backbones, including both Transformer-based ones and ConvNet-based ones. We can see, compared to the previous state-of-the-art Transformer-based architectures with similar model complexity, the proposed ResT achieves significant improvement by a large margin. For example, for smaller models, ResT noticeably surpass the counterpart PVT architectures with similar complexities: $+ 4 . 5 \%$ for ResT-Small $( 7 9 . 6 \% )$ over PVT-T $( 7 5 . 1 \% )$ . For larger models, ResT also significantly outperform the counterpart Swin architectures with similar complexities: $+ 0 . 3 \%$ for ResT-Base $( 8 1 . 6 \% )$ over Swin-T $( 8 1 . 3 \% )$ , and $+ 0 . 3 \%$ for ResT-Large $( 8 3 . 6 \% )$ over Swin-S $( 8 3 . 3 \% )$ using $2 2 4 \times 2 2 4$ input.
146
+
147
+ Table 2: Comparison with state-of-the-art backbones on ImageNet-1k benchmark. Throughput (images $/ s$ ) is measured on a single V100 GPU, following [26]. All models are trained and evaluated on $2 2 4 \times 2 2 4$ resolution. The best records and the improvements over bench-marked ResNets are marked in bold and blue, respectively.
148
+
149
+ <table><tr><td>Model</td><td>#Params (M)</td><td>FLOPs (G)</td><td>Throughput</td><td>Top-1 (%)</td><td>Top-5 (%)</td></tr><tr><td colspan="6">ConvNet</td></tr><tr><td>ResNet-18 [11]</td><td>11.7</td><td>1.8</td><td>1852</td><td>69.7</td><td>89.1</td></tr><tr><td>ResNet-50 [11]</td><td>25.6</td><td>4.1</td><td>871</td><td>79.0</td><td>94.4</td></tr><tr><td>ResNet-101[11]</td><td>44.7</td><td>7.9</td><td>635</td><td>80.3</td><td>95.2</td></tr><tr><td>RegNetY-4G [22]</td><td>20.6</td><td>4.0</td><td>1156</td><td>79.4</td><td>94.7</td></tr><tr><td>RegNetY-8G [22]</td><td>39.2</td><td>8.0</td><td>591</td><td>79.9</td><td>94.9</td></tr><tr><td>RegNetY-16G [22]</td><td>83.6</td><td>15.9</td><td>334</td><td>80.4</td><td>95.1</td></tr><tr><td colspan="6">Transformer</td></tr><tr><td>DeiT-S [26]</td><td>22.1</td><td>4.6</td><td>940</td><td>79.8</td><td>94.9</td></tr><tr><td>DeiT-B [26]</td><td>86.6</td><td>17.6</td><td>292</td><td>81.8</td><td>95.6</td></tr><tr><td>PVT-T [29]</td><td>13.2</td><td>1.9</td><td>1038</td><td>75.1</td><td>92.4</td></tr><tr><td>PVT-S [29]</td><td>24.5</td><td>3.7</td><td>820</td><td>79.8</td><td>94.9</td></tr><tr><td>PVT-M[29]</td><td>44.2</td><td>6.4</td><td>526</td><td>81.2</td><td>95.6</td></tr><tr><td>PVT-L [29]</td><td>61.4</td><td>9.5</td><td>367</td><td>81.7</td><td>95.9</td></tr><tr><td>Swin-T[19]</td><td>28.29</td><td>4.5</td><td>755</td><td>81.3</td><td>95.5</td></tr><tr><td>Swin-S[19]</td><td>49.61</td><td>8.7</td><td>437</td><td>83.3</td><td>96.2</td></tr><tr><td>Swin-B [19]</td><td>87.77</td><td>15.4</td><td>278</td><td>83.5</td><td>96.5</td></tr><tr><td>ResT-Lite (Ours)</td><td>10.49</td><td>1.4</td><td>1246</td><td>77.2 (个 7.5)</td><td>93.7 (个 4.6)</td></tr><tr><td>ResT-Small (Ours)</td><td>13.66</td><td>1.9</td><td>1043</td><td>79.6 (个 9.9)</td><td>94.9 (个 5.8)</td></tr><tr><td>ResT-Base (Ours)</td><td>30.28</td><td>4.3</td><td>673</td><td>81.6 (个 2.6)</td><td>95.7 (个 1.3)</td></tr><tr><td>ResT-Large (Ours)</td><td>51.63</td><td>7.9</td><td>429</td><td>83.6 (↑ 3.3)</td><td>96.3 (个 1.1)</td></tr></table>
150
+
151
+ Compared with the state-of-the-art ConvNets, i.e., RegNet, the ResT with similar model complexity also achieves better performance: an average improvement of $1 . 7 \%$ in terms of Top-1 Accuracy. Note that RegNet is trained via thorough architecture search, the proposed ResT is adapted from the standard Transformer and has strong potential for further improvement.
152
+
153
+ # 3.2 Object Detection and Instance Segmentation on COCO
154
+
155
+ Settings. Object detection and instance segmentation experiments are conducted on COCO 2017, which contains $1 1 8 \mathrm { k }$ training, 5k validation, and $2 0 \mathrm { k }$ test-dev images. We evaluate the performance of ResT using two representative frameworks: RetinaNet [18] and Mask RCNN [10]. For these two frameworks, we utilize the same settings: multi-scale training (resizing the input such that the shorter side is between 480 and 800 while the longer side is at most 1333), AdamW [20] optimizer (initial learning rate of 1e-4, weight decay of 0.05, and batch size of 16), and $1 \times$ schedule (12 epochs). Unlike CNN backbones, which adopt post normalization and can directly apply to downstream tasks. ResT employs the pre-normalization strategy to accelerate network convergence, which means the output of each stage is not normalized before feeding to FPN [17]. Here, we add a layer normalization (LN [1]) for the output of each stage (before FPN [17]), similar to Swin [19]. Results are reported on the validation split.
156
+
157
+ Object Detection Results. Table 3 lists the results of RetinaNet with different backbones. From these results, it can be seen that for smaller models, ResT-Small is $+ 3 . 6$ box AP higher (40.3 vs. 36.7) than PVT-T with a similar computation cost. For larger models, our ResT-Base surpassing the PVT-S by $+ 1 . 6$ box AP.
158
+
159
+ Table 3: Object detection performance on the COCO val2017 split using the RetinaNet framework.
160
+
161
+ <table><tr><td>Backbones</td><td>AP50:95</td><td>AP50</td><td>AP75</td><td>APs</td><td>APm</td><td>AP1</td><td>Param (M)</td></tr><tr><td>R18[11]</td><td>31.8</td><td>49.6</td><td>33.6</td><td>16.3</td><td>34.3</td><td>43.2</td><td>21.3</td></tr><tr><td>PVT-T[29]</td><td>36.7</td><td>56.9</td><td>38.9</td><td>22.6</td><td>38.8</td><td>50.0</td><td>23.0</td></tr><tr><td>ResT-Smal(Ours)</td><td>40.3</td><td>61.3</td><td>42.7</td><td>25.7</td><td>43.7</td><td>51.2</td><td>23.4</td></tr><tr><td>R50 [11]</td><td>37.4</td><td>56.7</td><td>40.3</td><td>23.1</td><td>41.6</td><td>48.3</td><td>37.9</td></tr><tr><td>PVT-S [29]</td><td>40.4</td><td>61.3</td><td>43.0</td><td>25.0</td><td>42.9</td><td>55.7</td><td>34.2</td></tr><tr><td>Swin-T[19]</td><td>41.5</td><td>62.1</td><td>44.1</td><td>27.0</td><td>44.2</td><td>53.2</td><td>38.5</td></tr><tr><td>ResT-Base (Ours)</td><td>42.0</td><td>63.2</td><td>44.8</td><td>29.1</td><td>45.3</td><td>53.3</td><td>40.5</td></tr><tr><td>R101[11]</td><td>38.5</td><td>57.8</td><td>41.2</td><td>21.4</td><td>42.6</td><td>51.1</td><td>56.9</td></tr><tr><td>PVT-M[29]</td><td>41.9</td><td>63.1</td><td>44.3</td><td>25.0</td><td>44.9</td><td>57.6</td><td>53.9</td></tr><tr><td>Swin-S[19]</td><td>44.5</td><td>65.7</td><td>47.5</td><td>27.4</td><td>48.0</td><td>59.9</td><td>59.8</td></tr><tr><td>ResT-Large (Ours)</td><td>44.8</td><td>66.1</td><td>48.0</td><td>28.3</td><td>48.7</td><td>60.3</td><td>61.8</td></tr></table>
162
+
163
+ Instance Segmentation Results. Table 4 compares the results of ResT with those of previous state-of-the-art models on the Mask RCNN framework. Rest-Small exceeds PVT-T by $+ 2 . 9$ box AP and $+ 2 . 1$ mask AP on the COCO val2017 split. As for larger models, ResT-Base brings consistent $+ 1 . 2$ and $+ 0 . 9$ gains over PVT-S in terms of box AP and mask AP, with slightly larger model size.
164
+
165
+ Table 4: Object detection and instance segmentation performance on the COCO val2017 split using Mask RCNN framework.
166
+
167
+ <table><tr><td>Backbones</td><td>APbox</td><td>APbgx</td><td>APbg</td><td>Apmask</td><td>APmask</td><td>APmask</td><td>Param (M)</td></tr><tr><td>R18[11]</td><td>34.0</td><td>54.0</td><td>36.7</td><td>31.2</td><td>51.0</td><td>32.7</td><td>31.2</td></tr><tr><td>PVT-T [29]</td><td>36.7</td><td>59.2</td><td>39.3</td><td>35.1</td><td>56.7</td><td>37.3</td><td>32.9</td></tr><tr><td>ResT-Small(Ours)</td><td>39.6</td><td>62.9</td><td>42.3</td><td>37.2</td><td>59.8</td><td>39.7</td><td>33.3</td></tr><tr><td>R50[11]</td><td>38.6</td><td>59.5</td><td>42.1</td><td>35.2</td><td>56.3</td><td>37.5</td><td>44.3</td></tr><tr><td>PVT-S[29]</td><td>40.4</td><td>62.9</td><td>43.8</td><td>37.8</td><td>60.1</td><td>40.3</td><td>44.1</td></tr><tr><td>ResT-Base(Ours)</td><td>41.6</td><td>64.9</td><td>45.1</td><td>38.7</td><td>61.6</td><td>41.4</td><td>49.8</td></tr></table>
168
+
169
+ # 3.3 Ablation Study
170
+
171
+ In this section, we report the ablation studies of the proposed ResT, using ImageNet-1k image classification. To thoroughly investigate the important design elements, we only adopt the simplest data augmentation and hyper-parameters settings in [11]. Specifically, the input images are randomly cropped to $2 2 4 \times 2 2 4$ with random horizontal flipping. All the architectures of ResT-Lite are trained with SGD optimizer (with weight decay 1e-4 and momentum 0.9) for 100 epochs, starting from the initial learning rate of $0 . 1 \times$ batch_size/512 (with a linear warm-up of 5 epochs) and decreasing it by a factor of 10 every 30 epochs. Also, a batch size of 2048 (using 8 GPUs with 256 images per GPU) is used.
172
+
173
+ Different types of stem module. Here, we test three type of stem modules: (1) the first patch embedding module in PVT [29], i.e., $4 \times 4$ convolution operation with stride 4 and no padding; (2) the stem module in ResNet [11], i.e., one $7 \times 7$ convolution layer with stride 2 and padding 3, followed by one $3 \times 3$ max-pooling layer; (3) the stem module in the proposed ResT, i.e., three $3 \times 3$ convolutional layers (all with padding 1) with stride 2, stride 1, and stride 2, respectively. We report the results in Table 5. The stem module in the proposed ResT is more effective than that in PVT and ResNet: $+ 0 . 9 2 \%$ and $+ 0 . 6 4 \%$ improvements in terms of Top-1 accuracy, respectively.
174
+
175
+ Ablation study on EMSA. As shown in Figure!3, we adopt a Depth-wise Conv2d to reduce the computation of MSA. Here, we provide the comparison of more strategies with the same reduction stride $s$ . Results are shown in Table 6. As can be seen, average pooling achieves slightly worse results $( - 0 . 2 4 \% )$ compared with the original Depth-wise Conv2d, while the results of the Max Pooling strategy are the worst. Since the pooling operation introduces no extra parameters, therefore, average pooling can be an alternative to Depth-wise Conv2d in practice.
176
+
177
+ Table 5: Comparison of various stem modules on ResT-Lite. Results show that the proposed stem module is more effective than existing ones in PVT and ResNet.
178
+
179
+ <table><tr><td>Stem</td><td>Top-1 (%)</td><td>Top-5 (%)</td></tr><tr><td>PVT[29]</td><td>71.96</td><td>89.87</td></tr><tr><td>ResNet [11]</td><td>72.24</td><td>90.17</td></tr><tr><td>ResT (Ours)</td><td>72.88</td><td>90.62</td></tr></table>
180
+
181
+ Table 6: Comparison of different reduction strategies of EMSA on ResT-Lite. Results show that Average Pooling can be an alternative to Depthwise Conv2d to make a trade-off.
182
+
183
+ <table><tr><td>Reduction</td><td>Top-1 (%)</td><td>Top-5 (%)</td></tr><tr><td>DWConv</td><td>72.88</td><td>90.62</td></tr><tr><td>Avg Pooling</td><td>72.64</td><td>90.41</td></tr><tr><td>Max Pooling</td><td>72.20</td><td>89.97</td></tr></table>
184
+
185
+ Table 7: Ablation study results on the important design elements of EMSA on ResT-Lite, including the $1 \times 1$ convolution operation and Instance Normalization in Eq. 4.
186
+
187
+ <table><tr><td>Methods</td><td>Top-1 (%)</td><td>Top-5 (%)</td></tr><tr><td>origin</td><td>72.88</td><td>90.62</td></tr><tr><td>w/o IN</td><td>71.98</td><td>90.32</td></tr><tr><td>w/o Conv-1&amp;IN</td><td>71.72</td><td>89.93</td></tr></table>
188
+
189
+ Table 8: Comparison of various positional encoding (PE) strategies on ResT-Lite.
190
+
191
+ <table><tr><td>Encoding</td><td>Top-1 (%)</td><td>Top-5 (%)</td></tr><tr><td>w/o position</td><td>71.54</td><td>89.82</td></tr><tr><td>+LE</td><td>71.98</td><td>90.32</td></tr><tr><td>+ GL</td><td>72.04</td><td>90.41</td></tr><tr><td>+ PA</td><td>72.88</td><td>90.62</td></tr></table>
192
+
193
+ In addition, EMSA also adding two important elements to the standard MSA, i.e., one $1 \times 1$ convolution operation to model the interaction among different heads, and the Instance Normalization(IN) to restore diversity of different heads. Here, we validate the effectiveness of these two settings. Results are shown in Table 7. We can see, without IN, the Top-1 accuracy is degraded by $0 . 9 \%$ , we attribute it to the destroying of diversity among different heads because the $1 \times 1$ convolution operation makes all heads focus on all the tokens. In addition, the performance drops $1 . 1 6 \%$ without the convolution operation and IN. This can demonstrate that the combination of long sequence and diversity are both important for attention function.
194
+
195
+ Different types of positional encoding. In section 2.4, we introduced 3 types of positional encoding types, i.e., the original learnable parameters with fixed lengths [5] (LE), the proposed group linear mode(GL), and PA mode. These encodings are added/multiplied to the input patch token at the beginning of each stage. Here, we compared the proposed GL and PA with LE, results are shown in Table 8. We can see, the Top-1 accuracy degrades from $7 2 . 8 8 \%$ to $7 1 . 5 4 \%$ when the PA encoding is removed, this means that positional encoding is crucial for ResT. The LE and GL, achieve similar performance, which means it is possible to construct variable length of positional encoding. Moreover, the PA mode significantly surpasses the GL, achieving $0 . 8 4 \%$ Top-1 accuracy improvement, which indicates that spatial attention can also be modeled as positional encoding.
196
+
197
+ # 4 Conclusion
198
+
199
+ In this paper, we proposed ResT, a new version of multi-scale Transformer which produces hierarchical feature representations for dense prediction. We compressed the memory of standard MSA and model the interaction between multi-heads while keeping the diversity ability. To tackle input images with arbitrary, we further redesign the positional encoding as spatial attention. Experimental results demonstrate that the potential of ResT as strong backbones for dense prediction. We hope that our approach will foster further research in visual recognition.
200
+
201
+ # Acknowledgments and Disclosure of Funding
202
+
203
+ This work is funded by the Natural Science Foundation of China (No. 62176119) and the program B for Outstanding PhD candidate of Nanjing University.
204
+
205
+ # References
206
+
207
+ [1] Lei Jimmy Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. Layer normalization. CoRR, abs/1607.06450, 2016.
208
+ [2] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In Andrea Vedaldi, Horst Bischof, Thomas Brox, and Jan-Michael Frahm, editors, Computer Vision - ECCV 2020 - 16th European Conference, Glasgow, UK, August 23-28, 2020, Proceedings, Part I, volume 12346 of Lecture Notes in Computer Science, pages 213–229. Springer, 2020.
209
+ [3] Hanting Chen, Yunhe Wang, Tianyu Guo, Chang Xu, Yiping Deng, Zhenhua Liu, Siwei Ma, Chunjing Xu, Chao Xu, and Wen Gao. Pre-trained image processing transformer. CoRR, abs/2012.00364, 2020.
210
+ [4] Ekin Dogus Cubuk, Barret Zoph, Jon Shlens, and Quoc Le. Randaugment: Practical automated data augmentation with a reduced search space. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin, editors, Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
211
+ [5] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021.
212
+ [6] Peng Gao, Jiasen Lu, Hongsheng Li, Roozbeh Mottaghi, and Aniruddha Kembhavi. Container: Context aggregation network. CoRR, abs/2106.01401, 2021.
213
+ [7] Xavier Glorot, Antoine Bordes, and Yoshua Bengio. Deep sparse rectifier neural networks. In Geoffrey J. Gordon, David B. Dunson, and Miroslav Dudík, editors, Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, AISTATS 2011, Fort Lauderdale, USA, April 11-13, 2011, volume 15 of JMLR Proceedings, pages 315–323. JMLR.org, 2011.
214
+ [8] Kai Han, An Xiao, Enhua Wu, Jianyuan Guo, Chunjing Xu, and Yunhe Wang. Transformer in transformer. CoRR, abs/2103.00112, 2021.
215
+ [9] Karttikeya Mangalam Yanghao Li Zhicheng Yan Jitendra Malik Christoph Feichtenhofer Haoqi Fan, Bo Xiong. Multiscale vision transformers. arXiv:2104.11227, 2021.
216
+ [10] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross B. Girshick. Mask R-CNN. In IEEE International Conference on Computer Vision, ICCV 2017, Venice, Italy, October 22-29, 2017, pages 2980–2988. IEEE Computer Society, 2017.
217
+ [11] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016, pages 770–778. IEEE Computer Society, 2016.
218
+ [12] Dan Hendrycks and Kevin Gimpel. Bridging nonlinearities and stochastic regularizers with gaussian error linear units. CoRR, abs/1606.08415, 2016.
219
+ [13] Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q. Weinberger. Deep networks with stochastic depth. In Bastian Leibe, Jiri Matas, Nicu Sebe, and Max Welling, editors, Computer Vision - ECCV 2016 - 14th European Conference, Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part IV, volume 9908 of Lecture Notes in Computer Science, pages 646–661. Springer, 2016.
220
+ [14] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Francis R. Bach and David M. Blei, editors, Proceedings of the 32nd International Conference on Machine Learning, ICML 2015, Lille, France, 6-11 July 2015, volume 37 of JMLR Workshop and Conference Proceedings, pages 448–456. JMLR.org, 2015.
221
+ [15] Md. Amirul Islam, Sen Jia, and Neil D. B. Bruce. How much position information do convolutional neural networks encode? In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020.
222
+ [16] Xiang Li, Wenhai Wang, Xiaolin Hu, and Jian Yang. Selective kernel networks. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16-20, 2019, pages 510–519. Computer Vision Foundation / IEEE, 2019.
223
+ [17] Tsung-Yi Lin, Piotr Dollár, Ross B. Girshick, Kaiming He, Bharath Hariharan, and Serge J. Belongie. Feature pyramid networks for object detection. In 2017 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA, July 21-26, 2017, pages 936–944, 2017.
224
+ [18] Tsung-Yi Lin, Priya Goyal, Ross B. Girshick, Kaiming He, and Piotr Dollár. Focal loss for dense object detection. In IEEE International Conference on Computer Vision, ICCV 2017, Venice, Italy, October 22-29, 2017, pages 2999–3007. IEEE Computer Society, 2017.
225
+ [19] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. CoRR, abs/2103.14030, 2021.
226
+ [20] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net, 2019.
227
+ [21] Niki Parmar, Prajit Ramachandran, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jon Shlens. Stand-alone self-attention in vision models. In Hanna M. Wallach, Hugo Larochelle, Alina Beygelzimer, Florence d’Alché-Buc, Emily B. Fox, and Roman Garnett, editors, Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pages 68–80, 2019.
228
+ [22] Ilija Radosavovic, Raj Prateek Kosaraju, Ross B. Girshick, Kaiming He, and Piotr Dollár. Designing network design spaces. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2020, Seattle, WA, USA, June 13-19, 2020, pages 10425–10433. IEEE, 2020.
229
+ [23] Aravind Srinivas, Tsung-Yi Lin, Niki Parmar, Jonathon Shlens, Pieter Abbeel, and Ashish Vaswani. Bottleneck transformers for visual recognition. CoRR, abs/2101.11605, 2021.
230
+ [24] Zhi Tian, Chunhua Shen, and Hao Chen. Conditional convolutions for instance segmentation. In Andrea Vedaldi, Horst Bischof, Thomas Brox, and Jan-Michael Frahm, editors, 16th European Conference on Computer Vision, ECCV 2020, Glasgow, UK, August 23-28, 2020, Proceedings, Part I, volume 12346 of Lecture Notes in Computer Science, pages 282–298. Springer, 2020.
231
+ [25] Zhi Tian, Chunhua Shen, Hao Chen, and Tong He. FCOS: A simple and strong anchor-free object detector. CoRR, abs/2006.09214, 2020.
232
+ [26] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. CoRR, abs/2012.12877, 2020.
233
+ [27] Dmitry Ulyanov, Andrea Vedaldi, and Victor S. Lempitsky. Instance normalization: The missing ingredient for fast stylization. CoRR, abs/1607.08022, 2016.
234
+ [28] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett, editors, Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 5998–6008, 2017.
235
+ [29] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv preprint arXiv:2102.12122, 2021.
236
+ [30] Xiaolong Wang, Ross B. Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. CoRR, abs/1711.07971, 2017.
237
+ [31] Xinlong Wang, Rufeng Zhang, Tao Kong, Lei Li, and Chunhua Shen. Solov2: Dynamic, faster and stronger. CoRR, abs/2003.10152, 2020.
238
+ [32] Saining Xie, Ross B. Girshick, Piotr Dollár, Zhuowen Tu, and Kaiming He. Aggregated residual transformations for deep neural networks. In 2017 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA, July 21-26, 2017, pages 5987–5995. IEEE Computer Society, 2017.
239
+ [33] Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Francis E. H. Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. CoRR, abs/2101.11986, 2021.
240
+ [34] Sangdoo Yun, Dongyoon Han, Sanghyuk Chun, Seong Joon Oh, Youngjoon Yoo, and Junsuk Choe. Cutmix: Regularization strategy to train strong classifiers with localizable features. In 2019 IEEE/CVF International Conference on Computer Vision, ICCV 2019, Seoul, Korea (South), October 27 - November 2, 2019, pages 6022–6031. IEEE, 2019.
241
+ [35] Hongyi Zhang, Moustapha Cissé, Yann N. Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net, 2018.
242
+ [36] Hang Zhang, Chongruo Wu, Zhongyue Zhang, Yi Zhu, Zhi Zhang, Haibin Lin, Yue Sun, Tong He, Jonas Mueller, R. Manmatha, Mu Li, and Alexander J. Smola. Resnest: Split-attention networks. CoRR, abs/2004.08955, 2020.
243
+ [37] Qing-Long Zhang, Lu Rao, and Yubin Yang. Group-cam: Group score-weighted visual explanations for deep convolutional networks. CoRR, abs/2103.13859, 2021.
244
+ [38] Qing-Long Zhang and Yu-Bin Yang. Sa-net: Shuffle attention for deep convolutional neural networks. CoRR, abs/2102.00240, 2021.
245
+ [39] Zelin Zhao, Karan Samel, Binghong Chen, and Le Song. Proto: Program-guided transformer for programguided tasks. CoRR, abs/2110.00804, 2021.
246
+ [40] Zhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, and Yi Yang. Random erasing data augmentation. In The Thirty-Fourth AAAI Conference on Artificial Intelligence, AAAI 2020, The Thirty-Second Innovative Applications of Artificial Intelligence Conference, IAAI 2020, The Tenth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2020, New York, NY, USA, February 7-12, 2020, pages 13001– 13008. AAAI Press, 2020.
247
+ [41] Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable DETR: deformable transformers for end-to-end object detection. CoRR, abs/2010.04159, 2020.
md/train/70kOIgjKhbA/70kOIgjKhbA.md ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # When Does Contrastive Learning Preserve Adversarial Robustness from Pretraining to Finetuning?
2
+
3
+ Lijie Fan1, Sijia $\mathbf { L i u ^ { 2 , 3 } }$ , Pin-Yu Chen3, Gaoyuan Zhang3, Chuang Gan3
4
+
5
+ 1 Massachusetts Institute of Technology, 2 Michigan State University, 3 MIT-IBM Watson AI Lab, IBM Research lijiefan@mit.edu, liusiji5@msu.edu, {pin-yu.chen,gaoyuan.zhang,chuangg}@ibm.com
6
+
7
+ # Abstract
8
+
9
+ Contrastive learning (CL) can learn generalizable feature representations and achieve state-of-the-art performance of downstream tasks by finetuning a linear classifier on top of it. However, as adversarial robustness becomes vital in image classification, it remains unclear whether or not CL is able to preserve robustness to downstream tasks. The main challenge is that in the ‘self-supervised pretraining $^ +$ supervised finetuning’ paradigm, adversarial robustness is easily forgotten due to a learning task mismatch from pretraining to finetuning. We call such challenge ‘cross-task robustness transferability’. To address the above problem, in this paper we revisit and advance CL principles through the lens of robustness enhancement. We show that (1) the design of contrastive views matters: High-frequency components of images are beneficial to improving model robustness; (2) Augmenting CL with pseudo-supervision stimulus (e.g., resorting to feature clustering) helps preserve robustness without forgetting. Equipped with our new designs, we propose ADVCL, a novel adversarial contrastive pretraining framework. We show that ADVCL is able to enhance cross-task robustness transferability without loss of model accuracy and finetuning efficiency. With a thorough experimental study, we demonstrate that ADVCL outperforms the state-of-the-art self-supervised robust learning methods across multiple datasets (CIFAR-10, CIFAR-100 and STL-10) and finetuning schemes (linear evaluation and full model finetuning). Code is available at https://github.com/LijieFan/AdvCL.
10
+
11
+ # 1 Introduction
12
+
13
+ Image classification has been revolutionized by convolutional neural networks (CNNs). In spite of CNNs’ generalization power, the lack of adversarial robustness has shown to be a main weakness that gives rise to security concerns in high-stakes applications when CNNs are applied, e.g., face recognition, medical image classification, surveillance, and autonomous driving [1–5]. The brittleness of CNNs can be easily manifested by generating tiny input perturbations to completely alter the models’ decision. Such input perturbations and corresponding perturbed inputs are referred to as adversarial perturbations and adversarial examples (or attacks), respectively [6–10].
14
+
15
+ One of the most powerful defensive schemes against adversarial attacks is adversarial training (AT) [11], built upon a two-player game in which an ‘attacker’ crafts input perturbations to maximize the training objective for worst-case robustness, and a ‘defender’ minimizes the maximum loss for an improved robust model against these attacks. However, AT and its many variants using min-max optimization [12–21] were restricted to supervised learning as true labels of training data are required for both supervised classifier and attack generator (that ensures misclassification). The recent work [22–24] demonstrated that with a properly-designed attacker’s objective, AT-type defenses can be generalized to the semi-supervised setting, and showed that the incorporation of additional unlabeled data could further improve adversarial robustness in image classification. Such an extension from supervised to semi-supervised defenses further inspires us to ask whether there exist unsupervised defenses that can eliminate the prerequisite of labeled data but improve model robustness.
16
+
17
+ Some very recent literature [25–29] started tackling the problem of adversarial defense through the lens of self-supervised learning. Examples include augmenting a supervised task with an unsupervised ‘pretext’ task for which ground-truth label is available for ‘free’ [25, 26], or robustifying unsupervised representation learning based only on a pretext task and then finetuning the learned representations over downstream supervised tasks [27–29]. The latter scenario is of primary interest to us as a defense can then be performed at the pretraining stage without needing any label information. Meanwhile, selfsupervised contrastive learning (CL) has been outstandingly successful in the field of representation learning: It can surpass a supervised learning counterpart on downstream image classification tasks in standard accuracy [30–34]. Different from conventional self-supervised learning methods [35], CL, e.g., SimCLR [30], enforces instance discrimination by exploring multiple views of the same data and treating every instance under a specific view as a class of its own [36].
18
+
19
+ The most relevant work to ours is [27, 28], which integrated adversarial training with CL. However, the achieved adversarial robustness at downstream tasks largely relies on the use of advanced finetuning techniques, either adversarial full finetuning [27] or adversarial linear finetuning [28]. Different from [27, 28], we ask:
20
+
21
+ # $( Q )$ How to accomplish robustness enhancement using CL without losing its finetuning efficiency, e.g., via a standard linear finetuner?
22
+
23
+ Our work attempts to make a rigorous and comprehensive study on addressing the above question. We find that self-supervised learning (including the state-of-the-art CL) suffers a new robustness challenge that we call ‘crosstask robustness transferability’, which was largely overlooked in the previous work. That is, there exists a task mismatch from pretraining to finetuning (e.g., from CL to supervised classification) so that adversarial robustness is not able to transfer across tasks even if pretraining datasets and finetuning datasets are drawn from the same distribution. Different from supervised/semi-supervised learning, this is a characteristic behavior of selfsupervision when being adapted to robust
24
+
25
+ ![](images/7f2ea9a79a438faed069f2c9db9cf64dabc61ba859861ba7da0ab921e88b9765.jpg)
26
+ Figure 1: Summary of performance for various robust pretraining methods on CIFAR-10. The covered baseline methods include AP-DPE [26], RoCL [28], ACL [27] and supervised adversarial training (AT) [11]. Upper-right indicates better performance with respect to (w.r.t.) standard accuracy and robust accuracy (under PGD attack with 20 steps and $8 / 2 5 5 \ell _ { \infty }$ -norm perturbation strength). Different colors represent different pretraining methods, and different shapes represent different finetuning settings. Circles $\mathbf { \eta } ^ { ( \bullet ) }$ indicates Standard Linear Finetuning (SLF), and Diamonds $( \bullet )$ indicates Adversarial Full Finetuning (AFF). Our method (ADVCL, red circle/diamond) has the best performance across finetuning settings. Similar improvement could be observed under Auto-Attacks, and we provide the visualization in the appendix.
27
+
28
+ learning. As shown in Figure 1, our work advances CL in the adversarial context and the proposed method outperforms all state-of-the-art baseline methods, leading to a substantial improvement in both robust accuracy and standard accuracy using either the lightweight standard linear finetuning or end-to-end adversarial full finetuning.
29
+
30
+ Contributions Our main contributions are summarized below.
31
+
32
+ $\bullet$ We propose ADVCL, a unified adversarial CL framework, and propose to use original adversarial examples and high-frequency data components to create robustness-aware and generalization-aware views of unlabeled data.
33
+
34
+ $\pmb { \varrho }$ We propose to generate proper pseudo-supervision stimulus for ADVCL to improve cross-task robustness transferability. Different from existing self-supervised defenses aided with labeled data [27], we generate pseudo-labels of unlabeled data based on their clustering information.
35
+
36
+ $\otimes$ We conduct a thorough experimental study and show that ADVCL achieves state-of-the-art robust accuracies under both PGD attacks [11] and Auto-Attacks [37] using only standard linear finetuning. For example, in the case of Auto-Attack (the most powerful threat model) with $8 / 2 5 5 ~ \ell _ { \infty }$ -norm perturbation strength under ResNet-18, we achieve $3 . 4 4 \%$ and $3 . 4 5 \%$ robustness improvement on CIFAR-10 and CIFAR-100 over existing self-supervised methods. We also justify the effectiveness of ADVCL in different attack setups, dataset transferring, model explanation, and loss landscape smoothness.
37
+
38
+ # 2 Background & Related Work
39
+
40
+ Self-Supervised Learning Early approaches for unsupervised representation learning leverages handcrafted tasks, like prediction rotation [38] and solving the Jigsaw puzzle [39, 40], geometry prediction [41] and Selfie [42]. Recently contrastive learning (CL) [30, 33, 34, 43–45] and its variants [31, 32, 36, 46] have demonstrated superior abilities in learning generalizable features in an unsupervised manner. The main idea behind $\mathrm { C L }$ is to self-create positive samples of the same image from aggressive viewpoints, and then acquire data representations by maximizing agreement between positives while contrasts with negatives.
41
+
42
+ In what follows, we elaborate on the formulation of SimCLR [30], one of the most commonly-used CL frameworks, which this paper will focus on. To be concrete, let $\mathcal { X } = \{ x _ { 1 } , x _ { 2 } , . . . , x _ { n } \}$ denote an unlabeled source dataset, SimCLR offers a learned feature encoder $f _ { \theta }$ to generate expressive deep representations of the data. To train $f _ { \theta }$ , each input $x \in \mathcal { X }$ will be transformed into two views $( \tau _ { 1 } ( x ) , \tau _ { 2 } ( x ) )$ and labels them as a positive pair. Here transformation operations $\tau _ { 1 }$ and $\tau _ { 2 }$ are randomly sampled from a pre-defined transformation set $\tau$ , which includes, e.g., random cropping and resizing, color jittering, rotation, and cutout. The positive pair is then fed in the feature encoder $f _ { \theta }$ with a projection head $g$ to acquire projected features, i.e., $z _ { i } = g \circ f _ { \theta } ( \tau _ { i } ( x ) )$ for $j \in \{ 1 , 2 \}$ . NT-Xent loss (i.e., the normalized temperature-scaled cross-entropy loss) is then applied to optimizing $f _ { \theta }$ , where the distance of projected positive features $( z _ { 1 } , z _ { 2 } )$ is minimized for each input $x$ . SimCLR follows the ‘self-supervised pretraining $^ +$ supervised finetuning’ paradigm. That is, once $f _ { \theta }$ is trained, a downstream supervised classification task can be handled by just finetuning a linear classifier $\phi$ over the fixed encoder $f _ { \theta }$ , leading to the eventual classification network $\phi \circ f _ { \theta }$ .
43
+
44
+ Adversarial Training (AT) Deep neural networks are vulnerable to adversarial attacks. Various approaches have been proposed to enhance the model robustness. Given a classification model $\theta$ , AT [11] is one of the most powerful robust training methods against adversarial attacks. Different from standard training over normal data $( x , y ) \in \mathcal { D }$ (with feature $x$ and label $y$ in dataset $\mathcal { D }$ ), AT adopts a min-max training recipe, where the worst-case training loss is minimized over the adversarially perturbed data $( x + \delta , y )$ . Here $\delta$ denotes the input perturbation variable to be maximized for the worst-case training objective. The supervised $A T$ is then formally given by
45
+
46
+ $$
47
+ \operatorname* { m i n } _ { \theta } \mathbb { E } _ { ( x , y ) \in D } \ \operatorname* { m a x } _ { \| \delta \| _ { \infty } \leq \epsilon } \ell ( x + \delta , y ; \theta ) ,
48
+ $$
49
+
50
+ where $\ell$ denotes the supervised training objective, e.g., cross-entropy (CE) loss. There have been many variants of AT [19–21, 47–50, 22–25] established for supervised/semi-supervised learning.
51
+
52
+ Self-supervision enabled AT Several recent works [26–29] started to study how to improve model robustness using self-supervised AT. Their idea is to apply AT (1) to a self-supervised pretraining task, e.g., SimCLR in [27, 28], such that the learned feature encoder $f _ { \theta }$ renders robust data representations. However, different from our work, the existing ones lack a systematic study on when and how self-supervised robust pretraining can preserve robustness to downstream tasks without sacrificing the efficiency of lightweight finetuning. For example, the prior work [26, 27] suggested adversarial full finetuning, where pretrained model is used as a weight initialization in finetuning downstream tasks. Yet, it requests the finetuner to update all of the weights of the pretrained model, and thus makes the advantage of self-supervised robust pretraining less significant. A more practical scenario is linear finetuning: One freezes the pretrained feature encoder for the downstream task and only partially finetunes a linear prediction head. The work [28] evaluated the performance of linear fintuning but observed a relatively large performance gap between the standard linear finetuning and adversarial linear finetuning; see more comparisons in Figure 1. Therefore, the problem–how to enhance robustness transferability from pretraining to linear finetuning–remains unexplored.
53
+
54
+ # 3 Problem Statement
55
+
56
+ In this section, we present the problem of our interest, together with its setup.
57
+
58
+ Robust pretraining $^ +$ linear finetuning. We aim to develop robustness enhancement solutions by fully exploiting and exploring the power of CL at the pretraining phase, so that the resulting robust feature representations can seamlessly be used to generate robust predictions of downstream tasks using just a lightweight finetuning scheme. With the aid of AT (1), we formulate the ‘robust pretraining $^ +$ linear finetuning’ problem below:
59
+
60
+ $$
61
+ \begin{array} { r l } & { \mathrm { P r e t r a i n i n g : ~ } \operatorname* { m i n } _ { \theta } \mathbb { E } _ { x \in \mathcal { X } } \underset { \| \delta \| _ { \infty } \leq \epsilon } { \operatorname* { m a x } } \ell _ { \mathrm { p r e } } ( x + \delta , x ; \theta ) } \\ & { \mathrm { F i n e t u n i n g : ~ } \operatorname* { m i n } _ { \theta _ { \mathrm { c } } } \mathbb { E } _ { ( x , y ) \in \mathcal { D } } \ell _ { \mathrm { C E } } ( \phi _ { \theta _ { \mathrm { c } } } \circ f _ { \theta } ( x ) , y ) , } \end{array}
62
+ $$
63
+
64
+ where $\ell _ { \mathrm { p r e } }$ denotes a properly-designed robustness- and generalization-aware CL loss (see Sec. 4) given as a function of the adversarial example $( x + \delta )$ , original example $x$ and feature encoder parameters $\theta$ . In (2), $\phi _ { \theta _ { \mathrm { c } } } \circ f _ { \theta }$ denotes the classifier by equipping the linear prediction head $\phi _ { \theta _ { \mathrm { c } } }$ (with parameters $\theta _ { \mathrm { c } }$ to be designed) on top of the fixed feature encoder $f _ { \theta }$ , and $\ell _ { \mathrm { C E } }$ denotes the supervised CE loss over the target dataset $\mathcal { D }$ . Note that besides the standard linear finetuning (3), one can also modify (3) using the worst-case CE loss for adversarial linear/full finetuning [27, 28]. We do not consider standard full finetuning in the paper since tuning the full network weights with standard cross-entropy loss is not possible for the model to preserve robustness [26].
65
+
66
+ Cross-task robustness transferability. Different from supervised/semi-supervised learning, selfsupervision enables robust pretraining over unlabeled source data. In the meantime, it also imposes a new challenge that we call ‘cross-task robustness transferability’: At the pretraining stage, a feature encoder is learned over a ‘pretext’ task for which ground-truth is available for free, while finetuning is typically carried out on a new downstream task. Spurred by the above, we ask the following questions:
67
+
68
+ • Will CL improve adversarial robustness using just standard linear finetuning? • What are the principles that CL should follow to preserve robustness across tasks? • What are the insights can we acquire from self-supervised robust representation learnin
69
+
70
+ # 4 Proposed Approach: Adversarial Contrastive Learning (ADVCL)
71
+
72
+ In this section, we develop a new adversarial CL framework, ADVCL, which includes two main components, robustnessaware view selection and pseudosupervision stimulus generation. In particular, we advance the view selection mechanism by taking into account proper frequencybased data transformations that are beneficial to robust representation learning and pretraining generalization ability. Furthermore, we propose to design and integrate proper supervision stimulus into ADVCL so as to improve the cross-task robustness transferability since robust representations learned from self
73
+
74
+ ![](images/64439f7f468608e7582a2cfebf1a4bda02c24138dbb68096c8644d0018589fe2.jpg)
75
+ Figure 2: The overall pipeline of ADVCL. It mainly has two ingredients: robustness-aware view selection (orange box) and pseudo-supervision stimulus generation (blue box). The view selection mechanism is advanced by high frequency components, and the supervision stimulus is created by generating pseudo labels for each image through CLUSTERFIT. The pseudo label (in yellow color) can be created in an offline manner and will not increase the computation overhead.
76
+
77
+ supervision may lack the class-discriminative ability required for robust predictions on downstream tasks. We provide an overview of ADVCL in Figure 2.
78
+
79
+ # 4.1 View selection mechanism
80
+
81
+ In contrast to standard CL, we propose two additional contrastive views: the adversarial view and the frequency view, respectively.
82
+
83
+ Multi-view CL loss Prior to defining new views, we first review the NT-Xent loss and its multiview version used in CL. Following notations defined in Sec. 2, the contrastive loss with respect to (w.r.t.) a positive pair $( \tau _ { 1 } ( x ) , \tau _ { 2 } ( x ) \bar { ) }$ of each (unlabeled) data $x$ is given by
84
+
85
+ $$
86
+ \ell _ { \mathrm { C L } } ( \tau _ { 1 } ( x ) , \tau _ { 2 } ( x ) ) = - \sum _ { i = 1 } ^ { 2 } \sum _ { j \in \mathcal { P } ( i ) } \log \frac { \exp { \left( \sin ( z _ { i } , z _ { j } ) / t \right) } } { \sum _ { k \in \mathcal { N } ( i ) } \exp { \left( \sin ( z _ { i } , z _ { k } ) / t \right) } } ,
87
+ $$
88
+
89
+ where recall that $z _ { i } = g \circ f ( \tau _ { i } ( x ) )$ is the projected feature under the ith view, $\mathcal { P } ( i )$ is the set of positive views except $i$ (e.g., $\mathcal { P } ( i ) = \{ 2 \}$ if $i = 1$ ), $\mathcal { N } ( i )$ denotes the set of augmented batch data except the point $\tau _ { i } ( x )$ , the cardinality of $\mathcal { N } ( i )$ is $( 2 b - 1 )$ (for a data batch of size $b$ under 2 views), $\sin ( z _ { i 1 } , z _ { i 2 } )$ denotes the cosine similarity between representations from two views of the same data, exp denotes exponential function, $\mathrm { s i m } ( \cdot , \cdot )$ is the cosine similarity between two points, and $t > 0$ is a temperature parameter. The two-view CL objective can be further extend to the multi-view contrastive loss [51]
90
+
91
+ $$
92
+ \ell _ { \mathrm { C L } } ( \tau _ { 1 } ( x ) , \tau _ { 2 } ( x ) , \dots , \tau _ { m } ( x ) ) = - \sum _ { i = 1 } ^ { m } \sum _ { j \in \mathcal { P } ( i ) } \log \frac { \exp { \left( \sin ( z _ { i } , z _ { j } ) / t \right) } } { \displaystyle \sum _ { k \in \mathcal { N } ( i ) } \exp { \left( \sin ( z _ { i } , z _ { k } ) / t \right) } } ,
93
+ $$
94
+
95
+ where $\mathcal { P } ( i ) ~ = ~ [ m ] / \{ i \}$ denotes the $m$ positive views except $i$ , $[ m ]$ denotes the integer set $\{ 1 , 2 , \ldots , { \dot { m } } \}$ , and $\mathcal { N } ( i )$ , with cardinality $( b m - 1 )$ , denotes the set of $m$ -view augmented $b$ batch samples except the point $\tau _ { i } ( x )$ .
96
+
97
+ Contrastive view from adversarial example Existing methods proposed in [27–29] can be explained based on (4): An adversarial perturbation $\delta$ w.r.t. each view of a sample $x$ is generated by maximizing the contrastive loss:
98
+
99
+ $$
100
+ \delta _ { 1 } ^ { * } , \delta _ { 2 } ^ { * } = \underset { \| \delta _ { i } \| _ { \infty } \leq \epsilon } { \mathrm { a r g m a x } } \ell _ { \mathrm { C L } } ( \tau _ { 1 } ( x ) + \delta _ { 1 } , \tau _ { 2 } ( x ) + \delta _ { 2 } ) .
101
+ $$
102
+
103
+ A solution to problem (6) eventually yields a paired perturbation view $( \tau _ { 1 } ( x ) + \delta _ { 1 } ^ { * } , \tau _ { 2 } ( x ) + \delta _ { 2 } ^ { * } )$ . However, the definition of adversarial view (6) used in [27–29] may not be proper. First, standard CL commonly uses aggressive data transformation that treats small portions of images as positive samples of the full image [36]. Despite its benefit to promoting generalization, crafting perturbations over such aggressive data transformations may not be suitable for defending adversarial attacks applied to full images in the adversarial context. Thus, a new adversarial view built upon $x$ rather than $\tau _ { i } ( x )$ is desired. Second, the contrastive loss (4) is only restricted to two views of the same data. As will be evident later, the multi-view contrastive loss is also needed when taking into account multiple robustness-promoting views. Spurred by above, we define the adversarial view over $x$ , without modifying the existing data augmentations $( \tau _ { 1 } ( x ) , \tau _ { 2 } ( x ) )$ . This leads to the following adversarial perturbation generator by maximizing a 3-view contrastive loss
104
+
105
+ $$
106
+ \delta ^ { * } = \underset { \| \delta \| \leq \epsilon } { \mathrm { a r g m a x } } \ell _ { \mathrm { C L } } ( \tau _ { 1 } ( x ) , \tau _ { 2 } ( x ) , x + \delta ) ,
107
+ $$
108
+
109
+ where $x + \delta ^ { * }$ is regarded as the third view of $x$
110
+
111
+ Contrastive view from high-frequency component Next, we use the high-frequency component (HFC) of data as another additional contrastive view. The rationale arises from the facts that 1) learning over HFC of data is a main cause of achieving superior generalization ability [52] and 2) an adversary typically concentrates on HFC when manipulating an example to fool model’s decision [53]. Let $\mathcal { F }$ and $\scriptstyle { \dot { \mathcal { F } } } ^ { - 1 }$ denote Fourier transformation and its inverse. An input image $x$ can then be decomposed into its HFC $x _ { \mathrm { h } }$ and low-frequency component (LFC) $x _ { \mathrm { l } }$ :
112
+
113
+ $$
114
+ x _ { \mathrm { h } } = \mathcal { F } ^ { - 1 } ( q _ { \mathrm { h } } ) , \quad x _ { \mathrm { l } } = \mathcal { F } ^ { - 1 } ( q _ { \mathrm { l } } ) , \quad [ q _ { \mathrm { h } } , q _ { \mathrm { l } } ] = \mathcal { F } ( x ) .
115
+ $$
116
+
117
+ In (8), the distinction between $q _ { \mathrm { h } }$ and $q _ { \mathrm { l } }$ is made by a hard thresholding operation. Let $q ( i , j )$ denote the $( i , j )$ th element of $\mathcal { F } ( x )$ , and $c = ( c _ { 1 } , c _ { 2 } )$ denote the centriod of the frequency spectrum. The components $q _ { \mathrm { l } }$ and $q _ { \mathrm { h } }$ in (8) are then generated by filtering out values according to the distance from c: $q _ { h } ( i , j ) = \mathbb { 1 } _ { [ d ( ( i , j ) , ( c _ { 1 } , c _ { 2 } ) ) \geq r ] } \cdot q ( i , j )$ , and $q _ { l } ( i , j ) = \mathbb { 1 } _ { [ d ( ( i , j ) , ( c _ { 1 } , c _ { 2 } ) ) \leq r ] } \cdot q ( i , j )$ , where $d ( \cdot , \cdot )$ is the Euclidian distance between two spatial coordinates, $r$ is a pre-defined distance threshold $r = 8$ in all our experiments), and $\mathbb { 1 } _ { [ . ] } \in \{ 0 , 1 \}$ is an indicator function which equals to 1 if the condition within $[ \cdot ]$ is met and 0 otherwise.
118
+
119
+ Robustness-aware contrastive learning objective By incorporating the adversarial perturbation $\delta$ and disentangling HFC $x _ { \mathrm { h } }$ from the original data $x$ , we obtain a four-view contrastive loss (5) defined over $( \tau _ { 1 } ( x ) , \tau _ { 2 } ( x ) , x + \delta , x _ { \mathrm { h } } )$ ,
120
+
121
+ $$
122
+ \ell _ { \mathrm { C L } } ^ { \mathrm { a d v } } ( \theta ; \mathcal { X } ) : = \mathbb { E } _ { x \in \mathcal { X } } \operatorname* { m a x } _ { \| \delta \| _ { \infty } \leq \epsilon } \ell _ { \mathrm { C L } } ( \tau _ { 1 } ( x ) , \tau _ { 2 } ( x ) , x + \delta , x _ { \mathrm { h } } ; \theta ) ,
123
+ $$
124
+
125
+ where recall that $\mathcal { X }$ denotes the unlabeled dataset, $\epsilon > 0$ is a perturbation tolerance during training, and for clarity, the four-view contrastive loss (5) is explicitly expressed as a function of model parameters $\theta$ . As will be evident latter, the eventual learning objective ADVCL will be built upon (9).
126
+
127
+ # 4.2 Supervision stimulus generation: ADVCL empowered by CLUSTERFIT
128
+
129
+ On top of (9), we further improve the robustness transferability of learned representations by generating a proper supervision stimulus. Our rationale is that robust representation could lack the class-discriminative power required by robust classification as the former is acquired by optimizing an unsupervised contrastive loss while the latter is achieved by a supervised cross-entropy CE loss. However, there is no knowledge about supervised data during pretraining. In order to improve crosstask robustness transferability but without calling for supervision, we take advantage of CLUSTERFIT [54], a pseudo-label generation method used in representation learning.
130
+
131
+ To be more concrete, let $f _ { \mathrm { p r e } }$ denote a pretrained representation network that can generate latent features of unlabeled data. Note that $f _ { \mathrm { p r e } }$ can be set available beforehand and trained over either supervised or unsupervised dataset $\mathcal { D } _ { \mathrm { p r e } }$ , e.g., ImageNet using using CL in experiments. Given (normalized) pretrained data representations $\{ f _ { \mathrm { p r e } } ( x ) \} _ { x \in \mathcal { X } }$ , CLUSTERFIT uses $K$ -means clustering to find $K$ data clusters of $\mathcal { X }$ , and maps a cluster index $c$ to a pseudo-label, resulting in the pseudolabeled dataset $\{ ( x , c ) \in \hat { \mathcal { X } } \}$ . By integrating CLUSTERFIT with (9), the eventual training objective of ADVCL is then formed by
132
+
133
+ $$
134
+ \operatorname* { m i n } _ { \theta } \ \ell _ { \mathrm { { C L } } } ^ { \mathrm { a d v } } ( \theta ; \mathcal { X } ) + \lambda \operatorname* { m i n } _ { \theta , \theta _ { \mathrm { c } } } \ \mathbb { E } _ { ( x , c ) \in \hat { \mathcal { X } } } \operatorname* { m a x } _ { \| \delta _ { c e } \| _ { \infty } \leq \epsilon } \ell _ { \mathrm { C E } } ( \phi _ { \theta _ { \mathrm { c } } } \circ f _ { \theta } ( x + \delta _ { c e } ) , c ) ,
135
+ $$
136
+
137
+ Pseudo-classification enabled AT regularization
138
+
139
+ where $\hat { \mathcal X }$ denotes the pseudo-labeled dataset of $\mathcal { X }$ , $\phi _ { \theta _ { \mathrm { c } } }$ denotes a prediction head over $f _ { \theta }$ , and $\lambda > 0$ is a regularization parameter that strikes a balance between adversarial contrastive training and pseudo-label stimulated AT. When the number of clusters $K$ is not known a priori, we extend (10) to an ensemble version over $n$ choices of cluster numbers $\{ K _ { 1 } , \ldots , K _ { n } \}$ . Here each cluster number $K _ { i }$ is paired with a unique linear classifier $\phi _ { i }$ to obtain the supervised prediction $\phi _ { i } \circ f$ (using cluster labels). The ensemble CE loss, given by the average of $n$ individual losses, is then used in (10). Our experiments show that the ensemble version usually leads to better generalization ability.
140
+
141
+ # 5 Experiments
142
+
143
+ In this section, we demonstrate the effectiveness of our proposed ADVCL from the following aspects: (1) Quantitative results, including cross-task robustness transferability, cross-dataset robustness transferability, and robustness against PGD attacks [11] and Auto-Attacks [37]; (2) Qualitative results, including representation t-SNE [55], feature inversion map visualization, and geometry of loss landscape; (3) Ablation studies of ADVCL, including finetuning schemes, view selection choices, and supervision stimulus variations.
144
+
145
+ Experiment setup We consider three robustness evaluation metrics: (1) Auto-attack accuracy (AA), namely, classification accuracy over adversarially perturbed images via Auto-Attacks; (2) Robust accuracy (RA), namely, classification accuracy over adversarially perturbed images via PGD attacks; and (3) Standard accuracy (SA), namely, standard classification accuracy over benign images without perturbations. We use ResNet-18 for the encoder architecture of $f _ { \theta }$ in CL. Unless specified otherwise, we use 5-step $\ell _ { \infty }$ projected gradient descent (PGD) with $\epsilon = 8 / 2 5 5$ to generate perturbations during pretraining, and use Auto-Attack and 20-step $\ell _ { \infty }$ PGD with $\epsilon = 8 / 2 5 5$ to generate perturbations in computing AA and RA at test time. We will compare ADVCL with the CL-based adversarial pretraining baselines , ACL [27], RoCL [28], (non-CL) self-supervised adversarial learning baseline AP-DPE [26] and the supervised AT baseline [11].
146
+
147
+ # 5.1 Quantitative Results
148
+
149
+ Overall performance from pretraining to finetuning (across tasks) In Table 1, we evaluate the robustness of a classifier (ResNet-18) finetuned over robust representations learned by different supervised/self-supervised pretraining approaches over CIFAR-10 and CIFAR-100. We focus on two representative finetuning schemes: the simplest standard linear finetuning (SLF) and the end-to-end adversarial full finetuning (AFF). As we can see, the proposed ADVCL method yields a substantial improvement over almost all baseline methods. Moreover, ADVCL improves robustness and standard accuracy simultaneously.
150
+
151
+ Table 1: Cross-task performance of ADVCL (in dark gray color), compared with supervised (in white color) and self-supervised (in light gray color) baselines, in terms of AA, RA and SA on CIFAR-10 with ResNet-18. The pretrained models are evaluated under the standard linear finetuning (SLF) setting and the adversarial full finetuning (AFF) setting. The top performance is highlighted in bold.
152
+
153
+ <table><tr><td rowspan="2">Pretraining Method</td><td rowspan="2">Finetuning Method</td><td colspan="3">CIFAR-10</td><td colspan="3">CIFAR-100</td></tr><tr><td>AA(%)</td><td>RA(%)</td><td>SA(%)</td><td>AA(%)</td><td>RA(%)</td><td>SA(%)</td></tr><tr><td>Supervised AP-DPE[26]</td><td rowspan="4">Standard linear finetuning</td><td>42.22</td><td>44.4</td><td>79.77</td><td>19.53</td><td>23.41</td><td>50.53</td></tr><tr><td>RoCL[28]</td><td>16.07</td><td>18.22</td><td>78.30</td><td>4.17</td><td>6.23</td><td>47.91</td></tr><tr><td></td><td>28.38</td><td>39.54</td><td>79.90</td><td>8.66</td><td>18.79</td><td>49.53</td></tr><tr><td>ACL[27] AdvCL (ours)</td><td>39.13</td><td>42.87</td><td>77.88</td><td>16.33</td><td>20.97</td><td>47.51</td></tr><tr><td></td><td rowspan="4">Adversarial full</td><td> 42.57</td><td> 50.45</td><td>80.85</td><td>19.78</td><td>27.67</td><td>48.34</td></tr><tr><td>Supervised</td><td>46.19</td><td>49.89</td><td>79.86</td><td>21.61</td><td>25.86</td><td>52.22</td></tr><tr><td>AP-DPE[26]</td><td>48.13</td><td>51.52</td><td>81.19</td><td>22.53</td><td>26.89</td><td>55.27</td></tr><tr><td>RoCL[28]</td><td>47.88</td><td>51.35</td><td>81.01</td><td>22.38</td><td>27.49</td><td>55.10</td></tr><tr><td>ACL[27]</td><td rowspan="3">finetuning (AFF)</td><td>49.27</td><td> 52.82</td><td>82.19</td><td>23.63</td><td>29.38</td><td>56.61</td></tr><tr><td> ADvCL (ours)</td><td>49.77</td><td> 52.77</td><td>83.62</td><td>24.72</td><td>28.73</td><td>56.77</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
154
+
155
+ Robustness transferability across datasets In Table 2, we next evaluate the robustness transferability across different datasets, where $A $ $B$ denotes the transferability from pretraining on dataset $A$ to finetuning on another dataset $B \left( \neq A \right)$ of representations learned by ADVCL. Here the pretraining setup is consistent with Table 1. We observe that ADVCL yields
156
+
157
+ Table 2: Cross-dataset performance of ADVCL (dark gray color), compared with supervised (white color) and self-supervised (light gray) baselines, in AA, RA, SA, on STL-10 with ResNet-18.
158
+
159
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">一 Fine- tuning</td><td colspan="3">CIFAR-10→STL-10</td><td colspan="3">CIFAR-100→STL-10</td></tr><tr><td>AA(%)</td><td>RA(%)</td><td>SA(%)</td><td>AA(%)</td><td>RA(%)</td><td>SA(%)</td></tr><tr><td>Supervised</td><td rowspan="4">SLF</td><td>22.26</td><td>30.45</td><td>54.70</td><td>19.54</td><td>23.63</td><td>51.11</td></tr><tr><td>RoCL[28]</td><td>18.65</td><td>28.18</td><td>54.56</td><td>12.39</td><td>21.93</td><td>47.86</td></tr><tr><td>ACL[27]</td><td>25.29</td><td>31.80</td><td>55.81</td><td>21.75</td><td>26.32</td><td>45.91</td></tr><tr><td> ADvCL (ours)</td><td>25.74</td><td>35.80</td><td>63.73</td><td>20.86</td><td>30.35</td><td>50.71</td></tr><tr><td>Supervised</td><td rowspan="4">AFF</td><td>33.10</td><td>36.7</td><td>62.78</td><td>29.18</td><td>32.43</td><td>55.85</td></tr><tr><td>RoCL[28]</td><td>29.40</td><td>34.65</td><td>61.75</td><td>27.55</td><td>31.38</td><td>57.83</td></tr><tr><td>ACL[27]</td><td>32.50</td><td>35.93</td><td>62.65</td><td>28.68</td><td>32.41</td><td>57.16</td></tr><tr><td>ADvCL (ours)</td><td>34.70</td><td>37.78</td><td>63.52</td><td>30.51</td><td>33.70</td><td>61.56</td></tr></table>
160
+
161
+ better robustness as well as standard accuracy than almost all baseline approaches under both SLF and AFF finetuning settings. In the case of CIFAR- $1 0 0 \mathrm { S T L } \mathrm { - } 1 0$ , although ADVCL yields $0 . 8 9 \%$ AA drop compared to ACL [27], it yields a much better SA with $4 . 8 \%$ improvement.
162
+
163
+ Robustness evaluation vs. attack strength It was shown in [56] that an adversarial defense that causes obfuscated gradients results in a false sense of model robustness. The issue of obfuscated gradients typically comes with two ‘side effects’: (a) The success rate of PGD attack ceases to be improved as the $\ell _ { \infty }$ -norm perturbation radius $\epsilon$ increases; (b) A larger number of PGD steps fails to generate stronger adversarial examples. Spurred by
164
+
165
+ ![](images/e5c730efe89813d6c102565477e6e1db11a1164beb2b8f69559cd73497434098.jpg)
166
+ Figure 3: RA of ADVCL and baseline approaches under various PGD attacks. SLF is applied to the pretrained model.
167
+
168
+ the above, Figure 3 shows the finetuning performance of ADVCL (using SLF) as a function of the perturbation size $\epsilon$ and the PGD step number. As we can see, ADVCL is consistently more robust than the baselines at all different PGD settings for a significant margin.
169
+
170
+ # 5.2 Qualitative Results
171
+
172
+ Class discrimination of learned representations To further demonstrate the efficacy of ADVCL, Figure 4 visualizes the representations learned by self-supervision using t-SNE [55] on CIFAR-10. We color each point using its ground-truth label. The results show representations learned by ADVCL have a much clearer class boundary than those learned with baselines. This indicates that ADVCL makes an adversary difficult to successfully perturb an image, leading to a more robust prediction.
173
+
174
+ ![](images/97479d92663cb4be02ac05f5e83a4f2103ad791e90a19e12758e106fa172e23b.jpg)
175
+ Figure 4: t-SNE visualization of representations learned with different self-supervised pretraining approaches. Our ADVCL gives a much clearer separation among classes than baseline approaches.
176
+
177
+ Visual interpretability of learned representations Furthermore, we demonstrate the advantage of our proposals from the perspective of model explanation, characterized by feature inversion map (FIM) [57] of internal neurons’ response. The work [18, 58, 59] showed that model robustness offered by supervised AT and its variants enforces hidden neurons to learn perceptuallyaligned data features through the lens of FIM. However, it remains unclear whether or not selfsupervised robust pretraining is able to render explainable internal response. Following [57, 58], we acquire FIM of the ith component of representation vector by solving the optimization problem $\begin{array} { r } { x _ { \mathrm { F I M } } = \operatorname* { m i n } _ { \Delta } [ f _ { \theta } ( x _ { 0 } + \Delta ) ] _ { i } } \end{array}$ , where $x _ { 0 }$ is a randomly selected seed image, and $[ \cdot ] _ { i }$ denotes the ith coordinate of a vector. Figure 5 shows that
178
+
179
+ ![](images/06c1fcc48298d40c5d015a0f22906b096d3dcce5827655f6dd67e88353ac4d6a.jpg)
180
+ Figure 5: FIM visualization of neuron 502 under CIFAR-10 using different robust training methods. Column 1 contains different seed images to generate FIM. Columns 2-5 are FIMs using models trained with different approaches.
181
+
182
+ compared to other approaches, more similar texture-aligned features can be acquired from a neuron’s feature representation of the network trained with our method regardless of the choice of seed images.
183
+
184
+ Flatter loss landscape implies better transferability It has been shown in [60] that the flatness of loss landscape is a good indicator for superb transferability in the pretraining $^ +$ finetuning paradigm. Motivated by that, Figure 6 presents the adversarial loss landscape of ADVCL and other self-supervised pretraining approaches under SLF, where the loss landscape is drawn using the method in [61]. Note that instead of standard CE loss, we visualize the adversarial loss w.r.t. model weights. As we can see, the loss for ADVCL has a much flatter landscape around the local optima, whereas the losses for the other approaches change more rapidly. This justifies that our proposal has a better robustness transferability than baseline approaches.
185
+
186
+ ![](images/d0c6b500d5ca6e86fad66f9d6e7d503ff4fdba67230a3e948a63d4ef8b39f6a5.jpg)
187
+ Figure 6: Visualization of adversarial loss landscape w.r.t. model weights using different self-supervised pretraining methods. ADVCL gives a much flatter landscape than the other baselines.
188
+
189
+ Table 3: Performance (RA and SA) of ADVCL (in dark gray color) and baseline approaches on CIFAR-10, under different linear finetuning strategies: SLF and adversarial linear finetuning (ALF).
190
+
191
+ <table><tr><td rowspan=3 colspan=3>SLFMethodRA(%) SA(%)</td><td></td><td></td></tr><tr><td rowspan=1 colspan=2>SLF</td><td rowspan=1 colspan=2>ALF</td></tr><tr><td rowspan=1 colspan=1>RA(%)</td><td rowspan=1 colspan=1>SA(%)</td><td rowspan=1 colspan=1>RA(%)</td><td rowspan=1 colspan=1>SA(%)</td></tr><tr><td rowspan=1 colspan=1>Supervised</td><td rowspan=1 colspan=1>44.40</td><td rowspan=1 colspan=1>79.77</td><td rowspan=1 colspan=1>46.75</td><td rowspan=1 colspan=1>79.06</td></tr><tr><td rowspan=1 colspan=1>RoCL[28]ACL[27]</td><td rowspan=1 colspan=1>39.5442.87</td><td rowspan=1 colspan=1>79.9077.88</td><td rowspan=1 colspan=1>43.1145.40</td><td rowspan=1 colspan=1>77.3377.71</td></tr><tr><td rowspan=1 colspan=1>ADvCL(ours)</td><td rowspan=1 colspan=1>50.45</td><td rowspan=1 colspan=1>80.85</td><td rowspan=1 colspan=1>52.01</td><td rowspan=1 colspan=1>79.39</td></tr></table>
192
+
193
+ Table 4: Performance (RA and SA) of ADVCL using different contrastive views setups. ResNet-18 is the backbone network, CIFAR-10 is the dataset, and SLF is used for classification.
194
+
195
+ <table><tr><td>Contrastive Views</td><td>RA(%)</td><td>SA(%)</td></tr><tr><td>T1(x)+01,T2(x) T1(x)+δ1,T2(x)+δ2</td><td>42.12 42.48</td><td>77.07 73.12</td></tr><tr><td>T1(x)+δ1,T2(x)+δ,T1(x),T2(x)</td><td>43.51</td><td>74.22</td></tr><tr><td>x+δ,T1(x),T2(x)</td><td>50.19</td><td>80.17</td></tr><tr><td>x +δ,T1(x),2(x),x1</td><td>49.51</td><td>79.83</td></tr><tr><td>x+δ,T1(x),T2(x),x1,xh</td><td>50.03</td><td>80.14</td></tr><tr><td>x +δ,T1(x),T2(x),xh</td><td> 50.45</td><td>80.85</td></tr></table>
196
+
197
+ Table 5: Performance (RA and SA) of ADVCL using various pretrained models $f _ { \mathrm { p r e } }$ and cluster numbers $K$ in CLUSTERFIT, as well as the baseline w/o using CLUSTERFIT. The setup of $f _ { \mathrm { p r e } }$ is specified by the training method (supervised training or SimCLR) and training dataset (ImageNet or CIFAR-10). ADVCL is implemented using unlabeled data from CIFAR-10 under ResNet-18, together with SLF over the acquired feature encoder for supervised CIFAR-10 classification.
198
+
199
+ <table><tr><td rowspan="2">fpre setup: (dataset, training)</td><td rowspan="2">Cluster number K</td><td rowspan="2">RA(%)</td><td rowspan="2">SA (%)</td></tr><tr><td></td></tr><tr><td>N/A</td><td>W/o CLUSTERFIT</td><td>48.89</td><td>77.73 80.34</td></tr><tr><td rowspan="2">(CIFAR-10, SimCLR)</td><td>10 100</td><td>50.10 49.21</td><td>79.52</td></tr><tr><td></td><td></td><td></td></tr><tr><td rowspan="2">(ImageNet,supervised)</td><td>10 100</td><td>50.16 49.27</td><td>78.27 78.08</td></tr><tr><td></td><td></td><td></td></tr><tr><td rowspan="6">(ImageNet, SimCLR)</td><td>2</td><td>50.09</td><td>79.72</td></tr><tr><td>10</td><td>50.12</td><td>79.93</td></tr><tr><td>50</td><td>49.27</td><td>79.55</td></tr><tr><td>100</td><td>49.16</td><td>79.07</td></tr><tr><td>500</td><td>49.03</td><td>78.96</td></tr><tr><td>Ensemble</td><td>50.45</td><td>80.85</td></tr></table>
200
+
201
+ # 5.3 Ablation studies
202
+
203
+ Linear finetuning types We first study the robustness difference when different linear finetuning strategies: Standard linear finetuning (SLF) and Adversarial linear finetuning (ALF) are applied. Table 3 shows the performance of models trained with different pretraining methods. As we can see, our ADVCL achieves the best performance under both linear finetuning settings and outperforms baseline approaches in a large margin. We also note the performance gap between SLF and ALF induced by our proposal ADVCL is much smaller than other approaches, and ADVCL with SLF achieves much better performance than baseline approaches with ALF. This indicates that the representations learned by ADVCL is already sufficient to yield satisfactory robustness.
204
+
205
+ View selection setup We illustrate how different choices of contrastive views influence the robustness performance of ADVCL in Table 4. The first 4 rows study the effect of different types of adversarial examples in contrastive views, and our proposed 3-view contrastive loss (7) significantly outperforms the other baselines, as shown in row 4. The rows in gray show the performance of further exploring different image frequency components (8) as different contrastive views. It is clear that the use of HFC leads to the best overall performance, as shown in the last row.
206
+
207
+ Supervision stimulus setup We further study the performance of ADVCL using different supervision stimulus. Specifically, we vary the pretrained model for $f _ { \mathrm { p r e } }$ and pseudo cluster number $K$ when training ADVCL and summarize the results in Table 5. The results demonstrate that adding the supervision stimulus could boost the performance of ADVCL. We also observe that the best result comes from $f _ { \mathrm { p r e } }$ pretrained on Imagenet using SimCLR. This is because such representations could generalize better. Moreover, the ensemble scheme over pseudo label categories $K \in \{ 2 , 1 0 , 5 0 , 1 0 \bar { 0 } , 5 0 0 \}$ yields better results than using a single number of clusters. The ensemble scheme also makes ADVCL less sensitive to the actual number of labels for the training dataset.
208
+
209
+ # 6 Conclusion
210
+
211
+ In this paper, we study the good practices in making contrastive learning robust to adversarial examples. We show that adding perturbations to original images and high-frequency components are two beneficial factors. We further show that proper supervision stimulus could improve model robustness. Our proposed approaches can achieve state-of-the-art robust accuracy as well as standard accuracy using just standard linear finetuning. Extensive experiments involving quantitative and qualitative analysis have also been made not only to demonstrate the effectiveness of our proposals but also to rationalize why it yields superior performance. Future works could be done to improve the scalability of our proposed self-supervised pretraining approach to very large datasets and models to further boost robust transferabilty across datasets.
212
+
213
+ References
214
+ [1] Fatemeh Vakhshiteh, Raghavendra Ramachandra, and Ahmad Nickabadi, “Threat of adversarial attacks on face recognition: A comprehensive survey,” arXiv preprint arXiv:2007.11709, 2020.
215
+ [2] Xingjun Ma, Yuhao Niu, Lin Gu, Yisen Wang, Yitian Zhao, James Bailey, and Feng Lu, “Understanding adversarial attacks on deep learning based medical image analysis systems,” Pattern Recognition, vol. 110, pp. 107332, 2021.
216
+ [3] Kaidi Xu, Gaoyuan Zhang, Sijia Liu, Quanfu Fan, Mengshu Sun, Hongge Chen, Pin-Yu Chen, Yanzhi Wang, and Xue Lin, “Adversarial t-shirt! evading person detectors in a physical world,” in European Conference on Computer Vision. Springer, 2020, pp. 665–681.
217
+ [4] Ji Lin, Chuang Gan, and Song Han, “Defensive quantization: When efficiency meets robustness,” ICLR, 2019.
218
+ [5] Yulong Cao, Chaowei Xiao, Dawei Yang, Jing Fang, Ruigang Yang, Mingyan Liu, and Bo Li, “Adversarial objects against lidar-based autonomous driving systems,” arXiv preprint arXiv:1907.05418, 2019.
219
+ [6] Ian Goodfellow, Jonathon Shlens, and Christian Szegedy, “Explaining and harnessing adversarial examples,” International Conference on Learning Representations, vol. arXiv preprint arXiv:1412.6572, 2015.
220
+ [7] Nicholas Carlini and David Wagner, “Towards evaluating the robustness of neural networks,” in Security and Privacy (SP), 2017 IEEE Symposium on. IEEE, 2017, pp. 39–57.
221
+ [8] Nicolas Papernot, Patrick McDaniel, Somesh Jha, Matt Fredrikson, Z Berkay Celik, and Ananthram Swami, “The limitations of deep learning in adversarial settings,” in Security and Privacy (EuroS&P), 2016 IEEE European Symposium on. IEEE, 2016, pp. 372–387.
222
+ [9] Pin-Yu Chen, Yash Sharma, Huan Zhang, Jinfeng Yi, and Cho-Jui Hsieh, “EAD: elasticnet attacks to deep neural networks via adversarial examples,” in Proceedings of the AAAI Conference on Artificial Intelligence, 2018, pp. 10–17.
223
+ [10] Kaidi Xu, Sijia Liu, Pu Zhao, Pin-Yu Chen, Huan Zhang, Quanfu Fan, Deniz Erdogmus, Yanzhi Wang, and Xue Lin, “Structured adversarial attack: Towards general implementation and better interpretability,” in International Conference on Learning Representations, 2019.
224
+ [11] Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu, “Towards deep learning models resistant to adversarial attacks,” 2018 ICLR, vol. arXiv preprint arXiv:1706.06083, 2018.
225
+ [12] Harini Kannan, Alexey Kurakin, and Ian Goodfellow, “Adversarial logit pairing,” 2018.
226
+ [13] Andrew Slavin Ross and Finale Doshi-Velez, “Improving the adversarial robustness and interpretability of deep neural networks by regularizing their input gradients,” in Thirty-second AAAI conference on artificial intelligence, 2018.
227
+ [14] Jingkang Wang, Tianyun Zhang, Sijia Liu, Pin-Yu Chen, Jiacen Xu, Makan Fardad, and Bo Li, “Towards a unified min-max framework for adversarial exploration and robustness,” arXiv preprint arXiv:1906.03563, 2019.
228
+ [15] Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Jonathan Uesato, and Pascal Frossard, “Robustness via curvature regularization, and vice versa,” in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2019, pp. 9078–9086.
229
+ [16] Yisen Wang, Xingjun Ma, James Bailey, Jinfeng Yi, Bowen Zhou, and Quanquan Gu, “On the convergence and robustness of adversarial training,” in International Conference on Machine Learning, 2019, pp. 6586–6595.
230
+ [17] Jiefeng Chen, Xi Wu, Vaibhav Rastogi, Yingyu Liang, and Somesh Jha, “Robust attribution regularization,” in Advances in Neural Information Processing Systems, 2019, pp. 14300–14310.
231
+ [18] Akhilan Boopathy, Sijia Liu, Gaoyuan Zhang, Cynthia Liu, Pin-Yu Chen, Shiyu Chang, and Luca Daniel, “Proper network interpretability helps adversarial robustness in classification,” in ICML, 2020.
232
+ [19] Ali Shafahi, Mahyar Najibi, Mohammad Amin Ghiasi, Zheng Xu, John Dickerson, Christoph Studer, Larry S Davis, Gavin Taylor, and Tom Goldstein, “Adversarial training for free!,” in Advances in Neural Information Processing Systems, 2019, pp. 3353–3364.
233
+ [20] Dinghuai Zhang, Tianyuan Zhang, Yiping Lu, Zhanxing Zhu, and Bin Dong, “You only propagate once: Accelerating adversarial training via maximal principle,” arXiv preprint arXiv:1905.00877, 2019.
234
+ [21] Eric Wong, Leslie Rice, and J. Zico Kolter, “Fast is better than free: Revisiting adversarial training,” in International Conference on Learning Representations, 2020.
235
+ [22] Hongyang Zhang, Yaodong Yu, Jiantao Jiao, Eric P Xing, Laurent El Ghaoui, and Michael I Jordan, “Theoretically principled trade-off between robustness and accuracy,” International Conference on Machine Learning, 2019.
236
+ [23] Yair Carmon, Aditi Raghunathan, Ludwig Schmidt, Percy Liang, and John C Duchi, “Unlabeled data improves adversarial robustness,” arXiv preprint arXiv:1905.13736, 2019.
237
+ [24] Runtian Zhai, Tianle Cai, Di He, Chen Dan, Kun He, John Hopcroft, and Liwei Wang, “Adversarially robust generalization just requires more unlabeled data,” arXiv preprint arXiv:1906.00555, 2019.
238
+ [25] Dan Hendrycks, Mantas Mazeika, Saurav Kadavath, and Dawn Song, “Using self-supervised learning can improve model robustness and uncertainty,” arXiv preprint arXiv:1906.12340, 2019.
239
+ [26] Tianlong Chen, Sijia Liu, Shiyu Chang, Yu Cheng, Lisa Amini, and Zhangyang Wang, “Adversarial robustness: From self-supervised pre-training to fine-tuning,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020, pp. 699–708.
240
+ [27] Ziyu Jiang, Tianlong Chen, Ting Chen, and Zhangyang Wang, “Robust pre-training by adversarial contrastive learning,” arXiv preprint arXiv:2010.13337, 2020.
241
+ [28] Minseon Kim, Jihoon Tack, and Sung Ju Hwang, “Adversarial self-supervised contrastive learning,” arXiv preprint arXiv:2006.07589, 2020.
242
+ [29] Sven Gowal, Po-Sen Huang, Aaron van den Oord, Timothy Mann, and Pushmeet Kohli, “Self-supervised adversarial robustness for the low-label, high-data regime,” in International Conference on Learning Representations, 2021.
243
+ [30] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton, “A simple framework for contrastive learning of visual representations,” in International conference on machine learning. PMLR, 2020, pp. 1597–1607.
244
+ [31] Jean-Bastien Grill, Florian Strub, Florent Altche, Corentin Tallec, Pierre H Richemond, Elena ´ Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, et al., “Bootstrap your own latent: A new approach to self-supervised learning,” arXiv preprint arXiv:2006.07733, 2020.
245
+ [32] Yonglong Tian, Chen Sun, Ben Poole, Dilip Krishnan, Cordelia Schmid, and Phillip Isola, “What makes for good views for contrastive learning,” arXiv preprint arXiv:2005.10243, 2020.
246
+ [33] Tongzhou Wang and Phillip Isola, “Understanding contrastive representation learning through alignment and uniformity on the hypersphere,” in International Conference on Machine Learning. PMLR, 2020, pp. 9929–9939.
247
+ [34] Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He, “Improved baselines with momentum contrastive learning,” arXiv preprint arXiv:2003.04297, 2020.
248
+ [35] Priya Goyal, Dhruv Mahajan, Abhinav Gupta, and Ishan Misra, “Scaling and benchmarking self-supervised visual representation learning,” in Proceedings of the IEEE/CVF International Conference on Computer Vision, 2019, pp. 6391–6400.
249
+ [36] Senthil Purushwalkam and Abhinav Gupta, “Demystifying contrastive self-supervised learning: Invariances, augmentations and dataset biases,” arXiv preprint arXiv:2007.13916, 2020.
250
+ [37] Francesco Croce and Matthias Hein, “Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks,” in International Conference on Machine Learning. PMLR, 2020, pp. 2206–2216.
251
+ [38] Spyros Gidaris, Praveer Singh, and Nikos Komodakis, “Unsupervised representation learning by predicting image rotations,” arXiv preprint arXiv:1803.07728, 2018.
252
+ [39] Mehdi Noroozi and Paolo Favaro, “Unsupervised learning of visual representations by solving jigsaw puzzles,” in European Conference on Computer Vision. Springer, 2016, pp. 69–84.
253
+ [40] Fabio M Carlucci, Antonio D’Innocente, Silvia Bucci, Barbara Caputo, and Tatiana Tommasi, “Domain generalization by solving jigsaw puzzles,” in Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2019, pp. 2229–2238.
254
+ [41] Chuang Gan, Boqing Gong, Kun Liu, Hao Su, and Leonidas J Guibas, “Geometry guided convolutional neural networks for self-supervised video representation learning,” in CVPR, 2018, pp. 5589–5597.
255
+ [42] Trieu H Trinh, Minh-Thang Luong, and Quoc V Le, “Selfie: Self-supervised pretraining for image embedding,” arXiv preprint arXiv:1906.02940, 2019.
256
+ [43] Aaron van den Oord, Yazhe Li, and Oriol Vinyals, “Representation learning with contrastive predictive coding,” arXiv preprint arXiv:1807.03748, 2018.
257
+ [44] 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, 2020, pp. 9729–9738.
258
+ [45] Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey Hinton, “Big self-supervised models are strong semi-supervised learners,” arXiv preprint arXiv:2006.10029, 2020.
259
+ [46] Xinlei Chen and Kaiming He, “Exploring simple siamese representation learning,” arXiv preprint arXiv:2011.10566, 2020.
260
+ [47] Eric Wong and J Zico Kolter, “Provable defenses against adversarial examples via the convex outer adversarial polytope,” arXiv preprint arXiv:1711.00851, 2017.
261
+ [48] Krishnamurthy Dvijotham, Sven Gowal, Robert Stanforth, Relja Arandjelovic, Brendan O’Donoghue, Jonathan Uesato, and Pushmeet Kohli, “Training verified learners with learned verifiers,” arXiv preprint arXiv:1805.10265, 2018.
262
+ [49] Chuang Gan, Ting Yao, Kuiyuan Yang, Yi Yang, and Tao Mei, “You lead, we exceed: Laborfree video concept learning by jointly exploiting web videos and images,” in CVPR, 2016, pp. 923–932.
263
+ [50] Chuang Gan, Chen Sun, Lixin Duan, and Boqing Gong, “Webly-supervised video recognition by mutually voting for relevant web images and web video frames,” in ECCV, 2016, pp. 849–866.
264
+ [51] Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan, “Supervised contrastive learning,” arXiv preprint arXiv:2004.11362, 2020.
265
+ [52] Haohan Wang, Xindi Wu, Zeyi Huang, and Eric P Xing, “High-frequency component helps explain the generalization of convolutional neural networks,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020, pp. 8684–8694.
266
+ [53] Zifan Wang, Yilin Yang, Ankit Shrivastava, Varun Rawal, and Zihao Ding, “Towards frequencybased explanation for robust cnn,” arXiv preprint arXiv:2005.03141, 2020.
267
+ [54] Xueting Yan, Ishan Misra, Abhinav Gupta, Deepti Ghadiyaram, and Dhruv Mahajan, “Clusterfit: Improving generalization of visual representations,” in Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020, pp. 6509–6518.
268
+ [55] Laurens Van der Maaten and Geoffrey Hinton, “Visualizing data using t-sne.,” Journal of machine learning research, vol. 9, no. 11, 2008.
269
+ [56] Anish Athalye, Nicholas Carlini, and David Wagner, “Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples,” arXiv preprint arXiv:1802.00420, 2018.
270
+ [57] Aravindh Mahendran and Andrea Vedaldi, “Visualizing deep convolutional neural networks using natural pre-images,” International Journal of Computer Vision, vol. 120, no. 3, pp. 233–255, 2016.
271
+ [58] Logan Engstrom, Andrew Ilyas, Shibani Santurkar, Dimitris Tsipras, Brandon Tran, and Aleksander Madry, “Adversarial robustness as a prior for learned representations,” arXiv preprint arXiv:1906.00945, 2019.
272
+ [59] Simran Kaur, Jeremy Cohen, and Zachary C Lipton, “Are perceptually-aligned gradients a general property of robust classifiers?,” arXiv preprint arXiv:1910.08640, 2019.
273
+ [60] Hong Liu, Mingsheng Long, Jianmin Wang, and Michael I Jordan, “Towards understanding the transferability of deep representations,” arXiv preprint arXiv:1909.12031, 2019.
274
+ [61] Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer, and Tom Goldstein, “Visualizing the loss landscape of neural nets,” arXiv preprint arXiv:1712.09913, 2017.
275
+ [62] Angus Galloway, Anna Golubeva, Thomas Tanay, Medhat Moussa, and Graham W Taylor, “Batch normalization is a cause of adversarial vulnerability,” arXiv preprint arXiv:1905.02161, 2019.
276
+ [63] Tianyu Pang, Xiao Yang, Yinpeng Dong, Hang Su, and Jun Zhu, “Bag of tricks for adversarial training,” arXiv preprint arXiv:2010.00467, 2020.
md/train/7uVcpu-gMD/7uVcpu-gMD.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/B1xsqj09Fm/B1xsqj09Fm.md ADDED
@@ -0,0 +1,492 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LARGE SCALE GAN TRAINING FORHIGH FIDELITY NATURAL IMAGE SYNTHESIS
2
+
3
+ Andrew Brock∗ † Heriot-Watt University ajb5@hw.ac.uk
4
+
5
+ Jeff Donahue†
6
+ DeepMind
7
+ jeffdonahue@google.com
8
+
9
+ Karen Simonyan† DeepMind simonyan@google.com
10
+
11
+ # ABSTRACT
12
+
13
+ Despite recent progress in generative image modeling, successfully generating high-resolution, diverse samples from complex datasets such as ImageNet remains an elusive goal. To this end, we train Generative Adversarial Networks at the largest scale yet attempted, and study the instabilities specific to such scale. We find that applying orthogonal regularization to the generator renders it amenable to a simple “truncation trick,” allowing fine control over the trade-off between sample fidelity and variety by reducing the variance of the Generator’s input. Our modifications lead to models which set the new state of the art in class-conditional image synthesis. When trained on ImageNet at $1 2 8 \times 1 2 8$ resolution, our models (BigGANs) achieve an Inception Score (IS) of 166.5 and Frechet Inception Dis- ´ tance (FID) of 7.4, improving over the previous best IS of 52.52 and FID of 18.65.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ ![](images/270fcbea08660596ca68cc3991827d5e9af5cd15489848fd6f1a73487aaf199d.jpg)
18
+ Figure 1: Class-conditional samples generated by our model.
19
+
20
+ The state of generative image modeling has advanced dramatically in recent years, with Generative Adversarial Networks (GANs, Goodfellow et al. (2014)) at the forefront of efforts to generate highfidelity, diverse images with models learned directly from data. GAN training is dynamic, and sensitive to nearly every aspect of its setup (from optimization parameters to model architecture), but a torrent of research has yielded empirical and theoretical insights enabling stable training in a variety of settings. Despite this progress, the current state of the art in conditional ImageNet modeling (Zhang et al., 2018) achieves an Inception Score (Salimans et al., 2016) of 52.5, compared to 233 for real data.
21
+
22
+ In this work, we set out to close the gap in fidelity and variety between images generated by GANs and real-world images from the ImageNet dataset. We make the following three contributions towards this goal:
23
+
24
+ • We demonstrate that GANs benefit dramatically from scaling, and train models with two to four times as many parameters and eight times the batch size compared to prior art. We introduce two simple, general architectural changes that improve scalability, and modify a regularization scheme to improve conditioning, demonstrably boosting performance.
25
+
26
+ • As a side effect of our modifications, our models become amenable to the “truncation trick,” a simple sampling technique that allows explicit, fine-grained control of the tradeoff between sample variety and fidelity.
27
+ We discover instabilities specific to large scale GANs, and characterize them empirically. Leveraging insights from this analysis, we demonstrate that a combination of novel and existing techniques can reduce these instabilities, but complete training stability can only be achieved at a dramatic cost to performance.
28
+
29
+ Our modifications substantially improve class-conditional GANs. When trained on ImageNet at $1 2 8 \times 1 2 8$ resolution, our models (BigGANs) improve the state-of-the-art Inception Score (IS) and Frechet Inception Distance (FID) from 52.52 and 18.65 to 166.5 and 7.4 respectively. We also ´ successfully train BigGANs on ImageNet at $2 5 6 \times 2 5 6$ and $5 1 2 \times 5 1 2$ resolution, and achieve IS and FID of 232.5 and 8.1 at $2 5 6 \times 2 5 6$ and IS and FID of 241.5 and 11.5 at $5 1 2 \times 5 1 2$ . Finally, we train our models on an even larger dataset – JFT-300M – and demonstrate that our design choices transfer well from ImageNet. Code and weights for our pretrained generators are publicly available 1.
30
+
31
+ # 2 BACKGROUND
32
+
33
+ A Generative Adversarial Network (GAN) involves Generator $\mathbf { \Pi } ( \pmb { \mathsf { G } } )$ and Discriminator (D) networks whose purpose, respectively, is to map random noise to samples and discriminate real and generated samples. Formally, the GAN objective, in its original form (Goodfellow et al., 2014) involves finding a Nash equilibrium to the following two player min-max problem:
34
+
35
+ $$
36
+ \operatorname* { m i n } _ { G } \operatorname* { m a x } _ { D } \mathbb { E } _ { { x } \sim { q _ { \mathrm { d a t a } } } ( \boldsymbol { x } ) } [ \log D ( \boldsymbol { x } ) ] + \mathbb { E } _ { \boldsymbol { z } \sim p ( \boldsymbol { z } ) } [ \log ( 1 - D ( G ( \boldsymbol { z } ) ) ) ] ,
37
+ $$
38
+
39
+ where $z ~ \in ~ \mathbb { R } ^ { d _ { z } }$ is a latent variable drawn from distribution $p ( z )$ such as $\mathcal { N } ( 0 , I )$ or $\mathcal { U } [ - 1 , 1 ]$ . When applied to images, $\pmb { \mathsf { G } }$ and D are usually convolutional neural networks (Radford et al., 2016). Without auxiliary stabilization techniques, this training procedure is notoriously brittle, requiring finely-tuned hyperparameters and architectural choices to work at all.
40
+
41
+ Much recent research has accordingly focused on modifications to the vanilla GAN procedure to impart stability, drawing on a growing body of empirical and theoretical insights (Nowozin et al., 2016; Sønderby et al., 2017; Fedus et al., 2018). One line of work is focused on changing the objective function (Arjovsky et al., 2017; Mao et al., 2016; Lim & Ye, 2017; Bellemare et al., 2017; Salimans et al., 2018) to encourage convergence. Another line is focused on constraining D through gradient penalties (Gulrajani et al., 2017; Kodali et al., 2017; Mescheder et al., 2018) or normalization (Miyato et al., 2018), both to counteract the use of unbounded loss functions and ensure D provides gradients everywhere to G.
42
+
43
+ Of particular relevance to our work is Spectral Normalization (Miyato et al., 2018), which enforces Lipschitz continuity on D by normalizing its parameters with running estimates of their first singular values, inducing backwards dynamics that adaptively regularize the top singular direction. Relatedly Odena et al. (2018) analyze the condition number of the Jacobian of G and find that performance is dependent on G’s conditioning. Zhang et al. (2018) find that employing Spectral Normalization in $\pmb { \mathsf { G } }$ improves stability, allowing for fewer D steps per iteration. We extend on these analyses to gain further insight into the pathology of GAN training.
44
+
45
+ Other works focus on the choice of architecture, such as SA-GAN (Zhang et al., 2018) which adds the self-attention block from (Wang et al., 2018) to improve the ability of both G and D to model global structure. ProGAN (Karras et al., 2018) trains high-resolution GANs in the single-class setting by training a single model across a sequence of increasing resolutions.
46
+
47
+ In conditional GANs (Mirza & Osindero, 2014) class information can be fed into the model in various ways. In (Odena et al., 2017) it is provided to G by concatenating a 1-hot class vector to the noise vector, and the objective is modified to encourage conditional samples to maximize the corresponding class probability predicted by an auxiliary classifier. de Vries et al. (2017) and
48
+
49
+ <table><tr><td rowspan=1 colspan=1>Batch</td><td rowspan=1 colspan=1>Ch.</td><td rowspan=1 colspan=1>Param (M)</td><td rowspan=1 colspan=1>Shared</td><td rowspan=1 colspan=1>Skip-z</td><td rowspan=1 colspan=1>Ortho.</td><td rowspan=1 colspan=1>Itr ×103</td><td rowspan=1 colspan=1>FID</td><td rowspan=1 colspan=2>IS</td></tr><tr><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>81.5</td><td rowspan=1 colspan=3>SA-GAN Baseline</td><td rowspan=1 colspan=1>1000</td><td rowspan=1 colspan=1>18.65</td><td rowspan=1 colspan=2>52.52</td></tr><tr><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>81.5</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>1000</td><td rowspan=1 colspan=1>15.30</td><td rowspan=1 colspan=1>58.77(±1.18)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>1024</td><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>81.5</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>1000</td><td rowspan=1 colspan=1>14.88</td><td rowspan=1 colspan=1>63.03(±1.42)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>2048</td><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>81.5</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>732</td><td rowspan=1 colspan=1>12.39</td><td rowspan=1 colspan=1>76.85(±3.83)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>2048</td><td rowspan=1 colspan=1>96</td><td rowspan=1 colspan=1>173.5</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>295(±18)</td><td rowspan=1 colspan=1>9.54(±0.62)</td><td rowspan=1 colspan=1>92.98(±4.27)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>2048</td><td rowspan=1 colspan=1>96</td><td rowspan=1 colspan=1>160.6</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>185(±11)</td><td rowspan=1 colspan=1>9.18(±0.13)</td><td rowspan=1 colspan=1>94.94(±1.32)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>2048</td><td rowspan=1 colspan=1>96</td><td rowspan=1 colspan=1>158.3</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>152(±7)</td><td rowspan=1 colspan=1>8.73(±0.45)</td><td rowspan=1 colspan=2>98.76((±2.84)</td></tr><tr><td rowspan=1 colspan=1>2048</td><td rowspan=1 colspan=1>96</td><td rowspan=1 colspan=1>158.3</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>了</td><td rowspan=1 colspan=1>165(±13)</td><td rowspan=1 colspan=1>8.51(±0.32)</td><td rowspan=1 colspan=1>99.31(±2.10)</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>2048</td><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>71.3</td><td rowspan=1 colspan=1>了</td><td rowspan=1 colspan=1>了</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>371(±7)</td><td rowspan=1 colspan=1>10.48(±0.10)</td><td rowspan=1 colspan=1>86.90(±0.61)</td><td rowspan=1 colspan=1></td></tr></table>
50
+
51
+ Table 1: Frechet Inception Distance (FID, lower is better) and Inception Score (IS, higher is better)´ for ablations of our proposed modifications. Batch is batch size, Param is total number of parameters, $C h$ . is the channel multiplier representing the number of units in each layer, Shared is using shared embeddings, Skip- $z$ is using skip connections from the latent to multiple layers, Ortho. is Orthogonal Regularization, and $I t r$ indicates if the setting is stable to $1 0 ^ { 6 }$ iterations, or it collapses at the given iteration. Other than rows 1-4, results are computed across 8 random initializations.
52
+
53
+ Dumoulin et al. (2017) modify the way class conditioning is passed to G by supplying it with classconditional gains and biases in BatchNorm (Ioffe & Szegedy, 2015) layers. In Miyato & Koyama (2018), D is conditioned by using the cosine similarity between its features and a set of learned class embeddings as additional evidence for distinguishing real and generated samples, effectively encouraging generation of samples whose features match a learned class prototype.
54
+
55
+ Objectively evaluating implicit generative models is difficult (Theis et al., 2015). A variety of works have proposed heuristics for measuring the sample quality of models without tractable likelihoods (Salimans et al., 2016; Heusel et al., 2017; Binkowski et al., 2018; Wu et al., 2017). Of these, ´ the Inception Score (IS, Salimans et al. (2016)) and Frechet Inception Distance (FID, Heusel et al. ´ (2017)) have become popular despite their notable flaws (Barratt & Sharma, 2018). We employ them as approximate measures of sample quality, and to enable comparison against previous work.
56
+
57
+ # 3 SCALING UP GANS
58
+
59
+ In this section, we explore methods for scaling up GAN training to reap the performance benefits of larger models and larger batches. As a baseline, we employ the SA-GAN architecture of Zhang et al. (2018), which uses the hinge loss (Lim & Ye, 2017; Tran et al., 2017) GAN objective. We provide class information to $\pmb { \mathsf { G } }$ with class-conditional BatchNorm (Dumoulin et al., 2017; de Vries et al., 2017) and to D with projection (Miyato & Koyama, 2018). The optimization settings follow Zhang et al. (2018) (notably employing Spectral Norm in G) with the modification that we halve the learning rates and take two D steps per G step. For evaluation, we employ moving averages of G’s weights following Karras et al. (2018); Mescheder et al. (2018); Yazc et al. (2018), with a decay of 0.9999. We use Orthogonal Initialization (Saxe et al., 2014), whereas previous works used $\dot { \mathcal { N } } ( 0 , 0 . 0 2 I )$ (Radford et al., 2016) or Xavier initialization (Glorot & Bengio, 2010). Each model is trained on 128 to 512 cores of a Google TPUv3 Pod (Google, 2018), and computes BatchNorm statistics in G across all devices, rather than per-device as is typical. We find progressive growing (Karras et al., 2018) unnecessary even for our $5 1 2 \times 5 1 2$ models. Additional details are in Appendix C.
60
+
61
+ We begin by increasing the batch size for the baseline model, and immediately find tremendous benefits in doing so. Rows 1-4 of Table 1 show that simply increasing the batch size by a factor of 8 improves the state-of-the-art IS by $46 \%$ . We conjecture that this is a result of each batch covering more modes, providing better gradients for both networks. One notable side effect of this scaling is that our models reach better final performance in fewer iterations, but become unstable and undergo complete training collapse. We discuss the causes and ramifications of this in Section 4. For these experiments, we report scores from checkpoints saved just before collapse.
62
+
63
+ We then increase the width (number of channels) in each layer by $50 \%$ , approximately doubling the number of parameters in both models. This leads to a further IS improvement of $21 \%$ , which we posit is due to the increased capacity of the model relative to the complexity of the dataset. Doubling the depth did not initially lead to improvement – we addressed this later in the BigGAN-deep model, which uses a different residual block structure.
64
+
65
+ ![](images/af3b2fb3d56d5c1d31eadbb19ed4d251b2758d90bc9a6792ec7dc55806f0b573.jpg)
66
+ Figure 2: (a) The effects of increasing truncation. From left to right, the threshold is set to 2, 1, 0.5, 0.04. (b) Saturation artifacts from applying truncation to a poorly conditioned model.
67
+
68
+ We note that class embeddings $c$ used for the conditional BatchNorm layers in G contain a large number of weights. Instead of having a separate layer for each embedding (Miyato et al., 2018; Zhang et al., 2018), we opt to use a shared embedding, which is linearly projected to each layer’s gains and biases (Perez et al., 2018). This reduces computation and memory costs, and improves training speed (in number of iterations required to reach a given performance) by $37 \%$ . Next, we add direct skip connections (skip- $z$ ) from the noise vector $z$ to multiple layers of $\pmb { \mathsf { G } }$ rather than just the initial layer. The intuition behind this design is to allow $\pmb { \mathsf { G } }$ to use the latent space to directly influence features at different resolutions and levels of hierarchy. In BigGAN, this is accomplished by splitting $z$ into one chunk per resolution, and concatenating each chunk to the conditional vector $c$ which gets projected to the BatchNorm gains and biases. In BigGAN-deep, we use an even simpler design, concatenating the entire $z$ with the conditional vector without splitting it into chunks. Previous works (Goodfellow et al., 2014; Denton et al., 2015) have considered variants of this concept; our implementation is a minor modification of this design. Skip- $z$ provides a modest performance improvement of around $4 \%$ , and improves training speed by a further $18 \%$ .
69
+
70
+ # 3.1 TRADING OFF VARIETY AND FIDELITY WITH THE TRUNCATION TRICK
71
+
72
+ Unlike models which need to backpropagate through their latents, GANs can employ an arbitrary prior $p ( z )$ , yet the vast majority of previous works have chosen to draw $z$ from either $\mathcal { N } ( 0 , I )$ or $\mathcal { U } [ - 1 , 1 ]$ . We question the optimality of this choice and explore alternatives in Appendix E.
73
+
74
+ Remarkably, our best results come from using a different latent distribution for sampling than was used in training. Taking a model trained with $z \sim \mathcal { N } ( 0 , I )$ and sampling $z$ from a truncated normal (where values which fall outside a range are resampled to fall inside that range) immediately provides a boost to IS and FID. We call this the Truncation Trick: truncating a $z$ vector by resampling the values with magnitude above a chosen threshold leads to improvement in individual sample quality at the cost of reduction in overall sample variety. Figure 2(a) demonstrates this: as the threshold is reduced, and elements of $z$ are truncated towards zero (the mode of the latent distribution), individual samples approach the mode of G’s output distribution. Related observations about this trade-off were made in (Marchesi, 2016; Pieters & Wiering, 2014).
75
+
76
+ This technique allows fine-grained, post-hoc selection of the trade-off between sample quality and variety for a given G. Notably, we can compute FID and IS for a range of thresholds, obtaining the variety-fidelity curve reminiscent of the precision-recall curve (Figure 17). As IS does not penalize lack of variety in class-conditional models, reducing the truncation threshold leads to a direct increase in IS (analogous to precision). FID penalizes lack of variety (analogous to recall) but also rewards precision, so we initially see a moderate improvement in FID, but as truncation approaches zero and variety diminishes, the FID sharply drops. The distribution shift caused by sampling with different latents than those seen in training is problematic for many models. Some of our larger models are not amenable to truncation, producing saturation artifacts (Figure 2(b)) when fed truncated noise. To counteract this, we seek to enforce amenability to truncation by conditioning G to be smooth, so that the full space of $z$ will map to good output samples. For this, we turn to Orthogonal Regularization (Brock et al., 2017), which directly enforces the orthogonality condition:
77
+
78
+ $$
79
+ R _ { \beta } ( W ) = \beta \| W ^ { \top } W - I \| _ { \mathrm { F } } ^ { 2 } ,
80
+ $$
81
+
82
+ where $W$ is a weight matrix and $\beta$ a hyperparameter. This regularization is known to often be too limiting (Miyato et al., 2018), so we explore several variants designed to relax the constraint while still imparting the desired smoothness to our models. The version we find to work best removes the diagonal terms from the regularization, and aims to minimize the pairwise cosine similarity between filters but does not constrain their norm:
83
+
84
+ $$
85
+ \begin{array} { r } { R _ { \beta } ( W ) = \beta \| W ^ { \top } W \odot ( \mathbf { 1 } - I ) \| _ { \mathrm { F } } ^ { 2 } , } \end{array}
86
+ $$
87
+
88
+ where 1 denotes a matrix with all elements set to 1. We sweep $\beta$ values and select $1 0 ^ { - 4 }$ , finding this small added penalty sufficient to improve the likelihood that our models will be amenable to truncation. Across runs in Table 1, we observe that without Orthogonal Regularization, only $16 \%$ of models are amenable to truncation, compared to $60 \%$ when trained with Orthogonal Regularization.
89
+
90
+ # 3.2 SUMMARY
91
+
92
+ We find that current GAN techniques are sufficient to enable scaling to large models and distributed, large-batch training. We find that we can dramatically improve the state of the art and train models up to $5 1 2 \times 5 1 2$ resolution without need for explicit multiscale methods like Karras et al. (2018). Despite these improvements, our models undergo training collapse, necessitating early stopping in practice. In the next two sections we investigate why settings which were stable in previous works become unstable when applied at scale.
93
+
94
+ # 4 ANALYSIS
95
+
96
+ ![](images/502a56f6b72e5570a6830eaed4026d0a34c5f9b723420e1b50265ebd6956b406.jpg)
97
+ Figure 3: A typical plot of the first singular value $\sigma _ { 0 }$ in the layers of G (a) and D (b) before Spectral Normalization. Most layers in G have well-behaved spectra, but without constraints a small subset grow throughout training and explode at collapse. D’s spectra are noisier but otherwise betterbehaved. Colors from red to violet indicate increasing depth.
98
+
99
+ # 4.1 CHARACTERIZING INSTABILITY: THE GENERATOR
100
+
101
+ Much previous work has investigated GAN stability from a variety of analytical angles and on toy problems, but the instabilities we observe occur for settings which are stable at small scale, necessitating direct analysis at large scale. We monitor a range of weight, gradient, and loss statistics during training, in search of a metric which might presage the onset of training collapse, similar to (Odena et al., 2018). We found the top three singular values $\sigma _ { 0 } , \sigma _ { 1 } , \sigma _ { 2 }$ of each weight matrix to be the most informative. They can be efficiently computed using the Alrnoldi iteration method (Golub & der Vorst, 2000), which extends the power iteration method, used in Miyato et al. (2018), to estimation of additional singular vectors and values. A clear pattern emerges, as can be seen in Figure 3(a) and Appendix F: most G layers have well-behaved spectral norms, but some layers (typically the first layer in G, which is over-complete and not convolutional) are ill-behaved, with spectral norms that grow throughout training and explode at collapse.
102
+
103
+ To ascertain if this pathology is a cause of collapse or merely a symptom, we study the effects of imposing additional conditioning on $\pmb { \mathsf { G } }$ to explicitly counteract spectral explosion. First, we directly regularize the top singular values $\sigma _ { 0 }$ of each weight, either towards a fixed value $\sigma _ { r e g }$ or towards some ratio $r$ of the second singular value, $r \cdot s g ( \sigma _ { 1 } )$ (with $s g$ the stop-gradient operation to prevent the regularization from increasing $\sigma _ { 1 }$ ). Alternatively, we employ a partial singular value decomposition to instead clamp $\sigma _ { 0 }$ . Given a weight $W$ , its first singular vectors $u _ { 0 }$ and $v _ { 0 }$ , and $\sigma _ { c l a m p }$ the value to which the $\sigma _ { 0 }$ will be clamped, our weights become:
104
+
105
+ $$
106
+ W = W - \operatorname* { m a x } ( 0 , \sigma _ { 0 } - \sigma _ { c l a m p } ) v _ { 0 } u _ { 0 } ^ { \top } ,
107
+ $$
108
+
109
+ where $\sigma _ { c l a m p }$ is set to either $\sigma _ { r e g }$ or $r \cdot s g ( \sigma _ { 1 } )$ . We observe that both with and without Spectral Normalization these techniques have the effect of preventing the gradual increase and explosion of either $\sigma _ { 0 }$ or $\frac { \sigma _ { 0 } } { \sigma _ { 1 } }$ , but even though in some cases they mildly improve performance, no combination prevents training collapse. This evidence suggests that while conditioning $\pmb { \mathsf { G } }$ might improve stability, it is insufficient to ensure stability. We accordingly turn our attention to $\mathbf { D }$ .
110
+
111
+ # 4.2 CHARACTERIZING INSTABILITY: THE DISCRIMINATOR
112
+
113
+ As with $\pmb { \mathsf { G } }$ , we analyze the spectra of D’s weights to gain insight into its behavior, then seek to stabilize training by imposing additional constraints. Figure 3(b) displays a typical plot of $\sigma _ { 0 }$ for $\mathbf { D }$ (with further plots in Appendix F). Unlike G, we see that the spectra are noisy, $\frac { \sigma _ { 0 } } { \sigma _ { 1 } }$ is well-behaved, and the singular values grow throughout training but only jump at collapse, instead of exploding.
114
+
115
+ The spikes in D’s spectra might suggest that it periodically receives very large gradients, but we observe that the Frobenius norms are smooth (Appendix F), suggesting that this effect is primarily concentrated on the top few singular directions. We posit that this noise is a result of optimization through the adversarial training process, where $\pmb { \mathsf { G } }$ periodically produces batches which strongly perturb D . If this spectral noise is causally related to instability, a natural counter is to employ gradient penalties, which explicitly regularize changes in $\mathbf { D }$ ’s Jacobian. We explore the $R _ { 1 }$ zero-centered gradient penalty from Mescheder et al. (2018):
116
+
117
+ $$
118
+ R _ { 1 } : = \frac { \gamma } { 2 } \mathbb { E } _ { p _ { D } ( x ) } \left[ \| \nabla D ( x ) \| _ { F } ^ { 2 } \right] .
119
+ $$
120
+
121
+ With the default suggested $\gamma$ strength of 10, training becomes stable and improves the smoothness and boundedness of spectra in both $\pmb { \mathsf { G } }$ and D, but performance severely degrades, resulting in a $45 \%$ reduction in IS. Reducing the penalty partially alleviates this degradation, but results in increasingly ill-behaved spectra; even with the penalty strength reduced to 1 (the lowest strength for which sudden collapse does not occur) the IS is reduced by $20 \%$ . Repeating this experiment with various strengths of Orthogonal Regularization, DropOut (Srivastava et al., 2014), and L2 (See Appendix I for details), reveals similar behaviors for these regularization strategies: with high enough penalties on D, training stability can be achieved, but at a substantial cost to performance.
122
+
123
+ We also observe that D’s loss approaches zero during training, but undergoes a sharp upward jump at collapse (Appendix F). One possible explanation for this behavior is that D is overfitting to the training set, memorizing training examples rather than learning some meaningful boundary between real and generated images. As a simple test for D’s memorization (related to Gulrajani et al. (2017)), we evaluate uncollapsed discriminators on the ImageNet training and validation sets, and measure what percentage of samples are classified as real or generated. While the training accuracy is consistently above $98 \%$ , the validation accuracy falls in the range of $50 \%$ , no better than random guessing (regardless of regularization strategy). This confirms that D is indeed memorizing the training set; we deem this in line with D’s role, which is not explicitly to generalize, but to distill the training data and provide a useful learning signal for G. Additional experiments and discussion are provided in Appendix G.
124
+
125
+ # 4.3 SUMMARY
126
+
127
+ We find that stability does not come solely from $\pmb { \mathsf { G } }$ or $\mathbf { D }$ , but from their interaction through the adversarial training process. While the symptoms of their poor conditioning can be used to track and identify instability, ensuring reasonable conditioning proves necessary for training but insufficient to prevent eventual training collapse. It is possible to enforce stability by strongly constraining D, but doing so incurs a dramatic cost in performance. With current techniques, better final performance can be achieved by relaxing this conditioning and allowing collapse to occur at the later stages of training, by which time a model is sufficiently trained to achieve good results.
128
+
129
+ Table 2: Evaluation of models at different resolutions. We report scores without truncation (Column 3), scores at the best FID (Column 4), scores at the IS of validation data (Column 5), and scores at the max IS (Column 6). Standard deviations are computed over at least three random initializations.
130
+
131
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Res.</td><td rowspan=1 colspan=1>FID/IS</td><td rowspan=1 colspan=1>(min FID)/ IS</td><td rowspan=1 colspan=1>FID/ (valid IS)</td><td rowspan=1 colspan=1>FID/ (max IS)</td></tr><tr><td rowspan=1 colspan=1>SN-GAN</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>27.62/36.80</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>N/A</td></tr><tr><td rowspan=1 colspan=1>SA-GAN</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>18.65/52.52</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>N/A</td><td rowspan=1 colspan=1>N/A</td></tr><tr><td rowspan=1 colspan=1>BigGAN</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>8.7± .6/98.8±3</td><td rowspan=1 colspan=1>7.7 ± 2/126.5±0</td><td rowspan=1 colspan=1>9.6±.4/166.3±1</td><td rowspan=1 colspan=1>25 ±2/206± 2</td></tr><tr><td rowspan=1 colspan=1>BigGAN</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>8.7 ± 1/142.3± 2</td><td rowspan=1 colspan=1>7.7 ± .1/178.0±5</td><td rowspan=1 colspan=1>9.3 ± 3/233.1 ± 1</td><td rowspan=1 colspan=1>25±5/291±4</td></tr><tr><td rowspan=1 colspan=1>BigGAN</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>8.1/144.2</td><td rowspan=1 colspan=1>7.6/170.3</td><td rowspan=1 colspan=1>11.8/241.4</td><td rowspan=1 colspan=1>27.0/275</td></tr><tr><td rowspan=1 colspan=1>BigGAN-deep</td><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>5.7 ± 3/124.5± 2</td><td rowspan=1 colspan=1>6.3± 3/148.1±4</td><td rowspan=1 colspan=1>7.4 ± .6/166.5±1</td><td rowspan=1 colspan=1>25 ±2/253±11</td></tr><tr><td rowspan=1 colspan=1>BigGAN-deep</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>6.9 ± .2/171.4± 2</td><td rowspan=1 colspan=1>7.0±.1/202.6± 2</td><td rowspan=1 colspan=1>8.1 ± 1/232.5 ± 2</td><td rowspan=1 colspan=1>27±8/317±6</td></tr><tr><td rowspan=1 colspan=1>BigGAN-deep</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>7.5/152.8</td><td rowspan=1 colspan=1>7.7/181.4</td><td rowspan=1 colspan=1>11.5/241.5</td><td rowspan=1 colspan=1>39.7/298</td></tr></table>
132
+
133
+ # 5 EXPERIMENTS
134
+
135
+ ![](images/f271d15f2d0a74e8060b04ea11570b5b75bf602bea16febd370625b001252104.jpg)
136
+ Figure 4: Samples from our BigGAN model with truncation threshold 0.5 (a-c) and an example of class leakage in a partially trained model (d).
137
+
138
+ # 5.1 EVALUATION ON IMAGENET
139
+
140
+ We evaluate our models on ImageNet ILSVRC 2012 (Russakovsky et al., 2015) at $1 2 8 \times 1 2 8$ , $2 5 6 \times 2 5 6$ , and $5 1 2 \times 5 1 2$ resolutions, employing the settings from Table 1, row 8. The samples generated by our models are presented in Figure 4, with additional samples in Appendix A, and online 2. We report IS and FID in Table 2. As our models are able to trade sample variety for quality, it is unclear how best to compare against prior art; we accordingly report values at three settings, with complete curves in Appendix D. First, we report the FID/IS values at the truncation setting which attains the best FID. Second, we report the FID at the truncation setting for which our model’s IS is the same as that attained by the real validation data, reasoning that this is a passable measure of maximum sample variety achieved while still achieving a good level of “objectness.” Third, we report FID at the maximum IS achieved by each model, to demonstrate how much variety must be traded off to maximize quality. In all three cases, our models outperform the previous state-of-the-art IS and FID scores achieved by Miyato et al. (2018) and Zhang et al. (2018).
141
+
142
+ In addition to the BigGAN model introduced in the first version of the paper and used in the majority of experiments (unless otherwise stated), we also present a 4x deeper model (BigGAN-deep) which uses a different configuration of residual blocks. As can be seen from Table 2, BigGAN-deep substantially outperforms BigGAN across all resolutions and metrics. This confirms that our findings extend to other architectures, and that increased depth leads to improvement in sample quality. Both BigGAN and BigGAN-deep architectures are described in Appendix B.
143
+
144
+ Table 3: BigGAN results on JFT-300M at $2 5 6 \times 2 5 6$ resolution. The $F I D$ and $I S$ columns report these scores given by the JFT-300M-trained Inception v2 classifier with noise distributed as $z \sim \mathcal { N } ( 0 , I )$ (non-truncated). The $\left( m i n F I D \right) / I S$ and $F I D / ( m a x I S )$ columns report scores at the best FID and IS from a sweep across truncated noise distributions ranging from $\sigma = 0$ to $\sigma = 2$ . Images from the JFT-300M validation set have an IS of 50.88 and FID of 1.94.
145
+
146
+ <table><tr><td rowspan=1 colspan=1>Ch.</td><td rowspan=1 colspan=1>Param (M)</td><td rowspan=1 colspan=1>Shared</td><td rowspan=1 colspan=1>Skip-z</td><td rowspan=1 colspan=1>Ortho.</td><td rowspan=1 colspan=1>FID</td><td rowspan=1 colspan=1>IS</td><td rowspan=1 colspan=1>(min FID)/ IS</td><td rowspan=1 colspan=1>FID /(max IS)</td></tr><tr><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>317.1</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>48.38</td><td rowspan=1 colspan=1>23.27</td><td rowspan=1 colspan=1>48.6/23.1</td><td rowspan=1 colspan=1>49.1/23.9</td></tr><tr><td rowspan=1 colspan=1>64</td><td rowspan=1 colspan=1>99.4</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>23.48</td><td rowspan=1 colspan=1>24.78</td><td rowspan=1 colspan=1>22.4/21.0</td><td rowspan=1 colspan=1>60.9/35.8</td></tr><tr><td rowspan=1 colspan=1>96</td><td rowspan=1 colspan=1>207.9</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>了</td><td rowspan=1 colspan=1>\</td><td rowspan=1 colspan=1>18.84</td><td rowspan=1 colspan=1>27.86</td><td rowspan=1 colspan=1>17.1/23.3</td><td rowspan=1 colspan=1>51.6/38.1</td></tr><tr><td rowspan=1 colspan=1>128</td><td rowspan=1 colspan=1>355.7</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>了</td><td rowspan=1 colspan=1>厂</td><td rowspan=1 colspan=1>13.75</td><td rowspan=1 colspan=1>30.61</td><td rowspan=1 colspan=1>13.0/28.0</td><td rowspan=1 colspan=1>46.2/47.8</td></tr></table>
147
+
148
+ Our observation that D overfits to the training set, coupled with our model’s sample quality, raises the obvious question of whether or not G simply memorizes training points. To test this, we perform class-wise nearest neighbors analysis in pixel space and the feature space of pre-trained classifier networks (Appendix A). In addition, we present both interpolations between samples and class-wise interpolations (where $z$ is held constant) in Figures 8 and 9. Our model convincingly interpolates between disparate samples, and the nearest neighbors for its samples are visually distinct, suggesting that our model does not simply memorize training data.
149
+
150
+ We note that some failure modes of our partially-trained models are distinct from those previously observed. Most previous failures involve local artifacts (Odena et al., 2016), images consisting of texture blobs instead of objects (Salimans et al., 2016), or the canonical mode collapse. We observe class leakage, where images from one class contain properties of another, as exemplified by Figure 4(d). We also find that many classes on ImageNet are more difficult than others for our model; our model is more successful at generating dogs (which make up a large portion of the dataset, and are mostly distinguished by their texture) than crowds (which comprise a small portion of the dataset and have more large-scale structure). Further discussion is available in Appendix A.
151
+
152
+ # 5.2 ADDITIONAL EVALUATION ON JFT-300M
153
+
154
+ To confirm that our design choices are effective for even larger and more complex and diverse datasets, we also present results of our system on a subset of JFT-300M (Sun et al., 2017). The full JFT-300M dataset contains 300M real-world images labeled with 18K categories. Since the category distribution is heavily long-tailed, we subsample the dataset to keep only images with the 8.5K most common labels. The resulting dataset contains 292M images – two orders of magnitude larger than ImageNet. For images with multiple labels, we sample a single label randomly and independently whenever an image is sampled. To compute IS and FID for the GANs trained on this dataset, we use an Inception v2 classifier (Szegedy et al., 2016) trained on this dataset. Quantitative results are presented in Table 3. All models are trained with batch size 2048. We compare an ablated version of our model – comparable to SA-GAN (Zhang et al., 2018) but with the larger batch size – against a “full” BigGAN model that makes uses of all of the techniques applied to obtain the best results on ImageNet (shared embedding, skip- $z$ , and orthogonal regularization). Our results show that these techniques substantially improve performance even in the setting of this much larger dataset at the same model capacity (64 base channels). We further show that for a dataset of this scale, we see significant additional improvements from expanding the capacity of our models to 128 base channels, while for ImageNet GANs that additional capacity was not beneficial.
155
+
156
+ In Figure 19 (Appendix D), we present truncation plots for models trained on this dataset. Unlike for ImageNet, where truncation limits of $\sigma \approx 0$ tend to produce the highest fidelity scores, IS is typically maximized for our JFT-300M models when the truncation value $\sigma$ ranges from 0.5 to 1. We suspect that this is at least partially due to the intra-class variability of JFT-300M labels, as well as the relative complexity of the image distribution, which includes images with multiple objects at a variety of scales. Interestingly, unlike models trained on ImageNet, where training tends to collapse without heavy regularization (Section 4), the models trained on JFT-300M remain stable over many hundreds of thousands of iterations. This suggests that moving beyond ImageNet to larger datasets may partially alleviate GAN stability issues.
157
+
158
+ The improvement over the baseline GAN model that we achieve on this dataset without changes to the underlying models or training and regularization techniques (beyond expanded capacity) demonstrates that our findings extend from ImageNet to datasets with scale and complexity thus far unprecedented for generative models of images.
159
+
160
+ # 6 CONCLUSION
161
+
162
+ We have demonstrated that Generative Adversarial Networks trained to model natural images of multiple categories highly benefit from scaling up, both in terms of fidelity and variety of the generated samples. As a result, our models set a new level of performance among ImageNet GAN models, improving on the state of the art by a large margin. We have also presented an analysis of the training behavior of large scale GANs, characterized their stability in terms of the singular values of their weights, and discussed the interplay between stability and performance.
163
+
164
+ # ACKNOWLEDGMENTS
165
+
166
+ We would like to thank Kai Arulkumaran, Matthias Bauer, Peter Buchlovsky, Jeffrey Defauw, Sander Dieleman, Ian Goodfellow, Ariel Gordon, Karol Gregor, Dominik Grewe, Chris Jones, Jacob Menick, Augustus Odena, Suman Ravuri, Ali Razavi, Mihaela Rosca, and Jeff Stanway.
167
+
168
+ # REFERENCES
169
+
170
+ 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 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 OSDI, 2016.
171
+
172
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks. ´ In ICML, 2017.
173
+
174
+ Shane Barratt and Rishi Sharma. A note on the Inception Score. In arXiv preprint arXiv:1801.01973, 2018.
175
+
176
+ Marc G. Bellemare, Ivo Danihelka, Will Dabney, Shakir Mohamed, Balaji Lakshminarayanan, Stephan Hoyer, and Remi Munos. The Cramer distance as a solution to biased Wasserstein gra- ´ dients. In arXiv preprint arXiv:1705.10743, 2017.
177
+
178
+ Mikolaj Binkowski, Dougal J. Sutherland, Michael Arbel, and Arthur Gretton. Demystifying MMD ´ GANs. In ICLR, 2018.
179
+
180
+ Andrew Brock, Theodore Lim, J.M. Ritchie, and Nick Weston. Neural photo editing with introspective adversarial networks. In ICLR, 2017.
181
+
182
+ Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. Infogan: Interpretable representation learning by information maximizing generative adversarial nets. In NIPS, 2016.
183
+
184
+ Harm de Vries, Florian Strub, Jer´ emie Mary, Hugo Larochelle, Olivier Pietquin, and Aaron ´ Courville. Modulating early visual processing by language. In NIPS, 2017.
185
+
186
+ Emily Denton, Soumith Chintala, Arthur Szlam, and Rob Fergus. Deep generative image models using a laplacian pyramid of adversarial networks. In NIPS, 2015.
187
+
188
+ Vincent Dumoulin, Jonathon Shlens, and Manjunath Kudlur. A learned representation for artistic style. In ICLR, 2017.
189
+
190
+ William Fedus, Mihaela Rosca, Balaji Lakshminarayanan, Andrew M. Dai, Shakir Mohamed, and Ian Goodfellow. Many paths to equilibrium: GANs do not need to decrease a divergence at every step. In ICLR, 2018.
191
+
192
+ Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In AISTATS, 2010.
193
+
194
+ Gene Golub and Henk Van der Vorst. Eigenvalue computation in the 20th century. Journal of Computational and Applied Mathematics, 123:35–65, 2000.
195
+
196
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, and Aaron Courville Yoshua Bengio. Generative adversarial nets. In NIPS, 2014.
197
+
198
+ Google. Cloud TPUs. https://cloud.google.com/tpu/, 2018.
199
+
200
+ Ishaan Gulrajani, Faruk Ahmed, Mart´ın Arjovsky, Vincent Dumoulin, and Aaron C. Courville. Improved training of Wasserstein GANs. In NIPS, 2017.
201
+
202
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
203
+
204
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, Gunter Klambauer, and ¨ Sepp Hochreiter. GANs trained by a two time-scale update rule converge to a local nash equilibrium. In NIPS, 2017.
205
+
206
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
207
+
208
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of GANs for improved quality, stability, and variation. In ICLR, 2018.
209
+
210
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2014.
211
+
212
+ Naveen Kodali, Jacob Abernethy, James Hays, and Zsolt Kira. On convergence and stability of GANs. In arXiv preprint arXiv:1705.07215, 2017.
213
+
214
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
215
+
216
+ Jae Hyun Lim and Jong Chul Ye. Geometric GAN. In arXiv preprint arXiv:1705.02894, 2017.
217
+
218
+ Xudong Mao, Qing Li, Haoran Xie, Raymond Y. K. Lau, and Zhen Wang. Least squares generative adversarial networks. In arXiv preprint arXiv:1611.04076, 2016.
219
+
220
+ Marco Marchesi. Megapixel size image creation using generative adversarial networks. In arXiv preprint arXiv:1706.00082, 2016.
221
+
222
+ Lars Mescheder, Andreas Geiger, and Sebastian Nowozin. Which training methods for GANs do actually converge? In ICML, 2018.
223
+
224
+ Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. In arXiv preprint arXiv:1411.1784, 2014.
225
+
226
+ Takeru Miyato and Masanori Koyama. cGANs with projection discriminator. In ICLR, 2018.
227
+
228
+ Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. In ICLR, 2018.
229
+
230
+ Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-GAN: Training generative neural samplers using variational divergence minimization. In NIPS, 2016.
231
+
232
+ Augustus Odena, Vincent Dumoulin, and Chris Olah. Deconvolution and checkerboard artifacts. Distill, 2016.
233
+
234
+ Augustus Odena, Christopher Olah, and Jonathon Shlens. Conditional image synthesis with auxiliary classifier GANs. In ICML, 2017.
235
+
236
+ Augustus Odena, Jacob Buckman, Catherine Olsson, Tom B. Brown, Christopher Olah, Colin Raffel, and Ian Goodfellow. Is generator conditioning causally related to GAN performance? In ICML, 2018.
237
+
238
+ Ethan Perez, Florian Strub, Harm de Vries, Vincent Dumoulin, and Aaron Courville. FiLM: Visual reasoning with a general conditioning layer. In AAAI, 2018.
239
+
240
+ Mathijs Pieters and Marco Wiering. Comparing generative adversarial network techniques for image creation and modificatio. In arXiv preprint arXiv:1803.09093, 2014.
241
+
242
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In ICLR, 2016.
243
+
244
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, and Michael Bernstein. ImageNet large scale visual recognition challenge. IJCV, 115:211–252, 2015.
245
+
246
+ Tim Salimans and Diederik Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. In NIPS, 2016.
247
+
248
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training GANs. In NIPS, 2016.
249
+
250
+ Tim Salimans, Han Zhang, Alec Radford, and Dimitris Metaxas. Improving GANs using optimal transport. In ICLR, 2018.
251
+
252
+ Andrew Saxe, James McClelland, and Surya Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. In ICLR, 2014.
253
+
254
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
255
+
256
+ Casper Kaae Sønderby, Jose Caballero, Lucas Theis, Wenzhe Shi, and Ferenc Huszr. Amortised map inference for image super-resolution. In ICLR, 2017.
257
+
258
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. JMLR, 15:1929–1958, 2014.
259
+
260
+ Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In ICCV, 2017.
261
+
262
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In CVPR, 2016.
263
+
264
+ Lucas Theis, Aaron van den Oord, and Matthias Bethge. A note on the evaluation of generative ¨ models. In arXiv preprint arXiv:1511.01844, 2015.
265
+
266
+ Dustin Tran, Rajesh Ranganath, and David M. Blei. Hierarchical implicit models and likelihood-free variational inference. In NIPS, 2017.
267
+
268
+ Xiaolong Wang, Ross B. Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In CVPR, 2018.
269
+
270
+ Yuhuai Wu, Yuri Burda, Ruslan Salakhutdinov, and Roger B. Grosse. On the quantitative analysis of decoder-based generative models. In ICLR, 2017.
271
+
272
+ Yasin Yazc, Chuan-Sheng Foo, Stefan Winkler, Kim-Hui Yap, Georgios Piliouras, and Vijay Chandrasekhar. The unusual effectiveness of averaging in gan training. In arXiv preprint arXiv:1806.04498, 2018.
273
+
274
+ Han Zhang, Ian Goodfellow, Dimitris Metaxas, and Augustus Odena. Self-attention generative adversarial networks. In arXiv preprint arXiv:1805.08318, 2018.
275
+
276
+ # APPENDIX A ADDITIONAL SAMPLES, INTERPOLATIONS, AND NEAREST NEIGHBORS FROM IMAGENET MODELS
277
+
278
+ ![](images/c937cff9a102fa41fd24eaf0fcd2862d26bd8123d6302fc33a0b8a051fd22e9a.jpg)
279
+ Figure 5: Samples generated by our BigGAN model at $2 5 6 \times 2 5 6$ resolution.
280
+
281
+ ![](images/a09dd6b24745984ef274c140c95e2529143c3bef7b3628e6b318931946de9151.jpg)
282
+ Figure 6: Samples generated by our BigGAN model at $5 1 2 \times 5 1 2$ resolution.
283
+
284
+ ![](images/3b31ec9c5af382db6ef448fe678f96feb9dd195d37d95e3b227aabc9d5a6f2d8.jpg)
285
+ Figure 7: Comparing easy classes (a) with difficult classes (b) at $5 1 2 \times 5 1 2$ . Classes such as dogs which are largely textural, and common in the dataset, are far easier to model than classes involving unaligned human faces or crowds. Such classes are more dynamic and structured, and often have details to which human observers are more sensitive. The difficulty of modeling global structure is further exacerbated when producing high-resolution images, even with non-local blocks.
286
+
287
+ ![](images/ee31ee196531a2e78a78c70a84cafae0fdba75233deee53523946002c03d6f89.jpg)
288
+ Figure 8: Interpolations between $z , c$ pairs.
289
+
290
+ ![](images/69297aec9a83dfd503986d37c03c48079d4f99380ff3bf8979c68fe499fe5747.jpg)
291
+ Figure 9: Interpolations between $c$ with $z$ held constant. Pose semantics are frequently maintained between endpoints (particularly in the final row). Row 2 demonstrates that grayscale is encoded in the joint $z , c$ space, rather than in $z$ .
292
+
293
+ ![](images/5a815d5a4b6289158f66ae7762b269006bab4e81e0503c5405d9f08c288ff3d1.jpg)
294
+ Figure 10: Nearest neighbors in VGG-16-fc7 (Simonyan & Zisserman, 2015) feature space. The generated image is in the top left.
295
+
296
+ ![](images/27628e9bd88e98a62108a2713499de794a775ef9c6b30ac2d4fe6583f4c813a6.jpg)
297
+ Figure 11: Nearest neighbors in ResNet-50-avgpool (He et al., 2016) feature space. The generated image is in the top left.
298
+
299
+ ![](images/101855a27a911cf056a22285fdf9626fb0348d3856b0ebff9b9a827ce6c5330c.jpg)
300
+ Figure 12: Nearest neighbors in pixel space. The generated image is in the top left.
301
+
302
+ ![](images/bf0c8abfcba5b34a163e07feb3d55df0054d59c4d0aac85eb26f11ba10979f3f.jpg)
303
+ Figure 13: Nearest neighbors in VGG-16-fc7 (Simonyan & Zisserman, 2015) feature space. The generated image is in the top left.
304
+
305
+ ![](images/d9d7c022d3881e4fe6f54a966089c4d04d7e6a2e8d75ed4adca2a63f4e760f43.jpg)
306
+ Figure 14: Nearest neighbors in ResNet-50-avgpool (He et al., 2016) feature space. The generated image is in the top left.
307
+
308
+ # APPENDIX B ARCHITECTURAL DETAILS
309
+
310
+ In the BigGAN model (Figure 15), we use the ResNet (He et al., 2016) GAN architecture of (Zhang et al., 2018), which is identical to that used by (Miyato et al., 2018), but with the channel pattern in D modified so that the number of filters in the first convolutional layer of each block is equal to the number of output filters (rather than the number of input filters, as in Miyato et al. (2018); Gulrajani et al. (2017)). We use a single shared class embedding in G, and skip connections for the latent vector $z$ (skip- $z$ ). In particular, we employ hierarchical latent spaces, so that the latent vector $z$ is split along its channel dimension into chunks of equal size (20-D in our case), and each chunk is concatenated to the shared class embedding and passed to a corresponding residual block as a conditioning vector. The conditioning of each block is linearly projected to produce per-sample gains and biases for the BatchNorm layers of the block. The bias projections are zero-centered, while the gain projections are centered at 1. Since the number of residual blocks depends on the image resolution, the full dimensionality of $z$ is 120 for $1 2 8 \times 1 2 8$ , 140 for $2 5 6 \times 2 5 6$ , and 160 for $5 1 2 \times 5 1 2$ images.
311
+
312
+ The BigGAN-deep model (Figure 16) differs from BigGAN in several aspects. It uses a simpler variant of skip- $z$ conditioning: instead of first splitting $z$ into chunks, we concatenate the entire $z$ with the class embedding, and pass the resulting vector to each residual block through skip connections. BigGAN-deep is based on residual blocks with bottlenecks (He et al., 2016), which incorporate two additional $1 \times 1$ convolutions: the first reduces the number of channels by a factor of 4 before the more expensive $3 \times 3$ convolutions; the second produces the required number of output channels. While BigGAN relies on $1 \times 1$ convolutions in the skip connections whenever the number of channels needs to change, in BigGAN-deep we use a different strategy aimed at preserving identity throughout the skip connections. In G, where the number of channels needs to be reduced, we simply retain the first group of channels and drop the rest to produce the required number of channels. In D, where the number of channels should be increased, we pass the input channels unperturbed, and concatenate them with the remaining channels produced by a $1 \times 1$ convolution. As far as the network configuration is concerned, the discriminator is an exact reflection of the generator. There are two blocks at each resolution (BigGAN uses one), and as a result BigGAN-deep is four times deeper than BigGAN. Despite their increased depth, the BigGAN-deep models have significantly fewer parameters mainly due to the bottleneck structure of their residual blocks. For example, the $1 2 8 \times 1 2 8$ BigGAN-deep G and D have 50.4M and $3 4 . 6 \mathbf { M }$ parameters respectively, while the corresponding original BigGAN models have $7 0 . 4 \mathbf { M }$ and $8 8 . 0 \mathbf { M }$ parameters. All BigGAN-deep models use attention at $6 4 \times 6 4$ resolution, channel width multiplier $c h = 1 2 8$ , and $z \in \mathbb { R } ^ { 1 2 8 }$ .
313
+
314
+ ![](images/e91203f16394fcf7e7e3a3ed66b2201a7bf795fd271993199c3106bd1475e2c9.jpg)
315
+ Figure 15: (a) A typical architectural layout for BigGAN’s G; details are in the following tables. (b) A Residual Block (ResBlock up) in BigGAN’s G. (c) A Residual Block (ResBlock down) in BigGAN’s D.
316
+
317
+ ![](images/d3f46a5ed7e9b5314ebf6827cd90e54ad8e0736198dd2901ef01b36c676a084e.jpg)
318
+ Figure 16: (a) A typical architectural layout for BigGAN-deep’s G; details are in the following tables. (b) A Residual Block (ResBlock up) in BigGAN-deep’s G. (c) A Residual Block (ResBlock down) in BigGAN-deep’s D. A ResBlock (without up or down) in BigGAN-deep does not include the Upsample or Average Pooling layers, and has identity skip connections.
319
+
320
+ Table 4: BigGAN architecture for $1 2 8 \times 1 2 8$ images. ch represents the channel width multiplier in each network from Table 1.
321
+
322
+ <table><tr><td rowspan=1 colspan=1>z ∈ R120 ~N(0,I)Embed(y)∈R128</td></tr><tr><td rowspan=1 colspan=1>Linear (20+128)→4×4×16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlockup 16ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 8ch → 4ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 4ch → 2ch</td></tr><tr><td rowspan=1 colspan=1>Non-Local Block (64 × 64)</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 2ch → ch</td></tr><tr><td rowspan=1 colspan=1>BN,ReLU,3 ×3 Conv ch →3</td></tr><tr><td rowspan=1 colspan=1>Tanh</td></tr><tr><td rowspan=1 colspan=1>(a)Generator</td></tr></table>
323
+
324
+ <table><tr><td rowspan=1 colspan=1>RGB image x ∈ R128×128×3</td></tr><tr><td rowspan=1 colspan=1>ResBlock down ch →2ch</td></tr><tr><td rowspan=1 colspan=1>Non-Local Block (64 × 64)</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 2ch → 4ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 4ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlockdown 8ch→16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlockdown16ch→16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ReLU, Global sum pooling</td></tr><tr><td rowspan=1 colspan=1>Embed(y)·h + (linear→1)</td></tr><tr><td rowspan=1 colspan=1>(b)Discriminator</td></tr></table>
325
+
326
+ Table 5: BigGAN architecture for $2 5 6 \times 2 5 6$ images. Relative to the $1 2 8 \times 1 2 8$ architecture, we add an additional ResBlock in each network at $1 6 \times 1 6$ resolution, and move the non-local block in $\pmb { \mathsf { G } }$ to $1 2 8 \times 1 2 8$ resolution. Memory constraints prevent us from moving the non-local block in D.
327
+
328
+ <table><tr><td rowspan=1 colspan=1>z ∈ R140 ~N(0,I)Embed(y)∈R128</td></tr><tr><td rowspan=1 colspan=1>Linear(20+128)→4×4×16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 16ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 8ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 8ch →4ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 4ch -→ 2ch</td></tr><tr><td rowspan=1 colspan=1>Non-Local Block (128 × 128)</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 2ch →ch</td></tr><tr><td rowspan=1 colspan=1>BN,ReLU,3 ×3 Conv ch →3</td></tr><tr><td rowspan=1 colspan=1>Tanh</td></tr><tr><td rowspan=1 colspan=1>(a) Generator</td></tr></table>
329
+
330
+ <table><tr><td rowspan=1 colspan=1>RGB image x ∈ R256×256×3</td></tr><tr><td rowspan=1 colspan=1>ResBlock down ch → 2ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 2ch → 4ch</td></tr><tr><td rowspan=1 colspan=1>Non-Local Block (64 × 64)</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 4ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 8ch → 8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 8ch→16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ReLU, Global sum pooling</td></tr><tr><td rowspan=1 colspan=1>Embed(y)·h+ (linear→1)</td></tr><tr><td rowspan=1 colspan=1>(b)Discriminator</td></tr></table>
331
+
332
+ Table 6: BigGAN architecture for $5 1 2 \times 5 1 2$ images. Relative to the $2 5 6 \times 2 5 6$ architecture, we add an additional ResBlock at the $5 1 2 \times 5 1 2$ resolution. Memory constraints force us to move the non-local block in both networks back to $6 4 \times 6 4$ resolution as in the $1 2 8 \times 1 2 8$ pixel setting.
333
+
334
+ <table><tr><td rowspan=1 colspan=1>z ∈ R160 ~N(0,I)Embed(y)∈R128</td></tr><tr><td rowspan=1 colspan=1>Linear(20+128)→4× 4× 16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 16ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 8ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 8ch → 4ch</td></tr><tr><td rowspan=1 colspan=1>Non-Local Block (64 × 64)</td></tr><tr><td rowspan=1 colspan=1>ResBlockup 4ch→2ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 2ch → ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up ch → ch</td></tr><tr><td rowspan=1 colspan=1>BN,ReLU,3 × 3 Conv ch → 3</td></tr><tr><td rowspan=1 colspan=1>Tanh</td></tr><tr><td rowspan=1 colspan=1>(a)Generator</td></tr></table>
335
+
336
+ <table><tr><td rowspan=1 colspan=1>RGB image x ∈ R512×512×3</td></tr><tr><td rowspan=1 colspan=1>ResBlock down ch → ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down ch →2ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 2ch → 4ch</td></tr><tr><td rowspan=1 colspan=1>Non-Local Block (64 × 64)</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 4ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 8ch → 8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 8ch→16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock16ch→16ch</td></tr><tr><td rowspan=1 colspan=1>ReLU, Global sum pooling</td></tr><tr><td rowspan=1 colspan=1>Embed(y)·h + (linear→1)</td></tr><tr><td rowspan=1 colspan=1>(b)Discriminator</td></tr></table>
337
+
338
+ Table 7: BigGAN-deep architecture for $1 2 8 \times 1 2 8$ images.
339
+
340
+ <table><tr><td rowspan=1 colspan=1>z ∈ R128 ~ N(0,1)Embed(y) ∈R128</td></tr><tr><td rowspan=1 colspan=1>Linear (128+128)-→4×4 ×16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 16ch → 8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 8ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 8ch → 4ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 4ch →4ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 4ch → 2ch</td></tr><tr><td rowspan=1 colspan=1>Non-Local Block (64 × 64)</td></tr><tr><td rowspan=1 colspan=1>ResBlock 2ch→ 2ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 2ch → ch</td></tr><tr><td rowspan=1 colspan=1>BN,ReLU,3 ×3 Conv ch -→3</td></tr><tr><td rowspan=1 colspan=1>Tanh</td></tr><tr><td rowspan=1 colspan=1>(a)Generator</td></tr></table>
341
+
342
+ <table><tr><td rowspan=1 colspan=1>RGB image x ∈ R128×128×3</td></tr><tr><td rowspan=1 colspan=1>3 ×3Conv 3→ ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down ch → 2ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 2ch → 2ch</td></tr><tr><td rowspan=1 colspan=1>Non-Local Block (64 × 64)</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 2ch → 4ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 4ch→4ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 4ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 8ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 8ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock16ch→16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 16ch→16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ReLU, Global sum pooling</td></tr><tr><td rowspan=1 colspan=1>Embed(y)·h + (linear→1)</td></tr><tr><td rowspan=1 colspan=1>(b)Discriminator</td></tr></table>
343
+
344
+ Table 8: BigGAN-deep architecture for $2 5 6 \times 2 5 6$ images.
345
+
346
+ <table><tr><td rowspan=1 colspan=1>z ∈R128 ~N(0,I)Embed(y) ∈R128</td></tr><tr><td rowspan=1 colspan=1>Linear(128+128)→4 × 4× 16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 16ch→16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 16ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 8ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 8ch → 8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 8ch → 8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 8ch →4ch</td></tr><tr><td rowspan=1 colspan=1>Non-Local Block (64 × 64)</td></tr><tr><td rowspan=1 colspan=1>ResBlock4ch→4ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 4ch → 2ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 2ch→ 2ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 2ch → ch</td></tr><tr><td rowspan=1 colspan=1>BN,ReLU,3 ×3 Conv ch →3</td></tr><tr><td rowspan=1 colspan=1>Tanh</td></tr><tr><td rowspan=1 colspan=1>(a) Generator</td></tr></table>
347
+
348
+ <table><tr><td rowspan=1 colspan=1>RGB image x ∈ R256×256×3</td></tr><tr><td rowspan=1 colspan=1>3 ×3Conv 3 →ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down ch → 2ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 2ch→2ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 2ch→4ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 4ch→4ch</td></tr><tr><td rowspan=1 colspan=1>Non-Local Block (64 × 64)</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 4ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 8ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 8ch→8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 8ch→ 8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 8ch→16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock16ch→16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock16ch→16ch</td></tr><tr><td rowspan=1 colspan=1>ReLU, Global sum pooling</td></tr><tr><td rowspan=1 colspan=1>Embed(y)·h + (linear→1)</td></tr></table>
349
+
350
+ (b) Discriminator
351
+
352
+ Table 9: BigGAN-deep architecture for $5 1 2 \times 5 1 2$ images.
353
+
354
+ <table><tr><td rowspan=1 colspan=1>zER128~N(0,I)Embed(y)∈R128</td></tr><tr><td rowspan=1 colspan=1>Linear (128+128)→4× 4×16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock16ch→16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlockup 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 16ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 8ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 8ch → 8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 8ch→8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 8ch → 4ch</td></tr><tr><td rowspan=1 colspan=1>Non-Local Block (64 × 64)</td></tr><tr><td rowspan=1 colspan=1>ResBlock 4ch→4ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 4ch → 2ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 2ch →2ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up 2ch →ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock ch →ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock up ch → ch</td></tr><tr><td rowspan=1 colspan=1>BN,ReLU,3 ×3 Conv ch → 3</td></tr><tr><td rowspan=1 colspan=1>Tanh</td></tr><tr><td rowspan=1 colspan=1>(a)Generator</td></tr></table>
355
+
356
+ <table><tr><td rowspan=1 colspan=1>RGB image x ∈ R512×512×3</td></tr><tr><td rowspan=1 colspan=1>3 × 3Conv 3-→ ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down ch →ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock ch →ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down ch →2ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 2ch→2ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 2ch → 4ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 4ch→4ch</td></tr><tr><td rowspan=1 colspan=1>Non-Local Block (64 × 64)</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 4ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 8ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 8ch →8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 8ch→8ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 8ch →→16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock16ch→16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock down 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ResBlock 16ch →16ch</td></tr><tr><td rowspan=1 colspan=1>ReLU, Global sum pooling</td></tr><tr><td rowspan=1 colspan=1>Embed(y)·h + (linear→1)</td></tr><tr><td rowspan=1 colspan=1>(b)Discriminator</td></tr></table>
357
+
358
+ # APPENDIX C EXPERIMENTAL DETAILS
359
+
360
+ Our basic setup follows SA-GAN (Zhang et al., 2018), and is implemented in TensorFlow (Abadi et al., 2016). We employ the architectures detailed in Appendix B, with non-local blocks inserted at a single stage in each network. Both G and D networks are initialized with Orthogonal Initialization (Saxe et al., 2014). We use Adam optimizer (Kingma & Ba, 2014) with $\beta _ { 1 } = 0$ and $\beta _ { 2 } = 0 . 9 9 9$ and a constant learning rate. For BigGAN models at all resolutions, we use $2 \cdot 1 0 ^ { - 4 }$ in D and $5 \cdot 1 0 ^ { - 5 } $ in G. For BigGAN-deep, we use the learning rate of $2 \cdot 1 0 ^ { - 4 }$ in $\mathbf { D }$ and $5 \cdot 1 0 ^ { - 5 } $ in $\pmb { \mathsf { G } }$ for $1 2 8 \times 1 2 8$ models, and $2 . 5 \cdot 1 0 ^ { - 5 }$ in both D and $\pmb { \mathsf { G } }$ for $2 5 6 \times 2 5 6$ and $5 1 2 \times 5 1 2$ models. We experimented with the number of D steps per G step (varying it from 1 to 6) and found that two D steps per $\pmb { \mathsf { G } }$ step gave the best results.
361
+
362
+ We use an exponential moving average of the weights of G at sampling time, with a decay rate set to 0.9999. We employ cross-replica BatchNorm (Ioffe & Szegedy, 2015) in G, where batch statistics are aggregated across all devices, rather than a single device as in standard implementations. Spectral Normalization (Miyato et al., 2018) is used in both G and D, following SA-GAN (Zhang et al., 2018). We train on a Google TPU v3 Pod, with the number of cores proportional to the resolution: 128 for $1 2 8 \times 1 2 8$ , 256 for $2 5 6 \times 2 5 6$ , and 512 for $5 1 2 \times 5 1 2$ . Training takes between 24 and 48 hours for most models. We increase $\epsilon$ from the default $1 0 ^ { - 8 }$ to $1 0 ^ { - 4 }$ in BatchNorm and Spectral Norm to mollify low-precision numerical issues. We preprocess data by cropping along the long edge and rescaling to a given resolution with area resampling.
363
+
364
+ # C.1 BATCHNORM STATISTICS AND SAMPLING
365
+
366
+ The default behavior with batch normalized classifier networks is to use a running average of the activation moments at test time. Previous works (Radford et al., 2016) have instead used batch statistics when sampling images. While this is not technically an invalid way to sample, it means that results are dependent on the test batch size (and how many devices it is split across), and further complicates reproducibility.
367
+
368
+ We find that this detail is extremely important, with changes in test batch size producing drastic changes in performance. This is further exacerbated when one uses exponential moving averages of G’s weights for sampling, as the BatchNorm running averages are computed with non-averaged weights and are poor estimates of the activation statistics for the averaged weights.
369
+
370
+ To counteract both these issues, we employ “standing statistics,” where we compute activation statistics at sampling time by running the G through multiple forward passes (typically 100) each with different batches of random noise, and storing means and variances aggregated across all forward passes. Analogous to using running statistics, this results in G’s outputs becoming invariant to batch size and the number of devices, even when producing a single sample.
371
+
372
+ # C.2 CIFAR-10
373
+
374
+ We run our networks on CIFAR-10 (Krizhevsky & Hinton, 2009) using the settings from Table 1, row 8, and achieve an IS of 9.22 and an FID of 14.73 without truncation.
375
+
376
+ # C.3 INCEPTION SCORES OF IMAGENET IMAGES
377
+
378
+ We compute the IS for both the training and validation sets of ImageNet. At $1 2 8 \times 1 2 8$ the training data has an IS of 233, and the validation data has an IS of 166. At $2 5 6 \times 2 5 6$ the training data has an IS of 377, and the validation data has an IS of 234. At $5 1 2 \times 5 1 2$ the training data has an IS of 348, and the validation data has an IS of 241. The discrepancy between training and validation scores is due to the Inception classifier having been trained on the training data, resulting in high-confidence outputs that are preferred by the Inception Score.
379
+
380
+ # APPENDIX D ADDITIONAL PLOTS
381
+
382
+ ![](images/e847b965cc77291bb4c9d55739b9a1e4bec960072e20fe36d9724decf7ebbb78.jpg)
383
+ Figure 17: IS vs. FID at $1 2 8 \times 1 2 8$ . Scores are averaged across three random seeds.
384
+
385
+ ![](images/c19f550905df85c7c84aea1c6a3efc64b91cdf54ea8cc0056b0e6b39cffb6eb7.jpg)
386
+ Figure 18: IS vs. FID at 256 and 512 pixels. Scores are averaged across three random seeds for 256.
387
+
388
+ ![](images/0cac1722d5f510dbb25400f9da8a93e2d20836d44bb49e73387451cefb2e42f4.jpg)
389
+ Figure 19: JFT-300M IS vs. FID at $2 5 6 \times 2 5 6$ . We show truncation values from $\sigma = 0$ to $\sigma = 2$ (top) and from $\sigma = 0 . 5$ to $\sigma = 1 . 5$ (bottom). Each curve corresponds to a row in Table 3. The curve labeled with baseline corresponds to the first row (with orthogonal regularization and other techniques disabled), while the rest correspond to rows 2-4 – the same architecture at different capacities $( C h )$ .
390
+
391
+ # APPENDIX E CHOOSING LATENT SPACES
392
+
393
+ While most previous work has employed $\mathcal { N } ( 0 , I )$ or $\mathcal { U } [ - 1 , 1 ]$ as the prior for $z$ (the noise input to G), we are free to choose any latent distribution from which we can sample. We explore the choice of latents by considering an array of possible designs, described below. For each latent, we provide the intuition behind its design and briefly describe how it performs when used as a drop-in replacement for $z \sim \mathcal { N } ( 0 , I )$ in an SA-GAN baseline. As the Truncation Trick proved more beneficial than switching to any of these latents, we do not perform a full ablation study, and employ $z \sim \mathcal { N } ( 0 , I )$ for our main results to take full advantage of truncation. The two latents which we find to work best without truncation are Bernoulli $\{ 0 , 1 \}$ and Censored Normal max $( \mathcal { N } ( 0 , I ) , 0 )$ , both of which improve speed of training and lightly improve final performance, but are less amenable to truncation.
394
+
395
+ We also ablate the choice of latent space dimensonality (which by default is $z \in \mathbb { R } ^ { 1 2 8 }$ ), finding that we are able to successfully train with latent dimensions as low as $z \in \mathbb { R } ^ { 8 }$ , and that with $z \in \mathbb { R } ^ { \breve { 3 } 2 }$ we see a minimal drop in performance. While this is substantially smaller than many previous works, direct comparison to single-class networks (such as those in Karras et al. (2018), which employ a $z \in \mathbb { R } ^ { 5 1 \frac { \mathbf { s } } { 2 } }$ latent space on a highly constrained dataset with 30,000 images) is improper, as our networks have additional class information provided as input.
396
+
397
+ # LATENTS
398
+
399
+ • $\mathcal { N } ( 0 , I )$ . A standard choice of the latent space which we use in the main experiments.
400
+ • $\mathcal { U } [ - 1 , 1 ]$ . Another standard choice; we find that it performs similarly to $\mathcal { N } ( 0 , I )$ .
401
+ • Bernoulli $\{ 0 , 1 \}$ . A discrete latent might reflect our prior that underlying factors of variation in natural images are not continuous, but discrete (one feature is present, another is not). This latent outperforms $\mathcal { N } ( 0 , I )$ (in terms of IS) by $8 \%$ and requires $60 \%$ fewer iterations.
402
+ • max $( \mathcal { N } ( 0 , I ) , 0 )$ , also called Censored Normal. This latent is designed to introduce sparsity in the latent space (reflecting our prior that certain latent features are sometimes present and sometimes not), but also allow those latents to vary continuously, expressing different degrees of intensity for latents which are active. This latent outperforms $\mathcal { N } ( 0 , I )$ (in terms of IS) by $1 5 \mathrm { - } 2 0 \%$ and tends to require fewer iterations.
403
+ • Bernoulli $\{ - 1 , 1 \}$ . This latent is designed to be discrete, but not sparse (as the network can learn to activate in response to negative inputs). This latent performs near-identically to $\mathcal { N } ( 0 , I )$ .
404
+ • Independent Categorical in $\{ - 1 , 0 , 1 \}$ , with equal probability. This distribution is chosen to be discrete and have sparsity, but also to allow latents to take on both positive and negative values. This latent performs near-identically to $\mathcal { N } ( 0 , I )$ .
405
+ • $\mathcal { N } ( 0 , I )$ multiplied by Bernoulli $\{ 0 , 1 \}$ . This distribution is chosen to have continuous latent factors which are also sparse (with a peak at zero), similar to Censored Normal but not constrained to be positive. This latent performs near-identically to $\mathcal { N } ( 0 , I )$ . Concatenating $\mathcal { N } ( 0 , I )$ and Bernoulli $\{ 0 , 1 \}$ , each taking half of the latent dimensions. This is inspired by Chen et al. (2016), and is chosen to allow some factors of variation to be discrete, while others are continuous. This latent outperforms $\mathcal { N } ( 0 , I )$ by around $5 \%$ .
406
+ • Variance annealing: we sample from $\mathcal { N } ( 0 , \sigma I )$ , where $\sigma$ is allowed to vary over training. We compared a variety of piecewise schedules and found that starting with $\sigma = 2$ and annealing towards $\sigma = 1$ over the course of training mildly improved performance. The space of possible variance schedules is large, and we did not explore it in depth – we suspect that a more principled or better-tuned schedule could more strongly impact performance.
407
+ • Per-sample variable variance: $\mathcal { N } ( 0 , \sigma _ { i } I )$ , where $\sigma _ { i } \sim \mathcal { U } [ \sigma _ { l } , \sigma _ { h } ]$ independently for each sample $i$ in a batch, and $\left( \sigma _ { l } , \sigma _ { h } \right)$ are hyperparameters. This distribution was chosen to try and improve amenability to the Truncation Trick by feeding the network noise samples with non-constant variance. This did not appear to affect performance, but we did not explore it in depth. One might also consider scheduling $( \sigma _ { l } , \sigma _ { h } )$ , similar to variance annealing.
408
+
409
+ ![](images/770e6212c1b743ea9c528e3a09ef7eb70e5f0c466d78e678c36cfc62173f0bdb.jpg)
410
+ APPENDIX F MONITORED TRAINING STATISTICS
411
+ Figure 20: Training statistics for a typical model without special modifications. Collapse occurs after 200000 iterations.
412
+
413
+ ![](images/9578474d9f89654837f07e6854209c3ddf738b23f433d0d8477bd34296e295c7.jpg)
414
+ Figure 21: G training statistics with $\sigma _ { 0 }$ in $\pmb { \mathsf { G } }$ regularized towards 1. Collapse occurs after 125000 iterations.
415
+
416
+ ![](images/3d644dbae274a9f3ad419efd40a9555fb5b2cf71c06eddfc4c316b889ae0671d.jpg)
417
+ Figure 22: D training statistics with $\sigma _ { 0 }$ in $\pmb { \mathsf { G } }$ regularized towards 1. Collapse occurs after 125000 iterations.
418
+
419
+ ![](images/36253d8d51fbb806a4853e595b2f22389ae8535108892ba620e10634620ab0b0.jpg)
420
+ Figure 23: G training statistics with an R1 Gradient Penalty of strength 10 on D. This model does not collapse, but only reaches a maximum IS of 55.
421
+
422
+ ![](images/60d612c06ae08229ae660289f4651372aef42838ffc8ab9255206f28f2055153.jpg)
423
+ Figure 24: D training statistics with an R1 Gradient Penalty of strength 10 on D. This model does not collapse, but only reaches a maximum IS of 55.
424
+
425
+ ![](images/615febba148a0c246cc6ea9e919cffa51f498a40640d5e66810733da83cbb834.jpg)
426
+ Figure 25: G training statistics with Dropout (keep probability 0.8) applied to the last feature layer of D. This model does not collapse, but only reaches a maximum IS of 70.
427
+
428
+ ![](images/bf988cd53f4afcab0ac969176d319cb7fc14b20a3072a9f661693d69fc752459.jpg)
429
+ Figure 26: D training statistics with Dropout (keep probability 0.8) applied to the last feature layer of D. This model does not collapse, but only reaches a maximum IS of 70.
430
+
431
+ ![](images/566619c4cc62f5871f213c60d31d438c02ad5d1295627eaace07742815f47f8d.jpg)
432
+ Figure 27: Additional training statistics for a typical model without special modifications. Collapse occurs after 200000 iterations.
433
+
434
+ ![](images/88d0b0ac3d6f8fd1353070ec4894e73581f5bcafb6b77ec4e5c1863fddda2c4b.jpg)
435
+ Figure 28: Additional training statistics with an R1 Gradient Penalty of strength 10 on D. This model does not collapse, but only reaches a maximum IS of 55.
436
+
437
+ # APPENDIX G ADDITIONAL DISCUSSION: STABILITY AND COLLAPSE
438
+
439
+ In this section, we present and discuss additional investigations into the stability of our models, expanding upon the discussion in Section 4.
440
+
441
+ # G.1 INTERVENING BEFORE COLLAPSE
442
+
443
+ The symptoms of collapse are sharp and sudden, with sample quality dropping from its peak to its lowest value over the course of a few hundred iterations. We can detect this collapse when the singular values in G explode, but while the (unnormalized) singular values grow throughout training, there is no consistent threshold at which collapse occurs. This raises the question of whether it is possible to prevent or delay collapse by taking a model checkpoint several thousand iterations before collapse, and continuing training with some hyperparameters modified (e.g., the learning rate).
444
+
445
+ We conducted a range of intervention experiments wherein we took checkpoints of a collapsed model ten or twenty thousand iterations before collapse, changed some aspect of the training setup, then observed whether collapse occurred, when it occurred relative to the original collapse, and the final performance attained at collapse.
446
+
447
+ We found that increasing the learning rates (relative to their initial values) in either G or D, or both $\pmb { \mathsf { G } }$ and D, led to immediate collapse. This occurred even when doubling the learning rates from $2 \cdot 1 0 ^ { - 4 }$ in D and $5 \cdot 1 0 ^ { - 5 } $ in $\pmb { \mathsf { G } }$ , to $4 \cdot 1 0 ^ { - 4 }$ in D and $1 \cdot 1 0 ^ { - 4 }$ in G, a setting which is not normally unstable when used as the initial learning rates. We also tried changing the momentum terms (Adam’s $\beta _ { 1 }$ and $\beta _ { 2 }$ ), or resetting the momentum vectors to zero, but this tended to either make no difference or, when increasing the momentum, cause immediate collapse.
448
+
449
+ We found that decreasing the learning rate in G, but keeping the learning rate in D unchanged could delay collapse (in some cases by over one hundred thousand iterations), but also crippled training— once the learning rate in $\pmb { \mathsf { G } }$ was decayed, performance either stayed constant or slowly decayed. Conversely, reducing the learning rate in D while keeping G’s learning rate led to immediate collapse. We hypothesize that this is because of the need for D to remain optimal throughout training—if its learning rate is reduced, it can no longer “keep up” with G, and training collapses. With this in mind, we also tried increasing the number of D steps per $\pmb { \mathsf { G } }$ step, but this either had no effect, or delayed collapse at the cost of crippling training (similar to decaying G’s learning rate).
450
+
451
+ To further illuminate these dynamics, we construct two additional intervention experiments, one where we freeze G before collapse (by ceasing all parameter updates) and observe whether D remains stable, and the reverse, where we freeze D before collapse and observe whether G remains stable. We find that when G is frozen, D remains stable, and slowly reduces both components of its loss towards zero. However, when D is frozen, G immediately and dramatically collapses, maxing out D’s loss to values upwards of 300, compared to the normal range of 0 to 3.
452
+
453
+ This leads to two conclusions: first, as has been noted in previous works (Miyato et al., 2018; Gulrajani et al., 2017; Zhang et al., 2018), D must remain optimal with respect to G both for stability and to provide useful gradient information. The consequence of G being allowed to win the game is a complete breakdown of the training process, regardless of G’s conditioning or optimization settings. Second, favoring D over G (either by training it with a larger learning rate, or for more steps) is insufficient to ensure stability even if D is well-conditioned. This suggests either that in practice, an optimal D is necessary but insufficient for training stability, or that some aspect of the system results in D not being trained towards optimality. With the latter possibility in mind, we take a closer look at the noise in D’s spectra in the following section.
454
+
455
+ # G.2 SPIKES IN THE DISCRIMINATOR’S SPECTRA
456
+
457
+ ![](images/91765d8ef82963256049d6b672c0086e916f6f0b6f49f8dfdf37338189f4c5b0.jpg)
458
+ Figure 29: A closeup of D’s spectra at a noise spike.
459
+
460
+ If some element of D’s training process results in undesirable dynamics, it follows that the behavior of D’s spectra may hold clues as to what that element is. The top three singular values of D differ from G’s in that they have a large noise component, tend to grow throughout training but only show a small response to collapse, and the ratio of the first two singular values tends to be centered around one, suggesting that the spectra of D have a slow decay. When viewed up close (Figure 29), the noise spikes resemble an impulse response: at each spike, the spectra jump upwards, then slowly decrease, with some oscillation.
461
+
462
+ One possible explanation is that this behavior is a consequence of D memorizing the training data, as suggested by experiments in Section 4.2. As it approaches perfect memorization, it receives less and less signal from real data, as both the original GAN loss and the hinge loss provide zero gradients when D outputs a confident and correct prediction for a given example. If the gradient signal from real data attenuates to zero, this can result in D eventually becoming biased due to exclusively received gradients that encourage its outputs to be negative. If this bias passes a certain threshold, D will eventually misclassify a large number of real examples and receive a large gradient encouraging positive outputs, resulting in the observed impulse responses.
463
+
464
+ This argument suggests several fixes. First, one might consider an unbounded loss (such as the Wasserstein loss (Arjovsky et al., 2017)) which would not suffer this gradient attentuation. We found that even with gradient penalties and brief re-tuning of optimizer hyperparameters, our models did not stably train for more than a few thousand iterations with this loss. We instead explored changing the margin of the hinge loss as a partial compromise: for a given model and minibatch of data, increasing the margin will result in more examples falling within the margin, and thus contributing to the loss.3. Training with a smaller margin (by a factor of 2) measurably reduces performance, but training with a larger margin (by up to a factor of 3) does not prevent collapse or reduce the noise in D’s spectra. Increasing the margin beyond 3 results in unstable training similar to using the Wasserstein loss. Finally, the memorization argument might suggest that using a smaller D or using dropout in D would improve training by reducing its capacity to memorize, but in practice this degrades training.
465
+
466
+ # APPENDIX H NEGATIVE RESULTS
467
+
468
+ We explored a range of novel and existing techniques which ended up degrading or otherwise not affecting performance in our setting. We report them here; our evaluations for this section are not as thorough as those for the main architectural choices.
469
+
470
+ Our intention in reporting these results is to save time for future work, and to give a more complete picture of our attempts to improve performance or stability. We note, however, that these results must be understood to be specific to the particular setup we used. A pitfall of reporting negative results is that one might report that a particular technique doesn’t work, when the reality is that this technique did not have the desired effect when applied in a particular way to a particular problem. Drawing overly general conclusions might close off potentially fruitful avenues of research.
471
+
472
+ • We found that doubling the depth (by inserting an additional Residual block after every upor down-sampling block) hampered performance.
473
+ • We experimented with sharing class embeddings between both G and D (as opposed to just within $\pmb { \mathsf { G } }$ ). This is accomplished by replacing D’s class embedding with a projection from G’s embeddings, as is done in G’s BatchNorm layers. In our initial experiments this seemed to help and accelerate training, but we found this trick scaled poorly and was sensitive to optimization hyperparameters, particularly the choice of number of D steps per G step.
474
+ • We tried replacing BatchNorm in G with WeightNorm (Salimans & Kingma, 2016), but this crippled training. We also tried removing BatchNorm and only having Spectral Normalization, but this also crippled training.
475
+ • We tried adding BatchNorm to D (both class-conditional and unconditional) in addition to
476
+ Spectral Normalization, but this crippled training.
477
+ • We tried varying the choice of location of the attention block in G and D (and inserting multiple attention blocks at different resolutions) but found that at $1 2 8 \times 1 2 8$ there was no noticeable benefit to doing so, and compute and memory costs increased substantially. We found a benefit to moving the attention block up one stage when moving to $2 5 6 \times 2 5 6$ , which is in line with our expectations given the increased resolution.
478
+ • We tried using filter sizes of 5 or 7 instead of 3 in either $\pmb { \mathsf { G } }$ or $\mathbf { D }$ or both. We found that having a filter size of 5 in G only provided a small improvement over the baseline but came at an unjustifiable compute cost. All other settings degraded performance.
479
+ • We tried varying the dilation for convolutional filters in both G and D at $1 2 8 \times 1 2 8$ , but found that even a small amount of dilation in either network degraded performance.
480
+ • We tried bilinear upsampling in $\pmb { \mathsf { G } }$ in place of nearest-neighbors upsampling, but this degraded performance.
481
+ • In some of our models, we observed class-conditional mode collapse, where the model would only output one or two samples for a subset of classes but was still able to generate samples for all other classes. We noticed that the collapsed classes had embedings which had become very large relative to the other embeddings, and attempted to ameliorate this issue by applying weight decay to the shared embedding only. We found that small amounts of weight decay $( 1 0 ^ { - 6 } )$ instead degraded performance, and that only even smaller values $( 1 0 ^ { - 8 } )$ did not degrade performance, but these values were also too small to prevent the class vectors from exploding. Higher-resolution models appear to be more resilient to this problem, and none of our final models appear to suffer from this type of collapse.
482
+ • We experimented with using MLPs instead of linear projections from G’s class embeddings to its BatchNorm gains and biases, but did not find any benefit to doing so. We also experimented with Spectrally Normalizing these MLPs, and with providing these (and the linear projections) with a bias at their output, but did not notice any benefit.
483
+ • We tried gradient norm clipping (both the global variant typically used in recurrent networks, and a local version where the clipping value is determined on a per-parameter basis) but found this did not alleviate instability.
484
+
485
+ # APPENDIX I HYPERPARAMETERS
486
+
487
+ We performed various hyperparameter sweeps in this work:
488
+
489
+ • We swept the Cartesian product of the learning rates for each network through $[ 1 0 ^ { - 5 }$ , $5 \cdot 1 0 ^ { - 5 }$ , $1 0 ^ { - 4 }$ , $2 \cdot 1 0 ^ { - 4 }$ , $4 \cdot 1 0 ^ { - 4 }$ , $8 \cdot 1 0 ^ { - 4 } $ , $1 0 ^ { = 3 } ]$ , and initially found that the SA-GAN settings (G’s learning rate $1 0 ^ { - 4 }$ , D’s learning rate $4 \cdot 1 0 ^ { - 4 } \ $ ) were optimal at lower batch sizes; we did not repeat this sweep at higher batch sizes but did try halving and doubling the learning rate, arriving at the halved settings used for our experiments. We swept the R1 gradient penalty strength through $[ 1 0 ^ { - 3 }$ , $1 0 ^ { - 2 }$ , $1 0 ^ { - 1 }$ , 0.5, 1, 2, 3, 5, 10]. We find that the strength of the penalty correlates negatively with performance, but that settings above 0.5 impart training stability.
490
+ • We swept the keep probabilities for DropOut in the final layer of D through [0.5, 0.6, 0.7, 0.8, 0.9, 0.95]. We find that DropOut has a similar stabilizing effect to R1 but also degrades performance.
491
+ • We swept D’s Adam $\beta _ { 1 }$ parameter through [0.1, 0.2, 0.3, 0.4, 0.5] and found it to have a light regularization effect similar to DropOut, but not to significantly improve results. Higher $\beta _ { 1 }$ terms in either network crippled training.
492
+ • We swept the strength of the modified Orthogonal Regularization penalty in G through $[ 1 0 ^ { - 5 }$ , $5 \cdot 1 0 ^ { - 5 }$ , $1 0 ^ { - 4 }$ , $5 \cdot 1 0 ^ { - 4 } $ , $1 0 ^ { - 3 }$ , $1 0 ^ { - 2 } ]$ , and selected $1 0 ^ { - 4 }$ .
md/train/BJ0Ee8cxx/BJ0Ee8cxx.md ADDED
@@ -0,0 +1,267 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HIERARCHICAL MEMORY NETWORKS
2
+
3
+ Sarath Chandar∗1, Sungjin $\mathbf { A } \mathbf { h } \mathbf { n } ^ { 1 }$ , Hugo Larochelle2,4, Pascal Vincent1,4, Gerald Tesauro3, Yoshua Bengio1,4
4
+
5
+ 1 Université de Montréal, Canada.
6
+ 2 Twitter, USA.
7
+ 3 IBM Watson Research Center, USA.
8
+ 4 CIFAR, Canada.
9
+
10
+ # ABSTRACT
11
+
12
+ Memory networks are neural networks with an explicit memory component that can be both read and written to by the network. The memory is often addressed in a soft way using a softmax function, making end-to-end training with backpropagation possible. However, this is not computationally scalable for applications which require the network to read from extremely large memories. On the other hand, it is well known that hard attention mechanisms based on reinforcement learning are challenging to train successfully. In this paper, we explore a form of hierarchical memory network, which can be considered as a hybrid between hard and soft attention memory networks. The memory is organized in a hierarchical structure such that reading from it is done with less computation than soft attention over a flat memory, while also being easier to train than hard attention over a flat memory. Specifically, we propose to incorporate Maximum Inner Product Search (MIPS) in the training and inference procedures for our hierarchical memory network. We explore the use of various state-of-the art approximate MIPS techniques and report results on SimpleQuestions, a challenging large scale factoid question answering task.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Until recently, traditional machine learning approaches for challenging tasks such as image captioning, object detection, or machine translation have consisted in complex pipelines of algorithms, each being separately tuned for better performance. With the recent success of neural networks and deep learning research, it has now become possible to train a single model end-to-end, using backpropagation. Such end-to-end systems often outperform traditional approaches, since the entire model is directly optimized with respect to the final task at hand. However, simple encode-decode style neural networks often underperform on knowledge-based reasoning tasks like question-answering or dialog systems. Indeed, in such cases it is nearly impossible for regular neural networks to store all the necessary knowledge in their parameters.
17
+
18
+ Neural networks with memory (Graves et al., 2014; Weston et al., 2015b) can deal with knowledge bases by having an external memory component which can be used to explicitly store knowledge. The memory is accessed by reader and writer functions, which are both made differentiable so that the entire architecture (neural network, reader, writer and memory components) can be trained end-to-end using backpropagation. Memory-based architectures can also be considered as generalizations of RNNs and LSTMs, where the memory is analogous to recurrent hidden states. However they are much richer in structure and can handle very long-term dependencies because once a vector (i.e., a memory) is stored, it is copied from time step to time step and can thus stay there for a very long time (and gradients correspondingly flow back time unhampered).
19
+
20
+ There exists several variants of neural networks with a memory component: Memory Networks (Weston et al., 2015b), Neural Turing Machines (NTM) (Graves et al., 2014), Dynamic Memory Networks (DMN) (Kumar et al., 2015). They all share five major components: memory, input module, reader, writer, and output module.
21
+
22
+ Memory: The memory is an array of cells, each capable of storing a vector. The memory is often initialized with external data (e.g. a database of facts), by filling in its cells with a pre-trained vector representations of that data.
23
+
24
+ Input module: The input module is to compute a representation of the input that can be used by other modules.
25
+
26
+ Writer: The writer takes the input representation and updates the memory based on it. The writer can be as simple as filling the slots in the memory with input vectors in a sequential way (as often done in memory networks). If the memory is bounded, instead of sequential writing, the writer has to decide where to write and when to rewrite cells (as often done in NTMs).
27
+
28
+ Reader: Given an input and the current state of the memory, the reader retrieves content from the memory, which will then be used by an output module. This often requires comparing the input’s representation or a function of the recurrent state with memory cells using some scoring function such as a dot product.
29
+
30
+ Output module: Given the content retrieved by the reader, the output module generates a prediction, which often takes the form of a conditional distribution over multiple labels for the output.
31
+
32
+ For the rest of the paper, we will use the name memory network to describe any model which has any form of these five components. We would like to highlight that all the components except the memory are learnable. Depending on the application, any of these components can also be fixed. In this paper, we will focus on the situation where a network does not write and only reads from the memory.
33
+
34
+ In this paper, we focus on the application of memory networks to large-scale tasks. Specifically, we focus on large scale factoid question answering. For this problem, given a large set of facts and a natural language question, the goal of the system is to answer the question by retrieving the supporting fact for that question, from which the answer can be derived. Application of memory networks to this task has been studied by Bordes et al. (2015). However, Bordes et al. (2015) depended on keyword based heuristics to filter the facts to a smaller set which is manageable for training. However heuristics are invariably dataset dependent and we are interested in a more general solution which can be used when the facts are of any structure. One can design soft attention retrieval mechanisms, where a convex combination of all the cells is retrieved or design hard attention retrieval mechanisms where one or few cells from the memory are retrieved. Soft attention is achieved by using softmax over the memory which makes the reader differentiable and hence learning can be done using gradient descent. Hard attention is achieved by using methods like REINFORCE (Williams, 1992), which provides a noisy gradient estimate when discrete stochastic decisions are made by a model.
35
+
36
+ Both soft attention and hard attention have limitations. As the size of the memory grows, soft attention using softmax weighting is not scalable. It is computationally very expensive, since its complexity is linear in the size of the memory. Also, at initialization, gradients are dispersed so much that it can reduce the effectiveness of gradient descent. These problems can be alleviated by a hard attention mechanism, for which the training method of choice is REINFORCE. However, REINFORCE can be brittle due to its high variance and existing variance reduction techniques are complex. Thus, it is rarely used in memory networks (even in cases of a small memory).
37
+
38
+ In this paper, we propose a new memory selection mechanism based on Maximum Inner Product Search (MIPS) which is both scalable and easy to train. This can be considered as a hybrid of soft and hard attention mechanisms. The key idea is to structure the memory in a hierarchical way such that it is easy to perform MIPS, hence the name Hierarchical Memory Network (HMN). HMNs are scalable at both training and inference time. The main contributions of the paper are as follows:
39
+
40
+ • We explore hierarchical memory networks, where the memory is organized in a hierarchical fashion, which allows the reader to efficiently access only a subset of the memory. • While there are several ways to decide which subset to access, we propose to pose memory access as a maximum inner product search (MIPS) problem.
41
+
42
+ • We empirically show that exact MIPS-based algorithms not only enjoy similar convergence as soft attention models, but can even improve the performance of the memory network. • Since exact MIPS is as computationally expensive as a full soft attention model, we propose to train the memory networks using approximate MIPS techniques for scalable memory access. • We empirically show that unlike exact MIPS, approximate MIPS algorithms provide a speedup and scalability of training, though at the cost of some performance.
43
+
44
+ # 2 HIERARCHICAL MEMORY NETWORKS
45
+
46
+ In this section, we describe the proposed Hierarchical Memory Network (HMN). In this paper, HMNs only differ from regular memory networks in two of its components: the memory and the reader.
47
+
48
+ Memory: Instead of a flat array of cells for the memory structure, HMNs leverages a hierarchical memory structure. Memory cells are organized into groups and the groups can further be organized into higher level groups. The choice for the memory structure is tightly coupled with the choice of reader, which is essential for fast memory access. We consider three classes of approaches for the memory’s structure: hashing-based approaches, tree-based approaches, and clustering-based approaches. This is explained in detail in the next section.
49
+
50
+ Reader: The reader in the HMN is different from the readers in flat memory networks. Flat memorybased readers use either soft attention over the entire memory or hard attention that retrieves a single cell. While these mechanisms might work with small memories, with HMNs we are more interested in achieving scalability towards very large memories. So instead, HMN readers use soft attention only over a selected subset of the memory. Selecting memory subsets is guided by a maximum inner product search algorithm, which can exploit the hierarchical structure of the organized memory to retrieve the most relevant facts in sub-linear time. The MIPS-based reader is explained in more detail in the next section.
51
+
52
+ In HMNs, the reader is thus trained to create MIPS queries such that it can retrieve a sufficient set of facts. While most of the standard applications of MIPS (Ram & Gray, 2012; Bachrach et al., 2014; Shrivastava & Li, 2014) so far have focused on settings where both query vector and database (memory) vectors are precomputed and fixed, memory readers in HMNs are learning to do MIPS by updating the input representation such that the result of MIPS retrieval contains the correct fact(s).
53
+
54
+ # 3 MEMORY READER WITH $K$ -MIPS ATTENTION
55
+
56
+ In this section, we describe how the HMN memory reader uses Maximum Inner Product Search (MIPS) during learning and inference.
57
+
58
+ We begin with a formal definition of $K$ -MIPS. Given a set of points ${ \mathcal { X } } = \{ x _ { 1 } , \ldots , x _ { n } \}$ and a query vector $q$ , our goal is to find
59
+
60
+ $$
61
+ \mathrm { a r g m a x } _ { i \in \mathcal { X } } ^ { ( K ) } \ q ^ { \top } x _ { i }
62
+ $$
63
+
64
+ where the $\mathrm { a r g m a x } ^ { ( K ) }$ returns the indices of the top- $K$ maximum values. In the case of HMNs, $\mathcal { X }$ corresponds to the memory and $q$ corresponds to the vector computed by the input module.
65
+
66
+ A simple but inefficient solution for $K$ -MIPS involves a linear search over the cells in memory by performing the dot product of $q$ with all the memory cells. While this will return the exact result for $K$ -MIPS, it is too costly to perform when we deal with a large-scale memory. However, in many practical applications, it is often sufficient to have an approximate result for $K$ -MIPS, trading speed-up at the cost of the accuracy. There exist several approximate $K$ -MIPS solutions in the literature (Shrivastava & Li, 2014; 2015; Bachrach et al., 2014; Neyshabur & Srebro, 2015).
67
+
68
+ All the approximate $K$ -MIPS solutions add a form of hierarchical structure to the memory and visit only a subset of the memory cells to find the maximum inner product for a given query. Hashingbased approaches (Shrivastava & Li, 2014; 2015; Neyshabur & Srebro, 2015) hash cells into multiple bins, and given a query they search for $K$ -MIPS cell vectors only in bins that are close to the bin associated with the query. Tree-based approaches (Ram & Gray, 2012; Bachrach et al., 2014) create search trees with cells in the leaves of the tree. Given a query, a path in the tree is followed and MIPS is performed only for the leaf for the chosen path. Clustering-based approaches (Auvolat et al., 2015) cluster cells into multiple clusters (or a hierarchy of clusters) and given a query, they perform MIPS on the centroids of the top few clusters. We refer the readers to (Auvolat et al., 2015) for an extensive comparison of various state-of-the-art approaches for approximate $K$ -MIPS.
69
+
70
+ Our proposal is to exploit this rich approximate $K$ -MIPS literature to achieve scalable training and inference in HMNs. Instead of filtering the memory with heuristics, we propose to organize the memory based on approximate $K$ -MIPS algorithms and then train the reader to learn to perform MIPS. Specifically, consider the following softmax over the memory which the reader has to perform for every reading step to retrieve a set of relevant candidates:
71
+
72
+ $$
73
+ R _ { o u t } = \operatorname { s o f t m a x } ( h ( q ) M ^ { T } )
74
+ $$
75
+
76
+ where $h ( q ) \in \mathbb { R } ^ { d }$ is the representation of the query, $M \in \mathbb { R } ^ { N \times d }$ is the memory with $N$ being the total number of cells in the memory. We propose to replace this softmax with softmax(K) which is defined as follows:
77
+
78
+ $$
79
+ C = \mathrm { a r g m a x } ^ { ( K ) } h ( q ) M ^ { T }
80
+ $$
81
+
82
+ $$
83
+ R _ { o u t } = \operatorname { s o f t m a x } ^ { ( K ) } ( h ( q ) M ^ { T } ) = \operatorname { s o f t m a x } ( h ( q ) M [ C ] ^ { T } )
84
+ $$
85
+
86
+ where $C$ is the indices of top- $K$ MIP candidate cells and $M [ C ]$ is a sub-matrix of $M$ where the rows are indexed by $C$ .
87
+
88
+ One advantage of using the softmax(K) is that it naturally focuses on cells that would normally receive the strongest gradients during learning. That is, in a full softmax, the gradients are otherwise more dispersed across cells, given the large number of cells and despite many contributing a small gradient. As our experiments will show, this results in slower training.
89
+
90
+ One problematic situation when learning with the softmax(K) is when we are at the initial stages of training and the $K$ -MIPS reader is not including the correct fact candidate. To avoid this issue, we always include the correct candidate to the top- $K$ candidates retrieved by the $K$ -MIPS algorithm, effectively performing a fully supervised form of learning.
91
+
92
+ During training, the reader is updated by backpropagation from the output module, through the subset of memory cells. Additionally, the log-likelihood of the correct fact computed using $K$ - softmax is also maximized. This second supervision helps the reader learn to modify the query such that the maximum inner product of the query with respect to the memory will yield the correct supporting fact in the top $K$ candidate set.
93
+
94
+ Until now, we described the exact $K$ -MIPS-based learning framework, which still requires a linear look-up over all memory cells and would be prohibitive for large-scale memories. In such scenarios, we can replace the exact $K$ -MIPS in the training procedure with the approximate $K$ -MIPS. This is achieved by deploying a suitable memory hierarchical structure. The same approximate $K$ -MIPSbased reader can be used during inference stage as well. Of course, approximate $K$ -MIPS algorithms might not return the exact MIPS candidates and will likely to hurt performance, but at the benefit of achieving scalability.
95
+
96
+ While the memory representation is fixed in this paper, updating the memory along with the query representation should improve the likelihood of choosing the correct fact. However, updating the memory will reduce the precision of the approximate $K$ -MIPS algorithms, since all of them assume that the vectors in the memory are static. Designing efficient dynamic $K$ -MIPS should improve the performance of HMNs even further, a challenge that we hope to address in future work.
97
+
98
+ # 3.1 READER WITH CLUSTERING-BASED APPROXIMATE $K$ -MIPS
99
+
100
+ Clustering-based approximate $K$ -MIPS was proposed in (Auvolat et al., 2015) and it has been shown to outperform various other state-of-the-art data dependent and data independent approximate $K$ - MIPS approaches for inference tasks. As we will show in the experiments section, clustering-based MIPS also performs better when used to training HMNs. Hence, we focus our presentation on the clustering-based approach and propose changes that were found to be helpful for learning HMNs.
101
+
102
+ Following most of the other approximate $K$ -MIPS algorithms, Auvolat et al. (2015) convert MIPS to Maximum Cosine Similarity Search (MCSS) problem:
103
+
104
+ $$
105
+ \operatorname { a r g m a x } _ { i \in \mathcal { X } } ^ { ( K ) } \ \frac { q ^ { T } x _ { i } } { \left. \left. q \right. \right. \left. \left. x _ { i } \right. \right. } = \operatorname { a r g m a x } _ { i \in \mathcal { X } } ^ { ( K ) } \ \frac { q ^ { T } x _ { i } } { \left. \left. x _ { i } \right. \right. }
106
+ $$
107
+
108
+ When all the data vectors $x _ { i }$ have the same norm, then MCSS is equivalent to MIPS. However, it is often restrictive to have this additional constraint. Instead, Auvolat et al. (2015) append additional dimensions to both query and data vectors to convert MIPS to MCSS. In HMN terminology, this would correspond to adding a few more dimensions to the memory cells and input representations.
109
+
110
+ The algorithm introduces two hyper-parameters, $U < 1$ and $m \in \mathbb { N } ^ { * }$ . The first step is to scale all the vectors in the memory by the same factor, such that maxi $| | x _ { i } | | _ { 2 } = U$ . We then apply two mappings, $P$ and $Q$ , on the memory cells and on the input vector, respectively. These two mappings simply concatenate $m$ new components to the vectors and make the norms of the data points all roughly the same (Shrivastava & Li, 2015). The mappings are defined as follows:
111
+
112
+ $$
113
+ \begin{array} { l c l } { P ( x ) } & { = } & { [ x , 1 / 2 - | | x | | _ { 2 } ^ { 2 } , 1 / 2 - | | x | | _ { 2 } ^ { 4 } , \dots , 1 / 2 - | | x | | _ { 2 } ^ { 2 m } ] } \\ { Q ( x ) } & { = } & { [ x , 0 , 0 , \dots , 0 ] } \end{array}
114
+ $$
115
+
116
+ We thus have the following approximation of MIPS by MCSS for any query vector $q$ :
117
+
118
+ $$
119
+ \begin{array} { r c l } { \operatorname * { a r g m a x } _ { i } ^ { ( K ) } q ^ { \top } x _ { i } } & { \simeq } & { \operatorname * { a r g m a x } _ { i } ^ { ( K ) } \frac { Q ( q ) ^ { \top } P ( x _ { i } ) } { \vert \vert Q ( q ) \vert \vert _ { 2 } \cdot \vert \vert P ( x _ { i } ) \vert \vert _ { 2 } } } \end{array}
120
+ $$
121
+
122
+ Once we convert MIPS to MCSS, we can use spherical $K$ -means (Zhong, 2005) or its hierarchical version to approximate and speedup the cosine similarity search. Once the memory is clustered, then every read operation requires only $K$ dot-products, where $K$ is the number of cluster centroids.
123
+
124
+ Since this is an approximation, it is error-prone. As we are using this approximation for the learning process, this introduces some bias in gradients, which can affect the overall performance of HMN. To alleviate this bias, we propose three simple strategies.
125
+
126
+ • Instead of using only the top- $K$ candidates for a single read query, we also add top- $K$ candidates retrieved for every other read query in the mini-batch. This serves two purposes. First, we can do efficient matrix multiplications by leveraging GPUs since all the $K$ -softmax in a minibatch are over the same set of elements. Second, this also helps to decrease the bias introduced by the approximation error.
127
+ • For every read access, instead of only using the top few clusters which has a maximum product with the read query, we also sample some clusters from the rest, based on a probability distribution log-proportional to the dot product with the cluster centroids. This also decreases the bias.
128
+ • We can also sample random blocks of memory and add it to top- $K$ candidates.
129
+
130
+ We empirically investigate the effect of these variations in Section 5.5.
131
+
132
+ # 4 RELATED WORK
133
+
134
+ Memory networks have been introduced in (Weston et al., 2015b) and have been so far applied to comprehension-based question answering (Weston et al., 2015a; Sukhbaatar et al., 2015), large scale question answering (Bordes et al., 2015) and dialogue systems (Dodge et al., 2015). While (Weston et al., 2015b) considered supervised memory networks in which the correct supporting fact is given during the training stage, (Sukhbaatar et al., 2015) introduced semi-supervised memory networks that can learn the supporting fact by itself. (Kumar et al., 2015; Xiong et al., 2016) introduced Dynamic Memory Networks (DMNs) which can be considered as a memory network with two types of memory: a regular large memory and an episodic memory. Another related class of model is the Neural Turing Machine (Graves et al., 2014), which uses softmax-based soft attention. Later (Zaremba & Sutskever, 2015) extended NTM to hard attention using reinforcement learning. (Dodge et al., 2015; Bordes et al., 2015) alleviate the problem of the scalability of soft attention by having an initial keyword based filtering stage, which reduces the number of facts being considered. Our work generalizes this filtering by using MIPS for filtering. This is desirable because MIPS can be applied for any modality of data or even when there is no overlap between the words in a question and the words in facts.
135
+
136
+ The softmax arises in various situations and most relevant to this work are scaling methods for large vocabulary neural language modeling. In neural language modeling, the final layer is a softmax distribution over the next word and there exist several approaches to achieve scalability. (Morin & Bengio, 2005) proposes a hierarchical softmax based on prior clustering of the words into a binary, or more generally $n$ -ary tree, that serves as a fixed structure for the learning process of the model. The complexity of training is reduced from $O ( n )$ to $O ( \log n )$ . Due to its clustering and tree structure, it resembles the clustering-based MIPS techniques we explore in this paper. However, the approaches differ at a fundamental level. Hierarchical softmax defines the probability of a leaf node as the product of all the probabilities computed by all the intermediate softmaxes on the way to that leaf node. By contrast, an approximate MIPS search imposes no such constraining structure on the probabilistic model, and is better thought as efficiently searching for top winners of what amounts to be a large ordinary flat softmax. Other methods such as Noice Constrastive Estimation (Mnih & Gregor, 2014) and Negative Sampling (Mikolov et al., 2013) avoid an expensive normalization constant by sampling negative samples from some marginal distribution. By contrast, our approach approximates the softmax by explicitly including in its negative samples candidates that likely would have a large softmax value. Jean et al. (2015) introduces an importance sampling approach that considers all the words in a mini-batch as the candidate set. This in general might also not include the MIPS candidates with highest softmax values.
137
+
138
+ (Spring & Shrivastava, 2016) is the only work that we know of, proposing to use MIPS during learning. It proposes hashing-based MIPS to sort the hidden layer activations and reduce the computation in every layer. However, a small scale application was considered and data-independent methods like hashing will likely suffer as dimensionality increases. Rae et al. (2016) have also independently proposed a model called SAM to use approximate search methods for memory access in NTM-like architectures. However, our motivation is different. While Rae et al. (2016) focus on architectures where the memory is written by the controller itself, we focus on handling memory access to large external knowledge bases. While both the models fix the memory access mechanism (HMN uses MIPS and SAM uses NNS), our controller works in a much more constrained setting. Moreover, our experiments suggest that the performance of SAM could be improved using a clustering-based approach as in our work, instead of tree/hash-based approaches for memory search used by SAM.
139
+
140
+ # 5 EXPERIMENTS
141
+
142
+ In this section, we report experiments on factoid question answering using hierarchical memory networks. Specifically, we use the SimpleQuestions dataset Bordes et al. (2015). The aim of these experiments is not to achieve state-of-the-art results on this dataset. Rather, we aim to propose and analyze various approaches to make memory networks more scalable and explore the achieved tradeoffs between speed and accuracy.
143
+
144
+ # 5.1 DATASET
145
+
146
+ We use SimpleQuestions (Bordes et al., 2015) which is a large scale factoid question answering dataset. SimpleQuestions consists of 108,442 natural language questions, each paired with a corresponding fact from Freebase. Each fact is a triple (subject,relation,object) and the answer to the question is always the object. The dataset is divided into training (75910), validation (10845), and test (21687) sets. Unlike Bordes et al. (2015) who additionally considered FB2M (10M facts) or FB5M (12M facts) with keyword-based heuristics for filtering most of the facts for each question, we only use SimpleQuestions, with no keyword-based heuristics. This allows us to do a direct comparison with the full softmax approach in a reasonable amount of time. Moreover, we would like to highlight that for this dataset, keyword-based filtering is a very efficient heuristic since all questions have an appropriate source entity with a matching word. Nevertheless, our goal is to design a general purpose architecture without such strong assumptions on the nature of the data.
147
+
148
+ # 5.2 MODEL
149
+
150
+ Let $V _ { q }$ be the vocabulary of all words in the natural language questions. Let $W _ { q }$ be a $| V _ { q } | * m$ matrix where each row is some $m$ dimensional embedding for a word in the question vocabulary. This matrix is initialized with random values and learned during training. Given any question, we in the question. Let represent it with a bag-of-words representation by summing the vector representation of each word $\bar { q ^ { } = } \{ w _ { i } \} _ { i = 1 } ^ { p }$ ,
151
+
152
+ $$
153
+ h ( q ) = \sum _ { i = 1 } ^ { p } W _ { q } [ w _ { i } ]
154
+ $$
155
+
156
+ Then, to find the relevant fact from the memory M, we call the $K$ -MIPS-based reader module with $h ( q )$ as the query. This uses Equation 3 and 4 to compute the output of the reader $R _ { o u t }$ . The reader is trained by minimizing the Negative Log Likelihood (NLL) of the correct fact.
157
+
158
+ $$
159
+ \mathcal { T } _ { \theta } = \sum _ { i = 1 } ^ { N } - \log ( R _ { o u t } [ f _ { i } ] )
160
+ $$
161
+
162
+ where $f _ { i }$ is the index of the correct fact in $W _ { m }$ . We are fixing the memory embeddings to the TransE (Bordes et al., 2013) embeddings and learning only the question embeddings.
163
+
164
+ This model is simpler than the one reported in (Bordes et al., 2015) so that it is esay to analyze the effect of various memory reading strategies.
165
+
166
+ # 5.3 TRAINING DETAILS
167
+
168
+ We trained the model with the Adam optimizer (Kingma & Ba, 2014), with a fixed learning rate of 0.001. We used mini-batches of size 128. We used 200 dimensional embeddings for the TransE entities, yielding 600 dimensional embeddings for facts by concatenating the embeddings of the subject, relation and object. We also experimented with summing the entities in the triple instead of concatenating, but we found that it was difficult for the model to differentiate facts this way. The only learnable parameters by the HMN model are the question word embeddings. The entity distribution in SimpleQuestions is extremely sparse and hence, following Bordes et al. (2015), we also add artificial questions for all the facts for which we do not have natural language questions. Unlike Bordes et al. (2015), we do not add any other additional tasks like paraphrase detection to the model, mainly to study the effect of the reader. We stopped training for all the models when the validation accuracy consistently decreased for 3 epochs.
169
+
170
+ # 5.4 EXACT $K$ -MIPS IMPROVES ACCURACY
171
+
172
+ In this section, we compare the performance of the full soft attention reader and exact $K$ -MIPS attention readers. Our goal is to verify that $K$ -MIPS attention is in fact a valid and useful attention mechanism and see how it fares when compared to full soft attention. For $K$ -MIPS attention, we tried $K \in \ 1 0 , 5 0 , 1 0 0 , 1 0 0 0$ . We would like to emphasize that, at training time, along with $K$ candidates for a particular question, we also add the $K$ -candidates for each question in the minibatch. So the exact size of the softmax layer would be higer than $K$ during training. In Table 1, we report the test performance of memory networks using the soft attention reader and $K$ -MIPS attention reader. We also report the average softmax size during training. From the table, it is clear that the $K$ -MIPS attention readers improve the performance of the network compared to soft attention reader. In fact, smaller the value of $K$ is, better the performance. This result suggests that it is better to use a $K$ -MIPS layer instead of softmax layer whenever possible. It is interesting to see that the convergence of the model is not slowed down due to this change in softmax computation (as shown in Figure 1).
173
+
174
+ This experiment confirms the usefulness of $K$ -MIPS attention. However, exact $K$ -MIPS has the same complexity as a full softmax. Hence, to scale up the training, we need more efficient forms of $K$ -MIPS attention, which is the focus of next experiment.
175
+
176
+ Table 1: Accuracy in SQ test-set and average size of memory used. 10-softmax has high performance while using only smaller amount of memory.
177
+
178
+ <table><tr><td>Model</td><td>Test Acc.</td><td>Avg.S Softmax Size</td></tr><tr><td>Full-softmax</td><td>59.5</td><td>108442</td></tr><tr><td>10-MIPS</td><td>62.2</td><td>1290</td></tr><tr><td>50-MIPS</td><td>61.2</td><td>6180</td></tr><tr><td>100-MIPS</td><td>60.6</td><td>11928</td></tr><tr><td>1000-MIPS</td><td>59.6</td><td>70941</td></tr><tr><td>Clustering</td><td>51.5</td><td>20006</td></tr><tr><td>PCA-Tree</td><td>32.4</td><td>21108</td></tr><tr><td>WTA-Hash</td><td>40.2</td><td>20008</td></tr></table>
179
+
180
+ ![](images/b66b6199342919484c2188a6fa67d80764976502f29b495ffa56e562b32f49e6.jpg)
181
+ Figure 1: Validation curve for various models. Convergence is not slowed down by $\mathbf { k }$ -softmax.
182
+
183
+ # 5.5 APPROXIMATE $K$ -MIPS BASED LEARNING
184
+
185
+ As mentioned previously, designing faster algorithms for $K$ -MIPS is an active area of research. Auvolat et al. (2015) compared several state-of-the-art data-dependent and data-independent methods for faster approximate $K$ -MIPS and it was found that clustering-based MIPS performs significantly better than other approaches. However the focus of the comparison was on performance during the inference stage. In HMNs, $K$ -MIPS must be used at both training stage and inference stages. To verify if the same trend can been seen during learning stage as well, we compared three different approaches:
186
+
187
+ Clustering: This was explained in detail in section 3.
188
+
189
+ WTA-Hash: Winner Takes All hashing (Vijayanarasimhan et al., 2014) is a hashing-based $K$ -MIPS algorithm which also converts MIPS to MCSS by augmenting additional dimensions to the vectors. This method used $n$ hash functions and each hash function does $p$ different random permutations of the vector. Then the prefix constituted by the first $k$ elements of each permuted vector is used to construct the hash for the vector.
190
+
191
+ PCA-Tree: PCA-Tree (Bachrach et al., 2014) is the state-of-the-art tree-based method, which converts MIPS to NNS by vector augmentation. It uses the principal components of the data to construct a balanced binary tree with data residing in the leaves.
192
+
193
+ For a fair comparison, we varied the hyper-parameters of each algorithm in such a way that the average speedup is approximately the same. Table 1 shows the performance of all three methods, compared to a full softmax. From the table, it is clear that the clustering-based method performs significantly better than the other two methods. However, performances are lower when compared to the performance of the full softmax.
194
+
195
+ As a next experiment, we analyze various the strategies proposed in Section 3.1 to reduce the approximation bias of clustering-based $K$ -MIPS:
196
+
197
+ Top-K: This strategy picks the vectors in the top $K$ clusters as candidates.
198
+
199
+ Sample-K: This strategy samples $K$ clusters, without replacement, based on a probability distribution based on the dot product of the query with the cluster centroids. When combined with the Top- $K$ strategy, we ignore clusters selected by the Top- $k$ strategy for sampling.
200
+
201
+ Rand-block: This strategy divides the memory into several blocks and uniformly samples a random block as candidate.
202
+
203
+ We experimented with 1000 clusters and 2000 clusters. While comparing various training strategies, we made sure that the effective speedup is approximately the same. Memory access to facts per query for all the models is approximately 20,000, hence yielding a 5X speedup.
204
+
205
+ Results are given in Table 2. We observe that the best approach is to combine the Top-K and SampleK strategies, with Rand-block not being beneficial. Interestingly, the worst performances correspond to cases where the Sample-K strategy is ignored.
206
+
207
+ Table 2: Accuracy in SQ test set and number of epochs for convergence.
208
+
209
+ <table><tr><td></td><td>Sample-K</td><td>rand-block</td><td>1000 clusters Test Acc.</td><td>epochs</td><td>2000 clusters Test Acc.</td><td>epochs</td></tr><tr><td>Top-K Yes</td><td>No</td><td>No</td><td>50.2</td><td>16</td><td>51.5</td><td>22</td></tr><tr><td>No</td><td>Yes</td><td>No</td><td>52.5</td><td>68</td><td>52.8</td><td>63</td></tr><tr><td>Yes</td><td>Yes</td><td>No</td><td>52.8</td><td>31</td><td>53.1</td><td>26</td></tr><tr><td>Yes</td><td>No</td><td>Yes</td><td>51.8</td><td>32</td><td>52.3</td><td>26</td></tr><tr><td>Yes</td><td>Yes</td><td>Yes</td><td>52.5</td><td>38</td><td>52.7</td><td>19</td></tr></table>
210
+
211
+ # 6 CONCLUSION
212
+
213
+ In this paper, we proposed a hierarchical memory network that exploits $K$ -MIPS for its attentionbased reader. Unlike soft attention readers, $K$ -MIPS attention reader is easily scalable to larger memories. This is achieved by organizing the memory in a hierarchical way. Experiments on the SimpleQuestions dataset demonstrate that exact $K$ -MIPS attention is better than soft attention. However, existing state-of-the-art approximate $K$ -MIPS techniques provide a speedup at the cost of some accuracy. Future research will investigate designing efficient dynamic $K$ -MIPS algorithms, where the memory can be dynamically updated during training. This should reduce the approximation bias and hence improve the overall performance.
214
+
215
+ # REFERENCES
216
+
217
+ Alex Auvolat, Sarath Chandar, Pascal Vincent, Hugo Larochelle, and Yoshua Bengio. Clustering is efficient for approximate maximum inner product search. arXiv preprint arXiv:1507.05910, 2015.
218
+
219
+ Yoram Bachrach et al. Speeding up the xbox recommender system using a euclidean transformation for inner-product spaces. RecSys ’14, pp. 257–264, 2014.
220
+
221
+ Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. Translating embeddings for modeling multi-relational data. In Advances in NIPS, pp. 2787–2795. 2013.
222
+
223
+ Antoine Bordes, Nicolas Usunier, Sumit Chopra, and Jason Weston. Large-scale simple question answering with memory networks. arXiv preprint arXiv:1506.02075, 2015.
224
+
225
+ Jesse Dodge, Andreea Gane, Xiang Zhang, Antoine Bordes, Sumit Chopra, Alexander Miller, Arthur Szlam, and Jason Weston. Evaluating prerequisite qualities for learning end-to-end dialog systems. CoRR, abs/1511.06931, 2015.
226
+
227
+ Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprint arXiv:1410.5401, 2014.
228
+
229
+ Sébastien Jean, KyungHyun Cho, Roland Memisevic, and Yoshua Bengio. On using very large target vocabulary for neural machine translation. In Proceedings of ACL,2015, pp. 1–10, 2015.
230
+
231
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014.
232
+
233
+ Ankit Kumar et al. Ask me anything: Dynamic memory networks for natural language processing. CoRR, abs/1506.07285, 2015.
234
+
235
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. In International Conference on Learning Representations, Workshop Track, 2013.
236
+
237
+ Andriy Mnih and Karol Gregor. Neural variational inference and learning in belief networks. arXiv preprint arXiv:1402.0030, 2014.
238
+
239
+ Frederic Morin and Yoshua Bengio. Hierarchical probabilistic neural network language model. In Robert G. Cowell and Zoubin Ghahramani (eds.), Proceedings of AISTATS, pp. 246–252, 2005.
240
+
241
+ Behnam Neyshabur and Nathan Srebro. On symmetric and asymmetric lshs for inner product search. In Proceedings of the 31st International Conference on Machine Learning, 2015.
242
+
243
+ Jack W Rae, Jonathan J Hunt, Tim Harley, Ivo Danihelka, Andrew Senior, Greg Wayne, Alex Graves, and Timothy P Lillicrap. Scaling memory-augmented neural networks with sparse reads and writes. In Advances in NIPS. 2016.
244
+
245
+ Parikshit Ram and Alexander G. Gray. Maximum inner-product search using cone trees. KDD ’12, pp. 931–939, 2012.
246
+
247
+ Anshumali Shrivastava and Ping Li. Asymmetric LSH (ALSH) for sublinear time maximum inner product search (MIPS). In Advances in Neural Information Processing Systems 27, pp. 2321– 2329, 2014.
248
+
249
+ Anshumali Shrivastava and Ping Li. Improved asymmetric locality sensitive hashing (alsh) for maximum inner product search (mips). In Proceedings of Conference on Uncertainty in Artificial Intelligence (UAI), 2015.
250
+
251
+ Ryan Spring and Anshumali Shrivastava. Scalable and sustainable deep learning via randomized hashing. CoRR, abs/1602.08194, 2016.
252
+
253
+ Sainbayar Sukhbaatar, Arthur Szlam, Jason Weston, and Rob Fergus. End-to-end memory networks. arXiv preprint arXiv:1503.08895, 2015.
254
+
255
+ Sudheendra Vijayanarasimhan, Jon Shlens, Rajat Monga, and Jay Yagnik. Deep networks with large output spaces. arXiv preprint arXiv:1412.7479, 2014.
256
+
257
+ Jason Weston, Antoine Bordes, Sumit Chopra, and Tomas Mikolov. Towards ai-complete question answering: a set of prerequisite toy tasks. arXiv preprint arXiv:1502.05698, 2015a.
258
+
259
+ Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. In Proceedings Of The International Conference on Representation Learning (ICLR 2015), 2015b. In Press.
260
+
261
+ Ronald J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning, 8:229–256, 1992.
262
+
263
+ Caiming Xiong, Stephen Merity, and Richard Socher. Dynamic memory networks for visual and textual question answering. CoRR, abs/1603.01417, 2016.
264
+
265
+ Wojciech Zaremba and Ilya Sutskever. Reinforcement learning neural turing machines. CoRR, abs/1505.00521, 2015.
266
+
267
+ Shi Zhong. Efficient online spherical k-means clustering. In Neural Networks, 2005. IJCNN’05. Proceedings. 2005 IEEE International Joint Conference on, volume 5, pp. 3180–3185. IEEE, 2005.
md/train/BJ46w6Ule/BJ46w6Ule.md ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DYNAMIC PARTITION MODELS
2
+
3
+ # Marc Goessling
4
+
5
+ # Yali Amit
6
+
7
+ Department of Statistics
8
+ University of Chicago
9
+ Chicago, IL 60637, USA
10
+ goessling@galton.uchicago.edu
11
+ Departments of Statistics and Computer Science
12
+ University of Chicago
13
+ Chicago, IL 60637, USA
14
+ amit@galton.uchicago.edu
15
+
16
+ # ABSTRACT
17
+
18
+ We present a new approach for learning compact and intuitive distributed representations with binary encoding. Rather than summing up expert votes as in products of experts, we employ for each variable the opinion of the most reliable expert. Data points are hence explained through a partitioning of the variables into expert supports. The partitions are dynamically adapted based on which experts are active. During the learning phase we adopt a smoothed version of this model that uses separate mixtures for each data dimension. In our experiments we achieve accurate reconstructions of high-dimensional data points with at most a dozen experts.
19
+
20
+ # 1 INTRODUCTION
21
+
22
+ We consider the task of learning a compact binary representation (e.g. Goessling & Amit, 2015). That means we are seeking a parsimonious set of experts, which can explain a given collection of multivariate data points. In contrast to most existing approaches the emphasis here is on finding experts that are individually meaningful and that have disjoint responsibilities. Ideally, each expert explains only one factor of variation in the data and for each factor of variation there is exactly one expert that focuses on it.
23
+
24
+ Formally, the experts $\mathbb { P } _ { k }$ , $k = 1 , \ldots , K$ , are probability distributions that depend on binary latent variables $\pmb { h } ( k )$ . The latent state $^ { h }$ specifies which experts are active and has to be inferred for each $D$ -dimensional data point $_ { \textbf { \em x } }$ . The active experts then define a probability distribution $\mathbb { P }$ . The goal of representation learning is to train experts such that the conditional likelihood $\mathbb { P } ( \pmb { x } | \pmb { h } )$ of the data given the latent activations is maximized.
25
+
26
+ We start by describing a simple model family, which forms the basis of our work. A partition model (Hartigan, 1990) makes use of a manually specified partitioning of the $D$ variables into subsets
27
+
28
+ $$
29
+ \{ 1 , \ldots , D \} = \bigcup _ { \ell = 1 } ^ { L } S _ { \ell } .
30
+ $$
31
+
32
+ For each subset of variables ${ \pmb x } ( S _ { \ell } ) = ( { \pmb x } ( d ) ) _ { d \in S _ { \ell } }$ there exists a separate model $\mathbb { P } _ { \ell }$ . It is then typically assumed that variables in different subsets are conditionally independent, i.e.,
33
+
34
+ $$
35
+ \mathbb { P } ( \pmb { x } | \pmb { h } ) = \prod _ { \ell = 1 } ^ { L } \mathbb { P } _ { \ell } \pmb { ( x ( S _ { \ell } ) } | \pmb { h ( \ell ) } ) .
36
+ $$
37
+
38
+ The model is completed by specifying a prior distribution $\mathbb { P } ( h )$ for the latent state $^ { h }$ . One advantage of partition models is that estimating $\mathbb { P } _ { \ell }$ from observations is straightforward, while learning expert models in general requires computationally involved procedures (Bengio et al., 2013). However, in order to be able to define a satisfactory partitioning of the variables some prior knowledge about the dependence structure is needed. For image data a common choice is to use a regular grid that divides the image into patches (e.g. Pal et al., 2002). In general, a good partitioning is characterized by providing weakly dependent subsets of variables so that the conditional independence assumption (1) is reasonable and the distribution of the latent variables is easy to model. Unfortunately, often there simply is no single fixed partitioning that works well for the whole dataset because the set of variables, which are affected by different factors of variation, might overlap. This restricts the scenarios in which partition models are useful.
39
+
40
+ In this paper we extend partition models to allow for dynamically adapting partitionings. In Section 2 we introduce the model and present an appropriate learning procedure. Related work is discussed in Section 3. Special emphasis is given to the comparison with products of experts (Hinton, 2002). Experiments on binary and real-valued data are performed in Section 4. While it is important to explain high-dimensional data points through multiple experts, our work shows that it is possible to assign the responsibility for individual variables to a single expert (rather than having all active experts speak for every variable).
41
+
42
+ # 2 DYNAMIC PARTITION MODELS
43
+
44
+ Our main proposal is to define for each expert $\mathbb { P } _ { k }$ its level of expertise $e _ { k } \in \mathbb { R } _ { + } ^ { D }$ for all variables. We can then dynamically partition the variables based on the active experts. Specifically, for each variable we employ the most reliable (active) expert
45
+
46
+ $$
47
+ \mathbb { P } ( \pmb { x } | h ) = \prod _ { d = 1 } ^ { D } \mathbb { P } _ { k ^ { \star } ( d ) } ( \pmb { x } ( d ) ) , \qquad k ^ { \star } ( d ) = \operatorname * { a r g m a x } _ { k : h ( k ) = 1 } e _ { k } ( d ) .
48
+ $$
49
+
50
+ That means, each variable ${ \pmb x } ( d )$ is explained by only a single expert $k ^ { \star } ( d )$ . The partitioning into expert supports $S _ { k } ( \pmb { h } ) = \{ d \in \{ 1 , \dots , D \} : k ^ { \star } ( d ) = k \}$ is determined dynamically based on the latent configuration $^ { h }$ . We hence call our model a dynamic partition model.
51
+
52
+ # 2.1 INFERENCE
53
+
54
+ In the inference step we try to find for each data point ${ \mathbf { } } x _ { n }$ the subset of experts $\{ k : h _ { n } ( k ) = 1 \}$ that maximizes $P ( x _ { n } \mid h _ { n } )$ . To do this, we suggest to sequentially activate the expert that most improves the likelihood, until the likelihood cannot be improved anymore. This approach is called likelihood matching pursuit (Goessling & Amit, 2015). The greedy search works well for our model because we are working with a small set of experts and each expert focuses on a rather different structure in the data. Consequently, the posterior distribution on the latent variables given ${ \pmb x } _ { n }$ is often highly peaked at a state $h _ { n }$ (note that for high-dimensional data the effect of the prior $\mathbb { P } ( h )$ is typically negligible).
55
+
56
+ # 2.2 LEARNING
57
+
58
+ In contrast to traditional approaches, which combine multiple experts for individual variables, training the experts in a dynamic partition model is trivial. Indeed, the maximum-likelihood estimates are simply the empirical averages over all observations for which the expert was responsible. For example, the expert means can be estimated from training data ${ \mathbf { } } x _ { n }$ , $n = 1 , \ldots , N$ , as
59
+
60
+ $$
61
+ \mathring { \mu } _ { k } ( d ) = \frac { \displaystyle \sum _ { n = 1 } ^ { N } \mathbb { 1 } \big \{ k _ { n } ^ { \star } ( d ) = k \big \} \pmb { x } _ { n } ( d ) } { \displaystyle \sum _ { n = 1 } ^ { N } \mathbb { 1 } \big \{ k _ { n } ^ { \star } ( d ) = k \big \} } .
62
+ $$
63
+
64
+ Here, $k _ { n } ^ { \star } ( d )$ denotes the expert with the highest level of expertise $e _ { k } ( d )$ among all experts $k$ with $h _ { n } ( k ) \ddot { = 1 }$ .
65
+
66
+ # 2.2.1 EXPERTISE-WEIGHTED COMPOSITION
67
+
68
+ In order to compute the estimator in (3) the levels of expertise $_ { e _ { k } }$ have to be known. Since in this paper we are trying to train the experts as well as the associated levels of expertise we consider a smoothing of the maximum-expertise composition (2) to motivate our learning procedure. Rather than using the expert with the highest level of expertise, we form a mixture of the active experts, where the mixture weight is proportional to the level of expertise. Thus, the smoothed composition
69
+
70
+ rule is
71
+
72
+ $$
73
+ \widetilde { \mathbb { P } } ( { \pmb x } | h ) = \prod _ { d = 1 } ^ { D } \sum _ { k = 1 } ^ { K } r _ { k } ( d ) \mathbb { P } _ { k } ( { \pmb x } ( d ) ) , \qquad { \pmb r } _ { k } ( d ) = \left\{ \begin{array} { l l } { \frac { e _ { k } ( d ) } { \sum _ { k ^ { \prime } : h ( k ^ { \prime } ) = 1 } e _ { k ^ { \prime } } ( d ) } } & { \mathrm { i f ~ } h ( k ) = 1 } \\ { 0 } & { \mathrm { i f ~ } h ( k ) = 0 } \end{array} \right. .
74
+ $$
75
+
76
+ In contrast to classical mixture models (e.g. McLachlan & Peel, 2004) we use different mixture weights for each dimension $d \in \{ 1 , \ldots , D \}$ . The mixture weight $\pmb { r } _ { k } ( d )$ is the degree of responsibility of $k$ -th expert for the $d$ -th dimension and depends on the latent state $^ { h }$ . An expert with a medium level of expertise assumes full responsibility if no other reliable expert is present and takes on a low degree of responsibility if experts with a higher level of expertise are present.
77
+
78
+ According to the total variance formula
79
+
80
+ $$
81
+ \mathbb { V } [ \mathbb { P } ] = \mathbb { E } _ { \pmb { r } _ { k } } [ \mathbb { V } [ \mathbb { P } _ { k } ] ] + \mathbb { V } _ { \pmb { r } _ { k } } [ \mathbb { E } [ \mathbb { P } _ { k } ] ]
82
+ $$
83
+
84
+ the variance of a mixture is always larger than the smallest variance of its components. In other words, the precision of the smoothed model is maximized when all the mixture weight (individually for each dimension) is concentrated on the most precise expert. We can thus learn a dynamic partition model in an EM manner (Dempster et al., 1977) by interleaving inference steps with updates of the experts and levels of expertise in the smoothed model.
85
+
86
+ # 2.2.2 EXPERT UPDATE
87
+
88
+ The sequential inference procedure (from Section 2.1) provides for each data point ${ \mathbf { } } x _ { n }$ the latent representation $h _ { n }$ . We denote the corresponding expert responsibilities (using the current estimates for the level of expertise) by ${ \bf \nabla } r _ { n k }$ . The smooth analog to the hard update equation (3) is a responsibilityweighted average of the training samples
89
+
90
+ $$
91
+ \mu _ { k } ( d ) = \frac { \displaystyle \sum _ { n = 1 } ^ { N } r _ { n k } ( d ) \pmb { x _ { n } } ( d ) + \epsilon \pmb { \mu _ { 0 } } } { \displaystyle \sum _ { n = 1 } ^ { N } r _ { n k } ( d ) + \epsilon } .
92
+ $$
93
+
94
+ For stability we added a term that shrinks the updated templates towards some target $\pmb { \mu _ { 0 } }$ if the total responsibility of the expert is small. In our experiments we set ${ \boldsymbol { \mu } } _ { \mathbf { 0 } }$ to the average of all training examples. The update rule implies that the experts have local supports, in the sense that they are uninformative about variables for which they are not responsible.
95
+
96
+ For binary data the mean templates $\mu _ { k }$ are all we need. Continuous data $\pmb { x } \in \mathbb { R } ^ { D }$ is modeled through Gaussians and hence we also have to specify the variance ${ \boldsymbol { v } } _ { k }$ of the experts. We again use a responsibility-weighted average
97
+
98
+ $$
99
+ { v _ { k } } ( d ) = \frac { \displaystyle \sum _ { n = 1 } ^ { N } r _ { n k } ( d ) ( { \pmb x } _ { n } ( d ) - { \pmb \mu } _ { k } ( d ) ) ^ { 2 } + \epsilon { \pmb v } _ { 0 } } { \displaystyle \sum _ { n = 1 } ^ { N } r _ { n k } ( d ) + \epsilon } ,
100
+ $$
101
+
102
+ where ${ \pmb v _ { 0 } }$ is the empirical variance of all training samples.
103
+
104
+ # 2.2.3 EXPERTISE UPDATE
105
+
106
+ We now turn to the updates of the levels of expertise. The log-likelihood of the smoothed model (4) as a function of $e _ { k }$ is rather complex. Using gradient descent is thus problematic because the derivatives with respect to $e _ { k }$ can have very different scales, which makes it difficult to choose an appropriate learning rate and hence the convergence could be slow. However, exact optimization is not necessary because in the end only the order of the levels of expertise matters. Consequently, we propose to adjust $e _ { k } ( d )$ only based on the sign of the gradient. We simply multiply or divide the current value by a constant $C$ . If the gradient is very close to 0 we leave $e _ { k } ( d )$ unchanged. For all our experiments we used $C = 2$ . Larger values can speed up the convergence but sometimes lead to a worse solution. Using an exponential decay is common practice when learning levels of expertise (e.g. Herbster & Warmuth, 1998).
107
+
108
+ In the learning procedure we perform the expertise update first. We then recompute the responsibilities using these new levels of expertise and update the experts. Our algorithm typically converges after about 10 iterations.
109
+
110
+ # 3 RELATED WORK
111
+
112
+ Herbster & Warmuth (1998) proposed an algorithm for tracking the best expert in a sequential prediction task. In their work it is assumed that a linear ordering of the variables is known such that the expert with the highest level of expertise is constant on certain segments. In contrast to that, our approach can be applied to an arbitrary permutation of the variables. Moreover, they consider a single sequence of variables with a fixed partitioning into experts supports. In our setup the partitioning changes dynamically depending on the observed sample. However, the greatest difference to our work is that Herbster & Warmuth (1998) do not learn the individual experts but only focus on training the levels of expertise.
113
+
114
+ Lucke & Sahani ¨ (2008) studied a composition rule that also partitions the variables into expert supports. In their model the composed template is simply the maximum of the experts templates $\mu _ { k }$ . This rule is only useful in special cases. A generalization, in which the composition depends on the maximum and the minimum of the expert templates $\mu _ { k } ( d )$ , was considered by Goessling & Amit (2015). While the motivation for that rule was similar, the maximum-expertise rule in this paper is more principled and can be applied to continuous data.
115
+
116
+ In the work by Amit & Trouve´ (2007) a simple average (i.e., an equal mixture) of the individual templates was used. With such a composition rule, all experts are equally responsible for each of the variables and hence specialization on local structures is not possible. To circumvent this problem, in their work $e _ { k } ( d )$ was manually set to 1 for some subset of the dimensions (depending on a latent shift variable) and to 0 elsewhere.
117
+
118
+ A popular model family with latent binary representation are products of experts (Hinton, 2002). In such a model the individual distributions $\mathbb { P } _ { k }$ are multiplied together and renormalized. Computation of the normalizing constant is in general intractable though. A special case, in which an explicit normalization is possible, are restricted Boltzmann machines (Hinton, 2002). In these models the experts are product Bernoulli distributions with templates $\mu _ { k } \in [ 0 , 1 ] ^ { D }$ . The composed distribution is then also a product Bernoulli distribution with composed template
119
+
120
+ $$
121
+ \begin{array} { r } { \pmb { \mu } _ { \mathrm { R B M } } ( d ) = \sigma \left( \sum _ { k : h ( k ) = 1 } \pmb { w } _ { k } ( d ) \right) , } \end{array}
122
+ $$
123
+
124
+ where the weights ${ \pmb w } _ { \pmb k } ( d ) = \log ( { \pmb \mu } _ { \pmb k } ( d ) / ( 1 - { \pmb \mu } _ { \pmb k } ( d ) ) \in \mathbb { R }$ are the log-odds of the experts and $\sigma ( t ) = ( 1 + \exp ( - t ) ) ^ { - 1 }$ is the logistic function. This sum-of-log-odds composition rule arises naturally from generalized linear models for binary data because the log-odds are the canonical parameter of the Bernoulli family. In a product of experts, the variance of the composition is usually smaller than the smallest variance of the experts. As a consequence, products of experts tend to employ many experts for each dimension (for more details on this issue see Goessling & Amit (2015)). Even with an L1-penalty on the votes ${ \pmb w } _ { { \pmb k } } ( d )$ the responsibility for individual variables ${ \pmb x } ( d )$ is typically still shared among many experts. The reason for this is that under the constraint $\begin{array} { r } { \sum _ { k } { \boldsymbol { w } } _ { \boldsymbol { k } } ( d ) = { \boldsymbol { w } } ( d ) } \end{array}$ the quantity $\textstyle \sum _ { k } | w _ { k } ( d ) |$ is minimized whenever ${ \pmb w } _ { \pmb k } ( d )$ has the same sign for all $k$ . The usual inference procedure for products of experts independently activates experts based on their inner product with the data point. In particular, not just the most probable expert configuration is determined but the whole posterior distribution on latent states given the data is explored through Monte Carlo methods. For learning in products of experts, simple update rules like (5) and (6) cannot be used because for each expert the effects of all other experts have to be factored out. Dynamic partition models essentially decompose the expert votes $\pmb { w } _ { k }$ into expert opinions $\mu _ { k }$ and levels of expertise $e _ { k }$ . Apart from the computational advantages for learning, this introduces an additional degree of flexibility because the expert supports are adjusted depending on which other experts are present (cf. Figure 5). Moreover, the decomposition into opinions and levels of expertise avoids ambiguities. For example, a vote ${ \pmb w } _ { \pmb k } ( d ) \approx 0$ could mean that $\mu _ { k } ( d ) \approx 1 / 2$ or that $\bar { e _ { k } ( d ) } \approx 0$ .
125
+
126
+ Another common model for representation learning are autoencoders (Vincent et al., 2008), which can be considered as mean-field approximations of restricted Boltzmann machines that use latent variables $\displaystyle h ( k )$ with values in $[ 0 , 1 ]$ . To obtain a sparse representation a penalty on the number of active experts can be added $( \mathrm { N g } , 2 0 1 1 )$ ). Such approaches are also known as sparse dictionaries (e.g., Elad, 2010) and are based on opinion pools of the form $\begin{array} { r } { \sum _ { k } h ( k ) w _ { k } ( d ) } \end{array}$ . The strength of the sparsity penalty is an additional tuning parameter which has to be tuned. In dynamic partition models sparse activations are inherent. In the next section, we experimentally compare products of experts, autoencoders and sparse dictionaries to our proposed model.
127
+
128
+ ![](images/f59e7097b4924e3f977d4d06826d4e2856d7b4228ca0a4275485a982bdc0af51.jpg)
129
+ Figure 1: Expert training for the synthetic dataset. Each panel shows the probabilities (white/black corresponds to $\mu _ { k } ( d ) = 0 / 1 \rangle$ of the 10 experts (rows) for the 10 dimensions (columns). 1st panel: Random initialization. 2nd-4th panel: Our learning procedure after 3/5/15 iterations.
130
+
131
+ ![](images/02d6de2310bf0a201411bf6152906617d129961005914ac13f034c1d48d8cf62.jpg)
132
+ Figure 2: Trained experts for the synthetic data after 1,000 iterations using an autoencoder (1st panel), a sparse dictionary (2nd panel) and a restricted Boltzmann machine (3rd panel).
133
+
134
+ # 4 EXPERIMENTS
135
+
136
+ # 4.1 SYNTHETIC DATA
137
+
138
+ We consider a synthetic example and try to learn the underlying factors of variation. The dataset consists of the 32-element subset $\{ ( 0 , \bar { 1 } ) , ( 1 , 0 ) \} ^ { 5 } \subset \{ 0 , 1 \bar \} ^ { 1 0 }$ . Note that there are 5 factors of variation corresponding to the state of the pairs $( { \pmb x } ( 2 \ell { - } 1 ) , { \pmb x } ( 2 \ell ) )$ for $\ell = 1 , \ldots , 5$ with the two factor levels $( 0 , 1 )$ and $( 1 , 0 )$ . Indeed, the distribution can be easily expressed through a partition model with partitioning
139
+
140
+ $$
141
+ \{ 1 , 2 \} \cup \{ 3 , 4 \} \cup \{ 5 , 6 \} \cup \{ 7 , 8 \} \cup \{ 9 , 1 0 \}
142
+ $$
143
+
144
+ and corresponding models
145
+
146
+ $$
147
+ \begin{array} { r } { \mathbb { P } _ { \ell } ( \pmb { x } ( 2 \ell - 1 ) , \pmb { x } ( 2 \ell ) ) = \frac { 1 } { 2 } \cdot \mathbb { 1 } \{ \pmb { x } ( 2 \ell - 1 ) = 0 , \pmb { x } ( 2 \ell ) = 1 \} + \frac { 1 } { 2 } \cdot \mathbb { 1 } \{ \pmb { x } ( 2 \ell - 1 ) = 1 , \pmb { x } ( 2 \ell ) = 0 \} . } \end{array}
148
+ $$
149
+
150
+ We show that our dynamic partition model is able to learn these factors of variation without requiring a manual specification of the partitioning. Here, the total number of experts we need to accurately reconstruct all data points happens to be equal to the number of dimensions. However, in other cases the number of required experts could be smaller or larger than $D$ . We ran our learning algorithm for 15 iterations starting from a random initialization of the experts. The resulting templates after 3, 5 and 15 iterations are shown in Figure 1. We see that each of the final experts specializes in exactly two dimensions $d$ and $d + 1$ . Its opinion for these variables are close to 0 and 1, respectively, while the opinions for the remaining variables are about $1 / 2$ . Every data point can now be (almost) perfectly reconstructed by using exactly 5 of these experts.
151
+
152
+ For comparison we trained various other models with 10 experts, which use a sum-of-log-odds composition. We first tried an autoencoder (Vincent et al., 2008), which in principle could adopt the identity map because it uses (in contrast to our model) a bias term for the observable and latent variables. However, the gradient descent learning algorithm with tuned step size yielded a different representation (Figure 2, 1st panel). While the reconstruction errors are rather low, they are clearly nonzero and the factors of variations have not been disentangled. Next, we considered a dictionary with a sparse representation (e.g., Elad, 2010). The sparsity penalty was adjusted so that the average number of active dictionary elements was around 5. The learning algorithm again yielded highly dependent experts (Figure 2, 2nd panel). Finally, we trained a restricted Boltzmann machine through batch persistent contrastive divergence (Tieleman, 2008) using a tuned learning rate. Note that a restricted Boltzmann machine in principle only requires 5 experts to model the data appropriately because it uses bias terms. However, we again learned 10 experts (Figure 2, 3rd panel). While the results look better than for the previous two models they are still far from optimal. In earlier work Goessling & Amit (2015) we performed a quantitative comparison for a similar dataset, which showed that the reconstruction performance of models with sum-of-log-odds composition is indeed suboptimal.
153
+
154
+ ![](images/5216866f4080e7fa86f1055bff378d9511869454c6d570608de2e6193fd6639e.jpg)
155
+ Figure 3: Trained experts for MNIST digits. Left: Expert probabilities (white/black corresponds to $\bar { \mu _ { k } ( d ) } = 0 / 1 \dot { . }$ ). Right: Levels of expertise (blue/red corresponds to small/large values).
156
+
157
+ ![](images/62d9a1080162f04e22a4e7ff25dfd6e533a86ae634df2772b0e8f6e566fc33c0.jpg)
158
+ Figure 4: Reconstruction of MNIST test examples using likelihood matching pursuit. Each column visualizes the composed Bernoulli templates during the sequential inference procedure (top down) for one sample. The bottom row are the original data points.
159
+
160
+ # 4.2 MNIST DIGITS
161
+
162
+ We now consider the MNIST digits dataset (LeCun et al., 1998), which consists of 60,000 training samples and 10,000 test samples of dimension $2 8 \times 2 8 = 7 8 4$ . We ran our learning algorithm for 10 iterations and trained 100 experts (Figure 3). We see that some experts specialize on local structures while others focus on more global ones. In Figure 4 we visualize the inference procedure for some test samples using these 100 learned experts. On average 12 experts were activated for each data point. For easier visualization we show at most 10 iterations of the likelihood matching pursuit algorithm. The reconstructions are overall accurate and peculiarities of the samples are smoothed out. In Figure 5 we illustrate how the expert supports change based on the latent representation. Depending on which other experts are present the supports can vary quite a bit.
163
+
164
+ ![](images/609f7098b415ad53343fbe0f35f3435a37561302fbc9257e6b8073eaad897d14.jpg)
165
+ Figure 5: Dynamic supports for 5 MNIST experts. Left column: Expert probabilities. Remaining columns: Composed Bernoulli templates for 10 latent configurations. The cast opinion of the expert is shown in shades of red (white/red corresponds to $\mu _ { k } ( d ) = 0 / 1$ ).
166
+
167
+ ![](images/e75d9a39438ef5bcf76d459068827e4ec9911ab05c98e94d81b81c08ba514359.jpg)
168
+ Figure 6: Trained experts for Weizmann horses. Left: Expert probabilities (white/black corresponds to $\mathbf { \bar { \mu } } _ { k } ( d ) = 0 / 1 ,$ ). Right: Levels of expertise (blue/red corresponds to small/large values).
169
+
170
+ # 4.3 WEIZMANN HORSES
171
+
172
+ The following experiment shows that our model is able to cope with very high-dimensional data. The Weizmann horse dataset (Borenstein & Ullman, 2008) consists of 328 binary images of size $2 0 0 \times 2 4 0$ . We used the first 300 images to train 20 experts (Figure 6) and used the remaining 28 images for testing. Some of the experts are responsible for the background and the central region of the horse while other experts focus on local structures like head posture, legs and tail. In Figure 7 we illustrate the partitioning of the test examples into expert opinions. For simplicity we used exactly 4 experts to reconstruct each sample. Not all characteristics of the samples are perfectly reconstructed but the general pose is correctly recovered. The same dataset was used to evaluate the shape Boltzmann machine (Eslami et al., 2014), where 2,000 experts were learned. For those experiments the images were downsampled to $3 2 \times 3 2$ pixels. This is a factor 50 smaller than the full resolution of 48,000 dimensions that we use.
173
+
174
+ ![](images/cb8e08d7ce07cc51fa5e5a5f318060fef614a3e17facba3b715183f0d86192c1.jpg)
175
+ Figure 7: Decomposition of the test examples from the Weizmann horse dataset. 1st column: Original data points. 2nd column: Reconstructions (shown are the composed Bernoulli templates). 3rd-6th column: Partitioning into experts opinions (white/black corresponds to $\mu _ { k } ( d ) = 0 / 1$ , gray indicates regions for which the expert is not responsible).
176
+
177
+ ![](images/85b35271a4e848799510c042732605283cc46fb75380b281457881b19cf1b3f0.jpg)
178
+ Figure 8: Reconstructions of the test examples from the Caltech motorcycle dataset. Odd rows: Original data. Even rows: Reconstructions (shown are the composed Gaussian means).
179
+
180
+ # 4.4 CALTECH MOTORCYCLES
181
+
182
+ We also experimented with real-valued data using the Caltech-101 motorcycle dataset (Fei-Fei et al., 2007), which consists of 798 images of size $1 0 0 \times 1 8 0$ . The first 750 images were used for training and the remaining 48 images for testing. We trained 50 experts by running our learning procedure for 10 iterations. In Figure 8 we visualize the reconstructed test examples. The reconstructions are a bit blurry since we use a fairly sparse binary representation. Indeed, for each data point on average only 7 experts were employed. Note that the shapes of the motorcycles are reconstructed quite accurately.
183
+
184
+ # 5 DISCUSSION
185
+
186
+ In order to improve the reconstructions for continuous image data we could use real-valued latent variables in addition to binary ones (as in Hinton et al. (1998)). This would allow us to model intensities and contrasts more accurately. The inference procedure would have to be adapted accordingly such that continuous activations can be returned.
187
+
188
+ Our work focused on product distributions. In order to apply the proposed approach to models with dependence structure one can make use of an autoregressive decomposition (e.g., Goessling & Amit, 2016). If the joint distribution is written as a product of conditional distributions then we can employ the same composition rule as before. Indeed, we can model composed the conditionals as
189
+
190
+ $$
191
+ \mathbb { P } ( \pmb { x } ( d ) | \pmb { x } ( 1 { : } d - 1 ) , \pmb { h } ) = \mathbb { P } _ { k ^ { \star } ( d ) } ( \pmb { x } ( d ) | \pmb { x } ( 1 { : } d - 1 ) ) ,
192
+ $$
193
+
194
+ where $\mathbb { P } _ { k }$ are autoregressive expert models and $k ^ { \star } ( d )$ is the active expert with the highest level of expertise for dimension $d$ .
195
+
196
+ # REFERENCES
197
+
198
+ Yali Amit and Alain Trouve. Pop: Patchwork of parts models for object recognition. ´ International Journal of Computer Vision, 75(2):267–282, 2007.
199
+
200
+ Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE transactions on pattern analysis and machine intelligence, 35(8):1798–1828, 2013.
201
+
202
+ Eran Borenstein and Shimon Ullman. Combined top-down/bottom-up segmentation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 30(12):2109–2125, 2008.
203
+
204
+ Arthur P Dempster, Nan M Laird, and Donald B Rubin. Maximum likelihood from incomplete data via the em algorithm. Journal of the Royal Statistical Society. Series B (methodological), pp. 1–38, 1977.
205
+
206
+ Michael Elad. Sparse and redundant representations. Springer, 2010.
207
+
208
+ SM Ali Eslami, Nicolas Heess, Christopher KI Williams, and John Winn. The shape boltzmann machine: a strong model of object shape. International Journal of Computer Vision, 107(2): 155–176, 2014.
209
+
210
+ Li Fei-Fei, Rob Fergus, and Pietro Perona. Learning generative visual models from few training examples: An incremental bayesian approach tested on 101 object categories. Computer Vision and Image Understanding, 106(1):59–70, 2007.
211
+
212
+ Marc Goessling and Yali Amit. Compact compositional models. In International Conference on Learning Representations (Workshop), 2015. URL http://arxiv.org/abs/1412.3708.
213
+
214
+ Marc Goessling and Yali Amit. Mixtures of sparse autoregressive networks. In International Conference on Learning Representations (Workshop), 2016. URL http://arxiv.org/abs/ 1511.04776.
215
+
216
+ John A Hartigan. Partition models. Communications in statistics-Theory and methods, 19(8):2745– 2756, 1990.
217
+
218
+ Mark Herbster and Manfred K Warmuth. Tracking the best expert. Machine Learning, 32(2):151– 178, 1998.
219
+
220
+ Geoffrey E Hinton. Training products of experts by minimizing contrastive divergence. Neural computation, 14(8):1771–1800, 2002.
221
+
222
+ Geoffrey E Hinton, Brian Sallans, and Zoubin Ghahramani. A hierarchical community of experts. In Learning in graphical models, pp. 479–494. 1998.
223
+
224
+ 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.
225
+
226
+ Jorg L ¨ ucke and Maneesh Sahani. Maximal causes for non-linear component extraction. ¨ The Journal of Machine Learning Research, 9:1227–1267, 2008.
227
+
228
+ Geoffrey McLachlan and David Peel. Finite mixture models. John Wiley & Sons, 2004.
229
+
230
+ Andrew Ng. Sparse autoencoder. CS294A Lecture Notes, 72:1–19, 2011.
231
+
232
+ Chris Pal, Brendan J Frey, and Nebojsa Jojic. Learning montages of transformed latent images as representations of objects that change in appearance. In Computer Vision–ECCV, pp. 715–731. 2002.
233
+
234
+ Tijmen Tieleman. Training restricted boltzmann machines using approximations to the likelihood gradient. In International Conference on Machine learning, pp. 1064–1071, 2008.
235
+
236
+ Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoine Manzagol. Extracting and composing robust features with denoising autoencoders. In International Conference on Machine Learning, pp. 1096–1103, 2008.
237
+
238
+ # 6 DERIVATIVES
239
+
240
+ We provide here the derivatives of the log-likelihood in the expertise-weighted compositional model (4) with respect to the expert parameters.
241
+
242
+ # 6.1 BERNOULLI MODEL
243
+
244
+ The Bernoulli log-likelihood is
245
+
246
+ $$
247
+ f ( \mu ) = x \log \mu + ( 1 - x ) \log ( 1 - \mu ) ,
248
+ $$
249
+
250
+ where the composition rule for the probability is
251
+
252
+ $$
253
+ \mu = \sum _ { k } r _ { k } \mu _ { k } , \quad r _ { k } = \frac { e _ { k } } { \sum _ { k ^ { \prime } } e _ { k ^ { \prime } } } .
254
+ $$
255
+
256
+ # 6.1.1 DERIVATIVES WITH RESPECT TO THE COMPOSED PROBABILITY
257
+
258
+ The first and second derivative of the log-likelihood with respect to the composed probability are
259
+
260
+ $$
261
+ { \frac { d f } { d \mu } } = { \frac { x } { \mu } } - { \frac { 1 - x } { 1 - \mu } } = { \frac { x - \mu } { \mu ( 1 - \mu ) } } ,
262
+ $$
263
+
264
+ $$
265
+ \frac { d ^ { 2 } f } { d \mu ^ { 2 } } = - \frac { x } { \mu ^ { 2 } } - \frac { 1 - x } { ( 1 - \mu ) ^ { 2 } } = - \frac { ( x - \mu ) ^ { 2 } } { \mu ^ { 2 } ( 1 - \mu ) ^ { 2 } } .
266
+ $$
267
+
268
+ 6.1.2 DERIVATIVES WITH RESPECT TO THE EXPERT PROBABILITIES
269
+
270
+ The first and second derivative of the composed probability with respect to the expert probabilities are
271
+
272
+ $$
273
+ \frac { d \mu } { d \mu _ { k } } = r _ { k } , \quad \frac { d ^ { 2 } \mu } { d \mu _ { k } ^ { 2 } } = 0 .
274
+ $$
275
+
276
+ Consequently, the derivatives of the log-likelihood with respect to the expert probabilities are
277
+
278
+ $$
279
+ { \frac { d f } { d \mu _ { k } } } = { \frac { d f } { d \mu } } \cdot { \frac { d \mu } { d \mu _ { k } } } = r _ { k } { \frac { x - \mu } { \mu ( 1 - \mu ) } } ,
280
+ $$
281
+
282
+ $$
283
+ { \frac { d ^ { 2 } f } { d \mu _ { k } ^ { 2 } } } = { \frac { d ^ { 2 } f } { d \mu ^ { 2 } } } \cdot \left( { \frac { d \mu } { d \mu _ { k } } } \right) ^ { 2 } + { \frac { d f } { d \mu } } \cdot { \frac { d ^ { 2 } \mu } { d \mu _ { k } ^ { 2 } } } = - r _ { k } ^ { 2 } { \frac { ( x - \mu ) ^ { 2 } } { \mu ^ { 2 } ( 1 - \mu ) ^ { 2 } } } .
284
+ $$
285
+
286
+ We see that $d ^ { 2 } f / d \mu _ { k } ^ { 2 } < 0$ for $\mu \in ( 0 , 1 )$ , i.e., the log-likelihood is a strictly concave function of $\mu _ { k }$
287
+
288
+ # 6.1.3 DERIVATIVE WITH RESPECT TO THE LEVELS OF EXPERTISE
289
+
290
+ The derivative of the composed probability with respect to the levels of expertise is
291
+
292
+ $$
293
+ { \frac { d \mu } { d e _ { k } } } = { \frac { \mu _ { k } E - \sum e _ { k ^ { \prime } } \mu _ { k ^ { \prime } } } { E ^ { 2 } } } = { \frac { \mu _ { k } - \mu } { E } } ,
294
+ $$
295
+
296
+ where $\begin{array} { r } { E = \sum _ { k ^ { \prime } } e _ { k ^ { \prime } } } \end{array}$ . The derivative of the log-likelihood with respect to the levels of expertise can be computed as
297
+
298
+ $$
299
+ { \frac { d f } { d e _ { k } } } = { \frac { d f } { d \mu } } \cdot { \frac { d \mu } { d e _ { k } } } .
300
+ $$
301
+
302
+ # 6.2 GAUSSIAN MODEL
303
+
304
+ The Gaussian log-likelihood is
305
+
306
+ $$
307
+ f ( \mu , v ) = - \frac { ( x - \mu ) ^ { 2 } } { 2 v } - \frac { 1 } { 2 } \log ( v ) - \frac { 1 } { 2 } \log ( 2 \pi ) ,
308
+ $$
309
+
310
+ where the composition rules for the mean and variance are
311
+
312
+ $$
313
+ \mu = \sum _ { k } r _ { k } \mu _ { k } , \quad v = \sum _ { k } r _ { k } ( v _ { k } + \mu _ { k } ^ { 2 } ) - \mu ^ { 2 } , \quad r _ { k } = \frac { e _ { k } } { \sum _ { k ^ { \prime } } e _ { k ^ { \prime } } } .
314
+ $$
315
+
316
+ # 6.2.1 DERIVATIVE WITH RESPECT TO THE COMPOSED MEAN AND VARIANCE
317
+
318
+ The derivative of the log-likelihood with respect to the composed mean and variance are
319
+
320
+ $$
321
+ { \frac { d f } { d \mu } } = { \frac { x - \mu } { v } } , \quad { \frac { d f } { d v } } = { \frac { ( x - \mu ) ^ { 2 } } { 2 v ^ { 2 } } } - { \frac { 1 } { 2 v } } = { \frac { ( x - \mu ) ^ { 2 } - v } { 2 v ^ { 2 } } } .
322
+ $$
323
+
324
+ 6.2.2 DERIVATIVE WITH RESPECT TO THE LEVELS OF EXPERTISE
325
+
326
+ The derivative of the composed mean and variance with respect to the levels of expertise are
327
+
328
+ $$
329
+ { \frac { d \mu } { d e _ { k } } } = { \frac { \mu _ { k } E - \sum e _ { k ^ { \prime } } \mu _ { k ^ { \prime } } } { E ^ { 2 } } } = { \frac { \mu _ { k } - \mu } { E } } ,
330
+ $$
331
+
332
+ $$
333
+ { \frac { d v } { d e _ { k } } } = { \frac { q _ { k } E - \sum e _ { k ^ { \prime } } q _ { k ^ { \prime } } } { E ^ { 2 } } } - 2 \mu { \frac { d \mu } { d e _ { k } } } = { \frac { q _ { k } - q } { E } } - 2 \mu { \frac { \mu _ { k } - \mu } { E } } = { \frac { v _ { k } - v + ( \mu _ { k } - \mu ) ^ { 2 } } { E } } ,
334
+ $$
335
+
336
+ where $\begin{array} { r } { E = \sum _ { k ^ { \prime } } e _ { k ^ { \prime } } } \end{array}$ and $q _ { k } = v _ { k } + \mu _ { k } ^ { 2 }$ , $q = v + \mu ^ { 2 }$ . The derivative of the log-likelihood with respect to the levels of expertise can be computed as
337
+
338
+ $$
339
+ { \frac { d f } { d e _ { k } } } = { \frac { d f } { d \mu } } \cdot { \frac { d \mu } { d e _ { k } } } + { \frac { d f } { d v } } \cdot { \frac { d v } { d e _ { k } } } .
340
+ $$
341
+
342
+ # 7 NUMERICAL OPTIMIZATION
343
+
344
+ For binary data, the log-likelihood of the smoothed model is a concave function of $\mu _ { k } ( d )$ , see Section 6.1.2. We could therefore in principal perform an optimization for the experts opinions using Newton’s method. There are a few complications though. One problem is that the second derivative is proportional to the squared responsibility and hence close to 0 if the level of expertise is small. Consequently, template updates in regions with low expertise would be unstable. To deal with that we could add a penalty on the squared log-odds for example. Another problem is that the Newton steps may lead to probability estimates outside of $[ 0 , 1 ]$ . This can be dealt with by pulling the estimates back into the unit interval. Note that working on the log-odds scale is not possible because the log-likelihood of our model is not concave in the expert log-odds. Because of these complications we use the simple, fast and robust heuristic (5) instead of Netwon’s method.
md/train/BJe1E2R5KX/BJe1E2R5KX.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/BJlAzTEKwS/BJlAzTEKwS.md ADDED
@@ -0,0 +1,383 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ATTRACTION-REPULSION ACTOR-CRITIC FOR CONTINUOUS CONTROL REINFORCEMENT LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ In reinforcement learning, robotic control tasks are often useful for understanding how agents perform in environments with deceptive rewards where the agent can easily become trapped into suboptimal solutions. One way to avoid these local optima is to use a population of agents to ensure coverage of the policy space (a form of exploration), yet learning a population with the “best” coverage is still an open problem. In this work, we present a novel approach to population-based RL in continuous control that leverages properties of normalizing flows to perform attractive and repulsive operations between current members of the population and previously observed policies. Empirical results on the MuJoCo suite demonstrate a high performance gain for our algorithm compared to prior work, including Soft-Actor Critic (SAC).
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Many important reinforcement learning (RL) tasks, such as those in robotics and self-driving cars, are challenging due to large action and state spaces (Lee et al., 2018). In particular, environments with large continuous action spaces are prone to deceptive rewards, i.e. fall into local optima in learning (Conti et al., 2018). Applying traditional policy optimization algorithms to these domains often leads to locally optimal, yet globally sub-optimal policies. The agent should then explore the reward landscape more thoroughly in order to avoid falling into these local optima.
12
+
13
+ Not all RL domains that require exploration are suitable for understanding how to train agents that are robust to deceptive rewards. For example, Montezuma’s Revenge, a game in the Atari Learning Environment (Bellemare et al., 2013), has sparse rewards; algorithms that perform the best on this task encourage exploration by providing a denser intrinsic reward to the agent to encourage exploration (Tang et al., 2017). On the other hand, many robotic control problems, such as those found in MuJoCo (Todorov et al., 2012), provide the agent with a dense reward signal, yet their high-dimensional action spaces induce a multimodal, often deceptive, reward landscape. For example, in the biped environments, coordinating both arms and legs is crucial for performing well on even simple tasks such as forward motion. However, simply learning to maximize the reward can be detrimental across training: agents will tend to run and fall further away from the start point rather than discovering stable and efficient walking motion. In this setting, exploration serves to provide a more reliable learning signal for the agent by covering more different types of actions during learning.
14
+
15
+ One way to maximize action space coverage is the maximum entropy RL framework (Ziebart, 2010), which prevents variance collapse by adding a policy entropy auxiliary objective. One such prominent algorithm, Soft Actor-Critic (SAC,Haarnoja et al. (2018)), has been shown to excel in large continuous action spaces. To further improve on exploration properties of SAC, one can maintain a population of agents that cover non-identical sections of the policy space. To prevent premature convergence, a diversity-preserving mechanism is typically put in place; balancing the objective and the diversity term becomes key to converging to a global optimum (Hong et al., 2018). This paper studies a particular family of population-based exploration methods, which conduct coordinated local search in the policy space. Prior work on population-based strategies improves performance on robotic control domains through stochastic perturbation on a single actor’s parameter (Pourchot & Sigaud, 2019) or a set of actor’s parameters (Conti et al., 2018; Khadka & Tumer, 2018; Liu et al., 2017). We hypothesize that exploring directly in the policy space will be more effective than perturbing the parameters of the policy, as the latter does not guarantee diversity (i.e., different neural network parameterizations can approximately represent the same function).
16
+
17
+ Given a population of RL agents, we enforce local exploration using an Attraction-Repulsion (AR) mechanism. The later consists in adding an auxiliary loss to encourage pairwise attraction or repulsion between members of a population, as measured by a divergence term. We make use of the KullbackLeibler (KL) divergence because of its desirable statistical properties and its easiness of computation. However, naively maximizing the KL term between two Gaussian policies can be detrimental (e.g. drives both means apart). Because of this, we parametrize the policy with a general family of distributions called Normalizing Flows (NFs, Rezende & Mohamed, 2015); this modification allows to improve upon $\mathrm { \bf A R + }$ Gaussian (see Appendix Figure 6). NFs are shown to improve the expressivity of the policies using invertible mappings while maintaining entropy guarantees (Mazoure et al., 2019; Tang & Agrawal, 2018). Nonlinear density estimators have also been previously used for deep RL problems in contexts of distributional RL (Doan et al., 2018) and reward shaping (Tang et al., 2017). The AR objective blends particularly well with SAC, since computing the KL requires stochastic policies with tractable densities for each agent.
18
+
19
+ # 2 PRELIMINARIES
20
+
21
+ We first formalize the RL setting in a Markov decision process (MDP). A discrete-time, finite-horizon, MDP (Bellman, 1957; Puterman, 2014) is described by a state space $s$ , an action space $\mathcal { A }$ , a transition function $\mathcal { P } : \mathcal { S } \times \mathcal { A } \times \mathcal { S } \mapsto \mathbb { R } ^ { + }$ , and a reward function $r : S \times \mathcal { A } \mapsto \mathbb { R }$ .1 On each round $t$ , an agent interacting with this MDP observes the current state $s _ { t } \in S$ , selects an action $a _ { t } \in \mathcal A$ , and observes a reward $r ( s _ { t } , a _ { t } ) \in \mathbb { R }$ upon transitioning to a new state $s _ { t + 1 } \sim \mathcal { P } ( s _ { t } , a _ { t } )$ . Let $\gamma \in [ 0 , 1 ]$ be a discount factor. The goal of an agent evolving in a discounted MDP is to learn a policy $\Dot { \pi } : \Dot { S \times A } \mapsto [ 0 , 1 ]$ such as taking action $a _ { t } \sim \pi ( \cdot | s _ { t } )$ would maximize the expected sum of discounted returns,
22
+
23
+ $$
24
+ V ^ { \pi } ( s ) = \mathbb { E } _ { \pi } \bigg [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s _ { t } , a _ { t } ) | s _ { 0 } = s \bigg ] .
25
+ $$
26
+
27
+ In the following, we use $\rho _ { \pi }$ to denote the trajectory distribution induced by following policy $\pi$ . If $s$ or $\mathcal { A }$ are vector spaces, action and space vectors are respectively denoted by a and s.
28
+
29
+ # 2.1 DISCOVERING NEW SOLUTIONS THROUGH POPULATION-BASED ATTRACTION-REPULSION
30
+
31
+ Consider evolving a population of $M$ agents, also called individuals, $\lbrace \pi _ { \theta _ { m } } \rbrace _ { m = 1 } ^ { M }$ , each agent corresponding to a policy with its own parameters. In order to discover new solutions, we aim to generate agents that can mimic some target policy while following a path different from those of other policies.
32
+
33
+ Let $\mathcal { G }$ denote an archive of policies encountered in previous generations of the population. A natural way of enforcing $\pi$ to be different from or similar to the policies contained in $\mathcal { G }$ is by augmenting the loss of the agent with an Attraction-Repulsion (AR) term:
34
+
35
+ $$
36
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { A R } } = - \underset { \pi ^ { \prime } \sim \mathcal { G } } { \mathbb { E } } \big [ \beta _ { \pi ^ { \prime } } \mathrm { D } _ { \mathrm { K L } } [ \pi | | \pi ^ { \prime } ] \big ] , } \end{array}
37
+ $$
38
+
39
+ where $\pi ^ { \prime }$ is an archived policy and $\beta _ { \pi ^ { \prime } }$ is a coefficient weighting the relative importance of the Kullback-Leibler (KL) divergence between $\pi$ and $\pi ^ { \prime }$ , which we will choose to be a function of the average reward (see Sec. 3.2 below). Intuitively, Eq. 1 adds to the agent objective a weighted average distance between the current and the archived policies. For $\beta _ { \pi ^ { \prime } } \geq 0$ , the agent tends to move away from the archived policy’s behavior (i.e. repulsion, see Figure 1) a). On the other hand, $\beta _ { \pi ^ { \prime } } < 0$ encourages the agent $\pi$ to imitate $\pi ^ { \prime }$ (i.e. attraction).
40
+
41
+ Requirements for AR In order for agents within a population to be trained using the proposed AR-based loss (Eq. 1), we have the following requirements:
42
+
43
+ 1. Their policies should be stochastic, so that the KL-divergence between two policies is well-defined.
44
+
45
+ 2. Their policies should have tractable distributions, so that the KL-divergence can be computed easily, either with closed-form solution or Monte Carlo estimation.
46
+
47
+ Several RL algorithms enjoy such properties (Haarnoja et al., 2018; Schulman et al., 2015; 2017). In particular, the soft actor-critic (SAC, Haarnoja et al., 2018) is a straightforward choice, as it currently outperforms other candidates and is off-policy, thus maintains a single critic shared among all agents (instead of one critic per agent), which reduces computation costs.
48
+
49
+ # 2.2 SOFT ACTOR-CRITIC
50
+
51
+ SAC (Haarnoja et al., 2018) is an off-policy learning algorithm which finds the information projection of the Boltzmann Q-function onto the set of diagonal Gaussian policies $\Pi$ :
52
+
53
+ $$
54
+ \pi = \underset { \pi ^ { \prime } \in \Pi } { \arg \operatorname* { m i n } } \mathrm { D } _ { \mathrm { K L } } \bigg ( \pi ^ { \prime } ( . | \mathbf { s } _ { t } ) \bigg | \bigg | \frac { \exp \big ( \frac { 1 } { \alpha } Q ^ { \pi _ { \mathrm { o l d } } } \big ( \mathbf { s } _ { t } , . \big ) \big ) } { Z ^ { \pi _ { \mathrm { o l d } } } \big ( \mathbf { s } _ { t } \big ) } \bigg ) ,
55
+ $$
56
+
57
+ where $\alpha \in ( 0 , 1 )$ controls the temperature, i.e. the peakedness of the distribution. The policy $\pi$ , critic $Q$ , and value function $V$ are optimized according to the following loss functions:
58
+
59
+ $$
60
+ \begin{array} { r l } & { \mathcal { L } _ { \pi , \mathrm { S A C } } = \mathbb { E } _ { \mathbf { s } _ { t } \sim \mathcal { B } } [ \mathbb { E } _ { \mathbf { a } _ { t } \sim \pi } [ \alpha \log \pi ( \mathbf { a } _ { t } | \mathbf { s } _ { t } ) - Q ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) ] ] } \\ & { \qquad \mathcal { L } _ { Q } = \underset { ( s , a , r , s ^ { \prime } ) \sim \mathcal { B } } { \mathbb { E } } [ \{ Q ( s , a ) - ( r + \gamma V _ { \nu } ^ { \pi } ( s ^ { \prime } ) ) \} ^ { 2 } ] } \\ & { \qquad \mathcal { L } _ { V } = \mathbb { E } _ { \mathbf { s } _ { t } \sim \mathcal { D } } \bigg [ \frac { 1 } { 2 } \big \{ V _ { \nu } ^ { \pi } ( \mathbf { s } _ { t } ) - \mathbb { E } _ { \mathbf { a } _ { t } \sim \pi } [ Q ( \mathbf { s } _ { t } , \mathbf { a } _ { t } ) - \alpha \log \pi ( \mathbf { a } _ { t } | \mathbf { s } _ { t } ) ] \big \} ^ { 2 } \bigg ] , } \end{array}
61
+ $$
62
+
63
+ where $\boldsymbol { B }$ is the replay buffer. The policy used in SAC as introduced in Haarnoja et al. (2018) is Gaussian, which is both stochastic and tractable, thus compatible with our AR loss function in Eq. 1. Together with the AR loss in Eq. 1, the final policy loss becomes:
64
+
65
+ $$
66
+ \mathcal { L } _ { \pi } = \mathcal { L } _ { \pi , \mathrm { S A C } } + \mathcal { L } _ { \mathrm { A R } }
67
+ $$
68
+
69
+ However, Gaussian policies are arguably of limited expressibility; we can improve on the family of policy distributions without sacrificing qualities necessary for AR or SAC by using Normalizing Flows (NFs, Rezende & Mohamed, 2015).
70
+
71
+ # 2.3 NORMALIZING FLOWS
72
+
73
+ NFs (Rezende & Mohamed, 2015) were introduced as a means of transforming simple distributions into more complex distributions using learnable and invertible functions. Given a random variable $\mathbf { z } _ { 0 }$ sequence of with density $q _ { 0 }$ $d$ 0-dimensional random variables, , they define a set of differentiable and invertible functions, $\{ { \mathbf { z } } _ { i } \} _ { i = 1 } ^ { N }$ . $\{ f _ { i } \} _ { i = 1 } ^ { N }$ , which generate a
74
+
75
+ Because SAC uses explicit, yet simple parametric policies, NFs can be used to transform the SAC policy into a richer one (e.g., multimodal) without risk loss of information. For example, Mazoure et al. (2019) enhanced SAC using a family of radial contractions around a point $\mathbf { z } _ { 0 } \in \bar { \mathbb { R } } ^ { d }$ ,
76
+
77
+ $$
78
+ f ( \mathbf { z } ) = \mathbf { z } + { \frac { \beta } { \alpha + | | \mathbf { z } - \mathbf { z } _ { 0 } | | _ { 2 } } } ( \mathbf { z } - \mathbf { z } _ { 0 } )
79
+ $$
80
+
81
+ for $\alpha \in \mathbb { R } ^ { + }$ and $\beta \in \mathbb { R }$ . This results in a rich set of policies comprised of an initial noise sample ${ \bf a } _ { 0 }$ , a state-noise embedding $h _ { \theta } ( \mathbf { a } _ { 0 } , \mathbf { s } _ { t } )$ , and a flow $\{ \dot { f } _ { \phi _ { i } } \} _ { i = 1 } ^ { N }$ of arbitrary length $N$ , parameterized by $\phi = \{ \phi _ { i } \} _ { i = 1 } ^ { N }$ . Sampling from the policy $\pi _ { \phi , \theta } ( \mathbf { a } _ { t } | \mathbf { s } _ { t } )$ can be described by the following set of equations:
82
+
83
+ $$
84
+ \begin{array} { r l } & { \mathbf { a } _ { 0 } \sim \mathcal { N } ( 0 , \mathbf { I } ) ; } \\ & { \mathbf { \Phi } \mathbf { z } = h _ { \theta } ( \mathbf { a } _ { 0 } , \mathbf { s } _ { t } ) ; } \\ & { \mathbf { a } _ { t } = f _ { \phi _ { N } } \circ f _ { \phi _ { N - 1 } } \circ \dots \circ f _ { \phi _ { 1 } } ( \mathbf { z } ) , } \end{array}
85
+ $$
86
+
87
+ where $h _ { \theta } = \mathbf { a } _ { 0 } \sigma \mathbf { I } + \mu ( \mathbf { s } _ { t } )$ depends on the state and the noise variance $\sigma > 0$ . Different SAC policies can thus be crafted by parameterizing their NFs layers.
88
+
89
+ ![](images/5f1e484c07b4d6aae050dd38be514b6f5d99e8200b908a2090a82327bc3e358f.jpg)
90
+ Figure 1: a) Augmenting the loss function with AR constraints allows an agent to reach a target policy by following different paths. Attractive and Repulsive policies represent any other agent’s policy. b) General flow of the proposed ARAC strategy.
91
+
92
+ # 3 ARAC: ATTRACTION-REPULSION ACTOR-CRITIC
93
+
94
+ We now detail the general procedure for training a population of agents using the proposed diversityseeking AR mechanism. More specifically, we consider here SAC agents enhanced with NFs (Mazoure et al., 2019). Figure 1 displays the general flow of the procedure. Algorithm 1 (Appendix) provides the pseudo-code of the proposed ARAC strategy, where sub-procedures for rollout and archive update can be found in the Appendix.
95
+
96
+ Overview ARAC works by evolving a population of $M$ SAC agents $\{ \pi _ { \phi , \theta } ^ { m } \} _ { m = 1 } ^ { M }$ with radial NFs policies (Eq. 7) and shared critic , and by maintaining an archive of policies encountered in previous generations of the population. After performing $T$ steps per agent on the environment (Alg. 1 L8-12), individuals are evaluated by performing $R$ rollouts2 on the environment (Alg. 1 L26-28). This allows to identify the top- $K$ best agents (Alg. 1 L29), also called elites, which will be used to update the critic as they provide the most meaningful feedback (Alg. 1 L13-17). The archive is finally updated in a diversity-seeking fashion using the current population (Alg. 1 L30).
97
+
98
+ The core component of the proposed approach lies within the update of the agents (Alg. 1 L18-25). During this phase, elite individuals are updated using AR operations w.r.t. policies sampled from the archive (Eq. 5), whereas non-elites are updated regularly (Eq. 2).
99
+
100
+ # 3.1 ENHANCING DIVERSITY IN THE ARCHIVE
101
+
102
+ Throughout the training process, we maintain an archive $\mathcal { G }$ of maximum capacity $G$ , which contains some previously encountered policies. The process goes as follow: until reaching full capacity, the archive saves a copy of the parameters of every individual in the population after the evaluation step. However, by naively adding all individuals as if the archive were just a heap, the archive could end up filled with policies leading to similar rewards, which would result in a loss of diversity (Mauldin, 1984). We mitigate this issue by keeping track of two fitness clusters (low and high) using the partition formed by running a $k$ -means algorithm on the fitness value. Hence, when $| { \mathcal { G } } | = G$ is reached and a new individual is added to the archive, it randomly replaces an archived policy from its respective cluster. This approach, also known as niching, has proved itself effective at maintaining high diversity levels (Gupta & Ghafir, 2012; Mahfoud, 1995).
103
+
104
+ # 3.2 DISCOVERING NEW POLICIES THROUGH ATTRACTION-REPULSION
105
+
106
+ The crux of this work lies in the explicit search for diversity in the policy space achieved using the AR mechanism. Since the KL between two base policies (i.e. input of the first flow layer) can be trivially maximized by driving their means apart, we apply attraction-repulsion only on the flow layers, while holding the mean of the base policy constant. This ensures that the KL term doesn’t depend on the difference in means and hence controls the magnitude of the AR mechanism. Every time the AR operator is applied (Alg. 1 L20-21), $n$ policies are sampled from the archive and are used for estimating the AR loss (Eq. 1). As in Hong et al. (2018), we consider two possible strategies to dictate the value of $\beta _ { \pi ^ { \prime } }$ coefficients for policies $\pi ^ { \prime } \sim \mathcal { G }$ :
107
+
108
+ $$
109
+ \begin{array} { l } { \displaystyle \beta _ { \pi ^ { \prime } } = - \biggl [ 2 \biggl ( \frac { f \bigl ( \pi ^ { \prime } \bigr ) - f _ { m i n } } { f _ { m a x } - f _ { m i n } } - 1 \biggr ) \biggr ] } \\ { \displaystyle \beta _ { \pi ^ { \prime } } = 1 - \frac { f \bigl ( \pi ^ { \prime } \bigr ) - f _ { m i n } } { f _ { m a x } - f _ { m i n } } } \end{array}
110
+ $$
111
+
112
+ where $f ( \pi ) ^ { 3 }$ represents the fitness function of policy $\pi$ (average reward in our case), and $f _ { m i n }$ and $f _ { m a x }$ are estimated based on the $n$ sampled archived policies. The proactive strategy aims to mimic high reward archived policies, while the reactive strategy is more cautious, only repulsing away the current policy from low fitness archived policies. Using this approach, the current agent policy will be attracted to some sampled policies $( \beta _ { \pi ^ { \prime } } < 0 )$ ) and will be repulsed from others $\beta _ { \pi ^ { \prime } } \geq 0 )$ ) in a more or less aggressive way, depending on the strategy.
113
+
114
+ Unlike Hong et al. (2018) who applied proactive and reactive strategies on policies up to 5 timesteps back, we maintain an archive consisting of two clusters seen so far: policies with low and high fitness, respectively. Having this cluster allows to attract/repulse from a set of diverse agents, replacing high-reward policies by policies with similar performance. Indeed, without this process, elements of the archive would collapse on the most frequent policy, from which all agents would attract/repulse. To avoid performing AR against a single "average policy" , we separate low-reward and high-reward agents via clustering.
115
+
116
+ # 4 RELATED WORK
117
+
118
+ The challenges of exploration are well studied in the RL literature. Previously proposed approaches for overcoming hard exploration domains tend to either increase the capacity of the state-action value function (Gal & Ghahramani, 2016; Henderson et al., 2017) or the policy expressivity (Mazoure et al., 2019; Tang & Agrawal, 2018; Touati et al., 2018). This work rather tackles exploration from a diverse multi-agent perspective. Unlike prior population-based approaches for exploration (Conti et al., 2018; Khadka & Tumer, 2018; Pourchot & Sigaud, 2019), which seek diversity through the parameters space, we directly promote diversity in the policy space.
119
+
120
+ The current work was inspired by Hong et al. (2018), who relied on the KL divergence to attract/repulse from a set of previous policies to discover new solutions. However, in their work, the archive is time-based (they restrict themselves to the 5 most recent policies), while our archive is built following a diversity-seeking strategy (i.e., niching and policies come from multiple agents). Notably, ARAC is different of previously discussed works in that it explores the action space in multiple regions simultaneously, a property enforced through the AR mechanism.
121
+
122
+ The proposed approach bears some resemblance with Liu et al. (2017), who took advantage of a multi-agent framework in order to perform repulsion operations among agents using of similarity kernels between parameters of the agents. The AR mechanism gives rise to exploration through structured policy rather than randomized policy. This strategy has also been employed in multi-task learning (Gupta et al., 2018), where experience on previous tasks was used to explore on new tasks.
123
+
124
+ # 5 EXPERIMENTS
125
+
126
+ # 5.1 DIDACTIC EXAMPLE
127
+
128
+ Consider a 2-dimensional multi-armed bandit problem where the actions lie in the real square $[ - 6 , 6 ] ^ { 2 }$ . We illustrate the example of using a proactive strategy where a SAC agent with radial flows policy imitates a desirable (expert) policy while simultaneously repelling from a less desirable policy. The task consists in matching the expert’s policy (blue density) while avoiding taking actions from a repulsive policy $\pi ^ { \prime }$ (red). We illustrate the properties of radial flows in Figure 2 by increasing the number of flows (where 0 flow corresponds to a Gaussian distribution).
129
+
130
+ We observe that increasing the number of flows (bottom to top) leads to more complex policy’s shapes and multimodality unlike the Gaussian policy which has its variance shrinked (the KL divergence is proportional to the ratio of the two variances, hence maximizing it can lead to a reduction in the variance which can be detrimental for exploration purpose). Details are provided in Appendix.
131
+
132
+ ![](images/1036cd057f37e814ff6f335c0a03dd0dd10f946762eb28661267361a0bedc134.jpg)
133
+ Figure 2: Agent trained to imitate a target while avoiding a repulsive policy using a proactive strategy. Increasing the number of flows leads to more complex policy’s shape.
134
+
135
+ ![](images/85f6af52b9f366799b350719614483ad9e8170c22dac51befe8f4baebf61470b.jpg)
136
+ Figure 3: Average return and one standard deviation on 5 random seeds across 7 MuJoCo tasks for ARAC against single SAC agents (with and without NFs). Curves are smoothed using Savitzky-Golay filtering with window size of 7.
137
+
138
+ # 5.2 MUJOCO LOCOMOTION BENCHMARKS
139
+
140
+ We now compare ARAC against the CEM-TD3 (Pourchot & Sigaud, 2019), ERL (Khadka & Tumer, 2018) and CERL (Khadka et al., 2019) multi-agent baselines on seven continuous control tasks from the MuJoco suite (Duan et al., 2016): Ant-v2, HalfCheetah-v2, Humanoid-v2, HumanoidStandup-v2, Hopper-v2, Walker2d-v2 and Humanoid (rllab). We also designed a sparse reward environment SparseHumanoid-v2. All algorithms are run over 1M time steps on each environment, except Humanoid (rllab) which gets 2M time steps and SparseHumanoid-v2 on $0 . 6 { \bf M }$ time steps. We also include comparison against single-agent baselines.
141
+
142
+ ARAC performs $R = 1 0$ rollouts for evaluation steps every 10, 000 interaction steps with the environment. We consider a small population of $N = 5$ individuals with $K = 2$ as elites. Every SAC agent has one feedforward hidden layer of 256 units acting as state embedding, followed by a radial flow of length $\in \{ 3 , 4 \}$ . A temperature of $\alpha = 0 . 0 5$ or 0.2 is used across all the environments (See appendix for more details). AR operations are carried out by sampling uniformly $n = 5$ archived policies from $\mathcal { G }$ . Parameters details are provided in the Appendix (Table 4). All networks are trained with Adam optimizer (Kingma & Ba, 2015) using a learning rate of $\mathrm { 3 E ^ { - 4 } }$ . Baselines CEM-TD34, $\mathrm { E R L } ^ { 5 }$ , CERL6 use the code contained in their respective repositories.
143
+
144
+ <table><tr><td></td><td>ARAC</td><td>CEM-TD3</td><td>CERL</td><td>ERL</td><td>SAC-NF</td><td>SAC</td><td>TD3</td></tr><tr><td>Ant</td><td>6044</td><td>4239</td><td>1639</td><td>1442</td><td>4912</td><td>4370</td><td>4372</td></tr><tr><td>HC</td><td>10264</td><td>10659</td><td>5703</td><td>6746</td><td>8429</td><td>11 900</td><td>9543</td></tr><tr><td>Hopper</td><td>3587</td><td>3655</td><td>2970</td><td>1149</td><td>3538</td><td>2794</td><td>3564</td></tr><tr><td>Hu</td><td>5965</td><td>212</td><td>4756</td><td>551</td><td>5506</td><td>5504</td><td>71</td></tr><tr><td>Standup</td><td>175 000</td><td>29 000</td><td>117000</td><td>12 900</td><td>116 000</td><td>149 000</td><td>54000</td></tr><tr><td>Hu (rllab)</td><td>14 230</td><td>1334</td><td>3340</td><td>57</td><td>5531</td><td>1963</td><td>286</td></tr><tr><td>Walker2d</td><td>4704</td><td>4710</td><td>4386</td><td>1107</td><td>5196</td><td>3783</td><td>4682</td></tr><tr><td>Hu (Sparse)</td><td>816</td><td>0</td><td>1.32</td><td>8.65</td><td>547</td><td>88</td><td>0</td></tr></table>
145
+
146
+ Table 1: Maximum average return after 1M (2M for Humanoid (rllab) and 600k for SparseHumanoid-v2) time steps 5 random seeds. Bold: best methods when the gap is less than 100 units. See appendix for average return with standard deviation. Environment short names: HC: HalfCheetah-v2, Hu: Humanoid-v2, Standup: HumanoidStandup-v2
147
+
148
+ Figure 4 displays the performance of all algorithms on three environments over time steps (see Appendix Figure 7 for all environments). Results are averaged over 5 random seeds. Table 1 reports the best observed reward for each method.
149
+
150
+ ![](images/7c61fe7d139129b6333acea8071a346e8a481d71ecd2da64dcd95580615568ae.jpg)
151
+ Figure 4: Average return and one standard deviation on 5 random seeds across 8 MuJoCo tasks. Curves are smoothed using Savitzky-Golay filtering with window size of 7.
152
+
153
+ Small state space environments HalfCheetah-v2, Hopper-v2, and Walker2d-v2 are low-dimensional state space environments $( d \leq 1 7 )$ . Except for HalfCheetah-v2, the proposed approach shows comparable results with its concurrent. Those results match the findings of (Plappert et al., 2018) that some environments with well-structured dynamics require little exploration. Full learning curves can be found in the Appendix.
154
+
155
+ Deceptive reward and Large state space environments Humanoid-v2, HumanoidStandup-v2 and Humanoid (rllab) belong to bipedal environments with high-dimensional state space $( d = 3 7 6$ and $d = 1 4 7$ ), and are known to trap algorithms into suboptimal solutions. In addition to the legs, the agent also needs to control the arms, which may influence the walking way and hence induce deceptive rewards (Conti et al., 2018). Figure 4 shows the learning curves on MuJoCo tasks. We observe that ARAC beats both baselines in performance as well as in convergence rate.
156
+
157
+ Ant-v2 is another high-dimensional state space environment $\mathit { l } \geq 1 0 0 )$ . In an unstable setup, a naive algorithm implementing an unbalanced fast walk could still generate high reward, the reward taking into account the distance from start, instead of learning to stand, stabilize, and walk (as expected).
158
+
159
+ Sparse reward environment To test ARAC in a sparse reward environment, we created SparseHumanoid-v2. The dynamic is the same as Humanoid-v2 but rewards of $+ 1$ is granted only given is the center of mass of the agent is above a threshold (set to 0.6 unit in our case). The challenge not only lies in the sparse reward property but also on the complex body dynamic that can make the agent falling down and terminating the episode. As shown in Figure 4, ARAC is the only method that can achieve non zero performance. A comparison against single agent methods in the Appendix also shows better performance for ARAC.
160
+
161
+ Sample efficiency compared with single agent methods Figure 3 (in Appendix) also shows that the sample efficiency of the population-based ARAC compares to a single SAC agent (with and without NFs) and other baselines methods (SAC, TD3). On Humanoid-v2 and Ant-v2 ARAC converges faster, reaching the 6k (4k, respectively) milestone performance after only 1M steps, while a single SAC agent requires 4M (3M, respectively) steps according to (Haarnoja et al., 2018). In general, ARAC achieves competitive results (no flat curves) and makes the most difference (faster convergence and better performance) in the biped environments.
162
+
163
+ Attraction-repulsion ablation study To illustrate the impact of repulsive forces, we introduce a hyperparameter $\lambda$ in the overall loss (Eq. 5):
164
+
165
+ $$
166
+ \mathcal { L } _ { \theta , \phi , \lambda } = \mathcal { L } _ { \theta , \phi , \mathrm { S A C } } + \lambda \mathcal { L } _ { \phi , \mathrm { A R } }
167
+ $$
168
+
169
+ We ran an ablation analysis on Humanoid-v2 by varying that coefficient. For two random states, we sampled 500 actions from all agents and mapped these actions onto a two-dimensional space (via t-SNE). Appendix Figure 5 shows that without repulsion $\lambda = 0$ ), actions from all agents are entangled, while repulsion $( \lambda > 0$ ) forces agents to behave differently and hence explore different regions of the action space.
170
+
171
+ The second ablation study is dedicated to highlight the differences between a Gaussian policy (similar to Hong et al. (2018) and an NF policy under AR operators. As one can observe in Figure 6, using a Gaussian policy deteriorates the solution as the repulsive KL term drives apart the means of agents and blows up/ shrinks the variance of the Gaussian policy. On the other hand, applying the AR term on the NF layers maximizes the KL conditioned on the mean and variance of both base policies, resulting in a solution which allows sufficient exploration. More details are provided in the Appendix.
172
+
173
+ Finally, through a toy example subject to AR, we characterize the policy’s shape when increasing the number of the radial flow policy in Figure 2 (experimental setup in Appendix). Unlike the diagonal Gaussian policy (SAC) that has symmetry constraints, increasing the number of flows allows the radial policy to adopt more complex shapes (from bottom to top).
174
+
175
+ # 6 CONCLUSION
176
+
177
+ In this paper, we addressed the issue of RL domains with deceptive rewards by introducing a population-based search model for optimal policies using attraction-repulsion operators. Our method relies on powerful density estimators (normalizing flows), to let policies exploit the reward landscape under AR constraints. Our ablation studies showed that (1) the strength of AR and (2) the number of flows are the two factors which predominantly affect the shape of the policy. Selecting the correct AR coefficient is therefore important to obtain good performance, while at the same time preventing premature convergence.
178
+
179
+ Empirical results on the MuJoCo suite demonstrate high performance of the proposed method in most settings, including with sparse rewards. Moreover, in biped environments that are known to trap algorithms into suboptimal solutions, ARAC enjoys higher sample efficiency and better performance compared to its competitors which confirms our intuitions on using AR with normalizing flows. As future steps, borrowing from multi-objective optimization literature methods could allow one to combine other diversity metrics with the performance objective, to in turn improve the coverage of the solution space among the individuals by working with the corresponding Pareto front (Horn et al., 1994).
180
+
181
+ # REFERENCES
182
+
183
+ Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47: 253–279, 2013.
184
+
185
+ Richard Bellman. A markovian decision process. Journal of Mathematics and Mechanics, pp. 679–684, 1957.
186
+
187
+ Edoardo Conti, Vashisht Madhavan, Felipe Petroski Such, Joel Lehman, Kenneth Stanley, and Jeff Clune. Improving exploration in evolution strategies for deep reinforcement learning via a population of novelty-seeking agents. In Advances in Neural Information Processing Systems (NeurIPS), pp. 5027–5038, 2018.
188
+
189
+ Thang Doan, Bogdan Mazoure, and Clare Lyle. Gan q-learning. arXiv preprint arXiv:1805.04874, 2018.
190
+
191
+ Yan Duan, Xi Chen, Rein Houthooft, John Schulman, and Pieter Abbeel. Benchmarking deep reinforcement learning for continuous control. In International Conference on Machine Learning (ICML), pp. 1329–1338, 2016.
192
+
193
+ Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In International conference on machine learning (ICML), pp. 1050– 1059, 2016.
194
+
195
+ Abhishek Gupta, Russell Mendonca, YuXuan Liu, Pieter Abbeel, and Sergey Levine. Metareinforcement learning of structured exploration strategies. In Advances in Neural Information Processing Systems (NeurIPS), pp. 5302–5311, 2018.
196
+
197
+ Deepti Gupta and Shabina Ghafir. An overview of methods maintaining diversity in genetic algorithms. International journal of emerging technology and advanced engineering, 2(5):56–60, 2012.
198
+
199
+ Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft Actor-Critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In International Conference on Machine Learning (ICML), pp. 1856–1865, 2018.
200
+
201
+ Peter Henderson, Thang Doan, Riashat Islam, and David Meger. Bayesian policy gradients via alpha divergence dropout inference. NIPS Bayesian Deep Learning Workshop, 2017.
202
+
203
+ Zhang-Wei Hong, Tzu-Yun Shann, Shih-Yang Su, Yi-Hsiang Chang, Tsu-Jui Fu, and Chun-Yi Lee. Diversity-driven exploration strategy for deep reinforcement learning. In Advances in Neural Information Processing Systems (NeurIPS), pp. 10489–10500, 2018.
204
+
205
+ Jeffrey Horn, Nicholas Nafpliotis, and David E. Goldberg. A niched pareto genetic algorithm for multiobjective optimization. In Proceedings of the 1st IEEE Conference on Evolutionary Computation, IEEE World Congress on Computational Intelligence, pp. 82–87, 1994.
206
+
207
+ Shauharda Khadka and Kagan Tumer. Evolution-guided policy gradient in reinforcement learning. In Advances in Neural Information Processing Systems (NeurIPS), pp. 1188–1200, 2018.
208
+
209
+ Shauharda Khadka, Somdeb Majumdar, Tarek Nassar, Zach Dwiel, Evren Tumer, Santiago Miret, Yinyin Liu, and Kagan Tumer. Collaborative evolutionary reinforcement learning. CoRR, abs/1905.00976, 2019. URL http://arxiv.org/abs/1905.00976.
210
+
211
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015.
212
+
213
+ Kyowoon Lee, Sol-A Kim, Jaesik Choi, and Seong-Whan Lee. Deep reinforcement learning in continuous action spaces: a case study in the game of simulated curling. In International Conference on Machine Learning, pp. 2943–2952, 2018.
214
+
215
+ Yang Liu, Prajit Ramachandran, Qiang Liu, and Jian Peng. Stein variational policy gradient. In Conference on Uncertainty in Artificla Intelligence (UAI), 2017.
216
+
217
+ Samir W Mahfoud. Niching methods for genetic algorithms. PhD thesis, University of Illinois at Urbana-Champaign Champaign, USA, 1995.
218
+
219
+ Michael L Mauldin. Maintaining diversity in genetic search. In AAAI Conference on Artificial Intelligence (AAAI), pp. 247–250, 1984.
220
+
221
+ Bogdan Mazoure, Thang Doan, Audrey Durand, R Devon Hjelm, and Joelle Pineau. Leveraging exploration in off-policy algorithms via normalizing flows. Proceedings of the 3rd Conference on Robot Learning (CoRL 2019), 2019.
222
+
223
+ Joelle Pineau. The machine learning reproducibility checklist. 2018.
224
+
225
+ Matthias Plappert, Rein Houthooft, Prafulla Dhariwal, Szymon Sidor, Richard Y Chen, Xi Chen, Tamim Asfour, Pieter Abbeel, and Marcin Andrychowicz. Parameter space noise for exploration. arXiv preprint arXiv:1706.01905, 2017.
226
+
227
+ Matthias Plappert, Rein Houthooft, Prafulla Dhariwal, Szymon Sidor, Richard Y. Chen, Xi Chen, Tamim Asfour, Pieter Abbeel, and Marcin Andrychowicz. Parameter space noise for exploration. In International Conference on Learning Representations (ICLR), 2018.
228
+
229
+ Aloïs Pourchot and Olivier Sigaud. CEM-RL: Combining evolutionary and gradient-based methods for policy search. In International Conference on Learning Representations (ICLR), 2019.
230
+
231
+ Martin L Puterman. Markov decision processes: discrete stochastic dynamic programming. John Wiley & Sons, 2014.
232
+
233
+ Danilo Jimenez Rezende and Shakir Mohamed. Variational inference with normalizing flows. In International Conference on Machine Learning (ICML), pp. 1530–1538, 2015.
234
+
235
+ John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International Conference on Machine Learning (ICML), pp. 1889–1897, 2015.
236
+
237
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint: 1707.06347, 2017.
238
+
239
+ Haoran Tang, Rein Houthooft, Davis Foote, Adam Stooke, OpenAI Xi Chen, Yan Duan, John Schulman, Filip DeTurck, and Pieter Abbeel. # Exploration: A study of count-based exploration for deep reinforcement learning. In Advances in neural information processing systems (NeurIPS), pp. 2753–2762, 2017.
240
+
241
+ Yunhao Tang and Shipra Agrawal. Boosting trust region policy optimization by normalizing flows policy. arXiv preprint: 1809.10326, 2018.
242
+
243
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 5026–5033. IEEE, 2012.
244
+
245
+ Ahmed Touati, Harsh Satija, Joshua Romoff, Joelle Pineau, and Pascal Vincent. Randomized value functions via multiplicative normalizing flows. arXiv preprint: 1806.02315, 2018.
246
+
247
+ Brian D Ziebart. Modeling purposeful adaptive behavior with the principle of maximum causal entropy. PhD thesis, figshare, 2010.
248
+
249
+ # APPENDIX
250
+
251
+ REPRODUCIBILITY CHECKLIST
252
+
253
+ We follow the reproducibility checklist (Pineau, 2018) and point to relevant sections explaining them here.
254
+
255
+ For all algorithms presented, check if you include:
256
+
257
+ • A clear description of the algorithm, see main paper and included codebase. The proposed approach is completely described by Alg. 1 (main paper), 2 (Appendix), and 3 (Appendix). The proposed population-based method uses attraction-repulsion operators in order to enforce a better policy space coverage by different agents. An analysis of the complexity (time, space, sample size) of the algorithm. See Appendix Figure 7 and 3. Experimentally, we demonstrate improvement in sample complexity as discussed in our main paper. In term of computation time, the proposed method scales linearly with the population size if agents are evaluated sequentially (as presented in Alg. 1 for clarity). However, this as mentioned in the paper, can be parallelized. All our results are obtained using $M$ small network architectures with $1 \times 2 5 6$ -units hidden layer followed by $f$ layers of $| A | + 2$ units each $f$ being the number of radial flows and $| A |$ being the action space dimension). A link to a downloadable source code, including all dependencies. The code is included with the Appendix as a zip file; all dependencies can be installed using Python’s package manager. Upon publication, the code would be available on Github.
258
+
259
+ For all figures and tables that present empirical results, check if you include:
260
+
261
+ • A complete description of the data collection process, including sample size. We use standard benchmarks provided in OpenAI Gym (Brockman et al., 2016).
262
+ • A link to downloadable version of the dataset or simulation environment. See: https://github.com/
263
+ • An explanation of how samples were allocated for training / validation / testing. We do not use a training-validation-test split, but instead report the mean performance (and one standard deviation) of the policy at evaluation time, openai/gym for OpenAI Gym benchmarks and https://www.roboti.us/index.html for MuJoCo suite. obtained with 5 random seeds. An explanation of any data that were excluded. We did not compare on easy environments (e.g. Reacher-v2) because all existing methods perform well on them. In that case, the improvement of our method upon baselines is incremental and not worth mentioning.
264
+ • The exact number of evaluation runs. 5 seeds for MuJoCo experiments, 1M, 2M or 3M environment steps depending on the domain.
265
+ • A description of how experiments were run. See Section 5 in the main paper and didactic example details in Appendix. A clear definition of the specific measure or statistics used to report results. Undiscounted returns across the whole episode are reported, and in turn averaged across 5 seeds. Clearly defined error bars. Confidence intervals and table values are always mean± 1 standard deviation over 5 seeds.
266
+ • A description of results with central tendency (e.g. mean) and variation (e.g. stddev). All results use the mean and standard deviation.
267
+ • A description of the computing infrastructure used. All runs used 1 CPU for all experiments (toy and MuJoCo) with 8Gb of memory.
268
+
269
+ ![](images/75d01fa4c6a294b396d495cb49a01703a056ee642fb7fd10e4b064ef53d861d8.jpg)
270
+ Figure 5: Mapping in two-dimension space (t-SNE) of agents’ actions for two arbitrary states. Each color represents a different agent.
271
+
272
+ To illustrate the impact of the repulsive force coefficient $\lambda$ , we ran an ablation analysis by varying that coefficient (recall that the overall loss function is $\mathcal { L } _ { \pi } = \mathcal { L } _ { \pi , \mathrm { S A C } } + \lambda \mathcal { L } _ { \mathrm { A R } }$ where $\lambda = 1$ in our experiment).
273
+
274
+ For two random states, we sampled 500 actions from all agents and mapped theses actions in a common 2-dimensional space (t-SNE).
275
+
276
+ As shown in the Figure above, policies trained without AR $\lambda = 0$ ) result in entangled actions, while increasing the repulsive coefficient $\lambda$ forces agents to have different actions and hence explore different regions of the policy space. Note that due to the specific nature of t-SNE , the policies are shown as Gaussians in a lower-dimensional embedding, while it is not necessarily the case in the true space.
277
+
278
+ # STABILIZING ATTRACTION-REPULSION WITH NORMALIZING FLOW
279
+
280
+ In this section, we illustrate the consequence of the AR operators with a Gaussian policy (as in Hong et al. (2018)) and our Normalizing flow policy for Ant-v2, Humanoid-v2 and HalfCheetah-v2. As shown in the figure below, AR with Gaussian policies yield worse results. One reason is that the KL term drives apart the mean and variance of the Gaussian policy which deteriorates the main objective of maximizing the reward. On the other side, our method applies the AR only on the NF layers allows enough exploration by deviating sufficiently from the main objective function.
281
+
282
+ ![](images/4efc27a07944874b7749b830b2f1aa73e9d64a0e975cbc0492917b3be8aaf97e.jpg)
283
+ Figure 6: Comparison of ARAC agents using (1) AR with radial flows, (2) AR with only the base (Gaussian) policy and (3) no AR with radial flows.
284
+
285
+ # COMPARING ARAC AGAINST BASELINES ON MUJOCO TASKS
286
+
287
+ Figure 7 shows the performance of ARAC and baselines (CEM-TD3, CERL and ERL) over time steps. Learning curves are averaged over 5 random seeds and displayed with one standard deviation. Evaluation is done every 10, 000 environment steps using 10 rollouts per agent. Overall, ARAC has reasonable performance on all tasks (no flat curves) and demonstrates high performance, especially in humanoid tasks.
288
+
289
+ ![](images/266cfd9eb6a43128f2757b9c1b4521aa722e61184330dc539ad0fcf16fbe9337.jpg)
290
+ Figure 7: Average return and one standard deviation on 5 random seeds across 7 MuJoCo tasks for ARAC against baselines. Curves are smoothed using Savitzky-Golay filtering with window size of 7.
291
+
292
+ BENEFITS OF POPULATION-BASED STRATEGIES: ARAC AGAINST SINGLE AGENTS
293
+
294
+ In this section, we highlight the benefits of the proposed population-based strategy by comparing with single agents. Figure 3 shows the performance of ARAC against a single SAC agent (with and without normalizing flows). Learning curves are averaged over 5 random seeds and displayed with one standard deviation. Evaluation is done every 10, 000 environment steps using 10 rollouts per agent. We observe a high beneficial impact on the convergence rate as well as on the performance. ARAC outperforms single agents in almost all tasks (except for HalfCheetah-v2 and Walker-v2) with large improvement. Note the high sample efficiency on humanoid environments (Humanoid-v2 and Humanoid (rllab)), where it shows faster convergence in addition to better performance. Indeed, on Humanoid (rllab) a single SAC agent reaches the 4k milestone after 4M steps (Haarnoja et al., 2018) while ARAC achieves this performance in less than 2M steps. Also, in SparseHumanoid-v2, due to its better coordinated exploration, ARAC could find a good solution faster than SAC-NF.
295
+
296
+ OVERALL PERFORMANCES ON MUJOCO TASKS
297
+
298
+ <table><tr><td rowspan="2">Ant-v2</td><td rowspan="2">ARAC 6,044 ± 216</td><td rowspan="2">CEM-TD3 4,239 ± 1,048</td><td rowspan="2">CERL</td><td rowspan="2">ERL</td><td rowspan="2">SAC - NF</td><td rowspan="2">SAC</td><td rowspan="2">TD3 4,372 ± 900</td></tr><tr><td>1,639± 564 1,442±819</td></tr><tr><td>HalfCheetah-v2</td><td>10,264± 271</td><td>10,659 ± 1,473</td><td>5,703 ± 831</td><td>6,746± 295</td><td>4,912 ± 954 8,429 ±818</td><td>4,370 ± 173 11,896 ± 574</td><td>9,543 ± 978</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Hopper-v2</td><td>3,587 ± 65</td><td>3,655 ± 82</td><td>2,970 ± 341</td><td>1,149 ±3</td><td>3,538 ± 108</td><td>2,794 ± 729</td><td>3,564 ± 114</td></tr><tr><td>Humanoid-v2 HumanoidStandup-v2</td><td>5,965 ± 51 175k±38k</td><td>212±1</td><td>4,756± 454</td><td>551± 60</td><td>5,506± 147</td><td>5,504± 116</td><td>71±10</td></tr><tr><td>Humanoid (rllab)</td><td>14,234 ± 7251</td><td>29k±4k 1,334 ± 551</td><td>117k ± 8k</td><td>129k ± 4k</td><td>116k ± 9k</td><td>149k ±7k</td><td>54k ± 24k</td></tr><tr><td>Walker2d-v2</td><td>4,704 ± 261</td><td>4,710 ± 320</td><td>3,340 ± 3,340 4,3860 ± 615</td><td>57±17 1,107 ± 60</td><td>5,531 ± 4,435</td><td>1,963 ± 1,384</td><td>286 ± 151 4,682 ± 539</td></tr><tr><td>SparseHumanoid-v2</td><td>816 ± 20</td><td>0±0</td><td>1.32 ± 2.64</td><td>8.65 ± 15.90</td><td>5,196 ± 527 547 ± 268</td><td>3,783 ± 366 88±159</td><td>0±0</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
299
+
300
+ Table 2: Maximum average return after 1M (2M for Humanoid (rllab) and 600k for SparseHumanoid-v2) time steps $\pm$ one standard deviation on 5 random seeds. Bold: best methods when the gap is less than 100 units.
301
+
302
+ <table><tr><td></td><td>ARAC</td><td>TRPO</td><td>PPO</td><td>Trust-PCL</td><td>Plappert et al. (2017)</td><td>Touati et al. (2018)</td><td>Hong et al. (2018)</td></tr><tr><td>HalfCheetah-v2</td><td>10,264</td><td>-15</td><td>2,600</td><td>2,200</td><td>5,000</td><td>7,700</td><td>4,200</td></tr><tr><td>Walker-v2</td><td>4,764</td><td>2,400</td><td>4,050</td><td>400</td><td>850</td><td>500</td><td>N/A</td></tr><tr><td>Hopper-v2</td><td>3,588</td><td>600</td><td>3,150</td><td>280</td><td>2,500</td><td>400</td><td>N/A</td></tr><tr><td>Ant-v2</td><td>6,044</td><td>-76</td><td>1,000</td><td>1,500</td><td>N/A</td><td>N/A</td><td>N/A</td></tr><tr><td>Humanoid-v2</td><td>5,939</td><td>400</td><td>400</td><td>N/A</td><td>N/A</td><td>N/A</td><td>1,250</td></tr><tr><td>HumanoidStandup-v2</td><td>163,884</td><td>80,000</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td></tr><tr><td>Humanoid (rllab)</td><td>4,117</td><td>23</td><td>200</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td></tr></table>
303
+
304
+ Table 3: Performance after 1M (except for rllab which is 2M) timesteps on 5 seeds. Values taken from their corresponding papers. N/A means the values were not available in the original paper.
305
+
306
+ # EXPERIMENTAL PARAMETERS
307
+
308
+ Table 4 provides the hyperparameters of ARAC used to obtain results in the MuJoCo domains. The noise input for normalizing flows in SAC policies (see Sec. 2.3) is sampled from $\mathcal { N } ( 0 , \sigma )$ , where the variance $\sigma$ is a function of the state (either fixed at a given value or learned).
309
+
310
+ Table 4: ARAC parameters.
311
+
312
+ <table><tr><td colspan="7">ARAC parameters</td></tr><tr><td></td><td>#flows</td><td>0</td><td>G</td><td>p</td><td>alpha</td><td>strategy</td></tr><tr><td>Ant-v2</td><td>3</td><td>0.2</td><td>10</td><td>1</td><td>0.2</td><td>proactive</td></tr><tr><td>HalfCheetah-v2</td><td>4</td><td>0.4</td><td>20</td><td></td><td>0.2</td><td>proactive</td></tr><tr><td>Hopper-v2</td><td>4</td><td>0.8</td><td>20</td><td></td><td>0.05</td><td>proactive</td></tr><tr><td>Walker2d-v2</td><td>4</td><td>0.6</td><td>10</td><td></td><td>0.05</td><td>proactive</td></tr><tr><td>Humanoid-v2</td><td>3</td><td>0.6</td><td>10</td><td></td><td>0.05</td><td>reactive</td></tr><tr><td>HumanoidStandup-v2</td><td>3</td><td>0</td><td>20</td><td></td><td>0.2</td><td>reactive</td></tr><tr><td>Humanoid (rllab)</td><td>3</td><td>9</td><td>10</td><td></td><td>0.05</td><td>proactive</td></tr><tr><td>SparseHumanoid-v2</td><td>2</td><td>0.6</td><td>20</td><td>2131111</td><td>0.2</td><td>proactive</td></tr><tr><td colspan="7">Adam Optimizer parameters</td></tr><tr><td>αq</td><td colspan="7">3.10-4</td></tr><tr><td>αw</td><td colspan="7">3.10-4</td></tr><tr><td>α</td><td colspan="7">3.10-4</td></tr><tr><td>a</td><td colspan="7">3.10-4</td></tr><tr><td colspan="3">Algorithmparameters</td><td colspan="4"></td></tr><tr><td>Batch size m</td><td colspan="7">256</td></tr><tr><td colspan="2">Buffer size B</td><td colspan="7">106</td></tr><tr><td colspan="2">Archive sample size n</td><td colspan="7">5</td></tr></table>
313
+
314
+ # IMPACT OF NUMBER OF FLOWS ON THE POLICY SHAPE
315
+
316
+ We used a single SAC agent with different radial flows numbers and randomly initialized weights, starting with actions centered at $( 0 , 0 )$ . All flow parameters are $\ell _ { 1 }$ regularized with hyperparameter 2. The agent is trained with the classical evidence lower bound (ELBO) objective augmented with the AR loss (Eq. 1), where the coefficient of the repulsive policy $\pi ^ { \prime }$ is given by $\begin{array} { r } { \beta _ { t } \stackrel { \smile } { = } \frac { 1 0 } { t + 1 } } \end{array}$ . Fig. 8 shows how both the NF and learned variance Gaussian policies manage to recover the target policy. We see that NF takes advantage of its flexible parametrization to adjust its density and can show asymmetric properties unlike the Gaussian distribution. This indeed can have advantage in some non symmetric environment where the Gaussian policy would be trapped into a suboptimal behavior. Finally, increasing the number of flows (from bottom to top) can lead to more complex policy’s shape.
317
+
318
+ ![](images/068a6a98b0db451a89cc30af3c2408532ae00760edf2494bd89935f5c4df961e.jpg)
319
+ Figure 8: Single state didactic illustration of attraction-repulsion operators. Comparing behavior of NF policy against Gaussian policy with learned variance under a repulsive constraint.
320
+
321
+ # 6.1 VARIANCE OF FITNESS IN THE ARCHIVE
322
+
323
+ Due to the high computation time for behavioral-diversity baselines such as DIYAN, we propose to use the agent’s fitness (i.e. undiscounted returns) as a candidate to repulse/attract from.
324
+
325
+ ![](images/9a717f5760f116f2d1161c25e91738a390ee835da2d8bb22df1295ddab31373b.jpg)
326
+ Figure ?? shows the variance of the archive across three MuJoCo domains: Ant, Humanoid and HumanoidStandup. As training progresses, the clustering approach allows to maintain a high variance in the archive, preventing mode collapse to a single, "average" fitness.
327
+
328
+ # 6.2 PSEUDO-CODE FOR ARAC
329
+
330
+ # Algorithm 1 ARAC: Attraction-Repulsion Actor-Critic
331
+
332
+ 1: Input: population size $M$ ; number of elites $K$ ; maximum archive capacity $G$ ; archive samp
333
+ size $n$ ; number of evaluation rollouts $R$ ; actor coefficient $p$ ; strategy (either proactive or reactiv
334
+ 2: Initialize value function network $V _ { \nu }$ and critic network $Q _ { \omega }$
335
+ 3: Initialize population of policy networks $\{ \pi _ { \phi , \theta } ^ { m } \} _ { m = 1 } ^ { M }$
336
+ 4: Initialize empty archive $\mathcal { G }$ and randomly assign $K$ individuals to top- $K$
337
+ 5: total_step $ 0$
338
+ 6: while total_step $\leq$ max_step do
339
+ 7: step $\gets 0$
340
+ 8: for agent $m = 1 \ldots M$ do
341
+ 9: $( \_ , \mathsf { s t e p } s ) \gets \mathtt { r o l l o u t } ( \pi ^ { m }$ , with noise, over 1 episode)
342
+ 10: $\mathrm { s t e p } \gets \mathrm { s t e p } + s$ Collect samples
343
+ 11: total_step total_step + s
344
+ 12: end for
345
+ 13: $C = { \mathsf { s t e p } } / { K }$
346
+ 14: for policy $\pi ^ { e }$ in top- $K$ do
347
+ 15: Update critic with $\pi ^ { e }$ for $C$ mini-batches (Eq. 3) Update critic
348
+ 16: Update value function (Eq. 4)
349
+ 17: end for
350
+ 18: for agent $m = 1 \ldots M$ do
351
+ 19: if policy $\pi ^ { m }$ is in top- $K$ then
352
+ 20: Sample $n$ archived policies uniformly from $\mathcal { G }$
353
+ 21: Update actor $\pi ^ { m }$ for ${ \frac { \mathrm { s t e p } } { M } } \cdot p$ mini-batches (Eq. 5 and 8 or 9) Update actors
354
+ 22: else
355
+ 23: Update actor $\pi ^ { m }$ for ${ \frac { \mathrm { s t e p } } { M } } \cdot p$ mini-batches (Eq. 2)
356
+ 24: end if
357
+ 25: end for
358
+ 26: for agent $m = 1 \ldots M$ do
359
+ 27: $( \mathrm { F i t n e s s } _ { m } , \ l _ { - } ) \gets \mathtt { r o l l o u t } ( \pi ^ { m } ,$ , without noise, over $R$ episodes) Evaluate actors
360
+ 28: end for
361
+ 29: Rank population $\{ \pi _ { \phi , \theta } ^ { m } \} _ { m = 1 } ^ { M }$ and identify top- $K$
362
+ 30: update_archiv $\mathsf { a } ( \mathcal { G } , \{ \pi _ { \phi , \theta } ^ { m } \} _ { m = 1 } ^ { M } , G )$
363
+ 31: end while
364
+
365
+ # COMPLEMENTARY PSEUDO-CODE FOR ARAC
366
+
367
+ Algorithms 2 and 3 respectively provide the pseudo-code of functions rollout and update_archive used in Algorithm 1.
368
+
369
+ # Algorithm 2 rollout
370
+
371
+ Input: actor $\pi$ ; noise status; number of episodes $E$ ; replay buffer $\boldsymbol { B }$ ;
372
+ Fitness $ 0$
373
+ for episode $= 1 , \ldots , E$ do $\mathbf { s } \gets$ Initial state ${ \bf s } _ { 0 }$ from the environment for step $t = 0 \dots$ termination do if with noise then Sample noise $z$ else Set $z \gets 0$ end if $\mathbf { a } _ { t } \sim \pi ( . | \mathbf { s } _ { t } , z )$ Observe $\mathbf { s } _ { t + 1 } \sim P ( \cdot | \mathbf { s } _ { t } , \mathbf { a } _ { t } )$ and obtain reward $r _ { t }$ Fitness $\gets$ Fitness + rt Store transition $( \mathbf { s } _ { t } , \mathbf { a } _ { t } , r _ { t } , \mathbf { s } _ { t + 1 } )$ in $\boldsymbol { B }$ end for
374
+ end for
375
+ Fitness Fitness/ $E$
376
+ return Average fitness per episode and number of steps performed
377
+ Input: archive $\mathcal { G }$ ; population of size $M$ ; maximal archive capacity $G$ .
378
+ if $| { \mathcal { G } } | < G$ then Add all agents of current population to $\mathcal { G }$
379
+ else $c _ { 1 } , c _ { 2 } \gets 2$ -means(fitness of individuals in $\mathcal { G }$ ) for agent $m = 1 , \ldots , M$ do Assign agent $m$ to closest cluster $c \in \{ c _ { 1 } , c _ { 2 } \}$ based on its fitness Sample an archived agent $j \sim \mathrm { U n i f o r m } ( c )$ Replace archived individual $j$ by $m$ end for
380
+ end if
381
+ return Updated archive $\mathcal { G }$
382
+
383
+ <table><tr><td>Algorithm archive</td></tr></table>
md/train/Bk9nkMa4G/Bk9nkMa4G.md ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BAYESIAN EMBEDDINGS FOR LONG-TAILED DATASETS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The statistics of the real visual world presents a long-tailed distribution: a few classes have significantly more training instances than the remaining classes in a dataset. This is because the real visual world has a few classes that are common while others are rare. Unfortunately, the performance of a convolutional neural network is typically unsatisfactory when trained using a long-tailed dataset. To alleviate this issue, we propose a method that discriminatively learns an embedding in which a simple Bayesian classifier can balance the class-priors to generalize well for rare classes. To this end, the proposed approach uses a Gaussian mixture model to factor out class-likelihoods and class-priors in a long-tailed dataset. The proposed method is simple and easy-to-implement in existing deep learning frameworks. Experiments on publicly available datasets show that the proposed approach improves the performance on classes with few training instances, while maintaining a comparable performance to the state-of-the-art on classes with abundant training examples.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep convolutional neural networks (CNN) have achieved impressive results in large-scale visual recognition tasks (Krizhevsky et al., 2012; Simonyan & Zisserman, 2015; Szegedy et al., 2015; Mnih et al., 2015; 2013; He et al., 2016; Huang et al., 2017). However, despite the significant impact in visual perception, the vast majority of these advancements learn from artificially balanced largescale datasets that are not representative of the real visual world (Nene et al., 1996; Griffin et al., 2007; Deng et al., 2009; Quattoni & Torralba, 2009; Lin et al., 2014; Russakovsky et al., 2015). The statistics of the real visual world follow a long-tailed distribution (Zhu et al., 2014; 2016; Van Horn & Perona, 2017; Salakhutdinov et al., 2011; Wang & Hebert, 2016; Wang et al., 2017). This means that a few classes are predominant in the world while others are rare. Consequently, representative real-world datasets have a few classes with significantly more training instances than the remaining classes in the set; see Fig. 1(a) for an illustration of a long-tailed dataset. We refer to classes with abundant training instances as classes in the head, and unrepresented classes as classes in the tail.
12
+
13
+ As Van Horn & Perona (2017) note, the main motivation for visual recognition is to understand and learn from the real visual world. Thus, while the state-of-the-art can challenge humans in visual recognition tasks, it misses a mechanism that effectively learns from long-tailed datasets. As Van Horn & Perona (2017) found, training models using long-tailed datasets often leads to unsatisfying performance. This is because classifiers tend to generalize well for classes in the head, but lack generalization for classes in the tail.
14
+
15
+ To alleviate this issue, learned classifiers need to generalize for classes in the tail while maintaining a good performance for all the classes. Recent efforts that aim to learn from long-tailed datasets consider penalities in the optimization-learning problem (Huang et al., 2016), sampling-based methods (He & Garcia, 2009), and transfer-learning algorithms (Wang & Hebert, 2016; Wang et al., 2017). In contrast with these solutions, the proposed method aims to learn an embedding in which the distribution of the real visual world allows a simple Bayesian classifier to predict robustly given a long-tailed dataset.
16
+
17
+ Long-tailed datasets have class-prior statistics that heavily skew towards classes in the head. This skew can bias classifiers towards classes in the head, and consequently can reduce generalization for classes in the tail. To remove this skew, we appeal to Bayesian classifiers that can explicitly factor out the likelihood and prior when computing posteriors over class labels. Thus, the main goal of this work is to learn a feature embedding in which class prior statistics do not affect/skew class likelihoods. The proposed approach uses a simple Gaussian mixture model (GMM) to describe the statistics of a long-tailed dataset. This is because it enables a clean factorization of the class-likelihoods and class-priors. Moreover, it easily fits within an empirical Bayesian classification framework, because a GMM enables the computation of closed-form maximum likelihood estimation (MLE) of class-specific means, covariance matrices, and priors. We show that such closed-form estimates can be integrated into existing deep learning optimizers without much effort. By fixing the covariance matrices of all the classes to be the identity and the priors over each class to be uniform, we can explicitly enforce that both rare classes in the tail and dominant classes in the head have equal weight for Bayesian classification. In simple terms: we learn a discriminative embedding of training data such that Bayesian classifiers with balanced priors produce accurate class posteriors. As a point of clarity, the proposed approach does not learn an embedding in the traditional Bayesian sense, which might define a prior distribution over embeddings that is then combined with training data to produce a posterior embedding. Rather, it learns a single embedding that is discriminatively trained to produce accurate features for Bayesian classifiers. See Fig. 1 for an illustration about the proposed approach.
18
+
19
+ ![](images/1d2129a3dbac2fa15d2af3f0eb09c915cc1c4fc9698fffe6985a1f92708b292b.jpg)
20
+ Figure 1: (a) The real visual world yields long-tailed datasets. Classes in the head are common (e.g., cats) while classes in the tail are rare (e.g., white reindeers). (b) The proposed approach builds a generative (Bayesian) classifier over a learned embedding to compute class-posterior probabilities. In an empirical Bayesian framework, posteriors are computed through class likelihoods and priors fit to the data (e.g., sample means, variances, and counts assuming Gaussian Mixture Models). We introduce an end-to-end pipeline for jointly learning embeddings and Bayesian models built upon them. (c) Bayesian models are particularly well-suited for long-tailed datasets because class priors and likelihoods can be fixed to be uniform and isotropic, ensuring that the learned representation is balanced across the head and tail.
21
+
22
+ A GMM not only is useful for learning an embedding using a long-tailed dataset, but also provides flexibility at the evaluation stage. This is because it enables the measurement of generalization for classes in the tail by simply setting equal class-prior probabilities. In addition, it enables the possibility of giving more importance to the most frequent classes by adjusting their respective class-prior probabilities.
23
+
24
+ In sum, the proposed approach aims to learn an embedding in which a GMM enables a Bayesian classifier to generalize well for classes in the tail by balancing out class-priors. The proposed method is simple, easy-to-train using deep learning frameworks, and increases classification performance for classes in the tail. The experiments on publicly available datasets show that this approach tends to perform better on classes in the tail than the competing methods, while performing comparable to the state-of-the-art on classes with abundant training instances.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ The main challenges for learning models using long-tailed datasets comprise learning parameters that generalize from a few-shots and avoiding classifier bias. While the proposed approach aims to tackle these two problems simultaneously, methods that tackle each of these problems independently are still relevant. As such, this section not only covers prior work on learning using imbalanced datasets, but also covers relevant solutions for few-shot learning. Given that the proposed approach is based on a GMM model, this section also covers recent approaches that use class-centroid representations for incremental learning and for improving discriminative properties.
29
+
30
+ # 2.1 LEARNING FROM LONG-TAILED DATASETS
31
+
32
+ Simple techniques that deal with imbalanced datasets use random sampling to artificially create a more balanced training set (He & Garcia, 2009). For instance, random oversampling effectively “repeats” training instances from the classes in the tail, while random undersampling “removes” instances from the classes with abundant training instances. Thus, these techniques address imbalanced datasets by means of artificially balancing the training set. An alternative approach to deal with long-tailed datasets use transfer learning techniques. Wang et al. (2017) proposed MetaModelNet, a meta-learning algorithm that learns the evolution of parameters when gradually including more training samples. MetaModelNet improves the performance of CNN models since it transfers the parameter-evolution knowledge from data-rich classes to categories in the tail. Rather than artificially modifying the training set or use transfer learning, the proposed approach aims to learn an embedding that allows classifiers to generalize when learning from a long-tailed dataset. Consequently, the proposed method can complement sampling or transfer-learning-based methods.
33
+
34
+ # 2.2 FEW-SHOT LEARNING AND CLASS-CENTROID-BASED REPRESENTATIONS
35
+
36
+ Recent approaches in this category aim to learn good parameters from a few training instances (Snell et al., 2017; Hariharan & Girshick, 2017). A recent approach that considers an imbalanced dataset to tackle few-shot learning is the work by Hariharan & Girshick (2017). Their proposed approach learns a feature embedding from the classes with the most samples in the dataset. Then, the approach “hallucinates” samples for classes with a few training instances in the learned embedding. While this work learns from an imabalanced dataset, it considers a different setting that that of the proposed approach. The work by Hariharan & Girshick (2017) assumes that classes with few instances are added incrementally. The proposed approach differs in this regard, since the introduced method aims to learn the embedding using the entire long-tailed dataset, generalize, and avoid any bias towards the classes with abundant training instances.
37
+
38
+ To achieve generalization given a few shots in an incremental learning context, Rebuffi et al. (2017) proposed iCaRL, a deep-learning-based incremental classifier. Similarly to the proposed approach, iCaRL represents each class using a single centroid in an embedding learned using a regular CNN model. However, instead of using the learned softmax classifier, it uses a nearestclass-mean (Mensink et al., 2013) classifier. Unlike iCaRL that uses features from a learned CNNsoftmax model, the proposed approach learns an embedding using a generative model. It is worth noting that the proposed approach uses a GMM, which by default includes a nearest-class-mean classifier as part of the learning problem. The use of class-centroids in learning representations is also useful to improve discriminative properties. Wen et al. (2016) proposed a loss that aims to minimize intra-class variation in CNN-softmax models. Unlike the center-loss approach, the proposed method minimizes the intra-class variation automatically by finding the GMM parameters in the learned embedding. Different from the center-loss that requires a mechanism to estimate the class-centroids, the proposed approach uses back-propagation to learn the GMM parameters. A recent approach that aims to generalize by using class-centroid representations are the Prototypical Networks (proto-nets) by Snell et al. (2017). Proto-nets estimate the class centroids from a slice of a mini-batch-like subset of the training set. Then, they evaluate the loss from the complementary slice of the mini-batch-like subset, and update the feature encoder weights. The proposed approach has two main differences with proto-nets. First, the proposed approach is based on generative models describing the statistics of an imbalanced dataset, rather than learning an embedding tailored for a nearest-class-mean classifier that requires specific parameter-update rules. Second, the proposed approach uses regular batching mechanisms and updates parameters using back-propagation. Thus, in constrast with proto-nets, the proposed approach avoids modifying components in the deep learning frameworks.
39
+
40
+ # 3 BAYESIAN EMBEDDINGS
41
+
42
+ The goal of this work is to learn an embedding that allows a simple Bayesian classifier to robustly operate given a long-tailed training dataset. Specifically, this work aims to learn an encoder $f _ { w } ( \cdot )$ , parameterized by its set of weights $w$ , that produces a good representation for Bayesian classification given a long-tailed dataset.
43
+
44
+ In order to learn the aforementioned encoder, the proposed approach requires a model that describes the distribution of the data. Let $x = f _ { w } ( I )$ be the encoded feature for image $I$ and $y$ be its corresponding class label. Thus, the distribution of the training set can be described with the following joint probability:
45
+
46
+ $$
47
+ \begin{array} { r l } & { p ( x , y ) = p ( x \mid y ) p ( y ) } \\ & { \qquad = p ( f _ { w } ( I ) \mid y ; \theta _ { y } ) \pi _ { y } } \\ & { \qquad = p ( x , y ; \ w , \theta ) } \end{array}
48
+ $$
49
+
50
+ where $p ( f _ { w } ( I ) \mid y ; \theta _ { y } )$ represents the likelihood of observing the feature vector $x$ as part of class $y$ , and $\pi _ { y }$ is the prior probabilities for class $y$ . The likelihood is a function with parameters $\theta _ { y }$ (e.g., parameters of a multivariate Gaussian) that describes the distribution of the feature vectors in the embedding. Thus, the joint probability of the data $p ( x , y ; ~ w , \theta )$ is a function with parameters composed by the the encoder $w$ parameters, and the Bayesian parameters $\theta$ which include the likelihood parameters $\theta _ { y }$ , and priors $\pi _ { y }$ . In practice, the likelihood parameters proves most crucial as it is not sensitive to class priors, which can be misleading in the long-tailed setting (as discussed in Section 3.1).
51
+
52
+ Given the above joint probability model, the posterior probability for class $y$ given a feature vector $x$ can be computed using Bayes rule as follows:
53
+
54
+ $$
55
+ p ( y \mid x ; \boldsymbol { w } , \boldsymbol { \theta } ) = \frac { p ( f _ { w } ( I ) \mid y ; \theta _ { y } ) \pi _ { y } } { \sum _ { k } p ( f _ { w } ( I ) \mid k ; \theta _ { k } ) \pi _ { k } } ,
56
+ $$
57
+
58
+ where $\theta$ is a concatenation of the likelihood parameters and priors of all the classes. Thus, the class posterior probability is a function that depends on the encoder parameters $w$ and the Bayesian parameters $\theta$ .
59
+
60
+ The overall objective of this work is to jointly learn the weights $w$ of the feature encoder and the Bayesian parameters $\theta$ to guarantee a good classification performance. Given a training dataset of images and label pairs $\mathcal { D } = \{ ( x _ { i } , y _ { i } ) \}$ , we propose to learn parameters by maximizing the Bayesian class-posterior probability of the true class labels:
61
+
62
+ $$
63
+ \operatorname* { m i n i m i z e } _ { \boldsymbol { w } } \sum _ { i } - \log p ( \boldsymbol { y } _ { i } \mid \boldsymbol { x } _ { i } ; \boldsymbol { w } , \boldsymbol { \theta } ) \qquad \mathrm { s u b j e c t ~ t o } \qquad \boldsymbol { \theta } = \mathbf { M L E } ( \mathcal { D } ) ,
64
+ $$
65
+
66
+ where MLE is a function that computes the closed form maximum likelihood estimates of the parameters of our Bayesian model, a procedure commonly known as Empirical Bayes (Bishop, 2006).
67
+
68
+ To use existing solvers for learning deep networks, we reformulate the problem shown in Eq. (3) as an unconstrained optimization by using a Lagrangian penalty (Boyd & Vandenberghe, 2004) that penalizes solutions which violate the constraint:
69
+
70
+ $$
71
+ \operatorname* { m i n i m i z e } _ { \boldsymbol { w } , \boldsymbol { \theta } } \quad \sum _ { i } - \log p ( y _ { i } \mid \boldsymbol { x } _ { i } ; \boldsymbol { w } , \boldsymbol { \theta } ) + \lambda \| \boldsymbol { \theta } - \mathbf { M } \mathbf { L } \mathbf { E } ( \mathcal { D } ) \| ^ { 2 } \quad ,
72
+ $$
73
+
74
+ where $\lambda \geq 0$ . In this formulation, the optimization explicitly searches over the feature encoder parameters $w$ and the Bayesian parameters $\theta$ so as to maximize class posterior probabilities. The last term penalizes deviations of the $\theta$ parameters from their MLE estimates, effectively acting as a regularizer.
75
+
76
+ # 3.1 GMM EMBEDDINGS FOR HEAVILY TAILED DATASETS
77
+
78
+ GMMs: The likelihood models are crucial to determine the parameters that allows the proposed approach to learn the feature encoder given a long-tailed dataset. We propose to use a multivariate Gaussian probability density function as the likelihood model. Given this likelihood model, the proposed approach implicitly uses a Gaussian mixture model to represent the distribution of the training set. Using a multivariate Gaussian brings benefits to the proposed formulation. This is because its parameters (the centroid $\mu$ , covariance matrix $\Sigma$ , and prior $\pi$ ) have an intuitive meaning and closed-form-maximum-likelihood estimators. Interestingly, as discussed by van den Oord & Schrauwen (2014) and Patel et al. (2016), a mixture of multivariate Gaussians can be used to theoretically motivate the success of deep learning.
79
+
80
+ Balancing: The use of a GMM not only brings simplicity into the formulation, but also allows the feature encoder to generalize better for classes in the tail. The generalization aspect of a GMM model comes from the fact that a class is described with a single centroid. The benefit of this class representation is that estimating the centroid with a handful of examples is simple and produces a good estimate. Perhaps more importantly, a GMM allows us to access specific parameters that control the probabilistic “footprint” of each class in the embedded space. We can set these parameters to ensure balanced footprints by fixing the covariance matrices to be the identity and the class priors to be uniform - see Fig. 1-(c). The remaining parameters to be estimated are then the class means $\boldsymbol { \mu } = ( \mu _ { 1 } , \dots , \mu _ { n _ { c } } )$ . Given this setting and considering that deep-learning frameworks use mini batches, the unconstrained problem shown in Eq. (4) becomes:
81
+
82
+ ![](images/91335f7e72779fdebb18a37fd60ffe71643340e092071ef8efcdf04d035d7840.jpg)
83
+ Figure 2: We compare the effect of gradient-based updates for a traditional softmax classifier versus our Bayesian embedding model. Recall that our approach learns an embedding for which Bayesian classifiers produce accurate class posteriors. During softmax training, an “easy” example of a class will tend to not generate a strong gradient update, and so is not useful for learning (left). This might be considered paradoxical: when children learn a new concept (for say, a never-before-seen animal), an easy or “protypical” example might be most informative for learning. On the other hand, in our framework, an easy example of a class will change its centroid, generating a strong signal for updating our learned representation (right).
84
+
85
+ $$
86
+ \underset { w , \mu } { \mathrm { n i m i z e } } \quad \frac { 1 } { m } \sum _ { i = 1 } ^ { m } - \log \left( \frac { \exp \left( - \frac { 1 } { 2 } \| f _ { w } ( I _ { i } ) - \mu _ { y _ { i } } \| ^ { 2 } \right) } { \sum _ { k } \exp \left( - \frac { 1 } { 2 } \| f _ { w } ( I _ { i } ) - \mu _ { k } \| ^ { 2 } \right) } \right) + \lambda \sum _ { j \in \mathcal { M } } \| \mu _ { j } - \frac { 1 } { n _ { j } } \sum _ { i ^ { \prime } : y _ { i ^ { \prime } } = j } f _ { w } ( I _ { i ^ { \prime } } ) \| ^ { 2 } \quad ,
87
+ $$
88
+
89
+ where $y _ { i }$ is the true class label/index for the $i$ -th data point, $m$ is the batch size, $\mathcal { M }$ is the set of class indices in the batch, $n _ { j }$ is the number of samples of the $j$ -th class in the batch, and $i ^ { \prime }$ is the index running over instances in the batch.
90
+
91
+ # 3.2 DISCUSSION
92
+
93
+ Other probabilistic models: Our analysis and experiments focus on Gaussian Mixture Models, but the general learning problem from Eq. (4) holds for other probabilistic models. For example, deep embeddings can be learned for rectified (nonnegative) or binary features (Agrawal et al., 2014; Erin Liong et al., 2015). For such embeddings, likelihood models based on rectified Gaussians or multivariate Bernoulli distributions may be more appropriate Socci et al. (1998); Teugels (1990). Such models do not appear to have closed form maximum likelihood estimates, and so may be challenging to formulate precisely as a constrained optimization problem.
94
+
95
+ Relationship to softmax: The GMM-based formulation has a direct relationship with softmax classifiers. This relationship can be obtained by expanding the squared distance terms in the classposterior probability, yielding the following:
96
+
97
+ $$
98
+ \begin{array} { r l } & { p \left( y _ { i } \mid f _ { w } ( I _ { i } ) ; \boldsymbol { w } , \mu \right) = \frac { \exp \big ( - \frac { 1 } { 2 } \| f _ { w } ( I _ { i } ) - \mu _ { j } \| ^ { 2 } \big ) } { \sum _ { k } \exp \big ( - \frac { 1 } { 2 } \| f _ { w } ( I _ { i } ) - \mu _ { k } \| ^ { 2 } \big ) } } \\ & { \qquad = \frac { \exp \big ( \mu _ { j } ^ { T } f _ { w } ( I _ { i } ) - \frac { 1 } { 2 } \big ( \| f _ { w } ( I _ { i } ) \| ^ { 2 } + \| \mu _ { j } \| ^ { 2 } \big ) \big ) } { \sum _ { k } \exp \big ( \mu _ { k } ^ { T } f _ { w } ( I _ { i } ) - \frac { 1 } { 2 } \big ( \| f _ { w } ( I _ { i } ) \| ^ { 2 } + \| \mu _ { k } \| ^ { 2 } \big ) \big ) } , } \\ & { \qquad = \frac { \exp \big ( v _ { j } ^ { T } f _ { w } ( I _ { i } ) + b _ { j } \big ) } { \sum _ { k } \exp \big ( v _ { k } ^ { T } f _ { w } ( I _ { i } ) + b _ { k } \big ) } } \end{array}
99
+ $$
100
+
101
+ where $v _ { j } = \mu _ { j }$ and $b _ { j } = - { \textstyle \frac { 1 } { 2 } } \| v _ { j } \| ^ { 2 }$ , since $- \frac { 1 } { 2 } \| f _ { w } ( I _ { i } ) \| ^ { 2 }$ is a common term between the numerator and denominator. This relationship thus indicates that the proposed approach fits linear classifiers with restricted biases. This relationship is useful for an easy implementation in many deep learning frameworks. This is because this approach can be implemented using a dense layer without the bias terms. In addition, this relationship shows that the proposed approach requires fewer parametersto-learn in comparison with classical CNN-softmax models. An more intuitive comparison between GMMs and softmax classifiers can be made with respect to to their parameter updates. Intuitively, during softmax training, an “easy” example of a class will not generate a model update. In some sense, this might be considered paradoxical. When children learn a new concept (for say, a neverbefore-seen animal), they tend to be presented with an easy or “protypical” example. On the other hand, an easy example of a class will change its centroid, generating a signal for learning - see Fig. 2.
102
+
103
+ # 4 EXPERIMENTS
104
+
105
+ This section presents a series of experiments evaluating the learned embedding computed using the proposed method and long-tailed datasets. Since the goal of the experiments is to evaluate the feature encoder, all the experiments trained all the baselines or competing methods and the proposed one from scratch. An additional goal of the experiments is to show that the proposed approach can be adapted to any CNN architecture. For this reason, the experiments also used legacy and recent CNN architectures.
106
+
107
+ Datasets: One evaluation aspect of the experiments is to measure the performance on smalland medium-scale datasets. The experiments included MNIST (LeCun et al., 1998) and CIFAR 10 (Krizhevsky & Hinton, 2009) as the small-scale datasets (each with ten classes); and CIFAR 100 (Krizhevsky & Hinton, 2009) and Tiny ImageNet 1 as the medium-scale datasets (with hundred and two hundred classes, respectively). The balanced MNIST dataset contains 60,000 and 10,000 $2 8 \mathbf { x } 2 8$ training and testing images depicting hand-written digits, respectively. The CIFAR 10 dataset contains 50,000 and $1 0 , 0 0 0 3 2 \mathrm { x } 3 2$ training and testing images, respectively. The CIFAR 100 dataset contains 500 and $1 0 0 \ 3 2 \mathrm { x } \lambda 2$ training and testing images per class, respectively. Lastly, Tiny ImageNet has 500 and 50 64x64 training and testing images for every class, respectively. However, the experiments used a $2 2 4 \mathbf { x } 2 2 4$ image instead. See Sec. 4.1 for details on how the experiments processed these datasets to evaluate classifiers using long-tailed datasets.
108
+
109
+ Baselines: The experiments included recent approaches that deal with imbalanced datasets. These approaches include iCaRL (Rebuffi et al., 2017), center loss (Wen et al., 2016), and a plain softmax classifier. The experiments also consider a variation of iCaRL. This variation does not use normalized feature vectors as originally proposed by Rebuffi et al. (2017). While prototypical networks (Snell et al., 2017) are similar to the proposed approach, they require a balanced dataset with a few training instances for every class. Since prototypical networks do not assume a long-tailed dataset, these experiments did not include it as a competing method. The experiment also considered a method that uses a full GMM model (i.e., full covariance, means, and priors) of a softmax representation of the training set. As discussed in Sec. 2, MetaModelNet (Wang et al., 2017) deals with long-tailed datasets by operating at the classifier-parameter level, since it is a meta-learning algorithm. Thus, MetaModelNet does not learn an embedding, and consequently complements the proposed method.
110
+
111
+ Implementation Details: All the experiments were implemented on top of TensorFlow Models $( \mathrm { T F M } ) ^ { 2 }$ . This open-source project implements various legacy architectures, and several preprocessing imaging techniques (e.g., random translations and shifts). The experiments used the following CNN architectures: LeNet (LeCun et al., 1998) for MNIST; CifarNet (Krizhevsky & Hinton, 2009) for CIFAR 10; AllCNN (Springenberg et al., 2014) for CIFAR 100; and VGG 16 (Simonyan & Zisserman, 2015) for Tiny ImageNet. We implemented center loss (Wen et al., 2016) and verified correctness using a balanced setting. We implemented the proposed approach in TFM using a fully connected layer with a restrictive bias. This is possible thanks to the relationship with linear classifiers discussed in Sec. 3.2. The regularizer was implemented using plain Tensorflow operations and was added as a regularizer function for the fully connected layer with restrictive bias. We will release the code upon publication. The hyperparameters for center-loss and the proposed approach were estimated using a validation set for every dataset. See Sec. A in the Appendix for the specific parameters.
112
+
113
+ ![](images/04550cb04c486edb38153b88e185b99d5ab24c22f5da6dd192fc128774d55a5b.jpg)
114
+ Figure 3: Histogram of the number of training instances per class in the long-tailed datasets. From left to right, the datasets are MNIST, CIFAR 10, CIFAR 100, and Tiny ImageNet.
115
+
116
+ # 4.1 EVALUATION FOR LONG-TAILED DATASETS
117
+
118
+ The main motivation of this work is to learn from a realistic dataset representing the statistics of the real visual world. Recall that realistic datasets are long-tailed since the visual world has a few predominant classes while others are rare. As such, the performance evaluation of the visual recognition system in this setting needs to be discussed, since common evaluation methods may not be adequate given this context.
119
+
120
+ Intuitively, since the visual world yields long-tailed datasets, then the test set should ideally be long-tailed as well. While this rationale is logical given the statistics of the world, it has a main drawback: a simple classifier that is biased towards classes in the head is likely to perform well using a long-tailed testing set. While this setting may reflect a good performance for the common classes in practice, achieving a good performance for classes in the tail is still desirable in real practical applications. For instance, consider a self-driving car: the vehicle may easily detect common objects or events, e.g., pedestrians walking on the sidewalk. However, children playing soccer on the street is a rare event that can occur in the real world, and it is important to evaluate autonomous systems on such rare but crucial events. Thus, although rare events are infrequent, classifiers still need to account for them. Consequently, average accuracy on a long-tailed dataset is not an adequate measure of performance across rare classes.
121
+
122
+ An alternative approach using long-tailed testing sets is to evaluate per-class accuracy. This explicitly weights all classes – both in the head and tail – equally. However, this has the drawback that performance estimates of rare classes in the tail have high variability and can be unreliable. In the autonomous vehicle scenario above, we might encounter very few (or even no) examples of children playing street soccer in any finite testset. This means that performance estimates fort tail classes can be unreliable.
123
+
124
+ We propose an evaluation approach that addresses the bias towards the head and intra-class variation of classes in the tail. The proposed evaluation protocol requires a training and an evaluation procedure. The training setting includes several training trials that used different versions of long-tailed training sets. The evaluation procedure uses a balanced dataset. The use of a balanced testing set addresses the issue of classifiers that are biased towards the head since the class-priors are uniform and both classes in the head and tail contribute to the performance measure. Training a classifier using different long-tailed sets accounts for intra-class variation for classes in the tail. Consequently, aggregates of performance from these different trials account for the intra-class variation noise from classes in the tail. The experiments report a per-class accuracy average, the average class-accuracy, and their standard deviations over three different trails.
125
+
126
+ Because the considered datasets are balanced, the experiments “long-tailed” these datasets following the procedure proposed by Wang et al. (2017). For every class, the procedure computed the number of samples to draw from the balanced set using an exponential distribution. Thus, as the class index grows, the number of training instances decreases according to the exponential distribution. Given the computed number of samples to draw, the procedure randomly selects these instances from the balanced set to generate a training long-tailed dataset version. Fig. 3 shows a visualization of the training-instance distribution of the resultant long-tailed datasets. The experiments used the balanced testing sets because the goal is to measure generalization and overall performance.
127
+
128
+ # 4.2 PERFORMANCE ON LONG-TAILED DATASETS
129
+
130
+ The goal of this experiment is to evaluate the learned embedding using a long-tailed dataset. To do so, the experiments used the long-tailed datasets described above. In particular, the target is to measure any classification improvement for classes in the tail with respect to the regular softmax classifier. Since most of the baselines rely on class-centroids to classify, the experiments use a nearest-class-mean (Mensink et al., 2013) classifier. Thus, the experiments computed the deepfeatures for the training and testing sets after learning the feature encoder $f _ { w } ( \cdot )$ ; a deep feature is the output of $f _ { w } ( \cdot )$ which is the input tensor to the classifier or softmax layer. Then, the experiments computed a class centroid using the long-tailed training set for every method.
131
+
132
+ ![](images/696dbac649133647dbfaa21c3422527d3f197a60b304f84a44f8345d043cce28.jpg)
133
+ Figure 4: Left column: Relative classification accuracy gain of the competing and proposed methods with respect to a softmax classifier using long-tailed datasets. Overall, the proposed method tends to achieve a comparable accuracy to that of a softmax classifier while delivering an increase for tail classes. Right column: The performance of a softmax classifier. The performance for classes in the head is higher than that of the classes in the tail.
134
+
135
+ To measure the classification improvements, the experiments trained all the methods with three different long-tailed datasets and used the balanced testing sets. Then, the experiment computed an average class-accuracy from the three trials for every baseline. To measure the relative performance with respect to a softmax classifier, the experiment computed the ratio between the average classaccuracy of a competing method (i.e., iCaRL (Rebuffi et al., 2017), center loss (Wen et al., 2016), and the proposed method) and the average class-accuracy of a softmax classifier; the softmax classifier is the reference because it tends to bias towards classes in the head (Wang et al., 2017).
136
+
137
+ Table 1: Average relative performance with respect to a softmax classifier for classes in the head (H column) and tail (T column); the relative performance is the ratio between the class accuracies of a competing method and a softmax classifier. The proposed method increases the performance on classes in the tail while maintaining a comparable performance to that of a softmax classifier for classes in the head. Bold numbers indicate the highest performance per dataset in each row.
138
+
139
+ <table><tr><td rowspan="2">Datasets</td><td rowspan="2">iCarl [Unorm] H</td><td rowspan="2">T</td><td rowspan="2">H</td><td rowspan="2">iCarl [Norm] T</td><td rowspan="2">Center loss H</td><td rowspan="2">T</td><td colspan="2">Proposed</td></tr><tr><td>H</td><td>T</td></tr><tr><td>MNIST</td><td>0.98</td><td>1.00</td><td>0.99</td><td>1.01</td><td>0.99</td><td>1.00</td><td>0.99</td><td>1.01</td></tr><tr><td>CIFAR 10</td><td>0.95</td><td>2.22</td><td>0.95</td><td>2.22</td><td>0.92</td><td>1.8</td><td>0.98</td><td>2.44</td></tr><tr><td>CIFAR 100</td><td>0.72</td><td>0.80</td><td>0.83</td><td>0.90</td><td>0.71</td><td>0.66</td><td>0.96</td><td>1.04</td></tr><tr><td>Tiny ImageNet</td><td>0.86</td><td>1.07</td><td>0.95</td><td>1.06</td><td>0.76</td><td>0.8</td><td>0.97</td><td>1.12</td></tr></table>
140
+
141
+ Fig. 4 shows the results of this experiment on small- and medium-scale datasets in the first two rows and last two rows, respectively. The Figure shows the relative performance for all the classes in a dataset in the left column, the class accuracy of a softmax classifier on the right column, and the average class-accuracy of the compared methods in the labels. All the plots in the left column show a black solid line indicating the performance of a softmax classifier. Thus, a decrement falls below the line while an increment raises above the line.
142
+
143
+ The results on the MNIST dataset (first row) show that most of the competing methods perform comparable to that of a softmax classifier. However, the GMM method underperforms for classes in the tail. For this dataset, a softmax classifier does not present a significant bias towards classes in the head. Thus, these results indicate that the competing and proposed methods, with the exception of the GMM, operate well given a dataset with minor visual variations (e.g., illumination variations, pose, occlusion, among others). Consequently, these results effectively work as a sanity check of the proposed and competing methods (i.e., iCaRl and Centerloss). The results on CIFAR 10 (second row) show that the proposed approach and competing methods tend to perform comparable to a softmax classifier for classes in the head (i.e., the first three classes). In addition, the results show that the GMM also underperforms for classes in the tail. However, the proposed approach and competing methods tend to increase relative performance for classes in the tail. In this dataset, the proposed approach achieved an average class-accuracy of $68 \%$ , which is the highest compared to all the methods.
144
+
145
+ The plots in the third row show the results on CIFAR 100. The plot in the left shows that the proposed method achieves a comparable performance with respect to a softmax classifier for classes in the head (i.e., the first twenty classes). On the other hand, the competing methods have a larger decrease in accuracy for classes in the head. The GMM in this dataset again underperforms for classes in the tail. The plot in the left shows that the proposed approach tends to increase the relative performance for classes in the tail. Overall, they tend to be larger than those of the competing methods and a softmax classifier. Lastly, the plot at the bottom shows the results on Tiny ImageNet. The plot in the left shows similar observations. The proposed approach maintains a comparable performance with respect to a softmax classifier for classes in the head. However, it delivers an increase in relative performance for classes in the tail. The GMM approach suffers for classes in the tail because the covariance estimates are poor due to the lack of data.
146
+
147
+ To highlight the previous observations, Table 1 shows a break down of the average relative performance for classes in the head (H column) and in the tail (T column); this experiment excludes the GMM approach. To measure an average relative performance for classes in the head, the experiments used a weighted average of the relative performance considering all the classes. The average used the fraction of instances for a given class in the training set as its corresponding weight. Specifically, the weight for the $i$ -th class is $\begin{array} { r } { w _ { i } = { \frac { n _ { i } } { n } } } \\ { \qquad \mathbf { \cdots } \qquad } \end{array}$ , where $n _ { i }$ is the number of training instances for the $i$ -th class and $n$ is the total number of training instances in the long-tailed training set. Thus, this average emphasizes the relative performance of classes with abundant training instances while decreasing the contribution of the classes with scarce training data. To compute a weighted average of the relative performance for classes in the tail, the experiment calculated the weight $w _ { i } ^ { \prime }$ for the $i$ -th class as follows: $\begin{array} { r } { w _ { i } ^ { \prime } = \frac { 1 - w _ { i } } { \sum _ { i } 1 - w _ { i } } } \end{array}$ These weights emphasize the relative performance of the classes in the tail while diminishing the relative performance of classes in the head. The results in Table 1 show that the proposed method maintains a comparable peformance for classes in the head with respect to a softmax classifier. At the same time, the proposed method consistently improves the performance for classes in the tail.
148
+
149
+ Table 2: Classification performance improvement by using the regularizer in the proposed approach on CIFAR 10. The proposed approach with regularizer achieves a higher classification accuracy than the approach without the regularizer.
150
+
151
+ <table><tr><td rowspan="2">Configuration</td><td colspan="10">Class Index</td><td rowspan="2">Avg. Acc.</td></tr><tr><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td></tr><tr><td>w/regularizer</td><td>81</td><td>85</td><td>68</td><td>62</td><td>67</td><td>58</td><td>70</td><td>61</td><td>65</td><td>68</td><td>68</td></tr><tr><td>w/o regularizer</td><td>72</td><td>72</td><td>57</td><td>63</td><td>65</td><td>55</td><td>67</td><td>63</td><td>68</td><td>58</td><td>64</td></tr></table>
152
+
153
+ ![](images/2d8f2a40598e5cf35e43968af729b45f30c97d6162de793775d9693763a43076.jpg)
154
+ Figure 5: Accuracy increase achieved by using the proposed regularizer on CIFAR 100. Overall, the proposed approach with regularizer tends to increase the accuracy across all classes compared to the proposed approach without one.
155
+
156
+ # 4.3 EFFECT OF THE CENTROIDS REGULARIZER
157
+
158
+ The goal of this experiment is to measure the benefits of the regularizer in the proposed method. To do so, this experiment compared the proposed method with a hyperparemeter $\lambda = 0$ , leaving only the Bayesian classifier, and the configuration tested in the previous Section. Note that this setting is equivalent to only using a linear classifier with restricted bias, according to the discussion in Sec. 3.2. This experiment only considered CIFAR 10 and 100, and tested performance also considering three different long-tailed training sets for each dataset.
159
+
160
+ The results of this experiment on CIFAR 10 are shown in Table 2. The table shows the average accuracies per class for the proposed method using a regularizer with $\lambda = 0 . 0 0 1$ (top row), and without a regularizer (bottom row). The last column of the table shows the average classification performance. This table shows that the regularizer overall improves classification performance. This is expected since the regularizer aims to retain the centroid-parameters that are as close as possible to the batch-sample-mean centroids.
161
+
162
+ Fig. 5 presents the results of this experiment on CIFAR 100. The plot shows the accuracy gains obtained by comparing the accuracies of the proposed method using a regularizer with $\lambda = 0 . 0 0 0 1$ across all classes. Also, the plot shows the average accuracies for both methods. The plot indicates that the regularizer consistently provides an accuracy increase across classes. Thus, the regularizer is an important component that overall improves the classification performance.
163
+
164
+ # 5 CONCLUSION
165
+
166
+ This work introduced a method that improves the classification performance for classes in the tail. The proposed approach is based on a Gaussian mixture model that allows a Bayesian classifier to represent the distribution of a long-tailed dataset and to compute the class-prediction probabilities. The experiments on publicly available dataset show that the proposed approach tends to increase the classification accuracy for classes in the tail while maintaining a comparable accuracy to that of a softmax classifier for classes in the head. In addition, this work introduced an evaluation method for methods that tackle the learning of concepts from a long-tailed dataset. Finally, this work demonstrated that class-centroid approaches overall tend to generalize well for classes in the tail while maintaining a comparable performance to that of a softmax classifiers for classes in the head.
167
+
168
+ # REFERENCES
169
+
170
+ Pulkit Agrawal, Ross Girshick, and Jitendra Malik. Analyzing the performance of multilayer neural networks for object recognition. In European conference on computer vision, pp. 329–344. Springer, 2014.
171
+
172
+ Christopher M Bishop. Pattern recognition and machine learning. springer, 2006.
173
+
174
+ Stephen Boyd and Lieven Vandenberghe. Convex optimization. Cambridge university press, 2004.
175
+
176
+ J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A Large-Scale Hierarchical Image Database. In Proc. of the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2009.
177
+
178
+ Venice Erin Liong, Jiwen Lu, Gang Wang, Pierre Moulin, and Jie Zhou. Deep hashing for compact binary codes learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2475–2483, 2015.
179
+
180
+ Gregory Griffin, Alex Holub, and Pietro Perona. Caltech-256 object category dataset, 2007.
181
+
182
+ Bharath Hariharan and Ross Girshick. Low-shot visual recognition by shrinking and hallucinating features. In Proc. of the IEEE International Conf. on Computer Vision (ICCV), October 2017.
183
+
184
+ Haibo He and Edwardo A Garcia. Learning from imbalanced data. IEEE Trans. on Knowledge and Data Engineering, 21(9):1263–1284, 2009.
185
+
186
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proc. of the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), June 2016.
187
+
188
+ Chen Huang, Yining Li, Chen Change Loy, and Xiaoou Tang. Learning deep representation for imbalanced classification. In Proc. of the IEEE Conf. Computer Vision and Pattern Recognition (CVPR), June 2016.
189
+
190
+ Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In Proc. of the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2017.
191
+
192
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014.
193
+
194
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. 2009.
195
+
196
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems (NIPS). 2012.
197
+
198
+ 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.
199
+
200
+ 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.
201
+
202
+ Thomas Mensink, Jakob Verbeek, Florent Perronnin, and Gabriela Csurka. Distance-based image classification: Generalizing to new classes at near-zero cost. IEEE Transactions on Pattern Analysis and Machine Intelligence, 35(11):2624–2637, 2013.
203
+
204
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin A. Riedmiller. Playing atari with deep reinforcement learning. CoRR, abs/1312.5602, 2013.
205
+
206
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
207
+
208
+ Sameer A. Nene, Shree K. Nayar, and Hiroshi Murase. Columbia object image library (coil-20. Technical report, 1996.
209
+
210
+ Ankit B Patel, Minh Tan Nguyen, and Richard Baraniuk. A probabilistic framework for deep learning. In Advances in Neural Information Processing Systems (NIPS), pp. 2558–2566. 2016.
211
+
212
+ Ariadna Quattoni and Antonio Torralba. Recognizing indoor scenes. In Proc of the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2009.
213
+
214
+ Sylvestre-Alvise Rebuffi, Alexander Kolesnikov, Georg Sperl, and Christoph H. Lampert. iCaRL: Incremental Classifier and Representation Learning. In Proc. of the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), July 2017.
215
+
216
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li FeiFei. Imagenet large scale visual recognition challenge. Int. J. Comput. Vision (IJCV), 115(3): 211–252, December 2015.
217
+
218
+ Ruslan Salakhutdinov, Antonio Torralba, and Josh Tenenbaum. Learning to share visual appearance for multiclass object detection. In Proc. of the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2011.
219
+
220
+ K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In Proc. of the International Conference on Learning Representations (ICLR), 2015.
221
+
222
+ J. Snell, K. Swersky, and R. S. Zemel. Prototypical Networks for Few-shot Learning. In Advances in Neural Information Processing Systems (NIPS). 2017.
223
+
224
+ Nicholas D Socci, Daniel D Lee, and H Sebastian Seung. The rectified gaussian distribution. In Advances in neural information processing systems, pp. 350–356, 1998.
225
+
226
+ Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. arXiv preprint arXiv:1412.6806, 2014.
227
+
228
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proc. of the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), June 2015.
229
+
230
+ Jozef L Teugels. Some representations of the multivariate bernoulli and binomial distributions. Journal of multivariate analysis, 32(2):256–268, 1990.
231
+
232
+ Aaron van den Oord and Benjamin Schrauwen. Factoring variations in natural images with deep gaussian mixture models. In Advances in Neural Information Processing Systems (NIPS), pp. 3518–3526. 2014.
233
+
234
+ Grant Van Horn and Pietro Perona. The devil is in the tails: Fine-grained classification in the wild. arXiv preprint arXiv:1709.01450, 2017.
235
+
236
+ Yu-Xiong Wang and Martial Hebert. Learning from Small Sample Sets by Combining Unsupervised Meta-Training with CNNs. In Advances in Neural Information Processing Systems (NIPS). 2016.
237
+
238
+ Yu-Xiong Wang, Deva Ramanan, and Martial Hebert. Learning To Model the Tail. In Advances in Neural Information Processing Systems (NIPS). 2017.
239
+
240
+ Yandong Wen, Kaipeng Zhang, Zhifeng Li, and Yu Qiao. A discriminative feature learning approach for deep face recognition. In Proc. of the European Conference on Computer Vision (ECCV), pp. 499–515. Springer, 2016.
241
+
242
+ Xiangxin Zhu, Dragomir Anguelov, and Deva Ramanan. Capturing long-tail distributions of object subcategories. In Proc. of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2014.
243
+
244
+ Xiangxin Zhu, Carl Vondrick, Charless C. Fowlkes, and Deva Ramanan. Do we need more training data? International Journal of Computer Vision (IJCV), 119(1):76–92, Aug 2016.
245
+
246
+ # A HYPERPARAMETERS AND IMPLEMENTATION DETAILS
247
+
248
+ In order to guarantee similar training conditions for all the methods, the experiments used the same framework parameters (e.g., number of steps, learning rate, decay factors, among others) for all the considered methods.
249
+
250
+ All the tested methods used an Adam optimizer (Kingma & Ba, 2014) and a batch size of 32. The experiments used a learning rate of 0.01 and 0.1 for the small- and medium-scale datasets, respectively. The experiments used the default exponential-learning-rate decay, weight decay, and drop-out parameters provided in TensorFlow Models. The hyperparameters used for center-loss are 0.5 for the centroids learning rate and a scale value of 0.001 for MNIST and CIFAR 10, 0.0001 for CIFAR 100 and Tiny ImageNet the proposed method. The hyperparameter for the proposed approach was set to 0.001 for MNIST and CIFAR 10, and 0.0001 for CIFAR 100 and Tiny ImageNet.
md/train/BkgXT24tDS/BkgXT24tDS.md ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADDITIVE POWERS-OF-TWO QUANTIZATION:AN EFFICIENT NON-UNIFORM DISCRETIZATION FORNEURAL NETWORKS
2
+
3
+ Yuhang Li †∗, $\mathbf { X i n ~ D o n g ^ { \delta * } }$ , Wei Wang †
4
+ †National University of Singapore, §Harvard University
5
+ loafyuhang@gmail.com, xindong@g.harvard.edu, wangwei@comp.nus.edu.sg
6
+
7
+ # ABSTRACT
8
+
9
+ We propose Additive Powers-of-Two (APoT) quantization, an efficient nonuniform quantization scheme for the bell-shaped and long-tailed distribution of weights and activations in neural networks. By constraining all quantization levels as the sum of Powers-of-Two terms, APoT quantization enjoys high computational efficiency and a good match with the distribution of weights. A simple reparameterization of the clipping function is applied to generate a better-defined gradient for learning the clipping threshold. Moreover, weight normalization is presented to refine the distribution of weights to make the training more stable and consistent. Experimental results show that our proposed method outperforms state-of-the-art methods, and is even competitive with the full-precision models, demonstrating the effectiveness of our proposed APoT quantization. For example, our 4-bit quantized ResNet-50 on ImageNet achieves $7 6 . 6 \%$ top-1 accuracy without bells and whistles; meanwhile, our model is capable to decrease $22 \%$ computational cost compared with the uniformly quantized counterpart. 1
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Deep Neural Networks (DNNs) have made a significant improvement for various real-world applications. However, the huge memory and computational cost impede the mass deployment of DNNs, e.g., on resource-constrained devices. To reduce memory footprint and computational burden, several model compression methods such as quantization (Zhou et al., 2016), pruning (Han et al., 2015) and low-rank decomposition (Denil et al., 2013) have been widely explored.
14
+
15
+ In this paper, we focus on the neural network quantization for efficient inference. Two operations are involved in the quantization process, namely clipping and projection. The clipping operation sets a full precision number to the range boundary if it is outside of the range; the projection operation maps each number (after clipping) into a predefined quantization level (a fixed number). We can see that both operations incur information loss. A good quantization method should resolve the two following questions/challenges, which correspond to two contradictions respectively.
16
+
17
+ How to determine the optimal clipping threshold to balance clipping range and projection resolution? The resolution indicates the interval between two quantization levels; the smaller the interval, the higher the resolution. The first contradiction is that given a fixed number of bits to represent weights, the range and resolution are inversely proportional. For example, a larger range can clip fewer weights; however, the resolution becomes lower and thus damage the projection. Note that slipshod clipping of outliers can jeopardize the network a lot (Zhao et al., 2019) although they may only take $1 \%$ of all weights in one layer. Previous works have tried either pre-defined (Cai et al., 2017; Zhou et al., 2016) or trainable (Choi et al., 2018b) clipping thresholds, but how to find the optimal threshold during training automatically is still not resolved.
18
+
19
+ How to design quantization levels with consideration for both the computational efficiency and the distribution of weights? Most of the existing quantization approaches (Cai et al., 2017; Gong et al., 2019) use uniform quantization although non-uniform quantization can usually achieve better accuracy (Zhu et al., 2016). The reason is that projection against uniform quantization levels are much more hardware-friendly (Zhou et al., 2016). However, empirical study (Han et al., 2015) has shown that weights in a layer of DNN follow a bell-shaped and long-tailed distribution instead of a uniform distribution (as shown in the right figure). In other words, a fair percentage of weights concentrate around the mean (peak area); and a few weights are of relatively high magnitude and out of the quantization range (called outliers). Such distribution also exists in activations (Miyashita et al., 2016). The second contradiction is: considering the bell-shaped distribution of weight, it is well-motivated to assign higher resolution (i.e. smaller quantization interval) around the mean; however, such non-uniform quantization levels will introduce high computational overhead. Powers-of-Two quantization levels (Miyashita et al., 2016; Zhou et al., 2017) are then proposed because of its cheap multiplication implemented by shift operations on hardware, and super high resolution around the mean. However, the vanilla powers-of-two quantization method only increases the resolution near the mean and ignores other regions at all when the bit-width is increased. Consequently, it assigns inordinate quantization levels for a tiny range around the mean. To this end, we propose additive Powers-of-Two (APoT) quantization to resolve these two contradictions, our contribution can be listed as follows:
20
+
21
+ ![](images/ac3ca25c85bb9d61445f20df0c9161b4ffa7e70781fbe8ea4ef4c47a284f6eb9.jpg)
22
+ Figure 1: Density of weights in ResNet-18
23
+
24
+ 1. We introduce the APoT quantization scheme for the weights and activations of DNNs. APoT is a non-uniform quantization scheme, in which the quantization levels is a sum of several PoT terms and can adapt well to the bell-shaped distribution of weights. APoT quantization enjoys an approximate $2 \times$ multiplication speed-up compared with uniform quantization on both generic and specific hardware. 2. We propose a Reparameterized Clipping Function (RCF) that can compute a more accurate gradient for the clipping threshold and thus facilitate the optimization of the clipping threshold. We also introduce weight normalization for neural network quantization. Normalized weights in the forward pass are more stable and consistent for clipping and projection. 3. Experimental results show that our proposed method outperforms state-of-the-art methods, and is even competitive with the full-precision implementation with higher computational efficiency. Specifically, our 4-bit quantized ResNet-50 on ImageNet achieve $7 6 . 6 \%$ Top-1 and $9 3 . 1 \%$ Top-5 accuracy. Compared with uniform quantization, our method can decrease $22 \%$ computational cost, demonstrating the proposed algorithm is hardware-friendly.
25
+
26
+ # 2 METHODOLOGY
27
+
28
+ # 2.1 PRELIMINARIES
29
+
30
+ Suppose kernels in a convolutional layer are represented by a 4D tensor $\mathcal { W } \in \mathbb { R } ^ { C _ { o u t } \times C _ { i n } \times K \times K }$ , where $C _ { o u t }$ and $C _ { i n }$ are the number of output and input channels respectively, and $K$ is the kernel size. We denote the quantization of the weights as
31
+
32
+ $$
33
+ \begin{array} { r } { \hat { \mathcal { W } } = \Pi _ { \mathcal { Q } ( \alpha , b ) } \lfloor \mathcal { W } , \alpha \rceil , } \end{array}
34
+ $$
35
+
36
+ where $\alpha$ is the clipping threshold and the clipping function $[ \cdot , \alpha ]$ clips weights into $[ - \alpha , \alpha ]$ . After clipping, each element of $\mathcal { W }$ is projected by $\Pi ( \cdot )$ onto the quantization levels. We denote $\mathcal { Q } ( \alpha , b )$ for a set of quantization levels, where $b$ is the bit-width. For uniform quantization, the quantization levels are defined as
37
+
38
+ $$
39
+ \mathcal { Q } ^ { u } ( \alpha , b ) = \alpha \times \{ 0 , \frac { \pm 1 } { 2 ^ { b - 1 } - 1 } , \frac { \pm 2 } { 2 ^ { b - 1 } - 1 } , \frac { \pm 3 } { 2 ^ { b - 1 } - 1 } , \ldots , \pm 1 \} .
40
+ $$
41
+
42
+ For every floating-point number, uniform quantization maps it to a $b$ -bit fixed-point representation (quantization levels) in $\mathcal { Q } ^ { u } ( \alpha , b )$ . Note that $\alpha$ is stored separately as a full-precision floating-point number for each whole $\mathcal { W }$ . Convolution is done against the quantization levels first and the results are then multiplied by $\alpha$ . Arithmetical computation, e.g., convolution, can be implemented using low-precision fixed point operations on hardware, which are substantially cheaper than their floating-point contradictory (Goldberg, 1991). Nevertheless, uniform quantization does not match the distribution of weights (and activations), which is typically bell-shaped (Han et al., 2015). A straightforward solution is to assign more quantization levels (higher resolution) for the peak of the distribution and fewer levels (lower resolution) for the tails. However, it is difficult to implement the arithmetical operations for the non-uniform quantization levels efficiently.
43
+
44
+ ![](images/c73baa7a1cd6bb5846b071beac43506a8cd785aea78c61ec29270271ff274fee.jpg)
45
+ Figure 2: Quantization of unsigned data to 3-bit or 4-bit $( \alpha = 1 . 0 $ ) using three different quantization levels. APoT quantization has a more reasonable resolution assignment and it does not suffer from the rigid resolution.
46
+
47
+ # 2.2 ADDITIVE POWERS-OF-TWO QUANTIZATION
48
+
49
+ To solve the contradiction between non-uniform resolution and hardware efficiency, Powers-ofTwo (PoT) quantization (Miyashita et al., 2016; Zhou et al., 2017) is proposed by constraining quantization levels to be powers-of-two values or zero, i.e.,
50
+
51
+ $$
52
+ \begin{array} { r } { \underline { { Q } } ^ { p } ( \alpha , b ) = \alpha \times \{ 0 , \pm 2 ^ { - 2 ^ { b - 1 } + 1 } , \pm 2 ^ { - 2 ^ { b - 1 } + 2 } , . . . , \pm 2 ^ { - 1 } , \pm 1 \} . } \end{array}
53
+ $$
54
+
55
+ Apparently, as a non-uniform quantizer, PoT has a higher resolution for the value range with denser weights because of its exponential property. Furthermore, multiplication between a Powers-of-two number $2 ^ { x }$ and the other operand $r$ can be implemented by bit-wise shift instead of bulky digital multipliers, i.e.,
56
+
57
+ $$
58
+ 2 ^ { x } r = { \left\{ \begin{array} { l l } { r } & { { \mathrm { ~ i f ~ } } x = 0 } \\ { r < < x } & { { \mathrm { ~ i f ~ } } x > 0 , } \\ { r > > x } & { { \mathrm { ~ i f ~ } } x < 0 } \end{array} \right. }
59
+ $$
60
+
61
+ where $> >$ denotes the right shift operation and is computationally cheap, which only takes 1 clock cycle in modern CPU architectures.
62
+
63
+ However, we find that PoT quantization does not benefit from more bits. Assume $\alpha$ is 1, as shown in Equation (3), when we increase the bit-width from b to b + 1, the interval [−2−2b−1+1, 2−2b−1+1] will be split into $2 ^ { b - 1 } - 1$ sub-intervals, whereas all other intervals remain unchanged. In other words, by increasing the bit-width, the resolution will increase only for $[ - 2 ^ { - 2 ^ { b - 1 } + 1 } , 2 ^ { - 2 ^ { b - 1 } + 1 } ]$ . We refer this phenomenon as the rigid resolution of PoT quantization. Take $\mathcal { Q } ^ { p } ( 1 , 5 )$ as an example, the two smallest positive levels are $2 ^ { - 1 5 }$ and $2 ^ { - 1 4 }$ , which is excessively fine-grained. In contrast, the two largest levels are $2 ^ { - 1 }$ and $2 ^ { 0 }$ , whose interval is large enough to incur high projection error for weights between $[ 2 ^ { - 1 } , 2 ^ { 0 } ]$ , e.g., 0.75. The rigid resolution is demonstrated in Figure 2(b). When we change from from 3-bit to 4-bit, all new quantization levels concentrate around 0 and thus cannot increase the model’s expressiveness effectively.
64
+
65
+ ![](images/b463f44038b337fd8ebc5c453fd6d8c77e25551f39f417fe6b886196dc7ef5d3.jpg)
66
+ Figure 3: Hardware accelerator with different quantization schemes. When $k$ increase, weights usually has less PoT terms, thus accelerates the computation.
67
+
68
+ To tackle the rigid resolution problem, we propose Additive Powers-of-Two (APoT) quantization. Without loss of generality, in this section, we only consider unsigned numbers for simplicity2. In APoT quantization, each level is the sum of n PoT terms as shown below,
69
+
70
+ $$
71
+ \mathcal { Q } ^ { a } ( \alpha , k n ) = \gamma \times \{ \sum _ { i = 0 } ^ { n - 1 } p _ { i } \} \mathrm { w h e r e } p _ { i } \in \{ 0 , \frac { 1 } { 2 ^ { i } } , \frac { 1 } { 2 ^ { i + n } } , . . . , \frac { 1 } { 2 ^ { i + ( 2 ^ { k } - 2 ) n } } \} ,
72
+ $$
73
+
74
+ where $\gamma$ is a scaling coefficient to make sure the maximum level in ${ \mathcal { Q } } ^ { a }$ is $\alpha , \ k$ is called the base bit-width, which is the bit-width for each additive term, and $n$ is the number of additive terms. When the bit-width $b$ and the base bit-width $k$ is set, $n$ can be calculated by $\begin{array} { r } { n = { \frac { b } { k } } } \end{array}$ . There are $2 ^ { k n } = 2 ^ { b }$ $b$ which provides a higher resolution for the non-uniform levels.
75
+
76
+ We use $b \ = \ 4$ and $k \ = \ 2$ as an example to illustrate how APoT resolves the rigid resolution problem. For this example, we have $p _ { 0 } \in \{ 0 , 2 ^ { 0 } , 2 ^ { - 2 } , 2 ^ { - 4 } \}$ , $p _ { 1 } \in \{ 0 , 2 ^ { - 1 } , 2 ^ { - 3 } , 2 ^ { - 5 } \} ,$ $\gamma = 2 \alpha / 3$ , and ${ \mathcal { Q } } ^ { a } ( \alpha , k n ) = \{ \gamma \times ( p _ { 0 } + p _ { 1 } ) \}$ for all $( 2 ^ { b } = 1 6 )$ combinations of $p _ { 0 }$ and $p _ { 1 }$ . First, we can see the smallest positive quantization level in $\mathcal { Q } ^ { a } ( 1 , 4 )$ is $2 ^ { - 4 } / 3$ . Compared with the original PoT levels, APoT allocates quantization levels prudently for the central area. Second, APoT generates 3 new quantization levels between $2 ^ { 0 }$ and $\bar { 2 } ^ { - 1 }$ , to properly increase the resolution. In Figure 2, the second row compares the 3 quantization methods using 4 bits for range [0, 1]. APoT quantization has a reasonable distribution of quantization levels, with more levels in the peak area (near 0) and relatively higher resolution than the vanilla PoT quantization at the tail (near 1).
77
+
78
+ Relation to other quantization schemes. On the one hand, the fixed-point number representations used in the uniform quantization is a special case of APoT. When $k ~ = ~ 1$ in Equation (5), the quantization levels is a sum of $b$ PoT terms or 0. In the fixed-point representations, each bit indicates one specific choice of the additive terms. On the other hand, when $k = b$ , there is only one PoT term and $\bar { \mathcal { Q } } ^ { a } ( \alpha , b )$ becomes $\mathcal { Q } ^ { p } ( \alpha , b )$ , i.e., PoT quantization. We can conclude that when $k$ decreases, APoT levels are decomposed into more PoT terms, and the distribution of levels becomes more uniform. Our experiments use $k = 2$ , which is an intermediate choice between the uniform case $k = 1 ,$ ) and the vanilla PoT case $k = b$ ).
79
+
80
+ Computation. Multiplication for fixed-point numbers can be implemented by shifting the multiplicand (i.e., the activations) and adding the partial product. The $n$ in Equation (5) denotes the Since number of additive PoT terms in the multiplier (weights), and control the speed of computation. $\begin{array} { r } { n = \frac { b } { k } } \end{array}$ , either decreasing $b$ or increasing $k$ can accelerate the multiplication. Compared with uniform quantization $k = 1 ,$ ), our method $k = 2$ ) is approximately $2 \times$ faster in multiplication. As for the full precision $\alpha$ , it is a coefficient for all weights in a layer and can be multiplied only once after the multiply-accumulate operation is finished. Figure 3 shows the hardware accelerator, the weights buffer takes $k$ -bit as a PoT term and shift-adds the activations.
81
+
82
+ Generalizing to $2 n + 1$ bits. When $k = 2$ , APoT quantization can only leverages $2 n$ -bit width for quantization. To deal with $2 n + 1$ -bit quantization, we choose to add $n + 1$ PoT terms, one of which only contains 2 levels. The formulation is given by
83
+
84
+ $$
85
+ \mathcal { Q } ^ { a } ( \alpha , 2 n + 1 ) = \gamma \times \ \{ \sum _ { i = 0 } ^ { n - 1 } p _ { i } + \tilde { p } \} \ \mathrm { w h e r e } \ p _ { i } \in \{ 0 , \frac { 1 } { 2 ^ { i } } , \frac { 1 } { 2 ^ { i + n } } , \frac { 1 } { 2 ^ { i + 2 n + 1 } } \} , \ \tilde { p } \in \{ 0 , \frac { 1 } { 2 ^ { i + 2 n } } \} .
86
+ $$
87
+
88
+ Take 3-bit APoT quantization as an example, every level is a sum of one $p _ { 0 }$ and one $\tilde { p }$ , where $p _ { 0 } \in \{ 0 , 2 ^ { - 1 } , 2 ^ { - 2 } , \bar { 2 } ^ { - 4 } \}$ and $\tilde { p } \in \{ 0 , 2 ^ { - 3 } \}$ . The forward function is plotted in Figure 2(c).
89
+
90
+ # 2.3 REPARAMETERIZED CLIPPING FUNCTION
91
+
92
+ Besides the projection operation, the clipping operation $[ \mathcal { W } , \alpha ]$ is also important for quantization. $\alpha$ is a threshold that determines the value range of weights in a quantized layer. Tuning the clipping threshold $\alpha$ is a key challenge because of the long-tail distribution of the weights. Particularly, if $\alpha$ is too large (e.g., the maximum absolute value of $\mathcal { W }$ ), $\mathcal { Q } ( \alpha , b )$ would have a wide range and then the projection will lead to large error as a result of insufficient resolution for the weights in the central area; if $\alpha$ is too small, more outliers will be clipped slipshodly. Considering the distribution of weights can be complex and differs across layers and training steps, a static clipping threshold $\alpha$ for all layers is not optimal.
93
+
94
+ To jointly optimize the clipping threshold $\alpha$ and weights via SGD during training, Choi et al. (2018b) apply the Straight-Through Estimator (STE) (Bengio et al., 2013) to do the backward propagation for the projection operation. According to STE, the gradient to $\alpha$ is computed by $\begin{array} { r } { \frac { \partial \hat { \mathcal { W } } } { \partial \alpha } \approx \frac { \partial \lfloor \mathcal { W } , \alpha \rceil } { \partial \alpha } = } \end{array}$ $\mathrm { s i g n } ( { \mathscr W } )$ when $| \mathcal { W } | > \alpha$ otherwise 0, where the weights outside of the range cannot contribute to the gradients, which results in inaccurate gradient approximation. To provide a refined gradient for the clipping threshold, we design a Reparameterized Clipping Function (RCF) as
95
+
96
+ $$
97
+ \hat { \mathcal { W } } = \alpha \Pi _ { \mathcal { Q } ( 1 , b ) } \big [ \frac { \mathcal { W } } { \alpha } , 1 \big ] .
98
+ $$
99
+
100
+ Instead of directly clipping them to $[ - \alpha , \alpha ]$ , RCF outputs a constant clipping range and re-scales weights back after the projection, which is mathematically equivalent to Equation (1) during forward. In backpropagation, STE is adopted for the projection operation and the gradients of $\alpha$ are calculated by
101
+
102
+ $$
103
+ \frac { \partial \hat { \mathcal { W } } } { \partial \alpha } = \left\{ \begin{array} { l l } { \mathrm { s i g n } ( \mathcal { W } ) } & { \mathrm { i f ~ } | \mathcal { W } | > \alpha } \\ { \displaystyle \Pi _ { \mathcal { Q } ( 1 , b ) } \frac { \mathcal { W } } { \alpha } - \frac { \mathcal { W } } { \alpha } } & { \mathrm { i f ~ } | \mathcal { W } | \leq \alpha } \end{array} \right.
104
+ $$
105
+
106
+ The detail derivation of the gradients is shown in Appendix A. Compared with the normal clipping function, RCF provides more accurate gradient signals for the optimization because both weights inside $( | \mathcal { W } | \leq \alpha )$ and out of $( | \mathcal { W } | > \alpha )$ the range can contribute to the gradient for the clipping threshold. Particularly, the outliers are responsible for the clipping, and the weights in $[ - \alpha , \alpha ]$ are for projection. Therefore, the update of $\alpha$ considers both clipping and projection, and tries to find a balance between them. In experiments, we observe that the clipping threshold will become universally smaller when the bit-width is reduced to guarantee sufficient resolution, which further validates the efficaciousness of the gradient in RCF.
107
+
108
+ # 2.4 WEIGHT NORMALIZATION
109
+
110
+ In practice, we find that learning $\alpha$ for weights is quite arduous because the distribution of weights is pretty steep and changes frequently during training. As a result, jointly training the clipping threshold and weights parameters is hard to converge. Inspired by the crucial role of batch normalization (BN) (Ioffe $\&$ Szegedy, 2015) in activation quantization (Cai et al., 2017), we propose weight normalization (WN) to refine the distribution of weights with zero mean and unit variance,
111
+
112
+ $$
113
+ \tilde { \mathcal { W } } = \frac { \mathcal { W } - \mu } { \sigma + \epsilon } , \mathrm { w h e r e } \mu = \frac { 1 } { I } \sum _ { i = 1 } ^ { I } \mathcal { W } _ { i } , \sigma = \sqrt { \frac { 1 } { I } \sum _ { i = 1 } ^ { I } ( \mathcal { W } _ { i } - \mu ) ^ { 2 } } ,
114
+ $$
115
+
116
+ where $\epsilon$ is a small number (typically $1 0 ^ { - 5 }$ ) for numerical stability, and $I$ denotes the number of weights in one layer. Note that quantization of weights is applied right after this normalization.
117
+
118
+ ![](images/296afd41c25721ce18c2a3fba33b7a7c5e0585187412215ff4824d4f0da40e1f.jpg)
119
+ Figure 4: The evolution of clipping ratio of the first three layers in ResNet-20. (a) demonstrates clipping ratio is too sensitive to threshold to hurt its optimization without weights normalization. (b) shows that weights distribution after normalization is relatively more stable during training.
120
+
121
+ # Algorithm 1 Forward and backward procedure for an APoT quantized convolutional layer
122
+
123
+ Input: input activations $\mathcal { X } _ { i n }$ , the full precision weight tensor $\mathcal { W }$ , the clipping threshold for weights and activations $\alpha _ { \mathcal { W } }$ , $\alpha _ { \mathcal { X } }$ , the bit-width $b$ of quantized tensor.
124
+
125
+ Output: the output activations $\mathcal { X } _ { o u t }$
126
+
127
+ 1: Normalize weights $\mathcal { W }$ to $\tilde { \mathcal W }$
128
+ 2: Apply RCF and APoT quantization to the normalized weights $\begin{array} { r } { \hat { \mathcal { W } } = \alpha \nu \Pi _ { \mathcal { Q } ^ { a } ( 1 , b ) } \big \lfloor \frac { \tilde { \mathcal { W } } } { \alpha _ { \mathcal { W } } } , 1 \big \rceil } \end{array}$
129
+ 3: Apply RCF and APoT quantization to the activations $\begin{array} { r } { \hat { \mathcal { X } _ { i n } } = \alpha _ { \mathcal { X } } \Pi _ { \mathcal { Q } ^ { a } ( 1 , b ) } \lfloor \frac { \mathcal { X } _ { i n } } { \alpha _ { \mathcal { X } } } , 1 \rceil } \end{array}$
130
+ 4: Compute the output activations $\mathcal { X } _ { o u t } = C o n \nu ( \hat { \mathcal { W } } , \hat { \mathcal { X } _ { i n } } )$
131
+ 5: Compute the loss $\mathcal { L }$ and the gradients $\frac { \partial \mathcal { L } } { \partial \mathcal { X } _ { o u t } }$ ,
132
+ 6: Compute the gradients of convolution $\frac { \partial \mathcal { L } } { \partial \hat { \mathcal { X } } _ { i n } }$ $\textstyle \frac { \partial { \mathcal { L } } } { \partial { \hat { \mathcal { W } } } }$
133
+ 7: Compute the gradients for clipping threshold $\frac { \partial \mathcal { L } } { \partial \alpha \ w }$ , $\frac { \partial \mathcal { L } } { \partial \alpha \boldsymbol { x } }$ based on Equation (8)
134
+ 8: Compute the gradients to the full precision weights $\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial \mathcal { W } } = \frac { \partial \mathcal { L } } { \partial \hat { \mathcal { W } } } \frac { \partial \hat { \mathcal { W } } } { \partial \tilde { \mathcal { W } } } \frac { \partial \tilde { \mathcal { W } } } { \partial \mathcal { W } } } \end{array}$
135
+ 9: Update $\mathcal { W }$ , $\alpha _ { \mathcal { W } }$ , $\alpha _ { \mathcal { X } }$ with learning rate $\eta _ { \mathcal { W } } , \eta _ { \alpha _ { \mathcal { W } } } , \eta _ { \alpha _ { \mathcal { X } } }$
136
+
137
+ Normalization is important to provide a relatively consistent and stable input distribution to both clipping and projection functions for smoother optimization of $\alpha$ over different layers and iterations during training. Besides, making the mean of weights to be zero can reap the benefits of the symmetric design of the quantization levels.
138
+
139
+ Here, we conduct a case study of ResNet-20 on CIFAR10 to illustrate how normalization for weights can help quantization. For a certain layer (at a certain training step) in ResNet-18, We firstly fix the weights, and let $\alpha$ go from 0 to max $| \mathcal { W } |$ to plot the curve of the clipping ratio (i.e. the proportion of clipped weights). As shown in Figure 4a, the change of clipping ratio is much smoother after quantization. As a result, the optimization of $\alpha$ will be significantly smoother. In addition, normalization also makes the distribution of weights quite more consistent over training iterations. We fix the value of $\alpha$ , and visualize clipping ratio over training iterations in Figure 4b. After normalization, the same $\alpha$ will result in almost the same clipping ratio, which improves the consistency of optimization goal for $\alpha$ . More experimental analysis demonstrating the effectiveness of the normalization on weights can be found in Appendix B.
140
+
141
+ # 2.5 TRAINING AND DEPLOYING
142
+
143
+ We adopt APoT quantization for both weights and activations. Notwithstanding the effect in activations is not conspicuous, we adopt APoT quantization for consistency. During backpropagation, we use STE when computing the gradients of weights, i.e. $\begin{array} { r } { \frac { \partial \hat { \mathcal { W } } } { \partial \tilde { \mathcal { W } } } = 1 } \end{array}$ . The detailed training procedure is shown in Algorithm 1.
144
+
145
+ To save memory cost during inference, we discard the full precision weights $\mathcal { W }$ and only store the quantized weights $\hat { \mathcal W }$ . Compared with other uniform quantization methods, APoT quantization is more efficient and effective during inference.
146
+
147
+ # 3 RELATED WORKS
148
+
149
+ Non-Uniform Quantization. Several methods are proposed for the non-uniform distribution of weights. LQ-Nets(Zhang et al., 2018) learns quantization levels based on the quantization error minimization (QEM) algorithm. Distillation (Polino et al., 2018) optimizes the quantization levels directly to minimize the task loss which reflects the behavior of their teacher network. These methods use finite floating-point numbers to quantize weights (and activations), bringing extra computation overhead compared with linear quantization. Logarithmic quantizers (Zhou et al., 2017; Miyashita et al., 2016) leverage powers-of-2 values to accelerate the computation by shift operations; however, they suffer from the rigid resolution problem.
150
+
151
+ Jointly Training. Many works have explored to optimize the quantization parameters (e.g., $\alpha$ ) and the weights parameters simultaneously. Zhu et al. (2016) learns positive and negative scaling coefficients respectively. LQ-Nets jointly train these parameters to minimize the quantization error. QIL (Jung et al., 2019) introduces a learnable transformer to change the quantization intervals and optimize them based on the task loss. PACT (Choi et al., 2018b) parameterizes the clipping threshold in activations and optimize it through gradient descent. However, in PACT, the gradient of $\alpha$ is not accurate, which only includes the contribution from outliers and ignores the contribution from other weights.
152
+
153
+ Weight Normalization. Previous works on weight normalization mainly focus on addressing the limitations of BatchNorm (Ioffe & Szegedy, 2015). Salimans & Kingma (2016); Hoffer et al. (2018) decouple direction from magnitude to accelerate the training procedure. Weight Standardization (Qiao et al., 2019) normalizes weights to zero mean and unit variance during the forward pass. However, there is limited literature that studies the normalization of weights for neural network quantization. (Zhu et al., 2016) uses feature-scaling to normalize weights by dividing the maximum absolute value. Weight Normalization based Quantization (Cai & Li, 2019) also uses this feature scaling and derive the gradient to eliminate the outliers in the weights tensor.
154
+
155
+ # 4 EXPERIMENT
156
+
157
+ In this section, we validate our proposed method on ImageNet-ILSVRC2012 (Russakovsky et al., 2015) and CIFAR10 (Krizhevsky et al., 2009). We also conduct ablation study for each component of our algorithm.
158
+
159
+ # 4.1 EVALUATION ON IMAGENET
160
+
161
+ We compare our methods with several strong baselines on ResNet architectures (He et al., 2016), including ABC-Net (Lin et al., 2017), DoReFa-Net (Zhou et al., 2016), PACT (Choi et al., 2018b), LQ-Net (Zhang et al., 2018), DSQ (Gong et al., 2019), QIL (Jung et al., 2019). Both weights and activations of the networks are quantized for comparisons. All the state-of-the-art methods use full precision (32 bits) for the first and the last layer, which incur more memory cost. In our implementation, we employ 8-bit quantization for them to balance the accuracy drop and the hardware overhead.
162
+
163
+ For our proposed APoT quantization algorithm, four configurations of the bit-width, i.e., 2,3,4, and 5 ( $k = 2$ and $n = 1$ or 2 in Equation (5) and (6)) are tested, where one bit is used for the sign of the weights but not for activations. Note that for the 2-bit symmetric weight quantization method, $\mathcal { Q } ( \alpha , 2 )$ can only be $\{ \pm \alpha , 0 \}$ , therefore only RCF and WN are used in this setting. To obtain a reasonable initialization, we follow Lin et al. (2017); Jung et al. (2019) to initialize our model. Specifically, the 5-bit quantized model is initialized from the pre-trained full precision one3, while the 4-bit network is initialized from the trained 5-bit model. We compare the accuracy, memory cost, and the fixed point operations under different bit-width. To compare the operations with different bit-width, we use the bit-op computation scheme introduced in Zhou et al. (2016) where the multiplication between a $m$ -bit and a $l$ -bit uniform quantized number costs $m l$ binary operation. We define one FixOP as one operation between an 8-bit weight and an 8-bit activation which takes 64 binary operations if uniform quantization scheme is applied. In APoT scheme, the multiplication between a $m$ -bit activation and a $l = k n$ -bit weight only needs mn shift-adds operations, i.e., $\frac { n \times m } { 6 4 }$ FixOPs. More details of the implementation are in the Appendix C.2.
164
+
165
+ Table 1: Comparison of accuracy performance as well as hardware performance of ResNets (He et al., 2016) on ImageNet with existing methods.
166
+
167
+ <table><tr><td rowspan="3">METHOD</td><td rowspan="2">PRECISION (W/A)</td><td colspan="2">ACCURACY(%)</td><td rowspan="2">MODEL SIZE</td><td rowspan="3">FIXOPS</td><td rowspan="2">PRECISION</td><td colspan="2">ACCURACY(%)</td><td rowspan="3">MODEL SIZE</td><td rowspan="3">FIXOPS</td></tr><tr><td>ToP-1</td><td>TOP-5</td><td>(W/A)</td><td>TOP-1 TOP-5</td></tr><tr><td>FP.(RES18)</td><td>32/32</td><td>70.2</td><td>89.4</td><td>46.8MB</td><td>1.82G</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ABC-NETS</td><td>5/5</td><td>65.0</td><td>85.9</td><td>8.72 MB</td><td>781M</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DoREFA-NET</td><td>5/5</td><td>68.4</td><td>88.3</td><td>8.72MB</td><td>781M</td><td>4/4</td><td>68.1</td><td>88.1</td><td>7.39MB</td><td>542M</td></tr><tr><td>PACT</td><td>5/5</td><td>69.8</td><td>89.3</td><td>8.72MB</td><td>781M</td><td>4/4</td><td>69.2</td><td>89.0</td><td>7.39 MB</td><td>542M</td></tr><tr><td>LQ-NET</td><td></td><td></td><td></td><td></td><td></td><td>4/4</td><td>69.3</td><td>88.8</td><td>7.39MB</td><td>542M</td></tr><tr><td>DSQ</td><td></td><td></td><td></td><td></td><td></td><td>4/4</td><td>69.6</td><td></td><td>7.39 MB</td><td>542M</td></tr><tr><td>QIL</td><td>5/5</td><td>70.4</td><td>=</td><td>8.72MB</td><td>781M</td><td>4/4</td><td>70.1</td><td>=</td><td>7.39MB</td><td>542M</td></tr><tr><td>APoT (OURS)</td><td>5/5</td><td>70.9</td><td>89.7</td><td>7.22 MB</td><td>616M</td><td>4/4</td><td>70.7</td><td>89.6</td><td>5.89 MB</td><td>437M</td></tr><tr><td>ABC-NETS</td><td>3/3</td><td>61.0</td><td>83.2</td><td>6.06MB</td><td>357M</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DoREFA-NET</td><td>3/3</td><td>67.5</td><td>87.6</td><td>6.06MB</td><td>357M</td><td>2/2</td><td>62.6</td><td>84.6</td><td>4.73MB</td><td>225M</td></tr><tr><td>PACT</td><td>3/3</td><td>68.1</td><td>88.2</td><td>6.06MB</td><td>357M</td><td>2/2</td><td>64.4</td><td>85.6</td><td>4.73 MB</td><td>225M</td></tr><tr><td>LQ-NET</td><td>3/3</td><td>68.2</td><td>87.9</td><td>6.06MB</td><td>357M</td><td>2/2</td><td>64.9</td><td>85.9</td><td>4.73MB</td><td>225M</td></tr><tr><td>DSQ</td><td>3/3</td><td>68.7</td><td>-</td><td>6.06MB</td><td>357M</td><td>2/2</td><td>65.2</td><td>-</td><td>4.73MB</td><td>225M</td></tr><tr><td>QIL</td><td>3/3</td><td>69.2</td><td>-</td><td>6.06MB</td><td>357M</td><td>2/2</td><td>65.7</td><td>-</td><td>4.73MB</td><td>225M</td></tr><tr><td>PACT+SAWB</td><td></td><td></td><td></td><td></td><td></td><td>2/2</td><td>67.0</td><td></td><td>5.36MB</td><td>243M</td></tr><tr><td>APOT (OURS)</td><td>3/3</td><td>69.9</td><td>89.2</td><td>4.56MB</td><td>298M</td><td>2/2</td><td>67.3</td><td>87.5</td><td>3.23MB</td><td>198M</td></tr><tr><td>FP.(RES34)</td><td>32/32</td><td>73.7</td><td>91.3</td><td>83.2MB</td><td>3.68G</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ABC-NETS</td><td>5/5</td><td>68.4</td><td>88.2</td><td>14.8MB</td><td>1.50G</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DSQ</td><td></td><td></td><td></td><td></td><td></td><td>4/4</td><td>72.8</td><td></td><td>12.3MB</td><td>1.00G</td></tr><tr><td>QIL</td><td>5/5</td><td>73.7</td><td>-</td><td>14.8MB</td><td>1.50G</td><td>4/4</td><td>73.7</td><td>=</td><td>12.3MB</td><td>1.00G</td></tr><tr><td>APOT(OURS)</td><td>5/5</td><td>73.9</td><td>91.6</td><td>13.3 MB</td><td>1.15G</td><td>4/4</td><td>73.8</td><td>91.6</td><td>10.8 MB</td><td>784M</td></tr><tr><td>ABC-NETS</td><td>3/3</td><td>66.4</td><td>87.4</td><td>9.73MB</td><td>618M</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LQ-NET</td><td>3/3</td><td>71.9</td><td>90.2</td><td>9.73MB</td><td>618M</td><td>2/2</td><td>69.8</td><td>89.1</td><td>7.20 MB</td><td>340M</td></tr><tr><td>DSQ</td><td>3/3</td><td>72.5</td><td>-</td><td>9.73MB</td><td>618M</td><td>2/2</td><td>70.0</td><td>1</td><td>7.20MB</td><td>340M</td></tr><tr><td>QIL</td><td>3/3</td><td>73.1</td><td>-</td><td>9.73MB</td><td>618M</td><td>2/2</td><td>70.6</td><td>-</td><td>7.20MB</td><td>340M</td></tr><tr><td>APOT(OURS)</td><td>3/3</td><td>73.4</td><td>91.1</td><td>8.23MB</td><td>493M</td><td>2/2</td><td>70.9</td><td>89.7</td><td>5.70MB</td><td>285M</td></tr><tr><td>FP.(RES50)</td><td>32/32</td><td>76.4</td><td>93.1</td><td>97.5MB</td><td>4.14G</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ABC-NETS</td><td>5/5</td><td>70.1</td><td>89.7</td><td>22.2MB</td><td>1.67G</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DOREFA-NET</td><td>5/5</td><td>71.4</td><td>93.3</td><td>22.2MB</td><td>1.67G</td><td>4/4</td><td>71.4</td><td>89.8</td><td>19.4MB</td><td>1.11G</td></tr><tr><td>LQ-NET</td><td></td><td></td><td></td><td></td><td></td><td>4/4</td><td>75.1</td><td>92.4</td><td>19.4MB</td><td>1.11G</td></tr><tr><td>PACT</td><td>5/5</td><td>76.7</td><td>93.3</td><td>22.2MB</td><td>1.67G</td><td>4/4</td><td>76.5</td><td>93.3</td><td>19.4 MB</td><td>1.11G</td></tr><tr><td>APOT (OURS)</td><td>5/5</td><td>76.7</td><td>93.3</td><td>16.3MB</td><td>1.28G</td><td>4/4</td><td>76.6</td><td>93.1</td><td>13.6MB</td><td>866M</td></tr><tr><td>DoREFA-NET</td><td>3/3</td><td>69.9</td><td>89.2</td><td>16.6 MB</td><td>680M</td><td>2/2</td><td>67.1</td><td>87.3</td><td>13.8MB</td><td>370M</td></tr><tr><td>PACT</td><td>3/3</td><td>75.3</td><td>92.6</td><td>16.6MB</td><td>680M</td><td>2/2</td><td>72.2</td><td>90.5</td><td>13.8MB</td><td>370M</td></tr><tr><td>LQ-NET PACT+SAWB</td><td>3/3</td><td>74.2</td><td>91.6</td><td>16.6MB</td><td>680M</td><td>2/2 2/2</td><td>71.5 74.2</td><td>90.3</td><td>13.8MB 23.7MB</td><td>370M 707M</td></table>
168
+
169
+ Overall results are shown in Table 1. The results of DoReFa-Net are taken from Choi et al. (2018b), and the other results are quoted from the original papers. It can be observed that our 5-bit quantized network achieves even higher accuracy than the full precision baselines ( $0 . 7 \%$ Top-1 improvement on ResNet-18 and $0 . 2 \%$ Top-1 improvement on ResNet-34 and ResNet-50), which means quantization may serve the purpose of regularization. Along with the accuracy performance, our APoT quantization can achieve better hardware performance on model size and inference speed. For full precision models, the number in the column of FixOPs indicates FLOPs.
170
+
171
+ 4-bit and 3-bit quantized networks are also preserving (or approaching) the full-precision accuracy except for the 3-bit quantized ResNet-18 and ResNet-34, which only drops $0 . 5 \%$ and $0 . 3 \%$ accuracy respectively. When $b$ is further reduced to 2, our model still outperforms the baselines, which demonstrates the effectiveness of RCF and WN. Note that Choi et al. (2018a) use a full precision shortcut in the model, reaching higher accuracy on ResNet-50 however suffering from the hardware performance. In specific, the different precision between the main path and the residual path may result in greater latency in a pipelined implementation.
172
+
173
+ # 4.2 EVALUATION ON CIFAR10
174
+
175
+ We quantize ResNet-20 and ResNet-56 (He et al., 2016) on CIFAR10 for evaluation. We adopt progressive initialization and choose the quantization bit as 2, 3 and 4. More implementations can be found in the Appendix C.2.
176
+
177
+ Table 2: Accuracy comparison of ResNet architectures on CIFAR10
178
+
179
+ <table><tr><td rowspan="2">MODELS METHODS</td><td rowspan="2"></td><td colspan="3">ACCURACY(%)</td></tr><tr><td>2 BITS</td><td>3 BITS</td><td>4 BITS</td></tr><tr><td rowspan="5">REsNET-20 (FP: 91.6)</td><td>DOREFA-NET (ZHOU ET AL.,2016)</td><td>88.2</td><td>89.9</td><td>90.5</td></tr><tr><td>PACT(CHOI ET AL., 2018B)</td><td>89.7</td><td>91.1</td><td>91.7</td></tr><tr><td>LQ-NET (ZHANG ET AL.,2018)</td><td>90.2</td><td>91.6</td><td>-</td></tr><tr><td>PACT+SAWB+FPSC(CHOI ET AL.,2018A)</td><td>90.5</td><td>-</td><td>=</td></tr><tr><td>APOT QUANTIZATION(OURS)</td><td>91.0</td><td>92.2</td><td>92.3</td></tr><tr><td rowspan="2">REsNET-56 (FP: 93.2)</td><td>PACT+SAWB+FPSC (CHOI ET AL., 2018A)</td><td>92.5</td><td>=</td><td>1</td></tr><tr><td>APOTQUANTIZATION (OURS)</td><td>92.9</td><td>93.9</td><td>94.0</td></tr></table>
180
+
181
+ Table. 2 summarizes the accuracy of our APoT in comparison with baselines. For 3-bit and 4-bit models, APoT quantization has reached comparable results with the full precision baselines. It is worthwhile to note that all state-of-the-arts methods in the table use 4 levels to quantize weights into 2-bit. Our model only employs ternary weights for 2-bit representation and still outstrips existing quantization methods.
182
+
183
+ # 4.3 ABLATION STUDY
184
+
185
+ Table 3: Comparison of quantizer, weight normalization and RCF of ResNet-18 on ImageNet.
186
+
187
+ <table><tr><td>METHOD</td><td>PRECISION</td><td>WN</td><td>RCF</td><td>Acc.-1</td><td>RCF</td><td>Acc.-1</td><td>MODEL SIZE</td><td>FIxOPS</td></tr><tr><td>FULL PREC.</td><td>32/32</td><td>:</td><td>-</td><td>70.2</td><td>-</td><td>70.2</td><td>46.8 MB</td><td>1.82G</td></tr><tr><td>APoT</td><td>5/5</td><td></td><td></td><td>70.9</td><td>X</td><td>70.0</td><td>7.22 MB</td><td>616M</td></tr><tr><td>PoT</td><td>5/5</td><td></td><td></td><td>70.3</td><td>X</td><td>68.9</td><td>7.22 MB</td><td>582M</td></tr><tr><td>UNIFORM</td><td>5/5</td><td>&lt;&lt;&gt;</td><td></td><td>70.7</td><td>×</td><td>69.4</td><td>7.22 MB</td><td>781M</td></tr><tr><td>LLOYD</td><td>5/5</td><td>√</td><td>&lt;&lt;&lt;√</td><td>70.9</td><td>X</td><td>70.2</td><td>7.22 MB</td><td>1.81G</td></tr><tr><td>APoT</td><td>3/3</td><td></td><td></td><td>69.9</td><td>X</td><td>68.5</td><td>4.56 MB</td><td>298M</td></tr><tr><td>UNIFORM</td><td>3/3</td><td></td><td></td><td>69.4</td><td>×</td><td>67.8</td><td>4.56 MB</td><td>357M</td></tr><tr><td>LLOYD</td><td>3/3</td><td>/&lt;√</td><td>/&lt;&gt;</td><td>70.0</td><td>X</td><td>69.0</td><td>4.56 MB</td><td>1.81G</td></tr><tr><td>APoT</td><td>3/3</td><td></td><td>√</td><td>2.0</td><td>×</td><td>68.5</td><td>4.56 MB</td><td>198M</td></tr></table>
188
+
189
+ The proposed algorithm consists of three techniques, APoT quantization levels to fit the bell-shaped distribution, RCF to learn the clipping threshold and WN to avoid the perturbation of the distribution of weights during training. In this section, we conduct an ablation study for these three techniques. We compare the APoT quantizer, the vanilla PoT quantizer, uniform quantizer and a non-uniform quantizer using Lloyd algorithm (Cai et al., 2017) to quantize the weights. And we either apply RCF to learn the optimal clipping range or do not clip any weights (i.e. $\alpha = \operatorname* { m a x } | \mathcal { W } | )$ . Weight Normalization is also adopted or discarded to justify the effectiveness of these techniques.
190
+
191
+ Table 3 summarizes the results of ResNet-18 using different techniques. Quantizer using Lloyd achieves the highest accuracy, however, the irregular non-uniform quantized weights cannot utilize the fixed point arithmetic to accelerate the inference time. APoT quantization attends to the distribution of weights, which reaches the same accuracy in 5-bit and only decreases $0 . 2 \%$ accuracy in 3-bit quantization compared with Lloyd, and shares a better tradeoff between task performance and hardware performance. We also observe that the vanilla PoT quantization suffers from the rigid resolution, and has the lowest accuracy in the 5-bit model.
192
+
193
+ Clipping range also matters in quantization, the comparison in Table 3 shows that a proper clipping range can help improve the robustness of the network. Especially when the network is quantized to 3-bit, the accuracy will drop significantly because of the quantization interval increases. Applying RCF to learn the optimal clipping range could improve at most $1 . 6 \%$ accuracy. As we mentioned before, normalization of weight is important to learn the clipping range, and the network diverges if RCF is applied without WN. We refer to the Appendix B for more details of weight normalization during training.
194
+
195
+ # 5 CONCLUSION
196
+
197
+ In this paper, we have introduced the additive powers-of-two (APoT) quantization algorithm for quantizing weights and activations in neural networks, which typically exhibit a bell-shaped and long-tailed distribution. Each quantization level of APoT is the sum of a set of powers-of-two terms, bringing roughly 2x speed-up in multiplication compared with uniform quantization. The distribution of the quantization levels matches that of the weights and activations better than existing quantization schemes. In addition, we propose to reparameterize the clipping function and normalize the weights to get a more stable and better-defined gradient for optimizing the clipping threshold. We reach state-of-the-art accuracy on ImageNet and CIFAR10 dataset compared to uniform or PoT quantization.
198
+
199
+ # ACKNOWLEDGEMENT
200
+
201
+ This work is supported by National University of Singapore FY2017 SUG Grant, and Singapore Ministry of Education Academic Research Fund Tier 3 under MOEs official grant number MOE2017-T3-1-007.
202
+
203
+ # REFERENCES
204
+
205
+ Yoshua Bengio, Nicholas Leonard, and Aaron Courville. Estimating or propagating gradients ´ through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
206
+
207
+ Wen-Pu Cai and Wu-Jun Li. Weight normalization based quantization for deep neural network compression. arXiv preprint arXiv:1907.00593, 2019.
208
+
209
+ Zhaowei Cai, Xiaodong He, Jian Sun, and Nuno Vasconcelos. Deep learning with low precision by half-wave gaussian quantization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5918–5926, 2017.
210
+
211
+ Jungwook Choi, Pierce I-Jen Chuang, Zhuo Wang, Swagath Venkataramani, Vijayalakshmi Srinivasan, and Kailash Gopalakrishnan. Bridging the accuracy gap for 2-bit quantized neural networks (qnn). arXiv preprint arXiv:1807.06964, 2018a.
212
+
213
+ Jungwook Choi, Zhuo Wang, Swagath Venkataramani, Pierce I-Jen Chuang, Vijayalakshmi Srinivasan, and Kailash Gopalakrishnan. Pact: Parameterized clipping activation for quantized neural networks. arXiv preprint arXiv:1805.06085, 2018b.
214
+
215
+ Misha Denil, Babak Shakibi, Laurent Dinh, Marc’Aurelio Ranzato, and Nando De Freitas. Predicting parameters in deep learning. In Advances in neural information processing systems, pp. 2148–2156, 2013.
216
+
217
+ Steven K. Esser, Jeffrey L. McKinstry, Deepika Bablani, Rathinakumar Appuswamy, and Dharmendra S. Modha. Learned step size quantization. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\equiv$ rkgO66VKDS.
218
+
219
+ David Goldberg. What every computer scientist should know about floating-point arithmetic. ACM Computing Surveys (CSUR), 23(1):5–48, 1991.
220
+
221
+ Ruihao Gong, Xianglong Liu, Shenghu Jiang, Tianxiang Li, Peng Hu, Jiazhen Lin, Fengwei Yu, and Junjie Yan. Differentiable soft quantization: Bridging full-precision and low-bit neural networks. arXiv preprint arXiv:1908.05033, 2019.
222
+
223
+ Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015.
224
+
225
+ 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.
226
+
227
+ Elad Hoffer, Ron Banner, Itay Golan, and Daniel Soudry. Norm matters: efficient and accurate normalization schemes in deep networks. In Advances in Neural Information Processing Systems, pp. 2160–2170, 2018.
228
+
229
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
230
+
231
+ Sangil Jung, Changyong Son, Seohyung Lee, Jinwoo Son, Jae-Joon Han, Youngjun Kwak, Sung Ju Hwang, and Changkyu Choi. Learning to quantize deep networks by optimizing quantization intervals with task loss. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4350–4359, 2019.
232
+
233
+ Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
234
+
235
+ Xiaofan Lin, Cong Zhao, and Wei Pan. Towards accurate binary convolutional neural network. In Advances in Neural Information Processing Systems, pp. 345–353, 2017.
236
+
237
+ Daisuke Miyashita, Edward H Lee, and Boris Murmann. Convolutional neural networks using logarithmic data representation. arXiv preprint arXiv:1603.01025, 2016.
238
+
239
+ Antonio Polino, Razvan Pascanu, and Dan Alistarh. Model compression via distillation and quantization. arXiv preprint arXiv:1802.05668, 2018.
240
+
241
+ Siyuan Qiao, Huiyu Wang, Chenxi Liu, Wei Shen, and Alan Yuille. Weight standardization. arXiv preprint arXiv:1903.10520, 2019.
242
+
243
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. Imagenet large scale visual recognition challenge. International journal of computer vision, 115(3):211–252, 2015.
244
+
245
+ Tim Salimans and Durk P Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. In Advances in Neural Information Processing Systems, pp. 901–909, 2016.
246
+
247
+ Dongqing Zhang, Jiaolong Yang, Dongqiangzi Ye, and Gang Hua. Lq-nets: Learned quantization for highly accurate and compact deep neural networks. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 365–382, 2018.
248
+
249
+ Ritchie Zhao, Yuwei Hu, Jordan Dotzel, Chris De Sa, and Zhiru Zhang. Improving neural network quantization without retraining using outlier channel splitting. In International Conference on Machine Learning, pp. 7543–7552, 2019.
250
+
251
+ Aojun Zhou, Anbang Yao, Yiwen Guo, Lin Xu, and Yurong Chen. Incremental network quantization: Towards lossless cnns with low-precision weights. arXiv preprint arXiv:1702.03044, 2017.
252
+
253
+ Shuchang Zhou, Yuxin Wu, Zekun Ni, Xinyu Zhou, He Wen, and Yuheng Zou. Dorefa-net: Training low bitwidth convolutional neural networks with low bitwidth gradients. arXiv preprint arXiv:1606.06160, 2016.
254
+
255
+ Chenzhuo Zhu, Song Han, Huizi Mao, and William J Dally. Trained ternary quantization. arXiv preprint arXiv:1612.01064, 2016.
256
+
257
+ # APPENDICES
258
+
259
+ # A GRADIENT DERIVATION
260
+
261
+ In this section, we derive the gradient estimation of PACT (Choi et al., 2018b) along with our proposed Reparameterized Clipping Function and show the distinction of these two estimation.
262
+
263
+ # A.1 PACT
264
+
265
+ Equation (1) shows the forward of PACT. In backpropagation, PACT applies the Straight-Through Estimator for the projection operation. In particular, the STE assumes that
266
+
267
+ $$
268
+ { \frac { \partial \Pi _ { \mathcal { Q } } X } { \partial X } } = 1 ,
269
+ $$
270
+
271
+ which means the variable before and after projection are treated the same in backpropagation. Therefore, the gradients of $\alpha$ in PACT is computed by:
272
+
273
+ $$
274
+ \frac { \partial \hat { W } } { \partial \alpha } = \frac { \partial \Pi _ { Q ( \alpha , b ) } \lfloor \mathcal { W } , \alpha \rfloor } { \partial \lfloor \mathcal { W } , \alpha \rfloor } \frac { \partial \lfloor \mathcal { W } , \alpha \rceil } { \partial \alpha } = \left\{ \begin{array} { l l } { \mathrm { s i g n } ( \mathcal { W } ) } & { \mathrm { i f } \left| \mathcal { W } \right| > \alpha } \\ { 0 } & { \mathrm { i f } \left| \mathcal { W } \right| \le \alpha } \end{array} , \right.
275
+ $$
276
+
277
+ where the first term is computed by STE and the second term is because the clip operation $[ \cdot , \alpha ]$ returns $\mathrm { s i g n } ( \cdot ) \alpha$ when $| \cdot | > \alpha$ . In this gradient estimation, the effect of $\alpha$ in the levels set $\mathcal { Q } ( \alpha , b )$ is ignored by the STE, leading to an inaccurate approximation.
278
+
279
+ # A.2 RCF
280
+
281
+ To avoid the elimination of STE, we reparameterize the clipping function so that the output clipping range before projection is settled and the range is re-scaled after the projection. We can define a general formation of RCF by
282
+
283
+ $$
284
+ \hat { \mathcal { W } } = \frac { \alpha } { c } \Pi _ { \mathcal { Q } ( c , b ) } \lfloor \frac { c } { \alpha } \mathcal { W } , c \rceil ,
285
+ $$
286
+
287
+ where $c > 0$ is a constant. This function clips the weights to $[ - c , c ]$ before projection and re-scaled to $[ - \alpha , \alpha ]$ after projection. Thus, the backpropagation is given by:
288
+
289
+ $$
290
+ \begin{array}{c} \begin{array} { l } { \displaystyle \frac { \partial \hat { \mathcal { W } } } { \partial \alpha } = \frac { \partial \alpha } { \partial \alpha } \times \frac 1 c \Pi _ { \mathcal { Q } ( c , b ) } \lfloor \frac c \alpha \mathcal { W } , c \rfloor + \displaystyle \frac { \partial \Pi _ { \mathcal { Q } ( c , b ) } \lfloor \frac c \alpha \mathcal { W } , c \rfloor } { \partial \lfloor \frac c \alpha \mathcal { W } , c \rfloor } \frac { \partial \lfloor \frac c \alpha \mathcal { W } , c \rfloor } { \partial \alpha } \times \frac \alpha c } \\ { = \displaystyle \left\{ \frac 1 c \times \mathrm { s i g n } ( \frac \alpha \mathcal { W } ) \times c + \frac \alpha c \times 0 \quad \right.} & { \mathrm { i f } | \mathcal { W } | > \alpha } \\ { \displaystyle \frac 1 c \Pi _ { \mathcal { Q } ( c , b ) } \frac { c } { \alpha } \mathcal { W } + \frac \alpha c \times ( - \frac { c } { \alpha ^ { 2 } } ) \mathcal { W } \quad \mathrm { i f } | \mathcal { W } | \le \alpha } \\ { = \displaystyle \left\{ \mathrm { s i g n } ( \frac \alpha \mathcal { W } ) \qquad \quad } & { \mathrm { i f } | \mathcal { W } | > \alpha \right. } \\ { \displaystyle \frac 1 c \Pi _ { \mathcal { Q } ( c , b ) } \frac { c } \alpha \mathcal { W } - \frac { 1 } { \alpha } \mathcal { W } \quad \mathrm { i f } | \mathcal { W } | \le \alpha } \end{array} . \end{array}
291
+ $$
292
+
293
+ Since the levels set $\mathcal { Q }$ is not parameterized by $\alpha$ , the gradients will flow to two parts in RCF: the re-scale coefficient and the scale in clipping function. The constant $c$ here do not impact the gradient estimation, therefore we choose 1 for simplicity in the implementation. Note that in uniform quantization scheme, this function is equivalent to the Learned Step Size Quantization (Esser et al., 2020), where the setp size is the same for all levels while RCF provides a more general formation for any levels set $\mathcal { Q }$ .
294
+
295
+ # B HOW DOES NORMALIZATION HELP QUANTIZATION
296
+
297
+ In this section, we show some experimental results to illustrate the effect of our weights normalization in quantization neural networks.
298
+
299
+ ![](images/d4f25614e44cf9c0581acb53bb10a413457c9bcdcdb956236f69dfb285cb7194.jpg)
300
+ Figure 5: When weights are normalized the distribution of weights are more stable. The dashed line shows the mean value of weights.
301
+
302
+ # B.1 WEIGHTS DISTRIBUTION
303
+
304
+ We visualize the density distribution of weights before normalization $\mathcal { W }$ and after normalization $\tilde { \mathcal W }$ during training to demonstrate its effectiveness.
305
+
306
+ Figure 5a demonstrates the density distribution of the fifth layer of the 5-bit quantized ResNet-18, from which we can see that the density of the unnormalized weights could be extensive high $( > 8 )$ in the centered area. Such distribution indicates that even a tiny change of clipping threshold would bring a significant effect on clipping when $\alpha$ is small, as shown in Figure 4a. , which means a small learning rate for $\alpha$ is needed. However, if the learning rate is too small, the change of $\alpha$ cannot follow the change of weights distribution because weights are also updated according to Figure 5a. Thus it is unfavorable to train the clipping threshold for unnormalized weights, while Figure 5b shows that the normalized weights can have a stable distribution. Furthermore, the dashed line in the figure indicates $\mathcal { W }$ usually do not have zero mean, which may not utilize the symmetric design of quantization levels.
307
+
308
+ # B.2 TRAINING BEHAVIOR
309
+
310
+ The above experiments use normalization during training to compare the distribution of weights. In this section, we compare the training of quantization neural networks with and without normalization to investigate the real effect of WN. Here, we train a 3-bit quantized (full precision for activations) ResNet-20 from scratch, and compare the results under different learning rate for $\alpha$ . The results are shown in Table 4, from which we can find that if weights are normalized during training, the network can converge to descent performances and is robust to the learning rate of clipping threshold. However, if the weights are not normalized, the network would diverge if the learning rate for $\alpha$ is too high. Even if the learning rate is set to a lower value, the network does not outperform the normalized one. Based on the training behaviors, the learning rate for clipping threshold without WN in QNNs need a careful choice.
311
+
312
+ Table 4: Accuracy comparison of 3-bit quantized ResNet-20 on CIFAR10.
313
+
314
+ ![](images/d2162a50a836907d469220f34e80810a93f268b39dcf0ad70382113424671738.jpg)
315
+ Figure 6: A summary of projection error and clipping error in different layers.
316
+
317
+ # C EXPERIMENTAL DETAILS
318
+
319
+ # C.1 REVISITING QUANTIZATION ERROR
320
+
321
+ Typically, quantization error $( \Delta )$ is defined as the mean squared error between weights $\tilde { \mathcal W }$ and $\hat { \mathcal W }$ before and after quantization respectively, defined as $\Delta = \mathbb { E } [ \tilde { \mathcal { W } } - \hat { \mathcal { W } } ] ^ { 2 }$ . This quantization error is composed of two errors, the clipping error $\Delta _ { c l i p }$ produced by $\lfloor \cdot , \alpha \rceil$ and the projection error $\Delta _ { p r o j }$ produced by $\Pi _ { \mathfrak { Q } }$ . I.e.
322
+
323
+ $$
324
+ \Delta = \Delta _ { c l i p } + \Delta _ { p r o j } = \frac { 1 } { I } \sum _ { | \tilde { \mathcal { W } } _ { i } | > \alpha } \left( | \tilde { \mathcal { W } } _ { i } | - \alpha \right) ^ { 2 } + \frac { 1 } { I } \sum _ { | \tilde { \mathcal { W } } _ { i } | \leq \alpha } ( \tilde { \mathcal { W } } _ { i } - \hat { \mathcal { W } } _ { i } ) ^ { 2 } .
325
+ $$
326
+
327
+ Previous methods (Zhang et al., 2018; Cai et al., 2017) seek to minimize the quantization error to obtain the optimal clipping threshold (i.e. $\begin{array} { r } { \alpha = \arg \operatorname* { m i n } _ { \alpha } ( \Delta _ { c l i p } + \Delta _ { p r o j } ) ) } \end{array}$ , while RCF is directly optimized by the final training loss to balance projection error and clipping error. We compare the Quantization Error Minimization (QEM) method with our RCF on the quantized ResNet-18 model. Figure 6 gives an overview of the clipping error and projection error using RCF or QEM.
328
+
329
+ For the 5-bit quantized model, RCF has a much higher quantization error. The projection error obtained by RCF is lower than QEM and QEM significantly reduces the clipping error. Therefore, we can infer that projection error has a higher priority in RCF. When quantizing to 3-bit, the clipping error in RCF still exceeds QEM except for the first quantized layer. This means RCF can identify whether the projection is more important than the clipping over different layers and bit-width. Generally, the insight behind is that simply minimizing the quantization error may not be the best choice and it is more direct to optimize threshold with respect to training loss.
330
+
331
+ # C.2 IMPLEMENTATIONS DETAILS
332
+
333
+ The ImageNet dataset consists of 1.2M training and 50K validation images. We use a standard data preprocess in the original paper (He et al., 2016). For training images, they are randomly cropped and resized to $2 2 4 \times 2 2 4$ . Validation images are center-cropped to the same size. We use the Pytorch official code 4 to construct ResNets, and they are initialized from the released pre-trained model. We use stochastic gradient descent (SGD) with the momentum of 0.9 to optimize both weight parameters and the clipping threshold simultaneously. Batch size is set to 1024 and the learning rate starts from 0.1 with a decay factor of 0.1 at epoch 30,60,80,100. The network is trained up to 120 epochs and weight decay is set to $1 0 ^ { - 4 }$ for 3-bit quantized models or higher and $2 \times 1 0 ^ { - 5 }$ for 2-bit model.
334
+
335
+ The CIFAR10 dataset contains 50K training and 10K test images with $3 2 \times 3 2$ pixels. The ResNet architectures for CIFAR10 (He et al., 2016) contains a convolutional layer followed by 3 residual blocks and a final FC layer. We train full precision ResNet-20 and ResNet-56 firstly and use them as initialization for quantized models. All networks were trained for 200 epochs with a mini-batch size of 128. SGD with momentum of 0.9 was adopted to optimize the parameters. Learning rate started at 0.04 and was scaled by 0.1 at epoch 80,120. Weight decay was set to $1 0 ^ { - 4 }$ .
336
+
337
+ For clipping threshold $\alpha$ , we set 8.0 for activations and 3.0 for weights as initial value when training a 5-bit quantized model. The learning rate of $\alpha$ is set to 0.01 and 0.03 for weights and activations, respectively. During practice, we found that the learning rate of $\alpha$ merely does not influence network performance. Different from PACT (Choi et al., 2018b), the update of $\alpha$ in our works already consider the projection error, so we do not require a relatively large L2-regularization. In practice, the network works fine when the weight decay for $\alpha$ is set to $\mathrm { \bar { 1 0 } } ^ { - 5 }$ and may increase to $1 0 ^ { - 4 }$ when bit-width is reduced.
md/train/BkxtNaEYDr/BkxtNaEYDr.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/ByxtC2VtPB/ByxtC2VtPB.md ADDED
@@ -0,0 +1,409 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MIXUP INFERENCE: BETTER EXPLOITING MIXUP TO DEFEND ADVERSARIAL ATTACKS
2
+
3
+ Tianyu Pang∗, Kun $\mathbf { X } \mathbf { u } ^ { * }$ , $\mathbf { J u n \ : Z h u } ^ { \dagger }$ Dept. of Comp. Sci. & Tech., BNRist Center, Institute for AI, Tsinghua University; RealAI $\{ { \tt p t y 1 7 } , { \tt x u - k 1 6 } \}$ @mails.tsinghua.edu.cn, dcszj@tsinghua.edu.cn
4
+
5
+ # ABSTRACT
6
+
7
+ It has been widely recognized that adversarial examples can be easily crafted to fool deep networks, which mainly root from the locally unreasonable behavior nearby input examples. Applying mixup in training provides an effective mechanism to improve generalization performance and model robustness against adversarial perturbations, which introduces the globally linear behavior in-between training examples. However, in previous work, the mixup-trained models only passively defend adversarial attacks in inference by directly classifying the inputs, where the induced global linearity is not well exploited. Namely, since the locality of the adversarial perturbations, it would be more efficient to actively break the locality via the globality of the model predictions. Inspired by simple geometric intuition, we develop an inference principle, named mixup inference (MI), for mixup-trained models. MI mixups the input with other random clean samples, which can shrink and transfer the equivalent perturbation if the input is adversarial. Our experiments on CIFAR-10 and CIFAR-100 demonstrate that MI can further improve the adversarial robustness for the models trained by mixup and its variants.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep neural networks (DNNs) have achieved state-of-the-art performance on various tasks (Goodfellow et al., 2016). However, counter-intuitive adversarial examples generally exist in different domains, including computer vision (Szegedy et al., 2014), natural language processing (Jin et al., 2019), reinforcement learning (Huang et al., 2017), speech (Carlini & Wagner, 2018) and graph data (Dai et al., 2018). As DNNs are being widely deployed, it is imperative to improve model robustness and defend adversarial attacks, especially in safety-critical cases. Previous work shows that adversarial examples mainly root from the locally unstable behavior of classifiers on the data manifolds (Goodfellow et al., 2015; Fawzi et al., 2016; 2018; Pang et al., 2018b), where a small adversarial perturbation in the input space can lead to an unreasonable shift in the feature space.
12
+
13
+ On the one hand, many previous methods try to solve this problem in the inference phase, by introducing transformations on the input images. These attempts include performing local linear transformation like adding Gaussian noise (Tabacof & Valle, 2016), where the processed inputs are kept nearby the original ones, such that the classifiers can maintain high performance on the clean inputs. However, as shown in Fig. 1(a), the equivalent perturbation, i.e., the crafted adversarial perturbation, is still $\delta$ and this strategy is easy to be adaptively evaded since the randomness of $\overline { { x } } _ { 0 }$ w.r.t $x _ { 0 }$ is local (Athalye et al., 2018). Another category of these attempts is to apply various non-linear transformations, e.g., different operations of image processing (Guo et al., 2018; Xie et al., 2018; Raff et al., 2019). They are usually off-the-shelf for different classifiers, and generally aim to disturb the adversarial perturbations, as shown in Fig. 1(b). Yet these methods are not quite reliable since there is no illustration or guarantee on to what extent they can work.
14
+
15
+ On the other hand, many efforts have been devoted to improving adversarial robustness in the training phase. For examples, the adversarial training (AT) methods (Madry et al., 2018; Zhang et al., 2019; Shafahi et al., 2019) induce locally stable behavior via data augmentation on adversarial examples. However, AT methods are usually computationally expensive, and will often degenerate model performance on the clean inputs or under general-purpose transformations like rotation (Engstrom et al., 2019). In contrast, the mixup training method (Zhang et al., 2018) introduces globally linear behavior in-between the data manifolds, which can also improve adversarial robustness (Zhang et al., 2018; Verma et al., 2019a). Although this improvement is usually less significant than it resulted by AT methods, mixup-trained models can keep state-of-the-art performance on the clean inputs; meanwhile, the mixup training is computationally more efficient than AT. The interpolated AT method (Lamb et al., 2019) also shows that the mixup mechanism can further benefit the AT methods.
16
+
17
+ ![](images/013f06454d81dc2d0bb4afea6a087651a6f9632dfac778edf8d77e9b51209e19.jpg)
18
+ Figure 1: Intuitive mechanisms in the input space of different input-processing based defenses. $_ x$ is the crafted adversarial example, $x _ { 0 }$ is the original clean example, which is virtual and unknown for the classifiers. $\delta$ is the adversarial perturbation.
19
+
20
+ However, most of the previous work only focuses on embedding the mixup mechanism in the training phase, while the induced global linearity of the model predictions is not well exploited in the inference phase. Compared to passive defense by directly classifying the inputs (Zhang et al., 2018; Lamb et al., 2019), it would be more effective to actively defend adversarial attacks by breaking their locality via the globally linear behavior of the mixup-trained models. In this paper, we develop an inference principle for mixup-trained models, named mixup inference (MI). In each execution, MI performs a global linear transformation on the inputs, which mixups the input $x$ with a sampled clean example $x _ { s }$ , i.e., $\tilde { x } = \lambda x + ( 1 - \lambda ) x _ { s }$ (detailed in Alg. 1), and feed $\tilde { x }$ into the classifier as the processed input.
21
+
22
+ There are two basic mechanisms for robustness improving under the MI operation (detailed in Sec. 3.2.1), which can be illustrated by simple geometric intuition in Fig. 1(c). One is perturbation shrinkage: if the input is adversarial, i.e., $x = x _ { 0 } + \delta$ , the perturbation $\delta$ will shrink by a factor $\lambda$ after performing MI, which is exactly the mixup ratio of MI according to the similarity between triangles. Another one is input transfer: after the MI operation, the reduced perturbation $\lambda \delta$ acts on random $\tilde { x } _ { 0 }$ . Comparing to the spatially or semantically local randomness introduced by Gaussian noise or image processing, $\tilde { x } _ { 0 }$ introduces spatially global and semantically diverse randomness w.r.t $x _ { 0 }$ . This makes it less effective to perform adaptive attacks against MI (Athalye et al., 2018). Furthermore, the global linearity of the mixup-trained models ensures that the information of $x _ { 0 }$ remained in $\tilde { x } _ { 0 }$ is proportional to $\lambda$ , such that the identity of $x _ { 0 }$ can be recovered from the statistics of $\tilde { x } _ { 0 }$ .
23
+
24
+ In experiments, we evaluate MI on CIFAR-10 and CIFAR-100 (Krizhevsky & Hinton, 2009) under the oblivious attacks (Carlini & Wagner, 2017) and the adaptive attacks (Athalye et al., 2018). The results demonstrate that our MI method is efficient in defending adversarial attacks in inference, and is also compatible with other variants of mixup, e.g., the interpolated AT method (Lamb et al., 2019). Note that Shimada et al. (2019) also propose to mixup the input points in the test phase, but they do not consider their method from the aspect of adversarial robustness.
25
+
26
+ # 2 PRELIMINARIES
27
+
28
+ In this section, we first introduce the notations applied in this paper, then we provide the formula of mixup in training. We introduce the adversarial attacks and threat models in Appendix A.1.
29
+
30
+ # 2.1 NOTATIONS
31
+
32
+ Given an input-label pair $( x , y )$ , a classifier $F$ returns the softmax prediction vector $F ( x )$ and the predicted label ${ \hat { y } } = \arg \operatorname* { m a x } _ { j \in [ L ] } F _ { j } ( x )$ , where $L$ is the number of classes and $[ L ] = \{ 1 , \cdots , L \}$ The classifier $F$ makes a correct prediction on $x$ if $y = \hat { y }$ . In the adversarial setting, we augment the
33
+
34
+ data pair $( x , y )$ to a triplet $( x , y , z )$ with an extra binary variable $z$ , i.e.,
35
+
36
+ $$
37
+ z = { \left\{ \begin{array} { l l } { 1 , } & { { \mathrm { i f ~ } } x { \mathrm { ~ i s ~ a d v e r s a r i a l , } } } \\ { 0 , } & { { \mathrm { i f ~ } } x { \mathrm { ~ i s ~ c l e a n . } } } \end{array} \right. }
38
+ $$
39
+
40
+ The variable $z$ is usually considered as hidden in the inference phase, so an input $x$ (either clean or adversarially corrupted) can be generally denoted as $x = x _ { 0 } + \delta \cdot \mathbf { 1 } _ { z = 1 }$ . Here $x _ { 0 }$ is a clean sample from the data manifold $p ( x )$ with label $y _ { 0 }$ , $\mathbf { 1 } _ { z = 1 }$ is the indicator function, and $\delta$ is a potential perturbation crafted by adversaries. It is worthy to note that the perturbation $\delta$ should not change the true label of the input, i.e., $y = y _ { 0 }$ . For $\ell _ { p }$ -norm adversarial attacks (Kurakin et al., 2017; Madry et al., 2018), we have $\| \delta \| _ { p } \leq \epsilon$ , where $\epsilon$ is a preset threshold. Based on the assumption that adversarial examples are off the data manifolds, we formally have $x _ { 0 } + \delta \not \in \operatorname { s u p p } ( p ( x ) )$ (Pang et al., 2018a).
41
+
42
+ # 2.2 MIXUP IN TRAINING
43
+
44
+ In supervised learning, the most commonly used training mechanism is the empirical risk minimization (ERM) principle (Vapnik, 2013), which minimizes $\begin{array} { r } { \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathcal { L } ( F ( x _ { i } ) , y _ { i } ) } \end{array}$ on the training dataset $\mathbfcal { D } = \{ ( x _ { i } , \bar { y _ { i } } ) \} _ { i = 1 } ^ { n }$ with the loss function $\mathcal { L }$ . While computationally efficient, ERM could lead to memorization of data (Zhang et al., 2017) and weak adversarial robustness (Szegedy et al., 2014).
45
+
46
+ As an alternative, Zhang et al. (2018) introduce the mixup training mechanism, which minimizes 1m Pmj=1 L(F (˜xj ), y˜j ). Here x˜j = λxj0 + (1 − λ)xj1; y˜j = λyj0 + (1 − λ)yj1, the input-label pairs $( x _ { j 0 } , y _ { j 0 } )$ and $( x _ { j 1 } , y _ { j 1 } )$ are randomly sampled from the training dataset, $\lambda \sim \operatorname { B e t a } ( \alpha , \alpha )$ and $\alpha$ is a hyperparameter. Training by mixup will induce globally linear behavior of models in-between data manifolds, which can empirically improve generalization performance and adversarial robustness (Zhang et al., 2018; Tokozume et al., 2018a;b; Verma et al., 2019a;b). Compared to the adversarial training (AT) methods (Goodfellow et al., 2015; Madry et al., 2018), trained by mixup requires much less computation and can keep state-of-the-art performance on the clean inputs.
47
+
48
+ # 3 METHODOLOGY
49
+
50
+ Although the mixup mechanism has been widely shown to be effective in different domains (Berthelot et al., 2019; Beckham et al., 2019; Verma et al., 2019a;b), most of the previous work only focuses on embedding the mixup mechanism in the training phase, while in the inference phase the global linearity of the trained model is not well exploited. Compared to passively defending adversarial examples by directly classifying them, it would be more effective to actively utilize the globality of mixup-trained models in the inference phase to break the locality of adversarial perturbations.
51
+
52
+ # 3.1 MIXUP INFERENCE
53
+
54
+ The above insight inspires us to propose the mixup inference (MI) method, which is a specialized inference principle for the mixup-trained models. In the following, we apply colored $y ,$ and $y _ { s }$ to visually distinguish different notations. Consider an input triplet $( x , y , z )$ , where $z$ is unknown in advance. When directly feeding $x$ into the classifier $F$ , we can obtain the predicted label $\hat { y }$ . In the adversarial setting, we are only interested in the cases where $x$ is correctly classified by $F$ if it is clean, or wrongly classified if it is adversarial (Kurakin et al., 2018). This can be formally denoted as
55
+
56
+ $$
57
+ \mathbf { 1 } _ { y \neq } \ = \mathbf { 1 } _ { z = 1 } .
58
+ $$
59
+
60
+ The general mechanism of MI works as follows. Every time we execute MI, we first sample a label $y _ { s } \sim p _ { s } ( y )$ , then we sample $x _ { s }$ from $p _ { s } ( x | y _ { s } )$ and mixup it with $x$ as $\tilde { x } = \lambda x + ( 1 - \lambda ) x _ { s }$ . $p _ { s } ( x , y )$ denotes the sample distribution, which is constrained to be on the data manifold, i.e., $\operatorname { s u p p } ( p _ { s } ( x ) ) \subset$ supp $( p ( x ) )$ . In practice, we execute $\mathbf { M I }$ for $N$ times and average the output predictions to obtain $F _ { \mathrm { M I } } ( x )$ , as described in Alg. 1. Here we fix the mixup ratio $\lambda$ in MI as a hyperparameter, while similar properties hold if $\lambda$ comes from certain distribution.
61
+
62
+ # 3.2 THEORETICAL ANALYSES
63
+
64
+ Theoretically, with unlimited capability and sufficient clean samples, a well mixup-trained model $F$ can be denoted as a linear function $H$ on the convex combinations of clean examples (Hornik et al., 1989; Guo et al., 2019), i.e., $\forall x _ { i } , x _ { j } \sim p ( x )$ and $\lambda \in [ 0 , 1 ]$ , there is
65
+
66
+ $$
67
+ H ( \lambda x _ { i } + ( 1 - \lambda ) x _ { j } ) = \lambda H ( x _ { i } ) + ( 1 - \lambda ) H ( x _ { j } ) .
68
+ $$
69
+
70
+ Algorithm 1 Mixup Inference (MI)
71
+
72
+ <table><tr><td>Input: The mixup-trained classifier F; the input x. Hyperparameters: The sample distribution ps; the mixup ratio 入; the number of execution N.</td></tr><tr><td>Initialize FM1(x) = O; for k = 1 to N do</td></tr><tr><td>Sample ys,k ~ps(ys),xs,k ~ps(xslys,k);</td></tr><tr><td>Mixup x with xs,k as xk = x +(1-λ)xs,k;</td></tr><tr><td>Update Fm1(x) =FM(x)+F(xk);</td></tr><tr><td>end for</td></tr><tr><td>Return: The prediction FM1(x) of input x.</td></tr></table>
73
+
74
+ Specially, we consider the case where the training objective $\mathcal { L }$ is the cross-entropy loss, then $H ( x _ { i } )$ should predict the one-hot vector of label $y _ { i }$ , i.e., $H _ { y } ( x _ { i } ) = \mathbf { 1 } _ { y = y _ { i } }$ . If the input $x = x _ { 0 } + \delta$ is adversarial, then there should be an extra non-linear part $G ( \delta ; x _ { 0 } )$ of $F$ , since $x$ is off the data manifolds. Thus for any input $x$ , the prediction vector can be compactly denoted as
75
+
76
+ $$
77
+ F ( x ) = F ( x _ { 0 } + \delta \cdot \mathbf { 1 } _ { z = 1 } ) = H ( x _ { 0 } ) + G ( \delta ; x _ { 0 } ) \cdot \mathbf { 1 } _ { z = 1 } .
78
+ $$
79
+
80
+ According to Eq. (3) and Eq. (4), the output of $\tilde { x }$ in MI is given by:
81
+
82
+ $$
83
+ \begin{array} { r l r } { { F ( \tilde { x } ) = H ( \tilde { x } _ { 0 } ) + G ( \lambda \delta ; \tilde { x } _ { 0 } ) \cdot \mathbf { 1 } _ { z = 1 } } } \\ & { } & { ~ = \lambda H ( x _ { 0 } ) + ( 1 - \lambda ) H ( x _ { s } ) + G ( \lambda \delta ; \tilde { x } _ { 0 } ) \cdot \mathbf { 1 } _ { z = 1 } , } \end{array}
84
+ $$
85
+
86
+ where $\tilde { x } _ { 0 } = \lambda x _ { 0 } + ( 1 - \lambda ) x _ { s }$ is a virtual unperturbed counterpart of $\tilde { x }$ as shown in Fig. 1(c). Note that $F _ { \mathrm { M I } } ( x )$ in Alg. 1 is a Monte Carlo approximation of $\mathbb { E } _ { p _ { s } } [ \bar { F } ( \tilde { x } ) ]$ as
87
+
88
+ $$
89
+ F _ { \mathrm { M I } } ( { \boldsymbol { x } } ) = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } F ( \tilde { { \boldsymbol { x } } } _ { i } ) \xrightarrow { \infty } \mathbb { E } _ { p _ { s } } [ F ( \tilde { { \boldsymbol { x } } } ) ] ,
90
+ $$
91
+
92
+ where $\xrightarrow { \infty }$ represents the limitation when the execution times $N \to \infty$ . Now we separately investigate the $y \cdot$ -th and $\hat { y }$ -th (could be the same one) components of $F ( \tilde { x } )$ according to Eq. (5), and see how these two components differ from those of $F ( x )$ . These two components are critical because they decide whether we can correctly classify or detect adversarial examples (Goodfellow et al., 2016). Note that there is $H _ { y } ( x _ { 0 } ) = 1$ and $\textit { H } \left( x _ { s } \right) = 1$ , thus we have the $y$ -th components as
93
+
94
+ $$
95
+ \begin{array} { r l } & { F _ { y } ( x ) = 1 + G _ { y } ( \delta ; x _ { 0 } ) \cdot \mathbf { 1 } _ { z = 1 } ; } \\ & { F _ { y } ( \tilde { x } ) = \lambda + ( 1 - \lambda ) \cdot \mathbf { 1 } _ { y = y _ { s } } + G _ { y } ( \lambda \delta ; \tilde { x } _ { 0 } ) \cdot \mathbf { 1 } _ { z = 1 } . } \end{array}
96
+ $$
97
+
98
+ Furthermore, according to Eq. (2), there is $\mathbf { 1 } _ { y = } ~ = \mathbf { 1 } _ { z = 0 }$ . We can represent the $\hat { y }$ -th components as
99
+
100
+ $$
101
+ \begin{array} { r l } & { F _ { \hat { y } } ( x ) = \mathbf { 1 } _ { z = 0 } + G _ { \hat { y } } ( \delta ; x _ { 0 } ) \cdot \mathbf { 1 } _ { z = 1 } ; } \\ & { F _ { \hat { y } } ( \tilde { x } ) = \lambda \cdot \mathbf { 1 } _ { z = 0 } + ( 1 - \lambda ) \cdot \mathbf { 1 } _ { \hat { y } = y _ { s } } + G _ { \hat { y } } ( \lambda \delta ; \tilde { x } _ { 0 } ) \cdot \mathbf { 1 } _ { z = 1 } . } \end{array}
102
+ $$
103
+
104
+ From the above formulas we can find that, except for the hidden variable $z$ , the sampling label $\cdot$ is another variable which controls the MI output $F ( \tilde { x } )$ for each execution. Different distributions of sampling $\cdot$ result in different versions of MI. Here we consider two easy-to-implement cases:
105
+
106
+ MI with predicted label (MI-PL): In this case, the sampling label $\cdot$ is the same as the predicted label $\hat { y }$ , i.e., $p _ { s } ( y ) = \mathbf { 1 } _ { y = }$ is a Dirac distribution on $\hat { y }$ .
107
+
108
+ MI with other labels (MI-OL): In this case, the label $y _ { s }$ is uniformly sampled from the labels other than $\cdot$ , i.e., $p _ { s } ( y ) = \mathcal { U } \ ( y )$ is a discrete uniform distribution on the set $\{ y \in [ L ] | y \neq \hat { y } \}$ .
109
+
110
+ We list the simplified formulas of Eq. (7) and Eq. (8) under different cases in Table 1 for clear representation. With the above formulas, we can evaluate how the model performance changes with and without MI by focusing on the formula of
111
+
112
+ $$
113
+ \Delta F ( x ; p _ { s } ) = F _ { \mathrm { M I } } ( x ) - F ( x ) \stackrel { \infty } { \longrightarrow } \mathbb { E } _ { p _ { s } } [ F ( \tilde { x } ) ] - F ( x ) .
114
+ $$
115
+
116
+ Specifically, in the general-purpose setting where we aim to correctly classify adversarial examples (Madry et al., 2018), we claim that the MI method improves the robustness if the prediction
117
+
118
+ Table 1: The the simplified formulas of Eq. (7) and Eq. (8) in different versions of MI. Here MI-PL indicates mixup inference with predicted label; MI-OL indicates mixup inference with other labels.
119
+
120
+ $$
121
+ \boxed \begin{array} { c c } \boxed \begin{array} { c c } \boxed \begin{array} { c c } \boxed \begin{array} { c c } \boxed { { \begin{array} { c c c } { \boxed { { { \begin{array} n { c c c } } { \boxed { { { \begin{array} n { c c c } } { \boxed { { { \begin{array} n { c c c } } { \boxed { { { \begin{array} n { c c c } } } { \boxed { { { \begin{ c c c c } } } { \boxed { { { \begin{ c c c c } } } \end{array} } } } } } } } } } } } \\ { \end{ \boxed { { { { \begin{array} { c c c } { \boxed { { { F \begin{array} { c c c } } { \boxed { { { \begin{array} 1 c c } } { \boxed { { { 1 } } } } } } } } \end{array} } } } } } } \\ { \end{array} \boxed { { { 1 \begin{array} {array} { c c c } { \boxed { { { 1 } } } } } \end{array} } } } \end{array} } } } } } } } & \boxed \begin{array} { c c } { \boxed { { \begin{array} { c c } { \boxed { { \begin{array} { c c c } { \boxed { { { \begin{array} } { c c c } { \boxed { { { \begin{array} } { c c c } } { \boxed { { { \begin{ c c c } } } { \boxed { { { \begin{ c c } } { \boxplus } } } } } \\ { z } } \end{array} } } } } } } \\ { \end{array} \boxed {array} { \begin{array} { c c } { \boxed { { \begin{array} { c c c } { \boxed { { { 1 } } } } } \end{array} } } } } \end{array} } } } } } & \boxed \begin{array} { c c } \boxed { \begin{array} { c c } { \boxed { { \begin{array} { c c c } { \boxed { { \begin{array} { c c c } } { \boxed { { { \begin{ c c c } } } { \boxed { { { \begin{ c c } } { \boxed { { 1 } } } } } } \\ { \end{ \begin{ c } { 1 } } } \end{array} } } } } } \\ { \end{array} \boxed { { \begin{array} { c c } { \boxed { { 1 } } } } \end{array} } } } } } \\ \end{array} \begin{array} { c } \boxed F \begin{array} { c c } \boxed { { \begin{array} { c c } { \boxed { { \begin{array} { c c c } } { \boxed { { \begin{ c c } } { \boxed { { \begin{ c c } } { 1 } } } \end{array} } } } } \\ { \boxed { { \begin{array} { c c } { \boxed { { 1 } } } \end{array} } } } } \end{array} } \end{array} \end{array} \end{array} \end{array} \end{array} \end{array} \end{array} \end{array} \end{array} \end{array} \end{array} \end{array} \end{array} \end{array}
122
+ $$
123
+
124
+ value on the true label $y$ increases while it on the adversarial label $\hat { y }$ decreases after performing MI when the input is adversarial $z = 1$ ). This can be formally denoted as
125
+
126
+ $$
127
+ \Delta F _ { y } ( x ; p _ { s } ) | _ { z = 1 } > 0 ; \Delta F _ { \hat { y } } ( x ; p _ { s } ) | _ { z = 1 } < 0 .
128
+ $$
129
+
130
+ We refer to this condition in Eq. (10) as robustness improving condition (RIC). Further, in the detection-purpose setting where we want to detect the hidden variable $z$ and filter out adversarial inputs, we can take the gap of the $\hat { y }$ -th component of predictions before and after the MI operation, i.e., $\Delta F _ { \hat { y } } ( x ; p _ { s } )$ as the detection metric (Pang et al., 2018a). To formally measure the detection ability on $z$ , we use the detection gap (DG), denoted as
131
+
132
+ $$
133
+ \mathbb { D } \mathbb { G } = \Delta F \left. \left( x ; p _ { s } \right) \right| _ { z = 1 } - \Delta F \left. \left( x ; p _ { s } \right) \right| _ { z = 0 } .
134
+ $$
135
+
136
+ A higher value of DG indicates that $\Delta F \left( x ; p _ { s } \right)$ is better as a detection metric. In the following sections, we specifically analyze the properties of different versions of MI according to Table 1, and we will see that the MI methods can be used and benefit in different defense strategies.
137
+
138
+ # 3.2.1 MIXUP INFERENCE WITH PREDICTED LABEL
139
+
140
+ In the MI-PL case, when the input is clean (i.e., $z = 0$ ), there is $F ( x ) = F ( \tilde { x } )$ , which means ideally the MI-PL operation does not influence the predictions on the clean inputs. When the input is adversarial (i.e., $z = 1$ ), MI-PL can be applied as a general-purpose defense or a detection-purpose defense, as we separately introduce below:
141
+
142
+ General-purpose defense: If MI-PL can improve the general-purpose robustness, it should satisfy RIC in Eq. (10). By simple derivation and the results of Table 1, this means that
143
+
144
+ $$
145
+ \begin{array} { r } { \mathbb { E } _ { x _ { s } \sim p _ { s } ( x \mid \mathbf { \theta } ) } \left[ G _ { k } ( \delta ; x _ { 0 } ) - G _ { k } ( \lambda \delta ; \tilde { x } _ { 0 } ) \right] \left\{ \begin{array} { l l } { > 1 - \lambda , } & { \mathrm { i f } \ k = \mathbf { \sigma } , } \\ { < \lambda - 1 , } & { \mathrm { i f } \ k = y . } \end{array} \right. } \end{array}
146
+ $$
147
+
148
+ Since an adversarial perturbation usually suppress the predicted confidence on the true label and promote it on the target label (Goodfellow et al., 2015), there should be $G _ { \hat { y } } ( \delta ; \tilde { x } _ { 0 } ) > 0$ and $G _ { y } ( \delta ; \tilde { x } _ { 0 } ) \dot { < } 0$ Note that the left part of Eq. (12) can be decomposed into
149
+
150
+ $$
151
+ \underbrace { \mathbb { E } _ { x _ { s } \sim p _ { s } ( x | \mathit { \Delta } ) } \left[ G _ { k } ( \delta ; x _ { 0 } ) - G _ { k } ( \delta ; \tilde { x } _ { 0 } ) \right] } _ { \mathrm { i n p u t t r a n s f e r } } + \underbrace { \mathbb { E } _ { x _ { s } \sim p _ { s } ( x | \mathit { \Delta } ) } \left[ G _ { k } ( \delta ; \tilde { x } _ { 0 } ) - G _ { k } ( \lambda \delta ; \tilde { x } _ { 0 } ) \right] } _ { \mathrm { p e r t u r b a t i o n ~ s h r i n k a g e } } .
152
+ $$
153
+
154
+ Here Eq. (13) indicates the two basic mechanisms of the MI operations defending adversarial attacks, as shown in Fig. 1(c). The first mechanism is input transfer, i.e., the clean input that the adversarial perturbation acts on transfers from the deterministic $x _ { 0 }$ to stochastic $\tilde { x } _ { 0 }$ . Compared to the Gaussian noise or different image processing methods which introduce spatially or semantically local randomness, the stochastic $\tilde { x } _ { 0 }$ induces spatially global and semantically diverse randomness. This will make it harder to perform an adaptive attack in the white-box setting (Athalye et al., 2018).
155
+
156
+ The second mechanism is perturbation shrinkage, where the original perturbation $\delta$ shrinks by a factor $\lambda$ . This equivalently shrinks the perturbation threshold since $\| \lambda \bar { \delta } \| _ { p } = \lambda \| \delta \| _ { p } \leq \lambda \epsilon$ , which means that MI generally imposes a tighter upper bound on the potential attack ability for a crafted perturbation. Besides, empirical results in previous work also show that a smaller perturbation threshold largely weakens the effect of attacks (Kurakin et al., 2018). Therefore, if an adversarial attack defended by these two mechanisms leads to a prediction degradation as in Eq. (12), then applying MI-PL would improve the robustness against this adversarial attack. Similar properties also hold for MI-OL as described in Sec. 3.2.2. In Fig. 2, we empirically demonstrate that most of the existing adversarial attacks, e.g., the PGD attack (Madry et al., 2018) satisfies these properties.
157
+
158
+ ![](images/8011d76f4fd07cde5f4ef8c925c8a8adcf55ffa04bf99546f8331fb9ebb07475.jpg)
159
+ Figure 2: The results are averaged on 100 randomly test clean samples of CIFAR-10. The adversarial attack is untargeted PGD-10. Note that the $\Delta G _ { y }$ calculated here is the minus value of it in Eq. (12) and Eq. (15).
160
+
161
+ Detection-purpose defense: According to Eq. (11), the formula of DG for MI-PL is
162
+
163
+ $$
164
+ \begin{array} { r } { \mathbb { D } \mathbb { G } _ { \mathrm { M I - P L } } = \mathbb { E } _ { { x _ { s } } \sim p _ { s } ( x | \hat { y } ) } [ G _ { \hat { y } } ( \delta ; x _ { 0 } ) - G _ { \hat { y } } ( \lambda \delta ; \tilde { x } _ { 0 } ) ] - ( 1 - \lambda ) . } \end{array}
165
+ $$
166
+
167
+ By comparing Eq. (12) and Eq. (14), we can find that they are consistent with each other, which means that for a given adversarial attack, if MI-PL can better defend it in general-purpose, then ideally MI-PL can also better detect the crafted adversarial examples.
168
+
169
+ # 3.2.2 MIXUP INFERENCE WITH OTHER LABELS
170
+
171
+ As to MI-OL, when the input is clean $z = 0$ ), there would be a degeneration on the optimal clean prediction as $F _ { y } ( \tilde { x } ) = F _ { \hat { y } } ( \tilde { x } ) = \lambda$ , since the sampled $x _ { s }$ does not come from the true label $y$ . As compensation, MI-OL can better improve robustness compared to MI-PL when the input is adversarial $z = 1$ ), since the sampled $x _ { s }$ also does not come from the adversarial label $\cdot$ in this case.
172
+
173
+ General-purpose defense: Note that in the MI-OL formulas of Table 1, there is a term of $\mathbf { 1 } _ { y = }$ Since we uniformly select $y _ { s }$ from the set $[ L ] \setminus \{ \begin{array} { r l } \end{array} \}$ , there is $\begin{array} { r } { \mathbb { E } ( \mathbf { 1 } _ { y = y _ { s } } ) = \frac { 1 } { L - 1 } } \end{array}$ s ) = 1L−1 . According to the RIC, MI-OL can improve robustness against the adversarial attacks if there satisfies
174
+
175
+ $$
176
+ \begin{array} { r l r } { \mathbb { E } } & { \sim \mathcal { U } \operatorname { \langle \mu \rangle } \mathbb { E } _ { x _ { s } \sim p _ { s } ( x | \mathrm { ~ \Lambda ~ } ) } \left[ G _ { k } ( \delta ; x _ { 0 } ) - G _ { k } ( \lambda \delta ; \tilde { x } _ { 0 } ) \right] \left\{ \begin{array} { l l } { > 0 , } & { \mathrm { i f ~ } k = { \it \Delta \phi } , } \\ { < \frac { ( \lambda - 1 ) ( L - 2 ) } { L - 1 } , } & { \mathrm { i f ~ } k = y . } \end{array} \right. } \end{array}
177
+ $$
178
+
179
+ Note that the conditions in Eq. (15) is strictly looser than Eq. (12), which means MI-OL can defend broader range of attacks than MI-PL, as verified in Fig. 2.
180
+
181
+ Detection-purpose defense: According to Eq. (11) and Table 1, the DG for MI-OL is
182
+
183
+ $$
184
+ \mathbb { D } \mathbb { G } _ { \mathrm { M I } \mathrm { - } \mathrm { O L } } = \mathbb { E } _ { y _ { s } \sim \mathcal { U } _ { \hat { y } } ( y ) } \mathbb { E } _ { x _ { s } \sim p _ { s } ( x | y _ { s } ) } [ G _ { \hat { y } } ( \delta ; x _ { 0 } ) - G _ { \hat { y } } ( \lambda \delta ; \tilde { x } _ { 0 } ) ] - ( 1 - \lambda ) .
185
+ $$
186
+
187
+ It is interesting to note that $\mathbb { D } \mathbb { G } _ { \mathrm { M I \mathrm { - } P L } } = \mathbb { D } \mathbb { G } _ { \mathrm { M I \mathrm { - } O L } }$ , thus the two variants of MI have the same theoretical performance in the detection-purpose defenses. However, in practice we find that MI-PL performs better than MI-OL in detection, since empirically mixup-trained models cannot induce ideal global linearity (cf. Fig. 2 in Zhang et al. (2018)). Besides, according to Eq. (6), to statistically make sure that the clean inputs will be correctly classified after MI-OL, there should be $\forall k \in [ L ] \setminus \{ y \}$ ,
188
+
189
+ $$
190
+ \mathbb { E } _ { y _ { s } \sim \mathcal { U } _ { \hat { y } } ( y ) } \mathbb { E } _ { x _ { s } \sim p _ { s } ( x \mid y _ { s } ) } [ F _ { y } - F _ { k } ] > 0 \Longrightarrow \lambda > L ^ { - 1 } .
191
+ $$
192
+
193
+ # 4 EXPERIMENTS
194
+
195
+ In this section, we provide the experimental results on CIFAR-10 and CIFAR-100 (Krizhevsky & Hinton, 2009) to demonstrate the effectiveness of our MI methods on defending adversarial attacks. Our codes are available at https://github.com/P2333/Mixup-Inference.
196
+
197
+ Table 2: Classification accuracy $( \% )$ on the oblivious adversarial examples crafted on 1,000 randomly sampled test points of CIFAR-10. Perturbation $\epsilon = 8 / 2 5 5$ with step size 2/255. The subscripts indicate the number of iteration steps when performing attacks. The notation $\leq 1$ represents accuracy less than $1 \%$ . The parameter settings for each method can be found in Table 4.
198
+
199
+ <table><tr><td rowspan="3">Methods</td><td rowspan="3">Cle.</td><td colspan="4">Untargeted Mode</td><td colspan="3">Targeted Mode</td></tr><tr><td rowspan="2"></td><td colspan="3">PGD50</td><td colspan="3"></td></tr><tr><td>PGD10</td><td>PGD200</td><td></td><td>PGD10</td><td>PGD50</td><td>PGD200</td></tr><tr><td>Mixup</td><td>93.8</td><td>3.6</td><td>3.2</td><td>3.1</td><td>≤1</td><td></td><td>≤1</td><td>&lt;1</td></tr><tr><td>Mixup + Gaussian noise</td><td>84.4</td><td>13.5</td><td>9.6</td><td>8.8</td><td>37.7</td><td></td><td>28.6</td><td>27.9</td></tr><tr><td>Mixup + Random rotation</td><td>82.0</td><td>21.8</td><td>18.7</td><td>18.2</td><td>38.9</td><td></td><td>32.5</td><td>26.5</td></tr><tr><td>Mixup + Xie et al. (2018)</td><td>82.1</td><td>23.0</td><td>19.6</td><td>19.1</td><td>38.4</td><td></td><td>31.1</td><td>25.2</td></tr><tr><td>Mixup + Guo et al. (2018)</td><td>83.3</td><td>31.2</td><td>28.8</td><td>28.3</td><td>57.8</td><td></td><td>49.1</td><td>48.9</td></tr><tr><td>ERM + MI-OL (ablation study)</td><td>81.6</td><td>7.4</td><td>6.4</td><td>6.1</td><td>33.0</td><td></td><td>26.7</td><td>23.2</td></tr><tr><td>Mixup + MI-OL</td><td>83.9</td><td>26.1</td><td>18.8</td><td>18.3</td><td>55.6</td><td></td><td>51.2</td><td>50.8</td></tr><tr><td>Mixup + MI-Combined</td><td>82.9</td><td>33.7</td><td>31.0</td><td>30.7</td><td>56.1</td><td></td><td>49.7</td><td>49.4</td></tr><tr><td>Interpolated AT</td><td>89.7</td><td>46.7</td><td>43.5</td><td>42.5</td><td>65.6</td><td></td><td>62.5</td><td>61.9</td></tr><tr><td>Interpolated AT + Gaussian noise</td><td>84.7</td><td>55.6</td><td>53.7</td><td>53.5</td><td>70.1</td><td></td><td>69.1</td><td>69.0</td></tr><tr><td>Interpolated AT + Random rotation</td><td>83.4</td><td>57.8</td><td>56.7</td><td>55.9</td><td>69.8</td><td></td><td>68.2</td><td>67.4</td></tr><tr><td>Interpolated AT + Xie et al. (2018)</td><td>82.1</td><td>59.7</td><td>58.4</td><td>57.9</td><td>71.1</td><td></td><td>69.7</td><td>69.3</td></tr><tr><td>Interpolated AT + Guo et al. (2018)</td><td>83.9</td><td>60.9</td><td>60.7</td><td>60.3</td><td>73.2</td><td></td><td>72.1</td><td>71.6</td></tr><tr><td>AT + MI-OL (ablation study)</td><td>81.2</td><td>56.2</td><td>55.8</td><td>55.1</td><td>67.7</td><td></td><td>67.2</td><td>66.4</td></tr><tr><td>Interpolated AT + MI-OL</td><td>84.2</td><td>64.5</td><td>63.8</td><td>63.3</td><td>75.3</td><td></td><td></td><td>74.7</td></tr><tr><td>1</td><td>0.88 0.84</td><td>50</td><td>mixup + Gaussian noise</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>0.9</td><td></td><td>yXesareeer reras 45</td><td>mixup + Rotation</td><td>mixup + Xie et al. (2018)</td><td></td><td></td><td></td><td></td></tr><tr><td>0.78 0.8 0.72 0.7</td><td></td><td>40</td><td>ERM + MI-OL</td><td>mixup + Guo et al. (2018)</td><td>★</td><td></td><td>★</td><td></td></tr><tr><td>0.6</td><td></td><td>X*★ 35 30</td><td>mixup + MI-OL</td><td>mixup + MI-Combined</td><td></td><td>米</td><td>:</td><td>米</td></tr><tr><td>Random guess 0.5 0.4</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>0.3 0.23</td><td>25</td><td></td><td></td><td>A</td><td></td><td>+</td><td>+</td><td></td></tr><tr><td>0.2</td><td>20</td><td></td><td></td><td></td><td></td><td></td><td></td><td>× ×</td></tr><tr><td>0.080.05 0.1 0.01 0</td><td>15 10</td><td></td><td></td><td></td><td></td><td></td><td></td><td>+</td></tr><tr><td>Mixup Mixup + MI-PL</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>5</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>PGD-10 (untargeted) PGD-50 (untargeted) PGD-10 (targeted) ■PGD-50(targeted)</td><td>0 0</td><td>102030405060708</td><td></td><td></td><td></td><td></td><td></td><td>8090100</td></tr><tr><td>(a) AUC scores</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="3"></td><td colspan="4">Accuracy on clean examples (%) (b) Adversarial accuracy w.r.t clean accuracy</td><td></td><td></td></tr></table>
200
+
201
+ Figure 3: Results on CIFAR-10. (a) AUC scores on 1,000 randomly selected test clean samples and 1,000 adversarial counterparts crafted on these clean samples. (b) The adversarial accuracy w.r.t clean accuracy on 1,000 randomly selected test samples. The adversarial attack is untargeted PGD-10, with $\epsilon = 8 / 2 5 5$ and step size 2/255. Each point for a certain method corresponds to a set of hyperparameters.
202
+
203
+ # 4.1 SETUP
204
+
205
+ In training, we use ResNet-50 (He et al., 2016) and apply the momentum SGD optimizer (Qian, 1999) on both CIFAR-10 and CIFAR-100. We run the training for 200 epochs with the batch size of 64. The initial learning rate is 0.01 for ERM, mixup and AT; 0.1 for interpolated AT (Lamb et al., 2019). The learning rate decays with a factor of 0.1 at 100 and 150 epochs. The attack method for AT and interpolated AT is untargeted PGD-10 with $\epsilon = 8 / 2 5 5$ and step size $2 / 2 5 5$ (Madry et al., 2018), and the ratio of the clean examples and the adversarial ones in each mini-batch is $1 : 1$ (Lamb et al., 2019). The hyperparameter $\alpha$ for mixup and interpolated AT is 1.0 (Zhang et al., 2018). All defenses with randomness are executed 30 times to obtain the averaged predictions (Xie et al., 2018).
206
+
207
+ # 4.2 EMPIRICAL VERIFICATION OF THEORETICAL ANALYSES
208
+
209
+ To verify and illustrate our theoretical analyses in Sec. 3, we provide the empirical relationship between the output predictions of MI and the hyperparameter $\lambda$ in Fig. 2. The notations and formulas annotated in Fig. 2 correspond to those introduced in Sec. 3. We can see that the results follow our theoretical conclusions under the assumption of ideal global linearity. Besides, both MI-PL and MI-OL empirically satisfy RIC in this case, which indicates that they can improve robustness under the untargeted PGD-10 attack on CIFAR-10, as quantitatively demonstrated in the following sections.
210
+
211
+ Table 3: Classification accuracy $( \% )$ on the oblivious adversarial examples crafted on 1,000 randomly sampled test points of CIFAR-100. Perturbation $\epsilon = 8 / 2 5 5$ with step size 2/255. The subscripts indicate the number of iteration steps when performing attacks. The notation $\leq 1$ represents accuracy less than $1 \%$ . The parameter settings for each method can be found in Table 5.
212
+
213
+ <table><tr><td rowspan=2 colspan=1>Methods</td><td rowspan=2 colspan=1>Cle.</td><td rowspan=2 colspan=3>Untargeted ModePGD10 PGD50 PGD200</td><td rowspan=2 colspan=3>Targeted ModePGD10 PGD50 PGD200</td></tr><tr><td rowspan=1 colspan=1>PGD50</td><td rowspan=1 colspan=1>PGD200</td><td rowspan=1 colspan=1>PGD10</td><td rowspan=1 colspan=1>PGD50</td></tr><tr><td rowspan=5 colspan=1>MixupMixup + Gaussian noiseMixup + Random rotationMixup + Xie et al. (2018)Mixup + Guo et al. (2018)</td><td rowspan=1 colspan=1>74.2</td><td rowspan=1 colspan=1>5.5</td><td rowspan=1 colspan=1>5.3</td><td rowspan=1 colspan=1>5.2</td><td rowspan=1 colspan=1>≤1</td><td rowspan=1 colspan=1>≤1</td><td rowspan=2 colspan=1>≤14.1</td></tr><tr><td rowspan=1 colspan=1>65.0</td><td rowspan=1 colspan=1>5.5</td><td rowspan=1 colspan=1>5.3</td><td rowspan=1 colspan=1>5.3</td><td rowspan=1 colspan=1>10.0</td><td rowspan=1 colspan=1>4.3</td></tr><tr><td rowspan=1 colspan=1>66.2</td><td rowspan=1 colspan=1>7.8</td><td rowspan=1 colspan=1>6.7</td><td rowspan=1 colspan=1>6.3</td><td rowspan=1 colspan=1>21.4</td><td rowspan=1 colspan=1>15.5</td><td rowspan=1 colspan=1>15.2</td></tr><tr><td rowspan=1 colspan=1>66.3</td><td rowspan=1 colspan=1>9.6</td><td rowspan=1 colspan=1>7.6</td><td rowspan=1 colspan=1>7.4</td><td rowspan=1 colspan=1>30.2</td><td rowspan=1 colspan=1>22.5</td><td rowspan=1 colspan=1>22.3</td></tr><tr><td rowspan=1 colspan=1>66.1</td><td rowspan=1 colspan=1>13.1</td><td rowspan=1 colspan=1>10.8</td><td rowspan=1 colspan=1>10.5</td><td rowspan=1 colspan=1>33.3</td><td rowspan=1 colspan=1>26.3</td><td rowspan=1 colspan=1>26.1</td></tr><tr><td rowspan=2 colspan=1>Mixup + MI-OLMixup + MI-Combined</td><td rowspan=2 colspan=1>68.867.0</td><td rowspan=1 colspan=1>12.6</td><td rowspan=1 colspan=1>9.4</td><td rowspan=1 colspan=1>9.1</td><td rowspan=1 colspan=1>37.0</td><td rowspan=2 colspan=1>29.026.9</td><td rowspan=2 colspan=1>28.726.7</td></tr><tr><td rowspan=1 colspan=1>14.8</td><td rowspan=1 colspan=1>11.7</td><td rowspan=1 colspan=1>11.3</td><td rowspan=1 colspan=1>31.4</td></tr><tr><td rowspan=4 colspan=1>Interpolated ATInterpolated AT + Gaussian noiseInterpolated AT + Random rotationInterpolated AT + Xie et al. (2018)</td><td rowspan=1 colspan=1>64.7</td><td rowspan=1 colspan=1>26.6</td><td rowspan=1 colspan=1>24.1</td><td rowspan=1 colspan=1>24.0</td><td rowspan=1 colspan=1>52.0</td><td rowspan=1 colspan=1>50.1</td><td rowspan=1 colspan=1>49.8</td></tr><tr><td rowspan=1 colspan=1>60.4</td><td rowspan=1 colspan=1>32.6</td><td rowspan=1 colspan=1>31.6</td><td rowspan=1 colspan=1>31.4</td><td rowspan=1 colspan=1>50.1</td><td rowspan=1 colspan=1>50.0</td><td rowspan=1 colspan=1>49.6</td></tr><tr><td rowspan=1 colspan=1>62.6</td><td rowspan=1 colspan=1>34.5</td><td rowspan=1 colspan=1>32.4</td><td rowspan=1 colspan=1>32.1</td><td rowspan=1 colspan=1>51.0</td><td rowspan=1 colspan=1>49.9</td><td rowspan=1 colspan=1>49.7</td></tr><tr><td rowspan=1 colspan=1>62.1</td><td rowspan=1 colspan=1>42.2</td><td rowspan=1 colspan=1>41.5</td><td rowspan=1 colspan=1>41.3</td><td rowspan=1 colspan=1>57.1</td><td rowspan=1 colspan=1>56.3</td><td rowspan=1 colspan=1>55.8</td></tr><tr><td rowspan=1 colspan=1>Interpolated AT + Guo et al. (2018)</td><td rowspan=1 colspan=1>61.5</td><td rowspan=1 colspan=1>36.2</td><td rowspan=1 colspan=1>33.7</td><td rowspan=1 colspan=1>33.3</td><td rowspan=1 colspan=1>53.8</td><td rowspan=1 colspan=1>52.4</td><td rowspan=1 colspan=1>52.2</td></tr><tr><td rowspan=1 colspan=1>Interpolated AT + MI-OL</td><td rowspan=1 colspan=1>62.0</td><td rowspan=1 colspan=1>43.8</td><td rowspan=1 colspan=1>42.8</td><td rowspan=1 colspan=1>42.5</td><td rowspan=1 colspan=1>58.1</td><td rowspan=1 colspan=1>56.7</td><td rowspan=1 colspan=1>56.5</td></tr></table>
214
+
215
+ # 4.3 PERFORMANCE UNDER OBLIVIOUS ATTACKS
216
+
217
+ In this subsection, we evaluate the performance of our method under the oblivious-box attacks (Carlini & Wagner, 2017). The oblivious threat model assumes that the adversary is not aware of the existence of the defense mechanism, e.g., MI, and generate adversarial examples based on the unsecured classification model. We separately apply the model trained by mixup and interpolated AT as the classification model. The AUC scores for the detection-purpose defense are given in Fig. 3(a). The results show that applying MI-PL in inference can better detect adversarial attacks, while directly detecting by the returned confidence without MI-PL performs even worse than a random guess.
218
+
219
+ We also compare MI with previous general-purpose defenses applied in the inference phase, e.g., adding Gaussian noise or random rotation (Tabacof & Valle, 2016); performing random padding or resizing after random cropping (Guo et al., 2018; Xie et al., 2018). The performance of our method and baselines on CIFAR-10 and CIFAR-100 are reported in Table 2 and Table 3, respectively. Since for each defense method, there is a trade-off between the accuracy on clean samples and adversarial samples depending on the hyperparameters, e.g., the standard deviation for Gaussian noise, we carefully select the hyperparameters to ensure both our method and baselines keep a similar performance on clean data for fair comparisons. The hyperparameters used in our method and baselines are reported in Table 4 and Table 5. In Fig. 3(b), we further explore this trade-off by grid searching the hyperparameter space for each defense to demonstrate the superiority of our method.
220
+
221
+ As shown in these results, our MI method can significantly improve the robustness for the trained models with induced global linearity, and is compatible with training-phase defenses like the interpolated AT method. As a practical strategy, we also evaluate a variant of MI, called MI-Combined, which applies MI-OL if the input is detected as adversarial by MI-PL with a default detection threshold; otherwise returns the prediction on the original input. We also perform ablation studies of ERM $/ \mathrm { A T } +$ MI-OL in Table 2, where no global linearity is induced. The results verify that our MI methods indeed exploit the global linearity of the mixup-trained models, rather than simply introduce randomness.
222
+
223
+ # 4.4 PERFORMANCE UNDER WHITE-BOX ADAPTIVE ATTACKS
224
+
225
+ Following Athalye et al. (2018), we test our method under the white-box adaptive attacks (detailed in Appendix B.2). Since we mainly adopt the PGD attack framework, which synthesizes adversarial examples iteratively, the adversarial noise will be clipped to make the input image stay within the valid range. It results in the fact that with mixup on different training examples, the adversarial perturbation will be clipped differently. To address this issue, we average the generated perturbations over the adaptive samples as the final perturbation. The results of the adversarial accuracy w.r.t the number of adaptive samples are shown in Fig. 4. We can see that even under a strong adaptive attack, equipped with MI can still improve the robustness for the classification models.
226
+
227
+ ![](images/5355a529935b75776ed26e5ff17e1bb507fea86befa34df1a7d1782e1eeaec71.jpg)
228
+ Figure 4: Classification accuracy under the adaptive PGD attacks on CIFAR-10. The number of adaptive samples refers to the execution times of sampling $x _ { s }$ in each iteration step of adaptive PGD. The dash lines are the accuracy of trained models without MI-OL under PGD attacks.
229
+
230
+ # 5 CONCLUSION
231
+
232
+ In this paper, we propose the MI method, which is specialized for the trained models with globally linear behaviors induced by, e.g., mixup or interpolated AT. As analyzed in Sec. 3, MI can exploit this induced global linearity in the inference phase to shrink and transfer the adversarial perturbation, which breaks the locality of adversarial attacks and alleviate their aggressivity. In experiments, we empirically verify that applying MI can return more reliable predictions under different threat models.
233
+
234
+ # ACKNOWLEDGEMENTS
235
+
236
+ This work was supported by the National Key Research and Development Program of China (No. 2017YFA0700904), NSFC Projects (Nos. 61620106010, U19B2034, U1811461), Beijing NSF Project (No. L172037), Beijing Academy of Artificial Intelligence (BAAI), Tsinghua-Huawei Joint Research Program, a grant from Tsinghua Institute for Guo Qiang, Tiangong Institute for Intelligent Computing, the JP Morgan Faculty Research Program and the NVIDIA NVAIL Program with GPU/DGX Acceleration.
237
+
238
+ # REFERENCES
239
+
240
+ Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. In International Conference on Machine Learning (ICML), 2018.
241
+
242
+ Christopher Beckham, Sina Honari, Alex Lamb, Vikas Verma, Farnoosh Ghadiri, R Devon Hjelm, and Christopher Pal. Adversarial mixup resynthesizers. In Advances in Neural Information Processing Systems (NeurIPS), 2019.
243
+
244
+ David Berthelot, Nicholas Carlini, Ian Goodfellow, Nicolas Papernot, Avital Oliver, and Colin Raffel. Mixmatch: A holistic approach to semi-supervised learning. In Advances in Neural Information Processing Systems (NeurIPS), 2019.
245
+
246
+ Nicholas Carlini and David Wagner. Adversarial examples are not easily detected: Bypassing ten detection methods. In ACM Workshop on Artificial Intelligence and Security (AISec), 2017.
247
+
248
+ Nicholas Carlini and David Wagner. Audio adversarial examples: Targeted attacks on speech-to-text. In 2018 IEEE Security and Privacy Workshops (SPW), pp. 1–7. IEEE, 2018.
249
+
250
+ Nicholas Carlini, Anish Athalye, Nicolas Papernot, Wieland Brendel, Jonas Rauber, Dimitris Tsipras, Ian Goodfellow, Aleksander Madry, and Alexey Kurakin. On evaluating adversarial robustness. arXiv preprint arXiv:1902.06705, 2019.
251
+
252
+ Hanjun Dai, Hui Li, Tian Tian, Xin Huang, Lin Wang, Jun Zhu, and Le Song. Adversarial attack on graph structured data. In International Conference on Machine Learning (ICML), 2018.
253
+
254
+ Yinpeng Dong, Fangzhou Liao, Tianyu Pang, Hang Su, Jun Zhu, Xiaolin Hu, and Jianguo Li. Boosting adversarial attacks with momentum. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
255
+
256
+ Logan Engstrom, Brandon Tran, Dimitris Tsipras, Ludwig Schmidt, and Aleksander Madry. A rotation and a translation suffice: Fooling cnns with simple transformations. In International Conference on Machine Learning (ICML), 2019.
257
+
258
+ Alhussein Fawzi, Seyed-Mohsen Moosavi-Dezfooli, and Pascal Frossard. Robustness of classifiers: from adversarial to random noise. In Advances in Neural Information Processing Systems (NeurIPS), pp. 1632–1640, 2016.
259
+
260
+ Alhussein Fawzi, Hamza Fawzi, and Omar Fawzi. Adversarial vulnerability for any classifier. In Advances in Neural Information Processing Systems (NeurIPS), 2018.
261
+
262
+ Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. MIT Press, 2016. http: //www.deeplearningbook.org.
263
+
264
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations (ICLR), 2015.
265
+
266
+ Chuan Guo, Mayank Rana, Moustapha Cisse, and Laurens Van Der Maaten. Countering adversarial images using input transformations. In International Conference on Learning Representations (ICLR), 2018.
267
+
268
+ Hongyu Guo, Yongyi Mao, and Richong Zhang. Mixup as locally linear out-of-manifold regularization. In Proceedings of the AAAI Conference on Artificial Intelligence (AAAI), volume 33, pp. 3714–3722, 2019.
269
+
270
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European Conference on Computer Vision (ECCV), pp. 630–645. Springer, 2016.
271
+
272
+ Kurt Hornik, Maxwell Stinchcombe, and Halbert White. Multilayer feedforward networks are universal approximators. Neural networks, 2(5):359–366, 1989.
273
+
274
+ Sandy Huang, Nicolas Papernot, Ian Goodfellow, Yan Duan, and Pieter Abbeel. Adversarial attacks on neural network policies. arXiv preprint arXiv:1702.02284, 2017.
275
+
276
+ Hiroshi Inoue. Data augmentation by pairing samples for images classification. arXiv preprint arXiv:1801.02929, 2018.
277
+
278
+ Di Jin, Zhijing Jin, Tianyi Zhou, and Peter Szolovits. Is bert really robust? natural language attack on text classification and entailment. arXiv preprint arXiv:1907.11932, 2019.
279
+
280
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
281
+
282
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. In The International Conference on Learning Representations (ICLR) Workshops, 2017.
283
+
284
+ Alexey Kurakin, Ian Goodfellow, Samy Bengio, Yinpeng Dong, Fangzhou Liao, Ming Liang, Tianyu Pang, Jun Zhu, Xiaolin Hu, Cihang Xie, et al. Adversarial attacks and defences competition. arXiv preprint arXiv:1804.00097, 2018.
285
+
286
+ Alex Lamb, Vikas Verma, Juho Kannala, and Yoshua Bengio. Interpolated adversarial training: Achieving robust neural networks without sacrificing accuracy. arXiv preprint arXiv:1906.06784, 2019.
287
+
288
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations (ICLR), 2018.
289
+
290
+ Anh Nguyen, Jason Yosinski, and Jeff Clune. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 427–436, 2015.
291
+
292
+ Tianyu Pang, Chao Du, Yinpeng Dong, and Jun Zhu. Towards robust detection of adversarial examples. In Advances in Neural Information Processing Systems (NeurIPS), pp. 4579–4589, 2018a.
293
+
294
+ Tianyu Pang, Chao Du, and Jun Zhu. Max-mahalanobis linear discriminant analysis networks. In International Conference on Machine Learning (ICML), 2018b.
295
+
296
+ Ning Qian. On the momentum term in gradient descent learning algorithms. Neural networks, 12(1): 145–151, 1999.
297
+
298
+ Edward Raff, Jared Sylvester, Steven Forsyth, and Mark McLean. Barrage of random transforms for adversarially robust defense. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 6528–6537, 2019.
299
+
300
+ Ali Shafahi, Mahyar Najibi, Amin Ghiasi, Zheng Xu, John Dickerson, Christoph Studer, Larry S Davis, Gavin Taylor, and Tom Goldstein. Adversarial training for free! In Advances in Neural Information Processing Systems (NeurIPS), 2019.
301
+
302
+ Takuya Shimada, Shoichiro Yamaguchi, Kohei Hayashi, and Sosuke Kobayashi. Data interpolating prediction: Alternative interpretation of mixup. arXiv preprint arXiv:1906.08412, 2019.
303
+
304
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In International Conference on Learning Representations (ICLR), 2014.
305
+
306
+ Pedro Tabacof and Eduardo Valle. Exploring the space of adversarial images. In 2016 International Joint Conference on Neural Networks (IJCNN), pp. 426–433. IEEE, 2016.
307
+
308
+ Yuji Tokozume, Yoshitaka Ushiku, and Tatsuya Harada. Learning from between-class examples for deep sound recognition. International Conference on Learning Representations (ICLR), 2018a.
309
+
310
+ Yuji Tokozume, Yoshitaka Ushiku, and Tatsuya Harada. Between-class learning for image classification. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5486–5494, 2018b.
311
+
312
+ Vladimir Vapnik. The nature of statistical learning theory. Springer science & business media, 2013.
313
+
314
+ Vikas Verma, Alex Lamb, Christopher Beckham, Aaron Courville, Ioannis Mitliagkis, and Yoshua Bengio. Manifold mixup: Encouraging meaningful on-manifold interpolation as a regularizer. In International Conference on Machine Learning (ICML), 2019a.
315
+
316
+ Vikas Verma, Alex Lamb, Juho Kannala, Yoshua Bengio, and David Lopez-Paz. Interpolation consistency training for semi-supervised learning. arXiv preprint arXiv:1903.03825, 2019b.
317
+
318
+ Cihang Xie, Jianyu Wang, Zhishuai Zhang, Zhou Ren, and Alan Yuille. Mitigating adversarial effects through randomization. In International Conference on Learning Representations (ICLR), 2018.
319
+
320
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In International Conference on Learning Representations (ICLR), 2017.
321
+
322
+ Hongyang Zhang, Yaodong Yu, Jiantao Jiao, Eric P Xing, Laurent El Ghaoui, and Michael I Jordan. Theoretically principled trade-off between robustness and accuracy. In International Conference on Machine Learning (ICML), 2019.
323
+
324
+ Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In International Conference on Learning Representations (ICLR), 2018.
325
+
326
+ # A MORE BACKGROUNDS
327
+
328
+ In this section, we provide more backgrounds which are related to our work in the main text.
329
+
330
+ # A.1 ADVERSARIAL ATTACKS AND THREAT MODELS
331
+
332
+ Adversarial attacks. Although deep learning methods have achieved substantial success in different domains (Goodfellow et al., 2016), human imperceptible adversarial perturbations can be easily crafted to fool high-performance models, e.g., deep neural networks (DNNs) (Nguyen et al., 2015).
333
+
334
+ One of the most commonly studied adversarial attack is the projected gradient descent (PGD) method (Madry et al., 2018). Let $r$ be the number of iteration steps, $x _ { 0 }$ be the original clean example, then PGD iteratively crafts the adversarial example as
335
+
336
+ $$
337
+ \begin{array} { r } { x _ { i } ^ { * } = \mathrm { c l i p } _ { x , \epsilon } ( x _ { i - 1 } ^ { * } + \epsilon _ { i } \cdot \mathrm { s i g n } ( \nabla _ { x _ { i - 1 } ^ { * } } \mathcal { L } ( x _ { i - 1 } ^ { * } , y ) ) ) , } \end{array}
338
+ $$
339
+
340
+ where $\mathrm { c l i p } _ { x , \epsilon } ( \cdot )$ is the clipping function. Here $x _ { 0 } ^ { * }$ is a randomly perturbed image in the neighborhood of $x _ { 0 }$ , i.e., $\mathring { U } ( x _ { 0 } , \epsilon )$ , and the finally returned adversarial example is $x = x _ { r } ^ { * } = x _ { 0 } + \delta$ , following our notations in the main text.
341
+
342
+ Threat models. Here we introduce different threat models in the adversarial setting. As suggested in Carlini et al. (2019), a threat model includes a set of assumptions about the adversarys goals, capabilities, and knowledge.
343
+
344
+ Adversary’s goals could be simply fooling the classifiers to misclassify, which is referred to as untargeted mode. Alternatively, the goals can be more specific to make the model misclassify certain examples from a source class into a target class, which is referred to as targeted mode. In our experiments, we evaluate under both modes, as shown in Table 2 and Table 3.
345
+
346
+ Adversary’s capabilities describe the constraints imposed on the attackers. Adversarial examples require the perturbation $\delta$ to be bounded by a small threshold $\epsilon$ under $\ell _ { p }$ -norm, i.e., $\| \delta \| _ { p } \leq \epsilon$ . For example, in the PGD attack, we consider under the $\ell _ { \infty }$ -norm.
347
+
348
+ Adversary’s knowledge describes what knowledge the adversary is assumed to have. Typically, there are three settings when evaluating a defense method:
349
+
350
+ • Oblivious adversaries are not aware of the existence of the defense $D$ and generate adversarial examples based on the unsecured classification model $F$ (Carlini & Wagner, 2017). White-box adversaries know the scheme and parameters of $D$ , and can design adaptive methods to attack both the model $F$ and the defense $D$ simultaneously (Athalye et al., 2018). • Black-box adversaries have no access to the parameters of the defense $D$ or the model $F$ with varying degrees of black-box access (Dong et al., 2018).
351
+
352
+ In our experiments, we mainly test under the oblivious setting (Sec. 4.3) and white-box setting (Sec. 4.4), since previous work has already demonstrated that randomness itself is efficient on defending black-box attacks (Guo et al., 2018; Xie et al., 2018).
353
+
354
+ # A.2 INTERPOLATED ADVERSARIAL TRAINING
355
+
356
+ To date, the most widely applied framework for adversarial training (AT) methods is the saddle point framework introduced in Madry et al. (2018):
357
+
358
+ $$
359
+ \operatorname* { m i n } _ { \theta } \rho ( \theta ) , \mathrm { w h e r e } \rho ( \theta ) = \operatorname { \mathbb { E } } _ { ( x , y ) \sim p } [ \operatorname* { m a x } _ { \delta \in S } \mathcal { L } ( x + \delta , y ; \theta ) ] .
360
+ $$
361
+
362
+ Here $\theta$ represents the trainable parameters in the classifier $F$ , and $S$ is a set of allowed perturbations. In implementation, the inner maximization problem for each input-label pair $( x , y )$ is approximately solved by, e.g., the PGD method with different random initialization (Madry et al., 2018).
363
+
364
+ As a variant of the AT method, Lamb et al. (2019) propose the interpolated AT method, which combines AT with mixup. Interpolated AT trains on interpolations of adversarial examples along with interpolations of unperturbed examples (cf. Alg. 1 in Lamb et al. (2019)). Previous empirical results demonstrate that interpolated AT can obtain higher accuracy on the clean inputs compared to the AT method without mixup, while keeping the similar performance of robustness.
365
+
366
+ Table 4: The parameter settings for the methods in Table 2. The number of execution for each random method is 30.
367
+
368
+ <table><tr><td>Methods</td><td>Parameter Settings</td></tr><tr><td>Mixup Mixup + Gaussian noise</td><td>Noise standard deviationo= 0.04</td></tr><tr><td>Mixup +Random rotation Mixup + Xie et al. (2018)</td><td>Rotation degree range[-40°,40°] The random crop size is randomly selected from [16, 24]</td></tr><tr><td>Mixup + Guo et al. (2018)</td><td>The random crop size is randomly selected from [22,30]</td></tr><tr><td>ERM+ MI-OL (ablation study) Mixup+MI-OL</td><td>The XoL = 0.6</td></tr><tr><td></td><td>The 入oL = 0.5</td></tr><tr><td>Mixup+MI-Combined</td><td>The 入oL = O.5,入oL = O.4,threshold is 0.2</td></tr><tr><td>Interpolated AT</td><td></td></tr><tr><td></td><td>=</td></tr><tr><td>Interpolated AT + Gaussian noise</td><td>Noise standard deviation o = 0.075</td></tr><tr><td>Interpolated AT +Random rotation</td><td>Rotation degree range[-3O°,30°]</td></tr><tr><td>Interpolated AT + Xie et al. (2018)</td><td>The random crop size is randomly selected from [20, 28]</td></tr><tr><td>Interpolated AT + Guo et al. (2018)</td><td>The random crop size is randomly selected from [20, 28]</td></tr><tr><td>AT+ MI-OL (ablation study)</td><td>The 入oL = 0.8</td></tr><tr><td>Interpolated AT + MI-OL</td><td>The 入oL = 0.6</td></tr></table>
369
+
370
+ # B TECHNICAL DETAILS
371
+
372
+ We provide more technical details about our method and the implementation of the experiments.
373
+
374
+ # B.1 MORE DISCUSSION ON THE MI METHOD
375
+
376
+ Generality. According to Sec. 3, except for the mixup-trained models, the MI method is generally compatible with any trained model with induced global linearity. These models could be trained by other methods, e.g., manifold mixup (Verma et al., 2019a; Inoue, 2018; Lamb et al., 2019). Besides, to better defend white-box adaptive attacks, the mixup ratio $\lambda$ in MI could also be sampled from certain distribution to put in additional randomness.
377
+
378
+ Empirical gap. As demonstrated in Fig. 2, there is a gap between the empirical results and the theoretical formulas in Table 1. This is because that the mixup mechanism mainly acts as a regularization in training, which means the induced global linearity may not satisfy the expected behaviors. To improve the performance of MI, a stronger regularization can be imposed, e.g., training with mixup for more epochs, or applying matched $\lambda$ both in training and inference.
379
+
380
+ # B.2 ADAPTIVE ATTACKS FOR MIXUP INFERENCE
381
+
382
+ Following Athalye et al. (2018), we design the adaptive attacks for our MI method. Specifically, according to Eq. (6), the expected model prediction returned by MI is:
383
+
384
+ $$
385
+ F _ { \mathrm { M I } } ( x ) = \mathbb { E } _ { p _ { s } } [ F ( \lambda x + ( 1 - \lambda ) x _ { s } ) ] .
386
+ $$
387
+
388
+ Note that generally the $\lambda$ in MI comes from certain distribution. For simplicity, we fix $\lambda$ as a hyperparameter in our implementation. Therefore, the gradients of the prediction w.r.t. the input $x$ is:
389
+
390
+ $$
391
+ \begin{array} { r l } { { \frac { \partial F _ { \mathrm { M I } } ( { \boldsymbol x } ) } { \partial { \boldsymbol x } } = \mathbb { E } _ { p _ { s } } [ \frac { \partial F ( \lambda { \boldsymbol x } + ( 1 - \lambda ) { \boldsymbol x } _ { s } ) } { \partial { \boldsymbol x } } ] } \ ~ } & { } \\ & { = \mathbb { E } _ { p _ { s } } [ \frac { \partial F ( { \boldsymbol u } ) } { \partial { \boldsymbol u } } \Big | _ { { \boldsymbol u } = \lambda { \boldsymbol x } + ( 1 - \lambda ) { \boldsymbol x } _ { s } } \cdot \frac { \partial \lambda { \boldsymbol x } + ( 1 - \lambda ) { \boldsymbol x } _ { s } } { \partial { \boldsymbol x } } ] } \\ & { = \lambda \mathbb { E } _ { p _ { s } } [ \frac { \partial F ( { \boldsymbol u } ) } { \partial { \boldsymbol u } } | _ { { \boldsymbol u } = \lambda { \boldsymbol x } + ( 1 - \lambda ) { \boldsymbol x } _ { s } } ] . } \end{array}
392
+ $$
393
+
394
+ Table 5: The parameter settings for the methods in Table 3. The number of execution for each random method is 30.
395
+
396
+ <table><tr><td rowspan=1 colspan=1>Methods</td><td rowspan=1 colspan=1>Parameter Settings</td></tr><tr><td rowspan=1 colspan=1>MixupMixup + Gaussian noiseMixup +Random rotationMixup + Xie et al. (2018)Mixup + Guo et al. (2018)</td><td rowspan=1 colspan=1>=Noise standard deviation g = 0.025Rotation degree range[-2O°,20°]The random crop size is randomly selected from [18, 26]The random crop size is randomly selected from [24,32]</td></tr><tr><td rowspan=1 colspan=1>Mixup + MI-OLMixup+MI-Combined</td><td rowspan=1 colspan=1>The 入oL = 0.5The 入oL = 0.5,入oL = O.4,threshold is 0.2</td></tr><tr><td rowspan=1 colspan=1>Interpolated ATInterpolated AT+Gaussian noiseInterpolated AT+RandomrotationInterpolated AT + Xie et al. (2018)Interpolated AT + Guo et al. (2018)</td><td rowspan=1 colspan=1>Noise standard deviation o = 0.06Rotation degree range[-2Oo,20°]The random crop size is randomly selected from [22,30]The random crop size is randomly selected from [24, 32]</td></tr><tr><td rowspan=1 colspan=1>Interpolated AT + MI-OL</td><td rowspan=1 colspan=1>The 入oL = 0.6</td></tr></table>
397
+
398
+ ![](images/ebd56fb7b59810ebc034e274f2b54f45adac6206f0e7c759ed718eee36e9848e.jpg)
399
+ Figure 5: Adversarial examples crafted by adaptive attacks with $\epsilon = 1 6 / 2 5 5$ on CIFAR-10, against the defense of Interpolated $\mathbf { A T } + \mathbf { M I } \mathbf { - O L }$ .
400
+
401
+ In the implementation of adaptive PGD attacks, we first sample a series of examples {xs,k}NAk=1, where $N _ { A }$ is the number of adaptive samples in Fig. 3. Then according to Eq. (18), the sign of gradients used in adaptive PGD can be approximated by
402
+
403
+ $$
404
+ \mathrm { s i g n } \left( \frac { \partial F _ { \mathrm { M I } } ( \boldsymbol { x } ) } { \partial \boldsymbol { x } } \right) \approx \mathrm { s i g n } \left( \sum _ { k = 1 } ^ { N _ { A } } \frac { \partial F ( \boldsymbol { u } ) } { \partial \boldsymbol { u } } \Big | _ { \boldsymbol { u } = \boldsymbol { \lambda } \boldsymbol { x } + ( 1 - \boldsymbol { \lambda } ) \boldsymbol { x } _ { s , k } } \right) .
405
+ $$
406
+
407
+ # B.3 HYPERPARAMETER SETTINGS
408
+
409
+ The hyperparameter settings of the experiments shown in Table 2 and Table 3 are provided in Table 4 and Table 5, respectively. Since the original methods in Xie et al. (2018) and Guo et al. (2018) are both designed for the models on ImageNet, we adapt them for CIFAR-10 and CIFAR-100. Most of our experiments are conducted on the NVIDIA DGX-1 server with eight Tesla P100 GPUs.
md/train/GOfGGASIUkg/GOfGGASIUkg.md ADDED
@@ -0,0 +1,447 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Test-Time Adaptation to Distribution Shift by Confidence Maximization and Input Transformation
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Deep neural networks often exhibit poor performance on data that is unlikely under
11
+ 2 the train-time data distribution, for instance data affected by corruptions. Previous
12
+ 3 works demonstrate that test-time adaptation to data shift, for instance using entropy
13
+ 4 minimization [1], effectively improves performance on such shifted distributions.
14
+ 5 This paper focuses on the fully test-time adaptation setting, where only unlabeled
15
+ 6 data from the target distribution is required. This allows adapting arbitrary pre
16
+ 7 trained networks. Specifically, we propose a novel loss that improves test-time
17
+ 8 adaptation by addressing both premature convergence and instability of entropy
18
+ 9 minimization. This is achieved by replacing the entropy by a non-saturating surro
19
+ 10 gate and adding a diversity regularizer based on batch-wise entropy maximization
20
+ 11 that prevents convergence to trivial collapsed solutions. Moreover, we propose
21
+ 12 to prepend an input transformation module to the network that can partially undo
22
+ 13 test-time distribution shifts. Surprisingly, this preprocessing can be learned solely
23
+ 14 using the fully test-time adaptation loss in an end-to-end fashion without any target
24
+ 15 domain labels or source domain data. We show that our approach outperforms
25
+ 16 previous work in improving the robustness of publicly available pretrained image
26
+ 17 classifiers to common corruptions on such challenging benchmarks as ImageNet-C.
27
+
28
+ # 18 1 Introduction
29
+
30
+ 19 Deep neural networks achieve impressive performance on test data, which has the same distribution
31
+ 20 as the training data. Nevertheless, they often exhibit a large performance drop on test (target) data
32
+ 21 which differs from training (source) data; this effect is known as data shift [2] and can be caused for
33
+ 22 instance by image corruptions. There exist different methods to improve the robustness of the model
34
+ 23 during training [3, 4, 5]. However, generalization to different data shifts is limited since it is infeasible
35
+ 24 to include sufficiently many augmentations during training to cover the excessively wide range of
36
+ 25 potential data shifts [6]. Alternatively, in order to generalize to the data shift at hand, the model can be
37
+ 26 adapted during test-time. Unsupervised domain adaptation methods such as [7] use both source and
38
+ 27 target data to improve the model performance during test-time. In general source data might not be
39
+ 28 available during inference time, e.g., due to legal constraints (privacy or profit). Therefore we focus
40
+ 29 on the fully test-time adaptation setting [1]: the model is adapted to the target data given only the
41
+ 30 arbitrarily pretrained model parameters and the unlabeled target data that share the same label space
42
+ 31 as source data. We extend the work of Wang et al. [1] by introducing a novel loss function, using
43
+ 32 a diversity regularizer, and prepending a parametrized input transformation module to the network.
44
+ 33 We show that our approach outperform previous works and make pretrained models robust against
45
+ 34 common corruptions on image classification benchmarks as ImageNet-C [8] and ImageNet-R [9].
46
+ 35 Sun et al. [10] investigate test-time adaptation using a self-supervision task. Wang et al. [1] and
47
+ 36 Liang et al. [11] use the entropy minimization loss that uses maximization of prediction confidence as
48
+ 37 self-supervision signal during test-time adaptation. Wang et al. [1] has shown that such loss performs
49
+ 38 better adaptation than a proxy task [10]. When using entropy minimization, however, high confidence
50
+ 39 predictions do not contribute to the loss significantly anymore and thus provide little self-supervision.
51
+ 40 This is a drawback since high-confidence samples provide the most trustworthy self-supervision.
52
+ 41 We mitigate this by introducing two novel loss functions that ensure that gradients of samples with
53
+ 42 high confidence predictions do not vanish and learning based on self-supervision from these samples
54
+ 43 continues. Our losses do not focus on minimizing entropy but on minimizing the negative log
55
+ 44 likelihood ratio between classes; the two variants differ in using either soft or hard pseudo-labels. In
56
+ 45 contrast to entropy minimization, the proposed loss functions provide non-saturating gradients, even
57
+ 46 when there are high confident predictions. We refer to Figure 1 for an illustration of the losses and the
58
+ 47 resulting gradients. Using these new loss functions, we are able to improve the network performance
59
+ 48 under data shifts in fully test-time adaptation.
60
+ 49 In general, self-supervision by confidence maximization can lead to collapsed trivial solutions, which
61
+ 50 make the network to predict only a single or a set of classes independent of the input. To overcome
62
+ 51 this issue a diversity regularizer [11, 12] can be used, that acts on a batch of samples. It encourages
63
+ 52 the network to make different class predictions on different samples. We extend the regularizer by
64
+ 53 including a moving average, in order to include the history of the previous batches and show that this
65
+ 54 stabilizes the adaptation of the network to unlabeled test samples. Furthermore we also introduce a
66
+ 55 parametrized input transformation module, which we prepend to the network. The module is trained
67
+ 56 in a fully test-time adaptation manner using the proposed loss function, i. e. without the need of any
68
+ 57 target domain labels or source data. It aims to partially undo the data shift at hand. This helps to
69
+ 58 further improve the performance on image classification benchmark with corruptions.
70
+ 59 Since our method does not change the training process, it allows to use any pretrained models. This
71
+ 60 is beneficial because any good performing pretrained network can be readily reused, e.g., a network
72
+ 61 trained on some proprietary data not available to the public. We show, that our method significantly
73
+ 62 improves performance on models that are trained on clean ImageNet data such as a ResNet50 [13],
74
+ 63 as well as robust models such as ResNet50 models trained using DeepAugment $^ +$ AugMix [9].
75
+ 64 In summary our main contributions are as follows: we propose non-saturating losses based on the
76
+ 65 negative log likelihood ratio, such that gradients from high confidence predictions still contribute to
77
+ 66 test-time adaptation. We extend the diversity regularizer that acts on a batch of samples to a moving
78
+ 67 average version, which includes the history of the previous batch samples. This prevents the network
79
+ 68 from collapsing to trivial solutions. Furthermore we also introduce an input transformation module,
80
+ 69 which partially undoes the data shift at hand. We show that the performance of different pretrained
81
+ 70 models can be significantly improved on challenging benchmarks like ImageNet-C and ImageNet-R.
82
+
83
+ # 71 2 Related work
84
+
85
+ 72 Common image corruptions are potentially stochastic image transformations motivated by real
86
+ 73 world effects that can be used for evaluating a model’s robustness. One such benchmark, ImageNet-C
87
+ 74 [8], contains simulated corruptions such as noise, blur, weather effects, and digital image transforma
88
+ 75 tions. Additionally, Hendrycks et al. [9] proposed three data sets containing real-world distribution
89
+ 76 shifts, including Imagenet-R. The ImageNet-C have been further extended to MNIST [14], several
90
+ 77 object detection datasets [15], and image segmentation [16], reflecting the interest of the robustness
91
+ 78 community. Most proposals for improving robustness involve special training protocols, requiring
92
+ 79 time and additional resources. This includes data augmentation like Gaussian noise [17, 18, 9],
93
+ 80 CutMix [19], AugMix [4], training on stylized images [3, 20] or against adversarial noise distribu
94
+ 81 tions [21]. Mintun et al. [22] pointed out that many improvements on ImageNet-C are due to data
95
+ 82 augmentations which are too similar to the test corruptions, that is: overfitting to ImageNet-C occurs.
96
+ 83 Thus, the model might be less robust to corruptions not included in the test set of ImageNet-C.
97
+ 84 Unsupervised domain adaptation methods train a joint model of the source and target domain by
98
+ 85 cross-domain losses, with the hope to find more general and robust features. These losses optimize
99
+ 86 feature alignment [23, 24] between domains, adversarial invariance [25, 5, 26, 27], shared proxy
100
+ 87 tasks [28] or adapting the entropy minimization via an adversarial loss [7]. While these approaches
101
+ 88 are effective, they require explicit access to source and target data at the same time, which may not
102
+ 89 always be feasible. Our approach works with any pretrained model and only needs target data.
103
+ 90 Test-time adaptation (also termed source free adaptation in some literature) is a setting, when
104
+ 91 training (source) data is unavailable at test-time. Several works use generative models [29, 30, 31, 32]
105
+ 92 for the source free adaptation and require several thousand epochs to adapt to the target data [30, 32].
106
+ 93 Besides, there is another line of work [10, 33, 34, 35, 1] that interpret the common corruptions as
107
+ 94 data shift and aim to improve the model robustness against these corruptions with efficient test-time
108
+ 95 adaptation strategy to facilitate online adaptation. Such setting refrain the usage of generative models
109
+ 96 or methods that require larger number of adaptation steps. Our work also falls in this line of research
110
+ 97 and aims to test-time adapt the model to common corruptions with less computational overhead.
111
+ 98 Sun et al. [10] update feature extractor parameters at test-time via a self-supervised proxy task
112
+ 99 (predicting image rotations). However, Sun et al. [10] alter the training procedure by including the
113
+ 100 proxy loss into the optimization objective as well, hence arbitrary pretrained models cannot be used
114
+ 101 directly for test-time adaptation. Inspired by the domain adaptation strategies [36, 37], several works
115
+ 102 [33, 34, 35] replace the estimates of Batch Normalization (BN) activation statistics with the statistics
116
+ 103 of the corrupted test images. Fully test time adaptation, studied by Wang et al. [1] (TENT) uses
117
+ 104 entropy minimization to update the channel-wise affine parameters of BN layers on corrupted data
118
+ 105 along with the batch statistics estimates. SHOT [11] also uses entropy minimization and a diversity
119
+ 106 regularizer to avoid collapsed solutions. SHOT modifies the model from the standard setting by
120
+ 107 adopting weight normalization at the fully connected classifier layer during training to facilitate their
121
+ 108 pseudo labeling technique. Hence, SHOT is not readily applicable to arbitrary pretrained models.
122
+ 109 We show that pure entropy minimization [1, 11] results in vanishing gradients for high confidence
123
+ 110 predictions, thus inhibiting learning. Our work addresses this issue by proposing a novel non
124
+ 111 saturating loss, that provides non-vanishing gradients for high confidence predictions. We show
125
+ 112 that our proposed loss function improves the network performance after test-time adaptation. In
126
+ 113 particular, performance on corruptions of higher severity improves significantly. Furthermore, we
127
+ 114 add and extend the diversity regularizer [11, 12] to avoid collapse to trivial, high confidence solutions.
128
+ 115 Note that the existing diversity regularizers [11, 12] act on a batch of samples, hence the number of
129
+ 116 classes has to be smaller than the batch size. We mitigate this problem by extending the regularizer
130
+ 117 to a running average version. Prior work [5, 38, 39] transformed inputs by an additional module
131
+ 118 to overcome domain shift, obtain robust models, and also to learn to resize. In our work, we also
132
+ 119 prepend an input transformation module to the model, but in contrast to former works, this module is
133
+ 120 trained purely at test-time to partially undo the data shift at hand and thus aids the adaptation.
134
+
135
+ # 121 3 Method
136
+
137
+ 122 We propose a novel method for fully test-time adaption. For this, we assume that a neural network
138
+ 123 $f _ { \theta }$ with parameters $\theta$ is available that was trained on data from some distribution $\mathcal { D }$ , as well a set of
139
+ 124 (unlabeled) samples $X \sim \mathcal { D } ^ { \prime }$ from a target distribution $\mathcal { D } ^ { \prime } \neq \mathcal { D }$ (importantly, no samples from $\mathcal { D }$ are
140
+ 125 required). We frame fully test-time adaption as a two-step process: (i) Generate a novel network $g _ { \phi }$
141
+ 126 based on $f _ { \theta }$ , where $\phi$ denotes the parameters that are adapted. A simple variant for this is $g = f$ and
142
+ 127 $\phi \subseteq \theta$ [1]. However, we propose a more expressive and flexible variant in Section 3.1. (ii) Adapt the
143
+ 128 parameters $\phi$ of $g$ on $X$ using an unsupervised loss function $L$ . We propose two novel losses $L _ { s l r }$
144
+ 129 and $L _ { h l r }$ in Section 3.2 that have non-vanishing gradients for high-confidence self-supervision.
145
+
146
+ # 3.1 Input Transformation
147
+
148
+ We propose to define the adaptable model as $g = f \circ d$ . That is: we preprend a trainable network $d$ to $f$ . The motivation for the additional component $d$ is to increase expressivity of $g$ such that it can learn to (partially) undo the domain shift $\mathcal { D } \to \mathcal { D } ^ { \prime }$ .
149
+
150
+ 134 Specifically, we choose $d ( x ) = \gamma \cdot [ \tau x + ( 1 - \tau ) r _ { \psi } ( x ) ] + \beta$ , where $\tau \in \mathbb { R }$ , $( \beta , \gamma ) \in \mathbb { R } ^ { n _ { i n } }$ with
151
+ 135 $n _ { i n }$ being the number of input channels, $r _ { \psi }$ being a network with identical input and output shape,
152
+ 136 and $\ast$ denoting elementwise multiplication. Specifically, $\beta$ and $\gamma$ implement a channel-wise affine
153
+ 137 transformation and $\tau$ implements a convex combination of unchanged input and the transformed input
154
+ 138 $r _ { \psi } ( x )$ . By choosing $\tau = 1$ , $\gamma = { \bf 1 }$ , and $\beta = { \bf 0 }$ , we ensure $d ( x ) = x$ and thus $g = f$ at initialization.
155
+ 139 In principle, $r _ { \psi }$ can be chosen arbitrarily. In this work, we choose $r _ { \psi }$ as a simple stack of $3 \times 3$
156
+ 140 convolutions, group normalization, and ReLUs (for details, we refer to the appendix). However,
157
+ 141 exploring other choices would be an interesting avenue for future work.
158
+ 142 Importantly, while the motivation for $d$ is to learn to partially undo a domain shift $\mathcal { D } \to \mathcal { D } ^ { \prime }$ , we train
159
+ 143 $d$ end-to-end in the fully test-time adaptation setting on data $X \sim \mathcal { D } ^ { \prime }$ , without any access to samples
160
+ 144 from the source domain $\mathcal { D }$ , based on the losses proposed in Section 3.2. The modulation parameters
161
+ 145 of $g _ { \phi }$ are $\phi = ( \beta , \gamma , \tau , \psi , \theta ^ { \prime } )$ , where $\theta ^ { \prime } \subseteq \theta$ . That is, we adapt only a subset of the parameters $\theta$ of
162
+ 146 the pretrained network $f$ . We largely follow Wang et al. [1] in adapting only the affine parameters of
163
+ 147 normalization layers in $f$ while keeping parameters of convolutional kernels unchanged. Additionally,
164
+ 148 batch normalization statistics (if any) are adapted to the target distribution.
165
+ 149 Please note that the proposed method is applicable to any pretrained network that contains normaliza
166
+ 150 tion layers with a channel-wise affine transformation. Even for networks that do not come with such
167
+ 151 affine transformation layers, one can add affine transformation layers into $f$ that are initialized to
168
+ 152 identity as part of model augmentation.
169
+
170
+ # 153 3.2 Adaptation Objective
171
+
172
+ 154 We propose a loss function ${ \cal L } = { \cal L } _ { \mathrm { d i v } } + \delta { \cal L } _ { \mathrm { c o n f } }$ for fully test-time network adaptation that consists of
173
+ 155 two components: (i) a term $L _ { \mathrm { d i v } }$ that encourages predictions of the network over the adaptation dataset
174
+ 156 $X$ that match a target distribution $p _ { { D ^ { \prime } } } ( y )$ . This can help avoiding test-time adaptation collapsing
175
+ 157 to too narrow distributions such as always predicting the same or very few classes. If $p _ { { D ^ { \prime } } } ( y )$ is
176
+ 158 (close to) uniform, it acts as a diversity regularizer. (ii) A term $L _ { \mathrm { c o n f } }$ that encourages high confidence
177
+ 159 prediction on individual datapoints. We note that test-time entropy minimization (TENT) [1] fits into
178
+ 160 this framework by choosing $L _ { \mathrm { d i v } } = 0$ and $L _ { \mathrm { c o n f } }$ as the entropy.
179
+
180
+ # 3.2.1 Class Distribution Matching $L _ { d i v }$
181
+
182
+ 162 Assuming knowledge of the class distribution $p _ { D ^ { \prime } } ( y )$ on the target domain $\mathcal { D } ^ { \prime }$ , we propose to add a
183
+ 163 term to the loss that encourages the empirical distribution of (soft) predictions of $g _ { \phi }$ on $X$ to match
184
+ 164 this distribution. Specifically, let $\hat { p } _ { g _ { \phi } } ( y )$ be an estimate of the distribution of (soft) predictions of $g _ { \phi }$ .
185
+ 165 We use the Kullback-Leibler divergence $L _ { \mathrm { d i v } } = D _ { K L } ( \hat { p } _ { g _ { \phi } } ( y ) | | p _ { \mathcal { D } ^ { \prime } } ( y ) )$ as loss term. In a special case
186
+ 166 of $p _ { D ^ { \prime } } ( y )$ being a uniform distribution over the classes, this corresponds to maximizing the entropy
187
+ 167 $H ( \hat { p } _ { g _ { \phi } } ( y ) )$ . Similar assumption has been made in SHOT [11] to circumvent the collapsed solutions.
188
+ 168 Since the estimate $\hat { p } _ { g _ { \phi } } ( y )$ depends on $\phi$ , which is continuously adapted, it needs to be re-estimated
189
+ 169 on a per-batch level. Since re-estimating $\hat { p } _ { g _ { \phi } } ( y )$ from scratch would be computational expensive, we
190
+ 170 propose to use a running estimate that tracks the changes of $\phi$ as follows: let $p _ { t - 1 } ( y )$ be the estimate at
191
+ 171 iteration $t - 1$ and $\begin{array} { r } { p _ { t } ^ { e m \bar { p _ { } } } = \frac { 1 } { n } \sum _ { k = 1 } ^ { n } \hat { y } ^ { ( k ) } } \end{array}$ , where $\hat { y } ^ { ( k ) }$ are the predictions (confidences) of $g _ { \phi }$ on a mini
192
+ 172 batch of $n$ inputs $x ^ { ( k ) } \sim X$ . We update the running estimate via $p _ { t } ( y ) = \kappa \cdot p _ { t - 1 } ( y ) + ( 1 - \kappa ) \cdot p _ { t } ^ { e m p }$
193
+ 173 The loss becomes $L _ { \mathrm { d i v } } = D _ { K L } ( \bar { p _ { t } } ( y ) | | p _ { \bar { D } ^ { \prime } } ( y ) )$ accordingly. We use $\kappa = 0 . 9$ in the experiments.
194
+
195
+ # 3.2.2 Confidence Maximization $L _ { c o n f }$
196
+
197
+ 175 We motivate our choice of $L _ { \mathrm { c o n f } }$ step-by-step from the (unavailable) supervised cross-entropy loss:
198
+ 176 for this, let $\hat { y } = g _ { \phi } ( x )$ be the predictions (confidences) of model $g _ { \phi }$ and $\begin{array} { r } { \dot { H } ( \hat { y } , y ^ { r } ) = - \sum _ { c } \bar { y _ { c } ^ { r } } \log \hat { y } _ { c } } \end{array}$
199
+ 177 be the cross-entropy between prediction $\hat { y }$ and some reference $y ^ { r }$ . Moreover, let the last layer of $g$ be
200
+ 178 a softmax activation layer softmax. That is $\hat { y } = \operatorname { s o f t m a x } ( o )$ , where $o$ are the network’s logits. We
201
+ 179 note that we can rewrite the cross-entropy loss in terms of the logits $o$ and a one-hot reference $y ^ { r }$ as
202
+ 180 follows: $\begin{array} { r } { H ( \mathrm { s o f t m a x } ( o ) , y ^ { r } ) = - o _ { c ^ { r } } + \mathbf { \bar { l o g } } \sum _ { i = 1 } ^ { n _ { c l } } e ^ { o _ { i } } } \end{array}$ where $c ^ { r }$ is the index of the 1 in $y ^ { r }$ and $n _ { c l }$ is
203
+ 181 the number of classes.
204
+ 182 In the case of labels being available for the target domain (which we do not assume) in the form of a
205
+ 183 one-hot encoded reference $y _ { t }$ for data $x _ { t }$ , one could use the supervised cross-entropy loss by setting
206
+ 184 $y ^ { r } = y _ { t }$ and using $L _ { s u p } ( \hat { y } , y ^ { r } ) = H ( \hat { y } , y ^ { r } ) = H ( \hat { y } , y _ { t } )$ . Since fully test-time adaptation assumes
207
+ 185 no label information being available, the supervised cross-entropy loss is not applicable and other
208
+ 186 options for $y ^ { r }$ need to be used.
209
+ 187 One option are (hard) pseudo-labels. That is, one defines the reference $y ^ { r }$ based on the network pre
210
+ 188 dictions $\hat { y }$ via $y ^ { r } = \mathrm { o n e h o t } ( \hat { y } )$ , where onehot creates a one-hot reference with the 1 corresponding to
211
+ 189 the class with maximal confidence in $\hat { y }$ . This results in $L _ { p l } ( \hat { y } ) = H ( \hat { y } , \mathrm { o n e h o t } ( \hat { y } ) ) = - \log \hat { y } _ { c ^ { * } }$ , with
212
+ 190 $c ^ { * } = \arg \operatorname* { m a x } \hat { y }$ . One disadvantage with this loss is that the (hard) pseudo-labels ignore uncertainty
213
+ 191 in the network predictions during self-supervision. This results in large gradient magnitudes with
214
+ 192 respect to the logits $| \frac { \partial L _ { p l } } { \partial o _ { c ^ { * } } } |$ being generated in situations where the network is highly unconfident (see
215
+
216
+ ![](images/6e08ef1849bc521aa225df2ec817644909ca5e1a443aee36c24dee7177ff7859.jpg)
217
+ Figure 1: Illustration of different losses for confidence maximization. Losses (left, shifted such that maxima of all losses are at 0) and the resulting gradients with respect to the first logit (right) as a function of the first classes confidence are shown for the case of a binary classification problem. Both entropy and hard pseudo-labels have vanishing gradients for high confidence predictions. Accordingly, both have maximum gradient amplitude for low-confidence self-supervision, with this effect being stronger for the hard pseudo-labels. Hard Likelihood Ratio has constant gradient amplitude for any confidence and thus takes into account low- and high-confidence self-supervision equally. Soft Likelihood Ratio also shows non-vanishing (albeit non-maximum) gradients for highconfidence self-supervision and additionally produces small gradient amplitudes from low-confidence self-supervision. Since the likelihood ratio-based losses are unbounded, the design of the model needs to ensure that logits cannot grow unbounded.
218
+
219
+ Figure 1). This is undesirable since it corresponds to the network being affected most by data points where the network’s self-supervision is least reliable.
220
+
221
+ An alternative is to use soft pseudo-labels, that is $\boldsymbol y ^ { r } \ : = \ : \boldsymbol { \hat { y } }$ . This takes uncertainty in network predictions into account during self-labelling and results in the entropy minimization loss of TENT [1]: $\begin{array} { r } { L _ { e n t } ( \hat { y } ) = H ( \hat { y } , \hat { y } ) = \bar { H } ( \hat { y } ) = - \sum _ { c } \hat { y } _ { c } \log \hat { y } _ { c } } \end{array}$ . However, also for the entropy the logits’ gradient magnitude $\lvert \frac { \partial L _ { e n t } } { \partial o } \rvert$ goes to 0 when one of the entries in $\hat { y }$ goes to 1 (see Figure 1). For a binary classification task, for instance, the maximal logits’ gradient amplitude is obtained for $\hat { y } \approx ( 0 . 8 2 , 0 . 1 8 )$ . This implies that during later stages of test-time adaptation where many predictions typically already have very high confidence, i. e. above 0.82, gradients are also dominated by datapoints with relative low confidence in self-supervision.
222
+
223
+ 203 While both hard and soft pseudo-labels are clearly motivated, they are not optimal in conjunction with
224
+ 204 a gradient-based optimizer since the self-supervision from low confidence predictions dominates (at
225
+ 205 least during later stages of training). To address this issue, we propose two losses that are analogous
226
+ 206 to $L _ { p l }$ and $L _ { e n t }$ , but are not based on the cross-entropy $H$ but instead on the negative log likelihood
227
+ 207 ratios
228
+
229
+ $$
230
+ \begin{array} { r l } { \mathfrak { l } ( \hat { y } , y ^ { r } ) = - \displaystyle \sum _ { c } y _ { c } ^ { r } \log \frac { \hat { y } _ { c } } { \sum _ { i \neq c } \hat { y } _ { i } } } & { = - \displaystyle \sum _ { c } y _ { c } ^ { r } ( \log \hat { y } _ { c } - \log \displaystyle \sum _ { i \neq c } \hat { y } _ { i } ) = H ( \hat { y } , y ^ { r } ) + \displaystyle \sum _ { c } y _ { c } ^ { r } \log \displaystyle \sum _ { i \neq c } \hat { y } _ { i } } \end{array}
231
+ $$
232
+
233
+ 208 Note that while the entropy $H$ is lower bounded by 0, $R$ can get arbitrary small if $y _ { c } ^ { r } 1$ and the
234
+ 209 sum $\textstyle \sum _ { i \neq c } { \hat { y } } _ { i } \to 0$ and thus $\textstyle \log \sum _ { i \neq c } { \hat { y } } _ { i } \to - \infty$ . This property will induce non-vanishing gradients
235
+ 210 for high confidence predictions.
236
+
237
+ 211 The first loss we consider is the hard likelihood ratio loss that is defined similarly to the hard pseudo-labels loss 212 $L _ { p l }$ :
238
+
239
+ $$
240
+ \begin{array} { r l } { L _ { h l r } ( \hat { y } ) = R ( \hat { y } , \mathrm { o n e h o t } ( \hat { y } ) ) = - \log ( \frac { \hat { y } _ { c ^ { * } } } { \sum _ { i \neq c ^ { * } } \hat { y } _ { i } } ) } & { = - \log ( \frac { e ^ { o _ { c ^ { * } } } } { \sum _ { i \neq c ^ { * } } e ^ { o _ { i } } } ) = - o _ { c ^ { * } } + \log \sum _ { i \neq c ^ { * } } e ^ { o _ { i } } , } \end{array}
241
+ $$
242
+
243
+ 213 where $c ^ { * } = \arg \operatorname* { m a x } \hat { y }$ . We note that ∂Lhlr ∂o ∗ = −1, thus also high-confidence self-supervision
244
+ 214 contributes equally to the maximum logits’ gradients. This loss was also independently proposed as
245
+ 215 negative log likelihood ratio loss by Yao et al. [40] as a replacement to the fully-supervised cross
246
+ 216 entropy loss for classification task. However, to the best of our knowledge, we are the first to motivate
247
+ 217 and identify the advantages of this loss for self-supervised learning and test-time adaptation due to its
248
+ 218 non-saturating gradient property.
249
+ 219 In addition to $L _ { h l r }$ , we also account for uncertainty in network predictions during self-labelling in a
250
+ 220 similar way as for the entropy loss $L _ { e n t }$ , and propose the soft likelihood ratio loss:
251
+
252
+ $$
253
+ \begin{array} { c c } { { { \cal L } _ { s l r } ( \hat { y } ) = R ( \hat { y } , \hat { y } ) = - \displaystyle \sum _ { c } \hat { y } _ { c } \cdot \log ( { \frac { \hat { y } _ { c } } { \sum _ { i \neq c } \hat { y } _ { i } } } ) ~ } } & { { ~ = - \displaystyle \sum _ { c } \hat { y } _ { c } \log ( { \frac { e ^ { o _ { c } } } { \sum _ { i \neq c } e ^ { o _ { i } } } } ) } } \\ { { ~ } } & { { ~ = \displaystyle \sum _ { c } \hat { y } _ { c } ( - o _ { c } + \log \sum _ { i \neq c } e ^ { o _ { i } } ) } } \end{array}
254
+ $$
255
+
256
+ 221 We note that as $\hat { y } _ { c ^ { * } } \to 1$ , $L _ { s l r } ( \hat { y } ) \to L _ { h l r } ( \hat { y } )$ . Thus the asymptotic behavior of the two likelihood
257
+ 222 ratio losses for high confidence predictions is the same. However, the soft likelihood ratio loss
258
+ 223 creates lower amplitude gradients for low confidence self-supervision. We provide illustrations of the
259
+ 224 discussed losses and the resulting logits’ gradients in Figure 1.
260
+ 225 We note that both likelihood ratio losses would typically encourage the network to simply scale
261
+ 226 its logits larger and larger, since this would reduce the loss even if the ratios between the logits
262
+ 227 remain constant. However, when finetuning an existing network and restricting the layers that are
263
+ 228 adapted such that the logits remain approximately scale-normalized, these losses can provide a
264
+ 229 useful and non-vanishing gradient signal for network adaptation. We achieve this appproximate
265
+ 230 scale normalization by freezing the top layers of the respective networks. In this case, normalization
266
+ 231 layers such as batch normalization prohibit “logit explosion”. However, predicted confidences can
267
+ 232 presumably become overconfident; calibrating confidences in a self-supervised test-time adaptation
268
+ 233 setting is an open and important direction for future work.
269
+
270
+ # 234 4 Experimental settings
271
+
272
+ Datasets We evaluate our method on image classification datasets for corruption robustness and domain adaptation. We evaluate on the challenging benchmark ImageNet-C [8], which includes a wide variety of 15 different synthetic corruptions with 5 severity levels that attribute to data shift. This benchmark also includes 4 additional corruptions as validation data. For domain adaptation, we choose ImageNet trained models to adapt to ImageNet-R proposed by Hendrycks et al. [9]. This dataset contains various naturally occurring artistic renditions of object classes from the original ImageNet. ImageNet-R comprises 30,000 image renditions for 200 ImageNet classes. Please refer Sec. A.5 for the experiments on other domain adaptation datasets VisDA-C [41], Office-Home [42].
273
+
274
+ Models Our method operates in a fully test-time adaptation setting that allows us to use any arbitrary pretrained model. We use publicly available ImageNet pretrained models ResNet50, DenseNet121, ResNeXt50, MobileNetV2 from torchvision [43]. We also test on a robust ResNet50 model trained using DeepAugment $^ +$ AugMix 1 [9].
275
+
276
+ Baseline for fully test-time adaptation Since TENT from Wang et al. [1] outperformed competing methods and fits the fully test-time adaptation setting, we consider it as a baseline and compare our results to this approach. Similar to TENT, we also adapt model features by estimating the normalization statistics and optimize only the channel-wise affine parameters on the target distribution.
277
+
278
+ Settings We conduct test-time adaptation on a target distribution for 5 epochs with batch size 64 and use the Adam optimizer with cosine decay scheduler of the learning rate with initial value 0.0006. We set the weight of $L _ { \mathrm { c o n f } }$ in our loss function to $\delta = 0 . 0 2 5$ and $\kappa = 0 . 9$ in the running estimate $p _ { t } ( y )$ of $L _ { \mathrm { d i v } }$ (we investigate the effect of $\kappa$ in the Sec. A.3). Similar to SHOT [11], we also choose the target distribution $p _ { D ^ { \prime } } ( y )$ in $L _ { \mathrm { d i v } }$ as a uniform distribution over the available classes. We found that the models converge during 3 to 5 epochs and do not improve further.
279
+
280
+ For TENT, we use SGD with momentum 0.9 at constant learning rate 0.00025 with batch size 64. These values correspond to the ones of Wang et al. [1]; alternative settings of optimizer and learning rates for TENT did not improve performance. TENT is originally optimized only for 1 epoch. For a fair comparison to our method, we optimize TENT also for 5 epochs. Similar to Wang et al. [1], we also control for ordering by data shuffling and sharing the order across the methods.
281
+
282
+ Note that all the hyperparameter settings are tuned solely on the validation corruptions of ImageNet-C that are disjoint from the test corruptions. As discussed in Section 3.2.2, we freeze all trainable parameters in the top layers of the networks to prohibit “logit explosion”. Note that normalization
283
+
284
+ Table 1: Test-time adaptation of ResNet50 on ImageNet-C at highest severity level 5. Ground truth labels are used to adapt the model in supervised manner to obtain empirical upper bound performance.
285
+
286
+ <table><tr><td>Method</td><td>Gauss</td><td>Shot</td><td>Impulse</td><td>Defocus</td><td>Glass</td><td>Motion</td><td>Zoom</td><td>Snow</td><td>Frost</td><td>Fog</td><td>Bright</td><td>Contrast</td><td>Elastic Pixel</td><td>JPEG</td></tr><tr><td>No Adaptation</td><td>2.44</td><td>2.99</td><td>1.96</td><td>17.92</td><td>9.82</td><td>14.78</td><td>22.50</td><td>16.89</td><td>23.31</td><td>24.43</td><td>58.93</td><td>5.43</td><td>16.95 20.61</td><td>31.65</td></tr><tr><td>Pseudo Labels</td><td>2.44</td><td>2.99</td><td>1.96</td><td>17.92</td><td>9.82</td><td>14.78</td><td>22.50 16.89</td><td>23.31</td><td>24.43</td><td>58.93</td><td>5.43</td><td>16.95</td><td>20.61</td><td>31.65</td></tr><tr><td colspan="9">Epoch 1</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>TENT</td><td>32.70</td><td>35.34</td><td>35.11</td><td>32.79</td><td>31.80</td><td>47.22 53.02</td><td>51.82</td><td>43.42</td><td>60.44</td><td>68.82</td><td>27.53</td><td>58.47</td><td>61.63</td><td>55.98</td></tr><tr><td>TENT+ HLR (ours)</td><td>33.96</td><td>36.66</td><td>35.75</td><td>33.70</td><td>33.33</td><td>47.73</td><td>53.22 52.16</td><td>44.79</td><td>60.62</td><td>68.91</td><td>35.60</td><td>58.81</td><td>61.82</td><td>56.23</td></tr><tr><td>SLR (ours)</td><td>38.39 39.51</td><td>41.11 42.09</td><td>40.28 41.58</td><td>38.25 39.35</td><td>38.18 39.02</td><td>51.63 52.67</td><td>55.55 55.45 55.80 55.92</td><td>48.96 49.64</td><td>62.19 62.62</td><td>68.17 68.47</td><td>49.47 50.27</td><td>60.34 60.80</td><td>62.51 63.01</td><td>57.42 57.80</td></tr><tr><td colspan="9"></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="10"></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>TENT TENT+</td><td>16.04 33.97</td><td>23.22 37.95</td><td>25.85 36.93</td><td>19.05 32.69</td><td>17.40 33.36</td><td>49.02 51.42</td><td>52.78 52.72 54.33 54.55</td><td>34.31 45.80</td><td>61.19 62.09</td><td>68.54 69.03</td><td>1.26 24.08</td><td>59.26 60.36</td><td>62.15 63.10</td><td>56.17 57.21</td></tr><tr><td>HLR (ours)</td><td>41.37</td><td>44.04</td><td>43.68</td><td>41.74</td><td>41.09</td><td>54.26</td><td>56.43 57.03</td><td>50.81</td><td>63.05</td><td>68.29</td><td>50.98</td><td>61.15</td><td>63.08</td><td>58.13</td></tr><tr><td>SLR (ours)</td><td>41.52</td><td>42.90</td><td>44.07</td><td>41.69</td><td>40.78</td><td>54.76</td><td>56.59 57.35</td><td>51.01</td><td>63.53</td><td>68.72</td><td>50.65</td><td>61.49</td><td>63.46</td><td>58.32</td></tr><tr><td>Groundtruth</td><td>55.68</td><td>58.10</td><td>61.27</td><td>55.84</td><td>55.08</td><td>65.83</td><td>67.22 67.56</td><td>62.60</td><td>72.49</td><td>76.97</td><td>65.04</td><td>70.86</td><td>72.51</td><td>68.56</td></tr></table>
287
+
288
+ Table 2: SSIM and SLR-adapted ResNet50 accuracy without and with input transformation (IT).
289
+
290
+ <table><tr><td>Corruption</td><td>Gauss</td><td>Shot</td><td>Impulse</td><td>Defocus</td><td>Glass</td><td>Motion</td><td>Zoom</td><td>Snow</td><td>Frost</td><td>Fog</td><td>Bright</td><td>Contrast</td><td>Elastic Pixel</td><td>JPEG</td></tr><tr><td>SSIM SSIM+IT</td><td>0.123 0.173</td><td>0.147 0.188</td><td>0.135 0.347</td><td>0.623 0.605</td><td>0.648 0.638</td><td>0.622 0.603</td><td>0.676 0.670</td><td>0.517 0.580</td><td>0.575 0.628</td><td>0.619 0.626</td><td>0.653 0.676</td><td>0.545 0.765</td><td>0.625 0.786 0.616 0.776</td><td>0.800 0.795</td></tr><tr><td>SLR SLR+IT</td><td>41.59 43.09</td><td>43.49 44.39</td><td>43.90 64.05</td><td>41.70 41.98</td><td>41.10 40.99</td><td>54.86 55.73</td><td>56.39 56.75</td><td>57.47 58.56</td><td>50.90 63.51 51.68 63.64</td><td>68.70 68.85</td><td></td><td>51.06 55.01</td><td>61.36 63.39 61.32 63.59</td><td>58.35 58.24</td></tr></table>
291
+
292
+ 65 statistics are still updated in these layers. Please refer Sec. A.2 for more details regarding which
293
+ 66 layers are frozen in different networks.
294
+
295
+ Furthermore, we prepend a trainable input transformation module $d$ (cf. Sec. 3.1) to the network to partially counteract the data-shift. Note that the parameters of this module discussed in Sec. 3.1 are trainable and subject to optimization. This module is initialized to operate as an identity function prior to adaptation on a target distribution by choosing $\tau = 1$ , $\gamma = { \bf 1 }$ , and $\beta = { \bf 0 }$ . We adapt the parameters of this module along with the channel-wise affine transformations and normalization statistics in an end-to-end fashion, solely using our proposed loss function along with the optimization details mentioned above. The architecture of this module is discussed in Sec. A.1.
296
+
297
+ 274 Since $L _ { \mathrm { d i v } }$ is independent of $L _ { \mathrm { c o n f } }$ , we also propose to combine $L _ { \mathrm { d i v } }$ with TENT, i. e. ${ \cal L } = { \cal L } _ { \mathrm { d i v } } + { \cal L } _ { e n t }$
298
+ 275 We denote this as $\mathrm { T E N T + }$ and also set $\kappa = 0 . 9$ here. Note that TENT optimizes all channel-wise
299
+ 276 affine parameters in the network (since entropy is saturating and does not cause logit explosion).
300
+ 277 For a fair comparison to our method, we also freeze the top layers of the networks in TENT $^ +$ . We
301
+ 278 show that adding $L _ { \mathrm { d i v } }$ and freezing top layers significantly improves the networks performance over
302
+ 279 TENT. Note that SHOT [11] is the combination of TENT, batch-level diversity regularizer, and their
303
+ 280 pseudo labeling strategy. TENT $^ +$ can be seen as a variant of SHOT but without their pseudo labeling
304
+ 281 technique. Please refer to Sec. A.4 for the test-time adaptation of pretrained models with SHOT.
305
+ 282 Note that each corruption and each severity in ImageNet-C is treated as a different target distribution
306
+ 283 and in all settings we reset model parameters to their pretrained values before every adaptation. We
307
+ 284 run our experiments for three times with different random seeds (2020, 2021, 2022) in PyTorch and
308
+ 285 report the average accuracies.
309
+
310
+ # 5 Results
311
+
312
+ Evaluation on ImageNet-C We adapt different models on the ImageNet-C benchmark using TENT, $\mathrm { T E N T + }$ , and both hard likelihood ratio (HLR) and soft likelihood ratio (SLR) losses. Figure 2 (top row) depicts the mean corruption accuracy $( \mathrm { m C A \% } )$ of each model computed across all the corruptions and severity levels. It can be observed that $\mathrm { T E N T + }$ improves over TENT, showcasing the importance of a diversity regularizer $L _ { \mathrm { d i v } }$ . Importantly, our methods HLR and SLR outperform TENT and TENT $^ +$ across DenseNet121, MobileNetV2, ResNet50, ResNeXt50 and perform comparable with $\mathrm { T E N T + }$ on robust ResNet50-DeepAugment $^ +$ Augmix model. This shows that the $\mathrm { m C A \% }$ of robust DeepAugment+Augmix model can be further increased from $58 \%$ (before adaptation) to $6 8 . 6 \%$ using test-time adaptation techniques. Here, the average of mCA obtained from three different
313
+
314
+ ![](images/56be656ccb50db43e0a7c3c65a1bc71bd516965329cabf8707ecbe6f3dce9496.jpg)
315
+ Figure 2: Test-time adaptation results on (top row) ImageNet-C, averaged across all 15 corruptions and severities, (middle row) ImageNet-R, (bottom row) clean ImageNet. NA refers to "No Adaptation".
316
+
317
+ ![](images/513817ad5181121d34a8385dfe9d72d68cc4f33a4704d12bb3c03c00cca735d2.jpg)
318
+ Figure 3: Test-time adaptation of ResNet50 using (top row) a subset of classes, and (bottom row) a subset of samples per class on 4 different corruptions at severity 5. Accuracy is computed based on the evaluation of adapted model on the entire target data. Note that error bars are smaller to visualize.
319
+
320
+ 296 random seeds are depicted along with the error bars. These smaller error bars represent that the
321
+ 297 test-time adaptation results are not sensitive to the choice of random seed.
322
+ 298 We also illustrate the performance of ResNet50 on the highest severity level across all 15 test
323
+ 299 corruptions of ImageNet-C in Table 1. Here, the adaptation results after epoch 1 and 5 are reported.
324
+ 300 It can be seen that a single epoch of test-time adaptation improves the performance significantly
325
+ 301 and makes minor improvements until epoch 5. TENT adaptation for more than one epoch result
326
+ 302 in reduced performance and TENT with $L _ { \mathrm { d i v } }$ (TENT $+$ ) prevents this behavior. We note that both
327
+ 303 HLR and SLR clearly and consistently outperform TENT and $\mathrm { T E N T + }$ on the ResNet50. We also
328
+ 304 compare our results with the hard pseudo-labels (PL) objective and also with an oracle setting where
329
+ 305 the groundtruth labels of the target data are used for adapting the model in a supervised manner (GT).
330
+ 306 Note that this oracle setting is not of practical importance but illustrates the empirical upper bound on
331
+ 307 fully test-time adaptation performance under the chosen modulation parametrization. The reported
332
+ 308 numbers in the table are the average of three random seeds.
333
+ 309 ImageNet-R We evaluate different adapted models on ImageNet-R and depict the results in Figure 2
334
+ 310 (middle row). Results show that our methods significantly improve performance of all the models,
335
+ 311 including the model pretrained with DeepAugment $^ +$ Augmix. Moreover, both HLR and SLR clearly
336
+ 312 outperform TENT and TENT $^ +$ .
337
+
338
+ Evaluation with data subsets In the above experiments, the model is evaluated on the same data that is also used for the test-time adaptation. Here, we test model generalization by adapting on a subset of target data and evaluate the performance on the whole dataset, which also includes unseen data that is not used for adaptation. We conduct two case studies: (i) adapt on the data from a subset of ImageNet classes and evaluate the performance on the data from all the classes. (ii) Adapt only on a subset of data from each class and test on all seen and unseen samples from the whole dataset.
339
+
340
+ Figure 3 illustrates generalization of a ResNet50 adapted on different proportions of the data across different corruptions, both in terms of classes and samples. We observe that adapting a model on a small subset of samples and classes is sufficient to achieve reasonable accuracy on the whole target data. This suggests that the adaptation actually learns to compensate the data shift rather than overfitting to the adapted samples or classes. The performance of TENT decreases as the number of classes/samples increases, because $L _ { e n t }$ can converge to trivial collapsed solutions and more data corresponds to more updates steps during adaptation. Adding $L _ { \mathrm { d i v } }$ such as in $\mathrm { T E N T + }$ stabilizes the adaptation process and reduces this issues. Reported are the average of random seeds with error bars.
341
+
342
+ Input transformation We investigate whether the input transformation (IT) module, trained end-toend with a ResNet50 and SLR loss on data of the respective distortion without seeing any source (undistorted) data, can partially undo certain domain shifts of ImageNet-C and also increase accuracy on corrupted data. We measure domain shift via the structural similarity index measure (SSIM) [44] between the clean image (unseen by the model) and its distorted version/the output of IT on the distorted version. Table 2 shows that IT increases the SSIM considerably on certain distortions such as Impulse, Contrast, Snow, and Frost. IT increases SSIM also for other types of noise distortions, while it slightly reduces SSIM for the blur distortions, Elastic, Pixelate, and JPEG. When combined with SLR, IT considerably increases accuracy on distortions for which also SSIM increased significantly (for instance $+ 2 0$ percent points on Impulse, $+ 4$ percent points on Contrast) and never reduces accuracy by more than 0.11 percent points. We provide illustrations of effect of IT in the appendix.
343
+
344
+ 338 Clean images As a sanity check, we investigate the effect of test-time adaptation when target data
345
+ 339 comes from the same distribution as training data. For this, we adapt pretrained models on clean
346
+ 340 validation data of ImageNet. The results in Figure 2 (bottom row) depict that the performance of
347
+ 341 SLR/HLR adapted models drops by 1.5 to 2.5 percent points compared to the pretrained model.
348
+ 342 We attribute this drop to self-supervision being less reliable than the original full supervision on in
349
+ 343 distribution training data. The drop is smaller for TENT and $\mathrm { T E N T + }$ , presumably because predictions
350
+ 344 on in-distribution target data are typically highly confident such that there is little gradient and thus
351
+ 345 little change to the pretrained networks by TENT. In summary, while self-supervision by confidence
352
+ 346 maximization is a powerful method for adaptation to domain shift, the observed drop when adapting
353
+ 347 to data from the source domain indicates that there is “no free lunch” in test-time adaptation.
354
+
355
+ # 348 6 Conclusion
356
+
357
+ 349 We propose a method to improve corruption robustness and domain adaptation of models in a fully
358
+ 350 test-time adaptation setting. Unlike entropy minimization, our proposed loss functions provide
359
+ 351 non-vanishing gradients for high confident predictions and thus attribute to improved adaptation
360
+ 352 in a self-supervised manner. We also show that additional diversity regularization on the model
361
+ 353 predictions is crucial to prevent trivial solutions and stabilize the adaptation process. Lastly, we
362
+ 354 introduce a trainable input transformation module that partially refines the corrupted samples to
363
+ 355 support the adaptation. We show that our method improves corruption robustness on ImageNet-C and
364
+ 356 domain adaptation to ImageNet-R on different ImageNet models. We also show that adaptation on a
365
+ 357 small fraction of data and classes is sufficient to generalize to unseen target data and classes.
366
+ 358 Ethical and Societal Impact Our non-saturating loss increases accuracy but might result in over
367
+ 359 confident predictions, which can cause harm in safety-critical downstream applications when not
368
+ 360 properly calibrated. At the same time, self-supervised confidence maximization might amplify bias in
369
+ 361 pretrained models. We hope that the diversity regularizer in the loss partially compensates this issue.
370
+
371
+ References
372
+ [1] Dequan Wang, Evan Shelhamer, Shaoteng Liu, Bruno Olshausen, and Trevor Darrell. Fully test-time adaptation by entropy minimization. arXiv preprint arXiv:2006.10726, 2020.
373
+ [2] Joaquin Quionero-Candela, Masashi Sugiyama, Anton Schwaighofer, and Neil D Lawrence. Dataset Shift in Machine Learning. MIT Press, 2009.
374
+ [3] Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix A. Wichmann, and Wieland Brendel. Imagenet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness. In International Conference on Learning Representations, 2019.
375
+ [4] Dan Hendrycks, Norman Mu, Ekin D Cubuk, Barret Zoph, Justin Gilmer, and Balaji Lakshminarayanan. Augmix: A simple data processing method to improve robustness and uncertainty. arXiv preprint arXiv:1912.02781, 2019.
376
+ [5] Eric Tzeng, Judy Hoffman, Kate Saenko, and Trevor Darrell. Adversarial discriminative domain adaptation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7167–7176, 2017. [6] Eric Mintun, Alexander Kirillov, and Saining Xie. On interaction between augmentations and corruptions in natural corruption robustness. arXiv preprint arXiv:2102.11273, 2021.
377
+ [7] Tuan-Hung Vu, Himalaya Jain, Maxime Bucher, Matthieu Cord, and Patrick Pérez. Advent: Adversarial entropy minimization for domain adaptation in semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2517–2526, 2019. [8] Dan Hendrycks and Thomas G. Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. International Conference on Learning Representations (ICLR), 2019. [9] Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, Dawn Song, Jacob Steinhardt, and Justin Gilmer. The many faces of robustness: A critical analysis of out-of-distribution generalization, 2020.
378
+ [10] Yu Sun, Xiaolong Wang, Zhuang Liu, John Miller, Alexei Efros, and Moritz Hardt. Test-time training with self-supervision for generalization under distribution shifts. In International Conference on Machine Learning, pages 9229–9248. PMLR, 2020.
379
+ [11] Jian Liang, Dapeng Hu, and Jiashi Feng. Do we really need to access the source data? Source hypothesis transfer for unsupervised domain adaptation. In Hal Daumé III and Aarti Singh, editors, Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pages 6028–6039. PMLR, 13–18 Jul 2020.
380
+ [12] Xiaofu Wu, Quan Zhou, Zhen Yang, Chunming Zhao, Longin Jan Latecki, et al. Entropy minimization vs. diversity maximization for domain adaptation. arXiv preprint arXiv:2002.01690, 2020.
381
+ [13] 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, pages 770–778, 2016.
382
+ [14] Norman Mu and Justin Gilmer. Mnist-c: A robustness benchmark for computer vision. arXiv preprint arXiv:1906.02337, 2019.
383
+ [15] Claudio Michaelis, Benjamin Mitzkus, Robert Geirhos, Evgenia Rusak, Oliver Bringmann, Alexander S Ecker, Matthias Bethge, and Wieland Brendel. Benchmarking robustness in object detection: Autonomous driving when winter is coming. arXiv preprint arXiv:1907.07484, 2019.
384
+ [16] Christoph Kamann and Carsten Rother. Benchmarking the robustness of semantic segmentation models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8828–8838, 2020.
385
+ [17] Nic Ford, Justin Gilmer, Nicolas Carlini, and Dogus Cubuk. Adversarial examples are a natural consequence of test error in noise. arXiv preprint arXiv:1901.10513, 2019.
386
+ [18] Raphael Gontijo Lopes, Dong Yin, Ben Poole, Justin Gilmer, and Ekin D Cubuk. Improving robustness without sacrificing accuracy with patch gaussian augmentation. arXiv preprint arXiv:1906.02611, 2019.
387
+ [19] Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6023–6032, 2019.
388
+ [20] Christoph Kamann, Burkhard Güssefeld, Robin Hutmacher, Jan Hendrik Metzen, and Carsten Rother. Increasing the robustness of semantic segmentation models with painting-by-numbers. arXiv preprint arXiv:2010.05495, 2020.
389
+ [21] Evgenia Rusak, Lukas Schott, Roland Zimmermann, Julian Bitterwolf, Oliver Bringmann, Matthias Bethge, and Wieland Brendel. Increasing the robustness of dnns against image corruptions by playing the game of noise. arXiv preprint arXiv:2001.06057, 3, 2020.
390
+ [22] Eric Mintun, Alexander Kirillov, and Saining Xie. On interaction between augmentations and corruptions in natural corruption robustness, 2021. URL https://openreview.net/forum? id=zbEupOtJFF.
391
+ [23] Joaquin Quiñonero-Candela, Masashi Sugiyama, Anton Schwaighofer, and N Lawrence. Covariate shift and local learning by distribution matching, 2008.
392
+ [24] Baochen Sun, Jiashi Feng, and Kate Saenko. Correlation alignment for unsupervised domain adaptation. In Domain Adaptation in Computer Vision Applications, pages 153–171. Springer, 2017.
393
+ [25] Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. In International conference on machine learning, pages 1180–1189. PMLR, 2015.
394
+ [26] Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The journal of machine learning research, 17(1):2096–2030, 2016.
395
+ [27] Judy Hoffman, Eric Tzeng, Taesung Park, Jun-Yan Zhu, Phillip Isola, Kate Saenko, Alexei Efros, and Trevor Darrell. Cycada: Cycle-consistent adversarial domain adaptation. In International conference on machine learning, pages 1989–1998. PMLR, 2018.
396
+ [28] Yu Sun, Eric Tzeng, Trevor Darrell, and Alexei A Efros. Unsupervised domain adaptation through self-supervision. arXiv preprint arXiv:1909.11825, 2019.
397
+ [29] Jogendra Nath Kundu, Naveen Venkat, Rahul M V, and R. Venkatesh Babu. Universal sourcefree domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
398
+ [30] Rui Li, Qianfen Jiao, Wenming Cao, Hau-San Wong, and Si Wu. Model adaptation: Unsupervised domain adaptation without source data. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
399
+ [31] Vinod K. Kurmi, Venkatesh K. Subramanian, and Vinay P. Namboodiri. Domain impression: A source data free domain adaptation method. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), January 2021.
400
+ [32] Hao-Wei Yeh, Baoyao Yang, Pong C. Yuen, and Tatsuya Harada. Sofa: Source-data-free feature alignment for unsupervised domain adaptation. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), January 2021.
401
+ [33] Steffen Schneider, Evgenia Rusak, Luisa Eck, Oliver Bringmann, Wieland Brendel, and Matthias Bethge. Improving robustness against common corruptions by covariate shift adaptation. Advances in Neural Information Processing Systems, 33, 2020.
402
+ [34] Zachary Nado, Shreyas Padhy, D. Sculley, Alexander D’Amour, Balaji Lakshminarayanan, and Jasper Snoek. Evaluating prediction-time batch normalization for robustness under covariate shift, 2021.
403
+ [35] Philipp Benz, Chaoning Zhang, Adil Karjauv, and In So Kweon. Revisiting batch normalization for improving corruption robustness. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), pages 494–503, January 2021.
404
+ [36] Fabio Maria Carlucci, Lorenzo Porzi, Barbara Caputo, Elisa Ricci, and Samuel Rota Bulo. Autodial: Automatic domain alignment layers. In Proceedings of the IEEE International Conference on Computer Vision, pages 5067–5075, 2017.
405
+ [37] Yanghao Li, Naiyan Wang, Jianping Shi, Jiaying Liu, and Xiaodi Hou. Revisiting batch normalization for practical domain adaptation. arXiv preprint arXiv:1603.04779, 2016.
406
+ [38] Evgenia Rusak, Lukas Schott, Roland S. Zimmermann, Julian Bitterwolf, Oliver Bringmann, Matthias Bethge, and Wieland Brendel. A simple way to make neural networks robust against diverse image corruptions. In Andrea Vedaldi, Horst Bischof, Thomas Brox, and Jan-Michael Frahm, editors, Computer Vision – ECCV, 2020.
407
+ [39] Hossein Talebi and Peyman Milanfar. Learning to resize images for computer vision tasks. arXiv preprint arXiv:2103.09950, 2021.
408
+ [40] Hengshuai Yao, Dong-lai Zhu, Bei Jiang, and Peng Yu. Negative log likelihood ratio loss for deep neural network classification. In Kohei Arai, Rahul Bhatia, and Supriya Kapoor, editors, Proceedings of the Future Technologies Conference (FTC), pages 276–282, Cham, 2020. Springer International Publishing. ISBN 978-3-030-32520-6.
409
+ [41] Xingchao Peng, Ben Usman, Neela Kaushik, Judy Hoffman, Dequan Wang, and Kate Saenko. Visda: The visual domain adaptation challenge. arXiv preprint arXiv:1710.06924, 2017.
410
+ [42] Hemanth Venkateswara, Jose Eusebio, Shayok Chakraborty, and Sethuraman Panchanathan. Deep hashing network for unsupervised domain adaptation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 5018–5027, 2017.
411
+ [43] Torch-Contributors. Torchvision models, 2020. URL https://pytorch.org/vision/ stable/models.html.
412
+ [44] Zhou Wang, A. C. Bovik, H. R. Sheikh, and E. P. Simoncelli. Image quality assessment: From error visibility to structural similarity. Trans. Img. Proc., 13(4):600–612, April 2004. ISSN 1057-7149.
413
+
414
+ # Checklist
415
+
416
+ 1. For all authors...
417
+
418
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
419
+ (b) Did you describe the limitations of your work? [Yes] We discuss that our class distribution matching term $L _ { d i v }$ requires knowledge of the class distribution $p _ { { D ^ { \prime } } } ( y )$ (Section 3.2.1). We also discuss that confidence maximization using a non-saturating loss might result in overconfident predictions (Section 3.2.2). We also discuss the small drop of accuracy when applying our method to adaptation on data from the source domain (part “Clean images” in Section 4).
420
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] Please refer to the “Ethical and Societal Impact” paragraph in Section 6.
421
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
422
+
423
+ 2. If you are including theoretical results...
424
+
425
+ (a) Did you state the full set of assumptions of all theoretical results? [N/A] We do not provide theoretical results
426
+ (b) Did you include complete proofs of all theoretical results? [N/A] We do not provide theoretical results
427
+
428
+ 3. If you ran experiments...
429
+
430
+ (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 include the code and instructions as a part of supplementary material.
431
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We report training details and hyperparameters and how they are chosen in Section 4, part "Settings".
432
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] We provide error bars in Figure 2. For the results in the Tables, we report error bars in the appendix.
433
+ (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)? [No] We can not report the total amount of compute since we did not track it. However, our organization is carbon neutral so that all its activities including compute on the GPU clusters on which the experiments have been performed do no longer leave a carbon footprint.
434
+
435
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
436
+
437
+ (a) If your work uses existing assets, did you cite the creators? [Yes] Our work builds upon pre-trained models. We cite the creators (see Section 4, part “Models”). Our work uses several openly available datasets. We cite their creators (see Section 4, part “Datasets”).
438
+ (b) Did you mention the license of the assets? [No]
439
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No] We do not provide new assets.
440
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No]
441
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] To the best of our knowledge data used in this project does not contain any personally identifiable information or offensive content.
442
+
443
+ 5. If you used crowdsourcing or conducted research with human subjects...
444
+
445
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] No crowdsourcing was used and no research with human subjects was conducted
446
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] No crowdsourcing was used and no research with human subjects was conducted
447
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] No crowdsourcing was used and no research with human subjects was conducted
md/train/H1gBhkBFDH/H1gBhkBFDH.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/H1gEP6NFwr/H1gEP6NFwr.md ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ON THE TUNABILITY OF OPTIMIZERS IN DEEP LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ There is no consensus yet on the question whether adaptive gradient methods like Adam are easier to use than non-adaptive optimization methods like SGD. In this work, we fill in the important, yet ambiguous concept of ‘ease-of-use’ by defining an optimizer’s tunability: How easy is it to find good hyperparameter configurations using automatic random hyperparameter search? We propose a practical evaluation protocol for optimizer tunability that can form the basis for a fair optimizer benchmark. Evaluating a variety of optimizers on an extensive set of standard datasets and architectures, we find that Adam is the most tunable for the majority of problems, especially with a low budget for hyperparameter tuning.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ With the ubiquity of deep learning in various applications, a multitude of first-order stochastic optimizers (Robbins & Monro, 1951) have been in vogue. They have varying algorithmic components like momentum (Sutskever et al., 2013) and adaptive learning rates (Tieleman & Hinton, 2012; Duchi et al., 2011; Kingma & Ba, 2015). With all these choices, picking the optimizer is among the most important design decisions for machine learning practitioners. For this decision, the best possible generalization performance is certainly an important characteristic to be taken into account. However, we argue that in practice, an even more important characteristic is whether the best possible performance can be reached with the available resources.
12
+
13
+ The performance of optimizers strongly depends on the choice of hyperparameter values such as the learning rate. In the machine learning research community, the sensitivity of models to hyperparameters has been of great debate recently, where in multiple cases, reported model advances did not stand the test of time because they can be explained by better hyperparameter tuning (Lucic et al., 2018; Melis et al., 2018; Henderson et al., 2018). This has led to calls for using automatic hyperparameter optimization methods with a fixed budget for a fairer comparison of models (Sculley et al., 2018; Feurer & Hutter, 2019; Eggensperger et al., 2019). For industrial applications, automated machine learning (AutoML, Hutter et al., 2019), which has automatic hyperparameter optimization as one of its key concepts, is becoming increasingly more important. In both cases, an optimization algorithm that achieves good performances with relatively little tuning effort is arguably substantially more useful than an optimization algorithm that achieves top performances, but reaches it only with a lot of careful tuning effort. Hence, we advocate that the performance obtained by an optimizer is not only the best performance obtained when using that optimizer, but also has to account for the cost of tuning its hyperparameters to obtain that performance, thus being dichotomous. We term this concept tunability in this paper.
14
+
15
+ Despite the importance of this concept, there is no standard way of measuring tunability. Works that propose optimization techniques show their performance on various tasks as depicted in Table 1. It is apparent that the experimental settings, as well as the network architectures tested, widely vary, hindering a fair comparison. The introduction of benchmarking suites like DEEPOBS (Schneider et al., 2019) have standardized the tested architectures, however, this does not fix the problem of selecting the hyperparameters themselves, and the effort expended in doing so. Previous studies treat tunability to be the best performance obtained on varying a hyperparameter (Schneider et al., 2019) or by measuring the improvement in performance by tuning a hyperparameter (Probst et al., 2019), but do not take any cognizance to the intermediate performance during the tuning process.
16
+
17
+ Table 1: Experimental settings shown in the original papers of popular optimizers. The large differences in test problems and tuning methods make them difficult to compare. $\gamma$ denotes learning rate, $\mu$ denotes momentum, $\lambda$ is the weight decay coefficient.
18
+
19
+ <table><tr><td>Method</td><td>Datasets</td><td>Network architecture</td><td>Parameter tuning methods</td></tr><tr><td>SGD with momentum (Sutskever et al., 2013)</td><td>Artificial datasets MNIST</td><td>Fully-connected LSTM</td><td>μ = 0.9 for first 1000 updates then μ ∈ {0,0.9,0.98,0.995}. other schedules for μ are used &amp; log1o(γ)∈{-3,-4,-5,-6}</td></tr><tr><td>Adagrad (Duchi et al., 2011)</td><td>ImageNet ranking Reuter RCV1 MNIST KDD Census</td><td>Single layer Handcrafted features Histogram features</td><td>Perfomance on dev-set</td></tr><tr><td>Adam (Kingma &amp; Ba, 2015)</td><td>IMDb MNIST CIFAR10</td><td>Logistic regression Multi-layer perceptron Convolutional network</td><td>β1∈{0,0.9} β∈{0.99,0.999,0.9999} log10(γ)∈{-5,-4,-3,-2,-1}</td></tr><tr><td>AdamW (Loshchilov &amp; Hutter,2019)</td><td>CIFAR 10 ImageNet 32×32</td><td>ResNet CNN</td><td>log2(γ) ∈{-11,-10.-1,0} log2(λ)∈ log2(10-3)+{-5,-4,...,4}</td></tr></table>
20
+
21
+ In this paper, we introduce a fair evaluation protocol for tunability based on automatic hyperparameter optimization, and simple evaluation measures that allow to compare the performance of optimizers under varying resource constraints. By evaluating on a wide range of 9 diverse tasks, we aim to contribute to the debate of adaptive vs. non-adaptive optimizers (Wilson et al., 2017; Shah et al., 2018; Chen & Gu, 2018) . To reach a fair comparison, we experiment with several SGD variants that are often needed to reach good performance. Although a well-tuned SGD variant is able to reach the top performance in some cases, our overall results clearly favor adaptive gradient methods. We therefore conclude that there is substantial value in adaptive gradient methods.
22
+
23
+ # 2 MEASURING TUNABILITY
24
+
25
+ Given the dichotomy of the problem of tunability, we argue that it needs to take into account
26
+
27
+ 1. how difficult it is to find a good hyperparameter configuration for the optimizer,
28
+ 2. the absolute performance of the optimizer.
29
+
30
+ To see why both are needed, consider Figure 1.a, which shows the performance in terms of loss of four different optimizers as a function of its only hyperparameter $\theta$ (by assumption). If we only consider requirement #1, optimizer C would be considered the best, since every hyperparameter value is the optimum. However, its absolute performance is poor, making it of low practical value. Moreover, due to the same shape, optimizers A and B would be considered equally good, although optimizer A clearly outperforms B. On the other hand, if we only consider requirement #2, optimizers B and D would be considered equally good, although optimizer D’s optimum is harder to find.
31
+
32
+ As we show in Section 5, no existing definition of tunability takes both requirements into account. In the following, we present a formulation that does so.
33
+
34
+ # 2.1 PRELIMINARIES: HYPERPARAMETER OPTIMIZATION
35
+
36
+ We define hyperparameter optimization (HPO) (Feurer & Hutter, 2019) as follows:
37
+
38
+ Definition. Let $\mathcal { M }$ be an optimization algorithm with $N$ hyperparameters $( \theta _ { 1 } , \ldots , \theta _ { N } ) \in \Theta$ . Let $a$ specific instantiation of $\mathcal { M }$ with $\pmb \theta \in \Theta$ be denoted by $\mathcal { M } _ { \theta }$ . Thus, given a dataset $D = D _ { t r a i n } \bigcup D _ { v a l }$ , the following objective is minimized
39
+
40
+ $$
41
+ \pmb { \theta } ^ { \star } = \arg \operatorname* { m i n } _ { \pmb { \theta } \in \Theta } \mathcal { L } ( \mathcal { M } _ { \pmb { \theta } } , D _ { v a l } )
42
+ $$
43
+
44
+ where $\mathcal { M } _ { \theta }$ is trained on $D _ { t r a i n }$ . In our work, we use $\mathcal { L }$ to be validation loss.
45
+
46
+ We use $\mathcal { L } ( \pmb { \theta } )$ to refer to $\mathcal { L } ( \mathcal { M } _ { \theta } , D _ { v a l } )$ for brevity. In our experiments, we use the time-tested Random Search (Bergstra & Bengio, 2012) algorithm for HPO for simplicity.
47
+
48
+ The ability to easily find good minima depends on the loss surface $\mathcal { L }$ itself. Thus, tunability is a characterization of the HPO’s loss function $\mathcal { L }$ . Here we present a quantification of this idea, which we illustrate with Figure 1.b.
49
+
50
+ Let us assume that there are two optimizers E & F, both with hyperparameter $\theta$ , both of them used to minimize a function (e.g. train a neural network). Let the loss functions of HPO be $\mathcal { L } _ { E }$ and $\mathcal { L } _ { F }$ respectively. As the figure shows, the minimum of $\mathcal { L } _ { E }$ is lower than that of $\mathcal { L } _ { F }$ (denoted by $\theta _ { E } ^ { \star }$ and $\theta _ { F } ^ { \star } .$ ) i.e. $\mathcal { L } _ { E } ( \theta _ { E } ^ { \star } ) < \mathcal { L } _ { F } ( \theta _ { F } ^ { \star } )$ . However, the minimum of $\mathcal { L } _ { E }$ is much sharper than that of $\mathcal { L } _ { F }$ , and in most regions of the parameter space F performs much better than E. This makes it easier to find configurations that already perform well. This makes optimizer F an attractive option when we have no prior knowledge of the good parameter settings.
51
+
52
+ ![](images/e23b0ccbb293a18f6a1db6c084466c5253e59cc3b80bdd3822b44d9f98c145d2.jpg)
53
+ 1.a: Illustration. It is important to consider both the absolute performance of optimizers as well as the tuning effort to get to good performances.
54
+
55
+ ![](images/1b5b7c856204f84cee6dd94985a20853400f67d375d9ac8122ea6d45cfa55388.jpg)
56
+ 1.b: Illustration. While optimizer E can achieve the best performance after careful tuning, optimizer F is likely to provide better performance under a constrained HPO budget.
57
+
58
+ The key-difference between the two interpretations is whether one prefers a ‘good enough’ performance through fewer hyperparameter configuration searches (in the case of optimizer F), or whether one is willing to spend computational time to get the best possible performance $\left( \theta _ { E } ^ { \star } \right)$ in the case of optimizer E). In this work, we search for the hyperparameter through an HPO like Random Search. Thus, the difference of the two interpretations of tunability lies whether one values results from late stages of the HPO process (i.e. optimizer $\mathrm { E }$ is preferable due to better optimum) more than results from early stages of the HPO process (i.e. optimizer F is preferable).
59
+
60
+ Motivated by these observations, we propose the following metric for tunability.
61
+
62
+ $\omega$ -tunability’s Definition. Let $( \mathbf { \boldsymbol { \theta } } _ { t } , \mathbf { \mathcal { L } } ( \mathbf { \boldsymbol { \theta } } _ { t } ) )$ be the incumbents (best performance attained till $t$ ) of the HPO algorithm at iteration $t$ and $T$ be the hyperparameter tuning budget. For $w _ { t } > 0 \forall t$ and $\textstyle \sum _ { t } w _ { t } < \infty$ , we define $\omega$ -tunability as
63
+
64
+ $$
65
+ \omega \ – t u n a b i l i t y = \sum _ { t = 1 } ^ { T } \omega _ { t } \mathcal { L } _ { t }
66
+ $$
67
+
68
+ i.e, $\omega$ -tunability is a weighted sum of the incumbents $\mathcal { L } ( \pmb { \theta } _ { t } )$ . In our experiments we use $\textstyle \sum _ { t } \omega _ { t } = 1$
69
+
70
+ By appropriately choosing the weights $\left\{ \omega _ { t } \right\}$ , we can interpolate between our two notions of tunability. In the extreme case where we are only interested in the peak performance of the optimizer, we can set $\omega _ { T } = 1$ and set the other weights to zero. In the opposite extreme case where we are interested in the "one-shot tunability" of the optimizer, we can set $\omega _ { 1 } = 1$ . In general, we can answer the question of "How well does the optimizer perform with a budget of $K$ iterations?" by setting $\omega _ { i } = { \bf 1 } _ { \mathrm { i = K } }$ .
71
+
72
+ While the above weighting scheme is intuitive, merely computing the performance after expending HPO budget of $K$ does not consider the performance obtained after the previous $K - 1$ iterations i.e. we would like to differentiate the cases where a requisite performance is attained by tuning an optimizer for $K$ iterations and another for $K _ { 1 }$ iterations, where $K _ { 1 } \gg K$ . Therefore, we employ three additional weighting schemes. By setting $\omega _ { i } \propto ( T - i )$ , our first one puts more emphasis on the earlier stages of the hyperparameter tuning process. We term this weighting scheme Cumulative Performance-Early $( C P E )$ . In contrast, the second weighting scheme, Cumulative Performance-Late $( C P L )$ puts more emphasis on late stages of tuning, and thus on obtaining a better performance at a higher tuning cost: $\omega _ { i } \propto i$ . As a intermediate of the two, we also report a uniform weighting Cumulative Performance-Uniform $( C P U ) : \omega _ { i } = 1 / T$ .
73
+
74
+ # 3 OPTIMIZERS AND THEIR HYPERPARAMETERS
75
+
76
+ # 3.1 PARAMETERS OF THE OPTIMIZERS
77
+
78
+ To compare the tunability of adaptive gradient methods to non-adaptive methods, we choose the most commonly used optimizers from both the strata; SGD and SGD with momentum for non-adaptive methods, and Adagrad and Adam for adaptive gradient methods. Since adaptive gradient methods are said to work well with their default hyperparameter values already, we additionally employ a default version of Adam where we only tune the initial learning rate and set the other hyperparameters to the values recommended in the original paper (Kingma & Ba, 2015) (termed AdamLR). Such a scheme has been used by Schneider et al. too. A similar argument can be made for SGD with momentum (termed SGDM): thus we experiment with a fixed momentum value of 0.9 (termed SGDMC).
79
+
80
+ In addition to standard parameters in all optimizers, we consider weight decay with SGD too. SGD with weight decay can be considered as an optimizer with two steps where the first step is to scale current weights with the decay value, followed by a normal descent step (Loshchilov & Hutter, 2019). Thus we devise two additional experiments for SGD with weight-decay where we tune weight-decay along with momentum (termed SGDMW), and one where we fix it to $1 0 ^ { - 5 }$ (termed $\mathbf { S G D M ^ { C } W } ^ { \dot { \mathbf { C } } } ,$ ) along with the momentum being fixed to 0.9, which is the value for weight decay we found to be consistently better through HPO. The full list of optimizers we consider is provided in Table 4
81
+
82
+ Manually defining a specific number of epochs can be biased towards one optimizer, as one optimizer may reach good performance in the early epochs of a single HPO iteration, whereas another may reach higher peaks more slowly. In order to alleviate this, it would be possible to add the number of training epochs as an additional hyperparameter to be searched. Since this would incur even higher computational cost, we instead use a validation set performance as stopping criterion. Thus we stop training when the validation loss plateaus for more than 2 epochs or if the number of epochs exceeds the predetermined maximum number as set in DEEPOBS.
83
+
84
+ # 3.2 CALIBRATION OF HYPERPARAMETER DISTRIBUTIONS
85
+
86
+ As mentioned previously, we use Random Search for optimizing the hyperparameters, which requires distributions of random variables to sample from. Choosing poor distributions to sample from impacts the performance, and may break requisite properties (e.g. learning rate is non-negative). For some of the parameters listed in Table 2, obvious bounds exist due their mathematical properties, or have been prescribed by the optimizer designers themselves. For example, Kingma & Ba (2015) bound $\beta _ { 1 } , \beta _ { 2 }$ to $[ 0 , 1 )$ and specify that they are close to 1. In the absence of such prior knowledge, we devise a simple method to determine the priors.
87
+
88
+ We train each task specified in the DEEPOBS with a large number of hyperparameter samplings and retain the hyperparameters which resulted in performance within $2 0 \%$ of the best performance obtained. For each of the hyperparameters in this set, we fit the distributions in the third column of Table 2 using maximum likelihood estimation. In doing so, we make a simplifying assumption that all the hyperparameters are independent of each other. We argue that these distributions are appropriate; the only condition on learning rate is non-negativity that is inherent to the log-normal distribution, momentum is non-negative with a usual upper bound of 1, $\beta \mathrm { { s } }$ in Adam have been prescribed to be less than 1 but close to it, $\epsilon$ is used to avoid divide-by-zero error and thus is a small positive value close to 0. We report the parameters of the distributions obtained after the fitting in Table 2. The calibration procedure’s performance is not included in the tunability computation.
89
+
90
+ Table 2: Optimizers evaluated. For each hyperparameter, we calibrated a ‘sampling distribution’ to give good results across tasks (Section 3.2). $\boldsymbol { \bar { \mathcal { U } } } [ \boldsymbol { a } , \boldsymbol { b } ]$ is the continuous uniform distribution on $[ a , b ]$ . Log-uniform $( a , b )$ is a distribution whose logarithm is $\mathcal { U } [ a , b ]$ . Log-normal $( \mu , \sigma )$ is a distribution whose logarithm is normally distributed with mean $\mu$ and standard deviation $\sigma$ .
91
+
92
+ <table><tr><td>Optimizer</td><td>Tunable parameters</td><td>Sampling distribution</td></tr><tr><td rowspan="3">Stochastic Gradient Descent</td><td>Learning rate</td><td>Log-normal(-2.09,1.312)</td></tr><tr><td>Momentum</td><td>u[0,1]</td></tr><tr><td>Weight decay</td><td>Log-uniform(-5,-1)</td></tr><tr><td>Adagrad</td><td>Learning rate</td><td>Log-normal(-2.004,1.20)</td></tr><tr><td rowspan="3">Adam</td><td>Learning rate</td><td>Log-normal(-2.69,1.42)</td></tr><tr><td>β1,β</td><td>Log-uniform(-5, -1)</td></tr><tr><td>E</td><td>Log-uniform(-8,0)</td></tr></table>
93
+
94
+ Table 3: Models and datasets used. We use the DeepOBS benchmark set (Schneider et al., 2019). Details are provided in Appendix A.
95
+
96
+ <table><tr><td>Architecture</td><td>Datasets</td></tr><tr><td>Convolutional net</td><td>FMNIST, CIFAR10/100</td></tr><tr><td>Variational autoencoder</td><td>FMNIST,I</td></tr><tr><td>Wide residual network</td><td>SVHN</td></tr><tr><td>CharacterRNN</td><td>Tolstoi&#x27;s War and Peace</td></tr><tr><td>Quadratic function</td><td>Artificial datatset</td></tr><tr><td>LSTM</td><td>IMDb</td></tr></table>
97
+
98
+ Table 4: Optimizers and tunable parameters. $\gamma$ is learning rate, $\mu$ is momentum, $\lambda$ is the weight decay coefficient.
99
+
100
+ <table><tr><td>Optimizer</td><td>Tunable parameters</td></tr><tr><td>SGD</td><td>γ(μ=0,λ=0)</td></tr><tr><td>SGDM</td><td>Y,μ(入=0)</td></tr><tr><td>SGDMC SGDMCWC</td><td>γ (μ=0.9,λ=0) γ (μ=0.9,λ=10-5)</td></tr><tr><td>SGDMW</td><td>Y,μ,入</td></tr><tr><td>Adagrad</td><td>Y</td></tr><tr><td>AdamLR Adam</td><td>γ (β1=0.9,β2=0.999,∈=10-8) Y,β1,β2,E</td></tr></table>
101
+
102
+ # 4 EXPERIMENTS AND RESULTS
103
+
104
+ To assess the tunability of optimizers’ hyperparameters for the training of deep neural networks, we benchmark using the open-source suite DEEPOBS (Schneider et al., 2019). The architectures and datasets we experiment are given in Table 3. We refer the reader to Schneider et al. (2019) for specific details of the architectures. To obtain a better balance between vision and NLP applications, we added an LSTM network with the task of sentiment classification in the IMDB dataset (Maas et al., 2011), details for which are provided in Appendix A.
105
+
106
+ # 4.1 HYPERPARAMETERS AND IMPLEMENTATION
107
+
108
+ The performance of automatic hyperparameter search methods is dependent on its own hyperparameters, which play an important role in the outcome, e.g number of configurations to test. In our experiments, we evaluate 100 configurations with each of the hyperparameter optimization methods. As we use random search, we simulate multiple runs of these 100 configurations through shuffling. This gives us the variance of performance at each step.
109
+
110
+ # 4.2 ANALYSIS OF TUNABILITY
111
+
112
+ We analyze the tunability for the various weighting schemes proposed. For the weighting scheme $\omega _ { i } = { \bf 1 } _ { \mathrm { i = K } }$ , for increasing values of $K$ , we show the performance as well as its variance in Figure 3. For readability, we show only results for Adam, AdamLR, Adagrad and SGDMW, and the rest are given in Appendix C. It is quite apparent that in most of the tasks, a well tuned SGD with momentum and weight decay is as good as Adam (for large $K$ ). However, the gap in the performance is quite noticeable when AdamLR outperforms SGD in the VAE tasks and the IMDB task. In the case of image classification problems, SGD variants fare the best, as it has been reported before (Keskar & Socher, 2017). It is interesting to notice that for $K { = } 4$ , the decreasing order of variance is nearly always SGDMW, Adam, Adagrad, AdamLR (10 out of 11 cases), even if AdamLR marginally underperforms as it is in the case of Quadratic Deep. Given this formulation, we ask the following question: given an HPO budget of $K$ , what is the best choice for optimizer? We answer this in Appendix D.
113
+
114
+ For the other weighting schemes, tunability scores are reported in Table 5. We see that there is no one optimizer that is best across three schemes, and tasks presented. A similar trend of SGD doing better than the adaptive gradient methods on image classification tasks is evident. Considering CPE, we observe that AdamLR performs the best in 6 out 9 tasks, where as the other three times $\mathrm { \Delta S G D M ^ { C } W ^ { C } }$ performs the best. The trend is not very obvious for CPU and CPL. In the case of CPU, AdamLR wins 5 out of 9 tasks, $\mathbf { S G D M ^ { C } W ^ { C } }$ wins twice, and SGDM wins once. For CPL, AdamLR wins 4 out of 9, and the $\mathbf { S G D M ^ { C } W ^ { C } }$ wins once, and SGDM and $\mathbf { S G D M ^ { C } }$ win twice each. Summarizing, if peak-performance or even evolving to better performance at a larger hyperparameter search cost, SGD variants are better 5 out 9 times. However, if a good performance is expected in the earlier iterations of hyperparameter search, AdamLR is very competitive. Also, the default parameters of $\beta _ { 1 } , \beta _ { 2 } , \epsilon$ of Adam optimizer result in quite good performance, to the point that Adam is rarely the better alternative over AdamLR. A known exception is training Inception networks (Abadi et al., 2015), where $\epsilon$ is recommended to be set to 0.1.
115
+
116
+ For some of the cases, the tunablities reported are very similar for the AdamLR and SGD variants. However, tuning Adam is very different from tuning SGD from a wall-clock time measurement. For example, we find that for the case of CIFAR-10, AdamLR requires on average $39 \%$ fewer epochs to complete training than $\mathbf { S G D M ^ { C } }$ (the top perfomer); thus being that much faster than $\mathrm { S G D M ^ { C } }$ in wall-clock time. It can be argued that a more practical form of hyperparameter tuning budget is wall-clock time i.e. if a wall-clock time budget of $K$ minutes is given, how do our findings vary? In short, we find similar trends as we noticed before. We provide the details in Appendix E.
117
+
118
+ # 4.3 SUMMARIZING ACROSS DATASETS
119
+
120
+ To get a better understanding of an optimizer’s aggregate tunability across datasets compared to the rest, we compute summary statistics for an optimizer $o$ ’s performance after $k$ iterations in the following way:
121
+
122
+ $$
123
+ S ( o , k ) = \frac { 1 } { | \mathcal { P } | } \sum _ { p \in \mathcal { P } } \frac { o ( k , p ) } { \operatorname* { m a x } _ { o ^ { \prime } \in \mathcal { O } } o ^ { \prime } ( k , p ) } ,
124
+ $$
125
+
126
+ where $o ( k , p )$ denotes the performance of optimizer $o \in \mathcal { O }$ on test problem $p \in \mathcal P$ after $k$ iterations of the HPO process (i.e. $\omega$ -tunability with $\omega _ { i } = \mathbf { 1 } _ { \mathrm { i = k } }$ ). In other words, we compute the average relative performance of an optimizer to the best performance of any optimizer over all tasks.
127
+
128
+ ![](images/49a91c72fa4f42bd73f6a4d510b838b41da14b1747ddb982287a49add13f2d19.jpg)
129
+ Figure 2: Aggregated relative tunability of each optimizer across datasets
130
+
131
+ The results are in Figure 2 and show that AdamLR performs very close to the best optimizer throughout the HPO process and is the best till about the $6 0 ^ { \mathrm { t h } }$ iteration. In early stages of HPO, the SGD variants perform $10 \mathrm { - } 2 0 \%$ worse than Adam, but improve as the HPO progresses.
132
+
133
+ # 5 RELATED WORK
134
+
135
+ There exist few works that have tried to define and investigate tunability formally. Assessing the impact of hyperparameter tuning for decision tree models, Mantovani et al. (2018) count the number of times the tuned hyperparameter values are (statistically significantly) better than the default values. Probst et al. (2019) define tunability of an ML algorithm as the performance difference between a reference configuration (e.g., the default hyperparameters of the algorithm) and the best possible configuration on each dataset. This metric is comparable across ML algorithms, but it disregards entirely the absolute performance of ML algorithms. Schneider et al. (2019) recently released a benchmark for optimizers that evaluates their peak performance and speed. Tunability is assessed as the sensitivity of the performance to changes of the learning rate. In all three aforementioned studies, the definitions of tunability would fail to identify the superiority of optimizer A over optimizer B in Figure 1.a.
136
+
137
+ The study by Wilson et al. (2017) finds SGD-based methods as easy to tune as adaptive gradient methods. However, their study lacks a clear definition of tunability and tunes the algorithms on manually selected, dataset dependent grid values. The study by Shah et al. (2018) applies a similar methodology and comes to similar conclusions regarding tunability. Since both studies only consider the best parameter configuration, their approach would be unable to identify the better optimizer among B and D in Figure 1.a. In contrast, the methodology in our study is able to distinguish all the cases depicted in Figure 1.a.
138
+
139
+ Table 5: Performance of various experiments.
140
+
141
+ <table><tr><td>Optimizer</td><td>CPE</td><td>CPU</td><td>CPL</td></tr><tr><td>Adagrad</td><td>91.3</td><td>91.4</td><td>91.6</td></tr><tr><td>Adam</td><td>91.3</td><td>91.5</td><td>91.8</td></tr><tr><td>AdamLR</td><td>91.3</td><td>91.6</td><td>91.9</td></tr><tr><td>SGD</td><td>90.4</td><td>90.8</td><td>91.2</td></tr><tr><td>SGDM</td><td>90.5</td><td>90.9</td><td>91.3</td></tr><tr><td>SGDMC</td><td>90.7</td><td>90.9</td><td>91.1</td></tr><tr><td>SGDMCWC</td><td>90.7</td><td>90.9</td><td>91.1</td></tr><tr><td>SGDMW</td><td>90.4</td><td>90.8</td><td>91.3</td></tr></table>
142
+
143
+ 5.a: FMNIST 2C2D. Higher is better
144
+
145
+ <table><tr><td>Optimizer</td><td>CPE</td><td>CPU</td><td>CPL</td></tr><tr><td>Adagrad</td><td>76.4</td><td>77.1</td><td>77.9</td></tr><tr><td>Adam</td><td>77.2</td><td>78.4</td><td>79.5</td></tr><tr><td>AdamLR</td><td>78.8</td><td>79.4</td><td>80.0</td></tr><tr><td>SGD</td><td>77.0</td><td>77.8</td><td>78.6</td></tr><tr><td>SGDM</td><td>77.8</td><td>78.6</td><td>79.5</td></tr><tr><td>SGDMC</td><td>78.6</td><td>79.4</td><td>80.1</td></tr><tr><td>SGDMCWC</td><td>81.1</td><td>81.6</td><td>82.0</td></tr><tr><td>SGDMW</td><td>79.7</td><td>80.4</td><td>81.2</td></tr></table>
146
+
147
+ 5.b: CIFAR 10. Higher is better
148
+
149
+ <table><tr><td>Optimizer</td><td>CPE</td><td>CPU</td><td>CPL</td></tr><tr><td>Adagrad</td><td>30.4</td><td>31.8</td><td>33.1</td></tr><tr><td>Adam</td><td>39.4</td><td>42.2</td><td>45.1</td></tr><tr><td>AdamLR</td><td>42.2</td><td>43.0</td><td>43.8</td></tr><tr><td>SGD</td><td>31.8</td><td>34.2</td><td>36.6</td></tr><tr><td>SGDM</td><td>40.6</td><td>43.3</td><td>46.0</td></tr><tr><td>SGDMC</td><td>42.1</td><td>43.3</td><td>44.5</td></tr><tr><td>SGDMCWC</td><td>39.2</td><td>40.3</td><td>41.5</td></tr><tr><td>SGDMW</td><td>33.5</td><td>37.2</td><td>41.0</td></tr></table>
150
+
151
+ 5.c: CIFAR 100. Higher the better
152
+
153
+ <table><tr><td>Optimizer</td><td>CPE</td><td>CPU</td><td>CPL</td></tr><tr><td>Adagrad</td><td>84.3</td><td>84.8</td><td>85.3</td></tr><tr><td>Adam</td><td>83.6</td><td>84.5</td><td>85.5</td></tr><tr><td>AdamLR</td><td>85.8</td><td>86.0</td><td>86.3</td></tr><tr><td>SGD</td><td>68.1</td><td>69.3</td><td>70.5</td></tr><tr><td>SGDM</td><td>74.3</td><td>75.9</td><td>77.5</td></tr><tr><td>SGDMC</td><td>79.3</td><td>80.1</td><td>81.0</td></tr><tr><td>SGDMCWC</td><td>78.8</td><td>79.4</td><td>80.0</td></tr><tr><td>SGDMW</td><td>75.7</td><td>77.1</td><td>78.6</td></tr></table>
154
+
155
+ 5.d: IMDB. Higher is better
156
+
157
+ <table><tr><td>Optimizer</td><td>CPE</td><td>CPU</td><td>CPL</td></tr><tr><td>Adagrad</td><td>94.8</td><td>94.9</td><td>95.0</td></tr><tr><td>Adam</td><td>94.5</td><td>94.8</td><td>95.2</td></tr><tr><td>AdamLR</td><td>95.1</td><td>95.3</td><td>95.4</td></tr><tr><td>SGD</td><td>94.6</td><td>94.9</td><td>95.2</td></tr><tr><td>SGDM</td><td>94.8</td><td>95.2</td><td>95.6</td></tr><tr><td>SGDMC</td><td>94.9</td><td>95.1</td><td>95.3</td></tr><tr><td>SGDMCWC</td><td>95.2</td><td>95.4</td><td>95.5</td></tr><tr><td>SGDMW</td><td>95.0</td><td>95.2</td><td>95.3</td></tr></table>
158
+
159
+ 5.e: WRN-16(4). Higher is better
160
+
161
+ <table><tr><td>Optimizer</td><td>CPE</td><td>CPU</td><td>CPL</td></tr><tr><td>Adagrad</td><td>55.6</td><td>56.2</td><td>56.7</td></tr><tr><td>Adam</td><td>54.4</td><td>55.7</td><td>57.0</td></tr><tr><td>AdamLR</td><td>56.9</td><td>57.2</td><td>57.5</td></tr><tr><td>SGD</td><td>40.3</td><td>42.5</td><td>44.6</td></tr><tr><td>SGDM</td><td>51.4</td><td>54.0</td><td>56.5</td></tr><tr><td>SGDMC</td><td>55.6</td><td>57.0</td><td>58.3</td></tr><tr><td>SGDMCWC</td><td>54.2</td><td>55.6</td><td>57.0</td></tr><tr><td>SGDMW</td><td>45.1</td><td>48.2</td><td>51.2</td></tr></table>
162
+
163
+ 5.f: Char-RNN. Higher is better
164
+
165
+ <table><tr><td>Optimizer</td><td>CPE</td><td>CPU</td><td>CPL</td></tr><tr><td>Adagrad</td><td>30.3</td><td>29.4</td><td>28.4</td></tr><tr><td>Adam</td><td>33.2</td><td>31.2</td><td>29.1</td></tr><tr><td>AdamLR</td><td>29.2</td><td>28.6</td><td>27.9</td></tr><tr><td>SGD</td><td>53.3</td><td>53.1</td><td>52.9</td></tr><tr><td>SGDM</td><td>36.0</td><td>32.9</td><td>29.9</td></tr><tr><td>SGDMC</td><td>54.1</td><td>53.5</td><td>53.0</td></tr><tr><td>SGDMCWC</td><td>54.0</td><td>53.5</td><td>53.0</td></tr><tr><td>SGDMW</td><td>34.6</td><td>32.2</td><td>29.8</td></tr></table>
166
+
167
+ <table><tr><td>Optimizer</td><td>CPE</td><td>CPU</td><td>CPL</td></tr><tr><td>Adagrad</td><td>25.5</td><td>24.7</td><td>24.0</td></tr><tr><td>Adam</td><td>26.0</td><td>24.8</td><td>23.7</td></tr><tr><td>AdamLR</td><td>24.6</td><td>24.0</td><td>23.5</td></tr><tr><td>SGD</td><td>26.2</td><td>25.5</td><td>24.8</td></tr><tr><td>SGDM</td><td>26.2</td><td>25.4</td><td>24.6</td></tr><tr><td>SGDMC</td><td>28.6</td><td>26.7</td><td>24.9</td></tr><tr><td>SGDMCWC</td><td>27.9</td><td>26.4</td><td>24.8</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>SGDMW</td><td>26.5</td><td>25.7</td><td>24.8</td></tr></table>
168
+
169
+ 5.g: FMNIST-VAE. Lower is better. 5.h: MNIST-VAE. Lower is better
170
+
171
+ <table><tr><td>Optimizer</td><td>CPE</td><td>CPU</td><td>CPL</td></tr><tr><td>Adagrad</td><td>91.5</td><td>89.6</td><td>87.6</td></tr><tr><td>Adam</td><td>94.8</td><td>92.1</td><td>89.4</td></tr><tr><td>AdamLR</td><td>91.2</td><td>89.5</td><td>87.7</td></tr><tr><td>SGD</td><td>90.5</td><td>89.6</td><td>88.7</td></tr><tr><td>SGDM</td><td>89.5</td><td>88.7</td><td>87.9</td></tr><tr><td>SGDMC</td><td>89.6</td><td>88.6</td><td>87.5</td></tr><tr><td>SGDMCWC</td><td>88.6</td><td>88.4</td><td>88.1</td></tr><tr><td>SGDMW</td><td>89.3</td><td>88.9</td><td>88.4</td></tr></table>
172
+
173
+ 5.i: Quadratic deep. Lower is better
174
+
175
+ In a concurrent study, Choi et al. (2019) show that there exist a hierarchy among optimizers that such some can be viewed as specific cases of others e.g. SGDM is shown to be a special case of Adam as its $\epsilon \to \infty$ , and thus Adam should never underperform SGDM with appropriate hyperparameter search). Like in our study, they suggest that the performance comparison of optimizers strongly depends on the hyperparameter tuning protocol. They also argue that the search space needs to be chosen optimizer specific. However, their focus is on the best possible performance achievable by an optimizer and does not take into account the tuning process. Moreover, while the authors claim their search protocol to be relevant for practitioners, the search spaces are manually chosen per dataset, constituting a significant difference to the AutoML scenario considered in our paper.
176
+
177
+ Tunability is related to measuring hyperparameter importance (Hutter et al., 2013), where van Rijn & Hutter (2018) have recently shown that learning the priors for hyperparameter distributions can yield to better HPO performance, akin to the calibration phase in our study.
178
+
179
+ There has been recent interest in building optimizers termed the APROX family (Asi & Duchi, 2019a;b) that are provably robust to hyperparameter choices. Asi & Duchi experimentally find that, training a Residual network (He et al., 2016) on CIFAR-10, SGD converges only for a small range of initial learning rate choices, whereas Adam exhibits better robustness to learning rate choices. This is inline with our findings of tunability.
180
+
181
+ # 6 CONCLUSION
182
+
183
+ Our work proposes a new notion of tunability for optimizers that takes into account the tuning efforts of an HPO. The results of our experiments support the hypothesis that adaptive gradient methods are easier to tune than non-adaptive methods: In a setting with low budget for hyperparameter tuning, tuning only Adam optimizer’s learning rate is likely to be a very good choice; it doesn’t guarantee the best possible performance, but it is evidently the easiest to find well-performing hyperparameter configurations for. While SGD yields the best performance in some cases, its best configuration is tedious to find, and Adam often performs close to it. We, thus, state that the substantial value of the adaptive gradient methods, specifically Adam, is its amenability to hyperparameter search. This is in contrast to the findings of Wilson et al. (2017) who observe no advantage in tunabilty for adaptive gradient methods, and thus deem them to be of ‘marginal value’. Unlike them, we base our experiments on a standard hyperparameter optimization method that allows for an arguably fairer comparison.
184
+
185
+ ![](images/a6a328ac8956d13a356ce3cd78118cadaef5aaeea2be8387efb7945b6d603628.jpg)
186
+ 3.a: CIFAR 10
187
+ 3.c: SVHN WRN-16-4
188
+
189
+ ![](images/37fa782ff72d6c3cf69d86b7bd1bf2925155a46897c634641a8aafccf461ecb4.jpg)
190
+ 3.b: CIFAR 100
191
+ 3.d: IMDb LSTM
192
+
193
+ ![](images/e59c891fc2344e65b1e84273272d32d8febae7cc9a8d8a365967a1a77934fa9a.jpg)
194
+ 3.e: FMNIST 2C2D CNN
195
+
196
+ ![](images/bb206c4e3b713dfa1b45b309a8f55d8dcbfc4dd9ea7cd3c6a4aac0182bda7c7d.jpg)
197
+ 3.f: Tolstoi Char-RNN
198
+
199
+ ![](images/6bdf6b9d68c3d0c673e056db52c9ba789a12343641b39d2f56bfc440064906ac.jpg)
200
+ 3.g: MNIST VAE
201
+
202
+ ![](images/fa18ce6d21356460daa8eb8cc9e764f75e8757afc08162235afa854744667933.jpg)
203
+ 3.h: F-MNIST VAE
204
+
205
+ ![](images/a078543749ba6f7edf8a8a44d7004986e18f4c4dea570d019b6e6567ab23eee0.jpg)
206
+ 3.i: Quadratic Deep
207
+
208
+ ![](images/05eab81f16ad917d949b166f6ff68db46a6643578bfd7be2228473acb6ff3bf1.jpg)
209
+
210
+ ![](images/72c08104c5d2ffc1ab91f210834a909ccc4020c306e77796c46c8c5d68c88a97.jpg)
211
+ Figure 3: $\omega$ -tunability with $\omega _ { i } = { \bf 1 } _ { \mathrm { i = K } }$ for various experiments. We plot the on the $\mathbf { X }$ -axis the number of the hyperparameter configuration searches, on the y-axis the appropriate performance on a log scale. Figures a-f: higher is better and g-i: lower is better.
212
+
213
+ Our study is certainly not exhaustive: We do not study the effect of the inclusion of a learning rate schedule, or using a different HPO algorithm on the results. However, their inclusion would result in a large increase the number of experiments, and constitutes our future work.
214
+
215
+ We hope that this paper encourages other researchers to conduct future studies on the performance of optimizers from a more holistic perspective, where the cost of the hyperparameter search is included.
216
+
217
+ # REFERENCES
218
+
219
+ Martín Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dandelion Mané, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viégas, Oriol Vinyals, Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL https://www.tensorflow.org/. Software available from tensorflow.org.
220
+
221
+ Hilal Asi and John C. Duchi. The importance of better models in stochastic optimization. Proceedings of the National Academy of Sciences, 2019a. ISSN 0027-8424. doi: 10.1073/pnas.1908018116. URL https://www.pnas.org/content/early/2019/10/29/1908018116.
222
+
223
+ Hilal Asi and John C Duchi. Stochastic (approximate) proximal point methods: Convergence, optimality, and adaptivity. SIAM Journal on Optimization, 29(3):2257–2290, 2019b.
224
+
225
+ James Bergstra and Yoshua Bengio. Random search for hyper-parameter optimization. Journal of Machine Learning Research, 13(Feb):281–305, 2012.
226
+
227
+ Jinghui Chen and Quanquan Gu. Closing the generalization gap of adaptive gradient methods in training deep neural networks. CoRR, abs/1806.06763, 2018. URL http://arxiv.org/ abs/1806.06763.
228
+
229
+ Dami Choi, Christopher J Shallue, Zachary Nado, Jaehoon Lee, Chris J Maddison, and George E Dahl. On empirical comparisons of optimizers for deep learning. arXiv preprint arXiv:1910.05446, 2019.
230
+
231
+ John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12(Jul):2121–2159, 2011.
232
+
233
+ Katharina Eggensperger, Marius Lindauer, and Frank Hutter. Pitfalls and best practices in algorithm configuration. Journal of Artificial Intelligence Research, 64:861–893, 2019.
234
+
235
+ Matthias Feurer and Frank Hutter. Hyperparameter Optimization, pp. 3–33. Springer International Publishing, Cham, 2019. ISBN 978-3-030-05318-5. doi: 10.1007/978-3-030-05318-5_1. URL https://doi.org/10.1007/978-3-030-05318-5_1.
236
+
237
+ 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.
238
+
239
+ Peter Henderson, Riashat Islam, Philip Bachman, Joelle Pineau, Doina Precup, and David Meger. Deep reinforcement learning that matters. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
240
+
241
+ Frank Hutter, Holger H Hoos, and Kevin Leyton-Brown. Identifying key algorithm parameters and instance features using forward selection. In International Conference on Learning and Intelligent Optimization, pp. 364–381. Springer, 2013.
242
+
243
+ Frank Hutter, Lars Kotthoff, and Joaquin Vanschoren. Automated machine learning-methods, systems, challenges, 2019.
244
+
245
+ Nitish Shirish Keskar and Richard Socher. Improving generalization performance by switching from adam to sgd. arXiv preprint arXiv:1712.07628, 2017.
246
+
247
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
248
+
249
+ Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id= Bkg6RiCqY7.
250
+
251
+ Mario Lucic, Karol Kurach, Marcin Michalski, Sylvain Gelly, and Olivier Bousquet. Are gans created equal? a large-scale study. In Advances in neural information processing systems, pp. 700–709, 2018.
252
+
253
+ Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts. Learning word vectors for sentiment analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pp. 142–150, Portland, Oregon, USA, June 2011. Association for Computational Linguistics. URL http: //www.aclweb.org/anthology/P11-1015.
254
+
255
+ Rafael Gomes Mantovani, Tomáš Horváth, Ricardo Cerri, Sylvio Barbon Junior, Joaquin Vanschoren, André Carlos Ponce de de Carvalho, and Leon Ferreira. An empirical study on hyperparameter tuning of decision trees. arXiv preprint arXiv:1812.02207, 2018.
256
+
257
+ Gábor Melis, Chris Dyer, and Phil Blunsom. On the state of the art of evaluation in neural language models. In International Conference on Learning Representations, 2018. URL https:// openreview.net/forum?id $=$ ByJHuTgA-.
258
+
259
+ Philipp Probst, Anne-Laure Boulesteix, and Bernd Bischl. Tunability: Importance of hyperparameters of machine learning algorithms. Journal of Machine Learning Research, 20(53):1–32, 2019. URL http://jmlr.org/papers/v20/18-444.html.
260
+
261
+ Herbert Robbins and Sutton Monro. A stochastic approximation method. The annals of mathematical statistics, pp. 400–407, 1951.
262
+
263
+ Frank Schneider, Lukas Balles, and Philipp Hennig. DeepOBS: A deep learning optimizer benchmark suite. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id ${ \underline { { \underline { { \mathbf { \Pi } } } } } } =$ rJg6ssC5Y7.
264
+
265
+ D. Sculley, Jasper Snoek, Alexander B. Wiltschko, and Ali Rahimi. Winner’s curse? on pace, progress, and empirical rigor. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Workshop Track Proceedings, 2018. URL https://openreview.net/forum?id ${ \underline { { \underline { { \mathbf { \Pi } } } } } } =$ rJWF0Fywf.
266
+
267
+ Vatsal Shah, Anastasios Kyrillidis, and Sujay Sanghavi. Minimum norm solutions do not always generalize well for over-parameterized problems. arXiv preprint arXiv:1811.07055, 2018.
268
+
269
+ Ilya Sutskever, James Martens, George Dahl, and Geoffrey Hinton. On the importance of initialization and momentum in deep learning. In Sanjoy Dasgupta and David McAllester (eds.), Proceedings of the 30th International Conference on Machine Learning, volume 28 of Proceedings of Machine Learning Research, pp. 1139–1147, Atlanta, Georgia, USA, 17–19 Jun 2013. PMLR. URL http://proceedings.mlr.press/v28/sutskever13.html.
270
+
271
+ T. Tieleman and G. Hinton. Lecture 6.5—RmsProp: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 2012.
272
+
273
+ Jan N van Rijn and Frank Hutter. Hyperparameter importance across datasets. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pp. 2367–2376. ACM, 2018.
274
+
275
+ Ashia C Wilson, Rebecca Roelofs, Mitchell Stern, Nati Srebro, and Benjamin Recht. The marginal value of adaptive gradient methods in machine learning. In Advances in Neural Information Processing Systems, pp. 4148–4158, 2017.
276
+
277
+ # A ARCHITECTURES OF THE MODELS USED IN EXPERIMENTS
278
+
279
+ Along with the architectures examined by Schneider et al. (2019), we experiment with an additional network and dataset. We included an additional network into our experimental setup, as DEEPOBS does not contain an word level LSTM model. Our model uses a 32-dimensional word embedding table and a single layer LSTM with memory cell size 128, the exact architecture is given in Table 6. We experiment with the IMDB sentiment classification dataset (Maas et al., 2011). The dataset contains 50, 000 movie reviews collected from movie rating website IMDB. The training set has 25, 000 reviews, each labeled as positive or negative. The rest 25, 000 form the test set. We split $2 0 \%$ of the training set to use as the development set. We refer the readers to DEEPOBS (Schneider et al., 2019) for the exact details of the other architectures used in this work.
280
+
281
+ Table 6: Architecture of the LSTM network used for IMDb experiments
282
+
283
+ <table><tr><td>Layer name</td><td>Description</td></tr><tr><td>Emb</td><td>Embedding Layer Vocabulary of 10000 [Embedding dimension: 32]</td></tr><tr><td>LSTM_1</td><td>LSTM Input size: 32 [Hidden dimension:128]</td></tr><tr><td>FC Layer</td><td>Linear(128 → 2)</td></tr><tr><td>Classifier</td><td>Softmax(2)</td></tr></table>
284
+
285
+ # B $\alpha$ - TUNABILITY
286
+
287
+ We provide additional methods to analyze tunability here. Let $p ( t )$ denote the best performance observed after using budget $t$ of hyperparameter optimization algorithm. We call an optimizer $\alpha$ -tunable $( \alpha \in [ 0 , 1 ] )$ at $t$ if $p ( t ) \geq \alpha \cdot p ( T )$ . Thus $\alpha$ −tunability is the ratio of number of times the neural network needs to be retrained with optimizer’s hyperparameters being provided by an automatic method, to the total budget $T$ (maximum number of configurations tested).
288
+
289
+ For each optimizer, we define its $\alpha$ -tunability $\zeta ( \alpha ) = \textstyle { \frac { t } { T } }$ for $\alpha \in \{ 0 . 9 , 0 . 9 5 , 0 . 9 9 \}$ . This metric provides an intuitive and simple quantification of how easy it is to tune an optimizer to reach requisite performance. We extend $\alpha$ –tunability to indicate the sharpness of the minima by computing the difference $\Delta = \zeta ( \alpha _ { 1 } ) - \zeta ( \alpha _ { 2 } )$ where $\alpha _ { 1 } > \alpha _ { 2 }$ and term it Sharpness. In our experiments, we choose $\alpha _ { 1 } = 0 . 9 9$ and $\alpha _ { 2 } = 0 . 9$ . Sharpness $( \Delta )$ is the relative time taken by the HPO to improve from $\alpha _ { 2 }$ to $\alpha _ { 1 }$ and thus quantifies the flatness of the minima in the space of hyperparameters. If the minima is sharper, then we expect random-search also takes a longer time to find it, thus the time required to go from $\alpha _ { 1 }$ and $\alpha _ { 2 }$ is higher. We provide Sharpness for our optimizers in table:7.
290
+
291
+ Table 7: Sharpness for various optimizers examined.
292
+
293
+ <table><tr><td></td><td>MNIST VAE</td><td>FMNIST2C2D</td><td>CIFAR100</td><td>CIFAR10</td><td>SVHN WRN</td><td>IMDBLSTM</td><td>FMNIST VAE</td><td>Quadratic Deep</td><td>Char RNN</td></tr><tr><td>Adagrad</td><td>92.0</td><td>99.0</td><td>63.0</td><td>95.0</td><td>10.0</td><td>97.0</td><td>91.0</td><td>66.0</td><td>95.0</td></tr><tr><td>Adam</td><td>80.0</td><td>98.0</td><td>40.0</td><td>91.0</td><td>71.0</td><td>93.0</td><td>90.0</td><td>75.0</td><td>87.0</td></tr><tr><td>Adam LR</td><td>83.0</td><td>96.0</td><td>71.0</td><td>94.0</td><td>98.0</td><td>70.0</td><td>95.0</td><td>93.0</td><td>97.0</td></tr><tr><td>SGD</td><td>98.0</td><td>95.0</td><td>35.0</td><td>93.0</td><td>98.0</td><td>81.0</td><td>94.0</td><td>6.0</td><td>47.0</td></tr><tr><td>SGDM</td><td>58.0</td><td>97.0</td><td>50.0</td><td>91.0</td><td>59.0</td><td>72.0</td><td>90.0</td><td>30.0</td><td>59.0</td></tr><tr><td>SGDMC</td><td>95.0</td><td>83.0</td><td>82.0</td><td>94.0</td><td>52.0</td><td>88.0</td><td>75.0</td><td>95.0</td><td>87.0</td></tr><tr><td>SGDMCWC</td><td>94.0</td><td>45.0</td><td>78.0</td><td>95.0</td><td>98.0</td><td>68.0</td><td>88.0</td><td>16.0</td><td>85.0</td></tr><tr><td>SGDMW</td><td>65.0</td><td>97.0</td><td>23.0</td><td>94.0</td><td>36.0</td><td>86.0</td><td>91.0</td><td>14.0</td><td>32.0</td></tr></table>
294
+
295
+ The above definition is not without faults. An optimizer’s $\alpha$ -tunability depends only on how fast it can get close to its own best performance, a pitfall it shares with Probst et al. (2019). That is, an optimizer that peaks at the performance of a random classifier may be considered well-tunable because it reaches its peak performance in the first iteration. It is apparent from tables 7 and 4 that the top performance does not imply lower sharpness. Take the case of IMDB Bi-LSTM, the lowest sharpness is for $\mathrm { S G D M ^ { C } W ^ { C } }$ , while the best performance is attained by AdamLR, implying that $\mathrm { S G D M ^ { C } W ^ { C } }$ settled to a minima faster which isn’t necessarily better than the one AdamLR found. In other terms, the flatness of the minima does not indicate how deep it is.
296
+
297
+ # C PERFORMANCE ANALYSIS
298
+
299
+ We show the full performance plots of all variants of SGD experimented with, in figures 5, 6, 7.
300
+
301
+ # D HOW LIKELY ARE WE TO FIND GOOD CONFIGURATIONS?
302
+
303
+ A natural question that arises is: given a budget $K$ , what is the best optimizer one can pick? In other words, for a given budget what is probability of each optimizer finding the best configuration? We answer this with a simple procedure. We repeat the runs of HPO for a budget $K$ , and collect the optimizer that gave the best result in each of those runs. Using the classical definition of probability, we compute the required quantity. We plot the computed probability in Figure 8. It is very evident for nearly all budgets, AdamLR is always the best option for 4 of the problems. SGD variants emerge to be better options for CIFAR-100 and Char-RNN at later stages of HPO. For some of the problems like VAEs, LSTM, it is very obvious that AdamLR is nearly always the best choice. Thus further strengthens our hypothesis that adaptive gradient methods are more tunable, especially in constrained HPO budget scenarios.
304
+
305
+ # E TUNABILITY BY COMPUTATION BUDGET
306
+
307
+ In our experiments so far, we defined tunability in terms of number of hyperparameter configurations. However, due to varying convergence speeds, different optimizers require varying amounts of time/epochs per configuration. We choose to work with number of epochs per configuration, as it is a hardware agnostic measure, but still indicates the relative time required. To incorporate epochs into our definition of tunability, we conduct the following analysis: For each dataset, we consider minimum total epochs for running all 100 trials across all optimizers, and consider it as the (virtual) maximum epoch budget $e _ { \mathrm { m a x } }$ , i.e., we disregard all trials after this point. We divide this maximum into $K = 1 0 0$ intervals $\begin{array} { r } { I _ { i } = \frac { e _ { \mathrm { m a x } } \cdot i } { K } , 1 \le i \le K } \end{array}$ . We modify the definition of $\omega$ -tunability from Section 2.2 as follows:
308
+
309
+ $\omega ^ { e p o c h }$ -tunability’s Definition. Let $( \mathbf { \boldsymbol { \theta } } _ { t } , \mathbf { \mathcal { L } } ( \mathbf { \boldsymbol { \theta } } _ { t } ) )$ be the incumbents (best performance attained till $t$ ) of the HPO algorithm at iteration $t$ , $e _ { t }$ be the total number of epochs required until iteration $t$ has finished. We define $\tilde { \mathcal { L } } _ { i } = \operatorname* { m a x } _ { e _ { t } \leq I _ { i } } \mathcal { L } _ { t }$ as the maximum performance among all configurations that have finished before interval $I _ { t }$ , where $\mathcal { L } _ { 0 } = e _ { 0 } = 0 .$ . For $w _ { i } > 0 \forall t$ and $\textstyle \sum _ { t } w _ { i } < \infty$ , we define $\omega ^ { e p o c h }$ -tunability as
310
+
311
+ $$
312
+ \omega ^ { e p o c h } \ – t u n a b i l i t y = \sum _ { i = 1 } ^ { K } \omega _ { i } \tilde { \mathcal { L } } _ { i }
313
+ $$
314
+
315
+ Please note that due to the case where no trial has finished before the first interval has concluded, we assign a performance of 0 for that task to that interval (bin). The above definition does not lend itself to VAE tasks, as an appropriate value there is $\infty$ . We, therefore, report the results for all classification problems in Table 8, where we use the same weighting schemes (CPE, CPU, and CPL) as before. To better understand the results, we also report the average number of epochs each configuration takes on average. Comparing the relative performances of optimizers to the results from Table 5, we can observe that considering $\omega ^ { e p o c h }$ yields to the same conclusions as before, and even amplifies Adam’s strengths: The performance gap to SGD variants widens in the cases where Adam(LR) was already better (FMNIST, IMDB, Char-RNN), and narrows considerably in the cases where an SGD variant was previously better (CIFAR-10, CIFAR-100, WRN-16). On CIFAR-100 and WRN-16, this even results in Adam outperforming the SGD variants slightly. Considering the average number of epochs, the results can easily be explained by the fact that the adaptive gradient methods tend to take less time to converge.
316
+
317
+ Table 8: $\omega ^ { e p o c h }$ -tunability performance of optimizers on the classification tasks for CPE, CPU, and CPL weighting schemes. We additionally provide the average number of epochs required by each optimizer for a single configuration.
318
+
319
+ <table><tr><td>Optimizer</td><td>CPE</td><td>CPU</td><td>CPL</td><td>Epochs</td></tr><tr><td>Adagrad</td><td>89.2</td><td>90.3</td><td>91.4</td><td>33.0</td></tr><tr><td>Adam</td><td>90.2</td><td>91.0</td><td>91.8</td><td>24.1</td></tr><tr><td>AdamLR</td><td>90.4</td><td>91.1</td><td>91.9</td><td>19.5</td></tr><tr><td>SGD</td><td>87.4</td><td>89.2</td><td>90.9</td><td>34.5</td></tr><tr><td>SGDM</td><td>88.1</td><td>89.6</td><td>91.1</td><td>33.6</td></tr><tr><td>SGDMC</td><td>88.6</td><td>89.8</td><td>91.0</td><td>28.2</td></tr><tr><td>SGDMCWC</td><td>89.1</td><td>90.1</td><td>91.1</td><td>27.4</td></tr><tr><td>SGDMW</td><td>88.0</td><td>89.5</td><td>91.0</td><td>32.4</td></tr></table>
320
+
321
+ <table><tr><td>Optimizer</td><td>CPE</td><td>CPU</td><td>CPL</td><td>Epochs</td></tr><tr><td>Adagrad</td><td>30.1</td><td>31.6</td><td>33.1</td><td>23.7</td></tr><tr><td>Adam</td><td>36.0</td><td>39.4</td><td>42.8</td><td>36.8</td></tr><tr><td>AdamLR</td><td>41.8</td><td>42.8</td><td>43.8</td><td>24.6</td></tr><tr><td>SGD</td><td>23.3</td><td>26.6</td><td>29.9</td><td>91.8</td></tr><tr><td>SGDM</td><td>30.5</td><td>34.7</td><td>39.0</td><td>80.6</td></tr><tr><td>SGDMC</td><td>36.9</td><td>39.8</td><td>42.7</td><td>68.7</td></tr><tr><td>SGDMCWC</td><td>34.1</td><td>36.8</td><td>39.4</td><td>71.7</td></tr><tr><td>SGDMW</td><td>21.5</td><td>25.6</td><td>29.7</td><td>102.3</td></tr></table>
322
+
323
+ 8.c: CIFAR 100. Higher the better
324
+
325
+ 8.a: FMNIST 2C2D. Higher is better
326
+ 8.b: CIFAR 10. Higher is better
327
+
328
+ <table><tr><td>Optimizer</td><td>CPE</td><td>CPU</td><td>CPL</td><td>Epochs</td></tr><tr><td>Adagrad</td><td>74.2</td><td>75.9</td><td>77.5</td><td>36.9</td></tr><tr><td>Adam</td><td>75.6</td><td>77.5</td><td>79.3</td><td>27.7</td></tr><tr><td>AdamLR</td><td>78.2</td><td>79.1</td><td>80.0</td><td>24.9</td></tr><tr><td>SGD</td><td>73.4</td><td>75.6</td><td>77.9</td><td>49.6</td></tr><tr><td>SGDM</td><td>74.3</td><td>76.5</td><td>78.8</td><td>46.9</td></tr><tr><td>SGDMC</td><td>75.6</td><td>77.6</td><td>79.6</td><td>44.4</td></tr><tr><td>SGDMCWC</td><td>78.2</td><td>79.9</td><td>81.7</td><td>47.6</td></tr><tr><td>SGDMW</td><td>75.5</td><td>78.1</td><td>80.6</td><td>52.4</td></tr></table>
329
+
330
+ <table><tr><td>Optimizer</td><td>CPE</td><td>CPU</td><td>CPL</td><td>Epochs</td></tr><tr><td>Adagrad</td><td>83.1</td><td>84.1</td><td>85.2</td><td>34.4</td></tr><tr><td>Adam</td><td>82.1</td><td>83.7</td><td>85.2</td><td>31.2</td></tr><tr><td>AdamLR</td><td>84.8</td><td>85.5</td><td>86.2</td><td>28.6</td></tr><tr><td>SGD</td><td>65.8</td><td>67.7</td><td>69.6</td><td>42.2</td></tr><tr><td>SGDM</td><td>72.2</td><td>74.5</td><td>76.9</td><td>37.2</td></tr><tr><td>SGDMC</td><td>77.9</td><td>79.3</td><td>80.8</td><td>32.3</td></tr><tr><td>SGDMCWC</td><td>71.3</td><td>75.0</td><td>78.6</td><td>109.7</td></tr><tr><td>SGDMW</td><td>64.6</td><td>69.6</td><td>74.6</td><td>119.0</td></tr></table>
331
+
332
+ 8.d: IMDB. Higher is better
333
+
334
+ <table><tr><td>Optimizer</td><td>CPE</td><td>CPU</td><td>CPL</td><td>Epochs</td></tr><tr><td>Adagrad</td><td>93.8</td><td>94.4</td><td>95.0</td><td>19.7</td></tr><tr><td>Adam</td><td>92.0</td><td>93.5</td><td>95.1</td><td>24.3</td></tr><tr><td>AdamLR</td><td>94.5</td><td>95.0</td><td>95.4</td><td>17.2</td></tr><tr><td>SGD</td><td>92.6</td><td>93.8</td><td>95.1</td><td>29.9</td></tr><tr><td>SGDM</td><td>91.9</td><td>93.6</td><td>95.3</td><td>29.2</td></tr><tr><td>SGDMC</td><td>93.3</td><td>94.2</td><td>95.2</td><td>26.0</td></tr><tr><td>SGDMCWC</td><td>92.5</td><td>94.0</td><td>95.4</td><td>31.8</td></tr><tr><td>SGDMW</td><td>91.6</td><td>93.4</td><td>95.3</td><td>33.5</td></tr></table>
335
+
336
+ 8.e: WRN-16(4). Higher is better
337
+
338
+ <table><tr><td>Optimizer</td><td>CPE</td><td>CPU</td><td>CPL Epochs</td></tr><tr><td>Adagrad</td><td>54.5</td><td>55.5</td><td>56.6 166.6</td></tr><tr><td>Adam</td><td>53.7</td><td>55.3</td><td>57.0 131.0</td></tr><tr><td>AdamLR</td><td>55.9</td><td>56.7</td><td>57.4 170.9</td></tr><tr><td>SGD</td><td>38.1</td><td>40.8</td><td>43.4 183.2</td></tr><tr><td>SGDM</td><td>48.5</td><td>51.8</td><td>55.2 188.3</td></tr><tr><td>SGDMC</td><td>53.3</td><td>55.6</td><td>58.0 194.5</td></tr><tr><td>SGDMCWC</td><td>51.7</td><td>54.2</td><td>56.6 197.3</td></tr><tr><td>SGDMW</td><td>42.2</td><td>45.6</td><td>49.1 184.0</td></tr></table>
339
+
340
+ 8.f: Char-RNN. Higher is better
341
+
342
+ ![](images/1638032d7d15d84e395e0faa09da5b7438cc54ad9d1aeb688caa6a26c9879864.jpg)
343
+ Figure 4: Performance analysis of various experiments. We plot the on the $\mathbf { X }$ -axis the number of the hyperparameter configuration searches, on the y-axis the appropriate performance.
344
+ 4.a: CIFAR-10 evolution
345
+
346
+ ![](images/84dcfcf92124dfc11105f29ebc9b20accf8298aebe9565b74e6f5a71ac46bc85.jpg)
347
+ 4.b: CIFAR-100 evolution
348
+
349
+ ![](images/b57494dc15a0b20c175961de79e9089054bc521b0b7fe4af1900ef95ac8bff49.jpg)
350
+ Figure 5: Performance analysis of various experiments. We plot the on the $\mathbf { X } ^ { } -$ -axis the number of the hyperparameter configuration searches, on the y-axis the appropriate performance on a log scale
351
+
352
+ ![](images/6fc13ff033e20baef240f395612d759fafce569eab04436ea8f39c39121c080b.jpg)
353
+ 6.a: Bi-LSTM evolution
354
+
355
+ ![](images/108350007f0e2d6fee04b87a5a958acacad0e5df60ea42e53d3cdf68e741896f.jpg)
356
+ 6.c: Tolstoi Char-RNN evolution
357
+ Figure 6: Performance analysis of various experiments. We plot the on the $\mathbf { X }$ -axis the number of the hyperparameter configuration searches, on the y-axis the appropriate performance on a log scale
358
+
359
+ ![](images/31d69d1c9650e9afbef7b1ae9e0ddd3bb8cebab8351627a42fc678cf71fc52e5.jpg)
360
+
361
+ ![](images/d4a03ff2add522127f868a9ad798425c2e1eac934abf07a87607853110ed674c.jpg)
362
+ 7.a: MNIST-VAE evolution
363
+
364
+ ![](images/94fc6587ea0272557615517ed8879a09bd2ef787bc3d6f9306e31029aaba6363.jpg)
365
+ 7.b: MNIST-VAE evolution
366
+ 7.c: Quadratic deep evolution
367
+
368
+ Figure 7: Performance analysis of various experiments. We plot the on the $\mathbf { X }$ -axis the number of the hyperparameter configuration searches, on the y-axis the appropriate performance on a log scale
369
+
370
+ ![](images/f40a5ba4ff8ec878621de75cb452f9ebfd5499757561a53052e0f6724f2eecc7.jpg)
371
+ Figure 8: Which optimizer for which budget? Given a tuning budget $K$ $\scriptstyle { \dot { x } }$ -axis), the stacked area plots above show how likely each optimizer (colored bands) is to yield the best result after $K$ steps of hyperparameter optimization. For example, for the IMDB LSTM problem, for a small budget, ‘AdamLR’ is the best choice (with $\sim 0 . 8$ probability), whereas for a larger search budget $> 5 0$ , tuning the additional parameters of ‘Adam’ is likely to pay off.
md/train/H1gR5iR5FX/H1gR5iR5FX.md ADDED
@@ -0,0 +1,406 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ANALYSING MATHEMATICAL REASONING ABILITIES OF NEURAL MODELS
2
+
3
+ David Saxton
4
+ DeepMind
5
+ saxton@google.com
6
+
7
+ Edward Grefenstette DeepMind egrefen@fb.com
8
+
9
+ Felix Hill
10
+ DeepMind
11
+ felixhill@google.com
12
+ Pushmeet Kohli
13
+ DeepMind
14
+ pushmeet@google.com
15
+
16
+ # ABSTRACT
17
+
18
+ Mathematical reasoning—a core ability within human intelligence—presents some unique challenges as a domain: we do not come to understand and solve mathematical problems primarily on the back of experience and evidence, but on the basis of inferring, learning, and exploiting laws, axioms, and symbol manipulation rules. In this paper, we present a new challenge for the evaluation (and eventually the design) of neural architectures and similar system, developing a task suite of mathematics problems involving sequential questions and answers in a free-form textual input/output format. The structured nature of the mathematics domain, covering arithmetic, algebra, probability and calculus, enables the construction of training and test splits designed to clearly illuminate the capabilities and failure-modes of different architectures, as well as evaluate their ability to compose and relate knowledge and learned processes. Having described the data generation process and its potential future expansions, we conduct a comprehensive analysis of models from two broad classes of the most powerful sequence-to-sequence architectures and find notable differences in their ability to resolve mathematical problems and generalize their knowledge.
19
+
20
+ # 1 INTRODUCTION
21
+
22
+ Deep learning, powered by convolutional and recurrent networks, has had remarkable success in areas involving pattern matching (such as in images (Krizhevsky et al., 2012), machine translation (Bahdanau et al., 2014; Vaswani et al., 2017), and reinforcement learning (Mnih et al., 2015; Silver et al., 2016)). However, deep models are far from achieving the robustness and flexibility exhibited by humans. They are limited in their ability to generalize beyond the environments they have experienced and are extremely brittle in the presence of adversarially constructed inputs (Szegedy et al., 2013).
23
+
24
+ One area where human intelligence still differs and excels compared to neural models is discrete compositional reasoning about objects and entities, that “algebraically generalize” (Marcus, 2003). Our ability to generalise within this domain is complex, multi-faceted, and patently different from the sorts of generalisations that permit us to, for example, translate new sentence of French into English. For example, consider the following question from mathematics, with answer " $- 7 0 x - 1 6 5 "$ .
25
+
26
+ What is $g ( h ( f ( x ) ) )$ , where $f ( x ) = 2 x + 3$ , $g ( x ) = 7 x - 4$ , and $h ( x ) = - 5 x - 8 ?$
27
+
28
+ To solve this problem, humans use a variety of cognitive skills:
29
+
30
+ • Parsing the characters into entities such as numbers, arithmetic operators, variables (which together form functions) and words (determining the question).
31
+ • Planning (for example, identifying the functions in the correct order to compose).
32
+ • Using sub-algorithms for function composition (addition, multiplication).
33
+ • Exploiting working memory to store intermediate values (such as the composition $h ( f ( x ) ) )$ .
34
+
35
+ • Generally applying acquired knowledge of rules, transformations, processes, and axioms.
36
+
37
+ In this paper, we introduce a dataset consisting of many different types of mathematics problems, with the motivation that it should be harder for a model to do well across a range of problem types (including generalization, which we detail below) without possessing at least some part of these abilities that allow for algebraic generalization.
38
+
39
+ This domain is an important one for the analysis of neural architectures in general. In addition to providing a wide range of questions, there are several other advantages: Mathematics offers a self-consistent universe; notation is the same across different problem types, which allows for an easily extendable dataset; and rules and methods learnt on one problem type often apply elsewhere. Addition of numbers (for example) obeys the same rules everywhere, and occurs as a “subroutine" in other problems (such as concretely in multiplication, and both concretely and more abstractly in addition of polynomials); models that possess the ability to transfer knowledge will do well on the dataset (and knowledge transfer may be a necessity for solving harder problems).
40
+
41
+ Mathematics is also an interesting domain in its own right; although models solving the mostly school-level problems in this dataset would not themselves have applications, they may lead on to more powerful models that can solve interesting and substantial new mathematical problems. But more generally, it is no coincidence that experiments seeking to validate new architectures which aim capture algorithmic/systematic reasoning have often been drawn from this domain (Graves et al., 2016; Kaiser & Sutskever, 2015; Joulin & Mikolov, 2015), and thus in providing a large scale training and evaluation framework for such models, we hope to provide a solid foundation upon which to continue such research into machine reasoning beyond mathematics.
42
+
43
+ Question: Solve $- 4 2 \star \Upsilon + 2 7 \star \subset = - 1 1 6 7$ and $1 3 0 \star \tt { r } + 4 \star \tt { C } = 3 7 2$ for r. Answer: 4
44
+ Question: Calculate $- 8 4 1 8 8 0 1 4 2 . 5 4 4 + 4 1 1 1 2 7 .$ .
45
+ Answer: $- 8 4 1 4 6 9 0 1 5 . 5 4 4$
46
+ Question: Let $\begin{array} { c c c c c } { { \mathrm { \bf ~ x ~ ( \mit g ) } } } & { { = } } & { { 9 \star \mathrm { \bf g } } } & { { + } } & { { 1 } } \end{array}$ . Let $\begin{array} { c c c c } { { \sf q _ { \tau } ( c ) } } & { { = } } & { { 2 \star { \sf c } } } & { { + } } & { { 1 } } \end{array}$ . Let $\begin{array} { r l r } { \pounds \left( \mathrm { ~ i ~ } \right) } & { { } = } & { 3 \star \mathrm { i } } \end{array}$ - 39. Let w( $\begin{array}{c} \begin{array} { r l r } { \dot { { \bf \Xi } } } \end{array} \mathrm { ~ ~ \cdot ~ } \dot { { \bf \Xi } } ) & { { } = \mathrm { ~ ~ q ~ } ( { \bf \Xi } { \bf x } \left( \dot { { \bf \Xi } } \right) ) } \end{array}$ . Calculate f(w(a)).
47
+ Answer: $5 4 \star \mathsf { a } \mathrm { ~ \ - ~ } \ 3 0$
48
+ Question: Let $\Theta \left( \frac { } { } 1 \right) \ = \ \begin{array} { c c c c } { { 1 } } & { { - } } & { { 6 } } & { { } } \end{array}$ . Is 2 a factor of both e(9) and 2?
49
+ Answer: False
50
+ Question: Let $u ( n ) = - n + 3 - n + \pm 2$ . Let $e ( C ) = - 2 \star C \star \star 3 + C$ . Let l(j) $= - 1 1 8 { \star } \mathsf { e }$ (j) $+ ~ 5 4 { \star } \sqcup$ (j). What is the derivative of l(a)?
51
+ Answer: $5 4 6 \star a \star \star 2 - 1 0 8 \star a - 1 1 8$
52
+ Question: Three letters picked without replacement from qqqkkklkqkkk. Give prob of sequence qql.
53
+ Answer: 1/110
54
+
55
+ # 1.1 OUR CONTRIBUTIONS
56
+
57
+ Dataset and generalization tests We release1 a sequence-to-sequence dataset consisting of many different types of mathematics questions (see Figure 1) for measuring mathematical reasoning, with the provision of both generation code and pre-generated questions. The dataset comes with two sets of tests: interpolation tests, one for each type of question occurring in the training set; and extrapolation tests, that measure generalization along various axes of difficulty to beyond that seen during training. We include extrapolation tests as an additional measure of whether models are employing abilities that allow them to algebraically generalize.
58
+
59
+ Experiments and model analysis We perform an experimental evaluation to investigate the algebraic abilities of state-of-the-art neural architectures, and show that they do well on some types of questions, but certainly not all, and furthermore have only moderate amounts of generalization. We give some insights into how they learn to answer mathematics questions, and their failure modes.
60
+
61
+ # 1.2 RELATED WORK
62
+
63
+ There are various papers with datasets with a discrete reasoning nature. Kaiser & Sutskever (2015) use an adapted convolutional architecture to solve addition and multiplication with good generalization; Allamanis et al. (2016) and Evans et al. (2018) use tree networks to predict polynomial or logical equivalence or logical entailment; Selsam et al. (2018) uses message passing networks with a bipartite graph structure to decide satisfiability in formulas in conjunctive normal form, and so on. The difference between those problems and the dataset in this paper is that the former all have a single well-defined input structure that can be easily mapped into narrow architectures suited to the problem structure, avoiding the need for general reasoning skills like parsing or generic working memory.
64
+
65
+ Zaremba & Sutskever (2014) analyze the ability of LSTMs to map short Python programs (addition or for-loops) to their output. Some mathematics problems are of a similar imperative nature (e.g. arithmetic), but we also cover many other types of problems, so our dataset subsumes learning-to-execute. There are a few other synthetically generated datasets designed to assess reasoning of some form. The bAbI dataset of Weston et al. (2015) consists of textual questions, testing the ability to extract knowledge from a story-like sequence of questions. The CLEVR dataset of Johnson et al. (2017) consists of image-question pairs, where the image is of a set of objects, and the question asks for some property of the scene; this dataset is designed to assess visual analysis. Santoro et al. (2018b) use Raven’s progressive matrix puzzles to measure abstract reasoning of networks.
66
+
67
+ There has also been a recent interest in solving algebraic word problems. These questions tend to be crowd sourced or obtained from exercise books, and existing datasets include Allen Institute for AI (2014); Kushman et al. (2014); Huang et al. (2016); Upadhyay & Chang (2016); Wang et al. (2017); Ling et al. (2017). These range in size from hundreds to up to one hundred thousand examples, with different variations and focuses; for example, containing supervised “answer rationale", or focusing on more narrow types of problems, or additionally containing geometry problems (although some of these are too small to train deep learning models without extensive prior mathematical knowledge). Our dataset differs from these in that our focus is mathematical reasoning rather than linguistic comprehension; we cover more areas of mathematics, but with less variation in problem specification, and we see mathematical reasoning as a partially orthogonal and complementary direction to linguistic understanding existing in these other datasets.
68
+
69
+ # 2 THE DATASET
70
+
71
+ # 2.1 DESIGN CHOICES
72
+
73
+ Modular structure and procedural generation There are two choices for obtaining mathematical questions: either crowd-sourced, or synthetically generated. While crowd-sourcing has the advantage of introducing linguistic diversity, as well as a diversity of problem types, it is difficult to collect and validate such data at scale. In contrast, procedural generation is sufficient for our purposes in most respects: it (1) easily provides a larger number of training examples, with (2) precise controls over difficulty levels, permitting (3) analysis of performance by question type, and (4) better guarantees on question correctness, with (5) potential for more efficient model training by varying the time spent on each module, and (6) ease of testing generalization (since one can precisely vary different axes of difficulty in different question types).
74
+
75
+ Freeform question/answers Given that we synthetically generate the data, we could of course provide the questions as parsed into some structure appropriate for each question type (e.g. a tree or graph). However, we opt for freeform—as a sequence of characters—because (1) it is a powerful and flexible format, allowing us to express many question types (whereas trees or graphs are only appropriate for some problems), (2) the ability to properly semantically parse is a non-negligible part of cognition, and (3) sequences are much simpler objects than graphs and trees, which simplifies development of the dataset and models.
76
+
77
+ Perhaps most importantly, using freeform inputs and outputs means that the input and output space for models evaluated on the benchmark tasks in this dataset is the same as required to address a variety of “real world” mathematics exams questions. While it is not plausible that models trained on our data would perform well on such actual tests due to restricted linguistic variation in how questions and answers are formulated, it is nonetheless a desirable feature of our data that future models which do attack real world tests can be “unit tested” on our benchmarks during their development.
78
+
79
+ Compositionality The questions can be seen as mappings with input and output types. For example, function evaluation maps a function and an integer to another integer, function composition maps a pair of functions to a function, and so on. We use this to generate additional composed questions by chaining modules with matching types, where intermediate values from one sub-problem are used as inputs to the next sub-problem. For example, for a single intermediate value, this composition may be phrased as Let $\mathrm { ~ ~ x ~ } = \mathrm { ~ ~ < ~ }$ description>. <question $( \mathbf { x } ) >$ . See Figure 1 for examples. This makes the dataset more interesting and challenging in several ways. Many rules in mathematics appear when different concepts are composed. For example, when differentiation is composed with function composition, the chain rule appears; when addition is composed with factorization, distributivity can emerge; and so on. Composition moves the questions away from pure perception, since intermediate results must be stored (working memory) and manipulated (reuse of sub-routines).
80
+
81
+ # 2.2 BRIEF OVERVIEW OF MODULES
82
+
83
+ What types of mathematics problems should be included in the dataset? The original content was based on a national school mathematics curriculum (up to age 16), restricted to textual questions (thus excluding geometry questions), which gave a comprehensive range of mathematics topics that worked together as part of a learning curriculum. We extended this with additional areas that offer good tests for algebraic reasoning. We cover the following areas (Appendix B contains the full list of modules). (1) Algebra, such as solving linear systems in 1 and 2 variables, finding roots of polynomials (presented in simplified or unsimplified forms), and extending sequences and finding their general form. (2) Arithmetic, such as basic addition etc, evaluating nested expressions, and simplifying expressions involving square roots. (3) Calculus and differentiating polynomials. (4) Comparisons, such as establishing which of two numbers is bigger, or sorting a list of numbers, or finding the closest number to a given one in a list. (5) Measurement, such as converting between different length scales, and calculating time intervals. (6) Numbers, such as finding divisors, rounding, place value, factorization, and primality. (7) Manipulating polynomials, such as simplification, expansion, evaluation, composition, and addition. (8) Probability, such as probability of obtaining a given sequence when sampling without replacement. Many modules participate in composition where possible. For example, one might have to compare two numbers (a composition module), one of which is the solution of a linear system, and the other is the evaluation of a function.
84
+
85
+ # 2.3 GENERATING DIVERSE QUESTIONS FOR TRAINING AND TESTING
86
+
87
+ Most questions involve evaluating one or more randomly generated mathematical objects (e.g. arithmetic expressions, linear systems, polynomials, compositions of these, etc). The biggest challenge in producing the dataset is generating diverse questions that are neither trivial nor impossibly hard. During testing we also want to generate questions that have not been seen in training.
88
+
89
+ These requirements rule-out naive unconditional sampling of such objects. For example, the product of a sequence of rationals will evaluate to zero if any of the rationals are zero; an arithmetic expression generated by randomly sampling a binary tree will often evaluate to zero or some large number; and a linear system in two variables will rarely have integer solutions. So instead for most modules we employ a different approach: we first sample the answer, and then work backwards to generate the question (including if we are doing module composition). The details of how we do this are diverse and depend on the question type, and we refer the reader to the generation code for more detail.
90
+
91
+ Training and interpolation tests Per module, we generate $2 \times 1 0 ^ { 6 }$ train questions, and $1 0 ^ { 5 }$ test (interpolation) questions. To ensure the train questions are diverse, and the test questions are distinct from the train questions, the generation code guarantees lower bounds on the probability of a given question appearing. (Post-generation hashing does not in general work, since the same question may occur with linguistic variation, although we use it in a few limited cases.) We generate test questions such that any particular question has a probability of at most $1 0 ^ { - 8 }$ , thus guaranteeing that at most $1 0 ^ { - 8 } \times 2 \times \mathrm { \dot { 1 } 0 ^ { 6 } } = 2 \%$ of the test questions to have already appeared in the training data. (To be more precise, each module generator accepts an input $\alpha$ , such that the output question has probability at most $1 0 ^ { - \alpha }$ ; train questions are generated by sampling $\alpha$ uniformly from [3, 10] (typically), and test questions are generated by taking $\alpha = 8 .$ )
92
+
93
+ The various mechanisms by which we achieve these probabilistic guarantees are again diverse and question dependent, so again we refer the reader to the generation code. But to give an example, many questions involve one or more integers (which includes rationals, a quotient of two integers). If we need to generate $n$ integers, then provided the $i$ th integer is sampled from a set of size at least $a _ { i }$ , then the probability of a given sequence of integers is at most $\bar { \Pi } _ { i } 1 / a _ { i }$ . We then simply need to choose these sets of integers appropriately (e.g. a symmetric set about zero, or the first positive integers, or integers coprime to some other integer, etc).
94
+
95
+ Extrapolation tests Mathematical generalization exists along a variety of axes (e.g. length, number of symbols, depth of composition/recursion). We therefore include, in our extrapolation test sets, a range of modules that measure extrapolation along different axes, such as to problems involving larger numbers, more numbers, more compositions, and (for probability questions) larger samplers. Full details are in Appendix B.
96
+
97
+ # 2.4 EVALUATION CRITERION
98
+
99
+ Given a model that maps an input question to an output answer, we score each question either 0 or 1 according to whether the answer matches the correct answer character-for-character. The performance on a given test module is the average of this score across all questions. Performance across the interpolation and extrapolation test sets is then the average across all modules inside the test set. This choice of criterion is appropriate given the restricted nature of the answers generated in our dataset (but see Section 5 for possible future extensions).
100
+
101
+ # 2.5 RELEASE
102
+
103
+ We will release $2 \times 1 0 ^ { 6 }$ training examples and $1 0 ^ { 4 }$ pre-generated test examples per module upon publication of this paper. In the dataset, the questions and answers use a common alphabet of size 95 (upper and lower case characters, digits, and punctuation characters). The questions are capped to 160 characters in length and answers to 30, which is sufficient for a wide range of question types. Mathematical equations are formatted according to Python/SymPy (Meurer et al., 2017) conventions (for example, $\star \star$ is used for power rather than ˆ); these rules are consistent for all modules.
104
+
105
+ # 3 MODELS EXAMINED
106
+
107
+ Due to the construction process underlying this dataset, there are a large number of existing models, which could be adapted, purpose-built, or tailored to solve the sort of problems we present here, especially with the help of symbolic solvers or computer algebra systems. Setting aside the possible brittleness or limits in scalability of traditional symbolic approaches as the complexity or linguistic diversity of questions and answers grows, we are interested here in evaluating general purpose models, rather than ones with their mathematics knowledge already inbuilt. What makes such models (which are invariably neural architectures) so ubiquitous from translation to parsing via image captioning is the lack of bias these function approximators present due to having relatively little (or no) domain-specific knowledge encoded in their design. Although there are some neural network-driven approaches with direct access to mathematical operations (such as addition or multiplication (Ling et al., 2017), or more complex mathematical templates like in (Kushman et al., 2014)), which would undoubtedly perform competitively on the tasks we present in this paper, we will limit ourselves to general sequence-processing architectures which are used in other non-mathematical tasks to present the most general baselines possible for future comparison.
108
+
109
+ We investigate two (broad classes of) models that have demonstrated themselves to be state-of-the-art on sequence-to-sequence problems: recurrent neural architectures, and the more recently introduced attentional/transformer (Vaswani et al., 2017) architecture. We also tried to use Differentiable Neural Computers (Graves et al., 2016), which is a recurrent model with an “external memory” (whose size is independent of the number of parameters in the network). In theory this could be well suited for solving mathematical questions, since it can store intermediate values for later usage. However we were unable to get decent performance out of it. (Even with hyperparameter sweeps for the number and size of memory slots, etc, we were only able to get to $10 \%$ validation performance after a day of training, whereas most models obtain this in less than an hour).
110
+
111
+ ![](images/f23d6f69a16b604b94a0a186316698e9b77ca84f4505c05b7f9b64a81f46b536.jpg)
112
+ Figure 2: The attentional LSTM and Transformer architectures are both consist of an encoder, that parses the question, and a decoder, which maps the correct answer right-shifted by 1 to a distribution of the next character in the answer at every position (thus allowing auto-regressive prediction). (a) The Attentional LSTM encodes the question to a sequence of (key, value) positions, which are then attended over by the decoder. (b) The Transformer has several stages of self- and input-attention; see (Vaswani et al., 2017) for details.
113
+
114
+ # 3.1 RECURRENT ARCHITECTURES
115
+
116
+ The LSTM (Hochreiter & Schmidhuber, 1997) is a powerful building block of sequence-to-sequence models that have achieved state of the art results in many domains, and despite its simplicity, continues to be a central building block for recurrent neural networks. We benchmark two standard recurrent architectures (described in more detail in Appendix A).
117
+
118
+ The first and simplest model we analyze (referred to in results below as “Simple LSTM”) is to simply feed the question into the LSTM, one character at a time (using a 1-hot encoding), before outputting the answer one character at a time (the output is a distribution over possible characters, and at every answer step, the previous correct answer character is fed in). In the results below, we use a hidden size of 2048 (obtained via a hyperparameter sweep).
119
+
120
+ The second model we analyze (referred to as “Attentional LSTM”) is the encoder/decoder-withattention architecture introduced in (Bahdanau et al., 2014) which has been prevalent in neural machine translation, and overcomes two problems with the simple LSTM model above, which affect both language translation and mathematical question-answering: (1) information that is presented in the input may be out-of-order for the purpose of calculations required for the output (for example, to calculate $\bar { 8 } / ( 1 + 3 )$ , the expression $1 + 3$ must be evaluated first); and (2) all information for the answer must be contained within the single vector of cell activations of the LSTM, which is a bottleneck. The attentional LSTM architecture consists of a recurrent encoder that encodes the question to a sequence of keys and values (of the same length as the question), and a recurrent decoder that has as input the correct answer right-shifted by 1, and at every time step attends to the encoded question, and outputs a distribution over the next character. We use an encoding LSTM with 512 hidden units and a decoding LSTM with 2048 hidden units. (These settings were obtained using a hyperparameter sweep.)
121
+
122
+ In both these architecture, we also employ a simple change that improves performance. The models as described must output the answer straight after parsing the question. However, it may be necessary for the models to expend several computation steps integrating information from the question. To allow for this, we add additional steps (with zero input) before outputting the answer. We also experimented with Adaptive Computation Time as introduced in (Graves, 2016), although this yielded worse results than simply having a fixed number of “thinking” steps.
123
+
124
+ Recently a recurrent architecture known as relational recurrent neural network (Santoro et al., 2018a), or relational memory core (RMC), has been developed as a replacement for the LSTM. This recurrent unit has multiple memory slots that interact via attention. This seems like a natural candidate for mathematical reasoning, for example if the model can learn to use the slots to store mathematical entities. However, a comprehensive hyperparameter sweep gave the best setting as 1 memory slot (i.e., without making full use of the RMC). We include these results below, also with 2048 total units, 16 attention heads, and 1 block.
125
+
126
+ Figure 3: Model accuracy (probability of correct answer) averaged across modules. RMC is the relational recurrent neural network model.
127
+
128
+ <table><tr><td></td><td>Parameters</td><td>Interpolation</td><td>Extrapolation</td></tr><tr><td>Simple LSTM</td><td>18M</td><td>0.57</td><td>0.41</td></tr><tr><td>Simple RMC</td><td>38M</td><td>0.53</td><td>0.38</td></tr><tr><td>Attentional LSTM,LSTM encoder</td><td>24M</td><td>0.57</td><td>0.38</td></tr><tr><td>Attentional LSTM, bidir LSTM encoder</td><td>26M</td><td>0.58</td><td>0.42</td></tr><tr><td>AttentionalRMC,bidirLSTM encoder</td><td>39M</td><td>0.54</td><td>0.43</td></tr><tr><td>Transformer</td><td>30M</td><td>0.76</td><td>0.50</td></tr></table>
129
+
130
+ # 3.2 TRANSFORMER (ATTENTION IS ALL YOU NEED)
131
+
132
+ The Transformer model (Vaswani et al., 2017) is a sequence-to-sequence model achieving stateof-the-art results in machine translation. We briefly describe it here (see Figure 2b). The model consists of an encoder, which transforms the question (represented as a sequence of vectors) to another sequence of the same length, and a decoder (which transforms the encoded question, and the answer autoregressively shifted right, into the answer prediction). Internally the input is transformed via attentional mechanisms (both self- and input-attention), and position-wise fully connected layers. We use an embedding size of $d _ { \mathrm { m o d e l } } = 5 1 2$ , with $h = 8$ attentional heads, and thus key and value sizes of $d _ { k } = d _ { v } = \bar { d } _ { \mathrm { m o d e l } } / h = 6 4$ . Each layer has an intermediate representation with dimension $d _ { \mathrm { f f } } = 2 0 4 8$ . For translation tasks, it is typically applied to sequences of embedded words; here we instead treat the question and answer as a sequence of characters, since we need to be able to embed arbitrary mathematical expressions.
133
+
134
+ # 4 ANALYSIS
135
+
136
+ # 4.1 TRAINING AND EVALUATION METHODS
137
+
138
+ As is common in sequence-to-sequence models, the models predict the answer autoregressively using a greedy decoder (output majority class at each step). We minimize the sum of log probabilities of the correct character via the Adam optimizer (Kingma & Ba, 2014) with learning rate of $6 \times 1 0 ^ { - 4 }$ , $\beta _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 9 5$ , $\epsilon = 1 0 ^ { - 9 }$ . We use a batch size of 1024 split across 8 NVIDIA P100 GPUs for 500k batches, with absolute gradient value clipping of 0.1.
139
+
140
+ # 4.2 RESULTS AND INSIGHTS
141
+
142
+ Figure 3 shows the average interpolation and extrapolation performances for the different architectures.
143
+ Full per-module performance results are in Appendix C.
144
+
145
+ LSTMs vs RMCs Using a RMC with more than one memory slot did not help performance; perhaps it is hard for the RMC to learn to use slots for manipulating mathematical entities. For a given number of hidden units, RMCs were more data efficient but trained more slowly (since they had more parameters), and LSTMs had better asymptotic performance.
146
+
147
+ Simple vs attentional LSTM The attentional LSTM and the simple LSTM have similar performance. One might suspect that the attentional LSTM does nothing, however this is not the case, since a simple LSTM model of the same size as the parsing LSTM obtains much worse performance. We speculate that the attentional model is not learning to algorithmically parse the question, and so the ability to change attention focus per-step does not count for as much.
148
+
149
+ Number of thinking steps For the attentional LSTM model, we observed that increasing the number of “thinking” steps (as defined above) from 0 up to 16 increased the performance.
150
+
151
+ Transformer vs best non-transformer model The Transformer performs the same as or significantly better than recurrent models across nearly all modules. Both architectures have a comparable number of parameters. One might a-priori expect the LSTM to perform better, since its sequential architecture is perhaps more similar to sequential reasoning steps that a human performs. However, evidence above and below suggest that neither of the networks are doing much “algorithmic reasoning”, and the Transformer has various advantages over LSTM architectures, such as (1) doing more calculations with the same number of parameters, (2) having a shallower architecture (with better gradient propagation), and (3) having an internal "memory" that is sequential, which is more pre-disposed to mathematical objects like sequences of digits.
152
+
153
+ Easiest maths for neural networks The easiest question types were finding the place value in a number, and rounding decimals and integers, which all models got nearly perfect scores on. Questions involving comparisons also tended to be quite easy, possible because such tasks are quite perceptual (e.g. comparing lengths or individual digits). This success includes questions with module composition, for example Let $\begin{array} { r c l } { \mathrm { ~ k ~ } ( \mathrm { ~ c ~ } ) } & { = } & { - 6 1 1 \star \mathrm { c ~ \ } + \ 2 1 8 8 8 5 7 } \end{array}$ . Is $\mathrm { ~ k ~ } ( - 1 0 3 )$ $\ ! = \ 2 2 5 1 7 9 0 ?$ (False) and mixtures of decimals and rationals, for example, Sort $- 1 3 9 / 4$ , 40.8, -555, 607 in increasing order. Overall it seems that magnitude is easy for neural networks to learn.
154
+
155
+ Hardest maths for neural networks Perhaps not surprisingly, some of the hardest modules include more number-theoretic questions which are also hard for humans, such as detecting primality and factorization. The Transformer model still gives plausible-looking answers, such as factoring 235232673 as 3, 11, 13, 19, 23, 1487 (the correct answer is 3, 13, 19, 317453).
156
+
157
+ The Transformer model has a performance of $90 \%$ or more on the “add or subtract several numbers" module and the “multiply or divide several numbers" module (which is just addition and subtraction in log space). However on the mixed arithmetic module (mixing all four operations together with parentheses), the performance drops to around $50 \%$ . (Note the distribution of the value of the expression is the same for all these modules, so it is not the case that difficulty increases due to different answer magnitudes.) We speculate that the difference between these modules in that the former can be computed in a relatively linear/shallow/parallel manner (so that the solution method is relatively easier to discover via gradient descent), whereas there are no shortcuts to evaluating mixed arithmetic expressions with parentheses, where intermediate values need to be calculated. This is evidence that the models do not learn to do any algebraic/algorithmic manipulation of values, and are instead learning relatively shallow tricks to obtain good answers on many of the modules. The same holds true for other modules that require intermediate value calculation, such as evaluating polynomials, and general composition.
158
+
159
+ Performance on polynomial manipulation One notable difference between the Transformer and the recurrent models was polynomial manipulation. The Transformer did significantly better on polynomial expansion, collecting terms, addition, composition, differentiation, and extracting named coefficients. Speculatively, the parallel sequential nature of the Transformer is better at manipulating polynomials where several coefficients must be kept in memory simultaneously where they can interact.
160
+
161
+ Other insights Examining the performance on adding multiple integers, we tested the models on adding $1 + 1 + \cdots + 1$ , where 1 occurs $n$ times. Both the LSTM and Transformer models gave the correct answer for $n \leq 6$ , but the incorrect answer of 6 for $n = 7$ (seemingly missing one of the 1s), and other incorrect values for $n > 7$ . (The models are trained on sequences of random integers up to length 10, and are capable of giving the correct answer on longer sequences of far bigger numbers, for example $- 3 4 ~ + ~ 5 3 ~ + ~ - 9 3 6 ~ + ~ - 2 9 7 ~ + ~ 1 6 2 ~ + ~ - 2 4 2 ~ + ~ - 1 2 8 . )$ We do not have a good explanation for this behaviour; one hypothesis is that the models calculate subsums and then combine these, but rely on different input numbers to align the subsums, and fail when the input is “camouflaged” by consisting of the same number repeated multiple times.
162
+
163
+ Robustness to question phrasing Although we do not train for linguistic variation and do not expect models to be robust to it, the failure modes are still interesting. For example, on one trained Transformer, the question “Calculate $ { { } ^ { 1 7 } } \star 4$ .” gave the correct answer 68, but the same question without the final full stop gave 69.
164
+
165
+ Extrapolation performance Modules on which good extrapolation performance was obtained include rounding larger numbers than seen during training, comparing more numbers, and adding and subtracting larger numbers. However for example models completely failed to add together more numbers than seen during training, which agrees with the suspicion that models have learnt to add numbers in parallel rather than calculating subsums.
166
+
167
+ # 4.3 PERFORMANCE ON REAL MATHEMATICS QUESTIONS
168
+
169
+ To provide an external benchmark for the capability of neural network models trained on our dataset, we tested the trained Transformer model on a set of 40 questions selected from publicly-available maths exams for British 16 year old schoolchildren2. These questions were gathered from four exam papers after excluding those involving graphs, tables or other figures - the full set is reproduced in the supplementary materials.
170
+
171
+ On these exam questions, the Transformer model got 14/40 questions correct, which is (proportionally) equivalent to that of an E grade student3. The model showed some promise by correctly solving the simultaneous equations $5 x + 2 y = 1 1$ and $4 x - 3 y = 1 8$ , identified the correct next number in the sequence 3, 9, 15, 27. The disappointing grade also assumes that no marks were awarded for plausible but incorrect attempts, such as the factorisation $1 ( y - 2 ) ( y + 4 )$ of the expression $y ^ { 2 } - \dot { 1 0 } y + 1 6$ . Overall, this analysis suggests that, with knowledge of the exam syllabus to inform the training data generation, and the ability to receive graphical inputs, it may be possible to encode the knowledge necessary to excel at unseen exams in an out-of-the-box neural network, although the pattern of errors and ability to generalise would likely differ from typical school-age students.
172
+
173
+ # 5 CONCLUSIONS AND FUTURE WORK
174
+
175
+ We have created a dataset on which current state-of-the-art neural models obtain moderate performance. Some modules are largely unsolved (for example those requiring several intermediate calculations), for which a human would find easy, and extrapolation performance is low. We hope this dataset will become a robust analyzable benchmark for developing models with more algebraic/symbolic reasoning abilities.
176
+
177
+ The dataset is easily extendable, since it is modular, with all modules using a common input/output format and the common language of mathematics. The main restriction is that the answers must be well-determined (i.e. unique), but this still allows for covering a lot of mathematics up to university level. At some point it becomes harder to cover more of mathematics (for example, proofs) while maintaining the sequence-to-sequence format, but hopefully by this point the dataset in its current format will have served its purpose in developing models that can reason mathematically. Alternatively, we could consider methods for assessing answers where there is not a single unique answer; for now the full scope of possibilities is too large to include in this paper, but a few possibilities include metrics such as BLEU (Papineni et al., 2002), by extending the data generation process to provide several reference answers, or by obtaining human paraphrases following the data augmentation process proposed by Wang et al. (2015).
178
+
179
+ We have not addressed linguistic variation or complexity in this dataset. Although to some extent linguistic complexity is orthogonal to the difficulty of the maths problems involved, the two cannot be entirely separated. The most obvious example of this for school-level mathematics is in algebraic word problems, where much of the difficulty lies in translating the description of the problem into an algebraic problem. Thus it would be useful to extend the dataset with “linguistic complexity”, where the same underlying mathematical problem is phrased in quite distinct, and not-at-first-obvious, translations. One option may be to do joint training on this dataset, and that of (Ling et al., 2017);
180
+
181
+ another would be to obtain more question templates via mechanical turking, as proposed by Wang et al. (2015).
182
+
183
+ Finally one completely distinct direction the dataset could be extended is to include visual (e.g. geometry) problems as well. For humans, visual reasoning is an important part of mathematical reasoning, even concerning problems that are not specified in a visual format. Therefore we want to develop questions along these lines, including those that require “intermediate visual representations” (in a similar way to how the textual module composition requires intermediate digital representations) and visual working memory. Note that reasoning with intermediate visual representations or ideas is richer than simply analyzing a visual domain (such as is typical in visual question-answering datasets).
184
+
185
+ # REFERENCES
186
+
187
+ Miltiadis Allamanis, Pankajan Chanthirasegaran, Pushmeet Kohli, and Charles Sutton. Learning continuous semantic representations of symbolic expressions. arXiv preprint arXiv:1611.01423, 2016.
188
+
189
+ Allen Institute for AI. Project Euclid. http://allenai.org/euclid/, 2014.
190
+
191
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
192
+
193
+ Richard Evans, David Saxton, David Amos, Pushmeet Kohli, and Edward Grefenstette. Can neural networks understand logical entailment? arXiv preprint arXiv:1802.08535, 2018.
194
+
195
+ Alex Graves. Adaptive computation time for recurrent neural networks. arXiv preprint arXiv:1603.08983, 2016.
196
+
197
+ Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka GrabskaBarwinska, Sergio Gómez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, et al. ´ Hybrid computing using a neural network with dynamic external memory. Nature, 538(7626):471, 2016.
198
+
199
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997.
200
+
201
+ Danqing Huang, Shuming Shi, Chin-Yew Lin, Jian Yin, and Wei-Ying Ma. How well do computers solve math word problems? large-scale dataset construction and evaluation. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1, pp. 887–896, 2016.
202
+
203
+ 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 Computer Vision and Pattern Recognition (CVPR), 2017 IEEE Conference on, pp. 1988–1997. IEEE, 2017.
204
+
205
+ Armand Joulin and Tomas Mikolov. Inferring algorithmic patterns with stack-augmented recurrent nets. In Advances in neural information processing systems, pp. 190–198, 2015.
206
+
207
+ Łukasz Kaiser and Ilya Sutskever. Neural gpus learn algorithms. arXiv preprint arXiv:1511.08228, 2015.
208
+
209
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
210
+
211
+ 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.
212
+
213
+ Nate Kushman, Yoav Artzi, Luke Zettlemoyer, and Regina Barzilay. Learning to automatically solve algebra word problems. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1, pp. 271–281, 2014.
214
+
215
+ Wang Ling, Dani Yogatama, Chris Dyer, and Phil Blunsom. Program induction by rationale generation: Learning to solve and explain algebraic word problems. arXiv preprint arXiv:1705.04146, 2017.
216
+
217
+ Gary F Marcus. The algebraic mind: Integrating connectionism and cognitive science. MIT press, 2003.
218
+
219
+ Aaron Meurer, Christopher P Smith, Mateusz Paprocki, Ondˇrej Certík, Sergey B Kirpichev, Matthew ˇ Rocklin, AMiT Kumar, Sergiu Ivanov, Jason K Moore, Sartaj Singh, et al. Sympy: symbolic computing in python. PeerJ Computer Science, 3:e103, 2017.
220
+
221
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015.
222
+
223
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting on association for computational linguistics, pp. 311–318. Association for Computational Linguistics, 2002.
224
+
225
+ Adam Santoro, Ryan Faulkner, David Raposo, Jack Rae, Mike Chrzanowski, Theophane Weber, Daan Wierstra, Oriol Vinyals, Razvan Pascanu, and Timothy Lillicrap. Relational recurrent neural networks. arXiv preprint arXiv:1806.01822, 2018a.
226
+
227
+ Adam Santoro, Felix Hill, David Barrett, Ari Morcos, and Timothy Lillicrap. Measuring abstract reasoning in neural networks. In International Conference on Machine Learning, pp. 4477–4486, 2018b.
228
+
229
+ Daniel Selsam, Matthew Lamm, Benedikt Bunz, Percy Liang, Leonardo de Moura, and David L Dill. Learning a sat solver from single-bit supervision. arXiv preprint arXiv:1802.03685, 2018.
230
+
231
+ David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. nature, 529(7587):484–489, 2016.
232
+
233
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
234
+
235
+ Shyam Upadhyay and Ming-Wei Chang. Annotating derivations: A new evaluation strategy and dataset for algebra word problems. arXiv preprint arXiv:1609.07197, 2016.
236
+
237
+ 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. 6000–6010, 2017.
238
+
239
+ Yan Wang, Xiaojiang Liu, and Shuming Shi. Deep neural solver for math word problems. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 845–854, 2017.
240
+
241
+ Yushi Wang, Jonathan Berant, and Percy Liang. Building a semantic parser overnight. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), volume 1, pp. 1332–1342, 2015.
242
+
243
+ Jason Weston, Antoine Bordes, Sumit Chopra, Alexander M Rush, Bart van Merriënboer, Armand Joulin, and Tomas Mikolov. Towards AI-complete question answering: A set of prerequisite toy tasks. arXiv preprint arXiv:1502.05698, 2015.
244
+
245
+ Wojciech Zaremba and Ilya Sutskever. Learning to execute. arXiv preprint arXiv:1410.4615, 2014.
246
+
247
+ # A RECURRENT ENCODER AND DECODER WITH ATTENTION
248
+
249
+ This model consists of an encoder and a decoder (see Figure 2a). The encoder maps the question (as a sequence of characters represented as 1-hot vectors) to a sequence of pairs of keys and values, where each key is a vector of length $k$ and each value is a vector of length $v$ . We take $k = v = 2 5 6$ .
250
+
251
+ We experiment with two different encoder cores. (1) An LSTM with hidden size $k + v$ . The hidden state is split to obtain the keys and values. (2) A bidirectional LSTM, i.e. two LSTMs both with hidden size $k + v$ , one operating in reverse. The keys and values are generated by concatenating the hidden states and mapping through a linear transformation.
252
+
253
+ The decoder LSTM has hidden size 2048. At each step, the output of the decoder is passed through a linear transformation to obtain (1) $h$ query vectors each of length $k$ , where $h$ is the number of attention heads, and (2) a logits vector of length 96 (the number of possible answer characters, plus a special ignored character). The query vectors are dot-producted with the keys to obtain a softmax weighting over the encoded question values (the standard attention mechanism, as done by e.g. Vaswani et al. (2017)). At every time step, the input to the decoder LSTM is the result of this attention mechanism (the soft-weighted values), concatenated with the 1-hot embedding of the current answer character. (The answer is right-shifted by 1, so that the LSTM does not get to see the character it is attempting to predict.) In addition we have 15 initial steps where no answer character is fed in to allow the LSTM to integrate information from the question, and the output predictions are ignored. The model is trained using a cross-entropy loss on the output logits for predicting the correct answer.
254
+
255
+ # B AREAS OF MATHEMATICS
256
+
257
+ # B.1 ALGEBRA
258
+
259
+ Some of the algebra modules participate in module composition.
260
+
261
+ • linear_1d Solve linear equations in one variable, e.g. solve $2 ( x - 1 0 ) + 3 = 1 7 x + 1 0$ for $x$ .
262
+ linear_2d Solve simultaneous linear equations in two variables.
263
+ • polynomial_roots Find roots of polynomials or factorize them, e.g. factorize $2 x ^ { 2 } + 5 x + 3$ .
264
+ • sequence_next_term Find continuations of a sequence given the first few terms. E.g. what comes next in the sequence 2, 6, 12, 20?
265
+ • sequence_nth_term Find an expression for the nth term in a sequence, given the first few terms.
266
+
267
+ For extrapolation tests, we include:
268
+
269
+ • polynomial_roots_big Same as polynomial_roots, but with polynomials larger than those seen during training.
270
+
271
+ # B.2 ARITHMETIC
272
+
273
+ Many of the arithmetic modules participate in module composition.
274
+
275
+ • add_or_sub Add or subtract a pair of integers or decimals.
276
+ • add_or_sub_in_base Add or subtract a pair of integers given in a different base (between 2 and 16).
277
+ • add_sub_multiple Add and subtract multiple integers.
278
+ • div Divide one integer by another, with the answer a simplified fraction.
279
+ • mixed Arithmetic involving addition, subtraction, multiplication, division, and brackets.
280
+ • mul Multiply pair of integers or decimals.
281
+ • mul_div_multiple Find simplest fraction of expression involving integers, multiplication, division, and brackets.
282
+
283
+ • nearest_integer_root Calculate the nearest integer to an nth root of another integer. • simplify_surd Simplify an expression involving square-roots, e.g. simplify √ $\sqrt { 1 0 } \times$ $- 9 ) ^ { - } / ( \sqrt { 2 } \times 1 2 ) \times - 8$ .
284
+
285
+ For extrapolation tests, we include:
286
+
287
+ • add_or_sub_big Add or subtract a pair of integers bigger than seen during training.
288
+ • add_sub_multiple Like add_sub_multiple but with more terms than seen during training.
289
+ • div_big Divide one integer by another, with bigger integers than seen during training.
290
+ • mixed_longer Like mixed but with more terms.
291
+ • mul_big Multiply pair of integers bigger than seen during training.
292
+ • mul_div_multiple_longer Like mul_div_multiple but with more terms.
293
+
294
+ # B.3 CALCULUS
295
+
296
+ The differentiate module fully participates in module composition, accepting inputs from and passing outputs to other modules.
297
+
298
+ • differentiate First and higher order derivatives of multivariate polynomials, either specified directly or as a result of module composition. E.g. let $f ( x ) = 2 \bar { * } x \bar { + } 3$ , let $g ( x ) = x * * 2 - 1 7$ ; what is the derivative of $f ( g ( x ) ) \smash { \vdots }$
299
+
300
+ # B.4 COMPARISON
301
+
302
+ All comparison modules accept numbers from other modules as inputs.
303
+
304
+ • closest Finding the closest to a given number in a list.
305
+ • kth_biggest Finding the $k$ th biggest or smallest number in a list.
306
+ • pair Pairwise comparison between pairs of numbers. E.g. which is bigger: 4/37 or 7/65? • sort Sorting lists of numbers into ascending or descending order.
307
+
308
+ For extrapolation tests, we include:
309
+
310
+ • closest_more Like closest but with larger lists than seen during training.
311
+ • kth_biggest_more Like kth_biggest but with larger list.
312
+ • sort_more Sorting longer lists of numbers than seen during training.
313
+
314
+ # B.5 MEASUREMENT
315
+
316
+ • conversion Conversion between different units of length, time, mass, and volume. E.g. how many millilitres are there in $1 3 / 8$ of a litre?
317
+ • time Working with clock times: time differences, and time before or after. E.g. how many minutes are there between 8:05 PM and 9:12 PM?
318
+
319
+ For extrapolation tests, we include:
320
+
321
+ • conversion With larger values than seen during training.
322
+
323
+ # B.6 NUMBERS
324
+
325
+ All number modules accept numbers from other modules as inputs.
326
+
327
+ • base_conversion Conversion between bases (e.g. give 1011001 (base 2) in base 16).
328
+ • div_remainder Calculate remainders under division. • gcd Calculating greatest common divisors.
329
+ • is_factor Recognizing factors, e.g. is 15 a factor of 60?
330
+ • is_prime Testing for primality.
331
+ • lcm Calculating least common multiples.
332
+ • list_prime_factors Factoring numbers into primes. E.g. give the prime factors of 64372. • place_value Give the place value of a number, e.g. what is the tens digit of 3585792? • round_number Rounding integers and decimals. E.g. give 432.1058 to three decimal places.
333
+
334
+ For extrapolation tests, we include:
335
+
336
+ • round_number_big Like round_number but with larger numbers than seen during training.
337
+ • place_value_big Like place_value but with larger numbers than seen during training.
338
+
339
+ # B.7 POLYNOMIALS
340
+
341
+ All function modules are fully compositional: they accept functions specified by other questions as inputs, and define functions for use in other modules.
342
+
343
+ • add Adding functions. E.g. calculating $2 f ( x ) + 1 7 g ( x )$ given $f$ and $g$ .
344
+ • collect Simplify polynomial expressions by collecting terms.
345
+ • compose Calculating the composition of functions.
346
+ • coefficient_named E.g. rearrange $( x + 1 ) ( 2 x + 3 )$ to $a x ^ { 2 } + b x + c$ and give $b$ .
347
+ • evaluate E.g. value of $x ^ { 2 } y ^ { 2 } + 2 x y$ when $x = 2 , y = 3$ .
348
+ • expand Expand and simplify polynomials, e.g. expand $( x + 1 ) ( 2 x + 3 )$ .
349
+ • simplify_power Simplify powers, testing rules of power indices. E.g. simplify $x ^ { 3 } / x ^ { 2 }$ .
350
+
351
+ # B.8 PROBABILITY
352
+
353
+ There are two modules here, both based on sampling without replacement from a bag of repeated letters, specified using either: (1) counts (e.g. {a: 1, b: 7}), or (2) an unsorted list of letters that require counting, e.g. ecggccdcdceeeeg.
354
+
355
+ • swr_p_level_set Calculating probability of obtaining certain counts of different letters.
356
+ • swr_p_sequence Calculating probability of obtaining a given sequence of letters.
357
+
358
+ For extrapolation tests, we include the same modules, but with more letters sampled from the bag than seen during training:
359
+
360
+ • swr_p_level_set_more_samples • swr_p_sequence_more_samples
361
+
362
+ C PER-MODULE PERFORMANCE
363
+
364
+ Interpolation test performance is shown in Figure 4 and extrapolation test performance is shown in Figure 5. Of the different encoders for the recurrent attention architecture, we show the per-module performance of the bidirectional LSTM encoder which has the greatest performance.
365
+
366
+ ![](images/3fd7e21bb9a3f772ed9a7424d7977010983475c976c26537a2d09c5762117214.jpg)
367
+ Figure 4: Interpolation test performance on the different modules.
368
+
369
+ ![](images/285ec570401c1eed8ddf8c0e002cffa9488fc6fa3782ad35dc723eeb3680103f.jpg)
370
+ Figure 5: Extrapolation test performance on the different modules.
371
+
372
+ # D HIGH-SCHOOL MATHEMATICS QUESTIONS
373
+
374
+ 1. Factorise $x ^ { 2 } + 7 x$ 2. Factorise $y ^ { 2 } - 1 0 y + 1 6$ 3. Factorise $2 t ^ { 2 } + 5 t + 2$ 4. Simplify ${ \frac { ( x + 1 ) } { 2 } } + { \frac { ( x + 3 ) } { 3 } }$ 5. Solve $2 x ^ { 2 } + 9 x + 7$ 6. Solve $\begin{array} { r } { \frac { 2 } { y ^ { 2 } } + \frac { 9 } { y } - 7 = 0 } \end{array}$ 7. Expand $3 ( x + 4 ) + 2 ( 5 x - 1 )$ 8. Expand $( 2 x + 1 ) ( x - 4 )$ 9. Factor $6 y ^ { 2 } - 9 x y$
375
+ 10. Solve $3 p - 7 > 1 1$
376
+ 11. $A = 4 b c , A = 1 0 0 , b = 2 .$ calculate $c$
377
+ 12. Make $k$ the subject of $m = \sqrt { ( \frac { k + 1 } { 4 } ) }$
378
+ 13. Expand $( p + 9 ) ( p - 4 )$
379
+ 14. Solve $\frac { ( 5 w - 8 ) } { 3 } = 4 w + 2$
380
+ 15. Factorise $x ^ { 2 } - 4 9$
381
+ 16. Expand $( x - 7 ) ( x + 1 )$
382
+ 17. Simplify $\sqrt { 9 x ^ { 8 } y ^ { 3 } }$ assuming $\mathbf { X }$ is positive.
383
+ 18. $\begin{array} { r } { p ^ { 2 } = \frac { ( x - y ) } { x y } } \end{array}$ , $x = 8 . 5$ , $y = 4$ , find p
384
+ 19. Make $t$ the subject of $2 ( d - t ) = 4 t + 7$
385
+ 20. Solve $3 x ^ { 2 } - 4 x - 2 = 0$
386
+ 21. Expand $3 ( 2 y - 5 )$
387
+ 22. Factorise $8 x ^ { 2 } + 4 x y$
388
+ 23. Make $h$ the subject of $\begin{array} { r } { t = \frac { g h } { 1 0 } } \end{array}$
389
+ 24. Simplify $( m ^ { - 2 } ) ^ { ! }$ 5
390
+ 25. Factorise $x ^ { 2 } + 3 x - 1 0$
391
+ 26. Solve $5 x + 2 y = 1 1$ and $4 x - 3 y = 1 8$ for
392
+
393
+ 27. Simplify $\frac { ( x ^ { 2 } + 3 x - 4 ) } { ( 2 x ^ { 2 } - 5 x + 3 ) }$
394
+ 28. Simplify $\textstyle { \frac { 4 } { ( x + 2 ) } } + { \frac { 3 } { ( x - 2 ) } }$
395
+ 29. Expand $4 ( 3 x + 5 )$
396
+ 30. Expand $2 ( x - 4 ) + 3 ( x + 5 )$
397
+ 31. Expand $( x + 4 ) ( x + 6 )$
398
+ 32. Simplify $\textstyle { \frac { m ^ { 5 } } { m ^ { 3 } } }$
399
+ 33. Simplify $( 5 x ^ { 4 } y ^ { 3 } ) ( x ^ { 2 } y )$
400
+ 34. Solve $3 x + 2 y = 4$ and $4 x + 5 y = 1 7$ for $\mathbf { X }$
401
+ 35. Complete the sequence: 3, 9, 15, 21, 27
402
+ 36. Simplify $5 x + 4 y + x - 7 y$
403
+ 37. Complete the sequence: 3, 10, 17, 24
404
+ 38. Simplify $x ^ { 1 0 } x ^ { 3 }$
405
+ 39. Solve $7 * ( x + 2 ) = 7$
406
+ 40. Factorise $x ^ { 2 } - 1 2 x + 2 7$
md/train/H1gX8C4YPr/H1gX8C4YPr.md ADDED
@@ -0,0 +1,375 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DD-PPO: LEARNING NEAR-PERFECT POINTGOAL NAVIGATORS FROM 2.5 BILLION FRAMES
2
+
3
+ Erik Wijmans1,2∗Abhishek Kadian2 Ari Morcos2 Stefan Lee1,3 Irfan Essa1
4
+ Devi Parikh1,2 Manolis Savva2,4 Dhruv Batra1,2
5
+ 1Georgia Institute of Technology 2Facebook AI Research
6
+ 3Oregon State University 4Simon Fraser University
7
+
8
+ # ABSTRACT
9
+
10
+ We present Decentralized Distributed Proximal Policy Optimization (DD-PPO), a method for distributed reinforcement learning in resource-intensive simulated environments. DD-PPO is distributed (uses multiple machines), decentralized (lacks a centralized server), and synchronous (no computation is ever ‘stale’), making it conceptually simple and easy to implement. In our experiments on training virtual robots to navigate in Habitat-Sim (Savva et al., 2019), DD-PPO exhibits near-linear scaling – achieving a speedup of $1 0 7 \mathrm { x }$ on 128 GPUs over a serial implementation. We leverage this scaling to train an agent for 2.5 Billion steps of experience (the equivalent of 80 years of human experience) – over 6 months of GPU-time training in under 3 days of wall-clock time with 64 GPUs.
11
+
12
+ This massive-scale training not only sets the state of art on Habitat Autonomous Navigation Challenge 2019, but essentially ‘solves’ the task – near-perfect autonomous navigation in an unseen environment without access to a map, directly from an RGB-D camera and a $\mathrm { G P S 4 C }$ ompass sensor. Fortuitously, error vs computation exhibits a power-law-like distribution; thus, $90 \%$ of peak performance is obtained relatively early (at 100 million steps) and relatively cheaply (under 1 day with 8 GPUs). Finally, we show that the scene understanding and navigation policies learned can be transferred to other navigation tasks – the analog of ‘ImageNet pre-training $^ +$ task-specific fine-tuning’ for embodied AI. Our model outperforms ImageNet pre-trained CNNs on these transfer tasks and can serve as a universal resource (all models and code are publicly available).
13
+
14
+ Code: https://github.com/facebookresearch/habitat-api Video: https://www.youtube.com/watch?v=5PBp V5i1v4
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ Recent advances in deep reinforcement learning (RL) have given rise to systems that can outperform human experts at variety of games (Silver et al., 2017; Tian et al., 2019; OpenAI, 2018). These advances, even more-so than those from supervised learning, rely on significant numbers of training samples, making them impractical without large-scale, distributed parallelization. Thus, scaling RL via multi-node distribution is of importance to AI – that is the focus of this work.
19
+
20
+ Several works have proposed systems for distributed RL (Heess et al., 2017; Liang et al., 2018a; Tian et al., 2019; Silver et al., 2016; OpenAI, 2018; Espeholt et al., 2018). These works utilize two core components: 1) workers that collect experience (‘rollout workers’), and 2) a parameter server that optimizes the model. The rollout workers are then distributed across, potentially, thousands of CPUs1. However, synchronizing thousands of workers introduces significant overhead (the parameter server must wait for the slowest worker, which can be costly as the number of workers grows). To combat this, they wait for only a few rollout workers, and then asynchronously optimize the model.
21
+
22
+ However, this paradigm – of a single parameter server and thousands of (typically CPU) workers – appears to be fundamentally incompatible with the needs of modern computer vision and robotics communities. Over the last few years, a large number of works have proposed training virtual robots (or ‘embodied agents’) in rich 3D simulators before transferring the learned skills to reality (Beattie et al., 2016; Chaplot et al., 2017; Das et al., 2018; Gordon et al., 2018; Anderson et al., 2018b; Wijmans et al., 2019; Savva et al., 2019). Unlike Gym or Atari, 3D simulators require GPU acceleration, and, consequently, the number of workers is greatly limited ( $2 ^ { 5 }$ to 8 vs. $2 ^ { 1 2 }$ to 15). The desired agents operate from high dimensional inputs (pixels) and, consequentially, use deep networks (ResNet50) that strain the parameter server. Thus, there is a need to develop a new distributed architecture.
23
+
24
+ ![](images/21bf2fd54b08beb184a14d21af7c8f027f4f2c1da0c98afce402df4bf44a191a.jpg)
25
+ Figure 1: Left: In PointGoal Navigation, an agent must navigate from a random starting location (blue) to a target location (red) specified relative to the agent $\mathbf { \bar { \Sigma } } ^ { 6 6 } \mathbf { G o } 5 \mathbf { m }$ north, $1 0 \mathrm { m }$ east of you”) in a previously unseen environment without access to a map. Right: Performance (SPL; higher is better) of an agent equipped with RGB-D and $\mathrm { G P S 4 C }$ ompass sensors on the Habitat Challenge 2019 (Savva et al., 2019) train & val sets. Using DD-PPO, we train agents for over 180 days of GPU-time in under 3 days of wall-clock time with 64 GPUs, achieving state-of-art results and ‘solving’ the task.
26
+
27
+ Contributions. We propose a simple, synchronous, distributed RL method that scales well. We call this method Decentralized Distributed Proximal Policy Optimization (DD-PPO) as it is decentralized (has no parameter server), distributed (runs across many different machines), and we use it to scale Proximal Policy Optimization (Schulman et al., 2017).
28
+
29
+ In DD-PPO, each worker alternates between collecting experience in a resource-intensive and GPU accelerated simulated environment and optimizing the model. This distribution is synchronous – there is an explicit communication stage where workers synchronize their updates to the model (the gradients). To avoid delays due to stragglers, we propose a preemption threshold where the experience collection of stragglers is forced to end early once a pre-specified percentage of the other workers finish collecting experience. All workers then begin optimizing the model.
30
+
31
+ We characterize the scaling of DD-PPO by the steps of experience per second with N workers relative to 1 worker. We consider two different workloads, 1) simulation time is roughly equivalent for all environments, and 2) simulation time can vary dramatically due to large differences in environment complexity. Under both workloads, we find that DD-PPO scales near-linearly. While we only examined our method with PPO, other on-policy RL algorithms can easily be used and we believe the method is general enough to be adapted to off -policy RL algorithms.
32
+
33
+ We leverage these large-scale engineering contributions to answer a key scientific question arising in embodied navigation. Mishkin et al. (2019) benchmarked classical (mapping $^ +$ planning) and learning-based methods for agents with RGB-D and $\mathrm { G P S + } \mathrm { c }$ ompass sensors on PointGoal Navigation (Anderson et al., 2018a) (PointGoalNav), see Fig. 1, and showed that classical methods outperform learning-based. However, they trained for ‘only’ 5 million steps of experience. Savva et al. (2019) then scaled this training to 75 million steps and found that this trend reverses – learningbased outperforms classical, even in unseen environments! However, even with an order of magnitude more experience (75M vs 5M), they found that learning had not yet saturated. This begs the question – what are the fundamental limits of learnability in PointGoalNav? Is this task entirely learnable? We answer this question affirmatively via an ‘existence proof’.
34
+
35
+ Utilizing DD-PPO, we find that agents continue to improve for a long time (Fig. 1) – not only setting the state of art in Habitat Autonomous Navigation Challenge 2019 (Savva et al., 2019), but essentially ‘solving’ PointGoalNav (for agents with GPS $^ +$ Compass). Specifically, these agents 1) almost always reach the goal (failing on 1/1000 val episodes on average), and 2) reach it nearly as efficiently as possible – nearly matching (within $3 \%$ of) the performance of a shortest-path oracle! It is worth stressing how uncompromising that comparison is – in a new environment, an agent navigating without a map traverses a path nearly matching the shortest path on the map. This means there is no scope for mistakes of any kind – no wrong turn at a crossroad, no back-tracking from a dead-end, no exploration or deviation of any kind from the shortest-path. Our hypothesis is that the model learns to exploit the statistical regularities in the floor-plans of indoor environments (apartments, offices) in our datasets. The more challenging task of navigating purely from an RGB camera without GPS $+$ Compass demonstrates progress but remains an open frontier.
36
+
37
+ ![](images/332df56e623c0f624a0eebf02fae9bb2ccb30196ae3b468e2b75d7c3a37378f0.jpg)
38
+ Figure 2: Comparison of asynchronous distribution (left) and synchronous distribution via distributed data parallelism (right) for RL. Left: rollout workers collect experience and asynchronously send it to the parameter-server. Right: a worker alternates between collecting experience, synchronizing gradients, and optimization. We find this highly effective in resource-intensive environments.
39
+
40
+ Finally, we show that the scene understanding and navigation policies learned on PointGoalNav can be transferred to other tasks (Flee and Explore (Gordon et al., 2019)) – the analog of ‘ImageNet pre-training $^ +$ task-specific fine-tuning’ for Embodied AI. Our models are able to rapidly learn these new tasks (outperforming ImageNet pre-trained CNNs) and can be utilized as near-perfect neural PointGoal controllers, a universal resource for other high-level navigation tasks (Anderson et al., 2018b; Das et al., 2018). We make code and trained models publicly available.
41
+
42
+ # 2 PRELIMINARIES: RL AND PPO
43
+
44
+ Reinforcement learning (RL) is concerned with decision making in Markov decision processes. In a partially observable MDP (POMDP), the agent receives an observation that does not fully specify the state $\left( { { s _ { t } } } \right)$ of the environment, $o _ { t }$ (e.g. an egocentric RGB image), takes an action $a _ { t }$ , and is given a reward $r _ { t }$ . The objective is to maximize cumulative reward over an episode, Formally, let $\tau$ be a sequence of $\left( o _ { t } , a _ { t } , r _ { t } \right)$ where $a _ { t } \sim \pi ( \cdot \mid o _ { t } )$ , and $s _ { t + 1 } \sim \mathcal { T } ( s _ { t } , a _ { t } )$ . For a discount factor $\gamma$ , which balances the trade-off between exploration and exploitation, the optimal policy, $\pi ^ { * }$ , is specified by
45
+
46
+ $$
47
+ \pi ^ { * } = \underset { \pi } { \operatorname { a r g m a x } } \mathbb { E } _ { \tau \sim \pi } \left[ R _ { T } \right] , \quad \mathrm { w h e r e } , R _ { T } = \sum _ { t = 1 } ^ { T } \gamma ^ { t - 1 } r _ { t } .
48
+ $$
49
+
50
+ One technique to find $\pi ^ { * }$ is Proximal Policy Optimization (PPO) (Schulman et al., 2017), an on-policy algorithm in the policy-gradient family. Given a $\theta$ -parameterized policy $\pi _ { \theta }$ and a set of trajectories collected with it (commonly referred to as a ‘rollout’), PPO updates $\pi _ { \theta }$ as follows. Let $\widehat { A } _ { t } ^ { \mathrm { ~ \scriptsize ~ - ~ } }$ , be the estimate of the advantage, where $\begin{array} { r } { R _ { t } = \sum _ { i = t } ^ { T } \gamma ^ { i - t } r _ { i } } \end{array}$ , and $\hat { V } _ { t }$ is the expected value of $R _ { t }$ , and $\begin{array} { r } { r _ { t } ( \theta ) = \frac { \pi _ { \theta } \left( a _ { t } | o _ { t } \right) } { \pi _ { \theta _ { t } } \left( a _ { t } | o _ { t } \right) } } \end{array}$ be the ratio of the probability of the action $a _ { t }$ under the current policy and the policy used to collect the rollout. The parameters are then updated by maximizing
51
+
52
+ $$
53
+ \mathcal { I } ^ { P P O } ( \theta ) = E _ { t } \Bigg [ \operatorname* { m i n } \Big ( \underbrace { r _ { t } ( \theta ) \hat { A } _ { t } } _ { \mathrm { i m p o r t a n c e - w e i g h t e d a d v a n t a g e } } , \quad \underbrace { \mathrm { c l i p } ( r _ { t } ( \theta ) , 1 - \epsilon , 1 + \epsilon ) \hat { A } _ { t } } _ { \mathrm { p r o x i m i t y c l i p p i n g ~ t e r m } } \Big ) \Bigg ]
54
+ $$
55
+
56
+ This clipped objective keeps this ratio within $\epsilon$ and functions as a trust-region optimization method;
57
+ allowing for the multiple gradient updates using the rollout, thereby improving sample efficiency.
58
+
59
+ ![](images/bf1241387fc742f2e852ff22264473db8b27bf1f5d3a2c3dd7491d9496d81e71.jpg)
60
+ Figure 3: Our agent for PointGoalNav. At very time-step, the agent receives an egocentric Depth or RGB (shown here) observation, utilizes its $\mathrm { G P S + C }$ ompass sensor to update the target position to be relative to its current position, and outputs the next action and an estimate of the value function.
61
+
62
+ # 3 DECENTRALIZED DISTRIBUTED PROXIMAL POLICY OPTIMIZATION
63
+
64
+ In reinforcement learning, the dominant paradigm for distribution is asynchronous (see Fig. 2). Asynchronous distribution is notoriously difficult – even minor errors can result in opaque crashes – and the parameter server and rollout workers necessitate separate programs.
65
+
66
+ In supervised learning, however, synchronous distributed training via data parallelism (Hillis & Steele Jr, 1986) dominates. As a general abstraction, this method implements the following: at step $k$ , worker $n$ has a copy of the parameters, $\theta _ { n } ^ { k }$ , calculates the gradient, $\partial \theta _ { n } ^ { k }$ , and updates $\theta$ via
67
+
68
+ $$
69
+ \theta _ { n } ^ { k + 1 } = \mathsf { P a r a m l p o d a t e } \Big ( \theta _ { n } ^ { k } , \mathsf { A l l R e d u c e } \big ( \partial \theta _ { 1 } ^ { k } , \ldots , \partial \theta _ { N } ^ { k } \big ) \Big ) = \mathsf { P a r a m l p o d a t e } \Big ( \theta _ { n } ^ { k } , \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \partial \theta _ { i } ^ { k } \Big ) ,
70
+ $$
71
+
72
+ where ParamUpdate is any first-order optimization technique (e.g. gradient descent) and AllReduce performs a reduction (e.g. mean) over all copies of a variable and returns the result to all workers. Distributed DataParallel scales very well (near-linear scaling up to 32,000 GPUs (Kurth et al., 2018)), and is reasonably simple to implement (all workers synchronously running identical code).
73
+
74
+ We adapt this to on-policy RL as follows: At step $k$ , a worker $n$ has a copy of the parameters $\theta _ { n } ^ { k }$ ; it gathers experience (rollout) using $\pi _ { \theta _ { n } ^ { k } }$ , calculates the parameter-gradients $\nabla _ { \theta }$ via any policy-gradient method (e.g. PPO), synchronizes these gradients with other workers, and updates the model:
75
+
76
+ $$
77
+ \theta _ { n } ^ { k + 1 } = \mathsf { P a r a m l y n d a t e } \left( \theta _ { n } ^ { k } , \mathsf { A l l R e d u c e } \left( \nabla _ { \theta } \mathcal { I } ^ { P P O } ( \theta _ { 1 } ^ { k } ) , \ldots , \nabla _ { \theta } \mathcal { I } ^ { P P O } ( \theta _ { N } ^ { k } ) \right) \right) .
78
+ $$
79
+
80
+ A key challenge to using this method in RL is variability in experience collection run-time. In supervised learning, all gradient computations take approximately the same time. In RL, some resourceintensive environments can take significantly longer to simulate. This introduces significant synchronization overhead as every worker must wait for the slowest to finish collecting experience. To combat this, we introduce a preemption threshold where the rollout collection stage of these stragglers is preempted (forced to end early) once some percentage, $p \%$ , (we find $6 0 \%$ to work well) of the other workers are finished collecting their rollout; thereby dramatically improving scaling. We weigh all worker’s contributions to the loss equally and limit the minimum number of steps before preemption to one-fourth the maximum to ensure all environments contribute to learning.
81
+
82
+ While we only examined our method with PPO, other on-policy RL algorithms can easily be used and we believe the method can be adapted to off -policy RL algorithms. Off-policy RL algorithms also alternate between experience collection and optimization, but differ in how experience is collected/used and the parameter update rule. Our adaptations simply add synchronization to the optimization stage and a preemption to the experience collection stage.
83
+
84
+ Implementation. We leverage PyTorch’s (Paszke et al., 2017) DistributedDataParallel to synchronize gradients, and TCPStore – a simple distributed key-value storage – to track how many workers have finished collecting experience. See Apx. E for a detailed description with code.
85
+
86
+ # 4 EXPERIMENTAL SETUP: POINTGOAL NAVIGATION, AGENTS, SIMULATOR
87
+
88
+ PointGoal Navigation (PointGoalNav). An agent is initialized at a random starting position and orientation in a new environment and asked to navigate to target coordinates specified relative to the agents position; no map is available and the agent must navigate using only its sensors – in our case RGB-D (or RGB) and $\mathrm { G P S } { + } 0$ Compass (providing current position and orientation relative to start).
89
+
90
+ The evaluation criteria for an episode is as follows (Anderson et al., 2018a): Let $S$ indicate ‘success’ (did the agent stop within 0.2 meters of the target?), $l$ be the length of the shortest path between start and target, and $p$ be the length of the agent’s path, then Success weighted by (normalized inverse) Path Length $\begin{array} { r } { \mathrm { S P L } = S \frac { \iota } { \operatorname* { m a x } ( l , p ) } } \end{array}$ . It is worth stressing that SPL is a highly punitive metric – to achieve $\mathrm { S P L } = 1$ , the agent (navigating without the map) must match the performance of the shortest-path oracle that has access to the map! There is no scope for any mistake – no wrong turn at a crossroad, no back-tracking from a dead-end, no exploration or deviation from the shortest path. In general, this may not even be possible in a new environment (certainly not if an adversary designs the map).
91
+
92
+ Agent. As in Savva et al. (2019), the agent has 4 actions, stop, which indicates the agent has reached the goal, move forward $( 0 . 2 5 \mathrm { m } )$ , turn left $( 1 0 ^ { \circ } )$ , and turn right $( 1 0 ^ { \circ } )$ . It receives $2 5 6 \times 2 5 6$ sized images and uses the GPS $^ +$ Compass to compute target coordinates relative to its current state. The RGB-D agent is limited to only Depth as Savva et al. (2019) found this to perform best.
93
+
94
+ Our agent architecture (Fig. 3) has two main components – a visual encoder and a policy network.
95
+
96
+ The visual encoder is based on either ResNet (He et al., 2016) or SE (Hu et al., 2018)-ResNeXt (Xie et al., 2017) with the number of output channels at every layer reduced by half. We use a first layer of 2x2-AvgPool to reduce resolution (essentially performing low-pass filtering $^ +$ down-sampling) – we find this to have no impact on performance while allowing faster training. From our initial experiments, we found it necessary to replace every BatchNorm layer (Ioffe & Szegedy, 2015) with GroupNorm (Wu & He, 2018) to account for highly correlated inputs seen in on-policy RL.
97
+
98
+ The policy is parameterized by a 2-layer LSTM with a 512-dimensional hidden state. It takes three inputs: the previous action, the target relative to the current state, and the output of the visual encoder. The LSTM’s output is used to produce a softmax distribution over the action space and an estimate of the value function. See Appendix C for full details.
99
+
100
+ Training. We use PPO with Generalized Advantage Estimation (Schulman et al., 2015). We set the discount factor $\gamma$ to 0.99 and the GAE parameter $\tau$ to 0.95. Each worker collects (up to) 128 frames of experience from 4 agents running in parallel (all in different environments) and then performs 2 epochs of PPO with 2 mini-batches per epoch. We use Adam (Kingma & Ba, 2014) with a learning rate of $2 . 5 \times 1 0 ^ { - 4 }$ . Unlike popular implementations of PPO, we do not normalize advantages as we find this leads to instabilities. We use DD-PPO to train with 64 workers on 64 GPUs.
101
+
102
+ The agent receives terminal reward $r _ { T } = 2 . 5 \mathrm { S P L }$ , and shaped reward $r _ { t } ( a _ { t } , s _ { t } ) = - \Delta _ { \mathrm { g e o } _ { - } \mathrm { d i s t } } - 0 . 0 1$ , where $\Delta _ { \mathrm { g e o \_ d i s t } }$ is the change in geodesic distance to the goal by performing action $a _ { t }$ in state $s _ { t }$ .
103
+
104
+ Simulator+Datasets. Our experiments are conducted using Habitat, a 3D simulation platform for embodied AI research (Savva et al., 2019). Habitat is a modular framework with a highly performant and stable simulator, making it an ideal framework for simulating billions of steps of experience.
105
+
106
+ We experiment with several different sources of data. First, we utilize the training data released as part of the Habitat Challenge 2019, consisting of 72 scenes from the Gibson dataset (Xia et al., 2018). We then augment this with all 90 scenes in the Matterport3D dataset (Chang et al., 2017) to create a larger training set (note that Matterport3D meshes tend to be larger and of better quality).2 Furthermore, Savva et al. (2019) curated the Gibson dataset by rating every mesh reconstruction on a quality scale of 0 to 5 and then filtered all splits such that each only contains scenes with a rating of 4 or above (Gibson- $^ { . 4 + }$ ), leaving all scenes with a lower rating previously unexplored. We examine training on the 332 scenes from the original train split with a rating of 2 or above (Gibson- $^ { 2 + }$ ).
107
+
108
+ # 5 BENCHMARKING: HOW DOES DD-PPO SCALE?
109
+
110
+ In this section, we examine how DD-PPO scales under two different workload regimes – homogeneous (every environment takes approximately the same amount of time to simulate) and heterogeneous (different environments can take orders of magnitude more/less time to simulate). We examine the number of steps of experience per second with N workers relative to 1 worker. We compare different values of the preemption threshold $p \%$ . We benchmark training our ResNet50 PointGoalNav agent with Depth on a cluster with Nvidia V100 GPUs and NCCL2.4.7 with Infiniband interconnect.
111
+
112
+ ![](images/435c1b7eeb301c7b83385d03704adc322e277f00ae6437de8b0ef2d9ac70b409.jpg)
113
+ Figure 4: Scaling performance (in steps of experience per second relative to 1 GPU) of DD-PPO for various preemption threshold, $p \%$ , values. Shading represents a $9 5 \%$ confidence interval.
114
+
115
+ Homogeneous. To create a homogeneous workload, we train on scenes from the Gibson dataset, which require very similar times to simulate agent steps. As shown in Fig. 4 (left), DD-PPO exhibits near-linear scaling (linear $=$ ideal) for preemption thresholds larger than $50 \%$ , achieving a $1 9 6 \mathrm { x }$ speed up with 256 GPUs relative to 1 GPU and an $7 . 3 \mathrm { x }$ speed up with 8 GPUs relative to 1.
116
+
117
+ Heterogeneous. To create a heterogeneous workload, we train on scenes from both Gibson and Matterport3D. Unlike Gibson, MP3D scenes vary significantly in complexity and time to simulate – the largest contains 8GB of data while the smallest is only 135MB. DD-PPO scales poorly at a preemption threshold of $100 \%$ (no preemption) due to the substantial straggler effect (one rollout taking substantially longer than the others); see Fig. 4 (right). However, with a preemption threshold of $80 \%$ or $60 \%$ , we achieve near-identical scaling to the homogeneous workload! We found no degradation in performance of models trained with any of these values for the preemption threshold despite learning in large scenes occurring at a lower frequency.
118
+
119
+ # 6 MASTERING POINTGOAL NAVIGATION WITH GPS $^ +$ COMPASS
120
+
121
+ In this section, we answer the following questions: 1) What are the fundamental limits of learnability in PointGoalNav navigation? 2) Do more training scenes improve performance? 3) Do better visual encoders improve performance? 4) Is PointGoalNav ‘solvable’ when navigating from RGB instead of Depth? 5) What are the open/unsolved problems – specifically, how does navigation without GPS+Compass perform? 6) Can agents trained for PointGoalNav be transferred to new tasks?
122
+
123
+ Agents continue to improve for a long time. Using DD-PPO, we train agents for 2.5 Billion steps of experience with 64 Tesla V100 GPUs in 2.75 days – 180 GPU-days of training, the equivalent of 80 years of human experience (assuming 1 human second per step). As a comparison, Savva et al. (2019) reached 75 million steps (an order of magnitude more than prior work) in 2.5 days using 2 GPUs – at that rate, it would take them over a month (wall-clock time) to achieve the scale of our study. Fig. 1 shows the performance of an agent with RGB-D and $\mathrm { G P S + C }$ ompass sensors, utilizing an SE-ResNeXt50 visual encoder, trained on Gibson- $^ { 2 + }$ – it does not saturate before 1 billion steps3, suggesting that previous studies were incomplete by 1-2 orders of magnitude. Fortuitously, error vs computation exhibits a power-law-like distribution; $90 \%$ of peak performance is obtained relatively early (100M steps) and relatively cheaply $( \mathrm { i n } 0 . 1$ day with 64 GPUs and in 1 day with ${ 8 \mathrm { G P U s } ^ { 4 } }$ ). Also noteworthy in Fig. 1 is the strong generalization (train to val) and corresponding lack of overfitting.
124
+
125
+ Increasing training data helps. Tab. 1 presents results with different training datasets and visual encoders for agent with RGB-D and GPS $^ +$ Compass. Our most basic setting (ResNet50, Gibson- $^ { . 4 + }$ training) already achieves SPL of 0.922 (val), 0.917 (test), which nearly misses (by 0.003) the top of the leaderboard for the Habitat Challenge $2 0 1 9 \ \mathsf { R G B - D \ t r a c k }$ . Next, we increase the size of the training data by adding in all Matterport3D scenes and see an improvement of ${ \sim } 0 . 0 3$ SPL – to 0.956 (val), 0.941 (test). Next, we compare training on Gibson- $^ { . 4 + }$ and Gibson- $^ { 2 + }$ . Recall that Gibson-{2, $3 \}$ corresponds to poorly reconstructed scenes (see Fig. 11). A priori, it is unclear whether the net effect of this addition would be positive or negative; adding them provides diverse experience to the agent, however, it is poor quality data. We find a potentially counter-intuitive result – adding poor 3D reconstructions to the train set improves performance on good reconstructions in val/test by ${ \sim } 0 . 0 3$ SPL – from 0.922 (val), 0.917 (test) to 0.956 (val), 0.944 (test). Our conjecture is that training on poor (Gibson-{2,3}) and good $^ { ( 4 + ) }$ reconstructions leads to robustness in representations learned.
126
+
127
+ Table 1: Performance (higher is better) of different architectures for agents with RGB-D and $\mathrm { G P S } { + }$ Compass sensors on the Habitat Challenge 2019 (Savva et al., 2019) validation and test-std splits (checkpoint selected on val). 10 samples taken for each episode on val. Gibson- $\cdot 4 + ( 2 + )$ refers to the subset of Gibson train scenes (Xia et al., 2018) with a quality rating of 4 (2) or higher. See Tab. 2 for results of the best DD-PPO agent for Blind, RGB, and RGB-D and other baselines.
128
+
129
+ <table><tr><td rowspan="2">Training Dataset</td><td rowspan="2">Agent Visual Encoder</td><td colspan="2">Validation</td><td colspan="2">Test Standard</td></tr><tr><td>SPL</td><td>Success</td><td>SPL</td><td>Success</td></tr><tr><td>Gibson-4+</td><td>ResNet50</td><td>0.922 ± 0.004</td><td>0.967 ±0.003</td><td>0.917</td><td>0.970</td></tr><tr><td>Gibson-4+ and MP3D</td><td>ResNet50</td><td>0.956 ± 0.002</td><td>0.996 ± 0.002</td><td>0.941</td><td>0.996</td></tr><tr><td>Gibson-2+</td><td>ResNet50</td><td>0.956± 0.003</td><td>0.994± 0.002</td><td>0.944</td><td>0.982</td></tr><tr><td></td><td>SE-ResNeXt50</td><td>0.959 ± 0.002</td><td>0.999 ± 0.001</td><td>0.943</td><td>0.988</td></tr><tr><td></td><td>SE-ResNeXt101+1024-d LSTM</td><td>0.969 ±0.002</td><td>0.997 ± 0.001</td><td>0.948</td><td>0.980</td></tr></table>
130
+
131
+ Better visual encoders and more parameters help. Using a better visual encoder, SE (Hu et al., 2018)-ResNeXt50 (Xie et al., 2017) instead of ResNet50, improves performance by 0.003 SPL (Tab. 1). Adding capacity to the visual encoder (SE-ResNeXt101 vs SE-ResNeXt50) and navigation policy (1024-d vs 512-d LSTM) further improves performance by 0.010 SPL.
132
+
133
+ PointGoalNav ‘solved’ with RGB-D and GPS $^ +$ Compass. Our best agent – SE-ResNeXt101 + 1024-d LSTM trained on Gibson- $^ { 2 + }$ – achieves SPL of 0.969 (val), 0.948 (test), which not only sets the state of art on the Habitat Challenge 2019 RGB-D track but is also within $3 { - } 5 \%$ of the shortest-path oracle6. Given the challenges with achieving near-perfect SPL in new environments, it is important to dig deeper. Fig. 13 shows (a) distribution of episode lengths in val and (b) SPL vs episode length. We see that while the dataset is dominated by short episodes $( 2 \mathrm { - } 1 2 \mathrm { m } )$ , the performance of the agent is remarkably stable over long distances and average SPL is not necessarily inflated. Our hypothesis is the agent has learned to exploit the structural regularities in layouts of real indoor environments. One (admittedly imperfect) way to test this is by training a Blind agent with only a $\mathrm { G P S + }$ Compass sensor. Fig. 13 shows that this agent is able to handle short-range navigation (which primarily involve turning to face the target and walking straight) but performs very poorly on longer trajectories – SPL of 0.3 (Blind) vs 0.95 (RGB-D) at $2 0 { - } 2 5 \mathrm { m }$ navigation. Thus, structural regularities, in part, explain performance for short-range navigation. For long-range navigation, the RGB-D agent is extracting overwhelming signal from its Depth sensor. We repeat this analysis on two additional navigation datasets proposed by Chaplot et al. (2019) – longer episodes and ‘harder’ episodes (more navigation around obstacles) – and find similar trends (Fig. 14). This discussion continues in Apx. A.
134
+
135
+ Performance with RGB is also improved. So far we studied RGB-D as this performed best in Savva et al. (2019). We now study RGB (with SE-ResNeXt50 encoder). We found it crucial to train on Gibson- $^ { 2 + }$ and all of Matterport3D, ensuring diversity in both layouts (Gibson- $^ { 2 + }$ ) and appearance (Matterport3D), and to channel-wise normalize RGB (subtract by mean and divide by standard deviation) as our networks lack BatchNorm. Performance improves dramatically from 0.57 (val), 0.47 (test) SPL in Savva et al. (2019) to near-perfect success 0.991 (val), 0.977 (test) and high SPL 0.929 (val), 0.920 (test). While SPL is considerably lower than the Depth agent, (0.929 vs 0.959), interestingly, the RGB agent still reaches the goal a similar percentage of the time $( 9 9 . 1 \%$ vs $9 9 . 9 \%$ ). This agent achieves state-of-art on the Habitat Challenge 2019 RGB track (rank 2 entry has 0.89 SPL).5
136
+
137
+ No GPS $^ +$ Compass remains unsolved. Finally, we examine if we also achieve better performance on the significantly more challenging task of navigation from RGB without GPS+Compass. At 100 million steps (an amount equivalent to Savva et al. (2019)), the agent achieves 0 SPL. By training to 2.5 billion steps, we make some progress and achieve 0.15 SPL. While this is a substantial improvement, the task continues to remain an open frontier for research in embodied AI.
138
+
139
+ Transfer Learning. We examine transferring our agents to the following tasks (Gordon et al., 2019)
140
+
141
+ ![](images/c9cfb838a867db299130f5b389dfb94f653429bcdff0be5f38adc41a18592352.jpg)
142
+ Figure 5: Performance (higher is better) on Flee (left) and Exploration (right) under five settings.
143
+
144
+ – Flee The agent maximizes its geodesic distance from its starting location. Let $s _ { t }$ be the agent’s position at time $t$ , and $M a x ( s _ { 0 } )$ denote the maximum distance over all reachable points, then the agent maximizes $D _ { T } = G e o ( s _ { T } , s _ { 0 } ) / M a x ( s _ { 0 } )$ . The reward is $r _ { t } = 5 ( D _ { t } - D _ { t - 1 } )$ .
145
+
146
+ Exploration The agent maximizes the number of locations (specified by 1m cubes) visited. Let Visitedt denote the number of location visited at time $t$ , then the agent maximizes $| { \mathrm { V i s i t e d } } _ { T } |$ The reward is $r _ { t } = 0 . 2 5 ( | \mathrm { V i s i t e d } _ { t } | - | \mathrm { V i s i t e d } _ { t - 1 } | )$ .
147
+
148
+ We use a PointGoalNav-trained agent with RGB and ${ \mathrm { G P S } } { + } { \mathsf { C } }$ ompass, remove the GPS+Compass, and transfer to these tasks under five different settings:
149
+
150
+ Scratch. All parameters (visual encoder $^ +$ policy) are trained from scratch for each new task. Improvements over this baseline demonstrate benefits of transfer learning.
151
+ ImageNetEncoder-ScratchPolicy. The visual encoder is initialized with ImageNet pre-trained weights and frozen; the navigation policy is trained from scratch.
152
+ PointGoalNavEncoder-ScratchPolicy. The visual encoder is initialized from PointGoalNav and frozen; the navigation policy is trained from scratch.
153
+ PointGoalNavEncoder-FinetunePolicy. Both visual encoder and policy parameters are initialized from PointGoalNav (critic layers are reinitialized). Encoder is frozen, policy is fine-tuned.7 ∇ Neural Controller We treat our agent as a differentiable neural controller, a closed-loop lowlevel controller than can navigate to a specified coordinate. We utilize this controller in a new task by training a light-weight high-level planner that predicts a goal-coordinate (at each time-step) for the controller to navigate to. Since the controller is fully differentiable, we can backprop through it. We freeze the controller, train the planner+controller system with PPO for the new task. The planner is a 2-layer LSTM and shares the (frozen) visual encoder with the controller.
154
+
155
+ Fig. 5 shows performance vs. experience results (higher is better). Nearly all methods outperform learning from scratch, establishing the value of transfer learning. PointGoalNav pre-trained visual encoders dramatically outperforms ImageNet pre-trained ones, indicating that the agent has learned generally useful scene understanding. For both tasks, fine-tuning an existing policy allows it to rapidly learn the new task, indicating that the agent has learned general navigation skills. ∇Neural Controller outperforms PointGoalNavEncoder-ScratchPolicy on Flee and is competitive on Exploration, indicating that the agent can indeed be ‘controlled’ or directed to target locations by a planner. Overall, these results demonstrate that our trained model is useful for more than just PointGoalNav.
156
+
157
+ # 7 RELATED WORK
158
+
159
+ Visual Navigation. Visual navigation in indoor environments has been the subject of many recent works (Gupta et al., 2017; Das et al., 2018; Anderson et al., 2018b; Savva et al., 2019; Mishkin et al., 2019). Our primary contribution is DD-PPO, thus we discuss other distributed works.
160
+
161
+ In the general case, computation in reinforcement learning (RL) in simulators can be broken down into 4 roles: 1) Simulation: Takes actions performed by the agent as input, simulates the new state, returns observations, reward, etc. 2) Inference: Takes observations as input and utilizes the agent policy to return actions, value estimate, etc. 3) Learner: Takes rollouts as input and computes gradients to update the policy’s parameters. 4) Parameter server/master: Holds the source of truth for the policy’s parameters and coordinates workers.
162
+
163
+ Synchronous RL. Synchronous RL systems utilize a single processes to perform all four roles; this design is found in RL libraries like OpenAI Baselines (Dhariwal et al., 2017) and PytorchRL (Kostrikov, 2018). This method is limited to a single nodes worth of GPUs.
164
+
165
+ Synchronous Distributed RL. The works most closely related to DD-PPO also propose to scale synchronous RL by replicating this simulation/inference/learner process across multiple GPUs and then synchronize gradients with AllReduce. Stooke & Abbeel (2018) experiment with Atari and find it not effective however. We hypothesize that this is due to a subtle difference – this distribution design relies on a single worker collecting experience from multiple environments, stepping through them in lock step. This introduces significant synchronization and communication costs as every step in the rollout must be synchronized across as many as 64 processes (possible because each environment is resource-light, e.g. Atari). For instance, taking 1 step in 8 parallel pong environments takes approximately the same wall-clock time as 1 pong environment, but it takes 10 times longer to take 64 steps in lock-step; thus gains from parallelization are washed out due to the lock-step synchronization. In contrast, we study resource-intensive environments, where only 2 or 4 environments per worker is possible, and find this technique to be effective. Liang et al. (2018b) mirror our findings (this distribution method can be effective for resource intensive simulation) in GPUaccelerated physics simulation, specifically MuJoCo (Todorov et al., 2012) with NVIDIA Flex. In contrast to our work, they examine scaling up to only 32 GPUs and only for homogeneous workloads. In contrast to both, we propose an adaption to mitigate the straggler effect – preempting the experience collection (rollout) of stragglers and then beginning optimization. This improves scaling for homogeneous workloads and dramatically improves scaling for heterogeneous workloads.
166
+
167
+ Asynchronous Distributed RL. Existing public frameworks for asynchronous distributed reinforcement learning (Heess et al., 2017; Liang et al., 2018a; Espeholt et al., 2018) use a single (CPU-only) process to perform the simulation and inference roles (and then replicate this process to scale). A separate process asynchronously performs the learner and parameter server roles (note its not clear how to use more than one these processes as it holds the source of truth for the parameters). Adapting these methods to the resource-intensive environments studied in this work (e.g. Habtiat (Savva et al., 2019)) encounters the following issues: 1) Limiting the inference/simulation processes to CPU-only is untenable (deep networks and need for GPU-accelerated simulation). While the inference/simulation processes could be moved to the GPU, this would be ineffective for the following: GPUs operate most efficiently with large batch sizes (each inference/simulation process would have a batch size of 1), CUDA runtime requires ${ \sim } 6 0 0 \mathrm { M B }$ of GPU memory per process, and only one CUDA kernel (function that runs on the GPU) can executed by the GPU at a time. These issue contribute and lead to low GPU utilization. In contrast, DD-PPO utilizes a single process per GPU and batches observations from multiple environments for inference. 2) The single process learner/- parameter server is limited to a single node’s worth of GPUs. While this not a limitation for small networks and low dimensional inputs, our agents take high dimensional inputs (e.g. a Depth sensor) and utilize large neural networks (ResNet50), thereby requiring considerable computation to compute gradients. In contrast, DD-PPO has no parameter server and every GPU computes gradients, supporting even very large networks (SE-ResNeXt101).
168
+
169
+ Straggler Effect Mitigation. In supervised learning, the straggler effect is commonly caused by heterogeneous hardware or hardware failures. Chen et al. (2016) propose a pool of $b$ “back-up” workers (there are $N + b$ workers total) and perform the parameter update once $N$ workers finish. In comparison, their method a) requires a parameter server, and b) discards all work done by the stragglers. Chen et al. (2018) propose to dynamically adjust the batch size of each worker such that all workers perform their forward and backward pass in the same amount of time. Our method aims to reduce variance in experience collection times. DD-PPO dynamically adjusts a worker’s batch size as a necessary side-effect of preempting experience collection in on-policy RL.
170
+
171
+ Distributed Synchronous SGD. Data parallelism is a common paradigm in high performance computing (Hillis & Steele Jr, 1986). In this paradigm, parallelism is achieved by workers performing the same work on different data. This paradigm can be naturally adapted to supervised deep learning (Chen et al., 2016). Works have used this to achieve state-of-the-art results in tasks ranging from computer vision (Goyal et al., 2017; He et al., 2017) to natural language processing (Peters et al., 2018; Devlin et al., 2018; Ott et al., 2019). Furthermore, multiple deep learning frameworks provide simple-to-use wrappers supporting this parallelism model (Paszke et al., 2017; Abadi et al., 2015; Sergeev & Balso, 2018). We adapt this framework to reinforcement learning.
172
+
173
+ # 8 ACKNOWLEDGEMENTS
174
+
175
+ The Georgia Tech effort was supported in part by NSF, AFRL, DARPA, ONR YIPs, ARO PECASE. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of the U.S. Government, or any sponsor.
176
+
177
+ # REFERENCES
178
+
179
+ Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit ´ Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, ´ Oriol Vinyals, Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL http://tensorflow.org/. Software available from tensorflow.org.
180
+
181
+ Peter Anderson, Angel Chang, Devendra Singh Chaplot, Alexey Dosovitskiy, Saurabh Gupta, Vladlen Koltun, Jana Kosecka, Jitendra Malik, Roozbeh Mottaghi, Manolis Savva, et al. On evaluation of embodied navigation agents. arXiv preprint arXiv:1807.06757, 2018a.
182
+
183
+ Peter Anderson, Qi Wu, Damien Teney, Jake Bruce, Mark Johnson, Niko Sunderhauf, Ian Reid, Stephen Gould, ¨ and Anton van den Hengel. Vision-and-language navigation: Interpreting visually-grounded navigation instructions in real environments. In CVPR, 2018b.
184
+
185
+ Charles Beattie, Joel Z. Leibo, Denis Teplyashin, Tom Ward, Marcus Wainwright, Heinrich Kuttler, Andrew ¨ Lefrancq, Simon Green, V´ıctor Valdes, Amir Sadik, Julian Schrittwieser, Keith Anderson, Sarah York, Max ´ Cant, Adam Cain, Adrian Bolton, Stephen Gaffney, Helen King, Demis Hassabis, Shane Legg, and Stig Petersen. Deepmind lab. arXiv, 2016.
186
+
187
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016.
188
+
189
+ Angel Chang, Angela Dai, Thomas Funkhouser, Maciej Halber, Matthias Niessner, Manolis Savva, Shuran Song, Andy Zeng, and Yinda Zhang. Matterport3D: Learning from RGB-D data in indoor environments. International Conference on 3D Vision (3DV), 2017.
190
+
191
+ Devendra Singh Chaplot, Kanthashree Mysore Sathyendra, Rama Kumar Pasumarthi, Dheeraj Rajagopal, and Ruslan Salakhutdinov. Gated-attention architectures for task-oriented language grounding. arXiv preprint arXiv:1706.07230, 2017.
192
+
193
+ Devendra Singh Chaplot, Saurabh Gupta, Abhinav Gupta, and Ruslan Salakhutdinov. Modular visual navigation using active neural mapping. http://www.cs.cmu.edu/∼dchaplot/papers/active neural mapping.pdf, 2019.
194
+
195
+ Chen Chen, Qizhen Weng, Wei Wang, Baochun Li, and Bo Li. Fast distributed deep learning via workeradaptive batch sizing. arXiv preprint arXiv:1806.02508, 2018.
196
+
197
+ Jianmin Chen, Xinghao Pan, Rajat Monga, Samy Bengio, and Rafal Jozefowicz. Revisiting distributed synchronous sgd. arXiv preprint arXiv:1604.00981, 2016.
198
+
199
+ Abhishek Das, Samyak Datta, Georgia Gkioxari, Stefan Lee, Devi Parikh, and Dhruv Batra. Embodied Question Answering. In CVPR, 2018.
200
+
201
+ 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.
202
+
203
+ Prafulla Dhariwal, Christopher Hesse, Oleg Klimov, Alex Nichol, Matthias Plappert, Alec Radford, John Schulman, Szymon Sidor, Yuhuai Wu, and Peter Zhokhov. Openai baselines. https://github.com/openai/ baselines, 2017.
204
+
205
+ Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Volodymir Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Dunning, et al. Impala: Scalable distributed deep-rl with importance weighted actor-learner architectures. arXiv preprint arXiv:1802.01561, 2018.
206
+
207
+ Daniel Gordon, Aniruddha Kembhavi, Mohammad Rastegari, Joseph Redmon, Dieter Fox, and Ali Farhadi. IQA: Visual question answering in interactive environments. In CVPR, 2018.
208
+
209
+ Daniel Gordon, Abhishek Kadian, Devi Parikh, Judy Hoffman, and Dhruv Batra. Splitnet: Sim2sim and task2task transfer for embodied visual navigation. ICCV, 2019.
210
+
211
+ Priya Goyal, Piotr Dollar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, ´ Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
212
+
213
+ Saurabh Gupta, James Davidson, Sergey Levine, Rahul Sukthankar, and Jitendra Malik. Cognitive mapping and planning for visual navigation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2616–2625, 2017.
214
+
215
+ 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.
216
+
217
+ Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross Girshick. Mask r-cnn. In ´ Proceedings of the IEEE international conference on computer vision, pp. 2961–2969, 2017.
218
+
219
+ Nicolas Heess, Srinivasan Sriram, Jay Lemmon, Josh Merel, Greg Wayne, Yuval Tassa, Tom Erez, Ziyu Wang, SM Eslami, Martin Riedmiller, et al. Emergence of locomotion behaviours in rich environments. arXiv preprint arXiv:1707.02286, 2017.
220
+
221
+ W Daniel Hillis and Guy L Steele Jr. Data parallel algorithms. Communications of the ACM, 29(12):1170– 1183, 1986.
222
+
223
+ 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.
224
+
225
+ 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.
226
+
227
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
228
+
229
+ Ilya Kostrikov. Pytorch implementations of reinforcement learning algorithms. https://github.com/ ikostrikov/pytorch-a2c-ppo-acktr-gail, 2018.
230
+
231
+ Thorsten Kurth, Sean Treichler, Joshua Romero, Mayur Mudigonda, Nathan Luehr, Everett Phillips, Ankur Mahesh, Michael Matheson, Jack Deslippe, Massimiliano Fatica, et al. Exascale deep learning for climate analytics. In Proceedings of the International Conference for High Performance Computing, Networking, Storage, and Analysis, pp. 51. IEEE Press, 2018.
232
+
233
+ Eric Liang, Richard Liaw, Robert Nishihara, Philipp Moritz, Roy Fox, Ken Goldberg, Joseph E. Gonzalez, Michael I. Jordan, and Ion Stoica. RLlib: Abstractions for distributed reinforcement learning. In International Conference on Machine Learning (ICML), 2018a.
234
+
235
+ Jacky Liang, Viktor Makoviychuk, Ankur Handa, Nuttapong Chentanez, Miles Macklin, and Dieter Fox. Gpuaccelerated robotic simulation for distributed reinforcement learning. In Conference on Robot Learning, pp. 270–282, 2018b.
236
+
237
+ Dmytro Mishkin, Alexey Dosovitskiy, and Vladlen Koltun. Benchmarking classic and learned navigation in complex 3d environments. arXiv preprint arXiv:1901.10915, 2019.
238
+
239
+ OpenAI. Openai five. https://blog.openai.com/openai-five/, 2018.
240
+
241
+ Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, and Michael Auli. fairseq: A fast, extensible toolkit for sequence modeling. arXiv preprint arXiv:1904.01038, 2019.
242
+
243
+ Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in PyTorch. In NIPS Autodiff Workshop, 2017.
244
+
245
+ Matthew E Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. arXiv preprint arXiv:1802.05365, 2018.
246
+
247
+ Manolis Savva, Abhishek Kadian, Oleksandr Maksymets, Yili Zhao, Erik Wijmans, Bhavana Jain, Julian Straub, Jia Liu, Vladlen Koltun, Jitendra Malik, Devi Parikh, and Dhruv Batra. Habitat: A Platform for Embodied AI Research. ICCV, 2019.
248
+
249
+ John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. High-dimensional continuous control using generalized advantage estimation. arXiv preprint arXiv:1506.02438, 2015.
250
+
251
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
252
+
253
+ Alexander Sergeev and Mike Del Balso. Horovod: fast and easy distributed deep learning in TensorFlow. arXiv preprint arXiv:1802.05799, 2018.
254
+
255
+ David Silver, Aja Huang, Christopher J. Maddison, Arthur Guez, Laurent Sifre, George van den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy Lillicrap, Madeleine Leach, Koray Kavukcuoglu, Thore Graepel, and Demis Hassabis. Mastering the game of go with deep neural networks and tree search. Nature, 2016.
256
+
257
+ David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, et al. Mastering the game of go without human knowledge. Nature, 550(7676):354, 2017.
258
+
259
+ Adam Stooke and Pieter Abbeel. Accelerated methods for deep reinforcement learning. arXiv preprint arXiv:1803.02811, 2018.
260
+
261
+ Yuandong Tian, Jerry Ma, Qucheng Gong, Shubho Sengupta, Zhuoyuan Chen, James Pinkerton, and C Lawrence Zitnick. Elf opengo: An analysis and open reimplementation of alphazero. arXiv preprint arXiv:1902.04522, 2019.
262
+
263
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 5026–5033. IEEE, 2012.
264
+
265
+ Erik Wijmans, Samyak Datta, Oleksandr Maksymets, Abhishek Das, Georgia Gkioxari, Stefan Lee, Irfan Essa, Devi Parikh, and Dhruv Batra. Embodied question answering in photorealistic environments with point cloud perception. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6659–6668, 2019.
266
+
267
+ Yuxin Wu and Kaiming He. Group normalization. arXiv preprint arXiv:1803.08494, 2018.
268
+
269
+ Fei Xia, Amir R. Zamir, Zhiyang He, Alexander Sax, Jitendra Malik, and Silvio Savarese. Gibson env: realworld perception for embodied agents. In CVPR, 2018.
270
+
271
+ Saining Xie, Ross Girshick, Piotr Dollar, Zhuowen Tu, and Kaiming He. Aggregated residual transformations ´ for deep neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1492–1500, 2017.
272
+
273
+ ![](images/81c837610c64d0e34826f47afbe2b738e6e256363d65e3ed0343b307afa6c0ac.jpg)
274
+ Figure 6: Example episodes broken down by geodesic distance between agent’s spawn location and target (on rows) vs SPL achieved by the agent (on cols). Gray represents navigable regions on the map while white is non-navigable. The agent begins at the blue square and navigates to the red square. The green line shows the shortest path on the map (or oracle navigation). The blue line shows the agent’s trajectory. The color of the agent’s trajectory changes changes from dark to light over time. Navigation dataset from the longer validation episodes proposed in Chaplot et al. (2019).
275
+
276
+ # A ADDITIONAL ANALYSIS AND DISCUSSION
277
+
278
+ In this section, we continue the analysis of our agent and examine differences in its behavior from a classical, hand-designed agent – the map-and-plan baseline agent proposed in Gupta et al. (2017).
279
+
280
+ Intricacies of SPL. Given an agent that always reaches the goal ${ \approx } 1 0 0 \%$ success), SPL can be seen as measuring the efficiency of an agent vs. an oracle $- i . e .$ . an SPL of 0.95 means the agent is $5 \%$ less efficient than an oracle. Given the challenges of near-perfect autonomous navigation without a map in novel environments we outlined, being $5 \%$ less efficient than an oracle seems near-impossible. However, this comparison/view is potentially miss-leading. Percentage errors are potentially miss-leading for long paths. Over a 10 meter episode, the agent can deviate from the oracle path by up-to a meter and still be within $10 \%$ . As a consequence, significant qualitative errors can result in an insignificant quantitative error (see Fig. 6).
281
+
282
+ Error recovery. Given the near-perfect performance of our agent (on average), we explicitly examine if it is able to recover from its own navigation errors. Fig. 6 column 3 shows several examples of error recovery, including several well executed backtracks (video: https://www.youtube.com/watch?v=a8AugVLSJ50), indicating that the agent is effective at recovering from its own navigation errors. Next, we look at the statistics of non-perfect ${ \mathrm { \ S P L { < } } } 0 . 9 9 $ ) episodes on the longer validation episodes proposed in Chaplot et al. (2019). Non-perfect episodes make up the majority of episodes $54 \%$ , see Fig. 7) with an average SPL of 0.85 $9 9 . 0 \%$ success) – compared to 0.92 SPL $9 9 . 5 \%$ success) over all episodes. Thus there are many episodes where the agent makes significant deviation from the shortest path and reaches the goal (a $15 \%$ deviation on long trajectories $( > 1 0 \mathrm { m } )$ is significant).
283
+
284
+ ![](images/63d58cd2df8d1f4b8cef78bfd5f321c6b966a92873e1041b58c5adc14208a446.jpg)
285
+ Figure 7: Histogram of SPL for non-perfect (S $\mathrm { ; P L } { < } 0 . 9 9 $ ) episodes.
286
+
287
+ When does the agent fail? Column 2 in Fig. 6 shows that the agent performs poorly when the ratio of the geodesic distance to goal and euclidean distance to goal. However, the agent is able to eventually overcome this failure mode and reach the goal in most cases.
288
+
289
+ Row 1 column 1 in Fig. 6 shows that the agent fails or performs poorly when it needs to go slightly up/down stairs. The data-set generation process used in Savva et al. (2019) only guarantees a start and goal pair won’t be on different floors, but there remains a possibility that the agent will need to traverse the stairs slightly. However, these situations are rare, and, in general, the stairs should be avoided. Furthermore, the GPS sensor provides location in 2D, not 3D.
290
+
291
+ The remaining failure cases of column 1 in Fig. 6 show that a singular location in one environment acts as a sink for the agent (once it enters this location, it is almost never able to leave it). At this location, there is a large hole in the mesh (an entire wall is missing). Utilizing visual encoders that explicitly handle missing values may allow the agent to overcome this failure mode.
292
+
293
+ Differences from a classical agent. We compare the behavior of our agent with the classical mapand-plan baseline agent proposed in Gupta et al. (2017). This agent achieves 0.92 val (0.89 test) SPL with 0.976 success.8 By comparing and contrasting qualitative behaviors, we can determine what behaviors learning-based methods enable. We make the following observation.
294
+
295
+ The learned agent is able to recover from unexpected collisions without hurting SPL. The mapand-plan baseline agent incorporates a specific collision recovery behavior where, after repeated collisions, the agent turns around and backs up $1 . 2 5 \mathrm { m }$ . This behavior brings the obstacle into view, maps it, and then allows the agent to create a plan to avoid it. In contrast, our agent is able to navigate around unseen obstacles without such a large impact on SPL. Determining the set of action sequences and heuristics necessary to do this is what learning enables.
296
+
297
+ # B RELATED WORK CONTINUED
298
+
299
+ Straggler Effect Mitigation. In supervised learning, the straggler effect is commonly caused by heterogeneous hardware or hardware failures. Chen et al. (2016) propose a pool of $b$ “back-up” workers (there are $N + b$ workers total) and perform the parameter update once $N$ workers finish. In comparison, their method a) requires a parameter server, and b) discards all work done by the stragglers. Chen et al. (2018) propose to dynamically adjust the batch size of each worker such that all workers perform their forward and backward pass in the same amount of time. Our method aims to reduce variance in experience collection times. DD-PPO dynamically adjusts a worker’s batch size as a necessary side-effect of preempting experience collection in on-policy RL.
300
+
301
+ Distributed Synchronous SGD. Data parallelism is a common paradigm in high performance computing (Hillis & Steele Jr, 1986). In this paradigm, parallelism is achieved by workers performing the same work on different data. This paradigm can be naturally adapted to supervised deep learning (Chen et al., 2016). Works have used this to achieve state-of-the-art results in tasks ranging from computer vision (Goyal et al., 2017; He et al., 2017) to natural language processing (Peters et al., 2018; Devlin et al., 2018; Ott et al., 2019). Furthermore, multiple deep learning frameworks provide simple-to-use wrappers supporting this parallelism model (Paszke et al., 2017; Abadi et al., 2015; Sergeev & Balso, 2018). We adapt this framework to reinforcement learning.
302
+
303
+ # C AGENT DESIGN
304
+
305
+ In this section, we outline the exact agent design we use. We break the agent into three components: a visual encoder, a goal encoder, and a navigation policy.
306
+
307
+ Visual Encoder. Out visual encoder uses one of three different backbones, ResNet50 (He et al., 2016), Squeeze-Excite(SE) (Hu et al., 2018)-ResNeXt50 (Xie et al., 2017), and SE-ResNeXt101. For all backbones, we reduce the number of output channels at each layer by half. We also add a 2x2-AvgPool before each backbone so that the effective resolution is 128x128. Given these modifications, each backbone produces a 1024x4x4 feature map. We then convert this to a 128x4x4 feature map with a 3x3-Conv.
308
+
309
+ We replace every BatchNorm layer with GroupNorm (Wu & He, 2018) to account for the highly correlated trajectories seen in on-policy RL and massively distributed training.
310
+
311
+ ![](images/b144c3f28a4d7d1f698e1ae00b22e8bf5d00c1424e34b32573287b7200215b45.jpg)
312
+ Figure 8: Scaling of DD-PPO under homogeneous and heterogeneous workloads for various different values of the percentage of rollouts that are fully completed by optimizing the model. Shading represents a bootstrapped $9 5 \%$ confidence interval.
313
+
314
+ Goal encoder. Habitat (Savva et al., 2019) provides the vector pointing to the goal in ego-centric polar coordinates. We convert this to magnitude and a unit vector, i.e. [d, $\theta ]$ to [d, $\cos ( \theta )$ , $\sin ( \theta ) ]$ , to account for the discontinuity at the $x$ -axis in polar coordinates. We pass the goal vector to a fully connected layer, resulting in a 32-dimensional representation.
315
+
316
+ Navigation Policy. Our navigation policy takes the $6 4 \times 4 \times 4$ feature map from the visual encoder, flattens it, and then converts the 2048-d vector to the same size as the hidden size via a fully-connected layer. It then concatenates this vector with output of the goal encoder, and a 32-dimensional embedding of the previous action taken (or the start-token in the case of the first action) and then passes this to a 2-layer LSTM with either a 512-dimensional or 1024-dimensional hidden dimension. The output of the LSTM is used as input to a fully connected layer, resulting in a soft-max distribution of the action space and an estimate of the value function.
317
+
318
+ # D ADDITIONAL SCALING DETAILS
319
+
320
+ We use the following procedure for benchmarking the throughput of our proposed DD-PPO: Each optimizer selects 4 scenes at random and then performs the process of collecting experience and optimizing the model based on that experience 10 times. We calculate throughput as the total number of steps of experience collected over the last 5 rollout/optimizing steps divided by the amount of time taken. We repeat this procedure over 10 different random seeds (we use the same random seeds for all variations of number of GPUs and sync-fraction values).
321
+
322
+ # E DD-PPO IMPLEMENTATION
323
+
324
+ Utilizing Distributed Data Parallel in supervised learning is straightforward as frameworks such as PyTorch (Paszke et al., 2017) provide a simple wrapper. The recommended way to use these wrappers is to first write training code that runs on a single GPU and then enable distributed training via the wrapper. We follow a similar approach. Given an implementation of
325
+
326
+ Table 2: Performance (higher is better) of various sensors and agent methods on the Habitat Challenge 2019 (Savva et al., 2019) validation and test splits (checkpoint selected on val). Random, Forward-only, and Goal-follower taken from Savva et al. (2019). Best visual encoder reported for DD-PPO.
327
+
328
+ <table><tr><td rowspan="2">Perception</td><td rowspan="2">Method</td><td colspan="2">Validation</td><td colspan="2">Test Standard</td></tr><tr><td>SPL</td><td>Success</td><td>SPL</td><td>Success</td></tr><tr><td rowspan="4">Blind</td><td>Random</td><td>0.02</td><td>0.03</td><td>0.02</td><td>1</td></tr><tr><td>Forward-only</td><td>0.00</td><td>0.00</td><td>0.00</td><td>1</td></tr><tr><td>Goal-follower</td><td>0.23</td><td>0.23</td><td>0.23</td><td>1</td></tr><tr><td>DD-PPO (RL)</td><td>0.729 ± 0.005</td><td>0.973 ± 0.003</td><td>0.676</td><td>0.947</td></tr><tr><td>RGB</td><td>DD-PPO (RL)</td><td>0.929 ± 0.003</td><td>0.991 ± 0.002</td><td>0.920</td><td>0.977</td></tr><tr><td>RGB-D (Depth)</td><td>DD-PPO (RL)</td><td>0.969 ± 0.002</td><td>0.997 ± 0.001</td><td>0.948</td><td>0.980</td></tr></table>
329
+
330
+ PPO that runs on one GPU we create a decentralized distributed variant by adding gradient synchronization, leveraging highly performant code written for this purpose in popular deep-learning frameworks, e.g. tf.distribute.MirroredStrategy in TensorFlow (Abadi et al., 2015) and torch.nn.parallel.DistributedDataParallel in PyTorch. Note that care must be taken to synchronize any training or rollout statistics between workers – in most cases these can also be synchronized via AllReduce.
331
+
332
+ We track how many workers have finished the experience collection stage with a distributed keyvalue storage – we use PyTorch’s torch.distributed.TCPStore, however almost any distributed key-value storage would be sufficient.
333
+
334
+ See Fig. 9 for an example implementation which adds 1) gradient synchronization via torch.nn.parallel.DistributedDataParallel, and 2) preempts stragglers by tracking the number of workers have finished the experience collection stage with a torch.distributed.TCPStore.
335
+
336
+ See Fig. 10 for a visual depiction of DD-PPO.
337
+
338
+ # F TRANSFER EXPERIMENTS ADDITIONAL DETAILS
339
+
340
+ For the transfer learning experiments, we utilize the same PPO hyper-parameters as the PointGoalNav experiments. We use DD-PPO to train with 8 workers on 8 GPUs. We train our agents on Gibson- $^ { . 4 + }$ and evaluate on the Habitat Challenge 2019 Validation scene and starting locations (the goal location is simply discarded).
341
+
342
+ The ImageNet encoder is trained using the same hyper-parameters and training procedure as Xie et al. (2017) with no data-augmentation.
343
+
344
+ # G NEURAL CONTROLLER ADDITIONAL DETAILS
345
+
346
+ The planner for neural controller used in Sec. 6 shares the same architecture as our agent’s policy, but utilizes a 512-d hidden state. It takes as input the previous action of the controller (or the start token), and the output of the visual encoder (which is shared with the controller). The output of the LSTM is then used to produced an estimate of the value function and a 3-dimensional vector specifying the PointGoal in magnitude and unit direction vector format. The magnitude competent is passed through an ELU activation and offset by 0.75. Each component of the unit direction vector is passed through a tanh activation – note that we do not re-normalize this vector have a length of 1 as we find doing so both unnecessary and harder to optimize.
347
+
348
+ ![](images/09aedb209ebc7a0632dd4fb2613d9e9c2ffd4f40b36fe80a2ff6738e63925f03.jpg)
349
+ Figure 9: Implementation of DD-PPO using PyTorch (Paszke et al., 2017) v1.1 and the NCCL backend. We use SLURM to populate the world rank, world size, and local rank fields.
350
+
351
+ ![](images/548a7b1636c4069fa10ecafdb847ecaa144309bb2924a4be4a9b9235dc06bf67.jpg)
352
+ Figure 10: Illustration of DD-PPO. Processes collecting experience in environments that are more costly to simulate (stragglers) have their experience collection stage preempted such that other processes do not have to wait for them. Note that we implement the monitor with a simple key-value storage and have processes preempt themselves. Note that the order of processes is irrelevant and done solely for aesthetic purposes.
353
+
354
+ ![](images/feecc15c6e42afc065761488dc668b9410f131d8a32b24553b8830bc13dee11f.jpg)
355
+ 2: big holes or significant texture issues, but good reconstruction
356
+
357
+ ![](images/238990f692e58257508b5a837c9a392c6cfb81286f98ed9ee1f5420f912f4545.jpg)
358
+ 3: small holes, some texture issues, good reconstruction
359
+
360
+ ![](images/cf91fd17d0f210f1d58b53676e9e03f2fd37699470a52f36eddb58fe8baeb331.jpg)
361
+
362
+ ![](images/a5e2e679c00c83f03d488f0cb714e28c3a397dd6e78d46506d2ff9990e6aeca6.jpg)
363
+
364
+ 4: no holes, some texture issues, good reconstruction
365
+
366
+ Figure 11: Examples of Gibson meshes for a given quality rating from Savva et al. (2019)
367
+
368
+ ![](images/11d28acfcfc73db15805e66b4444d205e36f47717fcf3ee6a14865fb35e1e59b.jpg)
369
+ Figure 12: Training and validation performance (in SPL; higher is better) of different architectures for Depth agents with $\mathrm { G P S } { + }$ Compass on the Habitat Challenge 2019 (Savva et al., 2019). Gibson (Xia et al., 2018)- $^ { . 4 + }$ refers to the subset of Gibson train scenes with a quality rating of 4 or better. Gibson- $^ { . 4 + }$ and MP3D refers to training on both Gibson- $^ { . 4 + }$ and all of Matterport3D. Gibson$^ { 2 + }$ refers to training on the subset of Gibson train scenes with a quality rating of 2 or better.
370
+
371
+ ![](images/caa878e17343d85a028e79410d5c25d85bad02b79e6abee9f14f813eb0e258da.jpg)
372
+ Figure 13: Performance vs. Geodesic Distance from start to goal for Blind, RGB, and RGB-D (using Depth only) models trained with DD-PPO on the Habitat Challenge 2019 (Savva et al., 2019) validation split. Bars at the bottom represent the fraction of episodes within each geodesic distance bin.
373
+
374
+ ![](images/99f5a5fc9997891ca3846c5e4879e1ea272013650165d78b65e0d27cdeac44c6.jpg)
375
+ Figure 14: Performance vs. Geodesic Distance from start to goal for Blind, RGB, and RGB-D (using Depth only) models trained with DD-PPO on the longer and harder validation episodes proposed in Chaplot et al. (2019). Bars at the bottom represent the fraction of episodes within each geodesic distance bin.
md/train/HJGkisCcKm/HJGkisCcKm.md ADDED
@@ -0,0 +1,260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A UNIVERSAL MUSIC TRANSLATION NETWORK
2
+
3
+ Noam Mor Facebook AI Research noam.mor@gmail.com
4
+
5
+ Lior Wolf & Adam Polyak Facebook AI Research & Tel Aviv Uni. wolf,adampolyak@fb.com
6
+
7
+ Yaniv Taigman Facebook AI Research yaniv@fb.com
8
+
9
+ # ABSTRACT
10
+
11
+ We present a method for translating music across musical instruments and styles. This method is based on unsupervised training of a multi-domain wavenet autoencoder, with a shared encoder and a domain-independent latent space that is trained end-to-end on waveforms. Employing a diverse training dataset and large net capacity, the single encoder allows us to translate also from musical domains that were not seen during training. We evaluate our method on a dataset collected from professional musicians, and achieve convincing translations. We also study the properties of the obtained translation and demonstrate translating even from a whistle, potentially enabling the creation of instrumental music by untrained humans.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Humans have always created music and replicated it – whether it is by singing, whistling, clapping, or, after some training, playing improvised or standard musical instruments. This ability is not unique to us, and there are many other vocal mimicking species that are able to repeat music from hearing. Music is also one of the first domains to be digitized and processed by modern computers and algorithms. It is, therefore, somewhat surprising that in the core music task of mimicry, AI is still much inferior to biological systems.
16
+
17
+ In this work, we present a novel way to produce convincing musical translation between instruments and styles. For example1, we convert the audio of a Mozart symphony performed by an orchestra to an audio in the style of a pianist playing Beethoven. Our ability builds upon two technologies that have recently become available: (i) the ability to synthesize high quality audio using autoregressive models, and (ii) the recent advent of methods that transform between domains in an unsupervised way. The first technology allows us to generate high quality and realistic audio and thanks to the teacher forcing technique, autoregressive models are efficiently trained as decoders. The second family of technologies contributes to the practicality of the solution, since posing the learning problem in the supervised setting, would require a parallel dataset of different musical instruments.
18
+
19
+ In our architecture, we employ a single, universal, encoder and apply it to all inputs (universal here means that a single encoder can address all input music, allowing us to achieve capabilities that are known as universal translation). In addition to the advantage of training fewer networks, this also enables us to convert from musical domains that were not heard during training to any of the domains encountered.
20
+
21
+ The key to being able to train a single encoder architecture, is making sure that the domain-specific information is not encoded. We do this using a domain confusion network that provides an adversarial signal to the encoder. In addition, it is important for the encoder not to memorize the input signal but to encode it in a semantic way. We achieve this by distorting the input audio by random local pitch modulation. During training, the network is trained as a denoising autoencoder, which recovers the undistorted version of the original input. Since the distorted input is no longer in the musical domain of the output, the network learns to project out-of-domain inputs to the desired output domain. In addition, the network no longer benefits from memorizing the input signal and employs a higher-level encoding.
22
+
23
+ Asked to convert one musical instrument to another, our network shows a level of performance that seems to approach that of musicians. When controlling for audio quality, which is still lower for generated music, it is many times hard to tell which is the original audio file and which is the output of the conversion that mimics a completely different instrument. The network is also able to successfully process unseen musical instruments such as drums, or other sources, such as whistles.
24
+
25
+ # 2 PREVIOUS WORK
26
+
27
+ Domain Transfer Recently, there has been a considerable amount of work, mostly on images and text, which performs unsupervised translation between domains $\mathcal { A }$ and $\boldsymbol { B }$ , without being shown any matching pairs, i.e., in a completely unsupervised way. Almost all of this work employs GAN constraints (Goodfellow et al., 2014), in order to ensure a high level of indistinguishability between the translations of samples in $A$ and samples from the domain $B$ . In our work, the output is generated by an autoregressive model and training takes place using the ground truth output of the previous time steps (“teacher forcing”), instead of the predicted ones. A complete autoregressive inference is only done during test time, and it is not practical to apply such inference during training in order to get a realistic generated (“fake”) sample for the purpose of training the GAN.
28
+
29
+ Another popular constraint is that of circularity, namely that by mapping from $\mathcal { A }$ to $\boldsymbol { B }$ and back to $\mathcal { A }$ a reconstruction of the original sample is obtained (Kim et al., 2017; Zhu et al., 2017; Yi et al., 2017). In our work, for the same reason mentioned above, the output during training does not represent the future test time output, and such a constraint is unrealistic. An application of circularity in audio was present in (Kaneko & Kameoka, 2017), where a non-autoregressive model between vocoder features is used to convert between voices in an unsupervised way.
30
+
31
+ Cross domain translation is not restricted to a single pair of domains. The recent StarGAN (Choi et al., 2017) method creates multiple cycles for mapping between multiple (more than two) domains. The method employs a single generator that receives as input the source image as well as the specification of the target domain. It then produces the analog “fake” image from the target domain. Our work employs multiple decoders, one per domain, and attempts to condition a single decoder on the selection of the output domain failed to produce convincing results.
32
+
33
+ UNIT (Liu et al., 2017) employs an encoder-decoder pair per each domain, where the latent spaces of the domains are assumed to be shared. This is achieved by sharing the network layers that are distant from the image (the top layers of the encoder and the bottom layers of the decoder), similarly to CoGAN (Liu & Tuzel, 2016). Cycle-consistency is also added, and structure is added to the latent space using a variational autoencoder (Kingma & Welling, 2014) loss terms. Our method employs a single encoder, which eliminates the need for many of the associated constraints. In addition, we do not impose a VAE loss term (Kingma & Welling, 2014) on the latent space of the encodings and instead employ a domain confusion loss (Ganin et al., 2016). The work of Louizos et al. (2015) investigates the problem of learning invariant representations by employing the Maximum Mean Discrepancy (MMD), which we do not use.
34
+
35
+ Audio Synthesis WaveNet (van den Oord et al., 2016) is an autoregressive model that predicts the probability distribution of the next sample, given the previous samples and an input conditioning signal. Its generated output is currently considered of the highest naturalness, and is applied in a range of tasks. In (Rethage et al., 2017), the authors have used it for denoising waveforms by predicting the middle ground-truth sample from its noisy input support. Recent contributions in Text-To-Speech(TTS) (Ping et al., 2018; Shen et al., 2018) have successfully conditioned wavenet on linguistic and acoustic features to obtain state of the art performance.
36
+
37
+ In VQ-VAE (van den Oord et al., 2017), voice conversion was obtained by employing a variational autoencoder that produces a quantized latent space that is conditioned on the speaker identity. Similar to our work, the decoder is based on WaveNet. However, we impose a greater constraint on the latent space by (a) having a universal encoder, forcing the embeddings of all domains to lie in the same space, yet (b) training a separate reconstructing decoder for each domain, provided that (c) the latent space is domain independent, thereby reducing source-target pathways memorization, which is also accomplished by (d) employing augmentation to distort the input signal. Invariance is achieved in VQ-VAE through the strong bottleneck effect achieved by discretization. Despite some effort, we were not able to use a discrete latent space here.
38
+
39
+ ![](images/8b9792730bd1bbfaf4808011743662447a7857a2b456112cf8a61abcd73a70b2.jpg)
40
+ Figure 1: (a) The schematic architecture of our translation network. The confusion term (marked by the dashed line) is employed only during training. $E$ is the shared encoder, $C$ is the domain classification network employed in the domain confusion term, $D ^ { i }$ are the various decoders. (b) A detailed depiction of our architecture. ‘NC’ indicates non-causal convolution. ‘1x1’ indicates a 1-D convolution with kernel size 1.
41
+
42
+ Recently, Dieleman et al. (2018) explored discretization as a method to capture long-range dependencies in unconditioned music generation, for up to 24 seconds. We focus on translation, and the conditioning on the source signal carries some long-range information on the development of the music. Consider an analogy to a myopic language translation system, where the input is a story in English and the output is a story in Spanish. Even if the translation occurs one sentence at a time, the main theme of the story is carried by the “conditioning” on the source text.
43
+
44
+ The architecture of the autoencoder we employ is the wavenet-autoencoder presented in (Engel et al., 2017). In comparison to this work, our inputs are not controlled and are collected from consumer media. Our overall architecture differs in that multiple decoders and an additional auxiliary network, which is used for disentangling the domain information from the other aspects of the music representation, are trained and by the addition of an important augmentation step.
45
+
46
+ In the supervised learning domain, an audio style transfer between source and target spectrograms was performed with sequence-to-sequence recurrent networks (Haque et al., 2018). This method requires matching pairs of samples played on different instruments. In another fully supervised work (Hadjeres & Pachet, 2017), a graphical model aimed at modeling polyphonic tones of Bach was trained on notes, capturing the specificity of Bach’s chorales. This model is based on RNNs and requires a large corpus of notes of a particular instrument produced with a music editor.
47
+
48
+ Style Transfer Style transfer is often confused with domain translation and the distinction is not always clear. In the task of style transfer, the “content” remains the same between the input and the output, but the ”style” is modified. Notable contributions in the field include (Gatys et al., 2016; Ulyanov et al., 2016; Johnson et al., 2016), which synthesize a new image that minimizes the content loss with respect to the content-donor sample and the style loss with respect to one or more samples of a certain style. The content loss is based on comparing the activations of a network training for an image categorization task. The style loss compares the statistics of the activations in various layers of the categorization layer. An attempt at audio style transfer is described in (Barry & Kim, 2018).
49
+
50
+ Concatenative Synthesis In the computer music and audio effects literature, the conversion task we aim to solve is tackled by concatenating together short pieces of audio from the target domain, such that the output audio resembles the input audio from the source domain Verfaille & Arfib (2000); Schwarz (2006); Zils & Pachet (2001); Simon et al. (2005). The method has been extensively researched, see the previous work section of Nuanain et al. (2017) and the online resource of Schwarz ´ (2018). A direct comparison to such methods is challenging, since many of the methods have elaborate interfaces with many tunable parameters that vary from one conversion task to the next. To the extent possible, we compare with some of the published results in Sec. 4.2, obtaining what we believe to be clearly superior results.
51
+
52
+ # 3 METHOD
53
+
54
+ Our domain translation method is based on training multiple autoencoder pathways, one per musical domain, such that the encoders are shared. During training, a softmax-based reconstruction loss is applied to each domain separately. The input data is randomly augmented, prior to applying the encoder, in order to force the network to extract high-level semantic features, instead of simply memorizing the data. In addition, a domain confusion loss (Ganin et al., 2016) is applied to the latent space to ensure that the encoding is not domain-specific. A diagram of the translation architecture is shown in Fig. 1 (a).
55
+
56
+ # 3.1 WAVENET AUTOENCODER
57
+
58
+ We reuse an existing autoencoder architecture that is based on a WaveNet decoder and a WaveNetlike dilated convolution encoder (Engel et al., 2017). The WaveNet of each decoder is conditioned on the latent representation produced by the encoder. In order to reduce the inferencetime, the nv-wavenet CUDA kernels provided by NVIDIA ( https://github.com/NVIDIA/ nv-wavenet) were used after modification to better match the architecture suggested by van den Oord et al. (2016), as described below.
59
+
60
+ The encoder is a fully convolutional network that can be applied to any sequence length. The network has three blocks of ten residual-layers, a total of thirty layers. Each residual-layer contains a RELU nonlinearity, a non-causal dilated convolution with an increasing kernel size, a second RELU, and a $1 \times 1$ convolution followed by the residual summation of the activations before the first RELU. There is a fixed width of 128 channels. After the three blocks, there is an additional $1 \times 1$ layer. An average pooling with a kernel size of 50 milliseconds (800 samples) follows in order to obtain an encoding in $\mathbb { R } ^ { 6 \bar { 4 } }$ , which implies a temporal down sampling by a factor of $\times 1 2 . 5$ .
61
+
62
+ The encoding is upsampled temporally to the original audio rate, using nearest neighbor interpolation and is used to condition a WaveNet decoder. The conditioning signal is passed through a $1 \times 1$ layer that is different for each WaveNet layer. The audio (both input and output) is quantized using 8-bit mu-law encoding, similarly to both (van den Oord et al., 2016; Engel et al., 2017), which results in some inherent loss of quality. The WaveNet decoder has either four blocks of 10 residual-layers and a resulting receptive field of 250 milliseconds (4,093 samples), as in Engel et al. (2017), or 14 layer blocks and a much larger receptive field of 4 seconds. Each residual-layer contains a causal dilated convolution with an increasing kernel size, a gated hyperbolic tangent activation, a $1 \times 1$ convolution followed by the residual summation of the layer input, and a $1 \times 1$ convolution layer which introduces a skip connection. Each residual-layer is conditioned on the encoding described above. The summed skip connections are passed through two fully connected layers and a softmax activation to output the next timestep probability. A detailed diagram of the WaveNet autoencoder is shown in Fig. 1 (b).
63
+
64
+ We modify the fast nv-wavenet CUDA inference kernels, which implement the architecture suggested by Ping et al. (2018), and create efficient WaveNet kernels that implement the WaveNet architecture suggested by Engel et al. (2017). Specifically, we make the following modifications to nv-wavenet: (i) we add initialization of skip connections with previous WAV samples, (ii) we increase the kernel capacity to support 128 residual channels and (iii) we also add the conditioning to the last fully connected layer.
65
+
66
+ # 3.2 AUDIO INPUT AUGMENTATION
67
+
68
+ In order to improve the generalization capability of the encoder, as well as to enforce it to maintain higher-level information, we employ a dedicated augmentation procedure that changes the pitch locally. The resulting audio is of a similar quality but is slightly out of tune.
69
+
70
+ Specifically, we perform our training on segments of one second length. For augmentation, we uniformly select a segment of length between 0.25 and 0.5 seconds, and modulate its pitch by a random number between -0.5 and 0.5 of half-steps, using librosa (McFee et al., 2015).
71
+
72
+ # 3.3 TRAINING AND THE LOSSES USED
73
+
74
+ Let $s ^ { j }$ be an input sample from domain $j = 1 , 2 , \dots , k ,$ $k$ being the number of domains employed during training. Let $E$ be the shared encoder, and $D ^ { j }$ the WaveNet decoder for domain $j$ . Let $C$ be the domain classification network, and $O ( s , r )$ be the random augmentation procedure applied to a sample $s$ with a random seed $r$ .
75
+
76
+ The network $C$ predicts which domain the input data came from, based on the latent vectors. It applies three 1D-convolution layers, with the ELU (Clevert et al., 2017) nonlinearity. The last layer projects the vectors to dimension $k$ and the vectors are subsequently averaged to a single $\mathbb { R } ^ { k }$ vector. A detailed diagram of network $C$ is shown as part of Fig. 1 (b).
77
+
78
+ During training, the domain classification network $C$ minimizes the classification loss
79
+
80
+ $$
81
+ \Omega = \sum _ { j } \sum _ { s ^ { j } } \operatorname { \mathbb { E } } _ { r } \mathcal { L } ( C ( E ( O ( s ^ { j } , r ) ) ) , j ) ,
82
+ $$
83
+
84
+ and the music to music autoencoders $j = 1 , 2 , \dots$ are trained with the loss
85
+
86
+ $$
87
+ - \lambda \Omega + \sum _ { j } \sum _ { s ^ { j } } \operatorname { \mathbb { E } } \mathcal { L } ( D ^ { j } ( E ( O ( s ^ { j } , r ) ) ) , s ^ { j } )
88
+ $$
89
+
90
+ where $\mathcal { L } ( o , y )$ is the cross entropy loss applied to each element of the output $o$ and the corresponding element of the target $y$ separately. Note that the decoder $D ^ { j }$ is an autoregressive model that is conditioned on the output of $E$ . During training, the autoregressive model is fed the target output $s ^ { j }$ from the previous time-step, instead of the generated output.
91
+
92
+ # 3.4 NETWORK DURING INFERENCE
93
+
94
+ To perform the actual transformation from a sample $s$ from any domain, even from an unseen musical domain, to output domain $j$ , we apply the autoencoder of domain $j$ to it, without applying the distortion. The new sample $\hat { s } ^ { j }$ is, therefore, given as $D ^ { j } ( E ( s ) )$ . The bottleneck during inference is the WaveNet autoregressive process, which is optimized by the dedicated CUDA kernels.
95
+
96
+ # 4 EXPERIMENTS
97
+
98
+ We conduct music translation experiments, using a mix of human evaluation and qualitative analysis, in order to overcome the challenges of evaluating generative models. The experiments were done in two phases. In the first phase, described in an earlier technical report (Mor et al., 2018), we train our network on six arbitrary classical musical domains: (i) Mozart’s symphonies conducted by Karl Bohm, (ii) Haydn’s string quartets, performed by the Amadeus Quartet, (iii) J.S Bach’s cantatas for ¨ orchestra, chorus and soloists, (iv) J.S Bach’s organ works, (v) Beethoven’s piano sonatas, performed by Daniel Barenboim, and (vi) J.S Bach’s keyboard works, played on Harpsichord. The music recordings by Bach (iii,iv,vi) are from the Teldec 2000 Complete Bach collection.
99
+
100
+ In the second phase, in order to allow reproducibility and sharing of the code and models, we train on audio data from MusicNET (Thickstun et al., 2017). Domains were chosen as the largest domains that show variability between composers and instruments. The following six domains were selected: (i) J.S Bach’s suites for cello, (ii) Beethoven’s piano sonatas, (iii) Cambini’s Wind Quintet, (iv) J.S Bach’s fugues, played on piano, (v) Beethoven’s violin sonatas and (vi) Beethoven’s string quartet. This public dataset is somewhat smaller than the data used in phase one.
101
+
102
+ The phases differ in the depth of the decoders: in the first phase, we employed blocks of ten layers, while in the second, we shifted to larger receptive fields and blocks of 14. The training and test splits are strictly separated by dividing the tracks (or audio files) between the two sets. The segments used in the evaluation experiments below were not seen during training. During training, we iterate over the training domains, such that each training batch contains 16 randomly sampled one second samples from a single domain. Each batch is first used to train the domain classification network $C$ , and then to train the universal encoder and the domain decoder, given the updated discriminator.
103
+
104
+ The method was implemented in the PyTorch framework, and trained on eight Tesla V100 GPUs for a total of 6 days. We used the ADAM optimization algorithm with a learning rate of $1 0 ^ { - 3 }$ and a decay factor of 0.98 every 10,000 samples. We weighted the confusion loss with $\lambda = 1 0 ^ { - 2 }$ .
105
+
106
+ Table 1: MOS scores (mean $\pm$ SD) for the conversion tasks.
107
+
108
+ <table><tr><td rowspan="2">Converter</td><td colspan="2">Harpsichord→Piano</td><td colspan="2">Orchestra-→ Piano</td><td colspan="2">New domains-→ Piano</td></tr><tr><td>Audio quality</td><td>Translation success</td><td>Audio quality</td><td>Translation success</td><td>Audio quality</td><td>Translation success</td></tr><tr><td>Musician E</td><td>3.89 ± 1.06</td><td>4.10± 0.94</td><td>4.02± 0.81</td><td>4.12± 0.97</td><td>4.44±0.82</td><td>4.13± 0.83</td></tr><tr><td>Musician M</td><td>3.82 ± 1.18</td><td>3.75± 1.17</td><td>4.13± 0.89</td><td>4.12± 0.98</td><td>4.48±0.72</td><td>3.97± 0.88</td></tr><tr><td>Musician A</td><td>3.69 ± 1.08</td><td>3.91± 1.16</td><td>4.06± 0.86</td><td>3.99± 1.08</td><td>4.53±0.79</td><td>3.93± 0.95</td></tr><tr><td>Our</td><td>2.95 ± 1.18</td><td>3.07± 1.30</td><td>2.56± 1.04</td><td>2.86± 1.16</td><td>2.36±1.17</td><td>3.18± 1.14</td></tr></table>
109
+
110
+ # 4.1 EVALUATION OF TRANSLATION QUALITY
111
+
112
+ The first set of experiments compared the method to human musicians using the phase one network. Since human musicians, are equipped by evolution with music skills, selected among their peers according to their talent, and who have trained for decades, we do not expect to do better than humans at this point. To perform this comparsion, music from domain $X$ was converted to piano, for various $X$ . The piano was selected for practical reasons: pianists are in higher availability than other musicians and a piano is easier to produce than, e.g., an orchestra.
113
+
114
+ Three professional musicians with a diverse background were employed for the conversion task: E, who is a conservatory graduate with an extensive background in music theory and piano performance, and also specializes in transcribing music; M, who is a professional producer, composer, pianist and audio engineer, who is an expert in musical transcription; and A who is a music producer, editor, and a skilled player of keyboards and other instruments.
115
+
116
+ The task used for comparison was to convert 60 segments of five seconds each to piano. Three varied sources were used. 20 of the segments were from Bach’s keyboard works, played on a Harpsichord, and 20 others were from Mozart’s 46 symphonies conducted by Karl Bohm, which are ¨ orchestral works. The last group of 20 segments was a mix of three different domains that were not encountered during training – Swing Jazz, metal guitar riffs, and instrumental Chinese music. The 60 music segments were encoded by the universal encoder and decoded by the WaveNet trained on Beethoven’s piano sonatas, as performed by Daniel Barenboim.
117
+
118
+ In order to compare between the conversions, we employed human evaluation, which is subjective and could be a mix of the assessment of the audio quality and the assessment of the translation itself. This limits the success of the automatic method, since the quality of the algorithm’s output is upper bounded by the neural network architecture and cannot match that of a high quality recording.
119
+
120
+ Since there is a trade-off between the fidelity to the original piece and the ability to create audio in the target domain, we present two scores: audio quality of the output piano and a matching score for the translation. While one can argue that style is hard to define and, therefore, such subjective experiments are not well founded, there are many similar MOS experiments in image to image translation, e.g., (Lample et al., 2017), and indeed MOS studies are used exactly where the translation metric is perceptual and subjective.
121
+
122
+ Specifically, Mean Opinion Scores (MOS) were collected using the CrowdMOS (Ribeiro et al., 2011) package. Two questions were asked: (1) what is the quality of the audio, and (2) how well does the converted version match the original. The results are shown in Tab. 1. It shows that our audio quality is considerably lower than the results produced by humans, using a keyboard connected to a computer (which should be rated as near perfect and makes any other audio quality in the MOS experiment pale in comparison). Regarding the translation success, the conversion from Harpsichord is better than the conversion from Orchestra. Surprisingly, the conversion from unseen domains is more successful than both these domains. In all three cases, our system is outperformed by the human musicians, whose conversions will soon be released to form a public benchmark.
123
+
124
+ Lineup experiment In another set of experiments, we evaluate the ability of persons to identify the source musical segment from the conversions. We present, in each test, a set of six segments. One segment is a real segment from a random domain out of the ones used to train our network, and five are the associated translations. We shuffle the segments and ask which is the original one and which are conversions. To equate the quality of the source to that of the translations and prevent identification by quality, we attach the source after passing it through its domain’s autoencoder.
125
+
126
+ ![](images/293098298e93b1a6e0ff4c825ebfca2e556ed1d935525d1d4f333f50890f2a8e.jpg)
127
+ Figure 2: Results of the lineup experiment. (a) listeners from the general population tend to select the same domain as the source regardless of the actual source. (b) the musician A failed to identify the source most of the time. (c) the amateurs T and (d) S failed most of the time.
128
+
129
+ The translation is perfectly authentic, if the distribution of answers is uniform. However, the task is hard to define. In a first attempt, Amazon Mechanical Turk (AMT) freelancers tended to choose the Mozart domain as the source, regardless of the real source and the presentation order, probably due to its relatively complex nature in comparison to the other domains. This is shown in the confusion matrix of Fig. 2(a). We, therefore, asked two amateur musicians (T, a guitarist, and S a dancer and a drummer with a background in piano) and the professional musician A (from the first experiment) to identify the source sample out of the six options, based on authenticity.
130
+
131
+ The results, in Fig. 2(b-d) show that there is a great amount of confusion. T and A failed in most cases, and A tended to show a similar bias to the AMT freelancers. S also failed to identify the majority of the cases, but showed coherent confusion patterns between pairs of instruments.
132
+
133
+ NSynth pitch experiments NSynth (Engel et al., 2017) is an audio dataset containing samples of 1,006 instruments, each sample labeled with a unique pitch, timbre, and envelope. Each sample is a four second monophonic 16kHz snippet, ranging over every pitch of a standard MIDI piano (21-108) as well as five different velocities. It was not seen during training of our system.
134
+
135
+ We measure the correlation of embeddings retrieved using the encoder of our network across pitch for multiple instruments. The first two columns (from the left hand side) of Fig. 3 show selfcorrelations, while the third column shows correlation across instruments. As can be seen, the embedding encodes pitch information very clearly, despite being trained on complex polyphonic audio. The cosine similarity between the two instruments for the same pitch is, on average, 0.90-0.95 (mean of the diagonal), depending on the pair of instruments.
136
+
137
+ # 4.2 EXPLORATORY EXPERIMENTS
138
+
139
+ In order to freely share our trained models and allow for maximal reproducibility, we have retrained the network with data from MusicNet (Thickstun et al., 2017). The following experiments are based on this network and are focused on understanding the properties of the conversion. The description is based on the supplementary media available at musictranslation.github.io.
140
+
141
+ Are we doing more than timbral transfer? Is our system equivalent to pitch estimation followed by rendering with a different instrument, or can it capture stylistic musical elements? We demonstrate that our system does more than timbral transfer in two ways. Consider the conversions presented in supplementary S1, which consist of many conversion examples from each of the domains to every other domain. There are many samples where it is clear that more than timbral transfer is happening. For example, when converting Beethoven’s string quartet music to a wind quintet (Sample #30), an ornamentation note is added in the output that is nowhere to be found in the input music; when converting Beethoven’s violin sonata to Beethoven’s solo piano (Samples $\# 2 4$ and $\# 2 3$ ), the violin line seamlessly integrated into the piano part; when converting Beethoven’s solo piano music to Bach’s solo cello (Sample #9), the bass line of the piano is converted to cello. It is perhaps most evident when converting solo piano to piano and violin; an identity transformation would have been a valid translation, but the network adds a violin part to better match the output distribution.
142
+
143
+ ![](images/f0d11ae8c94a6609dda271d7e0f52ae9c63c2c0eb4bb65d8e3c358b93bc58141.jpg)
144
+ Figure 3: Correlation of embeddings across pitch. (a) Self-correlation for NSynth’s flute-acoustic027. (b) Self-correlation for keyboard-electronic-019. (c) The correlation between the electronic keyboard (y-axis) and the flute. (d) Self-correlation for brass-acoustic-018. (e) Self-correlation for string-acoustic-029. (f) The correlation between the brass instrument (y-axis) and the string.
145
+
146
+ To further demonstrate the capabilities of our system, we train a network on two piano domains: MusicNet solo piano recordings of Bach and Beethoven. We reduce the size of the latent space to 8 to limit the ability of the original input to be repeated exactly, thereby encouraging the decoders to be more ”creative” than they normally would, with the goal of observing how decoders trained on different training data will use their freedom of expression. The input we employ is a simple MIDI synthesized as a piano. Supplementary S2 presents a clear stylistic difference: one can hear some counterpoint in the Bach sample, whereas the Beethoven output exhibits a more “Sturm und Drang” feeling, indicating that the network learns stylistic elements from the training data.
147
+
148
+ Comparison with previous methods We compare our results with those of Concatenative Synthesis methods in supplementary S3. To do that, we use our system to translate target files from published results of two works in that field, and present the methods’ results side-by-side. Samples 1 and 2 are compared with the published results of Coleman (2016), a work comparing several Concatenative Synthesis methods, and uses a violin passage as source audio input. Sample 3 is compared with MATConcat (Sturm, 2006), which uses a corpus of string quartets as a source material. Sample 1 is a fugue performed on a piano. We show that we are able to convincingly produce string quartet and wind ensemble renditions of the piece. To push our model to its boundaries, we also attempt to convert the polyphonic fugue to solo cello, obtaining a rather convincing result. We believe that our results surpass in naturalness those obtained by concatenative methods. Sample 2 is an orchestra piece, which for our system is data that has never been seen during training. We convert it to piano, solo cello and a wind quintet, achieving convincing results, that we believe surpass the concatenative synthesis results. Sample 3 is another orchestra piece, which includes a long drum roll, followed by brass instruments. It is not quite well-defined how to convert a drum roll to a string quartet, but we believe our rendition is more coherent. Our method is able to render the brass instruments and orchestral music after the drum roll more convincingly than MATConcat, which mimics the audio volume but loses most musical content.
149
+
150
+ Universality Note that our network has never observed drums, brass instruments or an entire orchestra during training, and, therefore, the results of supplementary S3 also serve to demonstrate the versatility of the encoder module resulting from our training procedure (and so do those of S2). Supplementary S4 presents more out-of-domain conversion results, including other domains from MusicNet, whistles, and even spontaneous hand clapping.
151
+
152
+ The universality property hinges on the success of training a domain-independent representation. As can be seen in the confusion matrices given in Fig. 4, the domain classification network does not do considerably better than chance when the networks converge.
153
+
154
+ Ablation Analysis We conducted three ablation studies. In the first study, the training procedure did not use the augmentation procedure of Sec. 3.2. This resulted in a learning divergence during training, and we were unable to obtain a working model trained without augmentation, despite considerable effort.
155
+
156
+ In order to investigate the option of not using augmentation in a domain where training without it converges, we have applied our method to the task of voice conversion. Our experiments show a clear advantage for applying augmentation, see Appendix A. Additional experiments were conducted, for voice conversion, using the VQ-VAE method of van den Oord et al. (2017).
157
+
158
+ In the second ablation study, the domain classification network was not used $\lambda = 0$ ). Without requiring that the shared encoder remove domain-specific information from the latent representation of the input, the network learned to simply encode all information in the latent vectors, and all decoders learned to turn this information back to the original waveform. This resulted in a model that does not do any conversion at all.
159
+
160
+ Finally, we performed an ablation study on the latent code size, in which we convert a simple MIDI clip to the Beethoven domain and the Bach domain. Samples are available as supplementary S6. As can be heard, a latent dimensionality of 64 tends to reconstruct the input (unwanted memorization). A model with a latent space of 8 (used in S2) performs well. A model with a latent dimensionality of 4 is more creative, less related to the input midi, and also suffers from a reduction in quality.
161
+
162
+ Semantic blending We blend two encoded musical segments linearly in order to check the additivity of the embedding space. For that, we have selected two random five second segments $i$ and $j$ from each domain and embedded both using the encoder, obtaining $e _ { i }$ and $e _ { j }$ . We then combine the embeddings as follows: starting with 3.5 seconds from $e _ { i }$ , we combine the next 1.5 seconds of $e _ { i }$ with the first 1.5 seconds of $e _ { j }$ using a linear weighting with weights $1 - t / 1 . 5$ and $t / 1 . 5$ respectively, where $t \in [ 0 , 1 . 5 ]$ . We then use the various decoders to generate audio. The results are natural and the shift is completely seamless, as far as we observe. See supplementary S5 for samples.
163
+
164
+ The samples also demonstrate that in the scenario we tested, one can alternatively use fade-in and fade-out to create a similar effect. We therefore employ a second network that is used for a related task of voice conversion (see Appendix A) and demonstrate that in the case of voice conversion, latent space embedding is clearly superior to converting the audio itself. These samples can also be found in supplementary S5 for details and samples.
165
+
166
+ # 5 DISCUSSION
167
+
168
+ Our work demonstrates capabilities in music conversion, which is a high-level task (a terminology that means that they are more semantic than low-level audio processing tasks), and could open the door to other high-level tasks, such as composition. We have initial results that we find interesting: by reducing the size of the latent space, the decoders become more “creative” and produce outputs that are natural yet novel, in the sense that the exact association with the original input is lost.
169
+
170
+ # ACKNOWLEDGMENTS
171
+
172
+ This work is part of Adam Polyak’s Ph.D thesis research conducted at Tel Aviv University.
173
+
174
+ ![](images/97bfcf7f6456a18cd5c56163146ca7fee1bd8ddc8d766e43a47d611f03e524aa.jpg)
175
+ Figure 4: Accuracy of the domain classification network. (a) A confusion matrix of the domain classification network at the end of training on the private dataset used in the first phase of experiments. The mean accuracy is 0.30. (b) The confusion matrix for the MusicNet dataset used in the second phase of experiments. The mean accuracy is 0.24.
176
+
177
+ # REFERENCES
178
+
179
+ Shaun Barry and Youngmoo Kim. style transfer for musical audio using multiple time-frequency representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ BybQ7zWCb.
180
+
181
+ Yunjey Choi, Min-Je Choi, Munyoung Kim, Jung-Woo Ha, Sunghun Kim, and Jaegul Choo. StarGAN: Unified generative adversarial networks for multi-domain image-to-image translation. In arXiv preprint 1711.09020, 2017.
182
+
183
+ Djork-Arne Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network ´ learning by exponential linear units (elus). In International Conference on Learning Representations (ICLR), 2017.
184
+
185
+ G Coleman. Descriptor Control of Sound Transformations and Mosaicing Synthesis. PhD thesis, Universitat Pompeu Fabra, Barcelona, 2016.
186
+
187
+ Sander Dieleman, Aaron van den Oord, and Karen Simonyan. The challenge of realistic music ¨ generation: modelling raw audio at scale. In Advances in Neural Information Processing Systems, 2018.
188
+
189
+ Jesse Engel, Cinjon Resnick, Adam Roberts, Sander Dieleman, Mohammad Norouzi, Douglas Eck, and Karen Simonyan. Neural audio synthesis of musical notes with WaveNet autoencoders. In ICML, 2017.
190
+
191
+ Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, Franc¸ois Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. J. Mach. Learn. Res., 17(1):2096–2030, 2016.
192
+
193
+ Leon A. Gatys, Alexander S. Ecker, and Matthias Bethge. Image style transfer using convolutional neural networks. In CVPR, 2016.
194
+
195
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS. 2014.
196
+
197
+ Gaetan Hadjeres and Franc¸ois Pachet. DeepBach: a steerable model for bach chorales generation.¨ In ICML, 2017.
198
+
199
+ Albert Haque, Michelle Guo, and Prateek Verma. Conditional end-to-end audio transforms. In Arxiv preprint 1804.00047, 2018.
200
+
201
+ Keith Ito. The lj speech dataset, 2017. URL ttps://keithito.com/ LJ-Speech-Dataset.
202
+ Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and super-resolution. In ECCV, 2016.
203
+ Takuhiro Kaneko and Hirokazu Kameoka. Parallel-data-free voice conversion using cycle-consistent adversarial networks. arXiv preprint arXiv:1711.11293, 2017.
204
+ Taeksoo Kim, Moonsu Cha, Hyunsoo Kim, Jungkwon Lee, and Jiwon Kim. Learning to Discover Cross-Domain Relations with Generative Adversarial Networks. In ICML, 2017.
205
+ Simon King and Vasilis Karaiskos. The blizzard challenge 2011. In Blizzard Challenge workshop, 2011.
206
+ Simon King and Vasilis Karaiskos. The blizzard challenge 2013. In Blizzard Challenge workshop, 2013.
207
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. Stat, 2014.
208
+ Guillaume Lample, Neil Zeghidour, Nicolas Usunier, Antoine Bordes, Ludovic Denoyer, et al. Fader networks: Manipulating images by sliding attributes. In Advances in Neural Information Processing Systems, pp. 5967–5976, 2017.
209
+ Ming-Yu Liu and Oncel Tuzel. Coupled generative adversarial networks. In NIPS, pp. 469–477. 2016.
210
+ Ming-Yu Liu, Thomas Breuel, and Jan Kautz. Unsupervised image-to-image translation networks. In NIPS. 2017.
211
+ Christos Louizos, Kevin Swersky, Yujia Li, Max Welling, and Richard Zemel. The variational fair autoencoder. arXiv preprint arXiv:1511.00830, 2015.
212
+ Brian McFee, Colin Raffel, Dawen Liang, Daniel PW Ellis, Matt McVicar, Eric Battenberg, and Oriol Nieto. librosa: Audio and music signal analysis in python. 2015.
213
+ Noam Mor, Lior Wolf, Adam Polyak, and Yaniv Taigman. A universal music translation network. arXiv preprint arXiv:1805.07848, 2018.
214
+ Carthach ´ O Nuan ´ ain, Perfecto Herrera, and Sergi Jord ´ a. Rhythmic concatenative synthesis for elec- \` tronic music: Techniques, implementation, and evaluation. Computer Music Journal, 41(2):21– 37, June 2017. ISSN 0148-9267. doi: 10.1162/COMJ a 00412.
215
+ Wei Ping, Kainan Peng, Andrew Gibiansky, Sercan Omer Arik, Ajay Kannan, Sharan Narang, ¨ Jonathan Raiman, and John Miller. Deep Voice 3: 2000-speaker neural text-to-speech. In ICLR, 2018.
216
+ Dario Rethage, Jordi Pons, and Xavier Serra. A wavenet for speech denoising. arXiv preprint arXiv:1706.07162, 2017.
217
+ Flavio Ribeiro, Dinei Flor ´ encio, Cha Zhang, and Michael Seltzer. Crowdmos: An approach for ˆ crowdsourcing mean opinion score studies. In Acoustics, Speech and Signal Processing (ICASSP), IEEE International Conference, pp. 2416–2419. IEEE, 2011.
218
+ Diemo Schwarz. Concatenative sound synthesis: The early years. Journal of New Music Research, 35(1):3–22, 2006.
219
+ Diemo Schwarz. Corpus-based sound synthesis survey, 2018. URL http://imtr.ircam.fr/ imtr/Corpus-Based_Sound_Synthesis_Survey.
220
+ Jonathan Shen, Ruoming Pang, Ron J. Weiss, Mike Schuster, Navdeep Jaitly, Zongheng Yang, Zhifeng Chen, Yu Zhang, Yuxuan Wang, R. J. Skerry-Ryan, Rif A. Saurous, Yannis Agiomyrgiannakis, and Yonghui Wu. Natural TTS synthesis by conditioning wavenet on mel spectrogram predictions. In ICASSP, 2018.
221
+
222
+ Ian Simon, Sumit Basu, David Salesin, and Maneesh Agrawala. Audio analogies: Creating new music from an existing performance by concatenative synthesis. In Int. Computer Music Conference, 2005.
223
+
224
+ Bob L Sturm. Adaptive concatenative sound synthesis and its application to micromontage composition. Computer Music Journal, 30(4):46–66, 2006.
225
+
226
+ John Thickstun, Zaid Harchaoui, and Sham Kakade. Learning Features of Music From Scratch. In ICLR, 2017.
227
+
228
+ D. Ulyanov, V. Lebedev, A. Vedaldi, and V. Lempitsky. Texture networks: Feed-forward synthesis of textures and stylized images. In ICML, 2016.
229
+
230
+ Aaron van den Oord, Oriol Vinyals, and Koray Kavukcuoglu. Neural Discrete Representation Learning. In NIPS, 2017.
231
+
232
+ Aron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alexander Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. In Arxiv preprint 1609.03499, 2016.
233
+
234
+ V Verfaille and D Arfib. A-dafx: Adaptive digital audio effects. energy, 2000.
235
+
236
+ Zili Yi, Hao Zhang, Ping Tan, and Minglun Gong. DualGAN: Unsupervised dual learning for image-to-image translation. In ICCV, 2017.
237
+
238
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In ICCV, 2017.
239
+
240
+ Aymeric Zils and Franc¸ois Pachet. Musical mosaicing. In Digital Audio Effects $( D A F x )$ , volume 2, pp. 135, 2001.
241
+
242
+ # A VOICE CONVERSION EXPERIMENTS
243
+
244
+ We further evaluate our method on the task of voice conversion, which is not as challenging as the music conversion task explored in this work. It is, therefore, a convenient test bed when comparing to the VQ-VAE (van den Oord et al., 2017) method, which, as we mention in the paper, did not perform well in our music-based experiments, and which was shown by the authors to work on voice conversion.
245
+
246
+ In addition, as mentioned in Sec. 4.2, successful training on the music domains requires data augmentation. In voice conversion, we were able to successfully train our network even without data augmentation, and we can therefore perform a direction comparison.
247
+
248
+ We apply our method, a variant without data augmentation, and the VQVQE method on three publicly available datasets: “Nancy” from Blizzard 2011 (King & Karaiskos, 2011), Blizzard 2013 (King & Karaiskos, 2013) and LJ (Ito, 2017) dataset. The generated samples are obtained by converting an audio produced by the Google Cloud TTS robot to these three voices. The models are evaluated by their quality using the Mean Opinion Score, as obtained with the CrowdMOS (Ribeiro et al., 2011) package.
249
+
250
+ As can be seen in Tab. 2, samples generated by our WaveNet autoencoder based method are of higher quality than those of VQ-VAE. A second results is that the method trains well in voice conversion, even without the data augmentation. However, this leads to inferior results.
251
+
252
+ # A.1 VOICE CONVERSION ARCHITECTURES
253
+
254
+ We slightly modify the WaveNet autoencoder used in our method for the voice conversion task. Specifically, we modify the size of the latent encoding to be in $\mathbb { R } ^ { 4 8 }$ , instead of $\mathbb { R } ^ { 6 4 }$ . The rest of the model details remain the same as in the music translation task.
255
+
256
+ In our implementation of the VQ-VAE, the encoder was composed of 6 one-dimensional convolution layer with a ReLU activation. As in the original paper, the convolutions were with a stride of 2 and kernel size of 4. Therefore, the mu-law quantized waveform is temporally downsampled by $\times 6 4$ . We used a dictionary of 512 vectors in $\mathbb { R } ^ { 1 2 8 }$ . The obtained quantized encoding is upsampled and serves to condition a decoder which reconstructs the input waveform. Here as well, we follow the original paper and implement a single WaveNet decoder for all three speaker domains, this is achieved by concatenating the quantized encoding with a learned speaker embedding. We train the VQ-VAE using dictionary updates with Exponential Moving Averages (EMA) with a decay parameter of $\gamma = 0 . 9 9$ and a commitment parameter of $\beta = 1$ .
257
+
258
+ Table 2: MOS scores (mean $\pm$ SD) for the unseen speaker conversion.
259
+
260
+ <table><tr><td></td><td>Blizzard 2013</td><td>Nancy</td><td>LJ</td></tr><tr><td>Our method</td><td>3.16 ± 0.79</td><td>3.85 ± 0.84</td><td>3.40± 0.77</td></tr><tr><td>Our method - without augmentation</td><td>3.07 ± 0.79</td><td>3.87 ± 0.85</td><td>2.85± 0.92</td></tr><tr><td>VQ-VAE</td><td>2.53 ± 1.08</td><td>2.92 ± 0.92</td><td>2.22± 0.96</td></tr></table>
md/train/HkGzUjR5tQ/HkGzUjR5tQ.md ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DATNET: DUAL ADVERSARIAL TRANSFER FOR LOWRESOURCE NAMED ENTITY RECOGNITION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We propose a new architecture termed Dual Adversarial Transfer Network (DATNet) for addressing low-resource Named Entity Recognition (NER). Specifically, two variants of DATNet, i.e., DATNet-F and DATNet-P, are proposed to explore effective feature fusion between high and low resource. To address the noisy and imbalanced training data, we propose a novel Generalized ResourceAdversarial Discriminator (GRAD). Additionally, adversarial training is adopted to boost model generalization. We examine the effects of different components in DATNet across domains and languages, and show that significant improvement can be obtained especially for low-resource data. Without augmenting any additional hand-crafted features, we achieve new state-of-the-art performances on CoNLL and Twitter NER— $8 8 . 1 6 \%$ F1 for Spanish, $5 3 . 4 3 \%$ F1 for WNUT-2016, and $4 2 . 8 3 \%$ F1 for WNUT- $2 0 1 7 ^ { 1 }$ .
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Named entity recognition (NER) is an important step in most natural language processing (NLP) applications. It detects not only the type of named entity, but also the entity boundaries, which requires deep understanding of the contextual semantics to disambiguate the different entity types of same tokens. To tackle this challenging problem, most early studies were based on hand-crafted rules, which suffered from limited performance in practice. Current methods are devoted to developing learning based algorithms, especially neural network based methods, and have been advancing the state-of-the-art consecutively (Collobert et al., 2011; Huang et al., 2015; Lample et al., 2016; Chiu & Nichols, 2016; Ma & Hovy, 2016). These end-to-end models generalize well on new entities based on features automatically learned from the data. However, when the annotated corpora is small, especially in the low resource scenario (Zhang et al., 2016), the performance of these methods degrades significantly since the hidden feature representations cannot be learned adequately.
12
+
13
+ Recently, more and more approaches have been proposed to address low-resource NER. Early works (Chen et al., 2010; Li et al., 2012) primarily assumed a large parallel corpus and focused on exploiting them to project information from high- to low-resource. Unfortunately, such a large parallel corpus may not be available for many low-resource languages. More recently, cross-resource word embedding (Fang & Cohn, 2017; Adams et al., 2017; Yang et al., 2017) was proposed to bridge the low and high resources and enable knowledge transfer. Although the aforementioned transferbased methods show promising performance in low-resource NER, there are two issues deserved to be further investigated on: 1) Representation Difference - they did not consider the representation difference across resources and enforced the feature representation to be shared across languages/domains; 2) Resource Data Imbalance - the training size of high-resource is usually much larger than that of low-resource. The existing methods neglect such difference in their models, resulting in poor generalization.
14
+
15
+ In this work, we present an approach termed Dual Adversarial Transfer Network (DATNet) to address the above issues in a unified framework for low-resource NER. Specifically, to handle the representation difference, we first investigate on two architectures of hidden layers (we use bidirectional long-short term memory (BiLSTM) model as hidden layer) for transfer. The first one is that all the units in hidden layers are common units shared across languages/domains. The second one is composed of both private and common units, where the private part preserves the independent language/domain information. Extensive experiments are conducted to show their advantages over each other in different situations. On top of common units, the adversarial discriminator (AD) loss is introduced to encourage the resource-agnostic representation so that the knowledge from high resource can be more compatible with low resource. To handle the resource data imbalance issue, we further propose a variant of the AD loss, termed Generalized Resource-Adversarial Discriminator (GRAD), to impose the resource weight during training so that low-resource and hard samples can be paid more attention to. In addition, we create adversarial samples to conduct the Adversarial Training (AT), further improving the generalization and alleviating over-fitting problem. We unify two kinds of adversarial learning, i.e., GRAD and AT, into one transfer learning model, termed Dual Adversarial Transfer Network (DATNet), to achieve end-to-end training and obtain the state-of-the-art performance on a series of NER tasks– $8 8 . 1 6 \%$ F1 for CoNLL-2002 Spanish, $5 3 . 4 3 \%$ and $4 2 . 8 3 \%$ F1 for WNUT-2016 and 2017. Different from prior works, we do not use additional hand-crafted features and do not use cross-lingual word embeddings while addressing the cross-language tasks.
16
+
17
+ # 2 RELATED WORK
18
+
19
+ Named Entity Recognition NER is typically framed as a sequence labeling task which aims at automatic detection of named entities (e.g., person, organization, location and etc.) from free text (Marrero et al., 2013). The early works applied CRF, SVM, and perception models with handcrafted features (Ratinov & Roth, 2009; Passos et al., 2014; Luo et al., 2015). With the advent of deep learning, research focus has been shifting towards deep neural networks (DNN), which requires little feature engineering and domain knowledge (Lample et al., 2016; Zukov Gregoric et al., 2018). Collobert et al. (2011) proposed a feed-forward neural network with a fixed sized window for each word, which failed in considering useful relations between long-distance words. To overcome this limitation, Chiu & Nichols (2016) presented a bidirectional LSTM-CNNs architecture that automatically detects word- and character-level features. Ma & Hovy (2016) further extended it into bidirectional LSTM-CNNs-CRF architecture, where the CRF module was added to optimize the output label sequence. Liu et al. (2018) proposed task-aware neural language model termed LMLSTM-CRF, where character-aware neural language models were incorporated to extract characterlevel embedding under a multi-task framework.
20
+
21
+ Transfer Learning for NER Transfer learning can be a powerful tool to low resource NER tasks. To bridge high and low resource, transfer learning methods for NER can be divided into two types: the parallel corpora based transfer and the shared representation based transfer. Early works mainly focused on exploiting parallel corpora to project information between the high- and low-resource language (Yarowsky et al., 2001; Chen et al., 2010; Li et al., 2012; Feng et al., 2018). For example, Chen et al. (2010) and Feng et al. (2018) proposed to jointly identify and align bilingual named entities. On the other hand, the shared representation methods do not require the parallel correspondence (Rei & Søgaard, 2018). For instance, Fang & Cohn (2017) proposed cross-lingual word embeddings to transfer knowledge across resources. Yang et al. (2017) presented a transfer learning approach based on a deep hierarchical recurrent neural network (RNN), where full/partial hidden features between source and target tasks are shared. Ni et al. (Ni & Florian, 2016; Ni et al., 2017) utilized the Wikipedia entity type mappings to improve low-resource NER. Al-Rfou’ et al. (2015) built massive multilingual annotators with minimal human expertise by using language agnostic techniques. Mayhew et al. (2017) created a cross-language NER system, which works well for very minimal resources by translate annotated data of high-resource into low-resource. Cotterell & Duh (2017) proposed character-level neural CRFs to jointly train and predict low- and high-resource languages. Pan et al. (2017) proposes a large-scale cross-lingual named entity dataset which contains 282 languages for evaluation. In addition, multi-task learning (Yang et al., 2016; Luong et al., 2016; Rei, 2017; Aguilar et al., 2017; Hashimoto et al., 2017; Lin et al., 2018) shows that jointly training on multiple tasks/languages helps improve performance. Different from transfer learning methods, multi-task learning aims at improving the performance of all the resources instead of low resource only.
22
+
23
+ Adversarial Learning Adversarial learning originates from Generative Adversarial Nets (GAN) (Goodfellow et al., 2014), which shows impressing results in computer vision. Recently, many papers have tried to apply adversarial learning to NLP tasks. Liu et al. (2017) presented an adversarial multi-task learning framework for text classification. Gui et al. (2017) applied the adversarial discriminator to POS tagging for Twitter. Kim et al. (2017) proposed a language discriminator to enable language-adversarial training for cross-language POS tagging. Apart from adversarial discriminator, adversarial training is another concept originally introduced by (Szegedy et al., 2014; Goodfellow et al., 2015) to improve the robustness of image classification model by injecting malicious perturbations into input images. Recently, Miyato et al. (2017) proposed a semi-supervised text classification method by applying adversarial training, where for the first time adversarial perturbations were added onto word embeddings. Yasunaga et al. (2018) applied adversarial training to POS tagging. Different from all these adversarial learning methods, our method integrates both the adversarial discriminator and adversarial training in an unified framework to enable end-to-end training.
24
+
25
+ # 3 DUAL ADVERSARIAL TRANSFER NETWORK (DATNET)
26
+
27
+ In this section, we introduce DATNet in more details. We first describe a base model for NER, and then discuss two proposed transfer architectures for DATNet.
28
+
29
+ ![](images/c12e79f3e88fd641871ac1c2081f1c626fa1b8792b17590e421f4bb59c842530.jpg)
30
+ Figure 1: The general architecture of proposed models.
31
+
32
+ # 3.1 BASIC ARCHITECTURE
33
+
34
+ We follow state-of-the-art models for NER task (Huang et al., 2015; Lample et al., 2016; Chiu & Nichols, 2016; Ma & Hovy, 2016), i.e., LSTM-CNNs-CRF based structure, to build the base model. It consists of the following pieces: character-level embedding, word-level embedding, BiLSTM for feature representation, and CRF as the decoder. The character-level embedding takes a sequence of characters in the word as atomic units input to derive the word representation that encodes the morphological information, such as root, prefix, and suffix. These character features are usually encoded by character-level CNN or BiLSTM, then concatenated with word-level embedding to form the final word vectors. On top of them, the network further incorporates the contextual information using BiLSTM to output new feature representations, which is subsequently fed into CRF layer to predict label sequence. Although both of the word-level layer and the character-level layer can be implemented using CNNs or RNNs, we use CNNs for extracting character-level and RNNs for extracting word-level representation. Fig. 1(a) shows the the architecture of the base model.
35
+
36
+ # 3.2 DUAL ADVERSARIAL TRANSFER ARCHITECTURE
37
+
38
+ # 3.2.1 CHARACTER-LEVEL ENCODER
39
+
40
+ Previous works have shown that character features can boost sequence labeling performance by capturing morphological and semantic information (Lin et al., 2018). For low-resource dataset to obtain high-quality word features, character features learned from other language/domain may provide crucial information for labeling, especially for rare and out-of-vocabulary words. Character-level encoder usually contains BiLSTM (Lample et al., 2016) and CNN (Chiu & Nichols, 2016; Ma & Hovy,
41
+
42
+ 2016) approaches. In practice, Reimers & Gurevych (2017) observed that the difference between the two approaches is statistically insignificant in sequence labeling tasks, but character-level CNN is more efficient and has less parameters. Thus, we use character-level CNN and share character features between high- and low-resource tasks to enhance the representations of low-resource.
43
+
44
+ # 3.2.2 WORD-LEVEL ENCODER
45
+
46
+ To learn a better word-level representation, we concatenate character-level features of each word with a latent word embedding as $\mathbf { w } _ { i } = [ \mathbf { w } _ { i } ^ { c h a r } , \mathbf { w } _ { i } ^ { e m b } ]$ , where the latent word embedding $\mathbf { w } _ { i } ^ { e m b }$ is initialized with pre-trained embeddings and fixed during training. One unique characteristic of NER is that the historical and future input for a given time step could be useful for label inference. To exploit such a characteristic, we use a bidirectional LSTM architecture (Hochreiter & Schmidhuber, 1997) to extract contextualized word-level features. In this way, we can gather the information from the past and future for a particular time frame $t$ as follows, $\vec { \mathbf { h } } _ { t } = \mathtt { l s t m } ( \vec { \mathbf { h } } _ { t - 1 } , \mathbf { w } _ { t } ) , \ \overleftarrow { \mathbf { h } } _ { t } $ $\left\{ \overline { { \mathbf { h } } } _ { t } = \right.$ $\mathtt { l s t m } ( \overleftarrow { \mathbf { h } } _ { t + 1 } , \mathbf { w } _ { t } )$ . After the LSTM layer, the representation of a word is obtained by concatenating its left and right context representation as follows, $\mathbf h _ { t } = [ \widehat { \mathbf h } _ { t } , \widetilde { \mathbf h } _ { t } ]$ .
47
+
48
+ To consider the resource representation difference on word-level features, we introduce two kinds of transferable word-level encoder in our model, namely DATNet-Full Share (DATNet-F) and DATNetPart Share (DATNet-P). In DATNet-F, all the BiLSTM units are shared by both resources while word embeddings for different resources are disparate. The illustrative figure is depicted in the Fig. 1(c). Different from DATNet-F, the DATNet-P decomposes the BiLSTM units into the shared component and the resource-related one, which is shown in the Fig. 1(b).
49
+
50
+ # 3.2.3 GENERALIZED RESOURCE-ADVERSARIAL DISCRIMINATOR
51
+
52
+ In order to make the feature representation extracted from the source domain more compatible with those from the target domain, we encourage the outputs of the shared BiLSTM part to be resourceagnostic by constructing a resource-adversarial discriminator, which is inspired by the LanguageAdversarial Discriminator proposed by Kim et al. (2017). Unfortunately, previous works did not consider the imbalance of training size for two resources. Specifically, the target domain consists of very limited labeled training data, e.g., 10 sentences. In contrast, labeled training data in the source domain are much richer, e.g., 10k sentences. If such imbalance was not considered during training, the stochastic gradient descent (SGD) optimization would make the model more biased to high resource (Lin et al., 2017b). To address this imbalance problem, we impose a weight $\alpha$ on two resources to balance their influences. However, in the experiment we also observe that the easily classified samples from high resource comprise the majority of the loss and dominate the gradient. To overcome this issue, we further propose Generalized Resource-Adversarial Discriminator (GRAD) to enable adaptive weights for each sample (note that the sample here means each sentence of resource), which focuses the model training on hard samples.
53
+
54
+ To compute the loss of GRAD, the output sequence of the shared BiLSTM is firstly encoded into a single vector via a self-attention module (Bahdanau et al., 2015), and then projected into a scalar $r$ via a linear transformation. The loss function of the resource classifier is formulated as:
55
+
56
+ $$
57
+ \ell _ { G R A D } = - \sum _ { i } \{ \mathbf { I } _ { i \in \mathcal { D } _ { S } } \alpha ( 1 - r _ { i } ) ^ { \gamma } \log r _ { i } + \mathbf { I } _ { i \in \mathcal { D } _ { T } } ( 1 - \alpha ) r _ { i } ^ { \gamma } \log ( 1 - r _ { i } ) \}
58
+ $$
59
+
60
+ where $\mathbf { I } _ { i \in \mathcal { D } _ { S } } , \mathbf { I } _ { i \in \mathcal { D } _ { T } }$ are the identity functions to denote whether a sentence is from high resource (source) and low resource (target), respectively; $\alpha$ is a weighting factor to balance the loss contribution from high and low resource; the parameter $( 1 - r _ { i } ) ^ { \gamma }$ (or $r _ { i } ^ { \gamma }$ ) controls the loss contribution from individual samples by measuring the discrepancy between prediction and true label (easy samples have smaller contribution); and $\gamma$ scales the contrast of loss contribution from hard and easy samples. In practice, the value of $\gamma$ does not need to be tuned much and usually set as 2 in our experiment. Intuitively, the weighting factors $\alpha$ and $( 1 - r _ { i } ) ^ { \gamma }$ reduce the loss contribution from high resource and easy samples, respectively. Note that though the resource classifier is optimized to minimize the resource classification error, when the gradients originated from the resource classification loss are back-propagated to the other model parts than the resource classifier, they are negated for parameter updates so that these bottom layers are trained to be resource-agnostic.
61
+
62
+ # 3.2.4 LABEL DECODER
63
+
64
+ The label decoder induces a probability distribution over sequences of labels, conditioned on the word-level encoder features. In this paper, we use a linear chain model based on the first-order Markov chain structure, termed the chain conditional random field (CRF) Lafferty et al. (2001), as the decoder. In this decoder, there are two kinds of cliques: local cliques and transition cliques. Specifically, local cliques correspond to the individual elements in the sequence. And transition cliques, on the other hand, reflect the evolution of states between two neighboring elements at time $t - 1$ and $t$ and we define the transition distribution as $\theta$ . Formally, a linear-chain CRF can be written $\begin{array} { r } { p ( \mathbf { y } | \mathbf { h } _ { 1 : T } ) = \frac { 1 } { Z ( \mathbf { h } _ { 1 : T } ) } \exp \left\{ \sum _ { t = 2 } ^ { T } \theta _ { y _ { t - 1 } , y _ { t } } + \sum _ { t = 1 } ^ { T } \mathbf { W } _ { y _ { t } } \mathbf { h } _ { t } \right\} } \end{array}$ , where $Z ( \mathbf { h } _ { 1 : T } )$ is a normalization term and $\mathbf { y }$ is the sequence of predicted labels as follows: $\mathbf { y } = y _ { 1 : T }$ . Model parameters are optimized to maximize this conditional log likelihood, which acts as the objective function of the model. We define the loss function for source and target resources as follows, $\begin{array} { r } { \ell _ { S } = - \sum _ { i } \log p ( \mathbf { y } | \mathbf { h } _ { 1 : T } ) } \end{array}$ , $\ell _ { T } =$ $\begin{array} { r } { - \sum _ { i } \log p ( \mathbf { y } | \mathbf { h } _ { 1 : T } ) } \end{array}$ .
65
+
66
+ # 3.2.5 ADVERSARIAL TRAINING
67
+
68
+ So far our model can be trained end-to-end with standard back-propagation by minimizing the following loss:
69
+
70
+ $$
71
+ \ell = \ell _ { G R A D } + \ell _ { S } + \ell _ { T }
72
+ $$
73
+
74
+ Recent works have demonstrated that deep learning models are fragile to adversarial examples Goodfellow et al. (2015). In computer vision, those adversarial examples can be constructed by changing a very small number of pixels, which are virtually indistinguishable to human perception (Pin-Yu et al., 2018). Recently, adversarial samples are widely incorporated into training to improve the generalization and robustness of the model, which is so-called adversarial training (AT) (Miyato et al., 2017). It emerges as a powerful regularization tool to stabilize training and prevent the model from being stuck in local minimum. In this paper, we explore AT in context of NER. To be specific, we prepare an adversarial sample by adding the original sample with a perturbation bounded by a small norm $\epsilon$ to maximize the loss function as follows:
75
+
76
+ $$
77
+ \eta _ { \mathbf { x } } = \arg \operatorname* { m a x } _ { \eta : \| \eta \| _ { 2 } \leq \epsilon } \ell ( \Theta ; \mathbf { x } + \eta )
78
+ $$
79
+
80
+ where $\Theta$ is the current model parameters set. However, we cannot calculate the value of $\eta$ exactly in general, because the exact optimization with respect to $\eta$ is intractable in neural networks. Following the strategy in Goodfellow et al. (2015), this value can be approximated by linearizing it as follows,
81
+
82
+ $$
83
+ \eta _ { \mathbf { x } } = \epsilon \frac { \mathbf { g } } { \| \mathbf { g } \| _ { 2 } } , \mathrm { w h e r e } \mathbf { g } = \nabla \ell ( \Theta ; \mathbf { x } )
84
+ $$
85
+
86
+ where $\epsilon$ can be determined on the validation set. In this way, adversarial examples are generated by adding small perturbations to the inputs in the direction that most significantly increases the loss function of the model. We find such $\eta$ against the current model parameterized by $\Theta$ , at each training step, and construct an adversarial example by ${ \bf x } _ { a d v } = { \bf x } + \eta _ { \bf x }$ . Noted that we generate this adversarial example on the word and character embedding layer, respectively, as shown in the Fig. 1(b) and 1(c). Then, the classifier is trained on the mixture of original and adversarial examples to improve the generalization. To this end, we augment the loss in Eqn. 2 and define the loss function for adversarial training as:
87
+
88
+ $$
89
+ \ell _ { A T } = \ell ( \Theta ; \mathbf { x } ) + \ell ( \Theta ; \mathbf { x } _ { a d v } )
90
+ $$
91
+
92
+ where $\ell ( \Theta ; { \mathbf x } ) , \ell ( \Theta ; { \mathbf x } _ { a d v } )$ represents the loss from an original example and its adversarial counterpart, respectively. Note that we present the AT in a general form for the convenience of presentation. For different samples, the loss and parameters should correspond to their counterparts. For example, for the source data with word embedding $\mathbf { w } _ { S }$ , the loss for AT can be defined as follows, $\bar { \ell _ { A T } } = \ell ( \Theta ; \mathbf { w } _ { S } ) + \ell ( \Theta ; \mathbf { w } _ { S , a d v } )$ with $\mathbf { w } _ { S , a d v } = \mathbf { w } _ { S } + \eta _ { \mathbf { w } _ { S } }$ and $\ell = \ell _ { G R A D } + \ell _ { S }$ . Similarly, we can compute the perturbations $\eta _ { \mathbf { c } }$ for char-embedding and $\eta _ { \mathbf { w } _ { T } }$ for target word embedding.
93
+
94
+ # 4 EXPERIMENTS
95
+
96
+ # 4.1 DATASETS
97
+
98
+ In order to evaluate the performance of DATNet, we conduct the experiments on following widely used NER datasets: CoNLL-2003 English NER (Kim & De, 2003), CoNLL-2002 Spanish & Dutch NER (Kim, 2002), WNUT-2016 & 2017 English Twitter NER (Zeman, 2017). The statistics of these datasets are described in Table 1. We use the official split of training/validation/test sets. Since our goal is to study the effects of transferring knowledge from high-resource dataset to low-resource dataset, unlike previous works (Collobert et al., 2011; Chiu & Nichols, 2016; Yang et al., 2017) to append one-hot gazetteer features to the input of the CRF layer, and the works (Partalas et al., 2016; Limsopatham & Collier, 2016; Aguilar et al., 2017) to introduce orthographic feature as additional input for learning social media NER in tweets, we do not experiment with hand-crafted features and only consider words and characters embeddings as the inputs of our model. To be noted, we used only train set for model training for all datasets except the WNUT-2016 NER dataset. Since in this dataset, all the previous studies merged the training and validation sets together for training, we followed the same way for fair comparison. Specifically, we use CoNLL-2003 English NER dataset as high-resource (i.e., source) for all the experiments on CoNLL and WNUT datasets, while CoNLL-2002 Spanish & Dutch NER datasets and WNUT-2016 & 2017 Twitter NER datasets as low-resource (i.e., target) in cross-language and cross-domain NER settings, respectively.
99
+
100
+ Table 1: Statistics of CoNLL and WNUT Named Entity Recognition Datasets.
101
+
102
+ <table><tr><td>Benchmark</td><td>Resource</td><td>Language</td><td># Training Tokens (# Entities)</td><td># Dev Tokens (# Entities)</td><td># Test Tokens (# Entities)</td></tr><tr><td>CoNLL-2003</td><td>English</td><td></td><td>204,567 (23,499)</td><td>51,578 (5,942)</td><td>46,666 (5,648)</td></tr><tr><td colspan="6">Cross-language NER</td></tr><tr><td>CoNLL-2002</td><td>Target</td><td>Spanish</td><td>207,484 (18,797)</td><td>51,645 (4,351)</td><td>52.098 (3,558)</td></tr><tr><td>CoNLL-2002</td><td>Target</td><td>Dutch</td><td>202,931 (13,344)</td><td>37,761 (2.616)</td><td>68,994 (3.941)</td></tr><tr><td colspan="6">Cross-domain NER</td></tr><tr><td>WNUT-2016</td><td>Target</td><td>English</td><td>46,469 (2,462)</td><td>16,261 (1,128)</td><td>61,908 (5,955)</td></tr><tr><td>WNUT-2017</td><td>Target</td><td>English</td><td>62,730 (3,160)</td><td>15,733 (1,250)</td><td>23,394 (1,740)</td></tr></table>
103
+
104
+ In addition to the CoNLL and WNUT datasets, we also experiment on the cross-language named entity dataset described in Pan et al. (2017), which contains datasets for 282 languages, to evaluate our methods and investigate the transferability of different linguistic families and branches in both low- and high-resource scenarios. We choose 9 languages in our experiment, where Galician (gl), West Frisian (fy), Ukrainian (uk) and Marathi (mr) are target languages, the corresponding source languages are Spanish (es), Dutch (nl), Russian $( r u )$ and Hindi (hi), and Arabic (ar) is also a source language, which is from different linguistic family. Following the setting in Cotterell & Duh (2017), we also simulate the low- and high-resource scenarios by creating 100 and 10,000 sentences split for training target language datasets, respectively. Then we create 1,000 sentences split for validation and test, respectively. For source languages, we create 10,000 sentence split for training only. For high-resource scenario, we only conduct experiments on Galician (gl-high) and Ukrainian (uk-high). The list of selected datasets are described in Table 2.
105
+
106
+ Table 2: List of Named Entity Recognition Datasets in Pan et al. (2017).
107
+
108
+ <table><tr><td>Language</td><td>Resource</td><td>Linguistic Family</td><td></td><td>Linguistic Branch # Training Sentences# Dev Sentences</td><td></td><td>:#Test Sentences</td></tr><tr><td>Spanish (es)</td><td>Source</td><td>Indo-European</td><td>Romance</td><td>10,000</td><td></td><td></td></tr><tr><td>Galician (gl/ gl-high)</td><td>Target</td><td>Indo-European</td><td>Romance</td><td>100 /10.000</td><td>1,000</td><td>1,000</td></tr><tr><td>Dutch (nl)</td><td>Source</td><td>Indo-European</td><td>Germanic</td><td>10,000</td><td></td><td></td></tr><tr><td>West Frisian (fy)</td><td>Target</td><td>Indo-European</td><td>Germanic</td><td>100</td><td>1,000</td><td>1,000</td></tr><tr><td>Russian (ru)</td><td>Source</td><td>Indo-European</td><td>Slavic</td><td>10,000</td><td></td><td></td></tr><tr><td>Ukrainian (uk /uk-high)</td><td>Target</td><td>Indo-European</td><td>Slavic</td><td>100 /10.000</td><td>1,000</td><td>1,000</td></tr><tr><td>Hindi (hi)</td><td>Source</td><td>Indo-European</td><td>Indo-Aryan</td><td>10.000</td><td></td><td></td></tr><tr><td>Marathi (mr)</td><td>Target</td><td>Indo-European</td><td>Indo-Aryan</td><td>100</td><td>1,000</td><td>1,000</td></tr><tr><td>Arabic (ar)</td><td>Source</td><td>Afro-Asiatic</td><td>Semitic</td><td>10.000</td><td>-</td><td>-</td></tr></table>
109
+
110
+ # 4.2 EXPERIMENTAL SETUP
111
+
112
+ We use 50-dimensional publicly available pre-trained word embeddings for English, Spanish and Dutch languages of CoNLL and WNUT datasets in our experiments, which are trained by word2vec package2 on the corresponding Wikipedia articles (2017-12-20 dumps) (Lin et al., 2018). For the named entity datasets selected from Pan et al. (2017), we use 300-dimensional pre-trained word embeddings trained by fastText package3 on Wikipedia (Bojanowski et al., 2017), and the 30- dimensional randomly initialized character embeddings are used for all the datasets. We set the filter number as 20 for char-level CNN and the dimension of hidden states of the word-level LSTM as 200 for both base model and DATNet-F. For DATNet-P, we set 100 for source, share, and target LSTMs dimension, respectively. Parameters optimization is performed by Adam optimizer (Kingma & Ba, 2014) with gradient clipping of 5.0 and learning rate decay strategy. We set the initial learning rate of $\beta _ { 0 } ~ = ~ 0 . 0 0 1$ for all experiments. At each epoch $t$ , learning rate $\beta _ { t }$ is updated using $\beta _ { t } = \beta _ { 0 } / ( 1 + \rho \times t )$ , where $\rho$ is decay rate with 0.05. To reduce over-fitting, we also apply Dropout (Srivastava et al., 2014) to the embedding layer and the output of the LSTM layer, respectively.
113
+
114
+ # 4.3 COMPARISON WITH STATE-OF-THE-ART RESULTS
115
+
116
+ In this section, we compare our approach with state-of-the-art (SOTA) methods on CoNLL and WNUT benchmark datasets. In the experiment, we exploit all the source data (i.e., CoNLL-2003 English NER) and target data to improve performance of target tasks. The averaged results with standard deviation over 10 repetitive runs are summarized in Table 3, and we also report the best results on each task for fair comparison with other SOTA methods. From results, we observe that incorporating the additional resource is helpful to improve performance. DATNet-P model achieves the highest F1 score on CoNLL-2002 Spanish and second F1 score on CoNLL-2002 Dutch dataset while DATNet-F model beats others on WNUT-2016 and WNUT-2017 English Twitter datasets. Different from other state-of-the-art models, DATNets do not use any addition features4.
117
+
118
+ Table 3: Comparison with State-of-the-art Results in CoNLL and WNUT datasets (F1-score)
119
+
120
+ <table><tr><td rowspan="2">Mode</td><td rowspan="2">Methods</td><td rowspan="2"></td><td colspan="2">Additional Features</td><td colspan="2">CoNLL Datasets</td><td colspan="2">WNUT Datasets</td></tr><tr><td></td><td>POS Gazetteers Orthographic</td><td>Spanish</td><td>Dutch</td><td>WNUT-2016 WNUT-2017</td><td></td></tr><tr><td rowspan="7">Mono-language /domain</td><td>Gillick et al. (2016)</td><td>×</td><td>×</td><td>×</td><td>82.59</td><td>82.84</td><td></td><td></td></tr><tr><td>Lample et al. (2016)</td><td>×</td><td>&lt;√√x</td><td>× &lt;</td><td>85.75</td><td>81.74</td><td>-</td><td></td></tr><tr><td>Partalas et al. (2016)</td><td></td><td></td><td></td><td>=</td><td>=</td><td>46.16</td><td></td></tr><tr><td>Limsopatham&amp; Collier (2016)</td><td></td><td></td><td></td><td></td><td>=</td><td>52.41</td><td></td></tr><tr><td rowspan="2">Lin et al. (2017a)</td><td></td><td>√</td><td>√</td><td></td><td></td><td></td><td>40.42</td></tr><tr><td>Best Our Base Model Mean&amp; Std</td><td>×</td><td></td><td></td><td>85.53</td><td>85.55 44.96</td><td>35.20 34.67±0.34</td></tr><tr><td colspan="2"></td><td></td><td>× √</td><td>× ×</td><td>85.35±0.15 85.24±0.21 85.77</td><td></td><td>44.37±0.31</td><td></td></tr><tr><td rowspan="8">Cross-language</td><td colspan="2">Yang et al. (2017)</td><td></td><td></td><td></td><td>85.19</td><td></td><td></td></tr><tr><td colspan="2">Lin et al. (2018)</td><td></td><td></td><td>85.88</td><td>86.55 88.39</td><td></td><td></td></tr><tr><td colspan="2">Feng et al. (2018)</td><td></td><td></td><td></td><td>86.42</td><td></td><td></td></tr><tr><td colspan="2">von Däniken &amp; Cieliebak (2017)</td><td>×</td><td>√ ×</td><td>√</td><td></td><td></td><td>40.78</td></tr><tr><td rowspan="2">Aguilar et al. (2017) DATNet-P</td><td></td><td>√</td><td></td><td>88.16</td><td>88.32</td><td>50.85</td><td>41.86</td></tr><tr><td>Best</td><td></td><td>×</td><td></td><td></td><td></td><td>41.12</td></tr><tr><td rowspan="2">DATNet-F</td><td>Mean&amp; Std</td><td>×</td><td></td><td>87.89±0.18 87.04</td><td>87.77</td><td>88.09±0.13 50.41±0.32 53.43</td><td>40.52±0.38 42.83</td></tr><tr><td>Best Mean&amp; Std</td><td>×</td><td>×</td><td>×</td><td>86.79±0.20</td><td>87.52±0.19</td><td>53.03±0.24 42.32±0.32</td></tr></table>
121
+
122
+ Table 4 summarizes the results of our methods under different cross-language transfer settings as well as the comparison with Cotterell & Duh (2017). In this experiment, we study the transferability between languages not only from same linguistic family and branch, but also from different linguistic families or branches. According to the results, DATNets outperform the transfer method of Cotterell & Duh (2017) for both low- and high-resource scenarios within the same linguistic family and branch (i.e., in-family in-branch) transfer case. We also observe that: 1) For the low-resource scenario, transfer learning is significantly helpful for improving the performance of target datasets within both same and different linguistic family or branch (i.e., in/cross-family in/cross-branch) transfer cases, while the improvements are more prominent under the in-family in-branch case. 2) For the high-resource scenario, say, when the target language data is sufficient, the improvements of transfer learning are not very distinct compared with that for low-resource scenario under in-family in-branch case. We also find that there is no effect by transferring knowledge from Arabic to Galician and Ukrainian. We suspect that it is caused by the great linguistic differences between source and target languages, since, for example, Arabic and Galician are from totally different linguistic families.
123
+
124
+ Table 4: Results of Varying Cross-language Transfer Settings in Pan et al. (2017) Datasets (F1-score).
125
+
126
+ <table><tr><td colspan="2">Language</td><td rowspan="2">Transferring Strategy</td><td colspan="2">Cotterell &amp; Duh (2017)</td><td colspan="3">Our Methods</td></tr><tr><td>Source</td><td>Target</td><td>Base Model</td><td>Transfer</td><td>Base Model</td><td>DATNet-P</td><td>DATNet-F</td></tr><tr><td>nl</td><td>fy</td><td>In-Family In-Branch</td><td>58.43</td><td>72.12</td><td>57.47</td><td>75.08</td><td>76.05</td></tr><tr><td>hi</td><td>fy</td><td>In-Family Cross-Branch</td><td>-</td><td>-</td><td>57.47</td><td>69.25</td><td>68.44</td></tr><tr><td>ar</td><td>fy</td><td>Cross-Family Cross-Branch</td><td>1</td><td>1</td><td>57.47</td><td>67.89</td><td>66.05</td></tr><tr><td>hi</td><td>mr</td><td>In-Family In-Branch</td><td>39.02</td><td>60.92</td><td>43.55</td><td>68.55</td><td>64.87</td></tr><tr><td>nl</td><td>mr</td><td>In-Family Cross-Branch</td><td>-</td><td>1</td><td>43.55</td><td>63.83</td><td>60.50</td></tr><tr><td>ar</td><td>mr</td><td>Cross-Family Cross-Branch</td><td>-</td><td>1</td><td>43.55</td><td>63.28</td><td>59.76</td></tr><tr><td>es</td><td>g</td><td>In-Family In-Branch</td><td>49.19</td><td>76.40</td><td>49.94</td><td>79.60</td><td>86.01</td></tr><tr><td>hi</td><td>g</td><td>In-Family Cross-Branch</td><td>-</td><td>-</td><td>49.94</td><td>60.57</td><td>61.68</td></tr><tr><td>ar</td><td>g</td><td>Cross-Family Cross-Branch</td><td></td><td>-</td><td>49.94</td><td>59.18</td><td>60.43</td></tr><tr><td>es</td><td>gl-high</td><td>In-Family In-Branch</td><td>89.42</td><td>89.46</td><td>92.78</td><td>93.14</td><td>93.02</td></tr><tr><td>ar</td><td>gl-high</td><td>Cross-Family Cross-Branch</td><td>-</td><td>1</td><td>92.78</td><td>92.63</td><td>92.21</td></tr><tr><td>ru</td><td>uk</td><td>In-Family In-Branch</td><td>60.65</td><td>76.74</td><td>61.48</td><td>79.02</td><td>80.76</td></tr><tr><td>hi</td><td>uk</td><td>In-Family Cross-Branch</td><td>1</td><td>-</td><td>61.48</td><td>72.73</td><td>73.84</td></tr><tr><td>ar</td><td>uk</td><td>Cross-Family Cross-Branch</td><td>-</td><td>1</td><td>61.48</td><td>71.55</td><td>72.24</td></tr><tr><td>ru</td><td>uk-high</td><td>In-Family In-Branch</td><td>87.39</td><td>87.42</td><td>93.29</td><td>93.62</td><td>93.51</td></tr><tr><td>ar</td><td>uk-high</td><td>Cross-Family Cross-Branch</td><td>-1</td><td>-</td><td>93.29</td><td>92.83</td><td>92.42</td></tr></table>
127
+
128
+ \* Base model means the model is trained by using target language dataset only.
129
+
130
+ ![](images/f72145ff1803baccf438290560a949df8356f92a886dcdb22b498b0c0e817679.jpg)
131
+ Figure 2: Comparison with Different Target Data Ratio, where AT stands for adversarial training, F(P)- Transfer denotes the DATNet-F(P) without AT.
132
+
133
+ # 4.4 TRANSFER LEARNING PERFORMANCE
134
+
135
+ In this section, we investigate on improvements with transfer learning under multiple low-resource settings with partial target data. To simulate a low-resource setting, we randomly select subsets of target data with varying data ratio at 0.05, 0.1, 0.2, 0.4, 0.6, and 1.0. For example, 20,748 training tokens are sampled from the training set under a data ratio of $r ~ = ~ 0 . 1$ for the dataset CoNLL-2002 Spanish NER (Cf. Table 1). The results for cross-language and cross-domain transfer are shown in Fig. 2(a) and 2(b), respectively, where we compare the results with each part of DATNet under various data ratios. From those figures, we have the following observations: 1) both adversarial training and adversarial discriminator in DATNet consistently contribute to the performance improvement; 2) the transfer learning component in the DATNet consistently improve over the base model results and the improvement margin is more substantial when the target data ratio is lower. For example, when the data ratio is 0.05, DATNet-P model outperforms the base model by more than $4 \%$ absolutely in F1-score on Spanish NER and DATNet-F model improves around $13 \%$ absolutely in F1-score compared to base model on WNUT-2016 NER.
136
+
137
+ Table 5: Experiments on Extremely Low Resource (F1-score).
138
+
139
+ <table><tr><td colspan="2">Tasks</td><td colspan="5">CoNLL-2002 2Spanish NER</td><td colspan="5">WNUT-2016 Twitter NER</td></tr><tr><td>#Target train sentences</td><td>10</td><td>50</td><td>100</td><td>200</td><td>500</td><td>1000</td><td>10</td><td>50</td><td>100</td><td>200 500</td><td>1000</td></tr><tr><td>Base</td><td>21.53</td><td>42.18</td><td>48.35</td><td>63.66</td><td>68.83</td><td>76.69</td><td>3.80 14.07</td><td>17.99</td><td>26.20</td><td>31.78</td><td>36.99</td></tr><tr><td>+ AT</td><td>19.23</td><td>41.01</td><td>50.46</td><td>64.83</td><td>70.85</td><td>77.91</td><td>4.34 16.87</td><td>18.43</td><td>26.32</td><td>35.68</td><td>41.69</td></tr><tr><td>+ P-Transfer</td><td>29.78</td><td>61.09</td><td>64.78</td><td>66.54</td><td>72.94</td><td>78.49</td><td>7.71 16.17</td><td>20.43</td><td>29.20</td><td>34.90</td><td>41.20</td></tr><tr><td>+ F-Transfer</td><td>39.72</td><td>63.00</td><td>63.36</td><td>66.39</td><td>72.88</td><td>78.04</td><td>15.26 20.04</td><td>26.60</td><td>32.22</td><td>38.35</td><td>44.81</td></tr><tr><td>DATNet-P</td><td>39.52</td><td>62.57</td><td>64.05</td><td>68.95</td><td>75.19</td><td>79.46</td><td>9.94 17.09</td><td>25.39</td><td>30.71</td><td>36.05</td><td>42.30</td></tr><tr><td>DATNet-F</td><td>44.52</td><td>63.89</td><td>66.67</td><td>68.35</td><td>74.24</td><td>78.56</td><td>17.14 22.59</td><td>28.41</td><td>32.48</td><td>39.20</td><td>45.25</td></tr></table>
140
+
141
+ In the second experiment, we further investigate DATNet on the extremely low resource cases, e.g., the number of training target sentences is 10, 50, 100, 200, 500 and 1,000. The setting is quite challenging and fewer previous works have studied before. The results are summarized in Table 5. We have two interesting observations 5: 1) DATNet-F outperforms DATNet-P on cross-language transfer when the target resource is extremely low, however, this situation is reversed when the target dataset size is large enough (here for this specific dataset, the threshold is 100 sentences); 2) DATNet-F is always superior to DATNet-P on cross-domain transfer. For the first observation, it is because DATNet-F with more shared hidden units is more efficient to transfer knowledge than DATNet-P when data size is extremely small. For the second observation, because cross-domain transfer are in the same language, more knowledge is common between the source and target domains, requiring more shared hidden features to carry with these knowledge compared to cross-language transfer. Therefore, for cross-language transfer with an extremely low resource and cross-domain transfer, we suggest using DATNet-F model to achieve better performance. As for cross-language transfer with relatively more training data, DATNet-P model is preferred.
142
+
143
+ ![](images/38bd30d068e4b39c5cd4a5729fc9ffba13a24ca5e60e11bf15adfd7bfc834cd6.jpg)
144
+ Figure 3: The visualization of extracted features from shared bidirectional-LSTM layer. The left, middle, and right figures show the results when no Adversarial Discriminator (AD), AD, and GRAD is performed, respectively. Red points correspond to the source CoNLL-2003 English examples, and blue points correspond to the target CoNLL-2002 Spanish examples.
145
+
146
+ # 4.5 ABLATION STUDY OF DATNET
147
+
148
+ In the proposed DATNet, both GRAD and AT play important roles in low resource NER. In this experiment, we further investigate how GRAD and AT help transfer knowledge across language/domain. In the first experiment6, we used t-SNE (Maaten & Hinton, 2008) to visualize the feature distribution of BiLSTM outputs without AD, with normal AD (GRAD without considering data imbalance), and with the proposed GRAD in Figure 3. From this figure, we can see that the GRAD in DATNet makes the distribution of extracted features from the source and target datasets much more similar by considering the data imbalance, which indicates that the outputs of BiLSTM are resource-invariant.
149
+
150
+ Table 6: Quantitative Performance Comparison between Models with Different Components.
151
+
152
+ <table><tr><td colspan="4">CoNLL-2002 Spanish NER</td><td colspan="4">WNUT-2016TwitterNER</td></tr><tr><td>Model</td><td>F1-score</td><td>Model</td><td>F1-score</td><td>Model</td><td>F1-score</td><td>Model</td><td>F1-score</td></tr><tr><td>Base</td><td>85.35</td><td>+AT</td><td>86.12</td><td>Base</td><td>44.37</td><td>+AT</td><td>47.41</td></tr><tr><td>+P-T (no AD)</td><td>86.15</td><td>+AT +P-T (no AD)</td><td>86.90</td><td>+P-T (no AD)</td><td>47.66</td><td>+AT +P-T (no AD)</td><td>48.44</td></tr><tr><td>+F-T (no AD)</td><td>85.46</td><td>+AT +F-T (no AD)</td><td>86.17</td><td>+F-T (no AD)</td><td>49.79</td><td>+AT +F-T (no AD)</td><td>50.93</td></tr><tr><td>+P-T (AD)</td><td>86.32</td><td>+AT +P-T (AD)</td><td>87.19</td><td>+P-T (AD)</td><td>48.14</td><td>+AT+P-T (AD)</td><td>49.41</td></tr><tr><td>+F-T(AD)</td><td>85.58</td><td>+AT +F-T (AD) +AT +P-T (GRAD)</td><td>86.38</td><td>+F-T(AD)</td><td>50.48</td><td>+AT +F-T (AD)</td><td>51.84</td></tr><tr><td>+P-T (GRAD)</td><td>86.93</td><td>(DATNet-P)</td><td>88.16</td><td>+P-T (GRAD)</td><td>48.91</td><td>+AT+P-T (GRAD) (DATNet-P)</td><td>50.85</td></tr><tr><td>+F-T(GRAD)</td><td>85.91</td><td>+AT+F-T (GRAD) (DATNet-F)</td><td>87.04</td><td>+F-T(GRAD)</td><td>51.31</td><td>+AT +F-T (GRAD) (DATNet-F)</td><td>53.43</td></tr></table>
153
+
154
+ \* AT: Adversarial Training; P-T: P-Transfer; F-T: F-Transfer; AD: Adversarial Discriminator; GRAD: Generalized Resource-Adversarial Discriminator.
155
+
156
+ To better understand the working mechanism, Table 6 further reports the quantitative performance comparison between models with different components. We observe that GRAD shows the stable superiority over the normal AD regardless of other components. There are no always winner between DATNet-P and DATNet-F on different settings. DATNet-P architecture is more suitable to cross-language transfer while DATNet-F is more suitable to cross-domain transfer.
157
+
158
+ Table 7: Analysis of Maximum Perturbation $\epsilon _ { \mathbf { w } _ { T } }$ in AT with Varying Data Ratio $\rho$ (F1-score).
159
+
160
+ <table><tr><td>EwT</td><td>1.0</td><td>3.0</td><td>5.0</td><td>7.0</td><td>9.0</td></tr><tr><td>Ratio</td><td colspan="5">CoNLL-2002 Spanish NER</td></tr><tr><td>p=0.1</td><td>75.90</td><td>76.23</td><td>77.38</td><td>77.77</td><td>78.13</td></tr><tr><td>p=0.2</td><td>81.54</td><td>81.65</td><td>81.32</td><td>81.81</td><td>81.68</td></tr><tr><td>p=0.4</td><td>83.62</td><td>83.83</td><td>83.43</td><td>83.99</td><td>83.40</td></tr><tr><td>p=0.6</td><td>84.44</td><td>84.47</td><td>84.72</td><td>84.04</td><td>84.05</td></tr></table>
161
+
162
+ From the previous results, we know that AT helps enhance the overall performance by adding perturbations to inputs with the limit of $\epsilon = 5$ , i.e., $\| \bar { \boldsymbol { \eta } } \| _ { 2 } \le 5$ . In this experiment, we further investigate how target perturbation $\epsilon _ { \mathbf { w } _ { T } }$ with fixed source perturbation ${ \epsilon _ { { \bf w } _ { S } } } = 5$ in AT affects knowledge transfer and the results on Spanish NER are summarized in Table 7. The results generally indicate that less training data require a larger $\epsilon$ to prevent over-fitting, which further validates the necessity of AT in the case of low resource data.
163
+
164
+ Table 8: Analysis of Discriminator Weight $\alpha$ in GRAD with Varying Data Ratio $\rho$ (F1-score).
165
+
166
+ <table><tr><td>α</td><td>0.1</td><td>0.15</td><td>0.2</td><td>0.25</td><td>0.3</td><td>0.35</td><td>0.4</td><td>0.45</td><td>0.5</td><td>0.55</td><td>0.6</td><td>0.65</td><td>0.7</td><td>0.75</td><td>0.8</td></tr><tr><td>Ratio</td><td></td><td></td><td></td><td></td><td></td><td></td><td>CoNLL-2002 Spanish NER</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>p=0.1</td><td>78.37</td><td>78.63</td><td>78.70</td><td>78.32</td><td>77.96</td><td>77.92</td><td>77.88</td><td>77.78</td><td>77.85</td><td>77.90</td><td>77.65</td><td>77.57</td><td>77.38</td><td>77.49</td><td>77.29</td></tr><tr><td>p=0.2</td><td>80.99</td><td>81.71</td><td>82.18</td><td>81.57</td><td>81.53</td><td>81.55</td><td>81.44</td><td>81.25</td><td>81.32</td><td>81.16</td><td>81.02</td><td>81.16</td><td>80.63</td><td>80.79</td><td>80.54</td></tr><tr><td>p=0.4</td><td>83.76</td><td>83.73</td><td>84.18</td><td>84.48</td><td>84.26</td><td>84.12</td><td>83.54</td><td>83.40</td><td>83.52</td><td>84.18</td><td>83.42</td><td>83.47</td><td>83.28</td><td>83.33</td><td>83.19</td></tr><tr><td>p=0.6</td><td>85.18</td><td>85.24</td><td>85.85</td><td>85.68</td><td>85.84</td><td>86.10</td><td>85.71</td><td>85.74</td><td>85.42</td><td>85.60</td><td>85.20</td><td>85.40</td><td>85.26</td><td>85.24</td><td>84.98</td></tr></table>
167
+
168
+ Finally, we analyze the discriminator weight $\alpha$ in GRAD and results are summarized in Table 8. From the results, it is interesting to find that $\alpha$ is directly proportional to the data ratio $\rho$ , basically, which means that more target training data requires larger $\alpha$ (i.e., smaller $1 - \alpha$ to reduce training emphasis on the target domain) to achieve better performance.
169
+
170
+ # 5 CONCLUSION
171
+
172
+ In this paper we develop a transfer learning model DATNet for low-resource NER, which aims at addressing two problems remained in existing work, namely representation difference and resource data imbalance. We introduce two variants of DATNet, DATNet-F and DATNet-P, which can be chosen for use according to the cross-language/domain user case and the target dataset size. To improve model generalization, we propose dual adversarial learning strategies, i.e., AT and GRAD. Extensive experiments show the superiority of DATNet over existing models and it achieves new state-of-the-art performance on CoNLL NER and WNUT NER benchmark datasets.
173
+
174
+ # REFERENCES
175
+
176
+ Oliver Adams, Adam Makarucha, Graham Neubig, Steven Bird, and Trevor Cohn. Cross-lingual word embeddings for low-resource language modeling. In EACL, pp. 937–947. Association for Computational Linguistics, 2017.
177
+
178
+ Gustavo Aguilar, Suraj Maharjan, Adrian Pastor Lopez Monroy, and Thamar Solorio. A multi-task ´ approach for named entity recognition in social media data. In Proceedings of the 3rd Workshop on Noisy User-generated Text, pp. 148–153, 2017.
179
+
180
+ Rami Al-Rfou’, Vivek Kulkarni, Bryan Perozzi, and Steven Skiena. Polyglot-ner: Massive multilingual named entity recognition. In SDM, 2015.
181
+
182
+ Dzmitry Bahdanau, KyungHyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015.
183
+
184
+ Piotr Bojanowski, Edouard Grave, Armand Joulin, and Tomas Mikolov. Enriching word vectors with subword information. Transactions of the Association for Computational Linguistics, 5:135–146, 2017.
185
+
186
+ Yufeng Chen, Chengqing Zong, and Keh-Yih Su. On jointly recognizing and aligning bilingual named entities. In ACL, pp. 631–639, 2010.
187
+
188
+ Jason Chiu and Eric Nichols. Named entity recognition with bidirectional lstm-cnns. Transactions of the Association for Computational Linguistics, 4:357–370, 2016.
189
+
190
+ Ronan Collobert, Jason Weston, Leon Bottou, Michael Karlen, Koray Kavukcuoglu, and Pavel ´ Kuksa. Natural language processing (almost) from scratch. JMLR, pp. 2493–2537, 2011.
191
+
192
+ Ryan Cotterell and Kevin Duh. Low-resource named entity recognition with cross-lingual, character-level neural conditional random fields. In Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pp. 91–96. Asian Federation of Natural Language Processing, 2017.
193
+
194
+ Meng Fang and Trevor Cohn. Model transfer for tagging low-resource languages using a bilingual dictionary. In ACL, pp. 587–593, 2017.
195
+
196
+ Xiaocheng Feng, Xiachong Feng, Bing Qin, Zhangyin Feng, and Ting Liu. Improving low resource named entity recognition using cross-lingual knowledge transfer. In IJCAI, pp. 4071–4077, 2018.
197
+
198
+ Dan Gillick, Cliff Brunk, Oriol Vinyals, and Amarnag Subramanya. Multilingual language processing from bytes. In NAACL HLT, pp. 1296–1306, 2016.
199
+
200
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in neural information processing systems, 2014.
201
+
202
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In ICLR, 2015.
203
+
204
+ Tao Gui, Qi Zhang, Haoran Huang, Minlong Peng, and Xuanjing Huang. Part-of-speech tagging for twitter with adversarial neural networks. In EMNLP, pp. 2411–2420, 2017.
205
+
206
+ Kazuma Hashimoto, caiming xiong, Yoshimasa Tsuruoka, and Richard Socher. A joint many-task model: Growing a neural network for multiple nlp tasks. In EMNLP, pp. 1923–1933, 2017.
207
+
208
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 1997.
209
+
210
+ Zhiheng Huang, Wei Xu, and Kai Yu. Bidirectional lstm-crf models for sequence tagging. CoRR, abs/1508.01991, 2015.
211
+
212
+ Joo-Kyung Kim, Young-Bum Kim, Ruhi Sarikaya, and Eric Fosler-Lussier. Cross-lingual transfer learning for pos tagging without cross-lingual resources. In EMNLP, pp. 2832–2838, 2017.
213
+
214
+ Sang Erik F. Tjong Kim. Introduction to the conll-2002 shared task: Language-independent named entity recognition. In COLING-02: The 6th Conference on Natural Language Learning 2002 (CoNLL-2002), 2002.
215
+
216
+ Sang Erik F. Tjong Kim and Meulder Fien De. Introduction to the conll-2003 shared task: Languageindependent named entity recognition. In NAACL HLT, 2003.
217
+
218
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, 2014.
219
+
220
+ John D. Lafferty, Andrew McCallum, and Fernando C. N. Pereira. Conditional random fields: Probabilistic models for segmenting and labeling sequence data. In Proceedings of the Eighteenth International Conference on Machine Learning, ICML ’01, 2001.
221
+
222
+ Guillaume Lample, Miguel Ballesteros, Sandeep Subramanian, Kazuya Kawakami, and Chris Dyer. Neural architectures for named entity recognition. In NAACL HLT, pp. 260–270, 2016.
223
+
224
+ Qi Li, Haibo Li, Heng Ji, Wen Wang, Jing Zheng, and Fei Huang. Joint bilingual name tagging for parallel corpora. In CIKM ’12, pp. 1727–1731, 2012.
225
+
226
+ Nut Limsopatham and Nigel Collier. Bidirectional lstm for named entity recognition in twitter messages. In Proceedings of the 2nd Workshop on Noisy User-generated Text (WNUT), pp. 145– 152, 2016.
227
+
228
+ Bill Y. Lin, Frank Xu, Zhiyi Luo, and Kenny Zhu. Multi-channel bilstm-crf model for emerging named entity recognition in social media. In Proceedings of the 3rd Workshop on Noisy Usergenerated Text, pp. 160–165, 2017a.
229
+
230
+ T. Lin, P. Goyal, R. Girshick, K. He, and P. Dollar. Focal loss for dense object detection. In 2017 IEEE International Conference on Computer Vision (ICCV), 2017b.
231
+
232
+ Ying Lin, Shengqi Yang, Veselin Stoyanov, and Heng Ji. A multi-lingual multi-task architecture for low-resource sequence labeling. In ACL, 2018.
233
+
234
+ L. Liu, J. Shang, F. Xu, X. Ren, H. Gui, J. Peng, and J. Han. Empower sequence labeling with task-aware neural language model. In AAAI, 2018.
235
+
236
+ Pengfei Liu, Xipeng Qiu, and Xuanjing Huang. Adversarial multi-task learning for text classification. In ACL, 2017.
237
+
238
+ Gang Luo, Xiaojiang Huang, Chin-Yew Lin, and Zaiqing Nie. Joint entity recognition and disambiguation. In EMNLP, pp. 879–888, 2015.
239
+
240
+ Minh-Thang Luong, Quoc V. Le, Ilya Sutskever, Oriol Vinyals, and Lukasz Kaiser. Multi-task sequence to sequence learning. In ICLR, 2016.
241
+
242
+ Xuezhe Ma and Eduard Hovy. End-to-end sequence labeling via bi-directional lstm-cnns-crf. In ACL, pp. 1064–1074, 2016.
243
+
244
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. JMLR, 9:2579–2605, 2008.
245
+
246
+ Monica Marrero, Juli ´ an Urbano, Sonia S ´ anchez-Cuadrado, Jorge Morato, and Juan Miguel G ´ omez- ´ Berb´ıs. Named entity recognition: Fallacies, challenges and opportunities. Computer Standards & Interfaces, (5):482–489, 2013.
247
+
248
+ Stephen Mayhew, Chen-Tse Tsai, and Dan Roth. Cheap translation for cross-lingual named entity recognition. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 2536–2545. Association for Computational Linguistics, 2017.
249
+
250
+ Takeru Miyato, Andrew M Dai, and Ian Goodfellow. Adversarial training methods for semisupervised text classification. In ICLR, 2017.
251
+
252
+ Jian Ni and Radu Florian. Improving multilingual named entity recognition with wikipedia entity type mapping. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 1275–1284, 2016.
253
+
254
+ Jian Ni, Georgiana Dinu, and Radu Florian. Weakly supervised cross-lingual named entity recognition via effective annotation and representation projection. In ACL, pp. 1470–1480, 2017.
255
+
256
+ Xiaoman Pan, Boliang Zhang, Jonathan May, Joel Nothman, Kevin Knight, and Heng Ji. Crosslingual name tagging and linking for 282 languages. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1946–1958. Association for Computational Linguistics, 2017.
257
+
258
+ Ioannis Partalas, Cedric Lopez, Nadia Derbas, and Ruslan Kalitvianski. Learning to search for rec-´ ognizing named entities in twitter. In Proceedings of the 2nd Workshop on Noisy User-generated Text (WNUT), pp. 171–177, 2016.
259
+
260
+ Alexandre Passos, Vineet Kumar, and Andrew McCallum. Lexicon infused phrase embeddings for named entity resolution. arXiv preprint arXiv:1404.5367, 2014.
261
+
262
+ Chen Pin-Yu, Sharma Yash, Zhang Huan, Yi Jinfeng, and Cho-Jui Hsieh. Ead: Elastic-net attacks to deep neural networks via adversarial examples. In AAAI, 2018.
263
+
264
+ Lev Ratinov and Dan Roth. Design challenges and misconceptions in named entity recognition. In Proceedings of the Thirteenth Conference on Computational Natural Language Learning, pp. 147–155, 2009.
265
+
266
+ Marek Rei. Semi-supervised multitask learning for sequence labeling. In ACL, pp. 2121–2130, 2017.
267
+
268
+ Marek Rei and Anders Søgaard. Zero-shot sequence labeling: Transferring knowledge from sentences to tokens. In NAACL HLT, pp. 293–302, 2018.
269
+
270
+ Nils Reimers and Iryna Gurevych. Reporting score distributions makes a difference: Performance study of lstm-networks for sequence tagging. In EMNLP, pp. 338–348, 2017.
271
+
272
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. JMLR, pp. 1929–1958, 2014.
273
+
274
+ Christian Szegedy, Wojciech Zaremba, Dumitru Erhan Ian Goodfellow Ilya Sutskever, Joan Bruna, and Rob Fergus. Intriguing properties of neural networks. In ICLR, 2014.
275
+
276
+ Pius von Daniken and Mark Cieliebak. Transfer learning and sentence level features for named ¨ entity recognition on tweets. In Proceedings of the 3rd Workshop on Noisy User-generated Text, pp. 166–171, 2017.
277
+
278
+ Zhilin Yang, Ruslan Salakhutdinov, and William W. Cohen. Multi-task cross-lingual sequence tagging from scratch. CoRR, abs/1603.06270, 2016.
279
+
280
+ Zhilin Yang, Ruslan Salakhutdinov, and William W. Cohen. Transfer learning for sequence tagging with hierarchical recurrent networks. In ICLR, 2017.
281
+
282
+ David Yarowsky, Grace Ngai, and Richard Wicentowski. Inducing multilingual text analysis tools via robust projection across aligned corpora. In Proceedings of the first international conference on Human language technology research, pp. 1–8, 2001.
283
+
284
+ Michihiro Yasunaga, Jungo Kasai, and Dragomir Radev. Robust multilingual part-of-speech tagging via adversarial training. In NAACL HLT, pp. 976–986, 2018.
285
+
286
+ Daniel et al. Zeman. Conll 2017 shared task: Multilingual parsing from raw text to universal dependencies. In Proceedings of the CoNLL 2017 Shared Task: Multilingual Parsing from Raw Text to Universal Dependencies, pp. 1–19, 2017.
287
+
288
+ Boliang Zhang, Xiaoman Pan, Tianlu Wang, Ashish Vaswani, Heng Ji, Kevin Knight, and Daniel Marcu. Name tagging for low-resource incident languages based on expectation-driven learning. In NAACL HLT, pp. 249–259, 2016.
289
+
290
+ Andrej Zukov Gregoric, Yoram Bachrach, and Sam Coope. Named entity recognition with parallel recurrent neural networks. In ACL, pp. 69–74, 2018.
md/train/HkgXteBYPB/HkgXteBYPB.md ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # STOCHASTIC NEURAL PHYSICS PREDICTOR
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Recently, neural-network based forward dynamics models have been proposed that attempt to learn the dynamics of physical systems in a deterministic way. While near-term motion can be predicted accurately, long-term predictions suffer from accumulating input and prediction errors which can lead to plausible but different trajectories that diverge from the ground truth. A system that predicts distributions of the future physical states for long time horizons based on its uncertainty is thus a promising solution. In this work, we introduce a novel robust Monte Carlo sampling based graph-convolutional dropout method that allows us to sample multiple plausible trajectories for an initial state given a neural-network based forward dynamics predictor. By introducing a new shape preservation loss and training our dynamics model recurrently, we stabilize long-term predictions. We show that our model’s long-term forward dynamics prediction errors on complicated physical interactions of rigid and deformable objects of various shapes are significantly lower than existing strong baselines. Lastly, we demonstrate how generating multiple trajectories with our Monte Carlo dropout method can be used to train model-free reinforcement learning agents faster and to better solutions on simple manipulation tasks.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Learning to predict the physical motion of objects from data is an open area of research. Yet, recent (hierarchical) relation network based forward dynamics predictors (Battaglia et al., 2016; Chang et al., 2016; Mrowca et al., 2018; Li et al., 2019) seem to be a promising alternative to conventional physics engines that are key components of robot control, computer vision and reinforcement learning (RL) systems. Physics simulators, both traditional numerical solvers and learned prediction models, still suffer from insufficient accuracy in challenging scenarios. Small errors in the input and model can lead to dramatically different object trajectories. Take the orange ball that is falling on the blue wedge in Figure 1. Depending on where the orange ball starts or what bias the model has, the ball could either end up on the left or right side. Both are valid outcomes. However, deterministic physics engines will either predict one trajectory or the other.
12
+
13
+ ![](images/0e12da0569d39ce72d103d2b4d295aa86904cc626073b5c0913c1c94adcc69a3.jpg)
14
+ Figure 1: Uncertainty in physics. Small errors in the input and prediction can lead to significantly different object trajectories. The orange ball could either end up on the left or right side of the wedge.
15
+
16
+ While it is important to reduce errors in each prediction, it is also important to acknowledge that uncertain situations might not have one but multiple possible outcomes. In machine learning, uncertainty-aware neural networks avoid deterministic point estimates by predicting distributions or by randomly sampling in the prediction interval. In the context of dynamics predictions, we propose to use Monte Carlo sampling based dropout on the model weights of a learned forward dynamics predictor to model uncertainty and sample multiple plausible trajectories for an initial state. To stabilize each trajectory and reduce error accumulation over long-time horizons, we use a state-invariant recurrent training mechanism. By feeding back predictions as input over multiple time steps, the model becomes more robust to its own prediction errors without the need for a hidden state. Finally, we introduce a new shape loss on the model predictions that constrains the pairwise distances between objects and object parts and greatly improves shape preservation and the stability of trajectories over long-time horizons. Our final fully differentiable forward dynamics model is able to sample multiple, more accurate and more stable trajectories over long-time horizons compared to existing baselines.
17
+
18
+ An accurate forward dynamics predictor that is able to predict a distribution of future states can be of great importance for robotic control. In model-free reinforcement learning, accomplishing tasks through random exploration is sample inefficient and hardly generalizable. Model-based methods promise greater generalization abilities, but suffer from deterministic world models that are hard to learn and fail in stochastic environments. With our stochastic forward dynamics predictor, we can move part of the sampling process into the environment, physically grounding the random exploration of model-free agents. As the agent is able to observe multiple trajectories at a given state without actually executing multiple actions, the sample efficiency is greatly improved while the stochasticity of each state and action is implicitly learned. We show on several control experiments that a model-free agent trained in our stochastic forward dynamics environment is not only able to better explore and learn faster but often also comes to better solutions than agents trained in deterministic environments.
19
+
20
+ In summary, (1) we propose a stochastic differentiable forward dynamics model that is able to generate multiple plausible trajectories via Monte Carlo (MC) based graph-convolutional dropout. (2) We greatly improve the accuracy and stability of long-term predictions by proposing a new fullyconnected shape loss term and training the model recurrently end-to-end in a state-invariant way. (3) We demonstrate how our stochastic dynamics model can be used to improve the efficiency and performance of model-free reinforcement learning agents on several physical manipulation tasks.
21
+
22
+ # 2 RELATED WORK
23
+
24
+ Physical dynamics prediction has long been an open research questions (Fragkiadaki et al., 2015; Agrawal et al., 2016; Li et al., 2016; Finn et al., 2016; Lerer et al., 2016; Mottaghi et al., 2016a;b; Haber et al., 2018; Tran et al., 2015; 2016; Qi et al., 2017a;b; Byravan & Fox, 2017). Recent advancements in deep learning allowed for emergence of successful systems that aim at solving this problem by learning from data. Battaglia et al. (2016) and Chang et al. (2016) proposed a graph-based approach with object-centric and relation-centric representations, and a neural network architecture that predicts object dynamics and interaction between objects in complex 2D scenes. Similarly, Mrowca et al. (2018) and Li et al. (2019) implement a relational network with particle representation for objects, but extend this approach to 3D scenes introducing hierarchical graph representations for computational tractability. These works rely however on a single step prediction during training. We propose a recurrent training scheme on multiple step predictions and show lower long-term error in our experiments.
25
+
26
+ Simulating future plausible object states under physical and user constraints is a commonly addressed challenge in computer graphics. Chenney & Forsyth (2000) analysed uncertainties in their simulation model for multi-body scenarios and used a Markov chain Monte Carlo algorithm to predict multiple trajectories. Twigg & James (2007) based their work on psychological findings about human errors in predicting object dynamics and simulated multiple future environment states by applying external random impulses to colliding bodies. Trajectories generated by both of the mentioned methods are visually plausible to human, but can often diverge from the real physical behavior and require extensive expertise to choose simulation parameters that ensure convergence. Huberman & Struss (1992) support the psychological theory behind the latter work, further suggesting that human predictions of non-linear dynamic effects such as collisions are far from perfect, and thus allow for a less advanced perturbation methods. Han et al. (2013) draw a line between physical and visual plausibility naming further factors improving the visual plausibility of a scenario such as the number of simultaneous collisions or homogeneity of colliding objects. In physical systems, situations that are non-intuitive to human can occur due to an unobservable state of the environment, e.g an object colliding with a fast rotating wheel or an unexpected behavior of a compressed spring. This opposes the goal of computer graphics were visual plausibility becomes a stronger requirement (Barzel et al., 1996) and motivates the search for more sophisticated methods for sampling probable states in physics engines.
27
+
28
+ Multiple techniques allow neural networks to incorporate uncertainty in model predictions. MeanVariance-Estimation (Nix & Weigend, 1994) is a method that circumvents point estimates in the output space by directly predicting a normal distribution. Um et al. (2018) used this method along with a particle-based representation for splash prediction. Assuming independent velocity distributions for each splash particle produced visually pleasing results. In our initial experiments for stochastic simulations, this method lead to unsatisfactory results. We observed that Mean-VarianceEstimation method is capable of indicating highly uncertain situations e.g collisions or force applications. Unfortunately, due to the lack of space-time consistency between particles that are present in real objects, this approach lead to incorrect shape predictions during test time.
29
+
30
+ Stochastic regularization as a way of capturing model uncertainty is an active field of research with scarce theoretical foundations. Nonetheless, we see a growing number of practical applications of this group of algorithms in numerous research areas (Gal et al., 2017; Bhattacharyya et al., 2017; Kendall et al., 2015; Kampffmeyer et al., 2016). Gal & Ghahramani (2016) proposed applying dropout during training and inference as a Bayesian inference approximation with prediction variance as the measure of the epistemic uncertainty. A clear advantage of this method is the ability to visualize the results of each predicted trajectory. On the other hand the computational cost grows linearly with the number of samples.
31
+
32
+ Prior work has shown that injecting noise into neural networks is successful not only as a regularization method (Noh et al., 2017; Kang et al., 2016) but also in the training of RL agents Xia et al. (2018); Chua et al. (2018). In model-free RL, temporal credit assignment, sparse reward, and exploration-exploitation trade-offs present significant challenges. Long episodes amplify both problems of credit assignment and reward sparsity, where naive exploration causes exponentially growing sample inefficiency (Osband et al., 2016). Reward shaping is one counter measure that improves credit assignment, and consequently sample efficiency, in model-free RL (Grzes, 2017; Zou ´ et al., 2019). Designing shaping functions usually requires expert knowledge and hand-engineering, while also imposing constraints on how the agent solves the task. Such constraints may prevent the agent from solving the task optimally. Predicting a set of trajectories can be framed here as a reward relaxation method with the clear advantage of depending on a single parameter - dropout rate. Fortunato et al. (2017) introduced parametric noise learned with gradient descent into action prediction network, which led to significantly better exploration and higher rewards without creating large computational overhead. This method shows clear potential for stochastic methods to improve training efficiency in reinforcement learning.
33
+
34
+ # 3 APPROACH
35
+
36
+ ![](images/fb29ae1c1503928ba0b2abe9cecb7855843ebe867dde278cfb68dc2649adf99f.jpg)
37
+ Figure 2: Hierarchical Relation Network (HRN) architecture. Force, collision and past effects on particles are computed and then propagated through each object hierarchy. The propagated effects are used to predict the next particle positions. Gray blocks represent graph convolutional effect propagation modules.
38
+
39
+ Our stochastic forward dynamics model is based on the deterministic hierarchical relation network (HRN) as proposed by Mrowca et al. (2018) and depicted in Figure 2.
40
+
41
+ Hierarchical graph representation: Propagating effects through a fully-connected scene graph is computationally infeasible. HRN circumvents this problem by leveraging a tree-like graph form that defines a constrained subset of edges for more efficient effect propagation. Edges within each object graph comprise shape and material properties, describing how rigid, soft and ”cloth-like” the material is as defined in our simulator. Edges across object graphs describe physical relations between objects such as contact forces. The hierarchy construction starts with the particles at the lowest level as provided by our ground truth simulator. Each next level of the hierarchy is constructed by clustering particles based on their states. The state attributes are the position, the velocity and the mass. Finally, nodes at each hierarchical level represent the state of an object, an object part, an object subpart and so forth down to single object particles. HRN takes a sequence of the past two hierarchical physics graphs $G _ { 1 , 2 }$ which consist of hierarchical object graphs as input and predicts the next state of the scene graph.
42
+
43
+ Force, Collision and History Modules: HRN assumes three effects that act on particles at the lowest level of the hierarchy and that influence the next particle state: external forces, interactions with particles of other objects in close proximity and particle’s state history. Inputs to these modules are current particle states, external forces (Force Module) and states of particles with which the particle interacts (Collision Module). Each module computes an embedding vector that represents the effects of the external forces, the collisions and the past states on the particle using pairwise graph convolutions. These effects are combined by summation and enter the Hierarchical Effect Propagation Module.
44
+
45
+ Hierarchical Effect Propagation Module: HRN predicts the next graph state by estimating the influence that particles within each object and across objects exert upon each other. The compounded effects from the Force, Collision and History Modules are propagated not only up and down the hierarchy, but also between particles at the same level by hierarchical graph convolutions that are implemented as fully-connected networks with weight sharing. Each forward pass takes the states of two connected particles and outputs an embedding vector that describes the influence of the first particle on the latter. These effect embedding vectors are collected for each particle in the scene graph and are used to estimate the future particle velocity.
46
+
47
+ Next State Prediction Module This module is realized as a feed-forward fully-connected neural network and predicts per-particle future velocity. It takes in the current particle state consisting of the position, velocity and mass, as well as the sum of effect embedding vectors belonging to the particle. The predicted particle velocity is expressed in the local coordinate frame, i.e relative the corresponding particle at the higher level in the hierarchy. The state of the particle at the highest level additionally includes gravity and is defined in the global coordinate frame.
48
+
49
+ To make the HRN stochastic and sample multiple plausible trajectories for a given initial state, we introduce a Monte Carlo based dropout on the activations of the graph convolutional collision and force modules. We greatly improve model predictions by introducing a new fully-connected shape loss term and a state-invariant recurrent training procedure. Our final model creates realistic trajectories that are suited to train a model-free agent for manipulation tasks.
50
+
51
+ # 3.1 STABLE LONG PREDICTIONS VIA RECURRENT TRAINING AND SHAPE CONSTRAINTS
52
+
53
+ Stable realistic long-term predictions are crucial for planning tasks. While HRN predictions are accurate for a large number of complex physical scenarios, we identify that objects fall apart relatively quickly along boundaries of object parts for two reasons.
54
+
55
+ First, the HRN’s loss function is designed to minimize the error between predicted and ground truth states while imposing a group shape constraint. As shown in the left panel of Figure 3, this group shape loss optimizes the pairwise distances between object nodes within a group to be the same as the ground truth pairwise distances. It does not impose that the pairwise distances across groups are the same as the ground truth distances, which leads to unrealistic deformations between groups as depicted in Figure 5. We therefore introduce a stronger fully-connected shape constraint (Figure Figure 3, right) that imposes pairwise distances to be the same as ground truth pairwise distances across all possible node combinations, which improves shape preservation significantly.
56
+
57
+ Second, the HRN’s prediction errors accumulate exponentially as predictions are fed back in recurrently during inference to generate multi-step trajectory predictions. However, during training the HRN is only supervised with the next ground truth state and thus never gets its own perturbed predictions as input. To make the HRN robust against prediction errors, we therefore propose to train the model recurrently in a state-invariant way, i.e. without using a hidden state as physical dynamics is state-free (Figure 4). The overall loss is the sum of losses from each time step. Learning recurrently on long sequences, the network optimizes its weights taking into account its own prediction errors during training. This significantly reduces error accumulation during inference time.
58
+
59
+ ![](images/99645994c1b6ee906189f0b82fa1c28d34f467be2b075299b09a7eb8b1d5077d.jpg)
60
+ Figure 3: Shape loss. The HRN shape loss only constraints particle distances within object particle groups (left). Our new fully-connected shape loss constraints distances between all particles pairs within each objects (right).
61
+
62
+ ![](images/ac0a8c4222cd9fd495e7ebd3d5cb98fefa062ec39de3bbca3c6a2cefee49ea1a.jpg)
63
+ Figure 4: Recurrent training. Model predictions are fed back recurrently as input to stabilize long-term predictions.
64
+
65
+ # 3.2 SAMPLING REALISTIC TRAJECTORIES WITH MONTE CARLO DROPOUT
66
+
67
+ For sampling physically plausible object trajectories, we introduce a novel Monte Carlo sampling based graph-convolutional dropout method. Dropout as proposed by Srivastava et al. (2014) removes a certain number of randomly chosen nodes in a neural network to prevent overfitting with a probability commonly referred to as dropout rate. In each iteration, a new set of nodes is sampled and only the edge weights attached to the active nodes are updated via backpropagation. In our novel approach, we use randomly sample dropout masks on graph-convolution kernels to sample physically plausible trajectories. To keep the kernel fixed independent of its position in the graph, we only sample once per prediction step. To infer a set of plausible trajectories, we randomly sample a dropout mask for each generated trajectory during test time, similarly how Gal & Ghahramani (2016) uses dropout to generate multiple predictions. The modular architecture of the HRN allows us to apply dropout at different locations in a very interpretable way (Figure 2. Dropout on the collision module makes sampled trajectories diverge at collision points. Dropout on the force module leads to diverging trajectories during force applications. Dropout on other HRN modules lead to convergence problems and unrealistic predictions. In the following experiments, we thus only apply dropout to the HRN’s force and collision modules. Applying our dropout based sampling method on our dynamics model results in physically plausible long-term predictions with consistent shapes.
68
+
69
+ # 3.3 MODEL-FREE REINFORCEMENT LEARNING ON STOCHASTIC ENVIRONMENTS
70
+
71
+ The ability to sample a distribution of physically plausible trajectories can be used to improve the efficiency of exploration of model-free reinforcement learning agents. We thus train a model-free policy on our stochastic physics predictor to achieve physical manipulation tasks as follows. At each episode during training, we input the agent’s action and current state into our stochastic forward dynamics predictor and sample a set of 5 future states with our dropout method. For accelerated training, we introduce a reward relaxation method which consists of rewarding an agent as soon as one of the trajectories from the sampled set leads to the goal, naturally exposing the agent to rewards much quicker. If none of the trajectories hits the goal, one future state is chosen at random and the sampling process is repeated for the next future state. The level of reward relaxation is controlled by the dropout rate. The higher the dropout rate, the wider the set of trajectories and the easier it is for the agent to be rewarded. This directs the agent much quicker towards the reward in early training stages. In scenarios requiring high levels of accuracy and repeatability, we find that a gradual reduction of the dropout rate during policy training helps convergence and leads to more efficient policies compared to a fixed dropout rate, which we show in the following experiments.
72
+
73
+ # 4 EXPERIMENTS
74
+
75
+ In our experiments, we first show that our recurrent training and new fully-connected shape loss significantly improve the prediction quality for single long-term trajectories on complex physical scenarios over baselines. We then demonstrate how our proposed Monte Carlo sampling based dropout method generates multiple high-quality trajectories by visualizing stochastic model rollouts. Lastly, we use our stochastic forward dynamics model’s ability to generate multiple trajectories to train a model-free policy on two physical manipulation tasks more efficiently and to higher reward.
76
+
77
+ # 4.1 FORWARD DYNAMICS PREDICTION PERFORMANCE
78
+
79
+ # 4.1.1 EXPERIMENTAL SETUP
80
+
81
+ We evaluate our models forward dynamics prediction performance against the HRN baseline (Mrowca et al., 2018) on two complex scenarios. The first scenario showcases the ability of our model to predict complex deformations: A deformable soft cube is first lifted off the ground by an upward impulse and then falls toward the ground while rotating and deforming on impact (Figure 5 left). In the second scenario, we evaluate our models performance on complex collisions. Collisions can greatly magnify object position and pose errors leading to large discrepancies between predictions and ground truth. For our collision experiment, two rigid cubes are placed at a random distance from each other and then repeatedly accelerated by an impulse on each cube into another to generate collisions (Figure 5 right). We train our model on a multitude of examples of both scenarios and evaluate on held out examples. We compare the mean squared error on positions, velocities and shape loss and show qualitative long-term predictions of our model and the HRN baseline.
82
+
83
+ # 4.1.2 RESULTS
84
+
85
+ In Table 1, we present our quantitative results on the deformation and collision task. Our fullyconnected shape loss and recurrent training procedure significantly lower long-term prediction errors in both scenarios. On the collision task, initial position and velocity error increase slightly compared to the baseline but accumulate to far lower errors in the long run. Empirically, we found that our recurrent training procedure works best with sequence lengths between 4 and 6 time steps. Longer sequence lengths prevent the model from converging during training. We found that gradually increasing the sequence length during training is an effective countermeasure.
86
+
87
+ The improvements of our model over the HRN baseline are obvious in visualizations of predicted trajectories (Figure 5). Whereas HRN predictions fall apart along object boundaries and sometimes penetrate objects, our method preserves shapes and resolves collisions much better and predicts positions much closer to the ground truth, leaving us with an adequate basis for generating multiple plausible trajectories with our sampling method.
88
+
89
+ Table 1: Quantitative dynamics prediction evaluation. We compare the mean squared error on positions, velocities and shape preservation for our model with the baseline HRN model. Our model outperforms the baseline on deformation predictions and long-term collision predictions.
90
+
91
+ <table><tr><td rowspan=2 colspan=2></td><td rowspan=1 colspan=2>Position MSE</td><td rowspan=1 colspan=2>Velocity MSE</td><td rowspan=1 colspan=2> Shape MSE</td></tr><tr><td rowspan=1 colspan=1>t+5</td><td rowspan=1 colspan=1>t+15</td><td rowspan=1 colspan=1>t+5</td><td rowspan=1 colspan=1>t+15</td><td rowspan=1 colspan=1>t+5</td><td rowspan=1 colspan=1>t+15</td></tr><tr><td rowspan=2 colspan=1>Deformations</td><td rowspan=1 colspan=1>HRN</td><td rowspan=1 colspan=1>0.00064</td><td rowspan=1 colspan=1>0.017</td><td rowspan=1 colspan=1>0.00019</td><td rowspan=1 colspan=1>0.0013</td><td rowspan=1 colspan=1>0.037</td><td rowspan=1 colspan=1>0.092</td></tr><tr><td rowspan=1 colspan=1>Ours</td><td rowspan=1 colspan=1>0.00039</td><td rowspan=1 colspan=1>0.011</td><td rowspan=1 colspan=1>0.00003</td><td rowspan=1 colspan=1>0.00043</td><td rowspan=1 colspan=1>0.0051</td><td rowspan=1 colspan=1>0.019</td></tr><tr><td rowspan=2 colspan=1>Collisions</td><td rowspan=1 colspan=1>HRN</td><td rowspan=1 colspan=1>0.028</td><td rowspan=1 colspan=1>0.84</td><td rowspan=1 colspan=1>0.0045</td><td rowspan=1 colspan=1>0.032</td><td rowspan=1 colspan=1>0.018</td><td rowspan=1 colspan=1>0.054</td></tr><tr><td rowspan=1 colspan=1>Ours</td><td rowspan=1 colspan=1>0.029</td><td rowspan=1 colspan=1>0.63</td><td rowspan=1 colspan=1>0.0061</td><td rowspan=1 colspan=1>0.019</td><td rowspan=1 colspan=1>0.0020</td><td rowspan=1 colspan=1>0.0039</td></tr></table>
92
+
93
+ ![](images/981f81b698c5cc2d38d6292187b385163d68b06e2c8980abea4fef77b59b3984.jpg)
94
+ Figure 5: Dynamics prediction comparisons. Our method is compared to the HRN baseline and ground truth. a) A soft cube bounces of the ground. b) Two rigid cubes collide. Our method preserves the geometry of objects better over long time horizons.
95
+
96
+ # 4.2 SAMPLING MULTIPLE PLAUSIBLE TRAJECTORIES
97
+
98
+ # 4.2.1 EXPERIMENTAL SETUP
99
+
100
+ In this section, we demonstrate that our Monte Carlo sampling based dropout method can sample multiple physically plausible trajectories from our forward dynamics predictor under the same initial state. In two complex scenarios we study our model’s uncertainty during force applications and collisions. In the first scenario, an external force lifts a soft body, which subsequently drops toward the floor rotating slightly. By applying dropout to the force module (Figure 2), we generate multiple trajectories that arise due to our model’s uncertainty during force applications. We use a dropout rate of 0.1 during training and 0.3 during testing. In the second scenario, we show that our proposed method produces realistic sets of trajectories in collision scenarios. Forces are applied to two rigid cubes pushing them towards each other causing collision. Dropout is applied to both force and collision module with a rate of 0.05 both during training and testing.
101
+
102
+ # 4.2.2 RESULTS
103
+
104
+ The visualizations of multi trajectory roll-outs in Figure 6 show that the sets of predicted trajectories are physically and visually plausible. Due to the modularity of the HRN model, targeted stochasticity can be applied within each submodule via dropout, introducing uncertainty in the output of force and collision predictions. Our proposed sampling method is able to capture trajectory distributions ranging from single mode low variance to complex, multi-modal distributions. Dropout rates between 0.05 and 0.3 allow for fast convergence during training and a wide variety of visually plausible sample trajectories during inference. We notice that inference dropout rates that differ significantly from the training rates can cause biased predictions leading to, e.g. objects slowly drifting away in one direction. Additional results studying the effect of the dropout rate on the width of the state distributions can be found in supplement Figure 10.
105
+
106
+ ![](images/1ed20dfc750f9f1cdc66a49215802d87998d4a827418ba7a9c8ad557696d8473.jpg)
107
+
108
+ Figure 6: Example sampled multiple trajectories. We use dropout on the force and collision module to sample multiple trajectories given the same initial input. Dark colors depict the ground truth trajectory. Light colors depict imagined sampled trajectories. The performance of our model in forward simulation is maintained at a high level despite the introduced graph-convolutional dropout. Deformations: A soft cube bounces off the ground. Collisions: Two rigid cubes collide. Our method is able to sample multiple physically plausible trajectory in each scenario. Falling on a wedge: We simulate the situation from Fig 1. A rigid objects falls on a wedge. Stochastic simulation allows for a multi-modal prediction. Multiple materials: A rigid and a soft object interact with a cloth while falling on the ground.
109
+
110
+ # 4.3 MODEL-FREE REINFORCEMENT LEARNING
111
+
112
+ # 4.3.1 EXPERIMENTAL SETUP
113
+
114
+ We show that stochastic physical environments are useful for intelligent systems by training reinforcement learning agents in two different scenarios involving various physical interaction types and materials. We use Proximal Policy Optimization (Schulman et al., 2017) as a model-free reinforcement learning method in all scenarios. Similarly to Plappert et al. (2017), we add a further baseline in which we use the deterministic environment and add Gaussian noise in the action space.
115
+
116
+ Cube moving task: In this scenario, the agent learns to apply a sequence of forces to rigid cubes such that at least one of the cubes is pushed towards the goal region. The maximum length of the episode is 10. Here, the two cubes are transparent to each other and cannot collide. The stochasticity originates entirely from the uncertainty in the force application. We use a constant dropout rate of 0.1 in the force module of our physics predictor throughout the whole training.
117
+
118
+ Ball hitting tower task: Tasks that require inducing collisions pose a significantly more difficult challenge to the RL agent. In this scenario, there is a stack of three rigid cubes and a ball to which the agent can apply force. The agent gets a reward for pushing the middle cube out of the tower. To achieve the goal, the agent needs to hit the tower with the ball to which it applies forces. The maximum episode length is 15 steps.
119
+
120
+ ![](images/9a7773310d97a5c4fc6bfbeda255c607e4002bd1e10b486f3a807f0c503f89b9.jpg)
121
+ Figure 7: Average episode length in the ”cube moving task”. We compare a deterministic environment against action space noise and 2 randomly seeded stochastic environments. The agent learns faster in stochastic environments through better initial exploration and converges to a shorter policy.
122
+
123
+ ![](images/9e071683c6d8bf4cbf4ed733c1f17343a33d2ba69665d418fa8764a8569904dc.jpg)
124
+ Figure 8: Average episode length in the ”ballhits-tower task”. We compare a deterministic environment against action space noise, a stochastic environment where the dropout rate is fixed and 3 randomly seeded stochastic environments where the dropout rate is annealed. The agent finds shorter policies earlier in the training indicating more efficient exploration in the stochastic environments.
125
+
126
+ ![](images/15bbe688604029b7e6fe729a51bd3b9e17704ef4a3e4ca7f7c51d887a32cdff5.jpg)
127
+ Figure 9: Policy comparisons. a) Cube moving task. Top: Policy learned in a deterministic environment (longer, 4 time steps). Bottom: Policy learned in a stochastic environment (shorter, 2 time steps). The first two frames are model inputs. The red cubes indicate the target position to which the green cubes have to be moved. b) Ball hitting tower task. Agents in deterministic and stochastic environments converge to similar 4 step policies. The figure depicts one 4 step policy example.
128
+
129
+ # 4.3.2 RESULTS
130
+
131
+ Cube moving task: In this example, introducing the action space noise leads to faster learning compared to learning in the deterministic environment. Training in stochastic physical environments outperforms both baselines, allows for better exploration and finding of shorter policies. In Figure 9, we visualize the two learned policies, in stochastic and deterministic environments.
132
+
133
+ Ball hitting tower task: In this scenario, the agent finds more efficient policies through the application of stronger forces during training, which results in gradually shorter policies as shown in Figure 8. The most effective learning method is learning in a stochastic environment with the dropout rate annealing. We lower the dropout rate linearly from 0.1 at the start to 0 after 1200 training updates. This method allows for initial fast exploration, but does not introduce too high stochasticity when precision is needed as the agent begins applying strong forces later in the training. Without annealing, the randomness is too high and agents learn longer policies in a noisy training process, as indicated by the red curve in Figure 8. Furthermore, action space noise improves the pace at which the agent learns compared to the entirely deterministic environment. The policies learned by the presented methods do not significantly differ. An exemplary policy is visualized in Figure 9.
134
+
135
+ # 5 CONCLUSION
136
+
137
+ Qualitatively our stochastic HRN predicts plausible future trajectories; an experiment in which human subjects were asked to discriminate between ground-truth and predicted trajectories could be used to evaluate its performance quantitatively. Even though this method does not require extensive expert knowledge, a few design decisions have to be made e.g dropout rates for training and inference. During inference, too high of a dropout rate can lead to visually unrealistic dynamics and object interactions. Dropout rate scheduling during training should be investigated to improve convergence of the dynamics model during training, which may improve its performance as an environment for the reinforcement learning tasks. Possible optimizations include more complex, potentially non-linear, annealing schedules during inference, delaying the dropout rate annealing, and finding appropriate starting values. Finding a universal schedule that can be applied to any environment and task has large potential for accelerating reinforcement learning. Further improvements for the physics predictor are key for its use as a physical environment. These can include improvements for: scenarios with multiple materials in one scene, penetrations during collisions that can lead to insufficient position prediction, and generalization to new scenes.
138
+
139
+ Our results show that the proposed sampling method produces physically plausible trajectories in single- and multi-object scenarios as well as across a range of materials. The quality of roll-outs, e.g. shape prediction is not compromised by the introduced noise. Furthermore, our model-free reinforcement learning experiments indicate that agents learning in physically stochastic environments are able to explore better and learn quicker, which confirms the quality of the sampled trajectories. In difficult reinforcement learning scenarios, where a high level of precision is needed to get a reward, we demonstrated that dropout rate annealing is an effective method to avoid too high randomness at the same time not reducing the benefits of stochasticity for exploration in early stages of the training. In this regard, stochastic neural physics engines offer a clear advantage over conventional physics engines.
140
+
141
+ # REFERENCES
142
+
143
+ Pulkit Agrawal, Ashvin V Nair, Pieter Abbeel, Jitendra Malik, and Sergey Levine. Learning to poke by poking: Experiential learning of intuitive physics. In Advances in Neural Information Processing Systems, pp. 5074–5082, 2016.
144
+
145
+ Ronen Barzel, John R. Hughes, and Daniel N. Wood. Plausible motion simulation for computer graphics animation. In Ronan Boulic and Gerard Hegron (eds.), ´ Computer Animation and Simulation ’96, pp. 183–197, Vienna, 1996. Springer Vienna.
146
+
147
+ Peter Battaglia, Razvan Pascanu, Matthew Lai, Danilo Jimenez Rezende, and koray kavukcuoglu. Interaction networks for learning about objects, relations and physics. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 4502–4510. Curran Associates, Inc., 2016.
148
+
149
+ Apratim Bhattacharyya, Mario Fritz, and Bernt Schiele. Long-term on-board prediction of people in traffic scenes under uncertainty. CoRR, abs/1711.09026, 2017. URL http://arxiv.org/ abs/1711.09026.
150
+
151
+ Arunkumar Byravan and Dieter Fox. Se3-nets: Learning rigid body motion using deep neural networks. In Robotics and Automation (ICRA), 2017 IEEE International Conference on, pp. 173–180. IEEE, 2017.
152
+
153
+ Michael B Chang, Tomer Ullman, Antonio Torralba, and Joshua B Tenenbaum. A compositional object-based approach to learning physical dynamics. arXiv preprint arXiv:1612.00341, 2016.
154
+
155
+ Stephen Chenney and David Forsyth. Sampling plausible solutions to multi-body constraint problems. In Proceedings of the 27th annual conference on Computer graphics and interactive techniques, pp. 219–228, 01 2000.
156
+
157
+ Kurtland Chua, Roberto Calandra, Rowan McAllister, and Sergey Levine. Deep reinforcement learning in a handful of trials using probabilistic dynamics models. In Advances in Neural Information Processing Systems, pp. 4754–4765, 2018.
158
+
159
+ Chelsea Finn, Ian Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. In Advances in neural information processing systems, pp. 64–72, 2016.
160
+
161
+ Meire Fortunato, Mohammad Gheshlaghi Azar, Bilal Piot, Jacob Menick, Ian Osband, Alex Graves, Vlad Mnih, Remi Munos, Demis Hassabis, Olivier Pietquin, Charles Blundell, and Shane Legg. ´ Noisy networks for exploration. CoRR, abs/1706.10295, 2017. URL http://arxiv.org/ abs/1706.10295.
162
+
163
+ Katerina Fragkiadaki, Pulkit Agrawal, Sergey Levine, and Jitendra Malik. Learning visual predictive models of physics for playing billiards. arXiv preprint arXiv:1511.07404, 2015.
164
+
165
+ Yarin Gal and Zoubin Ghahramani. Dropout as a Bayesian approximation: Representing model uncertainty in deep learning. In Proceedings of the 33rd International Conference on Machine Learning (ICML-16), 2016.
166
+
167
+ Yarin Gal, Riashat Islam, and Zoubin Ghahramani. Deep bayesian active learning with image data. CoRR, abs/1703.02910, 2017. URL http://arxiv.org/abs/1703.02910.
168
+
169
+ Marek Grzes. Reward shaping in episodic reinforcement learning. In ´ Proceedings of the 16th Conference on Autonomous Agents and MultiAgent Systems, AAMAS ’17, pp. 565–573, Richland, SC, 2017. International Foundation for Autonomous Agents and Multiagent Systems. URL http://dl.acm.org/citation.cfm?id=3091125.3091208.
170
+
171
+ Nick Haber, Damian Mrowca, Li Fei-Fei, and Daniel LK Yamins. Learning to play with intrinsically-motivated self-aware agents. arXiv preprint arXiv:1802.07442, 2018.
172
+
173
+ Donghui Han, Shu-wei Hsu, Ann McNamara, and John Keyser. Believability in simplifications of large scale physically based simulation. In Proceedings of the ACM Symposium on Applied Perception, pp. 99–106. ACM, 2013.
174
+
175
+ Bernardo A Huberman and Peter Struss. Chaos, qualitative reasoning, and the predictability problem. Recent advances in qualitative physics, pp. 119–135, 1992.
176
+
177
+ M. Kampffmeyer, A. Salberg, and R. Jenssen. Semantic segmentation of small objects and modeling of uncertainty in urban remote sensing images using deep convolutional neural networks. In 2016 IEEE Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), pp. 680– 688, June 2016. doi: 10.1109/CVPRW.2016.90.
178
+
179
+ Guoliang Kang, Jun Li, and Dacheng Tao. Shakeout: A new regularized deep neural network training scheme. In Dale Schuurmans and Michael P. Wellman (eds.), AAAI, pp. 1751–1757. AAAI Press, 2016. ISBN 978-1-57735-760-5. URL http://dblp.uni-trier.de/db/ conf/aaai/aaai2016.html#KangLT16.
180
+
181
+ Alex Kendall, Vijay Badrinarayanan, and Roberto Cipolla. Bayesian segnet: Model uncertainty in deep convolutional encoder-decoder architectures for scene understanding. CoRR, abs/1511.02680, 2015. URL http://arxiv.org/abs/1511.02680.
182
+
183
+ Adam Lerer, Sam Gross, and Rob Fergus. Learning physical intuition of block towers by example. arXiv preprint arXiv:1603.01312, 2016.
184
+
185
+ Wenbin Li, Seyedmajid Azimi, Ales Leonardis, and Mario Fritz. To fall or not to fall: A visual ˇ approach to physical stability prediction. arXiv preprint arXiv:1604.00066, 2016.
186
+
187
+ Yunzhu Li, Jiajun Wu, Russ Tedrake, Joshua B Tenenbaum, and Antonio Torralba. Learning particle dynamics for manipulating rigid bodies, deformable objects, and fluids. In ICLR, 2019.
188
+
189
+ Roozbeh Mottaghi, Hessam Bagherinezhad, Mohammad Rastegari, and Ali Farhadi. Newtonian scene understanding: Unfolding the dynamics of objects in static images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3521–3529, 2016a.
190
+
191
+ Roozbeh Mottaghi, Mohammad Rastegari, Abhinav Gupta, and Ali Farhadi. what happens if... learning to predict the effect of forces in images. In European Conference on Computer Vision, pp. 269–285. Springer, 2016b.
192
+
193
+ Damian Mrowca, Chengxu Zhuang, Elias Wang, Nick Haber, Li Fei-Fei, Joshua B Tenenbaum, and Daniel LK Yamins. Flexible neural representation for physics prediction. In Advances in Neural Information Processing Systems, 2018.
194
+
195
+ D. A. Nix and A. S. Weigend. Estimating the mean and variance of the target probability distribution. In Proceedings of 1994 IEEE International Conference on Neural Networks (ICNN’94), volume 1, pp. 55–60 vol.1, June 1994. doi: 10.1109/ICNN.1994.374138.
196
+
197
+ Hyeonwoo Noh, Tackgeun You, Jonghwan Mun, and Bohyung Han. Regularizing deep neural networks by noise: Its interpretation and optimization. CoRR, abs/1710.05179, 2017. URL http://arxiv.org/abs/1710.05179.
198
+
199
+ Ian Osband, Benjamin Van Roy, and Zheng Wen. Generalization and exploration via randomized value functions. In Proceedings of the 33rd International Conference on International Conference on Machine Learning - Volume 48, ICML’16, pp. 2377–2386. JMLR.org, 2016. URL http: //dl.acm.org/citation.cfm?id=3045390.3045641.
200
+
201
+ Matthias Plappert, Rein Houthooft, Prafulla Dhariwal, Szymon Sidor, Richard Y. Chen, Xi Chen, Tamim Asfour, Pieter Abbeel, and Marcin Andrychowicz. Parameter space noise for exploration. CoRR, abs/1706.01905, 2017. URL http://arxiv.org/abs/1706.01905.
202
+
203
+ Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. Proc. Computer Vision and Pattern Recognition (CVPR), IEEE, 1(2):4, 2017a.
204
+
205
+ Charles Ruizhongtai Qi, Li Yi, Hao Su, and Leonidas J Guibas. Pointnet++: Deep hierarchical feature learning on point sets in a metric space. In Advances in Neural Information Processing Systems, pp. 5105–5114, 2017b.
206
+
207
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. CoRR, abs/1707.06347, 2017. URL http://arxiv.org/abs/ 1707.06347.
208
+
209
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929–1958, 2014.
210
+
211
+ Du Tran, Lubomir Bourdev, Rob Fergus, Lorenzo Torresani, and Manohar Paluri. Learning spatiotemporal features with 3d convolutional networks. In Computer Vision (ICCV), 2015 IEEE International Conference on, pp. 4489–4497. IEEE, 2015.
212
+
213
+ Du Tran, Lubomir Bourdev, Rob Fergus, Lorenzo Torresani, and Manohar Paluri. Deep end2end voxel2voxel prediction. In Computer Vision and Pattern Recognition Workshops (CVPRW), 2016 IEEE Conference on, pp. 402–409. IEEE, 2016.
214
+
215
+ Christopher D Twigg and Doug L James. Many-worlds browsing for control of multibody dynamics. ACM Transactions on Graphics (TOG), 26(3):14, 2007.
216
+
217
+ Kiwon Um, Xiangyu Hu, and Nils Thuerey. Liquid Splash Modeling with Neural Networks. Computer Graphics Forum, 2018. ISSN 1467-8659. doi: 10.1111/cgf.13522.
218
+
219
+ Victoria Xia, Zi Wang, and Leslie Pack Kaelbling. Learning sparse relational transition models. arXiv preprint arXiv:1810.11177, 2018.
220
+
221
+ Haosheng Zou, Tongzheng Ren, Dong Yan, Hang Su, and Jun Zhu. Reward shaping via metalearning. CoRR, abs/1901.09330, 2019. URL http://arxiv.org/abs/1901.09330.
222
+
223
+ # 6 APPENDIX
224
+
225
+ # 6.1 EFFECT OF DROPOUT RATE ON THE WIDTH OF THE TRAJECTORY DISTRIBUTIONS
226
+
227
+ In Figure 10, we present the effect of the dropout rate on the width of the predicted distribution of trajectories. In this example, dropout is activated in the force module. We compare distributions generated with dropout rates 0.5, 0.3 and 0.1. In Figure 11, we present the stochastic predictions in ”ball hitting tower” scenario. The dropout is active in the force and collision modules. The prediction variance corresponds to the dropout rate strength in both scenarios. In the ”ball hitting tower” scenario, we observe highly complex behavior, where the time at which the cubes fall off the tower at different rates
228
+
229
+ ![](images/1c8432a124d73452007e14e1678bf09d5147ae2c10c90e0f7ea456ed2f12781f.jpg)
230
+
231
+ Figure 10: Effect of the dropout rate on the distribution width of the sampled trajectories. 0.5 - top, 0.3 - middle, 0.1 - bottom. Dropout applied in the force module.
232
+
233
+ ![](images/7f33b31ce6d46d35146b9447782e331507cbe09607c04454d48a69264ad7b7ee.jpg)
234
+
235
+ Figure 11: Effect of the dropout rate on the distribution width of the sampled trajectories. 0.3 - top, 0.1 - bottom. Dropout applied in the force and collision modules.
md/train/Hkx7_1rKwS/Hkx7_1rKwS.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/HkxKH2AcFm/HkxKH2AcFm.md ADDED
@@ -0,0 +1,329 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TOWARDS GAN BENCHMARKS WHICH REQUIRE GENERALIZATION
2
+
3
+ Ishaan Gulrajani Google Brain igul222@gmail.com
4
+
5
+ Colin Raffel
6
+ Google Brain
7
+ craffel@gmail.com
8
+ Luke Metz
9
+ Google Brain
10
+ lmetz@google.com
11
+
12
+ # ABSTRACT
13
+
14
+ For many evaluation metrics commonly used as benchmarks for unconditional image generation, trivially memorizing the training set attains a better score than models which are considered state-of-the-art; we consider this problematic. We clarify a necessary condition for an evaluation metric not to behave this way: estimating the function must require a large sample from the model. In search of such a metric, we turn to neural network divergences (NNDs), which are defined in terms of a neural network trained to distinguish between distributions. The resulting benchmarks cannot be “won” by training set memorization, while still being perceptually correlated and computable only from samples. We survey past work on using NNDs for evaluation, implement an example black-box metric based on these ideas, and validate experimentally that it can measure a notion of generalization.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ In machine learning, it is often difficult to directly measure progress towards our goals (e.g. “classify images correctly in the real world”, “generate valid translations of text”). To enable progress despite this difficulty, it is useful to define a standardized benchmark task which is easy to evaluate and serves as a proxy for some final task. This enables much stronger claims of improvement (albeit towards a somewhat artificial task) by reducing the risk of inadequate baselines or evaluation mistakes, with the hope that progress on the benchmark will yield discoveries and methods which are useful towards the final task. This approach requires that a benchmark task satisfy two properties:
19
+
20
+ 1. It should define a straightforward and objective evaluation procedure, such that strong claims of improvement can be made. Any off-limits methods of obtaining a high score (e.g. abusing a test set) should be clearly defined.
21
+ 2. Improved performance on the benchmark should require insights which are likely to be helpful towards the final task. The benchmark should, by construction, reflect at least some of the kinds of difficulty inherent in the final task.
22
+
23
+ Together these imply that a benchmark should at least be nontrivial: we should not know a priori how to obtain an arbitrarily high score, except perhaps by clearly-off-limits methods. Crucial to a useful benchmark is an evaluation metric which measures what we care about for the final task and which satisfies the requirements outlined above.
24
+
25
+ This paper deals with unconditional generation of natural images, which has been the goal of much recent work in generative modeling (e.g. Radford et al., 2015; Karras et al., 2017). Our ideas are general, but we hope to improve evaluation practice in models like Generative Adversarial Networks (GANs) (Goodfellow et al., 2014). Generative modeling has many possible final tasks (Theis et al., 2015). Of these, unconditional image generation is perhaps not very useful directly, but the insights and methods discovered in its pursuit have proven useful to other tasks like domain adaptation (Shrivastava et al., 2017), disentangled representation learning (Chen et al., 2016), and imitation learning (Ho & Ermon, 2016).
26
+
27
+ Some notion of generalization is crucial to why unconditional generation is difficult (and hence interesting). Otherwise, simply memorizing the training data exactly would yield perfect “generations”
28
+
29
+ ![](images/d2d6acd1064e69aa355b1bbacd953a96865609e13101a496ca283e3801e74e56.jpg)
30
+ Figure 1: Common GAN benchmarks prefer training set memorization $\hat { p } _ { \mathrm { t r a i n } }$ , red) to a model ( $\cdot \boldsymbol { q }$ , green) which imperfectly fits the true distribution ( $\scriptstyle { p , }$ , blue) but covers more of $p$ ’s support.
31
+
32
+ Table 1: The Inception Score and FID assign better scores to memorization of the training set, but a neural network divergence, $D _ { \mathrm { C N N } }$ , prefers a GAN which generalizes beyond the training set.
33
+
34
+ <table><tr><td>EVAL. METRIC</td><td>GAN</td><td>MEMORIZATION</td></tr><tr><td>INCEP.SCORE↑</td><td>6.49</td><td>11.3</td></tr><tr><td>FID(TRAIN)↓</td><td>38.6</td><td>0.51</td></tr><tr><td>FID(TEST)↓</td><td>38.6</td><td>5.63</td></tr><tr><td>DcNN (TRAIN)↓</td><td>12.8</td><td>1.69E-4</td></tr><tr><td>DcNN (TEST)↓</td><td>12.9</td><td>14.7</td></tr></table>
35
+
36
+ and the task would be meaningless. One might argue that some work—particularly recent GAN research—merely aims to improve convergence properties of the learning algorithm, and so generalization isn’t a big concern. However, generalization is an important part of why GANs themselves are interesting. A GAN with better convergence properties but no ability to generalize is arguably not a very interesting GAN; we believe our definition of the task, and our benchmarks, should reflect this.
37
+
38
+ Because our task is to generate samples, and often our models only permit sampling, recent work (e.g. Huang et al., 2016; Gulrajani et al., 2017; Tolstikhin et al., 2017) has adopted benchmarks based on evaluation metrics (Salimans et al., 2016; Heusel et al., 2017) which measure the perceptual quality and diversity of samples. However these particular metrics are, by construction, trivially “won” by a model which memorizes the training set. In other words, they mostly ignore any notion of generalization, which is central to why the task is difficult to begin with. This idea is illustrated in Figure 1. In this sense they give rise to “trivial” benchmark tasks which can lead to less convincing claims of improvement, and ultimately less progress towards useful methods. While “nontrivial” benchmark tasks based on downstream applications can be used, the goals of these tasks are at best indirectly related to, and at worst opposite from, sample generation (e.g. for semi-supervised learning (Dai et al., 2017)).
39
+
40
+ This paper considers evaluation metrics for generative models which give rise to nontrivial benchmarks, and which are aligned with the final task of generating novel, perceptually realistic and diverse data. We stress the difference between evaluating models and defining benchmarks. The former assumes that models have been chosen ahead of time, independently of the metric. The latter assumes that models will be developed with the metric in mind, and so seeks to avoid falsely high scores resulting from exploiting undesirable solutions to the benchmark (e.g. memorizing the training set). Our goal is to define benchmarks, and many of our decisions follow from this. Our contributions are as follows:
41
+
42
+ • We establish a framework for sample-based evaluation that permits a meaningful notion of generalization. We clarify a necessary condition for the ability to measure generalization: That the evaluation requires a large sample from the model.
43
+ • We investigate using neural network divergences (Arora et al., 2017) as evaluation metrics which have attractive properties for this application. We survey past work exploring the use of neural network divergences for evaluation.
44
+ • We study an example neural network divergence called “CNN divergence” $D _ { \mathrm { C N N } } )$ experimentally. We demonstrate that it can detect and penalize memorization and that it measures diversity relatively more than other evaluation functions.
45
+
46
+ # 2 BACKGROUND
47
+
48
+ Throughout the paper we cast evaluation metrics as statistical divergences specifying a notion of dissimilarity between distributions. The goal of generative modeling, then, is minimizing some divergence, and the choice of divergence reflects the properties of our final task.
49
+
50
+ Let $\mathcal { X }$ denote a set of possible observations (a common choice for image modeling is $\mathbb { R } ^ { 3 2 \times 3 2 \times 3 }$ ), and $\mathcal { P } ( \mathcal { X } )$ the set of probability distributions on $\mathcal { X }$ . The goal of generative modeling is: given a data distribution $p \in { \mathcal { P } } ( { \mathcal { X } } )$ (which we can only access through a finite sample) and a set of distributions $\mathcal { Q } \subseteq \mathcal { P } ( \mathcal { X } )$ (usually a parametric model family), find $q ^ { * } \in \mathcal { Q }$ which is closest to $p$ according to some definition of closeness. A notion of closeness between distributions is characterized by a statistical divergence, which is a function $D : \mathcal { P } ( \mathcal { X } ) \times \mathcal { P } ( \mathcal { X } ) \mathbb { R } _ { \geq 0 } \cup \{ + \infty \}$ satisfying $D ( p , q ) = 0$ iff $p = q$ .1 Usually we cannot exactly evaluate $D ( p , q )$ , and so for training and evaluation purposes we must compute an estimate using finite samples from $p$ and $q$ . We denote such an estimate of $D$ as $\hat { D }$ . With some abuse of notation, we denote by $\hat { p }$ either a finite sample from $p$ or the empirical distribution corresponding to that sample, and likewise for $\hat { q }$ and $q$ .
51
+
52
+ # 2.1 EVALUATION METRICS FOR MODELS OF NATURAL IMAGES
53
+
54
+ Various evaluation criteria have been proposed for evaluating a generative model of natural images solely based on a finite sample from the model. Perhaps the most commonly applied metrics are the “Inception Score” (IS) (Salimans et al., 2016) and “Fréchet Inception Distance” (FID) (Heusel et al., 2017). These metrics, described in detail in Appendix B and Appendix C respectively, compute statistics on features produced by an Inception network (Szegedy et al., 2016) trained on ImageNet (Deng et al., 2009). They are motivated by the intuition that statistics computed on samples from the model $q$ should match those of real data. Apart from the IS and FID, test set log-likelihood is a popular metric for evaluation, but is not directly computable for models from which we can only draw samples. While Wu et al. (2016b) proposed a method of estimating log-likelihoods for “decoder-based” generative models, it requires additional assumptions to be made and was shown to be a poor estimate in some cases (Grover et al., 2017). Log-likelihood has also been shown to not correlate well with downstream needs such as sample quality (Theis et al., 2015).
55
+
56
+ # 3 GENERALIZATION IN SAMPLE-BASED EVALUATION
57
+
58
+ In this section we establish a framework for sample-based evaluation that permits a meaningful notion of generalization. We state a property of divergences which are estimable from a finite sample (that they’re somewhat insensitive to diversity), propose a baseline for non-trivial performance (the model should outperform training set memorization), explain that beating the baseline might only be achievable under certain kinds of divergences (the divergence should consider a large model sample), and finally explain that minimizing such a divergence requires paying attention to generalization.
59
+
60
+ # 3.1 EASILY-ESTIMATED DIVERGENCES CAN’T MEASURE DIVERSITY
61
+
62
+ Because we can only sample from our models, and we have finite compute, we are restricted to divergences which can be estimated using only a finite sample from the model. We begin with an obvious but important note: any divergence estimated from a sample can be “fooled” by a model which memorizes a finite sample of not much greater size. Specifically:
63
+
64
+ Remark 1. If $D ( p , q )$ is a divergence which can always be estimated with error less than  using only m points sampled from $q ^ { 2 }$ , ${ { q } _ { \mathrm { g o o d } } }$ is a model distribution, and $q _ { \mathrm { b a d } }$ is an empirical version of ${ { q } _ { \mathrm { g o o d } } }$ with $m ^ { 2 }$ points, then $| D ( p , q _ { \mathrm { g o o d } } ) - D ( p , q _ { \mathrm { b a d } } ) | < 2 \epsilon$ .
65
+
66
+ In this case, we say that $D$ is (to some extent) insensitive to “diversity”, which we define as any differences between a distribution and its empirical counterpart. The reasoning is that a sample of $m$ points (with replacement) from $q _ { \mathrm { b a d } }$ is quite likely to also be a valid sample from ${ { q } _ { \mathrm { g o o d } } }$ (because it’s unlikely that a point in $q _ { \mathrm { b a d } }$ gets sampled twice), making it impossible to reliably tell whether the sample came from ${ { q } _ { \mathrm { g o o d } } }$ or $q _ { \mathrm { b a d } }$ . So, either the estimates must sometimes have substantial error or the difference between the true divergences must also be small.
67
+
68
+ This comes almost directly from Gretton et al. (2012)’s Example 1 and is similar in spirit to Arora et al. (2017)’s Corollary 3.2. This version requires that $D$ can be estimated with bounded error for a finite sample size, which is slightly too restrictive. Nonetheless it clarifies the intuition: the sample size required to estimate a divergence upper-bounds the divergence’s sensitivity to diversity.
69
+
70
+ 3.2 MODELS SHOULD OUTPERFORM TRAINING SET MEMORIZATION
71
+
72
+ From the previous section, we know that even trivially memorizing the training set (that is, choosing $q = \hat { p } _ { \mathrm { t r a i n } } ,$ ) is likely to minimize $D ( p , q )$ (to an extent depending on $D$ and the size of $\hat { p } _ { \mathrm { t r a i n } }$ ) because $\hat { p } _ { \mathrm { t r a i n } }$ is a finite sample from $p$ . Such memorization, however, is presumably not a useful solution in terms of our final task. Therefore we propose that in order for a model to be considered useful, it should at least outperform that trivial baseline. Specifically:
73
+
74
+ Definition 1. A model q outperforms training set memorization under a divergence $D$ if $D ( p , q ) <$ $D ( p , \hat { p } _ { \mathrm { t r a i n } } )$ .
75
+
76
+ Cornish et al. (2018) propose essentially the same criterion. The next section explains how to choose $D$ such that this goal is achievable.
77
+
78
+ # 3.3 THE DIVERGENCE SHOULD REQUIRE A LARGE SAMPLE (BUT NOT TOO LARGE)
79
+
80
+ Our goal is to find a model $q$ which outperforms training set memorization under $D$ , but of course this depends on our choice of $D$ . Intuitively, such a model makes $D ( p , q )$ small by recovering some of the diversity which exists in the true distribution, but not the training set. But if $D$ isn’t sensitive enough to diversity, very few models may exist which outperform $\hat { p } _ { \mathrm { t r a i n } }$ under $D$ . Specifically, Remark 1 implies (by taking $q _ { \mathrm { g o o d } } = p$ and $q _ { \mathrm { b a d } } = \hat { p } _ { \mathrm { t r a i n } } )$ that when $D$ can be estimated to small error using a sample of $m ^ { 1 / 2 }$ points $\mathbf { \dot { \phi } } _ { m }$ being the size of $\hat { p } _ { \mathrm { t r a i n } } \rangle$ ), $D ( p , \hat { p } _ { \mathrm { t r a i n } } )$ will be very close to zero. This suggests that finding a model satisfying $D ( p , q ) < D ( p , \hat { p } _ { \mathrm { t r a i n } } )$ might be very difficult when $D$ can be estimated with a small sample.
81
+
82
+ This motivates using divergences under which $D ( p , \hat { p } _ { \mathrm { t r a i n } } )$ is not a good solution. Such divergences require a large sample size (relative to the size of $\hat { p } _ { \mathrm { t r a i n } }$ ) to estimate, but fortunately this is often feasible. For example, the CIFAR-10 training set contains 50 thousand images, but we can sample 50 million images from a typical GAN generator within a reasonable computational budget.
83
+
84
+ Usually the underlying distribution we are dealing with is assumed to be exponentially large (say, on the order of $1 0 ^ { 5 \mathrm { { \bar { 0 } } } }$ distinct points), which dwarfs the largest sample we can possibly draw from a model. As such, no purely sample-based evaluation will be able to tell whether the model actually covers the full distribution. However, this also means that no purely sample-based final task will depend on such coverage. In this sense our work both suggests what generalization should mean in the context of sample-based applications and addresses how to evaluate it.
85
+
86
+ At the same time, we must be careful that our choice of $D$ does not require a larger sample to estimate than we can draw from $q$ ; otherwise our empirical estimate might be unreliable. Poor estimates are known to be hazardous in this setting: for example, the empirical Wasserstein distance, which converges exponentially slowly in the dimension (Sriperumbudur et al., 2012), systematically prefers models which generate blurry images (Huang et al., 2017; Cornish et al., 2018).
87
+
88
+ # 3.4 LEARNING SHOULD REQUIRE SMALL GENERALIZATION ERROR
89
+
90
+ It’s worth mentioning how we plan to find a model which minimizes $D ( p , q )$ given that we don’t usually have direct access to $p$ . Making guarantees is difficult without reference to a specific $D$ or a specific learning algorithm, but in general we might hope to apply the usual machine learning technique (e.g. Vapnik, 1995): optimize a (surrogate) training loss $\hat { D } ( \hat { p } _ { \mathrm { t r a i n } } , q )$ , use a held-out set to estimate $D ( p , q )$ , bound the generalization error $D ( p , q ) - \hat { D } ( \hat { p } _ { \mathrm { t r a i n } } , q )$ by constraining model capacity, and finally pick the model which best minimizes our estimate of $\dot { \cal D } ( p , q )$ .
91
+
92
+ This might seem obvious, but the situation is much less clear when $q = \hat { p } _ { \mathrm { t r a i n } }$ nearly minimizes $D ( p , q )$ (that is, when $D$ is insensitive to diversity). In this case, the usual motivation behind trying to bound generalization error – namely, minimizing $D ( p , q )$ given only access to $\hat { p } _ { \mathrm { t r a i n } }$ – doesn’t apply. For example, in an evaluation metric like FID, if $q = \hat { p } _ { \mathrm { t r a i n } }$ yields a near-optimal score with respect to the test set, then it’s not clear what we aim to achieve through generalization, even if we might be able to measure it sometimes. We show in Figure 1 that FID does indeed behave this way. In this sense, we can say that only divergences which require a large model sample permit a “meaningful” notion of generalization.
93
+
94
+ # 4 NEURAL NETWORK DIVERGENCES AS BENCHMARK METRICS
95
+
96
+ A promising approach for comparing two distributions using finite samples from each are neural network divergences (NNDs) (Arora et al., 2017; Liu et al., 2017; Huang et al., 2017), which are defined in terms of the loss of a neural network trained to distinguish between samples from the two distributions. Liu et al. (2017) define the family of divergences as follows:
97
+
98
+ $$
99
+ D _ { \mathrm { N N } } ( p , q ) = \operatorname* { s u p } _ { f _ { \theta } \in \mathcal { F } } \mathbb { E } _ { ( x _ { p } , x _ { q } ) \sim p \otimes q } \left[ \Delta ( f _ { \theta } ( x _ { p } ) , f _ { \theta } ( x _ { q } ) ) \right]
100
+ $$
101
+
102
+ for some function $\Delta : \mathbb { R } ^ { d } \times \mathbb { R } ^ { d } \mathbb { R }$ (which, loosely, looks like a classification loss) and parametric set of functions $\mathcal { F } = \{ f _ { \theta } : \mathcal { X } \mathbb { R } ^ { d } ; \theta \in \Theta \}$ (e.g. a neural network architecture). In practice, utilizing an NND to evaluate a generative model amounts to training an independent “critic” network whose objective is to distinguish between real and generated samples. After sufficient training, the critic’s loss can be used as a score reflecting the discriminability of real and generated data. To use an NND as an evaluation metric, we draw samples from our learned generative model $q$ and utilize a held-out test set $\hat { p } _ { \mathrm { t e s t } }$ of samples from $p$ which was not used to train the generative model.
103
+
104
+ There exists some recent work on using NNDs for generative model evaluation (Danihelka et al., 2017b; Rosca et al., 2017; Bowman et al., 2015). Danihelka et al. (2017b) show empirically that NNDs can detect overfitting, although their setup leaves open questions which we address in our experiments. More recently, Im et al. (2018) provided a meta-evaluation of evaluation methods arriving from using critics trained with different GAN losses and compared them to existing metrics.
105
+
106
+ A closely-related and complementary body of work proposes model evaluation through two-sample testing, likewise treating evaluation as a problem of discriminating between distributions. Sutherland et al. (2016) evaluate GANs using a test based on the MMD (Gretton et al., 2012), and find the MMD with a generic kernel isn’t very discriminative. Ramdas et al. (2015) show that with generic kernels, the MMD test power tends to decrease polynomially in the dimension. Li et al. (2017) recover these by combining the MMD with a learned discriminator (although not for evaluation). Bellemare et al. (2017) propose a similar method; Binkowski et al. (2018) connect the two to each other and to NNDs, ´ proving that all the estimators are biased. Binkowski et al. (2018) also propose evaluation using a ´ generic MMD in a pretrained feature space; this works at least as well as the FID, but it’s not clear whether pretrained features are discriminative enough to detect overfitting. Lopez-Paz & Oquab (2016) explore evaluation by a test based on a binary classifier. Among other options, they consider using a neural net as that classifier, which amounts to using an NND for evaluation, although they report difficulties due to problems since addressed by Arjovsky et al. (2017).
107
+
108
+ Outperforming Memorization We are interested in NNDs largely because they let us realize the ideas in Section 3. In particular, they satisfy the criterion of subsection 3.3: estimating one involves training a neural network, a process which can consider about $1 0 ^ { 7 }$ data points — a sample large enough for the divergence to be able to measure diversity beyond the size of most training sets, but not so large as to be computationally intractable. Thus we might hope to establish that our models generalize meaningfully and outperform training set memorization in the sense of Definition 1.
109
+
110
+ Concretely, NNDs measure diversity through the ability of the underlying neural network to overfit to data. If $q$ is an empirical distribution with a small number of points, the network can overfit to those points and more easily tell them apart from the points in $p$ , causing the resulting divergence to be higher. Moreover, by changing the capacity of the neural network (e.g. by adding or removing layers), we can tune the sample size at which it begins to overfit (and the sample complexity of the divergence) as we desire.
111
+
112
+ Perceptual Correlation Compared to traditional statistical divergences, NNDs have an advantage in their ability to incorporate prior knowledge about the task (Huang et al., 2017). For example, using a convolutional network (CNN) for the critic results in a shift-invariant divergence appropriate for natural images. To test the correlation of CNN-based NNDs to human perception, Im et al. (2018) generated sets of 100 image samples from various models and compared the pairswise preferences given by various NNDs to those from humans. They found that the NND metrics they studied agreed with human judgement the vast majority of the time. IS and FID are also perceptually correlated (Salimans et al., 2016; Im et al., 2018), but they use pretrained ImageNet classifier features, which may make them less applicable to arbitrary datasets and tasks. In contrast, NNDs are applicable to any data that can be fed into a neural net; for example, Bowman et al. (2015) used an NND to evaluate a generative model of text.
113
+
114
+ # 4.1 DRAWBACKS OF NNDS FOR EVALUATION
115
+
116
+ Training Against the Metric Prior work has argued (Arjovsky et al., 2017; Im et al., 2018) that using an NND for GAN evaluation can be hazardous because an NND closely relates to a GAN’s discriminator, and thus might “unfairly” prefer GANs trained with a similar discriminator architecture. More broadly, optimizing a loss which is too similar to a benchmark metric can cause issues if the benchmark fails to capture properties required for the “final task”. For example, in NLP, directly optimizing the BLEU or ROUGE scores on the training set tend to score higher on the benchmark without necessarily improving human evaluation scores (Wu et al., 2016a; Paulus et al., 2017).
117
+
118
+ Im et al. (2018) “investigated whether the [neural network divergence] metric favors samples from the model trained using the same metric” by training GANs with different discriminator objectives and evaluating them with NNDs utilizing the same set of objectives. Despite the potential for bias, they found the metrics largely agreed with each other. This suggests that the objectives might have reasonably similar minimizers, and that in some sense we are not “overfitting” to the benchmark when the training and test objectives are the same. However, it may nevertheless be that NNDs prefer generative models trained with a similar objective (i.e. GANs); we observe this in Section 5.
119
+
120
+ In contrast, training a generative model of images directly against metrics like the IS has been shown to produce noise-like samples which achieve extremely high scores (Barratt & Sharma, 2018). While training directly against the IS is arguably “off-limits”, there has been some evidence of techniques accidentally overfitting to the score. For example, Shu et al. (2017) suggest that the IS improvements achieved by AC-GAN (Odena et al., 2016) may be caused by AC-GAN models being biased towards samples near the classifier decision boundary; that the IS prefers this is arguably an undesirable artifact of the score. The existence of such a failure mode suggests that using the IS as a benchmark is ill-advised. In contrast, we are not aware of a similar failure mode for NNDs, but we believe further research into the robustness of these scores is warranted.
121
+
122
+ Sensitivity to Implementation Details In order for an evaluation metric to be used for benchmarking, the metric itself needs to be used consistently across different studies. If implementation details can cause the scores produced by a metric to vary significantly, this conflates comparison of when different implementations are used to compare different methods. This has caused issues in benchmarking machine translation (Post, 2018) and music information retrieval (Raffel et al., 2014). This problem is particularly pronounced for NNDs because they require implementing a neural network architecture and training scheme, and the use of different software frameworks or even driver versions can cause results to vary (Henderson et al., 2018; Oliver et al., 2018). We emphasize that if NNDs are to be used as a benchmark, it is absolutely crucial that the same implementation of the metric is used across studies.
123
+
124
+ Bias From a Small Test Set As explained in subsection 3.3, if an NND requires a larger sample to estimate than we have, we end up with a potentially-hazardous biased estimate. While we can draw an arbitrarily large model sample, the data distribution sample (that is, the test set) is finite and often fairly small. In concrete terms: if our critic network is big enough to detect an overfit or “collapsed” generator by overfitting to the generator’s samples, then the critic can also overfit to the test set. Fortunately, since this bias comes from the test set and not the model distribution, we might hope that the resulting biased estimates still rank models in the same order as the unbiased ones would; we verify in the experiments that this appears to be the case for our models and NND. Still, we’d like stronger guarantees that our estimates are reliable, either by designing an NND without this bias or by a more careful analysis of the nature bias.
125
+
126
+ # 4.2 AN EXAMPLE NEURAL NETWORK DIVERGENCE METRIC
127
+
128
+ To empirically investigate the use of NNDs for evaluation, we developed a simple architecture and training procedure which we refer to as CNN divergence $( D _ { \mathrm { C N N } } )$ which we describe in detail in Appendix D. As a short summary, our model architecture is a convolutional network taking $3 2 \times 3 2 \times 3$ images as input and closely resembles the DCGAN discriminator (Radford et al., 2015).
129
+
130
+ Table 2: For different evaluation metrics, how many training set images does one need to memorize to score better than a well-trained GAN model? A larger $n$ means the metric is more sensitive to diversity.
131
+
132
+ <table><tr><td>EVAL.METRIC</td><td>INPUT SIZE</td><td>n TO WIN</td></tr><tr><td>INCEP. SCORE</td><td>50,000</td><td>32</td></tr><tr><td>FID</td><td>50,000</td><td>1024</td></tr><tr><td>SMALL CNN DIV.</td><td>25M</td><td>32,768</td></tr><tr><td>CNN DIV.</td><td>25M</td><td>&gt;1M</td></tr></table>
133
+
134
+ Table 3: Evaluation of different models on CIFAR-10 by test set CNN divergence. The WGAN-GP attains a lower value of the test divergence than memorization of the training set.
135
+
136
+ <table><tr><td>METHOD</td><td>DcNN(Ptest, q)</td></tr><tr><td>PIXELCNN++</td><td>16.17</td></tr><tr><td>IAF VAE</td><td>18.11</td></tr><tr><td>WGAN-GP</td><td>12.97</td></tr><tr><td>TRAINING SET</td><td>14.62</td></tr></table>
137
+
138
+ To provide useful signal when the distributions being compared are dissimilar, we use the critic objective from WGAN-GP (Gulrajani et al., 2017) which doesn’t saturate when the distributions are easily discriminable by a neural network (i.e. have nonoverlapping support). We also utilize a carefully-tuned learning rate schedule and an exponential moving average of model parameters for evaluation, which we show produces a low-variance metric in Appendix E Our goal in developing the CNN divergence is not to propose a new standardized benchmark, but rather to develop a reasonable testbed for experimenting with adversarial divergences in the context of the current study. To facilitate future work on NNDs, we make an example implementation of the CNN divergence available.3
139
+
140
+ # 5 EXPERIMENTS
141
+
142
+ Here we present experiments evaluating our CNN divergence’s ability to assess generalization.
143
+
144
+ Detecting and Outperforming Memorization We are first interested in measuring the extent to which different evaluation metrics prefer memorization or generalization. To do so, we trained a WGAN-GP (Gulrajani et al., 2017) on the CIFAR-10 dataset and evaluated the resulting samples using IS, FID, and the CNN divergence using both $\hat { p } _ { \mathrm { t r a i n } }$ and $\hat { p } _ { \mathrm { t e s t } }$ as our collections of samples from $p$ To compare the resulting scores to training set memorization, we also evaluated each metric on $\hat { p } _ { \mathrm { t r a i n } }$ itself. The results are shown in Table 1. We find that both the IS and the FID assign better scores to simply memorizing the training set, but that the CNN divergence assigns a worse (higher) score to training set memorization than the GAN. Further, the score $D _ { \mathrm { C N N } } \big ( \hat { p } _ { \mathrm { t r a i n } } , \hat { p } _ { \mathrm { t r a i n } } \big )$ is much smaller than $D _ { \mathrm { C N N } } \big ( \hat { p } _ { \mathrm { t e s t } } , \hat { p } _ { \mathrm { t r a i n } } \big )$ , which suggests the ability to detect overfitting. The results of this experiment are summarized schematically in Figure 1: The IS and FID prefer memorizing a small sample, whereas the CNN divergence prefers a model which imperfectly fits the underlying distribution but covers more of its support.
145
+
146
+ Comparing Evaluation Metrics’ Ability to Measure Diversity For several evaluation functions, we test how many sample points from the true distribution are needed to attain a better score than a well-trained GAN model. We consider IS, Fréchet Inception Distance, our CNN divergence, and a modified version of the CNN divergence with a smaller critic network with $1 / 4$ as many channels at each layer. We begin by training a WGAN-GP (Gulrajani et al., 2017) on the $3 2 \times 3 2$ ImageNet dataset (Oord et al., 2016); we denote the model distribution by $q$ . We expect this GAN to generate images which are less realistic than the training set, but reasonably diverse (at least on the order of $1 \mathrm { \overline { { 0 } } ^ { 5 } }$ perceptually unique images, based on Arora & Zhang (2017)). We estimate each evaluation metric $D ( p , q )$ using a test set $\hat { p } _ { \mathrm { t e s t } }$ and a sample from $q$ . We similarly estimate $\mathbb { E } _ { \hat { p } _ { n } } [ D ( p , \hat { p } _ { n } ) ]$ , where $\hat { p } _ { n }$ is a random $n$ -point subset of $\hat { p } _ { \mathrm { t r a i n } }$ , for many values of $n$ . In Table 2 we report the smallest $n$ where memorizing $n$ training set images scores better than the GAN. Higher $n$ means that $D$ assigns relatively more importance to diversity.
147
+
148
+ Consistent with our expectation, we find that both CNN divergences require memorizing many more images to attain an equivalent score to a GAN, so Definition 1 is more likely to be achievable under these. Moreover, decreasing the capacity of the underlying critic network also decreases this sensitivity to diversity. In particular, the standard CNN divergence penalizes memorization to a greater extent than the small-critic version.
149
+
150
+ ![](images/a3c5ab9e3174cfa3903d0368d1d682116fa01f8c1ea4d9565cddb3e1d400d5aa.jpg)
151
+ Figure 2: CNN divergence on a small test set is biased, but correlated, with a large test set.
152
+
153
+ ![](images/e4b68935f4ae225687aa14f082ded946626b18dbf034d8e097794aed0398fe62.jpg)
154
+ Figure 3: CNN divergence reveals overfitting in a large GAN.
155
+
156
+ The Effect of Bias From a Small Test Set Our evaluation function requires a very large test set to accurately estimate, and using a normally-sized test set yields a biased estimate. However, we might hope that because the bias comes from the test set and not the model, the small-test-set estimates might still rank different models in the same order as large-test-set estimates would. To check this, we split $3 2 \times 3 2$ ImageNet into training $\scriptstyle n = 5 0 , 0 0 0 )$ ), “small test” $\scriptstyle n = 1 0 , 0 0 0 )$ , and “large test” $( n { = } 1 , 2 9 0 , 0 0 0 )$ sets. We train 64 GAN models with randomly-chosen hyperparameters on the training set and evaluate their CNN divergence with respect to both test sets. We plot the results in Figure 2. We observe that the two values are strongly correlated over this set of models (up to the level of noise introduced by the optimization process), suggesting that it might be safe to use a small test set in this setting.
157
+
158
+ Divergence Values Throughout Model Training We train a somewhat large (18M parameters) GAN on a 50,000-image subset of $3 2 \times 3 2$ ImageNet. Every 2000 iterations, we evaluate three CNN divergences: first, with respect to a held-out test set of 10,000 images, second, another independent test set of the same size (to verify that the variance with respect to the choice of test set images is negligible), and last, a 10,000-image subset of the training set (we use a subset to eliminate bias from the dataset size). Each of the 300 resulting CNN divergence evaluations was run completely from scratch. We plot the results in Figure 3.
159
+
160
+ We first note that the values of all the divergences decrease monotonically over the course of training. If we assume that a good model gets steadily better at the final task over its training and ultimately converges, then the value of a good evaluation metric should reflect this pattern, as ours does. We further observe a substantial gap between the training and test set divergences. Consistent with subsection 3.4, this suggests that to score well, we need to pay some attention to generalization.
161
+
162
+ The convergence result is closely related to the one in Arjovsky et al. (2017), and the generalization result to the one in Danihelka et al. (2017b). A major difference is that compared to the “critic” networks used in those works, our CNN divergence is a black-box evaluation metric computed from scratch at each point in training. This rules out the possibility that the observed behavior comes from an artifact in the critic training process rather than an underlying property of the model distribution.
163
+
164
+ Further, the overfitting result in Danihelka et al. (2017b) comes from “misusing the independent critic” by evaluating it on empirical distributions it wasn’t trained on: their estimation procedure is different for the training, validation, and test sets. This complicates reasoning about the bias of the resulting estimators (see subsection 4.1). In contrast, we simply estimate the same divergence with respect to three empirical distributions.
165
+
166
+ Evaluating Models Against CNN Divergence To test whether the CNN divergence prefers models trained on a similar objective, we use it to evaluate several different types of generative models. We train 3 models: a PixelCNN $^ { + + }$ (Salimans et al., 2017), a ResNet VAE with Inverse Autoregressive Flow (IAF) (Kingma et al., 2016), and a DCGAN (Radford et al., 2015) trained with the WGAN-GP objective (Gulrajani et al., 2017). Training details are given in the appendix. As a baseline, we also report the score attained by memorizing the training set. We list results in Table 3. Notably, the GAN outperforms both of the other models, which may simply be because its objective is much more closely related to the CNN divergence than maximum likelihood (as used by PixelCNN++ and the VAE); we discuss this effect in subsection 4.1. In addition, the GAN achieves a better score than memorizing the training set. This result satisfies Definition 1 and allows us to say that the GAN has achieved a nontrivial benchmark score through generalization.
167
+
168
+ # 6 CONCLUSION
169
+
170
+ We believe our experiments show that the NNDs are a promising direction for evaluating generative models. They are not trivially solved by memorizing the training set, which satisfies our argument (Section 3) that measuring generalization ability is linked to whether the metric requires a large collection of samples. They also appear to prefer diversity relatively more than the IS and FID metrics. We note that NNDs are almost certainly not the only evaluation metric under which models can meaningfully generalize, and encourage work on alternative metrics.
171
+
172
+ Ultimately, models should be evaluated according to their intended final task (Theis et al., 2015). In our work we assume that our final task is not usefully solved by memorizing the training set, but for many tasks such memorization is a completely valid solution. If so, the evaluation should reflect this: we do not need our model to be closer to the true distribution than the training set, Definition 1 does not apply, and we might be free to consider evaluations which look at only a small sample from the model.
173
+
174
+ # REFERENCES
175
+
176
+ Martin Arjovsky and Léon Bottou. Towards Principled Methods for Training Generative Adversarial Networks. arXiv.org, January 2017.
177
+ Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein gan. arXiv preprint arXiv:1701.07875, 2017.
178
+ Sanjeev Arora and Yi Zhang. Do gans actually learn the distribution? an empirical study. arXiv preprint arXiv:1706.08224, 2017.
179
+ 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.
180
+ Shane Barratt and Rishi Sharma. A note on the inception score. arXiv preprint arXiv:1801.01973, 2018.
181
+ Marc G Bellemare, Ivo Danihelka, Will Dabney, Shakir Mohamed, Balaji Lakshminarayanan, Stephan Hoyer, and Rémi Munos. The cramer distance as a solution to biased wasserstein gradients. arXiv preprint arXiv:1705.10743, 2017.
182
+ Mikołaj Binkowski, Dougal J. Sutherland, Michael Arbel, and Arthur Gretton. Demystifying ´ MMD GANs. In International Conference on Learning Representations, 2018. URL https: //openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ r1lUOzWCW.
183
+ Samuel R Bowman, Luke Vilnis, Oriol Vinyals, Andrew M Dai, Rafal Jozefowicz, and Samy Bengio. Generating sentences from a continuous space. arXiv preprint arXiv:1511.06349, 2015.
184
+ Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. Infogan: Interpretable representation learning by information maximizing generative adversarial nets. In Advances in Neural Information Processing Systems, pp. 2172–2180, 2016.
185
+ Robert Cornish, Hongseok Yang, and Frank Wood. Towards a testable notion of generalization for generative adversarial networks, 2018. URL https://openreview.net/forum?id= ByuI-mW0W.
186
+ Zihang Dai, Zhilin Yang, Fan Yang, William W Cohen, and Ruslan R Salakhutdinov. Good semisupervised learning that requires a bad gan. In Advances in Neural Information Processing Systems, pp. 6513–6523, 2017.
187
+
188
+ Ivo Danihelka, Balaji Lakshminarayanan, Benigno Uria, Daan Wierstra, and Peter Dayan. Comparison of Maximum Likelihood and GAN-based training of Real NVPs. arXiv.org, May 2017a.
189
+
190
+ Ivo Danihelka, Balaji Lakshminarayanan, Benigno Uria, Daan Wierstra, and Peter Dayan. Comparison of maximum likelihood and gan-based training of real nvps. arXiv preprint arXiv:1705.05263, 2017b.
191
+
192
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. In IEEE Conference on Computer Vision and Pattern Recognition, 2009.
193
+
194
+ 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.
195
+
196
+ Arthur Gretton, Karsten M Borgwardt, Malte J Rasch, Bernhard Schölkopf, and Alexander Smola. A kernel two-sample test. Journal of Machine Learning Research, 13(Mar):723–773, 2012.
197
+
198
+ Aditya Grover, Manik Dhar, and Stefano Ermon. Flow-GAN: Combining maximum likelihood and adversarial learning in generative models. arXiv preprint arXiv:1705.08868, 2017.
199
+
200
+ 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.
201
+
202
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, 2015.
203
+
204
+ Peter Henderson, Riashat Islam, Philip Bachman, Joelle Pineau, Doina Precup, and David Meger. Deep reinforcement learning that matters. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
205
+
206
+ 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.
207
+
208
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In Advances in Neural Information Processing Systems, pp. 4565–4573, 2016.
209
+
210
+ Gabriel Huang, Hugo Berard, Ahmed Touati, Gauthier Gidel, Pascal Vincent, and Simon LacosteJulien. Parametric Adversarial Divergences are Good Task Losses for Generative Modeling. arXiv.org, August 2017.
211
+
212
+ Xun Huang, Yixuan Li, Omid Poursaeed, John Hopcroft, and Serge Belongie. Stacked generative adversarial networks. arXiv preprint arXiv:1612.04357, 2016.
213
+
214
+ Daniel Jiwoong Im, He Ma, Graham Taylor, and Kristin Branson. Quantitatively evaluating gans with divergences proposed for training. arXiv preprint arXiv:1803.01045, 2018.
215
+
216
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. arXiv preprint arXiv:1710.10196, 2017.
217
+
218
+ Diederik P Kingma, Tim Salimans, Rafal Jozefowicz, Xi Chen, Ilya Sutskever, and Max Welling. Improved variational inference with inverse autoregressive flow. In Advances in Neural Information Processing Systems, pp. 4743–4751, 2016.
219
+
220
+ 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. 2203–2213, 2017.
221
+
222
+ Shuang Liu, Olivier Bousquet, and Kamalika Chaudhuri. Approximation and convergence properties of generative adversarial learning. arXiv preprint arXiv:1705.08991, 2017.
223
+
224
+ David Lopez-Paz and Maxime Oquab. Revisiting classifier two-sample tests. arXiv preprint arXiv:1610.06545, 2016.
225
+
226
+ Augustus Odena, Christopher Olah, and Jonathon Shlens. Conditional image synthesis with auxiliary classifier gans. arXiv preprint arXiv:1610.09585, 2016.
227
+
228
+ Avital Oliver, Augustus Odena, Colin Raffel, Ekin D Cubuk, and Ian J Goodfellow. Realistic evaluation of deep semi-supervised learning algorithms. arXiv preprint arXiv:1804.09170, 2018.
229
+
230
+ Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. arXiv preprint arXiv:1601.06759, 2016.
231
+
232
+ Romain Paulus, Caiming Xiong, and Richard Socher. A deep reinforced model for abstractive summarization. arXiv preprint arXiv:1705.04304, 2017.
233
+
234
+ Matt Post. A call for clarity in reporting bleu scores. In Proceedings of the Third Conference on Machine Translation (WMT), 2018.
235
+
236
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
237
+
238
+ Colin Raffel, Brian McFee, Eric J. Humphrey, Justin Salamon, Oriol Nieto, Dawen Liang, and Daniel P. W. Ellis. mir_eval: A transparent implementation of common MIR metrics. In Proceedings of the 15th International Society for Music Information Retrieval Conference, pp. 367–372, 2014.
239
+
240
+ Prajit Ramachandran, Barret Zoph, and Quoc V Le. Swish: a self-gated activation function. arXiv preprint arXiv:1710.05941, 2017.
241
+
242
+ Aaditya Ramdas, Sashank Jakkam Reddi, Barnabás Póczos, Aarti Singh, and Larry A Wasserman. On the decreasing power of kernel and distance based nonparametric hypothesis tests in high dimensions. 2015.
243
+
244
+ Mihaela Rosca, Balaji Lakshminarayanan, David Warde-Farley, and Shakir Mohamed. Variational approaches for auto-encoding generative adversarial networks. arXiv preprint arXiv:1706.04987, 2017.
245
+
246
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In Advances in Neural Information Processing Systems, pp. 2226–2234, 2016.
247
+
248
+ Tim Salimans, Andrej Karpathy, Xi Chen, and Diederik P Kingma. PixelCNN $^ { + + }$ : Improving the PixelCNN with Discretized Logistic Mixture Likelihood and Other Modifications. arXiv.org, January 2017.
249
+
250
+ Ashish Shrivastava, Tomas Pfister, Oncel Tuzel, Joshua Susskind, Wenda Wang, and Russell Webb. Learning from simulated and unsupervised images through adversarial training. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2107–2116, 2017.
251
+
252
+ Rui Shu, Hung Bui, and Stefano Ermon. Ac-gan learns a biased distribution. 2017.
253
+
254
+ 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.
255
+
256
+ Dougal J Sutherland, Hsiao-Yu Tung, Heiko Strathmann, Soumyajit De, Aaditya Ramdas, Alex Smola, and Arthur Gretton. Generative models and model criticism via optimized maximum mean discrepancy. arXiv preprint arXiv:1611.04488, 2016.
257
+
258
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2016.
259
+
260
+ Lucas Theis, Aäron van den Oord, and Matthias Bethge. A note on the evaluation of generative models. arXiv.org, November 2015.
261
+
262
+ Ilya Tolstikhin, Olivier Bousquet, Sylvain Gelly, and Bernhard Schoelkopf. Wasserstein auto-encoders. arXiv preprint arXiv:1711.01558, 2017.
263
+
264
+ Vladimir N Vapnik. The nature of statistical learning theory. 1995.
265
+
266
+ Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, et al. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv preprint arXiv:1609.08144, 2016a.
267
+
268
+ Yuhuai Wu, Yuri Burda, Ruslan Salakhutdinov, and Roger Grosse. On the quantitative analysis of decoder-based generative models. arXiv preprint arXiv:1611.04273, 2016b.
269
+
270
+ # A THE IMPORTANCE OF TRADEOFFS IN EVALUATION METRICS
271
+
272
+ Many evaluation metrics proposed for generative modeling are asymptotically consistent: that is, in the limit of infinite data and model capacity, the model which exactly recovers the data distribution will be the unique minimizer of the metric. The data log-likelihood and the MMD (given a suitable kernel) are examples of asymptotically consistent evaluation metrics. Given that in the limit, all such metrics agree with each other (and therefore optimizing them will produce the same result), we might wonder whether the precise choice of metric actually matters: maybe it’s sufficient to arbitrarily pick a “generic” metric like the MMD and minimize it.
273
+
274
+ However, none of this applies when our model is misspecified (that is, our model isn’t capable of exactly recovering the data distribution). In that case, the learning algorithm must choose between capturing different properties of the data distribution. Here, the tradeoffs made by different metrics – which properties of the distributions they assign relatively more and less importance to – can have a strong effect on the result.
275
+
276
+ Theis et al. (2015) provide an excellent overview of this problem and its implications for generative model evaluation. They demonstrate on toy data that in the regime of model misspecification, optimizing three different asymptotically consistent metrics (the log-likelihood, the MMD, and the Jensen-Shannon divergence) yields three different results. Further, considering the task of image generation, they show that log-likelihood and sample quality can be almost completely independent when the model is even very slightly suboptimal. Their work cautions against the use of “generic” metrics and concludes that generative models should always be evaluated using metrics whose tradeoffs are similar to the intended downstream task.
277
+
278
+ The examples in Theis et al. (2015) are mostly hypothetical, so we review a few instances of this problem in recent state-of-the-art generative models of images:
279
+
280
+ • Training two Real NVP models on CelebA using a log-likelihood objective and an NND results in qualitatively very different models. Each model scores better than the other in terms of the metric it was trained to minimize, and worse in terms of the other metric (Danihelka et al., 2017a; Grover et al., 2017). Two PixelCNN models with different architectures trained on CIFAR-10 can attain similar log-likelihoods very close to the state of the art, even while one generates much less realistic samples than the other (Salimans et al., 2017).
281
+ • By construction, the model architecture typically used in GAN generators attains the worst possible log-likelihood of negative infinity, even when the generator is well-trained, produces realistic samples, and is a good minimizer of an NND (Arjovsky & Bottou, 2017).
282
+
283
+ In this context, we take the view of Huang et al. (2017), who argue that NNDs are particularly good choices for evaluation metrics because we can control the tradeoffs they make by changing the discriminator architecture. For example, by using CNNs as discriminators, we can construct metrics which assign greater importance to perceptually relevant properties of the distribution of natural images.
284
+
285
+ # B INCEPTION SCORE
286
+
287
+ The Inception Score $\operatorname { I S } ( q )$ (Salimans et al., 2016) is defined as
288
+
289
+ $$
290
+ \mathrm { I S } ( q ) = \mathbb { E } _ { { x } \sim { q } } [ D _ { \mathrm { K L } } ( p ( { y } | { x } ) | | p ( { y } ) ) ]
291
+ $$
292
+
293
+ where $p ( y | x )$ is output of an Inception network (Szegedy et al., 2016) trained on ImageNet (Deng et al., 2009), producing a distribution over labels $y$ given an image $x$ and $p ( y )$ is the same but marginalized over generated images. While ad-hoc, it has been shown that this method correlates somewhat with perceived image quality (Salimans et al., 2016). To cast IS as a divergence, we will consider the absolute difference in scores between the data and the model:
294
+
295
+ $$
296
+ D _ { \mathrm { I S } } ( p , q ) = | \mathrm { I S } ( p ) - \mathrm { I S } ( q ) |
297
+ $$
298
+
299
+ The inception score is typically computed on 10 different samples of size 5,000, and the scores for each of the 10 samples are averaged to give a final score.
300
+
301
+ # C FRÉCHET INCEPTION DISTANCE
302
+
303
+ The Inception Score only very indirectly incorporates the statistics of the real data. To mitigate this, Heusel et al. (2017) proposed the Fréchet Inception Distance (FID), which is defined as
304
+
305
+ $$
306
+ D _ { \mathrm { F I D } } ( p , q ) = \Vert \mu _ { p } - \mu _ { q } \Vert ^ { 2 } + \operatorname { T r } \left( \Sigma _ { p } + \Sigma _ { q } - 2 ( \Sigma _ { p } \Sigma _ { q } ) ^ { 1 / 2 } \right)
307
+ $$
308
+
309
+ where $\mu _ { p } , \Sigma _ { p }$ and $\mu _ { q } , \Sigma _ { q }$ are the mean and covariance of feature maps from the penultimate layer of an Inception network for real and generated data respectively. This score was shown to be appropriately sensitive to various image degradations and better correlated with image quality compared to the Inception Score (Heusel et al., 2017). FID is typically computed using statistics from 50,000 real and generated images.
310
+
311
+ # D CNN DIVERGENCE ARCHITECTURE AND TRAINING DETAILS
312
+
313
+ For the CNN divergence, we use a typical convolutional network architecture which consists of three $5 \times 5$ convolutional layers with 64, 128, and 256 channels respectively. These layers are followed by a single fully-collected layer which produces a single scalar output. All convolutional layers utilize a stride of 2 and are each followed by a Swish nonlinearity (Ramachandran et al., 2017). Parameters are all initialized using “He”-style initialization (He et al., 2015). We do not use any form of normalization, batch or otherwise.
314
+
315
+ The model is trained using the critic’s loss from the WGAN-GP objective (Gulrajani et al., 2017). We train for 100,000 iterations using minibatches of size 256 with a learning rate of $2 \times 1 0 ^ { - 4 }$ . Our final loss value is computed after training, using an exponential moving average of model weights over training with a coefficient of 0.999.
316
+
317
+ # E VARIANCE OF CNN DIVERGENCE BETWEEN RUNS
318
+
319
+ To verify that the CNN divergence returns approximately the same value each time it is run with the same model, we train a single GAN on CIFAR-10 and then estimate the divergence $D _ { \mathrm { C N N } } ( \hat { p } _ { \mathrm { t r a i n } } , q )$ $n = 5 0$ times. To limit noise in the estimation process, we initialize weights carefully, train using learning rate decay, evaluate using a moving average of network weights. The resulting values have a mean of 5.51 and standard deviation of 0.03, which is approximately $0 . 5 \%$ of the mean. We conclude that our divergence is reliable across runs. Note that we are evaluating a single pretrained model, and different training runs of the same model might yield different scores. However, we view this as arguably a fault of the model’s training process moreso than the of evaluation metric.
320
+
321
+ # F EXPERIMENTAL DETAILS
322
+
323
+ # F.1 COMPARING EVALUATION METRICS’ ABILITY TO MEASURE DIVERSITY
324
+
325
+ For IS and FID, we use sample sizes 5K and 10K common in past work (the estimates don’t change much beyond this size) and for CNN divergence, we use the largest sample size we can $\mathbf { \Gamma } ( { > } 1 \mathbf { M } )$ .
326
+
327
+ # F.2 EVALUATING MODELS AGAINST CNN DIVERGENCE
328
+
329
+ For the VAE and the $\mathrm { P i x e l C N N + + }$ , we train 10 models using the hyperparameters and code provided by the authors and evaluate the divergence 10 times on each. For the GAN, we train 64 models, searching randomly over hyperparameters, and evaluate the divergence once per model. In all cases, we report the best score overall.
md/train/HyXBcYg0b/HyXBcYg0b.md ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RESIDUAL GATED GRAPH CONVNETS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Graph-structured data such as social networks, functional brain networks, gene regulatory networks, communications networks have brought the interest in generalizing deep learning techniques to graph domains. In this paper, we are interested to design neural networks for graphs with variable length in order to solve learning problems such as vertex classification, graph classification, graph regression, and graph generative tasks. Most existing works have focused on recurrent neural networks (RNNs) to learn meaningful representations of graphs, and more recently new convolutional neural networks (ConvNets) have been introduced. In this work, we want to compare rigorously these two fundamental families of architectures to solve graph learning tasks. We review existing graph RNN and ConvNet architectures, and propose natural extension of LSTM and ConvNet to graphs with arbitrary size. Then, we design a set of analytically controlled experiments on two basic graph problems, i.e. subgraph matching and graph clustering, to test the different architectures. Numerical results show that the proposed graph ConvNets are $3 . 1 7 \%$ more accurate and $1 . 5 – 4 \mathrm { x }$ faster than graph RNNs. Graph ConvNets are also $36 \%$ more accurate than variational (non-learning) techniques. Finally, the most effective graph ConvNet architecture uses gated edges and residuality. Residuality plays an essential role to learn multi-layer architectures as they provide a $10 \%$ gain of performance.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Convolutional neural networks of LeCun et al. (1998) and recurrent neural networks of Hochreiter & Schmidhuber (1997) are deep learning architectures that have been applied with great success to computer vision (CV) and natural language processing (NLP) tasks. Such models require the data domain to be regular, such as 2D or 3D Euclidean grids for CV and 1D line for NLP. Beyond CV and NLP, data does not usually lie on regular domains but on heterogeneous graph domains. Users on social networks, functional time series on brain structures, gene DNA on regulatory networks, IP packets on telecommunication networks are a a few examples to motivate the development of new neural network techniques that can be applied to graphs. One possible classification of these techniques is to consider neural network architectures with fixed length graphs and variable length graphs.
12
+
13
+ In the case of graphs with fixed length, a family of convolutional neural networks has been developed on spectral graph theory by Chung (1997). The early work of Bruna et al. (2013) proposed to formulate graph convolutional operations in the spectral domain with the graph Laplacian, as an analogy of the Euclidean Fourier transform as proposed by Hammond et al. (2011). This work was extended by Henaff et al. (2015) to smooth spectral filters for spatial localization. Defferrard et al. (2016) used Chebyshev polynomials to achieve linear complexity for sparse graphs, Levie et al. (2017) applied Cayley polynomials to focus on narrow-band frequencies, and Monti et al. (2017b) dealt with multiple (fixed) graphs. Finally, Kipf & Welling (2017) simplified the spectral convnets architecture using 1-hop filters to solve the semi-supervised clustering task. For related works, see also the works of Bronstein et al. (2017b), Bronstein et al. (2017a) and references therein.
14
+
15
+ For graphs with variable length, a generic formulation was proposed by Gori et al. (2005); Scarselli et al. (2009) based on recurrent neural networks. The authors defined a multilayer perceptron of a vanilla RNN. This work was extended by Li et al. (2016) using a GRU architecture and a hidden state that captures the average information in local neighborhoods of the graph. The work of Sukhbaatar et al. (2016) introduced a vanilla graph ConvNet and used this new architecture to solve learning communication tasks. Marcheggiani & Titov (2017) introduced an edge gating mechanism in graph ConvNets for semantic role labeling. Finally, Bruna & Li (2017) designed a network to learn nonlinear approximations of the power of graph Laplacian operators, and applied it to the unsupervised graph clustering problem. Other works for drugs design, computer graphics and vision are presented by Duvenaud et al. (2015); Boscaini et al. (2016); Monti et al. (2017a).
16
+
17
+ In this work, we study the two fundamental classes of neural networks, RNNs and ConvNets, in the context of graphs with arbitrary length. Section 2 reviews the existing techniques. Section 3 presents the new graph NN models. Section 4 reports the numerical experiments.
18
+
19
+ # 2 NEURAL NETWORKS FOR GRAPHS WITH ARBITRARY LENGTH
20
+
21
+ # 2.1 RECURRENT NEURAL NETWORKS
22
+
23
+ Generic formulation. Consider a standard RNN for word prediction in natural language processing. Let $h _ { i }$ be the feature vector associated with word $i$ in the sequence. In a regular vanilla RNN, $h _ { i }$ is computed with the feature vector $h _ { j }$ from the previous step and the current word $x _ { i }$ , so we have:
24
+
25
+ $$
26
+ h _ { i } = f _ { \mathrm { V R N N } } \left( \begin{array} { l } { x _ { i } \ , \ \{ h _ { j } : j = i - 1 \} } \end{array} \right)
27
+ $$
28
+
29
+ The notion of neighborhood for regular RNNs is the previous step in the sequence. For graphs, the notion of neighborhood is given by the graph structure. If $h _ { i }$ stands for the feature vector of vertex $i$ , then the most generic version of a feature vector for a graph RNN is
30
+
31
+ $$
32
+ h _ { i } = f _ { \mathrm { G - R N N } } ( \begin{array} { l } { x _ { i } } \end{array} , \begin{array} { l } { \{ h _ { j } : j i \} } \end{array} )
33
+ $$
34
+
35
+ where $x _ { i }$ refers to a data vector and $\{ h _ { j } : j i \}$ denotes the set of feature vectors of the neighboring vertices. Observe that the set $\{ h _ { j } \}$ is unordered, meaning that $h _ { i }$ is intrinsic, i.e. invariant by vertex re-indexing (no vertex matching between graphs is required). Other properties of $f _ { \mathrm { G - R N N } }$ are locality as only neighbors of vertex $i$ are considered, weight sharing, and such vector is independent of the graph length. In summary, to define a feature vector in a graph RNN, one needs a mapping $f$ that takes as input an unordered set of vectors $\{ h _ { j } \}$ , i.e. the feature vectors of all neighboring vertices, and a data vector $x _ { i }$ , Figure 1(a).
36
+
37
+ We refer to the mapping $f _ { \mathrm { G - R N N } }$ as the neighborhood transfer function in graph RNNs. In a regular RNN, each neighbor as a distinct position relatively to the current word (1 position left from the center). In a graph, if the edges are not weighted or annotated, neighbors are not distinguishable. The only vertex which is special is the center vertex around which the neighborhood is built. This explains the generic formulation of Eq. (1). This type of formalism for deep learning for graphs with variable length is described by Scarselli et al. (2009); Gilmer et al. (2017); Bronstein et al. (2017a) with slightly different terminology and notations.
38
+
39
+ Graph Neural Networks of Scarselli et al. (2009). The earliest work of graph RNNs for arbitrary graphs was introduced by Gori et al. (2005); Scarselli et al. (2009). The authors proposed to use a vanilla RNN with a multilayer perceptron to define the feature vector $h _ { i }$ :
40
+
41
+ $$
42
+ h _ { i } = f _ { \mathrm { G \cdot V R N } } ( x _ { i } , \{ h _ { j } : j i \} ) = \sum _ { j i } \mathcal { C } _ { \mathrm { G \cdot V R N } } ( x _ { i } , h _ { j } )
43
+ $$
44
+
45
+ with
46
+
47
+ $$
48
+ \mathcal { C } _ { \mathrm { G - V R N N } } ( x _ { i } , h _ { j } ) = A \sigma ( B \sigma ( U x _ { i } + V h _ { j } ) ) ,
49
+ $$
50
+
51
+ and $\sigma$ is the sigmoid function, $A , B , U , V$ are the weight parameters to learn.
52
+
53
+ Minimization of Eq. (2) does not hold a closed-form solution as the dependence computational graph of the model is not a directed acyclic graph (DAG). Scarselli et al. (2009) proposed a fixed-point iterative scheme: for $t = 0 , 1 , 2 , \ldots$ .
54
+
55
+ $$
56
+ h _ { i } ^ { t + 1 } = \sum _ { j i } { \mathcal { C } } ( x _ { i } , h _ { j } ^ { t } ) , \quad h _ { i } ^ { t = 0 } = 0 \ \forall i .
57
+ $$
58
+
59
+ The iterative scheme is guaranteed to converge as long as the mapping is contractive, which can be a strong assumption. Besides, a large number of iterations can be computational expensive.
60
+
61
+ ![](images/ae08cb64e7e1f123a452ccae4f2f714f7c91898685153b01f5b0bf6018a27c4c.jpg)
62
+ Figure 1: Generic feature representation $h _ { i }$ of vertex $i$ on a graph RNN (a) and a graph convNet (b).
63
+
64
+ Gated Graph Neural Networks of Li et al. (2016). In this work, the authors use the gated recurrent units (GRU) of Chung et al. (2014):
65
+
66
+ $$
67
+ h _ { i } = f _ { \mathrm { G - G R U } } ( x _ { i } , \{ h _ { j } : j i \} ) = \mathcal { C } _ { \mathrm { G - G R U } } ( x _ { i } , \sum _ { j i } h _ { j } )
68
+ $$
69
+
70
+ As the minimization of Eq. (4) does not have an analytical solution, Li et al. (2016) designed the following iterative scheme:
71
+
72
+ $$
73
+ \begin{array} { r c l l } { { { h } _ { i } ^ { t + 1 } } } & { { = } } & { { \displaystyle { \mathcal C } _ { \mathrm { G - G R U } } ( h _ { i } ^ { t } , \bar { h } _ { i } ^ { t } ) , } } & { { \displaystyle h _ { i } ^ { t = 0 } = x _ { i } \forall i , } } \\ { { \mathrm { w h e r e } \quad \bar { h } _ { i } ^ { t } } } & { { = } } & { { \displaystyle \sum _ { j \to i } h _ { j } ^ { t } , } } \end{array}
74
+ $$
75
+
76
+ and $\mathcal { C } _ { \mathrm { G - G R U } } ( h _ { i } ^ { t } , \bar { h } _ { i } ^ { t } )$ is equal to
77
+
78
+ $$
79
+ \begin{array} { r c l } { { z _ { i } ^ { t + 1 } } } & { { = } } & { { \sigma ( U _ { z } h _ { i } ^ { t } + V _ { z } \bar { h } _ { i } ^ { t } ) } } \\ { { r _ { i } ^ { t + 1 } } } & { { = } } & { { \sigma ( U _ { r } h _ { i } ^ { t } + V _ { r } \bar { h } _ { i } ^ { t } ) } } \\ { { \tilde { h } _ { i } ^ { t + 1 } } } & { { = } } & { { \operatorname { t a n h } \bigl ( U _ { h } ( h _ { i } ^ { t } \odot r _ { i } ^ { t + 1 } ) + V _ { h } \bar { h } _ { i } ^ { t } \bigr ) } } \\ { { h _ { i } ^ { t + 1 } } } & { { = } } & { { ( 1 - z _ { i } ^ { t + 1 } ) \odot h _ { i } ^ { t } + z _ { i } ^ { t + 1 } \odot \tilde { h } _ { i } ^ { t + 1 } , } } \end{array}
80
+ $$
81
+
82
+ where $\odot$ is the Hadamard point-wise multiplication operator. This model was used for NLP tasks by Li et al. (2016) and also in quantum chemistry by Gilmer et al. (2017) for fast organic molecule properties estimation, for which standard techniques (DFT) require expensive computational time.
83
+
84
+ Tree-Structured LSTM of Tai et al. (2015). The authors extended the original LSTM model of Hochreiter $\&$ Schmidhuber (1997) to a tree-graph structure:
85
+
86
+ $$
87
+ h _ { i } = f _ { \mathrm { T L S T M } } \left( x _ { i } , \left\{ h _ { j } : j \in C ( i ) \right\} \right) = \mathcal { C } _ { \mathrm { T L S T M } } ( x _ { i } , h _ { i } , \sum _ { j \in C ( i ) } h _ { j } ) ,
88
+ $$
89
+
90
+ where $C ( i )$ refers the set of children of node $i$ . $\begin{array} { r } { \mathcal { C } _ { \mathrm { T - L S T M } } ( x _ { i } , h _ { i } , \sum _ { j \in C ( i ) } h _ { j } ) } \end{array}$ is equal to
91
+
92
+ $$
93
+ \begin{array} { r c l } { \displaystyle \bar { h } _ { i } } & { = } & { \displaystyle \sum _ { j \in { \cal C } ( i ) } h _ { j } } \\ { \displaystyle i _ { i } } & { = } & { \sigma ( U _ { i } x _ { i } + V _ { i } \bar { h } _ { i } ) } \\ { \displaystyle o _ { i } } & { = } & { \sigma ( U _ { o } x _ { i } + V _ { o } \bar { h } _ { i } ) } \\ { \displaystyle \tilde { c } _ { i } } & { = } & { \mathrm { t a n h } \big ( U _ { c } x _ { i } + V _ { c } \bar { h } _ { i } \big ) } \\ { \displaystyle f _ { i j } } & { = } & { \sigma \big ( U _ { f } x _ { i } + V _ { f } h _ { j } \big ) } \\ { \displaystyle c _ { i } } & { = } & { i _ { i } \odot \tilde { c } _ { i } + { \displaystyle \sum _ { i \in { \cal C } ( i ) } f _ { i j } } \odot c _ { j } } \\ { \displaystyle h _ { i } } & { = } & { o _ { i } \odot \mathrm { t a n h } \big ( c _ { i } \big ) } \end{array}
94
+ $$
95
+
96
+ Unlike the works of Scarselli et al. (2009); Li et al. (2016), Tree-LSTM does not require an iterative process to update its feature vector $h _ { i }$ as the tree structure is also a DAG as original LSTM. Consequently, the feature representation (5) can be updated with a recurrent formula. Nevertheless, a tree is a special case of graphs, and such recurrence formula cannot be directly applied to arbitrary graph structure. A key property of this model is the function $f _ { i j }$ which acts as a gate on the edge from neighbor $j$ to vertex $i$ . Given the task, the gate will close to let the information flow from neighbor $j$ to vertex $i$ , or it will open to stop it. It seems to be an essential property for learning systems on graphs as some neighbors can be irrelevant. For example, for the community detection task, the graph neural network should learn which neighbors to communicate (same community) and which neighbors to ignore (different community). In different contexts, Dauphin et al. (2017) added a gated mechanism inside the regular ConvNets in order to improve language modeling for translation tasks, and van den Oord et al. (2016) considered a gated unit with the convolutional layers after activation, and used it for image generation.
97
+
98
+ # 2.2 CONVOLUTIONAL NEURAL NETWORKS
99
+
100
+ Generic formulation. Consider now a classical ConvNet for computer vision. Let $h _ { i j } ^ { \ell }$ denote the feature vector at layer $\ell$ associated with pixel $( i , j )$ . In a regular ConvNet, $h _ { i j } ^ { \ell + 1 }$ is obtained by applying a non linear transformation to the feature vectors $h _ { i ^ { \prime } j ^ { \prime } } ^ { \ell }$ for all pixels $( i ^ { \prime } , j ^ { \prime } )$ in a neighborhood of pixel $( i , j )$ . For example, with $3 \times 3$ filters, we would have:
101
+
102
+ $$
103
+ h _ { i j } ^ { \ell + 1 } = f _ { \mathrm { C N N } } ^ { \ell } \left( \left\{ h _ { i ^ { \prime } j ^ { \prime } } ^ { \ell } : | i - i ^ { \prime } | \leq 1 \mathrm { ~ a n d ~ } | j - j ^ { \prime } | \leq 1 \right\} \right)
104
+ $$
105
+
106
+ In the above, the notation $\{ h _ { i ^ { \prime } j ^ { \prime } } ^ { \ell } : | i - i ^ { \prime } | \le 1$ and $| j - j ^ { \prime } | \leq 1 \}$ denote the concatenation of all feature vectors $h _ { i ^ { \prime } j ^ { \prime } } ^ { \ell }$ belonging to the $3 \times 3$ neighborhood of vertex $( i , j )$ . In ConvNets, the notion of neighborhood is given by the euclidian distance. As previously noticed, for graphs, the notion of neighborhood is given by the graph structure. Thus, the most generic version of a feature vector $h _ { i }$ at vertex $i$ for a graph ConvNet is
107
+
108
+ $$
109
+ h _ { i } ^ { \ell + 1 } = f _ { \scriptscriptstyle \mathrm { G - C N N } } ( h _ { i } ^ { \ell } , \{ h _ { j } ^ { \ell } : j i \} )
110
+ $$
111
+
112
+ where $\{ h _ { j } ^ { \ell } : j i \}$ denotes the set of feature vectors of the neighboring vertices. In other words, to define a graph ConvNet, one needs a mapping $f _ { \mathrm { G - C N N } }$ taking as input a vector $h _ { i } ^ { \ell }$ (the feature vector of the center vertex) as well as an unordered set of vectors $\{ h _ { j } ^ { \ell } \}$ (the feature vectors of all neighboring vertices), see Figure 1(b). We also refer to the mapping $f _ { \mathrm { G - C N N } }$ as the neighborhood transfer function. In a regular ConvNet, each neighbor as a distinct position relatively to the center pixel (for example 1 pixel up and 1 pixel left from the center). As for graph RNNs, the only vertex which is special for graph ConvNets is the center vertex around which the neighborhood is built.
113
+
114
+ CommNets of Sukhbaatar et al. (2016). The authors introduced one of the simplest instantiations of a graph ConvNet with the following neighborhood transfer function:
115
+
116
+ $$
117
+ h _ { i } ^ { \ell + 1 } = f _ { \mathrm { G \cdot v C N N } } ^ { \ell } \left( h _ { i } ^ { \ell } , \frac { } { } \{ h _ { j } ^ { \ell } : j \to i \} \right) = \mathrm { R e L U } \left( U ^ { \ell } h _ { i } ^ { \ell } + V ^ { \ell } \sum _ { j \to i } h _ { j } ^ { \ell } \right) ,
118
+ $$
119
+
120
+ where $\ell$ denotes the layer level, and ReLU is the rectified linear unit. We will refer to this architecture as the vanilla graph ConvNet. Sukhbaatar et al. (2016) used this graph neural network to learn the communication between multiple agents to solve multiple tasks like traffic control.
121
+
122
+ Syntactic Graph Convolutional Networks of Marcheggiani $\pmb { \& }$ Titov (2017). The authors proposed the following transfer function:
123
+
124
+ $$
125
+ h _ { i } ^ { \ell + 1 } = f _ { \mathrm { s - G C N } } ^ { \ell } \left( \frac { } { } \{ h _ { j } ^ { \ell } : j \to i \} \ \right) = \mathrm { R e L U } \left( \sum _ { j \to i } \eta _ { i j } \odot V ^ { \ell } h _ { j } ^ { \ell } \right)
126
+ $$
127
+
128
+ where $\eta _ { i j }$ act as edge gates, and are computed by:
129
+
130
+ $$
131
+ \eta _ { i j } = \sigma \left( A ^ { \ell } h _ { i } ^ { \ell } + B ^ { \ell } h _ { j } ^ { \ell } \right) .
132
+ $$
133
+
134
+ These gated edges are very similar in spirit to the Tree-LSTM proposed in Tai et al. (2015). We believe this mechanism to be important for graphs, as they will be able to learn what edges are important for the graph learning task to be solved.
135
+
136
+ # 3 MODELS
137
+
138
+ Proposed Graph LSTM. First, we propose to extend the Tree-LSTM of Tai et al. (2015) to arbitrary graphs and multiple layers:
139
+
140
+ $$
141
+ { h } _ { i } ^ { \ell + 1 } = f _ { \mathrm { G \mathrm { \tiny { L S T M } } } } ^ { \ell } ( x _ { i } ^ { \ell } , \{ h _ { j } ^ { \ell } : j i \} ) = \mathcal { C } _ { \mathrm { G \mathrm { \tiny { L S T M } } } } ( x _ { i } ^ { \ell } , h _ { i } ^ { \ell } , \sum _ { j i } h _ { j } ^ { \ell } , c _ { i } ^ { \ell } )
142
+ $$
143
+
144
+ As there is no recurrent formula is the general case of graphs, we proceed as Scarselli et al. (2009) and use an iterative process to solve Eq. (10): At layer $\ell$ , for $t = 0 , 1 , . . . , T$
145
+
146
+ $$
147
+ \begin{array} { r l } { \bar { h } _ { \dot { i } } ^ { \ell , t } } & { = \displaystyle \sum _ { j i } h _ { j } ^ { \ell , t } , } \\ { { \dot { a } _ { i } ^ { \ell , t + 1 } } } & { = \sigma ( U _ { i } ^ { \ell } x _ { i } ^ { \ell } + V _ { i } ^ { \ell } { \bar { h } _ { i } ^ { \ell , t } } ) } \\ { { \dot { o } _ { i } ^ { \ell , t + 1 } } } & { = \sigma ( U _ { i } ^ { \ell } x _ { i } ^ { \ell } + V _ { i } ^ { \ell } { \bar { h } _ { i } ^ { \ell , t } } ) } \\ { { \dot { c } _ { i } ^ { \ell , t + 1 } } } & { = \mathrm { t a n h } ( { \bar { c } _ { i } ^ { \ell } x _ { i } ^ { \ell } + \bar { h } _ { i } ^ { \ell } \bar { h } _ { i } ^ { \ell , t } } ) } \\ { { \dot { f } _ { i } ^ { \ell , t + 1 } } } & { = \sigma ( U _ { i } ^ { \ell } x _ { i } ^ { \ell } + V _ { i } ^ { \ell } { \bar { h } _ { i } ^ { \ell , t } } ) } \\ { { \dot { c } _ { i } ^ { \ell , t + 1 } } } & { = { \dot { \iota } _ { i } ^ { \ell , t + 1 } } \odot { \bar { c } _ { i } ^ { \ell } } ^ { t + 1 } + \displaystyle \sum _ { j i } f _ { i j } ^ { \ell , t + 1 } \odot { c _ { j } ^ { \ell , t + 1 } } } \\ { { \dot { h } _ { \dot { i } } ^ { \ell , t + 1 } } } & { = { \dot { \sigma } _ { i } ^ { \ell , t + 1 } } \odot \mathrm { t a n h } ( { c } _ { i } ^ { \ell } t ^ { + 1 } ) } \end{array}
148
+ $$
149
+
150
+ and initial conditions: $\begin{array} { r c l } { { h _ { i } ^ { \ell , t = 0 } } } & { { = } } & { { c _ { i } ^ { \ell , t = 0 } = 0 , \forall i , \ell } } \\ { { x _ { i } ^ { \ell } } } & { { = } } & { { h _ { i } ^ { \ell - 1 , T } , x _ { i } ^ { \ell = 0 } = x _ { i } , \forall i , \ell } } \end{array}$
151
+
152
+ In other words, the vector $h _ { i } ^ { \ell + 1 }$ is computed by running the model from $t = 0 , . . , T$ at layer $\ell$ . It produces the vector $h _ { i } ^ { \ell , t = T }$ which becomes $h _ { i } ^ { \ell + 1 }$ and also the input $x _ { i } ^ { \ell + 1 }$ for the next layer. The proposed Graph LSTM model differs from Liang et al. (2016); Peng et al. (2017) mostly because the cell $\mathcal { C } _ { \mathrm { G - L S T M } }$ in these previous models is not iterated over multiple times $T$ , which reduces the performance of Graph LSTM (see numerical experiments on Figure 4).
153
+
154
+ Proposed Gated Graph ConvNets. We leverage the vanilla graph ConvNet architecture of Sukhbaatar et al. (2016), Eq.(7), and the edge gating mechanism of Marcheggiani $\&$ Titov (2017), Eq.(8), by considering the following model:
155
+
156
+ $$
157
+ h _ { i } ^ { \ell + 1 } = f _ { \mathrm { G \ell { \mathrm { G C N N } } } } ^ { \ell } ( h _ { i } ^ { \ell } , \{ h _ { j } ^ { \ell } : j i \} ) = \mathrm { R e L U } ( U ^ { \ell } h _ { i } ^ { \ell } + \sum _ { j i } \eta _ { i j } \odot V ^ { \ell } h _ { j } ^ { \ell } )
158
+ $$
159
+
160
+ where $h _ { i } ^ { \ell = 0 } = x _ { i } , \forall i$ , and the edge gates $\eta _ { i j }$ are defined in Eq. (9). This model is the most generic formulation of a graph ConvNet (because it uses both the feature vector $h _ { i } ^ { \ell }$ of the center vertex and the feature vectors $h _ { j } ^ { \ell }$ of neighboring vertices) with the edge gating property.
161
+
162
+ Residual Gated Graph ConvNets. In addition, we formulate a multi-layer gated graph ConvNet using residual networks (ResNets) introduced by He et al. (2016). This boils down to add the identity operator between successive convolutional layers:
163
+
164
+ $$
165
+ \begin{array} { r l r } { h _ { i } ^ { \ell + 1 } } & { = } & { f ^ { \ell } \left( \ h _ { i } ^ { \ell } , \ \{ h _ { j } ^ { \ell } : j \to i \} \ \right) + h _ { i } ^ { \ell } . } \end{array}
166
+ $$
167
+
168
+ As we will see, such multi-layer strategy work very well for graph neural networks.
169
+
170
+ # 4 EXPERIMENTS
171
+
172
+ # 4.1 SUBGRAPH MATCHING
173
+
174
+ We consider the subgraph matching problem presented by Scarselli et al. (2009), see Figure 2(a).
175
+ The goal is to find the vertices of a given subgraph $P$ in larger graphs $G _ { k }$ with variable sizes.
176
+
177
+ ![](images/fe9266c226259a8fd9f2ac74589691f443597b836426fd524d2758931935a96a.jpg)
178
+ Figure 2: Graph learning tasks.
179
+
180
+ Identifying similar localized patterns in different graphs is one of the most basic tasks for graph neural networks. The subgraph $P$ and larger graph $G _ { k }$ are generated with the stochastic block model (SBM), see for example Abbe (2017). A SBM is a random graph which assigns communities to each node as follows: any two vertices are connected with the probability $p$ if they belong to the same community, or they are connected with the probability $q$ if they belong to different communities. For all experiments, we generate a subgraph $P$ of 20 nodes with a SBM $q = 0 . 5$ , and the signal on $P$ is generated with a uniform random distribution with a vocabulary of size 3, i.e. $\{ 0 , 1 , 2 \}$ . Larger graphs $G _ { k }$ are composed of 10 communities with sizes randomly generated between 15 and 25. The SBM of each community is $p = 0 . 5$ . The value of $q$ , which acts as the noise level, is 0.1, unless otherwise specified. Besides, the signal on $G _ { k }$ is also randomly generated between $\{ 0 , 1 , 2 \}$ . Inputs of all neural networks are the graphs with variable size, and outputs are vertex classification vectors of input graphs. Finally, the output of neural networks are simple fully connected layers from the hidden states.
181
+
182
+ All reported results are averaged over 5 trails. We run 5 algorithms; Gated Graph Neural Networks of Li et al. (2016), CommNets of Sukhbaatar et al. (2016), SyntacticNets of Marcheggiani & Titov (2017), and the proposed Graph LSTM and Gated ConvNets from Section 3. We upgrade the existing models of Li et al. (2016); Sukhbaatar et al. (2016); Marcheggiani & Titov (2017) with a multilayer version for Li et al. (2016) and using ResNets for all three architectures. We also use the batch normalization technique of Ioffe & Szegedy (2015) to speed up learning convergence for our algorithms, and also for Li et al. (2016); Sukhbaatar et al. (2016); Marcheggiani & Titov (2017). The learning schedule is as follows: the maximum number of iterations, or equivalently the number of randomly generated graphs with the attached subgraph is 5,000 and the learning rate is decreased by a factor 1.25 if the loss averaged over 100 iterations does not decrease. The loss is the cross-entropy with 2 classes (the subgraph $P$ class and the class of the larger graph $G _ { k }$ ) respectively weighted by their sizes. The accuracy is the average of the diagonal of the normalized confusion matrix w.r.t. the cluster sizes (the confusion matrix measures the number of nodes correctly and badly classified for each class). We also report the time for a batch of 100 generated graphs. The choice of the architectures will be given for each experiment. All algorithms are optimized as follow. We fix a budget of parameters of $B = 1 0 0 K$ and a number of layers $L = 6$ . The number of hidden neurons $H$ for each layer is automatically computed. Then we manually select the optimizer and learning rate for each architecture that best minimize the loss. For this task, Li et al. (2016); Sukhbaatar et al. (2016); Marcheggiani & Titov (2017) and our gated ConvNets work well with Adam and learning rate 0.00075. Graph LSTM uses SGD with learning rate 0.075. Besides, the value of inner iterative steps $T$ for graph LSTM and Li et al. (2016) is 3.
183
+
184
+ The first experiment focuses on shallow graph neural networks, i.e. with a single layer $L = 1$ . We also vary the level of noise, that is the probability $q$ in the SBM that connects two vertices in two different communities (the higher $q$ the more mixed are the communities). The hyper-parameters are selected as follows. Besides $L = 1$ , the budget is $B = 1 0 0 K$ and the number of hidden neurons $H$ is automatically computed for each architecture to satisfy the budget. First row of Figure 3 reports the accuracy and time for the five algorithms and for different levels of noise $q = \{ 0 . \bar { 1 } , 0 . 2 , 0 . \bar { 3 } 5 , 0 . 5 \}$ . RNN architectures are plotted in dashed lines and ConvNet architectures in solid lines. For shallow networks, all RNN architectures (graph LSTM and Li et al. (2016)) performs much better, but they also take more time than the graph ConvNets architectures we propose, as well as Sukhbaatar et al.
185
+
186
+ (2016); Marcheggiani & Titov (2017). As expected, all algorithms performances decrease when the noise increases.
187
+
188
+ The second experiment demonstrates the importance of having multiple layers compared to shallow networks. We vary the number of layers $\bar { L } = \{ 1 , 2 , 4 , 6 , 1 \bar { 0 } \}$ and we fix the number of hidden neurons to $H \ : = \ : 5 0$ . Notice that the budget is not the same for all architectures. Second row of Figure 3 reports the accuracy and time w.r.t. $L$ (middle figure is a zoom in the left figure). All models clearly benefit with more layers, but RNN-based architectures see their performances decrease for a large number of layers. The ConvNet architectures benefit from large $L$ values, with the proposed graph ConvNet performing slightly better than Sukhbaatar et al. (2016); Marcheggiani & Titov (2017). Besides, all ConvNet models are faster than RNN models.
189
+
190
+ In the third experiment, we evaluate the algorithms for different budgets of parameters $B \ =$ $\{ 2 5 K , 5 0 K , 7 5 K , 1 0 0 K , 1 5 0 K \}$ . For this experiment, we fix the number of layers $L \ = \ 6$ and the number of neurons $H$ is automatically computed given the budget $B$ . The results are reported in the third row of Figure 3. For this task, the proposed graph ConvNet best performs for a large budget, while being faster than RNNs.
191
+
192
+ ![](images/dcde2c4f276a50992f1d845a91368215338f8db5149ca1d2eb732f34dd415995.jpg)
193
+ Figure 3: Subgraph matching: First row studies shallow networks w.r.t. noise. Second row investigates multilayer graph networks. Third row reports graph architectures w.r.t. budget.
194
+
195
+ We also show the influence of hyper-parameter $T$ for Li et al. (2016) and the proposed graph LSTM. We fix $H = 5 0$ , $L = 3$ and $B = 1 0 0 K$ . Figure 4 reports the results for $T = \{ 1 , 2 , 3 , 4 , 6 \}$ . The $T$ value has an undesirable impact on the performance of graph LSTM. Multi-layer Li et al. (2016) is not really influenced by $T$ . Finally, the computational time naturally increases with larger $T$ values.
196
+
197
+ # 4.2 SEMI-SUPERVISED CLUSTERING
198
+
199
+ In this section, we consider the semi-supervised clustering problem, see Figure 2(b). This is also a standard task in network science. For this work, it consists in finding 10 communities on a graph given 1 single label for each community. This problem is more discriminative w.r.t. to the architectures than the previous single pattern matching problem where there were only 2 clusters to find (i.e. $50 \%$ random chance). For clustering, we have 10 clusters (around $10 \%$ random chance). As in the previous section, we use SBM to generate graphs of communities with variable length. The size for each community is randomly generated between 5 and 25, and the label is randomly selected in each community. Probability $p$ is 0.5, and $q$ depends on the experiment. For this task, Li et al. (2016); Sukhbaatar et al. (2016); Marcheggiani & Titov (2017) and the proposed gated ConvNets work well with Adam and learning rate 0.00075. Graph LSTM uses SGD with learning rate 0.0075. The value of $T$ for graph LSTM and Li et al. (2016) is 3.
200
+
201
+ ![](images/29fc1a6ccd0fa8c50620d388786c8fec23357cf50224fe7466b1f70c4f0ff43f.jpg)
202
+ Figure 4: Influence of hyper-parameter $T$ on RNN architectures. Left figure is for graph matching, middle figure for semi-supervised clustering, and right figure are the batch time for the clustering task (same trend for matching).
203
+
204
+ The same set of experiments as in the previous task are reported in Figure 5. ConvNet architectures get clearly better than RNNs when the number of layers increase (middle row), with the proposed Gated ConvNet outperforming the other architectures. For a fixed number of layers $L = 6$ , our graph ConvNets and Marcheggiani & Titov (2017) best perform for all budgets, while paying a reasonable computational cost.
205
+
206
+ ![](images/ff4244af7cedb9a88d147a5dea9aab32820c1913899132c1e396441ff789676f.jpg)
207
+ Figure 5: Semi-supervised clustering: First row reports shallow networks w.r.t. noise $q$ . Second row shows multilayer graph networks w.r.t. $L$ . Third row is about graph architectures w.r.t. budget $B$ .
208
+
209
+ Next, we report the learning speed of the models. We fix $L \ = \ 6$ , $B \ = \ 1 0 0 K$ with $H$ being automatically computed to satisfy the budget. Figure 6 reports the accuracy w.r.t. time. The ConvNet architectures converge faster than RNNs, in particular for the semi-supervised task.
210
+
211
+ ![](images/c2aa29c01817800597511abc623b80c55cc6ca7fb741d397a4b0118a11a0e63b.jpg)
212
+ Figure 6: Learning speed of RNN and ConvNet architectures. Left figure is for graph matching and right figure semi-supervised clustering.
213
+
214
+ To close this study, we are interested in comparing learning based approaches to non-learning variational ones. To this aim, we solve the variational Dirichlet problem with labeled and unlabelled data as proposed by Grady (2006). We run 100 experiments and report an average accuracy of $4 5 . 3 7 \%$ using the same setting as the learning techniques (one label per class). The performance of the best learning model is $82 \%$ . Learning techniques produce better performances with a different paradigm as they use training data with ground truth, while variational techniques do not use such information. The downside is the need to see 2000 training graphs to get to $82 \%$ . However, when the training is done, the test complexity of these learning techniques is $O ( E )$ , where $E$ is the number of edges in the graph. This is an advantage over the variational Dirichlet model that solves a sparse linear system of equations with complexity ${ \cal O } ( E ^ { 3 / 2 } )$ , see Lipton et al. (1979).
215
+
216
+ # 5 CONCLUSION
217
+
218
+ This work explores the choice of graph neural network architectures for solving learning tasks with graphs of variable length. We developed analytically controlled experiments for two fundamental graph learning problems, that are subgraph matching and graph clustering. Numerical experiments showed that graph ConvNets had a monotonous increase of accuracy when the network gets deeper, unlike graph RNNs for which performance decreases for a large number of layers. This led us to consider the most generic formulation of gated graph ConvNets, Eq. (11). We also explored the benefit of residuality for graphs, Eq. (12). Without residuality, existing graph neural networks are not able to stack more than a few layers. This makes this property essential for graph neural networks, which receive a $10 \%$ boost of accuracy when more than 6 layers were stacked. Future work will focus on solving domain-specific problems in chemistry, physics, and neuroscience.
219
+
220
+ # REFERENCES
221
+
222
+ E. Abbe. Community Detection and Stochastic Block Models: Recent Developments. arXiv preprint arXiv:1703.10146, 2017.
223
+ D. Boscaini, J. Masci, E. Rodola, and M. M. Bronstein. Learning shape correspondence with \` anisotropic convolutional neural networks. In Proc. NIPS, 2016.
224
+ M. Bronstein, X. Bresson, A. Szlam, J. Bruna, and Y. LeCun. Tutorial on Geometric Deep Learning on Graphs and Manifolds. Conference on Computer Vision and Pattern Recognition (CVPR), 2017a.
225
+ M. M. Bronstein, J. Bruna, Y. LeCun, A. Szlam, and P. Vandergheynst. Geometric deep learning: going beyond euclidean data. IEEE Signal Processing Magazine, 2017b.
226
+ J. Bruna and X. Li. Community Detection with Graph Neural Networks. arXiv preprint arXiv:1705.08415, 2017.
227
+ J. Bruna, W. Zaremba, A. Szlam, and Y. LeCun. Spectral Networks and Deep Locally Connected Networks on Graphs. arXiv:1312.6203, 2013.
228
+ F. R. K. Chung. Spectral Graph Theory, volume 92. American Mathematical Society, 1997.
229
+ J. Chung, C. Gulcehre, K. Cho, and Y. Bengio. Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling. arXiv preprint arXiv:1412.3555, 2014.
230
+ Y. Dauphin, A. Fan, M. Auli, and D. Grangier. Language Modeling with Gated Convolutional Networks. International Conference on Machine Learning (ICML), 2017.
231
+ M. Defferrard, X. Bresson, and P. Vandergheynst. Convolutional Neural Networks on Graphs with Fast Localized Spectral Filtering. Advances in Neural Information Processing Systems (NIPS), pp. 3844–3852, 2016.
232
+ D. K. Duvenaud, D. Maclaurin, J. Iparraguirre, R. Bombarell, T. Hirzel, A. Aspuru-Guzik, and R. P Adams. Convolutional networks on graphs for learning molecular fingerprints. In Proc. NIPS, 2015.
233
+ J. Gilmer, S. Schoenholz, P. Riley, O. Vinyals, and G. Dahl. Neural Message Passing for Quantum Chemistry. arXiv preprint arXiv:1704.01212, 2017.
234
+ M. Gori, G. Monfardini, and F. Scarselli. A New Model for Learning in Graph Domains. IEEE Transactions on Neural Networks, 2:729–734, 2005.
235
+ L. Grady. Random Walks for Image Segmentation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 28(11):1768–1783, 2006.
236
+ D. Hammond, P. Vandergheynst, and R. Gribonval. Wavelets on Graphs via Spectral Graph Theory. Applied and Computational Harmonic Analysis, 30(2):129–150, 2011.
237
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep Residual Learning for Image Recognition. Computer Vision and Pattern Recognition, pp. 770–778, 2016.
238
+ M. Henaff, J. Bruna, and Y. LeCun. Deep Convolutional Networks on Graph-Structured Data. arXiv:1506.05163, 2015.
239
+ S. Hochreiter and J. Schmidhuber. Long Short-Term Memory. Neural Computation, 9(8):1735– 1780, 1997.
240
+ S. Ioffe and C. Szegedy. Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift. International Conference on Machine Learning (ICML), pp. 448–456, 2015.
241
+ T. Kipf and M. Welling. Semi-Supervised Classification with Graph Convolutional Networks. International Conference on Learning Representations (ICLR), 2017.
242
+ Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-Based Learning Applied to Document Recognition. In Proceedings of the IEEE, 86(11), pp. 2278–2324, 1998.
243
+ R. Levie, F. Monti, X. Bresson, and M.M. Bronstein. CayleyNets: Graph Convolutional Neural Networks with Complex Rational Spectral Filters. arXiv preprint arXiv:1705.07664, 2017.
244
+ Y. Li, D. Tarlow, M. Brockschmidt, and R. Zemel. Gated Graph Sequence Neural Networks. International Conference on Learning Representations (ICLR), 2016.
245
+ X. Liang, X. Shen, J. Feng, L. Lin, and S. Yan. Semantic Object Parsing with graph LSTM. In European Conference on Computer Vision (ECCV), pp. 125–143, 2016.
246
+ R. Lipton, D. Rose, and R. Tarjan. Generalized Nested Dissection. SIAM Journal on Numerical Analysis, 16(2):346–358, 1979.
247
+ D. Marcheggiani and I. Titov. Encoding Sentences with Graph Convolutional Networks for Semantic Role Labeling. arXiv preprint arXiv:1703.04826, 2017.
248
+ F. Monti, D. Boscaini, J. Masci, E. Rodola, J. Svoboda, and M. M. Bronstein. Geometric deep \` learning on graphs and manifolds using mixture model CNNs. In Proc. CVPR, 2017a.
249
+ F. Monti, M.M. Bronstein, and X. Bresson. Geometric Matrix Completion with Recurrent MultiGraph Neural Networks. Advances in Neural Information Processing Systems (NIPS), 2017b.
250
+ N. Peng, H. Poon, C. Quirk, K. Toutanova, and W.T. Yih. Cross-Sentence N-ary Relation Extraction with Graph LSTMs. Transactions of the Association for Computational Linguistics, 5:101–115, 2017.
251
+ F. Scarselli, M. Gori, A. Tsoi, M. Hagenbuchner, and G. Monfardini. The Graph Neural Network Model. IEEE Transactions on Neural Networks, 20(1):61–80, 2009.
252
+ S. Sukhbaatar, A Szlam, and R. Fergus. Learning Multiagent Communication with Backpropagation. Advances in Neural Information Processing Systems (NIPS), pp. 2244–2252, 2016.
253
+ K. Tai, R. Socher, and C. Manning. Improved Semantic Representations from Tree-Structured Long Short-Term Memory Networks. Association for Computational Linguistics (ACL), pp. 1556– 1566, 2015.
254
+ van den Oord, N. Kalchbrenner, L. Espeholt, O. Vinyals, A. Graves, and K. Kavukcuoglu. Conditional Image Generation with PixelCNN Decoders. In Advances in Neural Information Processing Systems (NIPS), pp. 4790–4798, 2016.
md/train/IkYEJ5Cps5H/IkYEJ5Cps5H.md ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SUCCINCT NETWORK CHANNEL AND SPATIAL PRUNING VIA DISCRETE VARIABLE QCQP
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Reducing the heavy computational cost of large convolutional neural networks is crucial when deploying the networks to resource-constrained environments. In this context, recent works propose channel pruning via greedy channel selection to achieve practical acceleration and memory footprint reduction. We first show this channel-wise approach ignores the inherent quadratic coupling between channels in the neighboring layers and cannot safely remove inactive weights during the pruning procedure. Furthermore, we show that these pruning methods cannot guarantee the given resource constraints are satisfied and cause discrepancy with the true objective. To this end, we formulate a principled optimization framework with discrete variable QCQP, which provably prevents any inactive weights and enables the exact guarantee of meeting the resource constraints in terms of FLOPs and memory. Also, we extend the pruning granularity beyond channels and jointly prune individual 2D convolution filters spatially for greater efficiency. Our experiments show competitive pruning results under the target resource constraints on CIFAR-10 and ImageNet datasets on various network architectures.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep neural networks are the bedrock of artificial intelligence tasks such as object detection, speech recognition, and natural language processing (Redmon & Farhadi, 2018; Chorowski et al., 2015; Devlin et al., 2019). While modern networks have hundreds of millions to billions of parameters to train, it has been recently shown that these parameters are highly redundant and can be pruned without significant loss in accuracy (Han et al., 2015; Guo et al., 2016). This discovery has led practitioners to desire training and running the models on resource-constrained mobile devices, provoking a large body of research on network pruning.
12
+
13
+ Unstructured pruning, however, does not directly lead to any practical acceleration or memory footprint reduction due to poor data locality (Wen et al., 2016), and this motivated research on structured pruning to achieve practical usage under limited resource budgets. To this end, a line of research on channel pruning considers completely pruning the convolution filters along the input and output channel dimensions, where the resulting pruned model becomes a smaller dense network suited for practical acceleration and memory footprint reduction (Li et al., 2017; Luo et al., 2017; He et al., 2019; Wen et al., 2016; He et al., 2018a).
14
+
15
+ However, existing channel pruning methods perform the pruning operations with a greedy approach and does not consider the inherent quadratic coupling between channels in the neighboring layers. Although these methods are easy to model and optimize, they cannot safely remove inactive weights during the pruning procedure, suffer from discrepancies with the true objective, and prohibit the strict satisfaction of the required resource constraints during the pruning process.
16
+
17
+ The ability to specify hard target resource constraints into the pruning optimization process is important since this allows the user to run the pruning and optional finetuning process only once. When the pruning process ignores the target specifications, the users may need to apply multiple rounds of pruning and finetuning until the specifications are eventually met, resulting in an extra computation overhead (Han et al., 2015; He et al., 2018a; Liu et al., 2017).
18
+
19
+ In this paper, we formulate a principled optimization problem that prunes the network layer channels while respecting the quadratic coupling and exactly satisfying the user-specified FLOPs and memory constraints. This new formulation leads to an interesting discrete variable QCQP (Quadratic Constrained Quadratic Program) optimization problem, which directly maximizes the importance of neurons in the pruned network under the specified resource constraints. Also, we increase the pruning granularity beyond channels and jointly prune individual 2D convolution filters spatially for greater efficiency. Furthermore, we generalize our formulation to cover nonsequential convolution operations, such as skip connections, and propose a principled optimization framework for handling various architectural implementations of skip connections in ResNet (He et al., 2016). Our experiments on CIFAR-10 and ImageNet datasets show the state of the art results compared to other channel pruning methods that start from pretrained networks.
20
+
21
+ ![](images/30607c2e56d734ec141791edf273f5b524a27effd00ad6c64c08ad72be07d27d.jpg)
22
+ Figure 1: Illustration of a channel pruning procedure that leads to inactive weights. When $j$ -th output channel of $l$ -th convolution weights $W _ { \cdot , j } ^ { ( \bar { l } ) }$ is pruned, i.e. $W _ { \cdot , j } ^ { ( l ) } = 0 _ { C _ { l - 1 } , K _ { l } , K _ { l } }$ , then the $j$ -th feature map of l-th layer X (l)j should also be 0. Consequently, $X _ { j } ^ { ( l ) }$ yields inactive weights $W _ { j } ^ { ( l + 1 ) }$ . Note that we use W (l)·,j to denote the tensor $W _ { \cdot , j , \cdot , \cdot } ^ { ( l ) } .$ , following the indexing rules of NumPy (Van Der Walt et al., 2011).
23
+
24
+ # 2 MOTIVATION
25
+
26
+ In this section, we first discuss the motivation of our method concretely. Suppose the weights in a sequential CNN form a sequence of 4-D tensors, $W ^ { ( l ) } \in \mathbb { R } ^ { C _ { l - 1 } \times C _ { l } \times K _ { l } \times K _ { l } } \forall \bar { l } \in [ L ]$ where $C _ { l - 1 } , C _ { l }$ , and $K _ { l }$ represent the number of input channels, the number of output channels, and the filter size of $l$ -th convolution weight tensor, respectively. We denote the feature map after $l$ -th convolution as $X ^ { ( l ) } \in \mathbb { R } ^ { C _ { l } \times H _ { l } \times W _ { l } }$ . Con, ncretely, denotes $X _ { j } ^ { ( \bar { l } ) } = \sigma ( X _ { \cdot } ^ { ( l - 1 ) } \odot W _ { \cdot , j } ^ { ( l ) } ) = \sigma ( \sum _ { i = 1 } ^ { C _ { l - 1 } } \bar { X } _ { i \ \cdot } ^ { ( l - 1 ) } * W _ { i , j } ^ { ( l ) } )$ , where hannel- $\sigma$ isse $^ *$ $\odot$
27
+ 2-D convolutions. Now consider pruning these weights in channel-wise direction. We show that naive channel-wise pruning methods prevent exact specification of the target resource constraints due to unpruned inactive weights and deviate away from the true objective by ignoring quadratic coupling between channels in the neighboring layers.
28
+
29
+ # 2.1 INACTIVE WEIGHTS
30
+
31
+ According to Han et al. (2015), network pruning produces dead neurons with zero input or output connections. These dead neurons cause inactive weights1, which do not affect the final output activations of the pruned network. These inactive weights may not be excluded automatically through the standard pruning procedure and require additional post-processing which relies on ad-hoc heuristics. For example, Figure 1 shows a standard channel pruning procedure that deletes weights across the output channel direction but fails to prune the inactive weights. Concretely, deletion of j el of l-th convolution layer leads to W (l)·,j weights on becomes a -th output channead neuron since $W _ { \cdot , j } ^ { ( l ) } = 0 _ { C _ { l - 1 } , K _ { l } , K _ { l } }$ $X _ { j } ^ { ( l ) }$ $\begin{array} { r } { \boldsymbol { X } _ { j } ^ { ( l ) } = \sigma ( \boldsymbol { X } ^ { ( l - 1 ) } \odot \boldsymbol { W } _ { \cdot , j } ^ { ( l ) } ) = \sigma ( \sum _ { i = 1 } ^ { { C } _ { l - 1 } } \boldsymbol { X } _ { i } ^ { ( l - 1 ) } * \boldsymbol { W } _ { i , j } ^ { ( l ) } ) = \boldsymbol { 0 } _ { C _ { l } , H _ { l } , W _ { l } } . } \end{array}$
32
+
33
+ The convolution operation on the dead neuron results in a trivially zero output, as below:
34
+
35
+ $$
36
+ X _ { p } ^ { ( l + 1 ) } = \sigma \left( \sum _ { i = 1 } ^ { C _ { l } } X _ { i } ^ { ( l ) } * W _ { i , p } ^ { ( l + 1 ) } \right) = \sigma \left( \sum _ { i = 1 } ^ { C _ { l } } \mathbb { 1 } _ { i \neq j } X _ { i } ^ { ( l ) } * W _ { i , p } ^ { ( l + 1 ) } + \underbrace { X _ { j } ^ { ( l ) } * \underbrace { W _ { j , p } ^ { ( l + 1 ) } } _ { \mathrm { d e a d } } } _ { = \mathbb { 0 } _ { H _ { l + 1 } , W _ { l + 1 } } } \right) .
37
+ $$
38
+
39
+ Equation (1) shows that the dead neuron X(l)j causes weights W (l+1)j,p , $W _ { j , p } ^ { ( l + 1 ) } , \forall p \in [ C _ { l + 1 } ]$ to be inactive. Such inactive weights do not account for the actual resource usage, even when they remain in the pruned network, which prevents the exact modeling of the user-specified hard resource constraints (FLOPs and network size). Furthermore, inactive weights unpruned during the pruning procedure are a bigger problem for nonsequential convolutional networks due to their skip connections. To address this problem, we introduce a quadratic optimization-based algorithm that provably eliminates all the inactive weights during the pruning procedure.
40
+
41
+ # 2.2 QUADRATIC COUPLING
42
+
43
+ ![](images/1a7cf02ee11375b60d23ae20a288b50d1f0a3933ed1213db30253f98b7026be9.jpg)
44
+ Figure 2: A comparison of the greedy channel pruning method and our pruning method. Parallelograms represent feature maps and squares represent 2-D filters of convolution weights. Gray squares are filters which account for the objective. The numbers on each squares represent the absolute sum of weights in the filter.
45
+
46
+ Existing channel pruning methods remove channels according to their importance. However, measuring a channel’s contribution to the network should also take into account the channels in the neighboring layers, as illustrated in Figure 2. In the example, we define the importance of a channel as the absolute sum of weights in the channel, as in Li et al. (2017), and assume the objective is to maximize the absolute sum of weights in the whole pruned network, excluding the inactive weights. We compare two different channel pruning methods: (a) a standard channel pruning method that greedily prunes each channel independently, and (b) our pruning method that considers the effect of the channels in neighboring layers when pruning. As a result of running each pruning algorithms, (a) will prune the second output channel of the first convolution and the third output channel of the second convolution, and (b) will prune the first output channel of the first convolution, the third output channel of the second convolution, and the first input channel of the second convolution. The objective values for each pruned networks are (a) 18 and (b) 21, respectively.
47
+
48
+ This shows that the coupling effect of the channels in neighboring layers directly affects the objective values, and finally results in a performance gap between (a) and (b). We call this coupling relationship as the quadratic coupling between the neighboring layers and formulate the contributions to the objective by quadratic terms of neighboring channel activations. To address this quadratic coupling, we propose a channel pruning method based on the QCQP framework with importance evaluation respecting both the input and the output channels.
49
+
50
+ # 3 METHOD
51
+
52
+ In this section, we first propose our discrete QCQP formulation of channel pruning for the sequential convolutional neural networks (CNNs). Then, we present an extended version of our formulation for joint channel and shape pruning of 2D convolution filters. The generalization to the nonsequential convolution (skip addition and skip concatenation) is introduced in Supplementary material A.
53
+
54
+ To capture the importance of weights in $W ^ { ( l ) }$ , we define the importance tensor as $I ^ { ( l ) } \in \Sigma ^ { }$ $\mathbb { R } _ { + } ^ { C _ { l - 1 } \times C _ { l } \times K _ { l } \times K _ { l } }$ . Following the protocol of Han et al. (2015); Guo et al. (2016), we set $I ^ { ( i ) } = \gamma _ { l } | W ^ { ( l ) } |$ where $\gamma _ { l }$ is the $\ell _ { 2 }$ normalizing factor in $l$ -th layer or $\lVert \mathrm { v e c } ( W ^ { ( l ) } ) \rVert ^ { - 1 }$ . Then, we define the binary pruning mask as $A ^ { ( l ) } \in \{ 0 , 1 \} ^ { C _ { l - 1 } \times C _ { l } \times K _ { l } \times K _ { l } }$ . For channel pruning in sequential CNNs, we define channel activation $r ^ { ( l ) } \in \{ 0 , 1 \} ^ { C _ { l } }$ to indicate which indices of channels remain in the $l$ -th layer of the pruned network. Then, the weights in $W _ { i , j } ^ { ( l ) }$ are active if and only if $r _ { i } ^ { ( l - 1 ) } r _ { j } ^ { ( l ) } = 1$ , which leads to A(l)i,j $A _ { i , j } ^ { ( l ) } = r _ { i } ^ { ( l - 1 ) } r _ { j } ^ { ( l ) } J _ { K _ { l } }$ . For example, in Figure 2b, $\boldsymbol { r } ^ { ( l - 1 ) } = [ 1 , 1 , 1 ] ^ { \intercal }$ , $r ^ { ( l ) } = [ 0 , 1 ] ^ { \intercal }$ and $\boldsymbol { r } ^ { ( l + 1 ) } = [ 1 , 1 , 0 ] ^ { \intercal }$ , therefore, $A ^ { ( l ) } = \binom { 0 } { 0 } 1 \Biggr ] \otimes J _ { K _ { l } }$ and $A ^ { ( l + 1 ) } = { \binom { 0 } { 1 } } ^ { 0 } \quad 0 \quad 0 ] \otimes J _ { K _ { l + 1 } } .$
55
+
56
+ We wish to directly maximize the sum of the importance of active weights after the pruning procedure under given resource constraints $: 1$ ) FLOPs, 2) memory, and 3) network size. Concretely, our optimization problem is 2
57
+
58
+ $$
59
+ \begin{array} { l } { \displaystyle \operatorname* { m a x i m i z e } _ { r ^ { ( 0 : L ) } } \ \sum _ { l = 1 } ^ { L } \left. I ^ { ( l ) } , A ^ { ( l ) } \right. } \\ { \mathrm { s u b j e c t \ t o } \ \displaystyle \sum _ { l = 0 } ^ { L } a _ { l } \left\| r ^ { ( l ) } \right\| _ { 1 } + \displaystyle \sum _ { l = 1 } ^ { L } b _ { l } \left\| A ^ { ( l ) } \right\| _ { 1 } \leq M } \\ { \displaystyle A ^ { ( l ) } = r ^ { ( l - 1 ) } r ^ { ( l ) \top } \otimes J _ { K _ { l } } \quad \forall l \in [ L ] } \\ { \displaystyle r ^ { ( l ) } \in \{ 0 , 1 \} ^ { C _ { l } } . } \end{array}
60
+ $$
61
+
62
+ In our formulation, the actual resource usage of the pruned network is exactly computed by specifying the number of channels in the pruned network $( = \bar { \Vert _ { r } ( l ) _ { \Vert _ { 1 } } } )$ and the pruning mask sparsity $\dot { ( } = \| A ^ { ( \dot { l } ) } \| _ { 1 } \dot { ) }$ in each layer. Concretely, the left hand side of the inequality in the first constraint in Equation (2) indicates the actual resource usage. Table 1 shows $a _ { l } , b _ { l }$ terms used for computing usage of each resource. Note that this optimization problem is a discrete nonconvex QCQP of the channel activations $[ r ^ { ( 0 ) } , \dots , r ^ { ( L ) } ]$ , where the objective, which is the same with the objective in Section 2.2, respects the quadratic coupling of channel activations $( = r ^ { ( l ) } )$ . Please refer to Supplementary material E for the details on the standard QCQP form of Equation (2).
63
+
64
+ # 3.2 FORMULATION OF JOINT CHANNEL AND SPATIAL PRUNING
65
+
66
+ For further efficiency, we increase the pruning granularity to additionally perform spatial pruning in 2-D convolution filters. Concretely, we prune by each weight vector across the input channel direction instead of each channel to perform channel and spatial pruning processes simultaneously.
67
+
68
+ <table><tr><td>Resource constraint (M)</td><td>a</td><td>b</td></tr><tr><td>Network size</td><td>0</td><td>1</td></tr><tr><td>Memory</td><td>HW</td><td>1</td></tr><tr><td>FLOPs</td><td>0</td><td>HWt</td></tr></table>
69
+
70
+ First, we define the shape column W (l)·,j,a by
71
+
72
+ Table 1: Resource constraints and the corresponding $a _ { l } , b _ { l }$ values.
73
+
74
+ the vector of weights at spatial position $( a , b )$ of a 2-D convolution filter along the $j$ -th output channel dimension. Then, we define shape column activation $q ^ { ( l ) } \in \{ 0 , 1 \} ^ { C _ { l } \times K _ { l } \times K _ { l } }$ to indicate which shape columns in the $l$ -th convolution layer remain in the pruned network. Figure 3 shows the illustration of each variables.
75
+
76
+ Note that this definition induces constraints on the channel activation variables. In detail, the $j$ -th output channel activation in $l$ -th layer is set if and only if at least one shape column activation in the $j$ -th output channel is set. Concretely, the new formulation should include the constraints $\begin{array} { r } { r _ { j } ^ { ( l ) } \le \sum _ { a , b } q _ { j , a , b } ^ { ( l ) } } \end{array}$ and $q _ { j , a , b } ^ { ( l ) } \leq r _ { j } ^ { ( l ) } \forall a , b$ .
77
+
78
+ ![](images/3aa112f2df91bd35c67a87050d367e0bb2b1dbaa345bc04d75a26c81aa7782b6.jpg)
79
+ Figure 3: Input channel activation $\left( = r ^ { ( l - 1 ) } \right)$ , shape column activation $\left( = q ^ { \left( l \right) } \right)$ , and the corresponding mask $\left( = A ^ { ( l ) } \right)$ for $l$ -th convolution layer, where $A ^ { ( l ) } = r ^ { ( l - 1 ) } \otimes q ^ { ( l ) }$ .
80
+
81
+ We now reformulate the optimization problem to include the shape column activation variables. Again, we aim to maximize the sum of the importance of active weights after pruning under the given resource constraints. Then, our optimization problem for simultaneous channel and spatial pruning is
82
+
83
+ $$
84
+ \begin{array} { l } { \displaystyle \underset { r ^ { ( s , L ) } , q ^ { ( 1 ; L ) } } { \mathrm { m a x i m i z e } } \ ~ \sum _ { l = 1 } ^ { L } \left. I ^ { ( l ) } , A ^ { ( l ) } \right. } \\ { \mathrm { s u b j e c t ~ t o } \ \displaystyle \sum _ { l = 0 } ^ { L } a _ { l } \left\| r ^ { ( l ) } \right\| _ { 1 } + \displaystyle \sum _ { l = 1 } ^ { L } b _ { l } \left\| A ^ { ( l ) } \right\| _ { 1 } \leq M } \\ { \displaystyle r _ { j } ^ { ( l ) } \leq \sum _ { a , b } q _ { j , a , b } ^ { ( l ) } \quad \mathrm { a n d } \quad q _ { j , a , b } ^ { ( l ) } \leq r _ { j } ^ { ( l ) } \quad \forall l , j , a , b } \\ { \displaystyle A ^ { ( l ) } = r ^ { ( l - 1 ) } \otimes q ^ { ( l ) } \quad \forall l } \\ { \displaystyle r ^ { ( l ) } \in \{ 0 , 1 \} ^ { C } \ a \mathrm { n d } \ q ^ { ( l ) } \in \{ 0 , 1 \} ^ { C } \times K _ { l } \times K _ { l } \quad \forall l \in [ L ] . } \end{array}
85
+ $$
86
+
87
+ We note that this optimization problem is also a discrete nonconvex QCQP. The details on the standard QCQP form of Equation (3) is provided in Supplementary material E. Furthermore, Proposition 1 below shows that the constraints in Equation (2) and Equation (3) provably eliminate any unpruned inactive weights and accurately model the resource usage as well as the objective of the pruned network. Also, Proposition 1 can be generalized to nonsequential networks with skip addition. The generalization and the proofs are given in Supplementary material D.
88
+
89
+ Proposition 1. Optimizing over the input and output channel activation variables ${ r ^ { ( 0 : L ) } }$ and shape column activation variables $q ^ { ( 1 : L ) }$ under the constraints in Equation (3) provably removes any inactive weights in the pruned network, guaranteeing exact computation of 1) resource usage and 2) the sum of the importance of active weights in the pruned network.
90
+
91
+ # 3.3 OPTIMIZATION
92
+
93
+ Concretely, Equation (2) and Equation (3) fall into the category of binary Mixed Integer Quadratic Constraint Quadratic Programming (MIQCQP). We solve these discrete QCQP problems with the CPLEX library (INC, 1993), which provides MIQCQP solvers based on the branch and cut technique. However, the branch and cut algorithm can lead to exponential search time (Mitchell, 2002) on large problems. Therefore, we provide a practical alternative utilizing a block coordinate descent style optimization method in Supplementary material B.
94
+
95
+ # 4 RELATED WORKS
96
+
97
+ Importance of channels Most of the channel pruning methods prune away the least important channels with a simple greedy approach, and the evaluation method for the importance of channels has been the main research problem (Molchanov et al., 2017; 2019; Liu et al., 2019). Channel pruning is divided into two major branches according to the method of evaluating the importance of channels: the trainable-importance method, which evaluates the importance of channels while training the whole network from scratch, and the fixed-importance method, which directly evaluates the importance of channels on the pretrained network. Trainable-importance channel pruning methods include the regularizer-based methods with group sparsity regularizers (Wen et al., 2016; Alvarez & Salzmann, 2016; Yang et al., 2019; Liu et al., 2017; Louizos et al., 2018; Liu et al., 2017; Gordon et al., 2018) and data-driven channel pruning methods (Kang & Han, 2020; You et al., 2019). Fixedimportance channel pruning methods first prune away most of the weights and then finetune the significantly smaller pruned network (Molchanov et al., 2017; 2019; Hu et al., 2016; He et al., 2018a; Li et al., 2017; He et al., 2019; Luo et al., 2017). As a result, fixed-importance methods are much more efficient than the trainable-importance channel pruning methods in terms of computational cost and memory as trainable-importance methods have to train the whole unpruned network. Our framework is on the line of fixed-importance channel pruning works.
98
+
99
+ Predefined target structure and Automatic target structure Layer-wise channel pruning methods (Li et al., 2017; He et al., 2019), which perform pruning operations per each layer independently, require users to predefine the target pruned structure. Also, LCCL(Dong et al., 2017) exploits a predefined low-cost network to improve inference time. Another line of research finds the appropriate target structure automatically (He et al., 2018b; Yang et al., 2018; Liu et al., 2019; Molchanov et al., 2017). Our method also finds the target structure automatically under the explicit target resource constraints.
100
+
101
+ Dynamic pruning and static pruning Dynamic pruning has a different network structure depending on the input during inference time, while static pruning has a fixed network structure during inference time. CGNet (Hua et al., 2019) dynamically identifies unnecessary features to reduce the computation, and FBS (Gao et al., 2019) dynamically skip computations on the unimportant channels. Our framework is static pruning and has a fixed network structure during inference time.
102
+
103
+ Quadratic coupling CCP (Peng et al., 2019) formulates a QP (quadratic formulation) to consider the quadratic coupling between channels in the same layer under layer-wise constraints on the maximum number of channels. On the other hand, our formulation considers the quadratic coupling between channels in the neighboring layers under the target resource constraints.
104
+
105
+ Channel pruning in nonsequential blocks Many network architectures contain nonsequential convolution operations, such as skip addition (He et al., 2016; Sandler et al., 2018; Tan & Le, 2019) and skip concatenation (Huang et al., 2017). Since these network architectures outperform sequential network architectures, pruning a network with nonsequential convolution operations is crucial. However, most channel pruning methods (Liu et al., 2017; He et al., 2018a; 2019; Molchanov et al., 2017; 2019) do not consider the nonsequential convolution operations and use the same method from the sequential network architecture. However, channel pruning methods ignorant of nonsequential convolution operations may result in the misalignment of feature maps connected by skip connections (You et al., 2019). GBN (You et al., 2019) forces parameters connected by a nonsequential convolution operation to share the same pruning pattern to solve this misalignment problem. In contrast, our formulation does not require strict pattern sharing. This flexibility allows for our methods to delete more channels under given constraints.
106
+
107
+ Spatial pruning of convolution filters Spatial pruning methods aim to prune convolution filters along the channel dimension for inference efficiency. Spatial pruning methods manually define the spatial patterns of filters (Lebedev & Lempitsky, 2016; Anwar et al., 2017) or optimize spatial patterns of filters with group sparse regularizers (Wen et al., 2016; Lebedev & Lempitsky, 2016). Among these works, Lebedev & Lempitsky (2016) empirically demonstrates that enforcing sparse spatial patterns in 2-D filters along the input channel leads to great speed-up during inference time using group sparse convolution operations (Chellapilla et al., 2006). Our proposed method enforces the spatial patterns in 2-D filters as in Lebedev & Lempitsky (2016) for speed-up in inference.
108
+
109
+ # 5 EXPERIMENTS
110
+
111
+ We compare the classification accuracy of the pruned network against several pruning baselines on CIFAR-10 (Krizhevsky et al., 2009) and ImageNet (Russakovsky et al., 2015) datasets using various ResNet architectures (He et al., 2016), DenseNet-40 (Huang et al., 2017), and VGG-16 (Simonyan & Zisserman, 2015). Note that most pruning baselines apply an iterative pruning procedure, which repeatedly alternates between network pruning and finetuning until the target resource constraints are satisfied (Han et al., 2015; He et al., 2018a; Liu et al., 2017; Yang et al., 2018). In contrast, since our methods explicitly include the target resource constraint to the optimization framework, we only need one round of pruning and finetuning.
112
+
113
+ # 5.1 EXPERIMENTAL SETTINGS
114
+
115
+ We follow the ‘smaller-norm-less-important’ criterion (Ye et al., 2018; Liu et al., 2017), which evaluates the importance of weights as the absolute value of weight (Han et al., 2015; Guo et al., 2016). We assume the network size and FLOPs reduction are linearly proportional to the sparsity in shape column activations, as empirically shown in Lebedev & Lempitsky (2016). Also, we ignore the extra memory overhead for storing the shape column activations due to its negligible size compared to the total network size. In the experiment tables, FLOPs and the network size of the pruned network are computed according to the resource specifications in Equations (2) and (3). Also, ‘Pruning ratio’ in the tables denotes the ratio of pruned weights among the total weights in baseline networks. ‘ours-c’ and ‘ours-cs’ in the tables denote our method with channel pruning and our method with both the channel and spatial pruning, respectively.
116
+
117
+ Table 2: Pruned accuracy and accuracy drop from the baseline network at given FLOPs (left) and pruning ratios (right) on various network architectures (ResNet-20,32,56 and DenseNet-40) at CIFAR-10.
118
+
119
+ <table><tr><td rowspan="2"></td><td rowspan="2">Method</td><td rowspan="2">Baseline acc</td><td colspan="3">FLOPs</td></tr><tr><td>Pruned acc↑</td><td>Acc drop↓</td><td>FLOPs(%)↓</td></tr><tr><td rowspan="9">ResNet-20</td><td>FPGM (He et al.,2019)</td><td>92.21 (0.18)</td><td>91.26 (0.24)</td><td>0.95</td><td>46.0</td></tr><tr><td>ours-c</td><td>92.21 (0.18)</td><td>90.96 (0.15)</td><td>1.25</td><td>46.0</td></tr><tr><td>ours-cs</td><td>92.21 (0.18)</td><td>91.70 (0.18)</td><td>0.51</td><td>46.0</td></tr><tr><td>LCCL (Dong et al.,2017)</td><td>92.74</td><td>91.68</td><td>1.06</td><td>62.1</td></tr><tr><td>SFP (He et al.,2018a)</td><td>92.20 (0.18)</td><td>90.83 (0.31)</td><td>1.37</td><td>57.8</td></tr><tr><td>FPGM (He et al.,2019)</td><td>92.21 (0.18)</td><td>91.72 (0.20)</td><td>0.49</td><td>57.8</td></tr><tr><td>ours-c</td><td>92.21 (0.18)</td><td>91.74 (0.20)</td><td>0.47</td><td>58.3</td></tr><tr><td>ours-cs</td><td>92.21 (0.18)</td><td>92.26 (0.10)</td><td>-0.05</td><td>57.8</td></tr><tr><td>FPGM(He et al.,2019)</td><td>92.88 (0.86)</td><td>91.96 (0.76)</td><td>0.92</td><td>46.8</td></tr><tr><td rowspan="9">ResNet-32</td><td>ours-c</td><td>92.88 (0.86)</td><td>91.98 (0.42)</td><td>0.90</td><td>46.8</td></tr><tr><td>ours-cs</td><td>92.88 (0.86)</td><td>92.33 (0.41)</td><td>0.55</td><td>47.0</td></tr><tr><td>LCCL (Dong et al.,2017)</td><td>92.33</td><td>90.74</td><td>1.59</td><td>69.0</td></tr><tr><td>SFP (He et al.,2018a)</td><td>92.63 (0.70)</td><td>92.08 (0.08)</td><td>0.55</td><td>58.5</td></tr><tr><td>FPGM (He et al.,2019)</td><td>92.88 (0.86)</td><td>92.51 (0.90)</td><td>0.37</td><td>58.5</td></tr><tr><td>ours-c</td><td>92.88 (0.86)</td><td>92.52 (0.46)</td><td>0.36</td><td>57.2</td></tr><tr><td>ours-cs</td><td>92.88 (0.86)</td><td>92.80 (0.61)</td><td>0.08</td><td>57.9</td></tr><tr><td>SFP (He et al.,2018a)</td><td>93.59 (0.58)</td><td>92.26 (0.31)</td><td>1.33</td><td>47.5</td></tr><tr><td>FPGM (He et al.,2019)</td><td>93.59 (0.58)</td><td>93.49 (0.13)</td><td>0.10</td><td>47.5</td></tr><tr><td rowspan="8"></td><td></td><td>93.50</td><td>93.42</td><td>0.08</td><td>47.4</td></tr><tr><td>CCP (Peng et al.,2019)</td><td>92.8</td><td>91.9</td><td></td><td></td></tr><tr><td>AMC (He et al.,2018b)</td><td></td><td></td><td>0.9</td><td>50.0</td></tr><tr><td>SCP(Kang &amp; Han,2020)</td><td>93.69</td><td>93.23</td><td>0.46</td><td>48.5</td></tr><tr><td>ours-c</td><td>93.59 (0.58)</td><td>93.36 (0.68)</td><td>0.23</td><td>47.4</td></tr><tr><td>ours-cs</td><td>93.59 (0.58)</td><td>93.59 (0.36)</td><td>0.00</td><td>47.4</td></tr><tr><td>SCP(Kang&amp; Han,2020)</td><td>94.39</td><td>93.77</td><td>0.62</td><td>29.2</td></tr><tr><td>ours-c</td><td>95.01</td><td>93.80</td><td>1.21</td><td>29.2</td></tr><tr><td rowspan="8"></td><td>ours-cs</td><td>95.01</td><td>94.25</td><td>0.76</td><td>29.2</td></tr><tr><td>slimming (Liu et al.,2017)</td><td>93.89</td><td>94.35</td><td>-0.46</td><td>45.0</td></tr><tr><td>ours-c</td><td>95.01</td><td>94.38</td><td>0.63</td><td>45.0</td></tr><tr><td>ours-cs</td><td>95.01</td><td>94.85</td><td>0.16</td><td>45.0</td></tr><tr><td>slimming (Liu et al.,2017)</td><td>93.89</td><td>94.81</td><td>-0.92</td><td>71.6</td></tr><tr><td>ours-c</td><td></td><td>94.82</td><td>0.19</td><td>71.0</td></tr><tr><td></td><td>95.01</td><td></td><td></td><td></td></tr><tr><td>ours-cs</td><td>95.01</td><td>95.02</td><td>-0.01</td><td>71.0</td></tr></table>
120
+
121
+ <table><tr><td colspan="3">Network size</td></tr><tr><td>Pruned acc↑</td><td>Acc drop↓</td><td>Pruning ratio(%)↑</td></tr><tr><td>91.26 (0.24)</td><td>0.95</td><td>54.0</td></tr><tr><td>91.26 (0.18)</td><td>0.95</td><td>54.1</td></tr><tr><td>92.02 (0.10)</td><td>0.19</td><td>54.0</td></tr><tr><td>91.68</td><td>1.06</td><td>33.1</td></tr><tr><td>90.83 (0.31)</td><td>1.37</td><td>42.2</td></tr><tr><td>91.72 (0.20)</td><td>0.49</td><td>42.2</td></tr><tr><td>92.27 (0.17).</td><td>-0.06</td><td>42.3</td></tr><tr><td>92.35 (0.10)</td><td>-0.14</td><td>42.2</td></tr><tr><td>91.96 (0.76)</td><td>0.92</td><td>53.2</td></tr><tr><td>92.22 (1.02)</td><td>0.66</td><td>53.2</td></tr><tr><td>92.78 (0.97)</td><td>0.10</td><td>53.2</td></tr><tr><td>90.74</td><td>1.59</td><td>37.5</td></tr><tr><td>92.08 (0.08)</td><td>0.55</td><td>41.5</td></tr><tr><td>92.51 (0.90)</td><td>0.37</td><td>41.5</td></tr><tr><td>92.42 (0.77)</td><td>0.46</td><td>42.7</td></tr><tr><td>92.83 (0.83)</td><td>0.05</td><td>42.7</td></tr><tr><td>92.26 (0.31)</td><td>1.33</td><td>52.6</td></tr><tr><td>93.49 (0.13)</td><td>0.10</td><td>52.6</td></tr><tr><td>=</td><td>-</td><td>-</td></tr><tr><td></td><td>=</td><td>=</td></tr><tr><td>93.23</td><td>0.46</td><td>51.5</td></tr><tr><td>93.37 (0.96)</td><td>0.22</td><td>52.7</td></tr><tr><td>93.69 (0.69)</td><td>-0.10</td><td>52.6</td></tr><tr><td></td><td></td><td>-</td></tr><tr><td></td><td></td><td>=</td></tr><tr><td></td><td>=</td><td>=</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></table>
122
+
123
+ # 5.2 CIFAR-10
124
+
125
+ CIFAR-10 dataset has 10 different classes with $5 k$ training images and $1 k$ test images per each class Krizhevsky et al. (2009). In CIFAR-10 experiments, we evaluate our methods on various network architectures: ResNet-20, 32, 56, and DenseNet-40. We provide implementation of the details for the experiments in Supplementary material C. We show the experiment results of pruning under FLOPs constraints in the left column of Table 2 and under final network size constraints in the right column of Table 2.
126
+
127
+ On the FLOPs experiments in the left column of Table 2, ‘ours-c’ shows comparable results against FPGM, which is the previous state of the art method, on ResNet-20, 32, and 56. Moreover, ‘ours-cs’ significantly outperforms both ‘ours-c’ and FPGM on the same architectures showing the state of the art performance. Also, ‘ours-c’ shows comparable results against slimming (Liu et al., 2017) and SCP (Kang & Han, 2020), while ‘ours-cs’ outperforms existing baselines by a large margin on DenseNet-40.
128
+
129
+ On the network size experiments in the right column of Table 2, ‘ours-c’ shows results competitive to FPGM and SCP, while ‘ours-cs’ again achieves the state of the art performance on ResNet-20, 32, and 56. Notably, in ResNet-56, ‘ours-cs’ achieves a minimal accuracy drop of $- 0 . 1 0$ with the pruning ratio of $5 2 . 6 \%$ . These results show simultaneous channel and spatial pruning produces more efficient networks with better performance compared to other channel pruning methods on CIFAR-10.
130
+
131
+ # 5.3 IMAGENET
132
+
133
+ ILSVRC-2012 (Russakovsky et al., 2015) is a large-scale dataset with 1000 classes that comes with $1 . 2 8 M$ training images and $5 0 k$ validation images. We conduct our methods under the fixed FLOPs constraint on ResNet-18,50, and VGG-16. For more implementation details of the ImageNet experiments, refer to Supplementary material C. Table 3 shows the experiment results on ImageNet. In ResNet-50, ‘ours- $. \mathrm { c } '$ ’ and ‘ours-cs’ achieve results comparable to GBN, a trainable-importance channel pruning method which is the previous state of the art, even though our method is a fixedimportance channel pruning method. In particular, top1 pruned accuracy in ‘ours-cs’ exceeds SFP by $1 . 3 2 \%$ using a similar number of FLOPs. Both ‘ours-cs’ and ‘ours-c’ clearly outperform FPGM in ResNet-50. Also, ‘ours- $\cdot \mathrm { c } '$ and ‘ours-cs’ show significantly better performance than Molchanov et al. (2017) on VGG-16.
134
+
135
+ Table 3: Top1,5 pruned accuracy and accuracy drop from the baseline network at given FLOPs on various network architectures (ResNet-18,50, and VGG-16) at ImageNet.
136
+
137
+ <table><tr><td>Network</td><td>Method</td><td>Top1 Pruned Acc↑</td><td>Topl Acc drop↓</td><td>Top5 Pruned Acc↑</td><td>Top5 Acc drop↓</td><td>FLOPs(%)↓</td></tr><tr><td rowspan="6">ResNet-18</td><td rowspan="6">SFP (He et al.,2018a) FPGM (He et al.,2019) ours-c</td><td>67.10</td><td>3.18</td><td>87.78</td><td>1.85</td><td>58.2</td></tr><tr><td>68.41</td><td>1.87</td><td>88.48</td><td>1.15</td><td>58.2</td></tr><tr><td>67.48</td><td>2.28</td><td>87.78</td><td>1.30</td><td>60.9</td></tr><tr><td>69.59</td><td>0.17</td><td>88.94</td><td>0.14</td><td>58.2</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LCCL (Dong et al.,2017) 66.33 68.65</td><td>3.65 1.11</td><td>86.94 88.69</td><td>2.29 0.39</td><td>65.3 65.9</td></tr><tr><td rowspan="6">ResNet-50</td><td rowspan="6">ours-cs SFP (He et al.,2018a) FPGM (He et al.,2019)</td><td>70.05</td><td>-0.29</td><td>89.24</td><td>-0.16</td><td>65.9</td></tr><tr><td>74.61</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>1.54</td><td>92.06</td><td>0.81</td><td>58.3</td></tr><tr><td>75.50</td><td>0.65</td><td>92.63</td><td>0.21</td><td>57.8</td></tr><tr><td>75.78</td><td>0.37</td><td>91.86</td><td>1.01</td><td>57.8</td></tr><tr><td>75.93</td><td>0.22</td><td>92.68</td><td>0.19</td><td>57.8</td></tr><tr><td rowspan="6"></td><td>GBN (You et al.,2019) ours-c ours-cs</td><td>76.19 75.89</td><td>-0.31 0.26</td><td>92.83 92.84</td><td>-0.16 0.03</td><td>59.5 61.5</td></tr><tr><td></td><td>76.00</td><td>0.15</td><td>92.76</td><td>0.11</td><td>59.0</td></tr><tr><td>Molchanov et al. (2017)</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ours-c</td><td>- 65.92</td><td></td><td>84.5</td><td>5.9</td><td>51.7</td></tr><tr><td></td><td></td><td>5.67</td><td>87.20</td><td>3.18</td><td>51.7</td></tr><tr><td>ours-cs</td><td>66.36</td><td>5.23</td><td>87.36</td><td>3.02</td><td>51.7</td></tr></table>
138
+
139
+ # 6 CONCLUSION
140
+
141
+ We present a discrete QCQP based optimization framework for jointly pruning channel and spatial filters under various architecture realizations. Since our methods model the inherent quadratic coupling between channels in the neighboring layers to eliminate any inactive weights during the pruning procedure, they allow exact modeling of the user-specified resource constraints and enable the direct optimization of the true objective on the pruned network. The experiments show our proposed method significantly outperforms other fixed-importance channel pruning methods, finding smaller and faster networks with the least drop in accuracy.
142
+
143
+ # REFERENCES
144
+
145
+ Jose M Alvarez and Mathieu Salzmann. Learning the number of neurons in deep networks. In NeurIPS, 2016.
146
+
147
+ Sajid Anwar, Kyuyeon Hwang, and Wonyong Sung. Structured pruning of deep convolutional neural networks. In JETC, 2017.
148
+
149
+ Kumar Chellapilla, Sidd Puri, and Patrice Simard. High performance convolutional neural networks for document processing. In IWFHR, 2006.
150
+
151
+ Jan K Chorowski, Dzmitry Bahdanau, Dmitriy Serdyuk, Kyunghyun Cho, and Yoshua Bengio. Attention-based models for speech recognition. In NeurIPS. 2015.
152
+
153
+ J. Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT, 2019.
154
+
155
+ Xuanyi Dong, Junshi Huang, Yi Yang, and Shuicheng Yan. More is less: A more complicated network with less inference complexity. In CVPR, 2017.
156
+
157
+ Xitong Gao, Yiren Zhao, Łukasz Dudziak, Robert Mullins, and Cheng-zhong Xu. Dynamic channel pruning: Feature boosting and suppression. 2019.
158
+
159
+ Ariel Gordon, Elad Eban, Ofir Nachum, Bo Chen, Hao Wu, Tien-Ju Yang, and Edward Choi. Morphnet: Fast & simple resource-constrained structure learning of deep networks. In CVPR, 2018.
160
+
161
+ Yiwen Guo, Anbang Yao, and Yurong Chen. Dynamic network surgery for efficient dnns. In NeurIPS, 2016.
162
+
163
+ Song Han, Jeff Pool, John Tran, and William Dally. Learning both weights and connections for efficient neural network. In NeurIPS, 2015.
164
+
165
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
166
+
167
+ Yang He, Guoliang Kang, Xuanyi Dong, Yanwei Fu, and Yi Yang. Soft filter pruning for accelerating deep convolutional neural networks. In IJCAI, 2018a.
168
+
169
+ Yang He, Ping Liu, Ziwei Wang, Zhilan Hu, and Yi Yang. Filter pruning via geometric median for deep convolutional neural networks acceleration. In CVPR, 2019.
170
+
171
+ Yihui He, Ji Lin, Zhijian Liu, Hanrui Wang, Li-Jia Li, and Song Han. Amc: Automl for model compression and acceleration on mobile devices. In ECCV, 2018b.
172
+
173
+ Hengyuan Hu, Rui Peng, Yu-Wing Tai, and Chi-Keung Tang. Network trimming: A data-driven neuron pruning approach towards efficient deep architectures. In arXiv:1607.03250, 2016.
174
+
175
+ Weizhe Hua, Yuan Zhou, Christopher M De Sa, Zhiru Zhang, and G Edward Suh. Channel gating neural networks. In NIPS, 2019.
176
+
177
+ Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In CVPR, 2017.
178
+
179
+ CPLEX OPTIMIZATION INC. Using the cplex callable library and cplex mixed integer library. In Incline Village, NV, 1993.
180
+
181
+ Minsoo Kang and Bohyung Han. Operation-aware soft channel pruning using differentiable masks. In ICML, 2020.
182
+
183
+ Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. In Tech Report, 2009.
184
+
185
+ Vadim Lebedev and Victor Lempitsky. Fast convnets using group-wise brain damage. In CVPR, 2016.
186
+
187
+ Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. In ICLR, 2017.
188
+
189
+ Z. Liu, H. Mu, X. Zhang, Z. Guo, X. Yang, K. Cheng, and J. Sun. Metapruning: Meta learning for automatic neural network channel pruning. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), 2019.
190
+
191
+ Zhuang Liu, Jianguo Li, Zhiqiang Shen, Gao Huang, Shoumeng Yan, and Changshui Zhang. Learning efficient convolutional networks through network slimming. In ICCV, 2017.
192
+
193
+ Zhuang Liu, Mingjie Sun, Tinghui Zhou, Gao Huang, and Trevor Darrell. Rethinking the value of network pruning. In ICLR, 2019.
194
+
195
+ Christos Louizos, Max Welling, and Diederik P Kingma. Learning sparse neural networks through l_0 regularization. In ICLR, 2018.
196
+
197
+ Jian-Hao Luo, Jianxin Wu, and Weiyao Lin. Thinet: A filter level pruning method for deep neural network compression. In ICCV, 2017.
198
+
199
+ John E Mitchell. Branch-and-cut algorithms for combinatorial optimization problems. In Handbook of applied optimization, 2002.
200
+
201
+ Pavlo Molchanov, Stephen Tyree, Tero Karras, Timo Aila, and Jan Kautz. Pruning convolutional neural networks for resource efficient inference. In ICLR, 2017.
202
+
203
+ Pavlo Molchanov, Arun Mallya, Stephen Tyree, Iuri Frosio, and Jan Kautz. Importance estimation for neural network pruning. In CVPR, 2019.
204
+
205
+ Hanyu Peng, Jiaxiang Wu, Shifeng Chen, and Junzhou Huang. Collaborative channel pruning for deep networks. In ICML, 2019.
206
+
207
+ Joseph Redmon and Ali Farhadi. Yolov3: An incremental improvement. In arXiv:1804.02767, 2018.
208
+
209
+ 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. In IJCV, 2015.
210
+
211
+ Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In CVPR, 2018.
212
+
213
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
214
+
215
+ Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In ICML, 2019.
216
+
217
+ Stefan Van Der Walt, S Chris Colbert, and Gael Varoquaux. The numpy array: a structure for efficient numerical computation. In CISE, 2011.
218
+
219
+ Wei Wen, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Learning structured sparsity in deep neural networks. In NeurIPS, 2016.
220
+
221
+ Huanrui Yang, Wei Wen, and Hai Li. Deephoyer: Learning sparser neural network with differentiable scale-invariant sparsity measures. In ICLR, 2019.
222
+
223
+ Tien-Ju Yang, Andrew Howard, Bo Chen, Xiao Zhang, Alec Go, Mark Sandler, Vivienne Sze, and Hartwig Adam. Netadapt: Platform-aware neural network adaptation for mobile applications. In ECCV, 2018.
224
+
225
+ Jianbo Ye, Xin Lu, Zhe Lin, and James Z Wang. Rethinking the smaller-norm-less-informative assumption in channel pruning of convolution layers. In ICLR, 2018.
226
+
227
+ Zhonghui You, Kun Yan, Jinmian Ye, Meng Ma, and Ping Wang. Gate decorator: Global filter pruning method for accelerating deep convolutional neural networks. In NeurIPS, 2019.
md/train/K5YasWXZT3O/K5YasWXZT3O.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/L80PLIixPIXTH/L80PLIixPIXTH.md ADDED
@@ -0,0 +1,321 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # How to Construct Deep Recurrent Neural Networks
2
+
3
+ Razvan Pascanu1, Caglar Gulcehre1, Kyunghyun $\mathrm { C h o } ^ { 2 }$ , and Yoshua Bengio1
4
+
5
+ 1Departement d’Informatique et de Recherche Op ´ erationelle, Universit ´ e de Montr ´ eal, ´ {pascanur, gulcehrc}@iro.umontreal.ca, yoshua.bengio@umontreal.ca 2Department of Information and Computer Science, Aalto University School of Science, kyunghyun.cho@aalto.fi
6
+
7
+ # Abstract
8
+
9
+ In this paper, we explore different ways to extend a recurrent neural network (RNN) to a deep RNN. We start by arguing that the concept of depth in an RNN is not as clear as it is in feedforward neural networks. By carefully analyzing and understanding the architecture of an RNN, however, we find three points of an RNN which may be made deeper; (1) input-to-hidden function, (2) hidden-tohidden transition and (3) hidden-to-output function. Based on this observation, we propose two novel architectures of a deep RNN which are orthogonal to an earlier attempt of stacking multiple recurrent layers to build a deep RNN (Schmidhuber, 1992; El Hihi and Bengio, 1996). We provide an alternative interpretation of these deep RNNs using a novel framework based on neural operators. The proposed deep RNNs are empirically evaluated on the tasks of polyphonic music prediction and language modeling. The experimental result supports our claim that the proposed deep RNNs benefit from the depth and outperform the conventional, shallow RNNs.
10
+
11
+ # 1 Introduction
12
+
13
+ Recurrent neural networks (RNN, see, e.g., Rumelhart et al., 1986) have recently become a popular choice for modeling variable-length sequences. RNNs have been successfully used for various task such as language modeling (see, e.g., Graves, 2013; Pascanu et al., 2013a; Mikolov, 2012; Sutskever et al., 2011), learning word embeddings (see, e.g., Mikolov et al., 2013a), online handwritten recognition (Graves et al., 2009) and speech recognition (Graves et al., 2013).
14
+
15
+ In this work, we explore deep extensions of the basic RNN. Depth for feedforward models can lead to more expressive models (Pascanu et al., 2013b), and we believe the same should hold for recurrent models. We claim that, unlike in the case of feedforward neural networks, the depth of an RNN is ambiguous. In one sense, if we consider the existence of a composition of several nonlinear computational layers in a neural network being deep, RNNs are already deep, since any RNN can be expressed as a composition of multiple nonlinear layers when unfolded in time.
16
+
17
+ Schmidhuber (1992); El Hihi and Bengio (1996) earlier proposed another way of building a deep RNN by stacking multiple recurrent hidden states on top of each other. This approach potentially allows the hidden state at each level to operate at different timescale (see, e.g., Hermans and Schrauwen, 2013). Nonetheless, we notice that there are some other aspects of the model that may still be considered shallow. For instance, the transition between two consecutive hidden states at a single level is shallow, when viewed separately.This has implications on what kind of transitions this model can represent as discussed in Section 3.2.3.
18
+
19
+ Based on this observation, in this paper, we investigate possible approaches to extending an RNN into a deep RNN. We begin by studying which parts of an RNN may be considered shallow. Then, for each shallow part, we propose an alternative deeper design, which leads to a number of deeper variants of an RNN. The proposed deeper variants are then empirically evaluated on two sequence modeling tasks.
20
+
21
+ The layout of the paper is as follows. In Section 2 we briefly introduce the concept of an RNN. In Section 3 we explore different concepts of depth in RNNs. In particular, in Section 3.3.1–3.3.2 we propose two novel variants of deep RNNs and evaluate them empirically in Section 5 on two tasks: polyphonic music prediction (Boulanger-Lewandowski et al., 2012) and language modeling. Finally we discuss the shortcomings and advantages of the proposed models in Section 6.
22
+
23
+ # 2 Recurrent Neural Networks
24
+
25
+ A recurrent neural network (RNN) is a neural network that simulates a discrete-time dynamical system that has an input $\mathbf { x } _ { t }$ , an output $\mathbf { y } _ { t }$ and a hidden state $\mathbf { h } _ { t }$ . In our notation the subscript $t$ represents time. The dynamical system is defined by
26
+
27
+ $$
28
+ \begin{array} { r l } & { \mathbf { h } _ { t } = f _ { h } ( \mathbf { x } _ { t } , \mathbf { h } _ { t - 1 } ) } \\ & { \mathbf { y } _ { t } = f _ { o } ( \mathbf { h } _ { t } ) , } \end{array}
29
+ $$
30
+
31
+ where $f _ { h }$ and $f _ { o }$ are a state transition function and an output function, respectively. Each function is parameterized by a set of parameters; $\pmb { \theta } _ { h }$ and $\theta _ { o }$ .
32
+
33
+ Given a set of $N$ training sequences $D = \left\{ \left( ( \mathbf { x } _ { 1 } ^ { ( n ) } , \mathbf { y } _ { 1 } ^ { ( n ) } ) , \ldots , ( \mathbf { x } _ { T _ { n } } ^ { ( n ) } , \mathbf { y } _ { T _ { n } } ^ { ( n ) } ) \right) \right\} _ { n = 1 } ^ { N }$ , the parameters of an RNN can be estimated by minimizing the following cost function:
34
+
35
+ $$
36
+ J ( \pmb \theta ) = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \sum _ { t = 1 } ^ { T _ { n } } d ( \mathbf y _ { t } ^ { ( n ) } , f _ { o } ( \mathbf h _ { t } ^ { ( n ) } ) ) ,
37
+ $$
38
+
39
+ where $\mathbf { h } _ { t } ^ { ( n ) } = f _ { h } ( \mathbf { x } _ { t } ^ { ( n ) } , \mathbf { h } _ { t - 1 } ^ { ( n ) } )$ and $\mathbf { h } _ { 0 } ^ { ( n ) } = \mathbf { 0 }$ . $d ( \mathbf { a } , \mathbf { b } )$ is a predefined divergence measure between a and , such as Euclidean distance or cross-entropy.
40
+
41
+ # 2.1 Conventional Recurrent Neural Networks
42
+
43
+ A conventional RNN is constructed by defining the transition function and the output function as
44
+
45
+ $$
46
+ \begin{array} { r l } & { \mathbf { h } _ { t } = f _ { h } ( \mathbf { x } _ { t } , \mathbf { h } _ { t - 1 } ) = \phi _ { h } \left( \mathbf { W } ^ { \top } \mathbf { h } _ { t - 1 } + \mathbf { U } ^ { \top } \mathbf { x } _ { t } \right) } \\ & { \mathbf { y } _ { t } = f _ { o } ( \mathbf { h } _ { t } , \mathbf { x } _ { t } ) = \phi _ { o } \left( \mathbf { V } ^ { \top } \mathbf { h } _ { t } \right) , } \end{array}
47
+ $$
48
+
49
+ where W, $\mathbf { U }$ and $\mathbf { V }$ are respectively the transition, input and output matrices, and $\phi _ { h }$ and $\phi _ { o }$ are element-wise nonlinear functions. It is usual to use a saturating nonlinear function such as a logistic sigmoid function or a hyperbolic tangent function for $\phi _ { h }$ . An illustration of this RNN is in Fig. 2 (a).
50
+
51
+ The parameters of the conventional RNN can be estimated by, for instance, stochastic gradient descent (SGD) algorithm with the gradient of the cost function in Eq. (3) computed by backpropagation through time (Rumelhart et al., 1986).
52
+
53
+ # 3 Deep Recurrent Neural Networks
54
+
55
+ # 3.1 Why Deep Recurrent Neural Networks?
56
+
57
+ Deep learning is built around a hypothesis that a deep, hierarchical model can be exponentially more efficient at representing some functions than a shallow one (Bengio, 2009). A number of recent theoretical results support this hypothesis (see, e.g., Le Roux and Bengio, 2010; Delalleau and Bengio, 2011; Pascanu et al., 2013b). For instance, it has been shown by Delalleau and Bengio (2011) that a deep sum-product network may require exponentially less units to represent the same function compared to a shallow sum-product network. Furthermore, there is a wealth of empirical evidences supporting this hypothesis (see, e.g., Goodfellow et al., 2013; Hinton et al., 2012b,a). These findings make us suspect that the same argument should apply to recurrent neural networks.
58
+
59
+ # 3.2 Depth of a Recurrent Neural Network
60
+
61
+ ![](images/00a94e656f7ace7d888d91f3f71e75335178957ddde7f6f65d3c7046c3cc9930.jpg)
62
+ Figure 1: A conventional recurrent neural network unfolded in time.
63
+
64
+ The depth is defined in the case of feedforward neural networks as having multiple nonlinear layers between input and output. Unfortunately this definition does not apply trivially to a recurrent neural network (RNN) because of its temporal structure. For instance, any RNN when unfolded in time as in Fig. 1 is deep, because a computational path between the input at time $k < t$ to the output at time $t$ crosses several nonlinear layers.
65
+
66
+ A close analysis of the computation carried out by an RNN (see Fig. 2 (a)) at each time step individually, however, shows that certain transitions are not deep, but are only results of a linear projection followed by an element-wise nonlinearity. It is clear that the hidden-to-hidden $( \mathbf { h } _ { t - 1 } \mathbf { h } _ { t } )$ ), hiddento-output $( \mathbf { h } _ { t } \mathbf { y } _ { t } )$ ) and input-to-hidden $\mathbf { \Delta x } _ { t } \to \mathbf { h } _ { t }$ ) functions are all shallow in the sense that there exists no intermediate, nonlinear hidden layer.
67
+
68
+ We can now consider different types of depth of an RNN by considering those transitions separately. We may make the hidden-to-hidden transition deeper by having one or more intermediate nonlinear layers between two consecutive hidden states $( \mathbf { h } _ { t - 1 }$ and $\mathbf { h } _ { t }$ ). At the same time, the hidden-tooutput function can be made deeper, as described previously, by plugging, multiple intermediate nonlinear layers between the hidden state $\mathbf { h } _ { t }$ and the output $\mathbf { y } _ { t }$ . Each of these choices has a different implication.
69
+
70
+ # 3.2.1 Deep Input-to-Hidden Function
71
+
72
+ A model can exploit more non-temporal structure from the input by making the input-to-hidden function deep. Previous work has shown that higher-level representations of deep networks tend to better disentangle the underlying factors of variation than the original input (Goodfellow et al., 2009; Glorot et al., 2011b) and flatten the manifolds near which the data concentrate (Bengio et al., 2013). We hypothesize that such higher-level representations should make it easier to learn the temporal structure between successive time steps because the relationship between abstract features can generally be expressed more easily. This has been, for instance, illustrated by the recent work (Mikolov et al., 2013b) showing that word embeddings from neural language models tend to be related to their temporal neighbors by simple algebraic relationships, with the same type of relationship (adding a vector) holding over very different regions of the space, allowing a form of analogical reasoning.
73
+
74
+ This approach of making the input-to-hidden function deeper is in the line with the standard practice of replacing input with extracted features in order to improve the performance of a machine learning model (see, e.g., Bengio, 2009). Recently, Chen and Deng (2013) reported that a better speech recognition performance could be achieved by employing this strategy, although they did not jointly train the deep input-to-hidden function together with other parameters of an RNN.
75
+
76
+ # 3.2.2 Deep Hidden-to-Output Function
77
+
78
+ A deep hidden-to-output function can be useful to disentangle the factors of variations in the hidden state, making it easier to predict the output. This allows the hidden state of the model to be more compact and may result in the model being able to summarize the history of previous inputs more efficiently. Let us denote an RNN with this deep hidden-to-output function a deep output RNN (DO-RNN).
79
+
80
+ Instead of having feedforward, intermediate layers between the hidden state and the output, Boulanger-Lewandowski et al. (2012) proposed to replace the output layer with a conditional generative model such as restricted Boltzmann machines or neural autoregressive distribution estimator (Larochelle and Murray, 2011). In this paper we only consider feedforward intermediate layers.
81
+
82
+ ![](images/7f1bb44a7d07ea09b619e3df2882984f8e9ff2c66cfda5301f37bcd6dd8abe85.jpg)
83
+ Figure 2: Illustrations of four different recurrent neural networks (RNN). (a) A conventional RNN. (b) Deep Transition (DT) RNN. $( \boldsymbol { \mathsf { b } } ^ { * } )$ DT-RNN with shortcut connections (c) Deep Transition, Deep Output (DOT) RNN. (d) Stacked RNN
84
+
85
+ # 3.2.3 Deep Hidden-to-Hidden Transition
86
+
87
+ The third knob we can play with is the depth of the hidden-to-hidden transition. The state transition between the consecutive hidden states effectively adds a new input to the summary of the previous inputs represented by the fixed-length hidden state. Previous work with RNNs has generally limited the architecture to a shallow operation; affine transformation followed by an element-wise nonlinearity. Instead, we argue that this procedure of constructing a new summary, or a hidden state, from the combination of the previous one and the new input should be highly nonlinear. This nonlinear transition could allow, for instance, the hidden state of an RNN to rapidly adapt to quickly changing modes of the input, while still preserving a useful summary of the past. This may be impossible to be modeled by a function from the family of generalized linear models. However, this highly nonlinear transition can be modeled by an MLP with one or more hidden layers which has an universal approximator property (see, e.g., Hornik et al., 1989).
88
+
89
+ An RNN with this deep transition will be called a deep transition RNN (DT-RNN) throughout remainder of this paper. This model is shown in Fig. 2 (b).
90
+
91
+ This approach of having a deep transition, however, introduces a potential problem. As the introduction of deep transition increases the number of nonlinear steps the gradient has to traverse when propagated back in time, it might become more difficult to train the model to capture longterm dependencies (Bengio et al., 1994). One possible way to address this difficulty is to introduce shortcut connections (see, e.g., Raiko et al., 2012) in the deep transition, where the added shortcut connections provide shorter paths, skipping the intermediate layers, through which the gradient is propagated back in time. We refer to an RNN having deep transition with shortcut connections by DT(S)-RNN (See Fig. 2 $( \boldsymbol { \mathsf { b } } ^ { * } )$ ).
92
+
93
+ Furthermore, we will call an RNN having both a deep hidden-to-output function and a deep transition a deep output, deep transition RNN (DOT-RNN). See Fig. 2 (c) for the illustration of DOT-RNN. If we consider shortcut connections as well in the hidden to hidden transition, we call the resulting model DOT(S)-RNN.
94
+
95
+ An approach similar to the deep hidden-to-hidden transition has been proposed recently by Pinheiro and Collobert (2014) in the context of parsing a static scene. They introduced a recurrent convolutional neural network (RCNN) which can be understood as a recurrent network whose the transition between consecutive hidden states (and input to hidden state) is modeled by a convolutional neural network. The RCNN was shown to speed up scene parsing and obtained the state-of-the-art result in Stanford Background and SIFT Flow datasets. Ko and Dieter (2009) proposed deep transitions for Gaussian Process models. Earlier, Valpola and Karhunen (2002) used a deep neural network to model the state transition in a nonlinear, dynamical state-space model.
96
+
97
+ # 3.2.4 Stack of Hidden States
98
+
99
+ An RNN may be extended deeper in yet another way by stacking multiple recurrent hidden layers on top of each other (Schmidhuber, 1992; El Hihi and Bengio, 1996; Jaeger, 2007; Graves, 2013).
100
+
101
+ We call this model a stacked RNN (sRNN) to distinguish it from the other proposed variants. The goal of a such model is to encourage each recurrent level to operate at a different timescale.
102
+
103
+ It should be noticed that the DT-RNN and the sRNN extend the conventional, shallow RNN in different aspects. If we look at each recurrent level of the sRNN separately, it is easy to see that the transition between the consecutive hidden states is still shallow. As we have argued above, this limits the family of functions it can represent. For example, if the structure of the data is sufficiently complex, incorporating a new input frame into the summary of what had been seen up to now might be an arbitrarily complex function. In such a case we would like to model this function by something that has universal approximator properties, as an MLP. The model can not rely on the higher layers to do so, because the higher layers do not feed back into the lower layer. On the other hand, the sRNN can deal with multiple time scales in the input sequence, which is not an obvious feature of the DT-RNN. The DT-RNN and the sRNN are, however, orthogonal in the sense that it is possible to have both features of the DT-RNN and the sRNN by stacking multiple levels of DT-RNNs to build a stacked DT-RNN which we do not explore more in this paper.
104
+
105
+ # 3.3 Formal descriptions of deep RNNs
106
+
107
+ Here we give a more formal description on how the deep transition recurrent neural network (DTRNN) and the deep output RNN (DO-RNN) as well as the stacked RNN are implemented.
108
+
109
+ # 3.3.1 Deep Transition RNN
110
+
111
+ We noticed from the state transition equation of the dynamical system simulated by RNNs in Eq. (1) that there is no restriction on the form of $f _ { h }$ . Hence, we propose here to use a multilayer perceptron to approximate $f _ { h }$ instead.
112
+
113
+ In this case, we can implement $f _ { h }$ by $L$ intermediate layers such that
114
+
115
+ $$
116
+ \mathbf { h } _ { t } = f _ { h } ( \mathbf { x } _ { t } , \mathbf { h } _ { t - 1 } ) = \phi _ { h } \left( \mathbf { W } _ { L } ^ { \top } \phi _ { L - 1 } \left( \mathbf { W } _ { L - 1 } ^ { \top } \phi _ { L - 2 } \left( \cdot \cdot \cdot \phi _ { 1 } \left( \mathbf { W } _ { 1 } ^ { \top } \mathbf { h } _ { t - 1 } + \mathbf { U } ^ { \top } \mathbf { x } _ { t } \right) \right) \right) \right) ,
117
+ $$
118
+
119
+ where $\phi _ { l }$ and $\mathbf { W } _ { l }$ are the element-wise nonlinear function and the weight matrix for the $l$ -th layer.
120
+ This RNN with a multilayered transition function is a deep transition RNN (DT-RNN).
121
+
122
+ An illustration of building an RNN with the deep state transition function is shown in Fig. 2 (b). In the illustration the state transition function is implemented with a neural network with a single intermediate layer.
123
+
124
+ This formulation allows the RNN to learn a non-trivial, highly nonlinear transition between the consecutive hidden states.
125
+
126
+ # 3.3.2 Deep Output RNN
127
+
128
+ Similarly, we can use a multilayer perceptron with $L$ intermediate layers to model the output function $f _ { o }$ in Eq. (2) such that
129
+
130
+ $$
131
+ \begin{array} { r } { \mathbf { y } _ { t } = f _ { o } ( \mathbf { h } _ { t } ) = \phi _ { o } \left( \mathbf { V } _ { L } ^ { \top } \phi _ { L - 1 } \left( \mathbf { V } _ { L - 1 } ^ { \top } \phi _ { L - 2 } \left( \cdot \cdot \cdot \phi _ { 1 } \left( \mathbf { V } _ { 1 } ^ { \top } \mathbf { h } _ { t } \right) \right) \right) \right) , } \end{array}
132
+ $$
133
+
134
+ where $\phi _ { l }$ and $\mathbf { V } _ { l }$ are the element-wise nonlinear function and the weight matrix for the $l$ -th layer. An RNN implementing this kind of multilayered output function is a deep output recurrent neural network (DO-RNN).
135
+
136
+ Fig. 2 (c) draws a deep output, deep transition RNN (DOT-RNN) implemented using both the deep transition and the deep output with a single intermediate layer each.
137
+
138
+ # 3.3.3 Stacked RNN
139
+
140
+ The stacked RNN (Schmidhuber, 1992; El Hihi and Bengio, 1996) has multiple levels of transition functions defined by
141
+
142
+ $$
143
+ \mathbf { h } _ { t } ^ { ( l ) } = f _ { h } ^ { ( l ) } ( \mathbf { h } _ { t } ^ { ( l - 1 ) } , \mathbf { h } _ { t - 1 } ^ { ( l ) } ) = \phi _ { h } \left( \mathbf { W } _ { l } ^ { \top } \mathbf { h } _ { t - 1 } ^ { ( l ) } + \mathbf { U } _ { l } ^ { \top } \mathbf { h } _ { t } ^ { ( l - 1 ) } \right) ,
144
+ $$
145
+
146
+ where $\mathbf { h } _ { t } ^ { ( l ) }$ is the hidden state of the $l$ -th level at time . When $l = 1$ , the state is computed using tinstead of $\mathbf { h } _ { t } ^ { ( l - 1 ) }$ t. The hidden states of all the levels are recursively computed from the bottom level $l = 1$ .
147
+
148
+ Once the top-level hidden state is computed, the output can be obtained using the usual formulation in Eq. (5). Alternatively, one may use all the hidden states to compute the output (Hermans and Schrauwen, 2013). Each hidden state at each level may also be made to depend on the input as well (Graves, 2013). Both of them can be considered approaches using shortcut connections discussed earlier.
149
+
150
+ The illustration of this stacked RNN is in Fig. 2 (d).
151
+
152
+ # 4 Another Perspective: Neural Operators
153
+
154
+ In this section, we briefly introduce a novel approach with which the already discussed deep transition (DT) and/or deep output (DO) recurrent neural networks (RNN) may be built. We call this approach which is based on building an RNN with a set of predefined neural operators, an operatorbased framework.
155
+
156
+ In the operator-based framework, one first defines a set of operators of which each is implemented by a multilayer perceptron (MLP). For instance, a plus operator $\oplus$ may be defined as a function receiving two vectors $\mathbf { x }$ and $\mathbf { h }$ and returning the summary $\mathbf { h } ^ { \prime }$ of them:
157
+
158
+ $$
159
+ \mathbf { h } ^ { \prime } = \mathbf { x } \oplus \mathbf { h } ,
160
+ $$
161
+
162
+ where we may constrain that the dimensionality of $\mathbf { h }$ and $\mathbf { h } ^ { \prime }$ are identical. Additionally, we can define another operator $\vartriangleright$ which predicts the most likely output symbol $\mathbf { x } ^ { \prime }$ given a summary $\mathbf { h }$ , such that
163
+
164
+ $$
165
+ \mathbf { x } ^ { \prime } = \ v { D } \ v { D } \mathbf { h }
166
+ $$
167
+
168
+ It is possible to define many other operators, but in this paper, we stick to these two operators which are sufficient to express all the proposed types of RNNs.
169
+
170
+ It is clear to see that the plus operator $\oplus$ and the predict operator $\vartriangleright$ correspond to the transition function and the output function in Eqs. (1)–(2). Thus, at each step, an RNN can be thought as performing the plus operator to update the hidden state given an input $( \mathbf { h } _ { t } = \mathbf { x } _ { t } \oplus \mathbf { h } _ { t - 1 } )$ and then the predict operator to compute the output $( \mathbf { y } _ { t } =$ $\triangleright { \mathbf { h } } _ { t } = \triangleright ( { \mathbf { x } } _ { t } \oplus { \mathbf { h } } _ { t - 1 } \bar { ) } )$ . See Fig. 3 for the illustration of how an RNN can be understood from the operator-based framework.
171
+
172
+ ![](images/b812d88ae2434b828838ffbdfe964e8ca56a5eb3b60953f6ac4d3f2535822761.jpg)
173
+ Figure 3: A view of an RNN under the operator-based framework: $\oplus$ and $\vartriangleright$ are the plus and predict operators, respectively.
174
+
175
+ Each operator can be parameterized as an MLP with one or more hidden layers, hence a neural operator, since we cannot simply expect the operation will be linear with respect to the input vector(s). By using an MLP to implement the operators, the proposed deep transition, deep output RNN (DOT-RNN) naturally arises.
176
+
177
+ This framework provides us an insight on how the con structed RNN be regularized. For instance, one may regularize the model such that the plus operator $\oplus$ is commutative. However, in this paper, we do not explore further on this approach.
178
+
179
+ Note that this is different from (Mikolov et al., 2013a) where the learned embeddings of words happened to be suitable for algebraic operators. The operator-based framework proposed here is rather geared toward learning these operators directly.
180
+
181
+ # 5 Experiments
182
+
183
+ We train four types of RNNs described in this paper on a number of benchmark datasets to evaluate their performance. For each benchmark dataset, we try the task of predicting the next symbol.
184
+
185
+ The task of predicting the next symbol is equivalent to the task of modeling the distribution over a sequence. For each sequence $\displaystyle \bigl ( \mathbf { x } _ { 1 } , \ldots , \mathbf { x } _ { T } \bigr )$ , we decompose it into
186
+
187
+ $$
188
+ p ( \mathbf { x } _ { 1 } , \ldots , \mathbf { x } _ { T } ) = p ( \mathbf { x } _ { 1 } ) \prod _ { t = 2 } ^ { T } p ( \mathbf { x } _ { t } \mid \mathbf { x } _ { 1 } , \ldots , \mathbf { x } _ { t - 1 } ) ,
189
+ $$
190
+
191
+ and each term on the right-hand side will be replaced with a single timestep of an RNN. In this setting, the RNN predicts the probability of the next symbol $\mathbf { x } _ { t }$ in the sequence given the all previous symbols $\mathbf { x } _ { 1 } , \ldots . . \mathbf { x } _ { t - 1 }$ . Then, we train the RNN by maximizing the log-likelihood.
192
+
193
+ We try this task of modeling the joint distribution on three different tasks; polyphonic music prediction, character-level and word-level language modeling.
194
+
195
+ We test the RNNs on the task of polyphonic music prediction using three datasets which are Nottingham, JSB Chorales and MuseData (Boulanger-Lewandowski et al., 2012). On the task of characterlevel and word-level language modeling, we use Penn Treebank Corpus (Marcus et al., 1993).
196
+
197
+ # 5.1 Model Descriptions
198
+
199
+ We compare the conventional recurrent neural network (RNN), deep transition RNN with shortcut connections in the transition MLP (DT(S)-RNN), deep output/transition RNN with shortcut connections in the hidden to hidden transition MLP (DOT(S)-RNN) and stacked RNN (sRNN). See Fig. 2 (a)–(d) for the illustrations of these models.
200
+
201
+ <table><tr><td rowspan=1 colspan=3></td><td rowspan=1 colspan=1>RNN</td><td rowspan=1 colspan=1>DT(S)-RNN</td><td rowspan=1 colspan=1>DOT(S)-RNN</td><td rowspan=1 colspan=1>sRNN2 layers</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Notthingam</td><td rowspan=1 colspan=1>#units# parameters</td><td rowspan=1 colspan=1>600465K</td><td rowspan=1 colspan=1>400,400585K</td><td rowspan=1 colspan=1>400,400,400745K</td><td rowspan=1 colspan=1>400550K</td></tr><tr><td rowspan=1 colspan=1>Music</td><td rowspan=1 colspan=1> JSB Chorales</td><td rowspan=1 colspan=1>#units# parameters</td><td rowspan=1 colspan=1>20075K</td><td rowspan=1 colspan=1>400,400585K</td><td rowspan=1 colspan=1>400,400,400745K</td><td rowspan=1 colspan=1>400550K</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>MuseData</td><td rowspan=1 colspan=1>#units# parameters</td><td rowspan=1 colspan=1>600465K</td><td rowspan=1 colspan=1>400,400585K</td><td rowspan=1 colspan=1>400,400,400745K</td><td rowspan=1 colspan=1>6001185K</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Char-level</td><td rowspan=1 colspan=1># units# parameters</td><td rowspan=1 colspan=1>600420K</td><td rowspan=1 colspan=1>400,400540K</td><td rowspan=1 colspan=1>400,400,600790K</td><td rowspan=1 colspan=1>400520K</td></tr><tr><td rowspan=1 colspan=1>Language</td><td rowspan=1 colspan=1>Word-level</td><td rowspan=1 colspan=1>#units# parameters</td><td rowspan=1 colspan=1>2004.04M</td><td rowspan=1 colspan=1>200,2006.12M</td><td rowspan=1 colspan=1>200,200,2006.16M</td><td rowspan=1 colspan=1>4008.48M</td></tr></table>
202
+
203
+ Table 1: The sizes of the trained models. We provide the number of hidden units as well as the total number of parameters. For DT(S)-RNN, the two numbers provided for the number of units mean the size of the hidden state and that of the intermediate layer, respectively. For DOT(S)-RNN, the three numbers are the size of the hidden state, that of the intermediate layer between the consecutive hidden states and that of the intermediate layer between the hidden state and the output layer. For sRNN, the number corresponds to the size of the hidden state at each level
204
+
205
+ The size of each model is chosen from a limited set $\{ 1 0 0 , 2 0 0 , 4 0 0 , 6 0 0 , 8 0 0 \}$ to minimize the validation error for each polyphonic music task (See Table. 1 for the final models). In the case of language modeling tasks, we chose the size of the models from $\{ 2 0 0 , 4 0 0 \}$ and $\{ 4 0 0 , 6 0 0 \}$ for word-level and character-level tasks, respectively. In all cases, we use a logistic sigmoid function as an element-wise nonlinearity of each hidden unit. Only for the character-level language modeling we used rectified linear units (Glorot et al., 2011a) for the intermediate layers of the output function, which gave lower validation error.
206
+
207
+ # 5.2 Training
208
+
209
+ We use stochastic gradient descent (SGD) and employ the strategy of clipping the gradient proposed by Pascanu et al. (2013a). Training stops when the validation cost stops decreasing.
210
+
211
+ Polyphonic Music Prediction: For Nottingham and MuseData datasets we compute each gradient step on subsequences of at most 200 steps, while we use subsequences of 50 steps for JSB Chorales.
212
+
213
+ We do not reset the hidden state for each subsequence, unless the subsequence belongs to a different song than the previous subsequence.
214
+
215
+ The cutoff threshold for the gradients is set to 1. The hyperparameter for the learning rate schedule1 is tuned manually for each dataset. We set the hyperparameter $\beta$ to 2330 for Nottingham, 1475 for MuseData and 100 for JSB Chroales. They correspond to two epochs, a single epoch and a third of an epoch, respectively.
216
+
217
+ The weights of the connections between any pair of hidden layers are sparse, having only 20 nonzero incoming connections per unit (see, e.g., Sutskever et al., 2013). Each weight matrix is rescaled to have a unit largest singular value (Pascanu et al., 2013a). The weights of the connections between the input layer and the hidden state as well as between the hidden state and the output layer are initialized randomly from the white Gaussian distribution with its standard deviation fixed to 0.1 and 0.01, respectively. In the case of deep output functions (DOT(S)-RNN), the weights of the connections between the hidden state and the intermediate layer are sampled initially from the white Gaussian distribution of standard deviation 0.01. In all cases, the biases are initialized to 0.
218
+
219
+ To regularize the models, we add white Gaussian noise of standard deviation 0.075 to each weight parameter every time the gradient is computed (Graves, 2011).
220
+
221
+ Language Modeling: We used the same strategy for initializing the parameters in the case of language modeling. For character-level modeling, the standard deviations of the white Gaussian distributions for the input-to-hidden weights and the hidden-to-output weights, we used 0.01 and 0.001, respectively, while those hyperparameters were both 0.1 for word-level modeling. In the case of DOT(S)-RNN, we sample the weights of between the hidden state and the rectifier intermediate layer of the output function from the white Gaussian distribution of standard deviation 0.01. When using rectifier units (character-based language modeling) we fix the biases to 0.1.
222
+
223
+ In language modeling, the learning rate starts from an initial value and is halved each time the validation cost does not decrease significantly (Mikolov et al., 2010). We do not use any regularization for the character-level modeling, but for the word-level modeling we use the same strategy of adding weight noise as we do with the polyphonic music prediction.
224
+
225
+ For all the tasks (polyphonic music prediction, character-level and word-level language modeling), the stacked RNN and the DOT(S)-RNN were initialized with the weights of the conventional RNN and the DT(S)-RNN, which is similar to layer-wise pretraining of a feedforward neural network (see, e.g., Hinton and Salakhutdinov, 2006). We use a ten times smaller learning rate for each parameter that was pretrained as either RNN or DT(S)-RNN.
226
+
227
+ <table><tr><td></td><td>RNN</td><td>DT(S)-RNN</td><td>DOT(S)-RNN</td><td>sRNN</td><td>DOT(S)-RNN*</td></tr><tr><td>Notthingam</td><td>3.225</td><td>3.206</td><td>3.215</td><td>3.258</td><td>2.95</td></tr><tr><td>JSB Chorales</td><td>8.338</td><td>8.278</td><td>8.437</td><td>8.367</td><td>7.92</td></tr><tr><td>MuseData</td><td>6.990</td><td>6.988</td><td>6.973</td><td>6.954</td><td>6.59</td></tr></table>
228
+
229
+ Table 2: The performances of the four types of RNNs on the polyphonic music prediction. The numbers represent negative log-probabilities on test sequences. $( ^ { * } )$ We obtained these results using DOT(S)-RNN with $L _ { p }$ units in the deep transition, maxout units in the deep output function and dropout (Gulcehre et al., 2013).
230
+
231
+ # 5.3 Result and Analysis
232
+
233
+ # 5.3.1 Polyphonic Music Prediction
234
+
235
+ The log-probabilities on the test set of each data are presented in the first four columns of Tab. 2. We were able to observe that in all cases one of the proposed deep RNNs outperformed the conventional, shallow RNN. Though, the suitability of each deep RNN depended on the data it was trained on. The best results obtained by the DT(S)-RNNs on Notthingam and JSB Chorales are close to, but worse than the result obtained by RNNs trained with the technique of fast dropout (FD) which are 3.09 and 8.01, respectively (Bayer et al., 2013).
236
+
237
+ In order to quickly investigate whether the proposed deeper variants of RNNs may also benefit from the recent advances in feedforward neural networks, such as the use of non-saturating activation functions2 and the method of dropout. We have built another set of DOT(S)-RNNs that have the recently proposed $L _ { p }$ units (Gulcehre et al., 2013) in deep transition and maxout units (Goodfellow et al., 2013) in deep output function. Furthermore, we used the method of dropout (Hinton et al., 2012b) instead of weight noise during training. Similarly to the previously trained models, we searched for the size of the models as well as other learning hyperparameters that minimize the validation performance. We, however, did not pretrain these models.
238
+
239
+ The results obtained by the DOT(S)-RNNs having $L _ { p }$ and maxout units trained with dropout are shown in the last column of Tab. 2. On every music dataset the performance by this model is significantly better than those achieved by all the other models as well as the best results reported with recurrent neural networks in (Bayer et al., 2013). This suggests us that the proposed variants of deep RNNs also benefit from having non-saturating activations and using dropout, just like feedforward neural networks. We reported these results and more details on the experiment in (Gulcehre et al., 2013).
240
+
241
+ We, however, acknowledge that the model-free state-of-the-art results for the both datasets were obtained using an RNN combined with a conditional generative model, such as restricted Boltzmann machines or neural autoregressive distribution estimator (Larochelle and Murray, 2011), in the output (Boulanger-Lewandowski et al., 2012).
242
+
243
+ <table><tr><td></td><td>RNN</td><td>DT(S)-RNN</td><td>DOT(S)-RNN</td><td>sRNN</td><td>*</td><td>★</td></tr><tr><td>Character-Level</td><td>1.414</td><td>1.409</td><td>1.386</td><td>1.412</td><td>1.411</td><td>1.243</td></tr><tr><td>Word-Level</td><td>117.7</td><td>112.0</td><td>107.5</td><td>110.0</td><td>123²</td><td>1173</td></tr></table>
244
+
245
+ Table 3: The performances of the four types of RNNs on the tasks of language modeling. The numbers represent bit-per-character and perplexity computed on test sequence, respectively, for the character-level and word-level modeling tasks. $^ *$ The previous/current state-of-the-art results obtained with shallow RNNs. $\star$ The previous/current state-of-the-art results obtained with RNNs having long-short term memory units.
246
+
247
+ # 5.3.2 Language Modeling
248
+
249
+ On Tab. 3, we can see the perplexities on the test set achieved by the all four models. We can clearly see that the deep RNNs (DT(S)-RNN, DOT(S)-RNN and sRNN) outperform the conventional, shallow RNN significantly. On these tasks DOT(S)-RNN outperformed all the other models, which suggests that it is important to have highly nonlinear mapping from the hidden state to the output in the case of language modeling.
250
+
251
+ The results by both the DOT(S)-RNN and the sRNN for word-level modeling surpassed the previous best performance achieved by an RNN with 1000 long short-term memory (LSTM) units (Graves, 2013) as well as that by a shallow RNN with a larger hidden state (Mikolov et al., 2011), even when both of them used dynamic evaluation3. The results we report here are without dynamic evaluation.
252
+
253
+ For character-level modeling the state-of-the-art results were obtained using an optimization method Hessian-free with a specific type of RNN architecture called mRNN (Mikolov et al., 2012a) or a regularization technique called adaptive weight noise (Graves, 2013). Our result, however, is better than the performance achieved by conventional, shallow RNNs without any of those advanced regularization methods (Mikolov et al., 2012b), where they reported the best performance of 1.41 using an RNN trained with the Hessian-free learning algorithm (Martens and Sutskever, 2011).
254
+
255
+ # 6 Discussion
256
+
257
+ In this paper, we have explored a novel approach to building a deep recurrent neural network (RNN). We considered the structure of an RNN at each timestep, which revealed that the relationship between the consecutive hidden states and that between the hidden state and output are shallow. Based on this observation, we proposed two alternative designs of deep RNN that make those shallow relationships be modeled by deep neural networks. Furthermore, we proposed to make use of shortcut connections in these deep RNNs to alleviate a problem of difficult learning potentially introduced by the increasing depth.
258
+
259
+ We empirically evaluated the proposed designs against the conventional RNN which has only a single hidden layer and against another approach of building a deep RNN (stacked RNN, Graves, 2013), on the task of polyphonic music prediction and language modeling.
260
+
261
+ The experiments revealed that the RNN with the proposed deep transition and deep output (DOT(S)- RNN) outperformed both the conventional RNN and the stacked RNN on the task of language modeling, achieving the state-of-the-art result on the task of word-level language modeling. For polyphonic music prediction, a different deeper variant of an RNN achieved the best performance for each dataset. Importantly, however, in all the cases, the conventional, shallow RNN was not able to outperform the deeper variants. These results strongly support our claim that an RNN benefits from having a deeper architecture, just like feedforward neural networks.
262
+
263
+ The observation that there is no clear winner in the task of polyphonic music prediction suggests us that each of the proposed deep RNNs has a distinct characteristic that makes it more, or less, suitable for certain types of datasets. We suspect that in the future it will be possible to design and train yet another deeper variant of an RNN that combines the proposed models together to be more robust to the characteristics of datasets. For instance, a stacked DT(S)-RNN may be constructed by combining the DT(S)-RNN and the sRNN.
264
+
265
+ In a quick additional experiment where we have trained DOT(S)-RNN constructed using nonsaturating nonlinear activation functions and trained with the method of dropout, we were able to improve the performance of the deep recurrent neural networks on the polyphonic music prediction tasks significantly. This suggests us that it is important to investigate the possibility of applying recent advances in feedforward neural networks, such as novel, non-saturating activation functions and the method of dropout, to recurrent neural networks as well. However, we leave this as future research.
266
+
267
+ One practical issue we ran into during the experiments was the difficulty of training deep RNNs. We were able to train the conventional RNN as well as the DT(S)-RNN easily, but it was not trivial to train the DOT(S)-RNN and the stacked RNN. In this paper, we proposed to use shortcut connections as well as to pretrain them either with the conventional RNN or with the DT(S)-RNN. We, however, believe that learning may become even more problematic as the size and the depth of a model increase. In the future, it will be important to investigate the root causes of this difficulty and to explore potential solutions. We find some of the recently introduced approaches, such as advanced regularization methods (Pascanu et al., 2013a) and advanced optimization algorithms (see, e.g., Pascanu and Bengio, 2013; Martens, 2010), to be promising candidates.
268
+
269
+ # Acknowledgments
270
+
271
+ We would like to thank the developers of Theano (Bergstra et al., 2010; Bastien et al., 2012). We also thank Justin Bayer for his insightful comments on the paper. We would like to thank NSERC, Compute Canada, and Calcul Quebec for providing computational resources. Razvan Pascanu is ´ supported by a DeepMind Fellowship. Kyunghyun Cho is supported by FICS (Finnish Doctoral Programme in Computational Sciences) and “the Academy of Finland (Finnish Centre of Excellence in Computational Inference Research COIN, 251170)”.
272
+
273
+ References
274
+ Bastien, F., Lamblin, P., Pascanu, R., Bergstra, J., Goodfellow, I. J., Bergeron, A., Bouchard, N., and Bengio, Y. (2012). Theano: new features and speed improvements. Deep Learning and Unsupervised Feature Learning NIPS 2012 Workshop.
275
+ Bayer, J., Osendorfer, C., Korhammer, D., Chen, N., Urban, S., and van der Smagt, P. (2013). On fast dropout and its applicability to recurrent networks. arXiv:1311.0701 [cs.NE].
276
+ Bengio, Y. (2009). Learning deep architectures for AI. Found. Trends Mach. Learn., 2(1), 1–127.
277
+ Bengio, Y., Simard, P., and Frasconi, P. (1994). Learning long-term dependencies with gradient descent is difficult. IEEE Transactions on Neural Networks, 5(2), 157–166.
278
+ Bengio, Y., Mesnil, G., Dauphin, Y., and Rifai, S. (2013). Better mixing via deep representations. In ICML’13.
279
+ Bergstra, J., Breuleux, O., Bastien, F., Lamblin, P., Pascanu, R., Desjardins, G., Turian, J., WardeFarley, D., and Bengio, Y. (2010). Theano: a CPU and GPU math expression compiler. In Proceedings of the Python for Scientific Computing Conference (SciPy). Oral Presentation.
280
+ Boulanger-Lewandowski, N., Bengio, Y., and Vincent, P. (2012). Modeling temporal dependencies in high-dimensional sequences: Application to polyphonic music generation and transcription. In ICML’2012.
281
+ Chen, J. and Deng, L. (2013). A new method for learning deep recurrent neural networks. arXiv:1311.6091 [cs.LG].
282
+ Delalleau, O. and Bengio, Y. (2011). Shallow vs. deep sum-product networks. In NIPS.
283
+ El Hihi, S. and Bengio, Y. (1996). Hierarchical recurrent neural networks for long-term dependencies. In NIPS 8. MIT Press.
284
+ Glorot, X., Bordes, A., and Bengio, Y. (2011a). Deep sparse rectifier neural networks. In AISTATS.
285
+ Glorot, X., Bordes, A., and Bengio, Y. (2011b). Domain adaptation for large-scale sentiment classification: A deep learning approach. In ICML’2011.
286
+ Goodfellow, I., Le, Q., Saxe, A., and Ng, A. (2009). Measuring invariances in deep networks. In NIPS’09, pages 646–654.
287
+ Goodfellow, I. J., Warde-Farley, D., Mirza, M., Courville, A., and Bengio, Y. (2013). Maxout networks. In ICML’2013.
288
+ Graves, A. (2011). Practical variational inference for neural networks. In J. Shawe-Taylor, R. Zemel, P. Bartlett, F. Pereira, and K. Weinberger, editors, Advances in Neural Information Processing Systems 24, pages 2348–2356.
289
+ Graves, A. (2013). Generating sequences with recurrent neural networks. arXiv:1308.0850 [cs.NE].
290
+ Graves, A., Liwicki, M., Fernandez, S., Bertolami, R., Bunke, H., and Schmidhuber, J. (2009). A novel connectionist system for improved unconstrained handwriting recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence.
291
+ Graves, A., Mohamed, A., and Hinton, G. (2013). Speech recognition with deep recurrent neural networks. ICASSP.
292
+ Gulcehre, C., Cho, K., Pascanu, R., and Bengio, Y. (2013). Learned-norm pooling for deep feedforward and recurrent neural networks. arXiv:1311.1780 [cs.NE].
293
+ Hermans, M. and Schrauwen, B. (2013). Training and analysing deep recurrent neural networks. In Advances in Neural Information Processing Systems 26, pages 190–198.
294
+ Hinton, G., Deng, L., Dahl, G. E., Mohamed, A., Jaitly, N., Senior, A., Vanhoucke, V., Nguyen, P., Sainath, T., and Kingsbury, B. (2012a). Deep neural networks for acoustic modeling in speech recognition. IEEE Signal Processing Magazine, 29(6), 82–97.
295
+ Hinton, G. E. and Salakhutdinov, R. (2006). Reducing the dimensionality of data with neural networks. Science, 313(5786), 504–507.
296
+ Hinton, G. E., Srivastava, N., Krizhevsky, A., Sutskever, I., and Salakhutdinov, R. (2012b). Improving neural networks by preventing co-adaptation of feature detectors. Technical report, arXiv:1207.0580.
297
+ Hornik, K., Stinchcombe, M., and White, H. (1989). Multilayer feedforward networks are universal approximators. Neural Networks, 2, 359–366.
298
+ Jaeger, H. (2007). Discovering multiscale dynamical features with hierarchical echo state networks. Technical report, Jacobs University.
299
+ Ko, J. and Dieter, F. (2009). Gp-bayesfilters: Bayesian filtering using gaussian process prediction and observation models. Autonomous Robots.
300
+ Larochelle, H. and Murray, I. (2011). The Neural Autoregressive Distribution Estimator. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics (AISTATS’2011), volume 15 of JMLR: W&CP.
301
+ Le Roux, N. and Bengio, Y. (2010). Deep belief networks are compact universal approximators. Neural Computation, 22(8), 2192–2207.
302
+ Marcus, M. P., Marcinkiewicz, M. A., and Santorini, B. (1993). Building a large annotated corpus of english: The Penn Treebank. Computational Linguistics, 19(2), 313–330.
303
+ Martens, J. (2010). Deep learning via Hessian-free optimization. In L. Bottou and M. Littman, editors, Proceedings of the Twenty-seventh International Conference on Machine Learning (ICML10), pages 735–742. ACM.
304
+ Martens, J. and Sutskever, I. (2011). Learning recurrent neural networks with Hessian-free optimization. In Proc. ICML’2011. ACM.
305
+ Mikolov, T. (2012). Statistical Language Models based on Neural Networks. Ph.D. thesis, Brno University of Technology.
306
+ Mikolov, T., Karafiat, M., Burget, L., Cernocky, J., and Khudanpur, S. (2010). Recurrent neural ´ network based language model. In Proceedings of the 11th Annual Conference of the International Speech Communication Association (INTERSPEECH 2010), volume 2010, pages 1045–1048. International Speech Communication Association.
307
+ Mikolov, T., Kombrink, S., Burget, L., Cernocky, J., and Khudanpur, S. (2011). Extensions of recurrent neural network language model. In Proc. 2011 IEEE international conference on acoustics, speech and signal processing (ICASSP 2011).
308
+ Mikolov, T., Sutskever, I., Deoras, A., Le, H., Kombrink, S., and Cernocky, J. (2012a). Subword language modeling with neural networks. unpublished.
309
+ Mikolov, T., Sutskever, I., Deoras, A., Le, H.-S., Kombrink, S., and Cernocky, J. (2012b). Subword language modeling with neural networks. preprint (http://www.fit.vutbr.cz/ imikolov/rnnlm/char.pdf).
310
+ Mikolov, T., Sutskever, I., Chen, K., Corrado, G., and Dean, J. (2013a). Distributed representations of words and phrases and their compositionality. In Advances in Neural Information Processing Systems 26, pages 3111–3119.
311
+ Mikolov, T., Chen, K., Corrado, G., and Dean, J. (2013b). Efficient estimation of word representations in vector space. In International Conference on Learning Representations: Workshops Track.
312
+ Pascanu, R. and Bengio, Y. (2013). Revisiting natural gradient for deep networks. Technical report, arXiv:1301.3584.
313
+ Pascanu, R., Mikolov, T., and Bengio, Y. (2013a). On the difficulty of training recurrent neural networks. In ICML’2013.
314
+ Pascanu, R., Montufar, G., and Bengio, Y. (2013b). On the number of response regions of deep feed forward networks with piece-wise linear activations. arXiv:1312.6098[cs.LG].
315
+ Pinheiro, P. and Collobert, R. (2014). Recurrent convolutional neural networks for scene labeling. In Proceedings of The 31st International Conference on Machine Learning, pages 82–90.
316
+ Raiko, T., Valpola, H., and LeCun, Y. (2012). Deep learning made easier by linear transformations in perceptrons. In Proceedings of the Fifteenth Internation Conference on Artificial Intelligence and Statistics (AISTATS 2012), volume 22 of JMLR Workshop and Conference Proceedings, pages 924–932. JMLR W&CP.
317
+ Rumelhart, D. E., Hinton, G. E., and Williams, R. J. (1986). Learning representations by backpropagating errors. Nature, 323, 533–536.
318
+ Schmidhuber, J. (1992). Learning complex, extended sequences using the principle of history compression. Neural Computation, (4), 234–242.
319
+ Sutskever, I., Martens, J., and Hinton, G. (2011). Generating text with recurrent neural networks. In L. Getoor and T. Scheffer, editors, Proceedings of the 28th International Conference on Machine Learning (ICML 2011), pages 1017–1024, New York, NY, USA. ACM.
320
+ Sutskever, I., Martens, J., Dahl, G., and Hinton, G. (2013). On the importance of initialization and momentum in deep learning. In ICML.
321
+ Valpola, H. and Karhunen, J. (2002). An unsupervised ensemble learning method for nonlinear dynamic state-space models. Neural Comput., 14(11), 2647–2692.
md/train/LOHyqjfyra/LOHyqjfyra.md ADDED
@@ -0,0 +1,182 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # On Interaction Between Augmentations and Corruptions in Natural Corruption Robustness
2
+
3
+ Eric Mintun∗ Facebook AI Research mintun@fb.com
4
+
5
+ Alexander Kirillov Facebook AI Research akirillov@fb.com
6
+
7
+ Saining Xie Facebook AI Research s9xie@fb.com
8
+
9
+ # Abstract
10
+
11
+ Invariance to a broad array of image corruptions, such as warping, noise, or color shifts, is an important aspect of building robust models in computer vision. Recently, several new data augmentations have been proposed that significantly improve performance on ImageNet-C, a benchmark of such corruptions. However, there is still a lack of basic understanding on the relationship between data augmentations and test-time corruptions. To this end, we develop a feature space for image transforms, and then use a new measure in this space between augmentations and corruptions called the Minimal Sample Distance to demonstrate a strong correlation between similarity and performance. We then investigate recent data augmentations and observe a significant degradation in corruption robustness when the test-time corruptions are sampled to be perceptually dissimilar from ImageNet-C in this feature space. Our results suggest that test error can be improved by training on perceptually similar augmentations, and data augmentations may not generalize well beyond the existing benchmark. We hope our results and tools will allow for more robust progress towards improving robustness to image corruptions. We provide code at https://github.com/facebookresearch/augmentation-corruption.
12
+
13
+ # 1 Introduction
14
+
15
+ Robustness to distribution shift, i.e. when the train and test distributions differ, is an important feature of practical machine learning models. Among many forms of distribution shift, one particularly relevant category for computer vision are image corruptions. For example, test data may come from sources that differ from the training set in terms of lighting, camera quality, or other features. Postprocessing transforms, such as photo touch-up, image filters, or compression effects are commonplace in real-world data. Models developed using clean, undistorted inputs typically perform dramatically worse when confronted with these sorts of image corruptions [8, 13]. The subject of corruption robustness has a long history in computer vision [1, 6, 28] and recently has been studied actively with the release of benchmark datasets such as ImageNet-C [13].
16
+
17
+ One particular property of image corruptions is that they are low-level distortions in nature. Corruptions are transformations of an image that affect structural information such as colors, textures, or geometry [5] and are typically free of high-level semantics. Therefore, it is natural to expect that data augmentation techniques, which expand the training set with random low-level transformations, can help learn robust models. Indeed, data augmentation has become a central technique in several recent methods [14, 20, 25] that achieve large improvements on ImageNet-C and related benchmarks.
18
+
19
+ One caveat for data augmentation based approaches is the test corruptions are expected to be unknown at training time. If the corruptions are known, they may simply be applied to the training set as data augmentations to trivially adapt to the test distribution. Instead, an ideal robust model needs to be robust to any valid corruption, including ones unseen in any previous benchmark. Of course, in practice the robustness of a model can only be evaluated approximately by measuring its corruption error on a representative corruption benchmark. To avoid trivial adaptation to the benchmark, recent works manually exclude test corruptions from the training augmentations. However, with a toy experiment presented in Figure 1, we argue that this strategy alone might not be enough and that visually similar augmentation outputs and test corruptions can lead to significant benchmark improvements even if the exact corruption transformations are excluded.
20
+
21
+ ![](images/fe090e63eeb377f94bef1f6849361fcdef3729355d87e25cbd42014e40b03afb.jpg)
22
+ Figure 1: A toy experiment. We train multiple models on CIFAR-10 [17] using different augmentation schemes. Each scheme is based on a single basic image transformation type and enhanced by overlaying random instantiations of the transformation for each input image following Hendrycks et al. [14]. We compare these models on the CIFAR-10 test set corrupted by the motion blur, a corruption used in the ImageNet-C corruption benchmark [13]. None of the augmentation schemes contains motion blur; however, the models trained with geometric-based augmentations significantly outperform the baseline model trained on the clean images while color-based augmentations show no gains. We note the geometric augmentations can produce a result visually similar to a blur by overlaying copies of shifted images3.
23
+
24
+ This observation raises two important questions. One, how exactly does the similarity between train time augmentations and corruptions of the test set affect the error? And two, if the gains are due to the similarity, they may not translate into better robustness to other possible corruptions, so how well will data augmentations generalize beyond a given benchmark? In this work, we take a step towards answering these questions, with the goal of better understanding the relationship between data augmentation and test-time corruptions. Using a feature space on image transforms and a new measure called Minimal Sample Distance (MSD) on this space, we are able to quantify the distance between augmentation schemes and classes of corruption transformation. With our approach, we empirically show an intuitive yet surprisingly overlooked finding:
25
+
26
+ Augmentation-corruption perceptual similarity is a strong predictor of corruption error.
27
+
28
+ Based on this finding, we perform additional experiments to show that data augmentation aids corruption robustness by increasing perceptual similarity between a (possibly small) fraction of the training data and the test set. To further support our claims, we introduce a set of new corruptions, called CIFAR/ImageNet-C, to test the degree to which common data augmentation methods generalize from the original CIFAR/ImageNet-C. To choose these corruptions, we expand the set of natural corruptions and sample new corruptions that are far away from CIFAR/ImageNet-C in our feature space for measuring perceptual similarity. We then demonstrate that augmentation schemes designed specifically to improve robustness show significantly degraded performance on CIFAR/ImageNet-C. Some augmentation schemes still show some improvement over baseline, which suggests meaningful progress towards general corruption robustness is being made, but different augmentation schemes exhibit different degrees of generalization capability. As an implication, caution is needed for fair robustness evaluations when additional data augmentation is introduced.
29
+
30
+ These results suggest a major challenge that is often overlooked in the study of corruption robustness: generalization is often poor. Since perceptual similarity can predict performance, for any fixed finite set of test corruptions, improvements on that set may generalize poorly to dissimilar corruptions. We hope that these results, tools, and benchmarks will help researchers better understand why a given augmentation scheme has good corruption error and whether it should be expected to generalize to dissimilar corruptions. On the positive side, our experiments show that generalization does emerge among perceptually similar transforms, and that only a small fraction of sampled augmentations need to be similar to a given corruption. Section 6 discusses these points in more depth.
31
+
32
+ # 2 Related Work
33
+
34
+ Corruption robustness benchmarks and analysis. ImageNet-C [13] is a corruption dataset often used as a benchmark in robustness studies. Other corruption datasets [15, 27] collect corrupted images from real world sources and thus have a mixture of semantic distribution shifts and perceptual transforms. Corruption robustness differs from adversarial robustness [31], which seeks invariance to small, worst case distortions. One notable difference is that improving corruption robustness often slightly improves regular test error, instead of harming it. Yin et al. [38] analyzes corruption robustness in the context of transforms’ frequency spectra; this can also influence corruption error independently from perceptual similarity. Here we study the relationship between augmentations and corruptions more generically, and explore the relationship between perceptual similarity and generalization to new corruptions. Dao et al. [3] and Wu et al. [36] study the theory of data augmentation for regular test error. Hendrycks et al. [15] and Taori et al. [33] study how the performance on synthetic corruption transforms generalizes to performance on corruption datasets collected from the real world. Here we do not address this issue directly but touch upon it in the discussion.
35
+
36
+ Improving corruption robustness. Data augmentations designed to improve robustness include AugMix [14], which composites common image transforms, Patch Gaussian [20], which applies Gaussian noise in square patches, and ANT [25], which augments with an adversarially learned noise distribution. AutoAugment [2] learns augmentation policies that optimize clean error but has since been shown to improve corruption error [38]. Mixup [40] can improve robustness [18], but its label augmentation complicates the dependence on image augmentation. Stylized-ImageNet [9], which applies style transfer to input images, can also improve robustness. DeepAugment [15], which applies augmentations to a deep representation of an image, can also give large improvements in robustness. Noisy Student [37] and Assemble-ResNet [18] combine data augmentation with new models and training procedures and greatly enhance corruption robustness. In addition to training-time methods, there are approaches that adapt to unseen corruptions at test time, e.g. using self-supervised tasks [30], entropy minimization [35], or with a focus on privacy and data transmission efficiency [19]. While we do not directly address these approaches here, our methods potentially provide tools that could be used to measure shifting distributions in an online regime.
37
+
38
+ # 3 Perceptual similarity for augmentations and corruptions
39
+
40
+ First, we study the importance of similarity between augmentations and corruptions for improving performance on those corruptions. To do so, we need a means to compare augmentations and corruptions. Both types of transforms are perceptual in nature, meaning they affect low-level image structure while leaving high-level semantic information intact, so we expect a good distance to be a measure of perceptual similarity. Then, we need to find the appropriate measure of distance between the augmentation and corruption distributions. We will argue below that distributional equivalence is not appropriate in the context of corruption robustness, and instead introduce the minimal sample distance, a simple measure that does capture a relevant sense of distribution distance.
41
+
42
+ Measuring similarity between perceptual transforms. We define a perceptual transform as a transform that acts on low-level image structure but not high-level semantic information. As such, we expect two transforms should be similar if their actions on this low-level structure are similar, independent of algorithmic or per-pixel differences between them. A closely related, well-studied problem is the perceptual similarity between images. A common approach is to train a neural network on a classification task and use intermediate layers as a feature space for measuring distances [42]. We adapt this idea to obtain a feature space for measuring distances between perceptual transforms.
43
+
44
+ We start with a feature extractor for images, which we call $\hat { f } ( x )$ . To train the model from which we will extract features, we assume access to a dataset $\mathbb { D }$ of image label pairs $( x , y )$ associated with a classification task. The model should be trained using only default data augmentation for the task in question so that the feature extractor is independent of the transforms we will use it to study. In order to obtain a very simple measure, we use just the last hidden layer of the network as a feature space.
45
+
46
+ ![](images/8506044a99d204381d92eb25f104590e102c5d67dd35b62b1721d2730c035e11.jpg)
47
+ Figure 2: (a) Schematic comparison of MMD to MSD. MMD measures the distance between distribution centers and is only small if the augmentation overlaps with a corruption. MSD measures to the nearest sampled point in the set of samples (marked by a star) and is small even for broad distributions that overlap with multiple corruptions. (b) We test on images corrupted with impulse noise, and train on images augmented with a mixture of impulse noise and motion blur. As the mixing fraction of impulse noise decreases, MMD between the augmentation and corruption grows linearly while MSD and error stay low until nearly $0 \%$ mixing fraction.
48
+
49
+ A perceptual transform $t ( x )$ may be encoded by applying it to all images in $\mathbb { D }$ , encoding the transformed images, and averaging the features over these images. For efficiency, we find it sufficient to average over only a randomly sampled subset of images $\mathbb { D } _ { S }$ in $\mathbb { D }$ . In Section 4.1 we discuss the size of $\mathbb { D } _ { S }$ . The random choice of images is a property of the feature extractor, and so remains fixed when encoding multiple transforms. This reduces variance when computing distances between two transforms. The transform feature extractor is given by $f ( t ) = \mathbb { E } _ { x \in \mathbb { D } _ { S } } [ \hat { f } ( t ( x ) ) - \hat { f } ( x ) ]$ . The perceptual similarity between an augmentation and a corruption can be taken as the $L _ { 2 }$ distance on this feature space $f$ .
50
+
51
+ Minimal sample distance. We now seek to compare the distribution of an augmentation scheme $p _ { a }$ to a distribution of a corruption benchmark $p _ { c }$ . If the goal was to optimize error on a known corruption distribution, exact equivalence of distributions is the correct measure to minimize. But since the goal is robustness to general, unknown corruption distributions, a good augmentation scheme should be equivalent to no single corruption distribution.
52
+
53
+ To illustrate this behavior, consider a toy problem where we have access to the corruption transforms at training time. A very rough, necessary-but-insufficient measure of distributional similarity is $d _ { \mathrm { M M D } } ( p _ { a } , p _ { c } ) = | | \mathbb { E } _ { a \sim p _ { a } } [ f ( a ) ] - \mathbb { E } _ { c \sim p _ { c } } [ f ( c ) ] | |$ . This is the maximal mean discrepancy on a fixed, finite feature space, so for brevity we will refer to it as MMD. We still employ the featurization $f ( t )$ , since we are comparing transforms and not images, unlike in typical domain adaptation. Consider two corruption distributions, here impulse noise and motion blur, and an augmentation scheme that is a mixture of the two corruption distributions. Figure 2b shows MMD between the augmentation and impulse noise corruption scales linearly with mixing fraction, but error on impulse noise remains low until the mixing fraction is almost $0 \%$ impulse noise. This implies distributional similarity is a poor predictor of corruption error. Indeed, low $d _ { \mathrm { M M D } }$ with any one corruption distribution suggests the augmentation overlaps it significantly, so the augmentation is unlikely to aid dissimilar corruptions.
54
+
55
+ Our expectation for the behavior of the error in Figure 2b is that networks can often successfully memorize rare examples seen during training, so that only a very small fraction of sampled images need impulse noise augmentations to perform well on impulse noise corruptions. An appropriate distance should then measure how close augmentation samples can come to the corruption distribution, even if the density of those samples is low. We thus propose a very simple measure called minimal sample distance (MSD), which is just the perceptual similarity between an average corruption and the closest augmentation from a finite set of samples A $\sim p _ { a }$ :
56
+
57
+ $$
58
+ d _ { \mathrm { M S D } } ( p _ { a } , p _ { c } ) = \operatorname* { m i n } _ { a \in \mathbb { A } \sim p _ { a } } \left| | f ( a ) - \mathbb { E } _ { c \sim p _ { c } } [ f ( c ) ] | \right| .
59
+ $$
60
+
61
+ ![](images/33d3208269f30287d53a25941c7a175d6582d601676ec3c3f6f7abd703715409.jpg)
62
+ 18 7.012 6.0Figure 3: Example relationships between MSD and corruption error. $\rho$ is the Spearman rank 16 200.2 0.4 0.6 0.8 0.4 0.8 1.2 1.612 0.10 0.14 0.18 0.22correlation. MSD correlates well with error across all four categories of corruption in CIFAR-10-C. 14 16 Minimal Sample DistanceFor completeness, we also show brightness, a negative example where correlation is poor.
63
+
64
+ 0.2 0.4 0.6 0.8 0.4 0.8 1.2 1.6 0.10 0.14 0.18 0.22A schematic comparison of MMD and MSD is shown in Figure 2a. While both MMD and MSD Minimal Sample Distanceare small for an augmentation scheme that is distributionally similar to a corruption distribution, only MSD remains small for a broad distribution that occasionally produces samples near multiple corruption distributions. Figure 2b shows MSD, like test error, is small for most mixing fractions in the toy problem described above. Note the measure’s need to accommodate robustness to general, unknown corruption distributions has led it to be asymmetric, so it differs from more formal distance metrics that may be used to predict generalization error, such as the Wasserstein distance [43].
65
+
66
+ # 4 Perceptual similarity is predictive of corruption error
67
+
68
+ We are now equipped to measure how important this augmentation-corruption similarity is for corruption error. For a large number of augmentation schemes, we will measure both the MSD to a corruption distribution and the corruption error of a model trained with that scheme. We will find a correlation between MSD and corruption error, which provides evidence that networks generalize across perceptually similar transforms. Then, we will calculate MSD for augmentation schemes in the literature that have been shown to improve error on corruption benchmarks. We will find a correlation between MSD and error here as well, suggesting their success is in part explained by their perceptual similarity to the benchmark. This implies there may be a risk of poor generalization to different benchmarks, since we would not expect this improvement to transfer to a dissimilar corruption.
69
+
70
+ # 4.1 Experimental setup
71
+
72
+ Corruptions. We use CIFAR-10-C [13], which is a common benchmark used for studying corruption robustness. It consists of 15 corruptions, each further split into five different severities of transformation, applied to the CIFAR-10 test set. The 15 corruptions fall into four categories: per-pixel noise, blurring, synthetic weather effects, and digital transforms. We treat each corruption at each severity as a separate distribution for the sake of calculating MSD and error; however, for simplicity we average errors and distances over severity to present a single result per corruption.
73
+
74
+ Space of augmentation schemes. To build each sampled augmentation transform, we will composite a set of base augmentations. For base augmentations, we consider the nine common image transforms used in Hendrycks et al. [14]. There are five geometric transforms and four color transforms. By taking all subsets of these base augmentations, we obtain $2 ^ { 9 } = 5 1 2$ unique augmentation schemes, collectively called the augmentation powerset. Also following Hendrycks et al. [14], we composite transforms in two ways: by applying one after another, or by applying them to copies of the image and then linearly superimposing the results. Examples of both augmentations and corruptions are provided in Appendix F.
75
+
76
+ Computing similarity and corruption error. A WideResNet-40-2 [39] model is pre-trained on CIFAR-10 using default augmentation and training parameters from Hendrycks et al. [14]. WideResNet is a common baseline model used when studying data augmentation on CIFAR-10 [2, 14, 40]. Its last hidden layer is used as the feature space. For MSD, we average over 100 images, 100 corruptions, and minimize over $1 0 0 \mathrm { k }$ augmentations. With this number of corruptions and images, we find that the average standard deviation in distance between an augmentation and the averaged corruptions is roughly five percent of the mean, which is smaller than the typical feature in our results found below, given in Figure 3. We also find that using VGG [29] instead of WideResNet for the feature extractor
77
+
78
+ ![](images/754ebcaed957914f40b406c3c5651bb1eefe20c091f79274177833423931217a.jpg)
79
+ 25 w/ solarize w/ x-translationFigure 4: Example relationships between base augmentations and corruptions. Including solarize 10reduces MSD on the perceptually similar impulse noise corruption. Including $x$ translation reduces 20MSD on the perceptually similar motion blur corruption. MSD is not decreased for dissimilar Minimum Sample D augmentation-corruption pairs.
80
+
81
+ 10gives similar results. Details for these calculations are in Appendix C. Images for calculating MSD are from the training set and do not have default training augmentation. A WideResNet-40-2 with the 0.2 0.6 1.0 1.4 0.2 0.6 1.0 1.4same training parameters is used for corruption error evaluation.
82
+
83
+ # 4.2 Analysis
84
+
85
+ MSD correlates with corruption error. First, we establish the correlation between MSD and corruption error on the augmentation powerset. MSD shows strong correlation with corruption error across corruptions types in all four categories of CIFAR-10-C, and for a large majority of CIFAR-10-C corruptions in general: 12 of 15 have Spearman rank correlation greater than 0.6. Figure 3 shows the relationship between distance and corruption error on six example corruptions, including one negative example for which correlation is low. A complete set of plots is below in Figure 5. This corruption, brightness, may give poor results because it is a single low-level image statistic that can vary significantly from image to image, and thus may not be well represented by our feature extractor. Appendix B has a few supplemental experiments. First, we we confirm MMD correlates poorly with corruption error, as expected. In particular, we expect broad augmentation schemes produce samples similar to a larger set of corruptions, leading to both lower MSD and lower corruption error but higher MMD. Second, we repeat our experiment but do not train on the augmentations, instead only adapting the batch norm statistics of a pre-trained model to them. We still find a strong correlation, suggesting our methods are compatible with the results of Schneider et al. [26], which shows such an adaptation of the batch norm statistics to a corruption can improve corruption error.
86
+
87
+ An example of perceptual similarity. Here we illustrate the perceptual nature of the similarity measure, using an example with two base augmentations and two corruptions. The augmentation solarize and the corruption impulse noise both insert bright pixels into the image, though in different ways. Linear superpositions of the augmentation $x$ translation are visually similar to a blur, such as the corruption motion blur. Figure 4 shows MSD vs error where augmentation schemes that include solarize and $x$ translation are colored. It is clear that including an augmentation greatly decreases MSD to its perceptually similar corruption, while having little effect on MSD to its perceptually dissimilar corruption.
88
+
89
+ MSD and corruption error in real augmentation methods. The augmentation powerset may be used as a baseline for comparing real data augmentation schemes. Figure 5 shows MSD-error correlations for Patch Gaussian [20], AutoAugment [2], and Augmix [14], along with the cloud of augmentation powerset points for all 15 CIFAR-10-C corruptions. The real augmentation schemes follow the same general trend that lower error predicts lower MSD. A few intuitive correlations are also captured in Figure 5. Patch Gaussian has low MSD to noise corruptions. AutoAugment, which contains contrast and Gaussian blurring augmentations in its sub-policies, has low MSD with contrast and defocus blur. A negative example is fog, on which MSD to AutoAugment is not predictive of corruption error.
90
+
91
+ This correlation suggests generalization may be poor beyond an existing benchmark, since an augmentation scheme may be perceptually similar to one benchmark but not another. For augmentations and corruptions that are explicitly the same, such as contrast in AutoAugment and ImageNet-C, this is typically accounted for by removing such transforms from the augmentation scheme when testing corruption robustness4. But in addition to these explicit similarities, Figure 5 shows quantitatively that perceptual similarity between non-identical augmentations and corruptions is also strongly predictive of corruption error. This includes possibly unexpected similarities, such as between Patch Gaussian and glass blur, which introduces random pixel-level permutations as noise. This suggests that perceptually similar augmentations and corruptions should be treated with the same care as identical transforms. In particular, tools such as MSD help us determine why an augmentation scheme improves corruption error, so we can better understand if new methods will generalize beyond their tested benchmarks. Next we test this generalization by finding corruptions dissimilar to ImageNet-C.
92
+
93
+ ![](images/d4816a08ab544b8902c76e2ed306197c37edf23422e76c702e28ac2d93da066d.jpg)
94
+ Figure 5: Correlations for augmentation schemes from the literature. Patch Gaussian is similar to noise, while AutoAugment is similar to contrast and blur, as expected from their formulation. Glass blur acts more like a noise corruption than a blur for these augmentation schemes, likely because it randomly permutes pixels. As a negative example, MSD does not correlate well with error for AutoAugment on fog. \*AugMix here refers to just the augmentation distribution in Hendrycks et al. [14], not the proposed Jensen-Shannon divergence loss.
95
+
96
+ # 5 ImageNet-C: benchmarking with dissimilar corruptions
97
+
98
+ We now introduce a set of corruptions, called ImageNet-C, that are perceptually dissimilar to ImageNet-C in our transform feature space, and we will show that several augmentation schemes have degraded performance on the new dataset. We emphasize that the dataset selection method uses only default data augmentation and was fixed before we looked at the results for different augmentations, so we are not adversarially selecting against the tested augmentation schemes.
99
+
100
+ Dataset construction. Here we present an overview of the dataset construction method. We build 30 new corruptions in 10 severities, from which the 10 most dissimilar corruptions will be chosen. We adapt common filters and noise distributions available online [10, 16] to produce human interpretable images. The transforms include warps, blurs, color distortions, noise additions, and obscuring effects. Examples of the new corruptions and exact details of the construction method are provided in Appendices D and F.
101
+
102
+ ![](images/47e802717f039011da8d3fa76d9b4cc61d83551f82c9eb8df720c25f4de6d572.jpg)
103
+ Brown Noise Checkerboard Cocentric Sine Waves Perlin Noise Single Frequency NoiseImageNet-C CorruptionsFigure 6: Example CIFAR-10-C and ImageNet-C corruptions. While still human interpretable, new corruptions are sampled to be dissimilar from CIFAR-10/ImageNet-C. Base images $^ ©$ Sehee Park and Chenxu Han.
104
+
105
+ Blue Noise Sample Caustic Refraction Inverse Sparkle Plasma Noise SparklesTo assure that the new dataset is no harder than ImageNet-C, we restrict the average corruption error of the new dataset to be similar to that of ImageNet-C for default augmentation. We then generate many potential datasets and measure the average shift in distance to ImageNet-C that each corruption contributes. Note that while MSD is a measure between augmentations and corruptions, here we are comparing corruptions to other corruptions and thus use MMD in our transform feature space. ImageNet-C then consists of the 10 corruptions types with the largest average shift in distance. Like ImageNet-C, each has five different severities, with severities chosen so that the average error matches ImageNet-C for default augmentation. Example transforms from ImageNet-C and CIFAR-10-C are shown in Figure 6. This procedure in our feature space produces corruptions intuitively dissimilar from ImageNet-C and CIFAR-10-C.
106
+
107
+ Results. We test AutoAugment [2], Patch Gaussian [20], AugMix [14], $\mathbf { A N T } ^ { 3 \mathrm { x } 3 }$ [25], StylizedImageNet [9], and DeepAugment [15] on our new datasets and show results in Table 1. CIFAR-10 models are WideResNet-40-2 with training parameters from Hendrycks et al. [14]. ImageNet [4] models are ResNet-50 [12] with training parameters from Goyal et al. [11]. Stylized-ImageNet is trained jointly with ImageNet for half the epochs and starts from a model pre-trained on ImageNet, following Geirhos et al. [9]. Models use default data augmentation as well as the augmentation being tested, except ImageNet color jittering is not used. All corruptions are applied in-memory instead of loaded from a compressed file; this can affect results especially on high frequency corruptions.
108
+
109
+ Since Section 4 suggests several augmentation schemes are perceptually similar to ImageNet-C corruptions, we might expect these methods to have worse error on the new corruptions. Indeed, every augmentation scheme performs worse. Different augmentation schemes also degrade by significantly different amounts, from $+ 0 . 7 \%$ for AutoAugment to $+ 7 . 3 \%$ for PatchGaussian, which changes their ranking by corruption error and leads to inconsistency of generalization. In Table 2, we compare performance on several robust models[7, 21, 22, 32, 34, 37, 41] that are not primarily augmentationbased and see no similar pattern of degradation, further suggesting that augmentation-corruption dissimilarity is the cause of the higher error.
110
+
111
+ Errors of individual corruptions in ImageNet-C are also revealing. For all augmentation schemes, there is significant improvement on blue sample noise5 but little improvement on sparkles or inverse sparkles. Only AutoAugment does well on checkerboard, perhaps because only AutoAugment’s geometric transforms produce empty space, similar to checkerboard’s occluded regions. These examples suggest a slightly different benchmark could yield significantly different results. Indeed, for a hypothetical benchmark that excluded blue sample noise and checkerboard, AutoAugment and Patch Gaussian have $5 7 . 3 \%$ and $5 7 . 2 \%$ error respectively, little better than baseline of $5 7 . 4 \%$ . AugMix fairs only a little better with $5 4 . 3 \%$ error. Even DeepAugment+AugMix, which is in general a strong augmentation scheme, shows a big discrepancy in performance across different corruptions, improving single frequency noise by $31 \%$ , but inverse sparkles by only $2 . 3 \%$ . Generalization to dissimilar corruptions is thus both inconsistent and typically quite poor. Single benchmarks and aggregate corruption scores are likely not enough for careful evaluation of robustness to unknown corruptions, and it is important to study why proposed augmentations succeed to better understand how well they might generalize.
112
+
113
+ Table 1: Test error for several data augmentation methods on CIFAR-10-C and ImageNet-10- $\overline { { C } }$ , for which every method performs worse than on ImageNet-C or CIFAR-10-C. The increase in error differs significantly between different augmentation methods. Descriptions of the abbreviations and standard deviations for individual corruptions are in Appendix D. ‘Baseline’ refers to default augmentation only. Averages are over five runs for ImageNet and ten for CIFAR-10. \*ANT, DeepAugment(DA) and DeepAugment+AugMix $( \mathrm { D A } { + } \mathrm { A M } )$ use the pre-trained model provided with the associated papers and have different training parameters.
114
+
115
+ <table><tr><td rowspan="2">Aug</td><td rowspan="2">IN-C Err</td><td colspan="2">IN-C</td><td colspan="10">ImageNet-C Corruptions</td></tr><tr><td>Err</td><td>△IN-C</td><td>BSmpl Plsm</td><td></td><td>Ckbd</td><td>CSin</td><td>SFrq</td><td>Brwn</td><td>Prln</td><td>Sprk</td><td>ISprk</td><td>Rfrac</td></tr><tr><td>Baseline</td><td></td><td>58.1±0.4 57.7±0.2</td><td>-0.4</td><td>68.6</td><td>71.7</td><td>49.4</td><td>84.7</td><td>79.0</td><td>37.5</td><td>34.3</td><td>32.4</td><td>76.7</td><td>42.8</td></tr><tr><td>AA</td><td>55.0±0.2</td><td>55.7±0.3</td><td>+0.7</td><td>54.8</td><td>68.3</td><td>43.8</td><td>86.5</td><td>78.8</td><td>34.5</td><td>33.8</td><td>36.1</td><td>77.1</td><td>43.8</td></tr><tr><td>SIN</td><td>52.4±0.1</td><td>55.8±0.3</td><td>+3.4</td><td>54.7</td><td>69.8</td><td>52.8</td><td>79.6</td><td>69.2</td><td>37.8</td><td>35.3</td><td>37.0</td><td>77.3</td><td>44.1</td></tr><tr><td>AugMix</td><td>49.2 ±0.7</td><td>52.4±0.2</td><td>+3.2</td><td>43.2</td><td>72.2</td><td>46.1</td><td>76.3</td><td>67.4</td><td>38.8</td><td>32.4</td><td>32.3</td><td>76.4</td><td>39.2</td></tr><tr><td>PG</td><td>49.3 ±0.2</td><td>56.6±0.4</td><td>+7.3</td><td>60.3</td><td>74.1</td><td>48.5</td><td>82.1</td><td>76.7</td><td>38.9</td><td>34.6</td><td>32.1</td><td>76.5</td><td>42.1</td></tr><tr><td>ANT*</td><td>48.8</td><td>53.9</td><td>+5.1</td><td>35.8</td><td>75.5</td><td>56.9</td><td>76.4</td><td>63.7</td><td>41.0</td><td>35.2</td><td>35.0</td><td>76.1</td><td>43.3</td></tr><tr><td>DA*</td><td>46.6</td><td>51.0</td><td>+4.4</td><td>41.7</td><td>73.3</td><td>53.9</td><td>74.6</td><td>50.9</td><td>37.2</td><td>30.3</td><td>32.9</td><td>74.7</td><td>40.9</td></tr><tr><td>DA+AM*</td><td>41.0</td><td>48.3</td><td>+7.3</td><td>34.9</td><td>67.9</td><td>49.8</td><td>69.7</td><td>48.0</td><td>35.2</td><td>30.6</td><td>32.9</td><td>74.3</td><td>39.8</td></tr><tr><td></td><td>C10-C</td><td colspan="2">C10-C</td><td></td><td></td><td></td><td>CIFAR-10-C</td><td></td><td>Corruptions</td><td></td><td></td><td></td><td></td></tr><tr><td>Aug</td><td>Err</td><td>Err</td><td>△C10-C</td><td>BSmpl Brwn</td><td></td><td>Ckbd</td><td>CBlur]</td><td>ISprk</td><td>Line</td><td>P&amp;T</td><td>Rppl</td><td>Sprk</td><td>TCA</td></tr><tr><td>Baseline</td><td></td><td>27.0±0.6 27.1 ±0.5</td><td>+0.1</td><td>42.9</td><td>27.2</td><td>23.3</td><td>11.8</td><td>43.3</td><td>26.2</td><td>11.3</td><td>21.6</td><td>21.0</td><td>42.9</td></tr><tr><td>AA</td><td>19.4±0.2</td><td>21.0±0.4</td><td>+1.6</td><td>17.7</td><td>17.5</td><td>17.6</td><td>9.5</td><td>40.4</td><td>23.6</td><td>10.7</td><td>23.5</td><td>17.5</td><td>31.8</td></tr><tr><td>AugMix</td><td>11.1±0.2</td><td>16.0±0.3</td><td>+5.9</td><td>9.8</td><td>27.8</td><td>13.4</td><td>5.9</td><td>30.3</td><td>18.0</td><td>8.3</td><td>12.1</td><td>15.5</td><td>19.2</td></tr><tr><td>PG</td><td>17.0±0.3</td><td>23.8±0.5</td><td>+6.8</td><td>9.0</td><td>30.1</td><td>21.6</td><td>12.8</td><td>35.4</td><td>20.6</td><td>8.8</td><td>21.5</td><td>19.3</td><td>59.5</td></tr></table>
116
+
117
+ Table 2: Comparison of errors on ImageNet-C and ImageNet-C for several robust models: WSL (weakly supervised ResNeXt-101-32x8d [21, 22]), EN (EfficientNet-B0 [32]), NS (Noisy Student EN-B0 [37]), ViT-S (Transformer [7, 34]), ResNeSt (ResNeSt-50d, [41]), using pre-trained models provided with the respective papers. These models do not rely primarily on data augmentation to be robust, and there is no consistent degradation on ImageNet-C. This is additional evidence that the worse performance in Table 1 does not occur because ImageNet-C is harder generally.
118
+
119
+ <table><tr><td></td><td>WSL</td><td>EN</td><td>NS</td><td>ViT-S</td><td>ResNeSt</td></tr><tr><td>IN-C Err</td><td>38.1</td><td>55.7</td><td>52.1</td><td>44.5</td><td>44.4</td></tr><tr><td>IN-CErr</td><td>39.2</td><td>53.4</td><td>52.2</td><td>41.1</td><td>41.6</td></tr></table>
120
+
121
+ It may be surprising that Stylized-ImageNet also degrades, given that it is intuitively very different from every corruption. While our measure works for augmentations, it does not cover all possible methods that improve robustness, such as more complicated algorithms like Stylized-ImageNet. Stylized-ImageNet degradation may be due to other reasons. For instance, it primarily augments texture information and may help mostly with higher frequency corruptions, as can be seen by its improvement on single frequency noise and cocentric sine waves; ImageNet-C has fewer such corruptions than ImageNet-C. ImageNet-C is thus a useful tool for understanding the interaction between training procedure and corruption distribution, even beyond perceptual similarity.
122
+
123
+ Nevertheless, note that it is the intuitively broader augmentation schemes, such as AutoAugment, AugMix, Stylized-ImageNet, and DeepAugment that generalize better to ImageNet-C. The importance of breadth has also been explored elsewhere[15, 38], but in the previous sections we have provided new quantitative evidence for why this may be true: broad augmentation schemes may be perceptually similar to more types of corruptions, and thus more likely to be perceptually similar to a new corruption. Moreover, AugMix and DeepAugment still improve over baseline on ImageNet-C, so there is reason to be optimistic that robustness to unknown corruptions is an achievable goal, as long as evaluation is treated carefully.
124
+
125
+ # 6 Discussion
126
+
127
+ Societal Impact. Our method for finding dissimilar corruptions could in principle be used to adversarially attack computer vision systems, such as those in content moderation or self-driving cars. Moreover, our ultimate goal is to help improve robustness in computer vision, and such robust systems may be used in detrimentals ways, for example in autonomous weapons or surveillance. However, we expect better evaluation of robust models to have definite benefits as well. In the long run, such an understanding should help defend against adversarial attacks. Our tools could also be used to challenge purportedly robust systems that are actually dangerously unreliable, such as an autonomous driving system that is robust to common corruption benchmarks yet fails to be robust to a dissimilar but important corruption, e.g., maybe glare. For instance, is the model employing data augmentation that is perceptually similar to the corruptions being used to report good robustness? Is the set of validation corruptions sufficiently broad that we would expect reasonable generalization to an unseen corruption? If we generate a dissimilar set of corruptions using the procedure we develop here, does the model still perform well on the new corruptions? Quantitative ways to answer these questions may provide a means to verify the robust performance of a model before it encounters and potentially fails on a critical, previously unseen corruption.
128
+
129
+ Corruption robustness as a secondary learning task. We have provided evidence that data augmentation may not generalize well beyond a given corruption benchmark. To explore this further, consider an analogy to a regular learning problem. We may think of corruption robustness in the presence of data augmentation as a sort of secondary task layered on the primary classification task: the set of data augmentations is the training set, the set of corruptions is the test set, and the goal is to achieve invariance of the underlying primary task. In this language, the ‘datasets’ involved are quite small: ImageNet-C has only 15 corruption types, and several augmentation schemes composite only around 10 basic transforms. In this case, standard machine learning practice would dictate a training/validation/test set split; it is only the size and breadth of modern vision datasets that has allowed this to be neglected in certain cases recently. But the effective dataset size of a corruption robustness problem is tiny, so having a held-out test set seems necessary. To emphasize, this is not a test set of the underlying classification task, for which generalization has been studied by Recht et al. [23, 24]. Instead, it is a test set of corruption transforms themselves. This means there would be validation/test split of dissimilar transformations, both applied to the ImageNet validation set6.
130
+
131
+ Real-world corruption robustness. Recently, Hendrycks et al. [15] and Taori et al. [33] study how performance on corruption transforms generalizes to real-world corruptions and come to conflicting conclusions. Though we do not study real-world corruptions, we have proposed a mechanism that may explain the conflict: performance will generalize between transforms and real-world corruptions if they are perceptually similar, but will likely not if they are dissimilar. Since Hendrycks et al. [15] and Taori et al. [33] draw on different real-world and synthetic corruptions, it may be that the perceptual similarity between datasets differs in the two analyses. This also suggests a way to find additional corruption transforms that correlate with real-world corruptions: transforms should be sought that have maximal perceptual similarity with real-world corruptions.
132
+
133
+ Generalization does occur. We have encountered two features of data augmentation that may explain why it can be such a powerful tool for corruption robustness, despite the issues discussed above. First, within a class of perceptually similar transforms, generalization does occur. This means each simple data augmentation may confer robustness to many complicated corruptions, as long as they share perceptual similarity. Second, dissimilar augmentations in an augmentation scheme often causes little to no loss in performance, as long as a similar augmentation is also present. We briefly study this in Appendix A by demonstrating that adding many dissimilar augmentations increases error much less than adding a few similar augmentations decreases it. These two features suggest broad augmentation schemes with many dissimilar augmentations may confer robustness to a large class of unknown corruptions. More generally, we think data augmentation is a promising direction of study for corruption robustness, as long as significant care is taken in evaluation.
134
+
135
+ # Acknowledgements and Funding Disclosure
136
+
137
+ Eric Mintun would like to thank Matthew Leavitt, Sho Yaida, and Achal Dave for discussions during the development of this work. Additionally, he would like to acknowledge the Facebook AI residency program for providing excellent training and support in AI research. The authors received no external funding and have no competing interests.
138
+
139
+ References
140
+ [1] Bruna, J. and Mallat, S. Invariant scattering convolution networks. IEEE transactions on pattern analysis and machine intelligence, 35(8):1872–1886, 2013.
141
+ [2] Cubuk, E. D., Zoph, B., Mané, D., Vasudevan, V., and Le, Q. V. AutoAugment: Learning augmentation strategies from data. In CVPR, 2019.
142
+ [3] Dao, T., Gu, A., Ratner, A. J., Smith, V., De Sa, C., and Ré, C. A kernel theory of modern data augmentation. Proceedings of machine learning research, 97:1528, 2019.
143
+ [4] Deng, J., Dong, W., Socher, R., Li, L.-J., Li, K., and Fei-Fei, L. ImageNet: A large-scale hierarchical image database. In CVPR, 2009.
144
+ [5] Ding, K., Ma, K., Wang, S., and Simoncelli, E. P. Image quality assessment: Unifying structure and texture similarity. IEEE transactions on pattern analysis and machine intelligence, 2020.
145
+ [6] Dodge, S. and Karam, L. A study and comparison of human and deep learning recognition performance under visual distortions. In ICCCN, 2017.
146
+ [7] Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., Uszkoreit, J., and Houlsby, N. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
147
+ [8] Geirhos, R., Temme, C. R., Rauber, J., Schütt, H. H., Bethge, M., and Wichmann, F. A. Generalisation in humans and deep neural networks. In NeurIPS, 2018.
148
+ [9] Geirhos, R., Rubisch, P., Michaelis, C., Bethge, M., Wichmann, F. A., and Brendel, W. ImageNet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness. In ICLR, 2019.
149
+ [10] Gladman, S. J. Filterpedia, 2016. URL https://github.com/FlexMonkey/Filterpedia.
150
+ [11] Goyal, P., Dollár, P., Girshick, R., Noordhuis, P., Wesolowski, L., Kyrola, A., Tulloch, A., Jia, Y., and He, K. Accurate, large minibatch SGD: Training ImageNet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
151
+ [12] He, K., Zhang, X., Ren, S., and Sun, J. Deep residual learning for image recognition. In CVPR, 2016.
152
+ [13] Hendrycks, D. and Dietterich, T. Benchmarking neural network robustness to common corruptions and perturbations. In ICLR, 2018.
153
+ [14] Hendrycks, D., Mu, N., Cubuk, E. D., Zoph, B., Gilmer, J., and Lakshminarayanan, B. AugMix: A simple data processing method to improve robustness and uncertainty. In ICLR, 2019.
154
+ [15] Hendrycks, D., Basart, S., Mu, N., Kadavath, S., Wang, F., Dorundo, E., Desai, R., Zhu, T., Parajuli, S., Guo, M., Song, D., Steinhardt, J., and Gilmer, J. The many faces of robustness: A critical analysis of out-of-distribution generalization. arXiv preprint arXiv:2006.16241, 2020.
155
+ [16] Huxtable, J. JH Labs Java Image Processing, 2006. URL http://www.jhlabs.com/ip/ filters/.
156
+ [17] Krizhevsky, A., Hinton, G., et al. Learning multiple layers of features from tiny images. 2009.
157
+ [18] Lee, J., Won, T., and Hong, K. Compounding the performance improvements of assembled techniques in a convolutional neural network. arXiv preprint arXiv:2001.06268, 2020.
158
+ [19] Liang, J., Hu, D., and Feng, J. Do we really need to access the source data? source hypothesis transfer for unsupervised domain adaptation. In International Conference on Machine Learning, pp. 6028–6039. PMLR, 2020.
159
+ [20] Lopes, R. G., Yin, D., Poole, B., Gilmer, J., and Cubuk, E. D. Improving robustness without sacrificing accuracy with Patch Gaussian augmentation. arXiv preprint arXiv:1906.02611, 2019.
160
+ [21] Mahajan, D., Girshick, R., Ramanathan, V., He, K., Paluri, M., Li, Y., Bharambe, A., and van der Maaten, L. Exploring the limits of weakly supervised pretraining. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 181–196, 2018.
161
+ [22] Orhan, A. E. Robustness properties of Facebook’s ResNeXt WSL models. arXiv preprint arXiv:1907.07640, 2019.
162
+ [23] Recht, B., Roelofs, R., Schmidt, L., and Shankar, V. Do CIFAR-10 classifiers generalize to CIFAR-10? arXiv preprint arXiv:1806.00451, 2018.
163
+ [24] Recht, B., Roelofs, R., Schmidt, L., and Shankar, V. Do ImageNet classifiers generalize to ImageNet? In ICML, 2019.
164
+ [25] Rusak, E., Schott, L., Zimmermann, R., Bitterwolf, J., Bringmann, O., Bethge, M., and Brendel, W. A simple way to make neural networks robust against diverse image corruptions. arXiv preprint arXiv:2001.06057, 2020.
165
+ [26] Schneider, S., Rusak, E., Eck, L., Bringmann, O., Brendel, W., and Bethge, M. Improving robustness against common corruptions by covariate shift adaptation. In NeurIPS, 2020.
166
+ [27] Shankar, V., Dave, A., Roelofs, R., Ramanan, D., Recht, B., and Schmidt, L. Do image classifiers generalize across time? arXiv preprint arXiv:1906.02168, 2019.
167
+ [28] Simard, P. Y., LeCun, Y. A., Denker, J. S., and Victorri, B. Transformation invariance in pattern recognition—tangent distance and tangent propagation. In Neural networks: tricks of the trade, pp. 239–274. Springer, 1998.
168
+ [29] Simonyan, K. and Zisserman, A. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
169
+ [30] Sun, Y., Wang, X., Liu, Z., Miller, J., Efros, A., and Hardt, M. Test-time training with selfsupervision for generalization under distribution shifts. In International Conference on Machine Learning, pp. 9229–9248. PMLR, 2020.
170
+ [31] Szegedy, C., Zaremba, W., Sutskever, I., Bruna, J., Erhan, D., Goodfellow, I., and Fergus, R. Intriguing properties of neural networks. In ICLR, 2014.
171
+ [32] Tan, M. and Le, Q. EfficientNet: Rethinking model scaling for convolutional neural networks. In ICML, 2019.
172
+ [33] Taori, R., Dave, A., Shankar, V., Carlini, N., Recht, B., and Schmidt, L. Measuring robustness to natural distribution shifts in image classification. In NeurIPS, 2020.
173
+ [34] Touvron, H., Cord, M., Douze, M., Massa, F., Sablayrolles, A., and Jégou, H. Training dataefficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020.
174
+ [35] Wang, D., Shelhamer, E., Liu, S., Olshausen, B., and Darrell, T. Tent: Fully test-time adaptation by entropy minimization. ICLR, 2021.
175
+ [36] Wu, S., Zhang, H. R., Valiant, G., and Ré, C. On the generalization effects of linear transformations in data augmentation. In ICML, 2020.
176
+ [37] Xie, Q., Luong, M.-T., Hovy, E., and Le, Q. V. Self-training with Noisy Student improves imagenet classification. In CVPR, 2020.
177
+ [38] Yin, D., Lopes, R. G., Shlens, J., Cubuk, E. D., and Gilmer, J. A Fourier perspective on model robustness in computer vision. In NeurIPS, 2019.
178
+ [39] Zagoruyko, S. and Komodakis, N. Wide residual networks. In BMVC, 2016.
179
+ [40] Zhang, H., Cisse, M., Dauphin, Y. N., and Lopez-Paz, D. mixup: Beyond empirical risk minimization. In ICLR, 2018.
180
+ [41] Zhang, H., Wu, C., Zhang, Z., Zhu, Y., Zhang, Z., Lin, H., Sun, Y., He, T., Muller, J., Manmatha, R., Li, M., and Smola, A. ResNeSt: Split-Attention Networks. arXiv preprint arXiv:2004.08955, 2020.
181
+ [42] Zhang, R., Isola, P., Efros, A. A., Shechtman, E., and Wang, O. The unreasonable effectiveness of deep features as a perceptual metric. In CVPR, 2018.
182
+ [43] Zilly, J., Zilly, H., Richter, O., Wattenhofer, R., Censi, A., and Frazzoli, E. The Frechet Distance of training and test distribution predicts the generalization gap. OpenReview preprint, 2019. URL https://openreview.net/forum?id $\cdot ^ { = }$ SJgSflHKDr.
md/train/LoUdcqLuPej/LoUdcqLuPej.md ADDED
@@ -0,0 +1,360 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Learning Generative Vision Transformer with Energy-Based Latent Space for Saliency Prediction
2
+
3
+ Jing Zhang1, Jianwen Xie1, Nick Barnes2, Ping Li1 1 Cognitive Computing Lab, Baidu Research 2 The Australian National University {zjnwpu, jianwen.kenny, pingli98} $@$ gmail.com, nick.barnes@anu.edu.au
4
+
5
+ # Abstract
6
+
7
+ Vision transformer networks have shown superiority in many computer vision tasks. In this paper, we take a step further by proposing a novel generative vision transformer with latent variables following an informative energy-based prior for salient object detection. Both the vision transformer network and the energy-based prior model are jointly trained via Markov chain Monte Carlo-based maximum likelihood estimation, in which the sampling from the intractable posterior and prior distributions of the latent variables are performed by Langevin dynamics. Further, with the generative vision transformer, we can easily obtain a pixel-wise uncertainty map from an image, which indicates the model confidence in predicting saliency from the image. Different from the existing generative models which define the prior distribution of the latent variables as a simple isotropic Gaussian distribution, our model uses an energy-based informative prior which can be more expressive to capture the latent space of the data. We apply the proposed framework to both RGB and RGB-D salient object detection tasks. Extensive experimental results show that our framework can achieve not only accurate saliency predictions but also meaningful uncertainty maps that are consistent with the human perception.
8
+
9
+ # 1 Introduction
10
+
11
+ In the field of computer vision, salient object detection [64, 65, 16, 17, 5, 89] (SOD) or visual saliency prediction, which aims at highlighting objects more attentive than the surrounding areas in images, has achieved significant performance improvement with the deep convolutional neural network revolution. Given a set of training images along with their saliency annotations, the conventional SOD models seek to learn a deterministic one-to-one mapping from image domain to saliency domain.
12
+
13
+ Two main issues exist in the above conventional deep saliency prediction framework: (i) the convolution operation based on sliding window makes the deep saliency prediction model less effective in modeling the global contrast of the image, which is essential for salient object detection [7]; (ii) the one-to-one deterministic mapping mechanism makes the current framework not only impossible to represent the pixel-wise uncertainty in predicting salient objects, but also hard to handle incomplete data in a weakly supervised scenario [89]. Besides, given an image, the saliency output of a human is subjective, therefore, a stochastic generative model is more natural than a deterministic model for representing saliency prediction. Although [85] introduces a conditional variational autoencoder (CVAE) [56] for RGB-D salient object detection, the potential posterior collapse problem [23] makes the stochastic predictions less effective in generating meaningful uncertainty estimation.
14
+
15
+ Motivated by the above two issues, we propose a novel framework, the generative vision transformer, for salient object detection, where a vision transformer structure [40] is used as a backbone and latent variables are introduced in designing our generative framework. On the one hand, transformers [60] have proven to be very effective in long-range dependency modeling, and are capable of modeling various scopes of object context information with the multi-head self-attention module. With such an architecture, we can achieve global context modeling for effective salient object detection. On the other hand, the latent variables account for randomness and uncertainty in modeling the mapping from image domain to saliency domain, and also enable the model to produce stochastic saliency predictions for uncertainty estimation. Therefore, the proposed model is a latent variable transformer.
16
+
17
+ Nowadays, there are two types of generative models that have been widely used, namely the variational autoencoder (VAE) [31] and the generative adversarial network (GAN) [20], which correspond to two different generative learning strategies to train latent variable models. To train a top-down latent variable generator, the VAE introduces an extra encoder to approximate the intractable posterior distribution of the latent variables, and trains the generator via a perturbation of maximum likelihood; while the GAN introduces a discriminator to distinguish between generated samples and real data, and trains the generator to fool the discriminator. [22, 69] present the third learning strategy, namely alternating back-propagation (ABP), to train the generator with latent variables being directly sampled from the true posterior distribution by using a gradient-based Markov chain Monte Carlo (MCMC) [38], e.g., Langevin dynamics [43, 66, 12]. All the three generative models define the prior distribution of the latent variables as a simple non-informative isotropic Gaussian distribution, which is less expressive in capturing meaningful latent representation of the data.
18
+
19
+ In this paper, we investigate generative modeling and learning of the vision transformer. We construct a generative model for salient object detection in the form of a top-down conditional latent variable model. Specifically, we propose a generative vision transformer by adding latent variables into the traditional deterministic vision transformer, and assume the latent variables follow an informative trainable energy-based prior distribution [47, 48]. Following [72], we parameterize the energy function of the energy-based model (EBM) by a deep net. Instead of using variational learning or adversarial learning, we jointly train the parameters of the EBM prior and the transformer network by maximum likelihood estimation (MLE). The MLE algorithm relies on MCMC sampling to evaluate the intractable prior and posterior distributions of the latent variables.
20
+
21
+ Experimental results on RGB and RGB-D salient object detections [64, 68, 85, 16] show that the generative framework equipped with the EBM prior and the transformer-based non-linear mapping is powerful in representing the conditional distribution of object saliency given an image, leading to more reasonable uncertainty estimation as shown in Figure 1, where stochastic saliency prediction is provided by a learned model and the visualization of the pixel-wise uncertainty is presented.
22
+
23
+ ![](images/ac4385a4d8575025890defc6c63c013ebc4fb503f16b7851ac9e1665cda2d0ce.jpg)
24
+ Figure 1: An illustration of the stochastic saliency prediction obtained by the proposed generative vision transformer with an EBM prior, as well as the corresponding pixel-wise uncertainty map.
25
+
26
+ We summarize our main contributions and novelties as follows: (i) we propose a novel top-down generative vision transformer network with an energy-based prior distribution defined on latent space for salient object detection; (ii) we jointly train the vision transformer network and the energy-based prior model by an MCMC-based maximum likelihood estimation, without relying on any extra assisting network for adversarial learning or variational learning; (iii) we achieve new benchmark results for both RGB and RGB-D salient object detections, and obtain meaningful uncertainty maps that are highly consistent with human perception for saliency prediction.
27
+
28
+ # 2 Related Work
29
+
30
+ Salient object detection: The main goal of the existing deep fully-supervised RGB image-based salient object detection models [67, 41, 68, 64, 61, 87, 65] is to achieve structure preserving saliency prediction, by either sophisticated feature aggregation [67, 61], auxiliary edge detection [68, 52, 65], or resorting to structure-aware loss functions [41, 64]. With extra depth information, RGB-D salient object detection models [53, 85, 5, 27, 93, 90, 16, 28, 51, 92, 59, 86] mainly focus on effective multi-modal modeling. Our paper solves the same problems, i.e., RGB and RGB-D salient object detection, by developing a new generative transformer-based framework.
31
+
32
+ Vision transformers: The breakthroughs of the Transformer networks [60] in natural language processing (NLP) domain have sparked the interest of the computer vision community in developing vision transformers for different computer vision tasks, such as image classification [10, 40], object detection [4, 63, 6, 40], image segmentation [96, 54, 63, 40], object tracking [80, 81], pose estimation [42, 58], etc. Among them, DPT [54] adopts a U-shape structure and uses ViT [10] as an encoder to perform semantic segmentation and monocular depth estimation. Swin [40] presents a hierarchical transformer with a shifted windowing scheme to achieve an efficient transformer network with high resolution images as input. Different from the above vision transformers that mainly focus on discriminative modeling and learning, our paper emphasizes generative modeling and learning of the vision transformer by involving latent variables and MCMC inference.
33
+
34
+ Dense prediction with generative models: VAEs have been successfully applied to image segmentation [3, 32]. For saliency prediction, [34] adopts a VAE to model the image background, and separates salient objects from the background through reconstruction residuals. [85, 84] design CVAEs to model the subjective nature of saliency. GAN-based methods can be divided into two categories, namely fully-supervised and semi-supervised settings. The former [21, 33] uses the discriminator to distinguish model predictions from ground truths, while the latter [57, 26] uses the GAN to explore the contribution of unlabeled data. [88] uses a cooperative learning framework [71, 74] for generative saliency prediction. [84] trains a single top-down generator in the ABP framework for RGB-D saliency prediction. Our model generalizes [84] by replacing the simple Gaussian prior by a learnable EBM prior and adopting a vision transformer-based generator for salient object prediction.
35
+
36
+ Energy-based models: Recent works have shown strong performance of data space EBMs [72, 44] in modeling high-dimensional complex dependencies, such as images [97, 95, 18, 11, 19], videos [78, 79], 3D shapes [75, 76], and point clouds [73], and also demonstrated the effectiveness of latent space EBMs [47] in improving the model expressivity for text [48], image [47], and trajectory [49] generation. Our paper also learns a latent space EBM as the prior model but builds the EBM on top of a vision transformer generator for image-conditioned saliency map prediction.
37
+
38
+ # 3 Generative Vision Transformer with Energy-Based Latent Space
39
+
40
+ # 3.1 Model
41
+
42
+ We formulate the supervised saliency prediction problem as a conditional generative learning problem. Let $\mathbf { I } \in \mathbb { R } ^ { h \times w \times 3 }$ be an observed RGB image, $s \in \mathbb { R } ^ { h \times w \times 1 }$ be the saliency map, and $z \in \bar { \mathbb { R } ^ { 1 \times 1 \times d } }$ be the $d$ -dimensional vector of latent variables, where $h \times w \gg d$ . Consider the following generative model to predict a saliency map $s$ from an image $\mathbf { I }$ ,
43
+
44
+ $$
45
+ \begin{array} { r } { s = T _ { \theta } ( \mathbf { I } , z ) + \epsilon , ~ z \sim p _ { \alpha } ( z ) , ~ \epsilon \sim \mathcal { N } ( 0 , \sigma _ { \epsilon } ^ { 2 } I ) , } \end{array}
46
+ $$
47
+
48
+ where $T _ { \theta }$ is the non-linear mapping process from $[ z , \mathbf { I } ]$ to $s$ with parameters $\theta$ , $p _ { \alpha } ( z )$ is the prior distribution with parameters $\alpha$ , and $\bar { \epsilon } \sim \mathcal N ( 0 , \sigma _ { \epsilon } ^ { 2 } I )$ is the observation residual of saliency with $\sigma _ { \epsilon }$ being given. Due to the stochasticity of the latent variables $z$ , given an image I, its saliency map is also stochastic. Such a probabilistic model is in accord with the uncertainty of the image saliency.
49
+
50
+ Following [47], the prior $p _ { \alpha } ( z )$ is not assumed to be a simple isotropic Gaussian distribution as GAN [20], VAE [31, 56] or ABP [22]. Specifically, it is in the form of the energy-based correction or exponential tilting [72] of an isotropic Gaussian reference distribution $p _ { 0 } ( z ) \stackrel { \_ } { = } \mathcal { N } ( 0 , \sigma _ { z } ^ { 2 } I )$ , i.e.,
51
+
52
+ $$
53
+ p _ { \alpha } ( z ) = \frac { 1 } { Z ( \alpha ) } \exp \left[ - U _ { \alpha } ( z ) \right] p _ { 0 } ( z ) \propto \exp \left[ - U _ { \alpha } ( z ) - \frac { 1 } { 2 \sigma _ { z } ^ { 2 } } | | z | | ^ { 2 } \right] ,
54
+ $$
55
+
56
+ where $\begin{array} { r } { \mathcal { E } _ { \alpha } ( z ) = U _ { \alpha } ( z ) + \frac { 1 } { 2 \sigma _ { z } ^ { 2 } } | | z | | ^ { 2 } } \end{array}$ is the energy function that maps the latent variables $z$ to a scalar, and $U _ { \alpha } ( z )$ is parameterized by a multi-layer perceptron (MLP) with trainable parameters $\alpha$ The standard deviation $\sigma _ { z }$ is a hyperparameter. $\begin{array} { r } { Z ( \bar { \alpha } ) = \bar { \int } \exp [ - U _ { \alpha } ( z ) ] p _ { 0 } ( z ) d z } \end{array}$ is the intractable normalizing constant that resolves the requirement for a probability distribution to have a total probability equal to one. $p _ { \alpha } ( z )$ is an informative prior distribution in our model and its parameters $\alpha$ need to be estimated along with the non-linear mapping function $T _ { \theta }$ from the training data.
57
+
58
+ The mapping function $T _ { \theta }$ is parameterized by a vision transformer [40] with self-attention mechanism, which encodes the input image I and then decodes it along with the vector of latent variables $z$ to the saliency map $s$ , thus, $p _ { \theta } ( s \vert \mathbf { I } , z ) = \mathcal { N } ( T _ { \theta } ( \mathbf { I } , z ) , \sigma _ { \epsilon } ^ { 2 } I )$ . The resulting generative model is a conditional directed graphical model that combines the EBM prior [47] and the vision transformer [40].
59
+
60
+ # 3.2 Learning
61
+
62
+ The generative transformer with an energy-based prior, which is presented in Eq. (1), can be trained via maximum likelihood estimation. For notation simplicity, let $\beta \stackrel { - } { = } ( \theta , \alpha )$ . For the training examples $\{ ( \mathbf { I } _ { i } , s _ { i } ) , i = 1 , . . . , n \}$ , the observed-data log-likelihood function is defined as
63
+
64
+ $$
65
+ L ( \boldsymbol { \beta } ) = \sum _ { i = 1 } ^ { n } \log p _ { \boldsymbol { \beta } } ( s _ { i } | \mathbf { I } _ { i } ) = \sum _ { i = 1 } ^ { n } \log \left[ \int p _ { \boldsymbol { \beta } } ( s _ { i } , z _ { i } | \mathbf { I } _ { i } ) d z _ { i } \right] = \sum _ { i = 1 } ^ { n } \log \left[ \int p _ { \boldsymbol { \alpha } } ( z _ { i } ) p _ { \boldsymbol { \theta } } ( s _ { i } | \mathbf { I } _ { i } , z _ { i } ) d z _ { i } \right] .
66
+ $$
67
+
68
+ Maximizing $L ( \beta )$ is equivalent to minimizing the Kullback-Leibler (KL) divergence between the model $p _ { \beta } ( s | \mathbf { I } )$ and the data distribution $p _ { \mathrm { d a t a } } ( s | \mathbf { I } )$ . The gradient of $L ( \beta )$ can be computed based on
69
+
70
+ $\nabla _ { \beta } \log p _ { \beta } ( s | \mathbf { I } ) = \mathbf { E } _ { p _ { \beta } ( z | s , \mathbf { I } ) } \left[ \nabla _ { \beta } \log p _ { \beta } ( s , z | \mathbf { I } ) \right] = \mathbf { E } _ { p _ { \beta } ( z | s , \mathbf { I } ) } \big [ \nabla _ { \beta } ( \log p _ { \alpha } ( z ) + \log p _ { \theta } ( s | \mathbf { I } , z ) ) \big ]$ , where the posterior distribution $p _ { \beta } ( z | s , \mathbf { I } ) = p _ { \beta } ( s , z | \mathbf { I } ) / p _ { \beta } ( s | \mathbf { I } ) = p _ { \alpha } ( z ) p _ { \theta } ( s | \mathbf { I } , z ) / p _ { \beta } ( s | \mathbf { I } ) .$
71
+
72
+ The learning gradient in Eq. (3) can be decomposed into two parts, i.e., the gradient for the energybased model $\alpha$
73
+
74
+ $$
75
+ \begin{array} { r } { \mathrm { E } _ { p _ { \beta } ( z | s , \mathbf { I } ) } [ \nabla _ { \alpha } \log p _ { \alpha } ( z ) ] = \mathrm { E } _ { p _ { \alpha } ( z ) } [ \nabla _ { \alpha } U _ { \alpha } ( z ) ] - \mathrm { E } _ { p _ { \beta } ( z | s , \mathbf { I } ) } [ \nabla _ { \alpha } U _ { \alpha } ( z ) ] , } \end{array}
76
+ $$
77
+
78
+ and the gradient for the transformer $\theta$
79
+
80
+ $$
81
+ \mathbf { E } _ { p _ { \beta } ( z | s , \mathbf { I } ) } [ \nabla _ { \theta } \log p _ { \theta } ( s | \mathbf { I } , z ) ] = \mathbf { E } _ { p _ { \beta } ( z | s , \mathbf { I } ) } \left[ { \frac { 1 } { \sigma _ { \epsilon } ^ { 2 } } } ( s - T _ { \theta } ( \mathbf { I } , z ) ) \nabla _ { \theta } T _ { \theta } ( \mathbf { I } , z ) \right] .
82
+ $$
83
+
84
+ $\nabla _ { \alpha } U _ { \alpha } ( z )$ in Eq. (4) and $\nabla _ { \boldsymbol { \theta } } T _ { \boldsymbol { \theta } } ( \mathbf { I } , z )$ in Eq. (5) can be efficiently computed via back-propagation. Both Eq. (4) and Eq. (5) include intractable expectation terms $\operatorname { E } _ { p } ( \cdot )$ , which can be approximated by MCMC samples. To be specific, we can use a gradient-based MCMC, e.g., Langevin dynamics, which is initialized with a Gaussian noise distribution $p _ { 0 }$ , to draw samples from the energy-based prior model $p _ { \alpha } ( z ) \propto \exp \left[ - \mathcal { E } _ { \alpha } ( z ) \right]$ by iterating
85
+
86
+ $$
87
+ z _ { t + 1 } = z _ { t } - \delta \nabla _ { z } \mathcal { E } _ { \alpha } ( z _ { t } ) + \sqrt { 2 \delta } e _ { t } , z _ { 0 } \sim p _ { 0 } ( z ) , e _ { t } \sim \mathcal { N } ( 0 , I ) ,
88
+ $$
89
+
90
+ and draw samples from the posterior distribution $p _ { \beta } ( z | s , \bf { I } )$ by iterating
91
+
92
+ $$
93
+ \begin{array} { r } { \psi _ { t + 1 } = z _ { t } - \delta \left[ \nabla _ { z } \mathcal { E } _ { \alpha } ( z _ { t } ) - \frac { 1 } { \sigma _ { \epsilon } ^ { 2 } } ( s - T _ { \theta } ( \mathbf { I } , z _ { t } ) ) \nabla _ { z } T _ { \theta } ( \mathbf { I } , z _ { t } ) \right] + \sqrt { 2 \delta } e _ { t } , z _ { 0 } \sim p _ { 0 } ( z ) , e _ { t } \sim \mathcal { N } ( 0 , I ) . } \end{array}
94
+ $$
95
+
96
+ $\delta$ is the Langevin step size and can be specified independently in Eq. (6) and Eq. (7). We use $\{ z _ { i } ^ { + } \}$ and $\{ z _ { i } ^ { - } \}$ to denote, respectively, the samples from the posterior distribution $p _ { \beta } ( z | s , \bf { I } )$ and the prior distribution $p _ { \alpha } ( z )$ . The gradients of $\alpha$ and $\theta$ can be computed with $\left\{ \left( \mathbf { I } _ { i } , s _ { i } \right) \right\}$ , $\{ z _ { i } ^ { + } \}$ and $\{ z _ { i } ^ { - } \}$ by
97
+
98
+ $$
99
+ \begin{array} { l } { { \displaystyle \nabla \alpha = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } [ \nabla _ { \alpha } U _ { \alpha } ( z _ { i } ^ { - } ) ] - \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \left[ \nabla _ { \alpha } U _ { \alpha } ( z _ { i } ^ { + } ) \right] } , } \\ { { \displaystyle \nabla \theta = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \left[ \frac { 1 } { \sigma _ { \epsilon } ^ { 2 } } ( s _ { i } - T _ { \theta } ( { \bf I } _ { i } , z _ { i } ^ { + } ) ) \nabla _ { \theta } T _ { \theta } ( { \bf I } _ { i } , z _ { i } ^ { + } ) \right] , } } \end{array}
100
+ $$
101
+
102
+ We can update the parameters with $\nabla \alpha$ and $\nabla \theta$ via the Adam optimizer [30]. We present the full learning and sampling algorithm of our model in Algorithm 1.
103
+
104
+ Algorithm 1 Maximum likelihood learning algorithm for generative vision transformer with energybased latent space for saliency prediction
105
+
106
+ Input: (1) Training images $\{ \mathbf { I } _ { i } \} _ { i } ^ { n }$ with associated saliency maps $\{ s _ { i } \} _ { i } ^ { n }$ ; (2) Number of learning iterations $M$ ; (3) Numbers of Langevin steps for prior and posterior $\{ K ^ { - } , K ^ { + } \}$ ; (4) Langevin step sizes for prior and posterior $\{ \delta ^ { - } , \delta ^ { + } \}$ ; (5) Learning rates for energy-based prior and transformer $\{ \xi _ { \alpha } , \xi _ { \theta } \}$ ; (6) batch size $n ^ { \prime }$ .
107
+
108
+ Output: Parameters $\theta$ for the transformer and $\alpha$ for the energy-based prior model
109
+
110
+ 1: Initialize $\theta$ and $\alpha$
111
+ 2: for $m \gets 1$ to $M$ do
112
+ 3: Sample observed image-saliency pairs $\{ ( \mathbf { I } _ { i } , s _ { i } ) \} _ { i } ^ { n ^ { \prime } }$
113
+ 4: For each $\left( \mathbf { I } _ { i } , s _ { i } \right)$ , sample the prior $z _ { i } ^ { - } \sim p _ { \alpha _ { m } } ( z )$ using $K ^ { - }$ Langevin steps in Eq. (6) with a step size $\delta ^ { - }$ .
114
+ 5: For each $\left( \mathbf { I } _ { i } , s _ { i } \right)$ , sample the posterior $z _ { i } ^ { + } \sim p _ { \beta _ { m } } ( z | s _ { i } , \mathbf { I } _ { i } )$ using $K ^ { + }$ Langevin steps in Eq. (7) with a step size $\delta ^ { + }$ .
115
+ 6: Update energy-based prior by Adam with the gradient $\nabla \alpha$ computed in Eq. (8) and a learning rate $\xi _ { \alpha }$ .
116
+ 7: Update transformer by Adam with the gradient $\nabla \theta$ computed in Eq. (9) and a learning rate $\xi _ { \theta }$ .
117
+
118
+ # 8: end for
119
+
120
+ # 3.3 Network
121
+
122
+ Generative vision transformer: We design the generative vision transformer using the Swin transformer [40] backbone as shown in Figure 2, which takes a three-channel image $\mathbf { I }$ and the latent variables $z$ as input and outputs a one-channel saliency map $T _ { \boldsymbol { \theta } } ( \mathbf { I } , z )$ . Two main modules are included in our generative vision transformer, including a “Transformer Encoder” module and a “Feature Aggregation” module. The former takes I as input and produces a set of feature maps $\{ f _ { l } \} _ { l = 1 } ^ { 5 }$ of channel sizes 128, 256, 512, 1024 and 1024, respectively, while the latter takes $\{ f _ { l } \} _ { l = 1 } ^ { 5 }$ and the vector of latent variables $z$ as input to generate the saliency prediction $s$
123
+
124
+ Specifically, we first feed each $f _ { l }$ to a $3 \times 3$ convolutional layer to reduce the channel dimension to 32, and obtain a new set of feature maps $\{ f _ { l } ^ { \prime } \} _ { l = 1 } ^ { 5 }$ after channel reduction. Then, we replicate the vector $z$ spatially and perform a channel-wise concatenation with $f _ { 5 } ^ { \prime }$ , followed by a $3 \times 3$ convolutional layer that seeks to produce a feature map
125
+
126
+ ![](images/dfe754670a9eceeb3ad2a690903b6d801196657007a4dfc8485bef9dd54e0c65.jpg)
127
+ Figure 2: Generative latent variable vision transformer
128
+
129
+ $F _ { 5 }$ with same number of channels as that of $f _ { 5 } ^ { \prime }$ . Finally, we sequentially concatenate feature maps from high level to low level via feature aggregation, i.e., from $l = 4$ to 1, we compute $\bar { F _ { l } } \bar { = } \mathrm { C o n v _ { 3 \times 3 } } \bar { ( } \mathrm { M } ( \mathrm { C o n c a t } ( f _ { l } ^ { \prime } , F _ { l + 1 } , . . . , F _ { 5 } ) ) \bar { } ,$ ), where $\mathrm { C o n v } _ { 3 \times 3 } ( \cdot )$ is a $3 \times 3$ convolutional layer that reduces the channel dimension to 32, $\mathbf { M } ( \cdot )$ is the channel attention module [91], and Concat $( \cdot )$ is the channel-wise concatenation operation. Note that, we upsample the higher level feature map to the same spatial size as that of the lower level feature map before the concatenation operation. We feed $F _ { 1 }$ to a $3 \times 3$ convolutional layer to obtain the one-channel saliency map $T _ { \boldsymbol { \theta } } ( \mathbf { I } , z )$ .
130
+
131
+ Energy-based prior model: We design an energy-based model for the latent variables $z$ by parameterizing the function $U _ { \alpha } ( z )$ via a multilayer perceptron (MLP), which uses three fully connected layers to map the latent variables $z$ to a scalar. The sizes of the feature maps of different layers of the MLP are $C _ { e } , C _ { e }$ and 1, respectively. We will simply use $C _ { e }$ to represent the size of the EBM prior and set $C _ { e } = 6 0$ in our experiment. GELU [25] activation is used after each layer except the last one.
132
+
133
+ # 3.4 Analysis
134
+
135
+ Convergence: Theoretically, when the Adam optimizer of $\beta = \left( \theta , \alpha \right)$ in the learning algorithm converges to a local minimum, it solves the following estimating equations
136
+
137
+ $$
138
+ \begin{array} { l l l } { { \displaystyle \nabla \alpha = 0 } } & { { \displaystyle \Rightarrow } } & { { \displaystyle \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathbf { E } _ { p _ { \beta } ( z _ { i } | s _ { i } , \mathbf { I } _ { i } ) } [ \nabla _ { \alpha } U _ { \alpha } ( z _ { i } ) ] - \mathbf { E } _ { p _ { \alpha } ( z ) } [ \nabla _ { \alpha } U _ { \alpha } ( z ) ] = 0 , } } \\ { { \displaystyle \nabla \theta = 0 } } & { { \displaystyle \Rightarrow } } & { { \displaystyle \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathbf { E } _ { p _ { \beta } ( z _ { i } | s _ { i } , \mathbf { I } _ { i } ) } \left[ \frac { 1 } { \sigma _ { \epsilon } ^ { 2 } } ( s _ { i } - T _ { \theta } ( \mathbf { I } _ { i } , z _ { i } ) ) \nabla _ { \theta } T _ { \theta } ( \mathbf { I } _ { i } , z _ { i } ) \right] = 0 , } } \end{array}
139
+ $$
140
+
141
+ which are the maximum likelihood estimating equations. However, in practise, the Langevin dynamics in Eq. (8) and Eq. (9) might not converge to the target distributions due to the use of a small number of Langevin steps (i.e., short-run MCMC), the estimating equations in Eq. (10) and Eq. (11) will correspond to a perturbation of the MLE estimating equation according to [44, 45, 47]. The learning algorithm can be justified as a Robbins-Monro [55] algorithm, whose convergence is theoretically sound. Our model can also be trained with an extra encoder as an amortized inference network [31] for $p _ { \beta } ( z | s , \mathbf { I } )$ and an extra generator as an amortized sampling network [70, 71, 77] for $p _ { \alpha } ( z )$ . In this work, we prefer to keep our training algorithm simple in order to avoid extra efforts for the design of the auxiliary network architectures. We will study the joint training strategy in our future work.
142
+
143
+ Accuracy: Compared with the GAN-based generative framework, our model is a likelihood-based generative framework that will not suffer from mode collapse [2]. In comparison with VAE-based generative framework, whose training is also based on likelihood, our MCMC-based maximum likelihood learning algorithm will not encounter the posterior collapse issue that is caused by amortized inference. On the other hand, the variational inference typically relies on an extra inference network for efficient inference of the latent variables given an image and saliency pair, however, the approximate inference might not be able to take the full place of the posterior distribution in practise. To be specific, we use $q _ { \phi } ( z | s , \bf { I } )$ to denote the tractable approximate inference network with parameters $\phi$ . The variational inference seeks to optimize $\begin{array} { r } { \operatorname* { m i n } _ { \boldsymbol { \beta } } \operatorname* { m i n } _ { \boldsymbol { \phi } } \mathrm { K L } \big ( p _ { \mathrm { d a t a } } ( \boldsymbol { s } | \mathbf { I } ) q _ { \boldsymbol { \phi } } ( z | \boldsymbol { s } , \mathbf { I } ) \big | \big | p _ { \boldsymbol { \beta } } ( z , \boldsymbol { s } | \mathbf { I } ) \big ) } \end{array}$ , which can be further decomposed into $\begin{array} { r } { \operatorname* { m i n } _ { \boldsymbol { \beta } } \operatorname* { m i n } _ { \boldsymbol { \phi } } \mathrm { K L } \big ( p _ { \mathrm { d a t a } } ( \boldsymbol { s } | \mathbf { I } ) | | p _ { \boldsymbol { \beta } } ( \boldsymbol { s } | \mathbf { I } ) \big ) + \mathrm { K L } \big ( q _ { \boldsymbol { \phi } } ( \boldsymbol { z } | \boldsymbol { s } , \mathbf { I } ) | | p _ { \boldsymbol { \beta } } ( \boldsymbol { z } | \boldsymbol { s } , \mathbf { I } ) \big ) } \end{array}$ . That is, the variational inference maximizes the conditional data likelihood plus a KL-divergence between the approximate inference network and the posterior distribution. Only when the $\mathrm { K L } ( q _ { \phi } ( z | s , \mathbf { I } ) | | p _ { \beta } ( z | s , \mathbf { I } ) ) \to 0$ , the variational inference will lead to the MLE solution, which is exactly the objective of our model. However, there might exist a gap between them in practise due to the improper design of the inference network. Our learning algorithm is much simpler and more accurate than amortized inference.
144
+
145
+ ![](images/888a70220dbd3e84c2454de192505464efc8bac016ad793b0af29363bb4def6a.jpg)
146
+ Figure 3: Visual comparison of our model and the state-of-the-art saliency prediction model, the BBSNet [16]. From top to bottom: images, ground truth saliency maps, results of the BBSNet [16] and results obtained by our model.
147
+
148
+ Computational and memory costs analysis: From the learning perspective, due to the iterative Langevin sampling for the posterior and prior distributions of latent variables, our model is more time-consuming for training than generative models with amortized inference, such as VAE, which is roughly 2.4 times faster than ours on RGB image-based salient object detection. However, for VAE, the inference model is parameterized by another set of parameters, which need to be updated by back-propagation. In our model, the Langevin dynamics is not treated as a model because once the top-down generator is updated in each iteration, the posterior distribution can be derived from the generator. With the posterior distribution, the Langevin sampling is just an optimization-like process to find fair samples in the latent space defined by the posterior distribution. Without relying on an extra inference network, our framework is efficient in memory and friendly for network design.
149
+
150
+ # 4 Experimental Results
151
+
152
+ # 4.1 Setup
153
+
154
+ Datasets: For RGB SOD, we train models on DUTS training set [62], and test them on five benchmark datasets, including DUTS testing set, ECSSD [82], DUT [83], HKU-IS [35] and PASCAL-S [36]. For RGB-D SOD, we follow the conventional training setting, in which the training set is a combination of 1,485 images from NJU2K dataset [29] and 700 images from NLPR dataset [50]. We test the trained models on NJU2K testing set, NLPR testing set, DES [8], SSB [46] and SIP [15] testing set.
155
+
156
+ Evaluation Metrics: We adopt four evaluation metrics to measure the performance, including Mean Absolute Error $\mathcal { M }$ , Mean F-measure $( F _ { \beta } )$ , Mean E-measure $( E _ { \xi } )$ [14] and S-measure $( S _ { \alpha } )$ [13].
157
+
158
+ Implementation Details: Our generative vision transformer is built upon the Swin transformer [40] and uses it as the backbone of the encoder in our framework. The Swin backbone can be initialized with the parameters pretrained on the ImageNet-1K [9] dataset for image classification, and the other parameters of the newly added components, including the decoder part and the MLP of the energy based prior model, will be randomly initialized from the Gaussian distribution $\mathcal { N } ( 0 , 0 . 0 1 )$ . Empirically we set the number of dimensions $d$ of the latent variables $z$ as $d = 3 2$ . We set $\sigma _ { \epsilon } = 1$ in Eq. (1) and $\sigma _ { z } = 1$ in Eq. (2). We resize all the images and the saliency maps to the resolution of $3 8 4 \times 3 8 4$ pixels to fit the Swin transformer. The maximum epoch is 50. The initial learning rates are $2 . 5 \times 1 0 ^ { - 5 }$ . The whole training takes 9 hours with a batch size $n ^ { \prime } = 1 0$ on one NVIDIA GTX 2080Ti GPU for each model. During testing, our model can process 15 images per second.
159
+
160
+ # 4.2 Performance Comparison
161
+
162
+ We compare our framework with the state-of-the-art RGB SOD models and RGB-D SOD models, and show a comparison of performance in Table 1 and Table 2 respectively, where VST [39] is the only transformer-based saliency detection model. We observe consistently better performance of the proposed frameworks. Especially for PASCAL-S dataset [36], which contains more than $40 \%$ examples with large-sized salient objects, the significant performance gap between our method and the existing solutions demonstrates the effectiveness of our generative framework for saliency prediction. We further show a qualitative comparison between our RGB-D saliency prediction model and the BBSNet [16] in Figure 3. As we can see, our transformer-based framework, with an effective global context modeling, is superior to its competitor in detecting various sizes of salient objects.
163
+
164
+ Table 1: Performance comparison with benchmark RGB salient object detection models.
165
+
166
+ <table><tr><td></td><td colspan="4">DUTS [62]</td><td colspan="4">ECSSD [82]</td><td colspan="4">DUT[83]</td><td colspan="4">HKU-IS [35]</td><td colspan="4">PASCAL-S [36]</td></tr><tr><td>Method</td><td>S↑FB↑E↑M↓</td><td></td><td></td><td></td><td>S↑FB↑E↑M√</td><td></td><td></td><td></td><td></td><td>S↑Fβ↑Ee↑M√</td><td></td><td></td><td></td><td></td><td>S↑Fβ↑E↑M√</td><td></td><td></td><td></td><td>S↑Fβ↑E↑M↓</td><td></td></tr><tr><td>CPD [67]</td><td>.869</td><td>.821</td><td>.898</td><td>.043</td><td>.913</td><td>.909</td><td>.937</td><td>.040</td><td>.825</td><td>.742</td><td>.847</td><td>.056</td><td>.906</td><td>.892</td><td>.938</td><td>.034</td><td>.848</td><td>.819</td><td>.882</td><td>.071</td></tr><tr><td>SCRN [68]</td><td>.885</td><td>.833</td><td>.900</td><td>.040</td><td>.920</td><td>.910</td><td>.933</td><td>.041</td><td>.837</td><td>.749</td><td>.847</td><td>.056</td><td></td><td>.916.894</td><td>.935</td><td>.034</td><td>.869</td><td>.833</td><td>.892</td><td>.063</td></tr><tr><td>PoolNet [37]</td><td>.887</td><td>.840</td><td>.910</td><td>.037</td><td>.919</td><td>.913</td><td>.938</td><td>.038</td><td></td><td>.831.748</td><td>.848</td><td>.054</td><td>.919</td><td>.903</td><td>.945</td><td>.030</td><td>.865</td><td>.835</td><td>5.896</td><td>.065</td></tr><tr><td>BASNet [52]</td><td>.876</td><td>.823</td><td>.896</td><td>.048</td><td>.910</td><td>.913</td><td>.938</td><td>.040</td><td>.836</td><td>.767</td><td>.865</td><td>.057</td><td>.909</td><td>.903</td><td>.943</td><td>.032</td><td>.838</td><td>.818</td><td>.879</td><td>.076</td></tr><tr><td>EGNet [94]</td><td>.878</td><td>.824</td><td>.898</td><td>.043</td><td>.914</td><td>.906</td><td>.933</td><td>.043</td><td>.840</td><td>.755</td><td>.855</td><td>.054</td><td>.917</td><td>.900</td><td>.943</td><td>.031</td><td>.852</td><td>.823</td><td>.881</td><td>.074</td></tr><tr><td>F3Net [64]</td><td>.888</td><td>.852</td><td>.920</td><td>.035</td><td>.919</td><td>.921</td><td>.943</td><td>.036</td><td>.839</td><td>.766</td><td>.864</td><td>.053</td><td>.917</td><td>.910</td><td>.952</td><td>.028</td><td>.861</td><td>.835</td><td>.898</td><td>.062</td></tr><tr><td>ITSD [98]</td><td>.886</td><td>.841</td><td>.917</td><td>.039</td><td>.920</td><td>.916</td><td>.943</td><td>.037</td><td>.842</td><td>.767</td><td>.867</td><td>.056</td><td>.921</td><td>.906</td><td>.950</td><td>.030</td><td>.860</td><td>.830</td><td>.894</td><td>.066</td></tr><tr><td>SCNet [88]</td><td>.902</td><td>.870</td><td>.936</td><td>.032</td><td>.928</td><td>.930</td><td>.955</td><td>.030</td><td>.847</td><td>.778</td><td>.879</td><td>.053</td><td>.927</td><td>.917</td><td>.960</td><td>.026</td><td>.873</td><td>.846</td><td>5.909</td><td>.058</td></tr><tr><td>LDF [65]</td><td>.892</td><td>.861</td><td>.925</td><td>.034</td><td>.919.923</td><td></td><td>.943</td><td>.036</td><td></td><td>.839.770</td><td>.865</td><td>.052</td><td>.920</td><td>).913</td><td>.953.028</td><td></td><td>.860</td><td>.856</td><td>5.901</td><td>.063</td></tr><tr><td>VST [39]</td><td>.896</td><td>.842</td><td>.918</td><td>.037</td><td>.932</td><td>.911</td><td>.943</td><td>.034</td><td></td><td>.850.771</td><td>.869</td><td>.058</td><td>.928</td><td>.903</td><td>.950</td><td>.030</td><td>.873</td><td>.832</td><td>.900</td><td>.067</td></tr><tr><td>Ours</td><td>.908</td><td>.875</td><td>.942</td><td>.029</td><td>.935</td><td>.935</td><td>.962</td><td>.026</td><td></td><td>.858.797</td><td>.892</td><td>.051</td><td>.930</td><td>.922</td><td>.964</td><td>.023</td><td>.877</td><td>.855</td><td>.915</td><td>.054</td></tr></table>
167
+
168
+ Table 2: Performance comparison with benchmark RGB-D salient object detection models.
169
+
170
+ <table><tr><td></td><td colspan="4">NJU2K [29] S↑FB↑E↑M</td><td colspan="4">SSB [46] S↑FB↑E↑M</td><td colspan="4">DES [8] S↑FB↑E↑M</td><td colspan="4">NLPR [50]</td><td colspan="4">SIP [15]</td></tr><tr><td>Method</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>S↑FB↑E↑M↓</td><td></td><td></td><td></td><td>S↑FB↑E↑M√</td><td></td></tr><tr><td>BBSNet [16]</td><td>.921</td><td>.902</td><td>.938</td><td>.035</td><td>.908</td><td>.883</td><td>.928</td><td>.041</td><td>.933</td><td>.910</td><td>.949</td><td>.021</td><td>.930</td><td>.896</td><td>.950</td><td>.023</td><td>.879</td><td>.868</td><td>.906</td><td>.055</td></tr><tr><td>BiaNet [92]</td><td>.915</td><td>.903</td><td>.934</td><td>.039</td><td>.904</td><td>.879</td><td>.926</td><td>.043</td><td>.931</td><td>.910</td><td>.948</td><td>.021</td><td>.925</td><td>.894</td><td>.948</td><td>.024</td><td>.883</td><td>.873</td><td>.913</td><td>.052</td></tr><tr><td>CoNet[28]</td><td>.911</td><td>.903</td><td>.944</td><td>.036</td><td>.896</td><td>.877</td><td>.939</td><td>.040</td><td>.906</td><td>.880</td><td>.939</td><td>.026</td><td>.900</td><td>.859</td><td>.937</td><td>.030</td><td>.868</td><td>.855</td><td>.915</td><td>.054</td></tr><tr><td>UCNet [85]</td><td>.897</td><td>.886</td><td>.930</td><td>.043</td><td>.903</td><td>.884</td><td>.938</td><td>.039</td><td>.934</td><td>.919</td><td>.967</td><td>.019</td><td>.920</td><td>.891</td><td>.951</td><td>.025</td><td>.875</td><td>.867</td><td>.914</td><td>.051</td></tr><tr><td>JLDCF [17]</td><td>.902</td><td>.885</td><td>.935</td><td>.041</td><td>.903</td><td>.873</td><td>.936</td><td>.040</td><td>.931</td><td>.907</td><td>.959</td><td>.021</td><td>.925</td><td>.894</td><td>.955</td><td>.022</td><td>.880</td><td>.873</td><td>.918</td><td>.049</td></tr><tr><td>DSA2F [59]</td><td>.903</td><td>.901</td><td>.923</td><td>.039</td><td>.904</td><td>.898</td><td>.933</td><td>.036</td><td>.920</td><td>.896</td><td>.962</td><td>.021</td><td>.918</td><td>.897</td><td>.950</td><td>.024</td><td>-</td><td>1</td><td>-</td><td>-</td></tr><tr><td>VST [39]</td><td>.922</td><td>.898</td><td>.939</td><td>.035</td><td>.913</td><td>.879</td><td>.937</td><td>.038</td><td>.943</td><td>.920</td><td>.965</td><td>.017</td><td>.932</td><td>.897</td><td>.951</td><td>.024</td><td>.904</td><td>.894</td><td>.933</td><td>.040</td></tr><tr><td>Ours</td><td>.929</td><td>.924</td><td>.956</td><td>.028</td><td>.916</td><td>.898</td><td>.950</td><td>.032</td><td>.945</td><td>.928</td><td>.971</td><td>.016</td><td>.938</td><td>.921</td><td>.966</td><td>.018</td><td>.906</td><td>.908</td><td>.940</td><td>.037</td></tr></table>
171
+
172
+ # 4.3 Backbone Analysis
173
+
174
+ To test the performance of the transformer structure proposed in Section 3.3, we compare it with a conventional convolutional backbone for salient object detection. We create the baseline by replacing the Swin encoder in our transformer structure by the ResNet50 [24] encoder and keeping the decoder part (i.e., the “Feature Aggregation” module shown in Figure 2) unchanged for a fair comparison.
175
+
176
+ We first test them without involving latent variables, which means that we need to train them in a discriminative manner. We use “Ours-Swin-D” to denote the model using the Swin encoder and “OursRes50-D” to denote the one using the ResNet50 encoder. Model performance in the task of RGB-D saliency detection are shown in Table 3. We observe that “Ours-Swin-D” outperforms “Ours-Res50- D”, which clearly indicates the effectiveness of transformer backbone for salient object detection.
177
+
178
+ Table 3: Analysis of different backbones without involving latent variable
179
+
180
+ <table><tr><td></td><td colspan="4">NJU2K [29] S↑FB↑E↑M√</td><td colspan="4"></td><td colspan="4"></td><td colspan="4"></td><td colspan="4"></td></tr><tr><td>Method</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>S↑FB↑Ee↑M√</td><td></td><td>S↑Fβ↑E↑M√</td><td></td><td></td><td></td><td></td><td>S↑FB↑Ee↑M√</td><td></td><td></td><td></td><td>S↑FB↑Ee↑M√</td><td></td></tr><tr><td>Ours-Res50-D</td><td>.908</td><td>.896</td><td>.931</td><td>.036</td><td>.906</td><td>.889</td><td>.927</td><td>.037</td><td>.918</td><td>.907</td><td>.948</td><td>.022</td><td>.921</td><td>.893</td><td>.951</td><td>.024</td><td>.874</td><td>.856</td><td></td><td>.917.049</td></tr><tr><td>Ours-Swin-D</td><td>.919</td><td>.923.947</td><td></td><td>.032</td><td></td><td>.914.897</td><td>.943</td><td>3.033</td><td>.931</td><td>.919</td><td>.959</td><td>.022</td><td></td><td>.933.912</td><td>2.951</td><td>.022</td><td>.897</td><td></td><td></td><td>7.899.931.041</td></tr></table>
181
+
182
+ Table 4: Performance of different backbones within our model for RGB saliency prediction.
183
+
184
+ <table><tr><td></td><td colspan="4">DUTS [62] S↑FB↑Ee↑M</td><td colspan="4">ECSSD [82]</td><td colspan="4">DUT[83] S↑FB↑Ee↑M√</td><td colspan="4">HKU-IS [35] S↑Fβ↑E↑M↓</td><td colspan="4">PASCAL-S [36] S↑FB↑Ee↑M↓</td></tr><tr><td>Method</td><td></td><td></td><td></td><td></td><td></td><td>S↑FB↑E↑M√</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Ours-Res50</td><td>.890</td><td>.850</td><td>.927</td><td>.035</td><td>.918</td><td>.914</td><td>.944</td><td>.036</td><td>.837</td><td>.762</td><td>.867</td><td>.053</td><td>.917</td><td>.906</td><td>.952</td><td>.029</td><td>.859</td><td>.830</td><td>.896 .063</td></tr><tr><td>Our-DPT</td><td>.899</td><td>.874</td><td>.940</td><td>.031</td><td>.924</td><td>.933</td><td>.956.031</td><td></td><td></td><td>.854.792</td><td>.890</td><td>.054</td><td>.922</td><td>.920</td><td>.960</td><td>.026</td><td>.870</td><td>.854 .911</td><td>.055</td></tr><tr><td>Ours-Swin</td><td>.908</td><td>.875</td><td>.942</td><td>.029</td><td>.935</td><td>.935</td><td>.962</td><td>.026</td><td>.858</td><td>.797</td><td>.892</td><td>.051</td><td>.930</td><td>.922</td><td>.964</td><td>.023</td><td>.877 .855</td><td>.915</td><td>.054</td></tr></table>
185
+
186
+ Table 5: Performance of different backbones within our model for RGB-D saliency prediction.
187
+
188
+ <table><tr><td></td><td colspan="4">NJU2K [29]</td><td colspan="4">SSB [46] S↑FB↑E↑M</td><td colspan="4">DES [8]</td><td colspan="4">NLPR [50]</td><td colspan="4">SIP [15]</td></tr><tr><td>Method</td><td></td><td></td><td>S↑FB↑E↑M</td><td>↓</td><td></td><td></td><td></td><td></td><td></td><td>S↑FB↑E↑M↓</td><td></td><td></td><td></td><td></td><td>S↑FB↑Ee↑M↓</td><td></td><td></td><td></td><td>S↑FB↑Ee↑M√</td></tr><tr><td>Ours-Res50</td><td>.919</td><td>.909</td><td>.946.033</td><td>.906</td><td></td><td>.882.937</td><td>.038</td><td></td><td>.937 .925</td><td></td><td>.974.017</td><td></td><td>.920</td><td>.892</td><td>.949</td><td>.025</td><td>.882.872</td><td>.918</td><td>.049</td></tr><tr><td>Ours-DPT</td><td>.924</td><td>.913</td><td>.950 .031</td><td>.915</td><td>.892</td><td>.946</td><td>.034</td><td>.941</td><td>.921</td><td>.968</td><td>3.017</td><td>.935</td><td>.913</td><td>.964</td><td>.019</td><td>.901</td><td>.903</td><td>.933</td><td>.038</td></tr><tr><td>Ours-Swin</td><td>.929</td><td>.924</td><td>.956 .028</td><td></td><td></td><td>.916.898 .950</td><td>.032</td><td></td><td>.945.928</td><td>.971</td><td>.016</td><td>.938</td><td>.921</td><td>.966</td><td>.018</td><td>.906</td><td>.908</td><td>.940</td><td>.037</td></tr></table>
189
+
190
+ We further study the influence of different encoder backbones in the context of the proposed generative saliency prediction framework with an EBM prior. Table 4 and Table 5, respectively, depict the performance comparisons of our frameworks using different backbones in the tasks of RGB and RGBD salient object detections. We compare the ResNet50 encoder backbone and the Swin transformer encoder backbone. We also modify the DPT [54] backbone such that it can adapt to the tasks of RGB and RGB-D salient object detections with our framework. The DPT built on the ViT transformer [10] is originally designed for semantic segmentation and depth estimation. The comparison results verify the effectiveness of the vision transformer used in our generative framework. In particular, our current solution with the Swin transformer encoder backbone can achieve the best performance for saliency prediction. Further, the performance gap between “Ours-Swin-D” in Table 3 and “Ours-Swin” in Table 5 indicates the effectiveness of the generative learning with an expressive latent space.
191
+
192
+ # 4.4 Generative Learning Analysis
193
+
194
+ We compare our framework with other alternative generative solutions in Table 6. The results are reported in the task of RGB-D saliency detection. For fair comparison, we implement an ABP-based model [22], a GAN-based model [20], and a VAE-based model [31, 56] using the same transformerbased generator as ours. The latent variables in these models are still assumed to follow the isotropic Gaussian distribution, as in their original algorithms. To be specific, for the ABP-based model, we use MCMC-based inference while training, and sample the latent variables directly from the Gaussian distribution during testing. For the GAN-based alternative, we design a fully convolutional discriminator [26] that consists of five $3 \times 3$ convolutional layers with a stride of 2 in each layer. The discriminator takes the concatenation of an image and a saliency map as input, and is trained to distinguish between the predicted saliency map and the ground truth given an image. The numbers of the output channels of the discriminator are 64, 64, 64, 64 and 1. For the VAE-based alternative, we introduce an extra encoder as an approximate Gaussian inference model via the reparameterization trick. The encoder consists of four $4 \times 4$ convolutional layers with a stride of 2 in each layer and maps the concatenation of an image and a saliency map to feature maps of channel sizes 64, 64, 64 and 64 sequentially. After that, two fully connected layers are adopted to produce the mean and the standard deviation of the inference model. For all the three alternative generative models, we set the numbers of the dimension of the latent space the same as that in our model, which is $d = 3 2$ .
195
+
196
+ Table 6: Performance of different generative models with transformer backbones for SOD.
197
+
198
+ <table><tr><td></td><td colspan="4">NJU2K [29]</td><td colspan="4">SSB [46]</td><td colspan="4">DES [8]</td><td colspan="4">NLPR [50]</td><td colspan="4">SIP [15]</td></tr><tr><td>Method</td><td></td><td></td><td></td><td>S↑FB↑E↑M</td><td></td><td></td><td>S↑FB↑E↑M√</td><td></td><td></td><td>S↑FB↑E↑M√</td><td></td><td></td><td></td><td></td><td>S↑Fβ↑E↑M√</td><td></td><td></td><td></td><td>S↑Fβ↑E↑M↓</td><td></td></tr><tr><td>ABP</td><td>.920</td><td>.915</td><td>.951</td><td>.030</td><td>.910</td><td>.890</td><td>.942</td><td>.035</td><td>.935</td><td>.920</td><td>.962</td><td>.018</td><td>.930</td><td>.914</td><td>.962</td><td>.020</td><td>.900</td><td>.898</td><td>.935</td><td>.039</td></tr><tr><td>GAN</td><td>.928</td><td>.922</td><td>.954</td><td>.030</td><td>.913</td><td>.892</td><td>.941</td><td>.033</td><td>.940.</td><td>.924</td><td>.969</td><td>.018</td><td>.934</td><td>.915</td><td>.961</td><td>.021</td><td>.901</td><td>.904</td><td>.937</td><td>.039</td></tr><tr><td>VAE</td><td>.928</td><td>.921</td><td>.955</td><td>.029</td><td>.914</td><td>.894</td><td>.947</td><td>.033</td><td>.942</td><td>.922</td><td>.970</td><td>.017</td><td>.934</td><td>.914</td><td>.961</td><td>.020</td><td>.904</td><td>.906</td><td>.935</td><td>.038</td></tr><tr><td>Ours</td><td>.929</td><td>.924</td><td>.956</td><td>.028</td><td>.916</td><td>.898</td><td>.950</td><td>.032</td><td>.945</td><td>.928</td><td>.971</td><td>.016</td><td>.938</td><td>.921</td><td>.966</td><td>.018</td><td>.906</td><td>.908</td><td>.940</td><td>.037</td></tr></table>
199
+
200
+ As shown in Table 6, compared with the deterministic baseline “Ours-Swin-D” (in Table 3), the three generative frameworks in achieve better or comparable performance. Especially in the DES dataset [8], they achieve large performance improvements. Our model outperforms all these alternative generative solutions, showing the effectiveness of the informative EBM prior distribution used in our model.
201
+
202
+ # 4.5 Hyperparameter Analysis
203
+
204
+ The main hyperparameters in our framework include the number of Langevin steps $K$ , the Langevin step size $\delta$ , the number of dimensions of the latent space $d$ , and the size of EBM prior $C _ { e }$ . We have two sets of hyperparameters $\{ \delta ^ { - } , K ^ { - } \}$ and $\{ \delta ^ { + } , K ^ { + } \}$ of the Langevin dynamics for sampling from the prior distribution and the posterior distribution, respectively. As to the Langevin step size, we find stable model performance with $\delta ^ { - } \in [ 0 . 2 , 0 . 6 ]$ and $\delta ^ { + } \in [ \bar { 0 } . 0 5 , 0 . 3 ]$ , and we set $\delta ^ { - } \overset { } { = } 0 . 4$ and $\delta ^ { + } = 0 . 1$ in our paper. For the number of Langevin steps, we empirically set $K ^ { - } = K ^ { + } = 5$ to achieve a trade-off between the training efficiency and the model performance, as more Langevin steps will lead to longer training time but more convergent inference results. Additionally, we investigate the influence of the number of latent dimensions by varying $d = \{ 8 , 1 6 , 3 2 , 6 4 \}$ , and observe comparable performance among different choices of $d$ . We set $d = 3 2$ in our paper. We also investigate the influence of the EBM size by varying $C _ { e } = \{ 2 0 , 6 0 , 1 0 0 \}$ , and show the results in Table 7, in which we find $C _ { e } = 6 0$ can provide optimal saliency prediction performance.
205
+
206
+ Table 7: Influence of the size of the EBM prior model
207
+
208
+ <table><tr><td></td><td colspan="4">NJU2K [29] S↑FB↑Ee↑M</td><td colspan="4">SSB [46] S↑FB↑E↑M↓</td><td colspan="4">DES [8]</td><td colspan="4">NLPR [50]</td><td colspan="4">SIP [15]</td></tr><tr><td>Method</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>S↑FB↑E↑M↓</td><td></td><td></td><td></td><td></td><td>S↑FB↑E↑M↓</td><td></td><td></td><td></td><td>S↑FB↑Ee↑M</td><td></td></tr><tr><td>Ce=20</td><td>.930</td><td>.913</td><td>.957</td><td>.026</td><td>.917</td><td>.898</td><td>.950</td><td>.030</td><td>.951</td><td>.921</td><td>.970.016</td><td></td><td>.937</td><td>.913</td><td></td><td>.950.022</td><td>.901</td><td>.892</td><td>.931</td><td>.037</td></tr><tr><td>Ce=100</td><td>.926</td><td>.904</td><td>.950 .031</td><td></td><td>.916.891</td><td></td><td>.952</td><td>.031</td><td>.942</td><td>.930</td><td>.970 .016</td><td></td><td>.939</td><td>.913</td><td>.960 .021</td><td></td><td>.903</td><td>.895</td><td>.934</td><td>.036</td></tr><tr><td>Ours(Ce = 60)</td><td>.929</td><td>.924</td><td>.956</td><td>.028</td><td>.916</td><td>.898</td><td>.950</td><td>.032</td><td>.945</td><td>.928</td><td>.971</td><td>.016</td><td>.938</td><td>.921</td><td>.966.018</td><td></td><td>.906</td><td>.908</td><td>.940</td><td>.037</td></tr></table>
209
+
210
+ # 4.6 Explainability Analysis
211
+
212
+ As a generative model, our framework is capable of obtaining a meaningful uncertainty map that summarizes the stochastic behavior of the model in performing saliency prediction. The uncertainty in our paper refers to the stochastic property of generating the saliency prediction from an input image, which is captured by the probabilistic model $p _ { \beta } ( s | \mathbf { I } )$ . In general, a generative saliency prediction method can provide not only accurate predictions but also reasonable uncertainty maps that represent the “subjective nature” of the human visual saliency. In this section, we propose to use the uncertainty map to help qualitatively evaluate different generative saliency prediction frameworks. Specifically, we propose to compute the uncertainty map as the variance of multiple saliency predictions produced from the learned probabilistic model. In the experiment, for each input image, we first output ten saliency maps by using the Langevin sampling from the learned conditional distribution, and then compute the variance map (uncertainty) based on the generated saliency predictions.
213
+
214
+ To quantify the complexity of a color image, we calculate a complexity score by the following way: (i) we first over-segment the image with the SLIC [1] to obtain 200 superpixels, (ii) then we compute the similarity of each superpixel with the others using handcrafted features from [99], which gives us a 200-dimensional contrast vector, representing an overall contrast of the image, (iii) we define the complexity of the image as the mean entropy of the contrast vector. The higher the score, the more complicated the image. In general, a reasonable generative saliency prediction model should have more confident predictions on images with simpler backgrounds (i.e., lower complexity scores), and less confident predictions on images with complicated backgrounds (i.e., higher complexity scores).
215
+
216
+ In Figure 4, we compare the uncertainty maps of different generative models that we have presented in Section 4.4. For each row of Figure 4, we display an input image, which is tagged with an image complexity score, and the associated ground truth saliency map, followed by the predicted saliency maps and the uncertainty maps obtained by the ABP-based model, the GAN-based model, the VAE-based model, and our model, respectively. As shown in Figure 4, the complexity score of each image is reasonable in the sense that it is consistent with the human perception. We observe that the uncertainty maps obtained by the other generative models fail to reflect the difficulties of the images for saliency prediction. For example, the image shown in the first row of Figure 4 has a structured foreground (i.e., a temple) and a textured background (i.e., a forest), which leads to a large ambiguity of the boundary between the foreground and the background. The uncertainty map obtained by our model indicates a big variance around the boundary region, which demonstrates the explainability and the reasonability of our model. Note that only generative saliency prediction frameworks can provide such an explainability analysis based on the uncertainty maps. This might motivate us to develop generative frameworks for explainable saliency prediction in the future.
217
+
218
+ ![](images/c8066cb758027bb4132dcf6048fb62f0400bd18e170ed265b9ce413c27f1677e.jpg)
219
+ Figure 4: A comparison of uncertainty maps obtained by different generative saliency prediction frameworks for explainability analysis. Each row represents one example, in which we display an image tagged with a complexity score, the corresponding ground truth saliency map, as well as the predicted saliency maps and the uncertainty maps obtained by different generative frameworks.
220
+
221
+ # 5 Conclusion and Discussion
222
+
223
+ In this paper, we study the generative modeling and learning of vision transformer in the context of RGB and RGB-D salient object detections. We start from defining a conditional probability distribution of saliency map given an input image by a top-down latent variable generative framework, in which the non-linear mapping from image domain to saliency domain is parameterized by a proposed vision transformer network and the prior distribution of the low-dimensional latent space is represented by a trainable energy-based model. Instead of using amortized inference and sampling strategies, we learn the model by the MCMC-based maximum likelihood, where the Langevin sampling is used to evaluate the intractable posterior and prior distributions of the latent variables for calculating the learning gradients of the model parameters. With the informative energy-based prior and the expressive top-down vision transformer network, our model can achieve both accurate predictions and meaningful uncertainty maps that are consistent with the human perception.
224
+
225
+ From the machine learning perspective, our model is a likelihood-based top-down deep conditional generative model, which is neither CGAN-based nor CVAE-based frameworks, and it is trained without relying on any assisting network. The learning algorithm derived from the proposed model is based on MCMC inference for the posterior and MCMC sampling for the prior, which makes our framework more natural, principled, and statistically rigorous than others. The MCMC-based inference is immediately available in the sense that there is nothing to worry about the non-trivial design and training of a separate inference model as in VAEs. Such a framework is not only useful for saliency prediction (Though this is what we target in this paper) but also applicable to a vast of conditional learning scenarios, such as semantic segmentation, image-to-image translation, etc. Thus, the proposed generative model and the learning algorithm are generic and universal.
226
+
227
+ From the computer vision perspective, our model with a special network design to handle saliency prediction is a new member of the family of saliency prediction methods. In comparison with the traditional discriminative saliency prediction methods, our generative method is natural and reasonable because it models the saliency prediction as a conditional probability distribution. Moreover, it demonstrates impressive performance over all RGB and RGB-D SOD benchmarks. As we know, the computer vision community has started to develop vision transformer networks for various computer vision tasks, such as image classification, segmentation, detection, generation, etc. Our paper is the first one to present a generative vision transformer for both RGB and RGB-D saliency predictions. Thus, the proposed framework is significantly important for the computer vision community.
228
+
229
+ References
230
+ [1] Radhakrishna Achanta, Appu Shaji, Kevin Smith, Aurélien Lucchi, Pascal Fua, and Sabine Süsstrunk. Slic superpixels. Technical report, EPFL, 06 2010.
231
+ [2] Sanjeev Arora, Andrej Risteski, and Yi Zhang. Do gans learn the distribution? some theory and empirics. In International Conference on Learning Representations (ICLR), 2018.
232
+ [3] Christian F. Baumgartner, Kerem Can Tezcan, Krishna Chaitanya, Andreas M. Hötker, Urs J. Muehlematter, Khoschy Schawkat, Anton S. Becker, Olivio Donati, and Ender Konukoglu. Phiseg: Capturing uncertainty in medical image segmentation. In The 24th International Conference on Medical Image Computing and Computer Assisted Intervention (MICCAI), pages 119–127, 2019.
233
+ [4] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European Conference on Computer Vision (ECCV), pages 213–229, 2020.
234
+ [5] Hao Chen and Youfu Li. Progressively complementarity-aware fusion network for RGB-D salient object detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 3051–3060, 2018.
235
+ [6] Shuo Chen, Tan Yu, and Ping Li. Mvt: Multi-view vision transformer for 3d object recognition. In British Machine Vision Conference (BMVC), 2021.
236
+ [7] Ming-Ming Cheng, Niloy J. Mitra, Xiaolei Huang, Philip H. S. Torr, and Shi-Min Hu. Global contrast based salient region detection. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 37(3):569–582, 2015.
237
+ [8] Yupeng Cheng, Huazhu Fu, Xingxing Wei, Jiangjian Xiao, and Xiaochun Cao. Depth enhanced saliency detection method. In Proceedings of International Conference on Internet Multimedia Computing and Service, pages 23–27, 2014.
238
+ [9] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 248–255, 2009.
239
+ [10] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations (ICLR), 2021.
240
+ [11] Yilun Du and Igor Mordatch. Implicit generation and modeling with energy based models. In Conference on Neural Information Processing Systems (NeurIPS), pages 3603–3613, 2019.
241
+ [12] Kumar Avinava Dubey, Sashank J. Reddi, Sinead A. Williamson, Barnabás Póczos, Alexander J. Smola, and Eric P. Xing. Variance reduction in stochastic gradient langevin dynamics. In Conference on Neural Information Processing Systems (NIPS), pages 1154–1162, 2016.
242
+ [13] Deng-Ping Fan, Ming-Ming Cheng, Yun Liu, Tao Li, and Ali Borji. Structure-measure: A new way to evaluate foreground maps. In IEEE International Conference on Computer Vision (ICCV), pages 4548–4557, 2017.
243
+ [14] Deng-Ping Fan, Cheng Gong, Yang Cao, Bo Ren, Ming-Ming Cheng, and Ali Borji. Enhancedalignment measure for binary foreground map evaluation. In International Joint Conference on Artificial Intelligence (IJCAI), pages 698–704, 2018.
244
+ [15] Deng-Ping Fan, Zheng Lin, Zhao Zhang, Menglong Zhu, and Ming-Ming Cheng. Rethinking RGB-D Salient Object Detection: Models, Datasets, and Large-Scale Benchmarks. IEEE Transactions on Neural Networks and Learning Systems (TNNLS), 2020.
245
+ [16] Deng-Ping Fan, Yingjie Zhai, Ali Borji, Jufeng Yang, and Ling Shao. BBS-Net: RGB-D salient object detection with a bifurcated backbone strategy network. In European Conference on Computer Vision (ECCV), pages 275–292, 2020.
246
+ [17] Keren Fu, Deng-Ping Fan, Ge-Peng Ji, and Qijun Zhao. JL-DCF: Joint learning and denselycooperative fusion framework for RGB-D salient object detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 3052–3062, 2020.
247
+ [18] Ruiqi Gao, Yang Lu, Junpei Zhou, Song-Chun Zhu, and Ying Nian Wu. Learning generative convnets via multi-grid modeling and sampling. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 9155–9164, 2018.
248
+ [19] Ruiqi Gao, Yang Song, Ben Poole, Ying Nian Wu, and Diederik P. Kingma. Learning energybased models by diffusion recovery likelihood. In International Conference on Learning Representations (ICLR), 2021.
249
+ [20] Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Conference on Neural Information Processing Systems (NIPS), pages 2672–2680, 2014.
250
+ [21] Rick Groenendijk, Sezer Karaoglu, Theo Gevers, and Thomas Mensink. On the benefit of adversarial training for monocular depth estimation. Computer Vision and Image Understanding, 190:102848, 2020.
251
+ [22] Tian Han, Yang Lu, Song-Chun Zhu, and Ying Nian Wu. Alternating back-propagation for generator network. In AAAI Conference on Artificial Intelligence (AAAI), page 1976–1984, 2017.
252
+ [23] Junxian He, Daniel Spokoyny, Graham Neubig, and Taylor Berg-Kirkpatrick. Lagging inference networks and posterior collapse in variational autoencoders. In International Conference on Learning Representations (ICLR), 2019.
253
+ [24] 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), pages 770–778, 2016.
254
+ [25] Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
255
+ [26] Wei-Chih Hung, Yi-Hsuan Tsai, Yan-Ting Liou, Yen-Yu Lin, and Ming-Hsuan Yang. Adversarial learning for semi-supervised semantic segmentation. In British Machine Vision Conference (BMVC), 2018.
256
+ [27] Wei Ji, Jingjing Li, Shuang Yu, Miao Zhang, Yongri Piao, Shunyu Yao, Qi Bi, Kai Ma, Yefeng Zheng, Huchuan Lu, and Li Cheng. Calibrated rgb-d salient object detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 9471–9481, 2021.
257
+ [28] Wei Ji, Jingjing Li, Miao Zhang, Yongri Piao, and Huchuan Lu. Accurate RGB-D salient object detection via collaborative learning. In European Conference on Computer Vision (ECCV), 2020.
258
+ [29] Ran Ju, Yang Liu, Tongwei Ren, Ling Ge, and Gangshan Wu. Depth-aware salient object detection using anisotropic center-surround difference. Signal Processing: Image Communication, 38:115 – 126, 2015.
259
+ [30] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015.
260
+ [31] Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In International Conference on Learning Representations (ICLR), 2014.
261
+ [32] Simon Kohl, Bernardino Romera-Paredes, Clemens Meyer, Jeffrey De Fauw, Joseph R. Ledsam, Klaus Maier-Hein, S. M. Ali Eslami, Danilo Jimenez Rezende, and Olaf Ronneberger. A probabilistic u-net for segmentation of ambiguous images. In Conference on Neural Information Processing Systems (NeurIPS), pages 6965–6975, 2018.
262
+ [33] Quang H. Le, Kamal Youcef-Toumi, Dzmitry Tsetserukou, and Ali Jahanian. Gan mask r-cnn:instance semantic segmentation benefits from generative adversarial networks. arXiv preprint arXiv:2010.13757, 2020.
263
+ [34] Bo Li, Zhengxing Sun, and Yuqi Guo. Supervae: Superpixelwise variational autoencoder for salient object detection. In AAAI Conference on Artificial Intelligence (AAAI), pages 8569–8576, 2019.
264
+ [35] Guanbin Li and Yizhou Yu. Visual saliency based on multiscale deep features. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 5455–5463, 2015.
265
+ [36] Yin Li, Xiaodi Hou, Christof Koch, James M Rehg, and Alan L Yuille. The secrets of salient object segmentation. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 280–287, 2014.
266
+ [37] Jiang-Jiang Liu, Qibin Hou, Ming-Ming Cheng, Jiashi Feng, and Jianmin Jiang. A simple pooling-based design for real-time salient object detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019.
267
+ [38] Jun S Liu. Monte Carlo strategies in scientific computing. Springer Science & Business Media, 2008.
268
+ [39] Nian Liu, Ni Zhang, Kaiyuan Wan, Ling Shao, and Junwei Han. Visual saliency transformer. In IEEE International Conference on Computer Vision (ICCV), pages 4722–4732, 2021.
269
+ [40] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In IEEE International Conference on Computer Vision (ICCV), 2021.
270
+ [41] Zhiming Luo, Akshaya Mishra, Andrew Achkar, Justin Eichel, Shaozi Li, and Pierre-Marc Jodoin. Non-local deep features for salient object detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017.
271
+ [42] Weian Mao, Yongtao Ge, Chunhua Shen, Zhi Tian, Xinlong Wang, and Zhibin Wang. Tfpose: Direct human pose estimation with transformers. arXiv preprint arXiv:2103.15320, 2021.
272
+ [43] Radford M Neal. MCMC using hamiltonian dynamics. Handbook of markov chain monte carlo, 2(11):2, 2011.
273
+ [44] Erik Nijkamp, Mitch Hill, Song-Chun Zhu, and Ying Nian Wu. Learning non-convergent nonpersistent short-run MCMC toward energy-based model. In Conference on Neural Information Processing Systems (NeurIPS), pages 5233–5243, 2019.
274
+ [45] Erik Nijkamp, Bo Pang, Tian Han, Linqi Zhou, Song-Chun Zhu, and Ying Nian Wu. Learning multi-layer latent variable model via variational optimization of short run mcmc for approximate inference. In European Conference on Computer Vision (ECCV), pages 361–378. Springer, 2020.
275
+ [46] Yuzhen Niu, Yujie Geng, Xueqing Li, and Feng Liu. Leveraging stereopsis for saliency analysis. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 454–461, 2012.
276
+ [47] Bo Pang, Tian Han, Erik Nijkamp, Song-Chun Zhu, and Ying Nian Wu. Learning latent space energy-based prior model. In Conference on Neural Information Processing Systems (NeurIPS), 2020.
277
+ [48] Bo Pang and Ying Nian Wu. Latent space energy-based model of symbol-vector coupling for text generation and classification. In International Conference on Machine Learning (ICML), pages 8359–8370, 2021.
278
+ [49] Bo Pang, Tianyang Zhao, Xu Xie, and Ying Nian Wu. Trajectory prediction with latent belief energy-based model. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 11814–11824, 2021.
279
+ [50] Houwen Peng, Bing Li, Weihua Xiong, Weiming Hu, and Rongrong Ji. RGBD salient object detection: A benchmark and algorithms. In European Conference on Computer Vision (ECCV), pages 92–109, 2014.
280
+ [51] Yongri Piao, Wei Ji, Jingjing Li, Miao Zhang, and Huchuan Lu. Depth-induced multi-scale recurrent attention network for saliency detection. In IEEE International Conference on Computer Vision (ICCV), pages 7254–7263, 2019.
281
+ [52] Xuebin Qin, Zichen Zhang, Chenyang Huang, Chao Gao, Masood Dehghan, and Martin Jagersand. Basnet: Boundary-aware salient object detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 7479–7489, 2019.
282
+ [53] Liangqiong Qu, Shengfeng He, Jiawei Zhang, Jiandong Tian, Yandong Tang, and Qingxiong Yang. RGBD salient object detection via deep fusion. IEEE Transactions on Image Processing (TIP), 26(5):2274–2285, 2017.
283
+ [54] René Ranftl, Alexey Bochkovskiy, and Vladlen Koltun. Vision transformers for dense prediction. In IEEE International Conference on Computer Vision (ICCV), pages 12179–12188, 2021.
284
+ [55] Herbert Robbins and Sutton Monro. A stochastic approximation method. The annals of mathematical statistics, pages 400–407, 1951.
285
+ [56] Kihyuk Sohn, Honglak Lee, and Xinchen Yan. Learning structured output representation using deep conditional generative models. In Conference on Neural Information Processing Systems (NIPS), pages 3483–3491, 2015.
286
+ [57] Nasim Souly, Concetto Spampinato, and Mubarak Shah. Semi supervised semantic segmentation using generative adversarial network. In IEEE International Conference on Computer Vision (ICCV), pages 5689–5697, 2017.
287
+ [58] Lucas Stoffl, Maxime Vidal, and Alexander Mathis. End-to-end trainable multi-instance pose estimation with transformers. arXiv preprint arXiv:2103.12115, 2021.
288
+ [59] Peng Sun, Wenhu Zhang, Huanyu Wang, Songyuan Li, and Xi Li. Deep rgb-d saliency detection with depth-sensitive attention and automatic multi-modal fusion. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1407–1417, 2021.
289
+ [60] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Conference on Neural Information Processing Systems (NIPS), pages 5998–6008, 2017.
290
+ [61] Bo Wang, Quan Chen, Min Zhou, Zhiqiang Zhang, Xiaogang Jin, and Kun Gai. Progressive feature polishing network for salient object detection. In AAAI Conference on Artificial Intelligence (AAAI), pages 12128–12135, 2020.
291
+ [62] Lijun Wang, Huchuan Lu, Yifan Wang, Mengyang Feng, Dong Wang, Baocai Yin, and Xiang Ruan. Learning to detect salient objects with image-level supervision. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 136–145, 2017.
292
+ [63] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In IEEE International Conference on Computer Vision (ICCV), pages 568–578, 2021.
293
+ [64] Jun Wei, Shuhui Wang, and Qingming Huang. $\mathrm { F ^ { 3 } }$ net: Fusion, feedback and focus for salient object detection. In AAAI Conference on Artificial Intelligence (AAAI), pages 12321–12328, 2020.
294
+ [65] Jun Wei, Shuhui Wang, Zhe Wu, Chi Su, Qingming Huang, and Qi Tian. Label decoupling framework for salient object detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 13025–13034, 2020.
295
+ [66] Max Welling and Yee Whye Teh. Bayesian learning via stochastic gradient langevin dynamics. In International Conference on Machine Learning (ICML), pages 681–688, 2011.
296
+ [67] Zhe Wu, Li Su, and Qingming Huang. Cascaded partial decoder for fast and accurate salient object detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 3902–3911, 2019.
297
+
298
+ [68] Zhe Wu, Li Su, and Qingming Huang. Stacked cross refinement network for edge-aware salient object detection. In IEEE International Conference on Computer Vision (ICCV), pages 7264–7273, 2019.
299
+
300
+ [69] Jianwen Xie, Ruiqi Gao, Zilong Zheng, Song-Chun Zhu, and Ying Nian Wu. Learning dynamic generator model by alternating back-propagation through time. In AAAI Conference on Artificial Intelligence (AAAI), pages 5498–5507, 2019.
301
+
302
+ [70] Jianwen Xie, Yang Lu, Ruiqi Gao, and Ying Nian Wu. Cooperative learning of energy-based model and latent variable model via MCMC teaching. In AAAI Conference on Artificial Intelligence (AAAI), pages 4292–4301, 2018.
303
+
304
+ [71] Jianwen Xie, Yang Lu, Ruiqi Gao, Song-Chun Zhu, and Ying Nian Wu. Cooperative training of descriptor and generator networks. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 42(1):27–45, 2018.
305
+
306
+ [72] Jianwen Xie, Yang Lu, Song-Chun Zhu, and Yingnian Wu. A theory of generative convnet. In International Conference on Machine Learning (ICML), pages 2635–2644, 2016.
307
+
308
+ [73] Jianwen Xie, Yifei Xu, Zilong Zheng, Song-Chun Zhu, and Ying Nian Wu. Generative pointnet: Deep energy-based learning on unordered point sets for 3d generation, reconstruction and classification. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 14976–14985, 2021.
309
+
310
+ [74] Jianwen Xie, Zilong Zheng, Xiaolin Fang, Song-Chun Zhu, and Ying Nian Wu. Cooperative training of fast thinking initializer and slow thinking solver for conditional learning. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 2021.
311
+
312
+ [75] Jianwen Xie, Zilong Zheng, Ruiqi Gao, Wenguan Wang, Song-Chun Zhu, and Ying Nian Wu. Learning descriptor networks for 3d shape synthesis and analysis. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 8629–8638, 2018.
313
+
314
+ [76] Jianwen Xie, Zilong Zheng, Ruiqi Gao, Wenguan Wang, Song-Chun Zhu, and Ying Nian Wu. Generative voxelnet: Learning energy-based models for 3d shape synthesis and analysis. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 2020.
315
+
316
+ [77] Jianwen Xie, Zilong Zheng, and Ping Li. Learning energy-based model with variational autoencoder as amortized sampler. In AAAI Conference on Artificial Intelligence (AAAI), pages 10441–10451, 2021.
317
+
318
+ [78] Jianwen Xie, Song-Chun Zhu, and Ying Nian Wu. Synthesizing dynamic patterns by spatialtemporal generative convnet. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1061–1069, 2017.
319
+
320
+ [79] Jianwen Xie, Song-Chun Zhu, and Ying Nian Wu. Learning energy-based spatial-temporal generative convnets for dynamic patterns. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 43(2):516–531, 2021.
321
+
322
+ [80] Yihong Xu, Yutong Ban, Guillaume Delorme, Chuang Gan, Daniela Rus, and Xavier AlamedaPineda. Transcenter: Transformers with dense queries for multiple-object tracking. arXiv preprint arXiv:2103.15145, 2021.
323
+
324
+ [81] Bin Yan, Houwen Peng, Jianlong Fu, Dong Wang, and Huchuan Lu. Learning spatio-temporal transformer for visual tracking. In IEEE International Conference on Computer Vision (ICCV), pages 10448–10457, 2021.
325
+
326
+ [82] Qiong Yan, Li Xu, Jianping Shi, and Jiaya Jia. Hierarchical saliency detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1155–1162, 2013.
327
+
328
+ [83] Chuan Yang, Lihe Zhang, Huchuan Lu, Xiang Ruan, and Ming-Hsuan Yang. Saliency detection via graph-based manifold ranking. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 3166–3173, 2013.
329
+
330
+ [84] Jing Zhang, Deng-Ping Fan, Yuchao Dai, Saeed Anwar, Fatemeh Sadat Saleh, Sadegh Aliakbarian, and Nick Barnes. Uncertainty inspired rgb-d saliency detection. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 2021.
331
+
332
+ [85] Jing Zhang, Deng-Ping Fan, Yuchao Dai, Saeed Anwar, Fatemeh Sadat Saleh, Tong Zhang, and Nick Barnes. Uc-net: Uncertainty inspired rgb-d saliency detection via conditional variational autoencoders. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 8582 – 8591, 2020.
333
+
334
+ [86] Jing Zhang, Deng-Ping Fan, Yuchao Dai, Xin Yu, Yiran Zhong, Nick Barnes, and Ling Shao. Rgb-d saliency detection via cascaded mutual information minimization. In IEEE International Conference on Computer Vision (ICCV), pages 4338–4347, 2021.
335
+
336
+ [87] Jing Zhang, Jianwen Xie, and Nick Barnes. Learning noise-aware encoder-decoder from noisy labels by alternating back-propagation for saliency detection. In European Conference on Computer Vision (ECCV), pages 349–366, 2020.
337
+
338
+ [88] Jing Zhang, Jianwen Xie, Zilong Zheng, and Nick Barnes. Energy-based generative cooperative saliency prediction. arXiv preprint arXiv:2106.13389, 2021.
339
+
340
+ [89] Jing Zhang, Xin Yu, Aixuan Li, Peipei Song, Bowen Liu, and Yuchao Dai. Weakly-supervised salient object detection via scribble annotations. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 12543–12552, 2020.
341
+
342
+ [90] Miao Zhang, Weisong Ren, Yongri Piao, Zhengkun Rong, and Huchuan Lu. Select, supplement and focus for RGB-D saliency detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 3472–3481, 2020.
343
+
344
+ [91] Yulun Zhang, Kunpeng Li, Kai Li, Lichen Wang, Bineng Zhong, and Yun Fu. Image superresolution using very deep residual channel attention networks. In European Conference on Computer Vision (ECCV), pages 286–301, 2018.
345
+
346
+ [92] Zhao Zhang, Zheng Lin, Jun Xu, Wenda Jin, Shao-Ping Lu, and Deng-Ping Fan. Bilateral attention network for RGB-D salient object detection. IEEE Transactions on Image Processing (TIP), 30:1949–1961, 2021.
347
+
348
+ [93] Jia-Xing Zhao, Yang Cao, Deng-Ping Fan, Ming-Ming Cheng, Xuan-Yi Li, and Le Zhang. Contrast prior and fluid pyramid integration for RGBD salient object detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 3927–3936, 2019.
349
+
350
+ [94] Jia-Xing Zhao, Jiang-Jiang Liu, Deng-Ping Fan, Yang Cao, Jufeng Yang, and Ming-Ming Cheng. Egnet:edge guidance network for salient object detection. In IEEE International Conference on Computer Vision (ICCV), pages 8778–8787, 2019.
351
+
352
+ [95] Yang Zhao, Jianwen Xie, and Ping Li. Learning energy-based generative models via coarse-tofine expanding and sampling. In International Conference on Learning Representations (ICLR), 2021.
353
+
354
+ [96] Sixiao Zheng, Jiachen Lu, Hengshuang Zhao, Xiatian Zhu, Zekun Luo, Yabiao Wang, Yanwei Fu, Jianfeng Feng, Tao Xiang, Philip HS Torr, and Li Zhang. Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 6881–6890, 2021.
355
+
356
+ [97] Zilong Zheng, Jianwen Xie, and Ping Li. Patchwise generative convnet: Training energy-based models from a single natural image for internal learning. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 2961–2970, 2021.
357
+
358
+ [98] Huajun Zhou, Xiaohua Xie, Jian-Huang Lai, Zixuan Chen, and Lingxiao Yang. Interactive two-stream decoder for accurate and fast saliency detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 9141–9150, 2020.
359
+
360
+ [99] Wangjiang Zhu, Shuang Liang, Yichen Wei, and Jian Sun. Saliency optimization from robust background detection. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 2814–2821, 2014.
md/train/MIDckA56aD/MIDckA56aD.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/OmtmcPkkhT/OmtmcPkkhT.md ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MULTIPLICATIVE FILTER NETWORKS
2
+
3
+ Rizal Fathony∗
4
+ Bosch Center for Artificial Intelligence Pittsburgh, PA
5
+ rizal.fathony@us.bosch.com
6
+
7
+ Anit Kumar Sahu∗† Amazon Alexa AI Seattle, WA anit.sahu@gmail.com
8
+
9
+ Devin Willmott∗
10
+ Bosch Center for Artificial Intelligence Pittsburgh, PA
11
+ devin.willmott@us.bosch.com
12
+ J. Zico Kolter
13
+ Bosch Center for Artificial Intelligence
14
+ Carnegie Mellon University
15
+ Pittsburgh, PA
16
+ zkolter@cs.cmu.edu
17
+
18
+ # ABSTRACT
19
+
20
+ Although deep networks are typically used to approximate functions over high dimensional inputs, recent work has increased interest in neural networks as function approximators for low-dimensional-but-complex functions, such as representing images as a function of pixel coordinates, solving differential equations, or representing signed distance functions or neural radiance fields. Key to these recent successes has been the use of new elements such as sinusoidal nonlinearities or Fourier features in positional encodings, which vastly outperform simple ReLU networks. In this paper, we propose and empirically demonstrate that an arguably simpler class of function approximators can work just as well for such problems: multiplicative filter networks. In these networks, we avoid traditional compositional depth altogether, and simply multiply together (linear functions of) sinusoidal or Gabor wavelet functions applied to the input. This representation has the notable advantage that the entire function can simply be viewed as a linear function approximator over an exponential number of Fourier or Gabor basis functions, respectively. Despite this simplicity, when compared to recent approaches that use Fourier features with ReLU networks or sinusoidal activation networks, we show that these multiplicative filter networks largely outperform or match the performance of these approaches on the domains highlighted in these past works.
21
+
22
+ # 1 INTRODUCTION
23
+
24
+ Neural networks are most commonly used to approximate functions over high-dimensional input spaces, such as functions that operate on images or long text sequences. However, there has been a recent growing interest in neural networks used to approximate low-dimensional-but-complex functions: for example, one could represent a continuous image as a function $f : \mathbb { R } ^ { 2 } \to \mathbb { R } ^ { 3 }$ where the input to this function specifies $( x , y )$ coordinates of a location in the image, and the output specifies the RGB value of the pixel at that location. However, two recent papers in particular have argued that specific architectural changes are required to make (fully-connected) deep networks suitable to this task: Sitzmann et al. (2020) employ sinusoidal activation functions within a multi-layer networks (called the SIREN architecture); and Tancik et al. (2020) propose random Fourier features input to a traditional ReLU-based network. Both papers show that the resulting networks can approximate these low-dimensional functions much better than simple feedforward ReLU networks, and achieve striking results in representing fairly complex functions (e.g. 3D signed distance fields or neural radiance fields) with a high degree of fidelity. However, the precise benefit of sinusoidal bases or a first layer of Fourier features seems difficult to characterize, and it remains unclear why such representations work well for these tasks.
25
+
26
+ In this paper, however, we argue and empirically demonstrate that an arguably simpler class of functions can work as well or better than these previously-proposed networks on this task. Specifically, we propose an architecture we call the multiplicative filter network (MFN). Unlike a traditional multi-layer network that achieves representation power through compositional depth, the MFN instead simply repeatedly applies nonlinear filters (such as a sinusoid or a Gabor wavelet function) to the network’s input, then multiplies together linear functions of these features. The notable advantage of this representation that, owing to the multiplicative properties of Fourier and Gabor filters, the entire function is ultimately just a linear function of (an exponential number of) these Fourier or Gabor features of the input. Indeed, we can express the exact linear form of these MFNs, which can make their analysis considerably simpler than that for deep networks, where compositions of nonlinear activation’s make the entire function difficult to characterize.
27
+
28
+ In this work, we show that despite this simplicity, the proposed networks often perform as well or better than the previously proposed SIREN or Fourier feature networks. Specifically, we compare our approach on networks with comparable numbers of parameters to the exact benchmarks proposed in the SIREN and Fourier features papers. We show that MFNs achieve better performance deltas when increasing the depth or width of the networks. Despite this, we do emphasize that SIREN networks, in particular, appear to retain some notable advantages over MFNs, such as a bias towards smoother regions in the represented function and its gradients. However, especially given the fact that MFNs ultimately just correspond to a linear Fourier or Wavelet representation of a lowdimensional function, we believe they should be considered a standard benchmark for future work on such problems, to indicate where the compositional depth of typical deep networks can propose a substantial benefit.
29
+
30
+ # 2 BACKGROUND AND RELATED WORK
31
+
32
+ Our approach is related to many previous works in Fourier and Wavelet transforms, random Fourier features, and implicit neural representations. We explore the connection among the areas below.
33
+
34
+ Fourier and Wavelet transforms. Transforming time or space domain signals to frequency domain using transforms such as Fourier and Wavelet transforms have been at the heart of many developments in image processing, signal processing, and computer vision. In particular, the Fourier transform (Bracewell & Bracewell, 1986; Vetterli et al., 2014) and its various forms have found usage in myriad applications, such as spectroscopy, quantum mechanics, signal processing. Wavelet transforms, which in particular aid in multi-scale analysis, have been found to be particularly useful in data compression, JPEG2000 (Rabbani, 2002) being one example.
35
+
36
+ Random Fourier features. A seminal work by Rahimi & Recht (2008) demonstrates the power of Fourier transform in machine learning applications. They show that simply projecting the original dataset into random Fourier bases vastly improves the expressiveness of models as it approximates kernel computations. Many subsequent works apply the Fourier features and variations (Rahimi & Recht, 2009; Le et al., 2013; Yu et al., 2016) to improve machine learning algorithm performance in many domain areas, including classification (Sun et al., 2018; Rawat et al., 2019), regression (Avron et al., 2017; Brault et al., 2016), clustering (Chitta et al., 2012; Liu et al., 2019), online learning (Lin et al., 2014; Hu et al., 2015), and deep learning (Xue et al., 2019; Mehrkanoon & Suykens, 2018; Rick Chang et al., 2016; Mairal et al., 2014; Jacot et al., 2018; Tancik et al., 2020).
37
+
38
+ Implicit neural representations. A recent line of work in representing signals as a continuous function parameterized by neural network (instead of using the traditional discrete representation) is gaining popularity. This strategy has been used to represent different objects such as images (Nguyen et al., 2015; Stanley, 2007), shapes (Park et al., 2019; Genova et al., 2019; Chen & Zhang, 2019; Chabra et al., 2020), scenes (Mildenhall et al., 2020; Sitzmann et al., 2019; Jiang et al., 2020; Niemeyer et al., 2020), and textures (Oechsle et al., 2019; Henzler et al., 2020). In most of these applications, the standard neural networks architecture with multi-layer perceptrons and ReLU activation function is often used. Recently, motivated by the success of Fourier transform in machine learning, a few papers have suggested architectural changes that integrate periodic nonlinearities into the network. Mildenhall et al. (2020); Zhong et al. (2020); Tancik et al. (2020) proposed the use of sinusoidal mapping of the input features (Rahimi & Recht, 2008) that uses positional encoding and Gaussian random distribution in the mapping. Others (Klocek et al., 2019; Sitzmann et al., 2020) have proposed the use of sinusoidal activation function within a multi-layer perceptron architecture.
39
+
40
+ Both of these strategies are demonstrated to vastly improve the results on many object representation tasks.
41
+
42
+ # 3 MULTIPLICATIVE FILTER NETWORKS
43
+
44
+ A traditional $k$ -layer deep network $f : \mathbb { R } ^ { n } \mathbb { R } ^ { m }$ is typically defined by a recurrence such as:
45
+
46
+ $$
47
+ \begin{array} { r } { z ^ { ( 1 ) } = x \qquad } \\ { z ^ { ( i + 1 ) } = \sigma \left( W ^ { ( i ) } z ^ { ( i ) } + b ^ { ( i ) } \right) , i = 1 , \dots , k - 1 \qquad } \\ { f ( x ) = W ^ { ( k ) } z ^ { ( k ) } + b ^ { ( k ) } \qquad } \end{array}
48
+ $$
49
+
50
+ where $\sigma$ denotes a nonlinearity applied elementwise, $W ^ { ( i ) } \in \mathbb { R } ^ { d _ { i + 1 } \times d _ { i } }$ and $b ^ { ( i ) } \in \mathbb { R } ^ { d _ { i + 1 } }$ denote the weight and bias of the ith layer, and $z ^ { ( i ) } \in \mathbb { R } ^ { d _ { i } }$ denotes the hidden unit at layer $i$ . We refer to these networks as compositional depth networks, because each nonlinearity is applied compositionally to outputs of the previous nonlinearity in order to achieve its representational complexity.
51
+
52
+ The SIREN or Fourier feature networks of (Sitzmann et al., 2020) and Tancik et al. (2020) respectively can be viewed as simple specializations of this structure. In a SIREN network, one uses the sinusoid $\sigma ( x ) = \sin ( x )$ as the nonlinearity, plus proper initialization of the weights and scaling of the input. In a Fourier features network, one replaces the input layer with
53
+
54
+ $$
55
+ z ^ { ( 1 ) } = \left[ \begin{array} { l } { \sin ( \Omega x + \phi ) } \\ { \cos ( \Omega x + \phi ) } \end{array} \right]
56
+ $$
57
+
58
+ where $\Omega \in \mathbb { R } ^ { \frac { d _ { 1 } } { 2 } \times n }$ is matrix of random $\mathcal { N } ( 0 , \tau ^ { 2 } )$ variables $\mathit { \Pi } _ { \tau }$ being a hyperparameter of the method), but with the typical ReLU nonlinearities $\sigma ( x ) = \mathrm { R e L U } ( x )$ .
59
+
60
+ Our proposed multiplicative filter network, in contrast, uses a different recursion that never results in composition of nonlinear functions. Specifically, an MFN is defined via the following recursion
61
+
62
+ $$
63
+ \begin{array} { r l } & { z ^ { ( 1 ) } = g \left( x ; \theta ^ { ( 1 ) } \right) } \\ & { z ^ { ( i + 1 ) } = \left( W ^ { ( i ) } z ^ { ( i ) } + b ^ { ( i ) } \right) \circ g \left( x ; \theta ^ { ( i + 1 ) } \right) , i = 1 , \dots , k - 1 } \\ & { f ( x ) = W ^ { ( k ) } z ^ { ( k ) } + b ^ { ( k ) } } \end{array}
64
+ $$
65
+
66
+ where $\circ$ denotes elementwise multiplication, $W ^ { ( i ) } , \boldsymbol { b } ^ { ( i ) } ,$ $z ^ { ( i ) }$ are all defined as above, but where $g : \mathbb { R } ^ { n } \mathbb { R } ^ { d _ { i } }$ is parameterized by parameters $\theta ^ { ( i ) }$ (the size of $\theta ^ { ( i ) }$ can vary to implicitly define the output dimensions $d _ { i }$ ) and denotes a nonlinear filter applied to the input directly. Of immediate importance here is that in such a network, we never apply a nonlinearity to the output of a previous nonlinearity. All the nonlinearity of the network occurs within the $g$ functions; layers $z ^ { ( i ) }$ , after passing through a linear function, are simply multiplied by new filters of the input. This results in a considerably different type of function that is currently employed by most multi-layer networks, and indeed it is largely only by convention that we refer to such a function as a “network” at all.
67
+
68
+ We now present two instantiations of the MFN, using sinusoids or a Gabor wavelet as the filter $g$ ; we call these two networks the FOURIERNET and GABORNET respectively. As we show, the crucial property of a function $f$ represented by a FOURIERNET or GABORNET is that the entire function $f$ can also be written as a linear combination of sinusoids and Gabor wavelets of the input respectively (albeit an exponentially large number of such features, but of course also with a highly reduced space of allowable coefficients on this exponential number of terms, since there are only a polynomial number of parameters that define the MFN). Thus, we would claim that the MFN really looks more like a (rich) Fourier or Wavelet representation of the underlying signal, just one that happens to have a similar parameterization as deep networks (and which can be tuned by typical gradient descent methods).
69
+
70
+ # 3.1 MULTIPLICATIVE FOURIER NETWORKS
71
+
72
+ As our first instantiation of the MFN, we consider using a simple sinusoidal filter
73
+
74
+ $$
75
+ g ( x ; \theta ^ { ( i ) } ) = \sin ( \omega ^ { ( i ) } x + \phi ^ { ( i ) } )
76
+ $$
77
+
78
+ with parameters $\theta ^ { ( i ) } = \{ \omega ^ { ( i ) } \in \mathbb { R } ^ { d _ { i } \times n } , \phi ^ { ( i ) } \in \mathbb { R } ^ { d _ { i } } \}$ . We term such a network the FOURIERNET, as the sinusoidal activation (with arbitrary phase shifts, to represent sine or cosine functions equally) corresponds naturally to a Fourier random feature representation of the entire function.
79
+
80
+ An immediate and compelling feature of the FOURIERNET, compared to networks based upon composition, is that its output can be directly viewed as a linear function of (an exponential number of) Fourier bases, with a low-rank set of coefficients determined by the parameters of the network. This is conveyed by the following theorem.
81
+
82
+ Theorem 1. The output of a Fourier Network is given by a linear combination of sinusoidal bases,
83
+
84
+ $$
85
+ f _ { j } ( x ) = \sum _ { t = 1 } ^ { T } \bar { \alpha } _ { t } \sin ( \bar { \omega } _ { t } x + \bar { \phi } _ { t } ) + \bar { b } ,
86
+ $$
87
+
88
+ for some coefficients $\bar { \alpha } _ { 1 : T }$ , frequencies $\bar { \omega } _ { 1 : T }$ , phase offsets $\bar { \phi } _ { 1 : T }$ , and bias term $\bar { b }$
89
+
90
+ In other words, the FOURIERNET represents its final function as a linear combination of traditional Fourier bases, just as do “classical” random Fourier features, for instance. The key element of the proof (given in the appendix) is the fact that for two Fourier filters, with parameters $\omega , \phi$ and $\tau , \psi$ respectively, their elementwise product can be transformed to a sum of the same type of filters
91
+
92
+ $$
93
+ \sin ( \omega x + \phi ) \circ \sin ( \tau x + \psi ) = { \frac { 1 } { 2 } } \cos \left( ( \omega - \tau ) x + \phi - \psi \right) - { \frac { 1 } { 2 } } \cos \left( ( \omega + \tau ) x + \phi + \psi \right)
94
+ $$
95
+
96
+ (note that the cosine can be expressed as a sine with a separate phase offset). Moreover, an inspection of the proof also lets us compute the exact coefficients of the linear expansion, as a function of the network parameters. This is shown in the following corollary.
97
+
98
+ Corollary 1. Let $i _ { 1 } , i _ { 2 } , \ldots , i _ { k - 1 }$ range over all $\textstyle \prod _ { j = 1 } ^ { k - 1 } d _ { j }$ possible indices of each hidden unit of each layer of an MFN, and let $s _ { 2 } , \ldots , s _ { k } \in \{ - 1 , + 1 \}$ range over all $2 ^ { k - 1 }$ possible binary signs; then the expansion of $z _ { i _ { k } } ^ { ( k ) }$ from (2) is given by all the terms
99
+
100
+ $$
101
+ \begin{array} { l } { \bar { \alpha } = \left\{ \displaystyle \frac { 1 } { 2 ^ { k - 1 } } W _ { i _ { k } , i _ { k - 1 } } ^ { ( k - 1 ) } \cdot \cdot \cdot W _ { i _ { 3 } , i _ { 2 } } ^ { ( 2 ) } W _ { i _ { 2 } , i _ { 1 } } ^ { ( 1 ) } \right\} } \\ { \bar { \omega } = \left\{ s _ { k } \omega _ { i _ { k } } ^ { ( k ) } + \ldots + s _ { 2 } \omega _ { i _ { 2 } } ^ { ( 2 ) } + \omega _ { i _ { 1 } } ^ { ( 1 ) } \right\} } \\ { \bar { \phi } = \left\{ s _ { k } \phi _ { i _ { k } } ^ { ( k ) } + \ldots + s _ { 2 } \phi _ { i _ { 2 } } ^ { ( 2 ) } + \phi _ { i _ { 1 } } ^ { ( 1 ) } + \displaystyle \frac { \pi } { 2 } \sum _ { i = 2 } ^ { k } s _ { k } \right\} . } \end{array}
102
+ $$
103
+
104
+ with a similar form for terms that begin at the $i > 1$ layer, multiplied by the corresponding $b _ { i _ { j } } ^ { ( j ) }$ term.
105
+
106
+ This corollary follows simply by inspection of the proof in the appendix, noting that each additional multiplicative layer creates both a positive and negative combination of frequencies in the sinusoid terms, and a multiplication of the corresponding entries of $W$ . In other words, the multiplicative “depth” of the FOURIERNET allows it to represent an exponential number of sinusoidal functions, but with the constraint that the actual number of coefficients on these features is given by a “lowrank” tensor consisting mainly of the coefficients in the $W$ matrices. This expansion also suggests a method for initializing parameters specific to this network in a manner that scales appropriately with the network size. Specifically, however $W ^ { ( i ) } \mathbf { s }$ are initialized (typically random uniform or Gaussian, though here with an additional scaling factor that depends on the relative scale of the input), one should divide these terms by $\sqrt { k }$ , to ensure that the variance of the final frequency $\omega _ { t }$ is independent of the number of layers.
107
+
108
+ # 3.2 MULTIPLICATIVE GABOR NETWORKS
109
+
110
+ A well-known deficiency of the pure Fourier bases is that they have global support, and thus may have difficulty representing more local features. A common alternative to these bases is the use of Gabor filter to capture both a frequency and spatial locality component. Specifically, we consider a Gabor filter of the form
111
+
112
+ $$
113
+ g _ { j } ( x ; \theta ^ { ( i ) } ) = \exp \left( - \frac { \gamma _ { j } ^ { ( i ) } } { 2 } \left\| x - \mu _ { j } ^ { ( i ) } \right\| _ { 2 } ^ { 2 } \right) \sin \left( \omega _ { j } ^ { ( i ) } x + \phi _ { j } ^ { ( i ) } \right)
114
+ $$
115
+
116
+ ![](images/235304ef33435a84be48f88e9c2d75cda774c4b8f31dc7e4bfc65f9c5f8fd31b.jpg)
117
+ Figure 1: Left: Performance of various models on an image representation task (top row) and three frames from a video representation task (remaining rows). Leftmost column shows ground truth. Right: PSNR of each model in the image reconstruction task for the first 1000 training iterations.
118
+
119
+ with parameters $\theta ^ { ( i ) } \ = \ \left\{ \gamma _ { 1 : d _ { i } } ^ { ( i ) } \in \mathbb { R } , \mu _ { 1 : d _ { i } } ^ { ( i ) } \in \mathbb { R } ^ { n } , \omega _ { 1 : d _ { i } } ^ { ( i ) } \in \mathbb { R } ^ { n } , \phi _ { 1 : d _ { i } } ^ { ( i ) } \in \mathbb { R } \right\}$ (here $\mu _ { j } ^ { ( i ) }$ denotes the mean of the $j$ th Gabor filter and $\gamma _ { j } ^ { ( i ) }$ denotes the scale term), and where for simplicity we specify the functional form of each $j = 1 \ldots , d _ { i }$ coordinates of the function $g : \mathbb { R } ^ { n } \mathbb { R } ^ { d _ { i } }$ . We call the MFN using this filter the GaborNet.
120
+
121
+ As with the FourierNet, a compelling feature of the Gabor network is that the final function $f$ can be represented as a linear combination of Gabor filters. This is captured by the following theorem:
122
+
123
+ Theorem 2. The output of a Gabor Network is given by a linear combination of Gabor bases,
124
+
125
+ $$
126
+ f _ { j } ( x ) = \sum _ { t = 1 } ^ { T } \bar { \alpha } _ { t } \exp \left( - \frac { 1 } { 2 } \bar { \gamma } _ { t } \| x - \bar { \mu } _ { t } \| ^ { 2 } \right) \sin ( \bar { \omega } _ { t } x + \bar { \phi } _ { t } ) + \bar { b } ,
127
+ $$
128
+
129
+ for coefficients $\bar { \alpha } _ { 1 : T }$ , scales $\bar { \gamma } _ { 1 : T }$ , means $\bar { \mu } _ { 1 : T ; }$ , frequencies $\bar { \omega } _ { 1 : T }$ , phase offsets $\bar { \phi } _ { 1 : T }$ , and bias term $\bar { b }$
130
+
131
+ The proof is given in the appendix, but the basic procedure is the same as the above: using the fact that just like Fourier filters, the product of Gabor filters is also a linear combination of (a different set of) Gabor filters. Likewise, we can also compute the explicit form of the coefficients and for this linear basis expansion, with the explicit form again given in the appendix. One relevant point, though, is how we choose initializations for the $\gamma$ and $\mu$ parameters. Since $\gamma$ effectively acts as an inverse covariance term of a Gaussian, a ${ \mathrm { G a m m a } } ( \alpha , \beta )$ random variable (the conjugate prior of the Gaussian inverse covariance), is a reasonable choice for this parameter. And since the $\bar { \gamma }$ functions in the final linear expansion end up being a sum of the individual random $\gamma ^ { ( i ) }$ terms at each layer, we scale each layer’s $\alpha$ term by $1 / k$ to effectively control this parameter at the final layer. We also simply choose each $\mu ^ { ( i ) }$ to be uniformly distributed over the range of the allowable input space $x$ .
132
+
133
+ # 4 EXPERIMENTAL RESULTS
134
+
135
+ We test MFNs on a broad range of representation tasks, showing that the relative simplicity of MFNs improves upon the performance of existing neural representation methods. Our set of experiments draws from those presented in Sitzmann et al. (2020) alongside SIREN (image representation, shape representation, and differential equation experiments) and in Tancik et al. (2020) alongside Fourier feature networks with Gaussian random features, which we call FF Gaussian (image generalization and 3D inverse rendering experiments). In each case, we compare against the set of models tested in the original experiment (generally, either SIREN or FF Gaussian, along with a basic ReLU MLP). A PyTorch implementation of MFN is available at https: //github.com/boschresearch/multiplicative-filter-networks, and full details on hyperparameters and training specifications are available in the appendix.
136
+
137
+ ![](images/c01ca2434e5a670f74ba1b510eb04b01d7fc87e132f9988f555fea2f0dbf540c.jpg)
138
+ Figure 2: Image generalization samples from the Natural and Text datasets.
139
+
140
+ # 4.1 IMAGE REPRESENTATION & GENERALIZATION
141
+
142
+ We first examine the ability of several networks architectures in the task of image representation as described in Section 1, where we fit the network to a function $f : \mathbb { R } ^ { 2 } \to \mathbb { R } ^ { c }$ using a dataset where input coordinates $( x , y )$ corresponding to the output pixel value at those coordinates (with $c = 1$ or 3 for grayscale or RGB images, respectively). To demonstrate this, we construct such a dataset from a $2 5 6 \times 2 5 6$ pixel grayscale image and fit various models using a simple mean squared error (MSE) loss, including SIREN, GABORNET, FOURIERNET, and ReLU MLPs with and without positional encoding (PE). Visual results and a plot of PSNR early in training are shown in (Figure 1). In particular, both FOURIERNET and GABORNET show quicker initial convergence than other architectures. PSNRs after training (Table 1) show that SIREN eventually outperforms FOURIERNET, while GABORNET remains the best model throughout the training. Indeed, after only 1000 training iterations, GABORNET performs reconstruction better than all other models trained for 10 times longer.
143
+
144
+ Table 1: PSNR of each model’s reconstruction in image and video representation tasks after 10,000 training iterations. For video representation, mean $\pm$ standard deviation over all frames is reported.
145
+
146
+ <table><tr><td>Method</td><td colspan="2">PSNR (in dB) Image Video</td></tr><tr><td>FFBasic</td><td>20.13</td><td>24.09 ±1.03</td></tr><tr><td>FFPositional</td><td>40.09</td><td>27.90 ± 0.99</td></tr><tr><td>SIREN</td><td>56.54</td><td>30.58 ± 0.93</td></tr><tr><td>FOURIERNET</td><td>43.32</td><td>27.93 ± 0.91</td></tr><tr><td>GABORNET</td><td>73.98</td><td>29.83 ± 0.71</td></tr></table>
147
+
148
+ We can broaden the task above to represent video by appending a third dimension to the input: the output corresponding to the input $( x , y , t )$ is the pixel value at $( x , y )$ at frame $t$ . We aim to represent a 300 frame color video with $5 1 2 \times 5 1 2$ resolution in this manner, testing all of the architectures used in the previous experiment. As shown in Figure 1, SIREN and GABORNET are most capable of reproducing fine details of the original video, such as whiskers and and eye color. This is reflected in the PSNR of these reconstructions (Table 1); SIREN performs best with a PSNR over $3 0 \mathrm { d B }$ , while the GABORNET reconstruction comes within 1 dB of SIREN and exhibits much lower variation across frames than any other model.
149
+
150
+ In addition to representing images, we demonstrate that the MFNs are able to generalize the representation to unseen pixels. We train the networks using only $2 5 \%$ of the image pixels (every other pixel in the width and height dimensions) and evaluate using the complete images. We compare the results of our methods with the Fourier feature networks on two datasets (natural and text images) presented in Tancik et al. (2020). The peak signal-to-noise ratio (PSNR) metric is used to evaluate the performance. As we can see from Table 2, both FOURIERNET and GABOR
151
+
152
+ Table 2: Image generalization results (mean $\pm$ standard deviation of PSNR).
153
+
154
+ <table><tr><td>Method</td><td>Natural</td><td>Text</td></tr><tr><td>FF Basic</td><td>21.61 ± 2.62</td><td>20.50± 2.13</td></tr><tr><td>FF Positional</td><td>25.13 ± 4.01</td><td>26.49 ± 3.11</td></tr><tr><td>FF Gaussian</td><td>25.57 ± 4.18</td><td>30.46 ± 1.97</td></tr><tr><td>FOURIERNET</td><td>26.03 ± 2.77</td><td>31.02 ± 2.04</td></tr><tr><td>GABORNET</td><td>26.18 ± 2.95</td><td>31.19 ± 2.00</td></tr></table>
155
+
156
+ NET outperform all versions of the Fourier feature networks that uses basic, positional encoding, and random Gaussian features. Some examples of the generated images are presented in Figure
157
+
158
+ ![](images/afd1188c01f127ebf76a845eb95c19c023e2ebf71bc071e7e0b0d2192512d9a1.jpg)
159
+ Figure 3: Poisson Image Reconstruction: In the left and right figures, an image on the left is reconstructed using gradients and Laplacians respectively; the top row depicts the reconstructed images, while the bottom row indicates the fitted gradients and the fitted Laplacians.
160
+
161
+ 2, with additional images in Appendix B.2. Visually, the MFNs’ generated images also have better quality over the baselines, particularly in Text datasets. Some parts of the text are missing in the baselines images (highlighted with red rectangles in Figure 2), whereas the MFNs completely generate all parts of the text in the images.
162
+
163
+ # 4.2 DIFFERENTIAL EQUATIONS
164
+
165
+ In this section, we aim to solve boundary value problems which are supervised by different forms of gradient information from the functional at hand. We first focus on the Poisson equation, where we demonstrate image reconstruction in two settings where the supervision for the model is brought about by gradients and Laplacians respectively. It is worth noting that the model is never presented with real function values. We then focus on two 2nd order differential equations, namely, the Helmholtz equation and the wave equation, where we solve for the wave field, where the network is supervised by a known source function.
166
+
167
+ We demonstrate image reconstruction using gradients and compare the performance of FOURIERNET and GABORNET with SIREN and ReLU MLP for the Poisson equation. We use the same loss function as in (Sitzmann et al., 2020) in (5). Figures 3a and 3b show that the image is reconstructed successfully when the networks are trained while being supervised by gradients and Laplacians respectively, while ReLU fails spectacularly. Table 3 depicts the losses of each method after 10000 iterations, where it can be seen that GABORNET beats other baselines in terms of performance.
168
+
169
+ The Helmholtz and wave equations are related to the physical modeling of diffusion and waves and are closely related to a Fourier transform. Hence, we focus our attention on describing the Helmholtz equation. We aim to solve for the wave field and compare the performance of FOURIERNET and GABORNET with SIREN and ReLU MLP. To accommodate for complex-valued solutions, the network is configured to output two values which can be interpreted as the real and imaginary parts. We use the same loss function as used in (Sitzmann et al., 2020) (see Section 4.3 of (Sitzmann et al., 2020) for details). Figure 4 shows the magnitude and the phase of the reconstructed wave front for a single Gaussian source placed at the center of a medium with uniform wave propagation velocity. Table 3 depicts the losses of each method after 50000 iterations, and shows that GABORNET beats FOURIERNET and SIREN in terms of performance, while, as previously shown in (Sitzmann et al., 2020), ReLU MLP fails miserably. Details pertaining to the network and training are relegated to Appendix B.3.
170
+
171
+ ![](images/c062514c30b6bc4c47c8c4562d915d23494ee00f6ecae08bd017078eea666466.jpg)
172
+ Figure 5: Shape representations from fitting signed distance functions (a). 2D rendered photographs from view synthesis experiments (b).
173
+
174
+ # 4.3 SHAPE REPRESENTATION VIA SIGNED DISTANCE FIELDS
175
+
176
+ Recent work (Park et al., 2019) has explored the problem of 3D shape representation with neural architectures, often with surprisingly effective results. This is done by training on raw geometric data: given an oriented point cloud, we seek to learn a function $f : \mathbb { R } ^ { 3 } \mathbb { R }$ that takes points as input such that the zero level set $\{ x \mid f ( x ) = 0 \}$ of the network accurately represents the surfaces of the shape. Effective training objectives for this task has been explored in considerable depth; we use the training loss presented by Park et al. (2019) and used in Sitzmann et al. (2020), which includes terms involving the
177
+
178
+ ![](images/a5ab3ebc60c65f0b4561c4260f876ee0e4e7b98a41a7ee7956dae03448454241.jpg)
179
+ Figure 4: Solving Helmholtz equation for a single point source placed at the center of a medium with uniform wave propagation velocity. The top row presents the magnitude, while the bottom row presents the phase.
180
+
181
+ network’s output (penalties to encourage SDF values near and away from 0 for surface and offsurface points, respectively) as well as its gradients (a term encouraging the gradient to match the surface points’ normals, and a gradient norm penalty throughout the entire 3D space). A complete description of the loss function is left to the appendix.
182
+
183
+ Figure 5a shows the results of our shape representation task on SIREN, a standard ReLU MLP, and both variants of MFN. As can be seen, the ReLU network’s fails to represent some features of the scene entirely, such as doorways, picture frames, and pillows. Both MFN architectures far outperform this baseline, and are able to reconstruct the room and objects within it to a recognizable degree. However, likely owing to its strong ability to produce smooth outputs and gradients, SIREN is largely able to avoid the visual artifacts on flat surfaces like walls that remain in reconstructions by FOURIERNET and, to a lesser extent, GABORNET.
184
+
185
+ # 4.4 3D INVERSE RENDERING FOR VIEW SYNTHESIS
186
+
187
+ In this view synthesis task, we aim to reconstruct 3D representation from the observed 2D photographs. Using the reconstructed 3D representation, we then render 2D images from new viewpoints. We use the “simplified Neural Radiance Fields (NeRF)” task on Lego dataset presented in Tancik et al. (2020). The networks are trained to predict the color (in RGB format) and the volume density at a given 3D location of the viewpoint. Volumetric rendering is then used to re-render the 2D image photograph at the viewpoint. The training loss is computed as the mean squared error between the rendered photograph and the actual 2D image observations. The results in Table 4 show that both MFNs perform competitively in the task. GABORNET has a slight advantage over the baselines and FOURIERNET in terms of the overall PSNR metric. It also arguably produces a slightly better image rendering quality as shown in Figure 5b and other images in Appendix B.5.
188
+
189
+ # 5 CONCLUSION
190
+
191
+ We have introduced multiplicative filter networks (MFNs), a class of neural representation architectures that forego the usual compositional notion of network depth in favor of a similarly expressive multiplicative operation. They also admit a natural signal processing interpretation, as in the two instantiations of MFNs, FOURIERNET and GABORNET, which are proven to be exactly equivalent to a linear combination of sinusoidal or Gabor wavelet bases, respectively. In experiments, we show that, despite their simplicity relative to other deep architectures designed for implicit representation, MFNs stand up to or surpass the previous state of the art on a battery of representation tasks.
192
+
193
+ Table 4: View synthesis results (mean $\pm$ st.d. of PSNR).
194
+
195
+ <table><tr><td>Method</td><td>PSNR</td></tr><tr><td>FF Basic</td><td>23.37 ± 0.96</td></tr><tr><td>FF Positional</td><td>25.76 ± 0.79</td></tr><tr><td>FF Gaussian</td><td>25.76 ± 0.92</td></tr><tr><td>FOURIERNET</td><td>25.20 ± 0.72</td></tr><tr><td>GABORNET</td><td>25.81 ± 0.76</td></tr></table>
196
+
197
+ # REFERENCES
198
+
199
+ Haim Avron, Michael Kapralov, Cameron Musco, Christopher Musco, Ameya Velingker, and Amir Zandieh. Random fourier features for kernel ridge regression: Approximation bounds and statistical guarantees. In International Conference on Machine Learning, pp. 253–262, 2017.
200
+ Ronald Newbold Bracewell and Ronald N Bracewell. The Fourier transform and its applications, volume 31999. McGraw-Hill New York, 1986.
201
+ Romain Brault, Markus Heinonen, and Florence Buc. Random fourier features for operator-valued kernels. In Asian Conference on Machine Learning, pp. 110–125, 2016.
202
+ Rohan Chabra, Jan Eric Lenssen, Eddy Ilg, Tanner Schmidt, Julian Straub, Steven Lovegrove, and Richard Newcombe. Deep local shapes: Learning local sdf priors for detailed 3d reconstruction. arXiv preprint arXiv:2003.10983, 2020.
203
+ Zhiqin Chen and Hao Zhang. Learning implicit fields for generative shape modeling. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5939–5948, 2019.
204
+ Radha Chitta, Rong Jin, and Anil K Jain. Efficient kernel clustering using random fourier features. In 2012 IEEE 12th International Conference on Data Mining, pp. 161–170. IEEE, 2012.
205
+ Kyle Genova, Forrester Cole, Daniel Vlasic, Aaron Sarna, William T Freeman, and Thomas Funkhouser. Learning shape templates with structured implicit functions. In Proceedings of the IEEE International Conference on Computer Vision, pp. 7154–7164, 2019.
206
+ Philipp Henzler, Niloy J Mitra, and Tobias Ritschel. Learning a neural 3d texture space from 2d exemplars. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8356–8364, 2020.
207
+ Zhen Hu, Ming Lin, and Changshui Zhang. Dependent online kernel learning with constant number of random fourier features. IEEE transactions on neural networks and learning systems, 26(10): 2464–2476, 2015.
208
+ Arthur Jacot, Franck Gabriel, and Clement Hongler. Neural tangent kernel: Convergence and gen- ´ eralization in neural networks. In Advances in neural information processing systems, pp. 8571– 8580, 2018.
209
+ Chiyu Jiang, Avneesh Sud, Ameesh Makadia, Jingwei Huang, Matthias Nießner, and Thomas Funkhouser. Local implicit grid representations for 3d scenes. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6001–6010, 2020.
210
+ Sylwester Klocek, Łukasz Maziarka, Maciej Wołczyk, Jacek Tabor, Jakub Nowak, and Marek Smieja. Hypernetwork functional image representation. In ´ International Conference on Artificial Neural Networks, pp. 496–510. Springer, 2019.
211
+
212
+ Quoc Le, Tamas Sarl ´ os, and Alex Smola. Fastfood-approximating kernel expansions in loglinear ´ time. In Proceedings of the international conference on machine learning, volume 85, 2013.
213
+
214
+ Ming Lin, Shifeng Weng, and Changshui Zhang. On the sample complexity of random fourier features for online learning: How many random fourier features do we need? ACM Transactions on Knowledge Discovery from Data (TKDD), 8(3):1–19, 2014.
215
+
216
+ Jingshu Liu, Li Wang, and Jinglei Liu. Efficient preference clustering via random fourier features. Big Data Mining and Analytics, 2(3):195–204, 2019.
217
+
218
+ Julien Mairal, Piotr Koniusz, Zaid Harchaoui, and Cordelia Schmid. Convolutional kernel networks. In Advances in neural information processing systems, pp. 2627–2635, 2014.
219
+
220
+ Siamak Mehrkanoon and Johan AK Suykens. Deep hybrid neural-kernel networks using random fourier features. Neurocomputing, 298:46–54, 2018.
221
+
222
+ Ben Mildenhall, Pratul P Srinivasan, Matthew Tancik, Jonathan T Barron, Ravi Ramamoorthi, and Ren Ng. Nerf: Representing scenes as neural radiance fields for view synthesis. arXiv preprint arXiv:2003.08934, 2020.
223
+
224
+ Anh Nguyen, Jason Yosinski, and Jeff Clune. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 427–436, 2015.
225
+
226
+ Michael Niemeyer, Lars Mescheder, Michael Oechsle, and Andreas Geiger. Differentiable volumetric rendering: Learning implicit 3d representations without 3d supervision. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3504–3515, 2020.
227
+
228
+ Michael Oechsle, Lars Mescheder, Michael Niemeyer, Thilo Strauss, and Andreas Geiger. Texture fields: Learning texture representations in function space. In Proceedings of the IEEE International Conference on Computer Vision, pp. 4531–4540, 2019.
229
+
230
+ Jeong Joon Park, Peter Florence, Julian Straub, Richard Newcombe, and Steven Lovegrove. Deepsdf: Learning continuous signed distance functions for shape representation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 165–174, 2019.
231
+
232
+ Majid Rabbani. Jpeg2000: Image compression fundamentals, standards and practice. Journal of Electronic Imaging, 11(2):286, 2002.
233
+
234
+ Ali Rahimi and Benjamin Recht. Random features for large-scale kernel machines. In Advances in neural information processing systems, pp. 1177–1184, 2008.
235
+
236
+ 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.
237
+
238
+ Ankit Singh Rawat, Jiecao Chen, Felix Xinnan X Yu, Ananda Theertha Suresh, and Sanjiv Kumar. Sampled softmax with random fourier features. In Advances in Neural Information Processing Systems, pp. 13857–13867, 2019.
239
+
240
+ Jen-Hao Rick Chang, Aswin C Sankaranarayanan, and BVK Vijaya Kumar. Random features for sparse signal classification. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5404–5412, 2016.
241
+
242
+ Vincent Sitzmann, Michael Zollhofer, and Gordon Wetzstein. Scene representation networks: Con- ¨ tinuous 3d-structure-aware neural scene representations. In Advances in Neural Information Processing Systems, pp. 1121–1132, 2019.
243
+
244
+ Vincent Sitzmann, Julien NP Martel, Alexander W Bergman, David B Lindell, and Gordon Wetzstein. Implicit neural representations with periodic activation functions. arXiv preprint arXiv:2006.09661, 2020.
245
+
246
+ Kenneth O Stanley. Compositional pattern producing networks: A novel abstraction of development. Genetic programming and evolvable machines, 8(2):131–162, 2007.
247
+
248
+ Yitong Sun, Anna Gilbert, and Ambuj Tewari. But how does it work in theory? linear svm with random features. In Advances in Neural Information Processing Systems, pp. 3379–3388, 2018.
249
+
250
+ Matthew Tancik, Pratul P Srinivasan, Ben Mildenhall, Sara Fridovich-Keil, Nithin Raghavan, Utkarsh Singhal, Ravi Ramamoorthi, Jonathan T Barron, and Ren Ng. Fourier features let networks learn high frequency functions in low dimensional domains. arXiv preprint arXiv:2006.10739, 2020.
251
+
252
+ Martin Vetterli, Jelena Kovacevi ˇ c, and Vivek K Goyal. ´ Foundations of signal processing. Cambridge University Press, 2014.
253
+
254
+ Hui Xue, Zheng-Fan Wu, and Wei-Xiang Sun. Deep spectral kernel learning. In Proceedings of the 28th International Joint Conference on Artificial Intelligence, pp. 4019–4025. AAAI Press, 2019.
255
+
256
+ Felix Xinnan X Yu, Ananda Theertha Suresh, Krzysztof M Choromanski, Daniel N Holtmann-Rice, and Sanjiv Kumar. Orthogonal random features. In Advances in Neural Information Processing Systems, pp. 1975–1983, 2016.
257
+
258
+ Ellen D Zhong, Tristan Bepler, Joseph H Davis, and Bonnie Berger. Reconstructing continuous distributions of 3d protein structure from cryo-em images. In ICLR, 2020.
md/train/S1emOTNKvS/S1emOTNKvS.md ADDED
@@ -0,0 +1,431 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ROBUST GRAPH REPRESENTATION LEARNING VIA NEURAL SPARSIFICATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Graph representation learning serves as the core of many important prediction tasks, ranging from product recommendation in online marketing to fraud detection in financial domain. Real-life graphs are usually large with complex local neighborhood, where each node is described by a rich set of features and easily connects to dozens or even hundreds of neighbors. Most existing graph learning techniques rely on neighborhood aggregation, however, the complexity on reallife graphs is usually high, posing non-trivial overfitting risk during model training. In this paper, we present Neural Sparsification (NeuralSparse), a supervised graph sparsification technique that mitigates the overfitting risk by reducing the complexity of input graphs. Our method takes both structural and non-structural information as input, utilizes deep neural networks to parameterize the sparsification process, and optimizes the parameters by feedback signals from downstream tasks. Under the NeuralSparse framework, supervised graph sparsification could seamlessly connect with existing graph neural networks for more robust performance on testing data. Experimental results on both benchmark and private datasets show that, NeuralSparse can effectively improve testing accuracy and bring up to $7 . 4 \%$ improvement when working with existing graph neural networks on node classification tasks.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Representation learning has been in the center of many machine learning tasks on graphs, such as name disambiguation in citation networks (Zhang et al., 2018c), spam detection in social networks (Akoglu et al., 2015), recommendations in online marketing (Ying et al., 2018a), and many others (Hamilton et al., 2017; Li et al., 2018). As a class of models that can simultaneously utilize non-structural (e.g., node and edge features) and structural information in graphs, Graph Neural Networks (GNNs) (Kipf & Welling, 2017; Hamilton et al., 2017; Li et al., 2016) construct effective representations for downstream tasks by iteratively aggregating neighborhood information (Kipf & Welling, 2017; Hamilton et al., 2017). Such methods have demonstrated state-of-the-art performance in classification and prediction tasks on graph data (Velickovi ˇ c et al., 2018; Chen et al., 2018; ´ Xu et al., 2019; Velickovi ˇ c et al., 2019). ´
12
+
13
+ Meanwhile, graphs from real-life applications are usually large with complex local neighborhood, where each node has rich features and dozens or even hundreds of neighbors. As shown in Figure 1(a), this subgraph from Transaction dataset (detailed in Section 5.1) consists of 38 nodes (i.e., promising organizations and other organizations) with average node degree 15 and node feature dimension 120. The GNNs are expected to grasp useful patterns from neighboring nodes; however, as representative patterns are diluted by overwhelming information in local neighborhood, graph learning algorithms could be misled by neighborhood aggregation. Such complexity in input graphs poses non-trivial overfitting risk to existing GNN based learning techniques.
14
+
15
+ While it is straightforward yet expensive (sometimes even impractical) to address this overfitting problem by increasing the number of labeled samples, we investigate a cheaper alternative of reducing input graph complexity by graph sparsification in this work. Graph sparsification (Liu et al., 2018; Zhang & Patone, 2017) aims to find smaller subgraphs from input large graphs that best preserve desired properties. Existing sparsification methods could lead to suboptimal performance for downstream prediction tasks: (1) these methods are unsupervised such that the resulting sparsified graphs may not favor downstream tasks; and (2) they only consider structural information for sparsification decision, while non-structural information in graphs, such as node/edge features, could have non-trivial impact to the quality of sparsification. Recently, there have been GNN models attempting to sample subgraphs from predefined distributions (Leskovec & Faloutsos, 2006; Adhikari et al., 2018; Hamilton et al., 2017; Chen et al., 2018). As the predefined distributions could be irrelevant to subsequent tasks, the sparsified graphs may miss important information for downstream tasks, leading to suboptimal prediction performance.
16
+
17
+ ![](images/a43cf4a2a96344ec1e8fc7e7c88b613b2ff17335b46d3936823be8fdec0a8151.jpg)
18
+ Figure 1: A subgraph of 38 organizations from Transaction dataset: (a) The original subgraph sampled from the Transaction dataset, where nodes and edges represent organizations and their transactions, respectively; (b) The sparsified subgraph by NeuralSparse; (c) Testing AUC on identifying promising organizations.
19
+
20
+ Present work. We propose Neural Sparsification (NeuralSparse), a general framework that simultaneously learns graph sparsification and graph representation by feedback signals from downstream tasks. The NeuralSparse consists of two major components: sparsification network and GNN. For the sparsification network, we utilize a deep neural network to parameterize the sparsification process: how to select edges from one-hop neighborhood given a fixed budget. In the training phase, the network learns to optimize a sparsification strategy that favors downstream tasks. In the testing phase, the network sparsifies input graphs following the learned strategy, instead of sampling subgraphs from a predefined distribution. Unlike conventional sparsification techniques, our technique takes both structural and non-structural information as input and optimizes the sparsification strategy by feedback from downstream tasks, instead of using (possibly irrelevant) heuristics. For the GNN component, the NeuralSparse feeds the sparsified graphs to a GNN and learns a graph representation for subsequent prediction tasks.
21
+
22
+ Under the framework of NeuralSparse, we are able to leverage the standard stochastic gradient descent and backpropagation techniques to simultaneously optimize graph sparsification and representation. As shown in Figure 1(b), the graph sparsified by the NeuralSparse has lower complexity with average node degree around 5. As a result (illustrated in Figure 1(c)), the testing classification accuracy on the sparsified graph is improved by $15 \%$ , compared with its counterpart in the original input graph, while conventional techniques could not offer competitive sparsification for the classification task.
23
+
24
+ Experimental results on both public and private datasets show that the NeuralSparse is able to consistently provide improved performance for existing GNNs on node classification tasks, bringing up to $7 \%$ improvement.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Our work is related to two lines of research: graph sparsification and graph representation learning.
29
+
30
+ Graph sparsification. The goal of graph sparsification is to find small subgraphs from input large graphs that best preserve desired properties. Existing techniques are mainly unsupervised and deal with simple graphs without node/edge features for preserving predefined graph metrics (Hubler ¨ et al., 2008), information propagation traces (Mathioudakis et al., 2011), graph spectrum (Calandriello et al., 2018; Chakeri et al., 2016; Adhikari et al., 2018), node degree distribution (Eden et al.,
31
+
32
+ ![](images/c63dd1a64bdebd2d5ba7cb87d0882072aa533e69b171d8077663067594ddf877.jpg)
33
+ Figure 2: The overview of NeuralSparse
34
+
35
+ 2018; Voudigari et al., 2016), node distance distribution (Leskovec & Faloutsos, 2006), or clustering coefficient (Maiya & Berger-Wolf, 2010). Importance based edge sampling has also been studied in a scenario where we could predefine edge importance (Zhao, 2015; Chen et al., 2018).
36
+
37
+ Unlike existing methods that mainly work with simple graphs without node/edge features in an unsupervised manner, our method takes node/edge features as parts of input and optimizes graph sparsification by supervision signals from errors made in downstream tasks.
38
+
39
+ Graph representation learning. Graph neural networks (GNNs) are the most popular techniques that enable vector representation learning for large graphs with complex node/edge features. All existing GNNs share a common spirit: extracting local structural features by neighborhood aggregation. Scarselli et al. (2009) explore how to extract multi-hop features by iterative neighborhood aggregation. Inspired by the success of convolutional neural networks, multiple studies (Defferrard et al., 2016; Bruna et al., 2014) investigate how to learn convolutional filters in the graph spectral domain under transductive settings (Zhang et al., 2018b; Zhuang & Ma, 2018). To enable inductive learning, convolutional filters in the graph domain are proposed (Simonovsky & Komodakis, 2017; Niepert et al., 2016; Kipf & Welling, 2017; Velickovi ˇ c et al., 2018; Xu et al., 2018), and a few stud- ´ ies (Hamilton et al., 2017; Lee et al., 2018) explore how to differentiate neighborhood filtering by sequential models. In addition, multiple recent works (Ying et al., 2018b; Xu et al., 2019; Abu-ElHaija et al., 2019) investigate the expressive power of GNNs. Recently, (Franceschi et al., 2019) study how to sample high-quality subgraphs from a space of all possible graphs of a complete graph so that the sampled graphs enhance the prediction power in downstream learning tasks. In particular, the proposed method only focus on transductive tasks.
40
+
41
+ Our work contributes from a unique angle: by reducing the noise from input graphs, our technique can further boost testing performance of existing GNNs.
42
+
43
+ # 3 PROPOSED METHOD: NEURALSPARSE
44
+
45
+ In this section, we introduce the core idea of our method. We start with the notations that are frequently used in this paper. We then describe the theoretical justification behind NeuralSparse and our architecture to tackle the supervised node classification problem.
46
+
47
+ Notations. In this paper, we represent an input graph of $n$ nodes as $G = ( V , E , \pmb { \Delta } )$ : (1) $V \in \mathbb { R } ^ { n \times d _ { n } }$ includes node features with dimensionality $d _ { n }$ ; (2) $E \in \mathbb { R } ^ { n \times n }$ is a binary matrix where $E ( u , v ) = 1$ if there is an edge between node $u$ and node $v$ ; (3) $\pmb { \mathsf { A } } \in \mathbb { R } ^ { n \times n \times d _ { e } }$ encodes input edge features of dimensionality $d _ { e }$ . In addition, we use $Y$ to denote the prediction target in downstream tasks (e.g., $Y \in \mathbb { R } ^ { n \times d _ { l } }$ if we are dealing with a node classification problem with $d _ { l }$ classes).
48
+
49
+ Theoretical justification. From the perspective of statistical learning, the key of a defined prediction task is to learn $P ( Y \mid G )$ , where $Y$ is the prediction target and $G$ is an input graph. Instead of directly working with original graphs, we would like to leverage sparsified subgraphs to mitigate overfitting risks. In other words, we are interested in the following variant,
50
+
51
+ $$
52
+ P ( Y \mid G ) \approx \sum _ { g \in \mathbb { S } _ { G } } P ( Y \mid g ) P ( g \mid G ) ,
53
+ $$
54
+
55
+ where $g$ is a sparsified subgraph, and $\mathbb { S } _ { G }$ is a class of sparsified subgraphs of $G$
56
+
57
+ In general, because of the combinatorial complexity in graphs, it is intractable to enumerate all possible $g$ as well as estimate the exact values of $P ( \boldsymbol { Y } \mid g )$ and $P ( g \mid G )$ . Therefore, we approximate the distributions by tractable functions,
58
+
59
+ $$
60
+ \sum _ { g \in \mathbb { S } _ { G } } P ( Y \mid g ) P ( g \mid G ) \approx \sum _ { g \in \mathbb { S } _ { G } } Q _ { \theta } ( Y \mid g ) Q _ { \phi } ( g \mid G )
61
+ $$
62
+
63
+ where $Q _ { \theta }$ and $Q _ { \phi }$ are approximation functions for $P ( \boldsymbol { Y } \mid g )$ and $P ( g \mid G )$ parameterized by $\theta$ and $\phi$ , respectively.
64
+
65
+ Moreover, to make the above graph sparsification process differentiable, we employ reparameterization tricks (Jang et al., 2017) to make $Q _ { \phi } ( g \mid G )$ directly generate differentiable samples, such that
66
+
67
+ $$
68
+ \sum _ { g \in \mathbb { S } _ { G } } Q _ { \theta } ( Y \mid g ) Q _ { \phi } ( g \mid G ) \propto \sum _ { g ^ { \prime } \sim Q _ { \phi } ( g \mid G ) } Q _ { \theta } ( Y \mid g ^ { \prime } )
69
+ $$
70
+
71
+ where $g ^ { \prime } \sim Q _ { \phi } ( g \mid G )$ means $g ^ { \prime }$ is a random sample drawn from $Q _ { \phi } ( g \mid G )$ .
72
+
73
+ To this end, the key is how to find appropriate approximation functions $Q _ { \phi } ( g \mid G )$ and $Q _ { \theta } ( Y \mid g )$
74
+
75
+ Architecture. In this paper, we propose Neural Sparsification (NeuralSparse) to implement the theoretical framework discussed in Equation 3. As shown in Figure 2, NeuralSparse consists of two major components: sparsification network and GNNs.
76
+
77
+ • The sparsification network is a multi-layer neural network that implements $Q _ { \phi } ( g \mid G )$ : Taking $G$ as input, it generates a random sparsified subgraph of $G$ drawn from a learned distribution. • GNNs implement $Q _ { \theta } ( Y \mid g )$ that takes a sparsified subgraph as input, extracts node representations, and makes predictions for downstream tasks.
78
+
79
+ # Algorithm 1 Training algorithm for NeuralSparse
80
+
81
+ <table><tr><td colspan="3">lnput:graphG=(V,E,A),integerl,andtraininglabelsY.</td></tr><tr><td></td><td>while stop criterion is not met do Generate sparsified subgraphs {g1, g2,·., gt} by sparsification network (Section 4);</td><td></td><td></td></tr><tr><td>2: 3:</td><td>Produce prediction {Y1,Y2,··,Y𝑖} by feeding {g1, g2,·. , gt} into GNNs;</td><td></td><td></td></tr><tr><td>4:</td><td>Calculate loss function J;</td><td></td><td></td></tr><tr><td>5:</td><td></td><td></td><td></td></tr><tr><td>6: end while</td><td>Update and θ by descending J</td><td></td><td></td></tr></table>
82
+
83
+ As the sparsified subgraph samples are differentiable, the two components can be jointly trained using gradient descent based backpropagation techniques from a supervised loss function, as illustrated in Algorithm 1. While the GNNs have been widely investigated in recent works (Kipf & Welling, 2017; Hamilton et al., 2017; Velickovi ˇ c et al., 2018), we focus on the practical implementation for ´ sparsification network in the remaining of this paper.
84
+
85
+ # 4 SPARSIFICATION NETWORK
86
+
87
+ Following the theory discussed above, the goal of sparsification network is to generate sparsified subgraphs for input graphs, serving as the approximation function $Q _ { \phi } ( g \mid G )$ . Therefore, we need to answer the following three questions in sparsification network. i). What is $\mathbb { S } _ { G }$ in Equation 1, the class of subgraphs we focus on? ii). How to sample sparsified subgraphs? iii). How to make sparsified subgraph sampling process differentiable for the end-to-end training? In the following, we address the questions one by one.
88
+
89
+ $k$ -neighbor subgraphs. We focus on $k$ -neighbor subgraphs for $\mathbb { S } _ { G }$ (Sadhanala et al., 2016): Given an input graph, a $k$ -neighbor subgraph shares the same set of nodes with the input graph, and each node in the subgraph can select no more than $k$ edges from its one-hop neighborhood. Although the concept of sparsification network is not limited to a specific class of subgraphs, we choose $k$ - neighbor subgraphs for the following reasons.
90
+
91
+ • We are able to adjust the estimation on the amount of task-relevant graph data by tuning the hyper-parameter $k$ . Intuitively, when $k$ is an under-estimate, the amount of task-relevant graph data accessed by GNNs could be inadequate, leading to inferior performance. When $k$ is an overestimate, the downstream GNNs may overfit the introduced noise or irrelevant graph data, resulting in sub-optimal performance. It could be difficult to set a golden hyper-parameter that works all time, but one has the freedom to choose the $k$ that is the best fit for a specific task. • $k$ -neighbor subgraphs are friendly to parallel computation. As each node selects its edges independently from its neighborhood, we can utilize tensor operations in existing deep learning frameworks, such as tensorflow (Abadi et al., 2016), to speed up the sparsification process.
92
+
93
+ Sampling $k$ -neighbor subgraphs. Given $k$ and an input graph $G = ( V , E , \mathbf { A } )$ , we obtain a $k$ - neighbor subgraph by repeatedly sampling edges for each node in the original graph. Without loss of generality, we sketch this sampling process by focusing on a specific node $u$ in graph $G$ . Let $\mathbb { N } _ { u }$ be the set of one-hop neighbors of node $u$ .
94
+
95
+ 1. $v \sim f _ { \phi } ( V ( u ) , V ( \mathbb { N } _ { u } ) , \pmb { \mathsf { A } } ( u ) )$ , where $f _ { \phi } ( \cdot )$ is a function that generates a one-hop neighbor $v$ from the learned distribution based on node $u$ ’s attributes, node attributes of $u$ ’s neighbors $V ( \mathbb { N } _ { u } )$ , and their edge attributes $\pmb { \mathsf { A } } ( u )$ . In particular, the learned distribution is encoded by parameters $\phi$ .
96
+ 2. Edge $E ( u , v )$ is selected for node $u$ .
97
+ 3. The above two steps are repeated $k$ times.
98
+
99
+ Note that the above process performs sampling without replacement. Given a node $u$ , each of its adjacent edges is selected at most once. Moreover, the sampling function $f _ { \phi } ( \cdot )$ is shared among nodes; therefore, the number of parameters $\phi$ is independent of the input graph size.
100
+
101
+ Making samples differentiable. While conventional methods are able to generate discrete samples (Sadhanala et al., 2016), these samples are not differentiable such that it is difficult to utilize them to optimize sample generation. To make samples differentiable, we propose a Gumbel-Softmax based multi-layer neural network to implement the sampling function $f _ { \phi } ( \cdot )$ discussed in above.
102
+
103
+ To make the discussion self-contained, we briefly discuss the idea of Gumbel-Softmax. GumbelSoftmax is a reparameterization trick used to generate differentiable discrete samples (Jang et al., 2017; Maddison et al., 2017). Under appropriate hyper-parameter settings, Gumbel-Softmax is able to generate continuous vectors that are as “sharp” as one-hot vectors widely used to encode discrete data.
104
+
105
+ Without loss of generality, we focus on a specific node $u$ in a graph $G = ( V , E , \pmb { \Delta } )$ . Let $\mathbb { N } _ { u }$ be the set of one-hop neighbors of node $u$ . We implement $f _ { \phi } ( \cdot )$ as follows.
106
+
107
+ 1. $\forall v \in \mathbb { N } _ { u }$
108
+
109
+ $$
110
+ z _ { u , v } = \mathbf { M } \mathbf { L } \mathbf { P } _ { \phi } ( V ( u ) , V ( v ) , \mathbf { A } ( u , v ) ) ,
111
+ $$
112
+
113
+ where ${ \mathrm { M L P } } _ { \phi }$ is a multi-layer neural network with parameters $\phi$ .
114
+
115
+ 2. $\forall v \in \mathbb { N } _ { u }$ , we employ a softmax function to compute the probability to sample the edge,
116
+
117
+ $$
118
+ \pi _ { u , v } = \frac { \exp ( z _ { u , v } ) } { \sum _ { w \in \mathbb { N } _ { u } } \exp ( z _ { u , w } ) }
119
+ $$
120
+
121
+ 3. Using Gumbel-Softmax, we generate differentiable samples
122
+
123
+ $$
124
+ x _ { u , v } = \frac { \exp ( ( \log ( \pi _ { u , v } ) + \epsilon _ { v } ) / \tau ) } { \sum _ { w \in \mathbb { N } _ { u } } \exp ( ( \log ( \pi _ { u , w } ) + \epsilon _ { w } ) / \tau ) }
125
+ $$
126
+
127
+ where $x _ { u , v }$ is a scalar, $\epsilon _ { v } = - \log ( - \log ( s ) )$ with $s$ randomly drawn from Uniform $( 0 , 1 )$ , and $\tau$ is a hyper-parameter called temperature which controls the interpolation between discrete distribution and continuous categorical densities.
128
+
129
+ Note that when we sample $k$ edges, the computation for $z _ { u , v }$ and $\pi _ { u , v }$ only needs to be performed once. For the hyper-parameter $\tau$ , we discuss how to tune it as follows.
130
+
131
+ Discussion on temperature tuning. The behavior of Gumbel-Softmax is governed by a hyperparameter $\tau$ called temperature. In general, when $\tau$ is small, the Gumbel-Softmax distribution resembles the discrete distribution, which induces strong sparsity; however, small $\tau$ also introduces high variance gradient that blocks effective backpropagation. A high value of $\tau$ cannot produce expected sparsification effect. Following the practice in (Jang et al., 2017), we adopt the strategy by starting the training with a high temperature and anneal to a small value with a guided schedule.
132
+
133
+ Sparsification algorithm and its complexity. As shown in Algorithm 2, given hyper-parameter $k$ , the sparsification network visits each node’s one-hop neighbors $k$ times. Let $m$ be the total number of edges in the graph. The complexity of sampling subgraphs by the sparsification network is $O ( k m )$ . When $k$ is small in practice, the overall complexity is $O ( m )$ .
134
+
135
+ # Algorithm 2 Sampling subgraphs by sparsification network
136
+
137
+ Input: graph $G = ( V , E , \pmb { \Delta } )$ and integer $k$ .
138
+ 1: Edge set $\mathbb { H } = \boldsymbol { \emptyset }$
139
+ 2: for $u \in \mathbb { V }$ do
140
+ 3: for $v \in \mathbb { N } _ { u }$ do
141
+ 4: $z _ { u , v } \gets \mathrm { M L P } _ { \phi } ( V ( u ) , V ( v ) , \mathbf { A } ( u , v ) )$
142
+ 5: end for
143
+ 6: for $v \in \mathbb { N } _ { u }$ do
144
+ 7: $\pi _ { u , v } \exp ( z _ { u , v } ) / { \sum _ { w \in \mathbb { N } _ { u } } \exp ( z _ { u , w } ) }$
145
+ 8: end for
146
+ 9: for $j = 1 , \cdots , k$ do
147
+ 10: for $v \in \mathbb { N } _ { u }$ do
148
+ 11: $\begin{array} { r } { x _ { u , v } \overset { \sim } { } \exp ( ( \log ( \pi _ { u , v } ) + \epsilon _ { v } ) / \tau ) / { \sum _ { w \in \mathbb { N } _ { u } } \exp ( ( \log ( \pi _ { u , w } ) + \epsilon _ { w } ) / \tau ) } } \end{array}$
149
+ 12: end for
150
+ 13: Add the edge represented by vector $[ x _ { u , v } ]$ into $\mathbb { H }$
151
+ 14: end for
152
+ 15: end for
153
+
154
+ Comparison with multiple related methods. Unlike GraphSAGE (Hamilton et al., 2017), FastGCN (Chen et al., 2018), and AS-GCN (Huang et al., 2018) that incorporate layer-wise node samplers to reduce the complexity of GNNs, NeuralSparse samples subgraphs before applying GNNs. As for the computation complexity, the sparsification in NeuralSparse is more friendly to parallel computation than the layer-conditioned approach in AS-GCN. Compared with GAT (Velickovi ˇ c´ et al., 2018; Zhang et al., 2018a), the NeuralSparse can produce sparser neighborhood, which effectively mitigates overfitting risks. Unlike LDS (Franceschi et al., 2019), NeuralSparse learns inductive graph sparsification, and its graph sampling is constrained by input graph topology.
155
+
156
+ # 5 EXPERIMENTAL STUDY
157
+
158
+ In this section, we evaluate our proposed NeuralSparse on node classification task, including inductive and transductive settings. We demonstrate that NeuralSparse achieves superior classification performance over state-of-the-art GNN models. Moreover, we provide a case study to demonstrate how sparsified subgraphs generated by NeuralSparse could improve classification. The supplementary material contains more detailed experimental information.
159
+
160
+ # 5.1 DATASETS
161
+
162
+ We employ five datasets from various domains and conduct node classification task following the settings as described in Hamilton et al. (2017); Kipf & Welling (2017). The dataset statistics are summarized in Table 1.
163
+
164
+ Inductive datasets. We utilize the Reddit and PPI datasets and follow the same setting in Hamilton et al. (2017). The Reddit dataset contains post-to-post graph with word vectors as node features. The node labels represent which community Reddit posts belong to. The protein-protein interaction (PPI) dataset contains graphs corresponding to different human tissues. The node features are positional gene sets, motif gene sets and immunological signatures. The nodes are multi-labeled by gene ontology. The graph in the Transaction dataset contains real transactions between organizations in two years, with the first year for training and the second year for validation/testing. Each node represents an organization and each edge indicates a transaction between two organizations. Node attributes are side information about the organizations such as account balance, cash reserve, etc. On this dataset, we aim to classify organizations into two categories: promising or others for investment in near future. The class distribution in the Transaction dataset is highly imbalanced. During the training under inductive setting, algorithms have only access to training nodes’ attributes and edges. In the PPI and Transaction datasets, the models have to generalize to completely unseen graphs.
165
+
166
+ Table 1: Dataset statistics
167
+
168
+ <table><tr><td></td><td>Reddit</td><td>PPI</td><td>Transaction</td><td>Cora</td><td>Citeseer</td></tr><tr><td>Task</td><td>Inductive</td><td>Inductive</td><td>Inductive</td><td>Transductive</td><td>Transductive</td></tr><tr><td>Nodes</td><td>232,965</td><td>56,944</td><td>95,544</td><td>2,708</td><td>3,327</td></tr><tr><td>Edges</td><td>11,606,919</td><td>818,716</td><td>963,468</td><td>5,429</td><td>4,732</td></tr><tr><td>Features</td><td>602</td><td>50</td><td>120</td><td>1,433</td><td>3,703</td></tr><tr><td>Classes</td><td>41</td><td>121</td><td>2</td><td>7</td><td>6</td></tr><tr><td>Training Nodes</td><td>152,410</td><td>44,906</td><td>47,772</td><td>140</td><td>120</td></tr><tr><td>Validation Nodes</td><td>23,699</td><td>6,514</td><td>9,554</td><td>500</td><td>500</td></tr><tr><td>Testing Nodes</td><td>55,334</td><td>5,524</td><td>38,218</td><td>1,000</td><td>1,000</td></tr></table>
169
+
170
+ Transductive datasets. We use two citation benchmark datasets with transductive experimental setting in Yang et al. (2016); Kipf & Welling (2017). The citation graphs contain nodes corresponding to documents and edges as citations. Node features are the sparse bag-of-words representations of documents and node labels indicate the topic class of the documents. In transductive learning, the training methods have access to all node features and edges, with a limited subset of node labels.
171
+
172
+ # 5.2 EXPERIMENTAL SETUP
173
+
174
+ Baseline models. We incorporate four state-of-the-art methods as the base GNN components, including GCN (Kipf & Welling, 2017), GraphSAGE (Hamilton et al., 2017), GAT (Velickovi ˇ c et al., ´ 2018), and GIN (Xu et al., 2019). We evaluate our proposed NeuralSparse with sparsification network and each of the four GNNs. Besides, we also implement variants of NeuralSparse by replacing the sparsification network with either the spectral sparsifier (SS, Sadhanala et al., 2016) or the Rank Degree (RD, Voudigari et al., 2016) method.
175
+
176
+ Temperature tuning. We anneal the temperature with the schedule $\tau = \operatorname* { m a x } ( 0 . 0 5 , \exp ( - r p ) )$ , where $p$ is the training epoch and $r ~ \in ~ 1 0 ^ { \{ - 5 , - 4 , - 3 , - 2 , - 1 \} }$ . $\tau$ is updated every $N$ steps and $N \in \{ 5 0 , 1 0 0 , . . . , 5 0 0 \}$ . Compared with MNIST VAE model in Jang et al. (2017), smaller hyperparameter $\tau$ fits NeuralSparse better in practice.
177
+
178
+ Metrics. We evaluate the performance on the transductive datasets with accuracy (Kipf & Welling, 2017). For inductive tasks on the Reddit and PPI datasets, we report micro-averaged F1 scores (Hamilton et al., 2017). Due to the highly imbalanced classes in the Transaction dataset, models are evaluated with AUC value (Huang & Ling, 2005). The results show the average of 10 runs.
179
+
180
+ # 5.3 CLASSIFICATION PERFORMANCE
181
+
182
+ Table 2 summarizes classification performance of NeuralSparse and the baseline methods on all datasets. For Reddit, PPI, Transaction, Cora and Citeseer, the hyper-parameter $k$ is set as 30, 15, 10, 5, and 3 respectively. The hyper-parameter $l$ is set as 1 in this experiment. Note that the result of GAT on Reddit is missing due to the out-of-memory error.
183
+
184
+ Overall, NeuralSparse is able to help GNN techniques achieve competitive generalization performance with sparsified graph data. We make the following observations. (1) Compared with basic GNN models, NeuralSparse can enhance the generalization performance on node classification tasks by utilizing the sparsified subgraphs from sparsification network, especially in the inductive setting. Indeed, large neighborhood size in the original graphs could bring increased chance of introducing noise into the convolutional operations, leading to sub-optimal performance. (2) With different GNN models, the NeuralSparse can consistently achieve comparable or superior performance, which demonstrates NeuralSparse is general and can be applied to multiple classification models.
185
+
186
+ Table 2: Node classification performance
187
+
188
+ <table><tr><td rowspan="2">Sparsifier</td><td rowspan="2">Method</td><td>Reddit</td><td>PPI</td><td>Transaction</td><td>Cora</td><td>Citeseer</td></tr><tr><td>Micro-F1</td><td>Micro-F1</td><td>AUC</td><td>Accuracy</td><td>Accuracy</td></tr><tr><td rowspan="4">N/A</td><td>GCN</td><td>0.922 ± 0.041</td><td>0.532 ± 0.024</td><td>0.564 ± 0.018</td><td>0.810 ± 0.027</td><td>0.694 ± 0.020</td></tr><tr><td>GraphSAGE</td><td>0.938 ± 0.029</td><td>0.600 ± 0.027</td><td>0.574 ± 0.029</td><td>0.825 ± 0.033</td><td>0.710 ± 0.020</td></tr><tr><td>GAT</td><td></td><td>0.917 ± 0.030</td><td>0.616 ± 0.022</td><td>0.821 ± 0.043</td><td>0.721 ± 0.037</td></tr><tr><td>GIN</td><td>0.928 ± 0.022</td><td>0.703 ± 0.028</td><td>0.607 ± 0.031</td><td>0.816 ± 0.020</td><td>0.709 ± 0.037</td></tr><tr><td rowspan="4">sS/ RD*</td><td>GCN</td><td>0.912 ± 0.022</td><td>0.521 ± 0.024</td><td>0.562 ± 0.035</td><td>0.780 ± 0.045</td><td>0.684 ± 0.033</td></tr><tr><td>GraphSAGE</td><td>0.907 ± 0.018</td><td>0.576 ± 0.022</td><td>0.565 ± 0.042</td><td>0.806 ± 0.032</td><td>0.701 ± 0.027</td></tr><tr><td>GAT</td><td></td><td>0.889 ± 0.034</td><td>0.614 ± 0.044</td><td>0.807 ± 0.047</td><td>0.686 ± 0.034</td></tr><tr><td>GIN</td><td>0.901 ± 0.021</td><td>0.693 ± 0.019</td><td>0.593 ± 0.038</td><td>0.785 ± 0.041</td><td>0.706 ± 0.043</td></tr><tr><td rowspan="4">Neural Sparse</td><td>GCN</td><td>0.946 ± 0.020</td><td>0.600 ± 0.014</td><td>0.610 ± 0.022</td><td>0.821 ± 0.014</td><td>0.715 ± 0.014</td></tr><tr><td>GraphSAGE</td><td>0.951 ± 0.015</td><td>0.626 ± 0.023</td><td>0.649 ± 0.018</td><td>0.832 ± 0.024</td><td>0.720 ± 0.013</td></tr><tr><td>GAT</td><td></td><td>0.921 ± 0.015</td><td>0.671 ± 0.018</td><td>0.834 ± 0.015</td><td>0.724 ± 0.026</td></tr><tr><td>GIN</td><td>0.937± 0.027</td><td>0.744 ± 0.015</td><td>0.634±0.023</td><td>0.824 ± 0.027</td><td>0.719 ± 0.015</td></tr></table>
189
+
190
+ (\* Report the better performance with SS or RD)
191
+
192
+ ![](images/2893d00ddd1fcdf5088ab61bc0a7cb6c06e5d73bb59385e19233158ebec593ea.jpg)
193
+ Figure 3: Sparsified subgraphs and performance vs hyper-parameters
194
+
195
+ (3) In comparison with the two NeuralSparse variants SS-GraphSAGE and RD-GraphSAGE, NeuralSparse outperforms because of the automatically learned graph sparsification with both structural and non-structural information as input.
196
+
197
+ # 5.4 SENSITIVITY TO HYPER-PARAMETERS AND SPARSIFIED SUBGRAPHS
198
+
199
+ Figure 3(c) demonstrates how classification performance responds when $k$ increases on the Transaction dataset. There exists an optimal $k$ that delivers the best classification AUC score. When $k$ is small, NeuralSparse can only make use of little relevant structural information in feature aggregation, which leads to inferior performance. When $k$ increases, the aggregation convolution involves more complex neighborhood aggregation with higher chance of overfitting noise data, which negatively impacts the classification performance for unseen testing data. Figure 3(d) shows how hyperparameter $l$ impacts classification performance on the Transaction dataset. When $l$ increases from 1 to 5, we observe a relatively small improvement in classification AUC score. As the parameters in the sparsification network are shared by all edges in the graph, the estimation variance from random sampling could already be mitigated to some extent by a number of sampled edges in a sparsified subgraph. Thus, when we increase the number of sparsified subgraphs, the incremental gain could be small.
200
+
201
+ In Figure 3(a, b), we present the sparsified graphs output by two baseline methods, SS and RD. By comparing the two plots with Figure 1(b), we make the following observations. First, the NeuralSparse sparsified graph tends to select edges that connect nodes of identical labels, which favors the downstream classification task. The observed clustering effect could further boost the confidence of decision making. Second, instead of exploring all the neighbors, we can focus on selected connections/edges in sparsified graphs, which could make it easier for human experts to perform model interpretation and result visualization.
202
+
203
+ # 6 CONCLUSION
204
+
205
+ In this paper, we propose Neural Sparsification (NeuralSparse) to address the overfitting issues brought by the complexity in real-life large graphs. NeuralSparse consists of two major components: (1) The sparsification network sparsifies input graphs by sampling edges following a learned distribution; (2) GNNs take sparsified subgraphs as input and extracts node representations for downstream tasks. The two components in NeuralSparse can be jointly trained with supervised loss, gradient descent, and backpropagation techniques. The experimental study on real-life datasets show that the NeuralSparse consistently renders more robust graph representations, and brings up to $7 \%$ improvement in accuracy over the state-of-the-art GNN models.
206
+
207
+ # REFERENCES
208
+
209
+ Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, et al. Tensorflow: a system for largescale machine learning. In OSDI, 2016.
210
+
211
+ Sami Abu-El-Haija, Bryan Perozzi, Amol Kapoor, Hrayr Harutyunyan, Nazanin Alipourfard, Kristina Lerman, Greg Ver Steeg, and Aram Galstyan. Mixhop: Higher-order graph convolution architectures via sparsified neighborhood mixing. In ICML, 2019.
212
+
213
+ Bijaya Adhikari, Yao Zhang, Sorour E Amiri, Aditya Bharadwaj, and B Aditya Prakash. Propagation-based temporal network summarization. TKDE, 2018.
214
+
215
+ Leman Akoglu, Hanghang Tong, and Danai Koutra. Graph based anomaly detection and description: a survey. Data mining and knowledge discovery, 2015.
216
+
217
+ Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. In ICLR, 2014.
218
+
219
+ Daniele Calandriello, Ioannis Koutis, Alessandro Lazaric, and Michal Valko. Improved large-scale graph learning through ridge spectral sparsification. In ICML, 2018.
220
+
221
+ Alireza Chakeri, Hamidreza Farhidzadeh, and Lawrence O Hall. Spectral sparsification in spectral clustering. In ICPR, 2016.
222
+
223
+ Jie Chen, Tengfei Ma, and Cao Xiao. Fastgcn: fast learning with graph convolutional networks via importance sampling. In ICLR, 2018.
224
+
225
+ Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on ¨ graphs with fast localized spectral filtering. In NIPS, 2016.
226
+
227
+ Talya Eden, Shweta Jain, Ali Pinar, Dana Ron, and C. Seshadhri. Provable and practical approximations for the degree distribution using sublinear graph samples. In WWW, 2018.
228
+
229
+ Luca Franceschi, Mathias Niepert, Massimiliano Pontil, and Xiao He. Learning discrete structures for graph neural networks. In ICML, 2019.
230
+
231
+ Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In NIPS, 2017.
232
+
233
+ Jin Huang and Charles X Ling. Using auc and accuracy in evaluating learning algorithms. TKDE, 2005.
234
+
235
+ Wenbing Huang, Tong Zhang, Yu Rong, and Junzhou Huang. Adaptive sampling towards fast graph representation learning. In NeurIPS, 2018.
236
+
237
+ Christian Hubler, Hans-Peter Kriegel, Karsten Borgwardt, and Zoubin Ghahramani. Metropolis ¨ algorithms for representative subgraph sampling. In ICDM, 2008.
238
+
239
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. In ICLR, 2017.
240
+
241
+ Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In ICLR, 2017.
242
+
243
+ John Boaz Lee, Ryan Rossi, and Xiangnan Kong. Graph classification using structural attention. In KDD, 2018.
244
+
245
+ Jure Leskovec and Christos Faloutsos. Sampling from large graphs. In KDD, 2006.
246
+
247
+ Yaguang Li, Rose Yu, Cyrus Shahabi, and Yan Liu. Diffusion convolutional recurrent neural net work: Data-driven traffic forecasting. In ICLR, 2018.
248
+
249
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. In ICLR, 2016.
250
+
251
+ Yike Liu, Tara Safavi, Abhilash Dighe, and Danai Koutra. Graph summarization methods and applications: A survey. ACM Computing Surveys, 2018.
252
+
253
+ Chris J Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables. In ICLR, 2017.
254
+
255
+ Arun S Maiya and Tanya Y Berger-Wolf. Sampling community structure. In WWW, 2010.
256
+
257
+ Michael Mathioudakis, Francesco Bonchi, Carlos Castillo, Aristides Gionis, and Antti Ukkonen. Sparsification of influence networks. In KDD, 2011.
258
+
259
+ Mathias Niepert, Mohamed Ahmed, and Konstantin Kutzkov. Learning convolutional neural networks for graphs. In ICML, 2016.
260
+
261
+ Veeru Sadhanala, Yu-Xiang Wang, and Ryan Tibshirani. Graph sparsification approaches for laplacian smoothing. In AISTATS, 2016.
262
+
263
+ Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 2009.
264
+
265
+ Martin Simonovsky and Nikos Komodakis. Dynamic edge-conditioned filters in convolutional neural networks on graphs. In CVPR, 2017.
266
+
267
+ Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Li ´ o, and Yoshua \` Bengio. Graph attention networks. In ICLR, 2018.
268
+
269
+ Petar Velickovi ˇ c, William Fedus, William L Hamilton, Pietro Li ´ o, Yoshua Bengio, and R Devon \` Hjelm. Deep graph infomax. In ICLR, 2019.
270
+
271
+ Elli Voudigari, Nikos Salamanos, Theodore Papageorgiou, and Emmanuel J Yannakoudakis. Rank degree: An efficient algorithm for graph sampling. In ASONAM, 2016.
272
+
273
+ Keyulu Xu, Chengtao Li, Yonglong Tian, Tomohiro Sonobe, Ken-ichi Kawarabayashi, and Stefanie Jegelka. Representation learning on graphs with jumping knowledge networks. In ICML, 2018.
274
+
275
+ Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? ICLR, 2019.
276
+
277
+ Zhilin Yang, William W Cohen, and Ruslan Salakhutdinov. Revisiting semi-supervised learning with graph embeddings. In ICML, 2016.
278
+
279
+ Rex Ying, Ruining He, Kaifeng Chen, Pong Eksombatchai, William L Hamilton, and Jure Leskovec. Graph convolutional neural networks for web-scale recommender systems. In KDD, 2018a.
280
+
281
+ Zhitao Ying, Jiaxuan You, Christopher Morris, Xiang Ren, Will Hamilton, and Jure Leskovec. Hierarchical graph representation learning with differentiable pooling. In NeurIPS, 2018b.
282
+
283
+ Jiani Zhang, Xingjian Shi, Junyuan Xie, Hao Ma, Irwin King, and Dit-Yan Yeung. Gaan: Gated attention networks for learning on large and spatiotemporal graphs. arXiv preprint arXiv:1803.07294, 2018a.
284
+
285
+ L-C Zhang and M Patone. Graph sampling. Metron, 2017.
286
+
287
+ Yizhou Zhang, Yun Xiong, Xiangnan Kong, Shanshan Li, Jinhong Mi, and Yangyong Zhu. Deep collective classification in heterogeneous information networks. In WWW, 2018b.
288
+
289
+ Yutao Zhang, Fanjin Zhang, Peiran Yao, and Jie Tang. Name disambiguation in aminer: Clustering, maintenance, and human in the loop. In KDD, 2018c.
290
+
291
+ Peixiang Zhao. gsparsify: Graph motif based sparsification for graph clustering. In CIKM, 2015.
292
+
293
+ Chenyi Zhuang and Qiang Ma. Dual graph convolutional networks for graph-based semi-supervised classification. In WWW, 2018.
294
+
295
+ # S1 DATASET DETAILS
296
+
297
+ In this section, we provide additional details about the Transaction datasets in our experiments. The Transaction dataset contains attributed graph that records transaction history between organizations in two years: 2014 and 2015. Each node represents an organization and each directed edge indicates a transaction between two organizations. Node attributes include organization information like account balance, cash research, etc. Under the inductive experimental setting, We use the 47,772 organization data of the year 2014 for training and remaining data are hidden from the model. The 9,554 organizations are used for validation and 38,218 for testing. Validation and testing node sets are from year 2015 and are not connected to the nodes in the training set. Like the PPI dataset, models need to generalize to unseen graph when testing on the Transaction dataset.
298
+
299
+ # S2 EXPERIMENTAL SETTINGS
300
+
301
+ In this section, we provide more details about our implementation and experiments in favor of reproducibility.
302
+
303
+ # S2.1 HARDWARE
304
+
305
+ All experiment are run on a Linux machine with 16 Intel(R) Xeon(R) CPU (E5-2637 v4 $@$ 3.50GHz) and 128GB RAM. Some models (e.g. NeuralSparse and GCN) are accelerated by 4 NVIDIA GeForce GTX1080Ti GPU with 11GB RAM.
306
+
307
+ # S2.2 IMPLEMENTATIONS OF NEURALSPARSE
308
+
309
+ We implement the proposed NeuralSparse in tensorflow framework for efficient GPU computation. In particular, the multi-layer neural network (Equation 4) in the sparsification network is implemented by two-layer feed-forward neural networks in all experiment, where the hyper-parameter $k$ is searched between 2 and 50 for the optimal performance. We employ cross-entropy to formulate the loss function and apply Adam optimizer for training. The learning rate of Adam optimizer is initially set to be $\alpha = \mathrm { \bar { 1 . 0 } \times 1 0 ^ { - 3 } }$ . We initial the weight matrices in the proposed NeuralSparse model with Xavier initialization.
310
+
311
+ In the following, we detail the network structures of NeuralSparse used on individual datasets. $\mathrm { F C } ( a ,$ $b , f )$ means a fully-connected layer with $a$ input neurons and $b$ output neurons activated by function $f$ (none means no activation function is used). $\mathrm { G N N } ( a , b , f )$ means a Graph Neural Network layer with input dimension $a$ , output dimension $b$ , and activation function $f$ . We implement GNN layer with GCN, GraphSAGE, GAT, GIN in the experiments.
312
+
313
+ Reddit The sparsification network runs with: FC(1204, 16, ReLU)-FC(16, 1, Gumbel-Softmax).
314
+ The structure of GNN is GNN(602, 128, ReLU)-GNN(128, 64, ReLU)-FC(64, 41, softmax).
315
+
316
+ PPI The sparsification network runs with: FC(100, 16, ReLU)-FC(16, 1, Gumbel-Softmax). The structure of GNN is GNN(50, 128, ReLU)-GNN(128, 128, ReLU)-FC(128, 121, softmax).
317
+
318
+ Transaction The sparsification network runs with: FC(243, 16, ReLU)-FC(16, 1, GumbelSoftmax). The structure of GNN is GNN(121, 128, ReLU)-GNN(128, 32, ReLU)-FC(32, 2, softmax). Note that there is one-dimensional edge attribute indicating the transaction amount in this dataset.
319
+
320
+ Cora The sparsification network runs with: FC(2866, 32, ReLU)-FC(32, 1, Gumbel-Softmax). The structure of GNN is GNN(1433, 128, ReLU)-GNN(128, 64, ReLU)-FC(64, 7, softmax).
321
+
322
+ Citeseer The sparsification network runs with: FC(7406, 64, ReLU)-FC(64, 1, Gumbel-Softmax).
323
+ The structure of GNN is GNN(3703, 128, ReLU)-GNN(128, 64, ReLU)-FC(64, 6, softmax).
324
+
325
+ As the spectral sparsification models cannot be jointly trained with subsequent GNN module, the sparsification process is treated as a preprocessing step. For Spectral Sparsifier (SS), $\epsilon$ is set to 0.4 in all datasets. For the Rank Degree algorithm (RD), we select $1 \%$ of nodes as the initial seeds and adopt $\rho \in \{ 0 . 1 , 0 . 2 , \cdot \cdot \cdot , 0 . 8 \}$ for the best results.
326
+
327
+ # S3 QUALITATIVE EDGE SAMPLING EVALUATION
328
+
329
+ In this section, we qualitatively demonstrate the difference by Figure 1(a) original graph, Figure 1(b) NeuralSparse, Figure 3(a) SS, and Figure 3(b) RD. In addition, we provide quantitative analysis in Table S1, where we report the percentage of edges that connect nodes of same class labels in sparsified graphs. Both qualitative and quantitative results suggest a common trend: NeuralSparse prefers to select neighbors with the same labels compared with the baseline methods.
330
+
331
+ Table S1: Percentage of edges connecting nodes of the same labels
332
+
333
+ <table><tr><td></td><td>Reddit</td><td>PPI</td><td>Transaction</td><td>Cora</td><td>Citeseer</td></tr><tr><td>Original</td><td>53.1%</td><td>55.0%</td><td>67.3%</td><td>82.2%</td><td>73.1%</td></tr><tr><td>SS</td><td>50.9%</td><td>52.8%</td><td>62.8%</td><td>79.8%</td><td>75.6%</td></tr><tr><td>RD</td><td>49.8%</td><td>53.5%</td><td>63.4%</td><td>84.8%</td><td>72.3%</td></tr><tr><td>NeuralSparse</td><td>59.6%</td><td>61.5%</td><td>76.8%</td><td>93.1%</td><td>87.4%</td></tr></table>
334
+
335
+ # S4 EXPERIMENT WITH SIMILAR NUMBERS OF TRAINABLE PARAMETERS
336
+
337
+ In this section, we evaluate the impact brought by reducing the number of parameters in a GNN with NeuralSparse so that the numbers of trainable parameters in a NeuralSparse GNN and an original GNN are similar. In particular, we focus on GCN in this set of experiment. Using the same notation in S2.2, NeuralSparse-GCN-Compact is implemented as follows.
338
+
339
+ Reddit. NeuralSparse-GCN-Compact runs with: FC(1204, 8, ReLU)-FC(8, 1, Gumbel-Softmax) and GCN(602, 112, ReLU)-GCN(112, 64, ReLU)-FC(64, 41, softmax). The total number of trainable parameters is 86,856 in the NeuralSparse-GCN-Compact, while it is 87,872 in the original GCN.
340
+
341
+ PPI. NeuralSparse-GCN-Compact runs with: FC(100, 16, ReLU)-FC(16, 1, Gumbel-Softmax) and GCN(50, 118, ReLU)-GCN(118, 128, ReLU)-FC(128, 121, softmax). The total number of trainable parameters is 38,108 in the NeuralSparse-GCN-Compact, while it is 38,272 in the original GCN.
342
+
343
+ Transaction. NeuralSparse-GCN-Compact runs with: FC(243, 16, ReLU)-FC(16, 1, GumbelSoftmax) and GCN(121, 100, ReLU)-GCN(100, 32, ReLU)-FC(32, 2, softmax). The total number of trainable parameters is 19,268 in the NeuralSparse-GCN-Compact, while it is 19,648 in the original GCN.
344
+
345
+ Cora NeuralSparse-GCN-Compact runs with: FC(2866, 8, ReLU)-FC(8, 1, Gumbel-Softmax) and GCN(1433, 115, ReLU)-GCN(115, 32, ReLU)-FC(32, 7, softmax). The total number of trainable parameters is 191,635 in the NeuralSparse-GCN-Compact, while it is 192,064 in the original GCN.
346
+
347
+ Citeseer NeuralSparse-GCN-Compact runs with: FC(7406, 32, ReLU)-FC(32, 1, Gumbel-Softmax) and GCN(3703, 64, ReLU)-GCN(64, 32, ReLU)-FC(32, 6, softmax). The total number of trainable parameters is 476,256 in the NeuralSparse-GCN-Compact, while it is 482,560 in the original GCN.
348
+
349
+ Table S2: Node classification performance with similar numbers of trainable parameters
350
+
351
+ <table><tr><td>Dataset</td><td>Reddit</td><td>PPI</td><td>Transaction</td><td>Cora</td><td>Citeseer</td></tr><tr><td>Metrics</td><td>Micro-F1</td><td>Micro-F1</td><td>AUC</td><td>Accuracy</td><td>Accuracy</td></tr><tr><td>GCN</td><td>0.922 ± 0.041</td><td>0.532 ± 0.024</td><td>0.564 ± 0.018</td><td>0.810 ± 0.027</td><td>0.694 ± 0.020</td></tr><tr><td>NeuralSparse- GCN</td><td>0.946 ± 0.020</td><td>0.600 ± 0.014</td><td>0.610 ± 0.022</td><td>0.821 ± 0.014</td><td>0.715 ± 0.014</td></tr><tr><td>NeuralSparse- GCN-Compact</td><td>0.943 ± 0.018</td><td>0.601 ± 0.021</td><td>0.605 ± 0.013</td><td>0.820 ± 0.012</td><td>0.713 ± 0.009</td></tr></table>
352
+
353
+ From the evaluation results shown in Table S2, we draw the following observations. First, both NeuralSparse-GCN and NeuralSparse-GCN-Compact consistently outperform GCN on all the datasets. Second, compared with NeuralSparse-GCN, NeuralSparse-GCN-Compact achieves comparable prediction accuracy with smaller variance in most cases.
354
+
355
+ ![](images/d4ff06450eeed7222339b4c481d90a0bdd0f3540836d5c1a52e337e61d91cdee.jpg)
356
+ S5 HOW PERFORMANCE EVOLVES AS HYPER-PARAMETER $k$ CHANGES?
357
+ Figure S1: Impact from hyper-parameter $k$ on validation and testing on the Transaction dataset
358
+
359
+ In this section, we demonstrate how the hyper-parameter $k$ impacts the performance of NeuralSparse-GAT and NeuralSparse-GraphSAGE in both validation and testing on the Transaction dataset. In terms of validation, as shown in Figure S1, the validation performance increases when $k$ ranges from 2 to 10 with more available graph data. After $k$ exceeds 10, the increase in validation performance slows down and turns to be saturated. In terms of testing performance, it shares a similar trend when $k$ ranges from 2 to 10. Meanwhile, the testing performance drops more after $k$ exceeds 10.
360
+
361
+ # S6 EMPIRICAL COMPARISON BETWEEN NEURALSPARSE AND LDS
362
+
363
+ # S6.1 EVALUATION RESULTS
364
+
365
+ In this section, we compare NeuralSparse and LDS (Franceschi et al., 2019) with the datasets in transductive setting. Here, we utilize three ways to prepare the input graphs of Cora and Citeseer datasets.
366
+
367
+ • Setting A: k-NN graphs (Franceschi et al., 2019). In this setting, the graph structures are completely missing. The input graphs are replaced with k-nearest neighbor graphs initialized from node features. The $k$ in kNN graph is selected from $\{ 1 0 , 2 0 \}$ . • Setting B: original input graphs of Cora and Citeseer datasets with the same random split as Kipf & Welling (2017). • Setting C: edge union of original input graphs and k-NN graphs with $k$ fixed as 10.
368
+
369
+ Table S3: Node classification performance in setting A
370
+
371
+ <table><tr><td></td><td>Cora(10)</td><td>Cora(20)</td><td>Citeseer(10)</td><td>Citeseer(20)</td></tr><tr><td>GCN</td><td>0.641 ± 0.009</td><td>0.631 ± 0.013</td><td>0.653 ± 0.012</td><td>0.671 ± 0.019</td></tr><tr><td>LDS-GCN</td><td>0.715 ± 0.008</td><td>0.703 ± 0.011</td><td>0.691 ± 0.021</td><td>0.715 ± 0.011</td></tr><tr><td>NeuralSparse-GCN</td><td>0.723 ± 0.012</td><td>0.719 ± 0.008</td><td>0.731 ± 0.011</td><td>0.724 ± 0.017</td></tr></table>
372
+
373
+ Our observation is summarized as follows. In general, NeuralSparse and LDS achieves comparable node classification accuracy. Specifically, NeuralSparse has relatively better performance in Setting
374
+
375
+ Table S4: Node classification performance in setting B
376
+
377
+ <table><tr><td></td><td>Cora</td><td>Citeseer</td></tr><tr><td>GCN</td><td>0.810 ± 0.027</td><td>0.694 ± 0.020</td></tr><tr><td>LDS</td><td>0.831 ± 0.017</td><td>0.727 ± 0.021</td></tr><tr><td>NeuralSparse-GCN</td><td>0.821 ± 0.014</td><td>0.724 ± 0.014</td></tr></table>
378
+
379
+ Table S5: Node classification performance in setting C
380
+
381
+ <table><tr><td></td><td>Cora + kNN</td><td>Citeseer +kNN</td></tr><tr><td>GCN</td><td>0.631 ± 0.014</td><td>0.646 ± 0.009</td></tr><tr><td>LDS</td><td>0.731 ± 0.019</td><td>0.725 ± 0.013</td></tr><tr><td>NeuralSparse-GCN</td><td>0.751 ± 0.013</td><td>0.743 ± 0.007</td></tr></table>
382
+
383
+ A and Setting C. LDS performs slightly better in Setting B. From the above observation, we conjecture that NeuralSparse is more robust to graphs with more random edges while LDS is more suitable in a graph of relatively less noise by adding additional edges. We will verify the conjecture in the next subsection.
384
+
385
+ # S6.2 RANDOM EDGE ADDITION TO CORA AND CITESEER
386
+
387
+ We further compare NeuralSparse and LDS (Franceschi et al., 2019) on the node classification tasks where original graph structure is available but more random edges are introduced as noise. Starting from the original graphs, we add edges by randomly sampling two nodes $u , v$ from node set $\mathbb { V }$ and connecting them.
388
+
389
+ The results are shown in Figure S2. In both datasets, NeuralSparse achieves better performance compared with LDS as the noise level goes beyond $200 \%$ . When the amount of noise increases, the classification accuracy of LDS drops significantly.
390
+
391
+ This result confirms our conjecture that NeuralSparse is more robust to random edges, compared to LDS.
392
+
393
+ ![](images/1541d39eb1baff4e83762097c3969c3f8fa9923cd0d18f75e0847ea35860f6c2.jpg)
394
+ Figure S2: Node classification performance when adding noise to graph structure.
395
+
396
+ With the above comments and experimental results, we hope to clarify the difference between the two models and demonstrate that our proposed NeuralSparse is more robust to noises in real-life graphs.
397
+
398
+ # S7 HOW DO TASK-IRRELEVANT EDGES COULD NEGATIVELY IMPACT THE PERFORMANCE OF GCN?
399
+
400
+ In this section, we use an example to demonstrate how an input graph with task-irrelevant edges could impact the performance of GCN. For the ease of discussion and visualization, we focus on a GCN with a simple architecture and synthetic graphs where we could adjust graph topology by hyper-parameters in graph generators.
401
+
402
+ In terms of GCN, we investigate a one-layer GCN
403
+
404
+ $$
405
+ f _ { W } = S o f t m a x ( \hat { A } X W ) = S o f t m a x ( Z W )
406
+ $$
407
+
408
+ where $\hat { A }$ is a normalized adjacency matrix, $X$ is the input node feature matrix, $W$ is the GCN parameters, and $Z = { \hat { A } } X$ denotes node representations in the aggregation space. Intuitively, the quality of $Z$ has direct impact to this GCN’s performance.
409
+
410
+ In terms of input graphs, we generate them for node classification tasks as follows.
411
+
412
+ 1. Nodes and their labels. 2,000 nodes are generated, where 1,000 nodes are assigned with positive labels and the rest are assigned with negative labels.
413
+
414
+ 2. Node features. Each node has a two-dimensional feature vector. For positive nodes, the node features are generated from a Gaussian distribution, where $\mu _ { p o s } = ( - 0 . 5 , 0 )$ and $\Sigma _ { p o s }$ is a diagonal matrix with $\Sigma _ { p o s } [ 0 , 0 ] = \Sigma _ { p o s } [ 1 , 1 ] = 0 . 3$ . For negative nodes, the node features are generated from another Gaussian distribution, where $\mu _ { n e g } = ( 0 . 5 , 0 )$ and $\Sigma _ { n e g }$ is a diagonal matrix with $\Sigma _ { n e g } [ 0 , 0 ] = \Sigma _ { n e g } [ 1 , 1 ] = 0 . 3$ .
415
+
416
+ 3. Edges. Given a hyper-parameter $\bar { d } .$ , for each node, it randomly selects $\bar { d }$ nodes as its onehop neighbors. With respect to this node classification task, an edge that connects two nodes of different labels could be irrelevant, bringing noise to the GCN.
417
+
418
+ ![](images/5dd96ea033e5b6b52630f581022f785856b9b69c307a829bf40b8859dcee63ee.jpg)
419
+ Figure S3: Distributions of $Z$ in graphs with different $\bar { d }$
420
+
421
+ In Figure S3, the distributions of node representation $Z$ are demonstrated at different $\bar { d }$ . When $\bar { d }$ is 0, $\hat { A }$ is an identity matrix so that we simply use input node features in model learning. As shown in Figure S3(a), it is difficult to find a good boundary that well separates the positive and negative nodes by using node features only. However, when we adjusts $\bar { d }$ to 10 or 20 with richer connections, the situation doesn’t get better. Because of the noise introduced by irrelevant edges, it becomes harder to find the classification boundary. While a deep learning may still be able to find a complex boundary that well separates the training data, the boundary could overfit the introduced noise, resulting in low generalization power.
422
+
423
+ In Figure S4, we illustrate how NeuralSparse enhances the prediction accuracy of the GCN. In particular, we focus on the graph with $\bar { d } \stackrel { = } { = } 2 0$ , and sparsify this graph by NeuralSparse. As shown in Figure S4, ranging the hyper-parameter $k$ from 1 to 15, the distributions of $Z$ vary. When $k$ is 1, there is no significant change compared with the distribution in Figure S3(a), as the amount of accessible relevant graph data is still small. When $k$ is increased to 5 or 10, the classification boundary becomes much clearer. As the edge generation process is uniformly random, the expected number of relevant edges per node is roughly 10. When $k$ is 15, this $k$ could be an over-estimate on the amount of relevant edges, making it a bit harder to find a good separation.
424
+
425
+ ![](images/9620fde2d203ee0c349ec93bb26a4e2176f89d84c237215f6816272e46b0151c.jpg)
426
+ Figure S4: Distributions of $\textsf { Z }$ in sparsified subgraphs by NeuralSparse
427
+
428
+ ![](images/227ab45090ec6968d2b28aa7ec871c8a3c410dab8e34e7fe1bba4a2f0d10f15c.jpg)
429
+ Figure S5: Distributions of $\boldsymbol { \mathrm { Z } }$ in sparsified subgraphs by random downsampling
430
+
431
+ In Figure S5, we demonstrate how random downsampling could impact the prediction accuracy of the GCN. In general, we could not see any significant improvement. Indeed, it is crucial to perform a task-driven sparsification as NeuralSparse does.
md/train/S1x4ghC9tQ/S1x4ghC9tQ.md ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TEMPORAL DIFFERENCE VARIATIONAL AUTO-ENCODER
2
+
3
+ Karol Gregor, George Papamakarios, Frederic Besse, Lars Buesing, Théophane Weber DeepMind {karolg, gpapamak, fbesse, lbuesing, theophane}@google.com
4
+
5
+ # ABSTRACT
6
+
7
+ To act and plan in complex environments, we posit that agents should have a mental simulator of the world with three characteristics: (a) it should build an abstract state representing the condition of the world; (b) it should form a belief which represents uncertainty on the world; (c) it should go beyond simple step-by-step simulation, and exhibit temporal abstraction. Motivated by the absence of a model satisfying all these requirements, we propose TD-VAE, a generative sequence model that learns representations containing explicit beliefs about states several steps into the future, and that can be rolled out directly without single-step transitions. TD-VAE is trained on pairs of temporally separated time points, using an analogue of temporal difference learning used in reinforcement learning.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Generative models of sequential data have received a lot of attention, due to their wide applicability in domains such as speech synthesis (van den Oord et al., 2016a; 2017), neural translation (Bahdanau et al., 2014), image captioning (Xu et al., 2015), and many others. Different application domains will often have different requirements (e.g. long term coherence, sample quality, abstraction learning, etc.), which in turn will drive the choice of the architecture and training algorithm.
12
+
13
+ Of particular interest to this paper is the problem of reinforcement learning in partially observed environments, where, in order to act and explore optimally, agents need to build a representation of the uncertainty about the world, computed from the information they have gathered so far. While an agent endowed with memory could in principle learn such a representation implicitly through model-free reinforcement learning, in many situations the reinforcement signal may be too weak to quickly learn such a representation in a way which would generalize to a collection of tasks.
14
+
15
+ Furthermore, in order to plan in a model-based fashion, an agent needs to be able to imagine distant futures which are consistent with the agent’s past. In many situations however, planning step-by-step is not a cognitively or computationally realistic approach.
16
+
17
+ To successfully address an application such as the above, we argue that a model of the agent’s experience should exhibit the following properties:
18
+
19
+ • The model should learn an abstract state representation of the data and be capable of making predictions at the state level, not just the observation level.
20
+ • The model should learn a belief state, i.e. a deterministic, coded representation of the filtering posterior of the state given all the observations up to a given time. A belief state contains all the information an agent has about the state of the world and thus about how to act optimally.
21
+ • The model should exhibit temporal abstraction, both by making ‘jumpy’ predictions (predictions several time steps into the future), and by being able to learn from temporally separated time points without backpropagating through the entire time interval.
22
+
23
+ To our knowledge, no model in the literature meets these requirements. In this paper, we develop a new model and associated training algorithm, called Temporal Difference Variational Auto-Encoder (TD-VAE), which meets all of the above requirements. We first develop TD-VAE in the sequential, non-jumpy case, by using a modified evidence lower bound (ELBO) for stochastic state space models (Krishnan et al., 2015; Fraccaro et al., 2016; Buesing et al., 2018) which relies on jointly training a filtering posterior and a local smoothing posterior. We demonstrate that on a simple task, this new inference network and associated lower bound lead to improved likelihood compared to methods classically used to train deep state-space models.
24
+
25
+ Following the intuition given by the sequential TD-VAE, we develop the full TD-VAE model, which learns from temporally extended data by making jumpy predictions into the future. We show it can be used to train consistent jumpy simulators of complex 3D environments. Finally, we illustrate how training a filtering a posterior leads to the computation of a neural belief state with good representation of the uncertainty on the state of the environment.
26
+
27
+ # 2 MODEL DESIDERATA
28
+
29
+ # 2.1 CONSTRUCTION OF A LATENT STATE-SPACE
30
+
31
+ Autoregressive models. One of the simplest way to model sequential data $( x _ { 1 } , \ldots , x _ { T } )$ is to use the chain rule to decompose the joint sequence likelihood as a product of conditional probabilities, i.e. $\begin{array} { r } { \log p ( x _ { 1 } , \dots , \dot { x _ { T } } ) = \sum _ { t } \log p ( \dot { x _ { t } } | x _ { 1 } , \dots , x _ { t - 1 } ) } \end{array}$ . This formula can be used to train an autoregressive model of data, by combining an RNN which aggregates information from the past (recursively computing an internal state $h _ { t } = f ( h _ { t - 1 } , x _ { t } ) )$ with a conditional generative model which can score the data $x _ { t }$ given the context $h _ { t }$ . This idea is used in handwriting synthesis (Graves, 2013), density estimation (Uria et al., 2016), image synthesis (van den Oord et al., 2016b), audio synthesis (van den Oord et al., 2017), video synthesis (Kalchbrenner et al., 2016), generative recall tasks (Gemici et al., 2017), and environment modeling (Oh et al., 2015; Chiappa et al., 2017).
32
+
33
+ While these models are conceptually simple and easy to train, one potential weakness is that they only make predictions in the original observation space, and don’t learn a compressed representation of data. As a result, these models tend to be computationally heavy (for video prediction, they constantly decode and re-encode single video frames). Furthermore, the model can be computationally unstable at test time since it is trained as a next step model (the RNN encoding real data), but at test time it feeds back its prediction into the RNN. Various methods have been used to alleviate this issue (Bengio et al., 2015; Lamb et al., 2016; Goyal et al., 2017; Amos et al., 2018).
34
+
35
+ State-space models. An alternative to autoregressive models are models which operate on a higher level of abstraction, and use latent variables to model stochastic transitions between states (grounded by observation-level predictions). This enables to sample state-to-state transitions only, without needing to render the observations, which can be faster and more conceptually appealing. They generally consist of decoder or prior networks, which detail the generative process of states and observations, and encoder or posterior networks, which estimate the distribution of latents given the observed data. There is a large amount of recent work on these type of models, which differ in the precise wiring of model components (Bayer & Osendorfer, 2014; Chung et al., 2015; Krishnan et al., 2015; Archer et al., 2015; Fraccaro et al., 2016; Liu et al., 2017; Serban et al., 2017; Buesing et al., 2018; Lee et al., 2018; Ha & Schmidhuber, 2018).
36
+
37
+ Let $\mathbf { z } ~ = ~ ( z _ { 1 } , \dots , z _ { T } )$ be a state sequence and $\mathbf { x } ~ = ~ ( x _ { 1 } , \dots , x _ { T } )$ an observation sequence. We assume a general form of state-space model, where the joint state and observation likelihood can be written as $\begin{array} { r } { p ( \mathbf { x } , \mathbf { z } ) = \prod _ { t } p ( z _ { t } \mid \bar { z } _ { t - 1 } ) p ( x _ { t } \mid z _ { t } ) } \end{array}$ .1 These models are commonly trained with a VAEinspired bound, by computing a posterior $q ( \mathbf { z } \mid \mathbf { x } )$ over the states given the observations. Often, the posterior is decomposed autoregressively: $\begin{array} { r } { \dot { q } ( \mathbf { \dot { z } } \vert \mathbf { x } ) = \prod _ { t } q ( z _ { t } \vert z _ { t - 1 } , \phi _ { t } ( \mathbf { x } ) ) } \end{array}$ , where $\phi _ { t }$ is a function of $( x _ { 1 } , \ldots , x _ { t } )$ for filtering posteriors or the entire sequence $\mathbf { x }$ for smoothing posteriors. This leads to the following lower bound:
38
+
39
+ $$
40
+ \log p ( \mathbf { x } ) \geq \mathbb { E } _ { \mathbf { z } \sim q ( \mathbf { z } \mid \mathbf { x } ) } \left[ \sum _ { t } \log p ( x _ { t } \mid z _ { t } ) + \log p ( z _ { t } \mid z _ { t - 1 } ) - \log q ( z _ { t } \mid z _ { t - 1 } , \phi _ { t } ( \mathbf { x } ) ) \right] .
41
+ $$
42
+
43
+ # 2.2 ONLINE CREATION OF BELIEF STATE.
44
+
45
+ A key feature of sequential models of data is that they allow to reason about the conditional distribution of the future given the past: $p ( x _ { t + 1 } , \ldots , x _ { T } \mid x _ { 1 } , \cdot \cdot \cdot , x _ { t } )$ . For reinforcement learning in partially observed environments, this distribution governs the distribution of returns given past observations, and as such, it is sufficient to derive the optimal policy. For generative sequence modeling, it enables conditional generation of data given a context sequence. For this reason, it is desirable to compute sufficient statistics $b _ { t } = b _ { t } ( x _ { 1 } , \dots , x _ { t } )$ of the future given the past, which allow to rewrite the conditional distribution as $p ( x _ { t + 1 } , \dots , x _ { T } | x _ { 1 } , \dots , x _ { t } ) \{ \approx p ( x _ { t + 1 } , \dots , x _ { T } | b _ { t } )$ . For an autoregressive model as described in section 2.1, the internal RNN state $h _ { t }$ can immediately be identified as the desired sufficient statistics $b _ { t }$ . However, for the reasons mentioned in the previous section, we would like to identify an equivalent quantity for a state-space model.
46
+
47
+ For a state-space model, the filtering distribution $p ( z _ { t } \mid x _ { 1 } , . . . , x _ { t } )$ , also known as the belief state in reinforcement learning, is sufficient to compute the conditional future distribution, due to the Markov assumption underlying the state-space model and the following derivation:
48
+
49
+ $$
50
+ p ( x _ { t + 1 } , \dots , x _ { T } \mid x _ { 1 } , \dots , x _ { t } ) = \int p ( z _ { t } \mid x _ { 1 } , \dots , x _ { t } ) p ( x _ { t + 1 } , \dots , x _ { T } \mid z _ { t } ) \mathrm { d } z _ { t } .
51
+ $$
52
+
53
+ Thus, if we train a network that extracts a code $b _ { t }$ from $( x _ { 1 } , \ldots , x _ { t } )$ so that $p ( z _ { t } | x _ { 1 } , \ldots , x _ { t } ) \approx$ $p ( \boldsymbol { z } _ { t } | \boldsymbol { b } _ { t } )$ , $b _ { t }$ would contain all the information about the state of the world the agent has, and would effectively form a neural belief state, i.e. a code fully characterizing the filtering distribution.
54
+
55
+ Classical training of state-space model does not compute a belief state: by computing a joint, autoregressive posterior $\begin{array} { r } { q ( \mathbf { z } \vert \mathbf { x } ) = \prod _ { t } q ( z _ { t } \vert z _ { t - 1 } , \mathbf { x } ) } \end{array}$ , some of the uncertainty about the marginal posterior of $z _ { t }$ may be ‘leaked’ in the sample $z _ { t - 1 }$ . Since that sample is stochastic, to obtain all information from $( x _ { 1 } , \ldots , x _ { t } )$ about $z _ { t }$ , we would need to re-sample $z _ { t - 1 }$ , which would in turn require re-sampling $z _ { t - 2 }$ all the way to $z _ { 1 }$ .
56
+
57
+ While the notion of a belief state itself and its connection to optimal policies in POMDPs is well known (Astrom, 1965; Kaelbling et al., 1998; Hauskrecht, 2000), it has often been restricted to the tabular case (Markov chain), and little work investigates computing belief states for learned deep models. A notable exception is (Igl et al., 2018), which uses a neural form of particle filtering, and represents the belief state more explicitly as a weighted collection of particles. Related to our definition of belief states as sufficient statistics is the notion of predictive state representations (PSRs) (Littman & Sutton, 2002); see also (Venkatraman et al., 2017) for a model that learns PSRs which, combined with a decoder, can predict future observations.
58
+
59
+ Our last requirement for the model is that of temporal abstraction. We postpone the discussion of this aspect until section 4.
60
+
61
+ # 3 BELIEF-STATE-BASED ELBO FOR SEQUENTIAL TD-VAE
62
+
63
+ In this section, we develop a sequential model that satisfies the requirements given in the previous section, namely (a) it constructs a latent state-space, and (b) it creates a online belief state. We consider an arbitrary state space model with joint latent and observable likelihood given by $\begin{array} { r } { p ( \mathbf { x } , \mathbf { z } ) = \prod _ { t } p ( z _ { t } \mid z _ { t - 1 } ) p ( x _ { t } \mid z _ { t } ^ { \cdot } ) } \end{array}$ , and we aim to optimize the data likelihood $\log p ( \mathbf { x } )$ . We begin by autoregressively decomposing the data likelihood as: $\begin{array} { r } { \log p ( \mathbf { x } ) = \sum _ { t } \log p ( x _ { t } \mid x _ { < t } ) } \end{array}$ . For a given $t$ , we evaluate the conditional likelihood $p ( x _ { t } \mid x _ { < t } )$ by inferring over two latent states only: $z _ { t - 1 }$ and $z _ { t }$ , as they will naturally make belief states appear for times $t - 1$ and $t$ :
64
+
65
+ $$
66
+ \begin{array} { r l } & { \log p ( x _ { t } \mid x _ { < t } ) \ge \underset { ( z _ { t - 1 } , z _ { t } ) \sim q ( z _ { t - 1 } , z _ { t } \mid x _ { \le t } ) } { \mathbb { E } } \Big [ \log p ( x _ { t } \mid z _ { t - 1 } , z _ { t } , x _ { < t } ) + \log p ( z _ { t - 1 } , z _ { t } \mid x _ { < t } ) } \\ & { \qquad \quad - \log q ( z _ { t - 1 } , z _ { t } \mid x _ { \le t } ) \Big ] . } \end{array}
67
+ $$
68
+
69
+ Because of the Markov assumptions underlying the state-space model, we can simplify $p ( x _ { t } \mid z _ { t - 1 } , z _ { t } , x _ { < t } ) = p ( x _ { t } \mid z _ { t } )$ and decompose $p ( z _ { t - 1 } , z _ { t } | x _ { < t } ) = p ( z _ { t - 1 } | x _ { < t } ) p ( z _ { t } | z _ { t - 1 } )$ . Next, we choose to decompose $q ( \boldsymbol { z } _ { t - 1 } , \boldsymbol { z } _ { t } \mid \boldsymbol { x } _ { \le t } )$ as a belief over $z _ { t }$ and a one-step smoothing distribution over $z _ { t - 1 }$ : $q ( z _ { t - 1 } , z _ { t } | x _ { \leq t } ) = q ( z _ { t } | \bar { x _ { \leq t } } ) q ( z _ { t - 1 } | z _ { t } , x _ { \leq t } )$ . We obtain the following belief-based
70
+
71
+ ELBO for state-space models:
72
+
73
+ $$
74
+ \begin{array} { c } { \log p ( x _ { t } \mid x _ { < t } ) \geq \underset { ( z _ { t - 1 } , z _ { t } ) \sim q ( z _ { t - 1 } , z _ { t } \mid x _ { \leq t } ) } { \mathbb { E } } \Big [ \log p ( x _ { t } \mid z _ { t } ) + \log p ( z _ { t - 1 } \mid x _ { < t } ) + \log p ( z _ { t } \mid z _ { t - 1 } ) } \\ { - \log q ( z _ { t } \mid x _ { \leq t } ) - \log q ( z _ { t - 1 } \mid z _ { t } , x _ { \leq t } ) \Big ] . } \end{array}
75
+ $$
76
+
77
+ Both quantities $p ( z _ { t - 1 } \mid x _ { \leq t - 1 } )$ and $q ( \boldsymbol { z } _ { t } | \boldsymbol { x } _ { \le t } )$ represent the belief state of the model at different times, so at this stage we approximate them with the same distribution $p _ { B } ( z \vert b )$ , with $b _ { t } = f ( b _ { t - 1 } , x _ { t } )$ representing the belief state code for $z _ { t }$ . Similarly, we represent the smoothing posterior over $z _ { t - 1 }$ as $q ( \bar { z } _ { t - 1 } | z _ { t } , \bar { b } _ { t - 1 } , b _ { t } )$ . We obtain the following loss:
78
+
79
+ $$
80
+ \begin{array} { r l } { - \mathcal { L } = } & { \underset { z _ { t } \sim p _ { B } ( z _ { t } \mid b _ { t } ) } { \mathbb { E } } \Big [ \log p ( x _ { t } \mid z _ { t } ) + \log p _ { B } ( z _ { t - 1 } \mid b _ { t - 1 } ) + \log p ( z _ { t } \mid z _ { t - 1 } ) } \\ & { \qquad \quad \ : z _ { t - 1 } \sim q ( z _ { t - 1 } \mid z _ { t } , b _ { t } , b _ { t - 1 } ) } \\ & { \qquad \quad \ : - \log p _ { B } ( z _ { t } \mid b _ { t } ) - \log q ( z _ { t - 1 } \mid z _ { t } , b _ { t - 1 } , b _ { t } ) \Big ] . } \end{array}
81
+ $$
82
+
83
+ We provide an intuition on the different terms of the ELBO in the next section.
84
+
85
+ # 4 TD-VAE AND JUMPY STATE MODELING
86
+
87
+ The model derived in the previous section expresses a state model $p ( z _ { t } \mid z _ { t - 1 } )$ that describes how the state of the world evolves from one time step to the next. However, in many applications, the relevant timescale for planning may not be the one at which we receive observations and execute simple actions. Imagine for example planning for a trip abroad; the different steps involved (discussing travel options, choosing a destination, buying a ticket, packing a suitcase, going to the airport, and so on), all occur at vastly different time scales (potentially months in the future at the beginning of the trip, and days during the trip). Certainly, making a plan for this situation does not involve making second-by-second decisions. This suggests that we should look for models that can imagine future states directly, without going through all intermediate states.
88
+
89
+ Beyond planning, there are several other reasons that motivate modeling the future directly. First, training signal coming from the future can be stronger than small changes happening between time steps. Second, the behavior of the model should ideally be independent from the underlying temporal sub-sampling of the data, if the latter is an arbitrary choice. Third, jumpy predictions can be computationally efficient; when predicting several steps into the future, there may be some intervals where the prediction is either easy (e.g. a ball moving straight), or the prediction is complex but does not affect later time steps — which Neitz et al. (2018) call inconsequential chaos.
90
+
91
+ There is a number of research directions that consider temporal jumps. Koutnik et al. (2014) and Chung et al. (2016) consider recurrent neural network with skip connections, making it easier to bridge distant timesteps. Buesing et al. (2018) temporally sub-sample the data and build a jumpy model (for fixed jump size) of this data; but by doing so they also drop the information contained in the skipped observations. Neitz et al. (2018) and Jayaraman et al. (2018) predict sequences with variable time-skips, by choosing as target the most predictable future frames. They predict the observations directly without learning appropriate states, and only focus on nearly fully observed problems (and therefore do not need to learn a notion of belief state). For more general problems, this is a fundamental limitation, as even if one could in principle learn a jumpy observation model $p ( x _ { t + \delta } | x _ { \leq t } )$ , it cannot be used recursively (feeding $x _ { t + \delta }$ back to the RNN and predicting $x _ { t + \delta + \delta ^ { \prime } } )$ . This is because $x _ { t + \delta }$ does not capture the full state of the system and so we would be missing information from $t$ to $t + \delta$ to fully characterize what happens after time $t + \delta$ . In addition, $x _ { t + \delta }$ might not be appropriate even as target, because some important information can only be extracted from a number of frames (potentially arbitrarily separated), such as a behavior of an agent.
92
+
93
+ # 4.1 THE TD-VAE MODEL
94
+
95
+ Motivated by the model derived in section 3, we extend sequential TD-VAE to exhibit time abstraction. We start from the same assumptions and architectural form: there exists a sequence of states $z _ { 1 } , \dots , z _ { T }$ from which we can predict the observations $x _ { 1 } , \ldots , x _ { T }$ . A forward RNN encodes a belief state $b _ { t }$ from past observations $x _ { \leq t }$ . The main difference is that, instead of relating information known at times $t$ and $t + 1$ through the states $z _ { t }$ and $z _ { t + 1 }$ , we relate two distant time steps $t _ { 1 }$ and $t _ { 2 }$ through their respective states $z _ { t _ { 1 } }$ and $z _ { t _ { 2 } }$ , and we learn a jumpy, state-to-state model $p \big ( \boldsymbol { z } _ { t _ { 2 } } \mid \boldsymbol { z } _ { t _ { 1 } } \big )$ between $z _ { t _ { 1 } }$ and $z _ { t _ { 2 } }$ . Following equation 5, the negative loss for the TD-VAE model is:
96
+
97
+ ![](images/a7723f2f0aeb62cb85ef6f1a2219b174363ded213b7cf0db50ca339574f8081b.jpg)
98
+ Figure 1: Diagram of TD-VAE. Follow the red panels for an explanation of the architecture. For succinctness, we use the notation $p _ { D }$ to denote the decoder $p ( x | z )$ , $p _ { T }$ to denote the transition distribution $p ( s _ { t _ { 2 } } | s _ { t _ { 1 } } )$ , $q _ { S }$ for the smoothing distribution and $p _ { B }$ for the belief distribution.
99
+
100
+ $$
101
+ \begin{array} { r l } & { \mathcal { L } _ { t _ { 1 } , t _ { 2 } } = \underset { ( z _ { t _ { 1 } } , z _ { t _ { 2 } } ) \sim q ( z _ { t _ { 1 } } , z _ { t _ { 2 } } \mid b _ { t _ { 1 } } , b _ { t _ { 2 } } ) } { \mathbb { E } } \bigg [ \log p ( x _ { t _ { 2 } } \mid z _ { t _ { 2 } } ) + \log p _ { B } ( z _ { t _ { 1 } } \mid b _ { t _ { 1 } } ) + \log p ( z _ { t _ { 2 } } \mid z _ { t _ { 1 } } ) } \\ & { \qquad \quad - \log p _ { B } ( z _ { t _ { 2 } } \mid b _ { t _ { 2 } } ) - \log q ( z _ { t _ { 1 } } \mid z _ { t _ { 2 } } , b _ { t _ { 1 } } , b _ { t _ { 2 } } ) \bigg ] } \end{array}
102
+ $$
103
+
104
+ To train this model, one should choose the distribution of times $t _ { 1 } , t _ { 2 }$ ; for instance, $t _ { 1 }$ can be chosen uniformly from the sequence, and $t _ { 2 } - t _ { 1 }$ uniformly over some finite range $[ 1 , D ]$ ; other approaches could be investigated. Figure 1 describes in detail the computation flow of the model.
105
+
106
+ Finally, it would be desirable to model the world with different hierarchies of state, the higher-level states predicting the same-level or lower-level states, and ideally representing more invariant or abstract information. For this reason, we also develop stacked (hierarchical) version of TD-VAE, which uses several layers of latent states. Hierarchical TD-VAE is detailed in the appendix.
107
+
108
+ # 4.2 INTUITION BEHIND TD-VAE
109
+
110
+ In this section, we provide a more intuitive explanation behind the computation and loss of the model. Assume we want to predict a future time step $t _ { 2 }$ from all the information we have up until time $t _ { 1 }$ . All relevant information up until time $t _ { 1 }$ (respectively $t _ { 2 }$ ) has been compressed into a code $b _ { t _ { 1 } }$ (respectively $b _ { t _ { 2 } }$ ). We make an observation $x _ { t }$ of the world2 at every time step $t$ , but posit the existence of a state $z _ { t }$ which fully captures the full condition of the world at time $t$ .
111
+
112
+ Consider an agent at the current time $t _ { 2 }$ . At that time, the agent can make a guess of what the state of the world is by sampling from its belief model $p _ { B } \big ( z _ { t _ { 2 } } \big | b _ { t _ { 2 } } \big )$ . Because the state $z _ { t _ { 2 } }$ should entail the corresponding observation $x _ { t _ { 2 } }$ , the agent aims to maximize $p ( x _ { t _ { 2 } } \mid z _ { t _ { 2 } } )$ (first term of the loss), with a variational bottleneck penalty $- \log p ( z _ { t _ { 2 } } \mid b _ { t _ { 2 } } )$ (second term of the loss) to prevent too much information from the current observation $x _ { t _ { 2 } }$ from being encoded into $z _ { t _ { 2 } }$ . Then follows the question ‘could the state of the world at time $t _ { 2 }$ have been predicted from the state of the world at time $t _ { 1 } ? { }$ . In order to ascertain this, the agent must estimate the state of the world at time $t _ { 1 }$ . By time $t _ { 2 }$ , the agent has aggregated observations between $t _ { 1 }$ and $t _ { 2 }$ that are informative about the state of the world at time $t _ { 1 }$ , which, together with the current guess of the state of the world $z _ { t _ { 2 } }$ , can be used to form an ex post guess of the state of the world. This is done by computing a smoothing distribution $q ( z _ { t _ { 1 } } | z _ { t _ { 2 } } , b _ { t _ { 1 } } , b _ { t _ { 2 } } )$ and drawing a corresponding sample $z _ { t _ { 1 } }$ . Having guessed states of the world $z _ { t _ { 1 } }$ and $z _ { t _ { 2 } }$ , the agent optimizes its predictive jumpy model of the world state $p ( \boldsymbol { z } _ { t _ { 2 } } \mid \boldsymbol { z } _ { t _ { 1 } } )$ (third term of the loss). Finally, it should attempt to see how predictable the revealed information was, or in other words, to assess whether the smoothing distribution $q ( z _ { t _ { 1 } } \mid z _ { t _ { 2 } } , b _ { t _ { 2 } } )$ could have been predicted from information only available at time $t _ { 1 }$ (this is indirectly predicting $z _ { t _ { 2 } }$ from the state of knowledge $b _ { t _ { 1 } }$ at time $t _ { 1 }$ - the problem we started with). The agent can do so by minimizing the KL between the smoothing distribution and the belief distribution at time $t _ { 1 }$ : $\mathbf { K } \dot { \mathbf { L } } ( q ( z _ { t _ { 1 } } \mid z _ { t _ { 2 } } , \bar { b } _ { t _ { 1 } } , b _ { t _ { 2 } } ) \mid \mid p ( z _ { t _ { 1 } } \mid b _ { t _ { 1 } } ) )$ (fourth term of the loss). Summing all the losses described so far, we obtain the TD-VAE loss.
113
+
114
+ # 4.3 CONNECTION WITH TEMPORAL-DIFFERENCE LEARNING
115
+
116
+ In reinforcement learning, the state of an agent represents a belief about the sum of discounted rewards $\begin{array} { r } { R _ { t } = \sum _ { \tau } r _ { t + \tau } \gamma ^ { \bar { \tau } } } \end{array}$ . In the classic setting, the agent only models the mean of this distribution represented by the value function $V _ { t }$ or action dependent $\mathrm { Q }$ -function $Q _ { t } ^ { a }$ (Sutton $\&$ Barto, 1998). Recently in (Bellemare et al., 2017), a full distribution over $R _ { t }$ has been considered. To estimate $V _ { t _ { 1 } }$ or $Q _ { t _ { 1 } } ^ { a }$ at time $t _ { 1 }$ , one does not usually wait to get all the rewards to compute $R _ { t _ { 1 } }$ . Instead, one uses an estimate at some future time $t _ { 2 }$ as a bootstrap to estimate $V _ { t _ { 1 } }$ or $Q _ { t _ { 1 } } ^ { a }$ (temporal difference).
117
+
118
+ In our case, the model expresses a belief $p _ { B } ( z _ { t } \vert b _ { t } )$ about possible future states instead of the sum of discounted rewards. The model trains the belief $p _ { B } \big ( z _ { t _ { 1 } } \big | b _ { t _ { 1 } } \big )$ at time $t _ { 1 }$ using belief $p _ { B } \big ( z _ { t _ { 2 } } \big | b _ { t _ { 2 } } \big )$ at some time $t _ { 2 }$ in the future. It accomplishes this by (variationally) auto-encoding a sample $z _ { t _ { 2 } }$ of the future state into a sample $z _ { t _ { 1 } }$ , using the approximate posterior distribution $q \big ( z _ { t _ { 1 } } \mid z _ { t _ { 2 } } , b _ { t _ { 1 } } , b _ { t _ { 2 } } \big )$ and the decoding distribution $p ( \boldsymbol { z } _ { t _ { 2 } } \mid \boldsymbol { z } _ { t _ { 1 } } )$ . This auto-encoding mapping translates between states at $t _ { 1 }$ and $t _ { 2 }$ , forcing beliefs at the two time steps to be consistent. Sample $z _ { t _ { 1 } }$ forms the target for training the belief $p _ { B } \big ( z _ { t _ { 1 } } \big | b _ { t _ { 1 } } \big )$ , which appears as a prior distribution over $z _ { t _ { 1 } }$ .
119
+
120
+ # 5 EXPERIMENTS.
121
+
122
+ The first experiment using sequential TD-VAE, which enables a direct comparison to related algorithms for training state-space models. Subsequent experiments use the full TD-VAE model.
123
+
124
+ # 5.1 PARTIALLY OBSERVED MINIPACMAN
125
+
126
+ We use a partially observed version of the MiniPacman environment (Racanière et al., 2017), shown in Figure 2. The agent (Pacman) navigates a maze, and tries to eat all the food while avoiding being eaten by a ghost. Pacman sees only a $5 \times 5$ window around itself. To achieve a high score, the agent needs to form a belief state that captures memory of past experience (e.g. which parts of the maze have been visited) and uncertainty on the environment (e.g. where the ghost might be).
127
+
128
+ We evaluate the performance of sequential (non-jumpy) TD-VAE on the task of modeling a sequence of the agent’s observations. We compare it with two state-space models trained using the standard ELBO of equation 1:
129
+
130
+ • A filtering model with encoder $\begin{array} { r } { q ( \mathbf { z } \mid \mathbf { x } ) = \prod _ { t } q ( z _ { t } \mid z _ { t - 1 } , b _ { t } ) } \end{array}$ , where $b _ { t } = \mathrm { R N N } ( b _ { t - 1 } , x _ { t } )$ .
131
+ • A mean-field model with encoder $\begin{array} { r } { q ( \mathbf { z } \mid \mathbf { x } ) = \prod _ { t } q ( z _ { t } \mid b _ { t } ) } \end{array}$ , where $b _ { t } = \mathrm { R N N } ( b _ { t - 1 } , x _ { t } )$ .
132
+
133
+ Figure 2 shows the ELBO and estimated negative log probability on a test set of MiniPacman sequences for each model. TD-VAE outperforms both baselines, whereas the mean-field model is the least well-performing. We note that $b _ { t }$ is a belief state for the mean-field model, but not for the filtering model; the encoder of the latter explicitly depends on the previous latent state $z _ { t - 1 }$ , hence $b _ { t }$ is not its sufficient statistics. This comparison shows that naively restricting the encoder in order to obtain a belief state hurts the performance significantly; TD-VAE overcomes this difficulty.
134
+
135
+ <table><tr><td></td><td>ELBO</td><td>-log p(x) (est.)</td></tr><tr><td>Filtering model</td><td>0.1169 ±0.0003</td><td>0.0962 ± 0.0007</td></tr><tr><td>Mean-field model</td><td>0.1987±0.0004</td><td>0.1678 ± 0.0010</td></tr><tr><td>TD-VAE</td><td>0.0773±0.0002</td><td>0.0553 ±0.0006</td></tr></table>
136
+
137
+ ![](images/dbe986c42bf2b18439142319f2b9d58e5cac11d9812c208b9c096d8581db98c1.jpg)
138
+ Figure 2: MiniPacman. Left: A full frame from the game (size $1 5 \times 1 9$ ). Pacman (green) is navigating the maze trying to eat all the food (blue) while being chased by a ghost (red). Top right: A sequence of observations, consisting of consecutive $5 \times 5$ windows around Pacman. Bottom right: ELBO and estimated negative log probability on a test set of MiniPacman sequences. Lower is better. Log probability is estimated using importance sampling with the encoder as proposal.
139
+
140
+ ![](images/53356f6d65dcaf8ab95d625cdbe7b653326dac0dcb5735d8bfb91cad38294117.jpg)
141
+ Figure 3: Moving MNIST. Left: Rows are example input sequences. Right: Jumpy rollouts from the model. We see that the model is able to roll forward by skipping frames, keeping the correct digit and the direction of motion.
142
+
143
+ # 5.2 MOVING MNIST
144
+
145
+ In this experiment, we show that the model is able to learn the state and roll forward in jumps. We consider sequences of length 20 of images of MNIST digits. For each sequence, a random digit from the dataset is chosen, as well as the direction of movement (left or right). At each time step, the digit moves by one pixel in the chosen direction, as shown in Figure 3. We train the model with $t _ { 1 }$ and $t _ { 2 }$ separated by a random amount $t _ { 2 } - t _ { 1 }$ from the interval [1, 4]. We would like to see whether the model at a given time can roll out a simulated experience in time steps $t _ { 1 } = t + \delta _ { 1 }$ , $t _ { 2 } = t _ { 1 } + \delta _ { 2 } , . . .$ with $\delta _ { 1 } , \delta _ { 2 } , \dots > 1$ , without considering the inputs in between these time points. Note that it is not sufficient to predict the future inputs $\boldsymbol { x } _ { t _ { 1 } } , \ldots$ as they do not contain information about whether the digit moves left or right. We need to sample a state that contains this information.
146
+
147
+ We roll out a sequence from the model as follows: (a) $b _ { t }$ is computed by the aggregation recurrent network from observations up to time $t$ ; (b) a state $z _ { t }$ is sampled from $p _ { B } ( z _ { t } \vert b _ { t } )$ ; (c) a sequence of states is rolled out by repeatedly sampling $z \gets z ^ { \prime } \sim p ( z ^ { \prime } | z )$ starting with $z = z _ { t }$ ; (d) each $z$ is decoded by $p ( x \mid z )$ , producing a sequence of frames. The resulting sequences are shown in Figure 3. We see that indeed the model can roll forward the samples in steps of more than one elementary time step (the sampled digits move by more than one pixel) and that it preserves the direction of motion, demonstrating that it rolls forward a state.
148
+
149
+ # 5.3 NOISY HARMONIC OSCILLATOR
150
+
151
+ We would like to demonstrate that the model can build a state even when little information is present in each observation, and that it can sample states far into the future. For this we consider a 1D sequence obtained from a noisy harmonic oscillator, as shown in Figure 4 (first and fourth rows). The frequencies, initial positions and initial velocities are chosen at random from some range. At every update, noise is added to the position and the velocity of the oscillator, but the energy is approximately preserved. The model observes a noisy version of the current position. Attempting to predict the input, which consists of one value, 100 time steps in the future would be uninformative; such a prediction wouldn’t reveal what the frequency or the magnitude of the signal is, and because the oscillator updates are noisy, the phase information would be nearly lost. Instead, we should try to predict as much as possible about the state, which consists of frequency, magnitude and position, and it is only the position that cannot be accurately predicted.
152
+
153
+ ![](images/a07734250325cb91c31f78aadcbbb6e42fa93ed686f71138d404c8ce91bcced7.jpg)
154
+ Figure 4: Skip-state prediction for 1D signal. The input is generated by a noisy harmonic oscillator. Rollouts consist of (a) a jumpy state transition with either $d t = 2 0$ or $d t = 1 0 0$ , followed by 20 state transitions with $d t = 1$ . The model is able to create a state and predict it into the future, correctly predicting frequency and magnitude of the signal.
155
+
156
+ The aggregation RNN is an LSTM; we use a hierarchical TD-VAE with two layers, where the latent variables in the higher layer are sampled first, and their results are passed to the lower layer. The belief, smoothing and state-transition distributions are feed-forward networks, and the decoder simply extracts the first component from the $z$ of the first layer. We also feed the time interval $t _ { 2 } - t _ { 1 }$ into the smoothing and state-transition distributions. We train on sequences of length 200, with $t _ { 2 } - t _ { 1 }$ taking values chosen at random from [1, 10] with probability 0.8 and from [1, 120] with probability 0.2.
157
+
158
+ We analyze what the model has learned as follows. We pick time $t _ { 1 } ~ = ~ 6 0$ and sample $z _ { t _ { 1 } } \sim$ $p _ { B } \big ( z _ { t _ { 1 } } \big | \big ) \big | b _ { t _ { 1 } } \big )$ . Then, we choose a time interval $\delta _ { t } \in \{ 2 0 , \bar { 1 } 0 0 \}$ to skip, sample from the forward model $p ( z _ { 2 } \mid z _ { 1 } , \delta _ { t } )$ to obtain $z _ { t _ { 2 } }$ at $t _ { 2 } = t _ { 1 } + \delta _ { t }$ . To see the content of this state, we roll forward 20 times with time step $\delta = 1$ and plot the result, shown in Figure 4. We see that indeed the state $z _ { t _ { 2 } }$ is predicted correctly, containing the correct frequency and magnitude of the signal. We also see that the position (phase) is predicted well for $d t = 2 0$ and less accurately for $d t = 1 0 0$ (at which point the noisiness of the system makes it unpredictable).
159
+
160
+ Finally, we show that TD-VAE training can improve the quality of the belief state. For this experiment, the harmonic oscillator has a different frequency in each interval $[ 0 , 1 0 )$ , [10, 20), [20, 120), [120, 140). The first three frequencies $f _ { 1 } , f _ { 2 } , f _ { 3 }$ are chosen at random. The final frequency $f _ { 4 }$ is chosen to be one fixed value $f _ { a }$ if $f _ { 1 } > f _ { 2 }$ and another fixed value $f _ { b }$ otherwise $f _ { a }$ and $f _ { b }$ are constants). In order to correctly model the signal in the final time interval, the model needs to learn the relation between $f _ { 1 }$ and $f _ { 2 }$ , store it over length of 100 steps, and apply it over a number of time steps (due to the noise) in the final interval. To test whether the belief state contains the information about this relationship, we train a binary classifier from the belief state to the final frequency $f _ { 4 }$ at points just before the final interval. We compare two models with the same recurrent architecture (an LSTM), but trained with different objective: next-step prediction vs TD-VAE loss. The figure on the right shows the classification accuracy for the two methods, averaged over 20 runs. We found that the longer the separating time interval (containing frequency $f _ { 3 }$ ) and the smaller the size of the LSTM, the better TD-VAE is compared to next-step predictor.
161
+
162
+ ![](images/1325d166c2f3f2e0dd2a2c55bc719503180df27d258785063eb9828ca8900b91.jpg)
163
+
164
+ # 5.4 DEEPMIND LAB ENVIRONMENT
165
+
166
+ In the final experiment, we analyze the model on a more visually complex domain. We use sequences of frames seen by an agent solving tasks in the DeepMind Lab environment (Beattie et al., 2016). We aim to demonstrate that the model holds explicit beliefs about various possible futures, and that it can roll out in jumps. We suggest functional forms inspired by convolutional DRAW: we use convolutional LSTMs for all the circles in Figure 8 and make the model 16 layers deep (except for the forward updating LSTMs which are fully connected with depth 4).
167
+
168
+ ![](images/c2368df29b05a7c8e75802a6c6eb94a47da537f30e710de4babea5b8d927c575.jpg)
169
+ Figure 5: Beliefs of the model. Left: Independent samples $z _ { 1 } , z _ { 2 } , z _ { 3 }$ from current belief; all 3 decode to roughly the same frame. Right: Multiple predicted futures for each sample. The frames are similar for each $z _ { i }$ , but different across $z _ { i }$ ’s.
170
+
171
+ ![](images/6b454271ed3815d08a88c90920955f635132ef68517a96471bc60ca8c4378d82.jpg)
172
+ Figure 6: Rollout from the model. The model was trained on steps uniformly distributed in [1, 5]. The model is able to create forward motion that skips several time steps.
173
+
174
+ We use time skips $t _ { 2 } - t _ { 1 }$ sampled uniformly from [1, 40] and analyze the content of the belief state $b$ . We take three samples $z _ { 1 } , z _ { 2 } , z _ { 3 }$ from $p _ { B } ( z \vert b )$ , which should represent three instances of possible futures. Figure 5 (left) shows that they decode to roughly the same frame. To see what they represent about the future, we draw 5 samples $\bar { z _ { i } ^ { k } } \sim p ( \hat { z } | z )$ , $k = 1 , \ldots , 5$ and decode them, as shown in Figure 5 (right). We see that for a given $i$ , the predicted samples decode to similar frames (images in the same row). However $z$ ’s for different $i$ ’s decode to different frames. This means $b$ represented a belief about several different possible futures, while different $z _ { i }$ each represent a single possible future.
175
+
176
+ Finally, we show what rollouts look like. We train on time separations $t _ { 2 } - t _ { 1 }$ chosen uniformly from [1, 5] on a task where the agent tends to move forward and rotate. Figure 6 shows 4 rollouts from the model. We see that the motion appears to go forward and into corridors and that it skips several time steps (real single step motion is slower).
177
+
178
+ # 6 CONCLUSIONS
179
+
180
+ In this paper, we argued that an agent needs a model that is different from an accurate step-by-step environment simulator. We discussed the requirements for such a model, and presented TD-VAE, a sequence model that satisfies all requirements. TD-VAE builds states from observations by bridging time points separated by random intervals. This allows the states to relate to each other directly over longer time stretches and explicitly encode the future. Further, it allows rolling out in state-space and in time steps larger than, and potentially independent of, the underlying temporal environment/data step size. In the future, we aim to apply TD-VAE to more complex settings, and investigate a number of possible uses in reinforcement learning such are representation learning and planning.
181
+
182
+ # REFERENCES
183
+
184
+ Brandon Amos, Laurent Dinh, Serkan Cabi, Thomas Rothörl, Sergio Gómez Colmenarejo, Alistair Muldal, Tom Erez, Yuval Tassa, Nando de Freitas, and Misha Denil. Learning awareness models. arXiv preprint arXiv:1804.06318, 2018.
185
+
186
+ Evan Archer, Il Memming Park, Lars Buesing, John Cunningham, and Liam Paninski. Black box variational inference for state space models. arXiv preprint arXiv:1511.07367, 2015.
187
+
188
+ Karl J Astrom. Optimal control of Markov decision processes with incomplete state estimation. Journal of mathematical analysis and applications, 10:174–205, 1965.
189
+
190
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
191
+
192
+ Justin Bayer and Christian Osendorfer. Learning stochastic recurrent networks. arXiv preprint arXiv:1411.7610, 2014.
193
+
194
+ Charles Beattie, Joel Z Leibo, Denis Teplyashin, Tom Ward, Marcus Wainwright, Heinrich Küttler, Andrew Lefrancq, Simon Green, Víctor Valdés, Amir Sadik, et al. DeepMind Lab. arXiv preprint arXiv:1612.03801, 2016.
195
+
196
+ Marc G Bellemare, Will Dabney, and Rémi Munos. A distributional perspective on reinforcement learning. arXiv preprint arXiv:1707.06887, 2017.
197
+
198
+ Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 1171–1179, 2015.
199
+
200
+ Lars Buesing, Theophane Weber, Sebastien Racaniere, SM Eslami, Danilo Rezende, David P Reichert, Fabio Viola, Frederic Besse, Karol Gregor, Demis Hassabis, et al. Learning and querying fast generative models for reinforcement learning. arXiv preprint arXiv:1802.03006, 2018.
201
+
202
+ Silvia Chiappa, Sébastien Racaniere, Daan Wierstra, and Shakir Mohamed. Recurrent environment simulators. arXiv preprint arXiv:1704.02254, 2017.
203
+
204
+ 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.
205
+
206
+ Junyoung Chung, Sungjin Ahn, and Yoshua Bengio. Hierarchical multiscale recurrent neural networks. arXiv preprint arXiv:1609.01704, 2016.
207
+
208
+ Marco Fraccaro, Søren Kaae Sønderby, Ulrich Paquet, and Ole Winther. Sequential neural models with stochastic layers. In Advances in neural information processing systems, pp. 2199–2207, 2016.
209
+
210
+ Mevlana Gemici, Chia-Chun Hung, Adam Santoro, Greg Wayne, Shakir Mohamed, Danilo J Rezende, David Amos, and Timothy Lillicrap. Generative temporal models with memory. arXiv preprint arXiv:1702.04649, 2017.
211
+
212
+ Anirudh Goyal, Alessandro Sordoni, Marc-Alexandre Côté, Nan Ke, and Yoshua Bengio. Z-forcing: Training stochastic recurrent networks. In Advances in Neural Information Processing Systems, pp. 6713–6723, 2017.
213
+
214
+ Alex Graves. Generating sequences with recurrent neural networks. arXiv preprint arXiv:1308.0850, 2013.
215
+
216
+ Karol Gregor, Frederic Besse, Danilo Jimenez Rezende, Ivo Danihelka, and Daan Wierstra. Towards conceptual compression. In Advances In Neural Information Processing Systems, pp. 3549–3557, 2016.
217
+
218
+ David Ha and Jürgen Schmidhuber. World models. arXiv preprint arXiv:1803.10122, 2018.
219
+
220
+ Milos Hauskrecht. Value-function approximations for partially observable Markov decision processes. Journal of artificial intelligence research, 13:33–94, 2000.
221
+
222
+ Maximilian Igl, Luisa Zintgraf, Tuan Anh Le, Frank Wood, and Shimon Whiteson. Deep variational reinforcement learning for POMDPs. arXiv preprint arXiv:1806.02426, 2018.
223
+
224
+ Dinesh Jayaraman, Frederik Ebert, Alexei A Efros, and Sergey Levine. Time-agnostic prediction: Predicting predictable video frames. arXiv preprint arXiv:1808.07784, 2018.
225
+
226
+ Leslie Pack Kaelbling, Michael L Littman, and Anthony R Cassandra. Planning and acting in partially observable stochastic domains. Artificial intelligence, 101(1-2):99–134, 1998.
227
+
228
+ Nal Kalchbrenner, Aaron van den Oord, Karen Simonyan, Ivo Danihelka, Oriol Vinyals, Alex Graves, and Koray Kavukcuoglu. Video pixel networks. arXiv preprint arXiv:1610.00527, 2016.
229
+
230
+ Diederik P Kingma, Tim Salimans, Rafal Jozefowicz, Xi Chen, Ilya Sutskever, and Max Welling. Improved variational inference with inverse autoregressive flow. In Advances in Neural Information Processing Systems, pp. 4743–4751, 2016.
231
+
232
+ Jan Koutnik, Klaus Greff, Faustino Gomez, and Juergen Schmidhuber. A clockwork RNN. arXiv preprint arXiv:1402.3511, 2014.
233
+
234
+ Rahul G Krishnan, Uri Shalit, and David Sontag. Deep Kalman filters. arXiv preprint arXiv:1511.05121, 2015.
235
+
236
+ Alex Lamb, Anirudh Goyal, Ying Zhang, Saizheng Zhang, Aaron C Courville, and Yoshua Bengio. Professor forcing: A new algorithm for training recurrent networks. In Advances In Neural Information Processing Systems, pp. 4601–4609, 2016.
237
+
238
+ Alex X Lee, Richard Zhang, Frederik Ebert, Pieter Abbeel, Chelsea Finn, and Sergey Levine. Stochastic adversarial video prediction. arXiv preprint arXiv:1804.01523, 2018.
239
+
240
+ Michael L Littman and Richard S Sutton. Predictive representations of state. In Advances in neural information processing systems, pp. 1555–1561, 2002.
241
+
242
+ Hao Liu, Lirong He, Haoli Bai, and Zenglin Xu. Efficient structured inference for stochastic recurrent neural networks. 2017.
243
+
244
+ Alexander Neitz, Giambattista Parascandolo, Stefan Bauer, and Bernhard Schölkopf. Adaptive skip intervals: Temporal abstraction for recurrent dynamical models. arXiv preprint arXiv:1808.04768, 2018.
245
+
246
+ Junhyuk Oh, Xiaoxiao Guo, Honglak Lee, Richard L Lewis, and Satinder Singh. Action-conditional video prediction using deep networks in atari games. In Advances in Neural Information Processing Systems, pp. 2863–2871, 2015.
247
+
248
+ Sébastien Racanière, Théophane Weber, David Reichert, Lars Buesing, Arthur Guez, Danilo Jimenez Rezende, Adrià Puigdomènech Badia, Oriol Vinyals, Nicolas Heess, Yujia Li, et al. Imaginationaugmented agents for deep reinforcement learning. In Advances in Neural Information Processing Systems, pp. 5694–5705, 2017.
249
+
250
+ Antti Rasmus, Mathias Berglund, Mikko Honkala, Harri Valpola, and Tapani Raiko. Semi-supervised learning with ladder networks. In Advances in Neural Information Processing Systems, pp. 3546– 3554, 2015.
251
+
252
+ Iulian Vlad Serban, Alessandro Sordoni, Ryan Lowe, Laurent Charlin, Joelle Pineau, Aaron C Courville, and Yoshua Bengio. A hierarchical latent variable encoder-decoder model for generating dialogues. In AAAI, pp. 3295–3301, 2017.
253
+
254
+ Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction, volume 1. MIT press Cambridge, 1998.
255
+
256
+ Benigno Uria, Marc-Alexandre Côté, Karol Gregor, Iain Murray, and Hugo Larochelle. Neural autoregressive distribution estimation. The Journal of Machine Learning Research, 17(1):7184– 7220, 2016.
257
+
258
+ Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. WaveNet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016a.
259
+
260
+ Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. arXiv preprint arXiv:1601.06759, 2016b.
261
+
262
+ Aaron van den Oord, Yazhe Li, Igor Babuschkin, Karen Simonyan, Oriol Vinyals, Koray Kavukcuoglu, George van den Driessche, Edward Lockhart, Luis C Cobo, Florian Stimberg, et al. Parallel waveNet: Fast high-fidelity speech synthesis. arXiv preprint arXiv:1711.10433, 2017.
263
+
264
+ Arun Venkatraman, Nicholas Rhinehart, Wen Sun, Lerrel Pinto, Martial Hebert, Byron Boots, Kris Kitani, and J Bagnell. Predictive-state decoders: Encoding the future into recurrent networks. In Advances in Neural Information Processing Systems, pp. 1172–1183, 2017.
265
+
266
+ 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.
267
+
268
+ # A TD-VAE AS A MODEL OF JUMPY OBSERVATIONS
269
+
270
+ In section 3, we derive an approximate ELBO which forms the basis of the training loss of the one-step TD-VAE. One may wonder whether a similar idea may underpin the training loss of the jumpy TD-VAE. Here we show how to modify the derivation to provide an approximate ELBO for a slightly different training regime.
271
+
272
+ Assume a sequence $( x _ { 1 } , \dots , x _ { T } )$ , and an arbitrary distribution $S$ over subsequences $\begin{array} { r l } { \mathbf { x } _ { s } } & { { } = } \end{array}$ $( x _ { t _ { 1 } } , \ldots , x _ { t _ { n } } )$ of $\mathbf { x }$ . For each time index $t _ { i }$ , we suppose a state $z _ { t _ { i } }$ , and model the subsequence $\mathbf { x } _ { s }$ with a jumpy state-space model $\begin{array} { r } { p ( \mathbf { x } _ { s } ) = \prod _ { i } p ( \bar { z } _ { t _ { i } } \vert z _ { t _ { i - 1 } } ) p ( x _ { t _ { i } } \vert \bar { z _ { t _ { i } } } ) } \end{array}$ ; denote $\mathbf { z } _ { s } = ( z _ { t _ { 1 } } , \dots , z _ { t _ { n } } )$ the state subsequence. We use the exact same machinery as the next-step ELBO, except that we enrich the posterior distribution over $\mathbf { z } _ { s }$ by making it depend not only on observation subsequence $\mathbf { x } _ { s }$ , but on the entire sequence $\mathbf { x }$ . This is possible because posterior distributions can have arbitrary contexts; the observations which are part of $\mathbf { x }$ but not $\mathbf { x } _ { s }$ effectively serve as auxiliary variable for a stronger posterior. We use the full sequence $\mathbf { x }$ to form a sequence of belief states $b _ { t }$ at all time steps. We use in particular the ones computed at the subsampled times $t _ { i }$ . By following the same derivation as the one-step TD-VAE, we obtain:
273
+
274
+ $$
275
+ \begin{array} { r } { \mathbb { E } _ { S } \left[ \log p ( x _ { t _ { 1 } } , \dots , x _ { t _ { n } } ) \right] \ge \mathbb { E } _ { S } \Bigg [ \sum _ { i } \underset { ( z _ { t _ { i - 1 } } , z _ { t _ { i } } ) \sim q } { \mathbb { E } } \Big [ \log p ( x _ { t _ { i } } \mid z _ { t _ { i } } ) + \log p ( z _ { t _ { i - 1 } } \mid x _ { < t } ) } \\ { + \log p ( z _ { t _ { i } } \mid z _ { t _ { i - 1 } } ) - \log q ( z _ { t _ { i } } \mid x _ { \le t } ) } \\ { - \log q ( z _ { t _ { i - 1 } } \mid z _ { t _ { i } } , x _ { \le t } ) \Big ] \Bigg ] } \end{array}
276
+ $$
277
+
278
+ which, using the same belief approximations as the next step TD-VAE, becomes:
279
+
280
+ $$
281
+ \begin{array} { r l } { - \mathcal { L } = \mathbb { E } _ { S } \Bigg [ \sum _ { i } \underset { z _ { t _ { i - 1 } } \sim q ( z _ { t _ { i - 1 } } | z _ { t _ { i } } , b _ { t _ { i } } , b _ { t _ { i - 1 } } ) } { \mathbb { E } } \Big [ \log p ( x _ { t _ { i } } | z _ { t _ { i } } ) + \log p _ { B } ( z _ { t _ { i - 1 } } | b _ { t _ { i - 1 } } ) + \log p ( z _ { t _ { i } } | z _ { t _ { i - 1 } } ) } \\ { - \log p _ { B } ( z _ { t _ { i } } | b _ { t _ { i } } ) - \log p ( z _ { t _ { i - 1 } } | z _ { t _ { i } } , b _ { t _ { i - 1 } } , b _ { t _ { i } } ) \Big ] \Bigg ] ~ } & { } \end{array}
282
+ $$
283
+
284
+ which is the same loss as the TD-VAE for a particular choice of the sampling scheme $S$ (only sampling pairs).
285
+
286
+ # B DERIVATION OF THE TD-VAE MODEL FROM ITS DESIRED PROPERTIES
287
+
288
+ In this section we start with a general recurrent variational auto-encoder and consider how the desired properties detailed in sections 1 and 2 constrain the architecture. We will find that these constraints in fact naturally lead to the TD-VAE model.
289
+
290
+ Let us first consider a relatively general form of temporal variational auto-encoder. We consider recurrent models where the same module is applied at every step, and where outputs are sampled one at a time (so that arbitrarily long sequences can be generated). A very general form of such an architecture consist of forward-backward encoder RNNs and a forward decoder RNN (Figure 7) but otherwise allowing for all the connections. Several works (Chung et al., 2015; Lee et al., 2018; Archer et al., 2015; Fraccaro et al., 2016; Liu et al., 2017; Goyal et al., 2017; Buesing et al., 2018; Serban et al., 2017) fall into this framework.
291
+
292
+ Now let us consider our desired properties.
293
+
294
+ In order to sample forward in latent space, the encoder must not feed into the decoder or the prior of the latent variables, since observations are required to compute the encoded state, and we would therefore require the sampled observations to compute the distribution over future states and observations.
295
+
296
+ We next consider the constraint of computing a belief state $b _ { t }$ . The belief state $b _ { t }$ represents the state of knowledge up to time $t$ , and therefore cannot receive an input from the backwards decoder.
297
+
298
+ ![](images/9ccde79a74da241a8322e4e748872ad717f7306801af6ff0c458d4e963711a9f.jpg)
299
+ Figure 7: Recurrent variational auto-encoder. General recurrent variational auto-encoder, obtained by imposing recurrent structure, forward sampling and allowing all potential connections. Note that the encoder can have several alternating layers of forward and backward RNNs. Also note that the connection 1 has to be absent if the backwards encoder is used. Possible skip connections are not shown as they can directly be implemented in the RNN weights. If connections 2 are absent, the model is capable of forward sampling in latent space without going back to observations.
300
+
301
+ Furthermore, $b _ { t }$ should have an unrestricted access to information; it should ideally not be disturbed by sampling (two identical agents with the same information should compute the same information; this will not be the case if the computation involves sampling), nor go through information bottlenecks. This suggests using the forward encoder for computing the belief state.
302
+
303
+ Given the use of a decoder RNN, the information needed to predict the future could be stored in the decoder state, which may prevent the encoder from storing the full state information (in other words, the information contained in $x _ { 1 } , \ldots , x _ { t + 1 }$ about the state $z _ { t + 1 }$ could be partially stored in the decoder state and previous sample $z _ { t }$ ). This presents two options: the first is to make the prior $p ( z _ { t + 1 } | . )$ and the reconstruction $p ( x _ { t } | . )$ depend only on $z _ { t }$ , i.e. to only consider distributions $p ( z _ { t + 1 } \mid z _ { t } )$ and $p ( x _ { t } \mid z _ { t } )$ . The second is to include the decoder state in the belief state (together with the encoder state). We will choose the former option, as we our next constraint will invalidate the latter option.
304
+
305
+ Next, we argue that smoothing, or the dependence of posterior on the future, is an important property that should be part of our model. As an example, imagine a box that can contain two items $A$ and $B$ and two time points: $t _ { 1 }$ before opening the box, when we don’t know the content of the box, and $t _ { 2 }$ after opening it. We would want our latent variable to represent the content of the box. The perfect model of the content of the box is that the content doesn’t change (the same object is in the box before and after opening it). Now imagine $B$ is in the box. Our belief at $t _ { 2 }$ is high for $B$ but our belief at $t _ { 1 }$ is uncertain. If we sample this belief at $t _ { 1 }$ without considering $t _ { 2 }$ we would sample $A$ half of the time. However, then we would be learning a wrong model of the world: that $A$ goes to $B$ . To solve this problem, we should sample $t _ { 2 }$ first and then, given this value, sample $t _ { 1 }$ .
306
+
307
+ Smoothing requires the use of the backward encoder; this prevents the use of the decoder state as part of our belief state, since the decoder has access to the encoder, and the encoder depends on the future. We therefore require a latent-to-latent model $p ( z _ { t + 1 } \mid z _ { t } )$ .
308
+
309
+ We are therefore left with a forward encoder which ideally computes the belief state, a backwards encoder which - with the forward encoder - compute posteriors over states, and a state-to-state forward model. The training of the backwards encoder will be induced by its use as a posterior in the state-space model. How do then make sure the forward encoder is in fact trained to contain the belief state? To do so, we will force $p _ { B } ( z _ { t } \vert b _ { t } )$ to be close to the posterior by using a KL term between prior belief and posterior belief.
310
+
311
+ Before detailing the KL term, we need to consider how to practically run the backwards decoder.
312
+ Ideally, we would like to train the model in a nearly forward fashion, for arbitrary long sequences.
313
+
314
+ ![](images/cb25367ac7f23c0a12965cc2611fb51ea98660e1d19d401afae0641866433420.jpg)
315
+ Figure 8: Deep version of the model from Figure 1. A deep version of the model is formed by creating a layer similar to the shallow model of Figure 1 and replicating it. Both sampling and inference proceed downwards through the layers. Circles have the same meaning as in Figure 1 and are implemented using neural networks, such as LSTMs.
316
+
317
+ This prevents running the backwards inference from the end of the sequence. However if we assume that $p _ { B }$ represents our best belief about the future, we can take a sample from it as an instance of the future: $z _ { t _ { 2 } } \sim p _ { B } ( z _ { t _ { 2 } } | b _ { t _ { 2 } } )$ . It forms a type of bootstrap information. Then we can go backwards and infer what would the world have looked like given this future (e.g. the object $B$ was still in the box even if we don’t see it). Using VAE training, we sample $z _ { 1 }$ from its posterior $q ( z _ { t _ { 1 } } | z _ { t _ { 2 } } , b _ { t _ { 2 } } , b _ { t _ { 1 } } )$ (the conditioning variables are the ones we have available locally), using $p _ { B } ( z _ { t _ { 1 } } | b _ { t _ { 1 } } )$ as prior. Conversely, for $t _ { 2 }$ , we sample from $p _ { B } ( z _ { t _ { 2 } } | b _ { t _ { 2 } } )$ as posterior, but with $p \big ( \boldsymbol { z } _ { t _ { 2 } } \big | \boldsymbol { z } _ { t _ { 1 } } \big )$ as prior. We therefore obtain the VAE losses $\log q ( z _ { 1 } | z _ { 2 } , s _ { 1 } , s _ { 2 } ) - \log p _ { B } ( z _ { 1 } | s _ { 1 } )$ at $t _ { 1 }$ and $\log p _ { B } ( z _ { 2 } | s _ { 2 } ) - \log p _ { P } ( z _ { 2 } | z _ { 1 } )$ at $t _ { 2 }$ . In addition we have the reconstruction term $p _ { D } ( x _ { 2 } | z _ { 2 } )$ that grounds the latent in the input. The whole algorithm is presented in the Figure 1.
318
+
319
+ # C HIERARCHICAL MODEL
320
+
321
+ In the main paper we detailed a framework for learning models by bridging two temporally separated time points. It would be desirable to model the world with different hierarchies of state, the higherlevel states predicting the same-level or lower-level states, and ideally representing more invariant or abstract information. In this section we describe a stacked (hierarchical) version of the model.
322
+
323
+ The first part to extend to $L$ layers is the RNN that aggregates observations to produce the belief state $b$ . Here we simply use a deep LSTM, but with layer $l$ receiving inputs also from layer $l + 1$ from the previous time step. This is so that the higher layers can influence the lower ones (and vice versa). For $l = 1 , \ldots , L$ :
324
+
325
+ $$
326
+ b _ { t } ^ { l } = \mathrm { R N N } ( b _ { t } ^ { l } , b _ { t } ^ { l - 1 } , b _ { t - 1 } ^ { l + 1 } , \boldsymbol { x } _ { t } )
327
+ $$
328
+
329
+ and setting $b _ { 0 } = b _ { L }$ and $b _ { L + 1 } = \emptyset$ .
330
+
331
+ We create a deep version of the belief part of the model by stacking the shallow one, as shown in Figure 8. In the usual spirit of deep directed models, the model samples downwards, generating higher level representations before the lower level ones (closer to pixels). The model implements deep inference, that is, the posterior distribution of one layer depends on the samples from the posterior distribution in previously sampled layers. The order of inference is a design choice, and we use the same direction as that of generation, from higher to lower layers, as done for example by Gregor et al. (2016); Kingma et al. (2016); Rasmus et al. (2015). We implement the dependence of various distributions on latent variables sampled so far using a recurrent neural network that summarizes all such variables (in a given group of distributions). We don’t share the weights between different layers. Given these choices, we can allow all connections consistent with the model. Next we describe the functional forms used in our model.
332
+
333
+ # D FUNCTIONAL FORMS AND PARAMETER CHOICES
334
+
335
+ Here we describe the functional forms used in more detail. We start with those used for the harmonic oscillator experiments. Let $x _ { t }$ , $t = 1 , \dots , T$ be the input sequence. The belief state network (both is a standard LSTM network: $b _ { t } , c _ { t } = \mathrm { L S T M } ( x _ { t } , b _ { t - 1 } , c _ { t - 1 } )$ . For any arbitrary context $x$ , we denote $D$ the map from $x$ to a normal distribution with mean $\mu ( x )$ and log-standard deviation $\log \sigma ( x )$ , where $[ \mu , \log { \sigma } ] = W _ { 3 } \operatorname { t a n h } ( W _ { 1 } x + B _ { 1 } ) \sigma ( W _ { 2 } x + B _ { 2 } ) + B _ { 3 } $ , with $W _ { 1 } , W _ { 2 } , W _ { 3 }$ as weight matrices and $B _ { 1 } , B _ { 2 } , B _ { 3 }$ as biases. We use the letter $D$ for all such maps (even when they don’t share weights); weights are shared if the contexts are identical except for the time index. Consider the update for a given pair of time points $t _ { 1 } < t _ { 2 }$ . We use a two-layer hierarchical TD-VAE. A variable $v$ at layer $l$ and time $t$ is denoted $\mathbf { \widehat { v } } _ { t } ^ { l }$ . Beliefs are time $t _ { 1 }$ and $t _ { 2 }$ are denoted $b _ { t _ { 1 } } , b _ { t _ { 2 } }$ . The set of equations describing the system are as follows.
336
+
337
+ $$
338
+ \begin{array} { r l } { \frac { 1 } { 2 } } & { { } = \frac { \lambda _ { 1 } } { 3 } - \frac { \lambda _ { 2 } } { 3 } - \mathcal { B } \xi _ { 2 } , } \\ { \frac { 1 } { 2 } } & { { } = \frac { \lambda _ { 2 } } { 3 } - \frac { \lambda _ { 3 } } { 3 } - \mathcal { B } \xi _ { 2 } , } \\ { \frac { 1 } { 2 } } & { { } = \frac { \lambda _ { 1 } } { 3 } - \frac { \lambda _ { 2 } } { 3 } - \frac { \lambda _ { 3 } } { 3 } - \frac { \lambda _ { 3 } } { 3 } } \\ { \frac { 1 } { 2 } } & { { } = \frac { \lambda _ { 2 } } { 3 } - \frac { \lambda _ { 3 } } { 3 } - \frac { \lambda _ { 3 } } { 3 } } \\ { \frac { 1 } { 2 } } & { { } = \frac { \lambda _ { 1 } } { 3 } - \frac { \lambda _ { 2 } } { 3 } - \frac { \lambda _ { 3 } } { 3 } } \\ { \frac { 1 } { 2 } } & { { } = \frac { \lambda _ { 2 } } { 3 } - \frac { \lambda _ { 3 } } { 3 } - \frac { \lambda _ { 3 } } { 3 } } \\ { \frac { 1 } { 2 } } & { { } = \frac { \lambda _ { 1 } } { 3 } - \frac { \lambda _ { 2 } } { 3 } - \frac { \lambda _ { 3 } } { 3 } } \\ { \frac { 1 } { 2 } } & { { } = \frac { \lambda _ { 2 } } { 3 } - \frac { \lambda _ { 3 } } { 3 } - \frac { \lambda _ { 3 } } { 3 } } \\ { \frac { 1 } { 2 } } & { { } = \frac { \lambda _ { 1 } } { 3 } - \frac { \lambda _ { 2 } } { 3 } } \\ { \frac { 1 } { 2 } } & { { } = \frac { \lambda _ { 1 } } { 3 } - \frac { \lambda _ { 2 } } { 3 } } \\ { \frac { 1 } { 2 } } & { { } = \frac { \lambda _ { 2 } } { 3 } - \frac { \lambda _ { 3 } } { 3 } } \\ { \frac { 1 } { 2 } } & { { } = \frac { \lambda _ { 1 } } { 3 } - \frac { \lambda _ { 2 } } { 3 } } \\ { \frac { 1 } { 2 } } & { { } = \frac { \lambda _ { 1 } } { 3 } - \frac { \lambda _ { 2 } } { 3 } } \\ { \frac { 1 } { 2 } } & \end{array}
339
+ $$
340
+
341
+ The hidden layer of the $D$ maps is 50; the size of each $z _ { t } ^ { l }$ is 8. Belief states have size 50. We use the Adam optimizer with learning rate 0.0005.
342
+
343
+ The same network works for the MNIST experiment with the following modifications. Observations are pre-processed by a two hidden layer MLP with ReLU nonlinearity. The decoder $p _ { D }$ also have a two layer MLP, which outputs the logits of a Bernoulli distribution. $\delta _ { t }$ was not passed as input to any network.
344
+
345
+ For the DeepMind Lab experiments, all the circles in Figure 8 are LSTMs. Blue circles are fully connected LSTM, the others are all convolutional LSTM. We use a fully connected LSTM of size 512 and convolutional layers of size $4 \times 4 \times 2 5 6$ . All kernel sizes are $3 \times 3$ . The decoder layer has an extra canvas layer, similar to DRAW.
md/train/SJgaRA4FPH/SJgaRA4FPH.md ADDED
@@ -0,0 +1,470 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GENERATIVE MODELS FOR EFFECTIVE ML ON PRIVATE, DECENTRALIZED DATASETS
2
+
3
+ H. Brendan McMahan Google Inc. mcmahan@google.com
4
+
5
+ Sean Augenstein
6
+ Google Inc.
7
+ saugenst@google.com Daniel Ramage
8
+ Google Inc.
9
+ dramage@google.com
10
+
11
+ Swaroop Ramaswamy Google Inc. swaroopram@google.com
12
+
13
+ Peter Kairouz
14
+ Google Inc.
15
+ kairouz@google.com Mingqing Chen
16
+ Google Inc.
17
+ mingqing@google.com Rajiv Mathews
18
+ Google Inc.
19
+ mathews@google.com
20
+
21
+ Blaise Aguera y Arcas Google Inc. blaisea@google.com
22
+
23
+ # ABSTRACT
24
+
25
+ To improve real-world applications of machine learning, experienced modelers develop intuition about their datasets, their models, and how the two interact. Manual inspection of raw data—of representative samples, of outliers, of misclassifications—is an essential tool in a) identifying and fixing problems in the data, b) generating new modeling hypotheses, and c) assigning or refining human-provided labels. However, manual data inspection is problematic for privacy-sensitive datasets, such as those representing the behavior of realworld individuals. Furthermore, manual data inspection is impossible in the increasingly important setting of federated learning, where raw examples are stored at the edge and the modeler may only access aggregated outputs such as metrics or model parameters. This paper demonstrates that generative models—trained using federated methods and with formal differential privacy guarantees—can be used effectively to debug many commonly occurring data issues even when the data cannot be directly inspected. We explore these methods in applications to text with differentially private federated RNNs and to images using a novel algorithm for differentially private federated GANs.
26
+
27
+ # 1 INTRODUCTION
28
+
29
+ Real-world systems increasingly depend on machine learning (ML) to make decisions, detect anomalies, and power products. Applications ranging from fraud detection to mobile phone keyboards use models trained on data that may be privacy sensitive. The data may contain financial, medical, or behavioral information about individuals. Institutions responsible for these applications of ML must balance data stewardship obligations—including minimizing the risks of data loss, theft, or abuse—with the practical needs of the “modeler” whose job is to develop and improve the machine learned models.
30
+
31
+ Modelers working with privacy-sensitive data face significant challenges in model development and debugging. Often, a modeler’s first step would be to inspect individual examples in order to discover bugs, generate hypotheses, improve labeling, or similar. But direct inspection of data may be audited or disallowed by policy in some settings. In other settings—including federated learning (FL) (McMahan & Ramage, 2017;
32
+
33
+ McMahan et al., 2017), which is the motivation and focus of this work—the data cannot be inspected. In FL, raw data remains distributed across a fleet of devices, such as mobile phones, while an orchestrating server coordinates training of a shared global model. Only the final model parameters and statistics are gathered and made available to the modeler. 1
34
+
35
+ How can a modeler effectively debug when training data is privacy sensitive or decentralized? This paper demonstrates that the novel application of auxiliary models, namely privacy-preserving generative models, can stand in for direct data examination during the process of debugging data errors during inference or training. By combining ideas from deep generative models, FL, and user-level differential privacy (DP), we show how some needs traditionally met with data inspection can instead be met by generating synthetic examples from a privacy-preserving federated generative model. These examples could be representative of all or a subset of the non-inspectable data, while at the same time preserving the privacy of individuals. Our contributions include:
36
+
37
+ • Identifying key challenges in implementing end-to-end workflows with non-inspectable data, e.g.,
38
+ for debugging a ‘primary’ ML model used in a mobile application.
39
+ • Proposing a methodology that allows (sufficiently powerful) ‘auxiliary’ generative models to resolve these challenges.
40
+ • Demonstrating how privacy preserving federated generative models—RNNs for text and GANs for images—can be trained to high enough fidelity to discover introduced data errors matching those encountered in real world scenarios. This requires a novel adaption of generative adversarial networks (GANs) to the federated setting with user-level DP guarantees.
41
+
42
+ # 2 CHALLENGES OF ML ON NON-INSPECTABLE DATA
43
+
44
+ A key aspect of deep learning is the utilization of large datasets. The behavior of a deep network is tightly coupled to the data it trains on. As Sculley et al. (2015) puts it, “ML is required in exactly those cases when the desired behavior cannot be effectively expressed in software logic without dependency on external data.” The centrality of data to ML performance is recognized in the attention paid to data analysis, curation, and debugging. Textbooks devote chapters to methodologies for “Determining Whether to Gather More Data” (Goodfellow et al., 2016). The literature conveys practical lessons learned on ML system anti-patterns that increase the chance of data processing bugs (Sculley et al., 2015). In general, an assumption of unfettered access to training or inference data is made (Riley, 2016; Zinkevich, 2017; Chakarov et al., 2016). What to do if direct access is precluded, e.g., if working with private and decentralized data, is largely unaddressed.
45
+
46
+ Below, we describe six common tasks (T1–T6, summarized in Table 1) where a modeler would typically use direct data access. Our choice of these tasks is validated by Humbatova et al. (2019), a recent survey providing a taxonomy of faults in deep learning systems. Two of the largest classes of faults are in ‘Preprocessing of Training Data’ and ‘Training Data Quality’; T1–T6 are manners of addressing these faults.
47
+
48
+ Sanity checking and model debugging (T1–T4) Experienced modelers will often inspect some random examples and observe their properties before training a model (T1); or if this step is skipped, it is often a first step in debugging. Are the size, data types, and value ranges as expected? For text data, are words or word pieces being properly separated and tokenized? A modeler is often working to identify mistakes in upstream processing, affecting all or most data, and readily apparent by looking at one or a few input samples.
49
+
50
+ When a model is misbehaving, looking at a particular subset of the input data is natural. For example, in a classification task, a modeler might inspect misclassified examples to look for issues in the features or labels (T2). For tasks where the full set of possible labels is too large, e.g. a language model with a fixed vocabulary, the modeler might examine a sample of out-of-vocabulary words (T3). For production ML applications, it is often important to monitor not only overall accuracy, but accuracy over finer grained slices of the data — for example, by country, by class label, by time of day, etc.2 If low accuracy is observed on such a slice, it is natural to examine examples selected from that segment of the data (T4). For example, if training on data which can be grouped by user, it is natural (but potentially problematic from a privacy perspective) to look at data from users with low overall accuracy.
51
+
52
+ Table 1: ML modeler tasks typically accomplished via data inspection. In Section 2.1 we observe that selection criteria can be applied programmatically to train generative models able to address these tasks.
53
+
54
+ <table><tr><td colspan="2">Task</td><td>Selection criteria for data to inspect</td></tr><tr><td>T1</td><td>Sanity checking data</td><td>Random training examples</td></tr><tr><td>T2</td><td>Debugging mistakes</td><td>Misclassified examples (by the primary classifer)</td></tr><tr><td>T3</td><td>Debugging unknown labels/classes,l e.g. out-of-vocabulary words</td><td>Examples of the unknown labels/classes</td></tr><tr><td>T4</td><td>certain classes/slices/users</td><td>Debugging poor performance onExamples from the low-accuracy classes/slices/users</td></tr><tr><td>T5</td><td>Human labeling of examples</td><td>Unlabeled examples from the training distribution</td></tr><tr><td>T6</td><td>Detecting bias in the training data</td><td>Examples with high density in the serving distribution but low density in the training distribution.</td></tr></table>
55
+
56
+ Data labeling (T5) Supervised learning problems require labeled data. Often in FL, labels can be inferred naturally from context on device—for example, the next-word predictor in a keyboard app (e.g., as in Hard et al. (2018)) is a problem where the input is a sequence of words and the label is the subsequent word. But some supervised learning problems are better suited to human raters inspecting and manually assigning class labels (e.g., visual object recognition datasets as in Deng et al. (2009)). Because FL systems do not allow users’ data to be sent to the cloud for labeling, it would be desirable to synthesize realistic, representative examples from the decentralized data that could be labeled by human raters. Doing so would require a private mechanism of generating high-fidelity training examples. This would expand the set of ML problems that can be afforded FL’s privacy advantages.
57
+
58
+ Detecting bias in training data (T6) Another common use of human raters in supervised learning is to assign labels to non-privacy-sensitive training examples curated from a public dataset or collected via donation. These examples might be the only ones a classifier is trained on, even if a much larger unlabeled dataset exists (e.g. on phones in FL). The distributional difference between the datasets is a source of bias. For example, a labeled training dataset for a face detector might not be representative of the diversity of racial/ethnic/gender/age classes that the face detector sees through a phone’s camera (i.e., at serving time). These classes can be unrelated to the model’s task but serve as a confounding factor in prediction if the model has erroneously fit an assumption about them during training (e.g., a smiling face detector that judges smiling vs. non-smiling based on gender or gender expression (Denton et al., 2019)). When entire groups are unor underrepresented in training, the result can be biased predictions that induce quite insidious social effects (Angwin et al., 2016). Modelers’ goals of building unbiased classifiers could be met by inspecting examples of classes missing at training but present at prediction time. These examples—even at low fidelity—could indicate whether a model is fair and point to where additional training data collection is required.
59
+
60
+ 2.1 USING GENERATIVE MODELS INSTEAD OF DATA INSPECTION
61
+
62
+ The general methodology for using generative models in place of data inspection is as follows: in a situation where the modeler would otherwise inspect examples based on a particular criteria (as shown in Table 1), this criteria is expressed as a programmatic data selection procedure used to construct a training dataset for a generative model. In the case of FL specifically, this might involve both selecting only a subset of devices to train the model, as well as filtering the local dataset held on each device.
63
+
64
+ We conduct experiments for three such tasks in this paper. Section 5 considers T3, and shows how the methodology proposed here can be extended when the primary model is itself a generative model. We conduct experiments for T2 and T4 in Section 6, where both approaches provide alternative ways of discovering the same bug; results for the T4 approach are presented in the main body, with T2 results appearing in the Appendix. We chose these scenarios as being representative of a large class of data-related ML bugs, based on real-world experience in both industry and academic settings. Independently, Humbatova et al. (2019) identifies ‘text segmentation’ and ‘pixel encoding’ as being very common sources of bugs. By showing that privacy-preserving federated generative models can debug these scenarios, we demonstrate the applicability of the approach. One of the reasons we select these scenarios is that high-fidelity generation is not necessary to detect these bugs, and pushing the state-of-the-art in generative models is not the aim of this work.
65
+
66
+ In contrast, for some classes of bugs, as well for generating examples used for labeling and training (T5), high-fidelity private generative models are necessary. We hope that this work will serve as a call-to-action for the generative modeling community, as our work strongly suggests that these models have a fundamental role to play in enabling the widespread use of privacy-preserving ML workflows.
67
+
68
+ Task T6 requires a more subtle approach in defining the selection criteria. We briefly describe possible approaches in the spirit of providing a more complete description of the uses of generative models in private ML workflows, but leave details and experiments as promising directions for future work. Suppose we have a public, centralized distribution $\mathcal { P } _ { \mathrm { p u b l i c } }$ as well as a private, decentralized distribution $\mathcal { P } _ { \mathrm { p r i v a t e } }$ . Informally, we might wish to generate examples according to $x \sim { \frac { { \mathcal { P } } _ { \mathrm { p r i v a t e } } ( x ) } { { \mathcal { P } } _ { \mathrm { p u b l i c } } ( x ) } }$ or perhaps $x \sim \mathcal { P } _ { \mathrm { p r i v a t e } } ( x \mid \mathcal { P } _ { \mathrm { p u b l i c } } ( x ) \leq \epsilon )$ . If we have a family of generative models for the domain of $x$ that explicitly provide a likelihood (e.g., the language models we consider in Section 5), then we can first train such a generative model on $\mathcal { P } _ { \mathrm { p u b l i c } }$ , and use this to filter or re-weight the decentralized samples drawn from $\mathcal { P } _ { \mathrm { p r i v a t e } }$ to train a second generative model which will be used to generate samples representative of $\mathcal { P } _ { \mathrm { p r i v a t e } }$ but not $\mathcal { P } _ { \mathrm { p u b l i c } }$ . In the case of architectures that do not provide an explicit likelihood (e.g., GANs), alternative techiques are needed, for example a secondary discriminator used to differentiate samples from $\mathcal { P } _ { \mathrm { p r i v a t e } }$ from those from $\mathcal { P } _ { \mathrm { p u b l i c } }$ .
69
+
70
+ Of course, if any of the generative models used here simply reproduce the private examples of users, nothing has been gained. Hence, we next turn to training these models with strong privacy guarantees.
71
+
72
+ # 3 DIFFERENTIALLY PRIVATE FEDERATED GENERATIVE MODELS
73
+
74
+ To implement the approach of Section 2.1, we propose combining three technologies: generative models, federated learning (FL), and differential privacy (DP). Deep generative models can synthesize novel examples, FL can train and evaluate against distributed data, and FL and DP both afford user privacy protections.
75
+
76
+ Critically, none of the challenges presented require the inspection of any particular user’s data. As with ML, the goal is to discover something broadly meaningful. Thus, it is natural to consider the use of suitable synthetic examples in lieu of real user data. For this, we can leverage generative models based on deep neural networks (or ‘deep generative models’). In contrast to discriminative models, generative models learn a joint distribution $p ( x , y )$ and can be applied to data synthesis. Such neural networks can either approximate a likelihood function or serve as a mechanism for drawing samples (i.e., an implicit distribution). Deep generative models of various forms (Kingma & Welling, 2013; Goodfellow et al., 2014; Kumar et al., 2019; Radford et al., 2019) have garnered a considerable amount of research interest, particularly for high dimensional spaces where explicit modeling is intractable. Application domains include text, audio, and imagery.
77
+
78
+ To work with decentralized data, we train these generative models via FL, ensuring raw user data never leaves the edge device. Instead, a randomly chosen subset of devices download the current model, and each locally computes a model update based on their own data. Ephemeral model updates are then sent back to the coordinating server, where they are aggregated and used to update the global model. This process repeats over many rounds until the model converges (for more information, see McMahan et al. (2017) and Bonawitz et al. (2019)). FL is borne of the mobile domain, where privacy is paramount and data is decentralized. Privacy for the mobile domain is a major motivator for this work, and we’ll use FL extensively in this paper.
79
+
80
+ As with other ML models, deep generative models have a tendency to memorize unique training examples, leading to a valid concern that they may leak personal information. Differential privacy is a powerful tool for preventing such memorization. In particular, in this paper we’ll emphasize the use of user-level DP, obtained in the FL context via a combination of per-user update clipping and post-aggregation Gaussian noising, following McMahan et al. (2018); Appendix A reviews user-level DP and FL. We assume this mechanism is implemented by the FL infrastructure, before the modeler has access to the trained models. This approach bounds the privacy loss to both the modeler and the devices that participate in FL rounds. In our experiments, we quantify the privacy obtained using $( \epsilon , \delta )$ upper bounds.
81
+
82
+ # 4 RELATED WORK
83
+
84
+ Prior work has looked at training GANs with DP in a centralized setting (Torkzadehmahani et al., 2019; Xie et al., 2018; Zhang et al., 2018; Frigerio et al., 2019; Beaulieu-Jones et al., 2018; Esteban et al., 2017). The focus is on how privacy protections like DP can be leveraged to quantifiably guarantee that a GAN will not synthesis examples too similar to real data. However, this work does not apply to training on decentralized data with FL, nor does it consider user-level DP guarantees, both of which are critical for our applications.
85
+
86
+ Other work studies generative models for decentralized data problems, but without privacy protections. An example is training GANs (Hardy et al., 2018) on decentralized data across multiple data centers. We consider this conceptually distant from the topic of this paper, where user-level privacy protection is paramount.
87
+
88
+ Two recent papers focus on what could be considered as specific instances of generative FL-based tasks, without connecting those instances to a much larger class of workflows on decentralized data in need of a general solution (i.e., all of T1-T6 from Table 1). First, the FedGP algorithm of Triastcyn & Faltings (2019) is an approach to building a federated data synthesis engine based on GANs, to address a specific task resembling T5. Where we use DP as our means of measuring and protecting against data release (providing a worst-case bound on privacy loss), FedGP adopts a weaker, empirical measure of privacy (specifically, differential average-case privacy) which has not yet been broadly accepted by the privacy community. Second, recent language modeling work in Chen et al. (2019) uses a character-level RNN trained via FL to perform the T3 task of generating common out-of-vocabulary (OOV) words (i.e., words that fall outside a finite vocabulary set). OOVs are interesting to the language modeler as they reflect natural temporal changes in word usage frequency (e.g., new slang terms, names in the news, etc.) that should be tracked. Their work does not apply DP. We adopt this OOV model for debugging purposes (and add DP) in experiments in Section 5.
89
+
90
+ # 5 AN APPLICATION TO DEBUGGING DURING TRAINING WITH RNNS
91
+
92
+ DP Federated RNNs for Generating Natural Language Data Recurrent Neural Networks (RNNs) are a ubiquitous form of deep network, used to learn sequential content (e.g., language modeling). An interesting property of RNNs is that they embody both discriminative and generative behaviors in a single model. With
93
+
94
+ ![](images/692ae6af2ecd6aa0763a73ab60b5b325fcba146e3595222b204986dc120114bc.jpg)
95
+ Figure 1: Percentage of samples generated from the word-LM that are OOV by position in the sentence, with and without bug.
96
+
97
+ Table 2: Top 10 generated OOV words by joint character probability (computed using Equation 1), with and without the bug. Number accompanying is joint probability. The model is trained with case-insensitive tokenization.
98
+
99
+ <table><tr><td>Without bug (prob 10-3)</td><td>With 10% bug (prob 10-3)</td><td></td></tr><tr><td>regex</td><td>5.50</td><td>i have 8.08</td></tr><tr><td>jsfiddle</td><td>3.90</td><td>iam 5.60</td></tr><tr><td>xcode</td><td>3.12</td><td>regex 4.45</td></tr><tr><td>divs</td><td>2.75</td><td>you can 3.71</td></tr><tr><td>stackoverflow</td><td>2.75</td><td>if you 2.81</td></tr><tr><td>listview</td><td>2.74</td><td>this is 2.77</td></tr><tr><td>textbox</td><td>2.73</td><td>here is 2.73</td></tr><tr><td>foreach</td><td>2.34</td><td>jsfiddle 2.70</td></tr><tr><td>async</td><td>2.27</td><td>iwant 2.39</td></tr><tr><td>iis</td><td>2.21</td><td>textbox 2.28</td></tr></table>
100
+
101
+ regards to the former, an RNN learns a conditional distribution $p ( x _ { i + 1 } | x _ { i } , \dots , x _ { 0 } ; D )$ . Given a sequence of tokens $x _ { 0 } , \ldots , x _ { i }$ and their successor $x _ { i + 1 }$ , the RNN reports the probability of $x _ { i + 1 }$ conditioned on its predecessors (based on observing dataset $D$ ). Typically, $x _ { 0 }$ is a special ‘beginning-of-sequence’ token.
102
+
103
+ But an RNN is also a generative model: the successor token probability distribution can be sampled from to generate a next token, and this process can be repeated to generate additional tokens in the sequence. The repeated application of the RNN provides a sample from the following joint distribution:
104
+
105
+ $$
106
+ p ( x _ { n } , x _ { n - 1 } , \ldots , x _ { 2 } , x _ { 1 } , x _ { 0 } | D ) = \prod _ { i = 0 } ^ { n - 1 } p ( x _ { i + 1 } | x _ { i } , \ldots , x _ { 0 } ; D ) \cdot p ( x _ { 0 } | D )
107
+ $$
108
+
109
+ In this way, RNN word language models (word-LMs) can generate sentences and RNN character language models (char-LMs) can generate words. Training an RNN under FL and DP can be performed via the DP-FedAvg algorithm of McMahan et al. (2018), restated in Appendix A, Algorithm 2.
110
+
111
+ Experiment Consider a mobile keyboard app that uses a word-LM to offer next-word predictions to users based on previous words. The app takes as input raw text, performs preprocessing (e.g. tokenization and normalization), and then feeds the processed list of words as input to the word-LM. The word-LM has a fixed vocabulary of words $V$ . Any words in the input outside of this vocabulary are marked as ‘out-of-vocabulary’ (OOV). Such word-LMs have been trained on-device via FL (Hard et al., 2018). We demonstrate how we can detect a bug in the training pipeline for the word-LM using DP federated RNNs.
112
+
113
+ Suppose a bug is introduced in tokenization which incorrectly concatenates the first two tokens in some sentences into one token. E.g., ‘Good day to you.’ is tokenized into a list of words as [‘Good day’, $\mathrm { ~ \Psi ~ } ^ { \bullet } \mathrm { t o } ^ { \prime } , \ldots ] ,$ , instead of [‘Good’, ‘day’, ‘to’, . . . ]. Such issues are not uncommon in production natural language processing (NLP) systems. Because these concatenated tokens don’t match words in vocabulary $V$ , they will be marked as OOVs. Under normal circumstances OOVs occur at a relatively consistent rate, so this bug will be noticed via a spike in OOV frequency, a metric an NLP modeler would typically track (see Appendix B). Were this the cloud, some of the OOV tokens could be inspected, and the erroneous concatenation realized. But here the dataset is private and decentralized, so inspection is precluded.
114
+
115
+ We simulate the scenario using a dataset derived from Stack Overflow questions and answers (hosted by TensorFlow Federated (Ingerman & Ostrowski, 2019)). It provides a realistic proxy for federated data, since we can associate all posts by an author as a particular user (see Appendix B.1 for details). We artificially introduce the bug in the dataset by concatenating the first two tokens in $10 \%$ of all sentences, across users.
116
+
117
+ Two federated generative models are used in complementary fashion for debugging. The first is the ‘primary’ model, the DP word-LM that is being trained via FL for use in the next word prediction pipeline. While the bug is inhibiting its training for production use, we can still harness its generative properties for insight into the nature of the bug. The second is an ‘auxiliary’ model for T3, a DP char-LM trained only on OOV words in the dataset; this model is taken from Chen et al. (2019), but here our goal is debugging, not learning new words. We assume we have access to both the word-LM and char-LM trained before the bug was introduced, as well as both models trained on buggy data. Continuous training of auxiliary models is beneficial in a production workflow, to contrast output of models trained at different times or on different selection criteria.
118
+
119
+ Both the DP word- and char-LMs are trained independently via simulated FL (following the approach of McMahan et al. (2018)) on the bug-augmented and bug-free Stack Overflow dataset, producing four trained models in total. These models are now used to synthesize useful and complementary information about the pipeline’s input data. From Figure 1, we notice that with the bug the sentences generated by the word-LM have a larger than normal OOV rate for the first position. In Table 2, we see that with the bug most of the top OOV words generated from the char-LM have spaces in them, indicating a tokenization bug in the pipeline. This bug can then be fixed by the modeler. See Appendix B for further details and expanded results.
120
+
121
+ Privacy The dataset contains 342,477 unique users. Each round, 5,000 random users are selected3. The models trained for 2,000 communication rounds with DP hyperparameters as in Appendix B.2, Table 5. As an example, this gives $\epsilon = 9 . 2 2$ with $\delta = 2 . 9 2 \times 1 0 ^ { - 6 }$ . A larger number of users would lead to a smaller $\epsilon$ .
122
+
123
+ # 6 AN APPLICATION TO DEBUGGING DURING INFERENCE WITH GANS
124
+
125
+ DP Federated GANs for Generating Image Data Generative Adversarial Networks (GANs) (Goodfellow et al., 2014) are a state-of-the-art form of deep generative model, with numerous recent successes in particular in the image domain (Isola et al., 2016; Zhu et al., 2017; Karras et al., 2018; 2019; Brock et al., 2019). GANs work by alternately training two networks. One is a generator which maps a random input vector in a low-dimensional latent space into a rich, high-dimensional generative output like an image. The other is a discriminator, which judges whether an input image is ‘real’ (originating from a dataset of actual images) or ‘fake’ (created by the generator). Each network tries to defeat the other; the generator’s training objective is to create content that the discriminator is unable to discern from real content, and the discriminator’s training objective is to improve its ability to discern real content from generated content.
126
+
127
+ We can take the GAN training framework and adapt it to FL and DP, analogous to RNN training under FL and DP in McMahan et al. (2018) via the DP-FedAvg algorithm. The difference here is that two sets of model parameters are updated, by alternating minimization of two loss functions. One key insight is that only the discriminator’s training step involves the use of real user data (private and restricted to the user’s device); the generator training step does not require real user data, and thus can be computed at the coordinating server via a traditional (non-federated) gradient update. A second insight is that the generator’s loss is a function of the discriminator. As observed by earlier works involving DP GANs, if the discriminator is trained under DP and the generator is trained only via the discriminator, then the generator has the same level of privacy as the discriminator, via the post-processing property of DP (Dwork & Roth, 2014). No additional computational steps (e.g., clipping, noising) are necessary at the application of the generator gradient update.
128
+
129
+ Algorithm 1: DP-FedAvg-GAN, based on DP-FedAvg (App. C) but accounts for training both GAN models.
130
+
131
+ <table><tr><td>Server-orchestrated training loop:</td><td></td><td>UserDiscUpdate(k, 0D, 0G):</td><td></td><td></td></tr><tr><td></td><td></td><td>parameters: round participation fraction q E (0,1], total number of users N ∈ N,total number of</td><td>parameters: number of steps n E N, batch size B ∈ N,disc.learning rate nD ∈ R+,clip parame-</td><td></td></tr><tr><td></td><td>rounds T ∈ N, noise scale z ∈ R+,clip param-</td><td></td><td>ter S ∈ R+,gen. input size nu ∈ N,gen. function</td><td></td></tr><tr><td>eter S ∈R+</td><td></td><td></td><td>G(U;0G),disc.loss function lD(0D;breal, bfake)</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>Initialize generator 0,discriminator 0D,privacy</td><td></td><td>D←品</td><td></td></tr><tr><td>accountant M</td><td></td><td></td><td>B ← (k&#x27;s data split into n size B batches)</td><td></td></tr><tr><td></td><td></td><td></td><td>for each batch breal ∈ Bdo</td><td></td></tr><tr><td>zS Setσ=</td><td></td><td></td><td></td><td></td></tr><tr><td>qN</td><td></td><td></td><td>U ←(sample B random vectors of dim. nu)</td><td></td></tr><tr><td></td><td></td><td></td><td>bfake←G(U;0G)I generated data</td><td></td></tr><tr><td></td><td>for each round t from O to T do</td><td></td><td>0D←0D-nDVlD(0D;breal,bfake)</td><td></td></tr><tr><td></td><td>Ct ←(sample of qN distinct users)</td><td></td><td>△=0D-0D</td><td></td></tr><tr><td></td><td>for each user k ∈ Ct in parallel do</td><td></td><td>return update△k =△·min (1,π)/</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>/ Clip</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>1 △t+1</td><td>△+1</td><td></td><td>GenUpdate(0 D, 0):</td><td></td></tr><tr><td>qN</td><td></td><td></td><td>parameters:number of steps n ∈ N,batch size</td><td></td></tr><tr><td></td><td>kect</td><td></td><td>B ∈ N,gen. learning rate nG ∈ R+,gen. input</td><td></td></tr><tr><td>眙+¹←眙+△t+1+N(0,[σ²)</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>size nu E N,gen.loss function lG(0G;b,0D)</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>M.accum-priv-spending(z)</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>G←</td><td></td></tr><tr><td></td><td></td><td></td><td>for each generator training step i from 1 to n do</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>+1←GenUpdate(0+1,0G)</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>U ← (sample B random vectors of dim. nu)</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>bfake ← G(U;0G) I generated data</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td>printM.get-privacy-spent()</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>0G←0G-nGVlG(0G;bfake,0D)</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>return 0G</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr></table>
132
+
133
+ Algorithm 1 (‘DP-FedAvg-GAN’) describes how to train a GAN under FL and DP. The discriminator update resembles closely the update in standard DP-FedAvg, and then each round concludes with a generator update at the server. The discriminator is explicitly trained under DP. During training the generator is only exposed to the discriminator, and never directly to real user data, so it has the same DP guarantees as the discriminator.
134
+
135
+ Experiment Our second experiment shows how auxiliary DP federated GANs can be used to monitor an on-device handwriting classification network being used for inference. Once trained, the federated GANs synthesize privacy-preserving samples that identify the nature of a bug in on-device image preprocessing.
136
+
137
+ Consider the scenario of a banking app that uses the mobile phone’s camera to scan checks for deposit. Internally, this app takes raw images of handwriting, does some pixel processing, and feeds the processed images to a pre-trained on-device Convolutional Neural Network (CNN) to infer labels for the handwritten characters. This CNN is the ‘primary’ model. The modeler can monitor its performance via metrics like user correction rate (i.e., how often do users manually correct letters/digits inferred by the primary model), to get coarse feedback on accuracy. To simulate users’ processed data, we use the Federated EMNIST dataset (Caldas et al., 2018). Figure 2a shows example images; see Appendix C.1 for further details on the data.
138
+
139
+ Suppose a new software update introduces a bug that incorrectly flips pixel intensities during preprocessing, inverting the images presented to the primary model (Figure 2b).4 This change to the primary model’s input data causes it to incorrectly classify most handwriting. As the update rolls out to an increasing percentage of the app’s user population, the user correction rate metric spikes, indicating to the app developers a problem exists, but nothing about the nature of the problem. Critically, the images in Figure 2 are never viewed by human eyes, but are fed to the primary model on device. If the data were public and the inference being performed on the app’s server, some of the misclassified handwriting images could potentially be inspected, and the pixel inversion bug realized. But this cannot be done when the data is private and decentralized.
140
+
141
+ ![](images/53ff0949d9cc5a0dbe81a24c5832d8f27e948122369bdf210f3ed5cbbb8a0aee.jpg)
142
+ Figure 2: Examples of primary model CNN input, from EMNIST with letters and digits (62 classes).
143
+
144
+ ![](images/43f57eb0c5f50e0deee4ab382d410305db7d6fd1608e77da0d5ae8b5b7cc426e.jpg)
145
+ Figure 3: DP federated GAN generator output given an inversion bug on $50 \%$ of devices.
146
+
147
+ Instead, we train two DP federated GANs via Algorithm 1: one on a subset of the processed image data that tends to perform best when passed to the primary model, and one on a subset of processed image data that tends to perform worst. (Specifically, we do this by forming two distinct subpopulations of users who exhibit high and low classification accuracy, respectively, and training one GAN on each user subpopulation, as in T4; full details in Appendix C.3, and an alternative selection criteria explored in Appendix C.4.) By contrasting images synthesized by the two GANs, we hope to understand what is causing degraded classification accuracy for some app users. In our simulation of this scenario, we train for 1,000 communication rounds, with 10 users (drawn at random) participating in each round. See Appendix C.2 for training details. Figure 3 shows images generated by the two trained GANs, when the bug is present on $50 \%$ of users’ phones.
148
+
149
+ Comparing the GANs’ output, the presence of a pixel inversion bug is clear, enabling the modeler to locate and fix the issue.5 A natural follow-on is to repeat training the two GANs after the fix is made; results shown in Figure 6 (Appendix C.3.1). Comparing these new images verifies the pixel inversion bug is fixed. It also potentially reveals new insights. Perhaps it identifies another, more subtle bug, or a particular characteristic of handwriting common to users with many misclassified examples (indicating a missing user class in the primary model’s training data, i.e. an instance of T6). We propose it is useful to continually train federated generative models like the GANs in this experiment, as a tool to monitor and debug.
150
+
151
+ Privacy at Scale We follow an approach as in McMahan et al. (2018) to determine the level of privacy at realistic population sizes. We simulate with 10 users per round and a small total population size (3,400) in order to validate the utility of our models and also determine a noise scale multiplier $z$ that does not degrade the quality of the GAN’s generated images. This simulation scenario will not afford good privacy protections (as indicated by the resulting very large $\epsilon$ bound). But it does indicate the factor necessary to scale $z$ up to 1.0; this is the factor we’d have to apply to per-round participation count to achieve a real-world scenario that affords good privacy protections (as measured by $\epsilon$ and $\delta$ ) while maintaining the quality of the GAN’s generated images. As the experiment shows good utility is achieved with a $z$ of 0.01, the factor to apply is
152
+
153
+ Table 3: Privacy parameters for different scenarios. $N$ is size of user subpopulation that meets selection criteria (not overall population size). Simulations are with overall population of 3,400, and realistic scenarios are with overall population of 2,000,000. All experiments use clip parameter $S$ of 0.1 and 1,000 rounds.
154
+
155
+ <table><tr><td></td><td>qN</td><td>N</td><td>2</td><td>E</td><td>8</td></tr><tr><td>simulation (Figure 3a)</td><td>10</td><td>425</td><td>0.01</td><td>9.99×106</td><td>2.35×10-3</td></tr><tr><td>realistic scenario</td><td>1,000</td><td>250,000</td><td>1.00</td><td>2.38</td><td>4.00×10-8</td></tr><tr><td>simulation (Figure 3b)</td><td>10</td><td>2,125</td><td>0.01</td><td>9.99×106</td><td>4.71×10-4</td></tr><tr><td>realistic scenario</td><td>1,000</td><td>1,250,000</td><td>1.00</td><td>1.48</td><td>8.00×10-9</td></tr><tr><td>simulation (Figure 6)</td><td>10</td><td>850</td><td>0.01</td><td>9.99×106</td><td>1.18×10-3</td></tr><tr><td>realistic scenario</td><td>1,000</td><td>500,000</td><td>1.00</td><td>1.79</td><td>2.00×10-8</td></tr></table>
156
+
157
+ 100: a real-world use case would involve 1,000 users per round, out of a total population of e.g. 2 million mobile app users. This is reasonable for a real-world system, e.g. Bonawitz et al. (2019).
158
+
159
+ Table 3 gives DP hyperparameters and resulting $( \epsilon , \delta )$ values, both for the simulation and the corresponding scenario with scaled-up, realistic population. The calculation of $( \epsilon , \delta )$ is fully described in Appendix A.1. Note that three sets of numbers are presented, as $( \epsilon , \delta )$ depend on the number of users meeting the selection criteria for a given use case. The cases are: (i) high-accuracy users when the bug exists $1 2 . 5 \%$ of overall population), (ii) low-accuracy users when the bug exists $( 6 2 . 5 \%$ of overall population), and (iii) either group of users when the bug is gone (each $2 5 \%$ of overall population). In all cases, for the realistic population we achieve single digit $\epsilon$ (between 1.48 and 2.38), indicating a reasonable amount of user privacy.
160
+
161
+ # 7 CONCLUSION
162
+
163
+ In this work we described ML modeler workflows that rely on data inspection and are hence precluded when direct inspection is impossible (i.e., in a private, decentralized data paradigm). We proposed a tool to overcome this limitation: differentially private, federated generative models that synthesize examples representative of the private data. We demonstrated application of two example model classes (DP federated RNNs and GANs), showing how they enable a modeler to debug natural language and image problems. In the GAN case, we presented a novel algorithm for training under FL and DP. Section 2 discusses several other modeler workflows (e.g., debiasing, labeling) that rely on data inspection and are inhibited in a private, decentralized paradigm. Experiments applying DP federated generative models to these workflows is a promising direction for future work, especially since applications like data labeling will likely require higherfidelity generative models than the ones considered here.
164
+
165
+ To convert the concept proposed in this paper into a practical data science tool, a variety of further research is necessary. For federated generative models to be useful and broadly applicable, they should require minimal tuning; excessive experimentation needed to achieve convergence both destroys the value proposition to the modeler and destroys the privacy budget under DP analysis. They must be capable of synthesizing relevant content in scenarios where the ‘signal-to-noise’ ratio is low, e.g., when a bug is only present in a small amount of data (in absolute or relative terms). How to achieve this in the case of GANs, which are powerful but can suffer from mode collapse, is of special interest. Advances in these dimensions will greatly benefit the private, decentralized data science community. As an initial step to stimulate research in this area, we provide an open-source implementation6 of our DP federated GAN code (used to generate the results in Section 6). We share additional thoughts on open problems in Appendix D.
166
+
167
+ # REFERENCES
168
+
169
+ Martin Abadi, Andy Chu, Ian Goodfellow, Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. Deep learning with differential privacy. In 23rd ACM Conference on Computer and Communications Security (ACM CCS), 2016.
170
+
171
+ Julia Angwin, Jeff Larson, Surya Mattu, and Lauren Kirchner. Machine bias: There’s software used across the country to predict future criminals. and it’s biased against blacks. ProPublica, 2016.
172
+
173
+ Raef Bassily, Adam Smith, and Abhradeep Thakurta. Private empirical risk minimization: Efficient algorithms and tight error bounds. In Proceedings of the 2014 IEEE 55th Annual Symposium on Foundations of Computer Science, FOCS ’14, pp. 464–473, Washington, DC, USA, 2014. IEEE Computer Society. ISBN 978-1-4799-6517-5. doi: 10.1109/FOCS.2014.56. URL http://dx.doi.org/10.1109/ FOCS.2014.56.
174
+
175
+ Brett K. Beaulieu-Jones, Zhiwei Steven Wu, Chris Williams, Ran Lee, Sanjeev P. Bhavnani, James Brian Byrd, and Casey S. Greene. Privacy-preserving generative deep neural networks support clinical data sharing. bioRxiv, 2018. doi: 10.1101/159756. URL https://www.biorxiv.org/content/ early/2018/12/20/159756.
176
+
177
+ Keith Bonawitz, Hubert Eichner, Wolfgang Grieskamp, Dzmitry Huba, Alex Ingerman, Vladimir Ivanov, Chloe Kiddon, Jakub Kone ´ cnˇ y, Stefano Mazzocchi, H Brendan McMahan, Timon Van Overveldt, David ´ Petrou, Daniel Ramage, and Jason Roselander. Towards federated learning at scale: System design. In SysML 2019, 2019.
178
+
179
+ Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale GAN training for high fidelity natural image synthesis. In International Conference on Learning Representations, 2019. URL https:// openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ B1xsqj09Fm.
180
+
181
+ Sebastian Caldas, Peter Wu, Tian Li, Jakub Konecnˇ y, H Brendan McMahan, Virginia Smith, and Ameet ´ Talwalkar. Leaf: A benchmark for federated settings. arXiv preprint arXiv:1812.01097, 2018.
182
+
183
+ N. Carlini, C. Liu, J. Kos, U. Erlingsson, and D. Song. The Secret Sharer: Measuring Unintended Neural ´ Network Memorization & Extracting Secrets. ArXiv e-prints, February 2018. URL https://arxiv. org/abs/1802.08232.
184
+
185
+ Aleksandar Chakarov, Aditya V. Nori, Sriram K. Rajamani, Shayak Sen, and Deepak Vijaykeerthy. Debugging machine learning tasks. CoRR, abs/1603.07292, 2016. URL http://arxiv.org/abs/1603. 07292.
186
+
187
+ Kamalika Chaudhuri, Claire Monteleoni, and Anand D. Sarwate. Differentially private empirical risk minimization. J. Mach. Learn. Res., 12, July 2011.
188
+
189
+ Mingqing Chen, Rajiv Mathews, Tom Ouyang, and Franc¸oise Beaufays. Federated learning of out-ofvocabulary words. CoRR, abs/1903.10635, 2019. URL http://arxiv.org/abs/1903.10635.
190
+
191
+ J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A Large-Scale Hierarchical Image Database. In CVPR09, 2009.
192
+
193
+ Emily Denton, Ben Hutchinson, Margaret Mitchell, and Timnit Gebru. Detecting bias with generative counterfactual face attribute augmentation. CoRR, abs/1906.06439, 2019. URL http://arxiv.org/ abs/1906.06439.
194
+
195
+ Cynthia Dwork. A firm foundation for private data analysis. Commun. ACM, 54(1):86–95, January 2011. ISSN 0001-0782. doi: 10.1145/1866739.1866758. URL http://doi.acm.org/10.1145/ 1866739.1866758.
196
+
197
+ Cynthia Dwork and Aaron Roth. The Algorithmic Foundations of Differential Privacy. Foundations and Trends in Theoretical Computer Science. Now Publishers, 2014.
198
+
199
+ Cynthia Dwork, Frank McSherry, Kobbi Nissim, and Adam Smith. Calibrating noise to sensitivity in private data analysis. In TCC, pp. 265–284. Springer, 2006.
200
+
201
+ Cristobal Esteban, Stephanie Hyland, and Gunnar R ´ atsch. Real-valued (medical) time series generation with¨ recurrent conditional gans, 2017. URL http://arxiv.org/abs/1811.03850.
202
+
203
+ Lorenzo Frigerio, Anderson Santana de Oliveira, Laurent Gomez, and Patrick Duverger. Differentially private generative adversarial networks for time series, continuous, and discrete open data. CoRR, abs/1901.02477, 2019. URL http://arxiv.org/abs/1901.02477.
204
+
205
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Z. Ghahramani, M. Welling, C. Cortes, N. D. Lawrence, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27, pp. 2672–2680. Curran Associates, Inc., 2014. URL http://papers.nips.cc/paper/ 5423-generative-adversarial-nets.pdf.
206
+
207
+ Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep learning. Book in preparation for MIT Press, 2016.
208
+
209
+ Klaus Greff, Rupesh Kumar Srivastava, Jan Koutn´ık, Bas R. Steunebrink, and Jurgen Schmidhuber. LSTM: ¨ A search space odyssey. CoRR, abs/1503.04069, 2015. URL http://arxiv.org/abs/1503. 04069.
210
+
211
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of wasserstein gans. In Proceedings of the 31st International Conference on Neural Information Processing Systems, NIPS’17, pp. 5769–5779, USA, 2017. Curran Associates Inc. ISBN 978-1-5108-6096-4. URL http://dl.acm.org/citation.cfm?id $=$ 3295222.3295327.
212
+
213
+ Andrew Hard, Kanishka Rao, Rajiv Mathews, Franc¸oise Beaufays, Sean Augenstein, Hubert Eichner, Chloe Kiddon, and Daniel Ramage. Federated learning for mobile keyboard prediction. ´ arXiv preprint arXiv:1811.03604, 2018.
214
+
215
+ Corentin Hardy, Erwan Le Merrer, and Bruno Sericola. MD-GAN: multi-discriminator generative adversarial networks for distributed datasets. CoRR, abs/1811.03850, 2018. URL http://arxiv.org/abs/ 1811.03850.
216
+
217
+ Jamie Hayes, Luca Melis, George Danezis, and Emiliano De Cristofaro. Logan: Membership inference attacks against generative models. Proceedings on Privacy Enhancing Technologies, 2019(1):133–152, 2019.
218
+
219
+ Benjamin Hilprecht, Martin Harterich, and Daniel Bernau. Reconstruction and membership inference at- ¨ tacks against generative models. arXiv preprint arXiv:1906.03006, 2019.
220
+
221
+ Nargiz Humbatova, Gunel Jahangirova, Gabriele Bavota, Vincenzo Riccio, Andrea Stocco, and Paolo Tonella. Taxonomy of real faults in deep learning systems, 2019.
222
+
223
+ Alex Ingerman and Krzys Ostrowski. Introducing tensorflow federated, 2019. URL https://medium. com/tensorflow/introducing-tensorflow-federated-a4147aa20041.
224
+
225
+ Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. arxiv, 2016.
226
+
227
+ Bargav Jayaraman and David Evans. Evaluating differentially private machine learning in practice. USENIX Security Symposium, Aug 2019. URL http://par.nsf.gov/biblio/10099285.
228
+
229
+ Peter Kairouz, Sewoong Oh, and Pramod Viswanath. The composition theorem for differential privacy. IEEE Transactions on Information Theory, 63(6):4037–4049, 2017.
230
+
231
+ 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. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ Hk99zCeAb.
232
+
233
+ Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2019.
234
+
235
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes, 2013.
236
+
237
+ Manoj Kumar, Mohammad Babaeizadeh, Dumitru Erhan, Chelsea Finn, Sergey Levine, Laurent Dinh, and Durk Kingma. Videoflow: A flow-based generative model for video. CoRR, abs/1903.01434, 2019. URL http://arxiv.org/abs/1903.01434.
238
+
239
+ Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-efficient learning of deep networks from decentralized data. In Artificial Intelligence and Statistics, pp. 1273–1282, 2017.
240
+
241
+ H Brendan McMahan and Daniel Ramage. Federated learning: Collaborative machine learning without centralized training data, April 2017. URL https://ai.googleblog.com/2017/04/ federated-learning-collaborative.html. Google AI Blog.
242
+
243
+ H. Brendan McMahan, Gary Holt, David Sculley, Michael Young, Dietmar Ebner, Julian Grady, Lan Nie, Todd Phillips, Eugene Davydov, Daniel Golovin, Sharat Chikkerur, Dan Liu, Martin Wattenberg, Arnar Mar Hrafnkelsson, Tom Boulos, and Jeremy Kubica. Ad click prediction: a view from the trenches. In KDD, 2013.
244
+
245
+ H Brendan McMahan, Daniel Ramage, Kunal Talwar, and Li Zhang. Learning differentially private recurrent language models. In International Conference on Learning Representations (ICLR), 2018.
246
+
247
+ Ilya Mironov. Renyi differential privacy. In ´ 2017 IEEE 30th Computer Security Foundations Symposium (CSF), pp. 263–275. IEEE, 2017.
248
+
249
+ Nicolas Papernot, Mart´ın Abadi, Ulfar Erlingsson, Ian Goodfellow, and Kunal Talwar. Semi-supervised ´ knowledge transfer for deep learning from private training data. In Proceedings of the International Conference on Learning Representations, 2017. URL https://arxiv.org/abs/1610.05755.
250
+
251
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. In OpenAI Technical report, 2019.
252
+
253
+ Patrick Riley. The unofficial google data science blog: Practical advice for analysis of large, complex data sets, October 2016. URL http://www.unofficialgoogledatascience.com/2016/ 10/practical-advice-for-analysis-of-large.html.
254
+
255
+ Hasim Sak, Andrew W. Senior, and Franc¸oise Beaufays. Long short-term memory based recurrent neural network architectures for large vocabulary speech recognition. CoRR, abs/1402.1128, 2014. URL http: //arxiv.org/abs/1402.1128.
256
+
257
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, Xi Chen, and Xi Chen. Improved techniques for training gans. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 2234–2242. Curran Associates, Inc., 2016. URL http://papers.nips.cc/paper/ 6125-improved-techniques-for-training-gans.pdf.
258
+
259
+ Florian Schroff, Dmitry Kalenichenko, and James Philbin. Facenet: A unified embedding for face recognition and clustering. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2015.
260
+
261
+ D. Sculley, Gary Holt, Daniel Golovin, Eugene Davydov, Todd Phillips, Dietmar Ebner, Vinay Chaudhary, Michael Young, Jean-Franc¸ois Crespo, and Dan Dennison. Hidden technical debt in machine learning systems. In C. Cortes, N. D. Lawrence, D. D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems 28, pp. 2503–2511. Curran Associates, Inc., 2015. URL http://papers.nips.cc/paper/ 5656-hidden-technical-debt-in-machine-learning-systems.pdf.
262
+
263
+ Congzheng Song and Vitaly Shmatikov. Auditing data provenance in text-generation models, 2019.
264
+
265
+ TFF documentation. tff.simulation.datasets.emnist.load data documentation, 2019. URL https://www.tensorflow.org/federated/api_docs/python/tff/ simulation/datasets/emnist/load_data.
266
+
267
+ Reihaneh Torkzadehmahani, Peter Kairouz, and Benedict Paten. Dp-cgan: Differentially private synthetic data and label generation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pp. 0–0, 2019.
268
+
269
+ Aleksei Triastcyn and Boi Faltings. Federated generative privacy. Proceedings of the IJCAI Workshop on Federated Machine Learning for User Privacy and Data Confidentiality (FML 2019), 2019. URL http://infoscience.epfl.ch/record/269023.
270
+
271
+ Yu-Xiang Wang, Borja Balle, and Shiva Kasiviswanathan. Subsampled r\’enyi differential privacy and analytical moments accountant. arXiv preprint arXiv:1808.00087, 2018.
272
+
273
+ Xi Wu, Fengan Li, Arun Kumar, Kamalika Chaudhuri, Somesh Jha, and Jeffrey F. Naughton. Bolt-on differential privacy for scalable stochastic gradient descent-based analytics. In Proceedings of SIGMOD, 2017.
274
+
275
+ Liyang Xie, Kaixiang Lin, Shu Wang, Fei Wang, and Jiayu Zhou. Differentially private generative adversarial network. CoRR, abs/1802.06739, 2018. URL http://arxiv.org/abs/1802.06739.
276
+
277
+ Timothy Yang, Galen Andrew, Hubert Eichner, Haicheng Sun, Wei Li, Nicholas Kong, Daniel Ramage, and Franc¸oise Beaufays. Applied federated learning: Improving google keyboard query suggestions. arXiv preprint 1812.02903, 2018.
278
+
279
+ Xinyang Zhang, Shouling Ji, and Ting Wang. Differentially private releasing via deep generative model. CoRR, abs/1801.01594, 2018. URL http://arxiv.org/abs/1801.01594.
280
+
281
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Computer Vision (ICCV), 2017 IEEE International Conference on, 2017.
282
+
283
+ Martin Zinkevich. Rules of machine learning: Best practices for ml engineering., 2017. URL http: //martin.zinkevich.org/rules_of_ml/rules_of_ml.pdf.
284
+
285
+ # A USER-LEVEL DIFFERENTIAL PRIVACY AND FEDERATED LEARNING
286
+
287
+ Differential privacy (DP) (Dwork et al., 2006; Dwork, 2011; Dwork & Roth, 2014) provides a well-tested formalization for the release of information derived from private data. Applied to ML, a differentially private training mechanism allows the public release of model parameters with a strong guarantee: adversaries are severely limited in what they can learn about the original training data based on analyzing the parameters, even when they have access to arbitrary side information. Formally, it says:
288
+
289
+ Definition 1 Differential Privacy: A randomized mechanism $\mathcal { M } \colon \mathcal { D } \mathcal { R }$ with a domain $\mathcal { D }$ (e.g., possible training datasets) and range $\mathcal { R }$ (e.g., all possible trained models) satisfies $( \epsilon , \delta )$ -differential privacy if for any two adjacent datasets $d , d ^ { \prime } \in \mathcal { D }$ and for any subset of outputs $S \subseteq \mathcal { R }$ it holds that $\operatorname* { P r } [ \mathcal { M } ( d ) \in S ] \leq$ $e ^ { \epsilon } \operatorname* { P r } [ \mathcal { M } ( d ^ { \prime } ) \in S ] + \delta$ .
290
+
291
+ The definition above leaves open the definition of adjacent datasets which will depend on the application. Most prior work on differentially private ML (e.g. Chaudhuri et al. (2011); Bassily et al. (2014); Abadi et al. (2016); Wu et al. (2017); Papernot et al. (2017)) deals with example-level privacy: two datasets $d$ and $d ^ { \prime }$ are defined to be adjacent if $d ^ { \prime }$ can be formed by adding or removing a single training example from $d$ .
292
+
293
+ However, recent work has presented an algorithm (DP-FedAvg, McMahan et al. (2018)) for differentially private ML with user-level privacy. Intuitively speaking, a model trained under DP-FedAvg should not change too much when one user’s data is added, removed, or changed arbitrarily. Learning takes place via FL; since FL processes all of one user’s data together, such guarantees are relatively easier to obtain than in the centralized setting.
294
+
295
+ We adopt an approach (Algorithm 2) for performing differentially private FL that follows closely from the DP-FedAvg algorithm. Similarly, our focus is on user-level differential privacy, where the privacy guarantee extends to all of a user’s data (rather than e.g. a single training example).
296
+
297
+ Specifically, following DP-FedAvg, we:
298
+
299
+ • enforce clipping of per-user updates so the total update has bounded $L _ { 2 }$ norm.
300
+ • use a bounded-sensitivity estimator for computing the weighted average update to the global model.
301
+ • add Gaussian noise to the weighted average update.
302
+
303
+ The sensitivity of a query is directly proportional to the amount of clipping $S$ and inversely proportional to the number of participants in a training round $q N$ . Algorithm 2 shows that a noise scale parameter $z$ relates the amount of standard deviation $\sigma$ in the added Gaussian noise to this query sensitivity. As described in McMahan et al. (2018), acceptable DP bounds are typically achieved when $z \geq 1 . 0$ . So a method of determining privacy hyperparameters that afford acceptable utility and privacy is to start with a small number of per-round participants $q N$ , determine values of $S$ and $\sigma$ that provide good utility, and then increase the number of per-round participants so that $z \geq 1 . 0$ .
304
+
305
+ A slight difference between our approach and that presented in DP-FedAvg is how we select devices to participate in a given federated round of computation. DP-FedAvg uses randomly-sized federated rounds, where users are selected independently with probability $q$ . In this paper, we instead use fixed-size federated rounds, where the number of users selected to participate in the round, $q N$ , is a constant (and $N$ is the total number of mobile devices participating in training). I.e., $q$ is the round participation fraction. This method of sampling has minor but non-trivial ramifications for the calculation of the overall privacy bound, which we discuss next.
306
+
307
+ Algorithm 2: DP-FedAvg with fixed-size federated rounds, used to train word- and char-LMs in Section 5.
308
+
309
+ <table><tr><td>Server-orchestrated training loop:</td><td>UserUpdate(k,0°):</td></tr><tr><td>parameters</td><td>parameters</td></tr><tr><td>round participation fraction q ∈ (0,1]</td><td>number of local epochs E∈N</td></tr><tr><td>total user population N ∈ N</td><td>batch sizeB∈N</td></tr><tr><td>noise scale z ∈R+</td><td>learning rate n ∈ R+</td></tr><tr><td>clip parameter S ∈ R+</td><td>clip parameter S ∈R+</td></tr><tr><td>Initialize model 0°,privacy accountant M</td><td>parameter functions loss function l(0; b)</td></tr><tr><td>zS</td><td>0←00</td></tr><tr><td>Set σ = qN</td><td>for each local epoch i from1 to E do</td></tr><tr><td>for each round t = O,1,2,... do</td><td>B ←(k&#x27;s data split into size B batches)</td></tr><tr><td>Ct←(sample without replacement qN users from</td><td>for each batch b ∈Bdo</td></tr><tr><td>population)</td><td>0←θ-nvl(0;b)</td></tr><tr><td>for each user k ∈ Ct in parallel do</td><td>△=0-00</td></tr><tr><td>△+1 ←UserUpdate(k,0t)</td><td>retum update △ =△·min (1,) I// Clip</td></tr><tr><td>1 M △+1 △t+1</td><td></td></tr><tr><td>qN kECt</td><td></td></tr><tr><td>0t+1←0t+△t+1+N(0,1σ²)</td><td></td></tr><tr><td>M.accum_priv_spending(z)</td><td></td></tr><tr><td></td><td></td></tr><tr><td>print M.get-privacy-spent()</td><td></td></tr></table>
310
+
311
+ # A.1 PRIVACY BOUNDS
312
+
313
+ To obtain precise DP guarantees, we use the analytical moments accountant of subsampled Renyi differential ´ privacy (RDP) method developed in Wang et al. (2018). In particular, this work provides a tight upper bound on the RDP parameters for an algorithm that: (a) uniformly subsamples records from an underlying dataset, and then (b) applies a randomized mechanism to the subsample (Gaussian perturbation in our case). This is precisely what happens in one round of Algorithm 1 or 2. To track the overall privacy budget, we multiply the RDP orders of the uniformly subsampled Gaussian mechanism by the number of rounds we execute Algorithm 1 or 2 and convert the resulting RDP orders to an $( \epsilon , \delta )$ pair using Proposition 3 of Mironov (2017).
314
+
315
+ # A.2 ADDITIONAL CONSIDERATIONS
316
+
317
+ Note that $( \epsilon , \delta )$ DP upper bounds are often loose, and so can be complemented by direct measurement of memorization, as in Carlini et al. (2018); Song & Shmatikov (2019). Further, while often unrealistic as a threat model, membership inference attacks on GANs can also be used as a tool to empirically quantify memorization (Hayes et al., 2019; Hilprecht et al., 2019). Finally, we note that since the modeler has access to not only the auxiliary generative models, but also potentially other models trained on the same data, if an $( \epsilon , \delta )$ guarantee is desired, the total privacy loss should be quantified across these models, e.g. using the strong composition theorem for DP (Mironov, 2017; Kairouz et al., 2017).
318
+
319
+ # B DP FEDERATED RNNS: EXPERIMENTAL DETAILS
320
+
321
+ # B.1 STACK OVERFLOW DATA
322
+
323
+ The Stack Overflow dataset contains questions and answers from the Stack Overflow forum grouped by user ids. The data consists of the text body of all questions and answers. The bodies were parsed into sentences; any user with fewer than 100 sentences was expunged from the data. Minimal preprocessing was performed to fix capitalization, remove URLs etc. The corpus is divided into train, held-out, and test parts. Table 4 summarizes the statistics on number of users and number of sentences for each partition. The dataset is available via the Tensorflow Federated open-source software framework (Ingerman & Ostrowski, 2019).
324
+
325
+ Table 4: Number of users and sentences in the Stack Overflow dataset.
326
+
327
+ <table><tr><td></td><td>Train</td><td>Held-out</td><td>Test</td></tr><tr><td>#Users</td><td>342K</td><td>38.8K</td><td>204K</td></tr><tr><td># Users with both questions and answers</td><td>297K</td><td>34.3K</td><td>99.3K</td></tr><tr><td># Sentences</td><td>136M</td><td>16.5M</td><td>16.6M</td></tr><tr><td># Sentences that are questions</td><td>57.8M</td><td>7.17M</td><td>7.52M</td></tr><tr><td># Sentences that are answers</td><td>78.0M</td><td>9.33M</td><td>9.07M</td></tr></table>
328
+
329
+ # B.2 RNN MODEL ARCHITECTURES AND TRAINING
330
+
331
+ DP Word-LM The DP word-LM model is based on a coupled input forget gate CIFG-LSTM (Greff et al., 2015) with projection layer (Sak et al., 2014). It uses a 10K vocabulary, which is composed of the most frequent 10K words from the training corpus. The model architecture is based on an RNN with hidden size of 670 and an input embedding dimension of 96. The model is trained for 2,000 rounds. A server learning rate of 1.0, an on-device learning rate of 0.5, and Nesterov momentum of 0.99 are used.
332
+
333
+ DP Char-LM The model architecture used to train the DP char-LM is based on $^ { \mathrm { 6 6 } } \mathrm { F L } _ { \mathrm { L } } ^ { \mathrm { M } , \mathrm { , , } }$ in Chen et al. (2019), which is also a CIFG-LSTM with projection using 3 layers, 256 RNN hidden units and 128 projected dimensions. The input embedding dimension is also 128. The character vocabulary has a size of 258, based on UTF-8 encoding with 256 categories from a single byte and additional start-of-word and end-of-word tokens. All other training and optimization parameters are the same as the word-LM model. Similar to Chen et al. (2019), once the char-LM is trained, Monte Carlo sampling is performed to generate OOV words.
334
+
335
+ Privacy Hyperparameters Table 5 gives the privacy hyperparameters used with DP-FedAvg (Algorithm 2) to yield the trained word-LM and char-LM models that generated the text results presented here.
336
+
337
+ Table 5: Privacy hyperparameters for DP RNN experiments.
338
+
339
+ <table><tr><td></td><td>L2 clip parameter S</td><td>participation count qN</td><td>total users N</td><td>noise scale 2</td><td>number of rounds T</td></tr><tr><td>DP word-LM</td><td>0.2</td><td>5,000</td><td>342,777</td><td>1.0</td><td>2.,000</td></tr><tr><td>DP char-LM</td><td>0.1</td><td>5,000</td><td>342,777</td><td>1.0</td><td>2,000</td></tr></table>
340
+
341
+ # B.3 EXPANDED RESULTS
342
+
343
+ To demonstrate the effectiveness of using the OOV model to monitor the introduced system bug, the experiments are done in four comparison settings: (1) without bug; (2) $1 \%$ of sentences have first two words concatenated; (3) $10 \%$ sentences; (4) $100 \%$ sentences. In each setting the model trains for 2,000 communication rounds, to meet the privacy guarantees stated in Section 5. We observed in all four settings that models were converged after 2,000 rounds.
344
+
345
+ DP Word-LM Figure 4 shows percentage of OOV words by their position in the sentence. It clearly shows that as the percentage of sentences affected increases, the word-LM reflects this in its generated output.
346
+
347
+ Table 6 shows the overall OOV rate observed in four experiment settings. It can be seen that overall OOV rate goes up as the percentage of sentences affected by the concatenation bug increases. Thus overall OOV rate can be used as an early abnormality indicator of the corpus.
348
+
349
+ Table 7 shows samples of phrases generated from the word-LM in different experiment settings. We can see that the phrases have more OOVs (marked as UNK) as the percentage of sentences affected by the concatenation bug increases.
350
+
351
+ DP Char-LM Table 8 shows the $2 0 \ \mathrm { m o s t }$ frequently occurring OOV words generated by the char-LM, for the four different experiment cases. These generated results provide actual information on the tokenized words being fed to the model from the decentralized dataset. Similar to the word-LM, as the ratio of the bug increases, the chance of generating content reflecting the bug (in this case, concatenated words) becomes higher. In the $100 \%$ setting, all the top 20 words are concatenated words; the word-level joint probabilities of the concatenated words are significantly higher than their non-concatenated counterparts.
352
+
353
+ ![](images/9c2a82748ff280eec5ac93815b57fccd05598405270dbc4e574c66e0ccbbd583.jpg)
354
+ Figure 4: Percentage of samples generated from the word-LM that are OOV by position in the sentence (computed over 100,000 samples).
355
+
356
+ Table 6: Overall OOV rate observed (during training) in different word-LM experiment settings.
357
+
358
+ <table><tr><td>without bug</td><td>1%</td><td>10%</td><td>100%</td></tr><tr><td>6.52%</td><td>6.63%</td><td>7.60%</td><td>17.89%</td></tr></table>
359
+
360
+ Table 7: Sample phrases generated from word-LMs when $0 \%$ , $1 \%$ , $10 \%$ , and $100 \%$ of sentences affected.
361
+
362
+ <table><tr><td rowspan=1 colspan=2>without bug 1%</td></tr><tr><td rowspan=1 colspan=2>for UNK metrics to work fine ,ago this tries to load the textbox by geti think your question is the correct format if any user who was originally have anquestion 1 UNK ? java 1 ,UNK which one is different at the same timeis the selector of the type of module UNK currently building my ios app to integratebasically ,i do a bunch of articles the only thing i can think of isUNK data UNK UNK UNK @ 43 UNK /home /UNK/jmeter/;this is a blog post for huge UNK the solution with our application is the currentone possibility is to send different limits to there is another solution in their UNK feedthis is missing some functions UNK on index ( your client sends all the source propertiesafter that UNK start the above ,then thank you ...in your worst</td></tr><tr><td rowspan=1 colspan=2>10% 100%</td></tr><tr><td rowspan=4 colspan=2>looks like it are pretty weather when i UNK lg for this is computing 3 assuppose one key is executed when you freeze UNK it is that sql will stop overdelete disadvantage of the files and prediction . UNK of UNK you need to call UNKUNK a folder created on one system ( UNK ms might have this off ;&amp;please note that the button would mount a UNK in the choice of sort of draggingwould it be displaying the same field i UNK,p1.UNK(UNK,UNK just all the UNK files ,such UNK UNK editing the push () controllersUNK,it UNK matter why( note UNK info must have depend on the waysimply at UNK .UNK but put it UNK i do it static ? UNK stopi started many debug from the jboss UNK trying to give more html privileges ?</td></tr><tr><td rowspan=2 colspan=1></td><td rowspan=1 colspan=1>dis</td></tr><tr><td rowspan=1 colspan=1>please note that the button would mount a</td></tr><tr><td rowspan=1 colspan=1>would it be displaying the same field i</td></tr></table>
363
+
364
+ Table 8: Top 20 char-LM-generated OOV words by joint character probability, for $0 \%$ (without bug), $1 \%$ , $10 \%$ , and $100 \%$ of examples affected by bug. Value alongside is joint probability (computed via Equation 1).
365
+
366
+ <table><tr><td colspan="2">without bug (prob 10-3)</td><td colspan="2">1% (prob 10-3)</td><td colspan="2">10% (prob 10-3)</td><td colspan="2">100% (prob 10-3)</td></tr><tr><td>regex</td><td>5.50</td><td>regex</td><td>5.15</td><td>i have</td><td>8.08</td><td>i have</td><td>27.47</td></tr><tr><td>jsfiddle</td><td>3.90</td><td>jsfiddle</td><td>3.73</td><td>iam</td><td>5.60</td><td>iam</td><td>16.50</td></tr><tr><td>xcode</td><td>3.12</td><td>xcode</td><td>2.86</td><td>regex</td><td>4.45</td><td>this is</td><td>9.92</td></tr><tr><td>divs</td><td>2.75</td><td>listview</td><td>2.64</td><td>you can</td><td>3.71</td><td>you can</td><td>9.04</td></tr><tr><td>stackoverflow</td><td>2.75</td><td>textbox</td><td>2.56</td><td>if you</td><td>2.81</td><td>here is</td><td>8.30</td></tr><tr><td>listview</td><td>2.74</td><td>divs</td><td>2.45</td><td>this is</td><td>2.77</td><td>if you</td><td>8.29</td></tr><tr><td>textbox</td><td>2.73</td><td>stackoverflow</td><td>2.44</td><td>here is</td><td>2.73</td><td>iwant</td><td>8.17</td></tr><tr><td>foreach</td><td>2.34</td><td>iis</td><td>2.27</td><td>jsfiddle</td><td>2.70</td><td>is there</td><td>7.51</td></tr><tr><td>async</td><td>2.27</td><td>foreach</td><td>2.24</td><td>iwant</td><td>2.39</td><td>how can</td><td>5.78</td></tr><tr><td>iis</td><td>2.21</td><td>linq</td><td>2.20</td><td>textbox</td><td>2.28</td><td>when i</td><td>5.33</td></tr><tr><td>onclick</td><td>2.07</td><td>async</td><td>2.17</td><td>xcode</td><td>2.23</td><td>however,</td><td>5.25</td></tr><tr><td>linq</td><td>2.02</td><td>onclick</td><td>2.05</td><td>listview</td><td>2.10</td><td>i would</td><td>4.72</td></tr><tr><td>params</td><td>2.00</td><td>htaccess</td><td>1.90</td><td>stackoverflow</td><td>2.10</td><td>ifi</td><td>4.22</td></tr><tr><td>htaccess</td><td>1.90</td><td>params</td><td>1.89</td><td>is there</td><td>2.07</td><td>for example</td><td>4.20</td></tr><tr><td>arraylist</td><td>1.90</td><td>mongodb</td><td>1.86</td><td>divs</td><td>1.93</td><td>itried</td><td>4.14</td></tr><tr><td>mongodb</td><td>1.83</td><td>npm</td><td>1.77</td><td>async</td><td>1.79</td><td>edit:</td><td>4.07</td></tr><tr><td>xaml</td><td>1.79</td><td>xaml</td><td>1.74</td><td>linq</td><td>1.72</td><td>i think</td><td>3.86</td></tr><tr><td>npm</td><td>1.66</td><td>arraylist</td><td>1.67</td><td>foreach</td><td>1.71</td><td>the problem</td><td>3.77</td></tr><tr><td>dataframe</td><td>1.61</td><td>enum</td><td>1.58</td><td>iis</td><td>1.70</td><td>i don&#x27;t</td><td>3.61</td></tr><tr><td>nginx</td><td>1.55</td><td>nginx</td><td>1.55</td><td>however,</td><td>1.69</td><td>i need</td><td>3.49</td></tr></table>
367
+
368
+ # C DP FEDERATED GAN: EXPERIMENTAL DETAILS
369
+
370
+ # C.1 FEDERATED EMNIST DATA
371
+
372
+ We use the Federated EMNIST dataset (Caldas et al., 2018) to represent the app’s users’ processed data in our GAN experiments in Section 6. This dataset contains 28x28 gray-scale images (Figure 2a) of handwritten letters and numbers, grouped by writer. This has the realistic property that all data grouped to a given user exhibits the same personally-identifying handwriting properties; our solution should generate examples while obfuscating these properties. The dataset contains 3,400 users. It is available via the Tensorflow Federated open-source software framework (Ingerman & Ostrowski, 2019).
373
+
374
+ # C.2 FEDERATED GAN ARCHITECTURE AND TRAINING
375
+
376
+ Models and Losses Our generator and discriminator network architectures are borrowed from a popular GAN code tutorial7for MNIST. For the generator and discriminator loss functions, $l _ { G } ( \ v u )$ and $l _ { D } ( \ v r )$ , we used the Improved Wasserstein loss formulation presented in Gulrajani et al. (2017). We used a gradient penalty coefficient of 10.0.
377
+
378
+ Hyperparameters Table 9 gives the various hyperparameters used with the DP-FedAvg-GAN algorithm to yield generators that produced the images displayed in Figures 3, 6, 7, and 8.
379
+
380
+ Table 9: DP federated GAN experimental hyperparameters.
381
+
382
+ <table><tr><td>generator training steps n</td><td>generator batch size B</td><td>generator learning rate nG</td><td>generator input size nu</td></tr><tr><td>6</td><td>32</td><td>0.005</td><td>128</td></tr><tr><td>discriminator training steps8 n</td><td>discriminator batch size B</td><td>discriminator learning rate η D</td><td>L2 clip parameter S</td></tr><tr><td>≤6</td><td>≤32</td><td>0.0005</td><td>0.1</td></tr><tr><td>participation count qN</td><td>total users N</td><td>noise scale</td><td>number of rounds</td></tr><tr><td>10</td><td>see Table 11</td><td>2 0.01</td><td>T 1,000</td></tr></table>
383
+
384
+ Network Update Cadence For simplicity, Algorithm 1 shows a 1:1 ratio of discriminator:generator training updates. This is not required. The discriminator could go through multiple federated updates before an update to the generator is calculated, just as is the case with non-federated GANs (Goodfellow et al., 2014). In these experiments we used a 1:1 ratio of discriminator:generator training updates, as this update cadence empirically was determined to work well.
385
+
386
+ # C.3 SELECTION CRITERIA: FILTERING BY USER
387
+
388
+ The modeler ideally wishes to train one GAN on the exact subset of data affected by the bug and the other GAN on the exact subset of data unaffected by the bug, in order to best discern the difference and identify the bug. Of course, to achieve this perfectly they would need to know what the actual bug is a priori. As they don’t, the modeler must settle for focusing the two GANs to train on the subsets of the data with the highest and lowest likelihood (respectively) of being related to the bug.
389
+
390
+ A question is how to define these two subsets of the overall decentralized dataset. In the experiments in Section 6, we filter these two subsets at the level of the user (i.e., T4 in Table 1). We define criteria for a user’s app experience to be considered as ‘poor’, and if a user meets this criteria then their device belongs to the ‘poorly performing’ subpopulation. When their device is selected to participate in a round, their examples will be used to calculate updates to the GAN discriminator for this subpopulation. (The equivalent is true for identifying members of the ‘strongly performing’ subpopulation.)
391
+
392
+ The criteria we use is a user’s classification accuracy, i.e., the percentage of examples in their local dataset that were correctly classified by the primary model (the CNN). Figure 5 shows a histogram of classification accuracy for the app’s users, and Table 10 gives the 25th and 75th percentiles when no bug exists. We set accuracy thresholds of ‘poor’ (and ‘strong’) performance based on the 25th (and 75th) percentile, i.e., when no bug exists we aim to capture the $2 5 \%$ of users who experience the worst (and best) classification accuracy.
393
+
394
+ When a bug exists and performance of the primary model drops, the ‘poorly performing’ subpopulation swells and the ‘strongly performing’ subpopulation shrinks (note the shift in histogram in Figure 5 with and without the bug). That is, subpopulation size varies depending on the degree of impact of the bug. Table 11 gives the subpopulation sizes that resulted for the experiments we ran.
395
+
396
+ ![](images/41c7170936979bd798dcc6767950bff4c3688bb4e138ec3c6651d77b9cb3ff98.jpg)
397
+ Figure 5: User accuracy histogram.
398
+
399
+ Table 10: User accuracy percentiles (without bug).
400
+
401
+ <table><tr><td colspan="2">Accuracy</td></tr><tr><td>75th Percentile of Users</td><td>93.9%</td></tr><tr><td>25th Percentile of Users</td><td>88.2%</td></tr></table>
402
+
403
+ Table 11: Subpopulation sizes for simulations in Section 6. Total population size is 3,400 user devices.
404
+
405
+ <table><tr><td colspan="3">Without Bug Bug in 50% of user devices</td></tr><tr><td>High-Accuracy Users</td><td>850</td><td>425</td></tr><tr><td>Low-Accuracy Users</td><td>850</td><td>2,125</td></tr></table>
406
+
407
+ Of course, this is not a perfect manner for identifying which data contains the bug (although as the bug is unknown, no manner could be perfect a priori). The poorly performing subpopulation will always contain the $2 5 \%$ of the overall population that doesn’t classify well for reasons unrelated to any bug (e.g., users with irregular handwriting, etc.), and their data will be training the discriminator along with the data actually affected by the bug. The assumption is that either the generative model has the capacity to model both modes of data, or the unaffected data will be dwarfed by the affected data and the generative model will focus on the larger mode of data. This assumption held for this experiment, but further research on the ‘sensitivity’ of selection criteria is necessary (see Section 7 and Appendix D).
408
+
409
+ An alternative selection criteria, where data is split up by classified and misclassified examples (as opposed to by high accuracy and low accuracy users), is presented in Appendix C.4.
410
+
411
+ # C.3.1 ADDITIONAL GENERATED RESULTS
412
+
413
+ Figure 6 shows the output of two DP federated GANs trained on the best and worst-classifying devices, once the bug described in Section 6 is fixed. These synthetic images are of high-enough quality to verify to the modeler that the pixel inversion bug they observed in Figure 3 is gone.
414
+
415
+ ![](images/52b953fc26817ea647ec62b4b9353edadca3d4c1d19af0ecec2108a31148da01.jpg)
416
+ Figure 6: DP federated GAN generator output after the inversion bug is fixed.
417
+
418
+ C.4 ALTERNATIVE SELECTION CRITERIA: FILTERING BY EXAMPLE
419
+
420
+ As Section 2 describes, there are a number of selection criteria that an ML modeler might employ in the course of their modeling tasks. The experiment described in Section 6 and Appendix C.3 involved data selection that filtered ‘by user’, based on a user’s classification accuracy (i.e., T4 in Table 1). Here we demonstrate an alternative selection criteria: filtering ‘by example’, based on whether a data example was correctly classified by the primary model (i.e., T2 in Table 1). We show that we can equivalently use this alternative data selection and train DP federated GANs to debug the primary model and uncover the source of the drop in accuracy observed in Figure 5.
421
+
422
+ Informally, one can consider the difference between filter ‘by user’ and filter ‘by example’ as “train on all examples, for some users” vs. “train on some examples, for all users”. In the former, the amount of users contributing to training varied quite a bit based on whether the bug was present or absent and whether we were training the high-accuracy or low-accuracy subpopulation (Table 11). With the latter, the amount of users in a training subpopulation varies to a much smaller extent (Table 12). Some variation in subpopulation sizes is still present, due to our requiring a user device to contain a minimum number of examples of a classification result (either ‘correctly classified’ or ‘misclassified’) in order for it to participate in training for that particular subpopulation. This minimum number of examples threshold is applied to mitigate effect of outliers. In the experiment we used a threshold of 5.
423
+
424
+ Table 12: Subpopulation sizes for filter ‘by example’ simulations, when excluding a user’s participation in subpopulation if containing $< 5$ examples of classification result. Total population size is 3,400 users.
425
+
426
+ <table><tr><td colspan="3">Without Bug1 Bug in 50% of user devices</td></tr><tr><td>Correctly Classified Examples</td><td>3,400</td><td>2,905</td></tr><tr><td>Misclassified Examples</td><td>3,282</td><td>3,340</td></tr></table>
427
+
428
+ Experiment As in Section 6, we train two distinct DP federated GANs via Algorithm 1, in order to infer the nature of the bug from the contrast in synthesized content between the two. One GAN trains on the examples on each device that were correctly classified by the primary model, and the other trains on examples that were misclassified. We again trained each GAN for 1,000 communication rounds involving 10 users per round.
429
+
430
+ Figures 7a and 7b show examples of images generated by the two GANs when trained with the bug present on $50 \%$ of users’ mobile phones. As with the ‘by user’ experiment, the ‘by example’ results here show that DP federated GANs can be trained to high enough fidelity to clearly distinguish that some private data has black and white reversed. Figures 8a and 8b show examples of images generated by the two GANs when trained with the bug present on no phones (e.g., after the bug is fixed).
431
+
432
+ ![](images/dae35fbf979c43e3dafdb893cd60899b86ebcb679cfdb0015f84d127dc4fe309.jpg)
433
+ (b) Trained on misclassified examples (for all users).
434
+
435
+ ![](images/717e0a78b26ce4c7e0eb8b3686e0ebb914ed86c9f83871054ef9a1e614d8bea1.jpg)
436
+ Figure 7: Filter ‘by example’ simulation: generator output with the inversion bug present on $50 \%$ of devices.
437
+
438
+ (a) Trained on correctly classified examples (for all users).
439
+
440
+ Privacy at Scale Privacy bounds for these ‘by example’ experiments are determined in analogous fashion to the ‘by user’ experiments in Section 6. In simulation we ran with 10 users per round and total population size of 3,400, to validate good utility in the presence of clipping and noising. While the $\epsilon$ and $\delta$ bounds
441
+
442
+ ![](images/b5c3b788fc49c56eaa492758f4acfbb2aac1c3e75243eab21756edea53e4da0b.jpg)
443
+
444
+ (a) Trained on correctly classified examples (for all users).
445
+
446
+ ![](images/fe20c1373d53af1c0143293aef283bc0a415d6610dd1de2f8840db91a20ca829.jpg)
447
+ (b) Trained on misclassified examples (for all users).
448
+ Figure 8: Filter ‘by example’ simulation: generator output after the inversion bug is fixed.
449
+
450
+ Table 13: Privacy parameters for different filter ‘by example’ (T2) scenarios. $N$ is size of user subpopulation that meets selection criteria (not overall population size). Simulations are with overall population of 3,400, and realistic scenarios are with overall population of 2,000,000. All experiments use clip parameter $S$ of 0.1 and 1,000 rounds.
451
+
452
+ <table><tr><td></td><td>qN</td><td>N</td><td>2</td><td>E</td><td>8</td></tr><tr><td>simulation (Figure 7a)</td><td>10</td><td>2,905</td><td>0.01</td><td>9.99×106</td><td>3.44×10-4</td></tr><tr><td>realistic scenario</td><td>1,000</td><td>1,708,824</td><td>1.00</td><td>1.47</td><td>5.85×10-9</td></tr><tr><td>simulation (Figure 7b)</td><td>10</td><td>3,340</td><td>0.01</td><td>9.99×106</td><td>2.99×10-4</td></tr><tr><td>realistic scenario</td><td>1,000</td><td>1,964,706</td><td>1.00</td><td>1.40</td><td>5.09×10-9</td></tr><tr><td>simulation (Figure 8a)</td><td>10</td><td>3,400</td><td>0.01</td><td>9.99×106</td><td>2.94×10-4</td></tr><tr><td>realistic scenario</td><td>1,000</td><td>2,000,000</td><td>1.00</td><td>1.39</td><td>5.00×10-9</td></tr><tr><td>simulation (Figure 8b)</td><td>10</td><td>3,282</td><td>0.01</td><td>9.99×106</td><td>3.05×10-4</td></tr><tr><td>realistic scenario</td><td>1,000</td><td>1,930, 588</td><td>1.00</td><td>1.40</td><td>5.18×10-9</td></tr></table>
453
+
454
+ do not guarantee meaningful privacy protection at this small scale of participants, the amount of clipping and noising are such that if we to scale up to a larger realistic scenario, we have meaningful DP guarantees. Table 13 summarizes the privacy bounds, and shows we achieve single digit $\epsilon$ bounds for realistic scenarios involving 1,000 users per round and total population size of 2,000,000 user devices. (For each realistic scenario, we estimated the number of devices $N$ in the user subpopulation by taking the same proportion of users out of the overall population as occurred in the corresponding simulation scenario.) Reiterating from Section 6, this scale of orchestration is feasible for real-world production FL systems, e.g. Bonawitz et al. (2019).
455
+
456
+ # D OPEN PROBLEMS
457
+
458
+ The intent of this paper is to highlight the gaps in a modeler’s data inspection toolbox when undertaking private, decentralized learning, and to present what appears to be a promising solution direction involving generative models. To say that open work remains is an understatement, and there are many interesting topics to consider in this new space.
459
+
460
+ Alternative Notions of Privacy In this paper we implemented user-level privacy via the mechanism of $( \epsilon , \delta )$ -differential privacy (DP), and considered acceptable privacy to be achieved via single-digit bounds on $\epsilon$ . Other useful notions of privacy exist, e.g. Carlini et al. (2018) defines a concept called exposure, a more empirical measure of data disclosure that takes into account the network training process. Research like Carlini et al. (2018) and Jayaraman & Evans (2019) shows that for many problems a large gap exists between empirical measures and DP’s measure of privacy risk. While DP is tighter, empirical concepts like exposure may prove to be more practically useful for a given application; even if the $\epsilon$ bound is larger than singledigits, exposure can indicate that data memorization is not taking place and privacy protected. Exploring how alternative concepts of privacy affect the utility of federated generative models could improve their usefulness. (This topic connects with the FedGP work in Triastcyn & Faltings (2019) exploring differential average-case privacy for federated GAN training.)
461
+
462
+ Sensitivity The GAN experiment in Section 6 demonstrated debugging when $50 \%$ of user devices have been affected. The RNN experiment in Section 5 demonstrated debugging when $10 \%$ of examples have been affected. In Appendix B we present RNN results with differing percentages of affected examples, but in general a question remains: how sensitive to the presence of a bug are such federated generative models? Is there a minimum percentage of users or examples that’s required in a composite data distribution such that the model learns to generate examples from that part of the distribution? This is of particular interest in the case of GANs, which are known to suffer from problems of mode collapse (Salimans et al., 2016).
463
+
464
+ Federated GAN Training We chose GANs for this paper as they had not (to our knowledge) previously been trained with FL and DP, and developing an algorithm to do so was an open question. Apart from the DP-FedAvg-GAN algorithm we present, the GAN used is relatively simplistic (see details in Appendix C.2). Exploring the space of GAN techniques to study which losses and model architectures are most amenable to privatization (e.g., scaling and noising for DP) and federation would be immensely useful.
465
+
466
+ Other Classes of Generative Models Other types of generative models exist, with interesting questions on how to federate them. For example, Variational Autoencoders (VAEs) involve an encoder mapping highdimensional data examples to a lower-dimensional latent space, and a decoder mapping from latent space back to high-dimensional space. With decentralized user-private data, is a useful paradigm to have each user have a personalized, private encoder (specific to the particulars of their local data and how it maps to the latent space), with a common decoder serving as synthesis engine mapping latent space to examples?
467
+
468
+ Federating Contrastive or Triplet Losses A class of ML losses involve distinguishing examples (or users) from each other. An example is the triplet loss used for FaceNet in Schroff et al. (2015). The loss is the sum of a reward based on similarity to a positive example and a penalty based on similarity to a negative example. For such loss calculations, a compute node requires access to both positive and negative examples.
469
+
470
+ FL protects not only the privacy of users from the coordinating server, but also the privacy of users from each other; each user’s data resides in a distinct silo. Computing a triplet loss on a user’s device requires access to negative examples of data (i.e., from other users), which is not directly possible. DP federated generative models offer a potential solution. If one can be trained to embody a user population, it can then be shipped to users’ devices to serve as an engine providing synthetic negative examples for the triplet loss calculation.
md/train/Skeq30NFPr/Skeq30NFPr.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/SyOvg6jxx/SyOvg6jxx.md ADDED
@@ -0,0 +1,372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # #Exploration: A Study of Count-Based Exploration for Deep Reinforcement Learning
2
+
3
+ Haoran $\mathbf { T a n g ^ { 1 * } }$ , Rein Houthooft3,4∗, Davis Foote2, Adam Stooke2, Xi Chen2,4, Yan Duan2 4, John Schulman4, Filip De Turck3, Pieter Abbeel 2 4
4
+
5
+ 1 UC Berkeley, Department of Mathematics
6
+ 2 UC Berkeley, Department of Electrical Engineering and Computer Sciences
7
+ 3 Ghent University – imec, Department of Information Technology
8
+ 4 OpenAI
9
+
10
+ # Abstract
11
+
12
+ Count-based exploration algorithms are known to perform near-optimally when used in conjunction with tabular reinforcement learning (RL) methods for solving small discrete Markov decision processes (MDPs). It is generally thought that count-based methods cannot be applied in high-dimensional state spaces, since most states will only occur once. Recent deep RL exploration strategies are able to deal with high-dimensional continuous state spaces through complex heuristics, often relying on optimism in the face of uncertainty or intrinsic motivation. In this work, we describe a surprising finding: a simple generalization of the classic count-based approach can reach near state-of-the-art performance on various highdimensional and/or continuous deep RL benchmarks. States are mapped to hash codes, which allows to count their occurrences with a hash table. These counts are then used to compute a reward bonus according to the classic count-based exploration theory. We find that simple hash functions can achieve surprisingly good results on many challenging tasks. Furthermore, we show that a domain-dependent learned hash code may further improve these results. Detailed analysis reveals important aspects of a good hash function: 1) having appropriate granularity and 2) encoding information relevant to solving the MDP. This exploration strategy achieves near state-of-the-art performance on both continuous control tasks and Atari 2600 games, hence providing a simple yet powerful baseline for solving MDPs that require considerable exploration.
13
+
14
+ # 1 Introduction
15
+
16
+ Reinforcement learning (RL) studies an agent acting in an initially unknown environment, learning through trial and error to maximize rewards. It is impossible for the agent to act near-optimally until it has sufficiently explored the environment and identified all of the opportunities for high reward, in all scenarios. A core challenge in RL is how to balance exploration—actively seeking out novel states and actions that might yield high rewards and lead to long-term gains; and exploitation—maximizing short-term rewards using the agent’s current knowledge. While there are exploration techniques for finite MDPs that enjoy theoretical guarantees, there are no fully satisfying techniques for highdimensional state spaces; therefore, developing more general and robust exploration techniques is an active area of research.
17
+
18
+ Most of the recent state-of-the-art RL results have been obtained using simple exploration strategies such as uniform sampling (Mnih et al., 2015) and i.i.d./correlated Gaussian noise (Schulman et al., 2015; Lillicrap et al., 2015). Although these heuristics are sufficient in tasks with well-shaped rewards, the sample complexity can grow exponentially (with state space size) in tasks with sparse rewards (Osband et al., 2016b). Recently developed exploration strategies for deep RL have led to significantly improved performance on environments with sparse rewards. Bootstrapped DQN (Osband et al., 2016a) led to faster learning in a range of Atari 2600 games by training an ensemble of Q-functions. Intrinsic motivation methods using pseudo-counts achieve state-of-the-art performance on Montezuma’s Revenge, an extremely challenging Atari 2600 game (Bellemare et al., 2016). Variational Information Maximizing Exploration (VIME, Houthooft et al. (2016)) encourages the agent to explore by acquiring information about environment dynamics, and performs well on various robotic locomotion problems with sparse rewards. However, we have not seen a very simple and fast method that can work across different domains.
19
+
20
+ Some of the classic, theoretically-justified exploration methods are based on counting state-action visitations, and turning this count into a bonus reward. In the bandit setting, the well-known UCB algorithm of Lai & Robbins (1985) chooses the action $a _ { t }$ at time $t$ that maximizes $\begin{array} { r } { \hat { r } ( a _ { t } ) + \sqrt { \frac { 2 \log t } { n ( a _ { t } ) } } } \end{array}$ where $\hat { r } ( a _ { t } )$ is the estimated reward, and $n ( a _ { t } )$ is the number of times action $a _ { t }$ was previously chosen. In the MDP setting, some of the algorithms have similar structure, for example, Model Based Interval Estimation–Exploration Bonus (MBIE-EB) of Strehl & Littman (2008) counts state-action pairs with a table $n ( s , a )$ and adding a bonus reward of the form $\frac { \beta } { \sqrt { n ( s , a ) } }$ to encourage exploring less visited pairs. Kolter & $\mathrm { N g }$ , (2009) show that the inverse-square-root dependence is optimal. MBIE and related algorithms assume that the augmented MDP is solved analytically at each timestep, which is only practical for small finite state spaces.
21
+
22
+ This paper presents a simple approach for exploration, which extends classic counting-based methods to high-dimensional, continuous state spaces. We discretize the state space with a hash function and apply a bonus based on the state-visitation count. The hash function can be chosen to appropriately balance generalization across states, and distinguishing between states. We select problems from rllab (Duan et al., 2016) and Atari 2600 (Bellemare et al., 2012) featuring sparse rewards, and demonstrate near state-of-the-art performance on several games known to be hard for naïve exploration strategies. The main strength of the presented approach is that it is fast, flexible and complementary to most existing RL algorithms.
23
+
24
+ In summary, this paper proposes a generalization of classic count-based exploration to high-dimensional spaces through hashing (Section 2); demonstrates its effectiveness on challenging deep RL benchmark problems and analyzes key components of well-designed hash functions (Section 3).
25
+
26
+ # 2 Methodology
27
+
28
+ # 2.1 Notation
29
+
30
+ This paper assumes a finite-horizon discounted Markov decision process (MDP), defined by $( S , \mathcal { A } , \mathcal { P } , r , \rho _ { 0 } , \gamma , T )$ , in which $s$ is the state space, $\mathcal { A }$ the action space, $\mathcal { P }$ a transition proba, , , , ρ , γ,bility distribution, $r : S \times \mathcal { A } \to \mathbb { R } _ { \geq 0 }$ a reward function, $\rho _ { 0 }$ an initial state distribution, $\gamma \in ( 0 , 1 ]$ a discount factor, and f $T$ ρ γ ,the horizon. The goal of RL is to maximize the total expected discountedg reward $\begin{array} { r } { \mathbb { E } _ { \pi , \mathcal { P } } \left[ \sum _ { t = 0 } ^ { T } \gamma ^ { t } r ( s _ { t } , a _ { t } ) \right] } \end{array}$ over a policy $\pi$ , which outputs a distribution over actions given a state.
31
+
32
+ # 2.2 Count-Based Exploration via Static Hashing
33
+
34
+ Our approach discretizes the state space with a hash function $\phi : S \to \mathbb { Z }$ . An exploration bonus is added to the reward function, defined as
35
+
36
+ $$
37
+ r ^ { + } ( s , a ) = \frac { \beta } { \sqrt { n ( \phi ( s ) ) } } ,
38
+ $$
39
+
40
+ where $\beta \in \mathbb { R } _ { \geq 0 }$ is the bonus coefficient. Initially the counts $n ( \cdot )$ are set to zero for the whole range of $\phi$ β. For every state $s _ { t }$ encountered at time step $t$ , $n ( \phi ( s _ { t } ) )$ is increased by one. The agent is trained φwith rewards $( r + r ^ { + } )$ φ, while performance is evaluated as the sum of rewards without bonuses.
41
+
42
+ Note that our approach is a departure from count-based exploration methods such as MBIE-EB since we use a state-space count $n ( s )$ rather than a state-action count $n ( s , a )$ . State-action counts $n ( s , a )$ , ,are investigated in Appendix A.6, but no significant performance gains over state counting could be witnessed.
43
+
44
+ 1 Define state preprocessor $g : S \to { \mathbb { R } ^ { K } }$
45
+ 2 (In case of SimHash) Initialize $A \in \mathbb { R } ^ { k \times K }$ with entries drawn i.i.d. from the standard Gaussian distribution $N ( 0 , 1 )$
46
+ ,3 Initialize a hash table with values $n ( \cdot ) \equiv 0$
47
+ 4 for each iteration $j$ do
48
+ 5 Collect a set of state-action samples $\{ ( s _ { m } , a _ { m } ) \} _ { m = 0 } ^ { M }$ with policy $\pi$
49
+ 6 , πCompute hash codes through any LSH method, e.g., for SimHash, $\phi ( s _ { m } ) = \operatorname { s g n } ( A g ( s _ { m } ) )$
50
+ 7 Update the hash table counts $\forall m : 0 \leq m \leq M$ as $n ( \phi ( s _ { m } ) ) n ( \phi ( s _ { m } ) ) + 1$
51
+ 8 Update the policy $\pi$ using rewards $\begin{array} { r } { \bigg \{ r ( s _ { m } , a _ { m } ) + \frac { \beta } { \sqrt { n ( \phi ( s _ { m } ) ) } } \bigg \} _ { m = 0 } ^ { M } } \end{array}$ with any RL algorithm
52
+
53
+ Clearly the performance of this method will strongly depend on the choice of hash function $\phi$ . One φimportant choice we can make regards the granularity of the discretization: we would like for “distant” states to be be counted separately while “similar” states are merged. If desired, we can incorporate prior knowledge into the choice of $\phi$ , if there would be a set of salient state features which are known to be relevant.
54
+
55
+ Algorithm 1 summarizes our method. The main idea is to use locality-sensitive hashing (LSH) to convert continuous, high-dimensional data to discrete hash codes. LSH is a popular class of hash functions for querying nearest neighbors based on certain similarity metrics (Andoni $\&$ Indyk, 2006). A computationally efficient type of LSH is SimHash (Charikar, 2002), which measures similarity by angular distance. SimHash retrieves a binary code of state $s \in S$ as
56
+
57
+ $$
58
+ \phi ( s ) = \operatorname { s g n } ( A g ( s ) ) \in \{ - 1 , 1 \} ^ { k } ,
59
+ $$
60
+
61
+ where $g : S \mathbb { R } ^ { d }$ is an optional preprocessing function and $A$ is a $k \times d$ matrix with i.i.d. entries drawn from a standard Gaussian distribution $N ( 0 , 1 )$ . The value for $k$ controls the granularity: higher ,values lead to fewer collisions and are thus more likely to distinguish states.
62
+
63
+ # 2.3 Count-Based Exploration via Learned Hashing
64
+
65
+ When the MDP states have a complex structure, as is the case with image observations, measuring their similarity directly in pixel space fails to provide the semantic similarity measure one would desire. Previous work in computer vision (Lowe, 1999; Dalal & Triggs, 2005; Tola et al., 2010) introduce manually designed feature representations of images that are suitable for semantic tasks including detection and classification. More recent methods learn complex features directly from data by training convolutional neural networks (Krizhevsky et al., 2012; Simonyan & Zisserman, 2014; He et al., 2015). Considering these results, it may be difficult for SimHash to cluster states appropriately using only raw pixels.
66
+
67
+ ![](images/fb4582a662e173f79d27cec1b6c5fc7d7c3c6da61f9553210eb95cbf03c39201.jpg)
68
+ Figure 1: The autoencoder (AE) architecture; the solid block represents the dense sigmoidal binary code layer, after which noise $U ( - a , a )$ is injected.
69
+
70
+ Therefore, we propose to use an autoencoder (AE) consisting of convolutional, dense, and transposed convolutional layers to learn meaningful hash codes in one of its hidden layers. This AE takes as input states $s$ and contains one special dense layer comprised of $K$ saturating activation functions,
71
+
72
+ 1 Define state preprocessor $g : S \to { \mathbb { B } } ^ { K }$ as the binary code resulting from the autoencoder (AE)
73
+ 2 Initialize $A \in \mathbb { R } ^ { k \times K }$ with entries drawn i.i.d. from the standard Gaussian distribution $N ( 0 , 1 )$
74
+ 3 Initialize a hash table with values $n ( \cdot ) \equiv 0$
75
+ 4 for each iteration $j$ do
76
+ 5 Collect a set of state-action samples $\{ ( s _ { m } , a _ { m } ) \} _ { m = 0 } ^ { M }$ with policy $\pi$
77
+ 6 Add the state samples $\{ s _ { m } \} _ { m = 0 } ^ { M }$ , to a FIFO replay pool $\mathcal { R }$
78
+ 7 if $j$ mod $j _ { \mathrm { u p d a t e } } = 0$ then
79
+ 8 Update the AE loss function in Eq. (3) using samples drawn from the replay pool
80
+ $\{ s _ { n } \} _ { n = 1 } ^ { N } \sim \mathcal { R }$ , for example using stochastic gradient descent
81
+ 9 Compute $g ( s _ { m } ) = \lfloor b ( s _ { m } ) \rceil$ , the $K$ -dim rounded hash code for $s _ { m }$ learned by the AE
82
+ 10 Project $g ( s _ { m } )$ to a lower dimension $k$ via SimHash as $\phi ( s _ { m } ) = \operatorname { s g n } ( A g ( s _ { m } ) )$
83
+ 11 Update the hash table counts $\forall m : 0 \leq m \leq M$ as $n ( \phi ( s _ { m } ) ) n ( \phi ( s _ { m } ) ) + 1$
84
+ 12 Update the policy $\pi$ using rewards $\begin{array} { r } { \bigg \{ r ( s _ { m } , a _ { m } ) + \frac { \beta } { \sqrt { n ( \phi ( s _ { m } ) ) } } \bigg \} _ { m = } ^ { M } } \end{array}$ with any RL algorithm
85
+
86
+ more specifically sigmoid functions. By rounding the sigmoid output $b ( s )$ of this layer to the closest binary number, any state $s$ can be binarized.
87
+
88
+ Since gradients cannot be back-propagated through a rounding function, an alternative method must be used to ensure that distinct states are mapped to distinct binary codes. Therefore, uniform noise $U ( - a , a )$ is added to the sigmoid output. By choosing uniform noise with a sufficiently high variance, ,the AE is only capable of reconstructing distinct inputs $s$ if its hidden dense layer outputs values $b ( s )$ that are sufficiently far apart from each other (Gregor et al., 2016). Feeding a state $s$ to the AE input, extracting $b ( s )$ and rounding it to $\lfloor b ( s ) \rceil$ yields a learned binary code. As such, the loss function $L ( \cdot )$ over a set of collected states $\{ s _ { i } \} _ { i = 1 } ^ { N }$ is defined as
89
+
90
+ $$
91
+ L \left( \{ s _ { n } \} _ { n = 1 } ^ { N } \right) = - \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \left[ \log p ( s _ { n } ) - \frac { \lambda } { K } \sum _ { i = 1 } ^ { K } \operatorname* { m i n } \left\{ \left( 1 - b _ { i } ( s _ { n } ) \right) ^ { 2 } , b _ { i } ( s _ { n } ) ^ { 2 } \right\} \right] .
92
+ $$
93
+
94
+ This objective function consists of a cross-entropy term and a term that pressures the binary code layer to take on binary values, scaled by $\lambda \in \mathbb { R } _ { \ge 0 }$ . The reasoning behind this is that uniform noise $U ( - a , a )$ λ ,alone is insufficient, in case the AE does not use a particular sigmoid unit. This term ensures that an unused binary code output is assigned an arbitrary binary value. When omitting this term, the code is more prone to oscillations, causing unwanted bit flips, and destabilizing the counting process.
95
+
96
+ In order to make the AE train sufficiently fast—which is required since it is updated during the agent’s training—we make use of a pixel-wise softmax output layer (van den Oord et al., 2016) that shares weights between all pixels. The different softmax outputs merge together pixel intensities into discrete bins. The architectural details are described in Appendix A.1 and are depicted in Figure 1. Because the code dimension often needs to be large in order to correctly reconstruct the input, we apply a downsampling procedure to the resulting binary code $\lfloor b ( s ) \rceil$ , which can be done through random projection to a lower-dimensional space via SimHash as in Eq. (2).
97
+
98
+ One the one hand, it is important that the mapping from state to code needs to remain relatively consistent over time, which is nontrivial as the AE is constantly updated according to the latest data (Algorithm 2 line 8). An obvious solution would be to significantly downsample the binary code to a very low dimension, or by slowing down the training process. But on the other hand, the code has to remain relatively unique for states that are both distinct and close together on the image manifold. This is tackled both by the second term in Eq. (3) and by the saturating behavior of the sigmoid units. As such, states that are already well represented in the AE hidden layers tend to saturate the sigmoid units, causing the resulting loss gradients to be close to zero and making the code less prone to change.
99
+
100
+ # 3 Experiments
101
+
102
+ Experiments were designed to investigate and answer the following research questions:
103
+
104
+ 1. Can count-based exploration through hashing improve performance significantly across different domains? How does the proposed method compare to the current state of the art in exploration for deep RL?
105
+ 2. What is the impact of learned or static state preprocessing on the overall performance when image observations are used?
106
+ 3. What factors contribute to good performance, e.g., what is the appropriate level of granularity of the hash function?
107
+
108
+ To answer question 1, we run the proposed method on deep RL benchmarks (rllab and ALE) that feature sparse rewards, and compare it to other state-of-the-art algorithms. Question 2 is answered by trying out different image preprocessors on Atari 2600 games. Finally, we investigate question 3 in Section 3.3 and 3.4. Trust Region Policy Optimization (TRPO, Schulman et al. (2015)) is chosen as the RL algorithm for all experiments, because it can handle both discrete and continuous action spaces, it can conveniently ensure stable improvement in the policy performance, and is relatively insensitive to hyperparameter changes. The hyperparameters settings are reported in Appendix A.1.
109
+
110
+ # 3.1 Continuous Control
111
+
112
+ The rllab benchmark (Duan et al., 2016) consists of various control tasks to test deep RL algorithms. We selected several variants of the basic and locomotion tasks that use sparse rewards, as shown in Figure 2, and adopt the experimental setup as defined in (Houthooft et al., 2016)—a description can be found in Appendix A.2. These tasks are all highly difficult to solve with naïve exploration strategies, such as adding Gaussian noise to the actions.
113
+
114
+ ![](images/b361a9b8e95718220308863d606ae375328e7733c70f739e9726b183648949f3.jpg)
115
+ Figure 2: Illustrations of the rllab tasks used in the continuous control experiments, namely MountainCar, CartPoleSwingup, SimmerGather, and HalfCheetah; taken from (Duan et al., 2016).
116
+
117
+ ![](images/3bddef7257aca125ef3ed901547493485ea605e4b0e6a4992fb9a784035e4180.jpg)
118
+ Figure 3: Mean average return of different algorithms on rllab tasks with sparse rewards; the solid line represents the mean average return, while the shaded area represents one standard deviation, over 5 seeds for the baseline and SimHash.
119
+
120
+ Figure 3 shows the results of TRPO (baseline), TRPO-SimHash, and VIME (Houthooft et al., 2016) on the classic tasks MountainCar and CartPoleSwingup, the locomotion task HalfCheetah, and the hierarchical task SwimmerGather. Using count-based exploration with hashing is capable of reaching the goal in all environments (which corresponds to a nonzero return), while baseline TRPO with Gaussian control noise fails completely. Although TRPO-SimHash picks up the sparse reward on HalfCheetah, it does not perform as well as VIME. In contrast, the performance of SimHash is comparable with VIME on MountainCar, while it outperforms VIME on SwimmerGather.
121
+
122
+ # 3.2 Arcade Learning Environment
123
+
124
+ The Arcade Learning Environment (ALE, Bellemare et al. (2012)), which consists of Atari 2600 video games, is an important benchmark for deep RL due to its high-dimensional state space and wide variety of games. In order to demonstrate the effectiveness of the proposed exploration strategy, six games are selected featuring long horizons while requiring significant exploration: Freeway, Frostbite, Gravitar, Montezuma’s Revenge, Solaris, and Venture. The agent is trained for 500 iterations in all experiments, with each iteration consisting of $0 . 1 { \bf M }$ steps (the TRPO batch size, corresponds to $0 . 4 { \bf M }$ . .frames). Policies and value functions are neural networks with identical architectures to (Mnih et al., 2016). Although the policy and baseline take into account the previous four frames, the counting algorithm only looks at the latest frame.
125
+
126
+ BASS To compare with the autoencoder-based learned hash code, we propose using Basic Abstraction of the ScreenShots (BASS, also called Basic; see Bellemare et al. (2012)) as a static preprocessing function g. BASS is a hand-designed feature transformation for images in Atari 2600 games. BASS builds on the following observations specific to Atari: 1) the game screen has a low resolution, 2) most objects are large and monochrome, and 3) winning depends mostly on knowing object locations and motions. We designed an adapted version of BASS1, that divides the RGB screen into square cells, computes the average intensity of each color channel inside a cell, and assigns the resulting values to bins that uniformly partition the intensity range [0 255]. Mathematically, let $C$ be the cell size (width and height), $B$ the number of bins, $( i , j )$ ,cell location, $( x , y )$ pixel location, and $z$ the channel.
127
+
128
+ $$
129
+ \begin{array} { r } { \mathrm { f e a t u r e } ( i , j , z ) = \left\lfloor { \frac { B } { 2 5 5 C ^ { 2 } } } \sum _ { ( x , y ) \in \mathrm { c e l l } ( i , j ) } I ( x , y , z ) \right\rfloor . } \end{array}
130
+ $$
131
+
132
+ Afterwards, the resulting integer-valued feature tensor is converted to an integer hash code $\mathbf { \nabla } _ { \phi } ( s _ { t } )$ in φLine 6 of Algorithm 1). A BASS feature can be regarded as a miniature that efficiently encodes object locations, but remains invariant to negligible object motions. It is easy to implement and introduces little computation overhead. However, it is designed for generic Atari game images and may not capture the structure of each specific game very well.
133
+
134
+ Table 1: Atari 2600: average total reward after training for $5 0 \mathrm { M }$ time steps. Boldface numbers indicate best results. Italic numbers are the best among our methods.
135
+
136
+ <table><tr><td></td><td>Freeway</td><td>Frostbite1</td><td>Gravitar</td><td>Montezuma</td><td>Solaris</td><td>Venture</td></tr><tr><td>TRPO (baseline)</td><td>16.5</td><td>2869</td><td>486</td><td>0</td><td>2758</td><td>121</td></tr><tr><td>TRPO-pixel-SimHash</td><td>31.6</td><td>4683</td><td>468</td><td>0</td><td>2897</td><td>263</td></tr><tr><td>TRPO-BASS-SimHash</td><td>28.4</td><td>3150</td><td>604</td><td>238</td><td>1201</td><td>616</td></tr><tr><td>TRPO-AE-SimHash</td><td>33.5</td><td>5214</td><td>482</td><td>75</td><td>4467</td><td>445</td></tr><tr><td>Double-DQN</td><td>33.3</td><td>1683</td><td>412</td><td>0</td><td>3068</td><td>98.0</td></tr><tr><td>Dueling network</td><td>0.0</td><td>4672</td><td>588</td><td>0</td><td>2251</td><td>497</td></tr><tr><td>Gorila</td><td>11.7</td><td>605</td><td>1054</td><td>4</td><td>N/A</td><td>1245</td></tr><tr><td>DQN Pop-Art</td><td>33.4</td><td>3469</td><td>483</td><td>0</td><td>4544</td><td>1172</td></tr><tr><td>A3C+</td><td>27.3</td><td>507</td><td>246</td><td>142</td><td>2175</td><td>0</td></tr><tr><td>pseudo-count²</td><td>29.2</td><td>1450</td><td>/</td><td>3439</td><td></td><td>369</td></tr></table>
137
+
138
+ 1 While Vezhnevets et al. (2016) reported best score 8108, their evaluation was based on top 5 agents trained with 500M time steps, hence not comparable. 2 Results reported only for $2 5 \mathbf { M }$ time steps ( $1 0 0 \mathbf { M }$ frames).
139
+
140
+ We compare our results to double DQN (van Hasselt et al., 2016b), dueling network (Wang et al., 2016), ${ \bf A } 3 { \bf C } +$ (Bellemare et al., 2016), double DQN with pseudo-counts (Bellemare et al., 2016), Gorila (Nair et al., 2015), and DQN Pop-Art (van Hasselt et al., 2016a) on the “null op” metric2. We show training curves in Figure 4 and summarize all results in Table 1. Surprisingly, TRPO-pixelSimHash already outperforms the baseline by a large margin and beats the previous best result on Frostbite. TRPO-BASS-SimHash achieves significant improvement over TRPO-pixel-SimHash on
141
+
142
+ Montezuma’s Revenge and Venture, where it captures object locations better than other methods.3
143
+ TRPO-AE-SimHash achieves near state-of-the-art performance on Freeway, Frostbite and Solaris.4
144
+
145
+ ![](images/7b881fc3dab477957b5fae40811e112642ed0c282e638819df700bebd28f689a.jpg)
146
+ Figure 4: Atari 2600 games: the solid line is the mean average undiscounted return per iteration, while the shaded areas represent the one standard deviation, over 5 seeds for the baseline, TRPOpixel-SimHash, and TRPO-BASS-SimHash, while over 3 seeds for TRPO-AE-SimHash.
147
+
148
+ As observed in Table 1, preprocessing images with BASS or using a learned hash code through the AE leads to much better performance on Gravitar, Montezuma’s Revenge and Venture. Therefore, an static or adaptive preprocessing step can be important for a good hash function.
149
+
150
+ In conclusion, our count-based exploration method is able to achieve remarkable performance gains even with simple hash functions like SimHash on the raw pixel space. If coupled with domain-dependent state preprocessing techniques, it can sometimes achieve far better results.
151
+
152
+ # 3.3 Granularity
153
+
154
+ While our proposed method is able to achieve remarkable results without requiring much tuning, the granularity of the hash function should be chosen wisely. Granularity plays a critical role in count-based exploration, where the hash function should cluster states without under-generalizing or over-generalizing. Table 2 summarizes granularity parameters for our hash functions. In Table 3 we summarize the performance of TRPO-pixel-SimHash under different granularities. We choose Frostbite and Venture on which TRPO-pixel-SimHash outperforms the baseline, and choose as reward bonus coefficient $\textstyle { \beta = 0 . 0 1 \times { \frac { 2 5 6 } { k } } }$ to keep average bonus rewards at approximately the same scale. $k = 1 6$ β . only corresponds to 65536 distinct hash codes, which is insufficient to distinguish between semantically distinct states and hence leads to worse performance. We observed that $k = 5 1 2$ tends to capture trivial image details in Frostbite, leading the agent to believe that every state is new and equally worth exploring. Similar results are observed while tuning the granularity parameters for TRPO-BASS-SimHash and TRPO-AE-SimHash.
155
+
156
+ The best granularity depends on both the hash function and the MDP. While adjusting granularity parameter, we observed that it is important to lower the bonus coefficient as granularity is increased. This is because a higher granularity is likely to cause lower state counts, leading to higher bonus rewards that may overwhelm the true rewards.
157
+
158
+ Table 2: Granularity parameters of various hash functions
159
+
160
+ <table><tr><td>SimHash</td><td>k: size of the binary code</td></tr><tr><td>BASS</td><td>C: cell size;B: number of bins for each color channel</td></tr><tr><td>AE</td><td>k: down stream SimHash parameter; size of the binary code λ: binarization parameter</td></tr><tr><td></td><td>SmartHashs: grid size for the agent&#x27;s (x,y) coordinates</td></tr></table>
161
+
162
+ Table 3: Average score at $5 0 \mathrm { M }$ time steps achieved by TRPO-pixel-SimHash
163
+
164
+ <table><tr><td>k</td><td>16</td><td>64</td><td>128</td><td>256</td><td>512</td></tr><tr><td>Frostbite</td><td>3326</td><td>4029</td><td>3932</td><td>4683</td><td>1117</td></tr><tr><td> Venture</td><td>0</td><td>218</td><td>142</td><td>263</td><td>306</td></tr></table>
165
+
166
+ Table 4: Average score at $5 0 \mathrm { M }$ time steps achieved by TRPO-SmartHash on Montezuma’s Revenge (RAM observations)
167
+
168
+ <table><tr><td>S</td><td>1</td><td>5</td><td>10</td><td>20</td><td>40</td><td>60</td></tr><tr><td>score</td><td>2598</td><td>2500</td><td>3533</td><td>3025</td><td>2500</td><td>1921</td></tr></table>
169
+
170
+ # 3.4 A Case Study of Montezuma’s Revenge
171
+
172
+ Montezuma’s Revenge is widely known for its extremely sparse rewards and difficult exploration (Bellemare et al., 2016). While our method does not outperform Bellemare et al. (2016) on this game, we investigate the reasons behind this through various experiments. The experiment process below again demonstrates the importance of a hash function having the correct granularity and encoding relevant information for solving the MDP.
173
+
174
+ Our first attempt is to use game RAM states instead of image observations as inputs to the policy (details in Appendix A.1), which leads to a game score of 2500 with TRPO-BASS-SimHash. Our second attempt is to manually design a hash function that incorporates domain knowledge, called SmartHash, which uses an integer-valued vector consisting of the agent’s $( x , y )$ location, room number ,and other useful RAM information as the hash code (details in Appendix A.3). The best SmartHash agent is able to obtain a score of 3500. Still the performance is not optimal. We observe that a slight change in the agent’s coordinates does not always result in a semantically distinct state, and thus the hash code may remain unchanged. Therefore we choose grid size $s$ and replace the √ $x$ coordinate by $\lfloor ( x - x _ { \mathrm { m i n } } ) / s \rfloor$ (similarly for $y$ ). The bonus coefficient is chosen as $\beta = 0 . 0 \bar { 1 } \sqrt { s }$ to maintain the scale / β .relative to the true reward5 (see Table 4). Finally, the best agent is able to obtain 6600 total rewards after training for 1000 iterations ( $1 0 0 0 \mathbf { M }$ time steps), with a grid size $s = 1 0$ .
175
+
176
+ ![](images/be0d5543a0ab05f99beefa2981092d2dbb3a8aa035a340793a06231dfa7e6ede.jpg)
177
+ Figure 5: SmartHash results on Montezuma’s Revenge (RAM observations): the solid line is the mean average undiscounted return per iteration, while the shaded areas represent the one standard deviation, over 5 seeds.
178
+
179
+ During our pursuit, we had another interesting discovery that the ideal hash function should not simply cluster states by their visual similarity, but instead by their relevance to solving the MDP. We experimented with including enemy locations in the first two rooms into SmartHash $( s = 1 0$ ), and observed that average score dropped to 1672 (at iteration 1000). Though it is important for the agent to dodge enemies, the agent also erroneously “enjoys” watching enemy motions at distance (since new states are constantly observed) and “forgets” that his main objective is to enter other rooms. An alternative hash function keeps the same entry “enemy locations”, but instead only puts randomly sampled values in it, which surprisingly achieves better performance (3112). However, by ignoring enemy locations altogether, the agent achieves a much higher score (5661) (see Figure 5). In retrospect, we examine the hash codes generated by BASS-SimHash and find that codes clearly distinguish between visually different states (including various enemy locations), but fails to emphasize that the agent needs to explore different rooms. Again this example showcases the importance of encoding relevant information in designing hash functions.
180
+
181
+ # 4 Related Work
182
+
183
+ Classic count-based methods such as MBIE (Strehl & Littman, 2005), MBIE-EB and (Kolter & Ng, 2009) solve an approximate Bellman equation as an inner loop before the agent takes an action (Strehl & Littman, 2008). As such, bonus rewards are propagated immediately throughout the state-action space. In contrast, contemporary deep RL algorithms propagate the bonus signal based on rollouts collected from interacting with environments, with value-based (Mnih et al., 2015) or policy gradient-based (Schulman et al., 2015; Mnih et al., 2016) methods, at limited speed. In addition, our proposed method is intended to work with contemporary deep RL algorithms, it differs from classical count-based method in that our method relies on visiting unseen states first, before the bonus reward can be assigned, making uninformed exploration strategies still a necessity at the beginning. Filling the gaps between our method and classic theories is an important direction of future research.
184
+
185
+ A related line of classical exploration methods is based on the idea of optimism in the face of uncertainty (Brafman & Tennenholtz, 2002) but not restricted to using counting to implement “optimism”, e.g. R-Max (Brafman & Tennenholtz, 2002), UCRL (Jaksch et al., 2010), and $\mathrm { E } ^ { \hat { 3 } }$ (Kearns & Singh, 2002). These methods, similar to MBIE and MBIE-EB, have theoretical guarantees in tabular settings.
186
+
187
+ Bayesian RL methods (Kolter & Ng, 2009; Guez et al., 2014; Sun et al., 2011; Ghavamzadeh et al., 2015), which keep track of a distribution over MDPs, are an alternative to optimism-based methods. Extensions to continuous state space have been proposed by Pazis & Parr (2013) and Osband et al. (2016b).
188
+
189
+ Another type of exploration is curiosity-based exploration. These methods try to capture the agent’s surprise about transition dynamics. As the agent tries to optimize for surprise, it naturally discovers novel states. We refer the reader to Schmidhuber (2010) and Oudeyer & Kaplan (2007) for an extensive review on curiosity and intrinsic rewards.
190
+
191
+ Several exploration strategies for deep RL have been proposed to handle high-dimensional state space recently. Houthooft et al. (2016) propose VIME, in which information gain is measured in Bayesian neural networks modeling the MDP dynamics, which is used an exploration bonus. Stadie et al. (2015) propose to use the prediction error of a learned dynamics model as an exploration bonus. Thompson sampling through bootstrapping is proposed by Osband et al. (2016a), using bootstrapped Q-functions.
192
+
193
+ The most related exploration strategy is proposed by Bellemare et al. (2016), in which an exploration bonus is added inversely proportional to the square root of a pseudo-count quantity. A state pseudocount is derived from its log-probability improvement according to a density model over the state space, which in the limit converges to the empirical count. Our method is similar to pseudo-count approach in the sense that both methods are performing approximate counting to have the necessary generalization over unseen states. The difference is that a density model has to be designed and learned to achieve good generalization for pseudo-count whereas in our case generalization is obtained by a wide range of simple hash functions (not necessarily SimHash). Another interesting connection is that our method also implies a density model $\begin{array} { r } { \rho ( s ) = \frac { n ( \phi ( s ) ) } { N } } \end{array}$ over all visited states, where $N$ is the ρ total number of states visited. Another method similar to hashing is proposed by Abel et al. (2016), which clusters states and counts cluster centers instead of the true states, but this method has yet to be tested on standard exploration benchmark problems.
194
+
195
+ # 5 Conclusions
196
+
197
+ This paper demonstrates that a generalization of classical counting techniques through hashing is able to provide an appropriate signal for exploration, even in continuous and/or high-dimensional MDPs using function approximators, resulting in near state-of-the-art performance across benchmarks. It provides a simple yet powerful baseline for solving MDPs that require informed exploration.
198
+
199
+ # Acknowledgments
200
+
201
+ We would like to thank our colleagues at Berkeley and OpenAI for insightful discussions. This research was funded in part by ONR through a PECASE award. Yan Duan was also supported by a Berkeley AI Research lab Fellowship and a Huawei Fellowship. Xi Chen was also supported by a Berkeley AI Research lab Fellowship. We gratefully acknowledge the support of the NSF through grant IIS-1619362 and of the ARC through a Laureate Fellowship (FL110100281) and through the ARC Centre of Excellence for Mathematical and Statistical Frontiers. Adam Stooke gratefully acknowledges funding from a Fannie and John Hertz Foundation fellowship. Rein Houthooft is supported by a Ph.D. Fellowship of the Research Foundation - Flanders (FWO).
202
+
203
+ # References
204
+
205
+ David Abel, Alekh Agarwal, Fernando Diaz, Akshay Krishnamurthy, and Robert E Schapire. Exploratory gradient boosting for reinforcement learning in complex domains. arXiv preprint arXiv:1603.04119, 2016.
206
+
207
+ Alexandr Andoni and Piotr Indyk. Near-optimal hashing algorithms for approximate nearest neighbor in high dimensions. In 47th Annual IEEE Symposium on Foundations of Computer Science (FOCS), pp. 459–468, 2006.
208
+
209
+ Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 2012.
210
+
211
+ Marc G Bellemare, Sriram Srinivasan, Georg Ostrovski, Tom Schaul, David Saxton, and Remi Munos. Unifying count-based exploration and intrinsic motivation. In Advances in Neural Information Processing Systems, 2016.
212
+
213
+ Burton H. Bloom. Space/time trade-offs in hash coding with allowable errors. Communications of the ACM, 13(7):422–426, 1970.
214
+
215
+ Ronen I Brafman and Moshe Tennenholtz. R-max-a general polynomial time algorithm for near-optimal reinforcement learning. Journal of Machine Learning Research, 3:213–231, 2002.
216
+
217
+ Moses S Charikar. Similarity estimation techniques from rounding algorithms. In Proceedings of the thirty-fourth annual ACM symposium on Theory of computing, pp. 380–388, 2002.
218
+
219
+ Graham Cormode and S Muthukrishnan. An improved data stream summary: the count-min sketch and its applications. Journal of Algorithms, 55(1):58–75, 2005.
220
+
221
+ Navneet Dalal and Bill Triggs. Histograms of oriented gradients for human detection. In 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’05), volume 1, pp. 886–893. IEEE, 2005.
222
+
223
+ Yan Duan, Xi Chen, Rein Houthooft, John Schulman, and Pieter Abbeel. Benchmarking deep reinforcement learning for continous control. In International Conference on Machine Learning (ICML), 2016.
224
+
225
+ Li Fan, Pei Cao, Jussara Almeida, and Andrei Z Broder. Summary cache: a scalable wide-area web cache sharing protocol. IEEE/ACM Transactions on Networking (TON), 8(3):281–293, 2000.
226
+
227
+ Mohammad Ghavamzadeh, Shie Mannor, Joelle Pineau, and Aviv Tamar. Bayesian reinforcement learning: A survey. Foundations and Trends in Machine Learning, 8(5-6):359–483, 2015.
228
+
229
+ Karol Gregor, Frederic Besse, Danilo Jimenez Rezende, Ivo Danihelka, and Daan Wierstra. Towards conceptual compression. arXiv preprint arXiv:1604.08772, 2016.
230
+
231
+ Arthur Guez, Nicolas Heess, David Silver, and Peter Dayan. Bayes-adaptive simulation-based search with value function approximation. In Advances in Neural Information Processing Systems (NIPS), pp. 451–459, 2014.
232
+
233
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015.
234
+
235
+ Rein Houthooft, Xi Chen, Yan Duan, John Schulman, Filip De Turck, and Pieter Abbeel. VIME: Variational information maximizing exploration. In Advances in Neural Information Processing Systems (NIPS), 2016.
236
+
237
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning (ICML), pp. 448–456, 2015.
238
+
239
+ Thomas Jaksch, Ronald Ortner, and Peter Auer. Near-optimal regret bounds for reinforcement learning. Journal of Machine Learning Research, 11:1563–1600, 2010.
240
+
241
+ Michael Kearns and Satinder Singh. Near-optimal reinforcement learning in polynomial time. Machine Learning, 49(2-3):209–232, 2002.
242
+
243
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations (ICLR), 2015.
244
+
245
+ J Zico Kolter and Andrew Y Ng. Near-bayesian exploration in polynomial time. In International Conference on Machine Learning (ICML), pp. 513–520, 2009.
246
+
247
+ 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.
248
+
249
+ Tze Leung Lai and Herbert Robbins. Asymptotically efficient adaptive allocation rules. Advances in applied mathematics, 6(1):4–22, 1985.
250
+
251
+ 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.
252
+
253
+ David G Lowe. Object recognition from local scale-invariant features. In Computer vision, 1999. The proceedings of the seventh IEEE international conference on, volume 2, pp. 1150–1157. Ieee, 1999.
254
+
255
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
256
+
257
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy P Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. arXiv preprint arXiv:1602.01783, 2016.
258
+
259
+ Arun Nair, Praveen Srinivasan, Sam Blackwell, Cagdas Alcicek, Rory Fearon, Alessandro De Maria, Vedavyas Panneershelvam, Mustafa Suleyman, Charles Beattie, Stig Petersen, et al. Massively parallel methods for deep reinforcement learning. arXiv preprint arXiv:1507.04296, 2015.
260
+
261
+ Ian Osband, Charles Blundell, Alexander Pritzel, and Benjamin Van Roy. Deep exploration via bootstrapped DQN. In Advances in Neural Information Processing Systems (NIPS), 2016a.
262
+
263
+ Ian Osband, Benjamin Van Roy, and Zheng Wen. Generalization and exploration via randomized value functions. In International Conference on Machine Learning (ICML), 2016b.
264
+
265
+ Pierre-Yves Oudeyer and Frederic Kaplan. What is intrinsic motivation? A typology of computational approaches. Frontiers in Neurorobotics, 1:6, 2007.
266
+
267
+ Jason Pazis and Ronald Parr. PAC optimal exploration in continuous space Markov decision processes. In Twenty-Seventh AAAI Conference on Artificial Intelligence, 2013.
268
+
269
+ Jürgen Schmidhuber. Formal theory of creativity, fun, and intrinsic motivation (1990–2010). IEEE Transactions on Autonomous Mental Development, 2(3):230–247, 2010.
270
+
271
+ John Schulman, Sergey Levine, Philipp Moritz, Michael I Jordan, and Pieter Abbeel. Trust region policy optimization. In International Conference on Machine Learning (ICML), 2015.
272
+
273
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
274
+
275
+ Bradly C Stadie, Sergey Levine, and Pieter Abbeel. Incentivizing exploration in reinforcement learning with deep predictive models. arXiv preprint arXiv:1507.00814, 2015.
276
+
277
+ Alexander L Strehl and Michael L Littman. A theoretical analysis of model-based interval estimation. In International Conference on Machine Learning (ICML), pp. 856–863, 2005.
278
+
279
+ Alexander L Strehl and Michael L Littman. An analysis of model-based interval estimation for Markov decision processes. Journal of Computer and System Sciences, 74(8):1309–1331, 2008.
280
+
281
+ Yi Sun, Faustino Gomez, and Jürgen Schmidhuber. Planning to be surprised: Optimal Bayesian exploration in dynamic environments. In Artificial General Intelligence, pp. 41–51. 2011.
282
+
283
+ Engin Tola, Vincent Lepetit, and Pascal Fua. Daisy: An efficient dense descriptor applied to wide-baseline stereo. IEEE transactions on pattern analysis and machine intelligence, 32(5): 815–830, 2010.
284
+
285
+ Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. In International Conference on Machine Learning (ICML), 2016.
286
+
287
+ Hado van Hasselt, Arthur Guez, Matteo Hessel, and David Silver. Learning functions across many orders of magnitudes. arXiv preprint arXiv:1602.07714, 2016a.
288
+
289
+ Hado van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double Q-learning. In Thirtieth AAAI Conference on Artificial Intelligence, 2016b.
290
+
291
+ Alexander Vezhnevets, Volodymyr Mnih, John Agapiou, Simon Osindero, Alex Graves, Oriol Vinyals, and Koray Kavukcuoglu. Strategic attentive writer for learning macro-actions. In Advances in Neural Information Processing Systems (NIPS), 2016.
292
+
293
+ Ziyu Wang, Nando de Freitas, and Marc Lanctot. Dueling network architectures for deep reinforcement learning. In International Conference on Machine Learning (ICML), 2016.
294
+
295
+ # A Appendices
296
+
297
+ # A.1 Hyperparameter Settings
298
+
299
+ For the rllab experiments, we used batch size 5000 for all tasks except SwimmerGather, for which we used batch size 50000. CartpoleSwingup makes use of a neural network policy with one layer of 32 tanh units. The other tasks make use of a two layer neural network policy of 32 tanh units each for MountainCar and HalfCheetah, and of 64 and 32 tanh units for SwimmerGather. The outputs are modeled by a fully factorized Gaussian distribution ${ \cal N } ( \mu , \sigma ^ { 2 } I )$ , in which $\mu$ is modeled as the network output, while $\sigma$ µ, σ µis a parameter. CartPoleSwingup makes use of a neural network baseline with one σlayer of 32 ReLU units, while all other tasks make use of a linear baseline function. For all tasks, we used TRPO step size 0 01 and discount factor $\gamma = 0 . 9 9$ . We choose SimHash parameter $k = 3 2$ and bonus coefficient $\beta = 0 . 0 1$ γ ., found through a coarse grid search.
300
+
301
+ For Atari experiments, a batch size of 100000 is used, while the KL divergence step size is set to 0 01. The policy and baseline both have the following architecture: 2 convolutional layers with .respectively 16 and 32 filters, sizes $8 \times 8$ and $4 \times 4$ , strides 4 and 2, using no padding, feeding into a single hidden layer of 256 units. The nonlinearities are rectified linear units (ReLUs). The input frames are downsampled to $5 2 \times 5 2$ . The input to policy and baseline consists of the 4 previous frames, corresponding to the frame skip of 4. The discount factor was set to $\gamma = 0 . 9 9 5$ . All inputs are rescaled to $[ - 1 , 1 ]$ γ .element-wise. All experiments used 5 different training seeds, except the ,experiments with the learned hash code, which uses 3 different training seeds. Batch normalization (Ioffe & Szegedy, 2015) is used at each policy and baseline layer. TRPO-pixel-SimHash uses binary codes of size $k = 2 5 6$ ; BASS (TRPO-BASS-SimHash) extracts features using cell size $C = 2 0$ and $B = 2 0$ bins. The autoencoder for the learned embedding (TRPO-AE-SimHash) uses a binary hidden layer of 512 bit, which are projected to 64 bit.
302
+
303
+ RAM states in Atari 2600 games are integer-valued vectors over length 128 in the range [0 255]. ,Experiments on Montezuma’s Revenge with RAM observations use a policy consisting of 2 hidden layers, each of size 32. RAM states are rescaled to a range $[ - 1 , 1 ]$ . Unlike images, only the current ,RAM is shown to the agent. Experiment results are averaged over 10 random seeds.
304
+
305
+ In addition, we apply counting Bloom filters (Fan et al., 2000) to maintain a small hash table. Details can be found in Appendix A.5.
306
+
307
+ The autoencoder used for the learned hash code has a 512 bit binary code layer, using sigmoid units, to which uniform noise $U ( - a , a )$ with $a = 0 . 3$ is added. The loss function Eq. (3), using $\lambda = 1 0$ , is updated every $j _ { \mathrm { u p d a t e } } = 3$ , . λiterations. The architecture looks as follows: an input layer of size $5 2 \times 5 2$ , representing the image luminance is followed by 3 consecutive $6 \times 6$ convolutional layers with stride 2 and 96 filters feed into a fully connected layer of size 1024, which connects to the binary code layer. This binary code layer feeds into a fully-connected layer of 1024 units, connecting to a fully-connected layer of 2400 units. This layer feeds into 3 consecutive $6 \times 6$ transposed convolutional layers of which the final one connects to a pixel-wise softmax layer with 64 bins, representing the pixel intensities. Moreover, label smoothing is applied to the different softmax bins, in which the log-probability of each of the bins is increased by 0 003, before normalizing. The softmax weights .are shared among each pixel. All output nonlinearities are ReLUs; Adam (Kingma & Ba, 2015) is used as an optimization scheme; batch normalization (Ioffe & Szegedy, 2015) is applied to each layer. The architecture was shown in Figure 1 of Section 2.3.
308
+
309
+ # A.2 Description of the Adapted rllab Tasks
310
+
311
+ This section describes the continuous control environments used in the experiments. The tasks are implemented as described in Duan et al. (2016), following the sparse reward adaptation of Houthooft et al. (2016). The tasks have the following state and action dimensions: CartPoleSwingup, $S \subseteq \mathbb { R } ^ { 4 }$ , $\mathcal { A } \subseteq \mathbb { R } ^ { 1 }$ ; MountainCar $s \subseteq \mathbb { R } ^ { 3 }$ , $\mathcal { A } \subseteq \mathbf { \overline { { \mathbb { R } } } } ^ { 1 }$ ; HalfCheetah, $\boldsymbol { s } \subseteq \mathbb { R } ^ { 2 0 }$ , $\mathcal { A } \subseteq \mathbb { R } ^ { 6 }$ ; SwimmerGather, $\boldsymbol { S } \subseteq \mathbb { R } ^ { 3 3 }$ , $\mathcal { A } \subseteq \mathbb { R } ^ { 2 }$ . For the sparse reward experiments, the tasks have been modified as follows. In CartPoleSwingup, the agent receives a reward of $+ 1$ when $\cos ( \beta ) > 0 . 8$ , with $\beta$ the pole angle. In MountainCar, the agent receives a reward of $+ 1$ β > . βwhen the goal state is reached, namely escaping the valley from the right side. Therefore, the agent has to figure out how to swing up the pole in the absence of any initial external rewards. In HalfCheetah, the agent receives a reward of $+ 1$ when $x _ { \mathrm { b o d y } } > 5$ . As such, it has to figure out how to move forward without any initial external reward. The >time horizon is set to $T = 5 0 0$ for all tasks.
312
+
313
+ # A.3 Examples of Atari 2600 RAM Entries
314
+
315
+ Table 5 lists the semantic interpretation of certain RAM entries in Montezuma’s Revenge. SmartHash, as described in Section 3.4, makes use of RAM indices 3, 42, 43, 27, and 67. “Beam walls” are deadly barriers that occur periodically in some rooms.
316
+
317
+ Table 5: Interpretation of particular RAM entries in Montezuma’s Revenge
318
+
319
+ <table><tr><td>RAM index</td><td>Group</td><td>Meaning</td></tr><tr><td>3</td><td>room</td><td>room number</td></tr><tr><td>42</td><td>agent</td><td>x coordinate</td></tr><tr><td>43</td><td>agent</td><td>y coordinate</td></tr><tr><td>52</td><td>agent</td><td>orientation (left/right)</td></tr><tr><td>27</td><td>beam walls</td><td>on/off</td></tr><tr><td>83</td><td>beam walls</td><td>beam wall countdown (on: O,off: 36 → 0)</td></tr><tr><td>0</td><td>counter</td><td>counts from O to 255 and repeats</td></tr><tr><td>55</td><td>counter</td><td>death scene countdown</td></tr><tr><td>67</td><td>objects</td><td>existence of objects (doors,skull and key) in the 1st room</td></tr><tr><td>47</td><td>skull</td><td>x coordinate (both 1st and 2nd rooms)</td></tr></table>
320
+
321
+ # A.4 Analysis of Learned Binary Representation
322
+
323
+ Figure 6 shows the downsampled codes learned by the autoencoder for several Atari 2600 games (Frostbite, Freeway, and Montezuma’s Revenge). Each row depicts 50 consecutive frames (from 0 to 49, going from left to right, top to bottom). The pictures in the right column depict the binary codes that correspond with each of these frames (one frame per row). Figure 7 shows the reconstructions of several subsequent images according to the autoencoder.
324
+
325
+ ![](images/211bf74321124f76d9aeedcd9061eebfd5f44286aaae4dd4b4fda17411c089b8.jpg)
326
+ Figure 6: Frostbite, Freeway, and Montezuma’s Revenge: subsequent frames (left) and corresponding code (right); the frames are ordered from left (starting with frame number 0) to right, top to bottom; the vertical axis in the right images correspond to the frame number.
327
+
328
+ ![](images/b12b2c9fed2ee4b18399bef400e2ba7a6e24230656b1816faf85b7f8ee3f8f88.jpg)
329
+ Figure 7: Freeway: subsequent frames and corresponding code (top); the frames are ordered from left (starting with frame number 0) to right, top to bottom; the vertical axis in the right images correspond to the frame number. Within each image, the left picture is the input frame, the middle picture the reconstruction, and the right picture, the reconstruction error.
330
+
331
+ # A.5 Counting Bloom Filter/Count-Min Sketch
332
+
333
+ We experimented with directly building a hashing dictionary with keys $\phi ( s )$ and values the state φcounts, but observed an unnecessary increase in computation time. Our implementation converts the integer hash codes into binary numbers and then into the “bytes” type in Python. The hash table is a dictionary using those bytes as keys.
334
+
335
+ However, an alternative technique called Count-Min Sketch (Cormode & Muthukrishnan, 2005), with a data structure identical to counting Bloom filters (Fan et al., 2000), can count with a fixed integer array and thus reduce computation time. Specifically, let $p ^ { 1 } , \ldots , p ^ { l }$ be distinct large prime numbers and define $\phi ^ { j } ( s ) = \phi ( s ) \ \mathrm { m o d } p ^ { j }$ . The count of state $s$ is returned as $\mathrm { m i n } _ { 1 \le j \le l } n ^ { j } \left( \bar { \phi ^ { j } } ( \bar { s } ) \right)$ . To increase the count of $s$ , we increment $n ^ { j } \left( \phi ^ { j } ( s ) \right)$ by 1 for all $j$ . Intuitively, the method replaces $\phi$ by weaker hash functions, while it reduces the probability of over-counting by reporting counts agreed by all such weaker hash functions. The final hash code is represented as $\left( \phi ^ { 1 } ( s ) , . . . , \phi ^ { l } ( s ) \right)$ .
336
+
337
+ Throughout all experiments above, the prime numbers for the counting Bloom filter are 999931, 999953, 999959, 999961, 999979, and 999983, which we abbreviate as $\mathbf { \ddot { \theta } M ^ { \prime \prime } }$ . In addition, we experimented with 6 other prime numbers, each approximately $1 5 \mathbf { M }$ , which we abbreviate as $" 9 0 1 \vec { \bf M } "$ . As we can see in Figure 8, counting states with a dictionary or with Bloom filters lead to similar performance, but the computation time of latter is lower. Moreover, there is little difference between direct counting and using a very larger table for Bloom filters, as the average bonus rewards are almost the same, indicating the same degree of exploration-exploitation trade-off. On the other hand, Bloom filters require a fixed table size, which may not be known beforehand.
338
+
339
+ ![](images/21758b2fa131e1fa7d95610d3c88ea9f86077b67c5f1fe8d3c4ecb1a19a973fb.jpg)
340
+ Figure 8: Statistics of TRPO-pixel-SimHash $k = 2 5 6$ on Frostbite. Solid lines are the mean, while the shaded areas represent the one standard deviation. Results are derived from 10 random seeds. Direct counting with a dictionary uses 2.7 times more computations than counting Bloom filters (6 M or $9 0 \mathbf { M }$ ).
341
+
342
+ Theory of Bloom Filters Bloom filters (Bloom, 1970) are popular for determining whether a data sample $s ^ { \prime }$ belongs to a dataset $\mathcal { D }$ . Suppose we have $l$ functions $\phi ^ { j }$ that independently assign each data sample to an integer between 1 and $p$ φuniformly at random. Initially $1 , 2 , \ldots , p$ are marked as 0. Then every $s \in \mathcal { D }$ is “inserted” through marking $\phi ^ { j } { \dot { ( s ) } }$ as 1 for all $j$ , , . . . ,. A new sample $s ^ { \prime }$ is reported as a member of $\mathcal { D }$ only if $\phi ^ { j } ( s )$ φare marked as 1 for all $j$ . A bloom filter has zero false negative rate (any $s \in \mathcal { D }$ φis reported a member), while the false positive rate (probability of reporting a nonmember as a member) decays exponentially in $l$ .
343
+
344
+ Though Bloom filters support data insertion, it does not allow data deletion. Counting Bloom filters (Fan et al., 2000) maintain a counter $n ( \cdot )$ for each number between 1 and $p$ . Inserting/deleting $s$ corresponds to incrementing/decrementing $n { \Big ( } \phi ^ { j } ( s ) { \Big ) }$ by 1 for all $j$ . Similarly, $s$ is considered a member if $\forall j : n \Big ( \phi ^ { j } ( s ) \Big ) = 0$ .
345
+
346
+ Count-Min sketch is designed to support memory-efficient counting without introducing too many over-counts. It maintains a separate count $n ^ { j }$ for each hash function $\phi ^ { j }$ defined as $\phi ^ { j } \bar { ( s ) } = \phi ( \bar { s ) }$ mod $p ^ { j }$ , where $p ^ { j }$ φis a large prime number. For simplicity, we may assume that $p ^ { j } \approx p \forall j$ φand $\phi ^ { j }$ assigns $s$ to any of $1 , \ldots , p$ with uniform probability.
347
+
348
+ We now derive the probability of over-counting. Let $s$ be a fixed data sample (not necessarily inserted yet) and suppose a dataset $\mathcal { D }$ of $N$ samples are inserted. We assume that $p ^ { l } \gg N$ . Let $n : = \mathrm { m i n } _ { 1 \leq j \leq l } n ^ { j } \left( \phi ^ { j } ( s ) \right)$ be the count returned by the Bloom filter. We are interested in computing $\mathrm { P r o b } ( n > 0 | s \notin \mathcal { D } )$ . Due to assumptions about $\phi ^ { j }$ , we know $n ^ { j } ( \phi ( s ) ) \sim \mathrm { B i n o m i a l } \left( N , { \frac { 1 } { p } } \right)$ . Therefore,
349
+
350
+ $$
351
+ \begin{array} { r l } { \mathrm { P r o b } ( n > 0 | s \mathcal { G } \mathcal { D } ) = } & { \frac { \mathrm { P r o b } ( n > 0 , s \varphi \mathcal { D } ) } { \mathrm { P r o b } ( s \varphi \mathcal { D } ) } } \\ & { = \frac { \mathrm { P r o b } ( n > 0 ) - \mathrm { P r o b } ( s \varphi \mathcal { D } ) } { \mathrm { P r o b } ( s \varphi \mathcal { D } ) } } \\ & { \approx \frac { \mathrm { P r o b } ( n > 0 ) } { \mathrm { P r o b } ( s \varphi \mathcal { D } ) } } \\ & { = \frac { \mathrm { P r o b } ( n > 0 ) } { \mathrm { P r o b } ( s \varphi \mathcal { D } ) } } \\ & { = \frac { ( 1 - 1 ) \cdot ( 1 \rho \mathcal { P } ) ^ { N } ( 1 \circ 1 ) \cdot ( \rho \mathcal { P } ) } { ( 1 - 1 ) \cdot ( 1 \rho \mathcal { P } ) ^ { N } } } \\ & { = \frac { ( 1 - 1 ) \cdot ( 1 \rho \mathcal { P } ) ^ { N } } { ( 1 - 1 ) \cdot ( 1 \rho \mathcal { P } ) ^ { N } } } \\ & { \approx \frac { ( 1 - e ^ { - N \varphi \mathcal { P } } ) } { e ^ { - N \varphi \mathcal { P } } } } \\ & { \approx ( 1 - e ^ { - N \varphi \mathcal { P } } ) . } \end{array}
352
+ $$
353
+
354
+ In particular, the probability of over-counting decays exponentially in $l$ . We refer the readers to (Cormode & Muthukrishnan, 2005) for other properties of the Count-Min sketch.
355
+
356
+ # A.6 Robustness Analysis
357
+
358
+ Apart from the experimental results shown in Table 1 and Table 3, additional experiments have been performed to study several properties of our algorithm.
359
+
360
+ Hyperparameter sensitivity To study the performance sensitivity to hyperparameter changes, we focus on evaluating TRPO-RAM-SimHash on the Atari 2600 game Frostbite, where the method has a clear advantage over the baseline. Because the final scores can vary between different random seeds, we evaluated each set of hyperparameters with 30 seeds. To reduce computation time and cost, RAM states are used instead of image observations.
361
+
362
+ Table 6: TRPO-RAM-SimHash performance robustness to hyperparameter changes on Frostbite
363
+
364
+ <table><tr><td rowspan="2"></td><td colspan="8">阝</td></tr><tr><td>k 0</td><td>0.01</td><td>0.05</td><td>0.1</td><td>0.2</td><td>0.4</td><td>0.8</td><td>1.6</td></tr><tr><td>1</td><td>397</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>64</td><td>1</td><td>879</td><td>2464</td><td>2243</td><td>2489</td><td>1587</td><td>1107</td><td>441</td></tr><tr><td>128</td><td>1</td><td>1475</td><td>4248</td><td>2801</td><td>3239</td><td>3621</td><td>1543</td><td>395</td></tr><tr><td>256</td><td></td><td>2583</td><td>4497</td><td>4437</td><td>7849</td><td>3516</td><td>2260</td><td>374</td></tr></table>
365
+
366
+ The results are summarized in Table 6. Herein, $k$ refers to the length of the binary code for hashing while $\beta$ is the multiplicative coefficient for the reward bonus, as defined in Section 2.2. This βtable demonstrates that most hyperparameter settings outperform the baseline $\mathcal { B } = 0 ,$ ) significantly. βMoreover, the final scores show a clear pattern in response to changing hyperparameters. Small $\beta$ -values lead to insufficient exploration, while large $\beta$ -values cause the bonus rewards to overwhelm βthe true rewards. With a fixed $k$ β, the scores are roughly concave in $\beta$ , peaking at around 0 2. Higher granularity $k$ β .leads to better performance. Therefore, it can be concluded that the proposed exploration method is robust to hyperparameter changes in comparison to the baseline, and that the best parameter settings can obtained from a relatively coarse-grained grid search.
367
+
368
+ State and state-action counting Continuing the results in Table 6, the performance of state-action counting is studied using the same experimental setup, summarized in Table 7. In particular, a bonus reward $\begin{array} { r } { r ^ { + } = \frac { \beta } { \sqrt { n ( s , a ) } } } \end{array}$ instead of $\begin{array} { r } { \bar { r } ^ { + } = \frac { \beta } { \sqrt { n ( s ) } } } \end{array}$ is assigned. These results show that the relative ,performance of state counting compared to state-action counting depends highly on the selected hyperparameter settings. However, we notice that the best performance is achieved using state counting with $k = 2 5 6$ and $\beta = 0 . 2$ .
369
+
370
+ Table 7: Performance comparison between state counting (left of the slash) and state-action counting (right of the slash) using TRPO-RAM-SimHash on Frostbite
371
+
372
+ <table><tr><td rowspan="2"></td><td colspan="8">β</td></tr><tr><td>0.01</td><td>0.05</td><td>0.1</td><td>0.2</td><td></td><td>0.4</td><td>0.8</td><td>1.6</td></tr><tr><td>64</td><td>879/976</td><td>2464/1491</td><td>2243/3954</td><td>2489 /5523</td><td>1587 /5985</td><td>1107/2052</td><td></td><td>441/742</td></tr><tr><td>128</td><td>1475/808</td><td>4248/4302</td><td>2801/4802</td><td>3239 /7291</td><td></td><td>3621/4243</td><td>1543/1941</td><td>395/362</td></tr><tr><td>256</td><td>2583 /1584</td><td>4497 /5402</td><td>4437 /5431</td><td>7849 /4872</td><td>3516/3175</td><td></td><td>2260/1238</td><td>374/96</td></tr></table>
md/train/SyYe6k-CW/SyYe6k-CW.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/_4VxORHq-0g/_4VxORHq-0g.md ADDED
@@ -0,0 +1,219 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dynamic Distillation Network for Cross-Domain Few-Shot Recognition with Unlabeled Data
2
+
3
+ Ashraful Islam Rensselaer Polytechnic Institute islama6@rpi.edu
4
+
5
+ Chun-Fu Chen MIT-IBM Watson AI Lab chenrich@us.ibm.com
6
+
7
+ Rameswar Panda MIT-IBM Watson AI Lab rpanda@ibm.com
8
+
9
+ Leonid KarlinskyIBM Researchleonidka@il.ibm.com
10
+
11
+ Rogerio FerisIBM Researchrsferis@us.ibm.com
12
+
13
+ Richard J. Radke Rensselaer Polytechnic Institute rjradke@ecse.rpi.edu
14
+
15
+ # Abstract
16
+
17
+ Most existing works in few-shot learning rely on meta-learning the network on a large base dataset which is typically from the same domain as the target dataset. We tackle the problem of cross-domain few-shot learning where there is a large shift between the base and target domain. The problem of cross-domain few-shot recognition with unlabeled target data is largely unaddressed in the literature. STARTUP was the first method that tackles this problem using self-training. However, it uses a fixed teacher pretrained on a labeled base dataset to create soft labels for the unlabeled target samples. As the base dataset and unlabeled dataset are from different domains, projecting the target images in the class-domain of the base dataset with a fixed pretrained model might be sub-optimal. We propose a simple dynamic distillation-based approach to facilitate unlabeled images from the novel/base dataset. We impose consistency regularization by calculating predictions from the weakly-augmented versions of the unlabeled images from a teacher network and matching it with the strongly augmented versions of the same images from a student network. The parameters of the teacher network are updated as exponential moving average of the parameters of the student network. We show that the proposed network learns representation that can be easily adapted to the target domain even though it has not been trained with target-specific classes during the pretraining phase. Our model outperforms the current state-of-the art method by $\bar { 4 . 4 \% }$ for 1-shot and $3 . 6 \%$ for 5-shot classification in the BSCD-FSL benchmark, and also shows competitive performance on traditional in-domain few-shot learning task. Our code is available at: https://git.io/Jilgs.
18
+
19
+ # 1 Introduction
20
+
21
+ The tremendous success of deep learning in visual recognition tasks is, to a great extent, attributed to the availability of large scale labeled datasets. While humans can recognize an object by looking only at a few examples, modern deep neural networks require hundreds or thousands of images for each category to achieve human-level visual recognition capability. This has led to the research on few-shot learning which aims at learning from a much smaller dataset. In a typical few-shot learning setting, there are two stages: meta-training and meta-testing. In the meta-training stage, a base dataset with labeled images is provided to train the model. In the meta-testing stage, the learned model is quickly adapted to a set of novel classes with only a few examples per class (the support set) and evaluated on a set of test images from the same novel classes (the query set). The base classes and novel classes are typically disjoint, but the images are obtained from the same domain. However, in many real world settings, training the model on a base dataset from the same domain as the target dataset is difficult and infeasible. Guo et al. [7] proposed a cross-domain few-shot benchmark, BSCD-FSL, which contains datasets from extremely different domains. In this benchmark, the meta-training is done on a labeled source dataset, and the few-shot evaluation is performed on a target dataset which is from different domain than the source dataset. The benchmark shows that traditional pretraining and finetuning outperforms more complicated meta-learning based few-shot learning methods by a significant margin.
22
+
23
+ ![](images/dbee5802125f4bfd45fbd04dea03e627fa4cb3b948e5122506897507063753e4.jpg)
24
+ Figure 1: Problem setup. (Left) In typical few-shot learning task, a model is trained on a base dataset first during meta-training stage. In meta-testing stage, a few examples from novel classes, referred to as support set, are provided, and the network predicts the categories of different samples from the same classes as support set. The base dataset and the target dataset generally come from the same domain with disjoint categories. (Middle) In cross-domain few-shot learning, there is a domain gap between the base dataset and the target dataset. For example, in the figure, the base dataset contains natural images from miniImageNet [29], and the target dataset consists of satellite images from EuroSAT dataset [8]. (Right) Our setting is similar to cross-domain few-shot learning setup. However, additional unlabeled images are also available during meta-training stage. Although the unlabeled dataset comes from the same domain as the target dataset, it does not contain any images either from the support set or query set.
25
+
26
+ In the real-world scenarios, the target domain should have many unlabeled images, and it might be beneficial to use the unlabeled data to learn more target domain specific representations. We hypothesize that using both labeled base data and unlabeled target data during training provides a common embedding for both base and target domain. Then the natural question could be - why not use the unlabeled target data only, it might provide more target-specific representation. One issue with this approach is that self-supervised learning generally requires a large amount of unlabeled data to work, and, as pointed out by Phoo and Hariharan [18], plain self-supervised learning struggles to outperform the naive transfer learning baseline in few-shot learning setup. Secondly, it has been shown that combining supervised and unsupervised learning during training provides more transferable representation [9]. We argue that similar conclusion holds for cross-domain few-shot learning, i.e., combining supervised and unsupervised loss provides better representation for the downstream task. Figure 1 illustrates our experimental setup in contrast to traditional few-shot learning or cross-domain few-shot learning setup. We show that labeled images from the base dataset are still important to learn generic image features, and images from the target domain, even if unlabeled, can help developing more target domain specific representations.
27
+
28
+ Figure 2 illustrates our approach. Our goal is to train a feature extractor which will be used to evaluate few-shot learning performance on the target dataset. We propose a dynamic distillationbased approach to this end. The student network consists of an encoder $f _ { s }$ and classifier $g _ { s }$ , and the teacher network shares similar architecture as the student network (denoted as $f _ { t }$ and $g _ { t }$ ). The classifier $g _ { s }$ is a linear layer that predicts the class-logits of the samples from the base dataset. We calculate a supervised cross-entropy loss between the student’s predictions and ground-truth labels on the base dataset. For the unlabeled target data, we compute the teacher’s prediction for a weaklyaugmented version of an image and the student’s prediction for a strongly augmented version of the same image, and optimize a distillation loss to match the predictions. We also apply sharpening in the teacher prediction to encourage low-entropy prediction from the student. Both the supervised loss and distillation loss are used to learn the student’s weights. The teacher network is updated as a moving average of the student network. During few-shot evaluation, we only use the student encoder $f _ { s }$ as a feature extractor, learn a classifier head on the labeled support images consisting of few examples per category, and calculate the class predictions of the query images.
29
+
30
+ Our main contributions are:
31
+
32
+ • We propose a simple method for few-shot learning across extreme domain difference. • We use dynamic distillation based approach that uses both labeled source data and unlabeled target data to learn a better representation for the few-shot evaluation on the target domain. • Our method significantly outperforms the current state of the art in the BSCD-FSL benchmark with unlabeled images by $4 . 4 \%$ for 1-shot and $3 . 6 \%$ for 5-shot classification in terms of average top-1 accuracy. It even shows superior performance for in-domain few-shot classification on miniImageNet and tieredImageNet datasets.
33
+
34
+ # 2 Related Work
35
+
36
+ Few-shot classification Few-shot learning methods can be divided into three broad categories - generative [36], metric-base [21, 28, 23] and adaptation-based [10, 14]. Early work on few-shot learning was based on meta-learning [29, 23, 10, 13]. Matching Networks [29] uses cosine similarities on feature vectors produced by independently learned feature extractors, while Relation Networks [23] learn its own similarity metric. MAML [10] learns good initialization parameters that can be quickly adapted to a new task. Prototypical Networks [21] learn a feature extractor that is used to calculate distances between features of test images and the mean features of support images. MetaOptNet [14] uses a discriminatively trained linear predictor to learn representations for few-shot learning.
37
+
38
+ Self-training Self-training trains a student model that mimicks the predictions of a teacher model. Self-training can improves ImageNet classification [33]. It is also a dominant approach in semisupervised learning, where the teacher network is used to create pseudo [35, 34] or soft labels [33] for a huge set of unlabeled images, and the student network is trained to mimic the teacher.
39
+
40
+ Semi-supervised Learning Our method is inspired from recent developments in semi-supervised learning. Both [16] and [27] uses supervised cross-entropy loss with unsupervised regularization loss. Pseudo-labeling based approaches first train a model on a labeled dataset, use the trained model to create pseudo-labels of the unlabeled samples, and retrain the model with both labeled and pseudo-labeled samples [12, 1]. FixMatch [22] proposes a simplified model which simultaneously optimizes cross-entropy loss on the labeled samples and generates pseudo labels using the model’s prediction on weakly-augmented unlabeled images. If the pseudo labels are confident enough, the model is trained to predict the pseudo labels with a strongly augmented version of the same images. We adopt a similar approach by imposing consistency regularization. However, while FixMatch is a semi-supervised technique where the unlabeled data is assumed to be from the same domain, our approach is applicable to the cross-domain few-shot learning problem. We also calculates the prediction from a mean teacher network instead of using the same network as FixMatch.
41
+
42
+ Cross-domain few-shot learning Guo et al. [7] proposed a cross-domain few-shot learning benchmark, and noted that existing state-of-the-art approaches fail to achieve good accuracy on this benchmark. One potential solution could be to use an unlabeled dataset from the target to learn representations that are adaptable to a completely different domain. Many approaches also explored few-shot learning with unlabeled data [11, 15, 19]; however, most of these works still assume a smaller gap between the base and target domains. Our method shares some similarity with the recently developed STARTUP [18] method for cross-domain few-shot learning. STARTUP also uses unlabeled data for learning a better representation. However, STARTUP uses a fixed pretrained model to produce pseudo labels for the unlabeled samples, and then train the network with the labeled base dataset and pseudo-labeled target dataset. Additionally, STARTUP also incorporates a self-supervised contrastive loss on the unlabeled images to improve accuracy, where our method does not require additional contrastive loss. Actually, we argue that our distillation loss works like a self-supervised non-contrastive loss, similar to BYOL [6], for which we might not need to add any extra self-supervised loss. We propose a dynamic distillation approach, where the parameters of the teacher network are updated during training. We obtain the prediction for the weakly-augmented version of an unlabeled image from the teacher network, and optimizes the model such that the prediction of the strongly augmented version of the same image obtained from the student network matches that of teacher network. Note that FixMatch [22] also uses similar consistency regularization loss for semi-supervised learning. To our knowledge, we are the first to use consistency regularization and dynamic distillation for cross-domain few-shot learning.
43
+
44
+ ![](images/ed07d4f711cf566e714bb944dc36fee82b96495882cb354e92aa82e147cd71b2.jpg)
45
+ Figure 2: Diagram of our approach. Given labeled base data and unlabeled target data, our goal is to train a feature extractor which will be used to evaluate few-shot learning performance on the target dataset. The student network consists of an encoder $f _ { s }$ and classifier $g _ { s }$ , and the teacher network share similar architecture as the student network. We use the labeled base dataset to optimize the supervised cross-entropy loss. For a target image, we compute the teacher’s prediction for a weakly-augmented and student’s prediction for a strongly augmented version of the image, and optimize the distillation loss to match the predictions. We also apply sharpening in the teacher prediction to encourage low-entropy prediction from the student. Both the supervised loss and distillation loss are used to learn student’s weights. The teacher network is updated as a moving average of the student network. During few-shot evaluation, we simply learn a new classifier header on the few-shot support images, and evaluate on the query images.
46
+
47
+ # 3 Methodology
48
+
49
+ # 3.1 Preliminary
50
+
51
+ Few-shot Learning Formulation A few-shot learning task consists of a support set $S$ , which containing $K$ data points from $N$ classes for $N$ -way $K$ -shot task, and a query $Q = \bar { \{ x _ { i } \} } _ { i = 1 } ^ { m }$ consisting of data points only from the $N$ classes of the support set. The goal is to classify the query points with the help of the labeled support set. In the typical few-shot learning setting, (1) an embedding is learned from the base/source dataset $\mathcal { D } _ { S }$ , (2) a linear classifier is learned on top of the fixed embedding on the support set, and (3) the classifications of the query data points are determined.
52
+
53
+ Cross-domain Few-shot Learning The difference between the typical few-shot learning setup and cross-domain few-shot learning is that the base/source dataset is drawn from a very different domain than the target domain. Additionally, in our setting, we are provided unlabeled data points $\mathcal { D } _ { U } = \{ x _ { i } \} _ { i = 1 } ^ { N _ { U } }$ from the tarbase dataset domain. The unlabeled, and an unlabeled set aset contains more classes than the support, we need to learn an embedding that can $\mathcal { D } _ { S }$ $\mathcal { D } _ { U }$ extract a representation that can be used for few-shot learning evaluation in the target-domain.
54
+
55
+ # 3.2 Proposed Method
56
+
57
+ Encoder We facilitate knowledge distillation to train our base encoder on both source datatset and target dataset. Denote the embedding network as $f _ { s }$ that embeds an input image $x$ to a ${ \mathrm { d } } \cdot$ -dimensional vector $f _ { s } ( x )$ . We add a classifier header $g _ { s }$ on top of $f _ { s }$ , which predicts $n _ { c }$ logits from the embeddings, where $n _ { c }$ is the total number of classes in the base dataset. Since the labels of the data points of the base dataset are provided, we calculate the supervised cross-entropy loss:
58
+
59
+ $$
60
+ l _ { \mathrm { C E } } ( y , p ) = H ( y , p )
61
+ $$
62
+
63
+ where $p = \mathsf { S o f t m a x } ( g _ { s } ( f _ { s } ( x ) ) )$ , and $H ( a , b ) = - a \log b$ .
64
+
65
+ Dynamic distillation Additionally, we also have a teacher encoder $f _ { t }$ and teacher classifier $g _ { t }$ . The task of the teacher network is to produce pseudo labels for the unlabeled images. Given an image $x _ { i }$ from the unlabeled set $\mathcal { D } _ { U }$ , we compute the model’s prediction $p _ { i } ^ { w }$ from a weakly-augmented version (denoted as $x _ { i } ^ { w }$ ) and $p _ { i } ^ { s }$ from a strongly-augmented version (denoted as $\boldsymbol { x } _ { i } ^ { s }$ ) of the unlabeled image. The prediction of the weakly-augmented version is produced from the teacher network, which serves as a soft-target for the strongly-augmented images. We use the student network to get the prediction $p _ { i } ^ { s }$ for the strongly-augmented images. Specifically,
66
+
67
+ $$
68
+ p _ { i } ^ { s } = \mathsf { S o f t m a x } \big ( g _ { s } \big ( f _ { s } ( x _ { i } ^ { s } ) \big ) \big ) ; \quad p _ { i } ^ { w } = \mathsf { S o f t m a x } \big ( g _ { t } \big ( f _ { t } ( x _ { i } ^ { w } ) \big ) / \tau \big )
69
+ $$
70
+
71
+ where $\tau$ is a sharpening parameter. Note that we do not let gradient pass through the teacher network. We calculate the distillation loss by the cross-entropy function
72
+
73
+ $$
74
+ l _ { U } ( p _ { i } ^ { w } , p _ { i } ^ { s } ) = H ( p _ { i } ^ { w } , p _ { i } ^ { s } )
75
+ $$
76
+
77
+ Eq. 3 works like a consistency regularizer so that the network predicts similar scores for different augmented versions of the image. We can also consider Eq. 3 as self-supervised loss, similar to BYOL [6] or DINO [2]. However, one major difference is that - in BYOL or DINO the projection head is a random linear layer, where, we are using the supervised classification head as the projection head.
78
+
79
+ The total loss function is:
80
+
81
+ $$
82
+ \mathcal { L } = \frac { 1 } { { { N _ { S } } } } \sum _ { ( { x _ { i } } , { y _ { i } } ) \in { \mathcal { D } _ { S } } } { l _ { \mathrm { { C E } } } } ( y , p ) + \lambda \frac { 1 } { { { N _ { U } } } } \sum _ { { x _ { i } } \in { \mathcal { D } _ { U } } } { l _ { U } } ( p _ { i } ^ { w } , p _ { i } ^ { s } )
83
+ $$
84
+
85
+ where $\lambda$ is a hyper-parameter. The loss function is used to update the parameters of the student network. For the teacher network, we use mean teacher approach [24], i.e., we update the teacher weights $\theta _ { t }$ from the student weights $\theta _ { s }$ by: $\theta _ { t } = m \theta _ { t } + ( 1 - m ) \theta _ { s }$ , where $m$ is the momentum parameter. Note that when $m = 1$ , we are essentially using fixed teacher, and when $m = 0$ , the teacher and student share the same model. When $m > 0$ , the teacher network is a moving average of the student network denoting the distillation process as dynamic. Please refer to the Appendix for PyTorch-like pseudo-code of our method.
86
+
87
+ # 4 Experiments
88
+
89
+ # 4.1 Experimental Setup
90
+
91
+ Dataset We follow the evaluation protocol of the BSCD-FSL benchmark [7], which contains novel data from CropDisease [17], EuroSAT [8], ISIC [4], and ChestX [32]. The base dataset is miniImageNet [29], which contains 100 classes from ImageNet dataset [5] where each class has 600 images. The novel datasets are chosen based on increasing dissimilarity from the miniImageNet dataset. More details about the datasets are provided in the Appendix. Following [18], we randomly sample $20 \%$ of the data from each novel dataset to construct the unlabeled set $\mathcal { D } _ { U }$ , and the remaining images are used for evaluation, where we perform 5-way 1-shot and 5-way 5-shot classification. For evaluation metric, we report top-1 accuracy and $9 5 \%$ confidence interval over 600 runs. We also report evaluation results on the larger tieredImageNet dataset [19].
92
+
93
+ Implementation details We use ResNet-10 as the backbone network [7, 18]. Our pretraining has two steps. In the first step, we train our network only on the miniImageNet dataset for 200 epochs. We use SGD with momentum 0.9, weight decay 1e-4, learning rate 0.01, batch size 32, and the cosine learning rate scheduler. In the next step, we use the miniImageNet-pretrained network, and use both the base dataset and the unlabeled dataset to optimize the loss function in Eq. 4 for 60 epochs. During training, we increase the weight of distillation loss $\lambda$ from 0 to 1 until 40 epochs using cosine scheduling. The sharpening temperature and teacher momentum parameter are set to 0.1 and 0.99 respectively. For the base images and weakly-augmented unlabeled images, we use the random-resize-crop, horizontal flip and normalization augmentations. For strong augmentation, we additionally use the color jitter, Gaussian blur, and random gray scale transformations. The other hyperparameters are kept the same. Refer to the supplementary for more details about hyper-parameter selection. For few-shot evaluation, we learn a logistic regression classifier on the support set, and evaluate on the query set.
94
+
95
+ Table 1: 5-way 1-shot and 5-shot scores on the BSCD-FSL benchmark datasets. The mean and $9 5 \%$ confidence interval of 600 runs are reported. The ∗ indicates that the numbers are reported from [7] where no unlabeled data is used. The † are the numbers reported from [18], which uses $20 \%$ of the original set as the unlabeled dataset. We also use similar number of unlabeled images as [18]; however, the splits might be different for random sampling.
96
+
97
+ <table><tr><td rowspan="2">Model</td><td colspan="4">1-shot</td><td colspan="4">5-shot</td></tr><tr><td>EuroSAT</td><td>CropDisease</td><td>ISIC</td><td>ChestX</td><td>EuroSAT</td><td>CropDisease</td><td>ISIC</td><td>ChestX</td></tr><tr><td>MAML*</td><td></td><td></td><td></td><td></td><td>71.70±.72</td><td>78.05±.70</td><td>40.13±.58</td><td>23.48±.48</td></tr><tr><td>ProtoNet*</td><td></td><td></td><td></td><td></td><td>73.29±.71</td><td>79.72±.79</td><td>39.57±.57</td><td>24.05±1.01</td></tr><tr><td>MetaOpt*</td><td></td><td></td><td></td><td></td><td>64.44±.73</td><td>68.41±.73</td><td>36.28±.50</td><td>22.53±.91</td></tr><tr><td>STARTUPt</td><td>63.88±.84</td><td>75.93±.80</td><td>32.66±.60</td><td>23.09±.43</td><td>82.29±.60</td><td>93.02±.45</td><td>47.22±.61</td><td>26.94±.45</td></tr><tr><td>ProtoNet</td><td>55.32±.88</td><td>52.94±.81</td><td>29.58±.57</td><td>21.32±.37</td><td>76.92±.67</td><td>81.84±.68</td><td>42.49±.58</td><td>24.72±.43</td></tr><tr><td>MatchingNet</td><td>54.88±.90</td><td>46.86±.88</td><td>27.37±.51</td><td>20.65±.29</td><td>68.00±.68</td><td>63.94±.84</td><td>33.96±.54</td><td>22.62±.36</td></tr><tr><td>Transfer</td><td>58.14±.83</td><td>68.78±.84</td><td>32.12±.59</td><td>22.60±.39</td><td>80.09±.61</td><td>89.79±.52</td><td>43.88±.57</td><td>26.51±.43</td></tr><tr><td>SimCLR(Base)</td><td>58.28±.90</td><td>61.58±.88</td><td>32.43±.56</td><td>22.37±.42</td><td>80.83±.64</td><td>83.44±.61</td><td>44.04±.55</td><td>26.63±.46</td></tr><tr><td>SimCLR</td><td>62.63±.87</td><td>69.22±.93</td><td>31.45±.59</td><td>23.59±.44</td><td>82.76±.59</td><td>89.31±.53</td><td>42.18±.54</td><td>29.56±.49</td></tr><tr><td>STARTUP</td><td>64.32±.88</td><td>74.45±.86</td><td>31.73±.57</td><td>22.27±.41</td><td>83.58±.60</td><td>92.41±.47</td><td>45.73±.62</td><td>26.21±.46</td></tr><tr><td>Transfer+SimCLR</td><td>63.91±.83</td><td>70.35±.85</td><td>31.67±.55</td><td>23.72±.44</td><td>85.78±.51</td><td>91.10±.49</td><td>45.97±.54</td><td>29.45±.10</td></tr><tr><td> Ours</td><td>73.14±.84</td><td>82.14±.78</td><td>34.66±.58</td><td>23.38±.43</td><td>89.07±.47</td><td>95.54±.38</td><td>49.36±.59</td><td>28.31±.46</td></tr></table>
98
+
99
+ # 4.2 Main Results
100
+
101
+ Comparison to State-of-the-arts Table 1 shows the performance comparison of our approach with other methods on the BSCD-FSL benchmark. All models are trained on the miniImageNet dataset. “Transfer” denotes the baseline trained by cross-entropy loss on the base dataset. “SimCLR” is trained only on the unlabeled images. As noted by [9], self-supervised contrastive learning learns better transferable representation for a different downstream domain. Hence, we also create a “SimCLR(Base)” baseline that trains the encoder by optimizing self-supervised contrastive loss on the base dataset. “Transfer+SimCLR” refers to the model which is trained with supervised cross-entropy loss from the base dataset and self-supervised contrastive loss from the unlabeled target dataset, which has been reported to show superior transferability across domain [9]. STARTUP [18] is trained with three losses: cross-entropy loss on the base dataset, KL-divergence loss on the unlabeled dataset similar, and self-supervised contrastive loss on unlabeled images. STARTUP, Transfer+SimCLR and our approach use both the base dataset and additional unlabeled dataset during the representation learning phase.
102
+
103
+ Our method outperforms all meta-learning-based approaches by a significant margin at all settings. Moreover, compared to Transfer, we achieve more than ${ \sim } 5 . 5 \%$ improvement for 5-shot classification on average. The performance improvement on 1-shot is more significant; we achieve $7 . 9 \%$ improvement on average.
104
+
105
+ We outperform STARTUP by $5 . 5 \%$ on EuroSAT, $3 . 1 \%$ on CropDisease, $2 . 1 \%$ on ChestX, and $3 . 6 \%$ on ISIC for 5-way 5-shot classification. The performance improvement is also quite significant for 1-shot classification; specifically, our method achieves $8 . 8 \%$ improvement on EuroSAT and $7 . 7 \%$ improvement on CropDisease dataset over STARTUP. We only perform slightly worse on the ChestX dataset. For ChestX, it seems that pure unsupervised learning performs pretty well. Considering that our method does not use any self-supervised training or distillation, the performance improvement is impressive. Note that STARTUP uses a fixed teacher to extract pseudo-labels for the unlabeled images, whereas we extract pseudo labels from the weakly-augmented images from the same network that is being trained. In that sense, our model works like a dynamic teacher, where the pseudo labels get more refined as training progress. We hypothesize that the superior performance might be attributed to the dynamic approach of our model over STARTUP.
106
+
107
+ Table 2: 5-way 1-shot and 5-shot scores on the BSCD-FSL benchmark datasets when tieredImageNet is used as base dataset. All models use ResNet-18 for backbone [25]. The mean and $9 5 \%$ confidence interval of 600 runs are reported. For EuroSAT and CropDisease dataset, our method achieves significant performance improvement over other models. The improvement for 1-shot learning is huge (over $7 \%$ for EuroSAT and $10 \%$ for CropDisease).
108
+
109
+ <table><tr><td rowspan="2">Model</td><td colspan="4">1-shot</td><td colspan="4">5-shot</td></tr><tr><td>EuroSAT</td><td>CropDisease</td><td>ISIC</td><td>ChestX</td><td>EuroSAT</td><td>CropDisease</td><td>ISIC</td><td>ChestX</td></tr><tr><td>Transfer</td><td>58.07±.86</td><td>69.94±.87</td><td>29.76±.55</td><td>22.46±.41</td><td>81.34±.53</td><td>90.12±.49</td><td>41.27±.58</td><td>26.33±.45</td></tr><tr><td>SimCLR(Base)</td><td>62.14±.89</td><td>62.45±.90</td><td>31.03±.55</td><td>22.28±.40</td><td>81.85±.59</td><td>84.11±.60</td><td>42.91±.55</td><td>25.96±.44</td></tr><tr><td>STARTUP</td><td>64.32±.87</td><td>70.09±.86</td><td>29.73±.51</td><td>22.10±.40</td><td>85.19±.50</td><td>90.81±.49</td><td>43.55±.56</td><td>26.03±.44</td></tr><tr><td>Transfer+SimCLR</td><td>58.08±.83</td><td>71.25±.89</td><td>31.71±.55</td><td>23.81±.46</td><td>86.08±.47</td><td>91.31±.49</td><td>45.08±.56</td><td>30.26±.50</td></tr><tr><td>Ours</td><td>72.15±.75</td><td>84.41±.75</td><td>33.87±.56</td><td>22.70±.42</td><td>89.44±.42</td><td>95.90±.34</td><td>47.21±.56</td><td>27.67±.46</td></tr></table>
110
+
111
+ Table 3: Few-shot evaluation on the same domain in terms of 5-way 5-shot and 5-way 1-shot accuracy on miniImageNet and tieredImageNet datasets. We use ResNet-10 backbone for miniImageNet and ResNet-18 backbone for tieredImageNet.
112
+
113
+ <table><tr><td></td><td colspan="2">miniImageNet</td><td colspan="2">tieredImageNet</td></tr><tr><td></td><td>1-shot</td><td>5-shot</td><td>1-shot</td><td>5-shot</td></tr><tr><td>ProtoNet</td><td>51.06±.83</td><td>73.49±.63</td><td></td><td></td></tr><tr><td>MatchingNet</td><td>52.34±.81</td><td>67.28±.67</td><td>1</td><td>=</td></tr><tr><td>Transfer</td><td>53.40±.80</td><td>74.26±.64</td><td>58.61±.97</td><td>81.42±.65</td></tr><tr><td>Transfer+SimCLR</td><td>51.63±.82</td><td>74.65±.60</td><td>61.33±.96</td><td>82.89±.65</td></tr><tr><td>STARTUP</td><td>51.68±.84</td><td>74.05±.66</td><td>60.92±.96</td><td>82.11±.64</td></tr><tr><td>Ours</td><td>53.71±.83</td><td>76.02±.61</td><td>69.00±.96</td><td>85.93±.60</td></tr></table>
114
+
115
+ Results with tieredImageNet base data tieredImageNet [19] is a subset of ImageNet dataset with 608 classes. The classes are grouped into 34 super-categories, from which 20 training categories (351 classes), 6 validation categories (97 classes), and 8 testing categories (160 classes) are selected. We use a larger backbone ResNet-18 for meta-training with tieredImageNet [25]. Table 2 shows the performance comparison with other models. We get similar conclusion as we get from Table 1. Particularly, we get $6 . 7 2 \%$ average improvement for 1-shot and $3 . 6 6 \%$ average improvement for 5-shot over STARTUP. However, we do not see much better accuracy than miniImageNet pretrained models even though we are using a much larger base dataset, which suggests that the size of base dataset is not as important as other transfer learning task in cross domain few-shot learning.
116
+
117
+ Few-shot performance on similar domain It has been shown that self-training improves ImageNet classification [33]. Given the distillation approach of our model, one could expect that it might improve the few-shot accuracy even when the target data come from the same domain. Note that STARTUP does not improve the in-domain accuracy [18], even though it is also a self-training based model. We evaluate on miniImageNet and tieredImageNet dataset in terms of 5-way 1-shot and 5-way 5-shot performance. We use the official training split as base dataset, and the unlabeled target data are obtained from $20 \%$ of the novel (test) set and the rest are used for evaluation. For backbone, we use ResNet-10 for miniImageNet and ResNet-18 for tieredImageNet. Table 3 reports the results for in-domain few-shot performance. We see that our method achieves the best performance among the baselines. Particularly, for 1-shot learning in tieredImageNet, our model outperforms the best one by $7 . 7 \%$ . We infer that our method can be safely applied to few-shot learning task when the domain gap between base and target dataset is small, which is in contrast with STARTUP that does not show improvement over “Transfer" for few-shot learning on similar domain.
118
+
119
+ # 4.3 Analysis
120
+
121
+ Effect of dynamic distillation To understand how distillation helps to learn better representation, we use the pretrained models to extract features of the target dataset. Then we use KMeans algorithm to create clusters from the features. The number of clusters in the KMeans is set to be the number of classes of the target dataset. In Table
122
+
123
+ Table 4: V-measure cluster score $( \% )$ [20] on the KMeans clustering of the extracted features with the ground-truth clustering. The backbone is ResNet-10 pretrained on the miniImageNet dataset and/or the unlabeled target dataset.
124
+
125
+ <table><tr><td></td><td>EuroSAT</td><td>CropDisease</td><td>ISIC</td><td>ChestX</td></tr><tr><td>Transfer</td><td>57.01</td><td>62.58</td><td>14.67</td><td>2.45</td></tr><tr><td>SimCLR</td><td>60.06</td><td>62.02</td><td>12.12</td><td>3.84</td></tr><tr><td>STARTUP</td><td>62.02</td><td>69.50</td><td>14.05</td><td>2.71</td></tr><tr><td>Ours</td><td>69.58</td><td>73.27</td><td>14.32</td><td>3.32</td></tr></table>
126
+
127
+ 4, the V-measurement cluster scores [20] between the KMeans clusters and original ground-truth are shown. The V-score has $100 \%$ value when there is maximum agreement between ground-truth and predicted clusters, and $0 \%$ when there’s no agreement. Table 4 shows that our method achieves higher v-scores for EuroSAT and CropDisease dataset, and the v-scores for ISIC and ChestX are also very competitive. It suggests that our model learns a good clustering of the target data even when we are not using any target labels. The clustering is much better when the domain gap is not extreme.
128
+
129
+ Fig. 3 shows t-SNE plots [26] from 10 representative classes from the CropDisease and EuroSAT datasets. We compare the embeddings extracted from “Transfer” and our approach. We see that our method creates better grouping on the embeddings of the target datasets, even though we do not use any labels for the target dataset during pretraining.
130
+
131
+ ![](images/36501101abeac70a3ef2f8ddf896c10e3853579dfdaab8e0e092e6c1fa408902.jpg)
132
+ Figure 3: t-SNE plot of 10 classes from CropDisease (a & b) and EuroSAT (c & d) test sets with features obtained from Transfer and our method.
133
+
134
+ Comparison with self-supervised learning If we ignore the supervised loss, our model has similarity with self-supervised non-contrastive loss similar to BYOL or DINO. However, the projection head we are using to calculate the final predictions of the two different views of an unlabeled image is the same classification head that is used to predict the classification logits of the labeled base samples. In Table 5, “Ours (distillation head)” represents the model where we use separate projection head for the predictions of the unlabeled images. We see that separate projection head performs much worse. We found that the distillation loss is simply converging to a trivial solution in this case. To discourage trivial solution, we add recently developed tricks in self-supervised learning, namely, centering and strong augmentation - which turns the unlabeled branch similar to ResNet DINO [2]. “Ours (DINO head)” achieves better accuracy than “Ours (distillation head)”, suggesting that it alleviates the issue of trivial solution. However, our original method still achieves a significant $3 . 0 7 \%$ more improvement. It is interesting to note that a separate projection head causes trivial solution for the unlabeled images, whereas our model does not converge to trivial solution with similar settings. We infer that using a supervised classifier linear layer as the projection head can solve the issue of trivial solution for the self-supervised learning to some extent without requiring extra tricks like BatchNorm [6] or centering $I 2 I$ . Additionally, it provides a better clustering of the unlabeled features, even if the unlabeled samples come from different domain than the labeled samples. Table 5 also shows results for “Ours $^ +$ SimCLR”, which simply adds a SimCLR loss for the unlabeled samples. It performs slightly better only in ChestX dataset. On average, the performance is similar to “Ours”, which signifies that there is no clear benefit using a self-supervised contrastive loss to achieve better transferability for our method. Note that STARTUP comes to a different conclusion reporting that adding SimCLR loss consistently improves the performance.
135
+
136
+ Table 5: Our method with self-supervised approaches. The evaluation is performed on BSCD-FSL benchmark in terms of 5-way 5-shot accuracy $( \% )$ . “Ours (distillation head)” refers to the model where we use a separate projection head for the distillation loss, which achieves much worse scores. In “Ours $^ +$ DINO”, we use a separate projection head with centering and strong augmentation as in DINO [2]. It achieves better performance than naive transfer, but still under-performs in comparison to our approach. “Ours $^ +$ SimCLR” simply adds a self-supervised contrastive loss for the unlabeled samples. See Appendix for more details.
137
+
138
+ <table><tr><td></td><td>EuroSAT</td><td>CropDisease</td><td>ISIC</td><td>ChestX</td></tr><tr><td>Ours</td><td>89.07</td><td>95.54</td><td>49.36</td><td>28.31</td></tr><tr><td>Ours (distillation head)</td><td>80.06</td><td>89.31</td><td>46.63</td><td>25.29</td></tr><tr><td>Ours (DINO head)</td><td>85.74</td><td>90.55</td><td>46.24</td><td>25.42</td></tr><tr><td>Ours+SimCLR</td><td>88.48</td><td>93.80</td><td>49.10</td><td>29.45</td></tr></table>
139
+
140
+ Experiment of few-shot classification on fine-grained dataset CUB [30] contains 200 classes and 11,788 images of different bird species. ‘miniImageNet- $\cdot >$ CUB’ is an interesting experiment to show the transferability of different models to a fine-grained dataset. We report the results in Table 6 in terms of 5-way 5-shot scores. For CUB, we found that vanilla Transfer performs surprisingly well (also reported by [3]), and adding SimCLR with Transfer (Transfer+SimCLR) actually decreases the accuracy. Wallace and Hariharan [31] also experimented with different self-supervised methods on smaller domain and found that all of them under-perform for fine-grained task [2]. However, our method still performs the best, demonstrating the effectiveness of our approach in a fine-grained downstream task.
141
+
142
+ Table 6: Experiment on mini-ImageNet $\bullet >$ CUB. All the scores are reproduced by us.
143
+
144
+ <table><tr><td>ProtoNet</td><td>Transfer</td><td>SimCLR</td><td>Transfer+SimCLR</td><td>STARTUP</td><td>Ours</td></tr><tr><td>63.19</td><td>68.72</td><td>62.84</td><td>67.82</td><td>66.10</td><td>69.50</td></tr></table>
145
+
146
+ Experiment of distillation with unlabeled datasets from different domain Table 7 reports the few-shot accuracy when our model is trained on different unlabeled datasets. The best accuracy is achieved when the unlabeled data and target data are from the same domain. Even if the unlabeled data consists of images from multiple domains including the target domain (denoted as “Ours-all”), it still significantly under-performs the base model.
147
+
148
+ Table 7: Effect of unlabeled datasets from a different domain than the target dataset in terms of 5-way 5-shot accuracy $( \% )$ . “Ours-X” denotes that we use base and “X” dataset during pretraining. “Ours-all” denotes that we use unlabeled images from all four target datasets.
149
+
150
+ <table><tr><td></td><td>EuroSAT</td><td>CropDisease</td><td>ChestX</td><td>ISIC</td></tr><tr><td>Ours-EuroSAT</td><td>89.07</td><td>90.43</td><td>26.02</td><td>46.82</td></tr><tr><td>Ours-CropDisease</td><td>81.86</td><td>95.54</td><td>26.17</td><td>45.12</td></tr><tr><td>Ours-ISIC</td><td>81.94</td><td>89.69</td><td>26.70</td><td>49.36</td></tr><tr><td>Ours-ChestX</td><td>81.87</td><td>90.38</td><td>28.31</td><td>45.20</td></tr><tr><td>Ours-All</td><td>82.75</td><td>91.31</td><td>26.01</td><td>46.43</td></tr></table>
151
+
152
+ Effect of data augmentation On the unlabeled images, we apply two types of augmentation: weak augmentation to extract pseudo labels and strong augmentation to impose consistency regularization. This setting is denoted as “weak-strong” (w-s), where ‘weak’ (w) augmentation is applied to the image that is fed into the teacher network and ‘strong’ (s) augmentation is applied to the image that is fed into the student network. We also show results with “weak-weak” (w-w), “strong-weak” (s-w) and “strong-strong” (s-s) augmentation settings in Figure 4a. Both “weak-weak” and “strong-strong” perform worse than the other augmentations. We also note that in self-supervised learning, generally strong augmentation is applied to all training images to get good performance. In our experiment, we find that applying weak augmentation in one of the image pairs improves the performance.
153
+
154
+ More unlabeled data To measure the effect of amount of unlabeled dataset during pretraining, we divide the target dataset by $80 \%$ and $20 \%$ splits. The $20 \%$ split is used for evaluation. From the $80 \%$ split, we vary the amount of unlabeled data and then pretrain with source and the unlabeled set. Fig. 4b shows the average 5-shot accuracy for different amounts of the unlabeled dataset during the pretraining phase. As expected, more information from the unlabeled dataset helps to learn better representations on the target domain. However, the performance saturates later, and we get diminishing return for more unlabeled data. It also signifies that there are scopes to improve the performance by using more unlabeled data denoting potential future research direction.
155
+
156
+ # 4.4 Addition Ablation Studies
157
+
158
+ We perform several ablation studies of different components of our approach. All scores are reported for 5-way 5-shot evaluation. More ablations are provided in the Appendix.
159
+
160
+ Longer training We use the base dataset pretrained network as initialization for our network, and then train on both base dataset and unlabeled dataset for 60 epochs. Figure $_ \mathrm { 4 c }$ reports average 5-way 5-shot few-shot on the BSCD-FSL benchmark performance for our pretrained with longer training epoch. Training for more epochs can result in minor improvement $( 0 . 2 \% )$ .
161
+
162
+ ![](images/f1b5c962ab2ccd9c9213cde32790f32a6824e26df90bce206252a13bf3f3f81d.jpg)
163
+ Figure 4: Ablation studies for (a) data augmentation on unlabeled images, (b) effect of longer training on base and unlabeled data, (c) amount of unlabeled data. The Y-axis represents average top1 accuracy $( \% )$ on the four benchmark datasets for 5-shot classification for 600 episodes. We use miniImageNet for labeled source dataset and ResNet-10 as backbone.
164
+
165
+ Table 8: Ablation studies on different settings. Mean over 600 runs.
166
+
167
+ <table><tr><td></td><td>EuroSAT</td><td>CropDisease</td><td>ISIC</td><td>ChestX</td></tr><tr><td>Ours</td><td>89.07</td><td>95.54</td><td>49.36</td><td>28.31</td></tr><tr><td>Ours(w/o base)</td><td>82.11</td><td>90.52</td><td>39.76</td><td>26.83</td></tr><tr><td>Ours(1-step)</td><td>86.16</td><td>87.28</td><td>46.10</td><td>25.11</td></tr></table>
168
+
169
+ Effect of base dataset Here, we perform experiments without the first term in Eq. 4, i.e., we train the network on the base dataset first and then re-train only on the unlabeled images (without joint training on the base dataset), denoted as “Ours (w/o base)”. Table 8 shows that the performance of “Ours (w/o base)” is poor, suggesting that the representation related to the labeled base dataset is still helpful to the target domain.
170
+
171
+ Training without pretrained model on base dataset We perform 2-step training during the representation learning phase - we first train the model on mini-IN only, and then jointly train on mini-IN and unlabeled images. In Table 8, “Ours(1-step)” denotes training on the unlabeled images and mini-IN from scratch for 300 epochs, which performs worse than 2-step training. Our assumption is that the proposed model is also like self-training where a well-trained teacher is needed.
172
+
173
+ # 5 Conclusion
174
+
175
+ We introduced a novel approach to utilize unlabeled data from the target domain for cross-domain fewshot learning. Experiments show that our method achieves state-of-the-art results in the BSCD-FSL benchmark for both 1-shot and 5-shot classification. Our model also outperforms other approaches in the same-domain few-shot learning. Future work can be focused on applying our approach in each episode during meta-testing so that the model can learn more category-specific representations.
176
+
177
+ # 6 Broader Impact
178
+
179
+ The approach tackles a practical problem of the existing few-shot learning setup that the base dataset and the novel samples generally come from different domain. Our work uses the unlabeled samples from the target dataset to learn more target specific representation. Like any other machine learning tool, the final impact depends on the intention of the people or institution applying it. However, it can be useful in drug discovery or medical image analysis where labeled dataset is limited.
180
+
181
+ # 7 Acknowledgments
182
+
183
+ This material is based upon work supported by the U.S. Department of Homeland Security, Science and Technology Directorate, Office of University Programs, under Grant Award 2013-ST-061- ED0001. The views and conclusions contained in this document are those of the authors and should not be interpreted as necessarily representing the official policies, either expressed or implied, of the U.S. Department of Homeland Security.
184
+
185
+ # References
186
+
187
+ [1] E. Arazo, D. Ortego, P. Albert, N. E. O’Connor, and K. McGuinness. Pseudo-labeling and confirmation bias in deep semi-supervised learning. In 2020 International Joint Conference on Neural Networks (IJCNN), pages 1–8. IEEE, 2020.
188
+ [2] M. Caron, H. Touvron, I. Misra, H. Jégou, J. Mairal, P. Bojanowski, and A. Joulin. Emerging properties in self-supervised vision transformers, 2021.
189
+ [3] W.-Y. Chen, Y.-C. Liu, Z. Kira, Y.-C. F. Wang, and J.-B. Huang. A closer look at few-shot classification. arXiv preprint arXiv:1904.04232, 2019.
190
+ [4] N. Codella, V. Rotemberg, P. Tschandl, M. E. Celebi, S. Dusza, D. Gutman, B. Helba, A. Kalloo, K. Liopyris, M. Marchetti, et al. Skin lesion analysis toward melanoma detection 2018: A challenge hosted by the international skin imaging collaboration (isic). arXiv preprint arXiv:1902.03368, 2019.
191
+ [5] J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, pages 248–255. IEEE, 2009. [6] J.-B. Grill, F. Strub, F. Altché, C. Tallec, P. H. Richemond, E. Buchatskaya, C. Doersch, B. A. Pires, Z. D. Guo, M. G. Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv preprint arXiv:2006.07733, 2020. [7] Y. Guo, N. C. Codella, L. Karlinsky, J. V. Codella, J. R. Smith, K. Saenko, T. Rosing, and R. Feris. A broader study of cross-domain few-shot learning. Eur. Conf. Comput. Vis., 2020.
192
+ [8] P. Helber, B. Bischke, A. Dengel, and D. Borth. Eurosat: A novel dataset and deep learning benchmark for land use and land cover classification. IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, 12(7):2217–2226, 2019. [9] A. Islam, C.-F. Chen, R. Panda, L. Karlinsky, R. Radke, and R. Feris. A broad study on the transferability of visual representations with contrastive learning, 2021.
193
+ [10] T. Jeong and H. Kim. Ood-maml: Meta-learning for few-shot out-of-distribution detection and classification. Advances in Neural Information Processing Systems, 33, 2020.
194
+ [11] J. Kim, T. Kim, S. Kim, and C. D. Yoo. Edge-labeling graph neural network for few-shot learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 11–20, 2019.
195
+ [12] D.-H. Lee et al. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In Workshop on challenges in representation learning, ICML, volume 3, 2013.
196
+ [13] K. Lee, S. Maji, A. Ravichandran, and S. Soatto. Meta-learning with differentiable convex optimization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10657– 10665, 2019.
197
+ [14] K. Lee, S. Maji, A. Ravichandran, and S. Soatto. Meta-learning with differentiable convex optimization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10657– 10665, 2019.
198
+ [15] Y. Liu, J. Lee, M. Park, S. Kim, E. Yang, S. J. Hwang, and Y. Yang. Learning to propagate labels: Transductive propagation network for few-shot learning. arXiv preprint arXiv:1805.10002, 2018.
199
+ [16] T. Miyato, S.-i. Maeda, M. Koyama, and S. Ishii. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. IEEE transactions on pattern analysis and machine intelligence, 41(8):1979–1993, 2018.
200
+ [17] S. P. Mohanty, D. P. Hughes, and M. Salathé. Using deep learning for image-based plant disease detection. Frontiers in plant science, 7:1419, 2016.
201
+ [18] C. P. Phoo and B. Hariharan. Self-training for few-shot transfer across extreme task differences. arXiv preprint arXiv:2010.07734, 2020.
202
+ [19] M. Ren, E. Triantafillou, S. Ravi, J. Snell, K. Swersky, J. B. Tenenbaum, H. Larochelle, and R. S. Zemel. Meta-learning for semi-supervised few-shot classification. arXiv preprint arXiv:1803.00676, 2018.
203
+ [20] A. Rosenberg and J. Hirschberg. V-measure: A conditional entropy-based external cluster evaluation measure. In Proceedings of the 2007 joint conference on empirical methods in natural language processing and computational natural language learning (EMNLP-CoNLL), pages 410–420, 2007.
204
+ [21] J. Snell, K. Swersky, and R. Zemel. Prototypical networks for few-shot learning. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30, pages 4077–4087. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper/2017/file/ cb8da6767461f2812ae4290eac7cbc42-Paper.pdf.
205
+ [22] K. Sohn, D. Berthelot, C.-L. Li, Z. Zhang, N. Carlini, E. D. Cubuk, A. Kurakin, H. Zhang, and C. Raffel. Fixmatch: Simplifying semi-supervised learning with consistency and confidence. arXiv preprint arXiv:2001.07685, 2020.
206
+ [23] F. Sung, Y. Yang, L. Zhang, T. Xiang, P. H. Torr, and T. M. Hospedales. Learning to compare: Relation network for few-shot learning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1199–1208, 2018.
207
+ [24] A. Tarvainen and H. Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results, 2018.
208
+ [25] Y. Tian, Y. Wang, D. Krishnan, J. B. Tenenbaum, and P. Isola. Rethinking few-shot image classification: a good embedding is all you need? arXiv preprint arXiv:2003.11539, 2020.
209
+ [26] L. van der Maaten and G. Hinton. Visualizing high-dimensional data using t-sne.(2008). Reference Source [Google Scholar], 2008.
210
+ [27] V. Verma, K. Kawaguchi, A. Lamb, J. Kannala, Y. Bengio, and D. Lopez-Paz. Interpolation consistency training for semi-supervised learning. arXiv preprint arXiv:1903.03825, 2019.
211
+ [28] O. Vinyals, C. Blundell, T. Lillicrap, k. kavukcuoglu, and D. Wierstra. Matching networks for one shot learning. In D. Lee, M. Sugiyama, U. Luxburg, I. Guyon, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 29, pages 3630–3638. Curran Associates, Inc., 2016. URL https://proceedings.neurips.cc/paper/2016/file/ 90e1357833654983612fb05e3ec9148c-Paper.pdf.
212
+ [29] O. Vinyals, C. Blundell, T. Lillicrap, D. Wierstra, et al. Matching networks for one shot learning. In Advances in neural information processing systems, pages 3630–3638, 2016.
213
+ [30] C. Wah, S. Branson, P. Welinder, P. Perona, and S. Belongie. The caltech-ucsd birds-200-2011 dataset. 2011.
214
+ [31] B. Wallace and B. Hariharan. Extending and analyzing self-supervised learning across domains. In European Conference on Computer Vision, pages 717–734. Springer, 2020.
215
+ [32] X. Wang, Y. Peng, L. Lu, Z. Lu, M. Bagheri, and R. M. Summers. Chestx-ray8: Hospital-scale chest x-ray database and benchmarks on weakly-supervised classification and localization of common thorax diseases. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2097–2106, 2017.
216
+ [33] Q. Xie, M.-T. Luong, E. Hovy, and Q. V. Le. Self-training with noisy student improves imagenet classification. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10687–10698, 2020.
217
+ [34] Q. Xu, T. Likhomanenko, J. Kahn, A. Hannun, G. Synnaeve, and R. Collobert. Iterative pseudo-labeling for speech recognition. arXiv preprint arXiv:2005.09267, 2020.
218
+ [35] I. Z. Yalniz, H. Jégou, K. Chen, M. Paluri, and D. Mahajan. Billion-scale semi-supervised learning for image classification. arXiv preprint arXiv:1905.00546, 2019.
219
+ [36] R. Zhang, T. Che, Z. Ghahramani, Y. Bengio, and Y. Song. Metagan: An adversarial approach to few-shot learning. NeurIPS, 2:8, 2018.
md/train/foNTMJHXHXC/foNTMJHXHXC.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/gG4j9PybfwI/gG4j9PybfwI.md ADDED
@@ -0,0 +1,452 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Beyond Fine-Tuning: Transferring Behavior in Reinforcement Learning
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Designing agents that acquire knowledge autonomously and use it to solve new
11
+ 2 tasks efficiently is an important challenge in reinforcement learning. Knowledge
12
+ 3 acquired during an unsupervised pre-training phase is often transferred by fine
13
+ 4 tuning neural network weights once rewards are exposed, as is common practice
14
+ 5 in supervised domains. Given the nature of the reinforcement learning problem,
15
+ 6 we argue that standard fine-tuning strategies alone are not enough for efficient
16
+ 7 transfer in challenging domains. We introduce Behavior Transfer (BT), a technique
17
+ 8 that leverages pre-trained policies for exploration and that is complementary to
18
+ 9 transferring neural network weights. Our experiments show that, when combined
19
+ 10 with large-scale pre-training in the absence of rewards, existing intrinsic motivation
20
+ 11 objectives can lead to the emergence of complex behaviors. These pre-trained
21
+ 12 policies can then be leveraged by BT to discover better solutions than without
22
+ 13 pre-training, and combining BT with standard fine-tuning strategies results in
23
+ 14 additional benefits. The largest gains are generally observed in domains requiring
24
+ 15 structured exploration, including settings where the behavior of the pre-trained
25
+ 16 policies is misaligned with the downstream task.
26
+
27
+ # 17 1 Introduction
28
+
29
+ 18 Transfer in deep learning is often performed through parameter initialization followed by fine-tuning,
30
+ 19 a technique that allows to leverage the power of deep networks in domains where labelled data
31
+ 20 is scarce [60, 16, 61, 22, 15]. This builds on the intuition that the pre-trained model will map
32
+ 21 inputs to a feature space where the downstream task is easy to perform. When combined with
33
+ 22 methods that can leverage massive amounts of unlabelled data for pre-training, this transfer strategy
34
+ 23 has led to unprecedented results in domains like computer vision [31, 30] and natural language
35
+ 24 processing [15, 50]. The success of these approaches has led to an ever-growing interest in developing
36
+ 25 techniques for pre-training large scale models on unlabelled data [9, 13, 24].
37
+ 26 In the reinforcement learning (RL) context, unsupervised methods that learn in the absence of reward
38
+ 27 have also garnered much research attention [23, 21, 46, 19, 29]. The benefits of unsupervised pre
39
+ 28 training are typically evaluated by their ability to enable efficient transfer to previously unseen reward
40
+ 29 functions [28]. In spite of their different approaches to unsupervised RL, most of the top-performing
41
+ 30 methods in this setting transfer knowledge through neural network weights. Such approaches deal
42
+ 31 with the data inefficiency associated to training neural networks with gradient descent, similarly to
43
+ 32 what is done in supervised learning, e.g. by pre-training encoders that extract representations from
44
+ 33 observations [59]. However, RL introduces a challenge that is not present in supervised learning: the
45
+ 34 agent is responsible for collecting the right data to learn from. This introduces a second source of
46
+ 35 inefficiency from which transfer approaches can also suffer if they rely on unstructured exploration
47
+ 36 strategies after pre-training, as these can lead to exponentially larger data requirements in complex
48
+ 37 downstream environments [45, 44]. To address this problem, one could consider fine-tuning policies
49
+ 38 that produce meaningful behavior [43, 52], but this approach quickly disregards the pre-trained
50
+ 39 behavior when learning in the downstream task due to catastrophic forgetting.
51
+ 40 In this work, we explicitly separate the transfer of behaviour and weights. We propose to make
52
+ 41 use of the pre-trained behaviour itself (i.e., the pre-trained policy mapping from observations to
53
+ 42 actions) in contrast to pre-trained neural network weights for further fine-tuning. While pre-trained
54
+ 43 behavior has been used before for exploitation [5, 56, 2, 3], our approach employs pre-trained policies
55
+ 44 to aid with exploration as well to collect experience that can be leveraged via off-policy learning.
56
+ 45 This strategy accelerates learning, as the agent is exposed to potentially useful experience earlier in
57
+ 46 training, without compromising the quality of the discovered solution when the pre-trained behavior
58
+ 47 is not aligned with the downstream task. We expose the pre-trained behaviour to the downstream
59
+ 48 agent in two ways: firstly, as an extra exploratory strategy that, when randomly activated, persists for
60
+ 49 a number of steps, and secondly as an additional pseudo-action for the learned value function where
61
+ 50 the agent may elect to defer action selection to the pre-trained policy instead of choosing itself. We
62
+ 51 call this approach Behavior Transfer (BT).
63
+ 52 Defining unsupervised RL objectives remains an open problem, and solutions are generally influenced
64
+ 53 by how the acquired knowledge will be used for solving downstream tasks. Instead of proposing yet
65
+ 54 another objective for unsupervised pre-training, we turn to existing techniques for training policies in
66
+ 55 the absence of reward and make our choice based on two general requirements. First, the objective
67
+ 56 should scale gracefully with increased compute and data. This has been key for the success of
68
+ 57 self-supervised approaches in other domains [9, 35], and we argue that it is an important property for
69
+ 58 unsupervised RL as well. Second, the pre-training stage should return a policy that produces complex
70
+ 59 behavior that may be leveraged in a subsequent transfer stage. The Never Give Up (NGU) [48]
71
+ 60 intrinsic reward meets both requirements, and our experiments show that large-scale pre-training with
72
+ 61 this objective leads to state of the art scores in the reward-free Atari benchmark.
73
+ 62 Figure 1 exemplifies our main findings. We pre-train behaviour using the intrinsic NGU reward during
74
+ 63 a long unsupervised phase without rewards. This gives rise to exploratory behaviors that seek to visit
75
+ 64 many different states throughout an episode, and we then compare different strategies for leveraging
76
+ 65 the acquired knowledge once rewards are reinstated. While fine-tuning the pre-trained weights
77
+ 66 enables faster learning, the exploratory behavior of the pre-trained policy is quickly disregarded as it
78
+ 67 is exposed to rewards. On the other hand, Behavior Transfer (BT) does not modify the pre-trained
79
+ 68 policy while learning in the new task and is able to achieve higher end scores thanks to better
80
+ 69 exploration. These two strategies are not mutually exclusive, and BT also benefits from the faster
81
+ 70 convergence provided by initializing neural networks with pre-trained weights when these encode
82
+ 71 useful information for solving the downstream task.
83
+ 72 Our contributions can be summarized as follows. (1) We propose Behavior Transfer (BT), a technique
84
+ 73 that leverages pre-trained policies for exploration by treating them as black boxes that are not modified
85
+ 74 during learning on the downstream task. BT uses the pre-trained policy to collect experience in
86
+ 75 two ways, namely randomly-triggered temporally-extended exploration and one-step calls based on
87
+ 76 value estimates. (2) Our experiments show that large-scale unsupervised pre-training with existing
88
+ 77 intrinsic rewards can produce meaningful behavior, achieving state of the art results in the reward-free
89
+ 78 Atari benchmark. These results suggest that scale is key for unsupervised RL, akin to what has been
90
+ 79 observed in supervised settings. (3) We provide extensive empirical evidence demonstrating the
91
+ 80 benefits of leveraging pre-trained behavior via BT. Our approach obtains the largest gains in hard
92
+ 81 exploration games, where it almost doubles the median human normalized score achieved by our
93
+ 82 strongest baseline. Furthermore, we show that BT is able to leverage a single task-agnostic policy
94
+ 83 to solve multiple tasks in the same environment and to achieve high performance even when the
95
+ 84 pre-trained policies are misaligned with the task being solved. (4) BT brings benefits to the table
96
+ 85 that are complementary to those provided by reusing pre-trained neural network weights, and we
97
+ 86 empirically show that combining these two strategies can result in larger gains.
98
+
99
+ ![](images/696568b2c84f51d1ef7c367946f1a4c3d2eebbbcb736aedca9ae66aae814bfa2.jpg)
100
+ Figure 1: Comparison of transfer strategies on Montezuma’s Revenge and Defender after pre-training a policy with NGU [48] in the absence of reward. The benefits of our proposed approach to leverage pre-trained behavior for exploration, Behavior Transfer (BT), are complementary to the gains provided by pre-trained weight initialization followed by fine-tuning.
101
+
102
+ # 87 2 Preliminaries
103
+
104
+ 88 The interaction between the agent and the environment is modelled as a Markov Decission Pro
105
+ 89 cess (MDP) [49]. An MDP is defined by the tuple $( S , A , P , d _ { 0 } , R , \gamma )$ where $s$ and $\mathcal { A }$ are the state
106
+ 90 and action spaces, $P ( s ^ { \prime } | s , a )$ is the probability of transitioning from state $s$ to $s ^ { \prime }$ after taking action $a$
107
+ 91 $d _ { 0 } ( s )$ is the probability distribution over initial states, $R : S \times \mathcal { A } \times \mathcal { S } \mathbb { R }$ is the reward function,
108
+ 92 and retu $\gamma \in [ 0 , 1 )$ $\begin{array} { r } { \dot { G } _ { t } = \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } R _ { t } } \end{array}$ unt fact, where $R _ { t } = r \hat { ( } S _ { t } , A _ { t } , S _ { t + 1 } )$ a policy . A prin $\pi ( a | s )$ that maximizes the expected way to address this problem
109
+ 94 is to use methods that compute action-value functions, $Q ^ { \pi } ( \bar { s } , a ) \overset { - } { = } \mathbb { E } _ { \pi } \left[ G _ { t } \vert S _ { t } = s , A _ { t } = a \right]$ , where
110
+ 95 $\mathbb { E } _ { \pi } [ \cdot ]$ denotes expectation over transitions induced by $\pi$ [49].
111
+ 96 We consider a setting where the agent is allowed to first learn within an MDP without rewards,
112
+ 97 $\boldsymbol { \mathcal { M } } ^ { R } = ( \boldsymbol { \mathcal { S } } , \boldsymbol { \mathcal { A } } , P , d _ { 0 } )$ , for a long period of time. The knowledge acquired during the reward-free
113
+ 98 stage is later leveraged when maximizing reward in new MDPs that share the same underlying
114
+ 99 dynamics but have different reward functions, $\mathcal { M } _ { i } = ( S , A , P , d _ { 0 } , R _ { i } , \gamma _ { i } )$ . Interactions between the
115
+ 100 agent and the environment are often assumed to incur a cost, but we will consider this cost to be
116
+ 101 relevant only for transitions with reward [28]. Even if the cost of unsupervised pre-training becomes
117
+ 102 non-negligible, it can be amortized when the acquired task-agnostic knowledge is leveraged to solve
118
+ 103 multiple tasks efficiently [15, 9]. Indeed, we would expect this transfer setting to become more
119
+ 104 relevant as the community moves towards more complex environments, where one may want to
120
+ 105 train agents to maximize multiple reward functions under constant dynamics. In the limit, one could
121
+ 106 consider the real world: it has constant or slowly changing dynamics, and humans are able to leverage
122
+ 107 previously acquired skills to quickly master new tasks.
123
+
124
+ # 108 3 Behavior Transfer
125
+
126
+ 109 Transfer in supervised domains often exploits the fact that related tasks might be solved using similar
127
+ 110 representations. This practice deals with the data inefficiency of training large neural networks
128
+ 111 with stochastic gradient descent. However, there is an additional source of data inefficiency when
129
+ 112 training RL agents: unstructured exploration. Fine-tuning a pre-trained exploratory policy arises as
130
+ 113 a potential strategy for overcoming this problem, as the agent will observe rich experience much
131
+ 114 earlier in training than when initializing the policy randomly, but this approach suffers from important
132
+ 115 limitations. Learning in the downstream task can lead to catastrophically forgetting the pre-trained
133
+ 116 policy, thus prematurely disregarding its exploratory behavior. Moreover, the same neural network
134
+ 117 architecture needs to be used for both the pre-trained and the downstream policies, which in practice
135
+ 118 also imposes a limitation on the type of RL methods that can be employed in the adaptation stage (for
136
+ 119 instance, if the pre-trained policy was trained using a policy-based method, it might not be possible
137
+ 120 to fine-tune it using a value-based approach).
138
+ 121 Let us assume that we have access to a pre-trained policy that exhibits exploratory behavior, and
139
+ 122 defer the discussion on how to train this policy to Section 4. Following such a policy might bring
140
+ 123 the agent to states that are unlikely to be visited with unstructured exploration techniques such as
141
+ 124 $\epsilon$ -greedy [55]. This property has the potential of accelerating learning even when the behavior of
142
+ 125 the pre-trained policy is not aligned with the downstream task, as it will effectively shorten the
143
+ 126 path between otherwise distant states [41]. Leveraging pre-trained policies for exploration differs
144
+ 127 from other approaches in the literature that use such policies directly for exploitation, e.g. via
145
+ 128 zero-shot transfer [19], methods that define a higher-level policy that alternates between the given
146
+ 129 policies [5, 56], or within the framework of generalized policy updates [4]. Exploring with pre-trained
147
+ 130 policies can accelerate convergence by providing useful experience to the agent, which is possible
148
+ 131 even when the pre-training and downstream tasks are misaligned. However, strategies that directly
149
+ 132 use the pre-trained policies for exploitation may result in sub-optimal solutions in such scenario [2].
150
+ 133 We propose to leverage the behavior of pre-trained policies during transfer to aid with exploration. An
151
+ 134 explicit distinction between behavior and representation is made by considering pre-trained policies as
152
+ 135 black boxes that take observations and return actions. This strategy is agnostic to how the pre-trained
153
+ 136 behavior is encoded and is not restricted to learned policies. We rely on off-policy learning methods
154
+ 137 during transfer to leverage the behavior of a pre-trained policy $\bar { \pi _ { p } ( a | s ) }$ . We keep $\pi _ { p }$ fixed during
155
+ 138 transfer, which prevents catastrophic forgetting of the original behavior when it is parameterized by a
156
+ 139 neural network (i.e., we instantiate and train a new policy with its own set of parameters). We propose
157
+ 140 Behavior Transfer (BT), which leverages two complementary strategies to achieve this. Since BT
158
+ 141 is agnostic to the method used to pre-train policies, $B T ( \pi _ { p } )$ refers to behavior being transferred
159
+ 142 from policy $\pi _ { p }$ . We formalize BT in the context of value-based Q-learning agents, although similar
160
+ 143 derivations are in principle possible for alternative off-policy learning methods. Pseudo-code for BT
161
+ 144 is provided in Algorithm 1.
162
+ 145 Temporally-extended exploration. We draw inspiration from Lévy flights [57], a class of ecological
163
+ 146 models for animal foraging, where a fixed direction is followed for a duration sampled from a
164
+ 147 heavy-tailed distribution. This principle was implemented in the context of exploration in RL by
165
+ 148 $\epsilon z$ -greedy [14], which encodes the notion of direction in the environment via exploration options that
166
+ 149 repeat the same action throughout the entire flight. Since $\pi _ { p }$ is more likely to encode a meaningful
167
+ 150 notion of direction in complex environments than action repeats, we propose a variant of $\epsilon z$ -greedy
168
+ 151 where $\pi _ { p }$ is used as the exploration option. An exploratory flight might be started at any step with
169
+ 152 some probability. The duration for the flight is sampled from a heavy-tailed distribution (Zeta with
170
+ 153 $\mu = 2$ in all our experiments), and control is handed over to $\pi _ { p }$ during the complete flight. When not
171
+ 154 in a flight, actions are sampled from the behavior policy obtained while maximizing the task reward
172
+ 155 (e.g. an $\epsilon$ -greedy derived from the estimated Q values).
173
+ 156 Extra action. The previous approach switches to $\pi _ { p }$ during experience collection blindly, and we
174
+ 157 now consider an alternative strategy for triggering these switches based on value. This can be easily
175
+ 158 implemented through an extra action which samples an action from $\pi _ { p }$ , which also allows the agent to
176
+ 159 use the pre-trained policy at test time if deemed beneficial. More formally, this amounts to training a
177
+ 160 policy over an expanded action set $\mathcal { A } ^ { + } = \mathcal { A } \cup \{ a _ { + } \}$ , where $a _ { + }$ is resolved by sampling an action from
178
+ 161 $\pi _ { p }$ , $a ^ { \prime } \sim \pi _ { p } ( s )$ (with $a ^ { \prime } \in { \mathcal { A } }$ ). The additional action can be seen as an option that can be initiated
179
+ 162 from any state and always terminates after a single step. Note that selecting the option will lead to
180
+ 163 the same outcome as if the agent had selected $a ^ { \prime }$ as a primitive action, and we take advantage of this
181
+ 164 observation by using the return of following the option as target to fit both $Q ( s , \pi _ { p } ( s ) )$ and $Q ( s , a ^ { \prime } )$ .
182
+ 165 Intuitively, this approach induces a bias that favours actions selected by $\pi _ { p }$ , accelerating the collection
183
+ 166 of rewarding transitions when the pre-trained policy is somewhat aligned with the downstream task.
184
+ 167 Otherwise, the agent can learn to ignore $\pi _ { p }$ as training progresses by selecting other actions.
185
+
186
+ # Algorithm 1: Experience collection pseudo-code for BT
187
+
188
+ Input: Action set, $\mathcal { A }$ ; additional action, $a _ { + }$ ; extended action set, $\mathcal { A } ^ { + } = \mathcal { A } \cup \{ a _ { + } \}$ ; pre-trained policy, $\pi _ { p }$ ; Q-value estimate for the current policy, $Q ^ { \pi } ( s , a ) \forall a \in A ^ { + }$ ; probability of taking an exploratory action, $\epsilon$ ; probability of starting a flight, $\epsilon _ { \mathrm { l e v y } }$ ; flight length distribution, $\mathcal { D } ( \mathbb { N } )$
189
+ while True do $n \gets 0$ // flight length while episode not ended do Observe state $s$ if $n = = 0$ and random $) \le \epsilon _ { l e v y }$ then $n \sim \mathcal { D } ( \mathbb { N } )$ // sample flight length if $n > 0$ then $\begin{array} { l } { n n - 1 } \\ { a \sim \pi _ { p } ( s ) } \end{array}$ else if random $) \leq \epsilon$ then $a \sim \operatorname { U n i f o r m } ( \mathcal { A } ^ { + } )$ else $a \gets \arg \operatorname* { m a x } _ { a ^ { \prime } \in \mathcal { A } ^ { + } } [ Q ^ { \pi } ( s , a ^ { \prime } ) ]$ if $a = = a _ { + }$ then $a \sim \pi _ { p } ( s )$ end Take action $a$ end
190
+ end
191
+
192
+ 169 It is a common practice to derive objectives for proxy tasks in order to drive learning in the absence
193
+ 170 of reward functions, and there exists a plethora of different approaches in the literature. Model-based
194
+ 171 approaches can learn world models from unsupervised interaction [26]. However, the diversity of
195
+ 172 the training data will impact the accuracy of the model [53] and deploying this type of approach
196
+ 173 in visually complex domains like Atari remains an open problem [27]. Unsupervised RL has also
197
+ 174 been explored through the lens of empowerment [51, 42], which studies agents that aim to discover
198
+ 175 intrinsic options [23, 19]. While these options can be leveraged by hierarchical agents [21] or
199
+ 176 integrated within the universal successor features framework [2, 3, 8, 28], their potential lack of
200
+ 177 coverage generally limits their applicability to complex downstream tasks [12]. An alternative
201
+ 178 objective is that of exploring the environment by finding policies that induce maximally entropic state
202
+ 179 distributions [29, 39], although this might become extremely inefficient in high-dimensional state
203
+ 180 spaces without proper priors [40, 59].
204
+ 181 Recall that our goal is to devise a pre-training objective that can help reduce the amount of interaction
205
+ 182 needed by the agent to collect relevant experience when learning in a downstream task. We argue that
206
+ 183 such objective needs to meet two requirements. First, as suggested by results in other domains [9, 35],
207
+ 184 it should scale gracefully as the amount of compute and experience used for pre-training are increased.
208
+ 185 This contrasts with the training regimes used in most unsupervised RL approaches, which use a
209
+ 186 relatively small amount of experience [28, 40, 59] when compared to distributed agents that do make
210
+ 187 use of rewards [33, 18, 36]. Second, it must encourage the emergence of complex behaviors such as
211
+ 188 navigation or manipulation skills. It has been argued that exploring the environment efficiently will
212
+ 189 serve as a proxy for developing such behaviors [37], and exploration bonuses have been shown to
213
+ 190 produce meaningful behavior in the absence of reward [46, 10]. However, many exploration bonuses
214
+ 191 vanish over the course of training and thus may not be well-suited for a long unsupervised pre-training
215
+ 192 phase. It can be shown that many intrinsic rewards aim at maximizing the entropy of all states visited
216
+ 193 during training, and so the final policy does not necessarily exhibit exploratory behavior [39].
217
+ 194 We propose to use Never Give Up (NGU) [48] as a means for training exploratory policies in an
218
+ 195 unsupervised setting. The NGU intrinsic reward proposes a curiosity-driven approach for training
219
+ 196 persistent exploratory policies which combines per-episode and life-long novelty. The per-episode
220
+ 197 novelty, $r _ { t } ^ { \mathrm { e p i s o d i c } }$ , rapidly vanishes over the course of an episode, and it is designed to encourage self
221
+ 198 avoiding trajectories. It is computed by comparing a representation of the current observation, $f ( s _ { t } )$ ,
222
+ 199 to those of all the observations visited in the current episode, $M = \{ f ( s _ { 0 } ) , f ( s _ { 1 } ) , \dotsc , f ( s _ { t - 1 } ) \}$ ,
223
+ 200 where $f : \mathcal { S } \mathbb { R } ^ { p }$ is an embedding function trained using a self-supervised inverse dynamics
224
+ 201 model [46]. Such a mapping concentrates on the controllable aspects of the environment, ignoring
225
+ 202 all the variability present in the observation that is not affected by the action taken by the agent.
226
+ 203 The life-long novelty, $\alpha _ { t }$ , slowly vanishes throughout training, and it is computed by using Random
227
+ 204 Network Distillation (RND) [11]. With this, the intrinsic reward $r _ { t } ^ { \mathrm { { N G U } } }$ is defined as follows:
228
+
229
+ $$
230
+ r _ { t } ^ { \mathrm { N G U } } = r _ { t } ^ { \mathrm { { e p i s o d i c } } } \cdot \operatorname* { m i n } \left\{ \operatorname* { m a x } \left\{ \alpha _ { t } , 1 \right\} , L \right\} , \mathrm { ~ w i t h } r _ { t } ^ { \mathrm { e p i s o d i c } } = \frac { 1 } { \sqrt { \sum _ { f ( s _ { t } ) \in N _ { k } } K ( f ( s _ { t } ) , f ( s _ { i } ) ) + c ^ { 2 } } } .
231
+ $$
232
+
233
+ 205 where $L$ is a fixed maximum reward scaling, $N _ { k }$ is the set containing the $k$ -nearest neighbors of $f ( s _ { t } )$
234
+ 206 in $M$ , $c$ is a constant and $K : \mathbb { R } ^ { p } \times \mathbb { R } ^ { p } \to \mathbb { R } ^ { + }$ is a kernel function satisfying $K ( x , { \bar { x } } ) = 1$ (which
235
+ 207 can be thought of as approximating pseudo-counts [48]). The episodic component of the reward
236
+ 208 in Equation 1 is reset by emptying $M$ with each episode, thus the NGU reward does not vanish
237
+ 209 throughout the training process. This makes it suitable for driving learning in task-agnostic settings.
238
+ 210 Further details on NGU are reported in the supplementary material.
239
+
240
+ # 211 5 Experiments
241
+
242
+ 212 Agents are evaluated in the Atari suite [7], a benchmark that presents a variety of challenges and that
243
+ 213 is a common test ground for RL agents with unsupervised pre-training [28, 40, 52]. Experiments are
244
+ 214 run using the distributed R2D2 agent [36] with 256 CPU actors and a single GPU learner. Policies
245
+ 215 use the same Q-Network architecture as Agent57 [47], which is composed by a convolutional torso
246
+ 216 followed by an LSTM [32] and a dueling head [58]. Hyperparameters and a detailed description of
247
+ 217 the full distributed setting are provided in the supplementary material. All reported results are the
248
+ 218 average over three random seeds.
249
+ 219 Reward-free learning. The amount of task reward collected by unsupervised policies is often
250
+ 220 used as a proxy to measure their quality [19]. While the actual utility of these policies will not
251
+ 221 be revealed until they are leveraged for transfer, this proxy lets us evaluate whether the discovered
252
+ 222 behavior changes as longer pre-training budgets are allowed. We compare unsupervised NGU policies
253
+ 223 against VISR [28] and APT [40], which utilize a small amount of supervised interaction to adapt
254
+ 224 the pre-trained policies. We also consider two additional unsupervised baselines: $( i )$ a constant
255
+ 225 positive reward at each timestep that favours long episodes, which correlate with high scores in some
256
+ 226 games [10], and (ii) RND [11], which rewards life-long novelty. Note that the RND reward vanishes,
257
+ 227 but we include it in our analysis because it was previously used by Burda et al. [10] in this setting
258
+ 228 and implementation choices such as reward normalization may prevent it from fading in practice.
259
+ 229 Figure 2 (left) shows how the zero-shot transfer performance of unsupervised policies evolves during
260
+ 230 a long pre-training phase. NGU reaches the highest scores, but both NGU and RND eventually
261
+ 231 outperform VISR and APT even though these used supervised interaction. In Table 2 of Appendix
262
+ 232 C we show that unsupervised NGU policies largely outperform several other baselines using the
263
+ 233 standard pre-training and adaptation setting. These results highlight the importance of large-scale
264
+ 234 unsupervised pre-training in RL, similarly to the trend observed in supervised domains [9].
265
+
266
+ ![](images/693f32859ff6d9b0ac39d33ab71c1a54485c1fe8c8c24525070d8a48b2d7618d.jpg)
267
+ Figure 2: Performance as a function of the pre-training budget. $@ N$ represents the number of frames with reward utilized for transfer. (Left) Median human normalized score across the 57 games in the Atari suite. We observe the emergence of useful behavior when optimizing an intrinsic reward during a long unsupervised pre-training of 16B frames, which contrasts with the shorter pre-training of 1B frames in previous works [28, 40]. (Right) Scores in the games of Montezuma’s Revenge (sparse rewards) and Pong (dense reward), before and after transfer, as a function of the pre-training budget. A longer pre-training benefits transfer in hard exploration games even if the zero-shot transfer score of the unsupervised policies does not increase.
268
+
269
+ Transfer setting. Transfer approaches are typically evaluated in the Atari benchmark with a budget of 100k RL interactions with reward (400k frames), but we propose to allow a longer adaptation phase. Randomly initialized networks tend to overfit in these very low data regimes without strong regularization [38], and we are interested in studying the impact of leveraging behavior both in isolation and combined with transfer via pre-trained weights. Moreover, since the pre-trained policies are already competent in the downstream tasks, $1 0 0 \mathrm { k }$ interactions are exhausted after few episodes and may be insufficient for improving performance. For these reasons, we provide results with up to 1.25B RL steps of supervised interaction (5B frames). This allows evaluating both convergence speed and asymptotic performance, while still being a relatively small budget for these distributed agents with hundreds of actors [47].
270
+
271
+ Transfer via behavior. We start by studying the impact of leveraging behavior in isolation, i.e. without transferring pre-trained weights, when learning in downstream tasks. We compare BT against two baselines that do not use pre-trained behavior, namely the standard R2D2 agent [36] that uses $\epsilon$ -greedy policies for exploration [55], as well as a variant of R2D2 with $\epsilon z$ -greedy exploration [14]. Figure 3 shows that BT is superior to both baselines for any amount of environment interaction with rewards, converging faster early in training and also obtaining higher asymptotic performance. These results also demonstrate the generality of the proposed approach, as it is able to benefit from both RND and NGU policies. Note that BT performs particularly well in the set of six hard exploration games1 defined by Bellemare et al. [6], which is aligned with our intuition that reusing behavior helps overcoming the inefficiency associated to unstructured exploration. Figure 2 (right) confirms that a long pre-training phase is especially important in hard exploration games such as Montezuma’s Revenge, even it they do not translate into higher zero-shot transfer scores, as it produces more exploratory behavior. On the other hand, the performance after transfer is independent of the amount of pre-training in dense reward games like Pong, where unstructured exploration is enough to reach optimal scores.
272
+
273
+ ![](images/7d402b37236621f24b6311f0a942112738113dc64eef0e4d23aa624852764151.jpg)
274
+ Figure 3: Median human normalized scores for R2D2-based agents trained from scratch. (Left) Full Atari suite. (Right) Subset of hard exploration games.
275
+
276
+ ![](images/985bc0ee229912f07e0229f480c5d0bf49fcef58c9fea4c4c5d8bc5084e081c9.jpg)
277
+ Figure 4: Usage of the extra action in $\mathrm { B T } ( \pi _ { \mathrm { N G U } } )$ , computed as the fraction of steps within an episode in which it is selected by the agent. The usage peaks early in training and slowly decreases afterwards as the new policy becomes stronger at the task.
278
+
279
+ 259 Ablation studies. In order to gain insight on each of the components in BT, we run experiments
280
+ 260 on a subset of 12 games2 requiring different amounts of exploration and featuring both dense and
281
+ 261 sparse rewards. $\mathbf { B T } ( \pi _ { \mathrm { N G U } } )$ achieves a median score of 368 in this subset, which compares favorably
282
+ 262 to the 196 median score of R2D2 with $\epsilon$ -greedy exploration. Removing either the extra action or
283
+ 263 the temporally-extended exploration reduces the median score of $\mathbf { B T } ( \pi _ { \mathrm { N G U } } )$ to 224. These results
284
+ 264 suggest that the gains provided by both strategies are complementary, and both are responsible for the
285
+ 265 strong performance of BT. To provide further insight about the benefits of BT, Figure 4 reports the
286
+ 266 fraction of steps per episode in which the extra action is selected by the greedy policy. It hints at the
287
+ 267 emergence of a schedule over the usage of the pre-trained policy, which increases early in training
288
+ 268 and decays afterwards. We hypothesize that this is due to the fact that the unsupervised policies
289
+ 269 obtain large episodic returns, but their behavior is suboptimal when maximizing discounted rewards.
290
+ 270 These policies take many exploratory actions in between rewards, and so the agent eventually figures
291
+ 271 out more efficient strategies for reaching rewarding states by using primitive actions.
292
+
293
+ Transfer to multiple tasks. An appealing property of task-agnostic knowledge is that it can be leveraged to solve multiple tasks. In the RL setting, this can be evaluated by leveraging a single task-agnostic policy for solving multiple tasks (i.e. reward functions) in the same environment. We evaluate whether the unsupervised NGU policies can be useful beyond the standard Atari tasks by creating two alternative versions of Ms Pacman and Hero with different levels of difficulty. The goal in the modified version of Ms Pacman is to eat vulnerable ghosts, with pac-dots giving 0 (easy version) or $- 1 0$ (hard version) points. In the modified version of Hero, saving miners gives a fixed return of 1000 points and dynamiting walls gives either 0 (easy version) or $- 3 0 0$ (hard version) points. The rest of rewards are removed, e.g. eating fruit in Ms Pacman or the bonus for unused power units in Hero. Note that even in the easy version of the games exploration is harder than in their original counterparts, as there are no small rewards guiding the agent towards its goals. Exploration is even more challenging in the hard version of the games, as the intermediate rewards work as a deceptive signal that takes the agent away from its actual goal. In this case, finding rewarding behaviors requires a stronger commitment to an exploration strategy. Unsupervised NGU policies often achieve very low or even negative rewards in this setting, which contrasts with the strong performance they showed when evaluated under the standard game reward. Figure 5 shows that leveraging the behavior of pre-trained exploration policies provides important gains even in this adversarial scenario. These results suggest that the strong performance observed under the standard game rewards is not due to an
294
+
295
+ ![](images/b2e9bc9d03e347e12efc286b6a57b2532360ce7edf0ad56c7d736b2ec11175b8.jpg)
296
+ Figure 5: Scores in Atari games with modified reward functions. We train a single task-agnostic policy per environment, and leverage it to solve three different tasks: the standard game reward, a task with sparse rewards (easy), and a variant of the same task with deceptive rewards (hard).
297
+
298
+ 90 alignment between the NGU reward and the game goals, but due to an efficient usage of pre-trained
299
+ 1 exploration policies.
300
+ 292 Combining pre-trained behavior and weights. Our last batch of experiments focuses on studying
301
+ 293 transfer via pre-trained weights and its compatibility with BT. Policies are composed of a convo
302
+ 294 lutional torso, an LSTM, and a dueling head. We consider two initialization strategies: a partial
303
+ 295 initialization approach that loads the torso and the LSTM, but initializes the head randomly; and a
304
+ 296 full initialization scheme where all weights are loaded. The former can be understood as transferring
305
+ 297 learned representations [59], but deferring exploration to a random policy. On the other hand, the
306
+ 298 full initialization approach can be seen as directly transferring the policy and is usually referred to as
307
+ 299 fine-tuning the pre-trained policy [43, 40, 52]. Note that these approaches only change how weights
308
+ 300 are initialized before training. As in previous experiments, all parameters in the new policy are trained
309
+ 301 and $\pi _ { p }$ is kept fixed when using BT. Figure 6 (top) compares agents with and without BT for different
310
+ 302 amounts of transfer via weights on the Atari benchmark. Loading pre-trained weights results in faster
311
+ 303 learning early in training, both with and without BT. The largest gains are observed in dense reward
312
+ 304 games, which translates into higher median scores across the full suite because most games belong
313
+ 305 to this category. Weights alone are not enough in hard exploration games, where leveraging the
314
+ 306 pre-trained policy via BT provides clear benefits. Perhaps surprisingly, we observe that transferring
315
+ 307 representations outperforms fine-tuning the pre-trained policy, and we hypothesize that the former
316
+ 308 is more robust to misalignments between the pre-trained policy and the downstream task. This
317
+ 309 intuition is further supported by the experiments on games with modified reward functions reported
318
+ 310 in Figure 6 (middle & bottom), where the faster learning provided by pre-trained weights often comes
319
+ 311 at the cost of lower end scores. On the other hand, BT is crucial in tasks with sparse and deceptive
320
+ 12 rewards and also benefits from pre-trained weights in tasks where positive transfer is observed.
321
+
322
+ # 6 Related work
323
+
324
+ 314 Our work uses the experimental methodology presented by Hansen et al. [28]. Whereas that work only
325
+ 315 considered a fast, simplified adaptation process that limited the final performance on the downstream
326
+ 316 task, we focus on the more general case of using a previously trained policy to aid in solving the
327
+ 317 full RL problem. Hansen et al. [28] use successor features to identify which of the pre-trained tasks
328
+ 318 best matches the true reward structure, which has previously been shown to work well for multi-task
329
+ 319 transfer [3]. Bagot et al. [1] augments an agent with the ability to utilize another policy, which is
330
+ 320 learned in tandem based on an intrinsic reward function. This promising direction is complementary
331
+ 321 to our work, as it handles the case wherein there is no unsupervised pre-training phase.
332
+ 322 Gupta et al. [25] provides an alternative method to meta-learn a solver for reinforcement learning prob
333
+ 323 lems from unsupervised reward functions. This method utilizes gradient-based meta-learning [20],
334
+ 324 which makes the adaptation process standard reinforcement learning updates. This means that even if
335
+ 325 the downstream reward is far outside of the training distribution, final performance would not neces
336
+ 326 sarily be affected. However, these methods are hard to scale to the larger networks considered here,
337
+ 327 and followup work [34] changed to memory-based meta-learning [17] which relies on information
338
+ 328 about rewards staying in the recurrent state. This makes it unsuitable to the sort of hard exploration
339
+ 329 problem our method excels at. Recent work has shown success in transferring representations learned
340
+ 330 in an unsupervised setting to reinforcement learning tasks [54]. Our representation transfer experi
341
+ 331 ments suggest that this might handicap final performance, but the possibility also exists that different
342
+ 332 unsupervised objectives should be used for representation transfer and policy transfer.
343
+
344
+ ![](images/789522c1b91b64812aefceb54c6d2e5dabd3c5fb5585eb5b04e66c0ba732af86.jpg)
345
+ Figure 6: Performance of R2D2-based agents with different amounts of transfer via weights. Policies are composed of a CNN encoder followed by an LSTM and a dueling head. We compare training from scratch, loading all weights (Full $\pi _ { \mathrm { N G U } }$ init) or all weights except those in the dueling head (Partial $\pi _ { \mathrm { { N G U } } }$ init). (Top) Median human normalized scores (HNS) in the full Atari suite (left) and the subset of hard exploration games (right). (Middle & Bottom) Games with modified reward functions as in Figure 5.
346
+
347
+ # 7 Discussion
348
+
349
+ We studied the problem of transferring pre-trained behavior for exploration in reinforcement learning, an approach that is complementary to the common practice of transferring neural network weights. Our proposed approach, Behavior Transfer (BT), relies on the pre-trained policy for collecting experience in two different ways: (i) through temporally-extended exploration, which can be triggered with some probability at any step, and $( i i )$ via one-step calls to the pre-trained policy based on value estimates. BT results in strong transfer performance when combined with exploratory policies pretrained in the absence of reward, with the most important gains being observed in hard exploration tasks. These benefits are not due to an alignment between our pre-training and downstream tasks, as we also observed positive transfer in games where the pre-trained policy obtained low scores. In order to provide further evidence for this claim, we designed alternative tasks for Atari games involving hard exploration and deceptive rewards. Our transfer strategy outperformed all considered baselines in these settings, even when the pre-trained policy obtained very low or even negative scores, demonstrating the generality of the method. Besides disambiguating the role of the alignment between pre-training and downstream tasks, these experiments demonstrate the utility of a single task-agnostic policy for solving multiple tasks in the same environment. Finally, we also demonstrated that BT can be combined with transfer via neural network weights to provide further gains.
350
+
351
+ 350 Our experimental results highlight the importance of scale when training RL agents in reward-free
352
+ 351 settings, which is one of the key factors behind the recent success of unsupervised approaches in other
353
+ 352 domains. This contrasts with the small budgets considered for reward-free RL in previous works and
354
+ 353 motivates further research in unsupervised RL approaches that scale with increased data and compute.
355
+ 354 We argue that scale is one of the missing components in reward-free RL, and it will be a necessary
356
+ 355 condition to unfold its full potential. Beyond improving the unsupervised learning phase, we are also
357
+ 356 excited about the possibilities unlocked by BT and that are not possible when transferring knowledge
358
+ 357 through weights, such as leveraging multiple pre-trained policies and deploying BT in continual
359
+ 358 learning scenarios where the agent never stops learning and keeps accumulating knowledge and skills.
360
+ 359 Future work should also study improved mechanisms for handing over control to pre-trained policies,
361
+ 360 as well as prioritizing the usage of certain behaviors over others when multiple such policies are
362
+ 361 available to the agent. This could overcome one of the current limitations of BT, which assumes that
363
+ 362 flights can be started from any state and still produce meaningful behavior.
364
+
365
+ References [1] Louis Bagot, Kevin Mets, and Steven Latré. Learning intrinsically motivated options to stimulate policy exploration. In ICML Workshop on LifeLong Learning, 2020. [2] André Barreto, Will Dabney, Rémi Munos, Jonathan J Hunt, Tom Schaul, Hado P van Hasselt, and David Silver. Successor features for transfer in reinforcement learning. In NeurIPS, 2017. [3] Andre Barreto, Diana Borsa, John Quan, Tom Schaul, David Silver, Matteo Hessel, Daniel Mankowitz, Augustin Zidek, and Remi Munos. Transfer in deep reinforcement learning using successor features and generalised policy improvement. In ICML, 2018. [4] André Barreto, Shaobo Hou, Diana Borsa, David Silver, and Doina Precup. Fast reinforcement learning with generalized policy updates. Proceedings of the National Academy of Sciences, 2020. [5] Andrew G Barto and Sridhar Mahadevan. Recent advances in hierarchical reinforcement learning. Discrete event dynamic systems, 2003. [6] Marc Bellemare, Sriram Srinivasan, Georg Ostrovski, Tom Schaul, David Saxton, and Remi Munos. Unifying count-based exploration and intrinsic motivation. In NeurIPS, 2016. [7] Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 2013. [8] Diana Borsa, André Barreto, John Quan, Daniel Mankowitz, Rémi Munos, Hado van Hasselt, David Silver, and Tom Schaul. Universal successor features approximators. In ICLR, 2019. [9] 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. [10] Yuri Burda, Harri Edwards, Deepak Pathak, Amos Storkey, Trevor Darrell, and Alexei A Efros. Large-scale study of curiosity-driven learning. arXiv preprint arXiv:1808.04355, 2018.
366
+ 8 [11] Yuri Burda, Harrison Edwards, Amos Storkey, and Oleg Klimov. Exploration by random network distillation. arXiv preprint arXiv:1810.12894, 2018.
367
+ [12] Víctor Campos, Alexander Trott, Caiming Xiong, Richard Socher, Xavier Giro-i Nieto, and Jordi Torres. Explore, discover and learn: Unsupervised discovery of state-covering skills. In ICML, 2020. [13] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In ICML, 2020. [14] Will Dabney, Georg Ostrovski, and André Barreto. Temporally-extended -greedy exploration. In ICLR, 2021. [15] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In NAACL, 2019. [16] Jeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. Decaf: A deep convolutional activation feature for generic visual recognition. In ICML, 2014.
368
+ [17] Yan Duan, John Schulman, Xi Chen, Peter L Bartlett, Ilya Sutskever, and Pieter Abbeel. RL2: Fast reinforcement learning via slow reinforcement learning. arXiv preprint arXiv:1611.02779, 2016. [18] Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Volodymyr Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Dunning, et al. IMPALA: Scalable distributed deep-RL with importance weighted actor-learner architectures. In ICML, 2018.
369
+ [19] Benjamin Eysenbach, Abhishek Gupta, Julian Ibarz, and Sergey Levine. Diversity is all you need: Learning skills without a reward function. In ICLR, 2019.
370
+ [20] Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. arXiv preprint arXiv:1703.03400, 2017.
371
+ [21] Carlos Florensa, Yan Duan, and Pieter Abbeel. Stochastic neural networks for hierarchical reinforcement learning. In ICLR, 2017.
372
+ [22] Ross Girshick, Jeff Donahue, Trevor Darrell, and Jitendra Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In CVPR, 2014.
373
+ [23] Karol Gregor, Danilo Jimenez Rezende, and Daan Wierstra. Variational intrinsic control. arXiv preprint arXiv:1611.07507, 2016.
374
+ [24] Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre H Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv preprint arXiv:2006.07733, 2020.
375
+ [25] Abhishek Gupta, Benjamin Eysenbach, Chelsea Finn, and Sergey Levine. Unsupervised meta-learning for reinforcement learning. arXiv preprint arXiv:1806.04640, 2018.
376
+ [26] David Ha and Jürgen Schmidhuber. Recurrent world models facilitate policy evolution. In NeurIPS, 2018.
377
+ [27] Danijar Hafner, Timothy Lillicrap, Jimmy Ba, and Mohammad Norouzi. Dream to control: Learning behaviors by latent imagination. In ICLR, 2019.
378
+ [28] Steven Hansen, Will Dabney, Andre Barreto, Tom Van de Wiele, David Warde-Farley, and Volodymyr Mnih. Fast task inference with variational intrinsic successor features. In ICLR, 2020.
379
+ [29] Elad Hazan, Sham M Kakade, Karan Singh, and Abby Van Soest. Provably efficient maximum entropy exploration. In ICML, 2019.
380
+ [30] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. arXiv preprint arXiv:1911.05722, 2019.
381
+ [31] Olivier J Hénaff, Ali Razavi, Carl Doersch, SM Eslami, and Aaron van den Oord. Data-efficient image recognition with contrastive predictive coding. arXiv preprint arXiv:1905.09272, 2019.
382
+ [32] Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 1997.
383
+ [33] Dan Horgan, John Quan, David Budden, Gabriel Barth-Maron, Matteo Hessel, Hado Van Hasselt, and David Silver. Distributed prioritized experience replay. arXiv preprint arXiv:1803.00933, 2018.
384
+ [34] Allan Jabri, Kyle Hsu, Abhishek Gupta, Ben Eysenbach, Sergey Levine, and Chelsea Finn. Unsupervised curricula for visual meta-reinforcement learning. In Advances in Neural Information Processing Systems, pages 10519–10531, 2019.
385
+ [35] 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.
386
+ [36] Steven Kapturowski, Georg Ostrovski, John Quan, Remi Munos, and Will Dabney. Recurrent experience replay in distributed reinforcement learning. In ICLR, 2019.
387
+ [37] Michael Kearns and Satinder Singh. Near-optimal reinforcement learning in polynomial time. Machine learning, 2002.
388
+ [38] Ilya Kostrikov, Denis Yarats, and Rob Fergus. Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. In ICLR, 2021.
389
+ [39] Lisa Lee, Benjamin Eysenbach, Emilio Parisotto, Eric Xing, Sergey Levine, and Ruslan Salakhutdinov. Efficient exploration via state marginal matching. arXiv preprint arXiv:1906.05274, 2019.
390
+ [40] Hao Liu and Pieter Abbeel. Behavior from the void: Unsupervised active pre-training. arXiv preprint arXiv:2103.04551, 2021.
391
+ [41] Yao Liu and Emma Brunskill. When simple exploration is sample efficient: Identifying sufficient conditions for random exploration to yield pac rl algorithms. arXiv preprint arXiv:1805.09045, 2018.
392
+ [42] Shakir Mohamed and Danilo Jimenez Rezende. Variational information maximisation for intrinsically motivated reinforcement learning. In NeurIPS, 2015.
393
+ [43] Mirco Mutti, Lorenzo Pratissoli, and Marcello Restelli. Task-agnostic exploration via policy gradient of a non-parametric state entropy estimate. In AAAI, 2021.
394
+ [44] Ian Osband, Charles Blundell, Alexander Pritzel, and Benjamin Van Roy. Deep exploration via bootstrapped dqn. arXiv preprint arXiv:1602.04621, 2016.
395
+ [45] Ian Osband, Benjamin Van Roy, and Zheng Wen. Generalization and exploration via randomized value functions. In ICML, 2016.
396
+ [46] Deepak Pathak, Pulkit Agrawal, Alexei A Efros, and Trevor Darrell. Curiosity-driven exploration by self-supervised prediction. In ICML, 2017.
397
+ [47] Adrià Puigdomènech Badia, Bilal Piot, Steven Kapturowski, Pablo Sprechmann, Alex Vitvitskyi, Daniel Guo, and Charles Blundell. Agent57: Outperforming the atari human benchmark. In ICML, 2020.
398
+ [48] Adrià Puigdomènech Badia, Pablo Sprechmann, Alex Vitvitskyi, Daniel Guo, Bilal Piot, Steven Kapturowski, Olivier Tieleman, Martín Arjovsky, Alexander Pritzel, Andew Bolt, et al. Never give up: Learning directed exploration strategies. In ICLR, 2020.
399
+ [49] Martin L Puterman. Markov Decision Processes: Discrete Stochastic Dynamic Programming. John Wiley & Sons, Inc., 1994.
400
+ [50] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI Blog, 2019.
401
+ [51] Christoph Salge, Cornelius Glackin, and Daniel Polani. Empowerment – an introduction. In Guided Self-Organization: Inception. Springer, 2014.
402
+ [52] Max Schwarzer, Nitarshan Rajkumar, Michael Noukhovitch, Ankesh Anand, Laurent Charlin, R Devon Hjelm, Philip Bachman, and Aaron Courville. Pretraining reward-free representations for data-efficient reinforcement learning. In Self-Supervision for Reinforcement Learning Workshop - ICLR 2021, 2021. URL https://openreview.net/forum?id $\underset { . } { = }$ o5z9Le5drua.
403
+ [53] Ramanan Sekar, Oleh Rybkin, Kostas Daniilidis, Pieter Abbeel, Danijar Hafner, and Deepak Pathak. Planning to explore via self-supervised world models. In ICML, 2020.
404
+ [54] Adam Stooke, Kimin Lee, Pieter Abbeel, and Michael Laskin. Decoupling representation learning from reinforcement learning. arXiv preprint arXiv:2009.08319, 2020.
405
+ [55] Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018.
406
+ [56] Richard S Sutton, Doina Precup, and Satinder Singh. Between mdps and semi-mdps: A framework for temporal abstraction in reinforcement learning. Artificial intelligence, 1999.
407
+ [57] Gandhimohan M Viswanathan, V Afanasyev, SV Buldyrev, EJ Murphy, PA Prince, and H Eugene Stanley. Lévy flight search patterns of wandering albatrosses. Nature, 1996.
408
+ [58] Ziyu Wang, Tom Schaul, Matteo Hessel, Hado Hasselt, Marc Lanctot, and Nando Freitas. Dueling network architectures for deep reinforcement learning. In ICML, 2016.
409
+ [59] Denis Yarats, Rob Fergus, Alessandro Lazaric, and Lerrel Pinto. Reinforcement learning with prototypical representations. In ICML, 2021.
410
+ [60] Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson. How transferable are features in deep neural networks? arXiv preprint arXiv:1411.1792, 2014.
411
+ [61] Matthew D Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In ECCV, 2014.
412
+
413
+ # Checklist
414
+
415
+ The checklist follows the references. Please read the checklist guidelines carefully for information on how to answer these questions. For each question, change the default [TODO] to [Yes] , [No] , or [N/A] . You are strongly encouraged to include a justification to your answer, either by referencing the appropriate section of your paper or providing a brief inline description. For example:
416
+
417
+ • Did you include the license to the code and datasets? [No] The code and the data are proprietary.
418
+
419
+ Please do not modify the questions and only use the provided macros for your answers. Note that the Checklist section does not count towards the page limit. In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below.
420
+
421
+ 1. For all authors...
422
+
423
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
424
+ (b) Did you describe the limitations of your work? [Yes]
425
+ (c) Did you discuss any potential negative societal impacts of your work? [N/A]
426
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
427
+
428
+ 2. If you are including theoretical results...
429
+
430
+ (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]
431
+
432
+ 3. If you ran experiments...
433
+
434
+ (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)? [No] We did not include source code because it relies on non-public libraries that are specific to our distributed hardware setting. However, we include all the details needed to replicate our experiments.
435
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
436
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] All our experiments were run with three different random seeds. Plots report mean, min and max results. Tables report mean and standard deviation.
437
+ (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]
438
+
439
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
440
+
441
+ (a) If your work uses existing assets, did you cite the creators? [N/A]
442
+ (b) Did you mention the license of the assets? [N/A]
443
+ (c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
444
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
445
+
446
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
447
+
448
+ 5. If you used crowdsourcing or conducted research with human subjects...
449
+
450
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
451
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
452
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/pAbm1qfheGk/pAbm1qfheGk.md ADDED
@@ -0,0 +1,416 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING NEURAL GENERATIVE DYNAMICS FOR MOLECULAR CONFORMATION GENERATION
2
+
3
+ Minkai $\mathbf { X } \mathbf { u } ^ { * 1 , 2 }$ , Shitong Luo\*3, Yoshua Bengio1,2,4, Jian Peng5, Jian Tang1,4,6
4
+
5
+ 1Mila - Quebec AI Institute, Canada ´
6
+ 2Universite de Montr ´ eal, Canada ´
7
+ 3Peking University, China
8
+ 4Canadian Institute for Advanced Research (CIFAR), Canada
9
+ 5University of Illinois at Urbana-Champaign, USA
10
+ 6HEC Montreal, Canada ´
11
+ {xuminkai,yoshua.bengio}@mila.quebec
12
+ luost@pku.edu.cn
13
+ jianpeng@illinois.edu
14
+ jian.tang@hec.ca
15
+
16
+ # ABSTRACT
17
+
18
+ We study how to generate molecule conformations (i.e., 3D structures) from a molecular graph. Traditional methods, such as molecular dynamics, sample conformations via computationally expensive simulations. Recently, machine learning methods have shown great potential by training on a large collection of conformation data. Challenges arise from the limited model capacity for capturing complex distributions of conformations and the difficulty in modeling long-range dependencies between atoms. Inspired by the recent progress in deep generative models, in this paper, we propose a novel probabilistic framework to generate valid and diverse conformations given a molecular graph. We propose a method combining the advantages of both flow-based and energy-based models, enjoying: (1) a high model capacity to estimate the multimodal conformation distribution; (2) explicitly capturing the complex long-range dependencies between atoms in the observation space. Extensive experiments demonstrate the superior performance of the proposed method on several benchmarks, including conformation generation and distance modeling tasks, with a significant improvement over existing generative models for molecular conformation sampling1.
19
+
20
+ # 1 INTRODUCTION
21
+
22
+ Recently, we have witnessed the success of graph-based representations for molecular modeling in a variety of tasks such as property prediction (Gilmer et al., 2017) and molecule generation (You et al., 2018; Shi et al., 2020). However, a more natural and intrinsic representation of a molecule is its 3D structure, commonly known as the molecular geometry or conformation, which represents each atom by its 3D coordinate. The conformation of a molecule determines its biological and physical properties such as charge distribution, steric constraints, as well as interactions with other molecules. Furthermore, large molecules tend to comprise a number of rotatable bonds, which may induce flexible conformation changes and a large number of feasible conformations in nature. Generating valid and stable conformations of a given molecule remains very challenging. Experimentally, such structures are determined by expensive and time-consuming crystallography. Computational approaches based on Markov chain Monte Carlo (MCMC) or molecular dynamics (MD) (De Vivo et al., 2016) are computationally expensive, especially for large molecules (Ballard et al., 2015).
23
+
24
+ Machine learning methods have recently shown great potential for molecular conformation generation by training on a large collection of data to model the probability distribution of potential conformations $\pmb { R }$ based on the molecular graph $\mathcal { G }$ , i.e., $p ( R | \mathcal { G } )$ . For example, Mansimov et al.
25
+
26
+ (2019) proposed a Conditional Variational Graph Autoencoders (CVGAE) for molecular conformation generation. A graph neural network (Gilmer et al., 2017) is first applied to the molecular graph to get the atom representations, based on which 3D coordinates are further generated. One limitation of such an approach is that by directly generating the 3D coordinates of atoms it fails to model the rotational and translational invariance of molecular conformations. To address this issue, instead of generating the 3D coordinates directly, Simm & Hernandez-Lobato (2020) recently proposed to ´ first model the molecule’s distance geometry (i.e., the distances between atoms)—which are rotationally and translationally invariant—and then generate the molecular conformation based on the distance geometry through a post-processing algorithm (Liberti et al., 2014). Similar to Mansimov et al. (2019), a few layers of graph neural networks are applied to the molecular graph to learn the representations of different edges, which are further used to generate the distances of different edges independently. This approach is capable of more often generating valid molecular conformations.
27
+
28
+ Although these new approaches have made tremendous progress, the problem remains very challenging and far from solved. First, each molecule may have multiple stable conformations around a number of states which are thermodynamically stable. In other words, the distribution $p ( R | \mathcal { G } )$ is very complex and multi-modal. Models with high capacity are required to model such complex distributions. Second, existing approaches usually apply a few layers of graph neural networks to learn the representations of nodes (or edges) and then generate the 3D coordinates (or distances) based on their representations independently. Such approaches are necessarily limited to capturing a single mode of $p ( R | \mathcal { G } )$ (since the coordinates or distances are sampled independently) and are incapable of modeling multimodal joint distributions and the form of the graph neural net computation makes it difficult to capture long-range dependencies between atoms, especially in large molecules.
29
+
30
+ Inspired by the recent progress with deep generative models, this paper proposes a novel and principled probabilistic framework for molecular geometry generation, which addresses the above two limitations. Our framework combines the advantages of normalizing flows (Dinh et al., 2014) and energy-based approaches (LeCun et al., 2006), which have a strong model capacity for modeling complex distributions, are flexible to model long-range dependency between atoms, and enjoy efficient sampling and training procedures. Similar to the work of Simm & Hernandez-Lobato (2020), ´ we also first learn the distribution of distances $^ d$ given the graph $\mathcal { G }$ , i.e., $p ( d | \mathcal { G } )$ , and define another distribution of conformations $\pmb { R }$ given the distances $^ d$ , i.e., $p ( R | d , \mathcal { G } )$ . Specifically, we propose a novel Conditional Graph Continuous Flow (CGCF) for distance geometry $( d )$ generation conditioned on the molecular graph $\mathcal { G }$ . Given a molecular graph $\mathcal { G }$ , CGCF defines an invertible mapping between a base distribution (e.g., a multivariate normal distribution) and the molecular distance geometry, using a virtually infinite number of graph transformation layers on atoms represented by a Neural Ordinary Differential Equations architecture (Chen et al., 2018). Such an approach enjoys very high flexibility to model complex distributions of distance geometry. Once the molecular distance geometry $^ d$ is generated, we further generate the 3D coordinates $\pmb { R }$ by searching from the probability $p ( R | d , \mathcal { G } )$ .
31
+
32
+ Though the CGCF has a high capacity for modeling complex distributions, the distances of different edges are still independently updated in the transformations, which limits its capacity for modeling long-range dependency between atoms in the sampling process. Therefore, we further propose another unnormalized probability function, i.e., an energy-based model (EBM) (Hinton & Salakhutdinov, 2006; LeCun et al., 2006; Ngiam et al., 2011), which acts as a tilting term of the flow-based distribution and directly models the joint distribution of $\pmb { R }$ . Specifically, the EBM trains an energy function $E ( R , { \mathcal { G } } )$ , which is approximated by a neural network. The flow- and energy-based models are combined in a novel way for joint training and mutual enhancement. First, energy-based methods are usually difficult to train due to the slow sampling process. In addition, the distribution of conformations is usually highly multi-modal, and the sampling procedures based on Gibbs sampling or Langevin Dynamics (Bengio et al., 2013a;b) tend to get trapped around modes, making it difficult to mix between different modes (Bengio et al., 2013a). Here we use the flow-based model as a proposal distribution for the energy model, which is capable to generate diverse samples for training energy models. Second, the flow-based model lacks the capacity to explicitly model the long-range dependencies between atoms, which we find can however be effectively modeled by an energy function $E ( R , { \mathcal { G } } )$ . Our sampling process can be therefore viewed as a two-stage dynamic system, where we first take the flow-based model to quickly synthesize realistic conformations and then used the learned energy $E ( R , { \mathcal { G } } )$ to refine the generated conformations through Langevin Dynamics.
33
+
34
+ We conduct comprehensive experiments on several recently proposed benchmarks, including GEOM-QM9, GEOM-Drugs (Axelrod & Gomez-Bombarelli, 2020) and ISO17 (Simm & Hernandez-Lobato, 2020). Numerical evaluations show that our proposed framework consistently ´ outperforms the previous state-of-the-art (GraphDG) on both conformation generation and distance modeling tasks, with a clear margin.
35
+
36
+ # 2 PROBLEM DEFINITION AND PRELIMINARIES
37
+
38
+ # 2.1 PROBLEM DEFINITION
39
+
40
+ Notations. Following existing work (Simm & Hernandez-Lobato, 2020), each molecule is repre- ´ sented as an undirected graph $\mathcal { G } = \langle \nu , \mathcal { E } \rangle$ , where $\nu$ is the set of nodes representing atoms and $\mathcal { E }$ is the set of edges representing inter-atomic bonds. Each node $v$ in $\nu$ is labeled with atomic properties such as element type. The edge in $\mathcal { E }$ connecting $u$ and $v$ is denoted as $e _ { u v }$ , and is labeled with its bond type. We also follow the previous work (Simm & Hernandez-Lobato, 2020) to expand the molecular ´ graph with auxiliary bonds, which is elaborated in Appendix B. For the molecular 3D representation, each atom in $\nu$ is assigned with a 3D position vector $\pmb { r } \in \mathbb { R } ^ { 3 }$ . We denote $d _ { u v } = \| \pmb { r } _ { u } - \pmb { r } _ { v } \| _ { 2 }$ as the Euclidean distance between the $u ^ { t h }$ and $v ^ { t h }$ atom. Therefore, we can represent all the positions $\{ r _ { v } \} _ { v \in \mathcal { V } }$ as a matrix $\pmb { R } \in \mathbb { R } ^ { | \mathcal { V } | \times 3 }$ and all the distances between connected nodes $\{ d _ { u v } \} _ { e _ { u v } \in \mathcal { E } }$ as a vector $\mathbf { \boldsymbol { d } } \in \mathbb { R } ^ { | \mathcal { E } | }$ .
41
+
42
+ Problem Definition. The problem of molecular conformation generation is defined as a conditional generation process. More specifically, our goal is to model the conditional distribution of atomic positions $\pmb { R }$ given the molecular graph $\mathcal { G }$ , i.e., $p ( R | \mathcal { G } )$ .
43
+
44
+ # 2.2 PRELIMINARIES
45
+
46
+ Continuous Normalizing Flow. A normalizing flow (Dinh et al., 2014; Rezende & Mohamed, 2015) defines a series of invertible deterministic transformations from an initial known distribution $p ( z )$ to a more complicated one $p ( x )$ . Recently, normalizing flows have been generalized from discrete number of layers to continuous (Chen et al., 2018; Grathwohl et al., 2018) by defining the transformation $f _ { \theta }$ as a continuous-time dynamic $\begin{array} { r } { \frac { \partial z ( t ) } { \partial t } = f _ { \theta } ( z ( t ) , t ) } \end{array}$ . Formally, with the latent variable $z ( t _ { 0 } ) \sim p ( z )$ at the start time, the continuous normalizing flow (CNF) defines the transformation $\begin{array} { r } { x = z ( t _ { 0 } ) + \int _ { t _ { 0 } } ^ { t _ { 1 } } f _ { \theta } ( z ( t ) , t ) d t } \end{array}$ . Then the exact density for $p _ { \theta } ( x )$ can be computed by:
47
+
48
+ $$
49
+ \log p _ { \theta } ( x ) = \log p ( z ( t _ { 0 } ) ) - \int _ { t _ { 0 } } ^ { t _ { 1 } } \operatorname { T r } \left( { \frac { \partial f _ { \theta } } { \partial z ( t ) } } \right) d t
50
+ $$
51
+
52
+ where $z ( t _ { 0 } )$ can be obtained by inverting the continuous dynamic $\begin{array} { r } { z ( t _ { 0 } ) = x + \int _ { t _ { 1 } } ^ { t _ { 0 } } f _ { \theta } ( z ( t ) , t ) d t } \end{array}$ . A black-box ordinary differential equation (ODE) solver can be applied to estimate the outputs and inputs gradients and optimize the CNF model (Chen et al., 2018; Grathwohl et al., 2018).
53
+
54
+ Energy-based Models. Energy-based models (EBMs) (Dayan et al., 1995; Hinton & Salakhutdinov, 2006; LeCun et al., 2006) use a scalar parametric energy function $E _ { \phi } ( x )$ to fit the data distribution. Formally, the energy function induces a density function with the Boltzmann distribution $p _ { \phi } ( x ) = \exp ( - E _ { \phi } ( x ) ) / Z ( \phi )$ , where $\begin{array} { r } { Z = \int \exp ( - E _ { \phi } ( x ) ) \mathop { d x } } \end{array}$ denotes the partition function. EBM can be learned with Noise contrastive estimation (NCE) (Gutmann & Hyvarinen, 2010) by treating ¨ the normalizing constant as a free parameter. Given the training examples from both the dataset and a noise distribution $q ( x )$ , $\phi$ can be estimated by maximizing the following objective function:
55
+
56
+ $$
57
+ J ( \phi ) = \mathbb { E } _ { p _ { \mathrm { d a t a } } } \big [ \log \frac { p _ { \phi } ( x ) } { p _ { \phi } ( x ) + q ( x ) } \big ] + \mathbb { E } _ { q } \big [ \log \frac { q ( x ) } { p _ { \phi } ( x ) + q ( x ) } \big ] ,
58
+ $$
59
+
60
+ which turns the estimation of EBM into a discriminative learning problem. Sampling from $E _ { \phi }$ can be done with a variety of methods such as Markov chain Monte Carlo (MCMC) or Gibbs sampling (Hinton $\&$ Salakhutdinov, 2006), possibly accelerated using Langevin dynamics (Du & Mordatch, 2019; Song et al., 2020), which leverages the gradient of the EBM to conduct sampling:
61
+
62
+ $$
63
+ x _ { k } = x _ { k - 1 } - \frac { \epsilon } { 2 } \nabla _ { x } E _ { \phi } \left( x _ { k - 1 } \right) + \sqrt { \epsilon } \omega , \omega \sim \mathcal { N } ( 0 , \mathcal { T } ) ,
64
+ $$
65
+
66
+ where $\epsilon$ refers to the step size. $x _ { 0 }$ are the samples drawn from a random initial distribution and we take the $x _ { K }$ with $K$ Langevin dynamics steps as the generated samples of the stationary distribution.
67
+
68
+ ![](images/cd374a98085e1dbec6b2d5b0951318d7bc4cc96141aadb2b4a7cc9e2ddf2e346.jpg)
69
+ Figure 1: Illustration of the proposed framework. Given the molecular graph, we 1) first draw latent variables from a Gaussian prior, and transform them to the desired distance matrix through the Conditional Graph Continuous Flow (CGCF); 2) search the possible 3D coordinates according to the generated distances and 3) further optimize the generated conformation via a MCMC procedure with the Energy-based Tilting Model (ETM).
70
+
71
+ # 3 METHOD
72
+
73
+ # 3.1 OVERVIEW
74
+
75
+ We first present a high-level description of our model. Directly learning a generative model on Cartesian coordinates heavily depends on the (arbitrary) rotation and translation (Mansimov et al., 2019). Therefore, in this paper we take the atomic pairwise distances as intermediate variables to generate conformations, which are invariant to rotation and translation. More precisely, the cornerstone of our method is to factorize the conditional distribution $p _ { \theta } ( { \pmb R } | { \mathcal G } )$ into the following formulation:
76
+
77
+ $$
78
+ p _ { \theta } ( \pmb { R } | \mathcal { G } ) = \int p ( \pmb { R } | \pmb { d } , \mathcal { G } ) \cdot p _ { \theta } ( \pmb { d } | \mathcal { G } ) \mathrm { d } \pmb { d } ,
79
+ $$
80
+
81
+ where $p _ { \theta } ( d | \mathcal { G } )$ models the distribution of inter-atomic distances given the graph $\mathcal { G }$ and $p ( R | d , \mathcal { G } )$ models the distribution of conformations given the distances $^ d$ . In particular, the conditional generative model $p _ { \theta } ( d | \mathcal { G } )$ is parameterized as a conditional graph continuous flow, which can be seen as a continuous dynamics system to transform the random initial noise to meaningful distances. This flow model enables us to capture the long-range dependencies between atoms in the hidden space during the dynamic steps.
82
+
83
+ Though CGCF can capture the dependency between atoms in the hidden space, the distances of different edges are still independently updated in the transformations, which limits the capacity of modeling the dependency between atoms in the sampling process. Therefore we further propose to correct $p _ { \theta } ( { \pmb R } | { \mathcal G } )$ with an energy-based tilting term $\bar { E _ { \phi } } ( \bar { R , { \mathcal G } } )$ :
84
+
85
+ $$
86
+ p _ { \theta , \phi } ( R | \mathcal { G } ) \propto p _ { \theta } ( R | \mathcal { G } ) \cdot \exp ( - E _ { \phi } ( R , \mathcal { G } ) ) .
87
+ $$
88
+
89
+ The tilting term is directly defined on the joint distribution of $\pmb { R }$ and $\mathcal { G }$ , which explicitly captures the long-range interaction directly in observation space. The tilted distribution $p _ { \theta , \phi } ( R | \mathcal { G } )$ can be used to provide refinement or optimization for the conformations generated from $p _ { \theta } ( { \pmb R } | { \mathcal G } )$ . This energy function is also designed to be invariant to rotation and translation.
90
+
91
+ In the following parts, we will firstly describe our flow-based generative model $p _ { \theta } ( { \pmb R } | { \mathcal G } )$ in Section 3.2 and elaborate the energy-based tilting model $E _ { \phi } ( R , { \mathcal { G } } )$ in Section 3.3. Then we introduce the two-stage sampling process with both deterministic and stochastic dynamics in Section 3.4. An illustration of the whole framework is given in Fig. 1.
92
+
93
+ # 3.2 FLOW-BASED GENERATIVE MODEL
94
+
95
+ Conditional Graph Continuous Flows $p _ { \theta } ( d | \mathcal { G } )$ . We parameterize the conditional distribution of distances $p _ { \theta } ( d | \mathcal { G } )$ with the continuous normalizing flow, named Conditional Graph Continuous Flow (CGCF). CGCF defines the distribution through the following dynamics system:
96
+
97
+ $$
98
+ d = F _ { \theta } ( { d ( t _ { 0 } ) } , \mathcal { G } ) = d ( t _ { 0 } ) + \int _ { t _ { 0 } } ^ { t _ { 1 } } f _ { \theta } ( d ( t ) , t ; \mathcal { G } ) \mathrm { d } t , \quad d ( t _ { 0 } ) \sim \mathcal { N } ( \mathbf { 0 } , I )
99
+ $$
100
+
101
+ where the dynamic $f _ { \theta }$ is implemented by Message Passing Neural Networks (MPNN) (Gilmer et al., 2017), which is a widely used architecture for representation learning on molecular graphs. MPNN takes node attributes, edge attributes and the bonds lengths $\mathbf { } d ( t )$ as input to compute the node and edge embeddings. Each message passing layer updates the node embeddings by aggregating the information from neighboring nodes according to its hidden vectors of respective nodes and edges. Final features are fed into a neural network to compute the value of the dynamic $f _ { \theta }$ for all distances independently. As $t _ { 1 } \to \infty$ , our dynamic can have an infinite number of steps and is capable to model long-range dependencies. The invertibility of $F _ { \theta }$ allows us to not only conduct fast sampling, but also easily optimize the parameter set $\theta$ by minimizing the exact negative log-likelihood:
102
+
103
+ $$
104
+ \mathcal { L } _ { \mathrm { m l e } } ( d , \mathcal { G } ; \theta ) = - \mathbb { E } _ { p _ { \mathrm { d a t a } } } \log p _ { \theta } ( d | \mathcal { G } ) = - \mathbb { E } _ { p _ { \mathrm { d a t a } } } \left[ \log p ( d ( t _ { 0 } ) ) + \int _ { t _ { 0 } } ^ { t _ { 1 } } \mathrm { T r } \left( \frac { \partial f _ { \theta , G } } { \partial d ( t ) } \right) d t \right] .
105
+ $$
106
+
107
+ Closed-form $p ( R | d , \mathcal { G } )$ . The generated pair-wise distances can be converted into 3D structures through postprocessing methods such as the classic Euclidean Distance Geometry (EDG) algorithm. In this paper, we adopt an alternative way by defining the conformations as a conditional distribution:
108
+
109
+ $$
110
+ p ( \pmb { R } | \pmb { d } , \mathcal { G } ) = \frac { 1 } { Z } \exp \Big \{ - \sum _ { e _ { u v } \in \mathcal { E } } \alpha _ { u v } \big ( \| \pmb { r } _ { u } - \pmb { r } _ { v } \| _ { 2 } - d _ { u v } \big ) ^ { 2 } \Big \} ,
111
+ $$
112
+
113
+ where $Z$ is the partition function to normalize the probability and $\{ \alpha _ { u v } \}$ are parameters that control the variance of desired Cartesian coordinates, which can be either learned or manually designed according to the graph structure $\mathcal { G }$ . With the probabilistic formulation, we can conduct either sampling via MCMC or searching the local optimum with optimization methods. This simple function is fast to calculate, making the generation procedure very efficient with a negligible computational cost.
114
+
115
+ Compared with the conventional EDG algorithm adopted in GraphDG (Simm & Hernandez-Lobato, ´ 2020), our probabilistic solution enjoys following advantages: 1) $p ( R | d , \mathcal { G } )$ enables the calculation for the likelihood $p _ { \theta } ( { \pmb R } | { \mathcal G } )$ of Eq. 4 by approximation methods, and thus can be further combined with the energy-based tilting term $E _ { \phi } ( R , { \mathcal { G } } )$ to induce a superior distribution; 2) GraphDG suffers the drawback that when invalid sets of distances are generated, EDG will fail to construct 3D structure. By contrast, our method can always be successful to generate conformations by sampling from the distribution $p ( R | d , \mathcal { G } )$ .
116
+
117
+ # 3.3 ENERGY-BASED TILTING MODEL
118
+
119
+ The last part of our framework is the Energy-based Tiling Model (ETM) $E _ { \phi } ( R , { \mathcal { G } } )$ , which helps model the long-range interactions between atoms explicitly in the observation space. $E _ { \phi } ( R , \bar { \mathcal { G } } )$ takes the form of SchNet (Schutt et al., 2017), which is widely used to model the potential-energy ¨ surfaces and energy-conserving force fields for molecules. The continuous-filter convolutional layers in SchNet allow each atom to aggregate the representations of all single, pairwise, and higherorder interactions between the atoms through non-linear functions. The final atomic representations are pooled to a single vector and then passed into a network to produce the scalar output.
120
+
121
+ Typically the EBMs can be learned by maximum likelihood, which usually requires the lengthy MCMC procedure and is time-consuming for training. In this work, we learn the ETM by Noise Contrastive Estimation (Gutmann & Hyvarinen, 2010), which is much more efficient. In practice, ¨ the noise distribution is required to be close to data distribution, otherwise the classification problem would be too easy and would not guide $E _ { \phi }$ to learn much about the modality of the data. We propose to take the pre-trained CGCF to serve as a strong noise distribution, leading to the following discriminative learning objective for the $\mathrm { E T M } ^ { 2 }$ :
122
+
123
+ $$
124
+ \mathcal { L } _ { \mathrm { n e e } } ( R , \mathcal { G } ; \phi ) = - \mathbb { E } _ { p _ { \mathrm { d a t a } } } \big [ \log \frac { 1 } { 1 + \exp ( E _ { \phi } ( R , \mathcal { G } ) ) } \big ] - \mathbb { E } _ { p _ { \theta } } \big [ \log \frac { 1 } { 1 + \exp ( - E _ { \phi } ( R , \mathcal { G } ) ) } \big ] .
125
+ $$
126
+
127
+ # 3.4 SAMPLING
128
+
129
+ We employ a two-stage dynamic system to synthesize a possible conformation given the molecular graph representation $\mathcal { G }$ . In the first stage, we first draw a latent variable $\hat { z }$ from the Gaussian prior $\mathcal { N } ( 0 , I )$ , and then pass it through the continuous deterministic dynamics model $F _ { \theta }$ defined in Eq. 6 to get $\hat { d } _ { 0 } = F _ { \theta } ( \hat { z } _ { 0 } , G )$ . Then an optimization procedure such as stochastic gradient descent is employed to search the realistic conformations $\pmb { R }$ with local maximum probability of $p ( R | d , \mathcal { G } )$ (defined in Eq. 8). By doing this, an initial conformation $\pmb { R } ^ { ( 0 ) }$ can be generated. In the second stage, we further refine the initial conformation $\pmb { R } ^ { ( 0 ) }$ with the energy-based model defined in Eq. 5 with $K$ steps of Langevin dynamics:
130
+
131
+ $$
132
+ \begin{array} { r l } & { R _ { k } = R _ { k - 1 } - \frac { \epsilon } { 2 } \nabla _ { R } E _ { \theta , \phi } \left( R | \mathcal { G } \right) + \sqrt { \epsilon } \omega , \omega \sim \mathcal { N } ( 0 , \mathcal { Z } ) , } \\ & { \mathrm { w h e r e ~ } E _ { \theta , \phi } ( R | \mathcal { G } ) = - \log p _ { \theta , \phi } ( R | \mathcal { G } ) = E _ { \phi } ( R , \mathcal { G } ) - \log \displaystyle \int p ( R | d , \mathcal { G } ) p _ { \theta } ( d | \mathcal { G } ) \mathrm { d } d A . } \end{array}
133
+ $$
134
+
135
+ where $\epsilon$ denotes the step size. The second integration term in $E _ { \theta , \phi }$ can be estimated through approximate methods. In practice, we use Monte Carlo Integration to conduct the approximation, which is simple yet effective with just a few distance samples from the CGCF model $p _ { \theta } ( d | \mathcal { G } )$ .
136
+
137
+ # 4 EXPERIMENTS
138
+
139
+ # 4.1 EXPERIMENT SETUP
140
+
141
+ Evaluation Tasks. To evaluate the performance of proposed model, we conduct experiments by comparing with the counterparts on: (1) Conformation Generation evaluates the model’s capacity to learn the distribution of conformations by measuring the diversity and accuracy of generated samples (section 4.2); (2) Distribution over distances is first proposed in Simm & Hernandez-Lobato ´ (2020), which concentrate on the distance geometry of generated conformations (section 4.2).
142
+
143
+ Benchmarks. We use the recent proposed GEOM-QM9 and GEOM-Drugs (Axelrod & GomezBombarelli, 2020) datasets for conformation generation task and ISO17 dataset (Simm & Hernandez-Lobato, 2020) for distances modeling task. The choice of different datasets is because ´ of their distinct properties. Specifically, GEOM datasets consist of stable conformations, which is suitable to evaluate the conformation generation task. By contrast, ISO17 contains snapshots of molecular dynamics simulations, where the structures are not equilibrium conformations but can reflect the density around the equilibrium state. Therefore, it is more suitable for the assessment of similarity between the model distribution and the data distribution around equilibrium states.
144
+
145
+ More specifically, GEOM-QM9 is an extension to the QM9 (Ramakrishnan et al., 2014) dataset: it contains multiple conformations for most molecules while the original QM9 only contains one. This dataset is limited to 9 heavy atoms (29 total atoms), with small molecular mass and few rotatable bonds. We randomly draw 50000 conformation-molecule pairs from GEOM-QM9 to be the training set, and take another 17813 conformations covering 150 molecular graphs as the test set. GEOM-Drugs dataset consists of much larger drug molecules, up to a maximum of 181 atoms (91 heavy atoms). It also contains multiple conformations for each molecule, with a larger variance in structures, e.g., there are the 6.5 rotatable bonds in average. We randomly take 50000 conformationmolecule pairs from GEOM-Drugs as the training set, and another 9161 conformations (covering 100 molecular graphs) as the test split. ISO17 dataset is also built upon QM9 datasets, which consists of 197 molecules, each with 5000 conformations. Following Simm & Hernandez-Lobato ´ (2020), we also split ISO17 into the training set with 167 molecules and the test set with another 30 molecules.
146
+
147
+ Baselines. We compared our proposed method with the following state-of-the-art conformation generation methods. CVGAE (Mansimov et al., 2019) uses a conditional version of VAE to directly generate the 3D coordinates of atoms given the molecular graph. GraphDG ( $\sin \alpha$ Hernandez- ´ Lobato, 2020) also employs the conditional VAE framework. Instead of directly modeling the 3D structure, they propose to learn the distribution over distances. Then the distances are converted into conformations with an EDG algorithm. Furthermore, we also take RDKit (Riniker & Landrum, 2015) as a baseline model, which is a classical EDG approach built upon extensive calculation collections in computational chemistry.
148
+
149
+ Table 1: Comparison of different methods on the COV and MAT scores. Top 4 rows: deep generative models for molecular conformation generation. Bottom 5 rows: different methods that involve an additional rule-based force field to further optimize the generated structures.
150
+
151
+ <table><tr><td rowspan="3">Dataset Metric</td><td colspan="4">GEOM-QM9</td><td colspan="4">GEOM-Drugs</td></tr><tr><td colspan="2">COV* (%)</td><td colspan="2">MAT (A)</td><td colspan="2">COV* (%)</td><td colspan="2">MAT (A)</td></tr><tr><td>Mean</td><td>Median</td><td>Mean</td><td>Median</td><td>Mean</td><td>Median</td><td>Mean</td><td>Median</td></tr><tr><td>CVGAE</td><td>8.52</td><td>5.62</td><td>0.7810</td><td>0.7811</td><td>0.00</td><td>0.00</td><td>2.5225</td><td>2.4680</td></tr><tr><td>GraphDG</td><td>55.09</td><td>56.47</td><td>0.4649</td><td>0.4298</td><td>7.76</td><td>0.00</td><td>1.9840</td><td>2.0108</td></tr><tr><td>CGCF</td><td>69.60</td><td>70.64</td><td>0.3915</td><td>0.3986</td><td>49.92</td><td>41.07</td><td>1.2698</td><td>1.3064</td></tr><tr><td>CGCF + ETM</td><td>72.43</td><td>74.38</td><td>0.3807</td><td>0.3955</td><td>53.29</td><td>47.06</td><td>1.2392</td><td>1.2480</td></tr><tr><td>RDKit</td><td>79.94</td><td>87.20</td><td>0.3238</td><td>0.3195</td><td>65.43</td><td>70.00</td><td>1.0962</td><td>1.0877</td></tr><tr><td>CVGAE + FF</td><td>63.10</td><td>60.95</td><td>0.3939</td><td>0.4297</td><td>83.08</td><td>95.21</td><td>0.9829</td><td>0.9177</td></tr><tr><td>GraphDG + FF</td><td>70.67</td><td>70.82</td><td>0.4168</td><td>0.3609</td><td>84.68</td><td>93.94</td><td>0.9129</td><td>0.9090</td></tr><tr><td>CGCF +FF</td><td>73.52</td><td>72.75</td><td>0.3131</td><td>0.3251</td><td>92.28</td><td>98.15</td><td>0.7740</td><td>0.7338</td></tr><tr><td>CGCF + ETM + FF</td><td>73.54</td><td>72.58</td><td>0.3088</td><td>0.3210</td><td>92.41</td><td>98.57</td><td>0.7737</td><td>0.7616</td></tr></table>
152
+
153
+ \* For the reported COV score, the threshold $\delta$ is set as $0 . 5 \mathrm { \AA }$ for QM9 and 1.25A˚ for Drugs. More results of COV scores with different threshold $\delta$ are given in Appendix H.
154
+
155
+ ![](images/486ae11ed6ee7e8a22d633cb6ecac7fd8f492450a45bd532578428cad47185b7.jpg)
156
+ Figure 2: Visualization of generated conformations from the state-of-the-art baseline (GraphDG), our method and the ground-truth, based on four random molecular graphs from the test set of GEOM-Drugs. C, O, H, S and Cl are colored gray, red, white, yellow and green respectively.
157
+
158
+ # 4.2 CONFORMATION GENERATION
159
+
160
+ In this section, we evaluate the ability of the proposed method to model the equilibrium conformations. We focus on both the diversity and accuracy of the generated samples. More specifically, diversity measures the model’s capacity to generate multi-modal conformations, which is essential for discovering new conformations, while accuracy concentrates on the similarity between generated conformations and the equilibrium conformations.
161
+
162
+ Evaluation. For numerical evaluations, we follow previous work (Hawkins, 2017; Mansimov et al., 2019) to calculate the Root-Mean-Square Deviation (RMSD) of the heavy atoms between generated samples and reference ones. Precisely, given the generated conformation $\pmb { R }$ and the reference $\pmb { R } ^ { * }$ , we obtain $\hat { R }$ by translating and rotating $\ b { R } ^ { * }$ to minimize the following predefined RMSD metric:
163
+
164
+ $$
165
+ \mathrm { R M S D } ( \pmb { R } , \hat { \pmb { R } } ) = \Big ( \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \| \pmb { R } _ { i } - \hat { \pmb { R } _ { i } } \| ^ { 2 } \Big ) ^ { \frac { 1 } { 2 } } ,
166
+ $$
167
+
168
+ where $n$ is the number of heavy atoms. Then the smallest distance is taken as the evaluation metric. Built upon the RMSD metric, we define Coverage (COV) and Matching (MAT) score to measure the diversity and quality respectively. Intuitively, COV measures the fraction of conformations in the reference set that are matched by at least one conformation in the generated set. For each conformation in the generated set, its neighbors in the reference set within a given RMSD threshold
169
+
170
+ Table 2: Comparison of distances density modeling with different methods. We compare the marginal distribution of single $( p ( d _ { u v } | \mathcal { G } ) )$ , pair $( p ( d _ { u v } , d _ { i j } \vert \mathcal { G } ) )$ and all $( p ( d | \mathcal { G } ) )$ edges between C and O atoms. Molecular graphs $\mathcal { G }$ are taken from the test set of ISO17. We take two metrics into consideration: 1) median MMD between the ground truth and generated ones, and 2) mean ranking (1 to 3) based on the MMD metric.
171
+
172
+ <table><tr><td></td><td colspan="2">Single</td><td colspan="2">Pair</td><td colspan="2">All</td></tr><tr><td></td><td>Mean</td><td>Median</td><td>Mean</td><td>Median</td><td>Mean</td><td>Median</td></tr><tr><td>RDKit</td><td>3.4513</td><td>3.1602</td><td>3.8452</td><td>3.6287</td><td>4.0866</td><td>3.7519</td></tr><tr><td>CVGAE</td><td>4.1789</td><td>4.1762</td><td>4.9184</td><td>5.1856</td><td>5.9747</td><td>5.9928</td></tr><tr><td>GraphDG</td><td>0.7645</td><td>0.2346</td><td>0.8920</td><td>0.3287</td><td>1.1949</td><td>0.5485</td></tr><tr><td>CGCF</td><td>0.4490</td><td>0.1786</td><td>0.5509</td><td>0.2734</td><td>0.8703</td><td>0.4447</td></tr><tr><td>CGCF +ETM</td><td>0.5703</td><td>0.2411</td><td>0.6901</td><td>0.3482</td><td>1.0706</td><td>0.5411</td></tr></table>
173
+
174
+ $\delta$ are marked as matched:
175
+
176
+ $$
177
+ \mathrm { C O V } ( \mathbb { S } _ { g } ( \mathcal { G } ) , \mathbb { S } _ { r } ( \mathcal { G } ) ) = \frac { 1 } { \left| \mathbb { S } _ { r } \right| } \bigg | \bigg \{ R \in \mathbb { S } _ { r } \big | \mathrm { R M S D } ( R , R ^ { \prime } ) < \delta , \exists R ^ { \prime } \in \mathbb { S } _ { g } \bigg \} \bigg | ,
178
+ $$
179
+
180
+ where $\mathbb { S } _ { g } ( \mathcal { G } )$ denotes the generated conformations set for molecular graph $\mathcal { G }$ , and $\mathbb { S } _ { r } ( \mathcal G )$ denotes the reference set. In practice, the number of samples in the generated set is two times of the reference set. Typically, a higher COV score means the a better diversity performance. The COV score is able to evaluate whether the generated conformations are diverse enough to cover the ground-truth.
181
+
182
+ While COV is effective to measure the diversity and detect the mode-collapse case, it is still possible for the model to achieve high COV with a high threshold tolerance. Here we define the MAT score as a complement to measure the quality of generated samples. For each conformation in the reference set, the RMSD distance to its nearest neighbor in the generated set is computed and averaged:
183
+
184
+ $$
185
+ \mathrm { M A T } ( \mathbb { S } _ { g } ( \mathcal { G } ) , \mathbb { S } _ { r } ( \mathcal { G } ) ) = \frac { 1 } { | \mathbb { S } _ { r } | } \sum _ { \pmb { R } ^ { \prime } \in \mathbb { S } _ { r } } \operatorname* { m i n } _ { \pmb { R } \in \mathbb { S } _ { g } } \mathrm { R M S D } ( \pmb { R } , \pmb { R } ^ { \prime } ) .
186
+ $$
187
+
188
+ This metric concentrate on the accuracy of generated conformations. More realistic generated samples lead to a lower matching score.
189
+
190
+ Results. Tab. 1 shows that compared with the existing state-of-the-art baselines, our CGCF model can already achieve superior performance on all four metrics (top 4 rows). As a CNF-based model, CGCF holds much the higher generative capacity for both diversity and quality compared than VAE approaches. The results are further improved when combined with ETM to explicitly incorporate the long-range correlations. We visualize several representative examples in Fig. 2, and leave more examples in Appendix G. A meaningful observation is that though competitive over other neural models, the rule-based RDKit method occasionally shows better performance than our model, which indicates that RDKit can generate more realistic structures. We argue that this is because after generating the initial coordinates, RDKit involves additional hand-designed molecular force field (FF) energy functions (Rappe et al., 1992; Halgren, 1996a) to find the stable conformations with ´ local minimal energy. By contrast, instead of finding the local minimums, our deep generative models aim to model and sample from the potential distribution of structures. To yield a better comparison, we further test our model by taking the generated structures as initial states and utilize the Merck Molecular Force Field (MMFF) (Halgren, 1996a) to find the local stable points. A more precise description of about the MMFF Force Field algorithms in RDKit is given in Appendix I. This postprocessing procedure is also employed in the previous work (Mansimov et al., 2019). Additional results in Tab. 1 verify our conjecture that FF plays a vital role in generating more realistic structures, and demonstrate the capacity of our method to generate high-quality initial coordinates.
191
+
192
+ # 4.3 DISTRIBUTIONS OVER DISTANCES
193
+
194
+ Tough primarily designed for 3D coordinates, we also following Simm & Hernandez-Lobato (2020) ´ to evaluate the generated distributions of pairwise distance, which can be viewed as a representative element of the model capacity to model the inter-atomic interactions.
195
+
196
+ Evaluation. Let $p ( d _ { u v } | \mathcal { G } )$ denote the conditional distribution of distances on each edge $e _ { u v }$ given a molecular graph $\mathcal { G }$ . The set of distances are computed from the generated conformations $\pmb { R }$ . We calculate maximum mean discrepancy (MMD) (Gretton et al., 2012) to compare the generated distributions and the ground-truth distributions. Specifically, we evaluate the distribution of individual distances $p ( d _ { u v } | \mathcal { G } )$ , pair distances $p ( d _ { u v } , d _ { i j } | \bar { \mathcal { G } } )$ and all distances $p ( d | \mathcal { G } )$ . For this benchmark, the number of samples in the generated set is the same as the reference set.
197
+
198
+ Table 3: Conformation Diversity. Mean and Std represent the corresponding mean and standard deviation of pairwise RMSD between the generated conformations per molecule.
199
+
200
+ <table><tr><td></td><td>RDKit</td><td>CVGAE</td><td>GraphDG</td><td>CGCF</td><td>CGCF +ETM</td></tr><tr><td>Mean</td><td>0.083</td><td>0.207</td><td>0.249</td><td>0.810</td><td>0.741</td></tr><tr><td>Std</td><td>0.054</td><td>0.187</td><td>0.104</td><td>0.223</td><td>0.206</td></tr></table>
201
+
202
+ Results. The results of MMD are summarized in Tab. 2. The statistics show that RDKit suffers the worst performance, which is because it just aims to generate the most stable structures as illustrated in Section 4.2. For CGCF, the generated samples are significantly closer to the ground-truth distribution than baseline methods, where we consistently achieve the best numerical results. Besides, we notice that ETM will slightly hurt the performance in this task. However, one should note that this phenomenon is natural because typically ETM will sharpen the generated distribution towards the stable conformations with local minimal energy. By contrast, the ISO17 dataset consists of snapshots of molecular dynamics where the structures are not equilibrium conformations but samples from the density around the equilibrium state. Therefore, ETM will slightly hurt the results. This phenomenon is also consistent with the observations for RDKit. Instead of generating unbiased samples from the underlying distribution, RDKit will only generate the stable ones with local minimal energy by involving the hand-designed molecular force field $\sin \alpha$ Hernandez-Lobato, ´ 2020). And as shown in the results, though highly competitive in Tab. 1, RDKit also suffers much weaker results in Tab. 2. The marginal distributions $P ( \bar { d } _ { u v } | \mathcal { G } )$ for pairwise distances in visualized in Appendix K, which further demonstrate the superior capacity of our proposed method.
203
+
204
+ We also follow Mansimov et al. (2019) to calculate the diversity of conformations generated by all compared methods, which is measured by calculating the mean and standard deviation of the pairwise RMSD between each pair of generated conformations per molecule. The results shown in Tab. 3 demonstrate that while our method can achieve the lowest MMD, it does not collapse to generating extremely similar conformations. Besides, we observe that ETM will slightly hurt the diversity of CGCF, which verifies our statement that ETM will sharpen the generated distribution towards the stable conformations with local minimal energy.
205
+
206
+ # 5 CONCLUSION AND FUTURE WORK
207
+
208
+ In this paper, we propose a novel probabilistic framework for molecular conformation generation. Our generative model combines the advantage of both flow-based and energy-based models, which is capable of modeling the complex multi-modal geometric distribution and highly branched atomic correlations. Experimental results show that our method outperforms all previous state-of-the-art baselines on the standard benchmarks. Future work includes applying our framework on much larger datasets and extending it to more challenging structures (e.g., proteins).
209
+
210
+ # ACKNOWLEDGMENTS
211
+
212
+ This project is supported by the Natural Sciences and Engineering Research Council (NSERC) Discovery Grant, the Canada CIFAR AI Chair Program, collaboration grants between Microsoft Research and Mila, Samsung Electronics Co., Ldt., Amazon Faculty Research Award, Tencent AI Lab Rhino-Bird Gift Fund and a NRC Collaborative R&D Project (AI4D-CORE-06). This project was also partially funded by IVADO Fundamental Research Project grant PRF-2019-3583139727.
213
+
214
+ # REFERENCES
215
+
216
+ Mohammed AlQuraishi. End-to-end differentiable learning of protein structure. Cell systems, 8(4): 292–301, 2019.
217
+
218
+ Simon Axelrod and Rafael Gomez-Bombarelli. Geom: Energy-annotated molecular conformations for property prediction and molecular generation. arXiv preprint arXiv:2006.05531, 2020.
219
+
220
+ Andrew J Ballard, Stefano Martiniani, Jacob D Stevenson, Sandeep Somani, and David J Wales. Exploiting the potential energy landscape to sample free energy. Wiley Interdisciplinary Reviews: Computational Molecular Science, 5(3):273–289, 2015.
221
+
222
+ Yoshua Bengio, Gregoire Mesnil, Yann Dauphin, and Salah Rifai. Better mixing via deep represen- ´ tations. In International conference on machine learning, pp. 552–560, 2013a.
223
+
224
+ Yoshua Bengio, Li Yao, Guillaume Alain, and Pascal Vincent. Generalized denoising auto-encoders as generative models. In Advances in neural information processing systems, pp. 899–907, 2013b.
225
+
226
+ Ricky TQ Chen, Yulia Rubanova, Jesse Bettencourt, and David K Duvenaud. Neural ordinary differential equations. In Advances in neural information processing systems, pp. 6571–6583, 2018.
227
+
228
+ Gordon M Crippen, Timothy F Havel, et al. Distance geometry and molecular conformation, volume 74. Research Studies Press Taunton, 1988.
229
+
230
+ Peter Dayan, Geoffrey E Hinton, Radford M Neal, and Richard S Zemel. The helmholtz machine. Neural computation, 7(5):889–904, 1995.
231
+
232
+ Marco De Vivo, Matteo Masetti, Giovanni Bottegoni, and Andrea Cavalli. Role of molecular dynamics and related methods in drug discovery. Journal of medicinal chemistry, 59(9):4035–4061, 2016.
233
+
234
+ Laurent Dinh, David Krueger, and Yoshua Bengio. Nice: Non-linear independent components estimation. arXiv preprint arXiv:1410.8516, 2014.
235
+
236
+ Yilun Du and Igor Mordatch. Implicit generation and generalization in energy-based models. arXiv preprint arXiv:1903.08689, 2019.
237
+
238
+ Niklas Gebauer, Michael Gastegger, and Kristof Schutt. Symmetry-adapted generation of 3d point ¨ sets for the targeted discovery of molecules. In Advances in Neural Information Processing Systems, pp. 7566–7578, 2019.
239
+
240
+ Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. arXiv preprint arXiv:1704.01212, 2017.
241
+
242
+ Will Grathwohl, Ricky TQ Chen, Jesse Bettencourt, Ilya Sutskever, and David Duvenaud. Ffjord: Free-form continuous dynamics for scalable reversible generative models. arXiv preprint arXiv:1810.01367, 2018.
243
+
244
+ Arthur Gretton, Karsten M Borgwardt, Malte J Rasch, Bernhard Scholkopf, and Alexander Smola. ¨ A kernel two-sample test. The Journal of Machine Learning Research, 13(1):723–773, 2012.
245
+
246
+ Michael Gutmann and Aapo Hyvarinen. Noise-contrastive estimation: A new estimation principle ¨ for unnormalized statistical models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 297–304, 2010.
247
+
248
+ Thomas A Halgren. Merck molecular force field. i. basis, form, scope, parameterization, and performance of mmff94. Journal of computational chemistry, 17(5-6):490–519, 1996a.
249
+
250
+ Thomas A Halgren. Merck molecular force field. v. extension of mmff94 using experimental data, additional computational data, and empirical rules. Journal of Computational Chemistry, 17(5-6): 616–641, 1996b.
251
+
252
+ Paul CD Hawkins. Conformation generation: the state of the art. Journal of Chemical Information and Modeling, 57(8):1747–1756, 2017.
253
+
254
+ Geoffrey E Hinton and Ruslan R Salakhutdinov. Reducing the dimensionality of data with neural networks. science, 313(5786):504–507, 2006.
255
+
256
+ Moritz Hoffmann and Frank Noe. Generating valid euclidean distance matrices. ´ arXiv preprint arXiv:1910.03131, 2019.
257
+
258
+ John Ingraham, Adam J Riesselman, Chris Sander, and Debora S Marks. Learning protein structure with a differentiable simulator. In International Conference on Learning Representations, 2019.
259
+
260
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
261
+
262
+ Yann LeCun, Sumit Chopra, Raia Hadsell, M Ranzato, and F Huang. A tutorial on energy-based learning. Predicting structured data, 1(0), 2006.
263
+
264
+ Tobias Lemke and Christine Peter. Encodermap: Dimensionality reduction and generation of molecule conformations. Journal of chemical theory and computation, 15(2):1209–1215, 2019.
265
+
266
+ Leo Liberti, Carlile Lavor, Nelson Maculan, and Antonio Mucherino. Euclidean distance geometry and applications. SIAM review, 56(1):3–69, 2014.
267
+
268
+ Elman Mansimov, Omar Mahmood, Seokho Kang, and Kyunghyun Cho. Molecular geometry prediction using a deep generative graph neural network. arXiv preprint arXiv:1904.00314, 2019.
269
+
270
+ Jiquan Ngiam, Zhenghao Chen, Pang W Koh, and Andrew Y Ng. Learning deep energy models. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 1105– 1112, 2011.
271
+
272
+ Frank Noe, Simon Olsson, Jonas K ´ ohler, and Hao Wu. Boltzmann generators: Sampling equilibrium ¨ states of many-body systems with deep learning. Science, 365(6457):eaaw1147, 2019.
273
+
274
+ 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.
275
+
276
+ Raghunathan Ramakrishnan, Pavlo O Dral, Matthias Rupp, and O Anatole Von Lilienfeld. Quantum chemistry structures and properties of 134 kilo molecules. Scientific data, 1(1):1–7, 2014.
277
+
278
+ Anthony K Rappe, Carla J Casewit, KS Colwell, William A Goddard III, and W Mason Skiff. Uff, ´ a full periodic table force field for molecular mechanics and molecular dynamics simulations. Journal of the American chemical society, 114(25):10024–10035, 1992.
279
+
280
+ Danilo Jimenez Rezende and Shakir Mohamed. Variational inference with normalizing flows. arXiv preprint arXiv:1505.05770, 2015.
281
+
282
+ Sereina Riniker and Gregory A Landrum. Better informed distance geometry: using what we know to improve conformation generation. Journal of chemical information and modeling, 55(12): 2562–2574, 2015.
283
+
284
+ Kristof Schutt, Pieter-Jan Kindermans, Huziel Enoc Sauceda Felix, Stefan Chmiela, Alexandre ¨ Tkatchenko, and Klaus-Robert Muller. Schnet: A continuous-filter convolutional neural network ¨ for modeling quantum interactions. In Advances in neural information processing systems, pp. 991–1001, 2017.
285
+
286
+ Andrew W Senior, Richard Evans, John Jumper, James Kirkpatrick, Laurent Sifre, Tim Green, Chongli Qin, Augustin Zˇ ´ıdek, Alexander WR Nelson, Alex Bridgland, et al. Improved protein structure prediction using potentials from deep learning. Nature, 577(7792):706–710, 2020.
287
+
288
+ Chence Shi, Minkai Xu, Zhaocheng Zhu, Weinan Zhang, Ming Zhang, and Jian Tang. Graphaf: a flow-based autoregressive model for molecular graph generation. arXiv preprint arXiv:2001.09382, 2020.
289
+
290
+ Gregor NC Simm and Jose Miguel Hern ´ andez-Lobato. A generative model for molecular distance ´ geometry. In International Conference on Machine Learning, 2020.
291
+
292
+ Justin S Smith, Olexandr Isayev, and Adrian E Roitberg. Ani-1: an extensible neural network potential with dft accuracy at force field computational cost. Chemical science, 8(4):3192–3203, 2017.
293
+
294
+ Yuxuan Song, Qiwei Ye, Minkai Xu, and Tie-Yan Liu. Discriminator contrastive divergence: Semi-amortized generative modeling by exploring energy of the discriminator. arXiv preprint arXiv:2004.01704, 2020.
295
+
296
+ Jianwen Xie, Yang Lu, Song-Chun Zhu, and Yingnian Wu. A theory of generative convnet. In International Conference on Machine Learning, pp. 2635–2644, 2016.
297
+
298
+ Jiaxuan You, Bowen Liu, Zhitao Ying, Vijay Pande, and Jure Leskovec. Graph convolutional policy network for goal-directed molecular graph generation. In Advances in neural information processing systems, pp. 6410–6421, 2018.
299
+
300
+ # A RELATED WORKS
301
+
302
+ Conformation Generation. There have been results showing deep learning speeding up molecular dynamics simulation by learning efficient alternatives to quantum mechanics-based energy calculations (Schutt et al., 2017; Smith et al., 2017). However, though accelerated by neural networks, ¨ these approaches are still time-consuming due to the lengthy MCMC process. Recently, Gebauer et al. (2019) and Hoffmann & Noe (2019) propose to directly generate 3D structures with deep gen- ´ erative models. However, these models can hardly capture graph- or bond-based structure, which is typically complex and highly branched. Some other works (Lemke & Peter, 2019; AlQuraishi, 2019; Ingraham et al., 2019; Noe et al., 2019; Senior et al., 2020) also focus on learning models to ´ directly generate 3D structure, but focus on the protein folding problem. Unfortunately, proteins are linear structures while general molecules are highly branched, making these methods not naturally transferable to general molecular conformation generation tasks.
303
+
304
+ Energy-based Generative Model. There has been a long history for energy-based generative models. Xie et al. (2016) proposes to train an energy-based model parameterized by modern deep neural network and learned it by Langevin based MLE. The model is called generative ConvNet since it can be derived from the discriminative ConvNet. In particular, this paper is the first to formulate modern ConvNet-parametrized EBM as exponential tilting of a reference distribution, and connect it to discriminative ConvNet classifier. More recently, Du & Mordatch (2019) implemented the deep EBMs with ConvNet as energy function and achieved impressive results on image generation.
305
+
306
+ Different from the previous works, we concentrate on molecular geometry generation, and propose a novel and principled probabilistic framework to address the domain-specific problems. More specifically, we first predict the atomic distances through the continuous normalizing flow, and then convert them to the desired 3D conformation and optimize it with the energy-based model. This procedure enables us to keep the rotational and translational invariance property. Besides, to the best of our knowledge, we are the first one to combine neural ODE with EBMs. We take the ODE model to improve the training of EBM, and combine both to conduct the two-stage sampling dynamics.
307
+
308
+ # B DATA PREPROCESS
309
+
310
+ Inspired by classic molecular distance geometry (Crippen et al., 1988), we also generate the confirmations by firstly predicting all the pairwise distances, which enjoys the invariant property to rotation and translation. Since the bonds existing in the molecular graph are not sufficient to characterize a conformation, we pre-process the graphs by extending auxiliary edges. Specifically, the atoms that are 2 or 3 hops away are connected with virtual bonds, labeled differently from the real bonds of the original graph. These extra edges contribute to reducing the degrees of freedom in the 3D coordinates, with the edges between second neighbors helping to fix the angles between atoms, and those between third neighbors fixing dihedral angles.
311
+
312
+ # C NETWORK ARCHITECTURE
313
+
314
+ In this section, we elaborate on the network architecture details of CGCF and ETM.
315
+
316
+ # C.1 CONTINUOUS GRAPH FLOW
317
+
318
+ In CGCF, the dynamic function $f _ { \theta }$ defined in Eq. 6 is instanced with a message passing neural networks. Given the node attributes, edge attributes and intermediate edge lengths as input, we first embed them into the feature space through feedforward networks:
319
+
320
+ $$
321
+ \begin{array} { r l } & { \pmb { h } _ { v } ^ { ( 0 ) } = \mathrm { N o d e E m b e d d i n g } ( v ) , \quad v \in \mathcal { V } , } \\ & { \pmb { h } _ { e _ { u v } } = \mathrm { E d g e E m b e d d i n g } ( e _ { u v } , d _ { u v } ( t _ { 0 } ) ) , \quad e _ { u v } \in \mathcal { E } . } \end{array}
322
+ $$
323
+
324
+ Then, the node and edge features along are passed sequentially into $L$ layers message passing networks with the graph structure $\mathcal { G }$ :
325
+
326
+ $$
327
+ \pmb { h } _ { v } ^ { ( \ell ) } = \mathrm { M L P } \left( \pmb { h } _ { v } ^ { ( \ell - 1 ) } + \sum _ { u \in N _ { \mathcal { G } } ( v ) } \sigma ( \pmb { h } _ { u } ^ { ( \ell - 1 ) } + \pmb { h } _ { e _ { u v } } ) \right) , \quad \ell = 1 \ldots L ,
328
+ $$
329
+
330
+ where $N _ { \mathcal { G } } ( v )$ denotes the first neighbors in the graph $\mathcal { G }$ and $\sigma$ is the activation function. After $L$ message passing layers, we use the final hidden representation $h ^ { ( L ) }$ as the node representations. Then for each bond, the corresponding node features are aggregated along with the edge feature to be fed into a neural network to compute the value of the dynamic $f _ { \theta }$ :
331
+
332
+ $$
333
+ \frac { \partial d _ { u v } } { \partial t } = \mathrm { N N } ( h _ { u } , h _ { v } , h _ { e _ { u v } } , t ) .
334
+ $$
335
+
336
+ # C.2 ENERGY-BASED TILTING MODEL
337
+
338
+ The ETM is implemented with SchNet. It takes both the graph and conformation information as input and output a scalar to indicate the energy level. Let the atoms are described by a tuple of features $\mathbf { X } ^ { l } \doteq ( \mathbf { x } _ { 1 } ^ { l } , \ldots , \mathbf { x } _ { n } ^ { l } )$ , where $n$ denote the number of atoms and $l$ denote the layer. Then given the positions $\pmb { R }$ , the node embeddings are updated by the convolution with all surrounding atoms:
339
+
340
+ $$
341
+ \mathbf { x } _ { i } ^ { l + 1 } = \left( X ^ { l } * W ^ { l } \right) _ { i } = \sum _ { j = 0 } ^ { n _ { \mathrm { a t o m s } } } \mathbf { x } _ { j } ^ { l } \circ W ^ { l } \left( \mathbf { r } _ { j } - \mathbf { r } _ { i } \right) ,
342
+ $$
343
+
344
+ where ”o” represents the element-wise multiplication. It is straightforward that the above function enables to include translational and rotational invariance by computing pairwise distances instead of using relative positions. After $L$ convolutional layers, we perform a sum-pooling operator over the node embeddings to calculate the global embedding for the whole molecular structure. Then the global embedding is fed into a feedforward network to compute the scalar of the energy level.
345
+
346
+ # D TWO-STAGE DYNAMIC SYSTEM FOR SAMPLING
347
+
348
+ # Algorithm 1 Sampling Procedure of the Proposed Method
349
+
350
+ Input: molecular graph $\mathcal { G }$ , CGCF model with parameter $\theta$ , ETM with parameter $\phi$ , the number of optimization steps for $p ( R | d , \mathcal { G } ) ~ M$ and its step size $r$ , the number of MCMC steps for $E _ { \theta , \phi } N$ and its step size $\epsilon$
351
+
352
+ Output: molecular conformation $\pmb { R }$
353
+
354
+ 1: Sample ${ \pmb d } ( t _ { 0 } ) \sim \mathcal { N } ( 0 , \mathcal { T } )$
355
+ 2: $\pmb { d } = F _ { \theta } ( \pmb { d } ( t _ { 0 } ) , \mathcal { G } )$
356
+ 3: for $m = 1 , . . . , M$ do
357
+ 4: $R _ { m } = R _ { m - 1 } + r \nabla _ { R } \log p ( R | d , \mathcal { G } )$
358
+ 5: end for
359
+ 6: for $n = 1 , . . . , N$ do
360
+ 7: $\begin{array} { r } { { \bf R } _ { n } = { \bf R } _ { n - 1 } - \frac { \epsilon } { 2 } \nabla _ { \bf R } E _ { \theta , \phi } ( { \bf R } | \mathcal { G } ) + \sqrt { \epsilon } \omega , \omega \sim \mathcal { N } ( 0 , \mathcal { T } ) , } \end{array}$
361
+ 8: end for
362
+
363
+ # E IMPLEMENTATION DETAILS
364
+
365
+ Our model is implemented in PyTorch (Paszke et al., 2017). The MPNN in CGCF is implemented with 3 layers, and the embedding dimension is set as 128. And the SchNet in ETM is implemented with 6 layers with the embedding dimension set as 128. We train our CGCF with a batch size of 128 and a learning rate of 0.001 until convergence. After obtaining the CGCF, we train the ETM with a batch size of 384 and a learning rate of 0.001 until convergence. For all experimental settings, we use Adam (Kingma & Ba, 2014) to optimize our model.
366
+
367
+ # F DETAILED DERIVATIONS OF ENERGY-BASED MODEL
368
+
369
+ Here we present the detailed derivations of the training objective function of Energy-based Tilting Model (ETM) in Eq. 9:
370
+
371
+ $$
372
+ \begin{array} { r l } & { \mathcal { L } _ { \mathrm { n c e } } ( R , \mathcal { G } ; \phi ) = - \mathbb { E } _ { p _ { \mathrm { d a t a } } } \big [ \log \frac { p _ { \theta , \phi } ( R | \mathcal { G } ) } { p _ { \theta , \phi } ( R | \mathcal { G } ) + p _ { \theta } ( R | \mathcal { G } ) } \big ] - \mathbb { E } _ { p _ { \theta } } \big [ \log \frac { p _ { \theta } ( R | \mathcal { G } ) } { p _ { \theta , \phi } ( R | \mathcal { G } ) + p _ { \theta } ( R | \mathcal { G } ) } \big ] } \\ & { \quad \quad \quad \quad \quad = - \mathbb { E } _ { p _ { \mathrm { d a t a } } } \big [ \log \frac { p _ { \theta } ( R | \mathcal { G } ) \exp ( - E _ { \phi } ( R , \mathcal { G } ) ) } { p _ { \theta } ( R | \mathcal { G } ) \exp ( - E _ { \phi } ( R , \mathcal { G } ) ) + p _ { \theta } ( R | \mathcal { G } ) } \big ] } \\ & { \quad \quad \quad \quad \quad - \mathbb { E } _ { p _ { \theta } } \big [ \log \frac { p _ { \theta } ( R | \mathcal { G } ) } { p _ { \theta } ( R | \mathcal { G } ) \exp ( - E _ { \phi } ( R , \mathcal { G } ) ) + p _ { \theta } ( R | \mathcal { G } ) } \big ] } \\ & { \quad \quad \quad \quad = - \mathbb { E } _ { p _ { \mathrm { d a t a } } } \big [ \log \frac { 1 } { 1 + \exp ( E _ { \phi } ( R , \mathcal { G } ) ) } \big ] - \mathbb { E } _ { p _ { \theta } } \big [ \log \frac { 1 } { 1 + \exp ( - E _ { \phi } ( R , \mathcal { G } ) ) } \big ] . } \end{array}
373
+ $$
374
+
375
+ # G MORE GENERATED SAMPLES
376
+
377
+ We present more visualizations of generated 3D structures in Fig. 3, which are generated from our model $( \mathbf { C G C F + E T M } )$ learned on both GEOM-QM9 and GEOM-Drugs datasets. The visualizations demonstrate that our proposed framework holds the high capacity to model the chemical structures in the 3D coordinates.
378
+
379
+ ![](images/ae3432b1f6664a1cd090103c4057e11e225d8df684286325a2fe5dba5e9d74e4.jpg)
380
+ Figure 3: Visualizations of generated graphs from our proposed method. In each row, we show multiple generated conformations for one molecular graph. For the top 5 rows, the graphs are chosen from the small molecules in GEOM-QM9 test dataset; and for the bottom 4 rows, graphs are chosen from the larger molecules in GEOM-Drugs test dataset. C, O, H, S and CI are colored gray, red, white, yellow and green respectively.
381
+
382
+ # H MORE RESULTS OF COVERAGE SCORE
383
+
384
+ We give more results of the coverage (COV) score with different threshold $\delta$ in Fig. 4. As shown in the figure, our proposed method can consistently outperform the previous state-of-the-art baselines CVGAE and GraphDG, which demonstrate the effectiveness of our model.
385
+
386
+ ![](images/10d1b6f7fc9970424468be8b7592e15d1f151a961a4af112c539d5d078da8aa6.jpg)
387
+ Figure 4: Curves of the averaged coverage score with different RMSD thresholds on GEOM-QM9 (left two) and GEOM-Drugs (right two) datasets. The first and third curves are results of only the generative models, while the other two are results when further optimized with rule-based force fields.
388
+
389
+ # I IMPLEMENTATION FOR MMFF
390
+
391
+ In this section, we give a more precise description of the MMFF Force Field implementation in the RDKit toolkit (Riniker & Landrum, 2015).
392
+
393
+ In MMFF, the energy expression is constituted by seven terms: bond stretching, angle bending, stretch-bend, out-of-plane bending, torsional, van der Waals and electrostatic. The detailed functional form of individual terms can be found in the original literature (Halgren, 1996a). To build the force field for a given molecular system, the first step is to assign correct types to each atom. At the second step, atom-centered partial charges are computed according to the MMFF charge model (Halgren, 1996b). Then, all bonded and non-bonded interactions in the molecular system under study, depending on its structure and connectivity, are loaded into the energy expression. Optionally, external restraining terms can be added to the MMFF energy expression, with the purpose of constraining selected internal coordinates during geometry optimizations. Once all bonded and non-bonded interactions, plus optional restraints, have been loaded into the MMFF energy expression, potential gradients of the system under study can be computed to minimize the energy.
394
+
395
+ # J MORE EVALUATIONS FOR CONFORMATION GENERATION
396
+
397
+ Junk Rate. The COV and MAT score in Section 4.2 do not appear to explicitly measure the generated false samples. Here we additionally define Junk rate measurement. Intuitively, JUNK measures the fraction of generated conformations that are far away from all the conformations in the reference set. For each conformation in the generated set, it will be marked as a false sample if its RMSD to all the conformations of reference set are above a given threshold $\delta$ :
398
+
399
+ $$
400
+ \mathrm { J U N K } ( \mathbb { S } _ { g } ( \mathcal { G } ) , \mathbb { S } _ { r } ( \mathcal { G } ) ) = \frac { 1 } { \lvert \mathbb { S } _ { g } \rvert } \Big \lvert \Big \{ \pmb { R } \in \mathbb { S } _ { g } \big \rvert \mathrm { R M S D } ( \pmb { R } , \pmb { R } ^ { \prime } ) > \delta , \forall \pmb { R } ^ { \prime } \in \mathbb { S } _ { r } \Big \} \Big \rvert ,
401
+ $$
402
+
403
+ Typically, a lower JUNK rate means better generated quality. The results are shown in Tab. 4. As shown in the table, our CGCF model can already outperform the existing state-of-the-art baselines with an obvious margin. The results are further improved when combined with ETM to explicitly incorporate the long-range correlations.
404
+
405
+ # K DISTANCE DISTRIBUTION VISUALIZATION
406
+
407
+ In Fig. 5, we plot the marginal distributions $p ( d _ { u v } | \mathcal { G } )$ for all pairwise distances between C and O atoms of a molecular graph in the ISO17 test set. As shown in the figure, though primarily designed for 3D structure generation, our method can make much better estimation of the distances than GraphDG, which is the state-of-the-art model for molecular geometry prediction. As a representative element of the pairwise property between atoms, the inter-atomic distances demonstrate the capacity of our model to capture the inter-atomic interactions.
408
+
409
+ Table 4: Comparison of different methods on the JUNK scores. Top 4 rows: deep generative models for molecular conformation generation. Bottom 5 rows: different methods that involve an additional rule-based force field to further optimize the generated structures.
410
+
411
+ <table><tr><td>Dataset Metric</td><td>GEOM-QM9 JUNK* (%)</td><td></td><td>GEOM-Drugs JUNK*(%)</td></tr><tr><td>CVGAE</td><td>Mean 71.59</td><td>Median 100.00</td><td>Mean Median 100.00</td></tr><tr><td>GraphDG</td><td>61.25</td><td>66.26</td><td>100.00 97.83 100.00</td></tr><tr><td>CGCF</td><td>55.24</td><td>57.24</td><td>77.82 90.00</td></tr><tr><td>CGCF+ETM</td><td>52.15</td><td>54.23 75.81</td><td>88.64</td></tr><tr><td>RDKit</td><td>17.07</td><td>5.90</td><td>45.51 45.94</td></tr><tr><td>CVGAE+FF</td><td>62.92</td><td>71.21</td><td>72.01 78.44</td></tr><tr><td>GraphDG + FF</td><td>45.53</td><td>46.35</td><td>55.50 61.54</td></tr><tr><td>CGCF+FF</td><td>43.01</td><td>46.69 37.48</td><td>36.63</td></tr><tr><td>CGCF +ETM+ FF</td><td>41.63</td><td>43.97</td><td>36.16 33.05</td></tr></table>
412
+
413
+ For the reported JUNK score, the threshold $\delta$ is set as 0.5A˚ for QM9 and $1 . 2 5 \mathrm { \AA }$ for Drugs.
414
+
415
+ ![](images/03966fa21fc67bf5a52d741023334a901a30327ec8ea9d3b66cdd9d52c9f67e2.jpg)
416
+ Figure 5: Marginal distributions $p ( d _ { u v } | \mathcal { G } )$ of ground-truth and generated conformations between C and O atoms given a molecular graph from the test set of ISO17. In each subplot, the annotation $( u - v )$ indicates the atoms connected by the corresponding bond $d _ { u v }$ . We concentrate on the heavy atoms $\mathbf { C }$ and O) and omit the H atoms for clarity.
md/train/r1eIiCNYwS/r1eIiCNYwS.md ADDED
@@ -0,0 +1,421 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TRANSFORMER-XH: MULTI-EVIDENCE REASONING WITH EXTRA HOP ATTENTION
2
+
3
+ Chen Zhao∗
4
+ University of Maryland, College Park
5
+ chenz@cs.umd.edu
6
+
7
+ Chenyan Xiong, Corby Rosset, Xia Song, Paul Bennett, and Saurabh Tiwary
8
+
9
+ Microsoft AI & Research cxiong, corosset, xiaso, pauben, satiwary $@$ microsoft.com
10
+
11
+ # ABSTRACT
12
+
13
+ Transformers have achieved new heights modeling natural language as a sequence of text tokens. However, in many real world scenarios, textual data inherently exhibits structures beyond a linear sequence such as trees and graphs; many tasks require reasoning with evidence scattered across multiple pieces of texts. This paper presents Transformer-XH, which uses eXtra Hop attention to enable intrinsic modeling of structured texts in a fully data-driven way. Its new attention mechanism naturally “hops” across the connected text sequences in addition to attending over tokens within each sequence. Thus, Transformer-XH better conducts joint multi-evidence reasoning by propagating information between documents and constructing global contextualized representations. On multi-hop question answering, Transformer-XH leads to a simpler multi-hop QA system which outperforms previous state-of-the-art on the HotpotQA FullWiki setting. On FEVER fact verification, applying Transformer-XH provides state-of-the-art accuracy and excels on claims whose verification requires multiple evidence.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ Transformers effectively model natural language in sequential form (Vaswani et al., 2017; Dai et al., 2019; Devlin et al., 2019; Yang et al., 2019). Nevertheless, in many NLP tasks, text does not simply appear as a linear sequence of tokens but rather carries meaningful structure in the form of paragraphs, headings, and hyperlinks. These structures can be represented abstractly as trees or graphs with nodes and edges; and the tasks can be performed as joint reasoning on these more general structures as input. Multi-hop question answering (Yang et al., 2018) is one such task in which structure plays an important role, since the evidence required to formulate the answer is scattered across multiple documents, requiring systems to jointly reason across links between them.
18
+
19
+ Recent approaches leverage pre-trained Transformers (e.g., BERT) for multi-hop question answering (QA) by converting the structural reasoning task into sub-tasks that model flat sequences. For example, Min et al. (2019b) decompose a multi-hop question into a series of single-hop questions; Ding et al. (2019) conduct several steps of single-hop reading comprehension to simulate the multihop reasoning. The hope is that additional processing to fuse the outputs of the sub-models can recover all the necessary information from the original structure. While pre-trained Transformer language models have shown improvements on multi-hop QA, manipulating the inherent structure of the problem to fit the rigid requirements of out-of-the-box models can introduce problematic assumptions or information loss.
20
+
21
+ This paper presents Transformer-XH (meaning eXtra Hop), which upgrades Transformers with the ability to natively represent structured texts. Transformer-XH introduces extra hop attention in its layers that connects different text pieces following their inherent structure while also maintaining the powerful pre-trained Transformer abilities over each textual piece individually. Our extra hop attention enables 1) a more global representation of the evidence contributed by each piece of text as it relates to the other evidence, and 2) a more natural way to jointly reason over an evidence graph by propagating information along edges necessary to complete the task at hand.
22
+
23
+ We apply Transformer-XH to two multi-evidence reasoning tasks: Hotpot QA, the multi-hop question answering task (Yang et al., 2018), and FEVER, the fact verification benchmark whose claims often require multiple pieces of evidence to support (Thorne et al., 2018). Rather than decomposing the task into a series of sub-tasks to fit the constraints of pre-trained Transformers, TransformerXH is a solution that fits the problem as it naturally occurs. It is a single model that represents and combines evidence from multiple documents to conduct the reasoning process. On HotpotQA’s FullWiki setting, which requires strong multi-hop reasoning capability (Min et al., 2019b; Jiang & Bansal, 2019), Transformer-XH outperforms CogQA (Ding et al., 2019), the previous start-of-theart, by 12 points on answer F1. On FEVER 1.0 shared task, Transformer-XH outperforms GEAR, the Graph Neural Network based approach significantly. On both applications, Transformer-XH beats the contemporary BERT based pipeline SR-MRS (Nie et al., 2019), by 2-3 points.
24
+
25
+ The results follow from our simple yet effective design, with one unified model operating over the inherent structure of the task, rather than melding the outputs from disparate sub-tasks adapted to the sequential constraints of pre-trained Transformers. Our ablation studies demonstrate TransformerXH’s efficacy on questions that are known to require multi-hop reasoning (Min et al., 2019b) and on verifying multi-evidence claims (Liu et al., 2019b). Our analyses confirm that the source of Transformer-XH’s effectiveness success is due to the eXtra Hop attention’s ability to fuse and propagate information across multiple documents.1
26
+
27
+ # 2 MODEL
28
+
29
+ This section first discusses preliminaries on sequential Transformers, then we show how we incorporate eXtra hop attention to create Transformer-XH.
30
+
31
+ # 2.1 PRELIMINARIES
32
+
33
+ Transformers represent a sequence of input text tokens $X = \{ x _ { 1 } , . . . , x _ { i } , . . . , x _ { n } \}$ as contextualized distributed representations $H = \{ h _ { 1 } , . . . , h _ { i } , . . . , h _ { n } \}$ (Vaswani et al., 2017). This process involves multiple stacked self-attention layers that converts the input $X$ into $\{ H ^ { 0 } , H ^ { 1 } , . . . , \dot { H } ^ { l } , . . . H ^ { L } \}$ , starting from $H ^ { 0 }$ , the embeddings, to the final layer of depth $L$ .
34
+
35
+ The key idea of Transformer is its attention mechanism, which calculates the $l$ -th layer output $H ^ { l }$ using the input $H ^ { l - 1 }$ from the previous layer:
36
+
37
+ $$
38
+ \begin{array} { c } { { H ^ { l } = \mathrm { s o f t m a x } ( \frac { \boldsymbol { Q } \cdot \boldsymbol { K } ^ { T } } { \sqrt { d _ { k } } } ) \cdot \boldsymbol { V } ^ { T } , } } \\ { { Q ^ { T } ; \boldsymbol { K } ^ { T } ; \boldsymbol { V } ^ { T } = W ^ { q } \cdot H ^ { l - 1 } ; W ^ { k } \cdot H ^ { l - 1 } ; W ^ { v } \cdot H ^ { l - 1 } . } } \end{array}
39
+ $$
40
+
41
+ It includes three projections on the input $H ^ { l - 1 }$ : Query (Q), Key (K), and Value (V).
42
+
43
+ Specifically, the slices of token $h _ { i } ^ { l }$ in Eqn.(2) is:
44
+
45
+ $$
46
+ h _ { i } ^ { l } = \sum _ { j } \mathrm { s o f t m a x } _ { j } ( \frac { q _ { i } ^ { T } \cdot k _ { j } } { \sqrt { d _ { k } } } ) \cdot v _ { j } ,
47
+ $$
48
+
49
+ which first calculates its attention to all other tokens $j$ in the sequence and then combines the token values $v _ { j }$ into a new representation $h _ { i } ^ { l }$ , using the normalized attention weights. Multiple attentions can be used in one Transformer layer and concatenated as multi-head attention (Vaswani et al., 2017). The architecture is stacked to form rather deep networks, which leads to significant success of large pre-trained Transformer models (Devlin et al., 2019; Liu et al., 2019a).
50
+
51
+ A challenge of Transformer is that its attention is calculated over all token pairs (Eqn. 3), which is hard to scale to long text sequences. Transformer-XL (eXtra Long) addresses this challenge by breaking down longer texts, e.g., a multi-paragraph document, into a sequence of text segments: $\{ X _ { 1 } , . . . , \bar { X } _ { \tau } , . . . , X _ { \zeta } \}$ , and propagates the information between adjacent text segments using the following attention:
52
+
53
+ $$
54
+ \tilde { H } _ { \tau } ^ { l - 1 } = [ \mathrm { F r e e z e } ( H _ { \tau - 1 } ^ { l - 1 } ) \circ H _ { \tau } ^ { l - 1 } ] .
55
+ $$
56
+
57
+ ![](images/8baba74743e8e0ad5cde2c86e9cf6d36bd451afabad7f781dfa9d0e1d0a6d335.jpg)
58
+ (a) Hop attention on the path
59
+ (b) Transformer-XH in Multi-hop QA
60
+ Figure 1: The eXtra Hop attention in Transformer-XH (a) and its application to multi-hop QA (b).
61
+
62
+ It concatenates (◦) the representation of the previous segment $H _ { \tau - 1 } ^ { l - 1 }$ to the current segment as segment level recurrences. The new representation $\tilde { H } _ { \tau } ^ { l - 1 }$ includes the information from previous segment and is integrated in the new attention mechanism:
63
+
64
+ $$
65
+ \tilde { Q } ^ { T } ; \tilde { K } ^ { T } ; \tilde { V } ^ { T } = W ^ { q } \cdot H _ { \tau } ^ { l - 1 } ; W ^ { k } \cdot \tilde { H } _ { \tau } ^ { l - 1 } ; W ^ { v } \cdot \tilde { H } _ { \tau } ^ { l - 1 } .
66
+ $$
67
+
68
+ The attention over the previous segment allows Transformer-XL to effectively model long form text data recurrently as a sequence of text chunks (Dai et al., 2019).
69
+
70
+ Nevertheless, in many scenarios, the text segments are organized in nontrivial structures beyond a linear sequence. For example, documents are connected by hyperlinks in a graphical structure that does not readily simplify to form a linear sequence, prohibiting Transformer-XL’s recurrent approach.
71
+
72
+ # 2.2 TRANSFORMER-XH WITH EXTRA HOP ATTENTION
73
+
74
+ Transformer-XH models structured text sequence by linking them with eXtra Hop attention following their original structure. As illustrated in Figure 1a, to model three connected documents $d _ { 2 } d _ { 1 } d _ { 3 }$ , Transformer-XH uses eXtra Hop attention to propagate information along the graph edges, enabling information sharing between connected text sequence.
75
+
76
+ Formally, the structured text data includes a set of nodes, $\mathcal { X } = \{ X _ { 1 } , . . . , X _ { \tau } , . . . X _ { \zeta } \}$ , each corresponding to a text sequence, and an edge matrix $E$ , which includes the connections (e.g., links) between them. The goal is to learn representations $\mathcal { H } = \{ \tilde { H } _ { 1 } , . . . , \tilde { H } _ { \tau } , . . . \tilde { H } _ { \zeta } \}$ , that incorporate not only the local information in each sequence $X$ , but also the global contexts on the entire structured text $\{ \mathcal { X } , E \}$ .
77
+
78
+ Transformer-XH achieves this by two attention mechanisms: in-sequence attention and eXtra Hop attention. The in-sequence attention is the same as vanilla Transformer: in layer $l$ , token $i$ gathers information from other tokens inside the same text piece $\tau$ :
79
+
80
+ $$
81
+ h _ { \tau , i } ^ { l } = \sum _ { j } \mathrm { s o f t m a x } _ { j } ( \frac { q _ { \tau , i } ^ { T } \cdot k _ { \tau , j } } { \sqrt { d _ { k } } } ) \cdot v _ { \tau , j } .
82
+ $$
83
+
84
+ The eXtra Hop attention uses the first token in each sequence – the added special token “[CLS]” – as an “attention hub”, which attends on all other connected nodes’ hub token. In layer $l$ , the $\tau$ -th text sequence attends over another text sequence $\eta$ if there is an edge between them $e _ { \tau \eta } = 1$ ):
85
+
86
+ $$
87
+ \hat { h } _ { \tau , 0 } ^ { l } = \sum _ { \eta ; e _ { \tau \eta } = 1 } \mathrm { s o f t m a x } _ { \eta } ( \frac { \hat { q } _ { \tau , 0 } ^ { T } \cdot \hat { k } _ { \eta , 0 } } { \sqrt { d _ { k } } } ) \cdot \hat { v } _ { \eta , 0 } .
88
+ $$
89
+
90
+ Node $\tau$ calculates the attention weight on its neighbor $\eta$ using hop query $\hat { q } _ { \tau , 0 }$ and key $\hat { k } _ { \eta , 0 }$ . Then it uses the weights to combine its neighbors’ value $\hat { v } _ { \eta , 0 }$ and forms a globalized representation $\hat { h } _ { \tau , 0 } ^ { l }$ .
91
+
92
+ The two attention mechanism are combined to form the new representation of layer $l$
93
+
94
+ $$
95
+ \begin{array} { r l } & { \tilde { h } _ { \tau , 0 } ^ { l } = \mathrm { L i n e a r } ( [ h _ { \tau , 0 } ^ { l } \circ \hat { h } _ { \tau , 0 } ^ { l } ] ) , } \\ & { \tilde { h } _ { \tau , i } ^ { l } = h _ { \tau , i } ^ { l } ; \forall i \neq 0 . } \end{array}
96
+ $$
97
+
98
+ Note that the non-hub tokens $( i \neq 0 )$ ) still have access to the hop attention in the previous layer through Eqn. (6).
99
+
100
+ One layer of eXtra Hop attention can be viewed as single-step of information propagation along edges $E$ . For example, in Figure 1a, the document node $d _ { 3 }$ updates its representation by gathering information from its neighbor $d _ { 1 }$ using the hop attention $d _ { 1 } d _ { 3 }$ . When multiple TransformerXH layers are stacked, this information in $d _ { 1 }$ includes both $d _ { 1 }$ ’s local contexts from its in-sequence attention, and cross-sequence information from the hop attention $d _ { 2 } \to d _ { 1 }$ of the $l - 1$ layer. Hence, an L-layer Transformer-XH can attend over information from up to $\mathrm { L }$ hops away.
101
+
102
+ Together, three main properties equip Transformer-XH to effectively model raw structured text data: the propagation of information (values) along edges, the importance of that information (hop attention weights), and the balance of in-sequence and cross-sequence information (attention combination). The representations learned in $\mathcal { H }$ can innately express nuances in structured text that are required for complex reasoning tasks such as multi-hop QA and natural language inference.
103
+
104
+ # 3 APPLICATION TO MULTI-HOP QUESTION ANSWERING
105
+
106
+ This section describes how Transformer-XH applies to multi-hop QA. Given a question $q$ , the task is to find an answer span $a$ in a large open-domain document corpus, e.g. the first paragraph of all Wikipedia pages. By design, the questions are complex and often require information from multiple documents to answer. For example, in the case shown in Figure 1b, the correct answer “Cambridge” requires combining the information from both the Wikipedia pages “Facebook” and “Harvard University”. To apply Transformer-XH in the open domain multi-hop QA task, we first construct an evidence graph and then apply Transformer-XH on the graph to find the answer.
107
+
108
+ Evidence Graph Construction. The first step is to find the relevant candidate documents $D$ for the question $q$ and connect them with edges $E$ to form the graph $G$ . Our set $D$ consists of three sources. The first two sources are from canonical information retrieval and entity linking techniques:
109
+
110
+ $D _ { i r }$ : the top 100 documents retrieved by DrQA’s TF-IDF on the question (Chen et al., 2017).
111
+
112
+ $D _ { e l }$ : the Wikipedia documents associated with the entities that appear in the question, annotated by entity linking systems: TagMe (Ferragina & Scaiella, 2010) and CMNS (Hasibi et al., 2017).
113
+
114
+ For better retrieval quality, we use a BERT ranker (Nogueira & Cho, 2019) on the set $D _ { i r } \cup D _ { e l }$ and keep the top two ranked ones in $D _ { i r }$ and top one per question entity in $D _ { e l }$ . Then the third source $D _ { e x p }$ includes all documents connected to or from any top ranked documents via Wikipedia hyperlinks (e.g., “Facebook” “Harvard University”).
115
+
116
+ The final graph comprises all documents from the three sources as nodes $\mathcal { X }$ . The edge matrix $E$ is flexible. We experiment with various edge matrix settings, including directed edges along Wikipedia links, i.e. $e _ { i j } = 1$ if there is a hyperlink from document $i$ to $j$ , bidirectional edges along Wiki links, and fully-connected graphs, which rely on Transformer-XH to learns the edge importance.
117
+
118
+ Similar to previous work (Ding et al., 2019), the textual representation for each node in the graph is the [SEP]-delimited concatenation of the question, anchor text (the text in the hyperlink in parent nodes pointing to the child node), and the paragraph itself. More details on the evidence graph construction are in Appendix A.1.
119
+
120
+ Transformer-XH on Evidence Graph. Transformer-XH takes the input nodes $\mathcal { X }$ and edges $E$ , and produces the global representation of all text sequences:
121
+
122
+ $$
123
+ \mathcal { H } ^ { L } = \mathrm { T r a n s f o r m e r - X H } ( \mathcal { X } , E ) .
124
+ $$
125
+
126
+ Then we add two task-specific layers upon the last layer’s representation $\mathcal { H } ^ { L }$ : one auxiliary layer to predict the relevance score of the evidence node, and one layer to extract the answer span within it:
127
+
128
+ $$
129
+ \begin{array} { r l } & { p ( \mathrm { r e l e v a n c e } | \tau ) = \mathrm { s o f t m a x } ( \mathrm { L i n e a r } ( \tilde { h } _ { \tau , 0 } ^ { L } ) ) ; } \\ & { p ( \mathrm { s t a r t } | \tau , i ) , p ( \mathrm { e n d } | \tau , j ) = \mathrm { s o f t m a x } ( \mathrm { L i n e a r } ( \tilde { h } _ { \tau , i } ^ { L } ) ) , \mathrm { s o f t m a x } ( \mathrm { L i n e a r } ( \tilde { h } _ { \tau , j } ^ { L } ) ) . } \end{array}
130
+ $$
131
+
132
+ The final model is trained end-to-end with cross-entropy loss for both tasks in a multi-task setting. During inference, we first select the document with the highest relevance score, and then the start and end positions of the answer within that document.
133
+
134
+ # 4 APPLICATION TO FACT VERIFICATION
135
+
136
+ This section describes how Transformer-XH applies to the fact verification task in FEVER Thorne et al. (2018). Given a claim and a trustworthy background corpus, i.e. Wikipedia, the task is to verify whether the evidence in the corpus SUPPORTS, REFUTES, or there is NOT ENOUGH INFO to verify the claim. Similar to multi-hop QA, the first step is to construct an evidence graph using the text pieces in the background corpus and then Transformer-XH can be easily applied to conduct reasoning on these evidence pieces.
137
+
138
+ Evidence Graph Construction. Many previous FEVER systems first retrieve the evidence sentences for the claim and then reason verify it (Nie et al., 2019; Zhou et al., 2019). This first step is similar as the retrieval stage in Hotpot QA. And the second step is a multi-evidence reasoning task, where Transformer-XH is applied.
139
+
140
+ We keep the evidence sentence retrieval step consistent with previous methods. The sentence retrieval results of SR-MRS is not yet released at the time of our experiments, thus we instead use the BERT-based retrieval results from another contemporary work (Liu et al., 2019b).
141
+
142
+ We construct the evidence graph using the top five sentences from Liu et al. (2019b) as the nodes $\mathcal { X }$ and fully connected edges $E$ . Following Liu et al. (2019b), the representation of each node is the concatenation of the claim, the Wikipedia title (entity name) of the document that includes the sentence, and the evidence sentence.
143
+
144
+ Transformer-XH on Evidence Graph. Transformer-XH takes the evidence graph $\{ X , E \}$ and learns to verify the claim to three categories: $y \in \{ \mathrm { S U P P O R T }$ , REFUSE, NOT ENOUGH EVIDENCE}. Similar to the application in Hotpot QA, it first produces the global representation of the graph:
145
+
146
+ $$
147
+ \mathcal { H } ^ { L } = \mathrm { T r a n s f o r m e r - X H } ( \mathcal { X } , E ) .
148
+ $$
149
+
150
+ Then two task-specific layers are added upon the last layer. The first layer conducts the fact prediction per node using the “[CLS]” token:
151
+
152
+ $$
153
+ p ( y | \tau ) = \mathrm { s o f t m a x } ( \mathrm { L i n e a r } ( \tilde { h } _ { \tau , 0 } ^ { L } ) ) .
154
+ $$
155
+
156
+ The second layer learns to measure the importance of each node in the graph:
157
+
158
+ $$
159
+ p ( s | \tau ) = \mathrm { s o f t m a x } ( \mathrm { L i n e a r } ( \tilde { h } _ { \tau , 0 } ^ { L } ) ) ,
160
+ $$
161
+
162
+ The node level predictions and node importance are combined to the final prediction for the claim:
163
+
164
+ $$
165
+ p ( y | \mathcal { X } , E ) = \sum _ { \tau } p ( s | \tau ) \cdot p ( y | \tau ) .
166
+ $$
167
+
168
+ Similar to the Hotpot QA scenario, we use multi-task learning that combines the node prediction task and the claim verification task. The first task uses the evidence sentence label provided by FEVER and cross-entropy loss on Eqn. 15. The second task uses the final verification label with cross-entropy loss on Eqn. 16.
169
+
170
+ # 5 EXPERIMENTAL METHODOLOGIES
171
+
172
+ Our experiments are conducted on Hotpot QA, the multi-hop question answering benchmark Yang et al. (2018), and FEVER, the fact verfication benchmark Thorne et al. (2018).
173
+
174
+ # 5.1 MULTI-HOP QUESTION ANSWERING ON HOTPOT QA
175
+
176
+ Dataset. HotpotQA includes $1 1 2 \mathrm { k }$ crowd-sourced questions designed to require multiple pieces of textual evidence, which are the first paragraphs of Wikipedia pages. It has two type of questions: bridge question require hopping via an outside entity, and comparison question compare a property of two entities. There are two settings in HotpotQA. The Distractor setting provides golden evidence paragraphs together with TF-IDF retrieved negatives. The FullWiki setting requires systems to retrieve evidence paragraphs from the full set of Wikipedia articles.
177
+
178
+ We focus on FullWiki setting since previous research found that the negative documents in Distractor may be too weak and mitigate the need for multi-hop reasoning (Min et al., 2019b). There are 90k Train, 7k Dev and 7k Test questions. The ground truth answer and supporting evidence sentences in Train and Dev sets are provided. Test labels are hidden; only one submission is allowed to the leaderboard per $3 0 \mathrm { d a y s } ^ { 2 }$ . We evaluate our final model on Test and conduct ablations on Dev.
179
+
180
+ Metrics. We use official evaluation metrics of HotpotQA: exact match (EM) and F1 on answer (Ans), supporting facts (Supp), and the combination (Joint). The supporting facts prediction is an auxiliary task that evaluates model’s ability to find the evidence sentences. Joint EM is the product of the two EM result. Joint F1 first multiplies the precision and recall from Ans and Supp, then combines the Joint precision and recall to F1.
181
+
182
+ Baseline. The main baselines include Cognitive QA (CogQA, Ding et al. (2019)) and Semantic Retrieval MRS (SR-MRS, Nie et al. (2019)). CogQA uses several fine-tuned BERT machine reading comprehension (MRC) models to find hop entities and candidate spans, and then uses a BERT based Graph Convolution Network to rank the candidate spans. SR-MRS is a contemporary work and was the previous leaderboard rank one. It is a BERT based pipeline and uses fine-tuned BERT models to first rank the documents (twice), then to rank sentences to find supporting facts, and finally conducts BERT MRC on the concatenated evidence sentences.
183
+
184
+ We also re-implement $\mathrm { C o g Q A }$ and upgrade its IR with our BERT IR model (BERT on $D _ { i r } \cup D _ { e l }$ , same as Transformer-XH), for fair comparisons. We include other approaches on the FullWiki setting: Official Baseline (Yang et al., 2018), MUPPET (Feldman & El-Yaniv, 2019), QFE (Nishida et al., 2019), and DecompRC (Min et al., 2019a),
185
+
186
+ Implementation Details. The in-sequence attention and other standard Transformer components in Transformer-XH are initialized by the pre-trained BERT base model (Devlin et al., 2019). The extra hop attention parameters are initialized randomly and trained from scratch. The final model uses three hop steps. For bridge questions, we build the evidence graph described in Section 3. And for comparison questions, we build the fully-connected graph on the set $D _ { i r } \cup D _ { e l }$ and train Transformer-XH separately. We leave more implementation details in the Appendix.
187
+
188
+ # 5.2 FACT VERIFICATION ON FEVER
189
+
190
+ Dataset. The FEVER task provides a claim sentence and requires the system to classify it into three categories: SUPPORTS, REFUTES, and NOT ENOUGH INFO, using the Wikipedia corpus as the evidence source. It provides 185,455 claims with manual labels and uses the Wikipedia dump in June 2017 which includes 5.4 million documents.
191
+
192
+ Metrics. There are two official evaluation metrics in FEVER: Label Accuracy (LA), which evaluates the classification accuracy of the verification labels, and FEVER Score, which evaluates both the correctness of the evidence sentences used in verification and the LA. The latter is close to Joint EM in Hotpot QA and is the main metric. We use the official evaluation scripts from FEVER task and we refer to Thorne et al. (2018) for more details of this task.
193
+
194
+ Experimental Setups. We follow the experiment settings used by previous research in FEVER 1.0 shared task, i.e. Nie et al. (2019), Zhou et al. (2019), and Liu et al. (2019b). Similar as Liu et al. (2019b), we also split the data into single and multi evidence categories and evaluate TransformerXH on the two splits.
195
+
196
+ Table 1: Results $( \% )$ on HotpotQA FullWiki Setting. Dev results of previous methods are reported in their papers. Test results are from the leaderboard. Contemporary method is marked by ∗.
197
+
198
+ <table><tr><td rowspan="3"></td><td colspan="5">Dev</td><td colspan="5">Test</td></tr><tr><td colspan="2">Ans</td><td colspan="2">Supp</td><td colspan="2">Joint</td><td>Ans</td><td colspan="2">Supp</td><td colspan="2">Joint</td></tr><tr><td>EMF1</td><td></td><td>EMF1</td><td></td><td>EM F1</td><td>EM</td><td>F1</td><td>EMF1</td><td></td><td>EMF1</td></tr><tr><td>Official Baseline (Yang et al.,2018)</td><td>23.9 32.9</td><td></td><td>5.140.9</td><td></td><td>47.240.8</td><td>24.0 32.9</td><td></td><td>3.9</td><td>37.7</td><td>1.9 16.2</td></tr><tr><td>DecompRC (Min et al.,2019a)</td><td></td><td>43.3</td><td>1</td><td>1</td><td>-</td><td>30.0</td><td>40.7 -</td><td>1</td><td>-</td><td>-</td></tr><tr><td>QFE (Nishida et al., 2019)</td><td></td><td></td><td></td><td>=</td><td></td><td>28.7</td><td>38.1</td><td>14.2 44.4</td><td>8.7</td><td>23.1</td></tr><tr><td>MUPPET(Feldman &amp;El-Yaniv,2019)</td><td>31.1 40.4</td><td></td><td>17.0 47.7</td><td></td><td>11.8 27.6</td><td>30.6 40.3</td><td></td><td>16.7 47.3</td><td></td><td>10.9 27.0</td></tr><tr><td>CogQA (Ding et al., 2019)</td><td>37.6 49.4</td><td></td><td>23.1 58.5</td><td></td><td>12.2 35.3</td><td>37.1</td><td>48.9 22.8</td><td>57.7</td><td></td><td>12.4 34.9</td></tr><tr><td>SR-MRS* (Nie et al., 2019)</td><td>46.5</td><td>58.8</td><td>39.9</td><td>71.5</td><td>26.6 49.2</td><td>45.3 57.3</td><td>38.7</td><td>70.8</td><td>25.1</td><td>47.6</td></tr><tr><td>CogQA(w. BERT IR) [Ours]</td><td>44.8 57.7</td><td></td><td></td><td>29.262.8</td><td>18.543.4</td><td>1</td><td>- -</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Transformer-XH</td><td>54.0 66.2</td><td></td><td></td><td>41.7 72.1</td><td>27.7 52.9</td><td>51.6 64.1</td><td></td><td>40.9 71.4</td><td></td><td>26.1 51.3</td></tr></table>
199
+
200
+ <table><tr><td rowspan="3"></td><td colspan="4">Question Type</td><td colspan="4">Reasoning Type</td></tr><tr><td colspan="2">Comparison (1487)</td><td colspan="2">Bridge (5918)</td><td colspan="2">Single-Hop(3426)</td><td colspan="2">Multi-Hop (3979)</td></tr><tr><td>EM</td><td>F1</td><td>EM</td><td>F1</td><td>EM</td><td>F1</td><td>EM</td><td>F1</td></tr><tr><td>CogQA</td><td>43.3</td><td>51.1</td><td>36.1</td><td>49.0</td><td>45.1</td><td>61.1</td><td>31.1</td><td>39.4</td></tr><tr><td>SR-MRS*</td><td>62.0</td><td>68.9</td><td>42.4</td><td>56.1</td><td>52.3</td><td>68.4</td><td>41.3</td><td>50.3</td></tr><tr><td>CogQA (w. BERT IR)</td><td>54.1</td><td>60.9</td><td>42.4</td><td>56.9</td><td>52.0</td><td>69.3</td><td>38.6</td><td>47.8</td></tr><tr><td>Transformer-XH(w.BERT IR)</td><td>59.9</td><td>65.8</td><td>52.4</td><td>66.3</td><td>62.2</td><td>78.3</td><td>46.8</td><td>55.7</td></tr><tr><td>Transformer-XH(w. SR-MRS)</td><td>64.3</td><td>70.7</td><td>47.9</td><td>62.3</td><td>58.1</td><td>74.3</td><td>45.3</td><td>55.2</td></tr></table>
201
+
202
+ Table 2: Dev Ans $( \% )$ on different scenarios. Reasoning Types are estimated by Min et al. (2019b) via whether single-hop BERT has non-zero Ans F1. The numbers of questions are shown in brackets.
203
+
204
+ Baselines. The baselines include GEAR (Zhou et al., 2019) and two contemporary work, SRMRS (Nie et al., 2019) and KGAT (Liu et al., 2019b). SR-MRS uses similar adaptations as Transformer-XH from Hotpot QA to FEVER. GEAR is a graph attention network based approach specially designed for fact verification. KGAT further improves GEAR’s GAT by adding the kernel information, and is the previous STOA with BERT base. We also include the BERT Concat baseline Liu et al. (2019b) which concatenates the evidence sentences to a text sequence and applies BERT on it.
205
+
206
+ Implementation Details. We use the retrieval result from Liu et al. (2019b) and connect all sentences as a fully connected graph. We follow similar parameter settings as Hothot QA. We use pre-trained BERT base model to initialize the Transformer components. The extra hop attention parameters are initialized randomly and trained from scratch, and three hop steps are used. We train Transformer-XH for two epochs.
207
+
208
+ # 6 EVALUATION RESULTS
209
+
210
+ This section first presents the evaluation results on HotpotQA and FEVER. Then it conducts ablation studies, analyses, and case studies on HotpotQA to understand the effectiveness of Transformer-XH.
211
+
212
+ # 6.1 OVERALL RESULT
213
+
214
+ HotpotQA FullWiki results are presented in Table 1. Transformer-XH outperforms all previous methods by significant margins. Besides strong results, Transformer-XH’s ability to natively represent structured data leads to much simpler QA system. Previously, in order to utilize pre-trained BERT, Hotpot QA approaches adapted the multi-hop reasoning task to comprise multiple sub-tasks. For example, given the retrieved documents, CogQA (w. BERT IR) first leverages one BERT MRC model to find hop entities and then another BERT MRC to find candidate answer spans. After that, it ranks the candidate spans using a BERT based GAT, which is the only structure modeling step. In comparison, Transformer-XH is a unified model which directly represents structured texts and integrates BERT weights.
215
+
216
+ <table><tr><td rowspan="2"></td><td colspan="2">Dev</td><td colspan="2">Test</td><td colspan="2">Single Evidence</td><td colspan="2">Multi Evidence</td></tr><tr><td>LA</td><td>FEVER</td><td>LA</td><td>FEVER</td><td>LA</td><td>FEVER</td><td>LA</td><td>FEVER</td></tr><tr><td>BERT Concat (Liu et al., 2019b)</td><td>73.67</td><td>68.89</td><td>71.01</td><td>65.64</td><td>1</td><td>1</td><td>1</td><td>-</td></tr><tr><td>GEAR/GAT (Zhou et al.,2019)</td><td>74.84</td><td>70.69</td><td>71.60</td><td>67.10</td><td>79.79</td><td>77.42</td><td>66.12</td><td>38.21</td></tr><tr><td>SR-MRS* (Nie et al., 2019)</td><td>75.12</td><td>70.18</td><td>72.56</td><td>67.26</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>KGAT* (Liu et al.,2019b)</td><td>78.02</td><td>75.88</td><td>72.81</td><td>69.40</td><td>80.33</td><td>78.07</td><td>65.92</td><td>39.23</td></tr><tr><td>Transformer-XH</td><td>78.05</td><td>74.98</td><td>72.39</td><td>69.07</td><td>81.84</td><td>81.31</td><td>86.58</td><td>58.47</td></tr></table>
217
+
218
+ Table 3: FEVER Results. Contemporary work is marked by ∗. Single and Multi Evidence are results on Dev claims on which one or multiple sentences are labeled as evidence.
219
+
220
+ Table 2 further inspects model performances on the Dev set by question types and reasoning types. Transformer-XH significantly outperforms all baselines on bridge questions which require more multi-hop reasoning. And on the “multi-hop” questions, Transformer-XH has higher relative gains $3 9 \%$ over $\mathrm { C o g Q A }$ on EM) than the “single-hop” questions $( 2 7 \% )$ , demonstrating its stronger multihop reasoning capability. We further study this in Section 6.3.
221
+
222
+ To further investigate the reasoning ability of Transformer-XH, we replace our retrieval pipeline with the top retrieved documents from the SR-MRS pipeline. More specifically, we use the top retrieved documents from SR-MRS to construct Transformer-XH’s evidence graph while keeping all else constant. The resulting system, Transformer-XH (w. SR-MRS), outperforms SR-MRS’s multi-step BERT based reasoning on all metrics and question types. Transformer-XH’s effectiveness is robust with multiple IR systems.
223
+
224
+ FEVER fact verification results are shown in Table 3. Transformer-XH outperforms SR-MRS by 4 FEVER score on Dev and 1.8 on Test. It performs on par with KGAT. More importantly, Transformer-XH excels at verifying claims that require multiple pieces of evidence–outperforming the contemporary work KGAT by 20 FEVER scores on the multi-evidence claims, a $49 \%$ relative improvement. Compared to KGAT, Transformer-XH mainly loses on the ”not enough evidence” category which is neither single nor multi evidence. This is an artifact the FEVER task which our system is not specifically designed for.
225
+
226
+ This result also demonstrates Transformer-XH’s generality on tasks with multiple text inputs not in sequential formats. The only difference between Transformer-XH when applied on multi-hop QA and FEVER is the last (linear) task specific layer; it provides similar or better performances over contemporary approaches that were specifically designed for the fact verification task. Due to space constraints and the consistent effectiveness of Transformer-XH on the two applications, the rest experiments mainly used HotpotQA to analyze the behavior of Transformer-XH.
227
+
228
+ # 6.2 ABLATION STUDIES
229
+
230
+ Model Variations. We show the results of different model variations on the top left of Table 4. Single-Hop BERT uses BERT MRC model on each document individually, which significantly decreases the accuracy, confirming the importance of multi-hop reasoning in FullWiki setting (Min et al., 2019a). $G A T + B E R T$ first uses Graph Attention Network (Velickovi ˇ c et al., 2018) on the evi- ´ dence graph to predict the best node; then it uses BERT MRC on the best document. It is $10 \%$ worse than Transformer-XH since the MRC model has no access to the information from other documents. No Node Prediction eliminates the node prediction task and only trains on span prediction task; the accuracy difference shows node prediction task helps the model training.
231
+
232
+ Graph Structures. We show Transformer-XH’s performance with different graph structures on the bottom left of Table 4. Bidirectional Edges adds reverse edges along the hyperlinks; Fully Connected Graph connects all document pairs; Node Sequence randomly permutes the documents and connects them into a sequence to simulate the Transformer-XL setting. Both Bidirectional Links and Fully Connected Graph have comparable performance with the original graph structure. Transformer-XH is able to learn meaningful connections using its hop attentions and is less dependent on the pre-existing graph structural. The fully connected graph can be used if there is no strong edge patterns available in the task. However, the performance drops significantly on Node Sequence, showing that structured texts cannot be treated as a linear sequence which cuts off many connections.
233
+
234
+ Table 4: Ablation studies on the bridge questions on Dev answer accuracy $( \% )$ , including model components (top left), graph structures (bottom left), and hop steps (right). Transformer-XH’s full model uses three hop step and unidirectional Wiki link graph.
235
+
236
+ <table><tr><td rowspan="2">Model Ablation</td><td colspan="2">Dev Ans</td><td rowspan="2">Hop Steps</td><td colspan="2">Dev Ans</td></tr><tr><td>EM</td><td>F1</td><td>EM</td><td>F1</td></tr><tr><td>Single-Hop BERT MRC on Individual Documents</td><td>31.3</td><td>42.2</td><td>One Hop</td><td>50.3</td><td>64.6</td></tr><tr><td>GAT (Node Prediction) + BERT (MRC on Best Node)</td><td>48.9</td><td>61.9</td><td>Two Hops</td><td>51.6</td><td>66.4</td></tr><tr><td>No Node Prediction Multi-Task</td><td>43.2</td><td>55.3</td><td>Four Hops</td><td>51.4</td><td>66.1</td></tr><tr><td>Bidirectional Edges on Hyperlinks</td><td>50.6</td><td>65.0</td><td>Five Hops</td><td>50.6</td><td>64.7</td></tr><tr><td>Fully Connected Graph</td><td>51.0</td><td>65.5</td><td>Six Hops</td><td>50.1</td><td>64.2</td></tr><tr><td>Node Sequence (Bidirectional Transformer-XL)</td><td>14.1</td><td>20.7</td><td>Transformer-XH</td><td>52.4</td><td>66.3</td></tr></table>
237
+
238
+ ![](images/937abe87ea803a9f533d860bb7ad6f79103c7adf93ed6ab6fb080b78abf1871c.jpg)
239
+ Figure 2: Distributions of learned attention weights of three hops on three groups: From All (Node) (to) All, $\mathbf { A l l } $ (to) Ans (ground truth answer node), and Supp (nodes with the supporting facts) (to) Ans. X-axes are attention values scaled by number of nodes.
240
+
241
+ Hop Steps. Recall that a Transformer-XH layer with extra hop attention corresponds to one information propagation (hop) step in the graph. Thus Transformer-XH with last K layers conducts K-step attention hops in the graph. We show results with different K on the right side of Table 4. Transformer-XH reaches its peak performance with three hops (our full-model). This is expected as most Hotpot QA questions can be answered by two documents (Yang et al., 2018).
242
+
243
+ # 6.3 HOP ATTENTION ANALYSIS
244
+
245
+ This experiment analyzes the hop attentions using our full-model (three-hop) on the fully connected graph to study their behavior without pre-defined structure. Figure 2 plots the distributions of the learned hop attentions on the Dev set. It shows a strong shift away from the normal distribution with more hops. Transformer-XH learns to distinguish different nodes after multi-hop attention: the attention score becomes a bimodal distribution after three hops, ignoring some non-useful nodes. Transformer-XH also learns to focus on meaningful edges: the score is higher on the path Supp Ans than All $ .$ Ans. And the margin is larger as the hop step increases from one to three.
246
+
247
+ # 6.4 CASE STUDY
248
+
249
+ Table 5 lists two examples from Transformer-XH and CogQA (w. BERT IR). The first case has a clear evidence chain “2011/S/S” “Winner” “YG Entertainment”; both methods find the correct answer. However, the second case has too many distractors in the first document. Without additional clues from document 2, it is likely that the single-hop hop entity extraction component in CogQA (w. BERT IR) misses the correct answer document in its candidate sets; and the later structural reasoning component can not recover from this cascade error. In comparison, Transformer-XH finds the correct answer by combining the evidence with the hop attentions between the two evidence pieces. We leave more positive and negative cases in Appendix A.5.
250
+
251
+ Table 5: Examples of Transformer-XH and BERT pipeline results in Hotpot QA.
252
+
253
+ <table><tr><td rowspan="2">Q:2014 S/S is the debut album of a South Ko- rean boy group that was formed by who? Document 1: 2014 S/S is the debut album of South Korean group Winner. Document 2: Winner is a South Korean boy group formed in 2013 by YG Entertainment. Transformer-XH:YG Entertainment√ CogQA(w.BERTIR): YG Entertainment√</td><td>Q:Which man who presented 2022FIFA World Cup bid was born on October 22,1930? Document 1: 2022 FIFA World Cup bid was presented by Quentin Bryce and Elle Macpherson. Document 2:FrankLowy (born 22 October</td></tr><tr><td>Frank Lowy, Ben_Buckley, 1930),is an Australian-Israeli businessman and Chairman of Westfield Corporation. Transformer-XH:FrankLowy√ CogQA(w. BERT IR): Quentin Bryce X</td></tr></table>
254
+
255
+ # 7 RELATED WORK
256
+
257
+ HotpotQA’s FullWiki task is a combination of open-domain QA (Chen et al., 2017) and multi-hop QA (Yang et al., 2018): the questions are designed to require multiple pieces of evidence and these evidence pieces are documents to retrieve from Wikipedia. It is a challenging combination: The retrieved documents are inevitably noisy and include much stronger distractors than the TF-IDF retrieved documents in the Distractor setting (Min et al., 2019a; Jiang & Bansal, 2019).
258
+
259
+ Various solutions have been proposed for Hotpot QA (Min et al., 2019b; Feldman & El-Yaniv, 2019; Nishida et al., 2019). These solutions often use complicated pipelines to adapt the multi-hop task into a combination of single-hop tasks, in order to leverage the advantage of pre-trained models. For example, CogQA (Ding et al., 2019) uses two BERT based MRC model to find candidate spans and then another BERT initialized Graph Neural Network (GNN) to rank spans; SR-MRS (Nie et al., 2019) uses three BERT based rankers to find supporting sentences, and then another BERT MRC model on the concatenated sentences to get the answer span. Transformer-XH is a simpler model that directly represents and reasons with multiple pieces of evidence using extra hop attentions.
260
+
261
+ Fact verification is a natural language inference task while also requires retrieving (“open-domain”) and reasoning with multiple text pieces (“multi-evidence”) (Thorne et al., 2018; Nie et al., 2019; Liu et al., 2019b). Many recent FEVER systems leverage Graph Neural Networks to combine information from multiple text nodes, while each node text is represented by BERT encodings (Zhou et al., 2019; Liu et al., 2019b). Transformer-XH is a more unified solution that simply includes language modeling as part of its joint reasoning.
262
+
263
+ In addition to Transformer-XL (Dai et al., 2019), other work is proposed to improve the Transformer architecture on long text sequence. For example, T-DMCA (Liu et al., 2018) splits the sequence into blocks and then the attention merges different blocks. Sparse Transformer (Child et al., 2019) introduces the sparse factorizations of the attention matrix. Transformer-XH shares similar motivation and focuses on multiple pieces of text that are not in sequential forms.
264
+
265
+ Transformer-XH is also inspired by GNN (Kipf & Welling, 2017; Schlichtkrull et al., 2017; Velickovi ˇ c et al., 2018), which leverages neural networks to model graph structured data for down- ´ stream tasks (Sun et al., 2018; Zhao et al., 2020). The key difference is that a “node” in TransformerXH is a text sequence, and modeling of the structure is conducted jointly with the representation of the text. Transformer-XH combines the Transformer’s advantages in understanding text with the power that GNN has in modeling structure.
266
+
267
+ # 8 CONCLUSION
268
+
269
+ Transformer-XH and its eXtra Hop attention mechanism is a simple yet powerful adaptation of Transformer to learn better representations of structured text data as it naturally occurs. It innately integrates with pre-trained language models to allow for complex reasoning across multiple textual evidence pieces. When applied to HotpotQA, Transformer-XH significantly shrinks the typical multi-hop QA pipeline, eliminating many cascading errors that arise from the linear sequence input constraints of pre-trained Transformers. The same simplicity also applies to FEVER, with one Transformer-XH all we needed to obtain a much stronger answer accuracy. With its simplicity and efficacy, we envision Transformer-XH will benefit many applications in the near future.
270
+
271
+ # REFERENCES
272
+
273
+ Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading Wikipedia to Answer OpenDomain Questions. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pp. 1870–1879, 2017.
274
+
275
+ Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating Long Sequences with Sparse Transformers. arXiv preprint arXiv:1904.10509, 2019.
276
+
277
+ 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, pp. 2978–2988, 2019.
278
+
279
+ 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, pp. 4171–4186, 2019.
280
+
281
+ Ming Ding, Chang Zhou, Qibin Chen, Hongxia Yang, and Jie Tang. Cognitive Graph for Multi-Hop Reading Comprehension at Scale. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2694–2703, 2019.
282
+
283
+ Yair Feldman and Ran El-Yaniv. Multi-Hop Paragraph Retrieval for Open-Domain Question Answering. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2296–2309, 2019.
284
+
285
+ Paolo Ferragina and Ugo Scaiella. Tagme: On-the-fly Annotation of Short Text Fragments (by Wikipedia Entities). In Proceedings of the 19th ACM international conference on Information and knowledge management, pp. 1625–1628, 2010.
286
+
287
+ Faegheh Hasibi, Krisztian Balog, and Svein Erik Bratsberg. Entity Linking in Queries: Efficiency vs.Effectiveness. In European Conference on Information Retrieval, pp. 40–53, 2017.
288
+
289
+ Yichen Jiang and Mohit Bansal. Avoiding Reasoning Shortcuts: Adversarial Evaluation, Training, and Model Development for Multi-Hop QA. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2726–2736, 2019.
290
+
291
+ Thomas N Kipf and Max Welling. Semi-supervised Classification with Graph Convolutional Networks. In International Conference on Learning Representations, 2017.
292
+
293
+ Peter J Liu, Mohammad Saleh, Etienne Pot, Ben Goodrich, Ryan Sepassi, Lukasz Kaiser, and Noam Shazeer. Generating Wikipedia by Summarizing Long Sequences. In International Conference on Learning Representations, 2018.
294
+
295
+ 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, 2019a.
296
+
297
+ Zhenghao Liu, Chenyan Xiong, and Maosong Sun. Kernel Graph Attention Network for Fact Verification. arXiv preprint arXiv:1910.09796, 2019b.
298
+
299
+ Sewon Min, Eric Wallace, Sameer Singh, Matt Gardner, Hannaneh Hajishirzi, and Luke Zettlemoyer. Compositional Questions Do Not Necessitate Multi-hop Reasoning. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 4249–4257, 2019a.
300
+
301
+ Sewon Min, Victor Zhong, Luke Zettlemoyer, and Hannaneh Hajishirzi. Multi-hop Reading Comprehension through Question Decomposition and Rescoring. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 6097–6109, 2019b.
302
+
303
+ Yixin Nie, Songhe Wang, and Mohit Bansal. Revealing the Importance of Semantic Retrieval for Machine Reading at Scale. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, 2019.
304
+
305
+ Kosuke Nishida, Kyosuke Nishida, Masaaki Nagata, Atsushi Otsuka, Itsumi Saito, Hisako Asano, and Junji Tomita. Answering while Summarizing: Multi-task Learning for Multi-hop QA with Evidence Extraction. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2335–2345, 2019.
306
+
307
+ Rodrigo Nogueira and Kyunghyun Cho. Passage Re-ranking with BERT. arXiv preprint arXiv:1901.04085, 2019.
308
+
309
+ Michael Schlichtkrull, Thomas N Kipf, Peter Bloem, Rianne van den Berg, Ivan Titov, and Max Welling. Modeling Relational Data with Graph Convolutional Networks. arXiv preprint arXiv:1703.06103, 2017.
310
+
311
+ Haitian Sun, Bhuwan Dhingra, Manzil Zaheer, Kathryn Mazaitis, Ruslan Salakhutdinov, and William Cohen. Open domain question answering using early fusion of knowledge bases and text. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 4231–4242, 2018.
312
+
313
+ James Thorne, Andreas Vlachos, Oana Cocarascu, Christos Christodoulopoulos, and Arpit Mittal. The Fact Extraction and VERification (FEVER) Shared Task. In Proceedings of the First Workshop on Fact Extraction and VERification (FEVER), pp. 1–9, 2018.
314
+
315
+ 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.
316
+
317
+ Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph Attention Networks. In International Conference on Learning Representations, 2018.
318
+
319
+ Minjie Wang, Lingfan Yu, Da Zheng, Quan Gan, Yu Gai, Zihao Ye, Mufei Li, Jinjing Zhou, Qi Huang, Chao Ma, Ziyue Huang, Qipeng Guo, Hao Zhang, Haibin Lin, Junbo Zhao, Jinyang Li, Alexander J Smola, and Zheng Zhang. Deep Graph Library: Towards Efficient and Scalable Deep Learning on Graphs. In ICLR Workshop on Representation Learning on Graphs and Manifolds, 2019.
320
+
321
+ Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William W. Cohen, Ruslan Salakhutdinov, and Christopher D. Manning. HotpotQA: A Dataset for Diverse, Explainable Multi-hop Question Answering. In Proceedings of the Conference on Empirical Methods in Natural Language Processing, pp. 2369–2380, 2018.
322
+
323
+ Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. XLNet: Generalized Autoregressive Pretraining for Language Understanding. In Advances in Neural Information Processing Systems, pp. 5754–5764, 2019.
324
+
325
+ Chen Zhao, Chenyan Xiong, Xin Qian, and Jordan Boyd-Graber. Complex factoid question answering with a free-text knowledge graph. In The Web Conference, 2020.
326
+
327
+ Jie Zhou, Xu Han, Cheng Yang, Zhiyuan Liu, Lifeng Wang, Changcheng Li, and Maosong Sun. GEAR: Graph-based Evidence Aggregating and Reasoning for Fact Verification. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 892–901, 2019.
328
+
329
+ # A APPENDIX
330
+
331
+ The appendix includes details of the evidence graph construction for Hotpot QA, ablation studies in the BERT IR component, more details and results on Hotpot QA.
332
+
333
+ # A.1 HOTPOTQA EVIDENCE GRAPH CONSTRUCTION DETAILS
334
+
335
+ The evidence graph construction includes two stages. The first stage is BERT IR, which extract related documents directly from question. The second stage expands the related documents along Wikipedia links. The first is applied on all questions while the second is only required by Bridge questions.
336
+
337
+ The first stage uses two methods to find documents. The first method uses DrQA’s retrieval system (Chen et al., 2017), which is unsupervised TF-IDF. We keep the top $1 0 0 \ \mathrm { { D r Q A } }$ retrieved ones $D _ { i r }$ for each question. The second method uses TagMe (Ferragina & Scaiella, 2010) and CMNS (Hasibi et al., 2017), two commonly used entity linkers, to annotate questions. We keep the TagMe output entity and three highest scored entities per surface form (a phrase in the question linked with entities) from CMNS, and use its corresponding Wikipedia document as $D _ { e l }$ .
338
+
339
+ We use BERT ranker (Nogueira & Cho, 2019) to re-rank the initial set $D _ { i r } \cup D _ { e l }$ . The input to the BERT is the concatenation of question and first paragraph of document:
340
+
341
+ [CLS] Question [SEP] First Paragraph of Document.
342
+
343
+ Then a linear layer is added on the last layer’s [CLS] representation to score the relevance of the document. We use BERT base and fine-tune it using the relevance label (from supporting facts) with cross-entropy loss. The top two highest scored documents from $D _ { i r }$ and the top one document per entity position (surface form) in $D _ { e l }$ are kept as the first stage BERT IR documents.
344
+
345
+ The second stage expands the first stage BERT IR documents by Wikipedia hyperlinks to obtain $D _ { e x p }$ . A document is included if it is linked to or links to a document in the first stage. We use the same BERT ranker to rank $D _ { e x p }$ and keep the top 15 documents in $D _ { e x p }$ .
346
+
347
+ The final evidence graph nodes per question includes the top two highest ranked documents in $D _ { i r }$ top one per entity name in $D _ { e l }$ , and top 15 from the expanded documents $D _ { e x p }$ .
348
+
349
+ The comparison questions only require information from two question entities; thus when building the evidence graph we do not expand them (i.e. there is no $D _ { e x p , }$ ).
350
+
351
+ The retrieval pipeline is a multi-stage retrieval enhanced with entity linking. It is close to the retrieval system used in SR-MRS (Nie et al., 2019). When using SR-MRS retrieved documents for documents, we use top 10 documents on bridge questions and top two documents on comparison questions.
352
+
353
+ In the next section, we show that Transformer-XH is robust to different number of documents kept in the evidence graph and performs similarly using the documents retrieved from SR-MRS.
354
+
355
+ # A.2 ABLATION STUDIES ON DOCUMENT RETRIEVAL
356
+
357
+ This experiment studies the effectiveness and influence of different retrieval settings. We use different numbers of top K ranked documents from the BERT ranker, run Transformer-XH in the corresponding evidence graph, and evaluate its performance on Bridge questions in the Dev set. We also evaluate the Supporting facts Recall and Answer Recall. Supp Recall evaluates whether the document with the supporting fact is included in the first stage retrieved documents. Ans Recall evaluates whether their exists a document in the evidence graph that includes the ground truth answer. The results are in Table 6.
358
+
359
+ Our BERT IR system performs better than CogQA’s TF-IDF and on par with SR-MRS, as expected. The latter uses a similar retrieval pipeline with our BERT IR system; Transformer-XH is robust on different retrieval settings and keeps its effectiveness when applied on Top 10 documents from SR-MRS (including both stages).
360
+
361
+ <table><tr><td>Method</td><td>Supp Recall</td><td>Ans Recall</td><td>Dev AnsEM</td><td>Dev Ans F1</td></tr><tr><td>Top 10 TFIDF (CogQA)</td><td>70.8</td><td>n.a.</td><td>1</td><td>1</td></tr><tr><td>Top 2 w. BERT IR + Q Entites</td><td>72.3</td><td>88.1</td><td>48.7</td><td>62.6</td></tr><tr><td>Top 5 w. BERT IR +QEntites</td><td>76.5</td><td>89.6</td><td>47.1</td><td>60.8</td></tr><tr><td>Top 10 w.BERTIR+Q Entites</td><td>78.9</td><td>91.1</td><td>46.6</td><td>60.3</td></tr><tr><td>SR-MRS Top 10 (All Together)</td><td>n.a.</td><td>86.1</td><td>47.9</td><td>62.3</td></tr></table>
362
+
363
+ Table 6: Ablation study on the retrieval systems. Top-10 TFIDF is the one used by $\mathrm { C o g Q A }$ (Ding et al., 2019). BERT IR is the retrieval system used by $\mathrm { C o g Q A }$ (w. BERT IR) and Transformer-XH. Top K refers to using the 2/5/10 highest ranked documents from the BERT ranker in the first stage. SR-MRS Top 10 uses the 10 retrieved documents per question provided by Nie et al. (2019). All retrieval methods include entities linked in the question and are expanded along Wiki links, except when evaluating the 1st stage Supp Recall.
364
+
365
+ # A.3 OTHER HOTPOT QA COMPONENTS
366
+
367
+ This section describes the other components for HotpotQA dataset. The whole QA system starts with question type classification. We train transformer-XH separately on each type of questions over their evidence graph. Besides answer prediction, we also adopt BERT based model for predicting supporting sentences.
368
+
369
+ # A.3.1 QUESTION CLASSIFICATION
370
+
371
+ The first component of our system is to classify the question to bridge and comparison types. We adopt BERT classification fine-tuning setting on HotpotQA questions using the question type labels provided in HotpotQA. The classifier achieves $9 9 . 1 \%$ accuracy on the dev set. We use the classifier to split the questions into Comparison and Bridge.
372
+
373
+ # A.3.2 SUPPORTING FACTS CLASSIFICATION
374
+
375
+ The supporting facts prediction task is to extract all sentences that help get the answer. For bridge question, these sentences usually cover different pieces of questions. And for comparison questions, the supporting facts are the properties of two question entities. We design one model architecture for this task, but we train two models on each type to reflect the inherent difference.
376
+
377
+ We use BERT as our base model and on top of BERT, we conduct multi-task learning scheme. The first task is document relevance prediction, similar as Transformer-XH, we add a linear layer on the [CLS] token of BERT to predict the relevance score. The other task is sentence binary classification, we concatenate the first and last token representation of each sentence in the document through a linear layer, the binary output decides whether this sentence is supporting sentence.
378
+
379
+ Bridge question supporting facts prediction For bridge questions, we predict supporting facts after answer prediction from Transformer-XH to resume the inference chain. We start by predicting supporting facts in the answer document. The other document is chosen from the parents of the answer document in the evidence graph. 3. Compare with the contemporary model Nie et al. (2019), which does not limit the search space along the inference chain (i.e., the answer document may not be relevant to the other supporting page), our method more naturally fits the task purpose.
380
+
381
+ Comparison question supporting facts prediction For comparison questions, after extracting the first step documents $D$ , we simply run this supporting facts prediction model to select the top-2 documents, and predict the corresponding supporting facts.
382
+
383
+ # A.3.3 TRAINING DETAILS
384
+
385
+ We use DGL (Wang et al., 2019) for implementing Transformer-XH and CogQA (w. BERT IR) with batch size 1 (i.e., one graph for each batch), and keep the other parameters same as default BERT setting. We train Transformer-XH separately on two different types of questions, following previous
386
+
387
+ Table 7: Additional examples for model prediction on HotpotQA dataset, the first example is the correct prediction $( + )$ , the other two examples are the wrong predictions (-).
388
+
389
+ <table><tr><td>id</td><td>Example</td><td>Explanation</td></tr><tr><td>1(+)</td><td>Q:In which year was the King who made the 1925 Birthday Honours born? P: 1865√ Document 1: The 1925 Birthday Honours were ap- pointments by King George V to various orders and honours. Document 2: GeorgeV (3 June 1865- 20 January 1936)was King of the United Kingdom.</td><td>Withnecessary evidenceavailable, Transformer-XH conducts multi-hop reasoning,and extracts the correct span.</td></tr><tr><td>2(-)</td><td>Q:Where was the world cup hosted that Algeria quali- fied for the first time into the round of 16? A:Brazil P: Spain X Document 1 (Algeria at the FIFA World Cup):In 2014,Algeria qualified for the first time into the round of 16. Document 2 (2014 FIFA CUP): It took place in Brazil from 12 June to 13 July 2O14,after the country was awarded the hosting rights in 2007.</td><td>Transformer-XH does not predict the correct answer, since document 1 does not link to any other docu- ments.Thus,the information does not propagate to the correct answer docu- ment 2014 FIFA CUP.</td></tr><tr><td>3(-)</td><td>Q:What government position was held by the woman who portrayed Corliss Archer in the film Kiss and Tell? A:Chief of ProtocolP:ambassador X Document 1: Kiss and Tell is a 1945 American comedy film starring then 17-year-old Shirley Temple as Corliss Archer. Document 2:As an adult, Shirley Temple was named United States ambassador to Ghana and to Czechoslo- vakia,and also servedas Chief ofProtocol of theUnited States.</td><td>Transformer-XH predicts the correct answer document Shirley Temple. However it could not distinguish from the wrong answer ambassador which she was named but not held that position.</td></tr></table>
390
+
391
+ research (Ding et al., 2019). We train Transformer-XH and the GNN of CogQA (w. BERT IR) for 2 epochs. All other BERT based models use the default BERT parameters and train the model for 1 epoch.
392
+
393
+ # A.4 IMPLEMENTATION DETAILS OF COGQA (W. BERT IR)
394
+
395
+ This section discusses our implementation of CogQA (W. BERT IR). We start with the same documents from BERT IR, the one used by Transformer-XH, and then implement the following steps:
396
+
397
+ # A.4.1 HOP ENTITY EXTRACTION
398
+
399
+ For each document from the previous step, we run BERT MRC model and limit the span candidates as hyperlinked entities for hop entity extraction (e.g., in Figure 1, “Harvard University” is a hop entity). Following Ding et al. (2019), we predict the top three entities that above the relative threshold that is the start span probability of [CLS] position.
400
+
401
+ # A.4.2 ANSWER SPAN EXTRACTION
402
+
403
+ For each document (add the hop entity document), following Ding et al. (2019), we run BERT MRC model to extract spans (e.g., “Combridge” in Figure 1.). We predict the top one span that above the threshold that is the start span probability of [CLS] position.
404
+
405
+ We train both hop entity extraction and span extraction tasks with same BERT model but different prediction layers. For each training example, we extract the link between two given supporting pages. The page includes the link (e.g., “Harvard University” in Figure 1.) is the supporting page
406
+
407
+ for hop entity extraction, while the other page is the answer page (e.g., “Combridge” in Figure 1.) for answer span extraction.
408
+
409
+ # A.4.3 GAT MODELING
410
+
411
+ All the entities and answer spans form the final graph. The nodes are the entities and spans, and edges are the connections from the entities to the extracted hop entities or spans.
412
+
413
+ We use BERT for each node representation with question, anchor sentences and context, following Ding et al. (2019). We run GAT (Velickovi ˇ c et al., 2018) on top of BERT to predict the correct ´ answer span node.
414
+
415
+ # A.4.4 COMPARISON QUESTIONS
416
+
417
+ After predicting supporting facts, we concatenate the sentences and follow Min et al. (2019b) to run a BERT MRC model to predict either span or yes/no as the answer.
418
+
419
+ # A.5 ADDITIONAL CASE STUDY
420
+
421
+ We provide addition case studies in Table 7. The first case can be directly predicted through the clear evidence chain ”the 1925 Birthday Honours” ”George $\mathrm { V } ^ { \prime \prime } ^ { \prime \prime } 1 8 6 5 ^ { \prime \prime }$ . In the second case, the first document (”Algeria at the FIFA World Cup”) has no link to any other documents, therefore the model can not access the correct answer. The third case is more reading comprehension oriented, where the model can not distinguish the correct and wrong spans inside one sentence.
md/train/rJgBd2NYPH/rJgBd2NYPH.md ADDED
@@ -0,0 +1,370 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING DEEP GRAPH MATCHING VIA CHANNELINDEPENDENT EMBEDDING AND HUNGARIAN ATTENTION
2
+
3
+ Tianshu $\mathbf { V } \mathbf { u } ^ { \dagger }$ , Runzhong Wang‡, Junchi Yan‡, Baoxin Li†
4
+
5
+ †Arizona State University
6
+ ‡Shanghai Jiao Tong University
7
+ {tianshuy,baoxin.li}@asu.edu
8
+ {runzhong.wang,yanjunchi}@sjtu.edu.cn
9
+
10
+ # ABSTRACT
11
+
12
+ Graph matching aims to establishing node-wise correspondence between two graphs, which is a classic combinatorial problem and in general NP-complete. Until very recently, deep graph matching methods start to resort to deep networks to achieve unprecedented matching accuracy. Along this direction, this paper makes two complementary contributions which can also be reused as plugin in existing works: i) a novel node and edge embedding strategy which stimulates the multihead strategy in attention models and allows the information in each channel to be merged independently. In contrast, only node embedding is accounted in previous works; ii) a general masking mechanism over the loss function is devised to improve the smoothness of objective learning for graph matching. Using Hungarian algorithm, it dynamically constructs a structured and sparsely connected layer, taking into account the most contributing matching pairs as hard attention. Our approach performs competitively, and can also improve state-of-the-art methods as plugin, regarding with matching accuracy on three public benchmarks.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Without loss of generality, we consider the bijection problem for graph matching: given graph $\mathcal { G } _ { 1 }$ and $\mathcal { G } _ { 2 }$ of equal size $n$ , graph matching seeks to find the one-vs-one node correspondence1:
17
+
18
+ $$
19
+ \operatorname* { m a x } _ { \mathbf { x } } \mathbf { x } ^ { \top } \mathbf { K } \mathbf { x } \qquad \mathrm { s . t . } \quad \mathbf { P } \mathbf { x } = \mathbf { 1 }
20
+ $$
21
+
22
+ where $\mathbf { x } = \mathrm { v e c } ( \mathbf { X } ) \in \{ 0 , 1 \} ^ { n ^ { 2 } }$ which is the column-wise vectorized form of the permutation ma$\mathbf { X }$ $\mathbf { \bar { K } } \in \mathcal { R } _ { + } ^ { n ^ { 2 } \times n ^ { 2 } }$ is the so-called affinity matrix2, respectively. Note $\mathbf { P }$ is a selection matrix encoding the one-to-one correspondence constraint. This problem is called Lawler’s QAP (Lawler, 1963) and has attracted enormous attention for its generally NP-complete (Hartmanis, 1982) challenge, as well as a wide spectrum of applications in computer vision, graphics, machine learning and operational research etc. In particular, Koopmans-Beckmann’s QAP (Loiola et al., 2007) with objective $\operatorname { t r } ( \mathbf { X } ^ { \top } \mathbf { F } _ { 1 } \mathbf { X } \mathbf { F } _ { 2 } )$ is a special case of Eq. (1), which can be converted to Lawler’s QAP by $\mathbf { K } = \mathbf { F } _ { 2 } \otimes \mathbf { F } _ { 1 }$ and $\mathbf { F } _ { i }$ refers to the weighted adjacency matrix. A series of solvers haven been developed to solve graph matching problem (Leordeanu & Hebert, 2005; Cho et al., 2010; Bernard et al., 2018; Yan et al., 2015; Yu et al., 2018). All these methods are based on deterministic optimization, which are conditioned with pre-defined affinity matrix and no learning paradigm is involved. This fact greatly limits the performance and broad application w.r.t. different problem settings considering its NP-hard nature.
23
+
24
+ Recently, the seminal work namely deep graph matching (DGM) (Zanfir & Sminchisescu, 2018) is proposed to exploit the high capacity of deep networks for graph matching, which achieves stateof-the-art performance. This is in contrast to some early works which incorporate learning strategy separately in local stages (Caetano et al., 2009; Cho et al., 2013). On the other hand, Graph Convolutional Networks (GCN) (Kipf & Welling, 2017) brings about new capability on tasks over graph-like data, as it naturally integrates the intrinsic graph structure in a general updating rule:
25
+
26
+ $$
27
+ \mathbf { H } ^ { ( l + 1 ) } = \sigma \left( \hat { \mathbf { A } } \mathbf { H } ^ { ( l ) } \mathbf { W } ^ { ( l ) } \right)
28
+ $$
29
+
30
+ where $\hat { \bf A }$ is the normalized connectivity matrix. $\mathbf { H } ^ { ( l ) }$ and $\mathbf { W } ^ { ( l ) }$ are the features and weights at layer $l$ , respectively. Node embedding is updated by aggregation from 1-neighboring nodes, which is akin to the convolution operator in CNN. By taking advantages of both DGM and GCN, Wang et al. (2019) and Zhang & Lee (2019) incorporate permutation loss instead of displacement loss in (Zanfir & Sminchisescu, 2018), with notable improvement across both synthetic and real data.
31
+
32
+ Note that Eq. (1) involves both node and edge information, which exactly correspond to the diagonal and off-diagonal elements in $\mathbf { K }$ , respectively. Edges can carry informative multi-dimensional attributes (namely weights) which are fundamental to graph matching. However existing embedding based graph matching methods (Wang et al., 2019; Xu et al., 2019) are focused on the explicit modeling of node level features, whereby the edges are only used as topological node connection for message passing in GCN. Besides, edge attributes are neither well modeled in the embedding-free model (Zanfir & Sminchisescu, 2018) since the edge information is derived from the concatenation of node features. To our best knowledge, there is no deep graph matching method explicitly incorporating edge attributes. In contrast, edge attributes e.g. length and orientation are widely used in traditional graph matching models (Cho et al., 2010; Yan et al., 2015; Yu et al., 2018) for constructing the affinity matrix K. Such a gap shall be filled in the deep graph matching pipeline.
33
+
34
+ Another important consideration refers to the design of loss function. There are mainly two forms in existing deep graph matching works: i) displacement loss (Zanfir & Sminchisescu, 2018) similar to the use in optical flow estimation (Ren et al., 2017); ii) the so-called permutation loss (Wang et al., 2019) involving iterative Sinkhorn procedure followed by a cross-entropy loss. Results in (Wang et al., 2019) show the latter is an effective improvement against the former regression based loss. However, we argue that the continuous Sinkhorn procedure (in training stage) is yet an unnatural approximation to Hungarian sampling (in testing stage) for discretization. If the network is equipped with a continuous loss function (e.g. cross-entropy), we argue that the training process will make a great “meaningless effort” to enforce some network output digits of the final matching matrix into binary and neglect the resting digits which might have notable impact on accuracy.
35
+
36
+ This paper strikes an endeavor on the above two gaps and makes the following main contributions:
37
+
38
+ i) We propose a new approach for edge embedding via channel-wise operation, namely channelindependent embedding (CIE). The hope is to effectively explore the edge attribute and simulate the multi-head strategy in attention models (Velickovi ˇ c et al., 2018) by decoupling the calculations ´ parallel and orthogonal to channel direction. In fact, edge attribute information has not been considered in existing embedding based graph matching methods (Wang et al., 2019; Xu et al., 2019).
39
+
40
+ ii) We devise a new mechanism to adjust the loss function based on the Hungarian method which is widely used for linear assignment problem, as termed by Hungarian attention. It resorts to dynamically generating sparse matching mask according to Hungarian sampling during training, rather than approximating Hungarian sampling with a differentiable function. As such, the Hungarian attention introduces higher smoothness against traditional loss functions to ease the training.
41
+
42
+ iii) The empirical results on three public benchmarks shows that the two proposed techniques are orthogonal and beneficial to existing techniques. Specifically, on the one hand, our CIE module can effectively boost the accuracy by exploring the edge attributes which otherwise are not considered in state-of-the-art deep graph matching methods; on the other hand, our Hungarian attention mechanism also shows generality and it is complementary to existing graph matching loss.
43
+
44
+ # 2 RELATED WORKS
45
+
46
+ Graph embedding. To handle graph-like data, early works adopt recursive neural networks (RNNs) treating input as directed acyclic graphs (Sperduti & Starita, 1997; Frasconi et al., 1998). Gori et al. (2005); Scarselli et al. (2008) generalized early models to graph neural networks (GNNs) so as to be directly applied on cyclic, directed or undirected graphs. Li et al. (2016) further improved this line of model by replacing standard RNNs with gated recurrent units (GRUs) (Cho et al., 2013). Inspired by the great success of convolutional neural networks (CNNs) (Simonyan & Zisserman, 2014; He et al., 2016), researchers have made tremendous effort on applying convolution operator to graphs (Bruna et al., 2014; Kipf & Welling, 2017; Gong & Cheng, 2019). Bruna et al. (2014) defined a convolution operator in Fourier domain which is obtained by performing eigen-decomposition on graph Laplacian. However, such convolution will affect the whole spatial domain once taking inverse Fourier transformation. This method was improved by Chebyshev expansion to approximate filters (Defferrard et al., 2016). Kipf & Welling (2017) propose a graph convolutional operator over 1-neighbor nodes derived from graph spectral theory, which is invariant to node permutation and achieved significant performance on semi-supervised learning tasks. There are series of works following GCN, such as GraphSAGE (Hamilton et al., 2017), GAT (Velickovi ˇ c et al., 2018) and ´ MPNN (Gilmer et al., 2017). Refer to (Cai et al., 2018) for a more comprehensive survey.
47
+
48
+ While the aforementioned models are focused on learning node state/embedding, a parallel line of work seek to learn edge embedding by taking into account the information carried on edges (Li et al., 2016; Gilmer et al., 2017; Gong & Cheng, 2019). Edges are intrinsic portion of graphs, and thus edge embedding can be essential to reveal the relation among nodes. Gilmer et al. (2017) introduce a general embedding network incorporating edge information and node-edge information merging, and a serious of works fall into this framework e.g. Gated GNN (Li et al., 2016), Tensor GNN (Schutt et al., 2017) and EGNN (Gong & Cheng, 2019). An improved version is devised in Chen ¨ et al. (2019) by interpreting this framework as maximizing mutual information across layers.
49
+
50
+ Loss for combinatorial learning. For the relatively easy linear assignment problem, it has been known that Sinkhorn algorithm (Sinkhorn, 1964) is the approximate and differentiable version of Hungarian algorithm (Mena et al., 2017). The Sinkhorn Network (Adams & Zemel, 2011) is developed given known assignment cost, whereby doubly-stochastic regulation is performed on input non-negative square matrix. Patrini et al. (2018) devise the Sinkhorn AutoEncoder to minimize Wasserstein distance, and Emami & Ranka (2018) propose to learning a linear assignment solver via reinforcement learning. For permutation prediction, DeepPermNet (Santa Cruz et al., 2018) adopts the Sinkhorn layer on top of a deep convolutional network. However this method cannot be directly applied for graph matching as it is not invariant to input permutations which is conditioned on a predefined node permutation as reference. In particular, existing supervised methods on combinatorial learning are generally cross-entropy-based. Pointer Net (Vinyals et al., 2015) incorporates cross-entropy loss on learning heuristics for combinatorial problems. Milan et al. (2017) propose an objective-based loss, where the gradients are only updated if the objective improves after update.
51
+
52
+ Learning for graph matching. The early effort (Caetano et al., 2009) aims to incorporate learning to graph matching. The key is to learn a more effective affinity function with given correspondence as supervision. While the ability by only learning affinity is limited, Cho et al. (2013) propose a matching function learning paradigm using histogram-based attributes with Structured-SVM (Tsochantaridis et al., 2005). A recent work (Zanfir & Sminchisescu, 2018) is a breakthrough to introduce deep learning paradigm into graph matching task, which utilizes a neural network to learn the affinity function. The learning procedure is explicitly derived from the factorization of affinity matrix (Zhou & De la Torre, 2012), which makes the interpretation of the network behavior possible. However, the displacement loss in (Zanfir & Sminchisescu, 2018) measures the pixel-wise translation which is similar to optical-flow (Dosovitskiy et al., 2015), being essentially a regression task instead of combinaotiral optimization. Seeing this limitation, Wang et al. (2019) employ elementwise binary cross-entropy, termed as permutation loss. This loss has proved capable of capturing the combinatorial nature rather than pixel offset, and achieves improvement over displacement loss. Node embedding is also used in (Wang et al., 2019) to explore the structure information.
53
+
54
+ # 3 THE PROPOSED LEARNING APPROACH FOR GRAPH MATCHING
55
+
56
+ # 3.1 APPROACH OVERVIEW
57
+
58
+ An overall structure of our approach is illustrated in Fig. 1. In line with (Wang et al., 2019), we employ VGG16 (Simonyan & Zisserman, 2014) to extract features from input images and bi-linearly interpolate the features at key points (provided by datasets). We concatenate lower-level (Relu4 2) and higher-level (Relu5 1) features to incorporate local and contextual information. For an image with $k$ key points, the feature is denoted as $\mathbf { \bar { H } } \in \mathcal { R } ^ { k \times d }$ , where $d$ is the feature dimension. Unless otherwise specified, the adjacency matrix $\mathbf { A } \in \mathcal { R } ^ { k \times k }$ is consequentially constructed via Delaunay triangulation (Delaunay et al., 1934), which is a widely adopted strategy to produce sparsely connected graph. To introduce more rich edge information, we also generate $k \times k m$ -dimensional edge features $\dot { \mathbf { E } } \in \mathcal { R } ^ { m \times k \times k }$ . $E$ can be initialized with some basic edge information (e.g. length and angle and other attributes) or a commutative function $\mathbf E _ { i j } = p ( \mathbf H _ { i } , \mathbf H _ { j } ) = p ( \mathbf H _ { j } , \mathbf H _ { i } ) \in \mathcal { R } ^ { m }$ , where $\mathbf { H } _ { i }$ refers to the feature of node $i$ . Note for directed graph, the commutative property is not required.
59
+
60
+ ![](images/267255b09253042737ddb258c97d1928c580274268e1a0f652999670954f3306.jpg)
61
+ Figure 1: Architecture overview of the proposed deep graph matching networks that consist of the proposed channel-independent embedding and Hungarian attention layer over the loss function.
62
+
63
+ The features $\mathbf { H }$ and $\mathbf { E }$ , together with the adjacency A, are then fed into GNN module. Pairs of features are processed in a Siamese fashion (Bromley et al., 1994). Standard GCN’s message passing rule simply updates node embedding as shown in Eq. (2). In contrast, each GNN layer in our model computes a new pair of node and edge embeddings simultaneously:
64
+
65
+ $$
66
+ \mathbf { H } ^ { ( l + 1 ) } = f _ { i } ( \mathbf { H } ^ { ( l ) } , \mathbf { E } ^ { ( l ) } , \mathbf { A } ; W _ { 0 } ^ { l } ) , \quad \mathbf { E } ^ { ( l + 1 ) } = g ( \mathbf { H } ^ { ( l ) } , \mathbf { E } ^ { ( l ) } , \mathbf { A } ; W _ { 1 } ^ { l } )
67
+ $$
68
+
69
+ where $W _ { 0 } ^ { l }$ and $W _ { 1 } ^ { l }$ are the learnable parameters at layer $l$ . The edge information is essential to provide structural feature enhancing graph matching. We initialize $\mathbf { H } ^ { ( 0 ) } = \mathbf { H }$ and $\mathbf { E } ^ { ( 0 ) } = \mathbf { E }$ in our setting. We will discuss the details of functions $f$ and $g$ in Sec. 3.2. Following state-of-the-art work (Wang et al., 2019), we also compute the cross-graph affinity followed by a column/row-wise softmax activation and a Sinkhorn layer (Adams & Zemel, 2011):
70
+
71
+ $$
72
+ \mathbf { M } _ { i j } = \exp \left( \tau \mathbf { H } _ { ( 1 ) i } ^ { \top } \boldsymbol { \Lambda } \mathbf { H } _ { ( 2 ) j } \right) , \quad \mathbf { S } = \mathrm { S i n k h o r n } ( \mathbf { M } )
73
+ $$
74
+
75
+ Note here $\mathbf { M } \in \mathbb { R } ^ { k \times k }$ is the node-level similarity matrix encoding similarity between two graphs, differing from the edege-level affinity matrix $\mathbf { K }$ in Eq. 1. $\tau$ is the weighting parameter of similarity, $\pmb { \Lambda }$ contains learnable parameters and ${ \bf H } _ { ( 1 ) i }$ is the node $i$ ’s embedding from graph $\mathcal { G } _ { 1 }$ . The output $\mathbf { S } \in [ 0 , 1 ] ^ { k \times k } , \mathbf { S 1 } = \mathbf { 1 } , \mathbf { S } ^ { \top } \mathbf { 1 } = \mathbf { 1 }$ is a so-called doubly-stochastic matrix. Here Sinkhorn $( \cdot )$ denotes the following update iteratively to project $\mathbf { M }$ into doubly stochastic polygon:
76
+
77
+ $$
78
+ \mathbf { M } ^ { ( t + 1 ) } = \mathbf { M } ^ { ( t ) } - \frac { 1 } { n } \mathbf { M } ^ { ( t ) } \mathbf { 1 } \mathbf { 1 } ^ { \top } - \frac { 1 } { n } \mathbf { 1 } \mathbf { 1 } ^ { \top } \mathbf { M } ^ { ( t ) } + \frac { 1 } { n ^ { 2 } } \mathbf { 1 } \mathbf { 1 } ^ { \top } \mathbf { M } ^ { ( t ) } \mathbf { 1 } \mathbf { 1 } ^ { \top } - \frac { 1 } { n } \mathbf { 1 } \mathbf { 1 } ^ { \top }
79
+ $$
80
+
81
+ The Sinkhorn layer is shown to be an approximation of Hungarian algorithm which produces discrete matching output (Kuhn, 1955). As there are only matrix multiplication and normalization operators involved in Sinkhorn layer, it is differentiable. In practice, Eq. (5) converges rapidly within 10 iterations for decades of nodes. Less iterations involved, more precise back-propagated gradients can be achieved. We employ a cross-graph node embedding strategy following (Wang et al., 2019):
82
+
83
+ $$
84
+ \mathbf { H } _ { ( 1 ) } ^ { ( l ) } = f _ { c } \left( \mathrm { c a t } ( \mathbf { H } _ { ( 1 ) } ^ { ( l ) } , \mathbf { S } \mathbf { H } _ { ( 2 ) } ^ { ( l ) } ) \right) , \quad \mathbf { H } _ { ( 2 ) } ^ { ( l ) } = f _ { c } \left( \mathrm { c a t } ( \mathbf { H } _ { ( 2 ) } ^ { ( l ) } , \mathbf { S } ^ { \top } \mathbf { H } _ { ( 2 ) } ^ { ( l ) } ) \right)
85
+ $$
86
+
87
+ where $f _ { c }$ is a network and $\cot ( \cdot , \cdot )$ is the concatenation operator. $\mathbf { H } _ { ( i ) }$ is the node feature of graph $i$ . This procedure seeks to merge similar features from another graph into the node feature in current graph. It is similar to the feature transfer strategy in (Aberman et al., 2018) for sparse correspondence, which employs a feature merging method analogous to style transfer (Li et al., 2017).
88
+
89
+ As Sinkhorn layer does not necessarily output binary digits, we employ Hungarian algorithm (Kuhn, 1955) to discretize matching output S in testing. The testing differs from the training due to the Hungarian discretization. We introduce a novel attention-like mechanism termed as Hungarian attention, along with existing loss functions (will be detailed in Sec. 3.3). The final training loss is as follows, where ${ \bf S } ^ { \mathrm { G } }$ and $\mathcal { H }$ correspond to binary true matching and Hungarian attention loss.
90
+
91
+ $$
92
+ \operatorname* { m i n } \mathcal { H } ( \mathbf { S } , \mathbf { S } ^ { \mathrm { G } } )
93
+ $$
94
+
95
+ ![](images/301dc06ba29ec62523c5784b4b59304b6998228650416da031d678be87b81dcf.jpg)
96
+ Figure 2: Illustration of the proposed CIE layer for embedding based deep graph matching. The operation “Linear” refers to the linear mapping, e.g. $\mathbf { H } _ { w } ^ { ( l ) } \to \bar { \mathbf { W } _ { 2 } ^ { ( l ) } } \mathbf { H } _ { w } ^ { ( l ) }$ in Eq (9).
97
+
98
+ # 3.2 CHANNEL-INDEPENDENT EMBEDDING
99
+
100
+ We detail the updating rule in Eq. (3). We propose a method to merge edge features into node features and perform matching on nodes. Edge information acts an important role in modeling relational data, whereby such relation can be complex thus should be encoded with high-dimensional feature. To this end, Gilmer et al. (2017) introduce a general embedding layer, which takes node and edge features and outputs a message to node $v$ , then fuses the message and the current embedding:
101
+
102
+ $$
103
+ \mathbf { m } _ { v } ^ { ( l ) } = \sigma \left( \sum _ { w \in \mathcal { N } _ { v } } f _ { t } \left( \mathbf { E } _ { v w } \right) \mathbf { H } _ { w } ^ { ( l ) } + \mathbf { W } ^ { ( l ) } \mathbf { H } ^ { ( l ) } \right) , \quad \mathbf { H } _ { v } ^ { ( t + 1 ) } = u _ { t } \left( \mathbf { H } _ { v } ^ { ( t ) } , \mathbf { m } _ { v } ^ { ( l ) } \right)
104
+ $$
105
+
106
+ where $\mathbf { E } _ { v w }$ is the feature corresponding to edge $( v , w )$ . In the realization of Eq. (8) (Gilmer et al., 2017), m(l)v and $\mathbf { H } _ { v } ^ { ( l ) }$ are fed to GRU (Cho et al., 2014) as a sequential input. There are several variants which take into account specific tasks (Li et al., 2016; Schutt et al., 2017; Chen et al., 2019). ¨ Among these, Li et al. (2016) generates a transformation matrix for each edge and Schutt et al. ¨ (2017) resorts to merge embedding via fully connected neural networks. While edge-wise merging is straightforward, the representation ability is also limited. On the other hand, fully connected merging strategy will result in high computational cost and instability for back-propagation. To address these issues, we propose to merge embedding in a channel-wise fashion, which is termed as Channel-Independent Embedding (CIE). Concretely, the updating rule is written as:
107
+
108
+ $$
109
+ \begin{array} { r } { \mathbf { H } _ { v } ^ { ( l + 1 ) } = \sigma \left( \underset { w \in \mathcal { N } _ { v } } { \sum } \underset { \mathrm { N } } { \underbrace { \Gamma _ { \mathrm { N } } \left( \mathbf { W } _ { 1 } ^ { ( l ) } \mathbf { E } _ { v w } ^ { ( l ) } \circ \mathbf { W } _ { 2 } ^ { ( l ) } \mathbf { H } _ { w } ^ { ( l ) } \right) } } \right) + \sigma \left( \mathbf { W } _ { 0 } ^ { ( l ) } \mathbf { H } _ { v } ^ { ( l ) } \right) } \\ { \mathbf { E } _ { v w } ^ { ( l + 1 ) } = \sigma \left( \mathbf { W } _ { 1 } ^ { ( l ) } \mathbf { E } _ { v w } ^ { ( l ) } \right) } \end{array}
110
+ $$
111
+
112
+ where $\Gamma _ { \mathrm { N } } ( \cdot \circ \cdot )$ is a channel-wise operator/function (above the underbrace), and it performs calculation per-channel and the output channel dimension is the same as input. The second $\sigma ( \cdot )$ term is the message a node passes to itself, which is necessary in keeping the node information contextually consistent through each CIE layer. In this fashion, CIE is thus a procedure to aggregate node and edge embedding in each channel independently, which requires the dimensions of node $( \mathbf { W } _ { 2 } ^ { ( l ) } \mathbf { H } _ { w } ^ { ( l ) } )$ and edge $( \mathbf { W } _ { 1 } ^ { ( l ) } \mathbf { E } _ { v w } ^ { ( l ) } )$ representations to be equal. Similarly, we also propose an corresponding updating rule of edge embedding by substituting Eq. (10):
113
+
114
+ $$
115
+ \mathbf { E } _ { v w } ^ { ( l + 1 ) } = \sigma \left( \Gamma _ { \mathrm { E } } \left( \mathbf { W } _ { 1 } ^ { ( l ) } \mathbf { E } _ { v w } ^ { ( l ) } \circ h \left( \mathbf { H } _ { v } ^ { ( l ) } , \mathbf { H } _ { w } ^ { ( l ) } \right) \right) \right) + \sigma \left( \mathbf { W } _ { 1 } ^ { ( l ) } \mathbf { E } _ { v w } ^ { ( l ) } \right)
116
+ $$
117
+
118
+ where $h ( \cdot , \cdot )$ is commutative $h ( \mathbf { X } , \mathbf { Y } ) = h ( \mathbf { Y } , \mathbf { X } )$ . Eq. (11) is supplementary to Eq. (9).
119
+
120
+ Fig. 2 shows a schematic diagram of CIE layer, which is motivated from two perspectives. First, CIE is motivated by counterparts in CNN (Qiu et al., 2017; Tran et al., 2018) which decouple a 3D convolution into two 2D ones (e.g. a $3 \times 3 \times 3$ convolution can be decomposed to a $1 \times 3 \times 3$ and a $3 \times 1 \times 1$ convolutions). In this sense, the number of parameters can be significantly reduced. As shown in Fig. 2, node and edge embedding is first manipulated along the channel direction via a linear layer, then operated via $\Gamma _ { \mathrm { N } }$ and $\Gamma _ { \mathrm { E } }$ orthogonal to the channel direction. Instead of merging node and edge as a whole, CIE layer decouples it into two operations. Second, CIE is also motivated by the triumph of multi-head structure (e.g. graph attention (Velickovi ˇ c et al., 2018)), the key of ´ which is to conduct unit calculation multiple times and concatenate the results. Multi-head proved effective to further improve the performance since it is capable of capturing information at different scales or aspects. Traditional neural node-edge message passing algorithms (Gilmer et al., 2017; Li et al., 2016; Schutt et al., 2017) typically produce a unified transformation matrix for all the channels. ¨ On the other hand, in Eq. (9) (10) and (11), one can consider that the basic operator in each channel is repeated $d$ times in a multi-head fashion. The cross-channel information exchange, as signified in Eq. (9) (10) and (11), only happens before the channel-wise operator (i.e. weights $\mathbf { W } _ { i } ^ { ( l ) }$ as the crosschannel matrices). The main difference between CIE and traditional multi-head approaches e.g. (Velickovi ˇ c et al., 2018) is that CIE assumes the channel-independence of two embedded features ´ (node and edge), while traditional ones only take one input under head-independence assumption.
121
+
122
+ ![](images/75a7a84da844e6c9da9fc1c6c589263364677f200a8999ef3bddde0726ba292e.jpg)
123
+ Figure 3: A working example illustrating of our proposed Hungarian attention pipeline starting from similarity matrix. Sinkhorn algorithm solves similarity matrix into a doubly-stochastic matrix in a differentiable way. A discrete permutation matrix is further obtained via Hungarian algorithm. Our proposed Hungarian attention, taking the ground truth matching matrix into account, focuses on the “important” digits either labeled true or being mis-classified. The output matrix is obtained by attention pooling from doubly-stochastic matrix, where we compute a loss on it.
124
+
125
+ # 3.3 HUNGARIAN ATTENTION MECHANISM
126
+
127
+ For most graph matching algorithms, the output is in a continuous domain. Though there are some alternatives that deliver discrete solutions by adding more constraints or introducing numerical continuation (Zhou & De la Torre, 2012; Yu et al., 2018), the main line of methods is to incorporate a sampling procedure (e.g. winner-take-all and Hungarian). Among them, the Hungarian algorithm (Kuhn, 1955) is a widely adopted, for its efficiency and theoretical optimality.
128
+
129
+ However, the Hungarian algorithm incurs a gap between training (loss function) and testing stages (Hungarian sampling). We compare the permutation loss (Wang et al., 2019) for concrete analysis:
130
+
131
+ $$
132
+ \mathcal { L } _ { \mathrm { C E } } = - \sum _ { i \in \mathcal { G } _ { 1 } , j \in \mathcal { G } _ { 2 } } \left( \mathbf { S } _ { i j } ^ { \mathrm { G } } \log \mathbf { S } _ { i j } + \left( 1 - \mathbf { S } _ { i j } ^ { \mathrm { G } } \right) \log \left( 1 - \mathbf { S } _ { i j } \right) \right)
133
+ $$
134
+
135
+ Note Eq. (12) is an element-wise version of binary cross-entropy. During training, this loss tends to drag the digits in S into binary format and is likely trapped to local optima. This is because this loss will back-propagate the gradients of training samples that are easy to learn in the early training stage. In later iterations, this loss is then hard to give up the digits that have become binary. In fact, the similar phenomenon is also investigated in the focal loss (Lin et al., 2017) in comparison to the traditional cross-entropy loss. During the testing stage, however, the Hungarian algorithm has no preference on the case if digits in S are close to $0 - 1$ or not. It binarizes S anyway. Therefore, the effort of Eq. (12) to drag S into binary might be meaningless.
136
+
137
+ This issue is likely to be solved by integrating Hungarian algorithm during the training stage. Unfortunately, Hungarian algorithm is undifferentiable and its behavior is difficult to mimic with a differentiable counterpart. In this paper, instead of finding a continuous approximation of Hungarian algorithm, we treat it as a black box and dynamically generate network structure (sparse link)
138
+
139
+ Table 1: Accuracy on Pascal VOC (best in bold). White and gray background refer to results on testing and training, respectively. Compared methods include GMN (Zanfir & Sminchisescu, 2018), GAT (Velickovi ˇ c et al., 2018), EPN (Gong & Cheng, 2019), PCA/PIA (Wang et al., 2019). ´
140
+
141
+ <table><tr><td>method</td><td>aero bike bird boat bottle bus car catchair cow table dog</td><td></td><td></td><td></td><td></td><td>horsembike</td><td></td><td></td><td></td><td>person plant sheep sofa train tv</td><td>Ave</td></tr><tr><td rowspan="5">GMN-D GMN-P</td><td>31.947.251.9 40.8 68.772.2 53.6 52.8 34.6 48.6</td><td></td><td></td><td></td><td>72.3 47.7</td><td>54.8 51.0</td><td>38.6</td><td>75.1</td><td>49.5</td><td>45.0 83.0 86.3</td><td>55.3</td></tr><tr><td>31.1 46.2 58.2 45.9 70.6 76.4 61.2 61.7 35.5 53.7</td><td></td><td></td><td></td><td>58.9 57.5</td><td>56.9</td><td>49.3</td><td>34.1 77.5</td><td>57.1</td><td>53.6 83.2 88.6</td><td>57.9</td></tr><tr><td>GAT-P 46.4 60.5 60.9 51.8 79.0</td><td></td><td>70.9 62.7 70.1</td><td>39.7 63.9</td><td>66.2 63.8</td><td>65.8</td><td>62.8</td><td>39.5</td><td>82.0 66.9</td><td>50.1 78.5 90.3</td><td>63.6</td></tr><tr><td>GAT-H 47.2 61.6 63.2 53.3</td><td>79.7</td><td>70.1 65.3 70.5 38.4 64.7</td><td></td><td>62.9 65.1</td><td>66.2</td><td>62.5</td><td>41.1</td><td>78.8 67.1</td><td>61.6 81.4 91.0</td><td>64.6</td></tr><tr><td>EPN-P 47.6 65.2 62.2 52.7</td><td>77.8</td><td>69.5 63.4 69.6</td><td>37.8 62.8</td><td>63.6 63.9</td><td>64.6</td><td>61.9</td><td>39.9</td><td>80.5 66.7</td><td>45.5 77.6 90.6</td><td>63.2</td></tr><tr><td rowspan="4">PIA-D PIA-P PCA-P</td><td>39.7 57.7 58.6 47.2</td><td>74.0</td><td>74.5 62.1 66.6 33.6 61.7</td><td>65.4</td><td>58.0 67.1</td><td>58.9</td><td>41.9</td><td>77.7</td><td>64.7</td><td>50.5 81.8 89.9</td><td>61.6</td></tr><tr><td>41.5 55.8 60.9 51.9</td><td>75.0</td><td>75.8 59.6 65.2 33.3 65.9</td><td></td><td>62.8 62.7</td><td>67.7</td><td>62.1</td><td>42.9</td><td>80.2 64.3</td><td>59.5 82.7 90.1</td><td>63.0</td></tr><tr><td>40.9 55.0 65.8 47.9</td><td>76.9</td><td>77.9 63.5 67.4</td><td>33.7 65.5</td><td>63.6 61.3</td><td>68.9</td><td>62.8</td><td>44.9</td><td>77.5 67.4</td><td>57.5 86.7 90.9</td><td>63.8</td></tr><tr><td>PCA-H 49.8 60.7 63.9 52.6 79.8 72.5 63.8 71.2 38.4 62.5</td><td></td><td></td><td></td><td>71.7 65.4</td><td>66.6</td><td>62.5</td><td>40.5</td><td>84.7 66.1</td><td>47.9 80.5 91.1</td><td>64.6</td></tr><tr><td rowspan="4">PCA+-P CIE2-P</td><td>46.6 61.0 62.3 53.9</td><td>78.2</td><td>72.5 64.4 70.539.0 63.5</td><td>74.8</td><td>65.2 65.0</td><td>61.6</td><td>40.8</td><td>83.2</td><td>67.1</td><td>50.5 79.6 91.6</td><td>64.6</td></tr><tr><td>50.9 65.5 68.057.081.0</td><td></td><td>75.970.373.441.1 66.7</td><td></td><td>53.2 68.3</td><td>68.4</td><td>63.5</td><td>45.3</td><td>84.8 69.7</td><td>57.2 79.8 91.6</td><td>66.9</td></tr><tr><td>CIE2-H 51.2 68.4 69.5 57.3 82.5 73.5 69.5 74.0 40.3 67.8 60.0</td><td></td><td></td><td></td><td></td><td>69.7 70.3</td><td>65.1</td><td>44.7</td><td>86.9 70.7</td><td>57.3 84.2 92.2</td><td>67.4</td></tr><tr><td>CIE-P 52.1 69.4 69.9 58.9</td><td></td><td>80.6 76.3 71.0 74.2 41.1 68.0</td><td></td><td>60.4 69.7</td><td>70.7</td><td>65.1</td><td>46.1</td><td>85.1 70.4</td><td>61.6 80.7 91.7</td><td>68.1</td></tr><tr><td>CIE-H</td><td>51.2 69.2 70.1 55.0 82.8 72.8 69.0 74.2 39.6 68.871.8 70.0</td><td></td><td></td><td></td><td></td><td>71.8 66.8</td><td>44.8</td><td>85.2</td><td>69.9</td><td>65.4 85.2 92.4</td><td>68.9</td></tr><tr><td>PCA-P</td><td>75.8 99.2 83.374.7 98.7 96.374.3 87.8 80.9 85.7 100.083.7 83.8</td><td></td><td></td><td></td><td></td><td></td><td>98.7</td><td>66.5</td><td>99.1 80.7</td><td></td><td></td></tr><tr><td>CIE-P</td><td></td><td></td><td></td><td>56.5 84.0 73.5 58.0 91.5 81.1 67.8 76.8 46.4 72.2 98.0 73.9 73.6</td><td></td><td></td><td>77.9</td><td>46.1</td><td>94.8 72.7</td><td>99.7 98.2 97.0 93.6 93.7 91.6</td><td>88.2</td></tr><tr><td></td><td></td><td></td><td></td><td>CIEt-H59.4 88.1 75.9 58.0 94.3 81.9 69.4 78.9 49.5 78.2 99.7 78.1 78.0</td><td></td><td></td><td>82.1</td><td>47.4</td><td>95.8 75.7</td><td>97.6 96.0 91.1</td><td>76.2 78.7</td></tr></table>
142
+
143
+ according to its output. Concretely, the sparse link is calculated as:
144
+
145
+ $$
146
+ \mathbf { Z } = \mathrm { A t t e n } \left( \mathrm { H u n g a r i a n } ( \mathbf { S } ) , \mathbf { S } ^ { \mathrm { G } } \right) = \mathcal { P } \cup \mathcal { Q }
147
+ $$
148
+
149
+ where the attention mechanism Atten is fulfilled by an element-wise “logic OR” function. Fig. 3 shows an example of Hungarian attention procedure, and Eq. (13) highlights the most contributing digit locations: positive digits $\mathcal { P } = \mathbf { S }$ where Hungarian agrees with the ground-truth; negative digits $\bar { \mathcal { Q } } ^ { - } = \operatorname { H u n g a r i a n } ( \mathbf { S } ) \ \backslash \ \mathbf { S } ^ { \mathrm { G } }$ where Hungarian differs from ground-truth. While GT (positive digits) naturally points out the digits that must be considered, negative ones indicate the digits that most hinder the matching (most impeding ones among all mis-matchings). Thus we need only minimize the loss at $\mathbf { Z }$ , without considering the rest of digits. As we note that this mechanism only focuses on a small portion of the matching matrix which is analogous to producing hard attention, we term it Hungarian attention. Now that with the attention mask $\mathbf { Z }$ , the Hungarian attention loss becomes:
150
+
151
+ $$
152
+ \mathcal { H } _ { \mathrm { C E } } = - \sum _ { i \in \mathcal { G } _ { 1 } , j \in \mathcal { G } _ { 2 } } \mathbf { Z } _ { i j } \left( \mathbf { S } _ { i j } ^ { \mathrm { G } } \log \mathbf { S } _ { i j } + \left( 1 - \mathbf { S } _ { i j } ^ { \mathrm { G } } \right) \log \left( 1 - \mathbf { S } _ { i j } \right) \right)
153
+ $$
154
+
155
+ Note that Hungarian attention mechanism can also be applied to other loss functions once the matching score is calculated in an element-wise fashion. Our experiment also studies Hungarian attention loss when casted on focal loss (Lin et al., 2017) and a specifically designed margin loss.
156
+
157
+ Finally we give a brief qualitative analysis on why Hungarian attention can improve matching loss. As discrete graph matching problem is actually built upon Delta function over permutation vertices (1 at ground-truth matching and 0 otherwise) (Yu et al., 2018), learning of graph matching with permutation loss is actually to approximate such functions with continuous counterparts. Unfortunately, more precise approximation to Delta function will result in higher non-smoothness, as discussed in Yu et al. (2018). For highly non-smooth objective, the network is more likely trapped at local optima. Hungarian attention, however, focuses on a small portion of the output locations, thus does not care about if most of the output digits are in $\{ 0 , 1 \}$ . In this sense, Hungarian attention allows moderate smoothness of the objective, thus optimizer with momentum is likely to avoid local optima.
158
+
159
+ # 4 EXPERIMENTS
160
+
161
+ Experiments are conducted on three benchmarks widely used for learning-based graph matching: CUB2011 dataset (Welinder et al., 2010) following the protocol in (Choy et al., 2016), Pascal VOC keypoint matching (Everingham et al., 2010; Bourdev & Malik, 2009) which is challenging and Willow Object Class dataset (Cho et al., 2013). Mean matching accuracy is adopted for evaluation:
162
+
163
+ $$
164
+ \operatorname { A c c } = \frac { 1 } { k } \sum _ { i \in \mathcal { G } _ { 1 } , j \in \mathcal { G } _ { 2 } } \operatorname { A N D } \left( \operatorname { H u n g a r i a n } ( \mathbf { S } ) _ { i j } , \mathbf { S } _ { i j } ^ { \mathrm { G } } \right)
165
+ $$
166
+
167
+ The algorithm abbreviation is in the form “X-Y”, where “X” and “Y” refer to the network structure (e.g. CIE) and loss function (e.g. Hungarian attention loss), respectively. Specifically, D, $\mathbf { P }$ and $\mathbf { H }$ correspond to displacement used in (Zanfir & Sminchisescu, 2018), permutation as adopted in (Wang et al., 2019) and Hungarian attention over permutation loss devised by this paper, respectively.
168
+
169
+ Peer methods. We compare our method with the following selected counterparts: 1) HARG (Cho et al., 2013). This shallow learning method is based on hand-crafted feature and Structured SVM; 2) GMN (Zanfir & Sminchisescu, 2018). This is a seminal work incorporating graph matching and deep learning, and the solver is upon spectral matching (Leordeanu & Hebert, 2005). While the loss of this method is displacement loss, we also report the results of GMN by replacing its loss with permutation loss (GMN-P); 3) PIA/PCA (Wang et al., 2019). PCA and PIA correspond to the algorithms with and without cross-graph node embedding, respectively. Readers are referred to Wang et al. (2019) for more details; We further replace the GNN layer in our framework with: 4) GAT (Velickovi ˇ c et al., 2018). Graph attention network is an attention mechanism on graphs, ´ which reweights the embedding according to attention score; 5) EPN (Gong & Cheng, 2019). This method exploits multi-dimensional edge embedding and can further be applied on directed graphs. The edge dimension is set to 32 in our experiments. Finally, we term our network structure CIE for short. To investigate the capacity of edge embedding update, we also devise a version without edge embedding, in which connectivity is initialized as reciprocal of the edge length then normalized, rather than A. This model is called $\mathbf { P C A } +$ since the node embedding strategy follows PCA.
170
+
171
+ Implementation details. As the node number of each graph might vary, we add dummy nodes for each graph pair such that the node number reaches the maximal graph size in a mini-batch in line with the protocol in (Wang et al., 2019). In either training or testing stages, these dummy nodes will not be updated or counted. The activation function in Eq. (9) (10) and (11) is set as Relu (Nair & Hinton, 2010) in all experiments. Specifically, the node and edge embedding is implemented by:
172
+
173
+ $$
174
+ \mathbf { H } _ { \cdot q } ^ { ( l + 1 ) } = \sigma \left( \left( \mathbf { A } \odot \left( \mathbf { W } _ { 1 } ^ { ( l ) } \mathbf { E } ^ { ( l ) } \right) _ { \cdot q } \right) \left( \mathbf { W } _ { 2 } ^ { ( l ) } \mathbf { H } ^ { ( l ) } \right) _ { \cdot q } \right) + \sigma \left( \left( \mathbf { W } _ { 0 } ^ { ( l ) } \mathbf { H } ^ { ( l ) } \right) _ { \cdot q } \right)
175
+ $$
176
+
177
+ $$
178
+ \mathbf { E } _ { \cdot q } ^ { ( l + 1 ) } = \sigma \left( \left| \left( \mathbf { W } _ { 0 } ^ { ( l ) } \mathbf { H } ^ { ( l ) } \right) _ { \cdot q } \Theta \left( \mathbf { W } _ { 0 } ^ { ( l ) } \mathbf { H } ^ { ( l ) } \right) _ { \cdot q } ^ { \top } \right| \odot \mathbf { E } _ { \cdot q } ^ { ( l ) } \right) + \sigma \left( \left( \mathbf { W } _ { 1 } ^ { ( l ) } \mathbf { E } ^ { ( l ) } \right) _ { \cdot q } \right)
179
+ $$
180
+
181
+ where $\odot$ and $\ominus$ refer to element-wise product and pairwise difference, respectively. $\mathbf { H } _ { \cdot q }$ is the qth channel of $\mathbf { H }$ . In $\mathbf { C I } \mathbf { E } _ { 1 }$ setting, only node-level merging Eq. (16a) is considered and the edge feature is updated as Eq. (10). In $\mathbf { { C I } } \mathbf { { E } } _ { 2 }$ setting, we also replace the edge update Eq. (11) with Eq. (16b). Note edge embedding is used in both $\mathbf { C I } \mathbf { E } _ { 1 }$ and $\mathbf { { C I } } \mathbf { { E } } _ { 2 }$ and note PCA-H can be regarded as the pure node embedding version of our approach. The edge feature is initiated as reciprocal of the edge length. For training, batch size is set to 8. We employ SGD optimizer (Bottou, 2010) with momentum 0.9. Two CIE layers are stacked after VGG16.
182
+
183
+ CUB2011 test CUB2011 consists of 11,788 images from 200 kinds of birds with 15 annotated parts. We randomly sample image pairs from the dataset following the implementation released by Choy et al. (2016). We do not use the pre-alignment of poses during testing, because their alignment result is not publicly available. Therefore, there exists significant variation in pose, articulation and appearance across images, in both training and testing phase. Images are cropped around bounding box and resized to $2 5 6 \times 2 5 6$ before fed into the network. Instead of evaluating the performance in a retrieval fashion (Zanfir & Sminchisescu, 2018), we directly evaluate the matching accuracy since the semantic key-points are pre-given. We test two settings: 1) intra-class. During training, we randomly sample images, with each pair sampled from the same category (out of 200 bird categories). In testing, 2,000 image pairs (100 pairs for each category) are sampled; 2) cross-class. We analogously sample image pairs without considering the category information and 5,000 randomly sampled image pairs are employed for testing. While the first setting is for a class-aware situation, the second setting is considered for testing the class-agnostic case. Results are shown in Table 3.
184
+
185
+ We see our method surpasses all the competing methods in terms of matching accuracy. Besides, almost all the selected algorithms can reach over $9 0 \%$ accuracy, indicating that this dataset contains mostly “easy” learning samples. In this case, the Hungarian attention can slightly improve the performance since easy gradients agree with descending trend of the loss on the whole dataset.
186
+
187
+ Pascal VOC test The Pascal VOC dataset with Key-point annotation (Bourdev & Malik, 2009) contains 7,020 training images and 1,682 testing images with 20 classes in total. To the best of our knowledge, this is the largest and most challenging dataset for graph matching in computer vision. Each image is cropped around its object bounding box and is resized to $2 5 6 \times 2 5 6$ . The node
188
+
189
+ ![](images/c8d9b9e1f995a1cc878942ca464f0eb90ffb13b074da62ef704af2069adf88e1.jpg)
190
+ (a) Accuracy/loss vs. training epoch.
191
+
192
+ ![](images/19ed5da35d238352f86d7bbe1fe6919ac6415510c5a713062e3e7e3a9dd22c1d.jpg)
193
+ (b) Ablation study by Hungarian attention.
194
+
195
+ Figure 4: Performance study on Pascal VOC. Note in (a) the loss is calculated on all matching digits for both $\mathrm { C I E } _ { 1 }$ -P and $\mathrm { C I E } _ { 1 }$ -H. Note around 10th epoch, the accuracy of $\mathrm { C I E } _ { 1 }$ -P almost reaches the highest, but the loss keeps descending until 30th epoch. This indicates that in most of the latter epochs, P-loss performs “meaningless” back-propagation to drag the output to binary. H-loss, by accommodating smoothness, can emphasize most contributing digits and achieves higher accuracy. size of this dataset varies from 6 to 23 and there are various scale, pose and illumination perturbations. Experimental results are summarized in Table 1. We see in either setting, CIE significantly outperforms all peer algorithms. Specifically, $\mathrm { C I E } _ { 1 } .$ -H achieves the best performance and has $0 . 8 \dot { \% }$ improvement w.r.t. average accuracy over $\mathrm { C I E } _ { 1 }$ -P. For each class, $\mathrm { C I E } _ { 1 }$ -H and $\mathrm { C I E } _ { 1 }$ -P carve up most of the top performance. We also note that $\mathrm { C I E } _ { 1 }$ -H has a close performance on “table” compared with GMN-D. Since P-loss is naturally not as robust as D-loss on symmetric objects, P-loss showed great degradation over D-loss on “table” (as discussed in (Wang et al., 2019)). However, with the help of Hungarian link, H-loss can maintain relatively high accuracy despite natural flaw of P-loss. This observation indicates that H-loss can focus on “difficult” examples. We also note that $\mathrm { C I E } _ { 1 }$ produces better results against $\mathrm { C I E } _ { 2 }$ , which implies that updating edge embedding is less effective compared to a singleton node updating strategy. We can also see from Table 1 that PCA-P has much higher performance on training samples than $\mathrm { C I E } _ { 1 }$ -H, which is to the contrary of the result on testing samples. This might indicate that PCA-P overfits the training samples.
196
+
197
+ Accuracy/loss vs. training epoch. We further show the typical training behavior of P-loss and Hloss on Pascal VOC dataset in Fig. 4. 30 epochs are involved in a whole training process. Accuracy is evaluated on testing samples after each epoch while loss is the average loss value within each epoch. In the early training stage, the loss of $\mathrm { C I E } _ { 1 }$ -P immediately drops. On the other hand, $\mathrm { C I E } _ { 1 }$ -H hesitates for several epochs to find the most effective descending direction. On the late stage, we observe that even though P-loss (Eq. (12)) calculates much more digits than H-loss (Eq. (14)), the loss values are opposite. This counter-intuitive fact strongly indicates that P-loss makes meaningless effort, which is not helpful to improve the performance, at late stage. The proposed H-loss, on the other hand, is capable of avoiding easy but meaningless gradients.
198
+
199
+ Effect of Hungarian attention mechanism. We also conduct experiments to show the improvement of Hungarian attention over several loss functions (with and without Hungarian attention): Hungarian attention is applied on Focal loss (Focal) (Lin et al., 2017) as:
200
+
201
+ $$
202
+ \mathcal { L } _ { \mathrm { f o c a l } } = \left\{ \begin{array} { l l } { - \alpha \mathbf { Z } _ { i j } ( 1 - \mathbf { S } _ { i j } ) ^ { \gamma } \log ( \mathbf { S } _ { i j } ) , } & { \mathbf { S } _ { i j } ^ { \mathrm { G } } = 1 } \\ { - ( 1 - \alpha ) \mathbf { Z } _ { i j } \mathbf { S } _ { i j } ^ { \gamma } \log ( 1 - \mathbf { S } _ { i j } ) , } & { \mathbf { S } _ { i j } ^ { \mathrm { G } } = 0 } \end{array} \right.
203
+ $$
204
+
205
+ where controlling parameters $\alpha = 0 . 7 5$ and $\gamma = 2$ in our setting. We also design a margin loss (Margin) with Hungarian attention under a max-margin rule. Note we insert the Hungarian attention mask $\mathbf { Z } _ { i j }$ into Eq. (17) and Eq. (18) based on the vanilla forms.
206
+
207
+ $$
208
+ \mathcal { L } _ { \mathrm { m a r g i n } } = \left\{ \begin{array} { l l } { \mathbf { Z } _ { i j } \times \operatorname* { m a x } ( 1 - \mathbf { S } _ { i j } - \beta , 0 ) , } & { \mathbf { S } _ { i j } ^ { \mathbf { G } } = 1 } \\ { \mathbf { Z } _ { i j } \times \operatorname* { m a x } ( \mathbf { S } _ { i j } - \beta , 0 ) , } & { \mathbf { S } _ { i j } ^ { \mathbf { G } } = 0 } \end{array} \right.
209
+ $$
210
+
211
+ where we set the margin value $\beta \ : = \ : 0 . 2$ . Loss of Eq. (18) is valid because after Softmax and Sinkhorn operations, $\mathbf { S } _ { i j } ~ \in ~ [ 0 , 1 ]$ . We also show permutation loss (Perm) (Wang et al., 2019). Result can be found in Fig. 4 (b) whereby the average accuracy on Pascal VOC is reported. All the settings are under $\mathrm { C I E } _ { 1 }$ . For either loss, the proposed Hungarian attention can further enhance the accuracy, which is further visualized by a pair of matching results under P-loss and H-loss in Fig. 5.
212
+
213
+ ![](images/b40a9251d7c8edb6df2b7b8344078fcf061652721ebd0223b72030de79b33362.jpg)
214
+ Figure 5: Visualization of a matching result: 10 key points in each image with 7 and 8 correct matchings dispalyed, respectively. Different colors across images indicate node correspondence. The larger size of dot, the larger is the predicted value $\mathbf { S } _ { i j }$ . (a) The reference image. (b) Result on the target image from $\mathrm { C I E } _ { 1 }$ -P. (c) Result on the target image from $\mathrm { C I E } _ { 1 }$ -H. We see though H-loss i.e. Hungarian attention loss outputs smaller predicted values, it delivers a more accurate matching.
215
+
216
+ Table 2: Accuracy $( \% )$ on Willow Object.
217
+
218
+ <table><tr><td>method</td><td>face</td><td>mbike</td><td>car</td><td>duck</td><td>wbottle</td></tr><tr><td>HARG</td><td>91.2</td><td>44.4</td><td>58.4</td><td>55.2</td><td>66.6</td></tr><tr><td>GMN-V</td><td>98.1</td><td>65.0</td><td>72.9</td><td>74.3</td><td>70.5</td></tr><tr><td>GMN-W</td><td>99.3</td><td>71.4</td><td>74.3</td><td>82.8</td><td>76.7</td></tr><tr><td>PCA-V</td><td>100.0</td><td>69.8</td><td>78.6</td><td>82.4</td><td>95.1</td></tr><tr><td>PCA-W</td><td>100.0</td><td>76.7</td><td>84.0</td><td>93.5</td><td>96.9</td></tr><tr><td>CIE-V</td><td>99.9</td><td>71.5</td><td>75.4</td><td>73.2</td><td>97.6</td></tr><tr><td>CIE-W</td><td>100.0</td><td>90.0</td><td>82.2</td><td>81.2</td><td>97.6</td></tr></table>
219
+
220
+ Table 3: Accuracy $( \% )$ on CUB.
221
+
222
+ <table><tr><td>method</td><td>intra-class</td><td>cross-class</td></tr><tr><td>GMN-D</td><td>89.6</td><td>89.9</td></tr><tr><td>GMN-P</td><td>90.4</td><td>90.8</td></tr><tr><td>GAT-P</td><td>93.2</td><td>93.4</td></tr><tr><td>PCA-P</td><td>92.9</td><td>93.5</td></tr><tr><td>PCA-H</td><td>93.7</td><td>93.5</td></tr><tr><td>CIE-P</td><td>94.1</td><td>93.8</td></tr><tr><td>CIE-H</td><td>94.4</td><td>94.2</td></tr></table>
223
+
224
+ Willow Object Class test We test the transfer ability on Willow Object Class (Cho et al., 2013). It contains 256 images3 of 5 categories in total, with three categories (face, duck and winebottle) collected from Caltech-256 and resting two (car and motorbike) from Pascal VOC 2007. This dataset is considered to have bias compared with Pascal VOC since images in the same category are with relatively fixed pose and background is much cleaner. We crop the object inside its bounding box and resize it to $2 5 6 \times 2 5 6$ as CNN input. While HARG is trained from scratch following the protocol in (Cho et al., 2013), all the resting counterparts are either directly pre-trained from the previous section or fine-tuned upon the pre-trained models. We term the method “X-V” or “X-W” to indicate pre-trained model on Pascal VOC or fine-tuned on Willow, respectively. CIE refers to $\mathrm { C I E } _ { 1 }$ -H for short. Results in Table 2 suggest that our method is competitive to state-of-the-art.
225
+
226
+ # 5 CONCLUSION
227
+
228
+ We have presented a novel and effective approach for learning based graph matching. On one hand, the novelty of our method partially lies in the development of the Hungarian attention, which intrinsically adapts the matching problem. It is further observed from the experiments that Hungarian attention can improve several matching-oriented loss functions, which might bring about potential for a series of combinatorial problems. On the other hand, we also devise the channel independent embedding (CIE) technique for deep graph matching, which decouples the basic merging operations and is shown robust in learning effective graph representation. Extensive experimental results on multiple matching benchmarks show the leading performance of our solver, and highlight the orthogonal contribution of the two proposed components on top of existing techniques.
229
+
230
+ # ACKNOWLEDGMENTS
231
+
232
+ Tianshu Yu and Baoxin Li were supported in part by a grant from ONR. Any opinions expressed in this material are those of the authors and do not necessarily reflect the views of ONR. Runzhong Wang and Junchi Yan were supported in part by NSFC 61972250 and U19B2035.
233
+
234
+ # REFERENCES
235
+
236
+ Kfir Aberman, Jing Liao, Mingyi Shi, Dani Lischinski, Baoquan Chen, and Daniel Cohen-Or. Neural best-buddies: Sparse cross-domain correspondence. SIGGRAPH, 2018.
237
+
238
+ Ryan Prescott Adams and Richard S Zemel. Ranking via sinkhorn propagation. arXiv:1106.1925, 2011.
239
+
240
+ Florian Bernard, Christian Theobalt, and Michael Moeller. Ds\*: Tighter lifting-free convex relaxations for quadratic matching problems. In CVPR, 2018.
241
+
242
+ Leon Bottou. Large-scale machine learning with stochastic gradient descent. In ´ COMPSTAT. 2010.
243
+
244
+ Lubomir Bourdev and Jitendra Malik. Poselets: Body part detectors trained using 3d human pose annotations. In ICCV, 2009.
245
+
246
+ Jane Bromley, Isabelle Guyon, Yann LeCun, Eduard Sackinger, and Roopak Shah. Signature verifi- ¨ cation using a “siamese” time delay neural network. In NIPS, 1994.
247
+
248
+ Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. In ICLR, 2014.
249
+
250
+ Tiberio S Caetano, Julian J McAuley, Li Cheng, Quoc V Le, and Alex J Smola. Learning graph ´ matching. PAMI, 31(6):1048–1058, 2009.
251
+
252
+ Hongyun Cai, Vincent W Zheng, and Kevin Chen-Chuan Chang. A comprehensive survey of graph embedding: Problems, techniques, and applications. TKDE, 30(9):1616–1637, 2018.
253
+
254
+ Pengfei Chen, Weiwen Liu, Chang-Yu Hsieh, Guangyong Chen, and Shengyu Zhang. Utilizing edge features in graph neural networks via variational information maximization. arXiv preprint arXiv:1906.05488, 2019.
255
+
256
+ Kyunghyun Cho, Bart Van Merrienboer, Dzmitry Bahdanau, and Yoshua Bengio. On the properties ¨ of neural machine translation: Encoder-decoder approaches. arXiv preprint arXiv:1409.1259, 2014.
257
+
258
+ Minsu Cho, Jungmin Lee, and Kyoung Mu Lee. Reweighted random walks for graph matching. In ECCV, 2010.
259
+
260
+ Minsu Cho, Karteek Alahari, and Jean Ponce. Learning graphs to match. In CVPR, 2013.
261
+
262
+ Christopher B Choy, JunYoung Gwak, Silvio Savarese, and Manmohan Chandraker. Universal correspondence network. In NIPS, 2016.
263
+
264
+ Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on ¨ graphs with fast localized spectral filtering. In NIPS, 2016.
265
+
266
+ Boris Delaunay et al. Sur la sphere vide. Izv. Akad. Nauk SSSR, Otdelenie Matematicheskii i Estestvennyka Nauk, 7(793-800):1–2, 1934.
267
+
268
+ Alexey Dosovitskiy, Philipp Fischer, Eddy Ilg, Philip Hausser, Caner Hazirbas, Vladimir Golkov, Patrick Van Der Smagt, Daniel Cremers, and Thomas Brox. Flownet: Learning optical flow with convolutional networks. In ICCV, 2015.
269
+
270
+ Patrick Emami and Sanjay Ranka. Learning permutations with sinkhorn policy gradient. arXiv:1805.07010, 2018.
271
+
272
+ Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. IJCV, 88(2):303–338, 2010.
273
+
274
+ Paolo Frasconi, Marco Gori, and Alessandro Sperduti. A general framework for adaptive processing of data structures. TNN, 9(5):768–786, 1998.
275
+
276
+ Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In ICML, 2017.
277
+
278
+ Liyu Gong and Qiang Cheng. Exploiting edge features for graph neural networks. In CVPR, 2019.
279
+
280
+ Marco Gori, Gabriele Monfardini, and Franco Scarselli. A new model for learning in graph domains. In IJCNN, 2005.
281
+
282
+ Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In NIPS, 2017.
283
+
284
+ Juris Hartmanis. Computers and intractability: a guide to the theory of np-completeness (michael r. garey and david s. johnson). Siam Review, 24(1):90, 1982.
285
+
286
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
287
+
288
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In ICLR, 2017.
289
+
290
+ Harold W Kuhn. The hungarian method for the assignment problem. Naval research logistics quarterly, 2(1-2):83–97, 1955.
291
+
292
+ Eugene L Lawler. The quadratic assignment problem. Management science, 9(4):586–599, 1963.
293
+
294
+ Marius Leordeanu and Martial Hebert. A spectral technique for correspondence problems using pairwise constraints. In ICCV, 2005.
295
+
296
+ Yijun Li, Chen Fang, Jimei Yang, Zhaowen Wang, Xin Lu, and Ming-Hsuan Yang. Universal style transfer via feature transforms. In NIPS, 2017.
297
+
298
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. In ICLR, 2016.
299
+
300
+ Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense object ´ detection. In ICCV, 2017.
301
+
302
+ Eliane Maria Loiola, Nair Maria Maia de Abreu, Paulo Oswaldo Boaventura-Netto, Peter Hahn, and Tania Querido. A survey for the quadratic assignment problem. European journal of operational research, 176(2):657–690, 2007.
303
+
304
+ Gonzalo Mena, David Belanger, Gonzalo Munoz, and Jasper Snoek. Sinkhorn networks: Using ˜ optimal transport techniques to learn permutations. NIPS Workshop in Optimal Transport and Machine Learning, 2017.
305
+
306
+ Anton Milan, Seyed Hamid Rezatofighi, Ravi Garg, Anthony R. Dick, and Ian D. Reid. Data-driven approximations to np-hard problems. In AAAI, 2017.
307
+
308
+ Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. In ICML, 2010.
309
+
310
+ Giorgio Patrini, Marcello Carioni, Patrick Forre, Samarth Bhargav, Max Welling, Rianne van den Berg, Tim Genewein, and Frank Nielsen. Sinkhorn autoencoders. arXiv:1810.01118, 2018.
311
+
312
+ Zhaofan Qiu, Ting Yao, and Tao Mei. Learning spatio-temporal representation with pseudo-3d residual networks. In ICCV, 2017.
313
+
314
+ Zhe Ren, Junchi Yan, Bingbing Ni, Bin Liu, Xiaokang Yang, and Hongyuan Zha. Unsupervised deep learning for optical flow estimation. In AAAI, 2017.
315
+
316
+ Rodrigo Santa Cruz, Basura Fernando, Anoop Cherian, and Stephen Gould. Visual permutation learning. TPAMI, 2018.
317
+
318
+ Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. TNN, 20(1):61–80, 2008.
319
+
320
+ Kristof T Schutt, Farhad Arbabzadah, Stefan Chmiela, Klaus R M ¨ uller, and Alexandre Tkatchenko. ¨ Quantum-chemical insights from deep tensor neural networks. Nature communications, 8:13890, 2017.
321
+
322
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
323
+
324
+ Richard Sinkhorn. A relationship between arbitrary positive matrices and doubly stochastic matrices. AoMS, 1964.
325
+
326
+ Alessandro Sperduti and Antonina Starita. Supervised neural networks for the classification of structures. TNN, 8(3):714–735, 1997.
327
+
328
+ Du Tran, Heng Wang, Lorenzo Torresani, Jamie Ray, Yann LeCun, and Manohar Paluri. A closer look at spatiotemporal convolutions for action recognition. In CVPR, 2018.
329
+
330
+ Ioannis Tsochantaridis, Thorsten Joachims, Thomas Hofmann, and Yasemin Altun. Large margin methods for structured and interdependent output variables. JMLR, 6(Sep):1453–1484, 2005.
331
+
332
+ Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Li ´ o, and Yoshua \` Bengio. Graph attention networks. In ICLR, 2018.
333
+
334
+ Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In NIPS, 2015.
335
+
336
+ Runzhong Wang, Junchi Yan, and Xiaokang Yang. Learning combinatorial embedding networks for deep graph matching. In ICCV, 2019.
337
+
338
+ P. Welinder, S. Branson, T. Mita, C. Wah, F. Schroff, S. Belongie, and P. Perona. Caltech-UCSD Birds 200. Technical Report CNS-TR-2010-001, California Institute of Technology, 2010.
339
+
340
+ Hongteng Xu, Dixin Luo, and Lawrence Carin. Gromov-wasserstein learning for graph matching and node embedding. In ICML, 2019.
341
+
342
+ Junchi Yan, Chao Zhang, Hongyuan Zha, Wei Liu, Xiaokang Yang, and Stephen M Chu. Discrete hyper-graph matching. In CVPR, 2015.
343
+
344
+ Tianshu Yu, Junchi Yan, Yilin Wang, Wei Liu, and Baoxin Li. Generalizing graph matching beyond quadratic assignment model. In NIPS, 2018.
345
+
346
+ Andrei Zanfir and Cristian Sminchisescu. Deep learning of graph matching. In CVPR, 2018.
347
+
348
+ Zhen Zhang and Wee Sun Lee. Deep graphical feature learning for the feature matching problem. In ICCV, 2019.
349
+
350
+ Feng Zhou and Fernando De la Torre. Factorized graph matching. In CVPR, 2012.
351
+
352
+ # A APPENDIX
353
+
354
+ # A.1 SYNTHETIC TEST
355
+
356
+ Synthetic graphs are generated for training and testing following the protocol in (Cho et al., 2010). Specifically, $K _ { p t }$ keypoints are generated for a pair of graphs with a 1024-dimensional random feature for each node, which is sampled from uniform distribution $\mathcal { U } ( - 1 , 1 )$ . Disturbance is also applied to graph pairs including: Gaussian node feature noise from $\mathcal { N } ( 0 , \sigma _ { f t } ^ { 2 } )$ ; random affine transformation $\left[ \begin{array} { c c c } { s \cos \theta } & { - s \sin \theta } & { t _ { x } } \\ { s \sin \theta } & { s \cos \theta } & { t _ { y } } \\ { 0 } & { 0 } & { 1 } \end{array} \right] \mathrm { w i t h } s \sim \mathcal { U } ( 0 . 8 , 1 . 2 ) , \theta \sim \mathcal { U } ( - 6 0 , 6 0 ) , t _ { x } , t _ { y } \sim \mathcal { U } ( - 1 0 , 1 0 )$ ) followed by Gaussian coordinate position noise $\mathcal { N } ( 0 , \sigma _ { c o } ^ { 2 } )$ . By default we assign $K _ { p t } = 2 5 , \sigma _ { f t } =$ $1 . 5 , \sigma _ { c o } = 5$ . Two graphs share the same structure. We generate 10 random distributions for each test. Results are shown in Fig. 6. The performance of PCA and CIE is reported. We see our method significantly outperformed PCA. It can further be noticed that Hungarian attention can help to achieve an even higher accuracy. Readers are referred to Wang et al. (2019) for some other results on synthetic test.
357
+
358
+ However, we also notice that the way to generate synthetic graphs is much different from the distribution of real-world data. For real-world data, on one hand, there is strong correlation on the neighboring node features. This is the reason why the message passing from nearby node features works. However, the features of synthetic data are randomly generated and there is no correlation between neighboring node features. Therefore, message passing mechanism is not very effective to reveal the relation or pattern among local nodes for synthetic data. On the other hand, features of real-world data typically lie on a manifold embedded in high dimensional space, hence is low dimensional. However, randomly generated features will span the whole space and show no patterns.
359
+
360
+ ![](images/0bdc47cf84fa82623f197589bb25d188aadce99a4aae6bb0f564975f37535b81.jpg)
361
+ Figure 6: Results on synthetic test where two different loss functions are compared in ablative study.
362
+
363
+ Taking into account the aforementioned factors, we believe there is a demand for a novel strategy to generate more reasonable synthetic data. This can be one of the future works.
364
+
365
+ # A.2 COMPARISON OF PASCAL VOC AND WILLOW
366
+
367
+ As we claim that Willow dataset is biased compared with Pascal VOC dataset, we qualitatively show some randomly selected examples in Fig. 7. We select several images with the same class “car” from both datasets. We also choose images with “bird” from Pascal VOC and “duck” from Willow since they somewhat share similar semantic information. We see in either case, Pascal VOC contains more variation and degradation compared with Willow in terms of pose, scale, appearance, etc. In general, Willow dataset is easier for algorithms to learn. While there is a significant performance gap of PCA over these two datasets, the performance of CIE on Willow without fine-tune (Table 2) is consistent to the performance on Pascal VOC (Table 1). As such, we infer the performance degradation of CIE on “duck” in Willow test (Table 2) is due to such bias. The pre-trained CIE on Pascal VOC tends to produce more stable and higher average accuracy on all types of images, rather than focusing on “easy-to-learn” samples by PCA. This is a different learning strategy from PCA.
368
+
369
+ ![](images/18cf48c3d41aebd319e375e71f705827d516d774adb2765e95eed33d4761c7f8.jpg)
370
+ Figure 7: Image examples from Pascal VOC and Willow.
md/train/rk9eAFcxg/rk9eAFcxg.md ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VARIATIONAL RECURRENT ADVERSARIALDEEP DOMAIN ADAPTATION
2
+
3
+ Sanjay Purushotham\*, Wilka Carvalho\*, Tanachat Nilanon, Yan Liu
4
+
5
+ Department of Computer Science
6
+ University of Southern California
7
+ Los Angeles, CA 90089, USA
8
+ {spurusho,wcarvalh,nilanon,yanliu.cs}@usc.edu
9
+
10
+ # ABSTRACT
11
+
12
+ We study the problem of learning domain invariant representations for time series data while transferring the complex temporal latent dependencies between domains. Our model termed as Variational Recurrent Adversarial Deep Domain Adaptation (VRADA) is built atop a variational recurrent neural network (VRNN) and trains adversarially to capture complex temporal relationships that are domain-invariant. This is (as far as we know) the first to capture and transfer temporal latent dependencies of multivariate time-series data. Through experiments on real-world multivariate healthcare time-series datasets, we empirically demonstrate that learning temporal dependencies helps our model’s ability to create domain-invariant representations, allowing our model to outperform current state-of-the-art deep domain adaptation approaches.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Many real-world applications require effective machine learning algorithms that can learn invariant representations across related time-series datasets. For example, precision medicine for patients of various age groups, mobile application recommendation for users based on locations, and so on. In these examples, while the domains (i.e. age group and location) may vary, there exist common predictive patterns that can aid in inferring knowledge from one domain to another. More often than not, some domains have a significantly larger number of observations than others (e.g., respiratory failure in adults vs. children). Therefore effective domain adaption of time-series data is in great demand.
17
+
18
+ The general approach to tackling domain adaptation has been explored under many facets which include reducing the domain discrepancy between the source and target domains(Ben-David et al. (2007)), instance re-weighting (Jiang & Zhai (2007)), subspace alignment (Fernando et al. (2013)), and deep learning (Tzeng et al. (2015); Ganin & Lempitsky (2014)). Many of these approaches work very well for non-sequential data but are not suitable for multivariate time-series data as they do not usually capture the temporal dependencies present in the data. For sequential data, earlier work has successfully used dynamic Bayesian Networks(Huang & Yates (2009)) and Recurrent Neural Networks (Socher et al. (2011)) to learn latent feature representations which were domaininvariant. Unfortunately, these works were not flexible enough to model non-linear dynamics or did not explicitly capture and transfer the complex latent dependencies needed to perform domain adaptation of time-series data.
19
+
20
+ In this paper, we address this problem with a model that learns temporal latent dependencies (i.e. dependencies between the latent variables across timesteps) that can be transferred across domains that experience different distributions in their features. We draw inspiration from the Variational Recurrent Neural Network (Chung et al. (2016)) and use variational methods to produce a latent representation that captures underlying temporal latent dependencies. Motivated by the theory of domain adaptation (Ben-David et al. (2010)), we perform adversarial training on this representation
21
+
22
+ ![](images/5994455d34a7df0125ff448c1f0d78bf48aa6fe58d9be5e243ebb4424444504a.jpg)
23
+ Figure 1: A Story of Temporal Dependency and Domain Invariance
24
+
25
+ t-SNE projections for the latent representations of DNN, R-DANN, and our VRADA model. We show adaption
26
+ from Adult-AHRF to Child-AHRF data. Source data is represented with red circles and target data with blue
27
+ circles. From left to right, one can see that domain adaptation results in mixing the source and target domain data distributions. We can also see a story of how encoding more temporal dependency into the latent
28
+ representation induces more domain-invariant representations. As models capture more underlying factors of
29
+ variation, post domain adaptation representations gradually smoothen and become evenly dispersed, indicating that temporal dependency acts synergestically with domain adaptation.
30
+
31
+ similarly to the Domain Adversarial Neural Network (DANN) (Ganin et al. (2016)) to make the representations invariant across domains. We call our model the Variational Recurrent Adversarial Deep Domain Adaptation (VRADA) model. As far as we know, this is the first model capable of accomplishing unsupervised domain adaptation while transferring temporal latent dependencies for complex multivariate time-series data. Figure 1 shows an example of the domain invariant representations learned by different deep learning models including our VRADA model. From this figure, we can see that our model (VRADA) shows better mixing of the domain distributions than the competing models indicating that it learns better domain invariant representations.
32
+
33
+ In order to prove the efficacy of our model, we perform domain adaptation using real-world healthcare time-series data. We choose healthcare data for two primary reasons. (1) Currently, a standard protocol in healthcare is to build, evaluate, and deploy machine learning models for particular datasets that may perform poorly on unseen datasets with different distributions. For example, models built around patient data from particular age groups perform poorly on other age groups because the features used to train the models have different distributions across the groups (Alemayehu & Warner (2004); Lao et al. (2004); Seshamani & Gray (2004)). Knowledge learned from one group is not transferrable to the other group. Domain adaptation seems like a natural solution to this problem as knowledge needs to be transferred across domains which share features that exhibit different distributions. (2) Healthcare data has multiple attributes recorded per patient visit, and it is longitudinal and episodic in nature. Thus, healthcare data is a suitable platform on which to study a model which seeks to capture complex temporal representations and transfer this knowledge across domains.
34
+
35
+ The rest of the paper is structured as follows. In the following section, we briefly discuss the current state-of-the-art deep domain adaptation approaches. Afterwards, we present our model mathematically, detailing how it simultaneously learns to capture temporal latent dependencies and create domain-invariant representations. In Section 4, we compare and contrast the performance of proposed approach with other approaches on two real-world health care datasets, and provide analysis on our domain-invariant representations.
36
+
37
+ # 2 RELATED WORK
38
+
39
+ Domain adaptation is a specific instance of transfer learning in which the feature spaces are shared but their marginal distributions are different. A good survey on the two has been done in several previous works (Pan & Yang (2009); Jiang (2008); Patel et al. (2015)). Domain adaptation has been thoroughly studied in computer vision(Saenko et al. (2010); Gong et al. (2012); Fernando et al. (2013)) and natural language processing (NLP) (Blitzer (2007); Foster et al. (2010)) applications. Recently, the deep learning paradigm has become popular in domain adaptation (Chen et al. (2012); Tzeng et al. (2015); Yang & Eisenstein; Long & Wang (2015)) due to its ability to learn rich, flexible, non-linear domain-invariant representations. Here, we briefly discuss two deep domain adaptation approaches which are closely related to our proposed model. Domain Adversarial Neural Networks (DANN)
40
+
41
+ ![](images/cdec1408957e6500c20e8bea104c23b625844077c8fbf34a2b1ef94f9c4d6fa5.jpg)
42
+ Figure 2: Block diagram of VRADA. Blue lines show the inference process, $q _ { \theta _ { e } } \left( z _ { t } | \boldsymbol { x } _ { \le t } , \boldsymbol { z } _ { < t } \right)$ . Brown lines show the generation process, $p _ { \theta _ { g } } ( x _ { t } | \boldsymbol { z } _ { \le t } , \boldsymbol { x } _ { < t } )$ . Red lines show the recurrence process where $h _ { t }$ is informed by $h _ { t - 1 }$ , which is informed by $z _ { t - 1 }$ and $x _ { t - 1 }$ . Black lines indicate classification.
43
+
44
+ (Ganin et al. (2016)) is a deep domain adaptation model which uses two core components to create domain-invariant representations, a feature extractor that produces the data’s latent representation, and an adversarial domain labeler that attempts to classify that data’s domain to help the feature extractor produce latent representations which are domain-invariant. In Louizos et al. (2015), the authors propose Variational Fair AutoEncoder, which uses Variational Autoencoding architecture (Kingma & Welling (2013)) to learn latent representations where most of the information about certain known factors of variation are purged from the representation while still retaining as much information about the data as possible. While, these deep learning approaches learn domain-invariant representations, they fail to capture and transfer the underlying complex temporal latent relationships from one domain to another as they use convolutional or feed forward neural networks which we claim are not suitable for multivariate time-series data.
45
+
46
+ Other works such as Huang & Yates (2009); Xiao & Guo (2013) have used distributed representations for domain adaptation in NLP sequence labeling tasks. However, they either induce hidden states as latent features using dynamic Bayesian networks (DBNs) or learn generalizable distributed representations of words using Recurrent Neural Networks (RNN) (Socher et al. (2011)) to enable domain adaptation. These works either model the highly non-linear dynamics, as one can with RNN, or capture the complex latent dependencies present in sequential data, as one can with DBNs, but not both. To overcome the challenges of DBNs and RNNs, Variational Recurrent Neural Network (VRNN)( Chung et al. (2016)) was proposed recently to capture the complex relationship between the underlying hidden factors of variation and the output variables at different time-steps. The VRNN uses Variational Autoencoders (VAEs)( Kingma & Welling (2013); Goodfellow et al. (2016)) at each time-step to learn a complex relationship between the latent hidden factors across time-steps. Like the VAE, its latent variable is parametric. Combined, these things make it well-suited for multimodal sequential data such as multivariate time-series. In the following section, we discuss our approach, Variational Adversarial Deep Domain Adaptation (VRADA), which uses a VRNN to model and transfer complex domain-invariant temporal latent relationships for unsupervised domain adaptation of multivariate time-series.
47
+
48
+ # 3 VARIATIONAL RECURRENT ADVERSARIAL DEEP DOMAIN ADAPTATION
49
+
50
+ In this section, we present our Variational Recurrent Adversarial Deep Domain Adaptation (VRADA) model for the purpose of capturing and transferring temporal latent dependencies across domains via domain-invariant representations. First, we introduce the notations used in this paper and then discuss our VRADA model in detail.
51
+
52
+ # 3.1 NOTATIONS
53
+
54
+ Let us denote a multivariate variable-length time series with $N$ data samples as $\{ \mathbf { x ^ { i } } = ( x _ { t } ^ { i } ) _ { t = 1 } ^ { T ^ { i } } \} _ { i = 1 } ^ { N }$ where . (Note: in our experiments, for all data samples , but for generality we maintain $T ^ { i }$ ). We denote $\{ \mathbf { x } _ { \mathcal { S } } ^ { \mathbf { i } } \} _ { i = 1 } ^ { n }$ as source domain data and $\{ \dot { \mathbf { x } } _ { \mathcal { T } } ^ { \mathbf { i } } \} _ { i = n + 1 } ^ { N }$ as target domain data. We assume that each source domain data sample $\mathbf { x } _ { \mathcal { S } } ^ { \mathbf { i } }$ comes with $L$ labels $y _ { i } \in \{ 0 , 1 \} ^ { L }$ (for example, these labels may correspond to a clinical outcome such as mortality or ICD9 diagnosis codes), while target domain has no labeled data samples. We assign a domain label $d _ { i } \in \{ 0 , 1 \}$ to each data sample to indicate if it comes from the source or target domain. $d _ { i }$ will be used for adversarial training.
55
+
56
+ # 3.2 VRADA
57
+
58
+ The block diagram of our VRADA model is shown in Figure 2. To explicitly model the dependencies between the latent random variable across time steps, the VRADA model utilizes Variational Recurrent Neural Networks (VRNN) (Chung et al. (2016)). The VRNN effectively contains a Variational AutoEncoders (Kingma & Welling (2013)) at every time step, all of which are conditioned on previous auto-encoders via the hidden state $h _ { t - 1 }$ of an RNN, such as an LSTM (Hochreiter & Schmidhuber (1997)). Therefore, for each time-step of $\ v { x } _ { t } ^ { i }$ , we infer a latent random variable $z _ { t } ^ { i }$ via
59
+
60
+ $$
61
+ \begin{array} { r } { z _ { t } ^ { i } | x _ { t } ^ { i } \sim \mathcal { N } ( \mu _ { z , t } , \mathrm { d i a g } ( \sigma _ { z , t } ) ) , \quad \mathrm { w h e r e } \ [ \mu _ { z , t } , \sigma _ { z , t } ] = \varphi _ { \tau } ^ { e n c } ( \varphi _ { \tau } ^ { x } ( x _ { t } ^ { i } ) , h _ { t - 1 } ) } \end{array}
62
+ $$
63
+
64
+ with prior
65
+
66
+ $$
67
+ z _ { t } ^ { i } \sim \mathcal { N } ( \mu _ { 0 , t } , \mathrm { d i a g } ( \sigma _ { 0 , t } ) ) , \quad \mathrm { w h e r e } \ [ \mu _ { 0 , t } , \sigma _ { 0 , t } ] = \varphi _ { \tau } ^ { p r i o r } ( h _ { t - 1 } )
68
+ $$
69
+
70
+ where $\mu _ { * , t } , \sigma _ { * , t }$ denote parameters of a generating distribution, and $\boldsymbol { \varphi } _ { \tau } ^ { \ast }$ can be any highly flexible function such as deep neural networks. For each $z _ { t } ^ { i } , x _ { t } ^ { i }$ is generated via
71
+
72
+ $$
73
+ x _ { t } ^ { i } | z _ { t } ^ { i } \sim { \mathcal { N } } ( \mu _ { x , t } , \mathrm { d i a g } ( \sigma _ { x , t } ) ) , \quad { \mathrm { w h e r e ~ } } [ \mu _ { x , t } , \sigma _ { x , t } ] = \varphi _ { \tau } ^ { d e c } ( \varphi _ { \tau } ^ { z } ( z _ { t } ^ { i } ) , h _ { t - 1 } )
74
+ $$
75
+
76
+ and learned by optimizing the VRNN objective function:
77
+
78
+ $$
79
+ \overset { \cdot } { \underset { t = t } { \cdot } } ( x _ { t } ^ { i } ; \theta _ { \epsilon } , \theta _ { g } ) = E _ { q _ { \theta _ { \epsilon } } ( z _ { \leq T ^ { i } } ^ { i } | x _ { \leq T ^ { i } } ^ { i } ) } [ \underset { t = 1 } { \overset { T ^ { i } } { \sum } } ( - D ( q _ { \theta _ { \epsilon } } ( z _ { t } ^ { i } | x _ { \leq t } ^ { i } , z _ { < t } ^ { i } ) | | p ( z _ { t } ^ { i } | x _ { < t } ^ { i } , z _ { < t } ^ { i } ) ) + \log p _ { \theta _ { g } } ( x _ { t } ^ { i } | z _ { \leq t } ^ { i } , x _ { < t } ^ { i } ) ) ] .
80
+ $$
81
+
82
+ where $q _ { \theta _ { e } } \big ( z _ { t } ^ { i } | \boldsymbol { x } _ { \le t } ^ { i } , \boldsymbol { z } _ { < t } ^ { i } \big )$ is the inference model, $p ( z _ { t } ^ { i } | x _ { < t } ^ { i } , z _ { < t } ^ { i } )$ is the prior, $p _ { \theta _ { g } } ( x _ { t } ^ { i } | \boldsymbol { z } _ { \le t } ^ { i } , x _ { < t } ^ { i } )$ is the generative model, $\theta _ { e }$ is the parameters of the VRNN’s encoder, $\theta _ { g }$ the parameters of the VRNN’s decoder, and $D ( \cdot | | \cdot )$ refers to KL-Divergence. Note: $z _ { \le T }$ refers to the set of all $z _ { t }$ such that $t \leq T$ , likewise for $z _ { < T }$ . For each $\mathbf { x ^ { i } }$ , we use $\tilde { z } ^ { i } \sim q _ { \theta _ { e } } ( z _ { T ^ { i } } ^ { i } | x _ { \le T ^ { i } } ^ { i } , z _ { < T ^ { i } } ^ { i } )$ as our feature representation for source domain classification task since it captures temporal latent dependencies across the time-steps. Training the VRNN for the source domain classification involves solving the following optimization:
83
+
84
+ $$
85
+ \operatorname* { m i n } _ { \theta _ { e } , \theta _ { g } , \theta _ { y } } \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { 1 } { T ^ { i } } \mathcal { L } _ { r } ( \mathbf { x ^ { i } } ; \theta _ { e } , \theta _ { g } ) + \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathcal { L } _ { y } ( \mathbf { x ^ { i } } ; \theta _ { y } , \theta _ { e } ) + \lambda \mathcal { R } ( \theta _ { e } )
86
+ $$
87
+
88
+ where $\mathcal { R } ( \theta _ { e } )$ is a regularizer for the parameters of VRNN encoder (which is also the feature extractor of VRADA) with a tuning hyperparameter $\lambda$ .
89
+
90
+ As we are interested in achieving domain adaptation via the latent representation $\tilde { z } ^ { i }$ (i.e. to make $\tilde { z } ^ { i }$ domain-invariant), we can adversarially train the above objective function (equation 1) by employing the domain adaptation idea proposed in Ganin et al. (2016). Let $G _ { y } ( \tilde { z } ^ { i } ; \theta _ { y } )$ and $G _ { d } ( \tilde { z } ^ { i } ; \theta _ { d } )$ represent the source label classifier (to predict source labels $y _ { i }$ ) and domain label classifier (to predict domain labels $d _ { i }$ ) respectively with parameters $\theta _ { y }$ and $\theta _ { d }$ for a given input $\tilde { z } ^ { i }$ . Here, $G _ { y } ( . )$ and $G _ { d } ( . )$ can be deep neural networks. Let us denote their loss functions respectively as
91
+
92
+ $$
93
+ \mathcal { L } _ { y } ( \mathbf { x ^ { i } } ; \theta _ { y } , \theta _ { e } ) = \mathcal { L } _ { B } ( G _ { y } ( V _ { e } ( \mathbf { x ^ { i } } ; \theta _ { e } ) ; \theta _ { y } ) , y _ { i } ) ; \quad \mathcal { L } _ { d } ( \mathbf { x ^ { i } } ; \theta _ { d } , \theta _ { e } ) = \mathcal { L } _ { B } ( G _ { d } ( V _ { e } ( \mathbf { x ^ { i } } ; \theta _ { e } ) ; \theta _ { d } ) , d _ { i } )
94
+ $$
95
+
96
+ where $\mathcal { L } _ { B }$ is the classification loss such as a binary or categorical cross-entropy loss function and $V _ { e } ( \mathbf { x } ^ { \mathbf { i } } ; \theta _ { e } )$ is the VRNN encoder that maps input $\mathbf { x ^ { i } }$ to $\tilde { z } ^ { i }$ .
97
+
98
+ Now, for adversarial training, we consider the following domain adaptation term as the regularizer of equation 1.
99
+
100
+ $$
101
+ \mathcal { R } ( \theta _ { e } ) = \operatorname* { m a x } _ { \theta _ { d } } \Big [ - \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathcal { L } _ { d } ( \mathbf { x } ^ { \mathbf { i } } ; \theta _ { d } , \theta _ { e } ) - \frac { 1 } { n ^ { \prime } } \sum _ { i = n + 1 } ^ { N } \mathcal { L } _ { d } ( \mathbf { x } ^ { \mathbf { i } } ; \theta _ { d } , \theta _ { e } ) \Big ]
102
+ $$
103
+
104
+ where $n ^ { \prime }$ is the number of target domain samples. As shown in Ganin et al. (2016), $\mathcal { R }$ is the domain regularizer and it is derived from the empirical $\varkappa -$ divergence between the source domain and target domain samples( Ben-David et al. (2010)).
105
+
106
+ Combining the joint optimization problem of equations 1 and 2 leads to our VRADA model, where we minimize the source classification risk and at the same time achieve domain adaptation. Mathematically, we optimize the following complete objective function:
107
+
108
+ $$
109
+ \boldsymbol { \mathrm { 5 } } ( \theta _ { e } , \theta _ { g } , \theta _ { y } , \theta _ { d } ) = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \frac { 1 } { T ^ { i } } \mathcal { L } _ { r } ( \mathbf { x } ^ { \mathbf { i } } ; \theta _ { e } , \theta _ { g } ) + \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathcal { L } _ { y } ( \mathbf { x } ^ { \mathbf { i } } ; \theta _ { y } ) - \boldsymbol { \lambda } ( \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathcal { L } _ { d } ( \mathbf { x } ^ { \mathbf { i } } ; \theta _ { d } ) + \frac { 1 } { n ^ { \prime } } \sum _ { i = n + 1 } ^ { N } \mathcal { L } _ { d } ( \mathbf { x } ^ { \mathbf { i } } ; \theta _ { d } ) ) = \frac { 1 } { n }
110
+ $$
111
+
112
+ where $\lambda$ is a trade-off between optimizing on making domain-invariant representations and optimizing source classification accuracy. Our optimization involves minimization with respect to some parameters, and maximization with respect to the others, i.e., we iteratively solve the following:
113
+
114
+ $$
115
+ \begin{array} { c } { { ( \hat { \theta } _ { g } , \hat { \theta } _ { y } , \hat { \theta } _ { e } ) = \arg \underset { \theta _ { g } , \theta _ { y } , \theta _ { e } } { \operatorname* { m i n } } E ( \theta _ { e } , \theta _ { g } , \theta _ { y } , \hat { \theta } _ { d } ) } } \\ { { \hat { \theta } _ { d } = \arg \underset { \theta _ { d } } { \operatorname* { m a x } } E ( \hat { \theta } _ { e } , \hat { \theta } _ { g } , \hat { \theta } _ { y } , \theta _ { d } ) } } \end{array}
116
+ $$
117
+
118
+ with the gradient updates calculated as:
119
+
120
+ $$
121
+ \begin{array} { r } { \theta _ { e } \theta _ { e } - \eta ( \frac { \partial \mathcal { L } _ { r } } { \partial \theta _ { e } } + \frac { \partial \mathcal { L } _ { y } } { \partial \theta _ { y } } - \lambda \frac { \partial \mathcal { L } _ { d } } { \partial \theta _ { d } } ) } \\ { \theta _ { g } \theta _ { g } - \eta \frac { \partial \mathcal { L } _ { r } } { \partial \theta _ { g } } } \\ { \theta _ { d } \theta _ { d } - \eta \frac { \partial \mathcal { L } _ { d } } { \partial \theta _ { d } } } \\ { \theta _ { y } \theta _ { y } - \eta \lambda \frac { \partial \mathcal { L } _ { y } } { \partial \theta _ { y } } } \end{array}
122
+ $$
123
+
124
+ where $\eta$ is the learning rate. We can use stochastic gradient descent (SGD) to solve the equations (5-7). To solve equation (4), we can use SGD and the gradient reversal layer (GRL)(Ganin et al. (2016)). The role of GRL is to reverse the gradient sign while performing backpropagation. This ensures that the domain classification loss is maximized which makes the feature representations domain-invariant.
125
+
126
+ Thus, VRADA results in learning feature representations which are domain-invariant (due to domain regressor $\mathcal { R }$ ) and which capture the temporal latent dependencies (due to optimizing VRNN objective function $\mathcal { L } _ { r }$ ). These things combine to allow the VRADAs’ discriminative power on the source domain to transfer to the target domain.
127
+
128
+ # 4 EXPERIMENTS
129
+
130
+ We conduct experiments on two real-world health care datasets to answer the following questions: (a) How does our VRADA model perform when compared to the state-of-the-art domain adaptation and non-adaptation approaches? (b) How different are the domain-invariant representations learned by various domain adaptation methods? (c) How do we show that the temporal latent dependencies are transferred between domains? In the remainder of this section, we will describe the datasets, methods, empirical results, and show visualizations to answer the above questions.
131
+
132
+ # 4.1 DATASET DESCRIPTION
133
+
134
+ We conduct experiments on two health care datasets, including the MIMIC-III dataset and a Pediatric ICU (PICU) dataset from Children’s Hospital Los Angeles.
135
+
136
+ MIMIC-III( Johnson et al. (2016)) is a public dataset with deidentified clinical care data collected at Beth Israel Deaconess Medical Center from 2001 to 2012. It contains over 58,000 hospital admission records of 38,645 adults and 7,875 neonates. For our experiments, we extracted the following two datasets:
137
+
138
+ • Adult-AHRF dataset: To study domain adaptation for adult patients with acute hypoxemic respiratory failure (AHRF), we extracted 20 time series features (such as Base excess, blood pH value, Mean Air Pressure, PaO2, etc.) from 5527 admission records based on Khemani et al. (2009). We grouped the patients into 4 groups/cohorts based on their age[1] - Group 2: working-age adult (20 to 45 yrs, 508 patients); Group 3: old working-age adult (46 to 65 yrs, 1888 patients); Group 4: elderly (66 to 85 yrs, 2394 patients); Group 5: old elderly (85 yrs and up, 437 patients). We treated each group as a separate domain with which we could perform domain adaptation. For each patient, we used the first 4 day after admission (with each day serving as a single time-step) as time series data for training and testing our models.
139
+
140
+ • ICD9 dataset: For this dataset we extracted 99 time series features from 19714 admission records from 4 modalities including input-events (fluids into patient, e.g., insulin), outputevents (fluids out of the patient, e.g., urine), lab-events (lab test results, e.g., blood pH values, platelet count, etc.) and prescription-events (drugs prescribed by doctors, e.g., aspirin, potassium chloride, etc.). These modalities are known to be extremely useful for monitoring ICU patients. All the time series are of more than 48 hours of duration, and only the first 24 hours (after admission) 2-hourly sampled time series data is used for training and testing our models. We use this dataset to predict the ICD9 Diagnosis code categories for each patient’s admission record.
141
+
142
+ Child-AHRF dataset: This is a PICU dataset which contains health records of 398 children patient with acute hypoxemic respiratory failure in the intensive care unit at Children’s Hospital Los Angeles (CHLA)(Khemani et al. (2009)). Similar to Adult-AHRF, this dataset has 20 time series features collected for 4 days after ICU admission. This dataset is considered as one group (Group 1: children, age 0 to 19 yrs) and represents one domain.
143
+
144
+ # 4.1.1 PREDICTION AND DOMAIN ADAPTATION TASKS
145
+
146
+ Mortality Prediction: For Adult-AHRF and Child-AHRF datasets, we are interested in predicting mortality, i.e. whether a patient dies from AHRF during their hospital stay. $2 0 . 1 0 \%$ of all the patients in Child-AHRF and $1 3 . 8 4 \%$ of all patients in Adult-AHRF have a positive mortality label (i.e. the patients who die in hospital).
147
+
148
+ ICD9 Code Prediction: Each admission record in MIMIC-III dataset has multiple ICD-9 diagnosis codes. We group all the occurrences of the ICD-9 codes into 20 diagnosis groups[2]. For the ICD9 dataset, we are interested in predicting these 20 ICD-9 Diagnosis Categories for each admission record. We treat this as a multi-task prediction problem.
149
+
150
+ Domain Adaptation Tasks: We study unsupervised domain adaptation (i.e. target domain labels are unavailable during training and validation) task with-in age groups of Adult-AHRF dataset, ICD9 dataset and across Adult and Child-AHRF datasets. For Adult-AHRF and ICD9 datasets, we created 12 source-target domain pairs using the age groups, pairing up each domain $D _ { i }$ with another domain $D _ { j \neq i }$ , for example, the source-target pair 2-5 was used for adapting from group 2 (working-age adult) to group 5 (old elderly). We also created 4 source-target pairs for performing domain adaptation from 4 adult age-groups to 1 child age-group.
151
+
152
+ # 4.2 METHODS AND IMPLEMENTATION DETAILS
153
+
154
+ We categorize the methods used in our main experiments into the following groups:
155
+
156
+ • Non-adaptive baseline methods: Logistic Regression (LR), Adaboost with decision regressors (Adaboost), and feed forward deep neural networks (DNN) Deep Domain adaptation methods: Domain Adversarial Neural Networks (DANN) (Ganin et al. (2016)); DANN with a RNN (LSTM) as feature extractor (R-DANN); Variational Fair Autocoder (VFAE)(Louizos et al. (2015))
157
+ • Our method: Variational Recurrent Adversarial Deep Domain Adaptation (VRADA)[3].
158
+
159
+ In all our experiments, we conducted unsupervised domain adaptation where target domain labels are unavailable during training and validation. For R-DANN, we used LSTM(Hochreiter & Schmidhuber (1997)) as the feature extractor network instead of the feed-forward neural networks used in DANN. For VFAE, DANN and all the non-domain adaptive approaches we flattened the time series along time axis and treat it as the input to the model. For fairness, the classifier and feature extractors of the VRADA and R-DANN were equivalent in depth and both had the same model capacity. We also ensure that the size of latent feature representation $\tilde { z } ^ { i }$ are similar for VRADA and DANN models. The model capacity of VFAE was chosen to be similar to VRADA. All the deep domain adaptation models including ours had depth of size 8 (including output classifier layers). We used the Adam optimizer ( Kingma & Ba (2014)) and ran all models for 500 epochs with a learning rate of $3 e { - 4 }$ We set an early stopping criteria that the model does not experience a decrease in the validation loss for 20 epochs. Source domain data was split into train/validation subsets with a 70/30 ratio and target domain data into train/validation/test subsets with a 70/15/15 ratio. In order to compare all the methods, we report AUC scores on the entire target domain set, and the test subset for each target domain data of a source-target pair.
160
+
161
+ # 4.3 QUANTITATIVE RESULTS
162
+
163
+ In Table 1, we compare non domain adaptation and domain adaptation models’ performance on the target domain test subset for the AHRF mortality prediction task. It is immediately clear that domain adaptation methods consistently outperform non domain adaptation methods. We see that generally the VRADA outperforms both variants of the DANN with it consistently seeing scores $\sim 4 \%$ higher. While the standard deviation for the VRADA was about $1 \%$ , it was about $2 \%$ for the R-DANN, further showing our models efficacy as it converges to more stable local optima. Our model VRADA beats state-of-the-art DANN(Ganin et al. (2016)) and VFAE(Louizos et al. (2015)) on all the source-pair domain adaptation tasks for Adult-AHRF dataset. For the domain adaptation from Adult-AHRF to Child-AHRF dataset, we observe that VRADA mostly outperforms all the competing models. This shows that our model can perform well even for smaller target domain datasets.
164
+
165
+ Table 1: AUC Comparison for AHRF Mortality Prediction task with and without Domain Adaptation
166
+
167
+ <table><tr><td>Source-Target</td><td>LR</td><td>Adaboost</td><td>DNN</td><td>DANN</td><td>VFAE</td><td>R-DANN</td><td>VRADA</td></tr><tr><td>3-2</td><td>0.555</td><td>0.562</td><td>0.569</td><td>0.572</td><td>0.615</td><td>0.603</td><td>0.654</td></tr><tr><td>4-2</td><td>0.624</td><td>0.645</td><td>0.569</td><td>0.589</td><td>0.635</td><td>0.584</td><td>0.656</td></tr><tr><td>5-2</td><td>0.527</td><td>0.554</td><td>0.551</td><td>0.540</td><td>0.588</td><td>0.611</td><td>0.616</td></tr><tr><td>2-3</td><td>0.627</td><td>0.621</td><td>0.550</td><td>0.563</td><td>0.585</td><td>0.708</td><td>0.724</td></tr><tr><td>4-3</td><td>0.681</td><td>0.636</td><td>0.542</td><td>0.527</td><td>0.722</td><td>0.821</td><td>0.770</td></tr><tr><td>5-3</td><td>0.655</td><td>0.706</td><td>0.503</td><td>0.518</td><td>0.608</td><td>0.769</td><td>0.782</td></tr><tr><td>2-4</td><td>0.585</td><td>0.591</td><td>0.530</td><td>0.560</td><td>0.582</td><td>0.716</td><td>0.777</td></tr><tr><td>3-4</td><td>0.652</td><td>0.629</td><td>0.531</td><td>0.527</td><td>0.697</td><td>0.769</td><td>0.764</td></tr><tr><td>5-4</td><td>0.689</td><td>0.699</td><td>0.538</td><td>0.532</td><td>0.614</td><td>0.728</td><td>0.738</td></tr><tr><td>2-5</td><td>0.565</td><td>0.543</td><td>0.549</td><td>0.526</td><td>0.555</td><td>0.659</td><td>0.719</td></tr><tr><td>3-5</td><td>0.576</td><td>0.587</td><td>0.510</td><td>0.526</td><td>0.533</td><td>0.630</td><td>0.721</td></tr><tr><td>4-5</td><td>0.682</td><td>0.587</td><td>0.575</td><td>0.548</td><td>0.712</td><td>0.747</td><td>0.775</td></tr><tr><td>5-1</td><td>0.502</td><td>0.573</td><td>0.557</td><td>0.563</td><td>0.618</td><td>0.563</td><td>0.639</td></tr><tr><td>4-1</td><td>0.565</td><td>0.533</td><td>0.572</td><td>0.542</td><td>0.668</td><td>0.577</td><td>0.636</td></tr><tr><td>3-1</td><td>0.500</td><td>0.500</td><td>0.542</td><td>0.535</td><td>0.570</td><td>0.591</td><td>0.631</td></tr><tr><td>2-1</td><td>0.520</td><td>0.500</td><td>0.534</td><td>0.559</td><td>0.578</td><td>0.630</td><td>0.637</td></tr></table>
168
+
169
+ In the above table, we test classification without adaptation using Logistic Regression (LR), Adaboost with decision tree classifiers and Feed forward Deep Neural Networks (DNN); and with adaptation using Deep Domain Adversarial Neural Networks (DANN), a DANN with an LSTM in its feature extractor (R-DANN), Variational Fair Autoencoder (VFAE) and our Variational Adversarial Domain Adaptation Model (VRADA). All results are reported on the target domain test subset dataset.
170
+
171
+ As the AHRF mortality prediction task made it clear that domain adaptation is necessary for intergroup adaptation, for the ICD9 multi-task prediction task that involved data with time-steps of length 12, we focused strictly on domain adaptive models (i.e. the DANN, R-DANN, and VRADA). Table 2 shows the aggregated AUC scores on the entire target domain dataset and test data of the target domain for the 20 tasks of the ICD9 Code Prediction task. Here, we clearly see that VRADA and
172
+
173
+ Table 2: AUC Comparison for ICD9 Diagnosis Code Prediction task
174
+
175
+ <table><tr><td>Model</td><td></td><td>23</td><td>24</td><td>25</td><td>32</td><td>34</td><td>35</td><td>42 43</td><td>45</td><td>52</td><td>53</td><td></td><td>54</td></tr><tr><td rowspan="2">DANN</td><td>entire target</td><td>0.513</td><td>0.508</td><td>0.509</td><td>0.511</td><td>0.508</td><td>0.514</td><td>0.511</td><td>0.507</td><td>0.512</td><td>0.505</td><td>0.508</td><td>0.506</td></tr><tr><td>target test</td><td>0.509</td><td>0.513</td><td>0.531</td><td>0.527</td><td>0.515</td><td>0.531</td><td>0.515</td><td>0.521</td><td>0.521</td><td>0.518</td><td>0.514</td><td>0.519</td></tr><tr><td rowspan="2">R-DANN</td><td>entire target</td><td>0.608</td><td>0.581</td><td>0.562</td><td>0.618</td><td>0.610</td><td>0.586</td><td>0.604</td><td>0.607</td><td>0.575</td><td>0.573</td><td>0.558</td><td>0.566</td></tr><tr><td>target test</td><td>0.605</td><td>0.579</td><td>0.570</td><td>0.628</td><td>0.609</td><td>0.589</td><td>0.614</td><td>0.616</td><td>0.586</td><td>0.573</td><td>0.563</td><td>0.564</td></tr><tr><td rowspan="2">VRADA</td><td>entire target</td><td>0.620</td><td>0.564</td><td>0.557</td><td>0.611</td><td>0.617</td><td>0.580</td><td>0.598</td><td>0.615</td><td>0.588</td><td>0.571</td><td>0.582</td><td>0.576</td></tr><tr><td>target test</td><td>0.609</td><td>0.563</td><td>0.560</td><td>0.620</td><td>0.617</td><td>0.580</td><td>0.606</td><td>0.623</td><td>0.594</td><td>0.576</td><td>0.581</td><td>0.576</td></tr></table>
176
+
177
+ Here, we compare results for the ICD9 Diagnosis Code Prediction task on the ICD9 dataset. For each model, the top row corresponds to the performance on the entire target domain dataset and the bottom row corresponds to performance on the test subset $( 1 5 \% )$ of the target domain dataset.
178
+
179
+ R-DANN models outperform DANN Ganin et al. (2016) by significant margins. We also observe that VRADA outperforms R-DANN by $1 . 5 \sim 2 \%$ when averaged over all the source-target domain pairs.
180
+
181
+ # 4.4 DISCUSSION
182
+
183
+ Figure 3 shows the temporal latent dependencies captured by our VRADA as compared to the R-DANN for $_ { 3 - 4 }$ source-target pair. While both models learn temporal latent dependencies fairly well, the VRADA outperforms the R-DANN in two ways. First, the VRADA’s neurons learned stronger predictions of whether features are relevant towards modeling the data. If we look at the VRADA row, for both AHRF and ICD9 we see that the neural activation patterns are more consistent across time-steps than for R-DANN. Figure 4 shows the unrolled memory cell states (in the form Examples $\times$ (Time $^ *$ Neurons)) for all the source and target domain data points. We see a consistent activation firing patterns across all these data points for VRADA but not for R-DANN. Together with the stronger performance on 3-4 for AHRF and 2-5 for ICD9, this potentially indicates that VRADA is better learning the temporal dependencies.
184
+
185
+ Second, nuanced values are consistent across time-steps for the VRADA, exhibiting a gradual transition towards stronger activation with time, whereas the temporal activation pattern of the RDANN seems somewhat sporadic. While activation gradients across time are consistent for both the R-DANN and VRADA, more consistent inhibitory and excitatory neuron firing patterns indicate that the VRADA better transfers knowledge. Another indication of domain adaptation was shown in Figure 1c. Looking at the t-SNE projections of feature representations of DNN, R-DANN, and VRADA we can see that the addition of temporal latent dependencies might help in better mixing of the domain distributions since we observe that the data is more evenly spread out. Figure 1c and Figure 3 together indicate that the VRADA’s temporal latent dependency capturing power and ability to create domain-invariant representations act synergistically. For plots of activation patterns without domain adaptation, please see appendix section 6.2.3.
186
+
187
+ # 5 SUMMARY
188
+
189
+ Because of its diverse range of patients and its episodic and longitudal nature, healthcare data provides a good platform to test domain adaptation techniques for temporal data. With it as our example, we showcase the Variational Recurrent Adversarial Domain Adaptation (VRADA) model’s ability to learn temporal latent representations that are domain-invariant. By comparing our model’s latent representations to others’, we show its ability to use variational methods to capture hidden factors of variation and produce more robust domain-invariant representations. We hope this work serves as a bedrock for future work capturing and adapting temporal latent representations across domains.
190
+
191
+ # ACKNOWLEDGMENTS
192
+
193
+ This material is based upon work supported by the NSF research grants IIS-1134990, IIS-1254206, Samsung GRO Grant and the NSF Graduate Research Fellowship Program under Grant No. DGE1418060. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the funding agencies. We also acknowledge Thailand’s Development and Promotion of Science and Technology Talents Project for financial support. We thank Dr. Robinder Khemani for sharing the Child-AHRF dataset.
194
+
195
+ ![](images/11fd6effccc792ff6631410da5d3ddcbc541c54cada9fc944919d2dd3bbc9116.jpg)
196
+ Figure 3: Cell states of memory cell for R-DANN and VRADA showing temporal latent dependencies captured by neurons of the R-DANN and VRADA for the source domain and transferred to the target domain. Each step along the y-axis refers to the activation of a single neuron with blue for strong inhibition and yellow for strong excitation. Step along the $\mathbf { X }$ -axis refers to activation per time-step. The left shows a single example in adapting 3-4 and the right for adapting 2-5.
197
+
198
+ ![](images/060dc22ac9abe81f633425af9fdaa8d121d2cdde4fbca74f78c03160c0517434.jpg)
199
+ Figure 4: Cell states of memory cell for R-DANN and VRADA showing activation for all ICD9 2-5 adaptation examples. Here, we show temporal dependencies learned across time, feature pairs for examples in a domain. The y-axis values refer to values per data point and the $\mathbf { X }$ -axis shows activation at time, feature pairs with the time and feature dimensions being flattened.
200
+
201
+ # REFERENCES
202
+
203
+ Berhanu Alemayehu and Kenneth E Warner. The lifetime distribution of health care costs. Health services research, 39(3):627–642, 2004.
204
+
205
+ S Ben-David, J Blitzer, and K Crammer. Analysis of representations for domain adaptation. Advances in Neural . . . , pp. 137–144, 2007.
206
+
207
+ Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman Vaughan. A theory of learning from different domains. Machine learning, 79(1-2):151–175, 2010.
208
+
209
+ John Blitzer. Domain adaptation of natural language processing systems. PhD thesis, University of Pennsylvania, 2007.
210
+
211
+ Minmin Chen, Zhixiang Xu, Kilian Weinberger, and Fei Sha. Marginalized denoising autoencoders for domain adaptation. arXiv preprint arXiv:1206.4683, 2012.
212
+
213
+ Junyoung Chung, Kyle Kastner, Laurent Dinh, Kratarth Goel, Aaron Courville, and Yoshua Bengio. A Recurrent Latent Variable Model for Sequential Data. arXiv.org, May 2016.
214
+
215
+ Basura Fernando, Amaury Habrard, Marc Sebban, and Tinne Tuytelaars. Unsupervised visual domain adaptation using subspace alignment. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2960–2967, 2013.
216
+
217
+ George Foster, Cyril Goutte, and Roland Kuhn. Discriminative instance weighting for domain adaptation in statistical machine translation. In Proceedings of the 2010 Conference on Empirical Methods in Natural Language Processing, pp. 451–459. Association for Computational Linguistics, 2010.
218
+
219
+ Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. arXiv preprint arXiv:1409.7495, 2014.
220
+
221
+ Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, Franc¸ois Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The Journal of Machine Learning Research, 17(1), 2016.
222
+
223
+ Boqing Gong, Yuan Shi, Fei Sha, and Kristen Grauman. Geodesic flow kernel for unsupervised domain adaptation. In Computer Vision and Pattern Recognition (CVPR), 2012 IEEE Conference on, pp. 2066–2073. IEEE, 2012.
224
+
225
+ Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep Learning. Mit Press, December 2016.
226
+
227
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
228
+
229
+ Fei Huang and Alexander Yates. Distributional representations for handling sparsity in supervised sequence-labeling. In Proceedings of the Joint Conference of the 47th Annual Meeting of the ACL and the 4th International Joint Conference on Natural Language Processing of the AFNLP: Volume 1-Volume 1, pp. 495–503. Association for Computational Linguistics, 2009.
230
+
231
+ Jing Jiang. A literature survey on domain adaptation of statistical classifiers. URL: http://sifaka. cs. uiuc. edu/jiang4/domainadaptation/survey, 2008.
232
+
233
+ Jing Jiang and ChengXiang Zhai. Instance weighting for domain adaptation in nlp. In ACL, volume 7, pp. 264–271, 2007.
234
+
235
+ AEW Johnson, TJ Pollard, L Shen, L Lehman, M Feng, M Ghassemi, B Moody, P Szolovits, LA Celi, and RG Mark. Mimic-iii, a freely accessible critical care database. Scientific Data, 2016.
236
+
237
+ Robinder G Khemani, David Conti, Todd A Alonzo, Robert D Bart III, and Christopher JL Newth. Effect of tidal volume in children with acute hypoxemic respiratory failure. Intensive care medicine, 35(8):1428–1437, 2009.
238
+
239
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014. URL http://arxiv.org/abs/1412.6980.
240
+
241
+ Diederik P Kingma and Max Welling. Auto-Encoding Variational Bayes. arXiv.org, December 2013.
242
+
243
+ Zhiqiang Lao, Dinggang Shen, Zhong Xue, Bilge Karacali, Susan M Resnick, and Christos Davatzikos. Morphological classification of brains via high-dimensional shape transformations and machine learning methods. Neuroimage, 21(1):46–57, 2004.
244
+
245
+ Mingsheng Long and Jianmin Wang. Learning transferable features with deep adaptation networks. CoRR, abs/1502.02791, 1:2, 2015.
246
+
247
+ Christos Louizos, Kevin Swersky, Yujia Li, Max Welling, and Richard Zemel. The variational fair auto encoder. arXiv preprint arXiv:1511.00830, 2015.
248
+
249
+ Sinno Jialin Pan and Qiang Yang. A Survey on Transfer Learning. IEEE Transactions on Knowledge and Data Engineering, 22(10):1345–1359, 2009.
250
+
251
+ Vishal M Patel, Raghuraman Gopalan, Ruonan Li, and Rama Chellappa. Visual domain adaptation: A survey of recent advances. IEEE signal processing magazine, 32(3):53–69, 2015.
252
+
253
+ Kate Saenko, Brian Kulis, Mario Fritz, and Trevor Darrell. Adapting visual category models to new domains. In European conference on computer vision, pp. 213–226. Springer, 2010.
254
+
255
+ Meena Seshamani and Alastair M Gray. A longitudinal study of the effects of age and time to death on hospital costs. Journal of health economics, 23(2):217–235, 2004.
256
+
257
+ Table 3: AUC Comparison for AHRF Mortality Prediction task for different types of VRADA training
258
+
259
+ <table><tr><td>Training</td><td>23</td><td>24</td><td>25</td><td>32</td><td>34 35</td><td>42</td><td>43</td><td>45</td><td>52</td><td>53</td><td>54</td></tr><tr><td>I</td><td>0.704</td><td>0.777</td><td>0.682</td><td>0.540</td><td>0.764</td><td>0.721</td><td>0.603</td><td>0.727 0.710</td><td>0.616</td><td>0.782</td><td>0.738</td></tr><tr><td>II</td><td>0.724</td><td>0.656</td><td>0.719</td><td>0.627</td><td>0.748</td><td>0.683</td><td>0.656</td><td>0.770 0.755</td><td>0.595</td><td>0.736</td><td>0.732</td></tr><tr><td>ⅢI</td><td>0.721</td><td>0.688</td><td>0.656</td><td>0.654</td><td>0.757</td><td>0.691</td><td>0.609 0.766</td><td>0.775</td><td>0.602</td><td>0.709</td><td>0.714</td></tr></table>
260
+
261
+ Richard Socher, Cliff C Lin, Chris Manning, and Andrew Y Ng. Parsing natural scenes and natural language with recursive neural networks. In Proceedings of the $2 8 t h$ international conference on machine learning (ICML-11), pp. 129–136, 2011.
262
+
263
+ Eric Tzeng, Judy Hoffman, Trevor Darrell, and Kate Saenko. Simultaneous deep transfer across domains and tasks. In Proceedings of the IEEE International Conference on Computer Vision, pp. 4068–4076, 2015.
264
+
265
+ Min Xiao and Yuhong Guo. Domain adaptation for sequence labeling tasks with a probabilistic language adaptation model. In ICML (1), pp. 293–301, 2013.
266
+
267
+ Yi Yang and Jacob Eisenstein. Unsupervised multi-domain adaptation with feature embeddings.
268
+
269
+ # 6 APPENDIX
270
+
271
+ # 6.1 TRAINING VARIATIONS
272
+
273
+ We tested 3 variations of training VRADA: (a) training VRADA regularly as discussed in Section 3 (denoted by I), (b) loading a pretrained VRNN encoder and optimizing strictly off the classification errors, i.e.
274
+
275
+ $$
276
+ E ( \theta _ { e } , \theta _ { y } , \theta _ { d } ) = { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } { \mathcal { L } } _ { y } ( \mathbf { x ^ { i } } ; \theta _ { y } ) - \lambda ( { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } { \mathcal { L } } _ { d } ( \mathbf { x ^ { i } } ; \theta _ { d } ) + { \frac { 1 } { n ^ { \prime } } } \sum _ { i = n + 1 } ^ { N } { \mathcal { L } } _ { d } ( \mathbf { x ^ { i } } ; \theta _ { d } ) ) )
277
+ $$
278
+
279
+ and (c) loading a pretrained VRNN encoder and using the objective as presented in equation 3 (denoted by $\mathbf { I I I }$ ). Key to note is that in method $\mathbf { I }$ , we do not apply variational methods towards learning the shared latent representation. This was done to test whether they were helpful or harmful towards the learned latent representation used for classification. In method III, we train VRADA as normal but load a pretrained encoder. We pretrain the encoder by training the VRNN on all source and target domain samples for a desired source-target adaptation pair. In order to choose how many samples would be used for training, we looked at which domain had more examples and chose the larger of the two. For example, if the source domain was group 2 with 508 patients and the target domain was group 5 with 437 patients, the VRNN would see 508 samples of each domain, with group 5 being sampled with replacement after seeing all its samples. As the encoder was used for learning latent representations, we thought it worth investigating whether if pretrained it better captured the latent representations that were being used by the domain classifier for adversarial training. We thought beginning domain classification at a better initialization point might help VRADA avoid local minima. For each method, we fed one source domain sample to $G _ { y }$ and either a source or target domain sample to $G _ { d }$ . (For this training and all training samples, order was randomized.) We only calculated the loss $\mathcal { L } _ { r }$ once for the $G _ { d }$ samples so as to not bias the optimization of the VRNN.
280
+
281
+ Table 3 shows the results of AHRF Mortality Prediction task for different types of VRADA training. From these experiments, we found that jointly training VRADA (i.e method I) usually performed better than the other pretrained training approaches.
282
+
283
+ # 6.2 MODEL VARIATIONS
284
+
285
+ # 6.2.1 ADVERSARIAL TRAINING AT EVERY TIME-STEP
286
+
287
+ A natural question is whether adversarial training at every time-step is more effective than adversarial training at the last time-step of a latent representation. If done at every time-step, the network learns to create domain-invariant representations of subsets of your input $x _ { \le T }$ . Do these domain-invariant representations help the network find more optimal domain-invariant representations of $x$ ? We empirically tested this scenario (Table 4) and found the results to be sub-optimal when compared to only performing adversarial training at the last time-step (Table 1). Below are results for the R-DANN and VRADA models for adversarial training at every time-step.
288
+
289
+ Table 4: AUC Comparison for AHRF Mortality Prediction task with adversarial training done at every time-step
290
+
291
+ <table><tr><td>Model</td><td>23 24</td><td>25</td><td>34</td><td>35</td><td>42</td><td>43</td><td>45</td><td>52 53 54</td></tr><tr><td>R-DANN</td><td>.651 .599</td><td>.598</td><td>.557 .679</td><td>.534</td><td>.563 .768</td><td>.588</td><td>.528</td><td>.696 .669</td></tr><tr><td>VRADA</td><td>.681 .691</td><td>.643</td><td>.594 .733</td><td>.641</td><td>.733 .794</td><td>.675</td><td>.583</td><td>.755 .726</td></tr></table>
292
+
293
+ # 6.2.2 EFFECT OF RECONSTRUCTION LOSS
294
+
295
+ Table 5 shows the effect of reconstruction loss for our VRADA model. We observe that reconstructing the original data (i.e. using the decoder for reconstructing the data) helps in the overall performance improvement of our VRADA model.
296
+
297
+ Table 5: AUC Comparison of VRADA model for AHRF Mortality Prediction task with and without reconstruction loss
298
+
299
+ <table><tr><td>Model</td><td>23</td><td>24</td><td>25</td><td>32</td><td>34</td><td>35</td><td>42</td><td>43</td><td>45</td><td>52</td><td>53</td><td>54</td></tr><tr><td>Without reconstruction</td><td>0.703</td><td>0.623</td><td>0.570</td><td>0.647</td><td>0.622</td><td>0.564</td><td>0.577</td><td>0.608</td><td>0.552</td><td>0.599</td><td>0.640</td><td>0.676</td></tr><tr><td>With reconstruction</td><td>0.724</td><td>0.777</td><td>0.719</td><td>0.654</td><td>0.764</td><td>0.721</td><td>0.656</td><td>0.770</td><td>0.775</td><td>0.616</td><td>0.782</td><td>0.738</td></tr></table>
300
+
301
+ # 6.2.3 IMPACT OF ADVERSARIAL TRAINING
302
+
303
+ In figures 5 and 6 we show the cell state activations for the VRADA and R-DANN without domain adaptation (i.e. no adversarial training). From these figures, we see that the dependencies between source and target domains are not transferred correctly since we do not perform adversarial training. On the otherhand, as discussed in section 4.4, figure 3 shows that adversarial training helps in transferring the dependencies between source and target domains efficiently.
304
+
305
+ # 6.3 R-DANN MODEL INFORMATION
306
+
307
+ Here we provide more details on the network architectures of the R-DANN and DANN. Please refer to Figure 7 for a diagram of the R-DANN model showing the dimensions of each layer and the connections between layers. The R-DANN and DANN were essentially identical except that, for the DANN, the first layer used a fully-connected layer instead of an RNN and took input flattened over the time-dimension. Thus the input dimensions corresponded to $f$ and $t \times f$ for the R-DANN and DANN, respectively, where $f$ is the number of features and $t$ is the length of the time-dimension.
308
+
309
+ ![](images/bee230ee86300b576363b47729e1f63bfc39e703a9aa8fcf9c19316fd4c71238.jpg)
310
+ Figure 5: Cell states of memory cell for R-DANN and VRADA showing temporal latent dependencies captured by neurons of the R-DANN and VRADA for the source domain and the target domain. Each step along the y-axis refers to the activation of a single neuron with blue for strong inhibition and yellow for strong excitation. Step along the $\mathbf { X }$ -axis refers to activation per time-step. The figure shows a single example in adapting 3-4 for AHRF dataset.
311
+
312
+ ![](images/d0627e3e2cc61001e649558d2740464a0862e463682008e147d7e287df284278.jpg)
313
+ Figure 6: Cell states of memory cell for R-DANN and VRADA showing temporal latent dependencies captured by neurons of the R-DANN and VRADA for the source domain and the target domain. Each step along the y-axis refers to the activation of a single neuron with blue for strong inhibition and yellow for strong excitation. Step along the $\mathbf { X }$ -axis refers to activation per time-step. The figure shows a single example in adapting 2-5 for ICD9 dataset.
314
+
315
+ ![](images/ab008a59e9a4e7df90a86064a5d4cefb15a372d0c8f2d11a890b871e7f24cd0f.jpg)
316
+ Figure 7: Block diagram of the R-DANN showing the number of neurons used in each layer and how the layers were connected. This model had a capacity of about 46, 000 parameters.
md/train/rklMnyBtPB/rklMnyBtPB.md ADDED
@@ -0,0 +1,428 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADVERSARIAL ROBUSTNESS AGAINST THE UNION OF MULTIPLE PERTURBATION MODELS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Owing to the susceptibility of deep learning systems to adversarial attacks, there has been a great deal of work in developing (both empirically and certifiably) robust classifiers, but the vast majority has defended against single types of attacks. Recent work has looked at defending against multiple attacks, specifically on the MNIST dataset, yet this approach used a relatively complex architecture, claiming that standard adversarial training can not apply because it “overfits” to a particular norm. In this work, we show that it is indeed possible to adversarially train a robust model against a union of norm-bounded attacks, by using a natural generalization of the standard PGD-based procedure for adversarial training to multiple threat models. With this approach, we are able to train standard architectures which are robust against $\ell _ { \infty }$ , $\ell _ { 2 }$ , and $\ell _ { 1 }$ attacks, outperforming past approaches on the MNIST dataset and providing the first CIFAR10 network trained to be simultaneously robust against $( \ell _ { \infty } , \ell _ { 2 } , \ell _ { 1 } )$ threat models, which achieves adversarial accuracy of $4 6 . 1 \%$ against the union of $( \ell _ { \infty } , \ell _ { 2 } , \ell _ { 1 } )$ perturbations with radius $\epsilon = ( 0 . 0 3 , \dot { 0 . 5 } , 1 2 )$ .
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Machine learning algorithms have been shown to be susceptible to adversarial examples (Szegedy et al., 2014) through the existence of data points which can be adversarially perturbed to be misclassified, but are “close enough” to the original example to be imperceptible to the human eye. Methods to generate adversarial examples, or “attacks”, typically rely on gradient information, and most commonly use variations of projected gradient descent (PGD) to maximize the loss within a small perturbation region, usually referred to as the adversary’s threat model. Since then, a number of heuristic defenses have been proposed to defend against this phenomenon, e.g. distillation (Papernot et al., 2016) or more recently logit-pairing (Kannan et al., 2018). However, as time goes by, the original robustness claims of these defenses typically don’t hold up to more advanced adversaries or more thorough attacks (Carlini & Wagner, 2017; Engstrom et al., 2018; Mosbach et al., 2018). One heuristic defense that seems to have survived (to this day) is to use adversarial training against a PGD adversary (Madry et al., 2018), which remains quite popular due to its simplicity and apparent empirical robustness. The method continues to perform well in empirical benchmarks even when compared to recent work in provable defenses, although it comes with no formal guarantees.
12
+
13
+ Some recent work, however, pointed out that adversarial training against $\ell _ { \infty }$ perturbations “overfits” to the $\ell _ { \infty }$ threat model, and used this as motivation to propose a more complicated architecture in order to achieve robustness to multiple perturbation types on the MNIST dataset (Schott et al., 2019).
14
+
15
+ In this work, we offer a alternative viewpoint: while adversarial training can overfit to the individual threat models, we show that it is indeed possible to use adversarial training to learn a model which is simultaneously robust against multiple types of $\ell _ { p }$ norm bounded attacks (we consider $\ell _ { \infty }$ , $\ell _ { 2 }$ , and $\ell _ { 1 }$ attacks, but the approach can apply to more general attacks). First, we show while simple generalizations of adversarial training to multiple threat models can achieve some degree of robustness against the union of these threat models, the performance is inconsistent and converges to suboptimal tradeoffs which may not actually minimize the robust objective. Second, we propose a slightly modified PGD-based algorithm called multi steepest descent (MSD) for adversarial training which more naturally incorporates the different perturbations within the PGD iterates, further improving the adversarial training approach by directly minimizing the robust optimization objective. Third, we show empirically that our approach improves upon past work by being applicable to standard network architectures, easily scaling beyond the MNIST dataset, and outperforming past results on robustness against multiple perturbation types.
16
+
17
+ # 2 RELATED WORK
18
+
19
+ After their original introduction, one of the first widely-considered attacks against deep networks had been the Fast Gradient Sign Method (Goodfellow et al., 2015), which showed that a single, small step in the direction of the sign of the gradient could sometimes fool machine learning classifiers. While this worked to some degree, the Basic Iterative Method (Kurakin et al., 2017) (now typically referred to as the PGD attack) was significantly more successful at creating adversarial examples, and now lies at the core of many papers. Since then, a number of improvements and adaptations have been made to the base PGD algorithm to overcome heuristic defenses and create stronger adversaries. Adversarial attacks were thought to be safe under realistic transformations (Lu et al., 2017) until the attack was augmented to be robust to them (Athalye et al., 2018b). Adversarial examples generated using PGD on surrogate models can transfer to black box models (Papernot et al., 2017). Utilizing core optimization techniques such as momentum can greatly improve the attack success rate and transferability, and was the winner of the NIPS 2017 competition on adversarial examples (Dong et al., 2018). Uesato et al. (2018) showed that a number of ImageNet defenses were not as robust as originally thought, and Athalye et al. (2018a) defeated many of the heuristic defenses submitted to ICLR 2018 shortly after the reviewing cycle ended, all with stronger PGD variations.
20
+
21
+ Throughout this cycle of attack and defense, some defenses were uncovered that remain robust to this day. The aforementioned PGD attack, and the related defense known as adversarial training with a PGD adversary (which incorporates PGD-attacked examples into the training process) has so far remained empirically robust (Madry et al., 2018). Verification methods to certify robustness properties of networks were developed, utilizing techniques such as SMT solvers (Katz et al., 2017), SDP relaxations (Raghunathan et al., 2018b), and mixed-integer linear programming (Tjeng et al., 2019), the last of which has recently been successfully scaled to reasonably sized networks. Other work has folded verification into the training process to create provably robust networks (Wong & Kolter, 2018; Raghunathan et al., 2018a), some of which have also been scaled to even larger networks (Wong et al., 2018; Mirman et al., 2018; Gowal et al., 2018). Although some of these could potentially be extended to apply to multiple perturbations simultaneously, most of these works have focused primarily on defending against and verifying only a single type of adversarial perturbation at a time.
22
+
23
+ Last but most relevant to this work are adversarial defenses that attempt to be robust against multiple types of attacks simultaneously. Schott et al. (2019) used multiple variational autoencoders to construct a complex architecture for the MNIST dataset that is not as easily attacked by $\ell _ { \infty }$ , $\ell _ { 2 }$ , and $\ell _ { 0 }$ adversaries. Importantly, Schott et al. (2019) compare to adversarial training with an $\ell _ { \infty }$ -bounded PGD adversary as described by Madry et al. (2018), claiming that the adversarial training defense overfits to the $\ell _ { \infty }$ metric, and they do not consider other forms of adversarial training. Following this, a number of concurrent papers have since been released. While not studied as a defense, Kang et al. (2019) study the transferability of adversarial robustness between models trained against different threat models. Croce & Hein (2019) propose a provable adversarial defense against all $\ell _ { p }$ norms for $p \geq 1$ using a regularization term. Finally, Tramer & Boneh (2019) study the theoretical and \` empirical trade-offs of adversarial robustness in various settings when defending against multiple adversaries, however, they use a rotation and translation adversary instead of an $\ell _ { 2 }$ adversary for CIFAR10.
24
+
25
+ Contributions In this work we demonstrate the effectiveness of adversarial training for learning models that are robust against a union of multiple perturbation models. First, we show that while simple aggregations of different adversarial attacks can achieve robustness against multiple perturbations models without resorting to complex architectures, the results are inconsistent across datasets and make suboptimal tradeoffs between the threat models. Second, we propose a modified PGD iteration that more naturally considers multiple perturbation models within the inner optimization loop of adversarial training. Third, we evaluate all approaches on the MNIST and CIFAR10 datasets, showing that our proposed generalizations of adversarial training can significantly outperform past approaches for the union of $\ell _ { \infty }$ , $\ell _ { 2 }$ , and $\ell _ { 1 }$ attacks. Specifically, on MNIST, our model achieves $5 8 . 7 \%$ (individually $6 3 . 7 \%$ , $8 2 . 6 \%$ , $6 2 . 3 \%$ adversarial accuracy against the union of all three attacks $( \ell _ { \infty } , \ell _ { 2 } , \ell _ { 1 } )$
26
+
27
+ ![](images/d1b8e0b3dac47e0af4857a63a01e0d2863aaa605b9963441982b649afb99476d.jpg)
28
+ Figure 1: (left) A depiction of the steepest descent directions for $\ell _ { \infty }$ , $\ell _ { 2 }$ , and $\ell _ { 1 }$ norms. The gradient is the black arrow, and the $\alpha$ radius step sizes and their corresponding steepest descent directions $\ell _ { \infty }$ , $\ell _ { 2 }$ , and $\ell _ { 1 }$ are shown in blue, red, and green respectively. (right) An example of the projection back to an $\ell _ { 2 }$ ball of radius $\epsilon$ after a steepest descent step from the starting perturbation $\delta$ . The steepest descent step is the black arrow, and the corresponding projection back onto the $\ell _ { 2 }$ ball is red arrow.
29
+
30
+ for $\epsilon = ( 0 . 3 , 1 . 5 , 1 2 )$ respectively, substantially improving upon the multiple-perturbation-model robustness described in Schott et al. (2019) and also improving upon the simpler aggregations of multiple adversarial attacks. Unlike past work, we also train a CIFAR10 model, which achieves $4 6 . 1 \%$ (individually $4 7 . 6 \%$ , $6 4 . 3 \%$ , $5 3 . 4 \%$ adversarial accuracy against the union of all three attacks $( \ell _ { \infty } , \ell _ { 2 } , \ell _ { 1 } )$ for $\epsilon = ( 0 . 0 3 , 0 . 5 , 1 2 )$ . Finally, for completeness, we also draw relevant comparisons to concurrent work, and show that the relative advantage of our approach still holds.
31
+
32
+ # 3 OVERVIEW OF ADVERSARIAL TRAINING
33
+
34
+ Adversarial training is an approach to learn a classifier which minimizes the worst case loss within some perturbation region (the threat model). Specifically, for some network $f _ { \theta }$ parameterized by $\theta$ , loss function $\ell$ , and training data $\{ x _ { i } , y _ { i } \} _ { i = 1 \ldots n }$ , the robust optimization problem of minimizing the worst case loss within $\ell _ { p }$ norm-bounded perturbations with radius $\epsilon$ is
35
+
36
+ $$
37
+ \operatorname* { m i n } _ { \theta } \sum _ { i } \operatorname* { m a x } _ { \delta \in \Delta _ { p , \epsilon } } \ell ( f _ { \theta } ( x _ { i } + \delta ) , y _ { i } ) ,
38
+ $$
39
+
40
+ where $\Delta _ { p , \epsilon } = \{ \delta : \| \delta \| _ { p } \leq \epsilon \}$ is the $\ell _ { p }$ ball with radius $\epsilon$ centered around the origin. To simplify the notation, we will abbreviate $\ell ( f _ { \theta } ( x + \delta ) , y ) = \ell ( x + \delta ; \theta )$ .
41
+
42
+ # 3.1 SOLVING THE INNER OPTIMIZATION PROBLEM
43
+
44
+ We first look at solving the inner maximization problem, namely
45
+
46
+ $$
47
+ \operatorname* { m a x } _ { \delta \in \Delta _ { p , \epsilon } } \ell ( x + \delta ; \theta ) .
48
+ $$
49
+
50
+ This is the problem addressed by the “attackers” in the space of adversarial examples, hoping that the classifier can be tricked by the optimal perturbed image, $x + \delta ^ { \star }$ . Typical solutions solve this problem by running a form of projected gradient descent, which iteratively takes steps in the gradient direction to increase the loss followed by a projection step back onto the feasible region, the $\ell _ { p }$ ball. Since the gradients at the example points themselves (i.e., $\delta = 0$ ) are typically too small to make efficient progress, more commonly used is a variation called projected steepest descent.
51
+
52
+ Steepest descent For some norm $\| \cdot \| _ { p }$ and step size $\alpha$ , the direction of steepest descent on the loss function $\ell$ for a perturbation $\delta$ is
53
+
54
+ $$
55
+ \boldsymbol { v } _ { p } ( \delta ) = \underset { \| \boldsymbol { v } \| _ { p } \leq \alpha } { \arg \operatorname* { m a x } } \boldsymbol { v } ^ { T } \nabla \ell ( \boldsymbol { x } + \delta ; \theta ) .
56
+ $$
57
+
58
+ Then, instead of taking gradient steps, steepest descent uses the following iteration
59
+
60
+ $$
61
+ \delta ^ { ( t + 1 ) } = \delta ^ { ( t ) } + v _ { p } ( \delta ^ { ( t ) } ) .
62
+ $$
63
+
64
+ In practice, the norm used in steepest descent is typically taken to be the same $\ell _ { p }$ norm used to define the perturbation region $\Delta _ { p , \epsilon }$ . However, depending on the norm used, the direction of steepest descent can be quite different from the actual gradient (Figure 1). Note that a single steepest descent step with respect to the $\ell _ { \infty }$ norm reduces to $\bar { v _ { \infty } ( x ) } = \alpha \cdot \bar { \mathrm { s i g n } ( \nabla \ell ( x + \delta ; \theta ) ) }$ , better known in the adversarial examples literature as the Fast Gradient Sign Method (Goodfellow et al., 2015).
65
+
66
+ Projections The second component of projected steepest descent for adversarial examples is to project iterates back onto the $\ell _ { p }$ ball around $x$ . Specifically, projected steepest descent performs the following iteration
67
+
68
+ $$
69
+ \delta ^ { ( t + 1 ) } = \mathcal { P } _ { \Delta _ { p , \epsilon } } \left( \delta ^ { ( t ) } + v _ { p } ( \delta ^ { ( t ) } ) \right)
70
+ $$
71
+
72
+ where $\mathcal { P } _ { \Delta _ { p , \epsilon } } ( \delta )$ is the standard projection operator that finds the perturbation $\delta ^ { \prime } \in \Delta _ { p , \epsilon }$ that is “closest” in Euclidean space to the input $\delta$ , defined as
73
+
74
+ $$
75
+ \begin{array} { r } { \mathcal { P } _ { \Delta _ { p , \epsilon } } ( \delta ) = \underset { \delta ^ { \prime } \in \Delta _ { p , \epsilon } } { \arg \operatorname* { m i n } } \Vert \delta - \delta ^ { \prime } \Vert _ { 2 } ^ { 2 } . } \end{array}
76
+ $$
77
+
78
+ Visually, a depiction of this procedure (steepest descent followed by a projection onto the perturbation region) for an $\ell _ { 2 }$ adversary can be found in Figure 1. If we instead project the steepest descent directions with respect to the $\ell _ { \infty }$ norm onto the $\ell _ { \infty }$ ball of allowable perturbations, the projected steepest descent iteration reduces to
79
+
80
+ $$
81
+ \begin{array} { r l } & { \delta ^ { ( t + 1 ) } = P _ { \Delta _ { \infty , \epsilon } } ( \delta ^ { ( t ) } + v _ { \infty } ( \delta ^ { ( t ) } ) ) } \\ & { \qquad = \underset { [ - \epsilon , \epsilon ] } { \mathrm { c l i p } } \left( \delta ^ { ( t ) } + \alpha \cdot \mathrm { s i g n } ( \nabla \ell ( x + \delta ^ { ( t ) } ; \theta ) ) \right) } \end{array}
82
+ $$
83
+
84
+ where $\mathrm { c l i p } _ { [ - \epsilon , + \epsilon ] }$ “clips” the input to lie within the range $[ - \epsilon , \epsilon ]$ . This is exactly the Basic Iterative Method used in Kurakin et al. (2017), typically referred to in the literature as an $\ell _ { \infty }$ PGD adversary.
85
+
86
+ # 3.2 SOLVING THE OUTER OPTIMIZATION PROBLEM
87
+
88
+ We next look at how to solve the outer optimization problem, or the problem of learning the weights $\theta$ that minimize the loss of our classifier. While many approaches have been proposed in the literature, we will focus on a heuristic called adversarial training, which has generally worked well in practice.
89
+
90
+ Adversarial training Although solving the min-max optimization problem may seem daunting, a classical result known as Danskin’s theorem (Danskin, 1967) says that the gradient of a maximization problem is equal to the gradient of the objective evaluated at the optimum. For learning models that minimize the robust optimization problem from Equation (1), this means that
91
+
92
+ $$
93
+ \nabla _ { \theta } \left( \sum _ { i } \operatorname* { m a x } _ { \delta \in \Delta _ { p , \epsilon } } \ell ( x _ { i } + \delta ; \theta ) \right) = \sum _ { i } \nabla _ { \theta } \ell ( x _ { i } + \delta ^ { * } ( x _ { i } ) ; \theta )
94
+ $$
95
+
96
+ where $\begin{array} { r } { \delta ^ { * } ( x _ { i } ) = \arg \operatorname* { m a x } _ { \delta \in \Delta _ { p , \epsilon } } \ell ( x _ { i } + \delta ; \theta ) } \end{array}$ . In other words, this means that in order to backpropagate through the robust optimization problem, we can solve the inner maximization and backpropagate through the solution. Adversarial training does this by empirically maximizing the inner problem with a PGD adversary. Note that since the inner problem is not solved exactly, Danskin’s theorem does not strictly apply. However, in practice, adversarial training does seem to provide good empirical robustness, at least when evaluated against the $\ell _ { p }$ threat model it was trained against.
97
+
98
+ # 4 ADVERSARIAL TRAINING FOR MULTIPLE PERTURBATION MODELS
99
+
100
+ We can now consider the core of this work, adversarial training procedures against multiple threat models. More formally, let $s$ represent a set of threat models, such that $p \in { \mathcal { S } }$ corresponds to the $\ell _ { p }$ perturbation model $\Delta _ { p , \epsilon }$ , and let $\begin{array} { r } { \Delta _ { \mathcal { S } } = \bigcup _ { p \in \mathcal { S } } \Delta _ { p , \epsilon } } \end{array}$ be the union of all perturbation models in $s$ Note that the $\epsilon$ chosen for each ball is not typically the same, but we still use the same notation $\epsilon$ for simplicity, since the context will always make clear which $\ell _ { p }$ -ball we are talking about. Then, the generalization of the robust optimization problem in Equation (1) to multiple perturbation models is
101
+
102
+ $$
103
+ \operatorname* { m i n } _ { \theta } \sum _ { i } \operatorname* { m a x } _ { \delta \in \Delta _ { S } } \ell ( x _ { i } + \delta ; \theta ) .
104
+ $$
105
+
106
+ The key difference is in the inner maximization, where the worst case adversarial loss is now taken over multiple $\ell _ { p }$ perturbation models. In order to perform adversarial training, using the same motivational idea from Danskin’s theorem, we can backpropagate through the inner maximization by first finding (empirically) the optimal perturbation,
107
+
108
+ $$
109
+ \delta ^ { * } = \underset { \delta \in \Delta _ { \mathscr { s } } } { \arg \operatorname* { m a x } } \ell ( \boldsymbol { x } + \boldsymbol { \delta } ; \boldsymbol { \theta } ) .
110
+ $$
111
+
112
+ To find the optimal perturbation over the union of threat models, we begin by considering straightforward generalizations of standard adversarial training, which will use PGD to approximately solve the inner maximization over multiple adversaries.
113
+
114
+ # 4.1 SIMPLE COMBINATIONS OF MULTIPLE PERTURBATIONS
115
+
116
+ First, we study two simple approaches to generalizing adversarial training to multiple threat models. These methods can perform reasonably well in practice and are competitive with existing approaches without relying on complicated architectures. While these methods work to some degree, we later find empirically that these methods do not necessarily minimize the worst-case performance, and can converge to unexpected tradeoffs between multiple threat models.
117
+
118
+ Worst-case perturbation One way to generalize adversarial training to multiple threat models is to use each threat model independently, and train on the adversarial perturbation that achieved the maximum loss. Specifically, for each adversary $p \in S$ , we solve the innermost maximization with an $\ell _ { p }$ PGD adversary to get an approximate worst-case perturbation $\delta _ { p }$ ,
119
+
120
+ $$
121
+ \delta _ { p } = \underset { \delta \in \Delta _ { p , \epsilon } } { \arg \operatorname* { m a x } } \ell ( x + \delta ; \theta ) ,
122
+ $$
123
+
124
+ and then approximate the maximum over all adversaries as
125
+
126
+ $$
127
+ \delta ^ { * } \approx \operatorname * { a r g m a x } _ { \delta _ { p } } \ell ( x + \delta _ { p } ; \theta ) .
128
+ $$
129
+
130
+ When $| S | = 1$ , then this reduces to standard adversarial training. Note that if each PGD adversary solved their subproblem from Equation (11) exactly, then this is exactly the optimal perturbation $\delta ^ { \star }$ .
131
+
132
+ PGD augmentation with all perturbations Another way to generalize adversarial training is to train on all the adversarial perturbations for all $p \in S$ to form a larger adversarial dataset. Specifically, instead of solving the robust problem for multiple adversaries in Equation (9), we instead solve
133
+
134
+ $$
135
+ \operatorname* { m i n } _ { \theta } \sum _ { i } \sum _ { p \in S } \operatorname* { m a x } _ { \delta \in \Delta _ { p , \epsilon } } \ell ( x _ { i } + \delta ; \theta )
136
+ $$
137
+
138
+ by using individual $\ell _ { p }$ PGD adversaries to approximate the inner maximization for each threat model.
139
+ Again, this reduces to standard adversarial training when $| S | = 1$ .
140
+
141
+ While these methods work reasonably well in practice (which is shown later in Section 5), both approaches solve the inner maximization problem independently for each adversary, so each individual PGD adversary is not taking advantage of the fact that the perturbation region is enlarged by other threat models. To take advantage of the full perturbation region, we propose a modification to standard adversarial training, which combines information from all considered threat models into a single PGD adversary that is potentially stronger than the combination of independent adversaries.
142
+
143
+ # 4.2 MULTI STEEPEST DESCENT
144
+
145
+ To create a PGD adversary with full knowledge of the perturbation region, we propose an algorithm that incorporates the different threat models within each step of projected steepest descent. Rather than generating adversarial examples for each threat model with separate PGD adversaries, the core idea is to create a single adversarial perturbation by simultaneously maximizing the worst case loss over all threat models at each projected steepest descent step. We call our method multi steepest descent (MSD), which can be summarized as the following iteration:
146
+
147
+ $$
148
+ \begin{array} { r l } & { \delta _ { p } ^ { ( t + 1 ) } = P _ { \Delta _ { p , \epsilon } } ( \delta ^ { ( t ) } + v _ { p } ( \delta ^ { ( t ) } ) ) \mathrm { f o r } p \in \mathcal { S } } \\ & { \delta ^ { ( t + 1 ) } = \arg \operatorname* { m a x } _ { \mathbf { \delta } } \ell ( x + \delta _ { p } ^ { ( t + 1 ) } ) } \\ & { \qquad \delta _ { p } ^ { ( t + 1 ) } } \end{array}
149
+ $$
150
+
151
+ Algorithm 1 Multi steepest descent for learning classifiers that are simultaneously robust to $\ell _ { p }$ attacks for $p \in S$
152
+
153
+ <table><tr><td>Input: classifier fe,data x,labels y Parameters: Ep,αp for p E S,maximum iterations T,loss function l 8(0)=0 fort=0...T-1do</td></tr><tr><td>for p ∈ S do s+1 = P△p,(s(t) + Up(δ(t))</td></tr><tr><td>end for</td></tr><tr><td>δ(t+1) =arg max(t+1) e(f(x +δ(t+1),y)</td></tr><tr><td>end for return 8(T)</td></tr><tr><td></td></tr></table>
154
+
155
+ The key difference here is that at each iteration of MSD, we choose a projected steepest descent direction that maximizes the loss over all attack models $p \in { \mathcal { S } }$ , whereas standard adversarial training and the simpler approaches use comparatively myopic PGD subroutines that only use one threat model at a time. The full algorithm is in Algorithm 1, and can be used as a drop in replacement for standard PGD adversaries to learn robust classifiers with adversarial training. We direct the reader to Appendix A for a complete description of steepest descent directions and projection operators for $\ell _ { \infty }$ , $\ell _ { 2 }$ , and $\ell _ { 1 }$ norms1.
156
+
157
+ # 5 RESULTS
158
+
159
+ In this section, we present experimental results on using generalizations of adversarial training to achieve simultaneous robustness to $\ell _ { \infty }$ , $\ell _ { 2 }$ , and $\ell _ { 1 }$ perturbations on the MNIST and CIFAR10 datasets. Our primary goal is to show that adversarial training can in fact be adapted to a union of perturbation models using standard architectures to achieve competitive results, without the pitfalls described by Schott et al. (2019). Our results improve upon the state-of-the-art in three key ways. First, we can use simpler, standard architectures for image classifiers, without relying on complex architectures or input binarization. Second, our method is able to learn a single MNIST model which is simultaneously robust to all three threat models, whereas previous work was only robust against two at a time. Finally, our method is easily scalable to datasets beyond MNIST, providing the first CIFAR10 model trained to be simultaneously robust against $\ell _ { \infty }$ , $\ell _ { 2 }$ , and $\ell _ { 1 }$ adversaries.
160
+
161
+ We trained models using both the simple generalizations of adversarial training to multiple adversaries and also using MSD. Since the analysis by synthesis model is not scalable to CIFAR10, we additionally trained CIFAR10 models against individual PGD adversaries to measure the changes and tradeoffs in universal robustness. We evaluated these models with a broad suite of both gradient and non-gradient based attacks using Foolbox2 (the same attacks used by Schott et al. (2019)), and also incorporated all the PGD-based adversaries discussed in this paper. All aggregate statistics that combine multiple attacks compute the worst case error rate over all attacks for each example.
162
+
163
+ Summaries of these results at specific thresholds can be found in Tables 1 and 2, where B-ABS and ABS refer to binarized and non-binarized versions of the analysis by synthesis models from Schott et al. (2019), $P _ { p }$ refers to a model trained against a PGD adversary with respect to the $p$ - norm, Worst-PGD and PGD-Aug refer to models trained using the worst-case and data augmentation generalizations of adversarial training, and MSD refers to models trained using multi steepest descent. Full tables containing the complete breakdown of these numbers over all individual attacks used in the evaluation are in Appendix C. We report the results against individual attacks and threat models for completeness, however note that the goal of all these algorithms is to minimize the robust optimization objective from Equation (9). While there may be different implicit tradeoffs between individual threat models, in the end, the most meaningful metric for measuring the effective performance is the robust optimization objective, or the performance against the union of all attacks.
164
+
165
+ Table 1: Summary of adversarial accuracy results for MNIST (higher is better)
166
+
167
+ <table><tr><td rowspan="2"></td><td colspan="6"></td><td rowspan="2">PGD Aug</td><td rowspan="2">MSD</td></tr><tr><td>P</td><td>P2</td><td>P</td><td>B-ABS4</td><td>ABS4</td><td>Worst PGD</td></tr><tr><td>Clean Accuracy</td><td>99.1%</td><td>99.4%</td><td>98.9%</td><td>99%</td><td>99%</td><td>98.9%</td><td>99.1%</td><td>98.2%</td></tr><tr><td>l attacks (∈=0.3)</td><td>90.3%</td><td>0.4%</td><td>0.0%</td><td>77%</td><td>8%</td><td>68.4%</td><td>83.7%</td><td>63.7%</td></tr><tr><td>l2 attacks (∈= 1.5)</td><td>45.3%</td><td>87.0%</td><td>70.3%</td><td>39%</td><td>80%</td><td>82.1%</td><td>75.0%</td><td>82.6%</td></tr><tr><td>l1 attacks (∈ = 12)</td><td>1.4%</td><td>43.4%</td><td>71.8%</td><td>82%</td><td>78%</td><td>54.6%</td><td>15.6%</td><td>62.3%</td></tr><tr><td> All Attacks</td><td>1.4%</td><td>0.4%</td><td>0.0%</td><td>39%</td><td>8%</td><td>53.7%</td><td>15.6%</td><td>58.7%</td></tr></table>
168
+
169
+ # 5.1 EXPERIMENTAL SETUP
170
+
171
+ Architectures and hyperparameters For MNIST, we use a four layer convolutional network with two convolutional layers consisting of 32 and $6 4 5 \times 5$ filters and 2 units of padding, followed by a fully connected layer with 1024 hidden units, where both convolutional layers are followed by $2 \times 2$ Max Pooling layers and ReLU activations (this is the same architecture used by Madry et al. (2018)). This is in contrast to past work on MNIST, which relied on per-class variational autoencoders to achieve robustness against multiple threat models (Schott et al., 2019), which was also not easily scalable to larger datasets. Since our methods have the same complexity as standard adversarial training, they also easily apply to standard CIFAR10 architectures, and in this paper we use the well known pre-activation version of the ResNet18 architecture consisting of nine residual units with two convolutional layers each (He et al., 2016).
172
+
173
+ A complete description of the hyperparameters used is in Appendix B, with hyperparameters for PGD adversaries in Appendix B.1, and hyperparameters for adversarial training in Appendix B.2. All reported $\epsilon$ are for images scaled to be between the range $[ 0 , 1 ]$ . All experiments can be run on modern GPU hardware (e.g. a single 1080ti).
174
+
175
+ Attacks used for evaluation To evaluate the model, we incorporate the attacks from Schott et al. (2019) as well as our PGD based adversaries using projected steepest descent, however we provide a short description here. Note that we exclude attacks based on gradient estimation, since the gradient for the standard architectures used here are readily available.
176
+
177
+ For $\ell _ { \infty }$ attacks, although we find the $\ell _ { \infty }$ PGD adversary to be quite effective, for completeness, we additionally use the Foolbox implementations of Fast Gradient Sign Method (Goodfellow et al., 2015), PGD adversary (Madry et al., 2018), and the Momentum Iterative Method (Dong et al., 2018).
178
+
179
+ For $\ell _ { 2 }$ attacks, in addition to the $\ell _ { 2 }$ PGD adversary, we use the Foolbox implementations of the same PGD adversary, the Gaussian noise attack (Rauber et al., 2017), the boundary attack (Brendel et al., 2017), DeepFool (Moosavi-Dezfooli et al., 2016), the pointwise attack (Schott et al., 2019), DDN based attack (Rony et al., 2018), and C&W attack (Carlini & Wagner, 2017).
180
+
181
+ For $\ell _ { 1 }$ attacks, we use both the $\ell _ { 1 }$ PGD adversary as well as additional Foolbox implementations of $\ell _ { 0 }$ attacks at the same radius, namely the salt $\&$ pepper attack (Rauber et al., 2017) and the pointwise attack (Schott et al., 2019). Note that an $\ell _ { 1 }$ adversary with radius $\epsilon$ is strictly stronger than an $\ell _ { 0 }$ adversary with the same radius, and so we choose to explicitly defend against $\ell _ { 1 }$ perturbations instead of the $\ell _ { 0 }$ perturbations considered by Schott et al. (2019).
182
+
183
+ We make 10 random restarts for each of the evaluation results mentioned hereon for both MNIST and CIFAR10 3. We encourage future work in this area to incorporate the same, since the success of all attacks, specially decision based or gradient free ones, is observed to increase significantly over restarts.
184
+
185
+ ![](images/6c80349c9d86e7301fa97302df16486d315b97b60660253e42b6ea37c40dcfa2.jpg)
186
+ Figure 2: Robustness curves showing the adversarial accuracy for the MNIST model trained with MSD, PGD-Aug, Worst-PGD against $\ell _ { \infty }$ (left), $\ell _ { 2 }$ (middle), and $\ell _ { 1 }$ (right) threat models over a range of epsilon.
187
+
188
+ Table 2: Summary of adversarial accuracy results for CIFAR10 (higher is better)
189
+
190
+ <table><tr><td></td><td>P</td><td>P2</td><td>P1</td><td>Worst-PGD</td><td>PGD-Aug</td><td>MSD</td></tr><tr><td>Clean accuracy</td><td>83.3%</td><td>90.2%</td><td>73.3%</td><td>81.0%</td><td>84.6%</td><td>81.7%</td></tr><tr><td>lo attacks (∈ = 0.03)</td><td>50.7%</td><td>28.3%</td><td>0.2%</td><td>44.9%</td><td>42.5%</td><td>47.6%</td></tr><tr><td>l2 attacks (∈ = 0.5)</td><td>57.3%</td><td>61.6%</td><td>0.0%</td><td>61.7%</td><td>65.0%</td><td>64.3%</td></tr><tr><td>l1 attacks (ε= 12)</td><td>16.0%</td><td>46.6%</td><td>7.9%</td><td>39.4%</td><td>54.0%</td><td>53.4%</td></tr><tr><td>All attacks</td><td>15.6%</td><td>27.5%</td><td>0.0%</td><td>34.9%</td><td>40.6%</td><td>46.1%</td></tr></table>
191
+
192
+ # 5.2 MNIST
193
+
194
+ We first present results on the MNIST dataset, which are summarized in Table 1 (a more detailed breakdown over each individual attack is in Appendix C.1). While considered an “easy” dataset, we note that the previous state-of-the-art result for multiple threat models on MNIST (and our primary comparison) is only able to defend against two out of three threat models at a time (Schott et al., 2019) using comparatively complex variational autoencoder architectures. The model trained with MSD achieves the best performance against all attacks, achieving an error rate of $5 8 . 7 \%$ (individually $6 3 . 7 \%$ , $8 2 . 6 \%$ , and $6 2 . { \overset { - } { 3 } } ) \%$ against the union of $( \ell _ { \infty } , \ell _ { 2 }$ , and $\ell _ { 1 }$ ) perturbations with radius $\epsilon = ( 0 . 3 ,$ , 1.5, 12). Complete robustness curves over a range of epsilons over each threat model can be found in Figure 2. A comparison of our results with concurrent work (Tramer & Boneh, 2019) can be found in \` Appendix D.
195
+
196
+ # 5.3 CIFAR10
197
+
198
+ Next, we present results on the CIFAR10 dataset, which are summarized in Table 2 (a more detailed breakdown over each individual attack is in Appendix C.2). Our MSD approach reaches the best performance against the union of attacks, and achieves $4 6 . 1 \%$ (individually $4 7 . 6 \% , 6 4 . 3 \% , 5 3 . 4 \% )$ adversarial accuracy against the union of $( \ell _ { \infty } , \ell _ { 2 } , \ell _ { 1 } )$ perturbations of size $\epsilon = ( 0 . 0 3 , 0 . 5 , 1 2 )$ . Interestingly, note that the $P _ { 1 }$ model trained against an $\ell _ { 1 }$ PGD adversary is not very robust when evaluated against other attacks, even though it can defend reasonably well against the $\ell _ { 1 }$ PGD attack in isolation (Table 4 in Appendix C.2). Complete robustness curves over a range of epsilons over each threat model can be found in Figure 3. A comparison of our results with concurrent work (Tramer & \` Boneh, 2019) can be found in Appendix D. While adversarial defenses are generally not intended to defend against attacks outside of the threat model, we show some experiments exploring this aspect in Appendix E.
199
+
200
+ ![](images/c97a82d48e4a31e818d806fdd31575b9736c7adf6ac5fe24ed06e5917fd00b2d.jpg)
201
+ Figure 3: Robustness curves showing the adversarial accuracy for the CIFAR10 model trained with MSD, PGD-Aug, Worst-PGD against $\ell _ { \infty }$ (left), $\ell _ { 2 }$ (middle), and $\ell _ { 1 }$ (right) threat models over a range of epsilon.
202
+
203
+ On tradeoffs and variability of the simpler defenses One major drawback to the simpler methods for generalizing adversarial training to multiple threat models is their variability and unclear tradeoffs over different settings. For example, on MNIST we see that the data augmentation approach fails to reduce the robust optimization objective: the $\ell _ { \infty }$ threat model dominates the training process and we get a suboptimal tradeoff between threat models which isn’t robust to the union. Similarly, on CIFAR10 we see that the worst-case approach for adversarial training also converges to a model which has suboptimal robust performance against the union of threat models. This highlights the inconsistency of the simpler generalizations of adversarial training: depending on the dataset and the threat models, they may not ultimately minimize the robust optimization objective from Equation (9), and the tradeoffs may vary significantly with the problem setting. On the other hand, in both problem settings, we find MSD is consistent at finding a more optimal tradeoff which minimizes the worst-case loss in the union of the threat models. As a result, rather than using one of the simpler methods and convergence to a potentially unclear tradeoff between threat models, we recommend using MSD which directly minimizes the worst case performance among the specified threat models.
204
+
205
+ # 6 CONCLUSION
206
+
207
+ In this paper, we showed that adversarial training can be quite effective when training against a union of multiple perturbation models. We compare two simple generalizations of adversarial training and an improved adversarial training procedure, multi steepest descent, which incorporates the different perturbation models directly into the direction of steepest descent. MSD based adversarial training procedure is able to outperform past approaches, demonstrating that adversarial training can in fact learn networks that are robust to multiple perturbation models simultaneously (as long as they are included in the threat model) while being scalable beyond MNIST and using standard architectures.
208
+
209
+ # REFERENCES
210
+
211
+ Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, July 2018a. URL https://arxiv.org/abs/ 1802.00420.
212
+
213
+ Anish Athalye, Logan Engstrom, Andrew Ilyas, and Kevin Kwok. Synthesizing robust adversarial examples. In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 284–293, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018b. PMLR. URL http: //proceedings.mlr.press/v80/athalye18b.html.
214
+
215
+ Wieland Brendel, Jonas Rauber, and Matthias Bethge. Decision-based adversarial attacks: Reliable attacks against black-box machine learning models. arXiv preprint arXiv:1712.04248, 2017.
216
+
217
+ Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In Security and Privacy (SP), 2017 IEEE Symposium on, pp. 39–57. IEEE, 2017.
218
+
219
+ Pin-Yu Chen, Yash Sharma, Huan Zhang, Jinfeng Yi, and Cho-Jui Hsieh. Ead: Elastic-net attacks to deep neural networks via adversarial examples, 2017.
220
+
221
+ Francesco Croce and Matthias Hein. Provable robustness against all adversarial lp-perturbations for ${ \tt p } { \geq } 1$ . CoRR, abs/1905.11213, 2019. URL http://arxiv.org/abs/1905.11213.
222
+
223
+ John M Danskin. The theory of max-min and its application to weapons allocation problems, volume 5. Springer Science & Business Media, 1967.
224
+
225
+ Yinpeng Dong, Fangzhou Liao, Tianyu Pang, Hang Su, Jun Zhu, Xiaolin Hu, and Jianguo Li. Boosting adversarial attacks with momentum. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
226
+
227
+ John Duchi, Shai Shalev-Shwartz, Yoram Singer, and Tushar Chandra. Efficient projections onto the l1-ball for learning in high dimensions. In Proceedings of the 25th International Conference on Machine Learning, ICML ’08, pp. 272–279, New York, NY, USA, 2008. ACM. ISBN 978- 1-60558-205-4. doi: 10.1145/1390156.1390191. URL http://doi.acm.org/10.1145/ 1390156.1390191.
228
+
229
+ Logan Engstrom, Andrew Ilyas, and Anish Athalye. Evaluating and understanding the robustness of adversarial logit pairing. arXiv preprint arXiv:1807.10272, 2018.
230
+
231
+ Ian Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations, 2015. URL http:// arxiv.org/abs/1412.6572.
232
+
233
+ Sven Gowal, Krishnamurthy Dvijotham, Robert Stanforth, Rudy Bunel, Chongli Qin, Jonathan Uesato, Relja Arandjelovic, Timothy A. Mann, and Pushmeet Kohli. On the effectiveness of interval bound propagation for training verifiably robust models. CoRR, abs/1810.12715, 2018. URL http://arxiv.org/abs/1810.12715.
234
+
235
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European conference on computer vision, pp. 630–645. Springer, 2016.
236
+
237
+ Daniel Kang, Yi Sun, Tom Brown, Dan Hendrycks, and Jacob Steinhardt. Transfer of adversarial robustness between perturbation types. arXiv preprint arXiv:1905.01034, 2019.
238
+
239
+ Harini Kannan, Alexey Kurakin, and Ian J. Goodfellow. Adversarial logit pairing. CoRR, abs/1803.06373, 2018. URL http://arxiv.org/abs/1803.06373.
240
+
241
+ Guy Katz, Clark Barrett, David Dill, Kyle Julian, and Mykel Kochenderfer. Reluplex: An efficient smt solver for verifying deep neural networks. arXiv preprint arXiv:1702.01135, 2017.
242
+
243
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. ICLR Workshop, 2017. URL https://arxiv.org/abs/1607.02533.
244
+
245
+ Jiajun Lu, Hussein Sibai, Evan Fabry, and David Forsyth. No need to worry about adversarial examples in object detection in autonomous vehicles. arXiv preprint arXiv:1707.03501, 2017.
246
+
247
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $=$ rJzIBfZAb.
248
+
249
+ Matthew Mirman, Timon Gehr, and Martin Vechev. Differentiable abstract interpretation for provably robust neural networks. In International Conference on Machine Learning (ICML), 2018. URL https://www.icml.cc/Conferences/2018/Schedule?showEvent $= 2 4 7 7$ .
250
+
251
+ Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. Deepfool: a simple and accurate method to fool deep neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2574–2582, 2016.
252
+
253
+ Marius Mosbach, Maksym Andriushchenko, Thomas Trost, Matthias Hein, and Dietrich Klakow. Logit pairing methods can fool gradient-based attacks. arXiv preprint arXiv:1810.12042, 2018.
254
+
255
+ Nicolas Papernot, Patrick McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. In Security and Privacy (SP), 2016 IEEE Symposium on, pp. 582–597. IEEE, 2016.
256
+
257
+ Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z. Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia Conference on Computer and Communications Security, ASIA CCS ’17, pp. 506–519, New York, NY, USA, 2017. ACM. ISBN 978-1-4503-4944-4. doi: 10.1145/3052973.3053009. URL http://doi.acm.org/10.1145/3052973.3053009.
258
+
259
+ Aditi Raghunathan, Jacob Steinhardt, and Percy Liang. Certified defenses against adversarial examples. In International Conference on Learning Representations, 2018a. URL https: //openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ Bys4ob-Rb.
260
+
261
+ Aditi Raghunathan, Jacob Steinhardt, and Percy S Liang. Semidefinite relaxations for certifying robustness to adversarial examples. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 10900–10910. Curran Associates, Inc., 2018b. URL http://papers.nips.cc/paper/8285-semidefinite-relaxations-forcertifying-robustness-to-adversarial-examples.pdf.
262
+
263
+ Jonas Rauber, Wieland Brendel, and Matthias Bethge. Foolbox: A python toolbox to benchmark the robustness of machine learning models. arXiv preprint arXiv:1707.04131, 2017. URL http://arxiv.org/abs/1707.04131.
264
+
265
+ Jer´ ome Rony, Luiz G. Hafemann, Luiz S. Oliveira, Ismail Ben Ayed, Robert Sabourin, and Eric ˆ Granger. Decoupling direction and norm for efficient gradient-based L2 adversarial attacks and defenses. CoRR, abs/1811.09600, 2018. URL http://arxiv.org/abs/1811.09600.
266
+
267
+ Lukas Schott, Jonas Rauber, Matthias Bethge, and Wieland Brendel. Towards the first adversarially robust neural network model on MNIST. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id ${ . } =$ S1EHOsC9tX.
268
+
269
+ Leslie N Smith. A disciplined approach to neural network hyper-parameters: Part 1–learning rate, batch size, momentum, and weight decay. arXiv preprint arXiv:1803.09820, 2018.
270
+
271
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In International Conference on Learning Representations, 2014. URL http://arxiv.org/abs/1312.6199.
272
+
273
+ Vincent Tjeng, Kai Y. Xiao, and Russ Tedrake. Evaluating robustness of neural networks with mixed integer programming. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HyGIdiRqtm.
274
+
275
+ Florian Tramer and Dan Boneh. Adversarial training and robustness for multiple perturbations. \` arXiv preprint arXiv:1904.13000, 2019.
276
+
277
+ Jonathan Uesato, Brendan O’Donoghue, Pushmeet Kohli, and Aaron van den Oord. Adversarial risk and the dangers of evaluating against weak attacks. In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 5025–5034, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http://proceedings.mlr.press/v80/uesato18a.html.
278
+
279
+ Eric Wong and Zico Kolter. Provable defenses against adversarial examples via the convex outer adversarial polytope. In International Conference on Machine Learning, pp. 5283–5292, 2018.
280
+
281
+ Eric Wong, Frank Schmidt, Jan Hendrik Metzen, and J. Zico Kolter. Scaling provable adversarial defenses. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 8410–8419. Curran Associates, Inc., 2018. URL http://papers.nips.cc/paper/8060-scaling-provableadversarial-defenses.pdf.
282
+
283
+ Algorithm 2 Projection of some perturbation $\delta \in \mathbb { R } ^ { n }$ onto the $\ell _ { 1 }$ ball with radius . We use $| \cdot |$ to denote element-wise absolute value.
284
+
285
+ <table><tr><td>Input:perturbation δ,radius ∈ Sort |δ| into γ : γ1 ≥ γ2 ≥·.: ≥ γn</td></tr><tr><td>ρ:=max{j∈[n]:γi-³(∑²=1r-e)&gt;0}</td></tr><tr><td>n:=¹(∑²=1γi-∈)</td></tr><tr><td>zi := sign(δi)max{γi-n,O} for i=1...n</td></tr><tr><td>return z</td></tr></table>
286
+
287
+ # A STEEPEST DESCENT AND PROJECTIONS FOR $\ell _ { \infty }$ , $\ell _ { 2 }$ , AND $\ell _ { 1 }$ ADVERSARIES
288
+
289
+ In this section, we show what the steepest descent and projection steps are for $\ell _ { p }$ adversaries for $p \in \{ \infty , 2 , 1 \}$ ; these are standard results, but included for a complete description of the algorithms. Note that this differs slightly from the adversaries considered in Schott et al. (2019): while they used an $\ell _ { 0 }$ adversary, we opted to use an $\ell _ { 1 }$ adversary with the same radius. The $\ell _ { 0 }$ ball with radius $\epsilon$ is contained within an $\ell _ { 1 }$ ball with the same radius, so achieving robustness against an $\ell _ { 1 }$ adversary is strictly more difficult.
290
+
291
+ $\ell _ { \infty }$ space The direction of steepest descent with respect to the $\ell _ { \infty }$ norm is
292
+
293
+ $$
294
+ v _ { \infty } ( \delta ) = \alpha \cdot \mathrm { s i g n } ( \nabla l ( x + \delta ; \theta ) )
295
+ $$
296
+
297
+ and the projection operator onto $\Delta _ { \infty , \epsilon }$ is
298
+
299
+ $$
300
+ \mathcal { P } _ { \Delta _ { \infty , \epsilon } } ( \delta ) = \mathrm { c l i p } _ { [ - \epsilon , \epsilon ] } ( \delta )
301
+ $$
302
+
303
+ $\ell _ { 2 }$ space The direction of steepest descent with respect to the $\ell _ { 2 }$ norm is
304
+
305
+ $$
306
+ v _ { 2 } ( \delta ) = \alpha \cdot \frac { \nabla \ell ( x + \delta ; \theta ) } { \| \nabla \ell ( x + \delta ; \theta ) \| _ { 2 } }
307
+ $$
308
+
309
+ and the projection operator onto the $\ell _ { 2 }$ ball around $x$ is
310
+
311
+ $$
312
+ \mathcal { P } _ { \Delta _ { 2 , \epsilon } } ( \delta ) = \epsilon \cdot \frac { \delta } { \operatorname* { m a x } \{ \epsilon , \| \delta \| _ { 2 } \} }
313
+ $$
314
+
315
+ $\ell _ { 1 }$ space The direction of steepest descent with respect to the $\ell _ { 1 }$ norm is
316
+
317
+ $$
318
+ v _ { 1 } ( \delta ) = \alpha \cdot \mathrm { s i g n } \left( \frac { \partial \ell ( x + \delta ; \theta ) } { \partial \delta _ { i ^ { \star } } } \right) \cdot e _ { i ^ { \star } }
319
+ $$
320
+
321
+ where
322
+
323
+ $$
324
+ \boldsymbol { i } ^ { \star } = \arg \operatorname* { m a x } _ { i } | \nabla l ( \boldsymbol { x } + \boldsymbol { \delta } ; \boldsymbol { \theta } ) _ { i } |
325
+ $$
326
+
327
+ and $e _ { i ^ { * } }$ is a unit vector with a one in position $i ^ { * }$ . Finally, the projection operator onto the $\ell _ { 1 }$ ball,
328
+
329
+ $$
330
+ \mathcal { P } _ { \Delta _ { 1 , \epsilon } } ( \delta ) = \underset { \delta ^ { \prime } : \| \delta ^ { \prime } \| _ { 1 } \le \epsilon } { \arg \operatorname* { m i n } } \| \delta - \delta ^ { \prime } \| _ { 2 } ^ { 2 } ,
331
+ $$
332
+
333
+ can be solved with Algorithm 2, and we refer the reader to Duchi et al. (2008) for its derivation.
334
+
335
+ # A.1 ENHANCED $\ell _ { 1 }$ STEEPEST DESCENT STEP
336
+
337
+ Note that the steepest descent step for $\ell _ { 1 }$ only updates a single coordinate per step. This can be quite inefficient, as pointed out by Tramer & Boneh (2019). To tackle this issue, and also empirically \` improve the attack success rate, Tramer & Boneh (2019) instead select the top \` $k$ coordinates according to Equation 20 to update. In this work, we adopt a similar but slightly modified scheme: we randomly sample $k$ to be some integer within some range $[ k _ { 1 } , k _ { 2 } ]$ , and update each coordinate with step size $\alpha ^ { \prime } \bar { = } \alpha / k$ . We find that the randomness induced by varying the number of coordinates aids in avoiding the gradient masking problem observed by Tramer & Boneh (2019). \`
338
+
339
+ # A.2 RESTRICTING THE STEEPEST DESCENT COORDINATE
340
+
341
+ The steepest descent direction for both the $\ell _ { 0 }$ and $\ell _ { 1 }$ norm end up selecting a single coordinate direction to move the perturbation. However, if the perturbation is already at the boundary of pixel space (for MNIST, this is the range [0,1] for each pixel), then it’s possible for the PGD adversary to get stuck in a loop trying to use the same descent direction to escape pixel space. To avoid this, we only allow the steepest descent directions for these two attacks to choose coordinates that keep the image in the range of real pixels.
342
+
343
+ # B EXPERIMENTAL DETAILS
344
+
345
+ # B.1 HYPERPARAMETERS FOR PGD ADVERSARIES
346
+
347
+ In this section, we describe the parameters used for all PGD adversaries in this paper.
348
+
349
+ MNIST The $\ell _ { \infty }$ adversary used a step size $\alpha = 0 . 0 1$ within a radius of $\epsilon = 0 . 3$ for 50 iterations.
350
+
351
+ The $\ell _ { 2 }$ adversary used a step size $\alpha = 0 . 1$ within a radius of $\epsilon = 1 . 5$ for 100 iterations.
352
+
353
+ The $\ell _ { 1 }$ adversary used a step size of $\alpha = 0 . 0 5$ within a radius of $\epsilon = 1 2$ for 50 iterations. By default the attack is run with two restarts, once starting with $\delta = 0$ and once by randomly initializing $\delta$ in the allowable perturbation ball. $k _ { 1 } = 5$ , $k _ { 2 } = 2 0$ as described in A.1.
354
+
355
+ The MSD adversary used step sizes of $\alpha = ( 0 . 0 1 , 0 . 2 , 0 . 0 5 )$ for the $( \ell _ { \infty } , \ell _ { 2 } , \ell _ { 1 } )$ directions within a radius of $\epsilon = ( 0 . 3 , 1 . 5 , 1 2 )$ for 100 iterations.
356
+
357
+ At test time, we increase the number of iterations to (100, 200, 100) for $( \ell _ { \infty } , \ell _ { 2 } , \ell _ { 1 } )$ .
358
+
359
+ CIFAR10 The $\ell _ { \infty }$ adversary used a step size $\alpha = 0 . 0 0 3$ within a radius of $\epsilon = 0 . 0 3$ for 40 iterations.
360
+
361
+ The $\ell _ { 2 }$ adversary used a step size $\alpha = 0 . 0 5$ within a radius of $\epsilon = 0 . 5$ for 50 iterations.
362
+
363
+ The $\ell _ { 1 }$ adversary used a step size $\alpha = 0 . 1$ within a radius of $\epsilon = 1 2$ for 50 iterations. $k _ { 1 } = 5$ , $k _ { 2 } = 2 0$ as described in A.1.
364
+
365
+ The MSD adversary used step sizes of $\alpha = ( 0 . 0 0 3 , 0 . 0 5 , 0 . 0 5 )$ for the $( \ell _ { \infty } , \ell _ { 2 } , \ell _ { 1 } )$ directions within a radius of $\epsilon = ( 0 . 0 3 , 0 . 3 , 1 2 )$ for 50 iterations. Note that the MSD model trained for $\ell _ { 2 }$ radius of 0.3 is in fact robust to a higher radius of 0.5.
366
+
367
+ # B.2 TRAINING HYPERPARAMETERS
368
+
369
+ In this section, we describe the parameters used for adversarial training. For all the models, we used the SGD optimizer with momentum 0.9 and weight decay $5 \cdot 1 0 ^ { - 4 } $ .
370
+
371
+ MNIST We train the models to a maximum of 20 epochs. We used a variation of the learning rate schedule from Smith (2018), which is piecewise linear from 0 to 0.1 over the first 7 epochs, down to 0.001 over the next 8 epochs, and finally back down to 0.0001 in the last 5 epochs.
372
+
373
+ CIFAR10 We used a variation of the learning rate schedule from Smith (2018) to achieve superconvergence in 50 epochs, which is piecewise linear from 0 to 0.1 over the first 20 epochs, down to 0.005 over the next 20 epochs, and finally back down to 0 in the last 10 epochs.
374
+
375
+ # C EXTENDED RESULTS
376
+
377
+ Here, we show the full tables which break down the overall adversarial error rates over individual attacks for both MNIST and CIFAR10, along with robustness curves for all models in the paper.
378
+
379
+ Table 3: Summary of adversarial accuracy results for MNIST
380
+
381
+ <table><tr><td rowspan="2"></td><td colspan="5"></td><td rowspan="2">Worst</td><td colspan="2">PGD</td></tr><tr><td>P</td><td>P2</td><td>P1</td><td>B-ABS</td><td>ABS PGD</td><td>Aug</td><td>MSD</td></tr><tr><td>Clean Accuracy</td><td>99.1%</td><td>99.4%</td><td>98.9%</td><td>99%</td><td>99%</td><td>98.9%</td><td>99.1%</td><td>98.2%</td></tr><tr><td>PGD-lo</td><td>90.3%</td><td>0.4%</td><td>0.0%</td><td>1</td><td>1</td><td>68.4%</td><td>83.7%</td><td>63.7%</td></tr><tr><td>FGSM</td><td>94.9%</td><td>68.6%</td><td>6.4%</td><td>85%</td><td>34%</td><td>82.4%</td><td>90.9%</td><td>81.8%</td></tr><tr><td>PGD-Foolbox</td><td>92.1%</td><td>8.5%</td><td>0.1%</td><td>86%</td><td>13%</td><td>72.1%</td><td>85.7%</td><td>67.9%</td></tr><tr><td>MIM</td><td>92.3%</td><td>14.5%</td><td>0.1%</td><td>85%</td><td>17%</td><td>73.9%</td><td>87.3%</td><td>71.0%</td></tr><tr><td>l attacks (∈ = 0.3)</td><td>90.3%</td><td>0.4%</td><td>0.0%</td><td>77%</td><td>8%</td><td>68.4%</td><td>83.7%</td><td>63.7%</td></tr><tr><td>PGD-l2</td><td>83.8%</td><td>87.0%</td><td>70.8%</td><td>1</td><td>-</td><td>85.3%</td><td>87.9%</td><td>84.2%</td></tr><tr><td>PGD-Foolbox</td><td>93.4%</td><td>89.7%</td><td>74.4%</td><td>63%</td><td>87%</td><td>86.9%</td><td>91.5%</td><td>86.9%</td></tr><tr><td>Gaussian Noise</td><td>98.9%</td><td>99.6%</td><td>98.0%</td><td>89%</td><td>98%</td><td>97.4%</td><td>99.0%</td><td>97.8%</td></tr><tr><td>Boundary Attack</td><td>52.6%</td><td>92.1%</td><td>83.0%</td><td>91%</td><td>83%</td><td>86.9%</td><td>79.1%</td><td>88.6%</td></tr><tr><td>DeepFool</td><td>95.1%</td><td>92.2%</td><td>76.5%</td><td>41%</td><td>83%</td><td>87.9%</td><td>93.5%</td><td>87.9%</td></tr><tr><td>Pointwise Attack</td><td>74.3%</td><td>97.4%</td><td>96.6%</td><td>87%</td><td>94%</td><td>92.7%</td><td>89.0%</td><td>95.1%</td></tr><tr><td>DDN</td><td>82.7%</td><td>87.0%</td><td>70.8%</td><td>-</td><td></td><td>85.1%</td><td>85.2%</td><td>84.3%</td></tr><tr><td>CWL2</td><td>88.2%</td><td>88.1%</td><td>75.5%</td><td>1</td><td>=</td><td>85.2%</td><td>87.5%</td><td>85.1%</td></tr><tr><td>l2 attacks (∈ = 1.5)</td><td>45.3%</td><td>87.0%</td><td>70.3%</td><td>39%</td><td>80%</td><td>82.1%</td><td>75.0%</td><td>82.6%</td></tr><tr><td>PGD-l1</td><td>51.8%</td><td>49.9%</td><td>71.8%</td><td>1</td><td>1</td><td>66.5%</td><td>57.4%</td><td>64.8%</td></tr><tr><td>Salt &amp; Pepper</td><td>55.5%</td><td>96.3%</td><td>95.6%</td><td>96%</td><td>95%</td><td>86.4%</td><td>71.9%</td><td>92.2%</td></tr><tr><td>Pointwise Attack</td><td>2.4%</td><td>66.4%</td><td>85.2%</td><td>82%</td><td>78%</td><td>60.1%</td><td>17.1%</td><td>72.8%</td></tr><tr><td>l1 attacks (∈ =12)</td><td>1.4%</td><td>43.4%</td><td>71.8%</td><td>82%</td><td>78%</td><td>54.6%</td><td>15.6%</td><td>62.3%</td></tr><tr><td>All attacks</td><td>1.4%</td><td>0.4%</td><td>0.0%</td><td>39%</td><td>8%</td><td>53.7%</td><td>15.6%</td><td>58.7%</td></tr></table>
382
+
383
+ # C.1 MNIST RESULTS
384
+
385
+ Expanded table of results Table 3 contains the full table of results for all attacks on all models on the MNIST dataset. All attacks were run on a subset of the first 1000 test examples with 10 random restarts, with the exception of Boundary Attack, which by default makes 25 trials per iteration, and DDN attack, which does not benefit from restarts owing to a deterministic starting point. Note that the results for B-ABS and ABS models are from Schott et al. (2019), which uses gradient estimation techniques whenever a gradient is needed, and the robustness against all attacks for B-ABS and ABS is an upper bound based on the reported results. Further, these models are not evaluated with restarts, pushing the reported results even higher than actual.
386
+
387
+ # C.2 CIFAR10 RESULTS
388
+
389
+ Expanded table of results Table 4 contains the full table of results for all attacks on all models on the CIFAR10 dataset. All attacks were run on a subset of the first 1000 test examples with 10 random restarts, with the exception of Boundary Attack, which by default makes 25 trials per iteration, and DDN attack, which does not benefit from restarts owing to a deterministic starting point. Further note that salt $\&$ pepper and pointwise attacks in the $\ell _ { 1 }$ section are technically $\ell _ { 0 }$ attacks, but produce perturbations in the $\ell _ { 1 }$ ball. Finally, it is clear here that while the training against an $\ell _ { 1 }$ PGD adversary defends against said PGD adversary, it does not seem to transfer to robustness against other attacks.
390
+
391
+ # D COMPARISON WITH CONCURRENT WORK
392
+
393
+ In this section we compare the results of our trained MSD model with that of Tramer & Boneh (2019), \` who study the theoretical and empirical trade-offs of adversarial robustness in various settings when defending against multiple adversaries. Training methods presented by them in their comparisons, namely $A d v _ { a v g }$ and $A d v _ { m a x }$ closely resemble the naive approaches discussed in this paper: PGDAug and Worst-PGD respectively. We use the results as is from their work, and additionally compare the position of our MSD models at the revised thresholds used by Tramer & Boneh (2019) without \` specially retraining them.
394
+
395
+ The results of Tables 5 and 6 show that the relative advantage of MSD over naive techniques does hold up. While we do make a comparison to the most relevant concurrent work for completeness, the following differences can bias the robust accuracies reported for the MSD models to relatively lower than expected (and correspondingly, the robust accuracies reported for the other models are relatively higher than expected):
396
+
397
+ Table 4: Summary of adversarial accuracy results for CIFAR10
398
+
399
+ <table><tr><td></td><td>P</td><td>P2</td><td>P1</td><td>Worst-PGD</td><td>PGD-Aug</td><td>MSD</td></tr><tr><td>Cleanaccuracy</td><td>83.3%</td><td>90.2%</td><td>73.3%</td><td>81.0%</td><td>84.6%</td><td>81.7%</td></tr><tr><td>PGD-lo</td><td>50.3%</td><td>48.4%</td><td>29.8%</td><td>44.9%</td><td>42.8%</td><td>49.8%</td></tr><tr><td rowspan="3">FGSM PGD-Foolbox</td><td>57.4%</td><td>43.4%</td><td>12.7%</td><td>54.9%</td><td>51.9%</td><td>55.0%</td></tr><tr><td>52.3%</td><td>28.5%</td><td>0.6%</td><td>48.9%</td><td>44.6%</td><td>49.8%</td></tr><tr><td>52.7%</td><td>30.4%</td><td>0.7%</td><td>49.9%</td><td>46.1%</td><td>50.6%</td></tr><tr><td>loo attacks (∈ = 0.03)</td><td>50.7%</td><td>28.3%</td><td>0.2%</td><td>44.9%</td><td>42.5%</td><td>47.6%</td></tr><tr><td rowspan="8">PGD-l2 PGD-Foolbox Gaussian Noise Boundary Attack</td><td>59.0%</td><td>62.1%</td><td>28.9%</td><td>64.1%</td><td>66.9%</td><td>66.0%</td></tr><tr><td>61.6%</td><td>64.1%</td><td>4.9%</td><td>65.0%</td><td>68.0%</td><td>66.4%</td></tr><tr><td>82.2%</td><td>89.8%</td><td>62.3%</td><td>81.3%</td><td>84.3%</td><td>81.8%</td></tr><tr><td>65.5%</td><td>67.9%</td><td>2.3%</td><td>64.4%</td><td>69.2%</td><td>67.9%</td></tr><tr><td>62.2% Pointwise Attack</td><td>67.3%</td><td>0.9%</td><td>64.4%</td><td>67.4%</td><td>65.7%</td></tr><tr><td>80.4%</td><td>88.6%</td><td>46.2%</td><td>78.9%</td><td>83.8%</td><td>81.4%</td></tr><tr><td>60.0%</td><td>63.5%</td><td>0.1%</td><td>64.5%</td><td>67.7%</td><td>66.2%</td></tr><tr><td>62.0%</td><td>71.6%</td><td>0.1%</td><td>66.9%</td><td>71.5%</td><td>68.7%</td></tr><tr><td>l2 attacks (∈ = 0.05)</td><td>57.3%</td><td>61.6%</td><td>0.0%</td><td>61.7%</td><td>65.0%</td><td>64.3%</td></tr><tr><td>PGD-l1</td><td>16.5%</td><td>49.2%</td><td>69.1%</td><td>39.5%</td><td>54.0%</td><td>53.4%</td></tr><tr><td>Salt &amp; Pepper</td><td>63.4%</td><td>74.2%</td><td>35.5%</td><td>75.2%</td><td>80.7%</td><td>75.6%</td></tr><tr><td>Pointwise Attack</td><td>49.6%</td><td>62.4%</td><td>8.4%</td><td>63.3%</td><td>77.0%</td><td>72.8%</td></tr><tr><td>l1 attacks (∈=12)</td><td>16.0%</td><td>46.6%</td><td>7.9%</td><td>39.4%</td><td>54.0%</td><td>53.4%</td></tr><tr><td>All attacks</td><td>15.6%</td><td>27.5%</td><td>0.0%</td><td>34.9%</td><td>40.6%</td><td>46.1%</td></tr></table>
400
+
401
+ Table 5: Comparison with contemporary work on MNIST (higher is better). Results for all models except MSD are taken as is from Tramer & Boneh (2019) \`
402
+
403
+ <table><tr><td></td><td>Vanilla</td><td>Advo</td><td>AdU1</td><td>Adu2</td><td>Advaug</td><td>Adumax</td><td>MSD</td></tr><tr><td>Clean accuracy</td><td>99.4%</td><td>99.1%</td><td>98.9%</td><td>98.5%</td><td>97.3%</td><td>97.2%</td><td>98.2%</td></tr><tr><td>loo attacks (∈= 0.3)</td><td>0.0%</td><td>91.1%</td><td>0.0%</td><td>0.4%</td><td>76.7%</td><td>71.7%</td><td>63.7%</td></tr><tr><td>l2 attacks (∈= 2.0)</td><td>12.4%</td><td>12.1%</td><td>50.6%</td><td>71.8%</td><td>58.3%</td><td>56.0%</td><td>67.4%</td></tr><tr><td>l1 attacks (ε = 10)</td><td>8.5%</td><td>11.3%</td><td>78.5%</td><td>68.0%</td><td>53.9%</td><td>62.6%</td><td>70.0%</td></tr><tr><td>All attacks</td><td>0.0%</td><td>6.8%</td><td>0.0%</td><td>0.4%</td><td>49.9%</td><td>52.4%</td><td>60.9%</td></tr></table>
404
+
405
+ 1. Use of random restarts: We observe in our experiments that using up to 10 restarts for all our attacks leads to a decrease in model accuracy from 5 to $10 \%$ across all models. Tramer & \` Boneh do not mention restarting their attacks for these models and so the results for models apart from MSD in Tables 5, 6 could potentially be lowered with random restarts.
406
+ 2. Different training and testing thresholds: The MSD model for the MNIST dataset was trained at $\epsilon = ( 0 . 3 , 1 . 5 , 1 2 )$ for the $\ell _ { \infty }$ , $\ell _ { 2 }$ , $\ell _ { 1 }$ perturbation balls respectively, while Tramer\` & Boneh (2019) tested at $\epsilon = ( 0 . 3 , 2 . 0 , 1 0 )$ . This may lower the robust accuracy at these thresholds for the MSD model, since it was not trained for that particular threshold. Likewise, the MSD model for CIFAR10 was also trained at $\epsilon = ( 0 . 0 3 , 0 . 0 5 , 1 2 )$ for the $\ell _ { \infty }$ , $\ell _ { 2 } , \ell _ { 1 }$ perturbation balls respectively, while Tramer & Boneh (2019) tested at \` $\begin{array} { r } { \epsilon = ( \frac { 4 } { 2 5 5 } , 0 , \frac { 2 0 0 0 } { 2 5 5 } ) } \end{array}$ 2000255 ).
407
+ 3. Different perturbation models: For the CIFAR10 results in Table 6, $A d v _ { a v g }$ & $A d v _ { m a x }$ models are trained and tested only for $\ell _ { 1 }$ and $\ell _ { \infty }$ adversarial perturbations, whereas the MSD model is robust to the union of $\ell _ { 1 } , \ell _ { 2 }$ and $\ell _ { \infty }$ , achieving a much harder task.
408
+ 4. Larger Suite of Attacks Used: The attacks used by Tramer & Boneh are PGD, EAD \` (Chen et al., 2017) and Pointwise Attack (Schott et al., 2019) for $\ell _ { 1 }$ ; PGD, C&W (Carlini & Wagner, 2017) and Boundary Attack (Brendel et al., 2017) for $\ell _ { 2 }$ ; and PGD for $\ell _ { \infty }$ adversaries. We use a more expansive suite of attacks as shown in Appendix C. Some of the attacks like DDN, which proved to be strong adversaries in most cases, were not considered
409
+
410
+ Table 6: Comparison with contemporary work on CIFAR10 (higher is better). Results for all models except MSD are taken as is from Tramer & Boneh (2019) \`
411
+
412
+ <table><tr><td></td><td>Vanilla</td><td>Advo</td><td>AdU1</td><td>Advavg</td><td>Advmax</td><td>MSD</td></tr><tr><td>Clean accuracy</td><td>95.7%</td><td>92.0%</td><td>90.8%</td><td>91.1%</td><td>91.2%</td><td>82.1%</td></tr><tr><td>loattacks(∈= 288 4</td><td>0.0%</td><td>71.0%</td><td>53.4%</td><td>64.1%</td><td>65.7%</td><td>65.6%</td></tr><tr><td>l1 attacks (ε = 255 All attacks</td><td>0.0% 0.0%</td><td>16.4% 16.4%</td><td>66.2% 53.1%</td><td>60.8% 59.4%</td><td>62.5% 61.1%</td><td>62.0% 61.7%</td></tr></table>
413
+
414
+ Table 7: Performance on CIFAR-10-C
415
+
416
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Accuracy</td></tr><tr><td rowspan=1 colspan=1>Standard model</td><td rowspan=1 colspan=1>66.0%</td></tr><tr><td rowspan=1 colspan=1>PP2P1</td><td rowspan=1 colspan=1>75.0%82.7%57.8%</td></tr><tr><td rowspan=1 colspan=1>Worst-PGDPGD-AugMSD</td><td rowspan=1 colspan=1>70.8%76.8%74.2%</td></tr></table>
417
+
418
+ by Tramer & Boneh (2019) and thus were only used to attack the MSD models in Tables 5 \` and 6.
419
+
420
+ # E ATTACKS OUTSIDE THE THREAT MODEL
421
+
422
+ In this section, we present some additional experiments exploring the performance of our model on attacks which lie beyond the threat model. Note that there is no principled reason why we would believe this to be the case (as most adversarial defenses tend to not generalize beyond the threat model defended against), and this is presented for exploratory reasons.
423
+
424
+ Common corruptions We measure the performance of all the models on CIFAR-10-C, which is a CIFAR10 benchmark which has had common corruptions applied to it (e.g. noise, blur, and compression). We report the results in Table 7. We find that that, apart from the $P _ { 1 }$ model, the rest achieve some improved robustness against these common corruptions above the standard CIFAR10 model.
425
+
426
+ Defending against $\ell _ { 1 }$ and $\ell _ { \infty }$ and evaluating on $\ell _ { 2 }$ We also briefly study what happens when one trains against $\ell _ { 1 }$ and $\ell _ { \infty }$ threat models, while evaluating against the $\ell _ { 2 }$ adversary. Specifically, we take the MSD approach on MNIST and simply remove the $\ell _ { 2 }$ adversary from the threat model. This results in a model which has its $\ell _ { 1 }$ and $\ell _ { \infty }$ robust performance against a PGD adversary drop by $1 \%$ and its $\ell _ { 2 }$ robust performance against a PGD adversary (which it was not trained for) drops by $2 \%$ in comparison to the original MSD approach on all three threat models.
427
+
428
+ As a result, we empirically observe that including the $\ell _ { 2 }$ threat model in this setting actually improved overall robustness against all three threat models. Unsurprisingly, the $\ell _ { 2 }$ performance drops to some degree, but the model does not lose all of its robustness.
md/train/ryacTMZRZ/ryacTMZRZ.md ADDED
@@ -0,0 +1,256 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A CONVOLUTIONAL APPROACH TO LEARNING TIMESERIES SIMILARITY
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Computing distances between examples is at the core of many learning algorithms for time series. Consequently, a great deal of work has gone into designing effective time series distance measures. We present Jiffy, a simple and scalable distance metric for multivariate time series. Our approach is to reframe the task as a representation learning problem—rather than design an elaborate distance function, we use a CNN to learn an embedding such that the Euclidean distance is effective. By aggressively max-pooling and downsampling, we are able to construct this embedding using a highly compact neural network. Experiments on a diverse set of multivariate time series datasets show that our approach consistently outperforms existing methods.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Measuring distances between examples is a fundamental component of many classification, clustering, segmentation and anomaly detection algorithms for time series (Rakthanmanon et al., 2012; Schafer, 2014; Begum et al., 2015; Dau et al., 2016). Because the distance measure used can have ¨ a significant effect on the quality of the results, there has been a great deal of work developing effective time series distance measures (Ganeshapillai & Guttag, 2011; Keogh et al., 2005; Bagnall et al., 2016; Begum et al., 2015; Ding et al., 2008). Historically, most of these measures have been hand-crafted. However, recent work has shown that a learning approach can often perform better than traditional techniques (Do et al., 2017; Mei et al., 2016; Che et al., 2017).
12
+
13
+ We introduce a metric learning model for multivariate time series. Specifically, by learning to embed time series in Euclidean space, we obtain a metric that is both highly effective and simple to implement using modern machine learning libraries. Unlike many other deep metric learning approaches for time series, we use a convolutional, rather than a recurrent, neural network, to construct the embedding. This choice, in combination with aggressive maxpooling and downsampling, results in a compact, accurate network.
14
+
15
+ Using a convolutional neural network for metric learning per se is not a novel idea (Oh Song et al., 2016; Schroff et al., 2015); however, time series present a set of challenges not seen together in other domains, and how best to embed them is far from obvious. In particular, time series suffer from:
16
+
17
+ 1. A lack of labeled data. Unlike text or images, time series cannot typically be annotated post-hoc by humans. This has given rise to efforts at unsupervised labeling (Blalock & Guttag, 2016), and is evidenced by the small size of most labeled time series datasets. Of the 85 datasets in the UCR archive (Chen et al., 2015), for example, the largest dataset has fewer than 17000 examples, and many have only a few hundred.
18
+ 2. A lack of large corpora. In addition to the difficulty of obtaining labels, most researchers have no means of gathering even unlabeled time series at the same scale as images, videos, or text. Even the largest time series corpora, such as those on Physiobank (Goldberger et al., 2000), are tiny compared to the virtually limitless text, image, and video data available on the web.
19
+ 3. Extraneous data. There is no guarantee that the beginning and end of a time series correspond to the beginning and end of any meaningful phenomenon. I.e., examples of the class or pattern of interest may take place in only a small interval within a much longer time series. The rest of the time series may be noise or transient phenomena between meaningful events (Rakthanmanon et al., 2011; Hao et al., 2013).
20
+
21
+ 4. Need for high speed. One consequence of the presence of extraneous data is that many time series algorithms compute distances using every window of data within a time series (Mueen et al., 2009; Blalock & Guttag, 2016; Rakthanmanon et al., 2011). A time series of length $T$ has $O ( T )$ windows of a given length, so it is essential that the operations done at each window be efficient.
22
+
23
+ As a result of these challenges, an effective time series distance metric must exhibit the following properties:
24
+
25
+ • Efficiency: Distance measurement must be fast, in terms of both training time and inference time. • Simplicity: As evidenced by the continued dominance of the Dynamic Time Warping (DTW) distance (Sakoe & Chiba, 1978) in the presence of more accurate but more complicated rivals, a distance measure must be simple to understand and implement. • Accuracy: Given a labeled dataset, the metric should yield a smaller distance between similarly labeled time series. This behavior should hold even for small training sets.
26
+
27
+ Our primary contribution is a time series metric learning method, Jiffy, that exhibits all of these properties: it is fast at both training and inference time, simple to understand and implement, and consistently outperforms existing methods across a variety of datasets.
28
+
29
+ We introduce the problem statement and the requisite definitions in Section 2. We summarize existing state-of-the-art approaches (both neural and non-neural) in Section 3 and go on to detail our own approach in Section 4. We then present our results in Section 5. The paper concludes with implications of our work and avenues for further research.
30
+
31
+ # 2 PROBLEM DEFINITION
32
+
33
+ We first define relevant terms, frame the problem, and state our assumptions.
34
+
35
+ Definition 2.1. Time Series A $D$ -variable time series $X$ of length $T$ is a sequence of real-valued vectors ${ \bf x } _ { 1 } , \dots , { \bf x } _ { T } , { \bf x } _ { i } \in \mathbb { R } ^ { D }$ . If $D = 1$ , we call $X$ “univariate”, and if $D > 1$ , we call $X$ “multivariate.” We denote the space of possible $D$ -variable time series $\mathcal { T } ^ { D }$ .
36
+
37
+ Definition 2.2. Distance Metric $A$ distance metric is defined a distance function $d : \mathcal { S } \times \mathcal { S } \mathbb { R }$ over a set of objects $s$ such that, for any $x , y \in S$ , the following properties hold:
38
+
39
+ • Symmetry: $d ( x , y ) = d ( y , x )$
40
+ • Non-negativity: $d ( x , y ) \geq 0$
41
+ • Triangle Inequality: $d ( x , z ) + d ( y , z ) \geq d ( x , z )$ • Identity of Indiscernibles: $x = y \Leftrightarrow d ( x , y ) = 0$
42
+
43
+ Our approach to learning a metric is to first learn an embedding into a fixed-size vector space, and then use the Euclidean distance on the embedded vectors to measure similarity. Formally, we learn a function $f : \mathcal { T } ^ { D } \to \mathbb { R } ^ { N }$ and compute the distance between time series $X , Y \in \mathcal { T } ^ { D }$ as:
44
+
45
+ $$
46
+ d ( X , Y ) \triangleq \| f ( X ) - f ( Y ) \| _ { 2 }
47
+ $$
48
+
49
+ # 2.1 ASSUMPTIONS
50
+
51
+ Jiffy depends on two assumptions about the time series being embedded. First, we assume that all time series are primarily “explained” by one class. This means that we do not consider multilabel tasks or tasks wherein only a small subsequence within each time series is associated with a particular label, while the rest is noise or phenomena for which we have no class label. This assumption is implicitly made by most existing work (Hu et al., 2013) and is satisfied whenever one has recordings of individual phenomena, such as gestures, heartbeats, or actions.
52
+
53
+ The second assumption is that the time series dataset is not too small, in terms of either number of time series or their lengths. Specifically, we do not consider datasets in which the longest time series is of length $T < 4 0$ or the number of examples per class is less than 25. The former number is the smallest number such that our embedding will not be longer than the input in the univariate case, while the latter is the smallest number found in any of our experimental datasets (and therefore the smallest on which we can claim reasonable performance).
54
+
55
+ For datasets too small to satisfy these constraints, we recommend using a traditional distance measure, such as Dynamic Time Warping, that does not rely on a learning phase.
56
+
57
+ # 3 RELATED WORK
58
+
59
+ # 3.1 HAND-CRAFTED DISTANCE MEASURES
60
+
61
+ Historically, most work on distance measures between time series has consisted of hand-crafted algorithms designed to reflect prior knowledge about the nature of time series. By far the most prevalent is the Dynamic Time Warping (DTW) distance (Sakoe & Chiba, 1978). This is obtained by first aligning two time series using dynamic programming, and then computing the Euclidean distance between them. DTW requires time quadratic in the time series’ length in the worst case, but is effectively linear time when used for similarity search; this is thanks to numerous lower bounds that allow early abandoning of the computation in almost all cases (Rakthanmanon et al., 2012).
62
+
63
+ Other handcrafted measures include the Uniform Scaling Distance (Keogh, 2003), the Scaled Warped Matching Distance (Fu et al., 2008), the Complexity-Invariant Distance (Batista et al., 2011), the Shotgun Distance (Schafer, 2014), and many variants of DTW, such as weighted DTW (Gane- ¨ shapillai & Guttag, 2011), DTW-A (Shokoohi-Yekta et al., 2015), and global alignment kernels (Cuturi, 2011). However, nearly all of these measures are defined only for univariate time series, and generalizing them to multivariate time series is not trivial (Shokoohi-Yekta et al., 2015).
64
+
65
+ # 3.2 HAND-CRAFTED REPRESENTATIONS
66
+
67
+ In addition to hand-crafted functions of raw time series, there are numerous hand-crafted representations of time series. Perhaps the most common are Symbolic Aggregate Approximation (SAX) (Lin et al., 2003) and its derivatives (Camerra et al., 2010; Senin & Malinchik, 2013). These are discretization techniques that low-pass filter, downsample, and quantize the time series so that they can be treated as strings. Slightly less lossy are Adaptive Piecewise Constant Approximation (Keogh et al., 2001a), Piecewise Aggregate Approximation (Keogh et al., 2001b), and related methods, which approximate time series as sequences of low-order polynomials.
68
+
69
+ The most effective of these representations tend to be extremely complicated; the current state-ofthe-art (Schafer & Leser, 2017), for example, entails windowing, Fourier transformation, quantiza- ¨ tion, bigram extraction, and ANOVA F-tests, among other steps. Moreover, it is not obvious how to generalize them to multivariate time series.
70
+
71
+ # 3.3 METRIC LEARNING FOR TIME SERIES
72
+
73
+ A promising alternative to hand-crafted representations and distance functions for time series is metric learning. This can take the form of either learning a distance function directly or learning a representation that can be used with an existing distance function.
74
+
75
+ Among the most well-known methods in the former category is that of (Ratanamahatana & Keogh, 2004a), which uses an iterative search to learn data-dependent constraints on DTW alignments. More recently, Mei et al. (2016) use a learned Mahalanobis distance to improve the accuracy of DTW. Both of these approaches yield only a pseudometric, which does not obey the triangle inequality. To come closer to a true metric, Che et al. (2017) combined a large-margin classification objective with a sampling step (even at test time) to create a DTW-like distance that obeys the triangle inequality with high probability as the sample size increases.
76
+
77
+ In the second category are various works that learn to embed time series into Euclidean space. Pei et al. (2016) use recurrent neural networks in a Siamese architecture (Bromley et al., 1994) to learn an embedding; they optimize the embeddings to have positive inner products for time series of the same class but negative inner products for those of different classes. A similar approach that does not require class labels is that of Arnaud et al. (2017). This method trains a Siamese, single-layer
78
+
79
+ CNN to embed time series in a space such that the pairwise Euclidean distances approximate the pairwise DTW distances. Lei et al. (2017) optimize a similar objective, but do so by sampling the pairwise distances and using matrix factorization to directly construct feature representations for the training set (i.e., with no model that could be applied to a separate test set).
80
+
81
+ These methods seek to solve much the same problem as Jiffy but, as we show experimentally, produce metrics of much lower quality.
82
+
83
+ # 4 METHOD
84
+
85
+ We learn a metric by learning to embed time series into a vector space and comparing the resulting vectors with the Euclidean distance. Our embedding function is takes the form of a convolutional neural network, shown in Figure 1. The architecture rests on three basic layers: a convolutional layer, maxpooling layer, and a fully connected layer.
86
+
87
+ The convolutional layer is included to learn the appropriate subsequences from the input. The network employs one-dimensional filters convolved over all time steps, in contrast to traditional twodimensional filters used with images. We opt for one-dimensional filters because time series data is characterized by infrequent sampling. Convolving over each of the variables at a given timestep has little intuitive meaning in developing an embedding when each step measurement has no coherent connection to time. For discussion regarding the mathematical connection between a learned convolutional filter and traditional subsequence-based analysis of time series, we direct the reader to (Cui et al., 2016).
88
+
89
+ The maxpooling layer allows the network to be resilient to translational noise in the input time series. Unlike most existing neural network architectures, the windows over which we max pool are defined as percentages of the input length, not as constants. This level of pooling allows us to heavily downsample and denoise the input signal and is fed into the final fully connected layer.
90
+
91
+ We downsample heavily after the filters are applied such that each time series is reduced to a fixed size. We do so primarily for efficiency—further discussion on parameter choice for Jiffy may be found in Section 6.
92
+
93
+ We then train the network by appending a softmax layer and using cross-entropy loss with the ADAM (Kingma & Ba, 2014) optimizer. We experimented with more traditional metric learning loss functions, rather than a classification objective, but found that they made little or no difference while adding to the complexity of the training procedure; specific loss functions tested include several variations of Siamese networks (Bromley et al., 1994; Pei et al., 2016) and the triplet loss (Hoffer & Ailon, 2015).
94
+
95
+ # 4.1 COMPLEXITY ANALYSIS
96
+
97
+ For ease of comparison to more traditional distance measures, such as DTW, we present an analysis of Jiffy’s complexity.
98
+
99
+ Let $T$ be the length of the $D$ -variable time series being embedded, let $F$ be the number of length $K$ filters used in the convolutional layer, and Let $L$ be the size of the final embedding. The time to apply the convolution and ReLU operations is $\Theta ( T D F K )$ . Following the convolutional layer, the maxpooling and downsampling require (T2DF) time if implemented naively, but (TDF) if an intelligent sliding max function is used, such as that of (Lemire, 2006). Finally, the fully connected layer, which constitutes the embedding, requires $\Theta ( T D F L )$ time.
100
+
101
+ The total time to generate the embedding is therefore $\Theta ( T D F ( K + L ) )$ . Given the embeddings, computing the distance between two time series requires $\Theta ( L )$ time. Note that $T$ no longer appears in either expression thanks to the max pooling.
102
+
103
+ With $F = 1 6$ , $K = 5$ , $L = 4 0$ , this computation is dominated by the fully connected layer. Consequently, when $L \ll T$ and embeddings can be generated ahead of time, this enables a significant speedup compared to operating on the original data. Such a situation would arise, e.g., when performing a similarity search between a new query and a fixed or slow-changing database (Blalock & Guttag, 2017). When both embeddings must be computed on-the-fly, our method is likely to be slower than DTW and other traditional approaches.
104
+
105
+ ![](images/dd1954eb73d7cbb7c7df34414e13bc50fe66598833624dcdda9f43e453658ede.jpg)
106
+ Figure 1: Architecture of the proposed model. A single convolutional layer extracts local features from the input, which a strided maxpool layer reduces to a fixed-size vector. A fully connected layer with ReLU activation carries out further, nonlinear dimensionality reduction to yield the embedding. A softmax layer is added at training time.
107
+
108
+ # 5 EXPERIMENTS
109
+
110
+ Before describing our experiments, we first note that, to ensure easy reproduction and extension of our work, all of our code is freely available.1 All of the datasets used are public, and we provide code to clean and operate on them.
111
+
112
+ We evaluate Jiffy-produced embeddings through the task of 1-nearest-neighbor classification, which assesses the extent to which time series sharing the same label tend to be nearby in the embedded space. We choose this task because it is the most widely used benchmark for time series distance and similarity measures (Ding et al., 2008; Bagnall et al., 2016).
113
+
114
+ # 5.1 DATASETS
115
+
116
+ To enable direct comparison to existing methods, we benchmark Jiffy using datasets employed by Mei et al. (2016). These datasets are taken from various domains and exhibit high variability in the numbers of classes, examples, and variables. We briefly describe each dataset below, and summarize statistics about each in Table 1.
117
+
118
+ Table 1: Summary of Multivariate Time Series Datasets.
119
+
120
+ <table><tr><td>Dataset</td><td>#Variables</td><td># Classes</td><td>Length</td><td># Time Series</td></tr><tr><td>Libras</td><td>2</td><td>15</td><td>45</td><td>360</td></tr><tr><td>AUSLAN</td><td>22</td><td>25</td><td>47-95</td><td>675</td></tr><tr><td>CharacterTrajectories</td><td>3</td><td>20</td><td>109-205</td><td>2858</td></tr><tr><td>ArabicDigits</td><td>13</td><td>10</td><td>4-93</td><td>8800</td></tr><tr><td>ECG</td><td>2</td><td>2</td><td>39 - 152</td><td>200</td></tr><tr><td>Wafer</td><td>6</td><td>2</td><td>104 - 198</td><td>1194</td></tr></table>
121
+
122
+ • ECG: Electrical recordings of normal and abnormal heartbeats, as measured by two electrodes on the patients’ chests.
123
+
124
+ • Wafer: Sensor data collected during the manufacture of semiconductor microelectronics, where the time series are labeled as normal or abnormal.
125
+
126
+ • AUSLAN: Hand and finger positions during the performance of various signs in Australian Sign Language, measured via instrumented gloves.
127
+ • Trajectories: Recordings of pen (x,y) position and force application as different English characters are written with a pen.
128
+ • Libras: Hand and arm positions during the performance of various signs in Brazilian Sign Language, extracted from videos.
129
+ • ArabicDigits: Audio signals produced by utterances of Arabic digits, represented by MelFrequency Cepstral Coefficients.
130
+
131
+ # 5.2 COMPARISON APPROACHES
132
+
133
+ We compare to recent approaches to time series metric learning, as well as popular means of generalizing DTW to the multivariate case:
134
+
135
+ 1. MDDTW (Mei et al., 2016) - MDDTW compares time series using a combination of DTW and the Mahalanobis distance. It learns the precision matrix for the latter using a triplet loss.
136
+ 2. Siamese RNN (Pei et al., 2016) - The Siamese RNN feeds each time series through a recurrent neural network and uses the hidden unit activations as the embedding. It trains by feeding pairs of time series through two copies of the network and computing errors based on their inner products in the embedded space.
137
+ 3. Siamese CNN The Siamese CNN is similar to the Siamese RNN, but uses convolutional, rather than recurrent, neural networks. This approach has proven successful across several computer vision tasks (Bromley et al., 1994; Taigman et al., 2014).
138
+ 4. DTW-I, DTW-D - As pointed out by Shokoohi-Yekta et al. (2015), there are two straightforward ways to generalize DTW to multivariate time series. The first is to treat the time series as $D$ independent sequences of scalars (DTW-I). In this case, one computes the DTW distance for each sequence separately, then sums the results. The second option is to treat the time series as one sequence of vectors (DTW-D). In this case, one runs DTW a single time, with elementwise distances equal to the squared Euclidean distances between the $D$ -dimensional elements.
139
+ 5. Zero Padding - One means of obtaining a fixed-size vector representation of a multivariate time series is to zero-pad such that all time series are the same length, and then treat the “flattened” representation as a vector.
140
+ 6. Upsampling - Like Zero Padding, but upsamples to the length of the longest time series rather than appending zeros. This approach is known to be effective for univariate time series (Ratanamahatana & Keogh, 2004b).
141
+
142
+ # 5.3 ACCURACY
143
+
144
+ As shown in Table 2, we match or exceed the performance of all comparison methods on each of the six datasets. Although it is not possible to claim statistical significance in the absence of more datasets (see Demsar (2006)), the average rank of our method compared to others is higher than its closest competitors at 1.16. The closest second, DTW-I, has an average rank of 3.33 over these six datasets.
145
+
146
+ Not only does Jiffy attain higher classification accuracies than competing methods, but the method also remains consistent in its performance across datasets. This can most easily be seen through the standard deviation in classification accuracies across datasets for each method. Jiffy’s standard deviation in accuracy (0.026) is approximately a third of DTWI’s (0.071). The closest method in terms of variance is MDDTW with a standard deviation of 0.042 , which exhibits a much lower rank than our method. This consistency suggests that Jiffy generalizes well across domains, and would likely remain effective on other datasets not tested here.
147
+
148
+ # 6 HYPERPARAMETER EFFECTS
149
+
150
+ A natural question when considering the performance of a neural network is whether, or to what extent, the hyperparameters must be modified to achieve good performance on a new dataset. In this section, we explore the robustness of our approach with respect to the values of the two key parameters: embedding size and pooling percentage. We do this by learning metrics for a variety of parameter values for ten data sets from the UCR Time Series Archive (Chen et al., 2015), and evaluating how classification accuracy varies.
151
+
152
+ Table 2: 1NN Classification Accuracy. The proposed method equals or exceeds the accuracies of all others on every dataset.
153
+
154
+ <table><tr><td>Dataset</td><td>Jiffy</td><td>MDDTW</td><td>DTW-D</td><td>DTW-I</td><td>Siamese CNN</td><td>Siamese RNN</td><td>Zero Pad</td><td>Upsample</td></tr><tr><td>ArabicDigits</td><td>0.974</td><td>0.969</td><td>0.963</td><td>0.974</td><td>0.851</td><td>0.375</td><td>0.967</td><td>0.898</td></tr><tr><td>AUSLAN</td><td>1.000</td><td>0.959</td><td>0.900</td><td>1.000</td><td>1.000</td><td>1.000</td><td>1.000</td><td>1.000</td></tr><tr><td>ECG</td><td>0.925</td><td>0.865</td><td>0.825</td><td>0.810</td><td>0.756</td><td>0.659</td><td>0.820</td><td>0.820</td></tr><tr><td>Libras</td><td>1.000</td><td>0.908</td><td>0.905</td><td>0.979</td><td>0.280</td><td>0.320</td><td>0.534</td><td>0.534</td></tr><tr><td>Trajectories</td><td>0.979</td><td>0.961</td><td>0.956</td><td>0.972</td><td>0.933</td><td>0.816</td><td>0.936</td><td>0.948</td></tr><tr><td>Wafer</td><td>0.992</td><td>0.988</td><td>0.984</td><td>0.861</td><td>0.968</td><td>0.954</td><td>0.945</td><td>0.936</td></tr><tr><td>MeanRank</td><td>1.67</td><td>3.67</td><td>4.67</td><td>3.33</td><td>6.0</td><td>6.5</td><td>4.17</td><td>4.5</td></tr></table>
155
+
156
+ # 6.1 EMBEDDING SIZE
157
+
158
+ ![](images/5d090f858abf9f17907dd28fc9063688ca2988f9066150a93eb36e024d53a936.jpg)
159
+ Figure 2.left shows that even a few dozen neurons are sufficient to achieve peak accuracy. As a result, an embedding layer of 40 neurons is sufficient and leads to an architecture that is compact enough to run on a personal laptop.
160
+ Figure 2: Effect of fully connected layer size and degree of max pooling on model accuracy using held-out datasets. Even small fully connected layers and large amounts of max pooling— up to half of the length of the time series in some cases—have little or no effect on accuracy. For ease of visualization, each dataset’s accuracies are scaled such that the largest value is 1.0.
161
+
162
+ # 6.2 POOLING PERCENTAGE
163
+
164
+ The typical assumption in machine learning literature is that max pooling windows in convolutional architectures should be small to limit information loss. In contrast, time series algorithms often max pool globally across each example (e.g. (Grabocka et al., 2014)). Contrary to the implicit assumptions of both, we find that the level of pooling that results in the highest classification often falls in the $10 \%$ range, as shown by Figure 2.right
165
+
166
+ # 7 CONCLUSION
167
+
168
+ We present Jiffy, a simple and efficient metric learning approach to measuring multivariate time series similarity. We show that our method learns a metric that leads to consistent and accurate classification across a diverse range of multivariate time series. Jiffy’s resilience to hyperparameter choices and consistent performance across domains provide strong evidence for its utility on a wide range of time series datasets.
169
+
170
+ Future work includes the extension of this approach to multi-label classification and unsupervised learning. There is also potential to further increase Jiffy’s speed by replacing the fully connected layer with a structured (Bojarski et al., 2016) or binarized (Rastegari et al., 2016) matrix.
171
+
172
+ # REFERENCES
173
+
174
+ Lods Arnaud, Simon Malinowski, Romain Tavenard, and Laurent Amsaleg. Learning dtwpreserving shapelets. In Sixteenth International Symposium on Intelligent Data Analysis (IDA 2017). Springer International Publishing, 2017.
175
+ Anthony Bagnall, Aaron Bostrom, James Large, and Jason Lines. The great time series classification bake off: An experimental evaluation of recently proposed algorithms. extended version. arXiv preprint arXiv:1602.01711, 2016.
176
+ Gustavo EAPA Batista, Xiaoyue Wang, and Eamonn J Keogh. A complexity-invariant distance measure for time series. In Proceedings of the 2011 SIAM International Conference on Data Mining, pp. 699–710. SIAM, 2011.
177
+ Nurjahan Begum, Liudmila Ulanova, Jun Wang, and Eamonn Keogh. Accelerating dynamic time warping clustering with a novel admissible pruning strategy. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 49–58. ACM, 2015.
178
+ Davis W Blalock and John V Guttag. Extract: Strong examples from weakly-labeled sensor data. In Data Mining (ICDM), 2016 IEEE 16th International Conference on, pp. 799–804. IEEE, 2016.
179
+ Davis W Blalock and John V Guttag. Bolt: Accelerated data mining with fast vector compression. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 727–735. ACM, 2017.
180
+ Mariusz Bojarski, Anna Choromanska, Krzysztof Choromanski, Francois Fagan, Cedric GouyPailler, Anne Morvan, Nouri Sakr, Tamas Sarlos, and Jamal Atif. Structured adaptive and random spinners for fast machine learning computations. arXiv preprint arXiv:1610.06209, 2016.
181
+ Jane Bromley, Isabelle Guyon, Yann LeCun, Eduard Sackinger, and Roopak Shah. Signature verifi- ¨ cation using a ”siamese” time delay neural network. In Advances in Neural Information Processing Systems, pp. 737–744, 1994.
182
+ Alessandro Camerra, Themis Palpanas, Jin Shieh, and Eamonn Keogh. isax 2.0: Indexing and mining one billion time series. In Data Mining (ICDM), 2010 IEEE 10th International Conference on, pp. 58–67. IEEE, 2010.
183
+ Zhengping Che, Xinran He, Ke Xu, and Yan Liu. Decade: A deep metric learning model for multivariate time series. 2017.
184
+ Yanping Chen, Eamonn Keogh, Bing Hu, Nurjahan Begum, Anthony Bagnall, Abdullah Mueen, and Gustavo Batista. The ucr time series classification archive, July 2015. www.cs.ucr.edu/ ˜eamonn/time_series_data/.
185
+ Zhicheng Cui, Wenlin Chen, and Yixin Chen. Multi-scale convolutional neural networks for time series classification. arXiv preprint arXiv:1603.06995, 2016.
186
+ Marco Cuturi. Fast global alignment kernels. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 929–936, 2011.
187
+
188
+ Hoang Anh Dau, Nurjahan Begum, and Eamonn Keogh. Semi-supervision dramatically improves time series clustering under dynamic time warping. In Proceedings of the 25th ACM International on Conference on Information and Knowledge Management, pp. 999–1008. ACM, 2016.
189
+
190
+ Janez Demsar. Statistical comparisons of classifiers over multiple data sets. Journal of Machine learning research, 7(Jan):1–30, 2006.
191
+
192
+ Hui Ding, Goce Trajcevski, Peter Scheuermann, Xiaoyue Wang, and Eamonn Keogh. Querying and mining of time series data: experimental comparison of representations and distance measures. Proceedings of the VLDB Endowment, 1(2):1542–1552, 2008.
193
+
194
+ Cao-Tri Do, Ahlame Douzal-Chouakria, Sylvain Marie, Mich ´ ele Rombaut, and Saeed Varasteh.\` Multi-modal and multi-scale temporal metric learning for a robust time series nearest neighbors classification. Information Sciences, 418:272–285, 2017.
195
+
196
+ Ada Wai-Chee Fu, Eamonn Keogh, Leo Yung Lau, Chotirat Ann Ratanamahatana, and Raymond Chi-Wing Wong. Scaling and time warping in time series querying. The VLDB JournalThe International Journal on Very Large Data Bases, 17(4):899–921, 2008.
197
+
198
+ Gartheeban Ganeshapillai and John V Guttag. Weighted time warping for temporal segmentation of multi-parameter physiological signals. 2011.
199
+
200
+ Ary L Goldberger, Luis AN Amaral, Leon Glass, Jeffrey M Hausdorff, Plamen Ch Ivanov, Roger G Mark, Joseph E Mietus, George B Moody, Chung-Kang Peng, and H Eugene Stanley. Physiobank, physiotoolkit, and physionet. Circulation, 101(23):e215–e220, 2000.
201
+
202
+ Josif Grabocka, Nicolas Schilling, Martin Wistuba, and Lars Schmidt-Thieme. Learning time-series shapelets. In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 392–401. ACM, 2014.
203
+
204
+ Yuan Hao, Yanping Chen, Jesin Zakaria, Bing Hu, Thanawin Rakthanmanon, and Eamonn Keogh. Towards never-ending learning from time series streams. In Proceedings of the 19th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 874–882. ACM, 2013.
205
+
206
+ Elad Hoffer and Nir Ailon. Deep metric learning using triplet network. In International Workshop on Similarity-Based Pattern Recognition, pp. 84–92. Springer, 2015.
207
+
208
+ Bing Hu, Yanping Chen, and Eamonn Keogh. Time series classification under more realistic assumptions. In Proceedings of the 2013 SIAM International Conference on Data Mining, pp. 578–586. SIAM, 2013.
209
+
210
+ Eamonn Keogh. Efficiently finding arbitrarily scaled patterns in massive time series databases. In European Conference on Principles of Data Mining and Knowledge Discovery, pp. 253–265. Springer, 2003.
211
+
212
+ Eamonn Keogh, Kaushik Chakrabarti, Michael Pazzani, and Sharad Mehrotra. Locally adaptive dimensionality reduction for indexing large time series databases. ACM Sigmod Record, 30(2): 151–162, 2001a.
213
+
214
+ Eamonn Keogh, Kaushik Chakrabarti, Michael Pazzani, and Sharad Mehrotra. Dimensionality reduction for fast similarity search in large time series databases. Knowledge and information Systems, 3(3):263–286, 2001b.
215
+
216
+ Eamonn Keogh, Jessica Lin, and Ada Fu. Hot sax: Efficiently finding the most unusual time series subsequence. In Data mining, fifth IEEE international conference on, pp. 8–pp. Ieee, 2005.
217
+
218
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
219
+
220
+ Qi Lei, Jinfeng Yi, Roman Vaculin, Lingfei Wu, and Inderjit S Dhillon. Similarity preserving representation learning for time series analysis. arXiv preprint arXiv:1702.03584, 2017.
221
+
222
+ Daniel Lemire. Streaming maximum-minimum filter using no more than three comparisons per element. arXiv preprint cs/0610046, 2006.
223
+
224
+ Jessica Lin, Eamonn Keogh, Stefano Lonardi, and Bill Chiu. A symbolic representation of time series, with implications for streaming algorithms. In Proceedings of the 8th ACM SIGMOD workshop on Research issues in data mining and knowledge discovery, pp. 2–11. ACM, 2003.
225
+
226
+ Jiangyuan Mei, Meizhu Liu, Yuan-Fang Wang, and Huijun Gao. Learning a mahalanobis distancebased dynamic time warping measure for multivariate time series classification. IEEE transactions on Cybernetics, 46(6):1363–1374, 2016.
227
+
228
+ Abdullah Mueen, Eamonn Keogh, Qiang Zhu, Sydney Cash, and Brandon Westover. Exact discovery of time series motifs. In Proceedings of the 2009 SIAM International Conference on Data Mining, pp. 473–484. SIAM, 2009.
229
+
230
+ Hyun Oh Song, Yu Xiang, Stefanie Jegelka, and Silvio Savarese. Deep metric learning via lifted structured feature embedding. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4004–4012, 2016.
231
+
232
+ Wenjie Pei, David MJ Tax, and Laurens van der Maaten. Modeling time series similarity with siamese recurrent networks. arXiv preprint arXiv:1603.04713, 2016.
233
+
234
+ Thanawin Rakthanmanon, Eamonn J Keogh, Stefano Lonardi, and Scott Evans. Time series epenthesis: Clustering time series streams requires ignoring some data. In Data Mining (ICDM), 2011 IEEE 11th International Conference on, pp. 547–556. IEEE, 2011.
235
+
236
+ Thanawin Rakthanmanon, Bilson Campana, Abdullah Mueen, Gustavo Batista, Brandon Westover, Qiang Zhu, Jesin Zakaria, and Eamonn Keogh. Searching and mining trillions of time series subsequences under dynamic time warping. In Proceedings of the 18th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 262–270. ACM, 2012.
237
+
238
+ Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. Xnor-net: Imagenet classification using binary convolutional neural networks. In European Conference on Computer Vision, pp. 525–542. Springer, 2016.
239
+
240
+ Chotirat Ann Ratanamahatana and Eamonn Keogh. Making time-series classification more accurate using learned constraints. In Proceedings of the 2004 SIAM International Conference on Data Mining, pp. 11–22. SIAM, 2004a.
241
+
242
+ Chotirat Ann Ratanamahatana and Eamonn Keogh. Everything you know about dynamic time warping is wrong. In Third Workshop on Mining Temporal and Sequential Data, pp. 22–25. Citeseer, 2004b.
243
+
244
+ Hiroaki Sakoe and Seibi Chiba. Dynamic programming algorithm optimization for spoken word recognition. IEEE transactions on acoustics, speech, and signal processing, 26(1):43–49, 1978.
245
+
246
+ Patrick Schafer. Towards time series classification without human preprocessing. In ¨ International Workshop on Machine Learning and Data Mining in Pattern Recognition, pp. 228–242. Springer, 2014.
247
+
248
+ Patrick Schafer and Ulf Leser. Fast and accurate time series classification with weasel. ¨ arXiv preprint arXiv:1701.07681, 2017.
249
+
250
+ Florian Schroff, Dmitry Kalenichenko, and James Philbin. Facenet: A unified embedding for face recognition and clustering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 815–823, 2015.
251
+
252
+ Pavel Senin and Sergey Malinchik. Sax-vsm: Interpretable time series classification using sax and vector space model. In Data Mining (ICDM), 2013 IEEE 13th International Conference on, pp. 1175–1180. IEEE, 2013.
253
+
254
+ Mohammad Shokoohi-Yekta, Jun Wang, and Eamonn Keogh. On the non-trivial generalization of dynamic time warping to the multi-dimensional case. In Proceedings of the 2015 SIAM International Conference on Data Mining, pp. 289–297. SIAM, 2015.
255
+
256
+ Yaniv Taigman, Ming Yang, Marc’Aurelio Ranzato, and Lior Wolf. Deepface: Closing the gap to human-level performance in face verification. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1701–1708, 2014.
md/train/rylkma4twr/rylkma4twr.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/ryxnY3NYPS/ryxnY3NYPS.md ADDED
@@ -0,0 +1,335 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DIVERSE TRAJECTORY FORECASTING WITH DETERMINANTAL POINT PROCESSES
2
+
3
+ Ye Yuan, Kris M. Kitani Robotics Institute Carnegie Mellon University {yyuan2,kkitani}@cs.cmu.edu
4
+
5
+ # ABSTRACT
6
+
7
+ The ability to forecast a set of likely yet diverse possible future behaviors of an agent (e.g., future trajectories of a pedestrian) is essential for safety-critical perception systems (e.g., autonomous vehicles). In particular, a set of possible future behaviors generated by the system must be diverse to account for all possible outcomes in order to take necessary safety precautions. It is not sufficient to maintain a set of the most likely future outcomes because the set may only contain perturbations of a dominating single outcome (major mode). While generative models such as variational autoencoders (VAEs) have been shown to be a powerful tool for learning a distribution over future trajectories, randomly drawn samples from the learned implicit likelihood model may not be diverse – the likelihood model is derived from the training data distribution and the samples will concentrate around the major mode of the data. In this work, we propose to learn a diversity sampling function (DSF) that generates a diverse yet likely set of future trajectories. The DSF maps forecasting context features to a set of latent codes which can be decoded by a generative model (e.g., VAE) into a set of diverse trajectory samples. Concretely, the process of identifying the diverse set of samples is posed as DSF parameter estimation. To learn the parameters of the DSF, the diversity of the trajectory samples is evaluated by a diversity loss based on a determinantal point process (DPP). Gradient descent is performed over the DSF parameters, which in turn moves the latent codes of the sample set to find an optimal set of diverse yet likely trajectories. Our method is a novel application of DPPs to optimize a set of items (forecasted trajectories) in continuous space. We demonstrate the diversity of the trajectories produced by our approach on both low-dimensional 2D trajectory data and high-dimensional human motion data. (Video1)
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Forecasting future trajectories of vehicles and human has many useful applications in autonomous driving, virtual reality and assistive living. What makes trajectory forecasting challenging is that the future is uncertain and multi-modal – vehicles can choose different routes and people can perform different future actions. In many safety-critical applications, it is important to consider a diverse set of possible future trajectories, even those that are less likely, so that necessary preemptive actions can be taken. For example, an autonomous vehicle should understand that a neighboring car can merge into its lane even though the car is most likely to keep driving straight. To address this requirement, we need to take a generative approach to trajectory forecasting that can fully characterize the multimodal distribution of future trajectories. To capture all modes of a data distribution, variational autoencoders (VAEs) are well-suited generative models. However, random samples from a learned VAE model with Gaussian latent codes are not guaranteed to be diverse for two reasons. First, the sampling procedure is stochastic and the VAE samples can fail to cover some minor modes even with a large number of samples. Second, since VAE sampling is based on the implicit likelihood function encoded in the training data, if most of the training data is centered around a specific mode while other modes have less data (Fig. 1 (a)), the VAE samples will reflect this bias and concentrate around the major mode (Fig. 1 (b)). To tackle this problem, we propose to learn a diversity sampling function (DSF) that can reliably generate a diverse set of trajectory samples (Fig. 1 (c)).
12
+
13
+ ![](images/935dc525723c5a63173fac98ebc77b977ebc640ac583ddbd40861f52edb857bf.jpg)
14
+ Figure 1: A toy trajectory forecasting example. (a) The three modes (pink, blue, purple) of the future trajectory distribution are shown in both the trajectory space and the latent space of a learned VAE model. The data distribution is imbalanced, where the blue mode has most data and covers most of the latent space. (b) Random samples from the VAE only cover the major (blue) mode. (c) Our proposed DSF generates a diverse set of future trajectories covering all three modes.
15
+
16
+ The proposed DSF is a deterministic parameterized function that maps forecasting context features (e.g., past trajectories) to a set of latent codes. The latent codes are decoded by the VAE docoder into a set of future trajectory samples, denoted as the DSF samples. In order to optimize the DSF, we formulate a diversity loss based on a determinantal point process (DPP) (Macchi, 1975) to evaluate the diversity of the DSF samples. The DPP defines the probability of choosing a random subset from the set of trajectory samples. It models the negative correlations between samples: the inclusion of a sample reduces the probability of including a similar sample. This makes the DPP an ideal tool for modeling the diversity within a set. In particular, we use the expected cardinality of the DPP as the diversity measure, which is defined as the expected size of a random subset drawn from the set of trajectory samples according to the DPP. Intuitively, since the DPP inhibits selection of similar samples, if the set of trajectory samples is more diverse, the random subset is more likely to select more samples from the set. The expected cardinality of the DPP is easy to compute and differentiable, which allows us to use it as the objective to optimize the DSF to enable diverse trajectory sampling.
17
+
18
+ Our contributions are as follows: (1) We propose a new forecasting approach that learns a diversity sampling function to produce a diverse set of future trajectories; (2) We propose a novel application of DPPs to optimize a set of items (trajectories) in continuous space with a DPP-based diversity measure; (3) Experiments on synthetic data and human motion validate that our method can reliably generate a more diverse set of future trajectories compared to state-of-the-art generative models.
19
+
20
+ # 2 RELATED WORK
21
+
22
+ Trajectory Forecasting has recently received significant attention from the vision community. A large portion of previous work focuses on forecasting 2D future trajectories for pedestrians (Kitani et al., 2012; Ma et al., 2017; Ballan et al., 2016; Xie et al., 2013) or vehicles (Jain et al., 2016a). Some approaches use deterministic trajectory modeling and only forecast one future trajectory (Alahi et al., 2016; Yagi et al., 2018; Robicquet et al., 2016). As there are often multiple plausible future trajectories, several approaches have tried to forecast distributions over trajectories (Lee et al., 2017; Galceran et al., 2015; Gupta et al., 2018). Recently, Rhinehart et al. (2018; 2019) propose a generative model that can accurately forecast multi-modal trajectories for vehicles. Soo Park et al. (2016) also use egocentric videos to predict the future trajectories of the camera wearer. Some work has investigated forecasting higher dimensional trajectories such as the 3D fullbody pose sequence of human motions. Most existing work takes a deterministic approach and forecasts only one possible future motion from past 3D poses (Fragkiadaki et al., 2015; Butepage et al., 2017; Li et al., 2017; Jain et al., 2016b), static images (Chao et al., 2017; Kanazawa et al., 2018) or egocentric videos (Yuan and Kitani, 2019). Differently, some probabilistic approaches (Habibie et al., 2017; Yan et al., 2018) use conditional variational autoencoders (cVAEs) to generate multiple future motions. In constrast to previous work, our approach can generate a diverse set of future motions with a limited number of samples.
23
+
24
+ Diverse Solutions have been sought after in a number of problems in computer vision and machine learning. A branch of these methods aiming for diversity stems from the M-Best MAP problem (Nilsson, 1998; Seroussi and Golmard, 1994), including diverse M-Best solutions (Batra et al., 2012) and multiple choice learning (Guzman-Rivera et al., 2012; Lee et al., 2016). Alternatively, previous work has used submodular function maximization to select a diverse subset of garments from fashion images (Hsiao and Grauman, 2018). Determinantal point processes (DPPs) (Macchi, 1975; Kulesza et al., 2012) are efficient probabilistic models that can measure both the diversity and quality of items in a subset, which makes it a natural choice for the diverse subset selection problem. DPPs have been applied for document and video summarization (Kulesza and Taskar, 2011; Gong et al., 2014), recommendation systems (Gillenwater et al., 2014), object detection (Azadi et al., 2017), and grasp clustering (Huang et al., 2015). Elfeki et al. (2018) have also used DPPs to mitigate mode collapse in generative adversarial networks (GANs). The work most related ours is (Gillenwater et al., 2014), which also uses the cardinality of DPPs as a proxy for user engagement. However, there are two important differences between our approach and theirs. First, the context is different as they use the cardinality for a subset selection problem while we apply the cardinality as an objective of a continuous optimization problem in the setting of generative models. Second, their main motivation behind using the cardinality is that it aligns better with the user engagement semantics, while our motivation is that using cardinality as a diversity loss for deep neural networks is more stable due to its tolerance of similar trajectories, which are often produced by deep neural networks during stochastic gradient descent.
25
+
26
+ # 3 BACKGROUND
27
+
28
+ # 3.1 VARIATIONAL AUTOENCODERS
29
+
30
+ The aim of multi-modal trajectory forecasting is to learn a generative model over future trajectories. Variational autoencoders (VAEs) are a popular choice of generative models for trajectory forecasting (Lee et al., 2017; Walker et al., 2016) because it can effectively capture all possible future trajectories by explicitly mapping each data point to a latent code. VAEs model the joint distribution $p _ { \theta } \mathbf { \bar { ( x , z ) } } = p \mathbf { \bar { ( z ) } } \bar { p _ { \theta } } ( \mathbf { x } | \mathbf { z } )$ of each data sample $\mathbf { x }$ (e.g., a future trajectory) and its corresponding latent code $\mathbf { z }$ , where $p ( \mathbf { z } )$ denotes some prior distribution (e.g., Gaussians) and $p _ { \boldsymbol { \theta } } ( \mathbf { x } | \mathbf { z } )$ denotes the conditional likelihood model. To calculate the marginal likelihood $p _ { \theta } ( \mathbf { x } ) = p _ { \theta } ( \mathbf { x } , \mathbf { z } ) / p _ { \theta } ( \mathbf { z } | \mathbf { x } )$ , one needs to compute the posterior distribution $p _ { \theta } ( \mathbf { z } | \mathbf { x } )$ which is typically intractable. To tackle this, VAEs use variational inference (Jordan et al., 1999) which introduces an approximate posterior $q _ { \phi } ( { \bf z } | { \bf x } )$ and decomposes the marginal log-likelihood as
31
+
32
+ $$
33
+ \begin{array} { r } { \log p _ { \theta } ( \mathbf { x } ) = \mathrm { K L } \left( q _ { \phi } ( \mathbf { z } | \mathbf { x } ) \| p _ { \theta } ( \mathbf { z } | \mathbf { x } ) \right) + \mathcal { L } ( \mathbf { x } ; \theta , \phi ) , } \end{array}
34
+ $$
35
+
36
+ where $\mathcal { L } ( \mathbf { x } ; \theta , \phi )$ is the evidence lower bound (ELBO) defined as
37
+
38
+ $$
39
+ \begin{array} { r } { \mathcal { L } ( \mathbf { x } ; \theta , \phi ) = \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } ) } \left[ \log p _ { \theta } ( \mathbf { x } | \mathbf { z } ) \right] - \mathrm { K L } \left( q _ { \phi } ( \mathbf { z } | \mathbf { x } ) \| p ( \mathbf { z } ) \right) . } \end{array}
40
+ $$
41
+
42
+ During training, VAEs jointly optimize the recognition model (encoder) $q _ { \phi } ( { \bf z } | { \bf x } )$ and the likelihood model (decoder) $p _ { \boldsymbol { \theta } } ( \mathbf { x } | \mathbf { z } )$ to maximize the ELBO. In the context of multi-modal trajectory forecasting, one can generate future trajectories from $p ( \mathbf { x } )$ by drawing a latent code $\mathbf { z }$ from the prior $p ( \mathbf { z } )$ and decoding $\mathbf { z }$ with the decoder $p _ { \boldsymbol { \theta } } ( \mathbf { x } | \mathbf { z } )$ to produce a corresponding future trajectory $\mathbf { x }$ .
43
+
44
+ # 3.2 DETERMINANTAL POINT PROCESSES
45
+
46
+ Our core technical innovation is a method to learn a diversity sampling function (DSF) that can generate a diverse set of future trajectories. To achieve this, we must equip ourselves with a tool to evaluate the diversity of a set of trajectories. To this end, we make use of determinantal point processes (DPPs) to model the diversity within a set. DPPs promote diversity within a set because the inclusion of one item makes the inclusion of a similar item less likely if the set is sampled according to a DPP.
47
+
48
+ Formally, given a set of items (e.g., data points) $\mathcal { Y } = \{ \mathbf { x } _ { 1 } , \dotsc , \mathbf { x } _ { N } \}$ , a point process $\mathcal { P }$ on the ground set $\mathcal { V }$ is a probability measure on $2 ^ { y }$ , i.e., the set of all subsets of $\mathcal { V }$ . $\mathcal { P }$ is called a determinantal point process if a random subset $\mathbf { Y }$ drawn according to $\mathcal { P }$ has
49
+
50
+ $$
51
+ \mathcal { P } _ { \mathbf { L } } ( Y = Y ) = \frac { \operatorname* { d e t } \left( \mathbf { L } _ { Y } \right) } { \sum _ { Y \subseteq \mathcal { V } } \operatorname* { d e t } \left( \mathbf { L } _ { Y } \right) } = \frac { \operatorname* { d e t } \left( \mathbf { L } _ { Y } \right) } { \operatorname* { d e t } ( \mathbf { L } + \mathbf { I } ) } ,
52
+ $$
53
+
54
+ where $Y \subseteq \mathcal { V }$ , I is the identity matrix, $\mathbf { L } \in \mathbb { R } ^ { N \times N }$ is the DPP kernel, a symmetric positive semidefinite matrix, and $\mathbf { L } _ { Y } \in \mathbb { R } ^ { | Y | \times | Y | }$ is a submatrix of $\mathbf { L }$ indexed by elements of $Y$ .
55
+
56
+ The DPP kernel $\mathbf { L }$ is typically constructed by a similarity matrix S, where $\mathbf { S } _ { i j }$ defines the similarity between two items $\mathbf { x } _ { i }$ and $\mathbf { x } _ { j }$ . If we use the inner product as the similarity measure, $\mathbf { L }$ can be written in the form of a Gram matrix $\mathbf { L } = \mathbf { S } = \mathbf { X } ^ { T } \mathbf { X }$ where $\mathbf { X }$ is the stacked feature matrix of $\mathcal { V }$ . As a property of the Gram matrix, det $\left( { \bf L } _ { Y } \right)$ equals the squared volume spanned by vectors $\mathbf { x } _ { i } \in Y$ . With this geometric interpretation in mind, one can observe that diverse sets are more probable because their features are more orthogonal, thus spanning a larger volume.
57
+
58
+ In addition to set diversity encoded in the similarity matrix S, it is also convenient to introduce a quality vector $\mathbf { r } = [ r _ { 1 } , \dots , r _ { N } ]$ to weigh each item according to some unary metric. For example, the quality weight might be derived from the likelihood of an item. To capture both diversity and quality of a subset, the DPP kernel $\mathbf { L }$ is often decomposed in the more general form:
59
+
60
+ $$
61
+ \mathbf { L } = \mathrm { D i a g } ( \mathbf { r } ) \cdot \mathbf { S } \cdot \mathrm { D i a g } ( \mathbf { r } ) .
62
+ $$
63
+
64
+ With this decomposition, we can see that both the quality vector $\mathbf { r }$ and similarity matrix S contribute to the DPP probability of a subset $Y$ :
65
+
66
+ $$
67
+ \mathcal { P } _ { L } ( \pmb { Y } = Y ) \propto \operatorname* { d e t } \left( \mathbf { L } _ { Y } \right) = \left( \prod _ { \mathbf { x } _ { i } \in Y } r _ { i } ^ { 2 } \right) \operatorname* { d e t } \left( \mathbf { S } _ { Y } \right) .
68
+ $$
69
+
70
+ Due to its ability to capture the global diversity and quality of a set of items, we choose DPPs as the probabilistic approach to evaluate and optimize the diversity of the future trajectories drawn by our proposed diversity sampling function.
71
+
72
+ # 4 APPROACH
73
+
74
+ Safety-critical applications often require that the system can maintain a diverse set of outcomes covering all modes of a predictive distribution and not just the most likely one. To address this requirement, we propose to learn a diversity sampling function (DSF) to draw deterministic trajectory samples by generating a set of latent codes in the latent space of a conditional variational autoencoder (cVAE) and decoding them into trajectories using the cVAE decoder. The DSF trajectory samples are evaluated with a DPP-based diversity loss, which in turn optimizes the parameters of the DSF for more diverse trajectory samples.
75
+
76
+ Formally, the future trajectory $\mathbf { x } \in \mathbb { R } ^ { T \times D }$ is a random variable denoting a $D$ dimensional feature over a future time horizon $T$ (e.g., a vehicle trajectory or a sequence of humanoid poses). The context $\boldsymbol { \psi } = \{ { \bf h } , { \bf f } \}$ provides the information to infer the future trajectory $\mathbf { x }$ , and it contains the past trajectory $\mathbf { \bar { h } } \in \mathbf { \mathbb { R } } ^ { \mathbf { \bar { H } } \times D }$ of last $H$ time steps and optionally other side information f , such as an obstacle map. In the following, we first describe how we learn the future trajectory model $p _ { \theta } ( \mathbf { x } | \psi )$ with a cVAE. Then, we introduce the DSF and the DPP-based diversity loss used to optimize the DSF.
77
+
78
+ # 4.1 LEARNING A CVAE FOR FUTURE TRAJECTORIES
79
+
80
+ In order to generate a diverse set of future trajectory samples, we need to learn a generative trajectory forecasting model $p _ { \theta } ( \mathbf { x } | \psi )$ that can cover all modes of the data distribution. Here we use cVAEs (other proper generative models can also be used), which explicitly map data $\mathbf { x }$ with the encoder $q _ { \phi } ( { \bf z } | { \bf x } , \psi )$ to its corresponding latent code $\mathbf { z }$ and reconstruct the data from the latent code using the decoder $p _ { \boldsymbol { \theta } } ( \mathbf { x } | \mathbf { z } , \boldsymbol { \psi } )$ . By maintaining this one-on-one mapping between the data and the latent code, cVAEs attempt to capture all modes of the data. As discussed in Sec. 3.1, cVAEs jointly optimize the encoder and decoder to maximize the variational lower bound:
81
+
82
+ $$
83
+ \mathcal { L } ( \mathbf { x } , \psi ; \theta , \phi ) = \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \psi ) } \left[ \log p _ { \theta } ( \mathbf { x } | \mathbf { z } , \psi ) \right] - \mathrm { K L } \left( q _ { \phi } ( \mathbf { z } | \mathbf { x } , \psi ) \| p ( \mathbf { z } ) \right) .
84
+ $$
85
+
86
+ We use multivariate Gaussians for the prior, encoder and decoder: $p ( \mathbf { z } ) = \mathcal { N } ( \mathbf { z } ; \mathbf { 0 } , \mathbf { I } )$ , $q _ { \phi } ( { \bf z } | { \bf x } , \psi ) =$ $\mathcal { N } ( \mathbf { z } ; \pmb { \mu } , \pmb { \sigma } ^ { 2 } \mathbf { I } )$ , and $p _ { \theta } ( \mathbf { x } | \mathbf { z } , \psi ) = \mathcal { N } ( \mathbf { x } ; \tilde { \mathbf { x } } , \alpha \mathbf { I } )$ . Both the encoder and decoder are implemented as neural networks. The encoder network $f _ { \phi }$ outputs the parameters of the posterior distribution: $( \mu , \sigma ) = f _ { \phi } ( { \bf x } , \psi )$ . The decoder network $g _ { \theta }$ outputs the reconstructed future trajectory $\tilde { \bf x }$ :
87
+
88
+ $\tilde { \mathbf { x } } = g _ { \theta } ( \mathbf { z } , \psi )$ . Detailed network architectures are given in Appendix B.1. Based on the Gaussian parameterization of the cVAE, the objective in Eq. 6 can be rewritten as
89
+
90
+ $$
91
+ \mathcal { L } _ { c v a e } ( \mathbf { x } , \psi ; \theta , \phi ) = - \frac { 1 } { V } \sum _ { v = 1 } ^ { V } \Vert \tilde { \mathbf { x } } _ { v } - \mathbf { x } \Vert ^ { 2 } + \beta \cdot \frac { 1 } { D _ { z } } \sum _ { j = 1 } ^ { D _ { z } } \left( 1 + 2 \log \sigma _ { j } - \mu _ { j } ^ { 2 } - \sigma _ { j } ^ { 2 } \right) ,
92
+ $$
93
+
94
+ where we take $V$ samples from the posterior $q _ { \phi } ( { \bf z } | { \bf x } , \psi )$ , $D _ { z }$ is the number of latent dimensions, and $\beta = 1 / \alpha$ is a weighting factor. The training procedure for the $\operatorname { c V A E }$ is detailed in Alg. 2 (Appendix A). Once the cVAE model is trained, sampling from the learned future trajectory model $p _ { \theta } ( \mathbf { x } | \psi )$ is efficient: we can sample a latent code $\mathbf { z }$ according to the prior $p ( \mathbf { z } )$ and use the decoder $p _ { \theta } ( \mathbf { x } | \mathbf { z } , \psi )$ to decode it into a future trajectory $\mathbf { x }$ .
95
+
96
+ # Algorithm 1 Training the diversity sampling function (DSF) $S _ { \gamma } ( \psi )$
97
+
98
+ 1: Input: Training data $\{ \mathbf { x } ^ { ( i ) } , \boldsymbol { \psi } ^ { ( i ) } \} _ { i = 1 } ^ { M }$ , cVAE decoder network $g _ { \boldsymbol { \theta } } ( \mathbf { z } , \boldsymbol { \psi } )$
99
+ 2: Output: DSF $S _ { \gamma } ( \psi )$
100
+ 3: Initialize $\gamma$ randomly
101
+ 4: while not converged do
102
+ 5: for each $\psi ^ { ( i ) }$ do
103
+ 6: Generate latent codes $\mathcal { Z } = \{ \mathbf { z } _ { 1 } , \ldots , \mathbf { z } _ { N } \}$ with the DSF $S _ { \gamma } ( \psi )$
104
+ 7: Generate the trajectory ground set $\mathcal { Y } = \{ \mathbf { x } _ { 1 } , \dotsc , \mathbf { x } _ { N } \}$ with the decoder $g _ { \boldsymbol { \theta } } ( \mathbf { z } , \boldsymbol { \psi } )$
105
+ 8: Compute the similarity matrix S and quality vector r with Eq. 8 and 9
106
+ 9: Compute the DPP kernel $\mathbf { L } ( \gamma ) = \mathrm { D i a g } ( \mathbf { r } ) \cdot \mathbf { S } \cdot \mathrm { D i a g } ( \mathbf { r } )$
107
+ 10: Calculate the diversity loss Ldiverse
108
+ 11: Update $\gamma$ with the gradient ∇Ldiverse
109
+ 12: end for
110
+ 13: end while
111
+
112
+ # 4.2 DIVERSITY SAMPLING FUNCTION (DSF)
113
+
114
+ As mentioned before, randomly sampling from the learned cVAE model according to the implicit likelihood function $p _ { \theta } ( \mathbf { x } | \psi )$ , i.e., sampling latent codes from the prior $p ( \mathbf { z } )$ , does not guarantee that the trajectory samples are diverse: major modes (those having more data) with higher likelihood will produce most of the samples while minor modes with lower likelihood will have almost no sample. This prompts us to devise a new sampling strategy that can reliably generate a diverse set of samples covering both major and minor modes. We propose to learn a diversity sampling function (DSF) $S _ { \gamma } ( \psi )$ that maps context $\psi$ to a set of latent codes $\mathcal { Z } = \{ \mathbf { z } _ { 1 } , \ldots , \mathbf { z } _ { N } \}$ . The DSF is implemented as a $\gamma$ -parameterized neural network which takes $\psi$ as input and outputs a vector of length $N \cdot D _ { z }$ (see Appendix B.1 for network details). The latent codes $\mathcal { Z }$ are decoded into a diverse set of future trajectories $\mathcal { Y } = \{ \mathbf { x } _ { 1 } , \dotsc , \mathbf { x } _ { N } \}$ , which are denoted as the DSF trajectory samples. We note that $N$ is the sampling budget. To solve for the parameters of the DSF, we propose a diversity loss based on a DPP defined over $\mathcal { V }$ . In this section, we first describe how the DPP kernel $\mathbf { L }$ is defined, which involves the construction of the similarity matrix S and quality vector $\mathbf { r }$ . We then discuss how we use the DPP kernel $\mathbf { L }$ to formulate a diversity loss to optimize the parameters of the DSF.
115
+
116
+ Recall that the DPP kernel is defined as $\mathbf { L } = \mathrm { D i a g } ( \mathbf { r } ) \cdot \mathbf { S } \cdot \mathrm { D i a g } ( \mathbf { r } )$ , where $\mathbf { r }$ defines the quality of each trajectory and $\mathbf { S }$ measures the similarity between two trajectories. The DPP kernel $\mathbf { L } ( \gamma )$ is a function of $\gamma$ as it is defined over the ground set $\mathcal { V }$ output by the DSF $S _ { \gamma } ( \psi )$ .
117
+
118
+ Similarity. We measure the similarity $\mathbf { S } _ { i j }$ between two trajectories $\mathbf { x } _ { i }$ and $\mathbf { x } _ { j }$ as
119
+
120
+ $$
121
+ \mathbf { S } _ { i j } = \exp \left( - k \cdot d _ { \mathbf { x } } ^ { 2 } ( \mathbf { x } _ { i } , \mathbf { x } _ { j } ) \right) ,
122
+ $$
123
+
124
+ where $d _ { \mathbf { x } }$ is the Euclidean distance and $k$ is a scaling factor. This similarity design ensures that $0 \leq \mathbf { S } _ { i j } \leq 1$ and $\mathbf { S } _ { i i } = 1$ . It also makes $\mathbf { S }$ positive definite since the Gaussian kernel we use is a positive definite kernel.
125
+
126
+ Quality. It may be tempting to use $p ( \mathbf { x } | \boldsymbol { \psi } )$ to define the quality of each trajectory sample. However, this likelihood-based measure will clearly favor major modes that have higher probabilities, making it less likely to generate samples from minor modes. This motivates us to design a quality metric that
127
+
128
+ treats all modes equally. To this end, unlike the similarity metric which is defined in the trajectory space, the quality of each sample is measured in the latent space and is defined as
129
+
130
+ $$
131
+ r _ { i } = \left\{ \begin{array} { l l } { \omega , } & { \mathrm { i f ~ } \| \mathbf { z } _ { i } \| \leq R } \\ { \omega \exp \left( - \mathbf { z } _ { i } ^ { T } \mathbf { z } _ { i } + R ^ { 2 } \right) , } & { \mathrm { o t h e r w i s e } } \end{array} \right.
132
+ $$
133
+
134
+ Geometrically, let $R$ be the radius of a sphere $\Phi$ containing most samples from the Gaussian prior $p ( \mathbf { z } )$ . We treat samples inside $\Phi$ equally and only penalize samples outside $\Phi$ . In this way, samples from major modes are not preferred over those from minor modes as long as they are inside $\Phi$ , while samples far away from the data manifold are heavily penalized as they are outside $\Phi$ . The radius $R$ is determined by where $\rho$ percent of the Gaussian samples lie within, and we set $\rho = 9 0$ . To compute $R$ , we use the percentage point function of the chi-squared distribution which models the distribution over the sum of squares of independent standard normal variables. The base quality $\omega$ is a hyperparameter which we set to 1 during training in our experiments. At test time, we can use a larger $\omega$ to encourage the DPP to select more items from the ground set $\mathcal { V }$ . The hyperparameter $\rho$ (or $R$ ) allows for the trade-off between diversity and quality. When $R$ is small, the quality metric is reduced to a pure likelihood-based metric (proportional to the latent likelihood), which will prefer samples with high likelihood and result in a less diverse sample set. When $R$ is large, most samples will have the same quality, and the resulting samples will be highly diverse but less likely. In practice, the choice of $R$ should be application dependent, as one could imagine autonomous vehicles would need to consider more diverse scenarios including those less likely ones to ensure robustness. We note that after the diverse samples are obtained, it is possible to reassign the quality score for each sample based on its likelihood to allow users to prioritize more likely samples.
135
+
136
+ Diversity Loss. To optimize the DSF $S _ { \gamma } ( \psi )$ , we need to define a diversity loss that measures the diversity of the trajectory ground set $\mathcal { V }$ generated by $S _ { \gamma } ( \psi )$ . An obvious choice for the diversity loss would be the negative log likelihood $- \log \mathcal { P } _ { \mathbf { L } ( \gamma ) } ( \boldsymbol { Y } = \mathcal { Y } ) = - \log \operatorname* { d e t } ( \mathbf { L } ( \gamma ) ) + \log \operatorname* { d e t } ( \mathbf { L } ( \gamma ) + \mathbf { I } )$ . However, there is a problem with directly using the DPP log likelihood. The log likelihood heavily penalizes repeated items: if two trajectories inside $\mathcal { V }$ are very similar, their corresponding rows in $\mathbf { L }$ will be almost identical, making $\operatorname* { d e t } ( \mathbf { L } ( \gamma ) ) = \lambda _ { 1 } \lambda _ { 2 } \dots \lambda _ { N } \approx 0$ ( $\lambda _ { n }$ is the $n$ -th eigenvalue). In practice, if the number of modes in the trajectory distribution $p ( \mathbf { x } | \boldsymbol { \psi } )$ is smaller than $| \mathcal { V } |$ , $\mathcal { V }$ will always have similar trajectories, thus making $\operatorname* { d e t } ( \mathbf { L } ( \gamma ) )$ always close to zero. In such cases, optimizing the negative log likelihood causes numerical issues, which is observed in our early experiments.
137
+
138
+ Instead, the expected cardinality of the DPP is a better measure for the diversity of $\mathcal { V }$ , which is defined as $\mathbb { E } _ { Y \sim \mathcal { P } _ { \mathbf { L } ( \gamma ) } } [ | Y | ]$ . Intuitively, since the DPP discourages selection of similar items, if $\mathcal { V }$ is more diverse, a random subset $\mathbf { Y }$ drawn according to the DPP is more likely to select more items from $\mathcal { V }$ , thus having larger cardinality. The expected cardinality can be computed as (Eq. 15 and 34 in Kulesza et al. (2012)):
139
+
140
+ $$
141
+ \mathbb { E } [ | \boldsymbol { Y } | ] = \sum _ { n = 1 } ^ { N } \frac { \lambda _ { n } } { \lambda _ { n } + 1 } = \mathrm { t r } \left( \mathbf { I } - ( \mathbf { L } ( \boldsymbol { \gamma } ) + \mathbf { I } ) ^ { - 1 } \right) .
142
+ $$
143
+
144
+ The main advantage of the expected cardinality is that it is well defined even when the ground set $\mathcal { V }$ has duplicated items, since it does not require all eigenvalues of $\mathbf { L }$ to be non-zero as the log likelihood does. Thus, our diversity loss is defined as $\bar { \mathcal { L } } _ { d i v e r s e } ^ { \bar { } } ( \gamma ) = - \mathrm { t r } \left( \mathbf { I } - ( \mathbf { L } ( \gamma ) + \mathbf { I } ) ^ { - 1 } \right)$ . The training procedure for $S _ { \gamma } ( \psi )$ is outlined in Alg. 1.
145
+
146
+ Inference. At test time, given current context $\psi$ ,we use the learned DSF $S _ { \gamma } ( \psi )$ to generate the future trajectory ground set $\mathcal { V }$ . In some cases, $\mathcal { V }$ may still contain some trajectories that are similar to others. In order to obtain a diverse set of trajectories without repetition, we aim to perform MAP inference for the DPP to find the most diverse subset $Y ^ { * } = \arg \operatorname* { m a x } _ { Y \in \mathcal { Y } } \mathcal { P } _ { \mathbf { L } ( \gamma ) } ( Y )$ . A useful property of DPPs is that the log-probability function is submodular (Gillenwater et al., 2012). Even though submodular maximization is NP-hard, we use a greedy algorithm (Nemhauser et al., 1978) which is a popular optimization procedure that works well in practice. As outlined in Alg. 3, the output set $Y _ { f }$ is initialized as $\varnothing$ , and at each iteration, the trajectory which maximizes the log probability
147
+
148
+ $$
149
+ \begin{array} { r } { \mathbf { x } ^ { * } = \underset { \mathbf { x } \in \mathcal { V } \backslash Y _ { f } } { \arg \operatorname* { m a x } } ~ \log \operatorname* { d e t } \left( \mathbf { L } _ { Y _ { f } \cup \{ \mathbf { x } \} } \right) } \end{array}
150
+ $$
151
+
152
+ is added to $Y _ { f }$ , until the marginal gain becomes negative or $Y _ { f } = y$ .
153
+
154
+ # 5 EXPERIMENTS
155
+
156
+ The primary focus of our experiments is to answer the following questions: (1) Are trajectory samples generated with our diversity sampling function more diverse than samples from the cVAE and other baselines? (2) How does our method perform on both balanced and imbalanced data? (3) Is our method general enough to perform well on both low-dimensional and high-dimensional tasks?
157
+
158
+ Metrics. A problem with trajectory forecasting evaluation is that in real data each context $\psi ^ { ( i ) }$ usually only has one future trajectory $\mathbf { x } ^ { ( i ) }$ , which means we only have one sample from a multi-modal distribution. Let us consider a scenario of three data examples {x(i), ψ(i)}3 as shown in Fig. 2 (red, purple, blue). The contexts (past trajectories) of the three examples are instances of the same trajectory but they are slightly different due to noise. As these three contexts have the same semantic meaning, they should share the future trajectories, e.g., the purple and blue future trajectories are also valid for the red context. If we evaluate each example $( \mathbf { x } ^ { ( i ) } , \psi ^ { ( i ) } )$ only with its own future trajectory $\mathbf { x } ^ { ( i ) }$ , a method can achieve high scores by only forecasting the mode corresponding to $\mathbf { x } ^ { ( i ) }$ and dropping other modes. This is undesirable because we want a good method to capture all modes of the future trajectory distribution, not just a single mode. To allow for multi-modal evaluation, we propose collecting multiple future trajectories for each example by clustering examples with similar contexts. Specifically, we augment each data example $\bar { ( \mathbf { x } ^ { ( i ) } , \psi ^ { ( i ) } ) }$ with a future trajectory set $\mathcal { X } ^ { ( i ) } = \{ \mathbf { x } ^ { ( j ) } | \| \boldsymbol { \psi } ^ { ( j ) } - \boldsymbol { \psi } ^ { ( i ) } \| \leq \varepsilon$ , $j = 1 , \dots , M \}$ and metrics are calculated based on $\chi ^ { ( i ) }$ instead of $\mathbf { x } ^ { ( i ) }$ , i.e., we compute metrics for each $\mathbf { x } \in \mathcal { X } ^ { ( i ) }$ and average the results.
159
+
160
+ ![](images/339718b64625c26a09d2391fc59d2fb39d3ea27dbcb5c3732aa26b7ef6c03c8e.jpg)
161
+ Figure 2: In real data, contexts (past trajectories) are seldom the same due to noise.
162
+
163
+ We use the following metrics for evaluation: (1) Average Displacement Error (ADE): average mean square error (MSE) over all time steps between the ground truth future trajectory $\mathbf { x }$ and the closest sample $\tilde { \bf x }$ in the forecasted set of trajectories $Y _ { f }$ . (2) Final Displacement Error (FDE): MSE between the final ground truth position $\mathbf { x } ^ { T }$ and the closest sample’s final position $\tilde { \mathbf { x } } ^ { T }$ . (3) Average Self Distance (ASD): average $L 2$ distance over all time steps between a forecasted sample $\tilde { \mathbf { x } } _ { i }$ and its closest neighbor $\tilde { \mathbf { x } } _ { j }$ in $Y _ { f }$ . (4) Final Self Distance (FSD): $L 2$ distance between the final position of a sample $\tilde { \mathbf { x } } _ { i } ^ { T }$ and its closest neighbor’s final position $\tilde { \mathbf { x } } _ { j } ^ { T }$ . The ADE and FDE are common metrics used in prior work on trajectory forecasting (Alahi et al., 2016; Lee et al., 2017; Rhinehart et al., 2018; Gupta et al., 2018). However, these two metrics do not penalize repeated samples. To address this, we introduce two new metrics ASD and FSD to evaluate the similarity between samples in the set of forecasted trajectories. Larger ASD and FSD means the forecasted trajectories are more non-repetitive and diverse.
164
+
165
+ Baselines. We compare our Diversity Sampler Function (DSF) with the following baselines: (1) cVAE: a method that follows the original sampling scheme of cVAE by sampling latent codes from a Gaussian prior $p ( \mathbf { z } )$ . (2) MCL: an approach that uses multiple choice learning (Lee et al., 2016) to optimize the sampler $S _ { \gamma } ( \psi )$ with the following loss: $\begin{array} { r } { \mathcal { L } _ { \mathrm { m c l } } \bar { \mathbf { \Psi } } = \operatorname* { m i n } _ { \tilde { \mathbf { x } } \in \mathcal { Y } } \| \tilde { \mathbf { x } } - \mathbf { x } \| ^ { 2 } } \end{array}$ , where $\mathbf { x }$ is the ground truth future trajectory. (3) R2P2: a method proposed in (Rhinehart et al., 2018) that uses a reparametrized pushforward policy to improve modeling of multi-modal distributions for vehicle trajectories. (4) cGAN: generative adversarial networks (Goodfellow et al., 2014) conditioned on the forecasting context. We implement all baselines using similar networks and perform hyperparameter search for each method for fair comparisons. For methods whose samples are stochastic, we use 10 random seeds and report the average results for all metrics.
166
+
167
+ # 5.1 SYNTHETIC 2D TRAJECTORY DATA
168
+
169
+ We first use synthetic data to evaluate our method’s performance for low-dimensional tasks. We design a virtual 2D traffic scene where a vehicle comes to a crossroad and can choose three different future routes: forward, left, and right. We consider two types of synthetic data: (1) Balanced data, which means the probabilities of the vehicle choosing one of the three routes are the same; (2)
170
+
171
+ ![](images/e449598c237031babc8a911ea804edb59e2cc40f470548bd63bb814a445de844.jpg)
172
+ Figure 3: Qualitative results on synthetic data for both balanced and imbalanced data distribution when $N = 1 0$ . Blue represents the past trajectory and red represents forecasted future trajectories.
173
+
174
+ <table><tr><td></td><td colspan="4">Balanced Data</td><td colspan="4">Imbalanced Data</td></tr><tr><td>Method</td><td>ADE↓</td><td>FDE↓</td><td>ASD ↑</td><td>FSD ↑</td><td>ADE↓</td><td>FDE↓</td><td>ASD ↑</td><td>FSD ↑</td></tr><tr><td>DSF (Ours)</td><td>0.182</td><td>0.344</td><td>0.147</td><td>0.340</td><td>0.198</td><td>0.371</td><td>0.207</td><td>0.470</td></tr><tr><td>cVAE</td><td>0.262</td><td>0.518</td><td>0.022</td><td>0.050</td><td>0.332</td><td>0.662</td><td>0.021</td><td>0.050</td></tr><tr><td>MCL</td><td>0.276</td><td>0.548</td><td>0.012</td><td>0.030</td><td>0.457</td><td>0.938</td><td>0.005</td><td>0.010</td></tr><tr><td>R2P2</td><td>0.211</td><td>0.361</td><td>0.047</td><td>0.080</td><td>0.393</td><td>0.776</td><td>0.019</td><td>0.030</td></tr><tr><td>cGAN</td><td>0.808</td><td>1.619</td><td>0.018</td><td>0.010</td><td>1.784</td><td>3.744</td><td>0.006</td><td>0.001</td></tr></table>
175
+
176
+ Table 1: Quantitative results on synthetic data (numbers scaled by 10) when $N = 1 0$ .
177
+
178
+ Imbalanced data, where the probabilities of the vehicle going forward, left and right are 0.8, 0.1, 0.1, respectively. We synthesize trajectory data by simulating the vehicle’s behavior and adding Gaussian noise to vehicle velocities. Each data example $( \mathbf { x } ^ { ( i ) } , \bar { \psi } ^ { ( i ) } )$ contains future trajectories of 3 steps and past trajectories of 2 steps. We also add an obstacle map around the current position to the context $\bar { \psi ^ { ( i ) } }$ . In total, we have around 1100 training examples and 1000 test examples. Please refer to Appendix B for more implementation details.
179
+
180
+ Table 1 summarizes the quantitative results for both balanced and imbalanced data when the sampling budget $N$ is 10. We can see that our method DSF outperforms the baselines in all metrics in both test settings. As shown in Fig. 3, our method generates more diverse trajectories and is less affected by the imbalanced data distribution. The trajectory samples of our method are also less repetitive, a feature afforded by our DPP formulation. Fig. 4 shows how ADE changes as a function of the sampling budget $N$ .
181
+
182
+ # 5.2 DIVERSE HUMAN MOTION FORECASTING
183
+
184
+ To further evaluate our method’s performance for more complex and high-dimensional tasks, we apply our method to forecast future human motions (pose sequences). We use motion capture to obtain 10 motion sequences including different types of motions such as walking, turning, jogging, bending, and crouching. Each sequence is about 1 minute long and each pose consists of 59 joint angles. We use past 3 poses
185
+
186
+ <table><tr><td>Method</td><td>ADE↓</td><td>FDE↓</td><td>ASD个</td><td>FSD↑</td></tr><tr><td>DSF (Ours)</td><td>0.259</td><td>0.421</td><td>0.115</td><td>0.282</td></tr><tr><td>cVAE</td><td>0.332</td><td>0.642</td><td>0.034</td><td>0.098</td></tr><tr><td>MCL</td><td>0.344</td><td>0.674</td><td>0.036</td><td>0.122</td></tr><tr><td>cGAN</td><td>0.652</td><td>1.296</td><td>0.001</td><td>0.003</td></tr></table>
187
+
188
+ Table 2: Quantitative results on for human motion forecasting when $N = 1 0$ .
189
+
190
+ (0.1s) to forecast next 30 poses (1s). There are around 9400 training examples and 2000 test examples where we use different sequences for training and testing. More implementation details can be found in Appendix B.
191
+
192
+ We present quantitative results in Table 2 and we can see that our approach outperforms other methods in all metrics. As the dynamics model used in R2P2 (Rhinehart et al., 2018) does not generalize well for high-dimensional human motion, we find the model fails to converge and we do not compare with it in this experiment. Fig. 4 shows that our method achieves large improvement when the sampling budget is big $\mathrm { \Delta } N = 5 0 \mathrm { \Omega }$ ). We also present qualitative results in Fig. 5, where we show the starting pose and the final pose of all 10 forecasted motion samples for each method. We can clearly see that our method generates more diverse future human motions than the baselines. Please refer to Appendix C and our video for additional qualitative results.
193
+
194
+ ![](images/ff9fe6900c65b3c7340feda04c9935bdbcf6b74f4b07a3fe374531d9c2ae1f9a.jpg)
195
+ Figure 4: ADE vs. $N$ for synthetic data and human motion forecasting. cGAN is not shown in this plot as it is much worse than other methods due to mode collapse.
196
+
197
+ ![](images/1df4f19ed6c9ea796a9731ebe271c06940cbbe9aaa4215f855d8629862c36a0c.jpg)
198
+ Figure 5: Qualitative results for human motion forecasting when $N = 1 0$ . The left shows the starting pose, and the right shows for each method the final pose of all 10 forecasted motion samples.
199
+
200
+ # 5.3 ADDITIONAL EXPERIMENTS WITH DIVERSITY-BASED BASELINES
201
+
202
+ In this section, we perform additional experiments on a large human motion dataset (3.6 million frames), Human3.6M (Ionescu et al., 2013), to evaluate the generalization ability of our approach. We predict future motion of 2 seconds based on observed motion of 0.5 seconds. Please refer to Appendix B.3 for implementation details. We also use a new selection of baselines including several variants of our method (DSF) and the cVAE to validate several design choices of our method, including the choice of the expected cardinality over the negative log likelihood (NLL) of the DPP as the diversity loss. Specifically, we use the following new baselines: (1) DSF-NLL: a variant of DSF that uses NLL as the diversity loss instead of the expected cardinality. (2) DSF-COS: a DSF variant that uses cosine similarity to build the similarity matrix S for the DPP kernel L. (3) DSF-NLL: a variant of the cVAE that samples 100 latent codes and performs DPP MAP inference on the latent codes to obtain a diverse set of latent codes, which are then decoded into trajectory samples.
203
+
204
+ We present quantitative results in Table 3 when the number of samples $N$ is 10 and 50. The baseline DSF-COS is able to achieve very high diversity (ASD and FSD) but its samples are overly diverse and have poor quality which is indicated by the large ADE and FDE. Compared with DSF-NLL, our method achieves better diversity (ASD and FSD) and similar ADE and FDE when the number of samples is small $N = 1 0$ ). For a larger number of samples $\mathrm { ~ N ~ } = 5 0 $ ), NLL becomes unstable even with a large $\epsilon$ (1e-3) added to the diagonal. This behavior of NLL, i.e., stable for small $N$ but unstable for large $N$ , matches our intuition that NLL becomes unstable when samples become similar (as discussed in Sec. 4.2), because when there are more samples, it is easier to have similar samples during the SGD updates of the DSF network. The baseline cVAE-LDPP also performs worse than DSF in all metrics even though it is able to outperfom the cVAE. We believe the reason is that diversity in sample space may not be well reflected in the latent space due to the non-linear mapping from latent codes to samples induced by deep neural networks.
205
+
206
+ <table><tr><td rowspan="2">Method</td><td colspan="4">N=10</td><td colspan="4">N= 50</td></tr><tr><td>ADE↓</td><td>FDE↓</td><td>ASD↑</td><td>FSD ↑</td><td>ADE↓</td><td>FDE↓</td><td>ASD↑</td><td>FSD ↑</td></tr><tr><td>DSF (Ours)</td><td>0.340</td><td>0.521</td><td>0.381</td><td>0.621</td><td>0.236</td><td>0.306</td><td>0.313</td><td>0.415</td></tr><tr><td>DSF-NLL</td><td>0.335</td><td>0.514</td><td>0.343</td><td>0.496</td><td>X</td><td>X</td><td>X</td><td>X</td></tr><tr><td>DSF-COS</td><td>2.588</td><td>1.584</td><td>5.093</td><td>5.718</td><td>0.978</td><td>0.891</td><td>2.007</td><td>1.968</td></tr><tr><td>cVAE</td><td>0.363</td><td>0.549</td><td>0.235</td><td>0.360</td><td>0.276</td><td>0.369</td><td>0.160</td><td>0.220</td></tr><tr><td>cVAE-LDPP</td><td>0.373</td><td>0.554</td><td>0.280</td><td>0.426</td><td>0.277</td><td>0.365</td><td>0.176</td><td>0.240</td></tr></table>
207
+
208
+ Table 3: Quantitative results on Human3.6M (Ionescu et al., 2013) for $N = 1 0$ and $N = 5 0$ . X means the method is unable to learn a model due to numerical instability.
209
+
210
+ # 6 CONCLUSION
211
+
212
+ We proposed a novel forecasting approach using a DSF to optimize over the sample space of a generative model. Our method learns the DSF with a DPP-based diversity measure to generate a diverse set of trajectories. The diversity measure is a novel application of DPPs to optimize a set of items in continuous space. Experiments have shown that our approach can generate more diverse vehicle trajectories and human motions compared to state-of-the-art baseline forecasting approaches.
213
+
214
+ Acknowledgment. This project was sponsored in part by JST CREST (JPMJCR14E1), NSF NRI (1637927) and IARPA (D17PC00340).
215
+
216
+ # REFERENCES
217
+
218
+ A. Alahi, K. Goel, V. Ramanathan, A. Robicquet, L. Fei-Fei, and S. Savarese. Social lstm: Human trajectory prediction in crowded spaces. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 961–971, 2016.
219
+ S. Azadi, J. Feng, and T. Darrell. Learning detection with diverse proposals. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7149–7157, 2017.
220
+ L. Ballan, F. Castaldo, A. Alahi, F. Palmieri, and S. Savarese. Knowledge transfer for scene-specific motion prediction. In European Conference on Computer Vision, pages 697–713. Springer, 2016.
221
+ D. Batra, P. Yadollahpour, A. Guzman-Rivera, and G. Shakhnarovich. Diverse m-best solutions in markov random fields. In European Conference on Computer Vision, pages 1–16. Springer, 2012.
222
+ J. Butepage, M. J. Black, D. Kragic, and H. Kjellstrom. Deep representation learning for human motion prediction and classification. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6158–6166, 2017.
223
+ Y.-W. Chao, J. Yang, B. Price, S. Cohen, and J. Deng. Forecasting human dynamics from static images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 548–556, 2017.
224
+ M. Elfeki, C. Couprie, M. Riviere, and M. Elhoseiny. Gdpp: Learning diverse generations using determinantal point process. arXiv preprint arXiv:1812.00068, 2018.
225
+ K. Fragkiadaki, S. Levine, P. Felsen, and J. Malik. Recurrent network models for human dynamics. In Proceedings of the IEEE International Conference on Computer Vision, pages 4346–4354, 2015.
226
+ E. Galceran, A. G. Cunningham, R. M. Eustice, and E. Olson. Multipolicy decision-making for autonomous driving via changepoint-based behavior prediction. In Robotics: Science and Systems, volume 1, 2015.
227
+ J. Gillenwater, A. Kulesza, and B. Taskar. Near-optimal map inference for determinantal point processes. In Advances in Neural Information Processing Systems, pages 2735–2743, 2012.
228
+ J. A. Gillenwater, A. Kulesza, E. Fox, and B. Taskar. Expectation-maximization for learning determinantal point processes. In Advances in Neural Information Processing Systems, pages 3149–3157, 2014.
229
+ B. Gong, W.-L. Chao, K. Grauman, and F. Sha. Diverse sequential subset selection for supervised video summarization. In Advances in Neural Information Processing Systems, pages 2069–2077, 2014.
230
+ I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial nets. In Advances in neural information processing systems, pages 2672–2680, 2014.
231
+ A. Gupta, J. Johnson, L. Fei-Fei, S. Savarese, and A. Alahi. Social gan: Socially acceptable trajectories with generative adversarial networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2255–2264, 2018.
232
+ A. Guzman-Rivera, D. Batra, and P. Kohli. Multiple choice learning: Learning to produce multiple structured outputs. In Advances in Neural Information Processing Systems, pages 1799–1807, 2012.
233
+ I. Habibie, D. Holden, J. Schwarz, J. Yearsley, and T. Komura. A recurrent variational autoencoder for human motion synthesis. BMVC17, 2017.
234
+ W.-L. Hsiao and K. Grauman. Creating capsule wardrobes from fashion images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7161–7170, 2018.
235
+ D.-A. Huang, M. Ma, W.-C. Ma, and K. M. Kitani. How do we use our hands? discovering a diverse set of common grasps. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 666–675, 2015.
236
+ C. Ionescu, D. Papava, V. Olaru, and C. Sminchisescu. Human3. 6m: Large scale datasets and predictive methods for 3d human sensing in natural environments. IEEE transactions on pattern analysis and machine intelligence, 36(7):1325–1339, 2013.
237
+ A. Jain, A. Singh, H. S. Koppula, S. Soh, and A. Saxena. Recurrent neural networks for driver activity anticipation via sensory-fusion architecture. In Robotics and Automation (ICRA), 2016 IEEE International Conference on, pages 3118–3125. IEEE, 2016a.
238
+ A. Jain, A. R. Zamir, S. Savarese, and A. Saxena. Structural-rnn: Deep learning on spatio-temporal graphs. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5308–5317, 2016b.
239
+ M. I. Jordan, Z. Ghahramani, T. S. Jaakkola, and L. K. Saul. An introduction to variational methods for graphical models. Machine learning, 37(2):183–233, 1999.
240
+ A. Kanazawa, J. Zhang, P. Felsen, and J. Malik. Learning 3d human dynamics from video. arXiv preprint arXiv:1812.01601, 2018.
241
+ D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
242
+ K. M. Kitani, B. D. Ziebart, J. A. Bagnell, and M. Hebert. Activity forecasting. In European Conference on Computer Vision, pages 201–214. Springer, 2012.
243
+ A. Kulesza and B. Taskar. k-dpps: Fixed-size determinantal point processes. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pages 1193–1200, 2011.
244
+ A. Kulesza, B. Taskar, et al. Determinantal point processes for machine learning. Foundations and Trend $\textsuperscript { \textregistered }$ in Machine Learning, 5(2–3):123–286, 2012.
245
+ N. Lee, W. Choi, P. Vernaza, C. B. Choy, P. H. Torr, and M. Chandraker. Desire: Distant future prediction in dynamic scenes with interacting agents. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 336–345, 2017.
246
+ S. Lee, S. P. S. Prakash, M. Cogswell, V. Ranjan, D. Crandall, and D. Batra. Stochastic multiple choice learning for training diverse deep ensembles. In Advances in Neural Information Processing Systems, pages 2119–2127, 2016.
247
+ Z. Li, Y. Zhou, S. Xiao, C. He, Z. Huang, and H. Li. Auto-conditioned recurrent networks for extended complex human motion synthesis. arXiv preprint arXiv:1707.05363, 2017.
248
+ W.-C. Ma, D.-A. Huang, N. Lee, and K. M. Kitani. Forecasting interactive dynamics of pedestrians with fictitious play. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 774–782, 2017.
249
+ O. Macchi. The coincidence approach to stochastic point processes. Advances in Applied Probability, 7(1): 83–122, 1975.
250
+ J. Martinez, R. Hossain, J. Romero, and J. J. Little. A simple yet effective baseline for 3d human pose estimation. In Proceedings of the IEEE International Conference on Computer Vision, pages 2640–2649, 2017.
251
+ G. L. Nemhauser, L. A. Wolsey, and M. L. Fisher. An analysis of approximations for maximizing submodular set functionsi. Mathematical programming, 14(1):265–294, 1978.
252
+ D. Nilsson. An efficient algorithm for finding the m most probable configurationsin probabilistic expert systems. Statistics and computing, 8(2):159–173, 1998.
253
+ G. Pavlakos, X. Zhou, K. G. Derpanis, and K. Daniilidis. Coarse-to-fine volumetric prediction for single-image 3d human pose. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7025–7034, 2017.
254
+ D. Pavllo, C. Feichtenhofer, D. Grangier, and M. Auli. 3d human pose estimation in video with temporal convolutions and semi-supervised training. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7753–7762, 2019.
255
+ N. Rhinehart, K. M. Kitani, and P. Vernaza. R2p2: A reparameterized pushforward policy for diverse, precise generative path forecasting. In Proceedings of the European Conference on Computer Vision (ECCV), pages 772–788, 2018.
256
+ N. Rhinehart, R. McAllister, K. Kitani, and S. Levine. Precog: Prediction conditioned on goals in visual multi-agent settings. arXiv preprint arXiv:1905.01296, 2019.
257
+ A. Robicquet, A. Sadeghian, A. Alahi, and S. Savarese. Learning social etiquette: Human trajectory understanding in crowded scenes. In European conference on computer vision, pages 549–565. Springer, 2016.
258
+ B. Seroussi and J.-L. Golmard. An algorithm directly finding the k most probable configurations in bayesian networks. International Journal of Approximate Reasoning, 11(3):205–233, 1994.
259
+ H. Soo Park, J.-J. Hwang, Y. Niu, and J. Shi. Egocentric future localization. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4697–4705, 2016.
260
+ J. Walker, C. Doersch, A. Gupta, and M. Hebert. An uncertain future: Forecasting from static images using variational autoencoders. In European Conference on Computer Vision, pages 835–851. Springer, 2016.
261
+ D. Xie, S. Todorovic, and S.-C. Zhu. Inferring ”dark matter” and ”dark energy” from videos. 2013 IEEE International Conference on Computer Vision, pages 2224–2231, 2013.
262
+ T. Yagi, K. Mangalam, R. Yonetani, and Y. Sato. Future person localization in first-person videos. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
263
+ X. Yan, A. Rastogi, R. Villegas, K. Sunkavalli, E. Shechtman, S. Hadap, E. Yumer, and H. Lee. Mt-vae: Learning motion transformations to generate multimodal human dynamics. In Proceedings of the European Conference on Computer Vision (ECCV), pages 265–281, 2018.
264
+ Y. Yuan and K. Kitani. Ego-pose estimation and forecasting as real-time pd control. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), pages 10082–10092, 2019.
265
+
266
+ # A ALGORITHMS
267
+
268
+ # Algorithm 2 Training the cVAE
269
+
270
+ 1: Input: Training data $\{ \mathbf { x } ^ { ( i ) } , \boldsymbol { \psi } ^ { ( i ) } \} _ { i = 1 } ^ { M }$
271
+ 2: Output: cVAE encoder network $f _ { \phi } ( { \mathbf { x } } , \psi )$ and decoder network $g _ { \boldsymbol { \theta } } ( \mathbf { z } , \boldsymbol { \psi } )$
272
+ 3: Initialize $\phi$ and $\theta$ randomly
273
+ 4: while not converged do
274
+ 5: for each $( \mathbf { x } ^ { ( i ) } , \psi ^ { ( i ) } )$ do
275
+ 6: Compute parameters $( \mu , \sigma )$ of the posterior distribution $q _ { \phi } ( { \bf z } | { \bf x } , \psi )$ using $f _ { \phi } ( \mathbf { x } , \psi )$
276
+ 7: Sample $V$ Gaussian noises $\{ \epsilon _ { 1 } , \ldots , \epsilon _ { V } \}$ from $\mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$
277
+ 8: Transform noises to latent samples from $q _ { \phi } ( { \bf z } | { \bf x } , \psi )$ : $\mathbf { z } _ { v } = \pmb { \mu } + \pmb { \sigma } \odot \pmb { \epsilon } _ { v }$
278
+ 9: Decode latent samples into reconstructed trajectories $\big \{ \tilde { \mathbf { x } } _ { 1 } , \dots , \tilde { \mathbf { x } } _ { V } \big \}$ using $g _ { \boldsymbol { \theta } } ( \mathbf { z } , \boldsymbol { \psi } )$
279
+ 10: Calculate the cVAE loss $\mathcal { L } _ { c v a e }$ according to Eq. 6
280
+ 11: Update $\phi$ and $\theta$ with $\nabla _ { \phi } \mathcal { L } _ { c v a e }$ and $\nabla _ { \theta } \mathcal { L } _ { c v a e }$
281
+ 12: end for
282
+ 13: end while
283
+
284
+ Algorithm 3 Inference with the DSF $S _ { \gamma } ( \psi )$
285
+
286
+ 1: Input: Context $\psi$ , DSF $S _ { \gamma } ( \psi )$ , cVAE decoder network $g _ { \boldsymbol { \theta } } ( \mathbf { z } , \boldsymbol { \psi } )$
287
+ 2: Output: Forecasted trajectory set $Y _ { f }$
288
+ 3: Generate latent codes $\mathcal { Z } = \{ \mathbf { z } _ { 1 } , \ldots , \mathbf { z } _ { N } \}$ with the DSF $S _ { \gamma } ( \psi )$
289
+ 4: Generate the trajectory ground set $\mathcal { Y } = \{ \mathbf { x } _ { 1 } , \dotsc , \mathbf { x } _ { N } \}$ with the decoder $g _ { \boldsymbol { \theta } } ( \mathbf { z } , \boldsymbol { \psi } )$
290
+ 5: Compute the DPP kernel $\mathbf { L } = \mathrm { D i a g } ( \mathbf { r } ) \cdot \mathbf { S } \cdot \mathrm { D i a g } ( \mathbf { r } )$
291
+ 6: $Y _ { f } \gets \emptyset , U \gets y$
292
+ 7: while $U$ is not empty do
293
+ 8: $\mathbf { x } ^ { * } \arg \operatorname* { m a x } _ { \mathbf { x } \in U }$ $\log \operatorname* { d e t } \left( \mathbf { L } _ { Y _ { f } \cup \{ \mathbf { x } \} } \right)$
294
+ 9: $\mathbf { | } \mathbf { f } \log \operatorname* { d e t } \left( \mathbf { L } _ { Y _ { f } \cup \{ \mathbf { x } ^ { * } \} } \right) - \log \operatorname* { d e t } \left( \mathbf { L } _ { Y _ { f } } \right) < 0$ then
295
+ 10: break
296
+ 11: end if
297
+ 12: $\begin{array} { l } { Y _ { f } Y _ { f } \cup \{ \mathbf { x } ^ { * } \} } \\ { U U \setminus \{ \mathbf { x } ^ { * } \} } \end{array}$
298
+ 13:
299
+ 14: end while
300
+
301
+ ![](images/32e613102435caf57bf44ee931dab86ab62337b0e3a87d0e948258d656b47358.jpg)
302
+ Figure 6: Network architectures for synthetic data and human motion. Top: for synthetic data, we use a CNN to process the obstacle map f and directly flatten trajectories $\mathbf { x }$ and $\mathbf { h }$ into vectors. The reconstructed trajectory $\tilde { \bf x }$ is decoded with an MLP. Bottom: for human motion, we use Bi-LSTMs to extract temporal features for $\mathbf { x }$ and $\mathbf { h }$ and decode the reconstructed trajectory $\tilde { \bf x }$ with a forward LSTM.
303
+
304
+ # B.1 NETWORK ARCHITECTURES
305
+
306
+ Synthetic data. Fig. 6 (Top) shows the network architecture for synthetic data. The number of latent dimensions is 2. By default, we use ReLU activation for all networks. The future trajectory $\mathbf { x } \in \mathbb { R } ^ { 3 \times 2 }$ consists of 3 future positions of the vehicle. The context $\psi$ contains past trajectories $\textbf { h } \in \mathbb { R } ^ { 2 \times 2 }$ of 2 time steps and a obstacle map $\textbf { f } \in \{ 0 , 1 \} ^ { 2 8 \times 2 8 }$ spanning a $4 \times 4$ area around the current position of the vehicle (the road width is 2). For the encoder, we use a convolutional neural network (CNN) with three 32-channel convolutional layers to process f. The first two layers have kernel size 4 and stride 2 while the last layer has kernel size 6 and stride 1. The obtained CNN features are concatenated with flattened $\mathbf { x }$ and $\mathbf { h }$ into a unified feature, which is feed into a multilayer perceptron (MLP). The MLP has one 128-dim hidden layer and two heads outputing the mean $\pmb { \mu }$ and variance $\sigma$ of the latent distribution. For the decoder, we concatenate the CNN feature from f with the latent code $\textbf { z } \in \mathbb { R } ^ { 2 }$ and flattened $\mathbf { h }$ into a unified feature. The feature is passed through an MLP with one 128-dim hidden layer which outputs the reconstructed future trajectory $\tilde { \mathbf { x } } \in \breve { \mathbb { R } } ^ { 3 \times 2 }$ . For the diversity sampler function (DSF), we concatenate the CNN feature from f with the flattened h and pass it through an MLP with one 128-dim hidden layer to obtain a set of latent codes $\left\{ \mathbf { z } _ { 1 } , \ldots , \mathbf { z } _ { N } \right\}$ which are represented by a vector of length $2 N$ .
307
+
308
+ Human motion. Fig. 6 (Bottom) shows the network architecture for synthetic data. The number of latent dimensions is 8. The future trajectory $\mathbf { x } \in \mathbb { R } ^ { 3 0 \times 5 9 }$ consists of future poses of 30 time steps (1s). The context $\psi$ contains past poses $\mathbf { h } \in \mathbb { R } ^ { 3 \times 5 9 }$ of 3 time steps (0.1s). Each pose consists of 59 joint angles. For the encoder, we use two 128-dim bidirectional LSTMs (Bi-LSTMs) and mean pooling to obtain the temporal features for $\mathbf { x }$ and $\mathbf { h }$ . We then concatenate the temporal features into a unified feature and feed it into an MLP with two hidden layers (300, 200) and two heads to obtain the mean $\pmb { \mu }$ and variance $\sigma$ of the latent distribution. For the decoder, we reuse the Bi-LSTM of the encoder for the context h and a 128-dim forward LSTM to decode the future trajectory $\tilde { \bf x }$ . At each time step $t$ , the forward LSTM takes as input the previous pose $\tilde { \mathbf { x } } ^ { t - 1 }$ $\mathbf { h } ^ { H }$ for $t = 0$ ), the latent code $\mathbf { z } \in \mathbb { R } ^ { 8 }$ and the temporal features from h, and outputs a 128-dim feature. The feature is then passed through an MLP with two hidden layers (300, 200) to generate the reconstructed pose $\tilde { \mathbf { x } } ^ { t }$ . For the DSF, we use a different 128-dim Bi-LSTM to obtain the temporal feature for $\mathbf { h }$ , which is feed into an MLP with a 128-dim hidden layer to produce a set of latent codes $\left\{ \mathbf { z } _ { 1 } , \ldots , \mathbf { z } _ { N } \right\}$ which are represented by a vector of length $8 N$ .
309
+
310
+ # B.2 TRAINING AND EVALUATION
311
+
312
+ When training the cVAE model using Eq. 7, we take $V = 1$ sample from the posterior $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \psi )$ . The weighting factor $\beta$ for the KL term is set to 0.1 for synthetic data and 1e-4 for human motion. We use Adam (Kingma and Ba, 2014) to jointly optimize the encoder and decoder. The learning rate is set to 1e-4 and we use a mini batch size of 32 for synthetic data. We optimize the model for 500 epochs for synthetic data and 100 epochs for human motion.
313
+
314
+ When training the DSF, the scale factor $k$ for the similarity matrix S is set to 1 for synthetic data and 1e-2 for human motions. For both synthetic data and human motions, we use Adam with learning rate 1e-4 to optimize the DSF for 20 epochs.
315
+
316
+ Recall that in the metrics section (Sec. 5.1), we need the grouping threshold $\varepsilon$ to build the ground truth future trajectory set $\mathcal { X } ^ { ( i ) } = \{ \mathbf { x } ^ { ( j ) } \vert \Vert \psi ^ { ( j ) } - \psi ^ { ( i ) } \Vert \leq \varepsilon$ , $j = 1 , \dots , M \}$ . For synthetic data, $\varepsilon$ is set to 0.1 and we only use past trajectories $\mathbf { h }$ to compute the distance between contexts. For human motion, $\varepsilon$ is set to 0.5.
317
+
318
+ B.3 IMPLEMENTATION DETAILS FOR EXPERIMENTS ON HUMAN3.6M
319
+
320
+ Following previous work (Martinez et al., 2017; Pavlakos et al., 2017; Pavllo et al., 2019), we convert the motion sequences in the dataset into sequences of 3D joint positions, and adopt a 17-joint skeleton. We train on five subjects (S1, S5, S6, S7, S8), and test on two subjects (S9 and S11).
321
+
322
+ We use the same network architectures (Fig.6 (Bottom)) in this experiment as the one used in the human motion forecasting experiment above. The number of latent dimensions is 128. When training the cVAE model, the weighting factor $\beta$ is set to 0.1. We sample 5000 training examples every epoch and optimize the cVAE for 500 epochs using Adam and a learning rate of 1e-4. We set the batch size to 64 for the optimization.
323
+
324
+ The scale factor $k$ for the similarity matrix S of the DPP kernel is set to 5. When learning the DSF, we use a batch size of 64 and sample 1000 training examples every epoch and optimize the DSF for 20 epochs using Adam and a learning rate of 1e-3.
325
+
326
+ When computing the metrics, we set the grouping threshold $\varepsilon$ to 0.1.
327
+
328
+ # C ADDITIONAL VISUALIZATION
329
+
330
+ We also show additional qualitative results for human motion forecasting in Fig. 7. The quality and diversity of the forecasted motions are best seen in our video2.
331
+
332
+ # The final pose of 10 forecasted motions
333
+
334
+ ![](images/f3e399ae3bc56208ba1dccca639da93a1d6e9a7fe8064fe2b76e19f24f16ec80.jpg)
335
+ Figure 7: Additional visualization for human motion forecasting. The left shows the starting pose, and on the right we show for each method the final pose of 10 forecasted motion samples.
md/train/u8X280hw1Mt/u8X280hw1Mt.md ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EQCO: EQUIVALENT RULES FOR SELF-SUPERVISED CONTRASTIVE LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ In this paper, we propose a method, named EqCo (Equivalent Rules for Contrastive Learning), to make self-supervised learning irrelevant to the number of negative samples in the contrastive learning framework. Inspired by the InfoMax principle, we point that the margin term in contrastive loss needs to be adaptively scaled according to the number of negative pairs in order to keep steady mutual information bound and gradient magnitude. EqCo bridges the performance gap among a wide range of negative sample sizes, so that we can use only a few negative pairs (e.g. 16 per query) to perform self-supervised contrastive training on large-scale vision datasets like ImageNet, while with almost no accuracy drop. This is quite a contrast to the widely used large batch training or memory bank mechanism in current practices. Equipped with EqCo, our simplified MoCo (SiMo) achieves comparable accuracy with MoCo v2 on ImageNet (linear evaluation protocol) while only involves 16 negative pairs per query instead of 65536, suggesting that large quantities of negative samples might not be a critical factor in contrastive learning frameworks.
8
+
9
+ # 1 INTRODUCTION AND BACKGROUND
10
+
11
+ Self-supervised learning has recently received much attention in the field of visual representation learning (Hadsell et al. (2006); Dosovitskiy et al. (2014); Oord et al. (2018); Bachman et al. (2019); Henaff et al. (2019); Wu et al. (2018); Tian et al. (2019); He et al. (2020); Misra & Maaten (2020); ´ Grill et al. (2020); Cao et al. (2020); Tian et al. (2020)), as its potential to learn universal representations from unlabeled data. Among various self-supervised methods, one of the most promising research paths is contrastive learning (Oord et al. (2018)), which has been demonstrated to achieve comparable or even better performances than supervised training for many downstream tasks such as image classification, object detection, and semantic segmentation (Chen et al., $2 0 2 0 \mathrm { c }$ ; He et al., 2020; Chen et al., 2020a;b).
12
+
13
+ The core idea of contrastive learning is briefly summarized as follows: first, extracting a pair of embedding vectors $( \mathbf { q } ( I ) , \mathbf { k } ( I ) )$ (named query and key respectively) from the two augmented views of each instance $I$ ; then, learning to maximize the similarity of each positive pair $( \mathbf { q } ( I ) , \mathbf { k } ( I ) )$ while pushing the negative pairs $( \mathbf { q } ( I ) , \mathbf { k } ( I ^ { \prime } ) )$ (i.e., query and key extracted from different instances accordingly) away from each other. To learn the representation, an InfoNCE loss (Oord et al. (2018); Wu et al. (2018)) is conventionally employed in the following formulation (slightly modified with an additional margin term):
14
+
15
+ $$
16
+ \mathcal { L } _ { N C E } = \underset { \mathbf { q } \sim \mathcal { D } , \mathbf { k } _ { 0 } \sim \mathcal { D } ^ { \prime } ( \mathbf { q } ) , \mathbf { k } _ { i } \sim \mathcal { D } ^ { \prime } } { \mathbb { E } } \left[ - \log \frac { e ^ { ( \mathbf { q } ^ { \top } \mathbf { k } _ { 0 } - m ) / \tau } } { e ^ { ( \mathbf { q } ^ { \top } \mathbf { k } _ { 0 } - m ) / \tau } + \sum _ { i = 1 } ^ { K } e ^ { \mathbf { q } ^ { \top } \mathbf { k } _ { i } / \tau } } \right] ,
17
+ $$
18
+
19
+ where $\mathbf { q }$ and $\mathbf { k } _ { i }$ $( i = 0 , \ldots , K )$ stand for the query and keys sampled from the two (augmented) data distributions $\mathcal { D }$ and $\mathcal { D } ^ { \prime }$ respectively. Specifically, $\mathbf { k } _ { 0 }$ is associated to the same instance as q’s while other $\mathbf { k } _ { i } \mathbf { s }$ not; hence we name $\mathbf { k } _ { 0 }$ and $\mathbf { k } _ { i }$ $\because 0$ ) positive sample and negative samples respectively in the remaining text, in which $K$ is the number of negative samples (or pairs) for each query. The temperature $\tau$ and the margin $m$ are hyper-parameters. In most previous works, $m$ is trivially set to zero (e.g. Oord et al. (2018); He et al. (2020); Chen et al. (2020a); Tian et al. (2020)) or some handcraft values (e.g. Xie et al. (2020)). In the following text, we mainly study contrastive learning frameworks with InfoNCE loss as in Eq. 1 unless otherwise specified.
20
+
21
+ In contrastive learning research, it has been widely believed that enlarging the number of negative samples $K$ boosts the performance (Henaff et al. (2019); Tian et al. (2019); Bachman et al. (2019)). ´ For example, in MoCo (He et al. (2020)) the ImageNet accuracy rises from $5 4 . 7 \%$ to $6 0 . 6 \%$ under linear classification protocol when $K$ grows from 256 to 65536. Such observation further drives a line of studies how to effectively optimize under a number of negative pairs, such as memory bank methods (Wu et al. (2018); He et al. (2020)) and large batch training (Chen et al. (2020a)), either of which empirically reports superior performances when $K$ becomes large. Analogously, in the field of supervised metric learning (Deng et al. (2019); Wang et al. (2018); Sun et al. (2020); Wang et al. (2020)), loss in the similar form as Eq. 1 is often applied on a lot of negative pairs for hard negative mining. Besides, there are also a few theoretical studies supporting the viewpoint. For instance, Oord et al. (2018) points out that the mutual information between the positive pair tends to increase with the number of negative pairs $K$ ; Wang $\&$ Isola (2020) find that the negative pairs encourage features’ uniformity on the hypersphere; Chuang et al. (2020) suggests that large $K$ leads to more precise estimation of the debiased contrastive loss; etc.
22
+
23
+ Despite the above empirical or theoretical evidence, however, we point out that the reason for using many negative pairs is still less convincing. First, unlike the metric learning mentioned above, in self-supervised learning, the negative terms $\mathbf { k } _ { i }$ in Eq. 1 include both “true negative” (whose underlying class label is different from the query’s, similarly hereinafter) and “false negative” samples, since the actual ground truth label is not available. So, intuitively large K should not always be beneficial because the risk of false negative samples also increases (known as class collision problem). Arora et al. (2019) thus theoretically concludes that a large number of negative samples could not necessarily help. Second, some recent works have proven that by introducing new architectures (e.g., a predictor network in BYOL (Grill et al., 2020)), or designing new loss functions (e.g., Caron et al. (2020a); Ermolov et al. (2020)), state-of-the-art performance can still be obtained even without any explicit negative pairs. In conclusion, it is still an open question whether large quantities of negative samples are essential to contrastive learning.
24
+
25
+ After referring to the above two aspects, we rise a question: is a large $\kappa$ really essential in the contrastive learning framework? We propose to rethink the question from a different view: note that in Eq. 1, there are three hyper-parameters: the number of negative samples $K$ , temperature $\tau$ , and margin $m$ . In most of previous empirical studies (He et al. (2020); Chen et al. (2020a)), only $K$ is changed while $\tau$ and $m$ are usually kept constant. Do the optimal hyper-parameters of $\tau$ and $m$ varies with $K ?$ If so, the performance gains observed from larger $K \mathrm { s }$ may be a wrong interpretation – merely brought by suboptimal hyper-parameters’ choices for small $K \mathrm { s }$ , rather than much of an essential.
26
+
27
+ In the paper, we investigate the relationship among three hyper-parameters and suggest an equivalent rule:
28
+
29
+ $$
30
+ m = \tau { \log } { \frac { \alpha } { K } } ,
31
+ $$
32
+
33
+ where $\alpha$ is a constant. We find that if the margin $m$ is adaptively adjusted based on the above rule, the performance of contrastive learning is irrelevant to the size of $K$ , in a very large range (e.g. $K \ge 1 6 )$ . For example, in MoCo framework, by introducing EqCo the performance gap between $K \ : = \ : 2 5 6$ and $K = 6 5 5 3 6$ (the best configuration reported in He et al. (2020)) almost disappears (from $6 . 1 \%$ decrease to $0 . 2 \%$ ). We call this method “Equivalent Rules for Contrastive learning” $( E q C o )$ . For completeness, as the other part of EqCo we point that adjusting the learning rate according to the conventional linear scaling rule satisfies the equivalence for different number of queries per batch.
34
+
35
+ Theoretically, following the InfoMax principle (Linsker (1988)) and the derivation in CPC (Oord et al. (2018)), we prove that in $E q C o$ , the lower bound of the mutual information keeps steady under various numbers of negative samples $K$ . Moreover, from the back-propagation perspective, we further prove that in such configuration the upper bound of the gradient norm is also free of
36
+
37
+ $K$ ’s scale. The proposed equivalent rule implies that, by assigning $\alpha = K _ { 0 }$ , it can “mimic” the optimization behavior under $K _ { 0 }$ negative samples even if the physical number of negatives $K \neq K _ { 0 }$ .
38
+
39
+ The “equivalent” methodology of EqCo follows the well-known linear scaling rule (Krizhevsky (2014); Goyal et al. (2017)), which suggests scalinif the loss satisfies with the linear averaged form: $\begin{array} { r } { L = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } f ( x _ { i } ; \theta ) } \end{array}$ portional to the batch size. However, linear scaling includes two batch sizes (number of queries and keys respectively) while linear scaling rule only involves one, in addition to the nonlinearity of the keys in InfoNCE loss. In the experiments of SimCLR (Chen et al. (2020a)), learning rates under different batch sizes are adjusted with linear scaling rule, but the accuracy gap is still very large $5 7 . 5 \% @$ batch $= 2 5 6$ vs. $6 4 + \% \textcircled { a }$ batc $_ { 1 = 8 1 9 2 }$ , 100 epochs training).
40
+
41
+ EqCo challenges the belief that self-supervised contrastive learning requires large quantities of negative pairs to obtain competitive performance, making it possible to design simpler algorithms. We thus present SiMo, a simplified contrastive learning framework based on $M o C o \ \nu 2$ (Chen et al. (2020c)). SiMo is elegant, efficient, free of large batch training and memory bank; moreover, it can achieve superior performances over state-of-the-art even if the number of negative pairs is extremely small (e.g. 16), without bells and whistles.
42
+
43
+ The contributions of our paper are summarized as follows:
44
+
45
+ • We challenge the widely accepted belief that on large-scale vision datasets like ImageNet, large size of negative samples is critical for contrastive learning. We interpret it from a different view: it may be because the hyper-parameters are not set to the optimum. • We propose EqCo, an equivalent rule to adaptively set hyper-parameters between small and large numbers of negative samples, which proves to bridge the performance gap. • We present SiMo, a simpler but stronger baseline for contrastive learning.
46
+
47
+ # 2 EQCO: EQUIVALENT RULES FOR CONTRASTIVE LEARNING
48
+
49
+ In this section we introduce EqCo. We mainly consider the circumstance of optimizing the InfoNCE loss (Eq. 1) with SGD. For each batch of training, there are two meanings of the concept “batch size”, i.e., the size of negative samples/pairs $K$ per query, and the number of queries (or positive pairs) $N$ per batch. Hence our equivalent rules accordingly consist of two parts, which will be introduced in the next subsections.
50
+
51
+ # 2.1 THE CASE OF NEGATIVE PAIRS
52
+
53
+ Our derivation is mainly inspired by the model of Contrastive Predictive Coding (CPC) (Oord et al. (2018)), in which InfoNCE loss is interpreted as a mutual information estimator. We further extend the method so that it is applicable to InfoNCE loss with a margin term (Eq. 1), which is not considered in Oord et al. (2018).
54
+
55
+ Following the concept in Oord et al. (2018), given a query embedding q (namely the context in Oord et al. (2018)) and suppose $K + 1$ random key embeddings $\textbf { x } = \{ \mathbf { x } _ { i } \} _ { i = 0 , \dots , K }$ , where there exists exactly one entry (e.g., ${ \bf x } _ { i }$ ) sampled from the conditional distribution $\mathbf { P } ( \mathbf { x } _ { i } | \mathbf { q } )$ while others (e.g., $\mathbf { x } _ { j }$ ) sampled from the “proposal” distribution $\mathrm { P } ( \mathbf { x } _ { j } )$ independently. According to which entry corresponds to the conditional distribution, we therefore defines $K + 1$ candidate distributions for $\mathbf { x }$ (denoted by $\{ H _ { i } \} _ { i = 0 , . . . , K } )$ , where the probability density of $\mathbf { x }$ under $H _ { i }$ is $\begin{array} { r } { \mathrm { P } _ { H _ { i } } ( \mathbf { x } ) = \mathrm { P } ( \mathbf { x } _ { i } | \mathbf { q } ) \prod _ { j \neq i } \mathrm { P } ( \mathbf { x } _ { j } ) } \end{array}$ . So, given the observed data $X = \{ \mathbf { k } _ { 0 } , \ldots , \mathbf { k } _ { K } \}$ of $\mathbf { x }$ , the probability where $\mathbf { x }$ is sampled from $H _ { 0 }$ rather than other candidates is thus derived with Bayes theorem:
56
+
57
+ $$
58
+ \begin{array} { r l } & { \mathrm { P r } [ { \bf x } \sim H _ { 0 } | { \bf q } , X ] = \frac { { \bf P } ^ { + } { \bf P } _ { H _ { 0 } } ( X ) } { { \bf P } ^ { + } { \bf P } _ { H _ { 0 } } ( X ) + { \bf P } ^ { - } \sum _ { i = 1 } ^ { K } { \bf P } _ { H _ { i } } ( X ) } } \\ & { \qquad = \frac { \frac { { \bf P } ^ { + } } { { \bf P } ^ { - } } \frac { { \bf P } ( { \bf k } _ { 0 } | { \bf q } ) } { { \bf P } ( { \bf k } _ { 0 } ) } } { \frac { { \bf P } ^ { + } } { { \bf P } ^ { - } } \frac { { \bf P } ( { \bf k } _ { 0 } | { \bf q } ) } { { \bf P } ( { \bf k } _ { 0 } ) } + \sum _ { i = 1 } ^ { K } \frac { { \bf P } ( { \bf k } _ { i } | { \bf q } ) } { { \bf P } ( { \bf k } _ { i } ) } } , } \end{array}
59
+ $$
60
+
61
+ where we denote $\mathrm { P } ^ { + }$ and $\mathrm { { \bf P } } ^ { - }$ as the prior probabilities of $H _ { 0 }$ and $H _ { i } ( i > 0 )$ respectively. We point that Eq. 2 introduces a generalized form to that in Oord et al. (2018) by taking the priors into account. Referring to the notations in Eq. 1, we suppose that $H _ { 0 }$ is the ground truth distribution of $\mathbf { x }$ (since $\mathbf { k } _ { 0 }$ is the only positive sample). By modeling the density ratio $\begin{array} { r } { \tilde { \bf P } ( \bar { \bf k } _ { i } | { \bf q } ) / { \bf P } ( \bf k _ { i } ) \propto \boldsymbol { e } ^ { \bf q ^ { \top } \bf k } \boldsymbol { i } / \tau ( i = 0 , \ldots , K ) } \end{array}$ and letting $\mathrm { P } ^ { + } / \mathrm { P } ^ { - } = e ^ { - m / \tau }$ , the negative log-likelihood $\mathcal { L } _ { o p t } \triangleq \mathbb { E } _ { \mathbf { q } , X } \ - \log \operatorname* { P r } [ x \sim H _ { 0 } | \mathbf { q } , X ]$ can be regarded as the optimal value of $\mathcal { L } _ { N C E }$ .
62
+
63
+ Similar to the methodology of Oord et al. (2018), we explore the lower bound of $\mathcal { L } _ { o p t }$ :
64
+
65
+ $$
66
+ \begin{array} { l } { \mathcal { L } _ { o p t } = \underset { \mathbf { q } \sim \mathcal { D } , \mathbf { k } _ { 0 } \sim \mathcal { D } ^ { \prime } ( \mathbf { q } ) , \mathbf { k } _ { i } \sim \mathcal { D } ^ { \prime } } { \mathbb { E } } \log \left( 1 + e ^ { m / \tau } \frac { \mathbf { P } ( \mathbf { k } _ { 0 } ) } { \mathbf { \bar { P } } \left( \mathbf { k } _ { 0 } | \mathbf { q } \right) } \underset { i = 1 } { \overset { K } { \sum } } \frac { \mathbf { P } ( \mathbf { k } _ { i } | \mathbf { q } ) } { \mathbf { \bar { P } } \left( \mathbf { k } _ { i } \right) } \right) } \\ { \approx \underset { \mathbf { q } \sim \mathcal { D } , \mathbf { k } _ { 0 } \sim \mathcal { D } ^ { \prime } ( \mathbf { q } ) } { \mathbb { E } } \log \left( 1 + K e ^ { m / \tau } \frac { \mathbf { P } \left( \mathbf { k } _ { 0 } \right) } { \mathbf { \bar { P } } \left( \mathbf { k } _ { 0 } | \mathbf { q } \right) } \left( \underset { \mathbf { k } _ { i } \sim \mathcal { D } ^ { \prime } } { \mathbb { E } } \frac { \mathbf { \bar { P } } \left( \mathbf { k } _ { i } | \mathbf { q } \right) } { \mathbf { \bar { P } } \left( \mathbf { k } _ { i } \right) } \right) \right) } \\ { = \underset { \mathbf { q } \sim \mathcal { D } , \mathbf { k } _ { 0 } \sim \mathcal { D } ^ { \prime } ( \mathbf { q } ) } { \mathbb { E } } \log \left( 1 + K e ^ { m / \tau } \frac { \mathbf { \bar { P } } \left( \mathbf { k } _ { 0 } \right) } { \mathbf { \bar { P } } \left( \mathbf { k } _ { 0 } | \mathbf { q } \right) } \right) } \\ { \geq \log \left( 1 + K e ^ { m / \tau } \right) - \mathcal { Z } ( \mathbf { k } _ { 0 } , \mathbf { q } ) , } \end{array}
67
+ $$
68
+
69
+ where $\mathcal { T } ( \cdot , \cdot )$ means mutual information. The approximation in the second row is guaranteed by Law of Large Numbers as well as the fact $\mathbf { P } ( \mathbf { k } _ { i } | \mathbf { \bar { q } } ) \approx \mathbf { P } ( \mathbf { k } _ { i } )$ since $\mathbf { k } _ { i } ( i > 0 )$ and $\mathbf { q }$ are “almost” independent. The inequality in the last row is resulted from $\mathbf { P } ( \mathbf { k } _ { 0 } | \mathbf { q } ) \ge \mathbf { P } ( \mathbf { k } _ { 0 } )$ as $\mathbf { k } _ { 0 }$ and $\mathbf { q }$ are extracted from the same instance. Therefore the lower bound of the mutual information (noted as $f _ { \mathrm { b o u n d } } ( m , K ) )$ between the positive pair $( \mathbf { k } _ { 0 } , \mathbf { q } )$ is:
70
+
71
+ $$
72
+ \begin{array} { r l r } & { } & { \mathcal { Z } ( { \bf k } _ { 0 } , { \bf q } ) \ge f _ { \mathrm { b o u n d } } ( m , K ) \triangleq \log ( 1 + K e ^ { m / \tau } ) - \mathcal { L } _ { o p t } } \\ & { } & { \approx \log ( 1 + K e ^ { m / \tau } ) - \underset { { \bf q } \sim \mathcal { D } , { \bf k } _ { 0 } \sim \mathcal { D } ^ { \prime } ( { \bf q } ) } { \mathbb { E } } \log \left( 1 + K e ^ { m / \tau } \frac { { \bf P } ( { \bf k } _ { 0 } ) } { { \bf P } ( { \bf k } _ { 0 } | { \bf q } ) } \right) . } \end{array}
73
+ $$
74
+
75
+ So, minimizing $\mathcal { L } _ { N C E }$ (Eq. 1) towards $\mathcal { L } _ { o p t }$ implies maximizing the lower bound of the mutual information, which is also satisfied when $\bar { m } \neq 0$ . In the case of $m = 0$ , the result is consistent with that in Oord et al. (2018). Oord et al. (2018) further points out the bound increases with $K$ , which indicates larger $K$ encourages to learn more mutual information thus could help to improve the performance.
76
+
77
+ Nevertheless, different from Oord et al. (2018) our model does not require $m$ to be zero, so the lower bound in Eq. 4 is also a function of $e ^ { m / \tau }$ . Thus we have the following theorem:
78
+
79
+ Theorem 1. (Main, EqCo for negative pairs) The mutual information lower bound of InfoNCE loss in Eq. 1 is irrelevant to the number of negative pairs $K$ , if
80
+
81
+ $$
82
+ m = \tau { \log } { \frac { \alpha } { K } } ,
83
+ $$
84
+
85
+ where $\alpha$ is a constant coefficient. And in the circumstances the bound is given by:
86
+
87
+ $$
88
+ f _ { \mathrm { b o u n d } } \left( \tau \mathrm { l o g } \frac { \alpha } { K } , K \right) \approx \mathrm { l o g } ( 1 + \alpha ) - \underset { \mathbf { q } \sim \mathcal { D } , \mathbf { k } _ { 0 } \sim \mathcal { D } ^ { \prime } ( \mathbf { q } ) } { \mathbb { E } } \mathrm { l o g } \left( 1 + \alpha \frac { \mathbf { P } ( \mathbf { k } _ { 0 } ) } { \mathbf { P } ( \mathbf { k } _ { 0 } | \mathbf { q } ) } \right) \approx f _ { \mathrm { b o u n d } } ( 0 , \alpha ) ,
89
+ $$
90
+
91
+ which can be immediately obtained by substituting Eq. 5 into Eq. 4. We name Eq. 5 as “equivalent condition”.
92
+
93
+ Theorem 1 suggests a property of equivalency: under the condition of Eq. 5, no matter what the number of physical negative pairs $K$ is, the optimal solution of $\mathcal { L } _ { N C E }$ (Eq. 1) is “equivalent” in the sense of the same mutual information lower bound. The bound is controlled by a hyper-parameter $\alpha$ rather than $K$ . Eq. 6 further implies that the lower bound also correlates to the configuration of $K = \alpha$ without margin, which suggests we can “mimic” the InfoNCE loss’s behavior of $K = K _ { 0 }$ under a different physical negative sample size $K _ { 1 }$ , just by applying Eq. 5 with $\alpha = K _ { 0 }$ . It inspires us to simplify the existing state-of-the-art frameworks (e.g. MoCo (He et al. (2020))) with fewer negative samples but as accurate as the original configurations, which will be introduced next.
94
+
95
+ We empirically validate Theorem 1 as follows. Notice that $f _ { \mathrm { b o u n d } }$ is difficult to calculate directly because $\mathcal { L } _ { o p t }$ is not known. Instead, we plot the empirical mutual information lower bound $\hat { f } _ { \mathrm { { b o u n d } } } ( m , K ) \triangleq \log ( 1 + K e ^ { m / \tau } ) - \mathcal { L } _ { N C E }$ . So, we have $\hat { f } _ { \mathrm { { b o u n d } } } \leq f _ { \mathrm { { b o u n d } } }$ ; when $\mathcal { L } _ { N C E }$ converges to the optimum $\mathcal { L } _ { o p t }$ , $\hat { f } _ { \mathrm { b o u n d } }$ is an approximation of $f _ { \mathrm { b o u n d } }$ . In Fig. 1, we plot the evolution of $\hat { f } _ { \mathrm { { b o u n d } } }$ during the training of $M o C o \ \nu 2$ under different configurations. Obviously, when it converges, without EqCo $\hat { f } _ { \mathrm { b o u n d } }$ keeps increasing with the number of negative pairs $K$ ; in contrast, after applying the equivalent condition (Eq. 5) $\hat { f } _ { \mathrm { { b o u n d } } }$ converges to almost the same value under different $K \mathrm { s }$ . The empirical results are thus consistent with Theorem 1.
96
+
97
+ ![](images/cca9754868e1b928436bbfd2defab666939fbe5da68708c15cab39390939d953.jpg)
98
+ Figure 1: Evolution of the empirical mutual information lower bound $\hat { f } _ { \mathrm { { b o u n d } } }$ during training. We use $\alpha = 6 5 5 3 6$ for EqCo. Results are evaluated with MoCo $\nu 2$ on ImageNet. Refer to Theorem 1 for details. Best viewed in color.
99
+
100
+ Remarks 1. The equivalent condition in Eq. 5 suggests the margin $m$ is inversely correlated with $K$ . It is intuitive, because the larger $K$ is, the more risks of class collision (Arora et al. (2019)) it suffers from, so we need to avoid over-penalty for negative samples near the query, thus smaller $m$ is used; in contrast, if $K$ is very small, we use larger $m$ to exploit more “hard” negative samples.
101
+
102
+ Besides, recall that the margin term $e ^ { m / \tau }$ is defined as the ratio of the prior probabilities $\mathrm { P ^ { - } / P ^ { + } }$ in Eq. 2. If the equivalent condition Eq. 5 satisfies, i.e., $\mathsf { P } ^ { - } / \mathsf { P } ^ { + } = \alpha / K$ , we have $\mathsf { P } ^ { + } = 1 / ( 1 + \alpha )$ (notice that $K \mathsf { P } ^ { - } + \mathsf { P } ^ { + } \equiv 1 ,$ ), suggesting that the prior probability of the ground truth distribution $H _ { 0 }$ is supposed to be a constant ignoring the number of negative samples $K$ . While in previous works (usually without the margin term, or $m = 0$ ) we have $\mathbf { \bar { P } } ^ { + } = 1 / ( \mathbf { \bar { K } } + 1 )$ . It is hard to distinguish which prior is more reasonable. However at least, we intuitively suppose keeping a constant prior for the ground truth distribution may help to keep the optimal choices of hyper-parameters steady under different $K \mathrm { s }$ , which is also consistent with our empirical observations.
103
+
104
+ Remarks 2. In Theorem 1, it is worth noting that $K$ refers to the number of negative samples per query. In the conventional batched training scheme, negative samples for different queries could be either (fully or partially) shared or isolated, i.e., the total number of distinguishing negatives samples per batch could be different, which is not ruled by Theorem 1. However, we empirically find the differences in implementation do not result in much of the performance variation.
105
+
106
+ The following theorem further supports the equivalent rule (Theorem 1) from back-propagation view:
107
+
108
+ Theorem 2. Given the equivalent condition (Eq. 5) and a query embedding q as well as the corresponding positive sample $\mathbf { k } _ { 0 }$ , for $\mathcal { L } _ { N C E }$ in Eq. 1 the expectation of the gradient norm w.r.t. $\mathbf { q }$ is bounded by 2:
109
+
110
+ $$
111
+ \underset { \mathbf { k } _ { i } \sim \mathcal { D } ^ { \prime } } { \mathbb { E } } \left. \frac { \mathrm { d } \mathcal { L } _ { N C E } } { \mathrm { d } \mathbf { q } } \right. \leq \frac { 2 } { \tau } \left( 1 - \frac { \exp ( \mathbf { q } ^ { \top } \mathbf { k } _ { 0 } / \tau ) } { \exp ( \mathbf { q } ^ { \top } \mathbf { k } _ { 0 } / \tau ) + \alpha \mathbb { E } _ { \mathbf { k } _ { i } \sim \mathcal { D } ^ { \prime } } [ \exp ( \mathbf { q } ^ { \top } \mathbf { k } _ { i } / \tau ) ] } \right) .
112
+ $$
113
+
114
+ Please refer to the Appendix A.1 for the detailed proof. Note that we assume the embedding vectors are normalized, i.e., $\| \mathbf { k } _ { i } \| = 1 ( i = 0 , \cdot \cdot \cdot , K )$ , which is also a convention in recent contrastive learning works.
115
+
116
+ Theorem 2 indicates that, equipped with the equivalent rule (Eq. 5), the upper bound of the gradient norm is irrelevant to the number of negative samples $K$ . Fig. 4 (see the Appendix A.2) further validates our theory: the gradient norm becomes much more steady after using EqCo under different $K \mathrm { s }$ . Since the size of $K$ affects little on the gradient magnitude, gradient scaling techniques, e.g. linear scaling rule, are not required specifically for different $K \mathrm { s } .$ . Eq. 7 also implies that the temperature $\tau$ significantly affects the gradient norm even EqCo is applied – it is why we only recommend to modify $m$ for equivalence (Eq. 5), though the mutual information lower bound is determined by $e ^ { m / \tau }$ as a whole.
117
+
118
+ # 2.2 THE CASE OF POSITIVE PAIRS
119
+
120
+ In practice the InfoNCE loss (Eq. 1) is usually optimized with batched SGD, which can be represented as empirical risk minimization:
121
+
122
+ $$
123
+ \mathcal { L } _ { N C E } ^ { \mathrm { b a t c h } } = \frac { 1 } { N } \sum _ { j = 1 } ^ { N } \mathcal { L } _ { N C E } ^ { ( j ) } ( \mathbf { q } _ { j } , \mathbf { k } _ { j , 0 } ) ,
124
+ $$
125
+
126
+ where $N$ is the number of queries (or positive pairs) per batch; $( { \bf q } _ { j } , { \bf k } _ { j , 0 } ) \sim ( { \cal D } , { \cal D } ^ { \prime } ( { \bf q } _ { j } ) )$ is the $j$ -th positive pair, and ndependent of each $\mathcal { L } _ { N C E } ^ { ( j ) } ( \mathbf { q } _ { j } , \mathbf { k } _ { j , 0 } )$ is the corresponding loss. For different is sampled independently. Hence, Eq. $j$ , 8 $\mathcal { L } _ { N C E } ^ { ( j ) }$ is (almost)es the form ${ \bf q } _ { j }$ of linear scaling rule (Krizhevsky (2014); Goyal et al. (2017)), suggesting that the learning rate should be adjusted proportional to the number of queries $N$ per batch.
127
+
128
+ Remarks 3. Previous work like SimCLR (Chen et al. (2020a)) also proposes to apply linear scaling rule. 3 The difference is, in SimCLR it does not clarify the concept of “batch size” refers to the number of queries or the number of keys. However in our paper, we explicitly point that the linear scaling rule needs to be applied corresponding to the number of queries per batch $( N )$ rather than $K$ .
129
+
130
+ # 2.3 EMPIRICAL EVALUATION
131
+
132
+ In this subsection we conduct experiments on the three state-of-the-art self-supervised contrastive learning frameworks – MoCo (He et al. (2020)), MoCo v2 (Chen et al. (2020c)) and SimCLR (Chen et al. (2020a)) to verify our theory in Sec. 2.1 and Sec. 2.2. We propose to alter $K$ and $N$ separately to examine the correctness of our equivalent rules.
133
+
134
+ Implementation details. We follow most of the training and evaluation settings recommended in the original papers respectively. The only difference is, for SimCLR, we adopt SGD with momentum rather than LARS (You et al. (2017)) as the optimizer. We use ResNet-50 (He et al. (2016)) as the default network architecture. 128-d features are employed for query and key embeddings. Unless specially mentioned, all models are trained on ImageNet (Deng et al. (2009)) for 200 epochs without using the ground truth labels. We report the top-1 accuracy under the conventional linear evaluation protocol according to the original paper respectively. The number of queries per batch $( N )$ is set to 256 by default. All models are trained with 8 GPUs.
135
+
136
+ It is worth noting the way we alter the number of negative samples $K$ independent of $N$ during training. For MoCo and MoCo v2, we simply need to set the size of the memory bank to $K$ . Specially, if $K < N$ , in the current batch the memory bank is actually composed of $K$ random keys sampled from the previous batch. While for SimCLR, if $K < N$ we random sample $K$ negative keys for each query independently. We do not study the case that $K > N$ for SimCLR. We mainly consider the ease of implementation in designing the strategies; as mentioned in Remarks 2 (Sec. 2.1), it does not affect the empirical conclusion.
137
+
138
+ ![](images/9106e601f0206f530101eae52fac3353abbbe4e5df8a80590ccee54ac565a8ad.jpg)
139
+ Figure 2: Comparisons with/without $E q C o$ under different number of negative samples (noted by $K _ { \cdot }$ ). Results are evaluated with ImageNet top-1 accuracy using linear evaluation protocol. In EqCo, we set $\alpha = 6 5 5 3 6$ for MoCo and MoCo v2, and $\alpha = 2 5 6$ for SimCLR (except for one data point with $\alpha = 4 0 9 6$ , as noted in the legend). Best viewed in color.
140
+
141
+ Quantitative results. Fig. 2 illustrates the effect of our equivalent rule under different $K \mathrm { s }$ . Our experiments start with the best configurations (i.e. $K \ : \ : = \ : 6 5 5 3 6$ for MoCo and MoCo v2, and $K = 2 5 6$ for $\mathrm { S i m C L R ^ { 4 } }$ ), then we gradually reduce $K$ and benchmark the performance. Results in Fig. 2 indicates that, without $\mathrm { E q C o }$ the accuracy significantly drops if $K$ becomes very small (e.g. $K < 6 4$ ). While with EqCo, by setting $\alpha$ to “mimic” the optimal $K$ , the performance surprisingly keeps steady under a wide range of $K \mathrm { s }$ . Fig. 2(b) further shows that in SimCLR, by setting $\alpha$ to a number larger than the physical batch size (e.g. 4096 vs. 256), the accuracy significantly improves from $6 2 . 0 \%$ to $6 5 . 3 \%$ , 5 suggesting the benefit of EqCo especially when the memory is limited. The comparison fully demonstrates EqCo is essential especially when the number of negative pairs is small.
142
+
143
+ Besides, Table 1 compares the results of MoCo $\nu 2$ under different number of queries $N$ , while $K \ : = \ : 6 5 5 3 6$ is fixed. It is clear that, with linear scaling rule (Krizhevsky (2014); Goyal et al. (2017)), the final performance is almost unchanged under different $N$ , suggesting the effectiveness of our equivalent rule for $N$ .
144
+
145
+ <table><tr><td rowspan=1 colspan=1>N(K = 65536)</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>512</td><td rowspan=1 colspan=1>1024</td></tr><tr><td rowspan=1 colspan=1>Top-1 accuracy (%)</td><td rowspan=1 colspan=1>67.5</td><td rowspan=1 colspan=1>67.5</td><td rowspan=1 colspan=1>67.4</td></tr></table>
146
+
147
+ Table 1: ImageNet accuracy (MoCo v2) vs. the number of queries per batch $( N )$ ). The learning rates during training are adjusted with linear scaling rule.
148
+
149
+ # 3 SIMO: A SIMPLER BUT STRONGER BASELINE
150
+
151
+ EqCo inspires us to rethink the design of contrastive learning frameworks. The previous state-ofthe-arts like MoCo and SimCLR heavily rely on large quantities of negative pairs to obtain high performances, hence implementation tricks such as memory bank and large batch training are introduced, which makes the system complex and tends to be costly. Thanks to $\mathrm { E q C o }$ , we are able to design a simpler contrastive learning framework with fewer negative pairs.
152
+
153
+ ![](images/99f3fae3131dfe8dc528521a4f6f40daf9e4132960d054ceeb22d941644caaf7.jpg)
154
+ Figure 3: SiMo with/without EqCo
155
+
156
+ Table 2: State-of-the-art InfoNCE-based frameworks
157
+
158
+ <table><tr><td>Method</td><td>Epochs</td><td>Top-1 (%)</td></tr><tr><td>CPC v2 (Henaff etal.,2019) CMC (Tian et al.,2019)</td><td>200</td><td>63.8</td></tr><tr><td>SimCLR (Chen et al.,2020a)</td><td>240 200</td><td>66.2 66.6</td></tr><tr><td>MoCo v2 (Chen et al.,2020c)</td><td>200</td><td>67.5</td></tr><tr><td>InfoMin Aug.(Tian et al. (2020))</td><td>200</td><td>70.1</td></tr><tr><td>SiMo(K=16,α=256)</td><td>200</td><td>68.1</td></tr><tr><td>SiMo (K= 256,α= 256)</td><td>200</td><td>68.0</td></tr><tr><td>SiMo (K= 256,α= 65536)</td><td>200</td><td>68.5</td></tr><tr><td>PIRL(Misra&amp;Maaten,2020)</td><td>800</td><td>63.6</td></tr><tr><td>SimCLR(Chen et al.,2020a)</td><td>1000</td><td>69.3</td></tr><tr><td>MoCo v2 (Chen et al.,2020c)</td><td>800</td><td>71.1</td></tr><tr><td>InfoMin Aug.(Tian et al.(2020))</td><td>800</td><td>73.0</td></tr><tr><td>SiMo(K=256,α=256)</td><td>800</td><td>71.8</td></tr><tr><td>SiMo(K= 256,α=65536)</td><td>800</td><td>72.1</td></tr></table>
159
+
160
+ We propose SiMo, a simplified variant of MoCo v2 (Chen et al. (2020c)) equipped with $\mathrm { E q C o }$ . We follow most of the design in Chen et al. (2020c), where the key differences are as follows:
161
+
162
+ Memory bank. MoCo, MoCo v2 and SimCLR ${ \tt V } 2 ^ { \mathrm { ~ 6 ~ } }$ (Chen et al. (2020b)) employ memory bank to maintain large number of negative embeddings $\mathbf { k } _ { i }$ , in which there is a side effect: every positive embedding $\mathbf { k } _ { 0 }$ is always extracted from a “newer” network than the negatives’ in the same batch, which could harm the performance. In SiMo, we thus cancel the memory bank as we only rely on a few negative samples per batch. Instead, we use the momentum encoder to extract both positive and negative key embeddings from the current batch.
163
+
164
+ Shuffling BN vs. Sync BN. In MoCo v1/v2, shuffling BN (He et al. (2020)) is proposed to remove the obvious dissimilarities of the BN (Ioffe & Szegedy (2015)) statistics between the positive (from current mini-batch) and the negatives (from memory bank), so that the model can make predictions based on the semantic information of images rather than the BN statistics. In contrast, since the positive and negatives are from the same batch in SiMo, therefore, we use sync BN (Peng et al. (2018)) for simplicity and more stable statistics. Sync BN is also used in SimCLR (Chen et al. (2020a)) and SimCLR v2 (Chen et al. (2020b)).
165
+
166
+ There are a few other differences, including 1) we use a BN attached to each of the fully-connected layers; 2) we introduce a warm-up stage at the beginning of the training, which follows the methodology in SimCLR (Chen et al. (2020a)). Apart from all the differences mentioned above, the architecture and the training (including data augmentations) details in SiMo are exactly the same as MoCo v2’s. In the following text, the number of queries per batch (N) is set to 256, and the backbone network is ResNet-50 by default.
167
+
168
+ Quantitative results. First, we empirically demonstrate the necessity of $E q C o$ in SiMo framework. We choose the number of negative samples $K \ : = \ : 2 5 6$ as the baseline, then reduce $K$ to evaluate the performance. Fig. 3 shows the result on ImageNet using linear evaluation protocol. Without EqCo, the accuracy significantly drops when $K$ is very small. In contrast, using EqCo to “mimic” the case of large $K$ (by setting $\alpha$ to 256), the accuracy almost keeps steady even under very small $K \mathrm { s }$ .
169
+
170
+ Table 2 further compares our SiMo with state-of-the-art self-supervised contrastive learning methods on ImageNet. 7 Using only 16 negative samples per query, SiMo outperforms MoCo v2 ( $6 8 . 1 \%$ vs. $6 7 . 5 \%$ ). If we increase $\alpha$ to 65536 to “simulate” the case under huge number of negative pairs, the accuracy further increases to $6 8 . 5 \%$ . Moreover, when we extend the training epochs to 800, we get the accuracy of $7 2 . 1 \%$ , surpassing the baseline MoCo v2 by $1 . 0 \%$ . The only entry that surpasses our results is InfoMin Aug. (Tian et al. (2020)), which is mainly focuses on data generation and orthogonal to ours. The experiments indicate that SiMo is a simpler but more powerful baseline for self-supervised contrastive learning. Readers can refer to the Appendix B for more experimental results of SiMo.
171
+
172
+ # 4 LIMITATIONS AND FUTURE WORK
173
+
174
+ Theorem 1 suggests that given the equivalent condition (Eq. 5), InfoNCE losses under various $K \mathrm { s }$ are “equivalent” in the sense of the same mutual information lower bound, which is also backed up with the experiments in Fig. 1. However, Fig. 2 (a) shows that if $K$ is smaller than a certain value (e.g. $K \leq 1 6$ ), some frameworks like $M o C o \ \nu 2$ start to degrade significantly even with $\mathrm { E q C o }$ ; while for other frameworks like SiMo (Fig. 3), the accuracy almost keeps steady for very small $K \mathrm { s }$ . Tschannen et al. (2019) also point that the principle of InfoMax cannot explain all the phenomena in contrastive learning. We will investigate the problem in the future, e.g. from other viewpoints such as gradient noise brought by small $K \mathrm { s }$ (Fig. 4 in Appendix A.2 gives some insights).
175
+
176
+ Though the formulation of Eq. 1 is very common in the field of supervised metric learning, which is usually named margin softmax cross-entropy loss (Deng et al., 2019; Wang et al., 2018; Sun et al., 2020). Nevertheless, unfortunately, our equivalent rule seems invalid to be generalized to those problems (e.g. face recognition). The major issue lies in the approximation in Eq. 3, we need the negative samples $\mathbf { k } _ { i }$ to be independent of the query q, which is not satisfied in supervised tasks.
177
+
178
+ According to Fig. 2 and Fig. 3, the benefits of EqCo become significant if $K$ is sufficiently small (e.g. $K < 6 4$ ). But in practice, for modern computing devices (e.g. GPUs) it is not that difficult to use $\sim 2 5 6$ negative pairs per query. Applying EqCo to “simulate” more negative pairs via adjusting $\alpha$ can further boost the performance, however, whose accuracy gains become relatively marginal. For example, in Table 2 under 200 epochs training, SiMo with $\alpha \ : = \ : 6 5 5 3 6$ outperforms that of $\alpha = 2 5 6$ by only $0 . 5 \%$ . It could be a fundamental limitation of InfoNCE loss. We will investigate the problem in the future.
179
+
180
+ # REFERENCES
181
+
182
+ Sanjeev Arora, Hrishikesh Khandeparkar, Mikhail Khodak, Orestis Plevrakis, and Nikunj Saunshi. A theoretical analysis of contrastive unsupervised representation learning. arXiv preprint arXiv:1902.09229, 2019.
183
+
184
+ Philip Bachman, R Devon Hjelm, and William Buchwalter. Learning representations by maximizing mutual information across views. In Advances in Neural Information Processing Systems, pp. 15535–15545, 2019.
185
+
186
+ Yue Cao, Zhenda Xie, Bin Liu, Yutong Lin, Zheng Zhang, and Han Hu. Parametric instance classification for unsupervised visual feature learning. arXiv preprint arXiv:2006.14618, 2020.
187
+
188
+ Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. arXiv preprint arXiv:2006.09882, 2020a.
189
+
190
+ Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. Advances in Neural Information Processing Systems, 33, 2020b.
191
+
192
+ Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709, 2020a.
193
+
194
+ Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey E Hinton. Big self-supervised models are strong semi-supervised learners. Advances in Neural Information Processing Systems, 33, 2020b.
195
+
196
+ Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020c.
197
+
198
+ Ching-Yao Chuang, Joshua Robinson, Lin Yen-Chen, Antonio Torralba, and Stefanie Jegelka. Debiased contrastive learning. arXiv preprint arXiv:2007.00224, 2020.
199
+
200
+ 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.
201
+
202
+ Jiankang Deng, Jia Guo, Niannan Xue, and Stefanos Zafeiriou. Arcface: Additive angular margin loss for deep face recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4690–4699, 2019.
203
+
204
+ Alexey Dosovitskiy, Jost Tobias Springenberg, Martin Riedmiller, and Thomas Brox. Discriminative unsupervised feature learning with convolutional neural networks. In Advances in neural information processing systems, pp. 766–774, 2014.
205
+
206
+ Aleksandr Ermolov, Aliaksandr Siarohin, Enver Sangineto, and Nicu Sebe. Whitening for selfsupervised representation learning. arXiv preprint arXiv:2007.06346, 2020.
207
+
208
+ Priya Goyal, Piotr Dollar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, An-´ drew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
209
+
210
+ Jean-Bastien Grill, Florian Strub, Florent Altche, Corentin Tallec, Pierre H Richemond, Elena ´ Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv preprint arXiv:2006.07733, 2020.
211
+
212
+ Raia Hadsell, Sumit Chopra, and Yann LeCun. Dimensionality reduction by learning an invariant mapping. In 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’06), volume 2, pp. 1735–1742. IEEE, 2006.
213
+
214
+ 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.
215
+
216
+ 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.
217
+
218
+ Olivier J Henaff, Aravind Srinivas, Jeffrey De Fauw, Ali Razavi, Carl Doersch, SM Eslami, and ´ Aaron van den Oord. Data-efficient image recognition with contrastive predictive coding. arXiv preprint arXiv:1905.09272, 2019.
219
+
220
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
221
+
222
+ Alex Krizhevsky. One weird trick for parallelizing convolutional neural networks. arXiv preprint arXiv:1404.5997, 2014.
223
+
224
+ Tsung-Yi Lin, Piotr Dollar, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. ´ Feature pyramid networks for object detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2117–2125, 2017.
225
+
226
+ Ralph Linsker. Self-organization in a perceptual network. Computer, 21(3):105–117, 1988.
227
+
228
+ Ishan Misra and Laurens van der Maaten. Self-supervised learning of pretext-invariant representations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6707–6717, 2020.
229
+
230
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
231
+
232
+ Chao Peng, Tete Xiao, Zeming Li, Yuning Jiang, Xiangyu Zhang, Kai Jia, Gang Yu, and Jian Sun. Megdet: A large mini-batch object detector. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6181–6189, 2018.
233
+
234
+ Ben Poole, Sherjil Ozair, Aaron van den Oord, Alexander A Alemi, and George Tucker. On variational bounds of mutual information. arXiv preprint arXiv:1905.06922, 2019.
235
+
236
+ Yifan Sun, Changmao Cheng, Yuhan Zhang, Chi Zhang, Liang Zheng, Zhongdao Wang, and Yichen Wei. Circle loss: A unified perspective of pair similarity optimization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6398–6407, 2020.
237
+
238
+ Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. arXiv preprint arXiv:1906.05849, 2019.
239
+
240
+ Yonglong Tian, Chen Sun, Ben Poole, Dilip Krishnan, Cordelia Schmid, and Phillip Isola. What makes for good views for contrastive learning. arXiv preprint arXiv:2005.10243, 2020.
241
+
242
+ Michael Tschannen, Josip Djolonga, Paul K Rubenstein, Sylvain Gelly, and Mario Lucic. On mutual information maximization for representation learning. arXiv preprint arXiv:1907.13625, 2019.
243
+
244
+ Hao Wang, Yitong Wang, Zheng Zhou, Xing Ji, Dihong Gong, Jingchao Zhou, Zhifeng Li, and Wei Liu. Cosface: Large margin cosine loss for deep face recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5265–5274, 2018.
245
+
246
+ Tongzhou Wang and Phillip Isola. Understanding contrastive representation learning through alignment and uniformity on the hypersphere. arXiv preprint arXiv:2005.10242, 2020.
247
+
248
+ Xun Wang, Haozhi Zhang, Weilin Huang, and Matthew R Scott. Cross-batch memory for embedding learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6388–6397, 2020.
249
+
250
+ Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3733–3742, 2018.
251
+
252
+ Jiahao Xie, Xiaohang Zhan, Ziwei Liu, Yew Soon Ong, and Chen Change Loy. Delving into interimage invariance for unsupervised visual representations. arXiv preprint arXiv:2008.11702, 2020.
253
+
254
+ Yang You, Igor Gitman, and Boris Ginsburg. Large batch training of convolutional networks. arXiv preprint arXiv:1708.03888, 2017.
255
+
256
+ # A DETAILS ABOUT THEOREM 2
257
+
258
+ # A.1 PROOF OF EQ. 7
259
+
260
+ Given the equivalent condition (Eq. 5) and a query embedding q as well as the corresponding positive sample $\mathbf { k } _ { 0 }$ , for $\mathcal { L } _ { N C E }$ in Eq. 1 the expectation of the gradient norm w.r.t. $\mathbf { q }$ is bounded by:
261
+
262
+ $$
263
+ \underset { \mathbf { k } _ { i } \sim \mathcal { D } ^ { \prime } } { \mathbb { E } } \left. \frac { \mathrm { d } \mathcal { L } _ { N C E } } { \mathrm { d } \mathbf { q } } \right. \leq \frac { 2 } { \tau } \left( 1 - \frac { \exp ( \mathbf { q } ^ { \top } \mathbf { k } _ { 0 } / \tau ) } { \exp ( \mathbf { q } ^ { \top } \mathbf { k } _ { 0 } / \tau ) + \alpha \mathbb { E } _ { \mathbf { k } _ { i } \sim \mathcal { D } ^ { \prime } } [ \exp ( \mathbf { q } ^ { \top } \mathbf { k } _ { i } / \tau ) ] } \right) .
264
+ $$
265
+
266
+ Proof. For simplicity, we denote the term $\exp ( \mathbf { q } ^ { \top } \mathbf { k } _ { i } / \tau )$ as $s _ { i } ( i = 0 , \ldots , K )$ . Then $\mathcal { L } _ { N C E }$ can be rewritten as:
267
+
268
+ $$
269
+ \mathcal { L } _ { N C E } = - \log \frac { s _ { 0 } } { s _ { 0 } + \frac { \alpha } { K } \sum _ { i = 1 } ^ { K } s _ { i } }
270
+ $$
271
+
272
+ The gradient of $\mathcal { L } _ { N C E }$ with respect to $\mathbf { q }$ is easily to derived:
273
+
274
+ $$
275
+ \frac { \mathrm { d } \mathcal { L } _ { N C E } } { \mathrm { d } \mathbf { q } } = - \frac { 1 } { \tau } \left( 1 - \frac { s _ { 0 } } { s _ { 0 } + \frac { \alpha } { K } \sum _ { i = 1 } ^ { K } s _ { i } } \right) \mathbf { k } _ { 0 } + \frac { \alpha } { \tau K } \sum _ { i = 1 } ^ { K } \frac { s _ { 0 } } { s _ { 0 } + \frac { \alpha } { K } \sum _ { i = 1 } ^ { K } s _ { i } } \mathbf { k } _ { i } ,
276
+ $$
277
+
278
+ Owing to the Triangle Inequality and the fact that $\mathbf { k } _ { i } ( i = 0 , \ldots , K )$ is normalized, the norm of gradient is bounded by:
279
+
280
+ $$
281
+ \begin{array} { r l } { \displaystyle \left\| \frac { \mathrm { d } \mathcal { L } _ { N C E } } { \mathrm { d } \mathbf { q } } \right\| \leq \left| \frac { 1 } { \tau } \left( 1 - \frac { s _ { 0 } } { s _ { 0 } + \frac { \alpha } { K } \sum _ { i = 1 } ^ { K } s _ { i } } \right) \right| \cdot \| \mathbf { k } _ { 0 } \| + \displaystyle \sum _ { i = 1 } ^ { K } \left| \frac { \alpha } { \tau K } \frac { s _ { i } } { s _ { 0 } + \frac { \alpha } { K } \sum _ { i = 1 } ^ { K } s _ { i } } \right| \cdot \| \mathbf { k } _ { i } \| } & { } \\ { \displaystyle } & { = \frac { 1 } { \tau } \left( 1 - \frac { s _ { 0 } } { s _ { 0 } + \frac { \alpha } { K } \sum _ { i = 1 } ^ { K } s _ { i } } \right) + \frac { 1 } { \tau } \sum _ { i = 1 } ^ { K } \frac { \frac { \alpha } { K } s _ { i } } { s _ { 0 } + \frac { \alpha } { K } \sum _ { i = 1 } ^ { K } s _ { i } } } \\ { \displaystyle } & { = \frac { 2 } { \tau } \left( 1 - \frac { s _ { 0 } } { s _ { 0 } + \frac { \alpha } { K } \sum _ { i = 1 } ^ { K } s _ { i } } \right) } \end{array}
282
+ $$
283
+
284
+ Since the cosine similarity between q and $\mathbf { k } _ { i } ( i = 1 , \ldots , K )$ is bounded in $[ - 1 , 1 ]$ , we know the expectation of $\mathbb { E } _ { \mathbf { k } _ { i } \sim \mathcal { D } ^ { \prime } } \left[ s _ { i } \right]$ exists. According to Inequality (12) and Jensen’s Inequality, we have:
285
+
286
+ $$
287
+ \begin{array} { r l } { \underset { \mathbf { k } _ { i } \sim \mathcal { D } ^ { \prime } } { \mathbb { E } } \left[ \frac { 2 } { \tau } \left( 1 - \frac { s _ { 0 } } { s _ { 0 } + \frac { \alpha } { K } \sum _ { i = 1 } ^ { K } s _ { i } } \right) \right] } & { = \frac { 2 } { \tau } \left( 1 - \underset { \mathbf { k } _ { i } \sim \mathcal { D } ^ { \prime } } { \mathbb { E } } \left[ \frac { s _ { 0 } } { s _ { 0 } + \frac { \alpha } { K } \sum _ { i = 1 } ^ { K } s _ { i } } \right] \right) } \\ & { \leq \frac { 2 } { \tau } \left( 1 - \frac { s _ { 0 } } { s _ { 0 } + \alpha \mathbb { E } _ { \mathbf { k } _ { i } \sim \mathcal { D } ^ { \prime } } \left[ s _ { i } \right] } \right) } \end{array}
288
+ $$
289
+
290
+ Replacing $s _ { i }$ by $\exp ( \mathbf { q } ^ { \top } \mathbf { k } _ { i } / \tau )$ , the proof of Theorem 2 is completed.
291
+
292
+ ![](images/333fde6018cd5d18409f22ed2d80aac94c549f355e51d621b841868a960d9cb6.jpg)
293
+ Figure 4: The means (solid line) and variances (ribbon, $\pm \sigma ,$ ) of $\| \mathrm { d } \mathcal { L } _ { N C E } / \mathrm { d } \pmb { q } \|$ under different $K \mathrm { s }$ . We train a normal MoCo v2 for 200 epochs and show the statistics at different epochs.
294
+
295
+ # B MORE EXPERIMENTS ON SIMO
296
+
297
+ For the following experiments of this section, we report the top-1 accuracy of SiMo on ImageNet (Deng et al., 2009) under the linear evaluation protocol. The backbone of SiMo is ResNet-50 (He et al., 2016) and we train SiMo for 200 epochs unless noted otherwise.
298
+
299
+ # B.1 ABLATION ON MOMENTUM UPDATE
300
+
301
+ In MoCo (He et al., 2020) and MoCo v2 (Chen et al., 2020c), the key encoder is updated by the following rule:
302
+
303
+ $$
304
+ \theta _ { k } = \beta \theta _ { k } + \left( 1 - \beta \right) \theta _ { q }
305
+ $$
306
+
307
+ where $\theta _ { q }$ and $\theta _ { k }$ stand for the weights of query encoder and key encoder respectively, and $\beta$ is the momentum coefficient. For SiMo, we also adopt the momentum update and use the key encoder to compute the features of positive sample and negative samples.
308
+
309
+ In Table 3, we report the results of SiMo with different momentum coefficients. The number of training epochs is set to be 100, so the top-1 accuracy of baseline $\beta = 0 . 9 9 9 )$ drops to $6 4 . 4 \%$ . Compared to the baseline, SiMo without momentum update ( $\beta = 0$ ) is inferior, showing the advantage of momentum update.
310
+
311
+ Table 3: Ablation on momentum update.
312
+
313
+ <table><tr><td rowspan=1 colspan=1>β</td><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>0.999</td></tr><tr><td rowspan=1 colspan=1>Accuracy (%)</td><td rowspan=1 colspan=1>62.1</td><td rowspan=1 colspan=1>64.4</td></tr></table>
314
+
315
+ # B.2 ABLATION ON BN
316
+
317
+ Table 4 shows the performance of SiMo equipped with shuffling BN or Sync BN. Likewise, we train SiMo for 100 epochs. It is easy to check out that SiMo with shuffling BN struggles to perform well. Besides, compared to MoCo v2, SiMo with shuffling BN degrades significantly, and we conjecture that it is because the MLP structure of SiMo is more suitable for Sync BN, rather than shuffling BN.
318
+
319
+ Table 4: Sync BN vs. shuffling BN.
320
+
321
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Shuffling BN</td><td rowspan=1 colspan=1>Sync BN</td></tr><tr><td rowspan=1 colspan=1>Accuracy (%)</td><td rowspan=1 colspan=1>58.8</td><td rowspan=1 colspan=1>64.4</td></tr></table>
322
+
323
+ # B.3 SIMO WITH DIFFERENT $\alpha$
324
+
325
+ As shown in Sec.2.1, $\alpha$ is related to the lower bound of mutual information. Table 5 reveals how accuracy of SiMo varies with the choice of $\alpha$ . As we increase $\alpha$ to 65536, the accuracy tends to improve, in accordance with the Eq.6. However, when $\alpha$ is too large (e.g., 262144), the performance slightly drops by $0 . 2 \%$ .
326
+
327
+ Table 5: SiMo with different $\alpha$ .
328
+
329
+ <table><tr><td rowspan=1 colspan=1>α</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>1024</td><td rowspan=1 colspan=1>4096</td><td rowspan=1 colspan=1>16384</td><td rowspan=1 colspan=1>65536</td><td rowspan=1 colspan=1>262144</td></tr><tr><td rowspan=1 colspan=1>Accuracy (%)</td><td rowspan=1 colspan=1>68.0</td><td rowspan=1 colspan=1>68.1</td><td rowspan=1 colspan=1>68.1</td><td rowspan=1 colspan=1>68.4</td><td rowspan=1 colspan=1>68.5</td><td rowspan=1 colspan=1>68.3</td></tr></table>
330
+
331
+ Similar results can be found in MoCo v2. We increase $K$ to 262144 in MoCo v2, the accuracy also descends (in Table 6).
332
+
333
+ Table 6: MoCo v2 with different $K$ .
334
+
335
+ <table><tr><td rowspan=1 colspan=1>K</td><td rowspan=1 colspan=1>256</td><td rowspan=1 colspan=1>1024</td><td rowspan=1 colspan=1>4096</td><td rowspan=1 colspan=1>16384</td><td rowspan=1 colspan=1>65536</td><td rowspan=1 colspan=1>262144</td></tr><tr><td rowspan=1 colspan=1>Accuracy (%)</td><td rowspan=1 colspan=1>67.0</td><td rowspan=1 colspan=1>67.1</td><td rowspan=1 colspan=1>67.6</td><td rowspan=1 colspan=1>67.3</td><td rowspan=1 colspan=1>67.5</td><td rowspan=1 colspan=1>67.4</td></tr></table>
336
+
337
+ # B.4 SIMO WITH WIDER MODELS
338
+
339
+ Results using wider models are presented in Table 7. For SiMo, the performance is further boosted with wider models (more channels). For instance, SiMo with ResNet-50 $( 2 \mathbf { x } )$ and ResNet-50 (4x) outperforms the baseline $( 6 8 . 5 \% )$ by $2 \%$ and $3 . 8 \%$ respectively.
340
+
341
+ <table><tr><td>Architecture</td><td>Param. (M)</td><td>α</td><td>Top-1 (%)</td></tr><tr><td>ResNet-50 (2x)</td><td>94</td><td>256</td><td>70.2</td></tr><tr><td>ResNet-50 (2x)</td><td>94</td><td>65536</td><td>70.5</td></tr><tr><td>ResNet-50 (4x)</td><td>375</td><td>256</td><td>71.9</td></tr><tr><td>ResNet-50 (4x)</td><td>375</td><td>65536</td><td>72.3</td></tr></table>
342
+
343
+ Table 7: SiMo with wider models. All models are trained with 200 epochs.
344
+
345
+ # B.5 TRANSFER TO OBJECT DETECTION
346
+
347
+ Setup We utilize FPN (Lin et al., 2017) with a stack of $4 \ 3 \times 3$ convolution layers in R-CNN head to validate the effectiveness of SiMo. Following the MoCo training protocol, we fine-tune with synchronized batch-normalization (Peng et al., 2018) across GPUs. The additional initialized layers are also equipped with BN for stable training. To effectively validate the transferability of the features, the training schedule is set to be 12 epochs (known as $1 \times$ ), in which learning rate is initialized as 0.2 and decreased at 7 and 11 epochs with a factor of 0.1. The image scales are random sampled of [640, 800] pixels during training and fixed with 800 at inference.
348
+
349
+ Results Table 8 summarizes the fine-tuning results on COCO val2017 of different pre-training methods. Random initialization indicates training COCO from scratch, and supervised represents conventional pre-training with ImageNet labels. Compared with MoCo, SiMo achieves competitive performance without large quantities of negative pairs. It is also on a par with the supervised counterpart and significantly outperforms random initialized one.
350
+
351
+ Table 8: Object detection fine-tuned on COCO.
352
+
353
+ <table><tr><td>pre-train</td><td>AP</td><td>AP50</td><td>AP75</td><td>APs</td><td>APm</td><td>AP</td></tr><tr><td>random init</td><td>31.4</td><td>49.4</td><td>34.0</td><td>17.9</td><td>32.3</td><td>41.6</td></tr><tr><td>supervised</td><td>39.0</td><td>59.1</td><td>42.6</td><td>22.4</td><td>42.2</td><td>50.6</td></tr><tr><td>MoCo v2</td><td>39.1</td><td>59.2</td><td>42.5</td><td>23.3</td><td>42.1</td><td>50.8</td></tr><tr><td>SiMo</td><td>39.0</td><td>59.2</td><td>42.3</td><td>22.9</td><td>41.8</td><td>50.5</td></tr></table>
354
+
355
+ # C A TOY EVALUATION OF EQCO
356
+
357
+ To evaluate the effectiveness of $\mathrm { E q C o }$ as mutual information (MI) estimator, following the configuration of Poole et al. (2019), we estimate the MI lower bound of between two simple random vectors.
358
+
359
+ Specifically, given that $( X , Y )$ are drawn from the known correlated Gaussian distribution, we calculate the lower bound of MI between $X$ and $Y$ based on their embedding. $X$ is a 20-dimensional random variables drawn from a standard Gaussian distribution. And we sampled $Y$ with the following rule:
360
+
361
+ $$
362
+ Y = \rho X + \sqrt { 1 - \rho ^ { 2 } } \epsilon
363
+ $$
364
+
365
+ where $\rho$ is a the given correlation coefficient and $\epsilon$ is a random variable sampled from a standard Gaussian distribution and independent from $X$ . With a known $\rho$ , the ground truth MI between $X$ and $Y$ is easy to compute:
366
+
367
+ $$
368
+ { \mathcal { T } } \left( X , Y \right) = - { \frac { d } { 2 } } \log \left( 1 - \rho ^ { 2 } \right)
369
+ $$
370
+
371
+ Here, $d$ is the dimension of $X$ and $Y$ , and as mentioned above we set $d = 2 0$ .
372
+
373
+ To embed $X$ and $Y$ , we adopt two MLPs respectively, and each MLP has 1 hidden layer of 256 units, followed by ReLU activation function. We use Adam optimizer with learning rate of 0.0005 to optimize InfoNCE or EqCo for 5000 steps. For each training iteration, $K$ pairs of $( X , Y )$ are independently sampled, which means there are $K - 1$ negative samples for each query. After training, the weights of MLPs are frozen and we repeat estimating the lower bound of MI for 1000 times to reduce the estimating variance. For experiments with EqCo, we set the $\alpha = 5 1 2$ .
374
+
375
+ As shown in Table 9, $\mathcal { T } _ { N C E }$ varies with $K$ , while $\mathcal { T } _ { E q C o }$ remains steady. Especially, when the ground truth MI is relatively large (e.g., 8, 10), significant differences between EqCo and InfoNCE can be observed. The experiment further validates the effectiveness of $\mathrm { E q C o }$ .
376
+
377
+ <table><tr><td colspan="5">K</td></tr><tr><td></td><td>64</td><td>128</td><td>256</td><td>512</td></tr><tr><td>Mutual Information=2.0 INCE</td><td>1.7</td><td>1.8</td><td>1.9</td><td>1.9</td></tr><tr><td>IEqCo</td><td>1.9</td><td>1.9</td><td>1.9</td><td>1.9</td></tr><tr><td>Mutual Information = 4.0 INCE</td><td>2.9</td><td>3.2</td><td>3.4</td><td>3.6</td></tr><tr><td>IEqCo Mutual Information = 6.0</td><td>3.8</td><td>3.7</td><td>3.6</td><td>3.6</td></tr><tr><td>INCE</td><td>3.6</td><td>4.1</td><td>4.5</td><td>4.9</td></tr><tr><td>IEqCo</td><td>5.1</td><td>5.0</td><td>4.9</td><td>4.9</td></tr><tr><td>Mutual Information=8.0</td><td></td><td></td><td></td><td></td></tr><tr><td>INCE</td><td>3.9</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td>4.6</td><td>5.1</td><td>5.6</td></tr><tr><td>IEqCo</td><td>5.8</td><td>5.7</td><td>5.7</td><td>5.6</td></tr><tr><td>Mutual Information= 10.0</td><td></td><td></td><td></td><td></td></tr><tr><td>INCE IEqCo</td><td>4.1</td><td>4.7</td><td>5.4</td><td>6.0</td></tr></table>
378
+
379
+ Table 9: Estimating mutual information by InfoNCE and $\mathrm { E q C o }$ with different batch size and various ground truth mutual information.
md/train/vrCiOrqgl3B/vrCiOrqgl3B.md ADDED
@@ -0,0 +1,683 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OUTLIER-ROBUST OPTIMAL TRANSPORT
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Optimal transport (OT) provides a way of measuring distances between distributions that depends on the geometry of the sample space. In light of recent advances in solving the OT problem, OT distances are widely used as loss functions in minimum distance estimation. Despite its prevalence and advantages, however, OT is extremely sensitive to outliers. A single adversarially-picked outlier can increase OT distance arbitrarily. To address this issue, in this work we propose an outlier-robust OT formulation. Our formulation is convex but challenging to scale at a first glance. We proceed by deriving an equivalent formulation based on cost truncation that is easy to incorporate into modern stochastic algorithms for regularized OT. We demonstrate our model applied to mean estimation under the Huber contamination model in simulation as well as outlier detection on real data.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Optimal transport is a fundamental problem in applied mathematics. In its original form (Monge, 1781), the problem entails finding the minimum cost way to transport mass from a prescribed probability distribution $\mu$ on $\mathcal { X }$ to another prescribed distribution $\nu$ on $\mathcal { X }$ . Kantorovich (1942) relaxed Monge’s formulation of the optimal transport problem to obtain the Kantorovich formulation:
12
+
13
+ $$
14
+ { \mathrm { O T } } ( \mu , \nu ) \triangleq \operatorname* { m i n } _ { \Pi \in { \mathcal { F } } ( \mu , \nu ) } \mathbb { E } _ { ( X _ { 1 } , X _ { 2 } ) \sim \Pi } { \big [ } c ( X _ { 1 } , X _ { 2 } ) { \big ] } ,
15
+ $$
16
+
17
+ where $\mathcal { F } ( \mu , \nu )$ is the set of couplings between $\mu$ and $\nu$ (probability distributions on $\mathcal { X } \times \mathcal { X }$ whose marginals are $\mu$ and $\nu$ ) and $c$ is a cost function, where we typically assume $c ( x , y ) ~ \geq ~ 0$ and $c ( x , x ) = 0$ . Compared to other notions of distance between probability distributions, optimal transport uniquely depends on the geometry of the sample space.
18
+
19
+ Recent advancements in optimization for optimal transport (Cuturi, 2013; Solomon et al., 2015; Genevay et al., 2016; Seguy et al., 2018) enabled its broad adaptation in machine learning applications where geometry of the data is important. See (Peyre & Cuturi, 2018) for a survey. Optimal ´ transport has found applications in natural language processing (Kusner et al., 2015; Huang et al., 2016; Alvarez-Melis & Jaakkola, 2018; Yurochkin et al., 2019), generative modeling (Arjovsky et al., 2017), clustering (Ho et al., 2017), domain adaptation (Courty et al., 2014; 2017), large-scale Bayesian modeling (Srivastava et al., 2018), and many other domains.
20
+
21
+ Many applications use OT as a loss in an optimization problem of the form:
22
+
23
+ $$
24
+ \theta \in { \mathrm { a r g } } \operatorname* { m i n } _ { \theta \in \Theta } \mathrm { O T } ( \mu _ { n } , \nu _ { \theta } ) ,
25
+ $$
26
+
27
+ where $\{ \nu _ { \theta } \} _ { \theta \in \Theta }$ is a collection of parametric models, $\mu _ { n }$ is the empirical distribution of the samples. Such estimators are called minimum Kantorovich estimators $( M K E )$ (Bassetti et al., 2006). They are popular alternatives to likelihood-based estimators, especially in generative modeling. For example, when $\operatorname { O T } ( \cdot , \cdot )$ is the Wasserstein-1 distance and $\nu _ { \theta }$ is a generator parameterized by a neural network with weights $\theta$ , equation 1.2 corresponds to the Wasserstein GAN (Arjovsky et al., 2017).
28
+
29
+ One drawback of optimal transport is its sensitivity to outliers. Because all the mass in $\mu$ must be transported to $\nu$ , a small fraction of outliers can have an outsized impact on the optimal transport problem. For statistics and machine learning applications in which the data is corrupted or noisy, this is a major issue. For example, the poor performance of Wasserstein GANs in the presence of outliers was noted in the recent works on outlier-robust generative learning with $f$ -divergence GANs (Chao et al., 2018; Wu et al., 2020). The problem of outlier-robustness in MKE has not been studied, with the exception of two concurrent works (Staerman et al., 2020; Balaji et al., 2020).
30
+
31
+ In this paper, we propose a modification of OT to address its sensitivity to outliers. Our formulation can be used as a loss in equation 1.2 so that it is robust to a small fraction of outliers in the data. To keep things simple, we consider the $\epsilon$ -contamination model (Huber & Ronchetti, 2009). Let $\nu _ { \theta _ { 0 } }$ be a member of a parametric model $\{ \nu _ { \theta } : \theta \in \Theta \}$ and let
32
+
33
+ $$
34
+ \mu = ( 1 - \epsilon ) \nu _ { \theta _ { 0 } } + \epsilon \tilde { \nu } ,
35
+ $$
36
+
37
+ where $\mu$ is the data-generating distribution, $\epsilon > 0$ is the fraction of outliers, and $\tilde { \nu }$ is the distribution of the outliers. Although the fraction of outliers is capped at $\epsilon$ , the value of the outliers is arbitrary, so the outliers may have an arbitrarily large impact on the optimal transport problem. Our goal is to modify the optimal transport problem so that it is more robust to outliers. We have in mind the downstream application of learning $\theta _ { 0 }$ from (samples from) $\mu$ in the $\epsilon$ -contamination model. Our main contributions are as follows:
38
+
39
+ 1. We propose a robust OT formulation that is suitable for statistical estimation in the $\epsilon$ - contamination model using MKE. 2. We show that our formulation is equivalent to the original OT problem with a clipped transport cost. This connection enables us to leverage the voluminous literature on computational optimal transport to develop efficient algorithm to perform MKE robust to outliers. 3. Our formulation enables a new application of optimal transport: outlier detection in data.
40
+
41
+ # 2 PROBLEM FORMULATION
42
+
43
+ # 2.1 ROBUST OT FOR MKE
44
+
45
+ To promote outlier-robustness in MKE, we need to allow the corresponding OT problem to ignore the outliers in the data distribution $\mu$ . The $\epsilon$ -contamination model imposes a cap on the fraction of outliers, so it is not hard to see that $\| \mu - \nu _ { \theta _ { 0 } } \| _ { \mathsf { T V } } \leq \epsilon$ , where $\| \cdot \| _ { \mathsf { T V } }$ is the total-variation norm defined as $\begin{array} { r } { \| \mu \| _ { \mathrm { I V } } = \int \frac { 1 } { 2 } | \mu ( \mathrm { d } x ) | } \end{array}$ . This suggests we solve a TV-constrained/regularized version of equation 1.2. The constrained version
46
+
47
+ $$
48
+ \begin{array} { l l } { \displaystyle \operatorname* { m i n } _ { \theta \in \Theta , \tilde { \mu } } } & { \mathrm { O T } ( \tilde { \mu } , \nu _ { \theta } ) } \\ { \mathsf { s u b j e c t } \mathrm { t o } } & { \| \mu - \tilde { \mu } \| _ { \mathsf { T V } } \leq \epsilon } \end{array}
49
+ $$
50
+
51
+ suffers from identification issues. In particular, it cannot distinguish between “clean” distributions within TV distance $\epsilon$ of $\nu _ { \theta _ { 0 } }$ . This makes it unsuitable as a loss function for statistical estimation, because it cannot lead to a consistent estimator. However, its regularized counterpart
52
+
53
+ $$
54
+ \operatorname* { m i n } _ { \theta \in \Theta , s } \mathrm { O T } ( \mu + s , \nu _ { \theta } ) + \lambda \| s \| _ { \mathsf { T V } } ,
55
+ $$
56
+
57
+ where $\lambda > 0$ is a regularization parameter, does not suffer from this issue. In the rest of this paper, we work with the TV-regularized formulation equation 2.1.
58
+
59
+ The main idea of our formulation is to allow for modifications of $\mu$ , while penalizing their magnitude and ensuring that the modified $\mu$ is still a probability measure. Below we formulate this intuition in an optimization problem titled ROBOT (ROBust Optimal Transport):
60
+
61
+ # Formulation 1:
62
+
63
+ $$
64
+ \begin{array} { r } { \mathrm { R O B O T } ( \mu , \nu ) = \left\{ \begin{array} { l l } { \operatorname* { m i n } _ { \Pi \in \mathcal { F } ^ { + } ( \mathbb { R } ^ { d } \times \mathbb { R } ^ { d } ) } } & { \displaystyle \int C ( x , y ) \Pi ( \mathrm { d } x , \mathrm { d } y ) + \lambda \| s \| _ { \mathbb { T } \mathbb { V } } } \\ { \displaystyle s \epsilon \mathcal { F } ( \mathbb { R } ^ { d } ) } & { \displaystyle \int _ { B \times \mathbb { R } ^ { d } } \Pi ( \mathrm { d } x , \mathrm { d } y ) = \int _ { B } ( \mu ( \mathrm { d } x ) + s ( \mathrm { d } x ) ) \geq 0 } \\ & { ~ \forall B \in \mathcal { B } ( \mathbb { R } ^ { d } ) \mathrm { ~ ( B o r e ~ } | \sigma - \mathrm { a } | \mathrm { g e b r a } ) } \\ & { ~ \displaystyle \int _ { \mathbb { R } ^ { d } \times \mathcal { C } } \Pi ( \mathrm { d } x , \mathrm { d } y ) = \int _ { C } \nu ( \mathrm { d } y ) ~ \forall C \in \mathcal { B } ( \mathbb { R } ^ { d } ) } \\ & { ~ \displaystyle \int _ { s ( \mathrm { d } x ) = 0 } s ( \mathrm { d } x ) = 0 . } \end{array} \right. } \end{array}
65
+ $$
66
+
67
+ Here ${ \mathcal { F } } ( \mathbb { R } ^ { d } )$ denotes the set of all signed measures with finite total variation on $\mathbb { R } ^ { d }$ , $\mathcal { F } ^ { + } ( \mathbb { R } ^ { d } \times \mathbb { R } ^ { d } )$ is the set of all measures with finite total variation on $\mathbb { R } ^ { d } \times \mathbb { R } ^ { d }$ .
68
+
69
+ The first and the last constraints ensure that $\mu + s$ is a valid probability measure, while $\lambda \| s \| _ { \mathrm { T V } }$ penalizes the amount of modifications in $\mu$ . It is worth noting that we can identify exact locations of outliers in $\mu$ by inspecting $\mu + s$ , i.e. if $\dot { \mu ( x ) } + s ( x ) = 0$ , then $x$ got eliminated and is an outlier.
70
+
71
+ ROBOT, unlike classical OT, guarantees that an adversarially picked outliers can not increase the distance arbitrarily. Let $\tilde { \mu } = ( 1 - \epsilon ) \mu + \epsilon \mu _ { c }$ , i.e. $\tilde { \mu }$ is $\mu$ contaminated with outliers from $\mu _ { c }$ , and let $\nu$ be an arbitrary measure (in MKE, $\tilde { \mu }$ is the contaminated data and $\nu$ is the model we learn). Adversary can arbitrarily increase $\operatorname { O T } ( \tilde { \mu } , \nu )$ by manipulating the outlier distribution $\mu _ { c }$ . For ROBOT we have the following bound:
72
+
73
+ Theorem 2.1. Let $\tilde { \mu } = ( 1 - \epsilon ) \mu + \epsilon \mu _ { c }$ for some $\epsilon \in [ 0 , 1 )$ , then
74
+
75
+ $$
76
+ \mathrm { R O B O T } ( \tilde { \mu } , \nu ) \leq ( \mathrm { O T } ( \mu , \nu ) + \lambda \epsilon \| \mu - \mu _ { c } \| _ { \mathrm { T V } } ) \wedge \lambda \| \tilde { \mu } - \nu \| _ { \mathrm { T V } } \wedge \mathrm { O T } ( \tilde { \mu } , \nu ) .
77
+ $$
78
+
79
+ This bound has two key takeaways: since TV norm of any two distributions is bounded by 1, adversary can not increase $\mathrm { R O B O T } ( \tilde { \mu } , \nu )$ arbitrarily; in the absence of outliers, ROBOT is bounded by classical OT. See Appendix C for the proof.
80
+
81
+ Related work We note connection between equation 2.2 and unbalanced OT (UOT) (Chizat., 2017; Chizat et al., 2018). UOT is typically formulated by replacing TV norm with $\operatorname { K L } ( \mu + s | \mu )$ and adding an analogous term for $\nu$ . Chizat et al. (2018) studied entropy regularized UOT with various divergences penalizing marginal violations. Optimization problems similar to equation 2.2 have also been considered outside of the ML literature (Piccoli & Rossi, 2014; Liero et al., 2018). We are unaware of prior applications of UOT to outlier-robustness, but it was studied in the concurrent work of Balaji et al. (2020). Another relevant variation of OT is partial OT (Figalli, 2010; Caffarelli & McCann, 2010). It may also be considered for outlier-robustness, but it has a drawback of forcing mass destruction rather than adjusting marginals to ignore outliers when they are present. A concurrent work by Staerman et al. (2020) took a different path: they replaced the expectation in the Wasserstein-1 dual with a median-of-means to promote robustness. It is unclear what is the corresponding primal, making it hard to interpret as an optimal transport problem.
82
+
83
+ A major challenge with the aforementioned methods, including our Formulation 1, is the difficulty of the optimization problem. This is especially the case for MKEs, where a transport problem has to be solved in every iteration to obtain the gradient of the model parameters. Chizat et al. (2018) proposed a Sinkhorn-like algorithm for entropy regularized UOT, but it is not amenable to stochastic optimization. Balaji et al. (2020) proposed a stochastic optimization algorithm based on the UOT dual, but it requires two additional neural networks (total of four including dual potentials) to parameterize modified marginal distributions (i.e., $\mu + s$ and analogous one for $\nu$ ). Optimizing with a median-of-means in the objective function as in (Staerman et al., 2020) is also challenging. The key contribution of our work is a formulation equivalent to equation 2.2, which is easily compatible with the large body of classical OT optimization techniques (Cuturi, 2013; Solomon et al., 2015; Genevay et al., 2016; Seguy et al., 2018).
84
+
85
+ More efficient equivalent formulation At a first glance, there are two issues with equation 2.2: it appears asymmetric and it is unclear if it can be optimized efficiently. Below we present an equivalent formulation that is free of these issues:
86
+
87
+ # Formulation 2:
88
+
89
+ $$
90
+ \mathrm { R O B O T } ( \mu , \nu ) = \left\{ \begin{array} { l l } { \operatorname* { m i n } _ { \Pi \in \mathcal { F } ^ { + } ( \mathbb { R } ^ { d } \times \mathbb { R } ^ { d } ) } } & { \displaystyle \int C _ { \lambda } ( x , y ) \Pi ( \mathrm { d } x , \mathrm { d } y ) } \\ { \mathrm { s u b j e c t ~ t o } } & { \displaystyle \int _ { B \times \mathbb { R } ^ { d } } \Pi ( \mathrm { d } x , \mathrm { d } y ) = \int _ { B } \mu ( \mathrm { d } x ) \vee B \in \mathcal { B } ( \mathbb { R } ^ { d } ) } \\ & { \displaystyle \int _ { \mathbb { R } ^ { d } \times C } \Pi ( \mathrm { d } x , \mathrm { d } y ) = \int _ { C } \nu ( \mathrm { d } y ) \ \forall C \in \mathcal { B } ( \mathbb { R } ^ { d } ) , } \end{array} \right.
91
+ $$
92
+
93
+ where $C _ { \lambda }$ is the truncated cost function defined as $C _ { \lambda } ( x , y ) = C ( x , y ) \wedge 2 \lambda$ . Looking at equation 2.4, it is not apparent that it adds robustness to MKE, but it is symmetric, easy to combine with entropic regularization by simply truncating the cost, and benefits from stochastic optimization algorithms (Genevay et al., 2016; Seguy et al., 2018). This formulation also has a distant relation to the idea of loss truncation for achieving robustness (Shen & Sanghavi, 2019). Pele & Werman (2009) considered the Earth Mover Distance (discrete OT) with truncated cost to achieve computational improvements; they also mentioned its potential to promote robustness against outlier noise but did not explore this direction.
94
+
95
+ In Section 3, we establish equivalence between the two ROBOT formulations, equation 2.2 and equation 2.4. This equivalence allows us to obtain an efficient algorithm based on equation 2.4 for robust MKE. We also provide a simple procedure for computing optimal $s$ in equation 2.2 from the solution of equation 2.4, enabling a new OT application: outlier detection. We verify the effectiveness of robust MKE and outlier detection in our experiments in Section 4. Before presenting the equivalence proof, we formulate the discrete analogs of the two ROBOT formulations for their practical value.
96
+
97
+ # 2.2 DISCRETE ROBOT FORMULATIONS
98
+
99
+ In practice we typically encounter samples from the distributions, rather then the distributions themselves. Sampling is also built into stochastic optimization. In this subsection, we present the discrete versions of the ROBOT formulations. The key detail is that, in equation 2.2, $\mu , \nu$ and $s$ are all supported on $\mathbb { R } ^ { d }$ , while in the discrete case the empirical measures $\mu _ { n } \in \Delta ^ { n - 1 }$ and $\nu _ { m } \in \Delta ^ { m \bar { - } 1 }$ are supported on a set of points ( $\Delta ^ { r }$ is the unit probability simplex in $\mathbb { R } ^ { r }$ ). As a result, to formulate a discrete version of equation 2.2, we need to augment $\mu _ { n }$ and $\nu _ { m }$ with each others’ supports. To be precise, let $\mathrm { s u p } \bar { \mathrm { p } } ( \mu _ { n } ) = \{ X _ { 1 } , \ldots , X _ { n } \}$ and $\operatorname { s u p p } ( \nu _ { m } ) = \{ Y _ { 1 } , . . . , Y _ { m } \}$ . Define $\mathcal { C } = \{ Z _ { 1 } , Z _ { 2 } , \ldots , Z _ { m + n } \} = \{ X _ { 1 } , \ldots , X _ { n } , Y _ { 1 } , \ldots , Y _ { m } \}$ . Then discrete analog of equation 2.2 is
100
+
101
+ # Formulation 1 (discrete):
102
+
103
+ $$
104
+ \begin{array} { r } { \mathbf { R O B O T } ( \mu _ { n } , \nu _ { m } ) = \left\{ \begin{array} { l l } { \operatorname* { m i n } _ { \Pi \in \mathbb { R } ^ { ( m + n ) \times ( m + n ) } } } & { \langle C _ { a u g } , \Pi \rangle + \lambda [ \| s _ { 1 } \| _ { 1 } + \| t _ { 1 } \| _ { 1 } ] } \\ { \mathrm { s t R } \mathrm { ~ e x t e } ^ { m + n } } & \\ { \mathrm { s u b j e c t ~ t o } } & { \Pi \mathrm { l } _ { m + n } = \left[ \begin{array} { l } { \mu _ { n } + s _ { 1 } } \\ { t _ { 1 } } \end{array} \right] , } & { \Pi ^ { \top } \mathrm { 1 } _ { m + n } = \left[ \begin{array} { l } { 0 } \\ { \nu _ { m } } \end{array} \right] } \\ & { \Pi \succeq 0 , ~ 1 _ { m + n } ^ { \top } \mathrm { s } = 0 , } \end{array} \right. } \end{array}
105
+ $$
106
+
107
+ where $C _ { a u g } \in \mathbb { R } ^ { ( m + n ) \times ( m + n ) }$ is the augmented cost function $C _ { a u g , i , j } = c ( Z _ { i } , Z _ { j } )$ ( $c$ is the ground cost, e.g., squared Euclidean distance), $\mathbf { s } = ( s _ { 1 } , t _ { 1 } )$ and $1 _ { r }$ is the vector all ones in $\mathbb { R } ^ { r }$ . The TV norm got replaced with its discrete analog, the $L _ { 1 }$ norm. Similarly to its continuous counterpart, the optimization problem is harder than the typical OT due to additional constraint optimization variable s and increased cost matrix size.
108
+
109
+ The discrete analog of equation 2.4 is straightforward:
110
+
111
+ # Formulation 2 (discrete):
112
+
113
+ $$
114
+ \mathrm { R O B O T } ( \mu _ { n } , \nu _ { m } ) = \left\{ \begin{array} { l l } { \operatorname* { m i n } _ { \Pi \in \mathbb { R } ^ { n \times m } } } & { \langle C _ { \lambda } , \Pi \rangle } \\ { \mathrm { s u b j e c t ~ t o } } & { \Pi 1 _ { n } = \mu _ { n } , \Pi ^ { \top } 1 _ { m } = \nu _ { m } , \Pi \succeq 0 , } \end{array} \right.
115
+ $$
116
+
117
+ where $C _ { \lambda , i , j } = c ( X _ { i } , Y _ { j } ) { \wedge } 2 { \lambda }$ . As in the continuous case, it is easy to adapt modern (regularized) OT solvers without any computational overhead. As in the continuous case, formulations of equation 2.5 and equation 2.6 are equivalent. It is also possible to recover s of equation 2.5 from the solution of equation 2.6 to perform outlier detection.
118
+
119
+ Two-sided formulation So far we have assumed that one of the input distributions does not have outliers, which is the setting of MKE, where the clean distribution corresponds to the model we learn. In some applications, both distributions may be corrupted. To address this case, we provide an equivalent two-sided formulation, analogous to UOT with TV norm:
120
+
121
+ # Formulation 3 (two-sided):
122
+
123
+ $$
124
+ \begin{array} { r } { \small \mathrm { 3 O B O T } ( \mu _ { n } , \nu _ { m } ) = \left\{ \begin{array} { l l } { \operatorname* { m i n } _ { \mathrm { \Pi } \in \mathbb { R } ^ { ( m + n ) \times ( m + n ) } } } & { \langle C _ { a u g } , \Pi \rangle + \lambda [ \| s _ { 1 } \| _ { 1 } + \| t _ { 1 } \| _ { 1 } + \| s _ { 2 } \| _ { 1 } + \| t _ { 2 } \| _ { 1 } ] } \\ { \mathrm { s } _ { 1 } \in \mathbb { R } ^ { m + n } , \mathrm { s } _ { 2 } \in \mathbb { R } ^ { m + n } } \\ { \mathrm { s u b j e c t ~ t o } } & { \Pi \mathrm { 1 } _ { m + n } = \left[ { \mu _ { n } + s _ { 1 } } \right] , \quad \Pi ^ { \top } \mathrm { 1 } _ { m + n } = \left[ { \nu _ { m } + t _ { 2 } } \right] } \\ & { \Pi \succeq 0 , \quad \Pi _ { m + n } ^ { \top } \mathrm { s } _ { 1 } = 0 , \quad \lambda _ { m + n } ^ { \top } \mathrm { s } _ { 2 } = 0 . } \end{array} \right. } \end{array}
125
+ $$
126
+
127
+ where $\mathbf { s } _ { 1 } = ( s _ { 1 } ^ { \top } , t _ { 1 } ^ { \top } ) ^ { \top }$ and $\mathbf { s } _ { 2 } = ( s _ { 2 } ^ { \top } , t _ { 2 } ^ { \top } ) ^ { \top }$ .
128
+
129
+ # 3 EQUIVALENCE OF THE ROBOT FORMULATIONS
130
+
131
+ In this section we present our main theorem, which demonstrates the equivalence between two formulations of the robust optimal transport:
132
+
133
+ Theorem 3.1. For any two measures $\mu$ and $\nu$ , $R O B O T ( \mu , \nu )$ has same value for both the formulations, i.e., Formulation 1 is equivalent to Formulation 2 both for continuous and discrete case. Moreover, we can recover optimal coupling of one formulation from the other.
134
+
135
+ Below we sketch the proof of this theorem and highlight some important techniques used in the proof. We focus on the discrete case as it is more intuitive and has concrete practical implications in our experiments. A complete proof can be found in Appendix A. Please also see Appendix A.2 for the proof of equivalence between Formulations 1, 2 and 3 in the discrete case.
136
+
137
+ # 3.1 PROOF SKETCH
138
+
139
+ In the remainder of this section we consider the discrete case, i.e., equation 2.5 for Formulation 1 (F1) and equation 2.6 for Formulation 2 (F2). Suppose $\Pi _ { 2 } ^ { * }$ is an optimal solution of F2. Then we construct a feasible solution $\Pi _ { 1 } ^ { * }$ , $\mathbf { s } _ { 1 } ^ { * } = ( s _ { 1 } ^ { * } , t _ { 1 } ^ { * } )$ of F1 based on $\Pi _ { 2 } ^ { * }$ with the same value of the objective function as F2 and claim that $( \Pi _ { 1 } ^ { * } , \mathbf { s } _ { 1 } ^ { * } )$ is an optimal solution. We prove the claim by contradiction: if $( \Pi _ { 1 } ^ { * } , \mathbf { s } _ { 1 } ^ { * } )$ is not optimal, then there exists another pair $( \tilde { \Pi } _ { 1 } , \tilde { \bf s } _ { 1 } )$ which is optimal for F1 with strictly 1 1less objective value. We then construct another feasible solution $\Pi _ { 2 , n e w } ^ { * }$ of Formulation 2 which has the same objective value as of $( \tilde { \Pi } _ { 1 } , \tilde { \bf s } _ { 1 } )$ for F1. This implies $\Pi _ { 2 , n e w } ^ { * }$ has strictly less objective value for F2 than $\Pi _ { 2 } ^ { * }$ , which is a contradiction.
140
+
141
+ The two main pillars of this proof are (1) to construct a feasible solution of F1 starting from a feasible solution of F2 and (2) to show that the solution constructed is indeed optimal for F1. Hence step (1) gives a recipe to construct an optimal solution of F1 starting from an optimal solution of F2. We elaborate the first point in the next subsection, which has practical implications for outlier detection. The other point is more technical; interested readers may go through the proof in Appendix A.1.
142
+
143
+ # Algorithm 1 Generating optimal solution of F1 from F2
144
+
145
+ 1: Start with $\Pi _ { 2 } ^ { * } \in \mathbb { R } ^ { n \times m }$ , an optimal solution of Formulation 2.
146
+ 2: Create an augmented matrix $\mathbf { \bar { I } } \mathbf { I } \in \mathbb { R } ^ { m + n \times m + n }$ with all 0. Divide $\Pi$ into four blocks:
147
+
148
+ $$
149
+ \Pi = \left[ \underbrace { \Pi _ { 1 1 } } _ { n \times n } \underbrace { \Pi _ { 1 2 } } _ { n \times m } \right]
150
+ $$
151
+
152
+ 3: Set $\Pi _ { 1 2 } \Pi _ { 2 } ^ { * }$ and collect all the indices $\mathcal { T } = \{ ( i , j ) : C _ { i , j } > 2 \lambda \}$ .
153
+ 4: Set $\Pi _ { 1 2 } ( i , j ) 0$ for $( i , j ) \in \mathcal { T }$ .
154
+ 5: Set $\begin{array} { r } { \Pi _ { 2 2 } ( j , j ) \sum _ { i = 1 } ^ { n } \Pi _ { 2 } ^ { * } ( i , j ) \mathtt { 1 } _ { ( i , j ) \in \mathcal { I } } } \end{array}$ for all $1 \leq j \leq m$ and set $\Pi _ { 1 } ^ { * } \Pi$ .
155
+ 6: Set $\begin{array} { r } { s _ { 1 } ^ { * } ( i ) \leq \sum _ { j = 1 } ^ { m } \Pi _ { 2 } ^ { * } ( i , j ) \mathbb { 1 } _ { ( i , j ) \in \mathcal { I } } } \end{array}$ for all $1 \leq i \leq n$ .
156
+ 7: Set $t _ { 1 } ^ { * } ( j ) = \Pi _ { 2 2 } ( j , j )$ for all $1 \leq j \leq m$ .
157
+ 8: return $\Pi _ { 1 } ^ { * } , s _ { 1 } ^ { * } , t _ { 1 } ^ { * }$ .
158
+
159
+ # 3.2 GOING FROM FORMULATION 2 TO FORMULATION 1
160
+
161
+ Let $\Pi _ { 2 } ^ { * }$ (respectively $\Pi _ { 1 } ^ { * }$ ) be an optimal solution of F2 (respectively F1). Recall that $\Pi _ { 1 } ^ { * }$ has dimension $( m + n ) \times ( m + n )$ . From the column sum constraint in F1, we need to take the first $n$ columns of $\Pi _ { 1 } ^ { * }$ to be exactly 0, whereas the last $m$ columns must sum up to $\nu _ { m }$ . For any matrix $A$ , we denote by $\mathbf { \bar { \xi } } A [ ( a : b ) \times ( c : d ) ]$ the submatrix consisting of rows from $a$ to $b$ and columns from $c$ to $d$ . Our main idea is to put a modified version of $\Pi _ { 2 } ^ { * }$ in $\bar { \Pi } _ { 1 } ^ { * } [ ( 1 : n ) \times ( n + 1 : m + n ) ]$ and make $\Pi _ { 1 } ^ { * } [ ( n + 1 : m + n ) \times ( n + 1 : m + n ) ]$ diagonal. First we describe how to modify $\Pi _ { 2 } ^ { * }$ . Observe that, if for some $\left( i , j \right) C _ { i , j } > 2 \lambda$ , we expect $X _ { i } \in \mathrm { s u p p } ( \mu _ { n } )$ to be an outlier resulting in high transportation cost, which is why we truncate the cost in F2. Therefore, to get an optimal solution of F1, we make the corresponding value of optimal plan 0 and dump the mass into the corresponding slack variable $t _ { 1 } ^ { * }$ in the diagonal of the bottom right submatrix. This changes the row sum, which is taken care of by $s _ { 1 } ^ { * }$ . But, as we are not moving this mass outside the corresponding column, the column sum of $\bar { \Pi } _ { 1 } ^ { * } [ ( \bar { 1 } : ( m + n ) ) : ( ( n + 1 ) : \bar { ( m + n ) } ) ]$ remains same as column sum of $\Pi _ { 2 } ^ { * }$ , which is $\nu _ { n }$ . We summarize this procedure in Algorithm 1.
162
+
163
+ ![](images/c63186a4c907aef0f031f3b9da4ca9b1bb1c94a15e2c5ec83f796a52810ed728.jpg)
164
+ Figure 1: Constructing optimal solution of Formulation 1 from optimal solution of Formulation 2.
165
+
166
+ Example. In Figure 1, we provide an example to visualize the construction. On the left, we have $\Pi _ { 2 } ^ { * }$ , an optimal solution of Formulation 2. The blue triangles denote the positions where the corresponding cost value is $\leq 2 \lambda$ , and light-green squares denote the positions where the corresponding value of the cost matrix is $> 2 \lambda$ . To construct an optimal solution $\Pi _ { 1 } ^ { * }$ of Formulation 1 from this $\Pi _ { 2 } ^ { * }$ , we first create an augmented matrix of size $6 \times 6$ . We keep all the entries of of left $6 \times 3$ sub-matrix as 0 (in this picture blank elements indicate 0). On the right submatrix, we put $\Pi _ { 2 } ^ { * }$ into the top-right block, but remove the masses from light-green squares, i.e. where cost value is $> 2 \lambda$ , and put it in the diagonal entries of the bottom right block as shown in Figure 1. This mass contributes to the slack variables $s _ { 1 }$ and $t _ { 1 }$ , and this augmented matrix along with $s _ { 1 } , t _ { 1 }$ give us an optimal solution of Formulation 1.
167
+
168
+ # 3.3 OUTLIER DETECTION WITH ROBOT
169
+
170
+ Our construction algorithm has practical consequences for outlier detection. Suppose we have two datasets, a clean dataset $\nu _ { m }$ (i.e., has no outliers) and an outlier-contaminated dataset $\mu _ { n }$ . We can detect the outliers in $\mu _ { n }$ without directly solving costly Formulation 1 by following Algorithm 2. In this algorithm, $\lambda$ is a regularization parameter that can be chosen via cross-validation or heuristically (see Section 4.2 for an example). In Section 4.2, we use this algorithm to perform outlier detection on image data.
171
+
172
+ # Algorithm 2 Outlier detection in contaminated data
173
+
174
+ <table><tr><td>Algorithm2 Outlierdetectionincontaminateddata</td></tr><tr><td>1: Start with μn (contaminted data) and Vm (clean data).</td></tr><tr><td>2:Solve Formulation 2 and obtain II* using a suitable value of 入.</td></tr><tr><td>3: Use Algorithm 1 to obtain II*,s*,t* from II*.</td></tr><tr><td>4: Find I,the set of all the indices where μn + s* = 0.</td></tr><tr><td> 5: Return I as the indices of outliers in μn·</td></tr></table>
175
+
176
+ Table 1: Robust mean estimation with GANs using different distribution divergences. True mean is $\eta _ { 0 } = \mathbf { 0 } _ { 5 }$ ; sample size $n = 1 0 0 0$ ; contamination proportion $\epsilon = 0 . 2$ . We report results over 30 experiment restarts.
177
+
178
+ <table><tr><td>Contamination</td><td> JS Loss</td><td>SH Loss</td><td>RKL Loss</td><td>ROBOT</td><td>UOT</td></tr><tr><td>N(0.1·15, I5)</td><td>0.09 ± 0.03</td><td>0.11 ± 0.03</td><td>0.115±0.03</td><td>0.1 ± 0.03</td><td>0.1 ± 0.04</td></tr><tr><td>N(0.5·15,I5)</td><td>0.23 ± 0.04</td><td>0.24 ± 0.05</td><td>0.24 ± 0.05</td><td>0.117±0.03</td><td>0.2 ± 0.04</td></tr><tr><td>N(1·15,I5)</td><td>0.43 ± 0.05</td><td>0.43 ± 0.06</td><td>0.43±0.06</td><td>0.261±0.06</td><td>0.25 ± 0.05</td></tr><tr><td>N(2·15,15)</td><td>0.67 ± 0.07</td><td>0.67 ± 0.08</td><td>0.67 ± 0.08</td><td>0.106 ± 0.03</td><td>0.1 ± 0.03</td></tr></table>
179
+
180
+ ![](images/26b94f3699d1eb10d32fe9f34ceece19a417b4f2e5c261479ed85d987c42dc22.jpg)
181
+ Figure 2: Empirical study of regularization hyperparameter $\lambda$ sensitivity
182
+
183
+ # 4 EMPIRICAL STUDIES
184
+
185
+ To evaluate effectiveness of ROBOT, we consider the task of robust mean estimation under the Huber contamination model. The data is generated from $( 1 - \epsilon ) \mathcal { N } ( \eta _ { 0 } , I _ { d } ) + \epsilon \mathcal { N } ( \eta _ { 1 } , I _ { d } )$ and the goal is to estimate $\eta _ { 0 }$ . Prior work has advocated for using $f$ -divergence GANs (Chao et al., 2018; Wu et al., 2020) for this problem and pointed out inefficiencies of Wasserstein GAN in the presence of outliers. We show that our robust OT formulation allows us to estimate the uncontaminated mean $\eta _ { 0 }$ comparably or better than a variety of $f$ -divergence GANs. We also use this simulated setup to study sensitivity to the regularization hyperparameter $\lambda$ .
186
+
187
+ In our second experiment, we present a new application of optimal transport enabled by ROBOT. Suppose we have collected a curated dataset $\nu _ { m }$ (i.e., we know that it has no outliers)—such data collection is expensive, and we want to benefit from it to automate subsequent data collection. Let $\mu _ { n }$ be a second dataset collected “in the wild,” i.e., it may or may not have outliers. We demonstrate how ROBOT can be used to identify outliers in $\mu _ { n }$ using the curated dataset $\nu _ { m }$ .
188
+
189
+ # 4.1 ROBUST MEAN ESTIMATION
190
+
191
+ Following Wu et al. (2020), we consider a simple generator of the form $g _ { \theta } ( x ) = x + \theta ,$ $x \sim$ $\mathcal { N } ( 0 , I _ { d } )$ , $d$ is the data dimension. The basic idea of robust mean estimation with GANs is to minimize various distributional divergences between samples from $g _ { \theta }$ and observed data simulated from $( 1 - \epsilon ) \mathcal { N } ( \eta _ { 0 } , I _ { d } ) + \epsilon \mathcal { N } ( \eta _ { 1 } , I _ { d } )$ . The goal is to estimate $\eta _ { 0 }$ with $\theta$ . To efficiently implement ROBOT GAN, we use a standard min-max optimization approach: solve the inner max (ROBOT) and use gradient descent for the outer min parameter. To solve ROBOT, it is straightforward to adopt any of the prior stochastic regularized OT solvers: the only modification is the truncation of the cost entries as in equation 2.6. We use the stochastic algorithm for semi-discrete regularized OT from (Genevay et al., 2016, Algorithm 2). We summarize ROBOT GAN in Algorithm 3. Line 5 - Line 10 perform the inner optimization where we solve entropy regularized OT dual with truncated cost and Line 11 - Line 12 perform gradient update of $\theta$ .
192
+
193
+ # Algorithm 3 ROBOT GAN
194
+
195
+ 1: Input: robustness regularizion $\lambda$ , entropic regularization $\alpha$ , data distribution $\mu _ { n } \in \Delta ^ { n - 1 }$ ,
196
+ $s u p p ( \mu _ { n } ) = \mathcal { X } = [ X _ { 1 } , \ldots , X _ { n } ]$ , steps sizes $\tau$ and $\gamma$
197
+ 2: Initialize: Initialize $\theta = \theta _ { i n i t }$ , set number of iterations $M$ and $L$ , $i = 0$ , ${ \bf v } = \tilde { \bf v } = { \bf 0 }$ .
198
+ 3: for $j = 1 , \dots , M$ do
199
+ 4: Generate $\tilde { z } \sim \mathcal { N } ( 0 , I _ { d } )$ and set $z = \tilde { z } + \theta$ .
200
+ 5: Set the cost vector $\mathbf { c } \in \mathbb { R } ^ { n }$ as $\mathbf { c } ( k ) = c ( X _ { k } , z ) \wedge 2 \lambda$ for $k = 1 , \dots , n$ .
201
+ 6: for $i = 1 , \ldots , L$ do $\triangleright$ solve entropy regularized OT dual
202
+ 7: Set $\mathbf { h } { \frac { \tilde { \mathbf { v } } - \mathbf { c } } { \alpha } }$ and do the normalized exponential transformation $\mathbf { \bar { u } } \gets \frac { e ^ { \mathbf { h } } } { \langle \mathbf { 1 } , e ^ { \mathbf { h } } \rangle }$ .
203
+ 8: Calculate the gradient $\nabla \tilde { \mathbf { v } } \mu _ { n } - \mathbf { u }$ .
204
+ 9: Update $\tilde { \mathbf { v } } \tilde { \mathbf { v } } + \gamma \nabla \tilde { \mathbf { v } }$ and $\mathbf { v } ( 1 / ( j + i ) ) \tilde { \mathbf { v } } + ( j + i - 1 / ( j + i ) ) \mathbf { v } .$ .
205
+ 10: Do the same transformation of $\mathbf { v }$ as in Step 7, i.e. set $\mathbf { h } { \frac { \mathbf { v } - \mathbf { c } } { \alpha } }$ and set $\begin{array} { r } { \bar { \Pi } \frac { e ^ { \mathbf { h } } } { \langle \mathbf { 1 } , e ^ { \mathbf { h } } \rangle } } \end{array}$ .
206
+ 11: Set $\Pi ( k ) = 0$ for $k$ such that $C ( X _ { k } , z ) > 2 \lambda$ for $k = 1 , \dots , n$ .
207
+ 12: Calculate gradient with respect to $\theta$ as $\begin{array} { r } { \nabla \theta = 2 \left[ z \sum _ { k } \Pi ( k ) - \mathcal { X } ^ { \top } \Pi \right] } \end{array}$
208
+ 13: Update $\theta \theta - \tau \nabla \theta$ .
209
+
210
+ 14: Ouput: $\theta$
211
+
212
+ For the $f$ -divergence GANs (Nowozin et al., 2016) we use the code of Wu et al. (2020) for GANs with Jensen-Shannon (JS) loss, squared Hellinger (SH) loss and Reverse Kullback-Leibler (RKL) loss. For the exact expression of these divergences see Table 1 of $\mathbf { W } \mathbf { u }$ et al. (2020). We report estimation error measured by the Euclidean distance between true uncontaminated mean $\eta _ { 0 }$ and estimated mean $\theta$ for various contamination distributions in Table 1. ROBOT GAN performs well across all considered contamination distributions. As the difference between true mean $\eta _ { 0 }$ and contamination mean $\eta _ { 1 }$ increases, the estimation error of all methods tends to increase. However, when it becomes easier to distinguish outliers from clean samples, i.e., $\eta _ { 1 } = 2 \cdot { \bf 1 _ { 5 } }$ , performance of ROBOT noticeably improves.
213
+
214
+ We also compared to the Sinkhorn-based UOT algorithm (Chizat et al., 2018) available in the Python Optimal Transport (POT) library (Flamary & Courty, 2017); to obtain a UOT GAN, we modified steps 5-11 of Algorithm 3 for computing Π. Unsurprisingly, both ROBOT and UOT perform similarly: recall equivalence to Formulation 3, which is similar to UOT with TV norm. The key insight of our work is the equivalence to classical OT with truncated cost, that greatly simplifies optimization and allows to use existing stochastic OT algorithms. In this experiment, the sample size $n = 1 0 0 0$ is sufficiently small for the Sinkhorn-based UOT POT implementation to be effective, but it breaks in the experiment we present in Section 4.2. We also tried the code of Balaji et al. (2020) based on CVXPY (Diamond & Boyd, 2016), but it is too slow even for the $n = 1 0 0 0$ sample size.
215
+
216
+ In the previous experiment, we set $\lambda = 0 . 5$ . Now we demonstrate empirically that there is a broad range of $\lambda$ values performing well. In Figure 2a, we study sensitivity of $\lambda$ under various contamination proportions $\epsilon$ holding $\eta _ { 0 } = \mathbf { 1 } _ { 5 }$ and $\eta _ { 1 } = 5 \cdot { \bf 1 } _ { 5 }$ fixed. Horizontal lines correspond to $\lambda = \infty$ , i.e., vanilla OT. The key observations are: there is a wide range of $\lambda$ efficient at all contamination proportions, and ROBOT is always at least as good as vanilla OT (even when there is no contamination $\epsilon = 0$ ). In Figure 2b, we present a similar study varying the mean of the contamination distribution and holding $\epsilon = 0 . 2$ fixed. We see that as the contamination distribution gets closer to the true distribution, it becomes harder to pick a good $\lambda$ , but the performance is always at least as good as the vanilla OT (horizontal lines).
217
+
218
+ # 4.2 OUTLIER DETECTION FOR DATA COLLECTION
219
+
220
+ Our robust OT formulation equation 2.5 enables outlier identification. Let $\nu _ { m }$ be a clean dataset and $\mu _ { n }$ potentially contaminated with outliers. Recall that ROBOT allows modification of one of the input distributions to eliminate potential outliers. We can identify outliers in $\mu _ { n }$ as follows: if $\mu _ { n } ( i ) \mathbf { \bar { + } } s _ { 1 } ^ { * } ( i ) = 0$ , then $X _ { i }$ , the $i$ th point in $\mu _ { n }$ , is an outlier. Instead of directly solving equation 2.5, which may be inefficient, we use our equivalence results and solve an easier optimization problem equation 2.6, followed by recovering s to find outliers via Algorithm 2.
221
+
222
+ ![](images/d2f240dabc86fe45b9a765fa087cbe4853c08a2ee161d10c811ab2f710a11a5a.jpg)
223
+ Figure 3: Random sample of outliers detected by ROBOT from a dataset of MNIST digits contaminated with Fashion MNIST images.
224
+
225
+ Let $\nu _ { m }$ be a clean dataset consisting of 10k MNIST digits and $\mu _ { n }$ be a dataset collected “in the wild” consisting of (different) 8k MNIST digits and 2k Fashion MNIST images. We compute $\mathrm { R O B O T } ( \mu _ { n } , \nu _ { m } )$ to identify outlier Fashion MNIST images in $\mu _ { n }$ . For each point in $\mu _ { n }$ we obtain a prediction, outlier or clean, which allows us to evaluate accuracy. ROBOT outlier detection is $90 \%$ accurate in this experiment. We also comment on $\lambda$ selection: since we know that $\nu _ { m }$ is clean, we can subsample two datasets from it, compute vanilla OT to obtain transportation plan $\Pi$ and set $\lambda$ to be half the maximum distance between matched elements, i.e. $2 \lambda = \mathrm { \bar { m a x } } _ { i , j } \{ C _ { i j } ^ { - } : \Pi _ { i j } > 0 \}$ , where $C$ is the cost matrix for the two subsampled datasets. This procedure is essentially estimating maximum distance between matched clean samples. We also present a random sample of outliers identified by our method in Figure 3. All of the sampled outliers are Fashion MNIST images, although $90 \%$ accuracy suggests that some of the outliers were not identified. Decreasing $\lambda$ can help to find more outliers, but may result in some clean samples being mistaken for outliers. We conclude that ROBOT can be used to assist in data collection once an initial set of clean data has been acquired. As we mentioned previously, the Sinkhorn-based UOT POT implementation is too expensive for this experiment due to larger sample size, yielding memory errors on a personal laptop with 16GB RAM.
226
+
227
+ For comparison, we also consider a heuristic distance-based approach for identifying outliers. We estimate diameter $\tau$ of the set of clean dataset $\nu _ { m }$ by taking the 99th percentile of the pairwise distance matrix of samples in $\nu _ { m }$ . If outliers and clean data have disjoint support, we can adopt a simple heuristic: for each sample in the potentially contaminated $\mu _ { n }$ compute an average distance to the clean samples in $\nu _ { m }$ and declare a sample as an outlier if this average distance is greater than the diameter $\tau$ of the clean data. The accuracy of this procedure is $8 5 . 4 \%$ , inferior to the ROBOT accuracy of $90 \%$ . The disjoint support assumption justifying the distance-based heuristic might be too strong in practice. ROBOT continues to be effective even when the supports of clean and outlier distributions are not easily separable.
228
+
229
+ # 5 SUMMARY AND DISCUSSION
230
+
231
+ We proposed and studied ROBOT, a robust formulation of optimal transport. We showed that although the problem is seemingly asymmetric and challenging to optimize, there is an equivalent formulation based on cost truncation that is symmetric and compatible with modern stochastic optimization methods for OT.
232
+
233
+ ROBOT closely resembles unbalanced optimal transport (UOT). In our formulation, we added a TV regularizer to the vanilla optimal transport problem. This is motivated by the $\epsilon$ -contamination model. In UOT, the TV regularizer is typically replaced with a KL divergence. Other choices of the regularizer may lead to new properties and applications. Studying equivalent, simpler formulations of UOT with different divergences may be a fruitful future work direction.
234
+
235
+ From the practical perspective, in our experiments we observed no degradation of ROBOT GAN in comparison to OT GAN, even when there were no outliers. It is possible that replacing OT with ROBOT may be beneficial for various machine learning applications of OT. Data encountered in practice may not be explicitly contaminated with outliers, but it often has errors and other deficiencies, suggesting that a “no-harm” robustness is desirable.
236
+
237
+ # REFERENCES
238
+
239
+ David Alvarez-Melis and Tommi S Jaakkola. Gromov-Wasserstein alignment of word embedding spaces. arXiv:1809.00013, 2018.
240
+
241
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein GAN. ´ arXiv:1701.07875 [cs, stat], January 2017.
242
+
243
+ Yogesh Balaji, Rama Chellappa, and Soheil Feizi. Robust optimal transport with applications in generative modeling and domain adaptation. Advances in Neural Information Processing Systems, 33, 2020.
244
+
245
+ Federico Bassetti, Antonella Bodini, and Eugenio Regazzini. On minimum Kantorovich distance estimators. Statistics & Probability Letters, 76(12):1298–1302, 2006.
246
+
247
+ Luis A Caffarelli and Robert J McCann. Free boundaries in optimal transport and Monge-Ampere obstacle problems. Annals of Mathematics, pp. 673–730, 2010.
248
+
249
+ Gao Chao, Yao Yuan, and Zhu Weizhi. Robust estimation via generative adversarial networks. In International Conference on Learning Representations, 2018.
250
+
251
+ Lenaic Chizat, Gabriel Peyre, Bernhard Schmitzer, and Franc¸ois-Xavier Vialard. Scaling algorithms ´ for unbalanced optimal transport problems. Mathematics of Computation, 87(314):2563–2609, 2018.
252
+
253
+ Lena¨ıc Chizat. Unbalanced optimal transport: Models, numerical methods, applications. Numerical Analysis [math.NA]. Universite Paris sciences et lettres ´ , 2017.
254
+
255
+ Nicolas Courty, Remi Flamary, and Devis Tuia. Domain adaptation with regularized optimal´ transport. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 274–289. Springer, 2014.
256
+
257
+ Nicolas Courty, Remi Flamary, Amaury Habrard, and Alain Rakotomamonjy. Joint distribution ´ optimal transportation for domain adaptation. In Advances in Neural Information Processing Systems, pp. 3730–3739, 2017.
258
+
259
+ Marco Cuturi. Sinkhorn Distances: Lightspeed Computation of Optimal Transport. In C. J. C. Burges, L. Bottou, M. Welling, Z. Ghahramani, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 26, pp. 2292–2300. Curran Associates, Inc., 2013.
260
+
261
+ Steven Diamond and Stephen Boyd. CVXPY: A Python-embedded modeling language for convex optimization. Journal of Machine Learning Research, 17(83):1–5, 2016.
262
+
263
+ Alessio Figalli. The optimal partial transport problem. Archive for Rational Mechanics and Analysis, 195(2):533–560, 2010.
264
+
265
+ Remi Flamary and Nicolas Courty. POT Python optimal transport library, 2017. URL ´ https: //pythonot.github.io/.
266
+
267
+ Aude Genevay, Marco Cuturi, Gabriel Peyre, and Francis Bach. Stochastic optimization for large- ´ scale optimal transport. In Advances in Neural Information Processing Systems, pp. 3440–3448, 2016.
268
+
269
+ Nhat Ho, XuanLong Nguyen, Mikhail Yurochkin, Hung Hai Bui, Viet Huynh, and Dinh Phung. Multilevel clustering via Wasserstein means. In International Conference on Machine Learning, pp. 1501–1509, 2017.
270
+
271
+ Gao Huang, Chuan Guo, Matt J Kusner, Yu Sun, Fei Sha, and Kilian Q Weinberger. Supervised word mover’s distance. In Advances in Neural Information Processing Systems, pp. 4862–4870, 2016.
272
+
273
+ Peter J. Huber and Elvezio Ronchetti. Robust Statistics. Wiley Series in Probability and Statistics. Wiley, Hoboken, N.J, 2nd ed edition, 2009. ISBN 978-0-470-12990-6.
274
+
275
+ Leonid Vitalievich Kantorovich. On the translocation of masses. In Dokl. Akad. Nauk. USSR (NS), volume 37, pp. 199–201, 1942.
276
+
277
+ Matt Kusner, Yu Sun, Nicholas Kolkin, and Kilian Weinberger. From Word Embeddings To Document Distances. In International Conference on Machine Learning, pp. 957–966, June 2015.
278
+
279
+ Matthias Liero, Alexander Mielke, and Giuseppe Savare. Optimal entropy-transport problems and a ´ new Hellinger–Kantorovich distance between positive measures. Inventiones Mathematicae, 211 (3):969–1117, 2018.
280
+
281
+ Gaspard Monge. Memoire sur la th ´ eorie des d ´ eblais et des remblais ´ . De l’Imprimerie Royale, 1781.
282
+
283
+ 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.
284
+
285
+ Ofir Pele and Michael Werman. Fast and robust earth mover’s distances. In 2009 IEEE 12th International Conference on Computer Vision, pp. 460–467. IEEE, 2009.
286
+
287
+ Gabriel Peyre and Marco Cuturi. Computational Optimal Transport. ´ arXiv:1803.00567 [stat], March 2018.
288
+
289
+ Benedetto Piccoli and Francesco Rossi. Generalized Wasserstein distance and its application to transport equations with source. Archive for Rational Mechanics and Analysis, 211(1):335–358, 2014.
290
+
291
+ Vivien Seguy, Bharath Bhushan Damodaran, Remi Flamary, Nicolas Courty, Antoine Rolet, and ´ Mathieu Blondel. Large-Scale Optimal Transport and Mapping Estimation. arXiv:1711.02283 [stat], February 2018.
292
+
293
+ Yanyao Shen and Sujay Sanghavi. Learning with bad training data via iterative trimmed loss minimization. In International Conference on Machine Learning, pp. 5739–5748. PMLR, 2019.
294
+
295
+ Justin Solomon, Fernando De Goes, Gabriel Peyre, Marco Cuturi, Adrian Butscher, Andy Nguyen, ´ Tao Du, and Leonidas Guibas. Convolutional Wasserstein distances: Efficient optimal transportation on geometric domains. ACM Transactions on Graphics (TOG), 34(4):1–11, 2015.
296
+
297
+ Sanvesh Srivastava, Cheng Li, and David B. Dunson. Scalable Bayes via Barycenter in Wasserstein Space. arXiv:1508.05880 [stat], June 2018.
298
+
299
+ Guillaume Staerman, Pierre Laforgue, Pavlo Mozharovskyi, and Florence d’Alche Buc. When OT´ meets MOM: Robust estimation of Wasserstein distance. arXiv:2006.10325, 2020.
300
+
301
+ C. Villani. Optimal Transport: Old and New. Grundlehren der Mathematischen Wissenschaften [Fundamental Principles of Mathemtical Sciences]. Springer, Berlin, 2009.
302
+
303
+ Kaiwen Wu, Gavin Weiguang Ding, Ruitong Huang, and Yaoliang Yu. On Minimax Optimality of GANs for Robust Mean Estimation. In International Conference on Artificial Intelligence and Statistics, pp. 4541–4551, June 2020.
304
+
305
+ Mikhail Yurochkin, Sebastian Claici, Edward Chien, Farzaneh Mirzazadeh, and Justin Solomon. Hierarchical Optimal Transport for Document Representation. arXiv:1906.10827 [cs, stat], June 2019.
306
+
307
+ # A PROOF OF THEOREM 3.1
308
+
309
+ A.1 PROOF OF DISCRETE VERSION
310
+
311
+ Proof. Define a matrix $\Pi$ as:
312
+
313
+ $$
314
+ \Pi ( i , j ) = { \left\{ \begin{array} { l l } { 0 , } & { { \mathrm { i f ~ } } C ( i , j ) > 2 \lambda } \\ { \Pi _ { 2 } ^ { * } ( i , j ) , } & { { \mathrm { o t h e r w i s e } } } \end{array} \right. }
315
+ $$
316
+
317
+ Also define $s \in \mathbb { R } ^ { n }$ and $t \in \mathbb { R } ^ { m }$ as:
318
+
319
+ $$
320
+ s _ { 1 } ^ { * } ( i ) = - \sum _ { j = 1 } ^ { m } \Pi _ { 2 } ^ { * } ( i , j ) \mathbb { 1 } _ { C ( i , j ) > 2 \lambda }
321
+ $$
322
+
323
+ and similarly define:
324
+
325
+ $$
326
+ t _ { 1 } ^ { * } ( j ) = \sum _ { i = 1 } ^ { n } \Pi _ { 2 } ^ { * } ( i , j ) \mathbb { 1 } _ { C ( i , j ) > 2 \lambda }
327
+ $$
328
+
329
+ These vectors corresponds to the row sums and the column sums of the elements of the optimal transport plan of Formulation 2, where the cost function exceeds $2 \lambda$ . Note that, these co-ordinates of the optimal transport plan corresponding to those co-ordinates of cost matrix, where the cost is greater than $2 \lambda$ and contribute to the objective value via their sum only, hence any different arrangement of these transition probabilities with same sum gives the same objective value.
330
+
331
+ Now based on this $\Pi$ obtained we construct a feasible solution of Formulation 1 following Algorithm 1:
332
+
333
+ $$
334
+ \Pi _ { 1 } ^ { * } = \left[ \mathbf { 0 } \atop \mathbf { 0 } \quad \mathbf { d i a g } ( t _ { 1 } ^ { * } ) \right]
335
+ $$
336
+
337
+ The row sums of $\Pi _ { 1 } ^ { * }$ is:
338
+
339
+ $$
340
+ \Pi _ { 1 } ^ { * } \mathbf { 1 } = \left[ { \mu _ { n } + s _ { 1 } ^ { * } } \right]
341
+ $$
342
+
343
+ and it is immediate from the construction that the column sums of $\Pi _ { 1 } ^ { * }$ is $\nu _ { m }$ . Also as:
344
+
345
+ $$
346
+ \sum _ { i = 1 } ^ { n } s _ { 1 } ^ { * } ( i ) = \sum _ { j = 1 } ^ { m } t _ { 1 } ^ { * } ( j ) = \sum _ { ( i , j ) : C _ { i , j } > 2 \lambda } \Pi _ { 2 } ^ { * } ( i , j ) \nonumber
347
+ $$
348
+
349
+ and $s _ { 1 } ^ { * } \preceq 0 , t _ { 1 } ^ { * } \succeq 0$ , we have:
350
+
351
+ $$
352
+ \mathbf { 1 } ^ { \top } ( \mu _ { n } + s _ { 1 } ^ { * } + t _ { 1 } ^ { * } ) = \mathbf { 1 } ^ { \top } p = 1 .
353
+ $$
354
+
355
+ Therefore, we have $( \Pi _ { 1 } ^ { * } , s _ { 1 } ^ { * } , t _ { 1 } ^ { * } )$ is a feasible solution of Formulation 1. Now suppose this is not an optimal solution. Pick an optimal solution $\tilde { \Pi } , \tilde { s } , \tilde { t }$ of Formulation 1 so that:
356
+
357
+ $$
358
+ \langle C _ { a u g } , \tilde { \Pi } \rangle + \lambda \left[ \lVert \tilde { s } \rVert _ { 1 } + \lVert \tilde { t } \rVert _ { 1 } \right] < \langle C _ { a u g } , \Pi _ { 1 } ^ { * } \rangle + \lambda \left[ \lVert s _ { 1 } ^ { * } \rVert _ { 1 } + \lVert t _ { 1 } ^ { * } \rVert _ { 1 } \right]
359
+ $$
360
+
361
+ The following two lemmas provide some structural properties of any optimal solution of Formulation 1:
362
+
363
+ Lemma A.1. Suppose $\Pi _ { 1 } ^ { * } , s _ { 1 } ^ { * } , t _ { 1 } ^ { * }$ are optimal solution for Formulation $^ { l }$ . Divide $\Pi _ { 1 } ^ { * }$ into four parts corresponding to augmentation as in algorithm $I$ :
364
+
365
+ $$
366
+ \Pi _ { 1 } ^ { * } = \left[ \begin{array} { c c } { { \Pi _ { 1 , 1 1 } ^ { * } } } & { { \Pi _ { 1 , 1 2 } ^ { * } } } \\ { { \Pi _ { 1 , 2 1 } ^ { * } } } & { { \Pi _ { 1 , 2 2 } ^ { * } } } \end{array} \right]
367
+ $$
368
+
369
+ Then we have $\Pi _ { 1 , 1 1 } ^ { * } = \Pi _ { 1 , 2 1 } ^ { * } = \mathbf { 0 }$ and $\Pi _ { 1 , 2 2 } ^ { * }$ is a diagonal matrix.
370
+
371
+ Lemma A.2. $H \Pi _ { 1 } ^ { * } , s _ { 1 } ^ { * } , t _ { 1 } ^ { * }$ is an optimal solution of Formulation $^ { l }$ then:
372
+
373
+ 1. If $C _ { i , j } > 2 \lambda$ then $\Pi _ { 1 } ^ { * } ( i , j ) = 0$ .
374
+ 2. If $C _ { i , j } < 2 \lambda$ for some i and for all $1 \leq j \leq n$ , then $s _ { 1 } ^ { * } ( i ) = 0$ .
375
+ 3. If $C _ { i , j } < 2 \lambda$ for some $j$ and for all $1 \leq i \leq m$ , then $t _ { 1 } ^ { * } ( j ) = 0$
376
+ 4. If $C _ { i , j } < 2 \lambda$ then $s _ { 1 } ^ { * } ( i ) t _ { 1 } ^ { * } ( j ) = 0$ .
377
+
378
+ We provide the proofs in the next subsection. By Lemma A.1 we can assume without loss of generality:
379
+
380
+ $$
381
+ \tilde { \Pi } = \left[ \begin{array} { c c } { \mathbf { 0 } } & { \tilde { \Pi } _ { 1 2 } } \\ { \mathbf { 0 } } & { \mathsf { d i a g } ( \tilde { t } ) } \end{array} \right]
382
+ $$
383
+
384
+ Now based on $\Big ( \tilde { \Pi } , \tilde { s } , \tilde { t } \Big )$ we create a feasible solution namely $\Pi _ { 2 , n e w } ^ { * }$ of Formulation 2 as follows: Define the set of indices $\{ i _ { 1 } , \cdots , i _ { k } \}$ and $\{ j _ { 1 } , \ldots , j _ { l } \}$ as:
385
+
386
+ $$
387
+ \begin{array} { r } { \tilde { s } _ { i _ { 1 } } , \tilde { s } _ { i _ { 2 } } , \ldots , \tilde { s } _ { i _ { k } } > 0 \quad \mathrm { a n d } \quad \tilde { t } _ { j _ { 1 } } , \tilde { t } _ { j _ { 2 } } , \ldots , \tilde { t } _ { j _ { l } } > 0 . } \end{array}
388
+ $$
389
+
390
+ Then by part (4) of Lemma A.2 we have $C _ { i _ { \alpha } , j _ { \beta } } > 2 \lambda$ for $\alpha \in \{ 1 , \ldots , k \}$ and $\beta \in \{ 1 , \ldots , l \}$ . Also by part (2) of Lemma A.2 the value of transport plan at these co-ordinates is 0. Now distribute the mass of slack variables in these co-ordinates such that the marginals of new transport plan becomes exactly $\mu _ { n }$ and $\nu _ { m }$ . This new transport plan is our $\Pi _ { 2 , n e w } ^ { * }$ . Recall that, $\| \tilde { s } \| _ { 1 } = \widetilde { \| \dot { t } \| _ { 1 } }$ . Hence, here the regularizer value decreases by $2 \lambda \| \tilde { s } \| _ { 1 }$ and the cost value increased by exactly $2 \lambda \| \tilde { s } \| _ { 1 }$ as we are truncating the cost. Hence we have:
391
+
392
+ $$
393
+ \begin{array} { r l } & { \langle C _ { \lambda } , \Pi _ { 2 , n e w } ^ { * } \rangle = \langle C _ { a u g } , \tilde { \Pi } \rangle + \lambda \left[ \Vert \tilde { s } \Vert _ { 1 } + \Vert \tilde { t } \Vert _ { 1 } \right] } \\ & { \qquad < \langle C _ { a u g } , \Pi _ { 1 } ^ { * } \rangle + \lambda \left[ \Vert s _ { 1 } ^ { * } \Vert _ { 1 } + \Vert t _ { 1 } ^ { * } \Vert _ { 1 } \right] } \\ & { \qquad = \langle C _ { \lambda } , \Pi _ { 2 } ^ { * } \rangle } \end{array}
394
+ $$
395
+
396
+ which is contradiction as $\Pi _ { 2 } ^ { * }$ is the optimal solution of Formulation 2. This completes the proof for the discrete part.
397
+
398
+ # A.2 PROOF OF EQUIVALENCE FOR TWO SIDED FORMULATION
399
+
400
+ Here we prove that our two sided formulation, i.e. Formulation 3 (equation 2.7) is equivalent to Formulation 1 (equation 2.5) for the discrete case. Towards that end, we introduce another auxiliary formulation and show that both Formulation 1 and Formulation 3 are equivalent to the following auxiliary formulation of the problem.
401
+
402
+ # Formulation 4:
403
+
404
+ $$
405
+ W _ { \mathbf { R } , \mathbf { L } , 4 } ( p , q ) = \left\{ \begin{array} { l l } { \operatorname* { m i n } _ { \Pi \in \mathbb { R } ^ { m \times n } , s _ { 1 } \in \mathbb { R } ^ { m } , s _ { 2 } \in \mathbb { R } ^ { n } } } & { \langle C , \Pi \rangle + \lambda [ \| s _ { 1 } \| _ { 1 } + \| s _ { 2 } \| _ { 1 } ] } \\ { \mathrm { s u b j e c t ~ t o } } & { \Pi 1 _ { n } = p + s _ { 1 } } \\ & { \Pi ^ { T } 1 _ { m } = q + s _ { 2 } } \\ & { \Pi \succeq 0 } \end{array} \right.
406
+ $$
407
+
408
+ First we show that Formulation 1 and Formulation 4 are equivalent in a sense that they have the same optimal objective value.
409
+
410
+ Theorem A.3. Suppose $C$ is a cost function such that $C ( x , x ) = 0$ . Then Formulation $^ { l }$ and Formulation $^ { 4 }$ has same optimal objective value.
411
+
412
+ Proof. Towards that end, we show that given one optimal variables of one formulation we can get optimal variables of other formulation with the same objective value. Before going into details we need the following lemma whose proof is provided in Appendix B:
413
+
414
+ Lemma A.4. Suppose $\Pi _ { 4 } ^ { * }$ $\boldsymbol { \cdot } , s _ { 4 , 1 } ^ { * } , s _ { 4 , 2 } ^ { * }$ are the optimal variables of Formulation 4. Then $s _ { 4 , 1 } ^ { * } \preceq 0$ and $s _ { 4 , 2 } ^ { * } \preceq 0$ .
415
+
416
+ Now we prove that optimal value of Formulation 1 and Formulation 4 are same. Let $( \Pi _ { 1 } ^ { * } , s _ { 1 , 1 } ^ { * } , t _ { 1 , 1 } ^ { * } )$ is an optimal solution of Formulation 1. Then we claim that $( \Pi _ { 1 } ^ { * } , s _ { 1 , 1 } ^ { * } , t _ { 1 , 1 } ^ { * } )$ is also an optimal solution of Formulation 4. Clearly it is feasible solution of Formulation 4. Suppose it is not optimal, i.e. there exists another optimal solution $( \tilde { \Pi } _ { 4 } , \tilde { s } _ { 4 , 1 } , \tilde { s } _ { 4 , 2 } )$ such that:
417
+
418
+ $$
419
+ \langle C , \tilde { \Pi } _ { 4 } \rangle + \lambda ( \lVert \tilde { s } _ { 4 , 1 } \rVert _ { 1 } + \lVert \tilde { s } _ { 4 , 2 } \rVert _ { 2 } ) < \langle C , \Pi _ { 1 , 1 2 } ^ { * } \rangle + \lambda ( \lVert s _ { 1 , 1 } ^ { * } \rVert _ { 1 } + \lVert t _ { 1 , 1 } ^ { * } \rVert _ { 1 } )
420
+ $$
421
+
422
+ Now based on $( \tilde { \Pi } _ { 4 } , \tilde { s } _ { 4 , 1 } , \tilde { s } _ { 4 , 2 } )$ we construct a feasible solution of Formulation 1 as follows:
423
+
424
+ $$
425
+ \tilde { \Pi } _ { 1 } = \left[ \begin{array} { c c } { { { \bf 0 } } } & { { \tilde { \Pi } _ { 4 } } } \\ { { { \bf 0 } } } & { { - { \bf d i a g } ( \tilde { s } _ { 4 , 2 } ) } } \end{array} \right]
426
+ $$
427
+
428
+ Note that we proved in Lemma A. $. 4 \ \tilde { s } _ { 4 , 2 } \preceq 0$ , hence we have $\tilde { \Pi } _ { 1 } \succeq 0$ . Now as the column sums of $\tilde { \Pi } _ { 4 }$ is $q + \tilde { s } _ { 4 , 2 }$ , we have column sums of $\tilde { \Pi } _ { 1 } = [ \mathbf { 0 } \mathbf { \Lambda } \boldsymbol { q } ^ { \top } ] ^ { \top }$ and the row sums are $[ ( p + \tilde { s } _ { 4 , 1 } ) ^ { \top } \quad \tilde { s } _ { 4 , 2 } ^ { \top } ] ^ { \top }$ . Hence we take $\tilde { s } _ { 1 , 1 } = \tilde { s } _ { 4 , 1 }$ and $\tilde { s } _ { 1 , 2 } = \tilde { s } _ { 4 , 2 }$ . Then it follows:
429
+
430
+ $$
431
+ \begin{array} { r l r } & { } & { \langle C _ { a u g } , \tilde { \Pi } _ { 1 } \rangle + \lambda [ \| \tilde { s } _ { 1 , 1 } \| _ { 1 } + \| \tilde { s } _ { 1 , 2 } \| _ { 1 } ] = \langle C , \tilde { \Pi } _ { 4 } \rangle + \lambda [ \| \tilde { s } _ { 4 , 1 } \| _ { 1 } + \| \tilde { s } _ { 4 , 2 } \| _ { 1 } ] \qquad } \\ & { } & { < \langle C , \Pi _ { 1 , 1 2 } ^ { * } \rangle + \lambda \left[ \| s _ { 1 , 1 } ^ { * } \| _ { 1 } + \| t _ { 1 , 1 } ^ { * } \| _ { 1 } \right] } \\ & { } & { = \langle C _ { a u g } , \Pi _ { 1 } ^ { * } \rangle + \lambda \left[ \| s _ { 1 , 1 } ^ { * } \| _ { 1 } + \| t _ { 1 , 1 } ^ { * } \| _ { 1 } \right] } \end{array}
432
+ $$
433
+
434
+ This is contradiction as we assumed $( \Pi _ { 1 } ^ { * } , s _ { 1 , 1 } ^ { * } , t _ { 1 , 2 } ^ { * } )$ is an optimal solution of Formulation 1. Therefore we conclude $( \Pi _ { 1 } ^ { * } , s _ { 1 , 1 } ^ { * } , t _ { 1 , 1 } ^ { * } )$ is also an optimal solution of Formulation 4 which further concludes Formulation 1 and Formulation 4 have same optimal values. This completes the proof of the theorem. □
435
+
436
+ Theorem A.5. The optimal objective value of Formulation 3 and Formulation 4 are same.
437
+
438
+ Proof. Like in the proof of Theorem A.3 we also prove couple of lemmas.
439
+
440
+ Lemma A.6. Any optimal transport plan $\Pi _ { 3 } ^ { * }$ of Formulation 3 has the following structure: If we write,
441
+
442
+ $$
443
+ \Pi _ { 3 } ^ { * } = \left[ \begin{array} { c c } { { \Pi _ { 3 , 1 1 } ^ { * } } } & { { \Pi _ { 3 , 1 2 } ^ { * } } } \\ { { \Pi _ { 3 , 2 1 } ^ { * } } } & { { \Pi _ { 3 , 2 2 } ^ { * } } } \end{array} \right]
444
+ $$
445
+
446
+ then $\Pi _ { 3 , 1 1 } ^ { * }$ and $\Pi _ { 3 , 2 2 } ^ { * }$ are diagonal matrices and $\Pi _ { 3 , 2 1 } ^ { * } = \mathbf { 0 }$
447
+
448
+ . If and $s _ { 3 , 1 } ^ { * } , t _ { 3 , 1 } ^ { * } , s _ { 3 , 2 } ^ { * } , t _ { 3 , 2 } ^ { * }$ are four optimal slack variables in Formulation 3, then $s _ { 3 , 1 } ^ { * } , t _ { 3 , 1 } ^ { * } \preceq 0$ $s _ { 3 , 2 } ^ { * } , t _ { 3 , 2 } ^ { * } \succeq 0$
449
+
450
+ Proof. The line of argument is same as in proof of Lemma A.4.
451
+
452
+ Next we establish equivalence. Suppose $( \Pi _ { 3 } ^ { * } , s _ { 3 , 1 } ^ { * } , t _ { 3 , 1 } ^ { * } , s _ { 3 , 2 } ^ { * } , t _ { 3 , 2 } ^ { * } )$ are optimal values of Formulation 3. We claim that $( \Pi _ { 3 , 1 2 } ^ { * } , s _ { 3 , 1 } ^ { * } - s _ { 3 , 2 } ^ { * } , t _ { 3 , 1 } ^ { * } - t _ { 3 , 2 } ^ { * } )$ forms an optimal solution of Formulation 4. The objective value will then also be same as $s _ { 3 , 1 } ^ { * } \preceq 0 , s _ { 3 , 2 } ^ { * } \succeq 0$ (Lemma A.7) implies $\| s _ { 3 , 1 } ^ { * } - s _ { 3 , 2 } ^ { * } \| _ { 1 } =$ $\lVert s _ { 3 , 1 } ^ { * } \rVert _ { 1 } + \lVert s _ { 3 , 2 } ^ { * } \rVert _ { 1 }$ and similarly $t _ { 3 , 1 . } ^ { * } \preceq 0 , t _ { 3 , 2 } ^ { * } \succeq 0$ implies $\lVert t _ { 3 , 1 } ^ { * } - t _ { 3 , 2 } ^ { * } \rVert _ { 1 } = \lVert t _ { 3 , 1 } ^ { * } \rVert _ { 1 } + \lVert t _ { 3 , 2 } ^ { * } \rVert _ { 1 }$ . Feasibility is immediate. Now for optimality, we again prove by contradiction. Suppose they are not optimal. Then lets say $\tilde { \Pi } _ { 4 } , \tilde { s } _ { 4 , 1 } , \tilde { s } _ { 4 , 2 }$ are an optimal triplet of Formulation 4. Now construct another feasible solution of Formulation 3 as follows: Set $\tilde { s } _ { 3 , 2 } = \tilde { t } _ { 3 , 2 } = 0 , \tilde { s } _ { 3 , 1 } = \tilde { s } _ { 4 , 1 }$ and $\tilde { t } _ { 3 , 1 } = \tilde { s } _ { 4 , 2 }$ . Set the matrix as:
453
+
454
+ $$
455
+ \tilde { \Pi } _ { 3 } = \left[ \begin{array} { c c } { { { \bf 0 } } } & { { \tilde { \Pi } _ { 4 } } } \\ { { { \bf 0 } } } & { { - { \bf d i a g } ( \tilde { s } _ { 4 , 2 } ) } } \end{array} \right]
456
+ $$
457
+
458
+ Then it follows that $\left( \tilde { \Pi } _ { 3 } , \tilde { s } _ { 3 , 1 } , \tilde { s } _ { 3 , 2 } , \tilde { t } _ { 3 , 1 } , \tilde { t } _ { 3 , 2 } \right)$ is a feasible solution of Formulation 3. Finally we have:
459
+
460
+ $$
461
+ \begin{array} { r l } & { \langle C _ { a u g } , \tilde { \Pi } _ { 3 } \rangle + \lambda \left[ \| \tilde { s } _ { 3 , 1 } \| _ { 1 } + \| \tilde { s } _ { 3 , 2 } \| _ { 1 } + \| \tilde { t } _ { 3 , 1 } \| _ { 1 } + \| \tilde { t } _ { 3 , 2 } \| _ { 1 } \right] } \\ & { = \langle C _ { a u g } , \tilde { \Pi } _ { 3 } \rangle + \lambda \left[ \| \tilde { s } _ { 4 , 1 } \| _ { 1 } + \| \tilde { s } _ { 4 , 2 } \| _ { 1 } \right] } \\ & { = \langle C , \tilde { \Pi } _ { 4 } \rangle + \lambda \left[ \| \tilde { s } _ { 4 , 1 } \| _ { 1 } + \| \tilde { s } _ { 4 , 2 } \| _ { 1 } \right] } \\ & { < \langle C , \Pi _ { 3 , 1 2 } ^ { * } \rangle + \lambda \left[ \| s _ { 3 , 1 } ^ { * } - s _ { 3 , 2 } ^ { * } \| _ { 1 } + \| t _ { 3 , 1 } ^ { * } - t _ { 3 , 2 } ^ { * } \| _ { 1 } \right] } \\ & { = \langle C _ { a u g } , \Pi _ { 3 } ^ { * } \rangle + \lambda \left[ \| s _ { 3 , 1 } ^ { * } \| _ { 1 } + \| s _ { 3 , 2 } ^ { * } \| _ { 1 } + \| t _ { 3 , 1 } ^ { * } \| _ { 1 } + \| t _ { 3 , 2 } ^ { * } \| _ { 1 } \right] } \end{array}
462
+ $$
463
+
464
+ This contradicts the optimality of $( \Pi _ { 3 } ^ { * } , s _ { 3 , 1 } ^ { * } , s _ { 3 , 2 } ^ { * } , t _ { 3 , 1 } ^ { * } , t _ { 3 , 2 } ^ { * } )$ . This completes the proof.
465
+
466
+ # A.3 PROOF OF CONTINUOUS VERSION
467
+
468
+ Proof. In this proof we denote by $F _ { 1 }$ the optimization problem of equation equation 2.2 and by $F _ { 2 }$ the optimization problem equation equation 2.4. Assume that $\mu _ { n }$ and $\nu _ { m }$ denote the respective empirical measures relative to $\mu , \nu$ . From Villani (2009), we know that $\mu _ { n } , \nu _ { n }$ converge weakly to $\mu$ and $\nu$ respectively. Therefore, $R O B O T _ { 2 } ( \mu _ { n } , \mu ) 0$ . Similary for $\nu _ { n }$ and $\nu$ . Thus, by triangle inequality,
469
+
470
+ $$
471
+ \operatorname* { l i m } _ { n \to \infty } | F _ { 2 } ( \mu _ { n } , \nu _ { n } ) - F _ { 2 } ( \mu , \nu ) | = 0 .
472
+ $$
473
+
474
+ But $R O B O T _ { 2 } ( \mu _ { n } , \nu _ { n } ) = R O B O T _ { 1 } ( \mu _ { n } , \nu _ { n } )$ . Therefore, our proof is complete if we can show that
475
+
476
+ $$
477
+ \operatorname* { l i m } _ { n , m \to \infty } \left| F _ { 1 } ( \mu _ { n } , \nu _ { m } ) - F _ { 1 } ( \mu , \nu ) \right| \to 0 .
478
+ $$
479
+
480
+ Let $\mathcal { S } = \{ s$ signed measure : $\mu + s$ is a probability measure in $\mathbb { R } ^ { d } \}$ . For $s \in \mathcal S$ , define
481
+
482
+ $$
483
+ \begin{array} { r } { V ( \mu + S , \nu ) = \left\{ \begin{array} { l l } { \displaystyle \operatorname* { m i n } _ { \Pi \in \mathcal { F } ( \mathbb { R } ^ { d } \times \mathbb { R } ^ { d } ) } } & { \displaystyle \int C ( x , y ) \ \Pi ( \mathrm { d } x , \mathrm { d } y ) + \lambda \| s \| _ { T V } } \\ { \displaystyle \mathrm { s u b j e c t ~ t o } } & { \displaystyle \int _ { A } \Pi ( \mathrm { d } x , \mathrm { d } y ) \geq 0 \forall A \in \mathcal { B } ( \mathbb { R } ^ { d } \times \mathbb { R } ^ { d } ) } \\ { \displaystyle \mu ( \mathrm { d } x ) + s ( \mathrm { d } x ) ) \geq 0 } & { \displaystyle \forall B \in \mathcal { B } ( \mathbb { R } ^ { d } ) } \\ & { \displaystyle \int _ { \mathbb { R } ^ { d } \times C } \Pi ( \mathrm { d } x , \mathrm { d } y ) = \int _ { C } \nu ( \mathrm { d } y ) \ \forall C \in \mathcal { B } ( \mathbb { R } ^ { d } ) . } \end{array} \right. } \end{array}
484
+ $$
485
+
486
+ By Lemma A.8, ∃ $s \in \mathcal S$ such that $R O B O T _ { \cdot } ( \mu , \nu ) = W ( \mu + s , \nu ) + \lambda \| s \| _ { T V }$ . Let $s = s ^ { + } - s ^ { - }$ where $s ^ { + }$ and $s ^ { - }$ are positive measures on $\mathbb { R } ^ { d }$ . Let $\| s \| _ { T V } = \gamma$ . Then, $\| s ^ { - } \| _ { T V } = \| s ^ { + } \| _ { T V } = \gamma / 2$
487
+
488
+ Then consider $X _ { 1 } , \dots , X _ { n } \sim ( P - s ^ { - } ) / ( 1 - \gamma ) , Y _ { 1 } , \dots , Y _ { n } \sim s ^ { - } / \gamma , Z _ { 1 } , \dots , Z _ { n } \sim s ^ { + } / \gamma .$ Then for any bounded continuous function $f$ ,
489
+
490
+ $$
491
+ \begin{array} { r c l } { \displaystyle \underset { n \to \infty } { \operatorname* { l i m } } \displaystyle \sum _ { i } f ( X _ { i } ) / n } & { = } & { \displaystyle \int f ( x ) \frac { \left( P - s ^ { - } \right) } { ( 1 - \gamma ) } ( \mathrm { d } x ) } \\ { \displaystyle \underset { n \to \infty } { \operatorname* { l i m } } \displaystyle \sum _ { i } f ( Z _ { i } ) / n } & { = } & { \displaystyle \int f ( x ) \frac { s ^ { + } } { \gamma } ( \mathrm { d } x ) } \end{array}
492
+ $$
493
+
494
+ Therefore, the distribution given by $( P + s ) _ { n } = \frac { ( 1 - \gamma ) } { n } \sum _ { i } \delta _ { X _ { i } } + \frac { \gamma } { n } \sum _ { i } \delta _ { Z _ { i } }$ satisfies, $( P + s ) _ { n } \stackrel { \mathcal { L } } { }$ $P + s$ , and therefore from (Villani, 2009), $\begin{array} { r } { \operatorname* { l i m } _ { n \to \infty } \tilde { W } _ { C } ( ( P + S ) _ { n } , \bar { \nu } _ { n } ) \to W ( P + S , Q ) } \end{array}$ . Here $\delta _ { x }$ is the Dirac mass at $x$ . Moreover, $\| s _ { n } \| = \| s \|$ , where $s _ { n }$ satisfies $s _ { n } = \frac { \gamma } { n } ( \sum _ { i } \delta _ { Z _ { i } } - \sum _ { i } \delta _ { Y _ { i } } )$ .
495
+
496
+ Also, $R O B O T ( \mu _ { n } , \nu _ { n } ) ~ \le ~ W ( ( P ~ + ~ s ) _ { n } , \nu _ { n } ) ~ + ~ \lambda \| s \| _ { T V }$ , and therefore $R O B O T _ { 2 } ( \mu , \nu ) ) \ =$ lim $\begin{array} { r } { \gimel \operatorname* { s u p } _ { n \to \infty } R O B O T ( \mu _ { n } , \nu _ { n } ) \leq R O B O T ( \mu , \nu ) } \end{array}$ .
497
+
498
+ Now, let $\tilde { s } _ { n }$ satisfy $W _ { 1 } ( \mu _ { n } + \tilde { s } _ { n } , \nu _ { n } ) + \lambda \| \tilde { s } _ { n } \| _ { T V } = R O B O T ( \mu _ { n } , \nu _ { n } )$ . Such an ${ \tilde { s } } _ { n }$ exists by the proof of the discrete part because $\mu _ { n } , \nu _ { n }$ are discrete measures.
499
+
500
+ Then, similar to the Step 1 in the proof of Lemma A.8, there exists a probability measure $\mu \oplus s$ and a subsequence $\{ n _ { k } \} _ { k \ge 1 }$ such that $\mu _ { n _ { k } } + s _ { n _ { k } }$ almost surely converges weakly to $\mu \oplus s$ .
501
+
502
+ Moreover, similar to Step 2 of Lemma A.8 $W _ { 1 } ( \mu _ { n _ { k } } + s _ { n _ { k } } , \mu \oplus s ) \to 0$ as well as $\| s _ { n _ { k } } \| _ { T V } $ $\| \mu \oplus s - \mu \| _ { T V }$ . Thus, $W _ { 1 } ( \mu _ { n _ { k } } + s _ { n _ { k } } , \nu _ { n _ { k } } ) + \lambda \| s _ { n _ { k } } \| _ { T V } W _ { 1 } ( \mu \oplus s , \nu ) + \lambda \| \mu \oplus s - \mu \| _ { T V } .$ But by the proof of the discrete part $R O B O T ( \mu _ { n _ { k } } , \nu _ { n _ { k } } ) = R O B O T _ { 2 } ( \mu _ { n _ { k } } , \nu _ { n _ { k } } ) .$ ROBOT2(µ, ν). Therefore, with $s = \mu \oplus s - \mu$ , $W _ { 1 } ( \mu + s , \nu ) + \lambda \| s \| _ { T V } = R O B O T _ { 2 } ( \mu , \nu )$ .
503
+
504
+ Therefore, $R O B O T _ { 2 } ( \mu , \nu ) = \operatorname* { l i m } \operatorname* { s u p } _ { n \to \infty } R O B O T ( \mu _ { n } , \nu _ { n } ) \geq R O B O T ( \mu , \nu )$ . Thus the equality holds.
505
+
506
+ Lemma A.8. Assume that $\mu , \nu$ is such that $\begin{array} { r } { \int \| \boldsymbol { x } \| \mathrm { d } \mu , \ \int \| \boldsymbol { x } \| \mathrm { d } \nu < \infty } \end{array}$ . Moreover, assume that $C ( x , y )$ in equation 2.2 is the $l _ { 1 }$ norm, i.e., $C ( \dot { x } , y ) = \| x - y \|$ . Then, there exists s with $\mu + s$ being a probability measure such that
507
+
508
+ $$
509
+ W _ { 1 } ( \mu + s , \nu ) + \lambda \| s \| _ { T V } = R O B O T ( \mu , \nu ) ,
510
+ $$
511
+
512
+ where $W _ { 1 }$ is the Wasserstein-1 norm with the cost function $C ( \cdot , \cdot )$ as mentioned above.
513
+
514
+ Proof. Let $\mu _ { n } , \nu _ { m }$ be the empirical measures relative to $\mu , \nu$ respectively. We know that since $\mu _ { n } , \nu _ { m }$ are discrete, there exists $s _ { n }$ satisfying $W _ { 1 } ( \mu _ { n } + s _ { n } , \nu _ { m } ) = R O B O T ( \mu _ { n } , \nu _ { m } )$ . We provide the proof in the following steps.
515
+
516
+ Step 1: Almost surely $\mu \times \nu$ , there exists a subsequence $\{ n _ { k } \} _ { k \ge 1 }$ such that $\{ \mu _ { n } + s _ { n } \} _ { n }$ and $\{ \nu _ { n } \} _ { n }$ is relatively compact.
517
+
518
+ $\mu$ and $\nu$ are probability measures on $\mathbb { R } ^ { d }$ and are therefore tight.
519
+ Let $K _ { \epsilon }$ be such that $\dot { P _ { \mu } } ( X \notin K _ { \epsilon } ) , P _ { \nu } ( Y \notin K _ { \epsilon } ) \le \epsilon / 4$ .
520
+
521
+ Consider the empirical distributions $\nu _ { n } = \textstyle \sum _ { i } \delta _ { Y _ { i } } / n , \mu _ { n } \textstyle \sum _ { i } \delta _ { X _ { i } } / n$ of $\nu , \mu$ respectively. Here, $X _ { i } \sim$ $\mu$ and $Y _ { i } \sim _ { \nu }$ .
522
+
523
+ Fix an $\omega$ . Then $\{ X _ { 1 } , . . . , X _ { n } , Y _ { 1 } , . . . , Y _ { n } \}$ is fixed. Now by the construction for the discrete case, $s _ { n }$ has support in $\{ X _ { 1 } , . . . , X _ { n } , Y _ { 1 } , . . . , Y _ { n } \}$ .
524
+
525
+ Let $T _ { n }$ be the optimal transport map from $\mu _ { n }$ to $\nu _ { n }$ . Then, for every $i \leq n$ , there exists a unique $j \ \leq \ n$ , such that $T _ { n } ( X _ { i } ) ~ = ~ Y _ { j }$ . Define $\tau _ { n } : \{ 1 , \dots , n \} \to \{ 1 , \dots , n \}$ such that $\tau _ { n } ( i ) = j$ if $T _ { n } ( X _ { i } ) = Y _ { j }$ .Then $\mu _ { n } + s _ { n } = \sum _ { i } \delta _ { Z _ { i } } / n$ , where $Z _ { i } = X _ { i }$ or $Y _ { \tau _ { n } ( i ) }$ and $\delta _ { x }$ is the Dirac delta mass at $x$ .
526
+
527
+ Then, let $Z \sim \mu _ { n } + s _ { n }$
528
+
529
+ $$
530
+ P _ { \omega } ( Z \notin K _ { \epsilon } | \mu _ { n } + s _ { n } ) \le \sum _ { i } \mathbb { 1 } _ { ( X _ { i } \notin K _ { \epsilon } ) } / n + \sum _ { i } \mathbb { 1 } _ { ( Y _ { i } \notin K _ { \epsilon } ) } / n
531
+ $$
532
+
533
+ Therefore, $\mathbb { E } ( P _ { \omega } ( Z \notin K _ { \epsilon } | \mu _ { n } + s _ { n } ) ) \le \epsilon / 2$ . Moreover, ${ \cal V } a r ( P _ { \omega } ( Z \not \in K _ { \epsilon } | \mu _ { n } + s _ { n } ) ) = o ( n ^ { - 1 } ) \to 0$ . Therefore, $\begin{array} { r } { \operatorname* { l i m } _ { n \infty } P _ { \mu ^ { n } \times \nu ^ { n } } \big ( P _ { \omega } ( Z \notin K _ { \epsilon } | \mu _ { n } + s _ { n } ) \le \epsilon \big ) 1 } \end{array}$ . Therefore $\mu _ { n } + s _ { n }$ is almost surely tight and thus by Prokhorov’s Theorem also relatively compact.
534
+
535
+ Step 2: Therefore, for $\omega$ almost surely, there exists a subsequence $\{ n _ { k } \} _ { k \ge 1 }$ such that $\mu _ { n _ { k } } + s _ { n _ { k } }$ converges weakly to a limit (dependent on $\omega$ ) $\mu \oplus s$ which is a probability measure. Moreover, $\textstyle \int \| x \| \bar { \mathrm { d } } ( \mu _ { n _ { k } } + s _ { n _ { k } } ) < \infty$ almost surely. By Bolzano-Weierstrass Theorem, there exists a further subsequence $\{ n _ { k _ { l } } \} _ { l }$ such that $\begin{array} { r } { \int \| x \| \mathrm { d } ( \mu _ { n _ { k _ { l } } } + s _ { n _ { k _ { l } } } ) \int \| x \| \mathrm { d } ( \mu + s ) } \end{array}$ almost surely. For the sake of convenience, without loss of generality, we will replace the sub-subsequence $\{ n _ { k _ { l } } \} _ { l }$ with $\{ n _ { k } \} _ { k \ge 1 }$ henceforth.
536
+
537
+ Thus, by Theorem 6.9 of (Villani, 2009) , $W _ { 1 } ( \mu _ { n _ { k } } + s _ { n _ { k } } , \mu \oplus s ) \to 0$ almost surely. Moreover, $W _ { 1 } ( \mu _ { n _ { k } } , \mu ) \to 0$ almost surely. Therefore $\| s _ { n _ { k } } \| _ { T V } \to \| \mu \oplus s - \mu \| _ { T V }$ almost surely.
538
+
539
+ Step 3: Consider an arbitrary $S = S ^ { + } - S ^ { - }$ , such that $S ^ { + }$ and $S ^ { - }$ are positive measures on $\mathbb { R } ^ { d }$ , and $\mu + S$ is a probability measure. Let $\| S \| _ { T V } = \gamma$ . Then, $\| S ^ { - } \| _ { T V } = \| S ^ { + } \| _ { T V } = \gamma / 2$ .
540
+
541
+ Then consider $X _ { 1 } , \dots , X _ { n } \sim ( \mu - S ^ { - } ) / ( 1 - \gamma ) , Y _ { 1 } , \dots , Y _ { n } \sim S ^ { - } / \gamma , Z _ { 1 } , \dots , Z _ { n } \sim S ^ { + } / \gamma$ . Then for any bounded continuous function $f$ ,
542
+
543
+ $$
544
+ \begin{array} { r c l } { { \displaystyle \operatorname* { l i m } _ { n \to \infty } \sum _ { i } f ( X _ { i } ) / n } } & { { = } } & { { \displaystyle \int f ( x ) \frac { \left( P - s ^ { - } \right) } { ( 1 - \gamma ) } ( \mathrm { d } x ) } } \\ { { \displaystyle \operatorname* { l i m } _ { n \to \infty } \sum _ { i } f ( Z _ { i } ) / n } } & { { = } } & { { \displaystyle \int f ( x ) \frac { s ^ { + } } { \gamma } ( \mathrm { d } x ) } } \end{array}
545
+ $$
546
+
547
+ Therefore, the distribution given by $\begin{array} { r } { ( \mu + S ) _ { n } ( A ) = ( 1 - \gamma ) \sum _ { i } \mathbb { 1 } _ { X _ { i } \in A } + ( \gamma ) \sum _ { i } \mathbb { 1 } _ { Z _ { i } \in A } } \end{array}$ satisfies, $( \mu + S ) _ { n } \stackrel { \mathcal { L } } { \to } \mu + S$ , and therefore from (Villani, 2009), $\begin{array} { r } { \operatorname* { l i m } _ { n \to \infty } W _ { 1 } ( ( \mu + S ) _ { n } , \nu _ { n } ) \to W _ { 1 } ( \mu + S , \nu ) } \end{array}$ . Moreover, $\| S _ { n } \| _ { T V } = \| S \| _ { T V }$ , where $S _ { n }$ satisfies $S _ { n } ( A ) = { \frac { \gamma } { n } } \sum _ { i } \mathbb { 1 } _ { Z _ { i } \in A } - \sum _ { i } \mathbb { 1 } _ { Y _ { i } \in A }$ .
548
+
549
+ But, $W _ { 1 } ( \mu _ { n _ { k } } + s _ { n _ { k } } , \nu _ { n _ { k } } ) + \lambda \| s _ { n _ { k } } \| _ { T V } \leq W _ { 1 } ( ( \mu + S ) _ { n _ { k } } , \nu _ { n _ { k } } ) + \lambda \| S _ { n _ { k } } \| _ { T V }$ . Therefore, taking limits, $W _ { 1 } ( \mu \oplus s , \nu ) + \lambda \| \mu \oplus s - \mu \| _ { T V } \leq W _ { 1 } ( \mu + S , \nu ) + \lambda \| S \| _ { T V }$ , and thus the proof holds with $s = \mu \oplus s - \mu$ .
550
+
551
+ # B PROOF OF ADDITIONAL LEMMAS
552
+
553
+ # B.1 PROOF OF LEMMA A.1
554
+
555
+ Proof. The fact that $\Pi _ { 1 , 1 1 } ^ { * } = \Pi _ { 1 , 2 1 } ^ { * } = \mathbf { 0 }$ follows from the fact that $\Pi _ { 1 } ^ { * } \succeq 0$ and $\Pi _ { 1 } ^ { * } \mathbf { 1 } = \mathbf { Q }$ . To prove that $\Pi _ { 1 , 2 2 } ^ { * }$ is diagonal, we use the fact that the any diagonal entry the cost matrix is 0. Now suppose $\Pi _ { 1 , 2 2 } ^ { * }$ is not diagonal. Then define a matrix $\hat { \Pi }$ as following: set $\hat { \Pi } _ { 1 1 } = \hat { \Pi } _ { 2 1 } = \mathbf { 0 }$ , $\hat { \Pi } _ { 1 2 } = \Pi _ { 1 , 1 2 } ^ { * }$ and:
556
+
557
+ $$
558
+ \hat { \Pi } _ { 2 2 } ( i , j ) = \left\{ \begin{array} { l l } { \sum _ { k = 1 } ^ { m } \Pi _ { 1 , 2 2 } ^ { * } ( k , i ) , } & { \mathrm { i f ~ } j = i } \\ { 0 , } & { \mathrm { i f ~ } j \ne i } \end{array} \right.
559
+ $$
560
+
561
+ Also define $\hat { s } = s _ { 1 } ^ { * }$ and $\hat { t }$ as $\hat { t } ( i ) = \hat { \Pi } _ { 2 2 } ( i , i )$ . Then clearly $( \hat { \Pi } , \hat { s } , \hat { t } )$ is a feasible solution of Formulation 1. Note that:
562
+
563
+ $$
564
+ \Vert \hat { t } \Vert _ { 1 } = 1 ^ { \top } \hat { \Pi } _ { 2 2 } 1 = 1 ^ { \top } \Pi _ { 1 , 2 2 } ^ { * } 1 = \Vert t _ { 1 } ^ { * } \Vert _ { 1 }
565
+ $$
566
+
567
+ and by our construction $\left. C _ { a u g } , \hat { \Pi } \right. < \left. C _ { a u g } , \Pi _ { 1 } ^ { * } \right.$ . Hence $( { \hat { \Pi } } , { \hat { s } } , { \hat { t } } )$ reduces the value of the objective function of Formulation 1 which is a contradiction. This completes the proof.
568
+
569
+ # B.2 PROOF OF LEMMA A.2
570
+
571
+ Proof. 1. Suppose $\Pi _ { 1 } ^ { * } ( i , j ) ~ > ~ 0$ . Then dump this mass to $s _ { 1 } ^ { * } ( j )$ and make it 0. In this way $\left. C _ { a u g } , \Pi _ { 1 } ^ { * } \right.$ will decrease by $> 2 \lambda \Pi _ { 1 } ^ { * } ( i , j )$ and the regularizer value will increase by atmost $2 \lambda \Pi _ { 1 } ^ { * } ( i , j )$ , resulting in overall reduction in the objective value, which leads to a contradiction.
572
+
573
+ 2. Suppose each entry of $i ^ { t h }$ row of $C$ is $< 2 \lambda$ . Then if $s _ { 1 } ^ { * } ( i ) > 0$ , we can distribute this mass in the $\bar { i } ^ { t h }$ row such that, $s _ { 1 } ^ { * } ( i ) = a _ { 1 } + a _ { 2 } + \cdot \cdot \cdot + a _ { m }$ with the condition that $t _ { 1 } ^ { * } ( j ) \geq a _ { j }$ . Now we reduce $t _ { 1 } ^ { * }$ as:
574
+
575
+ $$
576
+ t _ { 1 } ^ { * } ( j ) \gets t _ { 1 } ^ { * } ( j ) - a _ { j }
577
+ $$
578
+
579
+ Hence the value $\left. C _ { a u g } , \Pi _ { 1 } ^ { * } ( i , j ) \right.$ will increase by a value $< 2 \lambda s _ { 1 } ^ { * } ( i )$ but the value of regularizer will decrease by the value of $2 \lambda s _ { 1 } ^ { * } ( i )$ , resulting in overall decrease in the value of objective function.
580
+
581
+ 3. Same as proof of part (2) by interchanging row and column in the argument.
582
+
583
+ 4. Suppose not. Then choose $\epsilon < s _ { 1 } ^ { * } ( i ) \bar { \wedge } t _ { 1 } ^ { * } ( j )$ , Add $\epsilon$ to $\Pi _ { 1 } ^ { * } ( i , j )$ . Hence the cost function value $\left. C _ { a u g } , \Pi _ { 1 } ^ { * } \right.$ will increase by $< 2 \lambda \epsilon$ but the regularizer value will decrease by $2 \lambda \epsilon$ , resulting in overall decrease in the objective function.
584
+
585
+ # B.3 PROOF OF LEMMA A.4
586
+
587
+ Proof. For the notational simplicity, we drop the subscript 4 now as we will only deal with the solution of Formulation 4 and there will be no ambiguity. We prove the Lemma by contradiction. Suppose $s _ { 1 , i } ^ { * } > 0$ . Then we show one can come up with another solution $( \tilde { \Pi } , \tilde { s } _ { 1 } , \tilde { s } _ { 2 } )$ of Formulation 4 such that it has lower objective value. To construct this new solution, make:
588
+
589
+ $$
590
+ \tilde { s } _ { 1 , j } = \left\{ \begin{array} { l l } { s _ { 1 , j } ^ { * } , } & { \mathrm { i f } \ j \ne i } \\ { 0 , } & { \mathrm { i f } \ j = i } \end{array} \right.
591
+ $$
592
+
593
+ Now to change the optimal transport plan, we will only change $i ^ { t h }$ row of $\Pi ^ { * }$ . We subtract $a _ { 1 } , a _ { 2 } , \ldots , a _ { n } \geq 0$ from $i ^ { t h }$ column of $\Pi ^ { * }$ in such a way, such that none of the elements are negative. Hence the column sum will be change, i.e. the value of ${ \tilde { s } } _ { 2 }$ will be:
594
+
595
+ $$
596
+ \tilde { s } _ { 2 , j } = s _ { 2 , j } ^ { * } - a _ { j } \forall 1 \leq j \leq n .
597
+ $$
598
+
599
+ Now clearly from our construction:
600
+
601
+ $$
602
+ \langle C , \tilde { \Pi } \rangle \leq \langle C , \Pi ^ { * } \rangle
603
+ $$
604
+
605
+ For the regularization part, note that, as we only reduced $i ^ { t h }$ element of $s _ { 1 } ^ { * }$ , we have $\| \tilde { s } _ { 1 } \| _ { 1 } =$ $\| s _ { 1 } ^ { * } \| _ { 1 } - s _ { 1 , i } ^ { * }$ . And by simple triangle inequality,
606
+
607
+ $$
608
+ \| \widetilde s _ { 2 } \| _ { 1 } \leq \| s _ { 2 } ^ { * } \| _ { 1 } + \| a _ { 1 } \| _ { 1 } = \| s _ { 2 } ^ { * } \| _ { 1 } + s _ { 1 , i } ^ { * }
609
+ $$
610
+
611
+ by construction $a _ { i }$ ’s, as $a _ { i } \geq 0$ and $\textstyle \sum _ { i } a _ { i } = s _ { 1 , i } ^ { * }$ . Hence we have:
612
+
613
+ $$
614
+ \| \widetilde s _ { 1 } \| _ { 1 } + \| \widetilde s _ { 2 } \| _ { 1 } \leq \| s _ { 1 } ^ { * } \| _ { 1 } - s _ { 1 , i } ^ { * } + \| s _ { 2 } ^ { * } \| _ { 1 } + s _ { 1 , i } ^ { * } = \| s _ { 1 } ^ { * } \| _ { 1 } + \| s _ { 2 } ^ { * } \| _ { 1 } .
615
+ $$
616
+
617
+ Hence the value corresponding to regularizer will also decrease. This completes the proof.
618
+
619
+ # B.4 PROOF OF LEMMA A.6
620
+
621
+ Proof. We prove this lemma by contradiction. Suppose $\Pi _ { 3 } ^ { * }$ does not have the structure mentioned in the statement of Lemma. Construct another transport plan for Formulation $3 \tilde { \Pi } _ { 3 }$ as follows: Keep $\tilde { \Pi } _ { 3 , 1 2 } = \Pi _ { 3 , 1 2 } ^ { * }$ and set $\tilde { \Pi } _ { 3 , 1 2 } = \mathbf { 0 }$ . Construct the other parts as:
622
+
623
+ $$
624
+ \begin{array} { r } { \tilde { \Pi } _ { 3 , 1 1 } ( i , j ) = \left\{ \begin{array} { l l } { \sum _ { k = 1 } ^ { m } \Pi _ { 3 , 1 1 } ^ { * } ( i , k ) + \sum _ { k = 1 } ^ { n } \Pi _ { 3 , 2 1 } ^ { * } ( k , i ) , } & { \mathrm { i f ~ } i = j } \\ { 0 , } & { \mathrm { i f ~ } i \ne j } \end{array} \right. } \end{array}
625
+ $$
626
+
627
+ and
628
+
629
+ $$
630
+ \tilde { \Pi } _ { 3 , 2 2 } ( i , j ) = \left\{ \begin{array} { l l } { \sum _ { k = 1 } ^ { n } \Pi _ { 3 , 2 2 } ^ { * } ( k , i ) , } & { \mathrm { i f ~ } i = j } \\ { 0 , } & { \mathrm { i f ~ } i \ne j } \end{array} \right.
631
+ $$
632
+
633
+ It is immediate from the construction that:
634
+
635
+ $$
636
+ \left. C _ { a u g } , \tilde { \Pi } _ { 3 } \right. \leq \left. C _ { a u g } , \Pi _ { 3 } ^ { * } \right.
637
+ $$
638
+
639
+ As for the regularization term: Note the by our construction ${ \tilde { s } } _ { 4 }$ will be same as $s _ { 4 } ^ { * }$ as column sum of $\tilde { \Pi } _ { 3 , 2 2 }$ is same as $\Pi _ { 3 , 2 2 } ^ { * }$ . For the other three:
640
+
641
+ $$
642
+ \tilde { s } _ { 3 } ( i ) = \tilde { \Pi } _ { 3 , 1 1 } ( i , i ) = \sum _ { k = 1 } ^ { m } \Pi _ { 3 , 1 1 } ^ { * } ( i , k ) + \sum _ { k = 1 } ^ { n } \Pi _ { 3 , 2 1 } ^ { * } ( k , i )
643
+ $$
644
+
645
+ $$
646
+ \tilde { s } _ { 2 } ( i ) = \tilde { \Pi } _ { 3 , 2 2 } ( i , i ) = \sum _ { k = 1 } ^ { n } \Pi _ { 3 , 2 2 } ^ { * } ( k , i )
647
+ $$
648
+
649
+ and hence by construction:
650
+
651
+ $$
652
+ \begin{array} { r } { \| \tilde { s } _ { 2 } \| _ { 1 } = \mathbf { 1 } ^ { \top } \Pi _ { 3 , 2 2 } ^ { * } \mathbf { 1 } = \| s _ { 2 } ^ { * } \| _ { 1 } - \mathbf { 1 } ^ { \top } \Pi _ { 3 , 2 1 } ^ { * } \mathbf { 1 } . } \\ { \| \tilde { s } _ { 3 } \| _ { 1 } = \mathbf { 1 } ^ { \top } \Pi _ { 3 , 1 1 } ^ { * } \mathbf { 1 } + \mathbf { 1 } ^ { \top } \Pi _ { 3 , 2 1 } ^ { * } \mathbf { 1 } = \| s _ { 3 } ^ { * } \| _ { 1 } } \end{array}
653
+ $$
654
+
655
+ And also by our construction, $\tilde { s } _ { 1 } = s _ { 1 } ^ { * } + c$ where $c = ( \Pi _ { 3 , 2 1 } ^ { * } ) ^ { \top } \mathbf { 1 }$ . As a consequence we have $\Vert c \Vert _ { 1 } = \mathbf { 1 } ^ { \top } \Pi _ { 3 , 2 1 } ^ { * } \mathbf { 1 }$ . Then it follows:
656
+
657
+ $$
658
+ \begin{array} { l } { \displaystyle \sum _ { i = 1 } ^ { 4 } \| \widetilde s _ { i } \| _ { 1 } = \| s _ { 1 } ^ { * } + c \| + \| s _ { 2 } ^ { * } \| _ { 1 } - \mathbf { 1 } ^ { \top } \Pi _ { 3 , 2 1 } ^ { * } \mathbf { 1 } + \| s _ { 3 } ^ { * } \| _ { 1 } + \| s _ { 4 } ^ { * } \| _ { 1 } } \\ { \displaystyle \qquad \leq \displaystyle \sum _ { i = 1 } ^ { 4 } \| s _ { i } ^ { * } \| _ { 1 } + \| c \| _ { 1 } - \mathbf { 1 } ^ { \top } \Pi _ { 3 , 2 1 } ^ { * } \mathbf { 1 } } \\ { \displaystyle \qquad = \displaystyle \sum _ { i = 1 } ^ { 4 } \| s _ { i } ^ { * } \| _ { 1 } } \end{array}
659
+ $$
660
+
661
+ So the objective value is overall reduced. This contradicts the optimality of $\Pi _ { 3 } ^ { * }$ which completes the proof.
662
+
663
+ # C PROOF OF THEOREM 2.1
664
+
665
+ Proof. The proof is immediate from the Formulation 1. Recall that the Formulation 1 can restructured as:
666
+
667
+ $$
668
+ R O B O T ( \tilde { \mu } , \nu ) = \operatorname* { i n f } _ { P } \left\{ O T ( P , \nu ) + \lambda \| P - \tilde { \mu } \| _ { T V } \right\} .
669
+ $$
670
+
671
+ where the infimum is taking over all measure dominated by some common measure $\sigma$ (with respect to which $\mu , \mu _ { c } , \nu$ are dominated). Hence,
672
+
673
+ $$
674
+ R O B O T ( \tilde { \mu } , \nu ) \leq O T ( P , \nu ) + \lambda \| P - \tilde { \mu } \| _ { T V }
675
+ $$
676
+
677
+ for any particular choice of $P$ . Taking $P = \mu$ we get that
678
+
679
+ $$
680
+ R O B O T ( \tilde { \mu } , \nu ) \leq O T ( \mu , \nu ) + \lambda \| \mu - \tilde { \mu } \| _ { T V } = O T ( \mu , \nu ) ) + \lambda \epsilon \| \mu - \mu _ { c } \| _ { T V }
681
+ $$
682
+
683
+ Taking $P ~ = ~ \nu$ we get $R O B O T ( \tilde { \mu } , \nu ) ~ \leq ~ \lambda \| \nu - \tilde { \mu } \| _ { T V }$ and finally taking $P = ~ \tilde { \mu }$ we get $R O B \bar { O } T ( \tilde { \mu } , \nu ) \le O \bar { T } ( \tilde { \mu } , \nu )$ . This completes the proof.
md/train/w6iVxEdh6bi/w6iVxEdh6bi.md ADDED
@@ -0,0 +1,342 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Offline RL Without Off-Policy Evaluation
2
+
3
+ # David Brandfonbrener
4
+
5
+ William F. Whitney
6
+
7
+ Rajesh Ranganath
8
+
9
+ # Joan Bruna
10
+
11
+ Department of Computer Science, Center for Data Science New York University david.brandfonbrener@nyu.edu
12
+
13
+ # Abstract
14
+
15
+ Most prior approaches to offline reinforcement learning (RL) have taken an iterative actor-critic approach involving off-policy evaluation. In this paper we show that simply doing one step of constrained/regularized policy improvement using an on-policy Q estimate of the behavior policy performs surprisingly well. This onestep algorithm beats the previously reported results of iterative algorithms on a large portion of the D4RL benchmark. The one-step baseline achieves this strong performance while being notably simpler and more robust to hyperparameters than previously proposed iterative algorithms. We argue that the relatively poor performance of iterative approaches is a result of the high variance inherent in doing off-policy evaluation and magnified by the repeated optimization of policies against those estimates. In addition, we hypothesize that the strong performance of the one-step algorithm is due to a combination of favorable structure in the environment and behavior policy.
16
+
17
+ # 1 Introduction
18
+
19
+ An important step towards effective real-world RL is to improve sample efficiency. One avenue towards this goal is offline RL (also known as batch RL) where we attempt to learn a new policy from data collected by some other behavior policy without interacting with the environment. Recent work in offline RL is well summarized by Levine et al. [2020].
20
+
21
+ In this paper, we challenge the dominant paradigm in the deep offline RL literature that primarily relies on actor-critic style algorithms that alternate between policy evaluation and policy improvement [Fujimoto et al., 2018a, 2019, Peng et al., 2019, Kumar et al., 2019, 2020, Wang et al., 2020b, Wu et al., 2019, Kostrikov et al., 2021, Jaques et al., 2019, Siegel et al., 2020, Nachum et al., 2019]. All these algorithms rely heavily on off-policy evaluation to learn the critic. Instead, we find that a simple baseline which only performs one step of policy improvement using the behavior Q function often outperforms the more complicated iterative algorithms. Explicitly, we find that our one-step algorithm beats prior results of iterative algorithms on most of the gym-mujoco [Brockman et al., 2016] and Adroit [Rajeswaran et al., 2017] tasks in the the D4RL benchmark suite [Fu et al., 2020].
22
+
23
+ We then dive deeper to understand why such a simple baseline is effective. First, we examine what goes wrong for the iterative algorithms. When these algorithms struggle, it is often due to poor off-policy evaluation leading to inaccurate Q values. We attribute this to two causes: (1) distribution shift between the behavior policy and the policy to be evaluated, and (2) iterative error exploitation whereby policy optimization introduces bias and dynamic programming propagates this bias across the state space. We show that empirically both issues exist in the benchmark tasks and that one way to avoid these issues is to simply avoid off-policy evaluation entirely.
24
+
25
+ Finally, we recognize that while the the one-step algorithm is a strong baseline, it is not always the best choice. In the final section we provide some guidance about when iterative algorithms can perform better than the simple one-step baseline. Namely, when the dataset is large and behavior policy has good coverage of the state-action space, then off-policy evaluation can succeed and iterative algorithms can be effective. In contrast, if the behavior policy is already fairly good, but as a result does not have full coverage, then one-step algorithms are often preferable.
26
+
27
+ ![](images/cf6e42d2a672364d97aa78052a83104499bb9082e0e6b593f15addb41a4cfc26.jpg)
28
+ Figure 1: A cartoon illustration of the difference between one-step and multi-step methods. All algorithms constrain themselves to a neighborhood of “safe” policies around $\beta$ . A one-step approach (left) only uses the on-policy ${ \widehat Q } ^ { \beta }$ , while a multi-step approach (right) repeatedly uses off-policy $\widehat { Q } ^ { \pi _ { i } }$ .
29
+
30
+ Our main contributions are:
31
+
32
+ • A demonstration that a simple baseline of one step of policy improvement outperforms more complicated iterative algorithms on a broad set of offline RL problems. • An examination of failure modes of off-policy evaluation in iterative offline RL algorithms. • A description of when one-step algorithms are likely to outperform iterative approaches.
33
+
34
+ # 2 Setting and notation
35
+
36
+ We will consider an offline RL setup as follows. Let $\mathcal { M } = \{ { S } , \mathcal { A } , \rho , P , R , \gamma \}$ be a discounted infinitehorizon MDP. In this work we focus on applications in continuous control, so we will generally assume that both $s$ and $\mathcal { A }$ are continuous and bounded. We consider the offline setting where rather than interacting with $\mathcal { M }$ , we only have access to a dataset $D _ { N }$ of $N$ tuples of $\left( { { s _ { i } } , { a _ { i } } , { r _ { i } } } \right)$ collected by some behavior policy $\beta$ with initial state distribution $\rho$ . Let $r ( s , a ) = \mathbb { E } _ { r \mid s , a } [ r ]$ be the expected reward. Define the state-action value function for any policy $\pi$ by $Q ^ { \pi } ( s , a ) : = \mathbb { E } _ { P , \pi | s _ { 0 } = s }$ , $\begin{array} { r } { { \bf \Gamma } _ { a _ { 0 } = a } [ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s _ { t } , a _ { t } ) ] } \end{array}$ The objective is to maximize the expected return $J$ of the learned policy:
37
+
38
+ $$
39
+ J ( \pi ) : = \underset { \rho , P , \pi } { \mathbb { E } } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } r ( s _ { t } , a _ { t } ) \right] = \underset { a \sim \pi | s } { \mathbb { E } } \left[ Q ^ { \pi } ( s , a ) \right] .
40
+ $$
41
+
42
+ Following $\mathrm { F u }$ et al. [2020] and others in this line of work, we allow access to the environment to tune a small $( < 1 0 )$ set of hyperparameters. See Paine et al. [2020] for a discussion of the active area of research on hyperparameter tuning for offline RL. We also discuss this further in Appendix $\textrm { C }$ .
43
+
44
+ # 3 Related work
45
+
46
+ Iterative algorithms. Most prior work on deep offline RL consists of iterative actor-critic algorithms. The primary innovation of each paper is to propose a different mechanism to ensure that the learned policy does not stray too far from the data generated by the behavior policy. Broadly, we group these methods into three camps: policy constraints/regularization, modifications of imitation learning, and Q regularization:
47
+
48
+ 1. The majority of prior work acts directly on the policy. Some authors have proposed explicit constraints on the learned policy to only select actions where $( s , a )$ has sufficient support under the data generating distribution [Fujimoto et al., 2018a, 2019, Laroche et al., 2019]. Another proposal is to regularize the learned policy towards the behavior policy [Wu et al., 2019] usually either with a KL divergence [Jaques et al., 2019] or MMD [Kumar et al., 2019]. This is a very straighforward way to stay close to the behavior with a hyperparameter that determines just how close. All of these algorithms are iterative and rely on off-policy evaluation.
49
+
50
+ 2. Siegel et al. [2020], Wang et al. [2020b], Chen et al. [2020] all use algorithms that filter out datapoints with low Q values and then perform imitation learning. Wang et al. [2018], Peng et al. [2019] use a weighted imitation learning algorithm where the weights are determined by exponentiated Q values. These algorithms are iterative.
51
+
52
+ 3. Another way to prevent the learned policy from choosing unknown actions is to incorporate some form of regularization to encourage staying near the behavior and being pessimistic about unknown state, action pairs [Wu et al., 2019, Nachum et al., 2019, Kumar et al., 2020, Kostrikov et al., 2021, Gulcehre et al., 2021]. However, being able to properly quantify uncertainty about unknown states is notoriously difficult when dealing with neural network value functions [Buckman et al., 2020].
53
+
54
+ One-step algorithms. Some recent work has also noted that optimizing policies based on the behavior value function can perform surprisingly well. As we do, Goo and Niekum [2020] studies the continuous control tasks from the D4RL benchmark, but they examine a complicated algorithm involving ensembles, distributional Q functions, and a novel regularization technique. In contrast, we analyze a substantially simpler algorithm and get better performance on the D4RL tasks. We also focus more of our contribution on understanding and explaining this performance. Gulcehre et al. [2021] studies the discrete action setting and finds that a one-step algorithm (which they call “behavior value estimation”) outperforms prior work on Atari games and other discrete action tasks from the RL Unplugged benchmark [Gulcehre et al., 2020]. They also introduce a novel regularizer for the evaluation step. In contrast, we consider the continuous control setting. This is a substantial difference in setting since continuous control requires actor-critic algorithms with parametric policies while in the discrete setting the policy improvement step can be computed exactly from the Q function. Moreover, while Gulcehre et al. [2021] attribute the poor performance of iterative algorithms to “overestimation”, we define and separate the issues of distribution shift and iterative error exploitation which can combine to cause overestimation. This separation helps to expose the difference between the fundamental limits of off-policy evaluation from the specific problems induced by iterative algorithms, and will hopefully be a useful distinction to inspire future work. Finally, a one-step variant is also briefly discussed in Nadjahi et al. [2019], but is not the focus of that work.
55
+
56
+ There are also important connections between the one-step algorithm and the literature on conservative policy improvement [Kakade and Langford, 2002, Schulman et al., 2015, Achiam et al., 2017], which we discuss in more detail in Appendix B.
57
+
58
+ # 4 Defining the algorithms
59
+
60
+ In this section we provide a unified algorithmic template for model-free offline RL algorithms as offline approximate modified policy iteration. We show how this template captures our one-step algorithm as well as a multi-step policy iteration algorithm and an iterative actor-critic algorithm. Then any choice of policy evaluation and policy improvement operators can be used to define one-step, multi-step, and iterative algorithms.
61
+
62
+ # 4.1 Algorithmic template
63
+
64
+ # Algorithm 1: OAMPI
65
+
66
+ We consider a generic offline approximate modified policy iteration (OAMPI) scheme, shown in Algorithm 1 (and based off of Puterman and Shin [1978], Scherrer et al. [2012]). Essentially the algorithm alternates between two steps. First, there is a policy evaluation step where we estimate the Q function of the cur
67
+
68
+ input : $K$ , dataset $D _ { N }$ , estimated behavior $\hat { \beta }$
69
+ Set $\pi _ { 0 } = \hat { \beta }$ . Initialize $\widehat { Q } ^ { \pi _ { - 1 } }$ randomly.
70
+ for $k = I$ , . . . , $K$ do Policy evaluation: $\widehat { Q } ^ { \pi _ { k - 1 } } = \mathcal { E } ( \pi _ { k - 1 } , D _ { N } , \widehat { Q } ^ { \pi _ { k - 2 } } )$ Policy improvement: $\pi _ { k } = \mathcal { I } ( \widehat { Q } ^ { \pi _ { k - 1 } } , \widehat { \beta } , D _ { N } , \pi _ { k - 1 } )$
71
+ end
72
+
73
+ rent policy $\pi _ { k - 1 }$ by $\widehat { Q } ^ { \pi _ { k - 1 } }$ using only the dataset $D _ { N }$ . Implementations also often use the prior $\mathrm { Q }$ estimate $\widehat { Q } ^ { \pi _ { k - 2 } }$ to warm-start the approximation process. Second, there is a policy improvement step. This step takes in the estimated $\mathrm { Q }$ function $\widehat { Q } ^ { \pi _ { k - 1 } }$ , the estimated behavior $\hat { \beta }$ , and the dataset $D _ { N }$ and produces a new policy $\pi _ { k }$ . Again an algorithm may use $\pi _ { k - 1 }$ to warm-start the optimization. Moreover, we expect this improvement step to be regularized or constrained to ensure that $\pi _ { k }$ remains in the support of $\beta$ and $D _ { N }$ . Choices for this step are discussed below. Now we discuss a few ways to instantiate the template.
74
+
75
+ One-step. The simplest algorithm sets the number of iterations $K = 1$ . We learn $\hat { \beta }$ by maximum likelihood and train the policy evaluation step to estimate $Q ^ { \beta }$ . Then we use any one of the policy improvement operators discussed below to learn $\pi _ { 1 }$ . Importantly, this algorithm completely avoids off-policy evaluation.
76
+
77
+ Multi-step. The multi-step algorithm now sets $K > 1$ . The evaluation operator must evaluate off-policy since $D _ { N }$ is collected by $\beta$ , but evaluation steps for $K \geq 2$ require evaluating policies $\pi _ { k - 1 } \neq \beta$ . Each iteration is trained to convergence in both the estimation and improvement steps.
78
+
79
+ Iterative actor-critic. An actor critic approach looks somewhat like the multi-step algorithm, but does not attempt to train to convergence at each iteration and uses a much larger $K$ . Here each iteration consists of one gradient step to update the Q estimate and one gradient step to improve the policy. Since all of the evaluation and improvement operators that we consider are gradient-based, this algorithm can adapt the same evaluation and improvement operators used by the multi-step algorithm. Most algorithms from the literature fall into this category [Fujimoto et al., 2018a, Kumar et al., 2019, 2020, Wu et al., 2019, Wang et al., 2020b, Siegel et al., 2020].
80
+
81
+ # 4.2 Policy evaluation operator
82
+
83
+ Following prior work on continuous state and action problems, we always evaluate by simple fitted Q evaluation [Fujimoto et al., 2018a, Kumar et al., 2019, Siegel et al., 2020, Wang et al., 2020b, Paine et al., 2020, Wang et al., 2021]. In practice this is optimized by TD-style learning with the use of a target network [Mnih et al., 2015] as in DDPG [Lillicrap et al., 2015]. We do not use any double Q learning or Q ensembles [Fujimoto et al., 2018b]. For the one-step and multi-step algorithms we train the evaluation procedure to convergence on each iteration and for the iterative algorithm each iteration takes a single stochastic gradient step. See Voloshin et al. [2019], Wang et al. [2021] for more comprehensive examinations of policy evaluation and some evidence that this simple fitted Q iteration approach is reasonable. It is an interesting direction for future work to consider other operators that use things like importance weighting [Munos et al., 2016] or pessimism [Kumar et al., 2020, Buckman et al., 2020].
84
+
85
+ # 4.3 Policy improvement operators
86
+
87
+ To instantiate the template, we also need to choose a specific policy improvement operator $\mathcal { T }$ . We consider the following improvement operators selected from those discussed in the related work section. Each operator has a hyperparameter controlling deviation from the behavior policy.
88
+
89
+ Behavior cloning. The simplest baseline worth including is to just return $\hat { \beta }$ as the new policy $\pi$ Any policy improvement operator ought to perform at least as well as this baseline.
90
+
91
+ Constrained policy updates. Algorithms like BCQ [Fujimoto et al., 2018a] and SPIBB [Laroche et al., 2019] constrain the policy updates to be within the support of the data/behavior. In favor of simplicity, we implement a simplified version of the BCQ algorithm that removes the “perturbation network” which we call Easy BCQ. We define a new policy $\hat { \pi } _ { k } ^ { M }$ by drawing $M$ samples from $\hat { \beta }$ and then executing the one with the highest value according to ${ \widehat Q } ^ { \beta }$ . Explicitly:
92
+
93
+ $$
94
+ \hat { \pi } _ { k } ^ { M } ( a | s ) = \mathbb { 1 } [ a = \arg \operatorname* { m a x } _ { a _ { j } } \{ \widehat { Q } ^ { \pi _ { k - 1 } } ( s , a _ { j } ) : a _ { j } \sim \pi _ { k - 1 } ( \cdot | s ) , 1 \leq j \leq M \} ] .
95
+ $$
96
+
97
+ Regularized policy updates. Another common idea proposed in the literature is to regularize towards the behavior policy [Wu et al., 2019, Jaques et al., 2019, Kumar et al., 2019]. For a general divergence $D$ we can define an algorithm that maximizes a regularized objective:
98
+
99
+ $$
100
+ \hat { \pi } _ { k } ^ { \alpha } = \arg \operatorname* { m a x } _ { \pi } \sum _ { i } \underset { a \sim \pi | s } { \mathbb { E } } \big [ \widehat { Q } ^ { \pi _ { k - 1 } } ( s _ { i } , a ) \big ] - \alpha D ( \hat { \beta } ( \cdot | s _ { i } ) , \pi ( \cdot | s _ { i } ) )
101
+ $$
102
+
103
+ A comprehensive review of different variants of this method can be found in $\mathrm { W u }$ et al. [2019] which does not find dramatic differences across regularization techniques. In practice, we will use reverse KL divergence, i.e. $K L ( \pi ( \cdot | s _ { i } ) | | \hat { \beta } ( \cdot | s _ { i } ) )$ . To compute the reverse KL, we draw samples from $\pi ( \cdot | s _ { i } )$ and use the density estimate $\hat { \beta }$ to compute the divergence. Intuitively, this regularization forces $\pi$ to remain within the support of $\beta$ rather than incentivizing $\pi$ to cover $\beta$ .
104
+
105
+ Variants of imitation learning. Another idea, proposed by [Wang et al., 2018, Siegel et al., 2020, Wang et al., 2020b, Chen et al., 2020] is to modify an imitation learning algorithm either by filtering or weighting the observed actions to incentivize policy improvement. The weighted version that we implement uses exponentiated advantage estimates to weight the observed actions:
106
+
107
+ $$
108
+ \hat { \pi } _ { k } ^ { \tau } = \arg \operatorname* { m a x } _ { \pi } \sum _ { i } \exp ( \tau ( \widehat { Q } ^ { \pi _ { k - 1 } } ( s _ { i } , a _ { i } ) - \widehat { V } ( s _ { i } ) ) ) \log \pi ( a _ { i } | s _ { i } ) .
109
+ $$
110
+
111
+ With these definitions, we can now move on to testing various combinations of algorithmic template (one-step, multi-step, or iterative) and improvement operator (Easy BCQ, reverse KL regularization, or exponentially weighted imitation).
112
+
113
+ # 5 Benchmark Results
114
+
115
+ Our main empirical finding is that one step of policy improvement is sufficient to beat state of the art results on much of the D4RL benchmark suite [Fu et al., 2020]. This is striking since prior work focuses on iteratively estimating the Q function of the current policy iterate, but we only use one step derived from ${ \widehat Q } ^ { \beta }$ . Results are shown in Table 1. Full experimental details are in Appendix C and code can be found at https://github.com/davidbrandfonbrener/onestep-rl.
116
+
117
+ Table 1: Results of one-step algorithms on the D4RL benchmark. The first column gives the best results across several iterative algorithms considered in Fu et al. [2020]. Each algorithm is tuned over 6 values of their respective hyperparameter. We report the mean and standard error over 10 seeds of the training process and using 100 evaluation episodes per seed. We bold the best result on each dataset and blue any result where a one-step algorithm beat the best reported iterative result from Fu et al. [2020]. We use m for medium, m-e for medium-expert, m-re for medium-replay, r for random, and c for cloned.
118
+
119
+ <table><tr><td rowspan="2"></td><td colspan="2">Iterative</td><td colspan="3">One-step</td></tr><tr><td>Fu et al. [2020]</td><td>BC</td><td>Easy BCQ</td><td>Rev. KL Reg</td><td>Exp.Weight</td></tr><tr><td>halfcheetah-m</td><td>46.3</td><td>42.1 ± 0.1</td><td>52.6 ± 0.1</td><td>55.6 ± 0.2</td><td>48.6± 0.0</td></tr><tr><td>walker2d-m</td><td>81.1</td><td>70.2 ±1.3</td><td>86.9 ± 0.4</td><td>85.6 ± 0.4</td><td>80.3 ±1.1</td></tr><tr><td>hopper-m</td><td>58.8</td><td>49.8 ± 0.6</td><td>69.7 ± 2.1</td><td>83.3 ± 1.4</td><td>56.7 ± 0.8</td></tr><tr><td>halfcheetah-m-e</td><td>64.7</td><td>60.1 ± 0.8</td><td>77.0 ± 0.9</td><td>93.5 ± 0.1</td><td>91.7 ± 0.9</td></tr><tr><td>walker2d-m-e</td><td>111.0</td><td>93.6 ± 5.6</td><td>111.8 ± 0.2</td><td>110.9 ± 0.1</td><td>112.9 ± 0.2</td></tr><tr><td>hopper-m-e</td><td>111.9</td><td>48.1 ± 1.5</td><td>81.4 ± 1.9</td><td>102.1 ± 1.3</td><td>83.1 ± 7.0</td></tr><tr><td>halfcheetah-m-re</td><td>47.7</td><td>34.9 ± 0.3</td><td>38.4± 0.3</td><td>42.4± 0.1</td><td>38.6 ± 0.5</td></tr><tr><td>walker2d-m-re</td><td>26.7</td><td>23.9 ± 1.6</td><td>66.4 ± 2.0</td><td>71.6 ± 3.1</td><td>49.3 ± 3.5</td></tr><tr><td>hopper-m-re</td><td>48.6</td><td>21.2 ± 1.3</td><td>77.3 ± 2.7</td><td>71.0 ± 8.1</td><td>94.1 ± 2.4</td></tr><tr><td>halfcheetah-r</td><td>35.4</td><td>2.2 ± 0.0</td><td>5.4 ± 0.1</td><td>6.9 ± 1.0</td><td>3.7± 0.2</td></tr><tr><td>walker2d-r</td><td>7.3</td><td>0.7 ± 0.1</td><td>4.2 ± 0.2</td><td>6.1 ± 0.3</td><td>5.2 ± 0.2</td></tr><tr><td>hopper-r</td><td>12.2</td><td>2.6± 0.4</td><td>6.7 ± 0.1</td><td>7.8± 0.3</td><td>5.6 ± 0.6</td></tr><tr><td>pen-c</td><td>56.9</td><td>49.3 ± 2.2</td><td>67.0 ± 1.1</td><td>55.3 ± 1.9</td><td>54.7 ± 2.3</td></tr><tr><td>hammer-c</td><td>2.1</td><td>0.5 ± 0.1</td><td>2.8 ± 0.5</td><td>0.2±0.0</td><td>1.2 ± 0.2</td></tr><tr><td>relocate-c</td><td>-0.1</td><td>0.0± 0.0</td><td>0.3 ± 0.0</td><td>0.1 ± 0.0</td><td>0.1 ± 0.0</td></tr><tr><td>door-c</td><td>0.4</td><td>0.0± 0.0</td><td>0.4 ± 0.2</td><td>0.0 ± 0.1</td><td>0.1 ± 0.1</td></tr></table>
120
+
121
+ As we can see in the table, all of the one-step algorithms usually outperform the best iterative algorithms tested by Fu et al. [2020]. The one notable exception is the case of random data (especially on halfcheetah), where iterative algorithms have a clear advantage. We will discuss potential causes of this further in Section 7.
122
+
123
+ To give a more direct comparison that controls for any potential implementation details, we use our implementation of reverse KL regularization to create multi-step and iterative algorithms. We are not using algorithmic modifications like Q ensembles, regularized Q values, or early stopping that have been used in prior work. But, our iterative algorithm recovers similar performance to prior regularized actor-critic approaches. These results are shown in Table 2.
124
+
125
+ Table 2: Results of reverse KL regularization on the D4RL benchmark across one-step, multi-step, and iterative algorithms. Again we run 6 hyperparameters and report the mean and standard error across 10 seeds using 100 evaluation episodes.
126
+
127
+ <table><tr><td></td><td>One-step</td><td>Multi-step</td><td>Iterative</td></tr><tr><td>halfcheetah-m</td><td>55.6± 0.2</td><td>40.8 ± 8.6</td><td>47.4 ± 3.5</td></tr><tr><td>walker2d-m</td><td>85.6 ± 0.4</td><td>75.9 ± 0.5</td><td>75.4 ± 0.8</td></tr><tr><td>hopper-m</td><td>83.3 ± 1.4</td><td>53.0 ±1.0</td><td>54.2 ± 0.6</td></tr><tr><td>halfcheetah-m-e</td><td>93.5 ± 0.1</td><td>93.6 ± 0.3</td><td>93.6 ± 0.2</td></tr><tr><td>walker2d-m-e</td><td>110.9 ± 0.1</td><td>76.3 ± 15.9</td><td>108.2 ± 0.3</td></tr><tr><td>hopper-m-e</td><td>102.1 ± 1.3</td><td>101.3 ± 3.9</td><td>82.7 ± 7.4</td></tr><tr><td>halfcheetah-r</td><td>6.9 ± 1.0</td><td>13.7 ± 1.7</td><td>16.3 ± 1.6</td></tr><tr><td>walker2d-r</td><td>6.1 ± 0.3</td><td>5.0±0.3</td><td>5.1± 0.3</td></tr><tr><td>hopper-r</td><td>7.8 ± 0.3</td><td>15.4 ± 2.9</td><td>9.7 ± 0.1</td></tr></table>
128
+
129
+ Put together, these results immediately suggest some guidance to the practitioner: it is worthwhile to run the one-step algorithm as a baseline before trying something more elaborate. The one-step algorithm is substantially simpler than prior work, but frequently achieves better performance.
130
+
131
+ # 6 What goes wrong for iterative algorithms?
132
+
133
+ The benchmark experiments show that one step of policy improvement often beats iterative and multi-step algorithms. In this section we dive deeper to understand why this happens. First, by examining the learning curves of each of the algorithms we note that iterative algorithms require stronger regularization to avoid instability. Then we identify two causes of this instability: distribution shift and iterative error exploitation.
134
+
135
+ Distribution shift causes evaluation error by reducing the effective sample size in the fixed dataset for evaluating the current policy and has been extensively considered in prior work as discussed below. Iterative error exploitation occurs when we repeatedly optimize policies against our Q estimates and exploit their errors. This introduces a bias towards overestimation at each step (much like the training error in supervised learning is biased to be lower than the test error). Moreover, by iteratively re-using the data and using prior Q estimates to warmstart training at each step, the errors from one step are amplified at the next. This type of error is particular to multi-step and iterative algorithms.
136
+
137
+ # 6.1 Learning curves and hyperparameter sensitivity
138
+
139
+ To begin to understand why iterative and multi-step algorithms can fail it is instructive to look at the learning curves. As shown in Figure 2, we often observe that the iterative algorithm will begin to learn and then crash. Regularization can help to prevent this crash since strong enough regularization towards the behavior policy ensures that the evaluation is nearly on-policy.
140
+
141
+ ![](images/bbd4b958be2971ecaf3cafc93b6bd3c079cf9f34558ea6eefef0e6a511b802b6.jpg)
142
+ Figure 2: Learning curves and final performance on halfcheetah-medium across different algorithms and regularization hyperparameters (all using the reverse KL regularized improvement operator). Error bars show min and max over 3 seeds. Similar figures for other datasets from D4RL can be found in Appendix D.
143
+
144
+ In contrast, the one-step algorithm is more robust to the regularization hyperparameter. The rightmost panel of the figure shows this clearly. While iterative and multi-step algorithms can have their performance degrade very rapidly with the wrong setting of the hyperparameter, the one-step approach is more stable. Moreover, we usually find that the optimal setting of the regularization hyperparameter is lower for the one-step algorithm than the iterative or multi-step approaches.
145
+
146
+ # 6.2 Distribution shift
147
+
148
+ Any algorithm that relies on off-policy evaluation will struggle with distribution shift in the evaluation step. Trying to evaluate a policy that is substantially different from the behavior reduces the effective sample size and increases the variance of the estimates. Explicitly, by distribution shift we mean the shift between the behavior distribution (the distribution over state-action pairs in the dataset) and the evaluation distribution (the distribution that would be induced by the policy $\pi$ we want to evaluate).
149
+
150
+ Prior work. There is a substantial body of prior theoretical work that suggests that off-policy evaluation can be difficult and this difficulty scales with some measure of distribution shift. Wang et al. [2020a], Amortila et al. [2020], Zanette [2021] give exponential (in horizon) lower bounds on sample complexity in the linear setting even with good feature representations that can represent the desired Q function and assuming good data coverage. Upper bounds generally require very strong assumptions on both the representation and limits on the distribution shift [Wang et al., 2021, Duan et al., 2020, Chen and Jiang, 2019]. Moreover, the assumed bounds on distribution shift can be exponential in horizon in the worst case. On the empirical side, Wang et al. [2021] demonstrates issues with distribution shift when learning from pre-trained features and provides a nice discussion of why distribution shift causes error amplification. Fujimoto et al. [2018a] raises a similar issue under the name “extrapolation error”. Regularization and constraints are meant to reduce issues stemming from distribution shift, but also reduce the potential for improvement over the behavior.
151
+
152
+ Empirical evidence. Both the multi-step and iterative algorithms in our experiments rely on offpolicy evaluation as a key subroutine. We examine how easy it is to evaluate the policies encountered along the learning trajectory. To control for issues of iterative error exploitation (discussed in the next subsection), we train Q estimators from scratch on a heldout evaluation dataset sampled from the behavior policy. We then evaluate these trained Q function on rollouts from 1000 datapoints sampled from the replay buffer. Results are shown in Figure 3.
153
+
154
+ The results show a correlation betweed KL and MSE. Moreover, we see that the MSE generally increases over training. One way to mitigate this, as seen in the figure, is to use a large value of $\alpha$ . We just cannot take a very large step before running into problems with distribution shift. But, when we take such a small step, the information from the on-policy ${ \widehat Q } ^ { \beta }$ is about as useful as the newly estimated ${ \widehat { Q } } ^ { \pi }$ . This is seen, for example, in Figure 2 where we get very similar performance across algorithms at high levels of regularization.
155
+
156
+ ![](images/7cdca1b44030fc8a1f0c53056fe81e9e58f7cbc3b78dd6f5341ba10b8b54469b.jpg)
157
+ Figure 3: Results of running the iterative algorithm on halfcheetah-medium. Each checkpointed policy is evaluated by a Q function trained from scratch on heldout data. MSE refers to $\mathbb { E } _ { s , a \sim \beta } [ ( \hat { Q } ^ { \pi _ { i } } ( s , a ) -$ $Q ^ { \pi _ { i } } ( s , a ) ) ^ { 2 } ]$ and KL refers to $\mathbb { E } _ { s \sim \beta } [ K L ( \pi ( \cdot | s ) | | \beta ( \cdot | s ) ]$ . Left: 90 policies taken from various points in training with various hyperaparmeters and random seeds. Center: MSE learning curves. Right: KL learning curves. Error bars show min and max over 3 random seeds.
158
+
159
+ # 6.3 Iterative error exploitation
160
+
161
+ The previous subsection identifies how any algorithm that uses off-policy evaluation is fundamentally limited by distribution shift, even if we were given fresh data and trained Q functions from scratch at every iteration. But, in practice, iterative algorithms repeatedly iterate between optimizing policies against estimated Q functions and re-estimating the Q functions using the same data and using the Q function from the previous step to warm-start the re-estimation. This induces dependence between steps that causes a problem that we call iterative error exploitation.
162
+
163
+ Intuition about the problem. In short, iterative error exploitation happens because $\pi _ { i }$ tends to choose overestimated actions in the policy improvement step, and then this overestimation propagates via dynamic programming in the policy evaluation step. To illustrate this issue more formally, consider the following: at each $s , a$ we suffer some Bellman error $\varepsilon _ { \beta } ^ { \pi } ( s , a )$ based on our fixed dataset collected by $\beta$ . Formally,
164
+
165
+ $$
166
+ \widehat { Q } ^ { \pi } ( s , a ) = r ( s , a ) + \gamma \operatorname * { \mathbb { E } } _ { \mathbf { \Phi } _ { s ^ { \prime } \mid s , a } \atop { a ^ { \prime } \sim \pi \mid s ^ { \prime } } } [ \widehat { Q } ^ { \pi } ( s ^ { \prime } , a ^ { \prime } ) ] + \varepsilon _ { \beta } ^ { \pi } ( s , a ) .
167
+ $$
168
+
169
+ Intuitively, $\varepsilon _ { \beta } ^ { \pi }$ will be larger at state-actions with less coverage in the dataset collected by $\beta$ . Note that $\varepsilon _ { \beta } ^ { \pi }$ can absorb all error whether it is caused by the finite sample size or function approximation error.
170
+
171
+ All that is needed to cause iterative error exploitation is that the $\epsilon _ { \beta } ^ { \pi }$ are highly correlated across different $\pi$ , but for simplicity, we will assume that $\varepsilon _ { \beta } ^ { \pi }$ is the same for all policies $\pi$ estimated from our fixed offline dataset and instead write $\varepsilon _ { \beta }$ . Now that the errors do not depend on the policy we can treat the errors as auxiliary rewards that obscure the true rewards and see that
172
+
173
+ $$
174
+ \widehat { Q } ^ { \pi } ( s , a ) = Q ^ { \pi } ( s , a ) + \widetilde { Q } _ { \beta } ^ { \pi } ( s , a ) , \qquad \widetilde { Q } _ { \beta } ^ { \pi } ( s , a ) : = \underset { \pi | s _ { 0 } , a _ { 0 } = s , a } { \mathbb { E } } \left[ \sum _ { t = 0 } ^ { \infty } \gamma ^ { t } \varepsilon _ { \beta } ( s _ { t } , a _ { t } ) \right] .
175
+ $$
176
+
177
+ This assumption is somewhat reasonable since we expect the error to primarily depend on the data. And, when the prior Q function is used to warm-start the current one (as is generally the case in practice), the approximation errors are automatically passed between steps.
178
+
179
+ Now we can explain the problem. Recall that under our assumption the $\varepsilon _ { \beta }$ are fixed once we have a dataset and likely to have larger magnitude the further we go from the support of the dataset. So, with each step $\pi _ { i }$ is able to better maximize $\varepsilon _ { \beta }$ , thus moving further from $\beta$ and increasing the magnitude of $\widetilde { Q } _ { \beta } ^ { \pi _ { i } }$ relative to $Q ^ { \pi _ { i } }$ . Even though $Q ^ { \pi _ { i } }$ may provide better signal than $Q ^ { \beta }$ , it can easily be drowned out by $\widetilde { Q } _ { \beta } ^ { \pi _ { i } }$ . In contrast, $\widetilde { Q } _ { \beta } ^ { \beta }$ has small magnitude, so the one-step algorithm is robust to errors1.
180
+
181
+ An example. Now we consider a simple gridworld example to illustrate iterative error exploitation. This example fits exactly into the setup outlined above since all errors are due to reward estimation so the $\varepsilon _ { \beta }$ is indeed constant over all $\pi$ . The gridworld we consider has one deterministic good state with reward 1 and many stochastic bad states that have rewards distributed as $\mathcal { N } ( - 0 . 5 , 1 )$ . We collect a dataset of 100 trajectories, each of length 100. One run of the multi-step offline regularized policy iteration algorithm is illustrated in Figure 4.
182
+
183
+ In the example we see that one step often outperforms multiple steps of improvement. Intuitively, when there are so many noisy states, it is likely that a few of them will be overestimated. Since the data is re-used for each step, these overestimations persist and propagate across the state space due to iterative error exploitation. This property of having many bad, but poorly estimated states likely also exists in the high-dimensional control problems encountered in the benchmark where there are many ways for the robots to fall down that are not observed in the data for non-random behavior. Moreover, both settings have larger errors in areas where we have less data. So even though the errors in the gridworld are caused by noise in the rewards, while errors in D4RL are caused by function approximation, we think this is a useful mental model of the problem.
184
+
185
+ ![](images/28bd37725a9c5e57318c91a7a0e7430e58e28336dddb89607a085861be130769.jpg)
186
+ Figure 4: An illustration of multi-step offline regularized policy iteration. The leftmost panel in each row shows the true reward (top) or error $\varepsilon _ { \beta }$ (bottom). Then each subsequent panel plots $\pi _ { i }$ (with arrow size proportional to $\pi _ { i } ( a | s ) .$ ) over either $Q ^ { \pi _ { i } }$ (top) or $\widetilde { Q } _ { \beta } ^ { \pi }$ (bottom), averaged over actions at each state. The one-step policy $( \pi _ { 1 } )$ has the highest value. The behavior policy here is a mixture of optimal $\pi ^ { * }$ and uniform $u$ with coefficient 0.2 so that $\beta = 0 . 2 \cdot \pi ^ { * } + 0 . 8 \cdot u$ . We set $\alpha = 0 . 1$ as the regularization parameter for reverse KL regularization.
187
+
188
+ ![](images/3b10a08795d9696e39c5ae064a78494e5e6e4ed0576dc9e69d03724bd61efe1d.jpg)
189
+ Figure 5: Histograms of overestimation error $( \widehat { Q } ^ { \pi _ { i } } ( s , a ) - Q ^ { \pi _ { i } } ( s , a ) )$ on halfcheetah-medium with the iterative algorithm. Left: errors from the training Q function. Right: errors from an independently trained Q function.
190
+
191
+ Empirical evidence. In practice we cannot easily visualize the progression of errors. However, the dependence between steps still arises as overestimation of the Q values. We can track the overestimation of the Q values over training as a way to measure how much bias is being induced by optimizing against our dependent Q estimators. As a control we can also train Q estimators from scratch on independently sampled evaluation data. These independently trained Q functions do not have the same overestimation bias even though the squared error does tend to increase as the policy moves further from the behavior (as seen in Figure 3). Explicitly, we track 1000 state, action pairs from the replay buffer over training. For each checkpointed policy we perform 3 rollouts at each state to get an estimate of the true Q value and compare this to the estimated Q value. Results are shown in Figure 5.
192
+
193
+ # 7 When are multiple steps useful?
194
+
195
+ So far we have focused on why the one-step algorithm often works better than the multi-step and iterative algorithms. However, we do not want to give the impression that one-step is always better. Indeed, our own experiments in Section 5 show a clear advantage for the multi-step and iterative approaches when we have randomly collected data. While we cannot offer a precise delineation of when one-step will outperform multi-step, in this section we offer some intuition as to when we can expect to see benefits from multiple steps of policy improvement.
196
+
197
+ As seen in Section 6, multi-step and iterative algorithms have problems when they propagate estimation errors. This is especially problematic in noisy and/or high dimensional environments. While the multi-step algorithms propagate this noise more widely than the one-step algorithm, they also propagate the signal. So, when we have sufficient coverage to reduce the magnitude of the noise, this increased propagation of signal can be beneficial. The D4RL experiments suggest that we are usually on the side of the tradeoff where the errors are large enough to make one-step preferable.
198
+
199
+ ![](images/4deab14cea5ef2dbcec99ba9f0be26cb6ad0981000685aa80269646f930309aa.jpg)
200
+ Figure 6: Performance of all three algorithms with reverse KL regularization across mixtures between halfcheetah-random and halfcheetah-medium. Error bars indicate min and max over 3 seeds.
201
+
202
+ In Appendix A we illustrate a simple gridworld example where a slight modification of the behavior policy from Figure 4 makes multi-step dramatically outperform one-step. This modified behavior policy (1) has better coverage of the noisy states (which reduces error, helping multi-step), and (2) does a worse job propagating the reward from the good state (hurting one-step).
203
+
204
+ We can also test empirically how the behavior policy effects the tradeoff between error and signal propagation. To do this we construct a simple experiment where we mix data from the random behavior policy with data from the medium behavior policy. Explicitly we construct a dataset $D$ out of the datasets $D _ { r }$ for random and $D _ { m }$ for medium such that each trajectory in $D$ comes from the medium dataset with probability $p _ { m }$ . So for $p _ { m } = 0$ we have the random dataset and $p _ { m } = 1$ we have the medium dataset, and in between we have various mixtures. Results are shown in Figure 6. It takes surprisingly little data from the medium policy for one-step to outperform the iterative algorithm.
205
+
206
+ # 8 Discussion, limitations, and future work
207
+
208
+ This paper presents the surprising effectiveness of a simple one-step baseline for offline RL. We examine the failure modes of iterative algorithms and the conditions where we might expect them to outperform the simple one-step baseline. This provides guidance to a practitioner that the simple one-step baseline is a good place to start when approaching an offline RL problem.
209
+
210
+ But, we leave many questions unanswered. One main limitation is that we lack a clear theoretical characterization of which environments and behaviors can guarantee that one-step outperforms multi-step or visa versa. Such results will likely require strong assumptions, but could provide useful insight. We don’t expect this to be easy as it requires understanding policy iteration which has been notoriously difficult to analyze, often converging much faster than the theory would suggest [Sutton and Barto, 2018, Agarwal et al., 2019]. Another limitation is that while only using one step is perhaps the simplest way to avoid the problems of off-policy evaluation, there are possibly other more elaborate algorithmic solutions that we did not consider here. However, our strong empirical results suggest that the one-step algorithm is at least a strong baseline.
211
+
212
+ Broader impact. Our paper studies a simple and effective baseline approach to the offline RL problem. The effectiveness of this baseline raises some serious questions about the utility of prior work proposing substantially more complicated methods. By making this observation of prior shortcomings, our paper has the potential to encourage researchers to derive new and better methods for offline RL. This has many potential impacts on fields as diverse as robotics and healthcare where better offline decision making can lead to better real-world performance. As always, we note that machine learning improvements come in the form of “building machines to do $\mathbf { X }$ better”. For a sufficiently malicious or ill-informed choice of X, almost any progress in machine learning might indirectly lead to a negative outcome, and our work is not excluded from that.
213
+
214
+ # Acknowledgements
215
+
216
+ This work is partially supported by the Alfred P. Sloan Foundation, NSF RI-1816753, NSF CAREER CIF 1845360, NSF CHS-1901091, Samsung Electronics, and the Institute for Advanced Study. DB is supported by the Department of Defense (DoD) through the National Defense Science & Engineering Graduate Fellowship (NDSEG) Program.
217
+
218
+ # References
219
+
220
+ Joshua Achiam, David Held, Aviv Tamar, and Pieter Abbeel. Constrained policy optimization. In International Conference on Machine Learning, pages 22–31. PMLR, 2017.
221
+
222
+ Alekh Agarwal, Nan Jiang, and S. Kakade. Reinforcement learning: Theory and algorithms. 2019.
223
+
224
+ P. Amortila, Nan Jiang, and Tengyang Xie. A variant of the wang-foster-kakade lower bound for the discounted setting. ArXiv, abs/2011.01075, 2020.
225
+
226
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. CoRR, abs/1606.01540, 2016. URL http://arxiv.org/abs/ 1606.01540.
227
+
228
+ Jacob Buckman, Carles Gelada, and Marc G. Bellemare. The importance of pessimism in fixed-dataset policy optimization, 2020.
229
+
230
+ John Burkhardt. The truncated normal distribution, 2014.
231
+
232
+ Jinglin Chen and Nan Jiang. Information-theoretic considerations in batch reinforcement learning. In Proceedings of the 36th International Conference on Machine Learning. PMLR, 2019.
233
+
234
+ Xinyue Chen, Zijian Zhou, Zheng Wang, Che Wang, Yanqiu Wu, and Keith Ross. Bail: Bestaction imitation learning for batch deep reinforcement learning. Advances in Neural Information Processing Systems, 33, 2020.
235
+
236
+ Yaqi Duan, Zeyu Jia, and Mengdi Wang. Minimax-optimal off-policy evaluation with linear function approximation. In International Conference on Machine Learning, pages 2701–2709. PMLR, 2020.
237
+
238
+ Justin Fu, Aviral Kumar, Ofir Nachum, George Tucker, and Sergey Levine. D4rl: Datasets for deep data-driven reinforcement learning. arXiv preprint arXiv:2004.07219, 2020.
239
+
240
+ Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. arXiv preprint arXiv:1812.02900, 2018a.
241
+
242
+ Scott Fujimoto, Herke van Hoof, and David Meger. Addressing function approximation error in actor-critic methods. arXiv preprint arXiv:1802.09477, 2018b.
243
+
244
+ Scott Fujimoto, Edoardo Conti, Mohammad Ghavamzadeh, and Joelle Pineau. Benchmarking batch deep reinforcement learning algorithms. arXiv preprint arXiv:1910.01708, 2019.
245
+
246
+ Wonjoon Goo and Scott Niekum. You only evaluate once – a simple baseline algorithm for offline rl. In Offline Reinforcement Learning Workshop at Neural Information Processing Systems, 2020.
247
+
248
+ Caglar Gulcehre, Ziyu Wang, Alexander Novikov, Tom Le Paine, Sergio Gómez Colmenarejo, Konrad Zolna, Rishabh Agarwal, Josh Merel, Daniel Mankowitz, Cosmin Paduraru, et al. Rl unplugged: Benchmarks for offline reinforcement learning. arXiv preprint arXiv:2006.13888, 2020.
249
+
250
+ Caglar Gulcehre, Sergio Gómez Colmenarejo, Ziyu Wang, Jakub Sygnowski, Thomas Paine, Konrad Zolna, Yutian Chen, Matthew Hoffman, Razvan Pascanu, and Nando de Freitas. Regularized behavior value estimation. arXiv preprint arXiv:2103.09575, 2021.
251
+
252
+ Natasha Jaques, Asma Ghandeharioun, Judy Hanwen Shen, Craig Ferguson, Agata Lapedriza, Noah Jones, Shixiang Gu, and Rosalind Picard. Way off-policy batch deep reinforcement learning of implicit human preferences in dialog, 2019.
253
+
254
+ Sham Kakade and John Langford. Approximately optimal approximate reinforcement learning. In ICML, volume 2, pages 267–274, 2002.
255
+
256
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
257
+
258
+ Ilya Kostrikov, Jonathan Tompson, Rob Fergus, and Ofir Nachum. Offline reinforcement learning with fisher divergence critic regularization. arXiv preprint arXiv:2103.08050, 2021.
259
+
260
+ Aviral Kumar, Justin Fu, Matthew Soh, George Tucker, and Sergey Levine. Stabilizing off-policy q-learning via bootstrapping error reduction. In Advances in Neural Information Processing Systems, pages 11761–11771, 2019.
261
+
262
+ Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative q-learning for offline reinforcement learning. arXiv preprint arXiv:2006.04779, 2020.
263
+
264
+ Romain Laroche, Paul Trichelair, and Remi Tachet Des Combes. Safe policy improvement with baseline bootstrapping. In International Conference on Machine Learning, pages 3652–3661. PMLR, 2019.
265
+
266
+ Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020.
267
+
268
+ 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.
269
+
270
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015.
271
+
272
+ Rémi Munos, Tom Stepleton, Anna Harutyunyan, and Marc Bellemare. Safe and efficient off-policy reinforcement learning. In Advances in Neural Information Processing Systems, pages 1054–1062, 2016.
273
+
274
+ Ofir Nachum, Bo Dai, Ilya Kostrikov, Yinlam Chow, Lihong Li, and Dale Schuurmans. Algaedice: Policy gradient from arbitrary experience. arXiv preprint arXiv:1912.02074, 2019.
275
+
276
+ Kimia Nadjahi, Romain Laroche, and Rémi Tachet des Combes. Safe policy improvement with soft baseline bootstrapping, 2019.
277
+
278
+ Tom Le Paine, Cosmin Paduraru, Andrea Michi, Caglar Gulcehre, Konrad Zolna, Alexander Novikov, Ziyu Wang, and Nando de Freitas. Hyperparameter selection for offline reinforcement learning, 2020.
279
+
280
+ Xue Bin Peng, Aviral Kumar, Grace Zhang, and Sergey Levine. Advantage-weighted regression: Simple and scalable off-policy reinforcement learning. arXiv preprint arXiv:1910.00177, 2019.
281
+
282
+ Martin L Puterman and Moon Chirl Shin. Modified policy iteration algorithms for discounted markov decision problems. Management Science, 24(11):1127–1137, 1978.
283
+
284
+ Aravind Rajeswaran, Vikash Kumar, Abhishek Gupta, Giulia Vezzani, John Schulman, Emanuel Todorov, and Sergey Levine. Learning complex dexterous manipulation with deep reinforcement learning and demonstrations. arXiv preprint arXiv:1709.10087, 2017.
285
+
286
+ Bruno Scherrer, Victor Gabillon, Mohammad Ghavamzadeh, and Matthieu Geist. Approximate modified policy iteration. arXiv preprint arXiv:1205.3054, 2012.
287
+
288
+ John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International conference on machine learning, pages 1889–1897, 2015.
289
+
290
+ Noah Siegel, Jost Tobias Springenberg, Felix Berkenkamp, Abbas Abdolmaleki, Michael Neunert, Thomas Lampe, Roland Hafner, Nicolas Heess, and Martin Riedmiller. Keep doing what worked: Behavior modelling priors for offline reinforcement learning. In International Conference on Learning Representations, 2020.
291
+
292
+ Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018.
293
+
294
+ Hado Van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double qlearning. In Thirtieth AAAI conference on artificial intelligence, 2016.
295
+
296
+ Cameron Voloshin, Hoang M Le, Nan Jiang, and Yisong Yue. Empirical study of off-policy policy evaluation for reinforcement learning. arXiv preprint arXiv:1911.06854, 2019.
297
+
298
+ Qing Wang, Jiechao Xiong, Lei Han, Han Liu, Tong Zhang, et al. Exponentially weighted imitation learning for batched historical data. In Advances in Neural Information Processing Systems, pages 6288–6297, 2018.
299
+
300
+ Ruosong Wang, Dean P. Foster, and Sham M. Kakade. What are the statistical limits of offline rl with linear function approximation?, 2020a.
301
+
302
+ Ruosong Wang, Yifan Wu, Ruslan Salakhutdinov, and Sham M Kakade. Instabilities of offline rl with pre-trained neural representation. arXiv preprint arXiv:2103.04947, 2021.
303
+
304
+ Ziyu Wang, Alexander Novikov, Konrad Zolna, Josh S Merel, Jost Tobias Springenberg, Scott E Reed, Bobak Shahriari, Noah Siegel, Caglar Gulcehre, Nicolas Heess, et al. Critic regularized regression. Advances in Neural Information Processing Systems, 33, 2020b.
305
+
306
+ Yifan Wu, George Tucker, and Ofir Nachum. Behavior regularized offline reinforcement learning, 2019.
307
+
308
+ Andrea Zanette. Exponential lower bounds for batch reinforcement learning: Batch rl can be exponentially harder than online rl, 2021.
309
+
310
+ # Checklist
311
+
312
+ 1. For all authors...
313
+
314
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
315
+ (b) Did you describe the limitations of your work? [Yes] See Section 8 and Section 7.
316
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 8.
317
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
318
+
319
+ 2. If you are including theoretical results...
320
+
321
+ (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]
322
+
323
+ 3. If you ran experiments...
324
+
325
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See supplement.
326
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix C
327
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] In all relevant figures.
328
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix C
329
+
330
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
331
+
332
+ (a) If your work uses existing assets, did you cite the creators? [Yes] Data from Fu et al. [2020].
333
+ (b) Did you mention the license of the assets? [Yes] The license is Apache 2.0.
334
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Code in supplement.
335
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] Data is simulated.
336
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] Data is simulated.
337
+
338
+ 5. If you used crowdsourcing or conducted research with human subjects...
339
+
340
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
341
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
342
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]