ZHANGYUXUAN-zR commited on
Commit
588582f
·
verified ·
1 Parent(s): 5901036

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +50 -0
  2. md/train/-qh0M9XWxnv/-qh0M9XWxnv.md +767 -0
  3. md/train/0NXUSlb6oEu/0NXUSlb6oEu.md +286 -0
  4. md/train/1ibNKMp8SKc/1ibNKMp8SKc.md +304 -0
  5. md/train/3hGNqpI4WS/3hGNqpI4WS.md +562 -0
  6. md/train/7wCBOfJ8hJM/7wCBOfJ8hJM.md +286 -0
  7. md/train/8PPmLbV6WiQ/8PPmLbV6WiQ.md +530 -0
  8. md/train/A7pvvrlv68/A7pvvrlv68.md +255 -0
  9. md/train/B16dGcqlx/B16dGcqlx.md +356 -0
  10. md/train/B184E5qee/B184E5qee.md +257 -0
  11. md/train/B1E7Pwqgl/B1E7Pwqgl.md +428 -0
  12. md/train/B1G9tvcgx/B1G9tvcgx.md +404 -0
  13. md/train/B1YfAfcgl/B1YfAfcgl.md +468 -0
  14. md/train/B1ae1lZRb/B1ae1lZRb.md +292 -0
  15. md/train/B1eyO1BFPr/B1eyO1BFPr.md +0 -0
  16. md/train/B1lnbRNtwr/B1lnbRNtwr.md +213 -0
  17. md/train/B1uvH_gC-/B1uvH_gC-.md +238 -0
  18. md/train/B1x-LjAcKX/B1x-LjAcKX.md +264 -0
  19. md/train/B1x1ma4tDr/B1x1ma4tDr.md +381 -0
  20. md/train/B1xGGTEtDH/B1xGGTEtDH.md +608 -0
  21. md/train/BJe0Gn0cY7/BJe0Gn0cY7.md +398 -0
  22. md/train/BJeGZxrFvS/BJeGZxrFvS.md +214 -0
  23. md/train/BJfYvo09Y7/BJfYvo09Y7.md +337 -0
  24. md/train/BJgza6VtPB/BJgza6VtPB.md +276 -0
  25. md/train/BJlLdhNFPr/BJlLdhNFPr.md +501 -0
  26. md/train/BJm4T4Kgx/BJm4T4Kgx.md +363 -0
  27. md/train/BJypUGZ0Z/BJypUGZ0Z.md +308 -0
  28. md/train/BdKxQp0iBi8/BdKxQp0iBi8.md +270 -0
  29. md/train/BkJsCIcgl/BkJsCIcgl.md +295 -0
  30. md/train/ByC7ww9le/ByC7ww9le.md +342 -0
  31. md/train/ByJHuTgA-/ByJHuTgA-.md +228 -0
  32. md/train/ByMVTsR5KQ/ByMVTsR5KQ.md +338 -0
  33. md/train/BybtVK9lg/BybtVK9lg.md +293 -0
  34. md/train/ByeSdsC9Km/ByeSdsC9Km.md +302 -0
  35. md/train/ByfXe2C5tm/ByfXe2C5tm.md +312 -0
  36. md/train/Byl8hhNYPS/Byl8hhNYPS.md +282 -0
  37. md/train/ByuI-mW0W/ByuI-mW0W.md +262 -0
  38. md/train/C4-QQ1EHNcI/C4-QQ1EHNcI.md +511 -0
  39. md/train/CGFN_nV1ql/CGFN_nV1ql.md +326 -0
  40. md/train/CLnj31GZ4cI/CLnj31GZ4cI.md +225 -0
  41. md/train/CU0APx9LMaL/CU0APx9LMaL.md +251 -0
  42. md/train/D3PcGLdMx0/D3PcGLdMx0.md +371 -0
  43. md/train/EI2KOXKdnP/EI2KOXKdnP.md +215 -0
  44. md/train/EnmG3G5SYR/EnmG3G5SYR.md +403 -0
  45. md/train/H12GRgcxg/H12GRgcxg.md +215 -0
  46. md/train/H1gL-2A9Ym/H1gL-2A9Ym.md +340 -0
  47. md/train/H1lBj2VFPS/H1lBj2VFPS.md +343 -0
  48. md/train/H1lJws05K7/H1lJws05K7.md +610 -0
  49. md/train/H1lK_lBtvS/H1lK_lBtvS.md +275 -0
  50. md/train/H1vEXaxA-/H1vEXaxA-.md +411 -0
.gitattributes CHANGED
@@ -313,3 +313,53 @@ parse/dev/sMezXGG5So/sMezXGG5So_origin.pdf filter=lfs diff=lfs merge=lfs -text
313
  parse/dev/F7nD--1JIC/F7nD--1JIC_origin.pdf filter=lfs diff=lfs merge=lfs -text
314
  parse/dev/wu1Za9dY1GY/wu1Za9dY1GY_span.pdf filter=lfs diff=lfs merge=lfs -text
315
  parse/dev/wu1Za9dY1GY/wu1Za9dY1GY_layout.pdf filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  parse/dev/F7nD--1JIC/F7nD--1JIC_origin.pdf filter=lfs diff=lfs merge=lfs -text
314
  parse/dev/wu1Za9dY1GY/wu1Za9dY1GY_span.pdf filter=lfs diff=lfs merge=lfs -text
315
  parse/dev/wu1Za9dY1GY/wu1Za9dY1GY_layout.pdf filter=lfs diff=lfs merge=lfs -text
316
+ parse/dev/F7nD--1JIC/F7nD--1JIC_span.pdf filter=lfs diff=lfs merge=lfs -text
317
+ parse/dev/F7nD--1JIC/F7nD--1JIC_layout.pdf filter=lfs diff=lfs merge=lfs -text
318
+ parse/dev/4R7YrAGhnve/4R7YrAGhnve_layout.pdf filter=lfs diff=lfs merge=lfs -text
319
+ parse/dev/k7FuTOWMOc7/k7FuTOWMOc7_layout.pdf filter=lfs diff=lfs merge=lfs -text
320
+ parse/dev/4R7YrAGhnve/4R7YrAGhnve_span.pdf filter=lfs diff=lfs merge=lfs -text
321
+ parse/dev/sMezXGG5So/sMezXGG5So_span.pdf filter=lfs diff=lfs merge=lfs -text
322
+ parse/dev/w4cXZDDib1H/w4cXZDDib1H_layout.pdf filter=lfs diff=lfs merge=lfs -text
323
+ parse/dev/4R7YrAGhnve/4R7YrAGhnve_origin.pdf filter=lfs diff=lfs merge=lfs -text
324
+ parse/dev/fPhKeld3Okz/fPhKeld3Okz_layout.pdf filter=lfs diff=lfs merge=lfs -text
325
+ parse/dev/w4cXZDDib1H/w4cXZDDib1H_origin.pdf filter=lfs diff=lfs merge=lfs -text
326
+ parse/dev/k7FuTOWMOc7/k7FuTOWMOc7_span.pdf filter=lfs diff=lfs merge=lfs -text
327
+ parse/dev/sMezXGG5So/sMezXGG5So_layout.pdf filter=lfs diff=lfs merge=lfs -text
328
+ parse/dev/fPhKeld3Okz/fPhKeld3Okz_span.pdf filter=lfs diff=lfs merge=lfs -text
329
+ parse/dev/V88BafmH9Pj/V88BafmH9Pj_origin.pdf filter=lfs diff=lfs merge=lfs -text
330
+ parse/dev/w4cXZDDib1H/w4cXZDDib1H_span.pdf filter=lfs diff=lfs merge=lfs -text
331
+ parse/dev/V88BafmH9Pj/V88BafmH9Pj_span.pdf filter=lfs diff=lfs merge=lfs -text
332
+ parse/dev/k7FuTOWMOc7/k7FuTOWMOc7_origin.pdf filter=lfs diff=lfs merge=lfs -text
333
+ parse/dev/GUrhfTuf_3/GUrhfTuf_3_layout.pdf filter=lfs diff=lfs merge=lfs -text
334
+ parse/dev/GUrhfTuf_3/GUrhfTuf_3_origin.pdf filter=lfs diff=lfs merge=lfs -text
335
+ parse/dev/cVak2hs06z/cVak2hs06z_layout.pdf filter=lfs diff=lfs merge=lfs -text
336
+ parse/dev/oVE1z8NlNe/oVE1z8NlNe_span.pdf filter=lfs diff=lfs merge=lfs -text
337
+ parse/dev/V88BafmH9Pj/V88BafmH9Pj_layout.pdf filter=lfs diff=lfs merge=lfs -text
338
+ parse/dev/GUrhfTuf_3/GUrhfTuf_3_span.pdf filter=lfs diff=lfs merge=lfs -text
339
+ parse/dev/cVak2hs06z/cVak2hs06z_origin.pdf filter=lfs diff=lfs merge=lfs -text
340
+ parse/dev/oVE1z8NlNe/oVE1z8NlNe_origin.pdf filter=lfs diff=lfs merge=lfs -text
341
+ parse/dev/GMYWzWztDx5/GMYWzWztDx5_origin.pdf filter=lfs diff=lfs merge=lfs -text
342
+ parse/dev/GMYWzWztDx5/GMYWzWztDx5_span.pdf filter=lfs diff=lfs merge=lfs -text
343
+ parse/dev/GMYWzWztDx5/GMYWzWztDx5_layout.pdf filter=lfs diff=lfs merge=lfs -text
344
+ parse/dev/oVE1z8NlNe/oVE1z8NlNe_layout.pdf filter=lfs diff=lfs merge=lfs -text
345
+ parse/dev/SJ0Lde3tRL/SJ0Lde3tRL_layout.pdf filter=lfs diff=lfs merge=lfs -text
346
+ parse/dev/jmopGajkFY/jmopGajkFY_layout.pdf filter=lfs diff=lfs merge=lfs -text
347
+ parse/dev/r-6Z1SJbCpv/r-6Z1SJbCpv_layout.pdf filter=lfs diff=lfs merge=lfs -text
348
+ parse/dev/r-6Z1SJbCpv/r-6Z1SJbCpv_origin.pdf filter=lfs diff=lfs merge=lfs -text
349
+ parse/dev/SJ0Lde3tRL/SJ0Lde3tRL_origin.pdf filter=lfs diff=lfs merge=lfs -text
350
+ parse/dev/SJ0Lde3tRL/SJ0Lde3tRL_span.pdf filter=lfs diff=lfs merge=lfs -text
351
+ parse/dev/cVak2hs06z/cVak2hs06z_span.pdf filter=lfs diff=lfs merge=lfs -text
352
+ parse/dev/JhzzvJnL9t/JhzzvJnL9t_origin.pdf filter=lfs diff=lfs merge=lfs -text
353
+ parse/dev/jmopGajkFY/jmopGajkFY_span.pdf filter=lfs diff=lfs merge=lfs -text
354
+ parse/dev/r-6Z1SJbCpv/r-6Z1SJbCpv_span.pdf filter=lfs diff=lfs merge=lfs -text
355
+ parse/dev/JhzzvJnL9t/JhzzvJnL9t_layout.pdf filter=lfs diff=lfs merge=lfs -text
356
+ parse/dev/jmopGajkFY/jmopGajkFY_origin.pdf filter=lfs diff=lfs merge=lfs -text
357
+ parse/dev/JhzzvJnL9t/JhzzvJnL9t_span.pdf filter=lfs diff=lfs merge=lfs -text
358
+ parse/dev/ayPPc0SyLv1/ayPPc0SyLv1_origin.pdf filter=lfs diff=lfs merge=lfs -text
359
+ parse/dev/MpJjrfSJ-Xs/MpJjrfSJ-Xs_span.pdf filter=lfs diff=lfs merge=lfs -text
360
+ parse/dev/ayPPc0SyLv1/ayPPc0SyLv1_layout.pdf filter=lfs diff=lfs merge=lfs -text
361
+ parse/dev/ayPPc0SyLv1/ayPPc0SyLv1_span.pdf filter=lfs diff=lfs merge=lfs -text
362
+ parse/dev/pCucay08Co/pCucay08Co_origin.pdf filter=lfs diff=lfs merge=lfs -text
363
+ parse/dev/GGi4igGZEB-/GGi4igGZEB-_origin.pdf filter=lfs diff=lfs merge=lfs -text
364
+ parse/dev/MpJjrfSJ-Xs/MpJjrfSJ-Xs_origin.pdf filter=lfs diff=lfs merge=lfs -text
365
+ parse/dev/pCucay08Co/pCucay08Co_layout.pdf filter=lfs diff=lfs merge=lfs -text
md/train/-qh0M9XWxnv/-qh0M9XWxnv.md ADDED
@@ -0,0 +1,767 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ANALYZING THE EXPRESSIVE POWER OF GRAPH NEURAL NETWORKS IN A SPECTRAL PERSPECTIVE
2
+
3
+ Muhammet Balcilar∗, Guillaume Renton, Pierre Heroux, ´
4
+ Benoit Gauz¨ ere, S \` ebastien Adam, Paul Honeine ´
5
+ Normandy University, LITIS Lab, University of Rouen Normandy, INSA Rouen Normandie
6
+ Rouen, 76000, France
7
+
8
+ # ABSTRACT
9
+
10
+ In the recent literature of Graph Neural Networks (GNN), the expressive power of models has been studied through their capability to distinguish if two given graphs are isomorphic or not. Since the graph isomorphism problem is NP-intermediate, and Weisfeiler-Lehman (WL) test can give sufficient but not enough evidence in polynomial time, the theoretical power of GNNs is usually evaluated by the equivalence of WL-test order, followed by an empirical analysis of the models on some reference inductive and transductive datasets. However, such analysis does not account the signal processing pipeline, whose capability is generally evaluated in the spectral domain. In this paper, we argue that a spectral analysis of GNNs behavior can provide a complementary point of view to go one step further in the understanding of GNNs. By bridging the gap between the spectral and spatial design of graph convolutions, we theoretically demonstrate some equivalence of the graph convolution process regardless it is designed in the spatial or the spectral domain. Using this connection, we managed to re-formulate most of the state-of-the-art graph neural networks into one common framework. This general framework allows to lead a spectral analysis of the most popular GNNs, explaining their performance and showing their limits according to spectral point of view. Our theoretical spectral analysis is confirmed by experiments on various graph databases. Furthermore, we demonstrate the necessity of high and/or band-pass filters on a graph dataset, while the majority of GNN is limited to only low-pass and inevitably it fails.
11
+
12
+ Code available at https://github.com/balcilar/gnn-spectral-expressive-power.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Over the last five years, many Graph Neural Networks (GNNs) have been proposed in the literature of geometric deep learning (Velickovi ˇ c et al., 2018; Gilmer et al., 2017; Bronstein et al., 2017; ´ Battaglia et al., 2018), in order to generalize the very efficient deep learning paradigm into the world of graphs. This large number of contributions explains a new challenge recently tackled by the community, which consists in assessing the expressive power of GNNs.
17
+
18
+ In this area of research, there is a consensus to evaluate the theoretic expressive power of GNNs according to equivalence of Weisfeiler-Lehman (WL) test order (Morris et al., 2019; Xu et al., 2019; Maron et al., 2019b;a). Hence, GNNs models are frequently classified as ”as powerful as 1-WL”, ”as powerful as 2-WL”, . . . , ”as powerful as k-WL”. However, this perspective cannot make differences between two methods if they are as powerful as the same WL test order. Moreover, it does not always explain success or failure of any GNN on common benchmark datasets.
19
+
20
+ In this paper, we claim that analyzing theoretically and experimentally GNNs with a spectral point of view can bring a new perspective on their expressive power.
21
+
22
+ So far, GNNs have been generally studied separately as spectral based or as spatial based (Wu et al., 2019b; Chami et al., 2020). To the best of our knowledge, Message Passing Neural Networks (MPNNs) (Gilmer et al., 2017) and GraphNets (Battaglia et al., 2018) are the only attempts to merge both approaches in the same framework. However, these models are not able to generalize custom designed spectral filters, as well as the effect of each convolution support in a multi convolution case. The spatial-spectral connection is also mentioned indirectly in several cornerstone studies by Defferrard et al. (2016); Kipf & Welling (2017); Levie et al. (2019). Since the spectral-spatial interchangeability is missing, they did not propose to show spectral behavior of any graph convolution. Recent studies have also attempted to show, for a limited number of spatial GNNs, that they act as low-pass filters (NT & Maehara, 2019; Wu et al., 2019a). NT & Maehara (2019) concluded that using adjacency induces low-pass effects, while Wu et al. (2019a) studied a single spatial GNN’s spectral behavior by assuming adding self-connection changes the given topology of the graph.
23
+
24
+ In this paper, we bridge the gap between spectral and spatial domains for GNNs. Our first contribution consists in demonstrating the equivalence of convolution processes regardless if they are defined as spatial or as spectral GNN. Using this connection, we propose a new general framework and taxonomy for GNNs as the second contribution. Taking advantage of this equivalence, our third contribution is to provide a spectral analysis of any GNN model. This spectral analysis is another perspective for the analysis of expressive power of GNNs. Our theoretical spectral analysis is confirmed by experiments on various well-known graph datasets. Furthermore, we show the necessity of high and/or band-pass filters in our experiments, while the majority of GNNs are limited to only low-pass filters and thus inevitably fail when dealing with these problems. The code used in this paper is available at https://github.com/balcilar/gnn-spectral-expressive-power.
25
+
26
+ The remainder of this paper is organized as follows. Section 2 introduces convolutional GNNs and presents existing approaches. In Section 3 and Section 4, we describe the main contributions mentioned above. Section 5 presents a series of experiments and results which validate our propositions. Finally, Section 6 concludes this paper.
27
+
28
+ # 2 PROBLEM STATEMENT AND STATE OF THE ART
29
+
30
+ Let $G$ be a graph with $n$ nodes and an arbitrary number of edges. Connectivity is given by the adjacency matrix $A \in \{ 0 , 1 \} ^ { n \times n }$ and features are defined on nodes by $X \in \mathbb { R } ^ { \dot { n } \times f _ { 0 } }$ , with $f _ { 0 }$ the length of feature vectors. For any matrix $X$ , we used $X _ { i }$ , $X _ { : j }$ and $X _ { i , j }$ to refer its $i$ -th column vector, $j$ -th row vector and scalar value on $( i , j )$ location, respectively. A graph Laplacian is $L =$ $D - A$ (or $L = I - D ^ { - 1 / 2 } A D ^ { - 1 / 2 }$ ) where $D \in \mathbb { R } ^ { n \times n }$ is the diagonal degree matrix and $I$ is the identity. Through eigendecomposition, $L$ can be written by $L = \bar { U } \bar { \mathrm { d i a g } } ( \lambda ) \bar { U } ^ { T }$ where each column of $U \in \mathbb { R } ^ { n \times n }$ is an eigenvector of $L$ , $\boldsymbol { \lambda } \in \mathbb { R } ^ { n }$ gathers the eigenvalues of $\mathrm { L }$ and $\mathrm { d i a g ( . ) }$ function creates a diagonal matrix whose diagonal elements are from a given vector. We use superscript to refer same kind variable as base. For instance, $H ^ { ( l ) } \in \mathbb { R } ^ { n \times f _ { l } }$ refers node representation on layer $l$ whose feature dimension is $f _ { l }$ . A Graph Convolution layer takes the node representation of the previous layer $H ^ { ( l - 1 ) }$ as input and produces a new representation $H ^ { ( l ) }$ , with $H ^ { ( 0 ) } = X$ .
31
+
32
+ # 2.1 SPECTRAL APPROACHES
33
+
34
+ Spectral GNNs rely on the spectral graph theory (Chung, 1997). In this framework, signals on graphs are filtered using the eigendecomposition of graph Laplacian (Shuman et al., 2013). By transposing the convolution theorem to graphs, the spectral filtering in the frequency domain can be defined by $x _ { f l t } = U \mathrm { d i a g } ( \Phi ( { \pmb \lambda } ) ) U ^ { \top } x$ , where $\Phi ( . )$ is the desired filter function. As a consequence, a graph convolution layer in spectral domain can be written by a sum of filtered signals followed by an activation function as in (Bruna et al., 2013), namely
35
+
36
+ $$
37
+ H _ { j } ^ { ( l + 1 ) } = \sigma \left( \sum _ { i = 1 } ^ { f _ { l } } U \mathrm { d i a g } ( F _ { i } ^ { ( l , j ) } ) U ^ { \top } H _ { i } ^ { ( l ) } \right) , \qquad \mathrm { f o r ~ } j \in \{ 1 , \ldots , f _ { l + 1 } \} .
38
+ $$
39
+
40
+ Here, $\sigma$ is the activation function, $F ^ { ( l , j ) } \in \mathbb { R } ^ { n \times f _ { l } }$ is the corresponding weight vector to be tuned as used in (Henaff et al., 2015) for the single-graph problem known as non-parametric spectral GNN.
41
+
42
+ A first drawback is the necessity of Fourier and inverse Fourier transform by matrix multiplication of $U$ and $U ^ { T }$ . Another drawback occurs when generalizing the approach to multi-graph learning problems. Indeed, the $k$ -th element of the vector $F _ { i } ^ { ( l , j ) }$ weights the contribution of the $k$ -th eigenvector to the output. Those weights are not shareable between graphs of different sizes, which means a different length of $F _ { i } ^ { ( l , j ) }$ is needed. Moreover, even though the graphs have the same number of nodes, their eigenvalues will be different if their structures differ.
43
+
44
+ To overcome these issues, a few spatially-localized filters have been defined such as cubic B-spline (Bruna et al., 2013), polynomial and Chebyshev polynomial (Defferrard et al., 2016) and Cayley polynomial parameterization (Levie et al., 2019). With such approaches, trainable parameters are defined by $\bar { F } _ { i } ^ { ( l , j ) } = B \left[ W _ { i , j } ^ { ( l , 1 ) } , \ldots , W _ { i , j } ^ { ( l , s _ { e } ) } \right] ^ { \top }$ , where each column in $B \in \mathbb { R } ^ { n \times s _ { e } }$ is designed as a function of eigenvalues, namely $B _ { k , s } = \Phi _ { s } ( \lambda _ { k } )$ , where denotes eigenvalue index, $1 , \ldots , s _ { e }$ denotes index of filters and $s _ { e }$ is the number of desired filters. Here, $W ^ { ( l , s ) } \in \mathbb { R } ^ { f _ { l } \times f _ { l + 1 } }$ is the trainable matrix for the $l$ -th layer’s $s$ -th filter’s.
45
+
46
+ # 2.2 SPATIAL APPROACHES
47
+
48
+ Spatial GNNs consider an agg operator, which aggregates the neighborhood nodes, and an upd operator, which updates the concerned node as follows:
49
+
50
+ $$
51
+ H _ { : v } ^ { ( l + 1 ) } = u p d \Big ( g _ { 0 } ( H _ { : v } ^ { ( l ) } ) , a g g \Big ( g _ { 1 } ( H _ { : u } ^ { ( l ) } ) : u \in \mathcal { N } ( v ) \Big ) \Big ) ,
52
+ $$
53
+
54
+ where $\mathcal { N } ( v )$ is the set of neighborhood nodes and $g _ { 0 } , g _ { 1 } : \mathbb { R } ^ { n \times f _ { l } } \mathbb { R } ^ { n \times f _ { l + 1 } }$ trainable models. The choice of $a g g , u p d , g _ { 0 } , g _ { 1 }$ , and even $\mathcal { N } ( v )$ , determines the capability of model.
55
+
56
+ The vanilla GNN (known by GIN-0 in (Xu et al., 2019)) uses the same weights in $g _ { 0 }$ and $g _ { 1 } . { \mathcal { N } } ( v )$ is the set of connected nodes to $v$ , agg is the sum of all connected node values and $u p d ( x , y ) : = \sigma ( x +$ $y )$ where $\sigma$ is an elementwise nonlinearity. GCN has the same selection but normalizes features as in (Kipf & Welling, 2017). Hamilton et al. (2017) used separated weights in $g _ { 0 }$ and $g _ { 1 }$ , which means that two sets of trainable weights are applied on self feature and neighbor nodes. Other approaches defined multi neighborhood and used different $g _ { i }$ for different kind of neighborhood. For instance, Duvenaud et al. (2015) defined the neighborhood according to node label and/or degree, Niepert et al. (2016) reordered the neighbor nodes and used the same model $g _ { i }$ to neighbors according to their order.
57
+
58
+ These spatial GNNs use sum or normalized sum over $g _ { i }$ in equation 2. Other methods weighted this summation by another trainable parameter, where the weights can be written by the function of node and/or edge features in order to make the convolutions more productive, such as graph attention networks (Velickovi ˇ c et al., 2018), MoNet (Monti et al., 2017), GatedGCN (Bresson & Laurent, ´ 2018) and SplineCNN (Fey et al., 2018).
59
+
60
+ # 3 BRIDGING SPATIAL AND SPECTRAL GNNS
61
+
62
+ In this section, we define a general framework which includes most of the well-know GNN models, including euclidean convolution and models which use anisotropic update schema such as in Velickovi ˇ c et al. (2018); Bresson & Laurent (2018). ´
63
+
64
+ When $u p d ( x , y ) = \sigma ( x + y )$ , agg is a sum (or weighted sum) of the defined neighborhood nodes contributions and $g _ { i }$ applies linear transformation, one can trivially show that mentioned spatial GNNs can be generalized as propagation of the node features to the neighboring nodes followed by feature transformation and activation function of the form
65
+
66
+ $$
67
+ H ^ { ( l + 1 ) } = \sigma \Bigl ( \sum _ { s } C ^ { ( s ) } H ^ { ( l ) } W ^ { ( l , s ) } \Bigr ) ,
68
+ $$
69
+
70
+ where $C ^ { ( s ) } \in \mathbb { R } ^ { n \times n }$ is the $s$ -th convolution support that defines how the node features are propagated to the neighboring nodes. Within this generalization, GNNs differ from each other by the choice of convolution supports $C ^ { ( s ) }$ . This formulation generalizes many different kinds of Graph Convolutions, as well as Euclidean domain convolutions, which can be seen in Appendix A with the detailed schema.
71
+
72
+ Definition 1. A Trainable-support is a Graph Convolution Support $C ^ { ( s ) }$ with at least one trainable parameter that can be tuned during training. If $C ^ { ( s ) }$ has no trainable parameters, i.e. when the supports are pre-designed, it is called a fixed-support graph convolution.
73
+
74
+ In the trainable support case, supports can be different in each layer, which can be shown by $C ^ { ( l , s ) }$ for the $s$ -th support in layer $l$ . Formally, we can define a trainable support by:
75
+
76
+ $$
77
+ \left( C ^ { ( l , s ) } \right) _ { v , u } = h _ { s , l } \left( H _ { : v } ^ { ( l ) } , H _ { : u } ^ { ( l ) } , E _ { v , u } ^ { ( l ) } , A \right) ,
78
+ $$
79
+
80
+ where $E _ { v , u } ^ { ( l ) }$ shows edge features on layer $l$ from node $v$ to node $u$ if it is available and $h ( . )$ is any trainable model parametrized by $( s , l )$ .
81
+
82
+ Theorem 1. Spectral GNN parameterized with $B$ of entries $B _ { i , j } = \Phi _ { j } ( \lambda _ { i } )$ , defined as
83
+
84
+ $$
85
+ H _ { j } ^ { ( l + 1 ) } = \sigma \Big ( \sum _ { i = 1 } ^ { f _ { l } } U \operatorname { d i a g } \Big ( B \Big [ W _ { i , j } ^ { ( l , 1 ) } , \ldots , W _ { i , j } ^ { ( l , s _ { e } ) } \Big ] ^ { \top } \Big ) U ^ { \top } H _ { i } ^ { ( l ) } \Big ) ,
86
+ $$
87
+
88
+ is a particular case of framework in equation $^ 3$ with the convolution kernel set to
89
+
90
+ $$
91
+ \begin{array} { r } { C ^ { ( s ) } = U \mathrm { d i a g } ( \Phi _ { s } ( \pmb { \lambda } ) ) U ^ { \top } . } \end{array}
92
+ $$
93
+
94
+ The proof can be found in Appendix B. This theorem is general and it covers many well-known spectral GNNs, such as non-parametric spectral graph convolution (Henaff et al., 2015), polynomial parameterization (Defferrard et al., 2016), cubic $\mathbf { B }$ -spline parameterization (Bruna et al., 2013), CayleyNet (Levie et al., 2019) and also any custom designed graph convolution. From Theorem 1, one can see that the spatial and spectral GNNs work all the same way. Therefore, Fourier calculations are not necessary when convolutions are parameterized by $B$ . As a consequence of Theorem 1, one can see that the separation of spectral and spatial GNNs is just an interpretation. The only difference is the way convolution supports are designed: either in the spectral domain or in the spatial one.
95
+
96
+ Definition 2. A Spectral-designed graph convolution refers to a convolution where supports are written as a function of eigenvalues $( \Phi _ { s } ( \lambda ) )$ and eigenvectors $( U )$ of the corresponding graph Laplacian (equation 6). Thus, each convolution support $C ^ { ( s ) }$ has the same frequency response $\Phi _ { s } ( \lambda )$ over different graphs. Graph convolution out of this definition is called spatial-designed graph convolution.
97
+
98
+ Corollary 1.1. The frequency profile of any given graph convolution support $C ^ { ( s ) }$ can be defined in spectral domain by
99
+
100
+ $$
101
+ \Phi _ { s } ( \lambda ) = d i a g ^ { - 1 } ( U ^ { \top } C ^ { ( s ) } U ) .
102
+ $$
103
+
104
+ where diag $^ { - 1 } ( . )$ returns the vector made of the diagonal elements from the given matrix.
105
+
106
+ The proof of this corollary is given in Appendix C. This corollary leads to the spectral analysis of any given graph convolution support, including spatial-designed convolutions. Since the spatialdesigned convolutions do not fit into equation 6, $\bar { U } ^ { \top } C ^ { ( s ) } U$ is not a diagonal matrix. Therefore, we also compute the full frequency profile by $\Phi _ { s } = U ^ { \top } C ^ { ( s ) } U$ , which includes all eigenvectors pairwise contributions for spatial-designed convolutions.
107
+
108
+ # 4 THEORETICAL FREQUENCY RESPONSE OF GRAPH CONVOLUTIONS
109
+
110
+ This section aims at providing a theoretical understanding of the graph convolution process through an analysis in the spectral domain of existing GNNs. To the best of our knowledge, no one has led such an analysis concerning graph convolutions in the literature. This analysis is based on a reformulation of existing graph convolutions in our general framework (equation 3), and based on deriving analytical expressions of $\Phi _ { s } ( \lambda )$ (equation 7 in Corollary 1.1) for each convolution support of concerned graph convolution process. All proofs are provided in Appendices.
111
+
112
+ The theoretical frequency response of ChebNet (Defferrard et al., 2016) convolutions is given by the following theorem.
113
+
114
+ Theorem 2. The theoretical frequency response of each support of ChebNet can be defined as
115
+
116
+ $$
117
+ \Phi _ { 1 } ( \lambda ) = { \bf 1 } , ~ \Phi _ { 2 } ( \lambda ) = \frac { 2 \lambda } { \lambda _ { \mathrm { m a x } } } - { \bf 1 } , ~ \Phi _ { k } ( \lambda ) = 2 \Phi _ { 2 } ( \lambda ) \Phi _ { k - 1 } ( \lambda ) - \Phi _ { k - 2 } ( \lambda ) ,
118
+ $$
119
+
120
+ where 1 is the vector of ones and $\lambda _ { \mathrm { m a x } }$ is the maximum eigenvalue.
121
+
122
+ The proof of Theorem 2 is given in Appendix D. Since it has no trainable parameter in the supports and all support frequency responses do not depend on the graph, we can classify ChebNet as spectral-designed fixed-support graph convolution.
123
+
124
+ The theoretical frequency response of CayleyNet (Levie et al., 2019) convolution is given in the following theorem, and its proof is given in Appendix E.
125
+
126
+ Theorem 3. The theoretical frequency response of each support of CayleyNet can be defined as
127
+
128
+ $$
129
+ \Phi _ { s } ( \lambda ) = \left\{ \begin{array} { l l } { 1 } & { i f s = 1 } \\ { \cos ( \frac { s } { 2 } \theta ( h \lambda ) ) } & { i f s \in \{ 2 , 4 , \ldots , 2 r \} } \\ { - \sin ( \frac { s - 1 } { 2 } \theta ( h \lambda ) ) } & { i f s \in \{ 3 , 5 , \ldots , 2 r + 1 \} } \end{array} \right.
130
+ $$
131
+
132
+ where h is a trainable scalar and $\theta ( x ) = a t a n 2 ( - 1 , x ) - a t a n 2 ( 1 , x ) .$ .
133
+
134
+ Since it has a trainable parameter $h$ in the supports and all support frequency responses do not depend on the graph, we can classify CayleyNet as spectral-designed trainable-support graph convolution.
135
+
136
+ GCN (Kipf & Welling, 2017) uses a single convolution support and its theoretical frequency response is defined approximately in the following theorem, and its proof is given in Appendix F.
137
+
138
+ Theorem 4. The theoretical frequency response of GCN support can be approximated as
139
+
140
+ $$
141
+ \Phi ( \lambda ) \approx { \bf 1 } - \lambda \overline { { p } } / ( \overline { { p } } + 1 ) ,
142
+ $$
143
+
144
+ where $\overline { { p } }$ is the average node degree in the graph.
145
+
146
+ Since its support has no trainable parameter but the frequency response is not independent of the graph, we can classify GCN as spatial-designed fixed-support graph convolution.
147
+
148
+ Graph Isomorphism Network (GIN) defined in $\mathrm { X u }$ et al. (2019) has attracted a lot of interests from the community, mostly because of its simple convolution mechanism. It has a single convolution support and its theoretical frequency response is given in the following theorem:
149
+
150
+ Theorem 5. The theoretical frequency response of GIN support can be approximated as
151
+
152
+ $$
153
+ \Phi ( \lambda ) \approx \overline { { { p } } } \left( \frac { 1 + \epsilon } { \overline { { { p } } } } + 1 - \lambda \right)
154
+ $$
155
+
156
+ where  is a trainable scalar.
157
+
158
+ The proof of this theorem is in Appendix G. Since its support has trainable parameters but the frequency response depends on the graph structure, we classify GIN as spatial-designed trainablesupport graph convolution.
159
+
160
+ Graph attention networks (GATs) in (Velickovi ˇ c et al., 2018) proposes an application for graph world ´ of the attention mechanism from Vaswani et al. (2017). Due to the fact that graphs are invariant to the node order, GAT cannot use positional encoding. In addition, instead of considering that all nodes are connected to each other, GAT just assigns attention weights to the node itself and the connected ones according to adjacency (sparse attention). Thus, we can see its convolution support as weighted, self loop added adjacency. GAT can be represented in our framework in equation 3 by defining trainable convolution supports as follows:
161
+
162
+ $$
163
+ \left( C ^ { ( l , s ) } \right) _ { v , u } = \frac { e _ { v , u } } { \sum _ { k \in \tilde { \mathcal { N } } ( v ) } e _ { v , k } } ,
164
+ $$
165
+
166
+ where $\begin{array} { r } { e _ { v , u } = \exp \left( \sigma ( \mathbf { a } ^ { ( l , s ) } [ H _ { : v } ^ { ( l ) } W ^ { ( l , s ) } | | H _ { : u } ^ { ( l ) } W ^ { ( l , s ) } ] ) \right) } \end{array}$ , and $\mathbf { a } ^ { ( l , s ) }$ is another trainable weight. Convolution support will be calculated from node $v$ to each element of $\tilde { \mathcal { N } } ( v )$ , which shows the selfconnection added neighborhood. Thus, we classify GAT as spatial-designed trainable-support graph neural network in our framework. Since convolution supports are function of connected node features, a theoretical frequency response is not possible to formulate.All studied models are summarised in Table 1.
167
+
168
+ # 5 EXPERIMENTAL RESULTS
169
+
170
+ This section is dedicated to empirical spectral analysis of existing GNNs on some certain graphs to validate the theoretical results and also performance analysis of these GNNs on a benchmark graph
171
+
172
+ Table 1: Summary of the studied GNN models.
173
+
174
+ <table><tr><td></td><td>Design</td><td>Support Type</td><td>Convolution Matrix</td><td>Frequency Response</td></tr><tr><td>MLP</td><td>Spectral</td><td>Fixed</td><td>C=I</td><td>Φ(λ)=1</td></tr><tr><td>GCN</td><td>Spatial</td><td>Fixed</td><td>C = D-0.5AD-0.5</td><td>Φ(λ)≈1-λp/(𝑝+1)</td></tr><tr><td>GIN</td><td>Spatial</td><td>Trainable</td><td>C=A+(1+ε)I</td><td>Φ(λ)~p(¹+1-λ)</td></tr><tr><td>GAT</td><td>Spatial</td><td>Trainable</td><td></td><td>NA</td></tr><tr><td rowspan="3">CayleyNeta</td><td rowspan="3">Spectral</td><td rowspan="3">Trainable</td><td>C(1)= I</td><td>Φ1(λ)=1</td></tr><tr><td>C(2r)=Re(p(hL)T)</td><td>Φ2r(λ)=cos(r0(hλ))</td></tr><tr><td>C(2r+1) =Re(ip(hL)&quot;)</td><td>Φ2r+1(λ)=-sin(r(hλ))</td></tr><tr><td rowspan="2">ChebNet</td><td rowspan="2">Spectral</td><td rowspan="2">Fixed</td><td>C(1)= I</td><td>Φ1(λ)=1</td></tr><tr><td>C(2)= 2L/λmax -I</td><td>Φ2(λ)=2X/入max-1</td></tr><tr><td></td><td></td><td></td><td></td><td>C(s)=2C(2)C(s-1)-C(s-2) Φ𝑠(λ)=2Φ2(λ)Φs-1(λ)-Φs-2(λ)</td></tr></table>
175
+
176
+ $^ a _ { \mathbf { \delta } } \rho ( \mathbf { { \boldsymbol } x } ) = ( \mathbf { { \boldsymbol } x } - { \mathbf i } I ) / ( { \boldsymbol } x + { \mathbf i } I )$
177
+
178
+ dataset to demonstrate the necessity of having various frequency responses convolution supports.
179
+ The implementation and the introduced datasets are publicly available1.
180
+
181
+ # 5.1 SPECTRAL ANALYSIS RESULTS
182
+
183
+ All empirical analyses are based on obtaining convolution supports matrix for certain GNN model, followed by equation 7 to obtain the frequency response. In our analysis, we used three graphs independently: the first is a 1D signal encoded as a regular circular line graph with 1001 nodes; the others are the well-known Cora and CiteSeer graphs with 2708 and 3327 nodes respectively (Yang et al., 2016). Besides, we used 2 different collections of graph datasets, ENZYMES and PROTEIN, which have 600 and 1113 graph respectively (Kersting et al., 2016). The details of the graphs can be found in Appendix L.
184
+
185
+ ![](images/19b065b61c3cb8af90c405e6f4c0f9d9d7664fea39451e6322e80a87050e897f.jpg)
186
+ Figure 1: Frequency profiles $( \Phi _ { s } ( \lambda ) )$
187
+
188
+ Since ChebNet and CayleyNet are spectral-designed, their frequency responses do not change for different graphs. They are presented in Figure 1 for first 5 and 7 supports respectively. The results in Figure 1 confirm the theoretical analyses in Theorem 2 and Theorem 3. The full frequency profiles are not illustrated because they consist of zeros outside the diagonal. Analyzing the frequency profile of ChebNet, one can argue that the convolutions mostly cover the spectrum. However, none of the kernels focuses on some certain parts of the spectrum. As an example, the second kernel is mostly a low-pass and high-pass filter and stops the middle band, while the third one passes very high, very low and middle bands, but stops almost first and third quarter of the spectrum. Therefore, if the relation between input-output pairs can be figured out by just a low-pass, high-pass or some specific band-pass filter, a high number of convolution kernels is needed. However, in the literature, only 2 or 3 kernels are generally used in experiments (Defferrard et al., 2016; Kipf & Welling, 2017).
189
+
190
+ The scale parameter $h$ in CayleyNet affects the $\mathbf { X }$ -axis scaling, but does not change the global shape. When $h = 1$ , frequency profiles can be defined within the range [0, 2] (because $\lambda _ { \operatorname* { m a x } } = 2$ in all three test graphs). If $h = 1 . 5$ , the frequency profile can be defined till $1 . 5 \lambda _ { \mathrm { m a x } } = 3$ in Figure 1 and rescale axis label from [0, 3] to $[ 0 , 2 ]$ in original range. Learning the scaling of eigenvalues may seem advantageous. However, it induces extra computational cost in order to calculate the new convolution supports in every learning epoch. In addition, similarly to ChebNet, CayleyNet does not have any band specific convolutions, even when considering different scaling factors.
191
+
192
+ ![](images/afb03588eac5b3ee25ba0d1263e017c540e594c95eac7794752c3043a2f3c37f.jpg)
193
+ Figure 2: Frequency profiles of GCN on 1D, Cora, CiteSeer graph and GIN on 1D and CiteSeer graph with $\epsilon = 1 , 0 , - 1 , - 2$
194
+
195
+ When the given graph is a regular graph where each node degree is the same (2 for 1D graph case), theoretical frequency responses become certain as seen in Figure 2a in blue for GCN and Figure 2b for GIN. When $\epsilon = 2$ , 1D graph’s $( { \overline { { p } } } = 2 )$ ) frequency responses of GCN and GIN are the same except scaling factor as seen in blue Figure 2a yellow in Figure 2b. However in realistic graphs, both GIN and GCN are not spectral-designed, their frequency responses differ for different graphs. As Theorem 4 and Theorem 5 demonstrate, GCN’s and GIN’s frequency responses depend on the average node degree. GCN’s cut-off frequency decrease by increasing the $\overline { { p } }$ while $\overline { { p } }$ acts as scaling factor on GIN’s frequency response. This analysis leads us to understand that GCN works as lowpass filter and does not cover the whole spectrum. This approach is not able to learn relations that can be represented by high-pass or band-pass filtering. Hence, even though it gives very good results on a single graph node classification problem in Kipf & Welling (2017), it may fail for problems where discriminant information lies in particular frequency bands. Therefore, such an approach can be considered as problem specific.
196
+
197
+ In order to create some variations between low-pass to high-pass, having trainable parameter in GIN’s convolution support seems advantageous. But, since it is not spectral-designed, there is no guarantee that it has exactly the same spectral profiles for different graphs. Besides, its low-pass shape (where $\epsilon$ is high) is a linearly decreasing function, thus it is not a strong low-pass that generally natural graph problems need. Using more stacked layer may be a solution. In addition, this convolution cannot focus on some certain bands if the problem needs.
198
+
199
+ Since the GAT’s convolution supports are function of connected nodes feature, frequency profiles cannot be directly computed similarly to previous ones. Thus, we proposed to obtain frequency response by two ways, one is the expected frequency responses among simulations, the other is the frequency responses of trained model for any specific graph learning problem.
200
+
201
+ We calculated the expected frequency responses of GAT convolution supports on Cora graph by simulation of randomly created 240 possible attention weights. The expected value of simulated support’s frequency response and its standard deviation are shown in Figure 3a. This result gives an idea about the capability of the model on spectral domain, without being the true learned convolution support. In addition, the simulation is just for the first layer, because the first layer’s input is known without learning. Besides, we also provide in Figure 3b-c the frequency responses of all learned GAT attention head’s in all layers for all the graphs of ENZYMES and PROTEINS datasets respectively (in our model, there are two GNN layer consisting of 25 attention head). Since there is no significant differences between frequency responses in different layer or different attention head, we stacked all together in the same heat map.
202
+
203
+ ![](images/1076fe9a2d2d649b20314616adb59ade3b93501f6cf8cc42ed706a862e08227b.jpg)
204
+ Figure 3: Frequency profiles of GAT
205
+
206
+ As one can see, the mean standard frequency profile has a similar shape than those of GCN and GIN0 which are methods that use self-looped added (normalized or not) adjacency matrix as convolution support. Variations on the frequency profile induce more variations on output signal when compared to GCN and GIN-0. However, the variation on frequency profile might not be sufficient in problems that need some specific band-pass filters.
207
+
208
+ # 5.2 PERFORMANCE ANALYSIS OF GNNS
209
+
210
+ First, our goal was to assess empirically the ability of GNN models to produce the desired frequency effects on given graph signals. With the conducted experiments detailed in Appendix I, we can outline the empirical results as follows. GCN and GAT can produce low-pass effects but not band-pass or high-pass, while GAT has better variation on frequency profile; these empirical results corroborate the theoretical analysis of this paper, namely Theorem 4 and Section 5.1. Thanks to its trainable parameter , GIN can do better on producing low-pass and high-pass effects, but not band-pass, as demonstrated by Theorem 5. However, the spectral-designed ChebNet always outperformed the rest with a huge margin, which is not surprising.
211
+
212
+ Secondly, we measured the generalization capability of the GNN model for graph classification task as a toy example where the graph classes depend on the frequency of the signal on the graph. The conducted experiments are described in Appendix J. Again, we seen that GCN and GAT performed worse than GIN, because of their inability to catch necessary frequency components. Besides, thanks to the spectral-designed convolutions, ChebNet can catch the underlying patterns on the graphs and finally achieves better results.
213
+
214
+ Some graph problems naturally just need low-pass filtering, as we argued in Appendix K. Having spectral ability may increase the complexity of the model, which may result in a negative effect. However, some other problems might need various kind of filters, like image understanding problems. In our last experiment, we use the superpixel version of MNIST dataset (MNIST-75) 2 to show an example of graph problems that need various filtering. In MNIST-75, images are segmented into around 75 regions by the SLIC superpixel segmentation algorithm (Achanta et al., 2012). Regions constitute the nodes of the graph and edges correspond to connection between regions in the image. The average pixel value of this region was assign to node, giving one continuous value. The dataset also includes the center position of each region, but we excluded that information to make the problem more realistic and harder in terms of graph research. The dataset consists of 55K graphs for training, 5K graphs for validation and 10K for testing. Details and some illustrations of the dataset can be found in Appendix L.
215
+
216
+ We use 3 hidden graph convolution layers that have 64, 128, and 128 features respectively, followed by a global mean operator as graph readout layer, and ended by a fully connected layer with 10 outputs corresponding to the number of classes. To understand the effect of graph convolution, we apply the tests on 3 different inputs: the first one uses node degree as feature, the second one uses pixel values and the last one uses both information. Implementation details and hyperparameter tuning can be found in Appendix L.
217
+
218
+ Table 2: Test set accuracies on MNIST superpixel dataset
219
+
220
+ <table><tr><td>Node feature</td><td>MLP</td><td>GCN</td><td>GIN</td><td>GAT</td><td>CayleyNet</td><td>ChebNet</td></tr><tr><td>Node degree</td><td>11.29±0.5</td><td>15.81±0.8</td><td>32.45±1.2</td><td>31.72±1.5</td><td>45.61±1.7</td><td>46.23±1.8</td></tr><tr><td>Pixel value</td><td>12.11±0.5</td><td>11.35±1.1</td><td>64.96±3.9</td><td>62.61±2.9</td><td>88.41±2.1</td><td>91.10±1.9</td></tr><tr><td>Both</td><td>25.10±1.2</td><td>52.98±3.1</td><td>75.23±4.1</td><td>82.73±2.1</td><td>90.31±2.3</td><td>92.08±2.2</td></tr></table>
221
+
222
+ Table 2 gives the mean and standard deviation of the accuracy obtained over 10 runs on the test set, with different seed numbers. It is well known that the image version of the MNIST dataset can be processed by any ordinary CNN architecture, which is able to apply various filtering operations. Hence, we argue that superpixel graph of MNIST is a good candidate to show if the graph data needs various kind of filtering. As seen in Table 2, MLP and GCN cannot do significantly better than a random classifier when using only node degree or pixel value as input. That means that the distribution of node degrees or pixel values has no significant meaning for classification. When both node degree and pixel values are given, the accuracy of GCN is increased, but remains behind the best results. GIN and GAT outperform GCN in each case, but their performances remain behind those of ChebNet and CayleyNet, which are spectral-designed with supports that cover the spectrum.
223
+
224
+ # 6 FINAL REMARKS
225
+
226
+ In this paper, we have shown that most influential graph convolutions such as (Kipf & Welling, 2017; Velickovi ˇ c et al., 2018) operate as low-pass filters and some have a very limited ability on producing ´ high-pass in addition to low-pass filtering effect such as (Xu et al., 2019).
227
+
228
+ Interestingly, while being restricted to low-pass filters, they obtain state-of-the-art performance on reference node classification problems such as Cora, CiteSeer and Pubmed (Yang et al., 2016). These good results on these particular problems are induced by the nature of the graphs to be processed. Indeed, citation network problems, which are heavily assortative, are inherently low-pass filtering problems.
229
+
230
+ It is worth noting that, if we use enough convolution kernels, the frequency response of ChebNet kernels (Defferrard et al., 2016; Levie et al., 2019) covers nearly all frequency profiles. However, these frequency responses are not specific to special bands of frequency. It means that they can act as high-pass filters, but not as Gabor-like special band-pass filters,if a low number of convolution supports are used (e.g. 3). Getting any arbitrary band-pass effect requires a large number of convolution kernels, which makes the convolution not spatially-localized and increases the computational complexity.
231
+
232
+ As a conclusion, we claim that graph convolutions are problem specific and not problem agnostic. To have problem agnostic solutions, graph convolutions need to be able to produce necessary or at least plenty of different frequencies in output signal profile. The frequency profile of graph convolutions is not the single issue to be taken into account. But it is definitely one of the important perspectives that we need to pay attention. We point out that using only low-pass GNNs may not be a good choice for many graph problems. Finally, the convolution design can be considered as the tuning of hyperparameters or it can be automatically designed by another secondary unsupervised task with respect to the problem domain. Our future work will investigate this track. Experiments conducted in Section 5 provided empirical results to validate the theoretical analysis conducted in this paper.
233
+
234
+ # ACKNOWLEDGMENTS
235
+
236
+ This work was partially supported by the French Agence National de Recherche (ANR), grant APi (ANR-18-CE23-0014), and the PAUSE Program (College de France). \`
237
+
238
+ # REFERENCES
239
+
240
+ Radhakrishna Achanta, Appu Shaji, Kevin Smith, Aurelien Lucchi, Pascal Fua, and Sabine Susstrunk. Slic superpixels compared to state-of-the-art superpixel methods. ¨ IEEE transactions on pattern analysis and machine intelligence, 34(11):2274–2282, 2012.
241
+
242
+ Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018.
243
+
244
+ Xavier Bresson and Thomas Laurent. Residual gated graph convnets, 2018. URL https:// openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HyXBcYg0b.
245
+
246
+ Michael M. Bronstein, Joan Bruna, Yann LeCun, Arthur Szlam, and Pierre Vandergheynst. Geometric deep learning: Going beyond euclidean data. IEEE Signal Processing Magazine, 34(4): 18–42, July 2017.
247
+
248
+ Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. arXiv preprint arXiv:1312.6203, 2013.
249
+
250
+ Ines Chami, Sami Abu-El-Haija, Bryan Perozzi, Christopher Re, and Kevin Murphy. Machine ´ learning on graphs: A model and comprehensive taxonomy. arXiv preprint arXiv:2005.03675, 2020.
251
+
252
+ F.R.K. Chung. Spectral graph theory. American Mathematical Society, 1997.
253
+
254
+ Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks ¨ on graphs with fast localized spectral filtering. In Advances in Neural Information Processing Systems, pp. 3844–3852, 2016.
255
+
256
+ David K. Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Thimothy Hirzel, Alan Aspuru-Guzik, and Ryan P. Adams. Convolutional networks on graphs for learning molecular fingerprints. In Advances in Neural Information Processing Systems, pp. 2224–2232, 2015.
257
+
258
+ Matthias Fey, Jan Eric Lenssen, Frank Weichert, and Heinrich Muller. Splinecnn: Fast geomet- ¨ ric deep learning with continuous b-spline kernels. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 869–877, 2018.
259
+
260
+ Justin Gilmer, Samuel S. Schoenholz, Patrick F. Riley, Oriol Vinyal, and George E. Dahl. Neural message passing from quantum chemistry. In Proceedings of the International Conference on Machine Learning, 2017.
261
+
262
+ Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems, pp. 1024–1034, 2017.
263
+
264
+ David K Hammond, Pierre Vandergheynst, and Remi Gribonval. Wavelets on graphs via spectral ´ graph theory. Applied and Computational Harmonic Analysis, 30(2):129–150, 2011.
265
+
266
+ Mikael Henaff, Joan Bruna, and Yann LeCun. Deep convolutional networks on graph-structured data. arXiv preprint arXiv:1506.05163, 2015.
267
+
268
+ Kristian Kersting, Nils M. Kriege, Christopher Morris, Petra Mutzel, and Marion Neumann. Benchmark data sets for graph kernels, 2016. http://graphkernels.cs.tu-dortmund.de.
269
+
270
+ Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations (ICLR), 2017.
271
+
272
+ R. Levie, F. Monti, X. Bresson, and M. M. Bronstein. Cayleynets: Graph convolutional neural networks with complex rational spectral filters. IEEE Transactions on Signal Processing, 67(1): 97–109, Jan 2019. ISSN 1941-0476. doi: 10.1109/TSP.2018.2879624.
273
+
274
+ Meng Liu, Zhengyang Wang, and Shuiwang Ji. Non-local graph neural networks, 2020.
275
+
276
+ Haggai Maron, Heli Ben-Hamu, Hadar Serviansky, and Yaron Lipman. Provably powerful graph networks. In Advances in Neural Information Processing Systems, pp. 2156–2167, 2019a.
277
+
278
+ Haggai Maron, Heli Ben-Hamu, Nadav Shamir, and Yaron Lipman. Invariant and equivariant graph networks. In International Conference on Learning Representations, 2019b. URL https: //openreview.net/forum?id $=$ Syx72jC9tm.
279
+
280
+ Fernand Meyer. Topographic distance and watershed lines. Signal processing, 38(1):113–125, 1994.
281
+
282
+ Federico Monti, Davide Boscaini, Jonathan Masci, Emanuele Rodola, Jan Svoboda, and Michael M Bronstein. Geometric deep learning on graphs and manifolds using mixture model cnns. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5115– 5124, 2017.
283
+
284
+ Christopher Morris, Martin Ritzert, Matthias Fey, William L Hamilton, Jan Eric Lenssen, Gaurav Rattan, and Martin Grohe. Weisfeiler and leman go neural: Higher-order graph neural networks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 4602–4609, 2019.
285
+
286
+ Mathias Niepert, Mohamed Ahmed, and Konstantin Kutzkov. Learning convolutional neural networks for graphs. In Proceedings of the International Conference on Machine Learning, pp. 2014–2023, 2016.
287
+
288
+ Hoang NT and Takanori Maehara. Revisiting graph neural networks: All we have is low-pass filters. arXiv preprint arXiv:1905.09550, 2019.
289
+
290
+ David I Shuman, Sunil K Narang, Pascal Frossard, Antonio Ortega, and Pierre Vandergheynst. The emerging field of signal processing on graphs: Extending high-dimensional data analysis to networks and other irregular domains. IEEE signal processing magazine, 30(3):83–98, 2013.
291
+
292
+ 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.
293
+
294
+ Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph attention networks. In International Conference on Learning Representations (ICLR), 2018.
295
+
296
+ Felix Wu, Tianyi Zhang, Amauri Holanda de Souza Jr, Christopher Fifty, Tao Yu, and Kilian Q Weinberger. Simplifying graph convolutional networks. In International Conference on Machine Learning (ICML), 2019a.
297
+
298
+ Zonghan Wu, Shirui Pan, Fengwen Chen, Guodong Long, Chengqi Zhang, and Philip S. Yu. A comprehensive survey on graph neural networks. arXiv preprint arXiv:1901.00596, 2019b.
299
+
300
+ Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In International Conference on Learning Representations, 2019.
301
+
302
+ Zhilin Yang, William W. Cohen, and Ruslan Salakhutdinov. Revisiting semi-supervised learning with graph embeddings. In Proceedings of the 33rd International Conference on International Conference on Machine Learning, ICML’16, 2016.
303
+
304
+ # A GENERALISATION OF FRAMEWORK
305
+
306
+ ![](images/16734e5d80abac3b6068fe80deb115848d4d17fbf0cb5d7a6f3232c3aad1e806.jpg)
307
+ Figure 4: a) Schematic of the graph convolution layer defined in equation 3. The graph has 12 nodes and 12 edges. In the l-th layer, each node has a 2-length feature vector H(1 l) and H (l)2 r epresented by colors. The l + 1-th layer, it has a 3-length feature vector, denoted H(l+1)1 , $H _ { 2 } ^ { ( l + 1 ) }$ 1) and H (l+1)3 . Two convolution supports $C ^ { ( 1 ) }$ and $C ^ { ( 2 ) }$ are used. This architecture has 12 trainable parameters, omitting biases if the convolution supports $C ^ { ( 1 ) }$ and $C ^ { ( 2 ) }$ are fixed. b) Graph convolution supports for 2D Euclidean domain signal to perform convolution process by $3 \times 3$ mask.
308
+
309
+ Our selection of GNN generalization in equation 3 can be shown in Figure 4a with a detailed schematic of graph convolution layer on a sample graph signal. This framework can also generalize the Euclidean domain convolution layer. For 2D signal convolution by $\widetilde { W } ^ { ( l ) } \in \mathbb { R } ^ { 3 \times 3 }$ mask, we can define 9 different convolution supports denoted by $\mathbf { \bar { \cal C } } ^ { ( 1 ) } \dots { \cal C } ^ { ( 9 ) } \in \{ 0 , 1 \} ^ { 1 6 \times 1 6 }$ in Figure 4 for sample signal (e.g. image) shown by $\widetilde { H } ^ { ( l ) } \in \mathbb { R } ^ { 4 \times 4 }$ . When we stack all node values (e.g. pixels) into column vector $H ^ { ( l ) } \in \mathbb { R } ^ { 1 6 \times 1 }$ , and $W ^ { ( l , s ) }$ shows $s$ -th scalar weight in stacked $\widetilde { W } ^ { ( l ) }$ , we can write equivalence of Euclidean convolution by:
310
+
311
+ $$
312
+ \widetilde { \cal H } ^ { ( l ) } \circledast \widetilde { \cal W } ^ { ( l ) } = \sum _ { s = 1 } ^ { 9 } { \cal C } ^ { ( s ) } { \cal H } ^ { ( l ) } { \cal W } ^ { ( l , s ) } ,
313
+ $$
314
+
315
+ One can see that in Euclidean domain, the supports can be designed by relative position of the nodes which is not the case in graph world.
316
+
317
+ # B PROOF OF THEOREM 1
318
+
319
+ Proof. First, let us expand the $B$ matrix by introducing its columns denoted $\Phi _ { 1 } ( \lambda ) , \ldots , \Phi _ { S } ( \lambda ) \in$ $\mathbb { R } ^ { n }$ :
320
+
321
+ $$
322
+ H _ { j } ^ { ( l + 1 ) } = \sigma \left( \sum _ { i = 1 } ^ { f _ { l } } U \mathrm { d i a g } \Big ( \sum _ { s = 1 } ^ { S } W _ { i , j } ^ { ( l , s ) } \Phi _ { s } ( \pmb { \lambda } ) \Big ) U ^ { \top } H _ { i } ^ { ( l ) } \right) .
323
+ $$
324
+
325
+ Now, we distribute $U$ and $U ^ { \top }$ over the inner summation:
326
+
327
+ $$
328
+ H _ { j } ^ { ( l + 1 ) } = \sigma \left( \sum _ { s = 1 } ^ { S } \sum _ { i = 1 } ^ { f _ { l } } U \mathrm { d i a g } \Big ( W _ { i , j } ^ { ( l , s ) } \Phi _ { s } ( \pmb { \lambda } ) \Big ) U ^ { \top } H _ { i } ^ { ( l ) } \right) .
329
+ $$
330
+
331
+ Then, we take out the scalars W (l,s)i,j of the diag operator:
332
+
333
+ $$
334
+ H _ { j } ^ { ( l + 1 ) } = \sigma \left( \sum _ { s = 1 } ^ { S } \sum _ { i = 1 } ^ { f _ { l } } W _ { i , j } ^ { ( l , s ) } U \mathrm { d i a g } ( \Phi _ { s } ( \mathbf { \boldsymbol { \lambda } } ) ) U ^ { \top } H _ { i } ^ { ( l ) } \right) .
335
+ $$
336
+
337
+ Let us define a convolution operator $C ^ { ( s ) } \in \mathbb { R } ^ { n \times n }$ as:
338
+
339
+ $$
340
+ \begin{array} { r } { C ^ { ( s ) } = U \mathrm { d i a g } ( \Phi _ { s } ( \pmb { \lambda } ) ) U ^ { \top } . } \end{array}
341
+ $$
342
+
343
+ Using equation 16 and equation 17, we have thus:
344
+
345
+ $$
346
+ H _ { j } ^ { ( l + 1 ) } = \sigma \left( \sum _ { i = 1 } ^ { f _ { l } } \sum _ { s = 1 } ^ { S } W _ { i , j } ^ { ( l , s ) } C ^ { ( s ) } H _ { i } ^ { ( l ) } \right) .
347
+ $$
348
+
349
+ Then, each term of the sum over $s$ corresponds to a matrix $H ^ { ( l + 1 ) } \in \mathbb { R } ^ { n \times f _ { l + 1 } }$ with
350
+
351
+ $$
352
+ \begin{array} { r } { \boldsymbol { H } ^ { ( l + 1 ) } = \sigma \left( \boldsymbol { C } ^ { ( 1 ) } \boldsymbol { H } ^ { ( l ) } \boldsymbol { W } ^ { ( l , 1 ) } + \cdots + \boldsymbol { C } ^ { ( S ) } \boldsymbol { H } ^ { ( l ) } \boldsymbol { W } ^ { ( l , S ) } \right) , } \end{array}
353
+ $$
354
+
355
+ with $H ^ { ( l ) } = [ H _ { 1 } ^ { ( l ) } , \dots , H _ { f _ { l } } ^ { ( l ) } ]$ . We get by grouping the terms:
356
+
357
+ $$
358
+ H ^ { ( l + 1 ) } = \sigma \left( \sum _ { s = 1 } ^ { S } C ^ { ( s ) } H ^ { ( l ) } W ^ { ( l , s ) } \right) ,
359
+ $$
360
+
361
+ which corresponds to equation 3. Therefore, equation 5 corresponds to equation 3 with $C ^ { ( s ) }$ defined as equation 6. □
362
+
363
+ # C PROOF OF COROLLARY 1.1
364
+
365
+ Proof. By using equation 6 from Theorem 1, we can obtain a spatial convolution kernel $C ^ { ( s ) }$ whose frequency profile is $\Phi _ { s } ( \lambda )$ . Since the eigenvector matrix is orthonormal (i.e., $U ^ { - 1 } = U ^ { \top }$ ), we can extract $\Phi _ { s } ( \lambda )$ , which yields equation 7. □
366
+
367
+ # D PROOF OF THEOREM 2
368
+
369
+ ChebNet relies on the approximation of a spectral graph analysis proposed in (Hammond et al., 2011), based on the Chebyshev polynomial expansion of the scaled graph Laplacian. Even though its multi supports frequency responses are known, to the sake of simplicity, it was represented in form of equation 3 in (Defferrard et al., 2016) as follows;
370
+
371
+ $$
372
+ C ^ { ( 1 ) } = I , C ^ { ( 2 ) } = 2 L / \lambda _ { \mathrm { m a x } } - I , C ^ { ( k ) } = 2 C ^ { ( 2 ) } C ^ { ( k - 1 ) } - C ^ { ( k - 2 ) } .
373
+ $$
374
+
375
+ Proof. When the identity matrix is used as convolution kernel, it just directly transmits the inputs to the outputs without any modification. This process is called all-pass filter. Mathematically, we can calculate the full frequency profile for kernel $I$ by using Corollary 1.1, namely
376
+
377
+ $$
378
+ \begin{array} { r } { \Phi _ { 1 } = \boldsymbol { U } ^ { \top } \boldsymbol { I } \boldsymbol { U } = \boldsymbol { U } ^ { \top } \boldsymbol { U } = \boldsymbol { I } , } \end{array}
379
+ $$
380
+
381
+ since the eigenvectors are orthonormal. Therefore, we can parametrize the diagonal of the full frequency profile by $\lambda$ and reach the standard frequency profile for the first ChebNet support as follows:
382
+
383
+ $$
384
+ \Phi _ { 1 } ( \lambda ) = \mathrm { d i a g } ( I ) = { \bf 1 } .
385
+ $$
386
+
387
+ We can compute the $C ^ { ( 2 ) }$ kernel full frequency profile using Corollary 1.1:
388
+
389
+ $$
390
+ \Phi _ { 2 } = U ^ { \top } \left( \frac { 2 } { \lambda _ { \operatorname* { m a x } } } L - I \right) U .
391
+ $$
392
+
393
+ Since $U ^ { \top } I U = I$ , equation 24 can be rearranged as
394
+
395
+ $$
396
+ \Phi _ { \mathrm { 2 } } = \frac { \mathrm { 2 } } { \lambda _ { \mathrm { m a x } } } { U } ^ { \top } L U - I .
397
+ $$
398
+
399
+ Since $\pmb { \lambda } = [ \lambda _ { 1 } , \dots , \lambda _ { n } ]$ are the eigenvalues of the graph Laplacian $L$ , those must conform to the following condition:
400
+
401
+ $$
402
+ \begin{array} { r c l } { { { \cal L } U } } & { { = } } & { { U \mathrm { d i a g } ( \lambda ) ; } } \\ { { { \cal U } ^ { \top } { \cal L } U } } & { { = } } & { { \mathrm { d i a g } ( \lambda ) . } } \end{array}
403
+ $$
404
+
405
+ Replacing equation 27 into equation 25, we get
406
+
407
+ $$
408
+ \Phi _ { 2 } = \frac { 2 } { \lambda _ { \mathrm { m a x } } } \mathrm { d i a g } ( \lambda ) - I .
409
+ $$
410
+
411
+ This full frequency profile consists of two parts, a diagonal matrix and the negative identity matrix. Therefore, we can parametrize the full frequency matrix diagonal to show the standard frequency profile as follows:
412
+
413
+ $$
414
+ \Phi _ { 2 } ( \lambda ) = \mathrm { d i a g } ( \Phi _ { 2 } ) = \frac { 2 \lambda } { \lambda _ { \mathrm { m a x } } } - { \bf 1 } .
415
+ $$
416
+
417
+ Given the third and following ChebNet supports, when we use Corollary 1.1, the corresponding frequency profile is
418
+
419
+ $$
420
+ \Phi _ { k } = U ^ { \top } \left( 2 C ^ { ( 2 ) } C ^ { ( k - 1 ) } - C ^ { ( k - 2 ) } \right) U .
421
+ $$
422
+
423
+ By expanding equation 30, we get
424
+
425
+ $$
426
+ \begin{array} { r } { \Phi _ { k } = 2 U ^ { \top } C ^ { ( 2 ) } C ^ { ( k - 1 ) } U - U ^ { \top } C ^ { ( k - 2 ) } U . } \end{array}
427
+ $$
428
+
429
+ Since $U U ^ { \top } = I$ , we can insert the product $U U ^ { \top }$ into equation 31. Thus, we have
430
+
431
+ $$
432
+ \begin{array} { r l } & { \Phi _ { k } = 2 U ^ { \top } C ^ { ( 2 ) } U U ^ { \top } C ^ { ( k - 1 ) } U - U ^ { \top } C ^ { ( k - 2 ) } U } \\ & { \Phi _ { k } = 2 \left( U ^ { \top } C ^ { ( 2 ) } U \right) \left( U ^ { \top } C ^ { ( k - 1 ) } U \right) - U ^ { \top } C ^ { ( k - 2 ) } U . } \end{array}
433
+ $$
434
+
435
+ Since $\Phi _ { k ^ { \prime } } = U ^ { \top } C ^ { ( k ^ { \prime } ) } U$ for any $k ^ { \prime }$ , it yields:
436
+
437
+ $$
438
+ \Phi _ { k } = 2 \Phi _ { 2 } \Phi _ { k - 1 } - \Phi _ { k - 2 } ,
439
+ $$
440
+
441
+ Hence $\Phi _ { 1 }$ and $\Phi _ { 2 }$ are diagonal matrices, and the rest of the kernels frequency profiles become diagonal matrices in equation 34. Therefore, we can write the corresponding standard frequency profiles of third and following ChebNet convolution supports as follows:
442
+
443
+ $$
444
+ \Phi _ { k } ( \pmb { \lambda } ) = 2 \Phi _ { 2 } ( \pmb { \lambda } ) \Phi _ { k - 1 } ( \pmb { \lambda } ) - \Phi _ { k - 2 } ( \pmb { \lambda } ) .
445
+ $$
446
+
447
+ # E PROOF OF THEOREM 3
448
+
449
+ Proof. CayleyNet was originally defined as it uses the weight vector parametrization of $F _ { i } ^ { ( l , j ) } =$ $[ g _ { i , j , l } ( \lambda _ { 1 } , h ) , . . . , g _ { i , j , l } ( \lambda _ { n } , h ) ] ^ { \top }$ in equation 1, where the function $g ( \cdot , \cdot )$ is defined in (Levie et al., 2019) by
450
+
451
+ $$
452
+ g ( \lambda , h ) = c _ { 0 } + 2 R e \left( \sum _ { k = 1 } ^ { r } c _ { k } \left( \frac { h \lambda - \mathbf { i } } { h \lambda + \mathbf { i } } \right) ^ { k } \right) ,
453
+ $$
454
+
455
+ where $\mathbf { i } ^ { 2 } = - 1 , R e ( \cdot )$ is the function that returns the real part of a given complex number, $c _ { 0 }$ is a trainable real coefficient, and $c _ { 1 } , \ldots , c _ { r }$ are complex trainable coefficients. We can write $h \lambda - \mathbf { i }$ in Euler form by $\sqrt { h ^ { 2 } \lambda ^ { 2 } + 1 } . e ^ { \mathbf { i } a t a n 2 ( - 1 , h \lambda ) }$ and for $h \lambda + \mathbf { i }$ by $\sqrt { h ^ { 2 } \lambda ^ { 2 } + 1 } . e ^ { \mathbf { i } a t a n 2 ( 1 , h \lambda ) }$ . By this substitution, equation 36 becomes
456
+
457
+ $$
458
+ g ( \lambda , h ) = c _ { 0 } + 2 R e \left( \sum _ { k = 1 } ^ { r } c _ { k } e ^ { \mathbf { i } k ( a t a n 2 ( - 1 , h \lambda ) - a t a n 2 ( 1 , h \lambda ) ) } \right) .
459
+ $$
460
+
461
+ where atan2 $\left. y , x \right.$ is the inverse tangent function, which finds the angle (in range of $[ - \pi , \pi ] )$ of a point given its $y$ and $x$ coordinates. For further simplification, let us introduce the $\theta ( \cdot )$ function defined by
462
+
463
+ $$
464
+ \theta ( x ) = a t a n 2 ( - 1 , x ) - a t a n 2 ( 1 , x ) .
465
+ $$
466
+
467
+ Since the $c _ { k } s$ are complex numbers, we can write them as a sum of real and imaginary parts, $c _ { k } =$ $a _ { k } / 2 + \mathbf { i } b _ { k } / 2$ (the scale factor 2 is added for convenience). Thus, equation 37 can be rewritten as follows:
468
+
469
+ $$
470
+ g ( \lambda , h ) = c _ { 0 } + R e \left( \sum _ { k = 1 } ^ { r } ( a _ { k } + \mathbf { i } b _ { k } ) e ^ { \mathbf { i } k \theta ( h \lambda ) } \right) .
471
+ $$
472
+
473
+ We can replace $e ^ { \mathbf { i } k \theta ( h \lambda ) }$ with its polar coordinate equivalence form $\cos ( k \theta ( h \lambda ) ) + \mathbf { i } \sin ( k \theta ( h \lambda ) )$ When we remove the imaginary components because of $R e ( \cdot )$ function, equation 39 becomes
474
+
475
+ $$
476
+ g ( \lambda , h ) = c _ { 0 } + \sum _ { k = 1 } ^ { r } a _ { k } \cos ( k \theta ( h \lambda ) ) - b _ { k } \sin ( k \theta ( h \lambda ) ) .
477
+ $$
478
+
479
+ In this definition, there is no complex coefficient, but only real coefficients $( c _ { 0 } , a _ { k }$ and $b _ { k }$ for $k =$ $1 , \ldots , r )$ to be tuned by training. By using the form in equation 40, we can parametrize CayleyNet by the parametrization matrix $\breve { B } \in \breve { \mathbb { R } } ^ { n \times 2 r + 1 }$ by
480
+
481
+ $$
482
+ [ g ( \lambda _ { 0 } , h ) , \ldots , g ( \lambda _ { n } , h ) ] ^ { \top } = B [ c _ { 0 } , a _ { 1 } , b _ { 1 } , \ldots , a _ { r } , b _ { r } ] ^ { \top } .
483
+ $$
484
+
485
+ The $s$ -th column vector of matrix $B$ , denotes $B _ { s }$ , must fulfill the following conditions:
486
+
487
+ $$
488
+ B _ { s } = \Phi _ { s } ( \lambda ) = \left\{ \begin{array} { l l } { 1 } & { \mathrm { i f ~ } s = 1 } \\ { \cos ( \frac { s } { 2 } \theta ( h \lambda ) ) } & { \mathrm { i f ~ } s \in \{ 2 , 4 , . . . , 2 r \} } \\ { - \sin ( \frac { s - 1 } { 2 } \theta ( h \lambda ) ) \mathrm { ~ i f ~ } s \in \{ 3 , 5 , . . . , 2 r + 1 \} } \end{array} \right.
489
+ $$
490
+
491
+ We can see CayleyNet as a spectral graph convolution that uses $2 r + 1$ convolution kernels. The first kernel is an all-pass filter, and the frequency profiles of remaining $2 r$ kernels $( \Phi _ { s } ( \lambda ) )$ are created using sine and cosine functions, with a parameter $h$ used to scale the eigenvalues in equation 42. Considering equation 6 in Theorem 1, we can write CayleyNet’s convolutions $( C ^ { ( s ) } )$ in spatial domain. CayleyNet includes the tuning of this scaling parameter in the training pipeline. Note that because of the function definition in equation 38, $\theta ( h \lambda )$ is not linear in $\lambda$ . Therefore, $\Phi _ { s }$ cannot be a perfect sinusoidal in $\lambda s$ .
492
+
493
+ # F PROOF OF THEOREM 4
494
+
495
+ One major simplification of the ChebNet is Graph Convolution Network (GCN) (Kipf & Welling, 2017), which has single convolution support and already presented in our framework in equation 3. The first proposal of this paper uses the subtraction of the second ChebNet support from the first one under the assumption of $\lambda _ { \operatorname* { m a x } } = 2$ and $L$ is the normalized graph Laplacian, as it is defined by $C _ { G C N ^ { * } } = C ^ { ( 1 ) } - \bar { C ^ { ( 2 ) } } = 2 I - L$ .
496
+
497
+ Proposition 1. $C _ { G C N ^ { * } } = 2 I - L$ is a spectral-designed support and its frequency response is $\Phi _ { G C N ^ { * } } ( \lambda ) = 2 - \lambda$ .
498
+
499
+ Proof. If the assumption is true, it should meet:
500
+
501
+ $$
502
+ 2 I - L = U \mathrm { d i a g } ( 2 - \lambda ) U ^ { \top }
503
+ $$
504
+
505
+ this can be written in the following way as well
506
+
507
+ $$
508
+ 2 I - L = 2 U I U ^ { \top } - U \mathrm { d i a g } ( \lambda ) U ^ { \top }
509
+ $$
510
+
511
+ since $U I U ^ { \top } = I$ and $U \mathrm { d i a g } ( \lambda ) U ^ { \top } = L$ , the proposition is true.
512
+
513
+ One can see that the first proposal of GCN is spectral-designed and it is low-pass filter. That is why GCN is misclassified as a spectral approach in the literature $\mathrm { W u }$ et al., 2019b; Chami et al., 2020). However, instead of using this version, GCN used re-normalization trick and defined its final single convolution support as:
514
+
515
+ $$
516
+ C _ { G C N } = ( D + I ) ^ { - 1 / 2 } ( A + I ) ( D + I ) ^ { - 1 / 2 } ,
517
+ $$
518
+
519
+ where $D$ is diagonal degree matrix and $A$ is the adjacency matrix.
520
+
521
+ Proposition 2. $C _ { G C N } = ( D + I ) ^ { - 1 / 2 } ( A + I ) ( D + I ) ^ { - 1 / 2 }$ frequency response is $\Phi _ { G C N } ( \lambda ) =$ $\begin{array} { r } { \mathbf { 1 } - \frac { p } { p + 1 } \lambda } \end{array}$ for regular graphs whose node degrees are $p$ .
522
+
523
+ Proof. When all node degrees are $p$ , we can write diagonal degree matrix by $D = p I$ . It yields, $L = I - A / p$ or $A = p I - p L$ . When we substitute new equations of $A$ and $D$ into GCN support, we get
524
+
525
+ $$
526
+ C _ { G C N } = \frac { p I - p L + I } { p + 1 } = I - \frac { p } { p + 1 } L .
527
+ $$
528
+
529
+ It should meet the following condition if the given frequency response is true:
530
+
531
+ $$
532
+ I - \frac { p } { p + 1 } L = U \mathrm { d i a g } ( { \bf 1 } - \frac { p } { p + 1 } { \bf \lambda } ) U ^ { \top }
533
+ $$
534
+
535
+ Since $U \mathrm { d i a g } ( { \bf 1 } ) U ^ { \top } = I .$ , and $U \mathrm { d i a g } ( \lambda ) U ^ { \top } = L$ , the condition in equation 47 is satisfied.
536
+
537
+ This proposition shows that the GCN frequency profile acts as a low-pass filter. When the given graph is a regular graph, all node degrees are equal for the case of $p = 2$ , is leading to a frequency profile defined by $\mathbf { 1 } - 2 \lambda / 3$ . Since the normalized graph Laplacian eigenvalues are in the range $[ 0 , 2 ]$ , the filter magnitude linearly decreases until the third quarter of the spectrum (cut-off frequency) where it reaches zero. Then it linearly increases until the end of the spectrum. This explains the shape of the frequency profile of GCN convolutions for 1D regular graph observed in Figure 2a in blue one.
538
+
539
+ However, this conclusion cannot explain the perturbations on the GCN frequency profile. To analyse this point, we relax the assumption $D = p I$ and rewrite equation 45 as follows and start to proof.
540
+
541
+ $$
542
+ C _ { G C N } = ( D + I ) ^ { - 1 } + ( D + I ) ^ { - 1 / 2 } A ( D + I ) ^ { - 1 / 2 } .
543
+ $$
544
+
545
+ Proof. We can see that the GCN kernel consists of two parts, $C _ { G C N } = c _ { 1 } + c _ { 2 }$ , where first part is given by $c _ { 1 } = ( D + I ) ^ { - 1 }$ and the second one is $c _ { 2 } = ( D + I ) ^ { - 1 / 2 } A ( D + I ) ^ { - 1 / 2 }$ .
546
+
547
+ For the second part $\left( c _ { 2 } \right)$ , we can write it using the element-wise multiplication operator $\odot$ (Hadamard multiplication)
548
+
549
+ $$
550
+ c _ { 2 } = A \odot { \sqrt { \mathbf { 1 } / ( d + 1 ) } } \cdot { \sqrt { \mathbf { 1 } / ( d + 1 ) } } ^ { \top } ,
551
+ $$
552
+
553
+ where $d$ is the column degree vector $d = \mathrm { d i a g } ( D )$ and the division and square root are also elementwise (Hadamard) operations. With the same notation, we can rewrite the Chebyshev second kernel, assuming that $\lambda _ { \operatorname* { m a x } } = 2$ ,
554
+
555
+ $$
556
+ C ^ { ( 2 ) } = - A \odot \sqrt { { \bf 1 } / d } \cdot \sqrt { { \bf 1 } / d } ^ { \top } .
557
+ $$
558
+
559
+ The two expressions equation 49 and equation 50 show that negative $c _ { 2 }$ is an approximation of the second Chebyshev kernel if vector $d$ consists of same values, as it was assumed in Proposition 2. When the vector $d$ is composed of different values, the two matrices $\sqrt { \mathbf { 1 } / d } . \sqrt { \mathbf { 1 } / d } ^ { \top }$ and ${ \sqrt { \mathbf { 1 } / ( d + 1 ) } } . { \sqrt { \mathbf { 1 } / ( d + 1 ) } } ^ { \top }$ are not proportional for each coordinate (i.e., entry). To obtain $c _ { 2 }$ from $C ^ { ( 2 ) }$ , we need to use different coefficients for each coordinate of the kernel. If the difference between node degrees is important, these coefficients have the strong influence, and $c _ { 2 }$ may be very different from $\bar { C } ^ { ( 2 ) }$ . Conversely, if the node degrees are quite uniform, these coefficients may be neglected. This phenomenon is the first cause of perturbation on GCN frequency profile.
560
+
561
+ The first part $\left( c _ { 1 } \right)$ of the GCN kernel in equation 48 is more interesting. Actually, it is a diagonal matrix that shows the contribution of each node in the convolution process. Instead of looking for some approximations of known frequency profiles such as those of Chebyshev kernels, we can write its frequency profile directly. Using Corollary 1.1, we can express the frequency profile of $c _ { 1 }$ in matrix form by
562
+
563
+ $$
564
+ \Phi _ { c _ { 1 } } = ( U ^ { \top } c _ { 1 } U ) ,
565
+ $$
566
+
567
+ where $U$ is the eigenvectors matrix. By taking advantage of having a diagonal kernel $c _ { 1 }$ , we can express each component of full frequency profile as
568
+
569
+ $$
570
+ \left( \Phi _ { c _ { 1 } } \right) _ { i , j } = \sum _ { k = 1 } ^ { n } \left( \frac { 1 } { 1 + d _ { k } } U _ { i , k } U _ { j , k } \right) ,
571
+ $$
572
+
573
+ where $n$ is the number of nodes in the graph, $d _ { k }$ is degree of the $k$ -th node, $U _ { i , k }$ is the $k$ -th element of $i$ -th eigenvector. As eigenvectors $U _ { i }$ and $U _ { j }$ are orthogonal for $i \neq j$ , their scalar product is null. However, in equation 52, the weighting coefficient $\frac { 1 } { 1 + d _ { k } }$ is not constant over all the dimensions of the eigenvectors. Therefore, there is no guarantee that $\ddot { \Phi } _ { c _ { 1 } } ( i , j )$ is null. This is another reason that explains that the GCN frequency profile has many non-zero elements outside of the diagonal.
574
+
575
+ In addition, it is also clear that the standard frequency profile of $c _ { 1 }$ (diagonal of $\Phi _ { c _ { 1 } }$ , i.e., $( \Phi _ { c _ { 1 } } ) _ { i , i }$ in equation 52) is not smooth. Indeed, the diagonal elements of $\Phi _ { c _ { 1 } }$ can be written as a weighted sum of squared eigenvalues elements, which again is weighted by $1 \bar { / } ( 1 + d _ { k } )$ . If the latter is constant for all $k$ , the sum of squared eigenvectors elements has to be 1 since the eigenvectors have unit L2- norm. But in the general case where $1 / ( 1 + d _ { k } )$ are not necessarily constant over all the dimensions of eigenvectors, the diagonal of the matrix may have some perturbations. This point constitutes another explanation on the fact that the GCN standard frequency profile is not smooth.
576
+
577
+ On the other hand, under the assumption that the node degrees distribution is uniform, we can derive the following approximation:
578
+
579
+ $$
580
+ p \approx \overline { { p } } = \frac { 1 } { n } \sum _ { k = 1 } ^ { n } d _ { k } .
581
+ $$
582
+
583
+ We can then write an approximation of the GCN frequency profile as a function of the average node degree by replacing $p$ with $\overline { { p } }$ and obtain the final approximation:
584
+
585
+ $$
586
+ \Phi _ { G C N } ( \lambda ) \approx { \bf 1 } - \frac { \overline { { { p } } } } { \overline { { { p } } } + 1 } \lambda .
587
+ $$
588
+
589
+ Therefore, we can theoretically show the cut-off frequency, namely where GCN kernel frequency profile reaches 0, by
590
+
591
+ $$
592
+ \lambda _ { \mathrm { c u t } } \approx \frac { \overline { { p } } + 1 } { \overline { { p } } } .
593
+ $$
594
+
595
+ # G PROOF OF THEOREM 5
596
+
597
+ Graph Isomorphism Network (GIN) defined in ( $\mathrm { { X u } }$ et al., 2019) has a single convolution support defined as follows:
598
+
599
+ $$
600
+ C _ { G I N } = A + ( 1 + \epsilon ) I ,
601
+ $$
602
+
603
+ where $\epsilon$ is a trainable parameter that makes the support trainable (GIN- $\epsilon$ ) and classified as spatialdesigned trainable-support graph convolution. Another version named GIN-0 is also defined in the same paper where $\epsilon = 0$ , which makes $C _ { G I N } = A + I$ ; thus, the convolution becomes fixed-support and identical with Vanilla GNN defined in Section 2.2.
604
+
605
+ The proof of Theorem 5 relies on the following proposition.
606
+
607
+ Proposition 3. For $C _ { G I N } = A + ( 1 + \epsilon ) I _ { \mathrm { { \Omega } } }$ , the frequency response is $\begin{array} { r } { \Phi _ { G I N } ( \pmb { \lambda } ) = p \left( \frac { \mathbf { 1 } + \epsilon } { p } + 1 - \pmb { \lambda } \right) } \end{array}$ for regular graphs, where $p$ is the node degrees.
608
+
609
+ Proof. When all node degrees are $p$ , it yields $D = p I$ , $L = I - A / p$ or $A = p I - p L$ . When we substitute the expressions of $A$ and $D$ into $C _ { G I N }$ , we get
610
+
611
+ $$
612
+ C _ { G I N } = ( p + 1 + \epsilon ) I - p L .
613
+ $$
614
+
615
+ It should meet the following condition if the given frequency response is true:
616
+
617
+ $$
618
+ ( p + 1 + \epsilon ) I - p L = U \mathrm { d i a g } ( p + \epsilon + { \bf 1 } - p \pmb { \lambda } ) U ^ { \top } .
619
+ $$
620
+
621
+ We can obtain the following equation by $p + \epsilon + { \bf 1 } = ( p + 1 + \epsilon ) I$ substitution:
622
+
623
+ $$
624
+ ( p + 1 + \epsilon ) I - p L = ( p + 1 + \epsilon ) U I U ^ { \top } - p U \mathrm { d i a g } ( \lambda ) U ^ { \top } .
625
+ $$
626
+
627
+ Since $U I U ^ { \top } = I$ and $U \mathrm { d i a g } ( \lambda ) U ^ { \top } = L$ , the condition in equation 58 is satisfied.
628
+
629
+ By relying on Proposition 58, we establish Theorem 5 as follows.
630
+
631
+ Proof. Even in regular graph, the theoretical frequency response of GIN is not identical and it depends on the node degree, thus it is not spectral-designed. In addition, we can see the GIN convolution support as the sum of two matrices where the second one $( 1 + \epsilon ) I$ is diagonalizable by eigenvectors $U$ of graph Laplacian by $\Phi = { \bf 1 } + \epsilon$ . Thus, the second part of GIN support is spectral. However, the first part, which is adjacency $A$ , cannot be diagonalizable by $U$ . Since the convolution support is not diagonalizable, we cannot write exact frequency response of GIN convolution but just an approximation of Proposition 3, assuming by the average node degree of the graph is $\overline { { p } }$ in
632
+
633
+ $$
634
+ \Phi _ { G I N } ( \lambda ) \approx \frac { \ d } { \ d t } \left( \frac { 1 + \epsilon } { \ d \overline { { { p } } } } + { \bf 1 } - \lambda \right) .
635
+ $$
636
+
637
+ # H ADDITIONAL RESULTS ON SPECTRAL ANALYSIS
638
+
639
+ # H.1 CHEBNET
640
+
641
+ To get empirical frequency responses of ChebNet supports, we used regular 1D graph, Cora, CiteSeer. As confirmed in theoretical analysis, in all cases the frequency responses do not depend on graph. The magnitude (in absolute value) of the frequency responses are shown in Figure 1a. As stated by Theorem 2, the first two kernel frequency profiles of ChebNet are $\Phi _ { 1 } ( \lambda ) = \mathbf { 1 }$ and $\Phi _ { 2 } ( \lambda ) = 2 \dot { \lambda } / \lambda _ { \mathrm { m a x } } - 1$ , where 1 is the vector of ones. Since $\lambda _ { \operatorname* { m a x } } = 2$ for all graphs that we used in the analysis, we get $\Phi _ { 2 } ( \lambda ) = \lambda - 1$ . The third one and following kernel frequency profiles can also be computed using $\bar { \Phi _ { k } } ( \bar { \lambda } ) = 2 \bar { \Phi _ { 2 } } ( \lambda ) \Phi _ { k - 1 } ( \lambda ) - \bar { \Phi _ { k - 2 } } ( \lambda )$ , leading to $\Phi _ { 3 } ( \lambda ) = \dot { 2 } \bar { \lambda ^ { 2 } } - 4 \lambda + 1$ for example for the third kernel. One can easily confirm the functions in range of [0...2] by relevant plot in Figure 1a.
642
+
643
+ Thanks to Chebyshev polynomial expansion, we do not need to calculate supports by eigendecomposition which makes the method computationally efficient. Besides, as it is spectral designed, ChebNet covers all the spectrum. Theoretically it can create all necessary filters if we use many kernels and stack the layers back to back. However higher order supports frequency responses are less smooth than lower order ones. This does not guarantee that the graph convolution transferability is maintained. For this reason, in literature, generally a few (up to first 3) supports are used (Defferrard et al., 2016; Kipf & Welling, 2017).
644
+
645
+ # H.2 CAYLEYNET
646
+
647
+ Since CayleyNet is spectral, its supports frequency response is consistent and does not change according to graph structure. It leads to get the same empirical results for all our attempts on 1D graph, Cora, CiteSeer graphs. Theorem 3 result can be compared to relevant support result in Figure 1b. For instance, the first support frequency response is $\Phi _ { 1 } ( \lambda ) = 1$ as it is all-pass filter in Figure 1b (blue plot). If we assume zoom parameter is $h = 1$ , the second support frequency response becomes $\Phi _ { 2 } ( \lambda ) = c o s ( \theta ( \lambda ) )$ . To confirm that result, we can first check the case where $\lambda = 0$ . Since $\theta ( 0 ) = - \bar { \pi }$ , $\Phi _ { 2 } ( 0 ) = - 1$ where its magnitude (absolute value) in the diagram is 1. Later, we can check the case where $\lambda = 1$ . Since $\theta ( \bar { 1 } ) = - \pi / 2$ , thus $\Phi _ { 2 } ( 1 ) = 0$ as seen in the orange plot in Figure 1b, $\lambda = 1$ is the cut-off frequency for the second support of CayleyNet.
648
+
649
+ Having multi-support with different frequency responses makes the convolution productive in terms of output signal profile. Moreover, by learning zoom parameter, theoretically, we can shrink (higher $h$ value) or expand (smaller $h$ value) the frequency responses which is needed according to the problem. However, it makes the supports non-static. The supports need to be calculated in each learning epoch. Although, to limit the induced computational cost, an approximation is computed using a fixed number of Jacobi iterations (Levie et al., 2019). But still, it seems not efficient in benchmark problem. Instead, a fixed value for the $h$ parameter might be used and $h$ can be treated as an hyperparameter to be tuned according to validation set. Besides, it has no band specific supports, but band-pass might be obtained by using multi supports and stacked layers.
650
+
651
+ # H.3 GCN
652
+
653
+ By a clear margin, the most popular method is GCN (Kipf & Welling, 2017) in GNN literature, thanks to its simplicity and relatively good results on some benchmark dataset. However, as we prove in Theorem F, it is a low-pass filter. Since it has a single support, one kind of filter which is low-pass, stacking that layer in deep architecture will not work. Because it continuously smooths the signal on the graph and on the final layer, there will only be a smoothed signal.
654
+
655
+ ![](images/c4287052d532c9078016a37a2e7c8baa60f1eb6359b644a7f2d87612ee8ca257.jpg)
656
+ Figure 5: Full frequency response of GCN on 1D, Cora and CiteSeer graphs
657
+
658
+ The three standard frequency responses in Figure 2a have almost the same low-pass filter shape. It corresponds to a function composed of a decreasing part on the three first quarters of the eigenvalues range, followed by an increasing part on the remaining range. This observation is coherent with the theoretical analysis. Hence, kernels used in GCN are transferable across the three graphs at hand. In Figure 2a, the cut-off frequency of the 1-D linear circular graph is exactly 1.5, while it is about 1.35 for CiteSeer. This observation can be explained by the fact that when considering a 1-D linear circular graph, all nodes have a degree $( { \overline { { p } } } = 2 )$ , hence $\lambda _ { \mathrm { c u t } } = 1 . 5$ . Since the average node degree in CiteSeer is 2.77, therefore $\lambda _ { \mathrm { c u t } } \approx 1 . 3 6$ .
659
+
660
+ ![](images/8ee4808e4c944d3887679378145c63813293a1c87574c275fffb487b27d73413.jpg)
661
+ Figure 6: Heat map of GCN’s frequency profiles on ENZYMES and PROTEIN dataset graphs.
662
+
663
+ Concerning the full frequency responses, there is no contribution outside the diagonal for the regular line graph (Figure 5 a). Conversely, some off-diagonal values are not null for CiteSeer and Cora (Figure $5 { \mathrm { ~ b - c ~ } }$ ). Again, this observation confirms the theoretical analysis in Appendix F. We also provided heat map of frequency responses of GCN convolution on more realistic biological graph dataset named ENZYMES and PROTEIN in Figure 6. The majority of the graph frequency responses have almost the same shape. However, some graph frequency responses are far away from the expected frequency response as illustrated with lighter color in heatmap.
664
+
665
+ # H.4 GIN
666
+
667
+ GIN model defined in $\mathrm { X u }$ et al. (2019) is not just a layer but a mini multi-layer model. The first layer is the main graph convolution layer which we analyzed, followed by at least one but preferably two MLP layers. According to Theorem 5, the frequency response of the main GIN convolution has $1 - \epsilon + \overline { { p } }$ of magnitude at zero eigenvalue and it decreases with respect to the eigenvalue. The outer node degree is a scaling factor of the frequency response that does not have any effect of the character of filter. While $\epsilon$ increases, the cut-off frequency of the convolution increases, thus it makes more low-pass effect. On the other hand, when $\epsilon$ decreases, the cut-off decreases, thus it makes more high-pass effect while inner $\overline { { p } }$ can be seen as multiplicand of the effect. Theoretically, we can say that GIN’s cut-off frequency is $\lambda _ { \mathrm { c u t } } \approx 1 + ( 1 + \epsilon ) / \overline { { p } }$ , which is the same with GCN, if $\epsilon = 0$ .
668
+
669
+ ![](images/11f49ec92df6b5d0b2fe854e83ce2db4cca9a532e72a1888ea8c9348bdf7d554.jpg)
670
+ Figure 7: Full frequency profiles of GIN-0 and frequency responses of different $\epsilon$ values for Cora graph.
671
+
672
+ One can easily calculate the frequency response of adjacency as a convolution support where $C = A$ . It can be seen as a special GIN support where $\epsilon = - 1$ . Thus $\Phi _ { A } ( \lambda ) \approx \overline { { { p } } } ( \mathbf { 1 } - \bar { \lambda } )$ . The formulation is almost the same as the one given by (NT & Maehara, 2019). It differs by the scaling factor and an approximation of the regular graph case. Since the eigenvalues of the normalized Laplacian lie on the interval [0, 2], it works as a notch-like band-stop filter for intermediate frequency $( \lambda = 1 )$ ). But, in most of applications, the eigenvalues greater than 1 is less likely. In this case, there are less component to pass. It results that using adjacency has more likely a low-pass effect as concluded in (NT & Maehara, 2019).
673
+
674
+ The experimental analysis of the spectral behavior of GIN $\mathrm { { X u } }$ et al., 2019) first implies to compute the convolution kernel as given in equation 56 for $\epsilon = \{ - 2 , - 1 , 0 , 1 \}$ . Then, the spectral representation of the obtained convolution matrix can be calculated using Corollary 1.1. This result leads to the frequency profiles illustrated in Figure 2b-c (1D and CiteSeer graph) and Figure 7 (Cora graph). For regular 1D circular graph where $p = 2$ , the frequency responses are absolutely what Proposition 3 indicates. As shown in Figure 2b, the cut-off frequencies are 2, 1.5, 1.0, and 0.5 for $\epsilon = \bar { \{ 1 , 0 , - 1 , - 2 \} }$ respectively. But for realistic graphs such as CiteSeer, since its average degree is $\overline { { p } } \approx 2 . 7 7$ , the cut-off frequencies are 1,72, 1.36, 1.0 and 0.63 for $\epsilon = \{ 1 , 0 , - 1 , - 2 \}$ respectively as shown in Figure 2c. The results for Cora graph are slightly different than CiteSeer in Figure 7b because of the fact that average node degree is different. Since GIN does not have spectral designed support, in its full frequency profile, there are some non-zero components out of the diagonal as shown in Figure $\mathrm { 7 a }$ for GIN-0 model on Cora. Figure 8 and 9 show the heat map of frequency responses of the GIN model under $\epsilon = \{ 1 , 0 , - 1 , - \mathrm { { 2 } } \}$ on ENZYMES and PROTEIN collection of graphs.
675
+
676
+ ![](images/819b126a7cda320e252fc5d3447998c500e51cb6913a096e8973b92bd5ea1838.jpg)
677
+ Figure 8: Heat map of different $\epsilon$ valued GIN frequency profiles on ENZYMES
678
+
679
+ ![](images/c3abfa43addda0ac81c9be98b28fdb2d5291acaf66ae8d1fcb2b0f204006c497.jpg)
680
+ Figure 9: Heat map of different $\epsilon$ valued GIN frequency profiles on PROTEIN
681
+
682
+ # H.5 GAT
683
+
684
+ One can see that, each support is a function of trainable weights $( W ^ { ( l , s ) } , \mathbf { a } ^ { ( l , s ) } )$ in GAT, frequency profiles cannot be directly computed similarly to previous ones. We did bunch of simulations for Cora graph. As the proposed method used for Cora problem, we have generated 8 different convolution supports corresponding to 8 pairs of $W ^ { ( l , s ) } \in R ^ { 1 4 3 3 \times 8 }$ (1433 features for each node) and $\mathbf { a } ^ { ( l , s ) } \in R ^ { \bar { 1 6 } \times 1 }$ trainable weights for the first layer (Velickovi ˇ c et al., 2018). We produce 240 (30 ´ for each support) random pairs of $W ^ { ( l , s ) }$ and $\bar { \bf { a } } ^ { ( l , s ) }$ where activation function is LeakyReLU has 0.2 negative slope as in (Velickovi ˇ c et al., 2018). Later, we calculated frequency response of gener- ´ ated supports by Corollary 1.1. The mean and standard deviation of the frequency profiles for these simulated GAT supports are shown in Figure 3 a and its expected and standard deviation of the full frequency response shown in Figure 10.
685
+
686
+ ![](images/39f933ea2dd5054e6ac5b8c81717891f9ba32e67ca2072049005ed8b3f1732a8.jpg)
687
+ Figure 10: Full frequency profile of GAT and its standard deviation.
688
+
689
+ The full frequency profile is not symmetric as seen in Figure 10a. According to Figure 10b, variations are mostly on the right side of the diagonal in the full frequency profile. This is related to the fact that these convolution kernels are not symmetric. However, the variation on frequency profile might not be sufficient in problems that need some specific band-pass filters.
690
+
691
+ In order to get trained attention head frequency responses in ENZYMES and PROTEIN datasets, we randomly divided the dataset into 4 folds. We trained the 2-layer GAT model which has 25 attention heads each by using 3 folds. We calculated attention heads $5 0 ~ C$ matrices given in equation 12, 25 each layer) for each graph in test fold. The density heat map in Figure 3b-c are the frequency responses of these attention heads for ENZYMES and PROTEINS dataset respectively.
692
+
693
+ Table 3: Sum of squared errors. All models have roughly $3 0 \mathrm { k }$ trainable parameters.
694
+
695
+ <table><tr><td>Prediction Target</td><td>GCN</td><td>GIN</td><td>GAT</td><td>ChebNet</td></tr><tr><td>Low-pass filter (Φ1)</td><td>15.55</td><td>11.01</td><td>10.50</td><td>3.44</td></tr><tr><td>Band-pass filter (Φ2)</td><td>79.72</td><td>63.24</td><td>79.68</td><td>17.30</td></tr><tr><td>High-pass filter (Φ3)</td><td>29.51</td><td>14.27</td><td>29.10</td><td>2.04</td></tr></table>
696
+
697
+ # I WHICH FILTERS CAN THE GNN MODELS LEARN?
698
+
699
+ In this section, we seek to measure of the ability of GNN models to learn some specific filtering process. This study is very important in order to understand the learning capability of existing GNN models. Since the problem may need various types of filtering, the best GNN model has to be able to learn any kind of filtering.
700
+
701
+ For this purpose, we conduct an empirical analysis on a real image with resolution of $1 0 0 \times 1 0 0$ and its corresponding 2D regular 4-neighborhood grid graph. The input of the GNN is the adjacency matrix of size $1 0 0 0 0 \times 1 0 0 0 0$ and the pixel intensities given in a 10000-length vector. We create three different spectral filters that correspond to low-pass, band-pass and high-pass effects and apply these filters to the given input image. Our selection of spectral filters are defined by $\Phi _ { 1 } ( \rho ) = \exp ( - 1 0 0 \rho ^ { 2 } )$ , $\Phi _ { 2 } ( \rho \bar { ) = } \exp \bar { ( } - 1 0 0 0 \bar { ( } \rho - 0 . 5 ) ^ { 2 } )$ and $\Phi _ { 3 } ( \rho ) { \stackrel { - } { - } } 1 - \exp ( - 1 0 \rho ^ { 2 } )$ for lowpass, band-pass and high-pass filters respectively, where $\dot { \rho } ^ { 2 } = u ^ { 2 } + v ^ { 2 }$ and $u$ and $v$ are the normalized frequencies on each direction for a given image resolution. Used input image and its filtering results can be found in Figure 11.
702
+
703
+ Since we do not use pixel positions, neither as node feature nor as edge feature, we create these spectral filters to be learned in a directional agnostic way. Therefore, the problem can be viewed as a single graph node regression problem, where we train the GNN models to minimize the square error between its output and targeted filtered image.
704
+
705
+ ![](images/5457ca047728bac00189dd9a77fd3bc582e3d39a93b955cd2fdd4305ea8687e8.jpg)
706
+ Figure 11: Input image, and its filtering results by $\Phi _ { 1 }$ , $\Phi _ { 2 }$ and $\Phi _ { 3 }$ respectively
707
+
708
+ In order to assess ChebNet, GCN, GIN and GAT, we use a 3-layer GNN architecture whose input is a one-length feature (intensity of the pixel) and the number of neurons in hidden layers is respectively 32, 64 and 64; the output layer is an MLP that projects the final node representation onto the single output for each node. We used roughly $3 0 \mathrm { k }$ trainable parameter in ChebNet with 5 supports. For the other methods, we tuned the hidden neuron numbers in order to be sure that they have a similar number of trainable parameters. Since the aim is not assessing the generalization performance, we do not use any regularization or dropout to address overfitting, but simply force the GNN to learn the input-output relation. We keep the iterations till there is no improvement for consecutive 100 iterations or maximum 3000 iterations.
709
+
710
+ Table 3 gives the sum of squared errors between target and the output of the trained model. One can see that ChebNet constantly outperformed GCN, GIN and GAT for all tasks. For learning low-pass filtering, the rest of the models did better compared to the high-pass and band-pass tasks. That is the fact that GCN, GIN and GAT have the ability to act as low-pass filters. In addition to do better on the low-pass task, GIN also did relatively better on the high-pass task as well. It is obvious that GIN can work as high pass if the $\epsilon$ parameter is selected negative (see Theorem 5). It turns out that the trained values of $\epsilon$ in GIN for each layer are $- 5 . 2 7$ , $- 2 . 2 1$ and $- 0 . 4 7$ for the high-pass task.
711
+
712
+ ![](images/4657bc681742a7314ae8ad33cae0159de4e45ec72301ff90e5dd788bd6037131.jpg)
713
+ Figure 12: The output of GNNs trained with band-pass task. Images are taken from ChebNet, GIN, GAT and GCN respectively.
714
+
715
+ Table 4: ChebNet’s sum of squared errors on band-pass tasks with respect to $S$ kernels and $L$ stacked layers. All models have roughly 30k trainable parameters.
716
+
717
+ <table><tr><td></td><td>S=2</td><td>S=3</td><td>S=5</td><td>S=7</td><td>S=10</td></tr><tr><td>L=1</td><td>65.06</td><td>56.25</td><td>47.12</td><td>39.59</td><td>28.15</td></tr><tr><td>L=2</td><td>55.85</td><td>45.96</td><td>26.81</td><td>18.92</td><td>13.33</td></tr><tr><td>L=3</td><td>50.13</td><td>36.60</td><td>17.30</td><td>9.84</td><td>7.32</td></tr><tr><td>L=4</td><td>44.88</td><td>24.89</td><td>11.90</td><td>8.91</td><td>6.96</td></tr></table>
718
+
719
+ Thanks to the spectral-designed convolution supports in ChebNet, it could learn high-pass and lowpass tasks very well. However for band-pass tasks, even though it is the best in this category too, it still has large errors compared to the high-pass and low-pass tasks. This is due to the fact that the selected band-pass filter is very narrow, because the coefficient $- 1 0 0 0$ in the formulation of $\Phi _ { 2 }$ makes the used ChebNet (with 5 convolution supports and 3 layers) unable to adapt this stiff (not smooth) filter function. Moreover, since ChebNet has no band specific convolutions, band specific output can be produced if the number of kernels increases (going wider) and/or the model goes deeper. To clarify this point, we conducted another test for band-pass task on ChebNet to show the effect of going deeper in the model and going wider (increase the convolution support) while keeping the trainable parameters fixed. These results are given in Table 4.
720
+
721
+ According to Table 4, the ability of ChebNet to learn the given frequency response becomes better with respect to the number of convolution supports and number of layers. However, this result is not surprising where it is proved that any frequency response can be written by a weighed sum of enough number of Chebyshev polynomials (Hammond et al. (2011)). When we train the ChebNet, it just finds these coefficients to create the target frequency response by minimizing the error. However, the interesting point is the incapability of GCN, GIN and GAT methods to even create reasonable approximations of these targeted filter effects. For instance, it can be seen in Figure 12 that ChebNet performed well to produce the desired band-pass output. However, GAT and GCN produce just a different kind of low-pass filtering result instead of band-pass, while GIN at least can find edges (high-pass component) thank to its trainable parameter $\epsilon$ . We also tested the deeper network for GCN, GAT and GIN as well and have not seen any significant improvement when we use deeper network.
722
+
723
+ # J CAN GNN CLASSIFY GRAPHS ACCORDING TO FREQUENCY OF ITS SIGNAL?
724
+
725
+ In this section, we measure the generalization ability of GNN for graph classification problem where graph classes depend on the signal that the graphs carry. We generate 5000 images of $1 0 0 \times 1 0 0$ pixels composed of random generated frequency patterns obtained by a sinusoidal function with a frequency in the range [1-5]. We labelled the image as negative if the pattern’s frequency is in the ranges [2-2.5] or [4-4.5]. The rest of the frequency patterns are labeled as belonging to the positive class. Then, we randomly rotate and translate the image pattern, add white noise (with $\mathrm { s t d } { = } 0 . 2 )$ ) and normalize each image independently. From each image, we randomly sample 200 points in the
726
+
727
+ Table 5: Test set accuracy and binary cross entropy loss.
728
+
729
+ <table><tr><td></td><td>MLP</td><td>GCN</td><td>GIN</td><td>GAT</td><td>ChebNet</td></tr><tr><td>Accuracy</td><td>50</td><td>77.90</td><td>87.60</td><td>85.30</td><td>98.2</td></tr><tr><td>Loss</td><td>0.69</td><td>0.454</td><td>0.273</td><td>0.324</td><td>0.062</td></tr></table>
730
+
731
+ $1 0 0 \times 1 0 0$ image plane and we divide the image into 200 regions by watershed algorithm (Meyer, 1994), where each sampled point is the marker. From this preprocessing, we generate 5000 graphs, each graph having 200 nodes. Each node corresponds to a watershed region in the image, and if the two regions have intersection on the image plane, we assume these two nodes are connected by an edge in the graph. We set the average intensity value in each region as a 1-length node feature. Even though we know the region center position, we do not use it in order to make the problem harder. Sampled generated image, randomly selected points and their watershed regions, and the graph can be found in Figure 13 for a 30-node illustration.
732
+
733
+ ![](images/2dfb05d180230b093c4dbc448d76b7dc75f6e1c5df8036416c6adcfd32672a6b.jpg)
734
+ Figure 13: Sample graph in Band-Pass graph dataset. Random rotated and translated image pattern with frequency of 1, random sampled points and their watershed regions, and graph represent the connected region and average region intensity value respectively.
735
+
736
+ We divided the dataset into train/valid/test subsets, with respectively 3000, 1000 and 1000 graphs. We resampled the same number of positive and negative examples, such that the dataset is balanced. We used 3 layers of GNN followed by a mean readout layer and finally two fully connected layers which have 10 and 1 neuron respectively. Since the problem is a binary graph classification problem, we used binary cross entropy loss and no regularization. We roughly use 30K parameters in each model. The dropout ratio has been applied to all GNN layer’s inputs and optimized with respect to the validation set performance.
737
+
738
+ The results are found on Table 5. Since the node distributions are all the same in the graphs (because the graph nodes were independently normalized), MLP cannot do better than a random classifier. GCN does not perform well, probably because of its low-pass nature. Since GAT and GIN are better than GCN according to the spectral ability, they got a better accuracy than GCN. Finally, ChebNet with 5 convolution supports clearly outperforms the rest of them with a huge margin. These results show that models able to catch a particular band of frequencies obtain the best results, whereas only low-pass based methods like GCN perform only slightly better than MLP. Therefore, this toy example confirms our theoretical analysis.
739
+
740
+ To conclude, we have shown that if the model is able to perform different filtering operation, it can classify the graphs according to frequency of its signal.
741
+
742
+ # K WHY LOW-PASS GNNS GIVE REASONABLE RESULTS ON SEMI SUPERVISED TASKS?
743
+
744
+ In the recent literature, GNNs are generally evaluated on semi-supervised node classification problems. The most well-known datasets are Cora, CiteSeer and PubMed paper citation graphs (Yang et al., 2016). In these graphs, each node corresponds to a paper. If one paper cites another one, there is an unlabeled and undirected edge between the corresponding nodes. Binary features on the nodes indicate the presence of specific keywords in the corresponding paper. The learning task is to attribute a class to each node (i.e., paper) of the graph using for training the graph itself and a very limited number of labeled nodes. Labeled data ratios are $5 . 1 \%$ , $3 . 6 \%$ and $0 . 3 \%$ for Cora, CiteSeer and PubMed respectively. Since the connected node’s probability of being in the same class is high (0.83, 0.71, 0.79 for Cora, CiteSeer and PubMed respectively in Liu et al. (2020)), these graphs are classified as assortative graphs. When the connected nodes are highly likely to be in the same class, label propagation based low-pass effected algorithms can give reasonable results.
745
+
746
+ Table 6: Comparison of methods on the transductive learning problems using publicly defined train, validation and test sets. Results are on accuracy
747
+
748
+ <table><tr><td>Method</td><td>Cora</td><td>CiteSeer</td><td>PubMed</td></tr><tr><td>MLP</td><td>0.551</td><td>0.465</td><td>0.714</td></tr><tr><td>ChebNet</td><td>0.812</td><td>0.698</td><td>0.744</td></tr><tr><td>CayleyNet</td><td>0.819</td><td>0.701</td><td>0.751</td></tr><tr><td>GCN</td><td>0.819</td><td>0.707</td><td>0.789</td></tr><tr><td>GAT</td><td>0.830</td><td>0.725</td><td>0.790</td></tr><tr><td>LowPassConv</td><td>0.827 ± 0.006</td><td>0.717 ± 0.005</td><td>0.794 ± 0.005</td></tr></table>
749
+
750
+ To show empirical evidence that any ordinary low-pass filter can give comparable results by lowpass GNNs, we created a fixed, spectral-designed, single convolution support GNN whose frequency response is manually designed in the spectral domain by $\Phi ( \lambda ) = ( { \bf 1 } - \bar { \lambda _ { / } } \lambda _ { \mathrm { m a x } } ) ^ { 5 }$ . This GNN model is denoted as LowPassConv in Table 6 and its average accuracy and standard deviation over 20 random runs reported. We use predefined train, validation and test sets as defined by Yang et al. (2016) and follow the test procedure of Kipf & Welling (2017) and Velickovi ˇ c et al. (2018) for a ´ fair comparison. According to Table 6, spectral-designed GNN’s such as CayleyNet and ChebNet are slightly outperformed by other methods, including our simple low-pass convolution GNN. On the other hand, GCN and GAT do not give significantly better results than ordinary low-pass graph convolution.
751
+
752
+ These results seem conflicting with the idea of having spectral well-designed graph convolutions. However, if the problem just needs low-pass filtering effect and if the model produces some unnecessary spectral component in the output, it may have a negative effect on the accuracy. Instead of just one single low-pass convolution support, if we have many convolution supports with different spectral properties, it increases the trainable parameters for a vain. Regularization may help to overcome this issue. This problem may be solved by learning the convolution support in the frequency domain by another secondary unsupervised task which is in our priority list to do.
753
+
754
+ # L DATASETS AND IMPLEMENTATION DETAILS
755
+
756
+ ![](images/bdde4f7c14af7ec9b739eefb0fb41e02f53366a0295ced781b3a3eea56e68579.jpg)
757
+ Figure 14: Two sample graphs in MNIST-75 dataset (from 0 and from 1 class), the location of the nodes is just for illustration. Models do not use the node positions.
758
+
759
+ In our experiments, we used 3 citation graph datasets, named Cora CiteSeer and PubMed, an artificial regular graph where each node degree is 2, named 1D, 2 biological graph datasets named
760
+
761
+ Table 7: Summary of the datasets used in our experiments.
762
+
763
+ <table><tr><td></td><td>Cora</td><td>CiteSeer</td><td>PubMed</td><td>1D</td><td>Band-Pass</td><td>PROTEINS</td><td>ENZYMES</td><td>MNIST-75</td></tr><tr><td># Graphs</td><td>1</td><td>1</td><td>1</td><td>1</td><td>5K</td><td>1113</td><td>600</td><td>70K</td></tr><tr><td>#Nodes</td><td>2708</td><td>3327</td><td>19717</td><td>1001</td><td>200 each</td><td>39.06 each</td><td>32.63 each</td><td>75 each</td></tr><tr><td>#Edges</td><td>5429</td><td>4732</td><td>44338</td><td>1001</td><td>1072.6 each</td><td>72.82 each</td><td>62.14 each</td><td>694.7 each</td></tr><tr><td>#Features</td><td>1433</td><td>3703</td><td>500</td><td>NA</td><td>1</td><td>3</td><td>21</td><td>1</td></tr><tr><td># Classes</td><td>7</td><td>6</td><td>3</td><td>NA</td><td>2</td><td>2</td><td>6</td><td>10</td></tr><tr><td># Training</td><td>140 Nodes</td><td>120 Nodes</td><td>60 Nodes</td><td>NA</td><td>3K</td><td>9-fold</td><td>9-fold</td><td>55K</td></tr><tr><td># Validation</td><td>500 Nodes</td><td>500 Nodes</td><td>500 Nodes</td><td>NA</td><td>1K</td><td>1-fold</td><td>1-fold</td><td>5K</td></tr><tr><td>#Test</td><td>1000 Nodes</td><td>1000 Nodes</td><td>1000 Nodes</td><td>NA</td><td>1K</td><td>NA</td><td>NA</td><td>10K</td></tr></table>
764
+
765
+ PROTEINS and ENZYMES, Band-Pass graph dataset which was created by us in order to evaluate the models, and a large scale MNIST-75 graph dataset. The details of these datasets can be found in Table 7. Two samples in MNIST-75 dataset are shown in Figure 14.
766
+
767
+ In our tests on MNIST-75, all hyperparameters are tuned by a grid as follows: \`-2 norm regularization applied on trainable weights in $\{ 0 , 1 0 ^ { - 1 } , 1 0 ^ { - 2 } , 1 0 ^ { - 5 } , 1 0 ^ { - 4 } , 1 0 ^ { - 5 } \}$ and dropout in $\{ 0 , 0 . 2 , 0 . 4 , 0 . 6 \}$ for all models. In CayleyNet, we treated the zoom parameter as an hyperparameter and tuned it within the candidate values $\{ 0 . 5 , 1 , 1 . 5 , 2 \}$ and also $r \in \{ 1 , 2 , 3 \}$ which leads $\{ 3 , 5 , 7 \}$ numbers of supports. ChebNet support number is also another hyperparameter, we tuned it in set of $\{ 3 , 5 , 7 \}$ . For GAT, we tuned the number of heads and the number of output features by concatenating or not which can give the predefined layer feature. For a 64-feature output, two architectures were studied: 8 heads each has 8 outputs with concatenating, and 8 heads each has 64 output without concatenating. The same for 128-feature output layer as well, using the same number of heads. For each layer of GIN model, there is one main GIN convolution layer followed by the same size of MLP. We tested the fixed $\epsilon$ and trainable as well; finally we concluded to use trainable one according to a validation set result. All activation are ReLU, but Elu (exponential linear unit) in GAT. In the output layer, the linear activation is used in all models and the loss function is the cross entropy. We used Adam optimization with a 0.01 learning rate without decay. We fixed the number of iterations to 100 under 64 batch size. The test results were selected on the iteration where the validation set accuracy is maximum.
md/train/0NXUSlb6oEu/0NXUSlb6oEu.md ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Improving Robustness using Generated Data
2
+
3
+ Sven Gowal\*, Sylvestre-Alvise Rebuffi\*, Olivia Wiles, Florian Stimberg, Dan Calian and Timothy Mann DeepMind, London {sgowal,sylvestre}@deepmind.com
4
+
5
+ # Abstract
6
+
7
+ Recent work argues that robust training requires substantially larger datasets than those required for standard classification. On CIFAR-10 and CIFAR-100, this translates into a sizable robust-accuracy gap between models trained solely on data from the original training set and those trained with additional data extracted from the $^ { 6 6 } 8 0$ Million Tiny Images” dataset (80M-TI). In this paper, we explore how generative models trained solely on the original training set can be leveraged to artificially increase the size of the original training set and improve adversarial robustness to $\ell _ { p }$ norm-bounded perturbations. We identify the sufficient conditions under which incorporating additional generated data can improve robustness, and demonstrate that it is possible to significantly reduce the robust-accuracy gap to models trained with additional real data. Surprisingly, we show that even the addition of non-realistic random data (generated by Gaussian sampling) can improve robustness. We evaluate our approach on CIFAR-10, CIFAR-100, SVHN and TINYIMAGENET against $\ell _ { \infty }$ and $\ell _ { 2 }$ norm-bounded perturbations of size $\epsilon =$ $8 / 2 5 5$ and $\epsilon = 1 2 8 / 2 5 5$ , respectively. We show large absolute improvements in robust accuracy compared to previous state-of-the-art methods. Against $\ell _ { \infty }$ normbounded perturbations of size $\epsilon = 8 / 2 5 5$ , our models achieve $6 6 . 1 0 \%$ and $3 3 . 4 9 \%$ robust accuracy on CIFAR-10 and CIFAR-100, respectively (improving upon the state-of-the-art by $+ 8 . 9 6 \%$ and $+ 3 . 2 9 \%$ ). Against $\ell _ { 2 }$ norm-bounded perturbations of size $\epsilon = 1 2 8 / 2 5 5$ , our model achieves $7 8 . 3 1 \%$ on CIFAR-10 $( + 3 . 8 1 \% )$ . These results beat most prior works that use external data.
8
+
9
+ # 1 Introduction
10
+
11
+ Neural networks are being deployed in a wide variety of applications ranging from ranking content on the web [15] to autonomous driving [5] via medical diagnostics [22]. It has become increasingly important to ensure that deployed models are robust and generalize to various input perturbations. Unfortunately, the addition of imperceptible adversarial perturbations can cause neural networks to make incorrect predictions [9, 10, 27, 44, 64]. There has been a lot of work on understanding and generating adversarial perturbations [1, 4, 10, 64], and on building defenses that are robust to such perturbations [27, 49, 60, 82]. We note that while robustness and invariance to input perturbations is crucial to the deployment of machine learning models in various applications, it can also have broader negative impacts to society such as hindering privacy [63] or increasing bias [68].
12
+
13
+ The adversarial training procedure proposed by Madry et al. [49] feeds adversarially perturbed examples back into the training data. It is widely regarded as one of the most successful method to train robust deep neural networks [30], and it has been augmented in different ways – with changes in the attack procedure [25], loss function [50, 82] or model architecture [76, 85]. We highlight the works by Carmon et al. [11], Najafi et al. [51], Uesato et al. [72], Zhai et al. [80] who simultaneously proposed the use of additional unlabeled external data. While the addition of external data helped boost robust accuracy by a large margin, progress in the setting without additional data has slowed (see Fig. 1). On CIFAR-10 [42] against $\ell _ { \infty }$ perturbations of size $\epsilon = 8 / 2 5 5$ , the best known model obtains a robust accuracy of $6 5 . 8 7 \%$ when using additional data. The same model obtains a robust accuracy of $5 7 . 1 4 \%$ without this data [30]. As a result, we ask ourselves whether it is possible to leverage the information contained in the original training set to a greater extent. This manuscript challenges the status-quo. To the contrary of standard training where it is widely believed that generative models lack diversity and that the samples they produce cannot be used to train better classifiers [59], we demonstrate both theoretically and experimentally that these generated samples can be used to improve robustness (using the approach described in Fig. 2 and Sec. 3.3). We make the following contributions:
14
+
15
+ ![](images/8eb9ee6d3777e7d8166f9e6f212649a7a9831e7486d3e37219d94bb171c3f31b.jpg)
16
+ Figure 1: Robust accuracy of models against AUTOATTACK [16] on CIFAR-10 with $\ell _ { \infty }$ perturbations of size $8 / 2 5 5$ displayed in publication order. Our method explores how generated data can be used to improve robust accuracy by $+ 8 . 9 6 \%$ without using any additional external data. This constitutes the largest jump in robust accuracy in this setting. Our best model reaches a robust accuracy of $6 6 . 1 0 \%$ against $\mathbf { A } \mathbf { A } { + } \mathbf { M } \mathbf { T }$ [30].
17
+
18
+ ![](images/3e6487378e9debb436c615ff8311fb38dd237c64fb4e3dc9118341aa066fb749.jpg)
19
+ Figure 2: Overview of our approach. Our method initially trains a generative model and a non-robust classifier. The non-robust classifier is used to provide pseudo-labels to the generated data. Finally, generated and original training data are combined to train a robust classifier.
20
+
21
+ • We demonstrate in Sec. 3.2 that it is possible to use low-quality random inputs (sampled from a conditional Gaussian fit of the training data) to improve robust accuracy on CIFAR-10 against $\ell _ { \infty }$ perturbations of size $\epsilon = 8 / 2 5 5$ $( + 0 . 9 3 \%$ on a WRN-28-10) and provide a justification and sufficient conditions in Sec. 4.
22
+ • We leverage higher quality generated inputs (i.e., inputs generated by generative models solely trained on the original data), and study four recent generative models: the Denoising Diffusion Probabilistic Model (DDPM) [36], StyleGAN2 [40], BigGAN [7] and the Very Deep Variational Auto-Encoder (VDVAE) [14] (Sec. 5). We show that DDPM samples cover most closely the real data distribution (as measured by the distance to the test set in the Inception feature space). Using images generated by the DDPM allows us to reach a robust accuracy of $6 6 . 1 0 \%$ on CIFAR-10 against $\ell _ { \infty }$ perturbations of size $\epsilon = 8 / 2 5 5$ (an improvement of $+ 8 . 9 6 \%$ upon the stateof-the-art). Notably, our best CIFAR-10 models beat all techniques that use additional data (see Sec. 6) and constitutes one of the largest improvements ever made in the setting without additional data. As a consequence, we demonstrate that it is possible to avoid the use of 80M-TI [65] which has been withdrawn due to presence of offensive images.1
23
+
24
+ # 2 Related work
25
+
26
+ Adversarial $\ell _ { p }$ norm-bounded attacks. Since Biggio et al. [4], Szegedy et al. [64] observed that neural networks which achieve high accuracy are highly vulnerable to adversarial examples, the art of crafting increasingly sophisticated adversarial examples has received a lot of attention. Goodfellow et al. [27] proposed the Fast Gradient Sign Method (FGSM) which generates adversarial examples with a single normalized gradient step. It was followed by $\mathrm { R + F G S M }$ [67], which adds a randomization step, and the Basic Iterative Method (BIM) [44], which takes multiple smaller gradient steps.
27
+
28
+ Adversarial training as a defense. Adversarial training [49] is widely regarded as one of the most successful methods to train deep neural networks robust to such attacks. It has received significant attention and various modifications have emerged [25, 50, 76]. A notable work is TRADES [82], which balances the trade-off between standard and robust accuracy, and achieved state-of-the-art performance against $\ell _ { \infty }$ norm-bounded perturbations on CIFAR-10. More recently, the work from Rice et al. [60] studied robust overfitting and demonstrated that improvements similar to TRADES could be obtained more easily using classical adversarial training with early stopping. Finally, Gowal et al. [30] highlighted how different hyper-parameters (such as network size and model weight averaging) affect robustness.
29
+
30
+ Data-driven augmentations. Works, such as AutoAugment [18] and related RandAugment [19], learn augmentation policies directly from data. These methods are tuned to improve standard classification accuracy and have been shown to work well on multiple datasets. DeepAugment [34] explores how perturbations of the parameters of pre-trained image-to-image models can be used to generate augmented datasets that provide increased robustness to common corruptions [32]. Similarly, generative models can be used to create novel views of images [37, 39, 57] by manipulating them in latent space. When optimized and used during training, these novel views reduce the impact of spurious correlations and improve accuracy [28, 73]. Most recently, Laidlaw et al. [45] proposed an adversarial training method based on bounding a neural perceptual distance (i.e., an approximation of the true perceptual distance). While these works make significant contributions towards improving generalization and robustness to semantic perturbations, they do not improve robustness to $\ell _ { p }$ normbounded perturbations.
31
+
32
+ Robustness to $\ell _ { p }$ norm-bounded perturbations using generative modeling. Finally, we highlight works, such as Defense-GAN [61] or ME-Net [77], which leverage data modeling techniques to create stronger defenses against $\ell _ { p }$ norm-bounded attacks. Unfortunately, these techniques are not as robust as they seem and are broken by adaptive attacks [2, 16, 66]. Overall, to the best of our knowledge, there is little [48] to no evidence that data augmentations or generative models can be used to improve robustness to $\ell _ { p }$ norm-bounded attacks. In fact, generative models mostly lack diversity and it is widely believed that the samples they produce cannot be used to train classifiers to the same accuracy than those trained on original datasets [59]. We differentiate ourselves from earlier works by leveraging additional generated samples for training rather than modifying the defense procedure, and by establishing sufficient conditions under which such samples improve robustness.
33
+
34
+ # 3 Adversarial training using generated data
35
+
36
+ The rest of this manuscript is organized as follows. In this section, we provide an overview of adversarial training, demonstrate using a motivational example that low-quality generated data can be leveraged to improve robustness to adversarial examples, and describe our method. In Sec. 4, we detail sufficient conditions that explain why generated samples can improve robustness and explore the limitations of our approach. In Sec. 5, we analyze four complementary and recent generative models in the context of our method. Finally, we provide experimental results in Sec. 6.
37
+
38
+ # 3.1 Adversarial training
39
+
40
+ For classification tasks, Madry et al. [49] propose to find model parameters $\pmb { \theta }$ that minimize the adversarial risk:
41
+
42
+ $$
43
+ \underset { \pmb { \theta } } { \arg \operatorname* { m i n } } \mathbb { E } _ { ( \pmb { x } , \pmb { y } ) \sim \mathcal { D } } \left( \underset { \delta \in S } { \operatorname* { m a x } } \left[ f ( \pmb { x } + \pmb { \delta } ; \pmb { \theta } ) \neq y \right] \right)
44
+ $$
45
+
46
+ where $\mathcal { D }$ is a data distribution over pairs of examples $_ { \textbf { \em x } }$ and corresponding labels $y$ , $f ( \cdot ; \pmb \theta )$ is a model parametrized by $\theta , [ \cdot ]$ is the Iverson bracket notation and corresponds to the $0 - 1$ loss, and $s$ defines the set of allowed perturbations. For $\ell _ { p }$ norm-bounded perturbations of size $\epsilon$ , the perturbation set is defined as $S _ { p } = \{ \bar { \delta } \mid \| \delta \| _ { p } \leq \epsilon \}$ . Hence, for $\ell _ { \infty }$ norm-bounded perturbations $\begin{array} { r } { S = S _ { \infty } } \end{array}$ and for $\ell _ { 2 }$ norm-bounded perturbations ${ \mathcal { S } } = { \mathcal { S } } _ { 2 }$ . In the rest of this manuscript, we use $\epsilon _ { p }$ to denote $\ell _ { p }$ norm-bounded perturbations of size $\epsilon$ (e.g., $\epsilon _ { \infty } = 8 / 2 5 5 )$ .
47
+
48
+ ![](images/5e1e8166420c62722485c6a7820dfe98653f2088972c7e84afa5280b7a8886d0.jpg)
49
+ Figure 3: Low-quality random inputs can improve robustness. Panel (a) shows the robust test accuracy (against $\mathbf { A A } { + } \mathbf { M } \mathbf { T }$ [30]) of a WRN-28-10 against $\epsilon _ { \infty } = 8 / 2 5 5$ on CIFAR-10 trained with additional data randomly sampled from a class-conditional Gaussian fit of the training data. We compare how the proportion of original CIFAR-10 and generated images affects robustness ( $0 \%$ means generated samples only, while $100 \%$ means original CIFAR-10 train set only). Panel (b) shows some of the class-conditional Gaussian samples that are used during training.
50
+
51
+ In practice, given a training set $\mathcal { D } _ { \mathrm { t r a i n } }$ , the adversarial training procedure replaces the $0 - 1$ loss with the cross-entropy loss $l _ { \mathrm { c e } }$ and is formulated as
52
+
53
+ $$
54
+ \underset { \pmb { \theta } } { \arg \operatorname* { m i n } } \mathbb { E } _ { ( \pmb { x } , \pmb { y } ) \in \mathcal { D } _ { \mathrm { t r a i n } } } \left( \underset { \delta \in \mathcal { S } } { \operatorname* { m a x } } l _ { \mathrm { c e } } ( f ( \pmb { x } + \delta ; \pmb { \theta } ) , \ b { y } ) \right) .
55
+ $$
56
+
57
+ # 3.2 Generated data can improve robust generalization
58
+
59
+ Data augmentations can reduce the generalization error of standard (non-robust) training [18, 19, 23, 81]. However, to the contrary of standard training, augmentations beyond random flips and crops [31] – such as Cutout [23], mixup [81], AutoAugment [18] or RandAugment [19] – have been unsuccessful in the context of adversarial training [30, 60, 75]. The gap in robust accuracy between models trained with and without additional data suggests that common augmentation techniques, which tend to produce augmented views that are close to the original image they augment, are intrinsically limited in their ability to improve robust generalization. In other words, augmented samples are diverse (if the training set is diverse), but not complementary to the training set. This phenomenon is particularly exacerbated when training adversarially robust models which are known to require an amount of data polynomial in the number of input dimensions [62].
60
+
61
+ We hypothesize that, to improve robust generalization, it is critical to use additional training samples (augmented or generated) that are diverse and that complement the original training set (in the sense that these new samples should ideally come from the same underlying distribution as the training set but should not duplicate the training set). To test this hypothesis, we propose to use samples generated from a simple class-conditional Gaussian fit of the training data. By construction, such samples (shown in Fig. 3(b)) are extremely blurry but diverse. We proceed by fitting a multivariate Gaussian to each set of 5K training images corresponding to each class in CIFAR-10. For each class, we sample 100K images resulting in a new dataset of 1M datapoints (no further filtering is applied). In Fig. 3(a), we show the performance of various robust models trained by decreasing the proportion of real samples present in each batch from $100 \%$ (original data only) to $0 \%$ (generated data only). Decreasing this proportion reduces the importance of the original data. We observe that all proportions between $50 \%$ and $90 \%$ provide improvements in robust accuracy. Most surprisingly, the optimal proportion of $80 \%$ provides an absolute improvement of $+ 0 . 9 3 \%$ , which is an improvement comparable in size to the ones provided by model weight averaging or TRADES [30]. As we show in Sec. 4, the drop in robust accuracy for proportions below $50 \%$ is expected in the capacity-limited regime. This experiment directly motivates our method.
62
+
63
+ # 3.3 Method
64
+
65
+ Given access to a pre-trained non-robust classifier $f _ { \mathrm { N R } }$ and an unconditional generative model approximating the true data distribution $\overline { { \mathcal { D } } }$ by a distribution $\hat { \mathcal { D } }$ , we would like to train a robust classifier $f ( \cdot ; \pmb \theta )$ parameterized by $\pmb \theta$ . We propose the following optimization problem:
66
+
67
+ $$
68
+ \underset { \theta } { \arg \operatorname* { m i n } } \alpha \cdot \underset { ( \alpha , y ) \in \mathcal { D } _ { \mathrm { t r a i n } } } { \mathbb { E } } \left( \operatorname* { m a x } _ { \delta \in \mathcal { S } } l _ { \infty } ( f ( \alpha + \delta ; \theta ) , y ) \right) + ( 1 - \alpha ) \cdot \underset { x \sim \hat { \mathcal { D } } } { \mathbb { E } } \left( \operatorname* { m a x } _ { \delta \in \mathcal { S } } l _ { \infty } ( f ( \alpha + \delta ; \theta ) , f _ { \mathrm { N R } } ( x ) ) \right)
69
+ $$
70
+
71
+ where $\alpha$ corresponds to a mixing factor that blends examples from the training set with those that are generated. When $\alpha$ is set to one, our method reverts back to the original adversarial training formulation in Eq. 2. When $\alpha$ is set to zero, our method only uses generated samples with their corresponding pseudo-labels. In practice, for efficiency, rather than generating samples on-the-fly, we pre-generate samples offline. Hence, both the original training set $\mathcal { D } _ { \mathrm { t r a i n } }$ and generated set $\hat { \mathcal { D } }$ contain a finite number of samples. We have the advantage, however, to be able to generate significantly more samples than present in the original training set. In App. B, we evaluate how varying the number of generated samples impacts adversarial robustness.
72
+
73
+ Overall, the complete method is described in Fig. 2 and is composed of three steps: $( i )$ it starts by training the non-robust classifier and generative model on the original training set (for CIFAR-10, that corresponds to 50K images only); (ii) then, the generated dataset is constructed by drawing samples from the generative model and pseudo-labeling them using the non-robust classifier; $( i i i )$ finally, the robust classifier is trained using both the original training set and the generated dataset using Eq. 3.
74
+
75
+ # 4 Randomness might be enough
76
+
77
+ In this section, we formalize our notation (Sec. 4.1), and provide three sufficient conditions that explain why generated data can improve robustness (Sec. 4.2). In summary, $( i )$ the pre-trained, non-robust classifier $f _ { \mathrm { N R } }$ used for pseudo-labeling must be accurate, $( i i )$ the likelihood of sampling examples that are adversarial to this non-robust classifier must be low, and $( i i i )$ the generative model must be able to sample images from the true data distribution with non-zero probability.
78
+
79
+ # 4.1 Setup
80
+
81
+ Given a ground-truth function $f ^ { \star }$ , we would like to find optimal parameters $\pmb { \theta } ^ { \star }$ for $f ( \cdot ; \theta ^ { \star } )$ that minimize the adversarial risk,
82
+
83
+ $$
84
+ \pmb \theta ^ { \star } = \underset { \pmb \theta } { \arg \operatorname* { m i n } } \mathbb { E } _ { \pmb { x } \sim \mathcal { D } } \left( \operatorname* { m a x } _ { \pmb \delta \in \mathcal { S } } \left[ f ( \pmb x + \pmb \delta ; \pmb \theta ) \neq f ^ { \star } ( \pmb x ) \right] \right) ,
85
+ $$
86
+
87
+ without access to the true data distribution $\mathcal { D }$ or the ground-truth classifier $f ^ { \star }$ . As such, we replace the distribution $\mathcal { D }$ with an approximated distribution $\hat { \mathcal { D } }$ (from a generative model) and use a pre-trained non-robust classifier $f _ { \mathrm { N R } }$ instead of $f ^ { \star }$ (see Sec. 3.3). This results in sub-optimal parameters
88
+
89
+ $$
90
+ \hat { \pmb { \theta } } ^ { \star } = \underset { \pmb { \theta } } { \arg \operatorname* { m i n } } \mathbb { E } _ { \pmb { x } \sim \hat { \mathcal { D } } } \left( \underset { \delta \in \cal S } { \operatorname* { m a x } } \left[ f ( \pmb { x } + \pmb { \delta } ; \pmb { \theta } ) \neq f _ { \mathrm { N R } } ( \pmb { x } ) \right] \right) .
91
+ $$
92
+
93
+ We introduce the unknown probability measure $\mu$ corresponding to the true data distribution $\mathcal { D }$ and defined over the set of inputs ${ \mathcal { A } } \subseteq \mathbb { R } ^ { n }$ (where $n$ is the input dimensionality), as well as the known probability measure $\hat { \mu }$ corresponding to the approximated distribution $\hat { \mathcal { D } }$ . The set of relevant inputs ${ \mathcal { X } } \subseteq A$ (i.e., the set of realistic images for which we would like to enforce robustness) is the support of $\mu$ such that $\mu ( \mathcal { X } ) = 1$ and $\forall \mathcal { W } \subseteq \mathcal { X } , \mu ( \mathcal { W } ) > 0$ if $\mathcal { W }$ is non-empty. We assume that each input $\mathbf { \boldsymbol { x } } \in \mathcal { X }$ can be assigned a label $y = f _ { - } ^ { \star } ( { \pmb x } )$ where $f ^ { \star } : \mathcal { X } \mapsto \mathcal { Y }$ is the ground-truth classifier (only valid for realistic images) and $\mathscr { y } \in 2 ^ { \mathbb { Z } }$ is the set of labels. Finally, given a perturbation set $s$ , we restrict labels such that there exists no realistic image within the perturbation set of another that has a different label; i.e., for $\mathbf { \boldsymbol { x } } \in \mathcal { X }$ , for all $\delta \in \{ \delta ^ { \prime } \in \mathcal { S } | { \pmb x } + \delta ^ { \prime } \in \mathcal { X } \}$ we have $f ^ { \star } ( { \pmb x } ) = f ^ { \star } ( { \pmb x } + \delta )$ .
94
+
95
+ # 4.2 Limitations and sufficient conditions
96
+
97
+ To understand the limitations of our approach, it is useful to think about idealized sufficient conditions that would allow the sub-optimal parameters $\hat { \pmb { \theta } } ^ { \star }$ to approach the performance of the optimal parameters $\pmb { \theta } ^ { \star }$ . First, we concentrate on the capacity-limited regime and later extrapolate to the infinite-capacity, infinite-compute regime to gain more insights. The first sufficient condition concerns the pre-trained non-robust classifier and holds for both regimes.
98
+
99
+ Condition 1 (accurate non-robust classifier). The pre-trained non-robust classifier $f _ { N R } : \mathcal { A } \mapsto \mathcal { V }$ must be accurate on all realistic inputs $\pmb { x } \in \mathcal { X } \colon \forall \pmb { x } \in \mathcal { X }$ , $f _ { N R } ( x ) = f ^ { \star } ( x )$ .
100
+
101
+ Indeed, if we had access to the true distribution $\mathcal { D }$ , Eq. 4 and Eq. 5 could be made equal by setting $f ^ { \star } ( x ) = f _ { \mathrm { N R } } ( x )$ . 2 In the capacity-limited regime, when Cond. 1 is satisfied, the problem reduces to a robust generalization problem. This problem is widely studied [3, 21, 70] and one can show that the adversarial risk is bounded by the Wasserstein distance between the training distribution $\hat { \mathcal { D } }$ and true data distribution $\mathcal { D }$ (under mild assumptions) [46]. In other words, as $\hat { \mathcal { D } }$ approaches $\mathcal { D }$ , we expect the robust accuracy of $f ( \cdot ; \hat { \pmb \theta } ^ { \star } )$ to approach the one of $f ( \cdot ; \theta ^ { \star } )$ . This intuitively leads to the second sufficient condition and Prop. 1.
102
+
103
+ Condition 2 (accurate approximated distribution). The approximated data distribution $\hat { \mathcal { D } }$ and true data distribution $\mathcal { D }$ must be equivalent: $\mu ( \mathcal { W } ) = \hat { \mu } ( \mathcal { W } )$ for all measurable subset $\mathcal { W } \subseteq \mathcal { X }$ .
104
+
105
+ Proposition 1 (capacity-limited regime). Cond. 1 and Cond. 2 are sufficient conditions that allow the sub-optimal parameters $\hat { \pmb { \theta } } ^ { \star }$ to match the performance of the optimal parameters $\pmb { \theta } ^ { \star }$ .
106
+
107
+ Together, Cond. 1 and 2 provide sufficient conditions for the capacity-limited regime (see proof in Sec. E.1). Cond. 2 (and associated bounds from [46]) generally indicates that the robust accuracy of the classifier $f ( \cdot ; \hat { \pmb \theta } ^ { \star } )$ should increase as the quality of the generative model that provides the approximated distribution $\hat { \mathcal { D } }$ improves. However, these two conditions do not provide a satisfying answer when it comes to understanding why seemingly random data can help improve robustness (as demonstrated in Sec. 3.2). To help our understanding, it is worth analyzing the consequence of increasing the capacity of $f$ . In particular, in the infinite-capacity regime, Cond. 2 can be relaxed and replaced by the following two conditions, and Prop. 1 becomes Prop. 2.
108
+
109
+ Condition 3 (unlikely adversarial examples). It is not possible to sample a point $\mathbf { \boldsymbol { x } } \sim \hat { \mathcal { D } }$ outside the realistic set $\mathcal { X }$ such that it is adversarial to fNR: $\hat { \mu } ( \mathcal { W } ) = 0$ on the measurable subset $\mathcal { W } =$ $\{ x + \delta \mid x \in \mathcal { X } , \delta \in \mathcal { S } , f _ { N R } ( x + \delta ) \neq f _ { N R } ( x ) \}$ .
110
+
111
+ Condition 4 (sufficient coverage). The likelihood of any finite sample in the set of realistic inputs $\mathcal { X }$ obtained from $\hat { \mathcal { D } }$ should be non-zero under the measure $\hat { \mu }$ : $\hat { \mu } ( \mathcal { W } ) > 0$ for all open measurable subsets $\mathcal { W } \subseteq \mathcal { X }$ .
112
+
113
+ Proposition 2 (infinite-capacity regime). Cond. 1, Cond. 3 and Cond. 4 are sufficient conditions that allow the sub-optimal parameters $\hat { \pmb { \theta } } ^ { \star }$ to match the performance of the optimal parameters $\pmb { \theta } ^ { \star }$ when the model $f$ has infinite capacity.
114
+
115
+ Cond. 3 enforces that labels are non-conflicting within the perturbation set of a realistic input,3 while Cond. 4 guarantees that realistic inputs appear with enough frequency during training. Together, Cond. 1, 3 and 4 do not only provide sufficient conditions for the infinite-capacity regime (see proof in Sec. E.1), but also explain why samples generated by a simple class-conditional Gaussian-fit can be used to improve robustness. Indeed, they imply that it is not necessary to have access to either the true data distribution or a perfect generative model when given enough compute and capacity. However, when compute and capacity are limited, it is critical that the optimization in Eq. 5 focuses on realistic inputs and that the distribution $\hat { \mathcal { D } }$ be as close as possible to the true distribution $\mathcal { D }$ . In practice, this translates to the fact that better generative models (such as DDPM) can be used to achieve better robustness. We have relegated a discussion about the theoretical impact of the mixing factor $\alpha$ in Sec. E.2. Briefly stated, increasing $\alpha$ improves the realism of training samples (since the training samples mostly come from the original training set), but comes at the cost of a reduction in complementarity with the training set.
116
+
117
+ Table 1: Complementarity and coverage of augmented and generated samples. We sample 10K images from the train set and various different generative models. For each sample in each set, we find its closest neighbor in Inception feature space (obtained after the pooling layer). To estimate complementarity, we report the proportion of samples with a nearest neighbor in either the train set, test set or the sampled set itself. To estimate coverage, we report the proportion of unique neighbors in the train and test set. We also include the IS and FID computed from 50K samples from each set and the robust accuracy obtained by a WRN-28-10 models trained on 1M samples (Sec. 6).
118
+
119
+ <table><tr><td rowspan="2"> SETUP</td><td colspan="3">COMPLEMENTARITY</td><td colspan="2">COVERAGE</td><td colspan="2">INCEPTION METRICS</td><td rowspan="2">ROBUST ACCURACY ↑</td></tr><tr><td>TRAIN</td><td>Test</td><td>SELF</td><td>TRAIN</td><td>TesT</td><td>Is↑</td><td>FID↓</td></tr><tr><td>mixup [81]</td><td>90.34%</td><td>3.91%</td><td>5.75%</td><td>90.43%</td><td>45.61%</td><td>9.33 ± 0.22</td><td>7.71</td><td></td></tr><tr><td>Class-conditional Gaussian-fit</td><td>0.13%</td><td>0.22%</td><td>99.65%</td><td>12.36%</td><td>12.24%</td><td>3.64±0.03</td><td>117.62</td><td>55.37%</td></tr><tr><td>VDVAE [14]</td><td>11.97%</td><td>12.14%</td><td>75.89%</td><td>34.20%</td><td>33.76%</td><td>6.88 ±0.05</td><td>26.44</td><td>55.51%</td></tr><tr><td>BigGAN[7]</td><td>14.97%</td><td>14.81%</td><td>70.22%</td><td>38.86%</td><td>39.06%</td><td>9.73 ±0.07</td><td>13.78</td><td>55.99%</td></tr><tr><td>StyleGAN2 [40]</td><td>28.13%</td><td>27.22%</td><td>44.65%</td><td>50.16%</td><td>48.29%</td><td>10.04± 0.11</td><td>2.57</td><td>58.17%</td></tr><tr><td>DDPM[36]</td><td>29.29%</td><td>29.17%</td><td>41.54%</td><td>49.07%</td><td>49.10%</td><td>9.50 ± 0.14</td><td>3.15</td><td>60.73%</td></tr></table>
120
+
121
+ # 5 Generative models
122
+
123
+ The derivations from Sec. 4 and the experiment performed in Sec. 3.2 strongly suggest that generative models, which are capable of creating novel images [54], are viable augmentation candidates for adversarial training.
124
+
125
+ Generative models considered in this work. In this work, we limit ourselves to generative models that are solely trained on the original train set, as we focus on how to improve robustness in the setting without external data. We consider four recent and fundamentally different models: (i) BigGAN [7]: one of the first large-scale application of Generative Adversarial Networks (GANs) which produced significant improvements in Frechet Inception Distance (FID) and Inception Score (IS) on CIFAR-10 (as well as on IMAGENET); (ii) VDVAE [14]: a hierarchical Variational AutoEncoder (VAE) which outperforms alternative VAE baselines; (iii) StyleGAN2 [40]: an improved version of StyleGAN which borrows interesting properties from the style transfer literature; and (iv) DDPM [36]: a diffusion probabilistic model based on Langevin dynamics that reaches state-of-the-art FID on CIFAR-10.4 As we have done for the simpler class-conditional Gaussian-fit, for each model, we sample 100K images per class, resulting in 1M images in total (see App. D for details). Samples are shown in App. D.
126
+
127
+ Analysis of complementary and coverage. In Table 1, we evaluate how close Cond. 2 and Cond. 4 are to be satisfied in practice. To do so, we sample 10K images from each generative model. We also sample 10K images from the CIFAR-10 training set, and apply mixup to them as a point of comparison.5 We observe that mixup achieves a similar IS to the BigGAN and DDPM models. In the left-most set of three columns, for each augmented or generated sample, we report whether its closest neighbor in the Inception6 feature space belongs to the train set, test set or the generated set itself (more details are available in App. D). An ideal generative model should create samples that are equally likely to be close to images from each set. We observe that mixup tends to produce samples that are too close to the original train set and that lack complementarity, potentially explaining its limited usefulness in terms of improving adversarial robustness. Meanwhile, generated samples (including those from the class-conditional Gaussian-fit) are much more likely to be close to images of the test set. We also observe that the DDPM neighbor distribution matches more closely the ideal uniform distribution. Images generated by BigGAN and VDVAE tend to have their nearest neighbor among themselves which indicates that these samples are either far from the train and test distributions or produce overly similar samples. Images generated by StyleGAN2, which reach an FID of 2.57 and IS of 10.07 that are better than the DDPM scores, have a slightly worse neighbor distribution (indicating a slight memorization of the training set). The middle two columns measure the ratio of unique neighbors that are matched in the train and test set. This provides a rough approximation of coverage. We observe a similar trend where samples from the DDPM seem to provide a better coverage of the true data distribution. Note that, while these numbers rely on an inaccurate distance measure (i.e., Euclidean distance in Inception feature space) and should be taken with a grain of salt, they correlate well with the results obtained from our experiments. For example, models trained with StyleGAN2 samples obtain a lower robust accuracy than those trained with DDPM samples – despite obtaining better FID and IS.
128
+
129
+ ![](images/a258345ad42ce663855c9b9f41cda34f90e8fb3d6c743c8733aecb768f7c50f9.jpg)
130
+ Figure 4: Impact of violations of the sufficient conditions detailed in Sec. 4. We report the robust test accuracy (against $\mathbf { A } \mathbf { A } { + } \mathbf { M } \mathbf { T }$ [30]) when training different model architectures against $\epsilon _ { \infty } = 8 / 2 5 5$ . In panel (a), non-robust classifiers with different clean acccuracies are used for pseudo-labeling. In panel (b), we vary the mixture of training samples from a class-conditional Gaussian and a BigGAN distribution while the test distribution is the BigGAN distribution. In panel (c), we fix the proportion of samples from the class-conditional Gaussian to $9 9 \%$ and increase the number of classes from the BigGAN distribution seen during training (thus increasing coverage).
131
+
132
+ # 6 Experiments
133
+
134
+ The experimental setup is explained in App. A. We use Residual Networks (ResNets) and Wide ResNets (WRNs) [31, 79] with Swish/SiLU [33] activations. We use stochastic weight averaging [38] with a decay rate of 0.995. For adversarial training, we use TRADES [82] with 10 Projected Gradient Descent (PGD) steps. We train for 400 CIFAR-10-equivalent epochs with a batch size of 1024 (i.e., 19K steps). We evaluate our models against AUTOATTACK [16] and MULTITARGETED [29], which is denoted $\mathbf { A A } { + } \mathbf { M } \mathbf { T }$ [30]. For comparison, we trained ten WRN-28-10 models on CIFAR-10 (without additional generated samples) against $\epsilon _ { \infty } = 8 / 2 5 5$ . The resulting robust accuracy is $5 4 . 4 4 { \pm } 0 . 3 9 \%$ , thus showing a relatively low variance. Furthermore, as we will see, our best models are well clear of the threshold for statistical significance. On CIFAR-10 against $\epsilon _ { \infty } = 8 / 2 5 5$ without additional generated samples a ResNet-18 achieves a robust accuracy of $5 0 . 6 4 \%$ and a WRN-70-16 achieves $5 7 . 1 4 \%$ . Unless stated otherwise, all results pertain to CIFAR-10.
135
+
136
+ # 6.1 Sufficient conditions
137
+
138
+ The first set of experiments probes how violations of Cond. 1, 2 and 4 impact robustness against $\epsilon _ { \infty } = 8 / 2 5 5$ (violations to Cond. 3 have an impact equivalent to those of Cond. 1). All experiments are summarized in Fig. 4 where we train models with increasing capacity.
139
+
140
+ Non-robust classifier accuracy. In Fig. 4(a), we train models using 1M samples generated by the DDPM and vary the accuracy of the the pre-trained, non-robust classifier $f _ { \mathrm { N R } }$ . We evaluate the robust accuracy obtained on CIFAR-10 test set. We observe that robustness improves as the accuracy of $f _ { \mathrm { N R } }$ increases. Notably, even with the $7 4 . 4 7 \%$ -accurate non-robust classifier, the WRN-28-10 and WRN-70-16 obtain robust accuracies of $5 8 . 1 5 \%$ and $5 9 . 8 3 \%$ , respectively, and already improve upon the state-of-the-art $( 5 7 . 1 4 \%$ at the time of writing). Thus, validating that, in practice, it is not necessary to have access to a perfect non-robust classifier.
141
+
142
+ Quality of the generative models. To analyze how the quality of the generative model influences robustness, we use the BigGAN to model the “true” data distribution. During training, we use samples generated from a mixture of the class-conditional Gaussian and BigGAN distributions; during testing, we evaluate on a separate subset of 10K unseen BigGAN samples. To probe Cond. 2, we change the proportion of training samples from the class-conditional Gaussian. In effect, decreasing the proportion of such samples skews the mixed generative model (modeled by the mixture of Gaussian and BigGAN distributions) to produce more samples from the true distribution (modeled by the BigGAN distribution), thereby closing the gap between the approximated distribution $\hat { \mathcal { D } }$ and true distribution $\mathcal { D }$ . As expected, Fig. 4(b) demonstrates that, given enough capacity, models can significantly reduce the adversarial risk.
143
+
144
+ ![](images/ae444178f536b7d1189a65c00f2c5be9d41a215baebe793de3b527af52a200d2.jpg)
145
+ Figure 5: Robust test accuracy obtained by training a WRN-28-10 against $\epsilon _ { \infty } = 8 / 2 5 5$ on CIFAR-10 when using additional data produced by different generative models. We compare how the ratio between original and generated images (i.e., $\alpha$ ) affects robustness ( $0 \%$ means generated samples only, $100 \%$ means CIFAR-10 train set only).
146
+ Table 2: Clean (without perturbations) and robust (under adversarial attack) accuracy obtained by different models (we pick the worst accuracy obtained by either AUTOATTACK or $\mathbf { A A + M T } ,$ ). The accuracies are reported on the full test sets. For CIFAR-10, we test against $\epsilon _ { \infty } ~ = ~ 8 / 2 5 5$ and $\epsilon _ { 2 } =$ 128/255. For CIFAR-100, SVHN and TINYIMAGENET, we test against $\epsilon _ { \infty } = 8 / 2 5 5$ . \* This model is trained for 2000 epochs on 100M samples.
147
+
148
+ <table><tr><td>MODEL</td><td>DATASET</td><td>NORM</td><td>CLEAN</td><td>ROBUST</td></tr><tr><td>Wu et al.[75](WRN-34-10) Gowal et al.[30](WRN-70-16) Ours (DDPM) (WRN-28-10) Ours (DDPM)(WRN-70-16) Ours (100M DDPM)*(ResNet-18) Ours (100MDDPM)*(WRN-28-10) Ours (100M DDPM)*(WRN-70-16)</td><td>CIFAR-10</td><td>lo</td><td>85.36% 85.29% 85.97% 86.94% 87.35% 87.50% 88.74%</td><td>56.17% 57.14% 60.73% 63.58% 58.50% 63.38% 66.10%</td></tr><tr><td>Wu et al.[75](WRN-34-10) Gowal et al. [30] (WRN-70-16) Ours (DDPM) (WRN-28-10) Ours (DDPM) (WRN-70-16)</td><td>CIFAR-10</td><td>l2</td><td>88.51% 90.90% 90.24% 90.83%</td><td>73.66% 74.50% 77.37% 78.31%</td></tr><tr><td>Cui et al. [20](WRN-34-10) Gowal et al. [30] (WRN-70-16) Ours (DDPM)(WRN-28-10) Ours (DDPM) (WRN-70-16)</td><td>CIFAR-100</td><td>lo</td><td>60.64% 60.86% 59.18% 60.46%</td><td>29.33% 30.03% 30.81% 33.49%</td></tr><tr><td>Ours (without DDPM) (WRN-28-10) Ours (DDPM) (WRN-28-10)</td><td>SVHN</td><td>l</td><td>92.87% 94.15%</td><td>56.83% 60.90%</td></tr><tr><td>Ours (without DDPM)(WRN-28-10) Ours (DDPM) (WRN-28-10)</td><td>TINYIMAGENET</td><td>l</td><td>51.56% 60.95%</td><td>21.56% 26.66%</td></tr></table>
149
+
150
+ Relationship between coverage and capacity. Similarly to Fig. 4(b), we use samples generated from a mixture of the class-conditional Gaussian and BigGAN distributions; during testing, we evaluate on a separate subset of 10K unseen BigGAN samples. To probe Cond. 4, we keep the proportion of samples from the class-conditional Gaussian distribution fixed at $9 9 \%$ and use the remaining $1 \%$ to include BigGAN samples corresponding to either 0, 1, . . . or 10 classes (thereby increasing coverage). In other words, the coverage of the true data distribution $\mathcal { D }$ (given by the BigGAN) increases as the number of seen classes increases. However, the approximated distribution $\hat { \mathcal { D } }$ remains different from the true data distribution even when the coverage reaches all classes (as the proportion of Gaussian samples is fixed to $9 9 \%$ ). We observe in Fig. 4(c) that the robust accuracy of models with lower capacity improves less drastically – yielding a gap of $1 7 . 3 7 \%$ at full coverage between the ResNet-18 and WRN-70-16 models. This observation confirms that, with enough coverage, model capacity can compensate for the lack of a perfect generative model.
151
+
152
+ Discussion. Overall, Fig. 4(b) shows that when Cond. 2 is satisfied, the difference between models reduces and capacity takes a secondary role (since all models can bring their adversarial risk close to zero). Fig. 4(c) shows that when Cond. 4 is satisfied (and Cond. 2 is not), capacity matters as we observe that larger models benefit more from increased coverage. Both figures point to the fact that the quality of the generative model becomes less important when the capacity of the classifiers increases (as long as coverage is sufficient).
153
+
154
+ # 6.2 State-of-the-art robust accuracy
155
+
156
+ Effect of mixing factor $( \alpha )$ . As done in Sec. 3.3, we vary the proportion $\alpha$ of original images in each batch for all generated datasets. Fig. 5 explores a wide range of proportions while training a
157
+
158
+ WRN-28-10 against $\epsilon _ { \infty } = 8 / 2 5 5$ on CIFAR-10. Samples from all models improve robustness when mixed optimally, but only samples from the StyleGAN2 and DDPM improve robustness significantly $( + 3 . 7 3 \%$ and $+ 6 . 2 9 \%$ , respectively). It is also interesting to observe that, in the case of the DDPM, using 1M generated images is better than using the 50K images from the original train set only. While this may seem surprising, it can easily be explained if we assume that the DDPM produces many more high-quality, high-diversity images than the limited set of images present in the original data (c.f. [62]). We also observe that the optimal mixing factor is different for different generative models. Indeed, increasing $\alpha$ reduces the gap to the true data distribution at the cost of less complementarity with the original train set (see Sec. E.2).
159
+
160
+ CIFAR-10. Table 2 shows the performance of models trained with 1M samples generated by the DDPM on CIFAR-10 against $\epsilon _ { \infty } = 8 / 2 5 5$ and $\epsilon _ { 2 } = 1 2 8 / 2 5 5$ . Irrespective of their size, models trained with 1M DDPM samples surpass the current state-of-the-art in robust accuracy by a large margin $+ 6 . 4 4 \%$ and $+ 3 . 8 1 \%$ ). When using 100M DDPM samples (and training for 2000 epochs), we reach $6 6 . 1 0 \%$ robust accuracy against $\epsilon _ { \infty } = 8 / 2 5 5$ which constitutes an improvement of $+ 8 . 9 6 \%$ over the state-of-the-art. In this setting, our smallest model (ResNet-18) surpasses state-of-the-art results obtained by much larger models (e.g., WRN-70-16). Most remarkably, despite not using any external data, against $\epsilon _ { \infty } = 8 / 2 5 5$ , our best model beats all RobustBench [17] entries that used external data (see Table 6 in the appendix).
161
+
162
+ Generalization to other datasets (CIFAR-100, SVHN and TINYIMAGENET). Finally, to evaluate the generality of our approach, we evaluate it on CIFAR-100, SVHN [53] and TINYIMAGENET [26]. We train two new DDPM on the train set of CIFAR-100 and SVHN and sample 1M images from each. For TINYIMAGENET, we use a DDPM trained on IMAGENET [24] at $6 4 \times 6 4$ resolution and restricted samples to the 200 classes of TINYIMAGENET. The results are shown in Table 2. On CIFAR-100, our best model reaches a robust accuracy of $3 3 . 4 9 \%$ and improves noticeably upon the state-of-the-art by $+ 3 . 4 6 \%$ (in the setting that does not use any external data). On SVHN, in the same table, we compare models trained without and with DDPM samples. Again, the addition of DDPM samples significantly improves robustness, with the robust accuracy improving by by $+ 4 . 0 7 \%$ . On TINYIMAGENET, the improvement is $+ 5 . 1 0 \%$ .
163
+
164
+ # 7 Conclusion.
165
+
166
+ Using generative models, we posit and demonstrate that generated samples provide a greater diversity of augmentations that allow adversarial training to go well beyond the current state-of-the-art. Our work provides novel insights into the effect of diversity and complementarity on robustness, which we hope can further our understanding of robustness. All our models and generated datasets are available online at https://github.com/deepmind/deepmind-research/tree/master/adversarial_robustness.
167
+
168
+ # References
169
+
170
+ [1] A. Athalye and I. Sutskever. Synthesizing robust adversarial examples. Int. Conf. Mach. Learn., 2018.
171
+ [2] A. Athalye, N. Carlini, and D. Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. Int. Conf. Mach. Learn., 2018.
172
+ [3] A. N. Bhagoji, D. Cullina, and P. Mittal. Lower bounds on adversarial robustness from optimal transport. Adv. Neural Inform. Process. Syst., 2019.
173
+ [4] B. Biggio, I. Corona, D. Maiorca, B. Nelson, N. Šrndic, P. Laskov, G. Giacinto, and F. Roli. ´ Evasion attacks against machine learning at test time. In Machine Learning and Knowledge Discovery in Databases, 2013.
174
+ [5] M. Bojarski, D. Del Testa, D. Dworakowski, B. Firner, B. Flepp, P. Goyal, L. D. Jackel, M. Monfort, U. Muller, J. Zhang, X. Zhang, J. Zhao, and K. Zieba. End to end learning for self-driving cars. NIPS Deep Learning Symposium, 2016. [6] J. Bradbury, R. Frostig, P. Hawkins, M. J. Johnson, C. Leary, D. Maclaurin, and S. WandermanMilne. JAX: composable transformations of Python+NumPy programs, 2018. URL http: //github.com/google/jax. [7] A. Brock, J. Donahue, and K. Simonyan. Large scale gan training for high fidelity natural image synthesis. Int. Conf. Learn. Represent., 2018. [8] T. Brunner, F. Diehl, M. T. Le, and A. Knoll. Guessing smart: Biased sampling for efficient black-box adversarial attacks. arXiv preprint arXiv:1812.09803, 2019. [9] N. Carlini and D. Wagner. Adversarial examples are not easily detected: Bypassing ten detection methods. In Proceedings of the 10th ACM Workshop on Artificial Intelligence and Security, pages 3–14. ACM, 2017.
175
+ [10] N. Carlini and D. Wagner. Towards evaluating the robustness of neural networks. In 2017 IEEE Symposium on Security and Privacy, 2017.
176
+ [11] Y. Carmon, A. Raghunathan, L. Schmidt, J. C. Duchi, and P. S. Liang. Unlabeled data improves adversarial robustness. In Adv. Neural Inform. Process. Syst., 2019.
177
+ [12] H. Chang, T. D. Nguyen, S. K. Murakonda, E. Kazemi, and R. Shokri. On adversarial bias and the robustness of fair machine learning. arXiv preprint arXiv:2006.08669, 2020.
178
+ [13] D. Chen, N. Yu, Y. Zhang, and M. Fritz. Gan-leaks: A taxonomy of membership inference attacks against generative models. arXiv preprint arXiv:1909.03935, 2020.
179
+ [14] R. Child. Very deep vaes generalize autoregressive models and can outperform them on images. Int. Conf. Learn. Represent., 2021.
180
+ [15] P. Covington, J. Adams, and E. Sargin. Deep neural networks for YouTube recommendations. In Proceedings of the 10th ACM Conference on Recommender Systems, 2016.
181
+ [16] F. Croce and M. Hein. Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks. arXiv preprint arXiv:2003.01690, 2020.
182
+ [17] F. Croce, M. Andriushchenko, V. Sehwag, N. Flammarion, M. Chiang, P. Mittal, and M. Hein. Robustbench: a standardized adversarial robustness benchmark. arXiv preprint arXiv:2010.09670, 2020.
183
+ [18] E. D. Cubuk, B. Zoph, D. Mane, V. Vasudevan, and Q. V. Le. Autoaugment: Learning augmentation policies from data. IEEE Conf. Comput. Vis. Pattern Recog., 2019.
184
+ [19] E. D. Cubuk, B. Zoph, J. Shlens, and Q. V. Le. Randaugment: Practical automated data augmentation with a reduced search space. IEEE Conf. Comput. Vis. Pattern Recog., 2020.
185
+ [20] J. Cui, S. Liu, L. Wang, and J. Jia. Learnable boundary guided adversarial training. arXiv preprint arXiv:2011.11164, 2020.
186
+ [21] D. Cullina, A. N. Bhagoji, and P. Mittal. Pac-learning in the presence of adversaries. In Adv. Neural Inform. Process. Syst., 2018.
187
+ [22] J. De Fauw, J. R. Ledsam, B. Romera-Paredes, S. Nikolov, N. Tomasev, S. Blackwell, H. Askham, X. Glorot, B. O’Donoghue, D. Visentin, G. v. d. Driessche, B. Lakshminarayanan, C. Meyer, F. Mackinder, S. Bouton, K. Ayoub, R. Chopra, D. King, A. Karthikesalingam, C. O. Hughes, R. Raine, J. Hughes, D. A. Sim, C. Egan, A. Tufail, H. Montgomery, D. Hassabis, G. Rees, T. Back, P. T. Khaw, M. Suleyman, J. Cornebise, P. A. Keane, and O. Ronneberger. Clinically applicable deep learning for diagnosis and referral in retinal disease. In Nature Medicine, 2018.
188
+ [23] T. DeVries and G. W. Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017.
189
+ [24] P. Dhariwal and A. Nichol. Diffusion models beat GANs on image synthesis. arXiv preprint arXiv:2105.05233, 2021.
190
+ [25] Y. Dong, F. Liao, T. Pang, H. Su, J. Zhu, X. Hu, and J. Li. Boosting Adversarial Attacks with Momentum. IEEE Conf. Comput. Vis. Pattern Recog., 2018.
191
+ [26] A. K. Fei-Fei Li and J. Johnson. The Tiny ImageNet dataset. 2017. URL https://www.kaggle.com/c/ tiny-imagenet.
192
+ [27] I. J. Goodfellow, J. Shlens, and C. Szegedy. Explaining and harnessing adversarial examples. Int. Conf. Learn. Represent., 2015.
193
+ [28] S. Gowal, C. Qin, P.-S. Huang, T. Cemgil, K. Dvijotham, T. Mann, and P. Kohli. Achieving Robustness in the Wild via Adversarial Mixing with Disentangled Representations. arXiv preprint arXiv:1912.03192, 2019.
194
+ [29] S. Gowal, J. Uesato, C. Qin, P.-S. Huang, T. Mann, and P. Kohli. An Alternative Surrogate Loss for PGD-based Adversarial Testing. arXiv preprint arXiv:1910.09338, 2019.
195
+ [30] S. Gowal, C. Qin, J. Uesato, T. Mann, and P. Kohli. Uncovering the limits of adversarial training against norm-bounded adversarial examples. arXiv preprint arXiv:2010.03593, 2020.
196
+ [31] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. IEEE Conf. Comput. Vis. Pattern Recog., 2016.
197
+ [32] D. Hendrycks and T. Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In Int. Conf. Learn. Represent., 2018.
198
+ [33] D. Hendrycks and K. Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
199
+ [34] D. Hendrycks, S. Basart, N. Mu, S. Kadavath, F. Wang, E. Dorundo, R. Desai, T. Zhu, S. Parajuli, M. Guo, D. Song, J. Steinhardt, and J. Gilmer. The Many Faces of Robustness: A Critical Analysis of Out-of-Distribution Generalization. arXiv preprint arXiv:2006.16241, 2020. URL https://arxiv.org/pdf/2006.16241.
200
+ [35] T. Hennigan, T. Cai, T. Norman, and I. Babuschkin. Haiku: Sonnet for JAX, 2020. URL http://github.com/deepmind/dm-haiku.
201
+ [36] J. Ho, A. Jain, and P. Abbeel. Denoising diffusion probabilistic models. Adv. Neural Inform. Process. Syst., 2021.
202
+ [37] E. Härkönen, A. Hertzmann, J. Lehtinen, and S. Paris. GANSpace: Discovering Interpretable GAN Controls. arXiv preprint arXiv:2004.02546, 2020.
203
+ [38] P. Izmailov, D. Podoprikhin, T. Garipov, D. Vetrov, and A. G. Wilson. Averaging Weights Leads to Wider Optima and Better Generalization. Uncertainty in Artificial Intelligence, 2018.
204
+ [39] A. Jahanian, L. Chai, and P. Isola. On the "steerability" of generative adversarial networks. In Int. Conf. Learn. Represent., 2019.
205
+ [40] T. Karras, S. Laine, M. Aittala, J. Hellsten, J. Lehtinen, and T. Aila. Analyzing and improving the image quality of stylegan. In IEEE Conf. Comput. Vis. Pattern Recog., 2020.
206
+ [41] D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. Int. Conf. Learn. Represent., 2015.
207
+ [42] A. Krizhevsky, V. Nair, and G. Hinton. The CIFAR-10 dataset. 2014. URL http://www.cs.toronto. edu/kriz/cifar.html.
208
+ [43] S. Kumar, V. Bitorff, D. Chen, C. Chou, B. Hechtman, H. Lee, N. Kumar, P. Mattson, S. Wang, T. Wang, Y. Xu, and Z. Zhou. Scale mlperf-0.6 models on google tpu-v3 pods. arXiv preprint arXiv:1909.09756, 2019.
209
+ [44] A. Kurakin, I. Goodfellow, and S. Bengio. Adversarial examples in the physical world. ICLR workshop, 2016.
210
+ [45] C. Laidlaw, S. Singla, and S. Feizi. Perceptual adversarial robustness: Defense against unseen threat models. In Int. Conf. Learn. Represent., 2021.
211
+ [46] J. Lee and M. Raginsky. Minimax statistical learning with wasserstein distances. Adv. Neural Inform. Process. Syst., 2018.
212
+ [47] I. Loshchilov and F. Hutter. SGDR: stochastic gradient descent with warm restarts. In Int. Conf. Learn. Represent., 2017.
213
+ [48] D. Madaan, J. Shin, and S. J. Hwang. Learning to generate noise for robustness against multiple perturbations. arXiv preprint arXiv:2006.12135, 2020.
214
+ [49] A. Madry, A. Makelov, L. Schmidt, D. Tsipras, and A. Vladu. Towards deep learning models resistant to adversarial attacks. Int. Conf. Learn. Represent., 2018.
215
+ [50] M. Mosbach, M. Andriushchenko, T. Trost, M. Hein, and D. Klakow. Logit Pairing Methods Can Fool Gradient-Based Attacks. arXiv preprint arXiv:1810.12042, 2018.
216
+ [51] A. Najafi, S.-i. Maeda, M. Koyama, and T. Miyato. Robustness to adversarial perturbations in learning from incomplete data. Adv. Neural Inform. Process. Syst., 2019.
217
+ [52] Y. Nesterov. A method of solving a convex programming problem with convergence rate $o ( 1 / k ^ { 2 } )$ . In Sov. Math. Dokl, 1983.
218
+ [53] Y. Netzer, T. Wang, A. Coates, A. Bissacco, B. Wu, and A. Y. Ng. Reading digits in natural images with unsupervised feature learning. 2011.
219
+ [54] OpenAI. Dall-e: Creating images from text, 2021. URL https://openai.com/blog/dall-e.
220
+ [55] T. Pang, X. Yang, Y. Dong, H. Su, and J. Zhu. Bag of tricks for adversarial training. arXiv preprint arXiv:2010.00467, 2020.
221
+ [56] T. Pang, X. Yang, Y. Dong, K. Xu, H. Su, and J. Zhu. Boosting Adversarial Training with Hypersphere Embedding. Adv. Neural Inform. Process. Syst., 2020.
222
+ [57] A. Plumerault, H. L. Borgne, and C. Hudelot. Controlling generative models with continuous factors of variations. In Int. Conf. Learn. Represent., 2020.
223
+ [58] B. T. Polyak. Some methods of speeding up the convergence of iteration methods. USSR Computational Mathematics and Mathematical Physics, 1964.
224
+ [59] S. Ravuri and O. Vinyals. Classification Accuracy Score for Conditional Generative Models. arXiv preprint arXiv:1905.10887, 2019.
225
+ [60] L. Rice, E. Wong, and J. Z. Kolter. Overfitting in adversarially robust deep learning. Int. Conf. Mach. Learn., 2020.
226
+ [61] P. Samangouei, M. Kabkab, and R. Chellappa. Defense-gan: Protecting classifiers against adversarial attacks using generative models. In Int. Conf. Learn. Represent., 2018.
227
+ [62] L. Schmidt, S. Santurkar, D. Tsipras, K. Talwar, and A. Madry. Adversarially Robust Generalization Requires More Data. Adv. Neural Inform. Process. Syst., 2018.
228
+ [63] L. Song, R. Shokri, and P. Mittal. Privacy risks of securing machine learning models against adversarial examples. In Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security, pages 241–257, 2019.
229
+ [64] C. Szegedy, W. Zaremba, I. Sutskever, J. Bruna, D. Erhan, I. Goodfellow, and R. Fergus. Intriguing properties of neural networks. Int. Conf. Learn. Represent., 2014.
230
+ [65] A. Torralba, R. Fergus, and W. T. Freeman. 80 million tiny images: a large dataset for nonparametric object and scene recognition. IEEE Trans. Pattern Anal. Mach. Intell., 2008.
231
+ [66] F. Tramer, N. Carlini, W. Brendel, and A. Madry. On adaptive attacks to adversarial example defenses. arXiv preprint arXiv:2002.08347, 2020.
232
+ [67] F. Tramèr, A. Kurakin, N. Papernot, I. Goodfellow, D. Boneh, and P. McDaniel. Ensemble Adversarial Training: Attacks and Defenses. arXiv preprint arXiv:1705.07204, 2017.
233
+ [68] F. Tramèr, J. Behrmann, N. Carlini, N. Papernot, and J.-H. Jacobsen. Fundamental Tradeoffs between Invariance and Sensitivity to Adversarial Perturbations. arXiv preprint arXiv:2002.04599, 2020.
234
+ [69] D. Tsipras, S. Santurkar, L. Engstrom, A. Turner, and A. Madry. Robustness may be at odds with accuracy. arXiv preprint arXiv:1805.12152, 2018.
235
+ [70] Z. Tu, J. Zhang, and D. Tao. Theoretical analysis of adversarial learning: A minimax approach. In Adv. Neural Inform. Process. Syst. 2019.
236
+ [71] J. Uesato, B. O’Donoghue, A. v. d. Oord, and P. Kohli. Adversarial Risk and the Dangers of Evaluating Against Weak Attacks. Int. Conf. Mach. Learn., 2018.
237
+ [72] J. Uesato, J.-B. Alayrac, P.-S. Huang, R. Stanforth, A. Fawzi, and P. Kohli. Are labels required for improving adversarial robustness? Adv. Neural Inform. Process. Syst., 2019.
238
+ [73] E. Wong and J. Z. Kolter. Learning perturbation sets for robust machine learning. In Int. Conf. Learn. Represent., 2021.
239
+ [74] B. Wu, J. Chen, D. Cai, X. He, and Q. Gu. Do wider neural networks really help adversarial robustness? arXiv preprint arXiv:2010.01279, 2021.
240
+ [75] D. Wu, S.-t. Xia, and Y. Wang. Adversarial weight perturbation helps robust generalization. Adv. Neural Inform. Process. Syst., 2020.
241
+ [76] C. Xie, Y. Wu, L. van der Maaten, A. Yuille, and K. He. Feature denoising for improving adversarial robustness. IEEE Conf. Comput. Vis. Pattern Recog., 2019.
242
+ [77] Y. Yang, G. Zhang, D. Katabi, and Z. Xu. Me-net: Towards effective adversarial robustness with matrix estimation. In Int. Conf. Mach. Learn., 2019.
243
+ [78] S. Yun, D. Han, S. J. Oh, S. Chun, J. Choe, and Y. Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. Int. Conf. Comput. Vis., 2019.
244
+ [79] S. Zagoruyko and N. Komodakis. Wide residual networks. Brit. Mach. Vis. Conf., 2016.
245
+ [80] R. Zhai, T. Cai, D. He, C. Dan, K. He, J. Hopcroft, and L. Wang. Adversarially Robust Generalization Just Requires More Unlabeled Data. arXiv preprint arXiv:1906.00555, 2019.
246
+ [81] H. Zhang, M. Cisse, Y. N. Dauphin, and D. Lopez-Paz. mixup: Beyond empirical risk minimization. Int. Conf. Learn. Represent., 2018.
247
+ [82] H. Zhang, Y. Yu, J. Jiao, E. P. Xing, L. E. Ghaoui, and M. I. Jordan. Theoretically Principled Trade-off between Robustness and Accuracy. Int. Conf. Mach. Learn., 2019.
248
+ [83] J. Zhang, J. Zhu, G. Niu, B. Han, M. Sugiyama, and M. Kankanhalli. Geometry-aware instancereweighted adversarial training. In Int. Conf. Learn. Represent., 2021.
249
+ [84] R. Zhang, P. Isola, A. A. Efros, E. Shechtman, and O. Wang. The unreasonable effectiveness of deep features as a perceptual metric. arXiv preprint arXiv:1801.03924, 2018.
250
+ [85] D. Zoran, M. Chrzanowski, P.-S. Huang, S. Gowal, A. Mott, and P. Kohl. Towards Robust Image Classification Using Sequential Attention Models. IEEE Conf. Comput. Vis. Pattern Recog., 2019.
251
+
252
+ # Checklist
253
+
254
+ 1. For all authors...
255
+
256
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] We claim that adversarial robustness can be improved using generated data. Experiments demonstrate that this is possible and that the improvements are significant (Sec. 6).
257
+ (b) Did you describe the limitations of your work? [Yes] The sufficient conditions detailed in Sec. 4 provide an idealized situation that we degrade in the experimental section. In particular, the method is intrinsically limited by the accuracy of the non-robust classifier $f _ { \mathrm { N R } }$ as well as the ability to generate realistic inputs.
258
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] We highlight potential pitfalls in the introduction and related work. We summarize these and highlights them more broadly in App. G
259
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
260
+
261
+ 2. If you are including theoretical results...
262
+
263
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] We provide two set of sufficient conditions. The first set, composed of Cond. 1 and Cond. 2, applies to the limited-capacity and limited-compute regime, while the second set, composed of Cond. 1, Cond. 3 and Cond. 2, applies to the infinite-capacity and infinite-compute regime. Other assumptions are detailed in Sec. 4.1.
264
+ (b) Did you include complete proofs of all theoretical results? [Yes] Proof are included in the main text and rely on either demonstrating that Eq. 4 and Eq. 5 can be made equal when Cond. 1 and Cond. 2 are satisfied (limited-capacity) or showing that the combination of Cond. 1, Cond. 3 and Cond. 4 yields a perfectly robust classifier on the subset of inputs that includes the set of realistic inputs (infinite-capacity regime).
265
+
266
+ 3. If you ran experiments...
267
+
268
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] The training and evaluation code is available at https://github.com/deepmind/deepmind-research/tree/master/ adversarial_robustness.
269
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] All details are in App. A.
270
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Adversarial training is compute-intensive and the negative-impact of running more experiments outweighed the benefits. We use the same evaluation setup than proposed in [30]. That is, we always trained two models for each hyper-parameter setup and chose the best model according to a separate validation set of 1024 images (the average degradation in robustness between both models measured on a subset of 10 hyper-parameters setups is $- 0 . 1 2 \%$ in absolute robust accuracy). We also evaluated all models with one of the strongest set of adversarial attacks. Additionally, our baseline model was trained ten times resulting in a standard deviation of $0 . 3 9 \%$ and all reported improvements in robust accuracy are well beyond 2 standard deviations.
271
+ (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] All details are in App. A.
272
+
273
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
274
+
275
+ (a) If your work uses existing assets, did you cite the creators? [Yes] We use CIFAR10 [42], CIFAR-100 [42], SVHN [53] and TINYIMAGENET [26].
276
+ (b) Did you mention the license of the assets? [No] Please refer to citations for details on licensing. All datasets are available for non-commercial use.
277
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We generate additional data using generative models. These are available online at https://github.com/deepmind/deepmind-research/tree/master/adversarial_robustness.
278
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
279
+
280
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
281
+
282
+ 5. If you used crowdsourcing or conducted research with human subjects...
283
+
284
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
285
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
286
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/1ibNKMp8SKc/1ibNKMp8SKc.md ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ON DISENTANGLED REPRESENTATIONSLEARNED FROM CORRELATED DATA
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Despite impressive progress in the last decade, it still remains an open challenge to build models that generalize well across multiple tasks and datasets. One path to achieve this is to learn meaningful and compact representations, in which different semantic aspects of data are structurally disentangled. The focus of disentanglement approaches has been on separating independent factors of variation despite the fact that real-world observations are often not structured into meaningful independent causal variables. In this work, we bridge the gap to real-world scenarios by analyzing the behavior of most prominent methods and disentanglement scores on correlated data in a large scale empirical study (including 4260 models). We show that systematically induced correlations in the dataset are being learned and reflected in the latent representations, while widely used disentanglement scores fall short of capturing these latent correlations. Finally, we demonstrate how to disentangle these latent correlations using weak supervision, even if we constrain this supervision to be causally plausible. Our results thus support the argument to learn independent mechanisms rather than independent factors of variations.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Due to the induced structure, disentangled representations promise generalization to unseen scenarios (Higgins et al., 2017b), increased interpretability (Adel et al., 2018; Higgins et al., 2018) and faster learning on downstream tasks (van Steenkiste et al., 2019; Locatello et al., 2019a). While the advantages of disentangled representations have been well established, they generally assume the existence of natural factors that vary independently within the given dataset, which is rarely the case in real-world settings. As an example, consider a scene with a table and some chairs (see Fig. 1). The higher-level factors of this representation are in fact correlated and what we actually want to infer are independent (causal) mechanisms (Peters et al., 2017; Parascandolo et al., 2018; Suter et al., 2019; Goyal et al., 2019).
12
+
13
+ A complex generative model can be thought of as the composition of independent mechanisms or “causal” modules, which generate highdimensional observations (such as images or videos). In the causality community, this is often considered a prerequisite to achieve representations which are robust to interventions upon variables determined by such models (Peters et al., 2017). One particular instantiation of this idea in the machine learning community is the notion of disentangled representations (Bengio et al., 2013). The goal of disentanglement learning is to find a representation of the data which captures all the ground-truth factors of variation (FoV) independently.
14
+
15
+ ![](images/7cd9c32eb4e5dfbc24deba208b2c328f8872a001b1f886a15b06da7c96872ccb.jpg)
16
+ Figure 1: While in principle we consider the presence of the objects (coffee cup, table, chair) to be independent mechanisms, they tend to appear together in observed data.
17
+
18
+ Despite the recent growth of the field, the performance of state-of-the-art disentanglement learners remains unknown for more realistic settings where FoV are correlated during training. Given the potential societal impact in the medical domain (Chartsias et al., 2018) or fair decision making (Locatello et al., $2 0 1 9 \mathrm { a }$ ; Madras et al., 2018; Creager et al., 2019), the evaluation of the usefulness of disentangled representations trained on correlated data is of high importance.
19
+
20
+ To go beyond the highly idealized settings considered thus far, we conducted a large scale empirical study to systematically assess the effect of induced correlations between pairs of factors of variation in training data on the learned representations. To provide a qualitative and quantitative evaluation, we investigate multiple datasets with access to ground-truth labels. Moreover, we study the generalization abilities of the representations learned on correlated data as well as their performance in particular for the downstream task of fair decision making.
21
+
22
+ Contributions. Our main contributions can be summarized as follows:
23
+
24
+ • We present the first large-scale empirical study (4260 models)1 that examines how modern disentanglement learners perform when ground truth factors of the observational data are correlated.
25
+ • We find that factorization-based inductive biases are insufficient to learn disentangled representations from observational data. Existing methods fail to disentangle correlated factors of variation, resulting in correlated latent space dimensions. Moreover, standard disentanglement metrics do not reveal these persisting correlations.
26
+ • We investigate the usefulness of semi-supervised and weakly-supervised approaches to resolve latent entanglement. For the latter setting, we focus on multiple observational and interventional distributions.
27
+
28
+ # 2 BACKGROUND AND RELATED WORK
29
+
30
+ Disentanglement. Current state-of-the-art disentanglement approaches use the framework of variational auto-encoders (VAEs) (Kingma & Welling, 2014; Rezende et al., 2014). The (high-dimensional) observations $_ { \textbf { \em x } }$ are modelled as being generated from some latent features $_ { z }$ with chosen prior $p ( z )$ according to the probabilistic model $p _ { \theta } ( \pmb { x } | \pmb { z } ) p ( \pmb { z } )$ . The generative model $p _ { \boldsymbol { \theta } } ( \boldsymbol { x } | \boldsymbol { z } )$ as well as the proxy posterior $q _ { \phi } ( \pmb { z } | \pmb { x } )$ can be parameterized by neural networks, which are optimized by maximizing the variational lower bound (ELBO) of $\log p ( \pmb { x } _ { 1 } , \ldots , \pmb { x } _ { N } )$ .
31
+
32
+ $$
33
+ \mathcal { L } _ { V A E } = \sum _ { i = 1 } ^ { N } \mathbb { E } _ { q _ { \phi } ( z | \mathbf { x } ^ { ( i ) } ) } [ \log p _ { \theta } ( \mathbf { x } ^ { ( i ) } | z ) ] - D _ { K L } \big ( q _ { \phi } ( z | \mathbf { x } ^ { ( i ) } ) \| p ( z ) \big )
34
+ $$
35
+
36
+ The above objective does not enforce any structure on the latent space, except for similarity (in KL-divergence) to the prior $p ( z )$ (typically chosen as an isotropic Gaussian). However, the structure and semantic meaning of latent representations can be relevant to study generation properties. Consequently, various proposals for structure-imposing regularization and commonly used evaluation metrics measuring different notions of disentanglement of the learned representations have been made (Higgins et al., 2017a; Kim & Mnih, 2018; Burgess et al., 2018; Kumar et al., 2018; Chen et al., 2018; Eastwood & Williams, 2018; Mathieu et al., 2018). Recently, it has been shown that unsupervised disentangling by optimising marginal likelihood in a generative model is impossible without further inductive bias (Locatello et al., 2019b). To address this theoretical limitation, methods have been proposed that do not require explicitly labelled data but only some weak labeling information (Locatello et al., 2020; Shu et al., 2019). Ideas related to disentangling the factors of variations date back to the non-linear ICA literature (Bach & Jordan, 2002; Comon, 1994; Jutten & Karhunen, 2003; Hyvärinen & Pajunen, 1999; Hyvarinen et al., 2019; Hyvarinen & Morioka, 2016; Gresele et al., 2019). Recent work combines non-linear ICA with disentanglement (Khemakhem et al., 2020; Sorrenson et al., 2020; Klindt et al., 2020)
37
+
38
+ Correlations. A set of random variables $X _ { i = 1 , \ldots , n }$ is not independent, if and only if their joint distribution does not factorize
39
+
40
+ $$
41
+ P ( X _ { 1 } , X _ { 2 } , \ldots , X _ { n } ) \neq \prod _ { i = 1 } ^ { n } P ( X _ { i } ) .
42
+ $$
43
+
44
+ In this case, we speak of dependence between the random variables, also commonly referred to as correlation.2 Correlation between two variables can either stem from a direct causal relationship (one variable affects the other), but can also be due to different unobserved circumstances (confounders) affecting both. Real-world datasets display many of these (“spurious” and often a priori unknown) correlations (Geirhos et al., 2020). However, most work on learning disentangled representations assumes that there is an underlying set of independent ground truth variables that govern the generative process of observable data. These methods are hence predominantly evaluated on data that obey independence in the true factors of variation, which we then consider to be the correct factorization. In the real world, the observation generating process is likely not always as clearly “disentangled” and we do expect correlations in the collected datasets. It is thus an open question to what degree existing inductive biases from the encoder/decoder architecture, but more importantly the dataset biases, affect the learned representation. In our experiments, we introduce dataset correlations in a controlled manner to understand to what degree state-of-the-art approaches can cope with such correlations. We believe these correlations to reflect a major feature of more realistic environments.
45
+
46
+ ![](images/8434d800ad72d18ee910812aa691bbcbaf1629e87d4199312f4297e9514c68d5.jpg)
47
+ Figure 2: Disentanglement metrics show no clear trend along different correlation strengths (each violin represents 180 models, higher $\sigma$ indicates less correlation).
48
+
49
+ Other Related Work. Most popular datasets in the disentanglement literature exhibit perfect independence in their FoV. At some level this is sensible as it reflects the underlying assumption in the inductive bias being studied. However, this assumption is unlikely to hold in practice as shown by Li et al. (2019), who propose methods based on a pairwise independence assumption instead. The literature so far has not thoroughly measured how popular inductive biases such as factorized priors behave when learning from correlated datasets, although several smaller experiments along these lines can be acknowledged. Chen et al. (2018) studied correlated 3DFaces (Paysan et al., 2009) by fixing all except three factors in which the authors conclude that the $\beta$ -TC-VAE regularizer can help to disentangle imposed correlations. Brekelmans et al. (2019) show that Echo noise results in superior disentanglement compared to standard betaVAE in a small experiment on a downsampled dSprites variant where randomly selected factor pairs are excluded. However, the latent structure was not studied in detail; our findings suggest that global disentanglement metrics are insufficient to diagnose issues when models learn from correlated data. Creager et al. (2019) based some of the evaluations of a proposed new autoencoder architecture in the fairness context on a biased dSprites variant and Yang et al. (2020) study a linear SCM in a VAE architecure on datasets with dependent variables. However, their studies focused on representation learners that require strong supervision via FoV labels at train time.
50
+
51
+ # 3 THE EFFECT OF CORRELATED DATA ON DISENTANGLEMENT LEARNERS
52
+
53
+ In this section, we want to present the key findings from our empirical study of unsupervised disentanglement learning on a particular variant of correlated data. We start by outlining the experimental design of our study in Section 3.1. Based on this, we analyze the latent spaces in Section 3.2 and find that factorization-based inductive biases are insufficient to learn disentangled representations from observational data. Persisting pairwise correlations in the latent space are not sufficiently revealed by standard disentanglement metrics that might be particularly relevant and problematic for fairness applications. Finally, in Section 3.3, we show extrapolation and generalization capabilities of the learned representations towards unseen factor combinations due to the induced correlations.
54
+
55
+ # 3.1 EXPERIMENTAL DESIGN
56
+
57
+ For our first experiments we introduce correlations between single pairs of factors of variation on the following three datasets: Shapes3D with object size and azimuth (denoted “A”), dSprites with orientation and X-position (“B”) and finally the real-world observations dataset MPI-3D with first and second degree of freedom $\left( \ \stackrel { 6 6 } { \ C } \right)$ . We focus on linear correlations with Gaussian noise between the two variables, which we denote by $c 1 , c 2$ . The ground truth factors for $c 1 , c 2$ take values $z _ { c 1 } \in \{ 0 , \dots , z _ { c 1 } ^ { \operatorname* { m a x } } \}$ and $z _ { c 2 } \in \{ 0 , \dots , z _ { c 2 } ^ { \operatorname* { m a x } } \}$ respectively. We then parameterize correlations by sampling the training dataset from the joint $P ( z _ { c 1 } , z _ { c 2 } ) \propto \mathcal { N } ( z _ { c 2 } - \alpha z _ { c 1 } , \sigma )$ where $\alpha = z _ { c 2 } ^ { m a x } / z _ { c 1 } ^ { m a \bar { x } }$ The strength of the correlations can be tuned by $\sigma$ , for which we choose 0.2, 0.4, 0.7 in normalized units with respect to the range of values in $z _ { c 1 , c 2 }$ . Lower $\sigma$ indicates stronger correlation. See Fig. 5 for an example of $P ( z _ { c 1 } , z _ { c 2 } )$ for correlating azimuth and object size in Shapes3D with $\sigma = 0 . 2$ . Additionally, we study the uncorrelated limit $\sigma = \infty$ ), which amounts to the case typically studied in the literature. We train the same six VAE methods as discussed in Locatello et al. (2019b), including $\beta$ -VAE, FactorVAE, AnnealedVAE, DIP-VAE-I, DIP-VAE-II and $\beta$ -TC-VAE, each with six hyperparameter settings. Each method has been trained using five different random seeds. All remaining factors of variation are sampled uniformly at random. This first study sums up to a total of 2160 trained models, or 180 models per dataset and correlation strength3. Appendix A describes additional implementation details.
58
+
59
+ ![](images/c8e59e5dfb217a4b7e563ded39aa232ed4236c8bcac9947b1dbceacc1ab965b7.jpg)
60
+ Figure 3: We show latent traversals (left) of the best DCI score model among all 180 trained models with strongest correlation $\sigma = 0 . 2$ ) on Shapes3D (A). The traversals in latent code dimensions 4 and 8 (highlighted in black), suggest that these dimensions encode a mixture of azimuth and object size, reflecting one major axis along the correlation line of the joint distribution and one smaller, locally orthogonal axis. This is supported by a heat map of the GBT feature importance matrix of this model (right) indicating an entanglement of azimuth and object size encoded into both latent codes.
61
+
62
+ # 3.2 CAN UNSUPERVISED METHODS ACHIEVE DISENTANGLEMENT OF CORRELATED DATA?
63
+
64
+ Shortcomings of existing metrics. Following recent studies, we evaluate the trained models with the help of a broad range of disentanglement metrics that aim at quantifying overall success by a single scalar measure. Perhaps surprisingly, Fig. 2 shows no clear trend among all implemented disentanglement scores w.r.t. correlation strength (see Fig. 9 in the Appendix for the full result across all datasets and metrics). The metrics have been evaluated by sampling from the correlated data distribution although they do not differ substantially when evaluated on the uncorrelated distribution. However, as we will demonstrate along the following analysis, the latent spaces in this setting show some characteristic differences when trained on a strongly correlated pair of FoVs. We thus argue that common disentanglement metrics are limited when correlations are introduced into the training data. To conduct a more careful analysis of the inductive data bias applied on the learned representations we will instead evaluate pairwise metrics. Note that regarding BetaVAE and FactorVAE this observed trend is to some degree expected as they would yield perfect disentanglement scores even if we would take the correlated ground truth factors or a linear transformation in the case of BetaVAE as the representation.
65
+
66
+ Latent structure and pairwise entanglement. We start by analysing latent traversals of some trained models on Shapes3D (A). For strong correlations $\sigma = 0 . 2$ and $\sigma = 0 . 4$ ), we typically observe trained models with two latent codes encoding the two correlated variables simultaneously. In these cases, one of the latent codes corresponds to data along the major axis of the correlation line whereas the other latent code dimension manifests in an orthogonal change of the two variables along the minor axis. Still, a full traversal of the code corresponding to the minor axis often seems to cover only observations within the correlation line. Fig. 3 (left) shows this effect for the latent space of a model trained on Shapes3D (A) with strongest correlation $\sigma = 0 . 2$ ).
67
+
68
+ ![](images/f824ae85040c71c66286db291a42526822f07e8f2335325a9be194b7b8a49246.jpg)
69
+
70
+ Figure 4: Left: Pairwise entanglement scores help to uncover still existent correlations in the latent representation. Left: Mean of the pairwise entanglement scores for the correlated pair (red) and the median of the uncorrelated pairs. We see that stronger correlation leads to statistically more entangled latents compared to the baseline score without correlation (blue). Right: The same behavior can be seen for the unfairness score between the correlated pair of factors.
71
+
72
+ <table><tr><td>Correlation strength</td><td></td><td>g=0.2</td><td>g=0.4</td><td>g=0.7</td><td>σ=∞ (uc)</td></tr><tr><td rowspan="2">Shapes3d (A)</td><td>object size - azimuth</td><td>0.38</td><td>0.26</td><td>0.13</td><td>0.08</td></tr><tr><td>median uncorrelated pairs</td><td>0.09</td><td>0.09</td><td>0.09</td><td>0.08</td></tr><tr><td rowspan="2">dSprites (B)</td><td>orientation - position X</td><td>0.17</td><td>0.16</td><td>0.14</td><td>0.11</td></tr><tr><td>median uncorrelated pairs</td><td>0.13</td><td>0.13</td><td>0.13</td><td>0.13</td></tr><tr><td rowspan="2">MPI3D (C)</td><td>First DOF - Second DOF</td><td>0.2</td><td>0.19</td><td>0.17</td><td>0.16</td></tr><tr><td>median uncorrelated pairs</td><td>0.16</td><td>0.16</td><td>0.15</td><td>0.15</td></tr></table>
73
+
74
+ To quantify this observation, we analyze the importance of individual latent codes in predicting the value of a given ground truth FoV. An importance weight for each pair of $\{ \mathrm { F o V } ,$ latent dimension} is computed by training a gradient boosting trees (GBT) classifier to predict the ground truth labels from the latents (10,000 samples). In the right panel of Fig. 3, we compute these importance weights for the model used to generate traversals in the left panel. The corresponding evaluation for a model trained on the same dataset with weak correlation does not reveal this feature visually (see Fig. 10 in the Appendix).
75
+
76
+ To support this claim for a larger set of models, we calculate a pairwise entanglement score that allows us to measure how difficult it is to separate two factors of variation from their latent codes. This computation involves grouping FoV into pairs based on an ordering of their pairwise mutual information or GBT feature importance between latents and FoV; we defer to Appendix A for a detailed description of this procedure. Figure 4 (left) shows that across all datasets the pair of correlated FoV has a higher score than the median of all other pairs, indicating that they are harder to disentangle. This threshold decreases with weaker correlation and the pair becomes easier to disentangle for weaker correlations $( \sigma \ge 0 . 7 )$ . These findings suggest that the models still manage to disentangle correlated factors if the correlation is not too strong.
77
+
78
+ Finally, correlations between variables are of crucial importance in fairness applications motivating an additional investigation on ramifications of these entangled latent spaces. In this setting we are interested in the unfairness of predicting the second correlated variable while the first correlated variable is considered being a protected or sensitive attribute. In the following, we use a variant of demographic parity (Dwork et al., 2012) that computes pairwise mutual information between latents and FoV (Locatello et al., 2019a). In Fig. 4 (right) we evaluate this score when correlations are present within the data in the case of Shapes3D (A). Unfairness tracks correlation strength in this scenario. These results suggest that we cannot expect disentangled representations learned unsupervisedly to help reduce unfairness beyond the benefits discussed in Locatello et al. (2019a). More comprehensive results, that support the finding that the correlated pair is statistically more entangled in the latent representations across all unsupervised experiments and datasets is provided in Appendix B.1.
79
+
80
+ Summary. We find that existing methods fail to learn disentangled representations of correlated factors of variation, and moreover that standard disentanglement metrics are insufficient to reveal these troublesome pairwise entanglements in the latent space.
81
+
82
+ # 3.3 GENERALIZATION PROPERTIES
83
+
84
+ In this Section, we aim to understand how the trained models perform on unseen training data far away from the correlation line; out-of-distribution (OOD) w.r.t. the train distribution. We analyse this capability for the model from Fig. 3. In this model, the remaining factors seem to be disentangled well enough to only focus on the two latent dimensions encoding the entangled variables.
85
+
86
+ As a first test, we sample observations from the FoV then set object size and azimuth to six distinct configurations of zero probability, see Fig. 5 (left). The trained model is capable of reconstructing these observations despite never having encountered these configurations or neighbors thereof during training. This suggests that the encoder maps representations to a meaningful point in the latent space from which the decoder is equally capable of generating expected observations. To test this hypothesis further, we analysed latent traversals originating from these OOD points and observe that changes in the remaining factors reliably yield the expected reconstructions. Traversals with respect to the two entangled latent codes continue to encode object size and azimuth.
87
+
88
+ ![](images/3a4907b6a6815be9ba92ce3f27dba690c6be01f16deae4a661172b14204a1d76.jpg)
89
+ Figure 5: Generalization to out-of-distribution (OOD) test data. Left: Reconstructions of observations the model has never seen during training. Right: Latent space distribution of the two entangled dimensions. Circles without edges indicates encoded data from the (correlated) training distribution, while circles with edges indicate encoded OOD data where the correlation pattern is broken.
90
+
91
+ To fully understand this models’ generalization properties we visualise the occupied latent space spanned by the two identified dimensions encoding both correlated factors in Fig. 5 (right). We are particularly interested in where these points are located with respect to the ground truth value of each correlated variable, depicted via color. The two sets of depicted points are (1) latent codes sampled from the correlated training data and (2) latent codes sampled with a (object size, azimuth) configuration that has zero probability under the correlated training distribution. We observe that contours of equal color (ground truth) are not aligned with the latent axes. This indicates that the two latent dimensions encode both FoV at the same time. Likewise, we can understand the generalization capabilities of this model far away from the trained data. Extreme configurations such as small azimuth and large object size are encoded to space regions corresponding to the intersections of the manifolds with constant value for each correlated variable. This shows that all out-of-distribution points are encoded in this representation space in a way that obeys the natural ordering of each respective factor. This behaviour remains even in cases where the trained latent space does not mirror the default value ordering as stored in our ground truth table. For this we additionally trained 360 models on two additional Shapes3D variants each, where we strongly correlated object color - object size (“D”) and object color - azimuth (“E”) respectively $\sigma = 0 . 2$ and $\sigma = 0 . 4$ ). As the color values do not allow for a unique natural ordering, the trained models do often encode a different color manifold ordering into the latent space. In Appendix B.1, we show some of their characteristic latent space visualizations with similar extrapolation and generalization capabilities. We conclude from these results that disentanglement methods can generalize towards unseen FoV configurations as long as each factor value is contained in the training data within a different configuration.
92
+
93
+ # 4 FINDING THE RIGHT FACTORIZATION
94
+
95
+ The results from Section 3 illustrate the limitations of state-of-the-art unsupervised methods on correlated data (and thus real-world observational data). We now investigate the usefulness of several approaches for mitigating pairwise correlations in the latent code. We begin with a post-hoc procedure in Section 4.1 that uses limited label information on the ground truth factors and show that it achieves a substantial correction of the pairwise latent correlation. We then consider a recently proposed approach leveraging recent advances in weakly supervised disentanglement learning that applies directly at train time. As will be seen in Section 4.2, this method results in substantially more disentangled representations, even when applied on correlated data from different sampling scenarios.
96
+
97
+ Figure 6: Fast adaption with few labels: Pairwise entanglement scores for correlated FoV pair in Shapes3D (A). The correlated pair is highlighted (red). Zero labels reflects the unsupervised baseline without any fast adaptation. Growing number of labels show that fast adaption using linear regression reduces these correlations with as little as 100 labels (blue). Reported pairwise scores are averaged over 180 models per correlation strength.
98
+
99
+ <table><tr><td>#Labels</td><td></td><td>0</td><td>100</td><td>1000</td><td>10000</td></tr><tr><td>Shapes3D (A) σ = 0.2</td><td>object size - azimuth</td><td>0.38</td><td>0.17</td><td>0.15</td><td>0.15</td></tr><tr><td>Shapes3D (A) σ= 0.2</td><td>median uncorrelated pairs</td><td>0.09</td><td>0.08</td><td>0.07</td><td>0.07</td></tr><tr><td>Shapes3D (A) σ = 0.4</td><td> object size - azimuth</td><td>0.26</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>Shapes3D (A) σ = 0.4</td><td>median uncorrelated pairs</td><td>0.09</td><td>0.08</td><td>0.08</td><td>0.08</td></tr></table>
100
+
101
+ # 4.1 POST-HOC ALIGNMENT CORRECTION WITH FEW LABELS
102
+
103
+ When a limited number of FoV labels $\left\{ \mathbf { y } _ { i } \right\}$ can be accessed, a reasonable option for resolving entangled dimensions of the latent code is by fast adaptation. To identify the two entangled dimensions $( z _ { i } , z _ { j } )$ we look at the maximum feature importance for a given FoV from a GBT trained using these labels only. We then train a substitution function using supervised learning to replace these two dimensions with the predicted ground truth label. Crucially, both steps of this procedure rely on the same FoV labels, which should be as few as possible. In Fig. 6 we show the pairwise entanglement score of the correlated FoVs under this fast adaptation with a linear regression as the substitution function, which succeeds with as few as 100 labels, corresponding to less than $0 . 0 2 \%$ of all data points in Shapes3D. However, fast adaptation with linear regression substitution fails in some settings: when no two latent dimensions encode the applied correlation isolated from the other latent codes, or when the correlated variables do not have a unique natural ordering (e.g. color or categorical variables). To address this, a nonlinear substitution function such as a MLP can reduce this pairwise entanglement to a certain degree (see additional results in Appendix B.2).
104
+
105
+ We find that the efficacy of fast adaptation depends on the level of disentanglement of the representations with respect to all the other factors. This implies that if the representation is well disentangled at the start of the fast adaption procedure, it is possible to achieve a perfectly disentangled model (according to our previous visual and quantitative evaluations). However, if all FoV are entangled at the beginning, the fast adaption method will have little effect. Finally, we note that model selection is impossible in a purely unsupervised manner based on any of the used disentanglement metrics, as they all require labeled ground truth data. These shortcomings shall be resolved by the following method capable of disentangling the correlated factors of variation much more reliably.
106
+
107
+ # 4.2 ALIGNMENT DURING TRAINING USING WEAK SUPERVISION
108
+
109
+ Since the unsupervised disentangling by optimising marginal likelihood in a generative model is impossible (Locatello et al., 2019b, Theorem 1), inductive biases like grouping information (Bouchacourt et al., 2018) or access to labels (Locatello et al., 2019c) is required. Changes in natural environments, which typically correspond to changes of only a few underlying factors of variation, provide a weak supervision signal for representation learning algorithms (Goyal et al., 2019; Földiák, 1991; Schmidt et al., 2007; Bengio et al., 2019). Without correlations it has been shown that this weak supervision helps in learning much more disentangled representations (Locatello et al., 2020; Shu et al., 2019). Locatello et al. (2020) showed access to observations which display differences in a known number of factors of variation (without knowing which ones specifically) is sufficient to learn disentangled representation. These additional weak assumptions render the generative model identifiable in contrast to unsupervised disentanglement. This kind of extra knowledge might be available in certain settings 4, e.g., in temporarily close frames from a video of a moving robot arm where some factors remain unchanged. Hence, we want to investigate the usefulness of such a weakly-supervised method applied in various scenarios when training data is correlated. Specifically we implement the Ada-GVAE variant of Locatello et al. (2020) that was shown to allow for model selection via the (unsupervised) reconstruction loss. The method requires a pair of observations that differs in a known number of factors, without knowing which in particular.
110
+
111
+ ![](images/143ef6a989097e83190d62e51d5d5cd9acff40e9f5e8469f5605bbda6b516512.jpg)
112
+ Figure 7: Weak supervision: Left: With weak supervision trained models on Shapes3D correlation object size and azimuth learn consistently improved, often perfect, disentangled representations across all correlation strengths. Middle: Unfairness scores between correlated FoVs are much smaller (see scale). Right: Latent dimensions of a best DCI model with strong correlation $\mathit { \check { \sigma } } = 0 . 2 $ ). Representations are axis-aligned with respect to both of the correlated variables ground truth values (right). Below: Traversals of a model trained with strong correlation $( \sigma = 0 . 2$ )
113
+
114
+ Weak supervision mitigates pairwise latent entanglement. We trained the three correlated Shapes3D variants (A, D, E) with pairwise correlations between object color, object size and azimuth with the same correlation strength settings. Due to the definition of the regularizer we limit this study to the $\beta$ -VAE models with the same 6 hyperparameters and use 5 random seeds, yielding 360 additional models. For the generation of pairs we study the case where the difference in the observation pairs is present in one random FoV. Whenever we sample the difference to be in one of the correlated FoV, its respective value in each pair is drawn from the probability distribution conditioned on the other correlated FoV. This means the difference in this factor is typically very small and depends on the correlation strength. Note that this procedure assures that constructed pairs are consistent with the observational data such that the correlation is never broken. Fig. 7 summarizes the weak supervision results when imposing correlations in object size and azimuth. We consistently observe much better disentangled models, often achieving perfect DCI score irrespective of correlations in the dataset. The latent spaces tend to strongly align their coordinates with the ground truth label axis. Finally, weak-supervision reduces unfairness relative to the unsupervised baseline, and occasionally achieves zero unfairness score.
115
+
116
+ These results suggest that weak supervision can provide a strong inductive bias capable of finding the right factorization and resolving spurious correlations for datasets of unknown degree of correlation. As a prominent example, this is an issue in the fairness context where real-world datasets often display unknown discriminatory correlations. Additional results on the other datasets can be found in Appendix B.2 including two additional scenarios where one has intervening capabilities to generate the pair. We consistently observe the same strong trends regarding disentangled correlations in all of the above studies using weak supervision.
117
+
118
+ # 5 CONCLUSION
119
+
120
+ We have presented the first large-scale empirical study examining how modern disentanglement learners cope with correlated observational data. We find that existing methods fail to learn disentangled representations of correlated factors of variation, and moreover that standard disentanglement metrics are insufficient to reveal these pairwise entanglements. We discussed practical implications for downstream tasks like fair decision making. Finally, we demonstrate how to correct for these latent correlations via various weakly supervised training scenarios. Our results thus support the importance and usefulness of learning independent mechanisms rather than independent factors of variations (Schölkopf, 2019; Parascandolo et al., 2018; Suter et al., 2019; Goyal et al., 2019). Besides the simple correlations studied in this work, future work is needed to address the open question whether these results extend to more complex nonlinear correlations and settings where many more variables are correlated simultaneously.
121
+
122
+ # REFERENCES
123
+
124
+ Tameem Adel, Zoubin Ghahramani, and Adrian Weller. Discovering interpretable representations for both deep generative and discriminative models. In International Conference on Machine Learning, pp. 50–59, 2018.
125
+
126
+ Francis Bach and Michael Jordan. Kernel independent component analysis. Journal of Machine Learning Research, 3(7):1–48, 2002.
127
+
128
+ 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.
129
+
130
+ Yoshua Bengio, Tristan Deleu, Nasim Rahaman, Rosemary Ke, Sébastien Lachapelle, Olexa Bilaniuk, Anirudh Goyal, and Christopher Pal. A meta-transfer objective for learning to disentangle causal mechanisms. arXiv preprint arXiv:1901.10912, 2019.
131
+
132
+ Diane Bouchacourt, Ryota Tomioka, and Sebastian Nowozin. Multi-level variational autoencoder: Learning disentangled representations from grouped observations. In AAAI Conference on Artificial Intelligence, 2018.
133
+
134
+ Rob Brekelmans, Daniel Moyer, Aram Galstyan, and Greg Ver Steeg. Exact rate-distortion in autoencoders via echo noise. In Advances in Neural Information Processing Systems, pp. 3889– 3900, 2019.
135
+
136
+ Christopher P Burgess, Irina Higgins, Arka Pal, Loic Matthey, Nick Watters, Guillaume Desjardins, and Alexander Lerchner. Understanding disentangling in beta-VAE. arXiv preprint arXiv:1804.03599, 2018.
137
+
138
+ Agisilaos Chartsias, Thomas Joyce, Giorgos Papanastasiou, Scott Semple, Michelle Williams, David Newby, Rohan Dharmakumar, and Sotirios A Tsaftaris. Factorised spatial representation learning: Application in semi-supervised myocardial segmentation. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pp. 490–498. Springer, 2018.
139
+
140
+ Tian Qi Chen, Xuechen Li, Roger Grosse, and David Duvenaud. Isolating sources of disentanglement in variational autoencoders. In Advances in Neural Information Processing Systems, 2018.
141
+
142
+ Pierre Comon. Independent component analysis, a new concept? Signal Processing, 36(3):287–314, 1994.
143
+
144
+ Elliot Creager, David Madras, Jörn-Henrik Jacobsen, Marissa A Weis, Kevin Swersky, Toniann Pitassi, and Richard Zemel. Flexibly fair representation learning by disentanglement. arXiv preprint arXiv:1906.02589, 2019.
145
+
146
+ Cynthia Dwork, Moritz Hardt, Toniann Pitassi, Omer Reingold, and Richard Zemel. Fairness through awareness. In Proceedings of the 3rd innovations in theoretical computer science conference, pp. 214–226. ACM, 2012.
147
+
148
+ Cian Eastwood and Christopher KI Williams. A framework for the quantitative evaluation of disentangled representations. In International Conference on Learning Representations, 2018.
149
+
150
+ Peter Földiák. Learning invariance from transformation sequences. Neural Computation, 3(2): 194–200, 1991.
151
+
152
+ Robert Geirhos, Jörn-Henrik Jacobsen, Claudio Michaelis, Richard Zemel, Wieland Brendel, Matthias Bethge, and Felix A Wichmann. Shortcut learning in deep neural networks. arXiv preprint arXiv:2004.07780, 2020.
153
+
154
+ Anirudh Goyal, Alex Lamb, Jordan Hoffmann, Shagun Sodhani, Sergey Levine, Yoshua Bengio, and Bernhard Schölkopf. Recurrent independent mechanisms. arXiv preprint arXiv:1909.10893, 2019.
155
+
156
+ Luigi Gresele, Paul K. Rubenstein, Arash Mehrjou, Francesco Locatello, and Bernhard Schölkopf. The incomplete rosetta stone problem: Identifiability results for multi-view nonlinear ica. In Conference on Uncertainty in Artificial Intelligence (UAI), 2019.
157
+
158
+ Irina Higgins, Loic Matthey, Arka Pal, Christopher Burgess, Xavier Glorot, Matthew Botvinick, Shakir Mohamed, and Alexander Lerchner. beta-VAE: Learning basic visual concepts with a constrained variational framework. In International Conference on Learning Representations, 2017a.
159
+
160
+ Irina Higgins, Arka Pal, Andrei Rusu, Loic Matthey, Christopher Burgess, Alexander Pritzel, Matthew Botvinick, Charles Blundell, and Alexander Lerchner. Darla: Improving zero-shot transfer in reinforcement learning. In International Conference on Machine Learning, 2017b.
161
+
162
+ Irina Higgins, Nicolas Sonnerat, Loic Matthey, Arka Pal, Christopher P Burgess, Matko Bošnjak, Murray Shanahan, Matthew Botvinick, Demis Hassabis, and Alexander Lerchner. Scan: Learning hierarchical compositional visual concepts. In International Conference on Learning Representations, 2018.
163
+
164
+ Aapo Hyvarinen and Hiroshi Morioka. Unsupervised feature extraction by time-contrastive learning and nonlinear ica. In Advances in Neural Information Processing Systems, 2016.
165
+
166
+ Aapo Hyvärinen and Petteri Pajunen. Nonlinear independent component analysis: Existence and uniqueness results. Neural Networks, 1999.
167
+
168
+ Aapo Hyvarinen, Hiroaki Sasaki, and Richard E Turner. Nonlinear ica using auxiliary variables and generalized contrastive learning. In International Conference on Artificial Intelligence and Statistics, 2019.
169
+
170
+ Christian Jutten and Juha Karhunen. Advances in nonlinear blind source separation. In International Symposium on Independent Component Analysis and Blind Signal Separation, pp. 245–256, 2003.
171
+
172
+ Ilyes Khemakhem, Diederik Kingma, Ricardo Monti, and Aapo Hyvarinen. Variational autoencoders and nonlinear ica: A unifying framework. In International Conference on Artificial Intelligence and Statistics, pp. 2207–2217, 2020.
173
+
174
+ Hyunjik Kim and Andriy Mnih. Disentangling by factorising. In International Conference on Machine Learning, 2018.
175
+
176
+ Diederik P Kingma and Max Welling. Auto-encoding variational Bayes. In International Conference on Learning Representations, 2014.
177
+
178
+ David Klindt, Lukas Schott, Yash Sharma, Ivan Ustyuzhaninov, Wieland Brendel, Matthias Bethge, and Dylan Paiton. Towards nonlinear disentanglement in natural data with temporal sparse coding. arXiv preprint arXiv:2007.10930, 2020.
179
+
180
+ Abhishek Kumar, Prasanna Sattigeri, and Avinash Balakrishnan. Variational inference of disentangled latent concepts from unlabeled observations. In International Conference on Learning Representations, 2018.
181
+
182
+ Zejian Li, Yongchuan Tang, Wei Li, and Yongxing He. Learning disentangled representation with pairwise independence. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 4245–4252, 2019.
183
+
184
+ Francesco Locatello, Gabriele Abbati, Thomas Rainforth, Stefan Bauer, Bernhard Schölkopf, and Olivier Bachem. On the fairness of disentangled representations. In Advances in Neural Information Processing Systems, pp. 14584–14597, 2019a.
185
+
186
+ Francesco Locatello, Stefan Bauer, Mario Lucic, Sylvain Gelly, Bernhard Schölkopf, and Olivier Bachem. Challenging common assumptions in the unsupervised learning of disentangled representations. In International Conference on Machine Learning, 2019b.
187
+
188
+ Francesco Locatello, Michael Tschannen, Stefan Bauer, Gunnar Rätsch, Bernhard Schölkopf, and Olivier Bachem. Disentangling factors of variation using few labels. The 2nd Learning from Limited Labeled Data (LLD) Workshop at the International Conference on Learning Representations, 2019c.
189
+
190
+ Francesco Locatello, Ben Poole, Gunnar Rätsch, Bernhard Schölkopf, Olivier Bachem, and Michael Tschannen. Weakly-supervised disentanglement without compromises. arXiv preprint arXiv:2002.02886, 2020.
191
+
192
+ David Madras, Elliot Creager, Toniann Pitassi, and Richard Zemel. Learning adversarially fair and transferable representations. arXiv preprint arXiv:1802.06309, 2018.
193
+
194
+ David Madras, Elliot Creager, Toniann Pitassi, and Richard Zemel. Fairness through causal awareness: Learning causal latent-variable models for biased data. In Proceedings of the Conference on Fairness, Accountability, and Transparency, pp. 349–358, 2019.
195
+
196
+ Emile Mathieu, Tom Rainforth, N. Siddharth, and Yee Whye Teh. Disentangling disentanglement in variational auto-encoders. arXiv preprint arXiv:1812.02833, 2018.
197
+
198
+ G. Parascandolo, N. Kilbertus, M. Rojas-Carulla, and B. Schölkopf. Learning independent causal mechanisms. In Proceedings of the 35th International Conference on Machine Learning (ICML), pp. 4033–4041, 2018.
199
+
200
+ Pascal Paysan, Reinhard Knothe, Brian Amberg, Sami Romdhani, and Thomas Vetter. A 3d face model for pose and illumination invariant face recognition. In 2009 Sixth IEEE International Conference on Advanced Video and Signal Based Surveillance, pp. 296–301. Ieee, 2009.
201
+
202
+ J. Peters, D. Janzing, and B. Schölkopf. Elements of Causal Inference - Foundations and Learning Algorithms. MIT Press, Cambridge, MA, USA, 2017.
203
+
204
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014.
205
+
206
+ Mark Schmidt, Alexandru Niculescu-Mizil, Kevin Murphy, et al. Learning graphical model structure using l1-regularization paths. In AAAI, volume 7, pp. 1278–1283, 2007.
207
+
208
+ Bernhard Schölkopf. Causality for machine learning. arXiv preprint arXiv:1911.10500, 2019.
209
+
210
+ Rui Shu, Yining Chen, Abhishek Kumar, Stefano Ermon, and Ben Poole. Weakly supervised disentanglement with guarantees. arXiv preprint arXiv:1910.09772, 2019.
211
+
212
+ Peter Sorrenson, Carsten Rother, and Ullrich Köthe. Disentanglement by nonlinear ica with general incompressible-flow networks (gin). arXiv preprint arXiv:2001.04872, 2020.
213
+
214
+ Raphael Suter, Djordje Miladinovic, Stefan Bauer, and Bernhard Schölkopf. Interventional robustness ´ of deep latent variable models. In International Conference on Machine Learning, 2019.
215
+
216
+ Sjoerd van Steenkiste, Francesco Locatello, Jürgen Schmidhuber, and Olivier Bachem. Are disentangled representations helpful for abstract visual reasoning? arXiv preprint arXiv:1905.12506, 2019.
217
+
218
+ Mengyue Yang, Furui Liu, Zhitang Chen, Xinwei Shen, Jianye Hao, and Jun Wang. Causalvae: Structured causal disentanglement in variational autoencoder. arXiv preprint arXiv:2004.08697, 2020.
219
+
220
+ # A IMPLEMENTATION DETAILS
221
+
222
+ Unsupervised Disentanglement methods. For reasons of comparison, the considered disentanglement methods in this work cover the full collection of state-of-the-art approaches in disentanglement_lib from Locatello et al. (2019b) based on representations learned by VAEs. The set contains six different methods that enforce disentanglement of the representation by equipping the loss with different regularizers that aim at enforcing the special structure of the posterior aggregate encoder distribution. A detailed description of the regularizer forms used in this work, specifically $\beta$ -VAE (Higgins et al., 2017a), FactorVAE (Kim & Mnih, 2018), AnnealedVAE (Burgess et al., 2018), DIP-VAE-I, DIP-VAE-II (Kumar et al., 2018) and $\beta$ -TC-VAE (Chen et al., 2018) is provided in (Locatello et al., 2019b). We use the same encoder architecture with 10 latent dimensions for every model.
223
+
224
+ Evaluation metrics. To measure disentanglement of a learned representation, various metrics have been proposed, each requiring access to the ground truth labels. The BetaVAE score is based upon the prediction of a fixed factor from the disentangled representation using a linear classifier (Higgins et al., 2017a). The FactorVAE score is intended to correct for some failures of the former by utilizing majority vote classifiers based on a normalized variance of each latent dimension (Kim & Mnih, 2018). The SAP score represents the mean distance between the classification errors of the two latent dimensions that are most predictable (Kumar et al., 2018). For the MIG score, one computes the mutual information between the latent representation and the ground truth factors and calculates the final score using a normalized gap between the two highest MI entries for each factor. Finally, a disentanglement score proposed by Eastwood & Williams (2018), often referred to as DCI score, is calculated from a dimension-wise entropy reflecting the usefulness of the dimension to predict a single factor of variation.
225
+
226
+ Unfairness between a pair of FoV: The scores reported are based on a notion of demographic parity for predicting a target variable $y$ given a protected and sensitive variable $s$ . Both $y$ and $s$ can be associated with a factor of variation here. Rather than using the global total variation average as defined in Locatello et al. (2019a), we report the individual demographic parities for the correlated factors specifically.
227
+
228
+ Pairwise entanglement metric: In order to further analyze the differences between the GBT feature importance matrices between latent code and encoded factor of variation, we view them as weights on the edges of a bipartite graph encoding the statistical relation between each factor of variation and code. We can now delete all edges with weight smaller than some threshold and count (i) how many factors of variation are connected with at least a latent code and (ii) the number of connected components with size larger than one. We can then compute which factors are merged at which threshold. Factors that are merged at lower threshold are more entangled in the sense that are more statistically related to a shared latent dimension. This computation can be not only based on the GBT feature importances but likewise on weight matrices inferred from the Mutual Information.
229
+
230
+ Joint distributions of correlated factors in datasets: In Fig. 8 we show the joint probability distributions of the correlated pair of FoV for all datasets and correlation strengths considered in this study. Dataset A, B and C were designed with correlated factors of variation that are ordinal for a natural visual interpretation of the traversals. In contrast, datasets D and E contain a correlated factor of variation that has no such natural ordering.
231
+
232
+ # B ADDITIONAL RESULTS
233
+
234
+ # B.1 SECTION 3
235
+
236
+ Shortcomings of existing metrics. Following recent studies, we evaluate the trained models with the help of a broad range of disentanglement metrics that aim at quantifying overall success by the help of a single scalar measure. Perhaps surprisingly, as can be seen in Fig. 9, there is no clear trend among all implemented disentanglement scores w.r.t. correlation strength. The metrics have been evaluated by sampling from the correlated data distribution although they do not differ substantially when evaluated on the uncorrelated distribution. We thus argue that commonly used methods are insufficient to provide insight into the latent space learned.
237
+
238
+ ![](images/f94feea5848132b951f473cf53dfa9d1dc6ef33b49735fc543b46e24ae0ecf97.jpg)
239
+ Figure 8: Probability distributions for sampling training data in the correlated pair of FoVs in the respective datasets (A, B, C, D, E) considering correlation strengths of $\sigma = 0 . 2$ , $\sigma = 0 . 4$ , $\sigma = 0 . 7$ and $\sigma = \infty$ , the uncorrelated limit (from left to right).
240
+
241
+ ![](images/befc523d57a6f4ddbe357b7dbbffc7e45da3efd7984297017b532022ddc94e3f.jpg)
242
+ Figure 9: Standard disentanglement metrics evaluated on the correlated and uncorrelated (uc) training set showing no clear trend for different correlation strengths.
243
+
244
+ ![](images/60b117850a53daf06a30455a78996762a9ba12708937fe8953bef3fc11a32782.jpg)
245
+ Figure 10: We show latent traversals (left) of the best DCI score model among all 180 trained models with weak correlation $\sigma = 0 . 7$ ) in object size and azimuth. The traversals in latent code no 3 and 7/8 (highlighted in black), suggest that these dimensions encode no mixture of azimuth and object size compared to the models with stronger correlation. This is supported by the GBT feature importance matrix of this model (right).
246
+
247
+ <table><tr><td>correlation strength o</td><td></td><td>0.2 0.4</td><td>0.7</td><td>8 (uc)</td></tr><tr><td>Shapes3D (A)</td><td>object size - azimuth median other pairs</td><td>0.38 0.26 0.09 0.09</td><td>0.13 0.09</td><td>0.08 0.08</td></tr><tr><td>dSprites (B)</td><td>orientation - position X median other pairs</td><td>0.17 0.16 0.13 0.13</td><td>0.14 0.13</td><td>0.11 0.13</td></tr><tr><td>MPI3D (C)</td><td>First DOF - Second DOF median other pairs</td><td>0.2 0.19 0.16 0.16</td><td>0.17 0.15</td><td>0.16 0.15</td></tr></table>
248
+
249
+ <table><tr><td>0.2</td><td>0.4</td><td>0.7</td><td>8(uc)</td></tr><tr><td>0.28</td><td>0.25</td><td>0.2</td><td>0.17 0.18</td></tr><tr><td>0.2 0.34</td><td>0.2 0.31</td><td>0.19 0.24</td><td>0.14</td></tr><tr><td>0.16</td><td>0.18</td><td>0.19</td><td>0.15</td></tr><tr><td>0.54</td><td>0.52</td><td>0.5</td><td>0.49</td></tr><tr><td>0.25</td><td>0.25</td><td>0.26</td><td>0.25</td></tr></table>
250
+
251
+ <table><tr><td>0.2</td><td>0.4</td></tr><tr><td>0.38 0.11</td><td>0.31 0.11</td></tr><tr><td>0.43</td><td>0.3</td></tr><tr><td>0.15</td><td>0.15</td></tr></table>
252
+
253
+ Figure 11: Pairwise entanglement scores help to uncover still existent correlations in the latent representation. Left: Mean of the pairwise entanglement scores for the correlated pair (red) and the median of the uncorrelated pairs. We see that stronger correlation leads to statistically more entanglement latents across all datasets studied compared to their baseline pairwise entanglement where the data exhibits no correlations (blue). Each pairwise score is the mean across 180 models for each dataset and correlation strength. Scores in the left table are based on GBT feature importance and scores presented in the right table are based on Mutual Information.
254
+
255
+ <table><tr><td>correlation strength o</td><td></td><td>0.2</td><td>0.4</td></tr><tr><td>Shapes3D (D)</td><td>object color - object size</td><td>0.29</td><td>0.28</td></tr><tr><td></td><td>median uncorrelated pairs</td><td>0.07</td><td>0.07</td></tr><tr><td>Shapes3D (E)</td><td>object color - azimuth</td><td>0.25</td><td>0.23</td></tr><tr><td></td><td>median uncorrelated pairs</td><td>0.1</td><td>0.09</td></tr></table>
256
+
257
+ Latent structure and pairwise entanglement. Our hypothesis that the latent representations are less correlated if the correlation strength is weaker is shown for a model on Shapes3D (A) with weak correlation in Fig. 10. Here the latent traversals do not mirror the major and minor axis of the correlated joint distribution. This conclusion is being backed by the thresholds of the pairwise entanglement metrics for the correlated pair vs. the median of all other pairs across all datasets, either when computing them using the GBT feature importances or the mutual information. See Fig. 11 for these respective results. Another pairwise metric that tracks the correlation strength in our scenario is the unfairness score between the correlated pair of factors that is being shown for datasets A, B and C in Fig. 12.
258
+
259
+ Generalization Properties In order to support our conclusion from these results that disentanglement methods can generalize towards unseen FoV configurations we show in Fig. 13 latent traversals originating from these OOD point with smallest object size and largest azimuth. We observe that changes in the remaining factors reliably yield the expected reconstructions. Additionally, we are interested in where samples from correlated models are located with respect to the ground truth value of each correlated variable. For this, we are visualizing the latent spaces with similar extrapolation and generalization capabilities of four models from the two strongest correlation dataset variants of Shapes3d (D) and Shapes3d (E) in Fig. 14.
260
+
261
+ ![](images/34e189fd63cfbbe62d7bfd7f7f4115352a98f83edeef49f6dc31182e3a752e6d.jpg)
262
+ Figure 12: Disentangled representations trained on correlated data are anti-correlated with higher fairness properties. The plots show the mean unfairness scores between the correlated factors with decreasing correlation strength for Shapes3D (A), dSprites (B) and MPI3D-real (C).
263
+
264
+ ![](images/317b7f65006673a60895c3b03dc88a1dd36f82a0fe70127354c7c41ae1ed7185.jpg)
265
+ Figure 13: Generalization capabilities towards out-of-distribution test data. Latent traversals from an observations the model has never seen during training. The starting point corresponds to a factor configuration in point 1 from Fig. 5. Shown are the results of the model with highest DCI score among all 180 trained models on Shapes3d (A) with a very restricted correlation strength $\sigma = 0 . 2$ in object size and azimuth
266
+
267
+ # B.2 SECTION 4
268
+
269
+ Post-hoc alignment correction with few labels In Fig. 15, we see the axis alignment of the correlated latent space after fast adaptation using linear regression on a model trained on Shapes3D (A). Fast adaptation with linear regression substitution fails in some settings: when no two latent dimensions encode the applied correlation isolated from the other latent codes, or when the correlated variables do not have a unique natural ordering (e.g. color or categorical variables). Additionally, the functional form of the latent manifolds beyond the training distribution is unknown and in general expected to be nonlinear. We test the possibility of fast adaptation in this case using as substitution function a one-hidden layer MLP classifier of size 100 on the correlated Shapes3D variants. Under this method, we sample the FoV from a uniform independent distribution. A small number of such samples could practically be labeled manually. Using only 1000 labeled data points for our fast adaptation method shows a significant reduction in disentanglement-thresholds for the correlated pair (Fig. 16).
270
+
271
+ Alignment during training using weak supervision Using the studied weakly supervision AdaGVAE method with $k = 1$ from Locatello et al. (2020), we showed that weak supervision can provide a strong inductive bias capable of finding the right factorization and resolving spurious correlations for datasets of unknown degree of correlation. Despite the results shown on Shapes3D (A) in the main paper, results across all three correlation variants in Shapes3D (A, D, E) are shown in Fig. 17 as well as some representative latent space visualizations that show strong axis alignment in Fig. 18. This study contains a total of 360 trained models.
272
+
273
+ In addition to the experiment from the main paper where pairs are constructed solely from the correlated observational data, we want to study two scenarios where we have limited intervention capabilities on the FoV to generate training pairs. The resulting distribution of FoVs (still exhibiting correlations) in these pairs depends on whether the correlation between two pairs is due to a causal link or due to a common confounder.
274
+
275
+ Scenario I-1: We assume there is a confounder causing a spurious correlation between the factors, such that correlation is broken whenever we constraint the change to be in one of the correlations.
276
+
277
+ ![](images/518e9b8bb27e4c53eed05f016e18beadb6eebf81873ce47e059542589bc0fa47.jpg)
278
+ Figure 14: Latent space distribution of the two entangled dimensions of the best DCI model in Shapes3d (E) with $\sigma = 0 . 2$ (first column), in Shapes3d (E) with $\sigma = 0 . 4$ (second column), in Shapes3d (D) with $\sigma = 0 . 2$ (third column) and in Shapes3d (D) with $\sigma = 0 . 4$ (fourth column). Latent codes sampled from correlated observations (circle without edge) and (2) latent codes sampled with an object size-azimuth configuration not encountered during training(squares with black edge). Each column shows the ground truth values of the two correlated factors by color.
279
+
280
+ ![](images/e64e0ebba8a1d2a267f6bda535faa83e124944fb4f84fe0350c180fc7cefabb0.jpg)
281
+ Figure 15: Latent space distribution of the two entangled dimensions of the best DCI model in Shapes3D (A). Latent codes sampled from correlated observations (circle without edge) and (2) latent codes sampled with an object size-azimuth configuration not encountered during training (squares with black edge). Left column shows the ground truth values of the two correlated factors by color. Middle and right column show the fast adapted space using linear regression and 100 or 1000 labels respectively.
282
+
283
+ Figure 16: Mean of the pairwise entanglement scores for the correlated pair (red) and the median of the uncorrelated pairs (based on GBT feature importance) for all pairs of variables in Shapes3D (D) (top), Shapes3D (E) (middle) and Shapes3D (A) (bottom) all with correlation strength $\sigma = 0 . 2$ Each pairwise score is the mean across 180 models for each dataset and correlation strength. First column is the unsupervised baseline without any fast adaptation and the second column shows that fast adaption using a one-hidden layer MLP reduces these correlations with as little as 1000 labels when sampled from the uncorrelated dataset.
284
+
285
+ <table><tr><td>dataset</td><td>labels</td><td>0</td><td>1000</td></tr><tr><td>Shapes3D (D) σ = 0.2</td><td>object color - object size</td><td>0.3</td><td>0.16</td></tr><tr><td>Shapes3D (D) σ = 0.2</td><td>median uncorrelated pairs</td><td>0.07</td><td>0.07</td></tr><tr><td>Shapes3D (E)σ = 0.2</td><td>object color - azimuth</td><td>0.25</td><td>0.2</td></tr><tr><td>Shapes3D (E) σ = 0.2</td><td>median uncorrelated pairs</td><td>0.1</td><td>0.11</td></tr><tr><td>Shapes3D (A) σ = 0.2</td><td> object size - azimuth</td><td>0.37</td><td>0.26</td></tr><tr><td>Shapes3D (A) σ = 0.2</td><td>median uncorrelated pairs</td><td>0.09</td><td>0.1</td></tr></table>
286
+
287
+ The value of the changing variable is then sampled uniformly in the second observation. Note that this still means that the vast majority of sampled pairs exhibit correlated FoV. This is depicted in the substantially lifted disentanglement scores shown in Fig. 19 as well as some selected latent space visualizations that show strong axis alignment in Fig. 20. We consistently observe much better disentangled models, often achieving perfect DCI score irrespective of correlations in the data set. The latent spaces tend to strongly align their coordinates with the ground truth label axis. We chose 10 random seeds per configuration in this study, yielding 720 models in total.
288
+
289
+ Scenario I-2: Let us assume $C _ { 1 }$ causes $C _ { 2 }$ in our examples, which manifests as the studied linear correlations. Within this setting we cannot sample uniformly in $C _ { 2 }$ if we intervene (or “fix”) all factors except for this causal factor. Intervening on all factors but $C _ { 1 }$ , however, allows us to sample any value in $C _ { 1 }$ as it is not causally affected by $C _ { 2 }$ . To test the hypothesis that this constraint still allows for disentangling the correlation, we trained on Shapes3D (A) and sample pairs consistent with this causal model. Besides observing visually disentangled factors in the latent traversals, we show a summary of our results in Fig. 21 with the same significant improvements regarding disentangling the correlated FoVs. Besides the above correlation strengths, we additionally trained the same models using a very strong correlation of $\sigma = 0 . 1$ , yielding 300 models trained in this study.
290
+
291
+ ![](images/55a02791c8d0b50de5188e3389cffb5031ed780b7e45e63f8426086856db4b98.jpg)
292
+ Figure 17: Standard disentanglement metrics evaluated for the weakly supervised scenario using correlated observational data.
293
+
294
+ ![](images/f997e0d82272cc859cc5242bc563cb88283e962db14a373f621b6f0f37e42519.jpg)
295
+ Figure 18: Left: For the weakly supervised scenario using correlated observational data trained models on Shapes3D (A), (D) and (E) correlating object color and azimuth learn consistently improved, often perfect, disentangled representation across all correlation strengths. Right: Latent dimensions of a best DCI model trained on strongly correlated observational data. Representations are perfectly axis-aligned with respect to both of the correlated variables ground truth values (right).
296
+
297
+ ![](images/a25e94ba9291585646c3768650c399555dbe873fdf0046bcbe0de8f4bd961538.jpg)
298
+ Figure 19: Standard disentanglement metrics evaluated on the correlated training sets for the weakly supervised scenario with intervening capabilities (I-1).
299
+
300
+ ![](images/0a38d07ea4f3e624025b25e402e0f7d956eb38708636435fdc8e5dcdc86b34fd.jpg)
301
+ Figure 20: Left: For the weakly supervised scenario with intervening capabilities (I-1) trained models on Shapes3D (A), (D) and (E) correlating object color and azimuth learn consistently improved, often perfect, disentangled representation across all correlation strengths. Right: Latent dimensions of a best DCI model with strong correlation (0.2). Representations are perfectly axis-aligned with respect to both of the correlated variables ground truth values (right).
302
+
303
+ ![](images/c22f1e0add00466036990823304d24372b6bfc1093ac60cd57568df61d0bf979.jpg)
304
+ Figure 21: Disentanglement metrics (top), unfairness scores (middle) and latent spaces (bottom) show strong disentanglement using weak supervision with intervening capabilities (I-2) - even under the stronger assumption that sampling of observation pairs follow its causal generative model. We show the learnt latent space encoding of the two correlated factors of variation for a model with $\sigma = 0 . 1$ and low reconstruction loss.
md/train/3hGNqpI4WS/3hGNqpI4WS.md ADDED
@@ -0,0 +1,562 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DEPLOYMENT-EFFICIENT REINFORCEMENT LEARNING VIA MODEL-BASED OFFLINE OPTIMIZATION
2
+
3
+ Tatsuya Matsushima∗ Hiroki Furuta∗ Yutaka Matsuo The University of Tokyo {matsushima, furuta, matsuo}@weblab.t.u-tokyo.ac.jp
4
+
5
+ # Ofir Nachum
6
+
7
+ # Shixiang Shane Gu
8
+
9
+ Google Research
10
+
11
+ {ofirnachum, shanegu}@google.com
12
+
13
+ # ABSTRACT
14
+
15
+ Most reinforcement learning (RL) algorithms assume online access to the environment, in which one may readily interleave updates to the policy with experience collection using that policy. However, in many real-world applications such as health, education, dialogue agents, and robotics, the cost or potential risk of deploying a new data-collection policy is high, to the point that it can become prohibitive to update the data-collection policy more than a few times during learning. With this view, we propose a novel concept of deployment efficiency, measuring the number of distinct data-collection policies that are used during policy learning. We observe that naïvely applying existing model-free offline RL algorithms recursively does not lead to a practical deployment-efficient and sample-efficient algorithm. We propose a novel model-based algorithm, Behavior-Regularized Model-ENsemble (BREMEN), that not only performs better than or comparably as the state-of-the-art dynamic-programming-based and concurrently-proposed model-based offline approaches on existing benchmarks, but can also effectively optimize a policy offline using 10-20 times fewer data than prior works. Furthermore, the recursive application of BREMEN achieves impressive deployment efficiency while maintaining the same or better sample efficiency, learning successful policies from scratch on simulated robotic environments with only 5-10 deployments, compared to typical values of hundreds to millions in standard RL baselines.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Reinforcement learning (RL) algorithms have recently demonstrated impressive success in learning behaviors for a variety of sequential decision-making tasks (Barth-Maron et al., 2018; Hessel et al., 2018; Nachum et al., 2019). Virtually all of these demonstrations have relied on highly-frequent online access to the environment, with the RL algorithms often interleaving each update to the policy with additional experience collection of that policy acting in the environment. However, in many real-world applications of RL, such as health (Murphy et al., 2001), education (Mandel et al., 2014), dialog agents (Jaques et al., 2019), and robotics (Gu et al., 2017a; Kalashnikov et al., 2018), the deployment of a new data-collection policy may be associated with a number of costs and risks. If we can learn tasks with a small number of data collection policies, we can substantially reduce them.
20
+
21
+ Based on this idea, we propose a novel measure of RL algorithm performance, namely deployment efficiency, which counts the number of changes in the data-collection policy during learning, as illustrated in Figure 1. This concept may be seen in contrast to sample efficiency or data efficiency (Precup et al., 2001; Degris et al., 2012; Gu et al., 2017b; Haarnoja et al., 2018; Lillicrap et al., 2016; Nachum et al., 2018), which measures the amount of environment interactions incurred during training, without regard to how many distinct policies were deployed to perform those interactions. Even when the data efficiency is high, the deployment efficiency could be low, since many on-policy and off-policy algorithms alternate data collection with each policy update (Schulman et al., 2015; Lillicrap et al., 2016; Gu et al., 2016; Haarnoja et al., 2018). Such dependence on high-frequency policy deployments is best illustrated in the recent works in offline RL (Fujimoto et al., 2019; Jaques et al., 2019; Kumar et al., 2019; Levine et al., 2020; Wu et al., 2019), where baseline off-policy algorithms exhibited poor performance when trained on a static dataset. These offline RL works, however, limit their study to a single deployment, which is enough for achieving high performance with data collected from a sub-optimal behavior policy, but often not from a random policy. In contrast to those prior works, we aim to learn successful policies from scratch in a manner that is both sample and deployment-efficient.
22
+
23
+ ![](images/d4b7db2b7c0236b75d1498e37817a81892cf444ccaaf33effb12564d6ca2dc21.jpg)
24
+ Figure 1: Deployment efficiency is defined as the number of changes in the data-collection policy $( I )$ , which is vital for managing costs and risks of new policy deployment. Online RL algorithms typically require many iterations of policy deployment and data collection, which leads to extremely low deployment efficiency. In contrast, most pure offline algorithms consider updating a policy from a fixed dataset without additional deployment and often fail to learn from a randomly initialized data-collection policy. Interestingly, most state-of-the-art off-policy algorithms are still evaluated in heavily online settings. For example, SAC (Haarnoja et al., 2018) collects one sample per policy update, amounting to 100,000 to 1 million deployments for learning standard benchmark domains.
25
+
26
+ Many existing model-free offline RL algorithms (Levine et al., 2020) are tuned and evaluated on massive datasets (e.g., one million transitions). In order to develop an algorithm that is both sample and deployment-efficient, each iteration of the algorithm between successive deployments has to work effectively on much smaller dataset sizes. We believe model-based RL is better suited to this setting due to its higher demonstrated sample efficiency than model-free RL (Kurutach et al., 2018; Nagabandi et al., 2018). Although the combination of model-based RL and offline or limiteddeployment settings seems straight-forward, we find this naïve approach leads to poor performance. This problem can be attributed to extrapolation errors (Fujimoto et al., 2019) similar to those observed in model-free methods. Specifically, the learned policy may choose sequences of actions which lead it to regions of the state space where the dynamics model cannot predict properly, due to poor coverage of the dataset. This can lead the policy to exploit approximation errors of the dynamics model and be disastrous for learning. In model-free settings, similar data distribution shift problems are typically remedied by regularizing policy updates explicitly with a divergence from the observed data distribution (Jaques et al., 2019; Kumar et al., 2019; Wu et al., 2019), which, however, can overly limit policies’ expressivity (Sohn et al., 2020).
27
+
28
+ In order to better approach these problems arising in limited deployment settings, we propose Behavior-Regularized Model-ENsemble (BREMEN), which learns an ensemble of dynamics models in conjunction with a policy using imaginary rollouts while implicitly regularizing the learned policy via appropriate parameter initialization and conservative trust-region learning updates. We evaluate BREMEN on standard offline RL benchmarks of high-dimensional continuous control tasks, where only a single static dataset is used. In this fixed-batch setting, our experiments show that BREMEN can not only achieve performance competitive with state-of-the-art when using standard dataset sizes but also learn with 10-20 times smaller datasets, which previous methods are unable to attain. Enabled by such stable and sample-efficient offline learning, we show that BREMEN can learn successful policies with only 5-10 deployments in the online setting, significantly outperforming existing off-policy and offline RL algorithms in deployment efficiency while keeping sample efficiency.
29
+
30
+ # 2 PRELIMINARIES
31
+
32
+ We consider a Markov Decision Process (MDP) setting, characterized by the tuple $\begin{array} { r l } { \mathcal { M } } & { { } = } \end{array}$ $( S , \mathcal { A } , p , r , \gamma )$ , where $s$ is the state space, $\mathcal { A }$ is the action space, $p ( s ^ { \prime } | s , a )$ is the transition probability distribution or dynamics, $r ( s )$ is the reward function and $\gamma \in ( 0 , 1 )$ is the discount factor. A policy $\pi$ is a function that determines the agent behavior, mapping from states to probability distributions over actions. The goal is to obtain the optimal policy $\pi ^ { * }$ , which maximizes the expectation of discounted sum of rewards. The transition probability $p ( s ^ { \prime } | s , a )$ is usually unknown, and estimated with a parameterized dynamics model $f _ { \phi }$ (e.g. a neural network) in model-based RL. For simplicity, we assume that the reward function $r ( s )$ is known, and the reward can be computed for any arbitrary state, but we may extend to the unknown setting and predict it using a parameterized function.
33
+
34
+ On-policy vs Off-policy, Online vs Offline At a high-level, most RL algorithms alternate many times between collecting a batch of transitions (deployments) and optimizing the policy (learning). If the algorithms discard data after each policy update, they are on-policy (Schulman et al., 2015; 2017), while if they accumulate data in a buffer $\mathcal { D }$ , i.e. experience replay (Lin, 1992), they are off-policy (Mnih et al., 2015; Lillicrap et al., 2016; Gu et al., 2016; 2017b; Haarnoja et al., 2018; Fujimoto et al., 2019; Fakoor et al., 2019) because not all the data in buffer comes from the current policy. However, we consider all these algorithms to be online RL algorithms, since they involve many deployments during learning, ranging from hundreds to millions. On the other hand, in pure offline RL, one does not assume direct interaction and learns a policy from only a fixed dataset, which effectively corresponds to a single deployment allowed for learning. Classically, interpolating these two extremes were semi-batch RL algorithms (Lange et al., 2012; Singh et al., 1995), which improve the policy through repetitions of collecting a large batch of transitions $\mathcal { D } = \{ ( s , a , s ^ { \prime } , r ) \}$ and performing many or full policy updates. While these semi-batch RL also realize good deployment efficiency, they have not been extensively studied with neural network function approximators or in off-policy settings with experience replay for scalable sample-efficient learning. In our work, we aim to have both high deployment efficiency and sample efficiency by developing an algorithm that can solve the tasks with minimal policy deployments as well as transition samples.
35
+
36
+ # 3 DEPLOYMENT EFFICIENCY
37
+
38
+ Deploying a new policy for data collection can be associated with a number of costs and risks for many real-world applications like medicine, dialogue systems, or robotic control (Murphy et al., 2001; Mandel et al., 2014; Gu et al., 2017a; Kalashnikov et al., 2018; Nachum et al., 2019; Jaques et al., 2019). While there are abundant works on safety for RL (Chow et al., 2015; Eysenbach et al., 2018; Chow et al., 2018; Ray et al., 2019; Chow et al., 2019), they often do not provide guarantees in practice when combined with neural networks and stochastic optimization. It is therefore necessary to verify each policy before deployment (e.g. measuring the variance of rewards or checking out-of-bounds actions). Due to such costs associated with each deployment, it is desirable to minimize the number of distinct deployments needed during the learning process. Even ignoring safety considerations, frequent updates to a deployed policy can exacerbate communication bottlenecks in large-scale distributed RL systems, which are becoming more prevalent (Nair et al., 2015; Espeholt et al., 2018; 2019). We additionally discuss on the importance of the deployment efficiency in real-world applications. See Appendix C.
39
+
40
+ In order to focus research on these practical bottlenecks, we propose a novel measure of RL algorithms, namely, deployment efficiency, which counts how many times the data-collection policy has been changed during improvement from random policy to solve the task. For example, if an RL algorithm operates by using its learned policy to collect transitions from the environment $I$ times, each time collecting a batch of $B$ new transitions, then the number of deployments is $I$ , while the total number of samples collected is $I \times B$ . The lower $I$ is, the more deployment-efficient the algorithm is; in contrast, sample efficiency looks at $I \times B$ . Online RL algorithms, whether they are on-policy or off-policy, typically update the policy and acquire new transitions by deploying the newly updated policy at every iteration. This corresponds to performing hundreds to millions of deployments during learning on standard benchmarks (Haarnoja et al., 2018), which is severely deployment inefficient. On the other hand, offline RL literature only studies the case of 1 deployment. A deployment-efficient algorithm would stand in the middle of these two extremes and ideally learn a successful policy from scratch while deploying only a few distinct policies, as illustrated in Figure 1.
41
+
42
+ Recent deep RL literature seldom emphasizes deployment efficiency, with few exceptions in specific applications (Kalashnikov et al., 2018) where such a learning procedure is necessary. Deploymentinefficient algorithms will fail in scenarios where the deployment of each new policy is exorbitantly expensive, such as safety-critical robotics or user-facing products. Although current state-of-the-art algorithms on continuous control have substantially improved sample or data efficiency, they have not optimized for deployment efficiency. For example, SAC (Haarnoja et al., 2018), an efficient model-free off-policy algorithm, performs half a million to one million policy deployments during learning on MuJoCo (Todorov et al., 2012) benchmarks. ME-TRPO (Kurutach et al., 2018), a model-based algorithm, performs a much lower 100-300 policy deployments, although this is still relatively high for practical settings.2 In our work, we demonstrate successful learning on standard benchmark environments with only 5-10 deployments.
43
+
44
+ # 4 BEHAVIOR-REGULARIZED MODEL-ENSEMBLE
45
+
46
+ To achieve a favorable combination of both high deployment and sample efficiency, we propose Behavior-Regularized Model-ENsemble (BREMEN). BREMEN incorporates Dyna-style (Sutton, 1991; Kurutach et al., 2018) model-based RL, learning an ensemble of dynamics models in conjunction with a policy using imaginary rollouts and behavior regularization via conservative trust-region updates.
47
+
48
+ # 4.1 IMAGINARY ROLLOUT FROM MODEL ENSEMBLE
49
+
50
+ As in recent Dyna-style model-based RL methods (Kurutach et al., 2018; Wang et al., 2019), BREMEN uses an ensemble of $K$ deterministic dynamics models $\hat { f } _ { \phi } = \left\{ \hat { f } _ { \phi _ { 1 } } , \dots , \hat { f } _ { \phi _ { K } } \right\}$ to alleviate the problem of model bias. Each model $\hat { f } _ { \phi _ { i } }$ is parameterized by $\phi _ { i }$ and trained by the following objective, which minimizes mean squared error between the prediction of next state $\hat { f } _ { \phi _ { i } } \left( s _ { t } , a _ { t } \right)$ and true next state $s _ { t + 1 }$ over a dataset $\mathcal { D }$ :
51
+
52
+ $$
53
+ \operatorname* { m i n } _ { \phi _ { i } } \frac { 1 } { | \mathcal { D } | } \sum _ { \left( s _ { t } , a _ { t } , s _ { t + 1 } \right) \in \mathcal { D } } \frac { 1 } { 2 } \left. s _ { t + 1 } - \hat { f } _ { \phi _ { i } } \left( s _ { t } , a _ { t } \right) \right. _ { 2 } ^ { 2 } .
54
+ $$
55
+
56
+ During training of a policy $\pi _ { \theta }$ , imagined trajectories of states and actions are generated sequentially, using a dynamics model $\hat { f } _ { \phi _ { i } }$ that is randomly selected at each time step:
57
+
58
+ $$
59
+ a _ { t } \sim \pi _ { \theta } ( \cdot | \hat { s } _ { t } ) , \quad \hat { s } _ { t + 1 } = \hat { f } _ { \phi _ { i } } ( \hat { s } _ { t } , a _ { t } ) \quad \mathrm { w h e r e } \quad i \sim \{ 1 \cdot \cdot \cdot K \} .
60
+ $$
61
+
62
+ # 4.2 POLICY UPDATE WITH BEHAVIOR REGULARIZATION
63
+
64
+ In order to manage the discrepancy between the true dynamics and the learned model caused by the distribution shift in batch settings, we propose to use iterative policy updates via a trust-region constraint, re-initialized with a behavior-cloned policy after every deployment. Specifically, after each deployment, we are given an updated dataset of experience transitions $\mathcal { D }$ . With this dataset, we approximate the true behavior policy $\pi _ { b }$ through behavior cloning (BC), utilizing a neural network $\hat { \pi } _ { \beta }$ parameterized by $\beta$ , where we implicitly assume a fixed variance, a common practice in BC (Rajeswaran et al., 2017):
65
+
66
+ $$
67
+ \operatorname* { m i n } _ { \beta } \frac { 1 } { | \mathscr { D } | } \sum _ { ( s _ { t } , a _ { t } ) \in \mathscr { D } } \frac { 1 } { 2 } \left. a _ { t } - \hat { \pi } _ { \beta } \left( s _ { t } \right) \right. _ { 2 } ^ { 2 } .
68
+ $$
69
+
70
+ After obtaining the estimated behavior policy, we initialize the target policy $\pi _ { \theta }$ as a Gaussian policy with mean from $\hat { \pi } _ { \beta }$ and standard deviation of 1. This BC initialization in conjunction with gradient descent based optimization may be seen as implicitly biasing the optimized $\pi _ { \theta }$ to be close to the data-collection policy (Nagarajan & Kolter, 2019), and thus works as a remedy for the distribution shift problem (Ross et al., 2011). To further bias the learned policy to be close to the data-collection
71
+
72
+ # Algorithm 1 BREMEN for Deployment-Efficient RL
73
+
74
+ <table><tr><td></td><td>Input: Empty dataset Dau,D,Initial parameters Φ = {1,·,Φk},β,Number of policy optimization T</td></tr><tr><td></td><td>Numberof deploymentsI.</td></tr><tr><td></td><td>1:Randomly initialize the target policy πθ .</td></tr><tr><td>2:for deploymenti=1,·.,I do</td><td></td></tr><tr><td>3:</td><td>Collect B transitions in the true environment using T and add them to dataset</td></tr><tr><td></td><td>Dall←DalU{St,at,rt,St+1},D←{st,at,rt,St+1}.</td></tr><tr><td>4:</td><td>Train K dynamics models f using Dau via Equation 1.</td></tr><tr><td>5: 6:</td><td>Train estimated behavior policy πβ using D by behavior cloning via Equation 3.</td></tr><tr><td>7:</td><td>Re-initialize target policy πeo = Normal(β,1). for policy optimization k =1,..·,T do</td></tr><tr><td>8:</td><td>Generate imaginary rollout via Equation 2.</td></tr><tr><td>9:</td><td>Optimize target policy Tβ satisfying Equation 4 with the rollout.</td></tr></table>
75
+
76
+ policy, we opt to use a KL-based trust-region optimization (Schulman et al., 2015). Therefore, the optimization of BREMEN becomes
77
+
78
+ $$
79
+ \begin{array} { r l } & { \theta _ { k + 1 } = \underset { \theta } { \arg \operatorname* { m a x } } \ \underset { s , a \sim \pi _ { \theta _ { k } } , \hat { f } _ { \phi _ { i } } } { \mathbb { E } } [ \frac { \pi _ { \theta } ( a | s ) } { \pi _ { \theta _ { k } } ( a | s ) } A ^ { \pi _ { \theta _ { k } } } ( s , a ) ] } \\ & { \mathrm { s . t . } \quad \underset { s \sim \pi _ { \theta _ { k } } , \hat { f } _ { \phi _ { i } } } { \mathbb { E } } [ D _ { \mathrm { K L } } ( \pi _ { \theta } ( \cdot | s ) | | \pi _ { \theta _ { k } } ( \cdot | s ) ) ] \leq \delta , \quad \pi _ { \theta _ { 0 } } = \mathrm { N o r m a l } ( \hat { \pi } _ { \beta } , 1 ) , } \end{array}
80
+ $$
81
+
82
+ where $A ^ { \pi _ { \theta _ { k } } } ( s , a )$ is the advantage of $\pi _ { \theta _ { k } }$ computed using model-based rollouts in the learned dynamics model and $\delta$ is the maximum step size.
83
+
84
+ The combination of BC for initialization and finite iterative trust-region updates serves as an implicit KL regularization. This is in contrast to many previous offline RL algorithms that augment the value function with a penalty of explicit KL divergence (Siegel et al., 2020; Wu et al., 2019) or maximum mean discrepancy (Kumar et al., 2019). Empirically, we found that our regularization technique outperforms the explicit KL penalty (Section 5.3). Furthermore, we provide a mathematical intuition explaining how our methods works as an implicit regularization of distributional shift in Appendix A.
85
+
86
+ By recursively performing offline procedure, BREMEN can be used for deployment-efficient learning as shown in Algorithm 1, starting from a randomly initialized policy, collecting experience data, and performing offline policy updates.
87
+
88
+ # 5 EXPERIMENTS
89
+
90
+ In order to realize a deployment-efficient RL algorithm, the batch policy optimizer has to be stable and sample-efficient. We first evaluate BREMEN in the offline setting, where the algorithm learns the policy from a static dataset. Standard benchmarks of MuJoCo physics simulator shown in $\mathrm { W u }$ et al., 2019) and more recent datasets (Fu et al., 2020) are used in the evaluation, and we compared the asymptotic performance of BREMEN with other offline RL methods including the concurrent model-based approaches. We then tested the sample-efficiency of offline algorithms using smaller datasets. We lastly extend the experiment to deployment-efficient settings, where the algorithms learn their policies from scratch via a limited number of deployments and perform some ablations to see how components in BREMEN affect performance. See Appendix F for further details.
91
+
92
+ # 5.1 EVALUATING OFFLINE RL PERFORMANCES
93
+
94
+ Standard Benchmarks We evaluate BREMEN on standard offline RL benchmarks following and identical protocol as in Wu et al. (2019): We first train online SAC to a certain cumulative reward threshold, 4,000 in HalfCheetah, 1,000 in Ant, Hopper, and Walker2d, and collect offline datasets. We evaluate agents with the offline dataset of one million (1M) transitions, which is standard for BCQ and BRAC. Table 1 (top) shows that BREMEN can achieve performance competitive with state-of-the-art model-free offline RL algorithms when using the standard dataset size of 1M. We also test BREMEN with more recent benchmarks of D4RL (Fu et al., 2020) and compared the performance with the existing model-free and model-based methods. See Appendix D for the results.
95
+
96
+ <table><tr><td colspan="5">1,000,000(1M) transitions</td></tr><tr><td>Method</td><td>Ant</td><td>HalfCheetah</td><td>Hopper</td><td>Walker2d</td></tr><tr><td>Dataset BC</td><td>1191 1321±141</td><td>4126</td><td>1128</td><td>1376</td></tr><tr><td></td><td></td><td>4281±12 5783±272</td><td>1341±161 1130±127</td><td>1421±147 2153±753</td></tr><tr><td>BCQ</td><td>2021±31 2072±285</td><td></td><td>1422±90</td><td></td></tr><tr><td>BRAC</td><td></td><td>7192±115</td><td></td><td>2239±1124</td></tr><tr><td>BRAC (max Q)</td><td>2369±234</td><td>7320±91</td><td>1916±343</td><td>2409±1210</td></tr><tr><td>BREMEN (Ours)</td><td>3328±275</td><td>8055±103</td><td>2058±852</td><td>2346±230</td></tr><tr><td>ME-TRPO (offline)</td><td>1258±550</td><td>1804±924</td><td>518±91</td><td>211±154</td></tr><tr><td></td><td>100,000</td><td>(100K)transitions</td><td></td><td></td></tr><tr><td>Method</td><td>Ant</td><td>HalfCheetah</td><td>Hopper</td><td>Walker2d</td></tr><tr><td>Dataset</td><td>1191</td><td>4066</td><td>1128</td><td>1376</td></tr><tr><td>BC</td><td>1330±81</td><td>4266±21</td><td>1322±109</td><td>1426±47</td></tr><tr><td>BCQ</td><td>1363±199</td><td>3915±411</td><td>1129±238</td><td>2187±196</td></tr><tr><td>BRAC</td><td>-157±383</td><td>2505±2501</td><td>1310±70</td><td>2162±1109</td></tr><tr><td>BRAC (max Q)</td><td>-226±387</td><td>2332±2422</td><td>1422±101</td><td>2164±1114</td></tr><tr><td>BREMEN (Ours)</td><td>1633±127</td><td>6095±370</td><td>2191±455</td><td>2132±301</td></tr><tr><td>ME-TRPO (offline)</td><td>974±4</td><td>2±434</td><td>307±170</td><td>10±61</td></tr><tr><td></td><td>50,000 (50K) transitions</td><td></td><td></td><td></td></tr><tr><td>Method</td><td>Ant</td><td>HalfCheetah</td><td>Hopper</td><td>Walker2d</td></tr><tr><td>Dataset</td><td>1191</td><td>4138</td><td>1128</td><td>1376</td></tr><tr><td>BC</td><td>1270±65</td><td>4230±49</td><td>1249±61</td><td>1420±194</td></tr><tr><td>BCQ</td><td>1329±95</td><td>1319±626</td><td>1178±235</td><td>1841±439</td></tr><tr><td>BRAC</td><td>-878±244</td><td>-597±73</td><td>1277±102</td><td>976±1207</td></tr><tr><td>BRAC (max Q)</td><td>-843±279</td><td>-590±56</td><td>1276±225</td><td>903±1137</td></tr><tr><td>BREMEN(Ours)</td><td>1347±283</td><td>5823±146</td><td>1632±796</td><td>2280±647</td></tr><tr><td></td><td>938±32</td><td></td><td></td><td></td></tr><tr><td>ME-TRPO (offfline)</td><td></td><td>-73±95</td><td>152±13</td><td>176±343</td></tr></table>
97
+
98
+ Table 1: Comparison of BREMEN to the existing offline methods on static datasets. Each cell shows the average cumulative reward and their standard deviation, where the number of samples is 1M, 100K, and 50K, respectively. The maximum steps per episode is 1,000. BRAC applies a primal form of KL value penalty, and BRAC (max Q) means its variant of sampling multiple actions and taking the maximum according to the learned Q function.
99
+
100
+ Evaluating Sample-Efficiency We then evaluate the sample-efficiency by making much smaller datasets of $5 0 \mathrm { k }$ and $1 0 0 \mathrm { k }$ transitions $5 \sim 1 0 \%$ of Wu et al. (2019)). Surprisingly, Table 1 (middle and bottom) shows that BREMEN can also learn with smaller datasets, where BCQ and BRAC are unable to exceed even BC baseline. This is a novel evaluation protocol we proposed, and our BREMEN’s superior performance here is exactly what enables recursive BREMEN in the next section to be an effective algorithm in deployment-constrained settings.
101
+
102
+ # 5.2 EVALUATING DEPLOYMENT EFFICIENCY IN ONLINE RL BENCHMARKS
103
+
104
+ We compare BREMEN to ME-TRPO, SAC, BCQ, and BRAC applied to limited deployment settings. To adapt offline methods (BCQ, BRAC) to this setting, we simply apply them in a recursive fashion;3 at each deployment iteration, we collect a batch of data with the most recent policy and then run the offline update with this dataset. As for SAC, we simply change the replay buffer to update only at specific deployment intervals. For the sake of comparison, we align the number of deployments and the amount of data collection at each deployment (either $1 0 0 \mathrm { k }$ or $2 0 0 \mathrm { k }$ ) for all methods.4
105
+
106
+ Figure 2 shows the results with $2 0 0 \mathrm { k }$ (top) and $1 0 0 \mathrm { k }$ (bottom) batched transitions per deployment. Regardless of the environments and the batch size per update, BREMEN achieves remarkable performance while existing online and offline RL methods struggle to make any progress. As a point of comparison, we also include results for online SAC and ME-TRPO without deployment-limits but using the same number of transitions. We additionally compare BREMEN to the model-based offline RL methods with uncertainty-based penalties. See Appendix E for further details.
107
+
108
+ Following the motivation of deployment efficiency, obtaining a successful policy under data-collection constraint conditions in the real application, we extensively evaluate our algorithm on more realistic robotics environments in OpenAI Gym. The experimental procedure is the same as above, while we limit the batch size at each deployment as only $2 5 \mathrm { k }$ . Figure 3 presents the reaching tasks with Fetch robot and 20-DoF shadow hand (Plappert et al., 2018), and the experimental results in both environments. Only BREMEN shows stable improvement and high performance, while other offline and online algorithms fail to learn. These results suggest that a model-based method is a desirable approach for satisfying practical requirements in robotics, i.e. sample and deployment efficiency.
109
+
110
+ ![](images/6a1cb8fc593fa991de860c81499864a36dc243a21b814426030744b691e27217.jpg)
111
+ Figure 2: Evaluation of BREMEN with the existing methods (ME-TRPO, SAC, BCQ, BRAC) under deployment constraints (to 5-10 deployments with batch sizes of 200k and 100k). The average cumulative rewards and their standard deviations with 5 random seeds are shown. Vertical dotted lines represent where each policy deployment and data collection happen. BREMEN is able to learn successful policies with only 5-10 deployments, while the state-of-the-art off-policy (SAC), model-based (ME-TRPO), and recursively-applied offline RL algorithms (BCQ, BRAC) often struggle to make any progress. For completeness, we show ME-TRPO(online) and SAC(online) which are their original optimal learning curves without deployment constraints, plotted with respect to samples normalized by the batch size. While SAC(online) substantially outperforms BREMEN in sample efficiency, it uses 1 deployment per sample, leading to 100k-500k deployments required for learning. Interestingly, BREMEN achieves even better performance than the original ME-TRPO(online), suggesting the effectiveness of implicit behavior regularization. For SAC and ME-TRPO under deployment-constrained evaluation, their batch size between policy deployments differs substantially from their standard settings, and therefore we performed extensive hyper-parameter search on the relevant parameters such as the number of policy updates between deployments, as discussed in Appendix F.2.1.
112
+
113
+ ![](images/aefe5703a6af1bb98f484da513d1f7861b5ff52440d53d4cfceab98875c791d8.jpg)
114
+ Figure 3: Robotics environments and the results under deployment constraints (10 deployments with batch sizes of 25k). The performances are averaged over 5 seeds. BREMEN seems the only method that shows both stable improvement and solving tasks without large degradation or sub-optimal convergence.
115
+
116
+ # 5.3 ABLATION: EVALUATING EFFECTIVENESS OF IMPLICIT KL CONTROL
117
+
118
+ In this section, we present an experiment to better understand the effect of BREMEN’s implicit regularization. Figure 4 shows the KL divergence of learned policies from the last deployed policy. We compare BREMEN to variants of BREMEN that use an explicit KL penalty on value instead of BC initialization (conservative KL trust-region updates are still used). We find that the explicit KL without behavior initialization variants learn policies that move farther away from the last deployed policy than behavior initialized policies. This suggests that the implicit behavior regularization employed by BREMEN is more effective as a conservative policy learning protocol. In addition, to assess the effect of repeated behavior cloning initialization, we also evaluate a variant of BREMEN without behavior cloning re-initialization (grey). This variant works in easier environments (Ant, Halfcheetah), but does not show remarkable progress in more challenging ones with termination (Hopper, Walker2d).
119
+
120
+ ![](images/caaaeaae5c063a15f89b51e7364e62582bf4f0db0e551d24fb5de280da818a2c.jpg)
121
+ Figure 4: We examine average cumulative rewards (top) and corresponding KL divergence between the last deployed policy and the target policy (bottom) with batch size 200K in limited deployment settings. The behavior initialized policy remains close to the last deployed policy during improvement without explicit value penalty $- \alpha D _ { \mathrm { K L } } ( { \bar { \pi _ { \theta } } } \| { \hat { \pi } } _ { \beta } )$ . The explicit penalty is controlled by a coefficient $\alpha$ .
122
+
123
+ This result empirically supports the need for repeated behavior initialization after each deployment.
124
+ The results of further experiments are shown in Appendix G.
125
+
126
+ # 6 RELATED WORK
127
+
128
+ Deployment Efficiency and Offline RL Although we are not aware of any previous works which explicitly proposed the concept of deployment efficiency, its necessity in many real-world applications has been generally known. One may consider previously proposed semi-batch RL algorithms (Ernst et al., 2005; Lange et al., 2012; Singh et al., 1994; Roux, 2016) or theoretical analysis of switching cost under the tabular PAC-MDP settings (Bai et al., 2019; Guo & Brunskill, 2015) as approaching this issue. More recently, a related but distinct problem known as offline RL has gained popularity (Levine et al., 2020; Wu et al., 2019; Agarwal et al., 2019; Kumar et al., 2020). These works consider an extreme version of 1 deployment, and typically collect the static batch with a partially trained policy rather than a random policy. While offline RL has shown promising results for a variety of real-world applications, such as robotics (Mandlekar et al., 2019), dialogue systems (Jaques et al., 2019), or medical treatments (Gottesman et al., 2018), these algorithms struggle when learning a policy from scratch or when the dataset is small. Nevertheless, common themes of many offline RL algorithms – regularizing the learned policy to the behavior policy (Fujimoto et al., 2019; Kumar et al., 2019; Siegel et al., 2020; Wu et al., 2019) and utilizing ensembles to handle uncertainty (Kumar et al., 2019; Wu et al., 2019) – served as inspirations for the proposed our algorithm. A major difference of BREMEN from prior works is that the target policy is not explicitly forced to stick close to the estimated behavior policy through the policy update except for the initial iteration. Rather, BREMEN employs a more implicit regularization by initializing the learned policy with a behavior cloned policy and then applying conservative trust-region updates. Another major difference is the application of model-based approaches to fully offline settings, which has not been extensively studied in prior works (Levine et al., 2020), except the two concurrent works (Kidambi et al., 2020; Yu et al., 2020) that study pessimistic or uncertainty penalized MDPs with guarantees – closely related to Liu et al. (2019). By contrast, our work shows that a simple technique can already enable model-based offline algorithms to significantly outperform the prior model-free methods, and is, to the best of our knowledge, the first to define and extensively evaluate deployment efficiency with recursive experiments.
129
+
130
+ Model-Based RL There are many types of model-based RL algorithms (Sutton, 1991; Deisenroth & Rasmussen, 2011; Heess et al., 2015). A simple algorithmic choice is Dyna-style (Sutton, 1991), which uses a parameterized model to estimate the true MDP transition function, stochastically mapping states and actions to next states. The dynamics model can then serve as a simulator of the environment during policy updates. Dyna-style algorithms often suffer from the distributional shift, also known as model bias, which leads RL agents to exploit regions where the data is insufficient, and significant performance degradation. A variety of remedies have been proposed to relieve the issue of model bias, such as the use of multiple dynamics models as an ensemble (Chua et al., 2018; Kurutach et al., 2018; Janner et al., 2019), meta-learning (Clavera et al., 2018), energy-based regularizer (Boney et al., 2019), game-theoretic framework (Rajeswaran et al., 2020), and explicit penalty for unknown states (Kidambi et al., 2020; Yu et al., 2020). Notably, we have employed a subset of these remedies – model ensembles and trust-region updates (Kurutach et al., 2018) – for BREMEN. Compared to prior works, our work is notable for using BC initialization in conjunction with trust-region updates to alleviate the distribution shift of the learned policy from the dataset used to train the dynamics model.
131
+
132
+ # 7 CONCLUSION
133
+
134
+ In this work, we introduced deployment efficiency, a novel measure for RL performance that counts the number of changes in the data-collection policy during learning. To enhance deployment efficiency, we proposed a novel model-based offline algorithm, Behavior-Regularized Model-ENsemble (BREMEN), combining model-ensembles with trust region updates from model-based RL literature (Kurutach et al., 2018), and policy initialization with behavior cloning from offline RL literature (Fujimoto et al., 2019; Wu et al., 2019). Crucially, BREMEN can improve policies offline sample-efficiently even when the batch size is 10-20 times smaller than prior works, allowing BREMEN to achieve impressive results in limited deployment settings, obtaining successful policies from scratch in only 5-10 deployments. Not only can this help alleviate costs and risks in real-world applications, but it can also reduce the amount of communication required during distributed learning and could form the basis for communication-efficient large-scale RL in contrast to prior works (Nair et al., 2015; Espeholt et al., 2018; 2019). Most critically, we show that under deployment efficiency constraints, most prior algorithms – model-free or model-based, online or offline – fail to achieve successful learning. One possible direction for future work is to incorporate verification efficiency into consideration, since a stochastic multi-modal policy could collect more diverse transitions while it takes more trajectories to be verified for safety than a uni-modal policy. While we presented promising results on some realistic simulated environments, validating BREMEN on real robots is another direction. We hope our work can gear the research community to value deployment efficiency as an important criterion for RL algorithms, and to eventually achieve similar sample efficiency and asymptotic performance as the state-of-the-art algorithms like SAC (Haarnoja et al., 2018) while having the deployment efficiency well-suited for safe and practical real-world reinforcement learning.
135
+
136
+ # REFERENCES
137
+
138
+ Fabian Abel, Yashar Deldjoo, Mehdi Elahi, and Daniel Kohlsdorf. Recsys challenge 2017: Offline and online evaluation. In ACM Conference on Recommender Systems, 2017.
139
+
140
+ Rishabh Agarwal, Dale Schuurmans, and Mohammad Norouzi. An optimistic perspective on offline reinforcement learning. arXiv preprint arXiv:1907.04543, 2019.
141
+
142
+ Christopher G. Atkeson, Benzun P. Wisely Babu, Nandan Banerjee, Dmitry Berenson, Christoper P. Bove, Xiongyi Cui, Mathew DeDonato, Ruixiang Du, Siyuan Feng, Perry Franklin, Michael Gennert, Joshua P. Graff, Peng He, Aaron Jaeger, Joohyung Kim, Kevin Knoedler, Lening Li, Chenggang Liu, Xianchao Long, Taskin Padir, Felipe Polido, G. G. Tighe, and X Xinjilefu. No falls, no resets: Reliable humanoid behavior in the darpa robotics challenge. In International Conference on Humanoid Robots, 2015.
143
+
144
+ Yu Bai, Tengyang Xie, Nan Jiang, and Yu-Xiang Wang. Provably efficient q-learning with low switching cost. In Advances in Neural Information Processing Systems, 2019.
145
+
146
+ Gabriel Barth-Maron, Matthew Hoffman, David Budden, Will Dabney, Dan Horgan, Dhruva TB, Alistair Muldal, Nicolas Heess, and Timothy Lillicrap. Distributed distributional deterministic policy gradients. In International Conference on Learning Representations, 2018.
147
+
148
+ Rinu Boney, Juho Kannala, and Alexander Ilin. Regularizing model-based planning with energy-based models. In Conference on Robot Learning, 2019.
149
+
150
+ Serkan Cabi, Sergio Gómez Colmenarejo, Alexander Novikov, Ksenia Konyushova, Scott Reed, Rae Jeong, Konrad Zolna, Yusuf Aytar, David Budden, Mel Vecerik, Oleg Sushkov, David Barker, Jonathan Scholz, Misha Denil, Nando de Freitas, and Ziyu Wang. Scaling data-driven robotics with reward sketching and batch reinforcement learning. In Robotics: Science and Systems, 2020.
151
+
152
+ Yinlam Chow, Aviv Tamar, Shie Mannor, and Marco Pavone. Risk-sensitive and robust decisionmaking: a cvar optimization approach. In Advances in Neural Information Processing Systems, 2015.
153
+
154
+ Yinlam Chow, Ofir Nachum, Edgar Duenez-Guzman, and Mohammad Ghavamzadeh. A lyapunovbased approach to safe reinforcement learning. In Advances in neural information processing systems, 2018.
155
+
156
+ Yinlam Chow, Ofir Nachum, Aleksandra Faust, Edgar Duenez-Guzman, and Mohammad Ghavamzadeh. Lyapunov-based safe policy optimization for continuous control. arXiv preprint arXiv:1901.10031, 2019.
157
+
158
+ 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, 2018.
159
+
160
+ Ignasi Clavera, Jonas Rothfuss, John Schulman, Yasuhiro Fujita, Tamim Asfour, and Pieter Abbeel. Model-based reinforcement learning via meta-policy optimization. In Conference on Robot Learning, 2018.
161
+
162
+ Thomas Degris, Martha White, and Richard S Sutton. Off-policy actor-critic. arXiv preprint arXiv:1205.4839, 2012.
163
+
164
+ Marc Deisenroth and Carl E Rasmussen. PILCO: A model-based and data-efficient approach to policy search. In International Conference on Machine Learning, 2011.
165
+
166
+ Gabriel Dulac-Arnold, Daniel Mankowitz, and Todd Hester. Challenges of real-world reinforcement learning. arXiv preprint arXiv:1904.12901, 2019.
167
+
168
+ Damien Ernst, Pierre Geurts, and Louis Wehenkel. Tree-based batch mode reinforcement learning. Journal of Machine Learning Research, 2005.
169
+
170
+ Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Vlad 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 International Conference on Machine Learning, 2018.
171
+
172
+ Lasse Espeholt, Raphaël Marinier, Piotr Stanczyk, Ke Wang, and Marcin Michalski. SEED RL: Scalable and efficient deep-rl with accelerated central inference. arXiv preprint arXiv:1910.06591, 2019.
173
+
174
+ Benjamin Eysenbach, Shixiang Gu, Julian Ibarz, and Sergey Levine. Leave no trace: Learning to reset for safe and autonomous reinforcement learning. International Conference on Learning Representations, 2018.
175
+
176
+ Rasool Fakoor, Pratik Chaudhari, and Alexander J. Smola. P3o: Policy-on policy-off policy optimization. arXiv preprint arXiv:1905.01756, 2019.
177
+
178
+ 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.
179
+
180
+ Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. In International Conference on Machine Learning, 2019.
181
+
182
+ Omer Gottesman, Fredrik Johansson, Joshua Meier, Jack Dent, Donghun Lee, Srivatsan Srinivasan, Linying Zhang, Yi Ding, David Wihl, Xuefeng Peng, Jiayu Yao, Isaac Lage, Christopher Mosch, Li wei H. Lehman, Matthieu Komorowski, Matthieu Komorowski, Aldo Faisal, Leo Anthony Celi, David Sontag, and Finale Doshi-Velez. Evaluating reinforcement learning algorithms in observational health settings. arXiv preprint arXiv:1805.12298, 2018.
183
+
184
+ Shixiang Gu, Timothy Lillicrap, Ilya Sutskever, and Sergey Levine. Continuous deep q-learning with model-based acceleration. In International Conference on Machine Learning, 2016.
185
+
186
+ Shixiang Gu, Ethan Holly, Timothy Lillicrap, and Sergey Levine. Deep reinforcement learning for robotic manipulation with asynchronous off-policy updates. In International Conference on Robotics and Automation, 2017a.
187
+
188
+ Shixiang Gu, Timothy Lillicrap, Zoubin Ghahramani, Richard E. Turner, and Sergey Levine. Q-Prop: Sample-efficient policy gradient with an off-policy critic. In International Conference on Learning Representations, 2017b.
189
+
190
+ Zhaohan Guo and Emma Brunskill. Concurrent pac rl. In AAAI Conference on Artificial Intelligence, 2015.
191
+
192
+ 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, 2018.
193
+
194
+ Nicolas Heess, Gregory Wayne, David Silver, Timothy Lillicrap, Tom Erez, and Yuval Tassa. Learning continuous control policies by stochastic value gradients. In Advances in Neural Information Processing Systems, 2015.
195
+
196
+ Matteo Hessel, Joseph Modayil, Hado Van Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, Mohammad Azar, and David Silver. Rainbow: Combining improvements in deep reinforcement learning. In AAAI Conference on Artificial Intelligence, 2018.
197
+
198
+ Michael Janner, Justin Fu, Marvin Zhang, and Sergey Levine. When to trust your model: Model-based policy optimization. In Advances in Neural Information Processing Systems, 2019.
199
+
200
+ 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. arXiv preprint arXiv:1907.00456, 2019.
201
+
202
+ Dmitry Kalashnikov, Alex Irpan, Peter Pastor, Julian Ibarz, Alexander Herzog, Eric Jang, Deirdre Quillen, Ethan Holly, Mrinal Kalakrishnan, Vincent Vanhoucke, and Sergey Levine. QT-Opt: Scalable deep reinforcement learning for vision-based robotic manipulation. In Conference on Robot Learning, 2018.
203
+
204
+ Rahul Kidambi, Aravind Rajeswaran, Praneeth Netrapalli, and Thorsten Joachims. MOReL : Modelbased offline reinforcement learning. arXiv preprint arXiv:2005.05951, 2020.
205
+
206
+ D. Kingma and J. Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2014.
207
+
208
+ Aviral Kumar, Justin Fu, Matthew Soh, George Tucker, and Sergey Levine. Stabilizing off-policy q-learning via bootstrapping error reduction. In Advances in Neural Information Processing Systems, 2019.
209
+
210
+ Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative q-learning for offline reinforcement learning. arXiv preprint arXiv:2006.04779, 2020.
211
+
212
+ Thanard Kurutach, Ignasi Clavera, Yan Duan, Aviv Tamar, and Pieter Abbeel. Model-Ensemble Trust-Region Policy Optimization. In International Conference on Learning Representations, 2018.
213
+
214
+ Sascha Lange, Thomas Gabel, and Martin Riedmiller. Batch reinforcement learning. In Reinforcement learning. Springer, 2012.
215
+
216
+ 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.
217
+
218
+ 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. In International Conference on Learning Representations, 2016.
219
+
220
+ Long-Ji Lin. Self-improving reactive agents based on reinforcement learning, planning and teaching. Machine learning, 1992.
221
+
222
+ Yao Liu, Adith Swaminathan, Alekh Agarwal, and Emma Brunskill. Off-policy policy gradient with state distribution correction. arXiv preprint arXiv:1904.08473, 2019.
223
+
224
+ Travis Mandel, Yun-En Liu, Sergey Levine, Emma Brunskill, and Zoran Popovic. Offline policy evaluation across representations with applications to educational games. In International Conference on Autonomous Agents and Multiagent Systems, 2014.
225
+
226
+ Ajay Mandlekar, Fabio Ramos, Byron Boots, Li Fei-Fei, Animesh Garg, and Dieter Fox. IRIS: Implicit reinforcement without interaction at scale for learning control from offline robot manipulation data. arXiv preprint arXiv:1911.05321, 2019.
227
+
228
+ 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, 2015.
229
+
230
+ Susan A Murphy, Mark J van der Laan, James M Robins, and Conduct Problems Prevention Research Group. Marginal mean models for dynamic regimes. Journal of the American Statistical Association, 2001.
231
+
232
+ Ofir Nachum, Shixiang Shane Gu, Honglak Lee, and Sergey Levine. Data-efficient hierarchical reinforcement learning. In Advances in Neural Information Processing Systems, 2018.
233
+
234
+ Ofir Nachum, Michael Ahn, Hugo Ponte, Shixiang Gu, and Vikash Kumar. Multi-agent manipulation via locomotion using hierarchical sim2real. In Conference on Robot Learning, 2019.
235
+
236
+ Anusha Nagabandi, Gregory Kahn, Ronald S. Fearing, and Sergey Levine. Neural Network Dynamics for Model-Based Deep Reinforcement Learning with Model-Free Fine-Tuning. International Conference on Robotics and Automation, 2018.
237
+
238
+ Vaishnavh Nagarajan and J Zico Kolter. Generalization in deep networks: The role of distance from initialization. arXiv preprint arXiv:1901.01672, 2019.
239
+
240
+ 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.
241
+
242
+ Ashvin Nair, Murtaza Dalal, Abhishek Gupta, and Sergey Levine. Accelerating online reinforcement learning with offline datasets. arXiv preprint arXiv:2006.09359, 2020.
243
+
244
+ 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.
245
+
246
+ Matthias Plappert, Marcin Andrychowicz, Alex Ray, Bob McGrew, Bowen Baker, Glenn Powell, Jonas Schneider, Josh Tobin, Maciek Chociej, Peter Welinder, et al. Multi-goal reinforcement learning: Challenging robotics environments and request for research. arXiv preprint arXiv:1802.09464, 2018.
247
+
248
+ Doina Precup, Richard S Sutton, and Sanjoy Dasgupta. Off-policy temporal-difference learning with function approximation. In International Conference on Machine Learning, 2001.
249
+
250
+ 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.
251
+
252
+ Aravind Rajeswaran, Igor Mordatch, and Vikash Kumar. A game theoretic framework for model based reinforcement learning. arXiv preprint arXiv:2004.07804, 2020.
253
+
254
+ Alex Ray, Joshua Achiam, and Dario Amodei. Benchmarking safe exploration in deep reinforcement learning. arXiv preprint arXiv:1910.01708, 2019.
255
+
256
+ Stéphane Ross, Geoffrey Gordon, and Drew Bagnell. A reduction of imitation learning and structured prediction to no-regret online learning. In International conference on artificial intelligence and statistics, 2011.
257
+
258
+ Nicolas Le Roux. Efficient iterative policy optimization. arXiv preprint arXiv:1612.08967, 2016.
259
+
260
+ John Schulman, Sergey Levine, Philipp Moritz, Michael Jordan, and Pieter Abbeel. Trust region policy optimization. In International Conference on Machine Learning, 2015.
261
+
262
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
263
+
264
+ Noah Y. Siegel, Jost Tobias Springenberg, Felix Berkenkamp, Abbas Abdolmaleki, Michael Neunert, Thomas Lampe, Roland Hafner, and Martin A. Riedmiller. Keep doing what worked: Behavioral modelling priors for offline reinforcement learning. In International Conference on Learning Representations, 2020.
265
+
266
+ Satinder P Singh, Tommi Jaakkola, and Michael I Jordan. Learning without state-estimation in partially observable markovian decision processes. In Machine Learning Proceedings. Elsevier, 1994.
267
+
268
+ Satinder P. Singh, Tommi Jaakkola, and Michael I. Jordan. Reinforcement learning with soft state aggregation. In Advances in Neural Information Processing Systems, 1995.
269
+
270
+ Sungryull Sohn, Yinlam Chow, Jayden Ooi, Ofir Nachum, Honglak Lee, Ed Chi, and Craig Boutilier. BRPO: Batch residual policy optimization. arXiv preprint arXiv:2002.05522, 2020.
271
+
272
+ Richard S Sutton. Dyna, an integrated architecture for learning, planning, and reacting. ACM Sigart Bulletin, 1991.
273
+
274
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In International Conference on Intelligent Robots and Systems, 2012.
275
+
276
+ Tingwu Wang, Xuchan Bao, Ignasi Clavera, Jerrick Hoang, Yeming Wen, Eric Langlois, Shunshi Zhang, Guodong Zhang, Pieter Abbeel, and Jimmy Ba. Benchmarking model-based reinforcement learning. arXiv preprint arXiv:1907.02057, 2019.
277
+
278
+ Yifan Wu, George Tucker, and Ofir Nachum. Behavior Regularized Offline Reinforcement Learning. arXiv preprint arXiv:1911.11361, 2019.
279
+
280
+ Tianhe Yu, Garrett Thomas, Lantao Yu, Stefano Ermon, James Zou, Sergey Levine, Chelsea Finn, and Tengyu Ma. MOPO: Model-based offline policy optimization. arXiv preprint arXiv:2005.13239, 2020.
281
+
282
+ # APPENDIX
283
+
284
+ # A IMPLICIT KL CONTROL FROM A MATHEMATICAL PERSPECTIVE
285
+
286
+ We can intuitively understand that behavior cloning initialization with trust-region updates works as a regularization of distributional shift, and this can be supported by theory. Following the notation of Janner et al. (2019), we denote the generalization error of a dynamics model on the state distribution under the true behavior policy as $\begin{array} { r } { \epsilon _ { m } = \operatorname* { m a x } _ { t } \mathbb { E } _ { s \sim d _ { t } ^ { \pi _ { b } } } D _ { T V } ( \bar { p ( } s _ { t + 1 } | s _ { t } , a _ { t } ) | | p _ { \phi } ( s _ { t + 1 } | s _ { t } , a _ { t } ) ) } \end{array}$ , where $D _ { T V }$ represents the total variation distance between true dynamics $p$ and learned model $p _ { \phi }$ . We also denote the distribution shift on the target policy as $\begin{array} { r } { \operatorname* { m a x } _ { s } D _ { T V } ( \pi _ { b } | | \pi ) \le \epsilon _ { \pi } } \end{array}$ . A bound relating the true returns $\eta [ \pi ]$ and the model returns $\hat { \eta } [ \pi ]$ on the target policy is given in Janner et al. (2019) as,
287
+
288
+ $$
289
+ \eta [ \pi ] \ge \hat { \eta } [ \pi ] - \left[ \frac { 2 \gamma r _ { m a x } ( \epsilon _ { m } + 2 \epsilon _ { \pi } ) } { ( 1 - \gamma ) ^ { 2 } } + \frac { 4 r _ { m a x } \epsilon _ { \pi } } { ( 1 - \gamma ) } \right] .
290
+ $$
291
+
292
+ This bound guarantees the improvement under the true returns as long as the improvement under the model returns increases by more than the slack in the bound due to $\epsilon _ { m } , \epsilon _ { \pi }$ (Janner et al., 2019; Levine et al., 2020).
293
+
294
+ We may relate this bound to the specific learning employed by BREMEN, which includes dynamics model learning, behavior cloning policy initialization, and conservative KL-based trust-region policy updates. To do so, we consider an idealized version of BREMEN, where the expectations over states in equations Equation 1, 3, 4 are replaced with supremums and the dynamics model is set to have unit variance.
295
+
296
+ Proposition 1 (Policy and model error bound). Suppose we apply the idealized BREMEN on a dataset $\mathcal { D }$ , and define $\epsilon _ { \beta } , \epsilon _ { \phi }$ in terms of the behavior cloning and dynamics model losses as,
297
+
298
+ $$
299
+ \begin{array} { r l } & { \epsilon _ { \beta } : = \underset { s } { \operatorname* { s u p } } \mathbb { E } _ { a \sim \mathcal { D } ( - | s ) } [ \| a - \hat { \pi } _ { \beta } \left( s \right) \| _ { 2 } ^ { 2 } / 2 ] - \mathcal { H } ( \pi _ { b } ( - | s ) ) } \\ & { \epsilon _ { \phi } : = \underset { s , a } { \operatorname* { s u p } } \mathbb { E } _ { s ^ { \prime } \sim \mathcal { D } ( - | s , a ) } \left[ \| s ^ { \prime } - \hat { f } _ { \phi } ( s , a ) \| _ { 2 } ^ { 2 } / 2 \right] - \mathcal { H } ( p ( - | s , a ) ) , } \end{array}
300
+ $$
301
+
302
+ where $\mathcal { H }$ denotes the Shannon entropy. If one then applies $T$ KL-based trust-region steps of step size $\delta$ (Equation 4) using stochastic dynamics models with mean $\hat { f } _ { \phi }$ and standard deviation $^ { l }$ , then
303
+
304
+ $$
305
+ \epsilon _ { \pi } = \sqrt { \frac { 1 } { 2 } \epsilon _ { \beta } + \frac { d _ { a } } { 4 } \log 2 \pi } + T \sqrt { \frac { 1 } { 2 } \delta } ; \epsilon _ { m } \leq \sqrt { \frac { 1 } { 2 } \epsilon _ { \phi } + \frac { d _ { s } } { 4 } \log 2 \pi } ,
306
+ $$
307
+
308
+ where $d _ { a }$ and $d _ { s }$ denotes the dimension of action and state space.
309
+
310
+ Proof. We first consider $\epsilon _ { \pi }$ . The behavior cloning objective in its supremum form is,
311
+
312
+ $$
313
+ \begin{array} { r c l } { { \epsilon _ { \beta } } } & { { = } } & { { \displaystyle \operatorname* { s u p } _ { s \in \mathcal { D } } \mathbb { E } _ { a \sim \mathcal { D } ( - | s ) } [ \| a - \hat { \pi } _ { \beta } \left( s \right) \| _ { 2 } ^ { 2 } / 2 ] - \mathcal { H } ( \pi _ { b } ( - | s ) ) } } \\ { { } } & { { } } & { { \displaystyle = } } & { { \displaystyle \operatorname* { s u p } _ { s \in \mathcal { D } } \mathbb { E } _ { a \sim \mathcal { D } ( - | s ) } \left[ - \log \pi _ { \theta _ { 0 } } ( a | s ) \right] - \mathcal { H } ( \pi _ { b } ( - | s ) ) - \frac { d _ { a } } { 2 } \log 2 \pi } } \\ { { } } & { { } } & { { \displaystyle = } } & { { \displaystyle \operatorname* { s u p } _ { s \in \mathcal { D } } D _ { K L } ( \pi _ { b } ( - | s ) | | \pi _ { \theta _ { 0 } } ( - | s ) ) - \frac { d _ { a } } { 2 } \log 2 \pi . } } \end{array}
314
+ $$
315
+
316
+ We apply Pinsker’s inequality to the true and estimated behavior policy to yield
317
+
318
+ $$
319
+ \operatorname* { s u p } _ { s } D _ { T V } ( \pi _ { b } ( - | s ) | | \pi _ { \theta _ { 0 } } ( - | s ) ) \leq { \sqrt { { \frac { 1 } { 2 } } \epsilon _ { \beta } + { \frac { d _ { a } } { 4 } } \log 2 \pi } } .
320
+ $$
321
+
322
+ By the same Pinsker’s inequality, we have,
323
+
324
+ $$
325
+ \operatorname* { s u p } _ { s } D _ { T V } \big ( \pi _ { \theta _ { k } } ( - | s ) | | \pi _ { \theta _ { k + 1 } } ( - | s ) \big ) \leq \sqrt { \delta / 2 } .
326
+ $$
327
+
328
+ Therefore, by triangle inequality, we have
329
+
330
+ $$
331
+ \operatorname* { s u p } _ { s } D _ { T V } ( \pi _ { b } ( - | s ) | | \pi _ { \theta _ { T } } ( - | s ) ) \leq \sqrt { \frac { 1 } { 2 } \epsilon _ { \beta } + \frac { d _ { a } } { 4 } \log { 2 \pi } } + T \sqrt { \frac { 1 } { 2 } \delta } = \epsilon _ { \pi } ,
332
+ $$
333
+
334
+ as desired.
335
+
336
+ We perform similarly for $\epsilon _ { m }$ . The model dynamics loss is
337
+
338
+ $$
339
+ \begin{array} { r c l } { { \epsilon _ { \phi } } } & { { = } } & { { \displaystyle \operatorname* { s u p } _ { s , a } \mathbb { E } _ { s ^ { \prime } \sim \mathcal { D } ( - | s , a ) } \left[ \| s ^ { \prime } - \hat { f } _ { \phi } ( s , a ) \| _ { 2 } ^ { 2 } / 2 \right] - \mathcal { H } ( p ( - | s , a ) ) } } \\ { { } } & { { } } & { { } } \\ { { \displaystyle = } } & { { \displaystyle \operatorname* { s u p } _ { s , a } \mathbb { E } _ { s ^ { \prime } \sim \mathcal { D } ( - | s , a ) } \left[ - \log p _ { \phi } ( s ^ { \prime } | s , a ) \right] - \mathcal { H } ( p ( - | s , a ) ) - \frac { d _ { s } } { 2 } \log 2 \pi } } \\ { { } } & { { } } & { { } } \\ { { \displaystyle = } } & { { \displaystyle \operatorname* { s u p } _ { s , a } D _ { K L } ( p ( - | s , a ) | | p _ { \phi } ( - | s , a ) ) - \frac { d _ { s } } { 2 } \log 2 \pi . } } \end{array}
340
+ $$
341
+
342
+ We apply Pinsker’s inequality to the true dynamics and learned model to yield
343
+
344
+ $$
345
+ \epsilon _ { m } \leq \operatorname* { s u p } _ { s , a } D _ { T V } ( p ( - | s , a ) | | p _ { \phi } ( - | s , a ) ) \leq \sqrt { \frac { 1 } { 2 } \epsilon _ { \phi } + \frac { d _ { s } } { 4 } \log 2 \pi } ,
346
+ $$
347
+
348
+ as desired.
349
+
350
+ # B TRADE-OFF BETWEEN SAMPLE AND DEPLOYMENT EFFICIENCY
351
+
352
+ An important aspect of deployment efficiency is the trade-off between sample and deployment efficiency. To collect multiple data points per experiment and show this trade-off, we run recursive BREMEN with different batch sizes, and record how many samples are required to cross different reward thresholds.
353
+
354
+ HalfCheetah (Reward 7,000 result) and other results from Figure 5 generally show that high deployment efficiency lowers sample efficiency, confirming the inherent trade-off. However, in rare cases, e.g. Ant (Reward 5,000 result), it could be possible to achieve both high deployment efficiency and high sample efficiency through the right choice of the batch size hyper-parameter.
355
+
356
+ ![](images/e4a79595f8df889828b941ec6d05aca10bd9f4d0a7a9a704b384c7c841649438.jpg)
357
+ Figure 5: From the view of both sample and deployment efficiency at certain cumulative reward threshold, we evaluate BREMEN in Ant (left) and HalfCheetah (right). x and y axes respectively represent the number of samples and the number of deployments.Each data point comes from running BREMEN with different reward thresholds and batch sizes. The numbers above the points (e.g. 1000, 2000, ...) represent the reward threshold. The results (especially, reward 7,000 threshold in HalfCheetah) generally show that high deployment efficiency lowers sample efficiency, confirming the inherent trade-off.
358
+
359
+ # C DISCUSSION: IMPORTANCE OF DEPLOYMENT EFFICIENCY IN REAL-WORLD APPLICATIONS
360
+
361
+ Our notion of deployment-efficiency is necessitated by cost and safety constraints typical in many real world scenarios. Namely, a common approach to real-world applications (Cabi et al., 2020; DulacArnold et al., 2019; Kalashnikov et al., 2018) is the following iterative training and data-collection paradigm:
362
+
363
+ 1. Aggregate past previous dataset from worker(s)
364
+ 2. Update policy based on the collected data
365
+ 3. Deploy the policy to the worker(s)
366
+ 4. Monitor the policy works as expected e.g. checking if it does not violate safety criterion
367
+ (this safety verification step may alternatively happen before step 3)
368
+ 5. Let the worker(s) collect experiences with the latest policy.
369
+
370
+ It is easy to see that the number of deployments is a critical bottleneck, as it involves both monitoring of the policy (Step 4) and communication to the workers (Step 3), and both of these steps can incur significant cost. Specifically, Step 4 requires evaluating the policy for safety, and often requires human monitors (Atkeson et al., 2015). As for Step 3, communication to workers can also be a bottleneck, especially in highly-parallelized distributed RL systems (Nair et al., 2015; Espeholt et al., 2018; 2019). Every policy deployment requires a potentially expensive communication between different machines/processes, and this can be a bottleneck on the whole system.
371
+
372
+ As a concrete example of the necessity of good deployment efficiency, consider optimization of personalization in web apps or recommender systems (Abel et al., 2017). Once a policy is learned on a batch of past experiences, it is deployed to a collection of web-hosting servers. In this scenario, both safety and communication concerns are relevant: Safety of the new policy is typically ensured by initially deploying the policy to a small percentage of users; after monitoring the results for some length of time (e.g. the newly deployed policy does not deteriorate user experiences), one can expand the target user set. As for communication, deploying a new policy to web-hosting servers can be time intensive, especially in large-scale web applications where the policy must be deployed to a network of servers around the world. Thus, in this setting, it is clear that online updating of the policy is infeasible due to both safety and communication constraints. Accordingly, the deployment-efficiency of any candidate RL algorithm is of tantamount importance.
373
+
374
+ The safe exploration might be mentioned as a potential alternative to deployment-efficiency. While safe exploration can arguably tackle the first concern above (safety risks of the policy), it does nothing to mitigate the latter (the engineering or communication costs associated with online deployment of a policy). Furthermore, this still ignores the fact that in many scenarios the ability to do safe exploration is not a given. While some safe RL algorithms can provide guarantees in tabular cases, these guarantees no longer hold when using function approximation with neural networks (Chow et al., 2018). In these cases, it can be much more difficult to perform “safe exploration” than it is to develop a deployment-efficient algorithm.
375
+
376
+ # D EVALUATING OFFLINE PERFORMANCES ON D4RL DATASETS
377
+
378
+ We compare BREMEN to MOPO (Yu et al., 2020), concurrently proposed model-based offline methods penalized by model epistemic uncertainty, and state-of-the-art model-free offline algorithms, namely, CQL (Kumar et al., 2020), BEAR (Kumar et al., 2019), BRAC (Wu et al., 2019), AWR (Peng et al., 2019) and BCQ (Fujimoto et al., 2019), on the D4RL MuJoCo locomotion datasets (Fu et al., 2020), used as standard offline RL benchmarks (Kumar et al., 2020; Nair et al., 2020). They have several types of offline data collected with different strategies. We choose the hyper parameters of BREMEN in Section 5.1 and F.2.2. Table 2 shows BREMEN beats recent state-of-the-art algorithms with the highest normalized score (around 100 corresponds to an expert) in several tasks, while none of the methods consistently achieves the best performance. This result suggests that the implicit regularization with the model-based method performs surprisingly well in offline settings despite of its simplicity.
379
+
380
+ <table><tr><td rowspan=1 colspan=1>Task Name</td><td rowspan=1 colspan=1>BC</td><td rowspan=1 colspan=1>BREMEN</td><td rowspan=1 colspan=1>MOPO</td><td rowspan=1 colspan=1>CQL</td><td rowspan=1 colspan=1>BEAR</td><td rowspan=1 colspan=1>BRAC-v</td><td rowspan=1 colspan=1>AWR</td><td rowspan=1 colspan=1>BCQ</td></tr><tr><td rowspan=2 colspan=1>halfcheetah-randomwalker2d-randomhopper-random</td><td rowspan=2 colspan=1>2.11.69.8</td><td rowspan=2 colspan=1>36.93.712.2</td><td rowspan=2 colspan=1>31.913.013.3</td><td rowspan=1 colspan=1>35.47.0</td><td rowspan=2 colspan=1>25.17.311.4</td><td rowspan=2 colspan=1>31.21.912.2</td><td rowspan=2 colspan=1>2.51.510.2</td><td rowspan=2 colspan=1>2.24.910.6</td></tr><tr><td rowspan=1 colspan=1>10.8</td></tr><tr><td rowspan=1 colspan=1>halfcheetah-mediumwalker2d-mediumhopper-medium</td><td rowspan=1 colspan=1>36.16.629.0</td><td rowspan=1 colspan=1>55.059.669.3</td><td rowspan=1 colspan=1>40.214.026.5</td><td rowspan=1 colspan=1>44.479.258.0</td><td rowspan=1 colspan=1>41.759.152.1</td><td rowspan=1 colspan=1>46.381.131.1</td><td rowspan=1 colspan=1>37.417.435.9</td><td rowspan=1 colspan=1>40.753.154.5</td></tr><tr><td rowspan=2 colspan=1>halfcheetah-medium-replaywalker2d-medium-replayhopper-medium-replay</td><td rowspan=2 colspan=1>38.411.311.8</td><td rowspan=2 colspan=1>47.27.624.1</td><td rowspan=2 colspan=1>54.042.792.5</td><td rowspan=1 colspan=1>46.2</td><td rowspan=2 colspan=1>38.619.233.7</td><td rowspan=2 colspan=1>47.70.90.6</td><td rowspan=2 colspan=1>40.315.528.4</td><td rowspan=1 colspan=1>38.2</td></tr><tr><td rowspan=1 colspan=1>26.748.6</td><td rowspan=1 colspan=1>15.033.1</td></tr><tr><td rowspan=1 colspan=1>halfcheetah-medium-expertwalker2d-medium-experthopper-medium-expert</td><td rowspan=1 colspan=1>35.86.4111.9</td><td rowspan=1 colspan=1>53.355.264.6</td><td rowspan=1 colspan=1>57.955.051.7</td><td rowspan=1 colspan=1>62.498.7111.0</td><td rowspan=1 colspan=1>53.440.196.3</td><td rowspan=1 colspan=1>41.981.60.8</td><td rowspan=1 colspan=1>52.753.827.1</td><td rowspan=1 colspan=1>64.757.5110.9</td></tr></table>
381
+
382
+ Table 2: Evaluation on D4RL MuJoCo locomotion datasets. The normalized score of BREMEN are averaged over 4 random seeds. We refer the score of MOPO (Yu et al., 2020) and CQL (Kumar et al., 2020) from their original papers. Other results are cited from Fu et al. (2020). BREMEN achieves the best and competitive score in several domains, while none of the algorithms beats all other methods.
383
+
384
+ # E INCORPORATING PESSIMISTIC MODEL-BASED OFFLINE METHODS INTO BREMEN
385
+
386
+ The concurrent model-based offline RL methods prescribe the use of uncertainty-based penalties (Kidambi et al., 2020; Yu et al., 2020), which can be incorporated into BREMEN. We therefore augmented BREMEN with either a hard (MOReL-like, green) or soft (MOPO-like, orange) reward penalty according to model uncertainty. MOReL quantifies the uncertainty measuring the maximum discrepancy of the prediction across the ensembles of the models and receives constant negative reward (-5.0 in our experiments) if the discrepancy is larger than the threshold (we set 3.0). MOPO measures the uncertainty by the maximum standard deviation of the model ensembles and uses this as a reward penalty with a coefficient (0.1 in our experiments). Evaluations in Figure 6 reveal that the soft reward penalty has notable results in Hopper and Walker2d, where model uncertainty is more crucial due to the episode’s termination. Hard reward penalty seems overly pessimistic in deployment-efficient settings.
387
+
388
+ ![](images/b92db87a8488301afcc0d533a6528c154563a870085080d2776b335a16c289e9.jpg)
389
+ Figure 6: Comparison to the pessimistic reward shaping incorporated into BREMEN. Soft reward penalty (MOPO-like, orange) performs well in the environments where the incomplete models appear to be fatal.
390
+
391
+ # F DETAILS OF EXPERIMENTAL SETTINGS
392
+
393
+ # F.1 IMPLEMENTATION DETAILS
394
+
395
+ For our baseline methods, we use the open-source implementations of SAC, BC, BCQ, and BRAC published in Wu et al. (2019). SAC and BRAC have (300, 300) Q-Network and (200, 200) policy network. BC has (200, 200) policy network, and BCQ has (300, 300) Q-Network, (300, 300) policy network, and (750, 750) conditional VAE. As for online ME-TRPO, we utilize the codebase of model-based RL benchmark (Wang et al., 2019). BREMEN and online ME-TRPO use the policy consisting of two hidden layers with 200 units. The dynamics model also consists of two hidden layers with 1,024 units. We use Adam (Kingma & Ba, 2014) as the optimizer with the learning rate of 0.001 for the dynamics model, and 0.0005 for behavior cloning in BREMEN. Especially in BREMEN and online ME-TRPO, we adopt a linear feature value function to stabilize the training. BREMEN in deployment-efficient settings takes about two or three hours per deployment on an NVIDIA TITAN V.
396
+
397
+ To leverage neural networks as Dyna-style (Sutton, 1991) dynamics models, we modify reward and termination function so that they are not dependent on the internal physics engine for calculation, following model-based benchmark codebase (Wang et al., 2019); see Table 3. Note that the score of baselines (e.g., BCQ, BRAC) is slightly different from Wu et al. (2019) due to this modification of the reward function. We re-run each algorithm in our environments and got appropriate convergence.
398
+
399
+ The maximum length of one episode is 1,000 steps without any termination in Ant and HalfCheetah; however, termination function is enabled in Hopper and Walker2d. The batch size of transitions for policy update is 50,000 in BREMEN and ME-TRPO, following Kurutach et al. (2018). The batch size of BC and BRAC is 256, and BCQ is 100, also following Wu et al. (2019).
400
+
401
+ ![](images/22074d9a93978e2e7c0e5f01935d55d8e4c33f912df142778c7e453a465f0dca.jpg)
402
+ Figure 7: Four standard MuJoCo benchmark environments used in our experiments.
403
+
404
+ <table><tr><td>Environment</td><td>Rewardfunction</td><td>Terminationinrollouts</td></tr><tr><td>Ant</td><td>xt -0.1||atl²2-3.0 × (zt -0.57)² +1</td><td>False</td></tr><tr><td>HalfCheetah</td><td>xt -0.1||atll2</td><td>False</td></tr><tr><td>Hopper</td><td>xt - 0.001||atl2²+1</td><td>True</td></tr><tr><td>Walker2d</td><td>xt-0.001||atl2+1</td><td>True</td></tr></table>
405
+
406
+ Table 3: Reward function and termination in rollouts in the experiments. We remove all contact information from observation of Ant, basically following Wang et al. (2019).
407
+
408
+ # F.2 HYPER PARAMETERS
409
+
410
+ In this section, we describe the hyper-parameters in both deployment-efficient RL (Section F.2.1) and offline RL (Section F.2.2) settings. We run all of our experiments with five random seed, and the results are averaged.
411
+
412
+ # F.2.1 DEPLOYMENT-EFFICIENT RL
413
+
414
+ Table 4 shows the hyper-parameters of BREMEN. The rollout length is searched from {250, 500, $1 0 0 0 \}$ , and max step size $\delta$ is searched from {0.001, 0.01, 0.05, 0.1, 1.0}. As for the discount factor $\gamma$ and GAE $\lambda$ , we follow Wang et al. (2019).
415
+
416
+ <table><tr><td>Parameter</td><td>Ant</td><td>HalfCheetah</td><td>Hopper</td><td>Walker2d</td></tr><tr><td>Iteration per batch</td><td>2,000</td><td>2,000</td><td>6.000</td><td>2,000</td></tr><tr><td>Deployment</td><td>5</td><td>5</td><td>10</td><td>10</td></tr><tr><td>Total iteration</td><td>10.000</td><td>10.000</td><td>60.000</td><td>20.000</td></tr><tr><td>Rollouts length</td><td>250</td><td>250</td><td>1,000</td><td>1,000</td></tr><tr><td>Max step size δ</td><td>0.05</td><td>0.1</td><td>0.05</td><td>0.05</td></tr><tr><td>Discount factor y</td><td>0.99</td><td>0.99</td><td>0.99</td><td>0.99</td></tr><tr><td>GAE入</td><td>0.97</td><td>0.95</td><td>0.95</td><td>0.95</td></tr><tr><td>Stationary noise o</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td></tr></table>
417
+
418
+ Table 4: Hyper-parameters of BREMEN in deployment-efficient settings.
419
+
420
+ Number of Iterations for Policy Optimization To achieve high deployment efficiency, the number of iterations for policy optimization between deployments is one of the important hyper-parameters for fast convergence. In the existing methods (BCQ, BRAC, SAC), we search over three values: {10,000, 50,000, 100,000}, and choose 10,000 in BCQ and BRAC, and 100,000 in SAC (Figure 8). For BREMEN, we also search over three values: {2,000, 4,000, 6,000}. Figure 9 shows the results of iteration search, and we choose 2,000 in Ant, HalfCheetah, and Walker2d, and 6,000 in Hopper.
421
+
422
+ ![](images/e336bd4ed3f1cc2665e6fc99ab776b4c797ca110856fae70c3856d98bed9c733.jpg)
423
+ Figure 8: Search on the number of iterations for SAC policy optimization between deployments. The number of transitions per one data-collection is $2 0 0 \mathrm { K }$ .
424
+
425
+ ![](images/e3aa31a1dfb8de492f2a7d1dd0ba0b09d7546b19b72131e2fcba0161b0bbc2a1.jpg)
426
+ Figure 9: Search on the number of iterations for BREMEN policy optimization between deployments. The number of transitions per one data-collection is 200K.
427
+
428
+ Stationary Noise in BREMEN To achieve effective exploration, the stochastic Gaussian policy is a good choice. We found that adding stationary Gaussian noise to the policy in the imaginary trajectories and data collection led to the notable improvement. Stationary Gaussian policy is written as,
429
+
430
+ $$
431
+ a _ { t } = \operatorname { t a n h } ( \mu _ { \theta } ( s _ { t } ) ) + \epsilon , \qquad \epsilon \sim \mathcal { N } ( 0 , \sigma ^ { 2 } ) .
432
+ $$
433
+
434
+ Another choice is a learned Gaussian policy, which parameterizes not only $\mu _ { \theta }$ but also $\sigma _ { \theta }$ . Learned gaussian policy is also written as,
435
+
436
+ $$
437
+ a _ { t } = \operatorname { t a n h } ( \mu _ { \theta } ( s _ { t } ) ) + \sigma _ { \theta } ( s _ { t } ) \odot \epsilon , \qquad \epsilon \sim \mathcal { N } ( 0 , \sigma ^ { 2 } ) .
438
+ $$
439
+
440
+ We utilize the zero-mean Gaussian ${ \mathcal { N } } ( 0 , \sigma ^ { 2 } )$ , and tune up $\sigma$ in Figure 10 with HalfCheetah, comparing stationary and learned strategies. From this experiment, we found that the stationary noise, the scale of 0.1, consistently performs well, and therefore we used it for all our experiments.
441
+
442
+ ![](images/e7fbb1985511ad7e639f10932800c9a46a2e1ab41d3aa44609db46b5b84b8f7d.jpg)
443
+ Figure 10: Search on the Gaussian noise parameter $\sigma$ in HalfCheetah. The number of transitions per one data-collection is 200K.
444
+
445
+ Other Hyper-parameters in the Existing Methods As for online ME-TRPO, we collect 3,000 steps through online interaction with the environment per 25 iterations and split these transitions into a 2-to-1 ratio of training and validation dataset for learning dynamics models. In batch size 100,000 settings, we collect 2,000 steps and split with 1-to-1 ratio. Totally, we iterate 12,500 times policy optimization, which is equivalent to 500 deployments of the policy. Note that we carefully tune up the hyper-parameters of online ME-TRPO, and the performance is improved from Wang et al. (2019).
446
+
447
+ Table 5 and Table 6 shows the tunable hyper-parameters of BCQ and BRAC, respectively. We refer Wu et al. (2019) to choose these values. In this work, BRAC applies a primal form of KL value penalty, and BRAC (max Q) means sampling multiple actions and taking the maximum according to the learned Q function.
448
+
449
+ Table 5: Hyper-parameters of BCQ.
450
+
451
+ <table><tr><td>Parameter</td><td>Ant</td><td>HalfCheetah</td><td>Hopper</td><td>Walker2d</td></tr><tr><td>Policy learning rate</td><td>3e-05</td><td>3e-04</td><td>3e-06</td><td>3e-05</td></tr><tr><td>Perturbation range Φ</td><td>0.15</td><td>0.5</td><td>0.15</td><td>0.15</td></tr></table>
452
+
453
+ Table 6: Hyper-parameters of BRAC.
454
+
455
+ <table><tr><td>Parameter</td><td>Ant</td><td>HalfCheetah</td><td>Hopper</td><td>Walker2d</td></tr><tr><td>Policy learning rate</td><td>1e-4</td><td>1e-3</td><td>3e-5</td><td>1e-5</td></tr><tr><td>Divergence penalty α</td><td>0.3</td><td>0.1</td><td>0.3</td><td>0.3</td></tr></table>
456
+
457
+ # F.2.2 OFFLINE RL
458
+
459
+ In the offline experiments, we apply the same hyper-parameters as in the deployment-efficient settings described above, except for the iteration per batch. Algorithm 2 is pseudocode for BREMEN in offline RL settings where policies are updated only with one fixed batch dataset. The number of iteration $T$ is set to 6,250 in BREMEN, and 500,000 in BC, BCQ, and BRAC.
460
+
461
+ The datasets for $5 0 \mathrm { k }$ or $1 0 0 \mathrm { k }$ experiments are sliced from the beginning of the 1M batched datasets without shuffling, but we observed that the distribution of rewards in 50k or $1 0 0 \mathrm { k }$ is not different from 1M.
462
+
463
+ # Algorithm 2 BREMEN for Offline RL
464
+
465
+ Input: Offline dataset $\mathcal { D } = \{ s _ { t } , a _ { t } , r _ { t } , s _ { t + 1 } \}$ , Initial parameters $\phi = \{ \phi _ { 1 } , \cdot \cdot \cdot , \phi _ { K } \}$ , $\beta$ , Number of policy optimization $T$ .
466
+ 1: Train $K$ dynamics models $\hat { f } _ { \phi }$ using $\mathcal { D }$ via Equation 1.
467
+ 2: Train estimated behavior policy $\hat { \pi } _ { \beta }$ using $\mathcal { D }$ by behavior cloning via Equation 3.
468
+ 3: Initialize target policy $\pi _ { \theta _ { 0 } } = \mathrm { N o r m a l } ( \hat { \pi } _ { \beta } , 1 )$ .
469
+ 4: for policy optimization $k = 1 , \cdots , T$ do
470
+ 5: Generate imaginary rollout.
471
+ 6: Optimize target policy $\pi \theta$ satisfying Equation 4 with the rollout.
472
+
473
+ # G ADDITIONAL EXPERIMENTAL RESULTS
474
+
475
+ G.1 PERFORMANCE ON THE DATASET WITH DIFFERENT NOISE
476
+
477
+ Following Wu et al. (2019) and Kidambi et al. (2020), we additionally compare BREMEN in offline settings to the other baselines (BC, BCQ, BRAC) with five datasets of different exploration noise. Each dataset has also one million transitions.
478
+
479
+ • eps1: $40 \%$ of the dataset is collected by data-collection policy (partially trained SAC policy) $\pi _ { b }$ , $40 \%$ of the dataset is collected by epsilon greedy policy with $\epsilon = 0 . 1$ to take a random action, and $20 \%$ of dataset is collected by an uniformly random policy.
480
+ • eps3: Same as eps1, $40 \%$ of the dataset is collected by $\pi _ { b }$ , $40 \%$ is collected by epsilon greedy policy with $\epsilon = 0 . 3$ , and $20 \%$ is collected by an uniformly random policy. gaussian1: $40 \%$ of the dataset is collected by data-collection policy $\pi _ { b }$ , $40 \%$ is collected by the policy with adding zero-mean Gaussian noise $\mathcal { N } ( 0 , 0 . \bar { 1 } ^ { 2 } )$ to each action sampled from $\pi _ { b }$ , and $20 \%$ is collected by an uniformly random policy.
481
+ • gaussian3: $40 \%$ of the dataset is collected by data-collection policy $\pi _ { b }$ , $40 \%$ is collected by the policy with zero-mean Gaussian noise $\bar { \mathcal { N } ( 0 , 0 . 3 ^ { 2 } ) }$ , and $20 \%$ is collected by an uniformly random policy.
482
+ • random: All of the dataset is collected by an uniformly random policy.
483
+
484
+ Table 7 shows that BREMEN can also achieve performance competitive with state-of-the-art modelfree offline RL algorithm even with noisy datasets. The training curves of each experiment are shown in Appendix G.4.
485
+
486
+ # G.2 COMPARISON AMONG DIFFERENT NUMBER OF ENSEMBLES
487
+
488
+ To deal with the distribution shift during policy optimization, also known as model bias, we introduce the dynamics model ensembles. We validate the performance of BREMEN with a different number of dynamics models $K$ . Figure 11 and Figure 12 show the performance of BREMEN with the different number of ensembles in deployment-efficient and offline settings. Ensembles with more dynamics models resulted in better performance due to the mitigation of distributional shift except for $K = 1 0$ , and then we choose $K = 5$ .
489
+
490
+ ![](images/6a0b7f3bfe2cb62d53bb5b1256c8a3eb377aa3e705d405e2f33cc4f47577999d.jpg)
491
+ Figure 11: Comparison of the number of dynamics models in deployment-efficient settings.
492
+
493
+ ![](images/4755817929bd8db982519e32692cfd6b1d33c3aabe852221237d9bf32a39226b.jpg)
494
+ Figure 12: Comparison of the number of dynamics models in offline settings.
495
+
496
+ <table><tr><td colspan="5">Noise: eps1,1,000,000 (1M) transitions</td></tr><tr><td>Method</td><td>Ant</td><td>HalfCheetah</td><td>Hopper</td><td>Walker2d</td></tr><tr><td>Dataset</td><td>1077</td><td>2936</td><td>791</td><td>815</td></tr><tr><td>BC</td><td>1381±71</td><td>3788±740</td><td>266±486</td><td>1185±155</td></tr><tr><td>BCQ</td><td>1937±116</td><td>6046±276</td><td>800±659</td><td>479±537</td></tr><tr><td>BRAC</td><td>2693±155</td><td>7003±118</td><td>1243±162</td><td>3204±103</td></tr><tr><td>BRAC (max Q)</td><td>2907±98</td><td>7070±81</td><td>1488±386</td><td>3330±147</td></tr><tr><td>BREMEN (Ours)</td><td>3519±129</td><td>7585±425</td><td>2818±76</td><td>1710±429</td></tr><tr><td>ME-TRPO (offline)</td><td>1514±503</td><td>1009±731</td><td>1301±654</td><td>128±153</td></tr></table>
497
+
498
+ Noise: eps3, 1,000,000 (1M) transitions
499
+
500
+ <table><tr><td>Method</td><td>Ant</td><td>HalfCheetah</td><td>Hopper</td><td>Walker2d</td></tr><tr><td>Dataset BC BCQ BRAC</td><td>936 1364±121 1938±21 2718±90 2913±87</td><td>2408 2877±797 5739±188 6434±147</td><td>662 519±532 1170±446 1224±71</td><td>648 1066±176 1018±1231 2921±101</td></tr></table>
501
+
502
+ Noise: gaussian1, 1,000,000 (1M) transitions
503
+
504
+ <table><tr><td>Method</td><td>Ant</td><td>HalfCheetah</td><td>Hopper</td><td>Walker2d</td></tr><tr><td>Dataset</td><td>1072</td><td>3150</td><td>882</td><td>1070</td></tr><tr><td>BC</td><td>1279±80</td><td>4142±189</td><td>31±16</td><td>1137±477</td></tr><tr><td>BCQ</td><td>1958±76</td><td>5854±498</td><td>475±416</td><td>608±416</td></tr><tr><td>BRAC</td><td>2905±81</td><td>7026±168</td><td>1456±161</td><td>3030±103</td></tr><tr><td>BRAC (max Q)</td><td>2910±157</td><td>7026±168</td><td>1575±89</td><td>3242±97</td></tr><tr><td>BREMEN (Ours)</td><td>2912±165</td><td>7928±313</td><td>1999±617</td><td>1402±290</td></tr><tr><td>ME-TRPO (offline)</td><td>1275±656</td><td>1275±656</td><td>909±631</td><td>171±119</td></tr></table>
505
+
506
+ <table><tr><td colspan="5">Noise:gaussian3,1,0oo,0oo (1M) transitions</td></tr><tr><td>Method</td><td>Ant</td><td>HalfCheetah</td><td>Hopper</td><td>Walker2d</td></tr><tr><td>Dataset</td><td>1058</td><td>2872</td><td>781</td><td>981</td></tr><tr><td>BC</td><td>1300±34</td><td>4190±69</td><td>611±467</td><td>1217±361</td></tr><tr><td>BCQ</td><td>1982±97</td><td>5781±543</td><td>1137±582</td><td>258±286</td></tr><tr><td>BRAC</td><td>3084±180</td><td>3933±2740</td><td>1432±499</td><td>3253±118</td></tr><tr><td>BRAC (max Q)</td><td>2916±99</td><td>3997±2761</td><td>1417±267</td><td>3372±153</td></tr><tr><td>BREMEN (Ours)</td><td>3432±185</td><td>8124±145</td><td>1867±354</td><td>2299±474</td></tr><tr><td>ME-TRPO (offline)</td><td>1237±310</td><td>2141±872</td><td>973±243</td><td>219±145</td></tr></table>
507
+
508
+ Noise: random, 1,000,000 (1M) transitions
509
+
510
+ <table><tr><td>Method</td><td>Ant</td><td>HalfCheetah</td><td>Hopper</td><td>Walker2d</td></tr><tr><td>Dataset</td><td>470</td><td>-285</td><td>34</td><td>2</td></tr><tr><td>BC</td><td>989±10</td><td>-2±1</td><td>106±62</td><td>108±110</td></tr><tr><td>BCQ</td><td>1222±114</td><td>2887±242</td><td>206±7</td><td>228±12</td></tr><tr><td>BRAC</td><td>1057±92</td><td>3449±259</td><td>227±30</td><td>29±54</td></tr><tr><td>BRAC (max Q)</td><td>683±57</td><td>3418±171</td><td>224±37</td><td>26±50</td></tr><tr><td>BREMEN (Ours)</td><td>905±11</td><td>3627±193</td><td>270±68</td><td>254±6</td></tr><tr><td>ME-TRPO (offline)</td><td>2221±665</td><td>2701±120</td><td>321±29</td><td>262±13</td></tr></table>
511
+
512
+ Table 7: Comparison of BREMEN to the existing offline methods in offline settings, namely, BC, BCQ (Fujimoto et al., 2019), and BRAC (Wu et al., 2019). Each cell shows the average cumulative reward and their standard deviation with 5 seeds. The maximum steps per episode is 1,000. Five different types of exploration noise are introduced during the data collection, eps1, eps3, gaussian1, gaussian3, and random. BRAC applies a primal form of KL value penalty, and BRAC (max Q) means sampling multiple actions and taking the maximum according to the learned Q function.
513
+
514
+ # G.3 IMPLICIT KL CONTROL IN OFFLINE SETTINGS
515
+
516
+ Similar to Section 5.3, we present offline RL experiments to better understand the effect of implicit KL regularization. In contrast to the implicit KL regularization with Equation 4, the optimization of BREMEN with explicit KL value penalty becomes
517
+
518
+ $$
519
+ \begin{array} { r l } & { \theta _ { k + 1 } = \underset { \theta } { \arg \operatorname* { m a x } } \ \underset { s , a \sim \pi _ { \theta _ { k } } , \hat { f } _ { \phi _ { i } } } { \mathrm { E } } [ \frac { \pi _ { \theta } ( a | s ) } { \pi _ { \theta _ { k } } ( a | s ) } ( A ^ { \pi _ { \theta _ { k } } } ( s , a ) - \alpha D _ { \mathrm { K L } } ( \pi _ { \theta } ( \cdot | s ) | ) \hat { \pi } _ { \beta } ( \cdot | s ) ) ) ] } \\ & { \quad \mathrm { s . t . } \quad \underset { s \sim \pi _ { \theta _ { k } } } { \mathrm { E } } [ D _ { \mathrm { K L } } ( \pi _ { \theta } ( \cdot | s ) | | \pi _ { \theta _ { k } } ( \cdot | s ) ) ] \leq \delta , } \end{array}
520
+ $$
521
+
522
+ where $A ^ { \pi _ { \theta _ { k } } } ( s , a )$ is the advantage of $\pi _ { \theta _ { k } }$ computed using imaginary rollouts with the learned dynamics model and $\delta$ is the maximum step size. Note that BREMEN with explicit KL penalty does not utilize behavior cloning initialization.
523
+
524
+ We empirically conclude that the explicit constraint $- \alpha D _ { \mathrm { K L } } \big ( \pi _ { \boldsymbol { \theta } } \big ( \cdot | \boldsymbol { s } \big ) \big | \big | \hat { \pi } _ { \boldsymbol { \beta } } \big ( \cdot | \boldsymbol { s } \big ) \big )$ is unnecessary and just TRPO update with behavior-initialization as implicit regularization is sufficient in BREMEN algorithm. Figure 13 shows the KL divergence between learned policies and the last deployed policies (top row) and model errors measured by a mean squared error of predicted next state from the true state (second row). We find that behavior initialized policy with conservative KL trust-region updates well stuck to the last deployed policy during improvement without explicit KL penalty. The policy initialized with behavior cloning also tended to suppress the increase of model error, which implies that behavior initialization alleviates the effect of the distribution shift. In Walker2d, the model error of BREMEN is relatively large, which may relate to the poor performance with noisy datasets in Section G.1.
525
+
526
+ ![](images/380b79685657ca35961a182d8249d87b52383e893929db691d571c0225df1788.jpg)
527
+ Figure 13: Average cumulative rewards (top row) and corresponding KL divergence of learned policies from the last deployed policy (second row) and model errors (bottom row) in offline settings with 1M dataset (no noise). Behavior initialized policy (purple line) tends to suppress the policy and model error during training better than no-initialization (red line) or explicit KL penalty (green line).
528
+
529
+ # G.4 TRAINING CURVES FOR OFFLINE RL WITH DIFFERENT NOISES
530
+
531
+ In this section, we present training curves of our all experiments in offline settings. Figure 14 shows the results in Section 5.1. Figure 15, 16, 17, 18, and 19 also show the results in Section G.1.
532
+
533
+ ![](images/c5d8d3e93857b4772c71f9250ddb7e71a41d48a084aa8ff5d13896dcd60f0009.jpg)
534
+ Figure 14: Performance in Offline RL experiments (Table 1). (top row) dataset size is 1M, (second row) 100K, and (bottom row) 50K, respectively. Note that $\mathbf { X }$ -axis is the number of iterations with policy optimization in a log-scale.
535
+
536
+ ![](images/d9bc704351f20f3bf3fe30910804c40f1535b0cbc6b7b20c34aaf8f4523b2285.jpg)
537
+ Figure 15: Performance in Offline RL experiments with $\epsilon$ -greedy dataset noise $\epsilon = 0 . 1$ . Dataset size is 1M.
538
+
539
+ ![](images/f7f775ecb6dd3a924b4eb9058d7436ed3071014842ad90e854f68d8851a101b6.jpg)
540
+ Figure 16: Performance in Offline RL experiments with $\epsilon$ -greedy dataset noise $\epsilon = 0 . 3$ . Dataset size is 1M.
541
+
542
+ ![](images/130499bcf5e465aeeb59cee68e4a26cc2b0724c07bdd0d5ddaf94eaa44e62ee8.jpg)
543
+ Figure 17: Performance in Offline RL experiments with gaussian dataset noise $\mathcal { N } ( 0 , 0 . 1 ^ { 2 } )$ . Dataset size is 1M.
544
+
545
+ ![](images/b5e14c327508062c360ef17f8d7d6f8358413758c78deda33a2faba939bb6d82.jpg)
546
+ Figure 18: Performance in Offline RL experiments with gaussian dataset noise $\mathcal { N } ( 0 , 0 . 3 ^ { 2 } )$ . Dataset size is 1M.
547
+
548
+ ![](images/e8bd3de5b194349afabaa366a65cff854f71e8cdf7495f71533961a224245881.jpg)
549
+ Figure 19: Performance in Offline RL experiments with completely random behaviors. Dataset size is 1M.
550
+
551
+ # G.5 DEPLOYMENT-EFFICIENT RL EXPERIMENT WITH DIFFERENT REWARD FUNCTION
552
+
553
+ In addition to the main results in Section 5.2 (Figure 2), we also evaluate BREMEN in deploymentefficient setting with different reward function. We modified HalfCheetah environment into the one similar to cheetah-run task in Deep Mind Control Suite.5 The reward function is defined as
554
+
555
+ $$
556
+ r _ { t } = \left\{ \begin{array} { l l } { 0 . 1 \dot { x } _ { t } } & { ( 0 \leq \dot { x } _ { t } \leq 1 0 ) } \\ { 1 } & { ( \dot { x } _ { t } > 1 0 ) , } \end{array} \right.
557
+ $$
558
+
559
+ and the termination is turned off. Figure 20 shows the performance of BREMEN and existing methods. BREMEN also shows better deployment efficiency than other existing offline methods and online ME-TRPO, except for SAC, which is the same trend as that of main results.
560
+
561
+ ![](images/dd467a13475aaa5cb2f106904be422eee8725c7d1362d2167e7a9ddb7c8b3d1c.jpg)
562
+ Figure 20: Performance in Deployment-Efficient RL experiments with different reward function of HalfCheetah.
md/train/7wCBOfJ8hJM/7wCBOfJ8hJM.md ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NEAREST NEIGHBOR MACHINE TRANSLATION
2
+
3
+ Urvashi Khandelwal†∗, Angela Fan‡, Dan Jurafsky†, Luke Zettlemoyer‡, Mike Lewis‡
4
+
5
+ †Stanford University
6
+ ‡Facebook AI Research
7
+ {urvashik,jurafsky}@stanford.edu {angelafan,lsz,mikelewis}@fb.com
8
+
9
+ # ABSTRACT
10
+
11
+ We introduce $k$ -nearest-neighbor machine translation (kNN-MT), which predicts tokens with a nearest neighbor classifier over a large datastore of cached examples, using representations from a neural translation model for similarity search. This approach requires no additional training and scales to give the decoder direct access to billions of examples at test time, resulting in a highly expressive model that consistently improves performance across many settings. Simply adding nearest neighbor search improves a state-of-the-art German-English translation model by 1.5 BLEU. kNN-MT allows a single model to be adapted to diverse domains by using a domain-specific datastore, improving results by an average of 9.2 BLEU over zero-shot transfer, and achieving new state-of-the-art results—without training on these domains. A massively multilingual model can also be specialized for particular language pairs, with improvements of 3 BLEU for translating from English into German and Chinese. Qualitatively, $k \mathrm { N N - M T }$ is easily interpretable; it combines source and target context to retrieve highly relevant examples.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Non-parametric methods have recently been successfully applied to tasks such as language modeling (Khandelwal et al., 2020) and question answering (Guu et al., 2020; Lewis et al., 2020). They allow models that are (1) expressive, because they can use an arbitrary amount of data at test time; (2) adaptable, because predictions can be controlled by changing the datastore, and (3) interpretable, because the data used to make the prediction can be directly inspected. We introduce $k \mathrm { N N - M T }$ , a simple non-parametric method for machine translation (MT) using nearest neighbor retrieval. kNNMT can be added to any pre-trained neural translation model without further training, and significantly improves performance for in-domain, out-of-domain, and multi-lingual evaluations.
16
+
17
+ More specifically, kNN-MT interpolates the target-token softmax distribution from a neural MT model with a multinomial generated using nearest neighbor search over examples cached in a data store. The cache is over translation contexts (i.e. the complete source and prefix of the target), and is indexed by hidden states computed from the base MT model. We hypothesize that contexts which are close in representation space are more likely to be followed by the same target word. We show this is not only true for the original training data, thereby improving base model performance, but across a range of different bi-text corpora, allowing for simple and effective model adaptation.
18
+
19
+ Our work builds upon recent results showing the effectiveness of nearest neighbor methods in unconditional language models (Khandelwal et al., 2020). We generalize to conditional language models, by using both source and target context, and show nearest neighbour models can be effective for generation in addition to density estimation. Compared to prior work on non-parametric methods for MT, our approach is arguably simpler (in that it requires no training, as compared to Gu et al. (2018)) and more expressive (in that it provides access to billions of key-value pairs during inference, as compared to Zhang et al. (2018); Gu et al. (2018)).
20
+
21
+ Extensive experiments show that kNN-MT scales to datastores containing billions of tokens, improving results across a range of settings. For example, it improves a state-of-the-art GermanEnglish translation model by 1.5 BLEU. kNN-MT can also be used to adapt a single model to diverse domains by simply adding a domain-specific datastore—improving results by an average of 9.2 BLEU over the base model out-of-domain, and even outperforming existing models that train on these domains. Finally, language-pair-specific datastores are used to adapt a multilingual model to particular language pairs, with improvements of 3 BLEU for translating English into German and Chinese. We find that retrievals from kNN-MT are typically highly contextually relevant.
22
+
23
+ <table><tr><td rowspan="2" colspan="2">Training Translation Contexts ((s(2),)</td><td colspan="2">Datastore Representation</td><td rowspan="2" colspan="2">Distances dj=d(kj,q)</td><td rowspan="2">Nearest k</td><td rowspan="2"></td><td rowspan="2"></td><td rowspan="2">Temperature d=dj/T</td><td rowspan="2"></td><td rowspan="2"></td><td rowspan="2">Normalization p(kj) x exp(-d)</td><td rowspan="2"></td></tr><tr><td>kg=f(8(m),t)</td><td>Target U=t</td></tr><tr><td rowspan="2">J&#x27;aieteaParis. J&#x27;avaisetealamaison. J&#x27;appreciel&#x27;ete.</td><td>Ihave Ihad</td><td>8 0000</td><td>been been</td><td>4 3</td><td></td><td>my been</td><td>134</td><td></td><td>my been</td><td>0.1 0.3</td><td></td><td>my been</td><td>0.40 0.32</td></tr><tr><td>lenjoy .</td><td>000</td><td>summer</td><td>100 .</td><td></td><td>been</td><td></td><td></td><td>been</td><td>0.4</td><td></td><td>been</td><td>0.28</td></tr><tr><td>J&#x27;aimaproprechambre.</td><td>Ihave</td><td>8</td><td>. my</td><td>1</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>1 Aggregation</td><td></td></tr><tr><td>Test Input x</td><td>Generated tokens 91:i-1</td><td>Representation q=f(x,g1:i-1)</td><td>Target yi</td><td></td><td></td><td></td><td></td><td></td><td></td><td>PkNN(yi)=∑1yi=ujp(kj)</td><td></td><td></td><td></td></tr><tr><td>J&#x27;ai etedansmapropre chambre.</td><td>Ihave</td><td>8</td><td>?</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>my been</td><td></td><td>0.4 0.6</td></tr></table>
24
+
25
+ # 2 NEAREST NEIGHBOR MACHINE TRANSLATION
26
+
27
+ kNN-MT involves augmenting the decoder of a pre-trained machine translation model with a nearest neighbor retrieval mechanism, allowing the model direct access to a datastore of cached examples. The translation is generated word-by-word; at each time step, we find the most similar contexts in the datastore, and compute a distribution over the corresponding target tokens, as shown in Figure 1. This distribution is then interpolated with the output distribution from the pre-trained MT model.
28
+
29
+ More specifically, given an input sequence of tokens in a source language $\boldsymbol { s } = \left( s _ { 1 } , \ldots , s _ { M _ { 1 } } \right)$ , a neural MT model outputs a sequence of tokens $t = \left( t _ { 1 } , \ldots , t _ { M _ { 2 } } \right)$ in the target language. When using autoregressive decoders, the output distribution for each token $t _ { i }$ in the target sequence is conditioned on the entire source sequence as well as the previous target tokens, $p ( t _ { i } | s , t _ { 1 : i - 1 } )$ . Let $\left( s , t _ { 1 : i - 1 } \right)$ be the translation context and $t _ { i }$ be the target token.
30
+
31
+ Datastore creation Our datastore is constructed offline and consists of a set of key-value pairs. The key is a high-dimensional representation of the entire translation context computed by the MT decoder, $f ( s , t _ { 1 : i - 1 } )$ , where $f$ represents a mapping from input to an intermediate representation of the decoder. The value is the corresponding ground truth target token $t _ { i }$ . For a parallel text collection $( s , \tau )$ , the representations are generated by a single forward pass over each example and the complete datastore is defined as follows:
32
+
33
+ $$
34
+ ( K , \mathcal { V } ) = \{ ( f ( s , t _ { 1 : i - 1 } ) , \ t _ { i } ) , \ \forall t _ { i } \in t \mid ( s , t ) \in ( S , T ) \}
35
+ $$
36
+
37
+ Tokens from the source language are not stored directly as values in the datastore. Conditioning on the source is implicit via the keys, and the values are only target language tokens.
38
+
39
+ Generation At test time, given a source $x$ , the model outputs a distribution over the vocabulary $p _ { M T } ( y _ { i } | x , \hat { y } _ { 1 : i - 1 } )$ for the target $y _ { i }$ at every step of generation, where $\hat { y }$ represents the generated tokens. The model also outputs the representation $f ( x , \hat { y } _ { 1 : i - 1 } )$ , which is used to query the datastore for the $k$ nearest neighbors $\mathcal { N }$ according to squared- $L ^ { 2 }$ distance, $d$ . In practice, the search over billions of key-value pairs is carried out using FAISS (Johnson et al., 2017), a library for fast nearest neighbor search in high-dimensional spaces.
40
+
41
+ The retrieved set is converted into a distribution over the vocabulary by applying a softmax with temperature $T$ to the negative distances and aggregating over multiple occurrences of the same vocabulary item. Using a temperature greater than one flattens the distribution, and prevents overfitting to the most similar retrievals.
42
+
43
+ $$
44
+ p _ { \mathrm { k N N } } ( y _ { i } | x , \hat { y } _ { 1 : i - 1 } ) \propto \sum _ { ( k _ { j } , v _ { j } ) \in N } \mathbb { 1 } _ { y _ { i } = v _ { j } } \exp \left( \frac { - d ( k _ { j } , f ( x , \hat { y } _ { 1 : i - 1 } ) ) } { T } \right)
45
+ $$
46
+
47
+ While a pure $k \mathbf { N N }$ approach is effective, we improve results by interpolating with the base model distribution, which is more robust in cases without relevant cached examples. The model and $k \mathbf { N N }$ distributions are interpolated with a tuned parameter $\lambda$ , resulting in the final $k$ NN-MT distribution:
48
+
49
+ $$
50
+ p ( y _ { i } | x , \hat { y } _ { 1 : i - 1 } ) = \lambda p _ { \mathrm { k N N } } ( y _ { i } | x , \hat { y } _ { 1 : i - 1 } ) + ( 1 - \lambda ) p _ { \mathrm { M T } } ( y _ { i } | x , \hat { y } _ { 1 : i - 1 } )
51
+ $$
52
+
53
+ The complete translation is generated using beam search.
54
+
55
+ kNN-MT vs. kNN-LM kNN-MT is a generalization of kNN-LM applied to conditional sequence generation, with a few important differences. First, the keys are not only conditioned on prior context, but also on the source sequence (here, in a different language). This means that the representations must encode both source and target context; we show examples in Section 6. Second, there is an additional tuned parameter, the softmax temperature. Higher temperatures flatten the distribution and allow for greater diversity without overfitting to the retrieved contexts, as shown in Section 6.
56
+
57
+ # 3 EXPERIMENTAL SETUP
58
+
59
+ We experiment with kNN-MT in three settings: (1) single language-pair translation, (2) multilingual MT and (3) domain adaptation.
60
+
61
+ Data We use the following datasets for training and evaluation.
62
+
63
+ WMT’19: For the single language-pair experiments, we use WMT’19 data for German-English.
64
+
65
+ CCMATRIX: We train our multilingual model on CCMatrix (Schwenk et al., 2019), containing parallel data for 79 languages and 1,546 language pairs. The parallel sentences are mined from cleaned monolingual commoncrawl data created using the ccNet pipeline (Wenzek et al., 2019). Semantically similar sentences in different languages are aligned using a learned distance measure; we use examples where the distance measure is at least 1.06, resulting in 4 billion sentence-pairs.
66
+
67
+ NEWSTEST: The newstest2018 and newstest2019 test sets from WMT (Bojar et al., 2018; Barrault et al., 2019) are used as validation and test sets for the multilingual experiments. The same GermanEnglish validation and test sets are also used for evaluation in the single language-pair and domain adaptation experiments.
68
+
69
+ TED TALKS: We use the Ted Talks data prepared by Qi et al. (2018) for evaluation in the multilingual setting, particularly to explore performance for language pairs that do no include English.
70
+
71
+ MULTI-DOMAINS: We use the multi-domains dataset (Koehn & Knowles, 2017), re-split by Aharoni & Goldberg (2020) for the domain adaptation experiments. It includes German-English parallel data for train/validation/test sets in five domains: Medical, Law, IT, Koran and Subtitles.
72
+
73
+ Models For the single language-pair and domain adaptation experiments, we use the WMT’19 German-English news translation task winner ( $\mathrm { N g }$ et al., 2019), available via the FAIRSEQ library (Ott et al., 2019).1 It is a Transformer encoder-decoder model (Vaswani et al., 2017) with 6 layers, 1,024 dimensional representations, 8,192 dimensional feedforward layers and 8 attention heads. Apart from WMT’19 training data, this model is trained on over 10 billion tokens of backtranslation data and fine-tuned on newstest test sets from years prior to 2018. In this work, we do not use ensembles or $n$ -best reranking.
74
+
75
+ For multilingual MT, we trained a 418M parameter Transformer-based encoder-decoder model on the CCMatrix data for 100K updates. The model has embedding dimension 1,024, hidden dimension 4,096, 12 layers in both the encoder and decoder, with 16 attention heads. To balance the training of different language pairs, which have various resource levels, we apply temperature upsampling with $T = 5$ (Arivazhagan et al., 2019). The vocabulary is shared across all languages and consists of 128K subwords extracted using sentencepiece (Kudo & Richardson, 2018).2 All results use case-sensitive detokenized BLEU, measured using SACREBLEU (Post, 2018).We provide the SACREBLEU signatures, along with details on the statistical power of our experiments, in Appendix C.
76
+
77
+ kNN-MT In this work, we use a FAISS index to represent the datastore and search for nearest neighbors. The keys are stored in clusters to speed up search and quantized to 64-bytes for space efficiency (the full-precision keys are discarded). The index is constructed offline via a single forward pass over every example in the given parallel text collection. We use the 1024-dimensional representation input to the final layer feedforward network as the key. Building the index involves a training phase to learn the cluster centroids. We use 5M keys for learning 131K cluster centroids for the multilingual experiments, and 1M keys for 4K clusters for in-domain data in the domain adaptation experiments. During inference, we query the datastore for 64 neighbors while searching 32 clusters. The interpolation and softmax temperature parameters are tuned on the validation sets.3
78
+
79
+ Computational Cost While kNN-MT does not add trainable model parameters, it does add some computational overhead. The primary cost of building the datastore is a single forward pass over all examples in the datastore, which is a fraction of the cost for training on the same examples for one epoch. During inference, retrieving 64 keys from a datastore containing billions of items results in a generation speed that is two orders of magnitude slower than the base MT system. Generation speed can be improved by searching fewer clusters, using smaller beams, or querying smaller datastores, with relatively minor trade-offs in performance, as we will see in Section 5. Developing faster nearest neighbor search tools remains an active area of research (Guo et al., 2020).
80
+
81
+ # 4 EXPERIMENTS
82
+
83
+ # 4.1 SINGLE LANGUAGE-PAIR TRANSLATION
84
+
85
+ To test whether kNN-MT can improve a model’s ability to generalize from its training data, we first apply it to a state-of-the-art translation model, using a datastore containing only the original training set. We use a state-of-the-art German-English model as our base MT system, which scores 37.59 BLEU on the newstest2019 test set.4 This is a highly competitive baseline – apart from the WMT’19 training data, the base model has also been trained on over 10 billion tokens of extra backtranslation data as well as fine-tuned on newstest test sets from previous years. Providing this heavily tuned base model with a datastore containing about 770M tokens of WMT’19 training data improves performance by 1.5 BLEU to 39.08, without any additional training. This result shows that even very strong translation models can be improved with test-time access to training sets.
86
+
87
+ # 4.2 MULTILINGUAL MACHINE TRANSLATION
88
+
89
+ Next, we apply $k \mathrm { N N - M T }$ to multilingual machine translation, to measure its ability to add capacity to a model when using very large training sets. For these experiments, we create datastores using subsets of the CCMatrix parallel data that the model has been trained on.
90
+
91
+ Retrieving neighbors from same source language data Here, we build one datastore per language-pair being tested, using the training examples for that language-pair. Table 1 shows performance for the baseline and $k \mathrm { N N - M T }$ on 17 language-pairs from newstest2019. Retrieving neighbors results in up to 3 BLEU improvements for English-German, English-Chinese and Chinese-English, with an average improvement of 1.4 BLEU across all 17 pairs, without any additional training.
92
+
93
+ Table 1 also shows the sizes of each of the datastores. Datastore size and the increase in BLEU are only weakly correlated across languages, though within a language, a larger datastore is decidedly better, as shown in Section 5. This suggests that underlying factors, such as the quality of the parallel data used to populate the datastore, may also factor into the size of the improvements from $k$ NN-MT.
94
+
95
+ Table 1: Multilingual machine translation with $k \mathrm { N N - M T }$ All test sets are from newstest2019, except ja-en/en-ja which are from newstest2020. Adding $k \mathrm { N N - M T }$ increases BLEU scores in all cases, and by over 3 points for en-de, zh-en and en-zh. Bold scores indicate significant results based on statistically powered experiments (Card et al., 2020).
96
+
97
+ <table><tr><td>Test set sizes</td><td>de-en 2,000</td><td>ru-en 2,000</td><td>zh-en 2,000</td><td>ja-en 993</td><td>fi-en 1,996</td><td>lt-en 1,000</td><td>de-fr 1,701</td><td>de-cs 1,997</td><td>en-cs 2,000</td></tr><tr><td>Base MT +kNN-MT</td><td>34.45 35.74</td><td>36.42 37.83</td><td>24.23 27.51</td><td>12.79 13.14</td><td>25.92 26.55</td><td>29.59 29.98</td><td>32.75 33.68</td><td>21.15 21.62</td><td>22.78 23.76</td></tr><tr><td>Datastore Size</td><td>5.56B</td><td>3.80B</td><td>1.19B</td><td>360M</td><td>318M</td><td>168M</td><td>4.21B</td><td>696M</td><td>533M</td></tr><tr><td>Test set sizes</td><td>en-de 1,997</td><td>en-ru 1,997</td><td>en-zh 1,997</td><td>en-ja 1,000</td><td>en-fi 1,997</td><td>en-lt 998</td><td>fr-de 1,701</td><td>cs-de 1,997</td><td>Avg. 1</td></tr><tr><td>Base MT +kNN-MT</td><td>36.47</td><td>26.28</td><td>30.22</td><td>21.35</td><td>21.37</td><td>17.41</td><td>26.04</td><td>22.78</td><td>26.00 27.40</td></tr><tr><td>Datastore Size</td><td>39.49 6.50B</td><td>27.91 4.23B</td><td>33.63 1.13B</td><td>23.23 433M</td><td>22.20 375M</td><td>18.25 204M</td><td>27.81 3.98B</td><td>23.55 689M</td><td>1</td></tr></table>
98
+
99
+ Table 2: Adding datastores with English source-side data can improve translation from other languages by an average of 1 BLEU, suggesting that our representations generalize over different source langauges. The model’s representations of the source generalize across languages and make crosslingual retrieval effective.
100
+
101
+ <table><tr><td></td><td colspan="5">Ted Talks</td><td colspan="3">Newstest2019</td><td>Avg.</td></tr><tr><td>Test set sizes</td><td>de-ja 4,442</td><td>ru-ja 5,090</td><td>uk-ja 3,560</td><td>de-ru 4,288</td><td>de-zh 4,349</td><td>fr-de 1,701</td><td>cs-de 1,997</td><td>de-cs 1,997</td><td>1</td></tr><tr><td>Base MT</td><td>10.11</td><td>9.69</td><td>8.36</td><td>17.24</td><td>20.48</td><td>26.04</td><td>22.78</td><td>21.15</td><td>16.98</td></tr><tr><td>+kNN-MT (en-*)</td><td>11.08</td><td>10.42</td><td>9.64</td><td>18.02</td><td>21.22</td><td>27.85</td><td>23.71</td><td>21.74</td><td>17.96</td></tr><tr><td>Datastore Size</td><td>433M</td><td>433M</td><td>433M</td><td>4.23B</td><td>1.13B</td><td>6.50B</td><td>6.50B</td><td>533M</td><td>1</td></tr></table>
102
+
103
+ Finally, we also observe that improvements for languages translated into English, on average 1.23 BLEU, are lower than improvements for languages translated from English, on average 1.94 BLEU. As English is the most frequent language in the base model’s training data, this suggests that kNNMT is particularly useful for improving decoders in languages that may be underfit during training.
104
+
105
+ Retrieving neighbors using English as the source language Here, we construct datastores from training examples where English is the source language, and the target language is the language being tested. This setting is useful for rarer language pairs with less bi-text, and is related to pivoting (Utiyama & Isahara, 2007; Cohn & Lapata, 2007). Table 2 shows that on five pairs from the Ted Talks data and three from newstest2019, we find that kNN-MT improves performance by 1 BLEU on average. This result shows that the model’s representations of the source generalize well enough across languages to make cross-lingual retrieval effective. Further investigation is needed to study the extent to which multilingual representations from related and unrelated languages can improve translation performance via $k \mathrm { N N - M T }$ .
106
+
107
+ # 4.3 DOMAIN ADAPTATION
108
+
109
+ We also measure the effectiveness of kNN-MT for domain adaptation, in which we use a domainspecific datastore to adapt the model, without further training. For these experiments, we use the German-English translation model from Section 4.1 as our base MT system and provide domainspecific data in the datastores. We also explore the effects of retrieving neighbors from a large amount of out-of-domain data as well as from a single multi-domain datastore.
110
+
111
+ Table 3: Domain adaptation using kNN-MT. The base MT system is trained on WMT’19 data which is also treated as the in-domain data for newstest2019. kNN-MT improves the base model by an average of 9.2 BLEU, without training, to achieve the best reported results on this task.
112
+
113
+ <table><tr><td></td><td>Newstest 2019</td><td>Medical</td><td>Law</td><td>IT</td><td>Koran</td><td>Subtitles</td><td>Avg.</td></tr><tr><td>Test set sizes</td><td>2,000</td><td>2.000</td><td>2.000</td><td>2.000</td><td>2.000</td><td>2.000</td><td>-</td></tr><tr><td>Aharoni &amp; Goldberg (2020): one model per domain</td><td></td><td>56.5</td><td>59.0</td><td>43.0</td><td>15.9</td><td>27.3</td><td>40.34</td></tr><tr><td>one model for all domains</td><td></td><td>53.3</td><td>57.2</td><td>42.1</td><td>20.9</td><td>27.6</td><td>40.22</td></tr><tr><td>best data selection method</td><td>-</td><td>54.8</td><td>58.8</td><td>43.5</td><td>21.8</td><td>27.4</td><td>41.26</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Base MT +kNN-MT:</td><td>37.59</td><td>39.91</td><td>45.71</td><td>37.98</td><td>16.30</td><td>29.21</td><td>33.82</td></tr><tr><td>in-domain datastore</td><td>39.08</td><td>54.35</td><td>61.78</td><td>45.82</td><td>19.45</td><td>31.73</td><td>42.63</td></tr><tr><td>WMT&#x27;19 datastore</td><td>39.08</td><td>40.22</td><td>46.74</td><td>40.27</td><td>17.99</td><td>29.23</td><td>34.89</td></tr><tr><td>all-domains datastore</td><td>38.88</td><td>54.54</td><td>61.11</td><td>48.63</td><td>19.22</td><td>31.70</td><td>43.04</td></tr><tr><td>Datastore Size (in-domain)</td><td>770M</td><td>5.70M</td><td>18.3M</td><td>3.10M</td><td>450K</td><td>159M</td><td>-</td></tr></table>
114
+
115
+ Domain-specific datastores Table 3 shows the base MT system’s in-domain performance on newstest2019, as well as zero-shot transfer to five other domains. kNN-MT significantly outperforms the base MT system in all settings. For the multi-domains dataset, kNN-MT improves the base MT model performance by an average of 9.2 BLEU, with improvements as large as 16 BLEU on Law and 14.5 BLEU on Medical, all without any further training. We also provide scores from Aharoni & Goldberg (2020) for models trained on in-domain data, those trained on all domains jointly, and those trained using the best-performing data selection method proposed by the authors. We find that kNN-MT also outperforms the best reported average on the multi-domains dataset by 1.4 BLEU.
116
+
117
+ Out-of-domain and multi-domain datastores Table 3 also shows performance for retrieving neighbors from 770M tokens of WMT’19 data that the model has been trained on. While the average BLEU for the multi-domain data is 1 point higher, the improvements are much smaller compared to using in-domain data. This illustrates the value of adding domain-specific data to the datastore over adding a large amount of arbitrary data. We also measure the effectiveness of building a single multi-domain datastore containing parallel data from all six settings. Performance on IT improves by 3 BLEU but scores for the other domains are mostly the same. This shows that $k \mathrm { N N - M T }$ is robust to the presence of out-of-domain examples since retrieving neighbors from a datastore where large amounts of data is out-of-domain does not hurt performance relative to using only in-domain data.
118
+
119
+ # 5 TUNING KNN-MT
120
+
121
+ We investigate how key hyperparameters affect multilingual kNN-MT on validation data. We provide validation set BLEU scores as well as hyperparameter choices for our experiments in Appendix A.
122
+
123
+ Softmax temperature A softmax temperature is used when estimating the nearest neighbor distribution in order to prevent the model from assigning most of the probability mass to a single neighbor, thus hurting diversity. Values greater than 1 will flatten the distribution, which can improve $k \mathbf { N N } .$ - MT performance. Figure 2 shows that a temperature of 1 results in significantly lower BLEU scores. For all of our experiments, values of either 10 or 100 prove to be optimal.
124
+
125
+ Number of neighbors per query In our experiments, we fix the value of $k$ , the number of neighbors retrieved per query, to 64. For a fixed temperature and interpolation parameter, we find that performance does not improve when retrieving a larger number of neighbors, and in some cases, performance deteriorates. This suggests that retrieving more neighbors can add noise to the sequence generation process. Figure 2 shows that in some cases, performance improves when retrieving fewer neighbors, and further gains may be possible by tuning this parameter.
126
+
127
+ ![](images/4a894a653b5bc86d1ace69b7d9355010f59c2f95ab0e272cc0d4147ac07474f3.jpg)
128
+ Figure 2: Effect of the number of neighbors retrieved and the softmax temperature on the validation BLEU score for en- $z h$ . Temperatures greater than 1 are important to prevent the model from overfitting to the most similar neighbor. For higher temperatures, more neighbors do not always result in improvements.
129
+
130
+ ![](images/ffebda3037765255e36913287c15f19f093247f9555a28236f8315bb31082fba.jpg)
131
+ Figure 3: Effect of datastore size on the validation BLEU score for $r u – e n$ and $e n \ – \ z h$ . Performance improves monotonically with size but retrieval can be slow for datastores containing billions of tokens. Smaller datastores, which account for a large fraction of the improvement, can be used for faster retrieval.
132
+
133
+ Datastore size Figure 3 shows increasing the size of the datastore improves translation performance. However, larger datastores result in slower retrieval, indicating a speed-performance tradeoff. Much of the benefit can be realized with much smaller, and correspondingly faster, datastores.
134
+
135
+ # 6 QUALITATIVE ANALYSIS
136
+
137
+ To better understand kNN-MT, we examine the retrievals for several examples. We use the GermanEnglish model and generate with only the $k \mathbf { N N }$ distribution $\lambda = 1$ ) with beam size 1, retrieving $k = 8$ neighbors from the News Commentary and Common Crawl subsets of WMT’19 data.
138
+
139
+ Figure 4 shows an example from newstest2018 where all the retrieved neighbors map to the same target, military. Many of the retrieved examples include phrases similar to tamed the military such as Autoritat gegen ¨ uber dem Milit ¨ ar¨ , Kontrolle des Militars ¨ and das Militar gezwungen ¨ on the source side and authority over the military, control over the military and forced the military given the local target side context, but differ sharply in their longer context, often describing different nations and centuries. We provide additional examples illustrating this point in Appendix B.
140
+
141
+ Another interesting observation is that $k \mathbf { N N }$ , even when not interpolated with the base model, is able to reconstruct named entities that are split into multiple subword tokens, even if that particular named entity does not appear in the datastore. One such example is the name Haysom that is split into subwords Hay and som. The retrieved neighbors for the first subword token include examples that contain the names Hayes and Haydn, while those for the second include Grissom and Folsom, showing subword representations are used effectively in the nearest neighbor search.
142
+
143
+ # 7 RELATED WORK
144
+
145
+ Retrieval in Translation Recent work has integrated retrieval of words and phrases into neural translation, to gain some of the advantages of the previous generation of word- and phrase-based methods (Brown et al., 1993; Koehn et al., 2003). For example, Zhang et al. (2018) proposed guiding models by retrieving $n$ -grams and up-weighting the probabilities of retrieved tokens. Tu et al. (2018) use cache-based models (Grave et al., 2017a;b) to save and retrieve translation histories, so models can adapt to changing contexts. Compared to these, kNN-MT has several advantages — for instance, the external datastore only needs to be created once, whereas the cache model requires constant writes. Further, kNN-MT scales retrieval to orders-of-magnitude larger datastores, while taking advantage of neural context representations.
146
+
147
+ Other work has retrieved complete example translation sentences at test time. Nagao (1984) proposed example-based MT for translating sequences by analogy. Before deep learning was widely adopted, this approach was extended to identifying portions of the training data that could be a translation based on edit distance (Doi et al., 2005), matching training examples based on local trigram contexts (van den Bosch et al., 2007), using phrase-based memories (van Gompel et al., 2010) and incorporating syntactic features when retrieving similar examples (Stroppa et al., 2007; Haque et al., 2009). Recently, Gu et al. (2018) proposed a model that retrieves examples similar to the test source sequence and then attends over this subset of retrieved source-target pairs at the token level, while generating translations. Bulte & Tezcan (2019) and $\mathrm { X u }$ et al. (2020) use fuzzy-matching with translation memories and augment source sequences with retrieved source-target pairs. These techniques face challenges in identifying relevant retrieval candidates, as they focus on sentence-level retrieval. In contrast, kNN-MT focuses on token level retrieval from billions of key-value pairs, meaning that each word can retrieve the most relevant examples for its translation.
148
+
149
+ Figure 4: Example retrievals using kNN-MT. Not only do the retrievals all correctly predict the target word military, but the local contexts tend to be semantically related. Both the source and the three nearest retrievals express the concept of control over the military.
150
+
151
+ <table><tr><td colspan="3">TestInput:Dabei schien es,als habe Erdogan das Militar gezahmt. Generated tokens: In doing so,it seems as if Erdogan has tamed the</td></tr><tr><td colspan="2">Training Set Translation Context (source and target)</td><td>Training Set Target</td><td>Context Probability</td></tr><tr><td>Dem charismatischen Minis- terpräsidenten Recep Tayyip Erdogan,der drei aufeinanderfol- gendeWahlen fiirsich entscheiden konnte,ist es gelungenseine Autoritit gegeniiberdemMilitir</td><td>The charismatic prime minister, Re- cep Tayyip Erdogan,having won three consecutive elections, has been able to exert his authority over the</td><td>military</td><td>0.132</td></tr><tr><td>geltend zu machen. Ein bemerkenswerter Fall war die Ermordung des gemiβigten Pre-</td><td>One notable case was the assas- sination of moderate Prime Minis- terInukai Tsuyoshi in1932,which</td><td>military</td><td>0.130</td></tr><tr><td>mierministersInukaiTsuyoshi imJahre 1932, diedas Endejederwirklichenzivilen Kontrolle desMilitarsmarkiert. Siesind Teil eines Normal- isierungsprozesses und der Her-</td><td>marked theendofanyrealcivilian control ofthe They are part of a process of nor- malization,of the establishment of</td><td>military</td><td>0.129</td></tr><tr><td>stellung der absoluten zivilen Kontrolle iber dasMilitär und bestätigendasPrinzip, dass niemand iiber dem Gesetz steht.</td><td>absolute civilian control of the</td><td></td><td></td></tr><tr><td>Diese hart formulierte Erklarung wurdeals verschleierte,jedoch un- missverstandliche Warnung ange- sehen,dass das Militir bereit wire einzuschreiten...</td><td>That toughly worded statement was seenasa veiled but unmistakable warning that the</td><td>military</td><td>0.123</td></tr><tr><td colspan="2">… Final kNN distribution:military = 1.0 Final Translation: In doing so, Erdogan seemed to have tamed the military. Reference: In doing so, it seems as if Erdogan has tamed the military.</td><td></td><td></td></tr></table>
152
+
153
+ Finally, various studies have explored retrieving additional information to improve domain adaptation, often using lexicons (Hu et al., 2019), domain-adaptive training (Farajian et al., 2017) or attending over neighbors similar to $n$ -grams in the source (Bapna & Firat, 2019). These modifications require additional training, whereas kNN-MT provides the flexibility to use different datastores when decoding in different domains, keeping the model fixed.
154
+
155
+ Retrieval in Text Generation Retrieval mechanisms have also been applied to generation tasks more broadly. Weston et al. (2018) and Fan et al. (2020) improve dialogue response generation systems by retrieving examples and concatenating them to model inputs. Lewis et al. (2020) improve open-domain question answering systems by retrieving relevant contexts from Wikipedia and concatenating them to the inputs. Hashimoto et al. (2018) use a retrieve-and-edit framework to generate structured outputs such as code, by jointly training the editor and retriever. For $k \mathrm { N N - M T }$ , retrieval results in a distribution over the vocabulary that is used for generation directly and does not require further training or providing the retrieval candidates as input.
156
+
157
+ # 8 CONCLUSION
158
+
159
+ We introduced a simple and effective method that can be applied to any neural MT model without further training. We show that similar contexts in a model’s embedding space are more likely to be followed by similar next words, allowing the model to be improved by interpolation with a nearest neighbor classifier. The approach improves a state-of-the-art model in-domain, leads to large gains out-of-domain, and can specialize a multilingual model for specific language-pairs. Future work should improve efficiency, for example by down-sampling frequent target words in the datastore.
160
+
161
+ # ACKNOWLEDGMENTS
162
+
163
+ The authors thank Kartikay Khandelwal for thoughtful discussions, Holger Schwenk and Sergey Edunov for sharing data and model details, and Matthijs Douze for answering questions about FAISS.
164
+
165
+ # REFERENCES
166
+
167
+ Roee Aharoni and Yoav Goldberg. Unsupervised domain clusters in pretrained language models. In Association of Computational Linguistics (ACL), 2020.
168
+
169
+ Naveen Arivazhagan, Ankur Bapna, Orhan Firat, Dmitry Lepikhin, Melvin Johnson, Maxim Krikun, Mia Xu Chen, Yuan Cao, George Foster, Colin Cherry, et al. Massively multilingual neural machine translation in the wild: Findings and challenges. arXiv preprint arXiv:1907.05019, 2019.
170
+
171
+ Ankur Bapna and Orhan Firat. Non-parametric adaptation for neural machine translation. In North American Association of Computational Linguistics (NAACL), 2019.
172
+
173
+ Lo¨ıc Barrault, Ondˇrej Bojar, Marta R. Costa-jussa, Christian Federmann, Mark Fishel, Yvette \` Graham, Barry Haddow, Matthias Huck, Philipp Koehn, Shervin Malmasi, Christof Monz, Mathias Muller, Santanu Pal, Matt Post, and Marcos Zampieri. Findings of the 2019 con- ¨ ference on machine translation (WMT19). In Proceedings of the Fourth Conference on Machine Translation (Volume 2: Shared Task Papers, Day 1), pp. 1–61, Florence, Italy, August 2019. Association for Computational Linguistics. doi: 10.18653/v1/W19-5301. URL https://www.aclweb.org/anthology/W19-5301.
174
+
175
+ Ondˇrej Bojar, Christian Federmann, Mark Fishel, Yvette Graham, Barry Haddow, Philipp Koehn, and Christof Monz. Findings of the 2018 conference on machine translation (WMT18). In Proceedings of the Third Conference on Machine Translation: Shared Task Papers, pp. 272–303, Belgium, Brussels, October 2018. Association for Computational Linguistics. doi: 10.18653/v1/ W18-6401. URL https://www.aclweb.org/anthology/W18-6401.
176
+
177
+ Peter F Brown, Stephen A Della Pietra, Vincent J Della Pietra, and Robert L Mercer. The mathematics of statistical machine translation: Parameter estimation. Computational linguistics, 19(2): 263–311, 1993.
178
+
179
+ Bram Bulte and Arda Tezcan. Neural fuzzy repair: Integrating fuzzy matches into neural machine translation. In Association of Computational Linguistics (ACL), 2019.
180
+
181
+ Dallas Card, Peter Henderson, Urvashi Khandelwal, Robin Jia, Kyle Mahowald, and Dan Jurafsky. With little power comes great responsibility. In Empirical Methods in Natural Language Processing (EMNLP), 2020.
182
+
183
+ Trevor Cohn and Mirella Lapata. Machine translation by triangulation: Making effective use of multi-parallel corpora. In Proceedings of the 45th Annual Meeting of the Association of Computational Linguistics, pp. 728–735, Prague, Czech Republic, June 2007. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/P07-1092.
184
+
185
+ Takao Doi, Hirofumi Yamamoto, and Eiichiro Sumita. Example-based machine translation using efficient sentence retrieval based on edit-distance. ACM Transactions on Asian Language Information Processing, 4(4):377–399, 2005.
186
+
187
+ Angela Fan, Claire Gardent, Chloe Braud, and Antoine Bordes. Augmenting transformers with knn-based composite memory for dialogue. arXiv preprint arXiv:2004.12744, 2020.
188
+
189
+ M Amin Farajian, Marco Turchi, Matteo Negri, and Marcello Federico. Multi-domain neural machine translation through unsupervised adaptation. In Proceedings of the Second Conference on Machine Translation, pp. 127–137, 2017.
190
+
191
+ Edouard Grave, Moustapha M Cisse, and Armand Joulin. Unbounded cache model for online language modeling with open vocabulary. In NIPS, pp. 6042–6052, 2017a.
192
+
193
+ Edouard Grave, Armand Joulin, and Nicolas Usunier. Improving neural language models with a continuous cache. In International Conference on Learning Representations (ICLR), 2017b.
194
+
195
+ Jiatao Gu, Yong Wang, Kyunghyun Cho, and Victor OK Li. Search engine guided neural machine translation. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018.
196
+
197
+ Ruiqi Guo, Philip Sun, Erik Lindgren, Quan Geng, David Simcha, Felix Chern, and Sanjiv Kumar. Accelerating large-scale inference with anisotropic vector quantization. In International Conference on Machine Learning (ICML), 2020.
198
+
199
+ Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Realm: Retrievalaugmented language model pre-training. arXiv preprint arXiv:2002.08909, 2020.
200
+
201
+ Rejwanul Haque, Sudip Naskar, Yanjun Ma, and Andy Way. Using supertags as source language context in smt. 13th Annual Conference of the European Association for Machine Translation, (EAMT), 01 2009.
202
+
203
+ Tatsunori B. Hashimoto, Kelvin Guu, Yonatan Oren, and Percy Liang. A retrieve-and-edit framework for predicting structured outputs. In Advances in Neural Information Processing Systems (NeurIPS), 2018.
204
+
205
+ Junjie Hu, Mengzhou Xia, Graham Neubig, and Jaime G Carbonell. Domain adaptation of neural machine translation by lexicon induction. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2989–3001, 2019.
206
+
207
+ Jeff Johnson, Matthijs Douze, and Herve J ´ egou. Billion-scale similarity search with gpus. ´ arXiv preprint arXiv:1702.08734, 2017.
208
+
209
+ Urvashi Khandelwal, Omer Levy, Dan Jurafsky, Luke Zettlemoyer, and Mike Lewis. Generalization through memorization: Nearest neighbor language models. In International Conference on Learning Representations (ICLR), 2020.
210
+
211
+ Philipp Koehn and Rebecca Knowles. Six challenges for neural machine translation. In First Workshop on Neural Machine Translation (WNMT), 2017.
212
+
213
+ Philipp Koehn, Franz J Och, and Daniel Marcu. Statistical phrase-based translation. Technical report, UNIVERSITY OF SOUTHERN CALIFORNIA MARINA DEL REY INFORMATION SCIENCES INST, 2003.
214
+
215
+ Taku Kudo and John Richardson. Sentencepiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. In Empirical Methods in Natural Language Processing: System Demonstrations (EMNLP), 2018.
216
+
217
+ Patrick Lewis, Ethan Perez, Aleksandara Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Kuttler, Mike Lewis, Wen tau Yih, Tim Rockt ¨ aschel, Sebastian Riedel, and ¨ Douwe Kiela. Retrieval-augmented generation for knowledge-intensive nlp tasks. arXiv preprint arXiv:2005.11401, 2020.
218
+
219
+ Makoto Nagao. A framework of a mechanical translation between japanese and english by analogy principle. In Artificial and human intelligence, 1984.
220
+
221
+ Nathan Ng, Kyra Yee, Alexei Baevski, Myle Ott, Michael Auli, and Sergey Edunov. Facebook fair’s wmt19 news translation task submission. In Fourth Conference on Machine Translation (WMT), 2019.
222
+
223
+ Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan $\mathrm { N g }$ , David Grangier, and Michael Auli. fairseq: A fast, extensible toolkit for sequence modeling. In North American Association of Computational Linguistics: System Demonstrations (NAACL), 2019.
224
+
225
+ Matt Post. A call for clarity in reporting BLEU scores. In Proceedings of the Third Conference on Machine Translation: Research Papers, pp. 186–191, Belgium, Brussels, October 2018. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/ W18-6319.
226
+
227
+ Ye Qi, Devendra Sachan, Matthieu Felix, Sarguna Padmanabhan, and Graham Neubig. When and why are pre-trained word embeddings useful for neural machine translation? In North American Association of Computational Linguistics (NAACL), 2018.
228
+
229
+ Holger Schwenk, Guillaume Wenzek, Sergey Edunov, Edouard Grave, and Armand Joulin. Ccmatrix: Mining billions of high-quality parallel sentences on the web. arXiv preprint arXiv:1911.04944, 2019.
230
+
231
+ Nicolas Stroppa, Antal van den Bosch, and Andy Way. Exploiting source similarity for smt using context-informed features. Proceedings of The 11th Conference on Theoretical and Methodological Issues in Machine Translation, 01 2007.
232
+
233
+ Zhaopeng Tu, Yang Liu, Shuming Shi, and Tong Zhang. Learning to remember translation history with a continuous cache. In Transactions of the Association of Computational Linguistics (TACL), 2018.
234
+
235
+ Masao Utiyama and Hitoshi Isahara. A comparison of pivot methods for phrase-based statistical machine translation. In Human Language Technologies 2007: The Conference of the North American Chapter of the Association for Computational Linguistics; Proceedings of the Main Conference, pp. 484–491, Rochester, New York, April 2007. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/N07-1061.
236
+
237
+ Antal van den Bosch, Nicolas Stroppa, and Andy Way. A memory-based classification approach to marker-based ebmt. METIS-II Workshop on New Approaches to Machine Translation, 04 2007.
238
+
239
+ Maarten van Gompel, Antal van den Bosch, and Peter Berck. Extending memory-based machine translation to phrases. In Computational Linguistics in the Netherlands (CLIN), pp. 79–86, 01 2010.
240
+
241
+ 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 (NIPS), 2017.
242
+
243
+ Guillaume Wenzek, Marie-Anne Lachaux, Alexis Conneau, Vishrav Chaudhary, Francisco Guzman, ´ Armand Joulin, and Edouard Grave. Ccnet: Extracting high quality monolingual datasets from web crawl data. arXiv preprint arXiv:1911.00359, 2019.
244
+
245
+ Jason Weston, Emily Dinan, and Alexander H Miller. Retrieve and refine: Improved sequence generation models for dialogue. arXiv preprint arXiv:1808.04776, 2018.
246
+
247
+ Jitao Xu, Josep Crego, and Jean Senellart. Boosting neural machine translation with similar translations. In Association of Computational Linguistics (ACL), 2020.
248
+
249
+ Biao Zhang, Philip Williams, Ivan Titov, and Rico Sennrich. Improving massively multilingual neural machine translation and zero-shot translation. arXiv preprint arXiv:2004.11867, 2020.
250
+
251
+ Jingyi Zhang, Masao Utiyama, Eiichro Sumita, Graham Neubig, and Satoshi Nakamura. Guiding neural machine translation with retrieved translation pieces. In North American Association of Computational Linguistics (NAACL), 2018.
252
+
253
+ Table 4: Multilingual machine translation with $k \mathrm { N N - M T }$ on the validation set. We show the the tuned interpolation parameter $( \lambda )$ as well as the tuned softmax temperature $( T )$ for each language pair.
254
+
255
+ <table><tr><td>Test set sizes</td><td>de-en 2,998</td><td>ru-en 3,000</td><td>zh-en 3,981</td><td>ja-en 1,998</td><td>fi-en 3,000</td><td>lt-en 2,000</td><td>de-fr 1,512</td><td>de-cs 3,000</td><td>en-cs 2,983</td></tr><tr><td>Base MT +kNN-MT</td><td>38.21 40.48</td><td>30.51 32.6</td><td>21.93 24.49</td><td>14.44 15.62</td><td>21.50 22.11</td><td>28.68 29.41</td><td>28.46 29.74</td><td>21.97 23.01</td><td>20.66 21.79</td></tr><tr><td>Datastore Size Interpolation (入) Temperature (T)</td><td>5.56B 0.6 10</td><td>3.80B 0.5 10</td><td>1.19B 0.4 10</td><td>360M 0.4 10</td><td>318M 0.2 10</td><td>168M 0.2 10</td><td>4.21B 0.6 100</td><td>696M 0.4 100</td><td>533M 0.3 10</td></tr><tr><td>Test set sizes</td><td>en-de 2,998</td><td>en-ru 3,000</td><td>en-zh 3,981</td><td>en-ja 1,998</td><td>en-fi 3,000</td><td>en-lt 2,000</td><td>fr-de 1,512</td><td>cs-de</td><td>Avg.</td></tr><tr><td>Base MT</td><td>39.07</td><td>26.00</td><td>32.72</td><td>16.31</td><td>16.02</td><td>21.11</td><td>25.16</td><td>3,000 24.16</td><td>- 25.11</td></tr><tr><td>+kNN-MT</td><td>42.22</td><td>29.52</td><td>37.96</td><td>18.28</td><td>17.22</td><td>22.84</td><td>26.39</td><td>24.5</td><td>26.95</td></tr><tr><td>Datastore Size</td><td>6.50B</td><td>4.23B</td><td>1.13B</td><td>433M</td><td>375M</td><td>204M</td><td>3.98B</td><td></td><td></td></tr><tr><td>Interpolation (入)</td><td>0.6</td><td>0.7</td><td>0.7</td><td></td><td></td><td></td><td></td><td>689M</td><td>-</td></tr><tr><td></td><td></td><td></td><td></td><td>0.6</td><td>0.4</td><td>0.4</td><td>0.5</td><td>0.4</td><td></td></tr><tr><td>Temperature (T)</td><td>100</td><td>10</td><td>100</td><td>10</td><td>10</td><td>10</td><td>10</td><td>100</td><td></td></tr></table>
256
+
257
+ Table 5: Domain adaptation using $k \mathrm { N N - M T }$ on the multi-domains validation data and newstest2018. The base MT system is trained on WMT’19 data which is also treated as the in-domain data for newstest2018. We present the interpolation $( \lambda )$ and softmax temperature $( T )$ hyperparameter choices for each domain.
258
+
259
+ <table><tr><td></td><td>Newstest 2019</td><td>Medical</td><td>Law</td><td>IT</td><td>Koran</td><td>Subtitles</td><td>Avg.</td></tr><tr><td>Test set sizes Base MT</td><td>2,000</td><td>2,000</td><td>2,000</td><td>2.000</td><td>2,000</td><td>2,000</td><td>1</td></tr><tr><td>+kNN-MT:</td><td>48.07</td><td>39.94</td><td>45.78</td><td>35.78</td><td>16.30</td><td>29.74</td><td>33.51</td></tr><tr><td>in-domain datastore</td><td>48.57</td><td>53.12</td><td>61.58</td><td>42.41</td><td>19.67</td><td>32.28</td><td>41.81</td></tr><tr><td>Datastore Size (in-domain)</td><td>770M</td><td>5.70M</td><td>18.3M</td><td>3.10M</td><td>450K</td><td>159M</td><td>1</td></tr><tr><td>Interpolation (入)</td><td>0.4</td><td>0.8</td><td>0.8</td><td>0.7</td><td>0.8</td><td>0.7</td><td>-</td></tr><tr><td>Temperature (T)</td><td>100</td><td>10</td><td>10</td><td>10</td><td>100</td><td>10</td><td>-</td></tr></table>
260
+
261
+ # A HYPERPARAMETER TUNING
262
+
263
+ In this section, we present validation set results as well as the hyperparameter choices for the multilingual machine translation and domain adaptation experiments. Only two hyperparameters have been tuned on the validation sets, the interpolation parameter $\lambda$ and the softmax temperature $T$ . The number of neighbors $k$ has been fixed to 64, the number of clusters searched has been set to 32 and the beam size has been set to 5. For the number of clusters in the FAISS index, preliminary experiments showed that for larger datastores, while using more clusters does not hurt performance, it does significantly speed up the search process since searching within the clusters is exhaustive. Hence, we use 131K clusters for the multilingual experiments.
264
+
265
+ Table 4 shows the validation set BLEU scores for the multilingual experiments as well as the hyperparameter choices, and Table 5 shows the same for the domain adaptation experiments using only the in-domain datastores. Values for the interpolation parameter lie between 0 and 1. We also note that for a fixed value of $\lambda = 0 . 5$ , using $k \mathrm { N N - M T }$ either performs similarly to or improves the base MT model’s performance, but never hurts, on validation sets across the 17 language pairs evaluated in Section 4.2. For the temperature, we find that values of either 10 or 100 are optimal for all of our experiments.
266
+
267
+ Test Input: Aber in Papua hat sich wenig verandert, und heute f ¨ uhlen sich die Einheimischen betrogen. ¨ Generated tokens: But not much has
268
+
269
+ <table><tr><td>Training Set Translation Context</td><td>Training Set Target</td><td>Context Probability</td><td></td></tr><tr><td>Nach einem schwerumkämpften Wahlkampf,derdeutlich überzwei Milliarden Dollarkostete,sieht esfir vieleBeobachter aus,alshättesich in deramerikanischen Politik nicht vielt geandert..</td><td>Aftera hard-fought elec- tion campaign,costing well in excess of $2 billion,it seems to many observers thatnot much has</td><td>changed</td><td>0.143</td></tr><tr><td>Geindert freilich hat sich wenig:SchlechtBut not much has gehandhabteKriege...</td><td></td><td>changed</td><td>0.137</td></tr><tr><td>Kaum etwas hat sich verändert,auβerNot much has dasses jetzt nicht mehr die Bewohner des</td><td></td><td>changed</td><td>0.130</td></tr><tr><td>Appartement-Gebaudes... Es ist zwar richtig,dass sich seit dem AusbruchderglobalenFinanzkrise vor über vier Jahren und derschon 2010verabschiedetenDodd-Frank- Finanzmarkreformen in den Vereinigten Staatenkaumetwasdaran geändert hat...</td><td>True,while the global f- nancial crisis erupted more than four years ago,and the Dodd-Frank financial reformswereadopted inthe UnitedStatesbackin2010, notmuch has</td><td>changed</td><td>0.121</td></tr><tr><td colspan="4">… Final kNN distribution: changed = 1.0 Final Translation: But not much has changed in Papua,and locals feel betrayed today. Reference:But precious little has changed in Papua,and today local people feel betrayed.</td></tr></table>
270
+
271
+ # B ADDITIONAL EXAMPLES
272
+
273
+ Figure 5 further illustrates the behavior of kNN-MT using local contexts in both the source and target to retrieve nearest neighbors. Figure 6 shows a case where the model has very little target-side prior context and mainly relies on the source context to retrieve the best neighbors.
274
+
275
+ # C BLEU SCORES
276
+
277
+ In this paper, all results use case-sensitive detokenized BLEU, measured using SACREBLEU (Post, 2018), with the following signatures:
278
+
279
+ General: BLEU+case.mixed+numrefs. $^ { 1 + }$ smooth.exp+tok.13a+version.1.4.13
280
+ For chinese: BLEU $^ +$ case.mixed+numrefs. $^ { 1 + }$ smooth.exp+tok.zh+version.1.4.13
281
+
282
+ BLEU $^ +$ case.mixed+numrefs. $^ { 1 + }$ smooth.exp+tok.ja-mecab-0.996-IPA+version.1.4.13
283
+
284
+ For Table 1 and other experiments, we follow advice from Card et al. (2020) regarding the statistical power of machine translation experiments given the improvements in BLEU scores and the size of the dataset. The authors present results for a single language pair and we verify that their assumptions hold for a couple of other language pairs. Specifically, we find that for Chinese-English $P _ { 0 } = 0 . 1 3$ and $b _ { 0 } = 1 2$ , and for English-Chinese $P _ { 0 } = 0 . 0 7$ and $b _ { 0 } ~ = ~ 1 6$ . This indicates that these experiments, with the test sets containing about 2,000 examples, have close to $100 \%$ power which was verified using the notebooks provided by Card et al. (2020). We refer the reader to the original paper for more details. More generally, experiments on datasets which contain about 2,000 examples, with improvements of about 1 BLEU or higher, are statistically powered.
285
+
286
+ <table><tr><td colspan="3">TestInput:Wirwerden dasBeste tun,mit dem,waswir haben. Generated tokens:We</td></tr><tr><td>Training Set Translation Context (source and target)</td><td>Training Set Target</td><td>Context Probability</td></tr><tr><td>Wirwerden versuchen zu beweisen,dass die We Vermutung falsch ist,dies zu tun,nur um ein Gegenbeispiel Leinwände,dass die Aussage falsch ist,zu finden.</td><td>will</td><td>0.145</td></tr><tr><td>Allerdings,wenn man sich diese groβe Na- tion,wird diese Nation aussehen zu weit,und wir werden das tun, was wichtig und wertvoll, IdentityWiederherstellenderNation.</td><td>However, if you look will at this great nation, this nation will look too wide and we</td><td>0.132</td></tr><tr><td>Wir werden alles tun,um die Dinge fiir die We Anfänger sehr einfach zu machen,wahrend wir esden Experten erlauben,Dinge zu verändern,</td><td>will</td><td>0.127</td></tr><tr><td>fallssiewollen. “Wirwerden ihre Falleund die Fälle anderer politischer Gefangener vor die Gerichte brin- gen und das falsche Bild zerstoren...</td><td>“We</td><td>are 0.127</td></tr><tr><td colspan="3">· … · Final kNN distribution:will= O.639,are = O.238,intend= 0.123</td></tr></table>
md/train/8PPmLbV6WiQ/8PPmLbV6WiQ.md ADDED
@@ -0,0 +1,530 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Normalization of Language Embeddings for Cross-Lingual Alignment
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Learning a good transfer function to map the word vectors from two languages
11
+ 2 into a shared cross-lingual word vector space plays a crucial role in cross-lingual
12
+ 3 NLP. It is useful in translation tasks and important in allowing complex models
13
+ 4 built on a high-resource language like English to be directly applied on an aligned
14
+ 5 low resource language. While Procrustes and other techniques can align language
15
+ 6 models with some success, it has recently been identified that structural differences
16
+ 7 (for instance, due to differing word frequency) create different profiles for various
17
+ 8 monolingual embedding. When these profiles differ across languages, it corre
18
+ 9 lates with how well languages can align and their performance on cross-lingual
19
+ 10 downstream tasks. In this work, we develop a very general language embedding
20
+ 11 normalization procedure, building and subsuming various previous approaches,
21
+ 12 which removes these structural profiles across languages without destroying their
22
+ 13 intrinsic meaning. We demonstrate that meaning is retained and alignment is
23
+ 14 improved on similarity, translation, and cross-language classification tasks. Our
24
+ 15 proposed normalization clearly outperforms all prior approaches like centering and
25
+ 16 vector normalization on each task and with each alignment approach.
26
+
27
+ # 17 1 Introduction
28
+
29
+ 18 The best multilingual NLP approaches typically do not jointly learn a single embedding, since words
30
+ 19 of the same language tend to cluster, and thus are not useful for translation and cross-lingual learning
31
+ 20 tasks. Rather, after learning individual embeddings, the standard approach is to map word vectors
32
+ 21 from multiple languages into a shared cross-lingual word vector space [15]. This shared space creates
33
+ 22 a cross-lingual word embedding (CLWE) [22, 43]. These serve as a valuable tool for transferring
34
+ 23 data across different languages, understanding cross-linguistic differences, and cross-lingual transfer
35
+ 24 for downstream tasks, such as direct translation [16, 20, 24], cross-lingual information retrieval [42],
36
+ 25 cross-lingual document classification [23], and cross-lingual dependency parsing [17, 39].
37
+ 26 A common element of almost all CLWE methods is the use of a rigid, orthogonal transformation
38
+ 27 mapping one embedding onto another so they inhabit a shared linguistic space. An orthogonal
39
+ 28 transformation is a special class of transformations that can be interpreted as the space of (in our
40
+ 29 case, high-dimensional) rotations around the origin, and also allowing a mirror flip. This family of
41
+ 30 transformations preserves (a) linear and (b) angular properties. By linear properties, we mean that
42
+ 31 the straight-line Euclidean distance between elements is preserved, as are more powerful properties
43
+ 32 like analogies (e.g., Paris - France $^ +$ Italy $\approx$ Rome). Angular properties refer to measuring angles
44
+ 33 between pairs of points (from the origin), and as a result, cosine distance is preserved. Given a
45
+ 34 correspondence between pairs of objects across two embeddings, the classic Procrustes method,
46
+ 35 provides a closed-form solution which minimizes the sum of Euclidean distances. Moreover, if the
47
+ 36 vectors are all first made as unit vectors, then this also maximizes the sum of cosine similarities [10].
48
+ 37 Under this framework, there has been a flurry of work significantly improving CLWE model per
49
+ 38 formance along two directions. Semi-supervised and unsupervised models make these approaches
50
+ 39 require less input, and more amenable to lower-resource languages. For example Bootstrap Procrustes
51
+ 40 (PROC-B) [15, 41] is semi-supervised in that it starts with a small pairwise correspondence (of
52
+ 41 500-1000 words), aligns those to infer a larger correspondence, and repeats applying Procrustes
53
+ 42 alignment. Methods like MUSE [8] are unsupervised, and use a GAN to estimate a correspondence
54
+ 43 before applying a Procrustes procedure.
55
+ 44 The second direction is preprocessing the embeddings before applying the Procrustes alignment.
56
+ 45 These involve methods like removing the mean, removing principal components, and normalization
57
+ 46 which we will discuss in depth later. In principle, these methods aim to remove the geometry of
58
+ 47 data intrinsic to particular languages (but not shared across languages) while preserving similarity
59
+ 48 properties as assured by orthogonal alignment. The space of transformations allowed under orthogonal
60
+ 49 alignments is quite large, and we make the point that unless this data geometry is “normalized” it
61
+ 50 inhibits the alignment from optimizing over the entirety of this large space.
62
+ 51 Finally, we note that methods like Canonical Correlation Analysis (CCA) [13], Discriminative Latent
63
+ 52 Variable (DLV) [36], and Ranking-based optimization (RCSLS) [21] have also been applied towards
64
+ 53 finding an orthogonal alignment (or pair of alignments) which minimizes a different optimization
65
+ 54 function – since the objective function may not align with sums of squared Euclidean of cosine
66
+ 55 distance [8, 38]. Unlike the others, the RCSLS method notably does not require a rigid transformation.
67
+ 56 The focus of this paper is on embedding preprocessing, and is agnostic to the method of alignment
68
+ 57 used afterward, whether it is Procrustes-based, or optimizing something else.
69
+ 58 Our contribution. This work proposes a new and general approach to preprocessing word embed
70
+ 59 dings, subsuming many previous approaches. The key is Spectral Normalization which regularizes
71
+ 60 the spectral properties of monolingual embeddings by setting all of the top singular vectors to have
72
+ 61 the same singular value. However, it leaves alone the smaller singular value; these capture important
73
+ 62 information and cannot be zeroed out, but making them the same value as the top singular vectors
74
+ 63 introduces too much noise. Spectral normalization already performs as well as the best previous
75
+ 64 approaches on alignment and translation tasks, and since it applies a fairly uniform stretching to the
76
+ 65 embeddings it does not distort monolingual similarity performance. Moreover, we show layering
77
+ 66 Spectral Normalization within an iterative sequence with also centering and vector length normaliza
78
+ 67 tion improves results further. We first demonstrate this improvement on the standard translation task
79
+ 68 (BLI). We also show that this normalization preserves the core ontological structure of embeddings
80
+ 69 across languages, and that applying our normalization before aligning a low resource language to
81
+ 70 English improves performance on topic classification and on a natural language inference task.
82
+
83
+ # 71 2 Existing Methods for Orthogonal Vector Spaces Alignment
84
+
85
+ 72 Given a language $L$ , our starting point is an embedded representation of a set of $n$ words. Indexing
86
+ 73 words from $i = 1 \dots n$ , each word is associated with a vector $x _ { L } ^ { i } \in \mathbb { R } ^ { d }$ . And let $X _ { L } = \{ x _ { L } ^ { 1 } , . . . , x _ { L } ^ { n } \bar \}$
87
+ 74 be the set of $n$ words as their vector representation. These vector representations (derived by methods
88
+ 75 like word2vec [28], GloVe [33], or FastText [4]) are chosen so words with similar pairwise cosine
89
+ 76 similarity are found in the similar local context in large text corpora on which they are trained.
90
+ 77 Higher-level linear structure is shown to emerge, such as concept subspaces and analogies [29].
91
+ 78 The focus of this paper is on aligning embeddings of two languages $L _ { 1 }$ and $L _ { 2 }$ . Each embedding
92
+ 79 $X _ { L _ { 1 } }$ and $X _ { L _ { 2 } }$ , only is designed to ensure pairwise relationships between its word vectors, but the
93
+ 80 actual coordinates of those vectors do not have any explicit meaning. Yet, previous work has clearly
94
+ 81 demonstrated that there exists significant overall structural similarity, and alignment seeks to make
95
+ 82 correspondences between those structures for translation and joint understanding.
96
+ 83 Most methods start with a known correspondence (or build one) between a set of $K$ words in
97
+ 84 two languages, wlog let these be the same first $K$ indexed words in those languages, denoted
98
+ 85 $X _ { L _ { 1 } } ^ { K } ~ = ^ { \bf { \bar { \Phi } } } \{ x _ { L _ { 1 } } ^ { \bf { \bar { 1 } } } \cdot \cdot \cdot x _ { L _ { 1 } } ^ { \tilde { K } } \}$ and $X _ { L _ { 2 } } ^ { K } ~ = ~ \{ x _ { L _ { 2 } } ^ { 1 } \ldots x _ { L _ { 2 } } ^ { K } \}$ . Then the Procrustes Problem solve for an
99
+ 86 orthogonal matrix $W ^ { * } = \arg \operatorname* { m i n } \cdot$ W $\| X _ { L _ { 1 } } ^ { K } W - X _ { L _ { 2 } } ^ { K } \| _ { 2 } ^ { 2 }$ . There exists a simple solution [2, 38, 45, 10]
100
+ 87 as $W ^ { * } = U V ^ { \top }$ where $U \Sigma V ^ { \top } = { \mathsf { s v d } } ( X _ { L _ { 1 } } ^ { K } ( X _ { L _ { 2 } } ^ { K } ) ^ { \top } )$ . Dev et.al. [10] also point out that if all vectors
101
+ 88 are normalized first, then this procedure also maximizes the sum of cosine similarities.
102
+ 90 It turns out directly aligning embeddings from two languages (even using the “optimal” Procrustes
103
+ 91 solution) does not provide the best possible joint embedding for translation tasks. While word
104
+ 92 meaning appears to hold a similar structure, languages have other properties such as differing word
105
+ 93 frequency, and this for instance leads to more frequent words having longer vectors in embeddings.
106
+ 94 This extra language-specific structure tends to interfere with alignment. As a result, a number
107
+ 95 of techniques have been developed to “normalize” the embeddings before Procrustes (or other)
108
+ 96 alignment. This in some sense allows the word meaning to dominate the optimization tasks without
109
+ 97 other confounding factors. We review the most common normalization approaches.
110
+ 98 Mean Centering (C) subtracts the mean of all vectors in an embedding from each vector in that
111
+ 99 embedding. The result is that the mean of all vectors is 0. This is a rigid transformation, and so does
112
+ 100 not change the Euclidean distance between any pair of points in an embedding, and also preserves
113
+ 101 any linear property like analogies (e.g., Paris - France $^ +$ Italy $\approx$ Rome). Dev et. al. [10] points out
114
+ 102 that this is the first step (followed by the Procrustes orthogonal transformation) to minimize the sum
115
+ 103 of squared Euclidean distances among paired words, under any rigid transformation. However, this
116
+ 104 does change the cosine distance between pairs of points.
117
+ 05 Length Normalization (L) makes each vector have a 2-norm equal to 1, but retains its direction
118
+ 06 from the origin [2, 45]. This preprocessing step does not change the cosine distance between any pair
119
+ 07 of points in an embedding. But, it does change the Euclidean distance between pairs of points.
120
+ 108 Despite these contrasting goals, these two normalizations each turn out to be individually effective in
121
+ 109 regularizing the geometry of the embeddings, and allow for better CLWE. Wang et. al. [47], realized
122
+ 110 doing both was even more effective, and showed that iterating these two steps achieves the state
123
+ 111 of-the-art way to preprocess, we denote as $\mathbf { I } { \mathbf { - C } } { \mathbf { + L } }$ . Iterative Normalization transforms monolingual
124
+ 112 word embeddings to have unit-length and zero-mean simultaneously (in practice they terminate this
125
+ 113 iterative process after a few steps before it achieves these two goals exactly).
126
+ 114 PCA Removal (PR) computes the principal component analysis (PCA) of an embedding, and then
127
+ 115 projects away from the direction of the top principal component, removing it [31]. Mu et. al. [31]
128
+ 116 observed that the top singular values typically do not encode essential semantic relationships between
129
+ 117 words but rather align strongly with word frequency. Also, they notice that the top principal values
130
+ 118 are much larger than the other values. After eliminating $d / 1 0 0$ principal components, where d is the
131
+ 119 dimension of a word representation, they achieve better performance on both intrinsic and extrinsic
132
+ 120 tasks. Sachidananda et. al. [37] applied this simple pre-processing approach to their Filtered Inner
133
+ 121 Product Projection (FIPP) alignment method, and they significantly improve on the BLI task.
134
+
135
+ # 2.2 Spectral Statistics of Embeddings
136
+
137
+ 123 Dubossarsky et. al. [11] recently documented how cross-lingual alignment is strongly affected by the
138
+ 124 spectral statistics of monolingual embeddings. We stack the embedded vectors $x _ { L } ^ { \bar { i } } \in \mathbb { R } ^ { d }$ as rows in
139
+ 125 a $n \times d$ matrix $A \in \mathbb { R } ^ { n \times d }$ . The SVD decomposes $A$ into $U { \boldsymbol { \Sigma } } V ^ { \top }$ where $U$ and $V$ contain the left
140
+ 126 and right singular vectors, and the singular values $\sigma _ { 1 } \geq \sigma _ { 2 } \geq . . . \geq \sigma _ { d } \geq 0$ are on the diagonal of $\Sigma$ .
141
+ 127 The effedefined 128 $A$ s a smo where therewith k compone. The effec
142
+ $\mathsf { e r } ( A ) = e ^ { H } ( \Sigma )$ $\begin{array} { r } { H ( \Sigma ) = - \sum _ { i = 1 } ^ { d } \bar { \sigma } _ { i } \log \bar { \sigma } _ { i } } \end{array}$ $\bar { \sigma } _ { i } = { \sigma _ { i } } / { \sum _ { i = 1 } ^ { d } { \sigma _ { i } } }$
143
+ condition number $\kappa _ { \mathsf { e f f } } ( A ) = \sigma _ { 1 } / \sigma _ { \mathsf { e r } ( A ) }$ , which replaces the numerator (of condition number, $\sigma _ { d . }$ )
144
+ 130 with the more robust singular value at the effective rank. This is desired to be small in stable data
145
+ 131 sets. The joint effective condition number measures the harmonic mean of the effective condition
146
+ 132 number across two matrices A, A0 as ECOND-HM(A, A0) = 2κeff(A)κeff(A0)κ (A)+κ (A0) . The singular value gap
147
+ 133 measures how similar the singular value sequences are between two matrices as $\operatorname { s v g } ( A , A ^ { \prime } ) =$
148
+ 134 $\textstyle \sum _ { i = 1 } ^ { d } ( \log \sigma _ { i } - \log \sigma _ { i } ^ { \prime } ) ^ { 2 }$ . These should both be smaller, for more comparable data sets.
149
+ 135 Dubossarsky et. al. [11] applied these to monolingual embeddings and demonstrated that the
150
+ 136 performance of several CLWE methods were closely tied to these spectral properties. Basically
151
+ 137 embeddings align better if they are better jointly conditioned, especially measured via joint effective
152
+ 138 condition number and the singular value gap. Motivated by this idea, we propose methods that
153
+ 139 spectrally normalize embeddings improving these statistics while retaining intra-embedding meaning.
154
+ 141 We introduce more direct and more general techniques to normalize monolingual word embeddings
155
+ 142 to more effectively prepare them for alignment. The goal is to remove language-specific geometry
156
+ 143 while maintaining the intrinsic similarity and structure captured within them.
157
+
158
+ # 144 3.1 Geometric Median Normalization
159
+
160
+ 145 Iterative Normalization enforces individual word embeddings to have a unit length and each monolin
161
+ 146 gual embedding to have a zero mean through an iterative technique. Wang et. al. [47] showed that
162
+ 147 iterating solutions for these distinct goals will eventually converge to a solution which satisfies both.
163
+ 148 In this paper, we observe that both goals can be done in one shot without iterating – by solving the
164
+ 149 Fermat-Weber problem [27, 25]. This dates to the 17th century, and corresponds with identifying the
165
+ 150 geometric median of a point set. Formally, the goal is a point $x ^ { * } \in \mathbb { R } ^ { d }$ that minimizes the sum of
166
+ 151 distances from $n$ anchor points $\{ a _ { 1 } , \ldots , \dot { a _ { n } } \} \subset \bar { \mathbb { R } } ^ { d }$ which are not collinear: $\begin{array} { r } { x ^ { * } = \operatorname* { m i n } _ { x } \sum _ { i = 1 } ^ { n } \| x - { } } \end{array}$
167
+ 152 $a _ { i } \|$ . Several methods [6, 12, 32] have been proposed; the most popular is the Weiszfeld’s algorithm
168
+ 153 (Weiszfeld, see Appendix A). It is folklore that the solution $x ^ { * }$ satisfies that $\begin{array} { r } { 0 = \sum _ { i = 1 } ^ { n } { \frac { a _ { i } - x ^ { * } } { \left\| a _ { i } - x ^ { * } \right\| } } } \end{array}$ k we ;
169
+ 154 do not know of a written proof, so prove this in Appendix A.1 for completeness.
170
+ 155 Using this characteristic of the geometric median, we can simultaneously enforce monolingual
171
+ 156 word embeddings to have unit-length and zero-mean in just one step. This can be done using the
172
+ 157 Geometric Median normalization (GeoMediaN) algorithm (as Algorithm 1). Given a monolingual
173
+ 158 word embedding $A$ , we compute the geometric median $x ^ { * }$ , and "center" the data on this point, and
174
+ 159 unit length normalizes the centered embedding.
175
+
176
+ # Algorithm 1 Geometric Median Normalization: GeoMediaN(A)
177
+
178
+ 1: x∗ ← Weiszfeld(A)
179
+ 2: for all $a _ { i } \in A$ do $\begin{array} { r } { a _ { i } \frac { a _ { i } - x ^ { * } } { \| a _ { i } - x ^ { * } \| } } \end{array}$
180
+ 3: return A
181
+ 60 After these steps, all vectors are unit length, and because of the folklore property (Theorem A.1), the
182
+ 61 mean of those points is also 0. As a result, we can state the following property.
183
+
184
+ 162 Theorem 3.1. The output of GeoMediaN $( A )$ is centered and length normalized.
185
+
186
+ 163 Despite the Geometric Median Normalization algorithm’s ability to enforce unit-length and zero
187
+ 164 mean in just one step, we will observe that it does not perform especially well on the BLI task.
188
+ 165 Both GeoMediaN and $\mathrm { I - C + L }$ achieve one of many solutions which achieve these joint goals. We
189
+ 166 next investigate another one that works better: it preserves meaning and structure, and removes
190
+ 167 language-specific geometry allowing improved alignment.
191
+
192
+ # 168 3.2 Spectral Normalization
193
+
194
+ 169 The predominant effect of unit-length and zero-mean normalization on monolingual word embeddings
195
+ 170 is that it makes embedding vectors from a language lie on a hypersphere with the center of the
196
+ 171 hypersphere centered at the origin. However, this does not take into account how the word embeddings
197
+ 172 vectors are spread out or clustered on the hypersphere. Approaches like PCA removal and mean
198
+ 173 centering have the effect of reducing the top principal component or top singular vector. As a result,
199
+ 174 if the spectral properties are extreme, it can help regularize them. However, this approach can be a
200
+ 175 bit blunt. PCA removal makes the top singular value exactly 0, so the condition number becomes
201
+ 176 infinite. Other quantities like the effective condition number, $\kappa _ { \mathsf { e f f } } ( A )$ , do however, tend to decrease.
202
+ 177 To this effect, we propose a new algorithm Spectral Normalization that more gently regularizes
203
+ 178 the spectral properties of word embeddings; see Algorithm 2. We will then combine it with other
204
+ 179 approaches to again ensure the embedding vectors lie on the unit sphere.
205
+
206
+ # Algorithm 2 Spectral Normalization $( { \mathsf { S p e c N o r m } } ( A , \beta ) )$
207
+
208
+ 1: Compute $\mathsf { s v d } ( A ) = U \Sigma V ^ { \top }$ ; Let $D \in \mathbb { R } ^ { d }$ be a diagonal matrix.
209
+ 2: Compute $\eta = \sqrt { \| A \| _ { F } ^ { 2 } / d }$ , where $d$ is the dimension of the word embedding
210
+ 3: for $i = 1 , \ldots , d$ do
211
+ 4: if $\left( \Sigma _ { i i } > \beta \eta \right)$ then $D _ { i i } \Sigma _ { i i } / ( \beta \eta )$
212
+ 5: else $D _ { i i } = 1$ .
213
+ 6: return $A V D ^ { - 1 }$
214
+ 180 Given a monolingual word embedding $A$ it updates part of the spectral properties of $A$ as a whole,
215
+ 181 using on a parameter $\beta \geq 0$ . Based on an average of singular values $\eta = \sqrt { \| A \| _ { F } ^ { 2 } / d }$ , if a value is
216
+ 182 above $\beta$ times that average, it adjusts it to $\beta \eta$ . Hence, all of the top directions are given the same
217
+ 183 singular value. Otherwise, if it is below $\beta \eta$ , it is considered a minor effect (some are quite small,
218
+ 184 and fairly noisy), and it is left alone. If these small ones are completely zeroed out, the critical
219
+ 185 information within is destroyed. However, if these small ones are also given the same value (i.e., $\beta \eta )$
220
+ 186 then components which do not contribute to the most prevalent aspects of a vectors similarity is given
221
+ 187 more importance, and we observed (see Section 4.1) that the usefulness of the embedding decreased.
222
+ 188 Iterative Spectral Normalization. Spectral normalization makes the most sense (see Appendix
223
+ 189 G) in a setting where the vectors are already centered, and also unit length. While SpecNorm does
224
+ 190 not change the center of the data, it does not maintain the length of individual vectors. As such, we
225
+ 191 advocate combining these methods into a single iterative algorithm: $\scriptstyle \mathrm { I - C + S N + L }$ as in Algorithm 3.
226
+
227
+ Algorithm 3 Iterative Spectral Normalization with $\mathrm { C + L }$ normalization (I-C+SN+L(A, #Iter))
228
+
229
+ 1: for #Iter steps do
230
+ 2: A ← Center A
231
+ 3: A ← SpecNorm(A)
232
+ 4: A ← Unit length normalization of A
233
+ 5: return A
234
+ 192 We observe in Figure 1 that this process significantly improves the spectral properties, compare to
235
+ 193 any other approach. Without preprocessing (None), the languages (EN: English, DE: German, HI:
236
+ 194 Hindi, JA: Japanese shown) have large effective condition numbers – indicating that there is a large
237
+ 195 disparity between meaningful singular values. Note the y-axis is in log scale. Hence, aligning these
238
+ 196 languages without normalization would likely restrict alignment among top singular vectors, not
239
+ 197 allowing enough degree of freedom to align corresponding words.
240
+ 198 In contrast, after preprocessing when these values are more uniform, rotations among the dimensions
241
+ 199 containing the top principal components will not have an influence on the data distribution, and
242
+ 200 can fully optimize the alignment between words. Moreover, Figure 1 shows that $\mathbf { I - C + S N + L }$ most
243
+ 201 decreases the effective condition number, joint effective condition number, and singular value gap.
244
+ 202 Further, these values are fairly uniform across languages, despite great variation beforehand (as
245
+ 203 shown with None). In fact, $\scriptstyle \mathrm { I - C + S N + L }$ is much more effective than other methods.
246
+ 205 We provide an evaluation of our proposed preprocessing methods using 8 language embeddings
247
+ 206 pretrained on Wikipedia [4] of each language: Croatian (HR), English (EN), Finnish (FI), French
248
+ 207 (FR), German (DE), Italian (IT), Russian (RU), and Turkish (TR). We use the 300-dimensional
249
+ 208 fastText $[ 4 ] ^ { 1 }$ embeddings, and all vocabularies are trimmed to the 200K most frequent words.
250
+ 209 Alignment evaluation tasks: BLI We evaluate and compare our proposed preprocessing methods
251
+ 210 mostly on the Bilingual Lexicon Induction (BLI) task, a word translation task. We discuss two more
252
+ 211 global applications Cross-lingual document classification (CLDC), and Cross-lingual transfer for
253
+ 212 natural language inference (XNLI) later. BLI is more direct, and has become the de facto evaluation
254
+ 213 task for CLWE models. For words in the source language, this task retrieves the nearest neighbors in
255
+ 214 the target language after alignment to check if it contains the translation. It reports the mean average
256
+ 215 precision (MAP) [15], which is equivalent to the mean reciprocal rank (MRR), of the translation.
257
+ 216 Unless stated otherwise, reported values on baseline methods are taken from [15], and use the Google
258
+ 217 Translate (GTrans) dictionary from $[ 1 5 ] ^ { 2 }$ . We trained (aligned) using 1k, 3k and 5k source words and
259
+ 218 evaluated (tested) on separate 2k source test queries, unless noted otherwise.
260
+ 219 Alignment Algorithms. We evaluated and compared the result of several supervised rigid
261
+ 220 transformation CLWE models on the evaluation benchmarks using our proposed methods. All
262
+ 221 have publically available code, links are found in the reference citation. These include Canonical
263
+ 222 Correlation Analysis (CCA) [13], Procrustes (PROC) [2, 38, 45, 10], Bootstrapping Procrustes
264
+ 223 (PROC-B) [15], and Discriminative Latent-Variable (DLV) [36], as discussed in Section 1. We also
265
+ 224 consider Ranking-Based Optimization (RCSLS) [21] which is not a rigid alignment. In a few places,
266
+ 225 we also compare with VECMAP [3] as an example of an unsupervised alignment process. This should
267
+ 226 only use the geometry of the global embedding structure, e.g., derived from the natural ontology, and
268
+ 227 our normalization method still helps when using this approach.
269
+
270
+ ![](images/4457cfc7c0f470ce62ba0a8960c8b44495e221a08fec678f9a5a67f4ed9b61fb.jpg)
271
+ Figure 1: Spectral Measures of four (4) monolingual word embeddings, before (None) and after applying various normalization methods.
272
+
273
+ # 4.1 Hyperparameter Tuning
274
+
275
+ Our main proposed algorithm $\scriptstyle \mathrm { I - C + S N + L }$ has a few simple parameters. To avoid overfitting, we choose these through cross-validation on English (EN) and a held-out set of 5 languages Hindi (HI), Russian (RU), Chinese (ZH), Japanese (JA), Turkish (TR). Ten (10) Language pairs of the form EN-X and X-EN were considered. The hyperparameters $\beta \in \{ 1 , 2 , 3 , 4 , 5 \}$ and #Iter (number of iterations) $\in$ $\{ 1 , 2 , 3 , 4 , 5 \}$ were fine-tuned for $\scriptstyle \mathrm { I - C + S N + L }$ .
276
+
277
+ 234 We used the publicly available MUSE3 translation dictionary [8] for hyperparameter tuning. The
278
+ 235 Procrustes alignment algorithm was trained on $5 \mathrm { k }$ source words and evaluated on $1 . 5 \mathrm { k }$ source test
279
+ 236 queries. We reported the mean average precision (MAP) in Table 1 for $\beta \in \{ 1 , 2 , 3 , 4 , 5 \}$ and with
280
+ 237 #Iter $\in \{ 1 , 2 , 3 , 4 , 5 \}$ . We observe the value of $\beta = 2$ was consistently the best threshold (although
281
+ 238 any $\beta \geq 2$ performed similarly). These singular values were normalized, and those below $\beta$ times the
282
+ 239 average we judged as noise, and left as is. However, the result did not change much with respect to
283
+ 240 the number of iterations.
284
+ 241 The tie between the #Iter hyperparameter was broken using their performance on thirteen English
285
+ 242 word similarity benchmarks; see Appendix C for more details. In Table 2 below, we report the
286
+ 243 average Spearman rank coefficient score on the word similarity task (None means no normalization).
287
+ 244 $( \beta , \# \mathrm { { I t e r } } ) \mathbf { \bar { \Psi } } = \mathbf { \Psi } ( 2 , 5 )$ achieved the highest score. So hereafter, we applying $\scriptstyle \mathrm { I - C + S N + L }$ with the
288
+ 245 hyperparameter $( \beta , \# \mathrm { { I t e r } } ) = ( 2 , 5 )$ .
289
+ 246 Note that the proposed approach $( \mathrm { I - C + S N + L } )$ only increased this score for these similarity tasks, so
290
+ 247 showed no signs of distorting inherent information. Although Spectral Normalization does not exactly
291
+ 248 preserve the linear properties or angular properties (as centering and length normalization do, one each,
292
+ 249 respectively), it does not suffer ill effects. We hypothesize this is because it is somewhat uniformly
293
+ 250 stretching words along the major modes of variation, and is effectively removing information not
294
+ 251 relevant to meaning, like frequency of occurrence. This benign effect is on contrast to other spectral
295
+ 252 adjustments (removing small singular values, or setting all to the same value) shown in Appendix C.
296
+
297
+ Table 1: Cross-Validation for Hyperparameter Tuning: MAP after Procrustes for 10 language pairs.
298
+
299
+ <table><tr><td>β</td><td>#Iter=1</td><td>#Iter=2</td><td>#Iter=3</td><td>#Iter=4</td><td>#Iter=5</td></tr><tr><td>1</td><td>0.363</td><td>0.340</td><td>0.328</td><td>0.322</td><td>0.317</td></tr><tr><td>2</td><td>0.385</td><td>0.386</td><td>0.386</td><td>0.386</td><td>0.386</td></tr><tr><td>3</td><td>0.381</td><td>0.384</td><td>0.384</td><td>0.384</td><td>0.384</td></tr><tr><td>4</td><td>0.381</td><td>0.382</td><td>0.382</td><td>0.382</td><td>0.382</td></tr><tr><td>5</td><td>0.380</td><td>0.381</td><td>0.381</td><td>0.381</td><td>0.381</td></tr></table>
300
+
301
+ Table 2: Monolingual word similarity Task; Average Spearman rank coefficient
302
+
303
+ <table><tr><td>None</td><td></td><td>(β,#Iter)= (2,2)(β,#Iter)= (2,3)(β,#Iter)= (2,4) (β,#Iter)= (2,5)</td><td></td><td></td></tr><tr><td>0.651</td><td>0.67077</td><td>0.67101</td><td>0.67108</td><td>0.67111</td></tr></table>
304
+
305
+ # 4.2 BLI Performance across Normalization and Alignment Algorithms
306
+
307
+ 254 We compare and evaluate the BLI performance (MAP) of various normalization algorithms from
308
+ 255 previous works to our proposed algorithms. Using the MUSE translation dictionary, we trained CCA,
309
+ 256 PROC, PROC-B and RCSLS on $5 \mathrm { k }$ source words and evaluated on $1 . 5 \mathrm { k }$ source test queries. The
310
+ 257 following normalization algorithms were used in the comparison analysis: PR (PCA Removal) [31],
311
+ 258 GeoMediaN (Geometric Median Normalization), $\mathrm { C + L }$ (Mean centering and Length normalization,
312
+ 259 1 round), $\mathrm { I - C + L }$ (Iterative Mean centering and Length normalization, 5 rounds) [47], SN (Spectral
313
+ 260 Normalization, 1 round), $\mathrm { C + S N + L }$ (Mean centering, Spectral Normalization and Length normal
314
+ 261 ization, 1 round), and $_ { \mathrm { I - C + S N + L } }$ (Iterative Mean centering, Spectral Normalization and Length
315
+ 262 normalization, 5 rounds). Specifically, we evaluated 18 language pairs, i.e., English (EN) from/to
316
+ 263 Bulgarian (BG), Catalan (CA), Czech (CS), German (DE), Spanish (ES), Korean (KO), Thai (TH) and
317
+ 264 Chinese (ZH), separate from hyperparameter tuning. The average is reported in Table 3, all results
318
+ 265 are in Appendix G. For almost all algorithms $_ { \mathrm { I - C + S N + L } }$ achieves the best scores (and especially on
319
+ 266 ${ \bf X } _ { L _ { 2 } } \mathrm { - } { \bf E } { \bf N }$ , often considerably better). The only exceptions are on non-rigid RCSLS when $\mathrm { C + S N + L }$
320
+ 267 (with no iteration) or just SN (with $\mathrm { C + L }$ ) performs slightly better. So, Spectral Normalization, and in
321
+ 268 particular $\scriptstyle \mathrm { I - C + S N + L }$ , is shown as the best way to normalize languages before alignment.
322
+ 269 We also compute the average BLI MAP score across all 28 language pair for more direct comparison
323
+ 270 to prior work [15], summarized in Table 4 and Appendix D. All results are in Appendix H. We
324
+ 271 compare $\scriptstyle \mathrm { I - C + S N + L }$ (denoted with SN) against no normalization on various dictionary sizes: 1k, 3k
325
+ 272 and $5 \mathrm { k }$ source words and evaluated on 2k source test queries. In all cases, $\scriptstyle \mathbf { I - C + S N + L }$ significantly
326
+ 273 improves over the baseline. This includes improvement over RCSLS which is non-rigid, so in
327
+ 274 principle could “learn" adjustments similar to our normalization in the process of alignment. We also
328
+ 275 tested on VECMAP, an unsupervised approach; $_ { \mathrm { I - C + S N + L } }$ preprocessing also improves this result
329
+ 276 from 0.375 to 0.410.
330
+
331
+ Table 3: BLI performance (MAP) on aligning $\mathbf { E N - X } _ { L _ { 2 } }$ and ${ \bf X } _ { L _ { 2 } } \mathrm { - } { \bf E } { \bf N }$
332
+
333
+ <table><tr><td></td><td colspan="4">Methods : EN-XL2</td><td colspan="4">Methods : XL_-EN</td></tr><tr><td>Normalization</td><td>CCA</td><td>PROC</td><td>PROC-B</td><td>RCSLS</td><td>CCA</td><td>PROC</td><td>PROC-B</td><td>RCSLS</td></tr><tr><td>None</td><td>0.358</td><td>0.365</td><td>0.377</td><td>0.394</td><td>0.398</td><td>0.399</td><td>0.405</td><td>0.428</td></tr><tr><td>PR</td><td>0.394</td><td>0.391</td><td>0.404</td><td>0.373</td><td>0.434</td><td>0.430</td><td>0.442</td><td>0.425</td></tr><tr><td>GeoMediaN</td><td>0.393</td><td>0.391</td><td>0.400</td><td>0.379</td><td>0.433</td><td>0.432</td><td>0.440</td><td>0.429</td></tr><tr><td>C+L</td><td>0.393</td><td>0.394</td><td>0.408</td><td>0.404</td><td>0.439</td><td>0.437</td><td>0.445</td><td>0.464</td></tr><tr><td>I-C+L</td><td>0.394</td><td>0.395</td><td>0.410</td><td>0.406</td><td>0.439</td><td>0.438</td><td>0.448</td><td>0.460</td></tr><tr><td>SN</td><td>0.391</td><td>0.394</td><td>0.408</td><td>0.405</td><td>0.440</td><td>0.438</td><td>0.451</td><td>0.468</td></tr><tr><td>C+SN+L</td><td>0.395</td><td>0.396</td><td>0.413</td><td>0.407</td><td>0.444</td><td>0.444</td><td>0.458</td><td>0.466</td></tr><tr><td>I-C+SN+L</td><td>0.396</td><td>0.398</td><td>0.414</td><td>0.406</td><td>0.445</td><td>0.446</td><td>0.461</td><td>0.466</td></tr></table>
334
+
335
+ Table 4: Summary of BLI performance (MAP), average scores for all 28 language pairs. No normalization results from [15], against $_ { \mathrm { I - C + S N + L } }$ (denoted SN).
336
+
337
+ <table><tr><td></td><td></td><td>CCCC</td><td>PPRD</td><td>PPPPRD</td><td>PPPPRE</td><td>PPPPSRP</td><td></td><td>NsATQ</td><td></td><td>PSSSSY PSSSS</td></tr><tr><td>1K</td><td>.289</td><td>.314</td><td>.299</td><td>.326</td><td>.379</td><td>.407</td><td>.289</td><td>.332</td><td>.331</td><td>.331</td></tr><tr><td>3K</td><td>.378</td><td>.401</td><td>.384</td><td>.408</td><td>.398</td><td>.415</td><td>.381</td><td>.429</td><td>.415</td><td>.427</td></tr><tr><td>5K</td><td>.400</td><td>.423</td><td>.405</td><td>.429</td><td>1</td><td>1</td><td>.403</td><td>.452</td><td>.437</td><td>.460</td></tr></table>
338
+
339
+ # 277 4.3 Downstream Tasks
340
+
341
+ We conclude by demonstrating that Spectral Normalization not only improves in direct translation tasks, but also captures an important global structure that generalizes from a high resource language (i.e., English, EN) to lower resource languages. In both examples, a powerful classifier is trained on the EN embedding (after normalization), and then we demonstrate that after a lower resource language (e.g., German, DE) has been normalized and align the analysis task can be directly applied to that language. And in particular, adding the simple process of our normalization $( \mathrm { I - C + S N + L }$ ) dramatically improves the results over not doing that step.
342
+
343
+ 285 Cross-lingual Document Classification (CLDC). The CLDC task builds a topic classification
344
+ 286 using a language model on a high resource language (in our case English EN) across 15 topics.
345
+ 287 The TED CLDC corpus assembled by [19] was used for training and evaluation. Following [15]
346
+ 288 a simple CNN was used to train. Table 5 summarizes the average F1-score for all topic classifiers
347
+ 289 on 5 language pairs. The CLWEs induced by $\mathrm { P R O C ^ { S N } }$ , PROC- $\cdot \breve { \mathbf { B } } ^ { \mathsf { S N } }$ , ${ \bf D } { \bf U } ^ { { \sf S } { \sf N } }$ , and $\mathrm { R C S L S ^ { S N } }$ (using
348
+ 290 $\scriptstyle \mathrm { I - C + S N + L }$ ) outperformed the baseline result (with no normalization) on the CLDC task, significantly
349
+ 291 improving the best average score from 0.421 to 0.461. Glavas et.al. [15] use only 12 of 15 topics,
350
+ 292 but could not confirm which, so we re-ran all baselines using all 15 topics.
351
+ 293 Cross-lingual Natural Language Inference (XNLI). We evaluated the CLWE on a cross-lingual
352
+ 294 natural language inference (XNLI) task. We used a multi-lingual XNLI corpus created by [9], which
353
+ 295 is a collection of sentence pairs from the English MultiNLI corpus [44] translated into 14 languages.
354
+ 296 The MultiNLI corpus contains $4 3 3 \mathrm { k }$ sentence pairs with the labels entailment, contradiction, and
355
+ 297 neutral. The intersection between XNLI languages and BLI languages result in four XNLI evaluation
356
+ 298 pairs: EN-DE, EN-FR. EN-TR and EN-RU. We use the training setup in [15] with the Enhanced
357
+ 299 Sequential Inference Model [7] on English after normalization. First, we aligned normalized versions
358
+ 300 of each language onto the normalized EN embedding to obtain the shared cross-lingual embedding.
359
+ 301 Then we used the $5 \mathrm { k }$ test pairs from the XNLI corpus to evaluate each language alignment. Table 6
360
+ 302 shows the result for PROC, PROC-B, and RCSLS alignments (DLV and VECMAP transform the
361
+ 303 EN embedding in the process, so were omitted). We compare against the same procedure without
362
+
363
+ Table 5: CLDC performance (micro-averaged $F _ { 1 }$ scores). Cross-lingual transfer EN–X
364
+
365
+ <table><tr><td>Model</td><td>Dict</td><td>EN-DE</td><td>EN-FR</td><td>EN-IT</td><td>EN-RU</td><td>EN-TR</td><td>Avg</td></tr><tr><td>PROC</td><td>5K</td><td>.366</td><td>.258</td><td>.338</td><td>.288</td><td>.278</td><td>.306</td></tr><tr><td>PROCSN</td><td>5K</td><td>.436</td><td>.366</td><td>.427</td><td>.517</td><td>.511</td><td>.451</td></tr><tr><td>PROC-B</td><td>3K</td><td>.364</td><td>.304</td><td>.299</td><td>.336</td><td>.317</td><td>.324</td></tr><tr><td>PROC-BSN</td><td>3K</td><td>.448</td><td>.396</td><td>.423</td><td>.522</td><td>.517</td><td>.461</td></tr><tr><td>DLV</td><td>5K</td><td>.419</td><td>.336</td><td>.397</td><td>.493</td><td>.458</td><td>.421</td></tr><tr><td>DLVSN</td><td>5K</td><td>.433</td><td>.323</td><td>.406</td><td>.499</td><td>.472</td><td>.427</td></tr><tr><td>RCSLS</td><td>5K</td><td>.466</td><td>.397</td><td>.403</td><td>.403</td><td>.406</td><td>.415</td></tr><tr><td>RCSLSSN</td><td>5K</td><td>.468</td><td>.500</td><td>.443</td><td>.488</td><td>.394</td><td>.459</td></tr></table>
366
+
367
+ normalization from Glavas et.al. [15]304 $( \mathrm { I - C + S N + L }$ normalization denoted SN ). As in other experiments, 305 our normalization improves the average test accuracy with each alignment approach.
368
+
369
+ Table 6: XNLI performance (test set accuracy)
370
+
371
+ <table><tr><td>Model</td><td>Dict</td><td>EN-DE</td><td>EN-FR</td><td>EN-TR</td><td>EN-RU</td><td>Avg</td></tr><tr><td>PROC PROCSN</td><td>5K 5K</td><td>.607 .611</td><td>.534 .638</td><td>.568 .542</td><td>.585 .596</td><td>.574 .597</td></tr><tr><td>PROC-B PROC-BSN</td><td>3K 3K</td><td>.615 .624</td><td>.532 .638</td><td>.573 .548</td><td>.599 .601</td><td>.580 .603</td></tr><tr><td>RCSLS RCSLSSN</td><td>5K 5K</td><td>.390 .499</td><td>.363 .482</td><td>.387 .504</td><td>.399 .556</td><td>.385 .510</td></tr></table>
372
+
373
+ # 306 5 Conclusion & Discussion
374
+
375
+ 307 We introduce a new way to normalize embeddings, based on spectral normalization, for use in creating
376
+ 308 cross-lingual word embeddings. Our approach generalizes previous approaches, and effectively
377
+ 309 removes much of the clustering of words based on properties other than the similarity which encodes
378
+ 310 meaning. When used to individually preprocess monolingual embeddings, our approach allows
379
+ 311 any alignment procedure to find better alignments: resulting in improved performance on direct
380
+ 312 translation tasks as well as cross-lingual topic classification and natural language inference tasks.
381
+ 313 Social impacts. The vast majority of NLP research and cutting-edge advancements are in English.
382
+ 314 This disadvantages those who primarily operate in other languages, with less developed models, or
383
+ 315 less data to train models. As large language models are the cornerstone of most NLP research and
384
+ 316 development in English, one of this work’s main goals is to port these advances to other languages,
385
+ 317 and those who use them. This will help unlock this technology to many others around the world. As
386
+ 318 with most models, this accuracy and improvement may vary across tasks and languages.
387
+ 319 While language models have many positive use cases including improving accessibility, better
388
+ 320 recommendations, and increased automation, they have some negative effects as well. These include
389
+ 321 requiring potentially large computational and hence environmental cost, encoding and exacerbating
390
+ 322 bias, and aiding in automatically generating fake or deceitful content. While this paper is unlikely to
391
+ 323 change the desire to use embeddings, it aims to reduce the burden of use and increase the effectiveness
392
+ 324 in lower-resource settings. And in particular to port models trained in English to other languages.
393
+ 325 This would reduce the cost of retraining in other languages if the English model can be reused, easing
394
+ 326 environmental costs. We support the maturing efforts in attenuating bias in all such embeddings.
395
+ 327 And while we acknowledge the possibility of this work aiding in the automated creation of deceitful
396
+ 328 content and the harm it can cause, we believe the many benefits outweigh the harms.
397
+
398
+ Limitations. The overarching goal in this line of work is to port the many advances built on embeddings from high-resource settings (like built on the English language), to lower-resource settings (like Turkish). This work can apply a powerful model built on an English language model (e.g., for natural language inference) and automatically invoke it in Turkish after the embeddings have been aligned. However, the alignment will not be any better than the low-resource embedding. If the embedding is too noisy or limited, then the analysis will likely not be effective.
399
+
400
+ 335 Also, this work focuses on non-contextual embeddings like FastText, but not contextual ones like
401
+ 336 RoBERTa which have proven almost universally more effective in NLP on English. While in principle
402
+ 337 a normalization function and alignment could be applied to contextual settings, we are unaware of
403
+ 338 any technique for learning these mappings. We believe it could be important future work.
404
+
405
+ Data, Code, and Experiments. All existing methods are compared with publicly available code with publicly available data, with links above or in references. The exception is code for CLDC and XNLI is shared by Glavás et.al. [15]. Everything is run with default parameters; the exception is RCSLS were we follow the suggested hyperparameter selection strategy [21] (with learning rate in $\{ 1 , 1 0 , 2 5 , 5 0 \}$ and epoch number in $\{ 1 0 , 2 0 \}$ ). Our new code for SpecNorm is in Appendix E.
406
+
407
+ References
408
+ [1] Eneko Agirre, Enrique Alfonseca, Keith Hall, Jana Kravalova, Marius Pa¸sca, and Aitor Soroa. A study on similarity and relatedness using distributional and WordNet-based approaches. In Proceedings of Human Language Technologies: The 2009 Annual Conference of the North American Chapter of the Association for Computational Linguistics, pages 19–27, Boulder, Colorado, June 2009. Association for Computational Linguistics.
409
+ [2] Mikel Artetxe, Gorka Labaka, and Eneko Agirre. Learning principled bilingual mappings of word embeddings while preserving monolingual invariance. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2289–2294, Austin, Texas, November 2016. Association for Computational Linguistics.
410
+ [3] Mikel Artetxe, Gorka Labaka, and Eneko Agirre. A robust self-learning method for fully unsupervised cross-lingual mappings of word embeddings. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 789–798, Melbourne, Australia, July 2018. Association for Computational Linguistics. https: //github.com/artetxem/vecmap.
411
+ [4] 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.
412
+ [5] Elia Bruni, Gemma Boleda, Marco Baroni, and Nam-Khanh Tran. Distributional semantics in technicolor. In Proceedings of the 50th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 136–145, 2012.
413
+ [6] Jacques Antonin Chatelon, Donald W Hearn, and Timothy J Lowe. A subgradient algorithm for certain minimax and minisum problems. Mathematical Programming, 15(1):130–145, 1978.
414
+ [7] Qian Chen, Xiaodan Zhu, Zhen-Hua Ling, Si Wei, Hui Jiang, and Diana Inkpen. Enhanced LSTM for natural language inference. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1657–1668, Vancouver, Canada, July 2017. Association for Computational Linguistics.
415
+ [8] Alexis Conneau, Guillaume Lample, Marc’Aurelio Ranzato, Ludovic Denoyer, and Hervé Jégou. Word translation without parallel data, 2018.
416
+ [9] Alexis Conneau, Ruty Rinott, Guillaume Lample, Adina Williams, Samuel Bowman, Holger Schwenk, and Veselin Stoyanov. XNLI: Evaluating cross-lingual sentence representations. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 2475–2485, Brussels, Belgium, October-November 2018. Association for Computational Linguistics.
417
+ [10] Sunipa Dev, Safia Hassan, and Jeff M Phillips. Absolute orientation for word embedding alignment. Knowledge and Information Systems, 2021.
418
+ [11] Haim Dubossarsky, Ivan Vulic, Roi Reichart, and Anna Korhonen. The secret is in the spectra: ´ Predicting cross-lingual task performance with spectral similarity measures. In EMNLP, 2020.
419
+ [12] James W Eyster, John A White, and Walter W Wierwille. On solving multifacility location problems using a hyperboloid approximation procedure. AIIE Transactions, 5(1):01–06, 1973.
420
+ [13] Manaal Faruqui and Chris Dyer. Improving vector space word representations using multilingual correlation. In Proceedings of the 14th Conference of the European Chapter of the Association for Computational Linguistics, pages 462–471, Gothenburg, Sweden, April 2014. Association for Computational Linguistics.
421
+ [14] Lev Finkelstein, Evgeniy Gabrilovich, Yossi Matias, Ehud Rivlin, Zach Solan, Gadi Wolfman, and Eytan Ruppin. Placing search in context: The concept revisited. In Proceedings of the 10th international conference on World Wide Web, pages 406–414, 2001.
422
+
423
+ 91 [15] Goran Glavaš, Robert Litschko, Sebastian Ruder, and Ivan Vulic. How to (properly) evaluate ´
424
+ 92 cross-lingual word embeddings: On strong baselines, comparative analyses, and some miscon
425
+ 93 ceptions. In Proceedings of the 57th Annual Meeting of the Association for Computational
426
+ 94 Linguistics, pages 710–721, 2019. https://github.com/codogogo/xling-eval?utm_
427
+ 95 source $=$ catalyzex.com.
428
+ 96 [16] Stephan Gouws, Yoshua Bengio, and Greg Corrado. Bilbowa: Fast bilingual distributed
429
+ 97 representations without word alignments. In Francis Bach and David Blei, editors, Proceedings
430
+ 98 of the 32nd International Conference on Machine Learning, volume 37 of Proceedings of
431
+ 99 Machine Learning Research, pages 748–756, Lille, France, 07–09 Jul 2015. PMLR.
432
+ 00 [17] Jiang Guo, Wanxiang Che, David Yarowsky, Haifeng Wang, and Ting Liu. Cross-lingual
433
+ dependency parsing based on distributed representations. In Proceedings of the 53rd Annual
434
+ 02 Meeting of the Association for Computational Linguistics and the 7th International Joint
435
+ 03 Conference on Natural Language Processing (Volume 1: Long Papers), pages 1234–1244,
436
+ Beijing, China, July 2015. Association for Computational Linguistics.
437
+ 05 [18] Guy Halawi, Gideon Dror, Evgeniy Gabrilovich, and Yehuda Koren. Large-scale learning of
438
+ 06 word relatedness with constraints. In Proceedings of the 18th ACM SIGKDD international
439
+ 07 conference on Knowledge discovery and data mining, pages 1406–1414, 2012.
440
+ 08 [19] Karl Moritz Hermann and Phil Blunsom. Multilingual models for compositional distributed
441
+ 09 semantics. In Proceedings of the 52nd Annual Meeting of the Association for Computational
442
+ 10 Linguistics (Volume 1: Long Papers), pages 58–68, Baltimore, Maryland, June 2014. Association
443
+ for Computational Linguistics.
444
+ 12 [20] Geert Heyman, Ivan Vulic, and Marie-Francine Moens. Bilingual lexicon induction by learning ´
445
+ 13 to combine word-level and character-level representations. In Proceedings of the 15th Con
446
+ 14 ference of the European Chapter of the Association for Computational Linguistics: Volume 1,
447
+ 15 Long Papers, pages 1085–1095, Valencia, Spain, April 2017. Association for Computational
448
+ 16 Linguistics.
449
+ [21] Armand Joulin, Piotr Bojanowski, Tomas Mikolov, Hervé Jégou, and Edouard Grave. Loss
450
+ 18 in translation: Learning bilingual word mapping with a retrieval criterion. In Proceedings
451
+ 19 of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 2979–
452
+ 20 2984, Brussels, Belgium, October-November 2018. Association for Computational Linguistics.
453
+ https://github.com/facebookresearch/fastText/tree/master/alignment.
454
+ 22 [22] Mladen Karan, Ivan Vulic, Anna Korhonen, and Goran Glavaš. Classification-based self- ´
455
+ 23 learning for weakly supervised bilingual lexicon induction. In Proceedings of the 58th Annual
456
+ Meeting of the Association for Computational Linguistics, pages 6915–6922, Online, July 2020.
457
+ 25 Association for Computational Linguistics.
458
+ 26 [23] Alexandre Klementiev, Ivan Titov, and Binod Bhattarai. Inducing crosslingual distributed
459
+ 27 representations of words. In Proceedings of COLING 2012, pages 1459–1474, Mumbai, India,
460
+ 28 December 2012. The COLING 2012 Organizing Committee.
461
+ 29 [24] Guillaume Lample, Myle Ott, Alexis Conneau, Ludovic Denoyer, and Marc’Aurelio Ranzato.
462
+ 30 Phrase-based & neural unsupervised machine translation. In Proceedings of the 2018 Conference
463
+ 31 on Empirical Methods in Natural Language Processing, pages 5039–5049, Brussels, Belgium,
464
+ 32 October-November 2018. Association for Computational Linguistics.
465
+ [25] Robert F Love, James G Morris, and George O Wesolowsky. Facilities location. 1988.
466
+ 34 [26] Minh-Thang Luong, Richard Socher, and Christopher D Manning. Better word representations
467
+ 35 with recursive neural networks for morphology. In Proceedings of the seventeenth conference
468
+ 36 on computational natural language learning, pages 104–113, 2013.
469
+ 37 [27] EA Maxwell. 100 great problems of elementary mathematics: their history and solution. By
470
+ 38 Heinrich Dorme, translated by David. Ustin Pp. x, 393. $\$ 2.00$ . 1965.(Dover). The Mathematical
471
+ 39 Gazette, 50(372):213–213, 1966.
472
+
473
+ 40 [28] Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013.
474
+
475
+ [29] Tomáš Mikolov, Wen-tau Yih, and Geoffrey Zweig. Linguistic regularities in continuous space word representations. In Proceedings of the 2013 conference of the north american chapter of the association for computational linguistics: Human language technologies, pages 746–751, 2013.
476
+ [30] George A Miller and Walter G Charles. Contextual correlates of semantic similarity. Language and cognitive processes, 6(1):1–28, 1991.
477
+ [31] Jiaqi Mu, Suma Bhat, and Pramod Viswanath. All-but-the-top: Simple and effective postprocessing for word representations. CoRR, abs/1702.01417, 2017.
478
+ [32] Michael L Overton. A quadratically convergent method for minimizing a sum of euclidean norms. Mathematical Programming, 27(1):34–63, 1983.
479
+ [33] Jeffrey Pennington, Richard Socher, and Christopher Manning. GloVe: Global vectors for word representation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1532–1543, Doha, Qatar, October 2014. Association for Computational Linguistics.
480
+ [34] Kira Radinsky, Eugene Agichtein, Evgeniy Gabrilovich, and Shaul Markovitch. A word at a time: computing word relatedness using temporal semantic analysis. In Proceedings of the 20th international conference on World wide web, pages 337–346, 2011.
481
+ [35] Herbert Rubenstein and John B Goodenough. Contextual correlates of synonymy. Communications of the ACM, 8(10):627–633, 1965.
482
+ [36] Sebastian Ruder, Ryan Cotterell, Yova Kementchedjhieva, and Anders Søgaard. A discriminative latent-variable model for bilingual lexicon induction. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 458–468, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. https://github.com/ sebastianruder/latent-variable-vecmap.
483
+ [37] Vin Sachidananda, Ziyi Yang, and Chenguang Zhu. Filtered Inner Product Projection for Multilingual Embedding Alignment. arXiv e-prints, page arXiv:2006.03652, June 2020.
484
+ [38] Samuel L. Smith, David H. P. Turban, Steven Hamblin, and Nils Y. Hammerla. Offline bilingual word vectors, orthogonal transformations and the inverted softmax. CoRR, abs/1702.03859, 2017.
485
+ [39] Wasi Uddin Ahmad, Zhisong Zhang, Xuezhe Ma, Eduard Hovy, Kai-Wei Chang, and Nanyun Peng. On Difficulties of Cross-Lingual Transfer with Order Differences: A Case Study on Dependency Parsing. arXiv e-prints, page arXiv:1811.00570, November 2018.
486
+ [40] Yehuda Vardi and Cun-Hui Zhang. The multivariate l1-median and associated data depth. Proceedings of the National Academy of Sciences, 97(4):1423–1426, 2000.
487
+ [41] Ivan Vulic, Goran Glavaš, Roi Reichart, and Anna Korhonen. Do We Really Need Fully ´ Unsupervised Cross-Lingual Embeddings? arXiv e-prints, page arXiv:1909.01638, September 2019.
488
+ [42] Ivan Vulic and Marie-Francine Moens. Monolingual and cross-lingual information retrieval models based on (bilingual) word embeddings. Proceedings of the 38th International ACM SIGIR Conference on Research and Development in Information Retrieval, 2015.
489
+ [43] Zirui Wang, Jiateng Xie, Ruochen Xu, Yiming Yang, Graham Neubig, and Jaime G. Carbonell. Cross-lingual alignment vs joint training: A comparative study and A simple unified framework. CoRR, abs/1910.04708, 2019.
490
+ [44] Adina Williams, Nikita Nangia, and Samuel Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pages 1112–1122, New Orleans, Louisiana, June 2018. Association for Computational Linguistics.
491
+ [45] Chao Xing, Dong Wang, Chao Liu, and Yiye Lin. Normalized word embedding and orthogonal transform for bilingual word translation. In Proceedings of the 2015 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1006–1011, Denver, Colorado, May–June 2015. Association for Computational Linguistics.
492
+ [46] Dongqiang Yang and David Martin Powers. Verb similarity on the taxonomy of WordNet. Masaryk University, 2006.
493
+ [47] Mozhi Zhang, Keyulu Xu, Ken-ichi Kawarabayashi, Stefanie Jegelka, and Jordan Boyd-Graber. Are girls neko or shojo? cross-lingual alignment of non-isomorphic embeddings with iterative ¯ normalization. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3180–3189, Florence, Italy, July 2019. Association for Computational Linguistics. https://github.com/zhangmozhi/iternorm?utm_source $=$ catalyzex.com.
494
+
495
+ # Checklist
496
+
497
+ 1. For all authors...
498
+
499
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
500
+ (b) Did you describe the limitations of your work? [Yes]
501
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes]
502
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
503
+
504
+ 2. If you are including theoretical results...
505
+
506
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes]
507
+
508
+ 3. If you ran experiments...
509
+
510
+ (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]
511
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
512
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A]
513
+ (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]
514
+
515
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
516
+
517
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
518
+ (b) Did you mention the license of the assets? [N/A]
519
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] See code in Appendix E.
520
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
521
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
522
+
523
+ 5. If you used crowdsourcing or conducted research with human subjects...
524
+
525
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
526
+
527
+ 534 (b) Did you describe any potential participant risks, with links to Institutional Review
528
+ 535 Board (IRB) approvals, if applicable? [N/A]
529
+ 536 (c) Did you include the estimated hourly wage paid to participants and the total amount
530
+ 537 spent on participant compensation? [N/A]
md/train/A7pvvrlv68/A7pvvrlv68.md ADDED
@@ -0,0 +1,255 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Parallel Bayesian Optimization of Multiple Noisy Objectives with Expected Hypervolume Improvement
2
+
3
+ Samuel Daulton Facebook, University of Oxford sdaulton@fb.com
4
+
5
+ Maximilian Balandat Facebook balandat@fb.com
6
+
7
+ Eytan Bakshy Facebook ebakshy@fb.com
8
+
9
+ # Abstract
10
+
11
+ Optimizing multiple competing black-box objectives is a challenging problem in many fields, including science, engineering, and machine learning. Multi-objective Bayesian optimization (MOBO) is a sample-efficient approach for identifying the optimal trade-offs between the objectives. However, many existing methods perform poorly when the observations are corrupted by noise. We propose a novel acquisition function, NEHVI, that overcomes this important practical limitation by applying a Bayesian treatment to the popular expected hypervolume improvement (EHVI) criterion and integrating over this uncertainty in the Pareto frontier. We argue that, even in the noiseless setting, generating multiple candidates in parallel is an incarnation of EHVI with uncertainty in the Pareto frontier and therefore can be addressed using the same underlying technique. Through this lens, we derive a natural parallel variant, $q \mathrm { N E H V I }$ , that reduces computational complexity of parallel EHVI from exponential to polynomial with respect to the batch size. $q \mathrm { N E H V I }$ is one-step Bayes-optimal for hypervolume maximization in both noisy and noiseless environments, and we show that it can be optimized effectively with gradient-based methods via sample average approximation. Empirically, we demonstrate not only that $q \mathrm { N E H V I }$ is substantially more robust to observation noise than existing MOBO approaches, but also that it achieves state-of-the-art optimization performance and competitive wall-times in large-batch environments.
12
+
13
+ # 1 Introduction
14
+
15
+ Black-box optimization problems that involve multiple competing noisy objectives are ubiquitous in science and engineering. For example, a real-time communications service may be interested in tuning the parameters of a control policy to adapt video quality in real time in order to maximize video quality and minimize latency [10, 17]. In robotics, scientists may seek to design hardware components that maximize locomotive speed and minimize energy expended [8, 38]. In agriculture, development agencies may seek to balance crop yield and environmental impact [28]. For such multi-objective optimization (MOO) problems, there typically is no single solution that is best with respect to all objectives. Rather, the goal is to identify the Pareto frontier: a set of optimal trade-offs such that improving one objective means deteriorating another. In many cases, the objectives are expensive to evaluate. For instance, randomized trials used in agriculture and the internet industry may take weeks or months to conduct and incur opportunity costs, and manufacturing and testing hardware is both costly and time-consuming. Therefore, it is imperative to be able to identify good trade-offs with as few objective evaluations as possible.
16
+
17
+ Bayesian optimization (BO), a method for efficient global black-box optimization, is often used to tackle such problems. BO employs a probabilistic surrogate model in conjunction with an acquisition function to navigate the trade-off between exploration (evaluating designs with high uncertainty) and exploitation (evaluating designs that are believed to be optimal). Although a significant number of works have explored multi-objective Bayesian optimization (MOBO), most available methods [3, 39, 51, 60] do not take into account the fact that, in practice, observations are often subject to noise. For example, results of an A/B test are highly variable due to heterogeneity in the underlying user population and other factors. Agricultural trials are affected by the stochastic nature of plant growth and environmental factors such as soil composition or wind currents. In robotics, devices are subject to manufacturing tolerances, and observations of quantities such as locomotive speed and efficiency may be corrupted by measurement error from noisy sensors and environmental factors such as temperature or surface friction. While previous work has shown that a principled treatment of noisy observations can significantly improve optimization performance in the single-objective case [24, 37], this issue is understudied in the multi-objective setting. Furthermore, many applications in which evaluations take a long time require evaluating large batches of candidates in parallel in order to achieve reasonable throughput. For example, when firms optimize systems via A/B tests, it may take several weeks to test any particular configuration. Because of this, large batches of candidate policies are tested simultaneously [36]. In biochemistry and materials design, dozens of tests can be conducted parallel on a single microplate [63]. Even in sophisticated high throughput chemistry settings, these batches may take several hours or days to set up and evaluate [42]. Most existing MOBO methods, however, are either designed for purely sequential optimization [3, 51] or do not scale well to large batch sizes [11].
18
+
19
+ Contributions: In this work, we propose a novel MOBO algorithm, based on expected hypervolume improvement (EHVI), that scales to highly parallel evaluations of noisy objectives. Our approach is made possible by a general-purpose, differentiable, cached box decomposition (CBD) implementation that dramatically speeds up critical computations needed to account for uncertainty introduced by noisy observations and generate new candidate points for highly parallel batch or asynchronous evaluation. In particular, our CBD-based approach solves the fundamental problem of scaling parallel EHVI-based methods to large batch sizes, reducing time and space complexity from exponential to polynomial. Our proposed algorithm, noisy expected hypervolume improvement (NEHVI), is the onestep Bayes-optimal policy for hypervolume improvement and provides state-of-the-art performance across a variety of benchmarks. To our knowledge, our work provides the most extensive evaluation of noisy parallel MOBO to date. A high-quality implementation of $q \mathrm { N E H V I }$ , as well as many of the baselines considered here, will be made available as open-source software upon publication.
20
+
21
+ # 2 Preliminaries
22
+
23
+ Our goal is to find the set of optimal designs $_ { \textbf { \em x } }$ over a bounded set $\mathcal { X } \subset \mathbb { R } ^ { d }$ that maximize one or more objectives $\pmb { f } ( \pmb { x } ) \in \mathbb { R } ^ { M }$ , with no known analytical expression nor gradient information of $f$ .
24
+
25
+ Multi-Objective Optimization (MOO) aims to identify the set of Pareto optimal objective tradeoffs. We say a solution ${ \pmb f } ( { \pmb x } ) = \left[ f ^ { ( 1 ) } ( { \pmb x } ) , . . . , f ^ { ( M ) } ( { \pmb x } ) \right]$ dominates another solution $\pmb { f } ( \pmb { x } ) \succ \pmb { f } ( \pmb { x } ^ { \prime } )$ if $f ^ { ( m ) } ( { \pmb x } ) \geq f ^ { ( m ) } ( { \pmb x } ^ { \prime } )$ for $m = 1 , . . . , M$ and $\exists m \in \{ 1 , . . . , M \}$ s.t. $f ^ { ( m ) } ( { \pmb x } ) > f ^ { ( m ) } ( { \pmb x } ^ { \prime } )$ . We define the Pareto frontier as ${ \mathcal { P } } ^ { * } = \{ { \pmb { f } } ( { \pmb { x } } ) : { \pmb { x } } \in { \pmb { \chi } }$ , $\nexists \mathbf { \boldsymbol { x } } ^ { \prime } \in \mathcal { X }$ s.t. $f ( { \pmb x } ^ { \prime } ) \succ f ( { \pmb x } ) \}$ , and denote the set of Pareto optimal designs as $\mathcal { X } ^ { \ast } = \{ \pmb { x } : \pmb { f } ( \pmb { x } ) \in \mathcal { P } ^ { * } \}$ . Since the Pareto frontier (PF) is often an infinite set of points, MOO algorithms usually aim to identify a finite approximate PF $\mathcal { P }$ . A natural measure of the quality of a PF is the hypervolume of the region of objective space that is dominated by the PF and bounded from below by a reference point. Provided with the approximate PF, the decision-maker can select a particular Pareto optimal trade-off according to their preferences.
26
+
27
+ Bayesian Optimization (BO) is a sample-efficient optimization method that leverages a probabilistic surrogate model to make principled decisions to balance exploration and exploitation [19, 50]. Typically, the surrogate is a Gaussian Process (GP), a flexible, non-parametric model known for its well-calibrated predictive uncertainty [47]. To decide which points to evaluate next, BO employs an acquisition function $\alpha ( \cdot )$ that specifies the value of evaluating a set of new points $_ { \textbf { \em x } }$ based on the surrogate’s predictive distribution at . While evaluating the true black-box function $f$ is timeconsuming or costly, evaluating the surrogate is cheap and relatively fast; therefore, numerical optimization can be used to find the maximizer of the acquisition function $\pmb { x } ^ { * } = \arg \operatorname* { m a x } _ { \pmb { x } \in \mathcal { X } } \alpha ( \pmb { x } )$ to evaluate next on the black-box function. BO sequentially selects new points to evaluate and updates the model to incorporate the new observations.
28
+
29
+ Evolutionary algorithms (EAs) such as NSGA-II [12] are a popular choice for solving MOO problems (see Zitzler et al. [67] for a review of various other approaches). However, EAs generally suffer from high sample complexity, rendering them infeasible for optimizing expensive-to-evaluate black-box functions. Multi-objective Bayesian optimization (MOBO), which combines a Bayesian surrogate with an acquisition function designed for MOO, provides a much more sample-efficient alternative.
30
+
31
+ # 3 Related Work
32
+
33
+ Methods based on hypervolume improvement (HVI) seek to expand the volume of the objective space dominated by the Pareto frontier. Expected hypervolume improvement (EHVI) [16] is a natural extension of the popular expected improvement (EI) [29] acquisition function to the MOO setting. Recent work has led to efficient computational paradigms using box decomposition algorithms [59] and practical enhancements such as support for parallel candidate generation and gradient-based acquisition optimization [11, 58]. However, EHVI still suffers from some limitations, including (i) the assumption that observations are noise-free, and (ii) the exponential scaling of its batch variant, $q \mathrm { E H V I }$ , in the batch size $q$ , which precludes large-batch optimization. DGEMO [39] is a recent method for parallel MOBO that greedily maximizes HVI while balancing the diversity of the design points being sampled. Although DGEMO scales well to large batch sizes, it does not account for noisy observations. TSEMO [5] is a Thompson sampling (TS) heuristic that can acquire batches of points by optimizing a random fourier feature (RFF) [46] approximation of a GP surrogate using NSGA-II and selecting a subset of points from the EA’s population to sequentially greedily maximize HVI. This heuristic approach for maximizing HVI currently has no theoretical guarantees and relies on zeroth-order optimization methods, which tend to be slower and exhibit worse optimization performance than gradient-based approaches.
34
+
35
+ Entropy-based methods such as PESMO [25], MESMO [3], and PFES [51] are an alternative to EHVI. Of these three methods, PESMO is the only one that accounts for observation noise. However, PESMO involves intractable entropy computations and therefore relies on complex approximations, as well as challenging and time-consuming numerical optimization procedures [25]. Garrido-Merchán & Hernández-Lobato [21] recently proposed an extension to PESMO that supports parallel candidate generation. However, the authors of this work provide limited evaluation and have not provided code to reproduce their results.1
36
+
37
+ MOO can also be cast into a single-objective problem by applying a random scalarization of the objectives. ParEGO maximizes the expected improvement using random augmented Chebyshev scalarizations [32]. MOEA/D-EGO [64] extends ParEGO to the batch setting using multiple random scalarizations and the genetic algorithm MOEA/D [65] to optimize these scalarizations in parallel. Recently, $q \mathrm { P a r E G O }$ , another batch variant of ParEGO was proposed that uses compositional Monte Carlo objectives and sequential greedy candidate selection [11]. Additionally, the authors proposed a noisy variant, qNParEGO, but the empirical evaluation of that variant was limited. TS-TCH [45] combines random Chebyshev scalarizations with Thompson sampling [54], which is naturally robust to noise when the objective is scalarized. Golovin & Zhang [23] propose to use a hypervolume scalarization with the property that the expected value of the scalarization over a specific distribution of weights is equivalent to the hypervolume indicator. The authors propose a upper confidence bound algorithm using randomly sampled weights, but provide a very limited empirical evaluation.
38
+
39
+ Many prior attempts by the simulation community to handle MOO with noisy observations found that accounting for the noise did not improve optimization performance: Horn et al. [26] suggest that the best approach is to ignore noise, and Koch et al. [33] concluded that further research was needed to determine if modeling techniques such as re-interpolation could improve BO performance with noisy observations. In contrast, we find that accounting for noise does substantially improve performance in noisy settings.
40
+
41
+ Lastly, previous works have considered methods for quantifying and monitoring uncertainty in the Pareto frontiers during the optimization [4, 7]. In contrast, we provide a solution to performing MOBO in noisy settings, rather than purely reasoning about the uncertainty in the Pareto frontier.
42
+
43
+ # 4 Background on Expected Hypervolume Improvement
44
+
45
+ In this section, we review hypervolume, hypervolume improvement, and expected hypervolume improvement as well as efficient methods for computing these metrics using box decompositions.
46
+
47
+ Definition 1. The hypervolume indicator (HV) of a finite approximate Pareto frontier $\mathcal { P }$ is the $M$ -dimensional Lebesgue measure $\lambda _ { M }$ of the space dominated by $\mathcal { P }$ and bounded from below by $a$ reference point. $\begin{array} { r } { \pmb { r } \in \mathbb { R } ^ { M } \colon \mathrm { H V } ( \mathcal { P } | \pmb { r } ) = \lambda _ { M } \big ( \bigcup _ { \pmb { v } \in \mathcal { P } } [ \pmb { r } , \pmb { v } ] \big ) } \end{array}$ , where $[ r , v ]$ denotes the hyper-rectangle bounded by vertices $\mathbfit { \Delta } \mathbf { r }$ and $\textbf { { v } }$ .
48
+
49
+ As in previous work, we assume that the reference point $\pmb { r }$ is known and specified by the decision maker [58].
50
+
51
+ Definition 2. The hypervolume improvement (HVI) of a set of points ${ \mathcal { P } } ^ { \prime } w . r . t .$ . an existing approximate Pareto frontier $\mathcal { P }$ and reference point $\pmb { r }$ is defined $a s ^ { 2 } \operatorname { H V I } ( \mathcal { P } ^ { \prime } | \mathcal { P } , \boldsymbol { r } ) = \operatorname { H V } ( \mathcal { P } \cup \mathcal { P } ^ { \prime } | \boldsymbol { r } ) - \operatorname { H V } ( \mathcal { P } | \boldsymbol { r } ) .$
52
+
53
+ Computing HV requires calculating the volume of a typically non-rectangular polytope and is known to have time complexity that is super-polynomial in the number of objectives [59]. An efficient approach for computing HV is to (i) decompose the region that is dominated by the Pareto frontier $\mathcal { P }$ and bounded from below by the reference point $\mathbfit { \Delta } \mathbf { r }$ into disjoint axis-aligned hyperrectangles [34], (ii) compute the volume of each hyperrectangle in the decomposition, and (iii) sum over all hyperrectangles. So-called box decomposition algorithms have also been applied to partition the region that is not dominated by the Pareto frontier $\mathcal { P }$ , which can be used to compute the HVI from a set of new points [15, 59]. See Appendix $\mathbf { B }$ for further details.
54
+
55
+ Expected Hypervolume Improvement: Since function values at unobserved points are unknown in black-box optimization, so is the HVI of an out-of-sample point. However, in BO the probabilistic surrogate model provides a posterior distribution $p ( \pmb { f } ( \pmb { x } ) | \bar { \mathcal { D } } )$ over the function values for each $_ { \textbf { \em x } }$ , which can be used to compute the expected hypervolume improvement (EHVI) acquisition function: $\alpha _ { \mathrm { E H V I } } ( \pmb { x } | \mathcal { P } ) = \mathbb { E } \big [ \mathrm { H V I } ( \mathbf { \dot { f } } ( \pmb { x } ) | \mathcal { P } ) \big ]$ . Although $\alpha _ { \mathrm { E H V I } }$ can be expressed analytically when (i) the objectives are assumed to be conditionally independent given $_ { \textbf { \em x } }$ and (ii) the candidates are generated and evaluated sequentially [58], Monte Carlo (MC) integration is commonly used since it does not require either assumption [16]. The more general parallel variant using MC integration is given by
56
+
57
+ $$
58
+ \alpha _ { q \mathrm { E H V I } } \big ( \mathcal { X } _ { \mathrm { c a n d } } \big | \mathcal { P } \big ) \approx \hat { \alpha } _ { q \mathrm { E H V I } } \big ( \mathcal { X } _ { \mathrm { c a n d } } \big | \mathcal { P } \big ) = \frac { 1 } { N } \sum _ { t = 1 } ^ { N } \mathrm { H V I } \big ( \tilde { f } _ { t } \big ( \mathcal { X } _ { \mathrm { c a n d } } \big ) \big | \mathcal { P } \big ) ,
59
+ $$
60
+
61
+ where $\tilde { f } _ { t } \sim p ( f | \mathcal { D } )$ for $t = 1 , . . . , N$ and $\mathcal { X } _ { \mathrm { c a n d } } = \{ x _ { i } \} _ { i = 1 } ^ { q }$ [11]. The same box decomposition algorithms used to compute HVI can be used to compute EHVI (either analytic or via MC) using piece-wise integration. EHVI computation is agnostic to the choice of box decomposition algorithm (and can also use approximate methods [9]). Similar to EI in the single-objective case, EHVI is a one-step Bayes-optimal algorithm for maximizing hypervolume in the MOO setting under the following assumptions: (i) only a single design will be generated and evaluated, (ii) the observations are noise-free, (iii) the final approximate Pareto frontier (and final design that will be deployed) will be drawn from the set of observed points [19].
62
+
63
+ # 5 Expected Hypervolume Improvement with Noisy Observations
64
+
65
+ We consider the case that frequently arises in practice where we only receive noisy observations ${ \pmb y } _ { i } = f ( { \pmb x } _ { i } ) + \epsilon _ { i }$ , $\epsilon _ { i } \sim \mathcal { N } ( 0 , \mathbf { \bar { \Sigma } } _ { i } )$ , where $\Sigma _ { i }$ is the noise covariance. In this setting, EHVI is no longer (one-step) Bayes-optimal. This is because we can no longer compute the true Pareto frontier ${ \mathcal { P } } _ { n } { \overset { \cdot } { = } } \{ f ( { \pmb x } ) \mid { \overset { \cdot } { \pmb x } } \in { \dot { X } } _ { n }$ , $\bar { \nexists } \boldsymbol { x ^ { \prime } } \in X _ { n }$ s.t. $f ( { \pmb x } ^ { \prime } ) \succ f ( { \pmb x } ) \}$ over the previously evaluated points $X _ { n } =$ $\{ { \pmb x } _ { i } \} _ { i = 1 } ^ { n }$ . Simply using the observed Pareto frontier, $\mathcal { V } _ { n } = \{ \pmb { y } \vert \pmb { y } \in Y _ { n }$ , $\bar { \nexists } \ : y ^ { \prime } \in Y _ { n }$ s.t. $y ^ { \prime } \succ y , y \}$ where $\bar { Y } _ { n } = \{ { \pmb y } _ { i } \} _ { i = 1 } ^ { n }$ , can have strong detrimental effects on optimization performance. This is illustrated in Figure 1, which shows how EHVI is misled by noisy observations that appear to be Pareto optimal. EHVI proceeds to spend its evaluation budget trying to optimize noise, resulting in a clumped Pareto frontier that lacks diversity. Although the posterior mean could serve as a "plug-in" estimate of the true function values at the observed points and provide some regularization [61], we find that this heuristic also leads to clustered Pareto frontiers (EHVI-PM in Fig. 1). Similar patterns emerge with DGEMO (which does not account for noise), and other baselines that utilize the posterior mean rather than the observed values when computing hypervolume improvement (see Appendix H). To our knowledge, all previous work on EHVI assumes that observations are noiseless [16, 58] or imputes the unknown true function values with the posterior mean.
66
+
67
+ ![](images/956f97dc2146646d797257b5483737aca4c5f1c6a8ae6460f9c3c6c2a9f3f493.jpg)
68
+ Figure 1: An illustration of the effect of noisy observations on the true noiseless Pareto frontiers identified by NEHVI (our proposed algorithm), EHVI, and EHVI-PM, which uses the modeled posterior mean as point estimate of the true in-sample function values. All algorithms are tested on a BraninCurrin synthetic problem, where observations are corrupted with zero-mean, additive Gaussian noise with a standard deviation of $5 \%$ of the range of respective objective. All methods use sequential $( q = 1 )$ ) optimization. See Appendix G for details.
69
+
70
+ # 5.1 A Bayes-optimal algorithm for hypervolume maximization in noisy environments
71
+
72
+ In contrast with EHVI(-PM), we instead approach the problem of hypervolume maximization under noisy observations from a Bayesian perspective and derive a novel one-step Bayes-optimal expected hypervolume improvement criterion that iterates the expectation over the posterior distribution $p \big ( \bar { f } ( X _ { n } ) | \mathcal { D } _ { n } \big )$ of the function values at the previously evaluated points $X _ { n }$ given noisy observations $\mathcal { D } _ { n } = \{ \mathbf { { \boldsymbol { x } } } _ { i } , \mathbf { { \boldsymbol { y } } } _ { i } , ( \Sigma _ { i } ) \} _ { i = 1 } ^ { n }$ . Our acquisition function, noisy expected hypervolume improvement (NEHVI), is defined as
73
+
74
+ $$
75
+ \alpha _ { \mathrm { N E H V I } } ( { \pmb x } ) = \int \alpha _ { \mathrm { E H V I } } ( { \pmb x } | \mathcal { P } _ { n } ) p ( { \pmb f } | \mathcal { D } _ { n } ) d { \pmb f }
76
+ $$
77
+
78
+ where $P _ { n }$ denotes the Pareto frontier over $f ( X _ { n } )$ .
79
+
80
+ By integrating over the uncertainty in the function values at the observed points, NEHVI retains one-step Bayes-optimality in noisy environments (in noiseless environments, NEHVI is equivalent to EHVI). Empirically, Figure 1 shows that NEHVI is robust to noise and identifies a well-distributed Pareto frontier with no signs of clumping, even under very noisy observations.3
81
+
82
+ The integral in (2) is analytically intractable, but can easily be approximated using MC integration. Let $\tilde { \pmb { f } } _ { t } \sim p ( \pmb { f } | D _ { n } )$ for $t = 1 , . . . N$ be samples from the posterior, and let $\mathcal { P } _ { t } ~ { = } ~ \{ \tilde { f } _ { t } ( { \pmb x } ) \} ~ \mathbf { { \sigma } } | ~ { \pmb x } ~ \in$ $X _ { n } , \tilde { { f } } _ { t } ( { \pmb x } ) \succ \tilde { { f } } _ { t } ( { \pmb x } ^ { \prime } ) \forall { \pmb x } ^ { \prime } \in X _ { n } \}$ be the Pareto frontier over the previously evaluated points under the sampled function $\tilde { \pmb { f } } _ { t }$ . Then, $\begin{array} { r } { \alpha _ { \mathrm { N E H V I } } ( \pmb { x } ) \approx \frac { 1 } { N } \sum _ { t = 1 } ^ { N } \alpha _ { \mathrm { E H V I } } ( \pmb { x } | \mathcal { P } _ { t } ) } \end{array}$ . Using MC integration, we can compute the inner expectation in $\alpha _ { \mathrm { E H V I } }$ simultaneously using samples from the joint posterior $\tilde { \pmb f _ { t } } ( X _ { n } , \pmb x ) \sim p ( \pmb f ( X _ { n } , \pmb x ) | \mathcal D _ { n } )$ over $_ { \textbf { \em x } }$ and $X _ { n }$ :
83
+
84
+ $$
85
+ \hat { \alpha } _ { \mathrm { N E H V I } } ( \pmb { x } ) = \frac { 1 } { N } \sum _ { t = 1 } ^ { N } \mathrm { H V I } ( \tilde { \pmb { f } _ { t } } ( \pmb { x } ) | \mathcal { P } _ { t } ) .
86
+ $$
87
+
88
+ See Appendix B for details on computing (3) using box decompositions. Note that this “full-MC” variant of NEHVI does not require objectives to be modeled independently, and supports multi-task covariance functions across correlated objectives.
89
+
90
+ # 5.2 Parallel Noisy Expected Hypervolume Improvement
91
+
92
+ Generating and evaluating batches of candidates is imperative to achieving adequate throughput in many real-world scenarios. qNEHVI can naturally be extended to the parallel (asynchronous or batch) setting by evaluating HVI with respect to a batch of $q$ points $\mathcal { X } _ { \mathrm { c a n d } } = \{ \pmb { x } _ { i } \} _ { i = 1 } ^ { q }$
93
+
94
+ $$
95
+ \varepsilon _ { q \mathrm { N E H V I } } ( \mathcal { X } _ { \mathrm { c a n d } } ) = \int \alpha _ { q \mathrm { E H V I } } ( \mathcal { X } _ { \mathrm { c a n d } } | \mathcal { P } _ { n } ) p ( f | \mathcal { D } _ { n } ) d f \approx \hat { \alpha } _ { q \mathrm { N E H V I } } ( \mathcal { X } _ { \mathrm { c a n d } } ) = \frac { 1 } { N } \sum _ { t = 1 } ^ { N } \mathrm { H V I } ( \tilde { f } _ { t } ( \mathcal { X } _ { \mathrm { c a n d } } ) | \mathcal { P } _ { t } )
96
+ $$
97
+
98
+ Since optimizing $q$ candidates jointly is a difficult numerical optimization problem over a qddimensional domain, we use a sequential greedy approximation in the parallel setting and solve a sequence of $q$ simpler optimization problems with $d$ dimensions, which been shown empirically to improve optimization performance [57]. While selecting candidates according to a “sequential greedy” policy does not guarantee that the selected batch of candidates is a maximizer of the $\alpha _ { q \mathrm { N E H V I } }$ the submodularity of $\alpha _ { q \mathrm { N E H V I } }$ allows us to bound the regret of this approximation to be no more than $\frac { 1 } { e } \alpha _ { q \mathrm { N E H V I } } ^ { * }$ , where $\begin{array} { r } { \alpha _ { q \mathrm { N E H V I } } ^ { * } = \operatorname* { m a x } _ { \mathcal { X } _ { \mathrm { c a n d } } \in \mathcal { X } } \alpha _ { q \mathrm { N E H V I } } ( \mathcal { X } _ { \mathrm { c a n d } } ) } \end{array}$ (see Appendix F).
99
+
100
+ 3This noise level is ${ 5 } \mathbf { x }$ greater than the ones considered by previous works that evaluate noisy MOBO [25].
101
+
102
+ # 6 Efficient Evaluation with Cached Box Decompositions
103
+
104
+ Although $\hat { \alpha } _ { \mathrm { N E H V I } } ( \pmb { x } )$ in (3) has a concise mathematical form, computing it requires determining the Pareto frontier $\mathcal { P } _ { t }$ under each sample $\tilde { f } _ { t }$ for $t = 1 , . . . , N$ and then partitioning the region that is not dominated by $\mathcal { P } _ { t }$ into disjoint hyperrectangles $\{ S _ { k _ { t } } \} _ { k _ { t } = 1 } ^ { K _ { t } }$ . Optimizing the unbiased MC estimator of $\alpha _ { \mathrm { { N E H V I } } }$ would require re-sampling $\{ \tilde { f } _ { t } \} _ { t = 1 } ^ { N }$ at each evaluation of $\alpha _ { \mathrm { { N E H V I } } }$ . However, computing the Pareto frontier and performing a box decomposition under each of the $N$ samples during every evaluation of $\alpha _ { \mathrm { N E H V I } }$ in the inner optimization loop $\begin{array} { r } { ( \pmb { x } ^ { * } = \arg \operatorname* { m a x } _ { \pmb { x } } \alpha _ { \mathrm { N E H V I } } ( \pmb { x } | \mathcal { D } _ { n } ) ) } \end{array}$ would be prohibitively expensive. This is because box decomposition algorithms have super-polynomial time complexity in the number of objectives [59]. We instead propose an efficient alternative computational technique for repeated evaluations of EHVI with uncertain Pareto frontiers.
105
+
106
+ Cached Box Decompositions: For repeated evaluations of the integral in (2), we use a set of fixed samples $\{ \tilde { f } _ { t } ( X _ { n } ) \} _ { t = 1 } ^ { N }$ , which allows us to compute the Pareto frontiers and box decompositions once, and cache them for the entirety of the acquisition function optimization, thereby making those two computationally intensive operations a one-time cost per BO iteration.4 We refer to this approach as using cached box decompositions (CBD). The method of optimizing over fixed random samples is known as sample average approximation (SAA) [2].
107
+
108
+ Conditional Posterior Sampling: Under the CBD formulation, computing $\hat { \alpha } _ { \mathrm { N E H V I } } ( \pmb { x } )$ with joint samples from $\tilde { \pmb f _ { t } } ( X _ { n } , \pmb x ) \sim p ( \pmb f ( X _ { n } , \pmb x ) | \mathcal D _ { n } )$ requires sampling from the conditional distributions
109
+
110
+ $$
111
+ \tilde { { f } } _ { t } ( x ) \sim p \big ( f ( x ) | f ( X _ { n } ) = \tilde { f } _ { t } ( X _ { n } ) , \mathcal { D } _ { n } \big ) ,
112
+ $$
113
+
114
+ where $t = 1 , . . . , N$ and $\{ \tilde { f } _ { t } ( X _ { n } ) \} _ { t = 1 } ^ { N }$ are the realized samples at the previously evaluated points. For multivariate Gaussian posteriors (as is the case with GP surrogates), we can sample from $p ( f ( X _ { n } ) | \mathcal { D } _ { n } )$ via the reparameterization trick [30] by evaluating $\begin{array} { r } { \tilde { \pmb f } _ { t } ( { \pmb x } ) = { \pmb \mu } _ { n } + L _ { n } ^ { T } \zeta _ { n , t } } \end{array}$ , where $\zeta _ { n , t } \sim \mathcal { N } ( \mathbf { 0 } , I _ { n M } )$ , $\pmb { \mu _ { n } } \in \mathbb { R } ^ { n M }$ is the posterior mean, and $L _ { n } \in \mathbb { R } ^ { n M \times n M }$ is a lower triangular root decomposition of the posterior covariance matrix, typically a Cholesky decomposition. Given $L _ { n }$ , we can obtain a root decomposition $L _ { n } ^ { \prime }$ of the covariance matrix of the joint posterior $p ( f ( X _ { n } , \pmb { x } ) | \mathcal { D } _ { n } )$ by performing efficient low-rank updates [44]. Given $L _ { n } ^ { \prime }$ and the posterior mean of $p ( f ( X _ { n } , \pmb { x } ) | \mathcal { D } _ { n } )$ , we can sample from (5) via the reparameterization trick by augmenting the existing base samples $\zeta _ { n , t }$ with $M$ new base samples for the new point.
115
+
116
+ # 6.1 Efficient Sequential Greedy Batch Selection using CBD
117
+
118
+ The CBD technique addresses the general problem of inefficient repeated evaluations of EHVI with uncertain Pareto frontiers. In this section, we show that sequential greedy batch selection (with both $q \mathrm { E H V I }$ and $q \mathrm { N E H V I }$ is an incarnation of EHVI with uncertain Pareto frontiers.
119
+
120
+ The original formulation of parallel EHVI in Daulton et al. [11] uses the inclusion-exclusion principle (IEP), which involves computing the volume jointly dominated by each of the $2 ^ { q } - 1$ nonempty subsets of points in $\mathcal { X } _ { \mathrm { c a n d } }$ . However, using large batch sizes is not computationally feasible under this formulation because time and space complexity are exponential in $q$ and multiplicative in the number of hyperrectangles in the box decomposition [11] (see Appendix D for a complexity analysis). Although $q \mathrm { E H V I }$ is optimized using sequential greedy batch selection, the IEP is used over all candidates $\pmb { x } _ { 1 } , . . . , \pmb { x } _ { i }$ when selecting candidate $i$ . Although the IEP could similarly be used to compute $q \mathrm { N E H V I }$ , we instead leverage CBD, which yields a sequential greedy approximation of the joint (noisy) EHVI that is mathematically equivalent to the IEP formulation, but significantly reduces computational overhead. That is, the IEP and CBD approaches produce exactly the same acquisition value for a given set of points $\mathcal { X } _ { \mathrm { c a n d } }$ , but the IEP and the CBD approaches have exponential and polynomial time complexities in $q$ , respectively.
121
+
122
+ When selecting $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ for $i \in \{ 2 , \ldots , q \}$ , all $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { j } }$ for which $j < i$ have already been selected and are therefore held constant. Thus, we can decompose $q \mathrm { N E H V I }$ into the $q \mathrm { N E H V I }$ from the previously selected candidates $\pmb { x } _ { 1 } , \ldots , \pmb { x } _ { i - 1 }$ and NEHVI from $\mathbf { \boldsymbol { x } } _ { i }$ given the previously selected candidates
123
+
124
+ ![](images/a468f1bb1946757538c10a82e4cba5957f0190cedcd03a0cdcef5e345becbb5b.jpg)
125
+ Figure 2: Acquisition optimization wall time under a sequential greedy approximation using L-BFGS-B. CBD enables scaling to much larger batch sizes $q$ than using the IEP and avoids running out-of-memory (OOM) on a GPU. Independent GPs are used for each outcome. The Pareto frontier of of the 2-objective, 6- dimensional DTLZ2 problem [13] is initialized with 20 points. Wall times were measured on a Tesla V100 SXM2 GPU (16GB RAM) and a $2 \mathbf { x }$ Intel Xeon 6138 CPU $@$ 2GHz (251GB RAM). See Appendix H.2 for results with more objectives.
126
+
127
+ $$
128
+ \tilde { \tau } _ { q \mathrm { N E H V I } } ( \{ x _ { j } \} _ { j = 1 } ^ { i } ) = \frac { 1 } { N } \sum _ { t = 1 } ^ { N } \mathrm { H V I } \big ( \{ \tilde { f } _ { t } ( x _ { j } ) \} _ { j = 1 } ^ { i - 1 } \big \} | \mathcal { P } _ { t } \big ) + \frac { 1 } { N } \sum _ { t = 1 } ^ { N } \mathrm { H V I } \big ( \tilde { f } _ { t } ( x _ { i } ) | \mathcal { P } _ { t } \cup \{ \tilde { f } _ { t } ( x _ { j } ) \} _ { j = 1 } ^ { i - 1 } \big \} \big )
129
+ $$
130
+
131
+ Note that the first term on the right hand side is constant, since $\{ { \pmb x } _ { j } \} _ { j = 1 } ^ { i - 1 }$ and $\{ \tilde { f } _ { t } ( \pmb { x } _ { j } ) \} _ { j = 1 } ^ { i - 1 }$ are fixed for all $t = 1 , . . . , N$ . The second term is $\hat { \alpha } _ { \mathrm { N E H V I } } ( \pmb { x } _ { i } )$ , where the NEHVI is taken with respect to the Pareto frontier across $\pmb { f } ( X _ { n } , \pmb { x } _ { 1 } , . . . , \pmb { x } _ { i - 1 } )$ and computed using the fixed samples $\{ \tilde { f } _ { t } ( X _ { n } , \pmb { x } _ { 1 } , . . . \pmb { x } _ { i - 1 } ) \} _ { t = 1 } ^ { N }$ . To compute the second term when selecting candidate $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ , the $N$ Pareto frontiers and CBDs are updated to include $\{ \tilde { f } _ { t } ( X _ { n } , \pmb { x } _ { 1 } , . . . \pmb { x } _ { i - 1 } ) \} _ { t = 1 } ^ { N }$ . As in the sequential $q = 1$ setting, the box decompositions are only computed and cached while selecting each candidate point. See Appendix C.2 for a derivation of (6). Although we have focused on $q \mathrm { N E H V I }$ in the above, the CBD formulation for $q \mathrm { E H V I }$ is obtained by simply replacing $\mathcal { P } _ { t }$ with the Pareto frontier over the observed values ${ \mathcal { V } } _ { n }$ .
132
+
133
+ Despite computing $N$ box decompositions when selecting each candidate $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ for $i = 2 , . . . , q$ , the CBD approach reduces the time and space complexity from exponential (under the IEP) to polynomial in $q$ (see Appendix $\mathrm { D }$ for details on time and space complexity). Figure 2 shows the total acquisition optimization time (including box decompositions) for various batch sizes and demonstrates that using CBD allows to scale to batch sizes that are completely infeasible when using IEP.
134
+
135
+ # 7 Optimizing NEHVI
136
+
137
+ Differentiability: Importantly, $\hat { \alpha } _ { \mathrm { N E H V I } } ( \pmb { x } )$ is differentiable w.r.t. $_ { \textbf { \em x } }$ . Although determining the Pareto frontier and computing the box decompositions are non-differentiable operations, these operations do not involve $_ { \textbf { \em x } }$ , even when re-sampling from the joint posterior $p ( f ( X _ { n } , \pmb { x } ) | \mathcal { D } _ { n } )$ . Exact sample-path gradients of $\nabla _ { \pmb { x } } \hat { \alpha } _ { \mathrm { N E H V I } } ( \pmb { x } )$ can easily be computed using auto-differentiation in modern computational frameworks. This enables efficient gradient-based optimization of $q \mathrm { N E H V I }$ .5
138
+
139
+ SAA Convergence Results: In addition to approximating the outer expectation over $f ( X _ { n } )$ with fixed posterior samples, we can similarly fix the base samples used for the new candidate point $_ { \textbf { \em x } }$ This approach yields a deterministic acquisition function, which enables using (quasi-) higher-order optimization methods to obtain fast convergence rates for acquisition optimization [2]. Importantly, we prove that the theoretical convergence guarantees on acquisition optimization under the SAA approach proposed by Balandat et al. [2] also hold for NEHVI.
140
+
141
+ Theorem 1. Suppose $\mathcal { X }$ is compact and $f$ has a multi-output $G P$ prior with continuously differentiable mean and covariance functions. Let $X _ { n } = \{ \pmb { x } _ { i } \} _ { i = 1 } ^ { n }$ denote the previously evaluated points and $\{ \zeta \} _ { t = 1 } ^ { N }$ be base samples $\zeta \sim \mathcal { N } ( \mathbf { 0 } , I _ { ( n + 1 ) M } )$ . Let $\hat { \alpha }$ NEHVI denote the deterministic acquisition function computed using $\{ \zeta \} _ { t = 1 } ^ { N }$ as $\hat { \alpha } _ { \mathrm { N E H V I } } ^ { N }$ and define $S ^ { * } : = \arg \operatorname* { m a x } _ { { \pmb x } \in { \pmb X } }$ $\alpha _ { \mathrm { N E H V I } } ( \pmb { x } )$ to be the set of maximizers of $\alpha _ { \mathrm { N E H V I } } ( \pmb { x } )$ over $\mathcal { X }$ . Suppose $\hat { \pmb { x } } _ { N } ^ { * } \in \arg \operatorname* { m a x } _ { { \pmb { x } } \in { \mathcal { X } } } \hat { \alpha } _ { \mathrm { N E H V I } } ^ { N } ( { \pmb { x } } )$ . Then $( l )$ $\hat { \alpha } _ { \mathrm { N E H V I } } ^ { N } ( \hat { \pmb { x } } _ { N } ^ { * } ) \alpha _ { \mathrm { N E H V I } } ( \pmb { x } _ { N } ^ { * } )$ almost surely, and (2) $\mathrm { d i s t } ( \hat { \pmb { x } } _ { N } ^ { * } , S ^ { * } ) 0$ , where d $l i s t ( \hat { \pmb { x } } _ { N } ^ { * } , S ^ { * } ) : =$ $\mathrm { i n f } _ { { \pmb x } \in S ^ { * } } \| \hat { \pmb x } _ { N } ^ { * } - { \pmb x } \|$ is the Euclidean distance between $\hat { \pmb { x } } _ { N } ^ { * }$ and the set $S ^ { * }$ .
142
+
143
+ Theorem 1 also holds in the parallel setting, so $q \mathrm { N E H V I }$ enjoys the same convergence guarantees as NEHVI on acquisition optimization under the SAA. See Appendix $\mathrm { E }$ for further details and proof.
144
+
145
+ # 8 Approximation of $q$ NEHVI using Approximate GP Sample Paths
146
+
147
+ Although CBD yields polynomial complexity of $q \mathrm { N E H V I }$ with respect to $q$ (rather than exponential complexity with the IEP), it still requires computing $N$ box decompositions and repeatedly evaluating the joint posterior over ${ \pmb f } ( X _ { n } , \{ { \pmb x } _ { j } \} _ { j = 1 } ^ { i - 1 } )$ for selecting each candidate $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ for $i = 1 , . . . , q$ . A cheaper alternative is to approximate the integral in (4) using a single approximate GP sample path $\tilde { \pmb { f } } _ { i }$ using RFFs when optimizing candidate $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ . A single-sample approximation of $q \mathrm { N E H V I }$ , which we refer to as $q \mathrm { N E H V I - 1 }$ , can be computed by using $\tilde { \pmb { f } } _ { i }$ as the sampled GP in (6). Since the RFF is a deterministic model, it is much less computationally expensive to evaluate than the GP posterior on out-of-sample points, and exact gradients of $q \mathrm { N E H V I - 1 }$ with respect to current candidate $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ can be computed and used for efficient multi-start optimization of $q \mathrm { N E H V I - 1 }$ using second-order gradient methods. $q \mathrm { N E H V I - 1 }$ requires CBD for efficient sequential greedy batch selection and gradient-based optimization, but does not use a sample average approximation for optimizing a new candidate $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ ; instead, it uses an approximate sample path. See Rahimi & Recht [46] for details on RFFs.
148
+
149
+ $q$ NEHVI-1 is related to TSEMO in that both use sequential greedy batch selection using HVI based on RFF samples. However, TSEMO does not directly maximize HVI when selecting candidate $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ , where $i = 1 , . . . , q$ ; rather, it relies on a heuristic approach of running NSGA-II on an RFF sample of each objective to create a discrete population of candidates and then selecting the point from the discrete population that maximizes HVI under the RFF sample. In contrast, $q \mathrm { N E H V I - 1 }$ directly optimizes HVI under the RFF using exact sample-path gradients, which leads to improved optimization performance (see Appendix H). Furthermore, we find that $q \mathrm { N E H V I - 1 }$ is significantly faster than TSEMO, because rather than using NSGA-II it uses second order gradient methods to optimize HVI (see Appendix H). Gradient-based optimization is only possible because CBD enables scalable, differentiable HVI computation. While the primary goal of this work is to develop a principled, scalable method for parallel EHVI in noisy environments, we include empirical comparisons with qNEHVI-1 throughout the appendix to demonstrate the generalizablility of the CBD approach and practical performance of the $q \mathrm { N E H V I - 1 }$ approximation. $q \mathrm { N E H V I - 1 }$ achieves the fastest batch selection timesof any method tested on a GPU on every problem; in many cases, this is an order of magnitude speed-up over $q \mathrm { N E H V I }$ . Moreover, qNEHVI-1 has a remarkable ability to scale to large batch sizes when the dimensionality of optimization problem is modest. Further investigation of $q \mathrm { N E H V I - 1 }$ is needed, but we hope that the readers can recognize the ways in which $q \mathrm { N E H V I }$ can create broader opportunities for research into hypervolume improvement based acquisition functions.
150
+
151
+ # 9 Experiments
152
+
153
+ We empirically evaluate $q \mathrm { N E H V I }$ on a set of synthetic and real-world benchmark problems. We compare it against the following recently proposed methods from the literature: PESMO, MESMO (which we extend to the handle noisy observations using the noisy information gain from Takeno et al. [52]), PFES, DGEMO, MOEA/D-EGO, TSEMO, TS-TCH, $q \mathrm { E H V I }$ (and qEHVI-PM-CBD, which uses the posterior mean as a plug-in estimate for the function values at the in-sample points, along with CBD to scale to large batch sizes), and qNParEGO. We optimize all methods using multi-start L-BFGS-B with exact gradients (except for PFES, which uses gradients approximated via finite differences), including TS-TCH where we optimize approximate function samples using RFFs with 500 basis functions. We model each outcome with an independent GP with a Matérn 5/2 ARD kernel and infer the GP hyperparameters via maximum a posteriori (MAP) estimation. For all problems, we assume that the noise variances are observed (except ABR, where we infer the noise level). See Appendix G for more details on the experiments and acquisition function implementations.
154
+
155
+ We evaluate all methods using the logarithm of the difference in hypervolume between the true Pareto frontier and the approximate Pareto frontier recovered by the algorithm. Since evaluations are noisy, we compute the hypervolume dominated by the noiseless Pareto frontier across the observed points for each method.
156
+
157
+ Synthetic Problems: We consider a noisy variants of the BraninCurrin problem $\quad M = 2 , d = 2 ,$ and the DTLZ2 problem $( M = 2 , d = 6 )$ ) [13], in which observations are corrupted with zero-mean additive Gaussian noise with standard deviation of $5 \%$ of the range of each objective for BraninCurrin and $10 \%$ for DTLZ2.
158
+
159
+ Adaptive Bitrate (ABR) Control Policy Optimization: ABR controllers are used for real-time communication and media streaming applications. Policies for these controllers must be tuned to deliver a high quality of experience with respect to multiple objectives [40]. In industry settings, A/B tests with dozens of policies are tested simultaneously since each policy may take days or weeks to evaluate, producing noisy measurements across multiple objectives. In this experiment, we tune policies to maximize video quality (bitrate) and minimize stall time. The policy has $d = 4$ parameters, which are detailed in Appendix G. We use the Park simulator [41] and sample a random set of 100 traces to obtain noisy measurements of the objectives under a given policy. For comparing the performance of different methods, we estimate the true noiseless objective using mean objectives across 300 traces. We infer a homoskedastic noise level jointly with the GP hyperparameters via MAP estimation.
160
+
161
+ ![](images/6af06c98f410630170c917e8cab50477e1aa6be60e3cfa4697976649ab5238e6.jpg)
162
+ Figure 3: Sequential optimization performance. The shaded region indicates two standard errors of the mean over 100 replications (only 20 replications were feasible for PESMO due to large runtimes).
163
+
164
+ Vehicle Design Optimization: Optimizing the design of the frame an automobile is important to maximizing passenger safety, vehicle durability and fuel efficiency. Evaluating a vehicle design is time-consuming, since either a vehicle must manufactured and crashed, or a nonlinear finite element-based crash analysis must be run to simulate a collision (which can take over 20 hours per run) [62]. Hence, evaluating many designs in parallel is critical for reducing end-to-end optimization time. Observations are often noisy due to manufacturing imperfections, measurement error, or non-deterministic simulations. In this experiment, we tune the $d = 5$ widths of various components of a vehicle’s frame to minimize proxy metrics for (1) fuel consumption, (2) passenger trauma in a full frontal collison, and (3) vehicle fragility [53]. See Appendix G for details. For this demonstration, we add zero-mean Gaussian noise with a standard deviation of $1 \%$ of the objective range, which roughly corresponds to the manufacturing noise level used in previous work [62].
165
+
166
+ # 9.1 Summary of Results:
167
+
168
+ We find that $q \mathrm { N E H V I }$ and $q \mathrm { N E H V I - 1 }$ outperform all other methods on the noisy benchmarks, both in the sequential and parallel setting. In the sequential setting (Fig 3), $q \mathrm { N E H V I }$ and $q \mathrm { N E H V I - 1 }$ are followed closely by $q \mathrm { E H V I - P M }$ , and in some cases, even $q \mathrm { E H V I }$ . TS-TCH is firmly in the middle of the pack, while information-theoretic acquisition functions appear to perform the worst. This is consistent across noise levels; for experiments where we add noise to the objectives, we consider noise levels ranging from $1 \%$ to $10 \%$ of the range of each objective (these are magnitudes of the noise often seen in practice). Previous works have only evaluated MOBO algorithms with noise levels of $1 \%$ [25]. In Appendix H, we perform a study showing that $q \mathrm { N E H V I }$ consistently performs best with increasing noise levels up to $30 \%$ of the range of each objective.
169
+
170
+ While parallel evaluation can provide optimization speedups on order of the batch size $q$ , these evaluations do affect the overall sample complexity of the algorithm, since less information is available within the synchronous batch setting compared with fully sequential optimization. We find that, by and large, $q \mathrm { N E H V I }$ achieves the greatest hyper-volume for increasingly large batch sizes, and scales more elegantly relative to TS-TCH and the ParEGO variants (Fig 4). qNEHVI also consistently outperforms $q \mathrm { E H V I }$ -PM-CBD. In Appendix H, we observe that $q \mathrm { N E H V I }$ and $q \mathrm { N E H V I - 1 }$ provides excellent anytime performance all values of $q$ that we tested. We provide results on 4 additional test problems in Appendix H.3, and in Appendix H.8, we demonstrate that leveraging CBD and a single sample path approximation, $q$ NEHVI-1 enables scaling to 5-objective problems, which is a first for an HVI-based method, to our knowledge.
171
+
172
+ ![](images/871673288d167bcbd541079e5997b278cca429d8ca64fd48b785eb05c1db1a12.jpg)
173
+ Figure 4: The quality of the final Pareto frontier identified by each method with increasing batch sizes $q$ given a budget of 224 function evaluations. $q \mathrm { E H V I }$ is only included for $q = 1$ and $q = 8$ because the IEP scales exponential with $q$ . DGEMO is omitted on the ABR problem because it was prohibitively slow with time-consuming ABR simulations and on the VehicleSafety problem because DGEMO consistently crashed in the graph cutting algorithm.
174
+
175
+ In our experiments, we find that $q \mathrm { N E H V I - 1 }$ is among the top performers on relatively lowdimensional problems. Given the strong performance of $q \mathrm { N E H V I - 1 }$ , we examine its performance as the dimensionality of the search space increases in Appendix H.5. We find that $q \mathrm { N E H V I }$ is more robust than $q \mathrm { N E H V I - 1 }$ in higher-dimensional search spaces, but further investigation is needed into how the number of the Fourier basis functions affects the performance of qNEHVI-1 in highdimensional search spaces.
176
+
177
+ Optimization wall time: Across all experiments, we observe competitive wall times for optimizing $q \mathrm { N E H V I }$ and $q \mathrm { N E H V I - 1 }$ (all wall time comparisons are provided in Appendix H). On a GPU, optimizing qNEHVI-1 incurs the lowest wall time of any method that we tested on every single problem and optimizing $q \mathrm { N E H V I }$ is faster than optimizing information-theoretic methods on all problems. Using efficient low-rank Cholesky updates, qNEHVI is often faster than the qNParEGO implementation in BoTorch on a GPU.
178
+
179
+ # 10 Discussion
180
+
181
+ We proposed NEHVI, a novel acquisition function that provides a principled approach to parallel and noisy multi-objective Bayesian optimization. NEHVI is a one-step Bayes-optimal policy for maximizing the hypervolume dominated by the Pareto frontier in noisy and noise-free settings. NEHVI is made feasible by a new approach to computing joint hypervolumes (CBD), and we demonstrated that CBD enables scalable, parallel candidate generation with both noiseless $q \mathrm { E H V I }$ and qNEHVI. We provide theoretical results on optimizing a MC estimator of $q \mathrm { N E H V I }$ using sample average approximation and demonstrate significant improvements in optimization performance over state-of-the-art MOBO algorithms.
182
+
183
+ Yet, our work has some limitations. While the information-theoretic acquisition functions tested here perform poorly on our benchmarks, they do allow for decoupled evaluations of different objectives in cases where querying one objective may be more resource-intensive than querying other objectives. Optimizing such acquisition functions is a non-trivial task, and it is possible that with improved procedures, such acquisition functions could yield improved performance and provide a principled approach to selecting evaluation sources on a budget. Although practically fast enough for most Bayesian optimization tasks, exact hypervolume computation has super-polynomial complexity in the number of objectives. Combining $q \mathrm { N E H V I }$ with differentiable approximate methods for computing hypervolume (e.g. Couckuyt et al. [9], Golovin & Zhang [23]) could lead to further speed-ups.
184
+
185
+ We hope that the core ideas presented in this work, including the CBD approach, can provide a framework to support the development of new computationally efficient MOBO methods.
186
+
187
+ # References
188
+
189
+ [1] Asadpour, A., Nazerzadeh, H., and Saberi, A. Stochastic submodular maximization. In Papadimitriou, C. and Zhang, S. (eds.), Internet and Network Economics. Springer Berlin Heidelberg, 2008.
190
+ [2] Balandat, M., Karrer, B., Jiang, D. R., Daulton, S., Letham, B., Wilson, A. G., and Bakshy, E. BoTorch: A Framework for Efficient Monte-Carlo Bayesian Optimization. In Advances in Neural Information Processing Systems 33, 2020.
191
+ [3] Belakaria, S., Deshwal, A., and Doppa, J. R. Max-value entropy search for multi-objective bayesian optimization. In Advances in Neural Information Processing Systems 32, 2019.
192
+ [4] Binois, M., Ginsbourger, D., and Roustant, O. Quantifying uncertainty on pareto fronts with gaussian process conditional simulations. Eur. J. Oper. Res., 243:386–394, 2015.
193
+ [5] Bradford, E., Schweidtmann, A. M., and Lapkin, A. Efficient multiobjective optimization employing gaussian processes, spectral sampling and a genetic algorithm. Journal of global optimization, 71(2):407–438, 2018.
194
+ [6] Brockhoff, D., Tusar, T., Auger, A., and Hansen, N. Using well-understood single-objective functions in multiobjective black-box optimization test suites, 2019.
195
+ [7] Calandra, R. and Peters, J. Pareto front modeling for sensitivity analysis in multi-objective bayesian optimization. 2014.
196
+ [8] Calandra, R., Seyfarth, A., Peters, J., and Deisenroth, M. P. Bayesian optimization for learning gaits under uncertainty. Annals of Mathematics and Artificial Intelligence, 76(1):5–23, Feb 2016. ISSN 1573-7470. doi: 10.1007/s10472-015-9463-9.
197
+ [9] Couckuyt, I., Deschrijver, D., and Dhaene, T. Towards efficient multiobjective optimization: Multiobjective statistical criterions. In 2012 IEEE Congress on Evolutionary Computation, pp. 1–8, 2012.
198
+ [10] Daulton, S., Singh, S., Avadhanula, V., Dimmery, D., and Bakshy, E. Thompson sampling for contextual bandit problems with auxiliary safety constraints. In NeurIPS Workshop on Safety and Robustness in Decision Making, 2019.
199
+ [11] Daulton, S., Balandat, M., and Bakshy, E. Differentiable expected hypervolume improvement for parallel multi-objective Bayesian optimization. In Advances in Neural Information Processing Systems 33, NeurIPS, 2020.
200
+ [12] Deb, K., Pratap, A., Agarwal, S., and Meyarivan, T. A fast and elitist multiobjective genetic algorithm: Nsga-ii. IEEE Transactions on Evolutionary Computation, 6(2):182–197, 2002.
201
+ [13] Deb, K., Thiele, L., Laumanns, M., and Zitzler, E. Scalable multi-objective optimization test problems. volume 1, pp. 825–830, 06 2002. ISBN 0-7803-7282-4. doi: 10.1109/ CEC.2002.1007032.
202
+ [14] Deb, K., Gupta, S., Daum, D., Branke, J., Mall, A. K., and Padmanabhan, D. Reliability-based optimization using evolutionary algorithms. IEEE Transactions on Evolutionary Computation, 13(5):1054–1074, 2009. doi: 10.1109/TEVC.2009.2014361.
203
+ [15] Dächert, K., Klamroth, K., Lacour, R., and Vanderpooten, D. Efficient computation of the search region in multi-objective optimization. European Journal of Operational Research, 260 (3):841 – 855, 2017.
204
+ [16] Emmerich, M. T. M., Giannakoglou, K. C., and Naujoks, B. Single- and multiobjective evolutionary optimization assisted by gaussian random field metamodels. IEEE Transactions on Evolutionary Computation, 10(4):421–439, 2006.
205
+ [17] Feng, Q., Letham, B., Bakshy, E., and Mao, H. High-Dimensional Contextual Policy Search with Unknown Context Rewards using Bayesian Optimization. In Advances in Neural Information Processing Systems 33, 2020.
206
+ [18] Fisher, M. L., Nemhauser, G. L., and Wolsey, L. A. An analysis of approximations for maximizing submodular set functions—II, pp. 73–87. Springer Berlin Heidelberg, Berlin, Heidelberg, 1978.
207
+ [19] Frazier, P. I. A tutorial on bayesian optimization. arXiv preprint arXiv:1807.02811, 2018.
208
+ [20] Garrido-Merchán, E. C. and Hernández-Lobato, D. Predictive entropy search for multi-objective bayesian optimization with constraints. Neurocomputing, 361:50–68, 2019.
209
+ [21] Garrido-Merchán, E. C. and Hernández-Lobato, D. Parallel predictive entropy search for multi-objective bayesian optimization with constraints, 2020.
210
+ [22] Gelbart, M. A., Snoek, J., and Adams, R. P. Bayesian optimization with unknown constraints. In Proceedings of the 30th Conference on Uncertainty in Artificial Intelligence, UAI, 2014.
211
+ [23] Golovin, D. and Zhang, Q. Random hypervolume scalarizations for provable multi-objective black box optimization, 2020.
212
+ [24] Hernández-Lobato, J. M., Hoffman, M. W., and Ghahramani, Z. Predictive entropy search for efficient global optimization of black-box functions. In Proceedings of the 27th International Conference on Neural Information Processing Systems - Volume 1, NIPS’14, pp. 918–926, Cambridge, MA, USA, 2014. MIT Press.
213
+ [25] Hernández-Lobato, D., Hernández-Lobato, J. M., Shah, A., and Adams, R. P. Predictive entropy search for multi-objective bayesian optimization, 2015.
214
+ [26] Horn, D., Dagge, M., Sun, X., and Bischl, B. First investigations on noisy model-based multiobjective optimization. volume 10173, pp. 298–313, 02 2017. ISBN 978-3-319-54156-3. doi: 10.1007/978-3-319-54157-0_21.
215
+ [27] Igel, C., Hansen, N., and Roth, S. Covariance matrix adaptation for multi-objective optimization. Evolutionary Computation, 15(1):1–28, 2007. doi: 10.1162/evco.2007.15.1.1.
216
+ [28] Jiang, S., Zhang, H., Cong, W., Liang, Z., Ren, Q., Wang, C., Zhang, F., and Jiao, X. Multiobjective optimization of smallholder apple production: Lessons from the bohai bay region. Sustainability, 12(16):6496, 2020.
217
+ [29] Jones, D. R., Schonlau, M., and Welch, W. J. Efficient global optimization of expensive black-box functions. Journal of Global Optimization, 13:455–492, 1998.
218
+ [30] Kingma, D. P. and Welling, M. Auto-Encoding Variational Bayes. arXiv e-prints, pp. arXiv:1312.6114, Dec 2013.
219
+ [31] Klamroth, K., Lacour, R., and Vanderpooten, D. On the representation of the search region in multi-objective optimization. European Journal of Operational Research, 245(3):767–778, Sep 2015. ISSN 0377-2217. doi: 10.1016/j.ejor.2015.03.031. URL http://dx.doi.org/ 10.1016/j.ejor.2015.03.031.
220
+ [32] Knowles, J. Parego: a hybrid algorithm with on-line landscape approximation for expensive multiobjective optimization problems. IEEE Transactions on Evolutionary Computation, 10(1): 50–66, 2006.
221
+ [33] Koch, P., Wagner, T., Emmerich, M. T., Back, T., and Konen, W. Efficient multi-criteria optimization on noisy machine learning problems. Appl. Soft Comput., 29(C):357–370, April 2015. ISSN 1568-4946. doi: 10.1016/j.asoc.2015.01.005. URL https://doi.org/10.1016/ j.asoc.2015.01.005.
222
+ [34] Lacour, R., Klamroth, K., and Fonseca, C. M. A box decomposition algorithm to compute the hypervolume indicator. Computers & Operations Research, 79:347 – 360, 2017.
223
+ [35] LeCun, Y., Cortes, C., and Burges, C. Mnist handwritten digit database. ATT Labs [Online]. Available: http://yann.lecun.com/exdb/mnist, 2, 2010.
224
+ [36] Letham, B. and Bakshy, E. Bayesian optimization for policy search via online-offline experimentation. Journal of Machine Learning Research, 20(145):1–30, 2019. URL http: //jmlr.org/papers/v20/18-225.html.
225
+ [37] Letham, B., Karrer, B., Ottoni, G., and Bakshy, E. Constrained bayesian optimization with noisy experiments. Bayesian Analysis, 14(2):495–519, 06 2019. doi: 10.1214/18-BA1110.
226
+ [38] Liao, T., Wang, G., Yang, B., Lee, R., Pister, K., Levine, S., and Calandra, R. Data-efficient learning of morphology and controller for a microrobot. In 2019 International Conference on Robotics and Automation (ICRA), pp. 2488–2494. IEEE, 2019.
227
+ [39] Lukovic, K. M., Tian, Y., and Matusik, W. Diversity-guided multi-objective bayesian optimization with batch evaluations. Advances in Neural Information Processing Systems, 33, 2020.
228
+ [40] Mao, H., Chen, S., Dimmery, D., Singh, S., Blaisdell, D., Tian, Y., Alizadeh, M., and Bakshy, E. Real-world video adaptation with reinforcement learning. 2019.
229
+ [41] Mao, H., Negi, P., Narayan, A., Wang, H., Yang, J., Wang, H., Marcus, R., Addanki, R., Shirkoohi, M. K., He, S., Nathan, V., Cangialosi, F., Venkatakrishnan, S. B., Weng, W.-H., Han, S.-W., Kraska, T., and Alizadeh, M. Park: An open platform for learning-augmented computer systems. In NeurIPS, 2019.
230
+ [42] Mennen, S. M., Alhambra, C., Allen, C. L., Barberis, M., Berritt, S., Brandt, T. A., Campbell, A. D., Castañón, J., Cherney, A. H., Christensen, M., Damon, D. B., Eugenio de Diego, J., García-Cerrada, S., García-Losada, P., Haro, R., Janey, J., Leitch, D. C., Li, L., Liu, F., Lobben, P. C., MacMillan, D. W. C., Magano, J., McInturff, E., Monfette, S., Post, R. J., Schultz, D., Sitter, B. J., Stevens, J. M., Strambeanu, I. I., Twilton, J., Wang, K., and Zajac, M. A. The evolution of high-throughput experimentation in pharmaceutical development and perspectives on the future. Organic Process Research & Development, 23(6):1213–1242, 2019. doi: 10.1021/acs.oprd.9b00140.
231
+ [43] Namkoong, H., Daulton, S., and Bakshy, E. Distilled thompson sampling: Practical and efficient thompson sampling via imitation learning. In NeurIPS Offline Reinforcement Learning Workshop, 2020.
232
+ [44] Osborne, M. A. Bayesian gaussian processes for sequential prediction, optimisation and quadrature. 2010.
233
+ [45] Paria, B., Kandasamy, K., and Póczos, B. A Flexible Multi-Objective Bayesian Optimization Approach using Random Scalarizations. ArXiv e-prints, May 2018.
234
+ [46] Rahimi, A. and Recht, B. Random features for large-scale kernel machines. In Proceedings of the 20th International Conference on Neural Information Processing Systems, NIPS’07, pp. 1177–1184, Red Hook, NY, USA, 2007. Curran Associates Inc. ISBN 9781605603520.
235
+ [47] Rasmussen, C. E. Gaussian Processes in Machine Learning, pp. 63–71. Springer Berlin Heidelberg, Berlin, Heidelberg, 2004.
236
+ [48] Real, E., Aggarwal, A., Huang, Y., and Le, Q. V. Regularized evolution for image classifier architecture search. Proceedings of the AAAI Conference on Artificial Intelligence, 33(01): 4780–4789, Jul. 2019. doi: 10.1609/aaai.v33i01.33014780. URL https://ojs.aaai.org/ index.php/AAAI/article/view/4405.
237
+ [49] Schuster, M. Speech recognition for mobile devices at google. In Zhang, B.-T. and Orgun, M. A. (eds.), PRICAI 2010: Trends in Artificial Intelligence, pp. 8–10, Berlin, Heidelberg, 2010. Springer Berlin Heidelberg. ISBN 978-3-642-15246-7.
238
+ [50] Shahriari, B., Swersky, K., Wang, Z., Adams, R. P., and de Freitas, N. Taking the human out of the loop: A review of bayesian optimization. Proceedings of the IEEE, 104(1):148–175, 2016.
239
+ [51] Suzuki, S., Takeno, S., Tamura, T., Shitara, K., and Karasuyama, M. Multi-objective Bayesian optimization using pareto-frontier entropy. In III, H. D. and Singh, A. (eds.), Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 9279–9288. PMLR, 13–18 Jul 2020. URL http://proceedings.mlr.press/v119/suzuki20a.html.
240
+ [52] Takeno, S., Fukuoka, H., Tsukada, Y., Koyama, T., Shiga, M., Takeuchi, I., and Karasuyama, M. Multi-fidelity Bayesian optimization with max-value entropy search and its parallelization. In III, H. D. and Singh, A. (eds.), Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 9334–9345. PMLR, 13–18 Jul 2020. URL http://proceedings.mlr.press/v119/takeno20a.html.
241
+ [53] Tanabe, R. and Ishibuchi, H. An easy-to-use real-world multi-objective optimization problem suite. Applied Soft Computing, 89:106078, 2020. ISSN 1568-4946. doi: https://doi.org/10.1016/ j.asoc.2020.106078.
242
+ [54] Thompson, W. R. On the likelihood that one unknown probability exceeds another in view of the evidence of two samples. Biometrika, 25(3/4):285–294, 1933.
243
+ [55] Touré, C., Hansen, N., Auger, A., and Brockhoff, D. Uncrowded hypervolume improvement: Como-cma-es and the sofomore framework. In Proceedings of the Genetic and Evolutionary Computation Conference, GECCO ’19, pp. 638–646, New York, NY, USA, 2019. Association for Computing Machinery. ISBN 9781450361118. doi: 10.1145/3321707.3321852. URL https://doi.org/10.1145/3321707.3321852.
244
+ [56] Wang, R., Xiong, J., Ishibuchi, H., Wu, G., and Zhang, T. On the effect of reference point in moea/d for multi-objective optimization. Applied Soft Computing, 58:25–34, 2017. ISSN 1568-4946. doi: https://doi.org/10.1016/j.asoc.2017.04.002. URL https: //www.sciencedirect.com/science/article/pii/S1568494617301722.
245
+ [57] Wilson, J., Hutter, F., and Deisenroth, M. Maximizing acquisition functions for bayesian optimization. In Advances in Neural Information Processing Systems 31, pp. 9905–9916. 2018.
246
+ [58] Yang, K., Emmerich, M., Deutz, A., and Bäck, T. Multi-objective bayesian global optimization using expected hypervolume improvement gradient. Swarm and Evolutionary Computation, 44: 945 – 956, 2019. ISSN 2210-6502. doi: https://doi.org/10.1016/j.swevo.2018.10.007.
247
+ [59] Yang, K., Emmerich, M., Deutz, A. H., and Bäck, T. Efficient computation of expected hypervolume improvement using box decomposition algorithms. CoRR, abs/1904.12672, 2019.
248
+ [60] Yang, K., Palar, P., Emmerich, M., Shimoyama, K., and Bäck, T. A multi-point mechanism of expected hypervolume improvement for parallel multi-objective bayesian global optimization. pp. 656–663, 07 2019. doi: 10.1145/3321707.3321784.
249
+ [61] Yang, K., Palar, P. S., Emmerich, M., Shimoyama, K., and Bäck, T. A multi-point mechanism of expected hypervolume improvement for parallel multi-objective bayesian global optimization. In Proceedings of the Genetic and Evolutionary Computation Conference, GECCO ’19, pp. 656–663, New York, NY, USA, 2019. Association for Computing Machinery. ISBN 9781450361118. doi: 10.1145/3321707.3321784. URL https://doi.org/10.1145/ 3321707.3321784.
250
+ [62] Youn, B. D., Choi, K., Yang, R.-J., and Gu, L. Reliability-based design optimization for crashworthiness of vehicle side impact. Structural and Multidisciplinary Optimization, 26: 272–283, 02 2004. doi: 10.1007/s00158-003-0345-0.
251
+ [63] Zhang, G. and Block, D. E. Using highly efficient nonlinear experimental design methods for optimization of lactococcus lactis fermentation in chemically defined media. Biotechnology progress, 25(6):1587–1597, 2009.
252
+ [64] Zhang, Q., Liu, W., Tsang, E., and Virginas, B. Expensive multiobjective optimization by moea/d with gaussian process model. IEEE Transactions on Evolutionary Computation, 14(3): 456–474, 2010. doi: 10.1109/TEVC.2009.2033671.
253
+ [65] Zhou, A., Zhang, Q., and Zhang, G. A multiobjective evolutionary algorithm based on decomposition and probability model. In 2012 IEEE Congress on Evolutionary Computation, pp. 1–8, 2012. doi: 10.1109/CEC.2012.6252954.
254
+ [66] Zitzler, E., Deb, K., and Thiele, L. Comparison of multiobjective evolutionary algorithms: Empirical results. Evol. Comput., 8(2):173–195, June 2000. ISSN 1063-6560. doi: 10.1162/ 106365600568202. URL https://doi.org/10.1162/106365600568202.
255
+ [67] Zitzler, E., Deb, K., and Thiele, L. Comparison of multiobjective evolutionary algorithms: Empirical results. Evolutionary computation, 8(2):173–195, 2000.
md/train/B16dGcqlx/B16dGcqlx.md ADDED
@@ -0,0 +1,356 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THIRD-PERSON IMITATION LEARNING
2
+
3
+ Bradly C. Stadie1,2, Pieter Abbeel1,3, Ilya Sutskever1
4
+
5
+ 1 OpenAI 2 UC Berkeley, Department of Statistics 3 UC Berkeley, Departments of EECS and ICSI {bstadie, pieter, ilyasu,}@openai.com
6
+
7
+ # ABSTRACT
8
+
9
+ Reinforcement learning (RL) makes it possible to train agents capable of achieving sophisticated goals in complex and uncertain environments. A key difficulty in reinforcement learning is specifying a reward function for the agent to optimize. Traditionally, imitation learning in RL has been used to overcome this problem. Unfortunately, hitherto imitation learning methods tend to require that demonstrations are supplied in the first-person: the agent is provided with a sequence of states and a specification of the actions that it should have taken. While powerful, this kind of imitation learning is limited by the relatively hard problem of collecting first-person demonstrations. Humans address this problem by learning from third-person demonstrations: they observe other humans perform tasks, infer the task, and accomplish the same task themselves.
10
+
11
+ In this paper, we present a method for unsupervised third-person imitation learning. Here third-person refers to training an agent to correctly achieve a simple goal in a simple environment when it is provided a demonstration of a teacher achieving the same goal but from a different viewpoint; and unsupervised refers to the fact that the agent receives only these third-person demonstrations, and is not provided a correspondence between teacher states and student states. Our methods primary insight is that recent advances from domain confusion can be utilized to yield domain agnostic features which are crucial during the training process. To validate our approach, we report successful experiments on learning from third-person demonstrations in a pointmass domain, a reacher domain, and inverted pendulum.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Reinforcement learning (RL) is a framework for training agents to maximize rewards in large, unknown, stochastic environments. In recent years, combining techniques from deep learning with reinforcement learning has yielded a string of successful applications in game playing and robotics Mnih et al. (2015; 2016); Schulman et al. (2015a); Levine et al. (2016). These successful applications, and the speed at which the abilities of RL algorithms have been increasing, makes it an exciting area of research with significant potential for future applications.
16
+
17
+ One of the major weaknesses of RL is the need to manually specify a reward function. For each task we wish our agent to accomplish, we must provide it with a reward function whose maximizer will precisely recover the desired behavior. This weakness is addressed by the field of Inverse Reinforcement Learning (IRL). Given a set of expert trajectories, IRL algorithms produce a reward function under which these the expert trajectories enjoy the property of optimality. Recently, there has been a significant amount of work on IRL, and current algorithms can infer a reward function from a very modest number of demonstrations (e.g,. Abbeel & $\mathrm { N g }$ (2004); Ratliff et al. (2006); Ziebart et al. (2008); Levine et al. (2011); Ho & Ermon (2016); Finn et al. (2016)).
18
+
19
+ While IRL algorithms are appealing, they impose the somewhat unrealistic requirement that the demonstrations should be provided from the first-person point of view with respect to the agent. Human beings learn to imitate entirely from third-person demonstrations – i.e., by observing other humans achieve goals. Indeed, in many situations, first-person demonstrations are outright impossible to obtain. Meanwhile, third-person demonstrations are often relatively easy to obtain.
20
+
21
+ The goal of this paper is to develop an algorithm for third-person imitation learning. Future advancements in this class of algorithms would significantly improve the state of robotics, because it will enable people to easily teach robots news skills and abilities. Importantly, we want our algorithm to be unsupervised: it should be able to observe another agent perform a task, infer that there is an underlying correspondence to itself, and find a way to accomplish the same task.
22
+
23
+ We offer an approach to this problem by borrowing ideas from domain confusion Tzeng et al. (2014) and generative adversarial networks (GANs) Goodfellow et al. (2014). The high-level idea is to introduce an optimizer under which we can recover both a domain-agnostic representation of the agent’s observations, and a cost function which utilizes this domain-agnostic representation to capture the essence of expert trajectories. We formulate this as a third-person RL-GAN problem, and our solution builds on the first-person RL-GAN formulation by Ho & Ermon (2016).
24
+
25
+ Surprisingly, we find that this simple approach has been able to solve the problems that are presented in this paper (illustrated in Figure 1), even though the student’s observations are related in a complicated way to the teacher’s demonstrations (given that the observations and the demonstrations are pixel-level). As techniques for training GANs become more stable and capable, we expect our algorithm to be able to infer solve harder third-person imitation tasks without any direct supervision.
26
+
27
+ ![](images/4f116f6ef62dbbe520d3cfcd3efa9281e7a38397e6e00f6ac5c062e2df069dc2.jpg)
28
+ Figure 1: From left to right, the three domains we consider in this paper: pointmass, reacher, and pendulum. Top-row is the third-person view of a teacher demonstration. Bottom row is the agent’s view in their version of the environment. For the point and reacher environments, the camera angles differ by approximately 40 degrees. For the pendulum environment, the color of the pole differs.
29
+
30
+ # 2 RELATED WORK
31
+
32
+ Imitation learning (also learning from demonstrations or programming by demonstration) considers the problem of acquiring skills from observing demonstrations. Imitation learning has a long history, with several good survey articles, including (Schaal, 1999; Calinon, 2009; Argall et al., 2009). Two main lines of work within imitation learning are: 1) behavioral cloning, where the demonstrations are used to directly learn a mapping from observations to actions using supervised learning, potentially with interleaving learning and data collection (e.g., Pomerleau (1989); Ross et al. (2011)). 2) Inverse reinforcement learning $\mathrm { N g }$ et al., 2000), where a reward function is estimated that explains the demonstrations as (near) optimal behavior. This reward function could be represented as nearness to a trajectory (Calinon et al., 2007; Abbeel et al., 2010), as a weighted combination of features (Abbeel & $\mathrm { N g }$ , 2004; Ratliff et al., 2006; Ramachandran & Amir, 2007; Ziebart et al., 2008; Boularias et al., 2011; Kalakrishnan et al., 2013; Doerr et al., 2015), or could also involve feature learning (Ratliff et al., 2007; Levine et al., 2011; Wulfmeier et al., 2015; Finn et al., 2016; Ho & Ermon, 2016).
33
+
34
+ This past work, however, is not directly applicable to the third person imitation learning setting. In third-person imitation learning, the observations and actions obtained from the demonstrations are not the same as what the imitator agent will be faced with. A typical scenario would be: the imitator agent watches a human perform a demonstration, and then has to execute that same task. As discussed in Nehaniv & Dautenhahn (2001) the ”what and how to imitate” questions become significantly more challenging in this setting. To directly apply existing behavioral cloning or inverse reinforcement learning techniques would require knowledge of a mapping between observations and actions in the demonstrator space to observations and actions in the imitator space. Such a mapping is often difficult to obtain, and it typically relies on providing feature representations that captures the invariance between both environments Carpenter et al. (2002); Shon et al. (2005); Calinon et al. (2007); Nehaniv (2007); Gioioso et al. (2013); Gupta et al. (2016). Contrary to prior work, we consider third-person imitation learning from raw sensory data, where no such features are made available.
35
+
36
+ The most closely related work to ours is by Finn et al. (2016); Ho & Ermon (2016); Wulfmeier et al. (2015), who also consider inverse reinforcement learning directly from raw sensory data. However, the applicability of their approaches is limited to the first-person setting. Indeed, matching raw sensory observations is impossible in the 3rd person setting.
37
+
38
+ Our work also closely builds on advances in generative adversarial networks Goodfellow et al. (2014), which are very closely related to imitation learning as explained in Finn et al. (2016); Ho & Ermon (2016). In our optimization formulation, we apply the gradient flipping technique from Ganin & Lempitsky (2014).
39
+
40
+ The problem of adapting what is learned in one domain to another domain has been studied extensively in computer vision in the supervised learning setting Yang et al. (2007); Mansour et al. (2009); Kulis et al. (2011); Aytar & Zisserman (2011); Duan et al. (2012); Hoffman et al. (2013); Long & Wang (2015). It has also been shown that features trained in one domain can often be relevant to other domains Donahue et al. (2014). The work most closely related to ours is Tzeng et al. (2014; 2015), who also consider an explicit domain confusion loss, forcing trained classifiers to rely on features that don’t allow to distinguish between two domains. This work in turn relates to earlier work by Bromley et al. (1993); Chopra et al. (2005), which also considers supervised training of deep feature embeddings.
41
+
42
+ Our approach to third-person imitation learning relies on reinforcement learning from raw sensory data in the imitator domain. Several recent advances in deep reinforcement learning have made this practical, including Deep Q-Networks (Mnih et al., 2015), Trust Region Policy Optimization (Schulman et al., 2015a), A3C Mnih et al. (2016), and Generalized Advantage Estimation (Schulman et al., 2015b). Our approach uses Trust Region Policy Optimization.
43
+
44
+ # 3 BACKGROUND AND PRELIMINARIES
45
+
46
+ A discrete-time finite-horizon discounted Markov decision process (MDP) is represented by a tuple $M = ( S , A , \mathcal { P } , r , \rho _ { 0 } , \gamma , T )$ , in which $s$ is a state set, $\mathcal { A }$ an action set, $\mathcal { P } : \bar { S \times A } \times \bar { S } \stackrel { \cdot } { \to } \mathbb { R } _ { + }$ a transition probability distribution, $r : S \times \mathcal { A } \mathbb { R }$ a reward function, $\rho _ { 0 } : { \mathcal { S } } \to \mathbb { R } _ { + }$ an initial state distribution, $\gamma \in [ 0 , 1 ]$ a discount factor, and $T$ the horizon.
47
+
48
+ In the reinforcement learning setting, the goal is to find a policy $\pi _ { \theta } : \mathcal { S } \times \mathcal { A } \to \mathbb { R } _ { + }$ parametrized by $\theta$ that maximizes the expected discounted sum of rewards incurred, $\begin{array} { r } { \eta ( \pi _ { \theta } ) = \mathbb { E } _ { \pi _ { \theta } } [ \sum _ { t = 0 } ^ { T } \gamma ^ { t } c ( s _ { t } ) ] } \end{array}$ , where $s _ { 0 } \sim \rho _ { 0 } ( s _ { 0 } )$ , $a _ { t } \sim \pi _ { \theta } ( a _ { t } | s _ { t } )$ , and $s _ { t + 1 } \sim \mathcal { P } ( s _ { t + 1 } | s _ { t } , a _ { t } )$ .
49
+
50
+ In the (first-person) imitation learning setting, we are not given the reward function. Instead we are given traces (i.e., sequences of states traversed) by an expert who acts according to an unknown policy $\pi _ { E }$ . The goal is to find a policy $\pi _ { \theta }$ that performs as well as the expert against the unknown reward function. It was shown in Abbeel & $\mathrm { N g }$ (2004) that this can be achieved through inverse reinforcement learning by finding a policy $\pi _ { \theta }$ that matches the expert’s empirical expectation over discounted sum of all features that might contribute to the reward function. The work by Ho & Ermon (2016) generalizes this to the setting when no features are provided as follows: Find a policy $\pi _ { \theta }$ that makes it impossible for a discriminator (in their work a deep neural net) to distinguish states visited by the expert from states visited by the imitator agent. This can be formalized as follows:
51
+
52
+ $$
53
+ \begin{array} { r l } { \underset { \pi _ { \theta } } { \mathop { \operatorname* { m a x } } } \underset { \mathcal { D } _ { R } } { \mathop { \operatorname* { m i n } } } } & { { } - \mathbb { E } _ { \pi _ { \theta } } [ \log \mathcal { D } _ { R } ( s ) ] - \mathbb { E } _ { \pi _ { E } } [ \log ( 1 - \mathcal { D } _ { R } ( s ) ) ] } \end{array}
54
+ $$
55
+
56
+ Here, the expectations are over the states experienced by the policy of the imitator agent, $\pi _ { \theta }$ , and by the policy of the expert, $\pi _ { E }$ , respectively. $\mathcal { D } _ { R }$ is the discriminator, which outputs the probability of a state having originated from a trace from the imitator policy $\pi _ { \theta }$ . If the discriminator is perfectly able to distinguish which policy originated state-action pairs, then $\mathcal { D } _ { R }$ will consistently output a probability of 1 in the first term, and a probability of 0 in the second term, making the objective its lowest possible value of zero. It is the role of the imitator agent $\pi _ { \theta }$ to find a policy that makes it difficult for the discriminator to make that distinction. The desired equilibrium has the imitator agent making it impractical for the discriminator to distinguish, hence forcing the discriminator to assign probability 0.5 in all cases. Ho & Ermon (2016) present a practical approach for solving this type of game when representing both $\pi _ { \theta }$ and $\mathcal { D } _ { R }$ as deep neural networks. Their approach repeatedly performs gradient updates on each of them. Concretely, for a current policy $\pi _ { \theta }$ traces can be collected, which together with the expert traces form a data-set on which $\mathcal { D } _ { R }$ can be trained with supervised learning minimizing the negative log-likelihood (in practice only performing a modest number of updates). For a fixed $\mathcal { D } _ { R }$ , this is a policy optimization problem where $- \log \mathcal { D } _ { R } ( s , a )$ is the reward, and policy gradients can be computed from those same traces. Their approach uses trust region policy optimization (Schulman et al., 2015a) to update the imitator policy $\pi _ { \theta }$ from those gradients.
57
+
58
+ In our work we will have more terms in the objective, so for compactness of notation, we will realize the discriminative minimization from Eqn. (1) as follows:
59
+
60
+ $$
61
+ \operatorname* { m a x } _ { \pi _ { \boldsymbol { \theta } } } \operatorname* { m i n } _ { \mathcal { D } _ { R } } \mathcal { L } _ { R } = \sum _ { i } C E ( \mathcal { D } _ { R } ( \boldsymbol { s } _ { i } ) , \boldsymbol { c } _ { \boldsymbol { \ell } _ { i } } )
62
+ $$
63
+
64
+ Where $s _ { i }$ is state $i$ , $c _ { \ell _ { i } }$ is the correct class label (was the state $s _ { i }$ obtained from an expert vs. from a non-expert), and $C E$ is the standard cross entropy loss.
65
+
66
+ # 4 A FORMAL DEFINITION OF THE THIRD-PERSON IMITATION LEARNINGPROBLEM
67
+
68
+ Formally, the third-person imitation learning problem can be stated as follows. Suppose we are given two Markov Decision Processes $M _ { \pi _ { E } }$ and $M _ { \pi _ { \theta } }$ . Suppose further there exists a set of traces $\rho =$ $\{ ( s _ { 1 } , \ldots , s _ { n } ) \} _ { i = 0 } ^ { n }$ which were generated under a policy $\pi _ { E }$ acting optimally under some unknown reward $R _ { \pi _ { E } }$ . In third-person imitation learning, one attempts to recover by proxy through $\rho$ a policy $\pi _ { \theta } = f ( \rho )$ which acts optimally with respect to $R _ { \pi _ { \theta } }$ .
69
+
70
+ # 5 A THIRD-PERSON IMITATION LEARNING ALGORITHM
71
+
72
+ # 5.1 GAME FORMULATION
73
+
74
+ In this section, we discuss a simple algorithm for third-person imitation learning. This algorithm is able to successfully discriminate between expert and novice policies, even when the policies are executed under different environments. Subsequently, this discrimination signal can be used to train expert policies in new domains via RL by training the novice policy to fool the discriminator, thus forcing it to match the expert policy.
75
+
76
+ In third-person learning, observations are more typically available rather than direct state access, so going forward we will work with observations $o _ { t }$ instead of states $s _ { t }$ as representing the expert traces. The top row of Figure 8 illustrates what these observations are like in our experiments.
77
+
78
+ We begin by recalling that in the algorithm proposed by Ho & Ermon (2016) the loss in Equation 2 is utilized to train a discriminator $\mathcal { D } _ { R }$ capable of distinguishing expert vs non-expert policies. Unfortunately, (2) will likely fail in cases when the expert and non-expert act in different environments, since $\mathcal { D } _ { R }$ will quickly learn these differences and use them as a strong classification signal.
79
+
80
+ To handle the third-person setting, where expert and novice are in different environments, we consider that $\mathcal { D } _ { R }$ works by first extracting features from $o _ { t }$ , and then using these features to make a classification. Suppose then that we partition $\mathcal { D } _ { R }$ into a feature extractor $\mathcal { D } _ { F }$ and the actual classifier which assigns probabilities to the outputs of $D _ { F }$ . Overloading notation, we will refer to the classifier as $\mathcal { D } _ { R }$ going forward. For example, in case of a deep neural net representation, $\mathcal { D } _ { F }$ would correspond to the earlier layers, and $\mathcal { D } _ { R }$ to the later layers. The problem is then to ensure that $D _ { F }$ contains no information regarding the rollout’s domain label $d _ { \ell }$ (i.e., expert vs. novice domain). This can be realized as
81
+
82
+ $$
83
+ \begin{array} { r l r } & { } & { \underset { \pi _ { \theta } } { \operatorname* { m a x } } \operatorname* { m i n } \mathcal L _ { { R } } = \displaystyle \sum _ { i } C E ( \mathcal D _ { { R } } ( \mathcal D _ { { F } } ( o _ { i } ) ) , c _ { \ell _ { i } } ) } \\ & { } & { \mathrm { s . t . } ~ \mathrm { M I } ( D _ { { F } } ( o _ { i } ) ; d _ { l } ) = 0 } \end{array}
84
+ $$
85
+
86
+ Where MI is mutual information and hence we have abused notation by using $\mathcal { D } _ { R } , D _ { F }$ , and $d _ { \ell }$ to mean the classifier, feature extractor, and the domain label respectively as well as distributions over these objects.
87
+
88
+ The mutual information term can be instantiated by introducing another classifier $\mathcal { D } _ { D }$ , which takes features produced by $D _ { F }$ and outputs the probability that those features were produced by in the expert vs. non-expert environment. (See Bridle et al. (1992); Barber & Agakov (2005); Krause et al. (2010); Chen et al. (2016) for further discussion on instantiating the information term by introducing another classifier.) If $\sigma _ { i } = D _ { F } { ( o _ { i } ) }$ , then the problem can be written as
89
+
90
+ $$
91
+ \operatorname* { m a x } _ { \pi _ { \theta } } \operatorname* { m i n } _ { \mathcal { D } _ { R } } \operatorname* { m a x } _ { \mathcal { D } _ { D } } \mathcal { L } _ { R } + \mathcal { L } _ { D } = \sum _ { i } C E ( \mathcal { D } _ { R } ( \sigma _ { i } ) , c _ { \ell _ { i } } ) + C E ( \mathcal { D } _ { D } ( \sigma _ { i } ) , d _ { \ell _ { i } } )
92
+ $$
93
+
94
+ In words, we wish to minimize class loss while maximizing domain confusion.
95
+
96
+ Often, it can be difficult for even humans to judge a static image as expert vs. non-expert because it does not convey any information about the environmental change affected by the agent’s actions. For example, if a pointmass is attempting to move to a target location and starts far away from its goal state, it can be difficult to judge if the policy itself is bad or the initialization was simply unlucky. In response to this difficulty, we give $\mathcal { D } _ { R }$ access to not only the image at time $t$ , but also at some future time $t + n$ . Define $\sigma _ { t } = D _ { F } ( o _ { t } )$ and $\sigma _ { t + n } = D _ { F } ( o _ { t + n } )$ . The classifier then makes a prediction $\mathcal { D } _ { R } ( \sigma _ { t } , \sigma _ { t + n } ) = \hat { c } _ { \ell }$ .
97
+
98
+ This renders the following formulation:
99
+
100
+ $$
101
+ \operatorname* { m a x } _ { \pi _ { \theta } } \operatorname* { m i n } _ { \mathcal { D } _ { R } } \operatorname* { m a x } _ { \mathcal { D } _ { D } } \mathcal { L } _ { R } + \mathcal { L } _ { D } = \sum _ { i } C E ( \mathcal { D } _ { R } ( \sigma _ { i } , \sigma _ { i + n } ) , c _ { \ell _ { i } } ) + C E ( \mathcal { D } _ { D } ( \sigma _ { i } ) , d _ { \ell _ { i } } )
102
+ $$
103
+
104
+ Note we also want to optimize over $\mathcal { D } _ { F }$ , the feature extractor, but it feeds both into $\mathcal { D } _ { R }$ and into $\mathcal { D } _ { D }$ , which are competing (hidden under $\sigma$ ), which we will address now.
105
+
106
+ To deal with the competition over $\mathcal { D } _ { F }$ , we introduce a function $\mathcal { G }$ that acts as the identity when moving forward through a directed acyclic graph and flips the sign when backpropagating through the graph. This technique has enjoyed recent success in computer vision. See, for example, (Ganin & Lempitsky, 2014). With this trick, the problem reduces to its final form
107
+
108
+ $$
109
+ \operatorname* { m a x } _ { \pi _ { \theta } } \operatorname* { m i n } _ { \mathcal { D } _ { R } , \mathcal { D } _ { D } , \mathcal { D } _ { F } } \mathcal { L } _ { R } + \mathcal { L } _ { D } = \sum _ { i } C E ( \mathcal { D } _ { R } ( \sigma _ { i } , \sigma _ { i + n } ) , c _ { \ell _ { i } } ) + \lambda C E ( \mathcal { D } _ { D } ( \mathcal { G } ( \sigma _ { i } ) , d _ { \ell _ { i } } ) - c _ { \ell _ { i } } )
110
+ $$
111
+
112
+ In Equation (5), we flip the gradient’s sign during backpropagation of $D _ { F }$ with respect to the domain classification loss. This corresponds to stochastic gradient ascent away from features that are useful for domain classification, thus ensuring that $D _ { F }$ produces domain agnostic features. Equation 5 can be solved efficiently with stochastic gradient descent. Here $\lambda$ is a hyperparameter that determines the trade-off made between the objectives that are competing over $\mathcal { D } _ { F }$ .
113
+
114
+ To ensure sufficient signal for discrimination between expert and non-expert, we collect third-person demonstrations in the expert domain from both an expert and from a non-expert.
115
+
116
+ Our complete formulation is graphically summarized in Figure 2.
117
+
118
+ ![](images/0f6e6112f36cfebf12955fa02ddf614350be92d58e85c57da82c1566c4d52336.jpg)
119
+ Figure 2: Architecture diagram for third-person imitation learning. Images at time $t$ and $t + 4$ are sent through a feature extractor to obtain $F ( o _ { t } )$ and $F ( o _ { t + 4 } )$ . Subsequently, these feature vectors are reused in two places. First, they are concatenated and used to predict whether the samples are drawn from expert or non-expert trajectories. Second, $F ( o _ { t } )$ is utilized to predict a domain label (expert vs. novice domain). During backpropogation, the sign on the domain loss $L _ { D }$ is flipped to destroy information that was useful for distinguishing the two domains. This ensures that the feature extractor $F$ is domain agnostic. Finally, the classes probabilities that were computed using this domain-agnostic feature vector are utilized as a cost signal in TRPO; which is subsequently utilized to train the novice policy to take expert-like actions and collect further rollouts.
120
+
121
+ # 5.2 ALGORITHM
122
+
123
+ To solve the game formulation in Equation (5), we perform alternating (partial) optimization over the policy $\pi _ { \theta }$ and the reward function and domain confusion encoded through $\mathcal { D } _ { R } , \mathcal { D } _ { D } , \mathcal { D } _ { F }$ .
124
+
125
+ The optimization over $\mathcal { D } _ { R } , \mathcal { D } _ { D } , \mathcal { D } _ { F }$ is done through stochastic gradient descent with ADAM Kingma & Ba (2014).
126
+
127
+ Our generator $\left( \pi _ { \boldsymbol { \theta } } \right)$ step is similar to the generator step in the algorithm by (Ho & Ermon, 2016). We simply use $- \log \mathcal { D } _ { R }$ as the reward. Using policy gradient methods (TRPO), we train the generator to minimize this cost and thus push the policy further towards replicating expert behavior. Once the generator step is done, we start again with the discriminator step. The entire process is summarized in algorithm 1.
128
+
129
+ # 6 EXPERIMENTS
130
+
131
+ We seek to answer the following questions through experiments:
132
+
133
+ 1. Is it possible to solve the third-person imitation learning problem in simple settings? I.e., given a collection of expert image-based rollouts in one domain, is it possible to train a policy in a different domain that replicates the essence of the original behavior? 2. Does the algorithm we propose benefit from both domain confusion and velocity? 3. How sensitive is our proposed algorithm to the selection of hyper-parameters used in deployment? 4. How sensitive is our proposed algorithm to changes in camera angle? 5. How does our method compare against some reasonable baselines?
134
+
135
+ # Algorithm 1 A third-person imitation learning algorithm.
136
+
137
+ 1: Let CE be the standard cross entropy loss.
138
+ 2: Let $\mathcal { G }$ be a function that flips the gradient sign during backpropogation and acts as the identity
139
+ map otherwise.
140
+ 3: Initialize two domains, $E$ and $N$ for the expert and novice.
141
+ 4: Initialize a memory bank $\Omega$ of expert success and of failure in domain $E$ . Each trajectory $\omega \in \Omega$
142
+ comprises a rollout of images $o = o _ { 1 } , \ldots , o _ { t } , \ldots o _ { n }$ , a class label $c _ { \ell }$ , and a domain label $d _ { \ell }$ .
143
+ 5: Initialize $\mathcal { D } = \mathcal { D } _ { F } , \mathcal { D } _ { R } , \mathcal { D } _ { D }$ , a domain invariant discriminator.
144
+ 6: Initialize a novice policy $\pi _ { \theta }$ .
145
+ 7: Initialize numiters, the number of inner policy optimization iterations we wish to run.
146
+ 8: for iter in numiters do
147
+ 9: Sample a set of successes and failures $\omega _ { E }$ from $\Omega$ .
148
+ 10: Collect on policy samples $\omega _ { N }$
149
+ 11: Set $\omega = \omega _ { E } \cup \omega _ { N }$ .
150
+ 12: Shuffle $\omega$
151
+ 13: for $o , c _ { \ell } , d _ { \ell }$ in $\omega$ do
152
+ 14: for $o _ { t }$ in $o$ do
153
+ 15: $\sigma _ { t } = \mathcal { D } _ { F } \big ( o _ { t } \big )$
154
+ 16: $\sigma _ { t + 4 } = \mathscr { D } _ { F } ( o _ { t + 4 } )$
155
+ 17: $\mathcal { L } _ { R } = C E ( \mathcal { D } _ { R } ( \sigma _ { t } , \sigma _ { t + 4 } ) , c _ { \ell } )$
156
+ 18: $\mathcal { L } _ { d } = C E ( \mathcal { D } _ { D } ( \mathcal { G } ( \sigma _ { t } ) ) , d _ { \ell } )$
157
+ 19: L = λ · Ld + LR
158
+ 20: minimize $\mathcal { L }$ with ADAM.
159
+ 21: end for
160
+ 22: end for
161
+ 23: Collect on policy samples $\omega _ { N }$ from $\pi _ { \theta }$ .
162
+ 24: for $\omega$ in $\omega _ { N }$ do
163
+ 25: for $\omega _ { t }$ in $\omega$ do
164
+ 26: $\begin{array} { l } { \sigma _ { t } = \mathcal { D } _ { F } \big ( o _ { t } \big ) } \\ { \sigma _ { t + 4 } = \mathcal { D } _ { F } \big ( o _ { t + 4 } \big ) } \\ { \hat { c } _ { \ell } = \mathcal { D } _ { R } \big ( \sigma _ { t } , \sigma _ { t + 4 } \big ) } \end{array}$
165
+ 27:
166
+ 28:
167
+ 29: $r = \hat { c } _ { \ell } [ 0 ]$ , the probability that $o _ { t } , o _ { t + 4 }$ were generated via expert rollouts.
168
+ 30: Use $r$ to train $\pi _ { \theta }$ with via policy gradients (TRPO).
169
+ 31: end for
170
+ 32: end for
171
+ 33: end for
172
+ 34: return optimized policy $\pi _ { \theta }$
173
+
174
+ # 6.1 ENVIRONMENTS
175
+
176
+ To evaluate our algorithm, we consider three environments in the MuJoCo physics simulator. There are two different versions of each environment, an expert variant and a novice variant. Our goal is to train a cost function that is domain agnostic, and hence can be trained with images on the expert domain but nevertheless produce a reasonable cost on the novice domain. See Figure 1 for a visualization of the differences between expert and novice environments for the three tasks.
177
+
178
+ Point: A pointmass attempts to reach a point in a plane. The color of the target and the camera angle change between domains.
179
+
180
+ Reacher: A two DOF arm attempts to reach a designated point in the plane. The camera angle, the length of the arms, and the color of the target point are changed between domains. Note that changing the camera angle significantly alters the image background color from largely gray to roughly 30 percent black. This presents a significant challenge for our method.
181
+
182
+ Inverted Pendulum: A classic RL task wherein a pendulum must be made to balance via control. For this domain, We only change the color of the pendulum and not the camera angle. Since there is no target point, we found that changing the camera angle left the domain invariant representations with too little information and resulted in a failure case. In contrast to some traditional renderings of this problem, we do not terminate an episode when the agent falls but rather allow data collection to continue for a fixed horizon.
183
+
184
+ # 6.2 EVALUATIONS
185
+
186
+ Is it possible to solve the third-person imitation learning problem in simple settings? In Figure 3, we see that our proposed algorithm is indeed able to recover reasonable policies for all three tasks we examined. Initially, the training is quite unstable due to the domain confusion wreaking havoc on the learned cost. However, after several iterations the policies eventually head towards reasonable local minima and the standard deviation over the reward distribution shrinks substantially. Finally, we note that the extracted feature representations used to complete this task are in fact domain-agnostic, as seen in Figure 9. Hence, the learning is properly taking place from a third-person perspective.
187
+
188
+ ![](images/e5de99af5cf3a1c7aa7654c1a187c2ca412166671d36a48182ca68fd643f5215.jpg)
189
+ Figure 3: Reward vs training iteration for reacher, inverted pendulum, and point environments. The learning curves are averaged over 5 trials with error bars represent one standard deviation in the reward distribution at the given point.
190
+
191
+ ![](images/f7b7c6bcd21543c32d56d84f9174ade28e4f6a584b6d9c3ad7db142b231a7a52.jpg)
192
+ Figure 4: Domain accuracy vs. training iteration for reacher, inverted pendulum, and point environments.
193
+
194
+ Does the algorithm we propose benefit from both domain confusion and the multi-time step input? We answer this question with the experiments summarized in Figure 5. This experiment compares our approach with: (i) our approach without the domain confusion loss; (ii) our approach without the multi-time step input; (iii) our approach without the domain confusion loss and without the multitime step input (which is very similar to the approach in Ho & Ermon (2016)). We see that adding domain confusion is essential for getting strong performance in all three experiments. Meanwhile, adding multi-time step input marginally improves the results. See also Figure 7 for an analysis of the effects of multi-time step input on the final results.
195
+
196
+ ![](images/e3119af18c1c7e62ae4ef64c2ed955904fbe120c4d62bd13f90f984b9217f8c5.jpg)
197
+ Figure 5: Reward vs iteration for reacher, inverted pendulum, and point environments with no domain confusion and no velocity (red), domain confusion (orange), velocity (brown), and both domain confusion and velocity (blue).
198
+
199
+ How sensitive is our proposed algorithm to the selection of hyper-parameters used in deployment? Figure 6 shows the effect of the domain confusion coefficient $\lambda$ , which trades off how much we should weight the domain confusion objective vs. the standard cost-recovery objective, on the final performance of the algorithm. Setting $\lambda$ too low results in slower learning and features that are not domain-invariant. Setting $\lambda$ too high results in an objective that is too quick to destroy information, which makes it impossible to recover an accurate cost.
200
+
201
+ For multi-time step input, one must choose the number of look-ahead frames that are utilized. If too small a window is chosen, the agent’s actions have not affected a large amount of change in the environment and it is difficult to discern any additional class signal over static images. If too large a time-frame passes, causality becomes difficult to interpolate and the agent does worse than simply being trained on static frames. Figure 7 illustrates that no number of look-ahead frames is consistently optimal across tasks. However, a value of 4 showed good performance over all tasks, and so this value was utilized in all other experiments.
202
+
203
+ ![](images/45ed8ae8770c3fc15032a995eb4946b54fae1133b7d3d76076733073924dca65.jpg)
204
+ Figure 6: Reward of final trained policy vs domain confusion weight $\lambda$ for reacher, inverted pendulum, and point environments.
205
+
206
+ ![](images/0f0f2a991076420a5f9323afd72fe3d58d1351a3000f704f8ceb0602171cdb82.jpg)
207
+ Figure 7: Reward of final trained policy vs number of look-ahead frames for reacher, inverted pendulum, and point environments.
208
+
209
+ How sensitive is our algorithm to changes in camera angle? We present graphs for the reacher and point experiments wherein we exam the final reward obtained by a policy trained with thirdperson imitation learning vs the camera angle difference between the first-person and third-person perspective. We omit the inverted double pendulum experiment, as the color and not the camera angle changes in that setting and we found the case of slowly transitioning the color to be the definition of uninteresting science.
210
+
211
+ ![](images/878be86e4c28e17ce3098944393f81394f948537ce33b7bc32f67d1492e063e5.jpg)
212
+ Figure 8: Point and reacher final reward after 20 epochs of third-person imitation learning vs the camera angle difference between the first and third-person perspective. We see that the point follows a fairly linear slope in regards to camera angle differences, whereas the reacher environment is more stochastic against these changes.
213
+
214
+ ![](images/63dd757b05b53e432ebdfa3f1f6ac421e8f43a1c47d1053932e4f96e81238dfd.jpg)
215
+ Figure 9: Learning curves for third-person imitation vs. three baselines: 1)RL with true reward, 2) first-person imitation, 3) attempting to use first-person features on the third-person agent.
216
+
217
+ How does our method compare against reasonable baselines? We consider the following baselines for comparisons against third-person imitation learning. 1) Standard reinforcement learning with using full state information and the true reward signal. This agent is trained via TRPO. 2)
218
+
219
+ Standard GAIL (first-person imitation learning). Here, the agent receives first-person demonstration and attempts to imitate the correct behavior. This is an upper bound on how well we can expect to do, since we have the correct perspective. 3) Training a policy using first-person data and applying it to the third-person environment.
220
+
221
+ We compare all three of these baselines to third-person imitation learning. As we see in figure 9: 1) Standard RL, which (unlike the imitation learning approaches) has access to full state and true reward, helps calibrate performance of the other approaches. 2) First-person imitation learning is faced with a simpler imitation problem and accordingly outperforms third-person imitation, yet third-person imitation learning is nevertheless competitive. 3) Applying the first-person policy to the third-person agent fails miserably, illustrating that explicitly considering third-person imitation is important in these settings.
222
+
223
+ Somewhat unfortunately, the different reward function scales make it difficult to capture information on the variance of each learning curve. Consequently, in Appendix A we have included the full learning curves for these experiments with variance bars, each plotted with an appropriate scale to examine the variance of the individual curves.
224
+
225
+ # 7 DISCUSSION AND FUTURE WORK
226
+
227
+ In this paper, we presented the problem of third-person imitation learning. We argue that this problem will be important going forward, as techniques in reinforcement learning and generative adversarial learning improve and the cost of collecting first-person samples remains high. We presented an algorithm which builds on Generative Adversarial Imitation Learning and is capable of solving simple third-person imitation tasks.
228
+
229
+ One promising direction of future work in this area is to jointly train policy features and cost features at the pixel level, allowing the reuse of image features. Code to train a third person imitation learning agent on the domains from this paper is presented here: https://github.com/bstadie/ third_person_im
230
+
231
+ # ACKNOWLEDGEMENTS
232
+
233
+ This work was done partially at OpenAI and partially at Berkeley. Work done at Berkeley was supported in part by Darpa under the Simplex program and the FunLoL program.
234
+
235
+ # REFERENCES
236
+
237
+ P. Abbeel and A. Ng. Apprenticeship learning via inverse reinforcement learning. In International Conference on Machine Learning (ICML), 2004.
238
+
239
+ Pieter Abbeel, Adam Coates, and Andrew Y Ng. Autonomous helicopter aerobatics through apprenticeship learning. The International Journal of Robotics Research, 2010.
240
+
241
+ Brenna D Argall, Sonia Chernova, Manuela Veloso, and Brett Browning. A survey of robot learning from demonstration. Robotics and autonomous systems, 57(5):469–483, 2009.
242
+
243
+ Yusuf Aytar and Andrew Zisserman. Tabula rasa: Model transfer for object category detection. In 2011 International Conference on Computer Vision, pp. 2252–2259. IEEE, 2011.
244
+
245
+ D. Barber and F. V. Agakov. Kernelized infomax clustering. NIPS, 2005.
246
+
247
+ A. Boularias, J. Kober, and J. Peters. Relative entropy inverse reinforcement learning. In International Conference on Artificial Intelligence and Statistics (AISTATS), 2011.
248
+
249
+ J. S. Bridle, A. J. Heading, and D. J. MacKay. Unsupervised classifiers, mutual information and phantom targets. NIPS, 1992.
250
+
251
+ Jane Bromley, James W Bentz, Leon Bottou, Isabelle Guyon, Yann LeCun, Cliff Moore, Eduard ´ Sackinger, and Roopak Shah. Signature verification using a siamese time delay neural network.¨ International Journal of Pattern Recognition and Artificial Intelligence, 7(04):669–688, 1993.
252
+
253
+ Sylvain Calinon. Robot programming by demonstration. EPFL Press, 2009.
254
+
255
+ Sylvain Calinon, Florent Guenter, and Aude Billard. On learning, representing, and generalizing a task in a humanoid robot. IEEE Transactions on Systems, Man, and Cybernetics, Part B (Cybernetics), 37(2):286–298, 2007.
256
+
257
+ Malinda Carpenter, Josep Call, and Michael Tomasello. Understanding prior intentions enables two–year–olds to imitatively learn a complex task. Child development, 73(5):1431–1441, 2002.
258
+
259
+ Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. Infogan: Interpretable representation learning by information maximizing generative adversarial nets. NIPS, 2016.
260
+
261
+ Sumit Chopra, Raia Hadsell, and Yann LeCun. Learning a similarity metric discriminatively, with application to face verification. In 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’05), volume 1, pp. 539–546. IEEE, 2005.
262
+
263
+ A. Doerr, N. Ratliff, J. Bohg, M. Toussaint, and S. Schaal. Direct loss minimization inverse optimal control. In Proceedings of Robotics: Science and Systems (R:SS), Rome, Italy, July 2015.
264
+
265
+ Jeff Donahue, Yangqing Jia, Oriol Vinyals, Judy Hoffman, Ning Zhang, Eric Tzeng, and Trevor Darrell. Decaf: A deep convolutional activation feature for generic visual recognition. In ICML, pp. 647–655, 2014.
266
+
267
+ Lixin Duan, Dong Xu, and Ivor Tsang. Learning with augmented features for heterogeneous domain adaptation. arXiv preprint arXiv:1206.4660, 2012.
268
+
269
+ C. Finn, S. Levine, and P. Abbeel. Guided cost learning: Deep inverse optimal control via policy optimization. ICML, 2016.
270
+
271
+ Y. Ganin and V. Lempitsky. Unsupervised domain adaptation by backpropagation. Arxiv preprint 1409.7495, 2014.
272
+
273
+ G Gioioso, G Salvietti, M Malvezzi, and D Prattichizzo. An object-based approach to map human hand synergies onto robotic hands with dissimilar kinematics. Robotics: Science and Systems VIII, pp. 97, 2013.
274
+
275
+ 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.
276
+
277
+ Abhishek Gupta, Clemens Eppner, Sergey Levine, and Pieter Abbeel. Learning dexterous manipulation for a soft robotic hand from human demonstration. arXiv preprint arXiv:1603.06348, 2016.
278
+
279
+ J. Ho and S. Ermon. Generative adversarial imitation learning. arXiv pre-print: 1606.03476, pp. 1061–1068, 2016.
280
+
281
+ Judy Hoffman, Erik Rodner, Jeff Donahue, Trevor Darrell, and Kate Saenko. Efficient learning of domain-invariant image representations. arXiv preprint arXiv:1301.3224, 2013.
282
+
283
+ M. Kalakrishnan, P. Pastor, L. Righetti, and S. Schaal. Learning objective functions for manipulation. In International Conference on Robotics and Automation (ICRA), 2013.
284
+
285
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of the 3rd International Conference on Learning Representations (ICLR), 2014.
286
+
287
+ A. Krause, P. Perona, and R. G. Gomes. Discriminative clustering by regularized information maximization. NIPS, 2010.
288
+
289
+ Brian Kulis, Kate Saenko, and Trevor Darrell. What you saw is not what you get: Domain adaptation using asymmetric kernel transforms. In Computer Vision and Pattern Recognition (CVPR), 2011 IEEE Conference on, pp. 1785–1792. IEEE, 2011.
290
+
291
+ S. Levine, Z. Popovic, and V. Koltun. Nonlinear inverse reinforcement learning with gaussian processes. In Advances in Neural Information Processing Systems (NIPS), 2011.
292
+
293
+ Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. Journal of Machine Learning Research, 17(39):1–40, 2016.
294
+
295
+ Mingsheng Long and Jianmin Wang. Learning transferable features with deep adaptation networks. CoRR, abs/1502.02791, 1:2, 2015.
296
+
297
+ Yishay Mansour, Mehryar Mohri, and Afshin Rostamizadeh. Domain adaptation: Learning bounds and algorithms. arXiv preprint arXiv:0902.3430, 2009.
298
+
299
+ 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.
300
+
301
+ 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.
302
+
303
+ Chrystopher L Nehaniv. Nine billion correspondence problems. Imitation and Social Learning in Robots, Humans and Animals: Behavioural, Social and Communicative Dimensions, Cambridge University Press, 8:10, 2007.
304
+
305
+ Chrystopher L Nehaniv and Kerstin Dautenhahn. Like me?-measures of correspondence and imitation. Cybernetics & Systems, 32(1-2):11–51, 2001.
306
+
307
+ A. Ng, S. Russell, et al. Algorithms for inverse reinforcement learning. In International Conference on Machine Learning (ICML), 2000.
308
+
309
+ Dean A Pomerleau. Alvinn: An autonomous land vehicle in a neural network. In Advances in Neural Information Processing Systems, pp. 305–313, 1989.
310
+
311
+ D. Ramachandran and E. Amir. Bayesian inverse reinforcement learning. In AAAI Conference on Artificial Intelligence, volume 51, 2007.
312
+
313
+ N. Ratliff, J. A. Bagnell, and M. A. Zinkevich. Maximum margin planning. In International Conference on Machine Learning (ICML), 2006.
314
+
315
+ N. Ratliff, D. Bradley, J. A. Bagnell, and J. Chestnutt. Boosting structured prediction for imitation learning. 2007.
316
+
317
+ Stephane Ross, Geoffrey J Gordon, and Drew Bagnell. A reduction of imitation learning and struc-´ tured prediction to no-regret online learning. In AISTATS, volume 1, pp. 6, 2011.
318
+
319
+ Stefan Schaal. Is imitation learning the route to humanoid robots? Trends in cognitive sciences, 3 (6):233–242, 1999.
320
+
321
+ John Schulman, Sergey Levine, Philipp Moritz, Michael I. Jordan, and Pieter Abbeel. Trust region policy optimization. Arxiv preprint 1502.05477, 2015a.
322
+
323
+ John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. Highdimensional continuous control using generalized advantage estimation. arXiv preprint arXiv:1506.02438, 2015b.
324
+
325
+ Aaron Shon, Keith Grochow, Aaron Hertzmann, and Rajesh P Rao. Learning shared latent structure for image synthesis and robotic imitation. In Advances in Neural Information Processing Systems, pp. 1233–1240, 2005.
326
+
327
+ Eric Tzeng, Judy Hoffman, Ning Zhang, Kate Saenko, and Trevor Darrell. Deep domain confusion: Maximizing for domain invariance. arXiv preprint arXiv:1412.3474, 2014.
328
+
329
+ Eric Tzeng, Coline Devin, Judy Hoffman, Chelsea Finn, Xingchao Peng, Pieter Abbeel, Sergey Levine, Kate Saenko, and Trevor Darrell. Towards adapting deep visuomotor representations from simulated to real environments. arXiv preprint arXiv:1511.07111, 2015.
330
+
331
+ M. Wulfmeier, P. Ondruska, and I. Posner. Maximum entropy deep inverse reinforcement learning. arXiv preprint arXiv:1507.04888, 2015.
332
+
333
+ Jun Yang, Rong Yan, and Alexander G Hauptmann. Cross-domain video concept detection using adaptive svms. In Proceedings of the 15th ACM international conference on Multimedia, pp. 188–197. ACM, 2007.
334
+
335
+ B. Ziebart, A. Maas, J. A. Bagnell, and A. K. Dey. Maximum entropy inverse reinforcement learning. In AAAI Conference on Artificial Intelligence, 2008.
336
+
337
+ # 8 APPENDIX A: LEARNING CURVES FOR BASELINES
338
+
339
+ Here, we plot the learning curves for each of the baselines mentioned in the experiments section as a standalone plot. This allows one to better examine the variance of each individual learning curve.
340
+
341
+ ![](images/ea1b67edb2dfdb4fef94fc8a920576a33c7505c4ce55718706bd9be88e6caa3d.jpg)
342
+ Figure 10: Inverted Pendulum performance under a policy trained on RL, first-person imitation learning, third-person imitation, and a first-person policy applied to a third-person agent.
343
+
344
+ ![](images/b6baae997578e700d576c20450de54e13c29bc04641825948f30b3aa8cd5b4b7.jpg)
345
+ Figure 11: Reacher performance under a policy trained on RL, first-person imitation learning, thirdperson imitation, and a first-person policy applied to a third-person agent.
346
+
347
+ ![](images/93145b975be3c2886cda5aca0198047a94819a2d2d82acbc535b32d11815a821.jpg)
348
+ Figure 12: Point performance under a policy trained on RL, first-person imitation learning, thirdperson imitation, and a first-person policy applied to a third-person agent.
349
+
350
+ # 9 APPENDIX B: ARCHITECTURE PARAMETERS
351
+
352
+ Joint Feature Extractor: Input is images are size $5 0 \mathrm { ~ x ~ } 5 0$ with 3 channels, RGB. Layers are 2 convolutional layers each followed by a max pooling layer of size 2. Layers use 5 filters of size 3 each.
353
+
354
+ Domain Discriminator and the Class Discriminator: Input is domain agnostic output of convolutional layers. Layers are two feed forward layers of size 128 followed by a final feed forward layer of size 2 and a soft-max layer to get the log probabilities.
355
+
356
+ ADAM is used for discriminator training with a learning rate of 0.001. The RL generator uses the off-the-shelf TRPO implementation available in RLLab.
md/train/B184E5qee/B184E5qee.md ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # IMPROVING NEURAL LANGUAGE MODELS WITH A CONTINUOUS CACHE
2
+
3
+ Edouard Grave, Armand Joulin, Nicolas Usunier Facebook AI Research {egrave,ajoulin,usunier}@fb.com
4
+
5
+ # ABSTRACT
6
+
7
+ We propose an extension to neural network language models to adapt their prediction to the recent history. Our model is a simplified version of memory augmented networks, which stores past hidden activations as memory and accesses them through a dot product with the current hidden activation. This mechanism is very efficient and scales to very large memory sizes. We also draw a link between the use of external memory in neural network and cache models used with count based language models. We demonstrate on several language model datasets that our approach performs significantly better than recent memory augmented networks.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Language models, which are probability distributions over sequences of words, have many applications such as machine translation (Brown et al., 1993), speech recognition (Bahl et al., 1983) or dialogue agents (Stolcke et al., 2000). While traditional neural networks language models have obtained state-of-the-art performance in this domain (Jozefowicz et al., 2016; Mikolov et al., 2010), they lack the capacity to adapt to their recent history, limiting their application to dynamic environments (Dodge et al., 2015). A recent approach to solve this problem is to augment these networks with an external memory (Graves et al., 2014; Grefenstette et al., 2015; Joulin & Mikolov, 2015; Sukhbaatar et al., 2015). These models can potentially use their external memory to store new information and adapt to a changing environment.
12
+
13
+ While these networks have obtained promising results on language modeling datasets (Sukhbaatar et al., 2015), they are quite computationally expensive. Typically, they have to learn a parametrizable mechanism to read or write to memory cells (Graves et al., 2014; Joulin & Mikolov, 2015). This may limit both the size of their usable memory as well as the quantity of data they can be trained on. In this work, we propose a very light-weight alternative that shares some of the properties of memory augmented networks, notably the capability to dynamically adapt over time. By minimizing the computation burden of the memory, we are able to use larger memory and scale to bigger datasets. We observe in practice that this allows us to surpass the perfomance of memory augmented networks on different language modeling tasks.
14
+
15
+ Our model share some similarities with a model proposed by Kuhn (1988), called the cache model. A cache model stores a simple representation of the recent past, often in the form of unigrams, and uses them for prediction (Kuhn & De Mori, 1990). This contextual information is quite cheap to store and can be accessed efficiently. It also does not need any training and can be appplied on top of any model. This makes this model particularly interesting for domain adaptation (Kneser & Steinbiss, 1993).
16
+
17
+ Our main contribution is to propose a continuous version of the cache model, called Neural Cache Model, that can be adapted to any neural network language model. We store recent hidden activations and use them as representation for the context. Using simply a dot-product with the current hidden activations, they turn out to be extremely informative for prediction. Our model requires no training and can be used on any pre-trained neural networks. It also scales effortlessly to thousands of memory cells. We demonstrate the quality of the Neural Cache models on several language model tasks and the LAMBADA dataset (Paperno et al., 2016).
18
+
19
+ # 2 LANGUAGE MODELING
20
+
21
+ A language model is a probability distribution over sequences of words. Let $V$ be the size of the vocabulary; each word is represented by a one-hot encoding vector $x$ in $\mathbb { R } ^ { V } = \nu$ , corresponding to its index in the vocabulary. Using the chain rule, the probability assigned to a sequence of words $x _ { 1 } , \ldots , x _ { T }$ can be factorized as
22
+
23
+ $$
24
+ p ( x _ { 1 } , . . . , x _ { T } ) = \prod _ { t = 1 } ^ { T } p ( x _ { t } \mid x _ { t - 1 } , . . . , x _ { 1 } ) .
25
+ $$
26
+
27
+ Language modeling is often framed as learning the conditional probability over words, given the history (Bahl et al., 1983).
28
+
29
+ This conditional probability is traditionally approximated with non-parameteric models based on counting statistics (Goodman, 2001). In particular, smoothed N-gram models (Katz, 1987; Kneser & Ney, 1995) achieve good performance in practice (Mikolov et al., 2011). Parametrized alternatives are either maximum entropy language models (Rosenfeld, 1996), feedforward networks (Bengio et al., 2003) or recurrent networks (Mikolov et al., 2010). In particular, recurrent networks are currently the best solution to approximate this conditional probability, achieving state-of-the-arts performance on standard language modeling benchmarks (Jozefowicz et al., 2016; Zilly et al., 2016).
30
+
31
+ Recurrent networks. Assuming that we have a vector $h _ { t } \in \mathbb { R } ^ { d }$ encoding the history $x _ { t } , . . . , x _ { 1 }$ , the conditional probability of a word $w$ can be parametrized as
32
+
33
+ $$
34
+ p _ { v o c a b } ( w \mid x _ { t } , . . . , x _ { 1 } ) \propto \exp ( h _ { t } ^ { \top } o _ { w } ) .
35
+ $$
36
+
37
+ The history vector $h _ { t }$ is computed by a recurrent network by recursively applying an equation of the form
38
+
39
+ $$
40
+ h _ { t } = \Phi \left( x _ { t } , h _ { t - 1 } \right) ,
41
+ $$
42
+
43
+ where $\Phi$ is a function depending on the architecture of the network. Several architecture for recurrent networks have been proposed, such as the Elman network (Elman, 1990), the long short-term memory (LSTM) (Hochreiter & Schmidhuber, 1997) or the gated recurrent unit (GRU) (Chung et al., 2014). One of the simplest recurrent networks is the Elman network (Elman, 1990), where
44
+
45
+ $$
46
+ h _ { t } = \sigma \left( L x _ { t } + R h _ { t - 1 } \right) ,
47
+ $$
48
+
49
+ where $\sigma$ is a non-linearity such as the logistic or tanh functions, $L \in \mathbb { R } ^ { d \times V }$ is a word embedding matrix and $R \in \mathbb { R } ^ { d \times d }$ is the recurrent matrix. The LSTM architecture is particularly interesting in the context of language modelling (Jozefowicz et al., 2016) and we refer the reader to Graves et al. (2013) for details on this architecture.
50
+
51
+ The parameters of recurrent neural network language models are learned by minimizing the negative log-likelihood of the training data. This objective function is usually minimized by using the stochastic gradient descent algorithm, or variants such as Adagrad (Duchi et al., 2011). The gradient is computed using the truncated backpropagation through time algorithm (Werbos, 1990; Williams & Peng, 1990).
52
+
53
+ Cache model. After a word appears once in a document, it is much more likely to appear again. As an example, the frequency of the word tiger on the Wikipedia page of the same name is $2 . 8 \%$ , compared to $0 . 0 0 3 7 \%$ over the whole Wikipedia. Cache models exploit this simple observation to improve $n$ -gram language models by capturing long-range dependencies in documents. More precisely, these models have a cache component, which contains the words that appeared in the recent history (either the document or a fixed number of words). A simple language model, such as a unigram or smoothed bigram model, is fitted on the words of the cache and interpolated with the static language model (trained over a larger dataset). This technique has many advantages. First, this is a very efficient way to adapt a language model to a new domain. Second, such models can predict out-of-vocabulary words (OOV words), after seeing them once. Finally, this helps capture long-range dependencies in documents, in order to generate more coherent text.
54
+
55
+ ![](images/cf4652e06ce92d3dc252856a2cd9705b2ca2a4147643ec3cc2c62263c4eaeb03.jpg)
56
+ Figure 1: The neural cache stores the previous hidden states in memory cells. They are then used as keys to retrieve their corresponding word, that is the next word. There is no transformation applied to the storage during writing and reading.
57
+
58
+ # 3 NEURAL CACHE MODEL
59
+
60
+ The Neural Cache Model adds a cache-like memory to neural network language models. It exploits the hidden representations $h _ { t }$ to define a probability distribution over the words in the cache. As illustrated Figure 1, the cache stores pairs $\left( h _ { i } , x _ { i + 1 } \right)$ of a hidden representation, and the word which was generated based on this representation (we remind the reader that the vector $h _ { i }$ encodes the history $x _ { i } , . . . , x _ { 1 } )$ . At time $t$ , we then define a probability distribution over words stored in the cache based on the stored hidden representations and the current one $h _ { t }$ as
61
+
62
+ $$
63
+ p _ { c a c h e } ( w \mid h _ { 1 . . t } , ~ x _ { 1 . . t } ) \propto \sum _ { i = 1 } ^ { t - 1 } \mathbb { 1 } _ { \{ w = x _ { i + 1 } \} } \exp ( \theta h _ { t } ^ { \top } h _ { i } )
64
+ $$
65
+
66
+ where the scalar $\theta$ is a parameter which controls the flatness of the distribution. When $\theta$ is equal to zero, the probability distribution over the history is uniform, and our model is equivalent to a unigram cache model (Kuhn & De Mori, 1990).
67
+
68
+ From the point of view of memory-augmented neural networks, the probability $p _ { c a c h e } ( w \mid h _ { 1 . . t } , \ x _ { 1 . . t } )$ given by the neural cache model can be interpreted as the probability to retrieve the word $w$ from the memory given the query $h _ { t }$ , where the desired answer is the next word $x _ { t + 1 }$ . Using previous hidden states as keys for the words in the memory, the memory lookup operator can be implemented with simple dot products between the keys and the query. In contrast to existing memory-augmented neural networks, the neural cache model avoids the need to learn the memory lookup operator. Such a cache can thus be added to a pre-trained recurrent neural language model without fine tuning of the parameters, and large cache size can be used with negligible impact on the computational cost of a prediction.
69
+
70
+ Neural cache language model. Following the standard practice in n-gram cache-based language models, the final probability of a word is given by the linear interpolation of the cache language model with the regular language model, obtaining:
71
+
72
+ $$
73
+ p ( w \mid h _ { 1 . . t } , ~ x _ { 1 . . t } ) = ( 1 - \lambda ) p _ { v o c a b } ( w \mid h _ { t } ) + \lambda p _ { c a c h e } ( w \mid h _ { 1 . . t } , x _ { 1 . . t } ) .
74
+ $$
75
+
76
+ Instead of taking a linear interpolation between the two distribution with a fixed $\lambda$ , we also consider a global normalization over the two distribution:
77
+
78
+ $$
79
+ p ( w \mid h _ { 1 . . t } , ~ x _ { 1 . . t } ) \propto \left( \exp ( h _ { t } ^ { \top } o _ { w } ) + \sum _ { i = 1 } ^ { t - 1 } \mathbb { 1 } _ { \{ w = x _ { i + 1 } \} } \exp ( \theta h _ { t } ^ { \top } h _ { i } + \alpha ) \right) .
80
+ $$
81
+
82
+ This corresponds to taking a softmax over the vocabulary and the words in the cache. The parameter $\alpha$ controls the weight of the cache component, and is the counterpart of the $\lambda$ parameter for linear interpolation.
83
+
84
+ The addition of the neural cache to a recurrent neural language model inherits the advantages of $n$ - gram caches in usual cache-based models: The probability distribution over words is updated online depending on the context, and out-of-vocabulary words can be predicted as soon as they have been seen at least once in the recent history. The neural cache also inherits the ability of the hidden states of recurrent neural networks to model longer-term contexts than small $n$ -grams, and thus allows for a finer modeling of the current context than e.g., unigram caches.
85
+
86
+ ![](images/89dee18a863e0919f58a31c0b0fced0db90e513f3d196f09ed8d2380bb79b7fb.jpg)
87
+ Figure 2: Perplexity on the validation set of Penn Tree Bank for linear interpolation (left) and global normalization (right), for various values of hyperparameters $\theta$ , $\lambda$ and $\alpha$ . We use a cache model of size 500. The base model has a validation perplexity of 86.9. The best linear interpolation has a perplexity of 74.6, while the best global normalization has a perplexity of 74.9.
88
+
89
+ Table 1: Test perplexity on the Penn Tree Bank.
90
+
91
+ <table><tr><td>Model</td><td>Test PPL</td></tr><tr><td>RNN+LSA+KN5+cache (Mikolov &amp; Zweig, 2012)</td><td>90.3</td></tr><tr><td>LSTM (Zaremba et al., 2014)</td><td>78.4</td></tr><tr><td>Variational LSTM (Gal &amp; Ghahramani, 2015)</td><td>73.4</td></tr><tr><td>Recurrent Highway Network (Zilly et al., 2016)</td><td>66.0</td></tr><tr><td>Pointer Sentinel LSTM (Merity et al.,2016)</td><td>70.9</td></tr><tr><td>LSTM (our implem.)</td><td>82.3</td></tr><tr><td>Neural cache model</td><td>72.1</td></tr></table>
92
+
93
+ Training procedure. For now, we first train the (recurrent) neural network language model, without the cache component. We only apply the cache model at test time, and choose the hyperparameters $\theta$ and $\lambda$ (or $\alpha$ ) on the validation set. A big advantage of our method is that it is very easy and cheap to apply, with already trained neural models. There is no need to perform backpropagation over large contexts, and we can thus apply our method with large cache sizes (larger than one thousand).
94
+
95
+ # 4 RELATED WORK
96
+
97
+ Cache model. Adding a cache to a language model was intoducted in the context of speech recognition(Kuhn, 1988; Kupiec, 1989; Kuhn & De Mori, 1990). These models were further extended by Jelinek et al. (1991) into a smoothed trigram language model, reporting reduction in both perplexity and word error rates. Della Pietra et al. (1992) adapt the cache to a general $n$ -gram model such that it satisfies marginal constraints obtained from the current document.
98
+
99
+ Adaptive language models. Other adaptive language models have been proposed in the past: Kneser & Steinbiss (1993) and Iyer & Ostendorf (1999) dynamically adapt the parameters of their model to the recent history using different weight interpolation schemes. Bellegarda (2000) and Coccaro & Jurafsky (1998) use latent semantic analysis to adapt their models to the current context. Similarly, topic features have been used with either maximum entropy models (Khudanpur & Wu, 2000) or recurrent networks (Mikolov & Zweig, 2012; Wang & Cho, 2015). Finally, Lau et al. (1993) proposes to use pairs of distant of words to capture long-range dependencies.
100
+
101
+ Memory augmented neural networks. In the context of sequence prediction, several memory augmented neural networks have obtained promising results (Sukhbaatar et al., 2015; Graves et al., 2014; Grefenstette et al., 2015; Joulin & Mikolov, 2015). In particular, Sukhbaatar et al. (2015) stores a representation of the recent past and accesses it using an attention mechanism Bahdanau et al. (2014). Sukhbaatar et al. (2015) shows that this reduces the perplexity for language modeling.
102
+
103
+ ![](images/1f2579aa6e9ffc10db91676682d66b0fb2f6c4f3c580061eb001161b8e41d356.jpg)
104
+ Figure 3: Perplexity on the validation set of wikitext2 for linear interpolation (left) and global normalization (right), for various values of hyperparameters $\theta$ , $\lambda$ and $\alpha$ . We use a cache model of size 2000. The base model has a validation perplexity of 104.2. The best linear interpolation has a perplexity of 72.1, while the best global normalization has a perplexity of 73.5.
105
+
106
+ <table><tr><td>Model</td><td>wikitext2</td><td>wikitext103</td></tr><tr><td>Zoneout + Variational LSTM (Merity et al.,2016)</td><td>100.9</td><td></td></tr><tr><td>Pointer Sentinel LSTM (Merity et al., 2016)</td><td>80.8</td><td>1</td></tr><tr><td>LSTM (our implementation)</td><td>99.3</td><td>48.7</td></tr><tr><td>Neural cache model (size = 100)</td><td>81.6</td><td>44.8</td></tr><tr><td>Neural cache model (size = 2,000)</td><td>68.9</td><td>40.8</td></tr></table>
107
+
108
+ Table 2: Test perplexity on the wikitext datasets. The two datasets share the same validation and test sets, making all the results comparable.
109
+
110
+ This approach has been successfully applied to question answering, when the answer is contained in a given paragraph (Chen et al., 2016; Hermann et al., 2015; Kadlec et al., 2016; Sukhbaatar et al., 2015). Similarly, Vinyals et al. (2015) explores the use of this mechanism to reorder sequences of tokens. Their network uses an attention (or “pointer”) over the input sequence to predict which element should be selected as the next output. Gulcehre et al. (2016) have shown that a similar mechanism called pointer softmax could be used in the context of machine translation, to decide which word to copy from the source to target.
111
+
112
+ Independently of our work, Merity et al. (2016) apply the same mechanism to recurrent network. Unlike our work, they uses the current hidden activation as a representation of the current input (while we use it to represent the output). This requires additional learning of a transformation between the current representation and those in the past. The advantage of our approach is that we can scale to very large caches effortlessly.
113
+
114
+ # 5 EXPERIMENTS
115
+
116
+ In this section, we evaluate our method on various language modeling datasets, which have different sizes and characteristics. On all datasets, we train a static recurrent neural network language model with LSTM units. We then use the hidden representations from this model to obtain our cache, which is interpolated with the static LSTM model. We also evaluate a unigram cache model interpolated with the static model as another baseline.
117
+
118
+ # 5.1 SMALL SCALE EXPERIMENTS
119
+
120
+ Datasets. In this section, we describe experiments performed on two small datasets: the Penn Tree Bank (Marcus et al., 1993) and the wikitext2 (Merity et al., 2016) datasets. The Penn Tree Bank dataset is made of articles from the Wall Street Journal, contains $9 2 9 \mathrm { k }$ training tokens and has a vocabulary size of 10k. The wikitext2 dataset is derived from Wikipedia articles, contains 2M training tokens and has a vocabulary size of 33k. These datasets contain non-shuffled documents, therefore requiring models to capture inter-sentences dependencies to perform well.
121
+
122
+ ![](images/239b837a7406cfdca609786eda77fbccc139af2404a2727b6d8c5998ce090737.jpg)
123
+ Figure 4: Test perplexity as a function of the number of words in the cache, for our method and a unigram cache baseline. We observe that our approach can uses larger caches than the baseline.
124
+
125
+ Implementation details. We train recurrent neural network language models with 1024 LSTM units, regularized with dropout (probability of dropping out units equals to 0.65). We use the Adagrad algorithm, with a learning rate of 0.2, a batchsize of 20 and initial weight uniformly sampled in the range $[ - 0 . 0 5 , 0 . 0 5 ]$ . We clip the norm of the gradient to 0.1 and unroll the network for 30 steps. We consider cache sizes on a logarithmic scale, from 50 to 10, 000, and fit the cache hyperparameters on the validation set.
126
+
127
+ Results. We report the perplexity on the validation sets in Figures 2 and 3, for various values of hyperparameters, for linear interpolation and global normalization. First, we observe that on both datasets, the linear interpolation method performs slightly better than the global normalization approach. It is also easier to apply in practice, and we thus use this method in the remainder of this paper. In Tables 1 and 2, we report the test perplexity of our approach and state-of-the-art models. Our approach is competitive with previous models, in particular with the pointer sentinel LSTM model of Merity et al. (2016). On Penn Tree Bank, we note that the improvement over the base model is similar for both methods. On the wikitext2 dataset, both methods obtain similar results when using the same cache size (100 words). Since our method is computationally cheap, it is easy to increase the cache to larger values (2, 000 words), leading to dramatic improvements ( $3 0 \%$ over the baseline, $1 2 \%$ over a small cache of 100 words).
128
+
129
+ # 5.2 MEDIUM SCALE EXPERIMENTS
130
+
131
+ Datasets and implementation details. In this section, we describe experiments performed over two medium scale datasets: text8 and wikitext103. Both datasets are derived from Wikipedia, but different pre-processing were applied. The text8 dataset contains 17M training tokens and has a vocabulary size of 44k words, while the wikitext103 dataset has a training set of size 103M, and a vocabulary size of 267k words. We use the same setting as in the previous section, except for the batchsize (we use 128) and dropout parameters (we use 0.45 for text8 and 0.25 for wikitext103). Since both datasets have large vocabularies, we use the adaptive softmax (Grave et al., 2016) for faster training.
132
+
133
+ Results. We report the test perplexity as a function of the cache size in Figure 4, for the neural cache model and a unigram cache baseline. We observe that our approach can exploits larger cache sizes, compared to the baseline. In Table 2, we observe that the improvement in perplexity of our method over the LSTM baseline on wikitext103 is smaller than for wikitext2 (approx. $1 6 \%$ v.s. $3 0 \%$ ). The fact that improvements obtained with more advanced techniques decrease when the size of training data increases has already been observed by Goodman (2001). Both wikitext datasets sharing the same test set, we also observe that the LSTM baseline, trained on 103M tokens (wikitext103), strongly outperforms more sophisticated methods, trained on 2M tokens (wikitext2). For these two reasons, we believe that it is important to evaluate and compare methods on relatively large datasets.
134
+
135
+ <table><tr><td>Model</td><td>Test</td></tr><tr><td>LSTM-500 (Mikolov et al., 2014) SCRNN (Mikolov et al., 2014)</td><td>156</td></tr><tr><td>MemNN (Sukhbaatar et al., 2015)</td><td>161 147</td></tr><tr><td>LSTM-1024 (our implem.)</td><td>121.8</td></tr><tr><td>Neural cache model</td><td>99.9</td></tr></table>
136
+
137
+ (a) text8
138
+
139
+ <table><tr><td>Model</td><td>Dev</td><td>Ctrl</td></tr><tr><td>WB5 (Paperno et al., 2016) WB5+cache (Paperno et al., 2016)</td><td>3125 768</td><td>285</td></tr><tr><td>LSTM-512 (Paperno et al., 2016)</td><td>5357</td><td>270 149</td></tr><tr><td>LSTM-1024 (our implem.)</td><td>4088</td><td>94</td></tr><tr><td>Neural cache model</td><td>138</td><td>129</td></tr></table>
140
+
141
+ (b) lambada
142
+
143
+ ![](images/3927384ae624d65f7ffe727b8d722a996fbce28ae8ec55bfda11221b9c005b0a.jpg)
144
+ Table 3: Perplexity on the text8 and lambada datasets. WB5 stands for 5-gram language model with Witten-Bell smoothing.
145
+ Figure 5: Perplexity on the development and control sets of lambada, as a function of the interpolation parameters $\lambda$ .
146
+
147
+ # 5.3 EXPERIMENTS ON THE LAMBADA DATASET
148
+
149
+ Finally, we report experiments carried on the lambada dataset, introduced by Paperno et al. (2016). This is a dataset of short passages extracted from novels. The goal is to predict the last word of the excerpt. This dataset was built so that human subjects solve the task perfectly when given the full context (approx. 4.6 sentences), but fail to do so when only given the sentence with the target word. Thus, most state-of-the-art language models fail on this dataset. The lambada training set contains approximately 200M tokens and has a vocabulary size of 93, 215. We report results for our method in Table 3, as well the performance of baselines from Paperno et al. (2016). Adding a neural cache model to the LSTM baseline strongly improves the performance on the lambada dataset. We also observe in Figure 5 that the best interpolation parameter between the static model and the cache is not the same for the development and control sets. This is due to the fact that more than $83 \%$ of passages of the development set include the target word, while this is true for only $14 \%$ of the control set. Ideally, a model should have strong results on both sets. One possible generalization of our model would be to adapt the interpolation parameter based on the current vector representation of the history $h _ { t }$ .
150
+
151
+ # 6 CONCLUSION
152
+
153
+ We presented the neural cache model to augment neural language models with a longer-term memory that dynamically updates the word probablilities based on the long-term context. A neural cache can be added on top of a pre-trained language model at negligible cost. Our experiments on both language modeling tasks and the challenging LAMBADA dataset shows that significant performance gains can be expected by adding this external memory component.
154
+
155
+ Technically, the neural cache models is similar to some recent memory-augmented neural networks such as pointer networks. However, its specific design makes it possible to avoid learning the memory lookup component. This makes the neural cache appealing since it can use larger cache sizes than memory-augment networks and can be applied as easily as traditional count-based caches.
156
+
157
+ # REFERENCES
158
+
159
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
160
+
161
+ Lalit R Bahl, Frederick Jelinek, and Robert L Mercer. A maximum likelihood approach to continuous speech recognition. PAMI, 1983.
162
+
163
+ Jerome R Bellegarda. Exploiting latent semantic information in statistical language modeling. Proceedings of the IEEE, 2000.
164
+
165
+ Yoshua Bengio, Réjean Ducharme, Pascal Vincent, and Christian Jauvin. A neural probabilistic language model. JMLR, 2003.
166
+
167
+ Peter F Brown, Vincent J Della Pietra, Stephen A Della Pietra, and Robert L Mercer. The mathematics of statistical machine translation: Parameter estimation. Computational linguistics, 1993.
168
+
169
+ Danqi Chen, Jason Bolton, and Christopher D Manning. A thorough examination of the cnn/daily mail reading comprehension task. arXiv preprint arXiv:1606.02858, 2016.
170
+
171
+ Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014.
172
+
173
+ Noah Coccaro and Daniel Jurafsky. Towards better integration of semantic predictors in statistical language modeling. In ICSLP. Citeseer, 1998.
174
+
175
+ Stephen Della Pietra, Vincent Della Pietra, Robert L Mercer, and Salim Roukos. Adaptive language modeling using minimum discriminant estimation. In Proceedings of the workshop on Speech and Natural Language, 1992.
176
+
177
+ 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. arXiv preprint arXiv:1511.06931, 2015.
178
+
179
+ John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. JMLR, 2011.
180
+
181
+ Jeffrey L Elman. Finding structure in time. Cognitive science, 1990.
182
+
183
+ Yarin Gal and Zoubin Ghahramani. A theoretically grounded application of dropout in recurrent neural networks. arXiv preprint arXiv:1512.05287, 2015.
184
+
185
+ Joshua T Goodman. A bit of progress in language modeling. Computer Speech & Language, 2001.
186
+
187
+ Edouard Grave, Armand Joulin, Moustapha Cissé, David Grangier, and Hervé Jégou. Efficient softmax approximation for gpus. arXiv preprint arXiv:1609.04309, 2016.
188
+
189
+ A. Graves, A. Mohamed, and G. Hinton. Speech recognition with deep recurrent neural networks. In ICASSP, 2013.
190
+
191
+ Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprint arXiv:1410.5401, 2014.
192
+
193
+ Edward Grefenstette, Karl Moritz Hermann, Mustafa Suleyman, and Phil Blunsom. Learning to transduce with unbounded memory. In Advances in Neural Information Processing Systems, pp. 1828–1836, 2015.
194
+
195
+ Caglar Gulcehre, Sungjin Ahn, Ramesh Nallapati, Bowen Zhou, and Yoshua Bengio. Pointing the unknown words. arXiv preprint arXiv:1603.08148, 2016.
196
+
197
+ Karl Moritz Hermann, Tomas Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. In NIPS, 2015.
198
+
199
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 1997.
200
+
201
+ Rukmini M Iyer and Mari Ostendorf. Modeling long distance dependence in language: Topic mixtures versus dynamic cache models. IEEE Transactions on speech and audio processing, 1999.
202
+
203
+ Frederick Jelinek, Bernard Merialdo, Salim Roukos, and Martin Strauss. A dynamic language model for speech recognition. In HLT, 1991.
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
+ Rafal Jozefowicz, Oriol Vinyals, Mike Schuster, Noam Shazeer, and Yonghui Wu. Exploring the limits of language modeling. arXiv preprint arXiv:1602.02410, 2016.
208
+
209
+ Rudolf Kadlec, Martin Schmid, Ondrej Bajgar, and Jan Kleindienst. Text understanding with the attention sum reader network. arXiv preprint arXiv:1603.01547, 2016.
210
+
211
+ Slava M Katz. Estimation of probabilities from sparse data for the language model component of a speech recognizer. ICASSP, 1987.
212
+
213
+ Sanjeev Khudanpur and Jun Wu. Maximum entropy techniques for exploiting syntactic, semantic and collocational dependencies in language modeling. Computer Speech & Language, 2000.
214
+
215
+ Reinhard Kneser and Hermann Ney. Improved backing-off for m-gram language modeling. In ICASSP, 1995.
216
+
217
+ Reinhard Kneser and Volker Steinbiss. On the dynamic adaptation of stochastic language models. In ICASSP, 1993.
218
+
219
+ Roland Kuhn. Speech recognition and the frequency of recently used words: A modified markov model for natural language. In Proceedings of the 12th conference on Computational linguistics-Volume 1, 1988.
220
+
221
+ Roland Kuhn and Renato De Mori. A cache-based natural language model for speech recognition. PAMI, 1990.
222
+
223
+ Julien Kupiec. Probabilistic models of short and long distance word dependencies in running text. In Proceedings of the workshop on Speech and Natural Language, 1989.
224
+
225
+ Raymond Lau, Ronald Rosenfeld, and Salim Roukos. Trigger-based language models: A maximum entropy approach. In ICASSP, 1993.
226
+
227
+ Mitchell P Marcus, Mary Ann Marcinkiewicz, and Beatrice Santorini. Building a large annotated corpus of english: The penn treebank. Computational linguistics, 1993.
228
+
229
+ Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. arXiv preprint arXiv:1609.07843, 2016.
230
+
231
+ Tomas Mikolov and Geoffrey Zweig. Context dependent recurrent neural network language model. In SLT, 2012.
232
+
233
+ Tomas Mikolov, Martin Karafiát, Lukas Burget, Jan Cernocky, and Sanjeev Khudanpur. Recurrent neural \` network based language model. In INTERSPEECH, 2010.
234
+
235
+ Tomas Mikolov, Anoop Deoras, Stefan Kombrink, Lukas Burget, and Jan Cernocky. Empirical evaluation and \` combination of advanced language modeling techniques. In INTERSPEECH, 2011.
236
+
237
+ Tomas Mikolov, Armand Joulin, Sumit Chopra, Michael Mathieu, and Marc’Aurelio Ranzato. Learning longer memory in recurrent neural networks. arXiv preprint arXiv:1412.7753, 2014.
238
+
239
+ Denis Paperno, Germán Kruszewski, Angeliki Lazaridou, Quan Ngoc Pham, Raffaella Bernardi, Sandro Pezzelle, Marco Baroni, Gemma Boleda, and Raquel Fernández. The lambada dataset: Word prediction requiring a broad discourse context. arXiv preprint arXiv:1606.06031, 2016.
240
+
241
+ Ronald Rosenfeld. A maximum entropy approach to adaptive statistical language modeling. Computer, Speech and Language, 1996.
242
+
243
+ Andreas Stolcke, Noah Coccaro, Rebecca Bates, Paul Taylor, Carol Van Ess-Dykema, Klaus Ries, Elizabeth Shriberg, Daniel Jurafsky, Rachel Martin, and Marie Meteer. Dialogue act modeling for automatic tagging and recognition of conversational speech. Computational linguistics, 2000.
244
+
245
+ Sainbayar Sukhbaatar, Szlam Arthur, Jason Weston, and Rob Fergus. End-to-end memory networks. In NIPS, 2015.
246
+
247
+ Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In NIPS, 2015.
248
+
249
+ Tian Wang and Kyunghyun Cho. Larger-context language modelling. arXiv preprint arXiv:1511.03729, 2015.
250
+
251
+ Paul J Werbos. Backpropagation through time: what it does and how to do it. 1990.
252
+
253
+ Ronald J Williams and Jing Peng. An efficient gradient-based algorithm for on-line training of recurrent network trajectories. Neural computation, 1990.
254
+
255
+ Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. arXiv preprint arXiv:1409.2329, 2014.
256
+
257
+ Julian Georg Zilly, Rupesh Kumar Srivastava, Jan Koutník, and Jürgen Schmidhuber. Recurrent highway networks. arXiv preprint arXiv:1607.03474, 2016.
md/train/B1E7Pwqgl/B1E7Pwqgl.md ADDED
@@ -0,0 +1,428 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # COOPERATIVE TRAINING OF DESCRIPTOR AND GEN-ERATOR NETWORKS
2
+
3
+ Jianwen Xie, Yang Lu, Ruiqi Gao, Song-Chun Zhu & Ying Nian Wu
4
+
5
+ Department of Statistics
6
+ University of California, Los Angeles
7
+ {jianwen, yanglv, ruiqigao}@ucla.edu, {sczhu, ywu}@stat.ucla.edu
8
+
9
+ # ABSTRACT
10
+
11
+ This paper studies the cooperative training of two probabilistic models of signals such as images. Both models are parametrized by convolutional neural networks (ConvNets). The first network is a descriptor network, which is an exponential family model or an energy-based model, whose feature statistics or energy function are defined by a bottom-up ConvNet, which maps the observed signal to the feature statistics. The second network is a generator network, which is a nonlinear version of factor analysis. It is defined by a top-down ConvNet, which maps the latent factors to the observed signal. The maximum likelihood training algorithms of both the descriptor net and the generator net are in the form of alternating back-propagation, and both algorithms involve Langevin sampling. We observe that the two training algorithms can cooperate with each other by jumpstarting each other’s Langevin sampling, and they can be seamlessly interwoven into a CoopNets algorithm that can train both nets simultaneously.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ # 1.1 TWO CONVNETS OF OPPOSITE DIRECTIONS
16
+
17
+ We begin with a story that the reader of this paper can readily relate to. A student writes up an initial draft of a paper. His advisor then revises it. After that they submit the revised paper for review. The student then learns from his advisor’s revision, while the advisor learns from the outside review. In this story, the advisor guides the student, but the student does most of the work.
18
+
19
+ This paper is about two probabilistic models of signals such as images, and they play the roles of student and advisor as described above. Both models are parametrized by convolutional neural networks (ConvNets or CNNs) (LeCun et al., 1998; Krizhevsky et al., 2012). The two nets take two opposite directions. One is bottom-up, and the other is top-down, as illustrate by the following diagram:
20
+
21
+ <table><tr><td>Bottom-up ConvNet features</td><td>Top-down ConvNet latent variables</td></tr><tr><td></td><td></td></tr><tr><td>个</td><td>←</td></tr><tr><td>signal (a) Descriptor Net</td><td>signal (b) Generator Net</td></tr></table>
22
+
23
+ The simultaneous training of such two nets was first studied by the recent work of Kim & Bengio (2016). These two nets belong to two major classes of probabilistic models. (a) The exponential family models or the energy-based models (LeCun et al., 2006) or the Markov random field models (Zhu et al., 1997), where the probability distribution is defined by feature statistics or energy function computed from the signal by a bottom-up process. (b) The latent variable models or the directed graphical models, where the signal is assumed to be a transformation of the latent factors that follow a known prior distribution. The latent factors generate the signal by a top-down process. A classical example is factor analysis.
24
+
25
+ The two classes of models have been contrasted by Zhu (2003); Teh et al. (2003); Ngiam et al. (2011). Zhu (2003) called the two classes of models the descriptive models and the generative models respectively. Both classes of models can benefit from the high capacity of the multi-layer ConvNets. (a) In the exponential family models or the energy-based models, the feature statistics or the energy function can be defined by a bottom-up ConvNet that maps the signal to the features and the energy function (Ngiam et al., 2011; Xie et al., 2016). We call the resulting model a descriptive network or a descriptor net following Zhu (2003), because it is built on descriptive feature statistics. (b) In the latent variable models or the directed graphical models, the transformation from the latent factors to the signal can be defined by a top-down ConvNet (Dosovitskiy et al., 2015), which maps the latent factors to the signal. We call the resulting model a generative network or generator net following Goodfellow et al. (2014), who proposed such a model in their work on the generative adversarial networks (GAN).
26
+
27
+ ![](images/799da87ccece60114024503ad08a2702e46d67f851a2c657025c4fc10d8cf9f5.jpg)
28
+ Figure 1: (a) Algorithm D involves sampling from the current model by Langevin dynamics. (b) Algorithm G involves sampling from the posterior distribution of the latent factors by Langevin dynamics. (c) CoopNets algorithm. The part of the flowchart for training the descriptor is similar to Algorithm D, except that the D1 Langevin sampling is initialized from the initial synthesized examples supplied by the generator. The part of the flowchart for training the generator can also be mapped to Algorithm G, except that the revised synthesized examples play the role of the observed data, and the known generated latent factors can be used as inferred latent factors (or be used to initialize the G1 Langevin sampling of the latent factors).
29
+
30
+ # 1.2 TWO TRAINING ALGORITHMS AND THEIR COOPERATION
31
+
32
+ Fig. 1(a) and (b) display the flowcharts of the maximum likelihood learning algorithms for training the descriptor and generator nets . We call the two algorithms Algorithm D and Algorithm G respectively. Algorithm D (Xie et al., 2016) iterates two steps: Step D1 synthesizes examples by sampling from the current model by Langevin dynamics. Step D2 updates the parameters to shift the density from the synthesized examples towards the observed examples. Algorithm G (Han et al., 2017) also iterates two steps. Step G1 infers latent factors for each observed example by sampling from their posterior distribution by Langevin dynamics. Step G2 updates the parameters by a non-linear regression of the observed examples on their corresponding latent factors. We use Langevin dynamics for Markov chain Monte Carlo (MCMC) sampling because the gradient term of Langevin dynamics can be readily computed via back-propagation. Thus all the steps D1, D2 and G1, G2 are powered by back-propagation, and both Algorithms D and G are alternating back-propagation algorithms.
33
+
34
+ In this article, we propose to couple Algorithms D and G into a cooperative training algorithm that interweaves the steps of the two algorithms seamlessly. We call the resulting algorithm the CoopNets algorithm, and we show that it can train both nets simultaneously.
35
+
36
+ Figure 1(c) displays the flowchart of the CoopNets algorithm. The generator is like the student. It generates the initial draft of the synthesized examples. The descriptor is like the advisor. It revises the initial draft by initializing its Langevin dynamics from the initial draft in Step D1, which produces the revised draft of the synthesized examples. The descriptor learns from the outside review in Step D2, which is in the form of the difference between the observed examples and the revised synthesized examples. The generator learns from how the descriptor revises the initial draft by reconstructing the revised draft in Step G2. For each synthesized example, the generator knows the latent factors that generate the initial draft, so that Step G1 can infer the latent factors by initializing its Langevin dynamics from their known values.
37
+
38
+ In the CoopNets algorithm, the generator fuels the MCMC of the descriptor by supplying initial synthesized examples, which can be obtained by direct ancestral sampling. The generator then learns from the revised synthesized examples with virtually known latent factors. The cooperation is thus beneficial to both nets.
39
+
40
+ # 2 RELATED WORK
41
+
42
+ Our work is inspired by the generative adversarial networks (GAN) (Goodfellow et al., 2014; Denton et al., 2015; Radford et al., 2015). In GAN, the generator net is paired with a discriminator net. The two nets play adversarial roles. In our work, the generator net and the descriptor net play cooperative roles, and they feed each other the initial, revised and reconstructed synthesized data. The learning of both nets is based on maximum likelihood, and the learning process is quite stable because of the cooperative nature and the consistent directions of the two maximum likelihood training algorithms.
43
+
44
+ Another method to train the generator network is variational auto-encoder (VAE) (Kingma & Welling, 2014; Rezende et al., 2014; Mnih & Gregor, 2014), which learns an inferential or recognition network to approximate the posterior distribution of the latent factors.
45
+
46
+ The connection between the descriptor net and the discriminator net has been explored by Xie et al.
47
+ (2016), where the descriptor can be derived from the discriminator.
48
+
49
+ Our work is most similar to the recent work of Kim & Bengio (2016). In fact, the settings of the two nets are the same. In their work, the generator learns from the descriptor by minimizing the Kullback-Leibler divergence from the generator to the descriptor, which can be decomposed into an energy term and an entropy term. In our work, the two nets interact with each other via synthesized data, and the generator learns from the descriptor by reconstructing the revised draft of synthesized examples. Our method does not need to approximate the intractable entropy term.
50
+
51
+ Our work is related to the contrastive divergence algorithm (Hinton, 2002) for training the descriptor net. The contrastive divergence initializes the MCMC sampling from the observed examples. The CoopNets algorithm initializes the MCMC sampling from the examples supplied by the generator.
52
+
53
+ # 3 TWO NETS AND TWO TRAINING ALGORITHMS
54
+
55
+ # 3.1 DESCRIPTOR NET AND TRAINING ALGORITHM
56
+
57
+ Let $Y$ be the $D$ -dimensional signal, such as an image. The descriptor model is in the form of exponential tilting of a reference distribution (Xie et al., 2016):
58
+
59
+ $$
60
+ P _ { \mathcal { D } } ( Y ; W _ { \mathcal { D } } ) = \frac { 1 } { Z ( W _ { \mathcal { D } } ) } \exp \left[ f ( Y ; W _ { \mathcal { D } } ) \right] q ( Y ) ,
61
+ $$
62
+
63
+ where $q ( Y )$ is the reference distribution such as Gaussian white noise $q ( Y ) \propto \exp \left( - \| Y \| ^ { 2 } / 2 s ^ { 2 } \right) ,$ $f ( Y ; W _ { \mathcal { D } } )$ $( f$ stands for features) is the feature statistics or energy function, defined by a ConvNet whose parameters are denoted by $W _ { \mathcal { D } }$ . This ConvNet is bottom-up because it maps the signal $Y$ to a number. See the diagram in (1). $\begin{array} { r } { Z ( W _ { \mathcal { D } } ) = \int \exp { [ f ( Y ; W _ { \mathcal { D } } ) ] } \bar { q } ( Y ) d Y = \mathrm { E } _ { q } \bar { \left\{ \exp [ f ( \bar { Y } ; W _ { \mathcal { D } } ) ] \right\} } } \end{array}$ is the normalizing constant, where $\operatorname { E } _ { q }$ is the expectation with respect to $q$ .
64
+
65
+ Suppose we observe training examples $\{ Y _ { i } , i ~ = ~ 1 , . . . , n \}$ from an unknown data distribution $P _ { \mathrm { d a t a } } ( Y )$ . The maximum likelihood training seeks to maximize the log-likelihood function $\begin{array} { r } { L _ { \mathcal { D } } ( W _ { \mathcal { D } } ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \log P _ { \mathcal { D } } ( Y _ { i } ; W _ { \mathcal { D } } ) } \end{array}$ . If the sample size Kullback-Leibler di $n$ is large, the maximum likelihorgence from the data distribution $\mathrm { K L } ( P _ { \mathrm { d a t a } } | P _ { \mathcal { D } } )$ $P _ { \mathrm { d a t a } }$ to the model distribution $P _ { D }$ . The gradient of the $L _ { \mathcal { D } } ( W _ { \mathcal { D } } )$ is
66
+
67
+ $$
68
+ \begin{array} { r c l } { { { \cal L } _ { \mathcal D } ^ { \prime } ( W _ { \mathcal D } ) } } & { { = } } & { { \displaystyle { \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { \partial } { \partial W _ { \mathcal D } } f ( Y _ { i } ; W _ { \mathcal D } ) - \mathrm { E } _ { W _ { \mathcal D } } \left[ \frac { \partial } { \partial W _ { \mathcal D } } f ( Y ; W _ { \mathcal D } ) \right] } , } } \end{array}
69
+ $$
70
+
71
+ where $\operatorname { E } _ { W _ { \mathcal { D } } }$ denotes the expectation with respect to $P _ { \mathcal { D } } ( Y ; W _ { \mathcal { D } } )$
72
+
73
+ The expectation in equation (3) is analytically intractable and has to be approximated by MCMC, such as Langevin dynamics, which iterates the following step:
74
+
75
+ $$
76
+ Y _ { \tau + 1 } = Y _ { \tau } - \frac { \delta ^ { 2 } } { 2 } \left[ \frac { Y _ { \tau } } { s ^ { 2 } } - \frac { \partial } { \partial Y } f ( Y _ { \tau } ; W _ { \mathcal { D } } ) \right] + \delta U _ { \tau } ,
77
+ $$
78
+
79
+ where $\tau$ indexes the time steps of the Langevin dynamics, $\delta$ is the step size, and $U _ { \tau } \sim \mathrm { N } ( 0 , I _ { D } )$ is the Gaussian white noise term.
80
+
81
+ We can run $\tilde { n }$ parallel chains of Langevin dynamics according to (4) to obtain the synthesized examples $\{ \tilde { Y } _ { i } , i = 1 , . . . , \tilde { n } \}$ . The Monte Carlo approximation to $L _ { \mathcal { D } } ^ { \prime } ( W _ { \mathcal { D } } )$ is
82
+
83
+ $$
84
+ L _ { \mathcal { D } } ^ { \prime } ( W _ { \mathcal { D } } ) \quad \approx \quad \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { \partial } { \partial W _ { \mathcal { D } } } f ( Y _ { i } ; W _ { \mathcal { D } } ) - \frac { 1 } { \tilde { n } } \sum _ { i = 1 } ^ { \tilde { n } } \frac { \partial } { \partial W _ { \mathcal { D } } } f ( \tilde { Y } _ { i } ; W _ { \mathcal { D } } ) ,
85
+ $$
86
+
87
+ which is used to update $W _ { \mathcal { D } }$
88
+
89
+ Algorithm D (Xie et al., 2016) iterates the following two steps after initializing $W _ { \mathcal { D } }$ and $\{ \tilde { Y } _ { i } , i =$ $1 , . . . , \tilde { n } \}$ . Step $D l$ : Run $l _ { \mathcal { D } }$ steps of Langevin from the current $\{ \tilde { Y } \}$ according according to (4). Step $D 2$ : update $\boldsymbol { W _ { D } ^ { ( t + 1 ) } } = \boldsymbol { W _ { D } ^ { ( t ) } } + \gamma _ { t } \boldsymbol { L _ { D } ^ { \prime } } ( \boldsymbol { W _ { D } ^ { ( t ) } } )$ with learning rate $\gamma _ { t }$ . The convergence of such an algorithm follows Younes (1999).
90
+
91
+ # 3.2 GENERATOR NET AND TRAINING ALGORITHM
92
+
93
+ The generator net (Goodfellow et al., 2014) seeks to explain the signal $Y$ of dimension $D$ by a vector of latent factors $X$ of dimension $d$ , and usually $d \ll D$ . The model is of the following form:
94
+
95
+ $$
96
+ X \sim \mathrm { N } ( 0 , I _ { d } ) , Y = g ( X ; W _ { \mathcal { G } } ) + \epsilon , \epsilon \sim \mathrm { N } ( 0 , \sigma ^ { 2 } I _ { D } ) .
97
+ $$
98
+
99
+ $g ( X ; W _ { \mathcal { G } } )$ $( g$ stands for generator) is a top-down ConvNet defined by the parameters $W _ { \mathcal { G } }$ . The ConvNet $g$ maps the latent factors $X$ to the signal $Y$ . See the diagram in (1).
100
+
101
+ The joint density of model (6) is $P _ { \mathcal { G } } ( X , Y ; W _ { \mathcal { G } } ) = P _ { \mathcal { G } } ( X ) P _ { \mathcal { G } } ( Y | X ; W _ { \mathcal { G } } )$ , and
102
+
103
+ $$
104
+ \log P _ { \mathcal { G } } ( X , Y ; W _ { \mathcal { G } } ) = - \frac { 1 } { 2 \sigma ^ { 2 } } \| Y - g ( X ; W _ { \mathcal { G } } ) \| ^ { 2 } - \frac { 1 } { 2 } \| X \| ^ { 2 } + \mathrm { c o n s t a n t } ,
105
+ $$
106
+
107
+ where the constant term is independent of $X , Y$ and $W _ { \mathcal { G } }$ . The marginal density is obtained by integrating out the latent factors $X$ , i.e., $\begin{array} { r } { P _ { \mathcal { G } } ( Y ; W _ { \mathcal { G } } ) = \int P _ { \mathcal { G } } ( X , Y ; W _ { \mathcal { G } } ) d X } \end{array}$ . The inference of $X$ given $Y$ is based on the posterior density $P _ { \mathcal { G } } ( X | Y ; W _ { \mathcal { G } } ) \stackrel { \smile } { = } P _ { \mathcal { G } } ( X , Y ; W _ { \mathcal { G } } ) / P _ { \mathcal { G } } ( Y ; W _ { \mathcal { G } } ) \propto P _ { \mathcal { G } } ( X , Y ; W _ { \mathcal { G } } )$ as a function of $X$ .
108
+
109
+ For the training data $\{ Y _ { i } , i = 1 , . . . , n \}$ , the generator net can be trained by maximizing the loglikelihood $\begin{array} { r } { L _ { \mathcal { G } } ( W _ { \mathcal { G } } ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \log P _ { \mathcal { G } } ( Y _ { i } ; W _ { \mathcal { G } } ) } \end{array}$ . For large sample, the learned $W _ { \mathcal { G } }$ minimizes the Kullback-Leibler divergence $\mathrm { K L } ( P _ { \mathrm { d a t a } } | P _ { \mathcal { G } } )$ from the data distribution $P _ { \mathrm { d a t a } }$ to the model distribution $P _ { \mathcal { G } }$ . The gradient of $L _ { \mathcal { G } } ( W _ { \mathcal { G } } )$ is obtained according to the following identity
110
+
111
+ $$
112
+ \begin{array} { r c l } { \displaystyle \frac { \partial } { \partial W _ { \mathcal { G } } } \log P _ { \mathcal { G } } ( Y ; W _ { \mathcal { G } } ) } & { = } & { \displaystyle \frac { 1 } { P _ { \mathcal { G } } ( Y ; W _ { \mathcal { G } } ) } \frac { \partial } { \partial W _ { \mathcal { G } } } \int P _ { \mathcal { G } } ( Y , X ; W _ { \mathcal { G } } ) d X } \\ & { = } & { \displaystyle \frac { 1 } { P _ { \mathcal { G } } ( Y ; W _ { \mathcal { G } } ) } \int \left[ \frac { \partial } { \partial W _ { \mathcal { G } } } \log P _ { \mathcal { G } } ( Y , X ; W _ { \mathcal { G } } ) \right] P _ { \mathcal { G } } ( Y , X ; W _ { \mathcal { G } } ) d X } \\ & { = } & { \displaystyle \int \left[ \frac { \partial } { \partial W _ { \mathcal { G } } } \log P _ { \mathcal { G } } ( Y , X ; W _ { \mathcal { G } } ) \right] \frac { P _ { \mathcal { G } } ( Y , X ; W _ { \mathcal { G } } ) } { P _ { \mathcal { G } } ( Y ; W _ { \mathcal { G } } ) } d X } \\ & { = } & { \displaystyle \mathrm { E } _ { P _ { \mathcal { G } } ( X \mid Y ; W _ { \mathcal { G } } ) } \left[ \frac { \partial } { \partial W _ { \mathcal { G } } } \log P _ { \mathcal { G } } ( X , Y ; W _ { \mathcal { G } } ) \right] , } \end{array}
113
+ $$
114
+
115
+ which underlies the EM algorithm. In general, the expectation in (8) is analytically intractable, and has to be approximated by MCMC that samples from the posterior $P _ { G } ( X | Y ; W _ { \mathcal { G } } )$ , such as Langevin dynamics, which iterates
116
+
117
+ $$
118
+ X _ { \tau + 1 } = X _ { \tau } + \frac { \delta ^ { 2 } } { 2 } \frac { \partial } { \partial X } \log P _ { \mathcal { G } } ( X _ { \tau } , Y ; W _ { \mathcal { G } } ) + \delta U _ { \tau } ,
119
+ $$
120
+
121
+ where $U _ { \tau } \sim \mathrm { N } ( 0 , I _ { d } )$ . With $X _ { i }$ sampled from $P g ( X _ { i } \mid Y _ { i } , W g )$ for each observation $Y _ { i }$ , the Monte Carlo approximation to $L _ { \mathcal { G } } ^ { \prime } ( W _ { \mathcal { G } } )$ is
122
+
123
+ $$
124
+ L _ { \mathcal { G } } ^ { \prime } ( W _ { \mathcal { G } } ) \approx \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { \partial } { \partial W _ { \mathcal { G } } } \log P _ { \mathcal { G } } ( X _ { i } , Y _ { i } ; W _ { \mathcal { G } } ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \frac { 1 } { \sigma ^ { 2 } } \left( Y _ { i } - g ( X _ { i } ; W _ { \mathcal { G } } ) \right) \frac { \partial } { \partial W _ { \mathcal { G } } } g ( X _ { i } ; W _ { \mathcal { G } } ) .
125
+ $$
126
+
127
+ Algorithm G (Han et al., 2017) iterates the following two steps after initializing $W _ { \mathcal { G } }$ and $\{ X _ { i } , i =$ $1 , . . . , n \}$ . Step $G I$ : run $l _ { \mathcal { G } }$ steps of Langevin from the current $\{ X _ { i } \}$ according to (9). Step $G 2$ : update $\boldsymbol { W _ { \mathcal { G } } ^ { ( t + 1 ) } } = \boldsymbol { W } _ { \mathcal { G } } ^ { ( t ) } + \gamma _ { t } \boldsymbol { L } _ { \mathcal { G } } ^ { \prime } ( \boldsymbol { W } _ { \mathcal { G } } ^ { ( t ) } )$ with learning rate $\gamma _ { t }$ . The convergence of such an algorithm follows Younes (1999).
128
+
129
+ # 4 COOPNETS ALGORITHM: RECONSTRUCTING THE REVISION
130
+
131
+ In Algorithms $\mathrm { D }$ and $\mathbf { G }$ , both steps D1 and G1 are Langevin dynamics, which may be slow to converge. An interesting observation is that the two algorithms can cooperate with each other by jumpstarting each other’s Langevin sampling.
132
+
133
+ Specifically, in Step D1, we can initialize the synthesized examples by generating examples from the generator net. We first generate $\hat { X } _ { i } \sim \mathrm { N } ( 0 , I _ { d } )$ , and then generate $\bar { \hat { Y } } _ { i } = g ( \bar { \hat { X } } _ { i } ; W _ { \mathcal { G } } ) \bar { + } \epsilon _ { i }$ , for $i = 1 , . . . , \tilde { n }$ . If the current generator $P _ { \mathcal { G } }$ is close to the current descriptor $P _ { \mathcal { D } }$ , then the generated $\{ \hat { Y } _ { i } \}$ should be a good initialization for sampling from the descriptor net, i.e., starting from the $\{ \hat { Y } _ { i } , i = 1 , . . . , \tilde { n } \}$ , we run Langevin dynamics in Step D1 for $l _ { \mathcal { D } }$ steps to get $\{ \tilde { Y } _ { i } , i = 1 , . . . , \tilde { n } \}$ , which are revised versions of $\{ \hat { Y } _ { i } \}$ . These $\{ \tilde { Y } _ { i } \}$ can be used as the synthesized examples from the descriptor net. We can then update $W _ { \mathcal { D } }$ according to Step D2 of Algorithm D.
134
+
135
+ In order to update $W _ { \mathcal { G } }$ of the generator net, we treat the $\{ \tilde { Y } _ { i } , i = 1 , . . . , \tilde { n } \}$ produced by the above Step D1 as the training data for the generator. Since these $\{ \tilde { Y } _ { i } \}$ are obtained by the Langevin dynamics initialized from the $\{ \hat { Y } _ { i } , i = 1 , . . . , \tilde { n } \}$ produced by the generator net with known latent factors $\{ \hat { X } _ { i } , i = 1 , . . . , \tilde { n } \}$ , we can update $W _ { \mathcal { G } }$ by learning from $\{ ( \tilde { Y } _ { i } , \hat { X } _ { i } ) , i = 1 , . . . , \tilde { n } \}$ , which is a supervised learning problem, or more specifically, a non-linear regression of $\tilde { Y } _ { i }$ on ${ \hat { X } } _ { i }$ . At $W _ { \mathcal { G } } ^ { ( t ) }$ , the latent factors ${ \hat { X } } _ { i }$ generates and thus reconstructs the initial example $\hat { Y } _ { i }$ . After updating $W _ { \mathcal { G } }$ , we want ${ \hat { X } } _ { i }$ to reconstruct the revised example $\tilde { Y _ { i } }$ . That is, we revise $W _ { \mathcal { G } }$ to absorb the revision from ${ \hat { Y } } _ { i }$ to $\tilde { Y _ { i } }$ , so that the generator shifts its density from $\{ \hat { Y } _ { i } \}$ to $\{ \tilde { Y } _ { i } \}$ . The reconstruction error can tell us whether the generator has caught up with the descriptor by fully absorbing the revision.
136
+
137
+ The left diagram in (11) illustrates the basic idea.
138
+
139
+ $$
140
+ \begin{array} { c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & { { } } & \end{array}
141
+ $$
142
+
143
+ In the two diagrams in (11), the double-line arrows indicate generation and reconstruction by the generator net, while the dashed-line arrows indicate Langevin dynamics for revision and inference in the two nets. The diagram on the right in (11) illustrates a more rigorous method, where we initialize the Langevin inference of $\{ X _ { i } , i = 1 , . . . , \tilde { n } \}$ in Step G1 from $\{ \hat { X } _ { i } \}$ , and then update $W _ { \mathcal { G } }$ in Step G2 based on $\{ ( \tilde { Y } _ { i } , X _ { i } ) , i = \bar { 1 } , . . . , \tilde { n } \}$ . The diagram on the right shows how the two nets jumpstart each other’s Langevin dynamics.
144
+
145
+ Algorithm 1 describes the cooperative training that interweaves Algorithm D and Algorithm G. See Figure 1(c) for the flowchart of the CoopNets algorithm. In our experiments, we set $l _ { \mathcal { G } } = 0$ and infer $X _ { i } = \hat { X } _ { i }$ for simplicity, i.e., we follow the left diagram in (11).
146
+
147
+ See Appendix for a theoretical understanding of the convergence of the CoopNets algorithm.
148
+
149
+ # Algorithm 1 CoopNets Algorithm
150
+
151
+ #
152
+
153
+ (1) training examples $\{ Y _ { i } , i = 1 , . . . , n \}$ (2) numbers of Langevin steps $l _ { \mathcal { D } }$ ad $l _ { \mathcal { G } }$ (3) number of learning iterations $T$
154
+
155
+ #
156
+
157
+ (1) estimated parameters $W _ { \mathcal { D } }$ and $W _ { \mathcal { G } }$ (2) synthesized examples $\{ \hat { Y } _ { i } , \tilde { Y } _ { i } , i = 1 , . . . , \tilde { n } \}$
158
+
159
+ 1: Let $t \gets 0$ , initialize $W _ { \mathcal { D } }$ and $W _ { \mathcal { G } }$
160
+
161
+ 2: repeat
162
+
163
+ 3: Step G0: For $i = 1 , . . . , \tilde { n }$ , generate $\hat { X } _ { i } \sim \mathrm { N } ( 0 , I _ { d } )$ , and generate $\hat { Y } _ { i } = g ( \hat { X } _ { i } ; W _ { \mathcal { G } } ^ { ( t ) } ) + \epsilon _ { i }$
164
+
165
+ 4: Step D1: For $i = 1 , . . . , \tilde { n }$ , starting from $\hat { Y _ { i } }$ , Run $l _ { \mathcal { D } }$ steps of Langevin dynamics to obtain $\tilde { Y _ { i } }$ , each step following equation (4).
166
+
167
+ 5: Step G1: Treat the current $\{ \tilde { Y } _ { i } , i = 1 , . . . , \tilde { n } \}$ as the training data, for each $i$ , infer $X _ { i } = { \hat { X } } _ { i }$ . Or more rigorously, starting from $X _ { i } = { \hat { X } } _ { i }$ , run $l _ { \mathcal { G } }$ steps of Langevin dynamics to update $X _ { i }$ , each step following equation (9).
168
+
169
+ 6: Step D2: Update $\begin{array} { r } { \dot { W } _ { \mathcal { D } } ^ { ( \bar { t } + 1 ) } = W _ { \mathcal { D } } ^ { ( t ) } + \gamma _ { t } L _ { \mathcal { D } } ^ { \prime } ( W _ { \mathcal { D } } ^ { ( t ) } ) } \end{array}$ , where $L _ { \mathcal { D } } ^ { \prime } ( W _ { \mathcal { D } } ^ { ( t ) } )$ is computed according
170
+
171
+ 7: Step G2: Update $\boldsymbol { W _ { \mathcal { G } } ^ { ( t + 1 ) } } = \boldsymbol { W _ { \mathcal { G } } ^ { ( t ) } } + \gamma _ { t } \boldsymbol { L _ { \mathcal { G } } } ^ { \prime } ( \boldsymbol { W _ { \mathcal { G } } ^ { ( t ) } } )$ where $L _ { \mathcal { G } } ^ { \prime } ( W _ { G } )$ is computed according $Y _ { i }$ is replaced by $\tilde { Y _ { i } }$ , and $n$ by $\tilde { n }$
172
+
173
+ 8: Let $t \gets t + 1$
174
+ 9: until $t = T$
175
+
176
+ # 5 EXPERIMENTS
177
+
178
+ We use the MatConvNet of Vedaldi & Lenc (2015) for coding. For the descriptor net, we adopt the structure of Xie et al. (2016), where the bottom-up network consists of multiple layers of convolution by linear filtering, ReLU non-linearity, and down-sampling. We adopt the structure of the generator network of Radford et al. (2015); Dosovitskiy et al. (2015), where the top-down network consists of multiple layers of deconvolution by linear superposition, ReLU non-linearity, and up-sampling, with tanh non-linearity at the bottom-layer (Radford et al., 2015) to make the signals fall within $[ - 1 , 1 ]$ .
179
+
180
+ # 5.1 QUANTITATIVE EXPERIMENT ON FACE COMPLETION
181
+
182
+ We conduct an experiment on learning from complete training images of human faces, and then testing the learned model on completing the occluded testing images. The structure of the generator network is the same as in (Radford et al., 2015; Dosovitskiy et al., 2015). We adopt a 4-layer descriptor net. The first layer has $9 6 5 \times 5$ filters with sub-sampling of 2, the second layers has $1 2 8 \mathrm { ~ 5 ~ } \times \mathrm { ~ 5 ~ }$ filters with sub-sampling of 2, the third layer has $2 5 6 ~ 5 ~ \times ~ 5$ filters with sub-sampling of 2, and the final layer is a fully connected layer with 50 channels as output. We use $L { = } 1 0$ steps of Langevin revision dynamics within each learning iteration, and the Langevin step size is set at 0.002. The learning rate is 0.07. The training data are 10, 000 human faces randomly selected from CelebA dataset (Liu et al., 2015). We run 600 cooperative learning iterations. Figure 2 displays 144 synthesized human faces by the descriptor net.
183
+
184
+ To quantitatively test whether we have learned a good generator net $g ( X ; W _ { \mathcal { G } } )$ even though it has never seen the training images directly in the training stage, we apply it to the task of recovering the occluded pixels of testing images. For each occluded testing image $Y$ , we use Step G1 of Algorithm G to infer the latent factors $X$ . The only change is with respect to the term $\| Y - g ( X ; W _ { \mathcal { G } } ) \| ^ { 2 }$ , where the sum of squares is over all the observed pixels of $Y$ in back-propagation computation. We run 1000 Langevin steps, initializing $X$ from $\mathrm { N } ( 0 , I _ { d } )$ . After inferring $X$ , the completed image $g ( X ; W _ { \mathcal { G } } )$ is automatically obtained. We design 3 experiments, where we randomly place a $2 0 \times 2 0$ , $3 0 \times 3 0$ , or $4 0 \times 4 0$ mask on each $6 4 \times 6 4$ testing image. These 3 experiments are denoted by $\mathbf { M } 2 0 \ \mathbf { M } 3 0$ , and M40 respectively (M for mask). We report the recovery errors and compare our method with 8 different image inpainting methods as well as the DCGAN of Radford et al. (2015).
185
+
186
+ ![](images/00dee8a7ae0f21424076c4f3c1068bafffe2b10b9e9f036ee0ad57ae66f5d096.jpg)
187
+ Figure 2: Generating human face pattern. The synthesized images are generated by the CoopNets algorithm that learns from 10, 000 images.
188
+
189
+ For DCGAN, we use the parameter setting in Radford et al. (2015) except changing the number of learning iterations to 600. We use the same 10, 000 training images to learn DCGAN. After the model is learned, we keep the generator and use the same method as ours to infer latent factors $X$ , and recover the unobserved pixels. In 8 inpainting methods, Methods 1 and 2 are based on Markov random field prior where the nearest neighbor potential terms are $\ell _ { 2 }$ and $\ell _ { 1 }$ differences respectively. Methods 3 to 8 are interpolation methods. Please refer to D’Errico (2004) for more details. Table 1 displays the recovery errors of the 3 experiments, where the error is measured by per pixel difference (relative to the range of pixel values) between the original image and the recovered image on the occluded region, averaged over 100 testing images. Fig. 3 displays some recovery results by our method. The first row shows the original images as the ground truth. The second row displays the testing images with occluded pixels. The third row displays the recovered images by the generator net trained by the CoopNets algorithm on the 10,000 training images.
190
+
191
+ Table 1: Comparison of recovery errors among different inpainting methods in 3 experiments
192
+
193
+ <table><tr><td>Exp</td><td>Ours</td><td>GAN</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td><td>8</td></tr><tr><td>M20</td><td>.0966</td><td>.2535</td><td>.1545</td><td>.1506</td><td>.1277</td><td>.1123</td><td>.2493</td><td>.1123</td><td>.1126</td><td>.1277</td></tr><tr><td>M30</td><td>.1112</td><td>.2606</td><td>.1820</td><td>.1792</td><td>.1679</td><td>.1321</td><td>.3367</td><td>.1310</td><td>.1312</td><td>.1679</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>M40</td><td>.1184</td><td>.2618</td><td>.2055</td><td>.2032</td><td>.1894</td><td>.1544</td><td>.3809</td><td>.1525</td><td>.1526</td><td>.1894</td></tr></table>
194
+
195
+ ![](images/0f85ee69c8caee33ddcb82bc8eacc824192883782a133aa5e14a7314a197032a.jpg)
196
+ Figure 3: Row 1: ground-truth images. Row 2: testing images with occluded pixels. Row 3: recovered images by our method.
197
+
198
+ # 5.2 QUALITATIVE EXPERIMENT ON SYNTHESIS
199
+
200
+ We conduct an experiment on synthesizing images of categories from Imagenet ILSVRC2012 dataset (Deng et al., 2009) and MIT places205 dataset (Zhou et al., 2014). We adopt a 4-layer descriptor net. The first layer has $6 4 ~ 5 \times 5$ filters with sub-sampling of 2, the second layers has $1 2 8 3 \times 3$ filters with sub-sampling of 2, the third layer has $2 5 6 3 \times 3$ filters with sub-sampling of 1, and the final layer is a fully connected layer with 100 channels as output. We set the number of Langevin dynamics steps in each learning iteration to 10 and the step size to 0.002. The learning rate is 0.07. For each category, we randomly choose 1,000 images as training data and resize the images to $6 4 \times 6 4$ . We run 1, 000 cooperative learning iterations to train the model. Figures 4 and 5 display the results for two categories, where for each category, we show 144 original images sampled from the training set, and 144 synthesized images generated by our method. The appendix contains more synthesis results.
201
+
202
+ As a comparison, we apply the Algorithm G alone and GAN code on the same 1,000 hotel room training images to learn the generator of the same structure as in CoopNets. Figure 6 displays the synthesis results.
203
+
204
+ We also try to synthesize images at high resolution $( 2 2 4 \times 2 2 4 )$ ). We adopt a 4-layer descriptor net. The first layer has $1 2 8 1 5 \times 1 5$ filters with sub-sampling of 3, the second layer has $2 5 6 3 \times 3$ filters with sub-sampling of 2, the third layer has $5 1 2 3 \times 3$ filters with sub-sampling of 1, and the final layer is a fully connected layer with 100 channels as output. We enlarge the filters of the final layer of generator net to $1 4 \times 1 4$ to generate $2 2 4 \times 2 2 4$ images. The learning rate is 0.05. We run 1000 cooperative learning iterations to train the model. Figures 7 and 8 show the synthesized images of two categories from MIT places205 dataset.
205
+
206
+ # 6 CONCLUSION
207
+
208
+ The most unique feature of our work is that the two networks feed each other the synthesized data in the learning process, including initial, revised, and reconstructed synthesized data.
209
+
210
+ Another unique feature of our work is that the learning process interweaves the existing maximum likelihood learning algorithms for the two networks.
211
+
212
+ A third unique feature of our work is that the MCMC for the descriptor keeps rejuvenating the chains by refreshing the samples by independent replacements supplied by the generator, so that a single chain effectively amounts to an infinite number of chains or the evolution of the whole marginal distribution modeled by the generator.
213
+
214
+ # CODE AND DATA
215
+
216
+ http://www.stat.ucla.edu/˜ywu/CoopNets/main.html
217
+
218
+ # 7 APPENDIX: CONVERGENCE
219
+
220
+ # 7.1 GENERATOR OF INFINITE CAPACITY
221
+
222
+ In the CoopNets algorithm, the descriptor learns from the observed examples, while the generator learns from the descriptor through the synthesized examples. Therefore, the descriptor is the driving force in terms of learning, although the generator is the driving force in terms of synthesis. In order to understand the convergence of learning, we can start from Algorithm D for learning the descriptor.
223
+
224
+ Algorithm D is a stochastic approximation algorithm (Robbins & Monro, 1951), except that the samples are generated by finite step MCMC transitions. According to Younes (1999), Algorithm D converges to the maximum likelihood estimate under suitable regularity conditions on the mixing of the transition kernel of the MCMC and the schedule of the learning rate $\gamma _ { t }$ , even if the number of Langevin steps $l _ { \mathcal { D } }$ is finite or small (e.g., $l _ { \mathcal { D } } = 1 .$ ), and even if the number of parallel chains $\tilde { n }$ is finite or small (e.g., $\tilde { n } = 1$ ). The reason is that the random fluctuations caused by the finite number of chains, $\tilde { n }$ , and the limited mixing caused by the finite steps of MCMC, $l _ { \mathcal { D } }$ , are mitigated if the learning rate is sufficiently small. At learning iteration $t$ , let $W _ { \mathcal { D } } ^ { ( t ) }$ be the estimated parameter of D i D because lD is finite (P (t+1)D = PD(Y ; W (t)D ) if lD → ∞), we still have W (t)D the descriptor. Let $P _ { \mathcal { D } } ^ { ( t + 1 ) }$ be the marginal distribution of $\{ \tilde { Y } _ { i } \}$ D . Even though $W _ { \mathcal { D } } ^ { ( t ) } \hat { W } _ { \mathcal { D } }$ $P _ { \mathcal { D } } ^ { ( t + 1 ) } \neq P _ { \mathcal { D } } ( Y ; W _ { \mathcal { D } } ^ { ( t ) } )$ in probability according to Younes (1999), where $\hat { W } _ { \mathcal { D } }$ is the maximum likelihood estimate of $W _ { \mathcal { D } }$ .
225
+
226
+ ![](images/d4240e8ec86be0e776562781d3937712ce9947ec86ce6287e18cf6909f78c0b8.jpg)
227
+ (a) Original images
228
+
229
+ ![](images/27375fd3fc42fded0524ee180cc0241c3cddcd2cd4adbe32a593ef4295b0b3a4.jpg)
230
+ Figure 4: Generating forest road images. The category is from MIT places205 dataset.
231
+
232
+ ![](images/3b814fea1df0f26d03e177841edda77251a006c1d205523349743b71c3f8a821.jpg)
233
+ (a) Original images
234
+
235
+ ![](images/92c52da281e005d4ec4e61edf5d120b84b1ec7988226271a673f3d42cc16f074.jpg)
236
+ Figure 5: Generating hotel room images. The category is from MIT places205 dataset.
237
+
238
+ ![](images/6fb76193e697b5c26e40eed9a8fe339173923b9204009b88d0ee14072fa89502.jpg)
239
+ (a) Generated by Algorithm G alone.
240
+
241
+ ![](images/5e1e7b4b4e9b634c5fd2e2c24a30124a39d196894b57ce504d0eb3868ce4b020.jpg)
242
+ Figure 6: Generating hotel room images by Algorithm G alone and by GAN.
243
+
244
+ ![](images/9da43a4b287c88e80fbcf6b14085c1dd16285443159635e7c180a39e11c150b9.jpg)
245
+ Figure 7: Generating forest road images at high resolution $( 2 2 4 \times 2 2 4 )$ .
246
+
247
+ ![](images/66128d06a3eef868dcfe60224334a982f3e70707b3795c8172556dafa82e917e.jpg)
248
+ Figure 8: Generating hotel room images at high resolution $( 2 2 4 \times 2 2 4 )$ .
249
+
250
+ The efficiency of Algorithm D increases if the number of parallel chains $\tilde { n }$ is large because it leads to more accurate estimation of the expectation in the gradient $L _ { \mathcal { D } } ^ { \prime } ( W _ { \mathcal { D } } )$ of equation (3), so that we can afford to use larger learning rate $\gamma _ { t }$ for faster convergence.
251
+
252
+ Now let us come back to the CoopNets algorithm. In order to understand how the descriptor net helps the training of the generator net, let us consider the idealized scenario where the number of parallel chains $\tilde { n } \infty$ , and the generator has infinite capacity, and in each iteration it estimates $W _ { \mathcal { G } }$ by maximum likelihood using the synthesized data from P (t+1)D . In this idealized scenario, the learned generator $P _ { \mathcal { G } } ( Y ; W _ { \mathcal { G } } ^ { ( t + 1 ) } )$ will reproduce $P _ { \mathcal { D } } ^ { ( t + 1 ) }$ by minimizing $\operatorname { K L } ( P _ { \mathcal { D } } ^ { ( t + 1 ) } ( Y ) | P _ { \mathcal { G } } ( Y ; W _ { \mathcal { G } } ) )$ , with $P _ { \mathcal { D } } ^ { ( t + 1 ) }$ serving as its data distribution. Then eventually the learned generator $P _ { \mathcal { G } } ( Y , \hat { W } _ { \mathcal { G } } )$ will reproduce $P _ { \mathcal { D } } ( Y ; \hat { W } _ { \mathcal { D } } )$ . Thus the cooperative training helps the learning of the generator. Note that the learned generator $P _ { \mathcal { G } } ( Y , \hat { W } _ { \mathcal { G } } )$ will not reproduce the distribution of the observed data $P _ { \mathrm { d a t a } }$ , unless the descriptor is of infinite capacity too.
253
+
254
+ Conversely, the generator net also helps the learning of the descriptor net in the CoopNets algorithm. In Algorithm D, it is impractical to make the number of parallel chains $\tilde { n }$ too large. On the other hand, it would be difficult for a small number of chains $\{ \bar { \tilde { Y } _ { i } } , i = 1 , . . . , \tilde { n } \}$ to explore the state space. In the CoopNets algorithm, because $P _ { \mathcal { G } } ( Y ; W _ { \mathcal { G } } ^ { ( t ) } )$ reproduces $P _ { \mathcal { D } } ^ { ( t ) }$ , we can generate a completely new batch of independent samples $\{ \hat { Y } _ { i } \}$ from $\overset { \cdot } { P _ { \mathcal { G } } } ( Y ; W _ { \mathcal { G } } ^ { ( t ) } )$ , and revise $\{ \hat { Y } _ { i } \}$ to $\{ \tilde { Y } _ { i } \}$ by Langevin dynamics, instead of running Langevin dynamics from the same old batch of $\{ \tilde { Y } _ { i } \}$ as in the original Algorithm D. This is like implementing an infinite number of parallel chains, because each iteration evolves a fresh batch of examples, as if each iteration evolves a new set of chains. By updating the generator $W _ { \mathcal { G } }$ , it is like we are updating the infinite number of parallel chains, because $W _ { \mathcal { G } }$ memorizes the whole distribution. Even if $\tilde { n }$ in the CoopNets algorithm is small, e.g., $\tilde { n } \ = \ 1$ , viewed from the perspective of Algorithm D, it is as if $\tilde { n } \to \infty$ . Thus the above idealization $\tilde { n } \to \infty$ is sound.
255
+
256
+ # 7.2 GENERATOR OF FINITE CAPACITY
257
+
258
+ From an information geometry point of view, let $\mathcal { D } = \{ P _ { \mathcal { D } } ( Y ; W _ { \mathcal { D } } ) , \forall W _ { \mathcal { D } } \}$ be the manifold of the descriptor models, where each distribution $P _ { \mathcal { D } } ( Y ; W _ { \mathcal { D } } )$ is a point on this manifold. Then the maximum likelihood estimate of $W _ { \mathcal { D } }$ is a projection of the data distribution $P _ { \mathrm { d a t a } }$ onto the manifold $\mathcal { D }$ . Let $\mathcal { G } = \{ P _ { \mathcal { G } } ( Y ; W _ { \mathcal { G } } ) , \forall W _ { \mathcal { G } } \}$ be the manifold of the generator models, where each distribution $P _ { \mathcal { G } } ( Y ; W _ { \mathcal { G } } )$ is a point on this manifold. Then the maximum likelihood estimate of $W _ { \mathcal { G } }$ is a projection of the data distribution $P _ { \mathrm { d a t a } }$ onto the manifold $\mathcal { G }$ .
259
+
260
+ From now on, for notational simplicity and with a slight abuse of notation, we use $W _ { \mathcal { D } }$ to denote the descriptor distribution $P _ { \mathcal { D } } ( Y ; W _ { \mathcal { D } } )$ , and use $W _ { \mathcal { G } }$ to denote the generator distribution $P _ { \mathcal { G } } ( Y ; W _ { \mathcal { G } } )$ .
261
+
262
+ We assume both the observed data size $n$ and the synthesized data size $\tilde { n }$ are large enough so that we shall work on distributions or populations instead of finite samples. As explained above, assuming $\tilde { n } \to \infty$ is sound because the generator net can supply unlimited number of examples.
263
+
264
+ The Langevin revision dynamics runs a Markov chain from $W _ { \mathcal { G } } ^ { ( t ) }$ ) towards W (t)D . Let $\mathbf { L } _ { W _ { \mathcal { D } } }$ be the Markov transition kernel of $l _ { \mathcal { D } }$ steps of Langevin revisions towards $W _ { \mathcal { D } }$ . The distribution of the revised synthesized data is
265
+
266
+ $$
267
+ P _ { \mathcal { D } } ^ { ( t + 1 ) } = \mathbf { L } _ { W _ { \mathcal { D } } ^ { ( t ) } } \cdot W _ { \mathcal { G } } ^ { ( t ) } ,
268
+ $$
269
+
270
+ where the notation $\mathbf { L } \cdot P$ denotes the marginal distribution obtained by running the Markov transition L from $P$ . The distribution $P _ { \mathcal { D } } ^ { ( t + 1 ) }$ is in the middle between the two nets $W _ { \mathcal { G } } ^ { ( t ) }$ ) and W (t)D , and it serves as the data distribution to train the generator, i.e., we project this distribution onto the manifold $\mathcal { G } = \{ P _ { \mathcal { G } } ( Y ; W _ { \mathcal { G } } ) , \forall W _ { \mathcal { G } } \} = \{ W _ { \mathcal { G } } \}$ (recall we use $W _ { \mathcal { G } }$ to denote the distribution $P _ { \mathcal { G } } ( Y ; W _ { \mathcal { G } } ) )$ in the
271
+
272
+ information geometry picture, so that
273
+
274
+ $$
275
+ W _ { \mathcal { G } } ^ { ( t + 1 ) } = \arg \operatorname* { m i n } _ { \mathcal { G } } \mathrm { K L } ( P _ { \mathcal { D } } ^ { ( t + 1 ) } | W _ { \mathcal { G } } ) .
276
+ $$
277
+
278
+ The learning process alternates between Markov transition in (12) and projection in (13), as illustrated by Figure 9.
279
+
280
+ ![](images/b43b09ce1302d71cd85c8097eff4f0ee917cfe70c93d31247f6b45de0963750b.jpg)
281
+ Figure 9: The learning of the generator alternates between Markov transition and projection. The family of the generator models $\mathcal { G }$ is illustrated by the black curve. Each distribution is illustrated by a point.
282
+
283
+ In the case of $l _ { \mathcal { D } } \infty$
284
+
285
+ $$
286
+ \begin{array} { r l } & { W _ { \mathcal { D } } ^ { ( t ) } \to \hat { W } _ { \mathcal { D } } = \arg \underset { \mathcal { D } } { \operatorname* { m i n } } \mathrm { K L } ( P _ { \mathrm { d a t a } } | W _ { \mathcal { D } } ) , } \\ & { W _ { \mathcal { G } } ^ { ( t ) } \to \hat { W } _ { \mathcal { G } } = \arg \underset { \mathcal { G } } { \operatorname* { m i n } } \mathrm { K L } ( \hat { W } _ { \mathcal { D } } | W _ { \mathcal { G } } ) . } \end{array}
287
+ $$
288
+
289
+ That is, we first project $P _ { \mathrm { d a t a } }$ onto $\mathcal { D }$ , and from there continue to project onto $\mathcal { G }$ . Therefore, $W _ { \mathcal { D } }$ converges to the maximum likelihood estimate with $P _ { \mathrm { d a t a } }$ being the data distribution, while $W _ { \mathcal { G } }$ converges to the maximum likelihood estimate with $\hat { W _ { \mathcal { D } } }$ serving as the data distribution.
290
+
291
+ For finite $l _ { \mathcal { D } }$ , the algorithm may converge to the following fixed points. The fixed point for the generator satisfies
292
+
293
+ $$
294
+ \hat { W } _ { \mathcal { G } } = \arg \operatorname* { m i n } _ { \mathcal { G } } \mathrm { K L } ( L _ { \hat { W } _ { \mathcal { D } } } \cdot \hat { W } _ { \mathcal { G } } | W _ { \mathcal { G } } ) .
295
+ $$
296
+
297
+ The fixed point for the descriptor satisfies
298
+
299
+ $$
300
+ \begin{array} { r l r } { \hat { W } _ { \mathcal D } } & { = } & { \arg \underset { \mathcal D } { \operatorname* { m i n } } \left[ \mathrm { K L } ( P _ { \mathrm { d a t a } } | W _ { \mathcal D } ) - \mathrm { K L } ( \mathbf L _ { \hat { W } _ { \mathcal D } } \cdot \hat { W } _ { \mathcal G } | W _ { \mathcal D } ) \right] , } \end{array}
301
+ $$
302
+
303
+ which is similar to contrastive divergence (Hinton, 2002), except that $\hat { W } _ { G }$ takes the place of $P _ { \mathrm { d a t a } }$ in the second Kullback-Leibler divergence. Because $\hat { W } _ { \mathcal G }$ is supposed to be close to $\hat { W } _ { \mathcal { D } }$ , the second Kullback-Leibler divergence is supposed to be small, hence our algorithm is closer to maximum likelihood learning than contrastive divergence.
304
+
305
+ Kim & Bengio (2016) learned the generator by gradient descent on $\mathrm { K L } ( W _ { \mathcal { G } } | W _ { \mathcal { D } } ^ { ( t ) } )$ over $\mathcal { G }$ . The objective function is $\operatorname { K L } ( W _ { \mathcal { G } } | W _ { \mathcal { D } } ^ { ( t ) } ) = \operatorname { E } _ { W _ { \mathcal { G } } } [ \log P _ { G } ( Y ; W _ { \mathcal { G } } ) ] - \operatorname { E } _ { W _ { \mathcal { G } } } [ \log P _ { \mathcal { D } } ( Y ; W _ { \mathcal { D } } ^ { ( t ) } ) ]$ , where the first term is the negative entropy that is intractable, and the second term is the expected energy that is tractable. Our learning method for the generator is consistent with the learning objective $\mathrm { K L } ( W _ { \mathcal { G } } | W _ { \mathcal { D } } ^ { ( t ) } )$ , because
306
+
307
+ $$
308
+ \mathrm { K L } ( P _ { \mathcal { D } } ^ { ( t + 1 ) } | W _ { \mathcal { D } } ^ { ( t ) } ) \leq \mathrm { K L } ( W _ { \mathcal { G } } ^ { ( t ) } | W _ { \mathcal { D } } ^ { ( t ) } ) .
309
+ $$
310
+
311
+ In fact, $\mathrm { K L } ( P _ { \mathcal { D } } ^ { ( t + 1 ) } | W _ { \mathcal { D } } ^ { ( t ) } ) \to 0$ monotonically as $l _ { \mathcal { D } } \infty$ due to the second law of thermodynamics. The reduction of the Kullback-Leibler divergence in (18) and the projection in (13) in our learning of the generator are consistent with the learning objective of reducing $\mathrm { K L } ( W _ { \mathcal { G } } | W _ { \mathcal { D } } ^ { ( t ) } )$ in $\operatorname { K i m } \&$ Bengio (2016). But the Monte Carlo implementation of in our work avoids the need to approximate the intractable entropy term.
312
+
313
+ # 7.3 MORE SYNTHESIS RESULTS
314
+
315
+ We display more synthesis results at the resolution of $6 4 \times 6 4$ .
316
+
317
+ ![](images/fa57b10313cd350d46c64e652a218e577e9c5d82f42bf54e6cbda4051968c44b.jpg)
318
+ (a) Original images
319
+
320
+ ![](images/4344d87e0bc5dba658a5951713b369d4ebd3961a2be7cc7e3bef6fb9b8b0da35.jpg)
321
+ Figure 10: Generating swimming pool images. The category is from MIT places205 dataset.
322
+
323
+ ![](images/4f930503433b04f0f4f3a8d878fdf742a9e39069207fa6e40cbb81dd51708443.jpg)
324
+ (a) Original images
325
+
326
+ ![](images/643e35f770dfe5dc178ae9f9c9a07ba34b55669747d4d354cb29229f83ebe2cf.jpg)
327
+ Figure 11: Generating volcano images. The category is from MIT places205 dataset.
328
+
329
+ ![](images/c9545a3708bd3fb1fe08e41242a58e0180a661542fad4b2bdcd92a881bdb4175.jpg)
330
+ (a) Original images
331
+
332
+ ![](images/3e53647e608ce0c4acea2f61b7245b65ae4faaf262144fad822b943eda9ad142.jpg)
333
+ Figure 12: Generating rock images. The category is from MIT places205 dataset.
334
+
335
+ ![](images/b12cace848d065b0fa8a488392ab77b34a9746b62f0664058f2c3712139e8447.jpg)
336
+ (a) Original images
337
+
338
+ ![](images/5ee1f47ee99d367d33c8750e5f6afc134f8e3eb3ab8afa1c6349f1a4f3dcedae.jpg)
339
+ Figure 13: Generating desert images. The category is from MIT places205 dataset.
340
+
341
+ ![](images/c240c83a2ecf8e50df6b5c62bed9bc301a8fa3ed14365d75d5d059ea8c66eede.jpg)
342
+ Figure 14: Generating schoolbus images. The category is from Imagenet ILSVRC2012 1000 object categories.
343
+
344
+ ![](images/84da1ea2ce2aa8bb875b9475ae90c024adb01c0be4582788db870e1abbee7bca.jpg)
345
+ (a) Original images
346
+
347
+ ![](images/a8d36572a8199b6a19dcb1243b1e8da604cc228c9da6312c998be9f6ed69efbb.jpg)
348
+ Figure 15: Generating lifeboat images. The category is from Imagenet ILSVRC2012 1000 object categories.
349
+
350
+ ![](images/46d20f827362e767e77661eededb4fe10435504996bd25a3b41fa459497b2123.jpg)
351
+ (a) Original images
352
+
353
+ ![](images/e648eb571b9779541d94d339c142f7e168d3c07e852fd01745814cf2fbbbb81b.jpg)
354
+ Figure 16: Generating zebra images. The category is from Imagenet ILSVRC2012 1000 object categories.
355
+
356
+ ![](images/27711f6e1fdb6eb29d18e2f1525701702e0482d73d2d5267a3d0ec86c16756d5.jpg)
357
+ (a) Original images
358
+
359
+ ![](images/16832906f2ab1dce4cda5308ebb29a4000dea39e6fc33a2f320c55c689537a8c.jpg)
360
+ Figure 17: Generating strawberry images. The category is from Imagenet ILSVRC2012 1000 object categories.
361
+
362
+ ![](images/6d5cf44133ea0452bf4dfa5b37dabb9272e680f425069fb07a5732da64e15174.jpg)
363
+ Figure 18: Generating lemon images. The category is from Imagenet ILSVRC2012 1000 object categories.
364
+
365
+ ![](images/922628eee4c815b3f90fe271603a9b61b34ae36d5547fd0c779439a40bfa6723.jpg)
366
+ (a) Original images
367
+
368
+ ![](images/c07c2e08ef357ea34cea8c5bd5c0f147c0e503a97915274b1c7941023530fefd.jpg)
369
+ Figure 19: Generating apartment building images. The category is from Imagenet ILSVRC2012 1000 object categories.
370
+
371
+ ![](images/7217d8f4633ecbedd3c65d26e0b7c52899f72d7542e691c35e0c04a25cf095ca.jpg)
372
+ Figure 20: Generating dinning table images. The category is from Imagenet ILSVRC2012 1000 object categories.
373
+
374
+ ![](images/43d047ffdb94f8574ee56bff737c033f91dd1af046867e25f5900be4d091b51d.jpg)
375
+ Figure 21: Generating balloon images. The category is from Imagenet ILSVRC2012 1000 object categories.
376
+
377
+ # ACKNOWLEDGEMENT
378
+
379
+ We thank Hansheng Jiang for her work on this project as a summer visiting student. We thank Tian Han for sharing the code on learning the generator network, and for helpful discussions.
380
+
381
+ The work is supported by NSF DMS 1310391, DARPA SIMPLEX N66001-15-C-4035, ONR MURI N00014-16-1-2007, and DARPA ARO W911NF-16-1-0579.
382
+
383
+ # REFERENCES
384
+
385
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 248–255. IEEE, 2009.
386
+
387
+ Emily L Denton, Soumith Chintala, Rob Fergus, et al. Deep generative image models using a laplacian pyramid of adversarial networks. In Advances in Neural Information Processing Systems, pp. 1486–1494, 2015.
388
+
389
+ John D’Errico. Interpolation inpainting, 2004. URL https://www.mathworks.com/ matlabcentral/fileexchange/4551-inpaint-nans.
390
+
391
+ E Dosovitskiy, J. T. Springenberg, and T Brox. Learning to generate chairs with convolutional neural networks. In IEEE International Conference on Computer Vision and Pattern Recognition (CVPR), 2015.
392
+
393
+ 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.
394
+
395
+ Tian Han, Yang Lu, Song-Chun Zhu, and Ying Nian Wu. Alternating back-propagation for generator network. In 31st AAAI Conference on Artificial Intelligence, 2017.
396
+
397
+ Geoffrey E Hinton. Training products of experts by minimizing contrastive divergence. Neural Computation, 14(8):1771–1800, 2002.
398
+
399
+ Taesup Kim and Yoshua Bengio. Deep directed generative models with energy-based probability estimation. arXiv preprint arXiv:1606.03439, 2016.
400
+
401
+ Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. ICLR, 2014.
402
+
403
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, pp. 1097–1105, 2012.
404
+
405
+ 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.
406
+
407
+ Yann LeCun, Sumit Chopra, Rata Hadsell, Mare’Aurelio Ranzato, and Fu Jie Huang. A tutorial on energy-based learning. In Predicting Structured Data. MIT Press, 2006.
408
+
409
+ Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of the IEEE International Conference on Computer Vision, pp. 3730–3738, 2015.
410
+
411
+ Andriy Mnih and Karol Gregor. Neural variational inference and learning in belief networks. In ICML, 2014.
412
+
413
+ Jiquan Ngiam, Zhenghao Chen, Pang Wei Koh, and Andrew Y. Ng. Learning deep energy models. In International Conference on Machine Learning, 2011.
414
+
415
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
416
+
417
+ Danilo J. Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In Tony Jebara and Eric P. Xing (eds.), ICML, pp. 1278–1286. JMLR Workshop and Conference Proceedings, 2014.
418
+
419
+ Herbert Robbins and Sutton Monro. A stochastic approximation method. The annals of mathematical statistics, pp. 400–407, 1951.
420
+
421
+ Yee Whye Teh, Max Welling, Simon Osindero, and Geoffrey E Hinton. Energy-based models for sparse overcomplete representations. Journal of Machine Learning Research, 4(Dec):1235–1260, 2003.
422
+
423
+ A. Vedaldi and K. Lenc. Matconvnet – convolutional neural networks for matlab. In Proceeding of the ACM Int. Conf. on Multimedia, 2015.
424
+ Jianwen Xie, Yang Lu, Song-Chun Zhu, and Ying Nian Wu. A theory of generative convnet. In ICML, 2016.
425
+ Laurent Younes. On the convergence of markovian stochastic algorithms with rapidly decreasing ergodicity rates. Stochastics: An International Journal of Probability and Stochastic Processes, 65(3-4):177–228, 1999.
426
+ Bolei Zhou, Agata Lapedriza, Jianxiong Xiao, Antonio Torralba, and Aude Oliva. Learning deep features for scene recognition using places database. In Advances in neural information processing systems, pp. 487–495, 2014.
427
+ Song-Chun Zhu. Statistical modeling and conceptualization of visual patterns. IEEE Transactions on Pattern Analysis and Machine Intelligence, 25(6):691–712, 2003.
428
+ Song-Chun Zhu, Ying Nian Wu, and David Mumford. Minimax entropy principle and its application to texture modeling. Neural Computation, 9(8):1627–1660, 1997.
md/train/B1G9tvcgx/B1G9tvcgx.md ADDED
@@ -0,0 +1,404 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NEURAL MACHINE TRANSLATION WITH LATENT SEMANTIC OF IMAGE AND TEXT
2
+
3
+ Joji Toyama∗, Masanori Misono∗†, Masahiro Suzuki, Kotaro Nakayama & Yutaka Matsuo
4
+ Graduate School of Engineering, †Graduate School of Information Science and Technology
5
+ The University of Tokyo
6
+ Hongo, Tokyo, Japan
7
+ {toyama,misono,masa,k-nakayama,matsuo}@weblab.t.u-tokyo.ac.jp
8
+
9
+ # ABSTRACT
10
+
11
+ Although attention-based Neural Machine Translation have achieved great success, attention-mechanism cannot capture the entire meaning of the source sentence because the attention mechanism generates a target word depending heavily on the relevant parts of the source sentence. The report of earlier studies has introduced a latent variable to capture the entire meaning of sentence and achieved improvement on attention-based Neural Machine Translation. We follow this approach and we believe that the capturing meaning of sentence benefits from image information because human beings understand the meaning of language not only from textual information but also from perceptual information such as that gained from vision. As described herein, we propose a neural machine translation model that introduces a continuous latent variable containing an underlying semantic extracted from texts and images. Our model, which can be trained endto-end, requires image information only when training. Experiments conducted with an English–German translation task show that our model outperforms over the baseline.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Neural machine translation (NMT) has achieved great success in recent years (Sutskever et al., 2014; Bahdanau et al., 2015). In contrast to statistical machine translation, which requires huge phrase and rule tables, NMT requires much less memory. However, the most standard model, NMT with attention (Bahdanau et al., 2015) entails the shortcoming that the attention mechanism cannot capture the entire meaning of a sentence because it generates a target word while depending heavily on the relevant parts of the source sentence (Tu et al., 2016). To overcome this problem, Variational Neural Machine Translation (VNMT), which outperforms NMT with attention introduces a latent variable to capture the underlying semantic from source and target (Zhang et al., 2016). We follow the motivation of VNMT, which is to capture underlying semantic of a source.
16
+
17
+ Image information is related to language. For example, we human beings understand the meaning of language by linking perceptual information given by the surrounding environment and language (Barsalou, 1999). Although it is natural and easy for humans, it is difficult for computers to understand different domain’s information integrally. Solving this difficult task might, however, bring great improvements in natural language processing. Several researchers have attempted to link language and images such as image captioning by Xu et al. (2015) or image generation from sentences by Reed et al. (2016). They described the possibility of integral understanding of images and text. In machine translation, we can expect an improvement using not only text information but also image information because image information can bridge two languages.
18
+
19
+ As described herein, we propose the neural machine translation model which introduces a latent variable containing an underlying semantic extracted from texts and images. Our model includes an explicit latent variable z, which has underlying semantics extracted from text and images by introducing a Variational Autoencoder (VAE) (Kingma et al., 2014; Rezende et al., 2014). Our model, which can be trained end-to-end, requires image information only when training. As described herein, we tackle the task with which one uses a parallel corpus and images in training, while using a source corpus in translating. It is important to define the task in this manner because we rarely have a corresponding image when we want to translate a sentence. During translation, our model generates a semantic variable z from a source, integrates variable z into a decoder of neural machine translation system, and then finally generates the translation. The difference between our model and VNMT is that we use image information in addition to text information.
20
+
21
+ ![](images/7d59f4e9d8e0d16dcda6d9fe5f00e4043acaa4825994a380abfab9cb596829ee.jpg)
22
+ Figure 1: Architecture of Proposed Model. Green dotted lines denote that $\pi$ and encoded y are used only when training.
23
+
24
+ For experiments, we used Multi30k (Elliott et al., 2016), which includes images and the corresponding parallel corpora of English and German. Our model outperforms the baseline with two evaluation metrics: METEOR (Denkowski & Lavie, 2014) and BLEU (Papineni et al., 2002). Moreover, we obtain some knowledge related to our model and Multi30k. Finally, we present some examples in which our model either improved, or worsened, the result.
25
+
26
+ Our paper contributes to the neural machine translation research community in three ways.
27
+
28
+ • We present the first neural machine translation model to introduce a latent variable inferred from image and text information. We also present the first translation task with which one uses a parallel corpus and images in training, while using a source corpus in translating.
29
+ • Our translation model can generate more accurate translation by training with images, especially for short sentences.
30
+ • We present how the translation of source is changed by adding image information compared to VNMT which does not use image information.
31
+
32
+ # 2 BACKGROUND
33
+
34
+ Our model is the extension of Variational Neural Machine Translation (VNMT) (Zhang et al., 2016). Our model is also viewed as one of the multimodal translation models. In our model, VAE is used to introduce a latent variable. We describe the background of our model in this section.
35
+
36
+ # 2.1 VARIATIONAL NEURAL MACHINE TRANSLATION
37
+
38
+ The VNMT translation model introduces a latent variable. This model’s architecture shown in Figure 1 excludes the arrow from $\pi$ . This model involves three parts: encoder, inferrer, and decoder. In the encoder, both the source and target are encoded by bidirectional-Recurrent Neural Networks (bidirectional-RNN) and a semantic representation is generated. In the inferrer, a latent variable $\mathbf { z }$ is modeled from a semantic representation by introducing VAE. In the decoder, a latent variable $\mathbf { z }$ is integrated in the Gated Recurrent Unit (GRU) decoder; also, a translation is generated.
39
+
40
+ Our model is followed by architecture, except that the image is also encoded to obtain a latent variable z.
41
+
42
+ # 2.2 MULTIMODAL TRANSLATION
43
+
44
+ Multimodal Translation is the task with which one might one can use a parallel corpus and images. The first papers to study multimodal translation are Elliott et al. (2015) and Hitschler & Riezler (2016). It was selected as a shared task in Workshop of Machine Translation 2016 (WMT161). Although several studies have been conducted (Caglayan et al., 2016; Huang et al., 2016; Calixto et al., 2016; Libovicky et al. ´ , 2016; Rodr´ıguez Guasch & Costa-jussa\`, 2016; Shah et al., 2016), they do not show great improvement, especially in neural machine translation (Specia et al., 2016). Here, we introduce end-to-end neural network translation models like our model.
45
+
46
+ Caglayan et al. (2016) integrate an image into an NMT decoder. They simply put source context vectors and image feature vectors extracted from ResNet-50’s ‘res4f relu’ layer (He et al., 2016) into the decoder called multimodal conditional GRU. They demonstrate that their method does not surpass the text-only baseline: NMT with attention.
47
+
48
+ Huang et al. (2016) integrate an image into a head of source words sequence. They extract prominent objects from the image by Region-based Convolutional Neural Networks (R-CNN) (Girshick, 2015). Objects are then converted to feature vectors by VGG-19 (Simonyan & Zisserman, 2014) and are put into a head of source words sequence. They demonstrate that object extraction by R-CNN contributes greatly to the improvement. This model achieved the highest METEOR score in NMTbased models in WMT16, which we compare to our model in the experiment. We designate this model as CMU.
49
+
50
+ Caglayan et al. (2016) argue that their proposed model did not achieve improvement because they failed to benefit from both text and images. We assume that they failed to integrate text and images because they simply put images and text into neural machine translation despite huge gap exists between image information and text information. Our model, however, presents the possibility of benefitting from images and text because text and images are projected to their common semantic space so that the gap of images and text would be filled.
51
+
52
+ # 2.3 VARIATIONAL AUTO ENCODER
53
+
54
+ VAE was proposed in an earlier report of the literature Kingma et al. (2014); Rezende et al. (2014). Given an observed variable $\mathbf { x }$ , VAE introduces a continuous latent variable $\mathbf { z }$ , with the assumption that $\mathbf { x }$ is generated from $\mathbf { z }$ . VAE incorporates $p _ { \boldsymbol { \theta } } ( \mathbf { x } | \mathbf { z } )$ and $q _ { \phi } ( { \bf z } | { \bf x } )$ into an end-to-end neural network. The lower bound is shown below.
55
+
56
+ $$
57
+ \mathcal { L } _ { \mathrm { V A E } } = - \mathrm { D } _ { \mathrm { K L } } \left[ q _ { \phi } ( \mathbf { z } | \mathbf { x } ) | | p _ { \theta } ( \mathbf { z } ) \right] + \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } ) } \left[ \log p _ { \theta } ( \mathbf { x } | \mathbf { z } ) \right] \leq \log p _ { \theta } ( \mathbf { x } )
58
+ $$
59
+
60
+ # 3 NEURAL MACHINE TRANSLATION WITH LATENT SEMANTIC OF IMAGE AND TEXT
61
+
62
+ We propose a neural machine translation model which explicitly has a latent variable containing an underlying semantic extracted from both text and image. This model can be seen as an extension of VNMT by adding image information.
63
+
64
+ Our model can be drawn as a graphical model in Figure 3. Its lower bound is
65
+
66
+ $$
67
+ \mathcal { L } = - \mathrm { D } _ { \mathrm { K L } } \left[ q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pi ) | | p _ { \theta } ( \mathbf { z } | \mathbf { x } ) \right] + \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pi ) } \left[ \log p _ { \theta } ( \mathbf { y } | \mathbf { z } , \mathbf { x } ) \right] ,
68
+ $$
69
+
70
+ where ${ \mathbf { x } } , { \mathbf { y } } , \pi , { \mathbf { z } }$ respectively denote the source, target, image and latent variable, and $p _ { \theta }$ and $q _ { \phi }$ respectively denote the prior distribution and the approximate posterior distribution. It is noteworthy in Eq. (2) that we want to model $p ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pi )$ , which is intractable. Therefore we model $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pmb { \pi } )$
71
+
72
+ ![](images/be44e2eca20e772743f6f2e21e2702d4272dad150589e6eca8ea1113b2c8c7d9.jpg)
73
+ Figure 2: VNMT
74
+
75
+ ![](images/c7a23d3386179254d992cf59a6bfb4684fdde8b205007edc2ffd3f3352dbb994.jpg)
76
+ Figure 3: Our model
77
+
78
+ instead, and also model prior $p _ { \theta } ( \mathbf { z } | \mathbf { x } )$ so that we can generate a translation from the source in testing.
79
+ Derivation of the formula is presented in the appendix.
80
+
81
+ We model all distributions in Eq. (2) by neural networks. Our model architecture is divisible into three parts: 1) encoder, 2) inferrer, and 3) decoder.
82
+
83
+ # 3.1 ENCODER
84
+
85
+ In the encoder, the semantic representation $\mathbf { h _ { e } }$ is obtained from the image, source, and target. We propose several methods to encode an image. We show how these methods affect the translation result in the Experiment section. This representation is used in the inferrer. This section links to the green part of Figure 1.
86
+
87
+ # 3.1.1 TEXT ENCODING
88
+
89
+ The source and target are encoded in the same way as Bahdanau et al. (2015). The source is converted to a sequence of 1-of- $\mathbf { \nabla } _ { k }$ vector and is embedded to $d _ { e m b }$ dimensions. We designate it as the source sequence. Then, a source sequence is put into bidirectional RNN. Representation $\mathbf { h } _ { i }$ is obtained by concatenating $\vec { \mathbf { h } } _ { i }$ and $\bar { \mathbf { h } } _ { i } : \bar { \vec { \mathbf { h } } } _ { i } = \mathrm { R N N } ( \vec { \mathbf { h } } _ { i - 1 } , E _ { w _ { i } } ) , \bar { \mathbf { h } } _ { i } = \mathrm { R N N } ( \bar { \mathbf { h } } _ { i + 1 } , E _ { w _ { i } } ) , \mathbf { h } _ { i } = [ \vec { \mathbf { h } } _ { i } ; \bar { \mathbf { h } } _ { i } ]$ , where $E _ { w _ { i } }$ is the embedded word in a source sentence, $\mathbf { h } _ { i } \in \mathbb { R } ^ { d _ { h } }$ , and $\vec { \bf h } _ { i } , \bar { \bf h } _ { i } \in \mathbb { R } ^ { \frac { d _ { h } } { 2 } }$ . It is conducted through $i = 0$ to $i = T _ { f }$ , where $T _ { f }$ is the sequence length. GRU is implemented in bidirectional RNN so that it can attain long-term dependence. Finally, we conduct mean-pooling to $\mathbf { h } _ { i }$ and obtain the source representation vector as $\begin{array} { r } { \mathbf { h } _ { f } = \frac { 1 } { T _ { f } } \sum _ { i } ^ { T _ { f } } \mathbf { h } _ { i } } \end{array}$ . The exact same process is applied to target to obtain target representation $\mathbf { h } _ { g }$ .
90
+
91
+ # 3.1.2 IMAGE ENCODING AND SEMANTIC REPRESENTATION
92
+
93
+ We use Convolutional Neural Networks (CNN) to extract feature vectors from images. We propose several ways of extracting image features.
94
+
95
+ Global (G) The image feature vector is extracted from the image using a CNN. With this method, we use a feature vector in the certain layer as $\pi$ . Then $\pi$ is encoded to the image representation vector $\mathbf { h } _ { \pi }$ simply by affine transformation as
96
+
97
+ $$
98
+ \mathbf { h } _ { \pi } = W _ { \pi } \pi + b _ { \pi } \quad \mathrm { w h e r e } ~ W _ { \pi } \in \mathbb { R } ^ { d _ { \pi } \times d _ { f c 7 } } , b _ { \pi } \in \mathbb { R } ^ { d _ { \pi } } .
99
+ $$
100
+
101
+ Global and Objects $\mathbf { ( G { + } 0 ) }$ First we extract some prominent objects from images in some way. Then, we obtain fc7 image feature vectors $\pi$ from the original image and extracted objects using a CNN. Therefore $\pi$ takes a variable length. We handle $\pi$ in two ways: average and RNN encoder.
102
+
103
+ In average $\mathbf { G { + } O { - } A V G }$ , we first obtain intermediate image representation vector ${ \bf h } _ { \pi } ^ { \prime }$ by affine transformation in Eq. (3). Then, the average of ${ \bf h } _ { \pi } ^ { \prime }$ becomes the image representation vector: $\begin{array} { r } { \mathbf { h } _ { \pi } = \frac { \sum _ { i } ^ { l } \mathbf { h } _ { \pi _ { i } } ^ { \prime } } { l } } \end{array}$ , where $l$ is the length of ${ \bf h } _ { \pi } ^ { \prime }$ .
104
+
105
+ In RNN encoder $\mathbf { G } { + } \mathbf { O } { \mathbf { - } } \mathbf { R } \mathbf { N } \mathbf { N }$ ), we first obtain ${ \bf h } _ { \pi } ^ { \prime }$ by affine transformation in Eq. (3). Then, we encode ${ \bf h } _ { \pi } ^ { \prime }$ in the same way as we encode text in Section 3.1.1 to obtain $\mathbf { h } _ { \pi }$ .
106
+
107
+ Global and Objects into source and target $\mathbf { \left( G { + } O { - } T X T \right) }$ ) Thereby, we first obtain ${ \bf h } _ { \pi } ^ { \prime }$ by affine transformation in Eq. (3). Then, we put sequential vector ${ \bf h } _ { \pi } ^ { \prime }$ into the head of the source sequence and target sequence. In this case, we set $d _ { \pi }$ to be the same dimension as $d _ { e m b }$ . In fact, the source sequence including ${ \bf h } _ { \pi } ^ { \prime }$ is only used to model $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pmb { \pi } )$ . Context vector c (Eq. (15)) and $p _ { \theta } ( \mathbf { z } | \mathbf { x } )$ are computed by a source sequence that does not include ${ \bf h } _ { \pi } ^ { \prime }$ . We encode the source sequence including ${ \bf h } _ { \pi } ^ { \prime }$ as Section 3.1.1 to obtain $\mathbf { h } _ { f }$ and $\mathbf { h } _ { g }$ . In this case, $\mathbf { h } _ { \pi }$ is not obtained. Image information is contained in $\mathbf { h } _ { f }$ and $\mathbf { h } _ { g }$ .
108
+
109
+ All representation vectors $\mathbf { h } _ { f } , \mathbf { h } _ { g }$ and $\mathbf { h } _ { \pi }$ are concatenated to obtain a semantic representation vector as $\mathbf h _ { e } \ = \ [ \mathbf h _ { f } ; \mathbf h _ { g } ; \mathbf h _ { \pi } ]$ , where $\bar { \mathbf { h } } _ { e } \in \mathbb { R } ^ { d _ { e } = 2 \times d _ { h } + d _ { \pi } }$ (in $\mathrm { G } { + } \mathrm { O } \mathrm { \mathrm { \Omega } }$ -TXT: ${ \bf h } _ { e } ~ = ~ [ { \bf h } _ { f } ; { \bf h } _ { g } ]$ , where $\mathbf { h } _ { e } \in$ $\mathbb { R } ^ { d _ { e } = 2 \times d _ { h } }$ ). It is an input of the multimodal variational neural inferrer.
110
+
111
+ # 3.2 INFERRER
112
+
113
+ We model the posterior $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pmb { \pi } )$ using a neural network and also the prior $p _ { \theta } ( \mathbf { z } | \mathbf { x } )$ by neural network. This section links to the black and grey part of Figure 1.
114
+
115
+ # 3.2.1 NEURAL POSTERIOR APPROXIMATOR
116
+
117
+ Modeling the true posterior $p _ { \theta } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pi )$ is usually intractable. Therefore, we consider modeling of an approximate posterior $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pmb { \pi } )$ by introducing VAE. We assume that the posterior $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \boldsymbol { \pi } )$ has the following form:
118
+
119
+ $$
120
+ \begin{array} { r } { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pi ) = \mathcal { N } ( \mathbf { z } ; \mu ( \mathbf { x } , \mathbf { y } , \pi ) , \pmb { \sigma } ( \mathbf { x } , \mathbf { y } , \pi ) ^ { 2 } \mathbf { I } ) . } \end{array}
121
+ $$
122
+
123
+ The mean $\pmb { \mu }$ and standard deviation $\sigma$ of the approximate posterior are the outputs of neural networks.
124
+
125
+ Starting from the variational neural encoder, a semantic representation vector $\mathbf { h } _ { e }$ is projected to latent semantic space as
126
+
127
+ $$
128
+ { \bf h } _ { z } = g ( W _ { z } ^ { ( 1 ) } { \bf h } _ { e } + { \bf b } _ { z } ^ { ( 1 ) } ) ,
129
+ $$
130
+
131
+ where $W _ { z } ^ { ( 1 ) } \in \mathbb { R } ^ { d _ { z } \times ( d _ { e } ) } \mathbf { b } _ { z } ^ { ( 1 ) } \in \mathbb { R } ^ { d _ { z } }$ . $g ( \cdot )$ is an element-wise activation function, which we set as $\operatorname { t a n h } ( { \cdot } )$ . Gaussian parameters of Eq. (4) are obtained through linear regression as
132
+
133
+ $$
134
+ \pmb { \mu } = W _ { \mu } \mathbf { h } _ { z } + \mathbf { b } _ { \mu } , \log \pmb { \sigma } ^ { 2 } = W _ { \sigma } \mathbf { h } _ { z } + \mathbf { b } _ { \sigma } ,
135
+ $$
136
+
137
+ where $\mu , \log \sigma ^ { 2 } \in \mathbb { R } ^ { d _ { z } }$ .
138
+
139
+ # 3.2.2 NEURAL PRIOR MODEL
140
+
141
+ We model the prior distribution $p _ { \theta } ( \mathbf { z } | \mathbf { x } )$ as follows:
142
+
143
+ $$
144
+ \begin{array} { r l r } { p _ { \boldsymbol \theta } ( \mathbf { z } | \mathbf { x } ) } & { = } & { \mathcal { N } ( \mathbf { z } ; \mu ^ { \prime } ( \mathbf { x } ) , \pmb \sigma ^ { \prime } ( \mathbf { x } ) ^ { 2 } \mathbf { I } ) . } \end{array}
145
+ $$
146
+
147
+ $\mu ^ { \prime }$ and $\pmb { \sigma } ^ { \prime }$ are generated in the same way as that presented in Section 3.2.1, except for the absence of $\mathbf { y }$ and $\pi$ as inputs. Because of the absence of representation vectors, the dimensions of weight in equation (5) for prior model are W ′(1)z $W _ { z } ^ { ' ( 1 ) } \in \mathbb { R } ^ { d _ { z } \times d _ { h } }$ , $\mathbf { b } _ { z } ^ { ' ( 1 ) } \in \mathbb { R } ^ { d _ { z } }$ . We use a reparameterization trick to obtain a representation of latent variable $\mathbf { z }$ : $\mathbf h _ { z } ^ { \prime } = \pmb { \mu } + \pmb { \sigma } \pmb { \epsilon }$ , $\epsilon \sim \mathcal { N } ( 0 , I )$ . During translation, $\mathbf { h } _ { z } ^ { \prime }$ is set as the mean of $p _ { \theta } ( \mathbf { z } | \mathbf { x } )$ . Then, $\mathbf { h } _ { z } ^ { \prime }$ is projected onto the target space as
148
+
149
+ $$
150
+ \mathbf { h } _ { e } ^ { \prime } = g ( W _ { z } ^ { ( 2 ) } \mathbf { h } _ { z } ^ { \prime } + \mathbf { b } _ { z } ^ { ( 2 ) } ) \quad \mathrm { w h e r e ~ } \mathbf { h } _ { e } ^ { \prime } \in \mathbb { R } ^ { d _ { e } } .
151
+ $$
152
+
153
+ ${ \bf h } _ { e } ^ { \prime }$ is then integrated into the neural machine translation’s decoder.
154
+
155
+ # 3.3 DECODER
156
+
157
+ This section links to the orange part of Figure 1. Given the source sentence $\mathbf { x }$ and the latent variable $\mathbf { z }$ , decoder defines the probability over translation $\mathbf { y }$ as
158
+
159
+ $$
160
+ p ( \mathbf { y } | \mathbf { z } , \mathbf { x } ) = \prod _ { j = 1 } ^ { T } p ( \mathbf { y } _ { j } | \mathbf { y } _ { < j } , \mathbf { z } , \mathbf { x } ) .
161
+ $$
162
+
163
+ How we define the probability over translation $\mathbf { y }$ is fundamentally the same as VNMT, except for using conditional GRU instead of GRU. Conditional GRU involves two GRUs and an attention mechanism. We integrate a latent variable $\mathbf { z }$ into the second GRU. We describe it in the appendix.
164
+
165
+ # 3.4 MODEL TRAINING
166
+
167
+ Monte Carlo sampling method is used to approximate the expectation over the posterior Eq. (2), $\begin{array} { r } { \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pi ) } \approx \frac { 1 } { L } \sum _ { l = 1 } ^ { L } \log p _ { \theta } ( \mathbf { y } | \mathbf { x } , \mathbf { h } _ { z } ^ { ( l ) } ) } \end{array}$ , where $L$ is the number of samplings. The training objective is defined as
168
+
169
+ $$
170
+ \mathcal { L } ( \boldsymbol { \theta } , \boldsymbol { \phi } ) = - \mathrm { D } _ { \mathrm { K L } } \left[ q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \boldsymbol { \pi } ) | | p _ { \theta } ( \mathbf { z } | \mathbf { x } ) \right] + \frac { 1 } { L } \sum _ { l = 1 } ^ { L } \sum _ { j = 1 } ^ { T } \log p _ { \theta } ( \mathbf { y } _ { j } | \mathbf { y } _ { < j } , \mathbf { x } , \mathbf { h } _ { z } ^ { ( l ) } ) ,
171
+ $$
172
+
173
+ where $\mathbf { h } _ { z } = \pmb { \mu } + \pmb { \sigma } \cdot \pmb { \epsilon } , \pmb { \epsilon } \sim \mathcal { N } ( 0 , I )$ . The first term, KL divergence, can be computed analytically and is differentiable because both distributions are Gaussian. The second term is also differentiable. We set $L$ as 1. Overall, the objective $\mathcal { L }$ is differentiable. Therefore, we can optimize the parameter $\theta$ and variational parameter $\phi$ using gradient ascent techniques.
174
+
175
+ # 4 EXPERIMENTS
176
+
177
+ # 4.1 EXPERIMENTAL SETUP
178
+
179
+ We used Multi30k (Elliott et al., 2016) as the dataset. Multi30k have an English description and a German description for each corresponding image. We handle 29,000 pairs as training data, 1,014 pairs as validation data, and 1,000 pairs as test data.
180
+
181
+ Before training, punctuation normalization and lowercase are applied to both English and German sentences by Moses (Koehn et al., 2007) scripts2. Compound-word splitting is conducted only to German sentences using Sennrich et al. $( 2 0 1 \dot { 6 } ) ^ { 3 }$ . Then we tokenize sentences2 and use them as training data. We produce vocabulary dictionaries from training data. The vocabulary becomes 10,211 words for English and 13,180 words for German after compound-word splitting.
182
+
183
+ Image features are extracted using VGG-19 CNN (Simonyan & Zisserman, 2014). We use 4096- dimensional fc7 features. To extract the object’s region, we use Fast R-CNN (Girshick, 2015). Fast R-CNN is trained on ImageNet and MSCOCO dataset 4.
184
+
185
+ All weights are initialized by $\mathcal { N } ( 0 , 0 . 0 1 \mathbf { I } )$ . We use the adadelta algorithm as an optimization method. The hyperparameters used in the experiment are presented in the Appendix. All models are trained with early stopping. When training, VNMT is fine-tuned by NMT model and our models are finetuned using VNMT. When translating, we use beam-search. The beam-size is set as 12. Before evaluation, we restore split words to the original state and de-tokenize2 generated sentences.
186
+
187
+ We implemented proposed models based on $d l 4 m t ^ { 5 }$ . Actually, dl4mt is fundamentally the same model as Bahdanau et al. (2015), except that its decoder employs conditional GRU6. We implemented VNMT also with conditional GRU so small difference exists between our implementation and originally proposed VNMT which employs normal GRU as a decoder. We evaluated results based on METEOR and BLUE using MultEval 7.
188
+
189
+ # 4.2 RESULT
190
+
191
+ Table 1 presents experiment results. It shows that our models outperforms the baseline in both METEOR and BLEU. Figure 4 shows the plot of METEOR score of baselines and our models models in validation. Figure 5 shows the plot of METEOR score and the source sentence length.
192
+
193
+ Table 1: Evaluation Result on Multi30k dataset (English–German). The scores in parentheses are computed with ‘-norm’ parameter. NMT is dl4mt’s NMT (in the session3 directory). The score of the CMU is from (Huang et al., 2016).
194
+
195
+ <table><tr><td colspan="2"></td><td colspan="2">METEOR↑</td><td colspan="2">BLEU↑</td></tr><tr><td colspan="2"></td><td>val</td><td>test</td><td>val</td><td>test</td></tr><tr><td rowspan="3"></td><td>NMT</td><td>51.5 (55.8)</td><td>50.5 (54.9)</td><td>35.8</td><td>33.1</td></tr><tr><td>VNMT</td><td>52.2 (56.3)</td><td>51.1 (55.3)</td><td>37.0</td><td>34.9</td></tr><tr><td>CMU</td><td>()</td><td>1 (54.1)</td><td>1</td><td>1</td></tr><tr><td rowspan="4">Our Model</td><td>G</td><td>50.6 (54.8)</td><td>52.4 (56.0)</td><td>34.5</td><td>36.5</td></tr><tr><td>G+O-AVG</td><td>51.8 (55.8)</td><td>51.8 (55.8)</td><td>35.7</td><td>35.8</td></tr><tr><td>G+O-RNN</td><td>51.8 (56.1)</td><td>51.0 (55.4)</td><td>35.9</td><td>34.9</td></tr><tr><td>G+O-TXT</td><td>52.6 (56.8)</td><td>51.7 (56.0)</td><td>36.6</td><td>35.1</td></tr></table>
196
+
197
+ # 4.3 QUANTITATIVE ANALYSIS
198
+
199
+ Table 1 shows that G scores the best in proposed models. In G, we simply put the feature of the original image. Actually, proposed model does not benefit from R-CNN, presumably because we can not handle sequences of image features very well. For example, $\mathrm { G } { + } \mathrm { O }$ -AVG uses the average of multiple image features, but it only makes the original image information unnecessarily confusing.
200
+
201
+ Figure 4 shows that G and $\mathrm { G } { + } \mathrm { O } { } \mathrm { \cdot }$ -AVG outperforms VNMT almost every time, but all model scores increase suddenly in the 17,000 iteration validation. We have no explanation for this behavior. Figure 4 also shows that G and $\mathrm { G } { + } \mathrm { O } { } \mathrm { \mathrm { \Omega } }$ -AVG scores fluctuate more moderately than others. We state that G and $_ \mathrm { G + O }$ -AVG gain stability by adding image information. When one observes the difference between the test score and the validation score for each model, baseline scores decrease more than proposed model scores. Especially, the G score increases in the test, simply because proposed models produce a better METEOR score on average, as shown in Figure 4.
202
+
203
+ Figure 5 shows that G and $\mathrm { G } { + } \mathrm { O }$ -AVG make more improvements on baselines in short sentences than in long sentences, presumably because $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \boldsymbol { \pi } )$ can model $\mathbf { z }$ well when a sentence is short. Image features always have the same dimension, but underlying semantics of the image and text differ. We infer that when the sentence is short, image feature representation can afford to approximate the underlying semantic, but when a sentence is long, image feature representation can not approximate the underlying semantic.
204
+
205
+ Multi30k easily becomes overfitted, as shown in Figure 8 and 9 in the appendix. This is presumably because 1) Multi30k is the descriptions of image, making the sentences short and simple, and 2) Multi30k has 29,000 sentences, which could be insufficient. In the appendix, we show how the parameter setting affects the score. One can see that decay-c has a strong effect. Huang et al. (2016) states that their proposed model outperforms the baseline (NMT), but we do not have that observation. It can be assumed that their baseline parameters are not well tuned.
206
+
207
+ # 4.4 QUALITATIVE ANALYSIS
208
+
209
+ We presented the top 30 sentences, which make the largest METEOR score difference between G and VNMT, to native speakers of German and get the overall comments. They were not informed of our model training with image in addition to text. These comments are summarized into two general remarks. One is that G translates the meaning of the source material more accurately than VNMT. The other is that our model has more grammatical errors as prepositions’ mistakes or missing verbs compared to VNMT. We assume these two remarks are reasonable because G is trained with images which mainly have a representation of noun rather than verb, therefore can capture the meaning of materials in sentence.
210
+
211
+ ![](images/336f0b01b64b29847f26f5ecff9a7f50cb3d156bfae6b39739bff0d875544a49.jpg)
212
+ Figure 4: METEOR score to the validation data which are calculated for each 1000 iterations.
213
+
214
+ ![](images/5cbe81cb72340f2ba8e4f579766d3dc674988f34d481a805fadc437a74525605.jpg)
215
+ Figure 5: METEOR score on different groups of the source sentence length.
216
+
217
+ Figure 6 presents the translation results and the corresponding image which G translates more accurately than VNMT in METEOR. Figure 7 presents the translation results and the corresponding image which G translates less accurately than VNMT in METEOR. Again, we note that our model does not use image during translating. In Figure 6, G translates ”a white and black dog” correctly while VNMT translates it incorrectly implying ”a white dog and a black dog”. We assume that G correctly translates the source because G captures the meaning of material in the source. In Figure 7, G incorrectly translates the source. Its translation result is missing the preposition meaning ”at”, which is hardly represented in image.We present more translation examples in appendix.
218
+
219
+ ![](images/3e6e262a2cb9ed0521cc90b099233c2907e3bb10cdea3ffc73cf509db5803456.jpg)
220
+
221
+ ![](images/f5285ea63366850a021ab9f7f8e2cac294f6d2bbde53ffb04b34c0156f44619e.jpg)
222
+ Figure 6: Translation 1
223
+
224
+ ![](images/b9aa0f94d1e754dd559290e8983f30176de9651a391cc7a962dce590875455c5.jpg)
225
+
226
+ ![](images/b0308383548bfd1bdb406863a7474d490fee0deafc740e5feabcee5ef1f7bab4.jpg)
227
+ Figure 7: Translation 2
228
+
229
+ # 5 CONCLUSION
230
+
231
+ As described herein, we proposed the neural machine translation model that explicitly has a latent variable that includes underlying semantics extracted from both text and images. Our model outperforms the baseline in both METEOR and BLEU scores. Experiments and analysis present that our model can generate more accurate translation for short sentences. In qualitative analysis, we present that our model can translate nouns accurately while our model make grammatical errors.
232
+
233
+ # REFERENCES
234
+
235
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015.
236
+
237
+ Lawrence W. Barsalou. Perceptual symbol Systems. Behavioral and Brain Sciences, 22:577–609, 1999.
238
+
239
+ Ozan Caglayan, Walid Aransa, Yaxing Wang, Marc Masana, Mercedes Garc´ıa-Mart´ınez, Fethi Bougares, Lo¨ıc Barrault, and Joost van de Weijer. Does Multimodality Help Human and Machine for Translation and Image Captioning? In WMT, 2016.
240
+
241
+ Iacer Calixto, Desmond Elliott, and Stella Frank. DCU-UvA Multimodal MT System Report. In Proceedings of the First Conference on Machine Translation, pp. 634–638. Association for Computational Linguistics, 2016.
242
+
243
+ Michael Denkowski and Alon Lavie. Meteor Universal: Language Specific Translation Evaluation for Any Target Language. In Proceedings of the EACL 2014 Workshop on Statistical Machine Translation, 2014.
244
+
245
+ D. Elliott, S. Frank, and E. Hasler. Multilingual Image Description with Neural Sequence Models. ArXiv e-prints, 2015.
246
+
247
+ Desmond Elliott, Stella Frank, Khalil Sima’an, and Lucia Specia. Multi30K: Multilingual EnglishGerman Image Descriptions. CoRR, abs/1605.00459, 2016.
248
+
249
+ Ross Girshick. Fast R-CNN. In ICCV, 2015.
250
+
251
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. In CVPR, 2016.
252
+
253
+ Julian Hitschler and Stefan Riezler. Multimodal Pivots for Image Caption Translation. arXiv preprint arXiv:1601.03916, 2016.
254
+
255
+ Po-Yao Huang, Frederick Liu, Sz-Rung Shiang, Jean Oh, and Chris Dyer. Attention-based Multimodal Neural Machine Translation. In WMT, 2016.
256
+
257
+ Diederik P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised Learning with Deep Generative Models. In NIPS, 2014.
258
+
259
+ Philipp Koehn, Hieu Hoang, Alexandra Birch, Chris Callison-Burch, Marcello Federico, Nicola Bertoldi, Brooke Cowan, Wade Shen, Christine Moran, Richard Zens, Chris Dyer, Ondˇrej Bojar, Alexandra Constantin, and Evan Herbst. Moses: Open Source Toolkit for Statistical Machine Translation. In ACL, 2007.
260
+
261
+ Jindˇrich Libovicky, Jind ´ ˇrich Helcl, Marek Tlusty, Ond ´ ˇrej Bojar, and Pavel Pecina. CUNI System for WMT16 Automatic Post-Editing and Multimodal Translation Tasks. In Proceedings of the First Conference on Machine Translation, pp. 646–654. Association for Computational Linguistics, 2016.
262
+
263
+ Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. BLEU: A Method for Automatic Evaluation of Machine Translation. In ACL, 2002.
264
+
265
+ Scott Reed, Zeynep Akata, Xinchen Yan, Lajanugen Logeswaran, Bernt Schiele, and Honglak Lee. Generative Adversarial Text to Image Synthesis. In ICML, 2016.
266
+
267
+ Danilo J. Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic Backpropagation and Approximate Inference in Deep Generative Models. In ICML, 2014.
268
+
269
+ Sergio Rodr´ıguez Guasch and Marta R. Costa-jussa. WMT 2016 Multimodal Translation System \` Description based on Bidirectional Recurrent Neural Networks with Double-Embeddings. In Proceedings of the First Conference on Machine Translation, pp. 655–659. Association for Computational Linguistics, 2016.
270
+
271
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural Machine Translation of Rare Words with Subword Units. In ACL, 2016.
272
+
273
+ Kashif Shah, Josiah Wang, and Lucia Specia. SHEF-Multimodal: Grounding Machine Translation on Images. In Proceedings of the First Conference on Machine Translation, pp. 660–665. Association for Computational Linguistics, 2016.
274
+
275
+ Karen Simonyan and Andrew Zisserman. Very Deep Convolutional Networks for Large-Scale Image Recognition. CoRR, abs/1409.1556, 2014.
276
+
277
+ Lucia Specia, Stella Frank, Khalil Sima ’an, and Desmond Elliott. A shared Task on Multimodal Machine Translation and Crosslingual Image Description. In Proceedings of the First Conference on Machine Translation, Berlin, Germany. Association for Computational Linguistics, 2016.
278
+
279
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to Sequence Learning with Neural Networks. In NIPS, 2014.
280
+
281
+ Zhaopeng Tu, Zhengdong Lu, Yang Liu, Xiaohua Liu, and Hang Li. Modeling Coverage for Neural Machine Translation. In ACL, 2016.
282
+
283
+ Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhutdinov, Richard S Zemel, and Yoshua Bengio. Show, Attend and Tell: Neural Image Caption Generation with Visual Attention. In CVPR, 2015.
284
+
285
+ Biao Zhang, Deyi Xiong, and Jinsong Su. Variational Neural Machine Translation. In EMNLP, 2016.
286
+
287
+ # A DERIVATION OF LOWER BOUNDS
288
+
289
+ The lower bound of our model can be derived as follows:
290
+
291
+ $$
292
+ \begin{array} { l l l } { p ( \mathbf { y } | \mathbf { x } ) } & { = } & { \displaystyle \int p ( \mathbf { y } , \mathbf { z } | \mathbf { x } ) d \mathbf { z } } \\ { \displaystyle } & { = } & { \displaystyle \int p ( \mathbf { z } | \mathbf { x } ) p ( \mathbf { y } | \mathbf { z } , \mathbf { x } ) d \mathbf { z } } \end{array}
293
+ $$
294
+
295
+ $$
296
+ { \begin{array} { r c l } { \log p ( \mathbf { y } | \mathbf { x } ) } & { = } & { \log \int q ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pi ) { \frac { p ( \mathbf { z } | \mathbf { x } ) p ( \mathbf { y } | \mathbf { z } , \mathbf { x } ) } { q ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pi ) } } d \mathbf { z } } \\ & { \geq } & { \displaystyle \int q ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pi ) \log { \frac { p ( \mathbf { z } | \mathbf { x } ) p ( \mathbf { y } | \mathbf { z } , \mathbf { x } ) } { q ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pi ) } } d \mathbf { z } } \\ & { = } & { \displaystyle \int q ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pi ) \left( \log { \frac { p ( \mathbf { z } | \mathbf { x } ) } { q ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) } } + \log p ( \mathbf { y } | \mathbf { z } , \mathbf { x } ) \right) d \mathbf { z } } \\ & { = } & { \displaystyle - \mathrm { D } _ { \mathrm { K L } } \left[ q ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pi ) | | p ( \mathbf { z } | \mathbf { x } ) \right] + \mathbb { E } _ { q ( \mathbf { z } | \mathbf { x } , \mathbf { y } , \pi ) } \left[ \log p ( \mathbf { y } | \mathbf { z } , \mathbf { x } ) \right] } \\ & { = } & { \displaystyle { \mathcal { L } } } \end{array} }
297
+ $$
298
+
299
+ # B CONDITIONAL GRU
300
+
301
+ Conditional GRU is implemented in dl4mt. Caglayan et al. (2016) extends Conditional GRU to make it capable of receiving image information as input. The first GRU computes intermediate representation $s _ { j } ^ { \prime }$ as
302
+
303
+ $$
304
+ \begin{array} { r } { \mathbf { s } _ { j } ^ { \prime } = ( 1 - \mathbf { o } _ { j } ^ { \prime } ) \odot \underline { { \mathbf { s } } } _ { j } ^ { \prime } + \mathbf { o } _ { j } ^ { \prime } \odot \mathbf { s } _ { j - 1 } } \\ { \mathbf { s } _ { j } ^ { \prime } = \operatorname { t a n h } ( W ^ { \prime } E \left[ \mathbf { y } _ { j - 1 } \right] + \mathbf { r } _ { j } ^ { \prime } \odot ( U ^ { \prime } \mathbf { s } _ { j - 1 } ) ) } \\ { \mathbf { r } _ { j } ^ { \prime } = \sigma ( W _ { r } ^ { \prime } E \left[ \mathbf { y } _ { j - 1 } \right] + U _ { r } ^ { \prime } \mathbf { s } _ { j - 1 } ) } \\ { \mathbf { o } _ { j } ^ { \prime } = \sigma ( W _ { o } ^ { \prime } E \left[ \mathbf { y } _ { j - 1 } \right] + U _ { o } ^ { \prime } \mathbf { s } _ { j - 1 } ) } \end{array}
305
+ $$
306
+
307
+ where $E \in \mathbb { R } ^ { d _ { e m b } \times d _ { t } }$ signifies the target word embedding, $\underline { { \mathbf { s } } } _ { j } ^ { \prime } \in \mathbb { R } ^ { d _ { h } }$ denotes the hidden state, $\mathbf { r } _ { j } ^ { \prime } \in \mathbb { R } ^ { d _ { h } }$ and ${ \bf o } _ { j } ^ { \prime } \in \mathbb { R } ^ { d _ { h } }$ respectively represent the reset and update gate activations. $d _ { t }$ stands for the dimension of target; the unique number of target words. $[ W ^ { \prime } , W _ { r } ^ { \prime } , W _ { o } ^ { \prime } ] \in \mathbb { R } ^ { d _ { h } \times d _ { e m b } } , [ U ^ { \prime } , U _ { r } ^ { \prime } , U _ { o } ^ { \prime } ] \in$ $\mathbb { R } ^ { d _ { h } \times d _ { h } }$ are the parameters to be learned.
308
+
309
+ Context vector $\mathbf { c } _ { j }$ is obtained as
310
+
311
+ $$
312
+ \begin{array} { r } { \mathbf { c } _ { j } = \operatorname { t a n h } \left( \displaystyle \sum _ { i = 1 } ^ { T _ { f } } \alpha _ { i j } \mathbf { h } _ { i } \right) } \\ { \displaystyle \alpha _ { i j } = \frac { \exp \left( \mathbf { e } _ { i j } \right) } { \sum _ { k = 1 } ^ { T _ { f } } \exp \left( e _ { k j } \right) } } \\ { \mathbf { e } _ { i j } = U _ { a t t } \mathrm { t a n h } \big ( W _ { c a t t } \mathbf { h } _ { i } + W _ { a t t } \mathbf { s } _ { j } ^ { \prime } \big ) } \end{array}
313
+ $$
314
+
315
+ where $[ { U _ { a t t } } , { W _ { c a t t } } , { W _ { a t t } } ] \in \mathbb { R } ^ { d _ { h } \times d _ { h } }$ are the parameters to be learned.
316
+
317
+ The second GRU computes ${ \bf s } _ { j }$ from $\mathbf { s } _ { j } ^ { \prime } , \mathbf { c } _ { j }$ and ${ \bf h } _ { e } ^ { \prime }$ as
318
+
319
+ $$
320
+ \begin{array} { r } { \mathbf s _ { j } = ( 1 - \mathbf o _ { j } ^ { \prime } ) \odot \underline { { \mathbf s } } _ { j } + \mathbf o _ { j } \odot \mathbf s _ { j } ^ { \prime } } \\ { \underline { { \mathbf s } } _ { j } = \operatorname { t a n h } ( W \mathbf c _ { j } + \mathbf r _ { j } \odot ( U \mathbf s _ { j } ^ { \prime } ) + V \mathbf h _ { e } ^ { \prime } ) } \\ { \mathbf r _ { j } = \sigma ( W _ { r } \mathbf c _ { j } + U _ { r } \mathbf s _ { j } ^ { \prime } + V _ { r } \mathbf h _ { e } ^ { \prime } ) } \\ { \mathbf o _ { j } = \sigma ( W _ { o } \mathbf c _ { j } + U _ { o } \mathbf s _ { j } ^ { \prime } + V _ { o } \mathbf h _ { e } ^ { \prime } ) } \end{array}
321
+ $$
322
+
323
+ where $\underline { { \mathbf { s } } } _ { j } \in \mathbb { R } ^ { d _ { h } }$ stands for the hidden state, $\mathbf { r } _ { j } \in \mathbb { R } ^ { d _ { h } }$ and $\mathbf { o } _ { j } ~ \in ~ \mathbb { R } ^ { d _ { h } }$ are the reset and update gate activations. $[ W , W _ { r } , W _ { o } ] \ \in \ \mathbb { R } ^ { d _ { h } \times d _ { h } } , [ U , U _ { r } , U _ { o } ] \ \in \ \mathbb { R } ^ { d _ { h } \times d _ { h } } , [ V , V _ { r } , V _ { o } ] \ \in \ \mathbb { R } ^ { d _ { h } \times d _ { z } }$ are the
324
+
325
+ parameters to be learned. We introduce ${ \bf h } _ { e } ^ { \prime }$ obtained from a latent variable here so that a latent variable can affect the representation ${ \bf s } _ { j }$ through GRU units.
326
+
327
+ Finally, the probability of $y$ is computed as
328
+
329
+ $$
330
+ \begin{array} { r } { \mathbf { u } _ { j } = L _ { u } \mathrm { t a n h } ( E \left[ \mathbf { y } _ { j - 1 } \right] + L _ { s } \mathbf { s } _ { j } + L _ { x } \mathbf { c } _ { j } ) } \\ { P ( \mathbf { y } _ { j } | \mathbf { y } _ { j - 1 } , \mathbf { s } _ { j } , \mathbf { c } _ { j } ) = \mathrm { S o f t m a x } ( \mathbf { u } _ { j } ) } \end{array}
331
+ $$
332
+
333
+ where $L _ { u } \in \mathbb { R } ^ { d _ { t } \times d _ { e m b } }$ , $L _ { s } \in \mathbb { R } ^ { d _ { e m b } \times d _ { h } }$ and $L _ { c } \in \mathbb { R } ^ { d _ { e m b } \times d _ { h } }$ are the parameters to be learned.
334
+
335
+ # C TRAINING DETAIL
336
+
337
+ # C.1 HYPERPARAMETERS
338
+
339
+ Table 2 presents parameters that we use in the experiments.
340
+
341
+ Table 2: Hyperparameters. The name is the variable name of dl4mt except for dimv and dim pic, which are the dimension of the latent variables and image embeddings. We set dim (number of LSTM unit size) and dim word (dimensions of word embeddings) 256, batchsize 32, maxlen (max output length) 50 and $l r$ (learning rate) 1.0 for all models. decay- $c$ is weights on L2 regularization.
342
+
343
+ <table><tr><td colspan="2"></td><td>dimv</td><td>dim_pic</td><td>decay-c</td></tr><tr><td rowspan="3">Our Model</td><td>NMT</td><td>1</td><td>256</td><td>0.001</td></tr><tr><td>VNMT</td><td>256</td><td>256</td><td>0.0005</td></tr><tr><td>G G+O-AVG</td><td>256 256</td><td>512 256</td><td>0.001 0.0005</td></tr></table>
344
+
345
+ We found that Multi30k dataset is easy to overfit. Figure 8 and Figure 9 present training cost and validation METEOR score graph of the two experimental settings of the NMT model. Table 3 presents the hyperparameters which were used in the experiments. Large decay- $c$ ans small batchsize give the better METEOR scores in the end. Training is stopped if there is no validation cost improvements over the last 10 validations.
346
+
347
+ ![](images/c7bae09f36a43d6018ae579ac15c03de257556b8181a0a9f38fd44944c05724c.jpg)
348
+ Figure 8: NMT Training Cost
349
+
350
+ ![](images/4cf686d842327ec69a90e4b59544c93c4bbf7f5db98b7ef11c7a1a405e320bf0.jpg)
351
+ Figure 9: NMT Validation METEOR score
352
+
353
+ Table 3: Hyperparameters using the experiments in the Figure 8 and 9
354
+
355
+ <table><tr><td></td><td>dim</td><td>dim_word</td><td>lr</td><td>decay-c</td><td>maxlen</td><td>batchsie</td></tr><tr><td>1</td><td>256</td><td>256</td><td>1.0</td><td>0.0005</td><td>30</td><td>128</td></tr><tr><td>2</td><td>256</td><td>256</td><td>1.0</td><td>0.001</td><td>50</td><td>32</td></tr></table>
356
+
357
+ Figure 10 presents the English word length histogram of the Multi30k test dataset. Most sentences in the Multi30k are less than 20 words. We assume that this is one of the reasons why Multi30k is easy to overfit.
358
+
359
+ ![](images/2c9cbbbc325b95ee17810529bec3d8c10b1b4be16b57ee667ba3a6348e29d4a5.jpg)
360
+ Figure 10: Word Length Histogram of the Multi30k Test Dataset
361
+
362
+ # C.2 COST GRAPH
363
+
364
+ Figure 11 and 12 present the training cost and validation cost graph of each models. Please note that VNMT fine-tuned NMT, and other models fine-tuned VNMT.
365
+
366
+ ![](images/06cdb8130b72418e484bd88c7a72c3295a6dd43723f58361d1b6fc7254026797.jpg)
367
+ Figure 11: Training cost
368
+
369
+ # C.3 TRANSLATION EXAMPLES
370
+
371
+ We present some selected translations from VNMT and our proposed model (G). As of translation 3 to 5 our model give the better METEOR scores than VNMT and as of translation 6 to 8 VNMT give the better METEOR scores than our models.
372
+
373
+ ![](images/14471daa059b8d95974e504c430617cd19cc8a3ebbfa34c05662cdee40253162.jpg)
374
+ Figure 12: Validation cost
375
+
376
+ ![](images/acc29606458a5807494c450d7d98cfbf2019552dbf1817b3f5117cb49d155fc3.jpg)
377
+ Figure 13: Translation 3
378
+
379
+ <table><tr><td rowspan=1 colspan=1>Source</td><td rowspan=1 colspan=1> two boys inside a fence jump in the air while holding a basketball.</td></tr><tr><td rowspan=1 colspan=1>Truth</td><td rowspan=1 colspan=1> zwei jungen innerhalb eines zaunes springen in die luft und halten dabei einen basketball.</td></tr><tr><td rowspan=1 colspan=1>VNMT</td><td rowspan=1 colspan=1> zwei jungen in einem zaun springen in die luft, wahrend sie einen basketball hält.</td></tr><tr><td rowspan=1 colspan=1>Our Model (G)</td><td rowspan=1 colspan=1> zwei jungen in einem zaun springen in die luft und halten dabei einen basketball.</td></tr></table>
380
+
381
+ ![](images/23012d4624eca34e1c303667d6e14ec10c97268f0b4680d616f88c774e11979f.jpg)
382
+
383
+ ![](images/40438e3127b0e3dfabe5ef181edd81e6a9767fc1c201406ec2d489eec5be4b9a.jpg)
384
+ Figure 14: Translation 4
385
+
386
+ ![](images/3899a0a8465e2ce98deaee871de5b2b920dce614f48ba85d244452b665f39c4a.jpg)
387
+
388
+ ![](images/e7151f581c4957dd2df8001ca4e255d512e80383a168a778786ef6cf7af980b9.jpg)
389
+ Figure 15: Translation 5
390
+
391
+ ![](images/d411a02e14a3e6d08312a40b1f51766c1fe322869b0edcd0e47bc3d2e6bd81c1.jpg)
392
+
393
+ ![](images/bb605f8c5f246dc01410e5a4789cf874f02fe60269a8ccfae2a0e74f7144f6b4.jpg)
394
+ Figure 16: Translation 6
395
+
396
+ ![](images/401402a8fe1a4881873fd8a84766e65eef1b866c373de7db920db7592bf11743.jpg)
397
+
398
+ ![](images/8be7ff761f48d12a81eaaa70bf4c62d437638b12f62d9d8cd9b8e52448d94dc3.jpg)
399
+ Figure 17: Translation 7
400
+
401
+ ![](images/f4a6e36a04bba32d9bb47b3aaf084fd5b564ef6b93f245a779d068b254459b67.jpg)
402
+
403
+ ![](images/a9260f0f6290f1c96ecbfc79ab0478644bff0af1a4a394761f746d36cd74f6ab.jpg)
404
+ Figure 18: Translation 8
md/train/B1YfAfcgl/B1YfAfcgl.md ADDED
@@ -0,0 +1,468 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ENTROPY-SGD: BIASING GRADIENT DESCENT INTO WIDE VALLEYS
2
+
3
+ Pratik Chaudhari1, Anna Choromanska2, Stefano Soatto1, Yann LeCun3,4, Carlo Baldassi5, Christian Borgs6, Jennifer Chayes6, Levent Sagun3, Riccardo Zecchina5
4
+
5
+ 1 Computer Science Department, University of California, Los Angeles
6
+ 2 Department of Electrical and Computer Engineering, New York University
7
+ 3 Courant Institute of Mathematical Sciences, New York University
8
+ 4 Facebook AI Research, New York
9
+ 5 Dipartimento di Scienza Applicata e Tecnologia, Politecnico di Torino
10
+ 6 Microsoft Research New England, Cambridge
11
+
12
+ Email: pratikac $@$ ucla.edu, $\operatorname { a c } 5 4 5 5 @$ nyu.edu, soatto $@$ ucla.edu, yann $@$ cs.nyu.edu, carlo.baldassi $@$ polito.it, borgs $@$ microsoft.com, jchayes $@$ microsoft.com, sagun@cims.nyu.edu, riccardo.zecchina $@$ polito.it
13
+
14
+ # ABSTRACT
15
+
16
+ This paper proposes a new optimization algorithm called Entropy-SGD for training deep neural networks that is motivated by the local geometry of the energy landscape. Local extrema with low generalization error have a large proportion of almost-zero eigenvalues in the Hessian with very few positive or negative eigenvalues. We leverage upon this observation to construct a local-entropy-based objective function that favors well-generalizable solutions lying in large flat regions of the energy landscape, while avoiding poorly-generalizable solutions located in the sharp valleys. Conceptually, our algorithm resembles two nested loops of SGD where we use Langevin dynamics in the inner loop to compute the gradient of the local entropy before each update of the weights. We show that the new objective has a smoother energy landscape and show improved generalization over SGD using uniform stability, under certain assumptions. Our experiments on convolutional and recurrent neural networks demonstrate that Entropy-SGD compares favorably to state-of-the-art techniques in terms of generalization error and training time.
17
+
18
+ # 1 INTRODUCTION
19
+
20
+ This paper presents a new optimization tool for deep learning designed to exploit the local geometric properties of the objective function. Consider the histogram we obtained in Fig. 1 showing the spectrum of the Hessian at an extremum discovered by Adam (Kingma & Ba, 2014) for a convolutional neural network on MNIST (LeCun et al., 1998) $( \approx 4 7 , 0 0 0$ weights, cf. Sec. 5.1). It is evident that:
21
+
22
+ (i) a large number of directions $( \approx 9 4 \%$ ) have near-zero eigenvalues (magnitude less than $1 0 ^ { - 4 }$ ), (ii) positive eigenvalues (right inset) have a long tail with the largest one being almost 40, (iii) negative eigenvalues (left inset), which are directions of descent that the optimizer missed, have a much faster decay (the largest negative eigenvalue is only $- 0 . 4 6 )$ .
23
+
24
+ Interestingly, this trend is not unique to this particular network. Rather, its qualitative properties are shared across a variety of network architectures, network sizes, datasets or optimization algorithms (refer to Sec. 5 for more experiments). Local minima that generalize well and are discovered by gradient descent lie in “wide valleys” of the energy landscape, rather than in sharp, isolated minima. For an intuitive understanding of this phenomenon, imagine a Bayesian prior concentrated at the minimizer of the expected loss, the marginal likelihood of wide valleys under this prior is much higher than narrow, sharp valleys even if the latter are close to the global minimum in training loss. Almost-flat regions of the energy landscape are robust to data perturbations, noise in the activations, as well as perturbations of the parameters, all of which are widely-used techniques to achieve good generalization. This suggests that wide valleys should result in better generalization and, indeed, standard optimization algorithms in deep learning seem to discover exactly that — without being explicitly tailored to do so. For another recent analysis of the Hessian, see the parallel work of Sagun et al. (2016).
25
+
26
+ ![](images/fe6f472c542ef09360b26afca748671709746b760967305acfe6f04eaaa0004e.jpg)
27
+ small-LeNet: Eigenspectrum of the Hessian at local minimum
28
+ Eigenvalues
29
+ Figure 1: Eigenspectrum of the Hessian at a local minimum of a CNN on MNIST (two independent runs). Remark: The central plot shows the eigenvalues in a small neighborhood of zero whereas the left and right insets show the entire tails of the eigenspectrum.
30
+
31
+ Based on this understanding of how the local geometry looks at the end of optimization, can we modify SGD to actively seek such regions? Motivated by the work of Baldassi et al. (2015) on shallow networks, instead of minimizing the original loss $f ( x )$ , we propose to maximize
32
+
33
+ $$
34
+ F ( x , \gamma ) = \log \int _ { x ^ { \prime } \in { \mathbb { R } ^ { n } } } \exp \left( - f ( x ^ { \prime } ) - \frac { \gamma } { 2 } \left\| x - x ^ { \prime } \right\| _ { 2 } ^ { 2 } \right) d x ^ { \prime } .
35
+ $$
36
+
37
+ The above is a log-partition function that measures both the depth of a valley at a location $x \in$ $\mathbb { R } ^ { n }$ , and its flatness through the entropy of $f ( x ^ { \prime } )$ ; we call it “local entropy” in analogy to the free entropy used in statistical physics. The Entropy-SGD algorithm presented in this paper employs stochastic gradient Langevin dynamics (SGLD) to approximate the gradient of local entropy. Our algorithm resembles two nested loops of SGD: the inner loop consists of SGLD iterations while the outer loop updates the parameters. We show that the above modified loss function results in a smoother energy landscape defined by the hyper-parameter $\gamma$ which we can think of as a “scope” that seeks out valleys of specific widths. Actively biasing the optimization towards wide valleys in the energy landscape results in better generalization error. We present experimental results on fullyconnected and convolutional neural networks (CNNs) on the MNIST and CIFAR-10 (Krizhevsky, 2009) datasets and recurrent neural networks (RNNs) on the Penn Tree Bank dataset (PTB) (Marcus et al., 1993) and character-level text prediction. Our experiments show that Entropy-SGD scales to deep networks used in practice, obtains comparable generalization error as competitive baselines and also trains much more quickly than SGD (we get a $2 \mathbf { x }$ speed-up over SGD on RNNs).
38
+
39
+ # 2 RELATED WORK
40
+
41
+ Our above observation about the spectrum of Hessian (further discussed in Sec. 5) is similar to results on a perceptron model in Dauphin et al. (2014) where the authors connect the loss function of a deep network to a high-dimensional Gaussian random field. They also relate to earlier studies such as Baldi & Hornik (1989); Fyodorov & Williams (2007); Bray & Dean (2007) which show that critical points with high training error are exponentially likely to be saddle points with many negative directions and all local minima are likely to have error that is very close to that of the global minimum. The authors also argue that convergence of gradient descent is affected by the proliferation of saddle points surrounded by high error plateaus — as opposed to multiple local minima. One can also see this via an application of Kramer’s law: the time spent by diffusion is inversely proportional to the smallest negative eigenvalue of the Hessian at a saddle point (Bovier & den Hollander, 2006).
42
+
43
+ The existence of multiple — almost equivalent — local minima in deep networks has been predicted using a wide variety of theoretical analyses and empirical observations, e.g., papers such as Choromanska et al. (2015a;b); Chaudhari & Soatto (2015) that build upon results from statistical physics as also others such as Haeffele & Vidal (2015) and Janzamin et al. (2015) that obtain similar results for matrix and tensor factorization problems. Although assumptions in these works are somewhat unrealistic in the context of deep networks used in practice, similar results are also true for linear networks which afford a more thorough analytical treatment (Saxe et al., 2014). For instance, Soudry & Carmon (2016) show that with mild over-parameterization and dropout-like noise, training error for a neural network with one hidden layer and piece-wise linear activation is zero at every local minimum. All these results suggest that the energy landscape of deep neural networks should be easy to optimize and they more or less hold in practice — it is easy to optimize a prototypical deep network to near-zero loss on the training set (Hardt et al., 2015; Goodfellow & Vinyals, 2015).
44
+
45
+ Obtaining good generalization error, however, is challenging: complex architectures are sensitive to initial conditions and learning rates (Sutskever et al., 2013) and even linear networks (Kawaguchi, 2016) may have degenerate and hard to escape saddle points (Ge et al., 2015; Anandkumar & Ge, 2016). Techniques such as adaptive (Duchi et al., 2011) and annealed learning rates, momentum (Tieleman & Hinton, 2012), as well as architectural modifications like dropout (Srivastava et al., 2014), batch-normalization (Ioffe & Szegedy, 2015; Cooijmans et al., 2016), weight scaling (Salimans & Kingma, 2016) etc. are different ways of tackling this issue by making the underlying landscape more amenable to first-order algorithms. However, the training process often requires a combination of such techniques and it is unclear beforehand to what extent each one of them helps.
46
+
47
+ Closer to the subject of this paper are results by Baldassi et al. (2015; 2016a;b) who show that the energy landscape of shallow networks with discrete weights is characterized by an exponential number of isolated minima and few very dense regions with lots of local minima close to each other. These dense local minima can be shown to generalize well for random input data; more importantly, they are also accessible by efficient algorithms using a novel measure called “robust ensemble” that amplifies the weight of such dense regions. The authors use belief propagation to estimate local entropy for simpler models such as committee machines considered there. A related work in this context is EASGD (Zhang et al., 2015) which trains multiple deep networks in parallel and modulates the distance of each worker from the ensemble average. Such an ensemble training procedure enables improved generalization by ensuring that different workers land in the same wide valley and indeed, it turns out to be closely related to the replica theoretic analysis of Baldassi et al. (2016a).
48
+
49
+ Our work generalizes the local entropy approach above to modern deep networks with continuous weights. It exploits the same phenomenon of wide valleys in the energy landscape but does so without incurring the hardware and communication complexity of replicated training or being limited to models where one can estimate local entropy using belief propagation. The enabling technique in our case is using Langevin dynamics for estimating the gradient of local entropy, which can be done efficiently even for large deep networks using mini-batch updates.
50
+
51
+ Motivated by the same final goal, viz. flat local minima, the authors in Hochreiter & Schmidhuber (1997b) introduce hard constraints on the training loss and the width of local minima and show using the Gibbs formalism (Haussler & Opper, 1997) that this leads to improved generalization. As the authors discuss, the effect of hyper-parameters for the constraints is intricately tied together and they are difficult to choose even for small problems. Our local entropy based objective instead naturally balances the energetic term (training loss) and the entropic term (width of the valley). The role of γ is clear as a focusing parameter (cf. Sec. 4.3) and effectively exploiting this provides significant computational advantages. Among other conceptual similarities with our work, let us note that local entropy in a flat valley is a direct measure of the width of the valley which is similar to their usage of Hessian, while the Gibbs variant to averaging in weight space (Eqn. 33 of Hochreiter & Schmidhuber (1997b)) is similar to our Eqn. (7). Indeed, Gibbs formalism used in their analysis is a very promising direction to understanding generalization in deep networks (Zhang et al., 2016).
52
+
53
+ Homotopy continuation methods convolve the loss function to solve sequentially refined optimization problems (Allgower & Georg, 2012; Mobahi & Fisher III, 2015), similarly, methods that perturb the weights or activations to average the gradient (Gulcehre et al., 2016) do so with an aim to smooth the rugged energy landscape. Such smoothing is however very different from local entropy. For instance, the latter places more weight on wide local minima even if they are much shallower than the global minimum (cf. Fig. 2); this effect cannot be obtained by smoothing. In fact, smoothing can introduce an artificial minimum between two nearby sharp valleys which is detrimental to generalization. In order to be effective, continuation techniques also require that minimizers of successively smaller convolutions of the loss function lie close to each other (Hazan et al., 2016); it is not clear whether this is true for deep networks. Local entropy, on the other hand, exploits wide minima which have been shown to exist in a variety of learning problems (Monasson & Zecchina, 1995; Cocco et al., 1996). Please refer to Appendix C for a more elaborate discussion as well as possible connections to stochastic variational inference (Blei et al., 2016).
54
+
55
+ # 3 LOCAL ENTROPY
56
+
57
+ We first provide a simple intuition for the concept of local entropy of an energy landscape. The discussion in this section builds upon the results of Baldassi et al. (2016a) and extends it for the case of continuous variables. Consider a cartoon energy landscape in Fig. 2 where the $\mathbf { X }$ -axis denotes the configuration space of the parameters. We have constructed two local minima: a shallower although wider one at $x _ { \mathrm { r o b u s t } }$ and a very sharp global minimum at xnon robust. Under a Bayesian prior on the parameters, say a Gaussian of a fixed variance at locations $x _ { \mathrm { r o b u s t } }$ and $x _ { \mathrm { n o n - r o b u s t } }$ respectively, the wider local minimum has a higher marginalized likelihood than the sharp valley on the right.
58
+
59
+ The above discussion suggests that parameters that lie in wider local minima like $x _ { \mathrm { r o b u s t } }$ , which may possibly have a higher loss than the global minimum, should generalize better than the ones that are simply at the global minimum. In a neighborhood of $x _ { \mathrm { r o b u s t } }$ , “local entropy” as introduced in Sec. 1 is large because it includes the contributions from a large region of good parameters; conversely, near $x _ { \mathrm { n o n - r o b u s t } }$ , there are fewer such contributions and the resulting local entropy is low. The local entropy thus provides a way of picking large, approximately flat, regions of the landscape over sharp, narrow valleys in spite of the latter possibly having a lower loss. Quite conveniently, the local entropy is also computed from the partition function with a local re-weighting term.
60
+
61
+ Formally, for a parameter vector $x \in \mathbb { R } ^ { n }$ , consider a Gibbs distribution corresponding to a given energy landscape $f ( x )$ :
62
+
63
+ ![](images/f9080b5c33ff0c459ae76b79b64ba2c0a37369c205de046f172d7251db689ca8.jpg)
64
+ Figure 2: Local entropy concentrates on wide valleys in the energy landscape.
65
+
66
+ $$
67
+ \mathrm { P } ( x ; \beta ) = Z _ { \beta } ^ { - 1 } \ \mathrm { e x p } \ ( - \beta \ f ( x ) ) ;
68
+ $$
69
+
70
+ where $\beta$ is known as the inverse temperature and $Z _ { \beta }$ is a normalizing constant, also known as the partition function. As $\beta \to \infty$ , the probability distribution above concentrates on the global minimum of $f ( x )$ (assuming it is unique) given as:
71
+
72
+ $$
73
+ x ^ { * } = \underset { x } { \operatorname { a r g m i n } } \ f ( x ) ,
74
+ $$
75
+
76
+ which establishes the link between the Gibbs distribution and a generic optimization problem (2). We would instead like the probability distribution — and therefore the underlying optimization problem — to focus on flat regions such as $x _ { \mathrm { r o b u s t } }$ in Fig. 2. With this in mind, let us construct a modified Gibbs distribution:
77
+
78
+ $$
79
+ \mathbf { P } ( x ^ { \prime } ; x , \beta , \gamma ) = Z _ { x , \beta , \gamma } ^ { - 1 } \exp \left( - \beta f ( x ^ { \prime } ) - \beta \frac { \gamma } { 2 } \| x - x ^ { \prime } \| _ { 2 } ^ { 2 } \right) .
80
+ $$
81
+
82
+ The distribution in (3) is a function of a dummy variable $x ^ { \prime }$ and is parameterized by the original location $x$ . The parameter $\gamma$ biases the modified distribution (3) towards $x$ ; a large $\gamma$ results in a
83
+
84
+ $P ( x ^ { \prime } ; x , \beta , \gamma )$ with all its mass near $x$ irrespective of the energy term $f ( x ^ { \prime } )$ . For small values of $\gamma _ { : }$ , the term $f ( x ^ { \prime } )$ in the exponent dominates and the modified distribution is similar to the original Gibbs distribution in (1). We will set the inverse temperature $\beta$ to 1 because $\gamma$ affords us similar control on the Gibbs distribution.
85
+
86
+ Definition 1 (Local entropy). The local free entropy of the Gibbs distribution in (1), colloquially called “local entropy” in the sequel and denoted by $F ( x , \gamma )$ , is defined as the log-partition function of modified Gibbs distribution (3), i.e.,
87
+
88
+ $$
89
+ \begin{array} { l } { \displaystyle { F ( x , \gamma ) = \log Z _ { x , 1 , \gamma } } } \\ { \displaystyle { \phantom { \sum _ { i } \log Z _ { x , 1 } \exp Z _ { x } } = \log \int _ { x ^ { \prime } } \exp \left( - f ( x ^ { \prime } ) - \frac { \gamma } { 2 } \ : \| x - x ^ { \prime } \| _ { 2 } ^ { 2 } \right) d x ^ { \prime } } . } \end{array}
90
+ $$
91
+
92
+ The parameter $\gamma$ is used to focus the modified Gibbs distribution upon a local neighborhood of $x$ and we call it a “scope” henceforth.
93
+
94
+ Effect on the energy landscape: Fig. 2 shows the negative local entropy $- F ( x , \gamma )$ for two different values of $\gamma .$ . We expect $x _ { \mathrm { r o b u s t } }$ to be more robust than $x _ { \mathrm { { n o n } } }$ -robust to perturbations of data or parameters and thus generalize well and indeed, the negative local entropy in Fig. 2 has a global minimum near $x _ { \mathrm { r o b u s t } }$ . For low values of $\gamma ,$ , the energy landscape is significantly smoother than the original landscape and still maintains our desired characteristic, viz. global minimum at a wide valley. As $\gamma$ increases, the local entropy energy landscape gets closer to the original energy landscape and they become equivalent at $\gamma \to \infty$ . On the other hand, for very small values of $\gamma ,$ the local entropy energy landscape is almost uniform.
95
+
96
+ Connection to classical entropy: The quantity we have defined as local entropy in Def. 1 is different from classical entropy which counts the number of likely configurations under a given distribution. For a continuous parameter space, this is given by
97
+
98
+ $$
99
+ S ( x , \beta , \gamma ) = - \int _ { x ^ { \prime } } \log \mathrm { P } ( x ^ { \prime } ; x , \beta , \gamma ) d \mathrm { P } ( x ^ { \prime } ; x , \beta , \gamma )
100
+ $$
101
+
102
+ for the Gibbs distribution in (3). Minimizing classical entropy however does not differentiate between flat regions that have very high loss versus flat regions that lie deeper in the energy landscape. For instance in Fig. 2, classical entropy is smallest in the neighborhood of xcandidate which is a large region with very high loss on the training dataset and is unlikely to generalize well.
103
+
104
+ # 4 ENTROPY-GUIDED SGD
105
+
106
+ Simply speaking, our Entropy-SGD algorithm minimizes the negative local entropy from Sec. 3. This section discusses how the gradient of local entropy can be computed via Langevin dynamics. The reader will see that the resulting algorithm has a strong flavor of “SGD-inside-SGD”: the outer SGD updates the parameters, while an inner SGD estimates the gradient of local entropy.
107
+
108
+ Consider a typical classification setting, let $x \in \mathbb { R } ^ { n }$ be the weights of a deep neural network and $\xi _ { k } \in \Xi$ be samples from a dataset $\Xi$ of size $N$ . Let $f ( x ; \xi _ { k } )$ be the loss function, e.g., cross-entropy of the classifier on a sample $\xi _ { k }$ . The original optimization problem is:
109
+
110
+ $$
111
+ x ^ { * } = \underset { x } { \mathrm { a r g m i n } } \ \frac { 1 } { N } \ \sum _ { k = 1 } ^ { N } \ f ( x ; \ \xi _ { k } ) ;
112
+ $$
113
+
114
+ where the objective $f ( x , \xi _ { k } )$ is typically a non-convex function in both the weights $x$ and the samples $\xi _ { k }$ . The Entropy-SGD algorithm instead solves the problem
115
+
116
+ $$
117
+ x _ { \mathrm { E n t r o p y - S G D } } ^ { * } = \underset { x } { \mathrm { a r g m i n } } \ - F ( x , \gamma ; \ \Xi ) ;
118
+ $$
119
+
120
+ where we have made the dependence of local entropy $F ( x , \gamma )$ on the dataset $\Xi$ explicit.
121
+
122
+ The gradient of local entropy over a randomly sampled mini-batch of $m$ samples denoted by $\boldsymbol { \xi } _ { \ell _ { i } } \in \Xi ^ { \ell }$ for $i \leq m$ is easy to derive and is given by
123
+
124
+ $$
125
+ - \nabla _ { x } F \left( x , \gamma ; \Xi ^ { \ell } \right) = \gamma \left( x - \left. x ^ { \prime } ; \Xi ^ { \ell } \right. \right) ;
126
+ $$
127
+
128
+ where the notation $\langle \cdot \rangle$ denotes an expectation of its arguments (we have again made the dependence on the data explicit) over a Gibbs distribution of the original optimization problem modified to focus on the neighborhood of $x$ ; this is given by
129
+
130
+ $$
131
+ \mathrm { P } ( x ^ { \prime } ; x , \gamma ) \propto \exp \left[ - \left( \frac { 1 } { m } \sum _ { i = 1 } ^ { m } f \left( x ^ { \prime } ; \xi _ { \ell _ { i } } \right) \right) - \frac { \gamma } { 2 } \left. x - x ^ { \prime } \right. _ { 2 } ^ { 2 } \right] .
132
+ $$
133
+
134
+ Computationally, the gradient in (7) involves estimating $\left. x ^ { \prime } ; \Xi ^ { \ell } \right.$ with the current weights fixed to $x$ . This is an expectation over a Gibbs distribution and is hard to compute. We can however approximate it using Markov chain Monte-Carlo (MCMC) techniques. In this paper, we use stochastic gradient Langevin dynamics (SGLD) (Welling & Teh, 2011) that is an MCMC algorithm for drawing samples from a Bayesian posterior and scales to large datasets using mini-batch updates. Please see Appendix A for a brief overview of SGLD. For our application, as lines 3-6 of Alg. 1 show, SGLD resembles a few iterations of SGD with a forcing term $- \gamma ( x - x ^ { \prime } )$ and additive gradient noise.
135
+
136
+ We can obtain some intuition on how Entropy-SGD works using the expression for the gradient: the term $\langle x ^ { \prime } ; \cdot \rangle$ is the average over a locally focused Gibbs distribution and for two local minima in the neighborhood of $x$ roughly equivalent in loss, this term points towards the wider one because $\langle x ^ { \prime } ; \cdot \rangle$ is closer to it. This results in a net gradient that takes SGD towards wider valleys. Moreover, if we unroll the SGLD steps used to compute $\left( x - \langle { x ^ { \prime } ; \cdot } \rangle \right)$ (cf. line 5 in Alg. 1), it resembles one large step in the direction of the (noisy) average gradient around the current weights $x$ and Entropy-SGD thus looks similar to averaged SGD in the literature (Polyak & Juditsky, 1992; Bottou, 2012). These two phenomena intuitively explain the improved generalization performance of Entropy-SGD.
137
+
138
+ # 4.2 ALGORITHM AND IMPLEMENTATION DETAILS
139
+
140
+ Alg. 1 provides the pseudo-code for one iteration of the Entropy-SGD algorithm. At each iteration, lines 3-6 perform $L$ iterations of Langevin dynamics to estimate $\pmb { \mu } = \langle \bar { x } ^ { \prime } ; \Xi ^ { \ell } \rangle$ . The weights $x$ are updated with the modified gradient on line 7.
141
+
142
+ <table><tr><td colspan="2">Algorithm1: Entropy-SGD algorithm</td></tr><tr><td colspan="2">Input :current weights x,Langevin iterations L</td></tr><tr><td colspan="2">Hyper-parameters:scope γ,learning rate n,SGLD step size n&#x27;</td></tr><tr><td colspan="2"></td></tr><tr><td colspan="2">// SGLD iterations;</td></tr><tr><td colspan="2">1x,μ←x;</td></tr><tr><td colspan="2">2 forl≤Ldo El← sample mini-batch;</td></tr><tr><td>3</td><td></td></tr><tr><td>4</td><td>dx&#x27;←m∑m=Vxf(x²;5e)-γ (x-x);</td></tr><tr><td>5 6</td><td>x&#x27;← x&#x27;-n&#x27;dx&#x27;+√n&#x27;εN(0,1); μ←(1-α)μ+αx&#x27;;</td></tr><tr><td colspan="2"></td></tr><tr><td colspan="2">// Update weights; 7 x←x-nx(x-μ)</td></tr></table>
143
+
144
+ Let us now discuss a few implementation details. Although we have written Alg. 1 in the classical SGD setup, we can easily modify it to include techniques such as momentum and gradient preconditioning (Duchi et al., 2011) by changing lines 5 and 7. In our experiments, we have used SGD with Nesterov’s momentum (Sutskever et al., 2013) and Adam for outer and inner loops with similar qualitative results. We use exponential averaging to estimate $\mu$ in the SGLD loop (line 6)
145
+
146
+ with $\alpha = 0 . 7 5$ so as to put more weight on the later samples, this is akin to a burn-in in standard SGLD.
147
+
148
+ We set the number of SGLD iterations to $L = [ 5 , 2 0 ]$ depending upon the complexity of the dataset. The learning rate $\eta ^ { \prime }$ is fixed for all our experiments to values between $\eta ^ { \prime } \in \ [ 0 . 1 , 1 ]$ . We found that annealing $\eta ^ { \prime }$ (for instance, setting it to be the same as the outer learning rate $\eta$ ) is detrimental; indeed a small learning rate leads to poor estimates of local entropy towards the end of training where they are most needed. The parameter $\varepsilon$ in SGLD on line 5 is the thermal noise and we fix this to $\varepsilon \in [ 1 0 ^ { - 4 } , 1 0 ^ { - 3 } ]$ . Having thus fixed $L , \varepsilon$ and $\eta ^ { \prime }$ , an effective heuristic to tune the remaining parameter $\gamma$ is to match the magnitude of the gradient of the local entropy term, viz. $\gamma \left( x - \mu \right)$ , to the gradient for vanilla SGD, viz. $m ^ { - 1 } \sum _ { i = 1 } ^ { m } \bar { \nabla _ { x } } f ( x ; \xi _ { \ell _ { i } } )$ .
149
+
150
+ # 4.3 SCOPING OF γ
151
+
152
+ The scope $\gamma$ is fixed in Alg. 1. For large values of $\gamma ,$ the SGLD updates happen in a small neighborhood of the current parameters $x$ while low values of $\gamma$ allow the inner SGLD to explore further away from $x$ . In the context of the discussion in Sec. 3, a “reverse-annealing” of the scope $\gamma ,$ i.e. increasing γ as training progresses has the effect of exploring the energy landscape on progressively finer scales. We call this process “scoping” which is similar to that of Baldassi et al. (2016a) and use a simple exponential schedule given by
153
+
154
+ $$
155
+ \gamma ( t ) = \gamma _ { 0 } \ ( 1 + \gamma _ { 1 } ) ^ { t } ;
156
+ $$
157
+
158
+ for the $t ^ { \mathrm { { t h } } }$ parameter update. We have experimented with linear, quadratic and bounded exponential $( \gamma _ { 0 } \left( 1 - e ^ { - \tau t } \right) )$ ) scoping schedules and obtained qualitatively similar results.
159
+
160
+ Scoping of $\gamma$ unfortunately interferes with the learning rate annealing that is popular in deep learning, this is a direct consequence of the update step on line 7 of Alg. 1. In practice, we therefore scale down the local entropy gradient by $\gamma$ before the weight update and modify the line to read
161
+
162
+ $$
163
+ x x - \eta ( x - \mu ) .
164
+ $$
165
+
166
+ Our general strategy during hyper-parameter tuning is to set the initial scope $\%$ to be very small, pick a large value of $\eta$ and set $\gamma _ { 1 }$ to be such that the magnitude of the local entropy gradient is comparable to that of SGD. We can use much larger learning rates than SGD in our experiments because the local entropy gradient is less noisy than the original back-propagated gradient. This also enables very fast progress in the beginning with a smooth landscape of a small $\gamma$ .
167
+
168
+ # 4.4 THEORETICAL PROPERTIES
169
+
170
+ We can show that Entropy-SGD results in a smoother loss function and obtains better generalization error than the original objective (5). With some overload of notation, we assume that the original loss $f ( x )$ is $\beta$ -smooth, i.e., for all $x , y \in \mathbb { R } ^ { n }$ , we have $\| \nabla f ( x ) - \nabla f ( y ) \| \leq \beta \ \| x - y \|$ . We additionally assume for the purpose of analysis that no eigenvalue of the Hessian $\nabla ^ { 2 } f ( x )$ lies in the set $[ - 2 \gamma - c , c ]$ for some small $c > 0$ .
171
+
172
+ Lemma 2. The objective $F ( x , \gamma ; \Xi )$ in (6) is $\frac { \alpha } { 1 + \gamma ^ { - 1 } \ c }$ -Lipschitz and $\frac { \beta } { 1 + \gamma ^ { - 1 } ~ c }$ -smooth.
173
+
174
+ Please see Appendix B for the proof. The local entropy objective is thus smoother than the original objective. Let us now obtain a bound on the improvement in generalization error. We denote an optimization algorithm, viz., SGD or Entropy-SGD by $A ( \Xi )$ , it is a function of the dataset $\Xi$ and outputs the parameters $x ^ { * }$ upon termination. Stability of the algorithm (Bousquet & Elisseeff, 2002) is then a notion of how much its output differs in loss upon being presented with two datasets, Ξ and $\Xi ^ { \prime }$ , that differ in at most one sample:
175
+
176
+ $$
177
+ \operatorname* { s u p } _ { \xi \in \Xi \cup \Xi ^ { \prime } } \left[ f ( A ( \Xi ) , \xi ) - f \left( A ( \Xi ^ { \prime } ) , \xi \right) \right] \leq \varepsilon .
178
+ $$
179
+
180
+ Hardt et al. (2015) connect uniform stability to generalization error and show that an $\varepsilon$ -stable algorithm $A ( \Xi )$ has generalization error bounded by $\varepsilon$ , i.e., if $A ( \Xi )$ terminates with parameters $x ^ { * }$ ,
181
+
182
+ $$
183
+ | \mathbb { E } _ { \Xi } \left( R _ { \Xi } ( x ^ { * } ) - R ( x ^ { * } ) \right) | \le \varepsilon ;
184
+ $$
185
+
186
+ where the left hand side is the generalization error: it is the difference between the empirical loss $\begin{array} { r } { R _ { \Xi } ( x ) : = N ^ { - 1 } \sum _ { k = 1 } ^ { N } \ f ( x , \xi _ { k } ) } \end{array}$ and the population loss $R ( x ) : = \mathbb { E } _ { \xi } ~ f ( x , \xi )$ . We now employ the following theorem that bounds the stability of an optimization algorithm through the smoothness of its loss function and the number of iterations on the training set.
187
+
188
+ Theorem 3 (Hardt et al. (2015)). For an $\alpha$ -Lipschitz and $\beta$ -smooth loss function, if SGD converges in $T$ iterations on $N$ samples with decreasing learning rate $\eta _ { t } \leq 1 / t$ the stability is bounded by
189
+
190
+ $$
191
+ \varepsilon \stackrel { < } { \approx } \frac { 1 } { N } \alpha ^ { 1 / ( 1 + \beta ) } T ^ { 1 - 1 / ( 1 + \beta ) } .
192
+ $$
193
+
194
+ Using Lemma 2 and Theorem 3 we have
195
+
196
+ $$
197
+ \varepsilon _ { \mathrm { E n t r o p y - S G D } } \lesssim \left( \alpha T ^ { - 1 } \right) ^ { \left( 1 - \frac { 1 } { 1 + \gamma ^ { - 1 } c } \right) \beta } \varepsilon _ { \mathrm { S G D } } ,
198
+ $$
199
+
200
+ which shows that Entropy-SGD generalizes better than SGD for all $T > \alpha$ if they both converge after $T$ passes over the samples.
201
+
202
+ Let us note that while the number of passes over the dataset for Entropy-SGD and SGD are similar for our experiments on CNNs, Entropy-SGD makes only half as many passes as SGD for our experiments on RNNs. As an aside, it is easy to see from the proof of Lemma 2 that for a convex loss function $f ( x )$ , the local entropy objective does not change the minimizer of the original problem.
203
+
204
+ Remark 4. The above analysis hinges upon an assumption that the Hessian $\nabla ^ { 2 } f ( x )$ does not have eigenvalues in the set $[ - 2 \gamma - c , c ]$ for a constant $c > 0$ . This is admittedly unrealistic, for instance, the eigenspectrum of the Hessian at a local minimum in Fig. 1 has a large fraction of its eigenvalues almost zero. Let us however remark that the result in Thm. 3 by Hardt et al. (2015) assumes global conditions on the smoothness of the loss function; one imagines that Eqn. 9 remains qualitatively the same (with respect to $T$ in particular) even if this assumption is violated to an extent before convergence happens. Obtaining a rigorous generalization bound without this assumption would require a dynamical analysis of SGD and seems out of reach currently.
205
+
206
+ # 5 EXPERIMENTS
207
+
208
+ In Sec. 5.1, we discuss experiments that suggest that the characteristics of the energy landscape around local minimal accessible by SGD are universal to deep architectures. We then present experimental results on two standard image classification datasets, viz. MNIST and CIFAR-10 and two datasets for text prediction, viz. PTB and the text of War and Peace. Table 1 summarizes the results of these experiments on deep networks.
209
+
210
+ # 5.1 UNIVERSALITY OF THE HESSIAN AT LOCAL MINIMA
211
+
212
+ We use automatic differentiation1 to compute the Hessian at a local minimum obtained at the end of training for the following networks:
213
+
214
+ (i) small-LeNet on MNIST: This network has 47, 658 parameters and is similar to LeNet but with 10 and 20 channels respectively in the first two convolutional layers and 128 hidden units in the fully-connected layer. We train this with Adam to obtain a test error of $2 . 4 \%$ .
215
+ (ii) small-mnistfc on MNIST: A fully-connected network (50, 890 parameters) with one layer of 32 hidden units, ReLU non-linearities and cross-entropy loss; it converges to a test error of $2 . 5 \%$ with momentum-based SGD.
216
+ (iii) char-lstm for text generation: This is a recurrent network with 48 hidden units and Long Short-Term Memory (LSTM) architecture (Hochreiter & Schmidhuber, 1997a). It has 32, 640 parameters and we train it with Adam to re-generate a small piece of text consisting of 256 lines of length 32 each and 96-bit one-hot encoded characters.
217
+
218
+ (iv) All-CNN-BN on CIFAR-10: This is similar to the All-CNN-C network (Springenberg et al., 2014) with $\approx 1 . 6$ million weights (cf. Sec. 5.3) which we train using Adam to obtain an error of $1 1 . 2 \%$ . Exact Hessian computation is in this case expensive and thus we instead compute the diagonal of the Fisher information matrix (Wasserman, 2013) using the element-wise first and second moments of the gradients that Adam maintains, i.e., $\mathrm { d i a g } ( I ) = \mathbb { E } ( g ^ { 2 } ) - ( \mathbb { E } ~ g ) ^ { 2 }$ where $g$ is the back-propagated gradient. Fisher information measures the sensitivity of the log-likelihood of data given parameters in a neighborhood of a local minimum and thus is exactly equal to the Hessian of the negative log-likelihood. We will consider the diagonal of the empirical Fisher information matrix as a proxy for the eigenvalues of the Hessian, as is common in the literature.
219
+
220
+ We choose to compute the exact Hessian and to keep the computational and memory requirements manageable, the first three networks considered above are smaller than standard deep networks used in practice. For the last network, we sacrifice the exact computation and instead approximate the Hessian of a large deep network. We note that recovering an approximate Hessian from Hessianvector products (Pearlmutter, 1994) could be a viable strategy for large networks.
221
+
222
+ Fig. 1 in the introductory Sec. 1 shows the eigenspectrum of the Hessian for small-LeNet while Fig. 3 shows the eigenspectra for the other three networks. A large proportion of eigenvalues of the Hessian are very close to zero or positive with a very small (relative) magnitude. This suggests that the local geometry of the energy landscape is almost flat at local minima discovered by gradient descent. This agrees with theoretical results such as Baldassi et al. (2016c) where the authors predict that flat regions of the landscape generalize better. Standard regularizers in deep learning such as convolutions, max-pooling and dropout seem to bias SGD towards flatter regions in the energy landscape. Away from the origin, the right tails of the eigenspectra are much longer than the left tails. Indeed, as discussed in numerous places in literature (Bray & Dean, 2007; Dauphin et al., 2014; Choromanska et al., 2015a), SGD finds low-index critical points, i.e., optimizers with few negative eigenvalues of the Hessian. What is interesting and novel is that the directions of descent that SGD misses do not have a large curvature.
223
+
224
+ # 5.2 MNIST
225
+
226
+ We consider two prototypical networks: the first, called mnistfc, is a fully-connected network with two hidden layers of 1024 units each and the second is a convolutional neural network with the same size as LeNet but with batch-normalization (Ioffe & Szegedy, 2015); both use a dropout of probability 0.5 after each layer. As a baseline, we train for 100 epochs with Adam and a learning rate of $1 0 ^ { - 3 }$ that drops by a factor of 5 after every 30 epochs to obtain an average error of $1 . 3 9 \pm 0 . 0 3 \%$ and $0 . 5 1 \pm 0 . 0 1 \%$ for mnistfc and LeNet respectively, over 5 independent runs.
227
+
228
+ For both these networks, we train Entropy-SGD for 5 epochs with $L = 2 0$ and reduce the dropout probability (0.15 for mnistfc and 0.25 for LeNet). The learning rate of the SGLD updates is fixed to $\eta ^ { \prime } = 0 . 1$ while the outer loop’s learning rate is set to $\eta = 1$ and drops by a factor of 10 after the second epoch; we use Nesterov’s momentum for both loops. The thermal noise in SGLD updates (line 5 of Alg. 1) is set to $1 0 ^ { - 3 }$ . We use an exponentially increasing value of $\gamma$ for scoping, the initial value of the scope is set to $\gamma = 1 0 ^ { - 4 }$ and this increases by a factor of 1.001 after each parameter update. The results in Fig. 4a and Fig. 4b show that Entropy-SGD obtains a comparable generalization error: $1 . 3 7 \pm 0 . 0 3 \%$ and $0 . 5 0 \pm 0 . 0 1 \%$ , for mnistfc and LeNet respectively. While Entropy-SGD trains slightly faster in wall-clock time for LeNet; it is marginally slower for mnistfc which is a small network and trains in about two minutes anyway.
229
+
230
+ Remark on the computational complexity: Since Entropy-SGD runs $L$ steps of SGLD before each parameter update, the effective number of passes over the dataset is $L$ times that of SGD or Adam for the same number of parameter updates. We therefore plot the error curves of Entropy-SGD in Figs. 4, 5, and 6 against the “effective number of epochs”, i.e. by multiplying the abscissae by a factor of $L$ . (we define $L = 1$ for SGD or Adam). Modulo the time required for the actual parameter updates (which are fewer for Entropy-SGD), this is a direct measure of wall-clock time, agnostic to the underlying hardware and implementation.
231
+
232
+ char-lstm: Hessian eigenspectrum at local minimum (a) small-mnistfc (2 runs): Peak (clipped here) at zero $( | \lambda | \leq 1 0 ^ { - 2 } )$ accounts for $90 \%$ of the entries.
233
+
234
+ ![](images/336104945b2ccebddd4ac5db7ee5eb2d35a1c83e82765d6c182dc5a24f7bd6af.jpg)
235
+ Eigenvalues
236
+
237
+ ![](images/3ca7f5dcd4ecab6ad8e76a11626cd2899437ceee8e9af938df6da67976093a32.jpg)
238
+ Eigenvalues
239
+
240
+ (b) char-LSTM (5 runs): Almost $9 5 \%$ eigenvalues have absolute value below $1 0 ^ { - 5 }$ .
241
+
242
+ ![](images/a7f5a2dee37afd08233cfc30b8033d88abfc5efc20b2568c5fd8a33d1e6cbb44.jpg)
243
+ (c) Negative and positive eigenvalues of the Fisher information matrix of All-CNN-BN at a local minimum (4 independent runs). The origin has a large peak with $\approx 9 5 \%$ near-zero $( | \lambda | \leq 1 0 ^ { - 5 } )$ eigenvalues (clipped here).
244
+
245
+ Figure 3: Universality of the Hessian: for a wide variety of network architectures, sizes and datasets, optima obtained by SGD are mostly flat (large peak near zero), they always have a few directions with large positive curvature (long positive tails). A very small fraction of directions have negative curvature, and the magnitude of this curvature is extremely small (short negative tails).
246
+
247
+ ![](images/c5d0293acd789944f02d935e05d3ea8cc35794d3f246deaf7b1f263d3d3d8a2b.jpg)
248
+ Figure 4: Comparison of Entropy-SGD vs. Adam on MNIST
249
+
250
+ # 5.3 CIFAR-10
251
+
252
+ We train on CIFAR-10 without data augmentation after performing global contrast normalization and ZCA whitening (Goodfellow et al., 2013). We consider the All-CNN-C network of Springenberg et al. (2014) with the only difference that a batch normalization layer is added after each convolutional layer; all other architecture and hyper-parameters are kept the same. We train for 200 epochs with SGD and Nesterov’s momentum during which the initial learning rate of 0.1 decreases by a factor of 5 after every 60 epochs. We obtain an average error of $7 . 7 1 \pm 0 . 1 9 \%$ in 200 epochs vs. $9 . 0 8 \%$ error in 350 epochs that the authors in Springenberg et al. (2014) report and this is thus a very competitive baseline for this network. Let us note that the best result in the literature on non-augmented CIFAR-10 is the ELU-network by Clevert et al. (2015) with $6 . 5 5 \%$ test error.
253
+
254
+ We train Entropy-SGD with $L = 2 0$ for 10 epochs with the original dropout of 0.5. The initial learning rate of the outer loop is set to $\eta = 1$ and drops by a factor of 5 every 4 epochs, while the learning rate of the SGLD updates is fixed to $\eta ^ { \prime } = 0 . 1$ with thermal noise $\varepsilon = 1 0 ^ { - 4 }$ . As the scoping scheme, we set the initial value of the scope to $\gamma _ { 0 } = 0 . 0 3$ which increases by a factor of 1.001 after each parameter update. Fig. 5 shows the training and validation error curves for Entropy-SGD compared with SGD. It shows that local entropy performs as well as SGD on a large CNN; we obtain a validation error of $7 . 8 1 \pm 0 . 0 9 \%$ in about 160 effective epochs.
255
+
256
+ We see almost no plateauing of training loss or validation error for Entropy-SGD in Fig. 5a; this trait is shared across different networks and datasets in our experiments and is an indicator of the additional smoothness of the local entropy landscape coupled with a good scoping schedule for $\gamma .$
257
+
258
+ ![](images/ac3566167ec08871865ea227af1e776bc23d239d4cd1ed5fba2ec2eb18151904.jpg)
259
+ Figure 5: Comparison of Entropy-SGD vs. SGD on CIFAR-10
260
+
261
+ # 5.4 RECURRENT NEURAL NETWORKS
262
+
263
+ # 5.4.1 PENN TREE BANK
264
+
265
+ We train an LSTM network on the Penn Tree Bank (PTB) dataset for word-level text prediction. This dataset contains about one million words divided into a training set of about 930, 000 words, a validation set of 74, 000 words and 82, 000 words with a vocabulary of size 10, 000. Our network called PTB-LSTM consists of two layers with 1500 hidden units, each unrolled for 35 time steps; note that this is a large network with about 66 million weights. We recreated the training pipeline of Zaremba et al. (2014) for this network (SGD without momentum) and obtained a word perplexity of $8 1 . 4 3 \pm 0 . 2$ on the validation set and $7 8 . 6 \pm 0 . 2 6$ on the test set with this setup; these numbers closely match the results of the original authors.
266
+
267
+ We run Entropy-SGD on PTB-LSTM for 5 epochs with $L = 5$ , note that this results in only 25 effective epochs. We do not use scoping for this network and instead fix $\gamma = 1 0 ^ { - 3 }$ . The initial learning rate of the outer loop is $\eta = 1$ which reduces by a factor of 10 at each epoch after the third epoch. The SGLD learning rate is fixed to $\eta ^ { \prime } = 1$ with $\varepsilon = 1 0 ^ { - 4 }$ . We obtain a word perplexity of $8 0 . 1 1 6 \pm 0 . 0 6 9$ on the validation set and $7 7 . 6 5 6 \pm 0 . 1 7 1$ on the test set. As Fig. 6a shows, Entropy-SGD trains significantly faster than SGD (25 effective epochs vs. 55 epochs of SGD) and also achieves a slightly better generalization perplexity.
268
+
269
+ # 5.4.2 CHAR-LSTM ON WAR AND PEACE
270
+
271
+ Next, we train an LSTM to perform character-level text-prediction. As a dataset, following the experiments of Karpathy et al. (2015), we use the text of War and Peace by Leo Tolstoy which contains about 3 million characters divided into training $( 8 0 \% )$ , validation $( 1 0 \% )$ and test $( 1 0 \% )$ sets. We use an LSTM consisting of two layers of 128 hidden units unrolled for 50 time steps and a vocabulary of size 87. We train the baseline with Adam for 50 epochs with an initial learning rate of 0.002 that decays by a factor of 2 after every 5 epochs to obtain a validation perplexity of $1 . 2 2 4 \pm 0 . 0 0 8$ and a test perplexity of $1 . 2 2 6 \pm 0 . 0 1$ .
272
+
273
+ As noted in Sec. 4.2, we can easily wrap Alg. 1 inside other variants of SGD such as Adam; this involves simply substituting the local entropy gradient in place of the usual back-propagated gradient. For this experiment, we constructed Entropy-Adam which is equivalent to Adam with the local entropy gradient (which is computed via SGLD). We run Entropy-Adam for 5 epochs with $L = 5$ and a fixed $\gamma { = } 0 . 0 1$ with an initial learning rate of 0.01 that decreases by a factor of 2 at each epoch. Note that this again results in only 25 effective epochs, i.e. half as much wall-clock time as SGD or Adam. We obtain a validation perplexity of $1 . 2 1 3 \pm 0 . 0 0 7$ and a test perplexity of $1 . 2 1 7 { \pm } 0 . 0 0 5$ over 4 independent runs which is better than the baseline. Fig. 6b shows the error curves for this experiment.
274
+
275
+ ![](images/efaf369d187c7cde4890cecd6930a9f730ce4c1554e9e750a51f2550ef7f596c.jpg)
276
+ Figure 6: Comparison of Entropy-SGD vs. SGD / Adam on RNNs
277
+
278
+ Table 1: Experimental results: Entropy-SGD vs. SGD / Adam
279
+
280
+ <table><tr><td> Model</td><td>Entropy-SGD</td><td colspan="3"> SGD / Adam</td></tr><tr><td></td><td>Error(%)/PerplexityEpochs|Error(%)/PerplexityEpochs</td><td></td><td></td><td></td></tr><tr><td> mnistfc</td><td>1.37 ±0.03</td><td>120</td><td>1.39 ± 0.03</td><td>66</td></tr><tr><td>LeNet</td><td>0.5±0.01</td><td>80</td><td>0.51±0.01</td><td>100</td></tr><tr><td> All-CNN-BN</td><td>7.81±0.09</td><td>160</td><td>7.71±0.19</td><td>180</td></tr><tr><td>PTB-LSTM</td><td>77.656±0.171</td><td>25</td><td>78.6±0.26</td><td>55</td></tr><tr><td> char-LSTM</td><td>1.217 ± 0.005</td><td>25</td><td>1.226 ± 0.01</td><td>40</td></tr></table>
281
+
282
+ Tuning the momentum in Entropy-SGD was crucial to getting good results on RNNs. While the SGD baseline on PTB-LSTM does not use momentum (and in fact, does not train well with momentum) we used a momentum of 0.5 for Entropy-SGD. On the other hand, the baseline for char-LSTM was trained with Adam with $\beta _ { 1 } = 0 . 9$ $\lvert \beta _ { 1 }$ in Adam controls the moving average of the gradient) while we set $\beta _ { 1 } = 0 . 5$ for Entropy-Adam. In contrast to this observation about RNNs, all our experiments on CNNs used a momentum of 0.9. In order to investigate this difficulty, we monitored the angle between the local entropy gradient and the vanilla SGD gradient during training. This angle changes much more rapidly for RNNs than for CNNs which suggests a more rugged energy landscape for the former; local entropy gradient is highly uncorrelated with the SGD gradient in this case.
283
+
284
+ # 6 DISCUSSION
285
+
286
+ In our experiments, Entropy-SGD results in generalization error comparable to SGD, but always with lower cross-entropy loss on the training set. This suggests the following in the context of energy landscapes of deep networks. Roughly, wide valleys favored by Entropy-SGD are located deeper in the landscape with a lower empirical loss than local minima discovered by SGD where it presumably gets stuck. Such an interpretation is in contrast to theoretical models of deep networks (cf. Sec. 2) which predict multiple equivalent local minima with the same loss. Our work suggests that geometric properties of the energy landscape are crucial to generalize well and provides algorithmic approaches to exploit them. However, the literature lacks general results about the geometry of the loss functions of deep networks — convolutional neural networks in particular — and this is a promising direction for future work.
287
+
288
+ If we focus on the inner loop of the algorithm, SGLD updates compute the average gradient (with Langevin noise) in a neighborhood of the parameters while maintaining the Polyak average of the new parameters. Such an interpretation is very close to averaged SGD of Polyak & Juditsky (1992) and Bottou (2012) and worth further study. Our experiments show that while Entropy-SGD trains significantly faster than SGD for recurrent networks, it gets relatively minor gains in terms of wallclock time for CNNs. Estimating the gradient of local entropy cheaply with few SGLD iterations, or by using a smaller network to estimate it in a teacher-student framework (Balan et al., 2015) is another avenue for extensions to this work.
289
+
290
+ # 7 CONCLUSIONS
291
+
292
+ We introduced an algorithm named Entropy-SGD for optimization of deep networks. This was motivated from the observation that the energy landscape near a local minimum discovered by SGD is almost flat for a wide variety of deep networks irrespective of their architecture, input data or training methods. We connected this observation to the concept of local entropy which we used to bias the optimization towards flat regions that have low generalization error. Our experiments showed that Entropy-SGD is applicable to large convolutional and recurrent deep networks used in practice.
293
+
294
+ # 8 ACKNOWLEDGMENTS
295
+
296
+ This work was supported by ONR N00014-13-1-034, AFOSR F9550-15-1-0229 and ARO W911NF-15-1-0564/66731-CS.
297
+
298
+ # REFERENCES
299
+
300
+ E. L. Allgower and K. Georg. Numerical continuation methods: an introduction, volume 13. Springer, 2012.
301
+
302
+ A. Anandkumar and R. Ge. Efficient approaches for escaping higher order saddle points in non-convex optimization. arXiv:1602.05908, 2016.
303
+
304
+ A. Balan, V. Rathod, K. Murphy, and M. Welling. Bayesian dark knowledge. In NIPS, 2015.
305
+
306
+ C. Baldassi, C. Borgs, J. T. Chayes, A. Ingrosso, C. Lucibello, L. Saglietti, and R. Zecchina. Unreasonable effectiveness of learning neural networks: From accessible states and robust ensembles to basic algorithmic schemes. PNAS, 113(48):E7655–E7662, 2016a.
307
+ C. Baldassi, F. Gerace, C. Lucibello, L. Saglietti, and R. Zecchina. Learning may need only a few bits of synaptic precision. Physical Review E, 93(5):052313, 2016b.
308
+ C. Baldassi, A. Ingrosso, C. Lucibello, L. Saglietti, and R. Zecchina. Local entropy as a measure for sampling solutions in constraint satisfaction problems. Journal of Statistical Mechanics: Theory and Experiment, 2016(2):023301, 2016c.
309
+ C. Baldassi, A. Ingrosso, C. Lucibello, L. Saglietti, and R. Zecchina. Subdominant dense clusters allow for simple learning and high computational performance in neural networks with discrete synapses. Physical review letters, 115(12):128101, 2015.
310
+ P. Baldi and K. Hornik. Neural networks and principal component analysis: Learning from examples without local minima. Neural Networks, 2:53–58, 1989.
311
+ D. Blei, A. Kucukelbir, and J. McAuliffe. Variational inference: A review for statisticians. arXiv:1601.00670, 2016.
312
+ L. Bottou. Stochastic gradient descent tricks. In Neural Networks: Tricks of the Trade, pp. 421–436. Springer, 2012.
313
+ O. Bousquet and A. Elisseeff. Stability and generalization. JMLR, 2(Mar):499–526, 2002.
314
+ A. Bovier and F. den Hollander. Metastability: A potential theoretic approach. In International Congress of Mathematicians, volume 3, pp. 499–518, 2006.
315
+ A. Bray and D. Dean. The statistics of critical points of Gaussian fields on large-dimensional spaces. Physics Review Letter, 2007.
316
+ P. Chaudhari and S. Soatto. On the energy landscape of deep networks. arXiv:1511.06485, 2015.
317
+ C. Chen, D. Carlson, Z. Gan, C. Li, and L. Carin. Bridging the gap between stochastic gradient MCMC and stochastic optimization. arXiv:1512.07962, 2015.
318
+ T. Chen, E. Fox, and C. Guestrin. Stochastic Gradient Hamiltonian Monte Carlo. In ICML, 2014.
319
+ A. Choromanska, M. Henaff, M. Mathieu, G. Ben Arous, and Y. LeCun. The loss surfaces of multilayer networks. In AISTATS, 2015a.
320
+ A. Choromanska, Y. LeCun, and G. Ben Arous. Open problem: The landscape of the loss surfaces of multilayer networks. In COLT, 2015b.
321
+ D.-A. Clevert, T. Unterthiner, and S. Hochreiter. Fast and accurate deep network learning by exponential linear units (ELUs). arXiv:1511.07289, 2015.
322
+ S. Cocco, R. Monasson, and R. Zecchina. Analytical and numerical study of internal representations in multilayer neural networks with binary weights. Physical Review E, 54(1):717, 1996.
323
+ T. Cooijmans, N. Ballas, C. Laurent, and A. Courville. Recurrent batch normalization. arXiv:1603.09025, 2016.
324
+ Y. Dauphin, R. Pascanu, C. Gulcehre, K. Cho, S. Ganguli, and Y. Bengio. Identifying and attacking the saddle point problem in high-dimensional non-convex optimization. In NIPS, 2014.
325
+ N. Ding, Y. Fang, R. Babbush, C. Chen, R. D. Skeel, and H. Neven. Bayesian sampling using stochastic gradient thermostats. In NIPS, 2014.
326
+ J. Duchi, E. Hazan, and Y. Singer. Adaptive subgradient methods for online learning and stochastic optimization. JMLR, 12:2121–2159, 2011.
327
+ Y. Fyodorov and I. Williams. Replica symmetry breaking condition exposed by random matrix calculation of landscape complexity. Journal of Statistical Physics, 129(5-6),1081-1116, 2007.
328
+ Z. Gan, C. Li, C. Chen, Y. Pu, Q. Su, and L. Carin. Scalable Bayesian Learning of Recurrent Neural Networks for Language Modeling. arXiv:1611.08034, 2016.
329
+ R. Ge, F. Huang, C. Jin, and Y. Yuan. Escaping from saddle points — online stochastic gradient for tensor decomposition. In COLT, 2015.
330
+ I. Goodfellow and O. Vinyals. Qualitatively characterizing neural network optimization problems. In ICLR, 2015.
331
+ I. Goodfellow, D. Warde-Farley, M. Mirza, A. Courville, and Y. Bengio. Maxout networks. ICML, 2013.
332
+ C. Gulcehre, M. Moczulski, F. Visin, and Y. Bengio. Mollifying networks. arXiv:1608.04980, 2016.
333
+ B. Haeffele and R. Vidal. Global optimality in tensor factorization, deep learning, and beyond. arXiv:1506.07540, 2015.
334
+ M. Hardt, B. Recht, and Y. Singer. Train faster, generalize better: Stability of stochastic gradient descent. arXiv:1509.01240, 2015.
335
+ D. Haussler and M. Opper. Mutual information, metric entropy and cumulative relative entropy risk. The Annals of Statistics, 25(6):2451–2492, 1997.
336
+ E. Hazan, K. Levy, and S. Shalev-Shwartz. On graduated optimization for stochastic non-convex problems. In ICML, 2016.
337
+ S. Hochreiter and J. Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997a.
338
+ S. Hochreiter and J. Schmidhuber. Flat minima. Neural Computation, 9(1):1–42, 1997b.
339
+ S. Ioffe and C. Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv:1502.03167, 2015.
340
+ M. Janzamin, H. Sedghi, and A. Anandkumar. Beating the Perils of Non-Convexity: Guaranteed Training of Neural Networks using Tensor Methods. arXiv:1506.08473, 2015.
341
+ A. Karpathy, J. Johnson, and L. Fei-Fei. Visualizing and understanding recurrent networks. arXiv:1506.02078, 2015.
342
+ K. Kawaguchi. Deep learning without poor local minima. In NIPS, 2016.
343
+ D. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv:1412.6980, 2014.
344
+ A. Krizhevsky. Learning multiple layers of features from tiny images. Master’s thesis, Computer Science, University of Toronto, 2009.
345
+ Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
346
+ Y.-A. Ma, T. Chen, and E. Fox. A complete recipe for stochastic gradient MCMC. In NIPS, 2015.
347
+ S. Mandt, M. Hoffman, and D. Blei. A variational analysis of stochastic gradient algorithms. arXiv:1602.02666, 2016.
348
+ M. Marcus, M.-A. Marcinkiewicz, and B. Santorini. Building a large annotated corpus of English: The Penn Treebank. Computational linguistics, 19(2):313–330, 1993.
349
+ H. Mobahi. Training Recurrent Neural Networks by Diffusion. arXiv:1601.04114, 2016.
350
+ H. Mobahi and J. Fisher III. On the link between Gaussian homotopy continuation and convex envelopes. In Workshop on Energy Minimization Methods in CVPR, pp. 43–56. Springer, 2015.
351
+ R. Monasson and R. Zecchina. Weight space structure and internal representations: A direct approach to learning and generalization in multilayer neural networks. Physical review letters, 75(12):2432, 1995.
352
+ R. Neal. MCMC using Hamiltonian dynamics. Handbook of Markov Chain Monte Carlo, 2:113–162, 2011.
353
+ B. A. Pearlmutter. Fast exact multiplication by the hessian. Neural computation, 6(1):147–160, 1994.
354
+ B. Polyak and A. Juditsky. Acceleration of stochastic approximation by averaging. SIAM Journal on Control and Optimization, 30(4):838–855, 1992.
355
+ G. Roberts and O. Stramer. Langevin diffusions and Metropolis-Hastings algorithms. Methodology and computing in applied probability, 4(4):337–357, 2002.
356
+ L. Sagun, L. Bottou, and Y. LeCun. Singularity of the Hessian in Deep Learning. arXiv:1611:07476, 2016.
357
+ T. Salimans and D. Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. arXiv:1602.07868, 2016.
358
+ A. Saxe, J. McClelland, and S. Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. In ICLR, 2014.
359
+ D. Soudry and Y. Carmon. No bad local minima: Data independent training error guarantees for multilayer neural networks. arXiv:1605.08361, 2016.
360
+ J. Springenberg, A. Dosovitskiy, T. Brox, and M. Riedmiller. Striving for simplicity: The all convolutional net. arXiv:1412.6806, 2014.
361
+ N. Srivastava, G. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. JMLR, 15(1):1929–1958, 2014.
362
+ I. Sutskever, J. Martens, G. Dahl, and G. Hinton. On the importance of initialization and momentum in deep learning. In ICML, 2013.
363
+ T. Tieleman and G. Hinton. Lecture 6.5: RmsProp, Coursera: Neural networks for machine learning. Technical report, 2012.
364
+ L. Wasserman. All of statistics: A concise course in statistical inference. Springer, 2013.
365
+ M. Welling and Y. W. Teh. Bayesian learning via stochastic gradient Langevin dynamics. In ICML, 2011.
366
+ W. Zaremba, I. Sutskever, and O. Vinyals. Recurrent neural network regularization. arXiv:1409.2329, 2014.
367
+ C. Zhang, S. Bengio, M. Hardt, B. Recht, and O. Vinyals. Understanding deep learning requires rethinking generalization. arXiv:1611.03530, 2016.
368
+ S. Zhang, A. E. Choromanska, and Y. LeCun. Deep learning with elastic averaging SGD. In NIPS, 2015.
369
+
370
+ # A STOCHASTIC GRADIENT LANGEVIN DYNAMICS (SGLD)
371
+
372
+ Local entropy in Def. (1) is an expectation over the entire configuration space $x \in \mathbb { R } ^ { n }$ and is hard to compute; we can however approximate its gradient using Markov chain Monte-Carlo (MCMC) techniques. In this section, we briefly review stochastic gradient Langevin dynamics (Welling & Teh, 2011) that is an MCMC algorithm designed to draw samples from a Bayesian posterior and scales to large datasets using mini-batch updates.
373
+
374
+ For a parameter vector $x \in \mathbb { R } ^ { n }$ with a prior distribution $p ( x )$ and if the probability of generating a data item $\xi _ { k }$ given a model parameterized by $x$ is $p ( \xi _ { k } | x )$ , the posterior distribution of the parameters based on $N$ data items can be written as
375
+
376
+ $$
377
+ p \left( x | \xi _ { k \leq N } \right) \propto p ( x ) \prod _ { k = 1 } ^ { N } p \left( \xi _ { k } | x \right) .
378
+ $$
379
+
380
+ Langevin dynamics (Neal, 2011) injects Gaussian noise into maximum-a-posteriori (MAP) updates to prevent over-fitting the solution $x ^ { * }$ of the above equation. The updates can be written as
381
+
382
+ $$
383
+ \Delta x _ { t } = \frac { \eta } { 2 } \ \left( \nabla \log p ( x _ { t } ) + \sum _ { k = 1 } ^ { N } \nabla p ( \xi _ { k } | x _ { t } ) \right) + \sqrt { \eta } \ \varepsilon _ { t } ;
384
+ $$
385
+
386
+ where $\mathbf { \mathcal { E } } _ { t } \sim \mathrm { N } ( 0 , \varepsilon ^ { 2 } )$ is Gaussian noise and $\eta$ is the learning rate. In this form, Langevin dynamics faces two major hurdles for applications to large datasets. First, computing the gradient $\begin{array} { r l } { \sum _ { k = 1 } ^ { N } } & { { } \nabla p ( \xi _ { k } | x _ { t } ) } \end{array}$ over all samples for each update $\Delta x _ { t }$ becomes prohibitive. However, as Welling & Teh (2011) show, one can instead simply use the average gradient over $m$ data samples (mini-batch) as follows:
387
+
388
+ $$
389
+ \Delta x _ { t } = \frac { \eta _ { t } } { 2 } \left( \nabla \log p ( x _ { t } ) + \frac { N } { m } \sum _ { k = 1 } ^ { m } \nabla p ( \xi _ { k } | x _ { t } ) \right) + \sqrt { \eta _ { t } } \ \varepsilon _ { t } .
390
+ $$
391
+
392
+ Secondly, Langevin dynamics in (11) is the discrete-time approximation of a continuous-time stochastic differential equation (Mandt et al., 2016) thereby necessitating a Metropolis-Hastings (MH) rejection step (Roberts & Stramer, 2002) which again requires computing $p ( \xi _ { k } | x )$ over the entire dataset. However, if the learning rate $\eta _ { t } \to 0$ , we can also forgo the MH step (Chen et al., 2014). Welling & Teh (2011) also argue that the sequence of samples $x _ { t }$ generated by updating (12) converges to the correct posterior (10) and one can hence compute the statistics of any function $g ( x )$ of the parameters using these samples. Concretely, the posterior expectation $\mathbb { E } \left[ g ( x ) \right]$ is given by E [g(x)] ≈ ∑ts=1 ηt g(xt )t ; which is the average computed by weighing each sample by the corresponding learning rate in (12). In this paper, we will consider a uniform prior on the parameters $x$ and hence the first term in (12), viz., $\nabla { \log } p ( x _ { t } )$ vanishes.
393
+
394
+ Let us note that there is a variety of increasingly sophisticated MCMC algorithms applicable to our problem, e.g., Stochastic Gradient Hamiltonian Monte Carlo (SGHMC) by Chen et al. (2014) based on volume preserving flows in the “parameter-momentum” space, stochastic annealing thermostats (Santa) by Chen et al. (2015) etc. We can also employ these techniques, although we use SGLD for ease of implementation; the authors in Ma et al. (2015) provide an elaborate overview.
395
+
396
+ # B PROOFS
397
+
398
+ Proof of Lemma 2. The gradient $- \boldsymbol { \nabla } F ( \boldsymbol { x } )$ is computed in Sec. 4.1 to be γ $\left( x - \left. { x ^ { \prime } ; \Xi ^ { \ell } } \right. \right)$ . Consider the term
399
+
400
+ $$
401
+ \begin{array} { l } { { \displaystyle - \left. x ^ { \prime } ; x \right. = x - Z _ { x , \gamma } ^ { - 1 } \displaystyle \int _ { x } x ^ { \prime } e ^ { - f \left( x ^ { \prime } \right) - \frac { \gamma } { 2 } } \left. x - x ^ { \prime } \right. ^ { 2 } d x ^ { \prime } } } \\ { { \displaystyle \approx x - Z _ { x , \gamma } ^ { - 1 } \displaystyle \int _ { s } \left( x + s \right) e ^ { - f \left( x \right) - \nabla f \left( x \right) ^ { \top } s - \frac { 1 } { 2 } s ^ { \top } \left( \gamma + \nabla ^ { 2 } f \left( x \right) \right) s } d s } } \\ { { \displaystyle = x \left( 1 - Z _ { x , \gamma } ^ { - 1 } \displaystyle \int _ { s } e ^ { - f \left( x \right) - \nabla f \left( x \right) ^ { \top } s - \frac { 1 } { 2 } s ^ { \top } \left( \gamma + \nabla ^ { 2 } f \left( x \right) \right) s } d s \right) - Z _ { x , \gamma } ^ { - 1 } \displaystyle \int _ { s } s e ^ { - f \left( x \right) - \nabla f \left( x \right) ^ { \top } s - \frac { 1 } { 2 } s ^ { \top } \left( \gamma + \nabla ^ { 2 } f \left( x \right) \right) s } d s } } \\ { { \displaystyle = - Z _ { x , \gamma } ^ { - 1 } e ^ { - f \left( x \right) } \displaystyle \int _ { s } s e ^ { - \nabla f \left( x \right) ^ { \top } s - \frac { 1 } { 2 } s ^ { \top } \left( \gamma + \nabla ^ { 2 } f \left( x \right) \right) s } d s } . } \end{array}
402
+ $$
403
+
404
+ The above expression is the mean of a distribution $\propto e ^ { - \nabla f ( x ) ^ { \top } s - \frac { 1 } { 2 } ~ s ^ { \top } \left( \gamma + \nabla ^ { 2 } f ( x ) \right) s }$ . We can approximate it using the saddle point method as the value of $s$ that minimizes the exponent to get
405
+
406
+ $$
407
+ x - \left. x ^ { \prime } ; x \right. \approx \left( \nabla ^ { 2 } f ( x ) + \gamma I \right) ^ { - 1 } \nabla f ( x ) .
408
+ $$
409
+
410
+ Let us denote $A ( x ) : = \left( I + \gamma ^ { - 1 } \nabla ^ { 2 } f ( x ) \right) ^ { - 1 }$ . Plugging this into the condition for smoothness, we have
411
+
412
+ $$
413
+ \begin{array} { r l } & { \| \nabla F ( x , \gamma ) - \nabla F ( y , \gamma ) \| = \| A ( x ) \nabla f ( x ) - A ( y ) \nabla f ( y ) \| } \\ & { \qquad \le \left( \underset { x } { \operatorname* { s u p } } \| A ( x ) \| \right) \beta \| x - y \| . } \end{array}
414
+ $$
415
+
416
+ Unfortunately, we can only get a uniform bound if we assume that for a small constant $c > 0$ , no eigenvalue of $\nabla ^ { 2 } f ( x )$ lies in the set $[ - 2 \gamma - c , c ]$ . This gives
417
+
418
+ $$
419
+ \left( \operatorname* { s u p } _ { x } \left\| A ( x ) \right\| \right) \leq \frac { 1 } { 1 + \gamma ^ { - 1 } c } .
420
+ $$
421
+
422
+ This shows that a smaller value of $\gamma$ results in a smoother energy landscape, except at places with very flat directions. The Lipschitz constant also decreases by the same factor.
423
+
424
+ # C CONNECTION TO VARIATIONAL INFERENCE
425
+
426
+ The fundamental motivations of (stochastic) variational inference (SVI) and local entropy are similar: they both aim to generalize well by constructing a distribution on the weight space. In this section, we explore whether they are related and how one might reconcile the theoretical and algorithmic implications of the local entropy objective with that of SVI.
427
+
428
+ Let $\Xi$ denote the entire dataset, $z$ denote the weights of a deep neural network and $x$ be the parameters of a variational distribution $q _ { x } ( z )$ . The Evidence Lower Bound (ELBO) can be then be written as
429
+
430
+ $$
431
+ \log p ( \Xi ) \geq \mathbb { E } _ { z \sim q _ { x } ( z ) } \ [ \log p ( \Xi \mid z ) ] - \mathbf { K L } \left( q _ { x } ( z ) \mid \mid p ( z ) \right) ;
432
+ $$
433
+
434
+ where $p ( z )$ denotes a parameter-free prior on the weights and controls, through their KL-divergence, how well the posited posterior $q _ { x } ( z )$ fits the data. Stochastic variational inference involves maximizing the right hand side of the above equation with respect to $x$ after choosing a suitable prior $p ( z )$ and a family of distributions $q _ { x } ( z )$ . These choices are typically dictated by the ease of sampling $z \sim q _ { x } ( z )$ , e.g. a mean-field model where $q _ { x } ( z )$ factorizes over $z$ , and being able to compute the KL-divergence term, e.g. a mixture of Gaussians.
435
+
436
+ On the other hand, if we define the loss as the log-likelihood of data, viz. $f ( z ) : = - \log p ( \Xi | z )$ , we can write the logarithm of the local entropy in Eqn. (4) as
437
+
438
+ $$
439
+ \begin{array} { l } { \displaystyle \log F ( \boldsymbol { x } , \boldsymbol { \gamma } ) = \log \int _ { z \in \mathbb { R } ^ { n } } \exp \left[ - f ( z ; \Xi ) - \frac { \gamma } { 2 } \left. \boldsymbol { x } - \boldsymbol { z } \right. ^ { 2 } \right] d z , } \\ { \displaystyle \geq \int _ { z \in \mathbb { R } ^ { n } } \left[ \log p ( \Xi \mid z ) - \frac { \gamma } { 2 } \left. \boldsymbol { x } - \boldsymbol { z } \right. ^ { 2 } \right] d z ; } \end{array}
440
+ $$
441
+
442
+ by an application of Jensen’s inequality. It is thus clear that Eqn. (13) and (14) are very different in general and one cannot choose a prior, or a variational family, that makes them equivalent and interpret local entropy as ELBO.
443
+
444
+ Eschewing rigor, formally, if we modify Eqn. (13) to allow the prior $p ( z )$ to depend upon $x$ , we can see that the two lower bounds above are equivalent iff $q _ { x } ( z )$ belongs to a “flat variational family”, i.e. uniform distributions with $x$ as the mean and $\begin{array} { r } { p _ { x } ( z ) \propto \exp \left( - \frac { \gamma } { 2 } \parallel x - z \parallel ^ { 2 } \right) } \end{array}$ . We emphasize that the distribution $p _ { x } ( z )$ depends on the parameters $x$ themselves and is thus, not really a prior, or one that can be derived using the ELBO.
445
+
446
+ This “moving prior” is absent in variational inference and indeed, a crucial feature of the local entropy objective. The gradient of local entropy in Eqn. (7) clarifies this point:
447
+
448
+ $$
449
+ \nabla F ( x , \gamma ) = - \gamma ( x - \langle z ; \Xi \rangle ) = - \gamma \mathbb { E } _ { z } \sim _ { r ( z ; x ) } \ [ z ] ;
450
+ $$
451
+
452
+ where the distribution $r ( z ; x )$ is given by
453
+
454
+ $$
455
+ r ( z ; x ) \propto \ p ( \Xi \mid z ) \ \exp \left( - \frac \gamma 2 \ \| x - z \| ^ { 2 } \right) ;
456
+ $$
457
+
458
+ it thus contains a data likelihood term along with a prior that “moves” along with the current iterate $x$ .
459
+
460
+ Let us remark that methods in the deep learning literature that average the gradient through perturbations in the neighborhood of $x$ (Mobahi, 2016) or noisy activation functions (Gulcehre et al., 2016) can be interpreted as computing the data likelihood in ELBO (without the KL-term); such an averaging is thus different from local entropy.
461
+
462
+ # C.1 COMPARISON WITH SGLD
463
+
464
+ We use stochastic gradient Langevin dynamics (cf. Appendix A) to estimate the gradient of local entropy in Alg. 1. It is natural then, to ask the question whether vanilla SGLD performs as well as local entropy. To this end, we compare the performance of SGLD on two prototypical networks: LeNet on MNIST and All-CNN-BN on CIFAR-10. We follow the experiments in Welling & Teh (2011) and Chen et al. (2015) and set the learning rate schedule to be $\overline { { \eta / ( 1 + t ) } } ^ { b }$ where the initial learning rate $\eta$ and $b$ are hyper-parameters. We make sure that other architectural aspects (dropout, batch-normalization) and regularization (weight decay) are consistent with the experiments in Sec. 5.
465
+
466
+ After a hyper-parameter search, we obtained a test error on LeNet of $0 . 6 3 \pm 0 . 1 \%$ after 300 epochs and $9 . 8 9 \pm 0 . 1 1 \%$ on All-CNN-BN after 500 epochs. Even if one were to disregard the slow convergence of SGLD, its generalization error is much worse than our experimental results; we get $0 . 5 0 \pm 0 . 0 1 \%$ on LeNet and $7 . 8 1 \pm 0 . 0 9 \%$ on All-CNN-BN with Entropy-SGD. For comparison, the authors in Chen et al. (2015) report $0 . 7 1 \%$ error on MNIST on a slightly larger network. Our results with local entropy on RNNs are much better than those reported in Gan et al. (2016) for SGLD. On the PTB dataset, we obtain a test perplexity of $7 7 . 6 5 6 \pm 0 . 1 7 1$ vs. 94.03 for the same model whereas we obtain a test perplexity of $1 . 2 1 3 \pm 0 . 0 0 7$ vs. 1.3375 for char-LSTM on the War and Peace dataset.
467
+
468
+ Training deep networks with SGLD, or other more sophisticated MCMC algorithms such as SGHMC, SGNHT etc. (Chen et al., 2014; Neal, 2011) to errors similar to those of SGD is difficult, and the lack of such results in the literature corroborates our experimental experience. Roughly speaking, local entropy is so effective because it operates on a transformation of the energy landscape that exploits entropic effects. Conventional MCMC techniques such as SGLD or Nose’-Hoover thermostats (Ding et al., 2014) can only trade energy for entropy via the temperature parameter which does not allow the direct use of the geometric information of the energy landscape and does not help with narrow minima.
md/train/B1ae1lZRb/B1ae1lZRb.md ADDED
@@ -0,0 +1,292 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # APPRENTICE: USING KNOWLEDGE DISTILLATION TECHNIQUES TO IMPROVE LOW-PRECISION NETWORK ACCURACY
2
+
3
+ Asit Mishra & Debbie Marr
4
+ Accelerator Architecture Lab
5
+ Intel Labs
6
+ {asit.k.mishra,debbie.marr}@intel.com
7
+
8
+ # ABSTRACT
9
+
10
+ Deep learning networks have achieved state-of-the-art accuracies on computer vision workloads like image classification and object detection. The performant systems, however, typically involve big models with numerous parameters. Once trained, a challenging aspect for such top performing models is deployment on resource constrained inference systems — the models (often deep networks or wide networks or both) are compute and memory intensive. Low-precision numerics and model compression using knowledge distillation are popular techniques to lower both the compute requirements and memory footprint of these deployed models. In this paper, we study combination of these two techniques and show that the performance of low-precision networks can be significantly improved by using knowledge distillation techniques. Our approach, $\mathcal { A }$ pprentice, achieves state-of-the-art accuracies using ternary precision and 4-bit precision for variants of ResNet architecture on ImageNet dataset. We present three schemes using which one can apply knowledge distillation techniques to various stages of the train-and-deploy pipeline.
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ Background: Today’s high performing deep neural networks (DNNs) for computer vision applications comprise of multiple layers and involve numerous parameters. These networks have ${ \mathcal { O } } ( { \mathrm { G i g a - } }$ FLOPS) compute requirements and generate models which are $\mathcal { O }$ (Mega-Bytes) in storage (Canziani et al., 2016). Further, the memory and compute requirements during training and inference are quite different (Mishra et al., 2017). Training is performed on big datasets with large batch-sizes where memory footprint of activations dominates the model memory footprint. On the other hand, batchsize during inference is typically small and the model’s memory footprint dominates the runtime memory requirements.
15
+
16
+ Because of complexity in compute, memory and storage requirements, training phase of the networks is performed on CPU and/or GPU clusters in a distributed computing environment. Once trained, a challenging aspect is deployment of trained models on resource constrained inference systems such as portable devices or sensor networks, and for applications in which real-time predictions are required. Performing inference on edge-devices comes with severe constraints on memory, compute and power. Additionally, ensemble based methods, which one can potentially use to get improved accuracy predictions, become prohibitive in resource constrained systems.
17
+
18
+ Quantization using low-precision numerics (Vanhoucke et al., 2011; Zhou et al., 2016; Lin et al., 2015; Miyashita et al., 2016; Gupta et al., 2015; Zhu et al., 2016; Rastegari et al., 2016; Courbariaux et al., 2015; Umuroglu et al., 2016; Mishra et al., 2017) and model compression (Bucilua et al. ˇ , 2006; Hinton et al., 2015; Romero et al., 2014) have emerged as popular solutions for resource constrained deployment scenarios. With quantization, a low-precision version of network model is generated and deployed on the device. Operating in lower precision mode reduces compute as well as data movement and storage requirements. However, majority of existing works in low-precision DNNs sacrifice accuracy over baseline full-precision networks. With model compression, a smaller low memory footprint network is trained to mimic the behaviour of the original complex network. During this training, a process called, knowledge distillation is used to “transfer knowledge” from the complex network to the smaller network. Work by Hinton et al. (2015) shows that the knowledge distillation scheme can yield networks at comparable or slightly better accuracy than the original complex model. However, to the best of our knowledge, all prior works using model compression techniques target compression at full-precision.
19
+
20
+ Our proposal: In this paper, we study the combination of network quantization with model compression and show that accuracies of low-precision networks can be significantly improved by using knowledge distillation techniques. Previous studies on model compression use a large network as the teacher network and a small network as the student network. The small student network learns from teacher network using distillation process. The network architecture of the student network is typically different from that of the teacher network – for e.g. Hinton et al. (2015) investigate a student network that has fewer number of neurons in the hidden layers compared to the teacher network. In our work, the student network has similar topology as that of teacher network, except that the student network has low-precision neurons compared to the teacher network which has neurons operating at full-precision.
21
+
22
+ We call our approach Apprentice1 and study three schemes which produce low-precision networks using knowledge distillation techniques. Each of these three schemes produce state-of-the-art ternary precision and 4-bit precision models.
23
+
24
+ In the first scheme, a low-precision network and a full-precision network are jointly trained from scratch using knowledge distillation scheme. Later in the paper we describe the rationale behind this approach. Using this scheme, a new state-of-the-art accuracy is obtained for ternary and 4-bit precision for ResNet-18, ResNet-34 and ResNet-50 on ImageNet dataset. In fact, using this scheme the accuracy of the full-precision model also slightly improves. This scheme then serves as the new baseline for the other two schemes we investigate.
25
+
26
+ In the second scheme, we start with a full-precision trained network and transfer knowledge from this trained network continuously to train a low-precision network from scratch. We find that the low-precision network converges faster (albeit to similar accuracies as the first scheme) when a trained complex network guides its training.
27
+
28
+ In the third scheme, we start with a trained full-precision large network and an apprentice network that has been initialised with full-precision weights. The apprentice network’s precision is lowered and is fine-tuned using knowledge distillation techniques. We find that the low-precision network’s accuracy marginally improves and surpasses the accuracy obtained via the first scheme. This scheme then sets the new state-of-the-art accuracies for the ResNet models at ternary and 4-bit precision.
29
+
30
+ Overall, the contributions of this paper are the techniques to obtain low-precision DNNs using knowledge distillation technique. Each of our scheme produces a low-precision model that surpasses the accuracy of the equivalent low-precision model published to date. One of our schemes also helps a low-precision model converge faster. We envision these accurate low-precision models to simplify the inference deployment process on resource constrained systems and even otherwise on cloud-based deployment systems.
31
+
32
+ # 2 MOTIVATION FOR LOW-PRECISION MODEL PARAMETERS
33
+
34
+ Lowering precision of model parameters: Resource constrained inference systems impose significant restrictions on memory, compute and power budget. With regard to storage, model (or weight) parameters and activation maps occupy memory during the inference phase of DNNs. During this phase memory is allocated for input (IFM) and output feature maps (OFM) required by a single layer in the DNN, and these dynamic memory allocations are reused for other layers. The total memory allocation during inference is then the maximum of IFM and maximum of OFM memory required across all the layers plus the sum of all weight tensors (Mishra et al., 2017). When inference phase for DNNs is performed with a small batch size, the memory footprint of the weights exceeds the footprint of the activation maps. This aspect is shown in Figure 1 for 4 different networks (AlexNet (Krizhevsky et al., 2012), Inception-Resnet-v2 (Szegedy et al., 2016), ResNet-50 and ResNet-101 (He et al., 2015)) running $2 2 4 \mathrm { x } 2 2 4$ image patches. Thus lowering the precision of the weight tensors helps lower the memory requirements during deployment. One other aspect of lowering memory footprint is that the working set size of the workload starts to fit on chip and by reducing accesses to DRAM (off-chip) memory, the compute core starts to see better performance and energy savings (DRAM accesses are expensive in latency and energy).
35
+
36
+ Benefit of low-precision compute: Low-precision compute simplifies hardware implementation. For example, the compute unit to perform the convolution operation (multiplication of two operands) involves a floating-point multiplier when using fullprecision weights and activations. The floatingpoint multiplier can be replaced with a much simpler circuitry (xnor and popcount logic elements) when using binary precision for weights and activations (Courbariaux & Bengio, 2016; Rastegari et al., 2016; Courbariaux et al., 2015). Similarly, when using ternary precision for weights and full-precision for activations, the multiplier unit can be replaced with a sign comparator unit. Simpler hardware also helps lower the inference latency and energy budget. Thus, operating in lower precision mode reduces compute as well as data movement and storage requirements.
37
+
38
+ ![](images/9891559225e3a0edb31812399103f038b11fe71bbdf203533e28c2c2d622f4f3.jpg)
39
+ Figure 1: Memory footprint of activations (ACTs) and weights (W) during inference for mini-batch sizes 1 and 8.
40
+
41
+ The drawback of low-precision models, however, is degraded accuracy. We discuss later in the paper the network accuracies obtained using methods proposed in literature. These accuracies serve as the starting point and baselines we compare to in our work.
42
+
43
+ # 3 RELATED WORK
44
+
45
+ Low-precision networks: Low-precision DNNs are an active area of research. Most low-precision networks acknowledge the over parameterization aspect of today’s DNN architectures and/or the aspect that lowering the precision of neurons post-training often does not impact the final performance. Reducing precision of weights for efficient inference pipeline has been very well studied. Works like Binary connect (BC) (Courbariaux et al., 2015), Ternary-weight networks (TWN) (Li & Liu, 2016), fine-grained ternary quantization (Mellempudi et al., 2017) and INQ (Zhou et al., 2017) target precision reduction of network weights. Accuracy is almost always affected when quantizing the weights significantly below 8-bits of precision. For AlexNet on ImageNet, TWN loses $5 \%$ Top-1 accuracy. Schemes like INQ, work in Sung et al. (2015) and Mellempudi et al. (2017) do fine-tuning to quantize the network weights.
46
+
47
+ Work in XNOR-NET (Rastegari et al., 2016), binary neural networks (Courbariaux & Bengio, 2016), DoReFa (Zhou et al., 2016) and trained ternary quantization (TTQ) (Zhu et al., 2016) target training pipeline. While TTQ targets weight quantization, most works targeting activation quantization show that quantizing activations always hurt accuracy. XNOR-NET approach degrades Top-1 accuracy by $12 \%$ and DoReFa by $8 \%$ when quantizing both weights and activations to 1-bit (for AlexNet on ImageNet). Work by Gupta et al. (2015) advocates for low-precision fixed-point numbers for training. They show 16-bits to be sufficient for training on CIFAR10 dataset. Work by Seide et al. (2014) quantizes gradients in a distributed computing system.
48
+
49
+ Knowledge distillation methods: The general technique in distillation based methods involves using a teacher-student strategy, where a large deep network trained for a given task teaches shallower student network(s) on the same task. The core concepts behind knowledge distillation or transfer technique have been around for a while. Bucilua et al. ˇ (2006) show that one can compress the information in an ensemble into a single network. Ba & Caurana (2013) extend this approach to study shallow, but wide, fully connected topologies by mimicking deep neural networks. To facilitate learning, the authors introduce the concepts of learning on logits rather than the probability distribution.
50
+
51
+ Hinton et al. (2015) propose a framework to transfer knowledge by introducing the concept of temperature. The key idea is to divide the logits by a temperature factor before performing a Softmax function. By using a higher temperature factor the activations of incorrect classes are boosted. This then facilitates more information flowing to the model parameters during back-propagation operation. FitNets (Romero et al., 2014) extend this work by using intermediate hidden layer outputs as target values for training a deeper, but thinner, student model. Net2Net (Chen et al., 2015a) also uses a teacher-student network system with a function-preserving transformation approach to initialize the parameters of the student network. The goal in Net2Net approach is to accelerate the training of a larger student network. Zagoruyko & Komodakis (2016) use attention as a mechanism for transferring knowledge from one network to another. In a similar theme, Yim et al. (2017) propose an information metric using which a teacher DNN can transfer the distilled knowledge to other student DNNs. In N2N learning work, Ashok et al. (2017) propose a reinforcement learning based approach for compressing a teacher network into an equally capable student network. They achieve a compression factor of 10x for ResNet-34 on CIFAR datasets.
52
+
53
+ Sparsity and hashing: Few other popular techniques for model compression are pruning (LeCun et al., 1990; Han et al., 2015a; Wen et al., 2016; Han et al., 2015b), hashing (Weinberger et al., 2009) and weight sharing (Chen et al., 2015b; Denil et al., 2013). Pruning leads to removing neurons entirely from the final trained model making the model a sparse structure. With hashing and weight sharing schemes a hash function is used to alias several weight parameters into few hash buckets, effectively lowering the parameter memory footprint. To realize benefits of sparsity and hashing schemes during runtime, efficient hardware support is required (e.g. support for irregular memory accesses (Han et al., 2016; Venkatesh et al., 2016; Parashar et al., 2017)).
54
+
55
+ # 4 KNOWLEDGE DISTILLATION
56
+
57
+ We introduce the concept of knowledge distillation in this section. Bucilua et al. ˇ (2006), Hinton et al. (2015) and Urban et al. (2016) analyze this topic in great detail.
58
+
59
+ Figure 2 shows the schematic of the knowledge distillation setup. Given an input image $x$ , a teacher DNN maps this image to predictions $p ^ { T }$ . The $C$ class predictions are obtained by applying Softmax function on the un-normalized log probability values $z$ (the logits), i.e. $\begin{array} { r } { p ^ { T } = e ^ { z _ { k } ^ { T } } / \sum _ { j } ^ { C } e ^ { z _ { j } ^ { T } } } \end{array}$ . The same image is fed to the student network and it predicts $p ^ { A } = e ^ { z _ { k } ^ { A } } / { \sum _ { j } ^ { C } e ^ { z _ { j } ^ { A } } }$ . During training, the cost function, , is given as:
60
+
61
+ $$
62
+ \mathcal { L } ( x ; W _ { T } , W _ { A } ) = \alpha \mathcal { H } ( y , p ^ { T } ) + \beta \mathcal { H } ( y , p ^ { A } ) + \gamma \mathcal { H } ( z ^ { T } , p ^ { A } )
63
+ $$
64
+
65
+ where, $W _ { T }$ and $W _ { A }$ are the parameters of the teacher and the student (apprentice) network, respectively, $y$ is the ground truth, $\mathcal { H } ( \cdot )$ denotes a loss function and, $\alpha , \beta$ and $\gamma$ are weighting factors to prioritize the output of a certain loss function over the other.
66
+
67
+ In equation 1, lowering the first term of the cost function gives a better teacher network and lowering the second term gives a better student network. The third term is the knowledge distillation term whereby the student network attempts to mimic the knowledge in the teacher network. In Hinton et al. (2015), the logits of the teacher network are divided by a temperature factor $\tau$ . Using a higher value for $\tau$ produces a softer probability distribution when taking the Softmax of the logits. In our studies, we use cross-entropy function for $\mathcal { H } ( \cdot )$ , set $\alpha = 1$ , $\beta = 0 . 5$ and $\gamma = 0 . 5$ and, perform the transfer learning process using the logits (inputs to the Softmax function) of the teacher network. In our experiments we study the effect of varying the depth of the teacher and the student network, and the precision of the neurons in the student network.
68
+
69
+ # 5 OUR APPROACH - APPRENTICE NETWORK
70
+
71
+ Low-precision DNNs target the storage and compute efficiency aspects of the network. Model compression targets the same efficiency parameters from the point of view of network architecture. With
72
+
73
+ ![](images/de4bb554a8cf5d3c54e0cec30d054c2e4a524e80b0ca5c77ec209cd41c0c4ecd.jpg)
74
+ Figure 2: Schematic of the knowledge distillation setup. The teacher network is a high precision network and the apprentice network is a low-precision network.
75
+
76
+ Apprentice we combine both these techniques to improve the network accuracy as well as the runtime efficiency of DNNs. Using the teacher-student setup described in the last section, we investigate three schemes using which one can obtain a low-precision model for the student network. The first scheme (scheme-A) jointly trains both the networks - full-precision teacher and low-precision student network. The second scheme (scheme-B) trains only the low-precision student network but distills knowledge from a trained full-precision teacher network throughout the training process. The third scheme (scheme-C) starts with a trained full-precision teacher and a full-precision student network but fine-tunes the student network after lowering its precision. Before we get into the details of each of these schemes, we discuss the accuracy numbers obtained using low-precision schemes described in literature. These accuracy figures serve as the baseline for comparative analysis.
77
+
78
+ # 5.1 TOP-1 ERROR WITH PRIOR PROPOSALS FOR LOW-PRECISION NETWORKS
79
+
80
+ We focus on sub 8-bits precision for inference deployments, specifically ternary and 4-bits precision. We found TTQ (Zhu et al., 2016) scheme achieving the state-of-the-art accuracy with ternary precision for weights and full-precision (32-bits floating-point) for activations. On Imagenet-1K (Russakovsky et al., 2015), TTQ achieves $3 3 . 4 \%$ Top-1 error rate with a ResNet-18 model. We implemented TTQ scheme for ResNet-34 and ResNet-50 models trained on Imagenet-1K and achieved $2 8 . 3 \%$ and $2 5 . 6 \%$ Top-1 error rates, respectively. This scheme is our baseline for 2-bits weight and full-precision activations. For 2-bits weight and 8-bits activation, we find work by Mellempudi et al. (2017) to achieve the best accuracies reported in literature. For ResNet-50, Mellempudi et al. (2017) obtain $2 9 . 2 4 \%$ Top-1 error. We consider this work to be our baseline for 2-bits weight and 8-bits activation models.
81
+
82
+ For 4-bits precision, we find WRPN scheme (Mishra et al., 2017) to report the highest accuracy. We implemented this scheme for 4-bits weight and 8-bits activations. For ResNet-34 and ResNet-50 models trained on Imagenet-1K, we achieve $2 9 . 7 \%$ and $2 8 . 4 \%$ Top-1 error rates, respectively.
83
+
84
+ # 5.2 SCHEME-A: JOINT TRAINING OF TEACHER-STUDENT NETWORKS
85
+
86
+ In the first scheme that we investigate, a full-precision teacher network is jointly trained with a lowprecision student network. Figure 2 shows the overall training framework. We use ResNet topology for both the teacher and student network. When using a certain depth for the student network, we pick the teacher network to have either the same or larger depth.
87
+
88
+ In Bucilua et al. ˇ (2006) and Hinton et al. (2015), only the student network trains while distilling knowledge from the teacher network. In our case, we jointly train with the rationale that the teacher network would continuously guide the student network not only with the final trained logits, but also on what path the teacher takes towards generating those final higher accuracy logits.
89
+
90
+ We implement pre-activation version of ResNet (He et al., 2016) in TensorFlow (Abadi et al., 2015). The training process closely follows the recipe mentioned in Torch implementation of ResNet - we use a batch size of 256 and no hyper-parameters are changed from what is mentioned in the recipe. For the teacher network, we experiment with ResNet-34, ResNet-50 and ResNet-101 as options. For the student network, we experiment with low-precision variants of ResNet-18, ResNet-34 and ResNet-50.
91
+
92
+ For low-precision numerics, when using ternary precision we use the ternary weight network scheme (Li & Liu, 2016) where the weight tensors are quantized into $\{ - 1 , 0 , 1 \}$ with a per-layer scaling coefficient computed based on the mean of the positive terms in the weight tensor. We use the WRPN scheme (Mishra et al., 2017) to quantize weights and activations to 4-bits or 8-bits. We do not lower the precision of the first layer and the final layer in the apprentice network. This is based on the observation in almost all prior works that lowering the precision of these layers degrades the accuracy dramatically. While training and during fine-tuning, the gradients are still maintained at full-precision.
93
+
94
+ Table 1: Top-1 validation set error rate $( \% )$ on ImageNet-1K for ResNet-18 student network as precision of activations (A) and weight (W) changes. The last three columns show error rate when the student ResNet-18 is paired with ResNet-34, ResNet-50 and ResNet-101.
95
+
96
+ <table><tr><td></td><td>ResNet-18 Baseline</td><td>ResNet-18 with ResNet-34</td><td>ResNet-18 with ResNet-50</td><td>ResNet-18 with ResNet-101</td></tr><tr><td>32A,32W</td><td>30.4</td><td>30.2</td><td>30.1</td><td>30.1</td></tr><tr><td>32A,2W</td><td>33.4</td><td>31.7</td><td>31.5</td><td>31.8</td></tr><tr><td>8A,4W</td><td>33.6</td><td>29.6</td><td>29.6</td><td>29.9</td></tr><tr><td>8A,2W</td><td>33.9</td><td>32.0</td><td>32.2</td><td>32.4</td></tr></table>
97
+
98
+ Results with ResNet-18: Table 1 shows the effect of lowering precision on the accuracy (Top1 error) of ResNet-18 with baseline (no teacher) and with ResNet-34, ResNet-50 and ResNet-101 as teachers. In the table, $A$ denotes the precision of the activation maps (in bits) and $W$ denotes the precision of the weights. The baseline Top-1 error for full-precision ResNet-18 is $3 0 . 4 \%$ . By lowering the precision without using any help from a teacher network, the accuracy drops by $3 . 5 \%$ when using ternary and 4-bits precision (the column corresponding to “Res-18 Baseline” in the table). With distillation based technique, the accuracy of low-precision configurations improves significantly. In fact, the accuracy of the fullprecision ResNet-18 also improves when paired with a larger full-precision ResNet model (the row corresponding to $\mathrm { ^ { 6 6 } 3 2 A }$ , 32W” in Table 1). The best full-precision accuracy was achieved with a student ResNet-18 and ResNet-101 as the teacher (improvement by $0 . 3 5 \%$ over the baseline). The gap between full-precision ResNet-18 and the best
99
+
100
+ ![](images/f42e8f643c1b43106b46bcc4e066bcaba5b3b48a073be588f9ad1aea0c269326.jpg)
101
+ Difference (!) in Top-1 error for Res-18 from baseline
102
+ Figure 3: Difference in Top-1 error rate for lowprecision variants of ResNet-18 with (blue bars) and without (red bars) distillation scheme. The difference is calculated from the accuracy of ResNet-18 with full-precision numerics. Higher $\%$ difference denotes a better network configuration.
103
+
104
+ achieved ternary weight ResNet-18 is only $1 \%$ (improvement of $2 \%$ over previous best). With “8A, 4W”, we find the accuracy of the student ResNet-18 model to beat the baseline accuracy. We hypothesize regularization with low-precision (and distillation) to be the reason for this. “8A, 4W” improving the accuracy beyond baseline figure is only seen for ResNet-18.
105
+
106
+ Figure 3 shows the difference in Top-1 error rate achieved by our best low-precision student networks (when trained under the guidance of a teacher network) versus not using any help from a teacher network. For this figure, the difference in Top-1 error of the best low-precision student network is calculated from the baseline full-precision network (i.e. ResNet-18 with $3 0 . 4 \%$ Top-1 error), i.e. we want to see how close a low-precision student network can come to a full-precision baseline model.
107
+
108
+ We find our low-precision network accuracies to significantly close the gap between full-precision accuracy (and for some configurations even beat the baseline accuracy).
109
+
110
+ Hinton et al. (2015) mention improving the baseline full-precision accuracy when a student network is paired with a teacher network. They mention improving the accuracy of a small model on MNIST dataset. We show the efficacy of distillation based techniques on a much bigger model (ResNet) with much larger dataset (ImageNet).
111
+
112
+ Table 2: Top-1 validation set error rate $( \% )$ on ImageNet-1K for ResNet-34 student network as precision of activations (A) and weight (W) changes. The last three columns show error rate when the student ResNet-34 is paired with ResNet-34, ResNet-50 and ResNet-101.
113
+
114
+ <table><tr><td></td><td>ResNet-34 Baseline</td><td>ResNet-34 with ResNet-34</td><td>ResNet-34 with ResNet-50</td><td>ResNet-34 with ResNet-101</td></tr><tr><td>32A,32W</td><td>26.4</td><td>26.3</td><td>26.1</td><td>26.1</td></tr><tr><td>32A,2W</td><td>28.3</td><td>27.6</td><td>27.2</td><td>27.2</td></tr><tr><td>8A,4W</td><td>29.7</td><td>27.0</td><td>26.9</td><td>26.9</td></tr><tr><td>8A,2W</td><td>30.8</td><td>28.8</td><td>28.8</td><td>28.5</td></tr></table>
115
+
116
+ Table 3: Top-1 validation set error rate $( \% )$ on ImageNet-1K for ResNet-50 student network as precision of activations (A) and weight (W) changes. The final two columns show error rate when the student ResNet-50 is paired with ResNet-50 and ResNet-101.
117
+
118
+ <table><tr><td></td><td>ResNet-50 Baseline</td><td>ResNet-50 with ResNet-50</td><td>ResNet-50 with ResNet-101</td></tr><tr><td>32A,32W</td><td>23.8</td><td>23.7</td><td>23.5</td></tr><tr><td>32A,2W</td><td>26.1</td><td>25.4</td><td>25.3</td></tr><tr><td>8A,4W</td><td>28.5</td><td>25.5</td><td>25.3</td></tr><tr><td>8A,2W</td><td>29.2</td><td>27.3</td><td>27.2</td></tr></table>
119
+
120
+ ![](images/47c2437bfd32d6774412562b4a57e97c472a8cd6b2d82e1de69fef711f7fda78.jpg)
121
+ Difference (!) in Top-1 error for Res-34 from baseline
122
+ Figure 4: Difference in Top-1 error rate for low-precision variants of ResNet-34 and ResNet-50 with (blue bars) and without (red bars) distillation scheme. The difference is calculated from the accuracy of the baseline network (ResNet-34 for (a) and ResNet-50 for (b)) operating at full-precision. Higher $\%$ difference denotes a better network configuration.
123
+
124
+ ![](images/2e0db05bfecee700dbb72b7cb8a8f0fceab579a6d7c2d9898a51b6829c269068.jpg)
125
+ Difference (!) in Top-1 error for Res-50 from baseline
126
+ (a) Apprentice versus baseline accuracy for ResNet-34. (b) Apprentice versus baseline accuracy for ResNet-50.
127
+
128
+ Results with ResNet-34 and ResNet-50: Table 2 and Table 3 show the effect of lowering precision on the accuracy of ResNet-34 and ResNet-50, respectively, with distillation based technique. With a student ResNet-34 network, we use ResNet-34, ResNet-50 and ResNet-101 as teachers. With a student ResNet-50 network, we use ResNet-50 and ResNet-101 as teachers. The Top-1 error for full-precision ResNet-34 is $2 6 . 4 \%$ . Our best 4-bits weight and 8-bits activation ResNet-34 is within $0 . 5 \%$ of this number ( $2 6 . 9 \%$ error rate with ResNet-34 student and ResNet-50 teacher). This significantly improves upon the previously reported error rate of $2 9 . 7 \%$ . 4-bits weight and 8-bits activation for ResNet-50 gives us a model that is within $1 . 5 \%$ of full-precision model accuracy $2 5 . 3 \%$ vs. $2 3 . 8 \%$ ). Figure 4a and Figure 4b show the difference in Top-1 error achieved by our best low-precision ResNet-34 and ResNet-50 student networks, respectively, and compares with results obtained using methods proposed in literature. Our $\mathcal { A }$ pprentice scheme significantly closes the gap between full-precision baseline networks and low-precision variants of the same networks. In most cases we see our scheme to better the previously reported accuracy numbers by $1 . 5 \% - 3 \%$ .
129
+
130
+ Discussion: In scheme-A, we use a teacher network that is always as large or larger in number of parameters than the student network. We experimented with a ternary ResNet-34 student network which was paired with a full-precision ResNet-18. The ternary model for ResNet-34 is about $8 . 5 \mathrm { x }$ smaller in size compared to the full-precision ResNet-18 model. The final trained accuracy of the ResNet-34 ternary model with this setup is $2 . 7 \%$ worse than that obtained by pairing the ternary ResNet-34 network with a ResNet-50 teacher network. This suggests that the distillation scheme works only when the teacher network is higher in accuracy than the student network (and not necessarily bigger in capacity). Further, the benefit from using a larger teacher network saturates at some point. This can be seen by picking up a precision point, say “32A, 2W” and looking at the error rates along the row in Table 1, 2 and 3.
131
+
132
+ One concern, we had in the early stages of our investigation, with joint training of a low-precision small network and a high precision large network was the influence of the small network’s accuracy on the accuracy of the large network. When using the joint cost function, the smaller network’s probability scores are matched with the predictions from the teacher network. The joint cost is added as a term to the total loss function (equation 1). This led us to posit that the larger network’s learning capability will be affected by the inherent impairment in the smaller low-precision network. Further, since the smaller student network learns form the larger teacher network, a vicious cycle might form where the student network’s accuracy will further drop because the teacher network’s learning capability is being impeded. However, in practice, we did not see this phenomenon occurring - in each case where the teacher network was jointly trained with a student network, the accuracy of the teacher network was always within $0 . 1 \%$ to $0 . 2 \%$ of the accuracy of the teacher network without it jointly supervising a student network. This could be because of our choice of $\alpha$ , $\beta$ and $\gamma$ values.
133
+
134
+ In Section 4, we mentioned about temperature, $\tau$ , for Softmax function and hyper-parameters $\alpha = 1$ , $\beta = 0 . 5$ and $\gamma = 0 . 5$ . Since, we train directly on the logits of the teacher network, we did not have to experiment with the appropriate value of $\tau , \tau$ is required when training on the soft targets produced by the teacher network. Although we did not do extensive studies experimenting with training on soft targets as opposed to logits, we find that $\tau = 1$ gives us best results when training on soft targets. Hinton et al. (2015) mention that when the student network is significantly smaller than the teacher network, small values of $\tau$ are more effective than large values. For few of the low-precision configurations, we experimented with $\alpha = \beta = \gamma = 1$ , and, $\alpha = 0 . 9$ , $\beta = 1$ and $\gamma = 0 . 1$ or 0.3. Each of these configurations, yielded a lower performance model compared to our original choice for these parameters.
135
+
136
+ For the third term in equation 1, we experimented with a mean-squared error loss function and also a loss function with logits from both the student and the teacher network (i.e. $\mathcal { H } ( z ^ { T } , z ^ { A } ) )$ . We did not find any improvement in accuracy compared to our original choice of the cost function formulation. A thorough investigation of the behavior of the networks with other values of hyper-parameters and different loss functions is an agenda for our future work.
137
+
138
+ Overall, we find the distillation process to be quite effective in getting us high accuracy low-precision models. All our low-precision models surpass previously reported low-precision accuracy figures. For example, TTQ scheme achieves $3 3 . 4 \%$ Top-1 error rate for ResNet-18 with 2-bits weight. Our best ResNet-18 model, using scheme-A, with 2-bits weight achieves ${ \sim } 3 1 . 5 \%$ error rate, improving the model accuracy by ${ \sim } 2 \%$ over TTQ. Similarly, the scheme in Mellempudi et al. (2017) achieves $2 9 . 2 \%$ Top-1 error with 2-bits weight and 8-bits activation. The best performing $A$ pprentice network at this precision achieves $2 7 . 2 \%$ Top-1 error. For Scheme-B and Scheme-C, which we describe next, Scheme-A serves as the new baseline.
139
+
140
+ # 5.3 SCHEME-B: DISTILLING KNOWLEDGE FROM A TEACHER
141
+
142
+ In this scheme, we start with a trained teacher network. Referring back to Figure 2, the input image is passed to both the teacher and the student network, except that the learning with back-propagation happens only in the low precision student network which is trained from scratch. This is the scheme used by Bucilua et al. ˇ (2006) and Hinton et al. (2015) for training their student networks. In this scheme, the first term in equation 1 zeroes out and only the last two terms in the equation contribute toward the loss function.
143
+
144
+ ![](images/776aa02a37e8a7359b0d5d75f2da39efde532341c5e092bd7590bc5fbde6419b.jpg)
145
+ Figure 5: Top-1 error rate versus epochs of four student networks using scheme-A and scheme-B.
146
+
147
+ With scheme-B, one can pre-compute and store the logit values for the input images on disk and access them during training the student network. This saves the forward pass computations in the teacher network. Scheme-B might also help the scenario where a student network attempts to learn the “dark knowledge” from a teacher network that has already been trained on some private or sensitive data (in addition to the data the student network is interested in training on).
148
+
149
+ With scheme-A, we had the hypothesis that the student network would be influenced by not only the “dark knowledge” in the teacher network but also the path the teacher adopts to learn the knowledge. With scheme-B we find, that the student network gets to similar accuracy numbers as the teacher network albeit at fewer number of epochs.
150
+
151
+ With this scheme, the training accuracies are similar to that reported in Table 1, 2 and 3. The low-precision student networks, however, learn in fewer number of epochs. Figure 5 plots the Top-1 error rates for few of the configurations from our experiment suite. In each of these plots, the student network in scheme-B converges around 80th-85th epoch compared to about 105 epochs in schemeA. In general, we find the student networks with scheme-B to learn in about $10 \% { - } 2 0 \%$ fewer epochs than the student networks trained using scheme-A.
152
+
153
+ # 5.4 SCHEME-C: FINE-TUNING THE STUDENT MODEL
154
+
155
+ Scheme-C is very similar to scheme-B, except that the student network is primed with full precision training weights before the start of the training process. At the beginning of the training process, the weights and activations are lowered and the student network is sort of fine-tuned on the dataset.
156
+
157
+ Similar to scheme-B, only the final two terms in equation 1 comprise the loss function and the lowprecision student network is trained with back-propagation algorithm. Since, the network starts from a good initial point, comparatively low learning rate is used throughout the training process. There is no clear recipe for learning rates (and change of learning rate with epochs) which works across all the configurations. In general, we find training with a learning rate of 1e-3 for 10 to 15 epochs, followed by 1e-4 for another 5 to 10 epochs, followed by 1e-5 for another 5 epochs to give us the best accuracy. Some configurations run for about 40 to 50 epochs before stabilizing. For these configurations, we find training using scheme-B with warm startup (train the student network at full-precision for about 25-30 epochs before lowering the precision) to be equally good. Wu (2016) investigate a similar scheme for binary precision on AlexNet. Our experiments show that distillation is an overkill for AlexNet and one can get comparable accuracies using techniques proposed in (Tang et al., 2017; Mishra et al., 2017). Further, Wu (2016) hypothesize that distillation scheme will work on larger networks, we show in this paper how to make it work. Tann et al. (2017) use a similar scheme for AlexNet and mention starting from a non-global optimal checkpoint gives better accuracy, though we did not find this observation to hold in our experiments.
158
+
159
+ We find the final accuracy of the models obtained using scheme-C to be (marginally) better than those obtained using scheme-A or scheme-B. Table 4 shows error rates of few configurations of low-precision student network obtained using scheme-A (or scheme-B) and scheme-C. For ResNet50 student network, the accuracy with ternary weights is further improved by $0 . 6 \%$ compared to that obtained using scheme-A. Note that the performance of ternary networks obtained using schemeA are already state-of-the-art. Hence, for ResNet-50 ternary networks, $2 4 . 7 \%$ Top-1 error rate is the new state-of-the-art. With this, ternary ResNet-50 is within $0 . 9 \%$ of baseline accuracy $( 2 3 . 8 \%$ vs. $2 4 . 7 \%$ ). Similarly, with 4-bits weight and 8-bits activations, ResNet-50 model obtained using scheme-C is $0 . 4 \%$ better than that obtained with scheme-A (closing the gap to be within $1 . 3 \%$ of full-precision ResNet-50 accuracy).
160
+
161
+ Table 4: Top-1 ImageNet-1K validation set error rate $( \% )$ with scheme-A and scheme-C for ResNet-34 and ResNet-50 student networks with ternary and 4-bits precision.
162
+
163
+ <table><tr><td>ResNet-34 student with ResNet-50 teacher</td><td>32A,2W with scheme-A or B</td><td>32A,2W with scheme-C</td></tr><tr><td>ResNet-50 student with ResNet101 teacher</td><td>27.2 25.3</td><td>26.9 24.7</td></tr><tr><td rowspan="2">ResNet-34 student with ResNet-50 teacher</td><td>8A,4W with scheme-A or B</td><td>8A,4W with scheme-C</td></tr><tr><td>26.9</td><td>26.8</td></tr><tr><td>ResNet-50 student with ResNet101 teacher</td><td>25.5</td><td>25.1</td></tr></table>
164
+
165
+ Scheme-C is useful when one already has a trained network which can be fine-tuned using knowledge distillation schemes to produce a low-precision variant of the trained network.
166
+
167
+ # 5.5 DISCUSSION - TERNARY PRECISION VERSUS SPARSITY
168
+
169
+ As mentioned earlier, low-precision is a form of model compression. There are many works which target network sparsification and pruning techniques to compress a model. With ternary precision models, the model size reduces by a factor of $2 / 3 2$ compared to full-precision models. With $\mathcal { A }$ pprentice, we show how one can get a performant model with ternary precision. Many works targeting network pruning and sparsification target a full-precision model to implement their scheme. To be comparable in model size to ternary networks, a full-precision model needs to be sparsified by $9 3 . 7 5 \%$ . Further, to be effective, a sparse model needs to store a key for every non-zero value denoting the position of the value in the weight tensor. This adds storage overhead and a sparse model needs to be about $9 5 \%$ sparse to be at-par in memory size as a 2-bit model. Note that ternary precision also has inherent sparsity (zero is a term in the ternary symbol dictionary) – we find our ternary models to be about $50 \%$ sparse. In work by Wen et al. (2016) and Han et al. (2015b), sparsification of full-precision networks is proposed but the sparsity achieved is less than $9 3 . 7 5 \%$ . Further, the network accuracy using techniques in both these works lead to larger degradation in accuracy compared to our ternary models. Overall, we believe, our ternary precision models to be state-of-the-art not only in accuracy (we better the accuracy compared to prior ternary precision models) but also when one considers the size of the model at the accuracy level achieved by low-precision or sparse networks.
170
+
171
+ # 6 CONCLUSIONS
172
+
173
+ While low-precision networks have system-level benefits, the drawback of such models is degraded accuracy when compared to full-precision models. We present three schemes based on knowledge distillation concept to improve the accuracy of low-precision networks and close the gap between the accuracy of these models and full-precision models. Each of the three schemes improve the accuracy of the low-precision network configuration compared to prior proposals. We motivate the need for a smaller model size in low batch, real-time and resource constrained inference deployment systems. We envision the low-precision models produced by our schemes to simplify the inference deployment process on resource constrained systems and on cloud-based deployment systems where low latency is a critical requirement.
174
+
175
+ # REFERENCES
176
+
177
+ Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, ´ Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Watten- ´ berg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL https://www.tensorflow.org/. Software available from tensorflow.org.
178
+
179
+ A. Ashok, N. Rhinehart, F. Beainy, and K. M. Kitani. N2N Learning: Network to Network Compression via Policy Gradient Reinforcement Learning. ArXiv e-prints, September 2017.
180
+
181
+ Lei Jimmy Ba and Rich Caurana. Do deep nets really need to be deep? CoRR, abs/1312.6184, 2013. URL http://arxiv.org/abs/1312.6184.
182
+
183
+ Cristian Bucilua, Rich Caruana, and Alexandru Niculescu-Mizil. Model compression. In ˇ Proceedings of the 12th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’06, pp. 535–541, New York, NY, USA, 2006. ACM. ISBN 1-59593-339-5. doi: 10. 1145/1150402.1150464. URL http://doi.acm.org/10.1145/1150402.1150464.
184
+
185
+ Alfredo Canziani, Adam Paszke, and Eugenio Culurciello. An analysis of deep neural network models for practical applications. CoRR, abs/1605.07678, 2016. URL http://arxiv.org/ abs/1605.07678.
186
+
187
+ Tianqi Chen, Ian J. Goodfellow, and Jonathon Shlens. Net2net: Accelerating learning via knowledge transfer. CoRR, abs/1511.05641, 2015a. URL http://arxiv.org/abs/1511.05641.
188
+
189
+ Wenlin Chen, James T. Wilson, Stephen Tyree, Kilian Q. Weinberger, and Yixin Chen. Compressing neural networks with the hashing trick. CoRR, abs/1504.04788, 2015b. URL http://arxiv. org/abs/1504.04788.
190
+
191
+ Matthieu Courbariaux and Yoshua Bengio. Binarynet: Training deep neural networks with weights and activations constrained to $+ 1$ or -1. CoRR, abs/1602.02830, 2016. URL http://arxiv. org/abs/1602.02830.
192
+
193
+ Matthieu Courbariaux, Yoshua Bengio, and Jean-Pierre David. Binaryconnect: Training deep neural networks with binary weights during propagations. CoRR, abs/1511.00363, 2015. URL http: //arxiv.org/abs/1511.00363.
194
+
195
+ Misha Denil, Babak Shakibi, Laurent Dinh, Marc’Aurelio Ranzato, and Nando de Freitas. Predicting parameters in deep learning. CoRR, abs/1306.0543, 2013. URL http://arxiv.org/abs/ 1306.0543.
196
+
197
+ Suyog Gupta, Ankur Agrawal, Kailash Gopalakrishnan, and Pritish Narayanan. Deep learning with limited numerical precision. CoRR, abs/1502.02551, 2015. URL http://arxiv.org/abs/ 1502.02551.
198
+
199
+ Song Han, Huizi Mao, and William J. Dally. Deep compression: Compressing deep neural network with pruning, trained quantization and huffman coding. CoRR, abs/1510.00149, 2015a. URL http://arxiv.org/abs/1510.00149.
200
+
201
+ Song Han, Jeff Pool, John Tran, and William J. Dally. Learning both weights and connections for efficient neural network. In Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, pp. 1135–1143, 2015b.
202
+
203
+ Song Han, Xingyu Liu, Huizi Mao, Jing Pu, Ardavan Pedram, Mark A. Horowitz, and William J. Dally. EIE: efficient inference engine on compressed deep neural network. In 43rd ACM/IEEE Annual International Symposium on Computer Architecture, ISCA 2016, Seoul, South Korea, June 18-22, 2016, pp. 243–254, 2016. doi: 10.1109/ISCA.2016.30. URL https://doi.org/10. 1109/ISCA.2016.30.
204
+
205
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CoRR, abs/1512.03385, 2015. URL http://arxiv.org/abs/1512.03385.
206
+
207
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. CoRR, abs/1603.05027, 2016. URL http://arxiv.org/abs/1603.05027.
208
+
209
+ G. Hinton, O. Vinyals, and J. Dean. Distilling the Knowledge in a Neural Network. ArXiv e-prints, March 2015.
210
+
211
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
212
+
213
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In F. Pereira, C. J. C. Burges, L. Bottou, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 25, pp. 1097–1105. Curran Associates, Inc., 2012.
214
+
215
+ Yann LeCun, John S. Denker, and Sara A. Solla. Optimal brain damage. In D. S. Touretzky (ed.), Advances in Neural Information Processing Systems 2, pp. 598–605. Morgan-Kaufmann, 1990. URL http://papers.nips.cc/paper/250-optimal-brain-damage.pdf.
216
+
217
+ Fengfu Li and Bin Liu. Ternary weight networks. CoRR, abs/1605.04711, 2016. URL http: //arxiv.org/abs/1605.04711.
218
+
219
+ Zhouhan Lin, Matthieu Courbariaux, Roland Memisevic, and Yoshua Bengio. Neural networks with few multiplications. CoRR, abs/1510.03009, 2015. URL http://arxiv.org/abs/1510. 03009.
220
+
221
+ N. Mellempudi, A. Kundu, D. Mudigere, D. Das, B. Kaul, and P. Dubey. Ternary Neural Networks with Fine-Grained Quantization. ArXiv e-prints, May 2017.
222
+
223
+ A. Mishra, E. Nurvitadhi, J. J Cook, and D. Marr. WRPN: Wide Reduced-Precision Networks. ArXiv e-prints, September 2017.
224
+
225
+ Daisuke Miyashita, Edward H. Lee, and Boris Murmann. Convolutional neural networks using logarithmic data representation. CoRR, abs/1603.01025, 2016. URL http://arxiv.org/ abs/1603.01025.
226
+
227
+ Angshuman Parashar, Minsoo Rhu, Anurag Mukkara, Antonio Puglielli, Rangharajan Venkatesan, Brucek Khailany, Joel S. Emer, Stephen W. Keckler, and William J. Dally. SCNN: an accelerator for compressed-sparse convolutional neural networks. CoRR, abs/1708.04485, 2017. URL http://arxiv.org/abs/1708.04485.
228
+
229
+ Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. Xnor-net: Imagenet classification using binary convolutional neural networks. CoRR, abs/1603.05279, 2016. URL http://arxiv.org/abs/1603.05279.
230
+
231
+ Adriana Romero, Nicolas Ballas, Samira Ebrahimi Kahou, Antoine Chassang, Carlo Gatta, and Yoshua Bengio. Fitnets: Hints for thin deep nets. CoRR, abs/1412.6550, 2014. URL http: //arxiv.org/abs/1412.6550.
232
+
233
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 115(3):211–252, 2015. doi: 10.1007/s11263-015-0816-y.
234
+
235
+ Frank Seide, Hao Fu, Jasha Droppo, Gang Li, and Dong Yu. 1-bit stochastic gradient descent and application to data-parallel distributed training of speech dnns. In Interspeech 2014, September 2014.
236
+
237
+ Wonyong Sung, Sungho Shin, and Kyuyeon Hwang. Resiliency of deep neural networks under quantization. CoRR, abs/1511.06488, 2015. URL http://arxiv.org/abs/1511.06488.
238
+
239
+ Christian Szegedy, Sergey Ioffe, and Vincent Vanhoucke. Inception-v4, inception-resnet and the impact of residual connections on learning. CoRR, abs/1602.07261, 2016. URL http: //arxiv.org/abs/1602.07261.
240
+
241
+ Wei Tang, Gang Hua, and Liang Wang. How to train a compact binary neural network with high accuracy? In Proceedings of the Thirty-First AAAI Conference on Artificial Intelligence, February 4-9, 2017, San Francisco, California, USA., 2017.
242
+
243
+ Hokchhay Tann, Soheil Hashemi, Iris Bahar, and Sherief Reda. Hardware-software codesign of accurate, multiplier-free deep neural networks. CoRR, abs/1705.04288, 2017.
244
+
245
+ Torch implementation of ResNet. https://github.com/facebook/fb.resnet.torch.
246
+
247
+ Yaman Umuroglu, Nicholas J. Fraser, Giulio Gambardella, Michaela Blott, Philip Heng Wai Leong, Magnus Jahre, and Kees A. Vissers. FINN: A framework for fast, scalable binarized neural network inference. CoRR, abs/1612.07119, 2016. URL http://arxiv.org/abs/1612. 07119.
248
+
249
+ G. Urban, K. J. Geras, S. Ebrahimi Kahou, O. Aslan, S. Wang, R. Caruana, A. Mohamed, M. Philipose, and M. Richardson. Do Deep Convolutional Nets Really Need to be Deep and Convolutional? ArXiv e-prints, March 2016.
250
+
251
+ Vincent Vanhoucke, Andrew Senior, and Mark Z. Mao. Improving the speed of neural networks on cpus. In Deep Learning and Unsupervised Feature Learning Workshop, NIPS 2011, 2011.
252
+
253
+ Ganesh Venkatesh, Eriko Nurvitadhi, and Debbie Marr. Accelerating deep convolutional networks using low-precision and sparsity. CoRR, abs/1610.00324, 2016. URL http://arxiv.org/ abs/1610.00324.
254
+
255
+ Kilian Q. Weinberger, Anirban Dasgupta, Josh Attenberg, John Langford, and Alexander J. Smola. Feature hashing for large scale multitask learning. CoRR, abs/0902.2206, 2009. URL http: //arxiv.org/abs/0902.2206.
256
+
257
+ Wei Wen, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Learning structured sparsity in deep neural networks. CoRR, abs/1608.03665, 2016. URL http://arxiv.org/abs/ 1608.03665.
258
+
259
+ Xundong Wu. High performance binarized neural networks trained on the imagenet classification task. CoRR, abs/1604.03058, 2016.
260
+
261
+ Junho Yim, Donggyu Joo, Jihoon Bae, and Junmo Kim. A gift from knowledge distillation: Fast optimization, network minimization and transfer learning. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
262
+
263
+ Sergey Zagoruyko and Nikos Komodakis. Paying more attention to attention: Improving the performance of convolutional neural networks via attention transfer. CoRR, abs/1612.03928, 2016. URL http://arxiv.org/abs/1612.03928.
264
+
265
+ Aojun Zhou, Anbang Yao, Yiwen Guo, Lin Xu, and Yurong Chen. Incremental network quantization: Towards lossless cnns with low-precision weights. CoRR, abs/1702.03044, 2017. URL http://arxiv.org/abs/1702.03044.
266
+
267
+ Shuchang Zhou, Zekun Ni, Xinyu Zhou, He Wen, Yuxin Wu, and Yuheng Zou. Dorefa-net: Training low bitwidth convolutional neural networks with low bitwidth gradients. CoRR, abs/1606.06160, 2016. URL http://arxiv.org/abs/1606.06160.
268
+
269
+ Chenzhuo Zhu, Song Han, Huizi Mao, and William J. Dally. Trained ternary quantization. CoRR, abs/1612.01064, 2016. URL http://arxiv.org/abs/1612.01064.
270
+
271
+ ![](images/7647475b497c5ab56acf137b91a8eb2c58c5ffb1c66f3938057b2bfbff0237c1.jpg)
272
+ 7 APPENDIX: ANALYSIS WITH RESNET ON CIFAR-10 DATASET
273
+ Figure 6: Comparison of various configurations of ResNet on CIFAR-10 with and without $\mathcal { A }$ pprentice scheme.
274
+
275
+ In addition to ImageNet dataset, we also experiment with Apprentice scheme on CIFAR-10 dataset. CIFAR-10 dataset (Krizhevsky, 2009) consists of 50K training images and 10K testing images in 10 classes. We use various depths of ResNet topology for this study. Our implementation of ResNet for CIFAR-10 closely follows the configuration in He et al. (2015). The network inputs are $3 2 \times 3 2$ images. The first layer is a $3 \times 3$ convolutional layer followed by a stack of $6 n$ layers with $3 \times 3$ convolutions on feature map sizes 32, 16 and 8; with $2 n$ layers for each feature map size. The numbers of filters are 16, 32 and 64 in each set of $2 n$ layers. This is followed by a global average pooling, a 10-way fully connected layer and a softmax layer. Thus, in total there are $6 n { + 2 }$ weight layers.
276
+
277
+ Figure 6a shows the impact of lowering precision as the depth of ResNet varies. As the network becomes larger in size, the impact of lowering precision is diminished (relative to the accuracy of the network at that depth when using full-precision). For example, with ResNet-110, full-precision Top-1 error rate is $6 . 1 9 \%$ . At the same depth, ternarizing the model gives similar error rate $( 6 . 2 4 \% )$ . Comparing this with ResNet-20, the gap between full-precision and ternary model (2-bits weight and 32-bits activations) is $0 . 8 \%$ $7 . 9 \%$ vs. $8 . 7 \%$ Top-1 error). Overall, we find that ternarizing a model closely follows accuracy of baseline full-precision model. However, lowering both weights and activations almost always leads to large accuracy degradation. Accuracy of 2-bits weight and 8-bits activation network is $0 . 8 \% 1 . 6 \%$ worse than full-precision model. Using $A$ pprentice scheme this gap is considerably lowered.
278
+
279
+ Figure 6b shows the impact of lowering precision when a low-precision (student) network is paired with a full-precision (teacher) network. For this analysis we use scheme-A where we jointly train both the teacher and student network. The mix of ResNet depths we used for this study are ResNet20, 32, 44, 56, 110 and 182. ResNet-20 student network was paired with deeper ResNets from this mix, i.e. ResNet-32, 44, 56, 110 and 182 (as five separate experiments). Similarly, ResNet-44 student network was paired with deeper ResNet-56 and 110 (as two different set of experiments). ResNet-110 student network used ResNet-182 as its teacher network. For a particular ResNet depth, the figure plots the minimum error rate across each of the experiments.
280
+
281
+ We find $A$ pprentice scheme to improve the baseline full-precision accuracy. The scheme also helps close the gap between the new improved baseline accuracy and the accuracy when lowering the precision of the weights and activations. The gap between 2-bits weight and 8-bits activation network is now $0 . 4 \% - 0 . 8 \%$ worse than full-precision model. With ImageNet dataset, the accuracy of full-precision networks also improves but very marginally (by $0 . 3 \%$ ). However, the impact of distillation technique on CIFAR-10 is quite pronounced - for example, top-1 error lowers by $1 . 1 \%$ for ResNet-110.
282
+
283
+ ![](images/58b5bef731307b1943dcb500f0772a4d88af24ac4034b21f19ae656eba91abc5.jpg)
284
+ Figure 7: Distillation followed by quantization.
285
+
286
+ We experimented with a variation of scheme-C where a network is first compressed using distillation scheme (using a deeper ResNet as the teacher network) followed by lowering the precision and finetuning. The fine-tuning is done for 35-40 epochs with a very low learning-rate without the influence of any teacher network (no distillation). For this experiment, the student network starts from a higher accuracy compressed model compared to scheme-C (since distillation improves accuracy of student network at full-precision as well). Figure 7 shows the results with this experimental setting. For each configuration, we find the error-rate to lie in between the error-rates shown in Figure 6a and Figure 6b for the corresponding configuration, i.e. this scheme is better than low-precision training from scratch but not as good as training with methodology described in scheme-A. On an average, we find scheme-A to give $0 . 7 \%$ better accuracy at low-precision configurations compared to the scheme mentioned here highlighting the benefits of “joint” low-precision training from scratch with distillation (Apprentice scheme). Many works proposing low-precision knobs advocate for training from scratch or training (for a significant number of epochs) with warm-startup – the conclusions from this experiment are in line with the observations in these papers.
287
+
288
+ # 8 FUTURE RESEARCH
289
+
290
+ Some works proposing low-precision networks advocate for making the layers wider (or the model larger) to recover accuracy at low-precision. These works propose making the layers wider by $2 \mathrm { x }$ or $3 \mathrm { x }$ . While these works show the benefits of low-precision, making the model larger increases the number of raw computations. Future work could investigate low-precision and less layer widening factor (say $1 . 1 0 \mathrm { x }$ or $1 . 2 5 \mathrm { x }$ ). This would help inference latency while maintaining accuracy at-par with baseline full-precision networks.
291
+
292
+ As mentioned in section 5.5, sparsifying a model more than a certain percentage leads to accuracy loss. Investigating hyper-sparse network models without accuracy loss using distillation based schemes is another interesting avenue of further research.
md/train/B1eyO1BFPr/B1eyO1BFPr.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/B1lnbRNtwr/B1lnbRNtwr.md ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GLOBAL RELATIONAL MODELS OF SOURCE CODE
2
+
3
+ Vincent J. Hellendoorn, Petros Maniatis, Rishabh Singh, Charles Sutton, David Bieber Google Research {vhellendoorn,maniatis,rising,charlessutton,dbieber}@google.com
4
+
5
+ # ABSTRACT
6
+
7
+ Models of code can learn distributed representations of a program’s syntax and semantics to predict many non-trivial properties of a program. Recent state-ofthe-art models leverage highly structured representations of programs, such as trees, graphs and paths therein (e.g., data-flow relations), which are precise and abundantly available for code. This provides a strong inductive bias towards semantically meaningful relations, yielding more generalizable representations than classical sequence-based models. Unfortunately, these models primarily rely on graph-based message passing to represent relations in code, which makes them de facto local due to the high cost of message-passing steps, quite in contrast to modern, global sequence-based models, such as the Transformer. In this work, we bridge this divide between global and structured models by introducing two new hybrid model families that are both global and incorporate structural bias: Graph Sandwiches, which wrap traditional (gated) graph message-passing layers in sequential message-passing layers; and Graph Relational Embedding Attention Transformers (GREAT for short), which bias traditional Transformers with relational information from graph edge types. By studying a popular, non-trivial program repair task, variable-misuse identification, we explore the relative merits of traditional and hybrid model families for code representation. Starting with a graph-based model that already improves upon the prior state-of-the-art for this task by $20 \%$ , we show that our proposed hybrid models improve an additional $1 0 { - } 1 5 \%$ , while training both faster and using fewer parameters.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Well-trained models of source code can learn complex properties of a program, such as its implicit type structure (Hellendoorn et al., 2018), naming conventions (Allamanis et al., 2015), and potential bugs and repairs (Vasic et al., 2019). This requires learning to represent a program’s latent, semantic properties based on its source. Initial representations of source code relied on sequential models from natural-language processing, such as $n$ -gram language models (Hindle et al., 2012; Allamanis & Sutton, 2013; Hellendoorn & Devanbu, 2017) and Recurrent Neural Networks (RNNs) (White et al., 2015), but these models struggle to capture the complexity of source code.
12
+
13
+ Source code is rich in structured information, such as a program’s abstract syntax tree, data and control flow. Allamanis et al. (2018b) proposed to model some of this structure directly, providing a powerful inductive bias towards semantically meaningful relations in the code. Their Gated Graph Neural Network (GGNN) model for embedding programs was shown to learn better, more generalizable representations faster than classical RNN-based sequence models.
14
+
15
+ However, the debate on effective modeling of code is far from settled. Graph neural networks typically rely on synchronous message passing, which makes them inherently local, requiring many iterations of message passing to aggregate information from distant parts of the code. However, state-of-the-art graph neural networks for code often use as few as eight message-passing iterations (Allamanis et al., 2018b; Fernandes et al., 2018), primarily for computational reasons: program graphs can be very large, and training time grows linearly with the number of message passes. This is in contrast to, e.g., Transformer models (Vaswani et al., 2017), which allow program-wide information flow at every step, yet lack the powerful inductive bias from knowing the code’s structure.
16
+
17
+ This leads us to a basic research question: is there a fundamental dichotomy between global, unstructured and local, structured models? Our answer is an emphatic no. Our starting point is the sequence-to-pointer model of Vasic et al. (2019), which is state-of-the-art for the task of localizing and repairing a particular type of bug. As a sequence model, their architecture can (at least potentially) propagate information globally, but it lacks access to the known semantic structure of code. To this end, we replace the sequence encoder of Vasic et al. (2019) with a GGNN, yielding a new graph-to-mutlihead-pointer model. Remarkably, this model alone yields a $2 0 \%$ improvement over the state of the art, though at the cost of being significantly larger than the sequence model.
18
+
19
+ Motivated by this result, we propose two new families of models that efficiently combine longerdistance information, such as the sequence model can represent, with the semantic structural information available to the GGNN. One family, the Graph Sandwich, alternates between message passing and sequential information flow through a chain of nodes within the graph; the other, the Graph Relational Embedding Attention Transformer (GREAT), generalizes the relative position embeddings in Transformers by Shaw et al. (2018) to convey structural relations instead. We show that our proposed model families outperform all prior results, as well as our new, already stronger baseline by an additional $10 \%$ each, while training both substantially faster and using fewer parameters.
20
+
21
+ # 2 RELATED WORK
22
+
23
+ Distributed Representation of Programs: There has been increasing interest in modeling source code using machine learning (Allamanis et al., 2018a). Hindle et al. (2012) model programs as sequences of tokens and use an $n$ -gram model for predicting code completions. Raychev et al. (2015) use conditional random fields (CRFs) to predict program properties over a set of pairwise program features obtained from the program’s dependency graph. Many approaches use neural language models to embed programs as sequences of tokens (Bhoopchand et al., 2016; White et al., 2015). Some techniques leverage the ASTs of programs in tree-structured recurrent models (Piech et al., 2015; Parisotto et al., 2016; Chen et al., 2018). code2vec (Alon et al., 2018) and code2seq (Alon et al., 2019) model programs as a weighted combination of a set of leaf-to-leaf paths in the abstract syntax tree. Finally, Allamanis et al. (2018b) proposed using GGNNs for embedding program graphs consisting of ASTs together with control-flow and data-flow edges. Some recent models of code embed run-time information of programs, e.g., program traces, besides syntactic information (Wang et al., 2018). In this paper, we explore the space of combining sequence-based and graph-based representations of programs, as well as introduce a Transformer-based model with additional program-edge information to learn program representations. Fernandes et al. (2018) also combine an RNN and a GNN architecture, achieving slight improvements over a GGNN. However, they only consider a single RNN layer inserted at the start; we include larger and more diverse hybrids, as well as entirely different combinations of structural and sequential features.
24
+
25
+ Neural Program Repair: Automatically generating fixes to repair program bugs is an active field of research with many proposed approaches based on genetic programming, program analysis and formal methods, and machine learning (Monperrus, 2018; Gazzola et al., 2019). In this paper, we focus on a specific class of repair task called VarMisuse as proposed by Allamanis et al. (2018b), who use a graph-based embedding of programs to predict the most likely variable at each variable-use location and generate a repair prediction whenever the predicted variable is different from the one present, using an enumerative approach. Vasic et al. (2019) improved this approach by jointly predicting both the bug and repair locations using a two-headed pointer mechanism. Our multi-headed pointer graph, graph-sandwich and GREAT models significantly outperform these approaches.
26
+
27
+ # 3 SEMI-STRUCTURED MODELS OF SOURCE CODE
28
+
29
+ Models of code have so far either been structured (GNNs) or unstructured (RNNs, Transformers). Considering the graph-based models’ substantially superior performance compared to RNNs despite their locality limitations, we may ask: to what extent could global information help GNNs, and to what extent could structural features help sequence-based models?
30
+
31
+ # 3.1 MODELS
32
+
33
+ We address the questions of combining local and global information with two families of models.
34
+
35
+ Graph-sandwich Models Let $T = \langle t _ { 1 } , t _ { 2 } , \cdot \cdot \cdot , t _ { n } \rangle$ denote a program’s token sequence and $\mathcal { G } =$ $( \nu , \mathcal { E } )$ denote the corresponding program graph, where $\nu$ is the set of node vertices and $\mathcal { E }$ is the list of edge sets for different edge types. In both graph and sequence based models, the nodes $v$ maintain a state vector $h ^ { ( v ) }$ that is initialized with initial node embedding $\boldsymbol { x } ^ { ( v ) } \in \mathbb { R } ^ { D }$ .
36
+
37
+ In a GGNN layer, messages of type $k$ are sent from each node $v \in \mathcal V$ to its neighbors computed as mk $m _ { k } ^ { ( v ) } = \mathrm { L i n e a r L a y e r } _ { k } ( h ^ { ( v ) } )$ . After the message passing step, the set of messages at each node are aggregated as $\begin{array} { r } { m ^ { ( v ) } \ = \ \Sigma _ { e _ { k } ( u , v ) \in \mathcal { E } } \ m _ { k } ^ { ( u ) } } \end{array}$ Finally, the state vector of a node $v$ is updated as $h _ { \mathrm { n e w } } ^ { ( v ) } = \mathrm { G R U } ( m ^ { ( v ) } , h ^ { ( v ) } )$ . In aated as e of a node . A Transfo $v$ (correspondmer compute l, $t _ { i }$ $T$ $h _ { \mathrm { n e w } } ^ { ( v ) } = f ( t _ { v } , h ^ { ( t _ { i - 1 } ) } )$ $t _ { v } \mathbf { q _ { t } } , \mathbf { k _ { t } } , \mathbf { v _ { t } }$ corresponding to a query, key and value for each token.1 Each token then computes its attention to√ all other tokens using $e _ { i j } = ( { \bf q _ { i } } { \bf k _ { j } } ^ { \top } ) / \sqrt { N } ,$ 2 which can be soft-maxed to yield attention probabilities $a _ { i j } = \exp ( e _ { i j } ) / \Sigma \exp ( \bar { e } _ { i , : } )$ .
38
+
39
+ Our first class of models follows from the observation that $T \subseteq V$ ; i.e., the source code tokens used by sequence models, like RNNs, are by definition also nodes in the program graph, so GGNNs update their state with every message pass. We can thus envision a combined model that uses each of these as a building block; for instance, assuming initial node features $\boldsymbol { x } ^ { ( v ) } \in \mathbb { R } ^ { D }$ , the formula [RNN, GGNN(3), RNN] describes a model in which we first run an RNN on all tokens $\in \mathcal { T }$ (in lexical ordering), then, using these as initial states for $v \in T$ while using the default node-type embeddings for all other nodes, run three message passing steps using a GGNN, after which we again gather the nodes corresponding to $T$ and update their state with an additional RNN pass.
40
+
41
+ The resulting family of models alternates GGNN-style message passing operations and layers of sequence-based models. By varying the number and size of sequential layers and blocks of GGNNstyle message passing, this variant particularly provides insight into the first question above (how can global information help GNNs?), by showing the transition in performance potential of models that increasingly incorporate sequential features. We refer to this class of models as sandwich models.
42
+
43
+ Graph Relational Embedding Attention Transformer The above family of models still rely on explicit message passing for their structural bias, thereby only indirectly combining structural and global information to the model. We may wish to instead directly encode structural bias into a sequence-based model, which requires a relaxation of the ‘hard’ inductive bias from the GGNN. For Transformer-based architectures, Shaw et al. (2018) show that relational features can be incorporated directly into the attention function by changing the attention computation to:3√ $e _ { i j } = ( { \bf q _ { i } } + b _ { i j } ) { { \bf k _ { j } } ^ { \top } } / \sqrt { N }$ where ${ \bf q _ { i } }$ and $\mathbf { k _ { j } }$ correspond to the query and key vectors as described above, $b _ { i j }$ is an added bias term for the specific attention weight between tokens $i$ and $j$ , and $N$ is the per-head attention dimension. In our case, we compute $b _ { i j } = W _ { e } ^ { \top } { \mathbf e } + b _ { e }$ , where $W _ { e } \in \mathbb { R } ^ { N } , b _ { e } \in \mathbb { R }$ , and $\mathbf { e } \in \mathbb { R } ^ { N }$ is an embedding of the edge type connecting nodes $i$ and $j$ , if any. If multiple edge types are present between two nodes, the resulting biases are simply added. We name this model GREAT, for Graph Relational Embedding Attention Transformer.
44
+
45
+ # 3.2 ARCHITECTURAL DETAILS
46
+
47
+ In this section, we present details of different architectures we compare and their hyperparameters.
48
+
49
+ General: All of our models follow the structure proposed by Vasic et al. (2019), stacking an initial token-embedding layer, a ‘core’ model that computes a distributed representation of the code under inspection (in their case, an LSTM), followed by a projection into two pointers for the localization and repair tasks (see Section 4). This core model is the part varied in our work. We use
50
+
51
+ SubwordTextEncoder from Tensor2Tensor (Vaswani et al., 2018) to generate a 10K sub-token vocabulary from training data and embed each token by averaging embeddings of its sub-token(s).
52
+
53
+ GGNN: Many types of graph-based message-passing neural networks have been proposed for code, mostly differing in how a node’s state is updated based on ‘messages’ sent by nodes it is connected to. Most commonly used is the gated graph neural network (GGNN) (Li et al., 2015), which uses a GRU cell (Cho et al., 2014) to update a node’s state. Although other options sometimes outperform this architecture, the improvements are generally minor, so we rely on this model for our baseline. One hyperparameter of the architecture is whether to use different transformations at each message-passing step, or to reuse one set of transformations for multiple message passes. Following Allamanis et al. (2018b), we use blocks of two message-passing layers, in which the first layer is repeated three times, for four message passes per block. We then sweep over GGNN architectures that repeat these blocks 1 to 4 times (thus yielding 4 to 16 message passes). By default, the message dimension is set to 128, but we include an ablation with 256-dimensional messages as well.
54
+
55
+ RNNs: We experimented with the one-directional entailment-attention-based RNN proposed by Vasic et al. (2019), but found a simpler bi-directional RNN architecture to work even better. We use GRUs as the recurrent cells, vary the number of layers from 1 to 3, and the hidden dimension (of the concatenated forward and backward component) in $\{ 1 2 8 , 2 5 6 , 5 1 2 \}$ .
56
+
57
+ Transformers: We base our architecture on the original Transformer (Vaswani et al., 2017), varying the number of layers from 1 to 10 and the attention dimension in $\{ 1 2 8 , 2 5 6 , 5 1 2 , 1 0 2 4 \}$ .
58
+
59
+ Sandwich Models: We distinguish between two types of sandwich models: ‘small’ sandwiches, which add a single RNN or Transformer to a GGNN architecture, and ‘large’ sandwiches, which wrap every message-passing block (as defined above) with a 128-dimensional (bi-directional) RNN/Transformer layer. We vary the number of message-passing blocks from 1 to 3 (corresponding to 4 to 12 message passes) to span a similar parameter domain as the GGNNs above (ca. $1 . 5 { \mathbf { M } } -$ 5M), increasing the number of layers to 2 and their dimension to 512 for a later ablation.
60
+
61
+ GREAT: Uses the same architectural variations as the Transformer family; edge-type embedding dimensions are fixed at the per-head attention dimension, as described above.
62
+
63
+ Global hyper-parameters: We train most of our models with batch sizes of $\{ 1 2 . 5 \mathrm { K } , 2 5 \mathrm { K } , 5 0 \mathrm { K } \}$ tokens, with the exception of the Transformer architectures; due to the quadratic nature of the attention computation, 25K tokens was too large for these models, so we additionally trained these with 6.25K-token batches.4 Learning rates were varied in $\left\{ 1 \mathrm { e } { - } 3 , 4 \mathrm { - } \mathrm { e } 4 , 1 \mathrm { e } { - } 4 , 4 \mathrm { e } { - } 5 , 1 \mathrm { e } { - } 5 \right\}$ using an Adam optimizer, where we omitted the first option for our GGNN models and the last for our RNNs due to poor performance. Sub-tokens were embedded using 128-dimensional embeddings.
64
+
65
+ Hardware: all our models were trained on a single Tesla P100 GPU on 25 million samples, which required between 40 and 250 hours for our various models. However, we emphasize that overall training time is not our main objective; we primarily assess the ultimated converged accuracy of our models and present training behavior over time for reference of our various models’ training behavior.
66
+
67
+ # 3.3 ABOUT GRAPH REPRESENTATIONS OF CODE
68
+
69
+ Our program graphs borrow many edge types from Allamanis et al. (2018b), such as data-flow (e.g., read & write), adjacent-token, and syntactic edges, which we further augment with edges between control-flow statements and function calls. When representing programs as graphs, a key decision needs to be made regarding the Abstract Syntax Tree (AST). Typically, one of the edge types in the graphs represents syntactic parent-child relationships in the AST. Additionally, some of the edges representing relations (e.g., control-flow) are naturally represented as edges between internal nodes in this tree, e.g., between two IfStatement nodes. However, ablations often find that the effectiveness of including the AST is limited in graph-based models (Allamanis et al., 2018b).
70
+
71
+ This raises the question of whether it is possible to represent programs as graphs that include sequential and semantic information, but not syntax. To this end, we propose a leaves-only graph representation for code as follows: edges that represent semantic relationships such as control flow and data flow can easily be moved down from internal nodes – which typically represent a span of multiple tokens – to those leaf nodes in the graph that represent the begin token of that span. Thus, an edge that used to connect two IfStatement interior AST nodes is moved down to connect the corresponding if tokens. Now, the AST can be omitted entirely, thereby removing parent-child relations among syntax nodes, producing what we call a leaves-only graph. This latter representation is substantially more compressed than the graphs with ASTs, often using $2 { - } 3 \mathbf { x }$ fewer nodes (while retaining most of the edges), and additionally aligns better with sequence-based models, because all edges are directly connected to the original code tokens.5 We compare both settings for each graph-based model, but unless otherwise specified, we use the ‘full’ graphs for the regular GGNN model and the ‘leaves-only’ graphs (without ASTs) for the sandwich and GREAT models.
72
+
73
+ # 4 EXPERIMENTAL SETUP
74
+
75
+ The VarMisuse Task We focus our study on the variable-misuse localization-and-repair task (Vasic et al., 2019): given a function, predict two pointers into the function’s tokens, one pointer for the location of a variable use containing the wrong variable (or a special no-bug location), and one pointer for any occurrence of the correct variable that should be used at the faulty location instead.
76
+
77
+ Synthetic Dataset We used the ETH Py150 dataset (Raychev et al., 2016), which is based on GitHub Python code, and already partitioned into train and test splits (100K and 50K files, respectively). We further split the 100K train files into 90K train and 10K validation examples and applied a deduplication step on that dataset (Allamanis, 2018). We extracted all top-level function definitions from these files; any function that uses multiple variables can be turned into a training example by randomly replacing one variable usage with another. As there may be many candidates for such bugs in a function, we limit our extraction to up to three samples per function to avoid biasing our dataset too strongly towards longer functions. For every synthetically generated buggy example, an unperturbed, bug-free example of the function is included as well, to keep our dataset balanced, yielding ca. 2M total training and 755K test samples. Finally, we train with functions with up to 250 tokens; at test time, we raise this to 1,000 to study our models’ generalization to longer functions.
78
+
79
+ Metrics As we are mainly interested in contrasting the behavior of different models of code, we focus most of our results on the various models’ learning curves by tracking development-set accuracy on 25K held-out samples every 250K samples as the models train. Here, we measure two accuracy metrics: localization accuracy (whether the model correctly identifies the bug’s location for buggy samples); and (independently) repair accuracy (whether the model points to the correct variable to repair the bug). Note that these metrics focus on buggy samples; the models also determine whether a function is buggy, which we discuss below. We group all models by their ‘family’, as categorized in Section 3.2, reporting the maximum held-out performance per family.
80
+
81
+ For deeper insight into the fully trained models’ performance, we also analyze the performance of the best models in each family in more depth on the test portion of our synthetic dataset. Specifically, we assess their bugginess-classification accuracy (whether the model correctly identifies the method as (non-)buggy) and their joint localization and repair accuracy (for buggy samples, how often the model correctly localizes and repairs the bug). Here, we also increase the maximum function size to 1,000 tokens and analyze the impact of longer functions on our models’ performance.
82
+
83
+ # 4.1 DATA & CODE RELEASE
84
+
85
+ We release a public implementation of the GREAT model based on Tensorflow, as well as the program graphs for all samples in our training and evaluation datasets whose license permits us to redistribute these at: https://doi.org/10.5281/zenodo.3668323, which tracks the latest release of our Github repository at: https://github.com/VHellendoorn/ ICLR20-Great.
86
+
87
+ # 5 RESULTS
88
+
89
+ There are many degrees of freedom in our family of models, so we structure our results around a series of comparisons, which we analyze and discuss in this section. We start with our key result, which compares all our model families (RNNs, Transformers, GGNNs, Sandwich hybrids, and GREAT models) across a comparable parameter domain (ca. 1.4M – 5.5M parameters) in Figure 1.
90
+
91
+ ![](images/96061ba572ebf13a72a349a63a2a4c26ec4970bd22d2b93d03adfbc9020773de.jpg)
92
+ Figure 1: Comparison of top-performing models from all model families across a comparable parameter domain of $1 . 5 \mathrm { M } - 5 \mathrm { M }$ parameters. Performance visualized using the localization (left) and repair (right) accuracy Pareto fronts w.r.t. both training time (top) and number of training samples seen (bottom), both log-scaled, where an epoch is ca. 2M samples. In all cases, our proposed models substantially outperform GGNNs from early in the training process.
93
+
94
+ Although there are subtle differences between the models’ behavior on localization and repair accuracy, the overall picture is consistent: whereas our newly proposed graph-to-multihead-pointer models already substantially outperform RNN-based models (the previous state-of-the-art), and sometimes Transformers, the hybrid global & structured models achieve significantly better results faster.
95
+
96
+ Time-wise (the top two figures), the GGNN models take the longest to converge, continuing to improve slightly even after a week of training mainly because their largest (16-layer) architecture starts to dominate the 12-layer version’s performance after ca. 170h. The Sandwich models follow its training curve, but are more accurate and faster to converge, achieving especially good results for limited training budgets, partly because they succeeded with just 4 – 8 layers of message passing by relying on their global components.
97
+
98
+ The Transformer architecture, although slower at first, widely outperforms the RNN as a baseline model. The GREAT model tracks its learning curve, starting out slower than the models with explicit message passing, but gradually overtaking them after ca. 10h, as the underlying Transformer becomes increasingly effective. We note that this model achieves state-of-the-art results despite having, at the time of this writing, received less training time (ca. 64h compared to up to 240h).
99
+
100
+ The bottom half of Figure 1 abstracts away the potentially confounding issue of implementation speed of our models by tracking performance w.r.t the number of training samples. Naturally, the end-points of the curves (the converged accuracy) are identical, but importantly the various models’ training curves are quite similar; even here, the GGNN is only able to outperform some of our proposed models briefly, yielding inferior performance to all within just one epoch.
101
+
102
+ The RNN and GGNN models appear to be particularly complementary; even though the RNN’s localization accuracy is very poor compared to the GGNN, the combined model still sustains a ${ \sim } 5 \%$ improvement on the latter.6 However, the Transformer Sandwich does not seem to benefit similarly, showing virtually no difference in performance with the RNN Sandwich model. This strongly suggests that the Transformer’s ability to access long-distance information overlaps in large part (though not entirely, given GREAT’s performance) with the GGNNs’ ability to do so using message passing. We conjecture that the Transformer learns to infer many of the same connections (e.g., data-flow, control-flow) that are encoded explicitly in the graph’s message passing.
103
+
104
+ To understand the behavior of the many models and combinations that may be used for code, we now explore the variations on our choices of parameters, models, and metrics.
105
+
106
+ # 5.1 LARGER MODELS
107
+
108
+ Model capacity is a potential threat to any comparison between models of different families. We aimed to ensure a fair comparison in the previous section by selecting a range of hyper-parameters (which includes the number of stacked layers) for these architectures that span a similar parameter count range. For instance, a 6-layer Transformer with 512-dimensional attention is comparable to a 2-layer 512-dimensional bi-directional RNN and an 8-layer GGNN. However, all these architectures are relatively modest, having at most ${ \sim } 5 \mathbf { M }$ parameters. By increasing the number, and dimensionality of their layers, we can evaluate a second family of models with ca. 5–20M parameters.
109
+
110
+ Figure 2 shows the performance for the low- and high-parameter variations for each of our bestperforming model families. Overall, while providing more parameters to the GGNNs made virtually no difference, all our hybrid models increase $2 - 3 \%$ in both localization and repair accuracy, providing further support for combining global, structured models. The best-performing instances of each model family were consistently the larger architectures, 15M parameters for the GGNN, 12.5M & 10M for the RNN and Transformer Sandwiches respectively and 7.9M for GREAT.7
111
+
112
+ ![](images/891bb76b8b22cc3f22d8d35865dbfce9b0f0a82d9df045cca8830b19b5be6265.jpg)
113
+ Figure 2: Comparison of smaller (1.5–5M parameter) and larger (5–20M parameter, identified with $\cdot _ { + + } ,$ variants of each model family. Localization and repair accuracy Pareto-front w.r.t. time.
114
+
115
+ # 5.2 ON SYNTACTIC INFORMATION
116
+
117
+ In the previous results, the GGNN models were trained on ‘full’ graphs (as described in Section 3.3), that use the code’s AST structure, and the sandwich models on ‘leaves-only’ graphs, with only source token nodes, and edges moved to connect these directly. These settings are arguably each appropriate to the underlying model, but both models can also use the alternative setting.
118
+
119
+ ![](images/a820488f09223f97e60319c333a9fc46ccb028312e07b0032199bdaa49aa909f.jpg)
120
+ Figure 3: Comparing impact of graph representation on GGNNs and RNN Sandwich models. Localization and repair accuracy Pareto-front w.r.t time. Note: y-axis cropped to simplify comparison.
121
+
122
+ Figure 3 shows the training curves for the alternative settings. In all cases, the models that do not use syntax train substantially faster because each sample’s graph representation is more than twice as small, so these models naturally lead in accuracy early on in training. However, whereas the GGNN equipped with syntax overtakes its counter-part within ca. 48h, the sandwich models display a much longer lag, with no cross-over observed at all on localization accuracy in this time window.8
123
+
124
+ The sandwich model on full graphs still compares favorably with the GGNN baseline, though its early training behavior is not as effective. It is also interesting to note that the best-performing Sandwich models in this setting were consistently architectures with more message-passing steps. This may be due to the additional distance between information propagated along the tokens and along semantic edges, which in this setting are almost universally connected to AST-internal nodes.
125
+
126
+ # 5.3 RNNS IN SANDWICHES: SINGLE VS. MANY
127
+
128
+ Recent work on neural summarization also mixed RNNs and GGNNs (Fernandes et al., 2018), but did so by inserting a single RNN layer into a GNN architecture, before any message passing. We compare this architecture to a full Sandwich model in Figure 4. Although a single RNN certainly helps compared to the GGNN, interleaving RNNs and GGNN-style message passes performed substantially better. In fact, the best performing full Sandwiches used fewer parameters than the Single models because they used 8 message passes instead of 12, relying more heavily on the RNNs.9
129
+
130
+ # 5.4 TEST-SET ANALYSIS
131
+
132
+ Having identified our best-performing models in each family, we now study their performance on the test data, specifically using the metrics used in Vasic et al. (2019) (see Section 4) in Table 1. In general, the two metrics correlated well; models that accurately determined whether a function contained a bug also accurately identified the bug (and repair), as may be expected. The baseline RNN model achieves a modest $44 \%$ accuracy at the latter task; this is slightly lower than reported in prior work (Vasic et al., 2019), which is likely due in part to our dataset de-duplication. Transformers and GGNNs perform substantially better (and comparably, though the latter trained 6x longer for this performance), but still fall well short of our hybrid models’ performance, which are especially much more accurate on long functions. The GREAT model shows most promise on the repair task, already outperforming the sandwich models despite having so far had limited training time.
133
+
134
+ ![](images/4e04d6ea7dd5bfb2ef01a6dfd6d452ab0dbf57732e286b392cbf2337a905571b.jpg)
135
+ Figure 4: Comparison of RNN sandwiches with a single RNN vs. those with RNNs around every message-passing block (‘Multi’). Localization and repair accuracy Pareto-front w.r.t. time.
136
+
137
+ Table 1: Test-set results of best-performing models by family, on metrics of Vasic et al. (2019). Grouped by maximum length; $6 . 5 \%$ of test set samples exceeded 250 tokens (the training limit).
138
+
139
+ <table><tr><td rowspan=1 colspan=4>Model Family</td><td rowspan=1 colspan=1>Class. Accuracy≤ 250 ≤1000</td><td rowspan=1 colspan=1>Loc &amp; Rep Accuracy≤ 250 ≤1000</td><td rowspan=1 colspan=1>Parameters</td><td rowspan=1 colspan=1>TrainingTime</td></tr><tr><td rowspan=1 colspan=4>RNN1</td><td rowspan=1 colspan=1>71.8% 70.6%</td><td rowspan=1 colspan=1>44.4% 42.5%</td><td rowspan=1 colspan=1>4.3M</td><td rowspan=1 colspan=1>31.3h</td></tr><tr><td rowspan=3 colspan=4>TransformerGGNN</td><td rowspan=1 colspan=1>75.9% 73.2%</td><td rowspan=1 colspan=1>67.7% 63.0%</td><td rowspan=1 colspan=1>3.7M</td><td rowspan=1 colspan=1>41.5h</td></tr><tr><td rowspan=1 colspan=2></td><td rowspan=1 colspan=2>GGNN</td><td rowspan=1 colspan=1>81.4% 79.2%</td><td rowspan=1 colspan=1>64.0% 60.9%</td><td rowspan=1 colspan=1>5.5M</td><td rowspan=1 colspan=1>241h</td></tr><tr><td rowspan=2 colspan=4>RNN Sandwich</td><td></td><td></td><td></td><td></td></tr><tr><td rowspan=1 colspan=1>82.5% 81.9%</td><td rowspan=1 colspan=1>75.8% 73.8%</td><td rowspan=1 colspan=1>12.6M</td><td rowspan=1 colspan=1>109h</td></tr><tr><td rowspan=1 colspan=4>Transformer Sandwich</td><td rowspan=1 colspan=1>81.1% 78.1%</td><td rowspan=1 colspan=1>74.5% 71.4%</td><td rowspan=1 colspan=1>10M</td><td rowspan=1 colspan=1>161h</td></tr><tr><td rowspan=1 colspan=4>GREAT</td><td rowspan=1 colspan=1>80.1% 76.9%</td><td rowspan=1 colspan=1>76.4% 73.1%</td><td rowspan=1 colspan=1>7.9M</td><td rowspan=1 colspan=1>120h</td></tr></table>
140
+
141
+ 1: a stronger version of the model proposed in Vasic et al. (2019) (previous SOTA).
142
+
143
+ # 5.5 REAL BUGS ANALYSIS
144
+
145
+ We want to ensure that our models can be useful for real bugs and do not simply overfit to the synthetic data generation that we used. This risk exists because we did not filter our introduced bugs based on whether they would be difficult to detect, for instance because they conflate variables with similar names, usage, or data types; presumably, such bugs are more likely to escape a developer’s notice and find their way into real code bases. It is therefore expected that performance on realworld bugs will be lower for all our models, but we must assert that our proposed models do not just outperform GGNNs on synthetic data, e.g. by memorizing characteristics of synthetic bugs.
146
+
147
+ To mitigate this threat, we collect real variable misuse bugs from code on Github. Specifically, we collect ca. 1 million commits that modify Python files from Github. We extracted all changes to functions from these commits, filtering these according to the same criteria that we used to introduce variable-misuse bugs: we looked for commits that exclusively changed a single variable usage in a function body from one variable in scope to another. We focus on functions with up to 250 tokens, since all our models performed substantially better on these in Table 1. We identified 170 such changes, in which we assumed that the version before the change was buggy and the updated version correct. We removed any functions that had occurred in our training data, of which we found 9 and paired the remaining functions up (correct and buggy) to create a real-world evaluation set with 322 functions, which we presented to our models.
148
+
149
+ Table 2 shows the results of running our various models on these bugs. In general, these were clearly substantially more difficult for all our models than the synthetic samples we generated. However, we see a clear difference in performance with all our proposed models performing substantially better than previous baselines, and showing favorable precision/recall trade-offs.
150
+
151
+ Table 2: Results on 322 paired buggy and non-buggy samples from 161 real variable misuse bugs mined from Github commits. ‘Class.’ measures accuracy at identifying non-buggy samples; ‘Prec.’ and ‘Rec.’ capture the precision and recall at identifying the correct localization and repair on the buggy samples.
152
+
153
+ <table><tr><td>Model Family</td><td colspan="2"> All Samples</td><td>Precision at Recall = 5%</td><td>Precision at Recall = 10%</td></tr><tr><td>RNN</td><td>Class. Prec. 52.8% 13.3%</td><td>Rec. 46.6%</td><td>44.4%</td><td>23.5%</td></tr><tr><td>Transformer</td><td>62.1% 15.8%</td><td>47.2%</td><td>33.3%</td><td>17.6%</td></tr><tr><td>GGNN</td><td>65.8% 17.7%</td><td>42.2%</td><td>44.4%</td><td>23.5%</td></tr><tr><td>RNN Sandwich</td><td>69.6% 28.6%</td><td>43.5%</td><td>77.8%</td><td>64.7%</td></tr><tr><td>Trans.Sandwich</td><td>75.2% 21.5%</td><td>40.4%</td><td>33.3%</td><td>35.3%</td></tr><tr><td>GREAT</td><td>70.2% 23.7%</td><td>36.7%</td><td>44.4%</td><td>29.4%</td></tr></table>
154
+
155
+ # 6 CONCLUSION
156
+
157
+ We demonstrate that models leveraging richly structured representations of source code do not have to be confined to local contexts. Instead, models that leverage only limited message passing in combination with global models learn much more powerful representations faster. We proposed two different architectures for combining local and global information: sandwich models that combine two different message-passing schedules and achieve highly competitive models quickly, and the GREAT model which adds information from a sparse graph to a Transformer to achieve stateof-the-art results. In the process, we raise the state-of-the-art performance on the VarMisuse bug localization and repair task by over $30 \%$ .
158
+
159
+ # REFERENCES
160
+
161
+ Miltiadis Allamanis. The adverse effects of code duplication in machine learning models of code. CoRR, abs/1812.06469, 2018. URL http://arxiv.org/abs/1812.06469.
162
+
163
+ Miltiadis Allamanis and Charles Sutton. Mining source code repositories at massive scale using language modeling. In Working Conference on Mining Software Repositories (MSR), 2013.
164
+
165
+ Miltiadis Allamanis, Earl T Barr, Christian Bird, and Charles Sutton. Suggesting accurate method and class names. In Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering, pp. 38–49. ACM, 2015.
166
+
167
+ Miltiadis Allamanis, Earl T. Barr, Premkumar Devanbu, and Charles Sutton. A survey of machine learning for big code and naturalness. ACM Comput. Surv., 51(4):81:1–81:37, July 2018a. ISSN 0360-0300.
168
+
169
+ Miltiadis Allamanis, Marc Brockschmidt, and Mahmoud Khademi. Learning to represent programs with graphs. In International Conference on Learning Representations, 2018b.
170
+
171
+ Uri Alon, Meital Zilberstein, Omer Levy, and Eran Yahav. code2vec: Learning distributed representations of code. CoRR, abs/1803.09473, 2018.
172
+
173
+ Uri Alon, Shaked Brody, Omer Levy, and Eran Yahav. code2seq: Generating sequences from structured representations of code. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019, 2019.
174
+
175
+ Avishkar Bhoopchand, Tim Rocktaschel, Earl Barr, and Sebastian Riedel. Learning python code ¨ suggestion with a sparse pointer network. arXiv preprint arXiv:1611.08307, 2016.
176
+
177
+ Xinyun Chen, Chang Liu, and Dawn Song. Tree-to-tree neural networks for program translation. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 2547–2557. Curran Associates, Inc., 2018. URL http://papers.nips.cc/paper/ 7521-tree-to-tree-neural-networks-for-program-translation.pdf.
178
+
179
+ Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Hol- ¨ ger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014.
180
+
181
+ Patrick Fernandes, Miltiadis Allamanis, and Marc Brockschmidt. Structured neural summarization. arXiv preprint arXiv:1811.01824, 2018.
182
+
183
+ Luca Gazzola, Daniela Micucci, and Leonardo Mariani. Automatic software repair: A survey. IEEE Trans. Software Eng., 45(1):34–67, 2019.
184
+
185
+ Vincent J Hellendoorn and Premkumar Devanbu. Are deep neural networks the best choice for modeling source code? In Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering, pp. 763–773. ACM, 2017.
186
+
187
+ Vincent J Hellendoorn, Christian Bird, Earl T Barr, and Miltiadis Allamanis. Deep learning type inference. In Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, pp. 152–162. ACM, 2018.
188
+
189
+ Abram Hindle, Earl T. Barr, Zhendong Su, Mark Gabel, and Premkumar Devanbu. On the naturalness of software. In Proceedings of the 34th International Conference on Software Engineering, ICSE ’12, pp. 837–847, 2012.
190
+
191
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks, 2015.
192
+
193
+ Martin Monperrus. Automatic software repair: A bibliography. ACM Comput. Surv., 51(1):17:1– 17:24, January 2018. ISSN 0360-0300.
194
+
195
+ Emilio Parisotto, Abdel-rahman Mohamed, Rishabh Singh, Lihong Li, Dengyong Zhou, and Pushmeet Kohli. Neuro-symbolic program synthesis. CoRR, abs/1611.01855, 2016. URL http: //arxiv.org/abs/1611.01855.
196
+
197
+ Chris Piech, Jonathan Huang, Andy Nguyen, Mike Phulsuksombati, Mehran Sahami, and Leonidas Guibas. Learning program embeddings to propagate feedback on student code. In Proceedings of the 32Nd International Conference on International Conference on Machine Learning - Volume 37, ICML’15, pp. 1093–1102, 2015.
198
+
199
+ Veselin Raychev, Martin Vechev, and Andreas Krause. Predicting program properties from ”big code”. In Proceedings of the 42Nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’15, pp. 111–124, 2015.
200
+
201
+ Veselin Raychev, Pavol Bielik, and Martin T. Vechev. Probabilistic model for code with decision trees. In Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2016, part of SPLASH 2016, Amsterdam, The Netherlands, October 30 - November 4, 2016, pp. 731–747, 2016.
202
+
203
+ Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. Self-attention with relative position representations. arXiv preprint arXiv:1803.02155, 2018.
204
+
205
+ Marko Vasic, Aditya Kanade, Petros Maniatis, David Bieber, and Rishabh Singh. Neural program repair by jointly learning to localize and repair. arXiv preprint arXiv:1904.01720, 2019.
206
+
207
+ 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.
208
+
209
+ Ashish Vaswani, Samy Bengio, Eugene Brevdo, Franc¸ois Chollet, Aidan N. Gomez, Stephan Gouws, Llion Jones, Lukasz Kaiser, Nal Kalchbrenner, Niki Parmar, Ryan Sepassi, Noam Shazeer, and Jakob Uszkoreit. Tensor2tensor for neural machine translation. In Proceedings of the 13th Conference of the Association for Machine Translation in the Americas, AMTA 2018, Boston, MA, USA, March 17-21, 2018 - Volume 1: Research Papers, pp. 193–199, 2018. URL https://www.aclweb.org/anthology/W18-1819/.
210
+
211
+ Ke Wang, Rishabh Singh, and Zhendong Su. Dynamic neural program embeddings for program repair. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings, 2018.
212
+
213
+ Martin White, Christopher Vendome, Mario Linares-Vasquez, and Denys Poshyvanyk. Toward ´ deep learning software repositories. In Proceedings of the 12th Working Conference on Mining Software Repositories, pp. 334–345. IEEE Press, 2015.
md/train/B1uvH_gC-/B1uvH_gC-.md ADDED
@@ -0,0 +1,238 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PARAMETRIC MANIFOLD LEARNING VIA SPARSEMULTIDIMENSIONAL SCALING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We propose a metric-learning framework for computing distance-preserving maps that generate low-dimensional embeddings for a certain class of manifolds. We employ Siamese networks to solve the problem of least squares multidimensional scaling for generating mappings that preserve geodesic distances on the manifold. In contrast to previous parametric manifold learning methods we show a substantial reduction in training effort enabled by the computation of geodesic distances in a farthest point sampling strategy. Additionally, the use of a network to model the distance-preserving map reduces the complexity of the multidimensional scaling problem and leads to an improved non-local generalization of the manifold compared to analogous non-parametric counterparts. We demonstrate our claims on point-cloud data and on image manifolds and show a numerical analysis of our technique to facilitate a greater understanding of the representational power of neural networks in modeling manifold data.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The characterization of distance preserving maps is of fundamental interest to the problem of nonlinear dimensionality reduction and manifold learning. For the purpose of achieving a coherent global representation, it is often desirable to embed the high-dimensional data into a space of low dimensionality while preserving the metric structure of the data manifold. The intrinsic nature of the geodesic distance makes such a representation depend only on the geometry of the manifold and not on how it is embedded in ambient space. In the context of dimensionality reduction this property makes the resultant embedding meaningful.
12
+
13
+ The success of deep learning has shown that neural networks can be trained as powerful function approximators of complex attributes governing various visual and auditory phenomena. The availability of large amounts of data and computational power, coupled with parallel streaming architectures and improved optimization techniques, have all led to computational frameworks that efficiently exploit their representational power. However, a study of their behavior under geometric constraints is an interesting question which has been relatively unexplored.
14
+
15
+ In this paper, we use the computational infrastructure of neural networks to model maps that preserve geodesic distances on data manifolds. We revisit the classical geometric framework of multidimensional scaling to find a configuration of points that satisfy pairwise distance constraints. We show that instead of optimizing over the individual coordinates of the points, we can optimize over the function that generates these points by modeling this map as a neural network. This makes the complexity of the problem depend on the number of parameters of the network rather than the number of data points, and thus significantly reduces the memory and computational complexities, a property that comes into practical play when the number of data points is large. Additionally, the choice of modeling the isometric map with a parametric model provides a straightforward out-of-sample extension, which is a simple forward pass of the network.
16
+
17
+ We exploit efficient sampling techniques that progressively select landmark points on the manifold by maximizing the spread of their pairwise geodesic distances. We demonstrate that a small amount of these landmark points are sufficient to train a network to generate faithful low-dimensional embeddings of manifolds. Figure 1 provides a visualization of the proposed approach. In the interest of gauging their effectiveness in representing manifolds, we perform a numerical analysis to measure the quality of embedding generated by neural networks and associate an order of accuracy to a given architecture. Finally, we demonstrate that parametric models provide better non-local generalization as compared to extrapolation formulas of their non-parametric counter parts.
18
+
19
+ ![](images/70625e1c8d170a331b7b17b153db79441811a3f732f614c93d90325b141700b4.jpg)
20
+ Figure 1: Learning to unfurl a ribbon: A three dimensional Helical Ribbon and its two dimensional embedding learned using a two-layer MLP. The network was trained using estimated pairwise geodesic distances between only 100 points (marked in black) out of the total 8192 samples.
21
+
22
+ We advocate strengthening the link between axiomatic computation and parametric learning methodologies. Existing MDS frameworks use a geometrically meaningful objective in a cumbersome non-parametric framework. At the other end, learning based methods such as DrLim Hadsell et al. (2006) use a computationally desirable infrastructure yet a geometrically suboptimal objective requiring too many examples for satisfactory manifold learning. The proposed approach can be interpreted as taking the middle path by using a computationally desirable method of a parametric neural network optimized by the geometrically meaningful cost of multidimensional scaling.
23
+
24
+ # 2 BACKGROUND AND PRIOR WORK
25
+
26
+ # 2.1 MANIFOLD LEARNING
27
+
28
+ The literature on manifold learning is dominated by spectral methods that have a characteristic computational template. The first step involves the computation of the $\mathbf { k }$ -nearest neighbors of all $N$ data points. Then, an $N \times N$ square matrix is populated using some geometric principle which characterizes the nature of the desired low dimensional embedding. The eigenvalue decomposition of this matrix is used to obtain the low-dimensional representation of the manifold. Laplacian Eigenmaps Belkin & Niyogi (2003), LLE Roweis & Saul (2000), HLLE Donoho & Grimes (2003), Diffusion Maps Coifman et al. (2005) etc. are considered to be local methods, since they are designed to minimize some form of local distortion and hence result in embeddings which preserve locality. Methods like Schwartz et al. (1989); Wolfson & Schwartz (1989) and Isomap Tenenbaum et al. (2000) are considered global because they enforce preserving all geodesic distances in the low dimensional embedding. Local methods lead to sparse matrix eigenvalue problems and hence are computationally advantageous. However, global methods are more robust to noise and achieve globally coherent embeddings, in contrast to the local methods which can sometimes lead to excessively clustered results. All spectral techniques are non-parametric in nature and hence do not characterize the map that generates them. Therefore, the computational burden of large spectral decompositions becomes a major drawback when the number of data-points is large. Bengio et al. (2004) and De Silva & Tenenbaum (2004) address this issue by providing formulas for out-of-sample extensions to the spectral algorithms. However, these interpolating formulations are computationally inefficient and exhibit poor non-local generalization of the manifold Bengio et al. (2013).
29
+
30
+ # 2.2 MULTIDIMENSIONAL SCALING
31
+
32
+ Multidimensional scaling (henceforth MDS) is a classical problem in geometry processing and data science and a powerful tool for obtaining a global picture of data when only pairwise distances or dissimilarity information is available. The core idea of MDS is to find an embedding $\mathbf { X } = \left[ \mathbf { x _ { 1 } } , \mathbf { x _ { 2 } } , \mathbf { x _ { 3 } } . . . \mathbf { x _ { N } } \right]$ such that the pairwise distances measured in the embedding space are faithful to the desired distances $\bf { D _ { s } } = [ d _ { i j } ^ { 2 } ] _ { i , j = 1 } ^ { i , j = N }$ as much as possible. There are two prominent versions of MDS: Classical Scaling and Least Squares Scaling. Classical Scaling is based on the observation that the double centering of a pairwise squared distance matrix gives an inner-product matrix which can be factored to obtain the desired embedding. Therefore, if $\begin{array} { r } { { \bf H } = { \bf I } - \frac { 1 } { n } { \mathbb { 1 } } { \mathbb { 1 } } ^ { T } } \end{array}$ is the centering matrix, classical scaling minimizes the Strain of the embedding configuration $\mathbf { X }$ given by
33
+
34
+ $$
35
+ \mathit { S t r a i n } ( \mathbf { X } ) = | | \mathbf { X } \mathbf { X } ^ { T } + \frac { 1 } { 2 } \mathbf { H } \mathbf { D } _ { \mathbf { s } } \mathbf { H } | | _ { F } ^ { 2 } ,
36
+ $$
37
+
38
+ and is computed conveniently using the eigen-decomposition of the $N \times N$ matrix $- \frac { 1 } { 2 } \mathbf { H D _ { s } H }$ . At the other end, least squares scaling is based on minimizing the misfits between the pairwise distances of $\mathbf { X } = \left[ \mathbf { x _ { 1 } } , \mathbf { x _ { 2 } } , \mathbf { x _ { 3 } } . . . \mathbf { x _ { N } } \right]$ and desired distances $[ \bf d _ { i j } ] _ { i , j = 1 } ^ { i , j = \mathbf { \bar { N } } }$ measured by the Stress function
39
+
40
+ $$
41
+ \mathit { S t r e s s } ( \mathbf { X } ) = \sum _ { i } \sum _ { j } \ : ( | | \mathbf { x _ { i } } - \mathbf { x _ { j } } | | - \mathbf { d _ { i j } } ) ^ { 2 } .
42
+ $$
43
+
44
+ In the context of manifold learning and dimensionality reduction, the MDS framework is enabled by estimating all pairwise geodesic distances with a shortest path algorithm like Dijkstra Dijkstra (1959) and using the minimizers of Equations 1 and 2 to generate global embeddings by preserving metric properties of the manifold.
45
+
46
+ Schwartz et al. (1989); Wolfson & Schwartz (1989) along with Tenenbaum et al. (2000) were the first to suggest populating the inter-geodesic matrix $\mathbf { D _ { s } }$ using Dijkstra’s algorithm for preserving metric properties of manifolds. The SMACOF algorithm of De Leeuw & Mair (2011) and their variants Bronstein et al. (2006) are iterative least squares scaling algorithms for minimizing Stress in Equation (2). The computational bottleneck of dealing with a dense distance matrix requiring all pairwise distances led to faster algorithms like Aflalo $\&$ Kimmel (2013); Shamai et al. (2015) and Boyarski et al. (2017), that used spectral representations of the Laplace-Beltrami Operator of the manifold. Rosman et al. (2010) shows a least squares scaling technique which can overcome holes and non-convex boundaries of the manifold. All these algorithms are non-parametric and few out-of-sample extensions have been suggested De Silva & Tenenbaum (2004) to generalize them to new samples.
47
+
48
+ # 2.3 NEURAL NETWORKS FOR MANIFOLD LEARNING
49
+
50
+ Examining the ability of neural networks to represent data manifolds has received considerable interest and has been studied from multiple perspectives. From the viewpoint of unsupervised parametric manifold learning, one notable approach is based on the metric-learning arrangement of the Siamese configuration Hadsell et al. (2006); Bromley et al. (1994); Chopra et al. (2005). Similarly, the parametric version of the Stochastic Neighborhood Embedding van der Maaten (2009) is another example of using a neural network to generate a parametric map that is trained to preserve local structure Maaten & Hinton (2008). However, these techniques demand an extensive training effort requiring large number of training examples in order to generate satisfactory embeddings. Weston et al. (2012) use a parametric network to learn a classifier which enforces a manifold criterion, requiring nearby points to have similar representations. Basri & Jacobs (2017) have argued that neural-networks can efficiently represent manifolds as monotonic chain of linear segments by providing an architectural construction and analysis. However, they do not address the manifold learning problem and their experiments are based on supervised settings where the ground-truth embedding is known a priori. Gong et al. (2006); Mishne et al. (2017); Chui & Mhaskar (2016) use neural networks specifically for solving the out-of-sample extension problem for manifold learning. However, their procedure involves training a network to follow a pre-computed non-parametric embedding rather than adopting an entirely unsupervised approach thereby inheriting some of the deficiencies of the non-parametric methods.
51
+
52
+ It is advantageous to adopt a parametric approach to non-linear dimensionality reduction and replace the computational block of the matrix construction and eigenvalue decomposition with a straightforward parametric computation. Directly characterizing the non-linear map provides a simple out-ofsample extension which is a plain forward pass of the network. More importantly, it is expected that the reduced and tightly controlled parameters would lead to an improved non-local generalization of the manifold Bengio et al. (2013).
53
+
54
+ In Hadsell et al. (2006) (henceforth DrLim), it was proposed to use Siamese Networks for manifold learning using the popular hinge-embedding criterion (Equation (3)) as a loss function. A Siamese configuration (Figure 2) comprises of two identical networks that process two separate units of data to achieve output pairs that are compared in a loss function. The contrastive training comprises of constructing pairs $\{ \mathbf { X _ { 1 } ^ { ( k ) } } , \mathbf { X _ { 2 } ^ { ( k ) } } , \lambda ^ { ( k ) } \} _ { k = 1 } ^ { k = N }$ where $\lambda ^ { ( k ) } \in \{ 0 , 1 \}$ is a label for indicating a positive (a neighbor) or negative pair (not a neighbor) by building a nearest neighbor graph from the manifold data.
55
+
56
+ ![](images/2e204ad6304c9ea2bca00a267d9368dd47bc769f7c21d428f3697498d50fe0da.jpg)
57
+ Figure 2: Siamese Configuration
58
+
59
+ $$
60
+ \begin{array} { r l } { \displaystyle \mathcal { L } ( \boldsymbol { \Theta } ) = \sum _ { \mathbf { k } } \lambda ^ { ( \mathbf { k } ) } ~ | | \mathcal { F } _ { \boldsymbol { \Theta } } ( \mathbf { X _ { 1 } ^ { ( \mathbf { k } ) } } ) - \mathcal { F } _ { \boldsymbol { \Theta } } ( \mathbf { X _ { 2 } ^ { ( \mathbf { k } ) } } ) | | } & { } \\ { \displaystyle } & { \quad + ( \mathbf { 1 } - \lambda ^ { ( \mathbf { k } ) } ) ~ \operatorname* { m a x } ~ \{ \mathbf { 0 } , ~ \boldsymbol { \mu } - | | \mathcal { F } _ { \boldsymbol { \Theta } } ( \mathbf { X _ { 1 } ^ { ( \mathbf { k } ) } } ) - \mathcal { F } _ { \boldsymbol { \Theta } } ( \mathbf { X _ { 2 } ^ { ( \mathbf { k } ) } } ) | | \} } \end{array}
61
+ $$
62
+
63
+ Training with the loss in Equation (3) means that at any given update step, a negative pair contributes to the training only when their pairwise distance is less than $\mu$ . This leads to a hard-negative sampling problem where the quality of embedding depends on the selection of negative examples in order to prevent excessive clustering of the neighbors. This typically requires an extensive training effort with a huge amount of training data (30000 positive and approximately 17.9 million negatives for a total of 6000 data samples as reported in Hadsell et al. (2006)).
64
+
65
+ # 3 A FRAMEWORK FOR PARAMETRIC MULTIDIMENSIONAL SCALING
66
+
67
+ We propose to incorporate the ideas of Least Squares Scaling into the computational infrastructure of the Siamese configuration as shown in Figure 2. For every $\bar { \mathbf { k } } ^ { t h }$ pair, we estimate the geodesic distance using a shortest path algorithm and train the network to preserve these distances by minimizing the Stress function
68
+
69
+ $$
70
+ \mathcal { L } ( \boldsymbol { \Theta } ) = \sum _ { \mathbf { k } } \mathrm { ~ ( ~ } | | \mathcal { F } _ { \boldsymbol { \Theta } } ( \mathbf { X } _ { 1 } ^ { ( \mathbf { k } ) } ) - \mathcal { F } _ { \boldsymbol { \Theta } } ( \mathbf { X } _ { 2 } ^ { ( \mathbf { k } ) } ) \mathrm { ~ | | - \mathbf { d } ^ { ( \mathbf { k } ) } ~ ) ^ { 2 } ~ }
71
+ $$
72
+
73
+ The advantage of adopting the loss in Equation (4) over Equation (3) is that every pair of training data contributes to the learning process thereby eliminating the negative sampling problem. More importantly, it facilitates the use of efficient manifold sampling techniques like the Farthest Point Sampling strategy that make it possible to train with much fewer pairs of examples. The farthest point sampling strategy Bronstein et al. (2008) (also referred to as the MinMax strategy in De Silva & Tenenbaum (2004)) is a method to pick landmarks amongst the points of a discretely sampled manifold such that under certain conditions, these samples uniformly cover the manifold much as possible. Starting from a random selection, the landmarks are chosen one at a time such that, each new selection from the unused samples has the largest geodesic distance to the set of the selected sample points. Figure 3 provides a visualization of this sampling mechanism. We train the network by minimizing the loss in Equation (4) by computing the pairwise geodesic distances of the landmarks. Therefore, the pre-training computational effort is confined to computing the pairwise geodesic distances of only the landmark points. The proposed geometric manifold learning algorithm can be summarized in two steps,
74
+
75
+ ![](images/11c4e9f6c7f703ee00e0f45a02cc7c6d25db28a8f359a7e37e7fccc8199fbfd6.jpg)
76
+ Figure 3: 2D embeddings of a three dimensional S-Curve Manifold generated by a 2-Layer MLP with 70 hidden nodes, that was trained with varying number of landmark points obtained with the Farthest Point Sampling Algorithm.
77
+
78
+ Step1: Compute the nearest-neighbor graph from the manifold data and obtain a set of landmarkpoints and their corresponding pairwise graph/geodesic distances using Dijkstra’s algorithm and the Farthest Point Strategy.
79
+
80
+ Step2: Form a dataset of landmark pairs with corresponding geodesic distances and train network in Siamese configuration using the least-squares M $\{ \mathbf { X _ { 1 } ^ { ( k ) } , X _ { 2 } ^ { ( k ) } , d ^ { ( k ) } } \}$ (4)
81
+
82
+ # 4 EXPERIMENTS
83
+
84
+ # 4.1 3D POINT CLOUD DATA
85
+
86
+ Our first set of experiments are based on point-cloud manifolds, e.g., like the Swiss Roll, S-Curve and the Helical Ribbon. We use a multilayer perceptron (MLP) with the PReLU() as the non-linear activation function, given by
87
+
88
+ $$
89
+ P R e L U ( x ) = \operatorname* { m a x } ( 0 , x ) + a \ \operatorname* { m i n } ( 0 , x ) ,
90
+ $$
91
+
92
+ where $a$ is a learnable parameter. The networks are trained using the ADAM optimizer with constants $( \beta _ { 1 } , \beta _ { 2 } ) = ( 0 . 9 5 , 0 . 9 9 )$ and a learning rate of 0.01 for 1000 iterations. We run each optimization 5 times with random initialization to ensure convergence. All experiments are implemented in python using the PyTorch framework Paszke et al. (2017). We used the scikit-learn machine learning library for the nearest-neighbor and scipy-sparse for Dijkstra’s shortest path algorithms.
93
+
94
+ Figure 1 and 3 show the results of our method on the Helical Ribbon and S-Curve respectively with varying number of training samples (in black) out of a total of 8172 data points. The number of landmarks dictates the approximation quality of the low-dimensional embedding generated by the network. Training with too few samples will result in inadequate generalization which can be inferred from the corrugations of the unfurled results in the first two parts of Figure 3 and increasing the number of landmarks expectedly improves the quality of the embedding. We compute the Stress function (Equation (2)) of the entire point configuration to measure the quality of the MDS fit. Figure 4a shows the decay in the Stress as a function of the number of training points (or Landmarks) of a 2-Layer MLP.
95
+
96
+ The natural next question to ask is how many landmarks? how many layers? and how many hidden nodes per layer? We observe that these questions relate to an analogous setup in numerical methods for differential equations. For a given numerical technique, the accuracy of the solution depends on the resolution of the spatial grid over which the solution is estimated. Therefore, numerical methods are ranked by an assessment of the order of accuracy their solutions observe. This can be obtained by assuming that the relationship between the approximation error $E$ and the resolution of the grid $h$ is given by
97
+
98
+ ![](images/1192f770f43cf79258d17aecf1b9b90fdc30122acdb142febb67172cda5f83e1.jpg)
99
+ Figure 4: Exploring the variations in architecture and the number of landmarks: (a) The logarithm of stress of all 8172 points as a function of number of landmarks. (b) Order of accuracy estimates of varying architectures.
100
+
101
+ $$
102
+ E = C h ^ { P }
103
+ $$
104
+
105
+ where $P$ is the order of accuracy of the technique and $C$ is some constant. Therefore, $P$ is obtained by computing the slope of the line obtained by charting $\log ( E )$ vs $\log ( h )$ ,
106
+
107
+ $$
108
+ \log ( E ) = \log ( C ) + P \ \log ( h ) .
109
+ $$
110
+
111
+ We extend the same principle to evaluate network architectures (in place of numerical algorithms) for estimating the quality of isometric maps. We use the generalized Stress in Equation (2) as the error function for Equation (6). We assume that due to the 2-approximate property of the fartstrategy Hochbaum & Shmoys (1985) the sampling is approximately uniform and hence $h \propto { \frac { 1 } { \sqrt { K } } }$ where $K$ is the number of landmarks. By varying the number of layers and the number of nodes per layer we associate an order of accuracy to each architecture using Equation (7). Figure 4b shows the results of our experiment. It shows that a single layer MLP has the capacity for modeling functions upto the first order of accuracy. Adding an additional layer increases the representational power by moving to a second order result. Adding more layers does not provide any substantive gain arguably due to a larger likelihood of over-fitting as seen in the considerably noisier estimates (in green). Therefore, a two layer MLP with 70 hidden nodes per layer can be construed as a good architecture for approximating the isometric map of the S-Curve of Figure 3 with 200 landmarks.
112
+
113
+ # 4.2 IMAGE ARTICULATION MANIFOLDS
114
+
115
+ We extend the parametric MDS framework to image articulation manifolds where each sample point is a binary image governed by the modulation of a few parameters. We specifically deal with image manifolds that are isometric to Euclidean space Donoho & Grimes (2005), that is, the geodesic distance between any two sample points is equal to the euclidean distance between their articulation parameters. In the context of the main discussion of this paper, which is metric preserving properties of manifolds, we find that such datasets provide an appropriate test-bed for evaluating metric preserving algorithms.
116
+
117
+ We construct a horizon articulation manifold where each image contains two distinct regions separated by a horizon which is modulated by a linear combination of two fixed sinusoidal basis elements. See Figure 5.
118
+
119
+ $$
120
+ \begin{array} { r c l } { { { \cal I } _ { \alpha _ { 1 } , \alpha _ { 2 } } ( u , v ) } } & { { = } } & { { \mathbb { 1 } _ { \{ v \leq \psi _ { \alpha _ { 1 } , \alpha _ { 2 } } ( u ) \} } } } \\ { { } } & { { } } & { { } } \\ { { \psi _ { \alpha _ { 1 } , \alpha _ { 2 } } ( u ) } } & { { = } } & { { \alpha _ { 1 } \sin ( \omega _ { 1 } u ) + \alpha _ { 2 } \sin ( \omega _ { 2 } u ) } } \end{array}
121
+ $$
122
+
123
+ Thus, each sample has an intrinsic dimensionality of two - the articulation parameters $\left( \alpha _ { 1 } , \alpha _ { 2 } \right)$ which govern how the sinusoids representing the horizon are mixed. We sample the articulation
124
+
125
+ ![](images/21b58a74e5448145d64324281c028acc2f5278afbafe7ee573e8caef648b3fc3.jpg)
126
+ Figure 5: Visualizing a horizon articulation manifold: 1000 samples generated as per equations 8 and 9 with $\omega _ { 1 } = 2$ , $\omega _ { 2 } = 7$ . The color is proportional to the magnitude $\sqrt { \alpha _ { 1 } ^ { 2 } + \alpha _ { 2 } ^ { 2 } }$
127
+
128
+ ![](images/3159108861cf69b01d621e79a4006689641c5f95a69042c8651c3b791066bd28.jpg)
129
+ Figure 6: (a) Comparing metric preserving properties for different manifold learning algorithms on the image articulation manifold dataset. LE: Belkin & Niyogi (2003), DrLim: Hadsell et al. (2006). The proposed method shows maximum fidelity to the ground truth shown in Figure 5 (b) Visualizing the outputs of some filters trained using our method. The $1 ^ { \mathrm { s t } }$ column shows the input images. The filters act to exaggerate $2 ^ { \mathrm { n d } }$ column) and suppress ( $3 ^ { \mathrm { r d } }$ column) a governing frequency in Equation (8).
130
+
131
+ parameters from a 2D uniform distribution
132
+
133
+ $$
134
+ ( \alpha _ { 1 } , \alpha _ { 2 } ) \sim U ( [ 0 , 1 ] \times [ 0 , 1 ] ) .
135
+ $$
136
+
137
+ We generate 1000 images of the horizon articulation manifold of size $1 0 0 \times 1 0 0$ . The network architecture comprises of two convolution layers each with kernel sizes 12 and 9, number of kernels 15 and 2 respectively along with a stride of 3 and followed by a fully connected layer mapping the image to a two dimensional entity. We train using the ADAM optimizer Kingma & Ba (2015) with a learning rate of 0.01 and parameters $( \beta _ { 1 } , \beta _ { 2 } ) \stackrel { - } { = } ( 0 . 9 5 , 0 . 9 9 )$ . We train the network using 50 Landmark points.
138
+
139
+ Figure 6a shows the comparison between our method and other non-parametric counterparts along with the parametric approach of DrLim. Training with the least squares loss of Equation (4) shows high fidelity to the ground truth of Figure 5. Except for Isomap and our proposed method, all other methods show some form of distortion indicating a suboptimal metric preservation property.
140
+
141
+ Training with the articulation manifold in Figure5 provides an opportunity to get more detail in understanding the parametric action of the neural networks. The $2 ^ { \mathrm { n d } }$ and $3 ^ { \mathrm { { r } \mathrm { { \dot { d } } } } }$ columns in Figure 6b show the outputs of some of the filters in the first layer of the architecture trained on the manifold in Figure 5. The distance preserving loss facilitates the learning of image filters which separate the underlying frequencies governing the non-linear manifold, thereby providing a visual validation of the parametric map.
142
+
143
+ ![](images/df79e49165d87fb4c5d7086dd30330ff97ccaf5409b8afd18d41a28b479623e7.jpg)
144
+ Figure 7: Comparing with nonparametric out-of-sample extensions: (a) Comparing numerical stress values of embeddings generated for training and test data of our method and the interpolating formulation of Landmark Isomap. (b) Visualizing the non-local generalization properties of our method (top) and Landmark Isomap (bottom). Both algorithms were trained on the same Landmarks (in red) sampled from only a part of the manifold.
145
+
146
+ # 4.3 COMPARISON WITH LANDMARK ISOMAP
147
+
148
+ We compare our parametric multi-dimensional scaling approach to its direct non-parametric competitor: Landmark-Isomap De Silva & Tenenbaum (2004). The main idea of Landmark-Isomap is to perform classical scaling on the inter-geodesic distance matrix of only the landmarks and to estimate the embeddings of the remaining points using an interpolating formula (also mentioned in Bengio et al. (2004)). The formula uses the estimated geodesic distance of each new point to the selected Landmarks in order to estimate its low dimensional embedding.
149
+
150
+ We use the image articulation manifold dataset to provide a quantitative and visual comparison between the two methods. Both the methods are imputed with the same set of landmarks for evaluation. In the first experiment, we generate two independent horizon articulation datasets each containing 1000 samples generated using Equations (8) and (9) for training and testing. We then successively train both algorithms on the training dataset with varying number of Landmark points and then use the examples from the test data-set to evaluate performance. Figure 7 (a) shows that low dimensional embedding of Landmark-Isomap admits smaller stress values (hence better metric preservation) for the training dataset, but behaves poorly on unseen examples. On the other hand, despite larger stress values for training, the network shows better generalizability.
151
+
152
+ In order to visualize non-local generalization properties, we repeat the previous experiment with a minor modification. We train both algorithms on horizon articulation manifolds with parameters sampled from $( \alpha _ { 1 } , \alpha _ { 2 } ) \sim U ( [ 0 , 0 . 7 5 ] ^ { - } \times [ 0 , 0 . 7 5 ] )$ and visualize the outputs on test datasets with parameters sampled from $( \alpha _ { 1 } , \alpha _ { 2 } ) \sim U ( [ 0 , 1 ] \times [ 0 , 1 ] )$ thereby isolating a part of the manifold during training. As shown in Figure 7b, the output of Landmark-Isomap shows a clustered result due to the lack of non-local data in the geodesic distance calculations for the interpolation. In contrast, the network clearly shows a better generalization property.
153
+
154
+ # 4.4 CAMERA POSE MANIFOLDS
155
+
156
+ Finally we test our method on a more realistic dataset where the constraint of being isometric to a low dimensional euclidean space is not necessarily strict. We generate 1369 images obtained by smoothly varying the azimuth and elevation of the camera.
157
+
158
+ Figure 8 shows the embeddings and associated training times of our method compared to the conceptual (Landmark Isomap) and computational (DrLim Hadsell et al. (2006)) siblings. We see that the fast interpolation scheme of Landmark Isomap demonstrates higher distortion whereas DrLim requires a considerable training effort, requiring all possible $\binom { 1 3 6 9 } { 2 } \stackrel { - } { = } 9 3 6 3 9 6$ pairs. Our integrated approach yields an improved result in a considerably smaller training time (geodesic distances between only $\binom { 6 0 0 } { 2 } = 1 7 9 7 0 0$ pairs). We used the same 600 landmarks from Isomap and the same architecture of DrLim for generating the embedding in Figure 8c.
159
+
160
+ ![](images/73c08738a754ea4c022aeedda0837ef3e7869e334016c3468b84fcf52d1d9483.jpg)
161
+ (a) Landmark Isomap. Training time $<$ 1s
162
+
163
+ ![](images/fccb551294646faa8bba3229463a00918a7f61158c6c45d1db7f36f7ad8d630b.jpg)
164
+ (b) DrLim. Training time $\approx 6 6 2 0 \mathrm { s }$
165
+
166
+ ![](images/67613dc0591ad6925f8924d6d58c2963fe047e733c35296d13cd92d3df147dd0.jpg)
167
+ (c) Our Method. Training time $\approx 8 6 0 \mathrm { s }$
168
+ Figure 8: Camera Pose Manifold: Embedding results and training times for Landmark-Isomap, DrLim Hadsell et al. (2006) and our approach. Our hybrid parametric approach shows a faithful result for a smaller training time.
169
+
170
+ # 5 CONCLUSION
171
+
172
+ In the interest of obtaining a better understanding of neural network behavior, we advocate using learning methodologies for solving geometric problems with data by allowing a limited infusion of axiomatic computation to the learning process. In this paper we demonstrate such a scheme by combining parametric modeling with neural networks and the geometric framework of multidimensional scaling. The result of this union leads to reduction in training effort and improved local and nonlocal generalization abilities. As future work, we intend to further explore methods that leverage learning methodologies for improving the largely axiomatic setups of numerical algorithms.
173
+
174
+ # REFERENCES
175
+
176
+ Yonathan Aflalo and Ron Kimmel. Spectral multidimensional scaling. Proceedings of the National Academy of Sciences, 110(45):18052–18057, 2013.
177
+
178
+ Ronen Basri and David Jacobs. Efficient representation of low-dimensional manifolds using deep networks. International Conference On Learning Representations, 2017.
179
+
180
+ Mikhail Belkin and Partha Niyogi. Laplacian eigenmaps for dimensionality reduction and data representation. Neural computation, 15(6):1373–1396, 2003.
181
+
182
+ Yoshua Bengio, Jean-franc¸cois Paiement, Pascal Vincent, Olivier Delalleau, Nicolas L Roux, and Marie Ouimet. Out-of-sample extensions for lle, isomap, mds, eigenmaps, and spectral clustering. In Advances in neural information processing systems, pp. 177–184, 2004.
183
+
184
+ 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.
185
+
186
+ Amit Boyarski, Alex M Bronstein, and Michael M Bronstein. Subspace least squares multidimensional scaling. In International Conference on Scale Space and Variational Methods in Computer Vision, pp. 681–693. Springer, 2017.
187
+
188
+ 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.
189
+
190
+ Alexander M Bronstein, Michael M Bronstein, and Ron Kimmel. Numerical geometry of non-rigid shapes. Springer Science & Business Media, 2008.
191
+
192
+ Michael M Bronstein, Alexander M Bronstein, Ron Kimmel, and Irad Yavneh. Multigrid multidimensional scaling. Numerical linear algebra with applications, 13(2-3):149–171, 2006.
193
+
194
+ Sumit Chopra, Raia Hadsell, and Yann LeCun. Learning a similarity metric discriminatively, with application to face verification. In Computer Vision and Pattern Recognition, 2005. CVPR 2005. IEEE Computer Society Conference on, volume 1, pp. 539–546. IEEE, 2005.
195
+
196
+ Charles K Chui and Hrushikesh Narhar Mhaskar. Deep nets for local manifold learning. arXiv preprint arXiv:1607.07110, 2016.
197
+
198
+ Ronald R Coifman, Stephane Lafon, Ann B Lee, Mauro Maggioni, Boaz Nadler, Frederick Warner, and Steven W Zucker. Geometric diffusions as a tool for harmonic analysis and structure definition of data: Diffusion maps. Proceedings of the National Academy of Sciences of the United States of America, 102(21):7426–7431, 2005.
199
+
200
+ Jan De Leeuw and Patrick Mair. Multidimensional scaling using majorization: Smacof in r. Department of Statistics, UCLA, 2011.
201
+
202
+ Vin De Silva and Joshua B Tenenbaum. Sparse multidimensional scaling using landmark points. Technical report, 2004.
203
+
204
+ Edsger W Dijkstra. A note on two problems in connexion with graphs. Numerische mathematik, 1 (1):269–271, 1959.
205
+
206
+ David L Donoho and Carrie Grimes. Hessian eigenmaps: Locally linear embedding techniques for high-dimensional data. Proceedings of the National Academy of Sciences, 100(10):5591–5596, 2003.
207
+
208
+ David L Donoho and Carrie Grimes. Image manifolds which are isometric to euclidean space. Journal of mathematical imaging and vision, 23(1):5–24, 2005.
209
+
210
+ Haifeng Gong, Chunhong Pan, Qing Yang, Hanqing Lu, and Songde Ma. Neural network modeling of spectral embedding. In BMVC, pp. 227–236, 2006.
211
+
212
+ Raia Hadsell, Sumit Chopra, and Yann LeCun. Dimensionality reduction by learning an invariant mapping. In Computer vision and pattern recognition, 2006 IEEE computer society conference on, volume 2, pp. 1735–1742. IEEE, 2006.
213
+
214
+ Dorit S Hochbaum and David B Shmoys. A best possible heuristic for the k-center problem. Mathematics of operations research, 10(2):180–184, 1985.
215
+
216
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. International Conference On Learning Representations, 2015.
217
+
218
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 9(Nov):2579–2605, 2008.
219
+
220
+ Gal Mishne, Uri Shaham, Alexander Cloninger, and Israel Cohen. Diffusion nets. Applied and Computational Harmonic Analysis, 2017.
221
+
222
+ Adam Paszke, Sam Gross, and Soumith Chintala. Pytorch, 2017.
223
+
224
+ Guy Rosman, Michael M Bronstein, Alexander M Bronstein, and Ron Kimmel. Nonlinear dimensionality reduction by topologically constrained isometric embedding. International Journal of Computer Vision, 89(1):56–68, 2010.
225
+
226
+ Sam T Roweis and Lawrence K Saul. Nonlinear dimensionality reduction by locally linear embedding. science, 290(5500):2323–2326, 2000.
227
+
228
+ Eric L. Schwartz, Alan Shaw, and Estarose Wolfson. A numerical solution to the generalized mapmaker’s problem: flattening nonconvex polyhedral surfaces. IEEE Transactions on Pattern Analysis and Machine Intelligence, 11(9):1005–1008, 1989.
229
+
230
+ Gil Shamai, Yonathan Aflalo, Michael Zibulevsky, and Ron Kimmel. Classical scaling revisited. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2255–2263, 2015.
231
+
232
+ Joshua B Tenenbaum, Vin De Silva, and John C Langford. A global geometric framework for nonlinear dimensionality reduction. science, 290(5500):2319–2323, 2000.
233
+
234
+ Laurens van der Maaten. Learning a parametric embedding by preserving local structure. RBM, 500 (500):26, 2009.
235
+
236
+ Jason Weston, Fred´ eric Ratle, Hossein Mobahi, and Ronan Collobert. Deep learning via semi- ´ supervised embedding. In Neural Networks: Tricks of the Trade, pp. 639–655. Springer, 2012.
237
+
238
+ Estarose Wolfson and Eric L Schwartz. Computing minimal distances on polyhedral surfaces. IEEE Transactions on Pattern Analysis and Machine Intelligence, 11(9):1001–1005, 1989.
md/train/B1x-LjAcKX/B1x-LjAcKX.md ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LOCAL CRITIC TRAINING OF DEEP NEURAL NETWORKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ This paper proposes a novel approach to train deep neural networks by unlocking the layer-wise dependency of backpropagation training. The approach employs additional modules called local critic networks besides the main network model to be trained, which are used to obtain error gradients without complete feedforward and backward propagation processes. We propose a cascaded learning strategy for these local networks. In addition, the approach is also useful from multi-model perspectives, including structural optimization of neural networks, computationally efficient progressive inference, and ensemble classification for performance improvement. Experimental results show the effectiveness of the proposed approach and suggest guidelines for determining appropriate algorithm parameters.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In recent days, deep learning has been remarkably advanced and successfully applied in numerous fields (LeCun et al., 2015). A key mechanism behind the success of deep neural networks is that they are capable of extracting useful information progressively through their layered structures. It is an increasing trend that more and more complex deep neural network structures are developed in order to solve challenging real-world problems, e.g., He et al. (2016b). Training of deep neural networks is based on backpropagation in most cases, which basically works in a sequential and synchronous manner. During the feedforward pass, the input data is processed through the hidden layers to produce the network output; during the feedback pass, the error gradient is propagated back through the layers to update each layer’s weight parameters. Therefore, training of each layer has dependency on all the other layers, which causes the issue of locking (Jaderberg et al., 2017). This is undesirable in some cases, e.g., a system consisting of several interacting models, a model distributed across multiple computing nodes, etc.
12
+
13
+ There have been attempts to remove the locking constraint. In Carreira-Perpinan & Wang (2014), the method of auxiliary coordinates (MAC) is proposed. It replaces the original loss minimization problem with an equality-constrained optimization problem by introducing an auxiliary variable for each data and each hidden unit. Then, solving the problem is formulated as iteratively solving several sub-problems independently. A similar approach using the alternating direction method of multipliers (ADMM) is proposed in Taylor et al. (2016). It also employs an equality-constrained optimization but with different auxiliary variables, so that resulting sub-problems have closed form solutions. However, these methods are not scalable to deep learning architectures such as convolutional neural networks (CNNs).
14
+
15
+ The method proposed in Jaderberg et al. (2017), called decoupled neural interface (DNI), directly synthesizes estimated error gradients, called synthetic gradients, using an additional small neural network for training a layer’s weight parameters. As long as the synthetic gradients are close to the actual backpropagated gradients, each layer does not need to wait until the error at the output layer is backpropagated through the preceding layers, which allows independent training of each layer. However, this method suffers from performance degradation when compared to regular backpropagation (Czarnecki et al., 2017a). The idea of having additional modules supporting the layers of the main model is also adopted in Czarnecki et al. (2017a), where the additional modules are trained to approximate the main model’s outputs instead of error gradients. Due to this, however, the method does not resolve the issue of update locking, and in fact, the work does not intend to design a non-sequential learning algorithm.
16
+
17
+ ![](images/c2f5cb4c44bf704873fe2f46b97b9422343f9e9d1d458c774bb6d5e32319f1f9.jpg)
18
+ Figure 1: Learning processes of DNI (Jaderberg et al., 2017) and the proposed local critic training. The black, green, and blue arrows indicate feedforward passes, an error gradient flow, and loss comparison, respectively.
19
+
20
+ In this paper, we propose a novel approach for non-sequential learning, called local critic training. The key idea is that additional modules besides the main neural network model are employed, which we call local critics, in order to indirectly deliver error gradients to the main model for training without backpropagation. In other words, a local critic located at a certain layer group is trained in such a way that the derivative of its output serves as the error gradient for training of the corresponding layers’ weight parameters. Thus, the error gradient does not need to be backpropagated, and the feedforward operations and gradient-descent learning can be performed independently. Through extensive experiments, we examine the influences of the network structure, update frequency, and total number of local critics, which provide not only insight into operation characteristics but also guidelines for performance optimization of the proposed method.
21
+
22
+ In addition to the capability of implementing training without locking, the proposed approach can be exploited for additional important applications. First, we show that applying the proposed method automatically performs structural optimization of neural networks for a given problem, which has been a challenging issue in the machine learning field. Second, a progressive inference algorithm using the network trained with the proposed method is presented, which can adaptively reduce the computational complexity during the inference process (i.e., test phase) depending on the given data. Third, the network trained by the proposed method naturally enables ensemble inference that can improve the classification performance.
23
+
24
+ # 2 PROPOSED APPROACH
25
+
26
+ # 2.1 LOCAL CRITIC TRAINING
27
+
28
+ The basic idea of the proposed approach is to introduce additional local networks, which we call local critics, besides the main network model, so that they eventually provide estimates of the output of the main network. Each local critic network can serve a group of layers of the main model by being attached to the last layer of the group. The proposed architecture is illustrated in Figure 1, where $f _ { i }$ is the $i$ th layer group (containing one or more layers), $h _ { i }$ is the output of $f _ { i }$ , and $h _ { N }$ is the final output of the main model having $N$ layer groups:
29
+
30
+ $$
31
+ h _ { i } = f _ { i } ( h _ { i - 1 } )
32
+ $$
33
+
34
+ $c _ { i }$ is the local critic network for $f _ { i }$ , which is expected to approximate $h _ { N }$ based on $h _ { i }$ , i.e.,
35
+
36
+ $$
37
+ c _ { i } ( h _ { i } ) \approx h _ { N }
38
+ $$
39
+
40
+ Then, this can be used to approximate the loss function of the main network, $L _ { N } = l ( h _ { N } , y )$ , which is used to train $f _ { i }$ , by
41
+
42
+ $$
43
+ L _ { i } = l ( c _ { i } ( h _ { i } ) , y )
44
+ $$
45
+
46
+ for $i = 1 , . . . , N - 1$ , i.e.,
47
+
48
+ $$
49
+ L _ { i } \approx L _ { N }
50
+ $$
51
+
52
+ where $y$ is the training target and $l$ is the loss function such as cross-entropy or mean-squared error. Then, the error gradient for training $f _ { i }$ is obtained by differentiating $L _ { i }$ with respect to $h _ { i }$ , i.e.,
53
+
54
+ $$
55
+ \delta _ { i } = \frac { \partial L _ { i } } { \partial h _ { i } }
56
+ $$
57
+
58
+ which can be used to train the weight parameters of $f _ { i }$ , denoted by $\theta _ { i }$ , via a gradient-descent rule:
59
+
60
+ $$
61
+ \theta _ { i } \theta _ { i } - \eta \delta _ { i } \frac { \partial h _ { i } } { \partial \theta _ { i } }
62
+ $$
63
+
64
+ where $\eta$ is a learning rate. Note that the final layer group $h _ { N }$ does not require a local critic network and can be trained using the regular backproagation because the final output of the main network is directly available. Therefore, the update of $f _ { i }$ does not need to wait until its output $h _ { i }$ propagates till the end of the main network and the error gradient is backpropagated; it can be performed when the operations from (2) to (5) are done. For $c _ { i }$ , we usually use a simple model so that the operations through $c _ { i }$ are simpler than those through $f _ { i + 1 }$ till $f _ { N }$ .
65
+
66
+ While the dependency of $f _ { i }$ on $f _ { j } \ ( j > i )$ during training is resolved in this way, there still exists the dependency of $c _ { i }$ on $f _ { j } \ ( j > i )$ , because training $c _ { i }$ requires its ideal target, i.e., $h _ { N }$ , which is available from $f _ { N }$ only after the feedforward pass is complete. In order to resolve this problem, we use an indirect, cascaded approach, where $c _ { i }$ is trained so that its training loss targets the training loss for ${ c _ { i + 1 } } ^ { 1 }$ :
67
+
68
+ $$
69
+ L _ { c _ { i } } = l ( L _ { i } , L _ { i + 1 } )
70
+ $$
71
+
72
+ In other words, training of $c _ { i }$ can be performed once the loss for $c _ { i + 1 }$ is available.
73
+
74
+ Figure 1 compares the proposed architecture with the existing DNI approach that also employs local networks besides the main network to resolve the issue of locking (Jaderberg et al., 2017). In DNI, the local network $c _ { i }$ directly estimates the error gradient, i.e.,
75
+
76
+ $$
77
+ c _ { i } ( h _ { i } ) \approx \frac { \partial L _ { N } } { \partial h _ { i } }
78
+ $$
79
+
80
+ so that each layer group of the main model can be updated without waiting for the forward and backward propagations in the subsequent layers. And, to update $c _ { i }$ , the error gradient for $f _ { i + 1 }$ estimated by $c _ { i + 1 }$ is backpropagated through $f _ { i + 1 }$ and is used as the (estimated) target for $c _ { i }$ . Therefore, all the necessary computations in the forward and backward passes can be locally confined. The performance of the two methods will be compared in Section 3.
81
+
82
+ # 2.2 STRUCTURAL OPTIMIZATION
83
+
84
+ In many cases, determining an appropriate structure of neural networks for a given problem is not straightforward. This is usually done through trial-and-error, which is extremely time-consuming. There have been studies to automate the structural optimization process (Cortes et al., 2017; Feng & Darrell, 2015; Kwok & Yeung, 1997; Reed, 1993), but this issue still remains very challenging.
85
+
86
+ In deep learning, the problem of structural optimization is even more critical. Large-sized networks may easily show overfitting. Even if large networks may produce high accuracy, they take significantly large amounts of memory and computation, which is undesirable especially for resourceconstrained cases such as embedded and mobile systems. Therefore, it is highly desirable to find an optimal network structure that is sufficiently small while the performance is kept reasonably good.
87
+
88
+ During local critic training, each local critic network is trained to estimate the output of the main network eventually. Therefore, once the training of the proposed architecture finishes, we obtain different networks that are supposed to have similar input-output mappings but have different structures and possibly different accuracy, i.e., multiple sub-models and one main model (see Figure 2b). Here, a sub-model is composed of the layers on the path from the input to a certain hidden layer
89
+
90
+ # Algorithm 1: Progressive inference
91
+
92
+ Input: data $_ x$ , threshold $t$
93
+ Model: sub-model $c _ { i }$ , main-model $f$
94
+ Initialize: classif ication $= 0$ .
95
+ for $i = 1$ to $N - 1$ do if max softmax $( c _ { i } ( x ) ) > t$ then classif ication $=$ argmax softmax $( c _ { i } ( x ) )$ ) break end if
96
+ end for
97
+ if classif ication $= = 0$ then # if all sub-models are not confident classif ication $=$ argmax softmax $( f ( x ) )$
98
+ end if
99
+
100
+ and its local critic network. Among the sub-models, we can choose one as a structure-optimized network by considering the trade-off relationship between the complexity and performance.
101
+
102
+ It is worth mentioning that our structural optimization approach can be performed instantly after training of the model, whereas many existing methods for structural optimization require iterative search processes, e.g., Zoph & Le (2017).
103
+
104
+ # 2.3 PROGRESSIVE INFERENCE
105
+
106
+ We propose another simple but effective way to utilize the sub-models obtained by the proposed approach for computational efficiency, which we call progressive inference. Although small submodels (e.g., sub-model 1) tend to show low accuracy, they would still perform well for some data. For such data, we do not need to perform the full feedforward pass but can take the classification decision by the sub-models. Thus, the basic idea of the progressive inference is to finish inference (i.e., classification) with a small sub-model if its confidence on the classification result is high enough, instead of completing the full feedforward pass with the main model, which can reduce the computational complexity. Here, the softmax outputs for all classes are compared and the maximum probability is used as the confidence level. If it is higher than a threshold, we take the decision by the sub-model; otherwise, the feedforward pass continues. The proposed progressive inference method is summarized in Algorithm 12.
107
+
108
+ # 2.4 ENSEMBLE INFERENCE
109
+
110
+ In recent deep learning systems, it is popular to use ensemble approaches to improve performance in comparison to single models, where multiple networks are combined for producing final results, e.g., He et al. (2016a); Szegedy et al. (2015). The sub-models and main model obtained by applying the proposed local critic training approach can be used for ensemble inference. Figure 4a depicts how the sub-models and the main model can work together to form an ensemble classifier. We take the simplest way to combine them, i.e., summation of the networks’ outputs.
111
+
112
+ # 3 EXPERIMENTS
113
+
114
+ We conduct extensive experiments to examine the performance of the proposed method in various aspects. We use the CIFAR-10 and CIFAR-100 datasets (Krizhevsky, 2009) with data augmentation. We employ a VGG-like CNN architecture with batch normalization and ReLU activation functions, which is shown in Figure 2a. Note that this structure is the same to that used in Czarnecki et al. (2017a). It has three local critic networks, thus four layer groups that can be trained independently are formed (i.e., $N { = } 4$ ). The local critic networks are also CNNs, and their structures are kept as simple as possible in order to minimize the computational complexity for computing the estimated error gradient given by (5).
115
+
116
+ ![](images/e7fc0d788432248be4ca47ca6286fe703a2b1d4b34dc6032ad1b70417cbdc6d7.jpg)
117
+ Figure 2: (a) Network structure of the proposed approach using three local networks for CIFAR-10. LC1, LC2, and LC3 are local critic networks, each of which contains one convolutional layer. For CIFAR-100, the final fc10 layers of the main network and the local critic networks are replaced with fc100. (b) Sub-models and main model obtained by the proposed approach.
118
+
119
+ ![](images/cf0f00f590a2351278a4da197976c450ddbde9945826dacb31d04b73235d090e.jpg)
120
+ Figure 3: Training loss values of the main model and each sub-model with respect to the training iteration.
121
+
122
+ We use the stochastic gradient descent with a momentum of 0.9 for the main network and the Adam optimization with a fixed learning rate of $1 0 ^ { - 4 }$ for the local networks. The L2 regularization is used with $5 \times 1 0 ^ { - 4 }$ for the main network. For the loss functions in (3) and (7), the cross-entropy and the L1 loss are used, respectively, which is determined empirically. The batch size is set to 128, and the maximum training iteration is set to 80,000. The learning rate for the main network is initialized to 0.1 and dropped by an order of magnitude after 40,000 and 60,000 iterations. The Xavier method is used for initialization of the network parameters. All experiments are performed using TensorFlow. We conduct all the experiments five times with different random seeds and report the average accuracy.
123
+
124
+ # 3.1 PERFORMANCE EVALUATION
125
+
126
+ Figure 3 shows how the loss values of the main network and each local critic network, i.e., $L _ { i }$ in (3), evolve with respect to the training iteration. The graphs show that the local critic networks successfully learn to approximate the main network’s loss with high accuracy during the whole training process. The local critic network farthest from the output side (i.e., $L _ { 1 }$ ) shows larger loss values than the others, which is due to the inaccuracy accumulated through the cascaded approximation.
127
+
128
+ The classification performance of the proposed local critic training approach is evaluated in Table 1. For comparison, the performance of the regular backpropagation, DNI (Jaderberg et al., 2017), and critic training (Czarnecki et al., 2017a) is also evaluated. Although the critic training method is not for removing update locking, we include its result because it shares some similarity with our approach, i.e., additional modules to estimate the main network’s output. In all three methods, each additional module is composed of a convolutional layer and an output layer. In the case of the proposed method, we test different numbers of local critic networks. Figure 2a shows the structure with three local critic networks. When only one local network is used, it is located at the place of LC2 in Figure 2a. When five local networks are used, they are placed after every two layers of the main network.
129
+
130
+ Table 1: Average test accuracy $( \% )$ of backpropagation (BP), DNI (Jaderberg et al., 2017), critic training (Czarnecki et al., 2017a), and proposed local critic training (LC). The numbers of local networks used are shown in the parentheses. The standard deviation values are also shown.
131
+
132
+ <table><tr><td>Dataset</td><td>BP</td><td>DNI (3)</td><td>Critic (3)</td><td>LC(1)</td><td></td><td>LC (3)</td><td>LC (5)</td></tr><tr><td>CIFAR-10</td><td>93.93 ±0.20</td><td>64.86 ±0.42</td><td>91.92 ±0.30</td><td>92.06 ±0.20</td><td></td><td>92.39 ±0.09</td><td>91.38 ±0.20</td></tr><tr><td>CIFAR-100</td><td>75.14 ±0.18</td><td>36.53 ±0.64</td><td>69.07 ±0.25</td><td>73.61 ±0.31</td><td></td><td>69.91 ±0.50</td><td>63.53 ±0.24</td></tr></table>
133
+
134
+ Table 2: Average test accuracy $( \% )$ with respect to the number of layers in the local critic networks. $[ a , b , c ]$ means that the numbers of convolutional layers in LC1, LC2, and LC3 are $a , b$ , and $c$ respectively.
135
+
136
+ <table><tr><td>Dataset</td><td>[1,1,1] (default)</td><td>[3,3,3]</td><td>[5,5,5]</td><td>[3,2,1]</td><td>[1,2,3]</td><td>[5,4,3]</td><td>[3,4,5]</td></tr><tr><td>CIFAR-10</td><td>92.39 ±0.09</td><td>92.36 ±0.22</td><td>91.72 ±0.19</td><td>92.07 ±0.21</td><td>92.20 ±0.12</td><td>92.10 ±0.16</td><td>91.90 ±0.16</td></tr><tr><td>CIFAR-100</td><td>69.91 ±0.50</td><td>70.02 ±0.29</td><td>70.34 ±0.16</td><td>70.06 ±0.64</td><td>69.81 ±0.33</td><td>70.87 ±0.40</td><td>69.93 ±0.56</td></tr></table>
137
+
138
+ When compared to the result of backpropagation, the proposed approach successfully decouples training of the layer groups at a small expense of accuracy decrease (note that the performance of the proposed method can be made closer to that of backpropagation using different structures, as will be shown in Tables 2 and Figure 4b). The degradation of the accuracy and standard deviation of our method is larger for CIFAR-100, which implies that the influence of gradient estimation is larger for more complex problems. When more local critic networks are used, the accuracy tends to decrease more due to higher reliance on predicted gradients rather than true gradients, while more layer groups can be trained independently. Thus, there exists a trade-off between the accuracy and unlocking effect. The DNI method shows poor performance as in (Czarnecki et al., 2017a). The proposed method shows performance improvement by $0 . 4 \%$ and $0 . 9 \%$ over the critic training method, both with three local networks, for the two datasets, respectively, which are found to be statistically significant using Mann-Whitney tests at a significance level of 0.05. This shows the efficacy of the cascaded learning scheme of the local networks in our method.
139
+
140
+ # 3.2 STRUCTURES OF LOCAL CRITIC NETWORKS
141
+
142
+ We examine the influence of the structures of the local critic networks in our method. Two aspects are considered, one about the influence of the overall complexity of the local networks and the other about the relative complexities of the local networks for good performance. For this, we change the number of convolutional layers in each local critic network, while keeping the other structural parameters unchanged.
143
+
144
+ The results for various structure combinations of the three local critic networks are shown in Table 2. As the number of convolutional layers increase for all local networks (the first three cases in the table), the accuracy for CIFAR-100 slightly increases from $6 9 . 9 1 \%$ (with one convolutional layer) to $7 0 . 0 2 \%$ (three convolutional layers) and $7 0 . 3 4 \%$ (five convolutional layers), whereas for CIFAR-10 the accuracy slightly decreases when five convolutional layers are used. A more complex local network can learn better the target input-output relationship, which leads to the performance improvement for CIFAR-100. For CIFAR-10, on the other hand, the network structure with five convolutional layers seems too complex compared to the data to learn, which causes the performance drop.
145
+
146
+ Next, the numbers of layers of the local networks are adjusted differently in order to investigate which local networks should be more complex for good performance. The results are shown in the last four columns of Table 2. Overall, it is more desirable to use more complex structures for the local networks closer to the input side of the main model. For instance, LC1 and LC3 are supposed to learn the relationship from $h _ { 1 }$ to $h _ { 4 }$ and that from $h _ { 3 }$ to $h _ { 4 }$ , respectively. More layers are involved from $h _ { 1 }$ to $h _ { 4 }$ in the main network, so the mapping that LC1 should learn would be more complicated, requiring a network structure with sufficient modeling capability.
147
+
148
+ Table 3: Average test accuracy $( \% )$ with respect to the update frequency of local critic networks.
149
+
150
+ <table><tr><td>Dataset</td><td>1/1</td><td></td><td>1/2</td><td>1/3</td><td></td><td>1/4</td><td>1/5</td></tr><tr><td>CIFAR-10</td><td></td><td>92.39 ±0.09</td><td>91.91 ±0.19</td><td></td><td>91.78 ±0.18</td><td>91.57 ±0.12</td><td>91.35 ±0.17</td></tr><tr><td>CIFAR-100</td><td></td><td>69.91 ±0.50</td><td>67.99 ±0.49</td><td></td><td>67.76±0.19</td><td>66.74 ±0.41</td><td>66.39 ±0.39</td></tr></table>
151
+
152
+ Table 4: Average test accuracy $( \% )$ of the sub-models produced by local critic training and the networks trained by regular backpropagation.
153
+
154
+ <table><tr><td>Dataset</td><td>BP sub 1</td><td>LC sub 1</td><td>BP sub 2</td><td>LC sub 2</td><td>BP sub 3</td><td>LC sub 3</td></tr><tr><td>CIFAR-10</td><td>74.46 ±0.91</td><td>85.24 ±0.49</td><td>88.03 ±0.87</td><td>90.53 ±0.15</td><td>92.05 ±0.24</td><td>92.29 ±0.09</td></tr><tr><td>CIFAR-100</td><td>47.58 ±1.10</td><td>55.39 ±0.57</td><td>61.79 ±0.92</td><td>63.62 ±0.31</td><td>67.81 ±0.22</td><td>67.54 ±0.70</td></tr></table>
155
+
156
+ # 3.3 PERIODIC UPDATE OF LOCAL CRITIC NETWORKS
157
+
158
+ A way to increase the efficiency of the proposed approach is to update the local critic networks not at every iteration but only periodically. This may degrade the accuracy but has two benefits. First, the amount of computation required to update the local networks can be reduced. Second, the burden of the communication between the layer groups also can be reduced. These benefits will be more significant when the local networks have larger sizes.
159
+
160
+ For the default structure shown in Figure 2a, we compare different update frequency in Table 3. It is noticed that the accuracy only slightly decreases as the frequency decreases. When the update frequency is a half of that for the main network (i.e., 1/2), the accuracy drops by $0 . 4 8 \%$ and $1 . 9 2 \%$ for the two datasets, respectively. Then, the decrease of the accuracy is only $0 . 5 6 \%$ for CIFAR-10 and $1 . 6 0 \%$ for CIFAR-100 when the update frequency decreases from 1/2 to 1/5.
161
+
162
+ # 3.4 STRUCTURAL OPTIMIZATION
163
+
164
+ Table 4 compares the performance of the sub-models, and Table 5 shows the complexities of the sub-models in terms of the amount of computation for a feedforward pass and the number of weight parameters. A larger network (e.g., sub-model 3) shows better performance than a smaller network (e.g., sub-model 1), which is reasonable due to the difference in learning capability with respect to the model size. The largest sub-model (sub-model 3) shows similar accuracy to the main model $( 9 2 . 2 9 \%$ vs. $9 2 . 3 9 \%$ for CIFAR-10 and $6 7 . 5 4 \%$ vs. $6 9 . 9 1 \%$ for CIFAR-100), while the complexity is significantly reduced. For CIFAR-10, the computational complexity in terms of the number of floating-point operations (FLOPs) and the memory complexity are reduced to only about $30 \%$ (15.72 to 4.52 million FLOPs, and 7.87 to 2.26 million parameters), as shown in Table 5. If an absolute accuracy reduction of $1 . 8 6 \%$ (from $9 2 . 3 9 \%$ to $9 0 . 5 3 \%$ ) is allowed by taking sub-model 2, the reduction of complexity is even more remarkable, up to about one ninth.
165
+
166
+ In addition, the table also shows the accuracy of the networks that have the same structures with the sub-models but are trained using regular backpropagation. Surprisingly, such networks do not easily reach accuracy comparable to that of the sub-models obtained by local critic training, particularly for smaller networks (e.g., $7 4 . 4 6 \%$ vs. $8 5 . 2 4 \%$ with sub-model 1 for CIFAR-10). We think that joint training of the sub-models in local critic training helps them to find better solutions than those reached by independent regular backpropagation.
167
+
168
+ Therefore, these results demonstrate that a structurally optimized network can be obtained at a cost of a small loss in accuracy by local critic training, which may not be attainable by trial-and-error with backpropagation.
169
+
170
+ Table 5: FLOPs required for a feedforward pass and numbers of model parameters in the sub-models and main model for CIFAR-10. Note that sub-model 2 has less FLOPs and parameters than submodel 1 due to the pooling operation in sub-model 2.
171
+
172
+ <table><tr><td>model</td><td>FLOP</td><td># of parameters</td></tr><tr><td>Sub-model 1</td><td>2.85M</td><td>1.42M</td></tr><tr><td>Sub-model 2</td><td>1.76M</td><td>0.88M</td></tr><tr><td>Sub-model 3</td><td>4.52M</td><td>2.26M</td></tr><tr><td>Main model</td><td>15.72M</td><td>7.87M</td></tr></table>
173
+
174
+ Table 6: Average FLOPs and accuracy of progressive inference for test data of CIFAR-10 when the threshold is set to 0.9 or 0.95.
175
+
176
+ <table><tr><td></td><td>FLOP</td><td>Accuracy (%)</td></tr><tr><td>Progressive inference (0.9)</td><td>2.90M</td><td>91.18 ±0.10</td></tr><tr><td>Progressive inference (0.95)</td><td>3.05M</td><td>91.75 ±0.16</td></tr><tr><td>Main model</td><td>15.72M</td><td>92.39 ±0.09</td></tr></table>
177
+
178
+ # 3.5 PROGRESSIVE INFERENCE
179
+
180
+ We apply the progressive inference algorithm shown in Algorithm 1 to the trained default network for CIFAR-10 with the threshold set to 0.9 or 0.95. The results are shown in Table 6. The feedforward pass ends at different sub-models for different test data, and the average FLOPs over all test data are shown. When the threshold is 0.9, with only a slight loss of accuracy $( 9 2 . 3 9 \%$ to $9 1 . 1 8 \%$ ), the computational complexity is reduced significantly, which is only $1 8 . 4 5 \%$ of that of the main model. When the threshold increases to 0.95, the accuracy loss becomes smaller (only $0 . 6 4 \%$ , while the complexity reduction remains almost the same ( $1 9 . 4 0 \%$ of the main model’s complexity).
181
+
182
+ # 3.6 ENSEMBLE INFERENCE
183
+
184
+ The results of ensemble inference using the sub-models and main model are shown in Figure 4b. Using an ensemble of the three sub-models, we observe improved classification accuracy $( 9 2 . 6 8 \%$ and $7 0 . 8 6 \%$ for the two datasets, respectively) in comparison to the main model. The performance is further enhanced by an ensemble of both the three sub-models and the main model $( 9 2 . 7 9 \%$ and $7 1 . 8 6 \%$ . The improvement comes from the complementarity among the models, particularly between the models sharing a smaller number of layers. For instance, we found that sub-model 3 and the main model tend to show coincident classification results for a large portion of test data, so their complementarity is not significant; on the other hand, more data are classified differently by sub-model 1 and the main model, where we mainly observe performance improvement. Instead of the simple summation, there could be a better method to combine the models, which is left for future work.
185
+
186
+ # 4 CONCLUSION
187
+
188
+ In this paper, we proposed the local critic training approach for removing the inter-layer locking constraint in training of deep neural networks. In addition, we proposed three applications of the local critic training method: structural optimization of neural networks, progressive inference, and ensemble classification. It was demonstrated that the proposed method can successfully train CNNs with local critic networks having extremely simple structures. The performance of the method was also evaluated in various aspects, including effects of structures and update intervals of local critic networks and influences of the sizes of layer groups. Finally, it was shown that structural optimization, progressive inference, and ensemble classification can be performed directly using the models trained with the proposed approach without additional procedures.
189
+
190
+ ![](images/7e438144d79f096a85bdf12b0b985cd481458bf96e698456bea49a86fea6ec05.jpg)
191
+ Figure 4: (a) Ensemble inference using the sub-models and main model. (b) Performance of the ensemble inference for an ensemble of the three sub-models $( 1 + 2 + 3 )$ and an ensemble of the submodels and the main model ( $1 + 2 + 3 +$ main). Standard deviation values are also shown as error bars.
192
+
193
+ # REFERENCES
194
+
195
+ M. A. Carreira-Perpinan and W. Wang. Distributed optimization of deeply nested systems. In International Conference on Artificial Intelligence and Statistics (AISTATS), pp. 10–19, Reykjavik, Iceland, 2014.
196
+ C. Cortes, X. Gonzalvo, V. Kuznetsov, M. Mohri, and S. Yang. AdaNet: Adaptive structural learning of artificial neural networks. In International Conference on Machine Learning (ICML), pp. 874– 883, Sydney, Australia, 2017.
197
+ W. M. Czarnecki, S. Osindero, M. Jaderberg, G. Swirszcz, and R. Pascanu. Sobolev training for neural networks. In Advances in Neural Information Processing Systems (NIPS), pp. 4278–4287, Long Beach, CA, 2017a.
198
+ W. M. Czarnecki, G. Swirszcz, M. Jaderberg, S. Osindero, O. Vinyals, and K. Kavukcuoglu. Understanding synthetic gradients and decoupled neural interfaces. In International Conference on Machine Learning (ICML), pp. 904–912, Sydney, Australia, 2017b.
199
+ J. Deng, W. Dong, R. Socher, L. Li, K. Li, and L. Fei-Fei. ImageNet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition (CVPR), pp. 248–255, Miami Beach, FL, 2009.
200
+ J. Feng and T. Darrell. Learning the structure of deep convolutional networks. In International Conference on Computer Vision (ICCV), pp. 2749–2757, Santiago, Chile, 2015.
201
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, Las Vegas, NV, 2016a.
202
+ K. He, X. Zhang, S. Ren, and J. Sun. Identity mappings in deep residual networks. In European Conference on Computer Vision (ECCV), pp. 630–645, Amsterdam, The Netherlands, 2016b.
203
+ G. Huang, D. Chen, T. Li, F. Wu, L. Maaten, and K.Q. Weinberger. Multi-scale dense networks for resource efficient image classification. In International Conference on Learning Representations (ICLR), Vancouver, Canada, 2018.
204
+ M. Jaderberg, W. M. Czarnecki, S. Osindero, O. Vinyals, A. Graves, D. Silver, and K. Kavukcuoglu. Decoupled neural interfaces using synthetic gradients. In International Conference on Machine Learning (ICML), pp. 1627–1635, Sydney, Australia, 2017.
205
+ N. Kriegeskorte, M. Mur, and P. Bandettini. Representational similarity analysis connecting the branches of systems neuroscience. Frontiers in Systems Neuroscience, 2(4), 2008.
206
+ A. Krizhevsky. Learning multiple layers of features from tiny images. Master’s thesis, Department of Computer Science, University of Toronto, 2009.
207
+ T.-Y. Kwok and D.-Y. Yeung. Constructive algorithms for structure learning in feedforward neural networks for regression problems. IEEE Transactions on Neural Networks, 8(3):630–645, 1997.
208
+ G. Larsson, M. Maire, and G. Shakhnarovich. FractalNet: Ultra-deep neural networks without residuals. In International Conference on Learning Representations (ICLR), Toulon, France, 2017.
209
+ Y. LeCun, Y. Bengio, and G. Hinton. Deep learning. Nature, 521:436–444, 2015.
210
+ R. Reed. Pruning algorithms- a survey. IEEE Transactions on Neural Networks, 4(5):730–747, 1993.
211
+ C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. Going deeper with convolutions. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1–9, Boston, MA, 2015.
212
+ G. Taylor, R. Burmeister, Z. Xu, B. Singh, A. Patel, and T. Goldstein. Training neural networks without gradients: A scalable ADMM approach. In International Conference on Machine Learning (ICML), pp. 2722–2731, New York, NY, 2016.
213
+ L. Wang, C. Lee, Z. Tu, and S. Lazebnik. Training deeper convolutional networks with deep supervision. arXiv preprint arXiv:1505.02496v1, 2015.
214
+ B. Zoph and Q.V. Le. Neural architecture search with reinforcement learning. In International Conference on Learning Representations (ICLR), Toulon, France, 2017.
215
+
216
+ # A ADDITIONAL RESULTS
217
+
218
+ # A.1 ADDITIONAL COMPARISON
219
+
220
+ In Czarnecki et al. (2017a), a method to minimize not only the loss of the network output but also its derivative is proposed, called Sobolev training, and applied to the critic training algorithm. We also conduct an experiment to use the Sobolev training method in our proposed algorithm. The results are shown in Table 7. In comparison to the performance shown in Table 1, we do not observe significant difference overall. In addition, we test the deep supervision algorithm (Wang et al., 2015), which also has additional modules connected to intermediate layers. The table shows that its performance is not significantly different from that of backpropagation.
221
+
222
+ Table 7: Average test accuracy $( \% )$ of Sobolev local critic training (Sob LC), Sobolev critic training (Czarnecki et al., 2017a), and deep supervision (Wang et al., 2015). The numbers of local networks used are shown in the parentheses. The standard deviation values are also shown.
223
+
224
+ <table><tr><td>Dataset</td><td>Sob LC (1)</td><td>Sob LC (3)</td><td>Sob LC (5)</td><td>Sob critic (3)</td><td>Deep supervision (3)</td></tr><tr><td>CIFAR-10</td><td>91.83 ±0.22</td><td>92.32 ±0.12</td><td>91.42 ±0.26</td><td>91.96 ±0.22</td><td>94.08 ±0.11</td></tr><tr><td>CIFAR-100</td><td>73.64 ±0.22</td><td>69.58 ±0.32</td><td>63.82 ±1.04</td><td>68.83 ±0.31</td><td>75.09 ±0.29</td></tr></table>
225
+
226
+ # A.2 RESULTS FOR LARGER NETWORKS
227
+
228
+ We examine the effectiveness of the proposed method for larger networks than those used in Section 3. For this, ResNet-50 and ResNet-101 (He et al., 2016a) are trained with backpropagation or the proposed method using three local critic networks. The results shown in Table 8 have a similar trend to those in Table 1 with slight performance improvement in most cases, which confirm that the proposed method works successfully for relatively complex networks.
229
+
230
+ Table 8: Test accuracy $( \% )$ of backpropagation (BP), and local critic training (LC) for ResNet-50 and ResNet-101. The numbers of local networks used are shown in the parentheses.
231
+
232
+ <table><tr><td>Dataset</td><td>ResNet-50 BP</td><td>ResNet-50 LC (3)</td><td>ResNet-101 BP</td><td>ResNet-101 LC (3)</td></tr><tr><td>CIFAR-10</td><td>94.42</td><td>92.95</td><td>94.18</td><td>93.17</td></tr><tr><td>CIFAR-100</td><td>74.88</td><td>70.58</td><td>77.29</td><td>72.72</td></tr></table>
233
+
234
+ In addition, we experiment using the ImageNet dataset (Deng et al., 2009), which is much larger and more complex than CIFAR-10 and CIFAR-100. The results for ResNet-50 in Table 9 show that the proposed method can also work well for large datasets.
235
+
236
+ Table 9: Test accuracy $( \% )$ of ResNet-50 trained with backpropagation (BP) and local critic training (LC) for the ImageNet dataset.
237
+
238
+ <table><tr><td>ImageNet</td><td>ResNet-50 BP</td><td>ResNet-50 LC (3)</td></tr><tr><td>Top-5 accuracy</td><td>92.38</td><td>86.52</td></tr><tr><td>Top-1 accuracy</td><td>75.07</td><td>65.41</td></tr></table>
239
+
240
+ # B VISUALIZATION OF TRAINED MODELS
241
+
242
+ In order to analyze the trained networks, we obtain the representational dissimilarity matrix (RDM) (Kriegeskorte et al., 2008) from each layer of the networks trained by backpropagation and the proposed method. For each of 400 samples from CIFAR-10, the activation of each layer is recorded, and the correlation between two samples is measured, which is shown in Figure 5. In the figure, clear diagonal-blocks indicate that samples from the same class have highly correlated representations (e.g., the last layer).
243
+
244
+ ![](images/25c4b4bf1fb8d3e89761a9928ade1dad5be347d56a4fa5ebefcc89ee4de14596.jpg)
245
+ Figure 5: Representation dissimilarity matrix of each layer of the trained networks (having the structure shown in Figure 2a) for label-ordered samples from CIFAR-10. Red lines indicate the locations of local critic networks. A clear diagonal-block pattern indicates that clear inner-class representation has been trained.
246
+
247
+ Overall, block-diagonal patterns become clear at the last layers for all cases. However, the figure also shows that the two training methods result in networks showing qualitatively different characteristics in their internal representations. In particular, the layers at which local critic networks are attached (e.g., layer 5 in LC (1) and LC (3), and layer 6 in LC (5)) show relatively distinguishable blockdiagonal patterns in comparison to those of the network trained by backpropagation. These layers in the proposed method act not only as intermediate layers of the main network but also as near-final layers of the sub-models, and thus are forced to learn class-specific representations to some extent.
248
+
249
+ # C LEARNING DYNAMICS
250
+
251
+ # C.1 VISUALIZATION OF LOSS EVOLUTION
252
+
253
+ As a way to investigate the learning dynamics of the proposed method, the loss values at each local critic network $( L _ { i } )$ for individual data over the training iterations are examined (Czarnecki et al., 2017b). Figure 3 visualizes the loss values for 400 sampled data of CIFAR-10 (arranged in 2D) when three local critic networks are used. For visualization, the same results are shown twice, once sorted by labels (Figure 6a) and once sorted by $L _ { 4 }$ at iteration 20000 (Figure 6b). At the early stage of learning, the loss values at the local critic networks ( $L _ { 1 }$ to $L _ { 3 }$ ) are largely different from those at the main network $( L _ { 4 } )$ , with only slight similarity (e.g., the blue region at iteration 50 in Figure 6a). At the later stage, however, all the losses similarly converged to small values for most of the samples (at iteration 20000 in Figure 6b).
254
+
255
+ # C.2 LEARNING CURVES OF SUB-MODELS
256
+
257
+ We showed the test performance of sub-models in Table 4. In addition, we show their test accuracy over training iterations for CIFAR-10 in Figure 7. In particular, faster convergence in the case of local critic training than backpropagation is observed in Figure 7a.
258
+
259
+ ![](images/4d2ec25d549cecb1875fd17273ba16d4340e95ed2b8cf51f67ab792ad5df43f6.jpg)
260
+ Figure 6: Evolution of the loss value during the course of the proposed local critic training.
261
+
262
+ ![](images/86be65d27ac7cde0ef30ef8e27c778c97b88720bda116cd16823e0bacddeb792.jpg)
263
+ (c) Sub-model 3
264
+ Figure 7: Test accuracy $( \% )$ of sub-models trained by backpropagation and local critic training over training iterations.
md/train/B1x1ma4tDr/B1x1ma4tDr.md ADDED
@@ -0,0 +1,381 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DDSP: DIFFERENTIABLE DIGITAL SIGNAL PROCESSING
2
+
3
+ Jesse Engel, Lamtharn Hantrakul, Chenjie Gu, & Adam Roberts
4
+
5
+ Google Research, Brain Team
6
+ Mountain View, CA 94043, USA
7
+ {jesseengel,hanoih,gcj,adarob}@google.com
8
+
9
+ # ABSTRACT
10
+
11
+ Most generative models of audio directly generate samples in one of two domains: time or frequency. While sufficient to express any signal, these representations are inefficient, as they do not utilize existing knowledge of how sound is generated and perceived. A third approach (vocoders/synthesizers) successfully incorporates strong domain knowledge of signal processing and perception, but has been less actively researched due to limited expressivity and difficulty integrating with modern auto-differentiation-based machine learning methods. In this paper, we introduce the Differentiable Digital Signal Processing (DDSP) library, which enables direct integration of classic signal processing elements with deep learning methods. Focusing on audio synthesis, we achieve high-fidelity generation without the need for large autoregressive models or adversarial losses, demonstrating that DDSP enables utilizing strong inductive biases without losing the expressive power of neural networks. Further, we show that combining interpretable modules permits manipulation of each separate model component, with applications such as independent control of pitch and loudness, realistic extrapolation to pitches not seen during training, blind dereverberation of room acoustics, transfer of extracted room acoustics to new environments, and transformation of timbre between disparate sources. In short, DDSP enables an interpretable and modular approach to generative modeling, without sacrificing the benefits of deep learning. The library is publicly available1 and we welcome further contributions from the community and domain experts.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Neural networks are universal function approximators in the asymptotic limit (Hornik et al., 1989), but their practical success is largely due to the use of strong structural priors such as convolution (LeCun et al., 1989), recurrence (Sutskever et al., 2014; Williams & Zipser, 1990; Werbos, 1990), and self-attention (Vaswani et al., 2017). These architectural constraints promote generalization and data efficiency to the extent that they align with the data domain. From this perspective, end-to-end learning relies on structural priors to scale, but the practitioner’s toolbox is limited to functions that can be expressed differentiably. Here, we increase the size of that toolbox by introducing the Differentiable Digital Signal Processing (DDSP) library, which integrates interpretable signal processing elements into modern automatic differentiation software (TensorFlow). While this approach has broad applicability, we highlight its potential in this paper through exploring the example of audio synthesis.
16
+
17
+ Objects have a natural tendency to periodically vibrate. Small shape displacements are usually restored with elastic forces that conserve energy (similar to a canonical mass on a spring), leading to harmonic oscillation between kinetic and potential energy (Smith, 2010). Accordingly, human hearing has evolved to be highly sensitive to phase-coherent oscillation, decomposing audio into spectrotemporal responses through the resonant properties of the basilar membrane and tonotopic mappings into the auditory cortex (Moerel et al., 2012; Chi et al., 2005; Theunissen & Elie, 2014). However, neural synthesis models often do not exploit this periodic structure for generation and perception.
18
+
19
+ # 1.1 CHALLENGES OF NEURAL AUDIO SYNTHESIS
20
+
21
+ As shown in Figure 1, most neural synthesis models generate waveforms directly in the time domain, or from their corresponding Fourier coefficients in the frequency domain. While these representations are general and can represent any waveform, they are not free from bias. This is because they often apply a prior over generating audio with aligned wave packets rather than oscillations. For example, strided convolution models–such as SING (Defossez et al., 2018), MCNN (Arik et al., 2019), and WaveGAN (Donahue et al., 2019)–generate waveforms directly with overlapping frames. Since audio oscillates at many frequencies, all with different periods from the fixed frame hop size, the model must precisely align waveforms between different frames and learn filters to cover all possible phase variations. This challenge is visualized on the left of Figure 1.
22
+
23
+ Fourier-based models–such as Tacotron (Wang et al., 2017) and GANSynth (Engel et al., 2019)– also suffer from the phase-alignment problem, as the Short-time Fourier Transform (STFT) is a representation over windowed wave packets. Additionally, they must contend with spectral leakage, where sinusoids at multiple neighboring frequencies and phases must be combined to represent a single sinusoid when Fourier basis frequencies do not perfectly match the audio. This effect can be seen in the middle diagram of Figure 1.
24
+
25
+ Autoregressive waveform models–such as WaveNet (Oord et al., 2016), SampleRNN (Mehri et al., 2016), and WaveRNN (Kalchbrenner et al., 2018)–avoid these issues by generating the waveform a single sample at a time. They are not constrained by the bias over generating wave packets and can express arbitrary waveforms. However, they require larger and more data-hungry networks, as they do not take advantage of a bias over oscillation (size comparisons can be found in Table B.6). Furthermore, the use of teacher-forcing during training leads to exposure bias during generation, where errors with feedback can compound. It also makes them incompatible with perceptual losses such as spectral features (Defossez et al., 2018), pretrained models (Dosovitskiy & Brox, 2016), and discriminators (Engel et al., 2019). This adds further inefficiency to these models, as a waveform’s shape does not perfectly correspond to perception. For example, the three waveforms on the right of Figure 1 sound identical (a relative phase offset of the harmonics) but would present different losses to an autoregressive model.
26
+
27
+ ![](images/ce1f3b59584b9a627b918133ad3040953912b3a4848fa1f6c5f5ee4c06b20c05.jpg)
28
+ Figure 1: Challenges of neural audio synthesis. Full description provided in Section 1.1.
29
+
30
+ # 1.2 OSCILLATOR MODELS
31
+
32
+ Rather than predicting waveforms or Fourier coefficients, a third model class directly generates audio with oscillators. Known as vocoders or synthesizers, these models are physically and perceptually motivated and have a long history of research and applications (Beauchamp, 2007; Morise et al., 2016). These “analysis/synthesis” models use expert knowledge and hand-tuned heuristics to extract synthesis parameters (analysis) that are interpretable (loudness and frequencies) and can be used by the generative algorithm (synthesis).
33
+
34
+ Neural networks have been used previously to some success in modeling pre-extracted synthesis parameters (Blaauw & Bonada, 2017; Chandna et al., 2019), but these models fall short of endto-end learning. The analysis parameters must still be tuned by hand and gradients cannot flow through the synthesis procedure. As a result, small errors in parameters can lead to large errors in the audio that cannot propagate back to the network. Crucially, the realism of vocoders is limited by the expressivity of a given analysis/synthesis pair.
35
+
36
+ # 1.3 CONTRIBUTIONS
37
+
38
+ In this paper, we overcome the limitations outlined above by using the DDSP library to implement fully differentiable synthesizers and audio effects. DDSP models combine the strengths of the above approaches, benefiting from the inductive bias of using oscillators, while retaining the expressive power of neural networks and end-to-end training.
39
+
40
+ We demonstrate that models employing DDSP components are capable of generating high-fidelity audio without autoregressive or adversarial losses. Further, we show the interpretability and modularity of these models enable:
41
+
42
+ • Independent control over pitch and loudness during synthesis.
43
+ • Realistic extrapolation to pitches not seen during training.
44
+ • Blind dereverberation of audio through seperate modelling of room acoustics.
45
+ • Transfer of extracted room acoustics to new environments.
46
+ • Timbre transfer between disparate sources, converting a singing voice into a violin.
47
+ • Smaller network sizes than comparable neural synthesizers.
48
+
49
+ Audio samples for all examples and figures are provided in the online supplement2. We highly encourage readers to listen to the samples as part of reading the paper.
50
+
51
+ # 2 RELATED WORK
52
+
53
+ Vocoders. Vocoders come in several varieties. Source-filter/subtractive models are inspired by the human vocal tract and dynamically filter a harmonically rich source signal (Flanagan, 2013), while sinusoidal/additive models generate sound as the combination of a set of time-varying sine waves (McAulay & Quatieri, 1986; Serra & Smith, 1990). Additive models are strictly more expressive than subtractive models but have more parameters as each sinusoid has its own time-varying loudness and frequency. This work builds a differentiable synthesizer off the Harmonic plus Noise model (Serra & Smith, 1990; Beauchamp, 2007): an additive synthesizer combines sinusoids in harmonic (integer) ratios of a fundamental frequency alongside a time-varying filtered noise signal.
54
+
55
+ Synthesizers. A separate thread of research has tried to estimate parameters for commercial synthesizers using gradient-free methods (Huang et al., 2014; Hoffman & Cook, 2006). Synthesizer outputs modeled with a variational autoencoder were recently used as a “world model” (Ha & Schmidhuber, 2018) to pass approximate gradients to a controller during learning (Esling et al., 2019). DDSP differs from black-box approaches to modeling existing synthesizers; it is a toolkit of differentiable DSP components for end-to-end learning.
56
+
57
+ Neural Source Filter (NSF). Perhaps closest to this work, promising speech synthesis results were recently achieved using a differentiable waveshaping synthesizer (Wang et al., 2019). The NSF can be seen as a specific DDSP model, that uses convolutional waveshaping of a sinusoidal oscillator to create harmonic content, rather than additive synthesis explored in this work. Both works also generate audio in the time domain and impose multi-scale spectrograms losses in the frequency domain. A key contribution of this work is to highlight how these models are part of a common family of techniques and to release a modular library that makes them accessible by leveraging automatic differentiation to easily mix and match components at a high level.
58
+
59
+ # 3 DDSP COMPONENTS
60
+
61
+ Many DSP operations can be expressed as functions in modern automatic differentiation software. We express core components as feedforward functions, allowing efficient implementation on parallel
62
+
63
+ hardware such as GPUs and TPUs, and generation of samples during training. These components include oscillators, envelopes, and filters (linear-time-varying finite-impulse-response, LTV-FIR). 3
64
+
65
+ # 3.1 SPECTRAL MODELING SYNTHESIS
66
+
67
+ Here, as an example DDSP model, we implement a differentiable version of Spectral Modeling Synthesis (SMS) Serra & Smith (1990). This model generates sound by combining an additive synthesizer (adding together many sinusoids) with a subtractive synthesizer (filtering white noise). We choose SMS because, despite being parametric, it is a highly expressive model of sound, and has found widespread adoption in tasks as diverse as spectral morphing, time stretching, pitch shifting, source separation, transcription, and even as a general purpose audio codec in MPEG-4 (Tellman et al., 1995; Klapuri et al., 2000; Purnhagen & Meine, 2000).
68
+
69
+ As we only consider monophonic sources in these experiments, we use the Harmonic plus Noise model, that further constrains sinusoids to be integer multiples of a fundamental frequency (Beauchamp, 2007). One of the reasons that SMS is more expressive than many other parametric models because it has so many more parameters. For example, in the 4 seconds of $1 6 \mathrm { k H z }$ audio in the datasets considered here, the synthesizer coefficients actually have ${ \sim } 2 . 5$ times more dimensions than the audio waveform itself ((1 amplitude $+ ~ 1 0 0$ harmonics $+ ~ 6 5$ noise band magnitudes) $\ast 1 0 0 0$ timesteps $= 1 6 5 { , } 0 0 0$ dimensions, vs. 64,000 audio samples). This makes them amenable to control by a neural network, as it would be difficult to realistically specify all these parameters by hand.
70
+
71
+ # 3.2 HARMONIC OSCILLATOR $/$ ADDITIVE SYNTHESIZER
72
+
73
+ At the heart of the synthesis techniques explored in this paper is the sinusoidal oscillator. A bank of oscillators that outputs a signal $x ( n )$ over discrete time steps, $n$ , can be expressed as:
74
+
75
+ $$
76
+ x ( n ) = \sum _ { k = 1 } ^ { K } A _ { k } ( n ) \sin ( \phi _ { k } ( n ) ) ,
77
+ $$
78
+
79
+ where $A _ { k } ( n )$ is the time-varying amplitude of the $k$ -th sinusoidal component and $\phi _ { k } ( n )$ is its instantaneous phase. The phase $\phi _ { k } ( n )$ is obtained by integrating the instantaneous frequency $f _ { k } ( n )$ :
80
+
81
+ $$
82
+ \phi _ { k } ( n ) = 2 \pi \sum _ { m = 0 } ^ { n } f _ { k } ( m ) + \phi _ { 0 , k } ,
83
+ $$
84
+
85
+ where $\phi _ { 0 , k }$ is the initial phase that can be randomized, fixed, or learned.
86
+
87
+ For a harmonic oscillator, all the sinusoidal frequencies are harmonic (integer) multiples of a fundamental frequency, $f _ { 0 } ( n )$ , i.e., $f _ { k } ( n ) = k f _ { 0 } ( n )$ , Thus the output of the harmonic oscillator is entirely parameterized by the time-varying fundamental frequency $f _ { 0 } ( n )$ and harmonic amplitudes $A _ { k } ( n )$ . To aid interpretablity we further factorize the harmonic amplitudes:
88
+
89
+ $$
90
+ A _ { k } ( n ) = A ( n ) c _ { k } ( n ) .
91
+ $$
92
+
93
+ into a global amplitude $A ( n )$ that controls the loudness and a normalized distribution over harmonics $c ( n )$ that determines spectral variations, where $\textstyle \sum _ { k = 0 } ^ { K } c _ { k } ( n ) = 1$ and $c _ { k } ( n ) \geq 0$ . We also constrain both amplitudes and harmonic distribution components to be positive through the use of a modified sigmoid nonlinearity as described in the appendix. Figure 6 provides a graphical example of the additive synthesizer. Audio is provided in our online supplement2.
94
+
95
+ # 3.3 ENVELOPES
96
+
97
+ The oscillator formulation above requires time-varying amplitudes and frequencies at the audio sample rate, but our neural networks operate at a slower frame rate. For instantaneous frequency upsampling, we found bilinear interpolation to be adequate. However, the amplitudes and harmonic distributions of the additive synthesizer required smoothing to prevent artifacts. We are able to achieve this with a smoothed amplitude envelope by adding overlapping Hamming windows at the center of each frame and scaled by the amplitude. For these experiments we found a 4ms (64 timesteps) hop size and $8 \mathrm { m s }$ frame size ( $50 \%$ overlap) to be responsive to changes while removing artifacts.
98
+
99
+ 3.4 FILTER DESIGN: FREQUENCY SAMPLING METHOD
100
+
101
+ Linear filter design is a cornerstone of many DSP techniques. Standard convolutional layers are equivalent to linear time invariant finite impulse response (LTI-FIR) filters. However, to ensure interpretability and prevent phase distortion, we employ the frequency sampling method to convert network outputs into impulse responses of linear-phase filters.
102
+
103
+ Here, we design a neural network to predict the frequency-domain transfer functions of a FIR filter for every output frame. In particular, the neural network outputs a vector $\pmb { H } _ { l }$ (and accordingly $\pmb { h } _ { l } = \mathrm { I D P T } ( \bar { \pmb { H } } _ { l } ) ;$ ) for the $l$ -th frame of the output. We interpret $\pmb { H } _ { l }$ as the frequency-domain transfer function of the corresponding FIR filter. We therefore implement a time-varying FIR filter.
104
+
105
+ To apply the time-varying FIR filter to the input, we divide the audio into non-overlapping frames $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } \mathbf { \mathcal { l } } }$ to match the impulse responses $h _ { l }$ . We then perform frame-wise convolution via multiplication of frames in the Fourier domain: $Y _ { l } = H _ { l } X _ { l }$ where $\pmb { X } _ { l } = \mathbf { D } \mathrm { F T } ( \pmb { x } _ { l } )$ and $Y _ { l } = \mathrm { D F T } ( { \pmb y } _ { l } )$ is the output. We recover the frame-wise filtered audio, ${ \pmb y } _ { l } = \mathrm { I D F T } ( { \pmb Y } _ { l } )$ , and then overlap-add the resulting frames with the same hop size and rectangular window used to originally divide the input audio. The hop size is given by dividing the audio into equally spaced frames for each frame of conditioning. For 64000 samples and 250 frames, this corresponds to a hop size of 256.
106
+
107
+ In practice, we do not use the neural network output directly as $\pmb { H } _ { l }$ . Instead, we apply a window function $W$ on the network output to compute $\pmb { H } _ { l }$ . The shape and size of the window can be decided independently to control the time-frequency resolution trade-off of the filter. In our experiments, we default to a Hann window of size 257. Without a window, the resolution implicitly defaults to a rectangular window which is not ideal for many cases. We take care to shift the IR to zero-phase (symmetric) form before applying the window and revert to causal form before applying the filter.
108
+
109
+ # 3.5 FILTERED NOISE / SUBTRACTIVE SYNTHESIZER
110
+
111
+ Natural sounds contain both harmonic and stochastic components. The Harmonic plus Noise model captures this by combining the output of an additive synthesizer with a stream of filtered noise (Serra & Smith, 1990; Beauchamp, 2007). We are able to realize a differentiable filtered noise synthesizer by simply applying the LTV-FIR filter from above to a stream of uniform noise $Y _ { l } = H _ { l } N _ { l }$ where $N _ { l }$ is the DFT of uniform noise in domain [-1, 1].
112
+
113
+ # 3.6 REVERB: LONG IMPULSE RESPONSES
114
+
115
+ Room reverbation (reverb) is an essential characteristic of realistic audio, which is usually implicitly modeled by neural synthesis algorithms. In contrast, we gain interpretability by explicitly factorizing the room acoustics into a post-synthesis convolution step. A realistic room impulse response (IR) can be as long as several seconds, corresponding to extremely long convolutional kernel sizes $( \sim 1 0 - 1 0 0 \mathrm { k }$ timesteps). Convolution via matrix multiplication scales as $\mathsf { \bar { O } } ( n ^ { 3 } )$ , which is intractable for such large kernel sizes. Instead, we implement reverb by explicitly performing convolution as multiplication in the frequency domain, which scales as $\mathcal { O } ( n \overset { \cdot } { \log { n } } )$ and does not bottleneck training.
116
+
117
+ # 4 EXPERIMENTS
118
+
119
+ For empirical verification of this approach, we test two DDSP autoencoder variants–supervised and unsupervised–on two different musical datasets: NSynth (Engel et al., 2017) and a collection of solo violin performances. The supervised DDSP autoencoder is conditioned on fundamental frequency (F0) and loudness features extracted from audio, while the unsupervised DDSP autoencoder learns F0 jointly with the rest of the network.
120
+
121
+ ![](images/b3faeae273ee3875acc36bee50e5284123271a04e2aaa285692bb408b6dac899.jpg)
122
+ Figure 2: Autoencoder architecture. Red components are part of the neural network architecture, green components are the latent representation, and yellow components are deterministic synthesizers and effects. Components with dashed borders are not used in all of our experiments. Namely, $_ z$ is not used in the model trained on solo violin, and reverb is not used in the models trained on NSynth. See the appendix for more detailed diagrams of the neural network components.
123
+
124
+ # 4.1 DDSP AUTOENCODER
125
+
126
+ DDSP components do not put constraints on the choice of generative model (GAN, VAE, Flow, etc.), but we focus here on a deterministic autoencoder to investigate the strength of DDSP components independent of any particular approach to adversarial training, variational inference, or Jacobian design. Just as autoencoders utilizing convolutional layers outperform fully-connected autoencoders on images, we find DDSP components are able to dramatically improve autoencoder performance in the audio domain. Introducing stochastic latents (such as in GAN, VAE, and Flow models) will likely further improve performance, but we leave that to future work as it is orthogonal to the core question of DDSP component performance that we investigate in this paper.
127
+
128
+ In a standard autoencoder, an encoder network $f _ { \mathrm { e n c } } ( \cdot )$ maps the input $_ { \textbf { \em x } }$ to a latent representation $z = f _ { \mathrm { e n c } } ( \pmb { x } )$ and a decoder network $f _ { \mathrm { d e c } } ( \cdot )$ attempts to directly reconstruct the input $\begin{array} { r } { \bar { \hat { \pmb x } } = f _ { \mathrm { d e c } } ( \pmb z ) } \end{array}$ . Our architecture (Figure 2) contrasts with this approach through the use of DDSP components and a decomposed latent representation.
129
+
130
+ Encoders: Detailed descriptions of the encoders are given in Section B.1. For the supervised autoencoder, the loudness $l ( t )$ is extracted directly from the audio, a pretrained CREPE model with fixed weights (Kim et al., 2018) is used as an $f ( t )$ encoder to extact the fundamental frequency, and optional encoder extracts a time-varying latent encoding $z ( t )$ of the residual information. For the $z ( t )$ encoder, MFCC coefficients (30 per a frame) are first extracted from the audio, which correspond to the smoothed spectral envelope of harmonics (Beauchamp, 2007), and transformed by a single GRU layer into 16 latent variables per a frame.
131
+
132
+ For the unsupervised autoencoder, the pretrained CREPE model is replaced with a Resnet architecture (He et al., 2016) that extracts $f ( t )$ from a mel-scaled log spectrogram of the audio, and is jointly trained with the rest of the network.
133
+
134
+ Decoder: A detailed description of the decoder network is given in Section B.2. The decoder network maps the tuple $( f ( \bar { t } ) , l ( t ) , z ( t ) )$ to control parameters for the additive and filtered noise synthesizers described in Section 3. The synthesizers generate audio based on these parameters, and a reconstruction loss between the synthesized and original audio is minimized. The network architecture is chosen to be fairly generic (fully connected, with a single recurrent layer) to demonstrate that it is the DDSP components, and not other modeling decisions, that enables the quality of the work.
135
+
136
+ Also unique to our approach, the latent $f ( t )$ is fed directly to the additive synthesizer as it has structural meaning for the synthesizer outside the context of any given dataset. As shown later in Section 5.2, this disentangled representation enables the model to both interpolate within and ex
137
+
138
+ <table><tr><td></td><td>Loudness (L1)</td><td>F0 (L1)</td><td>F0 Outliers</td></tr><tr><td>Supervised WaveRNN (Hantrakul et al., 2019)</td><td>0.10</td><td>1.00</td><td>0.07</td></tr><tr><td>DDSP Autoencoder Unsupervised</td><td>0.07</td><td>0.02</td><td>0.003</td></tr><tr><td>DDSP Autoencoder</td><td>0.09</td><td>0.80</td><td>0.04</td></tr></table>
139
+
140
+ Table 1: Resynthesis accuracies. Comparison of DDSP models to SOTA WaveRNN model provided the same conditioning information. The supervised DDSP Autoencoder and WaveRNN models use the fundamental frequency from a pretrained CREPE model, while the unsupervised DDSP autoencoder learns to infer the frequency from the audio during training.
141
+
142
+ trapolate outside the data distribution. Indeed, recent work support incorporation of strong inductive biases as a prerequisite for learning disentangled representations (Locatello et al., 2018).
143
+
144
+ Model Size: Table B.6, compares parameter counts for the DDSP models and comparable models including GANSynth (Engel et al., 2019), WaveRNN (Hantrakul et al., 2019), and a WaveNet Autoencoder (Engel et al., 2017). The DDSP models have the fewest parameters (up to 10 times less), despite no effort to minimize the model size in these experiments. Initial experiments with very small models (240k parameters, $3 0 0 \mathrm { x }$ smaller than a WaveNet Autoencoder) have less realistic outputs than the full models, but still have fairly high quality and are promising for low-latency applications, even on CPU or embedded devices. Audio samples are available in the online supplement2.
145
+
146
+ # 4.2 DATASETS
147
+
148
+ NSynth: We focus on a smaller subset of the NSynth dataset (Engel et al., 2017) consistent with other work (Engel et al., 2019; Hantrakul et al., 2019). It totals 70,379 examples comprised mostly of strings, brass, woodwinds and mallets with pitch labels within MIDI pitch range 24-84. We employ a 80/20 train/test split shuffling across instrument families. For the NSynth experiments, we use the autoencoder as described above (with the $z ( t )$ encoder). We experiment with both the supervised and unsupervised variants.
149
+
150
+ Solo Violin: The NSynth dataset does not capture aspects of a real musical performance. Using the MusOpen royalty free music library, we collected 13 minutes of expressive, solo violin performances4. We purposefully selected pieces from a single performer (John Garner), that were monophonic and shared a consistent room environment to encourage the model to focus on performance. Like NSynth, audio is converted to mono 16kHz and divided into 4 second training examples (64000 samples total). Code to process the audio files into a dataset is available online.5
151
+
152
+ For the solo violin experiments, we use the supervised variant of the autoencoder (without the $z ( t )$ encoder), and add a reverb module to the signal processor chain to account for room reverberation. While the room impulse response could be produced as an output of the decoder, given that the solo violin dataset has a single acoustic environment, we use a single fixed variable (4 second reverb corresponding to 64000 dimensions) for the impulse response.
153
+
154
+ # 4.2.1 MULTI-SCALE SPECTRAL LOSS
155
+
156
+ The primary objective of the autoencoder is to minimize reconstruction loss. However, for audio waveforms, point-wise loss on the raw waveform is not ideal, as two perceptually identical audio samples may have distinct waveforms, and point-wise similar waveforms may sound very different.
157
+
158
+ Instead, we use a multi-scale spectral loss–similar to the multi-resolution spectral amplitude distance in Wang et al. (2019)–defined as follows. Given the original and synthesized audio, we compute their (magnitude) spectrogram $S _ { i }$ and $\hat { S } _ { i }$ , respectively, with a given FFT size $i$ , and define the loss as the
159
+
160
+ ![](images/f2f0d286056bf63409e00e2505c28e1a83f0f8f4bf3231325c3cd798a3824c35.jpg)
161
+ Figure 3: Separate interpolations over loudness, pitch, and timbre. The conditioning features (solid lines) are extracted from two notes and linearly mixed (dark to light coloring). The features of the resynthsized audio (dashed lines) closely follow the conditioning. On the right, the latent vectors, $z ( t )$ , are interpolated, and the spectral centroid of resulting audio (thin solid lines) smoothly varies between the original samples (dark solid lines).
162
+
163
+ sum of the L1 difference between $S _ { i }$ and $\hat { S } _ { i }$ as well as the L1 difference between $\log { S _ { i } }$ and $\log { \hat { S } _ { i } }$ .
164
+
165
+ $$
166
+ L _ { i } = | | S _ { i } - \hat { S _ { i } } | | _ { 1 } + \alpha | | \log S _ { i } - \log \hat { S } _ { i } | | _ { 1 } .
167
+ $$
168
+
169
+ where $\alpha$ is a weighting term set to 1.0 in our experiments. The total reconstruction loss is then the sum of all the spectral losses, $\begin{array} { r } { L _ { \mathrm { r e c o n s t r u c t i o n } } = \sum _ { i } { L _ { i } } } \end{array}$ . In our experiments, we used FFT sizes (2048, 1024, 512, 256, 128, 64), and the neighboring frames in the Short-Time Fourier Transform (STFT) overlap by $7 5 \%$ . Therefore, the $L _ { i }$ ’s cover differences between the original and synthesized audios at different spatial-temporal resolutions.
170
+
171
+ # 5 RESULTS
172
+
173
+ # 5.1 HIGH-FIDELITY SYNTHESIS
174
+
175
+ As shown in Figure 5, the DDSP autoencoder learns to very accurately resynthesize the solo violin dataset. Again, we highly encourage readers to listen to the samples provided in the online supplement2. A full decomposition of the components is provided Figure 5. High-quality neural audio synthesis has previously required very large autoregressive models (Oord et al., 2016; Kalchbrenner et al., 2018) or adversarial loss functions (Engel et al., 2019). While amenable to an adversarial loss, the DDSP autoencoder achieves these results with a straightforward L1 spectrogram loss, a small amount of data, and a relatively simple model. This demonstrates that the model is able to efficiently exploit the bias of the DSP components, while not losing the expressive power of neural networks.
176
+
177
+ For the NSynth dataset, we quantitatively compare the quality of DDSP resynthesis with that of a state-of-the-art baseline using WaveRNN (Hantrakul et al., 2019). The models are comparable as they are trained on the same data, provided the same conditioning, and both targeted towards realtime synthesis applications. In Table 1, we compute loudness and fundamental frequency (F0) $L _ { 1 }$ metrics described in Section C of the appendix. Despite the strong performance of the baseline, the supervised DDSP autoencoder still outperforms it, especially in $\mathrm { F 0 ~ } L _ { 1 }$ . This is not unexpected, as the additive synthesizer directly uses the conditioning frequency to synthesize audio.
178
+
179
+ The unsupervised DDSP autoencoder must learn to infer its own F0 conditioning signal directly from the audio. As described in Section B.4, we improve optimization by also adding a perceptual loss in the form of a pretrained CREPE network (Kim et al., 2018). While not as accurate as the supervised DDSP version, the model does a fair job at learning to generate sounds with the correct frequencies without supervision, outperforming the supervised WaveRNN model.
180
+
181
+ # 5.2 INDEPENDENT CONTROL OF LOUDNESS AND PITCH
182
+
183
+ Interpolation: Interpretable structure allows for independent control over generative factors. Each component of the factorized latent variables $( f ( t ) , l ( t ) , z ( t ) )$ independently alters samples along a matching perceptual axis. For example, Figure 3 shows an interpolation between two sound in the loudness conditioning $l ( t )$ . With other variables held constant, loudness of the synthesized audio closely matches the interpolated input. Similarly, the model reliably matches intermediate pitches between a high pitched $f ( t )$ and low pitched $f ( t )$ . In Table C.2 of the appendix, we quantitatively demonstrate how across interpolations, conditioning independently controls the corresponding characteristics of the audio.
184
+
185
+ ![](images/414209bf77fffcbe6e4b5785b534f765efaa40fc9593c11d89c199f57b09dd0d.jpg)
186
+ Figure 4: Timbre transfer from singing voice to violin. F0 and loudness features are extracted from the voice and resynthesized with a DDSP autoencoder trained on solo violin.
187
+
188
+ With loudness and pitch explicitly controlled by $( f ( t ) , l ( t ) )$ , the model should use the residual $z ( t )$ to encode timbre. Although architecture and training do not strictly enforce this encoding, we qualitatively demonstrate how varying $_ z$ leads to a smooth change in timbre. In Figure 3, we use the smooth shift in spectral centroid, or “center of mass” of a spectrum, to illustrate this behavior.
189
+
190
+ Extrapolation: As described in Section 4.1, $f ( t )$ directly controls the additive synthesizer and has structural meaning outside the context of any given dataset. Beyond interpolating between datapoints, the model can extrapolate to new conditions not seen during training. The rightmost plot of Figure 7 demonstrates this by resynthesizing a clip of solo violin after shifting $f ( t )$ down an octave and outside the range of the training data. The audio remains coherent and resembles a related instrument such as a cello. $f ( t )$ is only modified for the synthesizer, as the decoder is still bounded by the nearby distribution of the training data and produces unrealistic harmonic content if conditioned far outside that distribution.
191
+
192
+ # 5.3 DEREVERBERATION AND ACOUSTIC TRANSFER
193
+
194
+ Removing reverb in a “blind” setting, where only reverberated audio is available, is a standing problem in acoustics (Naylor & Gaubitch, 2010). However, a benefit of our modular approach to generative modeling is that it becomes possible to completely separate the source audio from the effect of the room. For the solo violin dataset, the DDSP autoencoder is trained with an additional reverb module as shown in Figure 2 and described in Section 3.6. Figure 7 (left) demonstrates that bypassing the reverb module during resynthesis results in completely dereverberated audio, similar to recording in an anechoic chamber. The quality of the approach is limited by the underlying generative model, which is quite high for our autoencoder. Similarly, Figure 7 (center) demonstrates that we can also apply the learned reverb model to new audio, in this case singing, and effectively transfer the acoustic environment of the solo violin recordings.
195
+
196
+ # 5.4 TIMBRE TRANSFER
197
+
198
+ Figure 4 demonstrates timbre transfer, converting the singing voice of an author into a violin. F0 and loudness features are extracted from the singing voice and the DDSP autoencoder trained on solo violin used for resynthesis. To better match the conditioning features, we first shift the fundamental frequency of the singing up by two octaves to fit a violin’s typical register. Next, we transfer the room acoustics of the violin recording (as described in Section 5.3) to the voice before extracting loudness, to better match the loudness contours of the violin recordings. The resulting audio captures many subtleties of the singing with the timbre and room acoustics of the violin dataset. Note the interesting “breathing” artifacts in the silence corresponding to unvoiced syllables from the singing.
199
+
200
+ # 6 CONCLUSION
201
+
202
+ The DDSP library fuses classical DSP with deep learning, providing the ability to take advantage of strong inductive biases without losing the expressive power of neural networks and end-to-end
203
+
204
+ learning. We encourage contributions from domain experts and look forward to expanding the scope of the DDSP library to a wide range of future applications.
205
+
206
+ # REFERENCES
207
+
208
+ S. O. Arik, H. Jun, and G. Diamos. Fast spectrogram inversion using multi-head convolutional neural networks. IEEE Signal Processing Letters, 26(1):94–98, Jan 2019. doi: 10.1109/LSP. 2018.2880284.
209
+
210
+ James W Beauchamp. Analysis, synthesis, and perception of musical sounds. Springer, 2007.
211
+
212
+ Merlijn Blaauw and Jordi Bonada. A neural parametric singing synthesizer modeling timbre and expression from natural songs. Applied Sciences, 7(12):1313, 2017.
213
+
214
+ Pritish Chandna, Merlijn Blaauw, Jordi Bonada, and Emilia Gomez. Wgansing: A multi-voice singing voice synthesizer based on the wasserstein-gan. arXiv preprint arXiv:1903.10729, 2019.
215
+
216
+ Taishih Chi, Powen Ru, and Shihab A Shamma. Multiresolution spectrotemporal analysis of complex sounds. The Journal of the Acoustical Society of America, 118(2):887–906, 2005.
217
+
218
+ Alexandre Defossez, Neil Zeghidour, Nicolas Usunier, Leon Bottou, and Francis Bach. Sing: Symbol-to-instrument neural generator. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 9041–9051. Curran Associates, Inc., 2018. URL http://papers.nips.cc/paper/ 8118-sing-symbol-to-instrument-neural-generator.pdf.
219
+
220
+ Chris Donahue, Julian McAuley, and Miller Puckette. Adversarial audio synthesis. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum? id $=$ ByMVTsR5KQ.
221
+
222
+ Alexey Dosovitskiy and Thomas Brox. Generating images with perceptual similarity metrics based on deep networks. In Advances in neural information processing systems, pp. 658–666, 2016.
223
+
224
+ Jesse Engel, Cinjon Resnick, Adam Roberts, Sander Dieleman, Douglas Eck, Karen Simonyan, and Mohammad Norouzi. Neural audio synthesis of musical notes with WaveNet autoencoders. In ICML, 2017.
225
+
226
+ Jesse Engel, Kumar Krishna Agrawal, Shuo Chen, Ishaan Gulrajani, Chris Donahue, and Adam Roberts. GANSynth: Adversarial neural audio synthesis. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ H1xQVn09FX.
227
+
228
+ Philippe Esling, Naotake Masuda, Adrien Bardet, Romeo Despres, et al. Universal audio synthesizer control with normalizing flows. arXiv preprint arXiv:1907.00971, 2019.
229
+
230
+ James L Flanagan. Speech analysis synthesis and perception, volume 3. Springer Science & Business Media, 2013.
231
+
232
+ David Ha and Jurgen Schmidhuber. World models. ¨ arXiv preprint arXiv:1803.10122, 2018.
233
+
234
+ Lamtharn (Hanoi) Hantrakul, Jesse Engel, Adam Roberts, and Chenjie Gu. Fast and flexible neural audio synthesis. In ISMIR, 2019.
235
+
236
+ 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.
237
+
238
+ Matthew D Hoffman and Perry R Cook. Feature-based synthesis: Mapping acoustic and perceptual features onto synthesis parameters. In ICMC. Citeseer, 2006.
239
+
240
+ Kurt Hornik, Maxwell Stinchcombe, and Halbert White. Multilayer feedforward networks are universal approximators. Neural networks, 2(5):359–366, 1989.
241
+
242
+ Cheng-Zhi Anna Huang, David Duvenaud, Kenneth C Arnold, Brenton Partridge, Josiah W Oberholtzer, and Krzysztof Z Gajos. Active learning of intuitive control knobs for synthesizers using gaussian processes. In Proceedings of the 19th international conference on Intelligent User Interfaces, pp. 115–124. ACM, 2014.
243
+
244
+ Nal Kalchbrenner, Erich Elsen, Karen Simonyan, Seb Noury, Norman Casagrande, Edward Lockhart, Florian Stimberg, Aaron van den Oord, Sander Dieleman, and Koray Kavukcuoglu. Efficient neural audio synthesis. arXiv preprint arXiv:1802.08435, 2018.
245
+
246
+ Jong Wook Kim, Justin Salamon, Peter Li, and Juan Pablo Bello. Crepe: A convolutional representation for pitch estimation. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 161–165. IEEE, 2018.
247
+
248
+ Anssi Klapuri, Tuomas Virtanen, and Jan-Markus Holm. Robust multipitch estimation for the analysis and manipulation of polyphonic musical signals. In Proc. COST-G6 Conference on Digital Audio Effects, pp. 233–236, 2000.
249
+
250
+ Y. LeCun, B. Boser, J. S. Denker, D. Henderson, R. E. Howard, W. Hubbard, and L. D. Jackel. Backpropagation applied to handwritten zip code recognition. Neural Computation, 1(4):541– 551, 1989. doi: 10.1162/neco.1989.1.4.541. URL https://doi.org/10.1162/neco. 1989.1.4.541.
251
+
252
+ Francesco Locatello, Stefan Bauer, Mario Lucic, Sylvain Gelly, Bernhard Scholkopf, and Olivier ¨ Bachem. Challenging common assumptions in the unsupervised learning of disentangled representations. arXiv preprint arXiv:1811.12359, 2018.
253
+
254
+ Robert McAulay and Thomas Quatieri. Speech analysis/synthesis based on a sinusoidal representation. IEEE Transactions on Acoustics, Speech, and Signal Processing, 34(4):744–754, 1986.
255
+
256
+ Soroush Mehri, Kundan Kumar, Ishaan Gulrajani, Rithesh Kumar, Shubham Jain, Jose Sotelo, Aaron Courville, and Yoshua Bengio. Samplernn: An unconditional end-to-end neural audio generation model. arXiv preprint arXiv:1612.07837, 2016.
257
+
258
+ Michelle Moerel, Federico De Martino, and Elia Formisano. Processing of natural sounds in human auditory cortex: tonotopy, spectral tuning, and relation to voice sensitivity. Journal of Neuroscience, 32(41):14205–14216, 2012.
259
+
260
+ Masanori Morise, Fumiya Yokomori, and Kenji Ozawa. World: a vocoder-based high-quality speech synthesis system for real-time applications. IEICE TRANSACTIONS on Information and Systems, 99(7):1877–1884, 2016.
261
+
262
+ Patrick A Naylor and Nikolay D Gaubitch. Speech dereverberation. Springer Science & Business Media, 2010.
263
+
264
+ Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016.
265
+
266
+ Heiko Purnhagen and Nikolaus Meine. Hiln-the mpeg-4 parametric audio coding tools. In 2000 IEEE International Symposium on Circuits and Systems. Emerging Technologies for the 21st Century. Proceedings (IEEE Cat No. 00CH36353), volume 3, pp. 201–204. IEEE, 2000.
267
+
268
+ Xavier Serra and Julius Smith. Spectral modeling synthesis: A sound analysis/synthesis system based on a deterministic plus stochastic decomposition. Computer Music Journal, 14(4):12–24, 1990.
269
+
270
+ Julius Orion Smith. Physical audio signal processing: For virtual musical instruments and audio effects. W3K publishing, 2010.
271
+
272
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pp. 3104–3112, 2014.
273
+
274
+ Edwin Tellman, Lippold Haken, and Bryan Holloway. Timbre morphing of sounds with unequal numbers of features. Journal of the Audio Engineering Society, 43(9):678–689, 1995.
275
+
276
+ Fred´ eric E Theunissen and Julie E Elie. Neural processing of natural sounds. ´ Nature Reviews Neuroscience, 15(6):355, 2014.
277
+ 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.
278
+ Xin Wang, Shinji Takaki, and Junichi Yamagishi. Neural source-filter waveform models for statistical parametric speech synthesis. arXiv preprint arXiv:1904.12088, 2019.
279
+ Yuxuan Wang, RJ Skerry-Ryan, Daisy Stanton, Yonghui Wu, Ron J Weiss, Navdeep Jaitly, Zongheng Yang, Ying Xiao, Zhifeng Chen, Samy Bengio, et al. Tacotron: Towards end-to-end speech synthesis. In INTERSPEECH, 2017.
280
+ P. J. Werbos. Backpropagation through time: what it does and how to do it. Proceedings of the IEEE, 78(10):1550–1560, Oct 1990. doi: 10.1109/5.58337.
281
+ Ronald J Williams and David Zipser. Gradient-based learning algorithms for recurrent connectionist networks. College of Computer Science, Northeastern University Boston, MA, 1990.
282
+
283
+ A APPENDIX
284
+
285
+ ![](images/ae69231c516ed09fed6808a0b174b09d4bc195050f2cd9f0a31748d0ba579fdf.jpg)
286
+ Figure 5: Decomposition of a clip of solo violin. Audio is visualized with log magnitude spectrograms. Loudness and fundamental frequency signals are extracted from the original audio. The loudness curve does not exhibit clear note segmentations because of the effects of the room acoustics. The DDSP autoencoder takes those conditioning signals and predicts amplitudes, harmonic distributions, and noise magnitudes. Note that the amplitudes are clearly segmented along note boundaries without supervision and that the harmonic and noise distributions are complex and dynamic despite the simple conditioning signals. Finally, the extracted impulse response is applied to the combined audio from the synthesizers to give the full resynthesis audio.
287
+
288
+ ![](images/855c51131f1c81de60a033cdab15dea61c347a2213820e4eb8131484c53c7d92.jpg)
289
+ Figure 6: Diagram of the Additive Synthesizer component. The synthesizer generates audio as a sum of sinusoids at harmonic (integer) multiples of the fundamental frequency. The neural network is then tasked with emitting time-varying synthesizer parameters (fundamental frequency, amplitude, harmonic distribution). In this example linear-frequency log-magnitude spectrograms show how the harmonics initially follow the frequency contours of the fundamental. We then factorize the harmonic amplitudes into an overall amplitude envelope that controls the loudness, and a normalized distribution among the different harmonics that determines spectral variations.
290
+
291
+ ![](images/3581853ac178f33be8f9520b8d3ecfdb7ccd3ddd4adef98cc5b7a6863db827eb.jpg)
292
+ Figure 7: Interpretable generative models enables disentanglement and extrapolation. Spectrograms of audio examples include dereverberation of a clip of solo violin playing (left), transfer of the extracted room response to new audio (center), and transposition below the range of training data (right).
293
+
294
+ # B MODEL DETAILS
295
+
296
+ # B.1 ENCODERS
297
+
298
+ The model has three encoders: $f$ -encoder that outputs fundamental frequency $f ( t )$ , $l$ -encoder that outputs loudness $l ( t )$ , and a $_ { z }$ -encoder that outputs residual vector $z ( t )$ .
299
+
300
+ $f$ -encoder: We use a pretrained CREPE pitch detector (Kim et al., 2018) as the $f$ -encoder to extract ground truth fundamental frequencies (F0) from the audio. We used the “large” variant of CREPE, which has SOTA accuracy for monophonic audio samples of musical instruments. For our supervised autoencoder experiments, we fixed the weights of the $f$ -encoder like (Hantrakul et al., 2019), and for our unsupervised autoencoder experiemnts we jointly learn the weights of a resnet model fed log mel spectrograms of the audio. Full details of the resnet architecture are show in Table 2.
301
+
302
+ $l$ -encoder: We use identical computational steps to extract loudness as (Hantrakul et al., 2019). Namely, an A-weighting of the power spectrum, which puts greater emphasis on higher frequencies, followed by log scaling. The vector is then centered according to the mean and standard deviation of the dataset.
303
+
304
+ $_ z$ -encoder: As shown in Figure 8, the encoder first calculates MFCC’s (Mel Frequency Cepstrum Coefficients) from the audio. MFCC is computed from the log-mel-spectrogram of the audio with a FFT size of 1024, 128 bins of frequency range between $2 0 \mathrm { H z }$ to $8 0 0 0 \mathrm { H z }$ , overlap of $7 5 \%$ . We use only the first 30 MFCCs that correspond to a smoothed spectral envelope. The MFCCs are then passed through a normalization layer (which has learnable shift and scale parameters) and a 512-unit GRU. The GRU outputs (over time) fed to a 512-unit linear layer to obtain $z ( t )$ . The $_ z$ embedding reported in this model has 16 dimensions across 250 time-steps.
305
+
306
+ Table 2: Model architecture for the f(t) encoder using a Resnet on log mel spectrograms. Spectrograms have a frame size of 2048 and a hop size of 512, and are upsampled at the end to have the same time resoultion as other latents (4ms per a frame). All convolutions use “same” padding and a temporal stride of 1. Each residual block uses a bottleneck structure (He et al., 2016). The final output is a normalized probablity distribution over 128 frequency values (logarithmically scaled between $8 . 2 \mathrm { H z }$ and $1 3 . 3 \mathrm { k H z }$ (https://www.inspiredacoustics.com/en/MIDI_note numbers_and_center_frequencies)). The finally frequency value is the weighted sum of each frequency by its probability.
307
+
308
+ <table><tr><td>Residual Block</td><td>Output Size</td><td>kTime</td><td>kFreq</td><td>SFreq</td><td>kFilters</td></tr><tr><td>layer norm + relu</td><td></td><td>1</td><td>-</td><td>1</td><td>■</td></tr><tr><td>conv</td><td></td><td>1</td><td>1</td><td>1</td><td>kFilters/4</td></tr><tr><td>layer norm + relu</td><td></td><td></td><td>=</td><td>1</td><td></td></tr><tr><td>conv</td><td></td><td>3</td><td>3</td><td>SFreq</td><td>kFilters/4</td></tr><tr><td>layer norm + relu</td><td></td><td></td><td>-</td><td>-</td><td></td></tr><tr><td>conv</td><td></td><td>1</td><td>1</td><td>1</td><td>kFilters</td></tr><tr><td>add residual</td><td></td><td>=</td><td>-</td><td>-</td><td>=</td></tr><tr><td>Resnet</td><td>Output Size</td><td>kTime</td><td>kFreq</td><td>SFreq</td><td>kFilters</td></tr><tr><td>LogMelSpectrogram</td><td>(125,229, 1)</td><td>1</td><td>-</td><td>1</td><td>1</td></tr><tr><td>conv2d</td><td>(125, 115, 64)</td><td>7</td><td>7</td><td>2</td><td>64</td></tr><tr><td>max pool</td><td>(125,58, 64)</td><td>1</td><td>3</td><td>2</td><td>1</td></tr><tr><td>residual block</td><td>(125,58,128)</td><td>3</td><td>3</td><td>1</td><td>128</td></tr><tr><td>residual block</td><td>(125,57, 128)</td><td>3</td><td>3</td><td>1</td><td>128</td></tr><tr><td>residual block</td><td>(125,29,256)</td><td>3</td><td>3</td><td>2</td><td>256</td></tr><tr><td>residual block</td><td>(125,29,256)</td><td>3</td><td>3</td><td>1</td><td>256</td></tr><tr><td>residual block</td><td>(125,29,256)</td><td>3</td><td>3</td><td>1</td><td>256</td></tr><tr><td>residual block</td><td>(125,15,512)</td><td>3</td><td>3</td><td>2</td><td>512</td></tr><tr><td>residual block</td><td>(125,15, 512)</td><td>3</td><td>3</td><td>1</td><td>512</td></tr><tr><td>residual block</td><td>(125,15, 512)</td><td>3</td><td>3</td><td>1</td><td>512</td></tr><tr><td>residual block</td><td>(125,15, 512)</td><td>3</td><td>3</td><td>1</td><td>512</td></tr><tr><td>residual block</td><td>(125,8, 1024)</td><td>3</td><td>3</td><td>2</td><td>1024</td></tr><tr><td>residual block</td><td>(125, 8,1024)</td><td>3</td><td>3</td><td>1</td><td>1024</td></tr><tr><td>residual block</td><td>(125,8, 1024)</td><td>3</td><td>3</td><td>1</td><td>1024</td></tr><tr><td>dense</td><td>(125,1, 128)</td><td></td><td>=</td><td>128</td><td>1</td></tr><tr><td>upsample time</td><td>(1000, 1, 128)</td><td></td><td></td><td></td><td>=</td></tr><tr><td>softplus and normalize</td><td>(1000, 1, 128)</td><td></td><td></td><td></td><td></td></tr></table>
309
+
310
+ # B.2 DECODER
311
+
312
+ The decoder’s input is the latent tuple $( f ( t ) , l ( t ) , z ( t ) )$ (250 timesteps). Its outputs are the parameters required by the synthesizers. For example, in the case of the harmonic synthesizer and filtered noise synthesizer setup, the decoder outputs $\mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \mathbf { } \mathbf \Psi \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf \mathbf \Psi \Psi \Psi \mathbf { } \mathbf \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \mathbf { } \mathbf \mathbf \mathbf \Psi \Psi \mathbf \Psi \mathbf \Psi \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf $ (amplitudes of the harmonics) for the harmonic synthesizer (note that $f ( t )$ is fed directly from the latent), and $\pmb { H }$ (transfer function of the FIR filter) for the filtered noise synthesizer.
313
+
314
+ ![](images/28fbf2379fdd01d9581cdab52dc4eb847082c1784e65dcbb804b6c4e60115aac.jpg)
315
+ Figure 8: Diagram of the $_ { z }$ -encoder.
316
+
317
+ As shown in Figure 9, we use a “shared-bottom” architecture, which computes a shared embedding from the latent tuple, and then have one head for each of the $( \pmb { a } ( t ) , \pmb { H } )$ outputs.
318
+
319
+ In particular, we apply separate MLPs to each of the $( f ( t ) , l ( t ) , z ( t ) )$ input. The outputs of the MLPs are concatenated and passed to a 512-unit GRU. We concatenate the GRU outputs with the outputs of the $f ( t )$ and $l ( t )$ MLPs (in the channel dimenssion) and pass it through a final MLP and Linear layer to get the decoder outputs.
320
+
321
+ ![](images/bbcebb94dbb9524aceff36f3d790224d20b0aa25c1c4063781359c32a7a78840.jpg)
322
+ Figure 9: Diagram of the decoder for the harmonic synthesizer and the filtered noise synthesizer.
323
+
324
+ The MLP architecture, shown in Figure 10, is a standard MLP with a layer normalization (tf.contrib.layers.layer_norm ) before the RELU nonlinearity. In Figure 9, all the MLPs have 3 layers and each layer has 512 units.
325
+
326
+ ![](images/1e46d3e88077e81097613373fcc5a8b27c7c453ce169bee2d1882e6fb619eebc.jpg)
327
+ Figure 10: MLP in the decoder.
328
+
329
+ # B.3 TRAINING
330
+
331
+ Because all DDSP components are differentiable, the model is differentiable end-to-end. Therefore, we can apply any SGD optimizer to train the model. We used ADAM optimizer with learning rate 0.001 and exponential learning rate decay 0.98 every 10,000 steps.
332
+
333
+ # B.4 PERCEPTUAL LOSS
334
+
335
+ To help guide the DDSP autoencoder that must predict $f ( t )$ on the NSynth dataset, we also added an additional perceptual loss using pretrained models, such as the CREPE (Kim et al., 2018) pitch estimator and the encoder of the WaveNet autoencoder (Engel et al., 2017). Compared to the L1 loss on the spectrogram, the activations of different layers in these models correlate better with the perceptual quality of the audio. After a large-scale hyperparameter search, we obtained our best results by using the L1 distance between the activations of the small CREPE model’s fifth max pool layer with a weighting of $5 \times 1 0 ^ { - 5 }$ relative to the spectral loss.
336
+
337
+ # B.5 SYNTHESIZERS
338
+
339
+ Harmonic synthesizer / Additive Synthesis: We use 101 harmonics in the harmonic synthesizer (i.e., $\mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf \Psi \Psi \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf \Psi \Psi \Psi \mathbf { } \mathbf \mathbf \Psi \Psi \mathbf \Psi \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \mathbf \Psi \mathbf \Psi \mathbf \Psi \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \Psi \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \Psi \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \mathbf \Psi \mathbf $ ’s dimension is 101). Amplitude and harmonic distribution parameters are upsampled with overlapping Hamming window envelopes whose frame size is 128 and hop size is 64. Initial phases are all fixed to zero, as neither the spectrogram loss functions or human perception are sensitive to absolute offsets in harmonic phase. We also do not include synthesis elements to model DC components to signals as they are inaudible and not reflected in the spectrogram losses.
340
+
341
+ We force the amplitudes, harmonic distributions, and filtered noise magnitudes to be non-negative by applying a sigmoid nonlinearity to network outputs. We find a slight improvement in traning stability by modifying the sigmoid to have a scaled output, larger slope by exponentiating, and threshold at a minimum value:
342
+
343
+ $$
344
+ y = 2 . 0 \cdot \mathrm { s i g m o i d } ( x ) ^ { \log 1 0 } + 1 0 ^ { - 7 }
345
+ $$
346
+
347
+ Filtered noise synthesizer: We use 65 network output channels as magnitude inputs to the FIR filter of the filtered noise synthesizer.
348
+
349
+ B.6 PARAMETER COUNTS
350
+
351
+ <table><tr><td>Model</td><td>Parameters</td></tr><tr><td>WaveNet Autoencoder (Engel et al.,2017)</td><td>75M</td></tr><tr><td>WaveRNN (Hantrakul et al., 2019)</td><td>23M</td></tr><tr><td>GANSynth (Engel et al., 2019)</td><td>15M</td></tr><tr><td>DDSP Autoencoder (Unsupervised)</td><td>12M</td></tr><tr><td>DDSP Autoencoder (Supervised, NSynth)</td><td>7M</td></tr><tr><td>DDSP Autoencoder (Supervised, Solo Violin)</td><td>6M</td></tr><tr><td>DDSP Autoencoder Tiny (Supervised, Solo Violin)</td><td>0.24M</td></tr></table>
352
+
353
+ Table 3: Parameter counts for different models. All models trained on NSynth dataset except for those marked (Solo Violin). Autoregressive models have the most parameters with GANs requiring less. The DDSP models examined in this paper (which have not been optimized at all for size) require 2 to 3 times less parameters than GANSynth. The unsupervised model has more parameters because of the CREPE (small) $f ( t )$ encoder, and the autoencoder has additional parameters for the $z ( t )$ encoder. Initial experiments with extremely small models (single GRU, 256 units), have slightly less realistic outputs, but still relatively high quality (as can be heard in the supplemental audio).
354
+
355
+ # C EVALUATION DETAILS
356
+
357
+ # C.1 METRICS
358
+
359
+ Loudness $L _ { 1 }$ distance: The loudness vector is extracted from the synthesized audio and $L _ { 1 }$ distance computed against the input’s conditioning loudness vector (ground truth). A better model will produce lower $L _ { 1 }$ distances, indicating input and generated loudness vectors closely match. Note this distance is not back-propagated through the network as a training objective.
360
+
361
+ F0 $L _ { 1 }$ distance: The $\mathrm { F 0 ~ } L _ { 1 }$ distance is reported in MIDI space for easier interpretation; an average $\mathrm { F 0 ~ } L _ { 1 }$ of 1.0 corresponds to a semitone difference. We use the same confidence threshold of 0.85 in (Hantrakul et al., 2019) to select portions where there was detectable pitch content, and compute the metric only in these areas.
362
+
363
+ F0 Outliers: Pitch tracking using CREPE, like any pitch tracker, is not completely reliable. Instabilities in pitch tracking, such as sudden octave jumps at low volumes, can result errors not due to model performance and need to be accounted for. F0 outliers accounts for pitch tracking imperfections in CREPE (Kim et al., 2018) vs. genuinely bad samples generated by the trained model. CREPE outputs both an F0 value as well as a F0 confidence. Samples with confidences below a threshold of 0.85 in (Hantrakul et al., 2019) are labeled as outliers and usually indicate the sample was mostly noise with no pitch or harmonic component. As the model outputs better quality audio, the number of outliers decrease, thus lower scores indicate better performance.
364
+
365
+ # C.2 INTERPOLATION METRICS
366
+
367
+ Loudness $L _ { 1 }$ and $\mathrm { F 0 ~ } L _ { 1 }$ are shown for different interpolation tasks in table C.2. In reconstruction, the model is supplied with the standard $( f ( t ) _ { A } , \bar { l } ( t ) _ { A } , z ( t ) _ { A } )$ . Loudness $( L _ { 1 } )$ and F0 $( L _ { 1 } )$ are computed against the ground truth inputs. In loudness interpolation, the model is supplied with $( f ( t ) _ { A } , l ( t ) _ { B } , z ( t ) _ { A } )$ , and Loudness $( L _ { 1 } )$ is calculated using $l ( t ) _ { B }$ as ground truth instead of $( l ( t ) _ { A } )$ . For F0 interpolation, the model is supplied with $( f ( t ) _ { B } , l ( t ) _ { A } , z ( t ) _ { A } )$ and F0 $( L _ { 1 } )$ is calculated using $f ( t ) _ { B }$ as ground truth instead of $f ( t ) _ { A }$ . For $\textsf { Z }$ interpolation, the model is supplied with $( f ( t ) _ { A } , l ( t ) _ { A } , z ( t ) _ { B } )$ . The low and constant Loudness $( L _ { 1 } )$ and F0 $( L _ { 1 } )$ metrics across these interpolations indicate the model is able independently vary these variables without affecting other components.
368
+
369
+ Table 4: Loudness and F0 metrics for different interpolation tasks.
370
+
371
+ <table><tr><td>Task</td><td>Loudness (L1)</td><td>F0 (L1)</td></tr><tr><td>Reconstruction</td><td>0.042</td><td>0.060</td></tr><tr><td>Loudness l(t) interp.</td><td>0.061</td><td>0.060</td></tr><tr><td>FO f(t) interp.</td><td>0.048</td><td>0.070</td></tr><tr><td>Zz(t) interp.</td><td>0.063</td><td>0.065</td></tr></table>
372
+
373
+ # D OTHER NOTES
374
+
375
+ # D.1 SINUSOIDAL MODELS
376
+
377
+ While unconstrained sinusoidal oscillator banks are strictly more expressive than harmonic oscillators, we restricted ourselves to harmonic synthesizers for the time being to focus the problem domain. However, this is not a fundamental limitation of the technique and perturbations such as inharmonicity can also be incorporated to handle phenomena such as stiff strings (Smith, 2010).
378
+
379
+ # D.2 REGULARIZATION
380
+
381
+ It is worth mentioning that the modular structure of the synthesizers also makes it possible to define additional losses in terms of different synthesizer outputs and parameters. For example, we may impose an SNR loss to penalize outputs with too much noise if we know the training data consists of mostly clean data. We have not experimented too much with such engineered losses, but we believe they can make training more efficient, even though such engineering methods deviates from the end-to-end training paradigm,
md/train/B1xGGTEtDH/B1xGGTEtDH.md ADDED
@@ -0,0 +1,608 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # UNIVERSAL APPROXIMATION WITH DEEP NARROW NETWORKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The classical Universal Approximation Theorem certifies that the universal approximation property holds for the class of neural networks of arbitrary width. Here we consider the natural ‘dual’ theorem for width-bounded networks of arbitrary depth. Precisely, let $n$ be the number of inputs neurons, $m$ be the number of output neurons, and let $\rho$ be any nonaffine continuous function, with a continuous nonzero derivative at some point. Then we show that the class of neural networks of arbitrary depth, width $n + m + 2$ , and activation function $\rho$ , exhibits the universal approximation property with respect to the uniform norm on compact subsets of $\mathbb { R } ^ { n }$ . This covers every activation function possible to use in practice; in particular this includes polynomial activation functions, making this genuinely different to the classical case. We go on to consider extensions of this result. First we show an analogous result for a certain class of nowhere differentiable activation functions. Second we establish an analogous result for noncompact domains, by showing that deep narrow networks with the ReLU activation function exhibit the universal approximation property with respect to the $p$ -norm on $\mathbb { R } ^ { n }$ . Finally we show that width of only $n + m + 1$ suffices for ‘most’ activation functions.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The Universal Approximation Theorem (Cybenko, 1989; Hornik, 1991; Pinkus, 1999) states that universal approximation holds for the class of neural networks with a single hidden layer of arbitrary width, with any continuous nonpolynomial activation function:
12
+
13
+ Theorem 1.1. Let $\rho \colon \mathbb { R } \mathbb { R }$ be any continuous function. Let $\mathcal { N } _ { n } ^ { \rho }$ represent the class of neural networks with activation function $\rho _ { i }$ , with n neurons in the input layer, one neuron in the output layer, and one hidden layer with an arbitrary number of neurons. Let $K \subseteq \mathbb { R } ^ { n }$ be compact. Then $\dot { \mathcal { N } } _ { n } ^ { \rho }$ is dense in $C ( K )$ if and only if ρ is nonpolynomial.
14
+
15
+ What if arbitrary width is replaced with arbitrary depth? Put more precisely, can networks of bounded width and arbitrary depth provide universal approximation? In some sense this poses a question ‘dual’ to the problem answered by the classical Universal Approximation Theorem. We refer to networks of this type as deep, narrow networks.
16
+
17
+ Furthermore we might ask how narrow the network may be, and what activation functions may be admitted. We provide a near-complete answer to these various questions.
18
+
19
+ Universal approximation may be established with respect to more than one topology. Continuous activation functions beget networks representing continuous functions. Thus when working with respect to the uniform norm, it is natural to seek density in $C ( K ; \mathbb { R } ^ { m } )$ for $K \subseteq \mathbb { R } ^ { n }$ . When working with respect to the $p$ -norm, it is natural to seek density in $L ^ { p } ( \mathbb { R } ^ { n } ; \mathbb { R } ^ { m } )$ for $p \in [ 1 , \infty )$ . In this latter case we may hope to generalise to noncompact domains, as functions in $L ^ { p } ( \mathbb { R } ^ { n } ; \mathbb { R } ^ { m } )$ must exhibit some sort of decay.
20
+
21
+ The primary motivation for this work stems from the work of Lu et al. (2017), who study this question in the special case of the popular ReLU activation function, and who establish density in $L ^ { 1 } ( \mathbb { R } ^ { n } )$ . The other notable result we are aware of is the work of Hanin & Sellke (2017), who show another special case: they also consider the ReLU activation function, and establish density in $C ( K ; \mathbb { R } ^ { m } )$ for $K \subseteq \mathbb { R } ^ { n }$ compact.
22
+
23
+ This article demonstrates generalisations of these results, in particular to general activation functions, without relying on the strong algebraic and analytic properties of the ReLU activation function. This also improves certain results specific to the ReLU.
24
+
25
+ The rest of the paper is laid out as follows. Section 2 discusses existing work. Section 3 provides a brief summary of our results; these are then presented in detail in Section 4. Section 5 is the conclusion. Several proofs are deferred to the appendices, due to length and technical content.
26
+
27
+ # 2 CONTEXT
28
+
29
+ Some positive results have been established showing that particular classes of networks are dense in certain spaces. Some negative results have also been established, showing that insufficiently wide networks will fail to be dense.
30
+
31
+ Hanin & Sellke (2017) have shown that deep narrow networks with the ReLU activation function exhibit the universal approximation property in $C ( K ; \mathbb { R } ^ { m } )$ for $K \subseteq \mathbb { R } ^ { n }$ compact.
32
+
33
+ Lu et al. (2017) have shown that deep narrow networks with the ReLU activation function exhibit the universal approximation property in $L ^ { 1 } ( \mathbb { R } ^ { n } )$ , whilst Lin & Jegelka (2018) have shown that a particular description of residual networks, with the ReLU activation function, also exhibit the universal approximation property in this space. We are not aware of any results for the general case of $L ^ { p } ( \mathbb { R } ^ { n } ; \mathbb { R } ^ { m } )$ for $p \in [ 1 , \infty )$ .
34
+
35
+ We do not know of any positive results applying to activation functions other than the ReLU.
36
+
37
+ Regarding widths insufficient for a class of deep narrow networks to exhibit the universal approximation property, consider the case of a network with $n$ input neurons and a single output neuron. For certain activation functions, Johnson (2019) shows that width $n$ is insufficient to give density in $C ( K )$ . For the ReLU activation function, Lu et al. (2017) show that width $n$ is insufficient to give density in $L ^ { 1 } ( \mathbb { R } ^ { n } )$ , and that width $n - 1$ is insufficient in $L ^ { 1 } ( [ - 1 , 1 ] ^ { n } )$ . For the ReLU activation function, Hanin & Sellke (2017) shows that width $n$ is insufficient to give density in $C ( K )$ , and that in fact that this is the greatest possible width not achieving universal approximation in this context.
38
+
39
+ The precise minimum width for activation functions other than ReLU, or for multiple output neurons, remains unknown.
40
+
41
+ Everything discussed so far is in the most general case of approximating functions on Euclidean space: in the language of machine learning, they are regression tasks. There has been some related work in the special case of classification tasks, for example Beise et al. (2018); Szymanski & McCane (2012); Rojas (2003); Nguyen et al. (2018). There has also been some related work in the special case of certain finite domains; Le Roux & Bengio (2010) show that networks with sigmoid activation function and width $n$ can approximate any distribution on $\{ 0 , 1 \} ^ { n }$ . See also Sutskever & Hinton (2008). Montufar (2014) considers the analogous scenario for distributions on ´ $\{ 0 , 1 , \ldots , q - 1 \} ^ { n }$ .
42
+
43
+ # 3 SUMMARY OF RESULTS
44
+
45
+ Definition 3.1. Let $\rho \colon \mathbb { R } \mathbb { R }$ and $n , m , k \in \mathbb { N }$ . Then let N ρn,m,k represent the class of functions $\mathbb { R } ^ { n } \to \mathbb { R } ^ { m }$ described by neural networks with $n$ neurons in the input layer, $m$ neurons in the output layer, $k$ neurons in each hidden layer, and an arbitrary number of hidden layers, such that every neuron in every hidden layer has activation function $\rho$ , and every neuron in the output layer has the identity activation function.
46
+
47
+ Our central result is the following theorem.
48
+
49
+ Theorem 3.2. Let $\rho \colon \mathbb { R } \mathbb { R }$ be any continuous function which is continuously differentiable at at least one point, with nonzero derivative at that point. Let $K \subseteq \mathbb { R } ^ { n }$ be compact. Then $\mathcal { N N } _ { n , m , n + m + 2 } ^ { \rho }$ is dense in $C ( K ; \mathbb { R } ^ { m } )$ .
50
+
51
+ The technical condition is very weak; in particular it is satisfied by every piecewise- $C ^ { 1 }$ function not identically zero. Thus any activation function that one might practically imagine using on a computer must satisfy this property.
52
+
53
+ Theorem 3.2 is proved by handling particular classes of activation functions as special cases. First we have the result for nonpolynomial activation functions, for which the width can be made slightly smaller.
54
+
55
+ Theorem 4.4. Let $\rho \colon \mathbb { R } \mathbb { R }$ be any continuous nonpolynomial function which is continuously differentiable at at least one point, with nonzero derivative at that point. Let $K \subseteq \mathbb { R } ^ { n }$ be compact. Then $\mathcal { N N } _ { n , m , n + m + 1 } ^ { \rho }$ is dense in $C ( K ; \mathbb { R } ^ { m } )$ .
56
+
57
+ We observe a corollary for noncompact domains, which generalises Lu et al. (2017, Theorem 1) to multiple output neurons, a narrower width, and $L ^ { p }$ for $p \geqslant 1$ instead of just $p = 1$ .
58
+
59
+ Corollary 4.6. Let $\rho$ be the ReLU activation function. Let $p \in [ 1 , \infty )$ . Then $\mathcal { N N } _ { n , m , n + m + 1 } ^ { \rho }$ dense in $L ^ { p } ( \mathbb { R } ^ { n } ; \mathbb { R } ^ { m } )$ .
60
+
61
+ Moving on to polynomial activation functions, the smaller width of $n + m + 1$ also suffices for a large class of polynomials.
62
+
63
+ 4.8. and $\rho \colon \mathbb { R } \mathbb { R }$ polynomial for whibe compact. Then a point is dens $\alpha \in \mathbb { R }$ at. $\rho ^ { \prime } ( \alpha ) = 0$ $\rho ^ { \prime \prime } ( \alpha ) \neq 0$ $K \subseteq \mathbb { R } ^ { n }$ $\mathcal { N N } _ { n , m , n + m + 1 } ^ { \rho }$ $C ( K ; \mathbb { R } ^ { m } )$
64
+
65
+ The simplest example of such a $\rho$ is $x \mapsto x ^ { 2 }$ . Note that in the classical arbitrary-width case it is both necessary and sufficient that the activation function be nonpolynomial. Here, however, the same restriction does not hold. Polynomial activation functions are a reasonable choice in this context.
66
+
67
+ The technical restrictions on the polynomial may be lifted by allowing the full $n + m + 2$ neurons per hidden layer.
68
+
69
+ Theorem 4.10. Let $\rho \colon \mathbb { R } \mathbb { R }$ be any nonaffine polynomial. Let $K \subseteq \mathbb { R } ^ { n }$ be compact. Then $\mathcal { N N } _ { n , m , n + m + 2 } ^ { \rho }$ is dense in $C ( K ; \mathbb { R } ^ { m } )$ .
70
+
71
+ It is clear that Theorems 4.4 and 4.10 together imply Theorem 3.2.
72
+
73
+ Finally we observe that even pathological cases not satisfying the technical condition of Theorem 3.2 may exhibit the universal approximation property.
74
+
75
+ Proposition 4.13. Let $w \colon \mathbb { R } \mathbb { R }$ be any bounded continuous nowhere differentiable function. Let $\rho ( x ) = \sin ( x ) + w ( x ) \mathrm { e } ^ { - x }$ , whise in o be nowhere differentiable. Let . $K \subseteq \mathbb { R } ^ { n }$ be compact. $\mathcal { N N } _ { n , m , n + m + 1 } ^ { \rho }$ $C ( K ; \mathbb { R } ^ { m } )$
76
+
77
+ Whilst not of direct practical application, this result exemplifies that little necessarily needs to be assumed about an activation function to understand the corresponding class of neural networks.
78
+
79
+ Remark 3.3. Every proof in this article is constructive, and can in principle be traced so as to determine how depth changes with approximation error. We have instead chosen to focus on quantifying the width necessary for universal approximation. In fact there are places in our arguments where we have used a deeper network over a shallower one, when the deeper network is more easily explained.
80
+
81
+ Remark 3.4. An understanding of universal approximation in deep narrow networks is applicable to an understanding of bottlenecks, when information must be discarded due to space constraints, for example in autoencoders (Bengio et al., 2006). This article demonstrates that certain narrow networks will not constitute a bottleneck; a converse example is Johnson (2019), who demonstrates that networks of insufficient width are forced to maintain certain topological invariants.
82
+
83
+ # 4 UNIVERSAL APPROXIMATION
84
+
85
+ # 4.1 PRELIMINARIES
86
+
87
+ Remark 4.1. A neuron is usually defined as an activation function composed with an affine function. For ease, we shall extend the definition of a neuron to allow it to represent a function of the form $\psi \circ \rho \circ \phi$ , where $\psi$ and $\phi$ are affine functions, and $\rho$ is the activation function. This does not increase the representational power of the network, as the new affine functions may be absorbed into the affine parts of the next layer, but it will make the neural representation of many functions easier to present. We refer to these as enhanced neurons. It is similarly allowable to take affine combinations of multiple enhanced neurons; we will use this fact as well.
88
+
89
+ One of the key ideas behind our constructions is that most reasonable activation functions can be taken to approximate the identity function. Indeed, this is essentially the notion that differentiability captures: that a function is locally affine. This makes it possible to treat neurons as ‘registers’, in which information may be stored and preserved through the layers. This allows for preserving the input values between layers, which is crucial to performing computations in a memory-bounded regime. Thus our constructions have strong overtones of space-limited algorithm design in traditional computer science settings.
90
+
91
+ Lemma 4.2. Let $\rho \colon \mathbb { R } \mathbb { R }$ be any continuous function which is continuously differentiable at at least one point, with nonzero derivative at that point. Let $L \subseteq \mathbb { R }$ be compact. Then a single enhanced neuron with activation function $\rho$ may uniformly approximate the identity function $\iota \colon \mathbb { R } \mathbb { R }$ on $L$ , with arbitrarily small error.
92
+
93
+ Proof. By assumption, as $\rho$ is continuously differentiable, there exists $[ a , b ] \subseteq \mathbb { R }$ with $a \neq b$ , on some neighbourhood of which $\rho$ is differentiable, and $\alpha \in ( a , b )$ at which $\rho ^ { \prime }$ is continuous, and for which $\rho ^ { \prime } ( \alpha )$ is nonzero.
94
+
95
+ For $h \in \mathbb { R } \setminus \{ 0 \}$ , let $\phi _ { h } ( x ) = h x + \alpha .$ , and let
96
+
97
+ $$
98
+ \psi _ { h } ( x ) = \frac { x - \rho ( \alpha ) } { h \rho ^ { \prime } ( \alpha ) } .
99
+ $$
100
+
101
+ Then
102
+
103
+ $$
104
+ \iota _ { h } = \psi _ { h } \circ \rho \circ \phi _ { h }
105
+ $$
106
+
107
+ is of the form that an enhanced neuron can represent. Then for all $u \in [ a , b ]$ , by the Mean Value Theorem there exists $\xi _ { u }$ between $u$ and $\alpha$ such that
108
+
109
+ $$
110
+ \rho ( u ) = \rho ( \alpha ) + ( u - \alpha ) \rho ^ { \prime } ( \xi _ { u } ) ,
111
+ $$
112
+
113
+ and hence
114
+
115
+ $$
116
+ \begin{array} { l } { \iota _ { h } ( x ) = ( \psi _ { h } \circ \rho \circ \phi _ { h } ) ( x ) } \\ { \qquad = \psi _ { h } \left( \rho ( \alpha ) + h x \rho ^ { \prime } ( \xi _ { h x + \alpha } ) \right) } \\ { \qquad = \frac { x \rho ^ { \prime } ( \xi _ { h x + \alpha } ) } { \rho ^ { \prime } ( \alpha ) } } \end{array}
117
+ $$
118
+
119
+ for $h$ sufficiently small that $\phi _ { h } ( L ) \subseteq [ a , b ]$ .
120
+
121
+ Now let $\rho ^ { \prime }$ have modulus of continuity $\omega$ on $[ a , b ]$ . Let $\iota \colon \mathbb { R } \mathbb { R }$ represent the identity function. Then for all $x \in L$ ,
122
+
123
+ $$
124
+ \begin{array} { l } { | \iota _ { h } ( x ) - \iota ( x ) | = | x | \left| \frac { \rho ^ { \prime } ( \xi _ { h x + \alpha } ) - \rho ^ { \prime } ( \alpha ) } { \rho ^ { \prime } ( \alpha ) } \right| } \\ { \displaystyle \leqslant \frac { | x | } { | \rho ^ { \prime } ( \alpha ) | } \omega ( h x ) , } \end{array}
125
+ $$
126
+
127
+ and so $\iota _ { h } \iota$ uniformly over $L$ .
128
+
129
+ Notation. Throughout the rest of this paper $\iota _ { h }$ will be used to denote such an approximation to the identity function, where $\iota _ { h } \iota$ uniformly as $h 0$ .
130
+
131
+ An enhnaced neuron may be described as performing (for example) the computation $x \mapsto \iota _ { h } ( 4 x { + } 3 )$ . This is possible as the affine transformation $x \mapsto 4 x + 3$ and the affine transformation $\phi _ { h }$ (from the description of $\iota _ { h }$ ) may be combined together into a single affine transformation.
132
+
133
+ # 4.2 NONPOLYNOMIAL ACTIVATION FUNCTIONS
134
+
135
+ We consider the ‘Register Model’, which represents a simplification of a neural network.
136
+
137
+ $\mathcal { T } _ { n , m , n + m \pm 1 } ^ { \rho }$ 4.3 repyer, Model). Let class of neurneurons in e $\rho \colon \mathbb { R } \mathbb { R }$ be any continuous nonpolynomial function. Let with n neurons in the input layer, m neurons in layer, an arbitrary number of hidden layers, and $n + m + 1$
138
+ for which neuron in $n + m$ of the neurons in each hidden layeidden layer has activation function have. Let tity activation funcbe compact. Then $\rho$ $K \subseteq \mathbb { R } ^ { n }$ $\mathcal { I } _ { n , m , n + m + 1 } ^ { \rho }$
139
+ is dense in $C ( K ; \mathbb { R } ^ { m } )$ .
140
+
141
+ ![](images/540adab59ada4efbc4c2aa54a6e857e3295f505448124700139b6997dfa485f5.jpg)
142
+ Figure 1: A simple example of how to prove the Register Model. The values $x _ { 1 } , \ldots , x _ { n }$ are inputs to the network, and the value $\textstyle \sum _ { j = 1 } ^ { M } \sigma _ { j }$ is the output. Each cell represents one neuron. Each $\sigma _ { i }$ is of the form $\psi _ { i } \circ \rho \circ \phi _ { i }$ , where $\psi _ { i }$ and $\phi _ { i }$ are affine functions and $\rho$ is the activation function.
143
+
144
+ See Appendix A for the proof.
145
+
146
+ A simplified depiction of the proof of the Register Model is shown in Figure 1, for the special case of $m = 1$ . It uses $n$ neurons in each layer as registers to preserve the input values. A single neuron in each layer performs a computation based off of the input values, which were preserved in the previous layer. The remaining neuron in each layer also acts a register, gradually summing up the results of the computation neurons. The computation neurons may be shown to exist by the classical Universal Approximation Theorem.
147
+
148
+ The Register Model is similar to Hanin & Sellke (2017), who have a related construction specific to the ReLU. The idea of the Register Model may also be thought of as thematically similar to residual networks, as in Lin & Jegelka (2018): in both cases the network is almost applying the identity transformation at each layer, with only a small amount of nonlinearity.
149
+
150
+ Theorem 4.4. Let $\rho \colon \mathbb { R } \mathbb { R }$ be any continuous nonpolynomial function which is continuously differentiable at at least one point, with nonzero derivative at that point. Let $K \subseteq \mathbb { R } ^ { n }$ be compact. Then $\mathcal { N N } _ { n , m , n + m + 1 } ^ { \rho }$ is dense in $C ( K ; \mathbb { R } ^ { m } )$ .
151
+
152
+ Proof. Let $f \in C ( K ; \mathbb { R } ^ { m } )$ and $\varepsilon > 0$ . Set up a neural network as in the Register Model (Proposition 4.3), approximating $f$ to within $\varepsilon / 2$ . Every neuron requiring an identity activation function in the Register Model will instead approximate the identity, in the manner of Lemma 4.2.
153
+
154
+ Uniform continuity preserves uniform convergence, compactness is preserved by continuous functions, and a composition of two uniformly convergent sequences of functions with uniformly continuous limits is again uniformly convergent. So as a neural network is a layer-by-layer composition of functions then the new model can be taken within $\varepsilon / 2$ of the Register Model, with respect to $\| \cdot \| _ { \infty }$ in $K$ , by taking $h$ sufficiently small.
155
+
156
+ Remark 4.5. This of course implies approximation in $L ^ { p } ( K , \mathbb { R } ^ { m } )$ for $p \in [ 1 , \infty )$ . However, when $\rho$ is the ReLU activation function, then the next corollary shows that in fact the result may be generalised to unbounded domains.
157
+
158
+ Corollary 4.6. Let $\rho$ be the ReLU activation function. Let $p \in [ 1 , \infty )$ . Then $\mathcal { N N } _ { n , m , n + m + 1 } ^ { \rho }$ dense in $L ^ { p } ( \mathbb { R } ^ { n } ; \mathbb { R } ^ { m } )$ .
159
+
160
+ See Appendix B for the proof.
161
+
162
+ Given some $f \in L ^ { p } ( \mathbb { R } ^ { n } ; \mathbb { R } ^ { m } )$ , the essential idea of the proof is to choose a compact set $K \subseteq \mathbb { R } ^ { n }$ on which $f$ places most of its mass, and find a neural approximation to $f$ on $K$ in the manner of Theorem 4.4. Once this is done, a cut-off function is applied outside the set, so that the network takes the value zero in $\mathbb { R } ^ { n } \setminus K$ . The interesting bit is finding a neural representation of such cut-off behaviour.
163
+
164
+ In particular the ‘obvious’ thing to do – multiply by a cut-off function – does not appear to have a suitable neural representation, as merely approximating the multiplication operation is not necessarily enough on an unbounded domain. Instead the strategy is to take a maximum and a minimum with suitable cut-off functions.
165
+
166
+ For the classical Universal Approximation Theorem, it was necessary that the activation function be nonpolynomial. However that turns out to be unnecessary here; deep narrow networks are different to shallow wide networks, and polynomial activations functions are reasonable choices.
167
+
168
+ We begin with the simplest possible nonaffine polynomial, namely $\rho ( x ) = x ^ { 2 }$ .
169
+
170
+ Proposi uare Model). Let $\rho ( x ) = x ^ { 2 }$ . Let $K \subseteq \mathbb { R } ^ { n }$ be compact. Then $\mathcal { N N } _ { n , m , n + m + 1 } ^ { \rho }$ $C ( K ; \mathbb { R } ^ { m } )$
171
+
172
+ See Appendix C for the proof. As might be expected, density is established with the help of the Stone–Weierstrass theorem, reducing the problem to the approximation of arbitrary polynomials.
173
+
174
+ We remark that it is actually straightforward to find a construction showing that N n,m,n+m+2 is dense in $C ( K ; \mathbb { R } ^ { m } )$ when $\rho ( x ) = x ^ { 2 }$ , note the increased width. This is because the square activation function can be used to perform multiplication, via $x y = ( ( x + y ) ^ { 2 } - ( x - y ) ^ { 2 } ) / 4$ , and this makes it easy to construct arbitrary polynomials. In fact this is what is done in the proof of Proposition 4.7 for finding $m - 1$ of the $m$ outputs, when there is still a ‘spare’ neuron in each layer. It is computing the final output that actually requires the bulk of the work. The key to this argument is a width-efficient approximation to division.
175
+
176
+ It is a consequence of Proposition 4.7 that any (polynomial) activation function which can approximate the square activation function, in a suitable manner, is also capable of universal approximation.
177
+
178
+ 4.8. and $\rho \colon \mathbb { R } \mathbb { R }$ polynomial for whibe compact. Then a point is dens $\alpha \in \mathbb { R }$ at. $\rho ^ { \prime } ( \alpha ) = 0$ $\rho ^ { \prime \prime } ( \alpha ) \neq 0$ $K \subseteq \mathbb { R } ^ { n }$ $\mathcal { N N } _ { n , m , n + m + 1 } ^ { \rho }$ $C ( K ; \mathbb { R } ^ { m } )$
179
+
180
+ Proof. Let $h \in \mathbb { R } \setminus \{ 0 \}$ . Define $\rho _ { h } \colon \mathbb { R } \to \mathbb { R }$ by
181
+
182
+ $$
183
+ \rho _ { h } ( x ) = \frac { \rho ( \alpha + h x ) - \rho ( \alpha ) } { h ^ { 2 } \rho ^ { \prime \prime } ( \alpha ) / 2 } .
184
+ $$
185
+
186
+ Then, taking a Taylor explansion around $\alpha$
187
+
188
+ $$
189
+ \begin{array} { l c r } { \rho _ { h } ( x ) = \displaystyle \frac { \rho ( \alpha ) + h x \rho ^ { \prime } ( \alpha ) + h ^ { 2 } x ^ { 2 } \rho ^ { \prime \prime } ( \alpha ) / 2 + \mathcal { O } ( h ^ { 3 } x ^ { 3 } ) - \rho ( \alpha ) } { h ^ { 2 } \rho ^ { \prime \prime } ( \alpha ) / 2 } } \\ { = x ^ { 2 } + \mathcal { O } ( h x ^ { 3 } ) . } \end{array}
190
+ $$
191
+
192
+ Let $s ( x ) = x ^ { 2 }$ . Then $\rho _ { h } \to s$ uniformly over any compact set as $h 0$ .
193
+
194
+ Now set up a network as in the Square Model (Proposition 4.7), with every neuron using the square activation function. Call this network $N$ . Create a network $N _ { h }$ by copying $N$ and giving every neuron in the network the activation function $\rho _ { h }$ instead.
195
+
196
+ Uniform continuity preserves uniform convergence, compactness is preserved by continuous functions, and a composition of two uniformly convergent sequences of functions with uniformly continuous limits is again uniformly convergent. So as a neural network is a layer-by-layer composition of functions, then the difference between $N$ and $N _ { h }$ , with respect to $\| \cdot \| _ { \infty }$ on $K$ , may be taken arbitrarily small by taking $h$ arbitrarily small.
197
+
198
+ Furthermore note that $\rho _ { h }$ is just $\rho$ pre- and post-composed with affine functions. (Note that there is only one term in the definition of $\rho _ { h } ( x )$ which depends on $x$ .) This means that any network which may be represented with activation function $\rho _ { h }$ may be precisely represented with activation function $\rho$ , by combining the affine transformations involved. □
199
+
200
+ Remark 4.9. That $\rho$ is polynomial is never really used in the proof of Theorem 4.8. Only a certain amount of differentiability is required, and all such nonpolynomial functions are already covered by Theorem 4.4, as a nonzero second derivative at $\alpha$ implies a nonzero first derivative somewhere close to $\alpha$ . Nonetheless in principle this provides another possible construction by which certain networks may be shown to exhibit universal approximation.
201
+
202
+ Note that the converse strategy (applying nonpolynomial techniques to the polynomial case) fails. This is because the Register Model requires nonpolynomial activation functions due to its dependence on the classical Universal Approximation Theorem.
203
+
204
+ ![](images/77a1f1c40712be63d7bf1a1e9d1de9dcc7f38e3a02e4a29d54050d0305512ccb.jpg)
205
+ Figure 2: A layer with square activation functions is equivalent to multiple layers with only a single square activation function in each layer. The other neurons use the identity activation function, denoted $\iota$ .
206
+
207
+ Theorem 4.10. Let $\rho \colon \mathbb { R } \mathbb { R }$ be any nonaffine polynomial. Let $K \subseteq \mathbb { R } ^ { n }$ be compact. Then $\mathcal { N N } _ { n , m , n + m + 2 } ^ { \rho }$ is dense in $C ( K ; \mathbb { R } ^ { m } )$ .
208
+
209
+ Proof. Fix $\alpha \in \mathbb { R }$ such that $\rho ^ { \prime \prime } ( \alpha ) \neq 0$ , which exists as $\rho$ is nonaffine. Now let $h \in ( 0 , \infty )$ . Define $\sigma _ { h } \colon { \mathbb { R } } \to { \mathbb { R } }$ by
210
+
211
+ $$
212
+ \sigma _ { h } ( x ) = { \frac { \rho ( \alpha + h x ) - 2 \rho ( \alpha ) + \rho ( \alpha - h x ) } { h ^ { 2 } \rho ^ { \prime \prime } ( \alpha ) } } .
213
+ $$
214
+
215
+ Then Taylor expanding $\rho ( \alpha + h x )$ and $\rho ( \alpha - h x )$ around $\alpha$ ,
216
+
217
+ $$
218
+ \begin{array} { c c l } { \displaystyle \sigma _ { h } ( x ) = \frac { \rho ( \alpha ) + h x \rho ^ { \prime } ( \alpha ) + h ^ { 2 } x ^ { 2 } \rho ^ { \prime \prime } ( \alpha ) / 2 + \mathcal { O } ( h ^ { 3 } x ^ { 3 } ) } { h ^ { 2 } \rho ^ { \prime \prime } ( \alpha ) } - \frac { 2 \rho ( \alpha ) } { h ^ { 2 } \rho ^ { \prime \prime } ( \alpha ) } + } \\ { \displaystyle \frac { \rho ( \alpha ) - h x \rho ^ { \prime } ( \alpha ) + h ^ { 2 } x ^ { 2 } \rho ^ { \prime \prime } ( \alpha ) / 2 + \mathcal { O } ( h ^ { 3 } x ^ { 3 } ) } { h ^ { 2 } \rho ^ { \prime \prime } ( \alpha ) } } \\ { = x ^ { 2 } + \mathcal { O } ( h x ^ { 3 } ) . } \end{array}
219
+ $$
220
+
221
+ Observe that $\sigma _ { h }$ needs precisely two operations of $\rho$ on (affine transformations of) $x$ , and so may be computed by two enhanced neurons with activation function $\rho$ . Thus the operation of a single enhanced neuron with square activation function may be approximated by two enhanced neurons with activation function $\rho$ .
222
+
223
+ Let $N$ be a network as in the Square Model (Proposition 4.7) with every neuron using the square activation function. Let $\ell$ be any hidden layer of $N$ ; it contains $n + m + 1$ neurons. Let $\eta$ be a vector of the values of the neurons of the previous layer. Let $\phi _ { i }$ be the affine part of the ith neuron of $\ell$ , so that $\ell$ computes $\phi _ { 1 } ( \eta ) ^ { 2 } , \dots , \phi _ { n + m + 1 } \overline { { { ( \eta ) } } } ^ { 2 }$ . Then this may equivalently be calculated with $n + m + 1$ layers of $n + m + 1$ neurons each, with $n + m$ of the neurons in each of these new layers using the identity function, and one neuron using the square activation function. The first of these new layers applies the $\phi _ { i }$ , and the $i$ th layer squares the value of the $i$ th neuron. See Figure 2.
224
+
225
+ Apply this procedure to every layer of $N$ ; call the resulting network $\widetilde N$ . It will compute exactly the same function as $N$ , and will have $n + m + 1$ times as many layers, but will use only a single squaring operation in each layer.
226
+
227
+ Create a copy of $\widetilde N$ , call it $\widetilde { N } _ { h }$ . Replace its identity activation functions with approximations in the manner of Lemma 4.2, using activation function $\rho$ . Replace its square activation functions (one in each layer) by approximations in the manner described above with $\sigma _ { h }$ ; this requires an extra neuron in each hidden layer, so that the network is now of width $n + m + 2$ . Thus $\widetilde { N } _ { h }$ uses the activation function $\rho$ throughout.
228
+
229
+ Uniform continuity preserves uniform convergence, compactness is preserved by continuous functions, and a composition of two uniformly convergent sequences of functions with uniformly continuous limits is again uniformly convergent. So as a neural network is a layer-by-layer composition of functions, then the difference between $\widetilde { N } _ { h }$ and $\widetilde { N }$ , with respect to $\| \cdot \| _ { \infty }$ on $K$ , may be taken arbitrarily small by taking $h$ arbitrarily small.
230
+
231
+ Remark 4.11. It is possible to construct shallower networks analogous to $\widetilde N$ . The proof of Proposition 4.7 in Appendix C, uses most of the network’s neurons to approximate the identity anyway; only a few in each layer are used to square a valued that is desired to be squared. These are the only neurons that actually require the procedure used in Figure 2 and the proof of Theorem 4.10.
232
+
233
+ # 4.4 NONDIFFERENTIABLE ACTIVATION FUNCTIONS
234
+
235
+ Although not of direct practical application, results for nondifferentiable activation functions demonstrate how certain pathological cases are still capable of being handled.
236
+
237
+ Lemma 4.12. Let $w \colon \mathbb { R } \mathbb { R }$ be any bounded continuous nowhere differentiable function. Let $\rho ( x ) = \sin ( x ) + w ( x ) \mathrm { e } ^ { - x }$ . Let $L \subseteq \mathbb { R }$ be compact. Then a single enhanced neuron with activation function $\rho$ may uniformly approximate the identity function $\iota \colon \mathbb { R } \mathbb { R }$ on $L$ , with arbitrarily small error.
238
+
239
+ Proof. For $h \in \mathbb { R } \setminus \{ 0 \}$ and $A \in 2 \pi \mathbb { N }$ , let $\phi _ { h , A } ( x ) = h x + A$ , and let $\psi ( x ) = x / h$ . Let
240
+
241
+ $$
242
+ \iota _ { h , A } = \psi _ { h } \circ \rho \circ \phi _ { h , A } ,
243
+ $$
244
+
245
+ which is of the form that an enhanced neuron can represent. Then jointly taking $h$ small enough and $A$ large enough it is clear that $^ { l } h , A$ may be taken uniformly close to $\iota$ on $L$ . □
246
+
247
+ Proposition 4.13. Let $w \colon \mathbb { R } \mathbb { R }$ be any bounded continuous nowhere differentiable function. Let $\rho ( x ) = \sin ( x ) + w ( x ) \mathrm { e } ^ { - x }$ , which will also be nowhere differentiable. Let $K \subseteq \mathbb { R } ^ { n }$ be compact. Then $\mathcal { N N } _ { n , m , n + m + 1 } ^ { \rho }$ is dense in $C ( K ; \mathbb { R } ^ { m } )$ .
248
+
249
+ Proof. As the proof of Theorem 4.4, except substituting Lemma 4.12 for Lemma 4.2.
250
+
251
+ This manner of proof may be extended to other nondifferentiable activation functions as well.
252
+
253
+ # 5 CONCLUSION
254
+
255
+ There is a large literature on theoretical properties of neural networks, but much of it deals only with the ReLU.1 However how to select an activation function remains a poorly understood topic, and many other options have been proposed: leaky ReLU, PReLU, RRelu, ELU, SELU and other more exotic activation functions as well.2
256
+
257
+ Our central contribution is to provide results for universal approximation using general activation functions (Theorems 3.2, 4.4, 4.8 and 4.10). In contrast to previous work, these results do not rely on the nice properties of the ReLU, and in particular do not rely on its explicit description. The techniques we use are straightforward, and robust enough to handle even the pathological case of nondifferentiable activation functions (Proposition 4.13).
258
+
259
+ We also consider approximation in $L ^ { p }$ norm (Remark 4.5), and generalise previous work to smaller widths, multiple output neurons, and $p \geqslant 1$ in place of $p = 1$ (Corollary 4.6).
260
+
261
+ In contrast to much previous work, every result we show also handles the general case of multiple output neurons.
262
+
263
+ # ACKNOWLEDGEMENTS
264
+
265
+ (Redacted from anonymised submission)
266
+
267
+ REFERENCES
268
+ R. Arora, A. Basu, P. Mianjy, and A. Mukherjee. Understanding Deep Neural Networks with Rectified Linear Units. In International Conference on Learning Representations, 2018.
269
+ H.-P. Beise, S. D. Da Cruz, and U. Schroder. On decision regions of narrow deep neural networks. ¨ CoRR, arXiv:1807.01194, 2018.
270
+ Y. Bengio, P. Lamblin, D. Popovici, and H. Larochelle. Greedy layer-wise training of deep networks. In Proceedings of the 19th International Conference on Neural Information Processing Systems, NIPS’06, pp. 153–160, Cambridge, MA, USA, 2006. MIT Press.
271
+ D.-A. Clevert, T. Unterthiner, and S. Hochreiter. Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs). In International Conference on Learning Representations, 2016.
272
+ G. Cybenko. Approximation by superpositions of a sigmoidal function. Math. Control Signals Syst., 2(4):303–314, 1989.
273
+ I. Daubechies, R. DeVore, S. Foucart, B. Hanin, and G. Petrova. Nonlinear Approximation and (Deep) ReLU Networks. arXiv:1905.02199, 2019.
274
+ I. Guhring, G. Kutyniok, and P. Petersen. Error bounds for approximations with deep ReLU neural ¨ networks in $W ^ { s , p }$ norms. Proceedings of the AMS. In press.
275
+ B. Hanin and M. Sellke. Approximating Continuous Functions by ReLU Nets of Minimal Width. arXiv:1710.11278, 2017.
276
+ K. He, X. Zhang, S. Ren, and J. Sun. Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification. In Proceedings of the 2015 IEEE International Conference on Computer Vision (ICCV), ICCV ’15, pp. 1026–1034, Washington, DC, USA, 2015. IEEE Computer Society.
277
+ K. Hornik. Approximation capabilities of multilayer feedforward networks. Neural Netw., 4(2): 251–257, 1991.
278
+ J. Johnson. Deep, Skinny Neural Networks are not Universal Approximators. In International Conference on Learning Representations, 2019.
279
+ G. Klambauer, T. Unterthiner, A. Mayr, and S. Hochreiter. Self-normalizing neural networks. In Advances in Neural Information Processing Systems 30, pp. 971–980. Curran Associates, Inc., 2017.
280
+ A. Krizhevsky. Convolutional Deep Belief Networks on CIFAR-10. 2012.
281
+ N. Le Roux and Y. Bengio. Deep Belief Networks are Compact Universal Approximators. Neural Comput., 22(8):2192–2207, 2010.
282
+ H. Lin and S. Jegelka. ResNet with one-neuron hidden layers is a Universal Approximator. In Advances in Neural Information Processing Systems 31, pp. 6169–6178. Curran Associates, Inc., 2018.
283
+ Z. Lu, H. Pu, F. Wang, Z. Hu, and L. Wang. The Expressive Power of Neural Networks: A View from the Width. In Advances in Neural Information Processing Systems 30, pp. 6231–6239. Curran Associates, Inc., 2017.
284
+ A. Maas, A. Hannun, and A. Ng. Rectifier Nonlinearities Improve Neural Network Acoustic Models. In International Conference on Learning Representations, 2013.
285
+ A. Molina, P. Schramowski, and K. Kersting. Pade Activation Units: End-to-end Learning of Flexi- ´ ble Activation Functions in Deep Networks. arXiv:1907.06732, 2019.
286
+ G. F. Montufar. Universal Approximation Depth and Errors of Narrow Belief Networks with Dis-´ crete Units. Neural Comput., 26(7):1386–1407, 2014. ISSN 0899-7667.
287
+ Q. Nguyen, M. C. Mukkamala, and M. Hein. Neural Networks Should Be Wide Enough to Learn Disconnected Decision Regions. In Proceedings of the 35th International Conference on Machine Learning. PMLR 80, Stockholm, Sweden, 2018.
288
+ P. Petersen and F. Voigtlaender. Optimal approximation of piecewise smooth functions using deep ReLU neural networks. Neural Netw., 108:296–330, 2018.
289
+ A. Pinkus. Approximation theory of the MLP model in neural networks. Acta Numer., 8:143–195, 1999.
290
+ R. Rojas. Networks of width one are universal classifiers. In Proceedings of the International Joint Conference on Neural Networks, volume 4, pp. 3124–3127, 2003.
291
+ I. Sutskever and G. E. Hinton. Deep, Narrow Sigmoid Belief Networks Are Universal Approximators. Neural Comput., 20(11):2629–2636, 2008. ISSN 0899-7667. doi: 10.1162/neco.2008. 12-07-661.
292
+ L. Szymanski and B. McCane. Deep, super-narrow neural network is a universal classifier. In The 2012 International Joint Conference on Neural Networks (IJCNN), pp. 1–8, 2012.
293
+ B. Xu, N. Wang, T. Chen, and M. Li. Empirical Evaluation of Rectified Activations in Convolutional Network. arXiv:1505.00853, 2015.
294
+
295
+ # A PROOF OF THE REGISTER MODEL (PROPOSITION 4.3)
296
+
297
+ First, we recall the classical Universal Approximation Theorem (Pinkus, 1999):
298
+
299
+ Theorem 1.1. Let $\rho \colon \mathbb { R } \mathbb { R }$ be any continuous function. Let $\mathcal { N } _ { n } ^ { \rho }$ represent the class of neural networks with activation function $\rho ,$ , with n neurons in the input layer, one neuron in the output layer, and one hidden layer with an arbitrary number of neurons. Let $K \subseteq \mathbb { R } ^ { n }$ be compact. Then $\mathcal { N } _ { n } ^ { \rho }$ is dense in $C ( K )$ if and only if ρ is nonpolynomial.
300
+
301
+ The Register Model is created by suitably reorganising the neurons from a collection of such shallow networks.
302
+
303
+ Proposition 4.3 (Register Model). Let $\mathcal { T } _ { n , m , n + m \pm 1 } ^ { \rho }$ repyer, class of neural networks with n neurons in the input layer, m neurons inneurons in each hidden layer, an arbitrary number of hidden layers, and $\rho \colon \mathbb { R } \mathbb { R }$ be any continuous nonpolynomial function. Let $n + m + 1$
304
+ for which neuron in $n + m$ of the neurons in each hidden layeidden layer has activation function have. Let tity activation funcbe compact. Then $\rho$ $K \subseteq \mathbb { R } ^ { n }$ $\mathcal { I } _ { n , m , n + m + 1 } ^ { \rho }$
305
+ is dense in $C ( K ; \mathbb { R } ^ { m } )$ .
306
+
307
+ Proof. Fix $f \in C ( K ; \mathbb { R } ^ { m } )$ . Let $f = ( f _ { 1 } , \ldots , f _ { m } )$ . Fix $\varepsilon > 0$ . By Theorem 1.1, there exist singlehidden-layer neural networks $g _ { 1 } , \ldots , g _ { m } \in \mathcal { N } _ { n } ^ { \rho }$ with activation function $\rho$ approximating $f _ { 1 } , \ldots , f _ { m }$ respectively. Each approximation is to within error $\varepsilon$ with respect to $\| \cdot \| _ { \infty }$ on $K$ . Let each $g _ { i }$ have $\beta _ { i }$ hidden neurons. Let $\sigma _ { i , j }$ represent the operation of its $j$ th hidden neuron, for $j \in \{ 1 , \dots , \beta _ { i } \}$ . In keeping with the idea of enhanced neurons, let each $\sigma _ { i , j }$ include the affine function that comes after it in the output layer of $g _ { i }$ , so that $\begin{array} { r } { g _ { i } = \sum _ { j = 1 } ^ { \beta _ { i } } \sigma _ { i , j } } \end{array}$ . Let $\begin{array} { r } { M = \sum _ { i = 1 } ^ { m } \beta _ { i } } \end{array}$ .
308
+
309
+ We seek to construct a neural network $N \in \mathbb { Z } _ { n , m , n + m + 1 } ^ { \rho }$ . Given input $( x _ { 1 } , \ldots , x _ { n } ) \in \mathbb { R } ^ { n }$ , it will output $( G _ { 1 } , \dots , G _ { m } ) \in \mathbb { R } ^ { m }$ , such that $G _ { i } = g _ { i } ( x _ { 1 } , \ldots , x _ { n } )$ for each $i$ . That is, it will compute all of the shallow networks $g _ { 1 } , \ldots , g _ { m }$ . Thus it will approximate $f$ to within error $\varepsilon$ with respect to $\| \cdot \| _ { \infty }$ on $K$ .
310
+
311
+ The construction of $N$ is mostly easily expressed pictorially; see Figure 3. In each cell, representing a neuron, we define its value as a function of the values of the neurons in the previous layer. In every layer, all but one of the neurons uses the identity activation function $\iota \colon \mathbb { R } \mathbb { R }$ , whilst one neuron in each layer performs a computation of the form $\sigma _ { i , j }$ .
312
+
313
+ The construction can be summed up as follows.
314
+
315
+ Each layer has $n + m + 1$ neurons, arranged into a group of $n$ neurons, a group of a single neuron, and a group of $m$ neurons.
316
+
317
+ The first $n$ neurons in each layer simply record the input $( x _ { 1 } , \ldots , x _ { n } )$ , by applying an identity activation function. We refer to these as the ‘in-register neurons’.
318
+
319
+ Next we consider $g _ { 1 } , \ldots , g _ { m }$ , which are all shallow networks. The neurons in the hidden layers of $g _ { 1 } , \ldots , g _ { m }$ are arranged ‘vertically’ in our deep network, one in each layer. This is the neuron in each layer that uses the activation function $\rho$ . We refer to these as the ‘computation neurons’. Each computation neuron performs its computation based off of the inputs preserved in the in-register neurons.
320
+
321
+ The final group of $m$ neurons also use the identity activation function; their affine parts gradually sum up the results of the computation neurons. We refer to these as the ‘out-register neurons’. The $i$ th out-register neuron in each layer will sum up the results of the computation neurons computing $\sigma _ { i , j }$ for all $j \in \{ 1 , \dots , \beta _ { i } \}$ .
322
+
323
+ Finally, the neurons in the output layer of the network are connected to the out-register neurons of the final hidden layer. As each of the neurons in the output layer has, as usual, the identity activation function, they will now have computed the desired results. □
324
+
325
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>(1-W1+I-WuS)=Wu5</td><td rowspan=1 colspan=1>(-1+-5)+=I-wu5</td><td rowspan=2 colspan=1></td><td rowspan=2 colspan=2>0=+Tgu5:…</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0=z+Igu5</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0=Ig‘u5</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0=bu5</td><td rowspan=1 colspan=1>0=8u5</td><td rowspan=1 colspan=1>0=5</td><td rowspan=1 colspan=1>0=Iu5</td></tr><tr><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=2>:</td><td rowspan=1 colspan=1>:…</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>::</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1>…</td><td rowspan=1 colspan=1>:…</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>::</td><td rowspan=1 colspan=1>:…</td><td rowspan=1 colspan=1>::</td><td rowspan=1 colspan=1>::</td></tr><tr><td rowspan=1 colspan=1>=</td><td rowspan=1 colspan=1>=W5(1-W25)1</td><td rowspan=1 colspan=1>=1-W5(-5)</td><td rowspan=7 colspan=1>·</td><td rowspan=7 colspan=1>…</td><td rowspan=1 colspan=1>1-++1-=g+g5</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>(2+11++21=8+1g&#x27;5</td><td rowspan=1 colspan=1>(+1g)1= +g&#x27;5</td><td rowspan=1 colspan=1>0=I+1g‘)</td><td rowspan=1 colspan=1>0=1g5</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>0=v5</td><td rowspan=1 colspan=1>0=85</td><td rowspan=1 colspan=1>0=5</td><td rowspan=1 colspan=1>0=15</td></tr><tr><td rowspan=1 colspan=1>W&#x27;S=5</td><td rowspan=1 colspan=1>=w15(1-W&#x27;15)1</td><td rowspan=1 colspan=1>=I-Wt5(-W15)</td><td rowspan=1 colspan=1>(-g+1g15)=g+1g5</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>=8+1g5(+1g15)7</td><td rowspan=1 colspan=1>=+tg&#x27;5(t+1g15)1</td><td rowspan=1 colspan=1>(11+15)=I+Ig5</td><td rowspan=1 colspan=1>(-11+1-1g15)=1g15</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1+5151= v15</td><td rowspan=1 colspan=1>(+1+=85</td><td rowspan=1 colspan=1>()=T5</td><td rowspan=1 colspan=1>0=115</td></tr><tr><td></td><td rowspan=1 colspan=1>(I-W‘uLc...I-W&#x27;I)ug‘uo=W⊥</td><td rowspan=1 colspan=1>(z-wu/....-w))-ugu)=I-W</td><td rowspan=1 colspan=1>(-y+1.-+))=g+g</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>(z+g/-.)+)80=s</td><td rowspan=1 colspan=1>(1g&#x27;us.*1+)0= z+⊥</td><td rowspan=1 colspan=1>(g‘u....gu)o= I+g⊥</td><td rowspan=1 colspan=1>(1-1gu..1-1g)1=1</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>(εu...ε/))10=v)</td><td rowspan=1 colspan=1>2/.../)1=))</td><td rowspan=1 colspan=1>(/..)1=)</td><td rowspan=1 colspan=1>(ux..·x)1&#x27;1o=I</td></tr><tr><td></td><td rowspan=1 colspan=1>0=Wu</td><td rowspan=1 colspan=1>=I-Wu(-Wu)</td><td rowspan=1 colspan=1>(-g+1g)=g+Igu</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>=8+Igu(z+Ig&#x27;uL)</td><td rowspan=1 colspan=1>=+Igu(1+Ig‘u)</td><td rowspan=1 colspan=1>=I+Igu(gu)</td><td rowspan=1 colspan=1>(1-g‘u)=Igu</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>=u(ε²u)</td><td rowspan=1 colspan=1>=8u(u)</td><td rowspan=1 colspan=1>=u(t&#x27;u)</td><td rowspan=1 colspan=1>=u(ux)</td></tr><tr><td></td><td rowspan=1 colspan=1>::</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=2>::</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=2>:</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=1>:</td><td rowspan=1 colspan=2>: :</td></tr><tr><td></td><td rowspan=1 colspan=1>0=W</td><td rowspan=1 colspan=1>=-(-)</td><td rowspan=1 colspan=1>(1-+)=g+g</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>=8+g(+g)</td><td rowspan=1 colspan=1>=+g(+g)</td><td rowspan=1 colspan=1>=+g(g)</td><td rowspan=1 colspan=1>(-g)=g</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>=(8)</td><td rowspan=1 colspan=1>=8()</td><td rowspan=1 colspan=1>=(1)</td><td rowspan=1 colspan=1>=(x)7</td></tr><tr><td></td><td rowspan=1 colspan=1>0=W</td><td rowspan=1 colspan=1>=-W(-)1</td><td rowspan=1 colspan=1>(1-+=g+g</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>=8+g(+g)</td><td rowspan=1 colspan=1>=+g(1+Ig)</td><td rowspan=1 colspan=1>=I+Ig()</td><td rowspan=1 colspan=1>(1-1g)=g</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>=(1)</td><td rowspan=1 colspan=1>=8()</td><td rowspan=1 colspan=1>=(1)</td><td rowspan=1 colspan=1>=It(1x)7</td></tr></table>
326
+
327
+ # B PROOF OF COROLLARY 4.6
328
+
329
+ Lemma B.1. Let $a , b , c , d \in \mathbb { R }$ be such that $a < b < c < d .$ . Let $U _ { a , b , c , d } \colon \mathbb { R } \to \mathbb { R }$ be the unique continuous piecewise affine function which is one on $[ b , c ]$ and zero on $( - \infty , a ] \cup [ d , \infty )$ . Then two layers of two enhanced neurons each, with ReLU activation function, may exactly represent the function $U _ { a , b , c , d }$ .
330
+
331
+ Proof. Let $x \in \mathbb { R }$ be the input. Let $m _ { 1 } = 1 / ( b - a )$ . Let $m _ { 2 } = 1 / ( d - c )$ . Let $\eta _ { 1 } , \eta _ { 2 }$ represent the first neuron in each layer, and $\zeta _ { 1 } , \zeta _ { 2 }$ represent the second neuron in each layer. We assign them values as follows.
332
+
333
+ $$
334
+ \begin{array} { l l } { \eta _ { 1 } = \operatorname* { m a x } \{ 0 , m _ { 1 } ( x - a ) \} , } & { \qquad \zeta _ { 1 } = \operatorname* { m a x } \{ 0 , m _ { 2 } ( x - c ) \} , } \\ { \eta _ { 2 } = \operatorname* { m a x } \{ 0 , 1 - \eta _ { 1 } \} , } & { \qquad \zeta _ { 2 } = \operatorname* { m a x } \{ 0 , 1 - \zeta _ { 1 } \} . } \end{array}
335
+ $$
336
+
337
+ Then $U _ { a , b , c , d } ( x ) = \zeta _ { 2 } - \eta _ { 2 }$ . (This final affine transformation is allowed, in keeping with the notion of enhanced neurons.)
338
+
339
+ Lemma B.2. One layer of two enhanced neurons, with ReLU activation function, may exactly represent the function $( x , y ) \mapsto \operatorname* { m i n } \{ x , y \}$ on $[ 0 , \infty ) ^ { 2 }$ .
340
+
341
+ Proof. Let the first neuron compute $\eta = \operatorname* { m a x } \{ 0 , x - y \}$ . Let the second neuron compute $\zeta =$ $\operatorname* { m a x } \{ 0 , x \}$ . Then $\operatorname* { m i n } \{ x , y \} = \bar { \zeta } - \eta$ . $\boxed { \begin{array} { r l } \end{array} }$
342
+
343
+ Corollary 4.6. Let $\rho$ be the ReLU activation function. Let $p \in [ 1 , \infty )$ . Then $\mathcal { N N } _ { n , m , n + m + 1 } ^ { \rho }$ dense in $L ^ { p } ( \mathbb { R } ^ { n } ; \mathbb { R } ^ { m } )$ .
344
+
345
+ Proof. Let $f \in L ^ { p } ( \mathbb { R } ^ { n } ; \mathbb { R } ^ { m } )$ and $\varepsilon > 0$ . For simplicity assume that $\mathbb { R } ^ { m }$ is endowed with the $\| \cdot \| _ { \infty }$ norm; other norms are of course equivalent. Let $\widehat { f } = ( \widehat { f } _ { 1 } , \ldots , \widehat { f } _ { m } ) \in C _ { c } ( \mathbb { R } ^ { n } ; \mathbb { R } ^ { m } )$ be such that
346
+
347
+ $$
348
+ \left\| f - { \widehat { f } } \right\| _ { p } < \varepsilon / 3 .
349
+ $$
350
+
351
+ Let
352
+
353
+ $$
354
+ C = \operatorname* { s u p } _ { x \in \mathbb { R } ^ { n } } \operatorname* { m a x } _ { i } { \widehat { f } } _ { i } ( x ) + 1
355
+ $$
356
+
357
+ and
358
+
359
+ $$
360
+ c = \operatorname* { i n f } _ { x \in \mathbb { R } ^ { n } } \operatorname* { m i n } _ { i } { \widehat { f } } _ { i } ( x ) - 1
361
+ $$
362
+
363
+ Pick $a _ { 1 } , b _ { 1 } , \ldots , a _ { n } , b _ { n } \in \mathbb { R }$ such that $J$ defined by
364
+
365
+ $$
366
+ J = [ a _ { 1 } , b _ { 1 } ] \times \cdot \cdot \cdot \times [ a _ { n } , b _ { n } ]
367
+ $$
368
+
369
+ is such that $\operatorname { s u p p } { \widehat { f } } \subseteq J$ . Furthermore, for $\delta > 0$ that we shall fix in a moment, let
370
+
371
+ $$
372
+ \begin{array} { r } { A _ { i } = a _ { i } - \delta , } \\ { B _ { i } = b _ { i } + \delta , } \end{array}
373
+ $$
374
+
375
+ and let $K$ be defined by
376
+
377
+ $$
378
+ { \cal K } = [ A _ { 1 } , B _ { 1 } ] \times \cdots \times [ A _ { n } , B _ { n } ] .
379
+ $$
380
+
381
+ Fix $\delta$ small enough that
382
+
383
+ $$
384
+ | K \setminus J | ^ { 1 / p } \cdot \operatorname* { m a x } { \{ | C | , | c | \} } < \frac { \varepsilon } { 6 } .
385
+ $$
386
+
387
+ $g = ( g _ { 1 } , \ldots , g _ { m } ) \in \mathcal { N } _ { n , m , n + m + 1 } ^ { \rho }$ be such that
388
+
389
+ $$
390
+ \operatorname* { s u p } _ { x \in K } \left| { \widehat { f } } ( x ) - g ( x ) \right| < \operatorname* { m i n } \left\{ { \frac { \varepsilon } { 3 { \big | } J { \big | } ^ { 1 / p } } } , 1 \right\} ,
391
+ $$
392
+
393
+ which exists by Theorem 4.4. Note that $g$ is defined on all of $\mathbb { R } ^ { n }$ ; it simply happens to be close to $\widehat { f }$ on $K$ . In particular it will takes values close to zero on $K \backslash J$ , and may take arbitrary values in $\mathbb { R } ^ { n } \setminus K$ . By equations (B.2), (B.3), (B.5), it is the case that
394
+
395
+ $$
396
+ \begin{array} { r } { C \geqslant \underset { x \in K } { \operatorname* { s u p } } \underset { i } { \operatorname* { m a x } } g _ { i } ( x ) , } \\ { c \leqslant \underset { x \in K } { \operatorname* { i n f } } \underset { i } { \operatorname* { m i n } } g _ { i } ( x ) . } \end{array}
397
+ $$
398
+
399
+ Now consider the network describing $g$ ; it will be modified slightly. The goal is to create a network which takes value $g$ on $J$ , zero in $\mathbb { R } ^ { n } \setminus K$ , and moves between these values in the interface region $K \backslash J$ . Such a network will provide a suitable approximation to $\widehat { f } .$ . This is done by first constructing a function which is approximately the indicator function for $J$ , with support in $K$ ; call such a function $U$ . The idea then is to construct a neural representation of $G _ { i }$ defined by
400
+
401
+ $$
402
+ G _ { i } = \operatorname* { m i n } \{ \operatorname* { m a x } \{ g _ { i } , c U \} , C U \} .
403
+ $$
404
+
405
+ Provided $| K \setminus J |$ is small enough then $G = ( G _ { 1 } , \dots , G _ { m } )$ will be the desired approximation; this is proved this below.
406
+
407
+ We move on to presenting the neural representation of this construction.
408
+
409
+ First we observe that because the activation function is the ReLU, then the identity approximations used in the proof of Theorem 4.4 may in fact exactly represent the identity function on some compact set: $x \mapsto \operatorname* { m a x } \{ 0 , x + N \} - N$ is exactly the identity function, for suitably large $N$ , and is of the form that an enhanced neuron may represent. This observation isn’t strictly necessary for the proof, but it does simplify the presentation somewhat, as the values preserved in the in-register neurons of $g$ are now exactly the inputs $x = ( x _ { 1 } , \ldots , x _ { n } ) $ for $x \in K$ . For sufficiently negative $x _ { i }$ , outside of $K$ , they will take the value $- N$ instead, but by insisting that is $N$ sufficiently large that
410
+
411
+ $$
412
+ - N < A _ { i }
413
+ $$
414
+
415
+ for all $i$ , then this will not be an issue for the proof.
416
+
417
+ So take the network representing $g$ , and remove the output layer. (If the output layer is performing any affine transformations then treat them as being part of the final hidden layer, in the manner of enhanced neurons. Thus the output layer that is being removed is just applying the identity function to the out-register neurons.) Some more hidden layers will be placed on top, and then a new output layer will be placed on top. In the following description, all neurons not otherwise specified will be performing the identity function, so as to preserve the values of the corresponding neurons in the preceding layer. As all functions involved are continuous and $K$ is compact, and compactness is preserved by continuous functions, and continuous functions are bounded on compact sets, then this is possible for all $x \in K$ by taking $N$ large enough.
418
+
419
+ The first task is to modify the value stored in the in-register neurons corresponding to $x _ { 1 }$ . At present it stores the value $x _ { 1 }$ ; by using this in-register neuron and the computation neuron in two extra layers, its value may be replaced with $U _ { A _ { 1 } , a _ { 1 } , b _ { 1 } , B _ { 1 } } ( x _ { 1 } )$ , via Lemma B.1. Place another two layers on top, and use them to replace the value of $x _ { 2 }$ in the second in-register neuron with $U _ { A _ { 2 } , a _ { 2 } , b _ { 2 } , B _ { 2 } } ( x _ { 2 } )$ , and so on. The in-register neurons now store the values $( U _ { A _ { 1 } , a _ { 1 } , b _ { 1 } , B _ { 1 } } ( x _ { 1 } ) , \dots , U _ { A _ { n } , a _ { n } , b _ { n } , B _ { n } } ( x _ { n } ) )$ .
420
+
421
+ Once this is complete, place another layer on top and use the first two in-register neurons to compute the minimum of their values, in the manner of Lemma B.2, thus computing $\operatorname* { m i n } \{ U _ { A _ { 1 } , a _ { 1 } , b _ { 1 } , B _ { 1 } } ^ { - } ( x _ { 1 } ) , U _ { A _ { 2 } , a _ { 2 } , b _ { 2 } , B _ { 2 } } ( x _ { 2 } ) \}$ . Place another layer on top and use another two inregister neurons to compute the minimum of this value and the value presently stored in the third in-register neuron, that is $U _ { A _ { 3 } , a _ { 3 } , b _ { 3 } , B _ { 3 } } ( x _ { 3 } )$ , so that
422
+
423
+ $$
424
+ \operatorname* { m i n } \{ U _ { A _ { 1 } , a _ { 1 } , b _ { 1 } , B _ { 1 } } ( x _ { 1 } ) , U _ { A _ { 2 } , a _ { 2 } , b _ { 2 } , B _ { 2 } } ( x _ { 2 } ) , U _ { A _ { 3 } , a _ { 3 } , b _ { 3 } , B _ { 3 } } ( x _ { 3 } ) \} _ { [ \mathrm { f } ] }
425
+ $$
426
+
427
+ has now been computed. Continue to repeat this process until the in-register neurons have computed.3
428
+
429
+ $$
430
+ U = \operatorname* { m i n } _ { i \in \{ 1 , . . . , n \} } U _ { A _ { i } , a _ { i } , b _ { i } , B _ { i } } ( x _ { i } ) .
431
+ $$
432
+
433
+ Observe how $U$ represents an approximation to the indicator function for $J$ , with support in $K$ , evaluated at $( x _ { 1 } , \ldots , x _ { n } )$ .
434
+
435
+ This is a highly destructive set of operations: the network no longer remembers the values of its inputs. Thankfully, it no longer needs them. Note how the small foible regarding how an in-register neuron would only record $- N$ instead of $x _ { i }$ , for $x _ { i } < - N$ , is not an issue. This is because of equation (B.7), which implies that $U _ { A _ { i } , a _ { i } , b _ { i } , B _ { i } } ( x _ { i } ) = 0 = U _ { A _ { i } , a _ { i } , b _ { i } , B _ { i } } ( - N )$ , thus leaving the value of $U$ unaffected.
436
+
437
+ The out-register neurons presently store the values $g _ { 1 } , \ldots , g _ { m }$ , where $g _ { i } = g _ { i } ( x _ { 1 } , \ldots , x _ { n } )$ . Now add another layer. Let the value of its out-register neurons be $\theta _ { 1 } , \ldots , \theta _ { m }$ , where
438
+
439
+ $$
440
+ \theta _ { i } = \operatorname* { m a x } \{ 0 , g _ { i } - c U \} .
441
+ $$
442
+
443
+ Add one more hidden layer. Let the value of its out-register neurons be $\lambda _ { 1 } , \ldots , \lambda _ { m }$ , where
444
+
445
+ $$
446
+ \lambda _ { i } = \operatorname* { m a x } \{ 0 , - \theta _ { i } + ( C - c ) U \} .
447
+ $$
448
+
449
+ Finally place the output layer on top. Let the value of its neurons be $G _ { 1 } , \ldots , G _ { m }$ , where
450
+
451
+ $$
452
+ G _ { i } = - \lambda _ { i } + C U .
453
+ $$
454
+
455
+ Then in fact
456
+
457
+ $$
458
+ G _ { i } = \operatorname* { m i n } \{ \operatorname* { m a x } \{ g _ { i } , c U \} , C U \}
459
+ $$
460
+
461
+ as desired.
462
+
463
+ All that remains to show is that $G = ( G _ { 1 } , \dots , G _ { m } )$ of this form is indeed a suitable approximation. First, as $G$ and $g$ coincide in $J$ , and by equation (B.5),
464
+
465
+ $$
466
+ \begin{array} { l } { \displaystyle \left( \displaystyle \int _ { J } \left| \widehat { f } ( x ) - G ( x ) \right| ^ { p } \mathrm { d } x \right) ^ { 1 / p } \leqslant \left| J \right| ^ { 1 / p } \operatorname* { s u p } _ { x \in J } \left| \widehat { f } ( x ) - G ( x ) \right| } \\ { \displaystyle \qquad = | J | ^ { 1 / p } \operatorname* { s u p } _ { x \in J } \left| \widehat { f } ( x ) - g ( x ) \right| } \\ { \displaystyle \qquad < \frac { \varepsilon } { 3 } . } \end{array}
467
+ $$
468
+
469
+ Secondly, by equations (B.2), (B.3), (B.6), (B.8) and then equation (B.4),
470
+
471
+ $$
472
+ \begin{array} { r l } { { ( \int _ { K \setminus J } \Big | \widehat { f } ( x ) - G ( x ) \Big | ^ { p } \mathrm { d } x ) ^ { 1 / p } \leqslant \vert K \setminus J \vert ^ { 1 / p } \operatorname* { s u p } _ { x \in K \setminus J } \Big \vert \widehat { f } ( x ) - G ( x ) \Big \vert } } \\ & { \leqslant \vert K \setminus J \vert ^ { 1 / p } \cdot 2 \operatorname* { m a x } \big \{ \vert C \vert , \vert c \vert \big \} } \\ & { < \frac { \varepsilon } { 3 } . } \end{array}
473
+ $$
474
+
475
+ Thirdly,
476
+
477
+ $$
478
+ \left( \int _ { \mathbb { R } ^ { n } \setminus K } \Big | \widehat { f } ( x ) - G ( x ) \Big | ^ { p } \mathrm { d } x \right) ^ { 1 / p } = 0 ,
479
+ $$
480
+
481
+ as both $\widehat { f }$ and $G$ have support in $K$ .
482
+
483
+ So by equations (B.1), (B.9), (B.10) and (B.11),
484
+
485
+ $$
486
+ \begin{array} { l } { \displaystyle \| f - G \| _ { p } \leqslant \left\| f - \widehat { f } \right\| _ { p } + \left( \int _ { \mathbb R ^ { n } } \left| \widehat { f } ( x ) - G ( x ) \right| ^ { p } \mathrm { d } x \right) ^ { 1 / p } } \\ { \displaystyle < \frac \varepsilon 3 + \frac \varepsilon 3 + \frac \varepsilon 3 } \\ { = \varepsilon . } \end{array}
487
+ $$
488
+
489
+ # C PROOF OF THE SQUARE MODEL (PROPOSITION 4.7)
490
+
491
+ Lemma C.1. One layer of two enhanced neurons, with square activation function, may exactly represent the multiplication function $( x , y ) \mapsto x y$ on $\mathbb { R } ^ { 2 }$ .
492
+
493
+ Proof. Let the first neuron compute $\eta = ( x + y ) ^ { 2 } / 4$ . Let the second neuron compute $\zeta = ( x - y ) ^ { 2 } / 4$ Then $x y = \eta - \zeta$ . □
494
+
495
+ Lemma C.2. Fix $L \subseteq \mathbb { R } ^ { 2 }$ compact. Three layers of two enhanced neurons each, with square activation function, may uniformly approximate $( x , y ) ( x ^ { 2 } , y ( x + 1 ) )$ arbitrarily well on $L$ .
496
+
497
+ Proof. Let $h , s \in \mathbb { R } \setminus \{ 0 \}$ . Let $\eta _ { 1 } , \eta _ { 2 } , \eta _ { 3 }$ represent the first neuron in each layer; let $\zeta _ { 1 } , \zeta _ { 2 } , \zeta _ { 3 }$ represent the second neuron in each layer. Let $\iota _ { h }$ represent an approximation to the identity in the manner of Lemma 4.2. Using $\cdot \approx $ as an informal notation to represent ‘equal to up to the use of $\iota _ { h }$ in place $\iota ^ { \prime }$ , just to help keep track of why we are performing these operations, assign values to $\eta _ { 1 } , \eta _ { 2 } , \eta _ { 3 }$ and $\zeta _ { 1 } , \zeta _ { 2 } , \zeta _ { 3 }$ as follows:
498
+
499
+ $$
500
+ \begin{array} { c c c } { { \eta _ { 1 } = \iota _ { h } ( x ) } } & { { } } & { { \zeta _ { 1 } = ( x + s y + 1 ) ^ { 2 } } } \\ { { } } & { { \approx x , } } & { { = x ^ { 2 } + 2 s x y + s ^ { 2 } y ^ { 2 } + 2 x + 2 s y + 1 , } } \\ { { } } & { { \eta _ { 2 } = ( \eta _ { 1 } ) ^ { 2 } } } & { { \zeta _ { 2 } = \iota _ { h } ( \zeta _ { 1 } - 2 \eta _ { 1 } - 1 ) } } \\ { { } } & { { \approx x ^ { 2 } , } } & { { \approx x ^ { 2 } + 2 s x y + s ^ { 2 } y ^ { 2 } + 2 s y , } } \\ { { } } & { { \eta _ { 3 } = \iota _ { h } ( \eta _ { 2 } ) } } & { { \zeta _ { 3 } = \iota _ { h } ( ( \zeta _ { 2 } - \eta _ { 2 } ) / 2 s ) } } \\ { { } } & { { } } & { { \approx x y + y + s y ^ { 2 } / 2 . } } \end{array}
501
+ $$
502
+
503
+ And so $\eta _ { 3 }$ may be taken arbitrarily close to $x ^ { 2 }$ and $\zeta _ { 3 }$ may be taken arbitrarily close to $y ( x + 1 )$ , with respect to $\| \cdot \| _ { \infty }$ on $L$ , by first taking $s$ arbitrarily small, and then taking $h$ arbitrarily small. □
504
+
505
+ Proposition C.3. Fix $L \subseteq ( 0 , 2 )$ compact. Then multiple layers of two enhanced neurons each, with square activation function, may uniformly approximate $x \mapsto 1 / x$ arbitrarily well on $L$ .
506
+
507
+ (Unlike Lemma C.2, the number of layers necessary will depend on the quality of approximation.)
508
+
509
+ Proof. First note that
510
+
511
+ $$
512
+ \prod _ { i = 0 } ^ { n } ( 1 + x ^ { 2 ^ { i } } ) \to { \frac { 1 } { 1 - x } }
513
+ $$
514
+
515
+ as $n \to \infty$ , uniformly over compact subsets of $( - 1 , 1 )$ . Thus,
516
+
517
+ $$
518
+ ( 2 - x ) \prod _ { i = 1 } ^ { n } ( 1 + ( 1 - x ) ^ { 2 ^ { i } } ) = \prod _ { i = 0 } ^ { n } ( 1 + ( 1 - x ) ^ { 2 ^ { i } } ) { \frac { 1 } { x } }
519
+ $$
520
+
521
+ uniformly over $L$
522
+
523
+ This has the following neural approximation: let $\eta _ { 1 } = ( 1 - x ) ^ { 2 }$ and $\zeta _ { 1 } = \iota _ { h } ( 2 - x )$ be the neurons in the first layer, where $\iota _ { h }$ is some approximation of the identity as in Lemma 4.2. Let $\kappa _ { h }$ represent an approximation to $( x , y ) \mapsto ( x ^ { 2 } , { \bar { y ( x + 1 ) } } )$ in the manner of Lemma C.2, with error made arbitrarily small as $h 0$ . Now for $i \in \{ 1 , 4 , 7 , 1 0 , . . . , 3 n - 2 \}$ , recursively define $( \eta _ { i + 3 } , \zeta _ { i + 3 } ) = \kappa _ { h } ( \eta _ { i } , \zeta _ { i } )$ , where we increase the index by three to represent the fact that three layers are used to perform this operation. So up to approximation, $\eta _ { i + 3 } \approx ( \eta _ { i } ) ^ { 2 }$ , and $\zeta _ { i + 3 } \approx \zeta _ { i } ( \eta _ { i } + 1 )$ .
524
+
525
+ So $\begin{array} { r } { \zeta _ { 3 n + 1 } \to ( 2 - x ) \prod _ { i = 1 } ^ { n } ( 1 + ( 1 - x ) ^ { 2 ^ { i } } ) } \end{array}$ uniformly over $L$ as $h 0$ . Thus the result is obtained by taking first $n$ large enough and then $h$ small enough. □
526
+
527
+ Remark C.4. Our approach to Proposition C.3 is to find a suitable polynomial approximation of the reciprocal function, and then represent that with a network of multiple layers of two neurons each. It is fortunate, then, that this polynomial happens to be of a form that may be represented by such a network, as it is not clear that this should necessarily be the case for all polynomials. Even if Proposition 4.7 were already known, it requires a network of width three to represent arbitrary polynomials $\mathbb { R } \to \mathbb { R }$ , whereas Proposition C.3 uses a network of only width two. It remains unclear whether an arbitrary-depth network of width two, with square activation function, is capable of universal approximation in $C ( K )$ .
528
+
529
+ Proposition 4.7 (Square Model). Let $\rho ( x ) = x ^ { 2 }$ . Let $K \subseteq \mathbb { R } ^ { n }$ be compact. Then $\mathcal { N N } _ { n , m , n + m + 1 } ^ { \rho }$ is dense in $C ( K ; \mathbb { R } ^ { m } )$ .
530
+
531
+ Proof. Fix $f \in C ( K ; \mathbb { R } ^ { m } )$ . Let $f = ( f _ { 1 } , \dots , f _ { m } )$ . Fix $\varepsilon > 0$ . By precomposing with an affine function – which may be absorbed into the first layer of the network – assume without loss of generality that
532
+
533
+ $$
534
+ K \subseteq ( 1 , 2 ) ^ { n } .
535
+ $$
536
+
537
+ By the Stone–Weierstrass theorem there exist polynomials $g _ { 1 } , \ldots , g _ { m }$ in $x _ { 1 } , \ldots . x _ { n }$ approximating $f _ { 1 } , \ldots , f _ { m }$ to within $\varepsilon / 3$ with respect to $\| \cdot \| _ { \infty }$ .
538
+
539
+ We will construct a network that evaluates arbitrarily good approximations to $g _ { 1 } , \ldots , g _ { n }$ . There are a total of $n + m + 1$ neurons in each layer; group them as in the proof of the Register Model (Proposition 4.3), see Appendix A, so that in each layer there is a group of $n$ neurons that we refer to as ‘in-register neurons’, a single neuron that we refer to as the ‘computation neuron’, and a group of $m$ neurons that we refer to as the ‘out-register neurons’.
540
+
541
+ As before, every in-register neuron will simply apply an approximate identity function to the corresponding in-register neuron in the previous layer, so that they preserve the inputs to the network, up to an arbitrarily good approximation of the identity. (For now, at least – later, when constructing the approximation to $g _ { 1 }$ , which will be the final approximation that is handled, then these neurons will be repurposed to perform that computation.) For the sake of sanity of notation, we shall suppress this detail in our notation, and refer to our neurons in later layers as having e.g. $\cdot _ { x _ { 1 } } ,$ as an input to them to them; in practice this means some arbitrarily good approximation to $x _ { 1 }$ . The out-register neurons will eventually store the desired outputs of the network; thus there is an out-register neuron in each layer ‘corresponding’ to each of the $g _ { i }$ .
542
+
543
+ Now suppose $m > 1$ ; if $m = 1$ then this paragraph and the next three paragraphs may simply be skipped. It is easy to build a network approximating $g _ { 2 } , \ldots g _ { m }$ , as there is at least one ‘extra’ neuron per layer thafollows. Let o use: the ou, where each egister neuron corresponding to is a monomial. Using the comp $g _ { 1 }$ . The strategy is asation neuron and the $\begin{array} { r } { g _ { 2 } = \sum _ { j = 1 } ^ { N } \delta _ { j } } \end{array}$ $\delta _ { j }$
544
+ C.1 to compute the value of $\delta _ { 1 }$ . For example, if $\delta _ { 1 } = x _ { 1 } ^ { 2 } x _ { 2 } x _ { 3 }$ , then this chain of multiplications is $x _ { 1 } ( x _ { 1 } ( x _ { 2 } x _ { 3 } ) )$ . The computation neuron and the ‘extra’ out-register neuron in the first layer compute the multiplication $\alpha = x _ { 2 } x _ { 3 }$ , these neurons in the second layer compute the multiplication $\beta = x _ { 1 } \alpha$ , and these neurons in the third layer compute $x _ { 1 } \beta$ . This value is then stored in the out-register neuron corresponding to $g _ { 2 } - \mathsf { b y }$ using the affine part of the operation of this neuron – and kept through the layers via approximate identity functions, as per Lemma 4.2.
545
+
546
+ This process is then repeated for $\delta _ { 2 }$ . The result is then added on – via the affine part of the operation of the out-register neuron corresponding to $g _ { 2 }$ – to the value stored in the out-register neuron corresponding to $g _ { 2 }$ . Repeat for all $j$ until all of the $\delta _ { j }$ have been computed and the out-register neuron stores an approximation to $g _ { 2 }$ . This is only an approximation in that it requires the use of approximate identity functions; other than that it is exact. As such, by taking sufficiently good approximations of the identity function, this will be a uniform approximation to $g _ { 2 }$ over $K$ .
547
+
548
+ Now repeat this whole process for $g _ { 3 } , \ldots g _ { m }$
549
+
550
+ For the rest of the layers of the network, the out-register neurons corresponding to $g _ { 2 } , \ldots , g _ { m }$ will now simply apply approximate identity functions to maintain their values: these will eventually form the outputs of the network. Let these computed values be denoted $\widehat { g } _ { 2 } , \ldots , \widehat { g } _ { m }$ . (With the ‘hat’ notation becuse of the fact that these are not the values $g _ { 2 } , \ldots , g _ { m }$ b b, due to the approximate identity functions in between.)
551
+
552
+ The difficult bit is computing an approximation to $g _ { 1 }$ , as it must be done without the ‘extra’ neuron in each layer. In total, then, in each layer, there are $n + 2$ neurons available: the $n$ in-register neurons (which have so far been storing the inputs $x _ { 1 } , \ldots x _ { n } )$ ), the computation neuron, and the out-register neuron corresponding to $g _ { 1 }$ .
553
+
554
+ Written in terms of monomials, let $\begin{array} { r } { g _ { 1 } = \sum _ { j = 1 } ^ { M } \gamma _ { j } } \end{array}$ . Then $g _ { 1 }$ may be written as
555
+
556
+ $$
557
+ g _ { 1 } = \gamma _ { 1 } \left( 1 + \frac { \gamma _ { 2 } } { \gamma _ { 1 } } \left( 1 + \frac { \gamma _ { 3 } } { \gamma _ { 2 } } \left( \cdots \left( 1 + \frac { \gamma _ { M - 1 } } { \gamma _ { M - 2 } } \left( 1 + \frac { \gamma _ { M } } { \gamma _ { M - 1 } } \right) \right) \cdots \right) \right) \right) .
558
+ $$
559
+
560
+ Note that this description is defined over $K$ , as $K$ is bounded away from the origin.
561
+
562
+ In particular, let $\begin{array} { r } { \gamma _ { j } = \prod _ { k = 1 } ^ { n } x _ { k } ^ { \theta _ { j , k } } } \end{array}$ xθj,kk , for θj,k ∈ N0. Substituting this in,
563
+
564
+ $$
565
+ g _ { 1 } = [ \prod _ { k = 1 } ^ { n } x _ { k } ^ { \theta _ { 1 , k } } ] ( 1 + \prod _ { k = 1 } ^ { n } x _ { k } ^ { \theta _ { 2 , k } } ( 1 + \prod _ { k = 1 } ^ { n } x _ { k } ^ { \theta _ { 3 , k } } ( \cdot \cdot \cdot \\ \prod _ { k = 1 } ^ { n } x _ { k } ^ { \theta _ { 1 , k } } ( 1 + \prod _ { k = 1 } ^ { n } x _ { k } ^ { \theta _ { 2 , k } } ( 1 + \frac { \prod _ { k = 1 } ^ { n } x _ { k } ^ { \theta _ { M , k } } } { \prod _ { k = 1 } ^ { n } x _ { k } ^ { \theta _ { M - 1 , k } } } ) ) \cdot \cdot \cdot ) ) ) .
566
+ $$
567
+
568
+ Now let $\operatorname* { s u p } K$ be defined by
569
+
570
+ $$
571
+ \operatorname* { s u p } K = \operatorname* { s u p } \{ x _ { i } \mid ( x _ { 1 } , \ldots , x _ { n } ) \in K \} ,
572
+ $$
573
+
574
+ so that $1 < \operatorname* { s u p } K < 2$ . Let $r$ be an approximation to $x \mapsto 1 / x$ in the manner of Proposition C.3, with the $L$ of that proposition given by
575
+
576
+ $$
577
+ L = [ ( \operatorname* { s u p } K ) ^ { - 1 } - \alpha , \operatorname* { s u p } K + \alpha ] \subseteq ( 0 , 2 ) ,
578
+ $$
579
+
580
+ where $\alpha > 0$ is taken small enough that the inclusion holds.
581
+
582
+ Let $r ^ { a }$ denote $r$ composed $a$ times. By taking $r$ to be a suitably good approximation, we may ensure that $\widetilde { g } _ { 1 }$ defined by
583
+
584
+ $$
585
+ \begin{array} { r l } { \widetilde { \eta } _ { 1 } - \displaystyle \prod _ { i = 1 } ^ { n } \gamma ^ { 2 M - 2 } ( z _ { i \ell } ) ^ { \theta _ { i , i } } \Bigg | } & { \Bigg ( 1 + \displaystyle \prod _ { i = 1 } ^ { n } \gamma ^ { 2 M - 3 } ( z _ { i \ell } ) ^ { \theta _ { i , i } } ) ^ { \theta _ { i , i } } \Bigg | \left[ \displaystyle \prod _ { i = 1 } ^ { n } \gamma ^ { 2 M - 4 } ( z _ { i \ell } ) ^ { \theta _ { i , i } } \right] } \\ & { \Bigg ( 1 + \displaystyle \prod _ { i = 1 } ^ { n } \gamma ^ { 2 M - 3 } ( z _ { i \ell } ) ^ { \theta _ { i , i } } \Bigg ) \displaystyle \prod _ { i = 1 } ^ { n } \gamma ^ { 3 \ell - 3 } ( z _ { i \ell } ) ^ { \theta _ { i , i } } \Bigg ] } \\ & { \Bigg ( \displaystyle \prod _ { i = 1 } ^ { n } \bigg ( \displaystyle \prod _ { i = 1 } ^ { n } \gamma ^ { 3 } ( z _ { i \ell } ) ^ { \theta _ { i , i } } \bigg ) ^ { \theta _ { i } } \Bigg ) } \\ & { \Bigg ( 1 + \displaystyle \prod _ { i = 1 } ^ { n } \gamma ^ { 3 } ( z _ { i \ell } ) ^ { \theta _ { i , i } } \Bigg ) ^ { \theta _ { i } } \left[ \displaystyle \prod _ { i = 1 } ^ { n } \gamma ^ { 2 } ( z _ { i \ell } ) ^ { \theta _ { i , i } } \cdots \right] \Bigg | } \\ & { \Bigg ( 1 + \displaystyle \prod _ { i = 1 } ^ { n } \gamma ^ { 3 } ( z _ { i \ell } ) ^ { \theta _ { i , i } } \cdots \bigg ) \Bigg [ \displaystyle \prod _ { i = 1 } ^ { n } \alpha _ { i } ^ { \theta _ { i , i } } \cdots \bigg ] \Bigg ) \Bigg ) ^ { \theta _ { i } } } \\ & { \quad \cdots \Bigg ) \Bigg ) \Bigg ) } \end{array}
586
+ $$
587
+
588
+ is an approximation to $g _ { 1 }$ in $K$ , to within $\varepsilon / 3$ , with respect to $\| \cdot \| _ { \infty }$ . This is possible by equations (C.1) and (C.2); in particular the approximation should be sufficiently precise that
589
+
590
+ $$
591
+ r ^ { 2 M - 2 } ( [ ( \operatorname { s u p } K ) ^ { - 1 } , \operatorname { s u p } K ] ) \subseteq L ,
592
+ $$
593
+
594
+ which is why $\alpha > 0$ is needed: note how $r ^ { 2 }$ , and thus $r ^ { 4 } , r ^ { 6 } , . . . , r ^ { 2 M - 2 }$ , are approximately the identity function on $L$ .
595
+
596
+ This description of $\widetilde { g } _ { 1 }$ is now amenable to representation with a neural network. The key fact about this description of $\widetilde { g } _ { 1 }$ is that, working from the most nested set of brackets outwards, the value of $\widetilde { g } _ { 1 }$ e emay be computed by performing a single chain of multiplications and additions, and occasionally taking the reciprocal of all of the input values.
597
+
598
+ So let the computation neuron and the out-register neuron corresponding to $g _ { 1 }$ perform the multiplications, layer-by-layer, to compute Qnk=1 xk θM,k in the manner of Lemma C.1. Store this value in the out-register neuron.
599
+
600
+ Now use the computation neurons and the in-register neurons corresponding to $x _ { 1 }$ (across multiple layers) to compute $r ( x _ { 1 } )$ , in the manner of Proposition C.3: eventually the in-register neuron is now storing $r ( x _ { 1 } ) \approx 1 / x _ { 1 }$ . Repeat for the other in-register neurons, so that they are collectively storing $r ( x _ { 1 } ) , \ldots , r ( x _ { n } )$ .
601
+
602
+ Now the computation neuron and the out-register neuron may start multipying $r ( x _ { 1 } ) , \ldots , r ( x _ { n } )$ on to Qnk=1 xk θM,k (which is the value presently stored in the out-register neuron) the appropriate number to times to compute $\left[ \prod _ { k = 1 } ^ { n } r ( x _ { k } ) ^ { \theta _ { M - 1 , k } } \right] \left[ \prod _ { k = 1 } ^ { n } x _ { k } ^ { \theta _ { M , k } } \right]$ , by Lemma C.1. Store this value in the out-register neuron. Then add one (using the affine part of a layer). The out-register neuron has now computed the expression in the innermost bracket in the description of $\widetilde { g } _ { 1 }$ .
603
+
604
+ The general pattern is now clear: apply $r$ to all of the in-register neurons again to compute $r ^ { 2 } ( x _ { i } )$ , multiply them on to the value in the out-register neuron, and so on. Eventually the out-register neuron corresponding to $g _ { 1 }$ will have computed the value $\widetilde { g } _ { 1 }$ . Actually, it will have computed an approximation $\widehat { g } _ { 1 }$ eto this value, because of the identity approximations involved.
605
+
606
+ By taking all of the (many) identity approximations throughout the network to be suitably precise, the values of $\widetilde { g } _ { 1 }$ and $\widehat { g } _ { 1 }$ may be taken within $\varepsilon / 3$ of each other, and the values of $\widehat { g } _ { 2 } , \ldots , \widehat { g } _ { m }$ and $g _ { 2 } , \ldots , g _ { m }$ e b may be taken within $2 \varepsilon / 3$ of each other, in each case with respect to $\| \cdot \| _ { \infty }$ on $K$ .
607
+
608
+ Thus $( \widehat { g } _ { 1 } , \ldots , \widehat { g } _ { m } )$ approximates $f$ with total error no more than $\varepsilon$ , and the proof is complete.
md/train/BJe0Gn0cY7/BJe0Gn0cY7.md ADDED
@@ -0,0 +1,398 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PREVENTING POSTERIOR COLLAPSE WITH δ-VAES
2
+
3
+ Ali Razavi
4
+ Deepmind
5
+ alirazavi@google.com
6
+
7
+ Aaron van den Oord ¨ Deepmind avdnoord@google.com
8
+
9
+ Ben Poole
10
+ Google Brain
11
+ pooleb@google.com
12
+ Oriol Vinyals
13
+ Deepmind
14
+ vinyals@google.com
15
+
16
+ # ABSTRACT
17
+
18
+ Due to the phenomenon of “posterior collapse,” current latent variable generative models pose a challenging design choice that either weakens the capacity of the decoder or requires altering the training objective. We develop an alternative that utilizes the most powerful generative models as decoders, optimize the variational lower bound, and ensures that the latent variables preserve and encode useful information. Our proposed $\delta$ -VAEs achieve this by constraining the variational family for the posterior to have a minimum distance to the prior. For sequential latent variable models, our approach resembles the classic representation learning approach of slow feature analysis. We demonstrate our method’s efficacy at modeling text on LM1B and modeling images: learning representations, improving sample quality, and achieving state of the art log-likelihood on CIFAR-10 and ImageNet $3 2 \times 3 2$ .
19
+
20
+ # 1 INTRODUCTION
21
+
22
+ Deep latent variable models trained with amortized variational inference have led to advances in representation learning on high-dimensional datasets (Kingma & Welling, 2013; Rezende et al., 2014). These latent variable models typically have simple decoders, where the mapping from the latent variable to the input space is unimodal, for example using a conditional Gaussian decoder. This typically results in representations that are good at capturing the global structure in the input, but fail at capturing more complex local structure (e.g. texture (Larsen et al., 2016)). In parallel, advances in autoregressive models have led to drastic improvements in density modeling and sample quality without explicit latent variables (van den Oord et al., 2016b). While these models are good at capturing local statistics, they often fail to produce globally coherent structures (Ostrovski et al., 2018).
23
+
24
+ Combining the power of tractable densities from autoregressive models with the representation learning capabilities of latent variable models could result in higher-quality generative models with useful latent representations. While much prior work has attempted to join these two models, a common problem remains. If the autoregressive decoder is expressive enough to model the data density, then the model can learn to ignore the latent variables, resulting in a trivial posterior that collapses to the prior. This phenomenon has been frequently observed in prior work and has been referred to as optimization challenges of VAEs by Bowman et al. (2015), the information preference property by Chen et al. (2016), and the posterior collapse problems by several others (e.g. van den Oord et al., 2017; Kim et al., 2018; Dieng et al., 2018). Ideally, an approach that mitigates posterior collapse would not alter the evidence lower bound (ELBO) training objective, and would allow the practitioner to leverage the most recent advances in powerful autoregressive decoders to improve performance. To the best of our knowledge, no prior work has succeeded at this goal. Most common approaches either change the objective (Higgins et al., 2017; Alemi et al., 2017; Zhao et al., 2017; Chen et al., 2016; Lucas & Verbeek, 2017; Goyal et al., 2017), or weaken the decoder (Bowman et al., 2015; Gulrajani et al., 2016). Additionally, these approaches are often challenging to tune and highly sensitive to hyperparameters (Alemi et al., 2017; Chen et al., 2016).
25
+
26
+ In this paper, we propose $\delta$ -VAEs, a simple framework for selecting variational families that prevent posterior collapse without altering the ELBO training objective or weakening the decoder. By restricting the parameters or family of the posterior, we ensure that there is a minimum KL divergence, $\delta$ , between the posterior and the prior.
27
+
28
+ We demonstrate the effectiveness of this approach at learning latent-variable models with powerful decoders on images (CIFAR-10, and ImageNet $3 2 \times 3 2$ ), and text (LM1B). We achieve state of the art log-likelihood results with image models by additionally introducing a sequential latent-variable model with an anti-causal encoder structure. Our experiments demonstrate the utility of $\delta$ -VAEs at learning useful representations for downstream tasks without sacrificing performance on density modeling.
29
+
30
+ # 2 MITIGATING POSTERIOR COLLAPSE WITH $\delta$ -VAES
31
+
32
+ Our proposed $\delta$ -VAE builds upon the framework of variational autoencoders (VAEs) (Kingma & Welling, 2013; Rezende et al., 2014) for training latent-variable models with amortized variational inference. Our goal is to train a generative model $p ( x , z )$ to maximize the marginal likelihood $\log p ( x )$ on a dataset. As the marginal likelihood requires computing an intractable integral over the unobserved latent variable $z$ , VAEs introduce an encoder network $q ( z | x )$ and optimize a tractable lower bound (the ELBO): $\begin{array} { r } { \log p ( x ) \ge \mathbb { E } _ { z \sim q ( z \vert x ) } \left[ \log p ( x \vert z ) \right] - D _ { \mathrm { K L } } ( q ( z \vert x ) \| p ( z ) ) } \end{array}$ . The first term is typically referred to as the reconstruction term, and the second term (KL) the rate term, as it measures how many nats on average are required to send the latent variables from the encoder $( q ( \boldsymbol { z } | \boldsymbol { x } ) )$ to the decoder $( p ( z | x ) )$ using a code designed for the prior $( p ( z ) )$ (Hoffman et al., 2016; Alemi et al., 2017).
33
+
34
+ The problem of posterior collapse is that the rate term, $D _ { \mathrm { K L } } ( q ( z | x ) | | p ( z ) )$ reduces to 0. In this case, the approximate posterior $q ( \tilde { \boldsymbol { z } | } \boldsymbol { x } )$ equals the prior $p ( z )$ , thus the latent variables do not carry any information about the input $x$ . A necessary condition if we want representations to be meaningful is to have the rate term be positive.
35
+
36
+ In this paper we address the posterior collapse problem with structural constraints so that the KL divergence between the posterior and prior is lower bounded by design. This can be achieved by choosing families of distributions for the prior and approximate posterior, $p _ { \boldsymbol { \theta } } ( \mathbf { z } )$ and $q _ { \phi } ( { \bf z } | { \bf x } )$ such that $\begin{array} { r } { \operatorname* { m i n } _ { \theta , \phi } D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { x } ) \| p _ { \theta } ( \mathbf { z } ) ) \geq \delta } \end{array}$ . We refer to $\delta$ as the committed rate of the model.
37
+
38
+ Note that a trivial choice for $p$ and $q$ to have a non-zero committed rate is to set them to Gaussian distributions with fixed (but different) variance term. We study a variant of this case in the experiments, and provide more details of this setup in Appendix D. In the following section we describe our choices for $p _ { \theta }$ and $q _ { \phi }$ , but others should also be explored in future work.
39
+
40
+ # 2.1 $\delta$ -VAE WITH SEQUENTIAL LATENT VARIABLES
41
+
42
+ Data such as speech, natural images and text exhibit strong spatio-temporal continuity. Our aim is to model variations in such data through latent variables, so that we have control over not just the global characteristics of the generated samples (e.g., existence of an object), but also can influence their finer, often shifting attributes such as texture and pose in the case of natural images, tone, volume and accent in the case of speech, or style and sentiment in the case of natural language. Sequences of latent variables can be an effective modeling tool for expressing the occurrence and evolution of such features throughout the sequence.
43
+
44
+ To construct a $\delta$ -VAE in the sequential setting, we combine a mean field posterior with a correlated prior in time. We model the posterior distribution of each timestep as $\begin{array} { r l } { q ( \mathbf { z } _ { t } | \mathbf { x } ) } & { { } = } \end{array}$ $\mathcal { N } ( \mathbf { z } _ { t } ; \bar { \mu _ { t } } ( \mathbf { x } ) , \sigma _ { t } ( \mathbf { x } ) )$ . For the prior, we use a first-order linear autoregressive process (AR(1)), where $\mathbf { z } _ { t } = \alpha \mathbf { z } _ { t - 1 } + \epsilon _ { t }$ with $\epsilon _ { t }$ zero mean Gaussian noise with constant variance $\sigma _ { \epsilon } ^ { 2 }$ . The conditional probability for the latent variable can be expressed as $p ( \mathbf { z } _ { t } | \mathbf { z } _ { < t } ) = \mathcal { N } ( \mathbf { z } _ { t } ; \alpha \mathbf { z } _ { t - 1 } , \sigma _ { \epsilon } )$ . This process is wide-sense stationary (that is, having constant sufficient statistics through its time evolution) if $| \alpha | < 1$ . If so, then $\mathbf { z } _ { t }$ has zero mean and variance of $\frac { \sigma _ { \epsilon } ^ { 2 } } { 1 - \alpha ^ { 2 } }$ . It is thus convenient to choose $\sigma _ { \epsilon } = \sqrt { 1 - \alpha ^ { 2 } }$ so that the variance is constant over time. The mismatch in the correlation structure of the prior and the posterior results in the following positive lower bound on the KL-divergence between the two distributions (see Appendix $\textrm { C }$ for derivation):
45
+
46
+ $$
47
+ D _ { \mathrm { K L } } ( q ( \mathbf { z } | \mathbf { x } ) \| p ( \mathbf { z } ) ) \geq \frac { 1 } { 2 } \sum _ { k = 1 } ^ { d } ( n - 2 ) \ln ( 1 + \alpha _ { k } ^ { 2 } ) - \ln ( 1 - \alpha _ { k } ^ { 2 } )
48
+ $$
49
+
50
+ where $n$ is the length of the sequence and $d$ is the dimension of the latent variable at each timestep. The committed rate between the prior and the posterior is easily controlled by equating the right hand side of the inequality in equation 1 to a given rate $\delta$ and solving for $\alpha$ . In Fig. 1, we show the scaling of the minimum rate as a function of $\alpha$ and the behavior of $\delta$ -VAE in 2d.
51
+
52
+ ![](images/e5f600e3710989565574d1d29fed7d3994bf9a4e038d6de369a7826c88d58a9c.jpg)
53
+ Figure 1: Effect of $\delta$ in a toy model. Fitting an uncorrelated Gaussian for the posterior, $q _ { \phi } ( z )$ , to a correlated Gaussian prior, $p _ { \alpha } ( z )$ , by minimizing $D _ { \mathrm { K L } } ( q _ { \phi } ( z ) \| p _ { \alpha } ( z ) )$ over $\phi$ . Left: committed rate $( \delta )$ as a function of the prior squared correlation $\alpha$ and the dimensionality $n$ . Right: contours of the optimal posterior and prior in 2d. As the correlation increases, the minimum rate grows.
54
+
55
+ # 2.1.1 RELATION TO PROBABILISTIC SLOWNESS PRIOR
56
+
57
+ The AR(1) prior over the latent variables specifies the degree of temporal correlation in the latent space. As the correlation $\alpha$ approaches one, the prior trajectories get smoother . On the other hand in the limit of $\alpha$ approaching 0, the prior becomes the same as the independent standard Gaussian prior where there are no correlations between timesteps. This pairing of independent posterior with a correlated prior is related to the probabilistic counterpart to Slow Feature Analysis (Wiskott & Sejnowski, 2002) in Turner & Sahani (2007). SFA has been shown to be an effective method for learning invariant spatio-temporal features (Wiskott & Sejnowski, 2002). In our models, we infer latent variables with multiple dimensions per timestep, each with a different slowness filter imposed by a different value of $\alpha$ , corresponding to features with different speed of variation.
58
+
59
+ # 2.2 ANTI-CAUSAL ENCODER NETWORK
60
+
61
+ Having a high capacity autoregressive network as the decoder implies that it can accurately estimate $p ( \mathbf { x } _ { t } | \mathbf { x } _ { < t } )$ . Given this premise, what kind of complementary information can latent variables provide? Encoding information about the past seems wasteful as the autoregressive decoder has full access to past observations already. On the other hand, if we impose conditional independence between observations and latent variables at other timesteps given the current one (i.e., $p ( \bar { \mathbf { x } } _ { t } | \mathbf { z } ) = p ( \mathbf { x } _ { t } | \mathbf { z } _ { t } ) )$ , there will then be at best (by the data processing inequality (Cover $\&$ Thomas, 2006)) a break-even situation between the KL cost of encoding information in $\mathbf { z } _ { t }$ and the resulting improvement in the reconstruction loss. There is therefore no advantage for the model to utilize the latent variable even if it would transmit to the decoder the unobserved $\mathbf { x } _ { t }$ . The situation is different when $\mathbf { z } _ { t }$ can inform the decoder at multiple timesteps, encoding information about $\mathbf { x } _ { t }$ and $\mathbf { x } _ { > t }$ . In this setting, the decoder pays the KL cost for the mutual information once, but is able to leverage the transmitted information multiple times to reduce its entropy about future predictions.
62
+
63
+ To encourage the generative model to leverage the latents for future timesteps, we introduce an anti-causal structure for the encoder where the parameters of the variational posterior for a timestep cannot depend on past observations (Fig. 2). Alternatively, one can consider a non-causal structure that allows latents be inferred from all observations. In this non-causal setup there is no temporal order in either the encoder or the decoder, thus the model resembles a standard non-temporal latentvariable model. While the anti-causal structure is a subgraph of the non-causal structure, we find that the anti-causal structure often performs better, and we compare both approaches in different settings in Appendix F.1.
64
+
65
+ ![](images/b72e61eeb4c483028eab5b9b3fdca1eaf0f245c20c9835c46ff228876a8ef17f.jpg)
66
+ Figure 2: Generative structures for the inference of sequential latent variables. The anti-causal structure introduces an inductive bias to encode in each latent variable information about the future
67
+
68
+ # 3 RELATED WORK
69
+
70
+ The main focus of our work is on representation learning and density modeling in latent variable models with powerful decoders. Earlier work has focused on this kind of architecture, but has addressed the problem of posterior collapse in different ways.
71
+
72
+ In terms of our architecture, the decoders for our image models build on advances in autoregressive modeling from van den Oord et al. (2016b); Salimans et al. (2017); Chen et al. (2017); Parmar et al. (2018). Unlike prior models, we use sequential latent variables to generate the image row by row. This differs from Gregor et al. (2016), where the latent variables are sequential but the entire image is generated at each timestep. Our sequential image generation model resembles latent variable models used for timeseries (Chung et al., 2015; Babaeizadeh et al., 2017; Denton & Fergus, 2018) but does not rely on KL annealing, and has an additional autoregressive dependence of the outputs over time (rows of the image). Another difference between our work and previous sequential latent variable models is our proposed anti-causal structure for the inference network (see Sect. 2.2). We motivate this structure from a coding efficiency and representation learning standpoint and demonstrate its effectiveness empirically in Sect. 4. For textual data, we use the Transformer architecture from Vaswani et al. (2017) as our main blueprint for the decoder. As shown in Sect. 4, our method is able to learn informative latent variables while preserving the performance of these models in terms of likelihoods.
73
+
74
+ To prevent posterior collapse, most prior work has focused on modifying the training objective. Bowman et al. (2015); Yang et al. (2017); Kim et al. (2018) and Gulrajani et al. (2016) use an annealing strategy, where they anneal the weight on the rate from 0 to 1 over the course of training. This approach does not directly optimize a lower bound on likelihood for most of training, and tuning the annealing schedule to prevent collapse can be challenging (see Sect. 4). Similarly, Higgins et al. (2017) proposes using a fixed coefficient $> 1$ on the rate term to learn disentangled representations. Zhao et al. (2017) adds a term to the objective to pick the model with maximal rate. Other works use auxiliary tasks such as secondary low-resolution reconstructions with non-autoregressive decoders (Lucas & Verbeek, 2017) or predicting the state of the backward LSTM in the encoder (Goyal et al., 2017) to encourage the utilization of latent variables. Chen et al. (2016); Kingma et al. (2016) use free-bits to allow the model to hit a target minimum rate, but the objective is non-smooth which leads to optimization difficulties in our hands, and deviations from a lower bound on likelihood when the soft version is used with a coefficient less than 1. Alemi et al. (2017) argue that the ELBO is a defective objective function for representation learning as it does not distinguish between models with different rates, and advocate for model selection based on downstream tasks. Their method for sweeping models was to use $\beta$ -VAE with different coefficients, which can be challenging as the mapping from $\beta$ to rate is highly nonlinear, and model- and data-dependent. While we adopt the same rate-distortion perspective as Alemi et al. (2017), we present a new way of achieving a target rate while optimizing the vanilla ELBO objective.
75
+
76
+ Most similar to our approach is work on constraining the variational family to regularize the model. VQ-VAE (van den Oord et al., 2017) uses discrete latent variables obtained by vector quantization of the latent space that, given a uniform prior over the outcome, yields a fixed KL divergence equal to $\log K$ , where $K$ is the size of the codebook. A number of recent papers have also used the von Mises-Fisher (vMF) distribution to obtain a fixed KL divergence and mitigate the posterior collapse problem. In particular, Guu et al. (2017); Xu & Durrett (2018); Davidson et al. (2018) use $\mathbf { v M F } ( { \boldsymbol { \mu } } , { \boldsymbol { \kappa } } )$ with a fixed $\kappa$ as their posterior, and the uniform distribution (i.e. $\mathbf { v M F } ( \cdot , 0 ) )$ ) as the prior. The mismatching prior-posterior thus give a constant KL divergence. As such, this approach can be considered as the continuous analogue of VQ-VAE. Unlike the VQ-VAE and vMF approaches which have a constant KL divergence for every data point, $\delta$ -VAE can allow higher KL for different data points. This allows the model to allocate more bits for more complicated inputs, which has been shown to be useful for detecting outliers in datasets (Alemi et al., 2018). As such, $\delta$ -VAE may be considered a generalisation of these fixed-KL approaches.
77
+
78
+ The Associative Compression Networks (ACN) (Graves & Menick, 2014) is a new method for learning latent variables with powerful decoders that exploits the associations between training examples in the dataset by amortizing the description length of the code among many similar training examples. ACN deviates from the i.i.d training regime of the classical methods in statistics and machine learning, and is considered a procedure for compressing whole datasets rather than individual training examples. GECO (Jimenez Rezende & Viola, 2018) is a recently proposed method to stabilize the training of $\beta$ -VAEs by finding an automatic annealing schedule for the KL that satisfies a tolerance constraint for maximum allowed distortion, and solving the resulting Lagrange multiplier for the KL penalty. The value of $\beta$ , however, does not necessarily approach one, which means that the optimized objective may not be a lower bound for the marginal likelihood.
79
+
80
+ # 4 EXPERIMENTS
81
+
82
+ # 4.1 NATURAL IMAGES
83
+
84
+ We applied our method to generative modeling of images on the CIFAR-10 (Krizhevsky et al.) and downsampled ImageNet (Deng et al., 2009) $3 2 \times 3 2$ as prepared in van den Oord et al. (2016a)) datasets. We describe the main components in the following. The details of our hyperparameters can be found in Appendix E.
85
+
86
+ Decoder: Our decoder network is closest to PixelSNAIL (Chen et al., 2017) but also incorporates elements from the original GatedPixelCNN (van den Oord et al., 2016b). In particular, as introduced by Salimans et al. (2017) and used in Chen et al. (2017), we use a single channel network to output the components of discretised mixture of logistics distributions for each channel, and linear dependencies between the RGB colour channels. As in PixelSNAIL, we use attention layers interleaved with masked gated convolution layers. We use the same architecture of gated convolution introduced in van den Oord et al. (2016b). We also use the multi-head attention module of Vaswani et al. (2017). To condition the decoder, similar to Transformer and unlike PixelCNN variants that use 1x1 convolution, we use attention over the output of the encoder. The decoder-encoder attention is causally masked to realize the anti-causal inference structure, and is unmasked for the non-causal structure.
87
+
88
+ Encoder. Our encoder also uses the same blueprint as the decoder. To introduce the anti-causal structure the input is reversed, shifted and cropped by one in order to obtain the desired future context. Using one latent variable for each pixel is too inefficient in terms of computation so we encode each row of the image with a multidimensional latent variable.
89
+
90
+ Auxiliary Prior. Tomczak & Welling (2017); Hoffman et al. (2016); Jimenez Rezende & Viola (2018) show that VAE performance can suffer when there is a significant mismatch between the prior and the aggregate posterior, $q ( \boldsymbol { z } ) = \mathbb { E } _ { \boldsymbol { x } \sim \mathcal { D } } \left[ q ( \boldsymbol { z } | \boldsymbol { x } ) \right]$ . When such a gap exists, the decoder is likely to have never seen samples from regions of the prior distribution where the aggregate posterior assigns small probability density. This phenomenon, also known as the “posterior holes” problem (Jimenez Rezende & Viola, 2018), can be exacerbated in $\delta$ -VAEs, where the systematic mismatch between the prior and the posterior might induce a large gap between the prior and aggregate posterior. Increasing the complexity of the variational family can reduce this gap (Rezende & Mohamed, 2015), but require changes in the objective to control the rate and prevent posterior collapse (Kingma et al., 2016). To address this limitation, we adopt the approaches of van den Oord et al. (2017); Roy et al. (2018) and train an auxiliary prior over the course of learning to match the aggregate posterior, but that does not influence the training of the encoder or decoder. We used a simple autoregressive model for the auxiliary prior $p ^ { a u x }$ : a single-layer LSTM network with conditional-Gaussian outputs.
91
+
92
+ # 4.1.1 DENSITY ESTIMATION RESULTS
93
+
94
+ We begin by comparing our approach to prior work on CIFAR-10 and downsampled ImageNet $3 2 \mathrm { x } 3 2 $ in Table 1. As expected, we found that the capacity of the employed autoregressive decoder had a large impact on the overall performance. Nevertheless, our models with latent variables have a negligible gap compared to their powerful autoregressive latent-free counterparts, while also learning informative latent variables. In comparison, (Chen et al., 2016) had a 0.03 bits per dimension gap between their latent variable model and $\mathrm { P i x e l C N N + + }$ architecture1. On ImageNet $3 2 \mathrm { x } 3 2 $ , our latent variable model achieves on par performance with purely autoregressive Image Transformer (Parmar et al., 2018). On CIFAR-10 we achieve a new state of the art of 2.83 bits per dimension, again matching the performance of our autoregressive baseline. Note that the values for KL appear quite small as they are reported in bits per dimension (e.g. 0.02 bits/dim translates to 61 bits/image encoded in the latents). The results on CIFAR-10 also demonstrate the effect of the auxiliary prior on improving the efficiency of the latent code; it leads to more than $5 0 \%$ (on average 30 bits per image) reduction in the rate of the model to achieve the same performance.
95
+
96
+ Table 1: Estimated upper bound on negative log-likelihood along with KL-divergence (in parenthesis) in bits per dimension for CIFAR-10 and downsampled ImageNet.
97
+
98
+ <table><tr><td></td><td>CIFAR-10 Test</td><td>ImageNet 32 × 32 Valid</td></tr><tr><td>Latent VariableModels ConvDraw (Gregor et al. (2016))</td><td>≤3.85</td><td></td></tr><tr><td>DenseNet VLAE (Chen et al. (2016)) δ-VAE +PixelSNAIL + AR(1) Prior</td><td>≈ 2.95 ≤ 2.85 (0.02)</td><td></td></tr><tr><td>δ-VAE+PixelSNAIL +Auxiliary Prior</td><td> 2.83 (0.01)</td><td>≤ 3.78 (0.08) 3.77 (0.07)</td></tr><tr><td>Autoregressive Models</td><td></td><td></td></tr><tr><td>Gated PixelCNN(van den Oord et al. (2016b))</td><td>3.03</td><td>3.83</td></tr><tr><td>PixelCNN++ (Salimans et al. (2017))</td><td>2.92</td><td>1</td></tr><tr><td>PixelRNN (van den Oord et al. (2016a))</td><td>3.00</td><td>1</td></tr><tr><td>ImageTransformer (Parmar et al. (2018))</td><td>2.90</td><td>3.77</td></tr><tr><td>PixelSNAIL (Chen et al. (2017))</td><td>2.85</td><td>3.80</td></tr><tr><td></td><td></td><td></td></tr><tr><td>Our Decoder baseline</td><td>2.83</td><td>3.77</td></tr></table>
99
+
100
+ # 4.2 UTILIZATION OF LATENT VARIABLES
101
+
102
+ In this section, we aim to demonstrate that our models learn meaningful representations of the data in the latent variables. We first investigate the effect of z on the generated samples from the model. Fig. 3 depicts samples from an ImageNet model (see Appendix for CIFAR-10), where we sample from the decoder network multiple times conditioned on a fixed sample from the auxiliary prior. We see similar global structure (e.g. same color background, scale and structure of objects) but very different details. This indicates that the model is using the latent variable to capture global structure, while the autoregressive decoder is filling in local statistics and patterns.
103
+
104
+ For a more quantitative assessment of how useful the learned representations are for downstream tasks, we performed linear classification from the representation to the class labels on CIFAR-10. We also study the effect of the chosen rate of the model on classification accuracy as illustrated in Fig. 4b, along with the performance of other methods. We find that generally a model with higher rate gives better classification accuracy, with our highest rate model, encoding 92 bits per image, giving the best accuracy of $6 8 \%$ . However, we find that improved log-likelihood does not necessarily lead to better linear classification results. We caution that an important requirement for this task is the linear separability of the learned feature space, which may not align with the desire to learn highly compressed representations.
105
+
106
+ # 4.3 ABLATION STUDIES
107
+
108
+ We performed more extensive comparisons of $\delta$ -VAE with other approaches to prevent posterior collapse on the CIFAR-10 dataset. We employ the same medium sized encoder and decoder for evaluating all methods as detailed in Appendix E. Fig. 4a reports the rate-distortion results of our experiments for the CIFAR-10 test set. To better highlight the difference between models and to put into perspective the amount of information that latent variables capture about images, the rate and distortion results in Fig. 4a are reported in bits per images. We only report results for models that encode a non-negligible amount information in latent variables. Unlike the committed information rate approach of $\delta$ -VAE, most alternative solutions required considerable amount of effort to get the training converge or prevent the KL from collapsing altogether. For example, with linear annealing of KL (Bowman et al., 2015), despite trying a wide range of values for the end step of the annealing schedule, we were not able to train a model with a significant usage of latent variables; the KL collapsed as soon as $\beta$ approached one. A practical advantage of our approach is its simple formula to choose the target minimum rate of the model. Targeting a desired rate in $\beta$ -VAE, on the other hand, proved to be difficult, as many of our attempts resulted in either collapsed KL, or very large KL values that led to inefficient inference. As reported in Chen et al. (2016), we also observed that optimising models with the free-bits loss was challenging and sensitive to hyperparameter values.
109
+
110
+ ![](images/ea4c6f6e7f7c7594da3267dc9d65daa9b0e1e437c3b0b9046985c9964175169f.jpg)
111
+ Figure 3: Random samples from our ImageNet $3 2 \times 3 2$ model. Each column in Fig. 3a shows multiple samples from $p ( \mathbf { x } | \mathbf { z } )$ for a fixed $\mathbf { z } \sim p _ { a u x } ( \mathbf { z } )$ . Each image in Fig. 3b is decoded using a different sample from $p _ { a u x } ( \mathbf { z } )$ .
112
+
113
+ To assess each methods tendency to overfit across the range of rates, we also report the rate-distortion results for CIFAR-10 training sets in Appendix F. While $\beta$ -VAEs do find points along the ratedistortion optimal frontier on the training set, we found that they overfit more than $\delta$ -VAEs, with $\delta$ -VAEs dominating the rate-distortion frontier on heldout data.
114
+
115
+ Next, we compare the performance of the anti-causal encoder structure with the non-causal structure on the CIFAR-10 dataset discussed in Sect. 2.2. The results for several configurations of our model are reported in the Appendix Table 6. In models where the decoder is not powerful enough (such as our 6-layer PixelCNN that has no attention and consequently a receptive field smaller than the causal context for most pixels), the anti-causal structure does not perform as well as the noncausal structure. The performance gap is however closed as the decoder becomes more powerful and its receptive field grows by adding self-attention and more layers. We observed that the anticausal structure outperforms the non-causal encoder for very high capacity decoders, as well as for medium size models with a high rate. We also repeated these experiments with both anti-causal and non-causal structures but without imposing a committed information rate or using other mitigation strategies, and found that neither structure by itself is able to mitigate the posterior collapse issue; in both cases the KL divergence drops to negligible values $\leq 1 0 ^ { - 8 }$ bits per dimension) only after a few thousand training steps, and never recovers.
116
+
117
+ ![](images/5b8fcdfd3cb5559beea74f50cbd4bb81c6517a11fc99cb616f189bde25dc07ba.jpg)
118
+ Figure 4: Comparison of CIFAR-10 test performance of $\delta$ -VAEs vs. models trained with free-bits and $\beta$ -VAE across many rates. $\delta$ -VAE is significantly more stable, achieves competitive density estimation results across different rates, and its learned representations perform better in the downstream linear classification task.
119
+
120
+ # 4.4 TEXT
121
+
122
+ For our experiments on natural language, we used the 1 Billion Words or LM1B (Chelba et al., 2013) dataset in its processed form in the Tensor2Tensor (Vaswani et al., 2018) codebase 2. Our employed architecture for text closely follows the Transformer network of Vaswani et al. (2017). Our sequence of latent variables has the same number of elements as in the number of tokens in the input, each having two dimensions with $\alpha = 0 . 2$ and 0.4. Our decoder uses causal self-attention as in Vaswani et al. (2017). For the anti-causal structure in the encoder, we use the inverted causality masks as in the decoder to only allow looking at the current timestep and the future.
123
+
124
+ Quantitatively, our model achieves slightly worse log-likelihood compared to its autoregressive counterpart (Table 2), but makes considerable use of latent variables, as demonstrated by the samples and interpolations in Appendix H.
125
+
126
+ Table 2: The result of our text experiments on LM1B in nats / token.
127
+
128
+ <table><tr><td></td><td>AR(1) ELBO (KL)</td><td>AuX prior ELBO (KL)</td><td>AR baseline NLL</td></tr><tr><td>δ-VAE</td><td>3.61(0.2)</td><td>≤ 3.58(0.17)</td><td>3.55</td></tr></table>
129
+
130
+ # 5 DISCUSSION
131
+
132
+ In this work, we have demonstrated that $\delta$ -VAEs provide a simple, intuitive, and effective solution to posterior collapse in latent variable models, enabling them to be paired with powerful decoders. Unlike prior work, we do not require changes to the objective or weakening of the decoder, and we can learn useful representations as well as achieving state-of-the-art likelihoods. While our work presents two simple posterior-prior pairs, there are a number of other possibilities that could be explored in future work. Our work also points to at least two interesting challenges for latentvariable models: (1) can they exceed the performance of a strong autoregressive baseline, and (2) can they learn representations that improve downstream applications such as classification?
133
+
134
+ # ACKNOWLEDGMENTS
135
+
136
+ We would like to thank Danilo J. Rezende, Sander Dieleman, Jeffrey De Fauw, Jacob Menick, Nal Kalchberner, Andy Brock, Karen Simonyan and Jeff Donahue for their help, insightful discussions and valuable feedback.
137
+
138
+ # REFERENCES
139
+
140
+ Mart´ın Abadi, Paul Barham, Jianmin Chen, Zhifeng Chen, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Geoffrey Irving, Michael Isard, Manjunath Kudlur, Josh Levenberg, Rajat Monga, Sherry Moore, Derek G. Murray, Benoit Steiner, Paul Tucker, Vijay Vasudevan, Pete Warden, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. Tensorflow: A system for largescale machine learning. In Proceedings of the 12th USENIX Conference on Operating Systems Design and Implementation, OSDI’16, pp. 265–283, Berkeley, CA, USA, 2016. USENIX Association. ISBN 978-1-931971-33-1. URL http://dl.acm.org/citation.cfm?id= 3026877.3026899.
141
+
142
+ Alexander A Alemi, Ben Poole, Ian Fischer, Joshua V Dillon, Rif A Saurous, and Kevin Murphy. Fixing a Broken ELBO. 2017. ISSN 1938-7228. URL http://arxiv.org/abs/1711. 00464.
143
+
144
+ Alexander A Alemi, Ian Fischer, and Joshua V Dillon. Uncertainty in the variational information bottleneck. arXiv preprint arXiv:1807.00906, 2018.
145
+
146
+ Lei Jimmy Ba, Ryan Kiros, and Geoffrey E. Hinton. Layer normalization. CoRR, abs/1607.06450, 2016.
147
+
148
+ Mohammad Babaeizadeh, Chelsea Finn, Dumitru Erhan, Roy H. Campbell, and Sergey Levine. Stochastic variational video prediction. CoRR, abs/1710.11252, 2017.
149
+
150
+ Samuel R. Bowman, Luke Vilnis, Oriol Vinyals, Andrew M. Dai, Rafal Jozefowicz, and Samy Bengio. Generating Sentences from a Continuous Space. 2015. doi: 10.18653/v1/K16-1002. URL http://arxiv.org/abs/1511.06349.
151
+
152
+ Ciprian Chelba, Tomas Mikolov, Mike Schuster, Qi Ge, Thorsten Brants, and Phillipp Koehn. One billion word benchmark for measuring progress in statistical language modeling. CoRR, abs/1312.3005, 2013.
153
+
154
+ Xi Chen, Diederik P Kingma, Tim Salimans, Yan Duan, Prafulla Dhariwal, John Schulman, Ilya Sutskever, and Pieter Abbeel. Variational Lossy Autoencoder. In Iclr, pp. 1–14, nov 2016. URL http://arxiv.org/abs/1611.02731.
155
+
156
+ Xi Chen, Nikhil Mishra, Mostafa Rohaninejad, and Pieter Abbeel. PixelSNAIL: An Improved Autoregressive Generative Model. pp. 12–17, 2017. URL http://arxiv.org/abs/1712. 09763.
157
+
158
+ Junyoung Chung, Kyle Kastner, Laurent Dinh, Kratarth Goel, Aaron Courville, and Yoshua Bengio. A Recurrent Latent Variable Model for Sequential Data. Advances in Neural Information Processing Systems 28 (NIPS 2015), pp. 8, 2015. ISSN 10495258. URL http: //arxiv.org/abs/1506.02216.
159
+
160
+ Thomas M. Cover and Joy A. Thomas. Elements of Information Theory (Wiley Series in Telecommunications and Signal Processing). Wiley-Interscience, New York, NY, USA, 2006. ISBN 0471241954.
161
+
162
+ Tim R Davidson, Luca Falorsi, Nicola De Cao, Thomas Kipf, and Jakub M Tomczak. Hyperspherical variational auto-encoders. arXiv preprint arXiv:1804.00891, 2018.
163
+
164
+ 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.
165
+
166
+ Emily Denton and Rob Fergus. Stochastic video generation with a learned prior. CoRR, abs/1802.07687, 2018.
167
+
168
+ Adji B Dieng, Yoon Kim, Alexander M Rush, and David M Blei. Avoiding latent variable collapse with generative skip models. arXiv preprint arXiv:1807.04863, 2018.
169
+
170
+ Anirudh Goyal, Alessandro Sordoni, Marc-Alexandre Cotˆ e, Nan Rosemary Ke, and Yoshua Bengio.´ Z-Forcing: Training Stochastic Recurrent Networks. (Nips), 2017. ISSN 10495258. URL http: //arxiv.org/abs/1711.05411.
171
+
172
+ Alex Graves and Jacob Menick. Associative Compression Networks for Representation Learning. 2014.
173
+
174
+ Karol Gregor, Frederic Besse, Danilo Jimenez Rezende, Ivo Danihelka, and Daan Wierstra. Towards conceptual compression. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 3549–3557. Curran Associates, Inc., 2016. URL http://papers.nips.cc/paper/ 6542-towards-conceptual-compression.pdf.
175
+
176
+ Ishaan Gulrajani, Kundan Kumar, Faruk Ahmed, Adrien Ali Taiga, Francesco Visin, David Vazquez, and Aaron Courville. PixelVAE: A Latent Variable Model for Natural Images. pp. 1–9, 2016. ISSN 0066-4308. doi: 10.1146/annurev.psych.53.100901.135239. URL http://arxiv. org/abs/1611.05013.
177
+
178
+ Kelvin Guu, Tatsunori B Hashimoto, Yonatan Oren, and Percy Liang. Generating Sentences by Editing Prototypes. 6:437–450, 2017. ISSN 1938-7228. URL http://arxiv.org/abs/ 1709.08878.
179
+
180
+ Irina Higgins, Loic Matthey, Arka Pal, Christopher Burgess, Xavier Glorot, Matthew Botvinick, Shakir Mohamed, and Alexander Lerchner. $\beta$ -VAE: Learning Basic Visual Concepts with a Constrained Variational Framework. In ICLR, 2017.
181
+
182
+ Matthew D Hoffman, Matthew J Johnson, and Google Brain. ELBO surgery: yet another way to carve up the variational evidence lower bound. Advances in Approximate Bayesian Inference, NIPS Workshop, (5), 2016. URL http://approximateinference.org/accepted/ HoffmanJohnson2016.pdf.
183
+
184
+ D. Jimenez Rezende and F. Viola. Taming VAEs. ArXiv e-prints, October 2018.
185
+
186
+ Yoon Kim, Sam Wiseman, Andrew Miller, David Sontag, and Alexander Rush. Semi-amortized variational autoencoders. 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. 2678–2687, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http://proceedings.mlr.press/v80/kim18e.html.
187
+
188
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014. URL http://dblp.uni-trier.de/db/journals/corr/ corr1412.html#KingmaB14.
189
+
190
+ Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. CoRR, abs/1312.6114, 2013.
191
+
192
+ Diederik P Kingma, Tim Salimans, Rafal Jozefowicz, Xi Chen, Ilya Sutskever, and Max Welling. Improving Variational Inference with Inverse Autoregressive Flow. (2011), 2016. ISSN 10495258. URL http://arxiv.org/abs/1606.04934.
193
+
194
+ Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-10 (canadian institute for advanced research). URL http://www.cs.toronto.edu/˜kriz/cifar.html.
195
+
196
+ Anders Boesen Lindbo Larsen, Søren Kaae Sønderby, Hugo Larochelle, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. In International Conference on Machine Learning, pp. 1558–1566, 2016.
197
+
198
+ Thomas Lucas and Jakob Verbeek. Auxiliary guided autoregressive variational autoencoders. arXiv preprint arXiv:1711.11479, 2017.
199
+
200
+ Georg Ostrovski, Will Dabney, and Remi Munos. Autoregressive quantile networks for generative modeling. 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. 3936–3945, Stockholmsmssan, Stockholm Sweden, 10–15 Jul 2018. PMLR. URL http://proceedings.mlr.press/v80/ostrovski18a.html.
201
+
202
+ Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Łukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image Transformer. 2018. ISSN 1938-7228. URL http://arxiv.org/abs/ 1802.05751.
203
+
204
+ Danilo Jimenez Rezende and Shakir Mohamed. Variational inference with normalizing flows. In Proceedings of the 32Nd International Conference on International Conference on Machine Learning - Volume 37, ICML’15, pp. 1530–1538. JMLR.org, 2015. URL http://dl.acm. org/citation.cfm?id=3045118.3045281.
205
+
206
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic Backpropagation and Approximate Inference in Deep Generative Models. 32, 2014. ISSN 10495258. doi: 10.1051/ 0004-6361/201527329. URL http://arxiv.org/abs/1401.4082.
207
+
208
+ Aurko Roy, Ashish Vaswani, Arvind Neelakantan, and Niki Parmar. Theory and experiments on vector quantized autoencoders. arXiv preprint arXiv:1805.11063, 2018.
209
+
210
+ Tim Salimans, Andrej Karpathy, Xi Chen, and Diederik P Kingma. PixelCNN $^ { + + }$ : Improving the PixelCNN with Discretized Logistic Mixture Likelihood and Other Modifications. pp. 1–9, 2017. ISSN 9781467324755. URL http://arxiv.org/abs/1701.05517.
211
+
212
+ Jakub M. Tomczak and Max Welling. VAE with a vampprior. CoRR, abs/1705.07120, 2017. URL http://arxiv.org/abs/1705.07120.
213
+
214
+ R. E. Turner and M. Sahani. A maximum-likelihood interpretation for slow feature analysis. Neural Computation, 19(4):1022–1038, 2007. ISSN 0899-7667. doi: http://dx.doi.org/10.1162/neco. 2007.19.4.1022.
215
+
216
+ Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks.¨ CoRR, abs/1601.06759, 2016a. URL http://arxiv.org/abs/1601.06759.
217
+
218
+ Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel Recurrent Neural Networks. In International Conference on Machine Learning, volume 48, pp. 1747–1756, 2016b. ISBN 9781510829008. URL http://arxiv.org/abs/1601.06759.
219
+
220
+ Aaron van den Oord, Oriol Vinyals, and Koray Kavukcuoglu. Neural discrete representation learn-¨ ing. CoRR, abs/1711.00937, 2017. URL http://arxiv.org/abs/1711.00937.
221
+
222
+ L.J.P. van der Maaten and G.E. Hinton. Visualizing high-dimensional data using t-sne. 2008.
223
+
224
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention Is All You Need. (Nips), 2017. ISSN 0140-525X. doi: 10.1017/S0140525X16001837. URL http://arxiv.org/abs/1706.03762.
225
+
226
+ Ashish Vaswani, Samy Bengio, Eugene Brevdo, Franc¸ois Chollet, Aidan N. Gomez, Stephan Gouws, Llion Jones, Lukasz Kaiser, Nal Kalchbrenner, Niki Parmar, Ryan Sepassi, Noam Shazeer, and Jakob Uszkoreit. Tensor2tensor for neural machine translation. CoRR, abs/1803.07416, 2018.
227
+
228
+ Laurenz Wiskott and Terrence J. Sejnowski. Slow feature analysis: Unsupervised learning of invariances. Neural Comput., 14(4):715–770, April 2002. ISSN 0899-7667. doi: 10.1162/ 089976602317318938. URL http://dx.doi.org/10.1162/089976602317318938.
229
+
230
+ Jiacheng Xu and Greg Durrett. Spherical latent spaces for stable variational autoencoders. Proc. Empirical Methods in Natural Language Processing, 2018.
231
+
232
+ Zichao Yang, Zhiting Hu, Ruslan Salakhutdinov, and Taylor Berg-Kirkpatrick. Improved Variational Autoencoders for Text Modeling using Dilated Convolutions. 2017. URL http://arxiv. org/abs/1702.08139.
233
+
234
+ Shengjia Zhao, Jiaming Song, and Stefano Ermon. InfoVAE: Balancing Learning and Inference in Variational Autoencoders. ICML Workshop, 2017. URL http://arxiv.org/abs/1706. 02262.
235
+
236
+ A DERIVATION OF THE KL DIVERGENCE FOR SEQUENTIAL LATENT VARIABLES
237
+
238
+ $$
239
+ \begin{array} { r l } { \epsilon _ { 1 } = \int _ { - \infty } ^ { \infty } d u \exp \left( \frac { \epsilon _ { 1 } } { \omega } \right) \sin \omega } & { = } \\ & { - \displaystyle \frac { \hat { \gamma } } { \omega } \displaystyle \frac { \hat { \gamma } } { \omega } \frac { \hat { \gamma } } { \omega } \sin \omega \sum _ { i = 1 } ^ { \infty } \omega \sum _ { j = 1 } ^ { N } \omega \log \omega _ { i } \ln \omega } \\ & { - \displaystyle \frac { \hat { \gamma } } { \omega } \displaystyle \frac { \hat { \gamma } } { \omega } \frac { \hat { \gamma } } { \omega } \sin \omega \sum _ { i = 1 } ^ { N } \omega \exp \left( - \frac { \omega ^ { 2 } \omega ^ { 2 } } { \omega ^ { 2 } } \right) - \sum _ { j = 1 } ^ { N } \exp \left( \frac { \omega ^ { 2 } \omega ^ { 2 } } { \omega ^ { 2 } } \right) \sin \omega } \\ & { - \displaystyle \frac { \hat { \gamma } } { \omega } \displaystyle \frac { \hat { \gamma } } { \omega } \frac { \hat { \gamma } } { \omega } \sin \omega \sum _ { i = 1 } ^ { N } \omega \exp \left( - \frac { \omega ^ { 2 } \omega ^ { 2 } } { \omega ^ { 2 } } \right) \sin \omega \Big [ \omega \sin \omega \omega \Big ] } \\ & { - \displaystyle \frac { \hat { \gamma } } { \omega } \displaystyle \frac { \hat { \gamma } } { \omega } \frac { \hat { \gamma } } { \omega } \frac { \hat { \gamma } } { \omega } \sin \omega \sum _ { j = 1 } ^ { N } \omega \omega \sum _ { i = 1 } ^ { N } \omega \frac { \hat { \gamma } } { \omega ^ { 2 } } \int _ { - \infty } ^ { \infty } d u \sin \omega \exp \left( - \frac { \omega ^ { 2 } \omega ^ { 2 } } { \omega ^ { 2 } } \right) \sin \omega } \\ & { - \displaystyle \sum _ { j = 1 } ^ { N } \int _ { - \infty } ^ { \infty } \int _ { - \infty } ^ { \infty } \int _ { 0 } ^ { \infty } u \exp \left( - \frac { \omega ^ { 2 } \omega ^ { 2 } } { \omega ^ { 2 } } \right) \exp \left( - \frac { \omega ^ { 2 } } { \omega ^ { 2 } } \right) \sin \omega } \\ & { - \displaystyle \frac { \hat { \gamma } } { \omega } \displaystyle \frac { \hat { \gamma } } { \omega } \frac { \hat { \gamma } } { \omega } \left( u \omega \times u \right) \sin \omega } \end{array}
240
+ $$
241
+
242
+ # B DERIVATION OF THE KL-DIVERGENCE BETWEEN AR(1) AND DIAGONAL GAUSSIAN, AND ITS LOWER-BOUND
243
+
244
+ $$
245
+ \begin{array} { r } { \mathbf { z } _ { i } \in \mathbb { R } ^ { d } , \mathbf { z } _ { 0 } \in \{ 0 \} ^ { d } \quad } \\ { p ( \mathbf { z } _ { 1 } ) = \mathcal { N } ( 0 , 1 ) \qquad } \\ { p ( \mathbf { z } _ { i } | \mathbf { z } _ { i - 1 } ) = \mathcal { N } ( \alpha \mathbf { z } _ { i - 1 } , \sqrt { 1 - \alpha ^ { 2 } } ) \quad i > 1 } \\ { q ( \mathbf { z } _ { i } | \mathbf { x } ) = \mathcal { N } ( \mu _ { i } ^ { \theta } ( \mathbf { x } ) , \sigma _ { i } ^ { \theta } ( \mathbf { x } ) ) \qquad } \end{array}
246
+ $$
247
+
248
+ Noting the analytic form for the KL-divergence for two uni-variate Gaussian distributions:
249
+
250
+ $$
251
+ D _ { \mathrm { K L } } ( \mathcal { N } ( \mu _ { q } , \sigma _ { q } ) \| \mathcal { N } ( \mu _ { p } , \sigma _ { p } ) ) = \frac { 1 } { 2 } [ \mathrm { l n } ( ( \frac { \sigma _ { p } } { \sigma _ { q } } ) ^ { 2 } ) + \frac { \sigma _ { q } ^ { 2 } + ( \mu _ { p } - \mu _ { q } ) ^ { 2 } } { \sigma _ { p } ^ { 2 } } - 1 ]
252
+ $$
253
+
254
+ we now derive the lower-bound for KL-divergence. To avoid clutter we assume a single dimension per timestep but extend the results to the general multivariate case at the end of this section.
255
+
256
+ $$
257
+ \begin{array} { l } { \displaystyle \mathcal { D } _ { \mathrm { K L } } \big ( q ( \mathbf { z } | \mathbf { x } ) \| p ( \mathbf { z } ) \big ) = \mathbb { E } _ { z _ { i - 1 } \sim q ( z _ { i - 1 } | \mathbf { x } ) } \big [ \displaystyle \sum _ { i = 1 } ^ { n } D _ { \mathrm { K L } } \big ( \mathcal { N } ( \mu _ { q _ { i } } , \sigma _ { q _ { i } } ) \| \mathcal { N } ( \mu _ { p _ { i } } , \sigma _ { p _ { i } } ) \big ) \big ] } \\ { \displaystyle \qquad = \frac { 1 } { 2 } \mathbb { E } _ { z _ { i - 1 } } \big [ - \ln ( \sigma _ { 1 } ^ { 2 } ) + \sigma _ { 1 } ^ { 2 } - 1 + \mu _ { 1 } ^ { 2 } + \displaystyle \sum _ { i = 2 } ^ { n } \ln ( \frac { 1 - \alpha ^ { 2 } } { \sigma _ { i } ^ { 2 } } ) + \frac { \sigma _ { i } ^ { 2 } } { 1 - \alpha ^ { 2 } } - 1 + \frac { \big ( \mu _ { i } - \alpha z _ { 1 } \big ) } { 1 - \alpha } } \\ { \displaystyle \qquad = \frac { 1 } { 2 } \big ( f _ { 1 } ( \sigma _ { 1 } ^ { 2 } ) + \mu _ { 1 } ^ { 2 } + \displaystyle \sum _ { i = 2 } ^ { n } f _ { 1 } ( \frac { \sigma _ { i } ^ { 2 } } { 1 - \alpha ^ { 2 } } ) + \frac { 1 } { 1 - \alpha ^ { 2 } } \mathbb { E } _ { z _ { i - 1 } } \big [ \big ( \mu _ { i } - \alpha z _ { i - 1 } \big ) ^ { 2 } \big ] \big ) } \end{array}
258
+ $$
259
+
260
+ Where $f _ { a } ( x ) = a x - l n ( x ) - 1$ . Using the fact that $\sigma _ { i } ^ { 2 } = \mathbb { E } [ ( \mathsf { z } _ { i } - \mu _ { i } ) ^ { 2 } ] = \mathbb { E } ( \mathsf { z } _ { i } ^ { 2 } ) - \mu _ { i } ^ { 2 }$ , the expectation inside the summation can be simplified as follows.
261
+
262
+ $$
263
+ \begin{array} { r l } { \mathbb { E } _ { \mathbf { z } _ { i - 1 } } [ ( \mu _ { i } - \alpha \mathbf { z } _ { i - 1 } ) ^ { 2 } ) ] ) = } & { } \\ & { = \mathbb { E } _ { \mathbf { z } _ { i - 1 } } [ \mu _ { i } ^ { 2 } - 2 \mu _ { i } \alpha \mathbf { z } _ { i - 1 } + \alpha ^ { 2 } \mathbf { z } _ { i - 1 } ^ { 2 } ] } \\ & { = \mu _ { i } ^ { 2 } - 2 \alpha \mu _ { i } \mathbb { E } _ { \mathbf { z } _ { i - 1 } } [ \mathbf { z } _ { i - 1 } ] + \alpha ^ { 2 } \mathbb { E } _ { \mathbf { z } _ { i - 1 } } [ \mathbf { z } _ { i - 1 } ^ { 2 } ] } \\ & { = \mu _ { i } ^ { 2 } - 2 \alpha \mu _ { i } \mu _ { i - 1 } + \alpha ^ { 2 } \sigma _ { i - 1 } ^ { 2 } + \alpha ^ { 2 } \mu _ { i - 1 } ^ { 2 } } \\ & { = ( \mu _ { i } - \alpha \mu _ { i - 1 } ) ^ { 2 } + \alpha ^ { 2 } \sigma _ { i - 1 } ^ { 2 } } \end{array}
264
+ $$
265
+
266
+ Plugging this back gives us the following analytic form for the KL-divergence for the sequential latent variable $\mathbf { z }$ .
267
+
268
+ $$
269
+ D _ { \mathrm { K L } } ( q ( \mathbf { z } | \mathbf { x } ) | | p ( \mathbf { z } ) ) = \frac { 1 } { 2 } ( f _ { 1 } ( \sigma _ { 1 } ^ { 2 } ) + \mu _ { 1 } ^ { 2 } + \sum _ { i = 2 } ^ { n } [ f _ { 1 } ( \frac { \sigma _ { i } ^ { 2 } } { 1 - \alpha ^ { 2 } } ) + \frac { ( \mu _ { i } - \alpha \mu _ { i - 1 } ) ^ { 2 } + \alpha ^ { 2 } \sigma _ { i - 1 } ^ { 2 } } { 1 - \alpha ^ { 2 } } ] )
270
+ $$
271
+
272
+ # C DERIVATION OF THE LOWER-BOUND
273
+
274
+ Removing non-negative quadratic terms involving $\mu _ { i }$ in equation 3 and expanding back $f$ inside the summation yields
275
+
276
+ $$
277
+ \begin{array} { l } { { \displaystyle { \cal D } _ { \mathrm { K L } } \big ( q ( { \bf z } | { \bf x } ) \| p ( { \bf z } ) \big ) \geq \frac { 1 } { 2 } \big ( f _ { 1 } ( \sigma _ { 1 } ^ { 2 } ) + \frac { \alpha ^ { 2 } \sigma _ { 1 } ^ { 2 } } { 1 - \alpha ^ { 2 } } + \sum _ { i = 2 } ^ { n - 1 } [ \frac { \sigma _ { i } ^ { 2 } ( 1 + \alpha ^ { 2 } ) } { 1 - \alpha ^ { 2 } } - \ln ( \frac { \sigma _ { i } ^ { 2 } } { 1 - \alpha ^ { 2 } } ) - 1 ] + f _ { 1 } ( \frac { \sigma _ { n } ^ { 2 } } { 1 - \alpha ^ { 2 } } ) \big ) } } \\ { { \displaystyle \qquad = \frac { 1 } { 2 } ( f _ { \frac { 1 } { 1 - \alpha ^ { 2 } } } ( \sigma _ { 1 } ^ { 2 } ) + \sum _ { i = 2 } ^ { n - 1 } f _ { 1 + \alpha ^ { 2 } } ( \frac { \sigma _ { i } ^ { 2 } } { 1 - \alpha ^ { 2 } } ) + f _ { 1 } ( \frac { \sigma _ { n } ^ { 2 } } { 1 - \alpha ^ { 2 } } ) ) } } \end{array}
278
+ $$
279
+
280
+ $f _ { a } ( x ) = a x - \ln ( x ) - 1$ and its first and second order d obtains its minimum value of tivat $\begin{array} { r } { f _ { a } ^ { \prime } ( x ) = a - \frac { 1 } { x } } \end{array}$ andting $f _ { a } ^ { \prime \prime } ( x ) \geq 0$ $f _ { a }$ $\ln ( a )$ $x = a ^ { - 1 }$ $\sigma _ { 1 } ^ { 2 } = 1 - \alpha ^ { 2 }$ , $\sigma _ { n } ^ { 2 } = 1 - \alpha ^ { 2 }$ and $\textstyle \sigma _ { i } ^ { 2 } = { \frac { 1 - \alpha ^ { 2 } } { 1 + \alpha ^ { 2 } } }$ yields the following lower-bound for the KL:
281
+
282
+ $$
283
+ D _ { \mathrm { K L } } ( q ( \mathbf { z } | \mathbf { x } ) \| p ( \mathbf { z } ) ) \geq { \frac { 1 } { 2 } } [ ( n - 2 ) \ln ( 1 + \alpha ^ { 2 } ) - \ln ( 1 - \alpha ^ { 2 } ) ]
284
+ $$
285
+
286
+ When using multi-dimensional $\mathbf { z } _ { i }$ at each timestep, the committed rate is the sum of the $\mathrm { K L }$ for each individual dimension:
287
+
288
+ $$
289
+ D _ { \mathrm { K L } } ( q ( \mathbf { z } | \mathbf { x } ) | | p ( \mathbf { z } ) ) \geq \frac { 1 } { 2 } [ \sum _ { k = 1 } ^ { D } ( n - 2 ) \ln ( 1 + \alpha _ { k } ^ { 2 } ) - \ln ( 1 - \alpha _ { k } ^ { 2 } ) ]
290
+ $$
291
+
292
+ # D INDEPENDENT $\delta$ -VAES
293
+
294
+ The most common choice for variational families is to assume that the components of the posterior are independent, for example using a multivariate Gaussian with a diagonal covariance: $q _ { \phi } ( \mathbf { z } | \mathbf { x } ) = \mathcal { N } ( \mathbf { z } ; \mu _ { q } ( \mathbf { x } ) , \sigma _ { q } ( \mathbf { x } ) )$ . When paired with a standard Gaussian prior, $p \bar { ( \mathbf { z } ) } = \mathcal { N } ( \mathbf { z } ; 0 , 1 )$ , we can guarantee a committed information rate $\delta$ by constraining the mean and variance of the variational family (see Appendix C)
295
+
296
+ $$
297
+ \mu _ { q } ^ { 2 } \ge 2 \delta + 1 + \ln ( \sigma _ { q } ^ { 2 } ) - \sigma _ { q } ^ { 2 }
298
+ $$
299
+
300
+ We can, thus, numerically solve
301
+
302
+ $$
303
+ \ln ( \sigma _ { q } ^ { 2 } ) - \sigma _ { q } ^ { 2 } + 2 r + 1 \ge 0
304
+ $$
305
+
306
+ to obtain the feasible interval $[ \sigma _ { q } ^ { l } , \sigma _ { q } ^ { u } ]$ where the above equation has a solution for $\mu _ { q }$ , and the committed rate $\delta$ . Posterior parameters can thus be parameterised as:
307
+
308
+ $$
309
+ \begin{array} { l } { { \displaystyle { \sigma _ { q } = \sigma _ { q } ^ { l } + ( \sigma _ { q } ^ { u } - \sigma _ { q } ^ { l } ) \frac { 1 } { 1 + e ^ { - \sigma _ { \phi } ( x ) } } } } } \\ { { \displaystyle { \mu _ { q } = 2 \delta + 1 + \ln ( \sigma _ { q } ^ { 2 } ) - \sigma _ { q } ^ { 2 } + \operatorname* { m a x } ( 0 , \mu _ { \phi } ( { \bf x } ) ) } } } \end{array}
310
+ $$
311
+
312
+ Where $\phi$ parameterises the data-dependent part of $\mu _ { q }$ ad $\sigma _ { q }$ , which allow the rate to go above the designated lower-bound $\delta$ .
313
+
314
+ We compare this model with the temporal version of $\delta$ -VAE discussed in the paper and report the results in Table 3. While independent $\delta$ -VAE also prevents the posterior from collapsing to prior, its performance in density modeling lags behind temporal $\delta$ -VAE.
315
+
316
+ <table><tr><td>Method</td><td>Test ELBO (KL)</td><td>Accuracy</td></tr><tr><td>Independent δ-VAE (δ = 0.08)</td><td>3.08 (0.08)</td><td>66%</td></tr><tr><td>Temporal δ-VAE (δ = 0.08)</td><td>3.02 (0.09)</td><td>65%</td></tr></table>
317
+
318
+ Table 3: Comparison of independent Gaussian delta-VAE and temporal delta-VAE with AR(1) prior on CIFAR-10 both targeting the same rate. While both models achieve a KL around the target rate and perform similarly in the downstream linear classification task, the temporal model with AR(1) prior achieves significantly better marginal likelihood.
319
+
320
+ # E ARCHITECTURE DETAILS
321
+
322
+ # E.1 IMAGE MODELS
323
+
324
+ In this section we provide the details of our architecture used in our experiments. The overall architecture diagram is depicted in Fig. 5. To establish the anti-causal context for the inference network we first reverse the input image and pad each spatial dimension by one before feeding it to the encoder. The output of the encoder is cropped and reversed again. As show in Fig. 5, this gives each pixel the anti-causal context (i.e., pooling information from its own value and future values). We then apply average pooling to this representation to give us row-wise latent variables, on which the decoder network is conditioned.
325
+
326
+ ![](images/d9ac3eb72cff0ab1952145c446d9c81ab402f04283b477e56ee5561a2cd312f5.jpg)
327
+ Figure 5: Architecture for images
328
+
329
+ The exact hyper-parameters of our network is detailed in Table 4. We used dropout only in our decoder and applied it the activations of the hidden units as well as the attention matrix. As in (Vaswani et al., 2017), we used rectified linear units and layer normalization (Ba et al., 2016) after the multi-head attention layers. We found layer normalization to be essential for stabilizing training. We trained with the Adam optimizer (Kingma & Ba, 2014) and used the learning rate schedule proposed in (Vaswani et al., 2017) with a few tweaks as in the following formulae:
330
+
331
+ $$
332
+ \begin{array} { r l r } { L R _ { i m a g e N e t } } & { = 0 . 1 8 \times h _ { d } ^ { - 0 . 5 } \operatorname* { m i n } ( s t e p . n u m ^ { 0 . 3 5 } , s t e p . n u m \times 4 0 0 ^ { 0 . 5 } ) } & \\ { L R _ { c i f a r 1 0 } } & { = 0 . 3 6 \times h _ { d } ^ { - 0 . 5 } \operatorname* { m i n } ( s t e p . n u m ^ { 0 . 3 5 } , s t e p . n u m \times 8 0 0 0 ^ { 1 . 5 } ) } & \\ { L R _ { a b l a t i o n } } & { = 0 . 0 0 0 1 } & \end{array}
333
+ $$
334
+
335
+ We use multi-dimensional latent variables per each timestep, with different slowness factors linearly spaced between a chosen interval. For our ablation studies, we chose corresponding hyperparameters of each method we compare against to target rates between 25-100 bits per image.
336
+
337
+ <table><tr><td></td><td>le/ld</td><td>he/hd/haux</td><td>re/rd</td><td>ae/ad</td><td>ah</td><td>ndmol</td><td>dod</td><td>2</td><td>a</td></tr><tr><td>Best Imagenet</td><td>6/20</td><td>128/512/1024</td><td>1024/2048</td><td>2/5</td><td>8</td><td>32</td><td>0.3</td><td>16</td><td>[0.5, 0.95]</td></tr><tr><td>CIFAR-10</td><td>20/30</td><td>128/256/1024</td><td>1024/1024</td><td>11/16</td><td>8</td><td>32</td><td>0.5</td><td>8</td><td>[0.3,0.99]</td></tr><tr><td>Ablations</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>[0.5,</td></tr><tr><td>CIFAR-10</td><td>8/8</td><td>128/128/1024</td><td>1024/1024</td><td>2/2</td><td>2</td><td>32</td><td>0.2</td><td>32</td><td>0.68-0.99]</td></tr></table>
338
+
339
+ Table 4: Hyperparameter values for the models used for experiments. The subscripts $e$ , $d .$ , aux respectively denote the encoder, the decoder, and the LSTM auxiliary prior. $l$ is the number of layers, $h$ is the hidden size of each layer, $r$ is the size of the residual filter, $a$ is the number of attention layers interspersed with gated convolution layers of PixelCNN, $n _ { d m o l }$ is the number of components in the discrete mixture of logistics distribution, $d o _ { d }$ is the probability of dropout applied to the decoder, $z$ is the dimensionality of the latent variable used for each row, and the alpha column gives the range of the AR(1) prior hyper-parameter for each latent.
340
+
341
+ We developed our code using Tensorflow (Abadi et al., 2016). Our experiments on natural images were conducted on Google Cloud TPU accelerators. For ImageNet, we used 128 TPU cores with batch size of 1024. We used 8 TPU cores for CIFAR-10 with batch size of 64.
342
+
343
+ # E.2 TEXT MODELS
344
+
345
+ The architecture of our model for text experiment is closely based on the Transformer network of Vaswani et al. (2017). We realize the encoder anti-causal structure by inverting the causal attention masks to upper triangular bias matrices. The exact hyper-parameters are summarized in Table 5.
346
+
347
+ $$
348
+ \frac { | \mathit { l } \mathit { \Delta } | } { \mathrm { L M l B } \ | \ 4 \quad 5 1 2 \quad 2 0 4 8 \quad 8 \quad 0 . 1 \quad 2 \quad [ 0 . 2 , 0 . 4 ] }
349
+ $$
350
+
351
+ Table 5: Hyperparameter values for our LM1B experiments. $l$ is the number of layers, $h$ is the hidden size of each layer, $r$ is the size of the residual filters, do is the probability of dropout, $z$ is the dimensionality of the latent variable, and the alpha column gives the range of the AR(1) prior hyper-parameter for each latent dimension.
352
+
353
+ # F ABLATION STUDIES
354
+
355
+ For our ablation studies on CIFAR-10, we trained our model with the configuration listed in Table 4. After training the model, we inferred the mean of the posterior distribution corresponding to each training example in the CIFAR-10 test set, and subsequently trained a multi-class logistic regression classifier on top of it. For each model, the linear classifier was optimized for 100 epochs using the Adam optimizer with the starting learning rate of 0.003. The learning rate was decayed by a factor of 0.3 every 30 epochs.
356
+
357
+ We also report the rate-distortion curves for the CIFAR-10 training set in Fig. 6. In contrast to the graph of Fig. 4a for the test set, $\delta$ -VAE achieves relatively higher negative log-likelihood on the training set compared to other methods, especially for larger rates. This suggests that $\delta$ -VAE is less prone to overfitting compared to $\beta$ -VAE and free-bits.
358
+
359
+ ![](images/71e38d7855d8c1501cf4144a5362be1e10438aff96ece5ada6013e45b01cbc66.jpg)
360
+ Figure 6: Rate-Distortion for CIFAR-10 training set.
361
+
362
+ # F.1 ENCODER ABLATION
363
+
364
+ In table Table 6, we report the details of evaluating our proposed anti-causal encoder architecture (discussed in Sect. 2.2) against the non-causal architecture in which there is no restriction on the connectivity of the encoder network. The reported experiments are conducted on the CIFAR-10 dataset. We trained 4 different configurations of our model to provide comparison in different capacity and information rate regimes, using the temporal $\delta$ -VAE approach to prevent posterior collapse. We found that the anti-causal structure is beneficial when the decoder has sufficiently large receptive field, and also when encoding relatively high amount of information in latent variables.
365
+
366
+ Table 6: Ablation of anti-causal vs. non-causal structure. $l$ : number of layers, $h$ : hidden size, $a$ : number of attention layers. Subscripts $e$ and $d$ respectively denote encoder and decoder sizes when they were different. The low-rate (high-rate) models had latent dimension of 8 (64) with alpha linearly placed in [0.5, 0.95] ([0.5, 0.99]) which gives the total rate of 79.44 (666.6) bits per image.
367
+
368
+ <table><tr><td rowspan=2 colspan=1></td><td rowspan=1 colspan=1>1=6h=128</td><td rowspan=1 colspan=1>1=8h=128</td><td rowspan=1 colspan=1>1=8h=128</td><td rowspan=2 colspan=1>le = 20,he =128ld = 30,hd = 256a=6low-rate</td></tr><tr><td rowspan=1 colspan=1>a=0low-rate</td><td rowspan=1 colspan=1>a=2low-rate</td><td rowspan=1 colspan=1>a=2high-rate</td></tr><tr><td rowspan=1 colspan=1>Non-Causal AR(1)Non-Causal Aux</td><td rowspan=1 colspan=1>3.04 (0.02)3.03 (0.01)</td><td rowspan=1 colspan=1>3.01 (0.03)2.98 (0.004)</td><td rowspan=1 colspan=1>3.32 (0.22)3.11 (0.02)</td><td rowspan=1 colspan=1>2.88 (0.05)2.85 (0.01)</td></tr><tr><td rowspan=1 colspan=1>Anti-Causal AR(1)Anti-Causal Aux</td><td rowspan=1 colspan=1>3.07 (0.02)3.06 (0.01)</td><td rowspan=1 colspan=1>3.01 (0.03)2.98 (0.006)</td><td rowspan=1 colspan=1>3.22 (0.22)3.03 (0.03)</td><td rowspan=1 colspan=1>2.87 (0.05)2.84 (0.02)</td></tr></table>
369
+
370
+ # G VISUALIZATION OF THE LATENT SPACE
371
+
372
+ It is generally expected that images from the same class are mapped to the same region of the latent space. Fig. 7 illustrates the t-SNE (van der Maaten & Hinton, 2008) plot of latent variables inferred from 3000 examples from the test set of CIFAR-10 colour coded based on class labels. As can also be seen on the right hand plot, classes that are closest are also mostly the one that have close semantic and often visual relationships (e.g., cat and dog, or deer and horse).
373
+
374
+ H ADDITIONAL SAMPLES
375
+
376
+ ![](images/fe417643a99a0ceda3e0b4be6a03a883620491ab77a54003ab692a9eb399ee73.jpg)
377
+ Figure 7: t-SNE plot of the posterior mean for 3000 CIFAR-10 images. Note the adjacent groups and mixed regions of the plot: cats and dogs images are mostly interspersed as are automobiles and trucks.The highest concentration of horses are on top of the region right above where deer examples are.
378
+
379
+ ![](images/5348af1b07de5fc5b3a7891e6ad85c035a314d13a82705329e080025fec46b58.jpg)
380
+ Figure 8: Additional ImageNet samples. Top left: Each column is interpolation in the latent space. Top right: ”Day dream” samples where we alternate between sampling $\bar { \mathbf { x } } \sim p ( \mathbf { x } | \mathbf { z } )$ and $\mathbf { z } \sim q ( \mathbf { z } | \mathbf { x } )$ . Bottom left: Each half-column contains in order an original image from the validation set, occlusion of that image, and two reconstructions from different posterior samples. Bottom right: Each halfcolumn contains in order an original image from the validation set, followed by 3 reconstructions from different posterior samples.
381
+
382
+ ![](images/94d032f1c3325469b78beccc19909bac153bf0ccb50777b626fcea67e63afe26.jpg)
383
+ Figure 9: Additional CIFAR-10 samples. Top left: Each column is interpolation in the latent space. Top right: ”Day dream” samples where we alternate between sampling $\bar { \mathbf { x } } \sim p ( \mathbf { x } | \mathbf { z } )$ and $\mathbf { z } \sim q ( \mathbf { z } | \mathbf { x } )$ . Bottom left: Each half-column contains in order an original image from the test set, occlusion of that image, and two reconstructions from different posterior samples. Bottom right: Each half-column contains in order an original image from the test set, followed by 3 reconstructions from different posterior samples.
384
+
385
+ ![](images/5ecd201862786c6ad281b48bb97cdce0067c60d5498fe11249b820472fae4d40.jpg)
386
+ Figure 10: Random samples from the auxiliary (left) and AR(1) (right) priors of our high-rate (top) and low-rate(bottom) CIFAR-10 models. The high-rate (low-rate) model has -ELBO of 2.90 (2.83) and KL of 0.10 (0.01) bits/dim. Notice that in the high rate model that has a larger value of $\alpha$ , samples from the AR(1) prior can turn out too smooth compared to natural images. This is because of the gap between the prior and the marginal posterior, which is closed by the auxiliary prior.
387
+
388
+ ![](images/d90b7a61554fabf3756a2bec321b3c2fe76175f5e55b88f9e4c4a34dcb64b3f6.jpg)
389
+ Figure 11: Additional unconditional random samples from Imagenet $3 2 \mathbf { x } 3 2$ . Each half-column in each block contains 4 decodings of the same sample $\mathbf { z } \sim p _ { a u x } ( \mathbf { z } )$
390
+
391
+ ![](images/dbb386a2b44f233f01291f7e774e9642b0cef23096f96e8aa5fc53bec1fe62c8.jpg)
392
+ Figure 12: One at a time interpolation of latent dimensions of a sample from the AR(1) prior. The sentences of each segment are generated by sampling a 32 element sequence of 2D random vectors from the autoregressive prior, fixing one dimension interpolating the other dimension linearly between $\mu \pm 3 \sigma$ .
393
+
394
+ ![](images/96d9addc22e60e168ff5d1e7958bdff93343f2a45d2e61040a28536d05f6e151.jpg)
395
+ Figure 13: One at a time interpolation of latent dimensions of a sample from the auxiliary prior. The generation procedure is identical to Fig. 12 with the exception that the initial vector is sampled from the auxiliary prior.
396
+
397
+ ![](images/e5338177f56634b35fb001fd21122b31e3d521eb39f8ac0e56250f18ec418ac2.jpg)
398
+ Figure 14: Text completion samples. For each sentence we prime the decoder with a fragment of a random sample from the validation set (shown in bold), and condition the decoder on interpolations between two samples from the latent space.
md/train/BJeGZxrFvS/BJeGZxrFvS.md ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A SIMPLE TECHNIQUE TO ENABLE SALIENCY METHODS TO PASS THE SANITY CHECKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Saliency methods attempt to explain a deep net’s decision by assigning a score to each feature/pixel in the input, often doing this credit-assignment via the gradient of the output with respect to input. Recently Adebayo et al. (2018) questioned the validity of many of these methods since they do not pass simple sanity checks, which test whether the scores shift/vanish when layers of the trained net are randomized, or when the net is retrained using random labels for inputs.
8
+
9
+ We propose a simple fix to existing saliency methods that helps them pass sanity checks, which we call competition for pixels. This involves computing saliency maps for all possible labels in the classification task, and using a simple competition among them to identify and remove less relevant pixels from the map. Section 3 provides a theoretical justification to support our method and indicates when it can be applied, and its performance is empirically demonstrated on several popular methods.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Saliency methods attempt to explain a deep net’s decision to humans by assigning a score to each feature/pixel in the input, often doing this credit-assignment via the gradient of the output with respect to input (from now on refered to as just “gradient”). Here we are interested in tasks involving multiclass classification, and for simplicity the exposition will assume the input is an image. Then a saliency method assigns scores to input pixels, which are presented as a heat map. (Extensions of these ideas to higher-level features of the net will not be discussed here.)
14
+
15
+ While gradient alone is often too noisy, it as well as related notions are the basis of other more successful methods. In Gradient $\odot$ Input (Shrikumar et al., 2017) the pixel score is the product of the corresponding coordinate of gradient vector with the pixel value. Layer-wise Relevance Propagation (LRP) (Bach et al., 2015) uses a back-propagation technique where every node in the deep net receives a share of the output which it distributes to nodes below it. This happens all the way to the input layer, whereby every pixel gets assigned a share of the output, which is its score. Another rule Deep-Lift (Shrikumar et al., 2016) does this in a different way and is related to Shapley values of cooperative game theory. DASP Ancona et al. (2019) is a state of the art method that performs an efficient approximation of the Shapley values. The perceived limitations of these methods in turn motivated a long list of new ones. Montavon et al. (2018) provides a survey of existing methods, and brief discussion is presented in Section 2.
16
+
17
+ The focus of the current paper is an evaluation of saliency methods called sanity checks in Adebayo et al. (2018). This involves randomizing the model parameters or the data labels (see Section 2 for details). The authors show that maps produced using corrupted parameters and data are often difficult to visually distinguish from those produced using the original parameters and data. The authors concluded that “...widely deployed saliency methods are independent of both the data the model was trained on, and the model parameters.”
18
+
19
+ The current paper shows how to pass sanity checks via a simple modification to existing methods: Competition for pixels. Section 3 motivates this idea by pointing out a significant issue with previous methods: they produce saliency maps for a chosen output (label) node using gradient information only for that node while ignoring the gradient information from the other (non-chosen) outputs. To incorporate information from non-chosen labels/outputs in the multiclass setting we rely on an axiom called completeness satisfied by many saliency methods, according to which the sum of pixel scores in a map is equal to the value of the chosen node (see Section 3). Existing methods design saliency maps for all outputs and the map for each label satisfies completeness. One can then view the various scores assigned to a single pixel as its “votes” for different labels. The competition idea is roughly to zero out any pixel whose vote for the chosen label was lower than for another (nonchosen) label. Section 4 develops theory to explain why this modification helps pass sanity checks in the multi-class setting, and yet produces maps not too different from existing saliency maps. It also introduces a notion called approximate completeness and suggests that it is both a reasonable alternative to completeness in practice, and also allows our analysis of the competition idea to go through. We the present an new empirical finding that saliency methods that were not designed to satisfy completeness in practice seem to satisfy approximate completeness anyway. This may be relevant for future research in this area.
20
+
21
+ Section 5 reports experiments applying the competition idea to three well-regarded methods, Gradient $\odot$ Input, LRP, and DASP, and shows that they produce sensible saliency maps while also passing the sanity checks. List of testbeds and methods is largely borrowed from Adebayo et al. (2018), except for inclusion of DASP, which draws inspiration from cooperative game theory.
22
+
23
+ # 2 RELATED WORK
24
+
25
+ Adebayo et al. (2018) and Montavon et al. (2018) provide surveys of saliency methods. Brief descriptions of some methods used in our experiments appear in Appendix Section 7.1. Here we briefly discuss the issue most relevant to the current paper, which is the interplay between tests/evaluations of saliency methods and principled design of new methods.
26
+
27
+ Controversies here often boil down to interpretations of the word “saliency,” which method designers have sought to codify via axioms. (Completeness is a simple example.) Evaluations then suggest that the axioms fail to ensure other desirable properties. To give an example, does the map change significantly if we blank out or modify a portion of the image that humans find insignificant, as depicted in Kim et al. (2019) ? But in such cases it is sometimes unclear if the failure is due to the method alone, or traces to other unsolved issues in deep learning related to distribution shift, domain adaptation, adversarial examples, etc.
28
+
29
+ ROAR evaluation Hooker et al. (2018) greys out pixels/features found informative by a saliency method, and retrains the classifier on these modified inputs. The method is considered low quality if the accuracy drop is less than greying out the same fraction of randomly-chosen pixels. Many popular methods (including some tested here) do poorly on this, and a subset of ensemble methods outperform a random assignment of saliency scores. But clearly this evaluation is using a different definition of saliency than the axiomatic approaches. The axiomatic approaches seek to find a set of pixels that are sufficient to justify the output label. Since real-life images have high redundancy, multiple sets of pixels could be sufficient to justify the label. ROAR defines the goal as identifying every pixel that is potentially relevant, and then ensembling would clearly help. (To see this, imagine taking any dataset and duplicating each feature $k$ times.)
30
+
31
+ The current paper sidesteps some of these controversies by focusing solely on the sanity checks evaluation of Adebayo et al. (2018), and their exact testbed and framework. At first sight the problems uncovered by the sanity checks appear quite serious. While the distribution-shift based evaluations were asking “Does the map shift too much upon changes to the input that humans find insignificant?,” the sanity checks asks the simpler question “Does the map fail to shift when the model/labels are dramatically changed to become nonsensical?” So it is surprising that most methods already failed the following sanity checks (the authors suggest there could be others).
32
+
33
+ The model parameter randomization test. According to the authors, this “compares the output of a saliency method on a trained model with the output of the saliency method on a randomly initialized untrained network of the same architecture.” The saliency method fails if the maps are similar for trained models and randomized models. The randomization can be done in a cascading or layerwise fashion.
34
+
35
+ The data randomization test “compares a given saliency method applied to a model trained on a labeled data set with the method applied to the same model architecture but trained on a copy of the data set in which we randomly permuted all labels.” Clearly the model in the second case has learnt no useful relationship between the data and the labels and does not generalize. The saliency method fails if the maps are similar in the two cases on test data.
36
+
37
+ To the best of our knowledge, no subsequent paper has designed reasonable saliency methods that pass the sanity checks.
38
+
39
+ # 3 ADDING COMPETITION
40
+
41
+ The idea of competition suggests itself naturally when one examines saliency maps produced using all possible labels/logits in a multiclass problem, rather than just the chosen label. Figure 1 shows some Gradient Input maps produced using AlexNet trained on MNIST, where the first layer was modified to accept one color channel instead of 3. Notice: Many pixels found irrelevant by humans receive heat (i.e., positive value) in all the maps, and many relevant pixels receive heat in more than one map. Our experiments showed similar phenomenon on more complicated datasets such as ImageNet. Figure 1 highlights an important point of Adebayo et al. (2018), which is that many saliency maps pick up a lot of information about the input itself —e.g., presence of sharp edges– that may be incidental to the final classification. Furthermore, these incidental features can survive during the various randomization checks, leading to failure in the sanity check. Thus it is a natural idea to create a saliency map by combining information from all labels, in the process filtering out or downgrading the importance of incidental features.
42
+
43
+ Suppose the input is $x$ and the net is solving a $k$ -way classification. We assume a standard softmax output layer whose inputs are $k$ logits, one per label. Let $x$ be an input, $y$ be its label and $\ell _ { y }$ denote the corresponding logit.
44
+
45
+ ![](images/1dd69aefbeb6d56d9a33679314a45fe7da52cd37c9dd901cf73cf09478a61cad.jpg)
46
+ Figure 1: Heatmap of Gradient $\odot$ Input saliency maps produced by various logits of a deep net trained on MNIST. Red denotes pixels with positive values and Blue denotes negative values. The input image is of the number 3 , which is clearly visible in all maps. Note how maps computed using logits/labels ”7” and ” 5” assign red color (resp., blue color) to pixels that would have been expected to be present (resp., absent) in those digits. The last figure shows the map produced using our CGI method.
47
+
48
+ Usually prior methods do not combine information from maps from different labels, but we wish to do so to design a simple competition among labels for pixels. A priori it can be unclear how to compare scores across labels, since this could end up being an “apples vs oranges” comparison due to potentially different scaling. However, prior work Sundararajan et al. (2017) has identified a property called completeness: this requires that the sum of the pixel scores is exactly the logit value. For example, Gradient $\odot$ Input satisfies completeness exactly for ReLU nets with zero bias1. (Recall that the ReLU function with bias $a$ is $R e L U ( z , a ) \operatorname* { m a x } \{ z - a , 0 \}$ . ) Ensuring completeness for nonzero bias requires more computationally expensive operations.
49
+
50
+ Enter competition. Completeness (and also approximate completeness, a property explained below in Section 4.1) allows an apples-to-apples comparison of saliency scores from different labels, and to view them as “votes” for a label. Now consider the case where $y$ is the label predicted by the net for input $x$ . Suppose pixel $i$ has a positive score for label $y$ and an even more positive score for label $y _ { 1 }$ . This pixel contributes positively to both logit values. But remember that since label $y _ { 1 }$ was not predicted by the net as the label, the logit $\ell _ { y _ { 1 } }$ is less than than logit $\ell _ { y }$ , so the contribution of pixel $x _ { i }$ ’s “vote” to $\ell _ { y 1 }$ is proportionately even higher than its contribution to $\ell _ { y }$ . This perhaps should make us realize that this pixel may be less relevant or even irrelevant to label $y$ since it is effectively siding with label $y _ { 1 }$ (recall Figure 1). We conclude that looking at saliency maps for non-chosen labels should allow us to fine-tune our estimate of the relevance of a pixel to the chosen label.
51
+
52
+ Now we formalize the competition idea. Note that positive and negative pixel scores should in general be interpreted differently; the former should be viewed as supporting the chosen label, and the latter as opposing that label.
53
+
54
+ # Competitive version of saliency method
55
+
56
+ Input $:$ An image, $I$ , an underlying saliency method, $S _ { u }$ and some chosen label $y$ Output : A saliency map $S$ of same dimensions as the input, $I$
57
+
58
+ For each pixel $p _ { i }$ in the input
59
+
60
+ 1. Calculate the saliency scores assigned by each label to pixel $p _ { i }$ by $S _ { u }$
61
+
62
+ 2. Zero out pixel $p _ { i }$ in the saliency map $S$ if either
63
+
64
+ (a) $p _ { i }$ has a positive saliency score for label $y$ that is not maximal among its saliency scores for all labels
65
+ (b) $p _ { i }$ has a negative saliency score for label $y$ that is not minimal among its saliency scores for all labels
66
+
67
+ # 4 WHY COMPETITION WORKS: SOME THEORY
68
+
69
+ Figure 1 suggests that it is a good idea to zero out some pixels in existing saliency maps, as the existing saliency maps are reflecting information incidental to classification, such as edges. Here we develop a more principled understanding of why adding competition (a) is aggressive enough to zero out enough pixels to help pass sanity checks on randomized nets and (b) not too aggressive so as to retain a reasonable saliency map for properly trained nets.
70
+
71
+ Adebayo et al. (2018) used linear models to explain why methods like Gradient $\odot$ Input fail their randomization tests. These tests turn the gradient into a random vector, and if $\xi _ { 1 } , \xi _ { 2 }$ are random vectors, then $x \odot \xi _ { 1 }$ and $x \odot \xi _ { 2 }$ are visually quite similar when $x$ is an image. (See Figure 10 in their appendix.) Thus the saliency map retains a strong sense of $x$ after the randomization test, even though the gradient is essentially random. Now it is immediately clear that with $k$ -way competition among the labels, the saliency map would be expected to become almost blank in the randomization tests since each pixel is equally likely to receive its highest score from each label, and thus in each saliency map the pixel becomes zero with probability $\mathrm { ~ \bar { 1 } - 1 / } k$ . Thus we would expect that adding competition enables the map to pass the sanity checks in multiclass settings, even for relatively small number of classes. Our experiments later show that the final map is indeed very sparse.
72
+
73
+ But one cannot use the simple (Adebayo et al., 2018) model to understand why competition yields a reasonable saliency map for properly trained nets. The reason being that the saliency map is not random and depends on the input —since completeness property requires that the sum of pixel saliencies is the label logit. We give a simple model for thinking about this dependence, which we hope will motivate further theory on the best way to aggregate information from different labels. We rely upon the completeness property, although Section 4.1 shows that a weaker property should suffice.
74
+
75
+ ![](images/d19ef59606abc84a636b3990d583b5308a63adefc4693c596dcd5b18b0de4d5b.jpg)
76
+ Figure 2: Histogram of Gradient $\odot$ Input scores for VGG-19 on Imagenet versus scores produced by mixture of two gaussians.
77
+
78
+ Mental model for saliency maps. One should keep in mind that a saliency map is the outcome of a stochastic process: training a deep net, with stochasticity coming from dataset choice, random initialization, and SGD. Let $\ell _ { y }$ and $\mu _ { x , y }$ be random variables denoting respectively the logit value for label $y$ on input $x$ and the corresponding saliency map.
79
+
80
+ For simplicity we assume the saliency method correlates with a certain ground truth saliency as follows. There exists a subset $S _ { x , y }$ of pixels (e.g., the pixels of $x$ that a human may find salient for label $y$ ) such that for each pixel in $S _ { x , y }$ the corresponding coordinate of $\mu _ { x , y }$ is distributed as $\mathcal { N } ( c , \sigma _ { 1 } ^ { 2 } )$ and each pixel in $\overline { { S _ { x , y } } }$ is distributed as $N ( 0 , \sigma _ { 2 } ^ { 2 } )$ where $c = c ( x , y )$ and $\sigma _ { 1 } , \sigma _ { 2 }$ are constants.
81
+
82
+ This modeling assumption — “noisy signal” mixed with “white noise”—makes intuitive sense and has some experimental support; see Figure 2 where distribution of saliency scores does seem similar to mixture of two Gaussians (maybe three?), one centered at zero and other at some positive value. One could consider variants of our model, e.g., allowing means and variances to differ across pixels so the maps can include certain image portions (e.g., sharp edges) with very high probability. These don’t qualitatively affect the phenomena discussed below.
83
+
84
+ Now $\mu _ { x , y } \cdot \overline { { 1 } }$ is the sum of pixel saliencies (where $\overline { { 1 } }$ is the all-1’s vector), which by completeness, is $\ell _ { y }$ . By linearity of expectation $E [ \ell _ { y } ] = c \cdot | S _ { x , y } |$ . By measure concentration, with probability at least $1 - \exp ( - t ^ { 2 } / 4 )$ we have
85
+
86
+ $$
87
+ | \ell _ { y } - c \cdot | S _ { x , y } | | \leq t \left( \sigma _ { 1 } \sqrt { | S _ { x , y } | } + \sigma _ { 2 } \sqrt { | \overline { { S } } _ { x , y } | } \right) .
88
+ $$
89
+
90
+ Since the sets are fairly large (say, reasonable fraction of all pixels), this concentration should be good2.
91
+
92
+ After applying competition, the saliency map changes to $\mu _ { x , y } \odot \mathcal { T } _ { x , y }$ where $\mathcal { T } _ { x , y }$ is the vector with 1 in coordinates where label $y$ wins the competition for pixels, and 0 elsewhere. Now we note various plausible conditions under which $\mu _ { x , y } \otimes \mathcal { T } _ { x , y }$ can be seen as a reasonable approximation to $\mu _ { x , y }$ . For simplicity we consider how well competition preserves completeness, though obviously other properties can be analysed.
93
+
94
+ Theorem 1 (Informal meta-theorem) For many plausible conditions on the $S _ { x , y }$ ’s there is a scale factor $\gamma > 0$ (depending on the conditions) such that the vector $\gamma \mu _ { x , y } \odot \mathcal { T } _ { x , y }$ satisfies completeness up to a small additive error.
95
+
96
+ Proof (sketch) One uses measure concentration. As an illustrative example suppose $S _ { x , y }$ ’s are disjoint for different $y$ ’s. For each coordinate in $S _ { x , y }$ there is a certain probability $p = p ( c , \sigma _ { 1 } , \sigma _ { 2 } )$ that the coordinate is nonzero in $\mathcal { T } _ { x , y }$ . Thus the expected sum of coordinates in the map $\mu _ { x , y } \odot \mathcal { T } _ { x , y }$ is $p | S _ { x , y } |$ , and so rescaling coordinates by $c / p$ makes them satisfy completeness, up to an additive error given by measure concentration. Qualitatively similar results are obtained when $S _ { x , y }$ ’s are not disjoint but for $S _ { x , y } \cap \cup _ { y ^ { \prime } \neq y } S _ { x , y }$ is small compared to $S _ { x , y }$ .
97
+
98
+ Remarks:(1) Obviously, the additive error will have smaller impact for the larger logit values than for smaller ones. (2) The above proof suggests that adding competition is akin to sampling a subset of the salient pixels. At least for image data, where pixel-level information has a lot of redundancy, the essence of the original map survives, as seen in the experiments later.
99
+
100
+ # 4.1 APPROXIMATE COMPLETENESS
101
+
102
+ While some methods satisfy completeness by design (Bach et al., 2015), others don’t. Can our theory apply to the latter class of methods? While an exhaustive study was not performed, randomly sampling a few methods suggests that the saliency maps Ancona et al. (2019) (Shrikumar et al., 2017) in practice satisfy approximate completeness anyway (theory is of course lacking), in sense of the following definition. Figure 3 depicts two saliency methods satisfying approximate completeness.
103
+
104
+ ![](images/945247dae4de73633dd802dde9d68f3b8008154c377587632412933b25a56ffc.jpg)
105
+ Figure 3: Approximate completeness property of some saliency methods on VGG19, illustrated by near-linear fit of (a) Gradient $\odot$ Input on ReLU nets with nonzero bias (b) DASP.
106
+
107
+ ![](images/c6dcb84b87abcab0da81c736611f7d5f57ee007bf052173e3e78e41125b2f9aa.jpg)
108
+ Figure 4: Comparison of CGI saliency maps with Gradient $\odot$ Input saliency maps. Original images are shown on the left.
109
+
110
+ Definition 2 (Approximate completeness) A saliency method satisfies $( \alpha , \beta )$ -approximate completeness if sum of the pixel saliencies for label y lies in the interval $\left[ \alpha \ell _ { y } - \beta , \alpha \ell _ { y } + \beta \right]$ .
111
+
112
+ Theorem 3 (Modified meta theorem) If a saliency method satisfies $( \alpha , \beta )$ -approximate completeness, then under various plausible conditions on the $S _ { x , y }$ ’s similar to Theorem $I$ there are constants $( \alpha ^ { \prime } , \beta ^ { \prime } )$ such that after applying competition the maps satisfy $( \alpha ^ { \prime } , \beta ^ { \prime } )$ -approximate completeness.
113
+
114
+ # 5 EXPERIMENTS
115
+
116
+ We consider saliency methods Gradient $\odot$ Input, LRP, and DASP, and adding competition to them to get methods CGI, CLRP, and CDASP, respectively. CGI is tested using VGG-19 architecture Simonyan & Zisserman (2015) trained on ImageNet Russakovsky et al. (2015); LRP using VGG-16 architecture with Imagenet; DASP using a CNN model on MNIST. While these architectures are not the most powerful ones around, this is not a limitation for testing saliency methods, which are supposed to work for all architectures.
117
+
118
+ # 5.1 VISUAL QUALITY OF MAPS
119
+
120
+ Figure 4 shows underlying saliency maps versus maps with our modifications for VGG-19 on Imagenet. Applying competition does not visibly degrade the map. Some more examples (labeled “original”) also appear in Figure 5.
121
+
122
+ # 5.2 PARAMETER RANDOMIZATION TEST
123
+
124
+ The goal of these experiments is to determine whether our modification may be applied to an underlying saliency method to pass the first sanity check in Adebayo et al. (2018). We conduct cascading and layerwise randomization as described in Adebayo et al. (2018) from top to bottom.
125
+
126
+ • The top figure in Figure 5 shows the results of layerwise randomization on Gradient $\odot$ Input. (Figure 8 in the Appendix shows the full figure ).The text underneath each image represents which layer of the model was randomized, with the leftmost label of ’original’ representing the original saliency map of the fully trained model. The top panel shows the saliency maps produced by CGI , and the bottom panel the maps produces by Gradient $\odot$ Input. We find that the Gradient $\odot$ Input method displays the bird no matter which layer is randomized, and that our method immediately stops revealing the structure of the bird in the saliency maps as soon as any layer is randomized. Figure 10 in the Appendix shows a similar result but utilizing absolute value visualization. Notice that CGI’s sensitivity to model parameters still holds.
127
+
128
+ • The second figure in Figure 5 shows the results for cascading randomization on Gradient $\odot$ Input. The rightmost column represents the original saliency map when all layer weights and biases are set to their fully trained values. The leftmost saliency map represents the map produced when only the softmax layer has been randomized. The image to the right of that when everything up to and including conv5 4 has been randomized, and so on. Again we find that CGI is much more sensitive to parameter randomization than Gradient $\odot$ Input.
129
+
130
+ • The bottom figure in Figure 5 shows our results for cascading randomization on LRP. We find that our competitive selection process (CLRP) benefits the LRP maps as well. The LRP maps show the structure of the bird even after multiple blocks of randomization, while our maps greatly reduce the prevalence of the bird structure in the images.
131
+
132
+ • Figure 6 shows our results for cascading randomization on DASP Ancona et al. (2019), a state of the art method that satisfies approximate completeness. DASP still shows the structure of the digit even after randomization, while CDASP eliminates much of this structure.
133
+
134
+ ![](images/5be245127c776fec812d6b962a0a1f2c896c32465e43f28d497987070563598d.jpg)
135
+ Layerwise Randomization for CGI versus Gradient Input
136
+ Figure 5: The first two figures depict layerwise and cascading randomization, respectively, for a VGG19 model trained on Imagenet for Gradient $\odot$ Input versus CGI. We find that in CGI, the saliency map is almost blank when any weights are reinitialized. By contrast, we find that the original Gradient $\odot$ Input method displays the structure of the bird, no matter which layer is randomized. The third figure depicts saliency map for cascading randomization on VGG -16 on Imagenet LRP versus CLRP. We notice that LRP shows the structure of the bird even after multiple blocks of randomization. CLRP eliminates much of the structure of the bird.
137
+
138
+ # 5.3 DATA RANDOMIZATION TEST
139
+
140
+ We run experiments to determine whether our saliency method is sensitive to model training. We use a version of Alexnet Krizhevsky et al. (2012) adjusted to accept one color channel instead of three and train on MNIST. We randomly permute the labels in the training data set and train the model to greater than $98 \%$ accuracy and examine the saliency maps. Figure 7 shows our results. On the left hand side is the original image. In the middle is the map produced by Gradient $\odot$ Input . We find that the input structure, the number 3, still shows through with the Gradient $\odot$ Input method. On the other hand, CGI removes the underlying structure of the number.
141
+
142
+ ![](images/ebcfc4a2311c7a146bcde37acf524e9222b56636169d30759743fc298b2760d4.jpg)
143
+ Figure 6: Saliency map cascading randomization on MNIST for CDASP versus DASP. We notice that DASP shows the structure of the digit even after randomization. CDASP eliminates the structure of the digit.
144
+
145
+ ![](images/2198b552def37c435f3615f08c1d45e754dd8ec986eb8b3514e1d7510c100785.jpg)
146
+ Figure 7: Second sanity check for Alexnet MNIST. On the middle image we find that using the original gradient times input method results in an image where the original structure of the number 3 is still visible. On the right hand side image we find that our modification removes the structure of the original input image, as we would expect for a model that had been fitted on randomized data.
147
+
148
+ # 6 CONCLUSION
149
+
150
+ Competition among labels is a simple modification to existing saliency methods that produces saliency maps by combining information from maps from all labels, instead of just the chosen label. Our modification keeps existing methods relevant for visual evaluation (as shown on three wellknown methods Gradient $\odot$ Input, LRP, and DASP) while allowing them to pass sanity checks of Adebayo et al. (2018), which had called into question the validity of saliency methods. Possibly our modification even improves the quality of the map, by zero-ing out irrelevant features. We gave some theory in Section 4 to justify the competition idea for methods which satisfy approximate completeness. Many methods satisfy completeness by design, and experimentally we find other methods satisfy approximate completeness.
151
+
152
+ We hope the simple analysis of Section 4—modeling the saliency map as “noisy signal” mixed with “white noise”—will inspire design of other new saliency maps. We leave open the question of what is the optimum way to design saliency maps by combining information from all labels3. When pixel values are spatially correlated it is natural to involve that in designing the competition. This is left for future work.
153
+
154
+ The sanity checks of Adebayo et al. (2018) randomize the net in a significant way, either by randomizing a layer or training on corrupted data. It is an interesting research problem to devise sanity checks that are less disruptive.
155
+
156
+ # REFERENCES
157
+
158
+ Julius Adebayo, Justin Gilmer, Michael Muelly, Ian Goodfellow, Moritz Hardt, and Been Kim. Sanity checks for saliency maps. In Advances in Neural Information Processing Systems, pp. 9505–9515, 2018.
159
+
160
+ Marco Ancona, Enea Ceolini, Cengiz Oztireli, and Markus Gross. Towards better understanding of gradient-based attribution methods for deep neural networks. In 6th International Conference on Learning Representations (ICLR 2018), 2018.
161
+
162
+ Marco Ancona, Cengiz Oztireli, and Markus Gross. Explaining deep neural networks with a poly- ¨ nomial time algorithm for shapley values approximation. In 36th International Conference on Machine Learning (ICML 2019), 2019.
163
+
164
+ Sebastian Bach, Alexander Binder, Gregoire Montavon, Frederick Klauschen, Klaus-Robert M ´ uller, ¨ and Wojciech Samek. On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation. PloS one, 10(7):e0130140, 2015.
165
+
166
+ Sara Hooker, Dumitru Erhan, Pieter-Jan Kindermans, and Been Kim. Evaluating feature importance estimates. Third Annual Workshop on Human Interpretability in Machine Learning, 2018.
167
+
168
+ Beomsu Kim, Junghoon Seo, SeungHyun Jeon, Jamyoung Koo, Jeongyeol Choe, and Taegyun Jeon. Why are saliency maps noisy? cause of and solution to noisy saliency maps. In Workshop on Interpreting and Explaining Visual AI Models, 2019.
169
+
170
+ Pieter-Jan Kindermans, Kristof Schutt, Klaus-Robert M ¨ uller, and Sven D ¨ ahne. Investigating the ¨ influence of noise and distractors on the interpretation of neural networks. In Workshop on Interpretable Machine Learning in Complex Systems, 2016.
171
+
172
+ 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.
173
+
174
+ Gregoire Montavon, Wojciech Samek, and Klaus-Robert M ´ uller. Methods for interpreting and un-¨ derstanding deep neural networks. Digital Signal Processing, 73:1–15, 2018.
175
+
176
+ 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.
177
+
178
+ Avanti Shrikumar, Peyton Greenside, Anna Shcherbina, and Anshul Kundaje. Not just a black box: Learning important features through propagating activation differences. CoRR, abs/1605.01713, 2016. URL http://arxiv.org/abs/1605.01713.
179
+
180
+ Avanti Shrikumar, Peyton Greenside, and Anshul Kundaje. Learning important features through propagating activation differences. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 3145–3153. JMLR. org, 2017.
181
+
182
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. ICLR, 2015.
183
+
184
+ Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 3319– 3328. JMLR. org, 2017.
185
+
186
+ # 7 APPENDIX
187
+
188
+ # 7.1 SOME SALIENCY METHODS
189
+
190
+ MOVE TO APPENDIX Let $S _ { y }$ denote the logit computed for the chosen output node of interest, $y$ .
191
+
192
+ 1. The Gradient $\odot$ Input explanation: Gradient $\odot$ Input method Shrikumar et al. (2017) computes . $\frac { \partial S _ { y } } { \partial x } \odot x$ where $\odot$ is the elementwise product.
193
+
194
+ 2. Integrated Gradients Integrated gradients Sundararajan et al. (2017) also computes the gradient of the chosen class’s logit. However, instead of evaluating this gradient at one fixed data point, integrated gradients consider the path integral of this value as the input varies from a baseline, $\bar { x }$ , to the actual input, $x$ along a straight line.
195
+
196
+ 3. Layerwise Relevance Propagation Bach et al. (2015) proposed an approach for propagating importance scores called Layerwise Relevance Propagation (LRP). LRP decomposes the output of the neural network into a sum of the relevances of coordinates of the input. Specifically, if a neural network computes a function $f ( x )$ they attempt to find relevance scores $R _ { p } ^ { ( 1 ) }$ such that $\begin{array} { r } { f ( x ) \approx \sum _ { p } R _ { p } ^ { ( 1 ) } } \end{array}$
197
+
198
+ 4. Taylor decomposition As stated Montavon et al. (2018) for special classes of piecewise linear functions that satisfy $f ( t x ) ~ = ~ t f ( x )$ , including ReLU networks with no biases, one can always find a root point near the origin such that $\begin{array} { r } { f ( x ) = \sum _ { i = 1 } ^ { d } R _ { i } ( x ) } \end{array}$ where the relevance scores $R _ { i } ( x )$ simplify to $\begin{array} { r } { R _ { i } ( x ) = \frac { \partial f } { \partial x _ { i } } \cdot x _ { i } } \end{array}$
199
+
200
+ 5. DeepLIFT explanation The DeepLIFT explanation Shrikumar et al. (2016) calculates the importance of the input by comparing each neuron’s activation to some ’reference’ activation. Each neuron is assigned an attribution that represents the amount of difference from the baseline that that neuron is responsible for. Reference activations are determined by propagating some reference input, $\bar { x }$ , through the neural network.
201
+
202
+ 6. DASP The Deep Approximate Shapley Propagation Ancona et al. (2019) is a state of the art method that computes the approximate Shapley values. By Proposition 2 in Ancona et al. (2019) the Shapley values satisfy completeness.
203
+
204
+ Relationships between different methods .Kindermans et al. (2016) and Shrikumar et al. (2017) showed that if modifications for numerical stability are not taken into account, the LRP rules are equivalent within a scaling factor to Gradient $\odot$ Input. Ancona et al. (2018) showed that for ReLU networks (with zero baseline and no biases) the $\epsilon$ -LRP and DeepLIFT (Rescale) explanation methods are equivalent to the Gradient $\odot$ Input. DASP Ancona et al. (2019), like DeepLIFT relies on the Shapley values, but designs an efficient way to approximately compute these values.
205
+
206
+ ![](images/aab80b7b47f78b5db458a0edfd5bdad09cbf822d27adaf6ccf6c64f733ce78a4.jpg)
207
+
208
+ Figure 8: Saliency map for layer-wise randomization of the learned weights. Diverging visualization where we plot the positive importances in red and the negative importances in blue. We find that with CGI, the saliency map is almost blank when any layer is reinitialized. By contrast, we find that Gradient $\odot$ Input displays the structure of the bird, no matter which layer is randomized.
209
+
210
+ ![](images/834599ead6a6a7f8e56e4ed888b2c73c5b39696c55cdd61b3aad264c787ec5c1.jpg)
211
+ Figure 9: Saliency map cascading randomization LRP versus CLRP.
212
+
213
+ ![](images/2b42fc6be5133e0cdd3dee6eb3a2da9ea7564cf5724975790d4d2f88e55d4ac4.jpg)
214
+ Figure 10: Saliency map for layer-wise randomization of the learned weights. Absolute value visualization where we plot the absolute value of the saliency map. We find that using CGI, the saliency map is almost blank when any layer is reinitialized. By contrast, we find that Gradient $\odot$ Input displays the structure of the bird, no matter which layer is randomized.
md/train/BJfYvo09Y7/BJfYvo09Y7.md ADDED
@@ -0,0 +1,337 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HIERARCHICAL VISUOMOTOR CONTROLOF HUMANOIDS
2
+
3
+ Josh Merel∗, Arun Ahuja∗,
4
+ Vu Pham, Saran Tunyasuvunakool, Siqi Liu, Dhruva Tirumala,
5
+ Nicolas Heess & Greg Wayne
6
+ DeepMind
7
+ London, UK
8
+ {jsmerel,arahuja,vuph,stunya,liusiqi,dhruvat, heess,gregwayne}@google.com
9
+
10
+ # ABSTRACT
11
+
12
+ We aim to build complex humanoid agents that integrate perception, motor control, and memory. In this work, we partly factor this problem into low-level motor control from proprioception and high-level coordination of the low-level skills informed by vision. We develop an architecture capable of surprisingly flexible, task-directed motor control of a relatively high-DoF humanoid body by combining pre-training of low-level motor controllers with a high-level, task-focused controller that switches among low-level sub-policies. The resulting system is able to control a physically-simulated humanoid body to solve tasks that require coupling visual perception from an unstabilized egocentric RGB camera during locomotion in the environment. Supplementary video link1
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ In reinforcement learning (RL), a major challenge is to simultaneously cope with high-dimensional input and high-dimensional action spaces. As techniques have matured, it is now possible to train high-dimensional vision-based policies from scratch to generate a range of interesting behaviors ranging from game-playing to navigation (Jaderberg et al., 2018; OpenAI, 2018; Wayne et al., 2018). Likewise, for controlling bodies with a large number of degrees of freedom (DoFs), in simulation, reinforcement learning methods are beginning to surpass optimal control techniques. Here, we try to synthesize this progress and tackle high-dimensional input and output at the same time. We evaluate the feasibility of full-body visuomotor control by comparing several strategies for humanoid control from vision.
17
+
18
+ Both to simplify the engineering of a visuomotor system and to reduce the complexity of taskdirected exploration, we construct modular agents in which a high-level system possessing egocentric vision and memory is coupled to a low-level, reactive motor control system. We build on recent advances in imitation learning to make flexible low-level motor controllers for high-DoF humanoids. The motor skills embodied by the low-level controllers are coordinated and sequenced by the high-level system, which is trained to maximize sparse task reward.
19
+
20
+ Our approach is inspired by themes from neuroscience as well as ideas developed and made concrete algorithmically in the animation and robotics literatures. In motor neuroscience, studies of spinal reflexes in animals ranging from frogs to cats have led to the view that locomotion and reaching are highly prestructured, enabling subcortical structures such as the basal ganglia to coordinate a motor repertoire; and cortical systems with access to visual input can send low complexity signals to motor systems in order to evoke elaborate movements (Flash & Hochner, 2005; Bizzi et al., 2008; Grillner et al., 2005).
21
+
22
+ The study of “movement primitives” for robotics descends from the work of Ijspeert et al. (2002). Subsequent research has focused on innovations for learning or constructing primitives for control of movments (Ijspeert et al., 2003; Kober & Peters, 2009), deploying and sequencing them to solve tasks (Sentis & Khatib, 2005; Kober & Peters, 2014; Konidaris et al., 2012), and increasing the complexity of the control inputs to the primitives (Neumann et al., 2014). Particularly relevant to our cause is the work of Kober et al. (2008) in which primitives were coupled by reinforcement learning to external perceptual inputs.
23
+
24
+ Research in the animation literature has also sought to produce physically simulated characters capable of distinct movements that can be flexibly sequenced. This ambition can be traced to the virtual stuntman (Faloutsos et al., 2001b;a) and has been advanced markedly in the work of Liu (Liu et al., 2012). Further recent work has relied on reinforcement learning to schedule control policies known as “control fragments”, each one able to carry out only a specialized short movement segment (Liu & Hodgins, 2017; 2018). In work to date, such control fragments have yet to be coupled to visual input as we will pursue here. From the perspective of the RL literature (Sutton et al., 1999), motor primitives and control fragments may be considered specialized instantiations of “option” sub-policies.
25
+
26
+ Our work aims to contribute to this multi-disciplinary literature by demonstrating concretely how control-fragment-like low-level movements can be coupled to and controlled by a vision and memory-based high-level controller to solve tasks. Furthermore, we demonstrate the scalability of the approach to greater number of control fragments than previous works. Taken together, we demonstrate progress towards the goal of integrated agents with vision, memory, and motor control.
27
+
28
+ # 2 APPROACH
29
+
30
+ We present a system capable of solving tasks from vision by switching among low-level motor controllers for the humanoid body. This scheme involves a general separation of control where a low-level controller handles motor coordination and a high-level controller signals/selects lowlevel behavior based on task context (see also Heess et al. 2016; Peng et al. 2017). In the present work, the low-level motor controllers operate using proprioceptive observations, and the high-level controller operate using proprioception along with first-person/egocentric vision. We first describe the procedure for creating low-level controllers from motion capture data, then describe and contrast multiple approaches for interfacing the high- and low-level controllers.
31
+
32
+ # 2.1 TRACKING MOTION CAPTURE CLIPS
33
+
34
+ For simulated character control, there has been a line of research extracting humanoid behavior from motion capture (“mocap”) data. The SAMCON algorithm is a forward sampling approach that converts a possibly noisy, kinematic pose sequence into a physical trajectory. It relies on a beamsearch-like planning algorithm (Liu et al., 2010; 2015) that infers an action sequence corresponding to the pose sequence. In subsequent work, these behaviors have been adapted into policies (Liu et al., 2012; Ding et al., 2015). More recently, RL has also been used to produce time-indexed policies which serve as robust tracking controllers (Peng et al., 2018). While the resulting time-indexed policies are somewhat less general as a result, time-indexing or phase-variables are common in the animation literature and also employed in kinematic control of characters (Holden et al., 2017). We likewise use mocap trajectories as reference data, from which we derive policies that are single purpose – that is, each policy robustly tracks a short motion capture reference motion (2-6 sec), but that is all each policy is capable of.
35
+
36
+ Humanoid body We use a 56 degree-of-freedom (DoF) humanoid body that was developed in previous work (Merel et al., 2017), a version of which is available with motion-capture playback in the DeepMind control suite (Tassa et al., 2018). Here, we actuate the joints with position-control: each joint is given an actuation range in $[ - 1 , 1 ]$ , and this is mapped to the angular range of that joint.
37
+
38
+ Single-clip tracking policies For each clip, we train a policy $\pi _ { \boldsymbol { \theta } } ( \boldsymbol { a } | \boldsymbol { s } , t )$ with parameters $\theta$ such that it maximizes a discounted sum of rewards, $r _ { t }$ , where the reward at each step comes from a custom scoring function (see eqns. 1, 2 defined immediately below). This tracking approach most closely follows Peng et al. (2018). Note that here the state optionally includes a normalized time $t$ that goes from 0 at the beginning of the clip to 1 at the end of the clip. For cyclical behaviors like locomotion, a gait cycle can be isolated manually and kinematically blended circularly by weighted linear interpolation of the poses to produce a repeating walk. The time input is reset each gaitcycle (i.e. it follows a sawtooth function). As proposed in Merel et al. (2017); Peng et al. (2018), episodes are initialized along the motion capture trajectory; and episodes can be terminated when it is determined that the behavior has failed significantly or irrecoverably. Our specific termination condition triggers if parts of the body other than hands or feet make contact with the ground. See Fig. 1 for a schematic.
39
+
40
+ ![](images/a52ff1c19d10a1768593fef3986a65bde7480d2334b7e76ecc0761318f823dab.jpg)
41
+ Figure 1: Illustration of tracking-based RL training. Training iteratively refines a policy to robustly track the reference trajectory as well as physically feasible.
42
+
43
+ We first define an energy function most similar to SAMCON’s (Liu et al., 2010):
44
+
45
+ $$
46
+ \begin{array} { r } { E _ { t o t a l } = w _ { q p o s } E _ { q p o s } + w _ { q v e l } E _ { q v e l } + w _ { o r i } E _ { o r i } + } \\ { w _ { e e } E _ { e e } + w _ { v e l } E _ { v e l } + w _ { g y r o } E _ { g y r o } } \end{array}
47
+ $$
48
+
49
+ where $E _ { q p o s }$ is a energy defined on all joint angles, $E _ { q v e l }$ on joint velocities, $E _ { o r i }$ on the body root (global-space) quaternion, $E _ { e e }$ on egocentric vectors between the root and the end-effectors (see Merel et al. (2017)), $E _ { v e l }$ on the (global-space) translational velocities, and $E _ { g y r o }$ on the body root rotational velocities. More specifically:
50
+
51
+ $$
52
+ \begin{array} { l l } { { E _ { q p o s } = \displaystyle \frac { 1 } { N _ { q p o s } } \sum | \vec { q } _ { p o s } - \vec { q } _ { p o s } ^ { * } | } } & { { \qquad E _ { e e } = \displaystyle \frac { 1 } { N _ { e e } } \sum | | \vec { q } _ { e e } - \vec { q } _ { e e } ^ { * } | | _ { 2 } } } \\ { { E _ { q v e l } = \displaystyle \frac { 1 } { N _ { q v e l } } \sum | \vec { q } _ { v e l } - \vec { q } _ { v e l } ^ { * } | } } & { { \qquad E _ { v e l } = 0 . 1 \cdot \frac { 1 } { N _ { v e l } } \sum | \vec { x } _ { v e l } - \vec { x } _ { v e l } ^ { * } | } } \\ { { E _ { o r i } = | | \log ( \vec { q } _ { o r i } \cdot \vec { q } _ { o r i } ^ { * - 1 } ) | | _ { 2 } } } & { { \qquad E _ { g y r o } = 0 . 1 \cdot | | \vec { q } _ { g y r o } - \vec { q } _ { g y r o } ^ { * } | | _ { 2 } } } \end{array}
53
+ $$
54
+
55
+ where $\vec { q }$ represents the pose and $\vec { q } ^ { \star }$ represents the reference pose. In this work, we used coefficients $w _ { q p o s } = 5$ , $w _ { q v e l } = 1$ , $w _ { o r i } = 2 0$ , $w _ { g y r o } = 1$ , $w _ { v e l } = 1$ , $w _ { e e } = 2$ . We tuned these by sweeping over parameters in a custom implementation of SAMCON (not detailed here), and we have found these coefficients tend to work fairly well across a wide range of movements for this body.
56
+
57
+ From the energy, we write the reward function:
58
+
59
+ $$
60
+ r _ { t } = \exp ( - \beta E _ { t o t a l } / w _ { t o t a l } )
61
+ $$
62
+
63
+ where $w _ { t o t a l }$ is the sum of the per energy-term weights and $\beta$ is a sharpness parameter ( $\beta = 1 0$ throughout). Since all terms in the energy are non-negative, the reward is normalized $r _ { t } \in ( 0 , 1 ]$ with perfect tracking giving a reward of 1 and large deviations tending toward 0.
64
+
65
+ Acquiring reference data features for some quantities required setting the body to the pose specified by the joint angles: e.g., setting $\vec { x } _ { p o s }$ , $\vec { q } _ { p o s }$ , and $\vec { q } _ { o r i }$ to compute the end-effector vectors $\vec { q } _ { e e }$ . Joint angle velocities, root rotational velocities, and translational velocities $( \vec { q } _ { v e l } , \vec { q } _ { g y r o } , \vec { x } _ { v e l } )$ were derived from the motion capture data by finite difference calculations on the corresponding positions. Note that the reward function here was not restricted to egocentric features – indeed, the velocity and quaternion were non-egocentric. Importantly, however, the policy received exclusively egocentric observations, so that, for example, rotating the initial pose of the humanoid would not affect the policy’s ability to execute the behavior. The full set of proprioceptive features we provided the policy consists of joint angles $( \vec { q } _ { p o s } )$ and velocities $( \vec { q } _ { v e l } )$ , root-to-end-effector vectors $( \vec { q } _ { e e } )$ , rootframe velocimeter $( \vec { q } _ { v e l o c } )$ , rotational velocity $( \vec { q } _ { g y r o } )$ , root-frame accelerometers $( \vec { q } _ { a c c e l } )$ , and 3D orientation relative to the $\mathbf { Z }$ -axis $\vec { r } _ { z }$ : functionally a gravity sensor).
66
+
67
+ Low-level controller reinforcement learning details Because the body is position-controlled, ( $\dot { \boldsymbol { a } } _ { t }$ has the same dimension and semantics as a subset of the body pose), we can pre-train the policy to produce target poses by supervised learning m $\begin{array} { r } { \operatorname * { l a x } _ { \theta } \sum _ { t } \log \pi \big ( \dot { q } _ { p o s , t + 1 } ^ { \ast } | s _ { t } ^ { \ast } , t \big ) } \end{array}$ . This produces very poor control but facilitates the subsequent stage of RL-based imitation learning. We generally found that training with some pretraining considerably shortened the time the training took to converge and improved the resulting policies.
68
+
69
+ For RL, we performed off-policy training using a distributed actor-critic implementation, closest to that used in (Hausman et al., 2018). This implementation used a replay buffer and target networks as done in previous work (Lillicrap et al., 2015; Heess et al., 2015). The Q-function was learned off-policy using TD-learning using importance-weighted Retrace (Munos et al., 2016), and the actor was learned off-policy using SVG(0) (Heess et al., 2015). This is to say that we learned the policy by taking gradients with respect to the Q function (target networks were updated every 500 learning steps). Gradient updates to the policy were performed using short time windows, $\{ s _ { \tau } , a _ { \tau } \} _ { \tau = 1 \dots T }$ , sampled from replay:
70
+
71
+ $$
72
+ \operatorname* { m a x } _ { \pi _ { \theta } } \sum _ { \tau = 1 \dots T } \mathbb { E } _ { a \sim \pi ( a \mid s _ { \tau } ) } [ Q _ { t a r g e t } ( s _ { \tau } , a ) ] - \eta \mathcal { D } _ { K L } [ \pi _ { \theta } ( a \mid s _ { \tau } ) \mid | \pi _ { t a r g e t } ( a \mid s _ { \tau } ) ]
73
+ $$
74
+
75
+ where $\eta$ was fixed in our experiments. While the general details of the RL algorithm are not pertinent to the success of this approach (e.g. Peng et al. (2018) used on-policy RL), we found two details to be critical, and both were consistent with the results reported in Peng et al. (2018). Policy updates needed to be performed conservatively with the update including a term which restricts $\mathcal { D } _ { K L } [ \pi _ { n e w } | | \pi _ { o l d } ]$ (Heess et al., 2015; Schulman et al., 2017). Secondly, we found that attempting to learn the variance of the policy actions tended to result in premature convergence, so best results were obtained using a stochastic policy with fixed noise (we used noise with $\sigma = . 1$ ).
76
+
77
+ # 2.2 VARIETIES OF LOW-LEVEL MOTOR CONTROL
78
+
79
+ We next consider how to design low-level motor controllers derived from motion capture trajectories. Broadly, existing approaches fall into two categories: structured and cold-switching controllers. In structured controllers, there is a hand-designed relationship between “skill-selection” variables and the generated behavior. Recent work by Peng et al. (2018) explored specific handdesigned, structured controllers. While parameterized skill-selection coupled with manual curation and preprocessing of motion capture data can produce artistically satisfying results, the range of behavior has been limited and implementation requires considerable expertise and animation skill. By contrast, an approach in which behaviors are combined by a more automatic procedure promises to ultimately scale to a wider range of behaviors.
80
+
81
+ Below, we describe some specific choices for both structured and cold-switching controllers. For structured control schemes, we consider: (1) a steerable controller that produces running behavior with a controllable turning radius, and (2) a switching controller that is a single policy that can switch between the behaviors learned from multiple mocap clips, with switch points allowed at the end of gait cycles. The allowed transitions were defined by a transition graph. For cold switching, we will not explicitly train transitions between behaviors.
82
+
83
+ Steerable controller Following up on the ability to track a single cyclical behavior like locomotion described above, we can introduce the ability to parametrically turn. To do this we distorted the reference trajectory accordingly and trained the policy to track the reference with the turning radius as additional input. Each gait cycle we picked a random turning radius parameter and in that gaitcyle we rotate the reference clip heading $( \vec { q } _ { o r i } )$ at that constant rate (with appropriate bookkeeping for other positions and velocities). The result was a policy that, using only one gait cycle clip as input, could turn with a specified rate of turning.
84
+
85
+ Switching controller An alternative to a single behavior with a single continuously controllable parameter is a single policy that is capable of switching among a discrete set of behaviors based on a 1-of- $k$ input. Training consisted of randomly starting in a pose sampled from a random mocap clip and transitioning among clips according to a graph of permitted transitions. Given a small, discrete set of clips that were manually “cut” to begin and end at similar points in a gait cycle, we initialized a discrete Markov process among clips with some initial distribution over clips and transitioned between clips that were compatible (walk forward to turn left, etc.) (Fig. 2).
86
+
87
+ ![](images/41f156a8599a7799b4decec73235f5cf28ac8e46bf148be9849e545f799100fd.jpg)
88
+ Figure 2: Training settings for explicit training of transition-capable controllers. Panel A depicts a cartoon of a training episode for a steerable controller in which the turning radius of a each gait-cycle is selected randomly. Panel B depicts training a policy under an explicit, hand-designed transition graph for $k$ options.
89
+
90
+ Cold-switching of behaviors and control fragments We can also leave the task of sequencing behaviors to the high-level controller, instead of building structured low-level policies with explicit, designed transitions. Here, we did not attempt to combine the clips into a single policy; instead, we cut behaviors into short micro-behaviors of roughly 0.1 to 0.3 seconds, which we refer to as control fragments (Liu & Hodgins, 2017). Compared to switching using the complete behaviors, the micro-behaviors, or control fragments, allow for better transitions and more flexible locomotion. Additionally, we can easily scale to many clips without manual intervention. For example, clip 1 would generate a list of fragments: $\pi _ { 1 } ^ { 1 } \dot { ( } a | s _ { t } \dot { , } \tau )$ $\vert s _ { t } , \tau ) , \pi _ { 2 } ^ { 1 } ( a \vert s _ { t } , \tau ) , \ldots , \pi _ { 1 0 } ^ { 1 } ( a \vert s _ { t } , \tau )$ . When fragment 1 was chosen, $\tau$ the time-indexing variable was set to $\tau = 0$ initially and ticked until, say, $\tau =$ 0.1. Choosing fragment 2, $\pi _ { 2 } ^ { 1 }$ , would likewise send a signal to the clip 1 policy starting from $\tau = 0 . 1$ , etc. Whereas we have to specify a small set of consistent behaviors for the other lowlevel controller models, we could easily construct hundreds (or possibly more) control fragments cheaply and without significant curatorial attention. Since the control fragments were not trained with switching behavior, we refer to the random access switching among fragments by the highlevel controller as “cold-switching” (Fig. 3).
91
+
92
+ ![](images/a6d7a01dc50a75c518c7d4f24eabdbd3e67c1603d0153bd4c2ad7fe0d39b9be4.jpg)
93
+ Figure 3: Cold-switching among a set of behaviors (A) only at end of clips to form a trajectory composed of sequentially activation of the policies (B). Alternatively, policies are fragmented at a pre-specified set of times, cutting the policy into sub-policies (C), which serve as control fragments, enabling sequencing at a higher frequency (D).
94
+
95
+ ![](images/fe90f6cb65acf49f3aba690c9ea9e320407050a50e70ddac20984bb96d8d70a3.jpg)
96
+ Figure 4: Schematic of the architecture: a high-level controller (HL) selects among multiple lowlevel (LL) control fragments, which are policies with proprioception. Switching from one control fragment to another occurs every $k$ time steps.
97
+
98
+ # 2.3 TRAINING HL-POLICIES TO SOLVE TASKS USING LL-CONTROLLERS
99
+
100
+ We integrated the low-level controllers into an agent architecture with vision and and an LSTM memory in order to apply it to tasks including directed movements to target locations, a running course with wall or gap obstacles, a foraging task for “balls”, and a simple memory task involving detecting and memorizing the reward value of the balls.
101
+
102
+ The interface between the high-level controller and the low-level depends on the type of low-level controller: for the steerable controller, the high-level produces a one-dimensional output; for the switching and control fragment controllers, the high-level produces a 1-of-K index to select the lowlevel policies. The high-level policies are trained off-policy using data from a replay buffer. The replay buffer contains data generated from distributed actors, and in general the learner processes the same replay data multiple times.
103
+
104
+ The high-level controller senses inputs from proprioceptive data and, for visual tasks, an egocentric camera mounted at the root of the body (Fig. 4). A noteworthy challenge arises due to the movement of the camera itself during locomotion. The proprioceptive inputs are encoded by a single linear layer, and the image is encoded by a ResNet (see Appendix A). The separate inputs streams are then flattened, concatenated, and passed to an LSTM, enabling temporally integrated decisions, with a stochastic policy and a value function head. The high-level controller receives inputs at each time step even though it may only act when the previous behavior (gait cycle or control fragment) has terminated.
105
+
106
+ Importantly, while the low-level skills used exclusively egocentric proprioceptive input, the highlevel controller used vision to select from or modulate them, enabling the system as a whole to effect visuomotor computations.
107
+
108
+ High-level controller reinforcement learning details For the steerable controller, the policy was a parameterized Gaussian distribution that produces the steering angle $a _ { s } \in [ - 1 . 5 , 1 . 5 ]$ . The mean of Gaussian was constrained via a tanh and sampled actions were clipped to the steering angle range. The steering angle was held constant for a full gait cycle. The policy was trained as previously described by learning a state-action value function off-policy using TD-learning with Retrace (Munos et al., 2016) with the policy trained using SVG(0) (Heess et al., 2015).
109
+
110
+ For the switching controller and the discrete control fragments approach, the policy was a multinomial over the discrete set of behaviors. In either case, the high-level controller would trigger the behavior for its period $T$ (a gait cycle or a fragment length). To train these discrete controllers, we fit the state-value baseline $V$ -function using V-Trace and update the policy according to the method in Espeholt et al. (2018). While we provided a target for the value function loss at each time step, the policy gradient loss for the high-level was non-zero only when a new action was sampled (every $T$ steps).
111
+
112
+ ![](images/6fde06b4a4230a10bdd07fed3dccb7725034668043b6a27735e50bc2924220a9.jpg)
113
+ Figure 5: A. Go-to-target: in this task, the agent moves on an open plane to a target provided in egocentric coordinates. B. Walls: The agent runs forward while avoiding solid walls using vision. C. Gaps: The agent runs forward and must jump between platforms to advance. D. Forage: Using vision, the agent roams in a procedurally-generated maze to collect balls, which provide sparse rewards. E. Heterogeneous Forage: The agent must probe and remember rewards that are randomly assigned to the balls in each episode.
114
+
115
+ Query-based control fragment selection We considered an alternative family of ideas to interface with control fragments based on producing a Gaussian policy search query to be compared against a feature-key for each control fragment. We then selected the control fragment whose key was nearest the query-action. Our method was based on the Wolpertinger approach introduced in (Dulac-Arnold et al., 2015). Here, the Q-function was evaluated for each of $k$ nearest neighbors to the query-action, and the control fragment were selected with Boltzmann exploration, i.e. $p ( a _ { i } ^ { H L } | h ) \stackrel { \cdot } { \propto } \exp ( \frac { 1 } { T } Q ( h , a _ { i } ^ { H L } ) )$ , where $h$ is the output of the LSTM. See Appendix A.3.3 for more details. The intuition was that this would allow the high-level policy to be less precise as the Qfunction could assist it in selecting good actions. However, this approach under-performed relative to discrete action selection as we show in our results.
116
+
117
+ # 3 EXPERIMENTS
118
+
119
+ # 3.1 RESULTS ON CORE TASKS
120
+
121
+ We compared the various approaches on a variety of tasks implemented in MuJoCo (Todorov et al., 2012). The core tasks we considered for the main comparisons were Go-to-target, wall navigation (Walls), running on gapped platforms (Gaps), foraging for colored ball rewards (Forage), and a foraging task requiring the agent to remember the reward value of the different colored balls (Heterogeneous Forage) (see Fig. 5). In Go-to-target, the agent received a sparse reward of 1 for each time step it was within a proximity radius of the target. For Walls and Gaps, adapted from Heess et al. (2017) to operate from vision, the agent received a reward proportional to its forward velocity. Forage was broadly similar to explore object locations in the DeepMind Lab task suite (Beattie et al., 2016) (with a humanoid body) while Heterogeneous Forage was a simplified version of explore object rewards. In all tasks, the body was initialized to a random pose from a subset of the reference motion capture data. For all tasks, other than Go-to-target, the high-level agent received a 64x64 image from the camera attached to the root of the body, in addition to the proprioceptive information.
122
+
123
+ We compared the agents on our core set of tasks. Our overall best results were achieved using control fragments with discrete selection (Fig. 6). Additional training details are provided in Appendix A. For comparison, we also include the control experiment of training a policy to control the humanoid from scratch (without low-level controllers) as well as training a simple rolling ball body. The performance of the rolling ball is not directly comparable because its velocity differs from that of the humanoid, but isolates the task complexity from the challenge of motor control of the humanoid body. The switching controllers selected between a base set of four policies: stand, run, left and right turn. For the control fragments approach we were able to augment this set as described in Table 2.
124
+
125
+ ![](images/27596c13ee2a21747e57ac52841bea06152e3afb93b2d8927c8131c1e65feb8f.jpg)
126
+ Figure 6: Performance of various approaches on each core task. Of the approaches we compared, discrete switching among control fragments performed the best. Plots show the mean and standard error over multiple runs.
127
+
128
+ The end-to-end approach (described in Appendix A.4) succeeded at only Go-to-target, however the resulting visual appearance was jarring. In the more complex Forage task, the end-to-end approach failed entirely. The steering controller was also able to perform the Go-to-target task, but a fixed turning radius meant that it was unable to make a direct approach the target, resulting in a long travel time to the target and lower score. Both the steering controller and switching controller were able to reach the end of the course in the Walls task, but only the control fragments approach allowed for sharper turns and quicker adjustments for agent to achieve a higher velocity. Generally, the switching controller with transitions started to learn faster and appeared the most graceful because of its predefined, smooth transitions, but its comparative lack of flexibility meant that its asymptotic task performance was relatively low. In the Forage task, where a score of $> 1 5 0$ means the agent is able to move around the maze and 600 is maximum collection of reward, the switching controller with transitions was able to traverse the maze but unable to adjust to the layout of the maze to make sharper turns to collect all objects. The control fragments approach was able to construct rotations and abrupt turns to collect the objects in each room. In the Gaps task, we were able to use the control fragments approach with 12 single-clip policies, where it would be laborious to pretrain transitions for each of these. In this task, the high-level controller selected between the 4 original stand, run and turn policies as well as 8 additional jumps, resulting in 359 fragments, and was able to synthesize them to move forward along the separated platforms. In the final Heterogeneous Forage task, we confirmed that the agent, equipped with an LSTM in the high-level controller, was capable of memory-dependent control behavior. See our Extended Video2 for a comprehensive presentation of the controllers.
129
+
130
+ All control fragment comparisons above used control fragments of 3 time steps (0.09s). To further understand the performance of the control fragment approach, we did a more exhaustive comparison of performance on Go-to-target of the effect of fragment length, number of fragments, as well as introduction of redundant clips (see appendix B). We saw benefits in early exploration due to using fragments for more than one time step but lower ultimate performance. Adding more fragments was helpful when those fragments were functionally similar to the standard set and the high-level controller was able to robustly handle those that involved extraneous movements unrelated to locomotion.
131
+
132
+ ![](images/525b45d62d672078e6bc0bb8bb839469e1430379fb7e893d788934d5f5268269.jpg)
133
+ Figure 7: Example agent-view frames and corresponding visuomotor salience visualizations. Note that the ball is more sharply emphasized, suggesting the selected actions were influenced by the affordance of tacking toward the ball.
134
+
135
+ # 3.2 ANALYSIS OF TRAINED HIGH-LEVEL POLICIES
136
+
137
+ While the query-based approaches did not outperform the discrete control fragment selection (Fig. 6), we include a representative visualization in Appendix A.3 to help clarify why this approach may not have worked well. In the present setting, it appears that the proposal distribution over queries generated by the high-level policy was high variance and did not learn to index the fragments precisely.
138
+
139
+ On Forage, the high-level controller with discrete selection of control fragments generated structured transitions between fragments (Appendix C). Largely, movements remained within clip or behavior type. The high-level controller ignored some fragments involving transitions from standing to running and left-right turns to use fast-walk-and-turn movements.
140
+
141
+ To assess the visual features that drove movements, we computed saliency maps (Simonyan et al., 2013) showing the intensity of the gradient of the selected action’s log-probability with respect to each pixel: $\begin{array} { r } { { \check { S _ { t ; x , y } } } = \frac { 1 } { Z } \operatorname* { m i n } ( g , \frac { 1 } { 3 } \check { \sum _ { c } } | \nabla _ { I _ { x , y , c } } \log \pi ( a _ { t } ^ { H L } | h _ { t } ) | ) } \end{array}$ with normalization $Z$ and clipping $g$ (Fig. 7). Consistently, action selection was sensitive to the borders of the balls as well as to the walls. The visual features that this analysis identifies correspond roughly to sensorimotor affordances (Gibson, 2014); the agent’s perceptual representations were shaped by goals and action.
142
+
143
+ # 4 DISCUSSION
144
+
145
+ In this work we explored the problem of learning to reuse motor skills to solve whole body humanoid tasks from egocentric camera observations. We compared a range of approaches for reusing lowlevel motor skills that were obtained from motion capture data, including variations related to those presented in Liu & Hodgins (2017); Peng et al. (2018). To date, there is limited learning-based work on humanoids in simulation reusing motor skills to solve new tasks, and much of what does exist is in the animation literature. A technical contribution of the present work was to move past hand-designed observation features (as used in Heess et al. (2017); Peng et al. (2018)) towards a more ecological observation setting: using a front-facing camera is more similar to the kinds of observations a real-world, embodied agent would have. We also show that hierarchical motor skill reuse allowed us to solve tasks that we could not with a flat policy. For the walls and go-to-target tasks, learning from scratch was slower and produced less robust behavior. For the forage tasks, learning from scratch failed completely. Finally, the heterogeneous forage is an example of task that integrates memory and perception.
146
+
147
+ There are some other very clear continuities between what we present here and previous work. For learning low-level tracking policies from motion capture data, we employed a manually specified similarity measure against motion capture reference trajectories, consistent with previous work (Liu et al., 2010; 2015; Peng et al., 2018). Additionally, the low-level policies were time-indexed: they operated over only a certain temporal duration and received time or phase as input. Considerably less research has focused on learning imitation policies either without a pre-specified scoring function or without time-indexing (but see e.g. Merel et al. (2017)). Compared to previous work using control fragments (Liu & Hodgins, 2017), our low-level controllers were built without a sampling-based planner and were parameterized as neural networks rather than linear-feedback policies.
148
+
149
+ We also want to make clear that the graph-transition and steerable structured low-level control approaches require significant manual curation and design: motion capture clips must be segmented by hand, possibly manipulated by blending/smoothing clips from the end of one clip to the beginning of another. This labor intensive process requires considerable skill as an animator; in some sense this almost treats humanoid control as a computer-aided animation problem, whereas we aim to treat humanoid motor control as an automated and data-driven machine learning problem. We acknowledge that relative to previous work aimed at graphics and animation, our controllers are less graceful. Each approach involving motion capture data can suffer from distinct artifacts, especially without detailed manual editing – the hand-designed controllers have artifacts at transitions due to imprecise kinematic blending but are smooth within a behavior, whereas the control fragments have a lesser but consistent level of jitter throughout due to frequent switching. Methods to automatically (i.e. without human labor) reduce movement artifacts when dealing with large movement repertoires would be interesting to pursue.
150
+
151
+ Moreover, we wish to emphasize that due to the human-intensive components of training structured low-level controllers, fully objective algorithm comparison with previous work can be somewhat difficult. This will remain an issue so long as human editing is a significant component of the dominant solutions. Here, we focused on building movement behaviors with minimal curation, at scale, that can be recruited to solve tasks. Specifically, we presented two methods that do not require curation and can re-use low-level skills with cold-switching. Additionally, these methods can scale to a large number of different behaviors without further intervention.
152
+
153
+ We view this work as an important step toward the flexible use of motor skills in an integrated visuomotor agent that is able to cope with tasks that pose simultaneous perceptual, memory, and motor challenges to the agent. Future work will necessarily involve refining the naturalness of the motor skills to enable more general environment interactions and to subserve more complicated, compositional tasks.
154
+
155
+ # ACKNOWLEDGMENTS
156
+
157
+ We thank Yuval Tassa for helpful comments. The data used in this project was obtained from mocap.cs.cmu.edu. The database was created with funding from NSF EIA-019621.
158
+
159
+ # REFERENCES
160
+
161
+ Charles Beattie, Joel Z Leibo, Denis Teplyashin, Tom Ward, Marcus Wainwright, Heinrich Kuttler, ¨ Andrew Lefrancq, Simon Green, V´ıctor Valdes, Amir Sadik, et al. Deepmind lab. ´ arXiv preprint arXiv:1612.03801, 2016.
162
+ E Bizzi, VCK Cheung, A d’Avella, P Saltiel, and Me Tresch. Combining modules for movement. Brain research reviews, 57(1):125–133, 2008.
163
+ Kai Ding, Libin Liu, Michiel Van de Panne, and KangKang Yin. Learning reduced-order feedback policies for motion skills. In Proceedings of the 14th ACM SIGGRAPH/Eurographics Symposium on Computer Animation, pp. 83–92. ACM, 2015.
164
+ Gabriel Dulac-Arnold, Richard Evans, Hado van Hasselt, Peter Sunehag, Timothy Lillicrap, Jonathan Hunt, Timothy Mann, Theophane Weber, Thomas Degris, and Ben Coppin. Deep reinforcement learning in large discrete action spaces. arXiv preprint arXiv:1512.07679, 2015.
165
+ Lasse Espeholt, Hubert Soyer, Remi Munos, Karen Simonyan, Vlad Mnih, Tom Ward, Yotam Doron, Vlad Firoiu, Tim Harley, Iain Dunning, Shane Legg, and Koray Kavukcuoglu. IMPALA:
166
+
167
+ Scalable distributed deep-RL with importance weighted actor-learner architectures. In Proceedings of the 35th International Conference on Machine Learning, volume 80, pp. 1407–1416, 2018.
168
+
169
+ Petros Faloutsos, Michiel Van de Panne, and Demetri Terzopoulos. Composable controllers for physics-based character animation. In Proceedings of the 28th annual conference on Computer graphics and interactive techniques, pp. 251–260. ACM, 2001a.
170
+
171
+ Petros Faloutsos, Michiel van de Panne, and Demetri Terzopoulos. The virtual stuntman: dynamic characters with a repertoire of autonomous motor skills. Computers & Graphics, 25(6):933–953, 2001b.
172
+
173
+ Tamar Flash and Binyamin Hochner. Motor primitives in vertebrates and invertebrates. Current opinion in neurobiology, 15(6):660–666, 2005.
174
+
175
+ James J Gibson. The ecological approach to visual perception: classic edition. Psychology Press, 2014.
176
+
177
+ Sten Grillner, Jeanette Hellgren, Ariane Menard, Kazuya Saitoh, and Martin A Wikstrom. Mech- ¨ anisms for selection of basic motor programs–roles for the striatum and pallidum. Trends in neurosciences, 28(7):364–370, 2005.
178
+
179
+ Karol Hausman, Jost Tobias Springenberg, Ziyu Wang, Nicolas Heess, and Martin Riedmiller. Learning an embedding space for transferable robot skills. International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ rk07ZXZRb. accepted as poster.
180
+
181
+ Nicolas Heess, Gregory Wayne, David Silver, Tim Lillicrap, Tom Erez, and Yuval Tassa. Learning continuous control policies by stochastic value gradients. In Advances in Neural Information Processing Systems, pp. 2944–2952, 2015.
182
+
183
+ Nicolas Heess, Greg Wayne, Yuval Tassa, Timothy Lillicrap, Martin Riedmiller, and David Silver. Learning and transfer of modulated locomotor controllers. arXiv preprint arXiv:1610.05182, 2016.
184
+
185
+ Nicolas Heess, TB Dhruva, Srinivasan Sriram, Jay Lemmon, Josh Merel, Greg Wayne, Yuval Tassa, Tom Erez, Ziyu Wang, SM Ali Eslami, et al. Emergence of locomotion behaviours in rich environments. arXiv preprint arXiv:1707.02286, 2017.
186
+
187
+ Daniel Holden, Taku Komura, and Jun Saito. Phase-functioned neural networks for character control. ACM Transactions on Graphics (TOG), 36(4):42, 2017.
188
+
189
+ Auke J Ijspeert, Jun Nakanishi, and Stefan Schaal. Learning attractor landscapes for learning motor primitives. In Advances in neural information processing systems, pp. 1547–1554, 2003.
190
+
191
+ Auke Jan Ijspeert, Jun Nakanishi, and Stefan Schaal. Movement imitation with nonlinear dynamical systems in humanoid robots. In Robotics and Automation, 2002. Proceedings. ICRA’02. IEEE International Conference on, volume 2, pp. 1398–1403. IEEE, 2002.
192
+
193
+ Max Jaderberg, Wojciech M Czarnecki, Iain Dunning, Luke Marris, Guy Lever, Antonio Garcia Castaneda, Charles Beattie, Neil C Rabinowitz, Ari S Morcos, Avraham Ruderman, et al. Humanlevel performance in first-person multiplayer games with population-based deep reinforcement learning. arXiv preprint arXiv:1807.01281, 2018.
194
+
195
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014. URL http://arxiv.org/abs/1412.6980.
196
+
197
+ Jens Kober and Jan Peters. Learning prioritized control of motor primitives. In Learning Motor Skills, pp. 149–160. Springer, 2014.
198
+
199
+ Jens Kober and Jan R Peters. Policy search for motor primitives in robotics. In Advances in neural information processing systems, pp. 849–856, 2009.
200
+
201
+ Jens Kober, Betty Mohler, and Jan Peters. Learning perceptual coupling for motor primitives. In Intelligent Robots and Systems, 2008. IROS 2008. IEEE/RSJ International Conference on, pp. 834–839. IEEE, 2008.
202
+
203
+ George Konidaris, Scott Kuindersma, Roderic Grupen, and Andrew Barto. Robot learning from demonstration by constructing skill trees. The International Journal of Robotics Research, 31(3): 360–375, 2012.
204
+
205
+ 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.
206
+
207
+ Libin Liu and Jessica Hodgins. Learning to schedule control fragments for physics-based characters using deep q-learning. ACM Transactions on Graphics (TOG), 36(3):29, 2017.
208
+
209
+ Libin Liu and Jessica Hodgins. Learning basketball dribbling skills using trajectory optimization and deep reinforcement learning. ACM Transactions on Graphics (TOG), 37(4):142, 2018.
210
+
211
+ Libin Liu, KangKang Yin, Michiel van de Panne, Tianjia Shao, and Weiwei Xu. Sampling-based contact-rich motion control. In ACM Transactions on Graphics (TOG), volume 29, pp. 128. ACM, 2010.
212
+
213
+ Libin Liu, KangKang Yin, Michiel van de Panne, and Baining Guo. Terrain runner: control, parameterization, composition, and planning for highly dynamic motions. ACM Transactions on Graphics (TOG), 31(6):154, 2012.
214
+
215
+ Libin Liu, KangKang Yin, and Baining Guo. Improving sampling-based motion control. In Computer Graphics Forum, volume 34, pp. 415–423. Wiley Online Library, 2015.
216
+
217
+ Josh Merel, Yuval Tassa, Sriram Srinivasan, Jay Lemmon, Ziyu Wang, Greg Wayne, and Nicolas Heess. Learning human behaviors from motion capture by adversarial imitation. arXiv preprint arXiv:1707.02201, 2017.
218
+
219
+ Remi Munos, Tom Stepleton, Anna Harutyunyan, and Marc Bellemare. Safe and efficient off-policy ´ reinforcement learning. In Advances in Neural Information Processing Systems, pp. 1054–1062, 2016.
220
+
221
+ Gerhard Neumann, Christian Daniel, Alexandros Paraschos, Andras Kupcsik, and Jan Peters. Learning modular policies for robotics. Frontiers in computational neuroscience, 8:62, 2014.
222
+
223
+ OpenAI. Openai five. journal=https://blog.openai.com/openai-five/, 2018.
224
+
225
+ Xue Bin Peng, Glen Berseth, KangKang Yin, and Michiel Van De Panne. Deeploco: Dynamic locomotion skills using hierarchical deep reinforcement learning. ACM Transactions on Graphics (TOG), 36(4):41, 2017.
226
+
227
+ Xue Bin Peng, Pieter Abbeel, Sergey Levine, and Michiel van de Panne. Deepmimic: Example-guided deep reinforcement learning of physics-based character skills. arXiv preprint arXiv:1804.02717, 2018.
228
+
229
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
230
+
231
+ Luis Sentis and Oussama Khatib. Synthesis of whole-body behaviors through hierarchical control of behavioral primitives. International Journal of Humanoid Robotics, 2(04):505–518, 2005.
232
+
233
+ Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. arXiv preprint arXiv:1312.6034, 2013.
234
+
235
+ Richard S Sutton, Doina Precup, and Satinder Singh. Between mdps and semi-mdps: A framework for temporal abstraction in reinforcement learning. Artificial intelligence, 112(1-2):181– 211, 1999.
236
+
237
+ Yuval Tassa, Yotam Doron, Alistair Muldal, Tom Erez, Yazhe Li, Diego de Las Casas, David Budden, Abbas Abdolmaleki, Josh Merel, Andrew Lefrancq, et al. Deepmind control suite. arXiv preprint arXiv:1801.00690, 2018.
238
+
239
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. In Intelligent Robots and Systems (IROS), 2012 IEEE/RSJ International Conference on, pp. 5026– 5033. IEEE, 2012.
240
+
241
+ Greg Wayne, Chia-Chun Hung, David Amos, Mehdi Mirza, Arun Ahuja, Agnieszka GrabskaBarwinska, Jack Rae, Piotr Mirowski, Joel Z Leibo, Adam Santoro, et al. Unsupervised predictive memory in a goal-directed agent. arXiv preprint arXiv:1803.10760, 2018.
242
+
243
+ # APPENDICES
244
+
245
+ # A ADDITIONAL TRAINING DETAILS
246
+
247
+ Following Espeholt et al. (2018), all training was done using a distributed actor-learner architecture. Many asynchronous actors interact with the environment to produce trajectories of $\left( { { s _ { t } } , { a _ { t } } , { r _ { t } } , { s _ { t + 1 } } } \right)$ tuples of a fixed rollout length, $N$ . In contrast to Espeholt et al. (2018), each trajectory was stored in a replay buffer. The learner sampled trajectories of length $N$ at random and performed updates. Each actor retrieved parameters from the learner at a fixed time interval. The learner ran on a single Pascal 100 or Volta 100 GPU. The plots presented use the steps processed by the learner on the $\mathbf { X }$ -axis. This is the number of transition retrieved from the replay buffer, which is equivalent to the number of gradient updates $\mathbf { X }$ batch size x rollout length.
248
+
249
+ We performed all optimization with Adam (Kingma & Ba, 2014) and used hyperparameter sweeps to select learning rates and batch sizes.
250
+
251
+ Table 1: Parameters for training the agent on different environments/tasks.
252
+
253
+ <table><tr><td>Task</td><td colspan="6"></td></tr><tr><td></td><td>unroll</td><td>LSTM state size</td><td> value MLP</td><td>gamma</td><td>replay size</td><td></td></tr><tr><td>Go To Target</td><td>10</td><td>128</td><td>(128,1)</td><td>0.99</td><td>106</td><td></td></tr><tr><td>Walls / Gaps</td><td>20</td><td>128</td><td>(128,1)</td><td>0.99</td><td>104</td><td></td></tr><tr><td>Forage</td><td>50</td><td>256</td><td>(200,200,1)</td><td>0.995</td><td>104</td><td></td></tr><tr><td>Heterogeneous Forage</td><td>200</td><td>256</td><td>(200,200,1)</td><td>0.99</td><td>105</td><td></td></tr></table>
254
+
255
+ A.1 SELECTED LOW-LEVEL POLICIES TRAINED FROM MOTION CAPTURE
256
+
257
+ For the switching controller and control fragments approach we used a standard set of four policies trained from motion capture which imitated stand, run, left and right turn behaviors. In the switching controller, pretrained transitions were created in the reference data. For the control fragments approach, we were able to augment the set without any additional work and the selected policies are described in Table 2.
258
+
259
+ Table 2: Selected motion-capture clips for control fragments controller.
260
+
261
+ <table><tr><td>Task</td><td>Selected policies</td><td>Num.control fragments</td></tr><tr><td></td><td></td><td></td></tr><tr><td>Go To Target</td><td>stand,run,left turn, right turn</td><td>105</td></tr><tr><td>Walls Forage</td><td>stand,run,left turn,right turn stand, run,left turn, right turn,</td><td>105 183</td></tr><tr><td></td><td>2 walk and turns</td><td></td></tr><tr><td>Heterogeneous Forage</td><td>stand,run,left turn,right turn, 2 turns and 2 about-face</td><td>359</td></tr><tr><td>Gaps</td><td>stand, run,left turn, right turn, 8 jumps</td><td>359</td></tr></table>
262
+
263
+ # A.2 HETEROGENEOUS FORAGE TASK
264
+
265
+ In the heterogeneous forage task, the humanoid is spawned in a room with 6 balls, 3 colored red and 3 colored green. Each episode, one color is selected at random and assigned a positive value $( + 3 0 )$ or a negative value (-10) and the agent must sample a ball and then only collect the positive ones.
266
+
267
+ # A.3 HIGH-LEVEL CONTROLLER TRAINING DETAILS
268
+
269
+ The architecture of the high-level controller consisted of proprioceptive encoder and an optional image encoder which, along with prior reward and action, were passed to an LSTM. This encoding core was shared with both the actor and critic. The details of the encoder are depicted in Fig. A.1.
270
+
271
+ ![](images/42f07898632084501e84aeba11404b8492ee92bd9cc485cfca2da2af62e2b933.jpg)
272
+ Figure A.1: Complete diagram of high-level agent architecture with encoders.
273
+
274
+ # A.3.1 STEERING CONTROLLER TRAINING DETAILS
275
+
276
+ The steering controller policy head took as input the outputs of the LSTM in Fig. A.1. The policy head was an LSTM, with a state size of 128, followed by a linear layer. The linear layer produced the parameters for a 1-D Gaussian. The $\mu$ parameters were constrained by a tanh and the $\sigma$ parameters were clipped between [0.1, 1].
277
+
278
+ The policy was trained with a SVG(0) update (Heess et al., 2015). A state-action value / Q function was implemented as an MLP with dimensions in Table 1 and trained with a Retrace target. Target networks were used for Q and updated every 100 training iterations.
279
+
280
+ The policy was also updated by an additional entropy cost at each time step, which was added to the policy update with a weight of $1 e ^ { - 5 }$ .
281
+
282
+ # A.3.2 SWITCHING CONTROLLER TRAINING DETAILS
283
+
284
+ The switching controller policy head took as input the outputs of the LSTM in Fig. A.1. The policy head was an LSTM, with a state size of 128, followed by a linear layer to produce the logits of the multinomial distribution.
285
+
286
+ The policy was updated with a policy gradient using $N$ -step empirical returns with bootstrapping to compute an advantage, where $N$ was equivalent to the rollout length in Table 1. The value-function (trained via V-Trace) was used as a baseline.
287
+
288
+ The policy was also updated by an additional entropy cost at each time step, which was added to the policy update with a weight of .01.
289
+
290
+ # A.3.3 DETAILS OF QUERY-BASED ACTION SELECTION APPROACH
291
+
292
+ We train a policy to produce a continuous feature vector (i.e. the query-action), so the selector is parameterized by a diagonal multivariate Gaussian action model. The semantics of the query-action
293
+
294
+ will correspond to the features in the control fragment feature-key vectors, which were partial state observations (velocity, orientation, and end-effector relative positions) of the control fragment’s nominal start or end pose.
295
+
296
+ ![](images/cd6c61e928dee70f58a1eb5aa865ca84638ea0db9f7f842e70489fae05b108b5.jpg)
297
+ Figure A.2: Illustration of query-based control fragment selection in which a query feature vector is produced, compared with key feature vectors for all control fragments, and the Q-value of selecting each control fragment in the current state is used to determine which control fragment is executed.
298
+
299
+ In this approach, the Q function was trained with 1 step returns. So, for samples $\left( { { s _ { t } } , { a _ { t } } , { r _ { t } } , { s _ { t + 1 } } } \right)$ from replay:
300
+
301
+ $$
302
+ \begin{array} { l } { q _ { t a r g e t } = \displaystyle r _ { t } + \gamma \mathbb { E } _ { a \sim \pi ( \cdot | h _ { t + 1 } ) } [ Q ( h _ { t + 1 } , a ) ] } \\ { \ell _ { c r i t i c } = \displaystyle \frac { 1 } { 2 } | | Q ( h _ { t } , a _ { t } ) - q _ { t a r g e t } | | _ { 2 } ^ { 2 } } \end{array}
303
+ $$
304
+
305
+ The total loss is summed across minibatches sampled from replay. Note that for the query-based approach we have query actions which are in the same space as but generally distinct from the reference keys of the control fragments which are selected after the sampling procedure.
306
+
307
+ The high-level policy emits query actions, which are rectified to reference keys by a nearest lookup (i.e. the selected actions). This leads to two, slightly different high-level actions in the same space. This leads to the question of what is the appropriate action on which to perform both policy updates and value function updates.
308
+
309
+ To handle this, it proved most stable to compute targets and loss terms for both the query-actions and selected actions for each state from replay. In this way, a single Q function represented the value of query-actions and selected actions. This was technically an approximation as the training of the Q-function pools these two kinds of action input. Finally, the policy update used the SVG(0)-style update (Heess et al., 2015):
310
+
311
+ $$
312
+ \ell _ { a c t o r } = - \mathbb { E } _ { \xi \sim \mathcal { N } ( 0 , 1 ) } Q ( h _ { t } , a ( h _ { t } , \xi ) )
313
+ $$
314
+
315
+ ![](images/456f1796b93b9f6866c69ba2dd351ab7b81930826d3bf9c2a7775b48bf9b00e1.jpg)
316
+ Figure A.3: Visualization (using PCA) of the actions produced by the trained query-based policy (on go-to-target). Query actions are the continuous actions generated by the policy. Reference keys are the feature vectors associated with the control fragments (here, features of the final state of the nominal trajectory of the fragment). Selected actions are the actions produced by the sampling mechanism and they are overlain to emphasize the control reference keys actually selected. The most prominent feature of this visualization is the lack of precision in the query actions. Note that 45/105 control fragments were selected by the trained policy.
317
+
318
+ We hypothesize that the limited success of this approach is perhaps partly due to the impreciseness in their selectivity (see Fig A.3). After finding these approaches were not working very well, an additional analysis of a trained discrete-selection agent, not shown here, found that the second most preferred control fragment (in a given state) was not usually the control fragment with the most similar reference key. This implies that the premise of the query-based approach, namely that similar fragments should be preferentially confused/explored may not be as well-justified in this case as we speculated, when we initially conceived of trying it. That analysis notwithstanding, we remain optimistic this approach may end up being more useful than we found it to be here.
319
+
320
+ # A.4 END-TO-END CONTROLLER TRAINING DETAILS
321
+
322
+ End-to-end training on each task was performed in a similar fashion to training the low-level controllers. Using the same architecture as in A.1, the policy was trained to output the 56-dimensional action for the position-controlled humanoid. As in the low-level training, the policy was trained with a SVG(0) update (Heess et al., 2015) and Q was trained with a Retrace target. The episode was terminated when the humanoid was in an irrecoverable state and when the head fell below a fixed height.
323
+
324
+ # B SCALING AND FRAGMENT LENGTH
325
+
326
+ We compared performance as a function of the number of fragments as a well as the length of fragments. If using a fixed number of behaviors and cutting them into control fragments of various lengths, two features are coupled: the length of the fragments vs. how many fragments there are. One can imagine a trade-off – more fragments might make exploration harder, but shorter temporal commitment to a fragment may ultimately lead to more precise control. To partially decouple the number of fragments from their length, we also compared performance with functionally redundant but larger sets of control fragments.
327
+
328
+ ![](images/6b289bd44fedf7a27aa9a2f095746ea297dc362f63ca3f305019122c845ad17a.jpg)
329
+ Figure A.4: A. Training was most stable with shorter fragment length (1 / .03 sec or 3 / .09 sec. B. Increasing the number of fragments, by duplicating the original set, did not hurt training performance. C. Additional functionally redundant policies (i.e. 4 vs 8 behaviors, cut into many control fragments) improved training speed, while additional extraneous policies were easily ignored.
330
+
331
+ Ultimately, it appears that from a strict task-performance perspective, shorter control fragments tend to perform best as they allow greatest responsiveness. That being said, the visual appearance of the behavior tends to be smoother for longer control fragments. Control fragments of length 3 (.09 sec) seemed to trade-off behavioral coherence against performance favorably. Hypothetically, longer control fragments might also shape the action-space and exploration distribution favorably. We see a suggestion of this with longer-fragment curves ascending earlier.
332
+
333
+ ![](images/a09f591112df1799327368396e89430b347dc52e552aded2dedf0cdb7036349f.jpg)
334
+ Figure A.5: Transition density between control fragments for a trained agent on Forage. The background colors reflect density of transitions within a clip/behavior class (darker is denser), and single fragment transition densities are overlain as circles where size indicates the density of that particular transition.
335
+
336
+ ![](images/5ad7e4fe5a33b6cfba79dcdb2a7f0b6c8e1c1dedd1459d43c5898d4b665d2803.jpg)
337
+ Figure A.6: We depict a timeseries of the behavior of a trained high-level policy on Forage. In this particular trained agent, it frequently transitions to a particular stand fragment which it has learned to rely on. Green vertical lines depict reward acquisition.
md/train/BJgza6VtPB/BJgza6VtPB.md ADDED
@@ -0,0 +1,276 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LANGUAGE GANS FALLING SHORT
2
+
3
+ Massimo Caccia∗ Mila, Universite de Montr´ eal´ massimo.p.caccia@gmail.com
4
+
5
+ Lucas Caccia∗
6
+ Mila, McGill University
7
+ lucas.page-caccia@mail.mcgill.ca
8
+
9
+ William Fedus Mila, Universite de Montr ´ eal ´ Google Brain, Montreal ´
10
+
11
+ Hugo Larochelle Google Brain, Montreal´ Mila, Universite de Montr ´ eal ´ Canada CIFAR AI Chair
12
+
13
+ Joelle Pineau ¨ Mila, McGill University Facebook AI Research, Montreal´ Canada CIFAR AI Chair
14
+
15
+ Laurent Charlin Mila, HEC Montreal´ Canada CIFAR AI Chair
16
+
17
+ # ABSTRACT
18
+
19
+ Traditional natural language generation (NLG) models are trained using maximum likelihood estimation (MLE) which differs from the sample generation inference procedure. During training the ground truth tokens are passed to the model, however, during inference, the model instead reads its previously generated samples - a phenomenon coined exposure bias. Exposure bias was hypothesized to be a root cause of poor sample quality and thus many generative adversarial networks (GANs) were proposed as a remedy since they have identical training and inference. However, many of the ensuing GAN variants validated sample quality improvements but ignored loss of sample diversity. This work reiterates the fallacy of quality-only metrics and clearly demonstrate that the well-established technique of reducing softmax temperature can outperform GANs on a quality-only metric. Further, we establish a definitive quality-diversity evaluation procedure using temperature tuning over local and global sample metrics. Under this, we find that MLE models consistently outperform the proposed GAN variants over the whole quality-diversity space. Specifically, we find that 1) exposure bias appears to be less of an issue than the complications arising from non-differentiable, sequential GAN training; 2) MLE trained models provide a better quality/diversity tradeoff compared to their GAN counterparts, all while being easier to train, easier to cross-validate, and less computationally expensive.1
20
+
21
+ # 1 INTRODUCTION
22
+
23
+ Generating fluent natural language is a central aim in Natural Language Processing (NLP). Transformer architectures (Vaswani et al., 2017) with hundreds of millions or billions of parameters regularly reestablish state-of-the-art on held-out validation perplexities, however, the generated samples can still often lack coherence. It was hypothesized that exposure bias, differences in the training and inference procedures, is the root cause for poor sample quality. Therefore, numerous GANs (Goodfellow et al., 2014) for text generation were proposed since they do not suffer from exposure bias due a training objective that directly seeks to improve sample quality (to a learned critic).
24
+
25
+ While many of the early GAN variants demonstrated improvements in sample quality (Yu et al., 2017; Guo et al., 2017), they often ignored loss of sample diversity. This is not only a theoretical concern because it is well-documented that GANs exhibit mode collapse (Che et al., 2016; Salimans et al., 2016) where the generator produces a subset of the ”modes” in the training data, reducing diversity. Evaluating generated samples remains challenging (Liu et al., 2016; Zhao et al., 2017), but C´ıfka et al. (2018) recommends assessing generated samples along two dimensions: 1) the quality of each sentence; 2) the diversity across sentences. However, this too is problematic because now the assessment relies on two measures which can make it difficult to compare models. Without further information about the relative trade-off between the two dimensions it is impossible to claim which is superior (Figure 1, left subplot).
26
+
27
+ ![](images/1f29a04568f394bf533ee075c77fc1d4392323e684e74043cba15e4eda162d36.jpg)
28
+ Figure 1: The importance of temperature for evaluating NLG models on quality and diversity. Each sub-figure plots inverse quality against inverse diversity (lower is better for both metrics). Left: current way of comparing NLG models. In this case, it is impossible to come to any meaningful conclusions about which model (red or blue) dominates the other. Middle: With our proposed NLG evaluation framework, the temperature sweep shines a light on the relative performance of the models: the red model should be used for high-diversity samples and the blue model for high-quality samples. Right: A second simulated scenario (consistent with the left Figure) where the temperature sweep reveals that the blue model dominates the red. That is, for any desired diversity-level, there is a temperature for which the blue model outperforms the red in terms of quality (and vice versa).
29
+
30
+ In this work, we build on the natural relationship between a model’s softmax temperature and the resultant quality-diversity trade-off: lower temperatures generate less diverse, higher-quality samples; higher temperatures increase the entropy of the distribution and produce more diverse, lower-quality samples. We propose a temperature sweep as a computationally efficient method to characterize the quality-diversity trade-off of different models. By explicitly controlling the temperature we remove a potential source of bias (models may have different ”implicit” temperatures) and obtain a more complete understanding of each model’s behavior (Figure 1 middle and right).
31
+
32
+ Additionally, we address that temperature modulation changes the entropy of the conditional distributions, as opposed to changing the entropy of the joint distribution. We explore other ways to navigate the quality-diversity space with less bias, including stochastic beam search and generator rejection. Although these methods provide small gains in the quality-diversity trade-off they have other computational limitations.
33
+
34
+ Despite the dizzying array of text-GAN variants and algorithms (Yu et al., 2017; Che et al., 2017; Lin et al., 2017; Zhang et al., 2017; Guo et al., 2017; Fedus et al., 2018; Lu et al., 2018a; Shi et al., 2018; Xu et al., 2018; Chen et al., 2018; Nie et al., 2019; d’Autume et al., 2019) our conclusions using temperature sweeps are clear: MLE models still dominate GANs. According to all metrics we studied, changing the temperature of MLE models at generation time leads to a better qualitydiversity trade-off compared to GANs. This evaluation technique provides a definitive boundary for future GAN research and our hope is that it will help the NLP community accurately assess natural-language generation progress.
35
+
36
+ # 2 ADVERSARIAL TEXT GENERATION
37
+
38
+ GANs are implicit generative models learned via a competition between a generator network $G _ { \theta }$ and a discriminator network $D _ { \phi }$ . The generator network $G _ { \theta }$ produces samples from a probability distribution $p _ { m o d e l } ( x )$ . The discriminator $D _ { \phi } ( x )$ attempts to distinguish whether an input value $x$ is real (training data) or generated. Mathematically, the GAN objective can be formulated as a minimax game
39
+
40
+ $$
41
+ \mathcal { L } = \underset { \theta } { m i n } \ : m a x \ : \mathbb { E } _ { { x } \sim { p _ { d a t a } } } [ \log D _ { \phi } ( x ) ] + \mathbb { E } _ { { x } \sim { G _ { \theta } } } [ 1 - \log D _ { \phi } ( x ) ]
42
+ $$
43
+
44
+ GANs were first proposed for continuous domains since their training procedure differentiates through the discriminator into the generator. However, modeling text, which is both discrete and typically modeled sequentially requires a challenging adaptation for GANs which, in their original formulation, were built upon “one-shot” continuous data. Discrete (sequential) data require an alternative approach. Yu et al. (2017) estimate the gradient to the generator via REINFORCE policy gradients (Williams, 1992). In their formulation, the discriminator evaluates full sequences. Therefore, to provide error attribution earlier for incomplete sequences and to reduce the variance of gradients, they perform $k$ Monte-Carlo rollouts until the sentence is completed.
45
+
46
+ Yu et al. (2017) advertise their model using two tasks which we argue (with hindsight) are flawed. First, they introduce a synthetic evaluation procedure where the underlying data distribution $P$ is known and can be queried. By representing $P$ with an LSTM (referred to as an oracle in the literature), they directly compute the likelihood of samples drawn from a generative model $G _ { \theta }$ . The issue is that they benchmark models against each other on this likelihood alone, i.e., the diagnostic is entirely blind to diversity. For example, a model that always outputs the same highly likely sequence would easily outperform other potentially superior models. For real data, there was no agreed-upon metric to evaluate the quality of unconditional NLG at the time. This led the authors to propose a new metric, Corpus-level BLEU, which computes the fraction of n-grams in a sample that appears in a reference corpus. Again, this metric is agnostic to diversity. Generating a single good sentence over and over will give a perfect BLEU score.
47
+
48
+ This paper sparked a stream of works that adopt their evaluation framework. Notably, RankGAN (Lin et al., 2017), MaliGAN (Che et al., 2017), TextGAN (Zhang et al., 2017), LeakGAN (Guo et al., 2017) and IRL-GAN (Shi et al., 2018) were proposed soon after.
49
+
50
+ All but one of the aforementioned papers evaluate sample quality alone. As a remedy, Zhu et al. (2018) propose a metric that compares a generated sentence with a corpus of generated sentences, called Self-BLEU. They, along with Lu et al. (2018b), provide an extensive comparison of GANs using quality (negative BLEU) and diversity (Self-Bleu). However, it is not clear which algorithm is superior, as evidenced by Figure 2, because no model simultaneously outperforms the other on both metrics. It is now standard for language GANs to evaluate simultaneously quality and diversity.
51
+
52
+ GANs Trained without RL Reinforcement Learning (RL) is often difficult to optimize, unstable, and sensitive to hyperparameters. Because of this, GAN-variants have recently been
53
+
54
+ ![](images/1266ec0367a09686c0920c0bbaec46286e697474e8954caf2cf263765da54f5c.jpg)
55
+ Figure 2: Negative BLEU-5 versus SBLEU5 (lower is better for both metrics) on the EMNLP2017 News dataset taken from (Lu et al., 2018b) and this work (train data and FM-GAN). These scatter plots do not clearly show which algorithm is preferred since none strictly dominates on both metrics simultaneously.
56
+
57
+ proposed that eschew RL-techniques in favor of fully-differentiable objectives. Cooperative training (CoT) (Lu et al., 2018a) and feature mover GAN (FM-GAN) Chen et al. (2018) are notable approaches.
58
+
59
+ Research in both RL and non-RL GANs is still very active (e.g., Xu et al. (2018); Nie et al. (2019); d’Autume et al. (2019); Li et al. (2019); Gagnon-Marchand et al. (2019)) and so our review is not exhaustive.
60
+
61
+ # 3 TEMPERATURE SWEEP: TOWARDS ROBUST NLG EVALUATION
62
+
63
+ During natural language generation, a single spurious sampled token can lead to an overall lowquality and incoherent sequence. In other words, a high-entropy conditional distribution may result in poor sample quality at inference. To address this problem, one can modulate the entropy of $G _ { \theta } \mathbf { \bar { ( } } x _ { t } \mid x _ { 1 : t - 1 } \mathbf { \bar { ) } }$ with a Boltzmann temperature parameter $\alpha$ (Ackley et al., 1988). If $o _ { t }$ is the generator’s pre-logit activation and $W$ is the word embedding matrix, then the conditional distribution of the generator is given by $G _ { \theta } ( x _ { t } \mid x _ { 1 : t - 1 } ) = \operatorname { s o f t m a x } ( o _ { t } \cdot W / \alpha )$ . Decreasing $\alpha$ below 1.0 will increase $o _ { t }$ and thus decrease the entropy of $G$ ’s conditional probability. Temperature tuning naturally moves the model in quality/diversity space. We demonstrate this in Table 1.
64
+
65
+ # α Samples
66
+
67
+ <table><tr><td colspan="2">2.0 (1) If you go at watch crucial characters putting awareness in Washington ,forget there are now unique developments organized personally then why charge .</td></tr><tr><td></td><td>(2)Front wants zero house blood number places than above spin 5 provide school projects which youth particularly teenager temporary dollars plenty of investors enjoy headed Japan about if federal assets own,at 41 .</td></tr><tr><td>1.0 this point .</td><td>(1) Researchers are expected to comment on where a scheme is sold , but it is no longer this big name at (2) We know you ’re going to build the kind of home you ’re going to be expecting it can give us a better understanding of what ground test we’re on this year ,he explained .</td></tr><tr><td>0.7</td><td>(1) The other witnesses are believed to have been injured ,the police said in a statement ,adding that there was no immediate threat to any other witnesses . (2) The company ’ s net income fell to 5 .29 billion ,or 2 cents per share ,on the same period last year .</td></tr><tr><td>0.0</td><td>(1) The company’s shares rose 1.5 percent to 1.81 percent,the highest since the end of the year. (2) The company ’s shares rose 1 . 5 percent to 1 .81 percent,the highest since the end of the year .</td></tr></table>
68
+
69
+ Table 1: The effect of temperature on samples from an language model trained via MLE on the EMNLP17 News dataset. At a temperature of $\alpha = 1 . 0$ the samples are syntactically correct but often lack in global coherence. The sample quality varies predictably with temperature. At $\alpha > 1 . 0$ , the syntax breaks down and at $\alpha = 0 . 0$ the model always outputs the same sequence. At $\alpha = 0 . 7$ the samples are both of high quality and of sufficient diversity.
70
+
71
+ The evaluation protocol for NLG explained in Section 2 is to compare models with respect to both quality and diversity metrics. Often this results in a situation where it is impossible to tell which model is superior, as shown in Figure 2 and further exemplified in Figure 1 (Left). One can then control the quality-diversity trade-off of autoregressive text generators using temperature. We can leverage this tool to design a new evaluation framework that shines a light on the real performance of each model. More precisely, we propose to generate samples at s temperatures for each model in order to compute temperature curves in quality-diversity space. This is exemplified in Figure 1. We refer to this procedure as temperature sweep. This new way of evaluating NLG models allows practitioners to answer questions such as: which model to use if interested in high quality (or diversity) samples? Does a new model improve upon others in the quality/diversity space or is it just reducing the entropy of the distribution? It could also be leveraged as a cross-validation tool e.g., early-stop once the best temperature curve is achieved according to a heuristic.
72
+
73
+ In the next section we show, using temperature sweep, that MLE models consistently outperform the new proposed GAN variants everywhere in the quality-diversity space. MLE performs equally on synthetic data to CoT and outperforms it on real data, whilst being computationally and algorithmically less complicated. Our results are further validated in independent follow-up works (d’Autume et al., 2019; Alihosseini et al., 2019)where temperature sweeps show MLE outperforming GANs.
74
+
75
+ To implement temperature sweep we have taken advantage of the fact that our model factorizes the joint distribution over an observation as a product of conditional distributions over single tokens given all previous tokens (this is a property of most autoregressive neural networks). We change the temperature of these conditionals, which is straightforward to implement. However, this is different from changing the temperature of the joint probability distribution. The samples generated in this way are biased towards having lower entropy at the beginning of sentences compared to samples obtained by changing the entropy of the joint distribution. Changing the entropy of the joint distribution quickly becomes intractable with respect to vocabulary size and/or the total number of timesteps. We show below some entropy reducing techniques are less biased than changing the temperature of the conditionals and might achieve a better quality-diversity trade-off. However, we argue that theses methods aren’t suitable for our evaluation protocol due to computational inefficiency (see Section 5.4).
76
+
77
+ Stochastic Beam Search is a popular approximate decoding technique. It is computationally expensive but leads to higher-likelihood samples than greedy decoding. Here, we focus on its stochastic version (not to be confused with the locally optimal one local beam search). In Stochastic beam search with beam size $k$ , the $k$ most likely hypotheses (sampled so far) are kept at every decoding steps. In Appendix A, we detail this technique and explain how it is less biased than temperature tuning regarding the reduction of the joint distribution’s entropy. Finally, the more traditional local (deterministic) beam search removes all sample diversity and is not useful in our setting.
78
+
79
+ Generator Rejection Sampling works as follow: generate some sentences; compute their likelihood under the generator’s own distribution; accept/reject the sample given a threshold. The threshold enables the practitioner to modulate the quality-diversity trade-off. In Appendix B, we explain how it is less biased than temperature tuning, why it is computationally expensive, and how the discriminator can be used in rejection sampling.
80
+
81
+ # 4 RELATED WORK
82
+
83
+ Concurrent with our work, Semeniuta et al. (2018) demonstrated the issues of local n-gram metrics. Their extensive empirical evaluation of GAN models and language models (LM) did not result in evidence of GAN-trained models outperforming on the new and improved global metrics from C´ıfka et al. (2018). Our analysis further explores this path by examining the performance of these models under a sweep of temperatures. We believe this difference to be of utmost importance, as it is the necessary ingredient towards definitively showing MLE models outperform current GAN variants on quality-diversity global metrics. Work from Ott et al. (2018) thoroughly examines the local beam search strategy for neural machine translation. In their analysis, the authors compare local beam search and generator rejection sampling and find the beam search is quite effective at finding highlikelihood regions. However, their work focuses on conditional text generation, where quality-only metrics measures performance.
84
+
85
+ Guo et al. (2017) suggest that increasing the temperature at training time leads to more diverse samples. However, we argue that this procedure leads to the opposite outcome as a model can adapt to the temperature change. This would have the net result of lowering the entropy at test time. We discuss this issue and propose a study in Appendix F.
86
+
87
+ # 5 EMPIRICAL RESULTS
88
+
89
+ Using our evaluation approach (Section 3), we examine several recent GAN text generation models and compare against an MLE baseline. The experiments consist of two parts: synthetic data generation and long-text generation. We provide strong empirical evidence for both types of data that MLE trained models reliably outperform textual GANs in the quality-diversity space. For these experiments, we only use temperature tuning, as it is the only technique that gives a smooth control over said trade-off whilst being computationally efficient (see Section 5.4).
90
+
91
+ # 5.1 EXPERIMENTAL DETAILS
92
+
93
+ The ever-growing body of RL trained language GANs makes writing, running hyperparameter searches and cross-validations on all the variants prohibitively expensive.2 We implemented our own language GAN, including improvements/functionalities proposed in several text GAN papers. We ensure that each functionality can be toggled during training. Then for each dataset, we ran a hyperparameter search of 300 trials encompassing all possible combinations of said functionalities. We refer to this model as RL-GAN. It is based on SeqGAN (Yu et al., 2017) with additional improvements shown to be useful including: MLE pretraining (Yu et al., 2017), leaky discriminator (Guo et al., 2017), step-level loss instead of sequence level (Fedus et al., 2018), learned baseline to reduce variance (Fedus et al., 2018), regularizing REINFORCE with a maximum-entropy loss (Williams & Peng, 1991) and alternating adversarial loss with MLE loss (Guo et al., 2017).
94
+
95
+ Through comparisons with previously reported results and results obtained via running the official repositories, we show that RL-GAN is the state-of-the-art RL trained GAN. Our MLE model is trained with the same codebase (adversarial training turned off) and only one-sixth of the trials. Moreover, we report SeqGAN and LeakGAN results in the synthetic data experiment. These were obtained with the official repositories that we modified in order to obtain samples at different temperatures. Finally, the SeqGAN, LeakGAN, RankGAN, and MaliGAN results in Figure 4a are taken from (Lu et al., 2018b), which was written by the authors of SeqGAN and LeakGAN.
96
+
97
+ Finally, we conducted experiments differently for non-RL GANs. The CoT (Lu et al., 2018a) results are obtained with the official repository via a careful hyperparameter search guided by a discussion with the authors. The FM-GAN (Chen et al., 2018) results were obtained with the best performing model that was provided by the authors.
98
+
99
+ Selecting temperature sweep range. We describe how we selected the range of temperatures in the temperate sweeps. We found that in practice, both the quality and the diversity axes induce bounds beyond which results are non-informative. On the diversity dimension, we found no value in increasing the entropy of the MLE model because minimizing the forward KL does not lead to an underestimation of the real data entropy. Hence, we decreased the temperatures of the other models until a similar diversity to the MLE model was reached. On the quality dimension, we decreased the temperatures to $\alpha = 0$ but did not report the complete curves for the following reasons. First, with synthetic data (Figure 3) the $N L L _ { t e s t }$ explodes when diversity is decreased too much, so we reduce the temperature of the MLE model until the difference in performance compared to the GAN results was evident. Second, in the real data in Figure $^ { 4 \mathrm { b } }$ , we stopped decreasing the temperature when the models achieved a Reverse LM score equal to the perplexity achieved by a 1-gram (unigram) model. This means that the generated dataset is almost non-informative for the (Reverse) language model to learn on i.e., it is as informative as counting tokens. This also coincides with severe mode collapse and a temperature of $< 0 . 5$ for the MLE model. In Figure 4a, we once more decreased the temperature until the difference in performance of MLE with respect to the other models is unambiguous.
100
+
101
+ Table 2: NLLoracle measured on the synthetic task (lower is better). All results are taken from their respective papers. An MLE-trained model with reduced temperature easily improves upon these GAN variants, producing the highest quality sample.
102
+
103
+ <table><tr><td>Model</td><td>NLLoracle</td></tr><tr><td>SeqGAN(Yu et al., 2017) RankGAN (Lin et al., 2017) LeakGAN (Guo et al., 2017)</td><td>8.74 8.25 7.04</td></tr><tr><td>IRL (Shi et al., 2018)</td><td>6.91</td></tr><tr><td>MLE(α = 1.0) MLE (α = 0.4)</td><td>9.40</td></tr><tr><td>MLE (α = 0.001)</td><td>5.50 4.58</td></tr></table>
104
+
105
+ ![](images/89a710e6ced3625a11e248fec87dfeea71ca3e21b27c78876d09e52ce012345c.jpg)
106
+ Figure 3: Effect of temperature tuning on the global metrics (lower is better for both metrics) for the synthetic task.
107
+
108
+ # 5.2 SYNTHETIC DATA EXPERIMENT
109
+
110
+ In the synthetic experiment, we learn a generative model of data produced from a fixed LSTM oracle Yu et al. (2017) with a hidden dimension of 32 with parameters drawn from a standard normal distribution. This allows us to compute a perfect quality metric, the likelihood under the Oracle $\mathrm { N L L } _ { o r a c l e }$ . In Table 2, we see that artificially reducing the temperature at inference achieves stateof-the-art as evaluated by the ${ \mathrm { N L L } } _ { o r a c l e }$ . As we and others have argued, evaluating quality alone is misleading. The MLE-trained model with extremely low temperature will repeatedly output only a single sequence. It is therefore essential to evaluate the resulting sample diversity which we evaluate using the log-likelihood that a generator assigns to held-out data $( N L L _ { t e s t } )$ ). We report the result of a temperature sweep in Figure 3.
111
+
112
+ ![](images/f993cd4f5146404c29140048f94bea8ae21c0b90b29d10bb16d319d9b644b653.jpg)
113
+ Figure 4: Results on the EMNLP 2017 News dataset. (lower is better for all metrics). MLE under a temperature sweep achieves better quality-diversity trade-off compared to the GAN approaches.
114
+
115
+ Our RL-GAN benchmark is superior to the official SeqGAN and LeakGAN implementations. Nonetheless, MLE outperforms GANs everywhere in the quality-diversity space. Semeniuta et al. (2018) suggest that the best-performing GANs tend to stay close to the solution given by maximumlikelihood training. We find support for this conclusion, as the best performing RL-GAN models have the smallest learning rate and a considerable amount of pretraining. CoT achieves similar performance to MLE, but with dramatically increased algorithmic complexity. This is unsurprising as their objectives are somewhat similar (see Section 4). Alihosseini et al. (2019) replicated this experiment on synthetic data and arrived at the same conclusions.
116
+
117
+ # 5.3 LONG-TEXT GENERATION
118
+
119
+ Next, we study long-text generation using EMNLP News 2017. We first compare an MLE model to the reported GAN results on the local metrics Negative BLEU and Self-BLEU. Negative BLEU5 and SBLEU-5 are used for Figure 4a and results for (Self-)BLEU-2 to (Self-)BLEU-4 are reported in Appendix D. Again, the conclusions are the same: MLE outperforms all RL GANs considered in the quality-diversity trade-off. Moreover, MLE outperforms FM-GAN, the state-of-the-art non-RL Language GAN. Note that the FM-GAN results were obtained with a combination of temperature tuning and noise reduction in order to achieve the best possible results. We provide additional details in Appendix H. We compare MLE to GANs using recently proposed global metrics, the Language Model score (quality) and Reverse Language Model score (diversity+quality) (C´ıfka et al., 2018; Semeniuta et al., 2018). See Figure 4b for a comparison of the training scheme in quality-diversity space. The conclusion is the same as with BLEU and Self-BLEU: MLE outperforms all GANs everywhere in the quality-diversity space. Further results on this dataset as well as on the IMDB movie reviews (Maas et al., 2011) and WikiText-103 (Merity et al., 2016) datasets are presented in independent follow-up works (d’Autume et al., 2019; Alihosseini et al., 2019) where MLE is also shown to outperform GANs using temperature sweeps.
120
+
121
+ # 5.4 EMPIRICAL REMARKS
122
+
123
+ These findings are illustrative: a body of research is predicated on exposure bias as the culprit for poor sample quality. Therefore, under this hypothesis, MLE should be at its weakest on long-text generation tasks. However, our results are evidence that exposure bias is less of an issue than optimization problems arising from GAN training combined with the non-differentiability of the original objective function. There is also another way to interpret these results. It seems that MLE (pre)training leaves the generator with a better policy according to quality-diversity. However, because GAN training removes entropy from the learned distribution (see Fig. 5 in Appendix ??), which results in high-quality samples, it can lead one to believe that GAN trained models are superior.
124
+
125
+ ![](images/03979eb1832a55dff2d4982a15dfaed1b86a25a7cf279b10f11963b5118f22fa.jpg)
126
+ Figure 6: Analysis of decoding methods. (lower is better for all metrics). Left: Less biased methods provided a better quality/diversity trade-off. Right: However, they are computationally much more expensive.
127
+
128
+ Methods to approximately reduce the entropy of the joint distribution We analyze the different decoding mechanisms as tools to move in the quality-diversity space and as an alternative to temperature sweep. We evaluate these tools by decoding from the best performing MLE model on the EMNLP2017 News dataset. We also consider the different properties of these tools, including their ability to provide smooth control over the quality-diversity trade-off and their computational efficiency. The purpose of this experiment is thus not to find the best performing strategy i.e., a model combined with a decoding method but rather to compare decoding methods. Further, a comparison between MLE and RL-GAN using these approaches is in Appendix I and it supports our prior results.
129
+
130
+ Figure 6a compares three methods for navigating the quality (Language Model, LM) diversity (Reverse LM) space: temperature sweep, generator rejection,3 and beam search. We first note that temperature tuning and generator rejection sampling yield a similar trade-off in the high-diversity regime. However, as the bias incurred by temperature tuning grows, so does the gap between both methods. An important finding is that generation rejection sampling gets exponentially slower as the threshold increases (see Figure 6b). It is for this reason that the generator rejection sampling curve doesn’t span further in the high-quality part of the space.
131
+
132
+ Beam search, a less biased method, also seems to offer a better trade-off compared to temperature sweep. However, beam search has a major drawback: unitary increases in beam size leads to drastic leaps in qualitydiversity space. In Figure 6a we report beam sizes of 1 (right dot), 2 (middle dot), and 3 (left dot). This study shows that although the less biased methods seem to offer at least small gains in the quality-diversity space, temperature tuning still has important advantages to assess a model’s quality-diversity trade-off efficiently. The discreteness of beam search and the computational inefficacy of generator rejection sampling are important drawbacks. However, if one’s goal is to obtain the best samples possible, we advocate for their use.
133
+
134
+ GAN Training Reduces Entropy Figure 5 shows the evolution of a generator’s entropy with respect to epochs. We observe that as soon as adversarial training starts, a drastic entropy reduction occurs. Future work investigates if GAN training changes the learned distribution or simply reduces the entropy in an ineffective way with respect to the quality-diversity trade-off.
135
+
136
+ ![](images/5f48d48a79b42b8cd8328a508fb1fd72a229c158d24512ded9834936e2917fa1.jpg)
137
+ Figure 5: Dotted line indicates the start of GAN training. We notice a clear drop in entropy (spike in $\mathrm { N L L } _ { t e s t . }$ ) when moving from maximum-likelihood to adversarial updates.
138
+
139
+ # 6 DISCUSSION
140
+
141
+ We demonstrate that well-adjusted language models are a strong baseline and that temperature sweeping can provide an unambiguous characterization of model performance in terms of quality and diversity. A well-adjusted language model outperforms the considered GAN variants as evaluated on both local, and more surprisingly, global metrics of quality and diversity. Our temperature sweeping framework shares characteristics with a Receiver Operating Curve. Analogously, if one needed a single scalar to compare NLG models, one could compute the area under the curve and seek the model with the smallest value (lower is better for our considered metrics).
142
+
143
+ GAN-based generative models have been proven effective on real-valued data. However, there exist many difficult pernicious issues involved in moving to discrete data. These issues must be overcome before they will improve over the strong MLE baselines for unconditional language generation. On the datasets and tasks considered, potential issues caused by exposure bias were less severe than the ones arising from adversarial training combined with learning the non-differentiability of the original objective function. GAN training may prove fruitful eventually, but this research lays forth clear boundaries that it must first surpass.
144
+
145
+ # REFERENCES
146
+
147
+ David H. Ackley, Geoffrey E. Hinton, and Terrence J. Sejnowski. Connectionist models and their implications: Readings from cognitive science. chapter A Learning Algorithm for Boltzmann Machines, pp. 285–307. Ablex Publishing Corp., Norwood, NJ, USA, 1988. ISBN 0-89391-456- 8. URL http://dl.acm.org/citation.cfm?id=54455.54465.
148
+ Danial Alihosseini, Ehsan Montahaei, and Mahdieh Soleymani Baghshah. Jointly measuring diversity and quality in text generation models. In Proceedings of the Workshop on Methods for Optimizing and Evaluating Neural Language Generation, pp. 90–98, 2019.
149
+ Tong Che, Yanran Li, Athul Paul Jacob, Yoshua Bengio, and Wenjie Li. Mode regularized generative adversarial networks. arXiv preprint arXiv:1612.02136, 2016.
150
+ Tong Che, Yanran Li, Ruixiang Zhang, R Devon Hjelm, Wenjie Li, Yangqiu Song, and Yoshua Bengio. Maximum-likelihood augmented discrete generative adversarial networks. arXiv preprint arXiv:1702.07983, 2017.
151
+ Liqun Chen, Shuyang Dai, Chenyang Tao, Dinghan Shen, Zhe Gan, Haichao Zhang, Yizhe Zhang, and Lawrence Carin. Adversarial text generation via feature-mover’s distance. arXiv preprint arXiv:1809.06297, 2018.
152
+ Ondˇrej C´ıfka, Aliaksei Severyn, Enrique Alfonseca, and Katja Filippova. Eval all, trust a few, do wrong to none: Comparing sentence generation models. arXiv preprint arXiv:1804.07972, 2018.
153
+ Cyprien de Masson d’Autume, Mihaela Rosca, Jack Rae, and Shakir Mohamed. Training language gans from scratch. arXiv preprint arXiv:1905.09922, 2019.
154
+ William Fedus, Ian Goodfellow, and Andrew M Dai. Maskgan: Better text generation via filling in the . arXiv preprint arXiv:1801.07736, 2018.
155
+ Jules Gagnon-Marchand, Hamed Sadeghi, Md Akmal Haidar, and Mehdi Rezagholizadeh. Salsatext: self attentive latent space based adversarial text generation. In Canadian Conference on Artificial Intelligence, pp. 119–131. Springer, 2019.
156
+ 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.
157
+ Jiaxian Guo, Sidi Lu, Han Cai, Weinan Zhang, Yong Yu, and Jun Wang. Long text generation via adversarial training with leaked information. arXiv preprint arXiv:1709.08624, 2017.
158
+ Zhongliang Li, Tian Xia, Xingyu Lou, Kaihe Xu, Shaojun Wang, and Jing Xiao. Adversarial discrete sequence generation without explicit neuralnetworks as discriminators. In The 22nd International Conference on Artificial Intelligence and Statistics, pp. 3089–3098, 2019.
159
+
160
+ Kevin Lin, Dianqi Li, Xiaodong He, Zhengyou Zhang, and Ming-Ting Sun. Adversarial ranking for language generation. In Advances in Neural Information Processing Systems, pp. 3155–3165, 2017.
161
+
162
+ 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.
163
+
164
+ Chia-Wei Liu, Ryan Lowe, Iulian V Serban, Michael Noseworthy, Laurent Charlin, and Joelle Pineau. How not to evaluate your dialogue system: An empirical study of unsupervised evaluation metrics for dialogue response generation. arXiv preprint arXiv:1603.08023, 2016.
165
+
166
+ Sidi Lu, Lantao Yu, Weinan Zhang, and Yong Yu. Cot: Cooperative training for generative modeling. https://arxiv.org/pdf/1804.03782.pdf, 2018a.
167
+
168
+ Sidi Lu, Yaoming Zhu, Weinan Zhang, Jun Wang, and Yong Yu. Neural text generation: Past, present and beyond. arXiv preprint arXiv:1803.07133, 2018b.
169
+
170
+ 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 - Volume 1, HLT ’11, pp. 142–150, Stroudsburg, PA, USA, 2011. Association for Computational Linguistics. ISBN 978-1-932432-87-9. URL http://dl.acm.org/citation.cfm?id $=$ 2002472. 2002491.
171
+
172
+ Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. ArXiv, abs/1609.07843, 2016.
173
+
174
+ Weili Nie, Nina Narodytska, and Ankit Patel. RelGAN: Relational generative adversarial networks for text generation. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ rJedV3R5tm.
175
+
176
+ Myle Ott, Michael Auli, David Granger, and Marc’Aurelio Ranzato. Analyzing uncertainty in neural machine translation. arXiv preprint arXiv:1803.00047, 2018.
177
+
178
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In Advances in Neural Information Processing Systems, pp. 2234–2242, 2016.
179
+
180
+ Stanislau Semeniuta, Aliaksei Severyn, and Sylvain Gelly. On accurate evaluation of gans for language generation. arXiv preprint arXiv:1806.04936, 2018.
181
+
182
+ Zhan Shi, Xinchi Chen, Qium Xipeng, and Xuanjing Huang. Towards diverse text generation with inverse reinforcement learning. https://arxiv.org/pdf/1804.11258.pdf, 2018.
183
+
184
+ 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.
185
+
186
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. In Reinforcement Learning, pp. 5–32. Springer, 1992.
187
+
188
+ Ronald J Williams and Jing Peng. Function optimization using connectionist reinforcement learning algorithms. Connection Science, 3(3):241–268, 1991.
189
+
190
+ Jingjing Xu, Xu Sun, Xuancheng Ren, Junyang Lin, Binzhen Wei, and Wei Li. Dp-gan: Diversitypromoting generative adversarial network for generating informative and diversified text. arXiv preprint arXiv:1802.01345, 2018.
191
+
192
+ Lantao Yu, Weinan Zhang, Jun Wang, and Yong Yu. Seqgan: Sequence generative adversarial nets with policy gradient. 2017.
193
+
194
+ Yizhe Zhang, Zhe Gan, Kai Fan, Zhi Chen, Ricardo Henao, Dinghan Shen, and Lawrence Carin. Adversarial feature matching for text generation. arXiv preprint arXiv:1706.03850, 2017.
195
+
196
+ Junbo Jake Zhao, Yoon Kim, Kelly Zhang, Alexander M Rush, and Yann LeCun. Adversarially regularized autoencoders for generating discrete structures. CoRR, abs/1706.04223, 2017.
197
+
198
+ Yaoming Zhu, Sidi Lu, Lei Zheng, Jiaxian Guo, Weinan Zhang, Jun Wang, and Yong Yu. Texygen: A benchmarking platform for text generation models. SIGIR, 2018.
199
+
200
+ # A STOCHASTIC BEAM SEARCH.
201
+
202
+ Beam search is a popular approximate decoding technique. It is computationally expensive but usually leads to higher-likelihood samples than greedy decoding. Here, we focus on its stochastic version, not to be confused with the locally optimal one, Local Beam Search. In Stochastic Beam Search with beam size $k$ , words are sampled sequentially starting from the first one. At the first timestep $k$ words are sampled, each represents a hypothesis. At subsequent timesteps, $k$ next words are sampled conditioned on each of the $k$ current hypotheses, resulting in $k ^ { 2 }$ hypotheses. The $k$ most likely are kept and so on. Because an increase in beam size results in higher-likelihood samples, beam size can be leveraged to modulate the quality-diversity trade-off. Moreover, an infinite beam size would result in sampling the most likely sentences under the generator’s distribution. This is not what we can expect from setting the temperature to 0, which is equivalent to greedy decoding. For this reason, we can hypothesize that Stochastic Beam Search is less biased regarding the reduction of the joint distribution’s entropy. However, unlike temperature tuning, one cannot smoothly trade quality for diversity, as the beam size is a discrete parameter. The more traditional local (deterministic) beam search removes all sample diversity. Thus, it is not useful in our setting.
203
+
204
+ # B GENERATOR REJECTION SAMPLING.
205
+
206
+ Generator Rejection Sampling works as follow: generate some sentences; compute their likelihood under the Generator’s own distribution; accept/reject the sample given a threshold. The threshold enables the practitioner to modulate the quality-diversity trade-off. Similar to Stochastic Beam Search, increasing the threshold to a maximum level would result in always sampling the most likely sentence. We can again hypothesize that this method achieves a better quality-diversity trade-off compared to temperature tuning, since it is not biased towards having sentences with a lower entropy prefix. However, the running time of this procedure increases significantly as the acceptance threshold lowers, as discussed in Section 5.4. We also experimented with a rejection sampling scheme where the score is determined by a discriminator but it did not provide any additional insights.
207
+
208
+ # C QUALITATIVE ANALYSIS OF THE SAMPLES
209
+
210
+ For completeness, we show samples of SeqGAN, LeakGAN, and MLE from both datasets in Table 3. In this experiment, we used the Image COCO dataset (Lin et al., 2014) in order to generate shorter sentences as well. In this case, the samples of all models appear similar. This is because generating captions is a relatively easier task. For the EMNLP2017 News dataset, we would like to point out interesting facts from our samples. In our first sample (1), the model generates the sequence “post Brexit strategy”. This is n-gram is not present in the training set. In our second sample (2), the token “leak” and the n-gram “Freedom of Information request” never appear together in the training dataset. The extrapolations show that the model learns a certain level of generalization beyond the training set. Additional samples are presented further in Appendix J.
211
+
212
+ # D FULL BLEU AND SELF-BLEU RESULTS
213
+
214
+ Full BLEU and Self-BLEU results are shown in Table 4.
215
+
216
+ # E THE LIMITATIONS OF BLEU
217
+
218
+ In this section, we want to highlight an important flaw in using BLEU as a proxy for quality. We tuned the temperature in order to find a MLE model with BLEU score equal to the training data’s. We show three randomly sampled sentences from the model in Table 6. Although sometimes grammatically correct, the samples lack in semantic and/or global coherence. It seems the generated text has poor information content. Surprisingly, in order to get great samples on a consistent basis, the temperature needs to be reduced to a level where BLEU-5 is twice as large as the training data’s. Thus, it seems like BLEU is not always a good proxy of sample quality. Again, we think it is of utmost importance to develop better metrics and modernize NLG’s canonical evaluation framework.
219
+
220
+ <table><tr><td>Datasets</td><td>imageCOCO</td><td>EMNLP2017NeWs</td></tr><tr><td rowspan="2">SeqGAN</td><td>(1)A woman is riding a bike on the street next to a bus.</td><td>(1) You only certainly might not rush it down for those circumstances where we are when they were the heads, and when she&#x27;s name.</td></tr><tr><td>(2)A silver stove,the refrigera- tor, sitting in a kitchen.</td><td>(2) I think you should really really leave for because we hadn&#x27;t been busy, where it goes to one,&quot;he wrote.</td></tr><tr><td rowspan="2">LeakGAN</td><td>(1)A woman holding an um- brella while standing against the sidewalk.</td><td>(1)A man has been arrested at age 28,a resident in Seattle,which was widely reported in 2007.</td></tr><tr><td>(2) A bathroom with a toilet and sink and mirror (1)A narrow kitchenwith</td><td>(2) I also think that&#x27;s a good place for us,I&#x27;m sure that this would be a good opportunity for me to get in touch.</td></tr><tr><td rowspan="2">MLE</td><td>woodencabinetsandwhite appliances .</td><td>(1) The company will be able to provide a post Brexit strategy,which will be published in the coming weeks</td></tr><tr><td>(2) There are several bikes parked in front of a tall building with four cars .</td><td>(2) The leak was obtained by a Freedom of Informa- tion request,which is based on the number of people claiming to be a victim of fraud .</td></tr></table>
221
+
222
+ Table 3: Samples from the different models on Image COCO and EMNLP2017 WMT News. For SeqGAN and LeakGAN, samples were taken from (Guo et al., 2017). It’s the first two samples found in their appendix. For our samples, we reduced the temperature of the model till we achieved similar BLEU scores to the ones reported in (Guo et al., 2017) in order to keep comparison fair.
223
+ Table 4: BLEU (left) and Self-BLEU (right) on test data of EMNLPNEWS 2017. (Higher BLEU and lower Self-BLEU is better).
224
+
225
+ <table><tr><td></td><td colspan="4">BLEU</td><td colspan="4">Self-BLEU</td></tr><tr><td></td><td>2</td><td>3</td><td>4</td><td>5</td><td>2</td><td>3</td><td>4</td><td>5</td></tr><tr><td>Training Data</td><td>0.86</td><td>0.61</td><td>0.38</td><td>0.23</td><td>0.86</td><td>0.62</td><td>0.38</td><td>0.24</td></tr><tr><td>SeqGAN Yu et al. (2017)</td><td>0.72</td><td>0.42</td><td>0.18</td><td>0.09</td><td>0.91</td><td>0.70</td><td>0.46</td><td>0.27</td></tr><tr><td>MaliGAN Che et al. (2017)</td><td>0.76</td><td>0.44</td><td>0.17</td><td>0.08</td><td>0.91</td><td>0.72</td><td>0.47</td><td>0.25</td></tr><tr><td>RankGAN Lin et al. (2017)</td><td>0.69</td><td>0.39</td><td>0.18</td><td>0.09</td><td>0.90</td><td>0.68</td><td>0.45</td><td>0.30</td></tr><tr><td>TextGAN Zhang et al. (2017)</td><td>0.21</td><td>0.17</td><td>0.15</td><td>0.13</td><td>1.00</td><td>0.98</td><td>0.97</td><td>0.96</td></tr><tr><td>LeakGAN Guo et al. (2017)</td><td>0.84</td><td>0.65</td><td>0.44</td><td>0.27</td><td>0.94</td><td>0.82</td><td>0.67</td><td>0.51</td></tr><tr><td>MLE(α=1.25-1)</td><td>0.93</td><td>0.74</td><td>0.51</td><td>0.32</td><td>0.93</td><td>0.78</td><td>0.59</td><td>0.41</td></tr></table>
226
+
227
+ <table><tr><td></td><td colspan="4">BLEU</td><td colspan="4">Self-BLEU</td></tr><tr><td></td><td>2</td><td>3</td><td>4</td><td>5</td><td>2</td><td>3</td><td>4</td><td>5</td></tr><tr><td>Training Data</td><td>0.74</td><td>0.53</td><td>0.34</td><td>0.22</td><td>0.90</td><td>0.75</td><td>0.58</td><td>0.42</td></tr><tr><td>SeqGAN Yu et al. (2017)</td><td>0.75</td><td>0.50</td><td>0.29</td><td>0.18</td><td>0.95</td><td>0.84</td><td>0.67</td><td>0.49</td></tr><tr><td>MaliGAN Che et al. (2017)</td><td>0.67</td><td>0.43</td><td>0.26</td><td>0.16</td><td>0.92</td><td>0.78</td><td>0.61</td><td>0.44</td></tr><tr><td>RankGAN Lin et al. (2017)</td><td>0.74</td><td>0.47</td><td>0.26</td><td>0.16</td><td>0.96</td><td>0.88</td><td>0.76</td><td>0.62</td></tr><tr><td>TextGAN Zhang et al. (2017)</td><td>0.59</td><td>0.46</td><td>0.28</td><td>0.21</td><td>0.94</td><td>0.93</td><td>0.80</td><td>0.75</td></tr><tr><td>LeakGAN Guo et al. (2017)</td><td>0.74</td><td>0.52</td><td>0.33</td><td>0.21</td><td>0.93</td><td>0.82</td><td>0.66</td><td>0.51</td></tr><tr><td>MLE</td><td>0.74</td><td>0.52</td><td>0.33</td><td>0.21</td><td>0.89</td><td>0.72</td><td>0.54</td><td>0.38</td></tr></table>
228
+
229
+ Table 5: BLEU (left) and Self-BLEU (right) on test data of Image COCO. (Higher BLEU and lower Self-BLEU is better).
230
+
231
+ # F ISSUES OF VARYING TEMPERATURE DURING TRAINING
232
+
233
+ As a penultimate experiment, we analyze the effect of changing the temperature at training instead of inference. Guo et al. (2017) suggested that increasing the temperature at training time leads to more diverse samples. However, we argue that this procedure leads to the opposite outcome as a model can adapt to the temperature change. This would have the net result of lowering the entropy at test time. To examine this, we trained 30 GANs maintaining everything constant except training temperature. Negative BLEU-5 against SBLEU-5 are plotted in Figure 7. The darker the dot, the higher the $\alpha$ and consequently the temperature. As we hypothesize, models trained with increased temperature at training time adapted to the change and the net result was a colder temperature at inference (hence reduced diversity). We therefore recommend only adjusting the temperature at inference. One should consider other techniques to facilitate exploration during training.
234
+
235
+ Table 6: Three randomly sampled sentences from our model with closest BLEU scores to the training set’s. The sentences have poor semantics or global coherence. They are also not perfect grammatically speaking.
236
+
237
+ <table><tr><td>MLE</td><td>(1) He explained that the Government’s plan to cut tax on unemployment was 3 . 3 percent lower than forecast for the first increase of 16 percent in 2Oi5 ,the fastest rate in the state since 2004.</td></tr><tr><td>α 1.05-1</td><td>(2) On the policy,it’s no more than the amount of money we have of the decades and Senate of our assets .</td></tr><tr><td></td><td>(3) They say it was possible supporting the Scottish government to make the changes as secret free environment based on competition .</td></tr></table>
238
+
239
+ ![](images/91b6caa2e7dc167f7da5fd190947e5c3a2f25d7bbaf797c357f76e4c98efcc61.jpg)
240
+ Figure 7: Negative BLEU-5 on test data against SBLEU5 for models with different temperature applied at training time. The redder the dot, the higher the $\alpha$ i.e. more pressure to increase entropy. From these results, it is evident that one should not increase the temperature at training time as the models adapts and the net results is mode collapse.
241
+
242
+ # G DISCRIMINATOR REJECTION SAMPLING
243
+
244
+ We experimented with a rejection sampling technique base on the Discriminator’s signal. For this method, we train a Discriminator on the Generator’s samples without ever updating the Generator. Next, we accept/reject samples in a similar fashion to Generator Rejection Sampling however now the score is determined by the Discriminator. The higher the threshold, the more confident the Discriminator needs to be about the realness of the data. This should increase the quality of the samples with the usual downside of reducing diversity. We show results with a Discriminator having the same architecture as the Generator (Discriminator Rejection) and the best Discriminator found with an hyper parameter search of 100 trials (Best Discriminator Rejection. Results are shown in Figure 8. Note that the domain of the figure is much smaller that in Figure 4b. The reason is that this approach can’t move the models further in quality-diversity space. For this reason, we do not advocate for the use of this approach as a means to obtain high quality samples.
245
+
246
+ # H MODULATING QUALITITY/DIVERSITY FOR FM-GAN
247
+
248
+ For FM-GAN, we observed that lowering the temperature to 0 didn’t completely remove all the stochasticity in the generations. This is because FM-GAN samples noise prior to sampling the first word. This is similar to how image generation GANs are trained. Precisely, $z \sim N ( 0 , \bar { 1 } )$ is sampled once and concatenated to every token of a generated sentence. Because temperature tuning wasn’t covering enough of the quality/diversity space, we also reduced the variance of the noise as quality modulating tool. Results are show in Figure 9.
249
+
250
+ ![](images/e309e212e69aaa8ed47938ec5c4c3ac817921d20d1d13903fecbf9d018e29679.jpg)
251
+ Figure 8: Discriminator Rejection Sampling is not a great tool to navigate in quality-diversity space.
252
+
253
+ ![](images/1173e4bf4ab67af100500e2503dc2e9212adadab335f4a7bf267867888552e58.jpg)
254
+ Figure 9: Different strategies to modulate the quality/diversity trade-off in FM-GAN.
255
+
256
+ # I RL-GAN VERSUS MLE WITH OTHER DECODING MECHANISMS
257
+
258
+ ![](images/839e61acf369a8825f1638bcac105d7ee77b6571c9cf07311ec9f339ee16922f.jpg)
259
+ Figure 10: MLE still outperforms RL-GAN under different decoding mechanisms.
260
+
261
+ # J EMNLP 2017 NEWS SAMPLES
262
+
263
+ We present additional samples for EMNLP 2017 News dataset.
264
+
265
+ EMNLP2017 News
266
+ Table 7: Samples from SeqGAN taken from Guo et al. (2017).
267
+
268
+ <table><tr><td>SeqGAN through . I wanted to be made you decided to have a crisis that way up and get some sort of weapon , not much to give birth to for an American room . She had been fined almost 2Oo, OOO with couple of asylum seekers in Syria and Iraq . Perhaps not,in looking for,housing offcials would help the frustration of Government , with an FBI shortly before 2020 . Once we got to real show for the young man since I m sure she went to love it just , whether to be late later last year . But ,after a holiday period we might have to go on a total - out debate like that could have</td><td>You only certainly might not rush it down for those circumstances where we are when they were the heads ,and when she s name . I think you should really really leave for because we hadn t been busy ,where it goes to one,he wrote . All the study knew was that they are ,so they continue to provide support service and it doesn texist . It can say become up with nothing sales have reached the charge for the other any evidence that been virtually well below the $ 800 . Three times before the start of the season is much early on 2O15 we are in the third training every year . That s the idea of strength that decision they said, we haven t already lost four or seven, or Liverpool s team. That is not the time for the cost of changing the system and it was pushing for $2O million We had to take it a good day for a military,but nearly 6 , OOO ] and prepare for them through . I actually didn t tell the background check the difference after my hour was to be recalled ... and it was great . We are thinking about 4O, OOO and jobs in what is wrong in the coming and you know . That is out how working you can t set out some pretty tight... or what I m going</td></tr></table>
269
+
270
+ Table 8: Samples from LeakGAN taken from Guo et al. (2017).
271
+
272
+ <table><tr><td>LeakGAN</td><td>A man has been arrested at age 28 ,a resident in Seattle ,which was widely reported in 2007. I also think that s a good place for us ,I m sure that this would be a good opportunity for me to get in touch . What is the biggest problem for Clinton is that Donald Trump will be in the race and he s unlikely to be the nominee . We re going to do and we re going to put it out and get the ball, he said . I would be afraid to blame the girls to go back but I was just disappointed with the race , he said. I m not going to work together with a different role and we can win the game,he added The couple s lives are still missing and they have been killed in the city s way to play against them ,and because Icame out there . For the last three years ,we ve got a lot of things that we need to do with this is based on the financial markets . Don t ask me ,but I know ,if I ll be able to be out of Hillary Clinton ,I think it s being</td></tr></table>
273
+
274
+ Table 9: Samples from our MLE with temperature to match BLEU scores reported in Guo et al. (2017)
275
+
276
+ <table><tr><td>MLE conservative . economy . police officer . coming weeks. game . for president . The US economy grew at a record low of 1 .6 percent in 2O14 ,and the unemployment rate has fallen by O .9 percent . The new rules are put into the hands of a member of the police ,and the public is not aware of the situation The World Health Organization said a number of people were killed in the attack ,according to the Pentagon . The study also found that women who are not particularly vulnerable to women ’s health</td><td>The UN Security Council is a major concern for the U . S . government , as well as a NATO ally in the Syrian civil war . A spokesman for the Met Ofice said the death toll was only slightly higher than the previous year,according to the report . But I hope that at the end of the day,I’ m going to give her the best chance to go to the gym and go out and play . The man,who cannot be named,said that he had never had sex with him,and he didn ’t want to see him . And it ’s just one of those things that I have to say ,I’m a Democrat ,and I’m a The bank is now the fastest growing market in the world and it is a significant change in the The two men ,aged 2O and 22 ,were arrested and charged with the murder of a man , a The company will be able to provide a post Brexit strategy ,which will be published in the She said she had been on the wrong side of the road and was finally caught in a car accident and was taken to hospital . I don ’ t think he ’ s even a good player ,he said ,but he ’ s got a good chance to win the I don ’t know what the future holds but I’m sure it will be a good thing . It’ s a very important step forward ,and we ’ re going to be able to get the right results . The driver of the vehicle,who was inside the vehicle ,was taken to hospital for treatment , but said he was not aware of the incident . The leak was obtained by a Freedom of Information request ,which is based on the number of people claiming to be a victim of fraud . The former secretary of state has made a major speech in New York , where she ’ s running</td></tr></table>
md/train/BJlLdhNFPr/BJlLdhNFPr.md ADDED
@@ -0,0 +1,501 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EXPLAINING A BLACK-BOX BY USING A DEEP VARIATIONAL INFORMATION BOTTLENECK APPROACH
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Interpretable machine learning has gained much attention recently. Briefness and comprehensiveness are necessary in order to provide a large amount of information concisely when explaining a black-box decision system. However, existing interpretable machine learning methods fail to consider briefness and comprehensiveness simultaneously, leading to redundant explanations. We propose the variational information bottleneck for interpretation, VIBI, a system-agnostic interpretable method that provides a brief but comprehensive explanation. VIBI adopts an information theoretic principle, information bottleneck principle, as a criterion for finding such explanations. For each instance, VIBI selects key features that are maximally compressed about an input (briefness), and informative about a decision made by a black-box system on that input (comprehensive). We evaluate VIBI on three datasets and compare with state-of-the-art interpretable machine learning methods in terms of both interpretability and fidelity evaluated by human and quantitative metrics.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Interpretability is crucial in building and deploying black-box decision systems such as deep learning models. Interpretation of a black-box system helps decide whether or not to follow its decisions, or understand the logic behind the system. In recent years, the extensive use of deep learning black-box systems has given rise to interpretable machine learning approaches (Lipton, 2016; Doshi-Velez & Kim, 2017), which aim to explain how black-box systems work or why they reach certain decisions. In order to provide sufficient information while avoiding redundancy when explaining a black-box decision, we need to consider both briefness and comprehensiveness. However, existing approaches lack in-depth consideration for and fail to find both brief but comprehensive explanation.
12
+
13
+ In order to obtain brief but comprehensive explanation, we adopt the information bottleneck principle (Tishby et al., 2000). This principle provides an appealing information theoretic perspective for learning supervised models by defining what we mean by a ‘good’ representation. The principle says that the optimal model transmits as much information as possible from its input to its output through a compressed representation called the information bottleneck. Then, the information bottleneck will maximally compress the mutual information (MI) with an input while preserving as much as possible MI with the output. Recently, it has been shown that the principle also applies to deep neural networks and each layer of a deep neural network can work as an information bottleneck (Tishby & Zaslavsky, 2015; Shwartz-Ziv & Tishby, 2017). Using this idea of information bottleneck principle, we define a brief but comprehensive explanation as maximally informative about the black-box decision while compressive about a given input.
14
+
15
+ In this paper, we introduce the variational information bottleneck for interpretation (VIBI), a systemagnostic information bottleneck model that provides a brief but comprehensive explanation for every single decision made by a black-box model. VIBI is composed of two parts: explainer and approximator, each of which is modeled by a deep neural network. The explainer returns a probability whether a chunk of features such as a word, phrase, sentence or a group of pixels will be selected as an explanation or not for each instance, and an approximator mimics behaviour of a black-box model. Using the information bottleneck principle, we learn an explainer that favors brief explanations while enforcing that the explanations alone suffice for accurate approximations to a black-box model.
16
+
17
+ # 1.1 CONTRIBUTION
18
+
19
+ Our main contribution is to provide a new framework that systematically defines and generates a ‘good’ (i.e. brief but comprehensive) explanation using the information bottleneck principle. Based on this principle, we develop VIBI that favors a brief but comprehensive explanation. In order to make the objective function of VIBI tractable, we derive a variational approximation to the objective.
20
+
21
+ The benefits of our method are as follows. 1) System-agnostic: VIBI can be applied to explain any black-box system. 2) Post-hoc learning: VIBI is learned in a post-hoc manner, hence there is no tradeoff between task accuracy of a black-box system and interpretability of an explainer. 3) Cognitive chunk: Cognitive chunk is defined as a group of raw features whose identity is understandable to human. VIBI groups non-cognitive raw features such as a pixel and letter into a cognitive chunk (e.g. a group of pixels, a word, a phrase, a sentence) and selects each unit as an explanation. 4) Separate explainer and approximator: The explainer and approximator are designed for separated tasks so that we do not need to limit the approximator to have a simple structure, which may reduce the fidelity (the ability to imitate the behaviour of a black-box) of approximator.
22
+
23
+ # 2 RELATED WORK
24
+
25
+ Most prior interpretable machine learning methods have been focusing on local interpretation, which implies knowing the reasons why a black-box system makes a certain decision at a very local point of interest, and our work is also situated in this line. Existing methods can be categorized into system-specific and system-agnostic method. System-specific methods only explain certain black-box decision systems (e.g. using backpropagation algorithm, or having CNN structure), while system-agnostic methods explain any black-box decision systems.
26
+
27
+ System-specific methods. To measure a change of output with respect to changes of input is an intuitive way of obtaining feature attribution for the output. Using this idea, Zeiler & Fergus (2014), and Zintgraf et al. (2017) observe how outputs change when they make perturbations to each instance. Baehrens et al. (2010); Simonyan et al. (2013), and Smilkov et al. (2017) use computationally more efficient approaches; they measure change of output by propagating contributions through layers of a deep neural network towards an input than the perturbation. However, these approaches fail to detect the changes of output when the prediction function is flattened at the instance (Shrikumar et al., 2017), which leads to interpretations focusing on irrelevant features. In order to solve this problem, the layer-wise relevance propagation (Bach et al., 2015; Binder et al., 2016), DeepLIFT (Shrikumar et al., 2017), and Integrated Gradients (Sundararajan et al., 2017) compare the changes of output to its reference output. Ross et al. (2017) learn a more generalizable model as well as desirable explanations by constraining its explanations (i.e. input gradient) to match domain knowledge.
28
+
29
+ System-agnostic methods. The great advantage of system-agnostic interpretable machine learning methods over system-specific methods is that their usage is not restricted to a specific black-box system. One of the most well-known system-agnostic methods is LIME (Ribeiro et al., 2016). It explains the decision of an instance by locally approximating the black-box decision boundary around the instance with an inherently interpretable model such as sparse linear or decision trees. The approximator is learned by samples generated by perturbing a given instance. Lundberg & Lee (2017) proposed SHAP, a unified measure defined over the additive feature attribution scores in order to achieve local accuracy, missingness, and consistency. L2X (Chen et al., 2018) learns a stochastic map that selects instance-wise features that are most informative for black-box decisions. Unlike LIME and SHAP, which approximate local behaviors of a black-box system with a simple (linear) model, L2X does not put a limit on the structure of the approximator; hence it avoids losing fidelity of the approximator. As SHAP does, Dabkowski & Gal (2017); Fong & Vedaldi (2017), and Petsiuk et al. (2018) use sample perturbation but they rather learn or estimate desired perturbation masks than using perturbed samples to learn an approximator. Dabkowski & Gal (2017), and Fong & Vedaldi (2017) learn a smallest perturbation mask that alters black-box outputs as much as possible. Petsiuk et al. (2018) empirically estimate feature attribution as a sum of random masks weighted by class scores corresponding to masked inputs. Our method VIBI is similar with L2X in that both learn a stochastic explainer that returns a distribution over the subset of features given the input and performs instance-wise feature selection based on that. However, given the same number of explanations, our explainer favors both briefness and comprehensiveness while the L2X explainer favors comprehensiveness of the explanation and does not account for briefness.
30
+
31
+ ![](images/fbf2db11882d4e969a67fd1d897a02970df566a07b36a47064b870cc4071b2ab.jpg)
32
+ Figure 1: Illustration of VIBI. (A) VIBI is composed of two parts: the explainer and approximator. The explainer selects a group of $k$ key cognitive chunks given an instance while the approximator mimics the behaviour of the black-box system using the selected keys as the input. (B) We set each word as a cognitive chunk and $k = 2$ . $\textcircled{1}$ The explainer takes an input $\mathbf { x }$ and returns a stochastic $\mathbf { k }$ -hot random vector $\mathbf { z }$ which indicates whether each cognitive chunk will be selected as an explanation or not. $\textcircled{2} \mathbf { t } ( \mathbf { x } )$ provides instance-specific explanation. $\textcircled{3}$ The approximator takes $\mathbf { t } ( \mathbf { x } )$ as an input and approximates the black-box output.
33
+
34
+ # 3.1 PERSPECTIVE FROM INFORMATION BOTTLENECK PRINCIPLE
35
+
36
+ The information bottleneck principle (Tishby et al., 2000) provides an appealing information theoretic view for learning a supervised model by defining what we mean by a ‘good’ representation. The principle says that the optimal model transmits as much information as possible from the input $\mathbf { x }$ to the output $\mathbf { y }$ through a compressed representation t (called the information bottleneck). The representation t is stochastically defined and the optimal stochastic mapping $p ( \mathbf { t } | \mathbf { x } )$ is obtained by optimizing the following problem with a Markov chain assumption $\mathbf { y } \mathbf { x } \mathbf { t }$ :
37
+
38
+ $$
39
+ p ( \mathbf { t } | \mathbf { x } ) = \operatorname * { a r g m a x } _ { p ( \mathbf { t } | \mathbf { x } ) , p ( \mathbf { y } | \mathbf { t } ) , p ( \mathbf { t } ) } \ I ( \mathbf { t } , \mathbf { y } ) - \beta \operatorname { I } ( \mathbf { x } , \mathbf { t } )
40
+ $$
41
+
42
+ where $\operatorname { I } ( \cdot , \cdot )$ is the MI and $\beta$ is a Lagrange multiplier representing the trade-off between the compressiveness $- \mathrm { I } ( \mathbf { x } , \mathbf { t } )$ and informativeness $\displaystyle \mathbf { I } ( \mathbf { t } , \mathbf { y } )$ of the representation t.
43
+
44
+ We adopt the information bottleneck principle as a criterion for finding brief but comprehensive explanations. Our aim is to learn an explainer generating explanations that are maximally informative about the black-box decision while compressive about a given input.
45
+
46
+ # 3.2 PROPOSED APPROACH
47
+
48
+ We introduce VIBI, a system-agnostic interpretation approach that provides brief but comprehensive explanations for decisions made by black-box decision system. In order to achieve this, we optimize the following information bottleneck objective.
49
+
50
+ $$
51
+ p ( \mathbf { z } | \mathbf { x } ) = \operatorname * { a r g m a x } _ { p ( \mathbf { z } | \mathbf { x } ) , p ( \mathbf { y } | \mathbf { t } ) } \quad \operatorname { I } ( \mathbf { t } , \mathbf { y } ) - \beta \operatorname { I } ( \mathbf { x } , \mathbf { t } )
52
+ $$
53
+
54
+ where $\operatorname { I } ( \mathbf { t } , \mathbf { y } )$ represents the sufficiency of information retained for explaining the black-box output $\mathbf { y }$ , $- \mathrm { I } ( \mathbf { x } , \mathbf { t } )$ represents the briefness of the explanation $\mathbf { t }$ , and $\beta$ is a Lagrange multiplier representing a trade-off between the two. The primary difference between our information bottleneck objective (2) and the one in Tishby et al. (2000) is as follows: the latter aims to identify a stochastic map of the representation $\mathbf { t }$ that itself works as an information bottleneck, whereas our objective aims to identify a stochastic map of $\mathbf { z }$ performing instance-wise selection of cognitive chunks and define information bottleneck as a function of $\mathbf { z }$ and the input $\mathbf { x }$ .
55
+
56
+ As illustrated in Figure 1A, VIBI is composed of two parts: the explainer and the approximator, each of which is modeled by a deep neural network. The explainer selects a group of $k$ key cognitive chunks given an instance while the approximator mimics the behaviour of the black-box system using the selected keys as the input. $k$ controls the level of sparsity in $\mathbf { z }$ . In detail, the explainer $p ( \mathbf { z } | \mathbf { x } ; \pmb { \theta } _ { e } )$ is a map from an input $\mathbf { x }$ to its attribution scores $p _ { j } ( \mathbf { x } ) = p ( \mathbf { z } _ { j } | \mathbf { x } )$ where $j$ is for the $j$ -th cognitive chunk and $\mathbf { Z } _ { j }$ is a binary indicator whether the chunk will be selected or not. The attribution score indicates the probability that each cognitive chunk to be selected. In order to select top $k$ cognitive chunks as an explanation, a $k$ -hot vector $\mathbf { z }$ is sampled from a categorical distribution with class probabilities $p _ { j } ( \mathbf { \bar { x } } ) = p ( \mathbf { z } _ { j } | \mathbf { x } )$ and the $j$ -th cognitive chunk is selected if $z _ { j } = 1$ . More specifically, the explanation $\mathbf { t }$ is defined as follows:
57
+
58
+ $$
59
+ \mathbf { t } _ { i } = ( \mathbf { x } \odot \mathbf { z } ) _ { i } = \mathbf { x } _ { i } \times \mathbf { z } _ { j } ,
60
+ $$
61
+
62
+ where $j$ indicates a cognitive chunk, each of which corresponds to multiple row features $i$ . The approximator is modeled by another deep neural network $p ( \mathbf { y } | \mathbf { t } ; \pmb { \theta } _ { a } )$ , which mimics the black-box decision system. It takes $\mathbf { t }$ as an input and returns an output approximating the black-box output for the instance $\mathbf { x }$ . $\theta _ { a }$ and $\pmb { \theta } _ { e }$ represent the weight parameters of neural networks. The explainer and approximator are trained jointly by minimizing a cost function that favors concise explanations while enforcing that the explanations alone suffice for accurate prediction.
63
+
64
+ To achieve compressiveness, in addition to encouraging small MI between explanations and inputs, we also encourage the number of selected cognitive chunks to be small, i.e., encouraging $\mathbf { z }$ to be sparse. Note that MI and sparsity are two complementary approaches for achieving compression. MI aims at reducing semantic redundancy in explanations. Sparsity cannot achieve such a goal. For example, consider a movie review where "great" occurs a lot and two explanations in judging the sentiment of the review: "great, great" and "great, thought-provoking". They have the same level of sparsity ( $k = 2$ ), but the former has semantic redundancy. In this case, MI helps to choose a better explanation. The first explanation has a larger MI with the input document. The second explanation has smaller MI and hence is more brief and preferable.
65
+
66
+ # 3.2.1 THE VARIATIONAL BOUND
67
+
68
+ The current form of information bottleneck objective is intractable due to the MIs $\displaystyle \mathbf { I } ( \mathbf { t } , \mathbf { y } )$ and $\mathbf { I } ( \mathbf { x } , \mathbf { t } )$ We address this problem by using a variational approximation of our information bottleneck objective. In this section, we summarize the results and refer to Supplementary Material A for details.
69
+
70
+ Variational bound for $\mathbf { I } ( \mathbf { x } , \mathbf { t } )$ : We first show that $\operatorname { I } ( \mathbf { x } , \mathbf { t } ) \leq \operatorname { I } ( \mathbf { x } , \mathbf { z } ) + C$ where $C$ is constant and use the lower bound for $- \mathrm { I } ( \mathbf { x } , \mathbf { z } ) - C$ as a lower bound for $- \mathrm { I } ( \mathbf { x } , \mathbf { t } )$ . As a result, we obtain:
71
+
72
+ $$
73
+ \mathrm { I } ( \mathbf { x } , \mathbf { t } ) \leq \mathrm { I } ( \mathbf { x } , \mathbf { z } ) + C \leq \mathbb { E } _ { ( \mathbf { x } , \mathbf { z } ) \sim p ( \mathbf { x } , \mathbf { z } ) } \left[ \log \frac { p ( \mathbf { z } | \mathbf { x } ) } { r ( \mathbf { z } ) } \right] + C = \mathbb { E } _ { \mathbf { x } \sim p ( \mathbf { x } ) } D _ { \mathrm { K L } } ( p ( \mathbf { z } | \mathbf { x } ) , r ( \mathbf { z } ) ) + C
74
+ $$
75
+
76
+ Note that with proper choices of $r ( \mathbf { z } )$ and $p ( \mathbf { z } | \mathbf { x } )$ , we can assume that the Kullback-Leibler divergence $D _ { \mathrm { K L } } ( p ( \mathbf { z } | \mathbf { x } ) , \bar { r } ( \mathbf { z } ) )$ has an analytical form.
77
+
78
+ Variational bound for $\operatorname { I } ( \mathbf { t } , \mathbf { y } )$ : We obtain the lower bound for $\operatorname { I } ( \mathbf { t } , \mathbf { y } )$ by using $q ( \mathbf { y } \vert \mathbf { t } )$ to approximate $p ( \mathbf { y } \vert \mathbf { t } )$ , which works as an approximator to the black-box system. As a result, we obtain:
79
+
80
+ $$
81
+ \begin{array} { r } { \operatorname { I } ( \mathbf { t } , \mathbf { y } ) \geq \operatorname { \mathbb { E } } _ { ( \mathbf { t } , \mathbf { y } ) \sim p ( \mathbf { t } , \mathbf { y } ) } \left[ \log q ( \mathbf { y } | \mathbf { t } ) \right] = \operatorname { \mathbb { E } } _ { \mathbf { x } \sim p ( \mathbf { x } ) } \operatorname { \mathbb { E } } _ { \mathbf { y } | \mathbf { x } \sim p ( \mathbf { y } | \mathbf { x } ) } \operatorname { \mathbb { E } } _ { \mathbf { t } | \mathbf { x } \sim p ( \mathbf { t } | \mathbf { x } ) } \left[ \log q ( \mathbf { y } | \mathbf { t } ) \right] } \end{array}
82
+ $$
83
+
84
+ where $p ( \mathbf { t } | \mathbf { x } , \mathbf { y } ) = p ( \mathbf { t } | \mathbf { x } )$ by the Markov chain assumption $\mathbf { y } \mathbf { x } \mathbf { t }$ .
85
+
86
+ Combining Equations (3) and (4), we obtain the following variational bound:
87
+
88
+ $$
89
+ \begin{array} { r l } & { \mathbf { I } ( \mathbf { t } , \mathbf { y } ) - \beta \ \mathbf { I } ( \mathbf { x } , \mathbf { t } ) } \\ & { \qquad \geq \mathbb { E } _ { \mathbf { x } \sim p ( \mathbf { x } ) } \mathbb { E } _ { \mathbf { y } | \mathbf { x } \sim p ( \mathbf { y } | \mathbf { x } ) } \mathbb { E } _ { \mathbf { t } | \mathbf { x } \sim p ( \mathbf { t } | \mathbf { x } ) } \left[ \log q ( \mathbf { y } | \mathbf { t } ) \right] - \beta \ \mathbb { E } _ { \mathbf { x } \sim p ( \mathbf { x } ) } D _ { \mathrm { K L } } ( p ( \mathbf { z } | \mathbf { x } ) , r ( \mathbf { z } ) ) + C ^ { * } . } \end{array}
90
+ $$
91
+
92
+ where $C ^ { * } = - C \beta$ can be ignored since it is independent of the optimization procedure. We use the empirical data distribution to approximate $p ( \mathbf { x } , \mathbf { \bar { y } } ) = p ( \mathbf { x } ) p ( \mathbf { y } | \mathbf { x } )$ and $p ( \mathbf { x } )$ .
93
+
94
+ # 3.2.2 CONTINUOUS RELAXATION AND REPARAMETERIZATION
95
+
96
+ Current form of the bound (5) is still intractable because we need to sum over the $\binom { d } { k }$ combinations of feature subsets. This is because we sample top $k$ out of $d$ cognitive chunks where each chunk is assumed drawn from a categorical distribution with class probabilities $p _ { j } ( \mathbf { x } ) = p ( \mathbf { z } _ { j } | \mathbf { x } )$ . In order to avoid this, we use the generalized Gumbel-softmax trick (Jang et al., 2017; Chen et al., 2018). This is a well-known technique that are used to approximate a non-differentiable categorical subset sampling with differentiable Gumbel-softmax samples. The steps are as follows.
97
+
98
+ First, we independently sample a cognitive chunk for $k$ times. For each time, a random perturbation $\mathrm { e } _ { j }$ is added to the log probability of each cognitive chunk $\log p _ { j } ( { \bf x } )$ . From this, Concrete random vector $\mathbf { c } = ( \mathsf { c } _ { 1 } , \cdots , \mathsf { c } _ { d } )$ working as a continuous, differentiable approximation to argmax is defined:
99
+
100
+ $$
101
+ \begin{array} { l l l } { \displaystyle \mathbf { g } _ { j } = - \log \left( - \log \mathbf { e } _ { j } \right) \quad \mathrm { w h e r e } \mathbf { e } _ { j } \sim U ( 0 , 1 ) } \\ { \displaystyle \mathbf { c } _ { j } = \frac { \exp \left( \left( \mathbf { g } _ { j } + \log p _ { j } ( \mathbf { x } ) \right) / \tau \right) } { \sum _ { j = 1 } ^ { d } \exp \left( \left( \mathbf { g } _ { j } + \log p _ { j } ( \mathbf { x } ) \right) / \tau \right) } , } \end{array}
102
+ $$
103
+
104
+ where $\tau$ is a tuning parameter for the temperature of Gumbel-Softmax distribution. Next, we define a continuous-relaxed random vector $\mathbf { z } ^ { \bar { * } } = [ \mathbf { z } _ { 1 } ^ { * } , \cdots , \mathbf { z } _ { d } ^ { * } ] ^ { \top }$ as the element-wise maximum of the independently sampled Concrete vectors $\mathbf { c } ^ { ( l ) }$ where $l = 1 , \cdots , k$ :
105
+
106
+ $$
107
+ \mathbf { z } _ { j } ^ { * } = \operatorname* { m a x } _ { l } \mathbf { c } _ { j } ^ { ( l ) } \ \mathrm { f o r } \ l = 1 , \cdot \cdot \ , k
108
+ $$
109
+
110
+ With this sampling scheme, we approximate the $k$ -hot random vector and have the continuous approximation to the variational bound (5). This trick allows using standard backpropagation to compute the gradients of the parameters via reparameterization.
111
+
112
+ By putting everything together, we obtain:
113
+
114
+ $$
115
+ \frac { 1 } { N L } \sum _ { n } ^ { N } \sum _ { l } ^ { L } \left[ \log q ( y _ { ( n ) } | \mathbf x _ { ( n ) } \odot f ( \mathbf e _ { ( n ) } ^ { ( l ) } , \mathbf x _ { ( n ) } ) ) - \beta D _ { \mathrm { K L } } ( p ( \mathbf z _ { ( n ) } ^ { * } | \mathbf x _ { ( n ) } ) , r ( \mathbf z _ { ( n ) } ^ { * } ) ) \right]
116
+ $$
117
+
118
+ where $N$ is the number of samples, $n$ indicate the $n$ -th sample, $f ( \mathbf { e } _ { ( n ) } ^ { ( l ) } , \mathbf { x } _ { ( n ) } ) = \mathbf { z } _ { ( n ) } ^ { * }$ , $q ( \pmb { y } _ { ( n ) } | \mathbf { x } _ { ( n ) } \odot$ $\mathbf { z } _ { ( n ) } ^ { * } )$ is the approximator to the black-box system and $- D _ { \mathrm { K L } } ( p ( \mathbf { z } ^ { * } | \mathbf { x } _ { ( n ) } ) , r ( \mathbf { z } ^ { * } ) )$ represents the compactness of the explanation. Once we learn the model, the attribution score $p _ { j } ( \mathbf { x } )$ for each cognitive chunk is used to select top $k$ key cognitive chunks that are maximally compressive about the input $\mathbf { x }$ and informative about the black-box decision $\mathbf { y }$ on that input.
119
+
120
+ # 4 EXPERIMENTS
121
+
122
+ We evaluated VIBI on three datasets and compared with state-of-the-art interpretable machine learning methods. The evaluation is performed from two perspectives: interpretability and fidelity. The interpretability indicates the ability to explain a black-box model with human understandable terms. The fidelity implies how accurately our approximator approximates the black-box model. Based on these criteria, we compared VIBI with three state-of-the-art system-agnostic methods (LIME (Ribeiro et al., 2016), SHAP (Lundberg & Lee, 2017) and L2X (Chen et al., 2018)), and a commonly used model-specific method called Saliency Map (Simonyan et al., 2013). For Saliency Map, we used the smooth gradient technique (Smilkov et al., 2017) to get visually sharp gradientbased sensitivity maps over the basic gradient saliency map. See Supplementary Material B for further experimental details.
123
+
124
+ We examined how VIBI performs across different experimental settings varying the number of selected chunks $k$ (amount or number of explanation), size of chunk (unit of explanation), and tradeoff parameter $\beta$ (trade-off between the compressiveness of explanation and information preserved about the output). The settings of hyperparameter tuning include (bold indicate the choice for our final model): the temperature for Gumbel-softmax approximation $\tau - \left\{ 0 . 1 , 0 . 2 , 0 . 5 , \mathbf { 0 } . 7 , 1 \right\}$ , learning rate $- 5 \times 1 0 ^ { - 3 } , 1 0 ^ { \div 3 } , 5 \times 1 0 ^ { - 4 } , 1 0 ^ { - 4 } , 5 \times 1 0 ^ { - 5 } \}$ and $\beta - \{ 0 , 0 . 0 0 1 , \mathbf { 0 . 0 1 } , 0 . 1 , 1 , 1 0 , 1 0 0 \}$ . We use Adam algorithm (Kingma & Ba, 2014) with batch size 100 for MNIST and 50 for IMDB, the coefficients used for computing running averages of gradient and its square $( \beta _ { 1 } , \beta _ { 2 } ) = ( 0 . 5 , 0 . 9 9 9 )$ , and $\epsilon = 1 0 ^ { - 8 }$ . We tuned the hyperparameters via grid search and picked up the hyperparameters that yield the best fidelity score on the validation set. The code is publicly available on GitHub https://github.com/XXX.1
125
+
126
+ # Negative Sentiment if any negative words are found
127
+
128
+ # Positive Sentiment if any positive words are found
129
+
130
+ I do NOT understand why anyone would waste their time or money on utter trash like this … Don't get me wrong -- I LOVE a good Western -- Notice I said "GOOD" -- this is just trash. The acting is horrible -- Val Kilmer must know someone or owed a favor or something for them just to use his face and name in this ridiculous piece of crap... True: Negative / B-Box: Negative
131
+
132
+ I watched this movie when it was released and being really young and not too much into cinema it was one of the most fascinating cinematic experiences I ever had and it really left a mark inside me. At first I didn't quite understand the story and probably failed to … He plays so well the man that falls in love slowly but so deeply with Katherine Clifton, opens up his heart and dives into this prohibited affair…. True: Positive / B-Box: Positive
133
+
134
+ # Negative sentiment but predicted as Positive because several positive words are found
135
+
136
+ The reality of the mafia environment is absolutely dog-eat-dog where a gangster will be killed for showing any sign of weakness because they become a liability. I've got no problem with the human side of gansters' being portrayed but Bugsy steers too far in the direction of soft, comical, men. The film is enjoyable but is only light entertainment and not a biopic of a man who, though exciting, was extremely dangerous and fearsome. The acting's all good and the direction very solid. The locations and era are very well represented and the themes very interesting…. True: Negative / B-Box: Positive
137
+
138
+ Figure 2: The movie reviews and explanations provided by VIBI were randomly selected from the validation set. The selected words are colored red. Each word is used as a cognitive chunk and $k = 5$ words are provided for each review.
139
+
140
+ # 4.1 LSTM MOVIE SENTIMENT PREDICTION MODEL USING IMDB
141
+
142
+ The IMDB (Maas et al., 2011) is a large text dataset containing movie reviews labeled by sentiment (positive/negative). We grouped the reviews into training, validation, and test sets, which have 25,000, 12,500, and 12,500 reviews respectively. Then, we trained a hierarchical LSTM for sentiment prediction, which has two LSTM layers where each layer encodes words and sentences respectively. It achieved $87 \%$ of test accuracy. In order to explain this LSTM black-box model, we applied VIBI. We parameterized the explainer using a bidirectional LSTM and approximator using a 2D CNN. For the details of the black-box model and VIBI architectures, see Supplementary Material B.1.
143
+
144
+ VIBI explains why the LSTM predicts each movie review to be positive/negative and provides instance-wise key words that are the most important attributes to the sentiment prediction. As seen in the top-right and top-left of Figure 2, VIBI shows that the positive (or negative) words pass through the bottleneck and make a correct prediction. The bottom of Figure 2 shows that the LSTM sentiment prediction model makes a wrong prediction for a negative review because the review includes several positive words such as ‘enjoyable’ and ‘exciting’.
145
+
146
+ # 4.2 CNN DIGIT RECOGNITION MODEL USING MNIST
147
+
148
+ ![](images/16e204fb62fd6ff2e0969bd600b3363fb2887571bd2898ed0e22b2a693bb932f.jpg)
149
+ Figure 3: The hand-written digits and explanations provided by VIBI were randomly selected from the validation set. The selected patches are colored red if the pixel is activated (i.e. white) and yellow otherwise (i.e. black). A patch composed of $4 \times 4$ pixels is used as a cognitive chunk and $k = 4$ patches are identified for each image.
150
+
151
+ The MNIST (LeCun et al., 1998) is a large dataset contains $2 8 \times 2 8$ sized images of handwritten digits (0 to 9). We grouped the images into training, validation, and test sets, which have 50,000, 10,000, and 10,000 images respectively, and trained a simple 2D CNN for the digit recognition, which achieved $9 7 \%$ of test accuracy. In order to explain this CNN black-box model, we applied VIBI. We parameterized each the explainer and approximator using a 2D CNN. For the details of the black-box model and VIBI architectures, see Supplementary Material B.2.
152
+
153
+ VIBI explains how the CNN characterizes a digit and recognizes differences between digits. The first two examples in Figure 3 show that the CNN recognizes digits using both shapes and angles. In the first example, the CNN characterizes ‘1’s by straightly aligned patches along with the activated regions although ‘1’s in the left and right panels are written at different angles. Contrary to the first example, the second example shows that the CNN recognizes the difference between $\mathbf { \nabla } ^ { 6 } 9 ^ { \bullet }$ and $\cdot _ { 6 } ,$ by their differences in angles. The last two examples in Figure 3 show that the CNN catches a difference of ‘7’s from ‘1’s by patches located on the activated horizontal line on $\cdot _ { 7 } ,$ (see the cyan circle) and recognizes ‘8’s by two patches on the top of the digits and another two patches at the bottom circle. More qualitative examples for VIBI and the baselines are shown in Supplementary Figure 6.
154
+
155
+ The briefness of explanations also depends on the sparsity $k$ . Supplementary Figure 8 shows how our method works under different sparsity. When we increase $k$ , VIBI tends to select patches that are the same with or nearby previously selected patches and additionally select patches that catch new characteristics of digits.
156
+
157
+ # 4.3 TCR TO EPITOPE BINDING PREDICTION MODEL USING VDJDB AND IEDB
158
+
159
+ ![](images/85d34025a5078ff10133ea49170548edf0c1f8381952ab2257374a3c231c420a.jpg)
160
+ Figure 4: Black-box prediction scores of (A) VDJdb and (B) IEDB. (C) Black-box prediction scores between the matched and unmatched instances from IEDB and (D) those by six epitope sequences. (E) An example of matched explanation (The VIBI selected amino acids are shaded).
161
+
162
+ We next illustrate how VIBI can be used to get insights from a model and ensure the safety of a model in a real world application. Identifying which T-cell receptor (TCR) will bind to a specific epitope (i.e. cancer induced peptide molecules presented by the major histocompatibility complex to T-cells) is important for screening T-cells or genetically engineering T-cells that are effective in recognizing and destroying tumor cells. Therefore, there has been efforts in developing computational methods to predict binding affinity of given TCR-epitope pairs (Jurtz et al., 2018; Jokinen et al., 2019). These approaches rely on known interacting TCR-epitope pairs available from VDJdb (Shugay et al., 2017) and IEDB (Vita et al., 2014), which are the largest databases of several thousand entries. However, the number of unique TCRs harbored in a single individual is estimated to be $1 0 ^ { 1 0 }$ (Lythe et al., 2016) and a theoretical number of epitopes of length $l$ is $2 0 ^ { l }$ , which are much larger than the number of known interacting TCR-epitope pairs.
163
+
164
+ One of the main concerns is whether a black-box model trained on such limited dataset can accurately predict TCR-epitope bindings of out-of-samples. This concern becomes pressing in a TCR-epitope binding prediction model trained on VDJdb (For details of the data, black-box model architecture, and parameter tuning, see Supplementary Material B.3). The model accurately predicted the (in-sample) bindings from VDJdb (recall 0.79, Figure 4A). However, it achieved poor prediction performance when it is used to predict the (out-of-sample) bindings from another dataset, IEDB (recall 0.40, Figure 4B). In an attempt to address this problem, we applied VIBI and determined whether or not to accept a decision made by the black-box model based on VIBI’s explanation. As illustrated in Figure 4E, VIBI provided matched explanations—the identical amino acids in same positions (S and Y in this example) are highlighted in different TCR sequences when they are bound to the same epitope (GILGFVFTL in this example). Moreover, we found that if two TCR sequences binding to the same epitope, each from IEDB and VDJdb, are assigned with matched explanations by VIBI, then it significantly better predicts the binding than the others with no matching TCRs (Figure 4C-D, p-values are shown). Therefore, if a TCR sequence from IEDB has a matched explanation to a TCR from VDJdb, then we safely follow the positive decision made by the black-box model.
165
+
166
+ # 4.4 INTERPRETABILITY EVALUATED BY HUMANS
167
+
168
+ We evaluated interpretability of the methods on the LSTM movie sentiment prediction model and the CNN digit recognition model. For the movie sentiment prediction model, we provided instances that the black-box model had correctly predicted and asked humans to infer the output of the primary sentiment of the movie review (Positive/Negative/Neutral) given five key words selected by each method. Each method was evaluated by the humans on $\bar { \bf M T u r k } ^ { 2 }$ who are awarded the Masters Qualification, high-performance workers who have demonstrated excellence across a wide range of tasks). We randomly selected and evaluated 200 instances for VIBI and 100 instances for the others. Five workers were assigned per instance. For the digit recognition model, we asked humans to directly score the explanation on a 0–5 scale. Each method was evaluated by 16 graduate students at XXX-University3 who have taken at least one graduate-level machine learning class. For each method, 100 instances were randomly selected and evaluated. Four cognitive chunks with the size $4 \times 4$ were provided as an explanation for each instance $\beta = 0 . 1$ for VIBI). On average, 4.26 students were assigned per instance. Further details regarding the experiments can be found in Supplementary Material C.
169
+
170
+ Table 1: Evaluation of interpretability
171
+
172
+ <table><tr><td></td><td>Saliency</td><td>LIME</td><td>L2X</td><td>VIBI (Ours)</td></tr><tr><td>IMDB</td><td>34.2%</td><td>33.8%</td><td>35.6%</td><td>44.7%</td></tr><tr><td>MNIST</td><td>3.448</td><td>1.369</td><td>1.936</td><td>3.526</td></tr></table>
173
+
174
+ For IMDB, the percentage indicates how well the MTurk worker’s answers match the black-box output. For MNIST, the score indicates how well the highlighted chunks catch key characteristics of handwritten digits. The average scores over all samples is shown on a 0 to 5 scale. See the survey example and detailed result in Supplementary Material Tables 3 and 4 for the detailed result.
175
+
176
+ As shown by the Table 1, VIBI better explains the black-box models. When explaining the movie sentiment prediction model, humans better inferred the (correctly predicted) black-box output given the five keywords when they were provided by VIBI. Therefore, it better captures the most contributing key words to the LSTM decision and better explains why the LSTM predicted each movie review by providing five key words. For explaining the digit recognition model, VIBI also highlighted the most concise chunks for explaining key characteristics of handwritten digit. Thus, it better explains how the CNN model recognized each the handwritten digit.
177
+
178
+ # 4.5 FIDELITY
179
+
180
+ Table 2: Evaluation of approximator and rationale fidelity
181
+
182
+ <table><tr><td rowspan="2">k</td><td rowspan="2">chunk size</td><td rowspan="2"></td><td colspan="5">Approximator Fidelity</td><td rowspan="2"></td><td colspan="2">Rationale Fidelity</td></tr><tr><td>Saliency</td><td>LIME</td><td>SHAP</td><td>L2X</td><td>VIBI(Ours)</td><td>L2X</td><td>VIBI(Ours)</td></tr><tr><td rowspan="4">IMDB</td><td>sentence</td><td>1</td><td>38.7 ± 0.9</td><td>72.7 ± 0.8</td><td>49.5 ± 1.0</td><td>87.6± 0.6</td><td>87.7 ± 0.6</td><td></td><td>72.7 ± 0.8</td><td>73.1 ± 0.8</td></tr><tr><td>word</td><td>5</td><td>41.9 ± 0.9</td><td>75.6 ± 0.8</td><td>50.1 ± 1.0</td><td>73.8±0.8</td><td>74.4 ± 0.8</td><td></td><td>63.8 ±0.8</td><td>65.7 ± 0.8</td></tr><tr><td>5 words</td><td>1</td><td>42.4 ± 0.9</td><td>29.0± 0.8</td><td>49.7 ± 1.0</td><td>75.9 ± 0.7</td><td></td><td>76.4 ± 0.7</td><td>60.1 ± 0.9</td><td>63.2 ± 0.8</td></tr><tr><td>5words</td><td>3</td><td>41.4 ± 0.9</td><td>67.9 ± 0.8</td><td>49.1 ± 1.0</td><td></td><td>83.3± 0.7</td><td>83.5 ± 0.7</td><td>69.4 ± 0.8</td><td>66.0± 0.8</td></tr><tr><td rowspan="6">MNIST</td><td>2×2</td><td>16</td><td>91.2 ± 0.6</td><td>77.0 ±0.8</td><td>94.2 ± 0.5</td><td>93.4± 0.5</td><td>94.8 ± 0.4</td><td>73.5± 0.9</td><td></td><td>77.1 ± 0.8</td></tr><tr><td>2×2</td><td>24</td><td>93.8± 0.5</td><td>80.7 ±0.8</td><td>95.4 ± 0.4</td><td></td><td>95.1 ± 0.4</td><td>95.3 ± 0.4</td><td>77.6± 0.8</td><td>85.6 ± 0.7</td></tr><tr><td>2×2</td><td>40</td><td>95.7 ± 0.4</td><td>85.9 ±0.7</td><td>95.4 ± 0.4</td><td>96.7 ± 0.4</td><td></td><td>96.2 ± 0.4</td><td>81.1 ± 0.8</td><td>91.5 ± 0.5</td></tr><tr><td>4×4</td><td>4</td><td>86.3 ± 0.7</td><td>60.9 ±1.0</td><td>94.8 ± 0.4</td><td>95.3 ± 0.4</td><td></td><td>94.8 ± 0.4</td><td>65.0 ± 0.9</td><td>77.5 ± 0.8</td></tr><tr><td>4×4</td><td>6</td><td>90.6± 0.6</td><td>63.7 ± 0.9</td><td>93.6± 0.5</td><td>95.7 ± 0.4</td><td></td><td>95.6 ± 0.4</td><td>51.1 ± 1.0</td><td>70.1 ± 0.9</td></tr><tr><td>4×4</td><td>10</td><td>94.9 ± 0.4</td><td>70.5 ± 0.9</td><td>95.1 ± 0.4</td><td>96.5 ± 0.4</td><td></td><td>96.7 ± 0.4</td><td>83.5±0.7</td><td>93.3 ± 0.5</td></tr></table>
183
+
184
+ Note that the black-box models achieved $87 \%$ accuracy for IMDB and $9 7 \%$ accuracy for MNIST. $\beta = 0 . 1$ for VIBI. Accuracy and 0.95 confidence interval is shown. We performed three runs for each method and reported the best results. See more evaluations using F1-score and further results from different parameter settings in Supplementary Material Table 6 and 8 for approximator fidelity and Table 5 and 7 for rationale fidelity.
185
+
186
+ We assessed fidelity of the methods in approximating the black-box output. First, we compared the ability of the approximators to imitate behaviour of the black-box, denoted as Approximator fidelity.
187
+
188
+ (See Supplementary Material B.4 for details about how each approximator fidelity is evaluated.) As shown in Table 2, VIBI has a better approximator fidelity than Saliency, LIME and SHAP in most cases. VIBI and L2X showed similar levels of approximator fidelity, so we further compared them based on Rationale fidelity. The difference between approximator and rationale fidelity is as follows. Approximator fidelity is quantified by prediction performance of the approximators that takes $\mathbf { t } ^ { * }$ , the continuous relaxation of $\mathbf { t }$ , as an input and the black-box output as a targeted label; rationale fidelity is quantified by using t instead of $\mathbf { t } ^ { * }$ . Note that t only takes the top $k$ chunks and sets the others to be zero, while $\mathbf { t } ^ { * }$ sets the others to be small, non-zero values. Therefore, rationale fidelity allows to evaluate how much information purely flows through the explanations, not through a narrow crack made during the continuous relaxation procedure. As shown in Table 2, VIBI has a better rationale fidelity than L2X in most cases. Note that L2X can be viewed as a special case of VIBI without the compressiveness term, i.e., $\beta = 0$ . The rationale fidelity empirically demonstrates that the compressiveness term can help the information to flow purely through the explanations.
189
+
190
+ # 5 CONCLUSION
191
+
192
+ We employ the information bottleneck principle as a criterion for learning ‘good’ explanations. Instance-wisely selected cognitive chunks work as an information bottleneck, hence, provide concise but comprehensive explanations for each decision made by a black-box system. The information bottleneck framework provides a theoretical background that the bottleneck captures a minimal sufficient statistic, i.e. the most compressed representation that captures all the possible (i.e. sufficient) amount of information about output. For finite $\cdot$ , the bottleneck approximates such a minimal sufficient statistic.
193
+
194
+ However, the way this information is represented may have a substantial effect on interpretability. VIBI helps to address this issue to some extent by always returning a certain form of output (i.e., a $k$ -hot vector z assigned to each chunk) and having a certain form of the information bottleneck layer (i.e., a masked input) so that it makes sure that the explanations are easily understandable to humans. In practice, such a chunking strategy leads to a deviation from the strict theory that a ’good’ explanation is the most compressed one but helps to achieve better interpretability in practice.
195
+
196
+ # REFERENCES
197
+
198
+ Alexander A Alemi, Ian Fischer, Joshua V Dillon, and Kevin Murphy. Deep variational information bottleneck. International Conference on Learning Representations, 2017.
199
+
200
+ Sebastian Bach, Alexander Binder, Grégoire Montavon, Frederick Klauschen, Klaus-Robert Müller, and Wojciech Samek. On pixel-wise explanations for non-linear classifier decisions by layer-wise relevance propagation. PLoS ONE, 10(7):e0130140, 2015.
201
+
202
+ David Baehrens, Timon Schroeter, Stefan Harmeling, Motoaki Kawanabe, Katja Hansen, and KlausRobert Müller. How to explain individual classification decisions. Journal of Machine Learning Research, 11(Jun):1803–1831, 2010.
203
+
204
+ Alexander Binder, Grégoire Montavon, Sebastian Lapuschkin, Klaus-Robert Müller, and Wojciech Samek. Layer-wise relevance propagation for neural networks with local renormalization layers. In International Conference on Artificial Neural Networks, pp. 63–71. Springer, 2016.
205
+
206
+ Jianbo Chen, Le Song, Martin J Wainwright, and Michael I Jordan. Learning to explain: An information-theoretic perspective on model interpretation. International Conference on Machine Learning (ICML), 2018.
207
+
208
+ Thomas M Cover and Joy A Thomas. Elements of information theory. John Wiley & Sons, 2012.
209
+
210
+ Piotr Dabkowski and Yarin Gal. Real time image saliency for black box classifiers. In Advances in Neural Information Processing Systems, pp. 6967–6976, 2017.
211
+
212
+ Finale Doshi-Velez and Been Kim. Towards a rigorous science of interpretable machine learning. arXiv preprint arXiv:1702.08608, 2017.
213
+
214
+ Ruth C Fong and Andrea Vedaldi. Interpretable explanations of black boxes by meaningful perturbation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 3429–3437, 2017.
215
+
216
+ Steven Henikoff and Jorja G Henikoff. Amino acid substitution matrices from protein blocks. Proceedings of the National Academy of Sciences, 89(22):10915–10919, 1992.
217
+
218
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. International Conference on Learning Representations, 2017.
219
+
220
+ Emmi Jokinen, Markus Heinonen, Jani Huuhtanen, Satu Mustjoki, and Harri Lähdesmäki. Tcrgp: Determining epitope specificity of t cell receptors. bioRxiv, pp. 542332, 2019.
221
+
222
+ Vanessa Isabell Jurtz, Leon Eyrich Jessen, Amalie Kai Bentzen, Martin Closter Jespersen, Swapnil Mahajan, Randi Vita, Kamilla Kjærgaard Jensen, Paolo Marcatili, Sine Reker Hadrup, Bjoern Peters, et al. Nettcr: sequence-based prediction of tcr binding to peptide-mhc complexes using convolutional neural networks. bioRxiv, pp. 433706, 2018.
223
+
224
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
225
+
226
+ Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
227
+
228
+ Zachary C Lipton. The mythos of model interpretability. arXiv preprint arXiv:1606.03490, 2016.
229
+
230
+ Scott M Lundberg and Su-In Lee. A unified approach to interpreting model predictions. In Advances in Neural Information Processing Systems, pp. 4765–4774, 2017.
231
+
232
+ Grant Lythe, Robin E Callard, Rollo L Hoare, and Carmen Molina-París. How many TCR clonotypes does a body maintain? Journal of Theoretical Biology, 389:214–224, 2016.
233
+
234
+ 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.
235
+
236
+ Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. In NIPS-W, 2017.
237
+
238
+ Vitali Petsiuk, Abir Das, and Kate Saenko. Rise: Randomized input sampling for explanation of black-box models. The British Machine Vision Conference, 2018.
239
+
240
+ Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. Why should i trust you?: Explaining the predictions of any classifier. In Proceedings of the 22nd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1135–1144. ACM, 2016.
241
+
242
+ Andrew Slavin Ross, Michael C. Hughes, and Finale Doshi-Velez. Right for the right reasons: Training differentiable models by constraining their explanations. In Proceedings of the TwentySixth International Joint Conference on Artificial Intelligence, pp. 2662–2670, 2017.
243
+
244
+ Avanti Shrikumar, Peyton Greenside, and Anshul Kundaje. Learning important features through propagating activation differences. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 3145–3153. JMLR. org, 2017.
245
+
246
+ Mikhail Shugay, Dmitriy V Bagaev, Ivan V Zvyagin, Renske M Vroomans, Jeremy Chase Crawford, Garry Dolton, Ekaterina A Komech, Anastasiya L Sycheva, Anna E Koneva, Evgeniy S Egorov, et al. Vdjdb: a curated database of t-cell receptor sequences with known antigen specificity. Nucleic Acids Research, 46(D1):D419–D427, 2017.
247
+
248
+ Ravid Shwartz-Ziv and Naftali Tishby. Opening the black box of deep neural networks via information. arXiv preprint arXiv:1703.00810, 2017.
249
+
250
+ Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Deep inside convolutional networks: Visualising image classification models and saliency maps. arXiv preprint arXiv:1312.6034, 2013.
251
+
252
+ Daniel Smilkov, Nikhil Thorat, Been Kim, Fernanda Viégas, and Martin Wattenberg. Smoothgrad: removing noise by adding noise. arXiv preprint arXiv:1706.03825, 2017.
253
+
254
+ Mukund Sundararajan, Ankur Taly, and Qiqi Yan. Axiomatic attribution for deep networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 3319–3328. JMLR. org, 2017.
255
+
256
+ Naftali Tishby and Noga Zaslavsky. Deep learning and the information bottleneck principle. In Information Theory Workshop (ITW), 2015 IEEE, pp. 1–5. IEEE, 2015.
257
+
258
+ Naftali Tishby, Fernando C Pereira, and William Bialek. The information bottleneck method. arXiv preprint physics/0004057, 2000.
259
+
260
+ Randi Vita, James A Overton, Jason A Greenbaum, Julia Ponomarenko, Jason D Clark, Jason R Cantrell, Daniel K Wheeler, Joseph L Gabbard, Deborah Hix, Alessandro Sette, et al. The immune epitope database (iedb) 3.0. Nucleic Acids Research, 43(D1):D405–D412, 2014.
261
+
262
+ Matthew D Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In European Conference on Computer Vision, pp. 818–833. Springer, 2014.
263
+
264
+ Luisa M Zintgraf, Taco S Cohen, Tameem Adel, and Max Welling. Visualizing deep neural network decisions: Prediction difference analysis. International Conference on Learning Representations, 2017.
265
+
266
+ # A VARIATIONAL INFERENCE TO CONSTRUCT A LOWER BOUND ON THE IB OBJECTIVE
267
+
268
+ We illustrate the variational approximation of the following information bottleneck objective:
269
+
270
+ $$
271
+ p ( \mathbf { t } | \mathbf { x } ) = \operatorname * { a r g m a x } _ { p ( \mathbf { t } | \mathbf { x } ) , p ( \mathbf { y } | \mathbf { t } ) , p ( \mathbf { t } ) } \ I ( \mathbf { t } , \mathbf { y } ) - \beta \operatorname { I } ( \mathbf { x } , \mathbf { t } )
272
+ $$
273
+
274
+ Let us start with the Markov chain assumption $\textbf { y } \textbf { x } \textbf { t }$ , which also implies $\mathbf { y } \gets \mathbf { x } \gets \mathbf { t }$ . Therefore, the condition is written as $\mathbf { y } \mathbf { x } \mathbf { t }$ (Cover & Thomas, 2012). Using this condition, we factorize the joint distribution $p ( \mathbf { y } , \mathbf { x } , \mathbf { t } )$ :
275
+
276
+ $$
277
+ p ( \mathbf { y } , \mathbf { x } , \mathbf { t } ) = p ( \mathbf { x } ) p ( \mathbf { t } | \mathbf { x } ) p ( \mathbf { y } | \mathbf { t } , \mathbf { x } ) = p ( \mathbf { x } ) p ( \mathbf { t } | \mathbf { x } ) p ( \mathbf { y } | \mathbf { t } )
278
+ $$
279
+
280
+ where $p ( \mathbf { y } \vert \mathbf { t } , \mathbf { x } ) = p ( \mathbf { y } \vert \mathbf { t } )$ by the Markov chain.
281
+
282
+ Now, we will examine each of the expressions in the information bottleneck objective $\mathbf { I } ( \mathbf { t } , \mathbf { y } ) -$ $\beta \operatorname { I } ( \mathbf { x } , \mathbf { t } )$ in turn.
283
+
284
+ # (I) VARIATIONAL LOWER BOUND FOR $\operatorname { I } ( \mathbf { x } , \mathbf { t } )$
285
+
286
+ We first show that $\operatorname { I } ( \mathbf { x } , \mathbf { t } ) \leq \operatorname { I } ( \mathbf { x } , \mathbf { z } ) + C$ where $C$ is a constant and then use the lower bound for $- \mathrm { I } ( \mathbf { x } , \mathbf { z } ) - C$ as a lower bound for $- \mathrm { I } ( \mathbf { x } , \mathbf { t } )$ .
287
+
288
+ First, we prove $\operatorname { I } ( \mathbf { x } , \mathbf { t } ) \leq \operatorname { I } ( \mathbf { x } , \mathbf { z } ) + C$ . From the Markov Chain $\mathbf { x } ( \mathbf { x } , \mathbf { z } ) \mathbf { t }$ , we have $\mathbf { I } ( \mathbf { x } , \mathbf { t } ) \leq$ $\begin{array} { r } { \operatorname { I } ( \mathbf { x } , ( \mathbf { x } , \mathbf { z } ) ) } \end{array}$ . According to the chain rule for mutual information, $\operatorname { I } ( \mathbf { x } , ( \mathbf { x } , \mathbf { z } ) ) = \operatorname { I } ( \mathbf { x } , \mathbf { z } ) + \operatorname { I } ( \mathbf { x } , \mathbf { x } | \mathbf { z } )$ , where $\operatorname { I } ( \mathbf { x } , \mathbf { x } | \mathbf { z } ) = \operatorname { H } ( \mathbf { \bar { x } } | \mathbf { z } ) + \operatorname { H } ( \mathbf { x } | \mathbf { z } ) - \operatorname { H } ( \mathbf { x } , \mathbf { x } | \mathbf { z } )$ . Further, $\mathrm { H } ( \mathbf { x } | \mathbf { z } ) \leq \mathrm { H } ( \mathbf { x } )$ . Putting these pieces together, we have
289
+
290
+ $$
291
+ \mathrm { I } ( \mathbf { x } , \mathbf { t } ) \leq \mathrm { I } ( \mathbf { x } , \mathbf { z } ) + \mathrm { H } ( \mathbf { x } )
292
+ $$
293
+
294
+ where entropy $\mathrm { H } ( \mathbf { x } )$ of input is a constant. For simplicity, we denote it as $C$ .
295
+
296
+ We then approximate $p ( \mathbf { z } )$ using $r ( \mathbf { z } )$ . From the fact that Kullback Leibler divergence is always positive, we have
297
+
298
+ $$
299
+ \begin{array} { r l } & { \mathbb { E } _ { ( \mathbf { x } , \mathbf { z } ) \sim p ( \mathbf { x } , \mathbf { z } ) } \left[ \log p ( \mathbf { z } ) \right] = \mathbb { E } _ { \mathbf { z } \sim p ( \mathbf { z } ) } \left[ \log p ( \mathbf { z } ) \right] } \\ & { \qquad \quad \geq \mathbb { E } _ { \mathbf { z } \sim p ( \mathbf { z } ) } \left[ \log r ( \mathbf { z } ) \right] } \\ & { \qquad = \mathbb { E } _ { ( \mathbf { x } , \mathbf { z } ) \sim p ( \mathbf { x } , \mathbf { z } ) } \left[ \log r ( \mathbf { z } ) \right] . } \end{array}
300
+ $$
301
+
302
+ From (6) and (7), we have
303
+
304
+ $$
305
+ \begin{array} { l } { \displaystyle \mathrm { I } ( \mathbf { x } , \mathbf { t } ) \leq \mathrm { I } ( \mathbf { x } , \mathbf { z } ) + C } \\ { \displaystyle = \mathbb { E } _ { ( \mathbf { x } , \mathbf { z } ) \sim p ( \mathbf { x } , \mathbf { z } ) } \left[ \log \frac { p ( \mathbf { z } | \mathbf { x } ) } { p ( \mathbf { z } ) } \right] + C } \\ { \displaystyle \leq \mathbb { E } _ { ( \mathbf { x } , \mathbf { z } ) \sim p ( \mathbf { x } , \mathbf { z } ) } \left[ \log \frac { p ( \mathbf { z } | \mathbf { x } ) } { r ( \mathbf { z } ) } \right] + C } \\ { \displaystyle = \mathbb { E } _ { \mathbf { x } \sim p ( \mathbf { x } ) } D _ { \mathrm { K L } } ( p ( \mathbf { z } | \mathbf { x } ) , r ( \mathbf { z } ) ) + C . } \end{array}
306
+ $$
307
+
308
+ (II) VARIATIONAL LOWER BOUND FOR $\operatorname { I } ( \mathbf { t } , \mathbf { y } )$
309
+
310
+ Starting with $\operatorname { I } ( \mathbf { t } , \mathbf { y } )$ , we have
311
+
312
+ $$
313
+ \begin{array} { l } { { \displaystyle { \bf { I } } ( { \bf { t } } , { \bf { y } } ) = \mathbb { E } _ { ( { \bf { t } } , { \bf { y } } ) \sim p ( { \bf { t } } , { \bf { y } } ) } \left[ \log \frac { p ( { \bf { y } } , { \bf { t } } ) } { p ( { \bf { y } } ) p ( { \bf { t } } ) } \right] } \ ~ } \\ { ~ = \mathbb { E } _ { ( { \bf { t } } , { \bf { y } } ) \sim p ( { \bf { t } } , { \bf { y } } ) } \left[ \log \frac { p ( { \bf { y } } | { \bf { t } } ) } { p ( { \bf { y } } ) } \right] } \\ { ~ = \mathbb { E } _ { ( { \bf { t } } , { \bf { y } } ) \sim p ( { \bf { t } } , { \bf { y } } ) } \left[ \log p ( { \bf { y } } | { \bf { t } } ) \right] - \mathbb { E } _ { { \bf { y } } \sim p ( { \bf { y } } ) } \left[ \log p ( { \bf { y } } ) \right] } \\ { ~ = \mathbb { E } _ { ( { \bf { t } } , { \bf { y } } ) \sim p ( { \bf { t } } , { \bf { y } } ) } \left[ \log p ( { \bf { y } } | { \bf { t } } ) \right] + \mathrm { { C o n s t . } } } \end{array}
314
+ $$
315
+
316
+ Note that $\mathrm { H } ( \mathbf { y } ) = - \mathbb { E } _ { \mathbf { y } \sim p ( \mathbf { y } ) } \left[ \log p ( \mathbf { y } ) \right]$ is independent of the optimization procedure, hence can be ignored. Now, we use $q ( \mathbf { y } \vert \mathbf { t } )$ to approximate $p ( \mathbf { y } \vert \mathbf { t } )$ which works as an approximator to the black-box system. Using the fact that Kullback Leibler divergence is always positive, we have
317
+
318
+ $$
319
+ \mathbb { E } _ { \mathbf { y } | \mathbf { t } \sim p ( \mathbf { y } | \mathbf { t } ) } \left[ \log p ( \mathbf { y } | \mathbf { t } ) \right] \geq \mathbb { E } _ { \mathbf { y } | \mathbf { t } \sim p ( \mathbf { y } | \mathbf { t } ) } \left[ \log q ( \mathbf { y } | \mathbf { t } ) \right]
320
+ $$
321
+
322
+ and
323
+
324
+ $$
325
+ \begin{array} { r l } & { \mathbf { I ( t , y ) } \geq \mathbb { E } _ { ( \mathbf { t } , \mathbf { y } ) \sim p ( \mathbf { t } , \mathbf { y } ) } \left[ \log q ( \mathbf { y } | \mathbf { t } ) \right] } \\ & { \qquad = \mathbb { E } _ { \mathbf { x } \sim p ( \mathbf { x } ) } \mathbb { E } _ { \mathbf { y } | \mathbf { x } \sim p ( \mathbf { y } | \mathbf { x } ) } \mathbb { E } _ { \mathbf { t } | \mathbf { x } , \mathbf { y } \sim p ( \mathbf { t } | \mathbf { x } , \mathbf { y } ) } \left[ \log q ( \mathbf { y } | \mathbf { t } ) \right] } \\ & { \qquad = \mathbb { E } _ { \mathbf { x } \sim p ( \mathbf { x } ) } \mathbb { E } _ { \mathbf { y } | \mathbf { x } \sim p ( \mathbf { y } | \mathbf { x } ) } \mathbb { E } _ { \mathbf { t } | \mathbf { x } \sim p ( \mathbf { t } | \mathbf { x } ) } \left[ \log q ( \mathbf { y } | \mathbf { t } ) \right] } \end{array}
326
+ $$
327
+
328
+ where $p ( \mathbf { t } | \mathbf { x } , \mathbf { y } ) = p ( \mathbf { t } | \mathbf { x } )$ by the Markov chain assumption $\mathbf { y } \mathbf { x } \mathbf { t }$
329
+
330
+ (III) VARIATIONAL LOWER BOUND FOR $\operatorname { I } ( \mathbf { t } , \mathbf { y } ) - \beta \operatorname { I } ( \mathbf { x } , \mathbf { t } )$
331
+
332
+ In summary, we have the following variational bounds for each term.
333
+
334
+ $$
335
+ \begin{array} { r l } & { \mathrm { I } ( \mathbf { t } , \mathbf { y } ) \geq \mathbb { E } _ { \mathbf { x } \sim p ( \mathbf { x } ) } \mathbb { E } _ { \mathbf { y } \mid \mathbf { x } \sim p ( \mathbf { y } \mid \mathbf { x } ) } \mathbb { E } _ { \mathbf { t } \mid \mathbf { x } \sim p ( \mathbf { t } \mid \mathbf { x } ) } \left[ \log q ( \mathbf { y } \mid \mathbf { t } ) \right] } \\ & { \mathrm { I } ( \mathbf { x } , \mathbf { t } ) \leq \mathbb { E } _ { \mathbf { x } \sim p ( \mathbf { x } ) } D _ { \mathrm { K L } } ( p ( \mathbf { z } \mid \mathbf { x } ) , r ( \mathbf { z } ) ) + C } \end{array}
336
+ $$
337
+
338
+ which result in
339
+
340
+ $$
341
+ \begin{array} { r l } & { \mathbf { I } ( \mathbf { t } , \mathbf { y } ) \ - \ \beta \ \mathbf { I } ( \mathbf { x } , \mathbf { t } ) } \\ & { \quad \geq \mathbb { E } _ { \mathbf { x } \sim p ( \mathbf { x } ) } \mathbb { E } _ { \mathbf { y } | \mathbf { x } \sim p ( \mathbf { y } | \mathbf { x } ) } \mathbb { E } _ { \mathbf { t } | \mathbf { x } \sim p ( \mathbf { t } | \mathbf { x } ) } \left[ \log q ( \mathbf { y } | \mathbf { t } ) \right] - \beta \ \mathbb { E } _ { \mathbf { x } \sim p ( \mathbf { x } ) } D _ { \mathrm { K L } } ( p ( \mathbf { z } | \mathbf { x } ) , r ( \mathbf { z } ) ) + \mathrm { C o n s t . } } \end{array}
342
+ $$
343
+
344
+ With proper choices of $r ( \mathbf { z } )$ and $p ( \mathbf { z } | \mathbf { x } )$ , we assume that the Kullback-Leibler divergence $D _ { \mathrm { K L } } ( p ( \mathbf { z } | \mathbf { x } ) , r ( \mathbf { z } ) )$ is integrated analytically. We use the empirical data distribution to approximate $p ( \mathbf { x } , \mathbf { y } ) = p ( \mathbf { x } ) p ( \mathbf { y } | \mathbf { x } )$ and $p ( \mathbf { x } )$ .
345
+
346
+ Our variational approximation is similar to the one from Alemi et al. (2017), which first developed variational lower bound on the information bottleneck for deep neural networks. However, our information bottleneck is different from theirs: their information bottleneck is the stochastic encoding $\mathbf { z }$ of the input $\mathbf { x }$ as itself, whereas our information bottleneck is a pairwise product of the stochastic encoding $\mathbf { z }$ and the input $\mathbf { x }$ where $\mathbf { z }$ is a Boolean random vector. Due to this difference, we appproximate $\mathbf { I } ( \mathbf { x } , \mathbf { t } )$ by using the lower bound of $\mathbf { I } ( \mathbf { x } , \mathbf { z } )$ , instead of directly deriving the lower bound of $\operatorname { I } ( \mathbf { x } , \mathbf { t } )$ .
347
+
348
+ # B EXPERIMENTAL DETAILS
349
+
350
+ The settings of hyperparameter tuning include the followings (bold indicate the choice for our final model): the temperature for Gumbel-softmax approximation $\tau - \{ 0 . 1 , 0 . 2 , 0 . 5 , 0 . 7 , 1 \}$ , learning rate – $5 \times 1 0 ^ { - 3 }$ , $\mathrm { \bar { 1 0 } ^ { - 3 } }$ , $5 \times 1 0 ^ { - 4 }$ , $\bf { 1 0 ^ { - 4 } }$ , $5 \times 1 0 ^ { - 5 } \}$ and $\beta - \{ 0 , 0 . 0 0 1 , \mathbf { 0 . 0 1 } , 0 . 1 , 1 , 1 0 , 1 0 0 \}$ . We use Adam algorithm (Kingma & Ba, 2014) with batch size 100 for MNIST and 50 for IMDB, the coefficients used for computing running averages of gradient and its square $( \beta _ { 1 } , \beta _ { 2 } ) = ( 0 . 5 , 0 . 9 9 9 )$ , and $\epsilon = 1 0 ^ { - 8 }$ . We tuned the hyperparameters via grid search and picked up the hyperparameters that yield the best fidelity score on the validation set. All implementation is performed via PyTorch an open source deep learning platform (Paszke et al., 2017).
351
+
352
+ Approximator fidelity is prediction performance of the approximator that takes relaxation $\mathbf { t } ^ { * }$ as an input and black-box output as a target. In detail, we get a $\mathbf { t } ^ { * }$ with the Gumble-softmax sampling and make a prediction based on $\mathbf { t } ^ { * }$ . This procedure is repeated for 12 times and the final prediction is made by averaging the 12 prediction scores. Rationale fidelity is prediction performance of the approximator that takes $\mathbf { t }$ as an input and black-box output as a target. (Note that $\mathbf { t }$ is a masked input that only takes the top $k$ chunks and set others to zero.) The final prediction is made by its prediction score. We use the prior $-$ for all experiments where $J$ is the total number of chunks and $\begin{array} { r } { r ( { \bf z } ) = \prod _ { j } r _ { j } ( { \bf z } _ { j } ) } \end{array}$ . The analytical form of the Kullback-Leibler divergence term is $-$ $-$
353
+
354
+ # B.1 LSTM MOVIE SENTIMENT PREDICTION MODEL USING IMDB
355
+
356
+ Black-Box Model Structure. Each review is padded or cut to contain 15 sentences and 50 words for each sentence. The architecture consists of a word-embedding layer with size 50 for each word followed by two bidirectional LSTMs, a fully connected layer with two units, and a soft-max layer. The first LSTM layer encodes the word embedding vector and generates a word-representation vector with size 100 for each word. Within each sentence, the word representation vectors are elementwisely averaged to form a size 100 sentence representation vector. The second LSTM layer encodes the sentence representation vector and generates a size 60 review embedding vector.
357
+
358
+ VIBI Structure. We parameterize the explainer with a bidirectional LSTM and approximator with a 2D CNN. For the explainer, we use a bidirectional layer that returns multiple output vectors, each of which corresponds to a recurrent unit. Each element in the output vectors are averaged over all units, and then the averaged output vector is followed by log-softmax calculation. As a result, the explainer returns a vector of log-probabilities, each of which indicates whether or not each cognitive chunk will be selected as an input to the approximator. For the approximator, we use a convolutional layer followed by a ReLU activation function and max-pooling layer and a fully connected layer returning a size-2 vector followed by a log-softmax calculation. The final layer returns a vector of log-probabilities for the two sentiments (positive/negative).
359
+
360
+ # B.2 CNN DIGIT RECOGNITION MODEL USING MNIST
361
+
362
+ Black-Box Model Structure. The architecture consists of two convolutional layers with the kernel size 5 followed by a max-pooling layer with the pool size 2, two fully connected layers and a soft-max layer. The two convolutional layers contain 10 and 20 filters respectively and the two fully connected layers are composed of 50 and 10 units respectively.
363
+
364
+ VIBI Structure. We parameterize each the explainer and approximator using 2D CNNs. Structure of the explainer differs depending on the chunk size. For example, when $4 \times 4$ cognitive chunk is used, we use two convolutional layers with the kernel size 5 followed by a ReLU activation function and max-pooling layer with the pool size 2, and one convolutional layer with kernel size 1 returning a $7 \times 7$ 2D matrix followed by a log-softmax calculation. The final layer returns a vector of log-probabilities for the 49 chunks. The three convolutional layers contains 8, 16, and 1 filters respectively. The output from the explainer indicates which cognitive chunks should be taken as an input for the approximator. We parameterize the approximator using two convolutional layers with kernel size 5 followed by a ReLU activation function and max-pooling layer with pool size 2 and with 32 and 64 filters respectively, and one fully connected layer returning a size-10 vector followed by a log-softmax calculation so that the final layer returns a vector of log-probabilities for the ten digits.
365
+
366
+ B.3 TCR TO EPITOPE BINDING PREDICTION MODEL USING VDJDB AND IEDB
367
+
368
+ Data. We use two public datasets: VDJdb and IEDB. VDJdb (Shugay et al., 2017) contains the T-cell receptor (TCR) sequences with known antigen specificity (i.e., epitope sequences). We use a VDJdb dataset preprocessed by Jokinen et al. (2019) (See their paper for details in data preprocessing). The preprocessed dataset contains 5,784 samples (2,892 positively and 2,892 negatively binding pairs of TCR and epitope). This dataset consists of 4,363 unique TCR sequences and 21 unique epitope sequences. We group the pairs of TCR and epitope sequences into training, validation, and test sets, which have 4,627, 578, and 579 pairs, respectively. IEDB (Vita et al., 2014) contains TCR sequences and corresponding epitopes. We used an IEDB dataset preprocessed by Jurtz et al. (2018). The preprocessed dataset contains 9,328 samples (positively binding pairs only) and consists of 9,221 unique TCR sequences and 98 unique epitopes sequences. We used the IEDB dataset as out-ouf-samples. There are 6 epitopes contained in both VDJdb and IEDB dataset: GILGFVFTL, GLCTLVAML, NLVPMVATV, LLWNGPMAV, YVLDHLIVV, CINGVCWTV.
369
+
370
+ Black-Box Model Structure. Each TCR and epitope sequence is padded or cut to contain 20 and 13 amino acids, respectively. The embedding matrix has a size 24 and is initialized with BLOSUM50 matrix (Henikoff & Henikoff, 1992). The architecture consists of two sequence encoders that process TCR and epitope sequences each, and three dense layers that process the encoded sequences together. The TCR encoder consists of a dropout layers with the drop-out probability 0.3, two convolutional layers with the kernel size 3 followed by a batch normalization layer, a ReLU activation function and max-pooling layer with the pool size 3. The two convolutional layers contain 32 and 16 filters respectively. Structure of the epitope encoder is the same with the one from the TCR encoder. We optimized the models with the following search space (bold indicate the choice for our final model): the batch size – $\{ 2 5 , 5 0 , 1 0 0 \}$ , learning rate $\mathbf { - 0 . 0 5 , 0 . 0 1 , 0 . 0 0 5 , 0 . 0 0 1 , 0 . 0 0 0 5 } \}$ and filter size – $\left\{ ( 1 6 , 8 ) , ( { \bf 3 2 } , { \bf 1 6 } ) \right\}$ .
371
+
372
+ VIBI Structure. We parameterize the explainer and approximator using 2D CNNs and several dense layers. Each TCR and epitope sequence is preprocessed and embedded in the same way as for the black-box model. We have two types of explainers: one for TCR sequence and another for epitope sequence. Each explainer encodes both TCR and epitope sequences and concatenates them through three dense layers followed by a ReLU activation function. For the TCR explainer, the three dense layers contain 32, 16, 20 hidden-units, respectively. For the epitope explainer, the three dense layers contain 32, 16, 13 hidden-units, respectively. The TCR and epitope encoders have the same architectures with those of the black-box model. Each explainer then returns a vector of log-probabilities that indicate which peptides in TCR or epitope should be selected as an explanation. The approximator has the same architecture as the black-box model. We optimize the models with the following search space (bold indicate the choice for our final model): the batch size – $\{ 2 5 , 5 0 , 1 0 0 \}$ , learning rate $- 0 . 0 0 0 1 , \mathbf { 0 . 0 0 1 } , 0 . 0 1 , 0 . 1 \}$ .
373
+
374
+ # B.4 BASELINE METHODS
375
+
376
+ Hyperparameter tuning. For L2X, we used the same hyperparameter search space of VIBI. For LIME, we tuned the segmentation filter size over $\{ 1 , 2 , 4 \}$ for MNIST and $\{ \mathbf { 1 0 } , 2 5 \}$ for IMDB. For all methods, we tuned the hyperparameters via grid search and picked up the hyperparameters that yield the best fidelity score on the validation set.
377
+
378
+ Cognitive chunk. LIME, SHAP and Saliency yield an attribution score for each feature. A chunk-attribution score is an average of (absolute) attribution scores of features that belong to the chunk. Top $k$ chunks that have the highest chunk-attribution scores are selected. L2X selects chunks in the same way as VIBI.
379
+
380
+ Fidelity evaluation. LIME, SHAP, Saliency, and L2X all have their own approximators. LIME and SHAP have a sparse linear approximator for each black-box instance (See Section 3.4 in Ribeiro et al. (2016), and Equation (3) in Lundberg & Lee (2017)). Saliency has a 1st-order Taylor approximation to each black-box instance (See Equation (3) in Simonyan et al. (2013)). The approximator fidelity of LIME, SHAP, and Saliency is calculated using their proposed approximators that are composed of the selected features. L2X has a deep neural network that approximates a black-box model (See Section 4 in Chen et al. (2018)). The approximator and rationale fidelity of L2X is calculated in the same way as VIBI.
381
+
382
+ # C INTERPRETABILITY EVALUATED BY HUMANS
383
+
384
+ C.1 LSTM MOVIE SENTIMENT PREDICTION MODEL USING IMDB DATASET
385
+
386
+ EVALUATION
387
+
388
+ Table 3: Evaluation of Interpretability on an LSTM movie sentiment prediction model using IMDB.
389
+
390
+ <table><tr><td>Black-Box Output</td><td>Recognized by Mturk worker</td><td>Saliency</td><td>LIME</td><td>L2X</td><td>VIBI (Ours)</td></tr><tr><td>Positive</td><td>Positive</td><td>19.8</td><td>17.4</td><td>17.6</td><td>24.3</td></tr><tr><td>Positive</td><td>Negative</td><td>12.6</td><td>6.8</td><td>7.2</td><td>16.9</td></tr><tr><td>Positive</td><td>Neutral</td><td>25.6</td><td>18.8</td><td>24.2</td><td>11.1</td></tr><tr><td>Negative</td><td>Positive</td><td>11.0</td><td>10.6</td><td>11.6</td><td>16.2</td></tr><tr><td>Negative</td><td>Negative</td><td>14.4</td><td>16.4</td><td>18.0</td><td>20.4</td></tr><tr><td>Negative</td><td>Neutral</td><td>16.6</td><td>30.0</td><td>21.4</td><td>11.2</td></tr></table>
391
+
392
+ The percentage of samples belongs to each combination of the black-box output and the sentiment recognized by workers at Amazon Mechanical Turk (https://www.mturk. com/) are showed
393
+
394
+ We evaluated interpretability of the methods on the LSTM movie sentiment prediction model. The interpretable machine learning methods were evaluated by workers at Amazon Mechanical Turk (https://www.mturk.com/) who are awarded the Masters Qualification (i.e. high performance workers who have demonstrated excellence across a wide range of task). Randomly selected instances (200 for VIBI and 100 for the others) were evaluated for each method. 5 workers are assigned per instance.
395
+
396
+ We provided instances that the black-box model had correctly predicted and asked humans to infer the output of the primary sentiment of the movie review (Positive/Negative/Neutral) given five key words selected by each method. See the survey example below for further details. Note that this is a proxy for measuring how well humans infer the black-box output given explanations; we use such proxy because the workers are general public who are not familiar with the term ‘black-box’ or ‘output of the model.’
397
+
398
+ In Table 3, the percentage of samples belongs to each combination of the black-box output and the sentiment recognized by the workers are showed. VIBI has the highest percentage of samples belonging to the Positive/Positive or Negative/Negataive and the lowest percentage of samples belonging to the Positive/Neutral or Negative/Neutral. LIME has the lowest percentage of samples belonging to the Positive/Negative or Negative/Positive, but it is because LIME tends to select words such as ‘that’, ‘the’, ‘is’ so that most of samples are recognized as Neutral.
399
+
400
+ # SURVEY EXAMPLE FOR IMDB
401
+
402
+ Title: Label sentiment given a few words.
403
+ Description: Recognize the primary sentiment of the movie review given a few words only.
404
+
405
+ ![](images/a89dc647c064ea5399f30471906485ddcb17f8ce568007069d5dd92cadfe1a4c.jpg)
406
+ Figure 5: A survey example of MTurk evaluation on the LSTM movie sentiment prediction model
407
+
408
+ C.2 CNN DIGIT RECOGNITION MODEL USING MNIST
409
+
410
+ EVALUATION
411
+
412
+ Table 4: Evaluation of Interpretability on a 2d CNN digit recognition model using MNIST.
413
+
414
+ <table><tr><td>MNIST Digit</td><td>Saliency</td><td>LIME</td><td>L2X</td><td>VIBI (Ours)</td></tr><tr><td>0</td><td>3.200</td><td>2.000</td><td>2.333</td><td>3.000</td></tr><tr><td>1</td><td>4.393</td><td>0.795</td><td>1.263</td><td>3.913</td></tr><tr><td>2</td><td>3.125</td><td>1.200</td><td>1.400</td><td>3.200</td></tr><tr><td>3</td><td>3.286</td><td>1.833</td><td>2.429</td><td>3.625</td></tr><tr><td>4</td><td>3.333</td><td>1.000</td><td>1.857</td><td>3.857</td></tr><tr><td>5</td><td>3.167</td><td>1.381</td><td>2.000</td><td>2.875</td></tr><tr><td>6</td><td>3.333</td><td>1.000</td><td>1.889</td><td>3.625</td></tr><tr><td>7</td><td>3.667</td><td>2.000</td><td>1.667</td><td>4.000</td></tr><tr><td>8</td><td>3.750</td><td>1.333</td><td>2.667</td><td>3.500</td></tr><tr><td>9</td><td>3.222</td><td>1.143</td><td>1.857</td><td>3.667</td></tr><tr><td>Ave. over digits</td><td>3.448</td><td>1.369</td><td>1.936</td><td>3.526</td></tr></table>
415
+
416
+ The average scores (0–5 scale) evaluated by graduate students at XXX University (Blinded due to the double blinding reviewing) are showed.
417
+
418
+ We evaluated interpretability of the methods on the CNN digit recognition model. The interpretable machine learning methods were evaluated by 16 graduate students at XXX University (Blinded due to the double blinding reviewing) who have taken at least one graduate-level machine learning class. Randomly selected 100 instances were evaluated for each method. On average, 4.26 students are assigned per instance. See the survey example below for further details. For the digit recognition model, we asked humans to directly score the explanation on a 0–5 scale.
419
+
420
+ In Table 4, the average score per digit is showed. VIBI outperforms L2X and LIME and slightly outperforms Saliency in terms of the average score over digits. VIBI outperforms at digit 2, 3, 4, 6, 7, and 9, and performs comparable to Saliency at 0, 1, 5, 8.
421
+
422
+ ![](images/aeddd4f8cdeed0dfa41531477cba9aa19accb17a3dac2b3f68ec9854cb6df00c.jpg)
423
+ Figure 6: The hand-written digits and explanations provided by VIBI and the baselines. The examples are randomly selected from the validation set. The selected patches are colored red if the pixel is activated (i.e. white) and yellow otherwise (i.e. black). A patch composed of $4 \times 4$ pixels is used as a cognitive chunk and $k = 4$ patches are identified for each image.
424
+
425
+ # SURVEY EXAMPLE FOR MNIST
426
+
427
+ # Instruction
428
+
429
+ ● 2D CNN model is used for digit recognition for MNIST dataset ● Now, an interpretable learning method explains a decision made by the 2D CNN model:
430
+
431
+ ![](images/a48e09c8712277f6325f7cc8a875dcb5cc15d38696991ab75d31274820460922.jpg)
432
+
433
+ Recognized as 9
434
+
435
+ Explain by highlighting key pixels that play an important role in the 2D CNN digit recognition.
436
+
437
+ ![](images/a238bd5f5349a5008b2354920ed88c05770b46e4f6bd49820a4910fa750985ac.jpg)
438
+
439
+ MNIST is a large dataset contains $2 8 \times 2 8$ sized images of handwritten digits (0 to 9). Here, a 2D convolutional neural network (CNN) is used for the digit recognition for MNIST. Several interpretable machine learning methods are learned to explain the model by highlighting key pixels that play an important role in the CNN digit recognition. The highlighted pixels provides an explanation for a handwritten image why the CNN model recognized the handwriting as it does. Your task is to evaluate the explanation for each instance on a scale 0 to 5.Instruction
440
+
441
+ ![](images/8af58bf87fd7b67300c8c0109182cf97a02d4f7eaaa43a59ac5c3e12d35537ff.jpg)
442
+ Please score each instance based on following criteria:
443
+ Figure 7: A survey example of evaluation on the MNIST digit recognition model.
444
+
445
+ D FIDELITY
446
+
447
+ Table 5: Evaluation of rationale fidelity on LSTM movie sentiment prediction model using IMDB.
448
+
449
+ <table><tr><td></td><td></td><td></td><td>L2X</td><td colspan="6">VIBI (Ours)</td></tr><tr><td></td><td>chunk size</td><td>k</td><td>0</td><td>0.001</td><td>0.01</td><td>0.1</td><td>1</td><td>10</td><td>100</td></tr><tr><td rowspan="4">Accuracy</td><td>sentence</td><td>1</td><td>0.727</td><td>0.693</td><td>0.711</td><td>0.731</td><td>0.729</td><td>0.734</td><td>0.734</td></tr><tr><td>word</td><td>5</td><td>0.638</td><td>0.657</td><td>0.666</td><td>0.657</td><td>0.648</td><td>0.640</td><td>0.654</td></tr><tr><td>5 words</td><td>1</td><td>0.601</td><td>0.630</td><td>0.624</td><td>0.632</td><td>0.628</td><td>0.623</td><td>0.628</td></tr><tr><td>5 words</td><td>3</td><td>0.694</td><td>0.660</td><td>0.662</td><td>0.660</td><td>0.662</td><td>0.660</td><td>0.660</td></tr><tr><td rowspan="4">F1-score</td><td>sentence</td><td>1</td><td>0.581</td><td>0.547</td><td>0.562</td><td>0.567</td><td>0.585</td><td>0.586</td><td>0.586</td></tr><tr><td>word</td><td>5</td><td>0.486</td><td>0.521</td><td>0.551</td><td>0.512</td><td>0.516</td><td>0.508</td><td>0.526</td></tr><tr><td>5 words</td><td>1</td><td>0.478</td><td>0.506</td><td>0.500</td><td>0.540</td><td>0.501</td><td>0.498</td><td>0.504</td></tr><tr><td>5 words</td><td>3</td><td>0.551</td><td>0.528</td><td>0.529</td><td>0.522</td><td>0.529</td><td>0.528</td><td>0.525</td></tr></table>
450
+
451
+ Rationale fidelity quantifies ability of the selected chunks to infer the black-box output. A large rationale fidelity implies that the selected chunks account for a large portion of the approximator fidelity. Prediction accuracy and F1-score of the approximator for the CNN model are shown. $\beta =$ $0 , 0 . 0 0 1 , 0 . 0 1 , 0 . 1 , 1 , 1 0 , 1 0 0 )$
452
+
453
+ Table 6: Evaluation of approximator fidelity on LSTM movie sentiment prediction model using IMDB.
454
+
455
+ <table><tr><td></td><td></td><td></td><td>Saliency</td><td>LIME</td><td>SHAP</td><td>L2X</td><td colspan="6">VIBI (Ours)</td></tr><tr><td></td><td>chunk size</td><td>k</td><td></td><td></td><td></td><td>0</td><td>0.001</td><td>0.01</td><td>0.1</td><td>1</td><td>10</td><td>100</td></tr><tr><td rowspan="4">Accuracy</td><td>sentence</td><td>1</td><td>0.387</td><td>0.727</td><td>0.495</td><td>0.876</td><td>0.877</td><td>0.869</td><td>0.877</td><td>0.879</td><td>0.879</td><td>0.884</td></tr><tr><td>word</td><td>5</td><td>0.419</td><td>0.756</td><td>0.501</td><td>0.738</td><td>0.766</td><td>0.772</td><td>0.744</td><td>0.773</td><td>0.763</td><td>0.767</td></tr><tr><td>5 words</td><td>1</td><td>0.424</td><td>0.290</td><td>0.496</td><td>0.759</td><td>0.784</td><td>0.780</td><td>0.764</td><td>0.774</td><td>0.778</td><td>0.774</td></tr><tr><td>5 words</td><td>3</td><td>0.414</td><td>0.679</td><td>0.491</td><td>0.833</td><td>0.836</td><td>0.831</td><td>0.835</td><td>0.834</td><td>0.830</td><td>0.833</td></tr><tr><td rowspan="4">F1-score</td><td>sentence</td><td>1</td><td>0.331</td><td>0.564</td><td>0.400</td><td>0.721</td><td>0.693</td><td>0.707</td><td>0.730</td><td>0.730</td><td>0.727</td><td>0.734</td></tr><tr><td>word</td><td>5</td><td>0.350</td><td>0.585</td><td>0.413</td><td>0.565</td><td>0.607</td><td>0.616</td><td>0.594</td><td>0.620</td><td>0.609</td><td>0.612</td></tr><tr><td>5 words</td><td>1</td><td>0.360</td><td>0.302</td><td>0.418</td><td>0.621</td><td>0.641</td><td>0.622</td><td>0.624</td><td>0.615</td><td>0.622</td><td>0.616</td></tr><tr><td>5 words</td><td>3</td><td>0.352</td><td>0.523</td><td>0.409</td><td>0.680</td><td>0.683</td><td>0.674</td><td>0.681</td><td>0.677</td><td>0.669</td><td>0.682</td></tr></table>
456
+
457
+ Approximator fidelity quantifies ability of the approximator to imitate the behaviour of a black-box. Prediction accuracy and F1-score of the approximator for the LSTM model are shown. $( \beta = 0 , 0 . 0 0 1 , 0 . 0 1 , 0 . 1 , 1 , 1 0 , 1 0 0 )$
458
+
459
+ Table 7: Evaluation of the rationale fidelity on CNN digit recognition model using MNIST.
460
+
461
+ <table><tr><td></td><td></td><td>L2X</td><td colspan="6">VIBI (Ours)</td></tr><tr><td>chunk size</td><td>k</td><td></td><td>0.001</td><td>0.01</td><td>0.1</td><td>1</td><td>10</td><td>100</td></tr><tr><td></td><td>1×1</td><td>64 0.694</td><td>0.690</td><td>0.726</td><td>0.689</td><td>0.742</td><td>0.729</td><td>0.766</td></tr><tr><td>1×1</td><td>96</td><td>0.814</td><td>0.831</td><td>0.780</td><td>0.806</td><td>0.859</td><td>0.765</td><td>0.826</td></tr><tr><td>1×1</td><td>160</td><td>0.903</td><td>0.907</td><td>0.905</td><td>0.917</td><td>0.917</td><td>0.928</td><td>0.902</td></tr><tr><td>2×2</td><td>16</td><td>0.735</td><td>0.795</td><td>0.750</td><td>0.771</td><td>0.732</td><td>0.753</td><td>0.769</td></tr><tr><td>2×2 Accuracy</td><td>24</td><td>0.776</td><td>0.855</td><td>0.834</td><td>0.856</td><td>0.868</td><td>0.854</td><td>0.847</td></tr><tr><td>2×2</td><td>40</td><td>0.811</td><td>0.914</td><td>0.914</td><td>0.915</td><td>0.903</td><td>0.918</td><td>0.935</td></tr><tr><td>2×2</td><td>80 4</td><td>0.905</td><td>0.949</td><td>0.940</td><td>0.939</td><td>0.962</td><td>0.941</td><td>0.923</td></tr><tr><td>4×4</td><td></td><td>0.650</td><td>0.655</td><td>0.650</td><td>0.775</td><td>0.717</td><td>0.682</td><td>0.681</td></tr><tr><td>4×4</td><td>6</td><td>0.511</td><td>0.858</td><td>0.706</td><td>0.701</td><td>0.708</td><td>0.690</td><td>0.730</td></tr><tr><td>4×4</td><td>10</td><td>0.835</td><td>0.835</td><td>0.824</td><td>0.933</td><td>0.875</td><td>0.854</td><td>0.782</td></tr><tr><td>4×4</td><td>20</td><td>0.954</td><td>0.962</td><td>0.815</td><td>0.934</td><td>0.929</td><td>0.946</td><td>0.943</td></tr><tr><td></td><td>1×1</td><td>64 0.684</td><td>0.679</td><td>0.716</td><td>0.670</td><td>0.734</td><td>0.710</td><td>0.755</td></tr><tr><td></td><td>1×1</td><td>96 0.808</td><td>0.825</td><td>0.750</td><td>0.803</td><td>0.854</td><td>0.750</td><td>0.820</td></tr><tr><td>1×1</td><td>160</td><td>0.898</td><td>0.902</td><td>0.899</td><td>0.912</td><td>0.913</td><td>0.924</td><td>0.897</td></tr><tr><td>2×2</td><td>16 24</td><td>0.720</td><td>0.786</td><td>0.738</td><td>0.761</td><td>0.723</td><td>0.744</td><td>0.769</td></tr><tr><td>2×2 F1-score</td><td></td><td>0.766</td><td>0.848</td><td>0.836</td><td>0.851</td><td>0.858</td><td>0.859</td><td>0.840</td></tr><tr><td>2×2</td><td>40</td><td>0.798</td><td>0.914</td><td>0.910</td><td>0.910</td><td>0.898</td><td>0.914</td><td>0.931</td></tr><tr><td>2×2</td><td></td><td>0.901</td><td>0.946</td><td>0.936</td><td>0.930</td><td>0.959</td><td>0.938</td><td>0.918</td></tr><tr><td>4×4</td><td>80</td><td>0.634</td><td>0.658</td><td>0.637</td><td>0.763</td><td>0.704</td><td>0.671</td><td>0.669</td></tr><tr><td>4×4</td><td></td><td>0.493</td><td>0.852</td><td>0.693</td><td>0.687</td><td>0.692</td><td>0.675</td><td>0.720</td></tr><tr><td>4×4</td><td></td><td>0.828</td><td>0.827</td><td>0.816</td><td>0.928</td><td>0.869</td><td>0.849</td><td>0.773</td></tr><tr><td>4×4</td><td></td><td>0.950</td><td>0.959</td><td>0.806</td><td>0.931</td><td>0.926</td><td>0.942</td><td>0.940</td></tr></table>
462
+
463
+ Rationale fidelity quantifies ability of the selected chunks to infer the black-box output. A large rationale fidelity implies that the selected chunks account for a large portion of the approximator fidelity. Prediction accuracy and F1-score of the approximator for the CNN model are shown. $\beta =$ 0, 0.001, 0.01, 0.1, 1, 10, 100)
464
+
465
+ Table 8: Evaluation of the approximator fidelity on CNN digit recognition model using MNIST.
466
+
467
+ <table><tr><td></td><td></td><td></td><td>Saliency</td><td>LIME</td><td>SHAP</td><td>L2X</td><td colspan="6">VIBI(Ours)</td></tr><tr><td></td><td>chunk size</td><td>k</td><td></td><td></td><td></td><td>0</td><td>0.001</td><td>0.01</td><td>0.1</td><td>1</td><td>10</td><td>100</td></tr><tr><td rowspan="10">Accuracy</td><td>1×1</td><td>64</td><td>0.944</td><td>0.982</td><td>0.955</td><td>0.933</td><td>0.959</td><td>0.962</td><td>0.959</td><td>0.960</td><td>0.952</td><td>0.953</td></tr><tr><td>1×1</td><td>96</td><td>0.956</td><td>0.986</td><td>0.950</td><td>0.963</td><td>0.963</td><td>0.951</td><td>0.967</td><td>0.968</td><td>0.953</td><td>0.962</td></tr><tr><td>1×1</td><td>160</td><td>0.964</td><td>0.989</td><td>0.958</td><td>0.970</td><td>0.967</td><td>0.973</td><td>0.974</td><td>0.974</td><td>0.974</td><td>0.967</td></tr><tr><td>2×2</td><td>16</td><td>0.912</td><td>0.770</td><td>0.942</td><td>0.934</td><td>0.945</td><td>0.941</td><td>0.948</td><td>0.938</td><td>0.939</td><td>0.940</td></tr><tr><td>2×2</td><td>24</td><td>0.938</td><td>0.807</td><td>0.954</td><td>0.951</td><td>0.956</td><td>0.955</td><td>0.953</td><td>0.953</td><td>0.953</td><td>0.960</td></tr><tr><td>2×2</td><td>40</td><td>0.957</td><td>0.859</td><td>0.954</td><td>0.967</td><td>0.965</td><td>0.966</td><td>0.962</td><td>0.967</td><td>0.965</td><td>0.967</td></tr><tr><td>2×2</td><td>80</td><td>0.966</td><td>0.897</td><td>0.966</td><td>0.976</td><td>0.977</td><td>0.974</td><td>0.972</td><td>0.977</td><td>0.971</td><td>0.973</td></tr><tr><td>4×4</td><td>4</td><td>0.863</td><td>0.609</td><td>0.948</td><td>0.953</td><td>0.922</td><td>0.928</td><td>0.948</td><td>0.942</td><td>0.942</td><td>0.953</td></tr><tr><td>4×4</td><td>6</td><td>0.906</td><td>0.637</td><td>0.936</td><td>0.957</td><td>0.963</td><td>0.954</td><td>0.956</td><td>0.953</td><td>0.963</td><td>0.962</td></tr><tr><td>4×4</td><td>10</td><td>0.949</td><td>0.705</td><td>0.951</td><td>0.965</td><td>0.971</td><td>0.959</td><td>0.967</td><td>0.961</td><td>0.969</td><td>0.964</td></tr><tr><td rowspan="10"></td><td>4×4</td><td>20</td><td>0.963</td><td>0.771</td><td>0.955</td><td>0.974</td><td>0.977</td><td>0.975</td><td>0.975</td><td>0.973</td><td>0.975</td><td>0.974</td></tr><tr><td>1×1</td><td>64</td><td>0.938</td><td>0.981</td><td>0.952</td><td>0.930</td><td>0.956</td><td>0.960</td><td>0.956</td><td>0.957</td><td>0.950</td><td>0.950</td></tr><tr><td>1×1</td><td>96</td><td>0.950</td><td>0.985</td><td>0.948</td><td>0.961</td><td>0.961</td><td>0.954</td><td>0.965</td><td>0.966</td><td>0.951</td><td>0.960</td></tr><tr><td>1×1</td><td>160 16</td><td>0.959</td><td>0.989</td><td>0.954</td><td>0.969</td><td>0.965</td><td>0.971</td><td>0.973</td><td>0.972</td><td>0.972</td><td>0.966</td></tr><tr><td>2×2</td><td>24</td><td>0.902</td><td>0.755</td><td>0.938</td><td>0.930</td><td>0.942</td><td>0.936</td><td>0.944</td><td>0.934</td><td>0.936</td><td>0.936</td></tr><tr><td>2×2</td><td>40</td><td>0.932</td><td>0.795</td><td>0.951</td><td>0.949</td><td>0.954</td><td>0.952</td><td>0.950</td><td>0.951</td><td>0.950</td><td>0.958</td></tr><tr><td>2×2</td><td>80</td><td>0.952</td><td>0.853</td><td>0.946</td><td>0.965</td><td>0.963</td><td>0.964</td><td>0.961</td><td>0.965</td><td>0.963</td><td>0.965</td></tr><tr><td>2×2</td><td>4</td><td>0.962</td><td>0.892</td><td>0.963</td><td>0.974</td><td>0.976 0.917</td><td>0.973 0.923</td><td>0.972</td><td>0.975</td><td>0.969</td><td>0.971</td></tr><tr><td>4×4</td><td>6</td><td>0.849 0.895</td><td>0.588 0.621</td><td>0.943</td><td>0.951 0.954</td><td>0.961</td><td>0.951</td><td>0.944 0.953</td><td>0.938</td><td>0.939</td><td>0.950</td></tr><tr><td>4×4</td><td></td><td></td><td></td><td>0.920</td><td></td><td></td><td>0.956</td><td></td><td>0.950</td><td>0.960</td><td>0.959</td></tr><tr><td></td><td>4×4</td><td>10</td><td>0.943</td><td>0.689</td><td>0.946</td><td>0.963</td><td>0.969</td><td></td><td>0.965</td><td>0.958</td><td>0.968</td><td>0.961</td></tr><tr><td></td><td>4×4</td><td>20</td><td>0.959</td><td>0.763</td><td>0.952</td><td>0.972</td><td>0.976</td><td>0.972</td><td>0.974</td><td>0.972</td><td>0.973</td><td>0.972</td></tr></table>
468
+
469
+ Approximator fidelity quantifies ability of the approximator to imitate the behaviour of a black-box. Prediction accuracy and F1-score of the approximator for the CNN model are shown. $( \beta = 0 , 0 . 0 0 1 , 0 . 0 1 , 0 . 1 , 1 , 1 0 , 1 0 0 )$
470
+
471
+ # E EXTRA EXPERIMENTS
472
+
473
+ # E.1 CHOICE OF $k$
474
+
475
+ The compressiveness of explanations depends on the sparsity $\cdot$ (i.e., the number of cognitive chunks to be selected). A larger $k$ allows the information bottleneck to convey more information about output, but it gives less compressive explanations than a smaller $k$ . For deciding $\cdot$ , we recommend choosing the minimum possible $\cdot$ that achieves a target fidelity because an unnecessarily large $\cdot$ can make redundant explanations. Figure 8 shows how VIBI works under different sparsity $k$ . When we increase $k$ , VIBI tends to select chunks that are the same or nearby the previously selected chunks and additionally select new chunks that catch another characteristics of digits. The characteristics that are caught at $k = 4$ tend to be caught again at a larger $k s$ .
476
+
477
+ ![](images/4235c031ea293488685035721b51d7966f553709bdf5f3d2824394aba8dd8813.jpg)
478
+ Figure 8: The hand-written digits and explanations provided by VIBI using various number of chunks $( k )$ . The examples are randomly selected from the validation set. The selected patches are colored red if the pixel is activated (i.e. white) and yellow otherwise (i.e. black). A patch composed of $4 \times 4$ 4 X 4pixels is used as a cognitive chunk and $k = 4 , 6 , 1 0 , 2 0$ patches are identified for each image.
479
+
480
+ # 1 X 1E.2 CHOICE OF CHUNK SIZE
481
+
482
+ The chunk size changes the way the information is represented in the information bottleneck, which can affect interpretability. For choosing the chunk size, a greater fidelity does not always mean better interpretability. For example, in the MNIST experiment, the models with the chunk size $1 \times 1$ have achieved better fidelity than those with $\cdot$ and $\cdot$ under the same number of pixels that are used for the information bottleneck, but $\cdot$ is less recognizable than $2 \times 2$ or $\cdot$ (Figure 9).
483
+
484
+ Choosing the chunk size is not trivial, and the strategy varies for different domains (except the case that each (raw) feature itself is cognitive (e.g., age, gender) so that the chunk size should be 1). Obviously, the chunk size should be larger than the size of the smallest cognitive unit. For example, in the IMDB experiment, the smallest cognitive unit was set to 50 because 50 raw features compose a word. In our sentiment prediction task, using a word as the chunk size can be enough to explain the decision (i.e., positive/negative sentiment); to infer the sentiment, we do not need to know a whole sentence. However, we may need to use a phrase or sentence as the chunk size for complex tasks such as disease diagnosis or patient need detection since decisions on such tasks are made based on contextual information. In the MNIST experiment, we set the chunk size to be $\cdot$ because the digits’ stroke width is about to 4. However, we may need to use different chunk sizes, for example, for automated visual inspection for identifying defects on a factory production line. In this case, the chunk size can be set to the average defect size on the production line.
485
+
486
+ ![](images/42b83622f0d20351a26b82b1a4b0ee2ef33f699950d4f309ed450a5e70f2f5b6.jpg)
487
+ Figure 9: The hand-written digits and explanations provided by VIBI using various chunk sizes. The same examples with Figure 8 are shown. The selected patches are colored red if the pixel is activated (i.e. white) and yellow otherwise (i.e. black). A patch composed of ${ 4 \times 4 , 2 \times 2 , 1 \times 1 }$ pixels is used as a cognitive chunk.
488
+
489
+ # E.3 CHOICE OF APPROXIMATOR
490
+
491
+ Different approximators affect fidelity and interpretability of the explanation, which makes sense both intuitively and theoretically. In theory, explanation is obtained via solving the problem in Equation (2) where $\cdot$ represents the approximator. Different models of the approximator result in different $\cdot$ and optimizing the information bottleneck objective amounts to learning a decent approximator. Intuitively, different models of the approximator indeed affect the quality as well as evaluated fidelity of the explanation. If the model of approximator has low capacity, $\cdot$ and fidelity tend to be low. To remedy this, explainer has to generate less brief explanations; vice versa.
492
+
493
+ In addition to the approximator capacity, the chunk sizes, more precisely chunk types, can be an essential factor for choosing approximators. In the IMDB experiment, we investigated how the two approximators affect the fidelity and interpretability. As seen in Table 9, the LSTM approximator has lower fidelity than the CNN approximator when we use a word for the chunk size, while both approximators achieve similar fidelity when we use a sentence for the chunk size. When we use a sentence as a cognitive chunk, the LSTM achieves better interpretability than CNN, which is more substantial than when we use a word as a cognitive chunk. This may indicate that a sentence (as an explanation) should be processed with an approximator that resembles the black-box model, while a group of single words is relatively free from such a constraint. This may be because a sentence is more similar to the original input (i.e., movie review – one or two paragraphs) than a group of single words.
494
+
495
+ Table 9: Fidelity and interpretability under different approximators.
496
+
497
+ <table><tr><td></td><td></td><td colspan="2">Approximator Fidelity</td><td colspan="2">Rationale Fidelity</td><td colspan="2">Interpretability</td></tr><tr><td>chunk size</td><td>k</td><td>CNN</td><td>LSTM</td><td>CNN</td><td>LSTM</td><td>CNN</td><td>LSTM</td></tr><tr><td>sentence</td><td>1</td><td>87.7 ± 0.6</td><td>87.8 ± 1.0</td><td>73.1 ± 0.8</td><td>71.7± 2.4</td><td>45.1</td><td>65.9</td></tr><tr><td>word</td><td>5</td><td>74.4 ± 0.8</td><td>61.3 ± 3.0</td><td>65.7 ± 0.8</td><td>57.1 ± 2.4</td><td>49.4</td><td>51.3</td></tr></table>
498
+
499
+ Prediction accuracy is reported for all measures. Randomely selected instances (100 for each) were evaluated for each model. 5 workers are assigned per instance.
500
+
501
+ In practice, we recommend choosing the approximator that matches the black-box model, especially if a cognitive chunk resembles the original input. We then recommend starting with an approximator with enough capacity and reducing it as far as the approximator achieves a target fidelity because a large capacity usually makes it hard to learn.
md/train/BJm4T4Kgx/BJm4T4Kgx.md ADDED
@@ -0,0 +1,363 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADVERSARIAL MACHINE LEARNING AT SCALE
2
+
3
+ Alexey Kurakin Google Brain kurakin@google.com
4
+
5
+ Ian J. Goodfellow OpenAI ian@openai.com
6
+
7
+ Samy Bengio
8
+ Google Brain
9
+ bengio@google.com
10
+
11
+ # ABSTRACT
12
+
13
+ Adversarial examples are malicious inputs designed to fool machine learning models. They often transfer from one model to another, allowing attackers to mount black box attacks without knowledge of the target model’s parameters. Adversarial training is the process of explicitly training a model on adversarial examples, in order to make it more robust to attack or to reduce its test error on clean inputs. So far, adversarial training has primarily been applied to small problems. In this research, we apply adversarial training to ImageNet (Russakovsky et al., 2014). Our contributions include: (1) recommendations for how to succesfully scale adversarial training to large models and datasets, (2) the observation that adversarial training confers robustness to single-step attack methods, (3) the finding that multi-step attack methods are somewhat less transferable than singlestep attack methods, so single-step attacks are the best for mounting black-box attacks, and (4) resolution of a “label leaking” effect that causes adversarially trained models to perform better on adversarial examples than on clean examples, because the adversarial example construction process uses the true label and the model can learn to exploit regularities in the construction process.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ It has been shown that machine learning models are often vulnerable to adversarial manipulation of their input intended to cause incorrect classification (Dalvi et al., 2004). In particular, neural networks and many other categories of machine learning models are highly vulnerable to attacks based on small modifications of the input to the model at test time (Biggio et al., 2013; Szegedy et al., 2014; Goodfellow et al., 2014; Papernot et al., 2016b).
18
+
19
+ The problem can be summarized as follows. Let’s say there is a machine learning system $M$ and input sample $C$ which we call a clean example. Let’s assume that sample $C$ is correctly classified by the machine learning system, i.e. $M ( C ) = y _ { t r u e }$ . It’s possible to construct an adversarial example $A$ which is perceptually indistinguishable from $C$ but is classified incorrectly, i.e. $M ( A ) \neq y _ { t r u e }$ . These adversarial examples are misclassified far more often than examples that have been perturbed by noise, even if the magnitude of the noise is much larger than the magnitude of the adversarial perturbation (Szegedy et al., 2014).
20
+
21
+ Adversarial examples pose potential security threats for practical machine learning applications. In particular, Szegedy et al. (2014) showed that an adversarial example that was designed to be misclassified by a model $M _ { 1 }$ is often also misclassified by a model $M _ { 2 }$ . This adversarial example transferability property means that it is possible to generate adversarial examples and perform a misclassification attack on a machine learning system without access to the underlying model. Papernot et al. (2016a) and Papernot et al. (2016b) demonstrated such attacks in realistic scenarios.
22
+
23
+ It has been shown (Goodfellow et al., 2014; Huang et al., 2015) that injecting adversarial examples into the training set (also called adversarial training) could increase robustness of neural networks to adversarial examples. Another existing approach is to use defensive distillation to train the network (Papernot et al., 2015). However all prior work studies defense measures only on relatively small datasets like MNIST and CIFAR10. Some concurrent work studies attack mechanisms on ImageNet (Rozsa et al., 2016), focusing on the question of how well adversarial examples transfer between different types of models, while we focus on defenses and studying how well different types of adversarial example generation procedures transfer between relatively similar models.
24
+
25
+ In this paper we studied adversarial training of Inception models trained on ImageNet. The contributions of this paper are the following:
26
+
27
+ • We successfully used adversarial training to train an Inception v3 model (Szegedy et al., 2015) on ImageNet dataset (Russakovsky et al., 2014) and to significantly increase robustness against adversarial examples generated by the fast gradient sign method (Goodfellow et al., 2014) as well as other one-step methods. We demonstrated that different types of adversarial examples tend to have different transferability properties between models. In particular we observed that those adversarial examples which are harder to resist using adversarial training are less likely to be transferrable between models. We showed that models which have higher capacity (i.e. number of parameters) tend to be more robust to adversarial examples compared to lower capacity model of the same architecture. This provides additional cue which could help building more robust models.
28
+ • We also observed an interesting property we call “label leaking”. Adversarial examples constructed with a single-step method making use of the true labels may be easier to classify than clean adversarial examples, because an adversarially trained model can learn to exploit regularities in the adversarial example construction process. This suggests using adversarial example construction processes that do not make use of the true label.
29
+
30
+ The rest of the paper is structured as follows: In section 2 we review different methods to generate adversarial examples. Section 3 describes details of our adversarial training algorithm. Finally, section 4 describes our experiments and results of adversarial training.
31
+
32
+ # 2 METHODS GENERATING ADVERSARIAL EXAMPLES
33
+
34
+ # 2.1 TERMINOLOGY AND NOTATION
35
+
36
+ In this paper we use the following notation and terminology regarding adversarial examples:
37
+
38
+ 1. $\boldsymbol { X }$ , the clean image — unmodified image from the dataset (either train or test set).
39
+ 2. $X ^ { a d v }$ , the adversarial image: the output of any procedure intended to produce an approximate worst-case modification of the clean image. We sometimes call this a candidate adversarial image to emphasize that an adversarial image is not necessarily misclassified by the neural network.
40
+ 3. Misclassified adversarial image — candidate adversarial image which is misclassified by the neural network. In addition we are typically interested only in those misclassified adversarial images when the corresponding clean image is correctly classified.
41
+ 4. $\epsilon { : }$ : The size of the adversarial perturbation. In most cases, we require the $L _ { \infty }$ norm of the perturbation to be less than $\epsilon$ , as done by Goodfellow et al. (2014). We always specify $\epsilon$ in terms of pixel values in the range [0, 255]. Note that some other work on adversarial examples minimizes the size of the perturbation rather than imposing a constraint on the size of the perturbation (Szegedy et al., 2014).
42
+ 5. The cost function used to train the model is denoted $J ( X , y _ { t r u e } )$ .
43
+ 6. $C l i p { \bf { _ { X , \epsilon } } } ( { \bf { A } } )$ denotes element-wise clipping $\pmb { A }$ , with $A _ { i , j }$ clipped to the range $[ X _ { i , j } \ -$ $\epsilon , X _ { i , j } + \epsilon ]$ .
44
+ 7. One-step methods of adversarial example generation generate a candidate adversarial image after computing only one gradient. They are often based on finding the optimal perturbation of a linear approximation of the cost or model. Iterative methods apply many gradient updates. They typically do not rely on any approximation of the model and typically produce more harmful adversarial examples when run for more iterations.
45
+
46
+ # 2.2 ATTACK METHODS
47
+
48
+ We study a variety of attack methods:
49
+
50
+ Fast gradient sign method Goodfellow et al. (2014) proposed the fast gradient sign method (FGSM) as a simple way to generate adversarial examples:
51
+
52
+ $$
53
+ X ^ { a d v } = X + \epsilon \mathrm { s i g n } \bigl ( \nabla _ { X } J ( X , y _ { t r u e } ) \bigr )
54
+ $$
55
+
56
+ This method is simple and computationally efficient compared to more complex methods like LBFGS (Szegedy et al., 2014), however it usually has a lower success rate. On ImageNet, top-1 error rate on candidate adversarial images for the FGSM is about $6 3 \% - 6 9 \%$ for $\epsilon \in [ 2 , 3 2 ]$ .
57
+
58
+ One-step target class methods FGSM finds adversarial perturbations which increase the value of the loss function. An alternative approach is to maximize probability $p ( y _ { t a r g e t } \mid X )$ of some specific target class $y _ { t a r g e t }$ which is unlikely to be the true class for a given image. For a neural network with cross-entropy loss this will lead to the following formula for the one-step target class method:
59
+
60
+ $$
61
+ X ^ { a d v } = X - \epsilon \mathrm { s i g n } \bigl ( \nabla _ { X } J ( X , y _ { t a r g e t } ) \bigr )
62
+ $$
63
+
64
+ As a target class we can use the least likely class predicted by the network $y _ { L L } = \arg \operatorname* { m i n } _ { y } \{ p ( y \mid$ $\pmb { X } ) \}$ , as suggested by Kurakin et al. (2016). In such case we refer to this method as one-step least likely class or just “step l.l.” Alternatively we can use a random class as target class. In such a case we refer to this method as “step rnd.”.
65
+
66
+ Basic iterative method A straightforward extension of FGSM is to apply it multiple times with small step size:
67
+
68
+ $$
69
+ X _ { 0 } ^ { a d v } = X , \quad X _ { N + 1 } ^ { a d v } = C l i p _ { X , \epsilon } \Big \{ X _ { N } ^ { a d v } + \alpha \mathrm { s i g n } \big ( \nabla _ { X } J \big ( X _ { N } ^ { a d v } , y _ { t r u e } \big ) \big ) \Big \}
70
+ $$
71
+
72
+ In our experiments we used $\alpha = 1$ , i.e. we changed the value of each pixel only by 1 on each step. We selected the number of iterations to be $\operatorname* { m i n } ( \epsilon + 4 , 1 . 2 5 \epsilon )$ . See more information on this method in Kurakin et al. (2016). Below we refer to this method as “iter. basic” method.
73
+
74
+ Iterative least-likely class method By running multiple iterations of the “step l.l.�� method we can get adversarial examples which are misclassified in more than $9 9 \%$ of the cases:
75
+
76
+ $$
77
+ X _ { 0 } ^ { a d v } = X , \quad X _ { N + 1 } ^ { a d v } = C l i p _ { X , \epsilon } \left\{ X _ { N } ^ { a d v } - \alpha \mathrm { s i g n } \left( \nabla _ { X } J ( X _ { N } ^ { a d v } , y _ { L L } ) \right) \right\}
78
+ $$
79
+
80
+ $\alpha$ and number of iterations were selected in the same way as for the basic iterative method. Below we refer to this method as the “iter. l.l.”.
81
+
82
+ # 3 ADVERSARIAL TRAINING
83
+
84
+ The basic idea of adversarial training is to inject adversarial examples into the training set, continually generating new adversarial examples at every step of training (Goodfellow et al., 2014). Adversarial training was originally developed for small models that did not use batch normalization. To scale adversarial training to ImageNet, we recommend using batch normalization (Ioffe & Szegedy, 2015). To do so successfully, we found that it was important for examples to be grouped into batches containing both normal and adversarial examples before taking each training step, as described in algorithm 1.
85
+
86
+ We use a loss function that allows independent control of the number and relative weight of adversarial examples in each batch:
87
+
88
+ $$
89
+ L o s s = \frac { 1 } { ( m - k ) + \lambda k } \left( \sum _ { i \in C L E A N } L ( X _ { i } | y _ { i } ) + \lambda \sum _ { i \in A D V } L ( X _ { i } ^ { a d v } | y _ { i } ) \right)
90
+ $$
91
+
92
+ where $L ( X | y )$ is a loss on a single example $X$ with true class $y ; m$ is total number of training examples in the minibatch; $k$ is number of adversarial examples in the minibatch and $\lambda$ is a parameter which controls the relative weight of adversarial examples in the loss. We used $\lambda = 0 . 3$ , $m = 3 2$ , and $k = 1 6$ . Note that we replace each clean example with its adversarial counterpart, for a total minibatch size of 32, which is a departure from previous approaches to adversarial training.
93
+
94
+ <table><tr><td colspan="2">Algorithm1 Adversarial training of network N. Size of the training minibatch is m.Number of adversarial images in the minibatch is k.</td></tr><tr><td colspan="2">1:Randomly initialize network N</td></tr><tr><td>2: repeat</td><td></td></tr><tr><td>3:</td><td>Read minibatch B = {X1,..., Xm} from training set</td></tr><tr><td>4:</td><td></td></tr><tr><td>5:</td><td>clean examples {X1,..., Xk} using current state of the network N Xkdo,Xk+1,Xmy</td></tr><tr><td>6:</td><td>Do one training step of network N using minibatch B&#x27;</td></tr><tr><td>7:</td><td></td></tr><tr><td colspan="2">until training converged</td></tr></table>
95
+
96
+ Fraction and weight of adversarial examples which we used in each minibatch differs from Huang et al. (2015) where authors replaced entire minibatch with adversarial examples. However their experiments was done on smaller datasets (MNIST and CIFAR-10) in which case adversarial training does not lead to decrease of accuracy on clean images. We found that our approach works better for ImageNet models (corresponding comparative experiments could be found in Appendix E).
97
+
98
+ We observed that if we fix $\epsilon$ during training then networks become robust only to that specific value of $\epsilon$ . We therefore recommend choosing $\epsilon$ randomly, independently for each training example. In our experiments we achieved best results when magnitudes were drawn from a truncated normal distribution defined in interval [0, 16] with underlying normal distribution $N ( \mu = 0 , \sigma = 8 )$ ) . 1
99
+
100
+ # 4 EXPERIMENTS
101
+
102
+ We adversarially trained an Inception v3 model (Szegedy et al., 2015) on ImageNet. All experiments were done using synchronous distributed training on 50 machines, with a minibatch of 32 examples on each machine. We observed that the network tends to reach maximum accuracy at around $1 3 0 k -$ $1 5 0 k$ iterations. If we continue training beyond $1 5 0 k$ iterations then eventually accuracy might decrease by a fraction of a percent. Thus we ran experiments for around $1 5 0 k$ iterations and then used the obtained accuracy as the final result of the experiment.
103
+
104
+ Similar to Szegedy et al. (2015) we used RMSProp optimizer for training. We used a learning rate of 0.045 except where otherwise indicated.
105
+
106
+ We looked at interaction of adversarial training and other forms or regularization (dropout, label smoothing and weight decay). By default training of Inception v3 model uses all three of them. We noticed that disabling label smoothing and/or dropout leads to small decrease of accuracy on clean examples (by $0 . 1 \% - 0 . 5 \%$ for top 1 accuracy) and small increase of accuracy on adversarial examples (by $1 \% - 1 . 5 \%$ for top 1 accuracy). On the other hand reducing weight decay leads to decrease of accuracy on both clean and adversarial examples.
107
+
108
+ We experimented with delaying adversarial training by 0, $1 0 k$ , $2 0 k$ and $4 0 k$ iterations. In such case we used only clean examples during the first $N$ training iterations and after $N$ iterations included both clean and adversarial examples in the minibatch. We noticed that delaying adversarial training has almost no effect on accuracy on clean examples (difference in accuracy within $0 . 2 \%$ ) after sufficient number of training iterations (more than $7 0 k$ in our case). At the same time we noticed that larger delays of adversarial training might cause up to $4 \%$ decline of accuracy on adversarial examples with high magnitude of adversarial perturbations. For small $1 0 k$ delay changes of accuracy was not statistically significant to recommend against it. We used a delay of $1 0 k$ because this allowed us to reuse the same partially trained model as a starting point for many different experiments.
109
+
110
+ For evaluation we used the ImageNet validation set which contains 50, 000 images and does not intersect with the training set.
111
+
112
+ We experimented with adversarial training using several types of one-step methods. We found that adversarial training using any type of one-step method increases robustness to all types of one-step adversarial examples that we tested. However there is still a gap between accuracy on clean and adversarial examples which could vary depending on the combination of methods used for training and evaluation.
113
+
114
+ Adversarial training caused a slight (less than $1 \%$ ) decrease of accuracy on clean examples in our ImageNet experiments. This differs from results of adversarial training reported previously, where adversarial training increased accuracy on the test set (Goodfellow et al., 2014; Miyato et al., 2016b;a). One possible explanation is that adversarial training acts as a regularizer. For datasets with few labeled examples where overfitting is the primary concern, adversarial training reduces test error. For datasets like ImageNet where state-of-the-art models typically have high training set error, adding a regularizer like adversarial training can increase training set error more than it decreases the gap between training and test set error. Our results suggest that adversarial training should be employed in two scenarios:
115
+
116
+ 1. When a model is overfitting, and a regularizer is required.
117
+ 2. When security against adversarial examples is a concern. In this case, adversarial training is the method that provides the most security of any known defense, while losing only a small amount of accuracy.
118
+
119
+ By comparing different one-step methods for adversarial training we observed that the best results in terms or accuracy on test set are achieved using “step l.l.” or “step rnd.” method. Moreover using these two methods helped the model to become robust to adversarial examples generated by other one-step methods. Thus for final experiments we used “step l.l.” adversarial method.
120
+
121
+ For brevity we omitted a detailed comparison of different one-step methods here, but the reader can find it in Appendix A.
122
+
123
+ Table 1: Top 1 and top 5 accuracies of an adversarially trained network on clean images and adversarial images with various test-time . Both training and evaluation were done using “step l.l.” method. Adversarially training caused the baseline model to become robust to adversarial examples but lost some accuracy on clean examples. We therefore also trained a deeper model with two additional Inception blocks. The deeper model benefits more from adversarial training in terms of robustness to adversarial perturbation, and loses less accuracy on clean examples than the smaller model does.
124
+
125
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Clean</td><td rowspan=1 colspan=1>∈=2</td><td rowspan=1 colspan=1>∈=4</td><td rowspan=1 colspan=1>e=8</td><td rowspan=1 colspan=1>∈=16</td></tr><tr><td rowspan=2 colspan=1>Baseline(standard training)</td><td rowspan=1 colspan=1>top1</td><td rowspan=1 colspan=1>78.4%</td><td rowspan=1 colspan=1>30.8%</td><td rowspan=1 colspan=1>27.2%</td><td rowspan=1 colspan=1>27.2%</td><td rowspan=1 colspan=1>29.5%</td></tr><tr><td rowspan=1 colspan=1>top 5</td><td rowspan=1 colspan=1>94.0%</td><td rowspan=1 colspan=1>60.0%</td><td rowspan=1 colspan=1>55.6%</td><td rowspan=1 colspan=1>55.1%</td><td rowspan=1 colspan=1>57.2%</td></tr><tr><td rowspan=1 colspan=1>Adv. training</td><td rowspan=1 colspan=1>top1top5</td><td rowspan=1 colspan=1>77.6%93.8%</td><td rowspan=1 colspan=1>73.5%91.7%</td><td rowspan=1 colspan=1>74.0%91.9%</td><td rowspan=1 colspan=1>74.5%92.0%</td><td rowspan=1 colspan=1>73.9%91.4%</td></tr><tr><td rowspan=1 colspan=1>Deeper model(standard training)</td><td rowspan=1 colspan=1>top1top 5</td><td rowspan=1 colspan=1>78.7%94.4%</td><td rowspan=1 colspan=1>33.5%63.3%</td><td rowspan=1 colspan=1>30.0%58.9%</td><td rowspan=1 colspan=1>30.0%58.1%</td><td rowspan=1 colspan=1>31.6%59.5%</td></tr><tr><td rowspan=1 colspan=1>Deeper model(Adv. training)</td><td rowspan=1 colspan=1>top1top5</td><td rowspan=1 colspan=1>78.1%94.1%</td><td rowspan=1 colspan=1>75.4%92.6%</td><td rowspan=1 colspan=1>75.7%92.7%</td><td rowspan=1 colspan=1>75.6%92.5%</td><td rowspan=1 colspan=1>74.4%91.6%</td></tr></table>
126
+
127
+ Results of adversarial training using “step l.l.” method are provided in Table 1. As it can be seen from the table we were able to significantly increase top-1 and top-5 accuracy on adversarial examples (up to $7 4 \%$ and $9 2 \%$ correspondingly) to make it to be on par with accuracy on clean images. However we lost about $0 . 8 \%$ accuracy on clean examples.
128
+
129
+ We were able to slightly reduce the gap in the accuracy on clean images by slightly increasing the size of the model. This was done by adding two additional Inception blocks to the model. For specific details about Inception blocks refer to Szegedy et al. (2015).
130
+
131
+ Unfortunately, training on one-step adversarial examples does not confer robustness to iterative adversarial examples, as shown in Table 2.
132
+
133
+ Table 2: Accuracy of adversarially trained network on iterative adversarial examples. Adversarial training was done using “step l.l.” method. Results were computed after $1 4 0 k$ iterations of training. Overall, we see that training on one-step adversarial examples does not confer resistance to iterative adversarial examples.
134
+
135
+ <table><tr><td rowspan=1 colspan=1>Adv. method</td><td rowspan=1 colspan=1>Training</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Clean</td><td rowspan=1 colspan=1>∈=2</td><td rowspan=1 colspan=1>∈=4</td><td rowspan=1 colspan=1>∈=8</td><td rowspan=1 colspan=1>∈=16</td></tr><tr><td rowspan=2 colspan=1>Iter. 1.1.</td><td rowspan=1 colspan=1>Adv. training</td><td rowspan=1 colspan=1>top 1top5</td><td rowspan=1 colspan=1>77.4%93.9%</td><td rowspan=1 colspan=1>29.1%56.9%</td><td rowspan=1 colspan=1>7.5%21.3%</td><td rowspan=1 colspan=1>3.0%9.4%</td><td rowspan=1 colspan=1>1.5%5.5%</td></tr><tr><td rowspan=1 colspan=1>Baseline</td><td rowspan=1 colspan=1>top1top5</td><td rowspan=1 colspan=1>78.3%94.1%</td><td rowspan=1 colspan=1>23.3%49.3%</td><td rowspan=1 colspan=1>5.5%18.8%</td><td rowspan=1 colspan=1>1.8%7.8%</td><td rowspan=1 colspan=1>0.7%4.4%</td></tr><tr><td rowspan=2 colspan=1>Iter. basic</td><td rowspan=1 colspan=1>Adv. training</td><td rowspan=1 colspan=1>top 1top5</td><td rowspan=1 colspan=1>77.4%93.9%</td><td rowspan=1 colspan=1>30.0%44.3%</td><td rowspan=1 colspan=1>25.2%33.6%</td><td rowspan=1 colspan=1>23.5%28.4%</td><td rowspan=1 colspan=1>23.2%26.8%</td></tr><tr><td rowspan=1 colspan=1>Baseline</td><td rowspan=1 colspan=1>top1top5</td><td rowspan=1 colspan=1>78.3%94.1%</td><td rowspan=1 colspan=1>31.4%43.1%</td><td rowspan=1 colspan=1>28.1%34.8%</td><td rowspan=1 colspan=1>26.4%30.2%</td><td rowspan=1 colspan=1>25.9%28.8%</td></tr></table>
136
+
137
+ We also tried to use iterative adversarial examples during training, however we were unable to gain any benefits out of it. It is computationally costly and we were not able to obtain robustness to adversarial examples or to prevent the procedure from reducing the accuracy on clean examples significantly. It is possible that much larger models are necessary to achieve robustness to such a large class of inputs.
138
+
139
+ # 4.2 LABEL LEAKING
140
+
141
+ We discovered a label leaking effect: when a model is trained on FGSM adversarial examples and then evaluated using FGSM adversarial examples, the accuracy on adversarial images becomes much higher than the accuracy on clean images (see Table 3). This effect also occurs (but to a lesser degree) when using other one-step methods that require the true label as input.
142
+
143
+ We say that label for specific example has been leaked if and only if the model classifies an adversarial example correctly when that adversarial example is generated using the true label but misclassifies a corresponding adversarial example that was created without using the true label. If too many labels has been leaked then accuracy on adversarial examples might become bigger than accuracy on clean examples which we observed on ImageNet dataset.
144
+
145
+ We believe that the effect occurs because one-step methods that use the true label perform a very simple and predictable transformation that the model can learn to recognize. The adversarial example construction process thus inadvertently leaks information about the true label into the input. We found that the effect vanishes if we use adversarial example construction processes that do not use the true label. The effect also vanishes if an iterative method is used, presumably because the output of an iterative process is more diverse and less predictable than the output of a one-step process.
146
+
147
+ Overall due to the label leaking effect, we do not recommend to use FGSM or other methods defined with respect to the true class label to evaluate robustness to adversarial examples; we recommend to use other one-step methods that do not directly access the label instead.
148
+
149
+ We recommend to replace the true label with the most likely label predicted by the model. Alternately, one can maximize the cross-entropy between the full distribution over all predicted labels given the clean input and the distribution over all predicted labels given the perturbed input (Miyato et al., 2016b).
150
+
151
+ We revisited the adversarially trained MNIST classifier from Goodfellow et al. (2014) and found that it too leaks labels. The most labels are leaked with $\epsilon = 0 . 3$ on MNIST data in $[ 0 , 1 ]$ . With that $\epsilon$ , the model leaks 79 labels on the test set of 10,000 examples. However, the amount of label leaking is small compared to the amount of error caused by adversarial examples. The error rate on adversarial examples exceeds the error rate on clean examples for $\epsilon \in \{ . 0 5 , . 1 , . 2 5 , . 3 , . 4 , . 4 5 , . 5 \}$ . This explains why the label leaking effect was not noticed earlier.
152
+
153
+ ![](images/958081ef9f622f7fd5d7461988d99be64d8f6a7e76185807bf0637cc6550f678.jpg)
154
+ No adversarial training, “basic iter.” adv. examples With adversarial training, “basic iter.” adv. examples
155
+ Figure 1: Influence of size of the model on top 1 classification accuracy of various adversarial examples. Left column — base model without adversarial training, right column — model with adversarial training using “step l.l.” method. Top row — results on “step l.l.” adversarial images, middle row — results on “iter. l.l.” adversarial images, bottom row — results on “basic iter.” adversarial images. See text of Section 4.3 for explanation of meaning of horizontal and vertical axes.
156
+
157
+ Table 3: Effect of label leaking on adversarial examples. When training and evaluation was done using FGSM accuracy on adversarial examples was higher than on clean examples. This effect was not happening when training and evaluation was done using “step l.l.” method. In both experiments training was done for $1 5 0 k$ iterations with initial learning rate 0.0225.
158
+
159
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Clean</td><td rowspan=1 colspan=1>∈=2</td><td rowspan=1 colspan=1>∈=4</td><td rowspan=1 colspan=1>∈=8</td><td rowspan=1 colspan=1>∈=16</td></tr><tr><td rowspan=1 colspan=1>No label leaking,training and eval using “step 1.1.”</td><td rowspan=1 colspan=1>top1top5</td><td rowspan=1 colspan=1>77.3%93.7%</td><td rowspan=1 colspan=1>72.8%91.1%</td><td rowspan=1 colspan=1>73.1%91.1%</td><td rowspan=1 colspan=1>73.4%91.0%</td><td rowspan=1 colspan=1>72.0%90.3%</td></tr><tr><td rowspan=1 colspan=1>With label leaking,training and eval using FGSM</td><td rowspan=1 colspan=1>top1top5</td><td rowspan=1 colspan=1>76.6%93.2%</td><td rowspan=1 colspan=1>86.2%95.9%</td><td rowspan=1 colspan=1>87.6%96.4%</td><td rowspan=1 colspan=1>88.7%96.9%</td><td rowspan=1 colspan=1>87.0%96.4%</td></tr></table>
160
+
161
+ # 4.3 INFLUENCE OF MODEL CAPACITY ON ADVERSARIAL ROBUSTNESS
162
+
163
+ We studied how the size of the model (in terms of number of parameters) could affect robustness to adversarial examples. We picked Inception v3 as a base model and varied its size by changing the number of filters in each convolution.
164
+
165
+ For each experiment we picked a scale factor $\rho$ and multiplied the number of filters in each convolution by $\rho$ . In other words $\rho = 1$ means unchanged Inception v3, $\rho = 0 . 5$ means Inception with half of the usual number of filters in convolutions, etc . . . For each chosen $\rho$ we trained two independent models: one with adversarial training and another without. Then we evaluated accuracy on clean and adversarial examples for both trained models. We have run these experiments for $\rho \in [ 0 . 5 , 2 . 0 ]$ .
166
+
167
+ In earlier experiments (Table 1) we found that deeper models benefit more from adversarial training. The increased depth changed many aspects of the model architecture. These experiments varying $\rho$ examine the effect in a more controlled setting, where the architecture remains constant except for the number of feature maps in each layer.
168
+
169
+ In all experiments we observed that accuracy on clean images kept increasing with increase of $\rho$ , though its increase slowed down as $\rho$ became bigger. Thus as a measure of robustness we used the ratio of accuracy on adversarial images to accuracy on clean images because an increase of this ratio means that the gap between accuracy on adversarial and clean images becomes smaller. If this ratio reaches 1 then the accuracy on adversarial images is the same as on clean ones. For a successful adversarial example construction technique, we would never expect this ratio to exceed 1, since this would imply that the adversary is actually helpful. Some defective adversarial example construction techniques, such as those suffering from label leaking, can inadvertently produce a ratio greater than 1.
170
+
171
+ Results with ratios of accuracy for various adversarial methods and $\epsilon$ are provided in Fig. 1.
172
+
173
+ For models without adversarial training, we observed that there is an optimal value of $\rho$ yielding best robustness. Models that are too large or too small perform worse. This may indicate that models become more robust to adversarial examples until they become large enough to overfit in some respect.
174
+
175
+ For adversarially trained models, we found that robustness consistently increases with increases in model size. We were not able to train large enough models to find when this process ends, but we did find that models with twice the normal size have an accuracy ratio approaching 1 for one-step adversarial examples. When evaluated on iterative adversarial examples, the trend toward increasing robustness with increasing size remains but has some exceptions. Also, none of our models was large enough to approach an accuracy ratio of 1 in this regime.
176
+
177
+ Overall we recommend exploring increase of accuracy (along with adversarial training) as a measure to improve robustness to adversarial examples.
178
+
179
+ # 4.4 TRANSFERABILITY OF ADVERSARIAL EXAMPLES
180
+
181
+ From a security perspective, an important property of adversarial examples is that they tend to transfer from one model to another, enabling an attacker in the black-box scenario to create adversarial
182
+
183
+ Table 4: Transfer rate of adversarial examples generated using different adversarial methods and perturbation size $\epsilon = 1 6$ . This is equivalent to the error rate in an attack scenario where the attacker prefilters their adversarial examples by ensuring that they are misclassified by the source model before deploying them against the target. Transfer rates are rounded to the nearest percent in order to fit the table on the page. The following models were used for comparison: $A$ and $B$ are Inception v3 models with different random initializations, $C$ is Inception v3 model with ELU activations instead of Relu, $D$ is Inception v4 model. See also Table 6 for the absolute error rate when the attack is not prefiltered, rather than the transfer rate of adversarial examples.
184
+
185
+ <table><tr><td rowspan="3"></td><td rowspan="3">source model</td><td colspan="4">FGSM</td><td colspan="4">basic iter.</td><td colspan="4">iter 1.1.</td></tr><tr><td colspan="4">target model</td><td colspan="4">target model</td><td colspan="4">target model</td></tr><tr><td>A</td><td>B</td><td>C</td><td>D</td><td>A</td><td>B</td><td>C</td><td>D</td><td>A</td><td>B</td><td>C</td><td>D</td></tr><tr><td rowspan="4">top 1</td><td>A(v3)</td><td>100</td><td>56</td><td>58</td><td>47</td><td>100</td><td>46</td><td>45</td><td>33</td><td>100</td><td>13</td><td>13</td><td>9</td></tr><tr><td>B(v3)</td><td>58</td><td>100</td><td>59</td><td>51</td><td>41</td><td>100</td><td>40</td><td>30</td><td>15</td><td>100</td><td>13</td><td>10</td></tr><tr><td>C (v3ELU)</td><td>56</td><td>58</td><td>100</td><td>52</td><td>44</td><td>44</td><td>100</td><td>32</td><td>12</td><td>11</td><td>100</td><td>9</td></tr><tr><td>D(v4)</td><td>50</td><td>54</td><td>52</td><td>100</td><td>35</td><td>39</td><td>37</td><td>100</td><td>12</td><td>13</td><td>13</td><td>100</td></tr><tr><td rowspan="4">top 5</td><td>A(v3)</td><td>100</td><td>50</td><td>50</td><td>36</td><td>100</td><td>15</td><td>17</td><td>11</td><td>100</td><td>8</td><td>7</td><td>5</td></tr><tr><td>B(v3)</td><td>51</td><td>100</td><td>50</td><td>37</td><td>16</td><td>100</td><td>14</td><td>10</td><td>7</td><td>100</td><td>5</td><td>4</td></tr><tr><td>C (v3ELU)</td><td>44</td><td>45</td><td>100</td><td>37</td><td>16</td><td>18</td><td>100</td><td>13</td><td>6</td><td>6</td><td>100</td><td>4</td></tr><tr><td>D(v4)</td><td>42</td><td>38</td><td>46</td><td>100</td><td>11</td><td>15</td><td>15</td><td>100</td><td>6</td><td>6</td><td>6</td><td>100</td></tr></table>
186
+
187
+ ![](images/e9b8d3fff56e6552946abda2fde8870f1863160f21d42f299541e0e998adfd18.jpg)
188
+ Top 1 transferability.
189
+
190
+ ![](images/f42264aec46ba5a0ae17952b02c11ed374b019c801053d32a9cdfd3008e23da2.jpg)
191
+ Top 5 transferability.
192
+
193
+ Figure 2: Influence of the size of adversarial perturbation on transfer rate of adversarial examples. Transfer rate was computed using two Inception v3 models with different random intializations. As could be seen from these plots, increase of $\epsilon$ leads to increase of transfer rate. It should be noted that transfer rate is a ratio of number of transferred adversarial examples to number of successful adversarial examples for source network. Both numerator and denominator of this ratio are increasing with increase of $\epsilon$ , however we observed that numerator (i.e. number of transferred examples) is increasing much faster compared to increase of denominator. For example when $\epsilon$ increases from 8 to 16 relative increase of denominator is less than $1 \%$ for each of the considered methods, at the same time relative increase of numerator is more than $2 0 \%$ .
194
+
195
+ examples for their own substitute model, then deploy those adversarial examples to fool a target model (Szegedy et al., 2014; Goodfellow et al., 2014; Papernot et al., 2016b).
196
+
197
+ We studied transferability of adversarial examples between the following models: two copies of normal Inception v3 (with different random initializations and order or training examples), Inception v4 (Szegedy et al., 2016) and Inception v3 which uses ELU activation (Clevert et al., 2015) instead of Relu2. All of these models were independently trained from scratch until they achieved maximum accuracy.
198
+
199
+ In each experiment we fixed the source and target networks, constructed adversarial examples from 1000 randomly sampled clean images from the test set using the source network and performed classification of all of them using both source and target networks. These experiments were done independently for different adversarial methods.
200
+
201
+ We measured transferability using the following criteria. Among 1000 images we picked only misclassified adversarial example for the source model (i.e. clean classified correctly, adversarial misclassified) and measured what fraction of them were misclassified by the target model.
202
+
203
+ Transferability results for all combinations of models and $\epsilon = 1 6$ are provided in Table 4. Results for various $\epsilon$ but fixed source and target model are provided in Fig. 2.
204
+
205
+ As can be seen from the results, FGSM adversarial examples are the most transferable, while “iter l.l.” are the least. On the other hand “iter l.l.” method is able to fool the network in more than $9 9 \%$ cases (top 1 accuracy), while FGSM is the least likely to fool the network. This suggests that there might be an inverse relationship between transferability of specific method and ability of the method to fool the network. We haven’t studied this phenomenon further, but one possible explanation could be the fact that iterative methods tend to overfit to specific network parameters.
206
+
207
+ In addition, we observed that for each of the considered methods transfer rate is increasing with increase of $\epsilon$ (see Fig. 2). Thus potential adversary performing a black-box attack have an incentive to use higher $\epsilon$ to increase the chance of success of the attack.
208
+
209
+ # 5 CONCLUSION
210
+
211
+ In this paper we studied how to increase robustness to adversarial examples of large models (Inception v3) trained on large dataset (ImageNet). We showed that adversarial training provides robustness to adversarial examples generated using one-step methods. While adversarial training didn’t help much against iterative methods we observed that adversarial examples generated by iterative methods are less likely to be transferred between networks, which provides indirect robustness against black box adversarial attacks. In addition we observed that increase of model capacity could also help to increase robustness to adversarial examples especially when used in conjunction with adversarial training. Finally we discovered the effect of label leaking which resulted in higher accuracy on FGSM adversarial examples compared to clean examples when the network was adversarially trained.
212
+
213
+ # REFERENCES
214
+
215
+ Battista Biggio, Igino Corona, Davide Maiorca, Blaine Nelson, Nedim Srndiˇ c, Pavel Laskov, Gior-´ gio Giacinto, and Fabio Roli. Evasion attacks against machine learning at test time. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 387– 402. Springer, 2013.
216
+ Djork-Arne Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep net- ´ work learning by exponential linear units (elus). CoRR, abs/1511.07289, 2015. URL http: //arxiv.org/abs/1511.07289.
217
+ Nilesh Dalvi, Pedro Domingos, Sumit Sanghai, Deepak Verma, et al. Adversarial classification. In Proceedings of the tenth ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 99–108. ACM, 2004.
218
+ Ian J. Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. CoRR, abs/1412.6572, 2014. URL http://arxiv.org/abs/1412.6572.
219
+ Ruitong Huang, Bing Xu, Dale Schuurmans, and Csaba Szepesvari. Learning with a strong adver- ´ sary. CoRR, abs/1511.03034, 2015. URL http://arxiv.org/abs/1511.03034.
220
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. 2015.
221
+ Alex Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. Technical report, arXiv, 2016. URL https://arxiv.org/abs/1607.02533.
222
+ Takeru Miyato, Andrew M Dai, and Ian Goodfellow. Virtual adversarial training for semi-supervised text classification. arXiv preprint arXiv:1605.07725, 2016a.
223
+ Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, Ken Nakae, and Shin Ishii. Distributional smoothing with virtual adversarial training. In International Conference on Learning Representations (ICLR2016), April 2016b.
224
+ N. Papernot, P. McDaniel, and I. Goodfellow. Transferability in Machine Learning: from Phenomena to Black-Box Attacks using Adversarial Samples. ArXiv e-prints, May 2016b. URL http://arxiv.org/abs/1605.07277.
225
+ Nicolas Papernot, Patrick Drew McDaniel, Xi Wu, Somesh Jha, and Ananthram Swami. Distillation as a defense to adversarial perturbations against deep neural networks. CoRR, abs/1511.04508, 2015. URL http://arxiv.org/abs/1511.04508.
226
+ Nicolas Papernot, Patrick Drew McDaniel, Ian J. Goodfellow, Somesh Jha, Z. Berkay Celik, and Ananthram Swami. Practical black-box attacks against deep learning systems using adversarial examples. CoRR, abs/1602.02697, 2016a. URL http://arxiv.org/abs/1602.02697.
227
+ Andras Rozsa, Manuel Gunther, and Terrance E Boult. Are accuracy and robustness correlated? ¨ arXiv preprint arXiv:1610.04563, 2016.
228
+ 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. arXiv preprint arXiv:1409.0575, 2014.
229
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian J. Goodfellow, and Rob Fergus. Intriguing properties of neural networks. ICLR, abs/1312.6199, 2014. URL http://arxiv.org/abs/1312.6199.
230
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. CoRR, abs/1512.00567, 2015. URL http://arxiv.org/abs/1512.00567.
231
+ Christian Szegedy, Sergey Ioffe, and Vincent Vanhoucke. Inception-v4, inception-resnet and the impact of residual connections on learning. CoRR, abs/1602.07261, 2016. URL http: //arxiv.org/abs/1602.07261.
232
+
233
+ # Appendices
234
+
235
+ # A COMPARISON OF ONE-STEP ADVERSARIAL METHODS
236
+
237
+ In addition to FGSM and “step l.l.” methods we explored several other one-step adversarial methods both for training and evaluation. Generally all of these methods can be separated into two large categories. Methods which try to maximize the loss (similar to FGSM) are in the first category. The second category contains methods which try to maximize the probability of a specific target class (similar to “step l.l.”). We also tried to use different types of random noise instead of adversarial images, but random noise didn’t help with robustness against adversarial examples.
238
+
239
+ The full list of one-step methods we tried is as follows:
240
+
241
+ • Methods increasing loss function $J$ – FGSM (described in details in Section 2.2):
242
+
243
+ $$
244
+ X ^ { a d v } = X + \epsilon \mathrm { s i g n } \big ( \nabla _ { X } J ( X , y _ { t r u e } ) \big )
245
+ $$
246
+
247
+ – FGSM-pred or fast method with predicted class. It is similar to FGSM but uses the label of the class predicted by the network instead of true class $y _ { t r u e }$ .
248
+
249
+ – “Fast entropy” or fast method designed to maximize the entropy of the predicted distribution, thereby causing the model to become less certain of the predicted class.
250
+
251
+ – “Fast grad. $L _ { 2 } '$ is similar to FGSM but uses the value of gradient instead of its sign. The value of gradient is normalized to have unit $L _ { 2 }$ norm:
252
+
253
+ $$
254
+ X ^ { a d v } = X + \epsilon \frac { \nabla _ { X } J ( X , y _ { t r u e } ) } { \left\| \nabla _ { X } J ( X , y _ { t r u e } ) \right\| _ { 2 } }
255
+ $$
256
+
257
+ Miyato et al. (2016b) advocate this method.
258
+
259
+ – “Fast grad. $L _ { \infty } , $ is similar to “fast grad. $L _ { 2 } { } ^ { \ ' }$ but uses $L _ { \infty }$ norm for normalization.
260
+
261
+ • Methods increasing the probability of the selected target class
262
+
263
+ – “Step l.l.” is one-step towards least likely class (also described in Section 2.2):
264
+
265
+ $$
266
+ X ^ { a d v } = X - \epsilon \mathrm { s i g n } \bigl ( \nabla _ { X } J ( X , y _ { t a r g e t } ) \bigr )
267
+ $$
268
+
269
+ where $y _ { t a r g e t } = \arg \operatorname* { m i n } _ { y } \{ p ( y \mid X ) \}$ is least likely class prediction by the network. – “Step rnd.” is similar to “step l.l.” but uses random class instead of least likely class.
270
+
271
+ • Random perturbations
272
+
273
+ – Sign of random perturbation. This is an attempt to construct random perturbation which has similar structure to perturbations generated by FGSM:
274
+
275
+ $$
276
+ X ^ { a d v } = X + \epsilon \mathrm { s i g n } ( \mathcal { N } )
277
+ $$
278
+
279
+ where $\mathcal { N }$ is random normal variable with zero mean and identity covariance matrix.
280
+
281
+ – Random truncated normal perturbation with zero mean and $0 . 5 \epsilon$ standard deviation defined on $[ - \epsilon , \epsilon ]$ and uncorrelated pixels, which leads to the following formula for perturbed images:
282
+
283
+ $$
284
+ X ^ { a d v } = X + \mathcal { T }
285
+ $$
286
+
287
+ where $\tau$ is a random variable with truncated normal distribution.
288
+
289
+ Overall, we observed that using only one of these single step methods during adversarial training is sufficient to gain robustness to all of them. Fig. 3 shows accuracy on various one-step adversarial examples when the network was trained using only “step l.l.” method.
290
+
291
+ At the same time we observed that not all one-step methods are equally good for adversarial training, as shown in Table 5. The best results (achieving both good accuracy on clean data and good accuracy on adversarial inputs) were obtained when adversarial training was done using “step l.l.” or “step rnd.” methods.
292
+
293
+ ![](images/58f7f6cb781f7b825dd826be739683c9c880fd5a3796af47870f220250c24875.jpg)
294
+ Figure 3: Comparison of different one-step adversarial methods during eval. Adversarial training was done using “step l.l.” method. Some evaluation methods show increasing accuracy with increasing $\epsilon$ over part of the curve, due to the label leaking effect.
295
+
296
+ # B ADDITIONAL RESULTS WITH SIZE OF THE MODEL
297
+
298
+ Section 4.3 contains details regarding the influence of size of the model on robustness to adversarial examples. Here we provide additional Figure 4 which shows robustness calculated using top 5 accuracy. Generally it exhibits the same properties as the corresponding plots for top 1 accuracy.
299
+
300
+ # C ADDITIONAL RESULTS ON TRANSFERABILITY
301
+
302
+ Section 4.4 contains results with transfer rate of various adversarial examples between models. In addition to transfer rate computed only on misclassified adversarial examples it is also interesting to observe the error rate of all candidate adversarial examples generated for one model and classified by other model.
303
+
304
+ This result might be interesting because it models the following attack. Instead of trying to pick “good” adversarial images an adversary tries to modify all available images in order to get as much misclassified images as possible.
305
+
306
+ To compute the error rate we randomly generated 1000 adversarial images using the source model and then classified them using the target model. Results for various models, adversarial methods
307
+
308
+ Table 5: Comparison of different one-step adversarial methods for adversarial training. The evaluation was run after $9 0 k$ training steps.
309
+
310
+ \*) In all cases except “fast grad $L _ { 2 } { } ^ { \ ' }$ and “fast grad $L _ { \infty }$ ” the evaluation was done using FGSM. For “fast grad $L _ { 2 } { } ^ { \ ' }$ and “fast grad $L _ { \infty }$ ” the evaluation was done using “step l.l.” method. In the case where both training and testing were done with FGSM, the performance on adversarial examples is artificially high due to the label leaking effect. Based on this table, we recommend using “step rnd.” or “step l.l.” as the method of generating adversarial examples at training time, in order to obtain good accuracy on both clean and adversarial examples. We computed $9 5 \%$ confidence intervals based on the standard error of the mean around the test error, using the fact that the test error was evaluated with 50,000 samples. Within each column, we indicate which methods are statistically tied for the best using bold face.
311
+
312
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Clean</td><td rowspan=1 colspan=1>∈=2</td><td rowspan=1 colspan=1>∈=4</td><td rowspan=1 colspan=1>∈=8</td><td rowspan=1 colspan=1>∈=16</td></tr><tr><td rowspan=1 colspan=1>No adversarial training</td><td rowspan=1 colspan=1>76.8%</td><td rowspan=1 colspan=1>40.7%</td><td rowspan=1 colspan=1>39.0%</td><td rowspan=1 colspan=1>37.9%</td><td rowspan=1 colspan=1>36.7%</td></tr><tr><td rowspan=1 colspan=1>FGSMFast with predicted classFast entropyStep rnd.Step 1.1.</td><td rowspan=1 colspan=1>74.9%76.4%76.4%76.4%76.3%</td><td rowspan=1 colspan=1>79.3%43.2%62.8%73.0%72.9%</td><td rowspan=1 colspan=1>82.8%42.0%61.7%75.4%75.1%</td><td rowspan=1 colspan=1>85.3%40.9%59.5%76.5%76.2%</td><td rowspan=1 colspan=1>83.2%40.0%54.8%72.5%72.2%</td></tr><tr><td rowspan=1 colspan=1>Fast grad. L2*Fast grad. L*</td><td rowspan=1 colspan=1>76.8%75.6%</td><td rowspan=1 colspan=1>44.0%52.2%</td><td rowspan=1 colspan=1>33.2%39.7%</td><td rowspan=1 colspan=1>26.4%30.9%</td><td rowspan=1 colspan=1>22.5%25.0%</td></tr><tr><td rowspan=1 colspan=1>Sign of random perturbationRandom normal perturbation</td><td rowspan=1 colspan=1>76.5%76.6%</td><td rowspan=1 colspan=1>38.8%38.3%</td><td rowspan=1 colspan=1>36.6%36.0%</td><td rowspan=1 colspan=1>35.0%34.4%</td><td rowspan=1 colspan=1>32.7%31.8%</td></tr></table>
313
+
314
+ and fixed $\epsilon = 1 6$ are provided in Table 6. Results for fixed source and target models and various $\epsilon$ are provided in Fig. 5.
315
+
316
+ Overall the error rate of transferred adversarial examples exhibits the same behavior as the transfer rate described in Section 4.4.
317
+
318
+ Table 6: Error rates on adversarial examples transferred between models, rounded to the nearest percent. Results are provided for adversarial images generated using different adversarial methods and fixed perturbation size $\epsilon = 1 6$ . The following models were used for comparison: $A$ and $B$ are Inception v3 models with different random initializations, $C$ is Inception v3 model with ELU activations instead of Relu, $D$ is Inception $\mathbf { v } 4$ model. See also Table 4 for the transfer rate of adversarial examples, rather than the absolute error rate.
319
+
320
+ <table><tr><td rowspan="3"></td><td rowspan="3">source model</td><td colspan="3">FGSM</td><td colspan="3">basic iter.</td><td colspan="3">iter 1.1.</td></tr><tr><td colspan="3">target model</td><td colspan="3">target model</td><td colspan="3">target model</td></tr><tr><td>A B</td><td>C</td><td>D</td><td>A B</td><td>C</td><td>D</td><td>A B</td><td>C</td><td>D</td></tr><tr><td rowspan="4">top1</td><td>A (v3)</td><td>65 52</td><td>53</td><td>45</td><td>78</td><td>51</td><td>50 42</td><td>100</td><td>32</td><td>31</td><td>27</td></tr><tr><td>B(v3)</td><td>52</td><td>66 54</td><td>48</td><td>50</td><td>79</td><td>51 43</td><td>35</td><td>99</td><td>34</td><td>29</td></tr><tr><td>C (v3 ELU)</td><td>53</td><td>55 70</td><td>50</td><td>47</td><td>46</td><td>74</td><td>40</td><td>31 30</td><td>100</td><td>28</td></tr><tr><td>D(v4)</td><td>47</td><td>51 49</td><td>62</td><td>43</td><td>46</td><td>45</td><td>73 30</td><td>31</td><td>31</td><td>99</td></tr><tr><td rowspan="4">top 5</td><td>A(v3)</td><td>46</td><td>28 28</td><td>22</td><td>76</td><td>17</td><td>18</td><td>13 94</td><td>12</td><td>12</td><td>9</td></tr><tr><td>B(v3)</td><td>29</td><td>46 30</td><td>22</td><td>19</td><td>76</td><td>18</td><td>16 13</td><td>96</td><td>12</td><td>11</td></tr><tr><td>C (v3 ELU)</td><td>28</td><td>29 55</td><td>25</td><td>18</td><td>19</td><td>74 15</td><td>12</td><td>12</td><td>96</td><td>9</td></tr><tr><td>D(v4)</td><td>23</td><td>22 25</td><td>40</td><td>14</td><td>16</td><td>16 70</td><td>11</td><td>11</td><td>11</td><td>97</td></tr></table>
321
+
322
+ # D RESULTS WITH DIFFERENT ACTIVATION FUNCTIONS
323
+
324
+ We evaluated robustness to adversarial examples when the network was trained using various nonlinear activation functions instead of the standard relu activation when used with adversarial training on “step l.l.” adversarial images. We tried to use following activation functions instead of $r e l u$ :
325
+
326
+ • tanh(x)
327
+
328
+ ![](images/4fc8661e7cd6a3298edceb42304156a3090e338bbc38bdf46e2ae112438ddf4e.jpg)
329
+ Figure 4: Influence of size of the model on top 5 classification accuracy of various adversarial examples. For a detailed explanation see Section 4.3 and Figure 1.
330
+
331
+ $$
332
+ \begin{array} { r l } & { \bullet r e l u 6 ( x ) = m i n ( r e l u ( x ) , 6 ) } \\ & { \bullet R e l u D e c a y _ { \beta } ( x ) = \frac { r e l u ( x ) } { 1 + \beta r e l u ( x ) ^ { 2 } } \mathrm { ~ f o r ~ } \beta \in \{ 0 . 1 , 0 . 0 1 , 0 . 0 0 1 \} } \end{array}
333
+ $$
334
+
335
+ Training converged using all of these activations, however test performance was not necessarily the same as with relu.
336
+
337
+ tanh and $R e l u D e c a y _ { \beta = 0 . 1 }$ lose about $2 \% - 3 \%$ of accuracy on clean examples and about $1 0 \% { - } 2 0 \%$ on “step l.l.” adversarial examples. relu6, ReluDecay $\scriptstyle { \beta = 0 . 0 1 }$ and $R e l u D e c a y _ { \beta = 0 . 0 0 1 }$ demonstrated similar accuracy (within $\pm 1 \%$ ) to relu on clean images and few percent loss of accuracy on “step l.l.” images. At the same time all non-linear activation functions increased classification accuracy on some of the iterative adversarial images. Detailed results are provided in Table 7.
338
+
339
+ ![](images/ca2ea6eca31c4cbdef1380db09eb81b2f300edd40a624085c176d03cbe177b94.jpg)
340
+ Top 1 error rate.
341
+
342
+ ![](images/f3ee75c54c24cd0dc49442a4a1cd65a2164519ca594c6face6e8a84029eecabf.jpg)
343
+ Top 5 error rate.
344
+ Figure 5: Influence of the size of adversarial perturbation on the error rate on adversarial examples generated for one model and classified using another model. Both source and target models were Inception v3 networks with different random intializations.
345
+
346
+ Overall non linear activation functions could be used as an additional measure of defense against iterative adversarial images.
347
+
348
+ Table 7: Activation functions and robustness to adversarial examples. For each activation function we adversarially trained the network on “step l.l.” adversarial images and then run classification of clean images and adversarial images generated using various adversarial methods and $\epsilon$ .
349
+
350
+ <table><tr><td>Adv. method</td><td>Activation</td><td>Clean</td><td>∈=2</td><td>∈=4</td><td>∈=8</td><td>∈=16</td></tr><tr><td rowspan="5">Step 1.1.</td><td>relu relu6</td><td>77.5% 77.7%</td><td>74.6% 71.8%</td><td>75.1% 73.5%</td><td>75.5% 74.5%</td><td>74.5% 74.0%</td></tr><tr><td>ReluDecayo.001</td><td>78.0%</td><td>74.0%</td><td>74.9%</td><td>75.2%</td><td>73.9%</td></tr><tr><td></td><td></td><td>73.6%</td><td>74.6%</td><td>75.0%</td><td></td></tr><tr><td>ReluDecayo.01</td><td>77.4%</td><td></td><td></td><td></td><td>73.6%</td></tr><tr><td>ReluDecayo.1 tanh</td><td>75.3% 74.5%</td><td>67.5% 63.7%</td><td>67.5% 65.1%</td><td>67.0% 65.8%</td><td>64.8% 61.9%</td></tr><tr><td rowspan="6">Iter. 1.1.</td><td>relu</td><td>77.5%</td><td>30.2%</td><td>8.0%</td><td>3.1%</td><td>1.6%</td></tr><tr><td>relu6</td><td>77.7%</td><td>39.8%</td><td>13.7%</td><td>4.1%</td><td>1.9%</td></tr><tr><td>ReluDecayo.001</td><td>78.0%</td><td>39.9%</td><td>12.6%</td><td>3.8%</td><td>1.8%</td></tr><tr><td>ReluDecayo.01</td><td>77.4%</td><td>36.2%</td><td>11.2%</td><td>3.2%</td><td>1.6%</td></tr><tr><td>ReluDecayo.1</td><td>75.3%</td><td>47.0%</td><td>25.8%</td><td>6.5%</td><td>2.4%</td></tr><tr><td>tanh</td><td>74.5%</td><td>35.8%</td><td>6.6%</td><td>2.7%</td><td>0.9%</td></tr><tr><td rowspan="6">Basic iter.</td><td>relu</td><td>77.5%</td><td>28.4%</td><td>23.2%</td><td>21.5%</td><td>21.0%</td></tr><tr><td>relu6</td><td>77.7%</td><td>31.2%</td><td>26.1%</td><td>23.8%</td><td>23.2%</td></tr><tr><td>ReluDecayo.001</td><td>78.0%</td><td>32.9%</td><td>27.2%</td><td>24.7%</td><td>24.1%</td></tr><tr><td>ReluDecayo.01</td><td>77.4%</td><td>30.0%</td><td>24.2%</td><td>21.4%</td><td>20.5%</td></tr><tr><td>ReluDecayo.1</td><td>75.3%</td><td>26.7%</td><td>20.6%</td><td>16.5%</td><td>15.2%</td></tr><tr><td>tanh</td><td>74.5%</td><td>24.5%</td><td>22.0%</td><td>20.9%</td><td>20.7%</td></tr></table>
351
+
352
+ # E RESULTS WITH DIFFERENT NUMBER OF ADVERSARIAL EXAMPLES IN THE MINIBATCH
353
+
354
+ We studied how number of adversarial examples $k$ in the minibatch affect accuracy on clean and adversarial examples. Results are summarized in Table 8.
355
+
356
+ Overall we noticed that increase of $k$ lead to increase of accuracy on adversarial examples and to decrease of accuracy on clean examples. At the same having more than half of adversarial examples in the minibatch (which correspond to $k > 1 6$ in our case) does not provide significant improvement of accuracy on adversarial images, however lead to up to $1 \%$ of additional decrease of accuracy on clean images. Thus for most experiments in the paper we have chosen $k = 1 6$ as a reasonable trade-off between accuracy on clean and adversarial images.
357
+
358
+ Table 8: Results of adversarial training depending on $k$ — number of adversarial examples in the minibatch. Adversarial examples for training and evaluation were generated using step l.l. method.
359
+ Row ‘No adv‘ is a baseline result without adversarial training (which is equivalent to $k = 0$ ).
360
+ Rows ‘Adv, $k = X ^ { \ast }$ are results of adversarial training with $X$ adversarial examples in the minibatch.
361
+ Total minibatch size is 32, thus $k = 3 2$ correspond to minibatch without clean examples.
362
+
363
+ <table><tr><td></td><td>Clean</td><td>∈=2</td><td>∈=4</td><td>∈=8</td><td>∈=16</td></tr><tr><td>No adv</td><td>78.2%</td><td>31.5%</td><td>27.7%</td><td>27.8%</td><td>29.7%</td></tr><tr><td>Adv, k = 4</td><td>78.3%</td><td>71.7%</td><td>71.3%</td><td>69.4%</td><td>65.8%</td></tr><tr><td>Adv,k =8</td><td>78.1%</td><td>73.2%</td><td>73.2%</td><td>72.6%</td><td>70.5%</td></tr><tr><td>Adv, k = 16</td><td>77.6%</td><td>73.8%</td><td>75.3%</td><td>76.1%</td><td>75.4%</td></tr><tr><td>Adv,k = 24</td><td>77.1%</td><td>73.0%</td><td>75.3%</td><td>76.2%</td><td>76.0%</td></tr><tr><td>Adv,k = 32</td><td>76.3%</td><td>73.4%</td><td>75.1%</td><td>75.9%</td><td>75.8%</td></tr></table>
md/train/BJypUGZ0Z/BJypUGZ0Z.md ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ACCELERATING NEURAL ARCHITECTURE SEARCH USING PERFORMANCE PREDICTION
2
+
3
+ Bowen Baker∗, Otkrist Gupta∗, Ramesh Raskar
4
+
5
+ # Nikhil Naik
6
+
7
+ Media Laboratory Massachusetts Institute of Technology Cambridge, MA 02142, USA {bowen,otkrist,raskar}@mit.edu
8
+
9
+ Faculty of Arts and Sciences Harvard University Cambridge, MA 02138, USA naik@fas.harvard.edu
10
+
11
+ # ABSTRACT
12
+
13
+ Methods for neural network hyperparameter optimization and architecture search are computationally expensive due to the need to train a large number of model configurations. In this paper, we show that simple regression models can predict the final performance of partially trained model configurations using features based on network architectures, hyperparameters, and time-series validation performance data. We empirically show that our performance prediction models are much more accurate than prominent Bayesian counterparts, are simpler to implement, and are faster to train. Our models can predict final performance in both visual classification and language modeling domains, are effective for predicting performance of drastically varying model architectures, and can even generalize between model classes. Using these prediction models, we also implement an early stopping method for hyperparameter optimization and architecture search, which obtains a speedup of a factor up to 6x in both hyperparameter optimization and architecture search. Finally, we empirically show that our early stopping method can be seamlessly incorporated into both reinforcement learning-based architecture selection algorithms and bandit based search methods. Through extensive experimentation, we empirically show our performance prediction models and early stopping algorithm are state-of-the-art in terms of prediction accuracy and speedup achieved while still identifying the optimal model configurations.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ Significant human expertise and labor is required for designing high-performing neural network architectures and successfully training them for different applications. Ongoing research in two areas—architecture search and hyperparameter optimization—attempts to reduce the amount of human intervention required for these tasks. Hyperparameter optimization methods (e.g., Hutter et al. (2011); Snoek et al. (2015); Li et al. (2017)) focus primarily on obtaining good optimization hyperparameter configurations for training human-designed networks, whereas architecture search algorithms (Bergstra et al., 2013; Verbancsics & Harguess, 2013; Baker et al., 2017; Zoph & Le, 2017) aim to design neural network architectures from scratch. Both sets of algorithms require training a large number of neural network configurations for identifying the right set of hyperparameters or the right network architecture and are hence computationally expensive.
18
+
19
+ When sampling many different model configurations, it is likely that many subpar configurations will be explored. Human experts are quite adept at recognizing and terminating suboptimal model configurations by inspecting their partial learning curves. In this paper we seek to emulate this behavior and automatically identify and terminate subpar model configurations in order to speedup both architecture search and hyperparameter optimization methods. Our method parameterizes learning curve trajectories with simple features derived from model architectures, training hyperparameters, and early time-series measurements from the learning curve. We use these features to train a set of simple regression models that predict the final validation performance of partially trained neural network configurations using a small training set of fully trained curves, and we empirically validate our method in both image classification and language modeling domains. We use these predictions along with uncertainty estimates obtained from small model ensembles to construct a simple early stopping algorithm that can speedup both architecture search and hyperparameter optimization methods.
20
+
21
+ ![](images/25baeeba5fe8e2faa370c9042f700f36b0568f1611f8d41291f30bb7417b7ef6.jpg)
22
+ Figure 1: Example Learning Curves: Example learning curves from experiments considered in this paper. Note the diversity in convergence times and overall learning curve shapes.
23
+
24
+ While there is some prior work on neural network performance prediction using Bayesian methods (Domhan et al., 2015; Klein et al., 2017), our proposed method is significantly more accurate, accessible, and efficient. We hope that our work leads to inclusion of neural network performance prediction and early stopping in the practical neural network training pipeline.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Neural Network Performance Prediction: There has been limited work on predicting neural network performance during training. Domhan et al. (2015) introduce a weighted probabilistic model for learning curves and utilize this model for speeding up hyperparameter search in small convolutional neural networks (CNNs) and fully-connected networks (FCNs). Building on Domhan et al. (2015), Klein et al. (2017) train Bayesian neural networks for predicting unobserved learning curves using a training set of fully and partially observed learning curves. Both methods rely on expensive Markov chain Monte Carlo (MCMC) sampling procedures and handcrafted learning curve basis functions. We also note that Swersky et al. (2014) develop a Gaussian Process kernel for predicting individual learning curves, which they use to automatically stop and restart configurations.
29
+
30
+ Architecture Search: We define architecture search as an algorithmic approach for designing neural network architectures from scratch. The earliest architecture search approaches were based on genetic algorithms (Schaffer et al., 1992; Stanley & Miikkulainen, 2002; Verbancsics & Harguess, 2013) or Bayesian optimization (Bergstra et al., 2013; Shahriari et al., 2016). More recently, reinforcement learning methods have become popular. Baker et al. (2017) use Q-learning to design competitive CNNs for image classification. Zoph & Le (2017) use policy gradients to design state-of-the-art CNNs and recurrent cell architectures. Several methods for architecture search (Cortes et al., 2017; Negrinho & Gordon, 2017; Zoph et al., 2017; Brock et al., 2017; Suganuma et al., 2017) have been proposed this year since the publication of Baker et al. (2017) and Zoph & Le (2017).
31
+
32
+ Hyperparameter Optimization: We define hyperparameter optimization as an algorithmic approach for finding optimal values of architecture independent hyperparameters such as learning rate and batch size, along with a limited search through the network design space. Bayesian hyperparameter optimization methods include those based on sequential model-based optimization (SMAC) (Hutter et al., 2011), Gaussian processes (GP) (Snoek et al., 2012), TPE (Bergstra et al., 2013), and neural networks Snoek et al. (2015). However, random search or grid search is most commonly used in practical settings (Bergstra & Bengio, 2012). Recently, Li et al. (2017) introduced Hyperband, a multiarmed bandit-based efficient random search technique that outperforms state-of-the-art Bayesian optimization methods.
33
+
34
+ # 3 NEURAL NETWORK PERFORMANCE PREDICTION
35
+
36
+ We first describe our model for neural network performance prediction, followed by a description of the datasets used to evaluate our model, and finally present experimental results.
37
+
38
+ # 3.1 MODELING LEARNING CURVES
39
+
40
+ Our goal is to model the validation performance $y _ { T }$ of a neural network configuration $\mathbf { x } \in \mathcal { X } \subset \mathbb { R } ^ { d }$ at epoch $T \in \mathbb { Z } ^ { + }$ using previous performance observations $y ( t )$ . For each configuration $\mathbf { x }$ trained for $T$ epochs, we record a time-series $y ( T ) = y _ { 1 } , y _ { 2 } , \dotsc , y _ { T }$ of validation performances. We train a population of $n$ configurations, obtaining a set $\tilde { \mathcal { S } } = \{ ( \mathbf { x } ^ { 1 } , y ^ { 1 } ( T ) ) , ( \mathbf { x } ^ { 2 } , y ^ { 2 } ( T ) ) , \ldots , ( \mathbf { x } ^ { n } , y ^ { n } ( T ) ) \} .$ This problem formulation is very similar to Klein et al. (2017). Note that most architecture and hyperparameter search methods naturally collect $s$ .
41
+
42
+ We propose to use a set of features $u _ { \mathbf { x } }$ , derived from the neural network configuration $\mathbf { x }$ , along with a subset of time-series performances $y ( \tau ) = ( y _ { t } ) _ { t = 1 , 2 , . . . , \tau }$ (where $1 \leq \tau < T )$ ) from $s$ to train a regression model for estimating $y _ { T }$ . We use models without natural support for variable size input, so we train $T - 1$ regression models, where each successive model uses one more point of the time-series validation data. As we shall see in subsequent sections, this use of sequential regression models (SRM) is more computationally efficient and more precise than methods that train a single model.
43
+
44
+ Features: We use features based on time-series (TS) validation performances, architecture parameters (AP), and hyperparameters (HP). (1) TS: Assume we are training the $\tau ^ { \mathrm { { t h } } }$ model in the SRM. TS features include the validation performances $y ( \tau ) = ( y _ { t } ) _ { t = 1 , 2 , . . . , \tau }$ , the first-order differences of validation performances, i.e. $y _ { t } ^ { \prime } = \left( y _ { t } - y _ { t - 1 } \right)$ , the second-order differences of validation performances, i.e. ${ y _ { t } } ^ { \prime \bar { \prime } } = ( { y _ { t } } ^ { \prime } - { y _ { t - 1 } ^ { \prime } } )$ , and mean and standard deviation of performances. (2) AP: These include total number of weights and number of layers. (3) HP: These include all hyperparameters used for training the neural networks, e.g. initial learning rate and learning rate decay (full list in Appendix Table 4).
45
+
46
+ # 3.2 DATASETS AND TRAINING PROCEDURES
47
+
48
+ Figure 1 shows example learning curves from three of the datasets considered in our experiments. We provide brief summary of the datasets below. Please see Appendix Section A for further details on the search space, preprocessing, hyperparameters and training settings of all datasets.
49
+
50
+ DATASETS WITH VARYING ARCHITECTURES:
51
+
52
+ Deep Resnets (TinyImageNet): We sample 500 ResNet architectures and train them on the TinyImageNet\* dataset (containing 200 classes with 500 training images of $3 2 \times 3 2$ pixels) for 140 epochs. We vary depths, filter sizes and number of convolutional filter block outputs. The network depths vary between 14 and 110.
53
+
54
+ Deep Resnets (CIFAR-10): We sample 500 39-layer ResNet architectures from a search space similar to Zoph & Le (2017), varying kernel width, kernel height, and number of kernels. We train these models for 50 epochs on CIFAR-10.
55
+
56
+ MetaQNN CNNs (CIFAR-10 and SVHN): We sample 1,000 model architectures from the search space detailed by Baker et al. (2017), which allows for varying the numbers and orderings of convolution, pooling, and fully connected layers. The models are between 1 and 12 layers for the SVHN experiment and between 1 and 18 layers for the CIFAR-10 experiment. Each architecture is trained on SVHN and CIFAR-10 datasets for 20 epochs.
57
+
58
+ LSTM (PTB): We sample 300 LSTM models and train them on the Penn Treebank dataset for 60 epochs, evaluating perplexity on the validation set. We vary number of LSTM cells and hidden layer inputs between 10-1400.
59
+
60
+ # DATASETS WITH VARYING HYPERPARAMETERS:
61
+
62
+ Cuda-Convnet (CIFAR-10 and SVHN): We train Cuda-Convnet architecture (Krizhevsky, 2012) with varying values of initial learning rate, learning rate reduction step size, weight decay for convolutional and fully connected layers, and scale and power of local response normalization layers. We train models with CIFAR-10 for 60 epochs and with SVHN for 12 epochs.
63
+
64
+ <table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>v-SVR</td><td rowspan=1 colspan=1>OLS</td><td rowspan=1 colspan=1>BLR</td><td rowspan=1 colspan=1>RF</td></tr><tr><td rowspan=1 colspan=1>MetaQNN (CIFAR-10)</td><td rowspan=1 colspan=1>97.22 ± 0.31</td><td rowspan=1 colspan=1>97.04± 0.42</td><td rowspan=1 colspan=1>97.11 ± 0.32</td><td rowspan=1 colspan=1>94.50 ± 0.78</td></tr><tr><td rowspan=1 colspan=1>Resnet (TinyImageNet)</td><td rowspan=1 colspan=1>87.12 ± 4.65</td><td rowspan=1 colspan=1>88.41 ± 3.76</td><td rowspan=1 colspan=1>82.40± 1.65</td><td rowspan=1 colspan=1>86.39 ± 3.58</td></tr><tr><td rowspan=1 colspan=1>LSTM (Penn Treebank)</td><td rowspan=1 colspan=1>98.03± 1.46</td><td rowspan=1 colspan=1>87.83 ± 21.53</td><td rowspan=1 colspan=1>97.99 ± 1.90</td><td rowspan=1 colspan=1>57.28± 24.98</td></tr></table>
65
+
66
+ Table 1: Performance Prediction Model Comparison: We report the coefficient of determination $R ^ { 2 } * 1 0 0$ for four standard methods. Each model is trained with 100 samples on $2 5 \%$ of the learning curve. We find that $\nu$ -SVR works best on average, though not by a large margin.
67
+
68
+ ![](images/e1e08d693f58b2451fc566e9d907921036494e900edf6b2beed895ec69970c9e.jpg)
69
+ Figure 2: Predicted vs True Values of Final Performance: We show the shape of the predictive distribution on three experiments: MetaQNN models, Deep Resnets, and LSTMs. Each $\nu$ -SVR model is trained with 100 configurations with data from $2 5 \%$ of the learning curve. We predict validation set classification accuracy for MetaQNN and Deep ResNets, and perplexity for LSTMs.
70
+
71
+ # 3.3 PREDICTION PERFORMANCE
72
+
73
+ Choice of Regression Method: We now describe our results for predicting final neural network performance. For all experiments, we train our SRMs on 100 randomly sampled neural network configurations. We obtain the best performing method using random hyperparameter search over 3-fold cross-validation. We then compute the regression performance over the remainder of the dataset using the coefficient of determination $R ^ { 2 }$ . We repeat each experiment 10 times and report the results with standard errors. We experiment with a few simple regression models, including ordinary least squares (OLS), random forests (RF), Bayesian linear regression (BLR), and $\nu$ -support vector machine regression ( $\nu$ -SVR). For both OLS and $\nu \cdot$ -SVR, we choose between the linear and RBF kernels based on prediction performance—after hyperparameter search, in case of $\nu$ -SVR. We chose 100 as the number of sampled configurations somewhat arbitrarily, though we found that prediction performance was quite poor below 50 and improves steadily after. As seen in Table 1, $\nu$ -SVR performs the best on most datasets, though not by a large margin. For the rest of this paper, we use $\nu$ -SVR unless otherwise specified.
74
+
75
+ Ablation Study on Feature Sets: In Table 2, we compare the predictive ability of different feature sets, training SVR with time-series (TS) features obtained from $2 5 \%$ of the learning curve, along with features of architecture parameters (AP), and hyperparameters (HP). TS features explain the largest fraction of the variance in all cases and found that in general AP are more important that HP. AP features almost match TS on the ResNet (TinyImageNet) dataset, indicating that choice of architecture has a large influence on accuracy for ResNets. Figure 2 shows the true vs. predicted performance for all test points in three datasets, trained with TS, AP, and HP features.
76
+
77
+ Generalization To Out Of Distribution Configurations: We also test to see whether our SRMs can accurately predict the performance of out-of-distribution neural networks. For instance, if we train a $\nu$ -SVR model on the Deep Resnet (TinyImagenet) dataset at $2 5 \%$ of the learning curve observed on configurations below median depth (60 layers), we can achieve $R ^ { 2 } = 0 . 8 6$ on configurations above median depth. The corresponding number for prediction below median depth is 0.89. We repeated this experiment all datasets with different hyperparameter values below/above the median and found that SRMs generally showed consistent performance across such splits. Full results can be found in Appendix Section $_ \mathrm { H }$ .
78
+
79
+ <table><tr><td rowspan=1 colspan=1>Feature Set</td><td rowspan=1 colspan=1>MetaQNN(CIFAR-10)</td><td rowspan=1 colspan=1>ResNets(TinyImageNet)</td><td rowspan=1 colspan=1>LSTM(Penn Treebank)</td><td rowspan=1 colspan=1>Cuda-Convnet(CIFAR-10)</td></tr><tr><td rowspan=1 colspan=1>HP</td><td rowspan=1 colspan=1>-2.96 ± 2.71</td><td rowspan=1 colspan=1>0.48 ± 7.24</td><td rowspan=1 colspan=1>-1.72 ± 1.62</td><td rowspan=1 colspan=1>0.48 ± 7.24</td></tr><tr><td rowspan=1 colspan=1>AP</td><td rowspan=1 colspan=1>15.38 ± 4.66</td><td rowspan=1 colspan=1>67.66 ± 9.08</td><td rowspan=1 colspan=1>13.76 ± 12.08</td><td rowspan=1 colspan=1>67.66 ± 9.08</td></tr><tr><td rowspan=1 colspan=1>TS</td><td rowspan=1 colspan=1>97.00 ± 0.52</td><td rowspan=1 colspan=1>82.71 ± 4.31</td><td rowspan=1 colspan=1>97.38 ± 1.49</td><td rowspan=1 colspan=1>82.71 ± 4.31</td></tr><tr><td rowspan=1 colspan=1>AP+HP</td><td rowspan=1 colspan=1>14.89 ± 5.12</td><td rowspan=1 colspan=1>70.25 ± 6.42</td><td rowspan=1 colspan=1>13.76 ± 12.08</td><td rowspan=1 colspan=1>70.25 ± 6.42</td></tr><tr><td rowspan=1 colspan=1>TS+HP</td><td rowspan=1 colspan=1>97.02 ± 0.52</td><td rowspan=1 colspan=1>82.67 ± 6.81</td><td rowspan=1 colspan=1>97.38 ± 1.49</td><td rowspan=1 colspan=1>82.67± 6.81</td></tr><tr><td rowspan=1 colspan=1>TS+AP</td><td rowspan=1 colspan=1>97.12 ± 0.37</td><td rowspan=1 colspan=1>87.36± 4.23</td><td rowspan=1 colspan=1>97.87 ± 1.68</td><td rowspan=1 colspan=1>87.36± 4.23</td></tr><tr><td rowspan=1 colspan=1>TS+AP+HP</td><td rowspan=1 colspan=1>97.15 ± 0.48</td><td rowspan=1 colspan=1>86.05 ± 8.24</td><td rowspan=1 colspan=1>97.87 ± 1.68</td><td rowspan=1 colspan=1>86.05 ± 8.24</td></tr></table>
80
+
81
+ Table 2: Ablation Study on Feature Sets: We report the $R ^ { 2 } * 1 0 0$ metric for different combinations of features. Time-series features (TS) refers to the partially observed learning curves, architecture parameters (AP) refer to the number of layers and number of weights in a deep model, and hyperparameters (HP) refer to the optimization parameters such as learning rate. All results are with $\nu$ -SVR. $2 5 \%$ of learning curve used for models including TS features.
82
+
83
+ # 3.3.1 COMPARISON WITH EXISTING METHODS:
84
+
85
+ We now compare the neural network performance prediction ability of SRMs with three existing learning curve prediction methods: (1) Bayesian Neural Network (BNN) (Klein et al., 2017), (2) the learning curve extrapolation (LCE) method (Domhan et al., 2015), and (3) the last seen value (LastSeenValue) heuristic (Li et al., 2017). When training the BNN, we not only present it with the subset of fully observed learning curves but also all other partially observed learning curves from the training set. While we do not present the partially observed curves to the SRMs for training, we felt this was a fair comparison as an SRM uses the entire partially observed learning curve during inference. Methods (2) and (3) do not incorporate prior learning curves during training. Figure 3 shows the $R ^ { 2 }$ obtained by each method for predicting the final performance versus the percent of the learning curve used for training the model. We see that in all neural network configuration spaces and across all datasets, $\nu { - } \mathbf { S } \mathbf { V } \mathbf { R }$ outperform the competing methods. Bayesian linear regression (BLR) also performs comparably well to $\nu$ -SVR and better than the more complex Bayesian methods (BNN and LCE). The LastSeenValue heuristic only becomes viable when the configurations are near convergence, and its performance is worse than an SRM for very deep models. We also find that the SRMs outperform the LCE method in all experiments, even after we remove a few extreme prediction outliers produced by LCE. Finally, while BNN outperforms the LastSeenValue and LCE methods when only a few iterations have been observed, it does worse than our proposed method. In summary, we show that our simple SRMs outperforms existing Bayesian approaches on predicting neural network performance on modern, very deep models in computer vision and language modeling tasks.
86
+
87
+ Since most of our experiments perform stepwise learning rate decay; it is conceivable that the performance gap between SRMs and both LCE and BNN results from a lack of sharp jumps in their basis functions. For completeness, we also experimented with exponential learning rate decay (ELRD), which the basis functions in LCE are designed for. We trained 630 random nets with ELRD, from the 1000 MetaQNN-CIFAR10 nets. Predicting from $2 5 \%$ of the learning curve, the $R ^ { 2 }$ is 0.95 for $\nu$ -SVR, 0.48 for LCE (with extreme outlier removal, negative without), and 0.31 for BNN. This comparison illuminates another benefit of our method: we do not require handcrafted basis functions to model new learning curve types.
88
+
89
+ Moreover, SRMs are faster to train and do inference in than LCE and BNN. On 1 core of a Intel $6 7 0 0 \mathrm { k }$ CPU, an $\nu$ -SVR with 100 training points trains in 0.006 seconds, and each inference takes 0.00006 seconds. In comparison, the LCE code takes 60 seconds and BNN code takes 0.024 seconds on the same hardware for each inference.
90
+
91
+ # 4 APPLYING PERFORMANCE PREDICTION FOR EARLY STOPPING
92
+
93
+ To speed up hyperparameter optimization and architecture search methods, we develop an algorithm to determine whether to continue training a partially trained model configuration using our sequential regression models. This approach follows the idea proposed by Domhan et al. (2015) and further expanded on by Klein et al. (2017). Concretely, if we would like to sample $N$ total neural network configurations, we begin by sampling and training $n \ll N$ configurations to create a training set $s$ . We then train a model $f ( x _ { f } )$ , where in our case $f$ is an SRM with $T - 1$ individual models, to predict $y _ { T }$ Now, given the current best performance observed $y _ { \mathrm { B E S T } }$ , we would like to terminate training a new configuration $\mathbf { x } _ { \mathrm { N E W } }$ at iteration $\tau$ given its partial learning curve $y _ { \mathrm { N E W } } ( \tau )$ if $f ( x _ { \mathrm { { N E W } } } f ) = \hat { y } _ { T } \overset { \cdot } { \leq } y _ { \mathrm { { B E S T } } }$ so as to not waste computational resources exploring a suboptimal configuration.
94
+
95
+ ![](images/b307684c90185a1bcebe23b1c8b3d267a9a5c28ed548460d497c2352fbae0626.jpg)
96
+ Figure 3: Performance Prediction Results: We plot the performance of each method versus the percent of learning curve observed. For BNN and $\nu$ -SVR, we sample 10 different training sets, plot the mean $R ^ { 2 }$ , and shade the corresponding standard error. We compare our method against BNN (Klein et al., 2017), LCE (Domhan et al., 2015), and a “last seen value” heuristic (Li et al., 2017). Absent results for a model indicate that it did not achieve a positive $R ^ { 2 }$ . The results for Cuda-Convnet on the SVHN dataset are shown in Appendix Figure 11.
97
+
98
+ However, in the case $f$ has poor out-of-sample generalization, we may mistakenly terminate the optimal configuration. If we assume that our estimate can be modeled as a Gaussian perturbation of the true value $\hat { y } _ { T } \sim \mathcal { N } ( y _ { T } , \sigma ( \mathbf { x } , \tau ) )$ , then we can find the probability $\begin{array} { r } { p ( \hat { y } _ { T } \leq y _ { \mathrm { B E S T } } \mathbf { \bar { \Phi } } | \sigma ( \mathbf { x } , \tau ) ) = } \end{array}$ $\varPhi ( y _ { \mathrm { B E S T } } ; y _ { T } , \sigma )$ , where $\varPhi ( \cdot ; \mu , \sigma )$ is the CDF of ${ \mathcal { N } } ( \mu , \sigma )$ . Note that in general the uncertainty will depend on both the configuration and $\tau$ , the number of points observed from the learning curve. Because frequentist models do not admit a natural estimate of uncertainty, we assume that $\sigma$ is independent of $\mathbf { x }$ yet still dependent on $\tau$ and estimate it via Leave One Out Cross Validation (LOOCV). In addition, we show results using a Bayesian linear regression SRM, which has natural uncertainty estimates, removing the need for LOOCV.
99
+
100
+ Now that we can estimate the model uncertainty, given a new configuration xNEW and an observed learning curve $y _ { \mathrm { N E W } } ( \tau )$ , we may set our termination criteria to be $p ( \hat { y } _ { T } \le y _ { \mathrm { B E S T } } ) \ge \varDelta$ . $\varDelta$ balances the trade-off between increased speedups and risk of prematurely terminating good configurations. In many cases, one may want several configurations that are close to optimal, for the purpose of ensembling. We offer two modifications in this case. First, one may relax the termination criterion to $p ( \hat { y } _ { T } \le \bar { y } _ { \mathtt { B E S T } } - \delta ) \ge \Delta$ , which will allow configurations within $\delta$ of optimal performance to complete training. One can alternatively set the criterion based on the $n ^ { \mathrm { t h } }$ best configuration observed, guaranteeing that with high probability the top $n$ configurations will be fully trained.
101
+
102
+ # 4.1 EARLY STOPPING FOR ARCHITECTURE SEARCH
103
+
104
+ Baker et al. (2017) train a $Q$ -learning agent to design convolutional neural networks. In this method, the agent samples architectures from a large, finite space by traversing a path from input layer to termination layer. However, the MetaQNN method uses 100 GPU-days to train 2700 neural architectures and the similar experiment by Zoph & Le (2017) utilized 10,000 GPU-days to train 12,800 models on CIFAR-10. The amount of computing resources required for these approaches makes them prohibitively expensive for large datasets (e.g., Imagenet) and larger search spaces. The main computational expense of reinforcement learning-based architecture search methods is training the neural network configuration to $T$ epochs (where $T$ is typically a large number at which the network stabilizes to peak accuracy).
105
+
106
+ ![](images/dc85c447f26791182cfb27434b6a9360fc11cf05a77d5f67d68ebe85227a11e5.jpg)
107
+ Figure 4: Simulated Speedup in MetaQNN Search Space: We compare the three variants of the early stopping algorithm presented in Section 4 for both a $\nu$ -SVR and BLR SRM. Each SRM is trained using the first 100 learning curves, and each algorithm is tested on 10 independent orderings of the model configurations. Triangles indicate an algorithm that successfully recovered the optimal model for more than half of the 10 orderings, and X’s indicate those that did not.
108
+
109
+ We now detail the performance of $\nu$ -SVR and BLR SRMs in speeding up architecture search. First, we take 1,000 random models from the MetaQNN (Baker et al., 2017) search space. We simulate the MetaQNN algorithm by taking 10 random orderings of each set and running our early stopping algorithm. We compare against the LCE early stopping algorithm (Domhan et al., 2015) as a baseline, which has a similar probability threshold termination criterion. Our SRM trains off of the first 100 fully observed curves, while the LCE model trains from each individual partial curve and can begin early termination immediately. Despite this “burn in” time needed by an SRM, it is still able to outperform the LCE model (Figure 4). In addition, fitting the LCE model to a learning curve takes between 1-3 minutes on a modern CPU due to expensive MCMC sampling, and it is necessary to fit a new LCE model each time a new point on the learning curve is observed. However, the difference in computing time between the methods is not as important as the difference in prediction accuracies.
110
+
111
+ We furthermore simulate early stopping for ResNets trained on CIFAR-10. We found that only the probability threshold $\varDelta = 0 . 9 9$ resulted in recovering the top model consistently. However, even with such a conservative threshold, the search was sped up by a factor of 3.4 over the baseline. While we do not have the computational resources to run the full experiment from Zoph & Le (2017), our method could provide similar gains in large scale architecture searches.
112
+
113
+ It is not enough, however, to simply simulate the speedup because architecture search algorithms typically use the observed performance in order to update an acquisition function to inform future sampling. In the reinforcement learning setting, the performance is given to the agent as a reward, so we also empirically verify that substituting $\hat { y } _ { T }$ for $y _ { T }$ does not cause the MetaQNN agent to converge to a subpar policy. Replicating the MetaQNN experiment on CIFAR-10 (see Figure 5), we find that integrating early stopping with the $Q$ -learning procedure does not disrupt learning and resulted in a speedup of $3 . 8 \mathrm { x }$ with $\varDelta = 0 . 9 9$ . After training the top models to 300 epochs, we also find that the resulting performance (just under $9 3 \%$ ) is on par with original results of Baker et al. (2017).
114
+
115
+ ![](images/aab0e4a5f68df68fc6dd3b814ef2564c865449f63f59a2bb14bd5810251a37ab.jpg)
116
+ Figure 5: MetaQNN on CIFAR-10 with Early Stopping: A full run of the MetaQNN algorithm (Baker et al., 2017) on the CIFAR10 dataset with early stopping. We use the $\nu { - } \mathbf { S } \mathbf { V } \mathbf { R }$ SRM with a probability threshold $\varDelta = 0 . 9 9$ . Light blue bars indicate the average model accuracy per decrease in $\epsilon$ , which represents the shift to a more greedy policy. We also plot the cumulative best, top 5, and top 15 performance to show that the agent continues to find better architectures.
117
+
118
+ ![](images/1cbaded586a36c427e79abfbd1d1e03d5fd12763217a0e9b703aa0b5e71656a0.jpg)
119
+ Figure 6: Simulated Max Accuracy vs SGD Iterations for Hyperband: We show the trajectories of the maximum performance so far versus total computational resources used for 40 consecutive Hyperband runs with $\eta = 4 . 0$ and $\varDelta = 0 . 9 5$ . Small vertical lines indicate the point at which each f-Hyperband run has searched over the same number of models as vanilla Hyperband. On Cifar-10, both BLR and $\nu$ -SVR f-Hyperbands outperform vanilla Hyperband, but on SVHN only $\nu$ -SVR f-Hyperbands do. Each triangle marks the completion of full Hyperband algorithm.
120
+
121
+ # 4.2 EARLY STOPPING FOR HYPERPARAMETER OPTIMIZATION
122
+
123
+ Recently, Li et al. (2017) introduced Hyperband, a random search technique based on multi-armed bandits that obtains state-of-the-art performance in hyperparameter optimization in a variety of settings. The Hyperband algorithm trains a population of models with different hyperparameter configurations and iteratively discards models below a certain percentile in performance among the population until the computational budget is exhausted or satisfactory results are obtained. Among previous work, Klein et al. (2017) have improved Hyperband by algorithmically choosing the next models to evaluate.
124
+
125
+ # 4.2.1 FAST HYPERBAND
126
+
127
+ We present a Fast Hyperband (f-Hyperband) algorithm based on our early stopping scheme. During each iteration of successive halving, Hyperband trains $n _ { i }$ configurations to $r _ { i }$ epochs. In f-Hyperband, we train an SRM to predict $y _ { r _ { i } }$ and do early stopping within each iteration of successive halving. We initialize f-Hyperband in exactly the same way as vanilla Hyperband, except once we have trained 100 models to $r _ { i }$ iterations, we begin early stopping for all future successive halving iterations that train to $r _ { i }$ iterations. By doing this, we exhibit no computational overhead over Hyperband other than training the SRMs, which we have shown to be cheap. We also introduce a parameter $\kappa$ which denotes the proportion of the $n _ { i }$ models in each iteration that must be trained to the full $r _ { i }$ iterations. This is similar to setting the criterion based on the $n ^ { \mathrm { t h } }$ best model in the previous section. See Appendix section C for the full algorithmic representation of f-Hyperband.
128
+
129
+ We empirically evaluate f-Hyperband using Cuda-Convnet trained on CIFAR-10 and SVHN datasets. Figure 6 shows that f-Hyperband evaluates the same number of unique configurations as Hyperband within half the compute time, while achieving the same final accuracy within standard error. Moreover, when we run f-Hyperband for the same amount of time as Hyperband, f-Hyperband with a $\nu$ -SVR SRM outperforms f-Hyperband. When reinitializing hyperparameter searches, one can use previouslytrained set of SRMs to achieve even larger speedups. Figure 12 in Appendix shows that one can safely achieve up to a $4 \mathbf { x }$ speedup in such cases.
130
+
131
+ # 5 CONCLUSION
132
+
133
+ In this paper we introduce a simple, fast, and accurate model for predicting future neural network performance using features derived from network architectures, hyperparameters, and time-series performance data. We show that the performance of drastically different network architectures can be jointly learned and predicted on both image classification and language models. Using our simple algorithm, we can speedup hyperparameter search techniques with complex acquisition functions, such as a $Q$ -learning agent, by a factor of $3 \mathbf { x }$ to 6x and Hyperband—a state-of-the-art hyperparameter search method—by a factor of $2 \mathbf { x }$ , without disturbing the search procedure. We outperform all competing methods for performance prediction in terms of accuracy, train and test time, and speedups obtained on hyperparameter search methods. We hope that the simplicity and success of our method will allow it to be easily incorporated into current hyperparameter optimization pipelines for deep neural networks. With the advent of large scale automated architecture search (Baker et al., 2017; Zoph & Le, 2017), methods such as ours will be vital in exploring even larger and more complex search spaces.
134
+
135
+ # REFERENCES
136
+
137
+ Bowen Baker, Otkrist Gupta, Nikhil Naik, and Ramesh Raskar. Designing neural network architectures using reinforcement learning. International Conference on Learning Representations, 2017.
138
+
139
+ James Bergstra and Yoshua Bengio. Random search for hyper-parameter optimization. JMLR, 13 (Feb):281–305, 2012.
140
+
141
+ James Bergstra, Daniel Yamins, and David D Cox. Making a science of model search: Hyperparameter optimization in hundreds of dimensions for vision architectures. ICML (1), 28:115–123, 2013.
142
+
143
+ Andrew Brock, Theodore Lim, JM Ritchie, and Nick Weston. Smash: One-shot model architecture search through hypernetworks. arXiv preprint arXiv:1708.05344, 2017.
144
+
145
+ Corinna Cortes, Xavier Gonzalvo, Vitaly Kuznetsov, Mehryar Mohri, and Scott Yang. AdaNet: Adaptive structural learning of artificial neural networks. International Conference on Machine Learning, 70:874–883, 2017.
146
+
147
+ Tobias Domhan, Jost Tobias Springenberg, and Frank Hutter. Speeding up automatic hyperparameter optimization of deep neural networks by extrapolation of learning curves. IJCAI, 2015.
148
+
149
+ Frank Hutter, Holger H Hoos, and Kevin Leyton-Brown. Sequential model-based optimization for general algorithm configuration. In International Conference on Learning and Intelligent Optimization, pp. 507–523. Springer, 2011.
150
+
151
+ Aaron Klein, Stefan Falkner, Jost Tobias Springenberg, and Frank Hutter. Learning curve prediction with bayesian neural networks. International Conference on Learning Representations, 17, 2017.
152
+
153
+ Alex Krizhevsky. Cuda-convnet. https://code.google.com/p/cuda-convnet/, 2012.
154
+
155
+ Lisha Li, Kevin Jamieson, Giulia DeSalvo, Afshin Rostamizadeh, and Ameet Talwalkar. Hyperband: A novel bandit-based approach to hyperparameter optimization. International Conference on Learning Representations, 2017.
156
+
157
+ Renato Negrinho and Geoff Gordon. Deeparchitect: Automatically designing and training deep architectures. arXiv preprint arXiv:1704.08792, 2017.
158
+
159
+ J David Schaffer, Darrell Whitley, and Larry J Eshelman. Combinations of genetic algorithms and neural networks: A survey of the state of the art. International Workshop on Combinations of Genetic Algorithms and Neural Networks, pp. 1–37, 1992.
160
+
161
+ Bobak Shahriari, Kevin Swersky, Ziyu Wang, Ryan P Adams, and Nando de Freitas. Taking the human out of the loop: A review of bayesian optimization. Proceedings of the IEEE, 104(1): 148–175, 2016.
162
+
163
+ Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical bayesian optimization of machine learning algorithms. NIPS, pp. 2951–2959, 2012.
164
+ Jasper Snoek, Oren Rippel, Kevin Swersky, Ryan Kiros, Nadathur Satish, Narayanan Sundaram, Mostofa Patwary, Mr Prabhat, and Ryan Adams. Scalable bayesian optimization using deep neural networks. In International Conference on Machine Learning, pp. 2171–2180, 2015.
165
+ Kenneth O Stanley and Risto Miikkulainen. Evolving neural networks through augmenting topologies. Evolutionary Computation, 10(2):99–127, 2002.
166
+ Masanori Suganuma, Shinichi Shirakawa, and Tomoharu Nagao. A genetic programming approach to designing convolutional neural network architectures. arXiv preprint arXiv:1704.00764, 2017.
167
+ Kevin Swersky, Jasper Snoek, and Ryan Prescott Adams. Freeze-thaw bayesian optimization. arXiv preprint arXiv:1406.3896, 2014.
168
+ Phillip Verbancsics and Josh Harguess. Generative neuroevolution for deep learning. arXiv preprint arXiv:1312.5355, 2013.
169
+ Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. International Conference on Learning Representations, 2017.
170
+ Barret Zoph, Vijay Vasudevan, Jonathon Shlens, and Quoc V Le. Learning transferable architectures for scalable image recognition. arXiv preprint arXiv:1707.07012, 2017.
171
+
172
+ # APPENDIX
173
+
174
+ # A DATASETS AND ARCHITECTURES
175
+
176
+ Deep Resnets (TinyImageNet): We sample 500 ResNet architectures and train them on the TinyImageNet† dataset (containing 200 classes with 500 training images of $3 2 \times 3 2$ pixels) for 140 epochs. We vary depths, filter sizes and number of convolutional filter block outputs. Filter sizes are sampled from $\{ 3 , 5 , 7 \}$ and number of filters is sampled from $\{ 2 , 3 , 4 , . . . , 2 2 \}$ . Each ResNet block is composed of three convolutional layers followed by batch normalization and summation layers. We vary the number of blocks from 2 to 18, giving us networks with depths varying between 14 and 110. Each network is trained for 140 epochs, using Nesterov optimizer. The learning rate is set to 0.1 and learning rate reduction and momentum are set to 0.1 and 0.9 respectively.
177
+
178
+ Deep Resnets (CIFAR-10): We sample 500 39-layer ResNet architectures from a search space similar to Zoph & Le (2017), varying kernel width, kernel height, and number of kernels. We train these models for 50 epochs on CIFAR-10. Each architecture consists of 39 layers: $1 2 \ : c o n \nu$ , a $2 \mathbf { x } 2$ max pool, 9 conv, a 2x2 max pool, $1 5 \ c o n \nu$ , and softmax. Each conv layer is followed by batch normalization and a ReLU nonlinearity. Each block of 3 conv layers are densely connected via residual connections and also share the same kernel width, kernel height, and number of learnable kernels. Kernel height and width are independently sampled from $\{ 1 , 3 , 5 , 7 \}$ and number of kernels is sampled from $\{ 6 , 1 2 , 2 4 , 3 6 \}$ . Finally, we randomly sample residual connections between each block of conv layers. Each network is trained for 50 epochs using the RMSProp optimizer, with weight decay $1 0 ^ { - 4 }$ , initial learning rate 0.001, and a learning rate reduction to $1 0 ^ { - 5 }$ at epoch 30 on the CIFAR-10 dataset.
179
+
180
+ MetaQNN CNNs (CIFAR-10 and SVHN): We sample 1,000 model architectures from the search space detailed by Baker et al. (2017), which allows for varying the numbers and orderings of convolution, pooling, and fully connected layers. The models are between 1 and 12 layers for the SVHN experiment and between 1 and 18 layers for the CIFAR-10 experiment. Each architecture is trained on SVHN and CIFAR-10 datasets for 20 epochs. Table 3 displays the state space of the MetaQNN algorithm.
181
+
182
+ Table 3: Experimental State Space For MetaQNN. For each layer type, we list the relevant parameters and the values each parameter is allowed to take. The networks are sampled beginning from the starting layer. Convolutional layers are allowed to transition to any other layer. Pooling layers are allowed to transition to any layer other than pooling layers. Fully connected layers are only allowed to transition to fully connected or softmax layers. A convolutional or pooling layer may only go to a fully connected layer if the current image representation size is below 8. We use this space to both randomly sample and simulate the behavior of a MetaQNN run as well as directly run the MetaQNN with early stopping.
183
+
184
+ <table><tr><td rowspan=1 colspan=1>Layer Type</td><td rowspan=1 colspan=1>LayerParameters</td><td rowspan=1 colspan=1>ParameterValues</td></tr><tr><td rowspan=1 colspan=1>Convolution (C)</td><td rowspan=1 colspan=1>i~Layer depthf~ Receptive field sizel~Strided ~ # receptive fieldsn ~ Representation size</td><td rowspan=1 colspan=1>&lt;12Square. ∈ {1,3,5}Square.Always equal to 1∈{64,128,256,512}∈{(∞,8],(8,4],(4,1]}</td></tr><tr><td rowspan=1 colspan=1>Pooling (P)</td><td rowspan=1 colspan=1>i~Layer depth(f,l)~ (Receptive field size,Strides)n ~Representation size</td><td rowspan=1 colspan=1>&lt;12Square.∈{(5,3),(3,2),(2,2)}∈{(∞,8],(8,4] and (4,1]}</td></tr><tr><td rowspan=1 colspan=1>Fully Connected (FC)</td><td rowspan=1 colspan=1>i~Layerdepthn ~ # consecutive FC layersd ~# neurons</td><td rowspan=1 colspan=1>&lt;12&lt;3∈ {512,256,128}</td></tr><tr><td rowspan=1 colspan=1>Termination State</td><td rowspan=1 colspan=1>S~Previous Statet~Type</td><td rowspan=1 colspan=1>Global Avg.Pooling/Softmax</td></tr></table>
185
+
186
+ LSTM (PTB): We sample 300 LSTM models and train them on the Penn Treebank dataset for 60 epochs. Number of hidden layer inputs and lstm cells was varied from 10 to 1400 in steps of 20. Each network was trained for 60 epochs with batch size of 50 and trained the models using stochastic gradient descent. Dropout ratio of 0.5 was used to prevent overfitting. Dictionary size of 400 words was used to generate embeddings when vectorizing the data.
187
+
188
+ Cuda-Convnet (CIFAR-10 and SVHN): We train Cuda-Convnet architecture (Krizhevsky, 2012) with varying values of initial learning rate, learning rate reduction step size, weight decay for convolutional and fully connected layers, and scale and power of local response normalization layers. We train models with CIFAR-10 for 60 epochs and with SVHN for 12 epochs. Table 4 show the hyperparameter ranges for the Cuda Convnet experiments.
189
+
190
+ Table 4: Range of hyperparameter settings used for the Hyperband experiment (Section 4.1)
191
+
192
+ <table><tr><td>Experiment</td><td>Hyperparameter</td><td>Scale</td><td>Min</td><td>Max</td></tr><tr><td rowspan="2">CIFAR-10, Imagenet, SVHN</td><td>Initial Learning Rate</td><td>Log</td><td>5×10-5</td><td>5</td></tr><tr><td>Learning Rate Reductions</td><td>Integer</td><td>0</td><td>3</td></tr><tr><td rowspan="6">CIFAR-10, SVHN</td><td>Conv1 L2 Penalty</td><td>Log</td><td>5×10-5</td><td>5</td></tr><tr><td>Conv2 L2 Penalty</td><td>Log</td><td>5×10-5</td><td>5</td></tr><tr><td>Conv3 L2 Penalty</td><td>Log</td><td>5×10-5</td><td>5</td></tr><tr><td>FC4 L2 Penalty</td><td>Log</td><td>5×10-5</td><td>5</td></tr><tr><td>Response Normalization Scale</td><td>Log</td><td>5×10-6</td><td>5</td></tr><tr><td>Response Normalization Power</td><td>Linear</td><td>1×10-2</td><td>3</td></tr></table>
193
+
194
+ # B HYPERPARAMETER SELECTION IN PERFORMANCE PREDICTION MODELS
195
+
196
+ When training performance prediction models we divided the data into training and validation and used 3-fold cross validation to select optimal hyperparameters. The models were then trained on full training data using the best hyperparameters. For random forests we varied number of trees between 10 and 800, and varied ratio of number of features from 0.1 to 0.5. For $\nu$ -SVR, we perform a random search over 1000 hyperparameter configurations from the space $C \sim$ LogUniform $( 1 0 ^ { - 5 }$ , 10), $\nu \sim$ Uniform $( 0 , 1 )$ , and $\gamma \sim \mathrm { L o g U n i f o r m } ( 1 0 ^ { - 5 } , 1 0$ ) (when using the RBF kernel). For Bayesian linear regression, we perform random search over the hyperparameters of the gamma prior distribution over both noise and weights in the range $[ 1 0 ^ { - 7 } , 1 0 ^ { - 5 } ]$ .
197
+
198
+ # C F-HYPERBAND
199
+
200
+ Algorithm 1 of this text replicates Algorithm 1 from Li et al. (2017), except we initialize two dictionaries: $D$ to store training data and $M$ to store performance prediction models. $D [ r ]$ will correspond to a dictionary containing all datasets with prediction target epoch $r$ . $D [ r ] [ \bar { \tau } ]$ will correspond to the dataset for predicting $y _ { r }$ based on the observed $y ( t ) _ { 1 - \tau }$ , and $M [ r ] [ \tau ]$ will hold the corresponding performance prediction model. We will assume that the performance prediction model will have a train function, and a predict function that will return the prediction and standard deviation of the prediction. In addition to the standard Hyperband hyperparameters $R$ and $\eta$ , we include $\varDelta$ and $\delta$ described in Section 4 and $\kappa$ . During each iteration of successive halving, we train $n _ { i }$ configurations to $r _ { i }$ epochs; $\kappa$ denotes the fraction of the top $n _ { i }$ models that should be run to the full $r _ { i }$ iterations. This is similar to setting the criterion based on the $n ^ { \mathrm { t h } }$ best model in the previous section.
201
+
202
+ We also detail the run_then_return_validation_loss function in Algorithm 2. This algorithm runs a set of configurations, adds training data from observed learning curves, trains the performance prediction models when there is enough training data present, and then uses the models to terminate poor configurations. It assumes we have a function max_k, which returns the $k ^ { \mathrm { { t h } } }$ max value or $- \infty$ if the list has less than $k$ values.
203
+
204
+ # Algorithm 1: f-Hyperband
205
+
206
+ input : $R$ (Max resources allocated to any configuration) η (default $\eta = 3 ,$ ) $\varDelta$ (Probability threshold for early termination) $\delta$ (Performance offset for early termination) $d$ (# points required to train performance predictors) $\kappa$ (Proportion of models to train) initialize : $D = \mathrm { d i c t ( ) }$ M = dict() smax = blogη(R)c $B = ( s _ { \mathrm { m a x } } + 1 ) R$ 1 for 2 T $\begin{array} { r } { n = \lceil \frac { B } { R } \frac { \eta ^ { s } } { s + 1 } \rceil , \quad r = R \eta ^ { - s } } \end{array}$ $s \in \{ s _ { m a x } , \ldots , 0 \}$ do 3 // begin SUCCESSIVEHALVING with $\left( n , \begin{array} { l l } { r } \end{array} \right)$ inner loop 4 $T = { \mathfrak { g e t } }$ _hyperparameter_configuration( $: n \mid$ ) for $i \in \{ 0 , \ldots , s \}$ do 6 $n _ { i } = \lfloor n \eta ^ { - i } \rfloor$ , $r _ { i } = r \eta ^ { i }$ 7 $\begin{array} { r } { n _ { \mathrm { n e x t } } = \lfloor \frac { n _ { i } } { \eta } \rfloor } \end{array}$ if $i ! = s$ else 1 8 L = run_then_return_validation_loss $( T , r _ { i } , n _ { \mathrm { n e x t } } , D , M )$ 9 $\begin{array} { r } { T = \mathrm { t o p \_ k } \left( T , L , \lfloor \frac { n _ { i } } { \eta } \rfloor \right) } \end{array}$ ) 0 end
207
+
208
+ 11 end
209
+
210
+ input : T hyperparameter configurations
211
+ r resources to use for training
212
+ $n$ # configurations in next iteration of successive halving
213
+ $D$ dictionary storing training data
214
+ $M$ – dictionary storing performance prediction models
215
+ initialize : $L = [ ]$
216
+ 1 for $t \in T$ do
217
+ 2 $\ell = \left[ \ \right]$
218
+ 3 for $i \in \{ 0 , \ldots , r - 1 \}$ do
219
+ 4 $\ell _ { i } =$ run_one_epoch_return_validation_loss(t)
220
+ 5 $\ell$ .append $( \ell _ { i }$ )
221
+ 6 if $M [ r ] [ i ]$ .trained() then
222
+ 7 ${ \hat { y } } _ { r }$ , $\dot { \sigma } = M [ r ] [ i ]$ .predict $( \ell )$
223
+ 8 if $\begin{array} { r } { \varPhi ( \mathrm { m a x \_ k } ( \bar { L } , \kappa n ) - \delta ; \hat { y } _ { r } , \sigma ) \geq \varDelta } \end{array}$ then
224
+ 9 $L$ .append $( \hat { y } _ { r }$ )
225
+ 10 break
226
+ 11 end
227
+ 12 end
228
+ 13 else if $i = = r - 1$ then
229
+ 14 $L$ .append $( \ell _ { i }$ )
230
+ 15 end
231
+ 16 end
232
+ 17 if length $( D [ r ] [ 0 ] ) < d$ and length $( { \boldsymbol { \ell } } ) \ = = r$ then
233
+ 18 $\{ D [ r ] [ i ]$ .append $\langle \ell [ 0 , \ldots , i ] , \ell [ r ] \} \rangle : i \in \{ 0 , \ldots , r - 1 \} \}$
234
+ 19 if not $M [ r ] [ i ]$ .trained() then
235
+ 20 $M [ r ] [ i ]$ .train $( D [ r ] [ i ] ,$ )
236
+ 21 end
237
+ 22 end
238
+ 23 end
239
+ 24 return L
240
+
241
+ # D F-HYPERBAND WITH SVR ACQUISITION FUNCTION
242
+
243
+ Similar to Klein et al. (2017), it is possible to use our simple models as an acquisition function for Hyperband. As shown in Table 2, our models have reasonable performance with only AP and HP features used, meaning we can use these models to rank hyperparameter settings before training the configurations. In particular, for each Hyperband iteration, we randomly select 10,000 configurations, weight them by their predicted performance and sample from this weighted distribution. In Figure 7, we compare f-Hyperband with this $\nu$ -SVR acquisition function to f-Hyperband with the standard uniform acquisition function and also to vanilla Hyperband. It seems that the acquisition function could help slightly, but it does not improve performance across all experiments, and where it does improve performance it does so only slightly.
244
+
245
+ ![](images/cd7670b52afd22f5572cddfea1b647b61e4c33d65e54d6765e5cede1a1f1cd49.jpg)
246
+ Figure 7: f-Hyperband with SVR Acquisition Function: We compare f-Hyperband with an SVR acquisition function to f-Hyperband with the uniform acquisition function (this is the standard version described in the main text) and to vanilla Hyperband. The results shown are inconclusive; it seems that there could be some benefit of incorporating the SVR acquisition function, but it isn’t significant enough to make a strong statement.
247
+
248
+ # E GAUSSIAN ERROR ASSUMPTION
249
+
250
+ In order to have uncertainty estimates with frequentist models, we estimated the mean and variance of the error from leave-one-out cross validation and assumed that the error was Gaussian. In Figure 8 we compare example error distributions between training and validation from a $\nu$ -SVR SRM. Visually one can see that the assumption holds very well for both visual classification tasks and holds slightly less well for the language modeling task. In Figure 9, we show the mean log likelihood of held out prediction errors being drawn from a Gaussian parameterized by the mean and variance of the error on the training set is very close to the mean log likelihood of samples drawn from the same distribution, which shows that our Gaussian error assumption is relatively strong.
251
+
252
+ # F ANALYZING IMPORTANCE OF FEATURES IN THE PREDICTION MODEL
253
+
254
+ We used a linear $\nu$ -SVR model to compare the weights of all features, which are normalized before training. Figure 10 shows the weight trends for time-series features, and Tables 5, 6, and 7 compare weights of some architecture features and hyperparameter features to statistics of time-series features for the MetaQNN (CIFAR-10), LSTMs (Penn Treebank), and Deep Resnets (TinyImagenet) experiments, respectively. We found the following main insights across datasets:
255
+
256
+ • The time-series (TS) features are on average have higher weights than HP and AP features (which is confirmed by our ablation studies in Table 2 as well). The original validation accuracies $( y _ { t } )$ have higher weights on average than the first-order differences $( { y } _ { t } ^ { \prime } )$ and second-order differences $( { y } _ { t } ^ { \prime \prime } )$ . • In general, later epochs in $y _ { t }$ have higher weights. In other words, the latest performance of the model available for prediction is much more important for performance prediction than initial performance, when the model has just started training. However, the weights for earlier performance metrics are non-zero, indicating there are high order autoregressive functions being learned.
257
+
258
+ ![](images/6ab4eee391e270952d9a993a07231dd2f41ebb64efe1a472221b93e477a96b83.jpg)
259
+ Figure 8: Example Error Distributions: Here we compare example error distributions between training and validation from a $\nu$ -SVR SRM. From left to right we see plots for models trained with increasing amounts of the learning curve. The blue line shows the Gaussian probability density function estimated from the training set with LOOCV. The orange histogram shows the error distribution of the held out validation set.
260
+
261
+ ![](images/10a7774b17a92c4e92355b15a9b04bb03ddd75fa3f8c268d6042658e62a1507b.jpg)
262
+ Figure 9: Error Log Likelihood: In orange we show the mean log likelihood of prediction errors measured from validation sets being drawn from the Gaussian distribution parameterized by the mean and variance of the training error, again measured with LOOCV. For a baseline, we show the mean log likelihood for 1,000,000 samples drawn from the same Gaussian. We calculate these metrics over 10 data splits and report the mean and standard error.
263
+
264
+ • Early values of $( { y } _ { t } ^ { \prime } )$ also have high weights, which indicates learning quickly in the beginning of training is a predictor of better final performance in our datasets.
265
+
266
+ • Among AP and HP features, the total number of parameters and depth have non-zero weight for the CNNs, and they are assigned weights comparable or higher than late epoch accuracies $( y _ { t } )$ . However, they have much lower weight in the LSTM experiment. The number of filters in each convolutional layer also has a high positive weight for CNNs. In general, architectural features are much more important for CNNs as compared to LSTMs. Hyperparameters like initial learning rate and step size were generally not as important as the architectural features, which is corroborated by the ablation study in Table 1 in the main text.
267
+
268
+ ![](images/b2971eb1174e30d287fd59999deb67712ba2523822f222b2dc7573d44e9acc4c.jpg)
269
+ Figure 10: Time Series Weights: We show the trends for weights for time-series features, along with first- and second-order differences.
270
+
271
+ Table 5: Summary of weights for a linear kernel $\nu$ -SVR SRM trained on configurations from MetaQNN (CIFAR-10).
272
+
273
+ <table><tr><td rowspan=1 colspan=1>PercentObserved</td><td rowspan=1 colspan=1>MeanPerf</td><td rowspan=1 colspan=1>Std DevPerf</td><td rowspan=1 colspan=1>Mean 1stOrder Diff</td><td rowspan=1 colspan=1>Mean 2ndOrder Diff</td><td rowspan=1 colspan=1>Depth</td><td rowspan=1 colspan=1>#Params</td><td rowspan=1 colspan=1>LearningRate</td></tr><tr><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>0.022989</td><td rowspan=1 colspan=1>0.013845</td><td rowspan=1 colspan=1>0.017069</td><td rowspan=1 colspan=1>0.009021</td><td rowspan=1 colspan=1>0.014638</td><td rowspan=1 colspan=1>0.005541</td><td rowspan=1 colspan=1>0.005355</td></tr><tr><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>0.016971</td><td rowspan=1 colspan=1>0.010882</td><td rowspan=1 colspan=1>0.010117</td><td rowspan=1 colspan=1>0.003494</td><td rowspan=1 colspan=1>0.008153</td><td rowspan=1 colspan=1>0.003408</td><td rowspan=1 colspan=1>0.005335</td></tr><tr><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>0.013733</td><td rowspan=1 colspan=1>0.007396</td><td rowspan=1 colspan=1>0.006921</td><td rowspan=1 colspan=1>0.002550</td><td rowspan=1 colspan=1>0.004199</td><td rowspan=1 colspan=1>0.002098</td><td rowspan=1 colspan=1>0.003310</td></tr><tr><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>0.011125</td><td rowspan=1 colspan=1>0.007023</td><td rowspan=1 colspan=1>0.005031</td><td rowspan=1 colspan=1>0.001903</td><td rowspan=1 colspan=1>0.002847</td><td rowspan=1 colspan=1>0.003041</td><td rowspan=1 colspan=1>0.002968</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>0.009409</td><td rowspan=1 colspan=1>0.005836</td><td rowspan=1 colspan=1>0.004594</td><td rowspan=1 colspan=1>0.001234</td><td rowspan=1 colspan=1>0.000578</td><td rowspan=1 colspan=1>0.000223</td><td rowspan=1 colspan=1>0.001107</td></tr><tr><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>0.008099</td><td rowspan=1 colspan=1>0.004768</td><td rowspan=1 colspan=1>0.003370</td><td rowspan=1 colspan=1>0.000923</td><td rowspan=1 colspan=1>0.001306</td><td rowspan=1 colspan=1>-0.000906</td><td rowspan=1 colspan=1>0.000287</td></tr><tr><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>0.007016</td><td rowspan=1 colspan=1>0.004246</td><td rowspan=1 colspan=1>0.002573</td><td rowspan=1 colspan=1>0.000627</td><td rowspan=1 colspan=1>0.000458</td><td rowspan=1 colspan=1>-0.000777</td><td rowspan=1 colspan=1>-0.000324</td></tr><tr><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>0.006190</td><td rowspan=1 colspan=1>0.003417</td><td rowspan=1 colspan=1>0.002159</td><td rowspan=1 colspan=1>0.000494</td><td rowspan=1 colspan=1>0.000454</td><td rowspan=1 colspan=1>0.000355</td><td rowspan=1 colspan=1>0.000583</td></tr><tr><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>0.005553</td><td rowspan=1 colspan=1>0.003141</td><td rowspan=1 colspan=1>0.001792</td><td rowspan=1 colspan=1>0.000371</td><td rowspan=1 colspan=1>0.000382</td><td rowspan=1 colspan=1>0.000020</td><td rowspan=1 colspan=1>0.000259</td></tr></table>
274
+
275
+ Table 6: Summary of weights for a linear kernel $\nu$ -SVR SRM trained on configurations from LSTMs (Penn Treebank).
276
+
277
+ <table><tr><td rowspan=1 colspan=1>PercentObserved</td><td rowspan=1 colspan=1>MeanPerf</td><td rowspan=1 colspan=1>Std DevPerf</td><td rowspan=1 colspan=1>Mean 1stOrder Diff</td><td rowspan=1 colspan=1>Mean 2ndOrder Diff</td><td rowspan=1 colspan=1>Depth</td><td rowspan=1 colspan=1># Params</td><td rowspan=1 colspan=1>LearningRate Step</td></tr><tr><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>1.129178</td><td rowspan=1 colspan=1>-0.952712</td><td rowspan=1 colspan=1>2.562584</td><td rowspan=1 colspan=1>0.822748</td><td rowspan=1 colspan=1>-2.608709</td><td rowspan=1 colspan=1>0.599052</td><td rowspan=1 colspan=1>-1.940918</td></tr><tr><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>0.388479</td><td rowspan=1 colspan=1>-0.168798</td><td rowspan=1 colspan=1>0.828343</td><td rowspan=1 colspan=1>0.287950</td><td rowspan=1 colspan=1>-1.148619</td><td rowspan=1 colspan=1>0.390338</td><td rowspan=1 colspan=1>-0.667870</td></tr><tr><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>0.202656</td><td rowspan=1 colspan=1>-0.254058</td><td rowspan=1 colspan=1>0.282163</td><td rowspan=1 colspan=1>0.132048</td><td rowspan=1 colspan=1>-1.134044</td><td rowspan=1 colspan=1>-0.033193</td><td rowspan=1 colspan=1>-0.301467</td></tr><tr><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>0.149271</td><td rowspan=1 colspan=1>-0.205868</td><td rowspan=1 colspan=1>0.183959</td><td rowspan=1 colspan=1>0.093839</td><td rowspan=1 colspan=1>-0.280646</td><td rowspan=1 colspan=1>0.050759</td><td rowspan=1 colspan=1>-0.057207</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>0.129166</td><td rowspan=1 colspan=1>-0.160091</td><td rowspan=1 colspan=1>0.127230</td><td rowspan=1 colspan=1>0.078865</td><td rowspan=1 colspan=1>-0.219122</td><td rowspan=1 colspan=1>-0.044931</td><td rowspan=1 colspan=1>-0.119674</td></tr><tr><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>0.116550</td><td rowspan=1 colspan=1>-0.160410</td><td rowspan=1 colspan=1>0.122557</td><td rowspan=1 colspan=1>0.085949</td><td rowspan=1 colspan=1>-0.128821</td><td rowspan=1 colspan=1>0.040022</td><td rowspan=1 colspan=1>-0.097907</td></tr><tr><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>0.112243</td><td rowspan=1 colspan=1>-0.144278</td><td rowspan=1 colspan=1>0.104209</td><td rowspan=1 colspan=1>0.078584</td><td rowspan=1 colspan=1>-0.082918</td><td rowspan=1 colspan=1>-0.077808</td><td rowspan=1 colspan=1>-0.057439</td></tr><tr><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>0.102105</td><td rowspan=1 colspan=1>-0.127418</td><td rowspan=1 colspan=1>0.078328</td><td rowspan=1 colspan=1>0.068932</td><td rowspan=1 colspan=1>-0.062506</td><td rowspan=1 colspan=1>0.054454</td><td rowspan=1 colspan=1>-0.006713</td></tr><tr><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>0.106653</td><td rowspan=1 colspan=1>-0.067369</td><td rowspan=1 colspan=1>0.141887</td><td rowspan=1 colspan=1>0.074515</td><td rowspan=1 colspan=1>0.079686</td><td rowspan=1 colspan=1>-0.169534</td><td rowspan=1 colspan=1>0.158086</td></tr></table>
278
+
279
+ Table 7: Summary of weights for a linear kernel $\nu$ -SVR SRM trained on configurations from Deep Resnets (TinyImagenet).
280
+
281
+ <table><tr><td rowspan=1 colspan=1>PercentObserved</td><td rowspan=1 colspan=1>MeanPerf</td><td rowspan=1 colspan=1>Std DevPerf</td><td rowspan=1 colspan=1>Mean 1stOrder Diff</td><td rowspan=1 colspan=1>Mean 2ndOrder Diff</td><td rowspan=1 colspan=1>Depth</td><td rowspan=1 colspan=1>#Params</td><td rowspan=1 colspan=1>KernelSize</td></tr><tr><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>0.008486</td><td rowspan=1 colspan=1>0.008576</td><td rowspan=1 colspan=1>0.001861</td><td rowspan=1 colspan=1>0.001502</td><td rowspan=1 colspan=1>0.005985</td><td rowspan=1 colspan=1>0.010987</td><td rowspan=1 colspan=1>0.000267</td></tr><tr><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>0.004723</td><td rowspan=1 colspan=1>0.004851</td><td rowspan=1 colspan=1>0.001092</td><td rowspan=1 colspan=1>0.000996</td><td rowspan=1 colspan=1>0.001709</td><td rowspan=1 colspan=1>0.005239</td><td rowspan=1 colspan=1>0.002484</td></tr><tr><td rowspan=1 colspan=1>30</td><td rowspan=1 colspan=1>0.003229</td><td rowspan=1 colspan=1>0.002848</td><td rowspan=1 colspan=1>0.000789</td><td rowspan=1 colspan=1>0.000619</td><td rowspan=1 colspan=1>0.004533</td><td rowspan=1 colspan=1>0.002553</td><td rowspan=1 colspan=1>-0.001138</td></tr><tr><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>0.002394</td><td rowspan=1 colspan=1>0.002985</td><td rowspan=1 colspan=1>0.000660</td><td rowspan=1 colspan=1>0.000557</td><td rowspan=1 colspan=1>0.003443</td><td rowspan=1 colspan=1>0.001092</td><td rowspan=1 colspan=1>-0.000302</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>0.001754</td><td rowspan=1 colspan=1>0.001993</td><td rowspan=1 colspan=1>0.000461</td><td rowspan=1 colspan=1>0.000396</td><td rowspan=1 colspan=1>0.001318</td><td rowspan=1 colspan=1>0.001081</td><td rowspan=1 colspan=1>0.000072</td></tr><tr><td rowspan=1 colspan=1>60</td><td rowspan=1 colspan=1>0.001456</td><td rowspan=1 colspan=1>0.001946</td><td rowspan=1 colspan=1>0.000370</td><td rowspan=1 colspan=1>0.000309</td><td rowspan=1 colspan=1>0.000968</td><td rowspan=1 colspan=1>0.000559</td><td rowspan=1 colspan=1>0.000036</td></tr><tr><td rowspan=1 colspan=1>70</td><td rowspan=1 colspan=1>0.001428</td><td rowspan=1 colspan=1>0.002678</td><td rowspan=1 colspan=1>0.000499</td><td rowspan=1 colspan=1>0.000344</td><td rowspan=1 colspan=1>0.001161</td><td rowspan=1 colspan=1>-0.000590</td><td rowspan=1 colspan=1>-0.000971</td></tr><tr><td rowspan=1 colspan=1>80</td><td rowspan=1 colspan=1>0.001168</td><td rowspan=1 colspan=1>0.001895</td><td rowspan=1 colspan=1>0.000352</td><td rowspan=1 colspan=1>0.000256</td><td rowspan=1 colspan=1>0.000455</td><td rowspan=1 colspan=1>0.000131</td><td rowspan=1 colspan=1>-0.001092</td></tr><tr><td rowspan=1 colspan=1>90</td><td rowspan=1 colspan=1>0.001015</td><td rowspan=1 colspan=1>0.001640</td><td rowspan=1 colspan=1>0.000285</td><td rowspan=1 colspan=1>0.000215</td><td rowspan=1 colspan=1>0.000208</td><td rowspan=1 colspan=1>-0.000091</td><td rowspan=1 colspan=1>-0.000958</td></tr></table>
282
+
283
+ # G ADDITIONAL PLOTS
284
+
285
+ Figure 11 shows the performance prediction results for the Cuda Convnet SVHN experiment. The instability of BLR with low percentage of learning curve observed may be what caused suboptimal performance of BLR f-Hyperband shown in Figure 6. Figure 12 shows the relative speedup of f-Hyperband over vanilla Hyperband for each consecutive iteration of Hyperband. However, Figure 13, which shows results for f-Hyperband with pretrained $\nu$ -SVR SRMs, shows that more aggressive settings of f-Hyperband result in suboptimal performance. We see that we can safely get a $3 { - } 4 \mathbf { x }$ speedup over vanilla Hyperband with pretrained SRMs.
286
+
287
+ ![](images/c750bab18bbb20f6ff9821a6eabe408b08df4b123f9375788a4aa1f50624cd94.jpg)
288
+ Figure 11: Cuda Convnet SVHN Performance Prediction Results: We plot the performance of each method versus the percent of learning curve observed for the Cuda Convnet SVHN experiment. For BNN, $\nu$ -SVR, and BLR we sample 10 different training sets, plot the mean $R ^ { 2 }$ , and shade the corresponding standard error. We compare our method against BNN (Klein et al., 2017), LCE (Domhan et al., 2015), and a “last seen value” heuristic (Li et al., 2017). Absent results for a model indicate that it did not achieve a positive $R ^ { 2 }$ .
289
+
290
+ ![](images/893b61c3e8dee896d83890cfd6f959ee2023596c2286f47916b4990e7a40b892.jpg)
291
+ Figure 12: Simulated Speedup on Hyperband vs Hyperband Iteration: We show the speedup using the f-Hyperband algorithm over Hyperband on 40 consecutive runs with $\eta = 4 . 0$ and $\varDelta = 0 . 9 5$ . The major jump in speedup comes at iteration 10, where we have trained more than 100 models to the full $R$ iterations.
292
+
293
+ ![](images/e9cd3871458632935a702159971de0403ccd0159d69e2a3b0451acad4716e165.jpg)
294
+ Figure 13: Simulated f-Hyperband with Pretrained SRMs: Each f-Hyperband model is initialized with a pretrained SRM, which simulates the case where one reinitializes an experiment. Every triangle indicates a full run of Hyperband, and small vertical lines indicate the point at which the f-Hyperband runs have completed the same number of full Hyperband runs as shown for vanilla Hyperband. Top 1 indicates only training the best model to $r _ { i }$ iterations, and $\delta$ represents an offset off the threshold used for early stopping (See Section 4).More aggressive f-Hyperband settings lead to suboptimal performance, indicating that there is a limit to how much speedup f-Hyperband can achieve.
295
+
296
+ # H SRM ROBUSTNESS TO OUT OF DISTRIBUTION CONFIGURATIONS
297
+
298
+ Table 8 shows that SRMs are relatively robust when training below or above the median of a specific architecture or training hyperparameter and testing on the other split.
299
+
300
+ <table><tr><td rowspan=1 colspan=1>Cuda Convnet (CIFAR-10)</td><td rowspan=1 colspan=1>Learning Rate</td><td rowspan=1 colspan=1>WeightDecay</td><td rowspan=1 colspan=1>LRN Scale</td><td rowspan=1 colspan=1>LRN Power</td></tr><tr><td rowspan=1 colspan=1>Test&lt;Median</td><td rowspan=1 colspan=1>93.06 ± 0.18</td><td rowspan=1 colspan=1>95.93 ± 0.21</td><td rowspan=1 colspan=1>97.27 ± 0.0068</td><td rowspan=1 colspan=1>96.96 ± 0.13</td></tr><tr><td rowspan=1 colspan=1>Test&gt;Median</td><td rowspan=1 colspan=1>81.97 ± 1.26</td><td rowspan=1 colspan=1>96.19± 0.13</td><td rowspan=1 colspan=1>93.37 ± 0.23</td><td rowspan=1 colspan=1>95.05 ± 0.19</td></tr></table>
301
+
302
+ <table><tr><td rowspan=1 colspan=1>LSTMs (Penn Treebank)</td><td rowspan=1 colspan=1>Number of Nodes</td><td rowspan=1 colspan=1>Depth</td></tr><tr><td rowspan=1 colspan=1>Test&lt;Median</td><td rowspan=1 colspan=1>98.08 ± 0.26</td><td rowspan=1 colspan=1>98.58 ± 0.04</td></tr><tr><td rowspan=1 colspan=1>Test&gt;Median</td><td rowspan=1 colspan=1>22.83 ± 5.55</td><td rowspan=1 colspan=1>96.96 ± 0.91</td></tr></table>
303
+
304
+ <table><tr><td rowspan=1 colspan=1>DeepResnets (TinyImagenet)</td><td rowspan=1 colspan=1>Depth</td><td rowspan=1 colspan=1>Number ofKernels</td><td rowspan=1 colspan=1>Kernel Size</td></tr><tr><td rowspan=1 colspan=1>Test&lt;Median</td><td rowspan=1 colspan=1>89.49 ± 1.84</td><td rowspan=1 colspan=1>85.12 ± 2.24</td><td rowspan=1 colspan=1>81.83 ± 0.59</td></tr><tr><td rowspan=1 colspan=1>Test &gt;Median</td><td rowspan=1 colspan=1>85.92 ± 1.78</td><td rowspan=1 colspan=1>62.37 ± 0.82</td><td rowspan=1 colspan=1>89.61 ± 0.31</td></tr></table>
305
+
306
+ Table 8: Accuracy when splitting test and train set based on median values for hyperparameters for different datasets.
307
+
308
+ <table><tr><td rowspan=1 colspan=1>MetaQNN (CIFAR-10)</td><td rowspan=1 colspan=1>Depth</td></tr><tr><td rowspan=1 colspan=1>Test&lt;Median</td><td rowspan=1 colspan=1>96.69 ± 0.16</td></tr><tr><td rowspan=1 colspan=1>Test&gt;Median</td><td rowspan=1 colspan=1>79.31 ± 5.66</td></tr></table>
md/train/BdKxQp0iBi8/BdKxQp0iBi8.md ADDED
@@ -0,0 +1,270 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Counterfactual Invariance to Spurious Correlations: Why and How to Pass Stress Tests
2
+
3
+ Victor Veitch1,2, Alexander D’Amour1, Steve Yadlowsky1, and Jacob Eisenstein1
4
+
5
+ 1Google Research
6
+ 2University of Chicago
7
+
8
+ # Abstract
9
+
10
+ Informally, a ‘spurious correlation’ is the dependence of a model on some aspect of the input data that an analyst thinks shouldn’t matter. In machine learning, these have a know-it-when-you-see-it character; e.g., changing the gender of a sentence’s subject changes a sentiment predictor’s output. To check for spurious correlations, we can ‘stress test’ models by perturbing irrelevant parts of input data and seeing if model predictions change. In this paper, we study stress testing using the tools of causal inference. We introduce counterfactual invariance as a formalization of the requirement that changing irrelevant parts of the input shouldn’t change model predictions. We connect counterfactual invariance to outof-domain model performance, and provide practical schemes for learning (approximately) counterfactual invariant predictors (without access to counterfactual examples). It turns out that both the means and implications of counterfactual invariance depend fundamentally on the true underlying causal structure of the data—in particular, whether the label causes the features or the features cause the label. Distinct causal structures require distinct regularization schemes to induce counterfactual invariance. Similarly, counterfactual invariance implies different domain shift guarantees depending on the underlying causal structure. This theory is supported by empirical results on text classification.
11
+
12
+ # 1 Introduction
13
+
14
+ Our focus in this paper is the sort of spurious correlations revealed by “poke it and see what happens” testing procedures for machine-learning models. For example, we might test a sentiment analysis tool by changing one proper noun for another (“tasty Mexican food” to “tasty Indian food”), with the expectation that the predicted sentiment should not change. This kind of perturbative stress testing is increasingly popular: it is straightforward to understand and offers a natural way to test the behavior of models against the expectations of practitioners [Rib $+ 2 0$ ; $\mathrm { W u } { + } 1 9$ ; Nai+18].
15
+
16
+ Intuitively, models that pass such stress tests are preferable to those that do not. However, fundamental questions about the use and meaning of perturbative stress tests remain open. For instance, what is the connection between passing stress tests and model performance on prediction? Eliminating predictor dependence on a spurious correlation should help with domain shifts that affect the spurious correlation—but how do we make this precise? And, how should we develop models that pass stress tests when our ability to generate perturbed examples is limited? For example, automatically perturbing the sentiment of a document in a general fashion is difficult.
17
+
18
+ The ad hoc nature of stress testing makes it difficult to give general answers to such questions. In this paper, we will use the tools of causal inference to formalize what it means for models to pass stress tests, and use this formalization to answer the questions above. We will formalize passing stress tests as counterfactual invariance, a condition on how a predictor should behave when given certain (unobserved) counterfactual input data. We will then derive implications of counterfactual invariance that can be measured in the observed data. Regularizing predictors to satisfy these observable implications provides a means for achieving (partial) counterfactual invariance. Then, we will connect counterfactual invariance to robust prediction under certain domain shifts, with the aim of clarifying what counterfactual invariance buys and when it is desirable.
19
+
20
+ An important insight that emerges from the formalization is that the true underlying causal structure of the data has fundamental implications for both model training and guarantees. Methods for handing ‘spurious correlations’ in data with a given causal structure need not perform well when blindly translated to another causal structure.
21
+
22
+ Counterfactual Invariance Consider the problem of learning a predictor $f$ that predicts a label $Y$ from covariates $X$ . In this paper, we’re interested in constructing predictors whose predictions are invariant to certain perturbations on $X$ . Our first task is to formalize the invariance requirement.
23
+
24
+ To that end, assume that there is an additional variable $Z$ that captures information that should not influence predictions. However, $Z$ may causally influence the covariates $X$ . Using the potential outcomes notation, let $X ( z )$ to denote the counterfactual $X$ we would have seen had $Z$ been set to $z$ , leaving all else fixed. Informally, we can understand perturbative stress tests as a way of producing particular realizations of counterfactual pairs $X ( z )$ , $X ( z ^ { \prime } )$ that differ by an intervention on $z$ . Then, we formalize the requirement that an arbitrary change to $z$ does not change predictions:
25
+
26
+ Definition 1.1. A predictor $f$ is counterfactually invariant to $Z$ if $f ( X ( z ) ) \ : = \ : f ( X ( z ^ { \prime } ) )$ almost everywhere, for all $z , z ^ { \prime }$ in the sample space of $Z$ . When $Z$ is clear from context, we’ll just say the predictor is counterfactually invariant.
27
+
28
+ # 2 Causal Structure
29
+
30
+ Counterfactual invariance is a condition on how the predicted label behaves under interventions on parts of the input data. However, intuitions about stress testing are based on how the true label behaves under interventions on parts of the input data. We will see that the true causal structure fundamentally affects both the implications of counterfactual invariance, and the techniques we use to achieve it. To study this phenomenon, we’ll use two causal structures that are commonly encountered in applications; see Figure 1.
31
+
32
+ # 2.1 Prediction in the Causal Direction
33
+
34
+ We begin with the case where $X$ is a cause of $Y$
35
+
36
+ Example 2.1. We want to automatically classify the quality of product reviews. Each review has a number of “helpful” votes $Y$ (from site users). We predict $Y$ using the text of the product review $X$ . However, we find interventions on the sentiment $Z$ of the text change our prediction; changing “Great shoes!” to “Bad shoes!” changes the prediction.
37
+
38
+ In the examples in this paper, the covariate $X$ is text data. Usually, the causal relationship between the text and $Y$ and $Z$ will be complex— e.g., the relationships may depend on abstract, unlabeled, parts of the text such as topic, writing quality, or tone. In principle, we could enumerate all such latent variables, construct a causal graph capturing the relationships between these variables and $Y , Z$ , and use this causal structure to study counterfactual invariance. For instance, if we think that topic causally influences the helpfulness $Y$ , but is not influenced by sen
39
+
40
+ ![](images/db6f289cfcf6978a6de564bcb64d3637aad50130eac9708db787c9ff88ca27f4.jpg)
41
+ Figure 1: Causal models for the data generating process. We decompose the observed covariate $X$ into latent parts defined by their causal relationships with $Z$ and $Y$ . Solid arrows denote causal relationships, while dashed lines denote non-causal associations. The differences between these causal structures will turn out to be key for understanding counterfactual invariance.
42
+
43
+ timent $Z$ , then we could build a counterfactually invariant predictor by extracting the topic and predicting $Y$ using topic alone. However, exhaustively articulating all possible such variables is a herculean task.
44
+
45
+ Instead, notice that the only thing that’s relevant about these latent variables is their causal relationship with $Y$ and $Z$ . Accordingly, we’ll decompose the observed variable $X$ into parts defined by their causal relationships with $Y$ and $Z$ . We remain agnostic to the semantic interpretation of these parts. Namely, we define $X _ { Z } ^ { \perp }$ as the part of $X$ that is not causally influenced by $Z$ (but may influence $Y )$ , $X _ { Y } ^ { \perp }$ as the part that does not causally influence $Y$ (but may be influenced by $Z$ ), and $X _ { Y \wedge Z }$ is the remaining part that is both influenced by $Z$ and that influences $Y$ . The causal structure is shown in Figure 1a.
46
+
47
+ We see there are two paths that lead to $Y$ and $Z$ being associated. The first is when $Z$ affects $X _ { Y \wedge Z }$ which, in turn, affects $Y$ . For example, a very enthusiastic reviewer might write a longer, more detailed review, which will in turn be more helpful. The second is when a common cause or selection effect in the data generating process induces an association between $Z$ and $Y$ , which we denote with a dashed arrow. For example, if books tend to get more positive reviews, and also people who buy books are more likely to flag reviews as helpful, then the product type would be a common cause of sentiment and helpfulness.
48
+
49
+ # 2.2 Prediction in the Anti-Causal Direction
50
+
51
+ We also consider the case where $Y$ causes $X$
52
+
53
+ Example 2.2. We want to predict the star rating $Y$ of movie reviews from the text $X$ . However, we find that predictions are influenced by the movie genre $Z$ ; e.g., changing “Adam Sandler” (a comedy actor) to “Hugh Grant” (a romance actor) changes the predictions.
54
+
55
+ Figure 1b shows the causal structure. Here, the observed $X$ is influenced by both $Y$ and $Z$ . Again, we decompose $X$ into parts defined by their causal relationship with $Z$ and $Y$ . Here, $Z$ (and thus $X _ { Y } ^ { \perp }$ ) can be associated with $Y$ through two paths. First, if $X _ { Y \wedge Z }$ is non-trivial, then conditioning on it causes a dependence between $Z$ and $Y$ (because $X _ { Y \wedge Z }$ is a collider). For example, if Adam Sandler tends to appear in good comedy movies but bad movies of other genres then seeing “Sandler” in the text induces a dependency between sentiment and genre. Second, $Z$ and $Y$ may be associated due to a common cause, or due to selection effects in the data collection protocol—this is represented by the dashed line between $Z$ and $Y$ . For example, fans of romantic comedies may tend to give higher reviews (to all films) than fans of horror movies.
56
+
57
+ # 2.3 Non-Causal Associations
58
+
59
+ Frequently, a predictor trained to predict $Y$ from $X$ will rely on $X _ { Y } ^ { \perp }$ , even though there is no causal connection between $Y$ and $X _ { Y } ^ { \perp }$ , and therefore will fail counterfactual invariance. The reason is that $X _ { Y } ^ { \perp }$ serves as a proxy for $Z$ , and $Z$ is predictive of $Y$ due to the non-causal (dashed line) association.
60
+
61
+ There are two mechanisms that can induce such associations. First, $Y$ and $Z$ may be confounded: they are both influenced by an unobserved common cause $U$ . For example, people who review books may be more upbeat than people who review clothing. This leads to positive sentiments and high helpfulness votes for books, creating an association between sentiment and helpfulness. Second, $Y$ and $Z$ may be subject to selection: there is some condition (event) $S$ that depends on $Y$ and $Z$ , such that a data point from the population is included in the sample only if $S = 1$ holds. For example, our training data might only include movies with at least 100 reviews. If only excellent horror movies have so many reviews (but most rom-coms get that many), then this selection would induce an association between genre and score. Formally, the dashed-line causal graphs mean our sample is distributed according to $\begin{array} { r } { P ( X , Y , Z ) = \int \mathrm { P } ( \dot { X } , Y , Z , u \mid S = 1 ) \mathrm { d } \mathrm { P } ( u ) } \end{array}$ where $Y , Z$ are caused by $U$ and are causes of $S$ , and $( X , Y , Z )$ are causally related according to the graph.
62
+
63
+ In addition to the non-causal dashed-line relationship, there is also dependency induced by between $Y$ and $Z$ by $X _ { Y \wedge Z }$ . Whether or not each of these dependencies is “spurious” is a problem-specific judgement that must be made by each analyst based on their particular use case. E.g., using genre to predict sentiment may or may not be reasonable, depending on the actual application in mind. However, there is a special case that captures a common intuition for purely spurious association.
64
+
65
+ Definition 2.3. We say that the association between $Y$ and $Z$ is purely spurious if $Y \perp X \mid X _ { Z } ^ { \perp } , Z$
66
+
67
+ That is, if the dashed-line association did not exist (removed by conditioning on $Z$ ) then the part of $X$ that is not influenced by $Z$ would suffice to estimate $Y$ .
68
+
69
+ # 3 Observable Signatures of Counterfactually Invariant Predictors
70
+
71
+ We now consider the question of how to achieve counterfactual invariance in practice. The challenge is that counterfactual invariance is defined by the behavior of the predictor on counterfactual data that is never actually observed. This makes checking counterfactual invariance impossible. Instead, we’ll derive a signature of counterfactual invariance that actually can be measured—and enforced— using ordinary datasets where $Z$ (or a proxy) is measured. For example, the star rating of a review as a proxy for sentiment, or genre labels in the movie review case.
72
+
73
+ Intuitively, a predictor $f$ is counterfactually invariant if it depends only on $X _ { Z } ^ { \perp }$ , the part of $X$ that is not affected by $Z$ . To formalize this, we need to show that such a $X _ { Z } ^ { \perp }$ is well defined:
74
+
75
+ Lemma 3.1. Let $X _ { Z } ^ { \perp }$ be a $X$ -measurable random variable such that, for all measurable functions $f$ , we have that $f$ is counterfactually invariant if and only if $f ( X )$ is $X _ { Z } ^ { \perp }$ -measurable. If $Z$ is discrete1 then such a $X _ { Z } ^ { \perp }$ exists.
76
+
77
+ Accordingly, we’d like to construct a predictor that is a function of $X _ { Z } ^ { \perp }$ only (i.e., is $X _ { Z } ^ { \perp }$ measurable). The key insight is that we can use the causal graphs to read off a set of conditional independence relationships that are satisfied by $Z , X _ { Z } ^ { \perp } , Y$ . Critically, these conditional independence relationships are testable from the observed data. Thus, they provide a signature of counterfactual invariance:
78
+
79
+ Theorem 3.2. If $f$ is a counterfactually invariant predictor:
80
+
81
+ 1. Under the anti-causal graph, $f ( X ) \perp Z \mid Y$ .
82
+ 2. Under the causal-direction graph, if $Y$ and $Z$ are not subject to selection (but possibly confounded), $f ( X ) \perp \perp Z$ .
83
+ 3. Under the causal-direction graph, if the association is purely spurious, $Y \perp X \mid X _ { Z } ^ { \perp } , Z$ , and $Y$ and $Z$ are not confounded (but possibly selected), $f ( X ) \perp Z \mid Y$ .
84
+
85
+ Remark 3.3 (Connection to Fairness). This result has an interesting interpretation when $Z$ is a protected attribute (e.g., sex or race) that we’d like to be fair with respect to. There are many ways of formalizing fairness, which are usually mutually incompatible. In the fairness setting, counterfactual invariance is equivalent to counterfactual fairness [Kus+17; Gar+19], the condition $f ( X ) \ \perp \ Z$ is equivalent to demographic parity, and the condition $f ( X ) \perp Z \mid Y$ is equivalent to equalized odds [Meh+19]. Theorem 3.2 then says that counterfactual fairness implies either demographic parity or equalized odds, depending on the true underlying causal structure of the problem. Hence, the relationship between disparate fairness notions is clarified by taking the underlying causal structure into account. This also suggests we can take counterfactual fairness as the fundamental notion, then use demographic parity in the causal-confounding case and equalized odds otherwise. However, we leave the (ethical) question of whether this is a sound strategy to future work.
86
+
87
+ Causal Regularization Without access to counterfactual examples, we cannot directly enforce counterfactual invariance. However, we can require a trained model to satisfy the counterfactual invariance signature of Theorem 3.2. The hope is that enforcing the signature will lead the model to be counterfactually invariant. To do this, we regularize the model to satisfy the appropriate conditional independence condition. For simplicity of exposition, we restrict to binary $Y$ and $Z$ . The (infinite data) regularization terms are
88
+
89
+ $$
90
+ \begin{array} { r l } & { = \mathrm { M M D } ( \mathrm { P } ( f ( X ) \mid Z = 0 ) , \mathrm { P } ( f ( X ) \mid Z = 1 ) ) } \\ & { = \mathrm { M M D } ( \mathrm { P } ( f ( X ) \mid Z = 0 , Y = 0 ) , \mathrm { P } ( f ( X ) \mid Z = 1 , Y = 0 ) ) } \\ & { \quad + \mathrm { M M D } ( \mathrm { P } ( f ( X ) \mid Z = 0 , Y = 1 ) , \mathrm { P } ( f ( X ) \mid Z = 1 , Y = 1 ) ) . } \end{array}
91
+ $$
92
+
93
+ Maximum mean discrepancy (MMD) is a metric on probability measures.2 The marginal independence condition is equivalent to (3.1) equal 0, and the conditional independence is equivalent to (3.2)
94
+
95
+ equal 0. In practice, we can estimate the MMD with finite data samples $[ \mathrm { G r e } { + } 1 2 ]$ . When training with stochastic gradient descent, we compute the penalty on each minibatch.
96
+
97
+ The procedure is then: if the data has causal-direction structure and the $Y Z$ association is due to confounding, add the marginal regularization term to the the training objective. If the data has anti-causal structure, or the association is due to selection, add the conditional regularization term instead. In this way, we regularize towards models that satisfy the counterfactual invariance signature.
98
+
99
+ A key point is that the regularizer we must use depends on the true causal structure. The conditional and marginal independence conditions are generally incompatible. Enforcing the condition that is mismatched to the true underlying causal structure may fail to encourage counterfactual invariance, or may throw away more information than is required.
100
+
101
+ Gap to Counterfactual Invariance The conditional independence signature of Theorem 3.2 is necessary but not sufficient for counterfactual invariance. This is for two reasons. First, counterfactual invariance applies to individual datapoint realizations, but the signature is distributional. In particular, the invariance $\mathrm { P } ( f ( X ) \mid \mathrm { d o } ( Z = z ) ) = \mathrm { P } ( f ( X ) \mid \mathrm { d o } ( Z = \bar { z } ^ { \prime } ) )$ for all $z , z ^ { \prime }$ would also imply the conditional independence signature. But, this invariance is weaker than counterfactual invariance, since it doesn’t require access to counterfactual realizations. Second, $f ( X ) \ \perp \perp Z$ does not imply, in general, that $Z$ is not a cause of $f ( X )$ . This (unusual) behavior can happen if, e.g., there are levels of $Z$ that we do not observe in the training data, or there are variables omitted from the causal graph that are a common cause of $Z$ and $X$ .
102
+
103
+ Unfortunately, the gap between the signature and counterfactual invariance is a fundamental restriction of using observational data. The conditional independence signature is in some sense the closest proxy for counterfactual invariance we can hope for. In section 5, we’ll see that enforcing the signature does a good job of enforcing counterfactual invariance in practice.
104
+
105
+ # 4 Performance Out of Domain
106
+
107
+ Counterfactual invariance is an intuitively desirable property for a predictor to have. However, it’s not immediately clear how it relates to model performance as measured by, e.g., accuracy. Intuitively, eliminating predictor dependence on a spurious $Z$ may help with domain shift, where the data distribution in the target domain differs from the distribution of the training data. We now turn to formalizing this idea.
108
+
109
+ First, we must articulate the set of domain shifts to be considered. In our setting, the natural thing is to hold the causal relationships fixed across domains, but to allow the non-causal (“spurious”) dependence between $Y$ and $Z$ to vary. Demanding that the causal relationships stay fixed reflects the requirement that the causal structure describes the dynamics of an underlying real-world process— e.g., the author’s sentiment is always a cause (not an effect) of the text in all domains. On the other hand, the dependency between $Y$ and $Z$ induced by either confounding or selection can vary without changing the underlying causal structure. For confounding, the distribution of the confounder may differ between domains—e.g., books are rare in training, but common in deployment. For selection, the selection criterion may differ between domains—e.g., we include only frequently reviewed movies in training, but make predictions for all movies in deployment.
110
+
111
+ We want to capture spurious domain shifts by considering domain shifts induced by selection or confounding. However, there is an additional nuance. Changes to the marginal distribution of $Y$ will affect the risk of a predictor, even in the absence of any spurious association between $Y$ and $Z$ . Therefore, we restrict to shifts that preserve the marginal distribution of $Y$ .
112
+
113
+ Definition 4.1. We say that distributions $P , Q$ are causally compatible if both obey the same causal graph, $P ( Y ) = Q ( Y )$ , and there is a confounder $U$ and/or selection conditions $S , { \tilde { S } }$ such that $\begin{array} { r } { P { = } \int \operatorname { P } ( X , Y , Z \mid U , S { = } 1 ) \mathrm { d } \tilde { P } ( U ) } \end{array}$ and $\begin{array} { r } { Q { = } \int \operatorname { P } ( X , Y , Z \mid U , \tilde { S } { = } 1 ) \mathrm { d } \tilde { Q } ( U ) } \end{array}$ for some $\tilde { P } ( U ) , \tilde { Q } ( U )$ .
114
+
115
+ We can now connect counterfactual invariance and robustness to domain shift.
116
+
117
+ Theorem 4.2. Let ${ \mathcal { F } } ^ { \mathrm { i n v a r } }$ be the set of all counterfactually invariant predictors. Let $L$ be either square error or cross entropy loss. And, let $f ^ { * } : = \operatorname { a r g m i n } _ { \underline { { f } } \in \mathcal { F } ^ { \mathrm { i n v a } } }$ r $\mathbb { E } _ { P } [ L ( Y , f ( X ) ) ]$ be the counterfactually invariant risk minimizer. Suppose that the target distribution $Q$ is causally compatible with the training distribution $P$ . Suppose that any of the following conditions hold:
118
+
119
+ 1. the data obeys the anti-causal graph
120
+ 2. the data obeys the causal-direction graph, there is no confounding (but possibly selection), and the association is purely spurious, $Y \perp X \mid X _ { Z } ^ { \perp } , Z$ , or
121
+ 3. the data obeys the causal-direction graph, there is no selection (but possibly confounding), the association is purely spurious and the causal effect of $X _ { Z } ^ { \perp }$ on $Y$ is additive, i.e., the true data generating process is
122
+
123
+ $$
124
+ Y g ( X _ { Z } ^ { \perp } ) + \tilde { g } ( U ) + \xi w h e r e \operatorname { \mathbb { E } } [ \xi \mid X _ { Z } ^ { \perp } ] = 0 ,
125
+ $$
126
+
127
+ for some functions $g , \tilde { g }$
128
+
129
+ Then, the training domain counterfactually invariant risk minimizer is also the target domain counterfactually invariant risk minimizer, $f ^ { * } = \mathrm { a r g m i n } _ { f \in \mathcal { F } ^ { \mathrm { i n } } }$ var $\mathbb { E } _ { Q } [ L ( Y , f ( X ) ) ]$ .
130
+
131
+ Remark 4.3. The causal case with confounding requires an additional assumption (additive structure) because, e.g., an interaction between confounder and $X _ { Z } ^ { \perp }$ can yield a case where $X _ { Z } ^ { \perp }$ and $Y$ have a different relationship in each domain (whence, out-of-domain learning is impossible).
132
+
133
+ This result gives a recipe for finding a good predictor in the target domain even without access to any target domain examples at training time. Namely, find the counterfactually invariant risk minimizer in the training domain. In practice, we can use the regularization scheme of section 3 to (approximately) achieve this. We’ll see in section 5 that this works well in practice.
134
+
135
+ Optimality Theorem 4.2 begs the question: if the only thing we know about the target setting is that it’s causally compatible with the training data, is the best predictor the counterfactually invariant predictor with lowest training risk? A natural way to formalize this question is to study the predictor with the best performance in the worst case target distribution. We define $ \bar { \mathcal { Q } } ~ = ~ \{ \bar { Q } ~ : ~ Q$ causally compatible with $P \}$ and the $\mathcal { Q }$ -minimax predictor $f _ { \mathrm { m i n i m a x } } ^ { * } ~ =$ $\operatorname { \arg m i n } _ { f \in { \mathcal { F } } } \operatorname* { m a x } _ { Q \in { \mathcal { Q } } } \mathbb { E } _ { Q } [ L ( Y , f ( X ) ]$ . The question is then: what’s the relationship between the counterfactually invariant risk minimizer and the minimax predictor?
136
+
137
+ Theorem 4.4. The counterfactually invariant risk minimizer is not $\mathcal { Q }$ -minimax in general. However, under the conditions of Theorem 4.2, if the association is purely spurious, $X _ { Y \wedge Z } \ { \bar { \perp } } \ Y \mid X _ { Z } ^ { \perp } , Z$ , and $\mathrm { P } ( Z , Y )$ satisfies overlap, then the two predictors are the same. By overlap we mean that $\mathrm { P } ( Z , Y )$ is a discrete distribution such that for all $( z , y )$ , $i f \mathrm { P } ( z , y ) > 0$ then there is some $y ^ { \prime } \ne y$ such that also $\mathrm { P } ( z , y ^ { \prime } ) > 0$ .
138
+
139
+ Conceptually, Theorem 4.4 just says that the counterfactually invariant predictor excludes $X _ { Y \wedge Z }$ , even when this information is useful in every domain. In the purely spurious case, $X _ { Y \wedge Z }$ carries no useful information, so counterfactual invariance is optimal.
140
+
141
+ # 5 Experiments
142
+
143
+ The main claims of the paper are:
144
+
145
+ 1. Stress test violations can be reduced by suitable conditional independence regularization.
146
+ 2. This reduction will improve out-of-domain prediction performance.
147
+ 3. To get the full effect, the imposed penalty must match the causal structure of the data.
148
+
149
+ Setup To assess these claims, we’ll examine the behavior of predictors trained with the marginal or conditinal regularization on multiple text datasets that have either causal or anti-causal structure. We expect to see that marginal regularization improves stress test and out-of-domain performance on data with causal-confounded structure, and conditional regularization improves these on data with anti-causal structure.
150
+
151
+ For each experiment, we use BERT [Dev+19] finetuned to predict a label $Y$ from the text as our base model. We train multiple causally-regularized models on the each dataset. The training varies by whether we use the conditional or marginal penalty, and by the strength of the regularization term. That is, we train identical architectures using CrossEntropy $+ \lambda \cdot$ Regularizer as the objective function, where we vary $\lambda$ and take Regularizer as either the marginal penalty, (3.1), or conditional penalty, (3.2). We compare these models’ predictions on data with causal and anti-causal structure.
152
+
153
+ See supplement for experimental details.
154
+
155
+ ![](images/53efb42512085a29a0de7812344b3d241b39e4349e1f4adf7ba004e54ec1e32c.jpg)
156
+ Figure 2: Regularizing conditional MMD improves counterfactual invariance on synthetic anti-causal data. Sufficiently high regularization of marginal MMD also improves invariance, but impairs accuracy. Dashed lines show baseline performance of an unregularized predictor. Left: lower conditional MMD implies that predictive probabilities are invariant to perturbation. Although marginal MMD penalization can result in low conditional MMD and good stress test performance, this comes at the cost of very low in-domain accuracy. Right: MMD regularization reduces the rate of predicted label flips on perturbed data, with little affect on indomain accuracy. Conditional MMD regularization reduces predicted label flips to $1 . 4 \%$ , while the best result for marginal MMD is $2 . 8 \%$ .
157
+
158
+ # 5.1 Robustness to Stress Tests
159
+
160
+ First, we examine whether enforcing the causal regularization actually helps to enforce counterfactual invariance. We create counterfactual (stress test) examples by perturbing the input data and compare the prediction on these. We build the experimental datasets using Amazon reviews from the product category “Clothing, Shoes, and Jewelry” [NLM19].
161
+
162
+ Synthetic To study the relationship between counterfactual invariance and the distributional signature of Theorem 3.2, we construct a synthetic confound. For each review, we draw a Bernoulli random $Z$ , and then perturb the text $X$ so that the common words “the” and “a” carry information about $Z$ : for example, we replace “the” with the token “thexxxxx” when $Z = 1$ . We take $Y$ to be the review score, and subsample so $Y$ is balanced. This data has anti-causal structure: the text $X$ is written to explain the score $Y$ . Further, we expect that the $Y , Z$ association is purely spurious, because “the” and “a” carry little information about the label.
163
+
164
+ We train the models on data where $\operatorname { P } ( Y = Z ) = 0 . 3$ . We then create perturbed stress-test datasets by changing each example $X _ { i } ( z )$ to the counterfactual $X _ { i } ( 1 - z )$ (using the synthetic model). By measuring the performance of each model on the perturbed data, we can test whether the distributional properties enforced by the regularizers result in counterfactual invariance at the instance level. Figure 2 shows that conditional regularization (matching the anti-causal structure) reduces checklist failures, as measured by the frequency that the predicted label changes due to perturbation as well as the mean absolute difference in predictive probabilities that is induced by perturbation.
165
+
166
+ Natural To study the relationship in real data, we use the review data in a different way. We now take $Z$ to be the score, binarized as $Z \in { }$ $\{ 1$ or 2 stars, 4 or 5 stars}. We use this $Z$ as a proxy for sentiment, and consider problems where sentiment should (plausibly) not have a causal effect on $Y$ . For the causal prediction problem, we take $Y$ to be the helpfulness score of the review (binarized as described below). This is causal because readers decide whether the review is helpful based on the text. For the anti-causal prediction problem, we take $Y$ to be whether “Clothing” is included as a category tag for the product under review (e.g., boots typically do not have this tag). This is anti-causal because the product category affects the text.
167
+
168
+ ![](images/25d13abb0d1a94526c03a9edcbbe9537be776b40dc5768ab7b2869bd796e53c3.jpg)
169
+ Figure 3: Penalizing the MMD matching the causal structure improves stress test performance on natural product review data. Note that penalizing the wrong MMD may not help: the marginal MMD hurts on the anticausal dataset. Perturbations are generated by swapping positive and negative sentiment adjectives in examples.
170
+
171
+ We control the strength of the spurious association between $Y$ and $Z$ . In the anti-causal case, this is done by selection: we randomly subset the data to enforce a target level of dependence between $Y$ and $Z$ . The causal-direction case with confounding is more complicated. To manipulate confounding strength, we binarize the number of helpfulness votes $V$ in a manner determined by the target level of association. We take $Y = 1 [ V > T _ { Z } ]$ where $T _ { Z }$ is a $Z$ -dependent threshold, chosen to induce a target association. We choose $\operatorname { P } ( Y = { \bar { 0 } } \mid Z = 0 ) = \operatorname { P } ( Y = { \bar { 1 } } \mid Z = 1 ) = 0 . 3$ . We balance $Z$ by subsampling, which also balances $Y$ .
172
+
173
+ Now, we create stress test perturbations of these datasets by randomly changing adjectives in the examples. Using predefined lists of postive sentiment adjectives and negative sentiment adjectives, we swap any adjective that shows up on a list with a randomly sampled adjective from the other list. This preserves basic sentence structure, and thus creates a limited set of counterfactual pairs that differ on sentiment.
174
+
175
+ Results for differences in predicted probabilities between original and perturbed data are shown in Figure 3. Each point is a trained model, which vary in measured MMD on the test data and on sensitivity to perturbations. Recall that the conditional independence signature of Theorem 3.2 are necessary but not sufficient for counterfactual invariance, so it’s not certain that regularizing to reduce the MMD will reduce perturbation sensitivity. Happily, we see that regularizing to reduce the MMD that matches the causal structure does indeed reduce sensitivity to perturbations.
176
+
177
+ Notice that regularizing the causally mismatched MMD can have strange effects. Regularizing marginal MMD in the anti-causal case actually makes the model more sensitive to perturbations!
178
+
179
+ # 5.2 Domain Shift
180
+
181
+ Next, we study the effect of causal regularization on model performance under domain shift.
182
+
183
+ Natural Product Review We again use the natural Amazon review data described above. For both the causal and anticausal data, we create multiple test sets with variable spurious correlation strength. This is done in the manner described above, varying $\operatorname { P } ( Y = 0 \mid Z =$ $0 ) = \operatorname { P } ( Y = 1 \mid Z = 1 ) =$ $\gamma$ . Here, $\gamma$ is the strength of spurious association. The test sets are out-of-domain samples. By design, $Y$ is balanced in each dataset, so these samples are causally compatible with the training data. For both the causal and anti-causal datasets, the training data has $\begin{array} { r l } { \mathrm { P } ( Y } & { { } = } \end{array}$ $0 \mid Z = 0 \bar { ) } = \mathrm { P } ( Y = 1 \mid Z =$ $1 ) ~ = ~ 0 . 3$ . We train a classifier for each regularization type and regularization strength, and measure the accuracy on each test domain. The results are shown in Figure 4.
184
+
185
+ ![](images/cc50159fcb6943974ab865fe3f6e0e57889243fedb2eb828a12ef8b80e7b30b1.jpg)
186
+ Anti-Causal Data: conditional regularization improves domain-shift robustness.
187
+
188
+ ![](images/1aad0d1d99d5ec2ccf3cc08ff60ebd5e9382fde6d09560b6780ee4953b6c184c.jpg)
189
+ Causal-Direction Data: marginal regularization improves domain-shift robustness.
190
+ Figure 4: The best domain-shift robustness is obtained by using the regularizer that matches the underlying causal structure of the data. The plots show out-of-domain accuracy for models trained on the (natural) review data. In each row, the left figure shows out-of-domain accuracies (lines are models), with the $X$ -axis showing the level of spurious correlation in the test data (0.3 is the training condition); the right figure shows worst out-of-domain accuracy versus in-domain test accuracy (dots are models).
191
+
192
+ First, the unregularized predictors do indeed learn to rely on the spurious association between sentiment and the label. The accuracy of these predictors decays dramatically as the spurious assocation moves from negative (0.3) to positive—in the causal case, the unregularized predictor is worse than chance in the 0.8 domain.
193
+
194
+ Following section 3, the regularization that matches the underlying causal structure should yield a predictor that is (approximately) counterfactually invariant. Following Theorem 4.2, we expect that good performance of a counterfactually-invariant predictor in the training domain should imply good performance in each of the other domains. Indeed, we see that this is so. Models that are regularized to have small values of the appropriate MMD do indeed have better out-of-domain performance.
195
+
196
+ ![](images/a10a5b2248012b6f81c4cccbf8cd45aa1b0e5f41578a88117ad325f1b0dfe2e9.jpg)
197
+ Figure 5: Conditional MMD penalization improves robustness in anti-causal MNLI data. Marginal regularization does not improve over the baseline unregularized model, shown with dashed lines. Left: Conditional regularization improves minimum accuracy across $( Y , Z )$ groups. When overregularized, the predictor returns the same $\hat { Y }$ for all inputs, yielding a worst-group accuracy of 0. Right: Conditional MMD regularization significantly improves worst $( Y , Z )$ group accuracy $y$ -axis) while only mildly reducing overall accuracy ( $x$ -axis).
198
+
199
+ Such models have somewhat worse in-domain performance, because they no longer exploit the spurious correlation.
200
+
201
+ MNLI Data For an additional test on naturally-occurring confounds, we use the multigenre natural language inference (MNLI) dataset [WNB18]. Instances are concatenations of two sentences, and the label describes the semantic relationship between them, $Y \in \mathbf { \Sigma }$ {contradiction, entailment, neutral}. There is a well-known confound in this dataset: examples where the second sentence contain a negation word (e.g., “not”) are much more likely to be labeled as contradictions $[ \mathrm { G u r } { + } 1 8 ]$ . Following Sagawa et al. $[ \mathrm { S a g } + 2 0 ]$ , we set $Z$ to indicate whether one of a small set of negation words is present. Although $Z$ is derived from the text $X$ , it can be viewed as a proxy for a latent variable indicating whether the author intended to use negation in the text. This is an anti-causal prediction problem: the annotators were instructed to write text to reflect the desired label [WNB18].
202
+
203
+ Following Sagawa et al. $[ \mathrm { S a g } + 2 0 ]$ , we divide the MNLI data into groups by $( Y , Z )$ and compute the “worst group accuracy” across all such groups. Because this is an anti-causal problem, we predict that the conditional MMD is a more appropriate penalty than the marginal MMD. As shown in Figure 5, this prediction holds: conditional MMD regularization dramatically improves performance on the worst group, while only lightly impacting the overall accuracy across groups.
204
+
205
+ # 6 Related work
206
+
207
+ Several papers draw a connection between causality and domain shifts [SS18; SCS19; $\mathrm { \bf A r j + } 2 0$ ; Mei18; PBM16; $\mathrm { R C } { + 1 8 }$ ; Zha+13; $\operatorname { S c h } { + 1 2 } ]$ . Typically, this work considers a prediction setting where the covariates $X$ include both causes and effects of $Y$ , and it is unknown which is which. The goal is to learn to predict $Y$ using only its causal parents. Zhang et al. $\left[ Z \mathrm { h a } + 1 3 \right]$ considers anti-causal domain shift induced by changing $P ( Y )$ and proposes a data reweighting scheme. By contrast, counterfactual invariance is an example-wise notion of invariance, not an invariance across environments. In particular, learning a counterfactually invariant predictor only requires access to data from a single environment. Theorem 4.2 establishes that counterfactual invariance does imply a certain domain generalization guarantee over causally-compatible domains. Note though that the notion of causal compatibility is not generally the same as class of domain shifts previously considered. For example, we have invariant performance in the anti-causal setting, but this is ruled out by Arjovsky et al. $[ \mathrm { A r j } { + } 2 0 ]$ .
208
+
209
+ A related body of work focuses on “causal representation learning” [Bes+19; $\mathrm { L o c } { + 2 0 }$ ; $\operatorname { S c h } { + 2 1 }$ ; $\mathrm { A r j } { + } 2 0 ]$ . Our approach follows this tradition, but focuses on splitting $X$ into components defined by their causal relationships with the label $Y$ and an additional covariate $Z$ . Rather than attempting to infer the causal relationship between $X$ and $Y$ , we show that domain knowledge of this relationship is essential for obtaining counterfactually-invariant predictors. The role of causal vs anti-causal data generation in semi-supervised learning and transfer learning has also been studied $[ \mathrm { S c h } \cdot 2 1 $ ; $\operatorname { S c h + } 1 2 ]$ . In this paper we focus on a different implication of the causal vs anti-causal distinction.
210
+
211
+ Another line of work considers the case where either the counterfactuals $X ( z )$ , $X ( z ^ { \prime } )$ are observed for at least some data points, or where it’s assumed that there’s enough structural knowledge to (learn to) generate counterfactual examples [RPH21; $\mathrm { W u } { + } 2 1$ ; Gar+19; $\mathrm { M i t } { + } 2 0$ ; WZ19; KCC20; KHL20; TAH20]. Kusner et al. [Kus+17] and Garg et al. [Gar $^ +$ 19] in particular examine a notion of counterfactual fairness that can be seen as equivalent to counterfactual invariance. In these papers, approximate counterfactuals are produced by direct manipulation of the features (e.g., change male to female names), generative models (e.g., style transfer of images), or crowdsourcing. Then, these counterfactuals can either be used as additional training data or the predictor can be regularized such that it cannot distinguish between $X _ { i } ( z )$ and $X _ { i } ( z ^ { \prime } )$ . This strategy can be viewed as enforcing counterfactual invariance directly; an advantage is that it avoids the necessary-but-not-sufficient nuance of Theorem 3.2. However, counterfactual examples can be difficult to obtain for language data in many realistic problem domains, and it may be difficult to learn to generalize from such examples [HLB20].
212
+
213
+ The marginal and conditional independencies of Theorem 3.2 have appeared in other contexts. As discussed in remark 3.3, if we think of $Z$ as a protected attribute and $f$ as a ‘fair’ classifier, then counterfactual invariance is counterfactual fairness, the marginal independence is demographic parity, and the conditional independence is equalized odds [Meh $^ +$ 19]. In another setting, one approach to domain adaptation is to seek representations $\phi$ such that either $\phi ( X )$ [e.g., MBS13; Bak $+ 1 3$ ; Gan $+ 1 6$ ; Tze+14] or $\phi ( X ) \mid Y$ [e.g., MLM19; $\mathrm { Y a n } { + } 1 7 ]$ have the same distribution in each environment. The connection here is subtler; it is inappropriate to interpret $Z$ as a domain label (we only have access to one domain at train time, and all values of $Z$ are present in each domain). To clarify the connection, consider introducing an extra variable $E$ that labels the domain. For concreteness, consider the anti-causal case where the spurious association between $Y$ and $Z$ is due to an observed confounder $U$ . Now, suppose that $E$ is a cause of $U$ . Then, $E$ labels the distribution of the unobserved confounder, and thus different values of $E$ correspond to different causally compatible domains. Now, if we draw the causal graph we can read off that $X _ { z } ^ { \perp } E | Y$ . That is, we arrive at the same conditional independence criterion. However, it’s essentially a coincidence that this matches the criterion we’d use if we’d observed $Z$ —the two variables have totally different causal meanings and interpretations. For example, in the review data case, we might take $Z$ to be review score and $E$ to be the website the review is collected from. The review quality doesn’t need to be counterfactually invariant to the website, and indeed we wouldn’t expect it to be!
214
+
215
+ Finally, this work can be viewed as part of a recent line of work using counterfactuals to examine the connection between example-wise robustness (stress testing) and distributional-level robustness (domain shift) [e.g., TAH20; RPH21; Kau+21]. Teney et al. [TAH20] use near counterfactuals with different labels in a modified training objective, and show improved performance out-of-domain empirically. Robey et al. [RPH21] use image models to generate counterfactuals, and incorporate the model into training, showing out-of-domain improvement. They assume a somewhat different causal structure—articulating the precise connection is an interesting future direction. Kaushik et al. [Kau+21] study a linear-Gaussian model and argue that out-of-domain performance can be used as a signal to distinguish ‘causal’ and ‘spurious’ features.
216
+
217
+ # 7 Discussion
218
+
219
+ We used the tools of causal inference to formalize and study perturbative stress tests. A main insight of the paper is that counterfactual desiderata can be linked to observationally-testable conditional independence criteria. This requires consideration of the true underlying causal structure of the data. Done correctly, the link yields a simple procedure for enforcing the counterfactual desiderata, and mitigating the effects of domain shift.
220
+
221
+ The main limitation of the paper is the restrictive causal structures we consider. In particular, we require that $X _ { Z } ^ { \perp }$ , the part of $X$ not causally affected by $Z$ , is also statistically independent of $Z$ in the observed data. However, in practice these may be dependent due to a common cause. In this case, the procedure here will be overly conservative, throwing away more information than required. Additionally, it is not obvious how to apply the ideas described here to more complicated causal situations, which can occur in structured prediction (e.g., question answering). Extending the ideas to handle richer causal structures is an important direction for future work. The work described here can provide a template for this research program.
222
+
223
+ # 8 Acknowledgements
224
+
225
+ Thanks to Kevin Murphy, Been Kim, Molly Roberts, Justin Grimmer, and Brandon Stewart for feedback on an earlier version.
226
+
227
+ # 9 Funding Transparency
228
+
229
+ This paper was not supported by any third party funding, and the authors have no competing interests to declare.
230
+
231
+ # References
232
+
233
+ $[ \mathrm { A r j } { + } 2 0 ]$ M. Arjovsky, L. Bottou, I. Gulrajani, and D. Lopez-Paz. Invariant Risk Minimization. 2020. arXiv: 1907.02893 [stat.ML].
234
+ $[ \mathrm { B a k } + 1 3 ]$ M. Baktashmotlagh, M. T. Harandi, B. C. Lovell, and M. Salzmann. “Unsupervised domain adaptation by domain invariant projection”. In: Proceedings of the 2013 IEEE International Conference on Computer Vision. 2013.
235
+ [Bes+19] M. Besserve, A. Mehrjou, R. Sun, and B. Scholkopf. ¨ Counterfactuals uncover the modular structure of deep generative models. 2019. arXiv: 1812.03253 [cs.LG].
236
+ [Dev+19] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. “Bert: pre-training of deep bidirectional transformers for language understanding”. In: Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers). 2019.
237
+ [Gan+16] Y. Ganin, E. Ustinova, H. Ajakan, P. Germain, H. Larochelle, F. Laviolette, M. Marchand, and V. Lempitsky. “Domain-adversarial training of neural networks”. In: J. Mach. Learn. Res. 1 (2016).
238
+ [Gar+19] S. Garg, V. Perot, N. Limtiaco, A. Taly, E. H. Chi, and A. Beutel. “Counterfactual fairness in text classification through robustness”. In: Proceedings of the 2019 AAAI/ACM Conference on AI, Ethics, and Society. 2019.
239
+ [Gre+12] A. Gretton, K. M. Borgwardt, M. J. Rasch, B. Scholkopf, and A. Smola. “A kernel ¨ two-sample test”. In: The Journal of Machine Learning Research 1 (2012).
240
+ [Gur+18] S. Gururangan, S. Swayamdipta, O. Levy, R. Schwartz, S. Bowman, and N. A. Smith. “Annotation artifacts in natural language inference data”. In: Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers). 2018.
241
+ [HLB20] W. Huang, H. Liu, and S. R. Bowman. Counterfactually-Augmented SNLI Training Data Does Not Yield Better Generalization Than Unaugmented Data. 2020. arXiv: 2010.04762 [cs.CL].
242
+ [KHL20] D. Kaushik, E. Hovy, and Z. C. Lipton. Learning the Difference that Makes a Difference with Counterfactually-Augmented Data. 2020. arXiv: 1909.12434 [cs.CL].
243
+ [Kau+21] D. Kaushik, A. Setlur, E. Hovy, and Z. C. Lipton. Explaining The Efficacy of Counterfactually Augmented Data. 2021. arXiv: 2010.02114 [cs.CL].
244
+ [KCC20] V. Kumar, A. Choudhary, and E. Cho. “Data augmentation using pre-trained transformer models”. In: Proceedings of the 2nd Workshop on Life-long Learning for Spoken Language Systems. 2020.
245
+ [Kus+17] M. J. Kusner, J. Loftus, C. Russell, and R. Silva. “Counterfactual fairness”. In: Advances in Neural Information Processing Systems. 2017.
246
+ [Loc+20] F. Locatello, B. Poole, G. Raetsch, B. Scholkopf, O. Bachem, and M. Tschannen. ¨ “Weakly-supervised disentanglement without compromises”. In: Proceedings of the 37th International Conference on Machine Learning. 2020.
247
+ [MLM19] J. Manders, T. van Laarhoven, and E. Marchiori. Adversarial Alignment of Class Prediction Uncertainties for Domain Adaptation. 2019. arXiv: 1804.04448 [stat.ML].
248
+ [Meh+19] N. Mehrabi, F. Morstatter, N. Saxena, K. Lerman, and A. Galstyan. A Survey on Bias and Fairness in Machine Learning. 2019. arXiv: 1908.09635 [cs.LG].
249
+ [Mei18] N. Meinshausen. “Causality from a distributional robustness point of view”. In: 2018 IEEE Data Science Workshop (DSW). 2018.
250
+ $[ \mathrm { M i t } + 2 0 ]$ J. Mitrovic, B. McWilliams, J. Walker, L. Buesing, and C. Blundell. Representation Learning via Invariant Causal Mechanisms. 2020. arXiv: 2010.07922 [cs.LG].
251
+ [MBS13] K. Muandet, D. Balduzzi, and B. Scholkopf. “Domain generalization via invariant fea- ¨ ture representation”. In: Proceedings of the 30th International Conference on Machine Learning. 2013.
252
+ [Nai+18] A. Naik, A. Ravichander, N. Sadeh, C. Rose, and G. Neubig. “Stress test evaluation for natural language inference”. In: Proceedings of the 27th International Conference on Computational Linguistics. 2018.
253
+ [NLM19] J. Ni, J. Li, and J. McAuley. “Justifying recommendations using distantly-labeled reviews and fined-grained aspects”. In: Empirical Methods in Natural Language Processing (EMNLP) (2019).
254
+ [PBM16] J. Peters, P. Buhlmann, and N. Meinshausen. “Causal inference by using invariant pre- ¨ diction: identification and confidence intervals”. In: Journal of the Royal Statistical Society. Series B (Statistical Methodology) 5 (2016).
255
+ $[ \mathrm { R i b } { + } 2 0 ]$ 1 M. T. Ribeiro, T. Wu, C. Guestrin, and S. Singh. “Beyond accuracy: behavioral testing of nlp models with checklist”. In: Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics. 2020.
256
+ [RPH21] A. Robey, G. J. Pappas, and H. Hassani. Model-Based Domain Generalization. 2021. arXiv: 2102.11436 [stat.ML].
257
+ $[ \mathrm { R C } \substack { + 1 8 } ]$ 1 M. Rojas-Carulla, B. Scholkopf, R. Turner, and J. Peters. “Invariant models for causal ¨ transfer learning”. In: Journal of Machine Learning Research 36 (2018).
258
+ $[ \mathrm { S a g } + 2 0 ]$ S. Sagawa, P. W. Koh, T. B. Hashimoto, and P. Liang. “Distributionally robust neural networks for group shifts: on the importance of regularization for worst-case generalization”. In: International Conference on Learning Representations. 2020.
259
+ $[ \mathrm { S c h } \cdot 1 2 ]$ B. Scholkopf, D. Janzing, J. Peters, E. Sgouritsa, K. Zhang, and J. Mooij. “On causal ¨ and anticausal learning”. In: Proceedings of the 29th International Coference on International Conference on Machine Learning. 2012.
260
+ $[ \mathrm { S c h } + 2 1 ]$ B. Scholkopf, F. Locatello, S. Bauer, N. R. Ke, N. Kalchbrenner, A. Goyal, and Y. ¨ Bengio. “Toward causal representation learning”. In: Proceedings of the IEEE 5 (2021).
261
+ [SCS19] A. Subbaswamy, B. Chen, and S. Saria. A Universal Hierarchy of Shift-Stable Distributions and the Tradeoff Between Stability and Performance. 2019. arXiv: 1905.11374 [stat.ML].
262
+ [SS18] A. Subbaswamy and S. Saria. “Counterfactual normalization: proactively addressing dataset shift and improving reliability using causal mechanisms”. In: Proceedings of the 34th Conference on Uncertainty in Artificial Intelligence (UAI), 2018. 2018.
263
+ [TAH20] D. Teney, E. Abbasnejad, and A. van den Hengel. “Learning what makes a difference from counterfactual examples and gradient supervision”. In: CoRR (2020). arXiv: 2004.09034.
264
+ [Tze+14] E. Tzeng, J. Hoffman, N. Zhang, K. Saenko, and T. Darrell. Deep Domain Confusion: Maximizing for Domain Invariance. 2014. arXiv: 1412.3474 [cs.CV].
265
+ [WZ19] J. Wei and K. Zou. “EDA: easy data augmentation techniques for boosting performance on text classification tasks”. In: Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP). 2019.
266
+ [WNB18] A. Williams, N. Nangia, and S. Bowman. “A broad-coverage challenge corpus for sentence understanding through inference”. In: Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers). 2018.
267
+ $[ \mathrm { W u } + 1 9 ]$ 1 T. Wu, M. T. Ribeiro, J. Heer, and D. Weld. “Errudite: scalable, reproducible, and testable error analysis”. In: Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics. 2019.
268
+ $[ \mathrm { W u } + 2 1 ]$ T. Wu, M. T. Ribeiro, J. Heer, and D. S. Weld. “Polyjuice: generating counterfactuals for explaining, evaluating, and improving models”. In: Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics. 2021.
269
+ [Yan+17] H. Yan, Y. Ding, P. Li, Q. Wang, Y. Xu, and W. Zuo. Mind the Class Weight Bias: Weighted Maximum Mean Discrepancy for Unsupervised Domain Adaptation. 2017. arXiv: 1705.00609 [cs.CV].
270
+ [Zha+13] K. Zhang, B. Scholkopf, K. Muandet, and Z. Wang. “Domain adaptation under target ¨ and conditional shift”. In: Proceedings of the 30th International Conference on Machine Learning. 2013.
md/train/BkJsCIcgl/BkJsCIcgl.md ADDED
@@ -0,0 +1,295 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THE PREDICTRON: END-TO-END LEARNING AND PLANNING
2
+
3
+ David Silver\*, Hado van Hasselt\*, Matteo Hessel\*, Tom Schaul\*, Arthur Guez\*, Tim Harley, Gabriel Dulac-Arnold, David Reichert, Neil Rabinowitz, Andre Barreto, Thomas Degris DeepMind, London {davidsilver,hado,mtthss,schaul,aguez}@google.com
4
+
5
+ # ABSTRACT
6
+
7
+ One of the key challenges of artificial intelligence is to learn models that are effective in the context of planning. In this document we introduce the predictron architecture. The predictron consists of a fully abstract model, represented by a Markov reward process, that can be rolled forward multiple “imagined” planning steps. Each forward pass of the predictron accumulates internal rewards and values over multiple planning depths. The predictron is trained end-to-end so as to make these accumulated values accurately approximate the true value function. We applied the predictron to procedurally generated random mazes and a simulator for the game of pool. The predictron yielded significantly more accurate predictions than conventional deep neural network architectures.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The central idea of model-based reinforcement learning is to decompose the RL problem into two subproblems: learning a model of the environment, and then planning with this model. The model is typically represented by a Markov reward process (MRP) or decision process (MDP). The planning component uses this model to evaluate and select among possible strategies. This is typically achieved by rolling forward the model to construct a value function that estimates cumulative reward. In prior work, the model is trained essentially independently of its use within the planner. As a result, the model is not well-matched with the overall objective of the agent. Prior deep reinforcement learning methods have successfully constructed models that can unroll near pixel-perfect reconstructions (Oh et al., 2015; Chiappa et al., 2016); but are yet to surpass state-of-the-art modelfree methods in challenging RL domains with raw inputs (e.g., Mnih et al., 2015; 2016; Lillicrap et al., 2016).
12
+
13
+ In this paper we introduce a new architecture, which we call the predictron, that integrates learning and planning into one end-to-end training procedure. At every step, a model is applied to an internal state, to produce a next state, reward, discount, and value estimate. This model is completely abstract and its only goal is to facilitate accurate value prediction. For example, to plan effectively in a game, an agent must be able to predict the score. If our model makes accurate predictions, then an optimal plan with respect to our model will also be an optimal plan for the underlying game – even if that model uses a different state space (e.g., an abstract representation of enemy positions, ignoring their shapes and colours), action space (e.g., a high-level action to move away from an enemy), rewards (e.g., a single abstract step could have a higher value than any real reward), or even timestep (e.g., a single abstract step could “jump” the agent to the end of a corridor). All we require is that trajectories through the abstract model produce scores that are consistent with trajectories through the real environment. This is achieved by training the predictron end-to-end, so as to make its value estimates as accurate as possible.
14
+
15
+ An ideal model could generalise to many different prediction tasks, rather than overfitting to a single task; and could learn from a rich variety of feedback signals, not just a single extrinsic reward. We therefore train the predictron to predict a host of different value functions for a variety of pseudoreward functions and discount factors. These pseudo-rewards can encode any event or aspect of the environment that the agent may care about, e.g., staying alive or reaching the next room.
16
+
17
+ We focus upon the prediction task: estimating value functions in MRP environments with uncontrolled dynamics. In this case, the predictron can be implemented as a deep neural network with an
18
+
19
+ MRP as a recurrent core. The predictron unrolls this core multiple steps and accumulates rewards into an overall estimate of value.
20
+
21
+ We applied the predictron to procedurally generated random mazes, and a simulated pool domain, directly from pixel inputs. In both cases, the predictron significantly outperformed model-free algorithms with conventional deep network architectures; and was much more robust to architectural choices such as depth.
22
+
23
+ # 2 BACKGROUND
24
+
25
+ We consider environments defined by an MRP with states $s \in S$ . The MRP is defined by a function, $s ^ { \prime } , r , \gamma = p ( s , \alpha )$ , where $s ^ { \prime }$ is the next state, $r$ is the reward, and $\gamma$ is the discount factor, which can for instance represent the non-termination probability for this transition. The process may be stochastic, given IID noise $\alpha$ .
26
+
27
+ The return of an MRP is the cumulative discounted reward over a single trajectory, $g _ { t } = r _ { t + 1 } +$ $\gamma _ { t + 1 } r _ { t + 2 } + \gamma _ { t + 1 } \gamma _ { t + 2 } r _ { t + 3 } + \ldots ,$ , where $\gamma _ { t }$ can vary per time-step. We consider a generalisation of the MRP setting that includes vector-valued rewards $\mathbf { r }$ , diagonal-matrix discounts $\gamma$ , and vector-valued returns $\mathbf { g }$ ; definitions are otherwise identical to the above. We use this bold font notation to closely match the more familiar scalar MRP case; the majority of the paper can be comfortably understood by reading all rewards as scalars, and all discount factors as scalar and constant, i.e., $\gamma _ { t } = \gamma$ .
28
+
29
+ The value function of an MRP $p$ is the expected return from state $s$ , $v _ { p } ( s ) = \mathbb { E } _ { p } \left[ \mathbf { g } _ { t } \mid s _ { t } = s \right]$ . In the vector case, these are known as general value functions (Sutton et al., 2011). We will say that a (general) value function $v ( \cdot )$ is consistent with environment $p$ if and only if $v = v _ { p }$ which satisfies the following Bellman equation (Bellman, 1957),
30
+
31
+ $$
32
+ v _ { p } ( s ) = \mathbb { E } _ { p } \left[ \mathbf { r } + \gamma v _ { p } ( s ^ { \prime } ) \mid s \right] .
33
+ $$
34
+
35
+ In model-based reinforcement learning (Sutton and Barto, 1998), an approximation $m \approx p$ to the environment is learned. In the uncontrolled setting this model is normally an MRP $s ^ { \prime } , \mathbf { r } , \gamma = m ( s , \beta )$ that maps from state $s$ to subsequent state $s ^ { \prime }$ and additionally outputs rewards $\mathbf { r }$ and discounts $\gamma$ ; the model may be stochastic given an IID source of noise $\beta$ . A (general) value function $v _ { m } ( \cdot )$ is consistent with model $m$ (or valid, (Sutton, 1995)), if and only if it satisfies a Bellman equation $v _ { m } ( s ) = \mathbb { E } _ { m } \left[ \mathbf { r } + \gamma v _ { m } ( s ^ { \prime } ) \mid s \right]$ with respect to model $m$ . Conventionally, model-based RL methods focus on finding a value function $v$ that is consistent with a separately learned model $m$ .
36
+
37
+ # 3 PREDICTRON ARCHITECTURE
38
+
39
+ The predictron is composed of four main components. First, a state representation $\mathbf { s } = f ( s )$ that encodes raw input $s$ (this could be a history of observations, in the partially observed setting, for example when $f$ is a recurrent network) into an internal (abstract, hidden) state s. Second, a model $\mathbf { s } ^ { \prime } , \mathbf { r } , \gamma = m ( \mathbf { s } , \beta )$ that maps from internal state s to subsequent internal state $\mathbf { s } ^ { \prime }$ , internal rewards $\mathbf { r }$ , and internal discounts $\gamma$ . Third, a value function $v$ that outputs internal values $\mathbf { v } = v ( \mathbf { s } )$ representing the future, internal return from internal state s onwards. The predictron is applied by unrolling its model $m$ multiple “planning” steps to produce internal rewards, discounts and values. We use superscripts $\bullet ^ { k }$ to indicate internal steps of the model (which have no necessary connection to time steps $\bullet _ { t }$ of the environment). Finally, these internal rewards, discounts and values are combined together by an accumulator into an overall estimate of value g. The whole predictron, from input state $s$ to output g, may be viewed as a value function approximator for external targets (i.e. the returns in the real environment). We consider both $k$ -step and $\lambda$ -weighted accumulators.
40
+
41
+ The $k$ -step predictron rolls its internal model forward $k$ steps. Specifically, the $k$ -step predictron return $\mathbf { g } ^ { k }$ (henceforth abbreviated as preturn) is the internal return obtained by accumulating $k$ model steps, plus a final value $\mathbf { v } ^ { k }$ from the $k$ th step,
42
+
43
+ $$
44
+ \mathbf { g } ^ { k } = \mathbf { r } ^ { 1 } + \gamma ^ { 1 } ( \mathbf { r } ^ { 2 } + \gamma ^ { 2 } ( \ldots ( \mathbf { r } ^ { k - 1 } + \gamma ^ { k - 1 } ( \mathbf { r } ^ { k } + \gamma ^ { k } \mathbf { v } ^ { k } ) ) \ldots ) ) .
45
+ $$
46
+
47
+ The 0-step preturn is simply the first value $\mathbf { g } ^ { 0 } = \mathbf { v } ^ { 0 }$ . The 1-step preturn is $\mathbf { g } ^ { 1 } = \mathbf { r } ^ { 1 } + \gamma ^ { 1 } \mathbf { v } ^ { 1 }$ , and so on (see Fig. 1a).
48
+
49
+ The $\lambda$ -predictron combines together many $k$ -step preturns. Specifically, it computes a diagonal weight matrix $\lambda ^ { k }$ from each internal state $\boldsymbol { \bar { s } } ^ { k }$ . The accumulator uses weights $\lambda ^ { 0 } , . . . , \lambda ^ { K }$ to aggregate
50
+
51
+ ![](images/6f6c0ac1ea5dd3b78bbf370494686c721ff710971f39d404ac4fa8e2eec69c6a.jpg)
52
+ Figure 1: a) The $k$ -step predictron architecture. The first three columns illustrate 0, 1 and 2-step pathways through the predictron. The 0-step preturn reduces to standard model-free value function approximation; other preturns “imagine” additional steps with an internal model. Each pathway outputs a $k \mathrm { . }$ -step preturn $\mathbf { g } ^ { k }$ that accumulates discounted rewards along with a final value estimate. In practice all $k$ -step preturns are computed in a single forward pass. b) The $\lambda$ -predictron architecture. The $\lambda$ -parameters gate between the different preturns. The output is a $\lambda$ -preturn $\mathbf { g } ^ { \lambda }$ that is a mixture over the $k$ -step preturns. For example, if $\pmb { \lambda } ^ { 0 } = \mathbf { 1 } , \pmb { \lambda } ^ { 1 } = \mathbf { 1 } , \pmb { \lambda } ^ { 2 } = \mathbf { 0 }$ then we recover the 2-step preturn, $\mathbf { g } ^ { \lambda } = \mathbf { g } ^ { 2 }$ . Discount factors $\gamma ^ { k }$ and $\lambda$ -parameters $\lambda ^ { k }$ are dependent on state $\mathbf { s } ^ { k }$ ; this dependence is not shown in the figure.
53
+
54
+ over $k$ -step preturns $\mathbf { g } ^ { 0 } , . . . , \mathbf { g } ^ { K }$ and output a combined value that we call the $\lambda$ -preturn $\mathbf { g } ^ { \lambda }$ ,
55
+
56
+ $$
57
+ \mathbf { g } ^ { \lambda } = \sum _ { k = 0 } ^ { K } w ^ { k } \mathbf { g } ^ { k } \qquad \mathrm { w h e r e } \qquad w ^ { k } = \left\{ \begin{array} { l l } { ( 1 - \lambda ^ { k } ) \prod _ { j = 0 } ^ { k - 1 } \lambda ^ { j } } & { \mathrm { i f ~ } k < K } \\ { \qquad } \\ { \prod _ { j = 0 } ^ { K - 1 } \lambda ^ { j } } & { \mathrm { o t h e r w i s e . } } \end{array} \right.
58
+ $$
59
+
60
+ where 1 is the identity matrix. This $\lambda$ -preturn is analogous to the $\lambda$ -return in the forward-view $\mathrm { T D } ( \lambda )$ algorithm (Sutton, 1988; Sutton and Barto, 1998). It may also be computed by a backward accumulation through intermediate steps $\mathbf { g } ^ { k , \lambda }$ ,
61
+
62
+ $$
63
+ \mathbf { g } ^ { k , \lambda } = ( \mathbf { 1 } - \lambda ^ { k } ) \mathbf { v } ^ { k } + \lambda ^ { k } \left( \mathbf { r } ^ { k + 1 } + \gamma ^ { k + 1 } \mathbf { g } ^ { k + 1 , \lambda } \right) ,
64
+ $$
65
+
66
+ where $\mathbf { g } ^ { K , \lambda } = \mathbf { v } ^ { K }$ , and then using $\mathbf { g } ^ { \lambda } = \mathbf { g } ^ { 0 , \lambda }$ . Computation in the $\lambda$ -predictron operates in a sweep, iterating first through the model from $k = 0 \ldots K$ and then back through the accumulator from $k = K \ldots 0$ in a single “forward” pass of the network (see Figure 1b). Each $\lambda ^ { k }$ weight acts as a gate on the computation of the $\lambda$ -preturn: a value of $\lambda ^ { k } = 0$ will truncate the $\lambda$ -preturn at layer $k$ , while a value of $\mathbf { \hat { \lambda } } \mathbf { \lambda } ^ { k } = \mathbf { 1 }$ will utilise deeper layers based on additional steps of the model $m$ ; the final weight is always $\pmb { \lambda } ^ { K } = \mathbf { 0 }$ . The individual $\dot { \lambda } ^ { k }$ weights may depend on the corresponding abstract state $\mathbf { s } ^ { k }$ and can differ per prediction. This enables the predictron to compute to an adaptive depth (Graves, 2016) depending on the internal state and learning dynamics of the network.
67
+
68
+ # 4 PREDICTRON LEARNING UPDATES
69
+
70
+ We first consider updates that optimise the joint parameters $\pmb { \theta }$ of the state representation, model, and value function. We begin with the $k$ -step predictron. We update the $k$ -step predictron $\mathbf { g } ^ { k }$ towards a target outcome $\mathbf { g }$ , such as the Monte-Carlo return from the real environment, by minimising a mean-squared error loss,
71
+
72
+ $$
73
+ L ^ { k } = { \frac { 1 } { 2 } } \left\| \mathbb { E } _ { p } \left[ \mathbf { g } \mid s \right] - \mathbb { E } _ { m } \left[ \mathbf { g } ^ { k } \mid s \right] \right\| ^ { 2 } . \qquad { \frac { \partial l ^ { k } } { \partial \theta } } = \left( \mathbf { g } - \mathbf { g } ^ { k } \right) { \frac { \partial \mathbf { g } ^ { k } } { \partial \theta } } .
74
+ $$
75
+
76
+ where $l ^ { k } = \textstyle { \frac { 1 } { 2 } } \left\| \mathbf { g } - \mathbf { g } ^ { k } \right\| ^ { 2 }$ is the sample loss. We can use the gradient of the sample loss to update parameters, e.g. by stochastic gradient descent. For stochastic models, two independent samples are required for $\mathbf { g } ^ { k }$ and ∂ g k to get unbiased samples for the gradient of $L ^ { k }$ .
77
+
78
+ The $\lambda$ -predictron combines together many $k$ -step preturns. To update the joint parameters $\pmb \theta$ , we can uniformly average the losses on the individual preturns $\mathbf { g } ^ { k }$ ,
79
+
80
+ $$
81
+ L ^ { 0 : K } = \frac { 1 } { 2 K } \sum _ { k = 0 } ^ { K } \left\| \mathbb { E } _ { p } \left[ \mathbf { g } \mid s \right] - \mathbb { E } _ { m } \left[ \mathbf { g } ^ { k } \mid s \right] \right\| ^ { 2 } , \qquad \frac { \partial l ^ { 0 : K } } { \partial \theta } = \frac { 1 } { K } \sum _ { k = 0 } ^ { K } \left( \mathbf { g } - \mathbf { g } ^ { k } \right) \frac { \partial \mathbf { g } ^ { k } } { \partial \theta } .
82
+ $$
83
+
84
+ Alternative, we could weight each loss by the usage $\boldsymbol { w } ^ { k }$ of the corresponding preturn, such that the gradient is $\begin{array} { r } { \sum _ { k = 0 } ^ { K } \pmb { w } ^ { k } \left( \mathbf { g } - \mathbf { g } ^ { k } \right) \frac { \partial \mathbf { g } ^ { k } } { \partial \pmb { \theta } } } \end{array}$  ∂ g k∂ θ .
85
+
86
+ The $\lambda$ -predictron uses an accumulator with additional parameters $\eta$ that determine the relative weighting of the $k$ -step preturns. These weights are also updated so as to minimise a mean-squared error loss $L ^ { \lambda }$ ,
87
+
88
+ $$
89
+ L ^ { \lambda } = \frac { 1 } { 2 } \left\| \mathbb { E } _ { p } \left[ \mathbf { g } \mid s \right] - \mathbb { E } _ { m } \left[ \mathbf { g } ^ { \lambda } \mid s \right] \right\| ^ { 2 } , \qquad \frac { \partial l ^ { \lambda } } { \partial \eta } = \left( \mathbf { g } - \mathbf { g } ^ { \lambda } \right) \frac { \partial \mathbf { g } ^ { \lambda } } { \partial \eta } .
90
+ $$
91
+
92
+ In summary, the joint parameters $\pmb \theta$ of the state representation $f$ , the model $m$ , and the value function $v$ are updated to make each of the $k$ -step preturns $\mathbf { g } ^ { k }$ more similar to the target $\mathbf { g }$ , and the parameters $\eta$ of the $\lambda$ -accumulator are updated to make the aggregate $\lambda$ -preturn $\mathbf { g } ^ { \lambda }$ more similar to the target g.
93
+
94
+ # 4.1 CONSISTENCY (SEMI-SUPERVISED) LEARNING WITH THE $\lambda$ -PREDICTRON
95
+
96
+ Ideally, the predictron $( f , m , v )$ learns preturns that are all equal in expectation to the true value function of the environment, $\mathbb { E } _ { m } \left[ \mathbf { g } ^ { k } \mid s \right] = \mathbb { E } _ { p } \left[ \mathbf { g } _ { t } \mid s \right] = v _ { p } ( s )$ , in which case the preturns must be equal in expectation, $\mathbb { E } _ { m } \left[ \mathbf { g } ^ { 0 } \mid s \right] = \mathbb { E } _ { m } \left[ \mathbf { g } ^ { 1 } \mid s \right] = \ldots = \mathbb { E } _ { m } \left[ \mathbf { g } ^ { K } \mid s \right]$ . In addition, each $k$ -step preturn must then be equal in expectation to th $: \lambda - p$ return, $\mathbb { E } _ { m } \left[ \mathbf { \bar { g } } ^ { k } \mid s \right] \mathbf { \bar { \Lambda } } = \mathbb { E } _ { m } \left[ \mathbf { g } ^ { \lambda } \mid s \right]$ , for any $\lambda$ parameters. All these consistency relations between preturns give rise to additional constraints upon the predictron. Specifically, we may adjust the parameters of the predictron to lead to consistent preturns, even in the absence of labelled targets.
97
+
98
+ Concretely, we can adjust each preturn $\mathbf { g } ^ { k }$ towards the $\lambda$ -preturn $\mathbf { g } ^ { \lambda }$ ; in other words, we can update each individual value estimate towards the best aggregated estimate by minimizing
99
+
100
+ $$
101
+ L = \frac { 1 } { 2 } \sum _ { k = 0 } ^ { K } \left\| \mathbb { E } _ { m } \left[ \mathbf { g } ^ { \lambda } \mid s \right] - \mathbb { E } _ { m } \left[ \mathbf { g } ^ { k } \mid s \right] \right\| ^ { 2 } , \qquad \quad \quad \frac { \partial l } { \partial \theta } = \sum _ { k = 0 } ^ { K } \left( \mathbf { g } ^ { \lambda } - \mathbf { g } ^ { k } \right) \frac { \partial \mathbf { g } ^ { k } } { \partial \theta } .
102
+ $$
103
+
104
+ Here $\mathbf { g } ^ { \lambda }$ is considered fixed; the parameters $\pmb \theta$ are only updated to make $\mathbf { g } ^ { k }$ more similar to $\mathbf { g } ^ { \lambda }$ , not vice versa. This consistency update does not require any labels $\mathbf { g }$ or samples from the environment. As a result, it can be applied to (potentially hypothetical) states that have no associated ‘real’ (e.g. Monte-Carlo) outcome: we update the value estimates to be self-consistent with each other. Note the similarity with the semi-supervised setting, where we may have unlabelled inputs.
105
+
106
+ # 5 EXPERIMENTS
107
+
108
+ We conducted experiments on two domains. The first domain consists of randomly generated $2 0 \times 2 0$ mazes in which each location either is empty or contains a wall. Two locations in a maze are considered connected if they are both empty and we can reach one from the other by moving horizontally or vertically through adjacent empty cells. The goal is to predict, for each of the locations on the diagonal from top-left to bottom-right of the maze, whether the bottom-right corner is connected to that location, given the entire maze as an input image. Some of these predictions will be straightforward, for instance for locations on the diagonal that contain a wall themselves and for locations close to the bottom right. Many other predictive questions seem to require a simple algorithm, such as some form of a flood fill or search; our hypothesis is that an internal model can learn to emulate such algorithms, where naive approximation may struggle. A few example mazes are shown in Figure 2.
109
+
110
+ Our second domain is a simulation of the game of pool, using four balls and four pockets. The simulator is implemented in the physics engine Mujoco (Todorov et al., 2012). We generate sequences of RGB frames starting from a random arrangement of balls on the table. The goal is to simultaneously learn to predict future events for each of the four balls, given 5 RGB frames as input. These events include: collision with any other ball, collision with any boundary of the table, entering a quadrant $\times 4$ , for each quadrant), being located in a quadrant $\times 4$ , for each quadrant), and entering a pocket $( \times 4$ , for each pocket). Each of these $1 4 \times 4$ events provides a binary pseudo-reward that we combine with 5 different discount factors $\{ 0 , 0 . 5 , 0 . 9 , 0 . 9 8 , 1 \}$ and predict their cumulative discounted sum over various time spans. This yields a total of 280 general value functions. An example trajectory is shown in Figure 2. In both domains, inputs are presented as minibatches of i.i.d. samples with their regression targets. Additional domain details are provided in Appendix E.
111
+
112
+ ![](images/8a31c76eabf685b5e20aa0765cb76bf5f66494f925957476c5705091f578ef29.jpg)
113
+ Figure 2: Left: Two sample mazes from the random-maze domain. Light blue cells are empty, darker blue cells contain a wall. One maze is connected from top-left to bottom-right (indicated in black), the other is not. Right: An example trajectory in the pool domain (before downsampling). It was selected by maximising the prediction of pocketing balls, using the predictron.
114
+
115
+ ![](images/e602264f049e19e6be76364d251d62f7e9f44ac88523eb8c4214db23eff3de07.jpg)
116
+ Figure 3: Exploring predictron variants. Aggregated prediction errors over all predictions (20 for mazes, 280 for pool) for the eight predictron variants corresponding to the cube on the left (as described in the main text), for both random mazes (top) and pool (bottom). Each line is the median of RMSE over five seeds; shaded regions encompass all seeds. The full $( r , \gamma , \lambda )$ -prediction (red) consistently performed best.
117
+
118
+ # 5.1 EXPLORING THE PREDICTRON ARCHITECTURE
119
+
120
+ Our first set of experiments examines three binary dimensions that differentiate the predictron from standard deep networks. We compare eight predictron variants corresponding to the corners of the cube on the left in Figure 3.
121
+
122
+ The first dimension corresponds to whether or not the predictron architecture utilises the structure of an MRP model. In the MRP case, labelled $r , \gamma$ , internal rewards and discounts are both learned. In the non- $r$ , $\gamma$ case, which corresponds to a vanilla hidden-to-hidden neural network module, internal rewards and discounts are ignored by fixing their values to $\mathbf { r } ^ { k } = \mathbf { 0 }$ and $\gamma ^ { k } = \mathbf { 1 }$ .
123
+
124
+ The second dimension is whether a $K$ -step accumulator or $\lambda$ -accumulator is used to aggregate over preturns. When a $\lambda$ -accumulator is used, a $\lambda$ -preturn is computed as described in Section 3. Otherwise, intermediate preturns are ignored by fixing their values to $\lambda ^ { k } = 1$ for $k < K$ . In this case, the overall output of the predictron is simply the maximum-depth preturn $\mathbf { g } ^ { K }$ .
125
+
126
+ The third dimension, labelled usage weighting, defines the loss that is used to update the parameters $\pmb \theta$ . On this dimension, we consider two options: the preturn losses can either be weighted uniformly (see Equation 6), or the update for each preturn $\mathbf { g } ^ { k }$ can be weighted according to the weight $\boldsymbol { w } ^ { k }$ that determines how much it is used in the $\lambda$ -predictron’s overall output. We call the latter loss ‘usage weighted‘. Note that for architectures without a $\lambda$ -accumulator, $\bar { \boldsymbol { w } } ^ { k } = 0$ for $k < K$ , and $\mathbf { \Delta } w ^ { K } = \mathbf { \bar { \mu } }$ , thus usage weighting then implies backpropagating only the loss on the final preturn $\mathbf { g } ^ { K }$ .
127
+
128
+ All variants utilise a convolutional core with 2 intermediate hidden layers (see Appendix A); parameters were updated by supervised learning (see Appendix $\mathbf { B }$ for more details). Root mean squared prediction errors for each architecture, aggregated over all predictions, are shown in Figure 3. The top row corresponds to the random mazes and the bottom row to the pool domain. The main conclusion is that learning an MRP model improved performance greatly. The inclusion of $\lambda$ weights helped as well, especially on pool. Usage weighting further improved performance.
129
+
130
+ ![](images/dba61ef00d493777d067bc381985a11c743383fcb9df81dc1d0a496239d6428e.jpg)
131
+ Figure 4: Comparing predictron to baselines. Aggregated prediction errors on random mazes (top) and pool (bottom) over all predictions for the eight architectures corresponding to the cube on the left. Each line is the median of RMSE over five seeds; shaded regions encompass all seeds. The full $( r , \gamma , \lambda )$ -predictron (red), consistently outperformed conventional deep network architectures (black), with and without skips and with and without weight sharing.
132
+
133
+ # 5.2 COMPARING THE PREDICTRON TO OTHER DEEP NETWORKS
134
+
135
+ Our second set of experiments compares the predictron to feedforward and recurrent deep learning architectures, with and without skip connections. We compare the corners of a new cube, as depicted on the left in Figure 4, based on three different binary dimensions.
136
+
137
+ The first dimension of this second cube is whether we use a predictron, or a (non- $\boldsymbol { \cdot } \lambda$ , non- $\cdot r , \gamma$ ) deep network that does not have an internal model and does not output or learn from intermediate predictions. We use the most effective predictron from the previous section, i.e., the $( r , \gamma , \lambda )$ -predictron with usage weighting.
138
+
139
+ The second dimension is whether weights are shared between all cores (as in a recurrent network), or whether each core uses separate weights (as in a feedforward network). We note that the non$\lambda$ , non- $\cdot r , \gamma$ variants of the predictron then correspond to standard (convolutional) feedforward and (unrolled) recurrent neural networks respectively.
140
+
141
+ The third dimension is whether we include skip connections. This is equivalent to defining the model step to output a change to the current state, $\Delta \mathbf { s } .$ , and then defining $\mathbf { s } ^ { \hat { k } + 1 } = h ( \mathbf { s } ^ { k } + \Delta \mathbf { s } ^ { \tilde { k } } )$ , where $h$ is the non-linear function—in our case a ReLU, $h ( x ) = \operatorname* { m a x } ( \bar { 0 , x } )$ . The deep network with skip connections is a variant of ResNet (He et al., 2015).
142
+
143
+ Root mean squared prediction errors for each architecture are shown in Figure 4. All $( r , \gamma , \lambda )$ - predictrons (red lines) outperformed the corresponding feedforward or recurrent neural network baselines (black lines) both in the random mazes and in pool. We also investigated the effect of changing the depth of the networks (see Appendix C). The predictron outperformed the corresponding feedforward or recurrent baselines for all depths, with and without skip connections.
144
+
145
+ # 5.3 SEMI-SUPERVISED LEARNING BY CONSISTENCY
146
+
147
+ We now consider how to use the predictron for semi-supervised learning, training the model on a combination of labelled and unlabelled random mazes. Semi-supervised learning is important because a common bottleneck in applying machine learning in the real world is the difficulty of collecting labelled data, whereas often large quantities of unlabelled data exist.
148
+
149
+ We trained a full $( r , \gamma , \lambda )$ -predictron by alternating standard supervised updates with consistency updates, obtained by stochastically minimizing the consistency loss (8), on the unlabelled samples. For each supervised update we apply either 0, 1, or 9 consistency updates. Figure 5 shows that the performance improved monotonically with the number of consistency updates, measured as a function of the number of labelled samples consumed.
150
+
151
+ ![](images/a6a297ad344d3d9b89961b40f0a239cf9bf15e8964e2525c883b866251e3e396.jpg)
152
+ Figure 5: Semi-supervised learning. Prediction errors of the $( r , \gamma , \lambda )$ -predictrons (shared core, no skips) using 0, 1, or 9 consistency updates for every update with labelled data, plotted as function of the number of labels consumed. Learning performance improves with more consistency updates.
153
+
154
+ # 5.4 ANALYSIS OF ADAPTIVE DEPTH
155
+
156
+ In principle, the predictron can adapt its depth to ‘think more’ about some predictions than others, perhaps depending on the complexity of the underlying target. We investigate this by looking at qualitatively different prediction types in pool: ball collisions, rail collisions, pocketing balls, and entering or staying in quadrants. For each prediction type we consider several different time-spans (determined by the real-world discount factors associated with each pseudo-reward). Figure 6 shows distributions of depth for each type of prediction. The ‘depth’ of a predictron is here defined as the effective number of model steps. If the predictron relies fully on the very first value (i.e., $\lambda ^ { 0 } = 0$ ), this counts as 0 steps. If, instead, it learns to place equal weight on all rewards and on the final value, this counts as 16 steps. Concretely, the depth $^ d$ can be defined recursively as $\pmb { d } = \pmb { d } ^ { 0 }$ where $\pmb { d } ^ { k } = \lambda ^ { k } ( 1 + \gamma ^ { k } \pmb { d } ^ { k + 1 } )$ and $\mathbf { { \mathbf { { \mathbf { { \mathbf { { \mathbf { \alpha } } } } } } } } } \mathbf { { \mathbf { { \mathbf { { d } } } } } } ^ { K } = \mathbf { { \mathbf { 0 } } }$ . Note that even for the same input state, each prediction has a separate depth.
157
+
158
+ The depth distributions exhibit three properties. First, different types of predictions used different depths. Second, depth was correlated with the real-world discount for the first four prediction types. Third, the distributions are not strongly peaked, which implies that the depth can differ per input even for a single real-world discount and prediction type. In a control experiment (not shown) we used a scalar $\lambda$ shared among all predictions, which reduced performance in all scenarios, indicating that the heterogeneous depth is a valuable form of flexibility.
159
+
160
+ # 5.5 VISUALIZING THE PREDICTIONS IN THE POOL DOMAIN
161
+
162
+ We test the quality of the predictions in the pool domain to evaluate whether they are well-suited to making decisions. For each sampled pool position, we consider a set $I$ of different initial conditions (different angles and velocity of the white ball), and ask which is more likely to lead to pocketing coloured balls. For each initial condition $s \in I$ , we apply the $( r , \gamma , \lambda )$ -predictron (shared cores, 16 model steps, no skip connections) to obtain predictions $\mathbf { g } ^ { \lambda }$ . We sum the predictions that correspond to pocketing any ball except the white ball, and to real-world discounts $\gamma = 0 . 9 8$ and $\gamma = 1$ . We select the condition $s ^ { * }$ that maximises this sum.
163
+
164
+ ![](images/9e5eda1ba0817010e3a899cfcd39b4555fece7632765839f1302bb06efcfea60.jpg)
165
+ Figure 6: Thinking depth. Distributions of thinking depth on pool for different types of predictions and for different real-world discounts.
166
+
167
+ We then roll forward the pool simulator from $s ^ { * }$ and log the number of pocketing events. Figure 2 shows a sampled rollout, using the predictron to pick $s ^ { * }$ . When providing the choice of 128 angles and two velocities for initial conditions $\left. \vert I \right. = 2 5 6 )$ , this procedure resulted in pocketing 27 coloured balls in 50 episodes. Using the same procedure with an equally deep convolutional network only resulted in 10 pocketing events. These results suggest that the lower loss of the learned $( r , \gamma , \lambda )$ -predictron translated into meaningful improvements when informing decisions. A video of the rollouts selected by the predictron is available here: https://youtu.be/BeaLdaN2C3Q.
168
+
169
+ # 6 RELATED WORK
170
+
171
+ Lee et al. (2015) introduced a neural network architecture where classifications branch off intermediate hidden layers. An important difference with respect to the $\lambda$ -predictron, is that the weights are hand-tuned as hyper-parameters, whereas in the predictron the $\lambda$ weights are learnt and, more importantly, conditional on the input. Another difference is that the loss on the auxiliary classifications is used to speed up learning, but the classifications themselves are not combined into an aggregate prediction; the output of the model itself is the deepest prediction.
172
+
173
+ Graves (2016) introduced an architecture with adaptive computation time (ACT), with a discrete (but differentiable) decision on when to halt, and aggregating over the outputs at each pondering step. This is related to our $\lambda$ weights, but obtains depth in a different way; one notable difference is that the $\lambda$ -predictron can choose different pondering depths for each of its predictions.
174
+
175
+ Value iteration networks (VINs) (Tamar et al., 2016) also learn value functions end-to-end using an internal model, similar to the (non- $\lambda$ ) predictron. However, VINs plan via convolutional operations over the full input state space; whereas the predictron plans via imagined trajectories through an abstract state space. This may allow the predictron architecture to scale much more effectively in domains that do not have a natural two-dimensional encoding of the state space.
176
+
177
+ The notion of learning about many predictions of the future relates to work on predictive state representations (PSRs; Littman et al., 2001), general value functions (GVFs; Sutton et al., 2011), and nexting (Modayil et al., 2012). Such predictions have been shown to be useful as representations (Schaul and Ring, 2013) and for transfer (Schaul et al., 2015). So far, however, none of these have been considered for learning abstract models.
178
+
179
+ Schmidhuber (2015) discusses learning abstract models, but maintains separate losses for the model and a controller, and suggests training the model unsupervised to compactly encode the entire history of observations, through predictive coding. The predictron’s abstract model is instead trained endto-end to obtain accurate values.
180
+
181
+ # 7 CONCLUSION
182
+
183
+ The predictron is a single differentiable architecture that rolls forward an internal model to estimate external values. This internal model may be given both the structure and the semantics of traditional reinforcement learning models. But unlike most approaches to model-based reinforcement learning, the model is fully abstract: it need not correspond to the real environment in any human understandable fashion, so long as its rolled-forward “plans” accurately predict outcomes in the true environment.
184
+
185
+ The predictron may be viewed as a novel network architecture that incorporates several separable ideas. First, the predictron outputs a value by accumulating rewards over a series of internal planning steps. Second, each forward pass of the predictron outputs values at multiple planning depths. Third, these values may be combined together, also within a single forward pass, to output an overall ensemble value. Finally, the different values output by the predictron may be encouraged to be self-consistent with each other, to provide an additional signal during learning. Our experiments demonstrate that these differences result in more accurate predictions of value, in reinforcement learning environments, than more conventional network architectures.
186
+
187
+ We have focused on value prediction tasks in uncontrolled environments. However, these ideas may transfer to the control setting, for example by using the predictron as a Q-network (Mnih et al., 2015). Even more intriguing is the possibility of learning an internal MDP with abstract internal actions, rather than the MRP considered in this paper. We aim to explore these ideas in future work.
188
+
189
+ # REFERENCES
190
+
191
+ R. Bellman. Dynamic programming. Princeton University Press, 1957.
192
+
193
+ S. Chiappa, S. Racaniere, D. Wierstra, and S. Mohamed. Recurrent environment simulators. 2016.
194
+
195
+ X. Glorot, A. Bordes, and Y. Bengio. Deep sparse rectifier neural networks. In Aistats, volume 15, page 275, 2011.
196
+
197
+ A. Graves. Adaptive computation time for recurrent neural networks. CoRR, abs/1603.08983, 2016. URL http://arxiv.org/abs/1603.08983.
198
+
199
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015.
200
+
201
+ S. Ioffe and C. Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
202
+
203
+ D. P. Kingma and J. Ba. A method for stochastic optimization. In International Conference on Learning Representation, 2015.
204
+
205
+ Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
206
+
207
+ C.-Y. Lee, S. Xie, P. Gallagher, Z. Zhang, and Z. Tu. Deeply-supervised nets. In AISTATS, volume 2, page 6, 2015.
208
+
209
+ T. Lillicrap, J. Hunt, A. Pritzel, N. Heess, T. Erez, Y. Tassa, D. Silver, and D. Wierstra. Continuous control with deep reinforcement learning. In ICLR, 2016.
210
+
211
+ M. L. Littman, R. S. Sutton, and S. P. Singh. Predictive representations of state. In NIPS, volume 14, pages 1555–1561, 2001.
212
+
213
+ V. Mnih, K. Kavukcuoglu, D. Silver, A. A. Rusu, J. Veness, M. G. Bellemare, A. Graves, M. Riedmiller, A. K. Fidjeland, G. Ostrovski, S. Petersen, C. Beattie, A. Sadik, I. Antonoglou, H. King, D. Kumaran, D. Wierstra, S. Legg, and D. Hassabis. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
214
+
215
+ V. Mnih, A. P. Badia, M. Mirza, A. Graves, T. Lillicrap, T. Harley, D. Silver, and K. Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, 2016.
216
+
217
+ J. Modayil, A. White, and R. S. Sutton. Multi-timescale nexting in a reinforcement learning robot. In International Conference on Simulation of Adaptive Behavior, pages 299–309. Springer, 2012.
218
+
219
+ J. Oh, X. Guo, H. Lee, R. L. Lewis, and S. Singh. Action-conditional video prediction using deep networks in atari games. In Advances in Neural Information Processing Systems, pages 2863– 2871, 2015.
220
+
221
+ T. Schaul and M. B. Ring. Better Generalization with Forecasts. In Proceedings of the International Joint Conference on Artificial Intelligence (IJCAI), Beijing, China, 2013.
222
+
223
+ T. Schaul, D. Horgan, K. Gregor, and D. Silver. Universal Value Function Approximators. In International Conference on Machine Learning (ICML), 2015.
224
+
225
+ J. Schmidhuber. On learning to think: Algorithmic information theory for novel combinations of reinforcement learning controllers and recurrent neural world models. arXiv preprint arXiv:1511.09249, 2015.
226
+
227
+ R. S. Sutton. Learning to predict by the methods of temporal differences. Machine Learning, 3: 9–44, 1988.
228
+
229
+ R. S. Sutton. TD models: Modeling the world at a mixture of time scales. In Proceedings of the Twelfth International Conference on Machine Learning, pages 531–539, 1995.
230
+
231
+ R. S. Sutton and A. G. Barto. Reinforcement Learning: An Introduction. The MIT press, Cambridge MA, 1998.
232
+
233
+ R. S. Sutton, J. Modayil, M. Delp, T. Degris, P. M. Pilarski, A. White, and D. Precup. Horde: A scalable real-time architecture for learning knowledge from unsupervised sensorimotor interaction. In The 10th International Conference on Autonomous Agents and Multiagent Systems-Volume 2, pages 761–768. International Foundation for Autonomous Agents and Multiagent Systems, 2011.
234
+
235
+ A. Tamar, Y. Wu, G. Thomas, S. Levine, and P. Abbeel. Value iteration networks. In Neural Information Processing Systems (NIPS), 2016.
236
+
237
+ E. Todorov, T. Erez, and Y. Tassa. Mujoco: A physics engine for model-based control. In 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pages 5026–5033. IEEE, 2012.
238
+
239
+ ![](images/470c195ad3d74763aaa60fca5f7047608345478b942bb4154c2bfe8bc163ff2a.jpg)
240
+ Figure 7: The predictron core used in our experiments.
241
+
242
+ # A ARCHITECTURE
243
+
244
+ The state representation $f$ is a two-layer convolutional neural network (LeCun et al., 1998). There is a core $c$ , again based on convolutions, that combines both MRP model and $\lambda$ -network into a single repeatable module, such that $\mathbf { s } ^ { k + 1 } , \mathbf { r } ^ { k + 1 } , \gamma ^ { k + 1 } , \lambda ^ { k } = c ( \mathbf { s } ^ { k } )$ . This core is deterministic, and is duplicated $K$ times in the predictron with shared weights. (The predictron with unshared weights has $K$ distinct cores.) Finally, the value network $v$ is a fully connected neural network that computes $\mathbf { v } ^ { k } = v ( \mathbf { s } ^ { k } )$ .
245
+
246
+ Concretely, the core (Figure 7) consists first of a convolutional layer that maps into an intermediate (hidden) layer. From this layer, another two convolutions compute the next abstract state of the predictron. Additionally, this same hidden layer is flattened and fed into three separate networks, with two fully connected layers each. The outputs of these three networks represent the internal rewards, discounts, and lambdas. A similar small network also hangs off the internal states, in addition to the core, and computes the values. All convolutions use $3 \times 3$ filters and a stride of one, and use padding to retain the size of the feature maps. All feature maps have 32 channels. The hidden layers within the MLPs have 32 hidden units.
247
+
248
+ In Figure 7 the convolutional layers are schematically drawn with three channels, flattening is represented by curly brakets, while the arrows represent the small multi-layer perceptrons which compute values, rewards, discounts and lambdas.
249
+
250
+ We allow up to 16 model steps in our experiments, resulting in 52-layer deep networks—two convolutional layers for the state representations, $3 \times 1 6 = 4 8$ convolutional layers for the core steps, and two fully-connected layers for the values on top of the final state. Between each two layers we apply batch normalization (Ioffe and Szegedy, 2015) followed by a ReLU non-linearity (Glorot et al., 2011). The value and reward networks end with a linear layer, whereas the discount and $\lambda$ -networks additionally add a sigmoid non-linearity to ensure that these quantities are in $[ 0 , 1 ]$ .
251
+
252
+ # B TRAINING
253
+
254
+ All experiments used the supervised (Monte-Carlo) update described in Section 4 except for the semi-supervised experiment which used the consistency update described in Section 4.1. We update all parameters by applying the Adam optimiser (Kingma and Ba, 2015) to stochastic gradients of the corresponding loss functions. Each return is normalised by dividing it by its standard deviation (as measured, prior to the experiment, on a set of 20,000 episodes). In all experiments, the learning rate was 0.001, and the other parameters of the Adam optimiser were $\beta _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 9 9$ , and $\epsilon = 1 0 ^ { - 8 }$ . We used mini-batches of 100 samples.
255
+
256
+ # C COMPARING ARCHITECTURES OF DIFFERENT DEPTHS
257
+
258
+ We investigated the effect of changing the depth of the networks, with and without skip connections. Figure 8 in shows that skip connections (dashed lines) make the conventional architectures
259
+
260
+ ![](images/b6658dee23cb96957d5c8447b1e18b5490b5e092b78dedcaac61ba8d741f03c4.jpg)
261
+ Figure 8: Comparing depths. Comparing the $( r , \gamma , \lambda )$ -predictron (red) against more conventional deep networks (black) for various depths (2, 4, 8, or 16 model steps, corresponding to 10, 16, 28, or 52 total layers of depth). Lighter colours correspond to shallower networks. Dashed lines correspond to networks with skip connections.
262
+
263
+ (black/grey lines) more robust to the depth (i.e., the black/grey dashed lines almost overlap, especially on pool), and that the predictron outperforms the corresponding feedforward or recurrent baselines for all depths, with and without skips.
264
+
265
+ # D CAPACITY COMPARISONS
266
+
267
+ In this section, we present some additional experiments comparing the predictron to more conventional deep networks. The purposes of these experiments are 1) to show that the conclusions obtained above do not depend on the precise architecture used, and 2) to show that the structure of the network—whether we use a predictron or not—is more important than the raw number of parameters.
268
+
269
+ Specifically, we again consider the same 20 by 20 random mazes, and the pool task described in the main text. As described in Section A, for the results in the paper we used an encoder that preserved the size of the input plans, $2 0 \times 2 0$ for the mazes and $2 8 \times 2 8$ for pool. Each convolution had 32 channels and therefore the abstract states were $2 0 \times 2 0 \times 3 2$ for the mazes and $2 8 \times 2 8 \times 3 2$ for pool.
270
+
271
+ We now consider a different architecture, where we no longer pad the convolutions used in the encoder. For the mazes, we still use two layers of $3 \times 3$ stride-1 convolutions, which means the planes reduce in size to $1 6 \times 1 6$ . This means that the abstract states are about one third smaller. For pool, we use three $5 \times 5$ stride-1 convolutions, which bring us from $2 8 \times 2 8$ down to $1 6 \times 1 6$ as well. So, the abstract states are now of equal size for both experiments. For pool, this is approximately a two-thirds reduction, which helps reduce the compute needed to run the model.
272
+
273
+ Most of the parameters in the predictron are in the fully connected layers. Previously, the first fully connected layer for each of the internal values, rewards, discounts, and $\lambda$ -parameters would take a flattened abstract state, and then go into 32 hidden nodes. This means the number of parameters in this layer were $2 0 \times 2 0 \times 3 2 \times 3 2 = 4 0 9 , 6$ 00 for the mazes and $2 8 \times 2 8 \times 3 2 \times 3 2 = 8 0 2 , 8 1$ 6 for pool. The predictron with shared core would have four of these layers, one for each of the internal values, rewards, discounts, and $\lambda s$ , compared to one for the deep network which only has values. We change this in two ways. First, we add a $1 \times 1$ convolution with a stride of 1 and 8 channels before the first fully connected layer for each of these outputs. This reduces the number of channels, and therefore the number of parameters in the subsequent fully-connected layer, by one fourth. Second, we tested three different numbers of hidden nodes: 32, 128, or 512.
274
+
275
+ ![](images/93fd02c8270d80a1af3e7ef67faee6943d3152147776544fec0ca60f183fb98d.jpg)
276
+ Figure 9: Comparing depths. Comparing the $( r , \gamma , \lambda )$ -predictron (red) against more conventional deep networks (blue) for different numbers hidden nodes in the fully connected layers, and therefore different total numbers of parameters. The deep networks with 32, 128, and 512 nodes respectively have 381,416, 1,275,752, and 4,853,096 parameters in total. The predictrons with 32 and 128 nodes respectively have 1,275,752, and 4,853,096 parameters in total. Note that the number of parameters for the 32 and 128 node predictrons are exactly equal to the number of parameters for the 128 and 512 node deep networks.
277
+
278
+ The deep network with 128 hidden nodes for its values has the exact same number of parameters as the $( r , \gamma , \lambda )$ -predictron with 32 hidden nodes for each of its outputs. Before, the deep network had fewer parameters, because we kept this number fixed at 32 across experiments. This opens the question of whether the improved performance of the predictron was not just an artifact of having more parameters. We tested this hypothesis, and the results are shown in Figure 9.
279
+
280
+ Figure 9 shows that in each setting—on the mazes and pool, and with or without shared cores— both. The predictrons always performed better than all the deep networks. This includes the 32 node predictron (darkest red) compared to the 512 node deep network (lightest blue), even though the latter has approximately 4 times as many parameters (1.27M vs 4.85M). This means that the number of parameters mattered less than whether or not we use a predictron.
281
+
282
+ # E ADDITIONAL DOMAIN DETAILS
283
+
284
+ We now provide some additional details of domains.
285
+
286
+ # E.1 POOL
287
+
288
+ To generate sequences in the Pool domain, the initial locations of 4 balls of different colours are sampled at random. The white ball is the only one moving initially. Its velocity has a norm sampled uniformly between 7 and 14. The initial angle is sampled uniformly in the range $( 0 , 2 \pi )$ . From the initial condition, the Mujoco simulation is run forward until all balls have stopped moving; sequences that last more than 151 frames are rejected, and a new one is generated as replacement. Each frame is rendered by Mujoco as a $2 8 0 \mathbf { x } 2 8 0$ RGB image, and subsequently downsampled through bilinear interpolation to a 28x28 RGB input (see Figure 10 for an example). Since the 280 signals described in Section 6.1 as targets for the Pool experiments have very different levels of sparsity, resulting in values with very different scales, we have normalised the pseudo returns. The normalization procedure consisted in dividing all targets by their standard deviation, as empirically measured across an initial set of 20,000 sequences.
289
+
290
+ ![](images/5d383c73a965d3d3933c82e67191cd7d3082ff03872892bee902b7940be8a77b.jpg)
291
+ Figure 10: Pool input frame. An example of a $2 8 \mathbf { x } 2 8$ RGB input frame in the pool domain.
292
+
293
+ # E.2 RANDOM MAZES
294
+
295
+ To generate mazes we first determine, with a stochastic line search, a number of walls so that the topleft corner is connected to the bottom-right corner (both always forced to be empty) in approximately $50 \%$ of the mazes. We then shuffle the walls uniformly randomly. For 20 by 20 mazes this means $70 \%$ of locations are empty and $30 \%$ contain walls. More than a googol different such 20-by-20 mazes exist (as $\mathrm { \binom { 3 9 8 } { 1 2 0 } } > \mathrm { \bar { 1 0 } ^ { \bar { 1 } 0 0 } } ,$ ).
md/train/ByC7ww9le/ByC7ww9le.md ADDED
@@ -0,0 +1,342 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GAUSSIAN ATTENTION MODEL AND ITS APPLICATION TO KNOWLEDGE BASE EMBEDDING AND QUESTION ANSWERING
2
+
3
+ Liwen Zhang Department of Computer Science University of Chicago Chicago, IL 60637, USA liwenz@cs.uchicago.edu
4
+
5
+ John Winn & Ryota Tomioka Microsoft Research Cambridge Cambridge, CB1 2FB, UK {jwinn, ryoto}@microsoft.com
6
+
7
+ # ABSTRACT
8
+
9
+ We propose the Gaussian attention model for content-based neural memory access. With the proposed attention model, a neural network has the additional degree of freedom to control the focus of its attention from a laser sharp attention to a broad attention. It is applicable whenever we can assume that the distance in the latent space reflects some notion of semantics. We use the proposed attention model as a scoring function for the embedding of a knowledge base into a continuous vector space and then train a model that performs question answering about the entities in the knowledge base. The proposed attention model can handle both the propagation of uncertainty when following a series of relations and also the conjunction of conditions in a natural way. On a dataset of soccer players who participated in the FIFA World Cup 2014, we demonstrate that our model can handle both path queries and conjunctive queries well.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ There is a growing interest in incorporating external memory into neural networks. For example, memory networks (Weston et al., 2014; Sukhbaatar et al., 2015) are equipped with static memory slots that are content or location addressable. Neural Turing machines (Graves et al., 2014) implement memory slots that can be read and written as in Turing machines (Turing, 1938) but through differentiable attention mechanism.
14
+
15
+ Each memory slot in these models stores a vector corresponding to a continuous representation of the memory content. In order to recall a piece of information stored in memory, attention is typically employed. Attention mechanism introduced by Bahdanau et al. (2014) uses a network that outputs a discrete probability mass over memory items. A memory read can be implemented as a weighted sum of the memory vectors in which the weights are given by the attention network. Reading out a single item can be realized as a special case in which the output of the attention network is peaked at the desired item. The attention network may depend on the current context as well as the memory item itself. The attention model is called location-based and content-based, if it depends on the location in the memory and the stored memory vector, respectively.
16
+
17
+ Knowledge bases, such as WordNet and Freebase, can also be stored in memory either through an explicit knowledge base embedding (Bordes et al., 2011; Nickel et al., 2011; Socher et al., 2013) or through a feedforward network (Bordes et al., 2015).
18
+
19
+ When we embed entities from a knowledge base in a continuous vector space, if the capacity of the embedding model is appropriately controlled, we expect semantically similar entities to be close to each other, which will allow the model to generalize to unseen facts. However the notion of proximity may strongly depend on the type of a relation. For example, Benjamin Franklin was an engineer but also a politician. We would need different metrics to capture his proximity to other engineers and politicians of his time.
20
+
21
+ ![](images/cf5b6abdc7ed89a863d9f6c7b06ccd455538426890860b6ceea74c96c880c10a.jpg)
22
+ Figure 1: Comparison of the conventional content-based attention model using inner product and the proposed Gaussian attention model with the same mean but two different covariances.
23
+
24
+ In this paper, we propose a new attention model for content-based addressing. Our model scores each item ${ \pmb { v } } _ { \mathrm { i t e m } }$ in the memory by the (logarithm of) multivariate Gaussian likelihood as follows:
25
+
26
+ $$
27
+ \begin{array} { r l } & { \mathrm { s c o r e } ( \pmb { v } _ { \mathrm { i t e m } } ) = \log \phi ( \pmb { v } _ { \mathrm { i t e m } } | \pmb { \mu } _ { \mathrm { c o n t e x t } } , \pmb { \Sigma } _ { \mathrm { c o n t e x t } } ) } \\ & { \qquad = - \frac { 1 } { 2 } ( \pmb { v } _ { \mathrm { i t e m } } - \pmb { \mu } _ { \mathrm { c o n t e x t } } ) \pmb { \Sigma } _ { \mathrm { c o n t e x t } } ^ { - 1 } ( \pmb { v } _ { \mathrm { i t e m } } - \pmb { \mu } _ { \mathrm { c o n t e x t } } ) + \mathrm { c o n s t . } } \end{array}
28
+ $$
29
+
30
+ where context denotes all the variables that the attention depends on. For example, “American engineers in the $1 8 \mathrm { t h }$ century” or “American politicians in the 18th century” would be two contexts that include Benjamin Franklin but the two attentions would have very different shapes.
31
+
32
+ Compared to the (normalized) inner product used in previous work (Sukhbaatar et al., 2015; Graves et al., 2014) for content-based addressing, the Gaussian model has the additional control of the spread of the attention over items in the memory. As we show in Figure 1, we can view the conventional inner-product-based attention and the proposed Gaussian attention as addressing by an affine energy function and a quadratic energy function, respectively. By making the addressing mechanism more complex, we may represent many entities in a relatively low dimensional embedding space. Since knowledge bases are typically extremely sparse, it is more likely that we can afford to have a more complex attention model than a large embedding dimension.
33
+
34
+ We apply the proposed Gaussian attention model to question answering based on knowledge bases. At the high-level, the goal of the task is to learn the mapping from a question about objects in the knowledge base in natural language to a probability distribution over the entities. We use the scoring function (1) for both embedding the entities as vectors, and extracting the conditions mentioned in the question and taking a conjunction of them to score each candidate answer to the question.
35
+
36
+ The ability to compactly represent a set of objects makes the Gaussian attention model well suited for representing the uncertainty in a multiple-answer question (e.g., “who are the children of Abraham Lincoln?”). Moreover, traversal over the knowledge graph (see Guu et al., 2015) can be naturally handled by a series of Gaussian convolutions, which generalizes the addition of vectors. In fact, we model each relation as a Gaussian with mean and variance parameters. Thus a traversal on a relation corresponds to a translation in the mean and addition of the variances.
37
+
38
+ The proposed question answering model is able to handle not only the case where the answer to a question is associated with an atomic fact, which is called simple Q&A (Bordes et al., 2015), but also questions that require composition of relations (path queries in Guu et al. (2015)) and conjunction of queries. An example flow of how our model deals with a question “Who plays forward for Borussia Dortmund?” is shown in Figure 2 in Section 3.
39
+
40
+ This paper is structured as follows. In Section 2, we describe how the Gaussian scoring function (1) can be used to embed the entities in a knowledge base into a continuous vector space. We call our model TransGaussian because of its similarity to the TransE model proposed by Bordes et al. (2013). Then in Section 3, we describe our question answering model. In Section 4, we carry out experiments on WorldCup2014 dataset we collected. The dataset is relatively small but it allows us to evaluate not only simple questions but also path queries and conjunction of queries. The proposed TransGaussian embedding with the question answering model achieves significantly higher accuracy than the vanilla TransE embedding or TransE trained with compositional relations Guu et al. (2015) combined with the same question answering model.
41
+
42
+ # 2 KNOWLEDGE BASE EMBEDDING
43
+
44
+ In this section, we describe the proposed TransGaussian model based on the Gaussian attention model (1). While it is possible to train a network that computes the embedding in a single pass (Bordes et al., 2015) or over multiple passes (Li et al., 2015), it is more efficient to offload the embedding as a separate step for question answering based on a large static knowledge base.
45
+
46
+ # 2.1 THE TRANSGAUSSIAN MODEL
47
+
48
+ Let $\mathcal { E }$ be the set of entities and $\mathcal { R }$ be the set of relations. A knowledge base is a collection of triplets $( s , r , o )$ , where we call $\textit { s } \in \textit { \varepsilon }$ , $r \in \mathcal { R }$ , and $\textit { o } \in \textit { \mathcal { E } }$ , the subject, the relation, and the object of the triplet, respectively. Each triplet encodes a fact. For example, (Albert Einstein, has profession, theoretical physicist). All the triplets given in a knowledge base are assumed to be true. However generally speaking a triplet may be true or false. Thus knowledge base embedding aims at training a model that predict if a triplet is true or not given some parameterization of the entities and relations (Bordes et al., 2011; 2013; Nickel et al., 2011; Socher et al., 2013; Wang et al., 2014).
49
+
50
+ paper, we associate awith two parameters, $\pmb { v } _ { s } \in \mathbb { R } ^ { d }$ with each entity ositive definite s $s \in { \mathcal { E } }$ , and we atric matrix h relation. $r \in \mathcal { R }$ $\pmb { \delta } _ { r } \in \mathbb { R } ^ { d }$ $\pmb { \Sigma } _ { r } \in \mathbb { R } _ { + + } ^ { d \times d }$
51
+
52
+ Given subject $s$ and relation $r$ , we can compute the score of an object $o$ to be in triplet $( s , r , o )$ using the Gaussian attention model as (1) with
53
+
54
+ $$
55
+ \begin{array} { r } { \mathrm { s c o r e } ( s , r , o ) = \log \phi ( \pmb { v } _ { o } | \pmb { \mu } _ { \mathrm { c o n t e x t } } , \pmb { \Sigma } _ { \mathrm { c o n t e x t } } ) , } \end{array}
56
+ $$
57
+
58
+ where $\pmb { \mu } _ { \mathrm { c o n t e x t } } = \pmb { v } _ { s } + \pmb { \delta } _ { r }$ , $\pmb { \Sigma } _ { \mathrm { c o n t e x t } } = \pmb { \Sigma } _ { r }$ . Note that if $\Sigma _ { r }$ is fixed to the identity matrix, we are modeling the relation of subject ${ \pmb v } _ { s }$ and object ${ \pmb v } _ { o }$ as a translation $\delta _ { r }$ , which is equivalent to the TransE model (Bordes et al., 2013). We allow the covariance $\Sigma _ { r }$ to depend on the relation to handle one-to-many relations (e.g., profession has person relation) and capture the shape of the distribution of the set of objects that can be in the triplet. We call our model TransGaussian because of its similarity to TransE (Bordes et al., 2013).
59
+
60
+ Parameterization For computational efficiency, we will restrict the covariance matrix $\Sigma _ { r }$ to be diagonal in this paper. Furthermore, in order to ensure that $\Sigma _ { r }$ is strictly positive definite, we employ the exponential linear unit (ELU, Clevert et al., 2015) and parameterize $\Sigma _ { r }$ as follows:
61
+
62
+ $$
63
+ \Sigma _ { r } = \mathrm { d i a g } \left( \begin{array} { c } { { \mathrm { E L U } ( m _ { r , 1 } ) + 1 + \epsilon } } \\ { { } } \\ { { \cdot _ { \cdot _ { \cdot _ { \cdot _ { \cdot _ { \cdot _ { \cdot _ { \cdot _ { \cdot } \cdot _ { \cdot _ { \cdot _ { \cdot } \cdot _ { \cdot _ { \cdot } \cdot _ { \cdot _ { \cdot } \cdot _ { \cdot _ { \cdot } \cdot _ { \cdot } \cdot _ { \cdot _ { \cdot } \cdot _ { \cdot } \cdot _ { \cdot } \cdot _ { \cdot } \cdot _ { \cdot } \cdot _ { \cdot } \cdot _ { \cdot } \cdot _ { \cdot } \cdot _ { \cdot } \cdot _ { \cdot } \cdot _ { \cdot } \cdot _ { \cdot } \cdot _ { \cdot } \cdot _ { \cdot } \cdot _ { \cdot } \cdot _ { \cdot } \cdot } } } } } } } } } } } } } } } \end{array} \right)
64
+ $$
65
+
66
+ where $m _ { r , j } ~ ( j = 1 , \ldots , d )$ are the unconstrained parameters that are optimized during training and $\epsilon$ is a small positive value that ensure the positivity of the variance during numerical computation. The ELU is defined as
67
+
68
+ $$
69
+ { \mathrm { E L U } } ( x ) = { \left\{ \begin{array} { l l } { x , } & { x \geq 0 , } \\ { \exp { ( x ) } - 1 , } & { x < 0 . } \end{array} \right. }
70
+ $$
71
+
72
+ Ranking loss Suppose we have a set of triplets $\mathcal { T } = \{ ( s _ { i } , r _ { i } , o _ { i } ) \} _ { i = 1 } ^ { N }$ from the knowledge base.
73
+ Let $\mathcal { N } ( s , r )$ be the set of incorrect objects to be in the triplet $( s , r , \cdot )$ .
74
+
75
+ Our objective function uses the ranking loss to measure the margin between the scores of true answers and those of false answers and it can be written as follows:
76
+
77
+ $$
78
+ \begin{array} { r } { \displaystyle \underset { \{ \delta _ { r } , M _ { r } , : r \in \bar { \mathcal { R } } \} } { \operatorname* { m i n } } \frac { 1 } { N } \sum _ { ( s , r , o ) \in \mathcal { T } } \mathbb { E } _ { t ^ { \prime } \sim \mathcal { N } ( s , r ) } \left[ [ \mu - \mathrm { s c o r e } ( s , r , o ) + \mathrm { s c o r e } ( s , r , t ^ { \prime } ) ] _ { + } \right] } \\ { + \lambda \left( \displaystyle \sum _ { e \in \mathcal { E } } \| v _ { e } \| _ { 2 } ^ { 2 } + \displaystyle \sum _ { r \in \bar { \mathcal { R } } } \big ( \| \delta _ { r } \| _ { 2 } ^ { 2 } + \| M _ { r } \| _ { F } ^ { 2 } \big ) \right) , } \end{array}
79
+ $$
80
+
81
+ where, $N = | \mathcal { T } |$ , $\mu$ is the margin parameter and $M _ { r }$ denotes the diagonal matrix with $m _ { r , j } , j =$ $1 , \ldots , d$ on the diagonal; the function $[ \cdot ] _ { + }$ is defined as $[ x ] _ { + } = \operatorname* { m a x } ( 0 , x )$ . Here, we treat an inverse relation as a separate relation and denote by $\bar { \mathcal { R } } = \mathcal { R } \cup \mathcal { R } ^ { - 1 }$ the set of all the relations including both relations in $\mathcal { R }$ and their inverse relations; a relation $\tilde { r }$ is the inverse relation of $r$ if $( s , \tilde { r } , o )$ implies $( o , r , s )$ and vice versa. Moreover, $\mathbb { E } _ { t ^ { \prime } \sim \mathcal { N } ( s , r ) }$ denotes the expectation with respect to the uniform distribution over the set of incorrect objects, which we approximate with 10 random samples in the experiments. Finally, the last terms are $\ell _ { 2 }$ regularization terms for the embedding parameters.
82
+
83
+ # 2.2 COMPOSITIONAL RELATIONS
84
+
85
+ Guu et al. (2015) has recently shown that training TransE with compositional relations can make it competitive to more complex models, although TransE is much simpler compared to for example, neural tensor networks (NTN, Socher et al. (2013)) and TransH Wang et al. (2014). Here, a compositional relation is a relation that is composed as a series of relations in $\mathcal { R }$ , for example, grand father of can be composed as first applying the parent of relation and then the father of relation, which can be seen as a traversal over a path on the knowledge graph.
86
+
87
+ TransGaussian model can naturally handle and propagate the uncertainty over such a chain of relations by convolving the Gaussian distributions along the path. That is, the score of an entity $o$ to be in the $\tau$ -step relation $r _ { 1 } / r _ { 2 } / \cdots / r _ { \tau }$ with subject $s$ , which we denote by the triplet $( \dot { s , } r _ { 1 } / r _ { 2 } / \cdot \cdot \cdot / r _ { \tau } , o )$ , is given as
88
+
89
+ $$
90
+ \begin{array} { r } { \mathrm { s c o r e } ( s , r _ { 1 } / r _ { 2 } / \cdot \cdot \cdot / r _ { \tau } , o ) = \log \phi ( \pmb { v } _ { o } | \pmb { \mu } _ { \mathrm { c o n t e x t } } , \pmb { \Sigma } _ { \mathrm { c o n t e x t } } ) , } \end{array}
91
+ $$
92
+
93
+ with $\begin{array} { r } { \pmb { \mu } _ { \mathrm { c o n t e x t } } = \pmb { v } _ { s } + \sum _ { t = 1 } ^ { \tau } \delta _ { r _ { t } } } \end{array}$ , $\begin{array} { r } { \sum _ { \mathrm { c o n t e x t } } = \sum _ { t = 1 } ^ { \tau } \sum _ { r _ { t } } } \end{array}$ , where the covariance associated with each relation is parameterized in the same way as in the previous subsection.
94
+
95
+ Training with compositional relations Let P = nsi, ri1 /ri2 / · · · /rili , oioN i=1 be a set of randomly sampled paths from the knowledge graph. Here relation $r _ { i _ { k } }$ in a path can be a relation in $\mathcal { R }$ or an inverse relation in $\mathcal { R } ^ { - 1 }$ . With the scoring function (4), the generalized training objective for compositional relations can be written identically to (3) except for replacing $\tau$ with $\mathcal { T } \cup \mathcal { P }$ and replacing $N$ with $N ^ { \prime } = | \mathcal { T } \cup \mathcal { P } |$ .
96
+
97
+ # 3 QUESTION ANSWERING
98
+
99
+ Given a set of question-answer pairs, in which the question is phrased in natural language and the answer is an entity in the knowledge base, our goal is to train a model that learns the mapping from the question to the correct entity. Our question answering model consists of three steps, entity recognition, relation composition, and conjunction. We first identify a list of entities mentioned in the question (which is assumed to be provided by an oracle in this paper). If the question is “Who plays Forward for Borussia Dortmund?” then the list would be [Forward, Borussia Dortmund]. The next step is to predict the path of relations on the knowledgegraph starting from each entity in the list extracted in the first step. In the above example, this will be (smooth versions of) /Forward/position played by/ and /Borussia Dortmund/has player/ predicted as series of Gaussian convolutions. In general, we can have multiple relations appearing in each path. Finally, we take a product of all the Gaussian attentions and renormalize it, which is equivalent to Bayes’ rule with independent observations (paths) and a noninformative prior.
100
+
101
+ # 3.1 ENTITY RECOGNITION
102
+
103
+ We assume that there is an oracle that provides a list containing all the entities mentioned in the question, because (1) a domain specific entity recognizer can be developed efficiently (Williams et al., 2015) and (2) generally entity recognition is a challenging task and it is beyond the scope of this paper to show whether there is any benefit in training our question answering model jointly with a entity recognizer. We assume that the number of extracted entities can be different for each question.
104
+
105
+ # 3.2 RELATION COMPOSITION
106
+
107
+ We train a long short-term memory (LSTM, Hochreiter & Schmidhuber, 1997) network that emits an output $\boldsymbol { h } _ { t }$ for each token in the input sequence. Then we compute the attention over the hidden
108
+
109
+ ![](images/c8be4c487573afc71d590a3b723235da8f6bd144ebef356a786893ec5f627b32.jpg)
110
+ Figure 2: The input to the system is a question in natural language. Two entities Forward and Borussia Dortmund are identified in the question and associated with point mass distributions centered at the corresponding entity vectors. An LSTM encodes the input into a sequence of output vectors of the same length. Then we take average of the output vectors weighted by attention $\mathit { p } _ { t , e }$ for each recognized entity $e$ to predict the weight $\alpha _ { r , e }$ for relation $r$ associated with entity $e$ . We form a Gaussian attention over the entities for each entity $e$ by convolving the corresponding point mass with the (pre-trained) Gaussian embeddings of the relations weighted by $\alpha _ { r , e }$ according to Eq. (6). The final prediction is produced by taking the product and normalizing the Gaussian attentions.
111
+
112
+ states for each recognized entity $e$ as
113
+
114
+ $$
115
+ p _ { t , e } = \mathrm { s o f t m a x } \left( f ( v _ { e } , h _ { t } ) \right) \quad ( t = 1 , . . . , T ) ,
116
+ $$
117
+
118
+ where ${ \pmb v } _ { e }$ is the vector associated with the entity $e$ . We use a two-layer perceptron for $f$ in our experiments, which can be written as follows:
119
+
120
+ $$
121
+ f ( \pmb { v } _ { e } , \pmb { h } _ { t } ) = \pmb { u } _ { f } ^ { \top } \mathrm { R e L U } \left( \pmb { W } _ { f , v } \pmb { v } _ { e } + \pmb { W } _ { f , h } \pmb { h } _ { t } + \pmb { b } _ { 1 } \right) + b _ { 2 } ,
122
+ $$
123
+
124
+ where $\mathbf { \widetilde { \Gamma } } _ { f , v } \in \mathbb { R } ^ { L \times d } , W _ { f , h } \in \mathbb { R } ^ { L \times H } , b _ { 1 } \in \mathbb { R } ^ { L } , { \mathbf { u } } _ { f } \in \mathbb { R } ^ { L } , b _ { 2 } \in \mathbb { R } \mathrm { a r e } \mathrm { p a r }$ ameters. Here ${ \mathrm { R e L U } } ( x ) =$ $\operatorname* { m a x } ( 0 , x )$ is the rectified linear unit. Finally, softmax denotes softmax over the $T$ tokens.
125
+
126
+ Next, we use the weights $\mathit { p } _ { t , e }$ to compute the weighted sum over the hidden states $\boldsymbol { h } _ { t }$ as
127
+
128
+ $$
129
+ o _ { e } = \sum _ { t = 1 } ^ { T } p _ { t , e } h _ { t } .
130
+ $$
131
+
132
+ Then we compute the weights $\alpha _ { r , e }$ over all the relations as $\alpha _ { r , e } = \mathrm { R e L U } \left( \pmb { w } _ { r } ^ { \top } \pmb { o } _ { e } \right) \quad \left( \forall r \in \mathcal { R } \cup \right.$ $\mathcal { R } ^ { - 1 }$ ). Here the rectified linear unit is used to ensure the positivity of the weights. Note however that the weights should not be normalized, because we may want to use the same relation more than once in the same path. Making the weights positive also has the effect of making the attention sparse and interpretable because there is no cancellation.
133
+
134
+ For each extracted entity $e$ , we view the extracted entity and the answer of the question to be the subject and the object in some triplet $( e , p , o )$ , respectively, where the path $p$ is inferred from the question as the weights $\alpha _ { r , e }$ as we described above. Accordingly, the score for each candidate answer $o$ can be expressed using (1) as:
135
+
136
+ $$
137
+ \mathrm { s c o r e } _ { e } ( \pmb { v } _ { o } ) = \log \phi ( \pmb { v } _ { o } | \pmb { \mu } _ { e , \alpha , \mathrm { K B } } , \pmb { \Sigma } _ { e , \alpha , \mathrm { K B } } )
138
+ $$
139
+
140
+ with $\begin{array} { r } { \pmb { \mu } _ { e , \alpha , \mathrm { K B } } = \pmb { v } _ { e } + \sum _ { r \in \bar { \mathcal { R } } } \alpha _ { r , e } \delta _ { r } , \sum _ { e , \alpha , \mathrm { K B } } = \sum _ { r \in \bar { \mathcal { R } } } \alpha _ { r , e } ^ { 2 } \pmb { \Sigma } _ { r } } \end{array}$ , where ${ \pmb v } _ { e }$ is the vector associated with entity $e$ and $\bar { \mathcal { R } } = \mathcal { R } \cup \mathcal { R } ^ { - 1 }$ denotes the set of relations including the inverse relations.
141
+
142
+ # 3.3 CONJUNCTION
143
+
144
+ Let $\mathcal { E } ( q )$ be the set of entities recognized in the question $q$ . The final step of our model is to take the conjunction of the Gaussian attentions derived in the previous step. This step is simply carried out by multiplying the Gaussian attentions as follows:
145
+
146
+ $$
147
+ \begin{array} { r l } & { \mathrm { s c o r e } ( \pmb { v } _ { o } | \mathcal { E } ( q ) , \Theta ) = \underset { e \in \mathcal { E } ( q ) } { \log \prod } \phi ( \pmb { v } _ { o } | \pmb { \mu } _ { e , \alpha , \mathrm { K B } } , \pmb { \Sigma } _ { e , \alpha , \mathrm { K B } } ) } \\ & { \qquad = - \cfrac { 1 } { 2 } \displaystyle \sum _ { e \in \mathcal { E } ( q ) } \left( \pmb { v } _ { o } - \pmb { \mu } _ { e , \alpha , \mathrm { K B } } \right) ^ { \top } \pmb { \Sigma } _ { e , \alpha , \mathrm { K B } } ^ { - 1 } ( \pmb { v } _ { o } - \pmb { \mu } _ { e , \alpha , \mathrm { K B } } ) + \mathrm { c o n s t . } , } \end{array}
148
+ $$
149
+
150
+ which is again a (logarithm of) Gaussian scoring function, where $\mu _ { e , \alpha , \mathrm { K B } }$ and $\Sigma _ { e , \alpha , \mathrm { K B } }$ are the mean and the covariance of the Gaussian attention given in (6). Here $\Theta$ denotes all the parameters of the question-answering model.
151
+
152
+ # 3.4 TRAINING THE QUESTION ANSWERING MODEL
153
+
154
+ Suppose we have a knowledge base $( \mathcal { E } , \mathcal { R } , \mathcal { T } )$ and a trained TransGaussian model $\big ( \{ v _ { e } \} _ { e \in \mathcal { E } } , \{ ( \delta _ { r } , \Sigma _ { r } ) \} _ { r \in \bar { \mathcal { R } } } \big )$ , where $\bar { \mathcal { R } }$ is the set of all relations including the inverse relations. During training time, we assume the training set is a supervised question-answer pairs $\{ ( q _ { i } , \mathcal { E } ( q _ { i } ) , a _ { i } \bar { ) } : i = 1 , 2 , . . . , m \}$ . Here, $q _ { i }$ is a question formulated in natural language, $\bar { \mathcal { E } } ( q _ { i } ) \subset \mathcal { E }$ is a set of knowledge base entities that appears in the question, and $a _ { i } ~ \in { \mathcal { E } }$ is the answer to the question. For example, on a knowledge base of soccer players, a valid training sample could be
155
+
156
+ (“Who plays forward for Borussia Dortmund?”,[Forward, Borussia Dortmund], Marco Reus).
157
+
158
+ Note that the answer to a question is not necessarily unique and we allow $a _ { i }$ to be any of the true answers in the knowledge base. During test time, our model is shown $\left( q _ { i } , \mathcal { E } ( q _ { i } ) \right)$ and the task is to find $a _ { i }$ . We denote the set of answers to $q _ { i }$ by $A ( q _ { i } )$ .
159
+
160
+ To train our question-answering model, we minimize the objective function
161
+
162
+ $$
163
+ \frac { 1 } { n } \sum _ { i = 1 } ^ { m } \biggl ( \underset { t ^ { \prime } \sim \mathcal { N } ( q _ { i } ) } { \mathbb { E } } \left[ [ \mu - \mathrm { s c o r e } ( v _ { a _ { i } } | \mathcal { E } ( q _ { i } ) , \Theta ) + \mathrm { s c o r e } ( v _ { t ^ { \prime } } | \mathcal { E } ( q _ { i } ) , \Theta ) ] _ { + } \right] + \nu \sum _ { e \in \mathcal { E } ( q _ { i } ) } \sum _ { r \in \mathcal { R } } | \alpha _ { r , e } | \biggr ) + \lambda \| \Theta \| _ { 2 } ^ { 2 }
164
+ $$
165
+
166
+ where $\mathbb { E } _ { t ^ { \prime } \sim \mathcal { N } ( q _ { i } ) }$ is expectation with respect to a uniform distribution over of all incorrect answers to $q _ { i }$ , which we approximate with 10 random samples. We assume that the number of relations implied in a question is small compared to the total number of relations in the knowledge base. Hence the coefficients $\alpha _ { r , e }$ computed for each question $q _ { i }$ are regularized by their $\ell _ { 1 }$ norms.
167
+
168
+ # 4 EXPERIMENTS
169
+
170
+ As a demonstration of the proposed framework, we perform question and answering on a dataset of soccer players. In this work, we consider two types of questions. A path query is a question that contains only one named entity from the knowledge base and its answer can be found from the knowledge graph by walking down a path consisting of a few relations. A conjunctive query is a question that contains more than one entities and the answer is given as the conjunction of all path queries starting from each entity. Furthermore, we experimented on a knowledge base completion task with TransGaussian embeddings to test its capability of generalization to unseen fact. Since knowledge base completion is not the main focus of this work, we include the results in the Appendix.
171
+
172
+ # 4.1 WORLDCUP2014 DATASET
173
+
174
+ We build a knowledge base of football players that participated in FIFA World Cup 2014 1. The original dataset consists of players’ information such as nationality, positions on the field and ages etc. We picked a few attributes and constructed 1127 entities and 6 atomic relations. The entities include 736 players, 297 professional soccer clubs, 51 countries, 39 numbers and 4 positions. And the six atomic relations are plays in club: PLAYER $ \mathrm { C L U B }$ , is aged: PLAYER NUMBER, plays for country: PLAYER COUNTRY, plays position: PLAYER POSITION, wears number 2: PLAYER NUMBER, is in country: CLUB COUNTRY,
175
+
176
+ where PLAYER, CLUB, NUMBER, etc, denote the type of entities that can appear as the left or right argument for each relation. Some relations share the same type as the right argument, e.g., plays for country and is in country.
177
+
178
+ Given the entities and relations, we transformed the dataset into a set of 3977 triplets. A list of sample triplets can be found in the Appendix. Based on these triplets, we created two sets of question answering tasks which we call path query and conjunctive query respectively. The answer of every question is always an entity in the knowledge base and a question can involve one or two triplets. The questions are generated as follows.
179
+
180
+ Path queries. Among the paths on the knowledge graph, there are some natural composition of relations, e.g., plays in country (PLAYER COUNTRY) can be decomposed as the composition of plays in club (PLAYE $\mathbf { R } \to \mathbf { C L } $ UB) and is in country $( \mathbf { C L U B } \to \mathbf { C O U N T R Y } )$ . In addition to the atomic relations, we manually picked a few meaningful compositions of relations and formed query templates, which takes the form “find $e \in { \mathcal { E } }$ , such that $( s , p , e )$ is true”, where $s$ is the subject and $p$ can be an atomic relation or a path of relations. To formulate a set of path-based question-answer pairs, we manually created one or more question templates for every query template (see Table 5) Then, for a particular instantiation of a query template with subject and object entities, we randomly select a question template to generate a question given the subject; the object entity becomes the answer of the question. See Table 6 for the list of composed relations, sample questions, and answers. Note that all atomic relations in this dataset are many-to-one while these composed relations can be one-to-many or many-to-many as well.
181
+
182
+ Conjunctive queries. To generate question-and-answer pairs of conjunctive queries, we first picked three pairs of relations and used them to create query templates of the form “Find $e \in { \mathcal { E } }$ , such that both $( s _ { 1 } , r _ { 1 } , e )$ and $( s _ { 2 } , r _ { 2 } , e )$ are true.” (see Table 5). For a pair of relations $r _ { 1 }$ and $r _ { 2 }$ , we enumerated all pairs of entities $s _ { 1 } , s _ { 2 }$ that can be their subjects and formulated the corresponding query in natural language using question templates as in the same way as path queries. See Table 7 for a list of sample questions and answers.
183
+
184
+ As a result, we created 8003 question-and-answer pairs of path queries and 2208 pairs of conjunctive queries which are partitioned into train / validation $/$ test subsets. We refer to Table 1 for more statistics about the dataset. Templates for generating the questions are list in Table 5.
185
+
186
+ # 4.2 EXPERIMENTAL SETUP
187
+
188
+ To perform question and answering under our proposed framework, we first train the TransGaussian model on WorldCup2014 dataset. In addition to the atomic triplets, we randomly sampled 50000 paths with length 1 or 2 from the knowledge graph and trained a TransGaussian model compositionally as described in Set 2.2. An inverse relation is treated as a separate relation. Following the naming convention from Guu et al. (2015), we denote this trained embedding by TransGaussian (COMP). We found that the learned embedding possess some interesting properties. Some dimensions of the embedding space dedicate to represent a particular relation. Players are clustered by their attributes when entities’ embeddings are projected to the corresponding lower dimensional subspaces. We elaborate and illustrate such properties in the Appendix.
189
+
190
+ Baseline methods We also trained a TransGaussian model only on the atomic triplets and denote such a model by TransGaussian (SINGLE). Since no inverse relation was involved when TransGaussian (SINGLE) was trained, to use this embedding in question answering tasks, we represent the inverse relations as follows: for each relation $r$ with mean $\delta _ { r }$ and variance $\Sigma _ { r }$ , we model its inverse $r ^ { - 1 }$ as a Gaussian attention with mean $- \delta _ { r }$ and variance equal to $\Sigma _ { r }$ .
191
+
192
+ We also trained TransE models on WorldCup2014 dataset by using the code released by the authors of Guu et al. (2015). Likewise, we use TransE (SINGLE) to denote the model trained with atomic triplets only and use TransE (COMP) to denote the model trained with the union of triplets and paths. Note that TransE can be considered as a special case of TransGaussian where the variance matrix is the identity and hence, the scoring formula Eq. (7) is applicable to TransE as well.
193
+
194
+ Training configurations For all models, dimension of entity embeddings was set to 30. The hidden size of LSTM was set to 80. Word embeddings were trained jointly with the question answering model and dimension of word embedding was set to 40. We employed Adam (Kingma & Ba, 2014) as the optimizer. All parameters were tuned on the validation set. Under the same setting, we experimented with two cases: first, we trained models for path queries and conjunctive queries separately; Furthermore, we trained a single model that addresses both types queries. We present the results of the latter case in the next subsection while the results of the former are included in the Appendix.
195
+
196
+ Evaluation metrics During test time, our model receives a question in natural language and a list of knowledge base entities contained in the question. Then it predicts the mean and variance of a Gaussian attention formulated in Eq. (7) which is expected to capture the distribution of all positive answers. We rank all entities in the knowledge base by their scores under this Gaussian attention. Next, for each entity which is a correct answer, we check its rank relative to all incorrect answers and call this rank the filtered rank. For example, if a correct entity is ranked above all negative answers except for one, it has filtered rank two. We compute this rank for all true answers and report mean filtered rank and $H @ l$ which is the percentage of true answers that have filtered rank 1.
197
+
198
+ # 4.3 EXPERIMENTAL RESULTS
199
+
200
+ We present the results of joint learning in Table 2. These results show that TransGaussian works better than TransE in general. In fact, TransGaussian (COMP) achieved the best performance in almost all aspects. Most notably, it achieved the highest $\mathrm { H @ 1 }$ rates on challenging questions such as “where is the club that edin dzeko plays for?” (#11, composition of two relations) and “who are the defenders on german national team?” (#14, conjunction of two queries).
201
+
202
+ The same table shows that TransGaussian benefits remarkably from compositional training. For example, compositional training improved TransGaussian’s $\mathrm { H @ 1 }$ rate by near $60 \%$ in queries on players from a given countries (#8) and queries on players who play a particular position (#9). It also boosted TransGaussian’s performance on all conjunctive quries (#13–#15) significantly.
203
+
204
+ To understand TransGaussian (COMP)’s weak performance on answering queries on the professional football club located in a given country (#10) and queries on professional football club that has players from a particular country (#12), we tested its capability of modeling the composed relation by feeding the correct relations and subjects during test time. It turns out that these two relations were not modeled well by TransGaussian (COMP) embedding, which limits its performance in question answering. (See Table 8 in the Appendix for quantitative evaluations.) The same limit was found in the other three embeddings as well.
205
+
206
+ Note that all the models compared in Table 2 uses the proposed Gaussian attention model because TransE is the special case of TransGaussian where the variance is fixed to one. Thus the main differences are whether the variance is learned and whether the embedding was trained compositionally. Finally, we refer to Table 9 and 10 in the Appendix for experimental results of models trained on path and conjunctive queries separately.
207
+
208
+ Table 1: Some statistics of the WorldCup2014 dataset.
209
+
210
+ <table><tr><td rowspan=3 colspan=1># entity</td><td></td><td></td><td></td><td></td></tr><tr><td rowspan=2 colspan=1>#atomic relations</td><td rowspan=2 colspan=1># atomic triplets</td><td></td><td></td></tr><tr><td rowspan=1 colspan=1># path query Q&amp;A(train/validation/test)</td><td rowspan=1 colspan=1># conjunctive query Q&amp;A(train /validation /test)</td></tr><tr><td rowspan=1 colspan=1>1127</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>3977</td><td rowspan=1 colspan=1>5620/804/1579</td><td rowspan=1 colspan=1>1564/224/420</td></tr></table>
211
+
212
+ # 5 RELATED WORK
213
+
214
+ The work of Vilnis & McCallum (2014) is similar to our Gaussian attention model. They discuss many advantages of the Gaussian embedding; for example, it is arguably a better way of handling asymmetric relations and entailment. However the work was presented in the word2vec (Mikolov et al., 2013)-style word embedding setting and the Gaussian embedding was used to capture the diversity in the meaning of a word. Our Gaussian attention model extends their work to a more general setting in which any memory item can be addressed through a concept represented as a Gaussian distribution over the memory items.
215
+
216
+ Table 2: Results of joint learning with path queries and conjunction queries on WorldCup2014.
217
+
218
+ <table><tr><td></td><td></td><td colspan="2">TransE (SINGLE)</td><td colspan="2">TransE (COMP)</td><td colspan="2">TransGaussian (SINGLE)</td><td colspan="2">TransGaussian (COMP)</td></tr><tr><td>#</td><td>Sample question</td><td>H@1(%)Filtered</td><td>Mean Rank</td><td>H@1(%)Filtered</td><td>Mean Rank</td><td>H@1(%)</td><td>Mean Filtered Rank</td><td>H@1(%)</td><td>Mean Filtered Rank</td></tr><tr><td>1</td><td>which club does alan pulido play for?</td><td>88.59</td><td>1.18</td><td>91.95</td><td>1.11</td><td>96.64</td><td>1.04</td><td>98.66</td><td>1.01</td></tr><tr><td>2</td><td>what position does gonzalo higuain play?</td><td>100.00</td><td>1.00</td><td>98.11</td><td>1.03</td><td>98.74</td><td>1.01</td><td>100.00</td><td>1.00</td></tr><tr><td>3</td><td>how old is samuel etoo?</td><td>67.11</td><td>1.44</td><td>90.79</td><td>1.13</td><td>94.74</td><td>1.08</td><td>97.37</td><td>1.04</td></tr><tr><td>4</td><td>what is the jersey number of mario balotelli?</td><td>45.00</td><td>1.89</td><td>83.57</td><td>1.22</td><td>97.14</td><td>1.03</td><td>99.29</td><td>1.01</td></tr><tr><td>5</td><td>which country is thomas mueller from ?</td><td>94.40</td><td>1.06</td><td>94.40</td><td>1.06</td><td>96.80</td><td>1.04</td><td>98.40</td><td>1.02</td></tr><tr><td>6</td><td>which country is the soccer team fc porto based in ?</td><td>98.48</td><td>1.02</td><td>98.48</td><td>1.02</td><td>93.94</td><td>1.06</td><td>95.45</td><td>1.05</td></tr><tr><td>7</td><td>who plays professionally at liverpool fc?</td><td>95.12</td><td>1.10</td><td>90.24</td><td>1.20</td><td>98.37</td><td>1.04</td><td>96.75</td><td>1.04</td></tr><tr><td>8</td><td>which player is from iran?</td><td>89.86</td><td>1.51</td><td>76.81</td><td>2.07</td><td>38.65</td><td>2.96</td><td>99.52</td><td>1.00</td></tr><tr><td>9</td><td>name a player who plays goalkeeper?</td><td>98.96</td><td>1.01</td><td>69.79</td><td>1.82</td><td>42.71</td><td>5.52</td><td>100.00</td><td>1.00</td></tr><tr><td>10</td><td>which soccer club is based in mexico?</td><td>22.03</td><td>13.94</td><td>30.51</td><td>8.84</td><td>6.78</td><td>10.66</td><td>16.95</td><td>21.14</td></tr><tr><td>11</td><td>where is the club that edin dzeko plays for ?</td><td>52.63</td><td>3.88</td><td>57.24</td><td>2.10</td><td>47.37</td><td>2.27</td><td>78.29</td><td>1.41</td></tr><tr><td>12</td><td>name a soccer club that has a player from australia ?</td><td>30.43</td><td>12.08</td><td>33.70</td><td>11.47</td><td>13.04</td><td>11.64</td><td>19.57</td><td>17.57</td></tr><tr><td colspan="2">Overall (Path Query)</td><td>74.16</td><td>3.11</td><td>77.39</td><td>2.56</td><td>69.54</td><td>3.02</td><td>85.94</td><td>3.52</td></tr><tr><td>13</td><td>who plays forward for fc barcelona?</td><td>97.55</td><td>1.06</td><td>76.07</td><td>1.66</td><td>93.25</td><td>1.24</td><td>98.77</td><td>1.02</td></tr><tr><td>14</td><td>who are the defenders on german national team?</td><td>95.93</td><td>1.06</td><td>69.92</td><td>2.33</td><td>65.04</td><td>2.04</td><td>100.00</td><td>1.00</td></tr><tr><td>15</td><td>which player in ssc napoli is from argentina?</td><td>88.81</td><td>1.17</td><td>76.12</td><td>1.76</td><td>88.81</td><td>1.35</td><td>97.76</td><td>1.03</td></tr><tr><td colspan="2">Overall(Conj. Query)</td><td>94.29</td><td>1.09</td><td>74.29</td><td>1.89</td><td>83.57</td><td>1.51</td><td>98.81</td><td>1.02</td></tr></table>
219
+
220
+ Bordes et al. (2014; 2015) proposed a question-answering model that embeds both questions and their answers to a common continuous vector space. Their method in Bordes et al. (2015) can combine multiple knowledge bases and even generalize to a knowledge base that was not used during training. However their method is limited to the simple question answering setting in which the answer of each question associated with a triplet in the knowledge base. In contrast, our method can handle both composition of relations and conjunction of conditions, which are both naturally enabled by the proposed Gaussian attention model.
221
+
222
+ Neelakantan et al. (2015a) proposed a method that combines relations to deal with compositional relations for knowledge base completion. Their key technical contribution is to use recurrent neural networks (RNNs) to encode a chain of relations. When we restrict ourselves to path queries, question answering can be seen as a sequence transduction task (Graves, 2012; Sutskever et al., 2014) in which the input is text and the output is a series of relations. If we use RNNs as a decoder, our model would be able to handle non-commutative composition of relations, which the current weighted convolution cannot handle well. Another interesting connection to our work is that they take the maximum of the inner-product scores (see also Weston et al., 2013; Neelakantan et al., 2015b), which are computed along multiple paths connecting a pair of entities. Representing a set as a collection of vectors and taking the maximum over the inner-product scores is a natural way to represent a set of memory items. The Gaussian attention model we propose in this paper, however, has the advantage of differentiability and composability.
223
+
224
+ # 6 CONCLUSION
225
+
226
+ In this paper, we have proposed the Gaussian attention model which can be used in a variety of contexts where we can assume that the distance between the memory items in the latent space is compatible with some notion of semantics. We have shown that the proposed Gaussian scoring function can be used for knowledge base embedding achieving competitive accuracy. We have also shown that our embedding model can naturally propagate uncertainty when we compose relations together. Our embedding model also benefits from compositional training proposed by Guu et al. (2015). Furthermore, we have demonstrated the power of the Gaussian attention model in a challenging question answering problem which involves both composition of relations and conjunction of queries. Future work includes experiments on natural question answering datasets and end-to-end training including the entity extractor.
227
+
228
+ # ACKNOWLEDGMENTS
229
+
230
+ The authors would like to thank Daniel Tarlow, Nate Kushman, and Kevin Gimpel for valuable discussions.
231
+
232
+ # REFERENCES
233
+
234
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
235
+
236
+ Antoine Bordes, Jason Weston, Ronan Collobert, and Yoshua Bengio. Learning structured embeddings of knowledge bases. In Conference on Artificial Intelligence, number EPFL-CONF-192344, 2011.
237
+
238
+ Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. Translating embeddings for modeling multi-relational data. In Advances in Neural Information Processing Systems, pp. 2787–2795, 2013.
239
+
240
+ Antoine Bordes, Jason Weston, and Nicolas Usunier. Open question answering with weakly supervised embedding models. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 165–180. Springer, 2014.
241
+
242
+ Antoine Bordes, Nicolas Usunier, Sumit Chopra, and Jason Weston. Large-scale simple question answering with memory networks. arXiv preprint arXiv:1506.02075, 2015.
243
+
244
+ Djork-Arne Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network´ learning by exponential linear units (elus). arXiv preprint arXiv:1511.07289, 2015.
245
+
246
+ Alex Graves. Sequence transduction with recurrent neural networks. arXiv preprint arXiv:1211.3711, 2012.
247
+
248
+ Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprint arXiv:1410.5401, 2014.
249
+
250
+ Kelvin Guu, John Miller, and Percy Liang. Traversing knowledge graphs in vector space. In EMNLP 2015, 2015.
251
+
252
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
253
+
254
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
255
+
256
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. arXiv preprint arXiv:1511.05493, 2015.
257
+
258
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013.
259
+
260
+ Arvind Neelakantan, Benjamin Roth, and Andrew McCallum. Compositional vector space models for knowledge base completion. arXiv preprint arXiv:1504.06662, 2015a.
261
+
262
+ Arvind Neelakantan, Jeevan Shankar, Alexandre Passos, and Andrew McCallum. Efficient non-parametric estimation of multiple embeddings per word in vector space. arXiv preprint arXiv:1504.06654, 2015b.
263
+
264
+ Maximilian Nickel, Volker Tresp, and Hans-Peter Kriegel. A three-way model for collective learning on multi-relational data. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 809–816, 2011.
265
+
266
+ Richard Socher, Danqi Chen, Christopher D Manning, and Andrew Ng. Reasoning with neural tensor networks for knowledge base completion. In Advances in Neural Information Processing Systems, pp. 926–934, 2013.
267
+
268
+ Sainbayar Sukhbaatar, Jason Weston, Rob Fergus, et al. End-to-end memory networks. In Advances in neural information processing systems, pp. 2440–2448, 2015.
269
+
270
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Advances in neural information processing systems, pp. 3104–3112, 2014.
271
+
272
+ Alan Mathison Turing. On computable numbers, with an application to the entscheidungsproblem: A correction. Proceedings of the London Mathematical Society, 2(1):544, 1938.
273
+
274
+ Luke Vilnis and Andrew McCallum. Word representations via gaussian embedding. arXiv preprint arXiv:1412.6623, 2014.
275
+
276
+ Zhen Wang, Jianwen Zhang, Jianlin Feng, and Zheng Chen. Knowledge graph embedding by translating on hyperplanes. In AAAI, pp. 1112–1119. Citeseer, 2014.
277
+
278
+ Jason Weston, Ron J Weiss, and Hector Yee. Nonlinear latent factorization by embedding multiple user interests. In Proceedings of the 7th ACM conference on Recommender systems, pp. 65–68. ACM, 2013.
279
+
280
+ Jason Weston, Sumit Chopra, and Antoine Bordes. Memory networks. arXiv preprint arXiv:1410.3916, 2014.
281
+
282
+ Jason D Williams, Eslam Kamal, Hani Amr Mokhtar Ashour, Jessica Miller, and Geoff Zweig. Fast and easy language understanding for dialog systems with microsoft language understanding intelligent service (LUIS). In 16th Annual Meeting of the Special Interest Group on Discourse and Dialogue, pp. 159, 2015.
283
+
284
+ # A WORDCUP2014 DATASET
285
+
286
+ Table 3: Sample atomic triplets.
287
+
288
+ <table><tr><td>Subject</td><td>Relation</td><td>Object</td></tr><tr><td>david_villa</td><td>plays-for_country</td><td>spain</td></tr><tr><td>lionel_messi</td><td>plays_in-club</td><td>fc_barcelona</td></tr><tr><td>antoine-griezmann</td><td>plays-position</td><td>forward</td></tr><tr><td>cristiano_ronaldo</td><td>wears_number</td><td>7</td></tr><tr><td>fulham_fc</td><td>is_in_country</td><td>england</td></tr><tr><td>lukas_podolski</td><td>is_aged</td><td>29</td></tr></table>
289
+
290
+ Table 4: Statistics of the WorldCup2014 dataset.
291
+
292
+ <table><tr><td rowspan=1 colspan=1>#entity# atomic relations# atomic triplets</td><td rowspan=1 colspan=1>112763977</td></tr><tr><td rowspan=1 colspan=1>#relations (atomic and compositional) in path queries# question and answer pairs in path queries(train/validation/ test)</td><td rowspan=1 colspan=1>125620/804/1579</td></tr><tr><td rowspan=1 colspan=1># types of questions in conjunctive queries# question and answer pairs in conjunctive queries(train/validation/test )</td><td rowspan=1 colspan=1>31564/224/420</td></tr><tr><td rowspan=1 colspan=1>size of vocabulary</td><td rowspan=1 colspan=1>1781</td></tr></table>
293
+
294
+ Table 5: Templates of questions. In the table, (player), (club), (position) are placeholders of named entities with associated type. (country 1) is a placeholder for a country name while (country 2) is a placeholder for the adjectival form of a country.
295
+
296
+ <table><tr><td rowspan=1 colspan=1>#</td><td rowspan=1 colspan=1>Query template</td><td rowspan=1 colspan=1>Question template</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>Finde ∈ε:((player),plays_in_club,e)is true</td><td rowspan=1 colspan=1>which club does (player) play for ?which professional football team does (player) play for ?which football club does (player) play for ?</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>Finde∈ε:(player),plays-position,e)is true</td><td rowspan=1 colspan=1>what position does (player) play ?</td></tr><tr><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>Find e ∈ε:(player),is-aged,e) is true</td><td rowspan=1 colspan=1>how old is (player) ?what is the age of (player) ?</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>Finde∈ε:(player),wears_number,e) is true</td><td rowspan=1 colspan=1>what is the jersey number of (player) ?what number does (player) wear ?</td></tr><tr><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>Finde ∈ε:(player),plays_for_country,e) is true</td><td rowspan=1 colspan=1>what is the nationality of (player) ?which national team does (player) play for ?which country is (player) from ?</td></tr><tr><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>Finde∈ε:(club),is-in_country,e)is true</td><td rowspan=1 colspan=1>which country is the soccer team (club) based in ?</td></tr><tr><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>Finde ∈ε: (club),plays_in_club-1,e)is true</td><td rowspan=1 colspan=1>name a player from (club) ?who plays at the soccer club (club) ?who is from the professional football team (club) ?who plays professionally at (club) ?</td></tr><tr><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>Finde ∈ε:(country-1),plays_for-country-1,e)is true</td><td rowspan=1 colspan=1>which player is from (country_1) ?name a player from (country-1) ?who is from (country-1) ?who plays for the (country_1) national football team ?</td></tr><tr><td rowspan=1 colspan=1>9</td><td rowspan=1 colspan=1>Finde∈ε:(position),playsposition-,e)is true</td><td rowspan=1 colspan=1>name a player who plays (position) ?who plays (position) ?</td></tr><tr><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>Finde ∈ε:(cotry-1),sicountry-1,e)is true</td><td rowspan=1 colspan=1>which soccer club is based in (country_1) ?name a soccer club in (country_1) ?</td></tr><tr><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>Finde∈ε:(player),plays_in_club /is_in_country,e)is true</td><td rowspan=1 colspan=1>which country does (player) play professionally in ?where is the football club that (player) plays for ?</td></tr><tr><td rowspan=1 colspan=1>12</td><td rowspan=1 colspan=1>Finde ∈ε:(country-1),plays-for-country-1/plays_in_club,e)is true</td><td rowspan=1 colspan=1>which professional football team do players from (country_1) play for ?name a soccer club that has a player from (country_1) ?which professional football team has a player from (country_1) ?</td></tr><tr><td rowspan=1 colspan=1>13</td><td rowspan=1 colspan=1>Find e∈ ε:(position),plays-position-1,e) is true and((club),plays-in_club-1,e) is true</td><td rowspan=1 colspan=1>who plays (position) for (club)?who are the (position) at (club) ?name a (position) that plays for (club) ?</td></tr><tr><td rowspan=1 colspan=1>14</td><td rowspan=1 colspan=1>Find e∈ε: (position),plays-position-1,e) is true and(country-l),plays-for-country-1,e)is true</td><td rowspan=1 colspan=1>who plays (position) for (country_1) ?who are the (position) on (country_1) national team ?name a (position) from (country-1) ?which (country_2) footballer plays (position) ?name a (country-2) (position) ?</td></tr><tr><td rowspan=1 colspan=1>15</td><td rowspan=1 colspan=1>Find e∈ε:(club), plays_in_club-1,e) is true and(country_l),plays_for_country-1,e)is true</td><td rowspan=1 colspan=1>who are the (country_2) playersat (club)?which (country_2) footballer plays for (club) ?name a (country_2) player at (club) ?which player in (club) is from (country-1) ?</td></tr></table>
297
+
298
+ Table 6: (Composed) relations and sample questions in path queries.
299
+
300
+ <table><tr><td rowspan=1 colspan=1>#</td><td rowspan=1 colspan=1>Relation</td><td rowspan=1 colspan=1>Type</td><td rowspan=1 colspan=1>Sample question</td><td rowspan=1 colspan=1>Sample answer</td></tr><tr><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>plays_in_club</td><td rowspan=1 colspan=1>many-to-one</td><td rowspan=1 colspan=1>which club doesalan pulido play for ?which professional footbal team does klaas jan huntelar play for ?</td><td rowspan=1 colspan=1>tigres_uanlfc_schalke_04</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>plays-position</td><td rowspan=1 colspan=1>many-to-one</td><td rowspan=1 colspan=1>what position does gonzalo higuain play ?</td><td rowspan=1 colspan=1>ssc_napoli</td></tr><tr><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>is_aged</td><td rowspan=1 colspan=1>many-to-one</td><td rowspan=1 colspan=1>how old is samuel etoo ?what is the age of luis suarez ?</td><td rowspan=1 colspan=1>3</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>wears-number</td><td rowspan=1 colspan=1>many-to-one</td><td rowspan=1 colspan=1>what is the jersey number of mario balotelli ?what number does shinji okazaki wear ?</td><td rowspan=1 colspan=1>:</td></tr><tr><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>plays_for_country</td><td rowspan=1 colspan=1>many-to-one</td><td rowspan=1 colspan=1>which country is thomas mueller from ?what is the nationality of helder postiga ?</td><td rowspan=1 colspan=1>germanyportugal</td></tr><tr><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>is.in_country</td><td rowspan=1 colspan=1>many-to-one</td><td rowspan=1 colspan=1>which country is the soccer team fc porto based in ?</td><td rowspan=1 colspan=1>portugal</td></tr><tr><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>plays_in_club-1</td><td rowspan=1 colspan=1>one-to-many</td><td rowspan=1 colspan=1>who playsprofessionally at liverpool fc ?name a player from as roma ?</td><td rowspan=1 colspan=1>steven_gerrardmiralem_pjanic</td></tr><tr><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>plays-for_country-1</td><td rowspan=1 colspan=1>one-to-many</td><td rowspan=1 colspan=1>which player is from iran ?name a player from italy ?</td><td rowspan=1 colspan=1>masoud_shojaeidaniele_de_rossi</td></tr><tr><td rowspan=1 colspan=1>9</td><td rowspan=1 colspan=1>plays-position-1</td><td rowspan=1 colspan=1>one-to-many</td><td rowspan=1 colspan=1>name a player who plays goalkeeper ?who plays forward ?</td><td rowspan=1 colspan=1>gianluiqi-buffonraul_jimenez</td></tr><tr><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>is_in-country-1</td><td rowspan=1 colspan=1>one-to-many</td><td rowspan=1 colspan=1>which soccer club is based in mexico ?name a soccer club in australia ?</td><td rowspan=1 colspan=1>cruz_azul.fcmelbourne_victory_fc</td></tr><tr><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>plays_in_club /is_in_country</td><td rowspan=1 colspan=1>many-to-one</td><td rowspan=1 colspan=1>where is the club that edin dzeko plays for ?which country does sime vrsaljko play professionally in ?</td><td rowspan=1 colspan=1>englanditaly</td></tr><tr><td rowspan=1 colspan=1>12</td><td rowspan=1 colspan=1>plays-for_country-1/plays_in_club</td><td rowspan=1 colspan=1>many-to-many</td><td rowspan=1 colspan=1>name a soccer club that has a player from australia?name a soccer club that has a player from spain ?</td><td rowspan=1 colspan=1>crystal_palace_fcfc_barcelona</td></tr></table>
301
+
302
+ Table 7: Conjunctive queries and sample questions.
303
+
304
+ <table><tr><td>#</td><td>Relations</td><td>Sample questions</td><td>Entities in questions</td><td>Sampleanswer</td></tr><tr><td>13</td><td>plays_position-1 and plays_in_club-1</td><td>who plays forward for fc barcelona ? who are the midfielders at fc bayern muenchen ?</td><td>forward,fc_barcelona midfielder,fc_bayern_muenchen</td><td>lionel_messi toni_kroos</td></tr><tr><td>14</td><td>plays-position -1 and</td><td>who are the defenders on german national team ? which mexican footballer plays forward ?</td><td>defender,germany defender,mexico</td><td>per_mertesacker raul-jimenez</td></tr><tr><td>15</td><td>plays_in_club-1 and plays_for_country -1</td><td>which player in paris saint-germain fc is from argentina ? who are the korean players at beijing guoan ?</td><td>paris_saint-germain_fc,argentina beijing-guoan,korea</td><td>ezequiel_lavezzi ha-daesung</td></tr></table>
305
+
306
+ # B TRANSGAUSSIAN EMBEDDING OF WORLDCUP2014
307
+
308
+ We trained our TransGaussian model on triplets and paths from WorldCup2014 dataset and illustrated the embeddings in Fig 3 and 4. Recall that we modeled every relation as a Gaussian with diagonal covariance matrix. Fig 3 shows the learned variance parameters of different relations. Each row corresponds to the variances of one relation. Columns are permuted to reveal the block structure. From this figure, we can see that every relation has a small variance in two or more dimensions. This implies that the coordinates of the embedding space are partitioned into semantically coherent clusters each of which represent a particular attribute of a player (or a football club). To verify this further, we picked the two coordinates in which a relation (e.g. plays position) has the least variance and projected the embedding of all valid subjects and objects (e.g. players and positions) of the relation to this 2 dimensional subspace. See Fig. 4. The relation between the subjects and the objects are simply translation in the projection when the corresponding subspace is two dimensional (e.g., plays position relation in Fig. 4 (a)). The same is true for other relations that requires larger dimension but it is more challenging to visualize in two dimensions. For relations that have a large number of unique objects, we only plotted for the eight objects with the most subjects for clarity of illustration.
309
+
310
+ Furthermore, in order to elucidate whether we are limited by the capacity of the TransGaussian embedding or the ability to decode question expressed in natural language, we evaluated the test question-answer pairs using the TransGaussian embedding composed according to the ground-truth relations and entities. The results were evaluated with the same metrics as in Sec. 4.3. This estimation is conducted for TransE embeddings as well. See Table 8 for the results. Compared to Table 2, the accuracy of TransGaussian (COMP) is higher on the atomic relations and path queries but lower on conjunctive queries. This is natural because when the query is simple there is not much room for the question-answering network to improve upon just combining the relations according to the ground truth relations, whereas when the query is complex the network could combine the embedding in a more creative way to overcome its limitation. In fact, the two queries (#10 and #12) that TransGaussian (COMP) did not perform well in Table 2 pertain to a single relation is in country−1 (#10) and a composition of two relations plays for country $^ - 1 \ /$ plays in club (#12). The performance of the two queries were low even when the ground truth
311
+
312
+ ![](images/dcac266cd0111b767c6f604dadfa93e9478ad13210e7862e4fc0a7fbd0595157.jpg)
313
+ Figure 3: Variance of each relation. Each row shows the diagonal values in the variance matrix associated with a relation. Columns are permuted to reveal the block structure.
314
+
315
+ Table 8: Evaluation of embeddings. We evaluate the embeddings by feeding the correct entities and relations from a path or conjunctive query to an embedding model and using its scoring function to retrieve the answers from the embedded knowledge base.
316
+
317
+ <table><tr><td></td><td></td><td colspan="2">TransE (SINGLE)</td><td colspan="2">TransE (COMP)</td><td colspan="2">TransGaussian (SINGLE)</td><td colspan="2">TransGaussian (COMP)</td></tr><tr><td>#</td><td>Relation</td><td>H@1(%)</td><td>Mean Filtered Rank</td><td>H@1(%)</td><td>Mean Filtered Rank</td><td>H@1(%)</td><td>Mean Filtered Rank</td><td>H@1(%)</td><td>Mean Filtered Rank</td></tr><tr><td>1</td><td>plays.in.club</td><td>75.54</td><td>1.38</td><td>93.48</td><td>1.09</td><td>99.86</td><td>1.00</td><td>98.51</td><td>1.02</td></tr><tr><td>2</td><td>plays-position</td><td>96.33</td><td>1.04</td><td>94.02</td><td>1.09</td><td>98.37</td><td>1.02</td><td>100.00</td><td>1.00</td></tr><tr><td>3</td><td>is_aged</td><td>55.03</td><td>1.69</td><td>91.44</td><td>1.12</td><td>96.88</td><td>1.03</td><td>100.00</td><td>1.00</td></tr><tr><td>4</td><td>wears_number</td><td>38.86</td><td>2.09</td><td>78.67</td><td>1.32</td><td>95.92</td><td>1.04</td><td>100.00</td><td>1.00</td></tr><tr><td>5</td><td>plays_for_country</td><td>71.60</td><td>1.39</td><td>94.84</td><td>1.10</td><td>99.32</td><td>1.01</td><td>100.00</td><td>1.00</td></tr><tr><td>6</td><td>is_in_country</td><td>98.32</td><td>1.03</td><td>99.66</td><td>1.00</td><td>99.33</td><td>1.01</td><td>100.00</td><td>1.00</td></tr><tr><td>7</td><td>plays_in_club-1</td><td>87.50</td><td>1.46</td><td>83.42</td><td>1.45</td><td>94.70</td><td>1.07</td><td>97.42</td><td>1.03</td></tr><tr><td>8</td><td></td><td>82.47</td><td>1.68</td><td>68.21</td><td>3.37</td><td>25.27</td><td>5.66</td><td>98.78</td><td>1.02</td></tr><tr><td>9</td><td>plays-position-1</td><td>100.00</td><td>1.00</td><td>75.54</td><td>1.60</td><td>13.59</td><td>24.35</td><td>98.78</td><td>1.02</td></tr><tr><td>10</td><td>is_in-country-1</td><td>23.11</td><td>26.92</td><td>23.48</td><td>23.27</td><td>8.32</td><td>130.59</td><td>19.41</td><td>83.61</td></tr><tr><td>11</td><td>plays_in_club/is_in-country</td><td>20.24</td><td>7.05</td><td>58.29</td><td>1.98</td><td>46.88</td><td>2.99</td><td>80.16</td><td>1.38</td></tr><tr><td>12</td><td>plays-for_country -1/plays-in_club</td><td>25.32</td><td>22.27</td><td>27.73</td><td>10.04</td><td>19.04</td><td>35.59</td><td>20.15</td><td>33.01</td></tr><tr><td colspan="2">Overall(Path relations) plays-position-1</td><td>64.64</td><td>5.09</td><td>75.02</td><td>3.59</td><td>67.22</td><td>14.87</td><td>86.73</td><td>8.79</td></tr><tr><td>13</td><td>and plays-in_club-1 plays-position</td><td>91.85</td><td>1.20</td><td>69.97</td><td>1.82</td><td>77.45</td><td>1.83</td><td>95.38</td><td>1.06</td></tr><tr><td>14</td><td>and plays_in_club =T</td><td>91.71</td><td>1.23</td><td>66.71</td><td>2.85</td><td>51.49</td><td>4.88</td><td>97.83</td><td>1.05</td></tr><tr><td>15</td><td>and is_in_country -1</td><td>88.59</td><td>1.20</td><td>73.37 70.02</td><td>1.80 2.16</td><td>83.42</td><td>1.34</td><td>94.70</td><td>1.08</td></tr><tr><td colspan="2">Overall (Conj.relations)</td><td>90.72</td><td>1.21</td><td></td><td></td><td>70.79</td><td>2.68</td><td>95.97</td><td>1.06</td></tr></table>
318
+
319
+ relations were given, which indicates that the TransGaussian embedding rather than the questionanswering network is the limiting factor.
320
+
321
+ # C KNOWLEDGE BASE COMPLETION
322
+
323
+ Knowledge base completion has been a common task for testing knowledge base models on their ability of generalizing to unseen facts. Here, we apply our TransGaussian model to a knowledge completion task and show that it has competitive performance.
324
+
325
+ We tested on the subset of WordNet released by Guu et al. (2015). The atomic triplets in this dataset was originally created by Socher et al. (2013) and Guu et al. (2015) added path queries that were randomly sampled from the knowledge graph. We build our TransGaussian model by training on these triplets and paths and tested our model on the same link prediction task as done by Socher et al. (2013); Guu et al. (2015).
326
+
327
+ As done by Guu et al. (2015), we trained TransGaussian (SINGLE) with atomic triplets only and trained TransGaussian (COMP) with the union of atomic triplets and paths. We did not incorporate word embedding in this task and each entity is assigned its individual vector. Without getting parameters tuned too much, TransGaussian (COMP) obtained accuracy comparable to TransE (COMP). See Table 11.
328
+
329
+ ![](images/4a25b8273f36037ebd611825cf1990cec4dc4df993551c3f676718009d7fca5b.jpg)
330
+ Figure 4: TransGaussian entity embeddings. Crosses are the subjects and circles are the objects of a relation. Specifically, crosses are players in (a)-(e) and professional football clubs in (f).
331
+
332
+ Table 9: Experimental results of path queries on WorldCup2014.
333
+
334
+ <table><tr><td></td><td></td><td>TransE (SINGLE)</td><td>TransE (COMP)</td><td></td><td>TransGaussian (SINGLE)</td><td>TransGaussian (COMP)</td><td></td></tr><tr><td>#</td><td>Relation and sample question</td><td>Mean H@1(%)Filtered Rank</td><td>H@1(%)</td><td>Mean Filtered Rank</td><td>Mean H@1(%) Filtered Rank</td><td>H@1(%)</td><td>Mean Filtered Rank</td></tr><tr><td>1</td><td>plays.in_club (which club does alan pulido play for?)</td><td>90.60 1.12</td><td>92.62</td><td>1.11</td><td>96.64 1.03</td><td>97.99</td><td>1.03</td></tr><tr><td>2</td><td>plays-position (what position does gonzalo higuain play?)</td><td>100.00 1.00</td><td>98.11</td><td>1.02</td><td>98.74 1.01</td><td>100.00</td><td>1.00</td></tr><tr><td>3</td><td>is_aged (how old is samuel etoo?)</td><td>81.58 1.30</td><td>92.11</td><td>1.10</td><td>96.05 1.04</td><td>100.00</td><td>1.00</td></tr><tr><td>4</td><td>wears_number (what is the jersey number of mario balotelli?)</td><td>44.29 1.88</td><td>85.71</td><td>1.19</td><td>96.43 1.04</td><td>100.00</td><td>1.00</td></tr><tr><td>5</td><td>plays-for-country (which country is thomas mueller from ?)</td><td>97.60 1.02</td><td>94.40</td><td>1.11</td><td>98.40 1.02</td><td>99.20</td><td>1.01</td></tr><tr><td>6</td><td>is_in.country (which country is the soccer team fc porto based in ?)</td><td>98.48 1.02</td><td>98.48</td><td>1.02</td><td>93.94 1.08</td><td>98.48</td><td>1.02</td></tr><tr><td>7</td><td>plays_in_club-1 (who plays professionally at liverpool fc?)</td><td>95.12 1.08</td><td>86.99</td><td>1.38</td><td>96.75 1.03</td><td>96.75</td><td>1.03</td></tr><tr><td>8</td><td>plays_for_country (which player is from iran?)</td><td>81.16 1.61</td><td>72.46</td><td>2.36</td><td>40.58 3.19</td><td>93.24</td><td>1.48</td></tr><tr><td>9</td><td>plays-position (name a player who plays goalkeeper?)</td><td>100.00 1.00</td><td>30.21</td><td>2.30</td><td>55.21 5.09</td><td>85.42</td><td>1.15</td></tr><tr><td>10</td><td>is.in_country (which soccer club is based in mexico?)</td><td>24.58 11.47</td><td>23.73</td><td>10.07</td><td>5.08 9.18</td><td>17.80</td><td>20.10</td></tr><tr><td>11</td><td>plays_in_club/is_in_country (where is the club that edin dzeko plays for ?)</td><td>48.68 4.24</td><td>62.50</td><td>2.07</td><td>48.03 2.41</td><td>76.97</td><td>1.50</td></tr><tr><td>12</td><td>plays-for-country-1/plays-in-club (name a soccer club that hasaplayer from australia ?)</td><td>34.78 9.49</td><td>30.43</td><td>11.26</td><td>6.52 9.88</td><td>16.30</td><td>20.27</td></tr><tr><td colspan="2">Overall</td><td>74.92 2.80</td><td>74.35</td><td>2.71</td><td>70.17</td><td>2.82 84.42</td><td>3.68</td></tr></table>
335
+
336
+ Table 10: Experimental results of conjunctive queries on WorldCup2014.
337
+
338
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>TransE(SINGLE)</td><td rowspan=1 colspan=1>TransE(COMP)</td><td rowspan=1 colspan=1>TransGaussian(SINGLE)</td><td rowspan=1 colspan=1>TransGaussian(COMP)</td></tr><tr><td rowspan=1 colspan=1>#</td><td rowspan=1 colspan=1>Relation and sample question</td><td rowspan=1 colspan=1>MeanH@1(%)FilteredRank</td><td rowspan=1 colspan=1>MeanH@1(%)FilteredRank</td><td rowspan=1 colspan=1>MeanH@1(%)FilteredRank</td><td rowspan=1 colspan=1>MeanH@1(%)FilteredRank</td></tr><tr><td rowspan=1 colspan=1>13</td><td rowspan=1 colspan=1>(who plays forward for fc barcelona?)</td><td rowspan=1 colspan=1>94.48 1.10</td><td rowspan=1 colspan=1>71.17 1.77</td><td rowspan=1 colspan=1>87.12 1.37</td><td rowspan=1 colspan=1>98.77 1.02</td></tr><tr><td rowspan=1 colspan=1>14</td><td rowspan=1 colspan=1>plays-position-and plays-for-country-1(who are the defenders on german national team?)</td><td rowspan=1 colspan=1>95.93 1.08</td><td rowspan=1 colspan=1>76.42 2.50</td><td rowspan=1 colspan=1>64.23 2.02</td><td rowspan=1 colspan=1>100.00 1.00</td></tr><tr><td rowspan=1 colspan=1>15</td><td rowspan=1 colspan=1>plays_in_club-1andis_in_country(which player in ssc napoli is from argentina?)</td><td rowspan=1 colspan=1>91.79 1.13</td><td rowspan=1 colspan=1>75.37 1.75</td><td rowspan=1 colspan=1>88.06 1.37</td><td rowspan=1 colspan=1>94.03 1.07</td></tr><tr><td rowspan=1 colspan=2>Overall</td><td rowspan=1 colspan=1>94.05 1.11</td><td rowspan=1 colspan=1>74.05 1.97</td><td rowspan=1 colspan=1>80.71 1.56</td><td rowspan=1 colspan=1>97.62 1.03</td></tr></table>
339
+
340
+ Table 11: Accuracy of knowledge base completion on WordNet.
341
+
342
+ <table><tr><td>Model</td><td>Accuracy (%)</td></tr><tr><td>TransE (SINGLE)</td><td>68.5</td></tr><tr><td>TransE (COMP)</td><td>80.3</td></tr><tr><td>TransGaussian (SINGLE)</td><td>58.4</td></tr><tr><td>TransGaussian (COMP)</td><td>76.4</td></tr></table>
md/train/ByJHuTgA-/ByJHuTgA-.md ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ON THE STATE OF THE ART OF EVALUATION IN NEURAL LANGUAGE MODELS
2
+
3
+ Gabor Melis´ †, Chris Dyer†, Phil Blunsom†‡
4
+ {melisgl,cdyer,pblunsom}@google.com
5
+ †DeepMind
6
+ ‡University of Oxford
7
+
8
+ # ABSTRACT
9
+
10
+ Ongoing innovations in recurrent neural network architectures have provided a steady influx of apparently state-of-the-art results on language modelling benchmarks. However, these have been evaluated using differing codebases and limited computational resources, which represent uncontrolled sources of experimental variation. We reevaluate several popular architectures and regularisation methods with large-scale automatic black-box hyperparameter tuning and arrive at the somewhat surprising conclusion that standard LSTM architectures, when properly regularised, outperform more recent models. We establish a new state of the art on the Penn Treebank and Wikitext-2 corpora, as well as strong baselines on the Hutter Prize dataset.
11
+
12
+ # 1 INTRODUCTION
13
+
14
+ The scientific process by which the deep learning research community operates is guided by empirical studies that evaluate the relative quality of models. Complicating matters, the measured performance of a model depends not only on its architecture (and data), but it can strongly depend on hyperparameter values that affect learning, regularisation, and capacity. This hyperparameter dependence is an often inadequately controlled source of variation in experiments, which creates a risk that empirically unsound claims will be reported.
15
+
16
+ In this paper, we use a black-box hyperparameter optimisation technique to control for hyperparameter effects while comparing the relative performance of language modelling architectures based on LSTMs, Recurrent Highway Networks (Zilly et al., 2016) and NAS (Zoph & Le, 2016). We specify flexible, parameterised model families with the ability to adjust embedding and recurrent cell sizes for a given parameter budget and with fine grain control over regularisation and learning hyperparameters.
17
+
18
+ Once hyperparameters have been properly controlled for, we find that LSTMs outperform the more recent models, contra the published claims. Our result is therefore a demonstration that replication failures can happen due to poorly controlled hyperparameter variation, and this paper joins other recent papers in warning of the under-acknowledged existence of replication failure in deep learning (Henderson et al., 2017; Reimers & Gurevych, 2017). However, we do show that careful controls are possible, albeit at considerable computational cost.
19
+
20
+ Several remarks can be made in light of these results. First, as (conditional) language models serve as the central building block of many tasks, including machine translation, there is little reason to expect that the problem of unreliable evaluation is unique to the tasks discussed here. However, in machine translation, carefully controlling for hyperparameter effects would be substantially more expensive because standard datasets are much larger. Second, the research community should strive for more consensus about appropriate experimental methodology that balances costs of careful experimentation with the risks associated with false claims. Finally, more attention should be paid to hyperparameter sensitivity. Models that introduce many new hyperparameters or which perform well only in narrow ranges of hyperparameter settings should be identified as such as part of standard publication practice.
21
+
22
+ ![](images/f81bf295401ea1f5d33b190a8279a379b919f6538c1f3652283719438ad90409.jpg)
23
+ Figure 1: Recurrent networks with optional down-projection (trapezoids), per-step and per-sequence dropout (dashed and solid lines).
24
+
25
+ # 2 MODELS
26
+
27
+ Our focus is on three recurrent architectures:
28
+
29
+ • The Long Short-Term Memory (Hochreiter & Schmidhuber, 1997) serves as a well known and frequently used baseline.
30
+ • The recently proposed Recurrent Highway Network (Zilly et al., 2016) is chosen because it has demonstrated state-of-the-art performance on a number of datasets.
31
+ • Finally, we also include NAS (Zoph & Le, 2016), because of its impressive performance and because its architecture was the result of an automated reinforcement learning based optimisation process.
32
+
33
+ Our aim is strictly to do better model comparisons for these architectures and we thus refrain from including techniques that are known to push perplexities even lower, but which are believed to be largely orthogonal to the question of the relative merits of these recurrent cells. In parallel work with a remarkable overlap with ours, Merity et al. (2017) demonstrate the utility of adding a Neural Cache (Grave et al., 2016). Building on their work, Krause et al. (2017) show that Dynamic Evaluation (Graves, 2013) contributes similarly to the final perplexity.
34
+
35
+ As pictured in Fig. 1a, our models with LSTM or NAS cells have all the standard components: an input embedding lookup table, recurrent cells stacked as layers with additive skip connections combining outputs of all layers to ease optimisation. There is an optional down-projection whose presence is governed by a hyperparameter from this combined output to a smaller space which reduces the number of output embedding parameters. Unless otherwise noted, input and output embeddings are shared, see (Inan et al., 2016) and (Press & Wolf, 2016).
36
+
37
+ Dropout is applied to feedforward connections denoted by dashed arrows in the figure. From the bottom up: to embedded inputs (input dropout), to connections between layers (intra-layer dropout), to the combined and the down-projected outputs (output dropout). All these dropouts have random masks drawn independently per time step, in contrast to the dropout on recurrent states where the same mask is used for all time steps in the sequence.
38
+
39
+ RHN based models are typically conceived of as a single horizontal “highway” to emphasise how the recurrent state is processed through time. In Fig. 1b, we choose to draw their schema in a way that makes the differences from LSTMs immediately apparent. In a nutshell, the RHN state is passed from the topmost layer to the lowest layer of the next time step. In contrast, each LSTM layer has its own recurrent connection and state.
40
+
41
+ The same dropout variants are applied to all three model types, with the exception of intra-layer dropout which does not apply to RHNs since only the recurrent state is passed between the layers.
42
+
43
+ For the recurrent states, all architectures use either variational dropout (Gal & Ghahramani, 2016, state dropout)1 or recurrent dropout (Semeniuta et al., 2016), unless explicitly noted otherwise.
44
+
45
+ # 3 EXPERIMENTAL SETUP
46
+
47
+ # 3.1 DATASETS
48
+
49
+ We compare models on three datasets. The smallest of them is the Penn Treebank corpus by Marcus et al. (1993) with preprocessing from Mikolov et al. (2010). We also include another word level corpus: Wikitext-2 by Merity et al. (2016). It is about twice the size of Penn Treebank with a larger vocabulary and much lighter preprocessing. The third corpus is Enwik8 from the Hutter Prize dataset (Hutter, 2012). Following common practice, we use the first 90 million characters for training, and the remaining 10 million evenly split between validation and test.
50
+
51
+ # 4 TRAINING DETAILS
52
+
53
+ When training word level models we follow common practice and use a batch size of 64, truncated backpropagation with 35 time steps, and we feed the final states from the previous batch as the initial state of the subsequent one. At the beginning of training and test time, the model starts with a zero state. To bias the model towards being able to easily start from such a state at test time, during training, with probability 0.01 a constant zero state is provided as the initial state.
54
+
55
+ Optimisation is performed by Adam (Kingma & Ba, 2014) with $\beta _ { 1 } ~ = ~ 0$ but otherwise default parameters $( \beta _ { 2 } ~ = ~ 0 . 9 9 9$ , $\epsilon { \bf \bar { \alpha } } = 1 0 ^ { - 9 } $ ). Setting $\beta _ { 1 }$ so turns off the exponential moving average for the estimates of the means of the gradients and brings Adam very close to RMSProp without momentum, but due to Adam’s bias correction, larger learning rates can be used.
56
+
57
+ Batch size is set to 64. The learning rate is multiplied by 0.1 whenever validation performance does not improve ever during 30 consecutive checkpoints. These checkpoints are performed after every 100 and 200 optimization steps for Penn Treebank and Wikitext-2, respectively.
58
+
59
+ For character level models (i.e. Enwik8), the differences are: truncated backpropagation is performed with 50 time steps. Adam’s parameters are $\beta _ { 2 } ~ = ~ 0 . 9 9$ , $\epsilon = 1 0 ^ { - 5 }$ . Batch size is 128. Checkpoints are only every 400 optimisation steps and embeddings are not shared.
60
+
61
+ # 5 EVALUATION
62
+
63
+ For evaluation, the checkpoint with the best validation perplexity found by the tuner is loaded and the model is applied to the test set with a batch size of 1. For the word based datasets, using the training batch size makes results worse by $0 . 3 \ : \mathrm { P P L }$ while Enwik8 is practically unaffected due to its evaluation and training sets being much larger. Preliminary experiments indicate that MC averaging would bring a small improvement of about 0.4 in perplexity and 0.005 in bits per character, similar to the results of Gal & Ghahramani (2016), while being a 1000 times more expensive which is prohibitive on larger datasets. Therefore, throughout we use the mean-field approximation for dropout at test time.
64
+
65
+ # 5.1 HYPERPARAMETER TUNING
66
+
67
+ Hyperparameters are optimised by Google Vizier (Golovin et al., 2017), a black-box hyperparameter tuner based on batched GP bandits using the expected improvement acquisition function (Desautels et al., 2014). Tuners of this nature are generally more efficient than grid search when the number of hyperparameters is small. To keep the problem tractable, we restrict the set of hyperparameters to learning rate, input embedding ratio, input dropout, state dropout, output dropout, weight decay. For deep LSTMs, there is an extra hyperparameter to tune: intra-layer dropout. Even with this small set, thousands of evaluations are required to reach convergence.
68
+
69
+ Table 1: Validation and test set perplexities on Penn Treebank for models with different numbers of parameters and depths. All results except those from Zaremba are with shared input and output embeddings. VD stands for Variational Dropout from Gal & Ghahramani (2016). †: parallel work.
70
+
71
+ <table><tr><td>Model</td><td>Size</td><td>Depth</td><td>Valid</td><td>Test</td></tr><tr><td>Medium LSTM, Zaremba et al. (2014)</td><td>10M</td><td>2</td><td>86.2</td><td>82.7</td></tr><tr><td>Large LSTM, Zaremba et al. (2014)</td><td>24M</td><td>2</td><td>82.2</td><td>78.4</td></tr><tr><td>VD LSTM,Press &amp; Wolf (2016)</td><td>51M</td><td>2</td><td>75.8</td><td>73.2</td></tr><tr><td>VD LSTM, Inan et al. (2016)</td><td>9M</td><td>2</td><td>77.1</td><td>73.9</td></tr><tr><td>VD LSTM, Inan et al. (2016)</td><td>28M</td><td>2</td><td>72.5</td><td>69.0</td></tr><tr><td>VD RHN, Zilly et al. (2016)</td><td>24M</td><td>10</td><td>67.9</td><td>65.4</td></tr><tr><td>NAS, Zoph &amp; Le (2016)</td><td>25M</td><td>-</td><td></td><td>64.0</td></tr><tr><td>NAS, Zoph &amp; Le (2016)</td><td>54M</td><td>1</td><td>=</td><td>62.4</td></tr><tr><td>AWD-LSTM, Merity et al. (2017) +</td><td>24M</td><td>3</td><td>60.0</td><td>57.3</td></tr><tr><td>LSTM</td><td rowspan="6">10M</td><td>1</td><td>61.8</td><td>59.6</td></tr><tr><td>LSTM</td><td>2</td><td>63.0</td><td>60.8</td></tr><tr><td>LSTM</td><td>4</td><td>62.4</td><td>60.1</td></tr><tr><td>RHN</td><td>5</td><td>66.0</td><td>63.5</td></tr><tr><td>NAS</td><td>1</td><td>65.6</td><td>62.7</td></tr><tr><td>LSTM</td><td>1</td><td>61.4</td><td>59.5</td></tr><tr><td>LSTM</td><td></td><td></td><td>62.1</td><td>59.6</td></tr><tr><td>LSTM</td><td>24M</td><td>2 4</td><td>60.9</td><td>58.3</td></tr><tr><td>RHN</td><td></td><td>5</td><td>64.8</td><td>62.2</td></tr><tr><td>NAS</td><td></td><td>1</td><td>62.1</td><td>59.7</td></tr></table>
72
+
73
+ Parameter budget. Motivated by recent results from Collins et al. (2016), we compare models on the basis of the total number of trainable parameters as opposed to the number of hidden units. The tuner is given control over the presence and size of the down-projection, and thus over the tradeoff between the number of embedding vs. recurrent cell parameters. Consequently, the cells’ hidden size and the embedding size is determined by the actual parameter budget, depth and the input embedding ratio hyperparameter.
74
+
75
+ For Enwik8 there are relatively few parameters in the embeddings since the vocabulary size is only 205. Here we choose not to share embeddings and to omit the down-projection unconditionally.
76
+
77
+ # 6 RESULTS
78
+
79
+ # 6.1 PENN TREEBANK
80
+
81
+ We tested LSTMs of various depths and an RHN of depth 5 with parameter budgets of 10 and 24 million matching the sizes of the Medium and Large LSTMs by (Zaremba et al., 2014). The results are summarised in Table 1.
82
+
83
+ Notably, in our experiments even the RHN with only 10M parameters has better perplexity than the 24M one in the original publication. Our 24M version improves on that further. However, a shallow LSTM-based model with only 10M parameters enjoys a very comfortable margin over that, with deeper models following near the estimated noise range. At 24M, all depths obtain very similar results, reaching 58.3 at depth 4. Unsurprisingly, NAS whose architecture was chosen based on its performance on this dataset does almost equally well, even better than in Zoph & Le (2016).
84
+
85
+ # 6.2 WIKITEXT-2
86
+
87
+ Wikitext-2 is not much larger than Penn Treebank, so it is not surprising that even models tuned for Penn Treebank perform reasonably on this dataset, and this is in fact how results in previous works were produced. For a fairer comparison, we also tune hyperparameters on the same dataset. In Table 2, we report numbers for both approaches. All our results are well below the previous state of the are for models without dynamic evaluation or caching. That said, our best result, 65.9 compares favourably even to the Neural Cache (Grave et al., 2016) whose innovations are fairly orthogonal to the base model.
88
+
89
+ <table><tr><td>Model</td><td>Size</td><td>Depth</td><td>Valid</td><td>Test</td></tr><tr><td>VD LSTM, Merity et al. (2016)</td><td>20M</td><td>2</td><td>101.7</td><td>96.3</td></tr><tr><td>VD+Zoneout LSTM, Merity et al. (2016)</td><td>20M</td><td>2</td><td>108.7</td><td>100.9</td></tr><tr><td>VD LSTM, Inan et al. (2016)</td><td>22M</td><td>2</td><td>91.5</td><td>87.7</td></tr><tr><td>AWD-LSTM, Merity et al. (2017) t</td><td>33M</td><td>3</td><td>68.6</td><td>65.8</td></tr><tr><td>LSTM (tuned for PTB)</td><td></td><td>1</td><td>88.4</td><td>83.2</td></tr><tr><td>LSTM</td><td></td><td>1</td><td>72.7</td><td>69.1</td></tr><tr><td>LSTM</td><td>10M</td><td>2</td><td>73.8</td><td>70.7</td></tr><tr><td>LSTM</td><td></td><td>4</td><td>78.3</td><td>74.3</td></tr><tr><td>RHN</td><td></td><td>5</td><td>83.5</td><td>79.5</td></tr><tr><td>NAS</td><td></td><td>1</td><td>79.6</td><td>75.9</td></tr><tr><td>LSTM (tuned for PTB)</td><td></td><td>1</td><td>79.8</td><td>76.3</td></tr><tr><td>LSTM</td><td></td><td>1</td><td>69.3</td><td>65.9</td></tr><tr><td>LSTM</td><td>24M</td><td>2</td><td>69.1</td><td>65.9</td></tr><tr><td>LSTM</td><td></td><td>4</td><td>70.5</td><td>67.6</td></tr><tr><td>RHN</td><td></td><td>5</td><td>78.1</td><td>75.6</td></tr><tr><td>NAS</td><td></td><td>1</td><td>73.0</td><td>69.8</td></tr></table>
90
+
91
+ Table 2: Validation and test set perplexities on Wikitext-2. All results are with shared input and output embeddings. †: parallel work.
92
+
93
+ Shallow LSTMs do especially well here. Deeper models have gradually degrading perplexity, with RHNs lagging all of them by a significant margin. NAS is not quite up there with the LSTM suggesting its architecture might have overfitted to Penn Treebank, but data for deeper variants would be necessary to draw this conclusion.
94
+
95
+ # 6.3 ENWIK8
96
+
97
+ In contrast to the previous datasets, our numbers on this task (reported in BPC, following convetion) are slightly off the state of the art. This is most likely due to optimisation being limited to 14 epochs which is about a tenth of what the model of Zilly et al. (2016) was trained for. Nevertheless, we match their smaller RHN with our models which are very close to each other. NAS lags the other models by a surprising margin at this task.
98
+
99
+ # 7 ANALYSIS
100
+
101
+ On two of the three datasets, we improved previous results substantially by careful model specification and hyperparameter optimisation, but the improvement for RHNs is much smaller compared to that for LSTMs. While it cannot be ruled out that our particular setup somehow favours LSTMs, we believe it is more likely that this effect arises due to the original RHN experimental condition having been tuned more extensively (this is nearly unavoidable during model development).
102
+
103
+ Naturally, NAS benefitted only to a limited degree from our tuning, since the numbers of Zoph & Le (2016) were already produced by employing similar regularisation methods and a grid search. The small edge can be attributed to the suboptimality of grid search (see Section 7.3).
104
+
105
+ In summary, the three recurrent cell architectures are closely matched on all three datasets, with minuscule differences on Enwik8 where regularisation matters the least. These results support the claims of Collins et al. (2016), that capacities of various cells are very similar and their apparent differences result from trainability and regularisation. While comparing three similar architectures cannot prove this point, the inclusion of NAS certainly gives it more credence. This way we have two of the best human designed and one machine optimised cell that was the top performer among thousands of candidates.
106
+
107
+ Table 3: Validation and test set BPCs on Enwik8 from the Hutter Prize dataset.
108
+
109
+ <table><tr><td>Model</td><td>Size</td><td>Depth</td><td>Valid</td><td>Test</td></tr><tr><td>Stacked LSTM, Graves (2013)</td><td>21M</td><td>7</td><td></td><td>1.67</td></tr><tr><td>Grid LSTM, Kalchbrenner et al. (2015)</td><td>17M</td><td>6</td><td></td><td>1.47</td></tr><tr><td>MI-LSTM, Wu et al. (2016)</td><td>17M</td><td>1</td><td>=</td><td>1.44</td></tr><tr><td>LN HM-LSTM, Chung et al. (2016)</td><td>35M</td><td>3</td><td></td><td>1.32</td></tr><tr><td>ByteNet, Kalchbrenner et al. (2016)</td><td>-</td><td>25</td><td></td><td>1.31</td></tr><tr><td>VD RHN, Zilly et al. (2016)</td><td>23M</td><td>5</td><td></td><td>1.31</td></tr><tr><td>VD RHN, Zilly et al. (2016)</td><td>21M</td><td>10</td><td></td><td>1.30</td></tr><tr><td>VD RHN, Zilly et al. (2016)</td><td>46M</td><td>10</td><td></td><td>1.27</td></tr><tr><td>LSTM</td><td></td><td>4</td><td>1.29</td><td>1.31</td></tr><tr><td>RHN</td><td>27M</td><td>5</td><td>1.30</td><td>1.31</td></tr><tr><td>NAS</td><td></td><td>4</td><td>1.38</td><td>1.40</td></tr><tr><td>LSTM</td><td>46M</td><td>4</td><td>1.28</td><td>1.30</td></tr><tr><td>RHN</td><td></td><td>5</td><td>1.29</td><td>1.30</td></tr><tr><td>NAS</td><td></td><td>4</td><td>1.32</td><td>1.33</td></tr></table>
110
+
111
+ # 7.1 THE EFFECT OF INDIVIDUAL FEATURES
112
+
113
+ Down-projection was found to be very beneficial by the tuner for some depth/budget combinations. On Penn Treebank, it improved results by about 2–5 perplexity points at depths 1 and 2 at 10M, and depth 1 at 24M, possibly by equipping the recurrent cells with more capacity. The very same models benefited from down-projection on Wikitext-2, but even more so with gaps of about 10–18 points which is readily explained by the larger vocabulary size.
114
+
115
+ We further measured the contribution of other features of the models in a series of experiments. See Table 4. To limit the number of resource used, in these experiments only individual features were evaluated (not their combinations) on Penn Treebank at the best depth for each architecture (LSTM or RHN) and parameter budget (10M or 24M) as determined above.
116
+
117
+ First, we untied input and output embeddings which made perplexities worse by about 6 points across the board which is consistent with the results of Inan et al. (2016).
118
+
119
+ Second, without variational dropout the RHN models suffer quite a bit since there remains no dropout at all in between the layers. The deep LSTM also sees a similar loss of perplexity as having intra-layer dropout does not in itself provide enough regularisation.
120
+
121
+ Third, we were also interested in how recurrent dropout (Semeniuta et al., 2016) would perform in lieu of variational dropout. Dropout masks were shared between time steps in both methods, and our results indicate no consistent advantage to either of them.
122
+
123
+ # 7.2 MODEL SELECTION
124
+
125
+ With a large number of hyperparameter combinations evaluated, the question of how much the tuner overfits arises. There are multiple sources of noise in play,
126
+
127
+ (a) non-deterministic ordering of floating-point operations in optimised linear algebra routines, (b) different initialisation seeds, (c) the validation and test sets being finite samples from a infinite population.
128
+
129
+ To assess the severity of these issues, we conducted the following experiment: models with the best hyperparameter settings for Penn Treebank and Wikitext-2 were retrained from scratch with various initialisation seeds and the validation and test scores were recorded. If during tuning, a model just got a lucky run due to a combination of (a) and (b), then retraining with the same hyperparameters but with different seeds would fail to reproduce the same good results.
130
+
131
+ There are a few notable things about the results. First, in our environment (Tensorflow with a single GPU) even with the same seed as the one used by the tuner, the effect of (a) is almost as large as that of (a) and (b) combined. Second, the variance induced by (a) and (b) together is roughly equivalent to an absolute difference of 0.4 in perplexity on Penn Treebank and 0.5 on Wikitext-2.
132
+
133
+ Table 4: Validation and test set perplexities on Penn Treebank for variants of our best LSTM and RHN models of two sizes.
134
+
135
+ <table><tr><td></td><td colspan="3">Size 10M</td><td colspan="3">Size 24M</td></tr><tr><td>Model</td><td>Depth</td><td>Valid</td><td>Test</td><td>Depth</td><td>Valid</td><td>Test</td></tr><tr><td>LSTM</td><td>1</td><td>61.8</td><td>59.6</td><td>4</td><td>60.9</td><td>58.3</td></tr><tr><td>- Shared Embeddings</td><td>1</td><td>67.6</td><td>65.2</td><td>4</td><td>65.6</td><td>63.2</td></tr><tr><td>- Variational Dropout</td><td>1</td><td>62.9</td><td>61.2</td><td>4</td><td>66.3</td><td>64.5</td></tr><tr><td>+ Recurrent Dropout</td><td>1</td><td>62.8</td><td>60.6</td><td>4</td><td>65.2</td><td>62.9</td></tr><tr><td>+ Untied gates</td><td>1</td><td>61.4</td><td>58.9</td><td>4</td><td>64.0</td><td>61.3</td></tr><tr><td>+ Tied gates</td><td>1</td><td>61.7</td><td>59.6</td><td>4</td><td>60.4</td><td>58.0</td></tr><tr><td>RHN</td><td>5</td><td>66.0</td><td>63.5</td><td>5</td><td>64.8</td><td>62.2</td></tr><tr><td>- Shared Embeddings</td><td>5</td><td>72.3</td><td>69.5</td><td>5</td><td>67.4</td><td>64.6</td></tr><tr><td>- Variational Dropout</td><td>5</td><td>74.4</td><td>71.7</td><td>5</td><td>74.7</td><td>71.7</td></tr><tr><td>+ Recurrent Dropout</td><td>5</td><td>65.5</td><td>63.0</td><td>5</td><td>63.4</td><td>61.0</td></tr></table>
136
+
137
+ Third, the validation perplexities of the best checkpoints are about one standard deviation lower than the sample mean of the reruns, so the tuner could fit the noise only to a limited degree.
138
+
139
+ Because we treat our corpora as a single sequence, test set contents are not i.i.d., and we cannot apply techniques such as the bootstrap to assess (c). Instead, we looked at the gap between validation and test scores as a proxy and observed that it is very stable, contributing variance of 0.12–0.3 perplexity to the final results on Penn Treebank and Wikitext-2, respectively.
140
+
141
+ We have not explicitly dealt with the unknown uncertainty remaining in the Gaussian Process that may affect model comparisons, apart from running it until apparent convergence. All in all, our findings suggest that a gap in perplexity of 1.0 is a statistically robust difference between models trained in this way on these datasets. The distribution of results was approximately normal with roughly the same variance for all models, so we still report numbers in a tabular form instead of plotting the distribution of results, for example in a violin plot (Hintze & Nelson, 1998).
142
+
143
+ # 7.3 SENSITIVITY
144
+
145
+ To further verify that the best hyperparameter setting found by the tuner is not a fluke, we plotted the validation loss against the hyperparameter settings. Fig. 2 shows one such typical plot, for a 4-layer LSTM. We manually restricted the ranges around the best hyperparameter values to around $1 5 - 2 5 \%$ of the entire tuneable range, and observed that the vast majority of settings in that neighbourhood produced perplexities within 3.0 of the best value. Widening the ranges further leads to quickly deteriorating results.
146
+
147
+ Satisfied that the hyperparameter surface is well behaved, we considered whether the same results could have possibly been achieved with a simple grid search. Omitting input embedding ratio because the tuner found having a down-projection suboptimal almost non-conditionally for this 4-layer LSTM, there remain six hyperparameters to tune. If there were 5 possible values on the grid for each hyperparameter (with one value in every $20 \%$ interval), then we would need $6 ^ { 5 }$ , nearly 8000 trials to get within 3.0 of the best perplexity achieved by the tuner in about 1500 trials.
148
+
149
+ # 7.4 TYING LSTM GATES
150
+
151
+ Normally, LSTMs have two independent gates controlling the retention of cell state and the admission of updates (Eq. 1). A minor variant which reduces the number of parameters at the loss of some flexibility is to tie the input and forget gates as in Eq. 2. A possible middle ground that keeps the number of parameters the same but ensures that values of the cell state $c$ remain in $[ - 1 , 1 ]$ is to cap
152
+
153
+ ![](images/eb7379d157cdc01f200e679d713c2374479d6c1a24ea6a64991bd147e3141cc8.jpg)
154
+ Figure 2: Average per-word negative log-likelihoods of hyperparameter combinations in the neighbourhood of the best solution for a 4-layer LSTM with 24M weights on the Penn Treebank dataset.
155
+
156
+ the input gate as in Eq. 3.
157
+
158
+ $$
159
+ \begin{array} { r l } & { \mathbf { c } _ { t } = \mathbf { f } _ { t } \odot \mathbf { c } _ { t - 1 } + \mathbf { i } _ { t } \odot \mathbf { j } _ { t } } \\ & { \mathbf { c } _ { t } = \mathbf { f } _ { t } \odot \mathbf { c } _ { t - 1 } + \left( 1 - \mathbf { f } _ { t } \right) \odot \mathbf { j } _ { t } } \\ & { \mathbf { c } _ { t } = \mathbf { f } _ { t } \odot \mathbf { c } _ { t - 1 } + \operatorname* { m i n } ( 1 - \mathbf { f } _ { t } , \mathbf { i } _ { t } ) \odot \mathbf { j } _ { t } } \end{array}
160
+ $$
161
+
162
+ Where the equations are based on the formulation of Sak et al. (2014). All LSTM models in this paper use the third variant, except those titled “Untied gates” and “Tied gates” in Table 4 corresponding to Eq. 1 and 2, respectively.
163
+
164
+ The results show that LSTMs are insensitive to these changes and the results vary only slightly even though more hidden units are allocated to the tied version to fill its parameter budget. Finally, the numbers suggest that deep LSTMs benefit from bounded cell states.
165
+
166
+ # 8 CONCLUSION
167
+
168
+ During the transitional period when deep neural language models began to supplant their shallower predecessors, effect sizes tended to be large, and robust conclusions about the value of the modelling innovations could be made, even in the presence of poorly controlled “hyperparameter noise.” However, now that the neural revolution is in full swing, researchers must often compare competing deep architectures. In this regime, effect sizes tend to be much smaller, and more methodological care is required to produce reliable results. Furthermore, with so much work carried out in parallel by a growing research community, the costs of faulty conclusions are increased.
169
+
170
+ Although we can draw attention to this problem, this paper does not offer a practical methodological solution beyond establishing reliable baselines that can be the benchmarks for subsequent work. Still, we demonstrate how, with a huge amount of computation, noise levels of various origins can be carefully estimated and models meaningfully compared. This apparent tradeoff between the amount of computation and the reliability of results seems to lie at the heart of the matter. Solutions to the methodological challenges must therefore make model evaluation cheaper by, for instance, reducing the number of hyperparameters and the sensitivity of models to them, employing better hyperparameter optimisation strategies, or by defining “leagues” with predefined computational budgets for a single model representing different points on the tradeoff curve.
171
+
172
+ # REFERENCES
173
+
174
+ Junyoung Chung, Sungjin Ahn, and Yoshua Bengio. Hierarchical multiscale recurrent neural networks. CoRR, abs/1609.01704, 2016. URL http://arxiv.org/abs/1609.01704.
175
+
176
+ Jasmine Collins, Jascha Sohl-Dickstein, and David Sussillo. Capacity and trainability in recurrent neural networks. arXiv preprint arXiv:1611.09913, 2016.
177
+
178
+ Thomas Desautels, Andreas Krause, and Joel W. Burdick. Parallelizing exploration-exploitation tradeoffs in Gaussian process bandit optimization. Journal of Machine Learning Research, 15: 4053–4103, 2014. URL http://jmlr.org/papers/v15/desautels14a.html.
179
+
180
+ Yarin Gal and Zoubin Ghahramani. A theoretically grounded application of dropout in recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 1019–1027, 2016.
181
+
182
+ Daniel Golovin, Benjamin Solnik, Subhodeep Moitra, Greg Kochanski, John Karro, and D Sculley. Google vizier: A service for black-box optimization. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 1487–1495. ACM, 2017.
183
+
184
+ Edouard Grave, Armand Joulin, and Nicolas Usunier. Improving neural language models with a continuous cache. CoRR, abs/1612.04426, 2016. URL http://arxiv.org/abs/1612. 04426.
185
+
186
+ Alex Graves. Generating sequences with recurrent neural networks. CoRR, abs/1308.0850, 2013. URL http://arxiv.org/abs/1308.0850.
187
+
188
+ Peter Henderson, Riashat Islam, Philip Bachman, Joelle Pineau, Doina Precup, and David Meger. Deep reinforcement learning that matters. arXiv preprint arXiv:1709.06560, 2017.
189
+
190
+ Jerry L Hintze and Ray D Nelson. Violin plots: a box plot-density trace synergism. The American Statistician, 52(2):181–184, 1998.
191
+
192
+ Sepp Hochreiter and Jurgen Schmidhuber. Long Short-Term Memory. ¨ Neural Computation, 9 (8):1735–1780, November 1997. ISSN 0899-7667. doi: 10.1162/neco.1997.9.8.1735. URL http://dx.doi.org/10.1162/neco.1997.9.8.1735.
193
+
194
+ Marcus Hutter. The human knowledge compression contest. 2012.
195
+
196
+ Hakan Inan, Khashayar Khosravi, and Richard Socher. Tying word vectors and word classifiers: A loss framework for language modeling. CoRR, abs/1611.01462, 2016. URL http://arxiv. org/abs/1611.01462.
197
+
198
+ Nal Kalchbrenner, Ivo Danihelka, and Alex Graves. Grid long short-term memory. CoRR, abs/1507.01526, 2015. URL http://arxiv.org/abs/1507.01526.
199
+
200
+ Nal Kalchbrenner, Lasse Espeholt, Karen Simonyan, Aaron van den Oord, Alex Graves, and Koray ¨ Kavukcuoglu. Neural machine translation in linear time. CoRR, abs/1610.10099, 2016. URL http://arxiv.org/abs/1610.10099.
201
+
202
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
203
+
204
+ Ben Krause, Emmanuel Kahembwe, Iain Murray, and Steve Renals. Dynamic evaluation of neural sequence models. arXiv preprint arXiv:1709.07432, 2017.
205
+
206
+ Mitchell P Marcus, Mary Ann Marcinkiewicz, and Beatrice Santorini. Building a large annotated corpus of english: The Penn treebank. Computational linguistics, 19(2):313–330, 1993.
207
+
208
+ Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. CoRR, abs/1609.07843, 2016. URL http://arxiv.org/abs/1609.07843.
209
+
210
+ Stephen Merity, Nitish Shirish Keskar, and Richard Socher. Regularizing and optimizing LSTM language models. CoRR, abs/1708.02182, 2017. URL http://arxiv.org/abs/1708. 02182.
211
+
212
+ Tomas Mikolov, Martin Karafiat, Lukas Burget, Jan Cernock ´ y, and Sanjeev Khudanpur. Recurrent\` neural network based language model. In Interspeech, volume 2, pp. 3, 2010.
213
+
214
+ Ofir Press and Lior Wolf. Using the output embedding to improve language models. CoRR, abs/1608.05859, 2016. URL http://arxiv.org/abs/1608.05859.
215
+
216
+ Nils Reimers and Iryna Gurevych. Reporting score distributions makes a difference: Performance study of lstm-networks for sequence tagging. CoRR, abs/1707.09861, 2017. URL http:// arxiv.org/abs/1707.09861.
217
+
218
+ 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.
219
+
220
+ Stanislau Semeniuta, Aliaksei Severyn, and Erhardt Barth. Recurrent dropout without memory loss. CoRR, abs/1603.05118, 2016. URL http://arxiv.org/abs/1603.05118.
221
+
222
+ Yuhuai Wu, Saizheng Zhang, Ying Zhang, Yoshua Bengio, and Ruslan Salakhutdinov. On multiplicative integration with recurrent neural networks. CoRR, abs/1606.06630, 2016. URL http://arxiv.org/abs/1606.06630.
223
+
224
+ Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. CoRR, abs/1409.2329, 2014. URL http://arxiv.org/abs/1409.2329.
225
+
226
+ Julian G. Zilly, Rupesh Kumar Srivastava, Jan Koutn´ık, and Jurgen Schmidhuber. Recurrent ¨ highway networks. CoRR, abs/1607.03474, 2016. URL http://arxiv.org/abs/1607. 03474.
227
+
228
+ Barret Zoph and Quoc V Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
md/train/ByMVTsR5KQ/ByMVTsR5KQ.md ADDED
@@ -0,0 +1,338 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADVERSARIAL AUDIO SYNTHESIS
2
+
3
+ Chris Donahue Department of Music UC San Diego cdonahue@ucsd.edu
4
+
5
+ Julian McAuley
6
+ Department of Computer Science UC San Diego
7
+ jmcauley@eng.ucsd.edu
8
+
9
+ Miller Puckette Department of Music UC San Diego msp@ucsd.edu
10
+
11
+ # ABSTRACT
12
+
13
+ Audio signals are sampled at high temporal resolutions, and learning to synthesize audio requires capturing structure across a range of timescales. Generative adversarial networks (GANs) have seen wide success at generating images that are both locally and globally coherent, but they have seen little application to audio generation. In this paper we introduce WaveGAN, a first attempt at applying GANs to unsupervised synthesis of raw-waveform audio. WaveGAN is capable of synthesizing one second slices of audio waveforms with global coherence, suitable for sound effect generation. Our experiments demonstrate that—without labels—WaveGAN learns to produce intelligible words when trained on a smallvocabulary speech dataset, and can also synthesize audio from other domains such as drums, bird vocalizations, and piano. We compare WaveGAN to a method which applies GANs designed for image generation on image-like audio feature representations, finding both approaches to be promising.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ Synthesizing audio for specific domains has many practical applications in creative sound design for music and film. Musicians and Foley artists scour large databases of sound effects to find particular audio recordings suitable for specific scenarios. This strategy is painstaking and may result in a negative outcome if the ideal sound effect does not exist in the library. A better approach might allow a sound artist to explore a compact latent space of audio, taking broad steps to find the types of sounds they are looking for (e.g. footsteps) and making small adjustments to latent variables to finetune (e.g. a large boot lands on a gravel path). However, audio signals have high temporal resolution, and strategies that learn such a representation must perform effectively in high dimensions.
18
+
19
+ Generative Adversarial Networks (GANs) (Goodfellow et al., 2014) are one such unsupervised strategy for mapping low-dimensional latent vectors to high-dimensional data. The potential advantages of GAN-based approaches to audio synthesis are numerous. Firstly, GANs could be useful for data augmentation (Shrivastava et al., 2017) in data-hungry speech recognition systems. Secondly, GANs could enable rapid and straightforward sampling of large amounts of audio. Furthermore, while the usefulness of generating static images with GANs is arguable, there are many applications (e.g. Foley) for which generating sound effects is immediately useful. But despite their increasing fidelity at synthesizing images (Radford et al., 2016; Berthelot et al., 2017; Karras et al., 2018), GANs have yet to be demonstrated capable of synthesizing audio in an unsupervised setting.
20
+
21
+ A na¨ıve solution for applying image-generating GANs to audio would be to operate them on imagelike spectrograms, i.e., time-frequency representations of audio. This practice of bootstrapping image recognition algorithms for audio tasks is commonplace in the discriminative setting (Hershey et al., 2017). In the generative setting however, this approach is problematic as the most perceptually-informed spectrograms are non-invertible, and hence cannot be listened to without lossy estimations (Griffin & Lim, 1984) or learned inversion models (Shen et al., 2018).
22
+
23
+ Recent work (van den Oord et al., 2016; Mehri et al., 2017) has shown that neural networks can be trained with autoregression to operate on raw audio. Such approaches are attractive as they dispense with engineered feature representations. However, unlike with GANs, the autoregressive setting results in slow generation as output audio samples must be fed back into the model one at a time.
24
+
25
+ In this work, we investigate both waveform and spectrogram strategies for generating one-second slices of audio with GANs.1 For our spectrogram approach (SpecGAN), we first design a spectrogram representation that allows for approximate inversion, and bootstrap the two-dimensional deep convolutional GAN (DCGAN) method (Radford et al., 2016) to operate on these spectrograms. In WaveGAN, our waveform approach, we flatten the DCGAN architecture to operate in one dimension, resulting in a model with the same number of parameters and numerical operations as its twodimensional analog. With WaveGAN, we provide both a starting point for practical audio synthesis with GANs and a recipe for modifying other image generation methods to operate on waveforms.
26
+
27
+ We primarily envisage our method being applied to the generation of short sound effects suitable for use in music and film. For example, we trained a WaveGAN on drums, resulting in a procedural drum machine designed to assist electronic musicians (demo chrisdonahue.com/wavegan). However, human evaluation for such domain-specific tasks would require expert listeners. Therefore, we also consider a speech benchmark, facilitating straightforward assessment by human annotators. Specifically, we explore a task where success can easily be judged by any English speaker: generating examples of spoken digits “zero” through “nine”.
28
+
29
+ Though our evaluation focuses on a speech generation task, we note that it is not our goal to develop a text-to-speech synthesizer. Instead, our investigation concerns whether unsupervised strategies can learn global structure (e.g. words in speech data) implicit in high-dimensional audio signals without conditioning. Our experiments on speech demonstrate that both WaveGAN and SpecGAN can generate spoken digits that are intelligible to humans. On criteria of sound quality and speaker diversity, human judges indicate a preference for the audio generated by WaveGAN compared to that from SpecGAN.
30
+
31
+ # 2 GAN PRELIMINARIES
32
+
33
+ GANs learn mappings from low-dimensional latent vectors $z \in { \mathcal { Z } }$ , i.i.d. samples from known prior $P _ { Z }$ , to points in the space of natural data $\mathcal { X }$ . In their original formulation (Goodfellow et al., 2014), a generator $G : { \mathcal { Z } } \mapsto { \mathcal { X } }$ is pitted against a discriminator $D : \mathcal { X } \mapsto [ 0 , 1 ]$ in a two-player minimax game. $G$ is trained to minimize the following value function, while $D$ is trained to maximize it:
34
+
35
+ $$
36
+ V ( D , G ) = \mathbb { E } _ { \pmb { x } \sim P _ { X } } [ \log D ( \pmb { x } ) ] + \mathbb { E } _ { \pmb { z } \sim P _ { Z } } [ \log ( 1 - D ( G ( \pmb { z } ) ) ) ] .
37
+ $$
38
+
39
+ In other words, $D$ is trained to determine if an example is real or fake, and $G$ is trained to fool the discriminator into thinking its output is real. Goodfellow et al. (2014) demonstrate that their proposed training algorithm for Equation 1 equates to minimizing the Jensen-Shannon divergence between $P _ { X }$ , the data distribution, and $P _ { G }$ , the implicit distribution of the generator when $z \sim$ $P _ { Z }$ . In this original formulation, GANs are notoriously difficult to train, and prone to catastrophic failure cases. Instead of Jensen-Shannon divergence, Arjovsky et al. (2017) suggest minimizing the smoother Wasserstein-1 distance between generated and data distributions
40
+
41
+ $$
42
+ W ( P _ { X } , P _ { G } ) = \operatorname* { s u p } _ { \| f \| _ { L } \leq 1 } \mathbb { E } _ { x \sim P _ { X } } [ f ( x ) ] - \mathbb { E } _ { x \sim P _ { G } } [ f ( x ) ]
43
+ $$
44
+
45
+ where $\| f \| _ { L } \leq 1 : \mathcal { X } \mapsto \mathbb { R }$ is the family of functions that are 1-Lipschitz.
46
+
47
+ To minimize Wasserstein distance, they suggest a GAN training algorithm (WGAN), similar to that of Goodfellow et al. (2014), for the following value function:
48
+
49
+ $$
50
+ V _ { \mathrm { W G A N } } ( D _ { w } , G ) = \mathbb { E } _ { { \pmb { x } } \sim P _ { X } } [ D _ { w } ( { \pmb x } ) ] - \mathbb { E } _ { { \pmb z } \sim P _ { Z } } [ D _ { w } ( G ( { \pmb z } ) ) ] .
51
+ $$
52
+
53
+ With this formulation, $D _ { w } : \mathcal { X } \mapsto \mathbb { R }$ is not trained to identify examples as real or fake, but instead is trained as a function that assists in computing the Wasserstein distance. Arjovsky et al. (2017) suggest weight clipping as a means of enforcing that $D _ { w }$ is 1-Lipschitz. As an alternative strategy, Gulrajani et al. (2017) replace weight clipping with a gradient penalty (WGAN-GP) that also enforces the constraint. They demonstrate that their WGAN-GP strategy can successfully train a variety of model configurations where other GAN losses fail.
54
+
55
+ ![](images/97650d4794e4590db58a92f72cb57f49c85fef289d9d13475d57aaaedc1d8259.jpg)
56
+
57
+ ![](images/a3b51d30ba4da138a3efe74960c70a5d651173f0a00848c1759dfae46f250693.jpg)
58
+ Figure 1: First eight principal components for 5x5 patches from natural images (left) versus those of length-25 audio slices from speech (right). Periodic patterns are unusual in natural images but a fundamental structure in audio.
59
+ Figure 2: Depiction of the transposed convolution operation for the first layers of the DCGAN (Radford et al., 2016) (left) and WaveGAN (right) generators. DCGAN uses small (5x5), twodimensional filters while WaveGAN uses longer (length-25), one-dimensional filters and a larger upsampling factor. Both strategies have the same number of parameters and numerical operations.
60
+
61
+ # 3 WAVEGAN
62
+
63
+ We motivate our design choices for WaveGAN by first highlighting the different types of structure found in audio versus images.
64
+
65
+ # 3.1 INTRINSIC DIFFERENCES BETWEEN AUDIO AND IMAGES
66
+
67
+ One way to illustrate the differences between audio and images is by examining the axes along which these types of data vary most substantially, i.e. by principal component analysis. In Figure 1, we show the first eight principal components for patches from natural images and slices from speech. While the principal components of images generally capture intensity, gradient, and edge characteristics, those from audio form a periodic basis that decompose the audio into constituent frequency bands. In general, natural audio signals are more likely to exhibit periodicity than natural images.
68
+
69
+ As a consequence, correlations across large windows are commonplace in audio. For example, in a waveform sampled at $1 6 \mathrm { k H z }$ , a $4 4 0 \mathrm { H z }$ sinusoid (the musical note A4) takes over 36 samples to complete a single cycle. This suggests that filters with larger receptive fields are needed to process raw audio. This same intuition motivated van den Oord et al. (2016) in their design of WaveNet, which uses dilated convolutions to exponentially increase the model’s effective receptive field with linear increase in layer depth.
70
+
71
+ # 3.2 WAVEGAN ARCHITECTURE
72
+
73
+ We base our WaveGAN architecture off of DCGAN (Radford et al., 2016) which popularized usage of GANs for image synthesis. The DCGAN generator uses the transposed convolution operation (Figure 2) to iteratively upsample low-resolution feature maps into a high-resolution image. Motivated by our above discussion, we modify this transposed convolution operation to widen its receptive field. Specifically, we use longer one-dimensional filters of length 25 instead of two-dimensional filters of size 5x5, and we upsample by a factor of 4 instead of 2 at each layer (Figure 2). We modify the discriminator in a similar way, using length-25 filters in one dimension and increasing stride from 2 to 4. These changes result in WaveGAN having the same number of parameters, numerical operations, and output dimensionality as DCGAN.
74
+
75
+ Because DCGAN outputs 64x64 pixel images — equivalent to just 4096 audio samples — we add one additional layer to the model resulting in 16384 samples, slightly more than one second of audio at $1 6 \mathrm { k H z }$ . This length is already sufficient for certain sound domains (e.g. sound effects, voice commands), and future work adapting megapixel image generation techniques (Karras et al., 2018) could expand the output length to more than a minute. We requantize the real data from its 16- bit integer representation (linear pulse code modulation) to 32-bit floating point, and our generator similarly outputs floating point waveforms. A complete description of our model is in Appendix D.
76
+
77
+ In summary, we outline our modifications to the DCGAN (Radford et al., 2016) method which result in WaveGAN. This straightforward recipe already produces reasonable audio, and further contributions outlined below and in Appendix A serve to refine results.
78
+
79
+ 1. Flatten 2D convolutions into 1D (e.g. 5x5 2D convolution becomes length-25 1D).
80
+ 2. Increase the stride factor for all convolutions (e.g. stride $2 \mathrm { x 2 }$ becomes stride 4).
81
+ 3. Remove batch normalization from the generator and discriminator.
82
+ 4. Train using the WGAN-GP (Gulrajani et al., 2017) strategy.
83
+
84
+ # 3.3 PHASE SHUFFLE
85
+
86
+ Generative image models that upsample by transposed convolution (such as DCGAN) are known to produce characteristic “checkerboard” artifacts in images (Odena et al., 2016). Periodic patterns are less common in images (Section 3.1), and thus the discriminator can learn to reject images that contain them. For audio, analogous artifacts are perceived as pitched noise which may overlap with frequencies commonplace in the real data, making the discriminator’s objective more challenging. However, the artifact frequencies will always occur at a particular phase, allowing the discriminator to learn a trivial policy to reject generated examples. This may inhibit the overall optimization problem.
87
+
88
+ To prevent the discriminator from learning such a solution, we propose the phase shuffle operation with hyperparameter $n$ . Phase shuffle randomly perturbs the phase of each layer’s activations by $- n$ to $n$ samples before input to the next layer (Figure 3). We apply phase shuffle only to the discriminator, as the latent vector already provides the generator a mechanism to manipulate the phase of a resultant waveform. Intuitively speaking, phase shuffle makes the discriminator’s job more challenging by requiring invariance to the phase of the input waveform.
89
+
90
+ ![](images/757554e8081d9f0db8bb7bd31943ae5c91e45cbdbbfaabbff1a9a214fa80aad7.jpg)
91
+ Figure 3: At each layer of the WaveGAN discriminator, the phase shuffle operation perturbs the phase of each feature map by Uniform $\sim ~ [ - n , n ]$ samples, filling in the missing samples (dashed outlines) by reflection. Here we depict all possible outcomes for a layer with four feature maps $( n = 1 )$ ).
92
+
93
+ # 4 SPECGAN: GENERATING SEMI-INVERTIBLE SPECTROGRAMS
94
+
95
+ While a minority of recent research in discriminative audio classification tasks has used raw audio input (Sainath et al., 2015; Lee et al., 2017), most of these approaches operate on spectrogram representations of audio. A generative model may also benefit from operating in such a time-frequency space. However, commonly-used representations in the discriminative setting are uninvertible.
96
+
97
+ With SpecGAN, our frequency-domain audio generation model, we design a spectrogram representation that is both well-suited to GANs designed for image generation and can be approximately inverted. Additionally, to facilitate direct comparison, our representation is designed to use the same dimensionality per unit of time as WaveGAN (16384 samples yield a 128x128 spectrogram).
98
+
99
+ To process audio into suitable spectrograms, we first perform the short-time Fourier transform with $1 6 \mathrm { m s }$ windows and $8 \mathrm { m s }$ stride, resulting in 128 frequency bins2 linearly spaced from 0 to $8 \mathrm { k H z }$ . We take the magnitude of the resultant spectra and scale amplitude values logarithmically to better-align with human perception. We then normalize each frequency bin to have zero mean and unit variance. This type of preprocessing is commonplace in audio classification, but produce spectrograms with unbounded values—a departure from image representations. We therefore clip the spectra to 3 standard deviations and rescale to [−1, 1]. Through an informal listening test, we determined that this clipping strategy did not produce an audible difference during inversion.
100
+
101
+ ![](images/c6d4e0d8442f77e8e8c02fbc2975b0da3dda75c387e24bdc9707590ef92e64b8.jpg)
102
+ Figure 4: Top: Random samples from each of the five datasets used in this study, illustrating the wide variety of spectral characteristics. Middle: Random samples generated by WaveGAN for each domain. WaveGAN operates in the time domain but results are displayed here in the frequency domain for visual comparison. Bottom: Random samples generated by SpecGAN for each domain.
103
+
104
+ Once our dataset has been processed into this format, we operate the DCGAN (Radford et al., 2016) algorithm on the resultant spectra. To render the resultant generated spectrograms as waveforms, we first invert the steps of spectrogram preprocessing described above, resulting in linear-amplitude magnitude spectra. We then employ the iterative Griffin-Lim algorithm (Griffin & Lim, 1984) with 16 iterations to estimate phase and produce 16384 audio samples.
105
+
106
+ # 5 EXPERIMENTAL PROTOCOL
107
+
108
+ To facilitate human evaluation, our experimentation focuses on the Speech Commands Dataset (Warden, 2018). This dataset consists of many speakers recording individual words in uncontrolled recording conditions. We explore a subset consisting of the spoken digits “zero” through “nine” and refer to this subset as the Speech Commands Zero Through Nine (SC09) dataset. While this dataset is intentionally reminiscent of the popular MNIST dataset of written digits, we note that examples from SC09 are much higher dimensional $( \mathbb { R } ^ { 1 6 0 0 0 } )$ than examples from MNIST $( \mathbb { R } ^ { 2 8 \times 2 8 = 7 8 4 }$ ).
109
+
110
+ These ten words encompass many phonemes and two consist of multiple syllables. Each recording is one second in length, and we do not attempt to align the words in time. There are 1850 utterances of each word in the training set, resulting in 5.3 hours of speech. The heterogeneity of alignments, speakers, and recording conditions make this a challenging dataset for generative modeling.
111
+
112
+ Our baseline configuration for WaveGAN excludes phase shuffle. We compare this to the performance of WaveGAN with phase shuffle $( n \in \{ 2 , 4 \} )$ and a variant of WaveGAN which uses nearest-neighbor upsampling rather than transposed convolution (Odena et al., 2016). Hoping to reduce noisy artifacts, we also experiment with adding a wide (length-512) post-processing filter to the output of the generator and learning its parameters with the rest of the generator variables (details in Appendix A.1). We use the WGAN-GP (Gulrajani et al., 2017) algorithm for all experiments, finding it to produce reasonable results where others (Radford et al., 2016; Mao et al., 2017; Arjovsky et al., 2017) failed. We compare the performance of these configurations to that of SpecGAN.
113
+
114
+ We also perform experiments on four other datasets with different characteristics (Figure 4):
115
+
116
+ 1. Drum sound effects (0.7 hours): Drum samples for kicks, snares, toms, and cymbals
117
+ 2. Bird vocalizations (12.2 hours): In-the-wild recordings of many species (Boesman, 2018)
118
+ 3. Piano (0.3 hours): Professional performer playing a variety of Bach compositions
119
+ 4. Large vocab speech (TIMIT) (2.4 hours): Multiple speakers, clean (Garofolo et al., 1993)
120
+
121
+ We train our networks using batches of size 64 on a single NVIDIA P100 GPU. During our quantitative evaluation of SC09 (discussed below), our WaveGAN networks converge by their early stopping criteria (inception score) within four days (200k iterations, around 3500 epochs), and produce speech-like audio within the first hour of training. Our SpecGAN networks converge more quickly, within two days (around 1750 epochs). On the other four datasets, we train WaveGAN for $2 0 0 \mathrm { k }$ iterations representing nearly 1500 epochs for the largest dataset. Unlike with autoregressive methods (van den Oord et al., 2016; Mehri et al., 2017), generation with WaveGAN is fully parallel and can produce an hour of audio in less than two seconds. We list all hyperparameters in Appendix E.
122
+
123
+ # 6 EVALUATION METHODOLOGY
124
+
125
+ Evaluation of generative models is a fraught topic. Theis et al. (2016) demonstrate that quantitative measures of sample quality are poorly correlated with each other and human judgement. Accordingly, we use several quantitative evaluation metrics for hyperparameter validation and discussion, and also evaluate our most promising models with human judges.
126
+
127
+ # 6.1 INCEPTION SCORE
128
+
129
+ Salimans et al. (2016) propose the inception score, which uses a pre-trained Inception classifier (Szegedy et al., 2016) to measure both the diversity and semantic discriminability of generated images, finding that the measure correlates well with human judgement.
130
+
131
+ Given model scores $P ( \pmb { y } \mid \pmb { x } )$ with marginal $P ( \pmb { y } )$ , the inception score is defined as $\exp ( \mathbb { E } _ { \pmb { x } } D _ { \mathrm { K L } } ( P ( \pmb { y } \mid \pmb { x } ) | | P ( \pmb { y } ) ) )$ , and is estimated over a large number of samples (e.g. 50k). For $n$ classes, this measure ranges from 1 to $n$ , and is maximized when the model is completely confident about each prediction and predicts each label equally often. We will use this measure as our primary quantitative evaluation method and early stopping criteria.
132
+
133
+ To measure inception score, we train an audio classifier on SC09. Our classifier first computes a short-time Fourier transform of the input audio with $6 4 \mathrm { m s }$ windows and 8 ms stride. This representation is projected to 128 frequency bins equally spaced on the Mel scale (Stevens et al., 1937) from $4 0 \mathrm { { H z } }$ to $7 8 0 0 \mathrm { H z }$ . Amplitudes are scaled logarithmically and normalized so that each bin has zero mean and unit variance. We process this perceptually-informed representation with four layers of convolution and pooling, projecting the result to a softmax layer with 10 classes. We perform early stopping on the minimum negative log-likelihood of the validation set; the resultant model achieves $9 3 \%$ accuracy on the test set. Because this classifier observes spectrograms, our spectrogramgenerating models may have a representational advantage over our waveform-generating models.
134
+
135
+ # 6.2 NEAREST NEIGHBOR COMPARISONS
136
+
137
+ Inception score has two trivial failure cases in which a poor generative model can achieve a high score. Firstly, a generative model that outputs a single example of each class with uniform probability will be assigned a high score. Secondly, a generative model that overfits the training data will achieve a high score simply by outputting examples on which the classifier was trained.
138
+
139
+ We use two indicators metrics to determine if a high inception score has been caused by either of these two undesirable cases. Our first indicator, $| D | _ { \mathrm { s e l f } }$ , measures the average Euclidean distance of a set of 1k examples to their nearest neighbor within the set (other than itself). A higher $| D | _ { \mathrm { s e l f } }$ indicates higher diversity amongst samples. Because measuring Euclidean distance in time-domain
140
+
141
+ Table 1: Quantitative and qualitative (human study) results for SC09 experiments comparing real and generated data. A higher inception score suggests that semantic modes of the real data distribution have been captured. $| D | _ { \mathrm { s e l f } }$ indicates the intra-dataset diversity relative to that of the real test data. $| D | _ { \mathrm { t r a i n } }$ indicates the distance between the dataset and the training set relative to that of the test data; a low value indicates a generative model that is overfit to the training data. Acc. is the overall accuracy of humans on the task of labeling class-balanced digits (random chance is 0.1). Sound quality, ease of intelligibility and speaker diversity are mean opinion scores (1-5); higher is better.
142
+
143
+ <table><tr><td></td><td colspan="4">Quantitative</td><td colspan="4">Qualitative (human judges)</td></tr><tr><td>Experiment</td><td>Inception score</td><td>|D|self</td><td>|D|train</td><td>Acc.</td><td>Quality</td><td>Ease</td><td></td><td>Diversity</td></tr><tr><td>Real (train)</td><td>9.18 ± 0.04</td><td>1.1</td><td>0.0</td><td rowspan="3">0.95</td><td rowspan="3"></td><td></td><td></td><td></td></tr><tr><td>Real (test)</td><td>8.01±0.24</td><td>1.0</td><td>1.0</td><td>3.9 ±0.8</td><td>3.9 ± 1.1</td><td>3.5 ± 1.0</td></tr><tr><td>Parametric</td><td>5.02 ± 0.06</td><td>0.7</td><td>1.1</td><td></td><td></td><td></td></tr><tr><td>WaveGAN</td><td>4.12 ± 0.03</td><td>1.4</td><td>2.0</td><td rowspan="6"></td><td></td><td></td><td></td><td></td></tr><tr><td>+ Phase shuffle n = 2</td><td>4.67 ± 0.01</td><td>0.8</td><td>2.3</td><td>0.58</td><td>2.3± 0.9</td><td>2.8±0.9</td><td>3.2 ±0.9</td></tr><tr><td>+ Phase shuffle n = 4</td><td>4.54± 0.03</td><td>1.0</td><td>2.3</td><td></td><td></td><td></td><td></td></tr><tr><td>+ Nearest neighbor</td><td>3.77± 0.02</td><td>1.8</td><td>2.6</td><td></td><td></td><td></td><td></td></tr><tr><td>+ Post-processing</td><td>3.92 ± 0.03</td><td>1.4</td><td>2.9</td><td></td><td></td><td></td><td></td></tr><tr><td>+ Dropout</td><td>3.93 ± 0.03</td><td>1.0</td><td>2.6</td><td></td><td></td><td></td><td></td></tr><tr><td>SpecGAN</td><td>6.03 ± 0.04</td><td>1.1</td><td>1.4</td><td>0.66</td><td>1.9 ±0.8</td><td>2.8 ±0.9</td><td></td><td>2.6±1.0</td></tr><tr><td>+Phase shuffle n =1</td><td>3.71± 0.03</td><td>0.8</td><td>1.6</td><td></td><td></td><td></td><td></td><td></td></tr></table>
144
+
145
+ audio poorly represents human perception, we evaluate distances in the same frequency-domain representation as our classifier from Section 6.1.
146
+
147
+ Our second indicator, $| D | _ { \mathrm { t r a i n } }$ , measures the average Euclidean distance of 1k examples to their nearest neighbor in the real training data. If the generative model simply produces examples from the training set, this measure will be 0. We report $| D | _ { \mathrm { t r a i n } }$ and $| D | _ { \mathrm { s e l f } }$ relative to those of the test set.
148
+
149
+ # 6.3 QUALITATIVE HUMAN JUDGEMENTS
150
+
151
+ While inception score is a useful metric for hyperparameter validation, our ultimate goal is to produce examples that are intelligible to humans. To this end, we measure the ability of human annotators on Amazon Mechanical Turk to label the generated audio. Using our best WaveGAN and SpecGAN models as measured by inception score, we generate random examples until we have 300 for each digit (as labeled by our classifier from Section 6.1)—3000 total. In batches of ten random examples, we ask annotators to label which digit they perceive in each example, and compute their accuracy with respect to the classifier’s labels (random accuracy would be $1 \bar { 0 } \%$ ). After each batch, annotators assign subjective values of 1–5 for criteria of sound quality, ease of intelligibility, and speaker diversity. We report accuracy $n = 3 0 0 0$ ) and mean opinion scores $\mathit { n } = 3 0 0 $ ) in Table 1.
152
+
153
+ # 7 RESULTS AND DISCUSSION
154
+
155
+ Results for our evaluation appear in Table 1. We also evaluate our metrics on the real training data, the real test data, and a version of SC09 generated by a parametric speech synthesizer (Buchner, 2017). We also compare to SampleRNN (Mehri et al., 2017) and two public implementations of WaveNet (van den Oord et al., 2016), but neither method produced competitive results (details in Appendix B), and we excluded them from further evaluation. These autoregressive models have not previously been examined on small-vocabulary speech data, and their success at generating full words has only been demonstrated when conditioning on rich linguistic features. Sound examples for all experiments can be found at chrisdonahue.com/wavegan_examples.
156
+
157
+ While the maximum inception score for SC09 is 10, any score higher than the test set score of 8 should be seen as evidence that a generative model has overfit. Our best WaveGAN model uses phase shuffle with $n = 2$ and achieves an inception score of 4.7. To compare the effect of phase shuffle to other common regularizers, we also tried using $5 0 \%$ dropout in the discriminator’s activations, which resulted in a lower score. Phase shuffle decreased the inception score of SpecGAN, possibly because the operation has an exaggerated effect when applied to the compact temporal axis of spectrograms.
158
+
159
+ Most experiments produced $| D | _ { \mathrm { s e l f } }$ (diversity) values higher than that of the test data, and all experiments produced $| D | _ { \mathrm { t r a i n } }$ (distance from training data) values higher than that of the test data. While these measures indicate that our generative models produce examples with statistics that deviate from those of the real data, neither metric indicates that the models achieve high inception scores by the trivial solutions outlined in Section 6.2.
160
+
161
+ Compared to examples from WaveGAN, examples from SpecGAN achieve higher inception score (6.0 vs. 4.7) and are labeled more accurately by humans ( $6 6 \%$ vs. $5 8 \%$ ). However, on subjective criteria of sound quality and speaker diversity, humans indicate a preference for examples from WaveGAN. It appears that SpecGAN might better capture the variance in the underlying data compared to WaveGAN, but its success is compromised by sound quality issues when its spectrograms are inverted to audio. It is possible that the poor qualitative ratings for examples from SpecGAN are primarily caused by the lossy Griffin-Lim inversion (Griffin & Lim, 1984) and not the generative procedure itself. We see promise in both waveform and spectrogram audio generation with GANs; our study does not suggest a decisive winner. For a more thorough investigation of spectrogram generation methods, we point to follow-up work (Engel et al., 2019).
162
+
163
+ Finally, we train WaveGAN and SpecGAN models on the four other domains listed in Section 5. Somewhat surprisingly, we find that the frequency-domain spectra produced by WaveGAN (a timedomain method) are visually more consistent with the training data (e.g. in terms of sharpness) than those produced by SpecGAN (Figure 4). For drum sound effects, WaveGAN captures semantic modes such as kick and snare drums. On bird vocalizations, WaveGAN generates a variety of distinct bird sounds. On piano, WaveGAN produces musically-consonant motifs that, as with the training data, represent a variety of key signatures and rhythmic patterns. For TIMIT, a large-vocabulary speech dataset with many speakers, WaveGAN produces speech-like babbling similar to results from unconditional autoregressive models (van den Oord et al., 2016).
164
+
165
+ # 8 RELATED WORK
166
+
167
+ Much of the work within generative modeling of audio is within the context of text-to-speech. Textto-speech systems are primarily either concatenative or parametric. In concatenative systems, audio is generated by sequencing small, prerecorded portions of speech from a phonetically-indexed dictionary (Moulines & Charpentier, 1990; Hunt & Black, 1996). Parametric systems map text to salient parameters of speech, which are then synthesized by a vocoder (Dudley, 1939); see (Zen et al., 2009) for a comprehensive review. Some of these systems use learning-based approaches such as a hidden Markov models (Yoshimura, 2002; Tokuda et al., 2013), and separately-trained neural networks pipelines (Ling et al., 2015) to estimate speech parameters.
168
+
169
+ Recently, several researchers have investigated parametric speech synthesis with end-to-end neural network approaches that learn to produce vocoder features directly from text or phonetic embeddings (Arik et al., 2017; Ping et al., 2018; Sotelo et al., 2017; Wang et al., 2017; Shen et al., 2018). These vocoder features are synthesized to raw audio using off-the-shelf methods such as WORLD (Morise et al., 2016) and Griffin-Lim (Griffin & Lim, 1984), or trained neural vocoders (Sotelo et al., 2017; Shen et al., 2018; Ping et al., 2018). All of these methods are supervised: they are trained to map linguistic features to audio outputs.
170
+
171
+ Several approaches have explored unsupervised generation of raw audio. van den Oord et al. (2016) propose WaveNet, a convolutional model which learns to predict raw audio samples by autoregressive modeling. WaveNets conditioned on rich linguistic features have widely been deployed in textto-speech systems, though they have not been demonstrated capable of generating cohesive words in the unconditional setting. Engel et al. (2017) pose WaveNet as an autoencoder to generate musical instrument sounds. Chung et al. (2014); Mehri et al. (2017) both train recurrent autoregressive models which learn to predict raw audio samples. While autoregressive methods generally produce higher audio fidelity than WaveGAN, synthesis with WaveGAN is orders of magnitude faster.
172
+
173
+ The application of GANs (Goodfellow et al., 2014) to audio has so far been limited to supervised learning problems in combination with traditional loss functions. Pascual et al. (2017) apply GANs to raw audio speech enhancement. Their encoder-decoder approach combines the GAN objective with an $L _ { 2 }$ loss. Fan et al. (2017); Michelsanti & Tan (2017); Donahue et al. (2018) all use GANs in combination with unstructured losses to map spectrograms in one domain to spectrograms in another. Chen et al. (2017) use GANs to map musical performance images into spectrograms.
174
+
175
+ # 9 CONCLUSION
176
+
177
+ We present WaveGAN, the first application of GANs to unsupervised audio generation. WaveGAN is fully parallelizable and can generate hours of audio in only a few seconds. In its current form, WaveGAN can be used for creative sound design in multimedia production. In our future work we plan to extend WaveGAN to operate on variable-length audio and also explore a variety of label conditioning strategies. By providing a template for modifying image generation models to operate on audio, we hope that this work catalyzes future investigation of GANs for audio synthesis.
178
+
179
+ # ACKNOWLEDGMENTS
180
+
181
+ The authors would like to thank Peter Boesman and Colin Raffel for providing training data for this work. This work was supported by the Unity Global Graduate Fellowship program and the UC San Diego Department of Computer Science. GPUs used for this work were provided by the HPC $@$ UC program and donations from NVIDIA.
182
+
183
+ # REFERENCES
184
+
185
+ Sercan Arik, Gregory Diamos, Andrew Gibiansky, John Miller, Kainan Peng, Wei Ping, Jonathan Raiman, and Yanqi Zhou. Deep Voice 2: Multi-speaker neural text-to-speech. In NIPS, 2017.
186
+
187
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein GAN. In ´ ICML, 2017.
188
+
189
+ David Berthelot, Tom Schumm, and Luke Metz. BEGAN: Boundary equilibrium generative adversarial networks. arXiv:1703.10717, 2017.
190
+
191
+ Peter Boesman. Bird recordings. https://www.xeno-canto.org/contributor/ OOECIWCSWV, 2018. Accessed: 2018-01-08.
192
+
193
+ Johannes Buchner. Synthetic speech commands dataset. https://www.kaggle.com/ jbuchner/synthetic-speech-commands-dataset, 2017. Accessed: 2017-01-15.
194
+
195
+ Lele Chen, Sudhanshu Srivastava, Zhiyao Duan, and Chenliang Xu. Deep cross-modal audio-visual generation. In Proceedings of the on Thematic Workshops of ACM Multimedia, 2017.
196
+
197
+ Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. In NIPS Deep Learning and Representation Learning Workshop, 2014.
198
+
199
+ Chris Donahue, Bo Li, and Rohit Prabhavalkar. Exploring speech enhancement with generative adversarial networks for robust speech recognition. In ICASSP, 2018.
200
+
201
+ Homer Dudley. Remaking speech. The Journal of the Acoustical Society of America, 1939.
202
+
203
+ Jesse Engel, Cinjon Resnick, Adam Roberts, Sander Dieleman, Douglas Eck, Karen Simonyan, and Mohammad Norouzi. Neural audio synthesis of musical notes with WaveNet autoencoders. In ICML, 2017.
204
+
205
+ Jesse Engel, Kumar Krishna Agrawal, Shuo Chen, Ishaan Gulrajani, Chris Donahue, and Adam Roberts. GANSynth: Adversarial neural audio synthesis. In ICLR, 2019.
206
+
207
+ Zhe-Cheng Fan, Yen-Lin Lai, and Jyh-Shing Roger Jang. SVSGAN: Singing voice separation via generative adversarial network. arXiv:1710.11428, 2017.
208
+
209
+ John S Garofolo, Lori F Lamel, William M Fisher, Jonathan G Fiscus, David S Pallett, Nancy L Dahlgren, and Victor Zue. TIMIT acoustic-phonetic continuous speech corpus. Linguistic data consortium, 1993.
210
+
211
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks. In NIPS, 2014.
212
+
213
+ Daniel Griffin and Jae Lim. Signal estimation from modified short-time fourier transform. IEEE Transactions on Acoustics, Speech, and Signal Processing, 1984.
214
+
215
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of Wasserstein GANs. In NIPS, 2017.
216
+
217
+ Shawn Hershey, Sourish Chaudhuri, Daniel PW Ellis, Jort F Gemmeke, Aren Jansen, R Channing Moore, Manoj Plakal, Devin Platt, Rif A Saurous, Bryan Seybold, et al. CNN architectures for large-scale audio classification. In ICASSP, 2017.
218
+
219
+ Andrew J Hunt and Alan W Black. Unit selection in a concatenative speech synthesis system using a large speech database. In ICASSP, 1996.
220
+
221
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of GANs for improved quality, stability, and variation. In ICLR, 2018.
222
+
223
+ Jongpil Lee, Jiyoung Park, Keunhyoung Luke Kim, and Juhan Nam. Sample-level deep convolutional neural networks for music auto-tagging using raw waveforms. In Sound and Music Computing Conference, 2017.
224
+
225
+ Zhen-Hua Ling, Shi-Yin Kang, Heiga Zen, Andrew Senior, Mike Schuster, Xiao-Jun Qian, Helen M Meng, and Li Deng. Deep learning for acoustic modeling in parametric speech generation: A systematic review of existing techniques and future trends. IEEE Signal Processing Magazine, 2015.
226
+
227
+ Xudong Mao, Qing Li, Haoran Xie, Raymond YK Lau, Zhen Wang, and Stephen Paul Smolley. Least squares generative adversarial networks. In ICCV, 2017.
228
+
229
+ Soroush Mehri, Kundan Kumar, Ishaan Gulrajani, Rithesh Kumar, Shubham Jain, Jose Sotelo, Aaron Courville, and Yoshua Bengio. SampleRNN: An unconditional end-to-end neural audio generation model. In ICLR, 2017.
230
+
231
+ Daniel Michelsanti and Zheng-Hua Tan. Conditional generative adversarial networks for speech enhancement and noise-robust speaker verification. In INTERSPEECH, 2017.
232
+
233
+ Masanori Morise, Fumiya Yokomori, and Kenji Ozawa. WORLD: a vocoder-based high-quality speech synthesis system for real-time applications. IEICE Transactions on Information and Systems, 2016.
234
+
235
+ Eric Moulines and Francis Charpentier. Pitch-synchronous waveform processing techniques for text-to-speech synthesis using diphones. Speech communication, 1990.
236
+
237
+ Augustus Odena, Vincent Dumoulin, and Chris Olah. Deconvolution and checkerboard artifacts. Distill, 2016.
238
+
239
+ Santiago Pascual, Antonio Bonafonte, and Joan Serra. SEGAN: Speech enhancement generative \` adversarial network. In INTERSPEECH, 2017.
240
+
241
+ Wei Ping, Kainan Peng, Andrew Gibiansky, Sercan O Arik, Ajay Kannan, Sharan Narang, Jonathan Raiman, and John Miller. Deep Voice 3: 2000-speaker neural text-to-speech. In ICLR, 2018.
242
+
243
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In ICLR, 2016.
244
+
245
+ Tara N Sainath, Ron J Weiss, Andrew Senior, Kevin W Wilson, and Oriol Vinyals. Learning the speech front-end with raw waveform CLDNNs. In INTERSPEECH, 2015.
246
+
247
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training GANs. In NIPS, 2016.
248
+
249
+ Jonathan Shen, Ruoming Pang, Ron J Weiss, Mike Schuster, Navdeep Jaitly, Zongheng Yang, Zhifeng Chen, Yu Zhang, Yuxuan Wang, RJ Skerry-Ryan, et al. Natural TTS synthesis by conditioning WaveNet on Mel spectrogram predictions. In ICASSP, 2018.
250
+
251
+ Ashish Shrivastava, Tomas Pfister, Oncel Tuzel, Joshua Susskind, Wenda Wang, and Russell Webb. Learning from simulated and unsupervised images through adversarial training. In CVPR, 2017.
252
+
253
+ Jose Sotelo, Soroush Mehri, Kundan Kumar, Joao Felipe Santos, Kyle Kastner, Aaron Courville, and Yoshua Bengio. Char2Wav: End-to-end speech synthesis. In ICLR Workshops, 2017.
254
+
255
+ Stanley Smith Stevens, John Volkmann, and Edwin B Newman. A scale for the measurement of the psychological magnitude pitch. The Journal of the Acoustical Society of America, 1937.
256
+
257
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In CVPR, 2016.
258
+
259
+ Lucas Theis, Aaron van den Oord, and Matthias Bethge. A note on the evaluation of generative ¨ models. In ICLR, 2016.
260
+
261
+ Keiichi Tokuda, Yoshihiko Nankaku, Tomoki Toda, Heiga Zen, Junichi Yamagishi, and Keiichiro Oura. Speech synthesis based on hidden Markov models. Proceedings of the IEEE, 2013.
262
+
263
+ 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:1609.03499, 2016.
264
+
265
+ Yuxuan Wang, RJ Skerry-Ryan, Daisy Stanton, Yonghui Wu, Ron J Weiss, Navdeep Jaitly, Zongheng Yang, Ying Xiao, Zhifeng Chen, Samy Bengio, et al. Tacotron: Towards end-to-end speech synthesis. arXiv:1703.10135, 2017.
266
+
267
+ Pete Warden. Speech commands: A dataset for limited-vocabulary speech recognition. arXiv:1804.03209, 2018.
268
+
269
+ Takayoshi Yoshimura. Simultaneous modeling of phonetic and prosodic parameters, and characteristic conversion for hmm-based text-to-speech systems. 2002.
270
+
271
+ Heiga Zen, Keiichi Tokuda, and Alan W Black. Statistical parametric speech synthesis. Speech Communication, 2009.
272
+
273
+ ![](images/ec0cfc4ea50d6ec4046a3bf70aba991b6d617d7fe7a11b6d37d11eee20c254fa.jpg)
274
+ Figure 5: (Top): Average impulse response for 1000 random initializations of the WaveGAN generator. (Bottom): Response of learned post-processing filters for speech and bird vocalizations. Post-processing filters reject frequencies corresponding to noise byproducts created by the generative procedure (top). The filter for speech boosts signal in prominent speech bands, while the filter for bird vocalizations (which are more uniformly-distributed in frequency) simply reduces noise presence.
275
+
276
+ # A UNDERSTANDING AND MITIGATING ARTIFACTS IN GENERATED AUDIO
277
+
278
+ Generative models that upsample by transposed convolution are known to produce characteristic “checkerboard” artifacts in images (Odena et al., 2016), artifacts with particular spatial periodicities. The discriminator of image-generating GANs can learn to reject images with these artifacts because they are uncommon in real data (as discussed in Section 3.1). However, in the audio domain, the discriminator might not have such luxury as these artifacts correspond to frequencies which might rightfully appear in the real data.
279
+
280
+ While checkerboard artifacts are an annoyance in image generation, they can be devastating to audio generation results. While our eye may perceive these types of periodic distortions as an intrusive texture, our ear perceives them as an abrasive tone. To characterize these artifacts in WaveGAN, we measure its impulse response by randomly initializing it 1000 times and passing unit impulses to its first convolutional layer. In Figure 5, we plot the average of these responses in the frequency domain. The response has sharp peaks at linear multiples of the sample rates of each convolutional layer $2 5 0 \mathrm { H z }$ , $1 \mathrm { k H z }$ , $4 \mathrm { k H z }$ , etc.). This is in agreement with our informal observation of results from WaveGAN, which often have a pitched noise close to the musical note B $( 2 4 7 \times 2 ^ { n } \mathrm { H z } )$ ).
281
+
282
+ Below, we will discuss strategies we designed to mitigate these artifacts in WaveGAN.
283
+
284
+ # A.1 LEARNED POST-PROCESSING FILTERS
285
+
286
+ We experiment with adding a post-processing filter to the generator, giving WaveGAN a simple mechanism to filter out undesirable frequencies created by the generative process. This filter has a long window (512 samples) allowing it to represent intricate transfer functions, and the weights of the filter are learned as part of the generator’s parameters. In Figure 5, we compare the postprocessing filters that WaveGAN learns for human speech and bird vocalizations. The filters boost signal in regions of the frequency spectrum that are most prominent in the real data domain, and introduce notches at bands that are artifacts of the generative procedure as discussed in the previous section.
287
+
288
+ ![](images/4f414414f814f3c214d3823672dd585c77e1af9cfc6dfe9cad2ef4f56848d5cf.jpg)
289
+ Figure 6: Depiction of the upsampling strategy used by transposed convolution (zero insertion) and other strategies which mitigate aliasing: nearest neighbor, linear and cubic interpolation.
290
+
291
+ # A.2 UPSAMPLING PROCEDURE
292
+
293
+ Transposed convolution upsamples signals by inserting zeros in between samples and applying a learned filterbank. This operation introduces aliased frequencies, copies of pre-existing frequencies shifted by multiples of the new Nyquist rate, into the upsampled signal. While aliased frequencies are usually seen as undesirable artifacts of a bad upsampling procedure, in the generative setting their existence may be crucial for producing fine-grained details in the output.
294
+
295
+ We experiment with three other upsampling strategies in WaveGAN: nearest-neighbor, linear and cubic interpolation, all of which attenuate aliased frequencies. In Figure 6, we compare these strategies visually. While nearest neighbor upsampling resulted in similar audio output to transposed convolution, linear and cubic interpolation strategies resulted in qualitatively poor audio output (sound examples: chrisdonahue.com/wavegan_examples). We hypothesize that the aliased frequencies produced by upsampling convolutions may be more critical to audio generation than image generation.
296
+
297
+ # B EXPERIMENTS WITH AUTOREGRESSIVE WAVEFORM MODELS
298
+
299
+ We developed our WaveGAN and SpecGAN models primarily to address the task of steerable sound effect generation. This is an inherently different task than text to speech (TTS), however autoregressive waveform models (e.g. WaveNet (van den Oord et al., 2016) and SampleRNN (Mehri et al., 2017)) that were developed for TTS can also be used to model and generate waveforms unconditionally. Hence, a comparison to these models for our task is reasonable. One upside of autoregressive models for our task is that they have the potential to produce high-quality audio. Potential downsides are 1) these models take several orders of magnitude longer to generate waveforms, and 2) they do not learn a compact latent space of waveforms, causing useful sound generation tasks like continuous exploration and interpolation to be impossible.
300
+
301
+ We attempt to train two public implementations of WaveNet (ImplA3 and $\mathrm { I m p l B ^ { 4 } }$ ) and SampleRNN5 on our SC09 digit generation task. We use default parameters for these libraries; the only modifications we make are to reduce the training example size to one second. To our ears, all three libraries failed to produce cohesive words (you can judge for yourself from our sound examples at the bottom chrisdonahue.com/wavegan_examples). This poor subjective performance is echoed by weak inception scores (weaker than any in Table 1): $1 . 0 7 \pm 0 . 0 5$ , $1 . 2 9 \pm 0 . 0 3$ , $2 . 2 8 \pm 0 . 1 9$ for WaveNet ImplA, WaveNet ImplB, and SampleRNN respectively. Note that these inception scores were calculated on far fewer examples $( < 1 k )$ than all of the scores listed in Table 1 (which were computed on $5 0 k$ examples). This is because it took over 24 hours to produce even a thousand one-second examples with these methods (whereas our methods produce $5 0 k$ examples in a few seconds).
302
+
303
+ Autoregressive methods have not been demonstrated capable of learning to synthesize coherent words without conditioning on rich linguistic features. We are not claiming that these methods cannot learn to synthesize full words, merely that three open-source implementations were unable to do so with default parameters. We want to be clear that our intent is not to disparage autoregressive waveform methods as these methods were developed for a different task, and hence we excluded these poor scores from our results table to avoid sending the wrong message. Instead, we hope to highlight that these implementations produced results that were noncompetitive for our problem domain, and less useful (due to slowness and lack of a latent space) for creative generation of sound effects.
304
+
305
+ # C FELINE “TURING TEST”
306
+
307
+ ![](images/68f22cd7b27c7439f9717bb54e59dae169763e841d232a0f2017c28f22d8f3f0.jpg)
308
+ Figure 7: Compared to resting state, this cat’s level of alertness increased when presented bird vocalizations synthesized by WaveGAN and SpecGAN.
309
+
310
+ As our results improved throughout the course of this research, our cats became quite intrigued by the synthetic bird vocalizations produced by WaveGAN (Figure 7). While this was of course not a formal experiment, we did find this to be encouraging evidence that our method might be capable of producing audio that could additionally convince non-human animals.
311
+
312
+ Table 2: WaveGAN generator architecture
313
+
314
+ <table><tr><td>Operation</td><td>Kernel Size</td><td>Output Shape</td></tr><tr><td>Input z ~ Uniform(-1,1) Dense 1 Reshape ReLU Trans Conv1D (Stride=4)</td><td>(100,256d) (25,16d,8d)</td><td>(n,100) (n,256d) (n,16,16d) (n,16,16d) (n,64,8d) (n,16384,c)</td></tr><tr><td>ReLU Trans Conv1D (Stride=4) ReLU</td><td>(25,8d,4d)</td><td>(n, 64,8d) (n,256,4d) (n,256,4d)</td></tr><tr><td>Trans Conv1D (Stride=4) ReLU Trans Conv1D (Stride=4)</td><td>(25,4d,2d)</td><td>(n,1024,2d) (n,1024,2d)</td></tr><tr><td>ReLU Trans Conv1D (Stride=4) Tanh</td><td>(25,2d,d) (25,d,c)</td><td>(n,4096,d) (n,4096,d)</td></tr></table>
315
+
316
+ Table 3: WaveGAN discriminator architecture
317
+
318
+ <table><tr><td>Operation Input x or G(z)</td><td>Kernel Size</td><td>Output Shape</td></tr><tr><td rowspan="3">Conv1D (Stride=4) LReLU (α = 0.2) Phase Shuffle (n = 2) Conv1D (Stride=4) LReLU (α = 0.2) Phase Shuffle (n = 2) Conv1D (Stride=4) LReLU (α = 0.2) Phase Shuffle (n = 2) Conv1D (Stride=4) LReLU (α = 0.2) Phase Shuffle (n = 2) Conv1D (Stride=4)</td><td>(25,c,d)</td><td>(n,16384,c) (n,4096,d) (n,4096,d) (n,4096,d)</td></tr><tr><td>(25,d,2d) (25,2d,4d)</td><td>(n,1024,2d) (n,1024,2d) (n,1024,2d)</td></tr><tr><td>(25,4d,8d) (25,8d,16d) (256d,1)</td><td>(n,256,4d) (n,256,4d) (n,256,4d) (n,64,8d) (n, 64,8d) (n,64,8d) (n,16,16d) (n,16,16d) (n,256d) (n,1)</td></tr></table>
319
+
320
+ # D ARCHITECTURE DESCRIPTION
321
+
322
+ In Tables 2 and 3, we list the full architectures for our WaveGAN generator and discriminator respectively. In Tables 4 and 5, we list the same for SpecGAN. In these tables, $n$ is the batch size, $d$ modifies model size, and $c$ is the number of channels in the examples. In all of our experiments in this paper, $c = 1$ . All dense and convolutional layers include biases. No batch normalization is used in WaveGAN or SpecGAN.
323
+
324
+ # E TRAINING HYPERPARAMETERS
325
+
326
+ In Table 6, we list the values of these and all other hyperparameters for our experiments, which constitute our out-of-the-box recommendations for WaveGAN and SpecGAN.
327
+
328
+ Table 4: SpecGAN generator architecture
329
+
330
+ <table><tr><td rowspan=1 colspan=4>Operation</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Kernel Size</td></tr><tr><td rowspan=1 colspan=2>Inputz~ Unif</td><td rowspan=1 colspan=2>form(-1,1)</td><td rowspan=2 colspan=1>(100,256d)(5,5,16d,8d)(5,5,8d,4d)(5,5,4d,2d)(5,5,2d,d)(5,5,d,c)</td><td rowspan=2 colspan=1>(n,100)(n,256d)(n,4,4,16d)(n,4,4,16d)(n,8,8,8d)(n,8,8,8d)(n,16,16,4d)(n,16,16,4d)(n,32,32,2d)(n,32,32,2d)(n,64,64,d)(n,64,64,d)(n,128,128,c)(n,128,128,c)</td></tr><tr><td rowspan=1 colspan=4>Dense 1ReshapeReLUTrans Conv2D (Stride=2)ReLUTrans Conv2D (Stride=2)ReLUTrans Conv2D (Stride=2)ReLUTrans Conv2D (Stride=2)ReLUTrans Conv2D (Stride=2)Tanh</td><td rowspan=1 colspan=1>Dense 1</td></tr></table>
331
+
332
+ Table 5: SpecGAN discriminator architecture
333
+
334
+ <table><tr><td rowspan=1 colspan=1>Operation</td><td rowspan=1 colspan=1>Kernel Size</td><td rowspan=1 colspan=1>Output Shape</td></tr><tr><td rowspan=1 colspan=1>Input x or G(z)Conv2D (Stride=2)LReLU (α = 0.2)Conv2D (Stride=2)LReLU (α = 0.2)Conv2D (Stride=2)LReLU (α = 0.2)Conv2D (Stride=2)LReLU (α = 0.2)Conv2D (Stride=2)LReLU (α= 0.2)ReshapeDense</td><td rowspan=1 colspan=1>(5,5,c,d)(5,5,d,2d)(5,5,2d,4d)(5,5,4d,8d)(5,5,8d,16d)(256d,1)</td><td rowspan=1 colspan=1>(n,128,128,c)(n,64,64,d)(n,64,64,d)(n,32,32,2d)(n,32,32,2d)(n,16,16,4d)(n,16,16,4d)(n,8,8,8d)(n,8,8,8d)(n,4,4,16d)(n,4,4,16d)(n,256d)(n,1)</td></tr></table>
335
+
336
+ Table 6: WaveGAN hyperparameters
337
+
338
+ <table><tr><td>Name</td><td>Value</td></tr><tr><td>Input data type Model data type</td><td>16-bit PCM (requantized to 32-bit float) 32-bit floating point</td></tr><tr><td>Num channels (c)</td><td>1</td></tr><tr><td>Batch size (b)</td><td>64</td></tr><tr><td>Model dimensionality (d)</td><td>64</td></tr><tr><td>Phase shuffle (WaveGAN)</td><td>2</td></tr><tr><td>Phase shuffle (SpecGAN)</td><td>0</td></tr><tr><td>Loss</td><td>WGAN-GP (Gulrajani et al., 2017)</td></tr><tr><td>WGAN-GP入</td><td>10</td></tr><tr><td>D updates per G update</td><td></td></tr><tr><td></td><td>5</td></tr><tr><td>Optimizer</td><td>Adam (α=1e-4,βi= 0.5,β2=0.9)</td></tr></table>
md/train/BybtVK9lg/BybtVK9lg.md ADDED
@@ -0,0 +1,293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AUTOENCODING VARIATIONAL INFERENCE FOR TOPIC MODELS
2
+
3
+ Akash Srivastava
4
+ Informatics Forum, University of Edinburgh
5
+ 10, Crichton St
6
+ Edinburgh, EH89AB, UK
7
+ akash.srivastava@ed.ac.uk
8
+ Charles Sutton∗
9
+ Informatics Forum, University of Edinburgh
10
+ 10, Crichton St
11
+ Edinburgh, EH89AB, UK
12
+ csutton@inf.ed.ac.uk
13
+
14
+ # ABSTRACT
15
+
16
+ Topic models are one of the most popular methods for learning representations of text, but a major challenge is that any change to the topic model requires mathematically deriving a new inference algorithm. A promising approach to address this problem is autoencoding variational Bayes (AEVB), but it has proven difficult to apply to topic models in practice. We present what is to our knowledge the first effective AEVB based inference method for latent Dirichlet allocation (LDA), which we call Autoencoded Variational Inference For Topic Model (AVITM). This model tackles the problems caused for AEVB by the Dirichlet prior and by component collapsing. We find that AVITM matches traditional methods in accuracy with much better inference time. Indeed, because of the inference network, we find that it is unnecessary to pay the computational cost of running variational optimization on test data. Because AVITM is black box, it is readily applied to new topic models. As a dramatic illustration of this, we present a new topic model called ProdLDA, that replaces the mixture model in LDA with a product of experts. By changing only one line of code from LDA, we find that ProdLDA yields much more interpretable topics, even if LDA is trained via collapsed Gibbs sampling.
17
+
18
+ # 1 INTRODUCTION
19
+
20
+ Topic models (Blei, 2012) are among the most widely used models for learning unsupervised representations of text, with hundreds of different model variants in the literature, and have have found applications ranging from the exploration of the scientific literature (Blei & Lafferty, 2007) to computer vision (Fei-Fei & Perona, 2005), bioinformatics (Rogers et al., 2005), and archaeology (Mimno, 2009). A major challenge in applying topic models and developing new models is the computational cost of computing the posterior distribution. Therefore a large body of work has considered approximate inference methods, the most popular methods being variational methods, especially mean field methods, and Markov chain Monte Carlo, particularly methods based on collapsed Gibbs sampling.
21
+
22
+ Both mean-field and collapsed Gibbs have the drawback that applying them to new topic models, even if there is only a small change to the modeling assumptions, requires re-deriving the inference methods, which can be mathematically arduous and time consuming, and limits the ability of practitioners to freely explore the space of different modeling assumptions. This has motivated the development of black-box inference methods (Ranganath et al., 2014; Mnih & Gregor, 2014; Kucukelbir et al., 2016; Kingma & Welling, 2014) which require only very limited and easy to compute information from the model, and hence can be applied automatically to new models given a simple declarative specification of the generative process.
23
+
24
+ Autoencoding variational Bayes (AEVB) (Kingma & Welling, 2014; Rezende et al., 2014) is a particularly natural choice for topic models, because it trains an inference network (Dayan et al., 1995), a neural network that directly maps a document to an approximate posterior distribution, without the need to run further variational updates. This is intuitively appealing because in topic models, we expect the mapping from documents to posterior distributions to be well behaved, that is, that a small change in the document will produce only a small change in topics. This is exactly the type of mapping that a universal function approximator like a neural network should be good at representing. Essentially, the inference network learns to mimic the effect of probabilistic inference, so that on test data, we can enjoy the benefits of probabilistic modeling without paying a further cost for inference.
25
+
26
+ However, despite some notable successes for latent Gaussian models, black box inference methods are significantly more challenging to apply to topic models. For example, in initial experiments, we tried to apply ADVI (Kucukelbir et al., 2016), a recent black-box variational method, but it was difficult to obtain any meaningful topics. Two main challenges are: first, the Dirichlet prior is not a location scale family, which hinders reparameterisation, and second, the well known problem of component collapsing (Dinh & Dumoulin, 2016), in which the inference network becomes stuck in a bad local optimum in which all topics are identical.
27
+
28
+ In this paper, we present what is, to our knowledge, the first effective AEVB inference method for topic models, which we call Autoencoded Variational Inference for Topic Models or AVITM1. On several data sets, we find that AVITM yields topics of equivalent quality to standard mean-field inference, with a large decrease in training time. We also find that the inference network learns to mimic the process of approximate inference highly accurately, so that it is not necessary to run variational optimization at all on test data.
29
+
30
+ But perhaps more important is that AVITM is a black-box method that is easy to apply to new models. To illustrate this, we present a new topic model, called ProdLDA, in which the distribution over individual words is a product of experts rather than the mixture model used in LDA. We find that ProdLDA consistently produces better topics than standard LDA, whether measured by automatically determined topic coherence or qualitative examination. Furthermore, because we perform probabilistic inference using a neural network, we can fit a topic model on roughly a one million documents in under 80 minutes on a single GPU, and because we are using a black box inference method, implementing ProdLDA requires a change of only one line of code from our implementation of standard LDA.
31
+
32
+ To summarize, the main advantages of our methods are:
33
+
34
+ 1. Topic coherence: ProdLDA returns consistently better topics than LDA, even when LDA is trained using Gibbs sampling.
35
+ 2. Computational efficiency: Training AVITM is fast and efficient like standard mean-field. On new data, AVITM is much faster than standard mean field, because it requires only one forward pass through a neural network.
36
+ 3. Black box: AVITM does not require rigorous mathematical derivations to handle changes in the model, and can be easily applied to a wide range of topic models.
37
+
38
+ Overall, our results suggest that AVITM is ready to take its place alongside mean field and collapsed Gibbs as one of the workhorse inference methods for topic models.
39
+
40
+ # 2 BACKGROUND
41
+
42
+ To fix notation, we begin by describing topic modelling and AVITM.
43
+
44
+ # 2.1 LATENT DIRICHLET ALLOCATION
45
+
46
+ We describe the most popular topic model, latent Dirichlet allocation (LDA). In LDA, each document of the collection is represented as a mixture of topics, where each topic $\beta _ { k }$ is a probability distribution over the vocabulary. We also use $\beta$ to denote the matrix $\beta = \left( \beta _ { 1 } \ldots \beta _ { K } \right)$ . The generative process is then as described in Algorithm 1. Under this generative model, the marginal likelihood of
47
+
48
+ for each document w do Draw topic distribution $\theta \sim$ Dirichlet $( \alpha )$ ; for each word at position $n$ do Sample topic $z _ { n } \sim$ Multinomial $( 1 , \theta )$ ; Sample word $w _ { n } \sim$ Multinomia $( 1 , \beta _ { z _ { n } } )$ ; end
49
+ end
50
+
51
+ Algorithm 1: LDA as a generative model.
52
+
53
+ a document w is
54
+
55
+ $$
56
+ p ( \mathbf { w } | \alpha , \beta ) = \int _ { \boldsymbol { \theta } } \left( \prod _ { n = 1 } ^ { N } \sum _ { z _ { n } = 1 } ^ { k } p ( w _ { n } | z _ { n } , \beta ) p ( z _ { n } | \boldsymbol { \theta } ) \right) p ( \boldsymbol { \theta } | \alpha ) d \boldsymbol { \theta } .
57
+ $$
58
+
59
+ Posterior inference over the hidden variables $\theta$ and $z$ is intractable due to the coupling between the $\theta$ and $\beta$ under the multinomial assumption (Dickey, 1983).
60
+
61
+ # 2.2 MEAN FIELD AND AEVB
62
+
63
+ A popular approximation for efficient inference in topic models is mean field variational inference, which breaks the coupling between $\theta$ and $z$ by introducing free variational parameters $\gamma$ over $\theta$ and $\phi$ over $z$ and dropping the edges between them. This results in an approximate variational posterior $\begin{array} { r } { q ( \theta , z | \gamma , \phi ) \stackrel { \_ } { = } q _ { \gamma } \bar { ( \theta ) } \prod _ { n } \bar { q _ { \phi } } ( z _ { n } ) } \end{array}$ , which is optimized to best approximate the true posterior $p ( \boldsymbol { \theta } , z | \mathbf { w } , \alpha , \beta )$ . The optimization problem is to minimize
64
+
65
+ $$
66
+ \begin{array} { r } { L ( \gamma , \phi \mid \alpha , \beta ) = D _ { K L } \left[ q ( \theta , z \vert \gamma , \phi ) \vert \vert p ( \theta , z \vert \mathbf { w } , \alpha , \beta ) \right] - \log p ( \mathbf { w } \vert \alpha , \beta ) . } \end{array}
67
+ $$
68
+
69
+ In fact the above equation is a lower bound to the marginal log likelihood, sometimes called an evidence lower bound $( E L B O )$ , a fact which can be easily verified by multiplying and dividing (1) by the variational posterior and then applying Jensen’s inequality on its logarithm. Note that the mean field method optimizes over an independent set of variational parameters for each document. To emphasize this, we will refer to this standard method by the non-standard name of Decoupled Mean-Field Variational Inference (DMFVI).
70
+
71
+ For LDA, this optimization has closed form coordinate descent equations due to the conjugacy between the Dirichlet and multinomial distributions. Although this is a computationally convenient aspect of DMFVI, it also limits its flexibility. Applying DMFVI to new models relies on the practitioner’s ability to derive the closed form updates, which can be impractical and sometimes impossible.
72
+
73
+ AEVB (Kingma & Welling, 2014; Rezende et al., 2014) is one of several recent methods that aims at “black box” inference methods to sidestep this issue. First, rewrite the ELBO as
74
+
75
+ $$
76
+ L ( \gamma , \phi \mid \alpha , \beta ) = - D _ { K L } \left[ q ( \theta , z | \gamma , \phi ) | | p ( \theta , z | \alpha ) \right] + \mathbb { E } _ { q ( \theta , z | \gamma , \phi ) } [ \log p ( \mathbf { w } | z , \theta , \alpha , \beta ) ]
77
+ $$
78
+
79
+ This form is intuitive. The first term attempts to match the variational posterior over latent variables to the prior on the latent variables, while the second term ensures that the variational posterior favors values of the latent variables that are good at explaining the data. By analogy to autoencoders, this second term is referred to as a reconstruction term.
80
+
81
+ What makes this method “Autoencoding,” and in fact the main difference from DMFVI, is the parameterization of the variational distribution. In AEVB, the variational parameters are computed by using a neural network called an inference network that takes the observed data as input. For example, if the model prior $p ( \theta )$ were Gaussian, we might define the inference network as a feedforward neural network $( \mu ( \mathbf { w } ) , \mathbf { v } ( \mathbf { w } ) ) = f ( \mathbf { w } , \gamma )$ , where $\mu ( \mathbf { w } )$ and $\mathbf { v } ( \mathbf { w } )$ are both vectors of length $k$ , and $\gamma$ are the network’s parameters. Then we might choose a Gaussian variational distribution $q _ { \gamma } ( \theta ) = N ( \theta ; \mu ( \mathbf { w } ) , \mathrm { d i a g } ( \bar { \mathbf { v } ( \mathbf { w } ) } ) )$ , where $\mathrm { d i a g ( \cdot \cdot \cdot ) }$ produces a diagonal matrix from a column vector. The variational parameters $\gamma$ can then be chosen by optimizing the ELBO (3). Note that we have now, unlike DMFVI, coupled the variational parameters for different documents because they are all computed from the same neural network. To compute the expectations with respect to $q$ in (3), Kingma & Welling (2014); Rezende et al. (2014) use a Monte Carlo estimator which they call the “reparameterization trick” (RT; appears also in Williams (1992)). In the RT, we define a variate $U$ with a simple distribution that is independent of all variational parameters, like a uniform or standard normal, and a reparameterization function $F$ such that $F ( U , \gamma )$ has distribution $q _ { \gamma }$ . This is always possible, as we could choose $F$ to be the inverse cumulative distribution function of $q _ { \gamma }$ , although we will additionally want $F$ to be easy to compute and differentiable. If we can determine a suitable $F$ , then we can approximate (3) by taking Monte Carlo samples of $U$ , and optimize $\gamma$ using stochastic gradient descent.
82
+
83
+ # 3 AUTOENCODING VARIATIONAL BAYES IN LATENT DIRICHLET ALLOCATION
84
+
85
+ Although simple conceptually, applying AEVB to topic models raises several practical challenges. The first is the need to determine a reparameterization function for $q ( \theta )$ and $q ( z _ { n } )$ to use the RT. The $z _ { n }$ are easily dealt with, but $\theta$ is more difficult; if we choose $q ( \theta )$ to be Dirichlet, it is difficult to apply the RT, whereas if we choose $q$ to be Gaussian or logistic normal, then the KL divergence in (3) becomes more problematic. The second issue is the well known problem of component collapsing (Dinh & Dumoulin, 2016), which a type of bad local optimum that is particularly endemic to AEVB and similar methods. We describe our solutions to each of those problems in the next few subsections.
86
+
87
+ # 3.1 COLLAPSING z’S
88
+
89
+ Dealing with discrete variables like $\mathbf { z }$ using reparameterization can be problematic, but fortunately in LDA the variable $\mathbf { z }$ can be conveniently summed out. By collapsing $\mathbf { z }$ we are left with having to sample from $\theta$ only, reducing (1) to
90
+
91
+ $$
92
+ p ( \mathbf { w } | \alpha , \beta ) = \int _ { \theta } \left( \prod _ { n = 1 } ^ { N } p ( w _ { n } | \beta , \theta ) \right) p ( \theta | \alpha ) d \theta .
93
+ $$
94
+
95
+ where the distribution of $w _ { n } | \beta , \theta$ is Multinomial(1, $\beta \theta ,$ ), recalling that $\beta$ denotes the matrix of all topic-word probability vectors.
96
+
97
+ # 3.2 WORKING WITH DIRICHLET BELIEFS: LAPLACE APPROXIMATION
98
+
99
+ LDA gets its name from the Dirichlet prior on the topic proportions $\theta$ , and the choice of Dirichlet prior is important to obtaining interpretable topics (Wallach et al., 2009). But it is difficult to handle the Dirichlet within AEVB because it is difficult to develop an effective reparameterization function for the RT. Fortunately, a RT does exist for the Gaussian distribution and has been shown to perform quite well in the context of variational autoencoder (VAE) (Kingma & Welling, 2014).
100
+
101
+ We resolve this issue by constructing a Laplace approximation to the Dirichlet prior. Following MacKay (1998), we do so in the softmax basis instead of the simplex. There are two benefits of this choice. First, Dirichlet distributions are unimodal in the softmax basis with their modes coinciding with the means of the transformed densities. Second, the softmax basis also allows for carrying out unconstrained optimization of the cost function without the simplex constraints. The Dirichlet probability density function in this basis over the softmax variable $\mathbf { h }$ is given by
102
+
103
+ $$
104
+ P ( \theta ( \mathbf { h } ) | \alpha ) = \frac { \Gamma ( \sum _ { k } \alpha _ { k } ) } { \prod _ { k } \Gamma ( \alpha _ { k } ) } \prod _ { k } \theta _ { k } ^ { \alpha _ { k } } g ( \mathbf { 1 } ^ { T } \mathbf { h } ) .
105
+ $$
106
+
107
+ Here $\theta = \sigma ( { \bf h } )$ , where $\sigma ( . )$ represents the softmax function. Recall that the Jacobian of $\sigma$ is proportional to $\textstyle \prod _ { k } \theta _ { k }$ and $g ( \cdot )$ is an arbitrary density that ensures integrability by constraining the redundant degree of freedom. We use the Laplace approximation of Hennig et al. (2012), which
108
+
109
+ has the property that the covariance matrix becomes diagonal for large $k$ (number of topics). This approximation to the Dirichlet prior $p ( \theta | \alpha )$ is results in the distribution over the softmax variables h as a multivariate normal with mean $\mu _ { 1 }$ and covariance matrix $\Sigma _ { 1 }$ where
110
+
111
+ $$
112
+ \begin{array} { c l } { \displaystyle \mu _ { 1 k } = \log \alpha _ { k } - \frac 1 K \sum _ { i } \log \alpha _ { i } } \\ { \displaystyle \sum _ { 1 k k } = \frac 1 { \alpha _ { k } } \left( 1 - \frac 2 K \right) + \frac 1 { K ^ { 2 } } \sum _ { i } \frac 1 { \alpha _ { k } } . } \end{array}
113
+ $$
114
+
115
+ Finally, we approximate $p ( \theta | \alpha )$ in the simplex basis with $\hat { p } ( \theta | \mu _ { 1 } , \Sigma _ { 1 } ) = \mathcal { L N } ( \theta | \mu _ { 1 } , \Sigma _ { 1 } )$ where $\mathcal { L N }$ is a logistic normal distribution with parameters $\mu _ { 1 } , \Sigma _ { 1 }$ . Although we approximate the Dirichlet prior in LDA with a logistic normal, this is not the same idea as a correlated topic model (Blei & Lafferty, 2006), because we use a diagonal covariance matrix. Rather, it is an approximation to standard LDA.
116
+
117
+ # 3.3 VARIATIONAL OBJECTIVE
118
+
119
+ Now we can write the modified variational objective function. We use a logistic normal variational distribution over $\theta$ with diagonal covariance. More precisely, we define two inference networks as feed forward neural networks $f _ { \mu }$ and $f _ { \Sigma }$ with parameters $\delta$ ; the output of each network is a vector in $\mathbb { R } ^ { K }$ . Then for a document w, we define $q ( \theta )$ to be logistic normal with mean $\mu _ { 0 } = f _ { \mu } ( \mathbf { w } , \pmb \delta )$ and diagonal covariance $\pmb { \Sigma } _ { 0 } = \mathrm { d i a g } ( f _ { \Sigma } ( \mathbf { w } , \pmb { \delta } ) )$ , where diag converts a column vector to a diagonal matrix. Note that we can generate samples from $q ( \theta )$ by sampling $\epsilon \sim \mathcal { N } ( 0 , I )$ and computing $\theta = \sigma ( \pmb { \mu } _ { 0 } + \pmb { \Sigma } _ { 0 } ^ { 1 / 2 } \pmb { \epsilon } ) .$ .
120
+
121
+ We can now write the ELBO as
122
+
123
+ $$
124
+ \begin{array} { r } { L ( \boldsymbol { \Theta } ) = \displaystyle \sum _ { d = 1 } ^ { D } \Bigg [ - \left( \frac { 1 } { 2 } \Big \{ t r ( \boldsymbol { \Sigma } _ { 1 } ^ { - 1 } \boldsymbol { \Sigma } _ { 0 } ) + ( \boldsymbol { \mu } _ { 1 } - \boldsymbol { \mu } _ { 0 } ) ^ { T } \boldsymbol { \Sigma } _ { 1 } ^ { - 1 } ( \boldsymbol { \mu } _ { 1 } - \boldsymbol { \mu } _ { 0 } ) - K + \log \frac { | \boldsymbol { \Sigma } _ { 1 } | } { | \boldsymbol { \Sigma } _ { 0 } | } \Big \} \right) } \\ { + \mathbb { E } _ { \epsilon \sim \mathcal { N } ( 0 , I ) } \Bigg [ \mathbf { w } _ { d } ^ { \top } \log \Big ( \sigma ( \boldsymbol { \beta } ) \sigma ( \boldsymbol { \mu } _ { 0 } + \boldsymbol { \Sigma } _ { 0 } ^ { 1 / 2 } \boldsymbol { \epsilon } ) \Big ) \Bigg ] \Bigg ] , } \end{array}
125
+ $$
126
+
127
+ where $\Theta$ represents the set of all the model and variational parameters and $\mathbf { w } _ { 1 } \ldots \mathbf { w } _ { D }$ are the documents in the corpus. The first line in this equation arises from the KL divergence between the two logistic normal distributions $q$ and $\hat { p }$ , while the second line is the reconstruction error.
128
+
129
+ In order to impose the simplex constraint on the $\beta$ matrix during the optimization, we apply the softmax transformation. That is, each topic $\beta _ { k } \in \mathbb { R } ^ { V }$ is unconstrained, and the notation $\sigma ( \beta )$ means to apply the softmax function separately to each column of the matrix $\beta$ . Note that the mixture of multinomials for each word $w _ { n }$ can then be written as $p ( w _ { n } | \beta , \theta ) = [ \sigma ( \beta ) \theta ] _ { w _ { n } }$ , which explains the ndot product in (7). To optimize (7), we use stochastic gradient descent using Monte Carlo samples from , following the Law of the Unconscious Statistician.
130
+
131
+ # 3.4 TRAINING AND PRACTICAL CONSIDERATIONS: DEALING WITH COMPONENT COLLAPSING
132
+
133
+ AEVB is prone to component collapsing (Dinh & Dumoulin, 2016), which is a particular type of local optimum very close to the prior belief, early on in the training. As the latent dimensionality of the model is increased, the KL regularization in the variational objective dominates, so that the outgoing decoder weights collapse for the components of the latent variable that reach close to the prior and do not show any posterior divergence. In our case, the collapsing specifically occurs because of the inclusion of the softmax transformation to produce $\theta$ . The result is that the $k$ inferred topics are identical as shown in table 7.
134
+
135
+ We were able to resolve this issue by tweaking the optimization. Specifically, we train the network with the ADAM optimizer (Kingma & Ba, 2015) using high moment weight $( \beta 1 )$ and learning rate $( \eta )$ . Through training at higher rates, early peaks in the functional space can be easily avoided. The problem is that momentum based training coupled with higher learning rate causes the optimizer to diverge. While explicit gradient clipping helps to a certain extent, we found that batch normalization (Ioffe & Szegedy, 2015) does even better by smoothing out the functional space and hence curbing sudden divergence.
136
+
137
+ Finally, we also found an increase in performance with dropout units when applied to $\theta$ to force the network to use more of its capacity.
138
+
139
+ While more prominent in the AEVB framework, the collapsing can also occurs in DMFVI if the learning offset (referred to as the $\tau$ parameter (Hofmann, 1999)) is not set properly. Interestingly, a similar learning offset or annealing based approach can also be used to down-weight the KL term in early iterations of the training to avoid local optima.
140
+
141
+ # 4 PRODLDA: LATENT DIRICHLET ALLOCATION WITH PRODUCTS OF EXPERTS
142
+
143
+ In LDA, the distribution $p ( \mathbf { w } | \theta , \beta )$ is a mixture of multinomials. A problem with this assumption is that it can never make any predictions that are sharper than the components that are being mixed (Hinton & Salakhutdinov, 2009). This can result in some topics appearing that are poor quality and do not correspond well with human judgment. One way to resolve this issue is to replace this word-level mixture with a weighted product of experts which by definition is capable of making sharper predictions than any of the constituent experts (Hinton, 2002). In this section we present a novel topic model PRODLDA that replaces the mixture assumption at the word-level in LDA with a weighted product of experts, resulting in a drastic improvement in topic coherence. This is a good illustration of the benefits of a black box inference method, like AVITM, to allow exploration of new models.
144
+
145
+ # 4.1 MODEL
146
+
147
+ The PRODLDA model can be simply described as latent Dirichlet allocation where the word-level mixture over topics is carried out in natural parameter space, i.e. the topic matrix is not constrained to exist in a multinomial simplex prior to mixing. In other words, the only changes from LDA are that $\beta$ is unnormalized, and that the conditional distribution of $w _ { n }$ is defined as $w _ { n } | \beta , \theta \ \sim$ Multinomia $( 1 , \sigma ( \beta \theta ) )$ .
148
+
149
+ The connection to a product of experts is straightforward, as for the multinomial, a mixture of natural parameters corresponds to a weighted geometric average of the mean parameters. That is, consider two $N$ dimensional multinomials parametrized by mean vectors $\mathbf { p }$ and $\mathbf { q }$ . Define the corresponding natural parameters as $\mathbf { p } = \sigma ( \pmb { r } )$ and $\mathbf { q } = \sigma ( \pmb { \mathscr { s } } )$ , and let $\delta \in [ 0 , 1 ]$ . It is then easy to show that
150
+
151
+ $$
152
+ P \Big ( \mathbf { x } | \delta r + ( 1 - \delta ) \pmb { s } \Big ) \propto \prod _ { i = 1 } ^ { N } \sigma ( \delta r _ { i } + ( 1 - \delta ) s _ { i } ) ^ { x _ { i } } \propto \prod _ { i = 1 } ^ { N } [ r _ { i } ^ { \delta } \cdot s _ { i } ^ { ( 1 - \delta ) } ] ^ { x _ { i } } .
153
+ $$
154
+
155
+ So the PRODLDA model can be simply described as a product of experts, that is, $p ( w _ { n } | \theta , \beta ) \ \propto$ $\begin{array} { r } { \prod _ { k } p ( w _ { n } | z _ { n } = k , \beta ) ^ { \theta _ { k } } } \end{array}$ . PRODLDA is an instance of the exponential-family PCA (Collins et al., 2001) class, and relates to the exponential-family harmoniums (Welling et al., 2004) but with nonGaussian priors.
156
+
157
+ # 5 RELATED WORK
158
+
159
+ For an overview of topic modeling, see Blei (2012). There are several examples of topic models based on neural networks and neural variational inference (Hinton & Salakhutdinov, 2009; Larochelle & Lauly, 2012; Mnih & Gregor, 2014; Miao et al., 2016) but we are unaware of methods that apply AEVB generically to a topic model specified by an analyst, or even of a successful application of AEVB to the most widely used topic model, latent Dirichlet allocation.
160
+
161
+ Recently, Miao et al. (2016) introduced a closely related model called the Neural Variational Document Model (NVDM). This method uses a latent Gaussian distribution over topics, like probabilistic latent semantic indexing, and averages over topic-word distributions in the logit space. However, they do not use either of the two key aspects of our work: explicitly approximating the Dirichlet prior using a Gaussian, or high-momentum training. In the experiments we show that these aspects lead to much improved training and much better topics.
162
+
163
+ # 6 EXPERIMENTS AND RESULTS
164
+
165
+ Qualitative evaluation of topic models is a challenging task and consequently a large body of work has developed automatic evaluation metrics that attempt to match human judgment of topic quality. Traditionally, perplexity has been used to measure the goodness-of-fit of the model but it has been repeatedly shown that perplexity is not a good metric for qualitative evaluation of topics (Newman et al., 2010). Several new metrics of topic coherence evaluation have thus been proposed; see Lau et al. (2014) for a comparative review. Lau et al. (2014) showed that among all the competing metrics, normalized pointwise mutual information (NPMI) between all the pairs of words in a set of topics matches human judgment most closely, so we adopt it in this work. We also report perplexity, primarily as a way of evaluating the capability of different optimizers. Following standard practice (Blei et al., 2003), for variational methods we use the ELBO to calculate perplexity. For AEVB methods, we calculate the ELBO using the same Monte Carlo approximation as for training.
166
+
167
+ We run experiments on both the 20 Newsgroups (11,000 training instances with 2000 word vocabulary) and RCV1 Volume 2 ( 800K training instances with 10000 word vocabulary) datasets. Our preprocessing involves tokenization, removal of some non UTF-8 characters for 20 Newsgroups and English stop word removal. We first compare our AVITM inference method with the standard online mean-field variational inference (Hoffman et al., 2010) and collapsed Gibbs sampling (Griffiths & Steyvers, 2004) on the LDA model. We use standard implementations of both methods, scikit-learn for DMFVI and mallet (McCallum, 2002) for collapsed Gibbs. Then we compare two autoencoding inference methods on three different topic models: standard LDA, PRODLDA using our inference method and the Neural Variational Document Model (NVDM) (Miao et al., 2016), using the inference described in the paper.2
168
+
169
+ Table 1: Average topic coherence on the 20 Newsgroups dataset. Higher is better.
170
+
171
+ <table><tr><td rowspan=1 colspan=1># topics</td><td rowspan=1 colspan=1>ProdLDAVAE</td><td rowspan=1 colspan=1>LDAVAE</td><td rowspan=1 colspan=1>LDADMFVI</td><td rowspan=1 colspan=1>LDACollapsed Gibbs</td><td rowspan=1 colspan=1>NVDM</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>0.24</td><td rowspan=1 colspan=1>0.11</td><td rowspan=1 colspan=1>0.11</td><td rowspan=1 colspan=1>0.17</td><td rowspan=1 colspan=1>0.08</td></tr><tr><td rowspan=1 colspan=1>200</td><td rowspan=1 colspan=1>0.19</td><td rowspan=1 colspan=1>0.11</td><td rowspan=1 colspan=1>0.06</td><td rowspan=1 colspan=1>0.14</td><td rowspan=1 colspan=1>0.06</td></tr></table>
172
+
173
+ Tables 1 and 2 show the average topic coherence values for all the models for two different settings of $k$ , the number of topics. Comparing the different inference methods for LDA, we find that, consistent with previous work, collapsed Gibbs sampling yields better topics than mean-field methods. Among the variational methods, we find that VAE-LDA model (AVITM) 3 yields similar topic coherence and perplexity to the standard DMFVI (although in some cases, VAE-LDA yields significantly better topics). However, AVITM is significantly faster to train than DMFVI. It takes 46 seconds on 20 Newsgroup compared to 18 minutes for DMFVI. Whereas for a million document corpus of RCV1 it only under 1.5 hours while scikit-learn’s implementation of DMFVI failed to return any results even after running for 24 hours.4
174
+
175
+ Comparing the new topic models than LDA, it is clear that PRODLDA finds significantly better topics than LDA, even when trained by collapsed Gibbs sampling. To verify this qualitatively, we display examples of topics from all the models in Table 6. The topics from ProdLDA appear visually more coherent than NVDM or LDA. Unfortunately, NVDM does not perform comparatively to LDA
176
+
177
+ <table><tr><td rowspan=1 colspan=1># topics</td><td rowspan=1 colspan=1>ProdLDAVAE</td><td rowspan=1 colspan=1>LDAVAE</td><td rowspan=1 colspan=1>LDADMFVI</td><td rowspan=1 colspan=1>LDACollapsed Gibbs</td><td rowspan=1 colspan=1>NVDM</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>0.14</td><td rowspan=1 colspan=1>0.07</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>0.04</td><td rowspan=1 colspan=1>0.07</td></tr><tr><td rowspan=1 colspan=1>200</td><td rowspan=1 colspan=1>0.12</td><td rowspan=1 colspan=1>0.05</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>0.06</td><td rowspan=1 colspan=1>0.05</td></tr></table>
178
+
179
+ Table 2: Average topic coherence on the RCV1 dataset. Higher is better. Results not reported for LDA DMFVI, as inference failed to converge in 24 hours.
180
+
181
+ Table 3: Perplexity scores for 20 Newsgroups. Lower is better.
182
+
183
+ <table><tr><td rowspan=1 colspan=1># topics</td><td rowspan=1 colspan=1>ProdLDAVAE</td><td rowspan=1 colspan=1>LDAVAE</td><td rowspan=1 colspan=1>LDADMFVI</td><td rowspan=1 colspan=1>LDACollapsed Gibbs</td><td rowspan=1 colspan=1>NVDM</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>1172</td><td rowspan=1 colspan=1>1059</td><td rowspan=1 colspan=1>1046</td><td rowspan=1 colspan=1>728</td><td rowspan=1 colspan=1>837</td></tr><tr><td rowspan=1 colspan=1>200</td><td rowspan=1 colspan=1>1168</td><td rowspan=1 colspan=1>1128</td><td rowspan=1 colspan=1>1195</td><td rowspan=1 colspan=1>688</td><td rowspan=1 colspan=1>884</td></tr></table>
184
+
185
+ for any value of $k$ . To avoid any training dissimilarities we train all the competing models until we reach the perplexities that were reported in previous work. These are reported in Table $3 ^ { 5 }$ .
186
+
187
+ A major benefit of AVITM inference is that it does not require running variational optimization, which can be costly, for new data. Rather, the inference network can be used to obtain topic proportions for new documents for new data points without running any optimization. We evaluate whether this approximation is accurate, i.e. whether the neural network effectively learns to mimic probabilistic inference. We verify this by training the model on the training set, then on the test set, holding the topics $\beta$ matrix) fixed, and comparing the test perplexity if we obtain topic proportions by running the inference neural network directly, or by the standard method of variational optimization of the inference network on the test set. As shown in Table 4, the perplexity remains practically un-changed. The computational benefits of this are remarkable. On both the datasets, computing perplexity using the neural network takes well under a minute, while running the standard variational approximation takes $\sim 3$ minutes even on the smaller 20 Newsgroups data. Finally, we investigate the reasons behind the improved topic coherence in PRODLDA. First, Table 5 explores the effects of each of our two main ideas separately. In this table, “Dirichlet” means that the prior is the Laplace approximation to Dirichlet $\langle \alpha = 0 . 0 2 \rangle$ , while “Gaussian” indicates that we use a standard Gaussian as prior. ‘High Learning Rate” training means we use $\beta 1 > 0 . 8$ and $0 . 1 > \eta > 0 . 0 0 1 ^ { 6 }$ with batch normalization, whereas “Low Learning Rate” means $\beta 1 > 0 . 8$ and $0 . 0 0 0 9 > \eta > 0 . 0 0 0 0 9$ without batch normalization. (For both parameters, the precise value was chosen by Bayesian optimization. We found that these values in the ”with BN” cases were close to the default settings in the Adam optimizer.) We find that the high topic coherence that we achieve in this work is only possible if we use both tricks together. In fact the high learning rates with momentum is required to avoid local minima in the beginning of the training and batch-normalization is required to be able to train the network at these values without diverging. If trained at a lower momentum value or at a lower learning rate PRODLDA shows component collapsing. Interestingly, if we choose a Gaussian prior, rather than the logistic normal approximation used in ProdLDA or NVLDA, the model is easier to train even with low learning rate without any momentum or batch normalization.
188
+
189
+ The main advantage of AVITM topic models as opposed to NVDM is that the Laplace approximation allows us to match a specific Dirichlet prior of interest. As pointed out by Wallach et al. (2009), the choice of Dirichlet hyperparameter is important to the topic quality of LDA. Following this reasoning, we hypothesize that AVITM topics are higher quality than those of NVDM because they are much more focused, i.e., apply to a more specific subset of documents of interest. We provide support for this hypothesis in Figure 1, by evaluating the sparsity of the posterior proportions over topics, that is, how many of the model’s topics are typically used to explain each document. In order to estimate the sparsity in topic proportions, we project samples from the Gaussian latent spaces of PRODLDA and NVDM in the simplex and average them across documents. We compare the topic sparsity for the standard Gaussian prior used by NVDM to the Laplace approximation of Dirichlet priors with different hyperparameters. Clearly the Laplace approximation to the Dirichlet prior significantly promotes sparsity, providing support for our hypothesis that preserving the Dirichlet prior explains the the increased topic coherence in our method.
190
+
191
+ Table 4: Evaluation of inference network of VAE-LDA on 20 Newsgroups test set. “Inference network only” shows the test perplexity when the inference network is trained on the training set, but no variational optimization is performed on the test set. “Inference Network $^ +$ Optimization” shows the standard approach of optimizing the ELBO on the test set. The neural network effectively learns to approximate probabilistic inference effectively.
192
+
193
+ <table><tr><td rowspan=1 colspan=1># Topics</td><td rowspan=1 colspan=1>Inference Network Only</td><td rowspan=1 colspan=1>Inference Network + Optimization</td></tr><tr><td rowspan=1 colspan=1>50</td><td rowspan=1 colspan=1>1172</td><td rowspan=1 colspan=1>1162</td></tr><tr><td rowspan=1 colspan=1>200</td><td rowspan=1 colspan=1>1168</td><td rowspan=1 colspan=1>1151</td></tr></table>
194
+
195
+ ![](images/b2094ca292cd2e8de3ce313104a3413e9ae589d52d53d728144ce0132732c235.jpg)
196
+ Figure 1: Effect of prior assumptions on $\theta$ on sparsity of $\theta$ in neural topic models.
197
+
198
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Dirichlet+High Learning Rate</td><td rowspan=1 colspan=1>Dirichlet+Low Learning Rate</td><td rowspan=1 colspan=1>GaussianPrior+High Learning Rate</td><td rowspan=1 colspan=1>GaussianPrior+Low Learning Rate</td></tr><tr><td rowspan=1 colspan=1>Topic Coherence</td><td rowspan=1 colspan=1>0.24</td><td rowspan=1 colspan=1>0.016</td><td rowspan=1 colspan=1>0.08</td><td rowspan=1 colspan=1>0.08</td></tr></table>
199
+
200
+ Table 5: Average topic coherence for different choices of prior and optimization strategies of PRODLDA on 20 Newsgroup for $k = 5 0$ .
201
+
202
+ The inference network architecture can be found in figure 2 in the appendix.
203
+
204
+ # 7 DISCUSSION AND FUTURE WORK
205
+
206
+ We present what is to our knowledge the first effective AEVB inference algorithm for latent Dirichlet allocation. Although this combination may seem simple in principle, in practice this method is difficult to train because of the Dirichlet prior and because of the component collapsing problem. By addressing both of these problems, we presented a black-box inference method for topic models with the notable advantage that the neural network allows computing topic proportions for new documents without the need to run any variational optimization. As an illustration of the advantages of
207
+
208
+ Table 6: Five randomly selected topics from all the models.
209
+
210
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Topics</td></tr><tr><td rowspan=1 colspan=1>ProdLDA</td><td rowspan=1 colspan=1>motherboard meg printer quadra hd windows processor vga mhz connectorarmenian genocide turks turkish muslim massacre turkey armenians armenia greekvoltage nec outlet circuit cable wiring wire panel motor installseasonnhl teamhockeyplayoff puckleague flyersdefensiveplayerisrael israeli lebanese arab lebanon arabs civilian territory palestinian militia</td></tr><tr><td rowspan=1 colspan=1>LDANVLDA</td><td rowspan=1 colspan=1>db file output program line entry write bit int returndrive disk get card scsi use hard ide controller onegame team play win year player get think good makeuse law state health file gun public issue control firearmpeople say one think life make know god man see</td></tr><tr><td rowspan=1 colspan=1>LDADMFVI</td><td rowspan=1 colspan=1>write article dod ride right go get night dealer likegun law use drug crime government court criminal firearm controllunar flyers hitter spacecraft power us existence god go meanstephanopoulos encrypt spacecraft ripem rsa cipher saturn violate lunar cryptofile program available server version include software entry ftp use</td></tr><tr><td rowspan=1 colspan=1>LDACollapsed Gibbs</td><td rowspan=1 colspan=1>get right back light side like see take time onelist mail send post anonymous internet file information user messagethanks please know anyone help look appreciate get need emailjesus church god law say christian one christ day comebike dod ride dog motorcycle write article bmw helmet get</td></tr><tr><td rowspan=1 colspan=1>NVDM</td><td rowspan=1 colspan=1>light die burn body life inside mother tear kill christianinsurance drug different sport friend bank owner vancouver buy prayerinput package interface output tape offer component channel level modelprice quadra hockey slot san playoff jose deal market dealerchristian church gateway catholic christianity homosexual resurrection modem mouse sunday</td></tr></table>
211
+
212
+ <table><tr><td>3.write article thanks anyone please like get one think look 4.article write one get like know thanks anyone try need</td><td>1. write article get thanks like anyone please know look one 2.article write one please like anyone know make want get</td></tr></table>
213
+
214
+ Table 7: VAE-LDA fails to learn any meaningful topics when component collapsing occurs. The table shows five randomly sampled topics (, which are essentially slight variants of each other) from when the VAE-LDA model is trained without BN and high momentum training.
215
+
216
+ black box inference techniques, we presented a new topic model, ProdLDA, which achieves significantly better topics than LDA, while requiring a change of only one line of code from AVITM for LDA. Our results suggest that AVITM inference is ready to take its place alongside mean field and collapsed Gibbs as one of the workhorse inference methods for topic models. Future work could include extending our inference methods to handle dynamic and correlated topic models.
217
+
218
+ # ACKNOWLEDGMENTS
219
+
220
+ We thank Andriy Mnih, Chris Dyer, Chris Russell, David Blei, Hannah Wallach, Max Welling, Mirella Lapata and Yishu Miao for helpful comments, discussions and feedback.
221
+
222
+ # REFERENCES
223
+
224
+ David Blei. Probabilistic topic models. Communications of the ACM, 55(4):77–84, 2012.
225
+
226
+ David M. Blei and John D. Lafferty. Correlated topic models. In Advances in Neural Information Processing Systems, 2006.
227
+
228
+ David M. Blei and John D. Lafferty. A correlated topic model of science. Annals of Applied Statistics, 1(1):17–35, 2007.
229
+
230
+ David M Blei, Andrew Y Ng, and Michael I Jordan. Latent dirichlet allocation. Journal of machine Learning research, 3(Jan):993–1022, 2003.
231
+
232
+ Michael Collins, Sanjoy Dasgupta, and Robert E Schapire. A generalization of principal component analysis to the exponential family. In Advances in Neural Information Processing Systems, volume 13, pp. 23, 2001.
233
+
234
+ Peter Dayan, Geoffrey E Hinton, Radford M Neal, and Richard S Zemel. The helmholtz machine. Neural Computation, 7(5):889–904, 1995.
235
+
236
+ James M Dickey. Multiple hypergeometric functions: Probabilistic interpretations and statistical uses. Journal of the American Statistical Association, 78(383):628–637, 1983.
237
+
238
+ Laurent Dinh and Vincent Dumoulin. Training neural Bayesian nets. http://www. iro.umontreal.ca/˜bengioy/cifar/NCAP2014-summerschool/slides/ Laurent_dinh_cifar_presentation.pdf, August 2016.
239
+
240
+ Li Fei-Fei and Pietro Perona. A Bayesian hierarchical model for learning natural scene categories. In IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR’05), volume 2, pp. 524–531. IEEE, 2005.
241
+
242
+ Thomas L Griffiths and Mark Steyvers. Finding scientific topics. Proceedings of the National academy of Sciences, 101(suppl 1):5228–5235, 2004.
243
+
244
+ Philipp Hennig, David H Stern, Ralf Herbrich, and Thore Graepel. Kernel topic models. In AISTATS, pp. 511–519, 2012.
245
+
246
+ Geoffrey E Hinton. Training products of experts by minimizing contrastive divergence. Neural computation, 14(8):1771–1800, 2002.
247
+
248
+ Geoffrey E Hinton and Ruslan R Salakhutdinov. Replicated softmax: an undirected topic model. In Advances in Neural Information Processing Systems, pp. 1607–1614, 2009.
249
+
250
+ Matthew Hoffman, Francis R Bach, and David M Blei. Online learning for latent dirichlet allocation. In Advances in Neural Information Processing Systems, pp. 856–864, 2010.
251
+
252
+ Thomas Hofmann. Probabilistic latent semantic indexing. In Proceedings of the 22nd annual international ACM SIGIR conference on Research and development in information retrieval, pp. 50–57. ACM, 1999.
253
+
254
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. pp. 448–456, 2015.
255
+
256
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. 3rd International Conference on Learning Representations (ICLR), 2015.
257
+
258
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. The International Conference on Learning Representations (ICLR), Banff, 2014.
259
+
260
+ Alp Kucukelbir, Dustin Tran, Rajesh Ranganath, Andrew Gelman, and David M Blei. Automatic differentiation variational inference. arXiv preprint arXiv:1603.00788, 2016.
261
+
262
+ Hugo Larochelle and Stanislas Lauly. A neural autoregressive topic model. In Advances in Neural Information Processing Systems, pp. 2708–2716, 2012.
263
+
264
+ Jey Han Lau, David Newman, and Timothy Baldwin. Machine reading tea leaves: Automatically evaluating topic coherence and topic model quality. In EACL, pp. 530–539, 2014.
265
+
266
+ David JC MacKay. Choice of basis for Laplace approximation. Machine learning, 33(1):77–86, 1998.
267
+
268
+ Andrew McCallum. Mallet: A machine learning for language toolkit. http://mallet.cs. umass.edu, 2002.
269
+
270
+ Yishu Miao, Lei Yu, and Phil Blunsom. Neural variational inference for text processing. pp. 1727– 1736, 2016.
271
+
272
+ David Mimno. Reconstructing Pompeian households. In Applications of Topic Models Workshop, NIPS, 2009.
273
+
274
+ Andriy Mnih and Karol Gregor. Neural variational inference and learning in belief networks. pp. 1791–1799, 2014.
275
+
276
+ David Newman, Jey Han Lau, Karl Grieser, and Timothy Baldwin. Automatic evaluation of topic coherence. In Human Language Technologies: The 2010 Annual Conference of the North American Chapter of the Association for Computational Linguistics, pp. 100–108. Association for Computational Linguistics, 2010.
277
+
278
+ Rajesh Ranganath, Sean Gerrish, and David M Blei. Black box variational inference. In AISTATS, pp. 814–822, 2014.
279
+
280
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. pp. 1278–1286, 2014.
281
+
282
+ Simon Rogers, Mark Girolami, Colin Campbell, and Rainer Breitling. The latent process decomposition of cdna microarray data sets. IEEE/ACM Transactions on Computational Biology and Bioinformatics (TCBB), 2(2):143–156, 2005.
283
+
284
+ Hanna Wallach, David Mimno, and Andrew McCallum. Rethinking LDA: Why priors matter. In NIPS, 2009.
285
+
286
+ Max Welling, Michal Rosen-Zvi, and Geoffrey E Hinton. Exponential family harmoniums with an application to information retrieval. In Advances in Neural Information Processing Systems, volume 4, pp. 1481–1488, 2004.
287
+
288
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning, 8(3-4):229–256, 1992.
289
+
290
+ A NETWORK ARCHITECTURE
291
+
292
+ ![](images/739c5c2afeba6028c8dc8a3876cc7e62cf223b081b151b4c71c000e9372c9a48.jpg)
293
+ Figure 2: Architecture of the inference network used in the experiments.
md/train/ByeSdsC9Km/ByeSdsC9Km.md ADDED
@@ -0,0 +1,302 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADAPTIVE POSTERIOR LEARNING: FEW-SHOT LEARNING WITH A SURPRISE-BASED MEMORY MODULE
2
+
3
+ Tiago Ramalho
4
+ Cogent Labs
5
+ tramalho@cogent.co.jp
6
+ Marta Garnelo
7
+ DeepMind
8
+ garnelo@google.com
9
+
10
+ # ABSTRACT
11
+
12
+ The ability to generalize quickly from few observations is crucial for intelligent systems. In this paper we introduce APL, an algorithm that approximates probability distributions by remembering the most surprising observations it has encountered. These past observations are recalled from an external memory module and processed by a decoder network that can combine information from different memory slots to generalize beyond direct recall. We show this algorithm can perform as well as state of the art baselines on few-shot classification benchmarks with a smaller memory footprint. In addition, its memory compression allows it to scale to thousands of unknown labels. Finally, we introduce a meta-learning reasoning task which is more challenging than direct classification. In this setting, APL is able to generalize with fewer than one example per class via deductive reasoning.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Consider the following sequential decision problem: at every iteration of an episode we are provided with an image of a digit (e.g. MNIST) and an unknown symbol. Our goal is to output a digit $Y = X + S$ where $X$ is the value of the MNIST digit, and $S$ is a numerical value that is randomly assigned to the unknown symbol at the beginning of each episode. After seeing only a single instance of a symbol an intelligent system should not only be able to infer the value $S$ of the symbol but also to correctly generalize the operation associated with the symbol to any other digit in the remaining iterations of that episode.
17
+
18
+ Despite its simplicity, this task emphasizes three cognitive abilities that a generic learning algorithm should display: 1. the algorithm can learn a behaviour and then flexibly apply it to a range of different tasks using only a few context observations at test time; 2. the algorithm can memorize and quickly recall previous experiences for quick adaptation; and 3. the algorithm can process these recalled memories in a non-trivial manner to carry out tasks that require reasoning.
19
+
20
+ The first point is commonly described as “learning to learn” or meta-learning, and represents a new way of looking at statistical inference (Schmidhuber, 1987; Bengio et al., 1990; Bengio & LeCun, 2007). Traditional neural networks are trained to approximate arbitrary probability distributions with great accuracy by parametric adaptation via gradient descent (LeCun et al., 2015; Schmidhuber, 2015). After training that probability distribution is fixed and neural networks can only generalize well when the testing distribution matches the training distribution (Neyshabur et al., 2017). In contrast, meta-learning systems are trained to learn an algorithm that infers a function directly from the observations it receives at test time. This setup is more flexible than the traditional approach and generalizes better to unseen distributions as it incorporates new information even after the training phase is over. It also allows these models to improve their accuracy as they observe more data, unlike models which learn a fixed distribution.
21
+
22
+ The second requirement - being able to memorize and efficiently recall previous experience - is another active area of research. Storing information in a model proves especially challenging as we move beyond small toy-examples to tasks with higher dimensional data or real-world problems.
23
+
24
+ Current methods often work around this by summarizing past experiences in one lower-dimensional representation (Hochreiter & Schmidhuber, 1997; Kingma & Welling, 2013) or using memory modules (Graves et al., 2016). While the former approach can produce good results, the representation and therefore the amount of information we can ultimately encode with such models will be of a fixed and thus limited size. Working with neural memory modules, on the other hand, presents its own challenges as learning to store and keep the right experiences is not trivial. In order to successfully carry out the task defined at the beginning of this paper a model should learn to capture information about a flexible and unbounded number of symbols observed in an episode without storing redundant information.
25
+
26
+ Finally, reasoning requires processing recalled experiences in order to apply the information they contain to the current data point being processed. In simple cases such as classification, it is enough to simply recall memories of similar data points and directly infer the current class by combining them using a weighted average or a simple kernel (Vinyals et al., 2016; Snell et al., 2017), which limits the models to performing interpolation. In the example mentioned above, more complex reasoning is necessary for human-level generalisation.
27
+
28
+ In this paper we introduce Approximate Posterior Learning (APL, pronounced like the fruit), a self-contained model and training procedure that address these challenges. APL learns to carry out few-shot approximation of new probability distributions and to store only as few context points as possible in order to carry out the current task. In addition it learns how to process recalled experiences to carry out tasks of varying degrees of complexity. This sequential algorithm was inspired by Bayesian posterior updating (Jaynes, 2003) in the sense that the output probability distribution is updated as more data is observed.
29
+
30
+ We demonstrate that APL can deliver accuracy comparable to other state-of-the-art algorithms in standard few-shot classification benchmarks while being more data efficient. We also show it can scale to a significantly larger number of classes while retaining good performance. Finally, we apply APL to the reasoning task introduced as motivation and verify that it can perform the strong generalization we desire.
31
+
32
+ The main contributions of this paper are:
33
+
34
+ • A simple memory controller design which uses a surprise-based signal to write the most predictive items to memory. By not needing to learn what to write, we avoid costly backpropagation through memory which makes the setup easier and faster to train. This design also minimizes how much data is stored, making our method more memory efficient. • An integrated external and working memory architecture which can take advantage of the best of both worlds: scalability and sparse access provided by the working memory; and all-to-all attention and reasoning provided by a relational reasoning module. • A training setup which steers the system towards learning an algorithm which approximates the posterior without backpropagating through the whole sequence of data in an episode.
35
+
36
+ # 2 MODEL
37
+
38
+ # 2.1 ARCHITECTURE
39
+
40
+ Our proposed model is composed of a number of parts: an encoder that generates a representation for the incoming query data; an external memory store which contains previously seen representation/ data pairings with writing managed by a memory controller; and a decoder that ingests the query representation as well as data from the memory store to generate a probability distribution over targets. We describe each of the parts in detail below1.
41
+
42
+ Encoder The encoder is a function which takes in arbitrary data $x _ { t }$ and converts it to a representation $e _ { t }$ of (usually) lower dimensionality. In all our experiments $x _ { t }$ is an image, and we therefore choose a convolutional network architecture for the encoder. Architectural details of the encoder used for each of the experiments are provided in the appendix.
43
+
44
+ ![](images/355aa60c9185cd75d6b6a18b73b967f6ed0eaddd8a357d1f8458d35c4561f9d8.jpg)
45
+ Figure 1: APL model applied to the the classification of an Omniglot image. The encoded image is compared to the entries of the memory and the most relevant ones are passed through a decoder that outputs a probability distribution over the labels. The dotted line indicates the parts of the graph that are not updated via back-propagation.
46
+
47
+ Memory store The external memory module is a database containing the stored experiences. Each of the columns corresponds to one of the attributes of the data. In the case of classification, for example, we would store two columns: the embedding $e _ { m }$ and the true label $y _ { m }$ . Each of the rows contains the information for one data point. The memory module is queried by finding the k-nearest neighbors between a query and the data in a given column. The full row data for each of the neighbors is returned for later use. The distance metric used to calculate proximity between the points is an open choice, and here we always use euclidean distance.
48
+
49
+ Since we are not backpropagating through the memory, how do we ensure that the neighbors returned by the querying mechanism contain task-relevant information? We expect that class-discriminative embeddings produced by the encoder should cluster together in representation space, and therefore should be close in the sense of euclidean distance. While this is not mathematically necessary, in the following sections we will show that APL as proposed does work and retrieve the correct neighbors which means that in practice our intuition holds true.
50
+
51
+ Memory controller We use a simple memory controller which tries to minimize the amount of data points written to memory. Let us define surprise as the quantity associated with the prediction for label $y _ { t }$ as ${ \bf S } = - l n ( y _ { t } )$ . Intuitively, this means that the higher the probability our model assigns to the true class, the less surprised it will be.
52
+
53
+ This suggests a way of storing the minimal amount of data points in memory which supports maximal classification accuracy. If a data point is ’surprising’, it should be stored in memory; otherwise it can be safely discarded as the model can already classify it correctly.
54
+
55
+ How should the memory controller decide whether a point is ’surprising’? In this work we choose the simplest possible controller: if the surprise is greater than some hyperparameter $\sigma$ , then that data should be stored in memory. For our experiments, we choose $\sigma \propto - \ln ( N )$ where $N$ is the number of classes under classification which means that if the prediction confidence in the correct class is smaller than the probability assigned by a uniform prediction the value should be written to memory. In the appendix we show that after model training model performance is robust to variations in $\sigma$ , as surprise becomes highly bimodal: a new data point tends to be either highly surprising (never seen something similar before) or not very surprising.
56
+
57
+ Conveniently, in the case of classification problems the commonly used cross-entropy loss reduces to our measure of surprise directly, and we therefore use the prediction loss as an input to the memory controller directly.
58
+
59
+ Decoder The decoder takes as input the query representation as well as all the data from the neighbors found in the external memory. We designed a relational feed-forward module with self attention which takes particular advantage of the external memory architecture. In addition we tested two other established decoder architectures: an unrolled relational working memory core and an unrolled LSTM. As all experiments have a classification loss at the end, all the decoders return a vector with logits for the $N$ classes under consideration. Full details of each architecture are provided in the Appendix.
60
+
61
+ • Relational self-attention feed-forward decoder. The relational feed-forward module (see figure 2, left) processes each of the neighbors individually by comparing them with the query, and then does a cross-element comparison with a self-attention module before reducing the activations with an attention vector calculated from neighbor distances.
62
+
63
+ ![](images/cbfa827ae16bd4a77580ecd8a56b6be593666f81498fc976ee7e7e33bdb298ea.jpg)
64
+ Figure 2: Two of the three different decoder architectures of APL: relational feed-forward memory (left) and relational working memory (Santoro et al., 2018) (right). In the figure $e _ { t }$ corresponds to the encoded target, $e _ { 1 \dots m }$ to the encoded observations from the memory, $l _ { 1 . . . m } = f ( y _ { 1 . . . m } )$ are the labels processed by an embedding layer and $d _ { 1 \dots m }$ is the distance between $e _ { t }$ and $e _ { 1 \dots m }$ .
65
+
66
+ • Relational working memory decoder (Santoro et al., 2018) The relational working memory module (figure 2, right) takes in the concatenated neighbor embeddings and corresponding label embeddings as its initial memory state. The query is fed a number $N$ times as input to the relational memory core to unroll the computation.
67
+
68
+ • LSTM decoder Finally we also test a vanilla LSTM decoder that takes in the query as the initial memory state and is fed each of the concatenated neighbor embeddings and corresponding label embeddings as its input each time step.
69
+
70
+ # 2.2 TRAINING SETUP
71
+
72
+ Since we are looking for a system which can update its beliefs in an online manner we need a training procedure that reflect this behaviour. We train the system over a sequence of episodes that are composed of sequences of pairs $( x _ { t } , y _ { t } )$ . At the start of every episode the mapping $x _ { t } y _ { t }$ is shuffled in a deterministic manner (the exact details are task dependent and will be outlined in the experiments section). The data is then presented to the model sequentially in a random order. The model’s memory is empty at the beginning of the episode.
73
+
74
+ At each time step, a batch of examples is shown to the model and a prediction is made. We then measure the instantaneous loss $L ( \hat { y } _ { t } , y _ { t } )$ and perform a gradient update step on the network to minimize the loss on that batch alone. The loss is also fed to the memory controller for the network to decide whether to write to memory. In all the experiments below the task is to classify some quantity, therefore we use cross entropy loss throughout.
75
+
76
+ ![](images/d7aad9d64cf23f65f53eb43bab580b91bcd2bf89c273cab89eb5b62d66f32a12.jpg)
77
+ Figure 3: APL training over several iterations. The encoder $e$ embeds the query image that is compared against the stored experiences in the memory $M$ . Matches are fed alongside the encoded image into a decoder $d$ . Finally, the controller $c$ decides whether the currently observed example should be stored in memory.
78
+
79
+ APL learns a sequential update algorithm, that is, it minimizes the expected loss over an episode consisting of a number of data elements presented sequentially. However we don’t need to backpropagate through the sequence to learn the algorithm. Rather, the model’s parameters are updated to minimize the cross-entropy loss independently at each time step. Therefore the only pressure to learn a sequential algorithm comes from the fact that episodes are kept small so that the decoder is encouraged to read the information coming from the queried neighbors instead of just learning to fit the current episode’s label mapping in its weights after a few steps of gradient descent (which is what happens in the case of MAML (Finn et al., 2017)).
80
+
81
+ # 3 RELATED WORK
82
+
83
+ Meta-learning as a research field covers a large number of areas. The concept of ‘learning to learn’ is not tied to a specific task and thus meta-learning algorithms have been successfully applied to a wide range of challenges like RL (Wang et al., 2016; Finn et al., 2017), program induction (Devlin et al., 2017) few-shot classification (Koch et al., 2015; Vinyals et al., 2016) and scene understanding (Eslami et al., 2018).
84
+
85
+ Some meta learning models generate predictions in an autoregressive fashion by predicting the next target point from the entire prior sequence of consecutive observations (Reed et al., 2018; Mishra et al., 2018). Algorithms of this kind have delivered state-of-the art results in a range of tasks such as supervised learning to classification. Nonetheless their reliance on the full context history in addition to their autoregressive nature hinders parallelization and hurts performance and scalability.
86
+
87
+ Another set of methods is based on the nearest neighbours approach (Koch et al., 2015; Vinyals et al., 2016; Snell et al., 2017). These methods use an encoder to find a suitable embedding and then perform a memory look up based on these representations. The result is a weighted average of the returned labels. As shown in (Mishra et al., 2018) using a pure distance metric to compare neighbors results in worse performance than allowing a network to learn a comparison function. These kinds of methods thus suffer in comparison. Meta Networks (Munkhdalai & Yu, 2017) also use an external memory to enable learning from previous examples combined with a model featuring slow and fast weights to produce the output, enabling them to state-of-the-art performance in several benchmarks.
88
+
89
+ Conditional neural processes (Garnelo et al., 2018) summarize the data into a fixed representation by averaging over the outputs of an encoder. This representation is fed into a decoder together with a query to produce the output. These methods are more space and compute efficient but given the fixed and averaged representation may not scale to very large problems.
90
+
91
+ All of the above methods expect a fixed size context, thereby making life-long learning over large time horizons difficult. To enable this, an algorithm must learn to only write observations into memory when they provide additional predictive power. Memory augmented neural networks (MANN) (Santoro et al., 2016) achieve this by learning a controller to write into a differentiable neural dictionary. However, this requires backpropagating through the entire sequence to learn, which makes credit assignment over long time sequences hard and is computationally expensive. The idea of using an external memory module has been explored in (Kaiser et al., 2017) and shown to produce good results. Compared to that work we introduce a simpler writing mechanism and the idea of a relational decoder to exploit the nearest neighbor structure.
92
+
93
+ # 4 EXPERIMENTS
94
+
95
+ # 4.1 FEW-SHOT OMNIGLOT CLASSIFICATION
96
+
97
+ The Omniglot dataset contains 1623 characters with 20 examples each. 1200 of the character classes are assigned to the train set while the remaining 423 are part of the test set. The examples are presented to the model sequentially in batches of 16 examples. For each episode, we choose $N$ classes and shuffle their labels. We then run an episode for a certain number of steps, which is decreased as the model’s accuracy increases to encourage quick adaptation. This means that the model accuracy and number of memories written to memory is time dependent.
98
+
99
+ We follow an architecture similar to those used in previous work for the image encoder (Vinyals et al., 2016; Mishra et al., 2018), which consists of four convolutional blocks with 3x3 convolutions, relu and batch normalization. We augment the number of classes in the training set by rotating each symbol 90, 180 and 270 degrees as in previous work (Santoro et al., 2016). For this task, we found that all three decoder architectures perform similarly. A detailed comparison and all hyperparameters needed to reproduce this experiment are provided in the Appendix.
100
+
101
+ In Figure 4a we can see the behavior of the algorithm within a single episode. As it sees more examples its performance increases until it saturates at some point, when additional writes don’t help anymore (assuming the exact same data piece won’t be seen again, which is the regime we always assume here). In the simple case of 5-way Omniglot classification, fewer than 2 examples per class are sufficient to saturate performance.
102
+
103
+ In Figure 4b we demonstrate the evolution of the posterior distribution in 20-way classification for 3 different, fixed inputs. For the first step, where the memory is empty APL learns to output a uniform distribution $( p \simeq 1 / N$ with $\mathbf { N }$ the number of classes under classification). As more examples are added to memory, its distribution refines until it sees an informative example for that class, at which point its prediction becomes very confident.
104
+
105
+ In Figure 4c we can see that different numbers of examples are written to memory for different classes, which demonstrates one of the advantages of this framework: we only need to store as many examples as each class requires, therefore if some classes may be more easily classified than others we can optimally use memory. In contrast, other models feed in a fixed context size per class which means they will either suffer in accuracy or use excessive memory.
106
+
107
+ ![](images/a35e3cd15cb2be90e9d7c00eb5e3de8820437e502b78da2c93d1a8eb6c12aaec.jpg)
108
+ Figure 4: a) Accuracy and size of memory for 5-way Omniglot. APL stops writing to memory after having 2 examples per class for 5-way classification. b), examples of evolution of posterior distribution for 20-way classification for 3 images. The distribution starts as uniform for the very first step, then starts to change as more items are added to memory. When the correct class is seen, the distribution converges. c), the number of labels stored in memory per class is highly heterogeneous. In this 20-way problem, APL stored 44 items in memory and achieved $9 8 . 5 \%$ accuracy, which is higher than its homogeneous 5-shot accuracy. d) Accuracy vs. number of items written to memory for 1000-way classification. Classification accuracy when only 2000 examples have been written to memory (on average 2 examples per class) surpasses the accuracy for a fixed context size of 5 examples per class.
109
+
110
+ Despite the previous point, it is also worthwhile comparing model accuracy to existing baselines with a fixed context size. To this end, we pre-populate the memory of a trained model with 1 or 5 examples per class and calculate the accuracy over the test set. We emphasize that the model was not trained to do well in this fixed-context scenario, and yet for 1 and 5-shot classification we obtain performance comparable to state-of-the-art models without having extensively tuned hyperparameters. Furthermore we tested our model with a much higher number of classes: 423-way classification where where we can use the whole test set, and 1000-way where the test set is augmented with rotations of the characters as we do in training.
111
+
112
+ Finally, we test how the model fares on a completely new distribution, MNIST. For 1-shot, 10-way MNIST, APL trained on 20-way omniglot classification obtains $61 \%$ accuracy (compared to $72 \%$ cited by (Vinyals et al., 2016)). Testing our model in the sequential regime, we observe that it continues writing examples to memory as it sees surprising observations, which allows it to correct for the distribution shift. After writing 45 examples per class, it reaches an accuracy of $86 \%$ (there are 1000 examples per class in the MNIST test set, so it is not simply memorizing).
113
+
114
+ Table 1: Omniglot test accuracies for fixed context sizes compared to other baselines. († For 1000- way classification rotated pseudoclasses are used.)
115
+
116
+ <table><tr><td rowspan="2"></td><td colspan="2">5-way</td><td colspan="2">20-way</td><td colspan="2">423-way</td><td colspan="2">1000-way†</td></tr><tr><td>1-shot</td><td>5-shot</td><td>1-shot</td><td>5-shot</td><td>1-shot</td><td>5-shot</td><td>1-shot</td><td>5-shot</td></tr><tr><td>Matching nets</td><td>98.1%</td><td>98.9%</td><td>93.8%</td><td>98.5%</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>CNP</td><td>95.3%</td><td>98.5%</td><td>89.9%</td><td>96.8%</td><td>-</td><td>-</td><td>-</td><td></td></tr><tr><td>MANN</td><td>82.2%</td><td>94.9%</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>MAML</td><td>98.7%</td><td>99.9%</td><td>95.8%</td><td>98.9%</td><td></td><td>-</td><td>-</td><td></td></tr><tr><td>SNAIL</td><td>99.07%</td><td>99.78%</td><td>97.64%</td><td>99.35%</td><td>-</td><td>-</td><td>1</td><td>-</td></tr><tr><td>APL</td><td>97.9%</td><td>99.9%</td><td>97.2%</td><td>97.6%</td><td>73.5%</td><td>88.0%</td><td>68.9%</td><td>78.9%</td></tr></table>
117
+
118
+ # 4.2 IMAGENET
119
+
120
+ ![](images/a8720edcb02b5a0aa7780ee57c5c5b415e2b55707ba55a2c1aaba528ab46766c.jpg)
121
+ Figure 5: Evolution of top-1 accuracy and number of written examples to memory over a single episode for the Imagenet dataset. Curves are averages over 5 test episodes and smoothed with exponential moving average.
122
+
123
+ We also applied our model to the full scale imagenet dataset. Unlike the above experiments there are no held out classes for testing, as the dataset was not conceived with held out classes in mind. Instead, we rely on shuffling the labels amongst the 1000 Imagenet classes and using the images from the test set for evaluation. This means the generalization results are slightly weaker than in the above sections, but they still provide important insights as to the scalability of our method to thousands of classes and applicability to harder scenarios.
124
+
125
+ As an encoder we use the pretrained Inception-ResNet-v2 (Szegedy et al., 2017) due to computational constraints. For the fixed label case, this network reaches a top-1 accuracy of $8 0 . 4 \%$ . Training the encoder end-to-end might produce better results, an investigation which we leave to later work.
126
+
127
+ In the 20-way classification challenge, our method reaches $8 6 . 7 \%$ top-1 accuracy (average accuracy after 50 iterations). Performance remains very high for 100-way $7 2 . 9 \%$ top-1 accuracy). The model’s performance degrades somewhat $( 5 2 . 6 \%$ top-1 accuracy) for 1000-way classification, where all the classes are shuffled. This highlights that large scale meta-learning on real world datasets remains a challenge even when all the classes have been observed by the encoder, as in this case.
128
+
129
+ # 4.3 NUMBER ANALOGY
130
+
131
+ The number analogy task challenges a meta-learning model to use logic reasoning to generalize with fewer than 1 example per possible class (Figure 6). At each time step the network is shown two pieces of data, a number $X$ and a symbol $S$ . It is asked to classify the result of $X + S$ based only on the current data and its previous experiments. We experiment with two levels of difficulty for this task: in the first, the number values are fixed and correspond to the MNIST digits, while there are
132
+
133
+ 10 different symbols with unknown values in each episode; in the second, both digits and symbols have shuffled values. We sample the symbol values in the range $[ - 1 0 , 1 0 ]$ .
134
+
135
+ When querying the memory, we query $k$ neighbors via the number embeddings and $k$ neighbors via the symbol embeddings. This makes sure that any relevant information to the problem is available to the reasoning module. The rest of the training setup is identical to the Omniglot experiments, including the encoder network for the digits.
136
+
137
+ In the case where the numbers are fixed a human would need only see 10 examples, one for each symbol, to be able to correctly generalize for all 100 possible combinations. With one example per symbol, APL reaches $9 7 . 6 \%$ accuracy on the test set.
138
+
139
+ When both numbers and symbols are shuffled each episode, a logical deduction process must be performed to infer the correct symbols. Our model is able to generalize using 50 examples written to memory (Figure 6) which is still fewer than seeing one of all 100 possible combinations.
140
+
141
+ In this complex case, once a symbol’s meaning has been figured out it is no longer necessary to solve the system of equations for that unknown. It would be interesting to explore how a system could additionally store this information in memory for later reuse, a question we leave for later work.
142
+
143
+ ![](images/7c1bcf07a05532ad70c152f3ba9ae1fd0a60a4b9471eff97af48c2059dbc7099.jpg)
144
+ Figure 6: Left: Number analogy task. The colored symbols have unknown values that are consistent throughout an episode. Right: Accuracy as a function of number of examples seen for the Analogy task where the number meanings are also shuffled each episode. Curves are averages over 10 test episodes and smoothed with exponential moving average. On the left we fix the decoder (relational self-attention feed-forward module) and vary $k$ . As there are 100 possible combinations of symbols (10 numbers $\times 1 0$ symbols), the thick dashed line corresponds to the performance of a model capable of perfect 1-shot generalization. We can see that for $k = 8$ and $k = 1 6$ the decoder can infer the symbol and number meanings to do better than direct 1-shot classifications. On the right we fix $k = 1 6$ and show that the relational self-attention feed-forward module can generalize better from few examples than other decoder architectures.
145
+
146
+ # 5 CONCLUSION
147
+
148
+ We introduced a self-contained system which can learn to approximate a probability distribution with as little data and as quickly as it can. This is achieved by putting together the training setup which encourages adaptation; an external memory which allows the system to recall past events; a writing system to adapt the memory to uncertain situations; and a working memory architecture which can efficiently compare items retrieved from memory to produce new predictions.
149
+
150
+ We showed that the model can:
151
+
152
+ • Reach state of the art accuracy with a smaller memory footprint than other meta-learning models by efficiently choosing which data points to remember.
153
+ • Scale to very large problem sizes thanks to the use of an external memory module with sparse access.
154
+ • Perform fewer than 1-shot generalization thanks to relational reasoning across neighbors.
155
+
156
+ # ACKNOWLEDGMENTS
157
+
158
+ The authors thank Elco Bakker, Alex Pritzel and David Raposo for insightful discussions; Paul Komarek, Adrià Puigdomènech for help with writing code; and Kevin McKee for revising the manuscript.
159
+
160
+ # REFERENCES
161
+
162
+ Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018.
163
+
164
+ Yoshua Bengio and Yann LeCun. Scaling learning algorithms towards AI. In Large Scale Kernel Machines. MIT Press, 2007.
165
+
166
+ Yoshua Bengio, Samy Bengio, and Jocelyn Cloutier. Learning a synaptic learning rule. Université de Montréal, Département d’informatique et de recherche opérationnelle, 1990.
167
+
168
+ SM Ali Eslami, Danilo Jimenez Rezende, Frederic Besse, Fabio Viola, Ari S Morcos, Marta Garnelo, Avraham Ruderman, Andrei A Rusu, Ivo Danihelka, Karol Gregor, et al. Neural scene representation and rendering. Science, 360(6394):1204–1210, 2018.
169
+
170
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning, pp. 1126–1135, 2017.
171
+
172
+ Marta Garnelo, Dan Rosenbaum, Christopher Maddison, Tiago Ramalho, David Saxton, Murray Shanahan, Yee Whye Teh, Danilo Rezende, and SM Ali Eslami. Conditional neural processes. In International Conference on Machine Learning, pp. 1690–1699, 2018.
173
+
174
+ 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.
175
+
176
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997.
177
+
178
+ Edwin T Jaynes. Probability theory: The logic of science. Cambridge university press, 2003.
179
+
180
+ Łukasz Kaiser, Ofir Nachum, Aurko Roy, and Samy Bengio. Learning to remember rare events. arXiv preprint arXiv:1703.03129, 2017.
181
+
182
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
183
+
184
+ James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, pp. 201611835, 2017.
185
+
186
+ Gregory Koch, Richard Zemel, and Ruslan Salakhutdinov. Siamese neural networks for one-shot image recognition. In ICML Deep Learning Workshop, volume 2, 2015.
187
+
188
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. nature, 521(7553):436, 2015.
189
+
190
+ Nikhil Mishra, Mostafa Rohaninejad, Xi Chen, and Pieter Abbeel. A simple neural attentive meta-learner. In International Conference on Learning Representations, 2018. URL https: //openreview.net/forum?id $\mathbf { \Psi } = \mathbf { \Psi }$ B1DmUzWAW.
191
+
192
+ Tsendsuren Munkhdalai and Hong Yu. Meta networks. In International Conference on Machine Learning, pp. 2554–2563, 2017.
193
+
194
+ Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nati Srebro. Exploring generalization in deep learning. In Advances in Neural Information Processing Systems, pp. 5947–5956, 2017.
195
+
196
+ Sylvestre-Alvise Rebuffi, Alexander Kolesnikov, Georg Sperl, and Christoph H Lampert. icarl: Incremental classifier and representation learning. In Proc. CVPR, 2017.
197
+
198
+ Scott Reed, Yutian Chen, Thomas Paine, Aäron van den Oord, S. M. Ali Eslami, Danilo Rezende, Oriol Vinyals, and Nando de Freitas. Few-shot autoregressive density estimation: Towards learning to learn distributions. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ r1wEFyWCW.
199
+
200
+ Andrei A Rusu, Neil C Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. arXiv preprint arXiv:1606.04671, 2016.
201
+
202
+ Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Metalearning with memory-augmented neural networks. In International conference on machine learning, pp. 1842–1850, 2016.
203
+
204
+ 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, 2018.
205
+
206
+ Jürgen Schmidhuber. Evolutionary principles in self-referential learning, or on learning how to learn: the meta-meta-... hook. PhD thesis, Technische Universität München, 1987.
207
+
208
+ Jürgen Schmidhuber. Deep learning in neural networks: An overview. Neural networks, 61:85–117, 2015.
209
+
210
+ Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In Advances in Neural Information Processing Systems, pp. 4077–4087, 2017.
211
+
212
+ Christian Szegedy, Sergey Ioffe, Vincent Vanhoucke, and Alexander A Alemi. Inception-v4, inception-resnet and the impact of residual connections on learning. In AAAI, volume 4, pp. 12, 2017.
213
+
214
+ Oriol Vinyals, Charles Blundell, Tim Lillicrap, Daan Wierstra, et al. Matching networks for one shot learning. In Advances in Neural Information Processing Systems, pp. 3630–3638, 2016.
215
+
216
+ Jane X Wang, Zeb Kurth-Nelson, Dhruva Tirumala, Hubert Soyer, Joel Z Leibo, Remi Munos, Charles Blundell, Dharshan Kumaran, and Matt Botvinick. Learning to reinforcement learn. arXiv preprint arXiv:1611.05763, 2016.
217
+
218
+ Jaehong Yoon, Eunho Yang, Jeongtae Lee, and Sung Ju Hwang. Lifelong learning with dynamically expandable networks. 2018.
219
+
220
+ # 6 SUPPLEMENTARY MATERIAL
221
+
222
+ # 6.1 MODEL ARCHITECTURES AND TRAINING DETAILS
223
+
224
+ For all experiments below we use the same training setup. For each training episode we sample elements from $N$ classes and randomly shuffle them to create training batches. For every batch shown to the model, we do one step of gradient descent with the Adam optimizer. We anneal the learning rate from $1 0 ^ { - 4 }$ to $1 0 ^ { - 5 }$ with exponential decay over 1000 steps (decay rate 0.9).
225
+
226
+ For all experiments, the query data is passed through an embedding network (described below in), and this vector is used to query an external memory module. The memory module contains multiple columns of data, one of which will be the key and the others will contain data associated with that key. The necessary columns for each experiment are outlined below. The memory size is chosen so that elements will never be overwritten in a single episode (i.e. memory size $>$ batch size $\times$ number of iterations).
227
+
228
+ The returned memory contents as well as the query are fed to one of the decoder architectures described in section 6.2.
229
+
230
+ # 6.1.1 OMNIGLOT
231
+
232
+ For omniglot we encode the images with a convolutional network composed of a single first convolution to map the image to 64 feature channels, followed by 12 convolutional blocks. Each block is made up of a step of Batch Normalization, followed by a ReLU activation and a convolutional layer with kernel size 3. Every three blocks the convolution contains a stride 2 to downsample the image. All layers have 64 features. Finally we flatten the activations to a 1D vector and pass it through a Layer Normalization function.
233
+
234
+ For all decoders we use a hidden dimensionality of 512, take their final state and pass it through a linear layer to generate the final logits for classification, using a Cross Entropy loss.
235
+
236
+ # 6.1.2 IMAGENET
237
+
238
+ The encoder is a pretrained Inception-ResNet-v2 network (Szegedy et al., 2017) with the standard preprocessing as described in the paper. We use as embedding the pre-logit activations. All decoders use a hidden dimensionality of 1024. After the decoder step we take their final state and pass it through a linear layer to generate the final logits for classification, using a Cross Entropy loss.
239
+
240
+ # 6.1.3 ANALOGY TASK
241
+
242
+ The encoder for MNIST uses the same convolutional network as described in the Omniglot section. The symbols are one-hot vectors for the first set of experiments. The memory is queried for neighbors both of the digit embeddings as well as the symbols, and found neighbors are concatenated and fed to the decoder.
243
+
244
+ The decoder process is identical to Omniglot. However, the classification target is now the one-shot encoded version of the result of the computation $X + S$ , where $X$ is the digit value and $S$ is the symbol value. As $S \in [ - 5 , 5 ]$ , we sum 5 to all values to obtain valid one-hot encodings (which means there are 20 possible values in all).
245
+
246
+ # 6.2 DECODER ARCHITECTURES COMPARISON
247
+
248
+ # 6.2.1 RELATIONAL SELF-ATTENTION FEED FORWARD MODULE
249
+
250
+ Consider the set $\{ e _ { t } , e _ { 1 . . . m } , l _ { 1 . . . m } , d _ { 1 . . . m } \}$ , where $e _ { t }$ is the encoded target, $e _ { 1 \dots m }$ the encoded observations from the memory, $l _ { 1 . . . m } = f ( y _ { 1 . . . m } )$ are the labels processed by a simple embedding layer to project the classes into a higher dimensional space, and $d _ { 1 \dots m }$ are the euclidean distances between $e _ { t }$ and $e _ { 1 \ldots m }$ . By concatenating all these vectors, we have a set of inputs to a relational block (Battaglia et al., 2018).
251
+
252
+ This tensor (of shape [batch size, $\mathbf { k }$ , sum of all embeddings feature sizes]) is fed to what we call a relational self-attentional block: first the tensor is passed through a multihead attention layer (Figure
253
+
254
+ 7), which compares all elements to each other and returns a new tensor of the same shape; then a shared nonlinear layer (ReLU, linear, layer norm) processes each element individually. The selfattentional blocks are repeated 8 times in a residual manner (the dimensionality of the tensor never changes).
255
+
256
+ Finally, we pass the distances between neighbors and query through a softmax layer to generate an attention vector which is multiplied with the activations tensor over the first axis (this has the effect of weighting closer memories more). The tensor is then summed over that first axis to obtain the final representation.
257
+
258
+ ![](images/5889e06f1272a3cbe821592b0d3cfbaf77d2aab473a3b2c79322aea6081bcef2.jpg)
259
+ Figure 7: Multihead attention implementation.
260
+
261
+ # 6.2.2 RELATIONAL WORKING MEMORY
262
+
263
+ We use a Relational working memory core as described in (Santoro et al., 2018), (figure 2, right). The memory is initialized with the concatenated vectors $\{ e _ { 1 . . . m } , l _ { 1 . . . m } , d _ { 1 . . . m } \}$ . The query $e _ { t }$ is fed a number $N = 5$ times as input to the relational memory core to unroll the computation. The final memory state is passed through a linear layer to obtain the logits.
264
+
265
+ # 6.2.3 LSTM
266
+
267
+ We use a standard LSTM module, with initial state equal to the query embedding, and at each time step we feed in the neighbor embedding as concatenated with the embedded label. The LSTM is rolled out for $k$ time steps (i.e. the number of neighbors). Its final output state is taken as input to the logits linear layer.
268
+
269
+ ![](images/b57536a24e844ec7c041ff56eabf513104b3bea405d2f0efc1ab7f25d3f0daf9.jpg)
270
+ Figure 8: The LSTM decoder for APL.
271
+
272
+ # 6.2.4 DECODER ARCHITECTURE COMPARISON
273
+
274
+ We compared all three decoder architectures for the classification case and found they perform equally well for the classification case, as shown in the figure below.
275
+
276
+ For the analogy task, we found the Relational self-attention feed forward module to work best, as outlined in the main text.
277
+
278
+ ![](images/39189663b0200b4b7fb418498a34fda7fe00fd8b680ed94097c63311911af784.jpg)
279
+ Figure 9: Accuracy as a function of examples written to memory. We compared relational working memory, LSTM and the relational self-attention feed-forward module for omniglot on the 20-way, 423-way and 1000-way tasks.
280
+
281
+ ![](images/5d5e38917455f1598af040a1769c8d15bedfe06295b4bb1711d885f5bcbba007.jpg)
282
+ Figure 10: Accuracy as a function of examples written to memory. Each plot corresponds to a different number $k$ of retrieved nearest neighbors. We compared relational working memory, LSTM and the relational self-attention feed-forward module.
283
+
284
+ # 6.3 EFFECT OF THRESHOLD PARAMETER ON PERFORMANCE
285
+
286
+ How does the choice of parameter $\sigma$ affect the performance of APL? Empirically we have verified that for a large range of $\sigma$ , memory size and accuracy are largely unchanged. This is due to the feedback loop between the number of items stored and classification accuracy: as more items are stored in memory, the more elements are correctly classified and not stored in memory. Therefore the memory storage mechanism is self-regulating, and the number of elements in memory ends up being largely flat.
287
+
288
+ In Fig. 11 we show the final memory size and average accuracy for the last 100 data points after showing APL 2000 unique data points for the case of 200-way classification. In this case the ’natural’ (uniform predictions) $\sigma$ is around 5.2, which seems to be close to optimal for accuracy vs. elements in memory. We can increase the value somewhat but eventually the model can’t write to memory any more and performance tanks. On the other side of the curve, for $\sigma = 0$ where we write everything, performance is slightly higher but at a roughly ${ 8 \mathrm { x } }$ memory cost.
289
+
290
+ ![](images/895e37d999f8a7adffb8406f7d1db11d1146682a171b39febe04adaf747a956d.jpg)
291
+ Figure 11: Accuracy as a function of examples written to memory. Each plot corresponds to a different number $k$ of retrieved nearest neighbors. We compared relational working memory, LSTM and the relational self-attention feed-forward module.
292
+
293
+ # 6.4 RELATION TO CONTINUAL LEARNING
294
+
295
+ While we study APL in the few-shot learning setting, the algorithm could also be used in the continual learning setup (Kirkpatrick et al., 2017; Rusu et al., 2016; Yoon et al., 2018; Rebuffi et al., 2017). We consider an experiment where each task consists of learning 10 new and previously unseen classes. For each task we present the models with 200 unique examples, and report the average accuracy for the last 100 examples seen. Examples are drawn from the test set of classes.
296
+
297
+ In the case of progressive networks, one gradient descent step is taken after each example. For each task, a new logits layer is added on top of a convolutional encoder (same architecuture as APL) pretrained on the omniglot training set. APL is run as described in the main text.
298
+
299
+ The results are summarized in figure 12: APL can perform as well or better than a progressive network on this kind of task without needing access to gradient information, as its memory store can provide the requisite information to update its predictions to the new task.
300
+
301
+ ![](images/2ada6e4f5074df0eb476a060c43c70bcdaf5f85cce4687b1b49d4d68552be651.jpg)
302
+ Figure 12: Accuracy of APL on a lifelong learning task where each task corresponds to learning 10 new classes in Omniglot. The baseline is a progressive net where the convolutional encoder is pretrained, and for every task a new logits layer is added and trained to classify the new classes. Results are the average accuracy over 5 runs. While not using any gradient information, APL performs as well or better than progressive networks.
md/train/ByfXe2C5tm/ByfXe2C5tm.md ADDED
@@ -0,0 +1,312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NLPROLOG: REASONING WITH WEAK UNIFICATION FOR NATURAL LANGUAGE QUESTION ANSWERING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Symbolic logic allows practitioners to build systems that perform rule-based reasoning which is interpretable and which can easily be augmented with prior knowledge. However, such systems are traditionally difficult to apply to problems involving natural language due to the large linguistic variability of language. Currently, most work in natural language processing focuses on neural networks which learn distributed representations of words and their composition, thereby performing well in the presence of large linguistic variability. We propose to reap the benefits of both approaches by applying a combination of neural networks and logic programming to natural language question answering. We propose to employ an external, nondifferentiable Prolog prover which utilizes a similarity function over pretrained sentence encoders. We fine-tune these representations via Evolution Strategies with the goal of multi-hop reasoning on natural language. This allows us to create a system that can apply rule-based reasoning to natural language and induce domainspecific natural language rules from training data. We evaluate the proposed system on two different question answering tasks, showing that it complements two very strong baselines – BIDAF (Seo et al., 2016a) and FASTQA (Weissenborn et al., 2017) – and outperforms both when used in an ensemble.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ We consider the problem of multi-hop reasoning on natural language input. For instance, consider the statements Socrates was born in Athens and Athens belongs to Greece, together with the question Where was Socrates born? There are two obvious answers following from the given statements: Athens and Greece. While Athens follows directly from the single statement Socrates was born in Athens, deducing Greece requires a reader to combine both provided statements using the knowledge that a person that was born in a city, which is part of a country, was also born in the respective country.
12
+
13
+ Most recent work that addresses such challenges leverages deep learning based methods (Sukhbaatar et al., 2015; Peng et al., 2015; Seo et al., 2016b; Raison et al., 2018; Henaff et al., 2016; Kumar et al., 2016; Graves et al., 2016; Dhingra et al., 2018), capable of dealing with the linguistic variability and ambiguity of natural language text. However, the black-box nature of neural networks makes it hard to interpret the exact reasoning steps leading to a prediction (local interpretation), as well as the induced model (global interpretation).
14
+
15
+ Logic programming languages like Prolog (Wielemaker et al., 2012), on the other hand, are built on the idea of using symbolic rules to reason about entities, which makes them highly interpretable both locally and globally. The capability to use user-defined logic rules allows users to incorporate external knowledge in a straightforward manner. Unfortunately, because of their reliance on symbolic logic, systems built on logic programming need extensive preprocessing to account for the linguistic variability that comes with natural language (Moldovan et al., 2003).
16
+
17
+ We introduce NLPROLOG, a system which combines a symbolic reasoner and a rule-learning method with pretrained sentence representations to perform rule-based multi-hop reasoning on natural language input.1 Like inductive logic programming methods, it facilitates both global as well as local interpretation, and allows for straightforward integration of prior knowledge. Similarly to deep learning based approaches, it can be applied to natural language text without the need to transforming it to formal logic.
18
+
19
+ At the core of the proposed method is an external non-differentiable theorem prover which can take similarities between symbols into account. Specifically, we modify a Prolog interpreter to support weak-unification as proposed by Sessa (2002). To obtain similarities between symbols, we utilize sentence encoders initialized with pretrained sentence embeddings (Pagliardini et al., 2017) and then fine-tune these for a downstream question answering task via gradient-based optimization methods. Since the resulting system contains non-differentiable components, we propose using Evolution Strategies (ES) (Eiben et al., 2003) as a gradient estimator (Williams, 1992) for training the system – enabling us to fine-tune the sentence encoders and to learn domain-specific logic rules (e.g. that the relation is in is transitive) from natural language training data. This results in a system where training can be trivially parallelized, and which allows to change the logic formalism by simply exchanging the external prover without the need for an intricate re-implementation as an end-to-end differentiable function.
20
+
21
+ In summary, our main contributions are: a) we show how Prolog-like reasoning can be applied to natural language input by employing a combination of pretrained sentence embeddings, an external logic prover, and fine-tuning using Evolution Strategies, $b _ { . }$ ) we extend a Prolog interpreter with weak unification based on distributed representations, $c _ { . }$ ) we present Gradual Rule Learning (GRL), a training algorithm that allows the proposed system to learn First-Order Logic (FOL) rules from entailment, and $d$ ) we evaluate the proposed system on two different Question Answering (QA) datasets and demonstrate that its performance is on par with state-of-the-art neural QA models in many cases, while having different failure modes. This allows to build an ensemble of NLPROLOG and a neural QA model that outperforms all individual models.
22
+
23
+ # 2 RELATED WORK
24
+
25
+ Our work touches in general on weak-unification based fuzzy logic (Sessa, 2002) and focuses on multi-hop reasoning for QA, the combination of logic and distributed representations, and theorem proving for question answering.
26
+
27
+ Multi-hop Reasoning for QA. One prominent approach for enabling multi-hop reasoning in neural QA models is to iteratively update a query embedding by integrating information from embeddings of context sentences, usually using an attention mechanism and some form of recurrency (Sukhbaatar et al., 2015; Peng et al., 2015; Seo et al., 2016b; Raison et al., 2018). These models have achieved state-of-the-art results in a number of reasoning-focused QA tasks. Henaff et al. (2016) employ a differentiable memory structure that is updated each time a new piece of information (usually a sentence) is processed. The memory slots can be used to track the state of various entities, which can be considered as a form of temporal reasoning. Similarly, the Neural Turing Machine (Graves et al., 2016) and the Dynamic Memory Network (Kumar et al., 2016), which are built on differentiable memory structures, have been used to solve synthetic QA problems requiring multi-hop reasoning. Dhingra et al. (2018) modify an existing neural QA model to additionally incorporate coreference information provided by a coreference resolution model in a preprocessing step, which improves performance on QA problems requiring multi-hop reasoning.
28
+
29
+ All of the methods above perform reasoning more or less implicitly by updating latent vector representations, which makes an unambiguous interpretation of the exact reasoning steps difficult. Additionally, it is not obvious how a strong prior, like user-defined inference rules, could be imposed on the respective reasoning procedures. Besides, many of them have been evaluated only on artificially generated data sets and thus it is unclear how they perform when on data that involves natural linguistic variability.
30
+
31
+ Combination of FOL and Distributed Representations. Investigating the combination of formal logic and distributed representations has a long tradition, which is reviewed by Besold et al. (2017). Strongly related to our approach is the combination of Markov Logic Networks (Richardson & Domingos, 2006), Probabilistic Soft Logic (Bach et al., 2017), and word embeddings, which has been applied to Recognizing Textual Entailment (RTE) and Semantic Textual Similarity (STS) (Garrette et al., 2011; 2014; Beltagy et al., 2013; 2014), and improves upon baselines utilizing either only logic or only distributed representations.
32
+
33
+ An area in which neural multi-hop reasoning models have been thoroughly investigated is Knowledge Base Completion (Das et al., 2016; Cohen, 2016; Neelakantan et al., 2015; Das et al., 2017). While QA could be in principle modeled as a KB-completion task, the construction of a densely connected KB from text is far from trivial, due to the inherent ambiguity of natural language. Without any preprocessing, even the moderately sized QA tasks considered in this work would produce a very large and sparsely connected KB.
34
+
35
+ Closest to our approach is the Natural Theorem Prover (NTP) (Rocktäschel & Riedel, 2017), which obtains the final proof score for a statement by constructing a neural network that represents all possible proofs. The model is trained end-to-end using backward chaining and a differentiable unification operator. Since the number of possible proofs grows exponentially with the number of facts and rules, NTPs cannot scale even to moderately sized knowledge bases, and are thus not applicable to natural language problems in its current form. We circumvent this issue by using a non-differentiable prover and fine-tune the model using Evolution Strategies.
36
+
37
+ Theorem Proving for Question Answering. Our work is not the first to apply theorem proving to QA problems. Angeli et al. (2016) employ a system based on Natural Logic to search a large KB for a single statement that entails the candidate answer. This is somewhat orthogonal to our approach, as we aim to learn rules that combine multiple statements to answer a question.
38
+
39
+ More traditional systems like Watson (Ferrucci et al., 2010) or COGEX (Moldovan et al., 2003) utilize an integrated theorem prover, but require a transformation of the natural language input to logical form. In the case of COGEX, this improves the accuracy of the underlying system by $30 \%$ , and increases its interpretability. While this work is similar in spirit, we greatly simplify the preprocessing step by replacing the transformation of natural language to logic with the simpler approach of taking Open Information Extraction (Open IE) (Etzioni et al., 2008) textual patterns.
40
+
41
+ Fader et al. (2014) propose the OPENQA system that utilizes a mixture of handwritten and automatically obtained operators that are able to parse, paraphrase and rewrite queries, which allows them to perform large-scale QA on KBs that include Open IE triples. While this work shares the same goal – answering questions using facts extracted by Open IE – we choose a completely different approach to address the problem of linguistic variablity and focus on the combination of multiple facts by learning logical rules.
42
+
43
+ # 3 BACKGROUND
44
+
45
+ In the following, we review the background relevant for the custom Prolog engine employed by our method. Specifically, we briefly introduce Prolog’s backward chaining algorithm and unification procedure (Russell & Norvig, 2016). We assume basic knowledge of formal logic and logic programming.
46
+
47
+ In a nutshell, a Prolog program consists of a set of rules in the form of Horn clauses
48
+
49
+ $$
50
+ h ( f _ { 1 } ^ { h } , \ldots , f _ { n } ^ { h } ) \ : \ : p _ { 1 } ( f _ { 1 } ^ { 1 } , \ldots , f _ { m } ^ { 1 } ) \land \ldots \land p _ { B } ( f _ { 1 } ^ { B } , \ldots , f _ { l } ^ { B } ) ,
51
+ $$
52
+
53
+ where $h , p _ { i }$ are predicate symbols and $f _ { j } ^ { i }$ are either function (denoted in lower case) or variable (upper case) symbols. The domain of function symbols is denoted by $\mathcal { F }$ and the domain of predicate symbols by $\mathcal { P }$ . $h ( f _ { 1 } ^ { h } , \ldots , f _ { n } ^ { h } )$ is called the head and $p _ { 1 } \bigl ( f _ { 1 } ^ { 1 } , \ldots , f _ { m } ^ { 1 } \bigr ) \ \wedge \ \ldots \ \wedge \ p _ { B } \bigl ( f _ { 1 } ^ { B } , \ldots , \bar { f } _ { l } ^ { B } \bigr )$ the body of the rule. We call $B$ the body size of the rule and rules with a body size of zero are named atoms (short for atomic formula).2 If an atom does not contain any variable symbols it is termed fact. As in related work (Sessa, 2002; Julián-Iranzo et al., 2009), we disregard negation and disjunction.
54
+
55
+ The central procedure of Prolog is unification. It receives two atoms and attempts to find variable substitutions that make both atoms syntactically equal. For example, the input atoms country(Greece, Socrates) and country $( X , Y )$ result in the following variable substitution after unification: $\{ X / G r e e c e , Y / S o c r a t e s \}$ .
56
+
57
+ The proof algorithm of Prolog is called backward-chaining. It starts from a goal atom $g$ and attempts to prove it by applying suitable rules, thereby generating subgoals that are proved next. To find applicable rules, it attempts to unify $g$ with the heads of all available rules. If this unification succeeds, the resulting variable substitutions are applied to the atoms in the rule body and each of those atoms becomes a new subgoal. For instance, the application of the rule countr $\prime ( X , Y ) \Leftarrow b o r n \_ i n ( Y , X )$ to the goal country(Greece, Socrates) would yield the subgoal born_in(Socrates, Greece). Then the process is repeated for all subgoals until no subgoal is left, i.e., until all subgoals have been unified with a fact. The result of this procedure is a set of rule applications and variable substitutions called proof. Note, that the number of possible proofs is exponential in the number of predicate and entity symbols, as every rule might be used in the proof of each subgoal. Pseudo code for weak unification can be found in Appendix A.1 and we refer the reader to Russell & Norvig (2010) for more details. To apply standard Prolog to a NLP problem like QA, one would have to account for semantic similarities and ambiguities with extensive and error-prone preprocessing, e.g. when transforming the natural language input to logical form.
58
+
59
+ # 4 NLPROLOG
60
+
61
+ Our aim is to apply Prolog to natural language question answering where the same entity or relation can have different natural language surface forms. Thus, we replace the equality-based unification operator with similarity-based weak unification (Sessa, 2002), which allows to unify two symbols $x , y$ if they are sufficiently similar, as judged by a similarity function $\sim \theta$ parameterized by $\theta$ . Then, the result of unification also contains a proof success score $S$ that is the result of the symbols’ similarity and the previous success score $S ^ { \prime }$ : $S = \top ( x \sim y , S ^ { \prime } )$ , where $\top \in \{ \mathrm { m i n } , \cdot \}$ is an aggregation function. The result of backward-chaining with weak unification are (possibly) multiple proofs, each with an associated proof success score. NLPROLOG combines inference based on weak unification and distributed representations to allow reasoning on natural language statements. The natural language statements are first transformed to triples using Open IE (Etzioni et al., 2008). The symbols occurring in these triples and in the rules are then embedded into a vector space, which in turn is used to estimate similarities between symbols. The resulting similarity function is subsequently used to perform a proof and consequently obtain a proof success score $S$ . The proof success score is then utilized as a training signal for ES. An illustration of the process can be found in Fig. 1, where we visualize the interplay of the different components for our running example.
62
+
63
+ # 4.1 SIMILARITY COMPUTATION
64
+
65
+ We embed symbols using an encoder $\mathcal { E } _ { \theta } : \mathcal { F } \cup \mathcal { P } \mapsto \mathbb { R } ^ { d }$ parametrized by $\theta$ for entity and predicate symbols, where $d$ denotes the embedding size. The resulting embeddings are used to induce $\sim \theta$ $( \mathcal { \dot { F } } \cup \mathcal { P } ) ^ { 2 } \mapsto \mathbb { R }$ :
66
+
67
+ $$
68
+ x \sim _ { \theta } y = \frac { 1 + c o s ( \mathcal { E } _ { \theta } ( x ) , \mathcal { E } _ { \theta } ( y ) ) } { 2 }
69
+ $$
70
+
71
+ where cos denotes the cosine similarity between two vectors. There are alternative similarity functions such as Euclidean distance or RBF kernel, but in preliminary experiments we found cosine simlarity to work more robustly.
72
+
73
+ We use an encoder function that uses a embedding lookup table for predicate symbols and a different one for entities. All embeddings representing natural language phrases are populated with sentence vectors that were pretrained with SENT2VEC (Pagliardini et al., 2017). Additionally, we introduce a third lookup table for the predicate symbols of rules and goals, because semantics of goal or rule predicates might differ from the semantics of fact predicates even if they share the same surface form. For instance, the query $( X , p a r e n t , Y )$ could be interpreted either as (X, is the parent of, $Y$ ) or as (X, has the parent, Y) which are fundamentally different things.
74
+
75
+ # 4.2 FINE-TUNING THE ENCODER TO A DOWNSTREAM TASK
76
+
77
+ We propose to fine-tune the similarity function on a downstream task by updating the symbol embeddings. As NLPROLOG involves the non-differentiable proof search step, we cannot apply backpropagation for optimization. Instead, we propose to employ Evolution Strategies in conjunction with Adam (Kingma & Ba, 2014) to estimate the weight updates. ES recently showed good results for Reinforcement Learning problems in Salimans et al. (2017); Mania et al. (2018). More formally, the parameter update is computed as:
78
+
79
+ ![](images/e6c463178bdb0f3faaa5be7c882e363fdc3e665790d2ed68cdbfb26410667e64.jpg)
80
+ Figure 1: Overview of NLPROLOG. The components of NLPROLOG are depicted as ellipses, while inputs and outputs are drawn as squares. Phrases with red background are entities and blue ones are predicates.
81
+
82
+ $$
83
+ \theta _ { t + 1 } = \theta _ { t } + \frac { \alpha _ { t } } { N \sigma _ { J } ^ { t } } \sum _ { \stackrel { k = 1 } { \epsilon _ { k } \sim \mathcal { N } ( 0 , \sigma ) } } ^ { N } \left[ J ( \theta _ { t } + \epsilon _ { k } ) - J ( \theta _ { t } - \epsilon _ { k } ) \right] \epsilon _ { k }
84
+ $$
85
+
86
+ where $J ( \theta )$ is the reward obtained by $\theta$ , $\boldsymbol { \sigma } _ { J } ^ { t }$ is the standard deviation of all rewards obtained at time $t$ as proposed by Mania et al. (2018), and $\alpha _ { t }$ are adaptive learning rates selected by ADAM (Kingma & Ba, 2014). The standard deviation $\sigma$ of the distribution that is generating the perturbations is treated as a hyperparameter.
87
+
88
+ We train NLPROLOG with ES using a learning from entailment setting (Muggleton & Raedt, 1994), in which the model is trained to decide whether a Prolog program $\mathcal { R }$ entails the truth of a candidate triple $c$ . The objective of the model is to assign high probabilities $p ( c | \mathcal { R } ; \theta )$ to true candidate triples and low probabilities to false triples. To achieve this, we model the reward as $J ( \theta ) = y p ( c | \mathcal { R } ; \theta )$ , where $\bar { y \in \{ - 1 , 1 \} }$ is the gold label. To estimate $p ( c | \mathcal { R } ; \theta )$ , we exhaustively search for all proofs for the triple $c$ , up to a given depth $D$ which we treat as a hyperparameter. This search yields a number of proofs each with a success score $S _ { i }$ . We set $p ( c | \mathcal { R } ; \theta )$ to be the maximum of these scores $S _ { \operatorname* { m a x } } = \operatorname* { m a x } _ { i } S _ { i }$ .
89
+
90
+ # 4.3 GRADUAL RULE LEARNING
91
+
92
+ The reasoning process of NLPROLOG crucially depends on rules that describe the relations between predicates. While it is possible to write down rules in natural language, this approach is hardly scalable. Thus, we follow Rocktäschel & Riedel (2017) and use rule templates to perform Inductive Logic Programming (ILP) (Muggleton, 1991) which allows NLPROLOG to learn rules from training data. For this, a user has to define a set of rules with a given structure as input. Then, NLPROLOG randomly initializes the predicates of these rules. For instance, to induce a rule that can model transitivity, one would add a rule template of the form $p _ { 1 } ( X , Z ) p _ { 2 } ( X , Y ) \land p _ { 3 } ( Y , Z )$ , and NLPROLOG would instantiate multiple rules with randomly initialized embeddings for $p _ { 1 } , p _ { 2 }$ , and $p _ { 3 }$ . The exact number and structure of the rule templates is treated as a hyper-parameter. If not explicitly stated otherwise, the experiments were performed with the same set of rule templates containing two rules for each of the forms $p _ { 1 } ( X , { \bar { Y } } ) \Leftarrow p _ { 2 } ( X , Y )$ , $p _ { 1 } ( X , Y ) \Leftarrow p _ { 2 } ( Y , \bar { X _ { \lambda } } )$ and $p _ { 1 } ( X , Z ) { \overset { \vartriangle } { \Leftarrow } } p _ { 2 } ( X , Y ) \land p _ { 3 } ( Y , Z )$ .
93
+
94
+ In preliminary experiments, we observed that unification with such randomly initialized embeddings always leads to a stark drop of the proof success score. This implies in turn that proofs involving rule templates rarely yield the highest score $S _ { \mathrm { m a x } }$ and thus, might have no impact on the value of the reward function. Due to that, the expected gradient estimate for the rule embeddings is zero, and they will remain close to their initialization.
95
+
96
+ The main reason for this behavior is that the monotonicity of the aggregation functions implies that each sub-goal created by an application of a rule will only decrease the success score of the proof. Thus, all other things being equal, rules with a small number of body atoms (and facts in particular) will be preferred over more complex rules with a higher number of body atoms. Note that this problem is particularly severe in our setting where rules are initialized randomly while the remaining predicate symbols are instantiated using pretrained sentence embeddings.
97
+
98
+ We propose a Gradual Rule Learning (GRL) algorithm which counteracts this effect during training. GRL segments the training process into $B _ { \mathrm { m a x } } + 1$ phases, where $B _ { \mathrm { m a x } }$ is the maximum body size of all available rules. In the $k$ -th phase of GRL, only proofs which employ at least one rule with a body size of $B _ { \mathrm { m a x } } + 1 - k$ are considered to estimate $p ( t | F ; \theta )$ . Thus, it is guaranteed that in each training step in phase $k$ at least one rule with a body size of $B _ { \mathrm { m a x } } + 1 - k$ receives a training signal.
99
+
100
+ # 5 EVALUATION
101
+
102
+ We evaluate our method on two different QA data sets: BABI-1K-STATIC (Weston et al., 2015) and different subsets of WIKIHOP (Welbl et al., 2017). The used hyperparameter configurations can be found in Section B.
103
+
104
+ # 5.1 SUBSETS OF WIKIHOP
105
+
106
+ We evaluate on different subsets of WIKIHOP (Welbl et al., 2017), each containing a single query predicate. We consider the predicates publisher, developer, and country, because their semantics ensure that the annotated answer is unique and they contain a relatively high amount of questions that are annotated as requiring true multi-hop reasoning. For publisher, this yields 509 training and 54 validation questions, for developer 267 and 29, and for country 742 and 194. As the test set of WIKIHOP is not publicly available, and splitting the small train set would lead to a far too small validation set, we report scores for the validation set and refrain from hyperparameter optimization and early stopping.
107
+
108
+ Each data point consists of a query $p ( q , X )$ where $q$ is some query entity, $X$ is the entity that has to be predicted, $C$ is a list of candidates entities, $a \in C$ is an answer entity and $p \in$ {publisher, developer, country} is the query predicate. In addition, every query is accompanied by a set of support documents which can be used to decide which candidate is the correct answer. To transform the support documents to natural language triples, we use the Open IE system MINIE (Gashteovski et al., 2017). We use the publicly available version of $\mathbf { M N I E } ^ { 3 }$ in the dictionary mode, and use a list of all WIKIHOP candidate entities as our dictionary of multi-token entities.
109
+
110
+ Following Welbl et al. (2017), we use the two neural QA models BIDAF (Seo et al., 2016a) and FASTQA (Weissenborn et al., 2017) as baselines for the selected predicates of WIKIHOP. We employ the implementation provided by the QA framework $\mathrm { J A C K } ^ { 4 }$ (Weissenborn et al., 2018) with the same hyperparameters as used by Welbl et al. (2017) and train a separate model for each predicate. In order to compensate for the fact that both models are extractive QA models which cannot make use of the candidate entities, we additionally evaluate modified versions which transform both the predicted answer and all candidates to vectors using the wiki-unigrams model5 of SENT2VEC (Pagliardini et al., 2017). Consequently, we return the candidate entity which has the highest cosine similarity to the predicted entity.
111
+
112
+ # 5.2 BABI-1K-STATIC
113
+
114
+ We utilize a subset of BABI-1K to study the behavior of NLPROLOG in a very controlled environment. Note however, that the experiments on WIKIHOP are much more significant, as they involve natural linguistic variability. BABI-1K-STATIC consists of the tasks QA4,QA15,QA17, and QA18 from the BABI suite (Weston et al., 2015), each containing 1,000 training and 1,000 testing questions. These tasks were selected because, unlike the other tasks of BABI, they do not require reasoning about a dynamically changing world state, which is not supported by the current implementation of NLPROLOG. We automatically transform all statements and queries of the respective tasks to triples and use the resulting KB as input to NLPROLOG. We train and evaluate on each problem individually. The tasks QA4 and QA15 require entities as an output, thus we consider every entity that occurs at least once in any problem of the task as a candidate for all problems. Tasks QA17 and QA18 are binary classification tasks, and thus we determine the optimal threshold on the training set, after the training of NLPROLOG has finished.
115
+
116
+ We refrain from systematically comparing results on the individual BABI tasks to competing methods like Seo et al. (2016b); Peng et al. (2015); Dhingra et al. (2018); Henaff et al. (2016); Sukhbaatar et al. (2015), since our non-negligible preprocessing and evaluation on only four out of 20 tasks does not allow us to match the relevant evaluation protocols. We therefore utilize BABI-1K-STATIC only for ablation experiments, but note that NLPROLOG achieves similar or better accuracy values than the mentioned methods in all instances we studied, except on $Q A 4$ .
117
+
118
+ # 5.3 DEALING WITH CANDIDATES
119
+
120
+ All questions of WIKIHOP and some of BABI-1K-STATIC include a set of answer candidates $C$ . For those cases, we modify our reward function to leverage this information, taking inspiration from Bayesian Personalized Ranking (Rendle et al., 2009):
121
+
122
+ $$
123
+ J ( \theta ) = p ( a | \mathcal { R } ; \theta ) - \operatorname* { m a x } _ { c \in C \setminus \{ a \} } p ( c | \mathcal { R } ; \theta ) ,
124
+ $$
125
+
126
+ where $a \in C$ is the true answer.
127
+
128
+ We observed that this reward function does not work well with the minimum aggregation function. Therefore, we employ this modified reward only when using the product aggregation and utilize the reward described in Section 4.2 with the minimum aggregation.
129
+
130
+ # 5.4 RESULTS
131
+
132
+ The results for the selected predicates of WIKIHOP can be found in Table 1. While there is no single best performing model, NLPROLOG is outperformed by at least one neural QA model on every predicate. For country, this only holds true when considering the versions of the neural models that have been augmented to consider candidate entities. For all three predicates, only a single transitive rule is utilized across all validation questions. Since we observe a more diverse set of induced rules on BABI-1K, we partly attributed this lack of diverse rules to the multi-hop characteristic of the WIKIHOP data. It seems that NLPROLOG struggles to find meaningful rules for the predicates developer and publisher, which leads to very few proofs involving rules on the development set: 1 out of 54 for publisher and 2 out of 29 for developer, compared with 159 out of 194 for country. We partially attribute this to the fact, that the semantics of country suggest a straightforward rule (transitivity of location), which is not true for developer or publisher. Additionally, the annotations regarding the neccessity of multi-hop reasoning provided for the validation set (Welbl et al., 2017) suggest that publisher and developer contain significantly fewer training examples involving multi-hop reasoning.
133
+
134
+ Exemplary proofs generated by NLPROLOG on the predicates developer and country can be found in Fig. 3. As we are especially interested in assessing the capability for multi-hop reasoning, we additionally evaluate on a subset of problems which have been unanimously labelled as requiring multi-hop reasoning. On this subset of the development data, which is denoted as Countryhop (mh) in Table 1, NLPROLOG outperforms all other single models.
135
+
136
+ # 5.5 NEURAL QA AND NLPROLOG ENSEMBLE
137
+
138
+ If the proof of NLPROLOG producing the prediction does not employ any rules, the prediction is essentially the result of performing a simple nearest neighbor search among the embeddings of all fact triples. We hypothesize that the neural QA models FASTQA and BIDAF are better suited for finding the most predictive single support statement, which motivates an ensemble of a neural QA model and NLPROLOG. We built a system which predicts the output of NLPROLOG when it used at least one rule and the output of the neural QA model otherwise. This allows to employ the multihop reasoning of NLPROLOG when possible and to utilize the pattern matching capabilities of the neural QA models in the remaining cases. The results for these ensembles are given in the bottom part of Table 1. In all instances, ensembling a neural QA model with NLPROLOG improved upon all single models, indicating that they complement each other well. We analyze reasons for the success of this ensembling strategy in Section 5.6.
139
+
140
+ Table 1: Accuracy scores in percent for different predicates on the development set of WIKIHOP. country (mh) only considers the problems that have been unanimously judged to require multi-hop reasoning. The upper part lists single models and the bottom part ensembles.
141
+
142
+ <table><tr><td>Model</td><td>publisher</td><td>developer</td><td>country</td><td>country (mh)</td></tr><tr><td>BIDAF</td><td>66.67</td><td>65.52</td><td>53.09</td><td>53.19</td></tr><tr><td>FastQA</td><td>62.96</td><td>62.07</td><td>57.21</td><td>57.44</td></tr><tr><td>BIDAF-Sent2Vec</td><td>75.93</td><td>68.97</td><td>61.86</td><td>65.96</td></tr><tr><td>FastQA-Sent2Vec</td><td>75.93</td><td>58.62</td><td>64.95</td><td>65.96</td></tr><tr><td>NLProlog (ours)</td><td>51.85</td><td>48.28</td><td>63.92</td><td>68.09</td></tr><tr><td>BIDAF-Sent2Vec + NLProlog</td><td>77.78</td><td>72.41</td><td>65.46</td><td>70.21</td></tr><tr><td>FastQA-Sent2Vec + NLProlog</td><td>77.78</td><td>62.07</td><td>69.07</td><td>70.21</td></tr></table>
143
+
144
+ # 5.6 ERROR ANALYSIS
145
+
146
+ We conducted an extensive error analysis, in which we manually classified all errors of NLPROLOG on the selected WIKIHOP predicates into predefined categories. The results are depicted in Figure 2.
147
+
148
+ For the developer predicate, in the majority of cases, errors were caused by OPENIE during the fact extraction step: in all but one case, OPENIE did not produce the necessary facts, or a necessary facts was not stated in the support text, or there were multiple correct candidates and NLPROLOG selected the wrong one. As a consequence, for both the publisher and developer predicates, the majority of queries would not answerable, even when the necessary rules were correctly induced. The predictive accuracy was significantly higher for the country predicate, where errors were mostly due to entitities not having SENT2VEC embeddings and a few missing rules.
149
+
150
+ Fig. 2 indicates that FASTQA can produce the correct answer, even if crucial information is missing from the supporting documents. To analyze this further, we evaluated FASTQA and NLPROLOG on a test set of the country predicate in which all documents mentioning the query entity were removed. Remarkably, the accuracy of FASTQA increased by approximately $1 \%$ , while the accuracy of NLPROLOG decreased by approx. $1 1 \%$ .
151
+
152
+ Furthermore, we evaluated both FASTQA and NLPROLOG on the hard subset of country as defined by Sugawara et al. (2018): on these 62 problems which cannot be solved with a simple heuristic, NLPROLOG achieved an accuracy of $5 1 . { \bar { 6 } } 1 \%$ , as opposed to $4 6 . 7 7 \%$ by FASTQA.
153
+
154
+ We conjecture that – besides NLPROLOG’s multi-hop reasoning capability – this is one reason why the neural models and NLPROLOG complement each other nicely: neural models can compensate for missing information, while NLPROLOG is less susceptible for spurious correlations between the query and supporting texts. The complementary nature of both approaches is further supported by the error analysis, described in Fig. 4.
155
+
156
+ # 5.7 ABLATION EXPERIMENTS
157
+
158
+ We perform experiments on BABI-1K-STATIC to investigate the effect of the GRL training procedure. Specifically, we perform experiments on BABI-1K-STATIC with only the last phase of GRL (i.e. training without GRL), with the last and the penultimate phase, and with all three phases, corresponding to full GRL as we limit the rule complexity to two body atoms in rule templates. To maintain comparability between runs, we keep the number of SGD steps constant across all experiments.
159
+
160
+ ![](images/84a090321be673203bf5af7c84917979a70a09bb28ca2bb215b164e77262c9b5.jpg)
161
+ Figure 2: Results of the error analysis. The y-axis shows the number of errors per category: O(penIE) refers to a crucial information missing due to an error of the OpenIE tool, A(mbiguous) means that multiple candidates were correct and NLProlog chose one which was not labeled as the correct one, while I(nfo) refers to problems that are not answerable with the provided support texts. $R ( u l e )$ means that a required rule was not induced, and E(mbedding) implies that the answer was correctly deduced but received a lower score than an erroneous deduction of another candidate.
162
+
163
+ <table><tr><td></td><td>QA4</td><td>QA15</td><td>QA17</td><td>QA18</td></tr><tr><td>GRL phase 3 (no)</td><td>56.4</td><td>37.1</td><td>62.8</td><td>90.9</td></tr><tr><td>GRL phase 2+3</td><td>88.8</td><td>33.5</td><td>66.7</td><td>94.7</td></tr><tr><td>GRL phase 1+2+3 (full)</td><td>88.0</td><td>100.0</td><td>67.6</td><td>97.6</td></tr><tr><td>Gold Rules (Untrained)</td><td>100.0</td><td>100.0</td><td>73.2</td><td>92.0</td></tr><tr><td>Gold Rules (Trained)</td><td>100.0</td><td>100.0</td><td>84.8</td><td>98.1</td></tr><tr><td>No Rules (Trained)</td><td>60.0</td><td>32.8</td><td>63.0</td><td>90.4</td></tr><tr><td>Ten Templates</td><td>88.1</td><td>100.0</td><td>61.9</td><td>89.4</td></tr></table>
164
+
165
+ Table 2: Accuracies in percent of ablation experiments on BABI-1K-STATIC. The upper half examines the effectiveness of GRL, while the bottom results concern the effect of training and different choices of rules.
166
+
167
+ Additionally, we experiment with manually defined rules, which we deem sufficient for solving each of the four tasks. For these, we report results before and after training, as well as for a run without any rule templates. The accuracy scores for all experiments on BABI are provided in Table 2.
168
+
169
+ To assess the impact of the choice of rule templates, we evaluate NLPROLOG on bAbI-1k-static with a different set of rule templates containing two rules of the form $p _ { 1 } ( X , Y ) \Leftarrow p _ { 2 } ( X , Y )$ , four with the form $p _ { 1 } ( X , Y ) \Leftarrow p _ { 2 } ( Y , X )$ and another four for $p _ { 1 } ( X , Z ) \in p _ { 2 } ( X , Y ) \land p _ { 3 } ( Y , Z )$ .
170
+
171
+ Clearly, the full GRL is necessary to obtain acceptable results in any of the problems. Interestingly, phase 1 of GRL does not contribute anything for QA4, which is perfectly solvable using only rules of body size 1. On the other hand, QA15 and QA18 both require a rule of body size 2, which makes phase 1 strongly improve the results. Only for $Q A 1 7$ the results are inconclusive. Nevertheless, this indicates that GRL works as intended, with the earlier phases encouraging the induction of rules with a higher number of conjuncts in the body.
172
+
173
+ The results using manually defined rules suggest that even when sufficient rules are provided, training with ES is helpful nevertheless. Interestingly, the model using no rules is able to solve over $9 0 \%$ of the problems in $Q A I \&$ , indicating that this problem is not well suited for evaluating reasoning capabilities of QA models.
174
+
175
+ Using ten instead of six templates leads to worse performance on all BABI problems but QA15, which is solved perfectly with a much faster convergence rate. This result indicates that the choice of rule templates might be an important hyperparameter which should be optimized for a given problem.
176
+
177
+ # 6 DISCUSSION AND FUTURE WORK
178
+
179
+ We have developed NLPROLOG, a system that is able to perform rule-based reasoning on natural language input, and can learn domain-specific natural language rules from training data. To this end, we have proposed to combine a symbolic prover with pretrained sentence embeddings and to train the resulting system with Evolution Strategies. We have evaluated NLPROLOG on two different QA tasks, showing that it can learn domain-specific rules and produce predictions which complement those of the two strong baselines BIDAF and FASTQA. This allows to build an ensemble of a baseline and NLPROLOG which outperforms all single models.
180
+
181
+ ![](images/7723a7462c403a1c25c15c96c367976e9d871a3b0467a3e7ebbd6acdeb635581.jpg)
182
+ Figure 3: Example proof trees generated by NLPROLOG. Each of the two trees shows an application of a transitive rule, the first for the predicate developer and the second for the predicate country. The rule templates are displayed with the most similar predicate. Note the noise introduced by the Open IE process, e.g. QUANT_0_1 and that entities and predicates do not need to match exactly.
183
+
184
+ While we have focused on a subset of First Order Logic in this work, the expressiveness of NLPROLOG could be extended by incorporating a different symbolic prover. For instance, a prover for temporal logic (Orgun & Ma, 1994) would allow to model temporal dynamics in natural language and enable us to evaluate NLPROLOG on the full set of BABI tasks. We are also interested in incorporating future improvements of symbolic provers, Open IE systems and pretrained sentence representations to further enhance the performance of NLPROLOG. To study the performance of the proposed method without the noise introduced by the Open IE step, it would be useful to evaluate it on tasks like knowledge graph reasoning. Additionally, it would be interesting to study the behavior of NLPROLOG in the presence of multiple WIKIHOP query predicates.
185
+
186
+ # REFERENCES
187
+
188
+ Gabor Angeli, Neha Nayak, and Christopher D Manning. Combining natural logic and shallow reasoning for question answering. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1, pp. 442–452, 2016.
189
+
190
+ Stephen H. Bach, Matthias Broecheler, Bert Huang, and Lise Getoor. Hinge-loss markov random fields and probabilistic soft logic. Journal of Machine Learning Research, 18:109:1–109:67, 2017.
191
+
192
+ Islam Beltagy, Cuong Chau, Gemma Boleda, Dan Garrette, Katrin Erk, and Raymond Mooney. Montague meets markov: Deep semantics with probabilistic logical form. In Second Joint Conference on Lexical and Computational Semantics $( ^ { * } S E M )$ , Volume 1: Proceedings of the Main Conference and the Shared Task: Semantic Textual Similarity, volume 1, pp. 11–21, 2013.
193
+
194
+ Islam Beltagy, Katrin Erk, and Raymond Mooney. Probabilistic soft logic for semantic textual similarity. In Proceedings of the 52nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), volume 1, pp. 1210–1219, 2014.
195
+
196
+ Tarek R Besold, Artur d’Avila Garcez, Sebastian Bader, Howard Bowman, Pedro Domingos, Pascal Hitzler, Kai-Uwe Kühnberger, Luis C Lamb, Daniel Lowd, Priscila Machado Vieira Lima, et al. Neural-symbolic learning and reasoning: A survey and interpretation. arXiv preprint arXiv:1711.03902, 2017.
197
+
198
+ William W Cohen. Tensorlog: A differentiable deductive database. arXiv preprint arXiv:1605.06523, 2016.
199
+
200
+ Rajarshi Das, Arvind Neelakantan, David Belanger, and Andrew McCallum. Chains of reasoning over entities, relations, and text using recurrent neural networks. arXiv preprint arXiv:1607.01426, 2016.
201
+
202
+ Rajarshi Das, Shehzaad Dhuliawala, Manzil Zaheer, Luke Vilnis, Ishan Durugkar, Akshay Krishnamurthy, Alex Smola, and Andrew McCallum. Go for a walk and arrive at the answer: Reasoning over paths in knowledge bases using reinforcement learning. arXiv preprint arXiv:1711.05851, 2017.
203
+
204
+ Bhuwan Dhingra, Qiao Jin, Zhilin Yang, William W Cohen, and Ruslan Salakhutdinov. Neural models for reasoning over multiple mentions using coreference. arXiv preprint arXiv:1804.05922, 2018.
205
+
206
+ Agoston E Eiben, James E Smith, et al. Introduction to evolutionary computing, volume 53. Springer, 2003.
207
+
208
+ Oren Etzioni, Michele Banko, Stephen Soderland, and Daniel S. Weld. Open information extraction from the web. Commun. ACM, 51(12):68–74, 2008. doi: 10.1145/1409360.1409378.
209
+
210
+ Anthony Fader, Luke Zettlemoyer, and Oren Etzioni. Open question answering over curated and extracted knowledge bases. In Proceedings of the 20th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’14, pp. 1156–1165, New York, NY, USA, 2014. ACM.
211
+
212
+ David Ferrucci, Eric Brown, Jennifer Chu-Carroll, James Fan, David Gondek, Aditya A Kalyanpur, Adam Lally, J William Murdock, Eric Nyberg, John Prager, and Others. Building watson: An overview of the DeepQA project. AI magazine, 31(3):59–79, 2010.
213
+
214
+ Hervé Gallaire and Jack Minker (eds.). Logic and Data Bases, Symposium on Logic and Data Bases, Centre d’études et de recherches de Toulouse, 1977, Advances in Data Base Theory, New York, 1978. Plemum Press. ISBN 0-306-40060-X.
215
+
216
+ Dan Garrette, Katrin Erk, and Raymond Mooney. Integrating logical representations with probabilistic information using markov logic. In Proceedings of the Ninth International Conference on Computational Semantics, pp. 105–114. Association for Computational Linguistics, 2011.
217
+
218
+ Dan Garrette, Katrin Erk, and Raymond Mooney. A formal approach to linking logical form and vector-space lexical semantics. In Computing meaning, pp. 27–48. Springer, 2014.
219
+
220
+ Kiril Gashteovski, Rainer Gemulla, and Luciano Del Corro. Minie: minimizing facts in open information extraction. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 2630–2640, 2017.
221
+
222
+ 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.
223
+
224
+ Mikael Henaff, Jason Weston, Arthur Szlam, Antoine Bordes, and Yann LeCun. Tracking the world state with recurrent entity networks. arXiv preprint arXiv:1612.03969, 2016.
225
+
226
+ Pascual Julián-Iranzo, Clemente Rubio-Manzano, and Juan Gallardo-Casero. Bousi prolog: a prolog extension language for flexible query answering. Electron. Notes Theor. Comput. Sci., 248 (Supplement C):131–147, August 2009.
227
+
228
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
229
+
230
+ Ankit Kumar, Ozan Irsoy, Peter Ondruska, Mohit Iyyer, James Bradbury, Ishaan Gulrajani, Victor Zhong, Romain Paulus, and Richard Socher. Ask me anything: Dynamic memory networks for natural language processing. In International Conference on Machine Learning, pp. 1378–1387, 2016.
231
+
232
+ Horia Mania, Aurelia Guy, and Benjamin Recht. Simple random search provides a competitive approach to reinforcement learning. arXiv preprint arXiv:1803.07055, 2018.
233
+
234
+ Dan Moldovan, Christine Clark, Sanda Harabagiu, and Steve Maiorano. COGEX: A logic prover for question answering. In Proceedings of the 2003 Conference of the North American Chapter of the Association for Computational Linguistics on Human Language Technology - Volume 1, NAACL ’03, pp. 87–93, Stroudsburg, PA, USA, 2003. Association for Computational Linguistics.
235
+
236
+ Stephen Muggleton. Inductive logic programming. New generation computing, 8(4):295–318, 1991.
237
+
238
+ Stephen Muggleton and Luc De Raedt. Inductive logic programming: Theory and methods. J. Log. Program., 19/20:629–679, 1994. doi: 10.1016/0743-1066(94)90035-3.
239
+
240
+ Arvind Neelakantan, Benjamin Roth, and Andrew McCallum. Compositional vector space models for knowledge base completion. arXiv preprint arXiv:1504.06662, 2015.
241
+
242
+ Mehmet A Orgun and Wanli Ma. An overview of temporal and modal logic programming. In Temporal logic, pp. 445–479. Springer, 1994.
243
+
244
+ Matteo Pagliardini, Prakhar Gupta, and Martin Jaggi. Unsupervised learning of sentence embeddings using compositional n-gram features. arXiv preprint arXiv:1703.02507, 2017.
245
+
246
+ Baolin Peng, Zhengdong Lu, Hang Li, and Kam-Fai Wong. Towards neural network-based reasoning. arXiv preprint arXiv:1508.05508, 2015.
247
+
248
+ Martin Raison, Pierre-Emmanuel Mazaré, Rajarshi Das, and Antoine Bordes. Weaver: Deep coencoding of questions and documents for machine reading. arXiv preprint arXiv:1804.10490, 2018.
249
+
250
+ Steffen Rendle, Christoph Freudenthaler, Zeno Gantner, and Lars Schmidt-Thieme. BPR: bayesian personalized ranking from implicit feedback. In UAI 2009, Proceedings of the Twenty-Fifth Conference on Uncertainty in Artificial Intelligence, Montreal, QC, Canada, June 18-21, 2009, pp. 452–461, 2009.
251
+
252
+ Matthew Richardson and Pedro M. Domingos. Markov logic networks. Machine Learning, 62(1-2): 107–136, 2006.
253
+
254
+ Tim Rocktäschel and Sebastian Riedel. End-to-end differentiable proving. In Advances in Neural Information Processing Systems, pp. 3788–3800, 2017.
255
+
256
+ Stuart J. Russell and Peter Norvig. Artificial Intelligence - A Modern Approach (3. internat. ed.). Pearson Education, 2010. ISBN 978-0-13-207148-2.
257
+
258
+ Stuart J Russell and Peter Norvig. Artificial intelligence: a modern approach. Malaysia; Pearson Education Limited„ 2016.
259
+
260
+ Tim Salimans, Jonathan Ho, Xi Chen, Szymon Sidor, and Ilya Sutskever. Evolution strategies as a scalable alternative to reinforcement learning. arXiv preprint arXiv:1703.03864, March 2017.
261
+
262
+ Minjoon Seo, Aniruddha Kembhavi, Ali Farhadi, and Hannaneh Hajishirzi. Bidirectional attention flow for machine comprehension. arXiv preprint arXiv:1611.01603, 2016a.
263
+
264
+ Minjoon Seo, Sewon Min, Ali Farhadi, and Hannaneh Hajishirzi. Query-reduction networks for question answering. arXiv preprint arXiv:1606.04582, 2016b.
265
+
266
+ Maria I Sessa. Approximate reasoning by similarity-based sld resolution. Theoretical computer science, 275(1-2):389–426, 2002.
267
+
268
+ Saku Sugawara, Kentaro Inui, Satoshi Sekine, and Akiko Aizawa. What makes reading comprehension questions easier? August 2018.
269
+
270
+ Sainbayar Sukhbaatar, Jason Weston, Rob Fergus, et al. End-to-end memory networks. In Advances in neural information processing systems, pp. 2440–2448, 2015.
271
+
272
+ Dirk Weissenborn, Georg Wiese, and Laura Seiffe. Fastqa: A simple and efficient neural architecture for question answering. arxiv preprint. arXiv preprint arXiv:1703.04816, 2017.
273
+
274
+ Dirk Weissenborn, Pasquale Minervini, Isabelle Augenstein, Johannes Welbl, Tim Rocktäschel, Matko Bosnjak, Jeff Mitchell, Thomas Demeester, Tim Dettmers, Pontus Stenetorp, and Sebastian Riedel. Jack the reader - A machine reading framework. In Proceedings of ACL 2018, Melbourne, Australia, July 15-20, 2018, System Demonstrations, pp. 25–30, 2018.
275
+
276
+ Johannes Welbl, Pontus Stenetorp, and Sebastian Riedel. Constructing datasets for multi-hop reading comprehension across documents. arXiv preprint arXiv:1710.06481, 2017.
277
+
278
+ 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.
279
+
280
+ Jan Wielemaker, Tom Schrijvers, Markus Triska, and Torbjörn Lager. SWI-Prolog. Theory and Practice of Logic Programming, 12(1-2):67–96, 2012. ISSN 1471-0684.
281
+
282
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
283
+
284
+ A ALGORITHMS
285
+
286
+ # A.1 WEAK UNIFICATION
287
+
288
+ fun unify $( x , y , \theta , S )$
289
+
290
+ #
291
+
292
+ $x$ : function $f ( \dots ) \mid$ atom $p ( \dots ) \mid$ variable $\mid$ list $x _ { 1 } : : x _ { 2 } : : \ldots : : x _ { n }$ $y$ : function $f ^ { \prime } ( \dots ) \mid$ atom $p ^ { \prime } ( \ldots ) \mid$ variable $|$ list $y _ { 1 } : : y _ { 2 } : : \dots : : y _ { m }$ $\theta$ : current substitutions, default $= \{ \}$
293
+ $S$ : current success score, default $= 1 . 0$
294
+
295
+ Output: (Unifying substitution $\theta ^ { \prime }$ or failure, Updated success score $S ^ { \prime }$ ) if $\theta =$ failure then return (failure, 0) else if $S < \lambda$ then return (failure, 0) else if $x = y$ then return $( \theta , S )$ else if $x$ is Var then return unify $_ - \nu a r ( x , y , \theta , S )$ else if $y$ is Var then return unify_ $\nu a r ( y , x , \theta , S )$ else if $x$ is $f ( x _ { 1 } , \ldots , x _ { n } )$ , y is $f ^ { \prime } ( y _ { 1 } , \ldots , y _ { n } )$ , and $f \sim f ^ { \prime } \geq \lambda$ then $S ^ { \prime } : = S \wedge f \sim f ^ { \prime }$ return uni $\mathfrak { f } ( x _ { 1 } : : \dots : : x _ { n } , y _ { 1 } : : \dots : : y _ { n } , \theta , S ^ { \prime } )$ end else if $x$ is $p ( x _ { 1 } , \ldots , x _ { n } )$ , y is $p ^ { \prime } ( y _ { 1 } , \ldots , y _ { n } )$ , and $p \sim p ^ { \prime } \ge \lambda$ then $S ^ { \prime } : = S \wedge f \sim f ^ { \prime }$ return unif $\nu ( x _ { 1 } : : \ldots : : x _ { n } , y _ { 1 } : : \ldots : : y _ { n } , \theta , S ^ { \prime } )$ end else if $x$ is $x _ { 1 } : : \ldots : : x _ { n }$ and $y$ is $y _ { 1 } : : \ldots : : y _ { n }$ then $( \theta ^ { \prime } , S ^ { \prime } ) : = u n i f y ( x _ { 1 } , y _ { 1 } , \theta , S )$ $\mathbf { r e t u r n } u n i f y ( x _ { 2 } : : \dots : : x _ { n } , y _ { 2 } : : \dots : : y _ { n } , \theta ^ { \prime } , S ^ { \prime } )$ end else if $x$ is empty list and $y$ is empty list then return $( \theta , S )$ else return (failure, 0) un unify_va $r ( v , o , \theta , S )$ if $\{ \nu / \nu a l \} \in \theta$ then return unify $( \nu a l , o , \theta , S )$ else if $\{ o / \nu a l \} \in \theta$ then return unif $\dot { y } ( \nu a r , \nu a l , \theta , S )$ else return $( \bar { \{ } v / o \} + \theta , S )$
296
+
297
+ Algorithm 1: The weak unification algorithm in Spyrolog without occurs check
298
+
299
+ # A.2 RUNTIME OF PROOF SEARCH
300
+
301
+ The worst case complexity vanilla logic programming is exponential in the depth of the proof (Russell & Norvig, 2010). However, in our case this is a particular problem because weak unification requires the prover to attempt unification between all entity/predicate symbols.
302
+
303
+ To keep things tractable, NLPROLOG only attempts to unify symbols with a similarity greater than some user-defined threshold $\lambda$ . Furthermore, in the search step for one statement $q$ , for the rest of the search, $\lambda$ is set to $\lambda : = \operatorname* { m a x } ( \lambda , S )$ whenever a proof for $q$ with success score $S$ is found. Due to the monotonicity of the employed aggregation functions, this allows to prune the search tree without losing the guarantee to find the proof yielding the maximum success score. We found this optimization to be crucial to make the proof search scale for the studied wikihop predicates.
304
+
305
+ # B HYPERPARAMETER CONFIGURATION
306
+
307
+ On BABI-1K we optimize the embeddings of predicate symbols of rules and query triples, as well as of entities. WIKIHOP has a large number of unique entity symbols and thus, optimizing their embeddings is prohibitive. Thus, we only train the predicate symbols of rules and query triples on this data set. The embeddings for entities and predicate symbols of fact and query triples are initialized using the WIKI-UNIGRAMS model of SENT2VEC, while the embeddings of rule predicates are intialized by uniformly sampling from the interval $[ - \frac { 1 } { \sqrt { 6 0 0 } } , \frac { 1 } { \sqrt { 6 0 0 } } ]$ . All experiments were performed with the same set of rule templates containing two rules for each of the forms $p ( X , Y ) \Leftarrow q ( X , Y )$ , $p ( X , Y ) \Leftarrow q ( Y , X )$ and $p ( X , Z ) \Leftarrow q ( X , Y ) \wedge r ( Y , Z )$ and set the similarity threshold $\lambda$ to 0.3. At each optimization step, we evaluate 100 perturbations sampled from $\mathcal { N } ( 0 , 0 . 0 4 )$ on a mini-batch of 16 training problems and use all of the directions in the generation of the next weight vector. If not stated otherwise, we use GRL with three phases training for 500 mini-batches in each phase. For the predicates publisher and developer, we used 1,000 mini-batches in the final phase of GRL. To further encourage rule usage, we use the minimum aggregation function in all but the last phases of GRL, in which we switch to product.
308
+
309
+ # C ERROR SETS
310
+
311
+ ![](images/8ed0a056d6d6697c5278a4b2b4a83f050042fb18571dfeb6c97d3c56fb6ab74a.jpg)
312
+ Figure 4: Venn diagram of the error sets per predicate.
md/train/Byl8hhNYPS/Byl8hhNYPS.md ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NEURAL MACHINE TRANSLATION WITH UNIVERSAL VISUAL REPRESENTATION
2
+
3
+ Zhuosheng Zhang1,2,3, Kehai Chen4, Rui Wang4,∗, Masao Utiyama4, Eiichiro Sumita4, Zuchao Li1,2,3 , Hai Zhao1,2,3,∗
4
+
5
+ 1Department of Computer Science and Engineering, Shanghai Jiao Tong University 2Key Laboratory of Shanghai Education Commission for Intelligent Interaction and Cognitive Engineering, Shanghai Jiao Tong University, Shanghai, China 3MoE Key Lab of Artificial Intelligence, AI Institute, Shanghai Jiao Tong University 4National Institute of Information and Communications Technology (NICT), Kyoto, Japan zhangzs@sjtu.edu.cn, charlee@sjtu.edu.cn, zhaohai@cs.sjtu.edu.cn, {khchen, wangrui, mutiyama, eiichiro.sumita}@nict.go.jp
6
+
7
+ # ABSTRACT
8
+
9
+ Though visual information has been introduced for enhancing neural machine translation (NMT), its effectiveness strongly relies on the availability of large amounts of bilingual parallel sentence pairs with manual image annotations. In this paper, we present a universal visual representation learned over the monolingual corpora with image annotations, which overcomes the lack of largescale bilingual sentence-image pairs, thereby extending image applicability in NMT. In detail, a group of images with similar topics to the source sentence will be retrieved from a light topic-image lookup table learned over the existing sentence-image pairs, and then is encoded as image representations by a pretrained ResNet. An attention layer with a gated weighting is to fuse the visual information and text information as input to the decoder for predicting target translations. In particular, the proposed method enables the visual information to be integrated into large-scale text-only NMT in addition to the multimodal NMT. Experiments on four widely used translation datasets, including the WMT’16 English-to-Romanian, WMT’14 English-to-German, WMT’14 Englishto-French, and Multi30K, show that the proposed approach achieves significant improvements over strong baselines.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Visual information has been introduced for neural machine translation in some previous studies (NMT) (Specia et al., 2016; Elliott et al., 2017; Barrault et al., 2018; Ive et al., 2019) though the contribution of images is still an open question (Elliott, 2018; Caglayan et al., 2019). Typically, each bilingual (or multilingual) parallel sentence pair is annotated manually by one image describing the content of this sentence pair. The bilingual parallel corpora with manual image annotations are used to train a multimodal NMT model by an end-to-end framework, and results are reported on a specific data set, Multi30K (Calixto & Liu, 2017; Calixto et al., 2017).
14
+
15
+ One strong point of the multimodal NMT model is the ability to use visual information to improve the quality of the target translation. However, the effectiveness heavily relies on the availability of bilingual parallel sentence pairs with manual image annotations, which hinders the image applicability to the NMT. As a result, the visual information is only applied to the translation task over a small and specific multimodal data set Multi30K (Elliott et al., 2016), but not to large-scale text-only NMT (Bahdanau et al., 2014; Gehring et al., 2017; Vaswani et al., 2017) and low-resource text-only NMT (Fadaee et al., 2017; Lample et al., 2018; Ma et al., 2019; Zhou et al., 2019). In addition, because of the high cost of annotation, the content of one bilingual parallel sentence pair is only represented by a single image, which is weak in capturing the diversity of visual information. The current situation of introducing visual information results in a bottleneck in the multimodal NMT and is not feasible for text-only NMT and low-resource NMT.
16
+
17
+ In this paper, we present a universal visual representation (VR) method1 relying only on image-monolingual annotations instead of the existing approach that depends on image-bilingual annotations, thus breaking the bottleneck of using visual information in NMT. In detail, we transform the existing sentence-image pairs into a topic-image lookup table from a small-scale multimodal data set Multi30K. During the training and decoding process, a group of images with a similar topic to the source sentence will be retrieved from the topic-image lookup table learned by the term frequency-inverse document frequency, and thus is encoded as image representations by a pretrained ResNet (He et al., 2016). A simple and effective attention layer is then designed to fuse the image representations and the original source sentence representations as input to the decoder for predicting target translations. In particular, the proposed approach can be easily integrated into the text-only NMT model without annotating large-scale bilingual parallel corpora. The proposed method was evaluated on four widely-used translation datasets, including the WMT’16 Englishto-Romanian, WMT’14 English-to-German, WMT’14 English-to-French, and Multi30K which are standard corpora for NMT and multimodal machine translation (MMT) evaluation. Experiments and analyses show effectiveness. In summary, our contributions are primarily three-fold:
18
+
19
+ 1. We present a universal visual representation method that overcomes the shortcomings of the bilingual (or multilingual) parallel data with manual image annotations for MMT.
20
+ 2. The proposed method enables the text-only NMT to use the multimodality of visual information without annotating the existing large scale bilingual parallel data.
21
+ 3. Experiments on different scales of translation tasks verified the effectiveness and generality of the proposed approach.
22
+
23
+ # 2 RELATED WORK
24
+
25
+ Building fine-grained representation with extra knowledge is an essential topic in language modeling (Li et al., 2020a;b; Zhang et al., 2020b;a), among which adopting visual modality could potentially benefit the machine with a more comprehensive perception of the real world. Inspired by the studies on the image description generation (IDG) task (Mao et al., 2014; Elliott et al., 2015; Venugopalan et al., 2015; Xu et al., 2015), a new shared translation task for multimodal machine translation was addressed by the machine translation community (Specia et al., 2016). In particular, the released dataset Multi30K (Elliott et al., 2016) includes 29,000 multilingual (English, German, and French) parallel sentence pairs with image annotations (Elliott et al., 2017; Barrault et al., 2018). Subsequently, there has been a rise in the number of studies (Caglayan et al., 2016; 2017; Calixto et al., 2016; Huang et al., 2016; Libovicky & Helcl, 2017; Helcl et al., 2018). For \` example, Calixto et al. (2017) proposed a doubly-attentive multimodal NMT model to incorporate spatial-visual features, improving translation performance. Compared with spatial-visual features, Calixto & Liu (2017) further incorporated global image features as words in the source sentence and to enhance the encoder or decoder hidden state. In contrast, some recent studies indicated that the visual modality is either unnecessary (Zhang et al., 2017) or only marginally beneficial (Gronroos ¨ et al., 2018). More recently, Ive et al. (2019) showed that visual information is only needed in particular cases, such as for ambiguous words where the textual context is not sufficient.
26
+
27
+ However, these approaches only center around a small and specific Multi30K data set to build a multimodal NMT model, which hinders image applicability to NMT. The reason would be the high cost of image annotations, resulting potentially in the image information not being adequately discovered. We believe that the capacity of MMT has not yet been excavated sufficiently, and there is still a long way to go before the potential of MMT is fully discovered. In this work, we seek to break this constraint and enable visual information to benefit NMT, especially text-only NMT.
28
+
29
+ # 3 UNIVERSAL VISUAL RETRIEVAL
30
+
31
+ <table><tr><td colspan="2">Algorithm1 Topic-image Lookup Table Conversion Algorithm</td></tr><tr><td>Require: Input sentences, S= {Xi, X2,... X1} and paired images E = {e1,e2,...,e1} 1:Obtain the TF-IDF dictionary F= TF-IDF(S) 2: 3: procedure TF-IDF(S)</td><td>Ensure: Topic-image lookup table Q where each word is associated with a group of images Transform sentence-image pair to topic-image lookup table Q= LookUp(S,E,F)</td></tr><tr><td>4: for each sentence in S do 5: end for</td><td>Filter stop-words in the sentence</td></tr><tr><td>6:</td><td>Calculate the TF-IDF weight for each word</td></tr><tr><td>7: 8:</td><td></td></tr><tr><td>9:</td><td></td></tr><tr><td></td><td>return TF-IDF dictionary F</td></tr><tr><td>10:</td><td>end procedure</td></tr><tr><td>11:</td><td>procedure LOOKUP(S,E,F)</td></tr><tr><td>12:</td><td>for For each pair{Ti,ei} ∈zip{S,E}do</td></tr><tr><td></td><td>Rank and pick out the top-w“topic” words in the sentence according to the TF-IDF</td></tr><tr><td>13:</td><td>score in the dictionary F,and each sentence is reformed as T= {t1,t2,...,tw}</td></tr><tr><td>14:</td><td>Pair the w words with the corresponding image ei</td></tr><tr><td>15:</td><td>for For each word tjin T do</td></tr><tr><td></td><td>if ei not in Q[tj] then</td></tr><tr><td>16:</td><td></td></tr><tr><td>17:</td><td>Add ej to the corresponding image set Q[tj] for word t j</td></tr><tr><td>18:</td><td>end if</td></tr><tr><td></td><td></td></tr><tr><td>19:</td><td>end for</td></tr><tr><td></td><td></td></tr><tr><td>20:</td><td>end for</td></tr><tr><td></td><td></td></tr><tr><td>21:</td><td>return Topic-image lookup table Q</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td>end procedure</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></table>
32
+
33
+ In this section, we will introduce the proposed universal visual representation method. Generally, the default input setting of the MMT is a sentence-image pair. Our basic intuition is to transform the existing sentence-image pairs into topic-image lookup table2, which assumes the topic words in a sentence should be relevant to the paired image. Consequently, a sentence can possess a group of images by retrieving the topic-image lookup table.
34
+
35
+ Topic-image Lookup Table Conversion To focus on the major part of the sentence and suppress the noise such as stopwords and low-frequency words, we design a filtering method to extract the “topic” words of the sentence through the term frequency-inverse document frequency $( \mathrm { T F - I D F } ) ^ { 3 }$ inspired by Chen et al. (2019). Specifically, given an original input sentence $X = \{ x _ { 1 } , x _ { 2 } , \dots , x _ { I } \}$ of length $I$ and its paired image $e$ , $X$ is first filtered by a stopword list4 and then the sentence is treated as a document $g$ . We then compute TF-IDF $T I _ { i , j }$ for each word $x _ { i }$ in $g$ ,
36
+
37
+ $$
38
+ T I _ { i , j } = \frac { o _ { i , j } } { \sum _ { k } o _ { k , j } } \times \log \frac { | { G } | } { 1 + | { j } : { x } _ { i } \in { g } | } ,
39
+ $$
40
+
41
+ where $o _ { i , j }$ represents the number of occurrences of the word $x _ { i }$ in the input sentence $g$ , $| G |$ the total number of source language sentences in the training data, and $| j : x _ { i } \in g |$ the number of source sentences including word $x _ { i }$ in the training data. We then select the top- $w$ high TF-IDF words as the new image description $T = \{ t _ { 1 } , t _ { 2 } , \dots , t _ { w } \}$ for the input sentence $X$ . After preprocessing, each filtered sentence $T$ is paired with an image $e$ , and each word $t _ { i } \in T$ is regarded as the topic word for image $e$ . After processing the whole corpus (i.e., Multi30K), we form a topic-image lookup table $\mathcal { Q }$ as described in Algorithm 1, in which each topic word $t _ { i }$ would be paired with dozens of images.
42
+
43
+ Image Retrieval For the input sentence, we first obtain its topic words according to the text preprocessing method described above. Then we retrieve the associated images for each topic word from the lookup table $\mathcal { Q }$ and group all the retrieved images together to form an image list $\mathcal { G }$ . We observe that an image might be associated with multiple topic words so that it would occur multiple times in the list $\mathcal { G }$ . Therefore, we sort the images according to the frequency of occurrences in $\mathcal { G }$ to maintain the total number of images for each sentence at $m$ .
44
+
45
+ ![](images/ec6ef9a373972526443f987670429f17c4cfcb962c73244ef05b7230b637fbcc.jpg)
46
+ Figure 1: Illustration of the proposed visual retrieval.
47
+
48
+ Figure 1 illustrates the retrieval process5. In the left block, we show six examples of sentence-image pairs in which the topic words are in boldface. Then we process the corpus using the topic-image transformation method demonstrated above and obtain the topic-image lookup table. For example, the word dog is associated with 1,512 images. For an input source sentence, we obtain the topic words (in boldface) using the same preprocessing. Then we retrieve the corresponding images from the lookup table for each topic word. Now we have a list of images, and some images appear multiple times as they have various topics (like the boxed image in Figure 1). So we sort the retrieved image list by the count of occurrence to pick out the top- $m$ images that cover the most topics of the sentence.
49
+
50
+ At test time, the process of getting images is done using the image lookup table built by the training set, so we do not need to use the images from the dev and test sets in Multi30K dataset6. Intuitively, we do not strictly require the manual alignment of the word (or concept) and image, but rely on the co-occurrence of topic word and image, which is simpler and more general. In this way, we call our method as universal visual retrieval.
51
+
52
+ # 4 NMT WITH UNIVERSAL VISUAL REPRESENTATION
53
+
54
+ In this section, we introduce the proposed universal visual representation (VR) method for NMT.
55
+ The overview of the framework of our proposed method is shown in Figure 2.
56
+
57
+ # 4.1 SOURCE REPRESENTATION FOR NEURAL MACHINE TRANSLATION
58
+
59
+ In the state-of-the-art Transformer-based NMT (Vaswani et al., 2017), source information is encoded as source representation by an SAN-based encoder with multiple layers. Specifically, the encoder is composed of a stack of $L$ identical layers, each of which includes two sub-layers. The first sublayer is a self-attention module, whereas the second is a position-wise, fully connected feed-forward network. A residual connection (He et al., 2016) is applied between the two sub-layers, and then a layer normalization (Ba et al., 2016) is performed. Formally, the stack of learning the source representation is organized as follows:
60
+
61
+ ![](images/c4aaf77a9b3f70bdd6db859235887c88b50e0497f0bb88b7a5d30fb871a689b9.jpg)
62
+ Figure 2: Overview of the framework of our proposed method.
63
+
64
+ $$
65
+ \begin{array} { r l } & { \overline { { \mathbf { H } } } ^ { l } = \mathrm { L N } ( \mathrm { A T T } ^ { l } ( \mathbf { Q } ^ { l - 1 } , \mathbf { K } ^ { l - 1 } , \mathbf { V } ^ { l - 1 } ) + \mathbf { H } ^ { l - 1 } ) , } \\ & { \mathbf { H } ^ { l } = \mathrm { L N } ( \mathrm { F F N } ^ { l } ( \overline { { \mathbf { H } } } ^ { l } ) + \overline { { \mathbf { H } } } ^ { l } ) , } \end{array}
66
+ $$
67
+
68
+ where $\mathrm { A T T } ^ { l } ( \cdot ) , \mathrm { L N } ( \cdot )$ , and $\mathrm { F F N } ^ { l } ( \cdot )$ are the attention module, layer normalization, and the feedforward network for the $l$ -th identical layer, respectively. $\{ \mathbf { Q } ^ { l - 1 } , \mathbf { K } ^ { l - 1 } , \mathbf { V } ^ { l - 1 } \}$ are query, key, and value vectors that are transformed from the (l-1)-th layer $\mathbf { H } ^ { l - 1 }$ . For example, $\{ Q ^ { 0 } , K ^ { 0 } , V ^ { 0 } \}$ are packed from the summation $\mathbf { H } ^ { 0 }$ of the positional embeddings and word embeddings. Finally, the output of the stack of $L$ identical layers $\mathbf { \bar { H } } ^ { L }$ is the final source sentence representation.
69
+
70
+ # 4.2 AGGREGATION FOR TEXT AND IMAGE REPRESENTATIONS
71
+
72
+ After retrieval as described in Section 3, each original sentence $X ~ = ~ \{ x _ { 1 } , x _ { 2 } , \ldots , x _ { I } \}$ is paired with $m$ images $E = \{ e _ { 1 } , e _ { 2 } , \ldots , e _ { m } \}$ retrieved from the topic-image lookup table $\mathcal { Q }$ . First, the source sentence $X { = } \{ x _ { 1 } , x _ { 2 } , \ldots , x _ { I } \}$ is fed into the encoder (Eq.2) to learn the source sentence representation $\mathbf { H } ^ { L }$ . Second, the images $E = \{ e _ { 1 } , e _ { 2 } , \dots , e _ { m } \}$ are the inputs to a pre-trained ResNet (He et al., 2016) followed by a feed forward layer to learn the source image representation $t e x t M \in$ $R ^ { m \times 2 0 4 8 }$ . Then, we apply an attention mechanism7 to append the image representation to the text representation:
73
+
74
+ $$
75
+ \begin{array} { r } { \overline { { \mathscr { H } } } = \mathrm { A T T } _ { \mathcal { M } } ( \mathbf { H } ^ { L } , \mathbf { K } _ { \mathcal { M } } , \mathbf { V } _ { \mathcal { M } } ) , } \end{array}
76
+ $$
77
+
78
+ where $\{ \mathbf { K } _ { \mathcal { M } } , \mathbf { V } _ { \mathcal { M } } \}$ are packed from the learned source image representation $\mathbf { \mathcal { M } }$
79
+
80
+ Intuitively, NMT aims to produce a target word sequence with the same meaning as the source sentence rather than a group of images. In other words, the image information may play an auxiliary effect during the translation prediction. Therefore, we compute $\lambda \in [ 0 , 1 ]$ to weight the expected importance of source image representation for each source word:
81
+
82
+ $$
83
+ \lambda = \mathrm { s i g m o i d } ( \mathbf { W } _ { \lambda } \overline { { \pmb { \mathscr { H } } } } + \mathbf { U } _ { \lambda } \mathbf { H } ^ { L } ) ,
84
+ $$
85
+
86
+ where $\mathbf { W } _ { \lambda }$ and $\mathbf { U } _ { \lambda }$ are model parameters. We then fuse $\mathbf { H } ^ { L }$ and $\overline { { \mathcal { H } } }$ to learn an effective source representation:
87
+
88
+ $$
89
+ \pmb { \mathcal { H } } = \mathbf { H } ^ { L } + \lambda \overline { { \pmb { \mathcal { H } } } } .
90
+ $$
91
+
92
+ Finally, $\varkappa$ is fed to the decoder to learn a dependent-time context vector for predicting target translation. Note that there is a single aggregation layer to fuse image and text information.
93
+
94
+ # 5 EXPERIMENTS
95
+
96
+ # 5.1 DATA
97
+
98
+ The proposed method was evaluated on four widely-used translation datasets, including WMT’16 English-to-Romanian (EN-RO), WMT’14 English-to-German (EN-DE), WMT’14 English-toFrench (EN-DE), and Multi30K which are standard corpora for NMT and MMT evaluation.
99
+
100
+ 1) For the EN-RO task, we experimented with the officially provided parallel corpus: Europarl v7 and SETIMES2 from WMT’16 with 0.6M sentence pairs. We used newsdev2016 as the dev set and newstest2016 as the test set.
101
+
102
+ 2) For the EN-DE translation task, 4.43M bilingual sentence pairs of the WMT14 dataset were used as training data, including Common Crawl, News Commentary, and Europarl v7. The newstest2013 and newstest2014 datasets were used as the dev set and test set, respectively.
103
+
104
+ 3) For the EN-FR translation task, 36M bilingual sentence pairs from the WMT14 dataset were used as training data. Newstest12 and newstest13 were combined for validation and newstest14 was used as the test set, following the setting of Gehring et al. (2017).
105
+
106
+ 4) The Multi30K dataset contains 29K English {German, French} parallel sentence pairs with visual annotations. The 1,014 English {German, French $\}$ sentence pairs visual annotations are as dev set. The test sets are test2016 and test2017 with 1,000 pairs for each.
107
+
108
+ # 5.2 SYSTEM SETTING
109
+
110
+ Image Retrieval Implementation We used 29,000 sentence-image pairs from Multi30K to build the topic-image lookup table. We segmented the sentences using the same BPE vocabulary as that for each source language. We selected top-8 $\omega = 8$ ) high TF-IDF words, and the default number of images $m$ was set 5. The detailed case study is shown in Section 6.2. After preprocessing, we had about 3K topic words, associated with a total of 10K images for retrieval. Image features were extracted from the averaged pooled features of a pre-trained ResNet50 CNN (He et al., 2016). This led to feature maps V ∈ R2048.
111
+
112
+ Baseline Our baseline was text-only Transformer (Vaswani et al., 2017). We used six layers for the encoder and the decoder. The number of dimensions of all input and output layers was set to 512 and 1024 for base and big models. The inner feed-forward neural network layer was set to 2048. The heads of all multi-head modules were set to eight in both encoder and decoder layers. For the Multi30K dataset, we further evaluated a multimodal baseline (denoted as MMT) where each source sentence was paired with an original image. The other settings were the same as our proposed model.
113
+
114
+ Model Implementation The byte pair encoding algorithm was adopted, and the size of the vocabulary was set to 40,000. In each training batch, a set of sentence pairs contained approximately $4 0 9 6 \times 4$ source tokens and $4 0 9 6 \times 4$ target tokens. During training, the value of label smoothing was set to 0.1, and the attention dropout and residual dropout were $p = 0 . 1$ . We used Adam optimizer (Kingma & Ba, 2014) to tune the parameters of the model. The learning rate was varied
115
+
116
+ <table><tr><td rowspan="2">System</td><td rowspan="2">Architecture</td><td colspan="2">EN-RO</td><td colspan="2">EN-DE</td><td colspan="2">EN-FR</td></tr><tr><td>BLEU #Param</td><td>BLEU</td><td></td><td>#Param</td><td>BLEU</td><td>#Param</td></tr><tr><td colspan="7">ExistingNMTsystems</td></tr><tr><td>Vaswani et al. (2017)</td><td>Trans.(base)</td><td>N/A</td><td>N/A</td><td>27.3</td><td>N/A</td><td>38.1</td><td>N/A</td></tr><tr><td></td><td>Trans.(big)</td><td>N/A</td><td>N/A</td><td>28.4</td><td>N/A</td><td>41.0</td><td>N/A</td></tr><tr><td>Lee et al. (2018)</td><td>Trans.(base)</td><td>32.40</td><td>N/A</td><td>24.57</td><td>N/A</td><td>N/A</td><td>N/A</td></tr><tr><td colspan="8">OurNMTsystems</td></tr><tr><td rowspan="4">This work</td><td>Trans.(base)</td><td>32.66</td><td>61.54M</td><td>27.31</td><td>63.44M</td><td>38.52</td><td>63.83M</td></tr><tr><td>+VR</td><td>33.78++</td><td>63.04M</td><td>28.14++</td><td>64.94M</td><td>39.64++</td><td>65.33M</td></tr><tr><td>Trans. (big)</td><td>33.85</td><td>207.02M</td><td>28.45</td><td>210.88M</td><td>41.10</td><td>211.66M</td></tr><tr><td>+VR</td><td>34.46+</td><td>211.02M</td><td>29.14++</td><td>214.89M</td><td>41.83+</td><td>215.66M</td></tr></table>
117
+
118
+ Table 1: Results on EN-RO, EN-DE, and EN-FR for the NMT tasks. Trans. is short for transformer. N/A denotes that those numbers are not reported in the corresponding literature. $" + + / + "$ after the BLEU score indicate that the proposed method was significantly better than the corresponding baseline Transformer (base or big) at significance level $p { < } 0 . 0 1 / 0 . 0 5$ .
119
+
120
+ under a warm-up strategy with 8,000 steps. For evaluation, we validated the model with an interval of 1,000 batches on the dev set. For the Multi30K dataset, we trained the model up to 10,000 steps, and the training was early-stopped if dev set BLEU score did not improve for ten epochs. For the ENDE, EN-RO, and EN-FR tasks, following the training of 200,000 batches, the model with the highest BLEU score of the dev set was selected to evaluate the test sets. During the decoding, the beam size was set to five. All models were trained and evaluated on a single V100 GPU. Multi-bleu.perl8 was used to compute case-sensitive 4-gram BLEU scores for all test sets. The signtest (Collins et al., 2005) is a standard statistical-significance test. In addition, we followed the model configurations of Vaswani et al. (2017) to train Big models for WMT EN-RO, EN-DE, and EN-FR translation tasks. All experiments were conducted with fairseq9 (Ott et al., 2019). The analysis in Section 6 is conducted on base models.
121
+
122
+ # 5.3 RESULTS
123
+
124
+ Table 1 shows the results for the WMT’14 EN-DE, EN-FR, and WMT’16 EN-RO translation tasks. Our implemented Transformer (base/big) models showed similar BLEU scores with the original Transformer (Vaswani et al., 2017), ensuring that the proposed method can be evaluated over strong baseline NMT systems. As seen, the proposed $+ \mathrm { V R }$ significantly outperformed the baseline Transformer (base), demonstrating the effectiveness of modeling visual information for text-only NMT. In particular, the effectiveness was adapted to the translation tasks of the three language pairs, which have different scales of training data, verifying that the proposed approach is a universal method for improving translation performance.
125
+
126
+ Our method introduced only $1 . 5 \mathbf { M }$ and $4 . 0 \mathbf { M }$ parameters for the base and big transformers, respectively. The number is less than $3 \%$ of the baseline parameters as we used the fixed image embeddings from the pre-trained ResNet feature extractor. Besides, the training time was basically the same as the baseline model (Section 6.4).
127
+
128
+ In addition, the proposed method was also evaluated for MMT on the multimodal dataset, Multi30K. Results in Table 2 show that our model also outperformed the transformer baseline. Compared with the results in text-only NMT, we find that the image presentation gave marginal contribution, which was consistent with the findings in previous work (Zhang et al., 2017; Gronroos et al., 2018; ¨ Caglayan et al., 2019). The most plausible reason might be that the sentences in Multi30K are so simple, short, and repetitive that the source text is sufficient to perform the translation (Caglayan et al., 2019; Ive et al., 2019). This verifies our assumption of the current bottleneck of MMT due to the limitation of Multi30K and shows the necessity of our new setting of transferring multimodality into more standard and mature text-only NMT tasks.
129
+
130
+ <table><tr><td rowspan="2">System</td><td rowspan="2">Architecture</td><td colspan="3">EN-DE</td><td colspan="3">EN-FR</td></tr><tr><td>Test2016</td><td>Test2017</td><td>#Param</td><td>Test2016</td><td>Test2017</td><td>#Param</td></tr><tr><td colspan="8">Existing NMTsystems</td></tr><tr><td>Calixto et al. (2017)</td><td>RNN</td><td>33.7</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td></tr><tr><td>Elliott et al. (2017)</td><td>RNN</td><td>N/A</td><td>19.3</td><td>N/A</td><td>N/A</td><td>44.3</td><td>N/A</td></tr><tr><td>Elliott &amp; Kadar (2017)</td><td>Imagination</td><td>36.8</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td><td>N/A</td></tr><tr><td rowspan="2">Ive et al. (2019)</td><td>Trans. (big)</td><td>36.4</td><td>N/A</td><td>N/A</td><td>59.0</td><td>N/A</td><td>N/A</td></tr><tr><td>Del</td><td>38.0</td><td>N/A</td><td>N/A</td><td>60.1</td><td>N/A</td><td>N/A</td></tr><tr><td colspan="8">Our MMTsystems</td></tr><tr><td rowspan="6">This work</td><td>MMT.(base)</td><td>35.09</td><td>27.10</td><td>50.72M</td><td>57.40</td><td>48.02</td><td>50.65M</td></tr><tr><td>MMT.(big)</td><td>35.60</td><td>28.02</td><td>190.58M</td><td>57.87</td><td>49.63</td><td>190.43M</td></tr><tr><td>Trans.(base)</td><td>35.59</td><td>26.31</td><td>49.15M</td><td>57.88</td><td>48.55</td><td>49.07M</td></tr><tr><td>+VR</td><td>35.72</td><td>26.87</td><td>50.72M</td><td>58.32</td><td>48.69</td><td>50.65M</td></tr><tr><td>Trans. (big)</td><td>36.86</td><td>27.62</td><td>186.38M</td><td>56.97</td><td>48.17</td><td>186.23M</td></tr><tr><td>+VR</td><td>36.94</td><td>28.63</td><td>190.58M</td><td>57.53</td><td>48.46</td><td>190.43M</td></tr></table>
131
+
132
+ Table 2: Results from the test2016 and test2017 for the MMT task. Del denotes the deliberation network in (Ive et al., 2019). Elliott et al. (2017) is the official baseline (text-only NMT) on WMT17- Multi30K 2017 test data. Trans. is short for transformer and MMT is the multimodal baseline described in Section 5.2. Because we used the same model for test2016 and test2017 evaluation, the numbers of parameters are the same.
133
+
134
+ # 6 ANALYSIS
135
+
136
+ # 6.1 WHY DOES THE LOOKUP TABLE WORK
137
+
138
+ The contribution of the lookup table could be two folds: 1) the content connection of the sentences and images; 2) the topic-aware co-occurrence of similar images and sentences. There are cases when paired images are not accurately related to the given sentence. A simple solution is to set a threshold heuristically for the TF-IDF retrieval to filter out the “improper” images. However, we maintain the specific number of the images in this work because of the second potential benefits of the cooccurrence, by taking images as diverse topic information. According to Distributional Hypothesis (Harris, 1954), which states that words that occur in similar contexts tend to have similar meanings, we are inspired to extend the concept in the multimodal world, the sentences with similar meanings would be likely to pair with similar even the same images. Therefore, the consistent images (with a related topic) could play the role of topic or type hints for similar sentence modeling.
139
+
140
+ This is also very similar to the idea of word embedding by taking each image as a “word”. Because we use the average pooled output of ResNet, each image is represented as a 2400-d vector. For all the 29,000 images, we have an embedding layer with size (29000, 2400). The “content” of the image is regarded as the embedding initialization. It indeed makes effects, but the capacity of the neural network is not up to it. In contrast, the mapping from text word to the index in the word embedding is critical. Similarly, the mapping of sentence to image in image embedding would be essential, i.e., the similar sentences (with the same topic words) tend to map the same or similar image.
141
+
142
+ To verify the hypotheses, we replace our ResNet features with 1) Shuffle: shuffle the image features but keep the lookup table; 2) Random Init: randomly initialize the image embedding but keep the lookup table; 3) Random Mapping: randomly retrieve unrelated images. The BLEU scores are on EN-RO are 33.53, 33,28, 32.14, respectively. The results of 1-2 are close to the proposed VR (33.78) and outperform the baseline (32.66), which shows that the content of images would not be very important. The ablation 3) gives a lower result, which verifies the necessity of the mapping, especially the topic relationship.
143
+
144
+ # 6.2 INFLUENCE OF THE NUMBER OF IMAGES
145
+
146
+ To evaluate the influence of the number of paired images $m$ , we constrained $m$ in $\{ 0 , 1 , 3 , 5 , 7 , 9 ,$ $1 5 , 2 0 , 3 0 \}$ for experiments on the EN-RO test set, as shown in Figure 4. When $m = 0$ , the model is the baseline NMT model, whose BLEU score was lower than all the models with images. As the number of images increases, the BLEU score also increased at the beginning (from 32.66 to 33.78)
147
+
148
+ and then slightly decreased when $m$ exceeds 5. The reason might be that too many images for a sentence would have a higher chance of noise. Therefore, we set $m = 5$ in our models.
149
+
150
+ The number of sentence-image pairs to create the lookup table could also make effects. We randomly split the pairs of Multi30K into the proportion in [0.1, 0.3, 0.5, 0.7, 0.9], the corresponding BLEU scores for EN-RO are [33.07, 33.44, 34.01, 34.06, 33.80]. Furthermore, we also evaluate the performance by adding external sentence-pairs from the training set of MS COCO image caption dataset (Lin et al., 2014). The BLEU scores are 33.55 and 33.71, respectively, for COCO only and Mult $1 3 0 \mathrm { K + C O C O }$ . These results indicate that a modest number of pairs would be beneficial.
151
+
152
+ # 6.3 THE INFLUENCE OF GATING WEIGHT λ
153
+
154
+ ![](images/4afe8a65f062ea1895711881c063117fba5d70ddc29a026e2c577a7da5e5e8cd.jpg)
155
+ Figure 4: Influence of the number of images on the BLEU score.
156
+
157
+ ![](images/2cf68d92dc3d17de00225cf8437e911eec88366d65a4a253c5cc7df8c22e8536.jpg)
158
+ Figure 5: Quantitative study of the gating weight $\lambda$ .
159
+
160
+ In our model, the weight $\lambda$ of the gated aggregation method was learned automatically to measure the importance of the visual information. We compared by manually setting the weight $\lambda$ into scalar values in $\{ 0 . 1 , 0 . 3 , 0 . 5 , 0 . 7 , 0 . 9 \}$ for experiments on the EN-RO test set. Figure 5 shows that all models with manual $\lambda$ outperformed the baseline Trans. (base), indicating the effectiveness of image information. In contrast, they were inferior to the performance of our model. This means that the degree of dependency for image information varies for each source sentence, indicating the necessity of automatically learning the gating weights of image representations.
161
+
162
+ # 6.4 EXTRA COMPUTATION TIME
163
+
164
+ There are mainly two extra computation costs using our method, including 1) obtaining image data for sentences and 2) learning image representations, which are negligible compared with training an NMT model. The time of obtaining image data for MT sentences for the EN-RO dataset is less than 1 minute using GPU. The lookup table is formed as the mapping of token (only topic words) index to image id. Then, the retrieval method is applied as the tensor indexing from the sentence token indices (only topic words) to image ids, which is the same as the procedure of word embedding. The retrieved image ids are then sorted by frequency. Learning image representations takes about 2 minutes for all the 29,000 images in Multi30K using 6G GPU memory for feature extraction and eight threads of CPU for transforming images. The extracted features are formed as the “image embedding layer” with the size of (29000, 2400) for quick access in the neural network.
165
+
166
+ # 7 CONCLUSION
167
+
168
+ This work presents a universal visual representation method for neural machine translation relying on monolingual image annotations, which breaks the restraint of heavy dependency on bilingual sentence-image pairs in the current multimodal NMT setting. In particular, this method enables visual information to be applied to large-scale text-only NMT through a topic-image lookup. We hope this work sheds some light on future MMT research. In the future, we will try to adopt the proposed method for other tasks.
169
+
170
+ # REFERENCES
171
+
172
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
173
+
174
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
175
+
176
+ Lo¨ıc Barrault, Fethi Bougares, Lucia Specia, Chiraag Lala, Desmond Elliott, and Stella Frank. Findings of the third shared task on multimodal machine translation. In Proceedings of the Third Conference on Machine Translation: Shared Task Papers, pp. 304–323, 2018.
177
+
178
+ Ozan Caglayan, Lo¨ıc Barrault, and Fethi Bougares. Multimodal attention for neural machine translation. arXiv preprint arXiv:1609.03976, 2016.
179
+
180
+ Ozan Caglayan, Walid Aransa, Adrien Bardet, Mercedes Garc´ıa-Mart´ınez, Fethi Bougares, Lo¨ıc Barrault, Marc Masana, Luis Herranz, and Joost van de Weijer. Lium-cvc submissions for wmt17 multimodal translation task. In Proceedings of the Second Conference on Machine Translation, pp. 432–439, 2017.
181
+
182
+ Ozan Caglayan, Pranava Swaroop Madhyastha, Lucia Specia, and Lo¨ıc Barrault. Probing the need for visual context in multimodal machine translation. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4159–4170, 2019.
183
+
184
+ Iacer Calixto and Qun Liu. Incorporating global visual features into attention-based neural machine translation. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 992–1003, 2017.
185
+
186
+ Iacer Calixto, Desmond Elliott, and Stella Frank. Dcu-uva multimodal mt system report. In Proceedings of the First Conference on Machine Translation: Volume 2, Shared Task Papers, pp. 634–638, 2016.
187
+
188
+ Iacer Calixto, Qun Liu, and Nick Campbell. Doubly-attentive decoder for multi-modal neural machine translation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1913–1924, 2017.
189
+
190
+ Kehai Chen, Rui Wang, Masao Utiyama, Eiichiro Sumita, and Tiejun Zhao. Neural machine translation with sentence-level topic context. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 2019.
191
+
192
+ Michael Collins, Philipp Koehn, and Ivona Kucerova. Clause restructuring for statistical machine translation. In Proceedings of the 43rd Annual Meeting of the Association for Computational Linguistics, Ann Arbor, Michigan, 2005.
193
+
194
+ Desmond Elliott. Adversarial evaluation of multimodal machine translation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 2974–2978, 2018.
195
+
196
+ Desmond Elliott and Akos K ´ ad´ ar. Imagination improves multimodal translation. In ´ Proceedings of the Eighth International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 130–141, 2017.
197
+
198
+ Desmond Elliott, Stella Frank, and Eva Hasler. Multilingual image description with neural sequence models. arXiv preprint arXiv:1510.04709, 2015.
199
+
200
+ Desmond Elliott, Stella Frank, Khalil Sima’an, and Lucia Specia. Multi30k: Multilingual englishgerman image descriptions. In Proceedings of the 5th Workshop on Vision and Language, pp. 70–74, 2016.
201
+
202
+ Desmond Elliott, Stella Frank, Lo¨ıc Barrault, Fethi Bougares, and Lucia Specia. Findings of the second shared task on multimodal machine translation and multilingual image description. In Proceedings of the Second Conference on Machine Translation, pp. 215–233, 2017.
203
+
204
+ Marzieh Fadaee, Arianna Bisazza, and Christof Monz. Data augmentation for low-resource neural machine translation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pp. 567–573, 2017.
205
+
206
+ Jonas Gehring, Michael Auli, David Grangier, and Yann Dauphin. A convolutional encoder model for neural machine translation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 123–135, 2017.
207
+
208
+ Stig-Arne Gronroos, Benoit Huet, Mikko Kurimo, Jorma Laaksonen, Bernard Merialdo, Phu Pham, ¨ Mats Sjoberg, Umut Sulubacak, J ¨ org Tiedemann, Raphael Troncy, et al. The memad submission ¨ to the wmt18 multimodal translation task. In Proceedings of the Third Conference on Machine Translation: Shared Task Papers, pp. 603–611, 2018.
209
+
210
+ Zellig S Harris. Distributional structure. Word, 10(2-3):146–162, 1954.
211
+
212
+ 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.
213
+
214
+ Jindˇrich Helcl, Jindˇrich Libovicky, and Dusan Varis. Cuni system for the wmt18 multimodal \` translation task. In Proceedings of the Third Conference on Machine Translation: Shared Task Papers, pp. 616–623, 2018.
215
+
216
+ Po-Yao Huang, Frederick Liu, Sz-Rung Shiang, Jean Oh, and Chris Dyer. Attention-based multimodal neural machine translation. In Proceedings of the First Conference on Machine Translation: Volume 2, Shared Task Papers, pp. 639–645, 2016.
217
+
218
+ Julia Ive, Pranava Madhyastha, and Lucia Specia. Distilling translations with visual awareness. arXiv preprint arXiv:1906.07701, 2019.
219
+
220
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
221
+
222
+ Guillaume Lample, Myle Ott, Alexis Conneau, Ludovic Denoyer, et al. Phrase-based & neural unsupervised machine translation. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 5039–5049, 2018.
223
+
224
+ Jason Lee, Elman Mansimov, and Kyunghyun Cho. Deterministic -autoregressive neural sequence modeling by iterative refinement. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 1173–1182, 2018.
225
+
226
+ Zuchao Li, Rui Wang, Kehai Chen, Masao Utiyama, Eiichiro Sumita, Zhuosheng Zhang, and Hai Zhao. Explicit sentence compression for neural machine translation. In Proceedings of the ThirtyFourth AAAI Conference on Artificial Intelligence, 2020a.
227
+
228
+ Zuchao Li, Rui Wang, Kehai Chen, Masao Utiyama, Eiichiro Sumita, Zhuosheng Zhang, and Hai Zhao. Data-dependent gaussian prior objective for language generation. In Eighth International Conference on Learning Representations, 2020b.
229
+
230
+ Jindˇrich Libovicky and Jind \` ˇrich Helcl. Attention strategies for multi-source sequence-to-sequence learning. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 2: Short Papers), pp. 196–202, 2017.
231
+
232
+ 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.
233
+
234
+ Xuezhe Ma, Chunting Zhou, Xian Li, Graham Neubig, and Eduard Hovy. Flowseq: Nonautoregressive conditional sequence generation with generative flow. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 4273–4283, 2019.
235
+
236
+ Junhua Mao, Wei Xu, Yi Yang, Jiang Wang, and Alan L Yuille. Explain images with multimodal recurrent neural networks. arXiv preprint arXiv:1410.1090, 2014.
237
+
238
+ 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. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations), pp. 48–53, 2019.
239
+
240
+ Lucia Specia, Stella Frank, Khalil Sima’an, and Desmond Elliott. A shared task on multimodal machine translation and crosslingual image description. In Proceedings of the First Conference on Machine Translation: Volume 2, Shared Task Papers, pp. 543–553, 2016.
241
+
242
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems 30, pp. 5998–6008, 2017.
243
+
244
+ Subhashini Venugopalan, Marcus Rohrbach, Jeffrey Donahue, Raymond Mooney, Trevor Darrell, and Kate Saenko. Sequence to sequence-video to text. In Proceedings of the IEEE international conference on computer vision, pp. 4534–4542, 2015.
245
+
246
+ 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.
247
+
248
+ Jingyi Zhang, Masao Utiyama, Eiichro Sumita, Graham Neubig, and Satoshi Nakamura. Nict-naist system for wmt17 multimodal translation task. In Proceedings of the Second Conference on Machine Translation, pp. 477–482, 2017.
249
+
250
+ Zhuosheng Zhang, Yuwei Wu, Hai Zhao, Zuchao Li, Shuailiang Zhang, Xi Zhou, and Xiang Zhou. Semantics-aware BERT for language understanding. In Proceedings of the Thirty-Fourth AAAI Conference on Artificial Intelligence, 2020a.
251
+
252
+ Zhuosheng Zhang, Yuwei Wu, Junru Zhou, Sufeng Duan, Hai Zhao, and Rui Wang. SG-Net: Syntax-guided machine reading comprehension. In Proceedings of the Thirty-Fourth AAAI Conference on Artificial Intelligence, 2020b.
253
+
254
+ Chunting Zhou, Xuezhe Ma, Junjie Hu, and Graham Neubig. Handling syntactic divergence in low-resource machine translation. arXiv preprint arXiv:1909.00040, 2019.
255
+
256
+ A APPENDIX
257
+
258
+ A.1 EXAMPLES OF RETRIEVED IMAGES
259
+
260
+ ![](images/293a5463d7433f9fcf3db43d8f8e360e7f0c0a86cb0f1e2cbf762a4bcdf0de49.jpg)
261
+ Figure 5: Examples of the topic-image lookup table and retrieved images for sentences in Multi30K dataset. We only show six images for each topic or sentence for instance. The topics in each sentence are in boldface.
262
+
263
+ The old system of private arbitration courts is off the table
264
+
265
+ ![](images/e5ba119ecb4055c44d9ac56f8f958a5bf101cbc9dfd928f44a8f71b79e2c460d.jpg)
266
+
267
+ This issue is shaping as a potential early rift with the business community
268
+
269
+ ![](images/42433a729a2739381d56bd5a48c8efe8b2f45ab2f7e88db467ebdf9f4a94fba9.jpg)
270
+
271
+ He said he then heard his friend , Hamza calling to him
272
+
273
+ ![](images/3ef3ba5df5780e6c074b6b54dd18c1288a6010c367ada066a6c05dccf074ad88.jpg)
274
+
275
+ The red flag has been risen
276
+
277
+ ![](images/feaeea2efe7f95fcdd779fa0dfcbc2340d2b06448715b7e1cbee82ec6754e002.jpg)
278
+
279
+ The character attempts to pass human smugglers and then border police on his way to a refugee centre in the European Union .
280
+
281
+ ![](images/6a2a396fc01022d989bc1aaf0e76e67498ceb7789654193b875e7f01d6cafe83.jpg)
282
+ Figure 6: Examples of the retrieved images for sentences in WMT datasets. We only show six images for each sentence for instance. The topics in each sentence are in boldface.
md/train/ByuI-mW0W/ByuI-mW0W.md ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TOWARDS A TESTABLE NOTION OF GENERALISATION FOR GENERATIVE ADVERSARIAL NETWORKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We consider the question of how to assess generative adversarial networks, in particular with respect to whether or not they generalise beyond memorising the training data. We propose a simple procedure for assessing generative adversarial network performance based on a principled consideration of what the actual goal of generalisation is. Our approach involves using a test set to estimate the Wasserstein distance between the generative distribution produced by our procedure, and the underlying data distribution. We use this procedure to assess the performance of several modern generative adversarial network architectures. We find that this procedure is sensitive to the choice of ground metric on the underlying data space, and suggest a choice of ground metric that substantially improves performance. We finally suggest that attending to the ground metric used in Wasserstein generative adversarial network training may be fruitful, and provide a concrete formulation for doing so.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Generative adversarial networks (GANs) (Goodfellow et al., 2014) have attracted significant interest as a means for generative modelling. However, recently concerns have been raised about their ability to generalise from training data and their capacity to overfit (Arora & Zhang, 2017; Arora et al., 2017). Moreover, techniques for evaluating the quality of GAN output are either ad hoc, lack theoretical rigor, or are not suitably objective – often times “visual inspection” of samples is the main tool of choice for the practitioner. More fundamentally, it is sometimes unclear exactly what we want a GAN to do: what is the learning task that we are trying to achieve?
12
+
13
+ In this paper, we provide a simple formulation of the GAN training framework, which consists of using a finite dataset to estimate an underlying data distribution. The quality of GAN output is measured precisely in terms of a statistical distance $D$ between the estimated and true distribution. Within this context, we propose an intuitive notion of what it means for a GAN to generalise.
14
+
15
+ We also show how our notion of performance can be measured empirically for any GAN architecture when $D$ is chosen to be a Wasserstein distance, which – unlike other methods such as the inception score (Salimans et al., 2016) – requires no density assumptions about the data-generating distribution. We investigate this choice of $D$ empirically, finding that its performance is heavily dependent on the choice of ground metric underlying the Wasserstein distance. We suggest a novel choice of ground metric that we show performs well, and also discuss how we might otherwise use this observation to improve the design of Wasserstein GANs (WGANs) (Arjovsky et al., 2017).
16
+
17
+ # 2 THE OBJECTIVE OF GENERATIVE MODELLING
18
+
19
+ GANs promise a means for learning complex probability distributions in an unsupervised fashion. In order to assess their effectiveness, we must first define precisely what we mean by this. We seek to do so in this section, presenting a formulation of the broader goal of generative modelling that we believe is widely compatible with much present work in this area. We also provide a natural notion of generalisation that arises in our framework.
20
+
21
+ Our setup consists of the following components. We assume some distribution $\pi$ on a set $\mathcal { X }$ . For instance, $\mathcal { X }$ may be the set of $3 2 \mathrm { x } 3 2 $ colour images, and $\pi$ the distribution from which the CIFAR-10 dataset was sampled. We assume that $\pi$ is completely intractable: we do not know its density (or even if it has one), and we do not have a procedure to draw novel samples from it. However, we do suppose that we have a fixed dataset $X$ consisting of samples $x _ { 1 } , \cdot \cdot \cdot , x _ { | X | } \overset { \mathrm { i i d } } { \sim } \pi$ . Equivalently, we have the empirical distribution
22
+
23
+ $$
24
+ \hat { X } : = \frac { 1 } { | X | } \sum _ { n = 1 } ^ { | X | } \delta _ { x _ { n } } ,
25
+ $$
26
+
27
+ where $\delta$ denotes the Dirac mass.
28
+
29
+ Let $\mathcal { P } ( \mathcal { X } )$ denote the set of probability distributions on $\mathcal { X }$ . Our aim is to use $X$ to produce a distribution in $\mathcal { P } ( \mathcal { X } )$ that is as “close” as possible to $\pi$ . We choose to measure closeness in terms of a function $D : \mathcal { P } ( \mathcal { X } ) \times \mathcal { P } ( \mathcal { X } ) \mathbb { R }$ . Usually $D$ will be chosen to be a statistical divergence, which means that $D ( P , Q ) \geq 0$ for all $P$ and $Q$ , with equality iff $P = Q$ . The task of a learning algorithm $\alpha$ in this context is then as follows:
30
+
31
+ $$
32
+ \boxed { \mathrm { S e l e c t } \alpha ( X ) \in \mathcal { P } ( \mathcal { X } ) \mathrm { ~ s u c h ~ t h a t ~ } D ( \alpha ( X ) , \pi ) \mathrm { ~ i s ~ a s ~ s m a l l ~ a s ~ p o s s i b l e . } }
33
+ $$
34
+
35
+ We believe (1) constitutes an intuitive and useful formulation of the problem of generative modelling that is largely in keeping with present research efforts.
36
+
37
+ Now, we can immediately see that one possibility is simply to choose $\alpha ( X ) : = { \hat { X } }$ . Moreover, in the case that $D$ is a metric for the weak topology on $\mathcal { P } ( \mathcal { X } )$ such as a Wasserstein distance, we have that $D ( \hat { X } , \pi ) \to 0$ almost surely as $| X | \to \infty$ , so that, assuming $| X |$ is large enough, we can already expect $D ( \hat { X } , \pi )$ to be small. This then suggests the following natural notion of generalisation:
38
+
39
+ $$
40
+ \Bigl | \mathrm { A ~ c h o i c e ~ o f } \alpha \mathrm { g e n e r a l i s e s ~ f o r ~ a ~ g i v e n } X \mathrm { i f } \ D ( \alpha ( X ) , \pi ) < D ( \hat { X } , \pi ) . \Bigr |
41
+ $$
42
+
43
+ In other words, using $\alpha$ here has actually achieved something: perhaps through some process of smoothing or interpolation, it has injected additional information into $\hat { X }$ that has moved us closer to $\pi$ than we were a priori.
44
+
45
+ # 3 GENERALISATION IN GANS
46
+
47
+ The previous section presented (1) as a general goal of generative modelling. In this section, we turn specifically to GANs. We begin by providing a general model for how many of the existing varieties of GAN operate, at least ideally. We then show how this model fits into our framework above, before considering the issue of generalisation in this context.
48
+
49
+ Most GAN algorithms in widespread use adhere to the following template: they take as input a distribution $P$ , from which we assume we can sample, and compute (or approximate)
50
+
51
+ $$
52
+ \Gamma ( P ) : = \underset { Q \in \mathcal { Q } } { \arg \operatorname* { m i n } } D _ { \Gamma } ( P , Q )
53
+ $$
54
+
55
+ for some choices of $\mathcal Q \subseteq \mathcal P ( \mathcal X )$ and $D _ { \Gamma } : \mathcal { P } ( \mathcal { X } ) \times \mathcal { P } ( \mathcal { X } ) \mathbb { R }$ . In other words, in the ideal case, a GAN maps $P$ to its $D _ { \Gamma }$ -projection onto $\mathcal { Q }$ . Note that we will not necessarily have that $D _ { \Gamma } = D$ : $D _ { \Gamma }$ is fixed given a particular GAN architecture, whereas the choice of $D$ is simply a feature of our problem definition (1) and is essentially ours to make.
56
+
57
+ In practice, $\mathcal { Q }$ is the set of pushforward measures $\nu \circ G ^ { - 1 }$ obtained from a fixed noise distribution $\nu$ on a noise space $\mathcal { Z }$ and some set $\mathcal { G }$ of functions $G : { \mathcal { Z } } { \mathcal { X } }$ . Precisely, $\mathcal { Q } = \left\{ \nu \circ G ^ { - 1 } : G \in \mathcal { G } \right\}$ . $\mathcal { G }$ itself usually corresponds to the set of functions realisable by some neural network architecture, and $\nu$ is some multivariate uniform or Gaussian distribution. However, numerous choices of $D _ { \Gamma }$ have been proposed: the original GAN formulation (Goodfellow et al., 2014) took $D _ { \Gamma }$ to be the Jenson-Shannon divergence, whereas the $f$ -GAN (Nowozin et al., 2016) generalised this to arbitrary $f$ -divergences, and the Wasserstein GAN (Arjovsky et al., 2017) advocated the Wasserstein distance. Many of the results proved in these papers involve showing that (usually under some assumptions, such as sufficient discriminator capacity) a proposed objective for $G$ is in fact equivalent to $\bar { D _ { \Gamma } ( P , \nu \circ }$ $G ^ { - 1 }$ ).
58
+
59
+ In terms of our framework in the previous section, using a GAN $\Gamma$ amounts to choosing
60
+
61
+ $$
62
+ \alpha ( X ) : = \Gamma ( \hat { X } ) = \underset { Q \in \mathcal { Q } } { \arg \operatorname* { m i n } } D _ { \Gamma } ( \hat { X } , Q ) .
63
+ $$
64
+
65
+ We emphasise again the important distinction between $D$ and $D _ { \Gamma }$ . In our setup, minimising $D$ defines our ultimate goal, whereas minimising $D _ { \Gamma }$ (over $\mathcal { Q }$ ) defines how we will attempt to achieve that goal. Even if $D \neq D _ { \Gamma }$ , it is still at least conceivable that $D ( \Gamma ( { \hat { X } } ) , \pi )$ might be small, and therefore this choice of $\alpha$ might be sensible. Also note that, crucially, $\Gamma$ receives $\hat { X }$ as input rather than $\pi$ itself. We only have access to a fixed number of CIFAR-10 samples, for example, not an infinite stream. Moreover, training GANs usually involves making many passes over the same dataset, so that, in effect, sampling from $P$ will repeatedly yield the same data points. We would not expect this to occur with nonzero probability if $P = \pi$ for most $\pi$ of interest.
66
+
67
+ The observation that $P$ is $\hat { X }$ rather than $\pi$ was also recently made by Arora et al. (2017). The authors argue that this introduces a problem for the ability of GANs to generalise, since, if $D _ { \Gamma }$ is a divergence (which is almost always the case), and if $\mathcal { Q }$ is too big (in particular, if it is big enough that $\hat { X } \in \mathcal { Q } ,$ ), then we trivially have that $\Gamma ( { \hat { X } } ) = { \hat { X } }$ . In other words, the GAN objective appears actively to encourage $\Gamma ( { \hat { X } } )$ to memorise the dataset $X$ , and never to produce novel samples from outside of it. The authors’ proposed remedy involves trying to find a better choice of $D _ { \Gamma }$ . The problem, they argue, is that popular choices of $D _ { \Gamma }$ do not satisfy the condition
68
+
69
+ $D _ { \Gamma } ( \pi , Q ) \approx D _ { \Gamma } ( { \hat { X } } , Q )$ with high probability given a modest number of samples in $X$ .
70
+
71
+ They point out that this is certainly violated when $D _ { \Gamma }$ is the Jensen-Shannon divergence JS, since
72
+
73
+ $$
74
+ \operatorname { J S } ( P \parallel Q ) = \log 2
75
+ $$
76
+
77
+ when one of $P$ and $Q$ is discrete and the other continuous, and give a similar result for $D _ { \Gamma }$ a Wasserstein distance in the case that $\pi$ is Gaussian. As a solution, they introduce the neural network distance $D _ { \mathrm { N N } }$ defined by
78
+
79
+ $$
80
+ D _ { \mathrm { N N } } ( P , Q ) : = \operatorname* { m a x } _ { f \in \mathcal { F } } \mathbb { E } _ { x \sim P } \left[ f ( x ) \right] - \mathbb { E } _ { x \sim Q } \left[ f ( x ) \right]
81
+ $$
82
+
83
+ for some choice of a class of functions $\mathcal { F }$ . They show that, assuming some smoothness conditions on the members of $\mathcal { F }$ , the choice $D _ { \Gamma } = D _ { \mathrm { N N } }$ satisfies (3), which means that if we minimise $D _ { \mathrm { N N } } ( \hat { X } , Q )$ in $Q$ then we can be confident that the value of $D _ { \mathrm { N N } } ( \pi , Q )$ is small also.
84
+
85
+ However, we do not believe that (3) is sufficient to ensure good generalisation behaviour for GANs. What we care about ultimately is not the value of $D _ { \Gamma }$ , but rather of $D$ , and (3) invites choosing $D _ { \Gamma }$ in such a way that gives no guarantees about $D$ at all. We see, for instance, that the degenerate choice $D _ { 0 } ( P , Q ) : = 0$ trivially satisfies (3), and indeed is also a pseudometric, just like $D _ { \mathrm { N N } }$ . It is therefore unclear what mathematical properties of $D _ { \mathrm { N N } }$ render it more suitable for estimating $\pi$ than the obviously undesirable $D _ { 0 }$ . The authors do acknowledge this shortcoming of $D _ { \mathrm { N N } }$ , pointing out that $D _ { \mathrm { N N } } ( P , Q )$ can be small even if $P$ and $Q$ are “quite different” in some sense.
86
+
87
+ The problematic consequences of the fact that $P = { \hat { X } }$ apply only in the case that $\mathcal { Q }$ is too large. In practice, however, $\mathcal { Q }$ is heavily restricted, since $\mathcal { G }$ is restricted via a choice of neural network architecture; hence we do not know $a$ priori whether $\boldsymbol { \Gamma } ( \boldsymbol { \hat { X } } ) = \boldsymbol { \hat { X } }$ is even possible. As such, we do not see the choice of $\alpha ( X ) = \Gamma ( \hat { X } )$ as necessarily a bad idea, and instead believe that it is an open empirical question as to how well GANs perform the task (1). In fact, this $\alpha$ falls perfectly within the framework of minimum distance estimation (Wolfowitz, 1957; Basu et al., 2011), which involves estimating an underlying distribution by minimising a distance measure to a given empirical distribution.
88
+
89
+ # 4 TESTING GANS
90
+
91
+ Our goal in this section is to assess how well GANs achieve (1) by estimating $D ( \Gamma ( X ) , \pi )$ for various $\Gamma$ and $\pi$ . This raises some difficulties, given that $\pi$ is intractable. Our approach is to take $D$ to be the first Wasserstein distance $W _ { d _ { x } }$ defined by
92
+
93
+ $$
94
+ W _ { d x } ( P , Q ) = \operatorname* { i n f } _ { \gamma \in \Pi ( P , Q ) } \int _ { \mathcal { X } \times \mathcal { X } } d _ { \mathcal { X } } ( x , y ) \mathrm { d } \gamma ( x , y ) ,
95
+ $$
96
+
97
+ where $d _ { \mathcal { X } }$ is a metric on $\mathcal { X }$ referred to as the ground metric, and $\Pi ( P , Q )$ denotes the set of joint distributions on the product space $\mathcal { X } \times \mathcal { X }$ with marginals $P$ and $Q$ . The Wasserstein distance is appealing since it is sensitive to the topology of the underlying set $\mathcal { X }$ , which we control by our choice of $d _ { \mathcal { X } }$ . Moreover, $W _ { d x }$ metricises weak convergence for the Wasserstein space $\mathcal { P } _ { d _ { \mathcal { X } } } ( \mathcal { X } )$ defined by
98
+
99
+ $$
100
+ { \mathcal { P } } _ { d _ { \mathcal { X } } } ( \mathcal { X } ) : = \left\{ P \in { \mathcal { P } } ( \mathcal { X } ) : \int _ { \mathcal { X } } d _ { \mathcal { X } } ( x _ { 0 } , y ) \mathrm { d } P ( y ) < \infty { \mathrm { ~ f o r ~ s o m e ~ } } x _ { 0 } \in \mathcal { X } \right\}
101
+ $$
102
+
103
+ (see (Villani, 2008)). Consequently, if we denote by $A$ a set of samples $a _ { 1 } , \cdots , a _ { | A | }$ iid∼ $\alpha ( X )$ and by $Y$ a set of samples (separate from $X$ ) $y _ { 1 } , \cdots , y _ { | Y | } \overset { \mathrm { i i d } } { \sim } \pi .$ , with $\hat { A }$ and $\hat { Y }$ the corresponding empirical distributions, then, provided
104
+
105
+ $$
106
+ \alpha ( X ) , \pi \in { \mathcal { P } } _ { d _ { \mathcal { X } } } ( { \mathcal { X } } ) ,
107
+ $$
108
+
109
+ we have that $D ( { \hat { A } } , { \hat { Y } } ) \to D ( \alpha ( X ) , \pi )$ almost surely as $\operatorname* { m i n } \{ | A | , | Y | \} \infty$ . Note that condition (4) holds automatically in the case that $( \mathcal { X } , d _ { \mathcal { X } } )$ is compact, since then $\mathcal { P } _ { d _ { \mathcal { X } } } ( \mathcal { X } ) = \mathcal { P } ( \mathcal { X } )$ .
110
+
111
+ As such, to estimate $D ( \alpha ( X ) , \pi )$ , for $D = W _ { d _ { x } }$ , we propose the following. Before training, we move some of our samples from $X$ into a testing set $Y$ . We next train our GAN on $X$ , obtaining $\alpha ( X )$ . We then take samples $A$ from $\alpha ( X )$ , and obtain the estimate
112
+
113
+ $$
114
+ W _ { d _ { \mathcal { X } } } ( \hat { A } , \hat { Y } ) \approx W _ { d _ { \mathcal { X } } } ( \alpha ( X ) , \pi ) ,
115
+ $$
116
+
117
+ where the left-hand side can be computed exactly by solving a linear program since both $\hat { A }$ and $\hat { Y }$ are discrete (Villani, 2003). We can also use the same methodology to estimate $W _ { d _ { \mathcal { X } } } ( \hat { X } , \pi )$ by $W _ { d x } ( \hat { X } , \hat { Y } )$ , which suggests testing if
118
+
119
+ $$
120
+ W _ { d _ { \mathcal { X } } } ( \hat { A } , \hat { Y } ) < W _ { d _ { \mathcal { X } } } ( \hat { X } , \hat { Y } ) .
121
+ $$
122
+
123
+ as a proxy for determining whether (2) holds. A summary of our procedure is given in Algorithm 1.
124
+
125
+ # Algorithm 1 Procedure for testing GANs
126
+
127
+ <table><tr><td>1: Split samples from π into a training set X and a testing set Y</td></tr><tr><td>2: Compute α(X) by training a GAN on X 3: Obtain a sample A from α(X)</td></tr></table>
128
+
129
+ # 4.1 RESULTS
130
+
131
+ We applied our methodology to test two popular GAN varieties – the DCGAN (Radford et al., 2015) and the Improved Wasserstein GAN (I-WGAN) (Gulrajani et al., 2017) – on the MNIST and CIFAR-10 datasets. In all cases when computing the relevant Wasserstein distances, our empirical distributions consisted of 10000 samples.
132
+
133
+ # 4.1.1 $L ^ { 2 }$ AS GROUND METRIC
134
+
135
+ We initially took our ground metric $d _ { \mathcal { X } }$ to be the $L ^ { 2 }$ distance. This has the appealing property of making $( \boldsymbol { \mathcal { X } } , d _ { \boldsymbol { \mathcal { X } } } )$ compact when $\mathcal { X }$ is a space of RGB or greyscale images, therefore ensuring that (4) holds.
136
+
137
+ Figure 1 shows $W _ { L ^ { 2 } } ( \hat { A } , \hat { Y } )$ plotted over multiple training runs for MNIST and CIFAR-10 when $A$ is obtained from an I-WGAN, with typical samples shown in Figures 6 and 7 in the appendix. For both datasets, $W _ { L ^ { 2 } } ( \hat { A } , \hat { Y } )$ decays towards an asymptote in a way that nicely corresponds to the visual quality of the samples produced. Moreover, $W _ { L ^ { 2 } } ( \hat { A } , \hat { Y } )$ is much closer to $W _ { L ^ { 2 } } ( \hat { X } , \hat { Y } )$ towards the tail end of training for MNIST than for CIFAR-10. This seems to reflect the fact that, visually, the eventual I-WGAN MNIST samples do seem quite close to true MNIST samples, whereas the eventual I-WGAN CIFAR-10 samples are easily identified as fake.
138
+
139
+ ![](images/a00baa7a2f8c1338c34dc16ac2b9d21542acedfe8552ef8248e5e4e39486957e.jpg)
140
+ Figure 1: Output of Algorithm 1 with $d _ { \mathcal { X } } = L ^ { 2 }$ for I-WGAN trained on MNIST (left) and CIFAR-10 (right)
141
+
142
+ ![](images/c579bf2b3cf37f9b358f5494cc533abd1bcd6e975256427480f8283fbd348944.jpg)
143
+ Figure 2: Output of Algorithm 1 with $d _ { \mathcal { X } } = L ^ { 2 }$ for DCGAN trained on CIFAR-10
144
+
145
+ However, when we re-ran the same experiment using a DCGAN on CIFAR-10, we obtained the $W _ { L ^ { 2 } } ( \hat { A } , \hat { Y } )$ trajectories shown in Figure 2. Typical examples are shown in Figure 8. Strangely, we observe that $W _ { L ^ { 2 } } ( \hat { A } , \hat { Y } ) < W _ { L ^ { 2 } } ( \hat { X } , \hat { Y } )$ very early on in training – at around batch 500 – when the samples resemble the heavily blurry Figure 8b. This raises some obvious concerns about the appropriateness of $W _ { L ^ { 2 } }$ as a metric for GAN quality.
146
+
147
+ We therefore sought to understand this strange behaviour. Motivated by the visual blurriness of the samples in Figure 8b, we explored the effect on $W _ { L ^ { p } } ( \hat { X } , \hat { Y } )$ of blurring the CIFAR-10 training set $X$ . In particular, we let $X$ and $Y$ each consist of 10000 distinct CIFAR-10 samples in $X$ . We then independently convolved each channel of each image with a Gaussian kernel having standard deviation $\sigma$ , obtaining a blurred dataset $\beta _ { \sigma } ( X )$ and corresponding empirical distribution $\hat { \beta } _ { \sigma } ( X )$ . The visual effect of this procedure is shown in Figure 9 in the appendix. We then computed $W _ { L ^ { p } } ( \hat { \beta } _ { \sigma } ( X ) , \hat { Y } )$ with $\sigma$ ranging between 0 and 10 for a variety of values of $p$ . The results of this experiment in the case $p = 2$ are shown in Figure 3, and similar results were observed for other values of $p$ : in all cases, we found that
148
+
149
+ $$
150
+ W _ { L ^ { p } } ( \hat { X } , \hat { Y } ) > W _ { L ^ { p } } ( \hat { \beta } _ { \sigma } ( X ) , \hat { Y } )
151
+ $$
152
+
153
+ whenever $\sigma > 0$ . That is, blurring $X$ by any amount brings $\hat { X }$ closer to $\hat { Y }$ in $\boldsymbol { W } _ { L ^ { p } }$ than not. This occurs even though $X$ is distributed identically to $Y$ (both being drawn from $\pi$ ), while $\beta _ { \sigma } ( X )$ (presumably) is not when $\sigma > 0$ .
154
+
155
+ ![](images/45f392895d2f6ffc598a181c84f164d1b14ef60a793bd79e85f92972b0cf924d.jpg)
156
+ Figure 3: Effect of blurring CIFAR-10 on $W _ { L ^ { 2 } }$ (left) and $W _ { L ^ { 2 } \circ \eta }$ (right)
157
+
158
+ # 4.1.2 EMBEDDED $L ^ { 2 }$ AS GROUND METRIC
159
+
160
+ To remedy these issues, we sought to replace $L ^ { 2 }$ with a choice of $d _ { \mathcal { X } }$ that is more naturally suited to the space of images in question. To this end we tried mapping $\mathcal { X }$ through a fixed pre-trained neural network $\eta$ into a feature space $\mathcal { V }$ , and then computing distances using some metric $d _ { \mathcal { Y } }$ on $\mathcal { V }$ , rather than in $\mathcal { X }$ directly. It is easily seen that, provided $\eta$ is injective, $d _ { \mathcal { V } } \circ \eta : \mathcal { X } \times \mathcal { X } \to \mathbb { R }$ defined by
161
+
162
+ $$
163
+ ( d _ { \mathcal { V } } \circ \eta ) ( x , x ^ { \prime } ) : = d _ { \mathcal { V } } ( \eta ( x ) , \eta ( x ^ { \prime } ) )
164
+ $$
165
+
166
+ is a metric. It also holds that, when $\eta$ is $( d _ { \mathcal { X } } , d _ { \mathcal { Y } } )$ -continuous, $( \mathcal { X } , d _ { \mathcal { Y } } \circ \eta )$ is compact when $( \mathcal { X } , d _ { \mathcal { X } } )$ is: given a sequence $x _ { i } \subseteq { \mathcal { X } }$ , there exists a subsequence $x _ { i ^ { \prime } }$ that converges in $d _ { \mathcal { X } }$ to some $x$ (by compactness), so that $( d \ / y \circ \eta ) ( x _ { i ^ { \prime } } , x ) = d \ / y ( \eta ( x _ { i ^ { \prime } } ) , \eta ( x ) ) 0$ by continuity of $\eta$ . Neither of these conditions on $\eta$ – injectivity and $( d _ { \mathcal { X } } , d _ { \mathcal { Y } } )$ -continuity – are unreasonable to expect from a typical neural network trained using stochastic gradient descent (at least, when $d _ { \mathcal { X } }$ and $d _ { \mathcal { Y } }$ are typical metrics such as $L ^ { p }$ distances). Consequently, $W _ { d _ { y } \circ \eta }$ constitutes a valid metric on $\mathcal { P } _ { d _ { y } \circ \eta } ( \mathcal { X } )$ , and (4) is automatically satisfied.
167
+
168
+ To test the performance of $W _ { d y \circ \eta }$ , we repeated the blurring experiment described above. We took $\eta ( x )$ to be the result of scaling $x \in \mathcal { X }$ to size $2 2 4 \mathbf { x } 2 2 4$ , mapping the result through a DenseNet-121 (Huang et al., 2016) pre-trained on ImageNet (Deng et al., 2009), and extracting features immediately before the linear output layer. Under the same experimental setup as above otherwise, we obtained the plot of $W _ { L ^ { 2 } \circ \eta } ( \beta _ { \sigma } ( \hat { X } ) , \hat { Y } )$ shown in Figure 3. Happily, we now see that this curve increases monotonically as $\sigma$ grows in accordance with the declining visual quality of $\beta _ { \sigma } ( X )$ shown in Figure 9.
169
+
170
+ Next, we computed $W _ { L ^ { 2 } \circ \eta } ( \hat { A } , \hat { Y } )$ over the course of GAN training. For the I-WGAN we obtained the results on MNIST and CIFAR-10 shown in Figure 4;1 for the DCGAN on CIFAR-10, we obtained the curve shown in Figure 5. In all cases we see that $W _ { L ^ { 2 } \circ \eta } ( \hat { A } , \hat { Y } )$ decreases monotonically towards an asymptote in a way that accurately summarises the visual quality of the samples throughout the training run. Moreover, there is always a large gap between the eventual value of $W _ { L ^ { 2 } \circ \eta } ( \hat { A } , \hat { Y } )$ and $W _ { L ^ { 2 } \circ \eta } ( \hat { X } , \hat { Y } )$ , which reflects the fact that the GAN samples are still visually distinguishable from real $\pi$ samples. In particular, we see an improvement in this respect for the I-WGAN on MNIST: in Figure 1 the asymptotic value of $W _ { L ^ { 2 } } ( \hat { \hat { A } } , \hat { Y } )$ for MNIST was barely discernible from $W _ { L ^ { 2 } } ( \hat { X } , \hat { Y } )$ , despite the fact that it is still quite easy to tell real samples from generated ones (see e.g. the various mistakes present in Figure 6).
171
+
172
+ # 5 DISCUSSION AND FUTURE WORK
173
+
174
+ We believe our work reveals two promising avenues of future inquiry. First, we suggest that $W _ { L ^ { p } \circ \eta }$ is an appealing choice of $D$ , both due to its nice theoretical properties – it metricises weak convergence, and does not require us to make any density assumptions about $\pi$ – and due to its sound empirical performance demonstrated above. It would be very interesting to use this $D$ to produce a systematic and objective comparison of the performance of all current major GAN implementations, and indeed to use this as a metric for guiding future GAN design. We also view the test (5) as potentially useful for determining whether our algorithms are overfitting. This would be particularly so if applied via a cross-validation procedure: if we consistently observe that (5) holds when training a GAN according to many different $X$ and $Y$ partitions of our total $\pi$ samples, then it seems reasonable to infer that $\alpha ( X )$ has indeed learnt something useful about $\pi$ .
175
+
176
+ ![](images/570e844b51dbee20d95f6a30d2c3878bb1d1165315288d1f52be0133d3933878.jpg)
177
+ Figure 4: Output of Algorithm 1 with $d _ { \mathcal { X } } = L ^ { 2 } \circ \eta$ for I-WGAN trained on MNIST (left) and CIFAR-10 (right)
178
+
179
+ ![](images/852317811ce1e44b66dd32c17d799d4f81b0b3e03c4c07617a867f42293c9ab6.jpg)
180
+ Figure 5: Output of Algorithm 1 with $d _ { \mathcal { X } } = L ^ { 2 } \circ \eta$ for DCGAN trained on CIFAR-10
181
+
182
+ We also believe that the empirical inadequacy of $W _ { L ^ { 2 } }$ that we observed suggests a path towards a better WGAN architecture. At present, WGAN implementations implicitly use $W _ { L ^ { 2 } }$ for their choice of $D _ { \Gamma }$ . We suspect that altering this to our suggested $W _ { L ^ { 2 } \circ \eta }$ may yield better quality samples. We briefly give here one possible way to do so that is largely compatible with existing WGAN setups. In particular, following Arjovsky et al. (2017), we take
183
+
184
+ $$
185
+ D _ { \Gamma } ( P , Q ) = \underset { f \in \mathcal { F } } { \operatorname* { m a x } } \mathbb { E } _ { x \sim P } \left[ f ( x ) \right] - \mathbb { E } _ { x \sim Q } \left[ f ( x ) \right]
186
+ $$
187
+
188
+ for a class $\mathcal { F }$ of functions $f : \mathcal { X } \mathbb { R }$ that are all $\left( L ^ { 2 } \circ \eta , d _ { \mathbb { R } } \right)$ -Lipschitz for some fixed Lipschitz constant $K$ . Here $d _ { \mathbb { R } }$ denotes the usual distance on $\mathbb { R }$ . To optimise over such an $\mathcal { F }$ in practice, we can require our discriminator $f : \mathcal { X } \to \mathbb { R }$ to have the form ${ \bar { f } } ( x ) : = h ( \eta ( x ) )$ , where $h : \mathcal { V } \to \mathbb { R }$ is $( d _ { \mathcal { Y } } , d _ { \mathbb { R } } )$ -Lipschitz, which entails that $f$ is Lipschitz provided $\eta$ is (which is almost always the case in practice). In other words, we compute
189
+
190
+ $$
191
+ D _ { \Gamma } ( P , Q ) = \operatorname* { m a x } _ { h \in \mathcal { F } ^ { \prime } } \mathbb { E } _ { x \sim P } \left[ h ( \eta ( x ) ) \right] - \mathbb { E } _ { x \sim Q } \left[ h ( \eta ( x ) ) \right] ,
192
+ $$
193
+
194
+ where ${ \mathcal { F } } ^ { \prime }$ is a class of $( d _ { \mathcal { Y } } , d _ { \mathbb { R } } )$ -Lipschitz functions. Optimising over this objective may now proceed as usual via weight-clipping like (Arjovsky et al., 2017), or via a gradient penalty like (Gulrajani et al., 2017). Note that this suggestion may be understood as training a standard WGAN with the initial layers of the discriminator fixed to the embedding $\eta$ ; our analysis here shows that this is equivalent to optimising with respect to $W _ { L ^ { 2 } \circ \eta }$ instead of $W _ { L ^ { 2 } }$ . We have begun some experimentation in this area but leave a more detailed empirical inquiry to future work.
195
+
196
+ It is also clearly important to establish better theoretical guarantees for our method. At present, we have no guarantee that the number of samples in $A$ and $Y$ are enough to ensure that
197
+
198
+ $$
199
+ D ( \hat { A } , \hat { Y } ) \approx D ( \alpha ( X ) , \hat { Y } )
200
+ $$
201
+
202
+ (perhaps with some fixed bias that is fairly independent of $\alpha$ , so that it is valid to use the value of $D ( \hat { A } , \hat { Y } )$ to compare different choices of $\alpha$ ), or that (5) entails (2) with high probability. We do however note that some recent theoretical work on the convergence rate of empirical Wasserstein estimations (Weed & Bach, 2017) does suggest that it is plausible to hope for fast convergence of $D ( \hat { A } , \hat { Y } )$ to $D ( \alpha ( X ) , { \hat { Y } } )$ . We also believe that the convincing empirical behaviour of $W _ { L ^ { 2 } \circ \eta }$ does suggest that it is possible to say something more substantial about our approach, which we leave to future work.
203
+
204
+ # 6 RELATED WORK
205
+
206
+ The maximum mean discrepancy (MMD) is another well-known notion of distance on probability distributions, which has been used for testing whether two distributions are the same or not (Gretton et al., 2012) and also for learning generative models in the style of GAN (Li et al., 2015; Dziugaite et al., 2015; Sutherland et al., 2016; Li et al., 2017). It is parameterised by a characteristic kernel $k$ , and defines the distance between probability distributions by means of the distance of $k$ ’s reproducing kernel Hilbert space (RKHS). The MMD induces the same weak topology on distributions as the one of the Wasserstein distance. Under a mild condition, the MMD between distributions $P$ and $Q$ under a kernel $k$ can be understood as the outcome of the following two-step calculation. First, we pushforward $P$ and $Q$ from their original space $\mathcal { X }$ to a Hilbert space $\mathcal { H }$ (isomorphic to $k$ ’s RKHS) using a feature function $\phi : \mathcal { X } \to \mathcal { H }$ induced by the kernel $k$ . Typically, $\mathcal { H }$ is an infinite-dimensional space, such as the set $\ell _ { 2 }$ of square-summable sequences in ${ \mathcal { R } } ^ { \infty }$ as in Mercer’s theorem. Let $P ^ { \prime }$ and $Q ^ { \prime }$ be the resulting distributions on the feature space. Second, we compute the supremum of $\mathbb { E } _ { P ^ { \prime } ( X ) } [ f ( X ) ] - \mathbb { E } _ { Q ^ { \prime } ( X ) } [ f ( X ) ]$ over all linear 1-Lipschitz functions $f : \mathcal { H } \to \mathbb { R }$ . The result of this calculation is the MMD between $P$ and $Q$ .
207
+
208
+ This two-step calculation shows the key difference between MMD and our use of Wasserstein distance and neural embedding $\eta$ . While the co-domain of the feature function $\phi$ is an infinitedimensional space (e.g. $\ell _ { 2 }$ ) in most cases, its counterpart $\eta$ in our setting uses a finite-dimensional space as co-domain. This means that the MMD possibly uses a richer feature space than our approach. On the other hand, the MMD takes the supremum over only linear functions $f$ among all 1-Lipschitz functions, whereas the Wasserstein distance considers all these 1-Lipschitz functions. These different balancing acts between the expressiveness of features and that of functions taken in the supremum affect the learning and testing of various GAN approaches as observed experimentally in the literature. One interesting future direction is to carry out systematic study on the theoretical and practical implications of these differences.
209
+
210
+ # REFERENCES
211
+
212
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein gan. ´ arXiv preprint arXiv:1701.07875, 2017.
213
+ Sanjeev Arora and Yi Zhang. Do gans actually learn the distribution? an empirical study. arXiv preprint arXiv:1706.08224, 2017.
214
+ 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.
215
+ Ayanendranath Basu, Hiroyuki Shioya, and Chanseok Park. Statistical inference: the minimum distance approach. CRC Press, 2011.
216
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition, 2009. CVPR 2009. IEEE Conference on, pp. 248–255. IEEE, 2009.
217
+
218
+ Gintare Karolina Dziugaite, Daniel M. Roy, and Zoubin Ghahramani. Training generative neural networks via maximum mean discrepancy optimization. In Proceedings of the Thirty-First Conference on Uncertainty in Artificial Intelligence, UAI 2015, July 12-16, 2015, Amsterdam, The Netherlands, pp. 258–267, 2015.
219
+
220
+ 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.
221
+
222
+ Arthur Gretton, Karsten M. Borgwardt, Malte J. Rasch, Bernhard Scholkopf, and Alexander J.¨ Smola. A kernel two-sample test. Journal of Machine Learning Research, 13:723–773, 2012.
223
+
224
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of wasserstein gans. arXiv preprint arXiv:1704.00028, 2017.
225
+
226
+ Gao Huang, Zhuang Liu, Kilian Q Weinberger, and Laurens van der Maaten. Densely connected convolutional networks. arXiv preprint arXiv:1608.06993, 2016.
227
+
228
+ Chun-Liang Li, Wei-Cheng Chang, Yu Cheng, Yiming Yang, and Barnabas P ´ oczos. MMD GAN: ´ towards deeper understanding of moment matching network. arXiv preprint arXiv:1705.08584, 2017.
229
+
230
+ Yujia Li, Kevin Swersky, and Richard S. Zemel. Generative moment matching networks. In Proceedings of the 32nd International Conference on Machine Learning, ICML 2015, Lille, France, 6-11 July 2015, pp. 1718–1727, 2015.
231
+
232
+ 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.
233
+
234
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
235
+
236
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. In Advances in Neural Information Processing Systems, pp. 2234–2242, 2016.
237
+
238
+ Dougal J. Sutherland, Hsiao-Yu Fish Tung, Heiko Strathmann, Soumyajit De, Aaditya Ramdas, Alexander J. Smola, and Arthur Gretton. Generative models and model criticism via optimized maximum mean discrepancy. arXiv preprint arXiv:1611.04488, 2016.
239
+
240
+ Cedric Villani. ´ Topics in optimal transportation. Number 58. American Mathematical Soc., 2003.
241
+
242
+ Cedric Villani. ´ Optimal transport: old and new, volume 338. Springer Science & Business Media, 2008.
243
+
244
+ Jonathan Weed and Francis Bach. Sharp asymptotic and finite-sample rates of convergence of empirical measures in wasserstein distance. arXiv preprint arXiv:1707.00087, 2017.
245
+
246
+ Jacob Wolfowitz. The minimum distance method. The Annals of Mathematical Statistics, pp. 75–88, 1957.
247
+
248
+ A EXAMPLE I-WGAN SAMPLES
249
+
250
+ ![](images/299b991f8908ee02ee348dccccbb828ad8fbf9b2fe032078582a7571aa052396.jpg)
251
+ Figure 6: Samples from I-WGAN trained on MNIST
252
+
253
+ ![](images/065b6587704900cb66c309c2e9ca20f09a0a7d9d4494f91a33ebe8b5024c26b7.jpg)
254
+ Figure 7: Samples from I-WGAN trained on CIFAR-10
255
+
256
+ B EXAMPLE DCGAN SAMPLES
257
+
258
+ ![](images/b16a225d78db6b6de2a7cb0b97ef2efaa0d11a8461afc63ce1f1e2360a25339b.jpg)
259
+ Figure 8: Samples from DCGAN trained on CIFAR-10 test set
260
+
261
+ ![](images/914e843c27d498e9477ae0e3631b8a88f4623f1ce1a32b22549f33ca9bb534c5.jpg)
262
+ Figure 9: Effect of different $\sigma$ on $\beta _ { \sigma } ( X )$ , for $X$ the CIFAR-10 training set
md/train/C4-QQ1EHNcI/C4-QQ1EHNcI.md ADDED
@@ -0,0 +1,511 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EXPRESSIVE YET TRACTABLE BAYESIAN DEEP LEARNING VIA SUBNETWORK INFERENCE
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The Bayesian paradigm has the potential to solve some of the core issues in modern deep learning, such as poor calibration, data inefficiency, and catastrophic forgetting. However, scaling Bayesian inference to the high-dimensional parameter spaces of deep neural networks requires restrictive approximations. In this paper, we propose performing inference over only a small subset of the model parameters while keeping all others as point estimates. This enables us to use expressive posterior approximations that would otherwise be intractable for the full model. In particular, we develop a practical and scalable Bayesian deep learning method that first trains a point estimate, and then infers a full covariance Gaussian posterior approximation over a subnetwork. We propose a subnetwork selection procedure which aims to maximally preserve posterior uncertainty. We empirically demonstrate the effectiveness of our approach compared to point-estimated networks and methods that use less expressive posterior approximations over the full network.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep neural networks (DNNs) still suffer from critical shortcomings that make them unfit for important applications. For instance, DNNs tend to be poorly calibrated and overconfident in their predictions, especially when there is a shift in the train and test distributions (Nguyen et al., 2015; Guo et al., 2017). To reliably inform decision making, DNNs must be able to robustly quantify the uncertainty in their predictions, which is particularly important in safety-critical areas such as healthcare or autonomous driving (Amodei et al., 2016; Filos et al., 2019a; Fridman et al., 2019).
12
+
13
+ Bayesian modeling (Ghahramani, 2015; Gal, 2016) presents a principled way to capture predictive uncertainty via the posterior distribution over model parameters. Unfortunately, due to their nonlinearities, exact posterior inference is intractable in DNNs. Despite recent successes in the field of Bayesian deep learning (Blundell et al., 2015; Gal & Ghahramani, 2016; Osawa et al., 2019; Maddox et al., 2019; Dusenberry et al., 2020), existing methods are only made scalable to modern DNNs with large numbers of parameters by invoking unrealistic assumptions. This severely limits the expressiveness of the inferred posterior and thus deteriorates the quality of the induced uncertainty estimates (Ovadia et al., 2019; Fort et al., 2019; Foong et al., 2019a; Ashukha et al., 2020a).
14
+
15
+ Due to the heavy overparameterization of DNNs, their accuracy is well-preserved by a small subnetwork (Cheng et al., 2017). Additionally, recent work by Izmailov et al. (2019) has shown how performing inference over a low dimensional subspace of the weights can result in accurate uncertainty quantification. These observations prompt the following question for a DNN’s uncertainty: Can a full DNN’s model uncertainty be well-preserved by a small subnetwork’s model uncertainty? We answer this question in the affirmative. We show both theoretically and empirically that the full network posterior can be well represented by a subnetwork’s posterior. As a result, we can use more expensive but faithful posterior approximations over just that subnetwork. We show that this achieves better uncertainty quantification than if we use cheaper, but more crude, posterior approximations over the full network.
16
+
17
+ The contributions of this paper are as follows:
18
+
19
+ 1. We propose a new Bayesian deep learning approach that performs Bayesian inference over only a small subset of the model weights and keeps all other weights deterministic. This allows us to use expressive posterior approximations that are typically intractable in DNNs.
20
+
21
+ ![](images/69ba0d7682cd0284507b2c8b65f0296f13b556dfc570af6f9e27b927c22c918d.jpg)
22
+ Figure 1: Schematic illustration of our proposed approach. (a) We train a neural network using standard techniques to obtain a point estimate of the weights. (b) We identify a small subset of the weights. (c) We estimate a posterior distribution over the selected subnetwork via Bayesian inference techniques. (d) We make predictions using the full network of mixed Bayesian/deterministic weights.
23
+
24
+ 2. As a concrete instantiation of this framework, we develop a practical and scalable Bayesian deep learning method that uses the linearized Laplace approximation to infer a fullcovariance Gaussian posterior over a subnetwork within a point-estimated neural network.
25
+ 3. We formally characterize the discrepancy between the posterior distributions over a subnetwork and the full network (in terms of their Wasserstein distance) in the linearized model, and derive a theoretically motivated strategy to select a subnetwork that minimizes this discrepancy under certain assumptions.
26
+ 4. We empirically show, on various benchmarks, that our method compares favourably against point-estimated networks and other Bayesian deep learning methods, experimentally confirming that expressive subnetwork inference is superior to crude inference over full networks.
27
+
28
+ # 2 SUBNETWORK POSTERIOR APPROXIMATION
29
+
30
+ Bayesian neural networks (BNNs) aim to capture model uncertainty, i.e., uncertainty about the choice of weights $W$ which arises due to multiple plausible explanations of the training data $\{ y , X \}$ . Here, $\textbf { { y } }$ is the dependent variable (e.g. classification label) and $\boldsymbol { X }$ is the feature matrix. A prior distribution $p ( \mathbf { W } )$ is specified over the BNN’s weights. We wish to infer their full posterior distribution
31
+
32
+ $$
33
+ \begin{array} { r l r } { p ( { \bf W } | { \bf y } , { \pmb X } ) } & { \propto } & { p ( { \pmb y } | { \pmb X } , { \bf W } ) p ( { \bf W } ) . } \end{array}
34
+ $$
35
+
36
+ To make predictions, we then estimate the posterior predictive distribution that averages the network’s predictions across all possible settings of the weights, weighted by their posterior probability, i.e.
37
+
38
+ $$
39
+ p ( { \mathbf { y } ^ { * } } | X ^ { * } , y , X ) = \int _ { \mathbf { W } } p ( { \mathbf { y } ^ { * } } | X ^ { * } , \mathbf { W } ) p ( \mathbf { W } | y , X ) d \mathbf { W } .
40
+ $$
41
+
42
+ Unfortunately, due to the size of modern deep neural networks, it is not only intractable to infer the exact posterior distribution $p ( \mathbf { W } | \mathbf { \boldsymbol { y } } , X )$ in Eq. (1), but it is even computationally challenging to properly approximate it. As a consequence, crude posterior approximations such as complete factorization are commonly employed (Blundell et al., 2015; Hernandez-Lobato & Adams, 2015; ´ Kingma et al., 2015; Khan et al., 2018; Osawa et al., 2019), i.e. $\begin{array} { r } { p ( \mathbf { W } | \pmb { y } , \pmb { X } ) \approx \prod _ { d = 1 } ^ { D } q ( \mathbf { w } _ { d } ) } \end{array}$ where $\mathbf { W } _ { d }$ denotes the $d$ -th weight in the $D$ -dimensional neural network weight vector $\mathbf { W _ { \lambda } } \in \mathbb { R } ^ { D }$ (the concatenation and flattening of all layers’ weight matrices). Clearly, this is a very wishful assumption; In practise, it suffers from severe pathologies (Foong et al., 2019a;b).
43
+
44
+ In this work, we question the implicit assumption that a good posterior approximation needs to include all BNN parameters. Instead, we aim to perform inference only over a small subset of the weights. This approach is well-motivated for two reasons:
45
+
46
+ 1. Overparameterization: Maddox et al. (2020) have shown that, in the neighborhood of local optima, there are many directions that leave the NN’s predictions unchanged. Moreover, NNs can be heavily pruned without sacrificing test-set accuracy (Frankle & Carbin, 2019). Thus, the majority of a NN’s predictive power might be isolated to a small subnetwork.
47
+
48
+ 2. Inference over submodels: Previous work1 has provided evidence that inference can be effective even when not done on the full parameter space. Izmailov et al. (2019) performed inference over a low-dimensional projection of the weights. Neural-linear models, which give a Bayesian treatment to only the last layer of a DNN, have shown to be competitive with full-network approaches (Riquelme et al., 2018; Ober & Rasmussen, 2019).
49
+
50
+ We thus combine these ideas, making the following two-step approximation of the posterior in Eq. (1):
51
+
52
+ $$
53
+ p ( \mathbf { W } | \pmb { y } , \pmb { X } ) \ \approx \ p ( \mathbf { W } _ { S } | \pmb { y } , \pmb { X } ) \prod _ { r } \delta ( \mathbf { w } _ { r } - \mathbf { w } _ { r } ^ { * } ) \ \approx \ q ( \mathbf { W } _ { S } ) \prod _ { r } \delta ( \mathbf { w } _ { r } - \mathbf { w } _ { r } ^ { * } ) .
54
+ $$
55
+
56
+ The first approximation decomposes the full neural network posterior $p ( \mathbf { W } | \mathbf { \boldsymbol { y } } , X )$ into a posterior $p ( \mathbf { W } _ { S } | \pmb { y } , \pmb { X } )$ over the subnetwork $\mathbf { W } _ { S }$ and delta functions $\delta \big ( \mathbf { w } _ { r } - \mathbf { w } _ { r } ^ { * } \big )$ over all remaining weights $\left\{ \mathbf { w } _ { r } \right\} _ { r }$ , keeping them at fixed values $\mathbf { w } _ { r } ^ { * } \in \mathbb { R }$ . This can be viewed as pruning the variances of the weights $\left\{ \mathbf { w } _ { r } \right\} _ { r }$ to zero, which is in contrast to ordinary weight pruning methods that set the weights $\left\{ \mathbf { w } _ { r } \right\} _ { r }$ themselves to zero. The second approximation is a result of posterior inference over the subnetwork still being intractable. In turn, we introduce the approximate distribution $q ( \mathbf { W } _ { S } )$ . Yet, as the subnetwork is much smaller than the full network, we can afford to make $q ( \mathbf { W } _ { S } )$ expressive and able to capture rich dependencies across the weights within the subnetwork.
57
+
58
+ # 3 SUBNETWORK INFERENCE VIA LAPLACE APPROXIMATION
59
+
60
+ To obtain a method that is as practical as possible, we propose to use inference techniques that can estimate a posterior distribution post-hoc from a point-estimated network. The Laplace approximation (MacKay, 1992) is well-suited to this task as it derives the approximate posterior from the local optimization landscape. Other inference procedures, such as SWAG (Maddox et al., 2019), could also be used. Nevertheless, we focus on Laplace due to it being a well-studied, fundamental technique.
61
+
62
+ Step #1: Point Estimation. The first step of the procedure is to train a neural network to obtain a point estimate of the weights, denoted $W _ { M A P }$ . This estimate should respect the Bayesian model given in Eq. (1), and therefore we optimize the maximum $a$ -posteriori (MAP) objective:
63
+
64
+ $$
65
+ \begin{array} { r } { { \cal W } _ { M A P } = \arg \operatorname* { m a x } _ { W } \left[ \log p ( { \bf y } | X , W ) + \log p ( W ) \right] . } \end{array}
66
+ $$
67
+
68
+ This can be done using standard stochastic gradient-based optimization methods commonly-used in modern deep learning (Goodfellow et al., 2016). This step is illustrated in Fig. 1 (a).
69
+
70
+ Step #2: Subnetwork Selection. The second step is to identify a small subnetwork $W _ { S }$ . Ideally, we would like to identify the subnetwork whose posterior is ‘closest’ to the full-network posterior. We formalize this argument in Section 4 and describe a principled strategy that, under certain conditions, minimizes the 2-Wasserstein distance between the sub- and full-network posteriors. All other weights not belonging to that subnetwork are then assigned fixed values: the MAP estimates obtained in Step #1. See Fig. 1 (b) for an illustration of this step.
71
+
72
+ Step #3: Bayesian Inference. Given the subnetwork point estimate $W _ { M A P } ^ { S }$ , we use the Laplace approximation to infer a full-covariance Gaussian posterior distribution over the subnetwork $\mathbf { W } _ { S }$ :
73
+
74
+ $$
75
+ p ( \mathbf { W } _ { S } | \mathbf { \boldsymbol { y } } , \boldsymbol { X } ) \approx \ q ( \mathbf { W } _ { S } ) \ = \ N \left( \mathbf { W } _ { S } ; \mathbf { \boldsymbol { W } } _ { M A P } ^ { S } , H ^ { - 1 } \right)
76
+ $$
77
+
78
+ where the posterior covariance matrix $H ^ { - 1 } \in \mathbb { R } ^ { D \times D }$ corresponds to the inverse of the average Hessian of the negative log posterior, i.e. $H = N \mathbb { E } \left[ - \partial ^ { 2 } \log \hat { p } ( \mathbf { y } | X , W ) / \partial W ^ { 2 } \right] + \lambda I$ . Here, the expectation is w.r.t. the data generating distribution and $\lambda$ is the precision of a zero-mean factorized Gaussian prior $p ( \mathbf { W } ) = \tilde { \mathcal { N } } ( \mathbf { W } ; \mathbf { 0 } , \lambda ^ { \top } I )$ . In practice, we approximate the Hessian $H$ with the generalized Gauss-Newton (GGN) matrix $\widetilde { H }$ (Schraudolph, 2002), i.e.
79
+
80
+ $$
81
+ \widetilde { H } = \sum _ { n = 1 } ^ { N } J _ { n } ^ { \top } H _ { n } J _ { n } + \lambda I , \mathrm { w i t h } J _ { n } = \frac { \partial f ( x _ { n } , W ) } { \partial W } \mathrm { a n d } H _ { n } = \frac { \partial ^ { 2 } L ( y _ { n } , f ( x _ { n } , W ) ) } { \partial ^ { 2 } f ( x _ { n } , W ) }
82
+ $$
83
+
84
+ where $J _ { n } \in \mathbb { R } ^ { O \times D }$ is the Jacobian of the neural network features $\pmb { f } ( \pmb { x } _ { n } , \pmb { W } ) \in \mathbb { R } ^ { O }$ w.r.t. the weights $W$ , and $\pmb { H } _ { n } \in \mathbb { R } ^ { O \times O }$ is the Hessian of the loss $L ( { \pmb y } _ { n } , { \pmb f } ( { \pmb x } _ { n } , { \pmb W } ) )$ w.r.t. the features $\mathbf { { \mathit { f } } } ( \mathbf { { \mathit { x } } } _ { n } , W )$ .The GGN $\widetilde { H }$ has clear practical advantages over the Hessian $H$ ; see Martens $\&$ Sutskever (2011) and Martens (2016). Using the Laplace approximation with the GGN Hessian can be viewed as an implicit local linearization of the underlying neural network $\mathbf { \Delta } f ( \mathbf { \Delta } x , W )$ at its MAP estimate $W _ { M A P }$ ,
85
+
86
+ $$
87
+ f _ { l i n } ^ { M A P } ( { \pmb x } , { \pmb W } ) = { \pmb f } ( { \pmb x } , { \pmb W } _ { M A P } ) + J _ { { \pmb W } _ { M A P } } ( { \pmb x } ) ( { \pmb W } - { \pmb W } _ { M A P } )
88
+ $$
89
+
90
+ where $J _ { W _ { M A P } } ( \pmb { x } ) = \partial \pmb { f } ( \pmb { x } , \pmb { W } _ { M A P } ) / \partial \pmb { W } _ { M A P } \in \mathbb { R } ^ { O \times D }$ (Immer et al., 2020). Note that the model in Eq. (7) is linear in $W$ , as only the term $J _ { W _ { M A P } } ( { \pmb x } ) { \pmb W }$ depends linearly on $W$ , while the other terms are constant w.r.t. $W$ and can thus be subsumed into an additive bias term (Khan et al., 2019). The GGN approximation thus locally turns the underlying probabilistic model from a Bayesian neural network into a (generalized) linear model, with basis function expansion $J _ { W _ { M A P } } ( { \pmb x } )$ of covariate $_ { \textbf { \em x } }$ (Immer et al., 2020). Put differently, linearized Laplace in the neural network $\mathbf { \Delta } f ( \mathbf { \Delta } x , W )$ is equivalent to ordinary Laplace in the linear model $\pmb { f } _ { l i n } ^ { M A P } ( \pmb { x } , \pmb { W } )$ in Eq. (7), as the GGN $\widetilde { H }$ corresponding to in Eq. (6) is equivalent to the Hessian 9). This is a useful property that will $H$ corresponding to ow us to derive a $\pmb { f } _ { l i n } ^ { M A P } ( \pmb { x } , \pmb { W } )$ in Eq. (7) (Khanetwork selection strategy in Section 4. This step is illustrated in Fig. 1 (c). We emphasize that this whole procedure (i.e. Steps #1-#3) is a perfectly valid mixed inference strategy, performing full Laplace inference over the selected subnetwork and MAP inference over all remaining weights.
91
+
92
+ Step #4: Prediction. Given the linearized Laplace approximation over the subnetwork $\mathbf { W } _ { S }$ in Eqs. (5) and (6), i.e. $q ( \mathbf { W } _ { S } ) = \mathcal { N } ( \mathbf { W } _ { S } ; { W _ { M A P } ^ { S } } , \mathbf { \widetilde { H } } ^ { - 1 } )$ , we can then compute the posterior predictive distribution. While, traditionally, one would compute the predictive distribution using the original Bayesian neural network likelihood, i.e. $p ( \mathbf { y } | X , \bar { \mathbf { W } } ) = p ( \bar { \mathbf { y } } | f ( \mathbf { x } , W ) )$ , Immer et al. (2020) recently suggested that, since inference was (implicitly) done in the GGpled to instead predict using the linearized likelihood Eq. (7), i.e. $p ( \mathbf { y } \vert X , \mathbf { W } ) = p ( \mathbf { y } \vert \pmb { f } _ { l i n } ^ { M A P } ( \pmb { \dot { x } } , \pmb { W } ) )$ -. This provides a formal justification for the empirical superiority of this approach observed previously (Lawrence, 2001; Foong et al., 2019b). We thus obtain the linearized predictive distribution
93
+
94
+ $$
95
+ p ( \mathbf { y } ^ { * } | \boldsymbol { X } ^ { * } , \boldsymbol { y } , \boldsymbol { X } ) \approx \int _ { \mathbf { W } } p ( \mathbf { y } ^ { * } | f _ { l i n } ^ { M A P } ( \boldsymbol { X } ^ { * } , \boldsymbol { W } ) ) \mathcal { N } ( \mathbf { W } _ { S } ; \boldsymbol { W } _ { M A P } ^ { S } , \tilde { H } ^ { - 1 } ) \prod _ { r } \delta ( \mathbf { w } _ { r } - \mathbf { w } _ { r } ^ { * } ) d \mathbf { W } .
96
+ $$
97
+
98
+ There are two ways to compute Eq. (8): Firstly, via a Monte Carlo approximation $p ( \mathbf { y } ^ { * } | X ^ { * } , y , X ) \simeq$ $\begin{array} { r } { \frac { 1 } { M } \sum _ { m = 1 } ^ { M } p ( \mathbf { y } ^ { * } | \pmb { f } _ { l i n } ^ { M A P } ( \pmb { X } ^ { * } , \widetilde { W } _ { m } ) ) } \end{array}$ by sampling $\widetilde { W } _ { m }$ from $\mathcal { N } ( W _ { M A P } ^ { S } , \widetilde { H } ^ { - 1 } )$ and $\begin{array} { r } { \prod _ { r } \delta ( \mathbf { w } _ { r } - \mathbf { w } _ { r } ^ { * } ) } \end{array}$ , M m=1 | lin f f N MAP e r − the latter of which is trivial. Secondly, due to linearity of p(y∗|f MAPlin (X∗, W )), there are closed- form expressions which are exact for Gaussian likelihoods (i.e. regression) and approximate for categorical ones (i.e. classification) (Bishop, 2006; Gibbs, 1998). This step is illustrated in Fig. 1 (d).
99
+
100
+ # 4 PRINCIPLED SUBNETWORK SELECTION FOR LINEAR(IZED) MODELS
101
+
102
+ We next analyze the subnetwork inference procedure described in Section 3 for the case of a generalized linear model (GLM) (Nelder & Baker, 1972), which models the expected response $y _ { n }$ given the basis function expansion of the covariates $\phi _ { n } = \phi ( { \mathbf { { x } } } _ { n } )$ as
103
+
104
+ $$
105
+ \mathbb { E } [ y _ { n } | \phi _ { n } ] = g ^ { - 1 } ( \mathbf { w } ^ { T } \phi _ { n } ) .
106
+ $$
107
+
108
+ Here, $\mathbf { w } \in \mathbb { R } ^ { D }$ is the vector of model parameters (which subsumes a scalar bias $\beta _ { 0 }$ for notational convenience) and $g ^ { - 1 } ( \cdot )$ denotes a link function such that $g ^ { - 1 } : \mathbb { R } \mapsto \mu _ { y | \phi }$ . In particular, we consider a Bayesian GLM, by specifying a prior distribution $p ( \mathbf { w } )$ over model parameters and aiming to infer the posterior distribution $p ( \mathbf { w } | \mathbf { y } , \pmb { \Phi } ) \propto p ( \mathbf { y } | \pmb { \Phi } , \mathbf { w } ) p ( \mathbf { w } )$ , where $\begin{array} { r } { \pmb { \Phi } = [ \phi _ { 1 } , \dots \phi _ { N } ] ^ { T } } \end{array}$ .
109
+
110
+ 1. Point Estimation. Obtain the MAP estimate, $\begin{array} { r } { \mathbf { w } _ { M A P } = \arg \operatorname* { m a x } _ { \mathbf { w } } \log p ( \pmb { y } | \Phi , \mathbf { w } ) + \log p ( \mathbf { w } ) } \end{array}$ . For commonly-used link functions (e.g. the identity in case of a Gaussian likelihood for regression, or the sigmoid/softmax function in case of a categorical likelihood for classification) and commonly-used priors (e.g. a Gaussian), the log-posterior $\propto \log p ( \pmb { y } | \pmb { \Phi } , \mathbf { w } ) + \log p ( \mathbf { w } )$ is concave. This allows for simple gradient-based MAP optimisation. It also makes a full-covariance Gaussian, estimated via Laplace, a faithful approximation to the true, uni-modal posterior, i.e.
111
+
112
+ $$
113
+ p ( \mathbf { w } | \mathbf { y } , \boldsymbol { \Phi } ) \approx \widetilde { p } ( \mathbf { w } | \mathbf { y } , \boldsymbol { \Phi } ) = \mathcal { N } ( \mathbf { w } ; \mathbf { w } _ { M A P } , H ^ { - 1 } )
114
+ $$
115
+
116
+ where $H$ is the Hessian defined in Section 3. Note that for the GLM we consider, the Hessian $H$ is equivalent to the GGN $\widetilde { H }$ defined in Eq. (6), meaning that an ordinary Laplace approximation is equivalent to a linearized Laplace approximation (Martens, 2016). For the case of an identity link function (i.e. a Gaussian likelihood with noise variance $\sigma _ { 0 } ^ { 2 }$ ) and a Gaussian prior w $\sim \mathcal { N } ( \mathbf { 0 } , \mathbf { \dot { N } } _ { 0 } ^ { - 1 } )$ , the MAP estimate even has a closed-form expression, $\begin{array} { r } { { \bf w } _ { M A P } = ( \Phi ^ { T } \Phi + \sigma _ { 0 } ^ { 2 } \Lambda _ { 0 } ) ^ { - 1 } \Phi ^ { T } { \pmb y } . } \end{array}$ . Here, the Laplace approximation in Eq. (10) exactly corresponds to the true posterior, i.e. $\widetilde { p } ( \mathbf { w } | \mathbf { y } , \Phi ) =$ $p ( \mathbf { w } | \mathbf { y } , \Phi )$ . We will thus refer to the posterior $\widetilde { p } ( \mathbf { w } | \mathbf { y } , \Phi )$ e in Eq. (10) as the full posterior.
117
+
118
+ 2. Subnetwork Selection. Select a subset of $S$ model weights via a method of choice, yielding a binary vector $\pmb { m } \in \mathbb { R } ^ { D }$ where $m _ { d } = 1$ if the $d$ -th weight is part of the subset, and $m _ { d } = 0$ otherwise. For convenience, we define the binary mask matrix $\mathbf { M } _ { S } = \pmb { m } \pmb { m } ^ { \top } \in \mathbb { R } ^ { D \times D }$ which contains 1s in the rows/columns corresponding to the $S$ subnetwork weights2, and 0s otherwise.
119
+
120
+ 3. Bayesian Inference. Compute the posterior over the subnetwork via a Laplace approximation:
121
+
122
+ $$
123
+ p _ { S } ( \mathbf { w } | \pmb { y } , \pmb { \Phi } ) = \mathcal { N } ( \mathbf { w } ; \mathbf { w } _ { M A P } , M _ { S } \odot H ^ { - 1 } ) \ .
124
+ $$
125
+
126
+ Firstly, note that the mean of the subnetwork posterior in Eq. (11) is the MAP estimate $\mathbf { w } _ { M A P }$ and thus equal to the mean of the full posterior $\widetilde { p } ( \mathbf { w } | \mathbf { y } , \Phi )$ in Eq. (10). Secondly, note that the ecovariance matrix of the subnetwork posterior in Eq. (11) is the element-wise product $M _ { S } \odot H ^ { - 1 }$ , which masks the (co-)variances of all weights not belonging to the subnetwork to zero, effectively making them deterministic. More precisely, the subnetwork covariance matrix, $M _ { S } \odot H ^ { - 1 }$ , is a $D \times D$ matrix that is equal to the full posterior covariance matrix $H ^ { - 1 }$ in the rows/columns of the $S$ weights in the subnetwork, and zero in the rows/columns of all other $D - S$ weights.
127
+
128
+ We consider what we term the posterior gap—the Wasserstein distance3 (in particular the squared 2-Wasserstein distance) between the posterior distribution over the full network and the posterior distribution over the subnetwork. The proofs for all results below will be presented in Appendix A.
129
+
130
+ Proposition 1 (Posterior Gap). For a subnetwork of size $S < D$ , the Wasserstein gap between the full posterior $\widetilde { p } ( \mathbf { w } | \mathbf { y } , \Phi )$ in Eq. (10) and the subnetwork posterior $p _ { \mathrm { S } } ( { \bf w } | { \pmb y } , { \pmb \Phi } )$ in Eq. (11) is:
131
+
132
+ $$
133
+ \begin{array} { r } { W \left[ \widetilde { p } ( \mathbf { w } | y , \Phi ) \mid | p _ { \mathrm { S } } ( \mathbf { w } | y , \Phi ) \right] = \sum _ { d = 1 } ^ { D } \left( 1 + m _ { d d } \right) \sigma _ { d } ^ { 2 } - \mathrm { t r a c e } ( 2 ( H ^ { - 1 } ( M _ { S } \odot H ^ { - 1 } ) ) ^ { 1 / 2 } ) . } \end{array}
134
+ $$
135
+
136
+ The optimal subnetwork should then minimize the posterior gap in Eq. (12). However, for full covariance matrices $H ^ { - 1 }$ and a large number of weights $D$ , this will generally be infeasible as Eq. (12) depends on all entries of the $D \times D$ -matrix $H ^ { - 1 }$ , which is intractable to compute/store. To derive a practical subnetwork selection strategy, we assume the covariance matrix to be diagonal.
137
+
138
+ Corollary 1.1 (Optimality of Maximum Variance Subnetwork Selection under Decorrelation). For $a$ generalized linear model with posterior covariance matrix $H ^ { - 1 } = d i a g ( \sigma _ { 1 } ^ { 2 } , . . . , \sigma _ { D } ^ { 2 } )$ , the optimal subnetwork under the Wasserstein gap is comprised of the $S$ weights with the largest variances $\sigma _ { d } ^ { 2 }$ .
139
+
140
+ Finally, since a GGN-linearized neural network, as in Eq. (7), corresponds to a GLM with basis expansion $\phi _ { n } = J _ { W _ { M A P } } ( \pmb { x } _ { n } ) = \partial \pmb { f } ( \pmb { x } _ { n } , \pmb { W } _ { M A P } ) / \partial W _ { M A P }$ (see Step #3 in Section 3), Corollary 1.1 implies that under decorrelation, the optimal subnetwork comprises of the weights with the largest variances. In practice, even just computing the diagonal of the covariance matrix is challenging, so we use a diagonal Laplace approximation which instead computes the inverse of the diagonal of the GGN (see e.g. Ritter et al. (2018)). Finally, note that we only have to make the decorrelation assumption for the purposes of subnetwork selection – when doing posterior inference over the selected subnetwork, we estimate a full covariance matrix for maximal expressiveness, as described in Step #3 in Section 3. In our experiments in Section 5, we empirically show that making the decorrelation assumption for subnetwork selection but then using a full-covariance Gaussian for inference performs significantly better than directly making the decorrelation assumption for inference (e.g. mean-field variational inference, diagonal Laplace).
141
+
142
+ # 5 EMPIRICAL ANALYSIS
143
+
144
+ We empirically assess the effectiveness of subnetwork inference compared to point-estimated NNs and methods that do less expressive inference over the full network. We consider three tasks: 1) small-scale toy regression, 2) medium-scale tabular regression, and 3) large-scale image classification.
145
+
146
+ ![](images/348c77967767ca7b767128552cfde1a6eab11fff719d21ab1885ac59de9d2e18.jpg)
147
+ Figure 2: Predictive distributions (mean $\pm$ std) for 1D regression. The numbers in brackets denote the number of parameters over which inference was done (out of 2600 in total). Wasserstein-based subnetwork inference maintains richer predictive uncertainties at smaller parameter counts.
148
+
149
+ # 5.1 HOW DOES SUBNETWORK INFERENCE RETAIN POSTERIOR PREDICTIVE UNCERTAINTY?
150
+
151
+ We first assess how the predictive distribution of a full-covariance Gaussian posterior over a selected subnetwork qualitatively compares to that obtained from 1) a full-covariance Gaussian over the full network (Full Cov), 2) a factorised Gaussian posterior over the full network (Diag), 3) a fullcovariance Gaussian over only the (Final layer) of the network (Kristiadi et al., 2020), and 4) a point estimate $( M A P )$ . For subnetwork inference, we consider both Wasserstein (Wass) (as described in Section 4) and uniform random subnetwork selection (Rand) to obtain subnetworks that comprise of only $50 \%$ , $3 \%$ and $1 \%$ of the model parameters. Note that while for this toy example, we could in principle use the full covariance matrix for the purpose of subnetwork selection, we still just use its diagonal (as described in Section 4) for consistency. Our NN consists of 2 ReLU hidden layers with 50 hidden units each. We employ a homoscedastic Gaussian likelihood function where the noise variance is optimised with maximum likelihood. We use GGN Laplace inference over network weights (not biases) in combination with the linearized predictive distribution in Eq. (8). Thus, all approaches considered share their predictive mean, allowing us to better compare their uncertainty estimates. All approaches share a single prior precision of $\lambda = 3$ .
152
+
153
+ We use a synthetic 1D regression task with two separated clusters of inputs (Antoran et al., 2020), ´ allowing us to probe for ‘in-between’ uncertainty (Foong et al., 2019b). Results are shown in Fig. 2. Subnetwork inference preserves more of the uncertainty of full network inference than diagonal Gaussian or final layer inference while doing inference over fewer weights. By capturing weight correlations, subnetwork inference retains uncertainty in between clusters of data. This is true for both random and Wasserstein subnetwork selection. However, the latter preserves more uncertainty with smaller subnetworks. Finally, the strong superiority to diagonal Laplace shows that making a diagonal assumption for subnetwork selection but then using a full-covariance Gaussian for inference (as we do) performs much signficantly better than making a diagonal assumption for the inferered posterior directly. These results suggest that expressive inference over a carefully selected subnetwork retains more predictive uncertainty than crude approximations over the full network.
154
+
155
+ 5.2 SUBNETWORK INFERENCE IN LARGE MODELS VS FULL INFERENCE OVER SMALL MODELS
156
+
157
+ Secondly, we study the following natural question: “Why should one use subnetwork inference in a large model when one can just perform full network inference over a smaller model?” We explore this by considering 4 fully connected models of increasing size. These have numbers of hidden layers $h _ { d } = \{ 1 , 2 \}$ and hidden layer widths ${ w _ { d } } \mathrm { { = } } \{ 5 0 , 1 0 0 \}$ . For a dataset with input dimension $i _ { d }$ , the number of weights is given by $D { = } ( i _ { d } { + } 1 ) w _ { d } { + } ( h _ { d } { - } 1 ) w _ { d } ^ { 2 }$ . Our 2 hidden layer, 100 hidden unit models have a weight count of the order $1 0 ^ { 4 }$ . Full covariance inference in these models borders the limit of computational tractability on commercial hardware. We first obtain a MAP estimate of each model’s weights and our homoscedastic likelihood function’s noise variance. We then perform full network GGN Laplace inference for each model. We also use our proposed Wassertein rule to prune every network’s weight variances such that the number of variances that remain matches the size of every smaller network under consideration. In all cases, we employ the linearized predictive in Eq. (7). Consequently, networks with the same number of weights make the same mean predictions. Increasing the number of weight variances considered will thus only increase predictive uncertainty.
158
+
159
+ ![](images/66c302f1bb14b542bd24077fff89bad6dabe0c7a84ec71a09c89a80dccf32d61.jpg)
160
+ Figure 3: Mean test log-likelihood values obtained on UCI datasets across all splits. Different markers indicate models with different numbers of weights. The horizontal axis indicates the number of weights over which full covariance inference is performed. 0 corresponds to MAP parameter estimation, and the rightmost setting for each marker corresponds to full network inference.
161
+
162
+ We employ 3 tabular datasets of increasing size (input dimensionality, n. points): wine (11, 1439), kin8nm (8, 7373) and protein (9, 41157). We consider their standard train-test splits (Hernandez- ´ Lobato & Adams, 2015) and their gap variants (Foong et al., 2019b), designed to test for out-ofdistribution uncertainty. Details are provided in Appendix C.4. For each split, we set aside $1 5 \%$ of the train data as a validation set. We use these for early stopping when finding MAP estimates and for selecting the weights’ prior precision. We keep other hyperparameters fixed across all models and datasets. Results are in Fig. 3.
163
+
164
+ We present mean test log-likelihood (LL) values, as these take into account both accuracy and uncertainty. Larger models tend to perform better when doing MAP inference, with wine-gap and protein-gap being exceptions. We also find larger models improve over their respective MAP LLs more than small ones when performing approximate inference over the same numbers of weights. We conjecture this is due to an abundance of degenerate directions (weights) in the weight posterior of all models (Maddox et al., 2020). Full network inference in small models captures information about both useful and non-useful weights. In larger models, our subnetwork selection strategy allows us to dedicate a larger proportion of our resources to modelling informative weight variances and covariances. In 3 out of 6 datasets, we find abrupt increases in LL as we increase the number of weights over which we perform inference, followed by a plateau. Such plateaus might be explained by all of the most informative weight variances having already been accounted for. These results suggest that, given the same amount of compute, larger models benefit more from subnetwork inference than small ones.
165
+
166
+ # 5.3 SCALING TO IMAGE CLASSIFICATION WITH DISTRIBUTION SHIFT
167
+
168
+ We now assess the robustness of large convolutional neural networks with subnetwork inference to distribution shift on image classification tasks compared to the following baselines: point-estimated networks (MAP), Bayesian deep learning methods that do less expressive inference over the full network: MC Dropout (Gal & Ghahramani, 2016), diagonal Laplace, VOGN (Osawa et al., 2019) (all of which assume factorisation of the weight posterior), and SWAG (Maddox et al., 2019) (which assumes a diagonal plus low-rank posterior). We also benchmark deep ensembles (Lakshminarayanan et al., 2017). The latter is considered state-of-the-art for uncertainty quantification in deep learning (Ovadia et al., 2019; Ashukha et al., 2020a). We use ensembles of 5 DNNs, as suggested by (Ovadia et al., 2019), and 16 samples for MC Dropout, diagonal Laplace and SWAG. We use a Dropout probability of 0.1 and a prior precision of $\lambda = 4 0 , 0 0 0$ for diagonal Laplace, found via grid search. We apply all approaches to ResNet-18 (He et al., 2016), which is composed of an input convolutional block, 8 residual blocks and a linear layer, for a total of 11,168,000 parameters. For subnetwork inference, we compute the linearized predictive distribution in Eq. (8) via the closed-form approximation for integrals between Gaussians and multi-class cross-entropy likelihoods described in (Gibbs, 1998). We use Wasserstein subnetwork selection to retain only $0 . 3 8 \%$ of the weights, yielding a subnetwork with only 42,438 weights. This is the largest subnetwork for which we can tractably compute a full covariance matrix. Its size is 42 $, 4 3 8 ^ { 2 } \times \hat { 4 }$ Bytes $\approx 7 . 2$ GB. We use a prior precision of $\lambda = 5 0 0$ , found via grid search. Finally, to assess to importance of principled subnetwork selection, we also consider the baseline where we select the subnetwork uniformly at random (called Ours (Rand)). We perform the following two experiments, with results in Fig. 4. See Appendix B for additional results.
169
+
170
+ ![](images/966242861badeec22bbb4cab7022e457bc6a60cc58c9e8f8bac63f13ef1c8655.jpg)
171
+ Figure 4: Results on the rotated MNIST (left) and the corrupted CIFAR (right) benchmarks of Ovadia et al. (2019), showing the mean $\pm$ std of the error (top) and log-likelihood (bottom) across three different seeds. Subnetwork inference retains better uncertainty calibration and robustness to distribution shift than point estimated networks and other Bayesian deep learning approaches.
172
+
173
+ Rotated MNIST: Following Ovadia et al. (2019); Antoran et al. (2020), we train all methods on ´ MNIST and evaluate their predictive distributions on increasingly rotated digits. While all methods perform well on the original MNIST test set, their accuracy degrades quickly for rotations larger than 30 degrees. In terms of LL, ensembles perform best out of our baselines. Subnetwork inference obtains significantly larger LL values than almost all baselines, including ensembles. The only exception is VOGN, which achieves slightly better performance. It was also observed in Ovadia et al. (2019) that mean-field variational inference (which VOGN also is an instance of) is very strong on MNIST, but its performance deteriorates on larger datasets. Subnetwork inference makes accurate predictions in-distribution while assigning higher uncertainty than the baselines to out-of-distribution points. Corrupted CIFAR: Again following Ovadia et al. (2019); Antoran et al. (2020), we train ´ on CIFAR10 and evaluate on data subject to 16 different corruptions with 5 levels of intensity each (Hendrycks & Dietterich, 2019). Our approach matches a MAP estimated network in terms of predictive error as local linearization makes their predictions the same. Ensembles and SWAG are the most accurate. Even so, subnetwork inference differentiates itself by being the least overconfident, outperforming all baselines in terms of log-likelihood at all corruption levels. Here, VOGN performs rather badly; while this might appear in stark contrast to its strong performance on the MNIST benchmark, the behaviour that mean-field VI performs well on MNIST but not on larger datasets was also observed in Ovadia et al. (2019).
174
+
175
+ On both benchmarks, we furthermore find that randomly selecting the subnetwork performs substantially worse than using our more principled subnetwork selection strategy. This highlights the importance of the way subnetworks are selected. These results suggest that subnetwork inference results in better uncertainty calibration and robustness to distribution shift than other popular uncertainty quantification approaches.
176
+
177
+ # 6 RELATED WORK
178
+
179
+ Bayesian Deep Learning. There have significant efforts to characterise the posterior distribution over NN weights $p ( W | \bar { \mathcal { D } } )$ . Hamiltonian Monte Carlo (Neal, 1995) remains the golden standard for approximate inference in BNNs to this day. Although asymptotically unbiased, sampling based approaches are difficult to scale to the large datasets (Betancourt, 2015). As a result, approaches which find the best surrogate posterior among an approximating family (most often Gaussians) have gained popularity. The first of these was the Laplace approximation, introduced by MacKay (1992), who also proposed approximating the predictive posterior with that of the linearised model (Khan et al., 2019; Immer et al., 2020). The popularisation of larger NN models has made surrogate distributions that capture correlations between weights computationally intractable. Thus, most modern methods make use of the mean field assumption (Blundell et al., 2015; Hernandez-Lobato & ´ Adams, 2015; Gal & Ghahramani, 2016; Mishkin et al., 2018; Osawa et al., 2019). This comes at the cost of limited expressivity (Foong et al., 2019a) and empirical under-performance (Ovadia et al., 2019; Antoran et al., 2020) of uncertainty estimates. Our proposed approach recovers predictive ´ posterior expressivity while maintaining tractability by lowering the dimensionality of the weight space considered. This allows us to scale up approximations that do consider weight correlations (MacKay, 1992; Louizos & Welling, 2016; Maddox et al., 2019; Ritter et al., 2018).
180
+
181
+ Neural Network Linearization. In the limit of infinite width, NNs converge to Gaussian process (GP) behaviour (Neal, 1995; Matthews, 2017; Garriga-Alonso et al., 2018). Recently, these results have been extended to finite width BNNs when the surrogate posterior is Gaussian (Khan et al., 2019). We draw upon these results to formulate a subnetwork selection strategy for BNNs. Neural linear methods perform inference over only the last layer of a NN, while keeping all other layers fixed (Snoek et al., 2015; Riquelme et al., 2018; Ovadia et al., 2019; Ober & Rasmussen, 2019; Pinsler et al., 2019; Kristiadi et al., 2020). These represent a different generalised linear model in which the basis functions are defined by the $l { - } 1$ first layers of a NN. They can also be viewed as a special case of subnetwork inference, in which the subnetwork is simply defined to be the last NN layer.
182
+
183
+ Inference over Subspaces. The subfield of NN pruning aims to increase the computational efficiency of NNs by identifying the smallest subset of weights which are required to make accurate predictions. Approaches trade-off computational cost with compression efficiency, ranging from those that require multiple training runs (Frankle & Carbin, 2019) to those that prune before training (Wang et al., 2020). Our work differs in that it retains all NN weights but aims to find a small subset over which to perform probabilistic reasoning. More closely related work to ours is that of Izmailov et al. (2019), who propose to perform inference over a low-dimensional subspace of weights; e.g. one constructed from the principal components of the SGD trajectory. Moreover, several recent approaches use low-rank parameterizations of approximate posteriors in the context of variational inference (Rossi et al., 2019; Swiatkowski et al., 2020; Dusenberry et al., 2020). This could also be viewed as doing inference over an implicit subspace of weight space. In contrast, we propose a technique to find subsets of weights which are relevant to predictive uncertainty, i.e., we identify axis aligned subspaces. Finally, there have been recent works studying neural network sparsity / pruning from a Bayesian perspective (Ghosh & Doshi-Velez, 2017; Polson & Rockov ˇ a, 2018; Cui et al., 2020; Louizos et al., 2017; ´ Molchanov et al., 2017; Gomez et al., 2019; Lee et al., 2018). While these seem conceptually related at first glance, their goal is fundamentally different to ours: While those methods aim to perform model selection / sparsification by either explicitly or implicitly pruning unnecessary weights, our goal is to make inference more tractable. More precisely, while those sparse Bayesian deep learning methods prune individual weights, we instead just prune the variances of certain weights, which, importantly retains the full predictive power of the full network to retain high predictive accuracy.
184
+
185
+ # 7 CONCLUSION
186
+
187
+ In this paper, we develop a practical and scalable method for expressive yet tractable probabilistic inference in deep neural networks. We approximate the posterior over a subset of the weights while keeping all other weights deterministic. Computational cost is decoupled from network size, allowing us to scale expressive approximations, such as full-covariance Gaussian distributions, to real-world sized NNs. Our approach can be applied post-hoc to any pre-trained model, making it particularly attractive for practical use. Our empirical analysis suggests that subnetwork inference 1) is more expressive and retains more uncertainty than crude approximations over the full network, 2) allows us to employ larger NNs, which fit a broader range of functions, without sacrificing the quality of our uncertainty estimates, and 3) is competitive with state-of-the-art uncertainty quantification methods, like deep ensembles (Lakshminarayanan et al., 2017), on real-world scale problems.
188
+
189
+ # REFERENCES
190
+
191
+ Dario Amodei, Chris Olah, Jacob Steinhardt, Paul Christiano, John Schulman, and Dan Mane.´ Concrete problems in ai safety. arXiv preprint arXiv:1606.06565, 2016.
192
+
193
+ Javier Antoran, James Urquhart Allingham, and Jos ´ e Miguel Hern ´ andez-Lobato. Depth uncertainty ´ in neural networks, 2020.
194
+
195
+ Arsenii Ashukha, Alexander Lyzhov, Dmitry Molchanov, and Dmitry Vetrov. Pitfalls of in-domain uncertainty estimation and ensembling in deep learning. In ICLR, 2020a.
196
+
197
+ Arsenii Ashukha, Alexander Lyzhov, Dmitry Molchanov, and Dmitry P. Vetrov. Pitfalls of in-domain uncertainty estimation and ensembling in deep learning. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020b.
198
+
199
+ Michael Betancourt. The fundamental incompatibility of scalable hamiltonian monte carlo and naive data subsampling. volume 37 of Proceedings of Machine Learning Research, pp. 533–540, Lille, France, 07–09 Jul 2015. PMLR. URL http://proceedings.mlr.press/v37/ betancourt15.html.
200
+
201
+ Christopher M Bishop. Pattern recognition and machine learning. springer, 2006.
202
+
203
+ Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight Uncertainty in Neural Networks. In Proceedings of The 32nd International Conference on Machine Learning (ICML), pp. 1613–1622, 2015.
204
+
205
+ Yu Cheng, Duo Wang, Pan Zhou, and Tao Zhang. A survey of model compression and acceleration for deep neural networks. arXiv preprint arXiv:1710.09282, 2017.
206
+
207
+ Tianyu Cui, Aki Havulinna, Pekka Marttinen, and Samuel Kaski. Informative gaussian scale mixture priors for bayesian neural networks. arXiv preprint arXiv:2002.10243, 2020.
208
+
209
+ Dheeru Dua and Casey Graff. UCI machine learning repository, 2017. URL http://archive. ics.uci.edu/ml.
210
+
211
+ Michael W Dusenberry, Ghassen Jerfel, Yeming Wen, Yi-an Ma, Jasper Snoek, Katherine Heller, Balaji Lakshminarayanan, and Dustin Tran. Efficient and scalable bayesian neural nets with rank-1 factors. arXiv preprint arXiv:2005.07186, 2020.
212
+
213
+ Angelos Filos, Sebastian Farquhar, Aidan N. Gomez, Tim G. J. Rudner, Zachary Kenton, Lewis Smith, Milad Alizadeh, Arnoud de Kroon, and Yarin Gal. Benchmarking bayesian deep learning with diabetic retinopathy diagnosis. https://github.com/OATML/bdl-benchmarks, 2019a.
214
+
215
+ Angelos Filos, Sebastian Farquhar, Aidan N Gomez, Tim GJ Rudner, Zachary Kenton, Lewis Smith, Milad Alizadeh, Arnoud de Kroon, and Yarin Gal. Benchmarking bayesian deep learning with diabetic retinopathy diagnosis. Preprint, 2019b.
216
+
217
+ Andrew YK Foong, David R Burt, Yingzhen Li, and Richard E Turner. On the expressiveness of approximate inference in bayesian neural networks. arXiv, pp. arXiv–1909, 2019a.
218
+
219
+ Andrew YK Foong, Yingzhen Li, Jose Miguel Hern ´ andez-Lobato, and Richard E Turner. In-between ´ uncertainty in bayesian neural networks. ICML Workshop on Uncertainty and Robustness in Deep Learning, 2019b.
220
+
221
+ Stanislav Fort, Huiyi Hu, and Balaji Lakshminarayanan. Deep ensembles: A loss landscape perspective. arXiv preprint arXiv:1912.02757, 2019.
222
+
223
+ Jonathan Frankle and Michael Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In International Conference on Learning Representations, 2019.
224
+
225
+ Lex Fridman, Li Ding, Benedikt Jenik, and Bryan Reimer. Arguing machines: Human supervision of black box ai systems that make life-critical decisions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pp. 0–0, 2019.
226
+
227
+ Yarin Gal. Uncertainty in deep learning. University of Cambridge, 1:3, 2016.
228
+
229
+ Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In international conference on machine learning, pp. 1050–1059, 2016.
230
+
231
+ Adria Garriga-Alonso, Carl Edward Rasmussen, and Laurence Aitchison. Deep convolutional \` networks as shallow gaussian processes. In International Conference on Learning Representations, 2018.
232
+
233
+ Zoubin Ghahramani. Probabilistic machine learning and artificial intelligence. Nature, 521(7553): 452–459, 2015.
234
+
235
+ Soumya Ghosh and Finale Doshi-Velez. Model selection in bayesian neural networks via horseshoe priors. arXiv preprint arXiv:1705.10388, 2017.
236
+
237
+ Mark N Gibbs. Bayesian Gaussian processes for regression and classification. PhD thesis, Citeseer, 1998.
238
+
239
+ Clark R Givens, Rae Michael Shortt, et al. A class of wasserstein metrics for probability distributions. The Michigan Mathematical Journal, 31(2):231–240, 1984.
240
+
241
+ Aidan N Gomez, Ivan Zhang, Kevin Swersky, Yarin Gal, and Geoffrey E Hinton. Learning sparse networks using targeted dropout. arXiv preprint arXiv:1905.13678, 2019.
242
+
243
+ Ian Goodfellow, Yoshua Bengio, Aaron Courville, and Yoshua Bengio. Deep learning, volume 1. MIT Press, 2016.
244
+
245
+ Priya Goyal, Piotr Dollar, Ross B. Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, ´ Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch SGD: Training ImageNet in 1 hour. CoRR, abs/1706.02677, 2017.
246
+
247
+ Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 1321–1330. JMLR. org, 2017.
248
+
249
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on ImageNet classification. In 2015 IEEE International Conference on Computer Vision, ICCV 2015, Santiago, Chile, December 7-13, 2015, pp. 1026–1034. IEEE Computer Society, 2015.
250
+
251
+ 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.
252
+
253
+ Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. arXiv preprint arXiv:1903.12261, 2019.
254
+
255
+ Jose Miguel Hern ´ andez-Lobato and Ryan Adams. Probabilistic backpropagation for scalable learning ´ of bayesian neural networks. In International Conference on Machine Learning, pp. 1861–1869, 2015.
256
+
257
+ Alexander Immer, Maciej Korzepa, and Matthias Bauer. Improving predictions of bayesian neural networks via local linearization. ICML Workshop on Uncertainty and Robustness in Deep Learning, 2020.
258
+
259
+ Pavel Izmailov, Wesley J Maddox, Polina Kirichenko, Timur Garipov, Dmitry Vetrov, and Andrew Gordon Wilson. Subspace inference for bayesian deep learning. In 35th Conference on Uncertainty in Artificial Intelligence, UAI 2019, 2019.
260
+
261
+ Mohammad Emtiyaz Khan, Didrik Nielsen, Voot Tangkaratt, Wu Lin, Yarin Gal, and Akash Srivastava. Fast and scalable bayesian deep learning by weight-perturbation in adam. arXiv preprint arXiv:1806.04854, 2018.
262
+
263
+ Mohammad Emtiyaz E Khan, Alexander Immer, Ehsan Abedi, and Maciej Korzepa. Approximate inference turns deep networks into gaussian processes. In Advances in neural information processing systems, pp. 3094–3104, 2019.
264
+
265
+ Durk P Kingma, Tim Salimans, and Max Welling. Variational dropout and the local reparameterization trick. In Advances in neural information processing systems, pp. 2575–2583, 2015.
266
+
267
+ Agustinus Kristiadi, Matthias Hein, and Philipp Hennig. Being bayesian, even just a bit, fixes overconfidence in relu networks. arXiv preprint arXiv:2002.10118, 2020.
268
+
269
+ Alex Krizhevsky and Geoffrey Hinton. Learning Multiple Layers of Features from Tiny Images. Technical report, University of Toronto, 2009.
270
+
271
+ Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In Advances in Neural Information Processing Systems, pp. 6402–6413, 2017.
272
+
273
+ Neil David Lawrence. Variational inference in probabilistic models. PhD thesis, University of Cambridge, 2001.
274
+
275
+ 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.
276
+
277
+ Juho Lee, Saehoon Kim, Jaehong Yoon, Hae Beom Lee, Eunho Yang, and Sung Ju Hwang. Adaptive network sparsification via dependent variational beta-bernoulli dropout. 2018.
278
+
279
+ Ekaterina Lobacheva, Nadezhda Chirkova, Maxim Kodryan, and Dmitry P Vetrov. On power laws in deep ensembles. Advances in Neural Information Processing Systems, 33, 2020.
280
+
281
+ Christos Louizos and Max Welling. Structured and efficient variational deep learning with matrix gaussian posteriors. In International Conference on Machine Learning, pp. 1708–1716, 2016.
282
+
283
+ Christos Louizos, Max Welling, and Diederik P Kingma. Learning sparse neural networks through l 0 regularization. arXiv preprint arXiv:1712.01312, 2017.
284
+
285
+ David JC MacKay. A practical bayesian framework for backpropagation networks. Neural computation, 4(3):448–472, 1992.
286
+
287
+ Wesley J Maddox, Pavel Izmailov, Timur Garipov, Dmitry P Vetrov, and Andrew Gordon Wilson. A simple baseline for bayesian uncertainty in deep learning. In Advances in Neural Information Processing Systems, pp. 13132–13143, 2019.
288
+
289
+ Wesley J Maddox, Gregory Benton, and Andrew Gordon Wilson. Rethinking parameter counting in deep models: Effective dimensionality revisited. arXiv preprint arXiv:2003.02139, 2020.
290
+
291
+ James Martens. Second-order optimization for neural networks. University of Toronto (Canada), 2016.
292
+
293
+ James Martens and Ilya Sutskever. Learning recurrent neural networks with hessian-free optimization. In Proceedings of the 28th international conference on machine learning (ICML-11), pp. 1033– 1040. Citeseer, 2011.
294
+
295
+ Alexander Graeme de Garis Matthews. Scalable Gaussian process inference using variational methods. PhD thesis, University of Cambridge, 2017.
296
+
297
+ Aaron Mishkin, Frederik Kunstner, Didrik Nielsen, Mark Schmidt, and Mohammad Emtiyaz Khan. Slang: Fast structured covariance approximations for bayesian deep learning with natural gradient. In Advances in Neural Information Processing Systems, pp. 6245–6255, 2018.
298
+
299
+ Dmitry Molchanov, Arsenii Ashukha, and Dmitry Vetrov. Variational dropout sparsifies deep neural networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 2498–2507. JMLR. org, 2017.
300
+
301
+ Eric Nalisnick, Akihiro Matsukawa, Yee Whye Teh, Dilan Gorur, and Balaji Lakshminarayanan. Do Deep Generative Models Know What They Don’t Know? In International Conference on Learning Representations (ICLR), 2019.
302
+
303
+ Radford M. Neal. Bayesian Learning for Neural Networks. PhD thesis, CAN, 1995. AAINN02676.
304
+
305
+ John Ashworth Nelder and R Jacob Baker. Generalized Linear Models. Wiley Online Library, 1972.
306
+
307
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading Digits in Natural Images with Unsupervised Feature Learning. In NeurIPS Workshop on Deep Learning and Unsupervised Feature Learning, 2011.
308
+
309
+ 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.
310
+
311
+ Sebastian W Ober and Carl Edward Rasmussen. Benchmarking the neural linear model for regression. arXiv preprint arXiv:1912.08416, 2019.
312
+
313
+ Kazuki Osawa, Siddharth Swaroop, Anirudh Jain, Runa Eschenhagen, Richard E Turner, Rio Yokota, and Mohammad Emtiyaz Khan. Practical deep learning with Bayesian principles. arXiv preprint arXiv:1906.02506, 2019.
314
+
315
+ Yaniv Ovadia, Emily Fertig, Balaji Lakshminarayanan, Sebastian Nowozin, D Sculley, Joshua Dillon, Jie Ren, Zachary Nado, and Jasper Snoek. Can you trust your model’s uncertainty? evaluating predictive uncertainty under dataset shift. In Advances in Neural Information Processing Systems, pp. 13969–13980, 2019.
316
+
317
+ Robert Pinsler, Jonathan Gordon, Eric Nalisnick, and Jose Miguel Hern ´ andez-Lobato. Bayesian batch ´ active learning as sparse subset approximation. In Advances in Neural Information Processing Systems, pp. 6359–6370, 2019.
318
+
319
+ Nicholas G Polson and Veronika Rockov ˇ a. Posterior concentration for sparse deep learning. In ´ Advances in Neural Information Processing Systems, pp. 930–941, 2018.
320
+
321
+ Carlos Riquelme, George Tucker, and Jasper Snoek. Deep bayesian bandits showdown: An empirical comparison of bayesian deep networks for thompson sampling. In International Conference on Learning Representations, 2018.
322
+
323
+ Hippolyt Ritter, Aleksandar Botev, and David Barber. A scalable laplace approximation for neural networks. In International Conference on Learning Representations, 2018.
324
+
325
+ Simone Rossi, Sebastien Marmin, and Maurizio Filippone. Walsh-hadamard variational inference for bayesian deep learning. arXiv preprint arXiv:1905.11248, 2019.
326
+
327
+ Nicol N Schraudolph. Fast curvature matrix-vector products for second-order gradient descent. Neural computation, 14(7):1723–1738, 2002.
328
+
329
+ Jasper Snoek, Oren Rippel, Kevin Swersky, Ryan Kiros, Nadathur Satish, Narayanan Sundaram, Mostofa Patwary, Mr Prabhat, and Ryan Adams. Scalable bayesian optimization using deep neural networks. In International conference on machine learning, pp. 2171–2180, 2015.
330
+
331
+ Jakub Swiatkowski, Kevin Roth, Bastiaan S Veeling, Linh Tran, Joshua V Dillon, Stephan Mandt, Jasper Snoek, Tim Salimans, Rodolphe Jenatton, and Sebastian Nowozin. The k-tied normal distribution: A compact parameterization of gaussian mean field posteriors in bayesian neural networks. arXiv preprint arXiv:2002.02655, 2020.
332
+
333
+ Chaoqi Wang, Guodong Zhang, and Roger Grosse. Picking winning tickets before training by preserving gradient flow. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ SkgsACVKPH.
334
+
335
+ Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-MNIST: a novel image dataset for benchmarking machine learning algorithms. 2017.
336
+
337
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In Richard C. Wilson, Edwin R. Hancock, and William A. P. Smith (eds.), Proceedings of the British Machine Vision Conference 2016, BMVC 2016, York, UK, September 19-22, 2016. BMVA Press, 2016.
338
+
339
+ # A PROOFS FOR THE THEORETICAL RESULTS
340
+
341
+ We now provide the proofs for the results in Section 4.
342
+
343
+ # A.1 PROOF OF PROPOSITION 1
344
+
345
+ Proof. Note that the posterior distributions $\widetilde { p } ( \mathbf { w } | \mathbf { y } , \Phi )$ and $p _ { S } ( { \bf w } | { \pmb y } , { \pmb \Phi } )$ are both Gaussian. We thus econsider the squared 2-Wasserstein distance between two Gaussian distributions $\mathcal { N } ( \mu _ { 1 } , \Sigma _ { 1 } )$ and $\mathcal { N } ( \mu _ { 2 } , \Sigma _ { 2 } )$ , which has the following closed-form expression (Givens et al., $1 9 8 4 ) ^ { 4 }$ :
346
+
347
+ $$
348
+ \begin{array} { r } { W \left[ \mathcal { N } \left( \mu _ { 1 } , \Sigma _ { 1 } \right) \ | | \mathcal { N } \left( \mu _ { 2 } , \Sigma _ { 2 } \right) \right] = \| \mu _ { 1 } - \mu _ { 2 } \| _ { 2 } ^ { 2 } + \mathrm { t r a c e } \left( \Sigma _ { 1 } + \Sigma _ { 2 } - 2 \left( \Sigma _ { 1 } \Sigma _ { 2 } \right) ^ { 1 / 2 } \right) \ . } \end{array}
349
+ $$
350
+
351
+ Plugging in ${ \pmb { \mu } } _ { 1 } = { \pmb { \mu } } _ { 2 } = \mathbf { w } _ { M A P }$ , $\pmb { \Sigma } _ { 1 } = H ^ { - 1 }$ and $\Sigma _ { 2 } = M _ { S } \odot H ^ { - 1 }$ , we obtain
352
+
353
+ $$
354
+ \begin{array} { r l } & { W \left[ \widetilde { p } ( \mathbf { w } | y , X ) \mid | p _ { \mathrm { S } } ( \mathbf { w } | y , X ) \right] } \\ & { \quad = W \left[ \mathcal { N } ( \mathbf { w } _ { M A P } , H ^ { - 1 } ) \mid | \mathcal { N } ( \mathbf { w } _ { M A P } , M _ { S } \odot H ^ { - 1 } ) \right] } \\ & { \quad = \underbrace { \left. \mathbf { w } _ { M A P } \longleftrightarrow \widetilde { { \mathbf { w } } _ { M A P } } \right. _ { 2 } ^ { 2 } } _ { = \mathrm { t r a c e } } \left( H ^ { - 1 } + ( M _ { S } \odot H ^ { - 1 } ) - 2 \left( H ^ { - 1 } ( M _ { S } \odot H ^ { - 1 } ) \right) ^ { 1 / 2 } \right) } \\ & { \quad = \mathrm { t r a c e } \left( ( 1 + M _ { S } ) \odot H ^ { - 1 } \right) - \mathrm { t r a c e } \left( 2 \left( H ^ { - 1 } \left( M _ { S } \odot H ^ { - 1 } \right) \right) ^ { 1 / 2 } \right) } \\ & { \quad = \displaystyle \sum _ { d = 1 } ^ { D } ( 1 + m _ { d d } ) \sigma _ { d } ^ { 2 } - \mathrm { t r a c e } \left( 2 \left( H ^ { - 1 } \left( M _ { S } \odot H ^ { - 1 } \right) \right) ^ { 1 / 2 } \right) } \end{array}
355
+ $$
356
+
357
+ # A.2 PROOF OF COROLLARY 1.1
358
+
359
+ Proof. For $H ^ { - 1 } = \mathrm { d i a g } ( \sigma _ { 1 } ^ { 2 } , . . . , \sigma _ { D } ^ { 2 } )$ , the Wasserstein posterior gap in Eq. (12) simplifies to
360
+
361
+ $$
362
+ W \left[ \widetilde { p } ( { \mathbf { w } } | { \pmb y } , { \pmb \Phi } ) | | p _ { \mathrm { S } } ( { \mathbf { w } } | { \pmb y } , { \pmb \Phi } ) \right] = \sum _ { d = 1 } ^ { D } \left( \left( 1 + m _ { d d } \right) \sigma _ { d } ^ { 2 } - 2 m _ { d d } \sigma _ { d } ^ { 2 } \right) .
363
+ $$
364
+
365
+ The optimal subnetwork selection strategy amounts to choosing the binary vector $\pmb { m } = [ m _ { d d } ] _ { d = 1 } ^ { D }$ with $\textstyle \sum _ { d = 1 } ^ { D } m _ { d } = S$ (i.e., we select $S$ out of $D$ parameters) s.t. the posterior gap in Eq. (14) is minimized. Observing that the contribution of the $d$ -th parameter to the posterior gap is $( 1 + 1 ) \sigma _ { d } ^ { 2 } - 1 \times 2 \sigma _ { d } ^ { 2 } = 0$ if it is selected (i.e. if $m _ { d d } = 1$ ), and $( 1 + \bar { 0 } ) \sigma _ { d } ^ { 2 } - 0 \times 2 \sigma _ { d } ^ { 2 } \stackrel { . } { = } \sigma _ { d } ^ { 2 }$ if it is not selected (i.e. if $m _ { d d } = 0$ ), we see that the optimal subnetwork comprises of the $S$ weights with the largest variances $\sigma _ { d } ^ { 2 }$ . □
366
+
367
+ # B ADDITIONAL IMAGE CLASSIFICATION RESULTS
368
+
369
+ Table 1: AUC-ROC scores for out-of-distribution detection, using CIFAR10 vs SVHN and MNIST vs FashionMNIST as in- (source) and out-of-distribution (target) datasets, respectively (Nalisnick et al., 2019).
370
+
371
+ <table><tr><td>SOURCE</td><td>TARGET</td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td></tr><tr><td>CIFAR10</td><td>SVHN</td><td>0.85±0.03</td><td>0.86±0.02</td><td>0.85±0.01</td><td>0.86±0.02</td><td>0.91±0.00</td><td>0.86±0.02</td><td>0.83±0.00</td></tr><tr><td>MNIST</td><td>Fashion</td><td>0.92±0.05</td><td>0.75±0.02</td><td>0.82±0.12</td><td>0.75±0.01</td><td>0.90±0.09</td><td>0.72±0.03</td><td>0.97±0.01</td></tr></table>
372
+
373
+ Table 2: MNIST – no rotation.
374
+
375
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-0.07±0.01</td><td>-0.01±0.00</td><td>-0.01±0.00</td><td>-0.04±0.03</td><td>-0.01±0.00</td><td>-0.01±0.00</td><td>-0.01±0.00</td><td>-0.14±nan</td></tr><tr><td>error</td><td>0.01±0.00</td><td>0.00±0.00</td><td>0.00±0.00</td><td>0.01±0.01</td><td>0.00±0.00</td><td>0.00±0.00</td><td>0.00±0.00</td><td>0.01±nan</td></tr><tr><td>ECE</td><td>0.05±0.01</td><td>0.00±0.00</td><td>0.00±0.00</td><td>0.00±0.00</td><td>0.00±0.00</td><td>0.00±0.00</td><td>0.00±0.00</td><td>0.10±nan</td></tr><tr><td>brier score</td><td>0.02±0.00</td><td>0.01±0.00</td><td>0.01±0.00</td><td>0.02±0.01</td><td>0.01±0.00</td><td>0.01±0.00</td><td>0.01±0.00</td><td>0.04±nan</td></tr></table>
376
+
377
+ 4This also holds for our case of a degenerate Gaussian with singular covariance matrix (Givens et al., 1984).
378
+
379
+ ![](images/aad024300c6bf0b50f42234321d229a99d769b38ed3b300a3faab5c6a4f64a35.jpg)
380
+ Figure 5: Rotated MNIST (left) and Corrupted CIFAR10 (right) results for deep ensembles (Lakshminarayanan et al., 2017) with large numbers of ensemble members (i.e. up to 55). Horizontal axis denotes number of ensemble members, and vertical axis denotes performance in terms of loglikelihood. Straight horizontal lines correspond to the performance of our method, as a reference. Colors denote different levels of rotation (left) and corruption (right). It can clearly be observed that the performance of deep ensembles saturates after around 15 ensemble members, meaning that adding more members yields strongly diminishing returns. This is in agreement with recent works (Antoran´ et al., 2020; Ashukha et al., 2020a; Lobacheva et al., 2020). Our method significantly outperforms even very large deep ensembles, especially for high degrees of rotation/corruption.
381
+
382
+ ![](images/7ac4e36b330bb3a0ad67b1c0ff314010923ad8edfb3ea97ca805ca45b4ba2b70.jpg)
383
+ Figure 6: Rejection-classification plots. We simulate a realistic OOD rejection scenario (Filos et al., 2019b) by jointly evaluating our models on an in-distribution and an OOD test set. We allow our methods to reject increasing proportions of the data based on predictive entropy before classifying the rest. All predictions on OOD samples are treated as incorrect. Following (Nalisnick et al., 2019), we use CIFAR10 vs SVHN and MNIST vs FashionMNIST as in- and out-of-distribution datasets, respectively. Note that the SVHN test set is randomly sub-sampled down to a size of 10,000.
384
+
385
+ ![](images/c3a908807cb61e57ccfb703b4ff067fc82ee203ac08066346bfa9a6f26a046e7.jpg)
386
+ Figure 7: Full MNIST rotation and CIFAR10 corruption results, for ResNet-18, reporting predictive error, log-likelihood (LL), expected calibration error (ECE) and brier score, respectively (from top to bottom).
387
+
388
+ ![](images/84c92e68a29bb694ec93250940373bf76b1df5a4d1136c7e674ba7159aed3f4b.jpg)
389
+ Figure 8: MNIST rotation results for ResNet-50, reporting predictive error, log-likelihood (LL), expected calibration error (ECE) and brier score. We choose a subnetwork containing only $0 . 1 6 7 \%$ (39,190 / 23,466,560) of the parameters of the full network. We see that subnetwork inference still results in an improvement in the calibration of predictive uncertainty. As expected, however, for ResNet-50 the improvement over MAP is smaller than for ResNet-18 where we were able to choose a subnetwork containing $0 . 3 8 \%$ of the parameters.
390
+
391
+ Table 3: MNIST – 15◦ rotation.
392
+
393
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-0.14±0.02</td><td>-0.05±0.00</td><td>-0.05±0.00</td><td>-0.11±0.08</td><td>-0.04±0.00</td><td>-0.05±0.00</td><td>-0.04±0.00</td><td>-0.19±nan</td></tr><tr><td>error</td><td>0.02±0.00</td><td>0.02±0.00</td><td>0.01±0.00</td><td>0.03±0.02</td><td>0.01±0.00</td><td>0.02±0.00</td><td>0.01±0.00</td><td>0.02±nan</td></tr><tr><td>ECE</td><td>0.08±0.01</td><td>0.00±0.00</td><td>0.00±0.00</td><td>0.01±0.01</td><td>0.00±0.00</td><td>0.00±0.00</td><td>0.00±0.00</td><td>0.12±nan</td></tr><tr><td>brier score</td><td>0.05±0.01</td><td>0.03±0.00</td><td>0.02±0.00</td><td>0.05±0.03</td><td>0.02±0.00</td><td>0.02±0.00</td><td>0.02±0.00</td><td>0.07±nan</td></tr></table>
394
+
395
+ Table 4: MNIST – $3 0 ^ { \circ }$ rotation.
396
+
397
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-0.42±0.04</td><td>-0.36±0.01</td><td>-0.32±0.02</td><td>-0.44±0.06</td><td>-0.28±0.02</td><td>-0.39±0.01</td><td>-0.30±0.00</td><td>-0.51±nan</td></tr><tr><td>error</td><td>0.11±0.01</td><td>0.10±0.00</td><td>0.09±0.01</td><td>0.12±0.01</td><td>0.08±0.01</td><td>0.10±0.00</td><td>0.08±0.00</td><td>0.14±nan</td></tr><tr><td>ECE</td><td>0.10±0.02</td><td>0.04±0.01</td><td>0.03±0.00</td><td>0.06±0.01</td><td>0.02±0.00</td><td>0.05±0.00</td><td>0.04±0.00</td><td>0.13±nan</td></tr><tr><td>brier score</td><td>0.19±0.02</td><td>0.16±0.00</td><td>0.14±0.01</td><td>0.18±0.02</td><td>0.12±0.01</td><td>0.16±0.00</td><td>0.12±0.00</td><td>0.23±nan</td></tr></table>
398
+
399
+ Table 5: MNIST – 45◦ rotation.
400
+
401
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>midrule LL</td><td>-1.09±0.03</td><td>-1.60±0.05</td><td>−1.44±0.11</td><td>-1.68±0.20</td><td>-1.36±0.07</td><td>-1.75±0.06</td><td>-1.35±0.02</td><td>-1.15±nan</td></tr><tr><td>error</td><td>0.36±0.01</td><td>0.35±0.01</td><td>0.33±0.01</td><td>0.35±0.03</td><td>0.31±0.01</td><td>0.35±0.01</td><td>0.29±0.00</td><td>0.40±nan</td></tr><tr><td>ECE</td><td>0.03±0.01</td><td>0.22±0.01</td><td>0.19±0.02</td><td>0.22±0.02</td><td>0.17±0.01</td><td>0.23±0.01</td><td>0.18±0.00</td><td>0.01±nan</td></tr><tr><td>brier score</td><td>0.49±0.02</td><td>0.55±0.02</td><td>0.52±0.02</td><td>0.55±0.04</td><td>0.48±0.02</td><td>0.56±0.02</td><td>0.46±0.01</td><td>0.53±nan</td></tr></table>
402
+
403
+ Table 6: MNIST – $6 0 ^ { \circ }$ rotation.
404
+
405
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-2.10±0.03</td><td>-3.85±0.18</td><td>-3.54±0.23</td><td>-4.11±0.66</td><td>-3.60±0.10</td><td>-4.29±0.21</td><td>-2.95±0.08</td><td>-1.92±nan</td></tr><tr><td>error</td><td>0.63±0.01</td><td>0.63±0.01</td><td>0.62±0.01</td><td>0.62±0.05</td><td>0.61±0.01</td><td>0.63±0.01</td><td>0.53±0.02</td><td>0.64±nan</td></tr><tr><td>ECE</td><td>0.25±0.02</td><td>0.46±0.02</td><td>0.43±0.02</td><td>0.47±0.06</td><td>0.42±0.01</td><td>0.48±0.02</td><td>0.36±0.02</td><td>0.17±nan</td></tr><tr><td>brier score</td><td>0.85±0.02</td><td>1.04±0.03</td><td>1.00±0.03</td><td>1.05±0.10</td><td>0.98±0.02</td><td>1.07±0.03</td><td>0.86±0.03</td><td>0.80±nan</td></tr></table>
406
+
407
+ Table 7: MNIST – $7 5 ^ { \circ }$ rotation.
408
+
409
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-3.02±0.07</td><td>-5.93±0.28</td><td>-5.49±0.38</td><td>-6.92±0.32</td><td>-5.74±0.15</td><td>-6.63±0.33</td><td>-4.46±0.18</td><td>-2.54±nan</td></tr><tr><td>error</td><td>0.80±0.02</td><td>0.79±0.01</td><td>0.79±0.01</td><td>0.81±0.00</td><td>0.78±0.01</td><td>0.79±0.01</td><td>0.72±0.02</td><td>0.77±nan</td></tr><tr><td>ECE</td><td>0.41±0.04</td><td>0.62±0.03</td><td>0.59±0.01</td><td>0.65±0.01</td><td>0.58±0.01</td><td>0.64±0.03</td><td>0.51±0.02</td><td>0.26±nan</td></tr><tr><td>brier score</td><td>1.08±0.04</td><td>1.34±0.04</td><td>1.30±0.02</td><td>1.39±0.01</td><td>1.29±0.02</td><td>1.37±0.04</td><td>1.17±0.04</td><td>0.95±nan</td></tr></table>
410
+
411
+ Table 8: MNIST – 90◦ rotation.
412
+
413
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-3.35±0.13</td><td>-6.46±0.15</td><td>-6.18±0.41</td><td>-7.32±0.67</td><td>-6.39±0.17</td><td>-7.18±0.22</td><td>-5.63±0.12</td><td>-2.91±nan</td></tr><tr><td>error</td><td>0.84±0.02</td><td>0.84±0.01</td><td>0.84±0.01</td><td>0.85±0.01</td><td>0.84±0.01</td><td>0.84±0.01</td><td>0.82±0.02</td><td>0.81±nan</td></tr><tr><td>ECE</td><td>0.43±0.03</td><td>0.64±0.04</td><td>0.62±0.01</td><td>0.66±0.03</td><td>0.62±0.01</td><td>0.66±0.04</td><td>0.60±0.01</td><td>0.29±nan</td></tr><tr><td>brier score</td><td>1.13±0.03</td><td>1.40±0.05</td><td>1.37±0.01</td><td>1.44±0.04</td><td>1.36±0.01</td><td>1.43±0.05</td><td>1.34±0.02</td><td>1.02±nan</td></tr></table>
414
+
415
+ Table 9: MNIST – 105◦ rotation.
416
+
417
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-3.59±0.05</td><td>-7.06±0.45</td><td>-6.70±0.52</td><td>-7.69±0.99</td><td>-7.01±0.17</td><td>-7.87±0.53</td><td>-6.28±0.19</td><td>-3.10±nan</td></tr><tr><td>error</td><td>0.85±0.02</td><td>0.84±0.02</td><td>0.84±0.01</td><td>0.85±0.01</td><td>0.84±0.01</td><td>0.84±0.02</td><td>0.81±0.00</td><td>0.81±nan</td></tr><tr><td>ECE</td><td>0.47±0.04</td><td>0.67±0.05</td><td>0.63±0.01</td><td>0.67±0.03</td><td>0.64±0.01</td><td>0.68±0.04</td><td>0.61±0.01</td><td>0.34±nan</td></tr><tr><td>brier score</td><td>1.17±0.05</td><td>1.44±0.07</td><td>1.38±0.02</td><td>1.44±0.04</td><td>1.40±0.01</td><td>1.46±0.07</td><td>1.34±0.02</td><td>1.07±nan</td></tr></table>
418
+
419
+ Table 10: MNIST – 120◦ rotation.
420
+
421
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-3.43±0.07</td><td>-6.73±0.53</td><td>-6.62±0.39</td><td>-7.92±0.59</td><td>-6.73±0.11</td><td>-7.53±0.63</td><td>-6.49±0.36</td><td>-3.07±nan</td></tr><tr><td>error</td><td>0.80±0.02</td><td>0.79±0.02</td><td>0.78±0.01</td><td>0.81±0.01</td><td>0.78±0.01</td><td>0.79±0.02</td><td>0.76±0.02</td><td>0.76±nan</td></tr><tr><td>ECE</td><td>0.40±0.03</td><td>0.62±0.05</td><td>0.58±0.01</td><td>0.65±0.04</td><td>0.59±0.01</td><td>0.63±0.04</td><td>0.58±0.03</td><td>0.30±nan</td></tr><tr><td>brier score</td><td>1.10±0.03</td><td>1.35±0.07</td><td>1.29±0.02</td><td>1.39±0.06</td><td>1.30±0.01</td><td>1.36±0.07</td><td>1.27±0.04</td><td>1.04±nan</td></tr></table>
422
+
423
+ Table 11: MNIST – 135◦ rotation.
424
+
425
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-3.24±0.06</td><td>-6.43±0.38</td><td>-6.46±0.28</td><td>-7.05±0.88</td><td>-6.57±0.10</td><td>-7.24±0.48</td><td>-6.40±0.37</td><td>-2.89±nan</td></tr><tr><td>error</td><td>0.71±0.02</td><td>0.71±0.02</td><td>0.70±0.01</td><td>0.71±0.01</td><td>0.70±0.01</td><td>0.71±0.02</td><td>0.70±0.02</td><td>0.67±nan</td></tr><tr><td>ECE</td><td>0.32±0.01</td><td>0.55±0.03</td><td>0.52±0.01</td><td>0.56±0.02</td><td>0.52±0.01</td><td>0.56±0.03</td><td>0.53±0.02</td><td>0.25±nan</td></tr><tr><td>brier score</td><td>0.99±0.02</td><td>1.21±0.05</td><td>1.17±0.02</td><td>1.22±0.04</td><td>1.17±0.01</td><td>1.23±0.05</td><td>1.18±0.04</td><td>0.94±nan</td></tr></table>
426
+
427
+ Table 12: MNIST – 150◦ rotation.
428
+
429
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-3.25±0.05</td><td>-6.56±0.18</td><td>-6.62±0.33</td><td>-7.04±0.36</td><td>-6.88±0.11</td><td>-7.41±0.25</td><td>-6.39±0.27</td><td>-2.69±nan</td></tr><tr><td>error</td><td>0.63±0.02</td><td>0.63±0.01</td><td>0.63±0.00</td><td>0.65±0.01</td><td>0.62±0.01</td><td>0.63±0.01</td><td>0.63±0.01</td><td>0.60±nan</td></tr><tr><td>ECE</td><td>0.29±0.01</td><td>0.50±0.01</td><td>0.48±0.01</td><td>0.52±0.01</td><td>0.48±0.01</td><td>0.51±0.01</td><td>0.49±0.01</td><td>0.23±nan</td></tr><tr><td>brier score</td><td>0.92±0.02</td><td>1.10±0.02</td><td>1.07±0.01</td><td>1.13±0.02</td><td>1.06±0.01</td><td>1.11±0.02</td><td>1.08±0.02</td><td>0.85±nan</td></tr></table>
430
+
431
+ Table 13: MNIST – 165◦ rotation.
432
+
433
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-3.42±0.12</td><td>-7.01±0.15</td><td>-7.08±0.39</td><td>-7.80±0.12</td><td>−7.51±0.11</td><td>-7.91±0.18</td><td>-6.63±0.24</td><td>-2.67±nan</td></tr><tr><td>error</td><td>0.58±0.01</td><td>0.58±0.01</td><td>0.58±0.01</td><td>0.58±0.00</td><td>0.57±0.01</td><td>0.58±0.01</td><td>0.59±0.00</td><td>0.56±nan</td></tr><tr><td>ECE</td><td>0.32±0.02</td><td>0.49±0.01</td><td>0.48±0.01</td><td>0.49±0.01</td><td>0.48±0.00</td><td>0.51±0.01</td><td>0.48±0.00</td><td>0.25±nan</td></tr><tr><td>brier score</td><td>0.90±0.02</td><td>1.05±0.01</td><td>1.04±0.01</td><td>1.05±0.01</td><td>1.03±0.01</td><td>1.07±0.02</td><td>1.03±0.01</td><td>0.82±nan</td></tr></table>
434
+
435
+ Table 14: MNIST – 180◦ rotation.
436
+
437
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-3.32±0.13</td><td>-6.63±0.18</td><td>-6.87±0.32</td><td>-7.10±0.47</td><td>-7.16±0.16</td><td>-7.43±0.20</td><td>-6.61±0.22</td><td>-2.71±nan</td></tr><tr><td>error</td><td>0.56±0.01</td><td>0.56±0.01</td><td>0.56±0.00</td><td>0.55±0.01</td><td>0.55±0.00</td><td>0.56±0.01</td><td>0.57±0.00</td><td>0.55±nan</td></tr><tr><td>ECE</td><td>0.29±0.02</td><td>0.46±0.01</td><td>0.45±0.00</td><td>0.46±0.00</td><td>0.46±0.01</td><td>0.48±0.01</td><td>0.47±0.01</td><td>0.25±nan</td></tr><tr><td>brier score</td><td>0.86±0.02</td><td>1.00±0.01</td><td>0.99±0.01</td><td>0.99±0.01</td><td>0.99±0.00</td><td>1.01±0.02</td><td>1.01±0.01</td><td>0.82±nan</td></tr></table>
438
+
439
+ Table 15: CIFAR10 – no corruption.
440
+
441
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-0.27±0.00</td><td>-0.43±0.01</td><td>-0.37±0.01</td><td>-0.50±0.02</td><td>-0.21±0.01</td><td>-0.46±0.02</td><td>-0.48±0.01</td><td>-0.61±nan</td></tr><tr><td>error</td><td>0.09±0.00</td><td>0.08±0.00</td><td>0.08±0.00</td><td>0.09±0.00</td><td>0.06±0.00</td><td>0.08±0.00</td><td>0.11±0.00</td><td>0.21±nan</td></tr><tr><td>ECE</td><td>0.01±0.00</td><td>0.06±0.00</td><td>0.04±0.00</td><td>0.06±0.00</td><td>0.01±0.00</td><td>0.06±0.00</td><td>0.07±0.00</td><td>0.03±nan</td></tr><tr><td>brier score</td><td>0.13±0.00</td><td>0.14±0.00</td><td>0.13±0.00</td><td>0.15±0.00</td><td>0.09±0.00</td><td>0.14±0.00</td><td>0.17±0.00</td><td>0.30±nan</td></tr></table>
442
+
443
+ Table 16: CIFAR10 – level 1 corruption.
444
+
445
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-0.51±0.01</td><td>-0.91±0.01</td><td>-0.80±0.02</td><td>−1.03±0.02</td><td>-0.50±0.02</td><td>-0.96±0.02</td><td>-0.89±0.02</td><td>-0.99±nan</td></tr><tr><td>error</td><td>0.17±0.01</td><td>0.16±0.00</td><td>0.16±0.00</td><td>0.17±0.00</td><td>0.13±0.00</td><td>0.16±0.00</td><td>0.17±0.00</td><td>0.32±nan</td></tr><tr><td>ECE</td><td>0.03±0.00</td><td>0.11±0.00</td><td>0.10±0.00</td><td>0.13±0.00</td><td>0.04±0.00</td><td>0.12±0.01</td><td>0.11±0.00</td><td>0.03±nan</td></tr><tr><td>brier score</td><td>0.24±0.00</td><td>0.27±0.00</td><td>0.25±0.00</td><td>0.29±0.00</td><td>0.19±0.00</td><td>0.27±0.01</td><td>0.29±0.00</td><td>0.44±nan</td></tr></table>
446
+
447
+ Table 17: CIFAR10 – level 2 corruption.
448
+
449
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-0.73±0.01</td><td>-1.29±0.06</td><td>-1.20±0.02</td><td>−1.50±0.12</td><td>-0.80±0.01</td><td>-1.40±0.03</td><td>-1.21±0.00</td><td>-1.31±nan</td></tr><tr><td>error</td><td>0.23±0.00</td><td>0.22±0.01</td><td>0.22±0.00</td><td>0.23±0.01</td><td>0.19±0.00</td><td>0.22±0.00</td><td>0.22±0.00</td><td>0.40±nan</td></tr><tr><td>ECE</td><td>0.06±0.00</td><td>0.16±0.01</td><td>0.14±0.00</td><td>0.17±0.01</td><td>0.07±0.00</td><td>0.16±0.00</td><td>0.15±0.00</td><td>0.10±nan</td></tr><tr><td>brier score</td><td>0.33±0.00</td><td>0.37±0.01</td><td>0.35±0.01</td><td>0.40±0.02</td><td>0.28±0.00</td><td>0.37±0.01</td><td>0.37±0.00</td><td>0.56±nan</td></tr></table>
450
+
451
+ Table 18: CIFAR10 – level 3 corruption.
452
+
453
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-1.06±0.02</td><td>-2.06±0.12</td><td>-1.85±0.07</td><td>-2.13±0.17</td><td>-1.28±0.03</td><td>-2.18±0.08</td><td>-1.63±0.03</td><td>-1.83±nan</td></tr><tr><td>error</td><td>0.32±0.01</td><td>0.31±0.01</td><td>0.31±0.01</td><td>0.31±0.01</td><td>0.28±0.00</td><td>0.31±0.01</td><td>0.28±0.00</td><td>0.51±nan</td></tr><tr><td>ECE</td><td>0.11±0.01</td><td>0.24±0.01</td><td>0.21±0.01</td><td>0.24±0.01</td><td>0.12±0.00</td><td>0.24±0.01</td><td>0.20±0.00</td><td>0.19±nan</td></tr><tr><td>brier score</td><td>0.46±0.01</td><td>0.54±0.02</td><td>0.50±0.02</td><td>0.54±0.03</td><td>0.42±0.00</td><td>0.54±0.02</td><td>0.47±0.01</td><td>0.72±nan</td></tr></table>
454
+
455
+ Table 19: CIFAR10 – level 4 corruption.
456
+
457
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>-1.25±0.03</td><td>-2.43±0.18</td><td>-2.28±0.10</td><td>-2.54±0.18</td><td>-1.56±0.05</td><td>-2.57±0.15</td><td>-1.95±0.04</td><td>-1.99±nan</td></tr><tr><td>error</td><td>0.36±0.01</td><td>0.35±0.01</td><td>0.35±0.01</td><td>0.35±0.01</td><td>0.32±0.01</td><td>0.35±0.01</td><td>0.32±0.00</td><td>0.54±nan</td></tr><tr><td>ECE</td><td>0.13±0.01</td><td>0.27±0.01</td><td>0.24±0.01</td><td>0.27±0.01</td><td>0.14±0.01</td><td>0.27±0.02</td><td>0.23±0.00</td><td>0.22±nan</td></tr><tr><td>brier score</td><td>0.51±0.02</td><td>0.60±0.03</td><td>0.57±0.01</td><td>0.61±0.02</td><td>0.47±0.01</td><td>0.60±0.03</td><td>0.53±0.00</td><td>0.76±nan</td></tr></table>
458
+
459
+ Table 20: CIFAR10 – level 5 corruption.
460
+
461
+ <table><tr><td></td><td>OURS</td><td>OURS (RAND)</td><td>DROPOUT</td><td>DIAG-LAP</td><td>ENSEMBLE</td><td>MAP</td><td>SWAG</td><td>VOGN</td></tr><tr><td>LL</td><td>−1.47±0.03</td><td>-2.82±0.11</td><td>-2.71±0.13</td><td>-3.20±0.13</td><td>-1.88±0.05</td><td>-3.03±0.10</td><td>-2.31±0.09</td><td>-2.00±nan</td></tr><tr><td>error</td><td>0.41±0.00</td><td>0.40±0.01</td><td>0.40±0.01</td><td>0.41±0.01</td><td>0.37±0.01</td><td>0.40±0.00</td><td>0.36±0.01</td><td>0.54±nan</td></tr><tr><td>ECE</td><td>0.16±0.01</td><td>0.31±0.01</td><td>0.28±0.01</td><td>0.33±0.02</td><td>0.17±0.01</td><td>0.31±0.01</td><td>0.27±0.01</td><td>0.19±nan</td></tr><tr><td>brier score</td><td>0.58±0.00</td><td>0.69±0.01</td><td>0.65±0.01</td><td>0.72±0.03</td><td>0.55±0.01</td><td>0.69±0.01</td><td>0.61±0.01</td><td>0.75±nan</td></tr></table>
462
+
463
+ # C EXPERIMENTAL SETUP
464
+
465
+ # C.1 TOY EXPERIMENTS
466
+
467
+ We train a single, 2 hidden layer network, with 50 hidden ReLU units per layer using MAP inference until convergence. Specifically, we use SGD with a learning rate of $1 \times 1 0 ^ { - 3 }$ , momentum of 0.9 and weight decay of $1 \times 1 0 ^ { - 4 }$ . We use a batch size of 512. The objective we optimise is the Gaussian log-likelihood of our data, where the mean is outputted by the network and the the variance is a hyperparameter learnt jointly with NN parameters by SGD. This variance parameters is shared among all datapoints. Once the network is trained, we perform post-hoc inference on it using different approaches. Since all of these involve the linearized approximation, the mean prediction is the same for all methods. Only their uncertainty estimates vary.
468
+
469
+ Note that while for this toy example, we could in principle use the full covariance matrix for the purpose of subnetwork selection, we still just use its diagonal (as described in Section 4) for consistency. We use GGN Laplace inference over network weights (not biases) in combination with the linearized predictive distribution in Eq. (8). Thus, all approaches considered share their predictive mean, allowing us to better compare their uncertainty estimates.
470
+
471
+ All approaches share a single prior precision of $\lambda = 3$ . We chose to select the prior precision such that the full covariance approach (optimistic baseline) presents reasonable results. We use the same value for all other methods. We first tried a precision of 1 and found the full covariance approach to produce excessively large errorbars (covering the whole plot). A value of 3 produces more reasonable results.
472
+
473
+ Final layer inference is performed by computing the full Laplace covariance matrix and discarding all entries except those corresponding to the final layer of the NN. Results for random sub-network selection are obtained with a single sample from a scaled uniform distribution over weight choice.
474
+
475
+ # C.2 UCI EXPERIMENTS
476
+
477
+ In this experiment, our fully connected NNs have numbers of hidden layers $h _ { d } = \{ 1 , 2 \}$ and hidden layer widths ${ w _ { d } } \mathrm { { = } } \{ 5 0 , 1 0 0 \}$ . For a dataset with input dimension $i _ { d }$ , the number of weights is given by $D { = } ( i _ { d } { + } 1 ) w _ { d } { + } ( h _ { d } { - } 1 ) \bar { w } _ { d } ^ { 2 }$ . Our 2 hidden layer, 100 hidden unit models have a weight count of the order $1 0 ^ { 4 }$ . The non-linearity used is ReLU.
478
+
479
+ We first obtain a MAP estimate of each model’s weights. Specifically, we use SGD with a learning rate of $1 \times 1 0 ^ { - 3 }$ , momentum of 0.9 and weight decay of $1 \bar { \times } 1 0 ^ { - 4 }$ . We use a batch size of 512. The objective we optimise is the Gaussian log-likelihood of our data, where the mean is outputted by the network and the the variance is a hyperparameter learnt jointly with NN parameters by SGD.
480
+
481
+ For each dataset split, we set aside $1 5 \%$ of the train data as a validation set. We use these for early stopping training. Training runs for a maximum of 2000 epochs but early stops with a patience of 500 if validation performance does not increase. For the larger Protein dataset, these values are 500 and 125. The weight settings which provide best validation performance are kept.
482
+
483
+ We then perform full network GGN Laplace inference for each model. We also use our proposed Wassertein rule together with the diagonal Hessian assumption to prune every network’s weight variances such that the number of variances that remain matches the size of every smaller network under consideration. The prior precision used for these steps is chosen such that the resulting predictor’s logliklihood performance on the validation set is maximised. Specifically, we employ a grid search over the values: $\lambda : [ 0 . 0 0 0 1 , 0 . 0 0 1 , 0 . 1 , 0 . 5 , 1 , 2 , 5 , 1 0 , 1 0 0 , 1 0 0 0 ]$ . In all cases, we employ the linearized predictive in Eq. (7). Consequently, networks with the same number of weights make the same mean predictions. Increasing the number of weight variances considered will thus only increase predictive uncertainty.
484
+
485
+ # C.3 IMAGE EXPERIMENTS
486
+
487
+ The results shown in Section 5.3 and Appendix B are obtained by training ResNet-18 (and ResNet-50) models using SGD with momentum. For each experiment repetition, we train 7 different models: The first is for: ‘MAP’, ‘Ours’, ‘Ours (Rand)’, ‘SWAG’, ‘Diag-Laplace’ and as the first element of ‘Ensemble’. We train 4 additional ‘Ensemble’ elements, 1 network with ‘Dropout’, and, finally 1 network for ‘VOGN’. The methods ‘Ours’, ‘Ours (Rand)’, ‘SWAG’, and ‘Diag-Laplace’ are applied post training.
488
+
489
+ For all methods except ‘VOGN’ we use the following training procedure. The (initial) learning rate, momentum, and weight decay are 0.1, 0.9, and $1 \times \mathrm { i 0 ^ { - 4 } }$ , respectively. For ‘MAP’ we use 4 Nvidia P100 GPUs with a total batch size of 2048. For the calculation of the Jacobian in the subnetwork selection phase we use a single P100 GPU with a batch size of 4. For the calculation of the hessian we use a single P100 GPU with a batch size of 2. We train on 1 Nvidia P100 GPU with a batch size of 256 for all other methods. Each dataset is trained for a different number of epochs, shown in Table 21. We decay the learning rate by a factor of 10 at scheduled epochs, also shown in Table 21. Otherwise, all methods and datasets share hyperparameters. These hyperparameter settings are the defaults provided by PyTorch for training on ImageNet. We found them to perform well across the board. We report results obtained at the final training epoch. We do not use a separate validation set to determine the best epoch as we found ResNet-18 and ResNet-50 to not overfit with the chosen schedules.
490
+
491
+ Table 21: Per-dataset training configuration for image experiments.
492
+
493
+ <table><tr><td>DATASET</td><td>No.EPOCHS</td><td>LR SCHEDULE</td></tr><tr><td>MNIST</td><td>90</td><td>40,70</td></tr><tr><td>CIFAR10</td><td>300</td><td>150,225</td></tr></table>
494
+
495
+ For ‘Dropout’, we add dropout to the standard ResNet-50 model (He et al., 2016) in between the 2 and 3 convolutions in the bottleneck blocks. This approach follows Zagoruyko & Komodakis (2016) and Ashukha et al. (2020b) who add dropout in-between the two convolutions of a WideResNet-50’s basic block. Following Antoran et al. (2020), we choose a dropout probability of 0.1, as they found ´ it to perform better than the value of 0.3 suggested by Ashukha et al. (2020b). We use $\mathrm { \dot { 1 } 6 \mathbf { M } C }$ samples for predictions. ‘Ensemble’ uses 5 elements for prediction. Ensemble elements differ from each other in their initialisation, which is sampled from the He initialisation distribution (He et al., 2015). We do not use adversarial training as, inline with Ashukha et al. (2020b), we do not find it to improve results. For ‘VOGN’ we use the same procedure and hyper-parameters as used by Osawa et al. (2019) in their CIFAR10 experiments, with the exception that we use a learning rate of $1 \times 1 0 ^ { - 3 }$ as we we found a value of $1 \times 1 0 ^ { - 4 }$ not to result in convergence. We train on a single Nvidia P100 GPU with a batch size of 256. See the authors’ GitHub for more details: github.com/team-approx-bayes/dl-with-bayes/blob/master/ distributed/classification/configs/cifar10/resnet18_vogn_bs256_ 8gpu.json.
496
+
497
+ We modify the standard ResNet-50 and ResNet-18 architectures such that the first $7 \times 7$ convolution is replaced with a $3 \times 3$ convolution. Additionally, we remove the first max-pooling layer. Following Goyal et al. (2017), we zero-initialise the last batch normalisation layer in residual blocks so that they act as identity functions at the start of training.
498
+
499
+ At test time, we tune the prior precision used for ‘Ours’, ‘Diag-Laplace’ and ‘SWAG’ approximation on a validation set for each approach individually, as in Ritter et al. (2018); Kristiadi et al. (2020). We use a grid search from $1 \times \bar { 1 } 0 ^ { - 4 }$ to $1 \times 1 0 ^ { 4 }$ in logarithmic steps, and then a second, finer-grained grid search between the two best performing values (again with logarithmic steps).
500
+
501
+ # C.4 DATASETS
502
+
503
+ The 1d toy dataset used in Section 5.1 was taken from Antoran et al. (2020). We obtained it from the ´ authors’ github repo: https://github.com/cambridge-mlg/DUN. Table 22 summarises the datasets used in Section 5.2. Wine and Protein are available from the UCI dataset repository Dua & Graff (2017). $\operatorname { K i n } 8 \mathrm { n m }$ is available from https://www.openml.org/d/189 Foong et al. (2019b). For the standard splits (Hernandez-Lobato & Adams, 2015)´ $90 \%$ of the data is used for training and $10 \%$ for validation. For the gap splits (Foong et al., 2019b) a split is obtained per input dimension by ordering points by their values across that dimension and removing the middle $33 \%$ of the points. These are used for validation. The datasets used for our image experiments are outlined in Table 23.
504
+
505
+ Table 22: Datasets from tabular regression used in Section 5.2
506
+
507
+ <table><tr><td>Dataset</td><td>N Train</td><td>N Val (15% train)</td><td>NTest</td><td>Splits</td><td>Output Dim</td><td> Output Type</td><td>Input Dim</td><td>Input Type</td></tr><tr><td>Wine</td><td>1223</td><td>216</td><td>160</td><td>20</td><td>1</td><td>Continous</td><td>11</td><td>Continous</td></tr><tr><td>Wine Gap</td><td>906</td><td>161</td><td>532</td><td>11</td><td>1</td><td>Continous</td><td>11</td><td>Continous</td></tr><tr><td>Kin8nm</td><td>6267</td><td>1106</td><td>819</td><td>20</td><td>1</td><td>Continous</td><td>8</td><td>Continous</td></tr><tr><td>Kin8nm Gap</td><td>4642</td><td>820</td><td>2730</td><td>8</td><td>1</td><td>Continous</td><td>8</td><td>Continous</td></tr><tr><td>Protein</td><td>34983</td><td>6174</td><td>4573</td><td>5</td><td>1</td><td>Continous</td><td>9</td><td>Continous</td></tr><tr><td>Protein Gap</td><td>25913</td><td>4573</td><td>15244</td><td>9</td><td>1</td><td>Continous</td><td>9</td><td>Continous</td></tr></table>
508
+
509
+ Table 23: Summary of image datasets. The test and train set sizes are shown in brackets, e.g. (test & train).
510
+
511
+ <table><tr><td>NAME</td><td>SIZE</td><td>INPUT DIM.</td><td>No. CLASSES</td><td>NO. SPLITS</td></tr><tr><td>MNIST (LeCun et al., 1998)</td><td>70,000 (60.000&amp;10,000)</td><td>784(28 × 28)</td><td>10</td><td>2</td></tr><tr><td>Fashion-MNIST (Xiao et al.,2017)</td><td>70,000 (60.000 &amp;10.000)</td><td>784(28 × 28)</td><td>10</td><td>2</td></tr><tr><td>CIFAR10(Krizhevsky &amp; Hinton,2009)</td><td>60,000 (50.000&amp;10.000)</td><td>3072(32 ×32 ×3)</td><td>10</td><td>2</td></tr><tr><td>SVHN (Netzer et al., 2011)</td><td>99,289 (73,257&amp; 26,032)</td><td>3072(32 ×32 × 3)</td><td>10</td><td>2</td></tr></table>
md/train/CGFN_nV1ql/CGFN_nV1ql.md ADDED
@@ -0,0 +1,326 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NON-ATTENTIVE TACOTRON: ROBUST AND CONTROLLABLE NEURAL TTS SYNTHESIS INCLUDING UNSUPERVISED DURATION MODELING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ This paper presents Non-Attentive Tacotron based on the Tacotron 2 text-to-speech model, replacing the attention mechanism with an explicit duration predictor. This improves robustness significantly as measured by unaligned duration ratio and word deletion rate, two metrics introduced in this paper for large-scale robustness evaluation using a pre-trained speech recognition model. With the use of Gaussian upsampling, Non-Attentive Tacotron achieves a 5-scale mean opinion score for naturalness of 4.41, slightly outperforming Tacotron 2. The duration predictor enables both utterance-wide and per-phoneme control of duration at inference time. When accurate target durations are scarce or unavailable in the training data, we propose a method using a fine-grained variational auto-encoder to train the duration predictor in a semi-supervised or unsupervised manner, with results almost as good as supervised training.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Autoregressive neural text-to-speech (TTS) models using an attention mechanism are known to be able to generate speech with naturalness on par with recorded human speech. However, these types of models are known to be less robust than traditional approaches (He et al., 2019; Zheng et al., 2019; Guo et al., 2019; Battenberg et al., 2020). These autoregressive networks that predict the output one frame at a time are trained to decide whether to stop at each frame, and thus a misprediction on a single frame can result in serious failures such as early cut-off. Meanwhile, there are little to no hard constraints imposed on the attention mechanism to prevent problems such as repetition, skipping, long pause or babbling. To exacerbate the issue, these failures are rare and are thus often not represented in small test sets, such as those used in subjective listening tests. However, in customer-facing products, even a one-in-a-million chance of such problems can severely degrade the user experience.
12
+
13
+ There have been various works aimed at improving the robustness of autoregressive attention-based neural TTS models. Some of them investigated reducing the effect of the exposure bias on the autoregressive decoder, using adversarial training (Guo et al., 2019) or adding regularization to encourage the forward and backward attention to be consistent (Zheng et al., 2019). Others utilized or designed alternative attention mechanisms, such as Gaussian mixture model (GMM) attention (Graves, 2013; Skerry-Ryan et al., 2018), forward attention (Zhang et al., 2018), stepwise monotonic attention (He et al., 2019), or dynamic convolution attention (Battenberg et al., 2020). Nonetheless, these approaches do not fundamentally solve the robustness issue.
14
+
15
+ Recently, there has been a surge in the use of non-autoregressive models for TTS. Rather than predicting whether to stop on each frame, non-autoregressive models need to determine the output length ahead of time, and one way to do so is with an explicit prediction of the duration for each input token. A side benefit of such a duration predictor is that it is significantly more resilient to the failures afflicting the attention mechanism.
16
+
17
+ However, one-to-many regression problems like TTS can benefit from an autoregressive decoder as the previous mel-spectrogram frames provides context to disambiguate between multi-modal outputs.
18
+
19
+ In this paper, we propose, Non-Attentive Tacotron1, a neural TTS model that combines the robust duration predictor with the autoregressive decoder of Tacotron 2 (Shen et al., 2018).
20
+
21
+ Our work is similar to DurIAN (Yu et al., 2019; Zhang et al., 2020), which incorporates the duration predictor with an autoregressive decoder. But besides the differences in architecture, we also introduce a couple of novel features in our model.
22
+
23
+ The key contributions of this paper are summarized as follows:
24
+
25
+ 1. Replacing the attention mechanism in Tacotron 2 with duration prediction and upsampling modules leading to better robustness with the naturalness matching recorded natural speech;
26
+ 2. Introduction of Gaussian upsampling significantly improving the naturalness compared to vanilla upsampling through repetition;
27
+ 3. Global and fine-grained controlling of durations at inference time;
28
+ 4. Semi-supervised and unsupervised duration modeling of Non-Attentive Tacotron, allowing the model to be trained with few to no duration annotations; and
29
+ 5. More reliable evaluation metrics for measuring robustness of TTS models, as well as comparing Non-Attentive Tacotron with Tacotron 2 with respect to those metrics.
30
+
31
+ # 2 RELATED WORKS
32
+
33
+ In the past decade, model-based TTS synthesis has evolved from hidden Markov model (HMM)-based approaches (Zen et al., 2009) to using deep neural networks. Over this period, the concept of using an explicit representation of token (phoneme) durations has not been foreign. Early neural parametric synthesis models (Zen et al., 2013) require explicit alignments between input and target and include durations as part of the bag of features used to generate vocoder parameters. Explicit durations continue to be used with the advent of the end-to-end neural vocoder WaveNet (Oord et al., 2016) in works such as Deep Voice (Arik et al., 2017; Gibiansky et al., 2017) and CHiVE (Kenter et al., 2019).
34
+
35
+ As general focus turned towards end-to-end approaches, the autoregressive sequence-to-sequence model with attention mechanism used in neural machine translation (NMT) (Bahdanau et al., 2015) and automatic speech recognition (ASR) (Chan et al., 2016) became an attractive option, removing the need to represent durations explicitly. This led to works such as Char2Wav (Sotelo et al., 2017), Tacotron (Wang et al., 2017; Shen et al., 2018), Deep Voice 3 (Ping et al., 2018), and Transformer TTS (Li et al., 2019). Similar models have been used for more complicated problems, like direct speech-to-speech translation (Jia et al., 2019), speech conversion (Biadsy et al., 2019), and speech enhancement (Ding et al., 2020).
36
+
37
+ Tacotron 2, on which our work is based, is one such model. It connects a character-level encoder and an autoregressive decoder producing mel spectrogram frames with the use of a location-sensitive attention mechanism (Chorowski et al., 2015).
38
+
39
+ Recently, there has been a surge of non-autoregressive models, bringing back the use of explicit duration prediction. This approach initially surfaced in NMT (Gu et al., 2017), then made its way into TTS with models such as FastSpeech (Ren et al., 2019; 2020), AlignTTS (Zeng et al., 2020), TalkNet (Beliaev et al., 2020), and JDI-T (Lim et al., 2020). See Appendix C for a rough categorization of these models.
40
+
41
+ To train the duration predictor, FastSpeech uses target durations extracted from a pre-trained autoregressive model in teacher forcing mode, while JDI-T also extracts target durations from a separate autoregressive model but co-trains it with the feed-forward model. TalkNet uses a CTC-based ASR model to extract target durations, while CHiVE, FastSpeech 2, and DurIAN use target durations from an external aligner module utilizing forced alignment. Finally, AlignTTS forgoes target durations completely and uses a specialized alignment loss inspired by the Baum-Welch algorithm to train a mixture density network for alignment.
42
+
43
+ ![](images/ef6245d28d6e5fe72286aed10af02936b934c22bae4b4a6aeddb69c0fa845c3b.jpg)
44
+ Figure 1: Architecture of Non-Attentive Tacotron.
45
+
46
+ # 3 MODEL
47
+
48
+ Modern neural TTS models typically consist of two separate networks: (1) a feature generation network that transforms input tokens (e.g., grapheme or phoneme ids) into acoustic features (e.g., mel-spectrogram), and (2) a vocoder network that transforms the acoustic features into a time-domain audio waveform. This paper focuses on the feature generation network, and can be used with any vocoder network, e.g., WaveNet (Oord et al., 2016), WaveRNN (Kalchbrenner et al., 2018), WaveGlow (Prenger et al., 2019), MelGAN (Kumar et al., 2019), or WaveGrad (Chen et al., 2020). The architecture of Non-Attentive Tacotron is illustrated in Figure 1a. See Appendix A for specific parameter value settings.
49
+
50
+ The model follows that of Tacotron 2 (Shen et al., 2018), transforming input ids $\pmb { X } = ( \pmb { x } _ { 1 } , \dots , \pmb { x } _ { N } )$ of length $N$ into mel-spectrogram predictions $\pmb { Y } = ( \pmb { y } _ { 1 } , \dots , \pmb { y } _ { T } )$ of size $T \times K$ . Phonemes are used as inputs, and include a silence token at word boundaries as well as an end-of-sequence token. The ids are used to index into a learned embedding and is then passed through an encoder consisting of 3 $\times$ (dropout, batch normalization, convolution) layers followed by a single bi-directional LSTM with ZoneOut to generate a 2-dimensional output of length $N$ . This output is concatenated with a speaker embedding vector to produce the final encoder output $\pmb { H } = ( h _ { 1 } , . . . , h _ { N } )$ .
51
+
52
+ The autoregressive decoder also follows Tacotron 2, and predicts mel-spectrograms one frame at a time. At training time, teacher forcing (Williams & Zipser, 1989) is employed and the previous groundtruth mel-spectrogram frame is used as input, while at inference time the previous predicted mel-spectrogram frame is used. This previous frame is passed through a pre-net containing two fully-connected layers of ReLU units with dropout, then concatenated with an upsampled (aligned) encoder output corresponding to the current frame. The upsampled encoder outputs for future frames are not visible to the decoder at the current frame. In Tacotron 2, this upsampling or alignment is achieved using a location-sensitive attention mechanism (Chorowski et al., 2015), while in this work the attention mechanism is not used and a separate upsampling mechanism described later is used in its stead. The result is then passed through two uni-directional LSTM layers with ZoneOut. The LSTM output is concatenated with the upsampled encoder output yet again then projected to the mel-spectrogram dimension as frames of a preliminary predicted spectrogram $\mathbf { { \mathbf { { \mathbf { Y } } ^ { \prime } } } }$ . Once all the mel-spectrogram frames have been predicted, they are passed through a 5-layer batch normalized convolutional post-net with tanh activation on all except the last layer. The post-net predicts a residual to add to the prediction $\mathbf { { \mathbf { { \mathbf { Y } } ^ { \prime } } } }$ to obtain the final prediction $\mathbf { Y }$ .
53
+
54
+ In place of the attention mechanism used in Tacotron 2, duration-based models upsample the encoder outputs using per-token duration information. This can be done by simply repeating each encoder output by its duration as in FastSpeech (Ren et al., 2019), but instead we adopt a different process we call Gaussian upsampling, which is described in subsection 3.1. Note that while durations in seconds are used for loss computation, they are converted to durations in integer frames for upsampling.
55
+
56
+ For Gaussian upsampling, a duration and a range parameter must be predicted for each token. The range parameter is called thus because it controls the range of a token’s influence. The duration predictor passes the encoder output through two bi-directional LSTM layers followed by a projection layer to predict the numeric duration $\pmb { d } \overset { - } { = } ( d _ { 1 } , \ldots , d _ { N } )$ for each input token. During training, these predicted durations are only used for loss computation, and the target durations are used instead in the upcoming steps2. The range parameter predictor passes the encoder output concatenated with durations through two bi-directional LSTM layers followed by a projection layer and a SoftPlus activation to predict a positive range parameter $\sigma$ for each input token.
57
+
58
+ After the encoder outputs are upsampled, a Transformer-style sinusoidal positional embedding (Vaswani et al., 2017) is concatenated. The positional embedding tracks the index of each upsampled frame within each token; if the duration values are [2, 1, 3], the indices for the positional embedding would be $[ 1 , 2 , 1 , 1 , 2 , 3 ]$ .
59
+
60
+ The model is trained using a combination of duration prediction loss and mel-spectrogram reconstruction loss. The duration prediction loss is the $L ^ { 2 }$ loss between predicted and target durations in seconds, and the mel-spectrogram reconstruction loss is a $L ^ { 1 } + L ^ { 2 }$ loss between the predicted and the groundtruth mel-spectrogram both before and after the post-net (following Jia et al. (2018)).
61
+
62
+ $$
63
+ \begin{array} { r l r } { { \mathcal { L } = \mathcal { L } _ { \mathrm { s p e c } } + \lambda _ { \mathrm { d u r } } \mathcal { L } _ { \mathrm { d u r } } } } \\ & { } & { \mathcal { L } _ { \mathrm { d u r } } = \frac { 1 } { N } \| d - d ^ { * } \| _ { 2 } ^ { 2 } } \\ & { } & { \mathcal { L } _ { \mathrm { s p e c } } = \frac { 1 } { T K } \displaystyle \sum _ { t = 1 } ^ { T } \Big ( \| y _ { t } ^ { \prime } - y _ { t } ^ { * } \| _ { 1 } + \| y _ { t } ^ { \prime } - y _ { t } ^ { * } \| _ { 2 } ^ { 2 } + \| y _ { t } - y _ { t } ^ { * } \| _ { 1 } + \| y _ { t } - y _ { t } ^ { * } \| _ { 2 } ^ { 2 } \Big ) } \end{array}
64
+ $$
65
+
66
+ # 3.1 GAUSSIAN UPSAMPLING
67
+
68
+ Given a sequence of vectors to be upsampled $\pmb { H } = ( h _ { 1 } , \ldots , h _ { N } )$ , integer duration values ${ \pmb d } =$ $( d _ { 1 } , \ldots , d _ { N } )$ , and range parameter values ${ \pmb \sigma } = ( \sigma _ { 1 } , \ldots , \sigma _ { N } )$ , we compute the upsampled vector sequence $U = ( \pmb { u } _ { 1 } , \dots , \pmb { u } _ { T } )$ as:
69
+
70
+ $$
71
+ c _ { i } = \frac { d _ { i } } { 2 } + \sum _ { j = 1 } ^ { i - 1 } d _ { j } , \qquad w _ { t i } = \frac { N \left( t ; c _ { i } , \sigma _ { i } ^ { 2 } \right) } { \sum _ { j = 1 } ^ { N } \mathcal { N } \left( t ; c _ { j } , \sigma _ { j } ^ { 2 } \right) } , \qquad \quad u _ { t } = \sum _ { i = 1 } ^ { N } w _ { t i } h _ { i }
72
+ $$
73
+
74
+ That is, we place a Gaussian distribution with standard deviation $\sigma _ { i }$ at the center of the output segment corresponding to the $i$ -th input token as determined by the duration values $^ d$ , and for each frame we take a weighted sum of the encoder outputs in accordance with the values of Gaussian distributions at that frame. This is similar to the softmax-based aligner in Donahue et al. (2020), except a learned $\pmb { \sigma }$ rather than a fixed temperature hyperparameter is used here.
75
+
76
+ Compared with vanilla upsampling by repetition (as in Ren et al. (2019)), which can be seen as a case of learning a hard monotonic attention, Gaussian upsampling results in an alignment that is more akin to single-component GMM attention. Another benefit of Gaussian upsampling is that it is fully differentiable, which is critical to semi-supervised and unsupervised duration modeling (section 4) as it allows the gradients from the spectrogram losses to flow through to the duration predictor.
77
+
78
+ # 3.2 TARGET DURATIONS
79
+
80
+ Neural TTS models using duration need alignments between input tokens and output features. This can be accomplished by implementing an aligner module in the model or by using an external aligner.
81
+
82
+ In our work, target durations are extracted by an external, flatstart trained, speaker-dependent HMMbased aligner with a lexicon (Talkin & Wightman, 1994). However, sometimes it is difficult to train a reliable aligner model and/or extract accurate alignments due to data sparsity, poor recording conditions, or unclear pronunciations. To address this problem, we introduce semi-supervised and unsupervised duration modeling.
83
+
84
+ # 4 SEMI-SUPERVISED AND UNSUPERVISED DURATION MODELING
85
+
86
+ A na¨ıve approach to unsupervised duration modeling would be to simply train the model using the predicted durations (instead of the target durations) for upsampling, and use only mel-spectrogram reconstruction loss for optimization. To match the length between the predicted durations and the target mel-spectrogram frames, the predicted per-token durations can be scaled by $T / \sum _ { i } d _ { i }$ . In addition to that, an utterance-level duration loss $\begin{array} { r } { \mathcal { L } _ { \mathrm { u } } = \frac { 1 } { N } \left( T - \sum _ { i } d _ { i } \right) ^ { 2 } } \end{array}$ could be added to the total loss. However, experiments show that such an approach does not produce satisfying naturalness in the synthesized speech (subsection 6.3).
87
+
88
+ The proposed unsupervised duration modeling is illustrated in Figure 1b. We instead utilize a fine-grained VAE (FVAE) similar to Sun et al. (2020) to model the alignment between the input tokens and the target mel-spectrogram frames, and extract per-token latent features from the target mel-spectrogram based on this alignment. The token encoder output $\pmb { H }$ is aligned to the target spectrogram $Y ^ { * }$ using an attention mechanism following Lee & Kim (2019):
89
+
90
+ $$
91
+ \begin{array} { r } { \pmb { c } _ { i } = \mathrm { A t t n } ( \pmb { h } _ { i } , f _ { \mathrm { s p e c } } ( \pmb { Y } ^ { * } ) ) , } \end{array}
92
+ $$
93
+
94
+ where $\boldsymbol { h } _ { i }$ is used as the query in the attention, and $f _ { \mathrm { s p e c } }$ is a spectrogram encoder whose output per frame is used as the values in the attention. A simple dot-product attention from Luong et al. (2015) was used in this work. A latent feature $z _ { i }$ is then computed from $c _ { i }$ and $\boldsymbol { h } _ { i }$ using a variational auto-encoder (VAE) (Kingma & Welling, 2014) with a Gaussian prior $\mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ , optimized through the evidence lower bound (ELBO):
95
+
96
+ $$
97
+ \log p \left( { Y } \mid { H } \right) \geq - \sum _ { i } D _ { \mathrm { K L } } \left( q \left( \boldsymbol { z } _ { i } \mid h _ { i } , \boldsymbol { c } _ { i } \right) \parallel p \left( \boldsymbol { z } _ { i } \right) \right) + \mathbb { E } _ { q \left( \boldsymbol { z } _ { i } \mid h _ { i } , \boldsymbol { c } _ { i } \right) } \left[ \log p \left( { Y } \mid { H } , \boldsymbol { Z } \right) \right]
98
+ $$
99
+
100
+ where the first term is the KL divergence between the prior and posterior, and the second term can be approximated by drawing samples from the posterior.
101
+
102
+ Because these latent features are extracted from the target spectrogram with an alignment, they are capable of carrying duration related information. At training time, the per-token duration $^ d$ is predicted from the concatenation of the token encoder output $\pmb { H }$ and the posterior latent $z$ ; while at inference time, the prior latent is used for $z$ (either sampled from the distribution or using the distribution mode), and the internal attention mechanism of the FVAE is not used.
103
+
104
+ Unlike Sun et al. (2020), scheduled sampling was not utilized for factorizing latent dimensions. These latent features are only used for duration prediction, and are not used for range parameter prediction or mel-spectrogram reconstruction. We also cap the range parameters for each token to twice its predicted duration in this setup for better training stability. As in section 3, durations predicted in seconds are used for loss computation, but are converted to durations in integer frames for upsampling.
105
+
106
+ The overall loss used for semi-supervised and unsupervised training is thus
107
+
108
+ $$
109
+ \mathcal { L } = \mathcal { L } _ { \mathrm { s p e c } } + \lambda _ { \mathrm { d u r } } \mathcal { L } _ { \mathrm { d u r } } + \lambda _ { \mathrm { u } } \mathcal { L } _ { \mathrm { u } } + \lambda _ { \mathrm { K L } } D _ { \mathrm { K L } } ,
110
+ $$
111
+
112
+ where $D _ { \mathrm { K L } }$ and $\mathcal { L } _ { \mathrm { s p e c } }$ correspond to the first and second terms in Equation 4, respectively, and ${ \mathcal { L } } _ { \mathrm { d u r } }$ is only counted for examples with target duration labels (i.e. supervised examples). The last three terms are all weighted per valid token.
113
+
114
+ # 5 ROBUSTNESS EVALUATION
115
+
116
+ Previous work typically evaluated the robustness of TTS systems on a small set of handpicked “hard cases” (He et al., 2019; Zheng et al., 2019; Guo et al., 2019). Although such evaluation is helpful for guiding improvements, it is not reflective of the overall robustness of the system. The handpicked samples may be biased to the weaknesses of a certain system, and is prone to lead further optimization to overfit to the specific evaluation set.
117
+
118
+ In this work, we evaluate the robustness of TTS systems on large evaluation sets in an automated way by leveraging existing ASR systems. We run ASR and forced alignment evaluations on the synthesized speech against the verbalized text, and report two metrics measuring over- and under-generation:
119
+
120
+ 1. Unaligned duration ratio (UDR): The synthesized speech is forced aligned with the verbalized input text using an ASR system. Each token in the input text is aligned to a segment in the synthesized audio. Any long audio segments $> 1$ second) not aligned to any input token are typically due to over-generation from the TTS system, such as long pauses, babbling, word repetitions, or failures to stop after finishing the utterance. The total duration of such long unaligned segments divided by the total output duration is the UDR. Note that short unaligned segments are ignored. If the synthesized speech is unable to be aligned with the input text, it is considered as having a UDR of $100 \%$ .
121
+ 2. ASR word deletion rate (WDR): This is the deletion error portion in a standard ASR word error rate (WER) evaluation. Under-generation in the synthesized speech, such as early cutoff and word skipping, is reflected by a higher WDR.
122
+
123
+ As the ASR system will make mistakes, the metrics above are just an upper-bound on the actual failures of the TTS system.
124
+
125
+ # 6 EXPERIMENTS
126
+
127
+ All models were trained on a proprietary dataset with 66 speakers with 4 different English accents (US, British, Australian, and Nigerian). The amount of data per speaker varied from merely 5 seconds to 47 hours, totaling 354 hours.
128
+
129
+ A preliminary experiment comparing different attention mechanisms (including monotonic, stepwise monotonic, dynamic convolution and GMM attention (GMMA)) showed that GMMA performed the best. We therefore compared our non-attentive Tacotron not only with Tacotron 2 with locationsensitive attention (LSA) which was used in the original Tacotron 2 paper but also with Tacotron 2 with GMMA. The Tacotron 2 models used reduction factor 2 and $L ^ { 1 } + L ^ { 2 }$ loss.
130
+
131
+ Following Shen et al. (2018), predicted features were obtained in teacher-forcing mode from a Tacotron 2 model and used to train a WaveRNN vocoder which was then used for all experiments.
132
+
133
+ # 6.1 NATURALNESS
134
+
135
+ The naturalness of the synthesized speech was evaluated through subjective listening tests, including 5-scale Mean Opinion Score (MOS) tests and side-by-side preference tests. The sentences were synthesized using 10 US English speakers (5 male / 5 female) in a round-robin fashion. The amount of training data for the evaluated speakers varied from 3 hours to 47 hours.
136
+
137
+ Table 1 contains MOS results. Non-Attentive Tacotron with Gaussian upsampling matched Tacotron 2 (GMMA) in naturalness, and both were close to the groundtruth audio. A preference test between
138
+
139
+ Table 1: MOS with $9 5 \%$ confidence intervals.
140
+
141
+ <table><tr><td>Model</td><td>MOS</td></tr><tr><td>Tacotron 2</td><td></td></tr><tr><td>w/LSA</td><td>4.35 ± 0.05</td></tr><tr><td>w/ GMMA</td><td>4.37 ± 0.04</td></tr><tr><td>Non-Attentive Tacotron w/ Gauss. upsampling</td><td></td></tr><tr><td>w/ vanilla upsampling</td><td>4.41 ± 0.04</td></tr><tr><td></td><td>4.13 ± 0.05</td></tr><tr><td>Ground truth</td><td>4.42 ± 0.04</td></tr></table>
142
+
143
+ ![](images/298c40f45176871a5c45d749a449e03d55efe7148d2e82ce9a206d5b085a6fcd.jpg)
144
+ Figure 2: Preference test result with Non-Attentive Tacotron with Gaussian upsampling compared against Tacotron 2 (GMMA).
145
+
146
+ Non-Attentive Tacotron and Tacotron 2 (GMMA) further confirmed this result, as shown in Figure 2. Non-Attentive Tacotron with vanilla (repeating) upsampling was rated as significantly less natural than with Gaussian upsampling.
147
+
148
+ The effectiveness of a learned range parameter versus a fixed temperature hyperparameter set at 10.0 as per Donahue et al. (2020) is compared using a preference test in Table 2. While there is only a slight perceived benefit in using a learned range parameter, it reduces the need to tune another dataset-dependent hyperparameter. Additionally, in multi-speaker setups it is possible that the optimal $\sigma$ may be speaker-dependent.
149
+
150
+ Table 2: Preference test between a learned $\sigma$ versus a fixed $\sigma$ set at 10.0. Pace is defined as in subsection 6.2. A negative preference value means that the learned $\sigma$ is preferred over the fixed $\sigma$ .
151
+
152
+ <table><tr><td>Pace</td><td>0.8×</td><td>1.0×</td><td>1.25×</td></tr><tr><td></td><td></td><td>Preference -0.017 ±0.057 -0.055±0.054 -0.017±0.055</td><td></td></tr></table>
153
+
154
+ # 6.2 PACE CONTROL
155
+
156
+ Table 3 shows WER and MOS results after modifying the utterance-wide pace by dividing the predicted durations by various factors. The WER is computed on speech synthesized on transcripts from the LibriTTS test-clean subset with the same 10 speakers in subsection 6.1, and then transcribed by an ASR model described in Park et al. (2020) with a WER of $2 . 3 \%$ on the ground truth audio.
157
+
158
+ With pace between $0 . 8 \times - 1 . 2 5 \times$ , the WERs were hardly impacted. The WER was significantly worse when the pace was increased to $1 . 5 \times$ normal, partially because the ASR model used was not optimized for speech so fast. In contrast, the subjective MOS decreased rapidly when the pace was sped up or slowed down significantly. However, most of the comments from raters were simply complaining about the pace, such as “too slow to be natural” $\mathbf { \eta } ^ { ( 0 . 8 \mathbf { x } ) }$ or “way too fast” $( 1 . 2 5 \mathrm { x } )$ .
159
+
160
+ Non-Attentive Tacotron is also able to control the pace of the synthesized speech at a finer granularity, such as per-word or per-phoneme, while still maintain the naturalness of the synthesized speech. Figure 3 shows examples of controlling the pace for specific words in a sentence.
161
+
162
+ ![](images/258a479afa848b55bc11081ce643fbccc1c6df42fb7881e28e3ba4917dd524cd.jpg)
163
+ Figure 3: Single word pace control with sentence “I’m so saddened about the devastation in Big Basin.” The top spectrogram is with regular pace. The rest slow down the words “saddened”, “devastation”, and “Big Basin” respectively to $0 . 6 7 \times$ the regular pace by scaling the predicted duration by $1 . 5 \times$ .
164
+
165
+ Table 3: Performance of controlling the utterance-wide pace of the synthesized speech.
166
+
167
+ <table><tr><td>Pace</td><td>0.67×</td><td>0.8×</td><td>0.9×</td><td>1.0×</td><td>1.11×</td><td>1.25×</td><td>1.5×</td></tr><tr><td>WER</td><td>3.3%</td><td>2.8%</td><td>2.6%</td><td>2.6%</td><td>2.5%</td><td>2.7%</td><td>6.1%</td></tr><tr><td>MOS</td><td>3.28 ± 0.06</td><td>3.87 ± 0.05</td><td>4.24 ± 0.04</td><td>4.41 ± 0.04</td><td>4.28 ± 0.04</td><td>3.79 ± 0.06</td><td>3.18± 0.06</td></tr></table>
168
+
169
+ # 6.3 SEMI-SUPERVISED AND UNSUPERVISED DURATION MODELING
170
+
171
+ Ten different US English speakers (5 male / 5 female) each with about 4 hours of training data were used for evaluating the performance of the unsupervised and semi-supervised duration modeling.
172
+
173
+ ![](images/26daa5ffb38bf9f1cab4ee35f8b59eb8c80db08b72734cb992f60f581080fb60.jpg)
174
+ Figure 4: Alignment on text “What time do I need to show up to my sky diving lesson?” from the unsupervised model. The predicted alignments are from Gaussian upsampling.
175
+
176
+ Table 4: Performance of unsupervised and semi-supervised duration modeling. Zero vectors are used as FVAE latents for inference. MAE denotes the mean absolute error.
177
+
178
+ <table><tr><td>Training</td><td>Model</td><td>Dur. MAE (ms)</td><td>MOS</td></tr><tr><td>Unsupervised</td><td>w/o FVAE</td><td>124.4</td><td>2.91± 0.09</td></tr><tr><td></td><td>w/ FVAE</td><td>41.3</td><td>4.31 ± 0.04</td></tr><tr><td>Semi-supervised</td><td>w/o FVAE</td><td>21.5</td><td>4.19 ± 0.05</td></tr><tr><td>Supervised</td><td>w/FVAE</td><td>18.3</td><td>4.35 ± 0.04</td></tr><tr><td></td><td>Non-Attentive Tacotron</td><td>15.4</td><td>4.37 ± 0.04</td></tr><tr><td></td><td>Tacotron2 w/ GMMA</td><td>-</td><td>4.35 ± 0.04</td></tr><tr><td>Ground truth</td><td></td><td>=</td><td>4.52 ± 0.03</td></tr></table>
179
+
180
+ The duration labels for these 10 speakers (i.e. about $11 \%$ of the training data) were withheld for the semi-supervised models, and all duration labels were withheld for the unsupervised models.
181
+
182
+ Figure 4 shows predicted alignment after Gaussian upsampling and the internal alignment from the attention module in the FVAE compared with the alignment computed from the target durations, for the unsupervised model. Despite not having access to any target durations, both the FVAE and duration predictor were able to produce an alignment close to that computed from the target durations.
183
+
184
+ As shown in Table 4, with the use of the FVAE, the naturalness of both semi-supervised and unsupervised models were very close to that of the supervised models, even though duration prediction errors were higher. The autoregressive decoder trained with teacher forcing may have been powerful enough to correct the duration prediction errors to some degree. However, the naturalness degraded significantly without the use of the FVAE. Although the duration error from the semi-supervised model without FVAE was lower than that from the unsupervised model with FVAE, the former was significantly less natural than the latter. This may be due to a lower consistency between supervised and unsupervised speakers without FVAE.
185
+
186
+ Although these models were close to the supervised model in MOS, manual investigation found that samples from both semi-supervised models and unsupervised models had a small chance of containing slight errors that do not occur in the supervised model, such as unclear pronunciations, phoneme repetitions, or extra pauses. However, they are significantly less severe than similar errors from Tacotron 2, mostly impacting just one or a few phonemes. These errors are further confirmed in the large scale robustness evaluation (subsection 6.4).
187
+
188
+ The utterance-wide or fine-grained pace control (subsection 6.2) can be applied to the semi-supervised and unsupervised models as well. However, as the alignments are not as accurate, the synthesized speech with fine-grained pace control are not as natural as from the supervised model. The duration may be extended by simply inserting more silence, and the extended portion may include phoneme repetitions or unclear pronunciations.
189
+
190
+ Table 5: Robustness measured by UDR and WDR on two large evaluation sets. The evaluation speakers are unsupervised ones in the semi-supervised and unsupervised models.
191
+
192
+ <table><tr><td rowspan="2">System</td><td colspan="2">LibriTTS</td><td colspan="2">web-long</td></tr><tr><td>UDR (%)</td><td>WDR (%)</td><td>UDR (%)</td><td>WDR (%)</td></tr><tr><td>Tacotron 2</td><td></td><td></td><td></td><td></td></tr><tr><td>w/LSA</td><td>16.96</td><td>0.4</td><td>46.04</td><td>4.4</td></tr><tr><td>w/ GMMA</td><td>3.812</td><td>0.1</td><td>6.157</td><td>1.3</td></tr><tr><td>Non-Attentive Tacotron</td><td></td><td></td><td></td><td></td></tr><tr><td>Supervised</td><td>0.005</td><td>0.1</td><td>0.011</td><td>1.1</td></tr><tr><td>Semi-supervised</td><td>0.266</td><td>0.9</td><td>0.695</td><td>3.5</td></tr><tr><td>Unsupervised</td><td>0.223</td><td>0.7</td><td>0.527</td><td>3.2</td></tr></table>
193
+
194
+ # 6.4 ROBUSTNESS
195
+
196
+ We evaluated the robustness of the neural TTS models by measuring UDR and WDR on two large evaluation sets: LibriTTS: 354K sentences from all train subsets from the LibriTTS corpus (Zen et al., 2019); and web-long: 100K long sentences mined from the web, which included a small amount of irregular text such as programming code. The median text lengths of the two sets were 74 and 224 characters, respectively. The input was synthesized using the same 10 speakers in subsection 6.3 in a round-robin fashion. All model outputs were capped at 120 seconds.
197
+
198
+ We used the ASR model trained on the LibriSpeech (Panayotov et al., 2015) and LibriLight (Kahn et al., 2020) corpora from Park et al. (2020) for measuring WDR, and a confidence islands-based forced alignment model (Chiu et al., 2018) for measuring UDR.
199
+
200
+ Table 5 shows the robustness metrics for Tacotron 2 and Non-Attentive Tacotron. Tacotron 2 (LSA) suffered from severe over-generation as measured by UDR, especially on long inputs. Manual investigation uncovered that they were typically long babbling or long silence, often at the end (failure to stop). It also had a high level of under-generation as measured by WDR, typically due to early cutoff. Tacotron 2 (GMMA) performed almost as well as the supervised Non-Attentive Tacotron in WDR because of its soft monotonic nature, which made end-of-sentence prediction easier. However, it still had significantly higher level of over-generation compared to Non-Attentive Tacotron, even when unsupervised or semi-supervised duration modeling is used for the latter. The robustness of semi-supervised and unsupervised Non-Attentive Tacotron is significantly worse than the supervised one. Manual investigation uncovered that the typical failure pattern is that part of the spectrogram is not correctly synthesized (often as silence, but sometimes as babbling), despite that the duration prediction seems reasonable. Such failure pattern contributes to both UDR and WDR. This indicates further improvements to be made. Even then, the semi-supervised and unsupervised Non-Attentive Tacotron still performs significantly better on over-generation compared to Tacotron 2.
201
+
202
+ In practice, we also observed that Tacotron 2 required significantly more care in data preprocessing to achieve this level of robustness, including consistent trimming of leading and trailing silences and filtering out utterances with long pauses. On the other hand, Non-Attentive Tacotron is significantly less sensitive to the data preprocessing steps.
203
+
204
+ # 7 CONCLUSIONS
205
+
206
+ This paper presented Non-Attentive Tacotron, showing a significant improvement in robustness compared to Tacotron 2 as measured by unaligned duration ratio and word deletion rate, while also slightly outperforming it in naturalness. This was achieved by replacing the attention mechanism in Tacotron 2 with an explicit duration predictor and Gaussian upsampling. We demonstrated the ability to control the pacing of the entire utterance as well as individual words using the duration predictor. We also described a method of modeling duration in a semi-supervised or unsupervised manner using Non-Attentive Tacotron when accurate target duration are scarce or unavailable by using a fine-grained variational auto-encoder, with results almost as good as supervised training.
207
+
208
+ # REFERENCES
209
+
210
+ Sercan O Arik, Mike Chrzanowski, Adam Coates, Gregory Diamos, Andrew Gibiansky, Yongguo Kang, Xian Li, John Miller, Andrew Ng, Jonathan Raiman, Shubho Sengupta, and Mohammad Shoeybi. Deep Voice: Real-Time Neural Text-to-Speech. In Proc. ICML, pp. 195–204, 2017.
211
+
212
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural Machine Translation by Jointly Learning to Align and Translate. In Proc. ICLR, 2015.
213
+
214
+ Eric Battenberg, RJ Skerry-Ryan, Soroosh Mariooryad, Daisy Stanton, David Kao, Matt Shannon, and Tom Bagby. Location-Relative Attention Mechanisms For Robust Long-Form Speech Synthesis. In Proc. ICASSP, 2020.
215
+
216
+ Stanislav Beliaev, Yurii Rebryk, and Boris Ginsburg. TalkNet: Fully-Convolutional NonAutoregressive Speech Synthesis Model. arXiv preprint arXiv:2005.05514, 2020.
217
+
218
+ Fadi Biadsy, Ron J. Weiss, Pedro J. Moreno, Dimitri Kanvesky, and Ye. Jia. Parrotron: An End-to-End Speech-to-Speech Conversion Model and its Applications Hearing-Impaired Speech and Speech Separation. In Proc. Interspeech, pp. 4115–4119, 2019.
219
+
220
+ W. Chan, N. Jaitly, Q. Le, and O. Vinyals. Listen, Attend and Spell: A Neural Network for Large Vocabulary Conversational Speech Recognition. In Proc. ICASSP, pp. 4960–4964, 2016.
221
+
222
+ Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, and William Chan. WaveGrad: Estimating Gradients for Waveform Generation. arXiv preprint arXiv:2009.00713, 2020.
223
+
224
+ Chung-Cheng Chiu, Anshuman Tripathi, Katherine Chou, Chris Co, Navdeep Jaitly, Diana Jaunzeikare, Anjuli Kannan, Patrick Nguyen, Hasim Sak, Ananth Sankar, Justin Tansuwan, Nathan Wan, Yonghui Wu, and Xuedong Zhang. Speech Recognition for Medical Conversations. In Proc. Interspeech, pp. 2972–2976, 2018.
225
+
226
+ Jan K Chorowski, Dzmitry Bahdanau, Dmitriy Serdyuk, Kyunghyun Cho, and Yoshua Bengio. Attention-based models for speech recognition. In Proc. NeurIPS, 2015.
227
+
228
+ Shaojin Ding, Ye Jia, Ke Hu, and Quan Wang. Textual Echo Cancellation. arXiv preprint arXiv:2008.06006, 2020.
229
+
230
+ Jeff Donahue, Sander Dieleman, Mikołaj Binkowski, Erich Elsen, and Karen Simonyan. End-to-End ´ Adversarial Text-to-Speech. arXiv preprint arXiv:2006.03575, 2020.
231
+
232
+ Andrew Gibiansky, Sercan Arik, Gregory Diamos, John Miller, Kainan Peng, Wei Ping, Jonathan Raiman, and Yanqi Zhou. Deep voice 2: Multi-speaker neural text-to-speech. In Advances in neural information processing systems, pp. 2962–2970, 2017.
233
+
234
+ Alex Graves. Generating Sequences with Recurrent Neural Networks. arXiv preprint arXiv:1308.0850, 2013.
235
+
236
+ Jiatao Gu, James Bradbury, Caiming Xiong, Victor OK Li, and Richard Socher. Non-autoregressive neural machine translation. arXiv preprint arXiv:1711.02281, 2017.
237
+
238
+ Haohan Guo, Frank K Soong, Lei He, and Lei Xie. A New GAN-based End-to-End TTS Training Algorithm. In Proc. Interspeech, pp. 1288–1292, 2019.
239
+
240
+ Mutian He, Yan Deng, and Lei He. Robust Sequence-to-Sequence Acoustic Modeling with Stepwise Monotonic Attention for Neural TTS. In Proc. Interspeech, pp. 1293–1297, 2019.
241
+
242
+ Ye Jia, Yu Zhang, Ron J. Weiss, Quan Wang, Jonathan Shen, Fei Ren, Zhifeng Chen, Patrick Nguyen, Ruoming Pang, Ignacio Lopez-Moreno, and Yonghui Wu. Transfer Learning from Speaker Verification to Multispeaker Text-To-Speech Synthesis. In Proc. NeurIPS, 2018.
243
+
244
+ Ye Jia, Ron J Weiss, Fadi Biadsy, Wolfgang Macherey, Melvin Johnson, Zhifeng Chen, and Yonghui Wu. Direct Speech-to-Speech Translation with a Sequence-to-Sequence Model. In Proc. Interspeech, pp. 1123–1127, 2019.
245
+
246
+ Jacob Kahn, Morgane Riviere, Weiyi Zheng, Evgeny Kharitonov, Qiantong Xu, Pierre-Emmanuel \` Mazare, Julien Karadayi, Vitaliy Liptchinsky, Ronan Collobert, Christian Fuegen, Tatiana Likhoma- ´ nenko, Gabriel Synnaeve, Armand Joulin, Abdelrahman Mohamed, and Emmanuel Dupoux. Librilight: A Benchmark for ASR with Limited or No Supervision. In Proc. ICASSP, pp. 7669–7673, 2020.
247
+
248
+ Nal Kalchbrenner, Erich Elsen, Karen Simonyan, Seb Noury, Norman Casagrande, Edward Lockhart, Florian Stimberg, Aaron van den Oord, Sander Dieleman, and Koray Kavukcuoglu. Efficient Neural Audio Synthesis. In Proc. ICML, pp. 2410–2419, 2018.
249
+
250
+ Tom Kenter, Vincent Wan, Chun-An Chan, Rob Clark, and Jakub Vit. CHiVE: Varying Prosody in Speech Synthesis with a Linguistically Driven Dynamic Hierarchical Conditional Variational Network. In Proc. ICML, pp. 3331–3340, 2019.
251
+
252
+ Diederik P Kingma and Max Welling. Auto-Encoding Variational Bayes. In Proc. ICLR, 2014.
253
+
254
+ Kundan Kumar, Rithesh Kumar, Thibault de Boissiere, Lucas Gestin, Wei Zhen Teoh, Jose Sotelo, Alexandre de Brebisson, Yoshua Bengio, and Aaron Courville. MelGAN: Generative Adversarial Networks for Conditional Waveform Synthesis. In Proc. NeurIPS, 2019.
255
+
256
+ Younggun Lee and Taesu Kim. Robust and fine-grained prosody control of end-to-end speech synthesis. In Proc. ICASSP, pp. 5911–5915, 2019.
257
+
258
+ Naihan Li, Shujie Liu, Yanqing Liu, Sheng Zhao, and Ming Liu. Neural Speech Synthesis with Transformer Network. In Proc. AAAI, volume 33, pp. 6706–6713, 2019.
259
+
260
+ Dan Lim, Won Jang, Hyeyeong Park, Bongwan Kim, and Jesam Yoon. JDI-T: Jointly Trained Duration Informed Transformer for Text-To-Speech without Explicit Alignment. arXiv preprint arXiv:2005.07799, 2020.
261
+
262
+ Minh-Thang Luong, Hieu Pham, and Christopher D Manning. Effective approaches to attention-based neural machine translation. arXiv preprint arXiv:1508.04025, 2015.
263
+
264
+ Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, ¨ Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. WaveNet: A Generative Model for Raw Audio. arXiv preprint arXiv:1609.03499, 2016.
265
+
266
+ Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. Librispeech: An ASR Corpus Based on Public Domain Audio Books. In Proc. ICASSP, pp. 5206–5210, 2015.
267
+
268
+ Daniel S Park, Yu Zhang, Ye Jia, Wei Han, Chung-Cheng Chiu, Bo Li, Yonghui Wu, and Quoc V Le. Improved Noisy Student Training for Automatic Speech Recognition. In Proc. Interspeech, 2020. to appear.
269
+
270
+ Wei Ping, Kainan Peng, Andrew Gibiansky, Sercan O Arik, Ajay Kannan, Sharan Narang, Jonathan Raiman, and John Miller. Deep Voice 3: Scaling text-to-speech with convolutional sequence learning. In Proc. ICLR, 2018.
271
+
272
+ Ryan Prenger, Rafael Valle, and Bryan Catanzaro. WaveGlow: A Flow-based Generative Network for Speech Synthesis. In Proc. ICASSP, 2019.
273
+
274
+ Yi Ren, Yangjun Ruan, Xu Tan, Tao Qin, Sheng Zhao, Zhou Zhao, and Tie-Yan Liu. FastSpeech: Fast, Robust and Controllable Text to Speech. In Proc. NeurIPS, 2019.
275
+
276
+ Yi Ren, Chenxu Hu, Tao Qin, Sheng Zhao, Zhou Zhao, and Tie-Yan Liu. FastSpeech 2: Fast and High-Quality End-to-End Text-to-Speech. arXiv preprint arXiv:2006.04558, 2020.
277
+
278
+ Jonathan Shen, Ruoming Pang, Ron J. Weiss, Mike Schuster, Navdeep Jaitly, Zongheng Yang, Zhifeng Chen, Yu Zhang, Yuxuan Wang, RJ Skerrv-Ryan, Rif A. Saurous, Yannis Agiomyrgiannakis, and Yonghui Wu. Natural TTS Synthesis by Conditioning WaveNet on Mel Spectrogram Predictions. In Proc. ICASSP, pp. 4779–4783, 2018.
279
+
280
+ RJ Skerry-Ryan, Eric Battenberg, Ying Xiao, Yuxuan Wang, Daisy Stanton, Joel Shor, Ron Weiss, Rob Clark, and Rif A Saurous. Towards End-to-End Prosody Transfer for Expressive Speech Synthesis with Tacotron. In Proc. ICML, pp. 4700–4709, 2018.
281
+
282
+ Jose Sotelo, Soroush Mehri, Kundan Kumar, Joao Felipe Santos, Kyle Kastner, Aaron C. Courville, and Yoshua Bengio. Char2Wav: End-to-End speech synthesis. In Proc. ICLR workshop, 2017.
283
+
284
+ Guangzhi Sun, Yu Zhang, Ron J Weiss, Yuan Cao, Heiga Zen, and Yonghui Wu. Fully-Hierarchical Fine-Grained Prosody Modeling for Interpretable Speech Synthesis. In Proc. ICASSP, pp. 6264– 6268, 2020.
285
+
286
+ David Talkin and Colin W Wightman. The aligner: Text to speech alignment using markov models and a pronunciation dictionary. In The Second ESCA/IEEE Workshop on Speech Synthesis, 1994.
287
+
288
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention Is All You Need. In Proc. NIPS, 2017.
289
+
290
+ Yuxuan Wang, RJ Skerry-Ryan, Daisy Stanton, Yonghui Wu, Ron J Weiss, Navdeep Jaitly, Zongheng Yang, Ying Xiao, Zhifeng Chen, Samy Bengio, Q. Le, Y. Agiomyrgiannakis, R. Clark, and R. Saurous. Tacotron: Towards End-to-End Speech Synthesis. In Proc. Interspeech, pp. 4006– 4010, 2017.
291
+
292
+ Ronald J. Williams and David Zipser. A Learning Algorithm for Continually Running Fully Recurrent Neural Networks. Neural Computation, 1(2):270–280, 1989.
293
+
294
+ Chengzhu Yu, Heng Lu, Na Hu, Meng Yu, Chao Weng, Kun Xu, Peng Liu, Deyi Tuo, Shiyin Kang, Guangzhi Lei, Dan Su, and Dong Yu. DurIAN: Duration informed attention network for multimodal synthesis. arXiv:1909.01700, 2019.
295
+
296
+ H. Zen, K. Tokuda, and A. Black. Statistical Parametric Speech Synthesis. Speech Communication, 51(11):1039–1064, 2009.
297
+
298
+ Heiga Zen, Andrew Senior, and Mike Schuster. Statistical Parametric Speech Synthesis Using Deep Neural Networks. In Proc. ICASSP, pp. 7962–7966, 2013.
299
+
300
+ Heiga Zen, Viet Dang, Rob Clark, Yu Zhang, Ron J Weiss, Ye Jia, Zhifeng Chen, and Yonghui Wu. LibriTTS: A Corpus Derived from LibriSpeech for Text-to-Speech. In Proc. Interspeech, pp. 1526–1530, 2019.
301
+
302
+ Zhen Zeng, Jianzong Wang, Ning Cheng, Tian Xia, and Jing Xiao. AlignTTS: Efficient Feed-Forward Text-to-Speech System without Explicit Alignment. In Proc. ICASSP, pp. 6714–6718, 2020.
303
+
304
+ Jing-Xuan Zhang, Zhen-Hua Ling, and Li-Rong Dai. Forward attention in sequence-to-sequence acoustic modeling for speech synthesis. In Proc. ICASSP, pp. 4789–4793, 2018.
305
+
306
+ Zewang Zhang, Qiao Tian, Heng Lu, Ling-Hui Chen, and Shan Liu. Adadurian: Few-shot adaptation for neural text-to-speech with durian. arXiv preprint arXiv:2005.05642, 2020.
307
+
308
+ Yibin Zheng, Jianhua Tao, Wen. Zhengqi, and Jiangyan Yi. Forward–backward decoding sequence for regularizing end-to-end tts. IEEE/ACM Trans. Audio Speech & Lang. Process., 27(12):2067–2079, 2019.
309
+
310
+ A MODEL PARAMETERS
311
+
312
+ Table 6: Model parameters.
313
+
314
+ <table><tr><td>Common</td><td>Training mode</td><td>Synchronous 32</td></tr><tr><td></td><td>Batch size (per replica) Replicas Parameter init L² regularization Learning rate Learning rate schedule</td><td>Xavier 1 ×10-6 0.001</td></tr><tr><td>Inputs and Targets</td><td>Optimizer LSTM zone-out prob LSTM cell abs value cap Sampling rate (Hz) Normalize waveform Pre-emphasis Frame size (ms) Frame hop (ms)</td><td>decay half every 50K steps. Adam(0.9,0.999,1 × 10-6) 0.1 10.0 24,000 No No 50</td></tr><tr><td>Encoder</td><td>Mel channels K Mel frequency lower bound (Hz) Mel frequency upper bound (Hz)</td><td>128 20 12,000</td></tr><tr><td>FVAE</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>Yes</td></tr><tr><td></td><td></td><td>512×2</td></tr><tr><td></td><td></td><td>5×1</td></tr><tr><td></td><td></td><td>512 64</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td>Mel spectrogram dynamic range compression</td><td>log(x +0.001)</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td>Token embedding dim</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td>Speaker embedding dim</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td>Conv kernel</td><td></td></tr><tr><td></td><td>Conv dim</td><td>[512, 512, 512]</td></tr><tr><td></td><td>Conv activation</td><td>[None,None,None]</td></tr><tr><td></td><td>Conv batch norm decay</td><td>0.999</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td>Bi-LSTM dim</td><td></td></tr><tr><td></td><td>Segment encoder conv kernel</td><td>3×1</td></tr><tr><td></td><td>Segment encoder conv dim</td><td>[512,512,512]</td></tr><tr><td></td><td>Segment encoder Bi-LSTM dim</td><td>256×2</td></tr><tr><td></td><td>Layer norm attention inputs</td><td></td></tr><tr><td></td><td>Latent dim</td><td>8 projected to 16</td></tr><tr><td>Duration Predictor</td><td>Bi-LSTM dim</td><td>512×2</td></tr><tr><td></td><td>Projection activation</td><td>None</td></tr><tr><td></td><td>Xdur supervised</td><td>2.0</td></tr><tr><td></td><td>Xdur semi-supervised</td><td>100.0</td></tr><tr><td></td><td></td><td>100.0</td></tr><tr><td></td><td>Au semi-supervised</td><td>1×10-3</td></tr><tr><td></td><td>XKL semi-supervised</td><td></td></tr><tr><td></td><td>Xu unsupervised</td><td>1.0</td></tr><tr><td>Range Parameter Predictor</td><td>入KL unsupervised</td><td>1 ×10-4</td></tr><tr><td></td><td>Bi-LSTM dim</td><td>512×2</td></tr><tr><td>Positional Embedding</td><td>Projection activation</td><td>SoftPlus</td></tr><tr><td></td><td>Embedding dim</td><td>32</td></tr><tr><td></td><td>Timestep denominator</td><td>10.000</td></tr><tr><td>Decoder</td><td></td><td>[256,256]</td></tr><tr><td></td><td>Pre-net dim supervised</td><td></td></tr><tr><td></td><td>Pre-net dim semi/unsupervised</td><td>[128,128]</td></tr><tr><td></td><td>Pre-net activation</td><td>[ReLU,ReLU]</td></tr><tr><td></td><td></td><td>[0.5,0.5]</td></tr><tr><td></td><td>Pre-net dropout prob</td><td></td></tr><tr><td></td><td>LSTM dim^</td><td>1,024</td></tr><tr><td></td><td>LSTM init</td><td>uniform(0.1)</td></tr><tr><td></td><td>Projection init</td><td>uniform(0.1)</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td>Post-net conv kernel</td><td>5×1</td></tr><tr><td></td><td>Post-net conv dim</td><td></td></tr><tr><td></td><td></td><td>[512,512,512,512,128]</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>Post-net conv activation</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>[tanh,tanh,tanh,tanh,None]</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><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><tr><td>Post-net conv init</td><td></td><td></td></tr></table>
315
+
316
+ # B WER BREAKDOWNS IN THE ROBUSTNESS EVALUATION
317
+
318
+ Table 7: WER breakdowns in the robustness evaluation. Deletion rate (del) is the WDR in Table 5.
319
+
320
+ <table><tr><td rowspan="2">System</td><td colspan="4">LibriTTS</td><td colspan="4">web-long</td></tr><tr><td>WER</td><td>del</td><td>ins</td><td>sub</td><td>WER</td><td>del</td><td>ins</td><td>sub</td></tr><tr><td>Tacotron 2</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>w/LSA</td><td>1.8</td><td>0.4</td><td>0.3</td><td>1.1</td><td>13.0</td><td>4.4</td><td>2.0</td><td>6.7</td></tr><tr><td>w/ GMMA</td><td>1.7</td><td>0.1</td><td>0.1</td><td>1.5</td><td>10.1</td><td>1.3</td><td>1.3</td><td>7.4</td></tr><tr><td>Non-Attentive Tacotron</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Supervised</td><td>1.4</td><td>0.1</td><td>0.1</td><td>1.2</td><td>9.3</td><td>1.1</td><td>1.3</td><td>6.9</td></tr><tr><td>Semi-supervised</td><td>3.3</td><td>0.9</td><td>0.2</td><td>2.2</td><td>14.1</td><td>3.5</td><td>1.6</td><td>9.0</td></tr><tr><td>Unsupervised</td><td>3.5</td><td>0.7</td><td>0.3</td><td>2.6</td><td>15.3</td><td>3.2</td><td>2.0</td><td>10.1</td></tr></table>
321
+
322
+ # C CLASSIFICATION OF SOME TTS MODELS
323
+
324
+ Table 8: Classification of some TTS models into autoregressive (AR)/feed-forward (FF), RNN/Transformer/fully convolutional, and attention-based/duration-based.
325
+
326
+ <table><tr><td>Model</td><td>Year</td><td>AR</td><td>FF</td><td>RNN</td><td>Transformer</td><td>Full Conv</td><td>Attention</td><td>Duration</td></tr><tr><td>Deep Voice</td><td>2017</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Char2Wav</td><td>2017</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Tacotron</td><td>2017</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Deep Voice 2</td><td>2017</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Tacotron 2</td><td>2018</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Deep Voice 3</td><td>2018</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Transformer TTS</td><td>2019</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>CHiVE</td><td>2019</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DurIAN</td><td>2019</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Fastspeech</td><td>2019</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>TalkNet</td><td>2020</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>AlignTTS</td><td>2020</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>JDI-T</td><td>2020</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Non-Attentive Tacotron</td><td>2020</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
md/train/CLnj31GZ4cI/CLnj31GZ4cI.md ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # K-ADAPTER: INFUSING KNOWLEDGE INTO PRETRAINED MODELS WITH ADAPTERS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We study the problem of injecting knowledge into large pre-trained models like BERT and RoBERTa. Existing methods typically update the original parameters of pre-trained models when injecting knowledge. However, when multiple kinds of knowledge are injected, they may suffer from catastrophic forgetting. To address this, we propose K-ADAPTER, which retains the original parameters of the pre-trained model fixed and supports continual knowledge infusion. Taking RoBERTa as the pre-trained model, K-ADAPTER has a neural adapter for each kind of infused knowledge, like a plug-in connected to RoBERTa. There is no information flow between different adapters, thus different adapters are efficiently trained in a distributed way. We inject two kinds of knowledge, including factual knowledge obtained from automatically aligned text-triplets on Wikipedia and Wikidata, and linguistic knowledge obtained from dependency parsing. Results on three knowledge-driven tasks (total six datasets) including relation classification, entity typing and question answering demonstrate that each adapter improves the performance, and the combination of both adapters brings further improvements. Probing experiments further indicate that K-ADAPTER captures richer factual and commonsense knowledge than RoBERTa.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Language representation models, which are pre-trained on large-scale text corpus through unsupervised objectives like (masked) language modeling, such as BERT (Devlin et al., 2019) GPT (Radford et al., $\boxed { 2 0 1 8 } \boxed { 2 0 1 9 }$ , XLNet (Yang et al., 2019), RoBERTa (Liu et al., 2019) and T5 (Raffel et al., 2019), have established state-of-the-art performances on various NLP downstream tasks.
12
+
13
+ Despite the huge success of these pre-trained models in empirical studies, recent studies suggest that models learned in such an unsupervised manner struggle to capture rich knowledge. For example, Poerner et al. (2019) suggest that although language models do well in reasoning about the surface form of entity names, they fail in capturing rich factual knowledge. Kassner & Schutze (2019) ¨ observe that BERT mostly did not learn the meaning of negation (e.g. “not”). These observations motivate us to study the injection of knowledge into pre-trained models like BERT and RoBERTa.
14
+
15
+ Recently, some efforts have been made to exploit injecting knowledge into pre-trained language models (Zhang et al., 2019; Lauscher et al., 2019; Levine et al., 2019; Peters et al., 2019; He et al., 2019; Xiong et al., 2020). Most previous works (as shown in Table 1) augment the standard language modeling objective with knowledge-driven objectives and update model parameters in a multi-task learning manner. Although these methods, with updated pre-trained models, obtain better performance on downstream tasks, they fail at continual learning (Kirkpatrick et al., 2017). Model parameters need to be retrained when new kinds of knowledge are injected, which may result in the catastrophic forgetting of previously injected knowledge. Meanwhile, the resulting pre-trained models produce entangled representations, which makes it hard to investigate the effect of each knowledge when multiple kinds of knowledge are injected.
16
+
17
+ In this paper, we propose K-ADAPTER, a flexible and simple approach that infuses knowledge into large pre-trained models. K-ADAPTER has attractive properties including supporting continual knowledge infusion and producing disentangled representations. It leaves the original representation of a pre-trained model unchanged and exports different representations for different types of infused knowledge. This is achieved by the integration of compact neural models, dubbed adapters here.
18
+
19
+ Table 1: Comparison between our approach (K-ADAPTER) and previous works on injecting knowledge into BERT.
20
+
21
+ <table><tr><td rowspan=1 colspan=3>Model</td><td rowspan=1 colspan=1>Knowledge Source</td><td rowspan=1 colspan=1>Objective</td><td rowspan=1 colspan=1>BERT fixedin training?</td><td rowspan=1 colspan=1>Continual knowl-edge infusion?</td></tr><tr><td></td><td rowspan=1 colspan=2>ERNIEZhang et al.2019</td><td rowspan=1 colspan=1>Wikipedia,WikiData</td><td rowspan=1 colspan=1>entity linking</td><td rowspan=1 colspan=1>N</td><td rowspan=1 colspan=1>N</td></tr><tr><td></td><td rowspan=1 colspan=1>LIBERT</td><td rowspan=2 colspan=1>Lauscher</td><td rowspan=2 colspan=1>WordNet</td><td rowspan=2 colspan=1>synonym word prediction,hyponym-hypernym prediction</td><td rowspan=2 colspan=1>from scratch</td><td rowspan=2 colspan=1>N</td></tr><tr><td></td><td rowspan=1 colspan=1>et al.,</td></tr><tr><td></td><td rowspan=1 colspan=1>Seal.</td><td rowspan=1 colspan=1>Levineet al.2019]</td><td rowspan=1 colspan=1>WordNet</td><td rowspan=1 colspan=1>word-supersense prediction</td><td rowspan=1 colspan=1>from scratch</td><td rowspan=1 colspan=1>N</td></tr><tr><td></td><td rowspan=1 colspan=1>Knov</td><td rowspan=1 colspan=1>(Peters</td><td rowspan=2 colspan=1>Wordnet,Wikipedia,CrossWikis</td><td rowspan=2 colspan=1>entity linking,hypernym link-ing</td><td rowspan=2 colspan=1>N</td><td rowspan=2 colspan=1>N</td></tr><tr><td></td><td rowspan=1 colspan=1>et al.,</td><td rowspan=1 colspan=1>2019</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2020</td><td rowspan=1 colspan=1>WKLM (Xiong et al.</td><td rowspan=1 colspan=1>WikiPedia,WikiData</td><td rowspan=1 colspan=1>replaced entity detection</td><td rowspan=1 colspan=1>N</td><td rowspan=1 colspan=1>N</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>2019]</td><td rowspan=1 colspan=1>(He et al.</td><td rowspan=1 colspan=1>Unified Medical Lan-guage System</td><td rowspan=1 colspan=1>discriminate between real andfake facts</td><td rowspan=1 colspan=1>N</td><td rowspan=1 colspan=1>N</td></tr><tr><td rowspan=1 colspan=3>K-Adapter (this work)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>K-Ac</td><td rowspan=1 colspan=1>Wikipedia,Wikidata,dependency parser</td><td rowspan=1 colspan=1>predication prediction,depen-dency relation prediction</td></tr></table>
22
+
23
+ Adapters are knowledge-specific models plugged outside of a pre-trained model, whose inputs are the output hidden-states of intermediate layers of the pre-trained model. We take RoBERTa (Liu et al., $\bar { 2 0 1 9 } )$ as the base pre-trained model and integrate two types of knowledge, including factual knowledge obtained by aligned Wikipedia text to Wikidata triplets, linguistic knowledge obtained by applying off-the-shell dependency parser to web texts. In the pre-training phase, we train two adapters independently on relation classification task and dependency relation prediction task respectively, while keeping the original parameters of RoBERTa frozen. Since adapters have much less trainable parameters compared with RoBERTa, the training process is memory efficient.
24
+
25
+ We conduct extensive experiments on six benchmark datasets across three knowledge-driven tasks, i.e., relation classification, entity typing and question answering. Experiments show that KADAPTER consistently performs better than RoBERTa, and achieves state-of-the-art performance on five datasets, and comparable performance compared with CosmosQA SOTA. Probing experiments on LAMA $\mathrm { ( } \mathbf { \overline { { P o e r n e r ~ e t ~ a l . } } ) } \mathbf { \overline { { 2 0 1 9 } } } \mathrm { ) }$ and LAMA-UHN (Petroni et al., 2019), further demonstrates that K-ADAPTER captures richer factual and commonsense knowledge than RoBERTa.
26
+
27
+ The contributions of this paper are summarized as follows:
28
+
29
+ • We propose K-ADAPTER, a flexible approach that supports continual knowledge infusion into large pre-trained models (e.g. RoBERTa in this work).
30
+ • We infuse factual knowledge and linguistic knowledge, and show that adapters for both kinds of knowledge work well on downstream tasks.
31
+ • K-ADAPTER achieves superior performance by fine-tuning parameters on three downstream tasks, and captures richer factual and commonsense knowledge than RoBERTa on probing experiments.
32
+
33
+ # 2 RELATED WORK
34
+
35
+ Our work relates to the area of injecting knowledge into pre-trained models. As stated in Table 1, previous works mainly differ from the knowledge sources and the objective used for training.
36
+
37
+ ERNIE (Zhang et al., 2019) injects a knowledge graph into BERT. They align entities from Wikipedia sentences to fact triples in WikiData, and discard sentences with less than three entities. In the training process, the input includes sentences and linked facts, and the knowledge-aware learning objective is to predict the correct token-entity alignment. Entity embeddings are trained on fact triples from WikiData via TransE (Bordes et al., 2013). LIBERT (Lauscher et al., 2019) injects pairs of words with synonym and hyponym-hypernym relations in WordNet. The model takes a pair of words separated by a special token as the input, and is optimized by a binary classification problem, which predicts whether the input holds a particular relation or not. SenseBERT (Levine et al., $\bigstar \underline { { 2 0 1 9 } } \bigstar$ considers word-supersense knowledge. It inject knowledge by predicting the supersense of the masked word in the input, where the candidates are nouns and verbs and the ground truth comes from WordNet. KnowBERT (Peters et al., 2019) incorporates knowledge bases into BERT using Knowledge attention and recontextualization, where the knowledge comes from synset-synset and lemma-lemma relationships in WordNet, and entity linking information in Wikipedia. If entity linking supervision is available, the model is learned with an additional knowledge-aware log-likelihood or max-margin objective. WKLM (Xiong et al., 2020) replaces entity mentions in the original document with names of other entities of the same type. The model is trained to distinguish the correct entity mention from randomly chosen ones. BERT-MK $( \mathbb { H } \mathrm { e } \mathrm { e t } \mathrm { a l . } , [ 2 0 1 9 ] )$ integrates fact triples from knowledge graph. For each entity, it sample incoming and outcoming instances from the neighbors on the knowledge graph, and replaces head or tail entity to create negative instances. The model is learned to discriminate between real and fake facts.
38
+
39
+ ![](images/405c8aa3a82bd46b6e8aa2f63d6a5af1d2a26f8824692d26c293b7dd07070303.jpg)
40
+ Figure 1: (a) Pre-trained language models inject multiple kinds of knowledge with multi-task learning. Model parameters need to be retrained when injecting new kinds of knowledge, which may result in the catastrophic forgetting (b) Our K-ADAPTER injects multiple kinds of knowledge by training adapters independently on different pre-train tasks, which supports continual knowledge infusion. When we inject new kinds of knowledge, the existing knowledge-specific adapters will not be affected. KIA represents the adapter layer and TRM represents the transformer layer, both of which are shown in Figure 2.
41
+
42
+ As shown in Table 1, our model (K-ADAPTER) differs from previous studies in three aspects. First, we consider both fact-related objective (i.e. predicate/relation prediction) and linguistic-related objective (i.e. dependency relation prediction). Second, the original parameter of BERT is clamped in the knowledge infusion process. Third, our approach supports continual learning, which means that the learning of different adapters are not entangled. This flexibility enables us to efficiently inject different types of knowledge independently, and inject more types of knowledge without any loss on the previously injected knowledge.
43
+
44
+ ![](images/4ceedc5d7287cd20d15c2340cc90ba58c2aadc28a29f762a590edfad4beba1ae.jpg)
45
+ Figure 2: Structure of the adapter layer (left). The adapter layer consists of two projection layers and $N { = } 2$ transformer layers, and a skip-connection between two projection layers.
46
+
47
+ # 3 K-ADAPTER
48
+
49
+ As illustrated in Figure $^ 1$ (a), most of the previous works enhance pre-trained language models by injecting knowledge and update model parameters through multi-task learning. Regardless of these different versions of knowledge-injected methods with multi-task learning, common issues not fully studied are catastrophic forgetting of previous knowledge. To address this, we present KADAPTER as shown in Figure $\textcircled { 1 } ( \mathsf { b } )$ , where multiple kinds of knowledge are injected into different compact neural models (i.e., adapters in this paper) individually instead of directly injecting knowledge into pre-trained models. It keeps the original representation of a pre-trained model fixed and supports continual knowledge infusion, i.e., injecting each kind of knowledge into the corresponding knowledge-specific adapter and producing disentangled representation. Specifically, adapters are knowledge-specific models (with few parameters) plugged outside of a pre-trained model. The inputs of adapters are the output hidden-states of intermediate layers of the pre-trained model. Each adapter is pre-trained independently on different tasks for injecting discriminative knowledge while the original parameters of the pre-trained model are frozen. In this paper, we exploit RoBERTa (Liu et al., 2019) as the pre-trained model, and mainly infuse factual knowledge and linguistic knowledge with two kinds of adapters, i.e., factual adapter and linguistic adapter which are pre-trained on the relation classification task and dependency relation prediction task respectively. In this section, we first describe the structure of our adapter, and then present the process of pre-training knowledgespecific adapters.
50
+
51
+ # 3.1 ADAPTER STRUCTURE
52
+
53
+ In this work, we present a different adapter structure as shown in Figure $\bigtriangledown$ which is referred to as the knowledge-specific adapter. In contrast to Houlsby et al. $\underline { { \left( 2 0 1 9 \right) } }$ add adapter layers into each transformer layer, our adapter works as outside plug-ins. Each adapter model consists of $K$ adapter layers that contain $N$ transformer $( \mathrm { \overline { { V a s w a n i \ e t { \ a l . } } } } ) \mathrm { \overline { { 2 0 1 7 } } ) }$ layers and two projection layers. A skipconnection is applied across two projection layers. Specifically, for each adapter model, we plug adapter layers among different transformer layers of the pre-trained model. We concatenate the output hidden feature of the transformer layer in the pre-trained model and the output feature of the former adapter layer, as the input feature of the current adapter layer. For each knowledge-specific adapter, we concatenate the last hidden features of the pre-trained model and adapter as the final output feature of this adapter model.
54
+
55
+ In the pre-training procedure, we train each knowledge-specific adapter on different pre-training tasks individually. For various downstream tasks, K-ADAPTER can adopt the fine-tuning procedure similar to RoBERTa and BERT. When only one knowledge-specific adapter is adopted, we can take the final output feature of this adapter model as the input for task-specific layers of the downstream task. When multiple knowledge-specific adapters are adopted, we concatenate the output features of different adapter models as the input for task-specific layers of the downstream task.
56
+
57
+ # 3.2 PRE-TRAINING SETTINGS
58
+
59
+ We use RoBERTaLARGE $\mathrm { L } { = } 2 4$ , $_ { \mathrm { H } = 1 0 2 4 }$ , $_ { \mathrm { A = } 1 6 }$ , 355M params) implementation by Huggingface1 as the pre-trained model in all our experiments. As for each adapter layer, we denote the number of transformer layer as $N$ , the hidden dimension of transformer layer as $H _ { A }$ , the number of selfattention heads as $A _ { A }$ , the hidden dimension of down-projection and up-projection layers as $H _ { d }$ and $H _ { u }$ . In detail, we have the following adapter size: $N = 2$ , $H _ { A } = 7 6 8$ , $A _ { A } = 1 2$ , $H _ { u } = 1 0 2 4$ and $H _ { d } = 7 6 8$ . The RoBERTa layers where adapter layers plug in are $\{ 0 , 1 1 , 2 3 \}$ , and different adapter layers do not share parameters. Thus the total parameters for each adapter model are about 42M, which are much smaller than $\mathrm { R o B E R T a } _ { L A R G E }$ and make the training process memory efficient. It should be noticed that RoBERTa is fixed during training and the parameters of adapters are trainable and initialized randomly. Then we describe how to inject different knowledge into knowledgespecific adapters as below.
60
+
61
+ # 3.3 FACTUAL ADAPTER
62
+
63
+ Factual knowledge can be described as the basic information that is concerned with facts. In this work, we acquire factual knowledge from the relationships among entities in natural language. We extract a sub-dataset T-REx-rc from T-REx (ElSahar et al., 2018) which is a large scale alignment dataset between Wikipedia abstracts and Wikidata triples. We discard all relations having less than 50 entity pairs, collecting 430 relations and $5 . 5 { \mathrm { M } }$ sentences. In order to inject factual knowledge, we propose to pre-train a knowledge-specific adapter called facAdapter on the relation classification task. This task requires a model to classify relation labels of given entity pairs based on context. Specifically, the last hidden features of RoBERTa and facAdapter are concatenated as the input representation, and the pooling layer is applied to the input representations of the given entities. Then, we concatenate two entity representations to perform relation classification.
64
+
65
+ Table 2: Results on two entity typing datasets OpenEntity and FIGER.
66
+
67
+ <table><tr><td rowspan="2" colspan="2">Model</td><td colspan="3">OpenEntity</td><td colspan="3">FIGER</td></tr><tr><td>P</td><td>R</td><td>Mi-F1</td><td>Acc</td><td>Ma-F1</td><td>Mi-F1</td></tr><tr><td>NFGEC (Shimaoka et al.</td><td>2016</td><td>68.80</td><td>53.30</td><td>60.10</td><td>55.60</td><td>75.15</td><td>71.73</td></tr><tr><td>BERT-base (Zhang et al.</td><td>12019</td><td>76.37</td><td>70.96</td><td>73.56</td><td>52.04</td><td>75.16</td><td>71.63</td></tr><tr><td>ERNIE (Zhang et al.[2019)</td><td></td><td>78.42</td><td>72.90</td><td>75.56</td><td>57.19</td><td>75.61</td><td>73.39</td></tr><tr><td>KnowBERT (Peters et al1|2019)</td><td></td><td>78.60</td><td>73.70</td><td>76.10</td><td>1</td><td>-</td><td>1</td></tr><tr><td> KEPLER (Wang et al.2019)</td><td></td><td>77.20</td><td>74.20</td><td>75.70</td><td>1</td><td>-</td><td>1</td></tr><tr><td>WKLM Xiong et al., [2020</td><td></td><td>-</td><td>1</td><td>-</td><td>60.21</td><td>81.99</td><td>77.00</td></tr><tr><td colspan="2">RoBERTa</td><td>77.55</td><td>74.95</td><td>76.23</td><td>56.31</td><td>82.43</td><td>77.83</td></tr><tr><td colspan="2">RoBERTa+multitask</td><td>77.96</td><td>76.00</td><td>76.97</td><td>59.86</td><td>84.45</td><td>78.84</td></tr><tr><td colspan="2">K-ADAPTER (F+L)</td><td>78.99</td><td>76.27</td><td>77.61</td><td>61.81</td><td>84.87</td><td>80.54</td></tr><tr><td colspan="2">K-ADAPTER (F)</td><td>79.30</td><td>75.84</td><td>77.53</td><td>59.50</td><td>84.52</td><td>80.42</td></tr><tr><td colspan="2">K-ADAPTER (L)</td><td>80.01</td><td>74.00</td><td>76.89</td><td>61.10</td><td>83.61</td><td>79.18</td></tr><tr><td colspan="2">K-ADAPTER (w/o knowledge)</td><td>74.47</td><td>74.91</td><td>76.17</td><td>56.93</td><td>82.56</td><td>77.90</td></tr></table>
68
+
69
+ # 3.4 LINGUISTIC ADAPTER
70
+
71
+ Linguistic knowledge is implicitly contained in natural language texts, e.g., syntactic and semantic information. In this work, we acquire linguistic knowledge from dependency relationships among words in natural language text. We build a dataset consisting of 1M examples. In particular, we run the off-the-shell dependency parser from Stanford Parser2 on a part of Book Corpus $( \mathbb { Z } \mathrm { h u } \mathrm { ~ e t ~ a l . , } \mathbb { Z } 0 1 5 )$ . To inject linguistic knowledge, we pre-train another knowledge-specific adapter called linAdapter on the task of dependency relation prediction. This task aims to predict the head index of each token in the given sentence. We concatenate the last hidden features of RoBERTa and linAdapter as the input representation, and then apply a linear layer to input representations of each token to perform classification. More training details of facAdapter and linAdapter can be found in the supplementary material.
72
+
73
+ # 4 EXPERIMENTS
74
+
75
+ We evaluate our K-ADAPTER on three knowledge-driven downstream tasks, i.e., entity typing, question answering and relation classification. Furthermore, we conduct probing experiments to examine the ability of models for learning factual knowledge. The notations of K-ADAPTER $\left( \mathrm { F } { + } \mathrm { L } \right)$ , K-ADAPTER $( \mathrm { F } )$ , and K-ADAPTER (L) denote our model which consists of both factual adapter and linguistic adapter, only factual adapter and only linguistic adapter, respectively. The implementation details, and statistics of datasets are in the supplementary material.
76
+
77
+ # 4.1 ENTITY TYPING
78
+
79
+ We conduct experiments on fine-grained entity typing which aims to predict the types of a given entity and its context. We evaluate our models on OpenEntity (Choi et al., 2018) and FIGER $\mathbf { \bar { \mathbb { E } } ^ { i n g } }$ et al., 2015) following the same split setting as Zhang et al. $\textcircled { 1 2 0 1 9 }$ . To fine-tune our models for entity typing, we modify the input token sequence by adding the special token “ $@$ ” before and after a certain entity, then the first “ $@$ ” special token representation is adopted to perform classification. As for OpenEntity, we adopt micro $F _ { 1 }$ score as the final metric to represent the model performance. As for FIGER, we adopt strict accuracy, loose macro, loose micro $F _ { 1 }$ scores (Ling & Weld, 2012) for evaluation following the same evaluation criteria used in previous works.
80
+
81
+ Baselines NFGEC (Shimaoka et al., 2016) employs attentive recursive neural networks to compose context representations. KEPLER (Wang et al., 2019) integrates factual knowledge with the supervision of the knowledge embedding objective. RoBERTa+multitask is our RoBERTa model pre-trained with multi-task learning (as shown in Figure $\mathbf { \lambda } _ { 1 ( \mathrm { a } ) } \dot { }$ ) for injecting multiple kinds of knowledge on two pre-training tasks. K-ADAPTER (w/o knowledge) consists of a RoBERTa model and an adapter without being injected knowledge. Other baseline models, such as BERT-base, ERNIE, KnowBERT and WKLM are described in Section 2.
82
+
83
+ Table 3: Results on question answering datasets including: CosmosQA, SearchQA and Quasar-T.
84
+
85
+ <table><tr><td colspan="2" rowspan="2">Model</td><td colspan="2">SearchQA</td><td colspan="2">Quasar-T</td><td rowspan="2">CosmosQA</td></tr><tr><td>EM</td><td>F1</td><td>EM</td><td>F1</td></tr><tr><td colspan="2">BiDAF ( Seo et al., 2016</td><td>28.60</td><td>34.60</td><td>25.90</td><td>28.50</td><td>Accuracy =</td></tr><tr><td colspan="2">AQA (Buck et al. 2018</td><td>40.50</td><td>47.40</td><td>=</td><td>=</td><td></td></tr><tr><td colspan="2">R^3 Wang et al., 2017a</td><td>49.00</td><td>55.30</td><td>35.30</td><td>41.70</td><td></td></tr><tr><td colspan="2"> DSQA (Lin et al. |2018)</td><td>49.00</td><td>55.30</td><td>42.30</td><td>49.30</td><td></td></tr><tr><td colspan="2">Evidence Agg. (Wang et al. 2018</td><td>57.00</td><td>63.20</td><td>42.30</td><td>49.60</td><td></td></tr><tr><td colspan="2">BERT Xiong et al.,2020)</td><td>57.10</td><td>61.90</td><td>40.40</td><td>46.10</td><td></td></tr><tr><td colspan="2">WKLM (Xiong et al.2020)</td><td>58.70</td><td>63.30</td><td></td><td></td><td></td></tr><tr><td colspan="2">WKLM+ Ranking Xiong et al.. 2020</td><td>61.70</td><td>66.70</td><td>43.70 45.80</td><td>49.90</td><td></td></tr><tr><td colspan="2"></td><td></td><td></td><td></td><td>52.20</td><td>=</td></tr><tr><td colspan="2">BERT-FTRACE+SW AG (Huang et al. 2019</td><td>= 59.01</td><td></td><td></td><td></td><td>68.70</td></tr><tr><td colspan="3">RoBERTa</td><td>65.62</td><td>40.83</td><td>48.84</td><td>80.59</td></tr><tr><td colspan="3">RoBERTa+multitask</td><td>59.92 66.67 61.96</td><td>44.62</td><td>51.17</td><td>81.19</td></tr><tr><td colspan="3">K-ADAPTER (F+L)</td><td>67.31</td><td>46.32</td><td>53.00</td><td>81.83</td></tr><tr><td colspan="3">K-ADAPTER (F)</td><td>61.85 67.17</td><td>46.20</td><td>52.86</td><td>80.93</td></tr><tr><td colspan="3">K-ADAPTER (L)</td><td>61.15 66.82</td><td>45.66</td><td>52.39</td><td>80.76</td></tr></table>
86
+
87
+ Results and Discussion The results on OpenEntity and FIGER are shown in Table 2. K-ADAPTER $\left( \mathrm { F } { + } \mathrm { L } \right)$ achieves consistent improvements across these datasets. As for OpenEntity, our RoBERTa achieve better results than other baseline models. K-ADAPTER $\left( \mathrm { F } { + } \mathrm { L } \right)$ further achieves improvement of $1 . 3 8 \% F _ { 1 }$ over RoBERTa, which means factual knowledge and linguistic knowledge help to predict the types more accurately. As for FIGER, it covers more entity types, and is more finegrained than OpenEntity. Compared with WKLM, K-ADAPTER $\left( \mathrm { F } { + } \mathrm { L } \right)$ improves the macro $F _ { 1 }$ by $2 . 8 8 \%$ , micro $F _ { 1 }$ by $2 . 5 4 \%$ and accuracy by $1 . 6 0 \%$ . This demonstrates that K-ADAPTER $\left( \mathrm { F } { + } \mathrm { L } \right)$ benefits fine-grained entity typing. In addition, we further conduct several experiments on our ablated model $\mathrm { K }$ -ADAPTER (w/o knowledge), to explore whether the performance gains came from introducing knowledge or additional parameters. Results show that K-ADAPTER (F) significantly outperforms K-ADAPTER (w/o knowledge). Moreover, it is worth noting that on OpenEntity dataset, K-ADAPTER (w/o knowledge) even performs slightly worse than RoBERTa. These results demonstrate that our model gains improvement from knowledge instead of more parameters. Thus, for simplicity, we don’t discuss K-ADAPTER (w/o knowledge) in the following experiments.
88
+
89
+ # 4.2 QUESTION ANSWERING
90
+
91
+ We conduct experiments on two question answering (QA) tasks, i.e., commonsense QA and opendomain QA. Commonsense QA aims to answer questions with commonsense. We adopt CosmosQA $( \overrightarrow { \mathrm { H u a n g ~ e t ~ a l . } } , \overrightarrow { \mathrm { 2 0 1 9 } } )$ to evaluate our models. CosmosQA requires commonsense-based reading comprehension, formulated as multiple-choice questions. To fine-tune our models for CosmosQA, the input token sequence is modified as “ ${ ' } { < } S E P { > }$ context ${ < } / S E P { > }$ question $< / S E P { > } a n s w e r { < } / S E P { > } ^ { , }$ , then the representation of the first token is adopted to perform classification, and will get a score for this answer. After getting four scores, the answer with the highest score will be selected. We report accuracy scores obtained from the leaderboard.
92
+
93
+ Open-domain QA aims to answer questions using external resources such as collections of documents and webpages. We evaluate our modes on two public datasets, i.e., Quasar-T (Dhingra et al., $\underline { 2 0 1 7 } )$ and SearchQA $\left( \mathbb { D } \mathrm { u n n ~ e t ~ a l . } \right) \left[ 2 0 1 7 \right)$ . Specifically, we first retrieve paragraphs corresponding to the question using the information retrieval system and then extract the answer from these retrieved paragraphs through the reading comprehension technique. Following previous work(Lin $\boxed { \mathrm { e t a l . , } \boxed { 2 0 1 8 } }$ , we use the retrieved paragraphs provided by $\boxed { \mathrm { W a n g e t a l . } } \textcircled { 2 0 1 7 b }$ for these two datasets. To fine-tune our models for this task, the input token sequence is modified as $^ { \ d } { } ^ { \ d } { } ^ { \ d } { < } S E P >$ question ${ \angle } S E P { > }$ paragraph ${ \angle } S E P { > } ^ { { \ } }$ . We apply linear layers over the last hidden features of our model to predict the start and end position of the answer span. We adopt two metrics including ExactMatch (EM) and loose $F _ { 1 }$ (Ling & Weld, 2012) scores to evaluate our models.
94
+
95
+ Baselines BERT- $\mathbf { F T } _ { R A C E + S W A G }$ (Huang et al., 2019) is the BERT model sequentially finetuned on both RACE and SWAG datasets. BiDAF (Seo et al., 2016) adopts a bi-directional attention network. AQA (Buck et al., 2018) proposes to re-write questions and aggregate the answers generated by the re-written questions. Rˆ3 (Wang et al., 2017a) is a reinforced model making use of a ranker for selecting most confident paragraph. Evidence Agg. (Wang et al., 2018) proposes making use of the aggregated evidence from across multiple paragraphs to better determine the answer with re-rankers. BERT (Xiong et al., 2020) is the BERT re-implementation. WKLM (Xiong et al., $\underline { { 2 \mathbf { 0 } 2 \mathbf { 0 } } } )$ is described in Section ${ \overline { { 2 , } } }$ which is adopted as the reader model to read multiple paragraphs to predict a single answer. WKLM $^ +$ Ranking (Xiong et al., 2020) is a WKLM paragraph reader plus with a BERT based paragraph ranker to assign each paragraph a relevance score.
96
+
97
+ Results and Discussion The results on CosmosQA are shown in Table 3. Compared with BERT- $\operatorname { F T } _ { R A C E + S W A G }$ , our RoBERTa significantly achieves $1 1 . 8 9 \%$ improvement of accuracy. Compared to RoBERTa, K-ADAPTER $\left( \mathrm { F } { + } \mathrm { L } \right)$ further improves the accuracy by $1 . 2 4 \%$ , which indicates that K-ADAPTER can obtain better commonsense inference ability. Moreover, the performance of ablated K-ADAPTER models, i.e., K-ADAPTER (F) and K-ADAPTER (L) are clearly better than RoBERTa, but slightly lose compared with RoBERTa $+$ multitask. It is notable that K-ADAPTER $\left( \mathrm { F } { + } \mathrm { L } \right)$ makes obvious improvement comparing with RoBERTa+multitask. This demonstrates that the combination of multiple knowledge-specific adapters could achieve better performance.
98
+
99
+ The results for open-domain QA are shown in Table $3 .$ K-ADAPTER models achieve better results compared to other baselines. This indicates that K-ADAPTER models can make full use of the infused knowledge and accordingly benefit understanding the retrieved paragraphs to answer the question. Specifically, on SearchQA, K-ADAPTER $\mathrm { ( F { + } L ) }$ makes significant improvement of $4 . 0 1 \%$ $F _ { 1 }$ scores, comparing with WKLM where the ranking scores are not used, and even has a slight improvement as compared to WKLM $+$ Ranking. It is worth noting that K-ADAPTER models do not consider the confidence of each retrieved paragraph, while WKLM $+$ Ranking utilizes ranking scores from a BERT based ranker. On the Quasar-T dataset, K-ADAPTER $( \mathrm { F } { + } \mathrm { L } )$ also outperforms WKLM by $3 . 1 \% F _ { 1 }$ score and slightly outperforms WKLM $+$ Ranking.
100
+
101
+ # 4.3 RELATION CLASSIFICATION
102
+
103
+ Relation classification aims to determine the correct relation between two entities in a given sentence. We adopt a large-scale relation classification dataset TACRED (Zhang et al., 2017).To finetune our models for this task, we modify the input token sequence by adding special token “ $@$ ” before and after the first entity, adding “#” before and after the second entity. Then the token representations of the first special token “ $@$ ” and “#” are concatenated to perform relation classification. We adopt micro $F _ { 1 }$ score as the metric to represent the model performance as previous works.
104
+
105
+ Baselines C-GCN (Zhang et al., 2018) employs graph convolutional networks to model dependency trees. BERT-large (Baldini Soares et al., 2019) is a baseline BERT-large model. BERT+MTB (Baldini Soares et al., 2019) is a method of training relation representation without supervision from a knowledge base by matching the blanks. Other baseline models, such as ERNIE, KnowBERT, KEPLER and RoBERTa $^ +$ multitask are described in Section 2 and 4.1.
106
+
107
+ Results and Discussion Table 4 shows the performances of different models on TACRED. The results indicate that K-ADAPTER models significantly outperform all baselines, which directly demonstrate our models can benefit relation classification. In particular, (1) K-ADAPTER models outperform RoBERTa, which proves the effectiveness of infusing knowledge into pre-trained model with adapters. (2) K-ADAPTER models gain more improvement compared with RoBERTa+multitask. This directly demonstrates injecting knowledge individually in K-ADAPTER way would help models make full use of knowledge.
108
+
109
+ Table 4: Results on the relation classification dataset TACRED.
110
+
111
+ <table><tr><td>Model</td></tr><tr><td></td><td>P 69.90</td><td>R 63.30</td><td>F1 66.40</td></tr><tr><td>C-GCN Zhang et al.[2018] BERT-base ( (Zhang et al.12019)</td><td></td><td>67.23</td><td>64.81</td><td>66.00</td></tr><tr><td>ERNIE</td><td>(Zhang et al.2019]</td><td></td><td>69.97 66.08</td><td>67.97</td></tr><tr><td>BERT-large(</td><td>Baldini Soareset al.</td><td>2019</td><td>=</td><td>70.10 =</td></tr><tr><td>BERT+MTB</td><td>(Baldini Soareset al.</td><td>2019 =</td><td>=</td><td>71.50</td></tr><tr><td>KnowBERT(</td><td>Peterset al. 2019)</td><td>71.60</td><td>71.40</td><td>71.50</td></tr><tr><td>KEPLER Wang et al..</td><td>2019)</td><td>70.43</td><td>73.02</td><td>71.70</td></tr><tr><td colspan="3">RoBERTa</td><td>70.17 72.36</td><td>71.25</td></tr><tr><td colspan="3">RoBERTa+multitask</td><td>70.18</td><td>73.11</td><td>71.62</td></tr><tr><td colspan="3">K-ADAPTER (F+L)</td><td>70.14</td><td>74.04</td><td>72.04</td></tr><tr><td colspan="3">K-ADAPTER (F)</td><td>69.39</td><td>74.59</td><td>71.89</td></tr><tr><td colspan="3">K-ADAPTER (L)</td><td>68.85</td><td>75.37</td><td>71.96</td></tr></table>
112
+
113
+ # 4.4 PROBING EXPERIMENTS
114
+
115
+ Although K-ADAPTER models have shown superior performance on knowledge-driven downstream tasks, it does not directly provide insights into whether our models infuse richer factual knowledge. Thus we utilize a LAMA (LAnguage Model Analysis) probe $\left( \mathrm { P e t r o n i ~ e t ~ a l . } \right) \left[ 2 0 1 9 \right)$ to examine the ability to memorize factual knowledge. Specifically, the LAMA probing task is under a zero-shot setting, which requires the language model to answer cloze-style questions about relational facts without fine-tuning, e.g., “Simon Bowman was born in [MASK]”. The model needs to predict a distribution over a limited vocabulary to replace [MASK]. We report mean precision at one $( \mathrm { P } @ 1 )$ macro-averaged over relations.
116
+
117
+ Table 5: $\mathrm { P @ 1 }$ on LAMA and LAMA-UHN across Google-RE and T-REx corpora.
118
+
119
+ <table><tr><td rowspan="2">Corpus</td><td colspan="6">Models</td></tr><tr><td>ELMo</td><td>ELMo5.5B</td><td>TransformerXL</td><td>BERT-large</td><td>RoBERTaLARGE</td><td>K-APDATER</td></tr><tr><td>LAMA-Google-RE</td><td>2.2</td><td>3.1</td><td>1.8</td><td>12.1</td><td>4.8</td><td>7.0</td></tr><tr><td>LAMA-UHN-Google-RE</td><td>2.3</td><td>2.7</td><td>1.3</td><td>6.5</td><td>2.5</td><td>3.7</td></tr><tr><td>LAMA-T-REx</td><td>0.2</td><td>0.3</td><td>19.5</td><td>33.9</td><td>27.1</td><td>29.1</td></tr><tr><td>LAMA-UHN-T-REx</td><td>0.2</td><td>0.2</td><td>12.6</td><td>26.2</td><td>20.1</td><td>23.0</td></tr></table>
120
+
121
+ Table 6: Examples of generation for $\mathrm { R o B E R T a } _ { L A R G E }$ and K-ADAPTER. The last column reports the top ranked predicted tokens. Correct predictions are in bold.
122
+
123
+ <table><tr><td>Query</td><td>Answer</td><td>Model</td><td>Generation</td></tr><tr><td rowspan="2">The native language of Mammootty is [MASK].</td><td rowspan="2">Malayalam</td><td>RoBERTa</td><td>English,Tamil,Hindi,Sanskrit,Arabic,Chinese</td></tr><tr><td>K-ADAPTER</td><td>Malayalam,Tamil,Hindi,Mandarin,English</td></tr><tr><td rowspan="2">Ravens can [MASK].</td><td rowspan="2">fy</td><td>RoBERTa</td><td>win,play,score,lose,run,drink,fly,roll, wait</td></tr><tr><td>K-ADAPTER</td><td>fly,swim,sing,shoot,kill,go,fish,drink,die</td></tr><tr><td rowspan="2">Sometimes virus causes [MASK].</td><td rowspan="2">infection</td><td>RoBERTa</td><td>cancer,death,illness, blindness, paralysis</td></tr><tr><td>K-ADAPTER</td><td>cancer,illness,death,infection,disease</td></tr><tr><td rowspan="2">Sunshine Coast, British Columbia is located in [MASK].</td><td rowspan="2">Canada</td><td>RoBERTa</td><td>Florida, California,Texas,Hawaii,Mexico</td></tr><tr><td>K-ADAPTER</td><td>Canada, Vancouver, Victoria,BC,Australia</td></tr><tr><td rowspan="2">iPod Touch is produced by [MASK].</td><td rowspan="2">Apple</td><td>RoBERTa</td><td>Apple,Samsung, Qualcomm,LG,Microsoft</td></tr><tr><td>K-ADAPTER</td><td>Apple,HTC,Samsung,Motorola,Intel</td></tr></table>
124
+
125
+ Settings We consider several language models including: ELMo (Peters et al., 2018), ELMo5.5B $\mathrm { ( P e t e r s ~ e t ~ a l . , } \tt \boxed { 2 0 1 8 } )$ , Transformer-XL (Dai et al., 2019), $\mathbf { B E R T } _ { L A R G E }$ and $\mathrm { R o B E R T a } _ { L A R G E }$ . We focus on LAMA-GoogleRE and LAMA-T-REx, which are aimed at factual knowledge. We also conduct probe experiments on LAMA-UHN (Poerner et al., 2019), a more “factual” subset of LAMA, by filtering out queries that are easy to answer from entity names alone. Different models have different vocabulary sizes. To conduct a more fair comparison experiment, we adopt the intersection of vocabularies and let every language model rank only tokens in this vocabulary following Petroni et al. $\underline { { \left. 2 0 1 9 \right. } }$ . For simplicity, we only compare K-APDATER (F) which is infused with factual knowledge, with other baseline models.
126
+
127
+ Results and Discussion Results are shown in Table 5. It is surprising that BERTLARGE performs better than RoBERTaLARGE. There is one possible reason: BERT uses a character-level BPE (Gage, $\boxed { 1 9 9 4 }$ vocabulary, while RoBERTa considers byte-level BPE vocabulary. This finding indicates that, although using bytes makes it possible to learn a subword vocabulary that can encode any text without introducing “unknown” tokens, it might indirectly harm the model’s ability to learn factual knowledge, e.g., some proper nouns may be divided into bytes. Thus in the following experiments, we do not take BERT into account.
128
+
129
+ K-ADAPTER outperforms other models (except for BERT) by a huge margin. As for LAMA, compared to $\mathrm { R o B E R T a } _ { L A R G E }$ , K-ADAPTER obtains $2 . 2 \%$ and $1 . 2 \%$ P@1 improvement across GoogleRE and T-REx, respectively. Moreover, compared to RoBERTa $L A R G E$ , K-ADAPTER still achieves better results on LAMA-UHN. The results demonstrate that K-ADAPTER captures richer factual and commonsense knowledge than RoBERTa. Furthermore, Table $\boxed { 6 }$ shows several examples for the generation of RoBERTaLARGE and K-ADAPTER for LAMA queries. From these examples, we can find that the objects predicted by K-ADAPTER are more accurate.
130
+
131
+ # 4.5 CASE STUDY
132
+
133
+ Table $\perp$ gives a qualitative comparison example between K-ADAPTER and RoBERTa on relation classification dataset TACRED. The results show that, in most cases, the wrongly predicted logit value of RoBERTa and the logit value of the true label are actually quite close. For example, given “New Fabris closed down June 16”, RoBERTa predicts “no relation”, but the true label “city of birth” ranks in second place. If a model could correctly predict the relationship between “New Fabris” and “June 16”, then it needs to know that “New Fabris” is a company. Thanks to the factual knowledge in K-ADAPTER, it can help the model from predicting “no relation” to predicting the correct category label.
134
+
135
+ Table 7: A case study for K-ADAPTER and RoBERTa on relation classification dataset TACRED. Underlines and wavy lines highlight the subject entities and object entities respectively. We report the top 3 ranked predictions.
136
+
137
+ <table><tr><td rowspan=1 colspan=1>Input</td><td rowspan=1 colspan=1>True label</td><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Predicted label</td><td rowspan=1 colspan=1>Predicted logits</td></tr><tr><td rowspan=2 colspan=1>His former student Mark Devlin of the University ofPennsylvania was co-leader of the other,known as theMicrowave Anisotropy Telescope.</td><td rowspan=2 colspan=1>schools_attended</td><td rowspan=1 colspan=1>K-Adapter</td><td rowspan=1 colspan=1>[&#x27;schoolsattended&#x27;,&#x27;norelation&#x27;,founded&#x27;]</td><td rowspan=1 colspan=1>[12.67,9.58, 5.26]</td></tr><tr><td rowspan=1 colspan=1>RoBERTa</td><td rowspan=1 colspan=1>[&#x27;no_relation&#x27;,&#x27;founded&#x27;,&quot;member_of&quot;]</td><td rowspan=1 colspan=1>[9.18, 6.54, 5.07]</td></tr><tr><td rowspan=2 colspan=1>Graham had been in custody in Vancouver, BritishColumbia,since June.</td><td rowspan=2 colspan=1>cities_of_residence</td><td rowspan=1 colspan=1>K-Adapter</td><td rowspan=1 colspan=1>[&#x27;cities_of_residence&#x27;,&#x27;countries_of_residence&#x27;,&#x27;no_relation&#x27;]</td><td rowspan=1 colspan=1>[13.52,6.88,6.61]</td></tr><tr><td rowspan=1 colspan=1>RoBERTa</td><td rowspan=1 colspan=1>[&#x27;countries_of_residence&#x27;,&#x27;country_of_death&#x27;,&#x27;alternate_names&#x27;]</td><td rowspan=1 colspan=1>[7.14, 7.03, 6.83]</td></tr><tr><td rowspan=2 colspan=1>Vladimir Ladyzhenskiy of Russia died after she suffered ashock in the final of the spa world championship in Heinola,a southern city of Finland,on Saturday</td><td rowspan=2 colspan=1>cause_of_death</td><td rowspan=1 colspan=1>K-Adapter</td><td rowspan=1 colspan=1>[&#x27;cause_of_death&#x27;,&#x27;origin&#x27;,&#x27;no_relation&#x27;]</td><td rowspan=1 colspan=1>[11.05, 7.65, 7.14]</td></tr><tr><td rowspan=1 colspan=1>RoBERTa</td><td rowspan=1 colspan=1>[&#x27;no_relation&#x27;,&#x27;cause_of_death&#x27;,&#x27;origin&#x27;]</td><td rowspan=1 colspan=1>[6.32, 5.90, 5.52]</td></tr><tr><td rowspan=2 colspan=1>You can’t have a good season unless it starts well, &quot; saidBill Martin,co-founder of ShopperTrak,on Saturday.</td><td rowspan=2 colspan=1>founded_by</td><td rowspan=1 colspan=1>K-Adapter</td><td rowspan=1 colspan=1>[&#x27;founded.by&#x27;,&#x27;member-of&#x27;,&#x27;employee_of&#x27;]</td><td rowspan=1 colspan=1>[10.25,9.32, 7.37]</td></tr><tr><td rowspan=1 colspan=1>RoBERTa</td><td rowspan=1 colspan=1>[&#x27;no_relation&#x27;,&#x27;founded_by&#x27;,&#x27;employee_of&#x27;]</td><td rowspan=1 colspan=1>[10.01, 8.57, 5.42]</td></tr><tr><td rowspan=2 colspan=1>New Fabris closed down June 16.</td><td rowspan=2 colspan=1>dissolved</td><td rowspan=1 colspan=1>K-Adapter</td><td rowspan=1 colspan=1>[&#x27;dissolved&#x27;,&#x27;no_relation’,&#x27;date_of_death&#x27;]</td><td rowspan=1 colspan=1>[12.94, 8.79, 6.83]</td></tr><tr><td rowspan=1 colspan=1>RoBERTa</td><td rowspan=1 colspan=1>[&#x27;no_relation&#x27;,&#x27;dissolved&#x27;,&#x27;date_of_birth&#x27;]</td><td rowspan=1 colspan=1>[11.44, 9.84, 3.31]</td></tr><tr><td rowspan=2 colspan=1>At Countrywide,which is finishing up a round of 12.000 job cuts, Chief Executive Angelo Mozilo said inannouncing the Bank of America takeover last week thatthe housing and mortgage sectors were being strained “ asnever seen since the Great Depression.</td><td rowspan=2 colspan=1>dissolved</td><td rowspan=1 colspan=1>K-Adapter</td><td rowspan=1 colspan=1>[&#x27;dissolved&#x27;,&#x27;no_relation’,&#x27;date_of_death&#x27;]</td><td rowspan=1 colspan=1>[11.76, 6.89, 6.42]</td></tr><tr><td rowspan=1 colspan=1>RoBERTa</td><td rowspan=1 colspan=1>[&#x27;date_of_birth&#x27;,&#x27;date_of-death&#x27;,&#x27;no.relation&#x27;]</td><td rowspan=1 colspan=1>[7.44, 6.88, 6.33]</td></tr></table>
138
+
139
+ # 5 CONCLUSION AND FUTURE WORK
140
+
141
+ In this paper, we propose a flexible and simple approach, called K-ADAPTER, to infuse knowledge into large pre-trained models. K-ADAPTER remains the original parameters of pre-trained models unchanged and supports continual knowledge infusion, i.e., new kinds of injected-knowledge will not affect the parameters learned for old knowledge. Specifically, factual knowledge and linguistic knowledge are infused into RoBERTa with two kinds of adapters, which are pre-trained on the relation classification task and dependency relation prediction task, respectively. Extensive experiments on three knowledge-driven downstream tasks demonstrate that the performance of each adapter achieves a significant improvement individually, and even more together. Probing experiments further suggest that K-ADAPTER captures richer factual and commonsense knowledge than RoBERTa. In future work, we will infuse more types of knowledge, and apply our framework to more pre-trained models.
142
+
143
+ # REFERENCES
144
+
145
+ Livio Baldini Soares, Nicholas FitzGerald, Jeffrey Ling, and Tom Kwiatkowski. Matching the Blanks: Distributional Similarity for Relation Learning. In ACL, pp. 2895–2905, 2019.
146
+
147
+ Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. Translating embeddings for modeling multi-relational data. In NIPS, pp. 2787–2795, 2013.
148
+
149
+ Christian Buck, Jannis Bulian, Massimiliano Ciaramita, Andrea Gesmundo, Neil Houlsby, Wojciech Gajewski, and Wei Wang. Ask the Right Questions: Active Question Reformulation with Reinforcement Learning. In ICLR, 2018.
150
+
151
+ Eunsol Choi, Omer Levy, Yejin Choi, and Luke Zettlemoyer. Ultra-fine entity typing. In ACL, pp. 87–96, 2018.
152
+
153
+ Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. In ACL, pp. 2978– 2988, 2019.
154
+
155
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL, pp. 4171–4186, 2019.
156
+
157
+ Bhuwan Dhingra, Kathryn Mazaitis, and William W Cohen. Quasar: Datasets for question answering by search and reading. In arXiv preprint arXiv:1707.03904, 2017.
158
+
159
+ Matthew Dunn, Levent Sagun, Mike Higgins, V. Ugur Guney, Volkan Cirik, and Kyunghyun Cho. ¨ SearchQA: A New Q&A Dataset Augmented with Context from a Search Engine. In ArXiv preprint arXiv:1704.05179, 2017.
160
+
161
+ Hady ElSahar, Pavlos Vougiouklis, Arslen Remaci, Christophe Gravier, Jonathon S. Hare, Fred´ erique Laforest, and Elena Simperl. T-REx: A Large Scale Alignment of Natural Language ´ with Knowledge Base Triples. In LREC, 2018.
162
+
163
+ Philip Gage. A new algorithm for data compression. The C Users Journal, 12(2):23–38, 1994.
164
+
165
+ Bin He, Di Zhou, Jinghui Xiao, Qun Liu, Nicholas Jing Yuan, Tong Xu, et al. Integrating Graph Contextualized Knowledge into Pre-trained Language Models. In arXiv preprint arXiv:1912.00147, 2019.
166
+
167
+ Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin De Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-Efficient Transfer Learning for NLP. In ICML, pp. 2790–2799, 2019.
168
+
169
+ Lifu Huang, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. Cosmos QA: Machine reading comprehension with contextual commonsense reasoning. In EMNLP, pp. 2391–2401, 2019.
170
+
171
+ Nora Kassner and Hinrich Schutze. Negated LAMA: Birds cannot fly. ¨ arXiv preprint arXiv:1911.03343, 2019.
172
+
173
+ James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, and et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the National Academy of Sciences, 114(13):3521–3526, Mar 2017. ISSN 1091-6490. doi: 10.1073/pnas.1611835114.
174
+
175
+ Anne Lauscher, Ivan Vulic, Edoardo Maria Ponti, Anna Korhonen, and Goran Glava ´ s. Informing ˇ unsupervised pretraining with external linguistic knowledge. arXiv preprint arXiv:1909.02339, 2019.
176
+
177
+ Yoav Levine, Barak Lenz, Or Dagan, Dan Padnos, Or Sharir, Shai Shalev-Shwartz, Amnon Shashua, and Yoav Shoham. Sensebert: Driving some sense into bert. arXiv preprint arXiv:1908.05646, 2019.
178
+
179
+ Yankai Lin, Haozhe Ji, Zhiyuan Liu, and Maosong Sun. Denoising distantly supervised opendomain question answering. In ACL, pp. 1736–1745, 2018.
180
+
181
+ Xiao Ling and Daniel S. Weld. Fine-grained entity recognition. In Jorg Hoffmann and Bart Selman ¨ (eds.), Proceedings of the Twenty-Sixth AAAI Conference on Artificial Intelligence, July 22-26, 2012, Toronto, Ontario, Canada. AAAI Press, 2012.
182
+
183
+ Xiao Ling, Sameer Singh, and Daniel S. Weld. Design challenges for entity linking. TACL, 3: 315–328, 2015.
184
+
185
+ Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
186
+
187
+ Matthew E Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. In NAACL, pp. 2227–2237, 2018.
188
+
189
+ Matthew E Peters, Mark Neumann, IV Logan, L Robert, Roy Schwartz, Vidur Joshi, Sameer Singh, and Noah A Smith. Knowledge enhanced contextual word representations. In EMNLP, pp. 43–54, 2019.
190
+
191
+ Fabio Petroni, Tim Rocktaschel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H Miller, ¨ and Sebastian Riedel. Language Models as Knowledge Bases? In EMNLP, pp. 2463–2473, 2019.
192
+
193
+ Nina Poerner, Ulli Waltinger, and Hinrich Schutze. BERT is Not a Knowledge Base (Yet): Factual ¨ Knowledge vs. Name-Based Reasoning in Unsupervised QA. arXiv preprint arXiv:1911.03681, 2019.
194
+
195
+ Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. OpenAI Blog, 2018.
196
+
197
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI Blog, 1(8), 2019.
198
+
199
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683, 2019.
200
+
201
+ Minjoon Seo, Aniruddha Kembhavi, Ali Farhadi, and Hannaneh Hajishirzi. Bidirectional Attention Flow for Machine Comprehension. ArXiv, abs/1611.01603, 2016.
202
+
203
+ Sonse Shimaoka, Pontus Stenetorp, Kentaro Inui, and Sebastian Riedel. An attentive neural architecture for fine-grained entity type classification. In Proceedings of the 5th Workshop on Automated Knowledge Base Construction(AKBC), pp. 69–74, 2016.
204
+
205
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, pp. 5998–6008, 2017.
206
+
207
+ Shuohang Wang, Mo Yu, Xiaoxiao Guo, Zhiguo Wang, Tim Klinger, Wei Zhang, Shiyu Chang, Gerald Tesauro, Bowen Zhou, and Jing Jiang. Reinforced reader-ranker for open-domain question answering. arXiv preprint arXiv:1709.00023, 2017a.
208
+
209
+ Shuohang Wang, Mo Yu, Jing Jiang, Wei Zhang, Xiaoxiao Guo, Shiyu Chang, Zhiguo Wang, Tim Klinger, Gerald Tesauro, and Murray Campbell. Evidence aggregation for answer re-ranking in open-domain question answering. In ICLR, 2018.
210
+
211
+ Wenhui Wang, Nan Yang, Furu Wei, Baobao Chang, and Ming Zhou. Gated self-matching networks for reading comprehension and question answering. In ACL, pp. 189–198, 2017b.
212
+
213
+ Xiaozhi Wang, Tianyu Gao, Zhaocheng Zhu, Zhiyuan Liu, Juanzi Li, and Jian Tang. KEPLER: A Unified Model for Knowledge Embedding and Pre-trained Language Representation. arXiv preprint arXiv:1911.06136, 2019.
214
+
215
+ Wenhan Xiong, Jingfei Du, William Yang Wang, and Veselin Stoyanov. Pretrained Encyclopedia: Weakly Supervised Knowledge-Pretrained Language Model. In ICLR, 2020.
216
+
217
+ Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V Le. XLNet: Generalized Autoregressive Pretraining for Language Understanding. arXiv preprint arXiv:1906.08237, 2019.
218
+
219
+ Yuhao Zhang, Victor Zhong, Danqi Chen, Gabor Angeli, and Christopher D. Manning. Positionaware Attention and Supervised Data Improve Slot Filling. In EMNLP, pp. 35–45, 2017.
220
+
221
+ Yuhao Zhang, Peng Qi, and Christopher D. Manning. Graph Convolution over Pruned Dependency Trees Improves Relation Extraction. In EMNLP, pp. 2205–2215, 2018.
222
+
223
+ Zhengyan Zhang, Xu Han, Zhiyuan Liu, Xin Jiang, Maosong Sun, and Qun Liu. ERNIE: Enhanced Language Representation with Informative Entities. In ACL, pp. 1441–1451, 2019.
224
+
225
+ Yukun Zhu, Ryan Kiros, Rich Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Aligning Books and Movies: Towards Story-Like Visual Explanations by Watching Movies and Reading Books. In ICCV, pp. 19–27, 2015.
md/train/CU0APx9LMaL/CU0APx9LMaL.md ADDED
@@ -0,0 +1,251 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NAS-BENCH-ASR: REPRODUCIBLE NEURAL ARCHITECTURE SEARCH FOR SPEECH RECOGNITION
2
+
3
+ Abhinav Mehrotra1†, Alberto Gil C. P. Ramos1†, Sourav Bhattacharya1†, Łukasz Dudziak1†, Ravichander Vipperla1, Thomas Chau1, Samin Ishtiaq1, Mohamed S. Abdelfattah1, and Nicholas D. Lane1,2
4
+
5
+ 1Samsung AI Center, Cambridge $\cdot$ 2University of Cambridge ⋅ †Equal contribution {a.mehrotra1,a.gilramos,sourav.b1,l.dudziak}@samsung.com
6
+
7
+ # ABSTRACT
8
+
9
+ Powered by innovations in novel architecture design, noise tolerance techniques and increasing model capacity, Automatic Speech Recognition (ASR) has made giant strides in reducing word-error-rate over the past decade. ASR models are often trained with tens of thousand hours of high quality speech data to produce state-of-the-art (SOTA) results. Industry-scale ASR model training thus remains computationally heavy and time-consuming, and consequently has attracted little attention in adopting automatic techniques. On the other hand, Neural Architecture Search (NAS) has gained a lot of interest in the recent years thanks to its successes in discovering efficient architectures, often outperforming handcrafted alternatives. However, by changing the standard training process into a bi-level optimisation problem, NAS approaches often require significantly more time and computational power compared to single-model training, and at the same time increase complexity of the overall process. As a result, NAS has been predominately applied to problems which do not require as extensive training as ASR, and even then reproducibility of NAS algorithms is often problematic. Lately, a number of benchmark datasets has been introduced to address reproducibility issues by providing NAS researchers with information about performance of different models obtained through exhaustive evaluation. However, these datasets focus mainly on computer vision and NLP tasks and thus suffer from limited coverage of application domains. In order to increase diversity in the existing NAS benchmarks, and at the same time provide systematic study of the effects of architectural choices for ASR, we release NAS-Bench-ASR – the first NAS benchmark for ASR models. The dataset consists of 8, 242 unique models trained on the TIMIT audio dataset for three different target epochs, and each starting from three different initializations. The dataset also includes runtime measurements of all the models on a diverse set of hardware platforms. Lastly, we show that identified good cell structures in our search space for TIMIT transfer well to a much larger LibriSpeech dataset.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Innovations in Deep Neural Network (DNN) architecture design, data augmentation techniques and a continuous increase in the amount of available high quality training datasets, resulted in a massive reduction in ASR word-error-rate over the past decade [Amodei et al., 2016; Kim et al., 2019; Park et al., 2019; Synnaeve et al., 2020]. However, training ASR models to achieve state-of-the-art performance remains challenging as it requires computationally heavy training process, e.g., often thousands of GPU-hours are needed for good convergence [Amodei et al., 2016; Kahn et al., 2020]. Furthermore, the requirement of hyper-parameter optimizations increases the computational loads in ASR training. Despite the system-level complexities in the training procedure, the importance of novel architecture design has proven extremely important in a variety of application domains including ASR [Chiu & Raffel, 2018; Pratap et al., 2020], computer vision [He et al., 2016; Krizhevsky et al., 2012], and natural-language processing (NLP) [Devlin et al., 2019; Vaswani et al., 2017].
14
+
15
+ However, architecture design is a non-trivial task and often depends on years of experience, domain knowledge of the researchers and is driven by empirical successes.
16
+
17
+ Over the past few years, the deep learning community is witnessing a trend in adopting automatic techniques to find neural network architectures over more traditional hand-designed alternatives. NAS algorithms are highly successful in discovering state-of-the-art architectures in various computer vision tasks [Cai et al., 2020; Howard et al., 2019; Lee et al., 2020; Real et al., 2018; Tan et al., 2019; Tan & Le, 2019]. However, many of them suffer from high computational demands, requiring a large number of architecture variations to be trained [Zoph & Le, 2017]. Furthermore, NAS algorithms are often difficult to reproduce by different researchers, mainly due to a non-standard use of training settings, e.g., hyperparameters, and subtle variations in the architecture search spaces [Li & Talwalkar, 2019; Sciuto et al., 2020]. Recently, a number of attempts have been made to mitigate these problems by releasing various benchmark datasets for the NAS research community [Dong & Yang, 2020; Klyuchnikov et al., 2020; Siems et al., 2020; Ying et al., 2019]. These datasets usually provide a direct mapping between an architecture variant and its post training performances, which can be used efficiently by a NAS algorithm speeding up the search process and, at the same time, providing common, fully reproducible environment for assessment and comparison of different algorithms. Initial attempts of creating benchmark datasets predominantly focus on image classification tasks (with only one existing work targeting NLP at the time of this writing), and thus suffer from poor application coverage.
18
+
19
+ We address the lack of coverage problem by introducing a new NAS-benchmak dataset in the domain of ASR, to our best knowledge the very first of its kind. To build the dataset, we have trained 8, 242 unique convolutional neural network architectures on the TIMIT dataset [Garofolo et al., 1993]. We consider convolutional architectures due to their recent successes in the domain of ASR [Pratap et al., 2020; Hannun et al., 2019]. Moreover, convolution based architectures are computationally efficient to run on mobile devices, thus favouring real-time on-device deployment. Our dataset contains multiple runs of the entire training procedure of an architecture, spanning three initializations of the network parameters and three target epochs, amounting a total of $7 4 , 1 7 8 \ = \ 8 , 2 4 2 \times 3 \times 3$ training runs. In addition to the per epoch validation and final test metrics, such as Phoneme Error Rate (PER), and CTC loss, we also provide run-times of the architectures on desktop and embedded GPUs for varying batch size. Furthermore, we compare a number of NAS algorithms [Zoph & Le, 2017; Real et al., 2018; Dudziak et al., 2020; Li et al., 2017; Li & Talwalkar, 2019] on our search space, highlighting potential challenges and differences compared to their performances on existing NAS benchmark dataset. Lastly, we show the transferability of the top architecture cells found on TIMIT to a much larger Librispeech dataset [Panayotov et al., 2015].
20
+
21
+ In summary, the contributions of this paper are:
22
+
23
+ • Design of ASR NAS Search Space. ASR NAS-Bench is a first-of-its-kind search space for convolutional speech models. It facilitates the reproducible study of ASR through NAS methods and thus fills an important gap in the literature. The associated dataset consists of 8, 242 unique cells and contains validation and test metrics along with model parameters, FLOPs and on-device run-times1.
24
+
25
+ • Enabling NAS for Large-scale ASR. Prohibitive training times for non-toy ASR datasets, has prevented NAS from strongly influencing the evolution of ASR architecture design. We show that ASR NAS-Bench is able to support the discovery of cell structures that generalize even to largescale datasets like Librispeech – a key breakthrough. We believe the methodological decisions in this paper will act as a blueprint for future work, where NAS plays a prominent role in ASR design.
26
+
27
+ • Validating Existing NAS Algorithm Design. Existing understanding of NAS is grossly influenced by image-based tasks. By systematically benchmarking popular NAS algorithms, under a rich ASR search space, our findings provide otherwise lacking scientific support for prior results.
28
+
29
+ # 2 RELATED WORK
30
+
31
+ NAS Benchmarks. Ying et al. [2019] inroduced NAS-Bench-101 dataset in an attempt to address the difficulties in reproducing NAS research. It contains over 400K unique image classification models trained on the CIFAR10 dataset. Despite being the biggest NAS dataset yet, not all NAS algorithms can utilize the dataset due to the restrictions it imposes on the maximum number of edges to limit the search space size. To mitigate the limitations, NAS-Bench-201 was introduced, which contains 15K image classification models and includes more diagnostic data [Dong & Yang, 2020]. Concurrently to NAS-Bench-201, NAS-Bench-1shot1 [Zela et al., 2020] and NAS-Bench301 [Siems et al., 2020] were introduced. NAS-Bench-1shot1 focuses on benchmarking NAS with weight sharing, whereas, NAS-Bench-301 points out the need for surrogate functions for scaling and uses the DARTS search space [Liu et al., 2019] with approximately ${ 1 0 } ^ { 1 8 }$ models. Lastly, NASBench-NLP [Klyuchnikov et al., 2020] contains models with custom recurrent cells, which are used to replace traditional layers like LSTMs. The dataset contains around 14K different architectures trained on a language modeling task.
32
+
33
+ NAS in Audio Modeling. Recently, there has been an increasing interest in applying NAS in speechrelated tasks, such as keyword spotting [Mo et al., 2020; Mazzawi et al., 2019], speaker verification [Ding et al., 2020; Qu et al., 2020], and acoustic scene classification [Li et al., 2020]. NAS has also been applied in ASR [He et al., 2020; Chen et al., 2020; Kim et al., 2020; Baruwa et al., 2019]. For example, Chen et al. [2020] used a search methodology based on the vanilla DARTS to optimize a CNN-based feature extractor, followed by a fixed Bi-LSTM module and multiple output heads. The authors evaluated the NAS-discovered models under mono- and multi-lingual settings, using the Full Language Pack from IARPA BABEL [Gales et al., 2014], showing improvements over a VGG-based extractor. In contrast, Kim et al. [2020] considered evolution-based search to optimize a micro-cell used within a transformer architecture. The evaluation was done using English and Korean dataset of approximately 100 hours of speech each, under monolingual setting. Similarly, He et al. [2020] used differentiable search, using P-DARTS [Chen et al., 2019] as the base, to optimize a convolutional model without the recurrent tail. Unlike the previous approaches, the evaluation is done on Mandarin, while using various training datasets spanning between 170 and 10K hours of speech. Closest to our work is the work by Baruwa et al. [2019], where the authors consider both TIMIT and LibriSpeech datasets, but studied them independently rather than using TIMIT as a proxy for LibriSpeech. Further differences include variations in search space design, e.g., the authors only considered operations arranged in a fixed feed-forward manner, and allowed interleaving convolutions with recurrent blocks. Lastly, current work on NAS for ASR focus mainly on using the search to improve prediction accuracy, however, they often lack solid foundations needed for analysing and reasoning about the overall search process and identifying its limitations. This work presents a large-scale study on the effects of architectural changes on ASR models.
34
+
35
+ # 3 ASR NAS-BENCH
36
+
37
+ The main purpose of the ASR NAS-Bench dataset is to provide a direct mapping from an architecture instance in the search-space (§3.1) to its training time and final performance metrics. The mapping is designed for any NAS algorithm to quickly navigate the architecture space without requiring the time-consuming and computationally-heavy training procedure. For architecture search we use the TIMIT dataset [Garofolo et al., 1993] and conduct a pilot experiment to select suitable hyperparameters used to train 8, 242 unique models.
38
+
39
+ # 3.1 ASR ARCHITECTURE SEARCH SPACE
40
+
41
+ In-line with existing work [Liu et al., 2019; Pham et al., 2018] and NAS Benchmarks [Ying et al., 2019; Dong & Yang, 2020], we restrict our search to a small feed-forward neural network topologyspace, commonly known as cells. We repeat and arrange a chosen cell to construct a predefined macro-architecture, which is then trained on the TIMIT dataset.
42
+
43
+ Micro-Architecture. A micro-architecture or a cell, as shown in Figure 1(a), is represented by a directed acyclic graph (DAG). We consider DAGs with four nodes $T _ { 1 } , \ldots , T _ { 4 }$ with corresponding incident tensors $t _ { 1 } , \ldots , t _ { 4 }$ and allow two types of edges: main and skip connection edges. A main edge connects two successive nodes $T _ { i - 1 }$ and $T _ { i }$ in the graph as shown by the solid line-arrows in Figure 1(a). A skip connection edge on the other hand, can connect any two nodes $T _ { j }$ and $T _ { i }$ , with the constraint $j < i$ and are depicted as dotted line-arrows in Figure 1(a). Each edge $e _ { j i }$ represents an operation on the tensor $t _ { j }$ . The tensor $t _ { i }$ is computed by summing the results of operations done by all incoming edges on $T _ { i }$ (i.e., $e _ { j i }$ , where $j < i$ ).
44
+
45
+ We consider a choice of six operations for the main edges: linear operation, four convolution operations distinguished by choices of (kernel size, dilation) ∈ $\{ ( 5 , 1 ) , ( 5 , 2 ) , ( 7 , 1 ) , ( 7 , 2 ) \}$ , and a zero operation, which outputs a tensor of zeros with the same shape and type as its input. Skip connection operations on the other hand, can be either the identity operation or the zero operation. We used L2 kernel regularizer with convolution operations and dropouts with linear operations. Within the convolution operations, the size of the kernels (e.g., 5 or 7) is chosen as a trade-off between the audio context duration and the model size. Similarly two dilation factors are considered (e.g., 1 or 2) to investigate the trade-off between audio context duration and time resolution. As the final step of a cell, the value of $t _ { 4 }$ is further passed through a layer normalization to produce the output of the cell. These design choices are made after we have considered the search space that can be used by the vast majority of the NAS algorithms.
46
+
47
+ Macro-Architecture. One of our focuses in this benchmark is on-device deployment, so the macroarchitecture is made up of convolution and unidirectional LSTM blocks as they are computationally efficient to run on mobile CPUs. The macro architecture, illustrated in Figure 1(b), is a sequential computation composed of four blocks followed by a unidirectional LSTM and a linear layer. Individual blocks are composed of a convolution layer, an activation layer (ReLU), a layer normalization and a composition of $C _ { i }$ $( i = 1 , 2 , 3 , 4 )$ ) search cells, with the same micro architecture across all the blocks. Each block is parametrized by three parameters $F _ { i }$ , $K _ { i }$ and $S _ { i }$ . These are used to define the number of filters $F _ { i }$ , the kernel size $K _ { i }$ and the stride $S _ { i }$ of the convolution layer. Note that $F _ { i }$ is also the number of filters of the convolution layers inside the search cell. We use the following set of parameters to define the macro-architecture while performing all micro-architecture training on the TIMIT dataset: $C _ { 1 : 4 } = [ 3 , 4 , 5 , 6 ]$ , $F _ { 1 : 4 } = [ 6 0 0 , 8 0 0 , 1 0 0 0 , 1 2 0 0 ]$ , $K _ { 1 : 4 } = [ 8 , 8 , 8 , 8 ]$ and $S _ { 1 : 4 } = [ 1 , 1 , 2 , 2 ]$ .
48
+
49
+ ![](images/8c90c5857af224c30d93df8385c104f07c53878301e83d77c1faa5adac0b2f6f.jpg)
50
+ Figure 1: (a) Example of micro-architectures (cells) trained on TIMIT. The architecture space has 8, 242 unique cells. (b) An overview of the macro-architecture.
51
+
52
+ # 3.2 TIMIT DATASET
53
+
54
+ TIMIT [Garofolo et al., 1993] is one of the earliest datasets designed for evaluating and benchmarking phoneme ASR systems. It is ideally suited for neural architecture search experiments due to its small size and high quality transcriptions. It comprises of 6, 300 utterances from 630 speakers, amounting to 5.4 hours of speech. We use the standard training partition of 3, 696 utterances from 462 speakers. Following Lee & Hon [1989], we split the core test dataset into a test partition, consisting of 24 speakers, and a validation partition. Inline with kaldi Timit-s5 recipe, the original 61 phonemes are mapped into a set of 48 phonemes, which forms the output layer targets for all the models. These 48 phonemes were further folded to a set of 39 during evaluations [Lee & Hon, 1989]. We use 80-dimensional log-mel spectrograms computed over $2 5 \mathrm { { m s } }$ sliding window with a stride of $1 0 ~ \mathrm { m s }$ as input features. During training, we employ a curriculum learning strategy [Amodei et al., 2016], where we begin training by iterating twice over audio utterances shorter than 1s, then twice over audio utterances shorter than 2s as a warmup phase followed by training on the entire dataset. For efficiency, we also use a batch bucketing strategy, where a batch size of 64 is used for audio utterances smaller than 2s, and a batch size of 32 is used otherwise. We used CTC beam-search decoder with beam-size of 12. Note, we did not use any language model in our experiments in order to avoid further HPO (e.g., weighting factors) optimization. This also helped us to keep the architecture search for Acoustic Model (AM) tractable. All training experiments on TIMIT report the PER on validation and test partitions.
55
+
56
+ ![](images/d689f534f876402c93481a57d3d7f0f2779c26e73ff384cf57206a8d4bfda0da.jpg)
57
+ Figure 2: Correlation of best validation and final test PER for top, middle and bottom 1, 000 models.
58
+
59
+ # 3.3 PILOT EXPERIMENT
60
+
61
+ As different training procedures can potentially lead to substantially different results [Ying et al., 2019], in this work we employ a single general training procedure for all models. Moreover, we use the same parameter set, e.g., $F , K , S$ , learning rate, and decay across all 8, 242 models. In order to select good values of the parameters, we conducted a range of training experiments, where we performed a grid-search to find good macro structure parameters and optimizer settings.
62
+
63
+ Macro Structure Parameter Selection. The macro structure considered in this work has four main blocks (see Figure 1(a)) and we considered the following variations in the pilot study: filters $F \in \{ [ 6 0 0 , 8 0 0 , 1 0 0 0 , 1 2 0 0 ]$ , [900, 1100, 1300, 1500], $\mathrm { 1 2 0 0 , 1 3 0 0 , 1 5 0 0 , 1 7 0 0 } ] \}$ , kernel sizes $K \in \{ [ 6 , 8 , 1 0 , 1 2 ]$ , [8, 8, 8, 8], [10, 10, 10, 10], [12, 12, 12, 12]}, and time reduction via strides $S \in \{ [ 2 , 2 , 2 , 1 ] , [ 1 , 1 , 2 , 2 ] , [ 2 , 2 , 1 , 1 ] \}$ .
64
+
65
+ Optimizer Setting for Training. We further explored good ranges of the learning rate, decay factor, and start epoch for an exponential decay learning rate scheduler used in conjunction with the Adam optimizer. Specifically, we considered the learning rate $( \mathbf { L R } ) \in [ 1 0 ^ { - 3 } , 1 0 ^ { - 4 } , 5 * 1 0 ^ { - 5 } , 1 0 ^ { - 5 } ]$ , the decay factor $\in [ 0 . 9 , 0 . 9 5 , 0 . 9 9 ]$ , and the LR decay start epoch $\in [ 5 , 1 0 , 1 5 ]$ .
66
+
67
+ Finally, we randomly chose five micro architectures among all possible 8, 242 cells and for each cell we conducted the grid search over the aforementioned parameters. Specifically, for each cell we created a model from a particular macro architecture, which we then trained by selecting a particular optimizer setting on TIMIT. We identified the parametric setting that resulted in the lowest PER across all five cells in the experiments and used the same parameters in all latter model training experiments. The best macro structure parameters are presented above (see $\ S 3 . 1 \ r ]$ , whereas the best LR was $1 0 ^ { - 4 }$ , and the decay factor and start epoch were: (i) 0.9 and 5 for target epoch 40, (ii) 0.631 and 2 for target epoch 10, and (iii) 0.398 and 1 for target epoch 5 respectively. The decay factor and start epoch are chosen such that the learning rate of the optimizer reaches the same value at the end of the target epoch of training.
68
+
69
+ # 3.4 TRAINING SETUP
70
+
71
+ Individual models are trained using a TensorFlow-based training pipeline running on a single GPU. We leveraged NVIDIA V100 and P40 GPUs, and decreased training time by increasing throughput via the bucketing strategy based on the audio length. Metrics such as CTC loss and Phoneme Error Rate (PER) for TIMIT were used to measure model performances. Specifically, train and validation metrics were logged at each epoch, and the test metrics were logged at the end of training for the best model (refered to as final test PER). Our dataset contains logs of each of the 8, 242 models trained with three different seeds and for three target epochs (5, 10 and 40), thus generating a total of 74, 178 model training traces. Additionally, we computed the number of parameters and floating point operations (FLOPs) for each of the architectures and measured their latency on two commonly used hardware platforms: Tesla 1080Ti and Jetson Nano.
72
+
73
+ # 4 ANALYSIS OF NAS-BENCH-ASR DATASET
74
+
75
+ As described in $\ S 3 . 1$ , our cell search space is constructed by selecting 3 main operations from a set of 6 candidates, and then selecting either identity or zeroize operation for the 6 skip connection edges (see Figure 1(a)). This amounts to 13, 824 $( 6 ^ { 3 } \times 2 ^ { 6 } )$ possible instances for the search-space. However, the use of zero operations introduces computational graph-isomorphism. To identify unique architectures, following [Ying et al., 2019; Dudziak et al., 2020], we first identify nodes with zero operations and disconnect them from their neighbors. Then we perform a reachability test and remove all nodes that can not be reached from the input or output nodes of the cell. Finally, we end up with a minimized graph representation, which we hash using an iterative graph invariant approach [Ying, 2019]. After accounting for isomorphism and discarding the empty graph from the list of valid models, we found 8, 242 unique architectures, out of which 8, 000 are without any zero operations.
76
+
77
+ Table 1: Summary of test vs. validation analysis on NAS-Bench-ASR, including three subgroups. Spearman-correlation between the test and validation performances are also presented.
78
+ Table 2: Comparison of correlations between test and validation accuracies reported in the existing image classification benchmarks NAS-Bench-101, NB-Bench-201, and our NAS-Bench-ASR.
79
+
80
+ <table><tr><td rowspan="2">Group</td><td rowspan="2">Positions</td><td colspan="3">Test PER (%)</td><td colspan="3">Val. PER (%)</td><td rowspan="2">Test-Val Corr.</td></tr><tr><td>Min.</td><td>Max.</td><td>Avg.</td><td>Min.</td><td>Max.</td><td>Avg.</td></tr><tr><td>Overall</td><td>All</td><td>20.83</td><td>90.28</td><td>30.37±36.47</td><td>18.71</td><td>90.41</td><td>28.21±38.03</td><td>0.8519</td></tr><tr><td>Top</td><td>1-1000</td><td>20.83</td><td>22.29</td><td>21.87±0.52</td><td>18.71</td><td>20.54</td><td>19.52±0.51</td><td>0.2037</td></tr><tr><td>Middle</td><td>2000-3000</td><td>23.19</td><td>23.48</td><td>23.36±0.17</td><td>19.91</td><td>22.59</td><td>21.11±0.58</td><td>0.1408</td></tr><tr><td>Bottom</td><td>7000-8000</td><td>32.16</td><td>84.53</td><td>65.03±42.68</td><td>29.57</td><td>84.6</td><td>64.52±44.21</td><td>0.9977</td></tr></table>
81
+
82
+ ![](images/c0aa9cae86b38f7e55589b7ef2336de40eafa2e09cefd877788706683dd174ce.jpg)
83
+ Figure 3: Distribution of selected edges for each node (first row) and distribution of skip-connections for possible edges (second row). Top, middle and bottom are grouped by final test PER.
84
+
85
+ Distribution of Model Performances. Analyzing the model training results we found that the majority of the models have converged and achieved a final test PER within a small range. Specifically, $8 3 . 3 \%$ (6, 869) of the models fall below a PER of $2 6 \%$ , with the best model reaching test PER of $2 0 . 8 3 \%$ . The remaining $1 6 . 7 \%$ of the models form a rather evenly-distributed tail, achieving PER values between $26 \%$ to $100 \%$ . Because of the high density of points below $26 \%$ PER and overall high range of PER values, we conducted our analysis by considering three subgroups of models: TOP models are the top 1, 000 architectures according to test PER, MIDDLE are models at positions between $2 , 0 0 0$ and 3, 000 in the test PER ranking, and BOTTOM are between 7, 000 and 8000.
86
+
87
+ Correlation Between Validation and Test PERs. Figure 2 shows the correlation between the test PER and the best validation PER. The results indicate that there is a moderate correlation for top models, weak for middle ones, and strong for worst ones. An overall summary is also presented in Table 1. In general, correlation between validation and test accuracy among the top performing models is significantly lower than for image classification benchmarks, which is highlighted in Table 2, can potentially pose additional challenge to NAS algorithms.
88
+
89
+ Distribution of Operations. Figure 3 (first row) presents the distribution of selected operations among main edges across top, middle and bottom most models. We found that the top models have the highest number of linear operations on the main edges, while the middle and bottom groups have low linear operations but higher convolution operations. Figure 3 (second row) also highlights that the worst models (bottom group) also have the highest selection of skip-connections. Figure 4 further confirms this observations showing how significantly worse the models in the search space become as they include less linear layers, or more than 2 skip connections.
90
+
91
+ Interestingly, we found that the micro cells in our search space yielding the best validation PER is similar to the structure found in the state-of-the-art convolution models such as time-depth-separable (TDS) models [Pratap et al., 2020]. Figure 5 shows the TDS-cell and
92
+
93
+ ![](images/fc463be9d566d406967f817c7edad10477d1d7a40f7bac6c5148f38ff17efec1.jpg)
94
+ Figure 4: Ranking of models according to their test PER, when they are grouped according to the number of Linear layers (left) and skip-connections (right) used in their designs.
95
+
96
+ ![](images/2d0af86ca8edae773833df1fed2d52c7d3e28cdb3474189a864fb45257097cfe.jpg)
97
+ Figure 5: Cell architectures in our search space (from left to right): TDS-like, with best validation and test PERs, and one of the efficient pareto points. Note that the TDS-like cell could also have different convolution selected as the first operation.
98
+
99
+ the micro-cells with best validation and test PERs (from left to right). This indicates the potential of conducting NAS on smaller datasets to discover new architectures yielding state-of-the-art results on larger datasets.
100
+
101
+ Latency, Params, FLOPs and PER. Figure 6 investigates the relationship among test PER, number of parameters and latency of models in the dataset. FLOPS counts are closely correlated to the number of parameters so are not shown for simplicity. Although this figure shows only latency measured on a desktop GPU (NVIDIA GeForce GTX $1 0 8 0 ~ \mathrm { T i }$ ) with batch size of 32, the NASBench-ASR includes latency measured on different devices with varying batch sizes. Also shown in the figure are 13 Pareto-optimal models, indicated by purple (x) markers. Also, the best models on test and validation dataset are highlighted in red markers. TDS-like models ([Pratap et al., 2020]) achieve test PER between $2 2 . 7 \%$ and $2 3 . 4 5 \%$ , and the best validation PER model has test PER of $2 2 . 1 3 \%$ . There are Pareto-optimal models that achieve much lower latency without significant increase in PER, for instance, the model indicated by violet $( \bullet )$ has one-fifth of the latency of the best test PER model and still has a test PER of $2 1 . 9 8 \%$ . The distribution of coloured clusters along the y axis suggests that the number of parameters is not a strong factor to determine the accuracy of models. Analogically, models with similar number of parameters can lead to very different latency.
102
+
103
+ # 5 TRANSFERABILITY
104
+
105
+ Training an ASR architecture to achieve state-of-the-art WER is a slow process, as it often requires iterating over tens of thousands hours of speech data, and potentially over various hyper-parameter choices. Even when distributed across multiple GPUs, this process can take days or weeks [Amodei et al., 2016; Kahn et al., 2020]. Since the largest strides in lowering WERs have resulted from new architectures being developed manually by speech experts slowly over decades, it would be beneficial to scale such exploration through NAS. However, performing NAS directly on large scale ASR datasets needed for peak performance is not practical due to significantly more computational costs. An issue which is further exacerbated when one is also interested in architectures yielding lower latency and computational cost.
106
+
107
+ ![](images/0a233ba78d8aee5f9c455f2ba91df694b349684b59f498ebb491da70235c132a.jpg)
108
+ Figure 7: Transfer between TIMIT and Librispeech on validation and test datasets with high validation and test correlation of 0.85 and 0.86, respectively.
109
+
110
+ ![](images/497bc85272436c739e1a2bbaeb0089c0470480b07bbfc555b59bdd88e62e8650.jpg)
111
+ Figure 6: Test PER versus latency, colorcoded by the number of parameters. Best models, Pareto-optimal models, and selected TDS-like models are highlighted.
112
+
113
+ For this reason, we explore how well new architectures found by NAS on TIMIT (5 hours) transfer to Librispeech (100 hours). Specifically, we investigate the correlation between the PER of best/random/worst performing architectures found on TIMIT, and the Label Error Rate (LER) (or WER) obtained when training the same architectures on Librispeech. If a high correlation is present, this would mean that one could lower the computational requirements of NAS by running it on a smaller datasets. In our case this would mean a $2 0 \mathrm { x }$ speedup in NAS, and in general this would open a new avenue for research, namely on how much one could save by running NAS on different smaller datasets, or running NAS on a subset of a larger dataset extracted by current or next generation data summarization techniques.
114
+
115
+ Librispeech Dataset. Librispeech [Panayotov et al., 2015] is a widely used ASR training and benchmarking database of about 1, 000 hours of speech derived from audiobooks. The training dataset is partitioned into clean-100, clean-360 and other-500 sets with the clean partitions exhibiting much higher SNR. The test and dev sets are also partitioned similarly. In our work, we have used clean100 partition for training and dev-clean and test-clean for validation and testing. The choice of 100 hours partition is to strike a balance between building a decent large scale model, while still keeping the computational cost involved in architecture search experiments plausible. Previous literature indicates that the models trained on 100 hours partition are about $1 { - } 1 . 5 \%$ absolute [Panayotov et al., 2015] behind the models trained on 1, 000 hours when evaluated on test-clean set.
116
+
117
+ Training. Librispeech models were trained with 4 GPUs with Horovod distributed framework. We use 80-dimensional log-mel features computed over $2 5 \mathrm { m s }$ Hamming windows strided by $1 0 \mathrm { m s }$ . Guided by latency considerations, we used a vocabulary of 780 sub-word tokens as output. Model performances are measured by tracking CTC loss, LER, and WER on the validation dataset during training and on test dataset post-training.
118
+
119
+ Pilot Experiments. Similarly to $\ S 3 . 3$ , we also conducted a pilot experiment to determine appropriate macro structure parameters and hyper-parameters to train the models for Librispeech. To promote transferability between datasets at a reasonable compute cost, with the micro cell of the best model found on TIMIT dataset (out of 8, 242), we conducted another grid search but instead on Librispeech dataset. Accordingly, we chose the final number of filters, kernel size, dilation, learning rate, decay factor and start epoch based on lowest LER/WER on Librispeech.
120
+
121
+ Correlation Analysis. For a meaningful analysis we selected 100 architectures from our search space based on their TIMIT PER, namely we took the best 20, 70 random, and the worst 10. We then plugged the micro cell architectures into the macro architecture for Librispeech. Finally, we trained these models on Librispeech with the hyper-parameters reported earlier and computed their LERs/WERs. We observe that models that didn’t converge for TIMIT also didn’t converge for Librispeech. For this reason, when looking at the strength of transferability between TIMIT and Librispeech we considered models that had TIMIT PER lower than $5 0 \%$ . As shown in Figure 7, there is a high correlation between TIMIT PER and Librispeech WER. In particular, we observe 0.85 correlation between validation metrics, and 0.86 for test metrics. Thus, it is possible to do indirect NAS for cell micro architecture on Librispeech by first applying NAS on TIMIT, and then reusing the identified cell structures in a macro architecture suitable for Librispeech.
122
+
123
+ ![](images/d186067c75eeae1e888505f877c7e2769abdcbca921b47fe3e35c848d17cfbda.jpg)
124
+ Figure 8: Performance of NAS algorithms on our ASR search space, where shaded regions mark interquartile ranges. The dashed line represents the best model in the dataset across all seeds.
125
+
126
+ # 6 NAS EXPERIMENTS
127
+
128
+ Following existing NAS benchmarks, we include results from running different NAS algorithms on our search space, using the NAS-Bench-ASR to query for accuracy of models. We consider the following standard NAS algorithms: Regularized Evolution (RE) [Real et al., 2018], Hyperband (HYPB) [Li et al., 2017], REINFORCE with an LSTM-based controller (REINF) [Zoph & Le, 2017], Binary Predictor (BP) [Dudziak et al., 2020], and Random Search (RAND) [Li & Talwalkar, 2019]. We also include an algorithm based on Deep Q-Learning (QLRN), which behaves similarly to RE but tries to chain mutations (actions) and learns what mutations can eventually lead to better results. We report results as functions of “trained models” to unify notion of cost. Because in the full training setting we trained models for 40 epochs, if an algorithm trains a model for fewer epochs than that (e.g. HYPB) we consider the cost of such a training to be $n / 4 0$ of a “trained model”, where $n$ is the number of epochs used $0 < n \leq 4 0$ ). We run each algorithm 100 times and present results in Figure 8 as average test PER of the best model found (all algorithms were using validation accuracy as their optimization target), and average validation PER of the most recently trained model (after smoothing the curve using exponential moving average with weight 0.9). We found that none of the algorithms were able to consistently find the best model – this is somewhat surprising given the moderate size our search space and the fact that algorithms like RE are able to consistently find the best model on NAS-Bench-201, given similar budget. Another interesting observation is related to the weak correlation between validation and test accuracies mentioned in the previous sections. By comparing the figures on the right and left sides (Figure 8), we can see that algorithms which tend to better optimize their rewards (validation accuracy) as search progresses are not necessarily better in the test PER objective – this is especially visible in the case of REINFORCE, which significantly outperforms random search if validation accuracy is considered, but when evaluated using test PER it presents comparable results. Another surprise is weak performance of Hyperband – the only algorithm that has the ability to adjust number of epochs to train models. From our observations it seems that many of our models converge to relatively good PER values fast (after 5-10 epochs) so we expected Hyperband to be able to leverage this property. However, it seems that in the case of our search space this is not so helpful – potentially because models might still change relative ordering as they are trained for more epochs despite the fact that they have already achieved decent performance.
129
+
130
+ # 7 CONCLUSIONS
131
+
132
+ We introduced NAS-Bench-ASR, a first comprehensive dataset for allowing computationally inexpensive training/test time evaluation of model performances, while conducting NAS research in the domain of ASR. We trained 8, 242 unique models on the TIMIT dataset for three initializations and three target epochs. In addition to the common training metrics in ASR, e.g., PER, CTC-loss, we also provide information on the number of parameters, FLOPS and latency of running all the models on two hardware platforms for varying batch sizes. Model run-times are especially beneficial for NAS researchers interested in optimizing architectures for efficient on-device deployment. We presented a comprehensive analysis of our dataset and evaluated the performances of a number of NAS algorithms on it. Lastly, we show that good cell structures as identified on the TIMIT dataset transfer well to Librispeech, which paves the way for affordable NAS on ASR domain.
133
+
134
+ # REFERENCES
135
+
136
+ Dario Amodei, Sundaram Ananthanarayanan, Rishita Anubhai, Jingliang Bai, Eric Battenberg, Carl Case, Jared Casper, Bryan Catanzaro, Qiang Cheng, Guoliang Chen, and et al. Deep Speech 2: End-to-End Speech Recognition in English and Mandarin. In ICML, 2016.
137
+
138
+ Ahmed Baruwa, Mojeed Abisiga, Ibrahim Gbadegesin, and Afeez Fakunle. Leveraging End-toEnd Speech Recognition with Neural Architecture Search. International Journal of Scientific Engineering Research, 10(11), 2019.
139
+
140
+ Han Cai, Chuang Gan, and Song Han. Once for all: Train one network and specialize it for efficient deployment. In ICLR, 2020.
141
+
142
+ Xin Chen, Lingxi Xie, Jun Wu, and Qi Tian. Progressive differentiable architecture search: Bridging the depth gap between search and evaluation. In ICCV, 2019.
143
+
144
+ Yi-Chen Chen, Jui-Yang Hsu, Cheng-Kuang Lee, and Hung yi Lee. DARTS-ASR: Differentiable Architecture Search for Multilingual Speech Recognition and Adaptation. In Interspeech, 2020.
145
+
146
+ Chung-Cheng Chiu and Colin Raffel. Monotonic chunkwise attention. In ICLR, 2018.
147
+
148
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In ACL, 2019.
149
+
150
+ Shaojin Ding, Tianlong Chen, Xinyu Gong, Weiwei Zha, and Zhangyang Wang. AutoSpeech: Neural Architecture Search for Speaker Recognition. In Interspeech, 2020.
151
+
152
+ Xuanyi Dong and Yi Yang. NAS-Bench-201: Extending the Scope of Reproducible Neural Architecture Search. In ICLR, 2020.
153
+
154
+ Łukasz Dudziak, Thomas Chau, Mohamed S. Abdelfattah, Royson Lee, Hyeji Kim, and Nicholas D. Lane. BRP-NAS: Prediction-based NAS using GCNs. In NeurIPS, 2020.
155
+
156
+ M. Gales, K. Knill, A. Ragni, and Shakti P. Rath. Speech recognition and keyword spotting for low-resource languages: Babel project research at CUED. In SLTU, 2014.
157
+
158
+ John S. Garofolo, Lori F. Lamel, William M. Fisher, Jonathan G. Fiscus, David S. Pallett, Nancy L. Dahlgren, and Victor Zue. TIMIT Acoustic Phonetic Continuous Speech Corpus. Linguistic Data Consortium, 1993.
159
+
160
+ Awni Hannun, Ann Lee, Qiantong Xu, and Ronan Collobert. Sequence-to-Sequence Speech Recognition with Time-Depth Separable Convolutions. In Interspeech, 2019.
161
+
162
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
163
+
164
+ Liqiang He, Dan Su, and Dong Yu. Learned transferable architectures can surpass hand-designed architectures for large scale speech recognition. arXiv preprint arXiv:2008.11589, 2020.
165
+
166
+ Andrew Howard, Ruoming Pang, Hartwig Adam, Quoc Le, Mark Sandler, Bo Chen, Weijun Wang, Liang-Chieh Chen, Mingxing Tan, Grace Chu, Vijay Vasudevan, and Yukun Zhu. Searching for MobileNetV3. In ICCV, 2019.
167
+
168
+ J. Kahn, M. Riviere, W. Zheng, E. Kharitonov, Q. Xu, P. E. Mazar \` e, J. Karadayi, V. Liptchinsky, ´ R. Collobert, C. Fuegen, T. Likhomanenko, G. Synnaeve, A. Joulin, A. Mohamed, and E. Dupoux. Libri-Light: A Benchmark for ASR with Limited or No Supervision. In ICASSP, 2020.
169
+
170
+ Jihwan Kim, Jisung Wang, Sangki Kim, and Yeha Lee. Evolved Speech-Transformer: Applying Neural Architecture Search to End-to-End Automatic Speech Recognition. In Interspeech, 2020.
171
+
172
+ Kwangyoun Kim, Kyungmin Lee, Dhananjaya Gowda, Junmo Park, Sungsoo Kim, Eunhyang S. Kim, Young-Yoon Lee, Jinsu Yeo, Daehyun Kim, Seokyeong Jung, Jungin Lee, Myoungji Han, and Chanwoo Kim. Attention based on-device streaming speech recognition with large speech corpus. In ASRU, 2019.
173
+
174
+ Nikita Klyuchnikov, Ilya Trofimov, Ekaterina Artemova, Mikhail Salnikov, Maxim Fedorov, and Evgeny Burnaev. NAS-Bench-NLP: Neural Architecture Search Benchmark for Natural Language Processing. arXiv preprint arXiv:2006.07116, 2020.
175
+
176
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. In NeurIPS, 2012.
177
+
178
+ K-F Lee and H-W Hon. Speaker-independent phone recognition using hidden markov models. IEEE Transactions on Acoustics, Speech, and Signal Processing, 37(11), 1989.
179
+
180
+ Royson Lee, Łukasz Dudziak, Mohamed Abdelfattah, Stylianos Venieris, Hyeji Kim, Hongkai Wen, and Nicholas Lane. Journey towards tiny perceptual super-resolution. In ECCV, 2020.
181
+
182
+ Jixiang Li, Chuming Liang, Bo Zhang, Zhao Wang, Fei Xiang, and Xiangxiang Chu. Neural Architecture Search on Acoustic Scene Classification. In Interspeech, 2020.
183
+
184
+ Liam Li and Ameet Talwalkar. Random search and reproducibility for neural architecture search. In UAI, 2019.
185
+
186
+ Lisha Li, Kevin Jamieson, Giulia DeSalvo, Afshin Rostamizadeh, and Ameet Talwalkar. Hyperband: A novel bandit-based approach to hyperparameter optimization. JMLR, 18(1), 2017.
187
+
188
+ Hanxiao Liu, Karen Simonyan, and Yiming Yang. DARTS: Differentiable architecture search. In ICLR, 2019.
189
+
190
+ Hanna Mazzawi, Xavi Gonzalvo, Aleks Kracun, Prashant Sridhar, Niranjan Subrahmanya, Ignacio Lopez Moreno, Hyun Jin Park, and Patrick Violette. Improving Keyword Spotting and Language Identification via Neural Architecture Search at Scale. In Interspeech, 2019.
191
+
192
+ Tong Mo, Yakun Yu, Mohammad Salameh, Di Niu, and Shangling Jui. Neural Architecture Search for Keyword Spotting. In Interspeech, 2020.
193
+
194
+ V. Panayotov, G. Chen, D. Povey, and S. Khudanpur. Librispeech: An ASR corpus based on public domain audio books. In ICASSP, 2015.
195
+
196
+ Daniel S. Park, William Chan, Yu Zhang, Chung-Cheng Chiu, Barret Zoph, Ekin D. Cubuk, and Quoc V. Le. SpecAugment: A simple data augmentation method for Automatic Speech Recognition. In Interspeech, 2019.
197
+
198
+ Hieu Pham, Melody Guan, Barret Zoph, Quoc Le, and Jeff Dean. Efficient Neural Architecture Search via Parameters Sharing. In ICML, 2018.
199
+
200
+ Vineel Pratap, Qiantong Xu, Jacob Kahn, Gilad Avidov, Tatiana Likhomanenko, Awni Hannun, Vitaliy Liptchinsky, Gabriel Synnaeve, and Ronan Collobert. Scaling up online speech recognition using convnets. In Interspeech, 2020.
201
+
202
+ Xiaoyang Qu, Jianzong Wang, and Jing Xiao. Evolutionary Algorithm Enhanced Neural Architecture Search for Text-Independent Speaker Verification. In Interspeech, 2020.
203
+
204
+ Esteban Real, Alok Aggarwal, Yanping Huang, and Quoc V. Le. Regularized evolution for image classifier architecture search. In AAAI, 2018.
205
+
206
+ Christian Sciuto, Kaicheng Yu, Martin Jaggi, Claudiu Musat, and Mathieu Salzmann. Evaluating the search phase of neural architecture search. In ICLR, 2020.
207
+
208
+ Julien Siems, Lucas Zimmer, Arber Zela, Jovita Lukasik, Margret Keuper, and Frank Hutter. NASBench-301 and the Case for Surrogate Benchmarks for Neural Architecture Search. arXiv preprint arXiv:2008.09777, 2020.
209
+
210
+ Gabriel Synnaeve, Qiantong Xu, Jacob Kahn, Edouard Grave, Tatiana Likhomanenko, Vineel Pratap, Anuroop Sriram, Vitaliy Liptchinsky, and Ronan Collobert. End-to-End ASR: From supervised to semi-supervised learning with modern architectures. In ICML: Workshop on Selfsupervision in Audio and Speech, 2020.
211
+
212
+ Mingxing Tan and Quoc V. Le. EfficientNet: Rethinking model scaling for convolutional neural networks. ICML, 2019.
213
+ Mingxing Tan, Bo Chen, Ruoming Pang, Vijay Vasudevan, Mark Sandler, Andrew Howard, and Quoc V. Le. MnasNet: Platform-Aware Neural Architecture Search for Mobile. In CVPR, 2019.
214
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, 2017.
215
+ Chris Ying. Enumerating unique computational graphs via an iterative graph invariant. arXiv preprint arXiv:1902.06192, 2019.
216
+ Chris Ying, Aaron Klein, Eric Christiansen, Esteban Real, Kevin Murphy, and Frank Hutter. NASBench-101: Towards Reproducible Neural Architecture Search. In ICML, 2019.
217
+ Arber Zela, Julien Siems, and Frank Hutter. NAS-Bench-1Shot1: Benchmarking and Dissecting One-shot Neural Architecture Search. In ICLR, 2020.
218
+ Barret Zoph and Quoc V. Le. Neural architecture search with reinforcement learning. ICLR, 2017.
219
+
220
+ # A APPENDIX
221
+
222
+ Our dataset comprises of 8,242 unique models that were trained for three target epochs and each starting with three different initializations. In this appendix we present the results for the models with different initializations and target epochs.
223
+
224
+ # A.1 CORRELATION BETWEEN VALIDATION AND TEST PERS FOR THE RUNS WITHDIFFERENT TARGET EPOCHS
225
+
226
+ In this section we present the correlation of validation and test PERs between different target epochs. Specifically, we correlate each run of target epoch 40 (i.e., runs starting with unique initialization and trained for 40 epochs) with the runs for target epoch 5 and 10. This analysis informs us if reduced training (i.e., target epoch of 5 or 10) can be used as a good proxy for NAS. As shown in Table 3, there is weak correlation of target epoch 40 and 5. However, there is a moderate correlation between target epoch 40 and 10, suggesting that the reduced training might be useful for performing NAS.
227
+
228
+ Table 3: Correlation of validation and test PERs between different target epochs.
229
+
230
+ <table><tr><td rowspan="2">E-40</td><td colspan="2">E-5</td><td colspan="2">E-10</td></tr><tr><td>Validation</td><td>Test</td><td>Validation</td><td>Test</td></tr><tr><td>Run 1</td><td>0.3349</td><td>0.3097</td><td>0.5493</td><td>0.5029</td></tr><tr><td>Run 2</td><td>0.2986</td><td>0.3022</td><td>0.5138</td><td>0.4793</td></tr><tr><td>Run 3</td><td>0.3234</td><td>0.3362</td><td>0.526</td><td>0.5112</td></tr></table>
231
+
232
+ # A.2 CORRELATION BETWEEN VALIDATION AND TEST PERS
233
+
234
+ In this section we present the correlation between the final test PER and the best validation PER for the three runs for target epoch 40 starting with different initializations, which is extension of results presented in Figure 2. As shown in Figure 9, the results for all seeds are similar. Specifically, there is moderate correlation for top models, weak for middle ones, and strong for worst ones.
235
+
236
+ # A.3 CELL ARCHITECTURES IN OUR SEARCH SPACE
237
+
238
+ In this section we present the micro-cell architectures in our search space that achieved best validation and test PERs for the three runs starting with different initializations. Figure 10 shows the micro-cell architectures that achieved best validation PERs (in top row) and best test PERs (in bottom row). We observe that the micro-cell architectures of top models often start with two convolution layers followed by a linear layer (which is consistent across all architectures).
239
+
240
+ # A.4 IMPACT OF DIFFERENT OPERATIONS-COUNT ON MODEL PERFORMANCE
241
+
242
+ In this section we present the impact of the number of selected operation on the model performance. As shown in Figure 11, models with more convolution layers, or with no linear layer are ranked as worst performing models. At the same time, models with a zero ops in the main edge have poor performance. This indicates that the top performing models are designed such that all nodes comprise of linear and convolution layers. We also observe that an increase in the number of skip connections deteriorates performance significantly, with surprisingly two skip connections yielding similar results to the traditional one skip connection, which aims to learn a perturbation of the identity rather than a generic transformation between input and output nodes.
243
+
244
+ ![](images/2aa7682ff6f6d64290a750a2d26b39eb19920f1daafef8c9f300ce841533edbc.jpg)
245
+ Figure 9: Correlation of best validation and final test PER. Figures in the columns are for top, middle and bottom 1, 000 models. Each row represents the results for runs with unique initialization.
246
+
247
+ ![](images/c0ccbaca6895863c9d9bf36bcfa08a7e0052cf30b1cbfb715abb577138a20acd.jpg)
248
+ Figure 10: Cell architectures in our search space with best validation and test PERs for the three runs.
249
+
250
+ ![](images/35a23870e5ce55539da32c082d7b165e304948c4426de4dd851989434dd2fb1b.jpg)
251
+ Figure 11: Positions of models in the ranking according to their test PER, when they are grouped according to the number of Convolution layer (first column), Linear layer (second column), Zero op (third column) and Skip-connections (last column). Each row correspond to the results for a run with unique inititialization.
md/train/D3PcGLdMx0/D3PcGLdMx0.md ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MELR: META-LEARNING VIA MODELING EPISODELEVEL RELATIONSHIPS FOR FEW-SHOT LEARNING
2
+
3
+ Nanyi Fei
4
+ School of Information, Renmin University of China, Beijing, China
5
+ feinanyi@ruc.edu.cn Zhiwu Lu ∗
6
+ Gaoling School of Artificial Intelligence, Renmin University of China, Beijing, China Beijing Key Laboratory of Big Data Management and Analysis Methods, Beijing, China luzhiwu@ruc.edu.cn
7
+
8
+ Tao Xiang University of Surrey Guildford, Surrey, UK t.xiang@surrey.ac.uk
9
+
10
+ Songfang Huang
11
+ Alibaba DAMO Academy
12
+ Hangzhou, China
13
+ songfang.hsf@alibaba-inc.com
14
+
15
+ # ABSTRACT
16
+
17
+ Most recent few-shot learning (FSL) approaches are based on episodic training whereby each episode samples few training instances (shots) per class to imitate the test condition. However, this strict adhering to test condition has a negative side effect, that is, the trained model is susceptible to the poor sampling of few shots. In this work, for the first time, this problem is addressed by exploiting interepisode relationships. Specifically, a novel meta-learning via modeling episodelevel relationships (MELR) framework is proposed. By sampling two episodes containing the same set of classes for meta-training, MELR is designed to ensure that the meta-learned model is robust against the presence of poorly-sampled shots in the meta-test stage. This is achieved through two key components: (1) a Cross-Episode Attention Module (CEAM) to improve the ability of alleviating the effects of poorly-sampled shots, and (2) a Cross-Episode Consistency Regularization (CECR) to enforce that the two classifiers learned from the two episodes are consistent even when there are unrepresentative instances. Extensive experiments for non-transductive standard FSL on two benchmarks show that our MELR achieves $1 . 0 \% { - } 5 . 0 \%$ improvements over the baseline (i.e., ProtoNet) used for FSL in our model and outperforms the latest competitors under the same settings.
18
+
19
+ # 1 INTRODUCTION
20
+
21
+ Deep convolutional neural networks (CNNs) have achieved tremendous successes in a wide range of computer vision tasks including object recognition (Krizhevsky et al., 2012; Simonyan & Zisserman, 2015; Russakovsky et al., 2015; He et al., 2016a), semantic segmentation (Long et al., 2015; Chen et al., 2018), and object detection (Ren et al., 2015; Redmon et al., 2016). For most visual recognition tasks, at least hundreds of labeled training images are required from each class for training a CNN model. However, collecting a large number of labeled training samples is costly and may even be impossible in real-life application scenarios (Antonie et al., 2001; Yang et al., 2012). To reduce the reliance of deep neural networks on large amount of annotated training data, few-shot learning (FSL) has been studied (Vinyals et al., 2016; Finn et al., 2017; Snell et al., 2017; Sung et al., 2018), which aims to recognize a set of novel classes with only a few labeled samples by knowledge transfer from a set of base classes with abundant samples.
22
+
23
+ Recently, FSL has been dominated by meta-learning based approaches (Finn et al., 2017; Snell et al., 2017; Sung et al., 2018; Lee et al., 2019; Ye et al., 2020), which exploit the ample samples from base classes via episodic training. During meta-training, to imitate an $N$ -way $K$ -shot novel class recognition task, an $N$ -way $K$ -shot episode/meta-task is sampled in each iteration from the base classes, consisting of a support set and a query set. By setting up the meta-training episodes exactly the same way as the meta-test ones (i.e., $N$ -way $K$ -shot in the support set), the objective is to ensure that the meta-learned model can generalize to novel tasks. However, this also leads to an unwanted side-effect, that is, the model will be susceptible to the poor sampling of the few shots.
24
+
25
+ Outlying training instances are prevalence in vision benchmarks which can be caused by various factors such as occlusions or unusual pose/lighting conditions. When trained with ample samples, modern CNN-based recognition models are typically robust against abnormal instances as long as they are not dominant. However, when as few as one shot per class is used to build a classifier for FSL, the poorly-sampled few shots could be catastrophic, e.g., when the cat class is represented in the support set by a single image of a half-occluded cat viewed from behind, it would be extremely hard to build a classifier to recognize cats in the query set that are mostly full-body visible and frontal. Existing episodic-training based FSL models do not offer any solution to this problem. The main reason is that different episodes are sampled randomly and independently. When the cat class is sampled in two episodes, these models are not aware that they are the same class, and thus cannot enforce the classifiers independently learned to be consistent to each other, regardless whether there exist poorly-sampled shots in one of the two episodes.
26
+
27
+ In this paper, a novel meta-learning via modeling episode-level relationships (MELR) framework is proposed to address the poor sampling problem of the support set instances in FSL. In contrast to the existing episodic training strategy, MELR conducts meta learning over two episodes deliberately sampled to contain the same set of base classes but different instances. In this way, cross-episode model consistency can be enforced so that the meta-learned model is robust against poorly-sampled shots in the meta-test stage. Concretely, MELR consists of two key components: Cross-Episode Attention Module (CEAM) and Cross-Episode Consistency Regularization (CECR). CEAM is composed of a cross-episode transformer which allows the support set instances to be examined through attention so that unrepresentative support samples can be identified and their negative effects alleviated (especially for computing class prototypes/centers). CECR, on the other hand, exploits the fact that since the two episodes contain the same set of classes, the obtained classifiers (class prototypes) should produce consistent predictions regardless whether there are any poorly-sampled instances in the support set and/or which episode a query instance comes from. This consistency is enforced via cross-episode knowledge distillation.
28
+
29
+ Our main contributions are three-fold: (1) For the first time, the poor sampling problem of the few shots is formally tackled by modeling the episode-level relationships in meta-learning based FSL. (2) We propose a novel MELR model with two cross-episode components (i.e., CEAM and CECR) to explicitly enforce that the classifiers of the same classes learned from different episodes need to be consistent regardless whether there exist poorly-sampled shots. (3) Extensive experiments for non-transductive standard FSL on two benchmarks show that our MELR achieves significant improvements over the baseline ProtoNet (Snell et al., 2017) and even outperforms the latest competitors under the same settings. We will release the code and models soon.
30
+
31
+ # 2 RELATED WORK
32
+
33
+ Few-Shot Learning. Few-shot learning (FSL) has become topical recently. Existing methods can be generally divided into four groups: (1) Metric-based methods either learn a suitable embedding space for their chosen/proposed distance metrics (e.g., cosine similarity (Vinyals et al., 2016), Euclidean distance (Snell et al., 2017), and a novel measure SEN (Nguyen et al., 2020)) or directly learn a suitable distance metric (e.g., CNN-based relation module (Sung et al., 2018; Wu et al., 2019), ridge regression (Bertinetto et al., 2019), and graph neural networks (Satorras & Estrach, 2018; Kim et al., 2019; Yang et al., 2020)). Moreover, several approaches (Yoon et al., 2019; Li et al., 2019a; Qiao et al., 2019; Ye et al., 2020; Simon et al., 2020) learn task-specific metrics which are adaptive to each episode instead of learning a shared task-agnostic metric space. (2) Model-based methods (Finn et al., 2017; Nichol et al., 2018; Rusu et al., 2019) learn good model initializations on base classes and then quickly adapt (i.e., finetune) them on novel classes with few shots and a limited number of gradient update steps. (3) Optimization-based methods (Ravi & Larochelle, 2017; Munkhdalai & Yu, 2017; Li et al., 2017) aim to learn to optimize, that is, to meta-learn optimization algorithms suitable for quick finetuning from base to novel classes. (4) Hallucination-based methods (Hariharan & Girshick, 2017; Wang et al., 2018; Schwartz et al., 2018; Li et al., 2020) learn generators on base classes and then hallucinate new novel class data to augment the few shots. Additionally, there are also other methods that learn to predict network parameters given few novel class samples (Qiao et al., 2018; Gidaris & Komodakis, 2019; Guo & Cheung, 2020). Although the metric-based ProtoNet (Snell et al., 2017) is used as our baseline in this paper, our proposed MELR framework can be easily integrated with other episodic-training based methods.
34
+
35
+ Modeling Episode-Level Relationships. In the FSL area, relatively less effort has been made to explicitly model the relationships across episodes. For modeling such episode-level relationships, there are two recent examples: (1) LGM-Net (Li et al., 2019b) proposes an inter-task normalization strategy, which applies batch normalization to all support samples across a batch of episodes in each training iteration. (2) Among a batch of episodes, Meta-Transfer Learning (Sun et al., 2019) records the class with the lowest accuracy in each episode and then re-samples ‘hard’ meta-tasks from the set of recorded classes. In this work, instead of utilizing the relationships implicitly, we propose to model episode-level relationships (MELR) explicitly by focusing on episodes with the same set of classes. Furthermore, our MELR is specifically designed to cope with the poor sampling of the few shots – an objective very different from those in (Li et al., 2019b; Sun et al., 2019).
36
+
37
+ Attention Mechanism. Attention mechanism was first proposed by (Bahdanau et al., 2015) for machine translation and has now achieved great success in natural language processing (Vaswani et al., 2017) and computer vision (Xu et al., 2015). An attention module typically takes a triplet (queries, keys, values) as input and learns interactions between queries and key-value pairs according to certain task objectives. It is referred to as self-attention or cross-attention depending on whether keys and queries are the same. Several recent works (Hou et al., 2019; Guo & Cheung, 2020; Ye et al., 2020) have utilized attention mechanism for meta-learning based FSL. CAN (Hou et al., 2019) employs cross-attention between support and query samples to learn better feature representations. AWGIM (Guo & Cheung, 2020) adopts both self- and cross-attention for generating classification weights. FEAT (Ye et al., 2020) only uses self-attention on the class prototypes of the support set. The biggest difference between these methods and our MELR lies in whether attention is modeled within each episode or across episodes. Only MELR allows modeling cross-episode instance attention explicitly so that the meta-learned model can be insensitive to badly-sampled support set instances. In addition, in our MELR, query set instances are also updated using cross-attention whilst existing models such as FEAT only apply attention to prototypes obtained using support set instances. They thus cannot directly handle instance-level anomalies.
38
+
39
+ # 3 METHODOLOGY
40
+
41
+ # 3.1 PROBLEM DEFINITION
42
+
43
+ Let $\mathcal { D } _ { b } = \{ ( x _ { i } , y _ { i } ) | y _ { i } \in \mathcal { C } _ { b } , i = 1 , 2 , \cdot \cdot \cdot , N _ { b } \}$ denote an abundant meta-training set from base classes $\mathcal { C } _ { b }$ , where $x _ { i }$ is the $i$ -th image, $y _ { i }$ denotes the class label of $x _ { i }$ , and $N _ { b }$ is the number of images in $\mathcal { D } _ { b }$ . Similarly, let $\mathcal { D } _ { n } = \{ ( x _ { i } , y _ { i } ) | y _ { i } \in \mathcal { C } _ { n } , i = 1 , 2 , \cdot \cdot \cdot , N _ { n } \}$ denote a few-shot sample set from a set of novel classes $\mathcal { C } _ { n }$ (e.g., $K$ -shot means that each novel class has $K$ labeled images and $N _ { n } = K | \mathcal { C } _ { n } | )$ , where $\mathcal { C } _ { b } \cap \mathcal { C } _ { n } = \emptyset$ . We are also given a test set $\tau$ from $\mathcal { C } _ { n }$ , where $\mathcal { D } _ { n } \cap \mathcal { T } = \emptyset$ . By exploiting $\mathcal { D } _ { b }$ and $\mathcal { D } _ { n }$ for training, the objective of few-shot learning (FSL) is to predict the class labels of test images in $\tau$ .
44
+
45
+ # 3.2 META-LEARNING BASED FSL
46
+
47
+ Most FSL methods are based on meta-learning (Vinyals et al., 2016; Finn et al., 2017; Snell et al., 2017; Sung et al., 2018; Lee et al., 2019; Ye et al., 2020), which adopt episodic training on the base class sample set $\mathcal { D } _ { b }$ and test their models over few-shot classification tasks sampled from the novel classes ${ \mathcal { C } } _ { n }$ . Concretely, an $N$ -way $K$ -shot $Q$ -query episode $e = ( S _ { e } , \mathcal { Q } _ { e } )$ is generated as follows: (1) We first randomly sample a subset $\mathcal { C } _ { e }$ from base classes $\mathcal { C } _ { b }$ during meta-training (or from novel classes $\mathcal { C } _ { n }$ during meta-test) and re-index it as $\mathcal { C } _ { e } = \{ 1 , 2 , \cdots , N \}$ . (2) For each class in $\mathcal { C } _ { e }$ , $K$ support and $Q$ query images are then randomly sampled to form the support set $\begin{array} { r } { S _ { e } = \{ ( x _ { i } , y _ { i } ) | y _ { i } \in } \end{array}$ $\mathcal { C } _ { e } , i = 1 , 2 , \cdots , N \times K \}$ and the query set ${ \mathcal { Q } } _ { e } \ = \ \{ ( x _ { i } , y _ { i } ) | y _ { i } \in { \mathcal { C } } _ { e } , i \ = \ 1 , 2 , \cdot \cdot \cdot , N \times Q \}$ $( S _ { e } \cap \mathcal { Q } _ { e } = \emptyset )$ ), respectively.
48
+
49
+ ![](images/4ad280f68813e43a41938f4193c35279d033d737dec993ac341152df5d45392c.jpg)
50
+ Figure 1: The schematic illustration of the proposed MELR model. It consists of two main components for modeling episode-level relationships: Cross-Episode Attention Module (CEAM) and Cross-Episode Consistency Regularization (CECR). For clarity, only the 5-way 1-shot setting is presented here. Each red/blue cuboid denotes a single instance.
51
+
52
+ A meta-learning based FSL approach typically designs a few-shot classification loss over the query set $\mathcal { Q } _ { e }$ for each meta-training episode $e$ :
53
+
54
+ $$
55
+ L _ { f s c } ( e ) = \mathbb { E } _ { ( x _ { i } , y _ { i } ) \in \mathcal { Q } _ { e } } L ( y _ { i } , f ( \psi ( x _ { i } ) ; \mathcal { S } _ { e } ) ) ,
56
+ $$
57
+
58
+ where $\psi$ denotes a feature extractor with an output dimension $d$ , $f ( \cdot ; S _ { e } ) : \mathbb { R } ^ { d } \to \mathbb { R } ^ { N }$ can be any scoring function constructed from the support set $S _ { e }$ , and $L ( \cdot , \cdot )$ is the classification loss (e.g., widely used cross-entropy). By minimizing the above loss function via back propagation to update the part of the model to be meta-learned (e.g., $\psi$ in ProtoNet), the model is trained over many meta-training episodes and then evaluated on the meta-test episodes.
59
+
60
+ # 3.3 MODELING EPISODE-LEVEL RELATIONSHIPS (MELR)
61
+
62
+ In the FSL area, relatively less effort has been made to explicitly model the relationships across episodes, and many FSL methods define their loss functions within each episode independently. In contrast, with our Modeling Episode-Level Relationships (MELR), two $N$ -way episodes are sampled in each training iteration from exactly the same set of $N$ base classes. Cross-Episode Attention Module (CEAM) and Cross-Episode Consistency Regularization (CECR) are then devised to exploit this type of episode-level relationship explicitly (see Figure 1).
63
+
64
+ Cross-Episode Attention Module (CEAM). We are given two $N$ -way $K$ -shot $Q$ -query episodes $e ^ { ( 1 ) } = ( \bar { S } _ { e } ^ { ( 1 ) } , \mathcal { Q } _ { e } ^ { ( 1 ) } )$ and $e ^ { ( 2 ) } = ( S _ { e } ^ { ( 2 ) } , \mathcal { Q } _ { e } ^ { ( 2 ) } )$ sampled from the same subset $\mathcal { C } _ { e }$ of $\mathcal { C } _ { b }$ , where $\mathcal { C } _ { e }$ is re-indexed as $\mathcal { C } _ { e } = \{ 1 , 2 , \cdots , N \}$ , and $e ^ { ( 1 ) } \bigcap e ^ { ( 2 ) } = \emptyset$ . For both episodes, to minimize the negative impact of badly-sampled few shots for a given query instance, we propose CEAM for cross-episode attention modeling, which is detailed below.
65
+
66
+ Concretely, let $\mathbf { S } ^ { ( 1 ) } = [ \boldsymbol { \psi } ( x _ { i } ) ^ { T } ; x _ { i } \in \mathcal { S } _ { e } ^ { ( 1 ) } ] \in \mathbb { R } ^ { N K \times d }$ (or $\mathbf { S } ^ { ( 2 ) }$ ) and ${ \bf Q } ^ { ( 1 ) } = [ \psi ( x _ { i } ) ^ { T } ; x _ { i } \in \mathcal { Q } _ { e } ^ { ( 1 ) } ] \in$ $\mathbb { R } ^ { N Q \times d }$ (or $\mathbf { Q } ^ { ( 2 ) } )$ denote the feature matrices of support and query samples in $e ^ { ( 1 ) }$ (or $e ^ { ( 2 ) }$ ), respectively, and let ${ \bf F } ^ { ( 1 ) } = [ { \bf S } ^ { ( 1 ) } ; { \bf Q } ^ { ( 1 ) } ] \in \mathbb { R } ^ { N ( K + Q ) \times d }$ (or $\mathbf { F } ^ { ( 2 ) } = [ \mathbf { S } ^ { ( 2 ) } ; \mathbf { Q } ^ { ( 2 ) } ] )$ be the feature matrix of all samples in $e ^ { ( 1 ) }$ (or $e ^ { ( 2 ) }$ ). For episode $e ^ { ( 1 ) }$ , CEAM takes the triplet $( \mathbf { \dot { F } } ^ { ( 1 ) } , \mathbf { S } ^ { ( 2 ) } , \mathbf { S } ^ { ( 2 ) } )$ as input, which corresponds to the input (queries, keys, values) in a typical attention module:
67
+
68
+ $$
69
+ \hat { \mathbf { F } } ^ { ( 1 ) } = \mathbf { C E A M } ( \mathbf { F } ^ { ( 1 ) } , \mathbf { S } ^ { ( 2 ) } , \mathbf { S } ^ { ( 2 ) } ) = \mathbf { F } ^ { ( 1 ) } + \mathrm { s o f t m a x } ( \frac { \mathbf { F } _ { Q } ^ { ( 1 ) } \mathbf { S } _ { K } ^ { ( 2 ) T } } { \sqrt { d } } ) \mathbf { S } _ { V } ^ { ( 2 ) } ,
70
+ $$
71
+
72
+ where the inputs are first linearly mapped into a latent space with the same dimension of the feature space (using projection matrices $\mathbf { W } _ { Q } , \mathbf { W } _ { K } , \mathbf { W } _ { V } \in \mathbb { R } ^ { d \times d } )$ :
73
+
74
+ $$
75
+ \begin{array} { r l } & { \mathbf { F } _ { Q } ^ { ( 1 ) } = \mathbf { F } ^ { ( 1 ) } \mathbf { W } _ { Q } \in \mathbb { R } ^ { N ( K + Q ) \times d } , } \\ & { \mathbf { S } _ { K } ^ { ( 2 ) } = \mathbf { S } ^ { ( 2 ) } \mathbf { W } _ { K } \in \mathbb { R } ^ { N K \times d } , } \\ & { \mathbf { S } _ { V } ^ { ( 2 ) } = \mathbf { S } ^ { ( 2 ) } \mathbf { W } _ { V } \in \mathbb { R } ^ { N K \times d } . } \end{array}
76
+ $$
77
+
78
+ Similarly, for episode $e ^ { ( 2 ) }$ , we have (analogous to Eq. (2)):
79
+
80
+ $$
81
+ \hat { \mathbf { F } } ^ { ( 2 ) } = \mathbf { C E A M } ( \mathbf { F } ^ { ( 2 ) } , \mathbf { S } ^ { ( 1 ) } , \mathbf { S } ^ { ( 1 ) } ) = \mathbf { F } ^ { ( 2 ) } + \mathrm { s o f t m a x } ( \frac { \mathbf { F } _ { Q } ^ { ( 2 ) } \mathbf { S } _ { K } ^ { ( 1 ) T } } { \sqrt { d } } ) \mathbf { S } _ { V } ^ { ( 1 ) } ,
82
+ $$
83
+
84
+ where the learnable parameters of fully connected layers (i.e., $\mathbf { W } _ { Q } , \mathbf { W } _ { K }$ and $\mathbf { W } _ { V }$ ) are shared across Eq. (2) and Eq. (6). We can then obtain the transformed support and query embedding matrices in $e ^ { ( 1 ) }$ (or $e ^ { ( 2 ) }$ ) from $\hat { \mathbf { F } } ^ { ( 1 ) } = [ \hat { \mathbf { S } } ^ { ( 1 ) } ; \hat { \mathbf { Q } } ^ { ( 1 ) } ]$ (or $\hat { \mathbf { F } } ^ { ( 2 ) } = [ \hat { \mathbf { S } } ^ { ( 2 ) } ; \hat { \mathbf { Q } } ^ { ( 2 ) } ] )$ .
85
+
86
+ Cross-Episode Consistency Regularization (CECR). In our MELR model, CEAM utilizes instance-level attention to alleviate the negative effects of the poor support set instance sampling so that each query set instance can be assigned to the right class with minimal loss. Our CECR is designed to further reduce the model sensitivity to badly-sampled shots in different episodes by forcing the two classifiers learned over the two episodes to produce consistent predictions. There are various options on how to enforce such consistency. CECR adopts a knowledge distillation based strategy as empirically it is the most effective one (see Section 4.3).
87
+
88
+ Let $f ( \cdot ; \hat { \mathbf { S } } ^ { ( 1 ) } ) : \mathbb { R } ^ { d } \to \mathbb { R } ^ { N }$ and $f ( \cdot ; \hat { \mathbf { S } } ^ { ( 2 ) } ) : \mathbb { R } ^ { d } \to \mathbb { R } ^ { N }$ be the scoring functions of the two classifiers constructed from $\hat { \mathbf { S } } ^ { ( 1 ) }$ and $\hat { \mathbf { S } } ^ { ( 2 ) }$ , respectively. To determine which classifier/scoring function is stronger, we compute the few-shot classification accuracies of the two classifiers on the merged query samples from both episodes. Concretely, let $\hat { \mathcal { Q } } _ { e } ^ { ( 1 ) } = \{ ( \hat { \mathbf { q } } _ { i } ^ { ( 1 ) } , y _ { i } ^ { ( 1 ) } ) | \hat { \mathbf { q } } _ { i } ^ { ( 1 ) } \in \mathbb { R } ^ { d } , i =$ $1 , 2 , \cdots , N Q \}$ (or $\hat { \mathcal { Q } } _ { e } ^ { ( 2 ) }$ ) denote the set of transformed embedding vectors of query samples in $e ^ { ( 1 ) }$ (or $e ^ { ( 2 ) }$ ), where $\hat { \mathbf { q } } _ { i } ^ { ( 1 ) }$ (or $\hat { \mathbf { q } } _ { i } ^ { ( 2 ) }$ ) denotes the $i$ -th row of the transformed embedding matrix $\hat { \mathbf { Q } } ^ { ( 1 ) }$ (or $\hat { \mathbf { Q } } ^ { ( 2 ) } )$ . With he few- $\hat { \mathcal { Q } } _ { e } ^ { ( 1 , 2 ) } = \hat { \mathcal { Q } } _ { e } ^ { ( 1 ) } \cup \hat { \mathcal { Q } } _ { e } ^ { ( 2 ) } = \{ ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } , y _ { i } ^ { ( 1 , 2 ) } ) , i = 1 , 2 , \cdots , 2 N Q \} )$ , we are able to com-nd-truth labels and the pute t shot classification accuracies of the two classifiers w.r.t. the grou corresponding predicted ones (i.e., arg maxj $\sigma _ { j } ( f ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \hat { \mathbf { S } } ^ { ( 1 ) } ) )$ and arg maxj $\sigma _ { j } ( f ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \hat { \mathbf { S } } ^ { ( 2 ) } ) )$ $( j = 1 , 2 , \cdots , N )$ for $( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } , y _ { i } ^ { ( 1 , 2 ) } ) \in \hat { \mathcal { Q } } _ { e } ^ { ( 1 , 2 ) }$ , where $\begin{array} { r } { \sigma _ { j } ( { \bf v } ) \triangleq \frac { \exp ( v _ { j } ) } { \sum _ { j ^ { \prime } = 1 } ^ { N } \exp ( v _ { j ^ { \prime } } ) } } \end{array}$ $( \mathbf { v } \in \mathbb { R } ^ { N } )$ is the softmax function).
89
+
90
+ The classifier with higher accuracy is thus considered to be the stronger one and subsequently used as the teacher classifier for the student to behave consistently with it. Without loss of generality, we assume that $f ( \cdot ; \hat { \mathbf { S } } ^ { ( 1 ) } )$ is stronger than $f ( \cdot ; \hat { \mathbf { S } } ^ { ( 2 ) } )$ . We choose the knowledge distillation loss (Hinton et al., 2015) for CECR, which is stated as:
91
+
92
+ $$
93
+ L _ { c e c r } ( e ^ { ( 1 ) } , e ^ { ( 2 ) } ; T ) = \mathbb { E } _ { ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } , y _ { i } ^ { ( 1 , 2 ) } ) \in \hat { \mathcal { Q } } _ { e } ^ { ( 1 , 2 ) } } L ^ { \prime } ( f ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \hat { \mathbf { S } } ^ { ( 1 ) } ) , f ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \hat { \mathbf { S } } ^ { ( 2 ) } ) ; T ) ,
94
+ $$
95
+
96
+ where $T$ is the temperature parameter as used in (Hinton et al., 2015). More specifically, when the softmax function $\begin{array} { r } { \sigma _ { j } ( \mathbf { v } ; T ) \triangleq \frac { \exp ( v _ { j } / T ) } { \sum _ { j ^ { \prime } = 1 } ^ { N } \exp ( v _ { j ^ { \prime } } / T ) } } \end{array}$ $\mathbf { \bar { v } } \in \mathbb { R } ^ { N }$ , $j = 1 , 2 , \cdots , N )$ is used, we define $L ^ { \prime } ( f ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \hat { \mathbf { S } } ^ { ( 1 ) } ) , f ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \hat { \mathbf { S } } ^ { ( 2 ) } ) ; T )$ in Eq. (7) with the cross-entropy loss:
97
+
98
+ $$
99
+ \begin{array} { r l } & { \quad L ^ { \prime } ( f ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \hat { \mathbf { S } } ^ { ( 1 ) } ) , f ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \hat { \mathbf { S } } ^ { ( 2 ) } ) ; T ) } \\ & { = - \displaystyle \sum _ { j = 1 } ^ { N } \sigma _ { j } \big ( f ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \hat { \mathbf { S } } ^ { ( 1 ) } ) ; T ) \log \left( \sigma _ { j } \big ( f ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \hat { \mathbf { S } } ^ { ( 2 ) } ) ; T ) \right) . } \end{array}
100
+ $$
101
+
102
+ Note that we cut off the gradients over $f ( \cdot ; \hat { \mathbf { S } } ^ { ( 1 ) } )$ when back-propagating since the output of the teacher scoring function is treated as the soft target for the student.
103
+
104
+ <table><tr><td colspan="2">Algorithm1MELR-basedFSL</td></tr><tr><td colspan="2">Input: Our MELR model with the set of all parameters Θ The base class sample set Db</td></tr><tr><td colspan="2">Hyper-parameters 入,T</td></tr><tr><td colspan="2">Output: The learned model</td></tr><tr><td colspan="2">1:for all iteration=1, 2,·.,MaxIteration do</td></tr><tr><td colspan="2"></td></tr><tr><td>2: 3:</td><td>C(2),e(1) ne(2)=0; Compute F(1) for e(1) using CEAM with Eq. (2),and obtain F(2) with Eq. (6) similarly.</td></tr><tr><td>4:</td><td>Compute Lfsc(e(1)) and Lfsc(e(2)) with Eq. (9), respectively;</td></tr><tr><td>5:</td><td>Construct Q(1,2) =Q(1)</td></tr><tr><td>6:</td><td>Determine the teacher episode e(t) and the student e(s) by computing the few-shot classifica-</td></tr><tr><td colspan="2"></td></tr><tr><td>7:</td><td>tion accuracies of the two classifiers within e(1) and e(2), respectively; Compute the CECR loss Lcecr(e(t),e(s);T) with Eq. (7);</td></tr><tr><td>8:</td><td>Compute the total loss Ltotal with Eq. (10);</td></tr><tr><td>9:</td><td>Compute the gradients V@ Ltotal ;</td></tr><tr><td>10:</td><td>Update O using stochastic gradient descent;</td></tr><tr><td colspan="2">11: end for</td></tr><tr><td colspan="2">12: return The learned model.</td></tr></table>
105
+
106
+ # 3.4 MELR-BASED FSL ALGORITHM
107
+
108
+ As we have mentioned above, in each training iteration, we randomly sample two $N$ -way $K$ -shot $Q$ - query episodes $e ^ { ( 1 ) } = ( S _ { e } ^ { ( 1 ) } , \mathcal { Q } _ { e } ^ { ( 1 ) } )$ and $e ^ { ( 2 ) } = ( S _ { e } ^ { ( 2 ) } , \mathcal { Q } _ { e } ^ { ( 2 ) } )$ , Q(2)e ), which must have exactly the same set of classes but with different instances. We first transform the feature embeddings with Cross-Episode Attention Module (CEAM) and then compute the few-shot classification loss adopting ProtoNet (Snell et al., 2017) for both episodes $( e \in \bar { \{ e ^ { ( 1 ) } , e ^ { ( 2 ) } \} } )$ ):
109
+
110
+ $$
111
+ \begin{array} { r l } & { L _ { f s c } ( e ) = \mathbb { E } _ { ( \hat { \mathbf { q } } _ { i } , y _ { i } ) \in \hat { \mathcal { Q } } _ { e } } L ( y _ { i } , f _ { \mathrm { P r o t o N e t } } ( \hat { \mathbf { q } } _ { i } ; \hat { \mathbf { S } } ) ) } \\ & { \qquad = \mathbb { E } _ { ( \hat { \mathbf { q } } _ { i } , y _ { i } ) \in \hat { \mathcal { Q } } _ { e } } - \log \sigma _ { y _ { i } } ( f _ { \mathrm { P r o t o N e t } } ( \hat { \mathbf { q } } _ { i } ; \hat { \mathbf { S } } ) ) . } \end{array}
112
+ $$
113
+
114
+ Next we determine the stronger/teacher episode to compute the Cross-Episode Consistency Regularization (CECR) loss between the two episodes. The total loss for MELR is finally given by:
115
+
116
+ $$
117
+ L _ { t o t a l } = \frac { 1 } { 2 } ( L _ { f s c } ( e ^ { ( 1 ) } ) + L _ { f s c } ( e ^ { ( 2 ) } ) ) + \lambda L _ { c e c r } ( e ^ { ( t ) } , e ^ { ( s ) } ; T ) ,
118
+ $$
119
+
120
+ where $e ^ { ( t ) } \in \{ e ^ { ( 1 ) } , e ^ { ( 2 ) } \}$ denotes the teacher episode, and $e ^ { ( s ) } \in \{ e ^ { ( 1 ) } , e ^ { ( 2 ) } \}$ is the student.
121
+
122
+ By combining CEAM and CECR for episodic training, our MELR-based FSL algorithm is summarized in Algorithm 1. Once learned, with the optimal model found by our algorithm, we randomly sample multiple $N$ -way $K$ -shot meta-test episodes from $\mathcal { C } _ { n }$ for evaluation. In other words, the episode-level relationship is only exploited during meta-training.
123
+
124
+ # 4 EXPERIMENTS
125
+
126
+ # 4.1 DATASETS AND SETTINGS
127
+
128
+ Datasets. Two widely-used benchmarks are selected: (1) miniImageNet (Vinyals et al., 2016): It contains 100 classes from ILSVRC-12 (Russakovsky et al., 2015). Each class has 600 images. We split it into 64 training classes, 16 validation classes and 20 test classes, as in (Ravi & Larochelle, 2017). (2) tieredImageNet (Ren et al., 2018): It is a larger subset of ILSVRC-12, containing 608 classes and 779,165 images in total. We split it into 351 training classes, 97 validation classes and 160 test classes, as in (Ren et al., 2018). All images of the two datasets are resized to $8 4 \times 8 4$ .
129
+
130
+ Evaluation Protocols. The 5-way 5-shot/1-shot settings are used. Each test episode $e ^ { ( t e s t ) } =$ $( S _ { e } ^ { ( t e s t ) } , \mathcal { Q } _ { e } ^ { ( t e s t ) } )$ has 5 classes randomly sampled from the test split, with 5 or 1 shots and 15 queries per class. We thus have $N = 5$ , $K = 5$ or 1, $Q = 1 5$ as in previous works. Although we meta-train our MELR with two episodes in each training iteration, we still evaluate it over test episodes one by one, strictly following the standard setting. Moreover, since no cross-episode relationships can be used when testing, we take $( \mathbf { F } ^ { ( t e s t ) } , \mathbf { S } ^ { ( t e s t ) } , \mathbf { S } ^ { ( t e s t ) } )$ as the input of CEAM. Note that the meta-test process is non-transductive since the embedding of each query sample in $e ^ { ( t e s t ) }$ is independently updated using the keys and values coming from the support set. We report average 5-way classification accuracy $\%$ , top-1) over 2,000 test episodes as well as the $9 5 \%$ confidence interval.
131
+
132
+ Table 1: Comparative results of standard FSL on two benchmark datasets. The average 5-way fewshot classification accuracies $\%$ , top-1) along with the $9 5 \%$ confidence intervals are reported.
133
+
134
+ <table><tr><td rowspan="2">Method</td><td colspan="3">miniImageNet</td><td colspan="2">tieredImageNet</td></tr><tr><td>Backbone</td><td>1-shot</td><td>5-shot</td><td>1-shot</td><td>5-shot</td></tr><tr><td>MatchingNet (Vinyals etal.,2016)</td><td>Conv4-64</td><td>43.56±0.84</td><td>55.31 ± 0.73</td><td></td><td></td></tr><tr><td>ProtoNet† (Snell et al., 2017)</td><td>Conv4-64</td><td>52.78 ± 0.45</td><td>71.26 ± 0.36</td><td>53.82 ±0.48</td><td>71.77 ± 0.41</td></tr><tr><td>MAML (Finn et al.,2017)</td><td>Conv4-64</td><td>48.70 ± 1.84</td><td>63.10 ±0.92</td><td>51.67 ± 1.81</td><td>70.30 ±0.08</td></tr><tr><td>RelationNet (Sung et al.,2018)</td><td>Conv4-64</td><td>50.40±0.80</td><td>65.30 ±0.70</td><td>54.48 ± 0.93</td><td>71.32 ± 0.78</td></tr><tr><td>IMP (Allen et al., 2019)</td><td>Conv4-64</td><td>49.60 ± 0.80</td><td>68.10±0.80</td><td></td><td></td></tr><tr><td>DN4 (Li et al.,2019c)</td><td>Conv4-64</td><td>51.24 ± 0.74</td><td>71.02 ± 0.64</td><td></td><td></td></tr><tr><td>PARN(Wu et al.,2019)</td><td>Conv4-64</td><td>55.22 ± 0.84</td><td>71.55 ± 0.66</td><td></td><td></td></tr><tr><td>PN+rot (Gidaris et al.,2019)</td><td>Conv4-64</td><td>53.63 ± 0.43</td><td>71.70 ± 0.36</td><td></td><td></td></tr><tr><td>CC+rot (Gidaris et al., 2019)</td><td>Conv4-64</td><td>54.83 ± 0.43</td><td>71.86 ± 0.33</td><td></td><td></td></tr><tr><td>Centroid (Afrasiyabi Arman,2020)</td><td>Conv4-64</td><td>53.14 ± 1.06</td><td>71.45 ± 0.72</td><td></td><td></td></tr><tr><td>Neg-Cosine (Liu et al.,2020)</td><td>Conv4-64</td><td>52.84 ± 0.76</td><td>70.41 ± 0.66</td><td></td><td></td></tr><tr><td>FEAT (Ye et al.,2020)</td><td>Conv4-64</td><td>55.15 ± 0.20</td><td>71.61 ± 0.16</td><td></td><td></td></tr><tr><td>MELR(ours)</td><td>Conv4-64</td><td>55.35 ± 0.43</td><td>72.27 ± 0.35</td><td>56.38± 0.48</td><td>73.22± 0.41</td></tr><tr><td>ProtoNet (Snell et al.,2017)</td><td>Conv4-512</td><td>53.52 ± 0.43</td><td>73.34± 0.36</td><td>55.52 ± 0.48</td><td>74.07±0.40</td></tr><tr><td>MAML (Finn et al.,2017)</td><td>Conv4-512</td><td>49.33 ± 0.60</td><td>65.17 ± 0.49</td><td>52.84±0.56</td><td>70.91 ± 0.46</td></tr><tr><td>Relation Net (Sung et al.,2018)</td><td>Conv4-512</td><td>50.86 ± 0.57</td><td>67.32 ± 0.44</td><td>54.69 ± 0.59</td><td>72.71 ± 0.43</td></tr><tr><td>PN+rot (Gidaris et al.,2019)</td><td>Conv4-512</td><td>56.02 ± 0.46</td><td>74.00 ± 0.35</td><td></td><td></td></tr><tr><td>CC+rot (Gidaris et al., 2019)</td><td>Conv4-512</td><td>56.27 ± 0.43</td><td>74.30 ± 0.33</td><td></td><td>一</td></tr><tr><td>MELR(ours)</td><td>Conv4-512</td><td>57.54±0.44</td><td>74.37±0.34</td><td>60.26±0.51</td><td>77.25± 0.40</td></tr><tr><td>ProtoNet† (Snell et al.,2017)</td><td>ResNet-12</td><td>62.41 ± 0.44</td><td>80.49±0.29</td><td>69.63±0.53</td><td>84.82± 0.36</td></tr><tr><td>TADAM (Oreshkin et al.,2018)</td><td>ResNet-12</td><td>58.50± 0.30</td><td>76.70±0.38</td><td></td><td></td></tr><tr><td>MetaOptNet (Lee et al., 2019)</td><td>ResNet-12</td><td>62.64 ± 0.61</td><td>78.63 ± 0.46</td><td>65.99 ±0.72</td><td>81.56 ± 0.63</td></tr><tr><td>MTL (Sun et al., 2019)</td><td>ResNet-12</td><td>61.20 ±1.80</td><td>75.50± 0.80</td><td>65.62 ± 1.80</td><td>80.61 ±0.90</td></tr><tr><td>AM3 (Xing et al.,2019)</td><td>ResNet-12</td><td>65.21 ± 0.49</td><td>75.20 ±0.36</td><td>67.23 ± 0.34</td><td>78.95 ± 0.22</td></tr><tr><td>Shot-Free (Ravichandran et al.,2019)</td><td>ResNet-12</td><td>59.04 ± 0.43</td><td>77.64 ± 0.39</td><td>66.87±0.43</td><td>82.64± 0.43</td></tr><tr><td>Neg-Cosine (Liu et al.,2020)</td><td>ResNet-12</td><td>63.85 ±0.81</td><td>81.57 ± 0.56</td><td></td><td>一</td></tr><tr><td>Distill (Tian et al.,2020)</td><td>ResNet-12</td><td>64.82 ± 0.60</td><td>82.14 ± 0.43</td><td>71.52 ± 0.69</td><td>86.03 ±0.49</td></tr><tr><td>DSN-MR (Simon et al., 2020)</td><td>ResNet-12</td><td>64.60±0.72</td><td>79.51 ± 0.50</td><td>67.39 ± 0.82</td><td>82.85 ±0.56</td></tr><tr><td>DeepEMD (Zhang et al.,2020)</td><td>ResNet-12</td><td>65.91 ± 0.82</td><td>82.41 ± 0.56</td><td>71.16 ± 0.87</td><td>86.03 ±0.58</td></tr><tr><td>FEAT (Ye et al.,2020)</td><td>ResNet-12</td><td>66.78±0.20</td><td>82.05 ±0.14</td><td>70.80 ±0.23</td><td>84.79 ± 0.16</td></tr><tr><td>MELR (ours)</td><td>ResNet-12</td><td>67.40±0.43</td><td>83.40±0.28</td><td>72.14± 0.51</td><td>87.01±0.35</td></tr></table>
135
+
136
+ Implementation Details. Our MELR algorithm adopts Conv4-64 (Vinyals et al., 2016), Conv4- 512 and ResNet-12 (He et al., 2016b) as the feature extractors $\psi$ for fair comparison with published results. The output feature dimensions of Conv4-64, Conv4-512 and ResNet-12 are 64, 512, and 640, respectively. To accelerate the entire training process, we pre-train all three backbones on the training split of each dataset as in many previous works (Zhang et al., 2020; Ye et al., 2020; Simon et al., 2020). We use data augmentation during pre-training (as well as meta-training with ResNet-12 on miniImageNet). For ResNet-12, the stochastic gradient descent (SGD) optimizer is employed with the initial learning rate of 1e-4, the weight decay of 5e-4, and the Nesterov momentum of 0.9. For Conv4-64 and Conv4-512, the Adam optimizer (Kingma & Ba, 2015) is adopted with the initial learning rate of 1e-4. The hyper-parameters $\lambda$ and $T$ are respectively selected from $\{ 0 . 0 2 , 0 . 0 5 , 0 . 1 , 0 . 2 \}$ and $\{ 1 6 , 3 2 , 6 4 , 1 2 8 \}$ according to the validation performances of our MELR algorithm (see Appendix A.5 for more details). The code and models will be released soon.
137
+
138
+ # 4.2 MAIN RESULTS
139
+
140
+ We compare our MELR with the representative/state-of-the-art methods for standard FSL on the two benchmark datasets in Table 1. Note that we re-implement our baseline (i.e., ProtoNet, denoted with †) by sampling two episodes in each training iteration since it is still considered as a strong FSL approach especially when the backbone is deep. We can observe from Table 1 that: (1) Methods trained with ResNet-12 generally perform better than those employing shallower backbones. Also, methods trained with Conv4-512 generally perform better than those employing Conv4-64 even though the two backbones are of the same depth. This is expected because deeper and wider backbones have better representation learning abilities. (2) Our MELR achieves the new state-ofthe-art performance on both benchmarks under all settings. Particularly, the improvements over the baseline (i.e., ProtoNet†) range from $1 . 0 \%$ to $5 . 0 \%$ , which clearly validates the effectiveness and the strong generalization ability of our MELR. (3) On both benchmarks, the improvements obtained by our MELR over ProtoNet† under the 1-shot setting are significantly larger than those under the 5-shot setting. This demonstrates the superior performance of our MELR for FSL with less shots. Again this is expected: FSL with less shots is more likely to suffer from the poor sampling of the few support instances; such a challenging problem is exactly what our MELR is designed for.
141
+
142
+ ![](images/72a317c5a587a885c76f8d67bb230df577a727207e1cf2a2ee929f43910c7f82.jpg)
143
+ Figure 2: (a) Ablative results for our MELR. (b) Comparison among different ProtoNet†+CEAM alternatives. (c) Comparison among different ProtoNet $^ { \dag } + \mathrm { C E C R }$ alternatives. All results are obtained under the 5-way 1-shot and 5-shot settings on miniImageNet with Conv4-64 as the feature extractor.
144
+
145
+ # 4.3 FURTHER EVALUATION
146
+
147
+ Ablation Study. To demonstrate the contributions of each cross-episode learning objective in our MELR, we conduct experiments on miniImageNet by adding these learning objectives to the baseline (one at a time) under the 5-way 1-shot and 5-shot settings. Note that ProtoNet without † is trained with one episode in each training iteration while ProtoNet† is trained with two episodes per iteration. The ablation study results in Figure 2(a) show that: (1) Increasing mini-batch size helps little for ProtoNet, indicating that our MELR benefits from two cross-episode objectives rather than doubling the mini-batch size. (2) CEAM or CECR alone clearly improves the performance of the baseline model and CEAM appears to be more beneficial to FSL than CECR. (3) The combination of the two cross-episode learning objectives in our full model (i.e., MELR) achieves further improvements, suggesting that these two learning objectives are complementary to each other. Moreover, in Appendix A.2, we conduct more ablative experiments when the attention module is applied within each episode, validating the necessity of cross-episode attention.
148
+
149
+ Comparison to CEAM Alternatives. As we have described, our CEAM takes the support samples as ‘keys’ and ‘values’, and all samples in one episode as ‘queries’ for attention module (denoted as Support $ \mathsf { A l l }$ ). We can also input prototypes (mean representations of support samples from the same class) as ‘keys’ and ‘values’ or input only query samples as ‘queries’ for attention. This results in other three alternatives of CEAM: Prototype Query, Support Query, and Prototype $ \mathsf { A l l }$ . Note that under the 5-way 1-shot setting, Prototype Query is equal to Support Query and Prototype $ \mathsf { A l l }$ is the same as Support All. Additionally, we compare to All All: inputting all samples from the other episode as ‘keys’ and ‘values’ for CEAM when training but still testing as Suppor $ \mathsf { A l l }$ (not violating the non-transductive setting). From the comparative results of different choices in Figure 2(b), we can see that Support $ \mathsf { A l l }$ is the best for CEAM. Moreover, Al $\mathrm { l } \mathrm { A l l }$ works worse than both Prototype All and Support All. One possible explanation is that Al $\lvert \mathsf { A l l }$ exploits all query set instances during meta-training but only has access to the support set during meta-test to conform to the inductive learning setting. This mis-match reduces its effectiveness.
150
+
151
+ Comparison to CECR Alternatives. Our consistency regularization loss $L _ { c e c r }$ in Eq. (7) is defined with the knowledge distillation (KD) loss, which can be easily replaced by the negative cosine similarity (NegCos), symmetric Kullback–Leibler divergence (symKL), or the L2 distance (see Appendix A.1 for more details). The results obtained by ProtoNet $^ { \dag } + { \mathrm { C E C R } }$ using different consistency losses are shown in Figure 2(c). It can be seen that ProtoNet $\dagger { + } \mathbf { K D }$ performs slightly better than other implementations. We thus choose KD as our CECR loss.
152
+
153
+ ![](images/d2f2e3ed381be40577763d30a74acf96fe9be1e2a281522bc05fa08a2e10973b.jpg)
154
+ Figure 3: (a) – (c) Visualizations of data distributions obtained by ProtoNet†, ProtoNet†+CEAM, and ProtoNet $^ { \dag } + \mathrm { C E A M + C E C R }$ (i.e., our MELR) for the same meta-test episode, respectively. $\mathrm { ( d ) - }$ (e) Visualizations of attention maps for query and support sets, respectively. All results are obtained under the 5-way 5-shot setting on miniImageNet with Conv4-64 as the feature extractor.
155
+
156
+ Visualizations of Data Distributions and Attention Maps. MELR is designed to alleviate the negative effects of poorly-sampled few shots. To validate this, we further provide some visualization results in Figure 3. (1) We sample one episode in the test split of miniImageNet under the 5-way 5-shot setting and obtain the embeddings of all images using the trained models of ProtoNet†, ProtoNet† $^ +$ CEAM, and our MELR (i.e., ProtoNet† $^ { + }$ CEAM+CECR), respectively. We then apply tSNE to project these embeddings into a 2-dimensional space in Figure 3(a) – 3(c). Across three subfigures, samples with the same color belong to the same class and diamonds are class prototypes/centers. We can observe that adding CEAM makes the distribution of different classes more separable (see Figure 3(b) vs. 3(a)), validating the effectiveness of our CEAM. Moreover, the embeddings obtained by our MELR are clearly much more evenly distributed with the prototypes right in the center, indicating less outlying instances (see Figure 3(c) vs. 3(b)). This shows that when CECR is combined with CEAM, those badly-sampled shots in Figure 3(a) are now pulled back to the center of the class distributions. (2) We also visualize the attention maps over the meta-test episode using our trained MELR. Since we take all samples in the episode as ‘queries’, and support samples as ‘keys’ and ‘values’ for CEAM when meta-testing, each of 100 samples has a 25-dimensional weight vector under the 5-way 5-shot setting. For each weight vector, we average the weights of the same class and obtain a 5-dimensional vector. For 75 query samples, we average the vectors of samples with the same class, resulting in a $5 \times 5$ instance attention map (see Figure 3(d)). Similarly, we obtain the attention map for 25 support samples (see Figure 3(e)). It can be seen that the two attention maps are very much alike, indicating that support and query sample embeddings are transformed by our CEAM in a similar way, which thus brings performance improvements for FSL.
157
+
158
+ # 5 CONCLUSION
159
+
160
+ We have investigated the challenging problem of how to counter the negative effects of badlysampled few shots for FSL. For the first time, we propose to exploit the underlying relationships between training episodes with identical sets of classes explicitly for meta-learning. This is achieved by two key components: CEAM is designed for neutralizing unrepresentative support set instances, and CECR is to enforce the prediction consistency of few-shot classifiers obtained in the two episodes. Extensive experiments for non-transductive standard FSL on two benchmarks show that our MELR achieves $1 . 0 \% { - } 5 . 0 \%$ improvements over the baseline (i.e., ProtoNet) used for FSL in our model and outperforms the latest competitors under the same settings.
161
+
162
+ # ACKNOWLEDGMENTS
163
+
164
+ This work was supported in part by National Natural Science Foundation of China (61976220 and 61832017), Beijing Outstanding Young Scientist Program (BJJWZYJH012019100020098), Open Project Program Foundation of Key Laboratory of Opto-Electronics Information Processing, Chinese Academy of Sciences (OEIP-O-202006), and Alibaba Innovative Research (AIR) Program.
165
+
166
+ REFERENCES
167
+ Gagne Christian Afrasiyabi Arman, Lalonde Jean-Franc¸ois. Associative alignment for few-shot image classifi- ´ cation. ECCV, 2020.
168
+ Kelsey R. Allen, Evan Shelhamer, Hanul Shin, and Joshua B. Tenenbaum. Infinite mixture prototypes for few-shot learning. In ICML, pp. 232–241, 2019.
169
+ Maria-Luiza Antonie, Osmar R Zaiane, and Alexandru Coman. Application of data mining techniques for medical image classification. In International Conference on Multimedia Data Mining, pp. 94–101, 2001.
170
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015.
171
+ Luca Bertinetto, Joao F. Henriques, Philip H. S. Torr, and Andrea Vedaldi. Meta-learning with differentiable ˜ closed-form solvers. In ICLR, 2019.
172
+ Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L. Yuille. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. IEEE TPAMI, 40(4):834–848, 2018.
173
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In ICML, pp. 1126–1135, 2017.
174
+ Spyros Gidaris and Nikos Komodakis. Generating classification weights with GNN denoising autoencoders for few-shot learning. In CVPR, pp. 21–30, 2019.
175
+ Spyros Gidaris, Andrei Bursuc, Nikos Komodakis, Patrick Perez, and Matthieu Cord. Boosting few-shot visual learning with self-supervision. In ICCV, pp. 8059–8068, 2019.
176
+ Yiluan Guo and Ngai-Man Cheung. Attentive weights generation for few shot learning via information maximization. In CVPR, pp. 13496–13505, 2020.
177
+ Bharath Hariharan and Ross B. Girshick. Low-shot visual recognition by shrinking and hallucinating features. In ICCV, pp. 3037–3046, 2017.
178
+ K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, pp. 770–778, 2016a.
179
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, pp. 770–778, 2016b.
180
+ Geoffrey E. Hinton, Oriol Vinyals, and Jeffrey Dean. Distilling the knowledge in a neural network. CoRR, abs/1503.02531, 2015.
181
+ Ruibing Hou, Hong Chang, Bingpeng Ma, Shiguang Shan, and Xilin Chen. Cross attention network for fewshot classification. In Advances in Neural Information Processing Systems, pp. 4005–4016, 2019.
182
+ Jongmin Kim, Taesup Kim, Sungwoong Kim, and Chang D. Yoo. Edge-labeling graph neural network for few-shot learning. In CVPR, pp. 11–20, 2019.
183
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
184
+ A. Krizhevsky, I. Sutskever, and G. E. Hinton. ImageNet classification with deep convolutional neural networks. In Advances in Neural Information Processing Systems, pp. 1097–1105, 2012.
185
+ Kwonjoon Lee, Subhransu Maji, Avinash Ravichandran, and Stefano Soatto. Meta-learning with differentiable convex optimization. In CVPR, pp. 10657–10665, 2019.
186
+ Hongyang Li, David Eigen, Samuel Dodge, Matthew Zeiler, and Xiaogang Wang. Finding task-relevant features for few-shot learning by category traversal. In CVPR, pp. 1–10, 2019a.
187
+ Huai-Yu Li, Weiming Dong, Xing Mei, Chongyang Ma, Feiyue Huang, and Bao-Gang Hu. Lgm-net: Learning to generate matching networks for few-shot learning. In ICML, pp. 3825–3834, 2019b.
188
+ Kai Li, Yulun Zhang, Kunpeng Li, and Yun Fu. Adversarial feature hallucination networks for few-shot learning. In CVPR, pp. 13467–13476, 2020.
189
+ Wenbin Li, Lei Wang, Jinglin Xu, Jing Huo, Yang Gao, and Jiebo Luo. Revisiting local descriptor based image-to-class measure for few-shot learning. In CVPR, pp. 7260–7268, 2019c.
190
+
191
+ Zhenguo Li, Fengwei Zhou, Fei Chen, and Hang Li. Meta-sgd: Learning to learn quickly for few shot learning. CoRR, abs/1707.09835, 2017.
192
+
193
+ Bin Liu, Yue Cao, Yutong Lin, Qi Li, Zheng Zhang, Mingsheng Long, and Han Hu. Negative margin matters: Understanding margin in few-shot classification. ECCV, 2020.
194
+
195
+ Yanbin Liu, Juho Lee, Minseop Park, Saehoon Kim, Eunho Yang, Sung Ju Hwang, and Yi Yang. Learning to propagate labels: Transductive propagation network for few-shot learning. In ICLR, 2019.
196
+
197
+ Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In CVPR, pp. 3431–3440, 2015.
198
+
199
+ Tsendsuren Munkhdalai and Hong Yu. Meta networks. In ICML, pp. 2554–2563, 2017.
200
+
201
+ Van Nhan Nguyen, Sigurd Lokse, Kristoffer Wickstr ´ om, Michael Kampffmeyer, Davide Roverso, and Robert ´ Jenssen. Sen: A novel feature normalization dissimilarity measure for prototypical few-shot learning networks. ECCV, 2020.
202
+
203
+ Alex Nichol, Joshua Achiam, and John Schulman. On first-order meta-learning algorithms. CoRR, abs/1803.02999, 2018.
204
+
205
+ Boris Oreshkin, Pau Rodr´ıguez Lopez, and Alexandre Lacoste. Tadam: Task dependent adaptive metric for ´ improved few-shot learning. In Advances in Neural Information Processing Systems, pp. 721–731, 2018.
206
+
207
+ Limeng Qiao, Yemin Shi, Jia Li, Yaowei Wang, Tiejun Huang, and Yonghong Tian. Transductive episodic-wise adaptive metric for few-shot learning. In ICCV, pp. 3603–3612, 2019.
208
+
209
+ Siyuan Qiao, Chenxi Liu, Wei Shen, and Alan L. Yuille. Few-shot image recognition by predicting parameters from activations. In CVPR, pp. 7229–7238, 2018.
210
+
211
+ Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In ICLR, 2017.
212
+
213
+ Avinash Ravichandran, Rahul Bhotika, and Stefano Soatto. Few-shot learning with embedded class models and shot-free meta training. In ICCV, pp. 331–339, 2019.
214
+
215
+ Joseph Redmon, Santosh Kumar Divvala, Ross B. Girshick, and Ali Farhadi. You only look once: Unified, real-time object detection. In CVPR, pp. 779–788, 2016.
216
+
217
+ Mengye Ren, Eleni Triantafillou, Sachin Ravi, Jake Snell, Kevin Swersky, Joshua B. Tenenbaum, Hugo Larochelle, and Richard S. Zemel. Meta-learning for semi-supervised few-shot classification. In ICLR, 2018.
218
+
219
+ Shaoqing Ren, Kaiming He, Ross B. Girshick, and Jian Sun. Faster R-CNN: towards real-time object detection with region proposal networks. In Advances in Neural Information Processing Systems, pp. 91–99, 2015.
220
+
221
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet large scale visual recognition challenge. IJCV, 115(3):211–252, 2015.
222
+
223
+ Andrei A. Rusu, Dushyant Rao, Jakub Sygnowski, Oriol Vinyals, Razvan Pascanu, Simon Osindero, and Raia Hadsell. Meta-learning with latent embedding optimization. In ICLR, 2019.
224
+
225
+ Victor Garcia Satorras and Joan Bruna Estrach. Few-shot learning with graph neural networks. In ICLR, 2018.
226
+
227
+ Eli Schwartz, Leonid Karlinsky, Joseph Shtok, Sivan Harary, Mattias Marder, Abhishek Kumar, Rogerio Schmidt Feris, Raja Giryes, and Alexander M. Bronstein. Delta-encoder: an effective sample´ synthesis method for few-shot object recognition. In Advances in Neural Information Processing Systems, pp. 2850–2860, 2018.
228
+
229
+ Christian Simon, Piotr Koniusz, Richard Nock, and Mehrtash Harandi. Adaptive subspaces for few-shot learning. In CVPR, pp. 4136–4145, 2020.
230
+
231
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
232
+
233
+ Jake Snell, Kevin Swersky, and Richard S. Zemel. Prototypical networks for few-shot learning. In Advances in Neural Information Processing Systems, pp. 4080–4090, 2017.
234
+
235
+ Qianru Sun, Yaoyao Liu, Tat-Seng Chua, and Bernt Schiele. Meta-transfer learning for few-shot learning. In CVPR, pp. 403–412, 2019.
236
+
237
+ Flood Sung, Yongxin Yang, Li Zhang, Tao Xiang, Philip H. S. Torr, and Timothy M. Hospedales. Learning to compare: Relation network for few-shot learning. In CVPR, pp. 1199–1208, 2018.
238
+ Yonglong Tian, Yue Wang, Dilip Krishnan, Joshua B Tenenbaum, and Phillip Isola. Rethinking few-shot image classification: a good embedding is all you need? ECCV, 2020.
239
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, pp. 5998–6008, 2017.
240
+ Oriol Vinyals, Charles Blundell, Tim Lillicrap, Koray Kavukcuoglu, and Daan Wierstra. Matching networks for one shot learning. In Advances in Neural Information Processing Systems, pp. 3630–3638, 2016.
241
+ C. Wah, S. Branson, P. Welinder, P. Perona, and S. Belongie. The caltech-ucsd birds-200-2011 dataset. Technical Report CNS-TR-2011-001, California Institute of Technology, 2011.
242
+ Yu-Xiong Wang, Ross B. Girshick, Martial Hebert, and Bharath Hariharan. Low-shot learning from imaginary data. In CVPR, pp. 7278–7286, 2018.
243
+ Ziyang Wu, Yuwei Li, Lihua Guo, and Kui Jia. Parn: Position-aware relation networks for few-shot learning. In ICCV, pp. 6659–6667, 2019.
244
+ Chen Xing, Negar Rostamzadeh, Boris Oreshkin, and Pedro O O. Pinheiro. Adaptive cross-modal few-shot learning. In NIPS, pp. 4847–4857, 2019.
245
+ Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron C. Courville, Ruslan Salakhutdinov, Richard S. Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In ICML, pp. 2048–2057, 2015.
246
+ Ling Yang, Liangliang Li, Zilun Zhang, Xinyu Zhou, Erjin Zhou, and Yu Liu. DPGN: distribution propagation graph network for few-shot learning. In CVPR, pp. 13387–13396, 2020.
247
+ Shulin Yang, Liefeng Bo, Jue Wang, and Linda G Shapiro. Unsupervised template learning for fine-grained object recognition. In Advances in Neural Information Processing Systems, pp. 3122–3130, 2012.
248
+ Han-Jia Ye, Hexiang Hu, De-Chuan Zhan, and Fei Sha. Few-shot learning via embedding adaptation with set-to-set functions. In CVPR, 2020.
249
+ Sung Whan Yoon, Jun Seo, and Jaekyun Moon. Tapnet: Neural network augmented with task-adaptive projection for few-shot learning. In ICML, pp. 7115–7123, 2019.
250
+ Chi Zhang, Yujun Cai, Guosheng Lin, and Chunhua Shen. Deepemd: Few-shot image classification with differentiable earth mover’s distance and structured classifiers. In CVPR, pp. 12203–12213, 2020.
251
+
252
+ # A APPENDIX
253
+
254
+ # A.1 DETAILS ABOUT CECR ALTERNATIVES
255
+
256
+ For the cross-episode consistency regularization (CECR) loss $L _ { c e c r }$ in Eq. (7), we compare the knowledge distillation (KD) loss to the negative cosine similarity (NegCos), the L2 distance, and the symmetric Kullback-Leibler (KL) divergence (SymKL) in the main paper. Here we give the details about three CECR alternatives. Concretely, let $\sigma ^ { ( 1 ) } ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } )$ (or $\sigma ^ { ( 2 ) } ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ) ;$ denote the normalized vector of $f ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \hat { \mathbf { S } } ^ { ( 1 ) } )$ (or $f ( \hat { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \hat { \mathbf { S } } ^ { ( 2 ) } ) )$ using softmax, we then have
257
+
258
+ $$
259
+ \begin{array} { r l } & { L _ { c c e } ^ { ( N , q , \mathcal { C } ) G 3 } = \varmathbb { E } _ { ( \tilde { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } , y _ { i } ^ { ( 1 , 2 ) } ) \in \varDelta _ { c } ^ { ( 1 , 2 ) } } \mathrm { P e g } C \cos ( f ( \tilde { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \tilde { \mathbf { S } } ^ { ( 1 ) } ) , f ( \tilde { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \tilde { \mathbf { S } } ^ { ( 2 ) } ) ) } \\ & { \qquad = \mathbb { E } _ { ( \tilde { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } , y _ { i } ^ { ( 1 , 2 ) } ) \in \varDelta _ { c } ^ { ( 1 , 2 ) } } - \frac { \mathcal { C } ^ { ( N , 1 ) } ( \tilde { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ) \mathcal { S } ^ { ( 2 ) } ( \tilde { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ) } { \| \mathcal { C } ^ { ( 1 , 2 ) } \| } , \sigma ^ { ( 2 ) } ( \tilde { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ) > } \\ & { L _ { c c e } ^ { ( L _ { c } ^ { ( 2 ) } ) } = \mathbb { E } _ { ( \tilde { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } , y _ { i } ^ { ( 1 , 2 ) } ) \in \varDelta _ { c } ^ { ( 1 , 2 ) } } \mathrm { L } 2 ( f ( \tilde { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \tilde { \mathbf { S } } ^ { ( 1 ) } ) ) , f ( \tilde { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \tilde { \mathbf { S } } ^ { ( 2 ) } ) ) | } \\ & { \qquad = \mathbb { E } _ { ( \tilde { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } , y _ { i } ^ { ( 1 , 2 ) } ) \in \varDelta _ { c } ^ { ( 1 , 2 ) } } \mathrm { L } 2 ( f ( \tilde { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \tilde { \mathbf { S } } ^ { ( 1 ) } ) , f ( \tilde { \mathbf { q } } _ { i } ^ { ( 1 , 2 ) } ; \tilde { \mathbf { S } } ^ { ( 2 ) } ) ) } \\ & L _ { c c e } ^ { ( s y m K L ) } = \mathbb { E } _ \end{array}
260
+ $$
261
+
262
+ $< \cdot , \cdot >$ nner(u, f two vectors, are two unno $T$ is the temperature paraalized scoring vectors, eter, anddenotes ${ \bf K L } ( { \bf u } , { \bf v } ) =$ $\begin{array} { r } { \sum _ { j = 1 } ^ { N } \sigma _ { j } ( \mathbf { u } ) \log \frac { \sigma _ { j } ( \mathbf { u } ) } { \sigma _ { j } ( \mathbf { v } ) } } \end{array}$ $\mathbf { v } \in \mathbb { R } ^ { N }$ $\sigma$ function, and $\sigma _ { j } ( { \mathbf { u } } )$ denotes the $j$ -th element of $\sigma ( \mathbf { u } )$
263
+
264
+ # A.2 MORE ABLATIVE RESULTS
265
+
266
+ In Table 2, we show more ablative results when the attention module is applied within each episode independently (named as Intra-Episode Attention Module (IEAM)). Concretely, IEAM is used for ProtoNet†+IEAM $^ \dagger$ means that ProtoNet is trained with two episodes in each training iteration for fair comparison) as follows $( \mathrm { i } = 1 , 2$ ):
267
+
268
+ $$
269
+ \hat { \mathbf { F } } ^ { ( i ) } = \mathrm { I E A M } ( \mathbf { F } ^ { ( i ) } , \mathbf { S } ^ { ( i ) } , \mathbf { S } ^ { ( i ) } ) = \mathbf { F } ^ { ( i ) } + \mathrm { s o f t m a x } ( \frac { \mathbf { F } _ { Q } ^ { ( i ) } \mathbf { S } _ { K } ^ { ( i ) T } } { \sqrt { d } } ) \mathbf { S } _ { V } ^ { ( i ) } .
270
+ $$
271
+
272
+ We also add our Cross-Episode Consistency Regularization (CECR) for ProtoNet†+IEAM+CECR to see the performance when IEAM instead of our CEAM is adopted.
273
+
274
+ We can see from Table 2 that adding IEAM to the baseline ProtoNet† also improves its performance, but IEAM is not as beneficial as our CEAM (see ProtoNet†+IEAM vs. ProtoNet† $^ +$ CEAM). When our CECR is applied on top of ProtoNet†+IEAM (i.e., ProtoNet†+IEAM+CECR), the improvement is rather minor under the 5-way 1-shot setting and the result even gets worse under the 5-shot setting. However, our MELR can still benefit from CECR (see MELR vs. ProtoNet† $^ +$ CEAM), indicating that CECR is not suitable for IEAM and our CEAM is necessary.
275
+
276
+ Table 2: Comparative results when IEAM is used on miniImageNet. The average 5-way few-shot classification accuracies $\%$ , top-1) along with the $9 5 \%$ confidence intervals are reported.
277
+
278
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">Backbone</td><td colspan="2">miniImageNet</td></tr><tr><td>1-shot</td><td> 5-shot</td></tr><tr><td>ProtoNet† (Snell et al., 2017)</td><td>Conv4-64</td><td>52.61 ± 0.42</td><td>71.33 ± 0.36</td></tr><tr><td>ProtoNet†+IEAM</td><td>Conv4-64</td><td>54.83 ± 0.43</td><td>71.81 ± 0.35</td></tr><tr><td>ProtoNet†+IEAM+CECR</td><td>Conv4-64</td><td>54.97 ± 0.44</td><td>71.72 ± 0.35</td></tr><tr><td>ProtoNet+ +CEAM (ours)</td><td>Conv4-64</td><td>55.01 ± 0.43</td><td>72.01 ± 0.35</td></tr><tr><td>MELR (ours)</td><td>Conv4-64</td><td>55.35 ± 0.43</td><td>72.27 ± 0.35</td></tr></table>
279
+
280
+ ![](images/a2dd9d23ce27830d5bce32728ecb061ec3b02691ee29a0faba4998752337b38c.jpg)
281
+ Figure 4: The first three subfigures in each row are the visualizations of data distributions obtained by ProtoNet†, ProtoNet $^ +$ CEAM, and ProtoNet† $\mathbf { \sigma } _ { + \mathbf { C E A M + C E C R } }$ (i.e., our MELR) for the same metatest episode, respectively. The last two subfigures in each row are the visualizations of attention maps for query and support sets, respectively. All results are obtained under the 5-way 5-shot setting on miniImageNet with Conv4-64 as the feature extractor.
282
+
283
+ # A.3 MORE VISUALIZATION RESULTS
284
+
285
+ Similar to Section 4.3, we provide more visualization results in Figure 4. (1) We sample five episodes (corresponding to five rows in Figure 4) in the test split of miniImageNet under the 5-way 5-shot setting and visualize the data distributions in the first three columns using the trained models of ProtoNet†, ProtoNet† $^ { + }$ CEAM, and our MELR (i.e., ProtoNet† $^ +$ CEAM+CECR), respectively. We can observe that adding CEAM makes the distributions of different classes more separable in the first four rows (see the second column vs. the first column), validating the effectiveness of our CEAM. Moreover, the embeddings obtained by our MELR are clearly much more evenly distributed with the prototypes generally right in the center, indicating less poorly-sampled instances (see the third column vs. the second column). Specifically, ProtoNet† $+$ CEAM brings an obvious outlying instance in the last row, but adding CECR stabilizes the training of CEAM. In a word, when CECR is combined with CEAM, the badly-sampled shots can be pulled back to the center of the class distributions. (2) We also visualize the attention maps over each meta-test episode using our trained MELR model. For each of the five episodes, we obtain two $5 \times 5$ attention maps for query and support sets in the last two subfigures of each row, respectively. It can be seen that the two attention maps in each row are very much alike, indicating that support and query sample embeddings are transformed by our CEAM in a similar way, which thus brings performance improvements for FSL.
286
+
287
+ Table 3: Comparative results of fine-grained FSL on CUB. The average 5-way few-shot classification accuracies ( $\%$ , top-1) along with the $9 5 \%$ confidence intervals are reported.
288
+
289
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">Backbone</td><td colspan="2">CUB</td></tr><tr><td>1-shot</td><td> 5-shot</td></tr><tr><td>MatchingNet (Vinyals et al., 2016)</td><td>Conv4-64</td><td>61.16±0.89</td><td>72.86 ± 0.70</td></tr><tr><td>ProtoNet† (Snell et al., 2017)</td><td>Conv4-64</td><td>64.42 ± 0.48</td><td>81.82 ± 0.35</td></tr><tr><td>MAML (Finn et al., 2017)</td><td>Conv4-64</td><td>55.92 ± 0.95</td><td>72.09 ± 0.76</td></tr><tr><td>Relation Net (Sung et al., 2018)</td><td>Conv4-64</td><td>62.45 ± 0.98</td><td>76.11 ± 0.69</td></tr><tr><td>FEAT(Ye et al., 2020)</td><td>Conv4-64</td><td>68.87 ± 0.22</td><td>82.90 ± 0.15</td></tr><tr><td>ProtoNet† +CEAM (ours)</td><td>Conv4-64</td><td>68.92±0.50</td><td>84.54 ±0.32</td></tr><tr><td>MELR (ours)</td><td>Conv4-64</td><td>70.26 ± 0.50</td><td>85.01 士 0.32</td></tr></table>
290
+
291
+ ![](images/0cf27eb5cc65a9dbac9174562785e65d9674f8fc0aa2be463189c03a50d7d4c6.jpg)
292
+ Figure 5: Illustration of hyper-parameter analysis on the miniImageNet dataset. Conv4-64 is used as the feature extractor.
293
+
294
+ # A.4 RESULTS FOR FINE-GRAINED FSL
295
+
296
+ To evaluate our MELR under the fine-grained setting where the poorly-sampled shots may have greater negative impact since the classes are much more close, we conduct experiments on CUB200-2011 Birds (CUB) (Wah et al., 2011) with Conv4-64 as the feature extractor. CUB has 200 finegrained classes of birds and 11,788 images in total. We follow (Ye et al., 2020) and split the dataset into 100, 50, and 50 classes for training, validation, and test, respectively. For direct comparison, we also use the pre-trained backbone model released by (Ye et al., 2020), which is pre-trained on the training set. The comparative results in Table 3 show that: (1) Our MELR achieves the best results and improves over the second-best FEAT by $1 . 4 \% - 2 . 1 \%$ , validating the effectiveness of MELR under the fine-grained setting. (2) Our ProtoNe $\cdot ^ { \dagger } { + } \mathrm { C E A M }$ alone outperforms all the competitors, and adding CECR into ProtoNet $^ { \dag } +$ CEAM (i.e., our MELR) further brings noticeable improvements $( 0 . 5 \% - 1 . 3 \% )$ , indicating that both CEAM and CECR are crucial for fine-grained FSL.
297
+
298
+ # A.5 ANALYSIS OF HYPER-PARAMETER SENSITIVITY
299
+
300
+ As we have mentioned in Section 4.1, the hyper-parameters $\lambda$ and $T$ are respectively selected from $\{ 0 . 0 2 , 0 . 0 5 , 0 . 1 , 0 . 2 \}$ and $\{ 1 6 , 3 2 , 6 4 , 1 2 8 \}$ according to the validation performance of our MELR algorithm. Concretely, on miniImageNet (with Conv4-64 as the feature extractor), we choose $\lambda =$ 0.1 and $T = 1 2 8$ under the 5-way 1-shot setting, and choose $\lambda = 0 . 0 5$ and $T = 6 4$ under the 5-way 5-shot setting. In Figure 5, we further present our hyper-parameter analysis on miniImageNet. The results show that our algorithm is quite insensitive to these parameters.
301
+
302
+ Table 4: Results obtained by varying the number of episodes in each training iteration on miniImageNet (with Conv4-64 as the backbone). The average 5-way classification accuracies $( \%$ top-1) along with the $9 5 \%$ confidence intervals are reported.
303
+
304
+ <table><tr><td></td><td></td><td colspan="2">Implement. (1)</td><td colspan="2">Implement. (2)</td></tr><tr><td>Method</td><td>#Episodes</td><td>1-shot</td><td>5-shot</td><td>1-shot</td><td>5-shot</td></tr><tr><td>MELR</td><td>2</td><td>55.35 ± 0.43</td><td>72.27 ± 0.35</td><td>55.35 ± 0.43</td><td>72.27 ± 0.35</td></tr><tr><td>MELR</td><td>3</td><td>55.26 ± 0.44</td><td>71.88 ± 0.35</td><td>55.19 ± 0.43</td><td>71.90 ± 0.35</td></tr><tr><td>MELR</td><td>4</td><td>55.15 ± 0.43</td><td>71.63 ± 0.35</td><td>55.03 ± 0.44</td><td>71.76 ± 0.35</td></tr></table>
305
+
306
+ Table 5: Comparison regarding the number of parameters (‘K’ denotes $^ { \bullet } \times 1 0 ^ { 3 }$ ’ and ‘M’ denotes $^ { \bullet } \times 1 0 ^ { 6 } ^ { \bullet }$ ) among various FSL methods.
307
+
308
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">Backbone</td><td rowspan="2">#Parameters</td><td colspan="2">miniImageNet</td></tr><tr><td>1-shot</td><td>5-shot</td></tr><tr><td>ProtoNet† (Snell et al., 2017)</td><td>Conv4-64</td><td>113.09K</td><td>52.78 ± 0.45</td><td>71.26 ± 0.36</td></tr><tr><td>PARN (Wu et al., 2019)</td><td>Conv4-64</td><td>405.49K</td><td>55.22 ± 0.84</td><td>71.55 ± 0.66</td></tr><tr><td>FEAT (Ye et al.,2020)</td><td>Conv4-64</td><td>129.66K</td><td>55.15 ± 0.20</td><td>71.61 ± 0.16</td></tr><tr><td>MELR (ours)</td><td>Conv4-64</td><td>129.66K</td><td>55.35 ± 0.43</td><td>72.27 ± 0.35</td></tr><tr><td>ProtoNet† (Snell et al., 2017)</td><td>ResNet-12</td><td>12.42M</td><td>62.41 ± 0.44</td><td>80.49±0.29</td></tr><tr><td>FEAT (Ye et al., 2020)</td><td>ResNet-12</td><td>14.06M</td><td>66.78 ± 0.20</td><td>82.05 ± 0.14</td></tr><tr><td>MELR (ours)</td><td>ResNet-12</td><td>14.06M</td><td>67.40 ± 0.43</td><td>83.40 ± 0.28</td></tr></table>
309
+
310
+ # A.6 RESULTS BY VARYING THE NUMBER OF EPISODES
311
+
312
+ We also conduct experiments by varying the number of episodes $N _ { e }$ in each training iteration. For the implementation of CEAM, we have two slightly different choices. Concretely, for each episode $e ^ { ( i ) }$ $( i = 1 , \cdots , N _ { e } )$ , the output of CEAM can be defined as:
313
+
314
+ $$
315
+ \hat { \mathbf { F } } ^ { ( i ) } = \frac { 1 } { N _ { e } - 1 } \sum _ { \substack { j = 1 , \cdots , N _ { e } , j \neq i } } \mathbf { C E A M } ( \mathbf { F } ^ { ( i ) } , \mathbf { S } ^ { ( j ) } , \mathbf { S } ^ { ( j ) } ) ;
316
+ $$
317
+
318
+ where $[ \mathbf { S } ^ { ( j ) } ] _ { j = 1 , j \neq i } ^ { N _ { e } } \in \mathbb { R } ^ { N K ( N _ { e } - 1 ) \times d }$ is the concatenation of $\mathbf { S } ^ { ( j ) } \in \mathbb { R } ^ { N K \times d } ( j = 1 , \cdots , i - 1 , i +$ $1 , \cdots , N _ { e } )$ . As for CECR, we determine the episode with the best accuracy as the teacher and distill knowledge to the rest $N _ { e } - 1$ student episodes.
319
+
320
+ The results on miniImageNet using Conv4-64 in Table 4 show that the performance drops slightly as the number of episodes in each training iteration increases for both implementations. One possible explanation is that too much training data make the model fit better on the training set but fail to improve its generalization ability on novel classes.
321
+
322
+ # A.7 COMPARISON REGARDING THE NUMBER OF PARAMETERS
323
+
324
+ We select several representative/latest FSL models from Table 1 of the main paper and list their numbers of parameters in Table 5. We can observe that: (1) With an extra CEAM in addition to the backbone (Conv4-64 or ResNet-12), our MELR has about $1 3 \% - 1 5 \%$ relatively more parameters than the baseline ProtoNet. Note that CECR (in our MELR) leads to no extra parameters. Considering the (statistically) significant improvements achieved by our MELR over ProtoNet, we think that our MELR is cost-effective because it requires not much additional parameters. (2) The number of MELR’s parameters is almost the same as that of FEAT’s and is much less than that of PARN’s, but our MELR achieves better results than FEAT and PARN, indicating that our MELR is the most cost-effective among these three methods.
325
+
326
+ ![](images/d8310768f74da4fd95867ec4f8dc1bbd7e1e37272f8603c91baaaf3d516a14a4.jpg)
327
+ Figure 6: Schematic illustration of our CEAM with a pair of episodes as its input. For easy understanding (but without loss of generality), a toy visual example is considered: only one outlying instance $x$ exists in the support set ${ \mathcal { S } } ^ { ( 1 ) }$ of the first episode, but the support set $S ^ { ( 2 ) }$ of the second episode is properly sampled. Since ${ \tilde { S } } ^ { ( 1 ) } { = } S ^ { ( 1 ) } \setminus \{ x \}$ and $S ^ { ( 2 ) }$ have similar data distributions (from the same classes), the outlying instance $x$ is pulled back to $\tilde { S } ^ { ( 1 ) }$ by attending on it with $S ^ { ( 2 ) }$ (which can not be done by attending on it with ${ \mathcal { S } } ^ { ( 1 ) }$ ), i.e., its negative effect is mitigated by our CEAM.
328
+
329
+ Table 6: Results by inputting only support samples as ‘queries’ into CEAM (denote as ‘Support Support’) on miniImageNet.
330
+
331
+ <table><tr><td>Method</td><td>Backbone</td><td>1-shot</td><td>5-shot</td></tr><tr><td>ProtoNett</td><td>Conv4-64</td><td>52.61 ± 0.42</td><td>71.33 ± 0.36</td></tr><tr><td>ProtoNet†+CEAM (Support →→ Support)</td><td>Conv4-64</td><td>54.79 ± 0.43</td><td>71.40 ± 0.36</td></tr><tr><td>ProtoNet† +CEAM (Support → All, ours)</td><td>Conv4-64</td><td>55.01 ± 0.43</td><td>72.01 ±0.35</td></tr></table>
332
+
333
+ # A.8 SCHEMATIC ILLUSTRATION OF CEAM
334
+
335
+ To demonstrate how our proposed CEAM can alleviate the negative effect of the poorly sampled shots, we present a schematic illustration of CEAM with a pair of episodes as its input in Figure 6. For easy understanding (but without loss of generality), a toy visual example is considered: only one outlying instance $x$ exists in the support set ${ \mathcal { S } } ^ { ( 1 ) }$ of the first episode, but the support set $\bar { S ^ { ( 2 ) } }$ of the second episode is properly sampled. Since the two episodes are sampled from the same set of classes, the data distributions of $\tilde { S } ^ { ( 1 ) } = S ^ { ( 1 ) } \setminus \{ x \}$ and $S ^ { ( 2 ) }$ are similar. On one hand, when ${ \mathcal { S } } ^ { ( 1 ) }$ (including the outlier $x$ ) is used as keys and values to update $S ^ { ( 2 ) }$ , the distribution of $S ^ { ( 2 ) }$ will not be influenced too much by the outlier $x$ since all the shots in $S ^ { ( 2 ) }$ are far away from $x$ and the weights on $x$ will be very small. That is, our CEAM is insensitive to few outliers in the keys and values. On the other hand, when ${ \mathcal { S } } ^ { ( 1 ) }$ is transformed based on $S ^ { ( 2 ) }$ , the distribution of $\tilde { \cal S } ^ { ( \mathrm { 1 } ) }$ will be changed little (the data distributions of $\tilde { S } ^ { ( 1 ) }$ and $S ^ { ( 2 ) }$ are similar). Particularly, for the outlier $x$ , its updated embedding $\hat { \bf x }$ will be pulled back to $\tilde { S } ^ { ( 1 ) }$ (i.e., its negative effect is mitigated) since $\hat { \mathbf { x } } = \mathbf { C E A M } ( \mathbf { x } , \mathbf { S } ^ { ( 2 ) } , \mathbf { S } ^ { ( 2 ) } ) \approx \mathbf { x } + \mathbf { W S } ^ { ( 2 ) } \approx \mathbf { x } + \tilde { \mathbf { W } } \tilde { \mathbf { S } } ^ { ( 1 ) }$ , where $\mathbf { x }$ is the original embedding of $x$ , $\mathbf { S } ^ { ( 2 ) }$ and $\tilde { \mathbf { S } } ^ { ( 1 ) }$ are respectively the feature matrices of $S ^ { ( 2 ) }$ and $\tilde { S } ^ { ( 1 ) }$ , $\mathbf { W }$ and $\tilde { \mathbf { W } }$ are two normalized weight matrices. Note that this cannot be done by attending on $\mathbf { x }$ with $\mathbf { S } ^ { ( 1 ) }$ .
336
+
337
+ Additionally, we provide the results obtained by an extra CEAM alternative in Table 6: only the embeddings of support samples are transformed (denoted as ‘Support Support’) instead of transforming all samples as our choice. We can see from Table 6 and also Figure 2(b) that our choice (i.e., Support $ \mathrm { A l l }$ ) achieves the best results among all CEAM alternatives. One possible explanation for why we resort to updating all samples is that transforming support and query samples into the same embedding space is beneficial to the model learning.
338
+
339
+ ![](images/53589dccc3ddf367dd0a36be2a1ea3d36f628b449fe24e2742ee4cd79b7b9d54.jpg)
340
+ Figure 7: Visualization results of 10 meta-test episodes on miniImageNet under the 5-way 5-shot setting (Conv4-64 is used as the backbone). For each meta-test episode, we visualize three data distributions (from left to right) obtained by ProtoNet†, ProtoNet $\mathsf { I } _ { + \mathrm { C E A M } }$ , and our MELR, respectively. That is, each meta-test episode is denoted by three subfigures and each row has two episodes. In each subfigure, we compute the test accuracy over query samples and present it as the title.
341
+
342
+ # A.9 SIGNIFICANCE ANALYSIS OF CECR
343
+
344
+ Since CECR (in our MELR) requires no extra learnable parameters and only computes a loss for consistency constraint, it brings very limited computational cost. Empirically, the meta-training time of MELR is almost the same as that of ProtoNet†+CEAM, indicating that the performance improvement over ProtoNet†+CEAM is obtained by CECR at an extremely low cost.
345
+
346
+ To study when CECR has a significant impact on the final FSL performance, we select 10 meta-test episodes from the 2,000 ones used in the evaluation stage and visualize them in Figure 7. Concretely, for each of the 10 selected meta-test episodes, we visualize three data distributions (from left to right) obtained by ProtoNet†, ProtoNet† $^ +$ CEAM, and our MELR, respectively. That is, each meta-test episode is denoted by a group of three subfigures. In each subfigure, we compute the test accuracy over query samples and present it as the title. We can see that: (1) When the few-shot classification task is hard (i.e., ProtoNet† obtains relatively low accuracy), CEAM leads to significant improvements (about $3 \% - 9 \%$ ). (2) In the same hard situation, CECR further achieves significant improvements (about $5 \% - 8 \%$ ) on top of CEAM and shows its great effect on the final FSL performance. This indicates that CECR and CEAM are complementary to each other in hard situations, and thus both are crucial for solving the poor sampling problem in meta-learning based FSL.
347
+
348
+ # A.10 RESULTS OF TRANSDUCTIVE FSL
349
+
350
+ The main difference between standard and transductive FSL is whether query samples are tested one at a time or all simultaneously. As we have mentioned in Section 4.1, we evaluate our MELR model strictly following the non-transductive setting for standard FSL since the embedding of each query sample in the test episode is independently transformed using the keys and values coming from the support set. However, in this section, we further conduct experiments under the transductive FSL setting to study how well our MELR can make use of the unlabeled query samples.
351
+
352
+ Table 7: Comparative results of transductive FSL on miniImageNet. The average 5-way few-shot classification accuracies $\%$ , top-1) along with the $9 5 \%$ confidence intervals are reported. We cite the results of the competitors from (Ye et al., 2020).
353
+
354
+ <table><tr><td></td><td></td><td colspan="2">miniImageNet</td></tr><tr><td>Method</td><td>Backbone</td><td>1-shot</td><td>5-shot</td></tr><tr><td>StandardFSL:</td><td></td><td></td><td></td></tr><tr><td>ProtoNet† (Snell et al., 2017)</td><td>Conv4-64</td><td>52.78 ± 0.45</td><td>71.26 ± 0.36</td></tr><tr><td>MELR (ours)</td><td>Conv4-64</td><td>55.35 ± 0.43</td><td>72.27 ± 0.35</td></tr><tr><td>Transductive FSL:</td><td></td><td></td><td></td></tr><tr><td>Semi-ProtoNet (Ren et al., 2018)</td><td>Conv4-64</td><td>55.50 ± 0.10</td><td>71.76 ± 0.08</td></tr><tr><td>TPN (Liu et al., 2019)</td><td>Conv4-64</td><td>55.51 ± 0.84</td><td>69.86 ± 0.67</td></tr><tr><td>TEAM (Qiao et al., 2019)</td><td>Conv4-64</td><td>56.57</td><td>72.04</td></tr><tr><td>FEAT (Ye et al., 2020)</td><td>Conv4-64</td><td>57.04 ± 0.16</td><td>72.89 ± 0.20</td></tr><tr><td>ProtoNet†+CEAM (ours)</td><td>Conv4-64</td><td>60.30 ± 0.49</td><td>74.28 ± 0.36</td></tr><tr><td>MELR (ours)</td><td>Conv4-64</td><td>61.67 ± 0.51</td><td>74.87 ± 0.35</td></tr></table>
355
+
356
+ ![](images/6d48eb43714c65a0aae66942670f3c3d111ac84046535db6ae2a08448c051534.jpg)
357
+ Figure 8: Visualization of the generalization ability of our MELR on the test split of miniImageNet under the 5-way 1-shot setting with Conv4-64 as the backbone. Note that we check the test performance of the model at each training epoch (i.e., every 100 training iterations).
358
+
359
+ Concretely, for each meta-test episode $e ^ { ( t e s t ) }$ , we input all samples (both support and query ones) as keys and values into the trained CEAM:
360
+
361
+ $$
362
+ \begin{array} { r } { \hat { \mathbf { F } } ^ { ( t e s t ) } = \mathrm { C E A M } ( { \mathbf { F } } ^ { ( t e s t ) } , { \mathbf { F } } ^ { ( t e s t ) } , { \mathbf { F } } ^ { ( t e s t ) } ) , } \end{array}
363
+ $$
364
+
365
+ such that the relationships of all unlabeled query samples can be taken into consideration. With the transformed embeddings, we make predictions for all query samples based on Semi-ProtoNet (Ren et al., 2018), which utilizes the unlabeled query samples to help construct better class prototypes and then makes predictions similar to ProtoNet. To match the meta-test process, we also make changes to meta-training accordingly. Specifically, for one episode (out of the two) in each training iteration, we use all samples from the other episode as keys and values for CEAM to update all of its own embeddings. This is followed by obtaining the prototypes based on Semi-ProtoNet as well as computing the FSL loss and CECR loss.
366
+
367
+ The results of transductive FSL on miniImageNet are shown in Table 7. It can be seen that: (1) By utilizing the unlabeled query samples under transductive FSL, our MELR achieves further improvements, as compared to MELR under standard FSL. Particularly, the performance improvement under 1-shot (i.e., $6 . 3 \%$ ) is more significant than that under 5-shot (i.e., $2 . 6 \%$ ), indicating that exploiting unlabeled query samples brings more benefits to FSL with less labeled support samples. (2) Our MELR achieves the best results among all the transductive FSL methods. Specifically, MELR outperforms FEAT by a large margin $( 2 . 0 \% - 4 . 6 \% )$ . Since FEAT also makes predictions based on Semi-ProtoNet, this clearly validates the effectiveness of our MELR under the transductive setting. (3) Our ProtoNet†+CEAM alone outperforms all the competitors, and adding CECR into ProtoNet†+CEAM (i.e., our MELR is obtained) further brings noticeable improvements $( 0 . 6 \% \mathrm { ~ - ~ }$ $1 . 4 \% )$ , indicating that both CEAM and CECR play important roles under transductive FSL.
368
+
369
+ A.11 VISUALIZATIONS OF THE GENERALIZATION ABILITY OF MELR
370
+
371
+ We further provide the visualization of the generalization ability of our MELR during meta-test in Figure 8. Concretely, we randomly sample 1,000 episode pairs from the test split of miniImageNet under the 5-way 1-shot setting, where the two episodes in each pair have identical sets of classes. We then compute the average 5-way classification accuracy over all 2,000 episodes (from the 1,000 episode pairs) and the average $L _ { c e c r }$ in Eq. (7) over all 1,000 episode pairs at each training epoch. We present the visualization results w.r.t. accuracy and CECR loss in Figure 8. As expected, the accuracy of our MELR is consistently higher than that of our baseline ProtoNet†. Moreover, as compared with ProtoNet†, the CECR loss of our MELR is also lower across the whole training process, indicating that MELR has better performance consistency between two episodes. This provides direct evidence that our CEAM and CECR can boost the generalization ability of the learned model on novel classes.
md/train/EI2KOXKdnP/EI2KOXKdnP.md ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MLP-Mixer: An all-MLP Architecture for Vision
2
+
3
+ Ilya Tolstikhin∗, Neil Houlsby∗, Alexander Kolesnikov∗, Lucas Beyer∗,
4
+
5
+ Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Andreas Steiner,
6
+
7
+ Daniel Keysers, Jakob Uszkoreit, Mario Lucic, Alexey Dosovitskiy
8
+
9
+ ∗equal contribution
10
+
11
+ Google Research, Brain Team
12
+
13
+ {tolstikhin, neilhoulsby, akolesnikov, lbeyer, xzhai, unterthiner, jessicayung†, andstein, keysers, usz, lucic, adosovitskiy}@google.com
14
+
15
+ †work done during Google AI Residency
16
+
17
+ # Abstract
18
+
19
+ Convolutional Neural Networks (CNNs) are the go-to model for computer vision. Recently, attention-based networks, such as the Vision Transformer, have also become popular. In this paper we show that while convolutions and attention are both sufficient for good performance, neither of them are necessary. We present MLP-Mixer, an architecture based exclusively on multi-layer perceptrons (MLPs). MLP-Mixer contains two types of layers: one with MLPs applied independently to image patches (i.e. “mixing” the per-location features), and one with MLPs applied across patches (i.e. “mixing” spatial information). When trained on large datasets, or with modern regularization schemes, MLP-Mixer attains competitive scores on image classification benchmarks, with pre-training and inference cost comparable to state-of-the-art models. We hope that these results spark further research beyond the realms of well established CNNs and Transformers.1
20
+
21
+ # 1 Introduction
22
+
23
+ As the history of computer vision demonstrates, the availability of larger datasets coupled with increased computational capacity often leads to a paradigm shift. While Convolutional Neural Networks (CNNs) have been the de-facto standard for computer vision, recently Vision Transformers [14] (ViT), an alternative based on self-attention layers, attained state-of-the-art performance. ViT continues the long-lasting trend of removing hand-crafted visual features and inductive biases from models and relies further on learning from raw data.
24
+
25
+ We propose the MLP-Mixer architecture (or “Mixer” for short), a competitive but conceptually and technically simple alternative, that does not use convolutions or self-attention. Instead, Mixer’s architecture is based entirely on multi-layer perceptrons (MLPs) that are repeatedly applied across either spatial locations or feature channels. Mixer relies only on basic matrix multiplication routines, changes to data layout (reshapes and transpositions), and scalar nonlinearities.
26
+
27
+ Figure 1 depicts the macro-structure of Mixer. It accepts a sequence of linearly projected image patches (also referred to as tokens) shaped as a “patches $\times$ channels” table as an input, and maintains this dimensionality. Mixer makes use of two types of MLP layers: channel-mixing MLPs and token-mixing MLPs. The channel-mixing MLPs allow communication between different channels;
28
+
29
+ ![](images/759c8bb1b0f4ebf46f621f72824e0a25d409516ac63197eee33154d2126e49cb.jpg)
30
+ Figure 1: MLP-Mixer consists of per-patch linear embeddings, Mixer layers, and a classifier head. Mixer layers contain one token-mixing MLP and one channel-mixing MLP, each consisting of two fully-connected layers and a GELU nonlinearity. Other components include: skip-connections, dropout, and layer norm on the channels.
31
+
32
+ they operate on each token independently and take individual rows of the table as inputs. The token-mixing MLPs allow communication between different spatial locations (tokens); they operate on each channel independently and take individual columns of the table as inputs. These two types of layers are interleaved to enable interaction of both input dimensions.
33
+
34
+ In the extreme case, our architecture can be seen as a very special CNN, which uses $1 \times 1$ convolutions for channel mixing, and single-channel depth-wise convolutions of a full receptive field and parameter sharing for token mixing. However, the converse is not true as typical CNNs are not special cases of Mixer. Furthermore, a convolution is more complex than the plain matrix multiplication in MLPs as it requires an additional costly reduction to matrix multiplication and/or specialized implementation.
35
+
36
+ Despite its simplicity, Mixer attains competitive results. When pre-trained on large datasets (i.e., ${ \sim } 1 0 0 \mathbf { M }$ images), it reaches near state-of-the-art performance, previously claimed by CNNs and Transformers, in terms of the accuracy/cost trade-off. This includes $8 7 . 9 4 \%$ top-1 validation accuracy on ILSVRC2012 “ImageNet” [13]. When pre-trained on data of more modest scale (i.e., ${ \sim } 1 -$ 10M images), coupled with modern regularization techniques [49, 54], Mixer also achieves strong performance. However, similar to ViT, it falls slightly short of specialized CNN architectures.
37
+
38
+ # 2 Mixer Architecture
39
+
40
+ Modern deep vision architectures consist of layers that mix features (i) at a given spatial location, (ii) between different spatial locations, or both at once. In CNNs, (ii) is implemented with $N \times N$ convolutions (for $N > 1$ ) and pooling. Neurons in deeper layers have a larger receptive field [1, 29]. At the same time, $1 \times 1$ convolutions also perform (i), and larger kernels perform both (i) and (ii). In Vision Transformers and other attention-based architectures, self-attention layers allow both (i) and (ii) and the MLP-blocks perform (i). The idea behind the Mixer architecture is to clearly separate the per-location (channel-mixing) operations (i) and cross-location (token-mixing) operations (ii). Both operations are implemented with MLPs. Figure 1 summarizes the architecture.
41
+
42
+ Mixer takes as input a sequence of $S$ non-overlapping image patches, each one projected to a desired hidden dimension $C$ . This results in a two-dimensional real-valued input table, $\mathbf { \bar { X } } \in \mathbb { R } ^ { S \times C }$ . If the original input image has resolution $( H , W )$ , and each patch has resolution $( P , P )$ , then the number of patches is $\bar { S } = \bar { H W } / P ^ { 2 }$ . All patches are linearly projected with the same projection matrix. Mixer consists of multiple layers of identical size, and each layer consists of two MLP blocks. The first one is the token-mixing MLP: it acts on columns of $\mathbf { X }$ (i.e. it is applied to a transposed input table $\mathbf { X } ^ { \top }$ ), maps $\mathbb { R } ^ { S } \mapsto \mathbb { R } ^ { S }$ , and is shared across all columns. The second one is the channel-mixing MLP: it acts on rows of $\mathbf { X }$ , maps $\mathbb { R } ^ { C } \mapsto \mathbb { R } ^ { C }$ , and is shared across all rows. Each MLP block contains two fully-connected layers and a nonlinearity applied independently to each row of its input data tensor. Mixer layers can be written as follows (omitting layer indices):
43
+
44
+ $$
45
+ \begin{array} { r } { \mathbf { U } _ { * , i } = \mathbf { X } _ { * , i } + \mathbf { W } _ { 2 } \sigma \big ( \mathbf { W } _ { 1 } \mathrm { L a y e r N o r m } ( \mathbf { X } ) _ { * , i } \big ) , \quad \mathrm { f o r } i = 1 \ldots C , } \\ { \mathbf { Y } _ { j , * } = \mathbf { U } _ { j , * } + \mathbf { W } _ { 4 } \sigma \big ( \mathbf { W } _ { 3 } \mathrm { L a y e r N o r m } ( \mathbf { U } ) _ { j , * } \big ) , \quad \mathrm { f o r } j = 1 \ldots S . } \end{array}
46
+ $$
47
+
48
+ Here $\sigma$ is an element-wise nonlinearity (GELU [16]). $D _ { S }$ and $D _ { C }$ are tunable hidden widths in the token-mixing and channel-mixing MLPs, respectively. Note that $D _ { S }$ is selected independently of the number of input patches. Therefore, the computational complexity of the network is linear in the number of input patches, unlike ViT whose complexity is quadratic. Since $D _ { C }$ is independent of the patch size, the overall complexity is linear in the number of pixels in the image, as for a typical CNN.
49
+
50
+ As mentioned above, the same channel-mixing MLP (token-mixing MLP) is applied to every row (column) of $\mathbf { X }$ . Tying the parameters of the channel-mixing MLPs (within each layer) is a natural choice—it provides positional invariance, a prominent feature of convolutions. However, tying parameters across channels is much less common. For example, separable convolutions [9, 40], used in some CNNs, apply convolutions to each channel independently of the other channels. However, in separable convolutions, a different convolutional kernel is applied to each channel unlike the token-mixing MLPs in Mixer that share the same kernel (of full receptive field) for all of the channels. The parameter tying prevents the architecture from growing too fast when increasing the hidden dimension $C$ or the sequence length $S$ and leads to significant memory savings. Surprisingly, this choice does not affect the empirical performance, see Supplementary A.1.
51
+
52
+ Each layer in Mixer (except for the initial patch projection layer) takes an input of the same size. This “isotropic” design is most similar to Transformers, or deep RNNs in other domains, that also use a fixed width. This is unlike most CNNs, which have a pyramidal structure: deeper layers have a lower resolution input, but more channels. Note that while these are the typical designs, other combinations exist, such as isotropic ResNets [38] and pyramidal ViTs [52].
53
+
54
+ Aside from the MLP layers, Mixer uses other standard architectural components: skip-connections [15] and layer normalization [2]. Unlike ViTs, Mixer does not use position embeddings because the token-mixing MLPs are sensitive to the order of the input tokens. Finally, Mixer uses a standard classification head with the global average pooling layer followed by a linear classifier. Overall, the architecture can be written compactly in JAX/Flax, the code is given in Supplementary F.
55
+
56
+ # 3 Experiments
57
+
58
+ We evaluate the performance of MLP-Mixer models, pre-trained with medium- to large-scale datasets, on a range of small and mid-sized downstream classification tasks. We are interested in three primary quantities: (1) Accuracy on the downstream task; (2) Total computational cost of pre-training, which is important when training the model from scratch on the upstream dataset; (3) Test-time throughput, which is important to the practitioner. Our goal is not to demonstrate state-of-the-art results, but to show that, remarkably, a simple MLP-based model is competitive with today’s best convolutional and attention-based models.
59
+
60
+ Downstream tasks We use popular downstream tasks such as ILSVRC2012 “ImageNet” (1.3M training examples, 1k classes) with the original validation labels [13] and cleaned-up ReaL labels [5], CIFAR-10/100 (50k examples, 10/100 classes) [23], Oxford-IIIT Pets (3.7k examples, 36 classes) [33], and Oxford Flowers-102 (2k examples, 102 classes) [32]. We also use the Visual Task Adaptation Benchmark (VTAB-1k), which consists of 19 diverse datasets, each with 1k training examples [58].
61
+
62
+ Pre-training We follow the standard transfer learning setup: pre-training followed by fine-tuning on the downstream tasks. We pre-train our models on two public datasets: ILSVRC2021 ImageNet, and ImageNet-21k, a superset of ILSVRC2012 that contains 21k classes and 14M images [13]. To assess performance at larger scale, we also train on JFT-300M, a proprietary dataset with 300M examples and 18k classes [44]. We de-duplicate all pre-training datasets with respect to the test sets of the downstream tasks as done in Dosovitskiy et al. [14], Kolesnikov et al. [22]. We pre-train all models at resolution 224 using Adam with $\beta _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 9 9$ , linear learning rate warmup of 10k steps and linear decay, batch size 4 096, weight decay, and gradient clipping at global norm 1. For JFT-300M, we pre-process images by applying the cropping technique from Szegedy et al. [45] in addition to random horizontal flipping. For ImageNet and ImageNet-21k, we employ additional data augmentation and regularization techniques. In particular, we use RandAugment [12], mixup [60], dropout [43], and stochastic depth [19]. This set of techniques was inspired by the timm library [54] and Touvron et al. [48]. More details on these hyperparameters are provided in Supplementary B.
63
+
64
+ Table 1: Specifications of the Mixer architectures. The “B”, “L”, and “H” (base, large, and huge) model scales follow Dosovitskiy et al. [14]. A brief notation $\mathbf { \ddot { B } } / 1 6 ^ { \mathbf { \ ' } }$ means the model of base scale with patches of resolution $1 6 \times 1 6$ . The number of parameters is reported for an input resolution of 224 and does not include the weights of the classifier head.
65
+
66
+ <table><tr><td>Specification</td><td>S/32</td><td>S/16</td><td>B/32</td><td>B/16</td><td>L/32</td><td>L/16</td><td>H/14</td></tr><tr><td>Number of layers</td><td>8</td><td>8</td><td>12</td><td>12</td><td>24</td><td>24</td><td>32</td></tr><tr><td>Patch resolution P×P</td><td>32×32</td><td>16×16</td><td>32×32</td><td>16×16</td><td>32×32</td><td>16×16</td><td>14×14</td></tr><tr><td>Hidden size C</td><td>512</td><td>512</td><td>768</td><td>768</td><td>1024</td><td>1024</td><td>1280</td></tr><tr><td>Sequence length S</td><td>49</td><td>196</td><td>49</td><td>196</td><td>49</td><td>196</td><td>256</td></tr><tr><td>MLP dimension Dc</td><td>2048</td><td>2048</td><td>3072</td><td>3072</td><td>4096</td><td>4096</td><td>5120</td></tr><tr><td>MLP dimension Ds</td><td>256</td><td>256</td><td>384</td><td>384</td><td>512</td><td>512</td><td>640</td></tr><tr><td>Parameters (M)</td><td>19</td><td>18</td><td>60</td><td>59</td><td>206</td><td>207</td><td>431</td></tr></table>
67
+
68
+ Fine-tuning We fine-tune using momentum SGD, batch size 512, gradient clipping at global norm 1, and a cosine learning rate schedule with a linear warmup. We do not use weight decay when finetuning. Following common practice [22, 48], we also fine-tune at higher resolutions with respect to those used during pre-training. Since we keep the patch resolution fixed, this increases the number of input patches (say from $S$ to $S ^ { \prime }$ ) and thus requires modifying the shape of Mixer’s token-mixing MLP blocks. Formally, the input in Eq. (1) is left-multiplied by a weight matrix $\mathbf { W } _ { 1 } \in \mathbb { R } ^ { D _ { S } \times S }$ and this operation has to be adjusted when changing the input dimension $S$ . For this, we increase the hidden layer width from $D _ { S }$ to $D _ { S ^ { \prime } }$ in proportion to the number of patches and initialize the (now larger) weight matrix $\mathbf { W } _ { 2 } ^ { \prime } \in \mathbb { R } ^ { D _ { S ^ { \prime } } \times S ^ { \prime } }$ with a block-diagonal matrix containing copies of $\mathbf { W } _ { 2 }$ on its diagonal. This particular scheme only allows for $S ^ { \prime } = \breve { K } ^ { 2 } S$ with $K \in \mathbb N$ . See Supplementary C for further details. On the VTAB-1k benchmark we follow the BiT-HyperRule [22] and fine-tune Mixer models at resolution 224 and 448 on the datasets with small and large input images respectively.
69
+
70
+ Metrics We evaluate the trade-off between the model’s computational cost and quality. For the former we compute two metrics: (1) Total pre-training time on TPU-v3 accelerators, which combines three relevant factors: the theoretical FLOPs for each training setup, the computational efficiency on the relevant training hardware, and the data efficiency. (2) Throughput in images/sec/core on TPU-v3. Since models of different sizes may benefit from different batch sizes, we sweep the batch sizes and report the highest throughput for each model. For model quality, we focus on top-1 downstream accuracy after fine-tuning. On two occasions (Figure 3, right and Figure 4), where fine-tuning all of the models is too costly, we report the few-shot accuracies obtained by solving the $\ell _ { 2 }$ -regularized linear regression problem between the frozen learned representations of images and the labels.
71
+
72
+ Models We compare various configurations of Mixer, summarized in Table 1, to the most recent, state-of-the-art, CNNs and attention-based models. In all the figures and tables, the MLP-based Mixer models are marked with pink ( ), convolution-based models with yellow $( \circ )$ , and attention-based models with blue ( ). The Vision Transformers (ViTs) have model scales and patch resolutions similar to Mixer. HaloNets are attention-based models that use a ResNet-like structure with local selfattention layers instead of $3 \times 3$ convolutions [51]. We focus on the particularly efficient “HaloNet-H4 (base 128, Conv-12)” model, which is a hybrid variant of the wider HaloNet-H4 architecture with some of the self-attention layers replaced by convolutions. Note, we mark HaloNets with both attention and convolutions with blue ( ). Big Transfer (BiT) [22] models are ResNets optimized for transfer learning. NFNets [7] are normalizer-free ResNets with several optimizations for ImageNet classification. We consider the NFNet- $\cdot \mathrm { F 4 + }$ model variant. We consider MPL [35] and ALIGN [21] for EfficientNet architectures. MPL is pre-trained at very large-scale on JFT-300M images, using meta-pseudo labelling from ImageNet instead of the original labels. We compare to the EfficientNetB6-Wide model variant. ALIGN pre-train image encoder and language encoder on noisy web image text pairs in a contrastive way. We compare to their best EfficientNet-L2 image encoder.
73
+
74
+ # 3.1 Main results
75
+
76
+ Table 2 presents comparison of the largest Mixer models to state-of-the-art models from the literature. “ImNet” and “ReaL” columns refer to the original ImageNet validation [13] and cleaned-up ReaL [5] labels. “Avg. $5 ^ { \circ }$ stands for the average performance across all five downstream tasks (ImageNet, CIFAR-10, CIFAR-100, Pets, Flowers). Figure 2 (left) visualizes the accuracy-compute frontier. When pre-trained on ImageNet-21k with additional regularization, Mixer achieves an overall strong performance $8 4 . 1 5 \%$ top-1 on ImageNet), although slightly inferior to other models2. Regularization in this scenario is necessary and Mixer overfits without it, which is consistent with similar observations for ViT [14]. The same conclusion holds when training Mixer from random initialization on ImageNet (see Section 3.2): Mixer-B/16 attains a reasonable score of $7 6 . 4 \%$ at resolution 224, but tends to overfit. This score is similar to a vanilla ResNet50, but behind state-of-the-art CNNs/hybrids for the ImageNet “from scratch” setting, e.g. $8 4 . 7 \%$ BotNet [42] and $8 6 . 5 \%$ NFNet [7].
77
+
78
+ Table 2: Transfer performance, inference throughput, and training cost. The rows are sorted by inference throughput (fifth column). Mixer has comparable transfer accuracy to state-of-the-art models with similar cost. The Mixer models are fine-tuned at resolution 448. Mixer performance numbers are averaged over three fine-tuning runs and standard deviations are smaller than 0.1.
79
+
80
+ <table><tr><td></td><td>ImNet top-1</td><td>ReaL top-1</td><td>Avg 5 top-1</td><td>VTAB-1k 19 tasks</td><td>Throughput img/sec/core</td><td>TPUv3 core-days</td></tr><tr><td colspan="7">Pre-trained on ImageNet-21k (public)</td></tr><tr><td>HaloNet [51]</td><td>85.8</td><td></td><td></td><td></td><td>120</td><td>0.10k</td></tr><tr><td>Mixer-L/16</td><td>84.15</td><td>87.86</td><td>93.91</td><td>74.95</td><td>105</td><td>0.41k</td></tr><tr><td>ViT-L/16 [14]</td><td>85.30</td><td>88.62</td><td>94.39</td><td>72.72</td><td>32</td><td>0.18k</td></tr><tr><td>BiT-R152x4 [22] .</td><td>85.39</td><td></td><td>94.04</td><td>70.64</td><td>26</td><td>0.94k</td></tr><tr><td colspan="7">Pre-trained on JFT-30OM (proprietary)</td></tr><tr><td>NFNet-F4+ [7]</td><td>89.2</td><td></td><td></td><td></td><td>46</td><td>1.86k</td></tr><tr><td>· Mixer-H/14</td><td>87.94</td><td>90.18</td><td>95.71</td><td>75.33</td><td>40</td><td>1.01k</td></tr><tr><td>·BiT-R152x4 [22]</td><td>87.54</td><td>90.54</td><td>95.33</td><td>76.29</td><td>26</td><td>9.90k</td></tr><tr><td>ViT-H/14 [14]</td><td>88.55</td><td>90.72</td><td>95.97</td><td>77.63</td><td>15</td><td>2.30k</td></tr><tr><td colspan="7">Pre-trained on unlabelled or weakly labelled data (proprietary)</td></tr><tr><td>·MPL [35]</td><td>90.0</td><td>91.12</td><td></td><td></td><td>一</td><td>20.48k</td></tr><tr><td>ALIGN[21] T</td><td>88.64</td><td>一</td><td></td><td>79.99</td><td>15</td><td>14.82k</td></tr></table>
81
+
82
+ When the size of the upstream dataset increases, Mixer’s performance improves significantly. In particular, Mixer-H/14 achieves $8 7 . 9 4 \%$ top-1 accuracy on ImageNet, which is $0 . 5 \%$ better than BiTResNet $1 5 2 \mathrm { x } 4$ and only $0 . 5 \%$ lower than ViT-H/14. Remarkably, Mixer-H/14 runs 2.5 times faster than ViT-H/14 and almost twice as fast as BiT. Overall, Figure 2 (left) supports our main claim that in terms of the accuracy-compute trade-off Mixer is competitive with more conventional neural network architectures. The figure also demonstrates a clear correlation between the total pre-training cost and the downstream accuracy, even across architecture classes.
83
+
84
+ BiT-ResNet1 $5 2 \mathrm { x } 4$ in the table are pre-trained using SGD with momentum and a long schedule. Since Adam tends to converge faster, we complete the picture in Figure 2 (left) with the BiT-R200x3 model from Dosovitskiy et al. [14] pre-trained on JFT-300M using Adam. This ResNet has a slightly lower accuracy, but considerably lower pre-training compute. Finally, the results of smaller ViT-L/16 and Mixer-L/16 models are also reported in this figure.
85
+
86
+ # 3.2 The role of the model scale
87
+
88
+ The results outlined in the previous section focus on (large) models at the upper end of the compute spectrum. We now turn our attention to smaller Mixer models.
89
+
90
+ We may scale the model in two independent ways: (1) Increasing the model size (number of layers, hidden dimension, MLP widths) when pre-training; (2) Increasing the input image resolution when fine-tuning. While the former affects both pre-training compute and test-time throughput, the latter only affects the throughput. Unless stated otherwise, we fine-tune at resolution 224.
91
+
92
+ ![](images/e888ec18a5f1ffc5126a75c42bc7c88e5c7569217134a6f3ca6be02f3064c9b2.jpg)
93
+ Figure 2: Left: ImageNet accuracy/training cost Pareto frontier (dashed line) for the SOTA models in Table 2. Models are pre-trained on ImageNet-21k, or JFT (labelled, or pseudo-labelled for MPL), or web image text pairs. Mixer is as good as these extremely performant ResNets, ViTs, and hybrid models, and sits on frontier with HaloNet, ViT, NFNet, and MPL. Right: Mixer (solid) catches or exceeds BiT (dotted) and ViT (dashed) as the data size grows. Every point on a curve uses the same pre-training compute; they correspond to pre-training on $3 \%$ , $10 \%$ , $30 \%$ , and $100 \%$ of JFT-300M for 233, 70, 23, and 7 epochs, respectively. Additional points at ${ \sim } 3 \mathbf { B }$ correspond to pre-training on an even larger JFT-3B dataset for the same number of total steps. Mixer improves more rapidly with data than ResNets, or even ViT. The gap between large Mixer and ViT models shrinks.
94
+
95
+ ![](images/dcb60c2290be7785a89bed98d1d0cadb3b9e81795e4b5a5cc118b0fb971d4aa5.jpg)
96
+ Figure 3: The role of the model scale. ImageNet validation top-1 accuracy vs. total pre-training compute (left) and throughput (right) of ViT, BiT, and Mixer models at various scales. All models are pre-trained on JFT-300M and fine-tuned at resolution 224, which is lower than in Figure 2 (left).
97
+
98
+ We compare various configurations of Mixer (see Table 1) to ViT models of similar scales and BiT models pre-trained with Adam. The results are summarized in Table 3 and Figure 3. When trained from scratch on ImageNet, Mixer-B/16 achieves a reasonable top-1 accuracy of $7 6 . 4 4 \%$ . This is $3 \%$ behind the ViT-B/16 model. The training curves (not reported) reveal that both models achieve very similar values of the training loss. In other words, Mixer-B/16 overfits more than ViT-B/16. For the Mixer-L/16 and ViT-L/16 models this difference is even more pronounced.
99
+
100
+ As the pre-training dataset grows, Mixer’s performance steadily improves. Remarkably, Mixer-H/14 pre-trained on JFT-300M and fine-tuned at 224 resolution is only $0 . 3 \%$ behind ViT-H/14 on ImageNet whilst running 2.2 times faster. Figure 3 clearly demonstrates that although Mixer is slightly below the frontier on the lower end of model scales, it sits confidently on the frontier at the high end.
101
+
102
+ # 3.3 The role of the pre-training dataset size
103
+
104
+ The results presented thus far demonstrate that pre-training on larger datasets significantly improves Mixer’s performance. Here, we study this effect in more detail.
105
+
106
+ To study Mixer’s ability to make use of the growing number of training examples we pre-train Mixer-B/32, Mixer-L/32, and Mixer-L/16 models on random subsets of JFT-300M containing $3 \%$ , $10 \%$ , $30 \%$ and $100 \%$ of all the training examples for 233, 70, 23, and 7 epochs. Thus, every model is pre-trained for the same number of total steps. We also pre-train Mixer-L/16 model on an even larger JFT-3B dataset [59] containing roughly 3B images with 30k classes for the same number of total steps.
107
+
108
+ Table 3: Performance of Mixer and other models from the literature across various model and pre-training dataset scales. “Avg. 5” denotes the average performance across five downstream tasks. Mixer and ViT models are averaged over three fine-tuning runs, standard deviations are smaller than 0.15. $( \ddagger )$ Extrapolated from the numbers reported for the same models pre-trained on JFT-300M without extra regularization. $\mathbf { \Pi } ( \widehat { \mathbf { a } } )$ Numbers provided by authors of Dosovitskiy et al. [14] through personal communication. Rows are sorted by throughput.
109
+
110
+ <table><tr><td></td><td>Image size</td><td>Pre-Train Epochs</td><td>ImNet top-1</td><td>ReaL top-1</td><td></td><td>Avg.5Throughput top-1 (img/sec/core) core-days</td><td>TPUv3</td></tr><tr><td colspan="8">Pre-trained on ImageNet (with extra regularization)</td></tr><tr><td>Mixer-B/16</td><td>224</td><td>300</td><td>76.44</td><td>82.36</td><td>88.33</td><td>1384</td><td>0.01k(t)</td></tr><tr><td>ViT-B/16 ()</td><td>224</td><td>300</td><td>79.67</td><td>84.97</td><td>90.79</td><td>861</td><td>0.02k(±)</td></tr><tr><td>Mixer-L/16 .</td><td>224</td><td>300</td><td>71.76</td><td>77.08</td><td>87.25</td><td>419</td><td>0.04k(t)</td></tr><tr><td>ViT-L/16 ()</td><td>224</td><td>300</td><td>76.11</td><td>80.93</td><td>89.66</td><td>280</td><td>0.05k($)</td></tr><tr><td colspan="8">Pre-trained on ImageNet-21k (with extra regularization)</td></tr><tr><td>·Mixer-B/16</td><td>224</td><td>300</td><td>80.64</td><td>85.80</td><td>92.50</td><td>1384</td><td>0.15k(t)</td></tr><tr><td>ViT-B/16 ()</td><td>224</td><td>300</td><td>84.59</td><td>88.93</td><td>94.16</td><td>861</td><td>0.18k(t)</td></tr><tr><td>Mixer-L/16</td><td>224</td><td>300</td><td>82.89</td><td>87.54</td><td>93.63</td><td>419</td><td>0.41k($)</td></tr><tr><td>ViT-L/16 (a)</td><td>224</td><td>300</td><td>84.46</td><td>88.35</td><td>94.49</td><td>280</td><td>0.55k(t)</td></tr><tr><td>·Mixer-L/16</td><td>448</td><td>300</td><td>83.91</td><td>87.75</td><td>93.86</td><td>105</td><td>0.41k($)</td></tr><tr><td colspan="8">Pre-trained on JFT-300M</td></tr><tr><td>·Mixer-S/32</td><td>224</td><td>5</td><td>68.70</td><td>75.83</td><td>87.13</td><td>11489</td><td>0.01k</td></tr><tr><td>Mixer-B/32</td><td>224</td><td>7</td><td>75.53</td><td>81.94</td><td>90.99</td><td>4208</td><td>0.05k</td></tr><tr><td>Mixer-S/16</td><td>224</td><td>5</td><td>73.83</td><td>80.60</td><td>89.50</td><td>3994</td><td>0.03k</td></tr><tr><td>BiT-R50x1</td><td>224</td><td>7</td><td>73.69</td><td>81.92</td><td>一</td><td>2159</td><td>0.08k</td></tr><tr><td>Mixer-B/16</td><td>224</td><td>7</td><td>80.00</td><td>85.56</td><td>92.60</td><td>1384</td><td>0.08k</td></tr><tr><td>·Mixer-L/32</td><td>224</td><td>7</td><td>80.67</td><td>85.62</td><td>93.24</td><td>1314</td><td>0.12k</td></tr><tr><td>BiT-R152x1</td><td>224</td><td>7</td><td>79.12</td><td>86.12</td><td></td><td>932</td><td>0.14k</td></tr><tr><td>BiT-R50x2</td><td>224</td><td>7</td><td>78.92</td><td>86.06</td><td></td><td>890</td><td>0.14k</td></tr><tr><td>BiT-R152x2</td><td>224</td><td>14</td><td>83.34</td><td>88.90</td><td></td><td>356</td><td>0.58k</td></tr><tr><td>Mixer-L/16</td><td>224</td><td>7</td><td>84.05</td><td>88.14</td><td>94.51</td><td>419</td><td>0.23k</td></tr><tr><td>·Mixer-L/16</td><td>224</td><td>14</td><td>84.82</td><td>88.48</td><td>94.77</td><td>419</td><td>0.45k</td></tr><tr><td>ViT-L/16</td><td>224</td><td>14</td><td>85.63</td><td>89.16</td><td>95.21</td><td>280</td><td>0.65k</td></tr><tr><td>Mixer-H/14</td><td>224</td><td>14</td><td>86.32</td><td>89.14</td><td>95.49</td><td>194</td><td>1.01k</td></tr><tr><td>. BiT-R200x3</td><td>224</td><td>14</td><td>84.73</td><td>89.58</td><td></td><td>141</td><td>1.78k</td></tr><tr><td>Mixer-L/16</td><td>448</td><td>14</td><td>86.78</td><td>89.72</td><td>95.13</td><td>105</td><td>0.45k</td></tr><tr><td>ViT-H/14</td><td>224</td><td>14</td><td>86.65</td><td>89.56</td><td>95.57</td><td>87</td><td>2.30k</td></tr><tr><td>ViT-L/16 [14]</td><td>512</td><td>14</td><td>87.76</td><td>90.54</td><td>95.63</td><td>32</td><td>0.65k</td></tr></table>
111
+
112
+ While not strictly comparable, this allows us to further extrapolate the effect of scale. We use the linear 5-shot top-1 accuracy on ImageNet as a proxy for transfer quality. For every pre-training run we perform early stopping based on the best upstream validation performance. Results are reported in Figure 2 (right), where we also include ViT-B/32, ViT-L/32, ViT-L/16, and BiT- $\mathbf { R } 1 5 2 \mathbf { x } 2$ models.
113
+
114
+ When pre-trained on the smallest subset of JFT-300M, all Mixer models strongly overfit. BiT models also overfit, but to a lesser extent, possibly due to the strong inductive biases associated with the convolutions. As the dataset increases, the performance of both Mixer-L/32 and Mixer-L/16 grows faster than BiT; Mixer-L/16 keeps improving, while the BiT model plateaus.
115
+
116
+ The same conclusions hold for ViT, consistent with Dosovitskiy et al. [14]. However, the relative improvement of larger Mixer models are even more pronounced. The performance gap between Mixer-L/16 and ViT-L/16 shrinks with data scale. It appears that Mixer benefits from the growing dataset size even more than ViT. One could speculate and explain it again with the difference in inductive biases: self-attention layers in ViT lead to certain properties of the learned functions that are less compatible with the true underlying distribution than those discovered with Mixer architecture.
117
+
118
+ # 3.4 Invariance to input permutations
119
+
120
+ In this section, we study the difference between inductive biases of Mixer and CNN architectures. Specifically, we train Mixer-B/16 and ResNet50x1 models on JFT-300M following the pre-training setup described in Section 3 and using one of two different input transformations: (1) Shuffle the order of $1 6 \times 1 6$ patches and permute pixels within each patch with a shared permutation; (2) Permute the pixels globally in the entire image. Same permutation is used across all images. We report the linear 5-shot top-1 accuracy of the trained models on ImageNet in Figure 4 (bottom). Some original images along with their two transformed versions appear in Figure 4 (top). As could be expected, Mixer is invariant to the order of patches and pixels within the patches (the blue and green curves match perfectly). On the other hand, ResNet’s strong inductive bias relies on a particular order of pixels within an image and its performance drops significantly when the patches are permuted. Remarkably, when globally permuting the pixels, Mixer’s performance drops much less ( ${ \sim } 4 5 \%$ drop) compared to the ResNet $\sim 7 5 \%$ drop).
121
+
122
+ ![](images/4d73edba72e7ee7ea5c72a0d41ac9476e577939a71c5c92b54605615df0e5d5c.jpg)
123
+ Figure 4: Top: Input examples from ImageNet before permuting the contents (left); after shuffling the $1 6 \times 1 6$ patches and pixels within the patches (center); after shuffling pixels globally (right). Bottom: Mixer-B/16 (left) and ResNet50x1 (right) trained with three corresponding input pipelines.
124
+
125
+ ![](images/6580eadc8dc26ea6d1683a42b8533e69114404d978ae2cc5853f9e28e8fb58f1.jpg)
126
+ Figure 5: Hidden units in the first (left), second (center), and third (right) token-mixing MLPs of a Mixer-B/16 model trained on JFT-300M. Each unit has 196 weights, one for each of the $1 4 \times 1 4$ incoming patches. We pair the units to highlight the emergence of kernels of opposing phase. Pairs are sorted by filter frequency. In contrast to the kernels of convolutional filters, where each weight corresponds to one pixel in the input image, one weight in any plot from the left column corresponds to a particular $1 6 \times 1 6$ patch of the input image. Complete plots in Supplementary D.
127
+
128
+ # 3.5 Visualization
129
+
130
+ It is commonly observed that the first layers of CNNs tend to learn Gabor-like detectors that act on pixels in local regions of the image. In contrast, Mixer allows for global information exchange in the token-mixing MLPs, which begs the question whether it processes information in a similar fashion. Figure 5 shows hidden units of the first three token-mixing MLPs of Mixer trained on JFT-300M. Recall that the token-mixing MLPs allow global communication between different spatial locations. Some of the learned features operate on the entire image, while others operate on smaller regions. Deeper layers appear to have no clearly identifiable structure. Similar to CNNs, we observe many pairs of feature detectors with opposite phases [39]. The structure of learned units depends on the hyperparameters. Plots for the first embedding layer appear in Figure 2 of Supplementary D.
131
+
132
+ # 4 Related work
133
+
134
+ MLP-Mixer is a new architecture for computer vision that differs from previous successful architectures because it uses neither convolutional nor self-attention layers. Nevertheless, the design choices can be traced back to ideas from the literature on CNNs [24, 25] and Transformers [50].
135
+
136
+ CNNs have been the de-facto standard in computer vision since the AlexNet model [24] surpassed prevailing approaches based on hand-crafted image features [36]. Many works focused on improving the design of CNNs. Simonyan and Zisserman [41] demonstrated that one can train state-of-the-art models using only convolutions with small $3 \times 3$ kernels. He et al. [15] introduced skip-connections together with the batch normalization [20], which enabled training of very deep neural networks and further improved performance. A prominent line of research has investigated the benefits of using sparse convolutions, such as grouped [57] or depth-wise [9, 17] variants. In a similar spirit to our token-mixing MLPs, Wu et al. [55] share parameters in the depth-wise convolutions for natural language processing. Hu et al. [18] and Wang et al. [53] propose to augment convolutional networks with non-local operations to partially alleviate the constraint of local processing from CNNs. Mixer takes the idea of using convolutions with small kernels to the extreme: by reducing the kernel size to $1 \times 1$ it turns convolutions into standard dense matrix multiplications applied independently to each spatial location (channel-mixing MLPs). This alone does not allow aggregation of spatial information and to compensate we apply dense matrix multiplications that are applied to every feature across all spatial locations (token-mixing MLPs). In Mixer, matrix multiplications are applied row-wise or column-wise on the “patches $\times$ features” input table, which is also closely related to the work on sparse convolutions. Mixer uses skip-connections [15] and normalization layers [2, 20].
137
+
138
+ In computer vision, self-attention based Transformer architectures were initially applied for generative modeling [8, 34]. Their value for image recognition was demonstrated later, albeit in combination with a convolution-like locality bias [37], or on low-resolution images [10]. Dosovitskiy et al. [14] introduced ViT, a pure transformer model that has fewer locality biases, but scales well to large data. ViT achieves state-of-the-art performance on popular vision benchmarks while retaining the robustness of CNNs [6]. Touvron et al. [49] trained ViT effectively on smaller datasets using extensive regularization. Mixer borrows design choices from recent transformer-based architectures. The design of Mixer’s MLP-blocks originates in [27, 50]. Converting images to a sequence of patches and directly processing embeddings of these patches originates in Dosovitskiy et al. [14].
139
+
140
+ Many recent works strive to design more effective architectures for vision. Srinivas et al. [42] replace $3 \times 3$ convolutions in ResNets by self-attention layers. Ramachandran et al. [37], Tay et al. [47], Li et al. [26], and Bello [3] design networks with new attention-like mechanisms. Mixer can be seen as a step in an orthogonal direction, without reliance on locality bias and attention mechanisms.
141
+
142
+ The work of Lin et al. [28] is closely related. It attains reasonable performance on CIFAR-10 using fully connected networks, heavy data augmentation, and pre-training with an auto-encoder. Neyshabur [31] devises custom regularization and optimization algorithms and trains a fully-connected network, attaining impressive performance on small-scale tasks. Instead we rely on token and channel-mixing MLPs, use standard regularization and optimization techniques, and scale to large data effectively.
143
+
144
+ Traditionally, networks evaluated on ImageNet [13] are trained from random initialization using Inception-style pre-processing [46]. For smaller datasets, transfer of ImageNet models is popular. However, modern state-of-the-art models typically use either weights pre-trained on larger datasets, or more recent data-augmentation and training strategies. For example, Dosovitskiy et al. [14], Kolesnikov et al. [22], Mahajan et al. [30], Pham et al. [35], Xie et al. [56] all advance state-of-the-art in image classification using large-scale pre-training. Examples of improvements due to augmentation or regularization changes include Cubuk et al. [11], who attain excellent classification performance with learned data augmentation, and Bello et al. [4], who show that canonical ResNets are still near state-of-the-art, if one uses recent training and augmentation strategies.
145
+
146
+ # 5 Conclusions
147
+
148
+ We describe a very simple architecture for vision. Our experiments demonstrate that it is as good as existing state-of-the-art methods in terms of the trade-off between accuracy and computational resources required for training and inference. We believe these results open many questions. On the practical side, it may be useful to study the features learned by the model and identify the main differences (if any) from those learned by CNNs and Transformers. On the theoretical side, we would like to understand the inductive biases hidden in these various features and eventually their role in generalization. Most of all, we hope that our results spark further research, beyond the realms of established models based on convolutions and self-attention. It would be particularly interesting to see whether such a design works in NLP or other domains.
149
+
150
+ # Acknowledgments and Disclosure of Funding
151
+
152
+ The work was performed in the Brain teams in Berlin and Zürich. We thank Josip Djolonga for feedback on the initial version of the paper; Preetum Nakkiran for proposing to train MLP-Mixer on input images with shuffled pixels; Olivier Bousquet, Yann Dauphin, and Dirk Weissenborn for useful discussions.
153
+
154
+ # References
155
+
156
+ [1] A. Araujo, W. Norris, and J. Sim. Computing receptive fields of convolutional neural networks. Distill, 2019. doi: 10.23915/distill.00021. URL https://distill.pub/2019/ computing-receptive-fields.
157
+ [2] J. L. Ba, J. R. Kiros, and G. E. Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
158
+ [3] I. Bello. LambdaNetworks: Modeling long-range interactions without attention. arXiv preprint arXiv:2102.08602, 2021.
159
+ [4] I. Bello, W. Fedus, X. Du, E. D. Cubuk, A. Srinivas, T.-Y. Lin, J. Shlens, and B. Zoph. Revisiting ResNets: Improved training and scaling strategies. arXiv preprint arXiv:2103.07579, 2021.
160
+ [5] L. Beyer, O. J. Hénaff, A. Kolesnikov, X. Zhai, and A. van den Oord. Are we done with ImageNet? arXiv preprint arXiv:2006.07159, 2020.
161
+ [6] S. Bhojanapalli, A. Chakrabarti, D. Glasner, D. Li, T. Unterthiner, and A. Veit. Understanding robustness of transformers for image classification. arXiv preprint arXiv:2103.14586, 2021.
162
+ [7] A. Brock, S. De, S. L. Smith, and K. Simonyan. High-performance large-scale image recognition without normalization. arXiv preprint arXiv:2102.06171, 2021.
163
+ [8] R. Child, S. Gray, A. Radford, and I. Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019.
164
+ [9] F. Chollet. Xception: Deep learning with depthwise separable convolutions. In CVPR, 2017.
165
+ [10] J.-B. Cordonnier, A. Loukas, and M. Jaggi. On the relationship between self-attention and convolutional layers. In ICLR, 2020.
166
+ [11] E. D. Cubuk, B. Zoph, D. Mane, V. Vasudevan, and Q. V. Le. AutoAugment: Learning augmentation policies from data. In CVPR, 2019.
167
+ [12] E. D. Cubuk, B. Zoph, J. Shlens, and Q. V. Le. RandAugment: Practical automated data augmentation with a reduced search space. In CVPR Workshops, 2020.
168
+ [13] J. Deng, W. Dong, R. Socher, L. Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. In CVPR, 2009.
169
+ [14] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, J. Uszkoreit, and N. Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
170
+ [15] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, 2016.
171
+ [16] D. Hendrycks and K. Gimpel. Gaussian error linear units (GELUs). arXiv preprint arXiv:1606.08415, 2016.
172
+ [17] A. G. Howard, M. Zhu, B. Chen, D. Kalenichenko, W. Wang, T. Weyand, M. Andreetto, and H. Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017.
173
+ [18] J. Hu, L. Shen, and G. Sun. Squeeze-and-excitation networks. In CVPR, 2018.
174
+ [19] G. Huang, Y. Sun, Z. Liu, D. Sedra, and K. Q. Weinberger. Deep networks with stochastic depth. In ECCV, 2016.
175
+ [20] S. Ioffe and C. Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
176
+ [21] C. Jia, Y. Yang, Y. Xia, Y.-T. Chen, Z. Parekh, H. Pham, Q. V. Le, Y. Sung, Z. Li, and T. Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. arXiv preprint arXiv:2102.05918, 2021.
177
+ [22] A. Kolesnikov, L. Beyer, X. Zhai, J. Puigcerver, J. Yung, S. Gelly, and N. Houlsby. Big transfer (BiT): General visual representation learning. In ECCV, 2020.
178
+ [23] A. Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
179
+ [24] A. Krizhevsky, I. Sutskever, and G. E. Hinton. ImageNet classification with deep convolutional neural networks. In NeurIPS, 2012.
180
+ [25] Y. LeCun, B. Boser, J. Denker, D. Henderson, R. Howard, W. Hubbard, and L. Jackel. Backpropagation applied to handwritten zip code recognition. Neural Computation, 1:541–551, 1989.
181
+ [26] D. Li, J. Hu, C. Wang, X. Li, Q. She, L. Zhu, T. Zhang, and Q. Chen. Involution: Inverting the inherence of convolution for visual recognition. CVPR, 2021.
182
+ [27] M. Lin, Q. Chen, and S. Yan. Network in network. In ICLR, 2014.
183
+ [28] Z. Lin, R. Memisevic, and K. Konda. How far can we go without convolution: Improving fullyconnected networks. In ICLR, Workshop Track, 2016.
184
+ [29] W. Luo, Y. Li, R. Urtasun, and R. Zemel. Understanding the effective receptive field in deep convolutional neural networks. In NeurIPS, 2016.
185
+ [30] D. Mahajan, R. Girshick, V. Ramanathan, K. He, M. Paluri, Y. Li, A. Bharambe, and L. van der Maaten. Exploring the limits of weakly supervised pretraining. In ECCV, 2018.
186
+ [31] B. Neyshabur. Towards learning convolutions from scratch. In NeurIPS, 2020.
187
+ [32] M. Nilsback and A. Zisserman. Automated flower classification over a large number of classes. In ICVGIP, 2008.
188
+ [33] O. M. Parkhi, A. Vedaldi, A. Zisserman, and C. V. Jawahar. Cats and dogs. In CVPR, 2012.
189
+ [34] N. Parmar, A. Vaswani, J. Uszkoreit, L. Kaiser, N. Shazeer, A. Ku, and D. Tran. Image transformer. In ICML, 2018.
190
+ [35] H. Pham, Z. Dai, Q. Xie, M.-T. Luong, and Q. V. Le. Meta pseudo labels. In CVPR, 2021.
191
+ [36] A. Pinz. Object categorization. Foundations and Trends in Computer Graphics and Vision, 1(4), 2006.
192
+ [37] P. Ramachandran, N. Parmar, A. Vaswani, I. Bello, A. Levskaya, and J. Shlens. Stand-alone self-attention in vision models. In NeurIPS, 2019.
193
+ [38] M. Sandler, J. Baccash, A. Zhmoginov, and Howard. Non-discriminative data or weak model? On the relative importance of data and model resolution. In ICCV Workshop on Real-World Recognition from Low-Quality Images and Videos, 2019.
194
+ [39] W. Shang, K. Sohn, D. Almeida, and H. Lee. Understanding and improving convolutional neural networks via concatenated rectified linear units. In ICML, 2016.
195
+ [40] L. Sifre. Rigid-Motion Scattering For Image Classification. PhD thesis, Ecole Polytechnique, 2014.
196
+ [41] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
197
+ [42] A. Srinivas, T.-Y. Lin, N. Parmar, J. Shlens, P. Abbeel, and A. Vaswani. Bottleneck transformers for visual recognition. arXiv preprint arXiv:2101.11605, 2021.
198
+ [43] N. Srivastava, G. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. JMLR, 15(56), 2014.
199
+ [44] C. Sun, A. Shrivastava, S. Singh, and A. Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In ICCV, 2017.
200
+ [45] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. Going deeper with convolutions. In CVPR, 2015.
201
+ [46] C. Szegedy, V. Vanhoucke, S. Ioffe, J. Shlens, and Z. Wojna. Rethinking the inception architecture for computer vision. In CVPR, 2016.
202
+ [47] Y. Tay, D. Bahri, D. Metzler, D.-C. Juan, Z. Zhao, and C. Zheng. Synthesizer: Rethinking self-attention in transformer models. arXiv, 2020.
203
+ [48] H. Touvron, A. Vedaldi, M. Douze, and H. Jegou. Fixing the train-test resolution discrepancy. In NeurIPS, 2019.
204
+ [49] H. Touvron, M. Cord, M. Douze, F. Massa, A. Sablayrolles, and H. Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020.
205
+ [50] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. Attention is all you need. In NeurIPS, 2017.
206
+ [51] A. Vaswani, P. Ramachandran, A. Srinivas, N. Parmar, B. Hechtman, and J. Shlens. Scaling local self-attention for parameter efficient visual backbones. arXiv preprint arXiv:2103.12731, 2021.
207
+ [52] W. Wang, E. Xie, X. Li, D.-P. Fan, K. Song, D. Liang, T. Lu, P. Luo, and L. Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv preprint arXiv:2102.12122, 2021.
208
+ [53] X. Wang, R. Girshick, A. Gupta, and K. He. Non-local neural networks. In CVPR, 2018.
209
+ [54] R. Wightman. Pytorch image models. https://github.com/rwightman/ pytorch-image-models, 2019.
210
+ [55] F. Wu, A. Fan, A. Baevski, Y. Dauphin, and M. Auli. Pay less attention with lightweight and dynamic convolutions. In ICLR, 2019.
211
+ [56] Q. Xie, M.-T. Luong, E. Hovy, and Q. V. Le. Self-training with noisy student improves imagenet classification. In CVPR, 2020.
212
+ [57] S. Xie, R. Girshick, P. Dollár, Z. Tu, and K. He. Aggregated residual transformations for deep neural networks. arXiv preprint arXiv:1611.05431, 2016.
213
+ [58] X. Zhai, J. Puigcerver, A. Kolesnikov, P. Ruyssen, C. Riquelme, M. Lucic, J. Djolonga, A. S. Pinto, M. Neumann, A. Dosovitskiy, et al. A large-scale study of representation learning with the visual task adaptation benchmark. arXiv preprint arXiv:1910.04867, 2019.
214
+ [59] X. Zhai, A. Kolesnikov, N. Houlsby, and L. Beyer. Scaling vision transformers. arXiv preprint arXiv:2106.04560, 2021.
215
+ [60] H. Zhang, M. Cisse, Y. N. Dauphin, and D. Lopez-Paz. mixup: Beyond empirical risk minimization. In ICLR, 2018.
md/train/EnmG3G5SYR/EnmG3G5SYR.md ADDED
@@ -0,0 +1,403 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Provable Benefits of Actor-Critic Methods for Offline Reinforcement Learning
2
+
3
+ Andrea Zanette⇤ University of California, Berkeley zanette@berkeley.edu
4
+
5
+ Martin J. Wainwright University of California, Berkeley wainwrig@berkeley.edu
6
+
7
+ Emma Brunskill Stanford University ebrun@stanford.edu
8
+
9
+ # Abstract
10
+
11
+ Actor-critic methods are widely used in offline reinforcement learning practice, but are not so well-understood theoretically. We propose a new offline actor-critic algorithm that naturally incorporates the pessimism principle, leading to several key advantages compared to the state of the art. The algorithm can operate when the Bellman evaluation operator is closed with respect to the action value function of the actor’s policies; this is a more general setting than the low-rank MDP model. Despite the added generality, the procedure is computationally tractable as it involves the solution of a sequence of second-order programs. We prove an upper bound on the suboptimality gap of the policy returned by the procedure that depends on the data coverage of any arbitrary, possibly data dependent comparator policy. The achievable guarantee is complemented with a minimax lower bound that is matching up to logarithmic factors.
12
+
13
+ # 1 Introduction
14
+
15
+ The problem of learning a near-optimal policy is a core challenge in reinforcement learning (RL). In many settings, it is beneficial to be able to learn a good policy using only a pre-collected set of data, without further exploration with the environment; this problem is known as offline or batch policy learning. The offline setting has unique challenges due to the incomplete information about the Markov decision process (MDP) encoded in the available dataset. For example, due to maximization bias, a naive offline algorithm can return a policy with a severely overestimated value. In order to avoid such undesirable behavior, researchers have introduced the idea of pessimism under uncertainty, and there is now a growing literature (e.g., Liu et al. (2020); Jin et al. (2020b); Buckman et al. (2020); Kumar et al. (2019); Kidambi et al. (2020); Yu et al. (2020)) on different ways in which pessimism can be incorporated. See Appendix B for additional references and discussion of this body of work.
16
+
17
+ At a high level, incorporating pessimism prevents algorithms from settling down on uncertain policies whose value might be misleadingly high under the current dataset due to statistical errors. By using pessimism, uncertain policies are penalized in such a way that only those policies robust to statistical errors are returned. The principle can be implemented in at least two different ways: (a) by penalizing policies that are far from the one that generated the dataset; or (b) by penalizing the value functions of policies not well covered by the dataset. In this paper, we take the latter avenue.
18
+
19
+ # 1.1 Overview and our contributions
20
+
21
+ Implementing pessimism with function approximation is challenging for several reasons. First, uncertainty must be estimated with particular care. On one hand, underestimating it can fail to correct the coverage problem. On the other hand, overestimating it leads to policies that are too conservative and thus underperform. Second, the incorporation of pessimism may introduce complex, higher order perturbations into the value function class handled by the algorithm. Similar issues can arise when adding optimistic bonuses in the exploration. The increased complexity of the function class often requires additional assumptions on the model, because the new class needs to interact “nicely” with the Bellman operator. Prior art on pessimism with function approximation has by-passed this problem by making strong model assumptions, such as low-rank transitions Jin et al. (2020b) or algorithm-specific assumptions Liu et al. (2020)
22
+
23
+ Actor-critic methods: Most past theoretical work on offline reinforcement learning on finding with high probability the policy with the highest performance has focused on algorithms that are either model or value-based2 Liu et al. (2020); Jin et al. $\textcircled { 2 0 2 0 6 }$ ; Buckman et al. (2020); Kidambi et al. (2020); Yu et al. (2020); these often incorporate pessimism into the estimates of the policy performance. Actor-critic methods are a hybrid class of methods that mitigate some deficiencies of methods that are either purely policy or purely value-based Konda and Tsitsiklis $\textcircled { 1 2 0 0 0 } \textcircled { 2 0 0 3 }$ Heess et al. (2015); Haarnoja et al. (2017, 2018); in modern RL, they are widely used in practice (e.g., Levine et al. (2020); Wu et al. (2019, 2021); Kumar et al. (2019, 2020)). An actor-critic method generally consists of an actor that changes the policy in order to maximize its value as estimated by the critic. Given their popularity, it is natural to ask the following question: do actor-critic methods provably offer any advantage in offline RL? The main contribution of this paper is to give a positive answer to this question: by separating the policy optimization from the policy evaluation, both tasks become simpler to design and the pessimism principle can be incorporated more naturally.
24
+
25
+ Contributions: More specifically, we study the problem of policy learning using linear function approximation in the offline setting. We assume that we are given a batch data set $\mathcal { D }$ , in which each sample consists of a quadruple. The first two components are the state-action pair, corresponding to the state in which a given action was taken, and the last two components correspond to a noisy observation of the reward, and a successor state drawn from the appropriate transition function. Our theory allows for a very general dependence structure among the the state-action pairs in these samples; when the data set is ordered according to how the samples were collected (which need not be related to a trajectory), we allow the state-action pair at any given instant to depend on all past samples. This set-up allows from data collected from arbitrary policies, mixtures of policies, generative models or even in adversarial manner.
26
+
27
+ Given such a data set, our objective is to find the policy that performs best in the face of uncertainty. In particular, we need to account for the fact that the optimal policy $\pi ^ { * }$ for the underlying MDP may not be well covered by the dataset $\mathcal { D }$ , in which case the associated uncertainty would be prohibitive. In order to achieve this goal, we design an actor-critic procedure that iteratively optimizes a lower bound on the value of the optimal policy. Suppose that we are interested in optimizing the value function at some given initial $s _ { 1 }$ . Our strategy works as follows: for any given policy $\pi$ , we construct a family $\mathcal { M } ( \pi )$ of “statistically plausible” MDPs, and use them to define a simple second-order cone program. By solving this convex program, we obtain value function estimate $\underline { { { V } } } _ { M } ^ { \pi } ( s _ { 1 } ) =$ arg $\mathrm { m i n } _ { M \in \mathcal { M } ( \pi ) } V _ { M } ^ { \pi } \big ( s _ { 1 } \big )$ that—for an appropriately constructed family $\mathcal { M } ( \pi )$ —is guaranteed to be a lower bound on the true value function of $\pi$ in the unknown MDP that generated the dataset. Given a procedure for producing such lower bounds, it is then natural to maximize these lower bounds over some family $\Pi$ of policies. This combination leads to the saddle-point problem
28
+
29
+ $$
30
+ \operatorname* { m a x } _ { \pi \in \Pi } \operatorname* { m i n } _ { M \in \mathcal { M } ( \pi ) } V _ { M } ^ { \pi } \big ( s _ { 1 } \big ) .
31
+ $$
32
+
33
+ Note that actor-critic methods fit naturally in this framework: the critic provides a pessimistic evaluation of any given policy $\pi$ , and the actor solves the outer maximization problem over policies.
34
+
35
+ This decoupling lends itself to a computationally tractable implementation, along with an analysis of the procedure. In particular, we show that the actor’s sequence of estimated policies enjoys online learning-style guarantees with respect to a sequence of pessimistic MDPs implicitly identified by the critic.
36
+
37
+ The way in which we introduce pessimism is a second key component of the algorithmic framework. In particular, in line with our previous paper Zanette et al. (2020b), we do so without enlarging the prescribed classes of functions and policies. We do so by a direct perturbation of the value functions examined by the critic; there is no addition of pessimistic bonuses or absorbing states. Since the class of value functions is not altered, this method has two main advantages. First, there are no additional model assumptions compared to the standard—that is non-pessimistic—version of the actor-critic method. Second, the complexity of the underlying classes is not increased, thereby allowing us to construct tight confidence intervals and estimation error bounds that are minimax optimal up to logarithmic factors.
38
+
39
+ The remainder of this paper is organized as follows. We begin in Section $2$ with background on MDPS, and then introduce the modeling assumptions that underlie the analysis of this paper. In Section $3 .$ we introduce the algorithm studied in this paper, namely the Pessimistic Actor Critic for Learning without Exploration (for short, PACLE) algorithm. Section $\boxed { 4 }$ provides statements of our main results and discussion of their consequences, including an upper bound on the PACLE algorithm in Theorem $^ { 1 , }$ and a minimax lower bound in Theorem $\bigstar$ In Section $\bigstar \bigstar$ we provide an outline of the proof of Theorem $\bigstar$ with various technical details as well as the proof of Theorem $\bigstar$ deferred to the appendices. We conclude with a discussion in Section 5.
40
+
41
+ # 1.2 Notation
42
+
43
+ For the reader’s convenience, we summarize here some notation used throughout the paper. We let $B _ { d } ( r ) = \{ x \in \mathbb { R } ^ { d } \mid \| x \| _ { 2 } \leq r \}$ denote the Euclidean ball of radius $r \in \mathbb { R }$ in dimension $d$ ; we simply write $\boldsymbol { B }$ when there is no possibility of confusion. For a vector $x \in \mathbb { R } ^ { d }$ , we use $[ x ] _ { i }$ to denote its $i ^ { t h }$ component. We use the $\widetilde O$ notation to denote an upper bound that holds up to constants and log factors in the input parameters $\textstyle { \bigl ( } { \frac { 1 } { \delta } } , d , H { \bigr ) }$ . The notation $\lesssim$ means an upper bound that holds up to a constant, with an analogous definition for $\gtrsim$ .
44
+
45
+ # 2 Background and problem formulation
46
+
47
+ We begin by providing some background, before introducing the assumptions that underlie our problem formulation.
48
+
49
+ # 2.1 Markov decision processes
50
+
51
+ In this paper, we focus on finite-horizon Markov decision processes, for which we provide a very brief introduction here. See the books Puterman (1994); Bertsekas and Tsitsiklis (1996); Bertsekas $\textcircled { 1 9 9 5 }$ ; Sutton and Barto (2018) for more background and detail. A finite-horizon MDP is specified by a positive integer $\overline { H }$ , and events take place over a sequence of stages indexed by the time step $\boldsymbol { h } \in [ H ] \overset { d e f } { = } \{ 1 , \dots , H \}$ . The underlying dynamics involve a state space $s$ , and are controlled by actions that take values in some action set $\mathcal { A }$ . In this paper, we allow the state space to be arbitrary (continous or discrete), whereas our analysis applies to discrete action spaces. For each time step $h \in [ H ]$ , there is a reward function $r _ { h } : \mathcal { S } \times \mathcal { A } \to \mathbb { R }$ , and for every time step $h$ and state-action pair $( s , a )$ , there is a transition function $\mathbb { P } _ { h } ( \cdot \mid s , a )$ . When at horizon $h$ , if the agent takes action $a$ in state $s$ , it receives a random reward drawn from a distribution $R _ { h } ( s , a )$ with mean $r _ { h } ( s , a )$ , and it then transitions randomly to a next state $s ^ { + }$ drawn from the transition function $\mathbb { P } _ { h } ( \cdot \mid s , a )$ .
52
+
53
+ A policy $\pi _ { h }$ at stage $h$ is a mapping from the state space $s$ to the action space $\mathcal { A }$ . Given a full policy $\pi = ( \pi _ { 1 } , \ldots , \pi _ { H } )$ , the state-action value function at time step $h$ is given by
54
+
55
+ $$
56
+ Q _ { h } ^ { \pi } ( s , a ) = r _ { h } ( s , a ) + \mathbb { E } _ { S _ { \ell } \sim \pi \mid ( s , a ) } \sum _ { \ell = h + 1 } ^ { H } r _ { \ell } ( S _ { \ell } , \pi _ { \ell } ( S _ { \ell } ) ) ,
57
+ $$
58
+
59
+ where the expectation is over the trajectories induced by $\pi$ upon starting from the pair $( s , a )$ . When we omit the starting state-action pair $( s , a )$ , the expectation is intended to start from a fixed state
60
+
61
+ denoted by $s _ { 1 }$ . The value function associated to $\pi$ is $V _ { h } ^ { \pi } ( s ) = Q _ { h } ^ { \pi } ( s , \pi _ { h } ( s ) )$ . For a given policy $\pi$ , we define the Bellman evaluation operator
62
+
63
+ $$
64
+ \begin{array} { r } { \mathcal { T } _ { h } ^ { \pi } ( Q _ { h + 1 } ) ( s , a ) = r _ { h } ( s , a ) + \mathbb { E } _ { S ^ { \prime } \sim \mathbb { P } _ { h } ( s , a ) } \mathbb { E } _ { A ^ { \prime } \sim \pi } Q _ { h + 1 } ( S ^ { \prime } , A ^ { \prime } ) . } \end{array}
65
+ $$
66
+
67
+ Under some regularity conditions Puterman (1994); Shreve and Bertsekas (1978), there always exists an optimal policy $\pi ^ { \star }$ whose value and action-value functions are defined as
68
+
69
+ $$
70
+ V _ { h } ^ { \star } ( s ) = V _ { h } ^ { \pi ^ { \star } } ( s ) = \operatorname* { s u p } _ { \pi } V _ { h } ^ { \pi } ( s ) , \quad \mathrm { a n d } \quad Q _ { h } ^ { \star } ( s , a ) = Q _ { h } ^ { \pi ^ { \star } } ( s , a ) = \operatorname* { s u p } _ { \pi } Q _ { h } ^ { \pi } ( s , a ) .
71
+ $$
72
+
73
+ # 2.2 Assumptions on data generation
74
+
75
+ In this paper, we study a model in which we observe a dataset of the form $\mathcal { D } = \{ ( s _ { i } , a _ { i } , r _ { i } , s _ { i } ^ { + } ) \} _ { i = 1 } ^ { n }$ where $n$ is the total sample size. For each $i \in [ n ] = \{ 1 , 2 , . . . , n \}$ , the tuple $( s _ { i } , a _ { i } )$ corresponds to a state-action pair associated with some time step $h _ { i }$ . We let $\mathcal { F } _ { i }$ be the $\sigma$ -field generated by the samples $\{ ( s _ { j } , a _ { j } , r _ { j } , s _ { j } ^ { + } ) \} _ { j = 1 } ^ { i - 1 }$ that are in the “past” relative to index $i$ . With this notation, we impose the following condition:
76
+
77
+ Assumption 1 (Data generation). For each $i \in [ n ]$ , the pair $( s _ { i } , a _ { i } )$ is measurable with respect to ${ \mathcal { F } } _ { i }$ . Conditionally on a given pair $( s _ { i } , a _ { i } )$ , the random variable $r _ { i }$ is drawn from a reward distribution $R _ { h _ { i } } ( s _ { i } , a _ { i } )$ that is 1-sub-Gaussian; and the next state $s _ { i } ^ { + }$ is drawn from the distribution $\mathbb { P } _ { h _ { i } } ( s _ { i } , a _ { i } )$ .
78
+
79
+ Note that the measurability condition allows the choice of $( s _ { i } , a _ { i } )$ to depend arbitrarily on any of the past data with indices $j < i$ . The mild assumption allows for considerable freedom. For example, the state-action pairs may be chosen from (mixture) policies, or they can be generated by an adversarial procedure that changes the data acquisition strategy as feedback is received.
80
+
81
+ For each $h \in [ H ]$ , we let $\mathcal { T } _ { h }$ denote the subset of observation indices $i \in [ n ]$ such that $h _ { i } = h$ . These index sets define the sub-datasets ${ \mathcal { D } } _ { h } = \{ ( s _ { i } , a _ { i } , r _ { i } , s _ { i } ^ { + } ) , i \in { \mathcal { I } } _ { h } \}$ associated with all samples that are based on be written as rs at time step . $h$ . We define $n _ { h } = | \mathcal { D } _ { h } |$ , so that our total sample size can $\begin{array} { r } { n = \sum _ { h = 1 } ^ { H } n _ { h } } \end{array}$
82
+
83
+ # 2.3 Policy and function classes
84
+
85
+ Next we define the policy space $\Pi$ and the action value function space $\mathcal { Q }$ over which we seek solutions. Let $\phi : \mathcal { S } \overset { \cdot } { \times } \overset { \cdot } { \underset { \cdot } { A } } \overset { \cdot } { \mapsto } \overset { \cdot } { \mathbb { R } ^ { d } }$ be a $d$ -dimensional feature mapping. We assume throughout that these feature mappings are normalized such that $\| \phi ( s , a ) \| _ { 2 } \leq 1$ uniformly for all $( s , a )$ -pairs. We consider action-value functions that are linear in $\phi$ , and families of the form
86
+
87
+ $$
88
+ \mathcal { Q } ( { \boldsymbol { \rho } } ^ { w } ) \stackrel { d e f } { = } \{ ( s , a ) \mapsto \langle \phi ( s , a ) , w \rangle \mid \| w \| _ { 2 } \leq \rho ^ { w } \} ,
89
+ $$
90
+
91
+ ere $\rho ^ { w } \in ( 0 , 1 ]$ is a user-defined radius. For policies, we consider the associated soft-max
92
+
93
+ $$
94
+ \Pi _ { s o f t } ( \rho ^ { \theta } ) \overset { d e f } { = } \left\{ \frac { e ^ { \langle \phi ( s , a ) , \theta \rangle } } { \displaystyle \sum _ { a ^ { \prime } \in \mathcal { A } } e ^ { \langle \phi ( s , a ^ { \prime } ) , \theta \rangle } } \ | \ \| \theta \| _ { 2 } \leq \rho ^ { \theta } \right\} ,
95
+ $$
96
+
97
+ where $\rho ^ { \theta } > 0$ is a second radius.
98
+
99
+ In the context of our actor-critic algorithm, the weight radius other hand, the actor produces a sequence of soft-max radii $\rho ^ { w }$ ins fixed for all updates. O, indexed by the iterations theof $\{ \rho _ { t } ^ { \theta } \} _ { t = 1 } ^ { T }$ $t$ the actor. This sequence is produced via the update rule in Line $\cdot ^ { 5 }$ of Algorithm $\dot { 1 . }$ The policy radius can be large $\rho ^ { \theta } \gg 1$ but we constrain $\rho ^ { w } \leq 1$ so that the critic’s estimate $Q _ { w } ( \overline { { s , } } a ) = \overline { { \langle \phi ( s , a ) , w \rangle } }$ is bounded by one, i.e., $\begin{array} { r } { \operatorname* { s u p } _ { ( s , a , w ) } | Q _ { w } ( s , a ) | \leq 1 } \end{array}$ .
100
+
101
+ Recall that our MDP consists of sequence of $H$ distinct stages. Our algorithm and theory allows for the possibility of different feature extractors at each step $h \in [ H ]$ , even with possibly different dimensions. Consequently, in implementing and analyzing the algorithm, there are actually $H$ (possibly different) functional spaces $\{ \mathcal { Q } _ { h } \} _ { h = 1 } ^ { H }$ , along with the associated soft-max policy classes $\{ \Pi _ { h } \} _ { h = 1 } ^ { H }$ . So as to simplify notation, we drop the dependence on the radii when referring to the functional spaces, and implicitly assume that the terminal value function is zero.
102
+
103
+ # 2.4 A range of function class assumptions
104
+
105
+ In this section, we discuss a range of assumptions that might be imposed on the class of action-value functions. This discussion serves as motivation for the particular assumption (Bellman restricted closedness—cf. Assumption $\textcircled { 3 }$ that underlies our analysis.
106
+
107
+ We begin with the least restrictive condition, which is a very natural starting point in our given set-up. If we seek to find the policy $\pi \in \Pi$ with the highest value function, it seems reasonable to require that the following representation condition (approximately) holds.
108
+
109
+ Assumption 2 (Linear action-value functions $Q ^ { \pi }$ ). The MDP admits a linear action-value function representation for all policies in $\Pi$ , meaning that for each policy $\pi \in \Pi$ and time step $\dot { h } \in [ H ]$ , there exists a vector $w _ { h } ^ { \pi }$ such that
110
+
111
+ $$
112
+ Q _ { h } ^ { \pi } ( s , a ) = \left. \phi _ { h } ( s , a ) , w _ { h } ^ { \pi } \right. .
113
+ $$
114
+
115
+ This assumption alone turns out to be inadequate to ensure that effective learning is possible; indeed, the recent papers Zanette (2020); Weisz et al. (2020) establish that even under this condition, there are instances that require exponentially many samples to do better than a random policy.
116
+
117
+ Given this fact, if one is interested in procedures with polynomial complexity (in both sample size and running time), stronger conditions need to be imposed. In general, the Bellman evaluation operator, even when applied to a linear action-value function, will return a nonlinear value function. The analysis of this paper is based on bounding the Bellman error in the sense of sup-norm deviation from linearity:
118
+
119
+ Assumption 3 (Bellman Restricted Closedness). The policy and value function spaces $( \Pi , \mathcal { Q } )$ are closed up to $\nu \in \mathbb { R } ^ { H }$ error in the sup-norm if there is a non-negative sequence $\{ \bar { \nu } _ { h } \} _ { h = 1 } ^ { H }$ Qsuch that for each $h \in [ H ]$ , we have
120
+
121
+ $$
122
+ \operatorname* { s u p } _ { Q _ { h + 1 } \in \mathcal Q _ { h + 1 } } \operatorname* { i n f } _ { Q _ { h } \in \mathcal Q _ { h } } \| Q _ { h } - \mathcal T _ { h } ^ { \pi _ { h + 1 } } Q _ { h + 1 } \| _ { \infty } \leq \nu _ { h } .
123
+ $$
124
+
125
+ The restricted closedness assumption measures how well we can fit the action-value function resulting from the application of the Bellman evaluation operator to an action value function in $\mathcal { Q }$ and for a policy in $\Pi$ . It enables the analysis of least-squares policy evaluation (e.g., Nedic and ´ Bertsekas (2003)), which will be our starting point when constructing the critic.
126
+
127
+ Finally, for understanding connections to past work, it is relevant to compare to the low-rank MDP assumption that has been analyzed in recent work Jin et al. (2020a); Yang and Wang $\underline { { ( 2 0 2 0 ) } }$ including in offline RL with pessimismistic guarantees Jin et al. (2020b), as well as in various online settings Agarwal et al. (2020a); Modi et al. (2021); Zanette et al. (2020a).
128
+
129
+ Assumption 4 (Low-Rank MDP). An MDP is low-rank if for all $h \in [ H ]$ , there exists a reward parameter $w _ { h } \in \mathbb { R } ^ { d }$ and a component-wise positive mapping $\psi _ { h } : S \to \mathbb { R } _ { + } ^ { d }$ such that $\| \psi _ { h } ( s ) \| _ { 1 } = 1$ for all $s \in S$ , and
130
+
131
+ $$
132
+ \begin{array} { r l r l r } { r _ { h } ( s , a ) = \langle \phi _ { h } ( s , a ) , w _ { h } \rangle , } & { } & { \mathbb { P } _ { h } ( s ^ { \prime } \mid s , a ) = \langle \phi _ { h } ( s , a ) , \psi _ { h } ( s ^ { \prime } ) \rangle , } & { } & { \forall ( s , a , h , s ^ { \prime } ) . } \end{array}
133
+ $$
134
+
135
+ The following proposition explicates the nested relationship between these three conditions, showing that the low-rank MDP condition is the most restrictive:
136
+
137
+ Proposition 1 (Low Rank $\subset$ Restricted Closedness $\subset$ Linear $Q ^ { \pi }$ ). For any fixed state-action space, horizon, and feature extractor:
138
+
139
+ (a) The class of low-rank MDPs is a strict subset of the class of MDPs that satisfy Bellman restricted closedness.
140
+ (b) The class of MDPs that satisfy Bellman restricted closedness is a strict subset of the linear Q⇡ MDP class.
141
+
142
+ See Appendix C for the proof of this claim.
143
+
144
+ Based on Proposition $\bigstar$ we see that any analysis based on assuming Bellman restricted closedness also a fortiori applies to MDPs that satisfy the more stringent low-rank MDP condition.
145
+
146
+ # 3 The Pessimistic Actor-Critic
147
+
148
+ Given the set-up thus far, we are now ready to describe the actor-critic algorithm that we analyze in this paper. We refer to it as the Pessimistic Actor Critic for Learning without Exploration, or PACLE for short. We first describe the critic in Section $\underline { { \boldsymbol { \left. 3 . 1 \right. } } }$ and then the actor in Section 3.2. We summarize the actor and critic algorithms, respectively, in pseudocode form in Algorithm 1 and Algorithm 2.
149
+
150
+ # 3.1 The Critic: Pessimistic Least Square Policy Evaluation
151
+
152
+ The purpose of the critic is to provide pessimistic value function estimates corresponding to the policy $\pi$ under consideration by the actor. Monte Carlo with importance sampling (IS) is not desirable in this setting, as the policy or distribution that generated the dataset might be unknown and estimation errors on the distribution can accumulate exponentially with the horizon in IS estimators (see e.g. Liu et al. $\textcircled { 2 0 1 8 6 } )$ . Instead, we use a least-squares temporal difference method for policy evaluation, but suitably perturbed to return pessimistic estimates—i.e., lower bounds on the true value function of the given policy $\pi$ . Our method is based on directly perturbing the regression parameters in the least-square estimate. In contrast to bonus-based approaches, this method has the important advantage of ensuring that the action-value function remains linear. The purpose of the perturbations is to compensate for possible statistical errors in estimating the regression parameter due to poor coverage of the given dataset.
153
+
154
+ Let us now give a precise description of the critic. Given a policy $\pi = ( \pi _ { 1 } , \ldots , \pi _ { H } )$ , the goal of the critic is to minimize the quantity
155
+
156
+ $$
157
+ \operatorname { \mathbb { E } } _ { A ^ { \prime } \sim \pi _ { 1 } } \left. \phi ( s _ { 1 } , A ^ { \prime } ) , w _ { 1 } \right. = \sum _ { a \in { \mathcal { A } } } \pi _ { 1 } ( a \mid s _ { 1 } ) \left. \phi _ { 1 } ( s _ { 1 } , a ) , w _ { 1 } \right. ,
158
+ $$
159
+
160
+ which is an estimate of the value function $V ^ { \pi } ( s _ { 1 } )$ for the policy $\pi$ at the initial state $s _ { 1 }$ . The parameter $\boldsymbol { w } _ { 1 } ~ \in ~ \mathbb { R } ^ { d }$ is a vector to be adjusted, one that is determined by a backwards-running sequence of regression problems from $h = H$ down to $h = 1$ .
161
+
162
+ We introduce the pessimistic perturbations directly to the solution of these regression problems. They involve a norm defined by the cumulative covariance matrix. Recall that $\mathcal { T } _ { h }$ indexes the subset of observations associated with state-action pairs at time step $h$ . For each $h \in [ H ]$ and $i \in \mathcal { T } _ { h }$ , let us write the associated sample as the quadruple $\left( { { s _ { h i } } , { a _ { h i } } , { r _ { h i } } , { s _ { h + 1 , i } } } \right)$ . Introducing the shorthand notation $\phi _ { h i } = \phi _ { h } ( s _ { h i } , a _ { h i } )$ , we define the cumulative covariance matrix
163
+
164
+ $$
165
+ { \Sigma } _ { h } \overset { d e f } { = } \Big ( \sum _ { i \in \mathbb { Z } _ { h } } \phi _ { h i } \phi _ { h i } ^ { \top } \Big ) + I _ { d \times d } ,
166
+ $$
167
+
168
+ where $I _ { d \times d }$ denotes the $d$ -dimensional identity matrix. Notice that the cumulative covariance grows as the number of samples in $\mathcal { T } _ { h }$ increases; we do not normalize it by the local sample size $n _ { h } = | \mathcal { T } _ { h } |$ , so that $\Sigma _ { h }$ effectively represents the amount of information contained in the sub-dataset $\mathcal { D } _ { h }$ at time step $h$ .
169
+
170
+ Since $\Sigma _ { h }$ is strictly positive definite by construction, it defines a pair of norms
171
+
172
+ $$
173
+ \begin{array} { r } { \left\| u \right\| _ { \Sigma _ { h } } \overset { d e f } { = } \sqrt { u ^ { \top } \Sigma _ { h } u } , \quad \mathrm { a n d } \quad \left\| u \right\| _ { \Sigma _ { h } ^ { - 1 } } \overset { d e f } { = } \sqrt { u ^ { \top } ( \Sigma _ { h } ) ^ { - 1 } u } . } \end{array}
174
+ $$
175
+
176
+ Consider the regression problem that is solved in moving backward from time step $h + 1$ to $h$ . Given the weight vector $w _ { h + 1 }$ at time step $h + 1$ , the regularized least-squares estimate of $w _ { h }$ is given by
177
+
178
+ $$
179
+ \widehat { w } _ { h } \overset { d e f } { = } \Sigma _ { h } ^ { - 1 } \sum _ { k \in \mathbb { Z } _ { h } } \phi _ { h k } \Bigl [ r _ { h k } + \sum _ { a \in \mathcal { A } } \pi _ { h + 1 } ( a \mid s _ { h + 1 , k } ) \left. \phi _ { h + 1 } ( s _ { h + 1 , k } , a ) , w _ { h + 1 } \right. \Bigr ] .
180
+ $$
181
+
182
+ We introduce pessimism by directly perturbing the weight vectors themselves—that is, we search for weight vector $w _ { h }$ such that $\overline { { w _ { h } } } \overline { { = } } \xi _ { h } + \bar { \widehat { w } } _ { h }$ , where the pessimism vector $\xi _ { h } \in \mathbb { R } ^ { d }$ satisfies a bound of the form $\| \xi _ { h } \| _ { \Sigma _ { h } } \le \alpha _ { h }$ , for a user-defined parameter $\alpha _ { h }$ .
183
+
184
+ In detail, the critic takes as input the dataset $\mathcal { D }$ , a policy $\pi$ , a sequence of tolerance parameters $\alpha = ( \alpha _ { 1 } , \ldots , \alpha _ { H } )$ , weight radii $\rho ^ { w } = ( \rho _ { 1 } ^ { w } , \dots , \rho _ { H } ^ { w } )$ with each $\rho _ { h } ^ { w } ~ \in ~ ( 0 , 1 ]$ . The optimization variables consist of the regression vectors $w = ( w _ { 1 } , \dots , w _ { H } ) \in ( { \mathbb { R } } ^ { d } ) ^ { H }$ and the pessimism vectors $\xi = ( \xi _ { 1 } , \dots , \xi _ { H } ) \in ( { \mathbb { R } } ^ { d } ) ^ { H }$ . The critic then solves the convex program
185
+
186
+ $$
187
+ \left( \xi ^ { \pi } , \underline { { \upsilon } } ^ { \pi } \right) \overset { d e f } { = } \arg \operatorname* { m i n } _ { \xi \in ( \mathbb { R } ^ { d } ) ^ { H } } \sum _ { a \in \mathcal { A } } \pi _ { 1 } ( a { | } s _ { 1 } ) { \langle } \phi _ { 1 } ( s _ { 1 } , a ) , w _ { 1 } \rangle
188
+ $$
189
+
190
+ with the terminal condition $w _ { H + 1 } = 0$ , and subject to the constraints
191
+
192
+ $$
193
+ w _ { h } = \xi _ { h } + \Sigma _ { h } ^ { - 1 } \sum _ { k \in \mathcal { Z } _ { h } } \phi _ { h k } \left[ r _ { h k } + \sum _ { a \in \mathcal { A } } \pi _ { h + 1 } ( a \mid s _ { h + 1 , k } ) \left. \phi _ { h + 1 } { \left( s _ { h + 1 , k } , a \right) } , w _ { h + 1 } \right. \right] ,
194
+ $$
195
+
196
+ and
197
+
198
+ $$
199
+ \| \xi _ { h } \| _ { \Sigma _ { h } } ^ { 2 } \le \alpha _ { h } ^ { 2 } , \qquad \| w _ { h } \| _ { 2 } ^ { 2 } \le ( \rho _ { h } ^ { w } ) ^ { 2 }
200
+ $$
201
+
202
+ for all $h \in [ H ]$ . Here the matrices $\Sigma _ { h }$ were previously defined in equation $( 8 )$ .
203
+
204
+ The convex program $\textcircled { 1 0 }$ consists of a linear objective subject to quadratic constraints; it is a special case of a second order cone program, and can be efficiently solved with standard convex solvers.
205
+
206
+ # Algorithm 1 ACTOR (MIRROR DESCENT)
207
+
208
+ 1: Input: Dataset $\mathcal { D }$ , starting state $s _ { 1 }$
209
+ learning rate $\eta$
210
+ 2: Set $\theta _ { 1 } = ( \vec { 0 } , \ldots , \vec { 0 } )$
211
+ 3: for $t = 1 , 2 , \dots , T$ do
212
+ 4: $\underline { { w } } _ { t } \gets \mathrm { C R I T I C } ( \mathcal { D } , \pi _ { \theta _ { t } } , s _ { 1 } )$
213
+ 5: $\theta _ { t + 1 } = \theta _ { t } + \eta \underline { { w } } _ { t }$
214
+ 6: end for
215
+ 7: Return: Mixture policy ⇡✓1 , . . . , ⇡✓T
216
+
217
+ <table><tr><td>Algorithm2 CRITIC (PLSPE)</td></tr><tr><td>1: Input: Dataset D, target policy π, start- ing state S1, critic radii {ph}h=1,.., H,</td></tr><tr><td>and parameters {αh}h=1..., H</td></tr><tr><td>2:Solve the optimization program 1 3: Return: Optimal weight vector w</td></tr><tr><td></td></tr></table>
218
+
219
+ # 3.2 The Actor: Mirror Descent
220
+
221
+ We now turn to the behavior of the actor. It applies the mirror descent algorithm based on the Kullback Leibler (KL) divergence Bubeck (2014) This combination leads to the exponentiated gradient update rule in every timestep $\overline { { h \in [ H ] } }$ , so that the soft-max policy in moving from iteration $t$ to $t + 1$ is updated as
222
+
223
+ $$
224
+ \pi _ { t + 1 , h } ( a \mid s ) \propto \pi _ { t , h } ( a \mid s ) e ^ { \eta Q _ { h } ( s , a ) } \qquad \mathrm { f o r } \operatorname { e a c h } \left( s , a \right) \in \mathcal { S } \times \mathcal { A } .
225
+ $$
226
+
227
+ Here $\eta > 0$ is a stepsize parameter, and our theory specifies a suitable choice.
228
+
229
+ If the $Q$ -value above from the critic lives in $\mathcal { Q }$ , then it is possible to show that $\pi _ { t + 1 , h } \in \Pi _ { h }$ and the update rule takes a much simpler and computationally more efficient form (cf. Line $^ { 5 } .$ of Algorithm 1), where $w _ { t }$ is the gradient of the value function on the pessimistic MDP implicitly identified by the critic. In this case, the spaces $( \mathcal { Q } , \Pi )$ are said to be compatible Sutton et al. (1999) ; Kakade (2001); Agarwal et al. (2020b); Raskutti and Mukherjee (2015) and the resulting algorithm is often called the Natural Policy Gradient (NPG) (see also Geist et al. $\textcircled { 1 2 0 1 9 }$ ; Shani et al. $\textcircled{2 0 2 0 } )$ By construction, the critic maintains a linear action value function even after pessimistic perturbations. As a consequence, the actor policy space is the simple softmax policy class $\Pi$ and the easier update rule can be used. As we explain in the analysis, this has important statistical benefits.
230
+
231
+ After $T$ rounds of updates, the mirror descent algorithm that we use here readily achieves online regret rates (in the optimization setting with exact feedback) $\sim 1 / T$ or $\sim 1 / \sqrt { T }$ depending on the analysis Agarwal et al. $\left( \overline { { 2 0 2 0 } } \mathrm { b } \right)$ and the learning rate, although we mention that these rates could potentially be improved Khodadadian et al. (2021); Lan (2021); Bhandari and Russo $\underline { { \left. 2 0 2 0 \right. } }$ .
232
+
233
+ # 4 Main results
234
+
235
+ We now turn to the statement of a bound on the performance of the policy $\pi _ { \mathrm { A L G } }$ returned by PACLE. This upper bound involves three terms: an optimization error, an uncertainty term, and a model mis-specification term. The optimization error is given by $\textstyle { \mathcal { C } } ( T ) { \overset { d e f } { = } } 4 H { \sqrt { \frac { \log | A | } { T } } }$ log |A|T ; it captures the rate at which the error decreases as a function of the iterations of the actor. The mis-specification error $\begin{array} { r } { \mathcal { E } _ { \mathrm { m s p } } ( \nu ) \overset { d e f } { = } \sum _ { h = 1 } ^ { H } \nu _ { h } } \end{array}$ is simply the sum of all the stage-wise mis-specification errors; notice h=1 that the mis-specification error does depend on the choice of the radii for the critic $\rho _ { 1 } ^ { w } , \ldots , \rho _ { H } ^ { w }$ in a problem dependent way (cf. Assumption $\bigstar \bigstar \bigstar$ Finally, for each h, define the vector ¯⇡h def= $\mathbb { E } _ { ( S _ { h } , A _ { h } ) \sim \pi } [ \phi _ { h } ( S _ { h } , A _ { h } ) ]$ , where the expectation is over the state-action $\left( S _ { h } , A _ { h } \right)$ encountered at timestep $h$ upon following policy $\pi$ . In terms of these vectors, the uncertainty error is given by
236
+
237
+ $$
238
+ \mathcal { U } ( \pi ; \alpha ) \overset { d e f } { = } 2 \sum _ { h = 1 } ^ { H } \alpha _ { h } \| \bar { \phi } _ { h } ^ { \pi } \| _ { \Sigma _ { h } ^ { - 1 } } = 2 \sum _ { h = 1 } ^ { H } \alpha _ { h } \sqrt { ( \bar { \phi } _ { h } ^ { \pi } ) ^ { \top } \Sigma _ { h } ^ { - 1 } \bar { \phi } _ { h } ^ { \pi } } ,
239
+ $$
240
+
241
+ where the cumulative covariance matrix $\Sigma _ { h }$ was defined in equation $( 8 )$ .
242
+
243
+ D the sequence of cumulative covariance matrices The amount of information from the dataset $\mathcal { D }$ is fully encoded in the uncertainty function $\{ \Sigma _ { h } \} _ { h = 1 } ^ { H }$ and parameters $\{ \alpha _ { h } \} _ { h = 1 } ^ { H }$ U . The more data $\boldsymbol { \mathcal { U } }$ through are available, the more positive definite $\Sigma _ { h }$ is and the smaller the uncertainty function $\mathcal { U } ( \pi ; \alpha )$ becomes for a fixed policy $\pi$ . If the sampling distribution that generates the dataset is fixed, then we can write $\mathcal { U } ( \pi ; \boldsymbol { \alpha } ) \lessapprox \boldsymbol { c } / \bar { \sqrt { n } }$ where $c$ does not depend on $n$ and can be interpreted as the coverage of the sampling distribution with respect to policy $\pi$ .
244
+
245
+ # 4.1 A guarantee for PACLE
246
+
247
+ Our main result holds under Assumption $\perp$ on the data collection process. It is based on radii $\{ \rho _ { h } ^ { w } \} _ { h = 1 } ^ { H }$ for the action value function3 that lie in the interval $( 0 , 1 ]$ , and it provides a guarantee relative to the class $\Pi _ { \mathrm { a l l } }$ of all stochastic policies.
248
+
249
+ Theorem 1 (An achievable guarantee). Suppose that we are given a data set $\mathcal { D }$ collected in a way that respects Assumption 1. Then there are pessimism vectors bounded as $\alpha _ { h } = { \widetilde O } ( \sqrt { d \log ( 1 / \delta ) } ) \dot { + }$ $\nu _ { h } \sqrt { n _ { h } }$ such that, after running $T \geq \log | { \mathcal { A } } |$ rounds of the actor with stepsize $\begin{array} { r } { \eta = \sqrt { \frac { \log | \mathcal { A } | } { T } } } \end{array}$ log |A| , the PACLE procedure returns a policy $\pi _ { \mathrm { A L G } }$ for which
250
+
251
+ $$
252
+ V _ { 1 } ^ { \pi } ( s _ { 1 } ) - V _ { 1 } ^ { \pi _ { \mathrm { A z e } } } ( s _ { 1 } ) \leq \mathcal { U } ( \pi ; \alpha ) + \underbrace { \sum _ { h = 1 } ^ { H } \nu _ { h } } _ { \mathcal { E } _ { m s p } ( \nu ) } + \underbrace { 4 H \sqrt { \frac { \log | A | } { T } } } _ { \mathcal { C } ( T ) } \qquad u n i f o r m l y o v e r a l l \pi \in \Pi _ { a l l } \nonumber
253
+ $$
254
+
255
+ with probability exceeding $1 - \delta$ .
256
+
257
+ The result provides a family of upper bounds on the sub-optimality of the learned policy $\pi _ { \mathrm { A L G } }$ , indexed by the choice of comparator policy $\pi$ , and embodies a tradeoff between the sub-optimality of the comparator $\pi$ and its uncertainty $\mathcal { U } ( \pi ; \alpha )$ . Note that the optimization error $\mathcal { C } ( T )$ can be reduced arbitrarily, while $\alpha$ (and thus $\mathcal { U } ( \pi ; \alpha ) ,$ ) increase only logarithmically with $T$ . As a special case, if we set $\pi = \pi ^ { \star }$ and assume that there is no mis-specification error, then we obtain that the learned policy satisfies a bound of the form
258
+
259
+ $$
260
+ V _ { 1 } ^ { \pi ^ { \star } } ( s _ { 1 } ) - V _ { 1 } ^ { \pi _ { \mathrm { A L G } } } ( s _ { 1 } ) \leq \mathcal { U } ( \pi ^ { \star } ; \alpha ) + \mathcal { C } ( T )
261
+ $$
262
+
263
+ with probability at least $1 - \delta$ . Since $\mathcal { C } ( T )$ is well-controlled, this guarantee is satisfied whenever the uncertainty term $\mathcal { U } ( \pi ^ { \star } ; \alpha )$ is small.
264
+
265
+ More generally, the guarantee $( 1 3 )$ is significantly stronger than most prior work as PACLE competes not just with the optimal policy $\pi ^ { \star }$ , but with all comparator policies simultaneously. Such comparator policies need not necessarily be in the prescribed policy class $\Pi$ . To highlight the strength of this generality, suppose that the uncertainty $\mathcal { U } ( \pi ^ { \star } ; \alpha )$ of the optimal $\pi ^ { \star }$ is not small—it could in fact be infinite. In this case, the bound $( 1 4 )$ would not be useful.
266
+
267
+ However, suppose that there exists a near-optimal policy—meaning a policy $\pi ^ { + }$ such that ${ V _ { 1 } ^ { \pi ^ { + } } ( s _ { 1 } ) ~ \geq ~ \widetilde { V } _ { 1 } ^ { \star } ( s _ { 1 } ) - \epsilon }$ for some small $\epsilon$ —that is well-covered by the dataset (i.e., for which $\mathcal { U } ( \pi ^ { + } ; \boldsymbol { \alpha } ) \approx 0 )$ ). In this case, Theorem 1 ensures with high probability $V _ { 1 } ^ { \mathrm { A L G } } ( s _ { 1 } ) \gtrsim V _ { 1 } ^ { \star } ( s _ { 1 } ) - \epsilon$ . In contrast, traditional analyses that use only the optimal policy $\pi ^ { \star }$ as a comparator—as opposed to also allowing near-optimal policies—cannot return meaningful guarantees. We note also that the papers Yu et al. $\underline { { \widehat { ( 2 0 2 0 ) } } }$ ; Liu et al. $\underline { { \left\{ 2 0 2 0 \right\} } }$ ; Kidambi et al. (2020) provide results of a similar flavor. These types of guarantees are also provided by some concurrent works Uehara and Sun (2021); Xie et al. (2021)
268
+
269
+ It should alscritic’s radii $\{ \rho _ { h } ^ { w } \} _ { h = 1 } ^ { H }$ d that Theorem. This choice is $\bigstar$ provides a family of results indexed by the choice of the modeling decision: increasing the radii increases both the approximation power of the function class $\mathcal { Q } _ { h }$ used for regression, but also increases the complexity of the function class $\mathcal { Q } _ { h + 1 }$ to represent (cf. Assumption $\bar { 3 } )$ ; thus, the choice of the radii affects the approximation error $\mathcal { E } _ { \mathrm { m s p } } ( \nu )$ in a problem dependent way.
270
+
271
+ # 4.2 A lower bound
272
+
273
+ Thus far, we have stated an upper bound on the quality of the returned policy for a given procedure. Central to this upper bound is the uncertainty function $\mathcal { U } ( \pi ; \alpha )$ . In this section, we show that a term of this form is unavoidable for any procedure. In particular, working within the well-specified setting, we prove a lower bound in terms of the quantity $\begin{array} { r } { \mathcal { U } ( \pi ; \sqrt { d } ) = \sqrt { d } \dot { \sum } _ { h = 1 } ^ { H } \| \bar { \phi } _ { h } ^ { \pi } \| _ { { \Sigma } _ { h } ^ { - 1 } } } \end{array}$ . Recalling that our choice of $\alpha$ scales with $\sqrt { d }$ (along with other logarithmic factors), this lower bound shows that our result is tight up to logarithmic factors.
274
+
275
+ We show that the lower bound actually holds in a setting that is easier for the learner, in the sense that (1) we restrict to low-rank MDPs, where there is no mis-specification error; and (2) the mechanism that generates the dataset is non-adaptive, and so certainly satisfies Assumption 1.
276
+
277
+ Theorem 2 (Information-theoretic lower bound). For a given horizon $H$ and dimension $d$ , consider a sample size $n \geq 2 d ^ { 3 } H ^ { 3 }$ . There is a class $\mathcal { M }$ of low-rank MDPs and a data generating procedure satisfying Assumption 1 such that for any policy $\widehat { \pi } _ { \mathrm { A L G } }$ , we have
278
+
279
+ $$
280
+ \operatorname* { s u p } _ { M \in \mathcal { M } } \mathbb { E } _ { M } \left[ V _ { 1 M } ^ { \pi } ( s _ { 1 } ) - V _ { 1 M } ^ { \pi _ { \mathrm { A t o } } } ( s _ { 1 } ) \right] \geq c \mathcal { U } ( \pi ; \sqrt { d } ) \qquad \mathit { u n i f o r m l y o v e r a l l } \pi \in \Pi _ { a l l } ,
281
+ $$
282
+
283
+ where $c > 0$ is a universal constant.
284
+
285
+ When $H = 1$ the above result gives a sample complexity lower bound for learning a near optimal policy from batch data in a linear bandit instance.
286
+
287
+ # 4.3 Comparison to related work
288
+
289
+ Theorem $^ 1$ automatically implies the typical bound $\mathbb { P } [ V _ { 1 } ^ { \pi _ { \mathrm { A L G } } } ( s _ { 1 } ) \geq V _ { 1 } ^ { \star } ( s _ { 1 } ) - \mathcal { U } ( \pi ^ { \star } ; \alpha ) ] \geq 1 - \delta$ when the comparator policy is the optimal policy $\pi ^ { \star }$ , e.g., Jin et al. (2020b) Rashidinejad et al. $\textcircled { 2 0 2 1 }$ ; Kidambi et al. $\dot { ( 2 0 2 0 ) }$ ; Kumar et al. $\overbrace { ( 2 0 1 9 ) }$ ; Buckman et al. (2020). The guarantee can be written as $\overline { { V _ { 1 } ^ { \mathrm { \tiny ~ A L G } } ( s _ { 1 } ) } } \stackrel { \textstyle > } { \sim } V _ { 1 } ^ { \star } ( s _ { 1 } ) - C / \sqrt { n }$ where $n$ is the number of samples and $C$ is the (scaled) condition number of $\Sigma _ { h } ^ { - 1 }$ . One could interpret $C$ as a concentrability coefficient that expresses the coverage of dataset—through $\Sigma _ { h }$ —with respect to the average direction in feature space $\mathbb { \bar { E } } _ { ( S _ { h } , A _ { h } ) \sim \pi _ { h } ^ { \star } } [ \phi ( S _ { h } , A _ { h } ) ]$ of the optimal policy $\pi ^ { \star }$ . As in the paper Jin et al. $\boxed { 2 0 2 0 6 }$ , such a factor can be small even when traditional concentrability coefficients are large because they depend on state-action visit ratios (see the literature in Appendix B, e.g., Chen and Jiang (2019))
290
+
291
+ With reference to the results in the paper Jin et al. $\textcircled { 2 0 2 0 6 }$ , our work provides improvements in two distinct ways. First, their upper and lower bounds exhibit a gap of the order $d H$ , which our analysis closes. Second, our analysis holds under the more permissive Assumption 3 (Bellman Restricted Closedness) which includes low-rank MDPs. Of this improvement, a factor of $\sqrt { d }$ is due to the algorithm that we use, and the remainder is due to a more refined construction to certify optimality in Theorem 2. To be clear, our upper and lower bounds differ from theirs by a factor of $H$ due to a different normalization in the value function). We also note that the result of Liu et al.Liu et al.
292
+
293
+ $\textcircled { 2 0 2 0 }$ can be specialized to the low-rank MDP setting; however, even in this simpler setting, the results would be sub-optimal and also require additional density estimates.
294
+
295
+ Deriving a computationally tractable model-free algorithm without low-rank dynamics but subject to value function perturbations (e.g., optimistic or pessimistic perturbations) is an open problem even in the more heavily studied online exploration setting: there the current state-of-the art Zanette et al. (2020b); Jin et al. (2021); Du et al. (2021); Jiang et al. (2017) only present computationally intractable algorithms with the exception of Zanette et al. (2020c) for a PAC setting with low inherent Bellman error which however requires an additional “explorability” condition. Due to space constraints, the proof outline is deferred to Appendix A.
296
+
297
+ # 5 Discussion
298
+
299
+ In this paper, we have developed and analyzed an actor-critic method procedure, designed for finding near-optimal policies in the offline setting. The PACLE procedure introduces pessimism into the critic’s evaluation of a given policy’s value function, thereby ensuring that, under suitable parameter choices and assumptions, it maintains (with high probability) a lower bound on the true value function. The actor then performs a form of mirror ascent so as to maximize the value of these lower bounds.
300
+
301
+ An important feature of our method is that it introduces pessimism via direct perturbations of the parameter vectors in a linear function approximation scheme. In this way, we avoid having to impose additional model assumptions; moreover, the pessimism does not substantially increase the complexity of our under value/policy classes, which allows us to provide minimax-optimal guarantees. We note that similar approaches have appeared before in the exploration setting; for example, see the recent papers Zanette et al. (2020b) Jin et al. (2021) Du et al. (2021). These methods enjoy similar advantages in terms of theoretical guarantees, but at the expense of computational tractability. In contrast, the method of this paper entails solving a low-dimensional second-order cone program, a simple class of convex programs for which there exist many polynomial-time algorithms. We enjoy this advantage due to some key differences between the offline and online settings of RL. In the offline setting, it is possible to keep the actor’s update cleanly separated from the evaluation step of the critic, as we have done here; this separation underlies the computational tractability.
302
+
303
+ Our work leaves open a number of interesting questions for future work. First, it would be interesting to provide some numerical studies of the PACLE’s performance, so as to understand its practical behavior relative to the theoretical guarantees provided here. Also, our analysis here has focused purely on approximation using linear basis expansions; extension to more general function classes is an important next step. Finally, it will be interesting to see to what extent these ideas can be translated to the more challenging setting of exploration.
304
+
305
+ # Acknowledgements
306
+
307
+ This work was partially supported by NSF-DMS grant 2015454, NSF-IIS grant 1909365, and NSFFODSI grant 2023505 to MJW, a Stanford Artificial Intelligence Laboratory Toyota gift to EB, and a Office of Naval Research grant DOD-ONR-N00014-18-1-2640 to MJW.
308
+
309
+ # References
310
+
311
+ Abbasi-Yadkori, Y., Pal, D., and Szepesvari, C. (2011). Improved algorithms for linear stochastic bandits. In Advances in Neural Information Processing Systems (NIPS). Agarwal, A., Kakade, S., Krishnamurthy, A., and Sun, W. (2020a). Flambe: Structural complexity and representation learning of low rank mdps. arXiv preprint arXiv:2006.10814. Agarwal, A., Kakade, S. M., Lee, J. D., and Mahajan, G. (2020b). Optimality and approximation with policy gradient methods in markov decision processes. In Conference on Learning Theory, pages 64–66. Agarwal, R., Schuurmans, D., and Norouzi, M. (2020c). An optimistic perspective on offline reinforcement learning. In International Conference on Machine Learning, pages 104–114. PMLR.
312
+
313
+ Antos, A., Munos, R., and Szepesvári, C. (2007). Fitted q-iteration in continuous action-space mdps.
314
+ Antos, A., Szepesvári, C., and Munos, R. (2008). Learning near-optimal policies with bellmanresidual minimization based fitted policy iteration and a single sample path. Machine Learning, 71(1):89–129.
315
+ Bertsekas, D. P. (1995). Dynamic programming and stochastic control, volume 1. Athena Scientific, Belmont, MA.
316
+ Bertsekas, D. P. and Tsitsiklis, J. N. (1996). Neuro-dynamic programming. Athena Scientific.
317
+ Bhandari, J. and Russo, D. (2020). A note on the linear convergence of policy gradient methods. arXiv preprint arXiv:2007.11120.
318
+ Bubeck, S. (2014). Convex optimization: Algorithms and complexity. arXiv preprint arXiv:1405.4980.
319
+ Buckman, J., Gelada, C., and Bellemare, M. G. (2020). The importance of pessimism in fixeddataset policy optimization. arXiv preprint arXiv:2009.06799.
320
+ Chen, J. and Jiang, N. (2019). Information-theoretic considerations in batch reinforcement learning. In International Conference on Machine Learning, pages 1042–1051.
321
+ de la Pena, V. H., Lai, T. L., and Shao, Q. M. (2009). Self-normalized processes. Springer.
322
+ Du, S. S., Kakade, S. M., Lee, J. D., Lovett, S., Mahajan, G., Sun, W., and Wang, R. (2021). Bilinear classes: A structural framework for provable generalization in rl. arXiv preprint arXiv:2103.10897.
323
+ Duan, Y., Jin, C., and Li, Z. (2021). Risk bounds and rademacher complexity in batch reinforcement learning. arXiv preprint arXiv:2103.13883.
324
+ Duan, Y. and Wang, M. (2020). Minimax-optimal off-policy evaluation with linear function approximation. arXiv preprint arXiv:2002.09516.
325
+ Fan, J., Wang, Z., Xie, Y., and Yang, Z. (2020). A theoretical analysis of deep q-learning. In Learning for Dynamics and Control, pages 486–489. PMLR.
326
+ Farahmand, A.-m., Ghavamzadeh, M., Szepesvári, C., and Mannor, S. (2016). Regularized policy iteration with nonparametric function spaces. The Journal of Machine Learning Research, 17(1):4809–4874.
327
+ Farahmand, A.-m., Szepesvári, C., and Munos, R. (2010). Error propagation for approximate policy and value iteration. In Advances in Neural Information Processing Systems (NIPS).
328
+ Farajtabar, M., Chow, Y., and Ghavamzadeh, M. (2018). More robust doubly robust off-policy evaluation. In International Conference on Machine Learning, pages 1447–1456. PMLR.
329
+ Fu, Z., Yang, Z., and Wang, Z. (2020). Single-timescale actor-critic provably finds globally optimal policy. arXiv preprint arXiv:2008.00483.
330
+ Geist, M., Scherrer, B., and Pietquin, O. (2019). A theory of regularized markov decision processes. In International Conference on Machine Learning, pages 2160–2169. PMLR.
331
+ Haarnoja, T., Tang, H., Abbeel, P., and Levine, S. (2017). Reinforcement learning with deep energybased policies. In International Conference on Machine Learning, pages 1352–1361. PMLR.
332
+ Haarnoja, T., Zhou, A., Abbeel, P., and Levine, S. (2018). Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor.
333
+ Hao, B., Ji, X., Duan, Y., Lu, H., Szepesvári, C., and Wang, M. (2021). Bootstrapping statistical inference for off-policy evaluation. arXiv preprint arXiv:2102.03607.
334
+ Heess, N., Wayne, G., Silver, D., Lillicrap, T., Tassa, Y., and Erez, T. (2015). Learning continuous control policies by stochastic value gradients.
335
+ Jaques, N., Ghandeharioun, A., Shen, J. H., Ferguson, C., Lapedriza, A., Jones, N., Gu, S., and Picard, R. (2019). Way off-policy batch deep reinforcement learning of implicit human preferences in dialog. arXiv preprint arXiv:1907.00456.
336
+ Jiang, N. and Huang, J. (2020). Minimax value interval for off-policy evaluation and policy optimization. arXiv preprint arXiv:2002.02081.
337
+ Jiang, N., Krishnamurthy, A., Agarwal, A., Langford, J., and Schapire, R. E. (2017). Contextual decision processes with low Bellman rank are PAC-learnable. In Precup, D. and Teh, Y. W., editors, International Conference on Machine Learning (ICML), volume 70 of Proceedings of Machine Learning Research, pages 1704–1713, International Convention Centre, Sydney, Australia. PMLR.
338
+ Jiang, N. and Li, L. (2016). Doubly robust off-policy value evaluation for reinforcement learning. In International Conference on Machine Learning, pages 652–661. PMLR.
339
+ Jin, C., Liu, Q., and Miryoosefi, S. (2021). Bellman eluder dimension: New rich classes of rl problems, and sample-efficient algorithms. arXiv preprint arXiv:2102.00815.
340
+ Jin, C., Yang, Z., Wang, Z., and Jordan, M. I. (2020a). Provably efficient reinforcement learning with linear function approximation. In Conference on Learning Theory.
341
+ Jin, Y., Yang, Z., and Wang, Z. (2020b). Is pessimism provably efficient for offline rl? arXiv preprint arXiv:2012.15085.
342
+ Kakade, S. M. (2001). A natural policy gradient. Advances in neural information processing systems, 14.
343
+ Kakade, S. M. et al. (2003). On the sample complexity of reinforcement learning. PhD thesis, University of London London, England.
344
+ Kallus, N. and Uehara, M. (2019). Efficiently breaking the curse of horizon in off-policy evaluation with double reinforcement learning. arXiv preprint arXiv:1909.05850.
345
+ Khodadadian, S., Jhunjhunwala, P. R., Varma, S. M., and Maguluri, S. T. (2021). On the linear convergence of natural policy gradient algorithm. arXiv preprint arXiv:2105.01424.
346
+ Kidambi, R., Rajeswaran, A., Netrapalli, P., and Joachims, T. (2020). Morel: Model-based offline reinforcement learning. arXiv preprint arXiv:2005.05951.
347
+ Konda, V. R. and Tsitsiklis, J. N. (2000). Actor-critic algorithms. In Advances in neural information processing systems, pages 1008–1014.
348
+ Konda, V. R. and Tsitsiklis, J. N. (2003). On actor-critic algorithms. SIAM Jour. Opt. Control, 42(4):1143–1166.
349
+ Kumar, A., Fu, J., Tucker, G., and Levine, S. (2019). Stabilizing off-policy q-learning via bootstrapping error reduction. arXiv preprint arXiv:1906.00949.
350
+ Kumar, A., Zhou, A., Tucker, G., and Levine, S. (2020). Conservative q-learning for offline reinforcement learning. arXiv preprint arXiv:2006.04779.
351
+ Lan, G. (2021). Policy mirror descent for reinforcement learning: Linear convergence, new sampling complexity, and generalized problem classes. arXiv preprint arXiv:2102.00135.
352
+ Laroche, R., Trichelair, P., and Des Combes, R. T. (2019). Safe policy improvement with baseline bootstrapping. In International Conference on Machine Learning, pages 3652–3661. PMLR.
353
+ Levine, S., Kumar, A., Tucker, G., and Fu, J. (2020). Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643.
354
+ Liao, P., Qi, Z., and Murphy, S. (2020). Batch policy learning in average reward markov decision processes. arXiv preprint arXiv:2007.11771.
355
+ Liu, Q., Li, L., Tang, Z., and Zhou, D. (2018a). Breaking the curse of horizon: Infinite-horizon off-policy estimation. In Advances in Neural Information Processing Systems, pages 5356–5366.
356
+ Liu, Y., Gottesman, O., Raghu, A., Komorowski, M., Faisal, A. A., Doshi-Velez, F., and Brunskill, E. (2018b). Representation balancing mdps for off-policy policy evaluation. Advances in Neural Information Processing Systems, 31:2644–2653.
357
+ Liu, Y., Swaminathan, A., Agarwal, A., and Brunskill, E. (2020). Provably good batch reinforcement learning without great exploration. arXiv preprint arXiv:2007.08202.
358
+ Mandel, T., Liu, Y.-E., Levine, S., Brunskill, E., and Popovic, Z. (2014). Offline policy evaluation across representations with applications to educational games. In AAMAS, volume 1077.
359
+ Modi, A., Chen, J., Krishnamurthy, A., Jiang, N., and Agarwal, A. (2021). Model-free representation learning and exploration in low-rank mdps. arXiv preprint arXiv:2102.07035.
360
+ Munos, R. (2003). Error bounds for approximate policy iteration. In ICML, volume 3, pages 560– 567.
361
+ Munos, R. (2005). Error bounds for approximate value iteration. In AAAI Conference on Artificial Intelligence (AAAI).
362
+ Nachum, O., Chow, Y., Dai, B., and Li, L. (2019a). Dualdice: Behavior-agnostic estimation of discounted stationary distribution corrections. arXiv preprint arXiv:1906.04733.
363
+ Nachum, O. and Dai, B. (2020). Reinforcement learning via fenchel-rockafellar duality. arXiv preprint arXiv:2001.01866.
364
+ Nachum, O., Dai, B., Kostrikov, I., Chow, Y., Li, L., and Schuurmans, D. (2019b). Algaedice: Policy gradient from arbitrary experience. arXiv preprint arXiv:1912.02074.
365
+ Nair, A., Dalal, M., Gupta, A., and Levine, S. (2020). Accelerating online reinforcement learning with offline datasets. arXiv preprint arXiv:2006.09359.
366
+ Nedic, A. and Bertsekas, D. P. (2003). Least squares policy evaluation algorithms with linear func- ´ tion approximation. Discrete Event Dynamic Systems, 13(1):79–110.
367
+ Puterman, M. L. (1994). Markov Decision Processes: Discrete Stochastic Dynamic Programming. John Wiley & Sons, Inc., New York, NY, USA.
368
+ Rashidinejad, P., Zhu, B., Ma, C., Jiao, J., and Russell, S. (2021). Bridging offline reinforcement learning and imitation learning: A tale of pessimism. arXiv preprint arXiv:2103.12021.
369
+ Raskutti, G. and Mukherjee, S. (2015). The information geometry of mirror descent. IEEE Transactions on Information Theory, 61(3):1451–1457.
370
+ Shani, L., Efroni, Y., and Mannor, S. (2020). Adaptive trust region policy optimization: Global convergence and faster rates for regularized mdps. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 5668–5675.
371
+ Shreve, S. E. and Bertsekas, D. P. (1978). Alternative theoretical frameworks for finite horizon discrete-time stochastic optimal control. SIAM Journal on control and optimization, 16(6):953– 978.
372
+ Siegel, N. Y., Springenberg, J. T., Berkenkamp, F., Abdolmaleki, A., Neunert, M., Lampe, T., Hafner, R., Heess, N., and Riedmiller, M. (2020). Keep doing what worked: Behavioral modelling priors for offline reinforcement learning. arXiv preprint arXiv:2002.08396.
373
+ Sutton, R. S. and Barto, A. G. (2018). Reinforcement Learning: An Introduction. MIT Press, Cambridge, MA, 2nd edition.
374
+ Sutton, R. S., McAllester, D. A., Singh, S. P., Mansour, Y., et al. (1999). Policy gradient methods for reinforcement learning with function approximation. In NIPs, volume 99, pages 1057–1063. Citeseer.
375
+ Tang, Z., Feng, Y., Li, L., Zhou, D., and Liu, Q. (2019). Doubly robust bias reduction in infinite horizon off-policy estimation. arXiv preprint arXiv:1910.07186.
376
+ Thomas, P. and Brunskill, E. (2016). Data-efficient off-policy policy evaluation for reinforcement learning. In International Conference on Machine Learning, pages 2139–2148.
377
+ Thomas, P., Theocharous, G., and Ghavamzadeh, M. (2015). High confidence policy improvement. In International Conference on Machine Learning, pages 2380–2388.
378
+ Thomas, P. S., da Silva, B. C., Barto, A. G., Giguere, S., Brun, Y., and Brunskill, E. (2019). Preventing undesirable behavior of intelligent machines. Science, 366(6468):999–1004.
379
+ Tsybakov, A. B. (2009). Introduction to Nonparametric Estimation. Springer, New York.
380
+ Uehara, M., Huang, J., and Jiang, N. (2020). Minimax weight and q-function learning for off-policy evaluation. In International Conference on Machine Learning, pages 9659–9668. PMLR.
381
+ Uehara, M. and Sun, W. (2021). Pessimistic model-based offline rl: Pac bounds and posterior sampling under partial coverage.
382
+ Voloshin, C., Jiang, N., and Yue, Y. (2021). Minimax model learning. In International Conference on Artificial Intelligence and Statistics, pages 1612–1620. PMLR.
383
+ Wainwright, M. J. (2019). High-dimensional statistics: A non-asymptotic viewpoint, volume 48. Cambridge University Press.
384
+ Wang, L., Cai, Q., Yang, Z., and Wang, Z. (2019). Neural policy gradient methods: Global optimality and rates of convergence. arXiv preprint arXiv:1909.01150.
385
+ Wang, Z., Novikov, A., Zo˙ łna, K., Springenberg, J. T., Reed, S., Shahriari, B., Siegel, N., Merel, J., Gulcehre, C., Heess, N., et al. (2020). Critic regularized regression. arXiv preprint arXiv:2006.15134.
386
+ Weisz, G., Amortila, P., and Szepesvári, C. (2020). Exponential lower bounds for planning in mdps with linearly-realizable optimal action-value functions. arXiv preprint arXiv:2010.01374.
387
+ Wu, Y., Tucker, G., and Nachum, O. (2019). Behavior regularized offline reinforcement learning. arXiv preprint arXiv:1911.11361.
388
+ Wu, Y., Zhai, S., Srivastava, N., Susskind, J., Zhang, J., Salakhutdinov, R., and Goh, H. (2021). Uncertainty weighted actor-critic for offline reinforcement learning. arXiv preprint arXiv:2105.08140.
389
+ Xie, T., Cheng, C.-A., Jiang, N., Mineiro, P., and Agarwal, A. (2021). Bellman-consistent pessimism for offline reinforcement learning.
390
+ Xie, T. and Jiang, N. (2020a). Batch value-function approximation with only realizability. arXiv preprint arXiv:2008.04990.
391
+ Xie, T. and Jiang, N. (2020b). $\mathbf { Q } ^ { * }$ approximation schemes for batch reinforcement learning: A theoretical comparison. volume 124 of Proceedings of Machine Learning Research, pages 550– 559, Virtual. PMLR.
392
+ Xie, T., Ma, Y., and Wang, Y.-X. (2019). Towards optimal off-policy evaluation for reinforcement learning with marginalized importance sampling. In Advances in Neural Information Processing Systems, pages 9668–9678.
393
+ Yang, L. F. and Wang, M. (2020). Reinforcement leaning in feature space: Matrix bandit, kernels, and regret bound. In International Conference on Machine Learning (ICML).
394
+ Yang, M., Nachum, O., Dai, B., Li, L., and Schuurmans, D. (2020). Off-policy evaluation via the regularized lagrangian. arXiv preprint arXiv:2007.03438.
395
+ Yin, M., Bai, Y., and Wang, Y.-X. (2020). Near optimal provable uniform convergence in off-policy evaluation for reinforcement learning. arXiv preprint arXiv:2007.03760.
396
+ Yin, M. and Wang, Y.-X. (2020). Asymptotically efficient off-policy evaluation for tabular reinforcement learning. In International Conference on Artificial Intelligence and Statistics, pages 3948–3958. PMLR.
397
+ Yu, T., Thomas, G., Yu, L., Ermon, S., Zou, J., Levine, S., Finn, C., and Ma, T. (2020). Mopo: Model-based offline policy optimization. arXiv preprint arXiv:2005.13239.
398
+ Zanette, A. (2020). Exponential lower bounds for batch reinforcement learning: Batch rl can be exponentially harder than online rl. arXiv preprint arXiv:2012.08005.
399
+ Zanette, A., Brandfonbrener, D., Pirotta, M., and Lazaric, A. (2020a). Frequentist regret bounds for randomized least-squares value iteration. In AISTATS.
400
+ Zanette, A., Lazaric, A., Kochenderfer, M., and Brunskill, E. (2020b). Learning near optimal policies with low inherent bellman error. In International Conference on Machine Learning (ICML).
401
+ Zanette, A., Lazaric, A., Kochenderfer, M. J., and Brunskill, E. (2020c). Provably efficient rewardagnostic navigation with linear value iteration. In Advances in Neural Information Processing Systems.
402
+ Zhang, J., Koppel, A., Bedi, A. S., Szepesvari, C., and Wang, M. (2020a). Variational policy gradient method for reinforcement learning with general utilities. arXiv preprint arXiv:2007.02151.
403
+ Zhang, R., Dai, B., Li, L., and Schuurmans, D. (2020b). Gendice: Generalized offline estimation of stationary values. arXiv preprint arXiv:2002.09072.
md/train/H12GRgcxg/H12GRgcxg.md ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TRAINING DEEP NEURAL-NETWORKS USING A NOISE ADAPTATION LAYER
2
+
3
+ Jacob Goldberger & Ehud Ben-Reuven
4
+
5
+ Engineering Faculty, Bar-Ilan University,
6
+ Ramat-Gan 52900, Israel
7
+ jacob.goldberger@biu.ac.il,udi.benreuven@gmail.com
8
+
9
+ # ABSTRACT
10
+
11
+ The availability of large datsets has enabled neural networks to achieve impressive recognition results. However, the presence of inaccurate class labels is known to deteriorate the performance of even the best classifiers in a broad range of classification problems. Noisy labels also tend to be more harmful than noisy attributes. When the observed label is noisy, we can view the correct label as a latent random variable and model the noise processes by a communication channel with unknown parameters. Thus we can apply the EM algorithm to find the parameters of both the network and the noise and estimate the correct label. In this study we present a neural-network approach that optimizes the same likelihood function as optimized by the EM algorithm. The noise is explicitly modeled by an additional softmax layer that connects the correct labels to the noisy ones. This scheme is then extended to the case where the noisy labels are dependent on the features in addition to the correct labels. Experimental results demonstrate that this approach outperforms previous methods.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ The presence of class label noise inherent to training samples has been reported to deteriorate the performance of even the best classifiers in a broad range of classification problems (Nettleton et al. (2010), Pechenizkiy et al. (2006), Zhu & Wu (2004)). Noisy labels also tend to be more harmful than noisy attributes (Zhu & Wu (2004)). Noisy data are usually related to the data collection process. Typically, the labels used to train a classifier are assumed to be unambiguous and accurate. However, this assumption often does not hold since labels that are provided by human judgments are subjective. Many of the largest image datasets have been extracted from social networks. These images are labeled by non-expert users and building a consistent model based on a precisely labeled training set is very tedious. Mislabeling examples have been reported even in critical applications such as biomedical datasets where the available data are restricted (Alon et al. (1999)). A very common approach to noisy datasets is to remove the suspect samples in a preprocessing stage or have them relabeled by a data expert (Brodley & Friedl (1999)). However, these methods are not scalable and may run the risk of removing crucial examples that can impact small datasets considerably.
16
+
17
+ Variants that are noise robust have been proposed for the most common classifiers such as logisticregression and SVM (Frenay & Verleysen (2014), Jakramate & Kab ´ an (2012), Beigman & Klebanov ´ (2009)). However, classifiers based on label-noise robust algorithms are still affected by label noise. From a theoretical point of view, Bartlett et al. (2006) showed that most loss functions are not completely robust to label noise. Natarajan et al. (2013) proposed a generic unbiased estimator for binary classification with noisy labels. They developed a surrogate cost function that can be expressed by a weighted sum of the original cost functions, and provided asymptotic bounds for performance. Grandvalet & Bengio (2005) addressed the problem of missing labels that can be viewed as an extreme case of noisy label data. They suggested a semi-supervised algorithm that encourages the classifier to predict the non-labeled data with high confidence by adding a regularization term to the cost function. The problem of classification with label noise is an active research area. Comprehensive up-to-date reviews of both the theoretical and applied aspects of classification with label noise can be found in Frenay & Kaban (2014) and Fr ´ enay & Verleysen (2014). ´
18
+
19
+ In spite of the huge success of deep learning there are not many studies that have explicitly attempted to address the problem of Neural Net (NN) training using data with unreliable labels. Larsen et al. (1998) introduced a single noise parameter that can be calculated by adding a new regularization term and cross validation. Minh & Hinton (2012) proposed a more realistic noise model that depends on the true label. However, they only considered the binary classification case. Sukhbaatar & Fergus (2014) recently proposed adding a constrained linear layer at the top of the softmax layer, and showed that only under some strong assumptions can the linear layer be interpreted as the transition matrix between the true and noisy (observed) labels and the softmax output layer as the true probabilities of the labels. Reed et al. (2014) suggested handling the unreliability of the training data labels by maximizing the likelihood function with an additional classification entropy regularization term.
20
+
21
+ The correct unknown label can be viewed as a hidden random variable. Hence, it is natural to apply the EM algorithm where in the E-step we estimate the true label and in the M-step we retrain the network. Several variations of this paradigm have been proposed (e.g. Minh & Hinton (2012), Bekker & Goldberger (2016)). However, iterating between EM-steps and neural network training does not scale well. In this study we use latent variable probabilistic modeling but we optimize the likelihood score function within the framework of neural networks. Current noisy label approaches assume either implicitly or explicitly that, given the correct label, the noisy label is independent of the feature vector. This assumption is probably needed to simplify the modeling and derive applicable learning algorithms. However, in many cases this assumption is not realistic since a wrong annotation is more likely to occur in cases where the features are misleading. By contrast, our framework makes it easy to extend the proposed learning algorithm to the case where the noise is dependent on both the correct label and the input features. In the next section we describe a model formulation and review the EM based approach. In Section 3 we described our method which is based on adding another softmax layer to the network and in Section 4 we present our results.
22
+
23
+ # 2 A PROBABILISTIC FRAMEWORK FOR NOISY LABELS
24
+
25
+ Assume we want to train a multi-class neural-network soft-classifier $p ( y = i | x ; w )$ where $x$ is the feature vector, $w$ is the network parameter-set and $i$ is a member of the class-set $\{ 1 , . . . , k \}$ . We further assume that in the training process we cannot directly observe the correct label $y$ . Instead, we only have access to a noisy version of it denoted by $z$ . Here we follow the probabilistic modeling and the EM learning approach described in Bekker $\&$ Goldberger (2016). In this approach noise generation is assumed to be independent of the features and is modeled by a parameter $\theta ( i , j ) =$ ${ \bar { p } } ( z = j | y = i )$ . The noise distribution is unknown and we want to learn it as part of the training phase. The probability of observing a noisy label $z$ given the feature vector $x$ is:
26
+
27
+ $$
28
+ p ( z = j | x ; w , \theta ) = \sum _ { i = 1 } ^ { k } p ( z = j | y = i ; \theta ) p ( y = i | x ; w )
29
+ $$
30
+
31
+ where $k$ is the number of classes. The model is illustrated in the following diagram:
32
+
33
+ ![](images/1e4a22f34a78167a2db61ba5826f72663e93013dabefc529b4d83b852b8bf7ca.jpg)
34
+
35
+ In the training phase we are given $n$ feature vectors $x _ { 1 } , . . . , x _ { n }$ with the corresponding noisy labels $z _ { 1 } , . . . , z _ { n }$ which are viewed as noisy versions of the correct hidden labels $y _ { 1 } , . . . , y _ { n }$ . The loglikelihood of the model parameters is:
36
+
37
+ $$
38
+ L ( w , \theta ) = \sum _ { t = 1 } ^ { n } \log ( \sum _ { i = 1 } ^ { k } p ( z _ { t } | y _ { t } = i ; \theta ) p ( y _ { t } = i | x _ { t } ; w ) )
39
+ $$
40
+
41
+ Based on the training data, the goal is to find both the noise distribution $\theta$ and the Neural Network parameters $w$ that maximize the likelihood function. Since the random variables $y _ { 1 } , . . . , y _ { n }$ are hidden, we can apply the EM algorithm to find the maximum-likelihood parameter set. In the E-step of
42
+
43
+ each EM iteration we estimate the hidden true data labels based on the noisy labels and the current parameters:
44
+
45
+ $$
46
+ c _ { t i } = p ( y _ { t } = i | x _ { t } , z _ { t } ; w _ { 0 } , \theta _ { 0 } ) , \qquad i = 1 , . . . , k , \qquad t = 1 , . . . , n
47
+ $$
48
+
49
+ where $w _ { 0 }$ and $\theta _ { 0 }$ are the current parameter estimations. In the M-step we update both the NN and the noisy channel parameters. The updated noise distribution has a closed-form solution.
50
+
51
+ $$
52
+ \theta ( i , j ) = \frac { \sum _ { t } c _ { t i } 1 _ { \{ z _ { t } = j \} } } { \sum _ { t } c _ { t i } } , \qquad i , j \in \{ 1 , . . . , k \}
53
+ $$
54
+
55
+ The $k \times k$ matrix $\theta$ can be viewed as a confusion matrix between the soft estimates of the true label $\{ c _ { t i } | i = 1 , . . . , k \}$ and the observed noisy labels $z _ { t }$ . As part of the EM M-step, to find the updated NN parameter $w$ we need to maximize the following function:
56
+
57
+ $$
58
+ S ( w ) = \sum _ { t = 1 } ^ { n } \sum _ { i = 1 } ^ { k } c _ { t i } \log p ( y _ { t } = i | x _ { t } ; w )
59
+ $$
60
+
61
+ which is a soft-version of the likelihood function of the fully observed case, based on the current estimate of the true labels. The back-propagation derivatives of the function (5) that we maximize in the M-step are:
62
+
63
+ $$
64
+ { \frac { \partial S } { \partial u _ { i } } } = \sum _ { t = 1 } ^ { n } ( p ( y _ { t } = i | x _ { t } , z _ { t } ; w _ { 0 } , \theta _ { 0 } ) - p ( y _ { t } = i | x _ { t } ; w ) ) h ( x _ { t } )
65
+ $$
66
+
67
+ such that $h$ is the final hidden layer and $u _ { 1 } , . . . , u _ { k }$ are the parameters of the soft-max output layer.
68
+
69
+ The method reviewed here is closely related to the work of Minh & Hinton (2012). They addressed the problem of mislabeled data points in a particular type of dataset (aerial images). The main difference is that in their approach they assumed that they do not learn the noise parameter. Instead they assume that the noise model can be separately tuned using a validation set or set by hand. Note that even if the true noise parameters are given, we still need the apply the EM iterative procedure. However, this assumption makes the interaction between the E-step and the NN learning much easier since each time a data-point $x _ { t }$ is visited we can compute the $\mathsf { \tilde { p } } ( y _ { t } = i | x _ { t } , z _ { t } )$ based on the current network parameters and the pre-defined noise parameters. Motivated by the need for model compression, Hinton et al. (2014) introduced an approach to learn a “distilled” model by training a more compact neural network to reproduce the output of a larger network. Using the notation defined above, in the second training stage they actually optimized the cost function: $S ( w ) =$ $\begin{array} { r } { \sum _ { t = 1 } ^ { n } \sum _ { i = 1 } ^ { k } p ( y _ { t } = i | x _ { t } ; w _ { 0 } , \theta _ { 0 } ) \log p ( y _ { t } = i ; x _ { t } ; w ) } \end{array}$ such that $w _ { 0 }$ is the parameter of the larger network that was trained using the labels $z _ { 1 } , . . . , z _ { n }$ , $w$ is the parameter of the smaller network and $\theta _ { 0 } ( i , j )$ in this case is a non-informative distribution (i.e. $\theta _ { 0 } ( \bar { i , } j ) = 1 / k$ ).
70
+
71
+ There are several drawbacks to the EM-based approach described above. The EM algorithm is a greedy optimization procedure that is notoriously known to get stuck in local optima. Another potential issue with combining neural networks and EM direction is scalability. The framework requires training a neural network in each iteration of the EM algorithm. For real-world, large-scale networks, even a single training iteration is a non-trivial challenge. Moreover, in many domains (e.g. object recognition in images) the number of labels is very large, so many EM iterations are likely to be needed for convergence. Another drawback of the probabilistic models is that they are based on the simplistic assumption that the noise error is only based on the true labels but not on the input features. In this study we propose a method for training neural networks with noisy labels that successfully addresses all these problems.
72
+
73
+ # 3 TRAINING DEEP NEURAL NETWORKS USING A NOISE ADAPTATION LAYER
74
+
75
+ In the previous section we utilized the EM algorithm to optimize the noisy-label likelihood function (2). In this section we describe an algorithm that optimizes the same function within the framework of neural networks. Assume the neural network classifier we are using is based on non-linear intermediate layers followed by a soft-max output layer used for soft classification. Denote the non-linear function applied on an input $x$ by $h = h ( x )$ and denote the soft-max layer that predicts the true $y$ label by:
76
+
77
+ $$
78
+ p ( y = i | x ; w ) = \frac { \exp ( u _ { i } ^ { \top } h + b _ { i } ) } { \sum _ { l = 1 } ^ { k } \exp ( u _ { l } ^ { \top } h + b _ { l } ) } , \qquad i = 1 , . . . , k
79
+ $$
80
+
81
+ where $w$ is the network parameter-set (including the softmax layer). We next add another softmax output layer to predict the noisy label $z$ based on both the true label and the input features:
82
+
83
+ $$
84
+ p ( z = j | y = i , x ) = \frac { \exp ( u _ { i j } ^ { \top } h + b _ { i j } ) } { \sum _ { l } \exp ( u _ { i l } ^ { \top } h + b _ { i l } ) }
85
+ $$
86
+
87
+ $$
88
+ p ( z = j | x ) = \sum _ { i } p ( z = j | y = i , x ) p ( y = i | x )
89
+ $$
90
+
91
+ We can also define a simplified version where the noisy label only depends on the true label; i.e. we assume that labels flips are independent of $x$ :
92
+
93
+ $$
94
+ p ( z = j | y = i ) = \frac { \exp ( b _ { i j } ) } { \sum _ { l } \exp ( b _ { i l } ) }
95
+ $$
96
+
97
+ $$
98
+ p ( z = j | x ) = \sum _ { i } p ( z = j | y = i ) p ( y = i | x )
99
+ $$
100
+
101
+ We denote the two noise modeling variants as the complex model (c-model) (8) and the simple model (s-model) (10). Hereafter we use the notation $w _ { \mathrm { n o i s e } }$ for all the parameters of the second softmax layer which can be viewed as a noise adaptation layer.
102
+
103
+ In the training phase we are given $n$ feature vectors $x _ { 1 } , . . . , x _ { n }$ with corresponding noisy labels $z _ { 1 } , . . . , z _ { n }$ which are viewed as noisy versions of the correct hidden labels $y _ { 1 } , . . . , y _ { n }$ . The loglikelihood of the model parameters is:
104
+
105
+ $$
106
+ S ( w , w _ { \mathrm { n o i s e } } ) = \sum _ { t } \log p ( z _ { t } | x _ { t } ) = \sum _ { t } \log ( \sum _ { i } p ( z _ { t } | y _ { t } = i , x _ { t } ; w _ { \mathrm { n o i s e } } ) p ( y _ { t } = i | x _ { t } ; w ) )
107
+ $$
108
+
109
+ Since the noise is modeled by adding another layer to the network, the score $S ( w , w _ { \mathrm { n o i s e } } )$ can be optimized using standard techniques for neural network training. By setting
110
+
111
+ $$
112
+ p ( z = j | y = i ) = \theta ( i , j ) = \frac { \exp ( b _ { i j } ) } { \sum _ { l } \exp ( b _ { i l } ) } ,
113
+ $$
114
+
115
+ it can easily verified that, by using either the EM algorithm (2) or the s-model neural network scheme (12), we are actually optimizing exactly the same function. Thus the neural network with the s-model noise adaptation layer provides an alternative optimization strategy to the EM algorithm. Instead of alternating between optimizing the noisy model and the network classifier, we consider them as components of the same network and optimize them simultaneously.
116
+
117
+ ![](images/534548a443496e5d2e355f491eab4b89bd6f51db466ab1ecb92ab98460c0558b.jpg)
118
+ Figure 1: An illustration of the noisy-label neural network architecture for the training phase (above) and test phase (below).
119
+
120
+ Note that in the c-model, where the noise is also dependent on the input features, we can still apply the EM algorithm to learn the parameters of the additional noise layer. However, there is no closedform solution in the M-step for the optimal parameters and we need to apply neural-network training in the M-step to find the noise-layer parameters.
121
+
122
+ At test time we want to predict the true labels. Hence, we remove the last softmax layer that aims to get rid of the noise in the training set. We compute the true-label softmax estimation $p ( y = i | x ; w )$ (7). The proposed architecture for training the neural network based on training data with noisy labels is illustrated in Figure 1.
123
+
124
+ There are degrees of freedom in the two softmax layer model. Hence, a careful initialization of the parameters of the noise adaptation layer is crucial for successful convergence of the network into a good classifier of the correct labels at test time. We used the parameters of the original network to initialize the parameters of the s-model network that contains the noise adaptation level. We can initialize the softmax parameters of the s-model by assuming a small uniform noise:
125
+
126
+ $$
127
+ b _ { i j } = \log ( ( 1 - \epsilon ) 1 _ { \{ i = j \} } + \frac { \epsilon } { k - 1 } 1 _ { \{ i \neq j \} } )
128
+ $$
129
+
130
+ such that $k$ is the number of different classes. A better procedure is to first train the original NN without the noise-adaptation layer, ignoring the fact that the labels are noisy. We can then treat the labels produced by the NN as the true labels and compute the confusion matrix on the train set and used it as an initial value for the bias parameters:
131
+
132
+ $$
133
+ b _ { i j } = \log ( \frac { \sum _ { t } 1 _ { \{ z _ { t } = j \} } p ( y _ { t } = i | x _ { t } ) } { \sum _ { t } p ( y _ { t } = i | x _ { t } ) } )
134
+ $$
135
+
136
+ such that $x _ { 1 } , . . . , x _ { n }$ are the feature vectors of the training dataset and $z _ { 1 } , . . . , z _ { n }$ are the corresponding noisy labels. So far we have concentrated on parameter initialization for the s-model. The strategy that works best to initialize the c-model parameters is to use the parameters that were optimized for the s-model. In other words we set linear terms $u _ { i j }$ to zero and initialize the bias terms $b _ { i j }$ with the values that were optimized by the s-model.
137
+
138
+ The computational complexity of the proposed method is quadratic in the size of the class-set. Suppose there are $k$ classes to predict, in this case the proposed methods require $k + 1$ sets of softmax operations with a size of $k$ each. Hence there are scalability problems when the class set is large. As we explained in the previous paragraph, we initialized the second soft-max layer using the confusion matrix of the baseline system. The confusion matrix is a good estimation of the label noise. Assume the rows of the matrix correspond to the true labels and the matrix columns correspond to the noisy labels. The $l$ largest elements in the $i$ -th row are the most frequent noisy class values when the true class value is $i$ . We can thus connect the $i \cdot$ -th element in the first softmax layer only to its $l$ most probable noisy class candidates. Note that if we connect the $i$ -th label in the first softmax only to the $i$ -th label in the second softmax layer, the second softmax layer collapses to identity and we obtain the standard baseline model. Taking the $l$ most likely connections to the second softmax layer, we allow an additional $l - 1$ possible noisy labels for each correct label. We thus obtain a data driven sparsifying of the second softmax layer which solves the scalability problem since the complexity becomes linear in the number of classes instead of quadratic. In the experiment section we show that by using this approach there is not much deference in performance.
139
+
140
+ Our architecture, which is based on a concatenation of softmax layers, resembles the hierarchical softmax approach Morin & Bengio (2005) that replaces the flat softmax layer with a hierarchical layer that has the classes as leaves. This allowed them to decompose calculating the probability of the class into a sequence of probability calculations, which saves us from having to calculate the expensive normalization over all classes. The main difference between our approach and theirs (apart from the motivation) is that in our approach the true-label softmax layer is fully connected to the noisy-label layer. Sukhbaatar & Fergus (2014) suggested adding a linear layer to handle noisy labels. Their approach is similar to our s-model. In their approach, however, they proposed a different learning procedure.
141
+
142
+ # 4 EXPERIMENTS
143
+
144
+ In this section, we evaluate the robustness of deep learning to training data with noisy labels with and without explicit noise modeling. We first show results on the MNIST data-set with injected label noise in our experiments. The MNIST is a database of handwritten digits, which consists of $2 8 \times 2 8$ images. The dataset has 60k images for training and 10k images for testing. We used a two hidden layer NN comprised of 500 and 300 neurons. The non-linear activation we used was ReLU and we used dropout with parameter 0.5. We trained the network using the Adam optimizer (Kingma & Ba (2014)) with default parameters, which we found to converge more quickly and effectively than SGD. We used a mini-batch size of 256. These settings were kept fixed for all the experiments described below. In addition to a network that is based on fully connected layers, we also applied a network based on a CNN architecture. The results we obtained in the two architectures were similar. The network we implemented is publicly available 1.
145
+
146
+ ![](images/7a84ff68aaac2dd8f567a28a156deefbfa9c0e717531b18040c9756e967633ad.jpg)
147
+ Figure 2: Test classification accuracy results on the MNIST dataset as a function of the noise level. The results are shown for several training data sizes $( 2 0 \% , 5 0 \% , 1 0 0 \% )$ of the training subset.
148
+
149
+ We generated noisy data from clean data by stochastically changing some of the labels. We converted each label with probability $p$ to a different label according to a predefined permutation. We used the same permutation as in Reed et al. (2014). The labels of the test data remained, of course, unperturbed to validate and compare our method to the regular approach.
150
+
151
+ We compared the proposed noise robust models to other model training strategies. The first network was the baseline approach that ignores the fact that the labels of the training data are unreliable. Denote the observed noisy label by $z$ and the softmax decision by $q _ { 1 } , . . . , q _ { k }$ . The baseline loglikelihood score (for a single input) is:
152
+
153
+ $$
154
+ S = \sum _ { i } 1 _ { \{ z = i \} } \log ( q _ { i } )
155
+ $$
156
+
157
+ ![](images/b5ef1146fcca8e02886ef3221e5fc0ca403f768335bc3313b5ab404edfd7422b.jpg)
158
+ Figure 3: Test classification accuracy results on the CIFAR-100 dataset as a function of the noise level. The results are shown for several training data sizes $( 2 0 \% , 5 0 \% , 1 0 0 \% )$ of the training subset for a CNN network architecture).
159
+
160
+ We also implemented two variants of the noise robust approach proposed by Reed et al. (2014). They suggested a soft version
161
+
162
+ $$
163
+ \beta S - ( 1 - \beta ) H ( q ) = \beta \sum _ { i } 1 _ { \{ z = i \} } \log ( q _ { i } ) + ( 1 - \beta ) \sum _ { i } q _ { i } \log ( q _ { i } )
164
+ $$
165
+
166
+ and a hard version:
167
+
168
+ $$
169
+ \beta S + ( 1 - \beta ) \operatorname* { m a x } _ { i } \log ( q _ { i } )
170
+ $$
171
+
172
+ In their experiments they took $\beta = 0 . 8$ for the hard version and $\beta = 0 . 9 5$ for the soft version, and observed that the hard version provided better results. Finally we implemented the two variants of our approach; namely, the noise modeling based only on the labels (s-model) and the noise modeling that was also based on the features (c-model).
173
+
174
+ Figure 2 depicts the comparative test errors results as a function of the fractions of noise. The results are shown for three different sizes of training data i.e. $( 2 0 \% , 5 0 \% , 1 0 0 \% )$ of the MNIST training subset. Bootstrapping was used to compute confidence intervals around the mean. For 1000 times, $N = 1 0$ samples were randomly drawn with repeats from the $N$ available samples and mean was computed. The confidence interval was taken to be the $2 . 5 \%$ and $9 7 . 5 \%$ percentiles of this process.
175
+
176
+ The results show that all the methods that are explicitly aware of the noise in the labels are better than the baseline which is the standard training approach. We revalidated the results reported in Reed et al. (2014) and showed that the hard version of their method performs better than the soft version. In all cases our models performed better than the alternatives. In most cases the c-model was better than the s-model. In the case where the entire dataset was used for training, we can see from the results that there was a phase transition phenomenon. We obtained almost perfect classification results until the noise level was high and there was a sudden strong performance drop. Analyzing why this effect occurred is left for future research.
177
+
178
+ We next show the results on the CIFAR-100 image dataset Krizhevsky & Hinton (2009) which consists of $3 2 \times 3 2$ color images arranged in 100 classes containing 600 images each. There are 500 training images and 100 testing images per class. We used raw images directly without any preprocessing or augmentation. We generated noisy data from clean data by stochastically changing some of the labels. We converted each one of the 100 labels with probability $p$ to a different label according to a predefined permutation. The labels of the test data remained, of course, unperturbed to validate and compare our method to the regular approach. We used a CNN network with two convolutional layers combined with ReLU activation and max-pooling, followed by two fully connected layers. Figure 3 depicts the comparative test errors results as a function of the fractions of noise for three different sizes of training data i.e. $( 2 0 \% , 5 0 \% , 1 0 0 \% )$ of the CIFAR-100 training subset. Bootstrapping was used to compute confidence intervals around the mean in the same way as for the MNIST experiment. The results showed that the proposed method works better than the alternatives. The simple model consistently provided the best results but when the noise level was very high the complex method tended to perform better.
179
+
180
+ ![](images/fdd9756231c266188a1e5ac475687a123453148e5548612140b54244bb24f5ad.jpg)
181
+ Figure 4: Test classification accuracy results on the CIFAR-100 dataset as a function of the noise level. The results of regular and sparse second softmax layers are shown for several training data sizes $( 2 0 \% , 5 0 \% , 1 0 0 \% )$ of the training subset .
182
+
183
+ We next report experimental results for the sparse variant of our method that remains efficient even when the class set is large. We demonstrate this on the case of the CIFAR-100 dataset which consists of 100 possible classes. For each class we only took the five most probable classes in the confusion matrix which is used to initialize the model parameter (see Section 3). As can be seen in Figure 4, sparsifying the second softmax layer did not not result in a drop in performance
184
+
185
+ # 5 CONCLUSION
186
+
187
+ In this paper we investigated the problem of training neural networks that are robust to label noise. We proposed an algorithm for training neural networks based solely on noisy data where the noise distribution is unknown. We showed that we can reliably learn the noise distribution from the noisy data without using any clean data which, in many cases, are not available. The algorithm can be easily combined with any existing deep learning implementation by simply adding another softmax output layer. Our results encourage collecting more data at a cheaper price, since mistaken data labels can be less harmful to performance. One possible future research direction would be to generalize our learning scheme to cases where both the features and the labels are noisy. We showed results on datasets with small and medium sized class-sets. Future research direction would be to evaluate the performance and efficiency of the proposed method on tasks with large class-sets.
188
+
189
+ # ACKNOWLEDGMENTS
190
+
191
+ This work is supported by the Intel Collaborative Research Institute for Computational Intelligence (ICRI-CI).
192
+
193
+ # REFERENCES
194
+
195
+ U. Alon, N. Barkai, D. Notterman, K. Gish, S.and D. Mack, and A. Levine. Broad patterns of gene expression revealed by clustering analysis of tumor and normal colon tissues probed by oligonucleotide arrays. Proceedings of the National Academy of Sciences, 96(12):6745–6750, 1999.
196
+ P. L. Bartlett, M. I. Jordan, and J. D. McAuliffe. Convexity, classification, and risk bounds. Journal of the American Statistical Association, pp. 138–156, 2006.
197
+ E. Beigman and B. B. Klebanov. Learning with annotation noise. In ACL-IJCNLP, 2009.
198
+ A. Bekker and J. Goldberger. Training deep neural-networks based on unreliable labels. In IEEE Int.l Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 2682–2686, 2016.
199
+ C. Brodley and M. Friedl. Identifying mislabeled training data. J. Artif. Intell. Res.(JAIR), 11: 131–167, 1999.
200
+ B. Frenay and A. Kaban. A comprehensive introduction to label noise. In ´ European Symposium on Artificial Neural Networks, Computational Intelligence and Machine Learning (ESANN), 2014.
201
+ B. Frenay and M. Verleysen. Classification in the presence of label noise: a survey. ´ IEEE Trans. on Neural Networks and Learning Systems, 25(5):845–869, 2014.
202
+ Y. Grandvalet and Y. Bengio. Semi-supervised learning by entropy minimization. In Advances in Neural Information Processing Systems (NIPS), 2005.
203
+ G.E. Hinton, O. Vinyals, and J. Dean. Distilling the knowledge in a neural network. In NIPS Deep Learning and Representation Learning Workshop, 2014.
204
+ B. Jakramate and A. Kaban. Label-noise robust logistic regression and its applications. In ´ Machine Learning and Knowledge Discovery in Databases, pp. 143–158. 2012.
205
+ D. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
206
+ A. Krizhevsky and G. Hinton. Learning multiple layers of features from tiny images. Technical report, Computer Science Department, University of Toronto, 2009.
207
+ J. Larsen, L. Nonboe, M. Hintz-Madsen, and K. L. Hansen. Design of robust neural network classifiers. In Int. Conf. on Acoustics, Speech and Signal Processing, pp. 1205–1208, 1998.
208
+ V. Minh and G. Hinton. Learning to label aerial images from noisy data. In Int. Conf. on Machine Learning (ICML), 2012.
209
+ F. Morin and Y. Bengio. Hierarchical probabilistic neural network language model. In Aistats, volume 5, pp. 246–252, 2005.
210
+ N. Natarajan, I. Dhillon, P. Ravikumar, and A. Tewari. Learning with noisy labels. In Advances in Neural Information Processing Systems (NIPS), 2013.
211
+ D. Nettleton, A. Orriols-Puig, and A. Fornells. A study of the effect of different types of noise on the precision of supervised learning techniques. Artificial intelligence review, 2010.
212
+ M. Pechenizkiy, A. Tsymbal, S. Puuronen, and O. Pechenizkiy. Class noise and supervised learning in medical domains: The effect of feature extraction. In Computer-Based Medical Systems (CBMS), 2006.
213
+ S. Reed, H. Lee, D. Anguelov, C. Szegedy, D. Erhan, and A. Rabinovich. Training deep neural networks on noisy labels with bootstrapping. In arXiv preprint arXiv:1412.6596, 2014.
214
+ S. Sukhbaatar and R. Fergus. Learning from noisy labels with deep neural networks. In arXiv preprint arXiv:1406.2080, 2014.
215
+ X. Zhu and X. Wu. Class noise vs. attribute noise: A quantitative study. Artificial Intelligence Review, 22(3):177–210, 2004.
md/train/H1gL-2A9Ym/H1gL-2A9Ym.md ADDED
@@ -0,0 +1,340 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PREDICT THEN PROPAGATE: GRAPH NEURAL NETWORKS MEET PERSONALIZED PAGERANK
2
+
3
+ Johannes Gasteiger, Aleksandar Bojchevski & Stephan Gunnemann ¨
4
+
5
+ Technical University of Munich, Germany {j.gasteiger,a.bojchevski,guennemann}@in.tum.de
6
+
7
+ # ABSTRACT
8
+
9
+ Neural message passing algorithms for semi-supervised classification on graphs have recently achieved great success. However, for classifying a node these methods only consider nodes that are a few propagation steps away and the size of this utilized neighborhood is hard to extend. In this paper, we use the relationship between graph convolutional networks (GCN) and PageRank to derive an improved propagation scheme based on personalized PageRank. We utilize this propagation procedure to construct a simple model, personalized propagation of neural predictions (PPNP), and its fast approximation, APPNP. Our model’s training time is on par or faster and its number of parameters on par or lower than previous models. It leverages a large, adjustable neighborhood for classification and can be easily combined with any neural network. We show that this model outperforms several recently proposed methods for semi-supervised classification in the most thorough study done so far for GCN-like models. Our implementation is available online. 1
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Graphs are ubiquitous in the real world and its description through scientific models. They are used to study the spread of information, to optimize delivery, to recommend new books, to suggest friends, or to find a party’s potential voters. Deep learning approaches have achieved great success on many important graph problems such as link prediction (Grover & Leskovec, 2016; Bojchevski et al., 2018), graph classification (Duvenaud et al., 2015; Niepert et al., 2016; Gilmer et al., 2017) and semi-supervised node classification (Yang et al., 2016; Kipf & Welling, 2017).
14
+
15
+ There are many approaches for leveraging deep learning algorithms on graphs. Node embedding methods use random walks or matrix factorization to directly train individual node embeddings, often without using node features and usually in an unsupervised manner, i.e. without leveraging node classes (Perozzi et al., 2014; Tang et al., 2015; Nandanwar & Murty, 2016; Grover & Leskovec, 2016; Qiu et al., 2018). Many other approaches use both graph structure and node features in a supervised setting. Examples for these include spectral graph convolutional neural networks (Bruna et al., 2014; Defferrard et al., 2016), message passing (or neighbor aggregation) algorithms (Kearnes et al., 2016; Kipf & Welling, 2017; Hamilton et al., 2017; Pham et al., 2017; Monti et al., 2017; Gilmer et al., 2017), and neighbor aggregation via recurrent neural networks (Scarselli et al., 2009; Li et al., 2016; Dai et al., 2018). Among these categories, the class of message passing algorithms has garnered particular attention recently due to its flexibility and good performance.
16
+
17
+ Several works have been aimed at improving the basic neighborhood aggregation scheme by using attention mechanisms (Kearnes et al., 2016; Hamilton et al., 2017; Velickovi ˇ c et al., 2018), random ´ walks (Abu-El-Haija et al., 2018a; Ying et al., 2018; Li et al., 2018), edge features (Kearnes et al., 2016; Gilmer et al., 2017; Schlichtkrull et al., 2018) and making it more scalable on large graphs (Chen et al., 2018; Ying et al., 2018). However, all of these methods only use the information of a very limited neighborhood for each node. A larger neighborhood would be desirable to provide the model with more information, especially for nodes in the periphery or in a sparsely labelled setting.
18
+
19
+ Increasing the size of the neighborhood used by these algorithms, i.e. their range, is not trivial since neighborhood aggregation in this scheme is essentially a type of Laplacian smoothing and too many layers lead to oversmoothing (Li et al., 2018). Xu et al. (2018) highlighted the same problem by establishing a relationship between the message passing algorithm termed Graph Convolutional Network (GCN) by Kipf & Welling (2017) and a random walk. Using this relationship we see that GCN converges to this random walk’s limit distribution as the number of layers increases. The limit distribution is a property of the graph as a whole and does not take the random walk’s starting (root) node into account. As such it is unsuited to describe the root node’s neighborhood. Hence, GCN’s performance necessarily deteriorates for a high number of layers (or aggregation/propagation steps).
20
+
21
+ To solve this issue, in this paper, we first highlight the inherent connection between the limit distribution and PageRank (Page et al., 1998). We then propose an algorithm that utilizes a propagation scheme derived from personalized PageRank instead. This algorithm adds a chance of teleporting back to the root node, which ensures that the PageRank score encodes the local neighborhood for every root node (Page et al., 1998). The teleport probability allows us to balance the needs of preserving locality (i.e. staying close to the root node to avoid oversmoothing) and leveraging the information from a large neighborhood. We show that this propagation scheme permits the use of far more (in fact, infinitely many) propagation steps without leading to oversmoothing.
22
+
23
+ Moreover, while propagation and classification are inherently intertwined in message passing, our proposed algorithm separates the neural network from the propagation scheme. This allows us to achieve a much higher range without changing the neural network, whereas in the message passing scheme every additional propagation step would require an additional layer. It also permits the independent development of the propagation algorithm and the neural network generating predictions from node features. That is, we can combine any state-of-the-art prediction method with our propagation scheme. We even found that adding our propagation scheme during inference significantly improves the accuracy of networks that were trained without using any graph information.
24
+
25
+ Our model achieves state-of-the-art results while requiring fewer parameters and less training time compared to most competing models, with a computational complexity that is linear in the number of edges. We show these results in the most thorough study (including significance testing) of message passing models using graphs with text-based features that has been done so far.
26
+
27
+ # 2 GRAPH CONVOLUTIONAL NETWORKS AND THEIR LIMITED RANGE
28
+
29
+ We first introduce our notation and explain the problem our model solves. Let $G = ( V , E )$ be a graph with nodes $V$ and edges $E$ . Let $n$ denote the number of nodes and $m$ the number of edges. The nodes are described by the feature matrix $\ b { X } \in \mathbb { R } ^ { n \times f }$ , with the number of features $f$ per node, and the class (or label) matrix $\ b { Y } \in \mathbb { R } ^ { n \times c }$ , with the number of classes $c$ . The graph $G$ is described by the adjacency matrix $A \in \mathbb { R } ^ { n \times n }$ . $\tilde { \pmb { A } } = \pmb { A } + \pmb { I _ { n } }$ denotes the adjacency matrix with added self-loops.
30
+
31
+ One simple and widely used message passing algorithm for semi-supervised classification is the Graph Convolutional Network (GCN). In the case of two message passing layers its equation is
32
+
33
+ $$
34
+ \boldsymbol { Z } _ { \mathrm { G C N } } = \mathrm { s o f t m a x } \left( \hat { \tilde { A } } \mathrm { R e L U } \left( \hat { \tilde { A } } \boldsymbol { X } \boldsymbol { W } _ { 0 } \right) \boldsymbol { W } _ { 1 } \right) ,
35
+ $$
36
+
37
+ where $\ b { Z } \in \mathbb { R } ^ { n \times c }$ are the predicted node labels, $\hat { \tilde { A } } = \tilde { D } ^ { - 1 / 2 } \tilde { A } \tilde { D } ^ { - 1 / 2 }$ is the symmetrically normalized adjacency matrix with self-loops, with the diagonal degree matrix $\begin{array} { r } { \tilde { D } _ { i j } = \sum _ { k } \tilde { A } _ { i k } \delta _ { i j } } \end{array}$ , and $W _ { 0 }$ and $W _ { 1 }$ are trainable weight matrices (Kipf & Welling, 2017).
38
+
39
+ With two GCN-layers, only neighbors in the two-hop neighborhood are considered. There are essentially two reasons why a message passing algorithm like GCN cannot be trivially expanded to use a larger neighborhood. First, aggregation by averaging causes oversmoothing if too many layers are used. It, therefore, loses its focus on the local neighborhood (Li et al., 2018). Second, most common aggregation schemes use learnable weight matrices in each layer. Therefore, using a larger neighborhood necessarily increases the depth and number of learnable parameters of the neural network (the second aspect can be circumvented by using weight sharing, which is typically not the case, though). However, the required neighborhood size and neural network depth are two completely orthogonal aspects. This fixed relationship is a strong limitation and leads to bad compromises.
40
+
41
+ We will start by concentrating on the filayer GCN the influence score of node $x$ isson $y$ ., $\begin{array} { r } { I ( x , y ) ~ = ~ \sum _ { i } \sum _ { j } \frac { \partial Z _ { y i } } { \partial X _ { x j } } } \end{array}$ $\mathrm { X u }$ hown that for a , is proportional $k$ expectation to a slightly modified $k$ -step random walk distribution starting at the root node $x$ , $P _ { \mathrm { r w } } , ( x \to y , k )$ . Hence, the information of node $x$ spreads to node $y$ in a random walk-like manner. If we take the limit $k \infty$ and the graph is irreducible and aperiodic, this random walk probability distribution $P _ { \mathrm { r w } } , ( x \to y , k )$ converges to the limit (or stationary) distribution $P _ { \mathrm { l i m } } ( \to y )$ . This distribution can be obtained by solving the equation $\pi _ { \mathrm { l i m } } = \hat { \tilde { A } } \pi _ { \mathrm { l i m } }$ . Obviously, the result only depends on the graph as a whole and is independent of the random walk’s starting (root) node $x$ . This global property is therefore unsuitable for describing the root node’s neighborhood.
42
+
43
+ ![](images/b4aa525e1c873f19349a9967b8eab74ff37d89d4cc7d33d209b29d100026a523.jpg)
44
+ Figure 1: Illustration of (approximate) personalized propagation of neural predictions (PPNP, APPNP). Predictions are first generated from each node’s own features by a neural network and then propagated using an adaptation of personalized PageRank. The model is trained end-to-end.
45
+
46
+ # 3 PERSONALIZED PROPAGATION OF NEURAL PREDICTIONS
47
+
48
+ From message passing to personalized PageRank. We can solve the problem of lost focus by recognizing the connection between the limit distribution and PageRank (Page et al., 1998). The only differences between these two are the added self-loops and the adjacency matrix normalization in $\hat { \tilde { A } }$ . Original PageRank is calculated via $\pi _ { \mathrm { p r } } = A _ { \mathrm { r w } } \pi _ { \mathrm { p r } }$ , with $A _ { \mathrm { r w } } = A D ^ { - 1 }$ . Having made this connection we can now consider using a variant of PageRank that takes the root node into account – personalized PageRank (Page et al., 1998). We define the root node $x$ via the teleport vector $i _ { x }$ , which is a one-hot indicator vector. Our adaptation of personalized PageRank can be obtained for node $x$ using the recurrent equation $\pi _ { \mathrm { p p r } } ( i _ { x } ) \stackrel { - } { = } ( 1 - \alpha ) \mathring { \hat { A } } \pi _ { \mathrm { p p r } } ( i _ { x } ) + \alpha i _ { x }$ , with the teleport (or restart) probability $\alpha \in \mathsf { \Gamma } ( 0 , 1 ]$ . By solving this equation, we obtain
49
+
50
+ $$
51
+ \pi _ { \mathrm { p p r } } ( i _ { x } ) = \alpha \left( I _ { n } - ( 1 - \alpha ) \hat { \tilde { A } } \right) ^ { - 1 } i _ { x } .
52
+ $$
53
+
54
+ Introducing the teleport vector $i _ { x }$ allows us to preserve the node’s local neighborhood even in the limit distribution. In this model the influence score of root node $x$ on node $y$ , $I ( x , y )$ , is proportional to the $y$ -th element of our personalized PageRank $\pi _ { \mathrm { p p r } } ( i _ { x } )$ . This value is different for every root node. How fast it decreases as we move away from the root node can be adjusted via $\alpha$ . By substituting the indicator vector $i _ { x }$ with the unit matrix ${ { I } _ { n } }$ we obtain our fully personalized PageRank matrix $\Pi _ { \mathrm { p p r } } = \alpha ( I _ { n } - ( 1 - \alpha ) \hat { \tilde { { \bf A } } } ) ^ { - 1 }$ , whose element $( y x )$ specifies the influence score of node $x$ on node $y$ , $I ( x , y ) \propto \mathbf { I } _ { \mathrm { p p r } } ^ { ( y x ) }$ . Note that due to symmetry $\mathbf { \Pi } \mathbf { \Pi } _ { \mathrm { p p r } } ^ { ( y x ) } = \mathbf { \Pi } \mathbf { I } _ { \mathrm { p p r } } ^ { ( x y ) }$ , i.e. the influence of $x$ on $y$ is equal to the influence of $y$ on . This inverse always exists since $\begin{array} { r } { \frac { 1 } { 1 - \alpha } > 1 } \end{array}$ and therefore cannot be an eigenvalue of $\hat { \tilde { A } }$ (see Appendix A).
55
+
56
+ Personalized propagation of neural predictions (PPNP). To utilize the above influence scores for semi-supervised classification we generate predictions for each node based on its own features and then propagate them via our fully personalized PageRank scheme to generate the final predictions. This is the foundation of personalized propagation of neural predictions. PPNP’s model equation is
57
+
58
+ $$
59
+ \begin{array} { r l r } { Z _ { \mathrm { P P N P } } = \operatorname { s o f t m a x } \left( \alpha \left( \boldsymbol { I } _ { n } - ( 1 - \alpha ) \hat { \boldsymbol { A } } \right) ^ { - 1 } \boldsymbol { H } \right) , } & { } & { \boldsymbol { H } _ { i , : } = f _ { \boldsymbol { \theta } } ( X _ { i , : } ) , } \end{array}
60
+ $$
61
+
62
+ where $\boldsymbol { X }$ is the feature matrix and $f _ { \theta }$ a neural network with parameter set $\theta$ generating the predictions $\pmb { H } \in \mathbb { R } ^ { n \times c }$ . Note that $f _ { \theta }$ operates on each node’s features independently, allowing for parallelization. Furthermore, one could substitute $\hat { \tilde { A } }$ with any propagation matrix, such as $\boldsymbol { A } _ { \mathrm { r w } }$ .
63
+
64
+ As a consequence, PPNP separates the neural network used for generating predictions from the propagation scheme. This separation additionally solves the second issue mentioned above: the depth of the neural network is now fully independent of the propagation algorithm. As we saw when connecting GCN to PageRank, personalized PageRank can effectively use even infinitely many neighborhood aggregation layers, which is clearly not possible in the classical message passing framework. Furthermore, the separation gives us the flexibility to use any method for generating predictions, e.g. deep convolutional neural networks for graphs of images.
65
+
66
+ While generating predictions and propagating them happen consecutively during inference, it is important to note that the model is trained end-to-end. That is, the gradient flows through the propagation scheme during backpropagation (implicitly considering infinitely many neighborhood aggregation layers). Adding these propagation effects significantly improves the model’s accuracy.
67
+
68
+ Efficiency analysis. Directly calculating the fully personalized PageRank matrix $\Pi _ { \mathrm { p p r } }$ , is computationally inefficient and results in a dense $\mathbb { R } ^ { n \times n }$ matrix. Using this matrix would lead to a computational complexity and memory requirement of $\mathcal { O } ( n ^ { 2 } )$ for training and inference.
69
+
70
+ To solve this issue, reconsider the equation ${ \cal Z } = \alpha ( { \cal I } _ { n } - ( 1 - \alpha ) \hat { \tilde { A } } ) ^ { - 1 } H$ . Instead of viewing this equation as a combination of a dense fully personalized PageRank matrix with the prediction matrix, we can also view it as a variant of topic-sensitive PageRank, with each class corresponding to one topic (Haveliwala, 2002). In this view every column of $\pmb { H }$ defines an (unnormalized) distribution over nodes that acts as a teleport set. Hence, we can approximate PPNP via an approximate computation of topic-sensitive PageRank.
71
+
72
+ Approximate personalized propagation of neural predictions (APPNP). More precisely, APPNP achieves linear computational complexity by approximating topic-sensitive PageRank via power iteration. While PageRank’s power iteration is connected to the regular random walk, the power iteration of topic-sensitive PageRank is related to a random walk with restarts. Each power iteration (random walk/propagation) step of our topic-sensitive PageRank variant is, thus, calculated via
73
+
74
+ $$
75
+ \begin{array} { r c l } { { } } & { { } } & { { { \pmb Z } ^ { ( 0 ) } = { \pmb H } = f _ { \theta } ( { \pmb X } ) , } } \\ { { } } & { { } } & { { { \pmb Z } ^ { ( k + 1 ) } = ( 1 - \alpha ) \hat { \hat { \bf A } } { \pmb Z } ^ { ( k ) } + \alpha { \pmb H } , } } \\ { { } } & { { } } & { { { \pmb Z } ^ { ( K ) } = \mathrm { s o f t m a x } \left( ( 1 - \alpha ) \hat { \hat { \bf A } } { \pmb Z } ^ { ( K - 1 ) } + \alpha { \pmb H } \right) , } } \end{array}
76
+ $$
77
+
78
+ where the prediction matrix $\pmb { H }$ acts as both the starting vector and the teleport set, $K$ defines the number of power iteration steps and $k \in [ 0 , K - 2 ]$ . Note that this method retains the graph’s sparsity and never constructs an $\mathbb { R } ^ { n \times n }$ matrix. The convergence of this iterative scheme can be shown by investigating the resulting series (see Appendix B).
79
+
80
+ Note that the propagation scheme of this model does not require any additional parameters to train – as opposed to models like GCN, which typically require more parameters for each additional propagation layer. We can therefore propagate very far with very few parameters. Our experiments show that this ability is indeed very beneficial (see Section 6). A similar model expressed in the message passing framework would therefore not be able to achieve the same level of performance.
81
+
82
+ The reformulation of PPNP via fixed-point iterations illustrates a connection to the original graph neural network (GNN) model (Scarselli et al., 2009). While the latter uses a learned fixed-point iteration, our approach uses a predetermined iteration (adapted personalized PageRank) and applies a learned feature transformation before propagation.
83
+
84
+ In both PPNP and APPNP, the size of the neighborhood influencing each node can be adjusted via the teleport probability $\alpha$ . The freedom to choose $\alpha$ allows us to adjust the model for different types of networks, since varying graph types require the consideration of different neighborhood sizes, as shown in Section 6 and described by Grover & Leskovec (2016) and Abu-El-Haija et al. (2018b).
85
+
86
+ Table 1: Dataset statistics. Shortest path length is denoted by SP.
87
+
88
+ <table><tr><td>Dataset</td><td>Type</td><td>Classes</td><td>Features</td><td>Nodes</td><td>Edges</td><td>Label rate</td><td>Avg. SP</td></tr><tr><td>CITESEER</td><td>Citation</td><td>6</td><td>3703</td><td>2110</td><td>3668</td><td>0.036</td><td>9.31</td></tr><tr><td>CORA-ML</td><td>Citation</td><td>7</td><td>2879</td><td>2810</td><td>7981</td><td>0.047</td><td>5.27</td></tr><tr><td>PUBMED</td><td>Citation</td><td>3</td><td>500</td><td>19 717</td><td>44324</td><td>0.003</td><td>6.34</td></tr><tr><td>MS ACADEMIC</td><td>Co-author</td><td>15</td><td>6805</td><td>18 333</td><td>81894</td><td>0.016</td><td>5.43</td></tr></table>
89
+
90
+ # 4 RELATED WORK
91
+
92
+ Several works have tried to improve the training of message passing algorithms and increase the neighborhood available at each node by adding skip connections (Li et al., 2016; Pham et al., 2017; Hamilton et al., 2017; Ying et al., 2018). One recent approach combined skip connection with aggregation schemes (Xu et al., 2018). However, the range of these models is still limited, as apparent in the low number of message passing layers used. While it is possible to add skip connections in the neural network used by our algorithm, this would not influence the propagation scheme. Our approach to solving the range problem is therefore unrelated to these models.
93
+
94
+ Li et al. (2018) facilitated training by combining message passing with co- and self-training. The improvements achieved by this combination are similar to results reported with other semi-supervised classification models (Buchnik & Cohen, 2018). Note that most algorithms, including ours, can be improved using self- and co-training. However, each additional step used by these methods corresponds to a full training cycle and therefore significantly increases the training time.
95
+
96
+ Deep GNNs that avoid the oversmoothing issue have been proposed in recent works by combining residual (skip) connections with batch normalization (Kawamoto et al., 2018; Chen et al., 2019). However, our model solves this issue by simplifying the architecture via decoupling prediction and propagation and does not rely on ad-hoc techniques that further complicate the model and introduce additional hyperparameters. Furthermore, since PPNP increases the range without introducing additional layers and parameters it is easier and faster to train compared to a deep GNN.
97
+
98
+ # 5 EXPERIMENTAL SETUP
99
+
100
+ Recently, many experimental evaluations have suffered from superficial statistical evaluation and experimental bias from using varying training setups and overfitting. The latter is caused by experiments using a single training/validation/test split, by not distinguishing clearly between the validation and test set, and by finetuning hyperparameters to each dataset or even data split separately. Message-passing algorithms are very sensitive to both data splits and weight initialization (as clearly shown by our evaluation). Thus, a carefully designed evaluation protocol is extremely important. Our work aims to establish such a thorough evaluation protocol. First, we run each experiment 100 times on multiple random splits and initializations. Second, we split the data into a visible and a test set, which do not change. The test set was only used once to report the final performance; and in particular, has never been used to perform hyperparameter and model selection. To further prevent overfitting we use the same number of layers and hidden units, dropout rate $d$ , $L _ { 2 }$ regularization parameter $\lambda$ , and learning rate $l$ across datasets, since all datasets use bag-of-words as features. To prevent experimental bias we optimized the hyperparameters of all models individually using a grid search on CITESEER and CORA-ML and use the same early stopping criterion across models.
101
+
102
+ Finally, to ensure the statistical robustness of our experimental setup, we calculate confidence intervals via bootstrapping and report the p-values of a paired $t$ -test for our main claims. To our knowledge, this is the most rigorous study on GCN-like models which has been done so far. More details about the experimental setup are provided in Appendix C.
103
+
104
+ Datasets. We use four text-classification datasets for evaluation. CITESEER (Sen et al., 2008), CORA-ML (McCallum et al., 2000; Bojchevski & Gunnemann, 2018) and P ¨ UBMED (Namata et al., 2012) are citation graphs, where each node represents a paper and the edges represent citations between them. In the MICROSOFT ACADEMIC graph (Shchur et al., 2018) edges represent coauthorship. We use the largest connected component of each graph. All graphs use a bag-of-words representation of the papers’ abstracts as features. While large graphs do not necessarily have a larger diameter (Leskovec et al., 2005), note that these graphs indeed have average shortest path lengths between 5 and 10 and therefore a regular two-layer GCN cannot cover the entire graph. Table 1 reports the dataset statistics.
105
+
106
+ Table 2: Average accuracy with uncertainties showing the $9 5 \%$ confidence level calculated by bootstrapping. Previously reported improvements vanish on our rigorous experimental setup, while PPNP and APPNP significantly outperform the compared models on all datasets.
107
+
108
+ <table><tr><td>Model</td><td>CITESEER</td><td>CORA-ML</td><td>PUBMED</td><td>MS ACADEMIC</td></tr><tr><td>V. GCN</td><td>73.51± 0.48</td><td>82.30±0.34</td><td>77.65± 0.40</td><td>91.65±0.09</td></tr><tr><td>GCN</td><td>75.40 ± 0.30</td><td>83.41 ± 0.39</td><td>78.68 ± 0.38</td><td>92.10±0.08</td></tr><tr><td>N-GCN</td><td>74.25 ± 0.40</td><td>82.25 ±0.30</td><td>77.43± 0.42</td><td>92.86 ±0.11</td></tr><tr><td>GAT</td><td>75.39 ± 0.27</td><td>84.37 ±0.24</td><td>77.76± 0.44</td><td>91.22 ± 0.07</td></tr><tr><td>JK</td><td>73.03 ± 0.47</td><td>82.69 ± 0.35</td><td>77.88 ±0.38</td><td>91.71 ± 0.10</td></tr><tr><td>Bt. FP</td><td>73.55 ± 0.57</td><td>80.84 ± 0.97</td><td>72.94 ± 1.00</td><td>91.61 ± 0.24</td></tr><tr><td>PPNP*</td><td>75.83 ± 0.27</td><td>85.29 ± 0.25</td><td></td><td></td></tr><tr><td>APPNP</td><td>75.73 ±0.30</td><td>85.09 ± 0.25</td><td>79.73 ± 0.31</td><td>93.27 ± 0.08</td></tr></table>
109
+
110
+ ∗out of memory on PUBMED, MS ACADEMIC (see efficiency analysis in Section 3)
111
+
112
+ ![](images/450c3c6b12966fe24757d76c94f47567c73eff0ace75efe4410c70428228806c.jpg)
113
+ Figure 2: Accuracy distributions of different models. The high standard deviation between data splits and initializations shows the importance of a rigorous evaluation, which is often omitted.
114
+
115
+ Baseline models. We compare to five state-of-the-art models: GCN (Kipf & Welling, 2017), network of GCNs (N-GCN) (Abu-El-Haija et al., 2018a), graph attention networks (GAT) (Velickovi ˇ c´ et al., 2018), bootstrapped feature propagation (bt. FP) (Buchnik & Cohen, 2018) and jumping knowledge networks with concatenation (JK) (Xu et al., 2018). For GCN we also show the results of the (unoptimized) vanilla version (V. GCN) to demonstrate the strong impact of early stopping and hyperparameter optimization. The hyperparameters of all models are listed in Appendix D.
116
+
117
+ Model hyperparameters. To ensure a fair model comparison we used a neural network for PPNP that is structurally very similar to GCN and has the same number of parameters. We use two layers with $h = 6 4$ hidden units. We apply $L _ { 2 }$ regularization with $\lambda = 0 . 0 0 5$ on the weights of the first layer and use dropout with dropout rate $d = 0 . 5$ on both layers and the adjacency matrix. For APPNP, adjacency dropout is resampled for each power iteration step. For propagation we use the teleport probability $\alpha = 0 . 1$ and $K = 1 0$ power iteration steps for APPNP. We use $\alpha = 0 . 2$ on the MICROSOFT ACADEMIC graph due to its structural difference (see Figure 5 and its discussion). The combination of this shallow neural network with a comparatively high number of power iteration steps achieved the best results during hyperparameter optimization (see Appendix G).
118
+
119
+ # 6 RESULTS
120
+
121
+ Overall accuracy. The results for the accuracy (micro F1-score) are summarized in Table 2. Similar trends are observed for the macro F1-score (see Appendix E). Both models significantly outperform the state-of-the-art baseline models on all datasets. Our rigorous setup might understate the improvements achieved by PPNP and APPNP – this result is statistically significant $p < 0 . 0 5$ , as tested via a paired $t$ -test (see Appendix F). This thorough setup furthermore shows that the advantages reported by recent works practically vanish when training is harmonized, hyperparameters are properly optimized and multiple data splits are considered. A simple GCN with optimized hyperparameters outperforms several recently proposed models on our setup.
122
+
123
+ Table 3: Average training time per epoch. PPNP and APPNP are only slightly slower than GCN and much faster than more sophisticated methods like GAT.
124
+
125
+ <table><tr><td>Graph</td><td>V. GCN</td><td>GCN</td><td>N-GCN</td><td>GAT</td><td>JK</td><td>Bt.FP*</td><td>PPNP**</td><td>APPNP</td></tr><tr><td>CITESEER</td><td>37.6ms</td><td>35.3ms</td><td>115.9 ms</td><td>187.0 ms</td><td>57.5 ms</td><td>=</td><td>49.2 ms</td><td>43.3ms</td></tr><tr><td>CORA-ML</td><td>32.4 ms</td><td>36.5ms</td><td>118.9 ms</td><td>217.4 ms</td><td>43.6 ms</td><td></td><td>55.3ms</td><td>42.7ms</td></tr><tr><td>PUBMED</td><td>48.6ms</td><td>48.3ms</td><td>342.6 ms</td><td>1029.8 ms</td><td>77.8ms</td><td></td><td>-</td><td>64.1ms</td></tr><tr><td>MS ACADEMIC</td><td>45.5ms</td><td>39.2 ms</td><td>328.5ms</td><td>772.2 ms</td><td>61.9 ms</td><td>=</td><td>=</td><td>59.8ms</td></tr></table>
126
+
127
+ ∗not applicable, since core method not trainable ∗∗out of memory on PUBMED, MS ACADEMIC (see efficiency analysis in Section 3)
128
+
129
+ ![](images/88566eae2ce6f160a22712efc36611a1a63fdd2342b12dae2ed67301a9c7b259.jpg)
130
+ Figure 3: Accuracy for different training set sizes (number of labeled nodes per class) on CORA-ML. PPNP’s dominance increases further for smaller training set sizes.
131
+
132
+ Figure 2 shows how broad the accuracy distribution of each model is. This is caused by both random initialization and different data splits (train / early stopping / test). This demonstrates how crucial a statistically rigorous evaluation is for a conclusive model comparison. Moreover, it shows the sensitivity (robustness) of each method, e.g. PPNP, APPNP and GAT typically have lower variance.
133
+
134
+ Training time per epoch. We report the average training time per epoch in Table 3. We decided to only compare the training time per epoch since all hyperparameters were solely optimized for accuracy and the used early stopping criterion is very generous. Obviously, (exact) PPNP can only be applied to moderately sized graphs, while APPNP scales to large data. On average, APPNP is around $2 5 \%$ slower than GCN due to its higher number of matrix multiplications. It scales similarly with graph size as GCN and is therefore significantly faster than other more sophisticated models like GAT. This is observed even though our implementation improved GAT’s training time roughly by a factor of 2 compared to the reference implementation.
135
+
136
+ Training set size. Since the labeling rate is often very small for real world datasets, investigating how the models perform with a small number of training samples is very important. Figure 3 shows how the number of training nodes per class $n _ { \mathrm { t r a i n } }$ , per class impacts the accuracy on CORA-ML (for other datasets see Appendix H). The dominance of PPNP and APPNP increases further in this sparsely labelled setting. This can be attributed to their higher range, which allows them to better propagate the information further away from the (few) training nodes. We see further evidence for this when comparing the accuracy of APPNP and GCN depending on the distance between a node and the training set (in terms of shortest path). Appendix I shows that the performance gap between APPNP and GCN tends to increase for nodes that are far away from the training nodes. That is, nodes further away from the training set benefit more from the increase in range.
137
+
138
+ ![](images/b5ef1be3d27841710cb335d16bfccf768880bcfa79885bfbb88b30e0d3582494.jpg)
139
+ Figure 4: Accuracy depending on the number of propagation steps $K$ . The accuracy breaks down for the GCN-like propagation $( \alpha = 0$ ), while it increases and stabilizes when using APPNP $\alpha = 0 . 1 $ ).
140
+
141
+ ![](images/62154be5f91cc09d9d69baa2c807574a402caacda004d7ce1b31b0a43cf0d3ec.jpg)
142
+ Figure 5: Accuracy depending on teleport probability $\alpha$ . The optimum typically lies within $\alpha \in$ [0.05, 0.2], but changes for different types of datasets.
143
+
144
+ ![](images/97478f5dbeec637506fb81f6d63e7bc17303dab521e5c1b780080f8ab5e41d8d.jpg)
145
+ Figure 6: Accuracy of APPNP with propagation used only during training/inference. Best results are achieved with full propagation, but propagating only during inference also achieves good results.
146
+
147
+ Number of power iteration steps. Figure 4 shows how the accuracy depends on the number of power iterations for two different propagation schemes. The first mimics the standard propagation as known from GCNs (i.e. $\alpha = 0$ in APPNP). As clearly shown the performance breaks down as we increase the number of power iterations $K$ (since we approach the global PageRank solution). However, when using personalized propagation (with $\alpha = 0 . 1$ ) the accuracy increases and converges to exact PPNP with infinitely many propagation steps, thus demonstrating the personalized propagation principle is indeed beneficial. As also shown in the figure, it is enough to use a moderate number of power iterations (e.g. $K = 1 0$ ) to effectively approximate exact PPNP. Interestingly, we’ve found that this number coincides with the highest shortest path distance of any node to the training set.
148
+
149
+ Teleport probability $\alpha$ . Figure 5 shows the effect of the hyperparameter $\alpha$ on the accuracy on the validation set. While the optimum differs slightly for every dataset, we consistently found a teleport probability of around $\alpha \in [ 0 . 0 5 , 0 . 2 ]$ to perform best. This probability should be adjusted for the dataset under investigation, since different graphs exhibit different neighborhood structures (Grover & Leskovec, 2016; Abu-El-Haija et al., 2018b). Note that a higher $\alpha$ improves convergence speed.
150
+
151
+ Neural network without propagation. PPNP and APPNP are trained end-to-end, with the propagation scheme affecting (i) the neural network $f _ { \theta }$ during training, and (ii) the classification decision during inference. Investigating how the model performs without propagation shows if and how valuable this addition is. Figure 6 shows how propagation affects both training and inference. ”Never” denotes the case where no propagation is used; essentially we train and apply a standard multilayer perceptron (MLP) $f _ { \theta }$ using the features only. ”Training” denotes the case where we use APPNP during training to learn $f _ { \theta }$ ; at inference time, however, only $f _ { \theta }$ is used to predict the class labels. ”Inference”, in contrast, denotes the case where $f _ { \theta }$ is trained without APPNP (i.e. standard MLP on features). This pretrained network with fixed weights is then used with APPNP’s propagation for inference. Finally, ”Inf. & Training” denotes the regular APPNP, which always uses propagation.
152
+
153
+ The best results are achieved with regular APPNP, which validates our approach. However, on most datasets the accuracy decreases surprisingly little when propagating only during inference. Skipping propagation during training can significantly reduce training time for large graphs as all nodes can be handled independently. This also shows that our model can be combined with pretrained neural networks that do not incorporate any graph information and still significantly improve their accuracy. Moreover, Figure 6 shows that just propagating during training can also lead to large improvements. This indicates that our model can also be applied to online/inductive learning where only the features and not the neighborhood information of an incoming (previously unobserved) node are available.
154
+
155
+ # 7 CONCLUSION
156
+
157
+ In this paper we have introduced personalized propagation of neural predictions (PPNP) and its fast approximation, APPNP. We derived this model by considering the relationship between GCN and PageRank and extending it to personalized PageRank. This simple model decouples prediction and propagation and solves the limited range problem inherent in many message passing models without introducing any additional parameters. It uses the information from a large, adjustable (via the teleport probability $\alpha$ ) neighborhood for classifying each node. The model is computationally efficient and outperforms several state-of-the-art methods for semi-supervised classification on multiple graphs in the most thorough study which has been done for GCN-like models so far.
158
+
159
+ For future work it would be interesting to combine PPNP with more complex neural networks used e.g. in computer vision or natural language processing. Furthermore, faster or incremental approximations of personalized PageRank (Bahmani et al., 2010; 2011; Lofgren et al., 2014) and more sophisticated propagation schemes would also benefit the method.
160
+
161
+ # ACKNOWLEDGEMENTS
162
+
163
+ This research was supported by the German Research Foundation, grant GU 1409/2-1.
164
+
165
+ # REFERENCES
166
+
167
+ Sami Abu-El-Haija, Amol Kapoor, Bryan Perozzi, and Joonseok Lee. N-GCN: Multi-scale Graph Convolution for Semi-supervised Node Classification. In International Workshop on Mining and Learning with Graphs (MLG), 2018a.
168
+ Sami Abu-El-Haija, Bryan Perozzi, Rami Al-Rfou, and Alex Alemi. Watch Your Step: Learning Node Embeddings via Graph Attention. In NeurIPS, 2018b.
169
+ Bahman Bahmani, Abdur Chowdhury, and Ashish Goel. Fast Incremental and Personalized PageRank. VLDB, 2010.
170
+ Bahman Bahmani, Kaushik Chakrabarti, and Dong Xin. Fast Personalized PageRank on MapReduce. In SIGMOD, 2011.
171
+ Aleksandar Bojchevski and Stephan Gunnemann. Deep Gaussian Embedding of Graphs: Unsuper- ¨ vised Inductive Learning via Ranking. ICLR, 2018.
172
+ Aleksandar Bojchevski, Oleksandr Shchur, Daniel Zugner, and Stephan G ¨ unnemann. NetGAN: ¨ Generating Graphs via Random Walks. In ICML, 2018.
173
+ Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral Networks and Deep Locally Connected Networks on Graphs. ICLR, 2014.
174
+ Eliav Buchnik and Edith Cohen. Bootstrapped Graph Diffusions: Exposing the Power of Nonlinearity. Proceedings of the ACM on Measurement and Analysis of Computing Systems (POMACS), 2 (1):1–19, April 2018.
175
+ Jie Chen, Tengfei Ma, and Cao Xiao. FastGCN: Fast Learning with Graph Convolutional Networks via Importance Sampling. ICLR, 2018.
176
+ Zhengdao Chen, Lisha Li, and Joan Bruna. Supervised Community Detection with Line Graph Neural Networks. In ICLR, 2019.
177
+ Hanjun Dai, Zornitsa Kozareva, Bo Dai, Alexander J. Smola, and Le Song. Learning Steady-States of Iterative Algorithms over Graphs. In ICML, 2018.
178
+ Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional Neural Networks on ¨ Graphs with Fast Localized Spectral Filtering. In NIPS, 2016.
179
+ David K. Duvenaud, Dougal Maclaurin, Jorge Aguilera-Iparraguirre, Rafael Gomez-Bombarelli, ´ Timothy Hirzel, Alan Aspuru-Guzik, and Ryan P. Adams. Convolutional Networks on Graphs for ´ Learning Molecular Fingerprints. In NIPS, 2015.
180
+
181
+ Justin Gilmer, Samuel S. Schoenholz, Patrick F. Riley, Oriol Vinyals, and George E. Dahl. Neural Message Passing for Quantum Chemistry. In ICML, 2017.
182
+
183
+ Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In AISTATS, 2010.
184
+
185
+ Aditya Grover and Jure Leskovec. node2vec: Scalable Feature Learning for Networks. In KDD, 2016.
186
+
187
+ William L. Hamilton, Zhitao Ying, and Jure Leskovec. Inductive Representation Learning on Large Graphs. In NIPS, 2017.
188
+
189
+ Taher H. Haveliwala. Topic-sensitive PageRank. In WWW, 2002.
190
+
191
+ Tatsuro Kawamoto, Masashi Tsubaki, and Tomoyuki Obuchi. Mean-field theory of graph neural networks in graph partitioning. In NeurIPS, 2018.
192
+
193
+ Steven M. Kearnes, Kevin McCloskey, Marc Berndl, Vijay S. Pande, and Patrick Riley. Molecular graph convolutions: moving beyond fingerprints. Journal of Computer-Aided Molecular Design, 30(8):595–608, 2016.
194
+
195
+ Diederik P. Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. ICLR, 2015.
196
+
197
+ Thomas N. Kipf and Max Welling. Semi-Supervised Classification with Graph Convolutional Networks. ICLR, 2017.
198
+
199
+ Jure Leskovec, Jon Kleinberg, and Christos Faloutsos. Graphs over Time: Densification Laws, Shrinking Diameters and Possible Explanations. In KDD, 2005.
200
+
201
+ Qimai Li, Zhichao Han, and Xiao-Ming Wu. Deeper Insights Into Graph Convolutional Networks for Semi-Supervised Learning. In AAAI, 2018.
202
+
203
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard S. Zemel. Gated Graph Sequence Neural Networks. In ICLR, 2016.
204
+
205
+ Peter Lofgren, Siddhartha Banerjee, Ashish Goel, and Seshadhri Comandur. FAST-PPR: scaling personalized pagerank estimation for large graphs. In KDD, 2014.
206
+
207
+ 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 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.
208
+
209
+ Andrew Kachites McCallum, Kamal Nigam, Jason Rennie, and Kristie Seymore. Automating the construction of internet portals with machine learning. Information Retrieval, 3(2):127–163, 2000.
210
+
211
+ Federico Monti, Davide Boscaini, Jonathan Masci, Emanuele Rodola, Jan Svoboda, and Michael M. Bronstein. Geometric Deep Learning on Graphs and Manifolds Using Mixture Model CNNs. In CVPR, 2017.
212
+
213
+ Galileo Namata, Ben London, Lise Getoor, and Bert Huang. Query-driven Active Surveying for Collective Classification. In International Workshop on Mining and Learning with Graphs (MLG), 2012.
214
+
215
+ Sharad Nandanwar and M. N. Murty. Structural Neighborhood Based Classification of Nodes in a Network. In KDD, 2016.
216
+
217
+ Mathias Niepert, Mohamed Ahmed, and Konstantin Kutzkov. Learning Convolutional Neural Networks for Graphs. In ICML, 2016.
218
+
219
+ Lawrence Page, Sergey Brin, Rajeev Motwani, and Terry Winograd. The pagerank citation ranking: Bringing order to the web. Technical report, Stanford InfoLab, 1998.
220
+
221
+ Bryan Perozzi, Rami Al-Rfou, and Steven Skiena. DeepWalk: online learning of social representations. In KDD, 2014.
222
+
223
+ Trang Pham, Truyen Tran, Dinh Q. Phung, and Svetha Venkatesh. Column Networks for Collective Classification. In AAAI, 2017.
224
+
225
+ Jiezhong Qiu, Yuxiao Dong, Hao Ma, Jian Li, Kuansan Wang, and Jie Tang. Network Embedding as Matrix Factorization: Unifying DeepWalk, LINE, PTE, and node2vec. In ACM International Conference on Web Search and Data Mining (WSDM), 2018.
226
+
227
+ F. Scarselli, M. Gori, Ah Chung Tsoi, M. Hagenbuchner, and G. Monfardini. The Graph Neural Network Model. IEEE Transactions on Neural Networks, 20(1):61–80, January 2009.
228
+
229
+ Michael Sejr Schlichtkrull, Thomas N. Kipf, Peter Bloem, Rianne van den Berg, Ivan Titov, and Max Welling. Modeling Relational Data with Graph Convolutional Networks. In Extended Semantic Web Conference (ESWC), 2018.
230
+
231
+ Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Gallagher, and Tina Eliassi-Rad. Collective Classification in Network Data. AI Magazine, 29(3):93–106, 2008.
232
+
233
+ Oleksandr Shchur, Maximilian Mumme, Aleksandar Bojchevski, and Stephan Gunnemann. Pitfalls¨ of Graph Neural Network Evaluation. In Relational Representation Learning Workshop (R2L 2018), NeurIPS, 2018.
234
+
235
+ Jian Tang, Meng Qu, Mingzhe Wang, Ming Zhang, Jun Yan, and Qiaozhu Mei. LINE: Large-scale Information Network Embedding. In WWW, 2015.
236
+
237
+ Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Li ´ o, and Yoshua \` Bengio. Graph Attention Networks. ICLR, 2018.
238
+
239
+ 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.
240
+
241
+ Zhilin Yang, William W. Cohen, and Ruslan Salakhutdinov. Revisiting Semi-Supervised Learning with Graph Embeddings. In ICML, 2016.
242
+
243
+ Rex Ying, Ruining He, Kaifeng Chen, Pong Eksombatchai, William L. Hamilton, and Jure Leskovec. Graph Convolutional Neural Networks for Web-Scale Recommender Systems. KDD, 2018.
244
+
245
+ # A EXISTENCE OF $\Pi _ { \mathrm { P P R } }$
246
+
247
+ The matrix
248
+
249
+ $$
250
+ \Pi _ { \mathrm { p p r } } = \alpha \left( I _ { n } - ( 1 - \alpha ) \hat { \tilde { A } } \right) ^ { - 1 }
251
+ $$
252
+
253
+ exists iff the determinant $\operatorname* { d e t } ( I _ { n } - ( 1 - \alpha ) { \hat { \tilde { A } } } ) \neq 0$ , which is the case iff $\operatorname* { d e t } ( \hat { \tilde { A } } - \frac { 1 } { 1 - \alpha } I _ { n } ) \neq 0$ , i.e. iff $\frac { 1 } { 1 - \alpha }$ is not an eigenvalue of $\hat { \tilde { A } }$ . This value is always larger than 1 since the teleport probability $\alpha \in \ ( 0 , 1 ]$ . Furthermore, the symmetrically normalized matrix $\hat { \tilde { A } }$ has the same eigenvalues as the row-stochastic matrix $\tilde { A } _ { \mathrm { r w } }$ . This can be shown by multiplying the eigenvalue equation $\hat { \tilde { A } } v = \lambda v$ with $\tilde { D } ^ { - 1 / 2 }$ from left and substituting $\pmb { w } = \tilde { \pmb { D } } ^ { - 1 / 2 } \pmb { v }$ . This also shows that the eigenvectors of $\hat { \tilde { A } }$ are the eigenvectors of $\tilde { A } _ { \mathrm { r w } }$ scaled by $\tilde { D } ^ { 1 / 2 }$ . The largest eigenvalue of a row-stochastic matrix is 1, as can be proven using the Gershgorin circle theorem. Hence, $\frac { 1 } { 1 - \alpha }$ cannot be an eigenvalue and $\Pi _ { \mathrm { p p r } }$ always exists.
254
+
255
+ # B CONVERGENCE OF APPNP
256
+
257
+ APPNP uses the iterative equation
258
+
259
+ $$
260
+ { \cal Z } ^ { ( k + 1 ) } = ( 1 - \alpha ) \hat { \tilde { \cal A } } { \cal Z } ^ { ( k ) } + \alpha { \cal H } .
261
+ $$
262
+
263
+ After the $k$ -th propagation step, the resulting predictions are
264
+
265
+ $$
266
+ \pmb { Z } ^ { ( k ) } = \left( ( 1 - \alpha ) ^ { k } \hat { \tilde { \mathbf { A } } } ^ { k } + \alpha \sum _ { i = 0 } ^ { k - 1 } ( 1 - \alpha ) ^ { i } \hat { \tilde { \mathbf { A } } } ^ { i } \right) \pmb { H } .
267
+ $$
268
+
269
+ If we take the limit $k \infty$ the left term tends to 0 and the right term becomes a geometric series. The series converges since $\alpha \in ( 0 , 1 ]$ and $\hat { \tilde { A } }$ is symmetrically normalized and therefore $\operatorname* { d e t } ( \hat { \tilde { A } } ) \leq 1$ , resulting in
270
+
271
+ $$
272
+ \pmb { Z } ^ { ( \infty ) } = \alpha \left( \pmb { I _ { n } } - ( 1 - \alpha ) \hat { \tilde { A } } \right) ^ { - 1 } \pmb { H } ,
273
+ $$
274
+
275
+ which is the equation for calculating (exact) PPNP.
276
+
277
+ # C EXPERIMENTAL DETAILS
278
+
279
+ ![](images/922f154318507fafbeb2f3ed5f38a53906d5fadd66a576d6fed279871fc59744.jpg)
280
+ Figure 7: Illustration of the node sampling procedure.
281
+
282
+ The sampling procedure is illustrated in Figure 7. The data is first split into a visible and a test set. For the visible set 1500 nodes were sampled for the citation graphs and 5000 for MICROSOFT ACADEMIC. The test set contains all remaining nodes. We use three different label sets in each experiment: A training set of 20 nodes per class, an early stopping set of 500 nodes and either a validation or test set. The validation set contains the remaining nodes of the visible set. We use 20 random seeds for determining the splits. These seeds are drawn once and fixed across runs to facilitate comparisons. We use one set of seeds for the validation splits and a different set for the test splits. Each experiment is run with 5 random initializations on each data split, leading to a total of 100 runs per experiment.
283
+
284
+ The early stopping criterion uses a patience of $p = 1 0 0$ and an (unreachably high) maximum of $n = 1 0 0 0 0$ epochs. The patience is reset whenever the accuracy increases or the loss decreases on the early stopping set. We choose the parameter set achieving the highest accuracy and break ties by selecting the lowest loss on this set. This criterion was inspired by GAT (Velickovi ˇ c et al., 2018). ´
285
+
286
+ We used TensorFlow (Mart´ın Abadi et al., 2015) for all experiments except bootstrapped feature propagation. All uncertainties and confidence intervals correspond to a confidence level of $9 5 \%$ and were calculated by bootstrapping with 1000 samples.
287
+
288
+ We use the Adam optimizer with a learning rate of $l = 0 . 0 1$ and cross-entropy loss for all models (Kingma & Ba, 2015). Weights are initialized as described in Glorot & Bengio (2010). The feature matrix is $L _ { 1 }$ normalized per row.
289
+
290
+ # D BASELINE HYPERPARAMETERS
291
+
292
+ Vanilla GCN uses the original settings of two layers with $h = 1 6$ hidden units, no dropout on the adjacency matrix, $L _ { 2 }$ regularization parameter $\lambda { \stackrel { \cdot } { = } } 5 \times 1 0 ^ { - 4 }$ and the original early stopping with a maximum of 200 steps and a patience of 10 steps based on the loss.
293
+
294
+ The optimized GCN uses two layers with $h = 6 4$ hidden units, dropout on the adjacency matrix with $d = 0 . 5$ and $L _ { 2 }$ regularization parameter $\lambda = 0 . 0 2$ .
295
+
296
+ N-GCN uses $h = 1 6$ hidden units, $R = 4$ heads per random walk length and random walks of up to $K - 1 = 4$ steps. It uses $L _ { 2 }$ regularization on all layers with $\lambda = \overline { { 1 } } \times 1 0 ^ { - 5 }$ and the attention variant for merging the predictions (Abu-El-Haija et al., 2018a). Note that this model effectively uses $R K h = 3 2 0$ hidden units, which is 5 times as many units compared to GCN, GAT, and PPNP.
297
+
298
+ For GAT we use the (well optimized) original hyperparameters, except the $L _ { 2 }$ regularization parameter $\lambda = 0 . 0 0 1$ and learning rate $l = 0 . 0 1$ . As opposed to the original paper, we do not use different hyperparameters on PUBMED, as described in our experimental setup.
299
+
300
+ Bootstrapped feature propagation uses a return probability of $\alpha = 0 . 2$ , 10 propagation steps, 10 bootstrapping (self-training) steps with $r = 0 . 1 n$ training nodes added per step. We add the training nodes with the lowest entropy on the predictions. The number of nodes added per class is based on the class proportions estimated using the predictions. Note that this model does not include any stochasticity in its initialization. We therefore only run it once per train/early stopping/test split.
301
+
302
+ For the jumping knowledge networks we use the concatenation variant with three layers and $h = 6 4$ hidden units per layer. We apply $L _ { 2 }$ regularization with $\lambda = 0 . 0 0 1$ on all layers and perform dropout with $d = 0 . 5$ on all layers but not on the adjacency matrix.
303
+
304
+ # E F1 SCORE
305
+
306
+ Table 4: Average macro F1 score with uncertainties showing the $9 5 \%$ confidence level calculated by bootstrapping. PPNP achieves the highest F1 score on all datasets investigated.
307
+
308
+ <table><tr><td>Model</td><td>CITESEER</td><td>CORA-ML</td><td>PUBMED</td><td>MS ACADEMIC</td></tr><tr><td>V. GCN</td><td>0.7002±0.0043</td><td>0.8205±0.0027</td><td>0.7801 ± 0.0038</td><td>0.9000±0.0008</td></tr><tr><td>GCN</td><td>0.7065 ± 0.0037</td><td>0.8289 ± 0.0030</td><td>0.7883 ± 0.0032</td><td>0.9045 ± 0.0008</td></tr><tr><td>N-GCN</td><td>0.7021 ± 0.0035</td><td>0.8183 ± 0.0024</td><td>0.7773 ± 0.0040</td><td>0.9144 ± 0.0012</td></tr><tr><td>GAT</td><td>0.7062 ± 0.0029</td><td>0.8359 ± 0.0025</td><td>0.7777 ± 0.0040</td><td>0.8917 ± 0.0007</td></tr><tr><td>JK</td><td>0.6914 ± 0.0043</td><td>0.8202 ± 0.0026</td><td>0.7799 ± 0.0039</td><td>0.8985 ±0.0012</td></tr><tr><td>Bt.FP</td><td>0.6789 ± 0.0055</td><td>0.8026 ± 0.0082</td><td>0.7448 ± 0.0079</td><td>0.8997 ± 0.0018</td></tr><tr><td>PPNP*</td><td>0.7102 ± 0.0041</td><td>0.8454 ± 0.0021</td><td></td><td></td></tr><tr><td>APPNP</td><td>0.7105 ± 0.0038</td><td>0.8429 ±0.0022</td><td>0.7966 ± 0.0031</td><td>0.9184 ± 0.0009</td></tr></table>
309
+
310
+ ∗out of memory on PUBMED, MS ACADEMIC (see efficiency analysis in Section 3)
311
+
312
+ # F PAIRED $t$ -TEST
313
+
314
+ Table 5: p-value of the paired $t$ -test with respect to accuracy.
315
+
316
+ <table><tr><td>Model</td><td>CITESEER</td><td>CORA-ML</td><td>PUBMED</td><td>MS ACADEMIC</td></tr><tr><td>PPNP</td><td>1.02 ×10-3</td><td>5.96×10-14</td><td></td><td></td></tr><tr><td>APPNP</td><td>1.77 × 10-2</td><td>4.27 ×10-9</td><td>2.19 ×10-15</td><td>5.93 × 10-13</td></tr></table>
317
+
318
+ Table 6: p-value of the paired $t$ -test with respect to F1 score.
319
+
320
+ <table><tr><td>Model</td><td>CITESEER</td><td>CORA-ML</td><td>PUBMED</td><td>MS ACADEMIC</td></tr><tr><td>PPNP</td><td>4.49×10-2</td><td>4.50×10-14</td><td></td><td></td></tr><tr><td>APPNP</td><td>2.32 ×10-2</td><td>1.07 × 10-8</td><td>8.70 × 10-14</td><td>1.99 × 10-8</td></tr></table>
321
+
322
+ ![](images/f5436eb85eb29bfa0226b787ea9e7661e7b18c50f0879781bcd8952e22d5f919.jpg)
323
+ Figure 8: Validation accuracy of APPNP for varying numbers of neural network (NN) layers. Deep NNs do not improve the accuracy, which is probably due to the simple bag-of-words features and the small training set size.
324
+
325
+ # H TRAINING SET SIZE
326
+
327
+ ![](images/1df3e15b9e80568ac6bbedbc6c5497b5b9982cec9d08137aa5b32a1273986c1f.jpg)
328
+ Figure 9: Accuracy for different training set sizes on CITESEER.
329
+
330
+ ![](images/c9a16536a4e516b2d58581e5824a4760c7222b772af1594436a217beb5a80ac1.jpg)
331
+ Figure 10: Accuracy for different training set sizes on PUBMED.
332
+
333
+ ![](images/5389f5b7b8ef0d13b1c87be6e2841f435778ee204063bc1b91ca6aa3f22410a4.jpg)
334
+ Figure 11: Accuracy for different training set sizes on MICROSOFT ACADEMIC.
335
+
336
+ ![](images/0072cf936b72a26218ba2729a695270a0013a7756cf97608c3cdfb41adef98a8.jpg)
337
+ Figure 12: $\Delta$ Accuracy $( \% )$ denotes the average improvement in percentage points of APPNP over GCN depending on the distance (number of hops) from the training nodes on CORA-ML. $\bar { n }$ denotes the average number of nodes at each distance. The improvement increases with distance.
338
+
339
+ ![](images/2fd5099893deec0cdde802e9feb63de47fc5c089a3e5393abf3aaeca4685822b.jpg)
340
+ Figure 13: $\Delta$ Accuracy $( \% )$ denotes the average improvement in percentage points of APPNP over GCN depending on the distance (number of hops) from the training nodes on different graphs. $\bar { n }$ denotes the average number of nodes at each distance over different splits.
md/train/H1lBj2VFPS/H1lBj2VFPS.md ADDED
@@ -0,0 +1,343 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LINEAR SYMMETRIC QUANTIZATION OF NEURAL NETWORKS FOR LOW-PRECISION INTEGER HARDWARE
2
+
3
+ Xiandong $\mathbf { Z } \mathbf { h } \mathbf { a } \mathbf { 0 } ^ { 1 , 2 }$ , Ying Wang1,3∗ , Xuyi Cai1,2, Cheng Liu1, Lei Zhang1
4
+
5
+ Institute of Computing Technology, Chinese Academy of Sciences1
6
+ University of Chinese Academy of Sciences2
7
+ State Key Laboratory of Computer Architecture3
8
+ {zhaoxiandong,wangying2009,caixuyi18s,liucheng,zlei}@ict.ac.cn
9
+
10
+ # ABSTRACT
11
+
12
+ With the proliferation of specialized neural network processors that operate on low-precision integers, the performance of Deep Neural Network inference becomes increasingly dependent on the result of quantization. Despite plenty of prior work on the quantization of weights or activations for neural networks, there is still a wide gap between the software quantizers and the low-precision accelerator implementation, which degrades either the efficiency of networks or that of the hardware for the lack of software and hardware coordination at designphase. In this paper, we propose a learned linear symmetric quantizer for integer neural network processors, which not only quantizes neural parameters and activations to low-bit integer but also accelerates hardware inference by using batch normalization fusion and low-precision accumulators (e.g., 16-bit) and multipliers (e.g., 4-bit). We use a unified way to quantize weights and activations, and the results outperform many previous approaches for various networks such as AlexNet, ResNet, and lightweight models like MobileNet while keeping friendly to the accelerator architecture. Additional, we also apply the method to object detection models and witness high performance and accuracy in YOLO-v2. Finally, we deploy the quantized models on our specialized integer-arithmetic-only DNN accelerator to show the effectiveness of the proposed quantizer. We show that even with linear symmetric quantization, the results can be better than asymmetric or non-linear methods in 4-bit networks. In evaluation, the proposed quantizer induces less than $0 . 4 \%$ accuracy drop in ResNet18, ResNet34, and AlexNet when quantizing the whole network as required by the integer processors.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Deep neural networks have shown excellent performance on various computer vision and natural language processing tasks, such as classification (Krizhevsky et al., 2012; Simonyan & Zisserman, 2015; He et al., 2016), object detection (Girshick, 2015; Redmon et al., 2016; He et al., 2017), segmentation (Long et al., 2015; Noh et al., 2015), machine translation (Zhang et al., 2018b), speech recognition (Nassif et al., 2019), etc. While the past few years witnessed the success of DNNs on cloud and server-end computers, neural networks have been recently pushed to embedded and mobile areas to enable edge intelligence. For these scenarios, the power provision and computational strength on the edge computing devices are limited. As a result, it is essential to have more efficient network architectures and less expensive inference overhead. Therefore, there is increasing attention from the research community to study the compression of modern deep neural networks that are typically over-parameterized and computationally costly.
17
+
18
+ Several categories of approaches are proposed to decrease the computational overhead of neural networks, such as lightweight neural network architectures (Howard et al., 2017), neural architecture search (NAS) (Elsken et al., 2018), and network pruning (Han et al., 2015; 2016; Wen et al., 2016;
19
+
20
+ Table 1: Comparison between different quantizers: All-Layer $( A L )$ denotes quantizing all the parameters of all the operators in networks, including weights, bias, activations, and the scaling factor for low-precision networks; $\pmb { B N }$ donates that the BN operation is only invoked in training but merged into weights and induces no overhead in integer inference; Linear-Symmetric $( L S )$ denotes linear symmetric quantization; Activation Functions $( A F )$ donates the support of Leaky $R e L U$ and activation functions besides ReLU. Structure-Intact $( S I )$ indicates the network structure is unmodified.
21
+
22
+ <table><tr><td>Method</td><td>AL</td><td>BN</td><td>LS</td><td>AFe</td><td>SI</td></tr><tr><td>Deep Compression (Han et al.,2016)b</td><td></td><td></td><td></td><td></td><td>√</td></tr><tr><td>WQ (Park et al., 2017)b</td><td></td><td></td><td></td><td></td><td>√</td></tr><tr><td>LQ-Nets (Zhang et al., 2018a)</td><td></td><td></td><td></td><td></td><td>√</td></tr><tr><td>Min-Max Linear Quantizationa</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DoReFa (Zhou et al., 2016)c</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RQ (Louizos et al., 2019)</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>WRPN (Mishra et al., 2018)</td><td></td><td></td><td>√</td><td></td><td></td></tr><tr><td>PACT (Choi, 2018)d</td><td></td><td></td><td></td><td>√</td><td></td></tr><tr><td>LLSQ(ours)</td><td>厂</td><td></td><td>√</td><td>1</td><td></td></tr></table>
23
+
24
+ a Naive linear quantization, which finds min-max value at runtime. b Clustering-based approaches to quantize weights. c DoReFa falls into linear asymmetric quantizer due to the need for offset. d In Choi (2018), they use PACT to quantize activations, and DoReFa to quantize weights. e DoReFa, RQ, WRPN, and PACT are designed for $R e L U$ , but they can be extended to support other activation functions in theory.
25
+
26
+ Molchanov et al., 2017). Besides these techniques, quantizing high-precision floating-point networks to lower bitwidth representation can also drastically decrease both the static parameters and the intermediate data generated during the network inference, resulting in reduced memory footprint and also computational intensity. And this paper focuses on the quantization of neural networks.
27
+
28
+ Quantization technique is also closely related to the implementation of specialized hardware that maps the procedure of network inference onto the energy-efficient low-precision integer or fixedpoint arithmetic circuits. In the hardware perspective, low-precision integer accelerators or processors are dominating the solutions targeted on neural network inference, especially for mobile and embedded scenarios. Google’s Tensor Processing Unit 1.0 (TPU) (Jouppi et al., 2017), Unified Deep Neural Network Accelerator (UNPU) (Lee et al., 2018), Eyeriss (Chen et al., 2018), Stripes (Judd et al., 2016), Pragmatic(Albericio et al., 2017) and many other newly proposed hardware implementations are generally reliant on the effectiveness of the underlying quantization techniques, which are especially crucial for the low-precision integer hardware designed to process binary, ternary, 4-bit or 8-bit networks. In other words, quantization is not only a method to reduce the memory footprint as in traditional work, but also a mandatory step to make the network deployable on integer hardware.
29
+
30
+ Though there is a lot of prior work that investigates low-precision quantization, they mainly target on reducing the memory overhead caused by floating or high precision data representation in the networks, but not focus on specialized integer hardware for network inference. To enable the neural network processors to work with low-precision integer operands and minimize the accuracy losses, a good network quantizer must satisfy the constraints as enlisted in Table 1.
31
+
32
+ First, all the parameters, including weights, bias, activations, partial results that eventually accumulate to an activation, and even the scaling factors, which are indispensable for low-precision networks like binary and ternary representation, must be quantized into low bitwidth integers as required by the underlying specialized hardware. In some prior work (Zhou et al., 2016; Zhu et al., 2017; Zhang et al., 2018a; Mishra et al., 2018; Choi, 2018), they either leave bias and scaling factors unquantized or keep the first and last layer in full or high precision. Besides, some designs rely on high-precision internal register or ALUs to support high-precision partial results that are generated during computation before the final output of activations or features. For example, Krishnamoorthi (2018), which quantizes the weights and activations to 8-bit, directly use 32-bit accumulators to cache the intermediate values or partial results to avoid overflows. However, for 4-bit and lower bitwidth, the integer accelerators cannot afford high bitwidth accumulators, which indicates higher silicon area and power cost. For integer-only-arithmetic, we quantize the bias to fixed-point numbers by using a straight-forward method. The value range of these numbers is wide, resulting in overflows of the low bitwidth accumulators. To overcome this problem, we quantize the bias to 8-bit and finetune the bias of the model. As shown in Figure 1, the bitwidth of accumulators can be reduced to 16-bit.
33
+
34
+ Second, the BatchNorm (BN) layer does not necessarily need to be processed during inference for the reduction of computation and memory cost. For most of the convolutional neural networks, BN layers are often after the Conv or $F C$ layers. In these situations, $B N$ can be merged into the weights and biases of the corresponding Conv or $F C$ layers. However, in Zhou et al. (2016); Zhang et al. (2018a), they use asymmetric or non-linear quantization, causing barriers to $B N$ fusion. There are two ways to overcome this obstacle. One is $\mathbf { \bar { \Sigma } } ^ { 6 6 }$ folded training”(Krishnamoorthi, 2018), which adopts BN fusion before weights quantization in every training step; the other is to use symmetric linear quantization. However, the first method doubles the training time, while the second one has no additional computational overhead, which will be introduced in Section 3.4.
35
+
36
+ Third, linear quantization is necessary for state-of-the-art accelerators. There are many non-linear quantization methods which achieve excellent bitwidth reduction efficacy and accuracy tradeoffs. In these cases, it requires additional transformation to have correct arithmetic results after quantizing the value into non-linear distribution. For example, as in Han et al. (2016); Park et al. (2017), it necessitates the operation of table lookup to have correct multiplication between quantized values. However, the linear quantization can make full use of the low-precision arithmetic components in off-the-shelf accelerators. Further, linear quantization can be divided into symmetric mode and asymmetric mode. Asymmetric quantization has one more parameter (e.g., zero-point (Krishnamoorthi, 2018)) than symmetric quantization, and it requires additional subtraction or linearoperation before multiplication. As a result, the symmetrical mode is compatible with the mainstream integer accelerator chip design and do not require the redesign of datapath in these hardware.
37
+
38
+ Fourth, different CNNs or applications usually use a variety of activation functions. For instance, the object detection model Redmon et al. (2016) typically uses Leaky ReLU. And the bottleneck of ResNet block does not use any activation function. The quantization methods are expected to be adapted to these situations. However, Zhang et al. (2018a); Park et al. (2017) only focus on the quantization of activations after ReLU. In this paper, we demonstrate our method is friendly to different activation methods such as Leaky ReLU.
39
+
40
+ Some of the previous researches change the network structure for better quantization performance, e.g., Mishra et al. (2018) double or even triple the convolutional filters to reduce accuracy degradation. For the energy-efficient integer neural network chips, it needs to remap the changed network architecture to hardware and adds to computational and memory access overhead due to the increased filters and parameters. As a result, keeping the network structure intact is important.
41
+
42
+ Concerning all the factors above, in this paper, we present a learned linear symmetric quantization (LLSQ) method and also evaluate it on a low-precision neural network accelerator through hardware-software co-design. Specifically, our mainly contributions are:
43
+
44
+ • Unlike most of other quantization methods, we quantize the whole network including the first and last layers. We also quantize bias and scaling factors, in support of the low bitwidth integer arithmetic units and accumulators on the accelerator.
45
+ We adopt learned linear symmetric quantization schemes which are hardware friendly (such as the convenience of $B N$ fusion implementation) while achieving state-of-the-art prediction accuracy. We design a specialized low-precision CNN inference accelerator to validate the methodology, which supports 2/4/8 integer operating and work with high efficiency. We then deploy our quantization model on the accelerator to illustrate the efficacy of the workflow.
46
+
47
+ # 2 MOTIVATION
48
+
49
+ Edge or embedded neural network accelerators generally have three primary design goals— smallfootprint, high-throughput/low-latency, and low-power. For different applications and scenarios, the prior researches on specialized deep learning processors are often falling into different categories: cloud-oriented hardware for warehouse machines, low power mobile processors and ultra-low power accelerators for IoT or cyber-physical devices.
50
+
51
+ For mobile and embedded usage, specialized neural network processors are becoming increasingly popular as an efficient hardware solution of inference. DianNao (Chen et al., 2014) is proposed for fast inference of DNNs and it uses 16-bit fixed-point multipliers for small silicon area and lowenergy. Later, ShiDianNao (Du et al., 2015) is introduced and it burns extremely low energy consumption by putting all weights onto the SRAM to eliminate considerable DRAM accesses. Besides, DeepBurning (Wang et al., 2016) simplifies the design flow of accelerator for different NN models. Eyeriss (Chen et al., 2018) is also another representative of low-power accelerators. And it presents a row-stationary (RS) dataflow to minimize data movement energy consumption on a spatial architecture. To further reduce computation overhead, EIE (Han et al., 2016) exploits the sparsity and low-bit compression of the NNs and achieves better throughput, energy and area efficiency. These typical edge neural network processors are accepting fixed-point data input and using fixed-point processing elements to reduce the power and chip area overhead caused by floating-point arithmetic components and memory. For the cloud scenarios, specialized architectures like TPU (Jouppi et al., 2017) and FPGA-based accelerator cards are also replacing conventional GPGPU and CPU for highthroughput inference tasks. Even for cloud-oriented inference architectures, fixed-point processing architectures like TPU are favored because they are able to deliver much higher throughput for the given power budget and silicon area overhead.
52
+
53
+ However, for the fixed-point or integer hardware targeted on neural network acceleration, quantization is prerequisite to convert the floating-point network model into the fixed-point format compatible with the specialized hardware, and it is also a critical step to ensure the accuracy of the network after conversion. Many prior quantization methods are intended to reduce the running overhead of networks but ignore the architecture and working mechanism of integer neural network processors, as illustrated in Table 1, and they sometimes face considerable accuracy losses, or performance penalty or even fail to be supported on the realistic integer datapath due to the unconsciousness of the underlying hardware. This problem becomes particularly important for the hardware that is designed to run low bitwidth networks such as binary, ternary, and 2/4-bit models. For instance, Deep compression and WQ are clustering-based quantization methods, and they still need high-precision values to represent the weights, bias, and activations. As a result, they are not compatible with the hardware that only supports low-precision computing. LQ-Nets uses non-linear quantization based on the binary code and basis vector, and it can theoretically calculate the inner products between quantized weights and activations by bitwise operations only. However, it requires intensive modifications to the design of current processors by adding a lot of look-up tables in the datapath. Further, bias and scaling factors are not quantized in PACT and WRPN, resulting in performance penalty when employing additional high-precision or float-point ALUs to deal with them. In contrast, our LLSQ is designed to ease the model quantization flow for the specialized integer neural network processors by conforming to the constraints specified in Table 1. To validate the importance of hardware-aware quantizer and software/hardware co-design, we also design a specialized CNN accelerator for wearable applications. And the specialized accelerator supports 2/4/8 integer operation and adopts the dataflow of low latency and energy design.
54
+
55
+ # 3 NETWORKS WITH LEARNED LINEAR SYMMETRIC QUANTIZATION
56
+
57
+ In this section, we firstly give the overview of the proposed quantization scheme. Then we detail the scheme including low-precision representation, quantized network training, and the deployment of quantization model on our specialized integer-only CNN accelerator for fast inference.
58
+
59
+ # 3.1 OVERVIEW OF LLSQ
60
+
61
+ Many of the previous researches focus on the quantization-aware training in GPU, showing the potential of low-bit quantization on CNNs. Han et al. (2016); Park et al. (2017); Zhang et al. (2018a) propose non-linear quantization methods but lacks of a detailed description of the hardware feasibility. Krishnamoorthi (2018) provides a quantization scheme that quantizes weights and activations into 8-bit integers and integer-arithmetic-only implementation on ARM CPUs. The method achieves evident hardware acceleration effects, but does not fully exploit lower-precision quantization. Based on the researches, we propose a quantization scheme for state-of-the-art specialized accelerators operating on low-precision integers only. Figure 1 shows an overview of the proposed scheme.
62
+
63
+ ![](images/c9cfdd978cc908a0f869aa6ced258efd9a3f69064b2bf31b5fca1215f8c520d7.jpg)
64
+ Figure 1: An overview of LLSQ: using pre-trained weights for fast convergence; Retraining of the network with quantized weights and activations; BN fusion for efficient inference; Quantization of bias and scaling factors; Deployment of the quantized model to our accelerator. As shown in this figure, weights, activations, bias, and scaling factors are quantized to low-bit integers. And the bandwidth of accumulator can be set to lower (e.g., 16-bit in our experiments).
65
+
66
+ Compared with prior work, our proposed quantization scheme pays more attention to the constraints imposed by real hardware. We use a unified learned linear symmetric quantizer to quantize weights and activations. And the quantizer has only one parameter, known as the scaling factor. Linear symmetric quantization consumes little additional resources based on the mainstream integer accelerator designs while achieving state-of-the-art accuracy in various networks. After that, we adopt BN fusion for fast inference on hardware. As for bias and scaling factors, we also quantize them to low-bitwidth integers. The integer accelerator illustrated in Figure 1 is an illustrative case of 4-bit quantization and hardware acceleration.
67
+
68
+ # 3.2 MAKING FULL USE OF THE PRE-TRAINED PARAMETERS
69
+
70
+ In experiments, we find that it is more efficient to start with the pre-trained full-precision parameters before quantization. Louizos et al. (2019); Zhou et al. (2017) use pre-trained weights for fast convergence and deployment, while Zhang et al. (2018a); Choi (2018); Cai et al. (2017) train quantized network from scratch to show the robustness of the algorithm. However, for some object detection models, the backbone models and pre-trained weights are essential to the detection performance. Redmon et al. (2016) shows that the pre-trained high-resolution classification network gives an increase of almost $4 \% m A P$ . To have better performance in classification, object detection, and other CNN based tasks, in this paper, we use pre-trained parameters to initialize the networks.
71
+
72
+ # 3.3 LOW-PRECISION REPRESENTATION AND QUANTIZATION ALGORITHM
73
+
74
+ We use channel-wise quantization for $C o n \nu$ layers and layer-wise quantization for $F C$ layers and activations. And we adopt the symmetric linear quantization to quantize weights or activations into $k$ bits words(e.g., 4-bit), which can be defined as
75
+
76
+ $$
77
+ \begin{array} { c } { { { \pmb x } ^ { q } = Q u a n t i z e _ { k } ( { \pmb x } ^ { r } \mid \alpha ) } } \\ { { { \pmb q } = \displaystyle \frac { { \pmb x } ^ { q } } { \alpha } = c l a m p ( \lfloor \displaystyle \frac { { \pmb x } ^ { r } } { \alpha } \rceil , - 2 ^ { k - 1 } , 2 ^ { k - 1 } - 1 ) } } \end{array}
78
+ $$
79
+
80
+ where $\pmb { x } ^ { r } \in \mathbb { R }$ is one kernel of weights or one layer of activations, the variable $\alpha \in \mathbb { R } ^ { + }$ is the quantization parameter, known as the scaling factor, while $\pmb { q } \in \{ - 2 ^ { k - 1 } , \dotsc , 0 , 1 , \dotsc , 2 ^ { k - 1 } - 1 \}$ is the integer values flowing in the integer accelerator and $\pmb { x } ^ { q } \in \{ - 2 ^ { k - 1 } \alpha , \dotsc , 0 , \alpha , \dotsc , ( 2 ^ { k - 1 } - 1 ) \alpha \}$ is the quantized weights or activations. Note that for activations, which are non-negative values if the ActFun is $R e L U$ , we clamp them to $[ 0 , 2 ^ { k } - 1 ]$ , resulting in $\textbf { \em q } \in \ \{ 0 , 1 , \ldots , \bar { 2 } ^ { k } - 1 \}$ and $\pmb { x } ^ { q } \in \{ 0 , \alpha , \dots , ( 2 ^ { k - 1 } - 1 ) \alpha \}$ , respectively.
81
+
82
+ As defined above, we use $\alpha$ as our quantization parameter. And we optimize it with:
83
+
84
+ $$
85
+ \alpha ^ { * } = \arg \operatorname* { m i n } _ { \alpha } \int p ( \pmb { x } ^ { r } ) | \pmb { x } ^ { q } - \pmb { x } ^ { r } | ^ { l }
86
+ $$
87
+
88
+ Table 2: Comparison of SG and EMA.
89
+
90
+ <table><tr><td>Method</td><td>VGGSmallw4a4</td><td>VGGSmallw2a2</td><td>ResNet18w4a4</td><td>ResNet18w3a3</td></tr><tr><td>EMA</td><td>93.95</td><td>92.78</td><td>69.48</td><td>66.80</td></tr><tr><td>SG</td><td>94.34</td><td>93.31</td><td>69.84</td><td>68.08</td></tr></table>
91
+
92
+ VGGSmall is trained on Cifar10 and ResNet18 is on ImageNet.
93
+
94
+ where $\mathbf { \boldsymbol { x } } ^ { r } , \mathbf { \boldsymbol { x } } ^ { q }$ are the same factors defined in Equation 1, $p ( \pmb { x } ^ { r } )$ is the probability density distribution of $\pmb { x } ^ { r }$ , and $l \in \{ 1 , 2 \}$ is an optional constraint (We use 2 in our experiments). In Figure 2, we present the relationship between quantization error and $\alpha$ . When fixing weights $\pmb { x } ^ { r }$ , we can find the optimal $\alpha ^ { * }$ by using the brute-force search approach, which induces high computation cost. Besides, the weights are updated during the re-training phase and the optimal value $\alpha ^ { * }$ changes accordingly. In other words, the optimal value for the factors is not fixed and it takes considerable computational overhead to find the dynamic optimal value.
95
+
96
+ Inspired by Zhang et al. (2018a), we find through experiments that there is no need to find the optimal value $\alpha ^ { * }$ , and it works well enough to find a near-optimal value $\tilde { \alpha } ^ { * }$ . Generally, quantization can be considered as a regularization of the networks, and the quantization parameter $\alpha$ needs only to be adjusted to a near-optimal value to preserve the network capacity.
97
+
98
+ Then the problem becomes how to find a $\tilde { \alpha } ^ { * }$ in the forward pass of the network training phase. At the beginning of training, we assign $\alpha$ an initial value. Then in every training iteration, we explore between $2 \alpha$ and $\alpha / 2$ to find a better search direction $d _ { b e t t e r } \in \{ - 1 , 0 , 1 \}$ , and use $- \alpha ^ { 2 } d _ { b e t t e r }$ as the simulated gradient (SG) of $\alpha$ which is detailed in Equation 9. The gradients of other parameters are still obtained by backpropagation algorithm. After that, we update all parameters with the gradients or simulated gradients. Another method is updating $\alpha$ by the exponential moving average (EMA). We experiment both of the methods, and the results show that SG is generally better than EMA on various networks (See Table 2). If not specifically stated, we use the SG method in experiments. The re-training process with weights and activations quantized is summarized in Step 1 of Algorithm 1.
99
+
100
+ ![](images/e686ab91bd9834460084d50fa5a530a5652517ef6dd02d9f3b062233971cf826.jpg)
101
+ Figure 2: L2 distance of quantization. The data is from weights of the first FC layer in AlexNet. As shown in the figure, the optimal $\alpha ^ { * }$ changes with the updating of weights.
102
+
103
+ # 3.4 BN LAYER FUSION OF QUANTIZED NETWORKS
104
+
105
+ As described in Section 1, merging the $B N$ layers into convolutional layers can reduce the latency of network inference by removing additional computation overhead. The operator of quantized $C o n \nu ^ { 1 }$ and $F C$ layers can be expressed as
106
+
107
+ $$
108
+ \pmb { o } = \alpha _ { a } \pmb { q } _ { a } \alpha _ { w } \pmb { q } _ { w } + b
109
+ $$
110
+
111
+ where $\alpha , \mathbf { \pmb q }$ are the same as Equation 1, $\alpha _ { a } \mathbf { q } _ { a }$ , $\alpha _ { w } \pmb { q } _ { w }$ donate the quantized activations and weights, while $b$ is the bias and $^ o$ is the output feature vector. Note that $\alpha _ { a } , \alpha _ { w }$ and $b$ are full precision values. And the $B N$ layer can be formulated as follows:
112
+
113
+ $$
114
+ { \pmb y } = \frac { { \pmb o } - { \pmb \mu } } { \sqrt { \sigma ^ { 2 } + \epsilon } } \gamma + \beta
115
+ $$
116
+
117
+ where $\mu$ and $\sigma ^ { 2 }$ are EMA statistics, $\gamma$ and $\beta$ are learned parameters in $B N$ layers.
118
+
119
+ Obviously, we can merge $B N$ layers and figure out the corrected parameters:
120
+
121
+ $$
122
+ \hat { \alpha } _ { w } = \zeta \alpha _ { w } ; ~ \hat { b } = ( b - \mu ) \zeta + \beta ; ~ \zeta = \frac { \gamma } { \sqrt { \sigma ^ { 2 } + \epsilon } }
123
+ $$
124
+
125
+ # 3.5 BIAS AND SCALING FACTOR QUANTIZATION FOR LOW-BIT INTEGER ONLY ARITHMETIC
126
+
127
+ Further, the outputs of layers are quantized according to Equation 1. For integer-only-arithmetic, the bias use $\alpha _ { a } \alpha _ { w }$ as its scaling factor. And for the multiplier $\frac { \alpha _ { a } \alpha _ { w } } { \alpha _ { o } }$ , we use bit-shift quantization (See Equation 10) so that no multiplication but bit-shift operation is needed in hardware.
128
+
129
+ $$
130
+ \begin{array} { c } { { \alpha _ { o } { \bf q } _ { o } = \alpha _ { a } { \bf q } _ { a } \hat { \alpha } _ { w } { \bf q } _ { w } + \hat { b } } } \\ { { { \displaystyle \bf q } _ { o } = \frac { \alpha _ { a } \hat { \alpha } _ { w } } { \alpha _ { o } } ( { \bf q } _ { a } { \bf q } _ { w } + { \bf q } _ { b } ) } } \\ { { { \displaystyle \alpha _ { b h e r e } q _ { b } = c l a m p ( \bigl \lfloor \frac \hat { b } { \alpha _ { a } \hat { \alpha } _ { w } } \bigr \rceil , - 2 ^ { k _ { b } - 1 } , 2 ^ { k _ { b } - 1 } - 1 ) } } } \end{array}
131
+ $$
132
+
133
+ Note that $\alpha _ { a } \alpha _ { w }$ is a very small number, resulting in large quantization noise when adopting the clamp operation. In addition, the quantization of the scaling factors $\alpha$ can also raise the quantization noise of weights and activations. Parameter re-training summarized in Step 2 of Algorithm 1 is required.
134
+
135
+ In the re-training phase, we adopt STE (Bengio et al., 2013) to realize the non-differentiable quantization function.
136
+
137
+ For weights and bias, we have
138
+
139
+ $$
140
+ \frac { \partial y } { \partial w ^ { q } } \simeq \frac { \partial y } { \partial w ^ { r } } ; \frac { \partial y } { \partial b ^ { q } } \simeq \frac { \partial y } { \partial b ^ { r } }
141
+ $$
142
+
143
+ For activations, we have
144
+
145
+ $$
146
+ \frac { \partial y } { \partial a ^ { q } } \simeq \left\{ \begin{array} { l l } { \frac { \partial y } { \partial a ^ { r } } } & { i f 0 \leq a ^ { r } \leq ( 2 ^ { k } - 1 ) \alpha } \\ { 0 } & { o t h e r w i s e } \end{array} \right.
147
+ $$
148
+
149
+ # 4 EXPERIMENTAL RESULTS
150
+
151
+ In this section, three sets of experiments on Cifar10, ImageNet and Pascal VOC datasets are presented. First, we conduct our proposed learned linear symmetric quantization (LLSQ) on weights and activations, leaving the first and last layers in full precision for a fair comparison with Zhang et al. (2018a). Second, we quantize the whole networks including the first and last layers, which is referred as LLSQF (LLSQ for Full network). Finally, we quantize the remaining bias and scaling factors. LLSQ is implemented in PyTorch (Paszke et al., 2017), and most of the baselines it uses in evaluation are from PyTorch Model $Z _ { 0 0 } { } ^ { 2 }$ .
152
+
153
+ # 4.1 QUANTIZATION OF WEIGHTS AND ACTIVATIONS
154
+
155
+ We firstly employ the VGG-Small network on Cifar10 to verify the LLSQ method. After that, we use AlexNet (Krizhevsky et al., 2012), ResNet18, ResNet34 (He et al., 2016), particularly the lightweight and hard-to-compress network architecture of MobileNet (Howard et al., 2017; Sandler et al., 2018) etc. to conduct more detailed experiments on the ImageNet dataset. Finally, we also quantize YOLOv2 (Redmon & Farhadi, 2017) to demonstrate that LLSQ also works well for complicated applications and especially the task adopting the activation functions like Leaky ReLU other than ReLU used in previous work.
156
+
157
+ # VGG-SMALL ON CIFAR10
158
+
159
+ The VGG-Small architecture is the same with Louizos et al. (2019); Zhang et al. (2018a), consisting of six Conv layers, three MaxPool layers, and one $F C$ layer. We adopt a cosine learn rate scheduler to train the VGG-Small reference and the quantized models. Specifically, we train the reference network for 400 epochs using an initial learning rate of 2e-2. And for the training of the quantized network, we use a warmup learning rate scheduler in the first ten epochs with an initial learning rate of 2e-3. In all quantization experiments, the total training epochs are 100. The VGG-Small quantization results are provided in Table 3. With 3-bit weights and 3-bit activations, the accuracy using our method is better than state-of-the-art method, LQ-Nets. And even when the first and last layers are all quantized in the same way, the loss of accuracy is minimal.
160
+
161
+ Table 3: Comparison with the state-of-the-art low-bit quantization methods on CIFAR-10. The bitwidth for weights $( { \pmb w } )$ , activations $\mathbf { \Pi } ( \mathbf { a } )$ , bias $( b )$ and scaling factor $( \alpha )$ are given.
162
+
163
+ <table><tr><td>Method</td><td>#Bits wla/b/α</td><td>Acc(%)</td><td>Degradation(%)</td></tr><tr><td rowspan="3">LQ-Nets* (Zhang et al., 2018a)</td><td>Reference</td><td>93.8</td><td></td></tr><tr><td>3/3</td><td>93.8</td><td>0.0</td></tr><tr><td>2/2</td><td>93.5</td><td>0.3</td></tr><tr><td rowspan="3">RQ (Louizos et al., 2019)</td><td>Reference</td><td>93.05</td><td></td></tr><tr><td>8/8</td><td>93.30</td><td>-0.25</td></tr><tr><td>4/4 2/2</td><td>91.57</td><td>1.48 2.31</td></tr><tr><td rowspan="4">LLSQ*(ours)</td><td>Reference</td><td>90.92 93.34</td><td></td></tr><tr><td>4/4</td><td>94.34</td><td>-1.00</td></tr><tr><td>3/3</td><td>94.02</td><td>-0.68</td></tr><tr><td>2/2</td><td>93.31</td><td>0.03</td></tr><tr><td rowspan="4">LLSQF(ours)</td><td>4/4</td><td>94.30</td><td>-0.96</td></tr><tr><td>3/3</td><td>94.07</td><td>-0.73</td></tr><tr><td>2/2</td><td>93.12</td><td>0.22</td></tr><tr><td>4/4/8/8</td><td>93.84</td><td>-0.50</td></tr></table>
164
+
165
+ \* first and last layer in full precision
166
+
167
+ # IMAGENET DATASET
168
+
169
+ We then quantize AlexNet, ResNet18, ResNet34 and MobileNetv2 on ILSVRC2012 dataset with different bitwidth configuration to demonstrate the effectiveness of the method. All of the pretrained float-point weights except MobileNetv $2 ^ { 3 }$ are downloaded from the PyTorch Model Zoo, and they are trained for 90 epochs with a step learning rate scheduler. After loading the pre-trained weights, we employ a warmup learning scheduler in the first three epochs and the cosine scheduler in the remained 57 epochs with an initial learning rate of 2e-2.
170
+
171
+ As shown in Figure 3a, when quantizing both weights and activations, our degradation of accuracy is significantly smaller than LQ-Nets, PACT, and RQ. Especially, LLSQ outperforms the baselines when quantizing weights and activations into 4-bit. And it also outperforms other non-linear quantization methods with different bitwidth. Figure 3b shows that even with the first and last layers quantized, it can still achieve near baseline performance. In overall, the accuracy drop is less than $0 . 4 \%$ in ResNet18, ResNet34, and AlexNet when quantizing the whole network. We also quantize MobileNetv2, a more compact network, and obtain results that are significantly better than RQ. Please check Table 7 for detailed results.
172
+
173
+ # OBJECT DETECTION ON PASCAL VOC
174
+
175
+ We also apply the proposed LLSQ to YOLOv2. The backbone of YOLOv2 is Darknet-19, and its activation function is Leaky ReLU, so that the activations contain negative values. For YOLOv2 on Pascal VOC, we adopt the same quantization configuration (See Section 3.3) of the weights to the activations. Results are listed in Table 4. As shown in the table, LLSQ induces minor losses of $m A P$ in different bitwidth presentation. For comparison, we also quantize the activations into signed 5-bit integers using PACT, and consequently face considerable mAP losses $( 5 4 . 8 m A P )$ . Please note that we use the open-source PyTorch implementation of YOLOv2 4 as the baseline. We train the quantized model for 170 epochs (2/3 of baseline) with an initial learning rate of 1e-4 (1/10 of baseline).
176
+
177
+ (a) Comparison with other state-of-art methods.
178
+ Lower is better.
179
+
180
+ ![](images/c77a4b3d1753549da14a63fb83a3565751683e1648bc66bbb2df309b4224a3cf.jpg)
181
+ Figure 3: Quantization results on different networks.
182
+
183
+ ![](images/a97efd5b33c1146e456371e6660c6f9710b806e60f52af3c35caf2df57ec3546.jpg)
184
+
185
+ Table 4: LLSQ on YOLOv2 detector.
186
+
187
+ <table><tr><td>bitwidth</td><td>mAP</td><td>aero</td><td>bike</td><td>bird</td><td>boat</td><td>bottle</td><td>bus</td><td>car</td><td>cat</td><td>chair</td><td>cow</td><td>table</td><td>dog</td><td>horse</td><td>mbike</td><td>person plant</td><td></td><td>sheep</td><td>sofa</td><td>train</td><td>tv</td></tr><tr><td>FP32</td><td>73.2</td><td>78.9</td><td>80.0</td><td>72.8</td><td>62.3</td><td>47.1</td><td>79.2</td><td>79.6</td><td>85.7</td><td>54.4</td><td>79.7</td><td>72.2</td><td>83.3</td><td>81.1</td><td>79.2</td><td>74.8</td><td>48.4</td><td>75.7</td><td>72.3</td><td>83.4</td><td>73.0</td></tr><tr><td>w4a5</td><td>70.3</td><td>73.9</td><td>76.1</td><td>67.8</td><td>57.3</td><td>39.9</td><td>81.2</td><td>79.1</td><td>82.6</td><td>51.8</td><td>75.7</td><td>68.3</td><td>80.3</td><td>83.9</td><td>78.7</td><td>70.6</td><td>42.6</td><td>72.2</td><td>71.6</td><td>83.5</td><td>69.5</td></tr><tr><td>w32a5</td><td>71.2</td><td>75.5</td><td>75.9</td><td>71.4</td><td>60.4</td><td>42.4</td><td>80.6</td><td>80.0</td><td>83.3</td><td>53.5</td><td>75.8</td><td>68.1</td><td>70.8</td><td>82.6</td><td>79.5</td><td>71.6</td><td>45.5</td><td>69.9</td><td>72.1</td><td>84.6</td><td>70.4</td></tr><tr><td>w4a8</td><td>73.4</td><td>74.5</td><td>79.1</td><td>75.5</td><td>60.6</td><td>43.8</td><td>80.9</td><td>80.7</td><td>85.8</td><td>56.6</td><td>80.0</td><td>70.9</td><td>83.5</td><td>84.5</td><td>81.0</td><td>74.5</td><td>47.5</td><td>74.8</td><td>75.2</td><td>84.1</td><td>73.6</td></tr><tr><td>w4a32</td><td>74.2</td><td>74.6</td><td>78.6</td><td>75.5</td><td>66.0</td><td>47.4</td><td>80.8</td><td>83.2</td><td>87.4</td><td>57.3</td><td>80.3</td><td>70.8</td><td>83.7</td><td>84.3</td><td>83.0</td><td>74.8</td><td>49.4</td><td>74.2</td><td>73.8</td><td>85.2</td><td>73.5</td></tr></table>
188
+
189
+ # 4.2 BN FUSION AND QUANTIZATION OF BIAS AND THE SCALING FACTOR
190
+
191
+ We adopt BN fusion in the PostAct $C o n \nu { } B N { } R e L U )$ networks according to the formula in Section 3.4. And the scaling factor of bias is the product of the corresponding scaling factors belonging to the activations and the weights, respectively. After that, we visualize the bias value distribution of VGG-Small. Figure 4 shows $b / \alpha _ { b }$ is distributed between a vast range (-1000, 1000), resulting in overflows of low bitwidth accumulators. And the overflow phenomena have a significantly harmful impact on the network performance. To deal with this issue, we quantize the bias and the scaling factors to 8-bit words, and then fine-tune the networks to restore the original performance. Generally, we need fine-tuning for one epoch only. After the quantization of bias and scaling factor, we have a fully quantized model and have it deployed onto our integer-only accelerator with 16 bitwidth accumulators. Table 3 and 7 show that the accuracy loss is negligible with $\pmb { w } 4 \pmb { a } 4 b 8 \pmb { \alpha } 8$ quantization on both VGG-Small and AlexNet.
192
+
193
+ ![](images/9e1b4c6d38ebf4bf95490ae5f2d98a8de7f18a1e2a205101e4a89dd2655e5f46.jpg)
194
+ Figure 4: Distribution of the bias/scaling factor. The data is from VGG-Small with w4a4 quantization.
195
+
196
+ # 4.3 DEPLOYMENT ONTO REALISTIC HARDWARE
197
+
198
+ The introduced linear symmetric quantization is intended to deploy the quantized networks to specialized integer-only-arithmetic CNN accelerators or other integer-only hardware. Our accelerators adopt the typical 2D systolic array architecture (Chen et al., 2018), but they are featured with 4-bit or 2-bit low-precision operation. As shown in Figure 1, the 8/4/2-bit accelerator has a $3 2 \mathrm { x } 7 $ array of processing elements (PE). And the MAC unit in each PE consists of a 4-bit multiplier and a 16-bit accumulator. For the 4-bit accelerator, we use INT4 representation for weights, UINT4 for activations, INT8 for the bias and scaling factors, respectively. For the 2-bit accelerator, we use INT2 for weights, UINT2 for activations, INT8 for the bias and scaling factors, respectively. Through the quantization process described in the paper, we can have a fully quantized network that works directly on the CNN accelerator. In addition, as we use linear symmetric quantization, we can use a straight-forward way to conduct multiply-accumulate operations without introducing shifters or lookup tables, which means the quantized models can run on state-of-the-art integer accelerators and ensures that their output accuracy degradation is minimal as presented in the above sections. Finally, we implement the 8/4/2-bit integer neural network processors with Synopsys Design Compiler (DC) under the $4 0 \mathrm { n m }$ technology, clocked at 800MHz. Table 5 shows that the $4 / 2$ -bit implementation achieves up to $2 . 5 6 \mathrm { x }$ lower silicon area and 5.56x lower power compared to that of the 8-bit baseline.
199
+
200
+ Table 5: Comparison of our low-precision integer Neural Network Processors.
201
+
202
+ <table><tr><td>Bitwidth</td><td>#MAC Unit</td><td>Throughput (GOps/sec)</td><td>Silicon Area (mm²)</td><td>Power (mW)</td></tr><tr><td>8-bit</td><td>224</td><td>179.2</td><td>4.71</td><td>228</td></tr><tr><td>4-bit</td><td>224</td><td>179.2</td><td>2.80</td><td>93</td></tr><tr><td>2-bit</td><td>224</td><td>179.2</td><td>1.84</td><td>41</td></tr></table>
203
+
204
+ Implemented and synthesized with Synopsys Design Compiler (DC) under the $4 0 \mathrm { n m }$ technology.
205
+
206
+ # 5 CONCLUSIONS
207
+
208
+ In this paper, we introduced a learned linear symmetric quantization (LLSQ) to quantize the whole network including the bias and scaling factors. We also use BN fusion and low bitwidth accumulators to reduce the network inference overhead and the hardware resources in integer neural accelerators. We show that our proposed method performs well for various networks on Cifar10, ImageNet, and Pascal VOC datasets. We also show that even the linear symmetric quantizer can obtain better results than asymmetric or non-linear quantization in the case of 4-bit networks. Finally, we deploy the quantized network onto our specialized integer-only neural network accelerator. Currently, the bitwidth of every layer in a network is all the same. Prior researches empirically find that different layers have different sensitivity to bitwidth of quantization. Hence in the future, we will explore a framework to support more flexible bitwidth for different layers or finer-grained quantization.
209
+
210
+ # ACKNOWLEDGMENTS
211
+
212
+ This work was supported in part by the National Natural Science Foundation of China under Grant 61874124 and Grant 61902375.
213
+
214
+ # REFERENCES
215
+
216
+ Jorge Albericio, Alberto Delmas, Patrick Judd, Sayeh Sharify, Gerard O’Leary, Roman Genov, and Andreas Moshovos. Bit-pragmatic deep neural network computing. In Proceedings of the 50th Annual IEEE/ACM International Symposium on Microarchitecture, MICRO 2017, Cambridge, MA, USA, October 14-18, 2017, pp. 382–394, 2017. doi: 10.1145/3123939.3123982. URL https://doi.org/10.1145/3123939.3123982.
217
+
218
+ Yoshua Bengio, Nicholas Leonard, and Aaron C Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv: Learning, 2013.
219
+
220
+ Zhaowei Cai, Xiaodong He, Jian Sun, and Nuno Vasconcelos. Deep learning with low precision by half-wave gaussian quantization. In CVPR, 2017.
221
+
222
+ Tianshi Chen, Zidong Du, Ninghui Sun, Jia Wang, Chengyong Wu, Yunji Chen, and Olivier Temam. Diannao: a small-footprint high-throughput accelerator for ubiquitous machine-learning. architectural support for programming languages and operating systems, 49(4):269–284, 2014.
223
+
224
+ Y. Chen, J. Emer, and V. Sze. Eyeriss: A spatial architecture for energy-efficient dataflow for convolutional neural networks. IEEE Micro, pp. 1–1, 2018. ISSN 0272-1732. doi: 10.1109/MM. 2017.265085944.
225
+ Jungwook Choi. Pact: Parameterized clipping activation for quantized neural networks. arXiv: Computer Vision and Pattern Recognition, 2018.
226
+ Zidong Du, Robert Fasthuber, Tianshi Chen, Paolo Ienne, Ling Fei Li, Tao Luo, Xiaobing Feng, Yunji Chen, and Olivier Temam. Shidiannao: shifting vision processing closer to the sensor. international symposium on computer architecture, 43(3):92–104, 2015.
227
+ Thomas Elsken, Jan Hendrik Metzen, and Frank Hutter. Neural architecture search: A survey. Journal of Machine Learning Research, 20(55):1–21, 2018.
228
+ Ross B Girshick. Fast r-cnn. international conference on computer vision, pp. 1440–1448, 2015.
229
+ S. Han, X. Liu, H. Mao, J. Pu, A. Pedram, M. A. Horowitz, and W. J. Dally. Eie: Efficient inference engine on compressed deep neural network. In 2016 ACM/IEEE 43rd Annual International Symposium on Computer Architecture (ISCA), pp. 243–254, June 2016. doi: 10.1109/ISCA.2016.30.
230
+ Song Han, Jeff Pool, John Tran, and William J Dally. Learning both weights and connections for efficient neural networks. neural information processing systems, pp. 1135–1143, 2015.
231
+ Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. international conference on learning representations, 2016.
232
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. computer vision and pattern recognition, pp. 770–778, 2016.
233
+ Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross B Girshick. Mask r-cnn. international conference on computer vision, pp. 2980–2988, 2017.
234
+ Andrew G. Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications, 2017.
235
+ Norman P Jouppi, C S Young, Nishant Patil, David A Patterson, Gaurav Agrawal, Raminder Bajwa, Sarah Bates, Suresh K Bhatia, Nan Boden, Al Borchers, et al. In-datacenter performance analysis of a tensor processing unit. international symposium on computer architecture, 45(2):1–12, 2017.
236
+ Patrick Judd, Jorge Albericio, Tayler H Hetherington, Tor M Aamodt, and Andreas Moshovos. Stripes: bit-serial deep neural network computing. international symposium on microarchitecture, pp. 1–12, 2016.
237
+ Raghuraman Krishnamoorthi. Quantizing deep convolutional networks for efficient inference: A whitepaper. arXiv preprint arXiv:1806.08342, 2018.
238
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. neural information processing systems, 141(5):1097–1105, 2012.
239
+ Jinmook Lee, Changhyeon Kim, Sang Hoon Kang, Dongjoo Shin, Sangyeob Kim, and Hoijun Yoo. Unpu: A 50.6tops/w unified deep neural network accelerator with 1b-to-16b fully-variable weight bit-precision. pp. 218–220, 2018.
240
+ Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. computer vision and pattern recognition, pp. 3431–3440, 2015.
241
+ Christos Louizos, Matthias Reisser, Tijmen Blankevoort, Efstratios Gavves, and Max Welling. Relaxed quantization for discretized neural networks. international conference on learning representations, 2019.
242
+ Asit K Mishra, Eriko Nurvitadhi, Jeffrey J Cook, and Debbie Marr. Wrpn: Wide reduced-precision networks. international conference on learning representations, 2018.
243
+
244
+ Pavlo Molchanov, Stephen Tyree, Tero Karras, Timo Aila, and Jan Kautz. Pruning convolutional neural networks for resource efficient inference. international conference on learning representations, 2017.
245
+
246
+ Ali Bou Nassif, Ismail Shahin, Imtinan Attili, Mohammad Azzeh, and Khaled Shaalan. Speech recognition using deep neural networks: A systematic review. IEEE Access, 7:19143–19165, 2019.
247
+
248
+ Hyeonwoo Noh, Seunghoon Hong, and Bohyung Han. Learning deconvolution network for semantic segmentation. international conference on computer vision, pp. 1520–1528, 2015.
249
+
250
+ Eunhyeok Park, Junwhan Ahn, and Sungjoo Yoo. Weighted-entropy-based quantization for deep neural networks. pp. 7197–7205, 2017.
251
+
252
+ 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.
253
+
254
+ Joseph Redmon and Ali Farhadi. Yolo9000: Better, faster, stronger. pp. 6517–6525, 2017.
255
+
256
+ Joseph Redmon, Santosh Kumar Divvala, Ross B Girshick, and Ali Farhadi. You only look once: Unified, real-time object detection. computer vision and pattern recognition, pp. 779–788, 2016.
257
+
258
+ Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks, 2018.
259
+
260
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. international conference on learning representations, 2015.
261
+
262
+ Y. Wang, J. Xu, Y. Han, H. Li, and X. Li. Deepburning: Automatic generation of fpga-based learning accelerators for the neural network family. In 2016 53nd ACM/EDAC/IEEE Design Automation Conference (DAC), pp. 1–6, June 2016. doi: 10.1145/2897937.2898002.
263
+
264
+ Wei Wen, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Learning structured sparsity in deep neural networks. neural information processing systems, pp. 2074–2082, 2016.
265
+
266
+ Dongqing Zhang, Jiaolong Yang, Dongqiangzi Ye, and Gang Hua. Lq-nets: Learned quantization for highly accurate and compact deep neural networks. european conference on computer vision, pp. 373–390, 2018a.
267
+
268
+ Xiangwen Zhang, Jinsong Su, Yue Qin, Yang Liu, Rongrong Ji, and Hongji Wang. Asynchronous bidirectional decoding for neural machine translation. national conference on artificial intelligence, pp. 5698–5705, 2018b.
269
+
270
+ Aojun Zhou, Anbang Yao, Yiwen Guo, Lin Xu, and Yurong Chen. Incremental network quantization: Towards lossless cnns with low-precision weights. CoRR, abs/1702.03044, 2017. URL http://arxiv.org/abs/1702.03044.
271
+
272
+ Shuchang Zhou, Zekun Ni, Xinyu Zhou, He Wen, Yuxin Wu, and Yuheng Zou. Dorefa-net: Training low bitwidth convolutional neural networks with low bitwidth gradients. arXiv: Neural and Evolutionary Computing, 2016.
273
+
274
+ Chenzhuo Zhu, Song Han, Huizi Mao, and William J Dally. Trained ternary quantization. international conference on learning representations, 2017.
275
+
276
+ # APPENDIX
277
+
278
+ IMAGENET DETAILED
279
+
280
+ We conduct experiments on AlexNet, ResNet18, ResNer34, and MobileNetv2. For all of the experiments, we adopt channel-wise quantization for Conv layers and layer-wise quantization for $F C$ layers as well as the activations. The AlexNet architecture is the same as the PyTorch Model Zoo, and it consists of five Conv layers, three $F C$ layers, three MaxPool layers, and two Dropout layers. To prevent over-fitting, we keep the Dropout layers when quantizing AlexNet. As shown in Figure 5d, we use the same learning rate scheduler for all experiments on ImageNet. The test curves are also shown in Figure 5. As we begin with the pre-trained full-precision weights, the test accuracy is already acceptable after one-epoch training. The final results are listed in Table 7.
281
+
282
+ Table 6: Train Time of ResNet18
283
+
284
+ <table><tr><td rowspan=1 colspan=1>#Training Process</td><td rowspan=1 colspan=1>training time</td></tr><tr><td rowspan=1 colspan=1>Train the fp32 network from scratch</td><td rowspan=1 colspan=1>1.0x</td></tr><tr><td rowspan=1 colspan=1>Quantize w/a to 4/4 according to Step1 of Alg. 1</td><td rowspan=1 colspan=1>0.69x</td></tr><tr><td rowspan=1 colspan=1>Quantize w/a to 3/3 according to Step1 of Alg. 1</td><td rowspan=1 colspan=1>0.69x</td></tr><tr><td rowspan=1 colspan=1>Quantize b/α to 8/8 according to Step2 of Alg. 1</td><td rowspan=1 colspan=1>0.01x</td></tr></table>
285
+
286
+ Training time. The proposed LLSQ requires about $2 / 3$ training epochs than that of floating-point network training. In each training iteration, LLSQ needs extra computation cost to optimize the quantizers. Specifically, the simulated gradients generation of the scaling factors is the major cost. Table 6 shows the total training time comparison of ResNet18 network. The quantization training time is $70 \%$ of baseline only.
287
+
288
+ ![](images/f6612721c7554999187d6d1ad01ee13872e2853d1471e362664f2ff4ea2e0ffc.jpg)
289
+ Figure 5: Test curves for AlexNet, ResNet18, and ResNet34 on ImageNet.
290
+
291
+ # THE LLSQ ALGORITHM
292
+
293
+ Generate simulate gradients for $\alpha$ :
294
+
295
+ $$
296
+ \begin{array} { c } { { E _ { m } = \displaystyle \sum _ { i } ( x _ { i } ^ { r } - q u a n t i z e _ { k } ( x _ { i } ^ { r } \mid \alpha ) ) ^ { 2 } } } \\ { { E _ { l } = \displaystyle \sum _ { i } ( x _ { i } ^ { r } - q u a n t i z e _ { k } ( x _ { i } ^ { r } \mid \frac \alpha 2 ) ) ^ { 2 } } } \\ { { E _ { r } = \displaystyle \sum _ { i } ( x _ { i } ^ { r } - q u a n t i z e _ { k } ( x _ { i } ^ { r } \mid 2 \alpha ) ) ^ { 2 } } } \\ { { d _ { b e t t e r } = \displaystyle \operatorname * { a r g m i n } ( [ E _ { l } , E _ { m } , E _ { r } ] ) - 1 } } \\ { { \Delta G _ { \alpha } = - \alpha ^ { 2 } d _ { b e t t e r } } } \end{array}
297
+ $$
298
+
299
+ where $\pmb { x } ^ { r }$ is one kernel of weights or one layer of activations. $\arg \operatorname* { m i n } ( [ E _ { l } , E _ { m } , E _ { r } ] ) \in \{ 0 , 1 , 2 \}$
300
+ selects the index of the smallest number in the array $[ E _ { l } , E _ { m } , E _ { r } ]$ .
301
+
302
+ The bit-shift quantization can be formulated as:
303
+
304
+ $$
305
+ \begin{array} { l } { { \pmb { \alpha } ^ { q } = S Q _ { k } ( \pmb { \alpha } ) } } \\ { { \nonumber } } \\ { { \vphantom { \int } } = \frac { \mathrm { c l a m p } ( \mathrm { r o u n d } ( 2 ^ { q c o d e } \cdot { \pmb { \alpha } } ) , - 2 ^ { k - 1 } , 2 ^ { k - 1 } - 1 ) } { 2 ^ { q c o d e } } } \end{array}
306
+ $$
307
+
308
+ where $\pmb { \alpha } \in \mathbb { R } ^ { + l e n ( \pmb { \alpha } ) }$ is the scaling factors to be quantized, $k \in \mathbb { Z }$ is the bitwidth, and $q c o d e \in \mathbb { Z }$ is the parameter of the bit-shift quantizer simply obtained by:
309
+
310
+ $$
311
+ q c o d e = k - \mathrm { c e i l } ( \log _ { 2 } ( \operatorname* { m a x } ( \pmb { \alpha } ) ) + 1 - 1 0 ^ { - 5 } )
312
+ $$
313
+
314
+ # Algorithm 1 LLSQ
315
+
316
+ Input: Dataset $( { \pmb x } , { \pmb y } )$ , where $_ { \textbf { \em x } }$ is input and $\textbf { { y } }$ is label; Pre-trained full-precision parameters $( w , b )$ , where $\pmb { w }$ is weights and $^ { b }$ is bias; Suppose the network consists of $L$ layers, ${ \pmb w } _ { l } ^ { ( i ) }$ represents the $i _ { t h }$ kernel of weights of the $l _ { t h }$ layer while $\mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf \mathbf { } \mathbf { } \mathbf \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf { } \mathbf \Psi \mathbf \Psi \Psi \Psi \mathbf \Psi \Psi \Psi \mathbf \Psi \Psi \Psi \mathbf \Psi \Psi \Psi \mathbf \Psi \Psi \Psi \mathbf \Psi \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \mathbf \Psi \Psi \Psi \Psi \mathbf \Psi \Psi \mathbf \Psi \Psi \Psi \mathbf \Psi \mathbf \Psi \Psi \Psi \mathbf \Psi \Psi \Psi \Psi \Psi \mathbf \Psi \mathbf \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \mathbf \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi \Psi $ is the output of the $l _ { t h }$ layer.
317
+
318
+ Output: The quantized scaling factors: $\hat { \pmb { \alpha } } _ { \pmb { w } } ^ { q } = [ [ \hat { \alpha } _ { \pmb { w } _ { 0 } ^ { ( 0 ) } } ^ { q } , \dots ] , \dots , [ \hat { \alpha } _ { \pmb { w } _ { L - 1 } ^ { q } } ^ { q } , \dots ] ]$ $\pmb { \alpha _ { a } ^ { q } } = [ \alpha _ { { \pmb { a } } _ { 0 } } ^ { q } , \dots , \alpha _ { { \pmb { a } } _ { L - 1 } } ^ { q } ]$ ; The quantized weights $\pmb { w } ^ { q }$ and bias $\hat { b } ^ { q }$ .
319
+
320
+ # Step 1: Quantize weights and activations and $\pmb { R e }$ -training
321
+
322
+ // Re-training of quantized networks can converge faster and end with a higher accuracy due to the mechanism of $B N$ layers.
323
+
324
+ repeat Forward: $\mathbf { } a _ { 0 } \gets$ input for $l = 1 , \cdots , L$ do for w(i)l in wl do // This is accelerated in parallel when implemented. $\pmb { w } _ { l } ^ { ( i ) q } \mathrm { Q u a n t i z e } ( \pmb { w } _ { l } ^ { ( i ) } \mid \alpha _ { \pmb { w } _ { l } ^ { ( i ) } } )$ per Eq. (1) Generate simulated gradients for $\alpha _ { w _ { l } ^ { ( i ) } }$ per Eq. (9) end for $\begin{array} { r l } & { \mathbf { \Lambda } _ { { \pmb { w } } _ { l } ^ { q } \mathrm { C o n c a t } } ^ { \pmb { \mathrm { c m u } } \bullet \mathbf { \Lambda } _ { { \pmb { w } } _ { l } ^ { q } } } } \\ & { \mathbf { \Lambda } _ { { \pmb { a } } _ { l } } R e L U ( B N ( C o n v ( \mathbf { a } _ { l - 1 } ^ { q } , \mathbf { w } _ { l } ^ { q } , \mathbf { b } _ { l } ) ) ) } \end{array}$ $\mathbf { \pmb { a } } _ { l } ^ { q } \gets \mathrm { Q u a n t i z e } ( a _ { l } \mid \alpha _ { \pmb { a } _ { l } } )$ per Eq. (1) Generate simulated gradients for $\alpha _ { { \pmb a } _ { l } }$ per Eq. (9)
325
+
326
+ # end for
327
+
328
+ # Backward:
329
+
330
+ Generate $\Delta G$ for weights and bias and $\Delta E$ for activation per Eq. (7), (8) and backpropagation algorithm. Update $w , b , \alpha _ { w } , \alpha _ { a }$ $i t e r \gets i t e r + 1$ ntil iter $\geq i t e r _ { m a x } / /$ need about 60 epochs, e.g. $i t e r _ { m a x } = 6 0 \frac { \mathrm { l e n } ( d a t a s e t ) } { b a t c h s i z e }$
331
+
332
+ Step 2: Quantize bias and scaling factor after BN fusion and $\pmb { R e }$ -training
333
+ iter $\gets 0$
334
+ $\hat { \alpha _ { w } } , \hat { b } \gets \mathbf { B } \mathbf { N }$ fusion per Eq. (5)
335
+ repeat Forward: $\mathbf { } \mathbf { } \mathbf { 0 } \gets$ input for $l = 1 , \cdots , L \mathbf { d }$ o $\hat { \alpha } _ { { w _ { l } } } ^ { q } \gets \mathrm { S Q } ( \hat { \alpha } _ { { w _ { l } } } )$ per Eq. (10) for ${ \pmb w } _ { l } ^ { ( i ) }$ in ${ \pmb w } _ { l }$ do // This is accelerated in parallel when implemented. $\mathbf { \dot { \mathbf { w } } } _ { l } ^ { ( i ) q } \mathrm { Q u a n t i z e } ( \mathbf { w } _ { l } ^ { ( i ) } \mid \hat { \alpha } _ { \mathbf { \pmb { w } } _ { l } ^ { ( i ) } } ^ { q } )$ αˆqw(i) ) per Eq. (1)
336
+
337
+ $\hat { b } _ { l } ^ { ( i ) q } \gets \mathrm { Q u a n t i z e } ( \hat { b } _ { l } ^ { ( i ) } \mid \alpha _ { a _ { l - 1 } } ^ { q } \hat { \alpha } _ { { \pmb w } _ { l } ^ { ( i ) } } ^ { q } )$ (i) ) per Eq. (1) Generate simulated gradients for $\hat { \alpha } _ { { \pmb w } _ { l } ^ { ( i ) } }$ per Eq. (9) end for $\begin{array} { r l } & { \mathbf { \Lambda } _ { u } ^ { \mathrm { c u n t \ : 1 0 1 } } } \\ & { \mathbf { \Lambda } _ { u } ^ { w _ { l } ^ { q } } \mathrm { C o n c a t } \ w _ { l } ^ { ( i ) q } } \\ & { \hat { b } _ { l } ^ { q } \mathrm { C o n c a t } \ \hat { b } _ { l } ^ { ( i ) q } } \\ & { a _ { l } R e L U ( C o n v ( a _ { l - 1 } ^ { q } , { \pmb { w } } _ { l } ^ { q } , \hat { b } _ { l } ^ { q } ) ) } \end{array}$ $\alpha _ { { \pmb a } _ { l } } ^ { q } \mathrm { S Q } ( \alpha _ { { \pmb a } _ { l } } )$ − per Eq. (10) $\mathbf { \em a } _ { l } ^ { q } \gets \mathrm { Q u a n t i z e } ( \mathbf { \em a } _ { i } \mid \alpha _ { \mathbf { \em a } _ { l } } ^ { q } )$ per Eq. (1) Generate simulated gradients for $\alpha _ { { \pmb a } _ { l } }$ per Eq. (9) end for Backward: Generate $\Delta G$ for weights and bias and $\Delta E$ for activation per Eq. (7), (8) and backpropagation algorithm. Update $\bar { w } , \bar { b } , \hat { \alpha } _ { w } , \bar { \alpha } _ { a }$ $i t e r \gets i t e r + 1$ until iter $\geq i t e r _ { m a x } / /$ only need one epoch, e.g. $i t e r _ { m a x } = \frac { \mathbf { l e n } ( d a t a s e t ) } { b a t c h s i z e }$
338
+
339
+ Table 7: Comparison with state-of-the-art quantization methods on ImageNet. Top1, Top5 accuracy $\% )$ and degradation of Top1 are given.
340
+
341
+ <table><tr><td>Method</td><td>Model</td><td>#Bits w/a/b/α</td><td></td><td></td><td>Top1(%) Top5(%) Degradation</td></tr><tr><td rowspan="3">LQ-Nets* (Zhang et al., 2018a)</td><td>ResNet18</td><td>Reference</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td>70.3 69.3</td><td>89.5</td><td></td></tr><tr><td></td><td>4/4 3/3</td><td>68.2</td><td>88.8</td><td>1.0</td></tr><tr><td rowspan="3">RQ (Louizos et al., 2019)</td><td>ResNet18</td><td>Reference</td><td>69.54</td><td>87.9</td><td>2.1</td></tr><tr><td></td><td></td><td>69.97</td><td>89.19</td><td></td></tr><tr><td></td><td>8/8 4/4</td><td>61.52</td><td>89.44 83.99</td><td>-0.43</td></tr><tr><td>RQ+ST</td><td></td><td>8/8</td><td>69.63</td><td>89.33</td><td>8.02 -0.09</td></tr><tr><td>(Louizos et al., 2019)</td><td></td><td>4/4</td><td>62.46</td><td>84.78</td><td>7.08</td></tr><tr><td rowspan="4">LLSQ(ours)*</td><td rowspan="4">ResNet18</td><td>Reference</td><td>69.76</td><td>89.08</td><td></td></tr><tr><td>4/4</td><td>69.84</td><td>89.14</td><td>-0.08</td></tr><tr><td>3/3</td><td>68.08</td><td>88.20</td><td>1.68</td></tr><tr><td>4/4</td><td>69.40</td><td>88.72</td><td>0.36</td></tr><tr><td rowspan="2">LLSQF(ours) LQ-Nets*</td><td>ResNet18</td><td>3/3</td><td>66.67</td><td>87.42</td><td>3.09</td></tr><tr><td>ResNet34</td><td>Reference</td><td>73.80</td><td>91.40</td><td></td></tr><tr><td>(Zhang et al., 2018a) LLSQ(ours)*</td><td>ResNet34</td><td>3/3</td><td>71.9</td><td>90.2</td><td>1.9</td></tr><tr><td rowspan="3"></td><td></td><td>Reference</td><td>73.30</td><td>91.42</td><td></td></tr><tr><td></td><td>4/4</td><td>73.60</td><td>91.28</td><td>-0.30</td></tr><tr><td></td><td>3/3</td><td>72.02</td><td>90.66</td><td>1.28</td></tr><tr><td>LLSQF(ours)</td><td>ResNet34</td><td>4/4 3/3</td><td>72.94 70.97</td><td>91.20</td><td>0.36</td></tr><tr><td rowspan="4">LLSQ(ours)*</td><td>AlexNet</td><td>Reference</td><td>56.55</td><td>89.95</td><td>2.33</td></tr><tr><td></td><td>4/4</td><td>56.57</td><td>79.09</td><td></td></tr><tr><td></td><td></td><td></td><td>79.02</td><td>-0.02</td></tr><tr><td></td><td>4/4/8/8</td><td>56.45</td><td>80.15</td><td>0.10</td></tr><tr><td rowspan="4">LLSQF(ours)</td><td>AlexNet</td><td>3/3</td><td>55.36</td><td>78.20</td><td>0.19</td></tr><tr><td></td><td>4/4</td><td>56.40</td><td>78.85</td><td>0.15</td></tr><tr><td></td><td>4/4/8/8</td><td>55.58</td><td>77.47</td><td>0.97</td></tr><tr><td></td><td>3/3</td><td>54.28</td><td>77.65</td><td>2.27</td></tr><tr><td rowspan="4">RQ (Louizos et al., 2019)</td><td>Mobilenet(v1)</td><td>Reference</td><td>70.61</td><td>89.47</td><td></td></tr><tr><td></td><td>8/8</td><td>70.43</td><td>89.42</td><td>0.18</td></tr><tr><td></td><td>6/6</td><td>68.02</td><td>88.00</td><td>2.59</td></tr><tr><td></td><td>5/5</td><td>61.38</td><td>83.73</td><td>9.23</td></tr><tr><td rowspan="3">RQ+ST (Louizos et al., 2019)</td><td>Mobilenet(v1)</td><td>8/8</td><td>70.06</td><td>89.52</td><td>0.55</td></tr><tr><td></td><td>6/6</td><td>67.62</td><td>87.78</td><td>2.99</td></tr><tr><td></td><td>5/5</td><td>56.85</td><td>80.35</td><td>13.76</td></tr><tr><td rowspan="4">LLSQ(ours)*</td><td>MobileNet(v2)</td><td>Reference</td><td>71.80</td><td>90.37</td><td></td></tr><tr><td></td><td>6/6</td><td>71.20</td><td>89.99</td><td>0.60</td></tr><tr><td></td><td>5/5</td><td>70.45</td><td>89.69</td><td>1.35</td></tr><tr><td></td><td>4/4</td><td>67.37</td><td>87.99</td><td>4.43</td></tr></table>
342
+
343
+ \* First and last layers in full precision.
md/train/H1lJws05K7/H1lJws05K7.md ADDED
@@ -0,0 +1,610 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ON THE SELECTION OF INITIALIZATION AND ACTIVATION FUNCTION FOR DEEP NEURAL NETWORKS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The weight initialization and the activation function of deep neural networks have a crucial impact on the performance of the training procedure. An inappropriate selection can lead to the loss of information of the input during forward propagation and the exponential vanishing/exploding of gradients during back-propagation. Understanding the theoretical properties of untrained random networks is key to identifying which deep networks may be trained successfully as recently demonstrated by Schoenholz et al. (2017) who showed that for deep feedforward neural networks only a specific choice of hyperparameters known as the ‘edge of chaos’ can lead to good performance. We complete this analysis by providing quantitative results showing that, for a class of ReLU-like activation functions, the information propagates indeed deeper for an initialization at the edge of chaos. By further extending this analysis, we identify a class of activation functions that improve the information propagation over ReLU-like functions. This class includes the Swish activation, $\phi _ { s w i s h } ( x ) = x \cdot \mathrm { s i g m o i d } ( x )$ , used in Hendrycks & Gimpel (2016), Elfwing et al. (2017) and Ramachandran et al. (2017). This provides a theoretical grounding for the excellent empirical performance of $\phi _ { s w i s h }$ observed in these contributions. We complement those previous results by illustrating the benefit of using a random initialization on the edge of chaos in this context.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep neural networks have become extremely popular as they achieve state-of-the-art performance on a variety of important applications including language processing and computer vision; see, e.g., LeCun et al. (1998). The success of these models has motivated the use of increasingly deep networks and stimulated a large body of work to understand their theoretical properties. It is impossible to provide here a comprehensive summary of the large number of contributions within this field. To cite a few results relevant to our contributions, Montufar et al. (2014) have shown that neural networks have exponential expressive power with respect to the depth while Poole et al. (2016) obtained similar results using a topological measure of expressiveness.
12
+
13
+ We follow here the approach of Poole et al. (2016) and Schoenholz et al. (2017) by investigating the behaviour of random networks in the infinite-width and finite-variance i.i.d. weights context where they can be approximated by a Gaussian process as established by Matthews et al. (2018) and Lee et al. (2018).
14
+
15
+ In this paper, our contribution is two-fold. Firstly, we provide an analysis complementing the results of Poole et al. (2016) and Schoenholz et al. (2017) and show that initializing a network with a specific choice of hyperparameters known as the ‘edge of chaos’ is linked to a deeper propagation of the information through the network. In particular, we establish that for a class of ReLU-like activation functions, the exponential depth scale introduced in Schoenholz et al. (2017) is replaced by a polynomial depth scale. This implies that the information can propagate deeper when the network is initialized on the edge of chaos. Secondly, we outline the limitations of ReLU-like activation functions by showing that, even on the edge of chaos, the limiting Gaussian Process admits a degenerate kernel as the number of layers goes to infinity. Our main result (4) gives sufficient conditions for activation functions to allow a good ‘information flow’ through the network (Proposition 4) (in addition to being non-polynomial and not suffering from the exploding/vanishing gradient problem). These conditions are satisfied by the Swish activation $\phi _ { s w i s h } ( x ) = x$ · sigmoid $( x )$ used in Hendrycks & Gimpel (2016),
16
+
17
+ Elfwing et al. (2017) and Ramachandran et al. (2017). In recent work, Ramachandran et al. (2017) used automated search techniques to identify new activation functions and found experimentally that functions of the form $\phi ( x ) = \overset { \cdot } { x } \cdot \mathrm { s i g m o i d } ( \overset { \cdot } { \beta } x )$ appear to perform indeed better than many alternative functions, including ReLU. Our paper provides a theoretical grounding for these results. We also complement previous empirical results by illustrating the benefits of an initialization on the edge of chaos in this context. All proofs are given in the Supplementary Material.
18
+
19
+ # 2 ON GAUSSIAN PROCESS APPROXIMATIONS OF NEURAL NETWORKS AND THEIR STABILITY
20
+
21
+ # 2.1 SETUP AND NOTATIONS
22
+
23
+ We use similar notations to those of Poole et al. (2016) and Lee et al. (2018). Consider a fully connected random neural network of depth $L$ , widths $( N _ { l } ) _ { 1 \leq l \leq L }$ , weights $\begin{array} { r } { { W _ { i j } ^ { l } } \stackrel { i i d } { \sim } \mathcal { N } ( 0 , \frac { { \sigma _ { w } ^ { 2 } } } { { N _ { l - 1 } } } ) } \end{array}$ and bias $B _ { i } ^ { l } \stackrel { i i d } { \sim } \mathcal { N } ( 0 , \sigma _ { b } ^ { 2 } )$ , where ${ \mathcal { N } } ( \mu , \sigma ^ { 2 } )$ denotes the normal distribution of mean $\mu$ and variance $\sigma ^ { 2 }$ . For some input $a \in \mathbb { R } ^ { d }$ , the propagation of this input through the network is given for an activation function $\phi : \mathbb { R } \mathbb { R }$ by
24
+
25
+ $$
26
+ y _ { i } ^ { 1 } ( a ) = \sum _ { j = 1 } ^ { d } W _ { i j } ^ { 1 } a _ { j } + B _ { i } ^ { 1 } , \quad y _ { i } ^ { l } ( a ) = \sum _ { j = 1 } ^ { N _ { l - 1 } } W _ { i j } ^ { l } \phi ( y _ { j } ^ { l - 1 } ( a ) ) + B _ { i } ^ { l } , \quad \mathrm { f o r } l \ge 2 .
27
+ $$
28
+
29
+ Throughout the paper we assume that for all $l$ the processes $y _ { i } ^ { l } ( . )$ are independent (across $i$ ) centred Gaussian processes with covariance kernels $\kappa ^ { l }$ and write accordingly $y _ { i } ^ { l } \overset { i n d } { \sim } g \mathcal { P } ( 0 , \kappa ^ { l } )$ . This is an idealized version of the true processes corresponding to choosing $N _ { l - 1 } = + \infty$ (which implies, using Central Limit Theorem, that $y _ { i } ^ { l } ( a )$ is a Gaussian variable for any input $a$ ). The approximation of $y _ { i } ^ { l } ( . )$ by a Gaussian process was first proposed by Neal (1995) in the single layer case and has been recently extended to the multiple layer case by Lee et al. (2018) and Matthews et al. (2018). We recall here the expressions of the limiting Gaussian process kernels. For any input $a \in \mathbb { R } ^ { d }$ , $\mathbb { E } [ y _ { i } ^ { l } ( a ) ] = 0$ so that for any inputs $a , b \in \mathbb { R } ^ { d }$
30
+
31
+ $$
32
+ \begin{array} { r l } & { \kappa ^ { l } ( a , b ) = \mathbb { E } [ y _ { i } ^ { l } ( a ) y _ { i } ^ { l } ( b ) ] = \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } \mathbb { E } _ { y _ { i } ^ { l - 1 } \sim G P ( 0 , \kappa ^ { l - 1 } ) } [ \phi ( y _ { i } ^ { l - 1 } ( a ) ) \phi ( y _ { i } ^ { l - 1 } ( b ) ) ] } \\ & { \quad \quad \quad \quad \quad \quad = \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } F _ { \phi } ( \kappa ^ { l - 1 } ( a , a ) , \kappa ^ { l - 1 } ( a , b ) , \kappa ^ { l - 1 } ( b , b ) ) , } \end{array}
33
+ $$
34
+
35
+ where $F _ { \phi }$ is a function that depends only on $\phi$ . This gives a recursion to calculate the kernel $\kappa ^ { l }$ ; see, e.g., Lee et al. (2018) for more details. We can also express the kernel $\kappa ^ { l }$ in terms of the correlation $c _ { a b } ^ { l ^ { - } }$ in the ${ l ^ { t h } }$ layer used in the rest of this paper
36
+
37
+ q $\mathbf \Lambda _ { a b } ^ { l } : = \kappa ^ { l } ( a , b ) = \mathbb { E } [ y _ { i } ^ { l } ( a ) y _ { i } ^ { l } ( b ) ] = \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ( \sqrt { q _ { a } ^ { l - 1 } } Z _ { 1 } ) \phi ( \sqrt { q _ { b } ^ { l - 1 } } ( c _ { a b } ^ { l - 1 } Z _ { 1 } + \sqrt { 1 - ( c _ { a b } ^ { l - 1 } ) ^ { 2 } } Z _ { 2 } ) ) ]$ where $q _ { a } ^ { l - 1 } : = q _ { a a } ^ { l - 1 }$ , resp. $c _ { a b } ^ { l - 1 } : = q _ { a b } ^ { l - 1 } / \sqrt { q _ { a } ^ { l - 1 } q _ { b } ^ { l - 1 } }$ , is the variance, resp. correlation, in the $( l - 1 ) ^ { t h }$ layer and $Z _ { 1 } , Z _ { 2 }$ are independent standard Gaussian random variables. when it propagates through the network. $q _ { a } ^ { l }$ is updated through the layers by the recursive formula $q _ { a } ^ { l } = F ( q _ { a } ^ { l - 1 } )$ , where $F$ is the ‘variance function’ given by
38
+
39
+ $$
40
+ F ( x ) = \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ( { \sqrt { x } } Z ) ^ { 2 } ] , \quad { \mathrm { w h e r e } } \quad Z \sim { \mathcal { N } } ( 0 , 1 ) .
41
+ $$
42
+
43
+ Throughout the paper, $Z , Z _ { 1 } , Z _ { 2 }$ will always denote independent standard Gaussian variables.
44
+
45
+ # 2.2 LIMITING BEHAVIOUR OF THE VARIANCE AND COVARIANCE OPERATORS
46
+
47
+ We analyze here the limiting behaviour of $q _ { a } ^ { L }$ and $c _ { a , b } ^ { L }$ as the network depth $L$ goes to infinity under the assumption that $\phi$ has a second derivative at least in the distribution sense1. From now onwards, we will also assume without loss of generality that $c _ { a b } ^ { 1 } \geq 0$ (similar results can be obtained straightforwardly when $c _ { a b } ^ { 1 } \leq 0 .$ ). We first need to define the Domains of Convergence associated with an activation function $\phi$ .
48
+
49
+ ![](images/67ba9471ecfa4d946636702278bad8657163cc6c2c83d792308784273a4ce982.jpg)
50
+ Figure 1: Two draws of outputs for ReLU and Tanh networks with $( \sigma _ { b } , \sigma _ { w } ) = ( 1 , 1 ) \in D _ { \phi , v a r } \cap$ $D _ { \phi , c o r r }$ . The output functions are almost constant.
51
+
52
+ Definition 1. Let $\phi$ be an activation function, $( \sigma _ { b } , \sigma _ { w } ) \in ( \mathbb R ^ { + } ) ^ { 2 }$ (i) ${ \mathrm { ~ , ~ } } ( \sigma _ { b } , \sigma _ { w } )$ is in $D _ { \phi , v a r }$ (domain of convergence for the variance) if there exists $K > 0 , q \ge 0$ such that for any input a with $q _ { a } ^ { 1 } \leq K$ , $\begin{array} { r } { \operatorname* { l i m } _ { l \to \infty } q _ { a } ^ { l } = q } \end{array}$ . We denote by $K _ { \phi , v a r } ( \sigma _ { b } , \sigma _ { w } )$ the maximal $K$ satisfying this condition.
53
+
54
+ (ii) $\left( \sigma _ { b } , \sigma _ { w } \right)$ is in $D _ { \phi , c o r r }$ (domain of convergence for the correlation) if there exists $K > 0$ such that for any two inputs $a , b$ with $q _ { a } ^ { 1 } , q _ { b } ^ { 1 } \leq K$ , $\begin{array} { r } { \operatorname* { l i m } _ { l \to \infty } c _ { a b } ^ { l } = 1 } \end{array}$ . We denote by $K _ { \phi , c o r r } ( \sigma _ { b } , \sigma _ { w } )$ the maximal $K$ satisfying this condition.
55
+
56
+ Remark : Typically, $q$ in Definition 1 is a fixed point of the variance function defined in equation 2. Therefore, it is easy to see that for any $\left( \sigma _ { b } , \sigma _ { w } \right)$ such that $F$ is increasing and admits at least one fixed point, we have $K _ { \phi , c o r r } ( \sigma _ { b } , \sigma _ { w } ) \ge q$ where $q$ is the minimal fixed point; i.e. $q : = \operatorname* { m i n } \{ x : F ( x ) = x \}$ . Thus, if we re-scale the input data to have $q _ { a } ^ { 1 } \leq q$ , the variance $q _ { a } ^ { l }$ converges to $q$ . We can also re-scale the variance $\sigma _ { w }$ of the first layer (only) to assume that $q _ { a } ^ { 1 } \leq q$ for all inputs $a$ .
57
+
58
+ The next result gives sufficient conditions on $\left( \sigma _ { b } , \sigma _ { w } \right)$ to be in the domains of convergence of $\phi$ .
59
+
60
+ Proposition 1. Let $\begin{array} { r } { M _ { \phi } : = \mathrm { s u p } _ { x \geq 0 } \mathbb { E } [ | \phi ^ { \prime 2 } ( x Z ) + \phi ^ { \prime \prime } ( x Z ) \phi ( x Z ) | ] } \end{array}$ . Assume $M _ { \phi } < \infty$ , then for $\begin{array} { r } { \sigma _ { w } ^ { 2 } < \frac { 1 } { M _ { \phi } } } \end{array}$ and any $\sigma _ { b }$ , we have $( \sigma _ { b } , \sigma _ { w } ) \in D _ { \phi , v a r }$ and $K _ { \phi , v a r } ( \sigma _ { b } , \sigma _ { w } ) = \infty$
61
+
62
+ Let $\begin{array} { r } { C _ { \phi , \delta } : = \operatorname* { s u p } _ { x , y \geq 0 , | x - y | \leq \delta , c \in [ 0 , 1 ] } \mathbb { E } [ | \phi ^ { \prime } ( x Z _ { 1 } ) \phi ^ { \prime } ( y ( c Z _ { 1 } + \sqrt { 1 - c ^ { 2 } } Z _ { 2 } ) | ] } \end{array}$ . Assume $C _ { \phi , \delta } < \infty$ for some $\delta > 0$ , then for $\begin{array} { r } { \sigma _ { w } ^ { 2 } < \operatorname* { m i n } ( \frac { 1 } { M _ { \phi } } , \frac { 1 } { C _ { \phi } } ) } \end{array}$ and any $\sigma _ { b }$ , we have $( \sigma _ { b } , \sigma _ { w } ) \in D _ { \phi , v a r } \cap D _ { \phi , c o r r }$ and $K _ { \phi , v a r } ( \sigma _ { b } , \sigma _ { w } ) = K _ { \phi , c o r r } ( \sigma _ { b } , \sigma _ { w } ) = \infty$ .
63
+
64
+ The proof of Proposition 1 is straightforward. We prove that $\operatorname* { s u p } F ^ { \prime } ( x ) = \sigma _ { w } ^ { 2 } M _ { \phi }$ and then apply the Banach fixed point theorem; similar ideas are used for $C _ { \phi , \delta }$ .
65
+
66
+ Example : For ReLU activation function, we have $M _ { R e L U } = 2$ and $C _ { R e L U , \delta } \leq 1$ for any $\delta > 0$
67
+
68
+ In the domain of convergence $D _ { \phi , v a r } \cap D _ { \phi , c o r r }$ , for all $a , b \in \mathbb { R } ^ { d }$ , $y _ { i } ^ { \infty } ( a ) = y _ { i } ^ { \infty } ( b )$ almost surely and the outputs of the network are constant functions. Figure 1 illustrates this behaviour for $d = 2$ for ReLU and Tanh using a network of depth $L = 1 0$ with $N _ { l } = 1 0 0$ neurons per layer. The draws of outputs of these networks are indeed almost constant.
69
+
70
+ To refine this convergence analysis, Schoenholz et al. (2017) established the existence of $\epsilon _ { q }$ and $\epsilon _ { c }$ such that $| q _ { a } ^ { l } - q | \sim e ^ { - l / \epsilon _ { q } }$ and $| c _ { a b } ^ { l } - 1 | \sim e ^ { - l / \epsilon _ { c } }$ when fixed points exist. The quantities $\epsilon _ { q }$ and $\epsilon _ { c }$ are called ‘depth scales’ since they represent the depth to which the variance and correlation can propagate without being exponentially close to their limits. More precisely, if we write $\chi _ { 1 } = \sigma _ { w } ^ { 2 } \mathbb { E } [ \bar { \phi ^ { \prime } } ( \bar { \sqrt { q } } \bar { Z } ) ^ { 2 } ]$ and $\alpha = \chi _ { 1 } + \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ^ { \prime \prime } ( \sqrt { q } Z ) \phi ( \sqrt { q } Z ) ]$ then the depth scales are given by $\epsilon _ { r } = - \log ( \alpha ) ^ { - 1 }$ and $\epsilon _ { c } = - \log ( \chi _ { 1 } ) ^ { - 1 }$ . The equation $\chi _ { 1 } = 1$ corresponds to an infinite depth scale of the correlation. It is called the edge of chaos as it separates two phases: an ordered phase where the correlation converges to 1 if $\chi _ { 1 } < 1$ and a chaotic phase where $\chi _ { 1 } > 1$ and the correlations do not converge to 1. In this chaotic regime, it has been observed in Schoenholz et al. (2017) that the correlations converge to some random value $c < 1$ when $\phi ( x ) = \mathrm { T a n h } ( x )$ and that $c$ is independent of the correlation between the inputs. This means that very close inputs (in terms of correlation) lead to very different outputs. Therefore, in the chaotic phase, the output function of the neural network is non-continuous everywhere.
71
+
72
+ Definition 2. For $( \sigma _ { b } , \sigma _ { w } ) \in D _ { \phi , v a r }$ , let q be the limiting variance2. The Edge of Chaos, hereafter EOC, is the set of values of $\left( \sigma _ { b } , \sigma _ { w } \right)$ satisfying $\chi _ { 1 } = \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ^ { \prime } ( \sqrt { q } Z ) ^ { 2 } ] = 1$ .
73
+
74
+ To further study the EOC regime, the next lemma introduces a function $f$ called the ‘correlation function’ simplifying the analysis of the correlations. It states that the correlations have the same asymptotic behaviour as the time-homogeneous dynamical system $c _ { a b } ^ { l + 1 } = f ( c _ { a b } ^ { l } )$ .
75
+
76
+ Lemma 1. Let $( \sigma _ { b } , \sigma _ { w } ) \in D _ { \phi , v a r } \cap D _ { \phi , c o r r }$ such that $q > 0$ , $a , b \in \mathbb { R } ^ { d }$ and $\phi$ an activation function such that $\begin{array} { r } { \operatorname* { s u p } _ { x \in S } \mathbb { E } [ \phi ( x Z ) ^ { 2 } ] < \infty } \end{array}$ for all compact sets √ $S$ . Define $f _ { l }$ by $c _ { a b } ^ { l + 1 } = f _ { l } ( c _ { a b } ^ { l } )$ and $f$ by $\begin{array} { r } { f ( x ) = \frac { \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ( \sqrt { q } Z _ { 1 } ) \phi ( \sqrt { q } ( x Z _ { 1 } + \sqrt { 1 - x ^ { 2 } } Z _ { 2 } ) ) } { q } } \end{array}$ . Then $\begin{array} { r } { \operatorname* { l i m } _ { l \infty } \operatorname* { s u p } _ { x \in [ 0 , 1 ] } | f _ { l } ( x ) - f ( x ) | = 0 . } \end{array}$
77
+
78
+ The condition on $\phi$ in Lemma 1 is violated only by activation functions with exponential growth (which are not used in practice), so from now onwards, we use this approximation in our analysis. Note that being on the EOC is equivalent to $( \sigma _ { b } , \sigma _ { w } )$ satisfying $f ^ { \prime } ( 1 ) = 1$ . In the next section, we analyze this phase transition carefully for a large class of activation functions.
79
+
80
+ # 3 EDGE OF CHAOS
81
+
82
+ To illustrate the effect of the initialization on the EOC, we plot in Figure 2 the output of a ReLU neural network with 20 layers and 100 neurons per layer with parameters $( \sigma _ { b } ^ { 2 } , \sigma _ { w } ^ { 2 } ) = ( \mathsf { \bar { 0 } } , 2 )$ (as we will see later $\mathrm { E O C } = \{ ( 0 , \sqrt { 2 } ) \}$ for ReLU). Unlike the output in Figure 1, this output displays much more variability. However, we will prove here that the correlations still converges to 1 even in the EOC regime, albeit at a slower rate.
83
+
84
+ # 3.1 RELU-LIKE ACTIVATION FUNCTIONS
85
+
86
+ ![](images/227bb801e09b15a5209fdb1053b023bb8f21040bdf297f460a1bf93f25faa361.jpg)
87
+ Figure 2: A draw from the output function of a ReLu network with 20 layers, 100 neurons per layer, $( \sigma _ { b } ^ { 2 } , \bar { \sigma _ { w } ^ { 2 } } ) = ( 0 , 2 )$ (edge of chaos)
88
+
89
+ We consider activation functions $\phi$ of the form: $\phi ( x ) = \lambda x$ if $x > 0$ and $\phi ( x ) = \beta x$ if $x \leq 0$ . ReLU corresponds to $\lambda = 1$ and $\beta = 0$ . For this class of activation functions, we see (Proposition 2) that the variance is unchanged $( q _ { a } ^ { l } = q _ { a } ^ { 1 } )$ on the EOC, so that $q$ does not formally exist in the sense that the limit of $q _ { a } ^ { l }$ depends on $a$ . However, this does not impact the analysis of the correlations.
90
+
91
+ Proposition 2. Let $\phi$ be a ReLU-like function with $\lambda$ and $\beta$ defined above. Then for any $\begin{array} { r } { \sigma _ { w } < \sqrt { \frac { 2 } { \lambda ^ { 2 } + \beta ^ { 2 } } } } \end{array}$ and $\sigma _ { b } \geq 0$ , we have $( \sigma _ { b } , \sigma _ { w } ) \in D _ { \phi , v a r }$ with $K _ { \phi , v a r } ( \sigma _ { b } , \sigma _ { w } ) = \infty$ . Moreover $\begin{array} { r } { E O C = \{ ( 0 , \frac { 1 } { \sqrt { \mathbb { E } [ \phi ^ { \prime } ( Z ) ^ { 2 } ] } } ) \} } \end{array}$ , √ 1E[φ0(Z)2] )} and, on the EOC, F (x) = x for any $x \geq 0$ .
92
+
93
+ This class of activation functions has the interesting property of preserving the variance across layers when the network is initialized on the EOC. However, we show in Proposition 3 below that, even in the EOC regime, the correlations converge to 1 but at a slower rate. We only present the result for ReLU but the generalization to the whole class is straightforward.
94
+
95
+ Example : ReLU: The EOC is reduced to the singleton $( \sigma _ { b } ^ { 2 } , \sigma _ { w } ^ { 2 } ) = ( 0 , 2 )$ , which means we should initialize a ReLU network with the parameters $( \bar { \sigma } _ { b } ^ { 2 } , \sigma _ { w } ^ { 2 } ) = ( \bar { 0 } , 2 )$ . This result coincides with the recommendation of He et al. (2015) whose objective was to make the variance constant as the input propagates but did not analyze the propagation of the correlations. Klambauer et al. (2017) also performed a similar analysis by using the "Scaled Exponential Linear Unit" activation (SELU) that makes it possible to center the mean and normalize the variance of the post-activation $\phi ( y )$ . The propagation of the correlation was not discussed therein either. In the next result, we present the correlation function corresponding to ReLU networks. This was first obtained in Cho & Saul (2009). We present an alternative derivation of this result and further show that the correlations converge to 1 at a polynomial rate of $1 / l ^ { 2 }$ instead of an exponential rate.
96
+
97
+ ![](images/b561b5a725551310ac9febadaa8763a49c33b898c38663d2947bf188813e15c1.jpg)
98
+ Figure 3: Impact of the initialization on the EOC for a ReLU network
99
+
100
+ Proposition 3 (ReLU kernel). Consider a ReLU network with parameters $( \sigma _ { b } ^ { 2 } , \sigma _ { w } ^ { 2 } ) = ( 0 , 2 )$ on the EOC.We have
101
+
102
+ Figure 3 displays the correlation function $f$ with two different sets of parameters $( \sigma _ { b } , \sigma _ { w } )$ . The red graph corresponds to the EOC $( \sigma _ { b } ^ { 2 } , \sigma _ { w } ^ { 2 } ) = ( 0 , 2 )$ , and the blue one corresponds to an ordered phase $( \bar { \sigma } _ { b } , \bar { \sigma } _ { w } ) = ( \bar { 1 } , 1 )$ . In unreported experiments, we observed that numerical convergence towards 1 for $l \geq 5 0$ on the EOC. As the variance $q _ { a } ^ { l }$ is preserved by the network $( q _ { a } ^ { l } = q _ { a } ^ { 1 } = 2 \| a \| ^ { 2 } / d )$ and the correlations $c _ { a b } ^ { l }$ converge to 1 as $l$ increases, the output function is of the form $C \cdot \| a \|$ for a constant $C$ (notice that in Figure 2, we start observing this effect for depth 20).
103
+
104
+ # 3.2 A BETTER CLASS OF ACTIVATION FUNCTIONS
105
+
106
+ We now introduce a set of sufficient conditions for activation functions which ensures that it is then possible to tune $\left( \sigma _ { b } , \sigma _ { w } \right)$ to slow the convergence of the correlations to 1. This is achieved by making the correlation function $f$ sufficiently close to the identity function.
107
+
108
+ Proposition 4 (Main Result). Let $\phi$ be an activation function. Assume that
109
+ (i) $\phi ( 0 ) = 0$ , and $\phi$ has right and left derivatives in zero and $\phi ^ { \prime } ( 0 ^ { + } ) \neq 0$ or $\phi ^ { \prime } ( 0 ^ { - } ) \neq 0$ , and there exists $k > 0$ such that $\big | \frac { \phi ( x ) } { x } \big | \leq k$ .
110
+ (ii) There exists $A > 0$ such that for any $\sigma _ { b } \in [ 0 , A ]$ , there exists $\sigma _ { w } > 0$ such that $( \sigma _ { b } , \sigma _ { w } ) \in E O C$ . (iii) For any $\sigma _ { b } \in [ 0 , A ]$ , the function $F$ with parameters $( \sigma _ { b } , \sigma _ { w } ) \in E O C$ is non-decreasing and $\scriptstyle \operatorname* { l i m } _ { \sigma _ { b } \to 0 } q = 0$ where $q$ is the minimal fixed point of $F$ , $q : = \operatorname* { i n f } \{ x : F ( x ) = x \}$ .
111
+ $( i \nu )$ For any $\sigma _ { b } \in [ 0 , A ]$ , the correlation function $f$ with parameters $( \sigma _ { b } , \sigma _ { w } ) \in E O C$ introduced in Lemma $^ { l }$ is convex.
112
+
113
+ Then, for any $\sigma _ { b } \in [ 0 , A ]$ , we have $K _ { \phi , v a r } ( \sigma _ { b } , \sigma _ { w } ) \ge q$ , and
114
+
115
+ $$
116
+ \operatorname* { l i m } _ { \sigma _ { b } \to 0 } \operatorname* { s u p } _ { x \in [ 0 , 1 ] } | f ( x ) - x | = 0 .
117
+ $$
118
+
119
+ Note that ReLU does not satisfy the condition $( i i )$ since the EOC in this case is the singleton $( \sigma _ { b } ^ { 2 } , \sigma _ { w } ^ { 2 } ) = ( 0 , 2 )$ . The result of Proposition 4 states that we can make $f ( x )$ close to $x$ by considering $\sigma _ { b } \ \ 0$ . However, this is under condition $( i i i )$ which states that $\textstyle \operatorname* { l i m } _ { \sigma _ { b } \to 0 } q \ = \ 0$ . Therefore, practically, we cannot take $\sigma _ { b }$ too small. One might wonder whether condition $( i i i )$ is necessary for this result to hold. The next lemma shows that removing this condition results in a useless class of activation functions.
120
+
121
+ ![](images/2c52e8ca7c9650fb6981180040517400bd14ed471e430e501603d0e81e0fd882.jpg)
122
+
123
+ (a) The correlation function $f$ of a Swish network for different values of $\sigma _ { b }$
124
+
125
+ ![](images/4fddc8b8d1192b827546854ef5e42088eb4844a2a488f6e319586405c4f4307b.jpg)
126
+ (b) A draw from the output function of a Swish network with depth 30 and width 100 on the edge of chaos for
127
+ Figure 4: Correlation function and a draw of the output for a Swish network
128
+
129
+ Lemma 2. Under the conditions of Proposition 4, the only change being $\textstyle \operatorname* { l i m } _ { \sigma _ { b } \to 0 } q > 0$ , the result of Proposition 4 holds if only if the activation function is linear.
130
+
131
+ The next proposition gives sufficient conditions for bounded activation functions to satisfy all the conditions of Proposition 4.
132
+
133
+ Proposition 5. Let $\phi$ be a bounded function such that $\phi ( 0 ) = 0$ , $\phi ^ { \prime } ( 0 ) > 0$ , $\phi ^ { \prime } ( x ) \geq 0$ , $\phi ( - x ) =$ $- \phi ( x )$ , $x \phi ( x ) > 0$ and $x \phi ^ { \prime \prime } ( x ) < 0$ for $x \neq 0$ , and $\phi$ satisfies (ii) in Proposition 4. Then, $\phi$ satisfies all the conditions of Proposition 4.
134
+
135
+ The conditions in Proposition 5 are easy to verify and are, for example, satisfied by Tanh and Arctan. We can also replace the assumption " $" \phi$ satisfies (ii) in Proposition $4 "$ by a sufficient condition (see Proposition 7 in the Supplementary Material). Tanh-like activation functions provide better information flow in deep networks compared to ReLU-like functions. However, these functions suffer from the vanishing gradient problem during back-propagation; see, e.g., Pascanu et al. (2013) and Kolen & Kremer (2001). Thus, an activation function that satisfies the conditions of Proposition 4 (in order to have a good ’information flow’) and does not suffer from the vanishing gradient issue is expected to perform better than ReLU. Swish is a good candidate.
136
+
137
+ Proposition 6. The Swish activation function $\begin{array} { r } { \phi _ { s w i s h } ( x ) = x \cdot s i g m o i d ( x ) = \frac { x } { 1 + e ^ { - x } } } \end{array}$ satisfies all the conditions of Proposition 4.
138
+
139
+ It is clear that Swish does not suffer from the vanishing gradient problem as it has a gradient close to 1 for large inputs like ReLU. Figure 4 (a) displays $f$ for Swish for different values of $\sigma _ { b }$ . We see that $f$ is indeed approaching the identity function when $\sigma _ { b }$ is small, preventing the correlations from converging to 1. Figure 4(b) displays a draw of the output of a neural network of depth 30 and width 100 with Swish activation, and $\sigma _ { b } = 0 . 2$ . The outputs displays much more variability than the ones of the ReLU network with the same architecture. We present in Table 1 some values of $\left( \sigma _ { b } , \sigma _ { w } \right)$ on the EOC as well as the corresponding limiting variance for Swish. As condition $( i i i )$ of Proposition 4 is satisfied, the limiting variance $q$ decreases with $\sigma _ { b }$ .
140
+
141
+ Table 1: Values of $\left( \sigma _ { b } , \sigma _ { w } \right)$ on the EOC and limiting variance $q$ for Swish
142
+
143
+ <table><tr><td>Jb</td><td>0.1</td><td>0.2</td><td>0.3</td><td>0.4</td><td>0.5</td></tr><tr><td>w</td><td>1.845</td><td>1.718</td><td>1.616</td><td>1.537</td><td>1.485</td></tr><tr><td>q</td><td>0.14</td><td>0.44</td><td>0.61</td><td>1.01</td><td>2.13</td></tr></table>
144
+
145
+ Other activation functions that have been shown to outperform empirically ReLU such as ELU (Clevert et al. (2016)), SELU (Klambauer et al. (2017)) and Softplus also satisfy the conditions of Proposition 4 (see Supplementary Material for ELU). The comparison of activation functions satisfying the conditions of Proposition 4 remains an open question.
146
+
147
+ # 4 EXPERIMENTAL RESULTS
148
+
149
+ We demonstrate empirically our results on the MNIST dataset. In all the figures below, we compare the learning speed (test accuracy with respect to the number of epochs/iterations) for different activation functions and initialization parameters. We use the Adam optimizer with learning rate $\mathbf { l r } = 0 . 0 0 1$ . The Python code to reproduce all the experiments will be made available on-line.
150
+
151
+ Initialization on the Edge of Chaos We initialize randomly the deep network by sampling $W _ { i j } ^ { l } \stackrel { i i d } { \sim }$ $\mathcal { N } ( 0 , \sigma _ { w } ^ { 2 } / N _ { l - 1 } )$ and $B _ { i } ^ { l } \overset { i i d } { \sim } \mathcal { N } ( 0 , \sigma _ { b } ^ { 2 } )$ . In Figure 5, we compare the learning speed of a Swish network for different choices of random initialization. Any initialization other than on the edge of chaos results in the optimization algorithm being stuck eventually at a very poor test accuracy of $\sim 0 . 1$ as the depth $L$ increases (equivalent to selecting the output uniformly at random). To understand what is happening in this case, let us recall how the optimization algorithm works. Let $\{ ( X _ { i } , Y _ { i } ) , 1 \leq i \leq N \}$ be the MNIST dataset. The loss we optimize is given by $\begin{array} { r } { \mathcal { L } ( w , b ) = \sum _ { i = 1 } ^ { N } \ell ( y ^ { L } ( X _ { i } ) , Y _ { i } ) / N } \end{array}$ where $y ^ { L } ( x )$ is the output of the network, and $\ell$ is the categorical cross-entropy loss. In the ordered phase, we know that the output converges exponentially to a fixed value (same value for all $X _ { i }$ ), thus a small change in $w$ and $b$ will not change significantly the value of the loss function, therefore the gradient is approximately zero and the gradient descent algorithm will be stuck around the initial value.
152
+
153
+ ![](images/efaa881563f0962ee53a7d2dd5064e0ba71fe98dcd7e8d5cbe738619d65835cc.jpg)
154
+ Figure 5: Impact of the initialization on the edge of chaos for Swish network
155
+
156
+ ReLU versus Tanh We proved in Section 3.2 that the Tanh activation guarantees better information propagation through the network when initialized on the EOC. However, Tanh suffers
157
+
158
+ ![](images/90b381d8088acb02fa69f71a50ef1959e721d6fe23d7e8eb3e19ccb898a5bc83.jpg)
159
+ Figure 6: Comparaison of ReLu and Tanh learning curves for different widths and depths
160
+
161
+ from the vanishing gradient problem. Consequently, we expect Tanh to perform better than ReLU for shallow networks as opposed to deep networks, where the problem of the vanishing gradient is not encountered. Numerical results confirm this fact. Figure 6 shows curves of validation accuracy with confidence interval $9 0 \%$ (30 simulations). For depth 5, the learning algorithm converges faster for Tanh compared to ReLu. However, for deeper networks $L \geq 4 0 ) ,$ ), Tanh is stuck at a very low test accuracy, this is due to the fact that a lot of parameters remain essentially unchanged because the gradient is very small.
162
+
163
+ ReLU versus Swish As established in Section 3.2, Swish, like Tanh, propagates the information better than ReLU and, contrary to Tanh, it does not suffer from the vanishing gradient problem. Hence our results suggest that Swish should perform better than ReLU, especially for deep architectures. Numerical results confirm this fact. Figure 7 shows curves of validation accuracy with confidence interval $9 0 \%$ (30 simulations). Swish performs clearly better than ReLU especially for depth 40. A comparative study of final accuracy is shown in Table 2. We observe a clear advantage for Swish, especially for large depths. Additional simulations results on diverse datasets demonstrating better performance of Swish over many other activation functions can be found in Ramachandran et al. (2017) (Notice that these authors have already implemented Swish in Tensorflow).
164
+
165
+ ![](images/979885afdba59d50b929b7fd51a2d90a3bfd77ad0071b79dd3be779dcf9f0384.jpg)
166
+ Figure 7: Convergence across iterations of the learning algorithm for ReLU and Swish networks
167
+
168
+ Table 2: Accuracy on test set for different values of (width, depth)
169
+
170
+ <table><tr><td></td><td>(10,5)</td><td>(20,10)</td><td>(40,30)</td><td>(60,40)</td></tr><tr><td>ReLU</td><td>94.01</td><td>96.01</td><td>96.51</td><td>91.45</td></tr><tr><td>Swish</td><td>94.46</td><td>96.34</td><td>97.09</td><td>97.14</td></tr></table>
171
+
172
+ # 5 CONCLUSION AND DISCUSSION
173
+
174
+ We have complemented here the analysis of Schoenholz et al. (2017) which shows that initializing networks on the EOC provides a better propagation of information across layers. In the ReLU case, such an initialization corresponds to the popular approach proposed in He et al. (2015). However, even on the EOC, the correlations still converge to 1 at a polynomial rate for ReLU networks. We have obtained a set of sufficient conditions for activation functions which further improve information propagation when the parameters $\left( \sigma _ { b } , \sigma _ { w } \right)$ are on the EOC. The Tanh activation satisfied those conditions but, more interestingly, other functions which do not suffer from the vanishing/exploding gradient problems also verify them. This includes the Swish function used in Hendrycks & Gimpel (2016), Elfwing et al. (2017) and promoted in Ramachandran et al. (2017) but also ELU Clevert et al. (2016).
175
+
176
+ Our results have also interesting implications for Bayesian neural networks which have received renewed attention lately; see, e.g., Hernandez-Lobato $\&$ Adams (2015) and Lee et al. (2018). They show that if one assigns i.i.d. Gaussian prior distributions to the weights and biases, the resulting prior distribution will be concentrated on close to constant functions even on the EOC for ReLU-like activation functions. To obtain much richer priors, our results indicate that we need to select not only parameters $\left( \sigma _ { b } , \sigma _ { w } \right)$ on the EOC but also an activation function satisfying Proposition 4.
177
+
178
+ # REFERENCES
179
+
180
+ Y. Cho and L.K. Saul. Kernel methods for deep learning. Advances in Neural Information Processing Systems, 22:342–350, 2009.
181
+ D.A. Clevert, T. Unterthiner, and S. Hochreiter. Fast and accurate deep network learning by exponential linear units (elus). International Conference on Learning Representations, 2016.
182
+ S. Elfwing, E. Uchibe, and K. Doya. Sigmoid-weighted linear units for neural network function approximation in reinforcement learning. arXiv:1702.03118, 2017.
183
+ K. He, X. Zhang, S. Ren, and J. Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. ICCV, 2015.
184
+ D.. Hendrycks and K. Gimpel. Bridging nonlinearities and stochastic regularizers with gaussian error linear units. arXiv:1606.08415, 2016.
185
+ J. M. Hernandez-Lobato and R.P. Adams. Probabilistic backpropagation for scalable learning of bayesian neural networks. ICML, 2015.
186
+ G. Klambauer, T. Unterthiner, and A. Mayr. Self-normalizing neural networks. Advances in Neural Information Processing Systems, 30, 2017.
187
+ J.F. Kolen and S.C. Kremer. Gradient flow in recurrent nets: The difficulty of learning longterm dependencies. A Field Guide to Dynamical Recurrent Network, Wiley-IEEE Press, pp. 464–, 2001.
188
+ Y. LeCun, L. Bottou, G. Orr, and K. Muller. Efficient backprop. Neural Networks: Tricks of the trade, Springer, 1998.
189
+ J. Lee, Y. Bahri, R. Novak, S.S. Schoenholz, J. Pennington, and J. Sohl-Dickstein. Deep neural networks as gaussian processes. 6th International Conference on Learning Representations, 2018.
190
+ A.G. Matthews, J. Hron, M. Rowland, R.E. Turner, and Z. Ghahramani. Gaussian process behaviour in wide deep neural networks. 6th International Conference on Learning Representations, 2018.
191
+ G.F. Montufar, R. Pascanu, K. Cho, and Y. Bengio. On the number of linear regions of deep neural networks. Advances in Neural Information Processing Systems, 27:2924–2932, 2014.
192
+ R.M. Neal. Bayesian learning for neural networks. Springer Science & Business Media, 118, 1995.
193
+ R. Pascanu, T. Mikolov, and Y. Bengio. On the difficulty of training recurrent neural networks. Proceedings of the 30th International Conference on Machine Learning, 28:1310–1318, 2013.
194
+ B. Poole, S. Lahiri, M. Raghu, J. Sohl-Dickstein, and S. Ganguli. Exponential expressivity in deep neural networks through transient chaos. 30th Conference on Neural Information Processing Systems, 2016.
195
+ P. Ramachandran, B. Zoph, and Q.V. Le. Searching for activation functions. arXiv e-print 1710.05941, 2017.
196
+ S.S. Schoenholz, J. Gilmer, S. Ganguli, and J. Sohl-Dickstein. Deep information propagation. 5th International Conference on Learning Representations, 2017.
197
+
198
+ # A PROOFS
199
+
200
+ We provide in the supplementary material the proofs of the propositions presented in the main document, and we give additive theoretical and experimental results. For the sake of clarity we recall the propositions before giving their proofs.
201
+
202
+ # A.1 CONVERGENCE TO THE FIXED POINT: PROPOSITION 1
203
+
204
+ Proposition 1. Let $\begin{array} { r } { M _ { \phi } : = \operatorname* { s u p } _ { x \ge 0 } \mathbb { E } [ | \phi ^ { \prime 2 } ( x Z ) + \phi ^ { \prime \prime } ( x Z ) \phi ( x Z ) | ] } \end{array}$ . Suppose $M _ { \phi } < \infty$ , then for $\begin{array} { r } { \sigma _ { w } ^ { 2 } < \frac { 1 } { M _ { \phi } } } \end{array}$ and any $\sigma _ { b }$ , we have $( \sigma _ { b } , \sigma _ { w } ) \in D _ { \phi , v a r }$ and $K _ { \phi , v a r } ( \sigma _ { b } , \sigma _ { w } ) = \infty$
205
+
206
+ Moreover, let $\begin{array} { r l r } { C _ { \phi , \delta } } & { : = } & { \operatorname* { s u p } _ { x , y \geq 0 , | x - y | \leq \delta , c \in [ 0 , 1 ] } \mathbb { E } [ | \phi ^ { \prime } ( x Z _ { 1 } ) \phi ^ { \prime } ( y ( c Z _ { 1 } + \sqrt { 1 - c ^ { 2 } } Z _ { 2 } ) | ] } \end{array}$ ]. Suppose $C _ { \phi , \delta } \ < \ \infty$ for some positive $\delta$ , then for $\begin{array} { r } { \sigma _ { w } ^ { 2 } \ < \ \operatorname* { m i n } ( \frac { 1 } { M _ { \phi } } , \frac { 1 } { C _ { \phi } } ) } \end{array}$ and any $\sigma _ { b }$ , we have $( \sigma _ { b } , \sigma _ { w } ) \in$ $D _ { \phi , v a r } \cap D _ { \phi , c o r r }$ and $K _ { \phi , v a r } ( \sigma _ { b } , \sigma _ { w } ) = K _ { \phi , c o r r } ( \sigma _ { b } , \sigma _ { w } ) = \infty$ .
207
+
208
+ Proof. To abbreviate the notation, we use $\boldsymbol { q } ^ { l } : = \boldsymbol { q } _ { a } ^ { l }$ for some fixed input a.
209
+
210
+ Convergence of the variances: We first consider the asymptotic behaviour of $q ^ { l } = q _ { a } ^ { l }$ . Recall that $q ^ { l } = F \tilde { ( q ^ { l - 1 } ) }$ where,
211
+
212
+ $$
213
+ F ( x ) = \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ( { \sqrt { x } } Z ) ^ { 2 } ] .
214
+ $$
215
+
216
+ The first derivative of this function is given by:
217
+
218
+ $$
219
+ F ^ { \prime } ( x ) = \sigma _ { w } ^ { 2 } \mathbb { E } [ \frac { Z } { \sqrt { x } } \phi ^ { \prime } ( \sqrt { x } Z ) \phi ( \sqrt { x } Z ) ] = \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ^ { \prime } ( \sqrt { x } Z ) ^ { 2 } + \phi ^ { \prime \prime } ( \sqrt { x } Z ) \phi ( \sqrt { x } Z ) ]
220
+ $$
221
+
222
+ where we used Gaussian integration by parts $\mathbb { E } [ Z G ( Z ) ] = \mathbb { E } [ G ^ { \prime } ( Z ) ]$ , an identify satisfied by any function $G$ such that $\mathbb { E } [ | G ^ { \prime } ( Z ) | ] < \infty$ .
223
+
224
+ Using the condition on $\phi$ , we see that for $\begin{array} { r } { \sigma _ { w } ^ { 2 } \ < \ \frac { 1 } { M _ { \phi } } } \end{array}$ , the function $F$ is a contraction mapping, and the Banach fixed-point theorem guarantees the existence of a unique fixed point $q$ of $F$ , with $\textstyle \operatorname* { l i m } _ { l \to + \infty } q ^ { l } = q$ . Note that this fixed point depends only on $F$ , therefore, this is true for any input $a$ , and $K _ { \phi , v a r } ( \sigma _ { b } , \sigma _ { w } ) = \infty$ .
225
+
226
+ Convergence of the covariances: Since $M _ { \phi } < \infty$ , then for all $a , b \in \mathbb { R } ^ { d }$ there exists $l _ { 0 }$ such that, for all $l > l _ { 0 } , | \sqrt { q _ { a } ^ { l } } - \sqrt { q _ { b } ^ { l } } | < \delta$ . Let $l > l _ { 0 }$ , using Gaussian integration by parts, we have
227
+
228
+ $$
229
+ \frac { d c _ { a b } ^ { l + 1 } } { d c _ { a b } ^ { l } } = \sigma _ { w } ^ { 2 } \mathbb { E } [ | \phi ^ { \prime } ( \sqrt { q _ { a } ^ { l } } Z _ { 1 } ) \phi ^ { \prime } ( \sqrt { q _ { b } ^ { l } } ( c _ { a b } ^ { l } Z _ { 1 } + \sqrt { 1 - ( c _ { a b } ^ { l } ) ^ { 2 } } Z _ { 2 } ) | ] .
230
+ $$
231
+
232
+ We cannot use the Banach fixed point theorem directly because the integrated function here depends on $l$ through $q ^ { l }$ . For ease of notation, we write $c ^ { l } : = \dot { c } _ { a b } ^ { l }$ , we have
233
+
234
+ $$
235
+ | c ^ { l + 1 } - c ^ { l } | = | \int _ { c ^ { l - 1 } } ^ { c ^ { l } } \frac { d c ^ { l + 1 } } { d c ^ { l } } ( x ) d x | \le \sigma _ { w } ^ { 2 } C _ { \phi } | c ^ { l } - c ^ { l - 1 } | .
236
+ $$
237
+
238
+ Therefore, for $\begin{array} { r } { \sigma _ { w } ^ { 2 } < \operatorname* { m i n } \bigl ( \frac { 1 } { M _ { \phi } } , \frac { 1 } { C _ { \phi } } \bigr ) , } \end{array}$ $c ^ { l }$ is a Cauchy sequence and it converges to a limit $c \in [ 0 , 1 ]$ At the limit
239
+
240
+ $$
241
+ c = f ( c ) = \frac { \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ( \sqrt { q } z _ { 1 } ) \phi ( \sqrt { q } ( c z _ { 1 } + \sqrt { 1 - c ^ { 2 } } z _ { 2 } ) ) ) ] } { q } ,
242
+ $$
243
+
244
+ The derivative of this function is given by
245
+
246
+ $$
247
+ f ^ { \prime } ( x ) = \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ^ { \prime } ( { \sqrt { q } } Z _ { 1 } ) \phi ^ { \prime } ( { \sqrt { q } } ( x Z _ { 1 } + { \sqrt { 1 - x } } Z _ { 2 } ) ]
248
+ $$
249
+
250
+ By assumption on $\phi$ and the choice of $\sigma _ { w }$ , we have $\begin{array} { r } { \operatorname* { s u p } _ { x } | f ^ { \prime } ( x ) | < 1 } \end{array}$ , so that $f$ is a contraction, and has a unique fixed point. Since $f ( 1 ) = 1$ , $c = 1$ . The above result is true for any $a , b$ , therefore, $K _ { \phi , v a r } ( \sigma _ { b } , \sigma _ { w } ) = \bar { K } _ { \phi , c o r r } ( \sigma _ { b } , \sigma _ { w } ) = \infty$ . □
251
+
252
+ As an illustration we plot in Figure 12 the variance for three different inputs with $( \sigma _ { b } , \sigma _ { w } ) = ( 1 , 1 )$ , as a function of the layer l. In this example, the convergence for Tanh is faster than that of ReLU.
253
+
254
+ ![](images/2a659e3f248b7002f1d1f26a057bc37f97be473666bff9d2326a11970e0e601b.jpg)
255
+ Figure 8: Convergence of the variance for three different inputs with $( \sigma _ { b } , \sigma _ { w } ) = ( 1 , 1 )$
256
+
257
+ Lemma 1. Let $( \sigma _ { b } , \sigma _ { w } ) \in D _ { \phi , v a r } \cap D _ { \phi , c o r r }$ such that $q > 0$ , $a , b \in \mathbb { R } ^ { d }$ and $\phi$ an activation function such that $\begin{array} { r } { \operatorname* { s u p } _ { x \in K } \mathbb { E } [ \phi ( x Z ) ^ { 2 } ] < \infty } \end{array}$ for all compact sets $K$ . Define $f _ { l }$ by $c _ { a , b } ^ { l + 1 } = f _ { l } ( c _ { a , b } ^ { l } )$ and $f$ by $\begin{array} { r } { f ( x ) = \frac { \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ( \sqrt { q } Z _ { 1 } ) \phi ( \sqrt { q } ( x Z _ { 1 } + \sqrt { 1 - x ^ { 2 } } Z _ { 2 } ) ) } { q } } \end{array}$ . Then $\begin{array} { r } { \operatorname* { l i m } _ { l \infty } \operatorname* { s u p } _ { x \in [ 0 , 1 ] } | f _ { l } ( x ) - f ( x ) | = 0 . } \end{array}$ .
258
+
259
+ Proof. For $x \in [ 0 , 1 ]$ , we have
260
+
261
+ $$
262
+ \begin{array} { l } { \displaystyle f _ { l } ( x ) - f ( x ) = \big ( \frac { 1 } { \sqrt { q _ { a } ^ { l } q _ { b } ^ { l } } } - \frac { 1 } { q } \big ) \big ( \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi \big ( \sqrt { q _ { a } ^ { l } } Z _ { 1 } \big ) \phi \big ( \sqrt { q _ { b } ^ { l } } u _ { 2 } ( x ) \big ) ] \big ) } \\ { \displaystyle \qquad + \frac { \sigma _ { w } ^ { 2 } } { q } \big ( \mathbb { E } [ \phi \big ( \sqrt { q _ { a } ^ { l } } Z _ { 1 } \big ) \phi \big ( \sqrt { q _ { b } ^ { l } } u _ { 2 } ( x ) \big ) ] - \mathbb { E } [ \phi \big ( \sqrt { q } Z _ { 1 } \big ) \phi ( \sqrt { q } u _ { 2 } ( x ) \big ) ] \big ) , } \end{array}
263
+ $$
264
+
265
+ where $u _ { 2 } ( x ) : = x Z _ { 1 } + \sqrt { 1 - x ^ { 2 } } Z _ { 2 }$ . The first term goes to zero uniformly in $x$ using the condition on $\phi$ and Cauchy-Schwartz inequality. As for the second term, it can be written as
266
+
267
+ $$
268
+ \mathbb { E } [ ( \phi ( \sqrt { q _ { a } ^ { l } } Z _ { 1 } ) - \phi ( \sqrt { q } Z _ { 1 } ) ) \phi ( \sqrt { q _ { b } ^ { l } } u _ { 2 } ( x ) ) ] + \mathbb { E } [ \phi ( \sqrt { q } Z _ { 1 } ) ( \phi ( \sqrt { q _ { b } ^ { l } } u _ { 2 } ( x ) ) - \phi ( \sqrt { q } u _ { 2 } ( x ) ) ) ]
269
+ $$
270
+
271
+ again, using Cauchy-Schwartz and the condition on $\phi$ , both terms can be controlled uniformly in $x$ by an integrable upper bound. We conclude using the Dominated convergence. □
272
+
273
+ A.2 RESULTS FOR RELU-LIKE ACTIVATION FUNCTIONS: PROOF OF PROPOSITIONS 2 AND 3
274
+
275
+ Proposition 2. Let $\phi$ be a ReLU-like function with $\lambda$ and $\beta$ defined above. Then for any $\sigma _ { w } \ <$ q 2λ2+β2 and σb ≥ 0, we have (σb, σw) ∈ Dφ,var with Kφ,var(σb, σw) = ∞. Moreover EOC = $\big \{ ( 0 , \frac { 1 } { \sqrt { \mathbb { E } [ \phi ^ { \prime } ( Z ) ^ { 2 } ] } } ) \big \}$ and, on the EOC, $F ( x ) = x$ for any $x \geq 0$ .
276
+
277
+ Proof. We write $q ^ { l } = q _ { a } ^ { l }$ throughout the proof. Note first that the variance satisfies the recursion:
278
+
279
+ $$
280
+ q ^ { l + 1 } = \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ( Z ) ^ { 2 } ] q ^ { l } = \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } \frac { \lambda ^ { 2 } + \beta ^ { 2 } } { 2 } q ^ { l } .
281
+ $$
282
+
283
+ For all $\begin{array} { r } { \sigma _ { w } < \sqrt { \frac { 2 } { \lambda ^ { 2 } + \beta ^ { 2 } } } } \end{array}$ , $q = \sigma _ { b } ^ { 2 } \left( 1 - \sigma _ { w } ^ { 2 } ( \lambda ^ { 2 } + \beta ^ { 2 } ) / 2 \right) ^ { - 1 }$ is a fixed point. This is true for any input, therefore $K _ { \phi , v a r } ( \sigma _ { b } , \sigma _ { w } ) = \infty$ and (i) is proved.
284
+
285
+ Now, the EOC equation is given by $\begin{array} { r } { \chi _ { 1 } = \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ^ { \prime } ( Z ) ^ { 2 } ] = \sigma _ { w } ^ { 2 } \frac { \lambda ^ { 2 } + \beta ^ { 2 } } { 2 } } \end{array}$ . Therefore, σ2w $\begin{array} { r } { \sigma _ { w } ^ { 2 } = \frac { 2 } { \lambda ^ { 2 } + \beta ^ { 2 } } } \end{array}$ . Replacing $\sigma _ { w } ^ { 2 }$ by its critical value in equation 4 yields
286
+
287
+ $$
288
+ \begin{array} { r } { q ^ { l + 1 } = \sigma _ { b } ^ { 2 } + q ^ { l } . } \end{array}
289
+ $$
290
+
291
+ Thus $q = \sigma _ { b } ^ { 2 } + q$ if and only if $\sigma _ { b } = 0$ , otherwise $q ^ { l }$ diverges to infinity. So the frontier is reduced to a single point $( \sigma _ { b } ^ { 2 } , \sigma _ { w } ^ { 2 } ) = ( \bar { 0 } , \mathbb { E } [ \phi ^ { \prime } ( Z ) ^ { 2 } ] ^ { - 1 } )$ , and the variance does not depend on $l$ .
292
+
293
+ Proposition 3 (ReLU kernel). Consider a ReLU network with parameters $( \sigma _ { b } ^ { 2 } , \sigma _ { w } ^ { 2 } ) = ( 0 , 2 )$ on the EOC.We have
294
+
295
+ (i) for $x \in [ 0 , 1 ]$ , $\begin{array} { r } { f ( x ) = \frac { 1 } { \pi } x \arcsin ( x ) + \frac { 1 } { \pi } \sqrt { 1 - x ^ { 2 } } + \frac { 1 } { 2 } x , } \end{array}$ , ii) for any $( a , b )$ , $\begin{array} { r } { \operatorname* { l i m } _ { l \to \infty } c _ { a b } ^ { l } = 1 } \end{array}$ and $\begin{array} { r } { 1 - c _ { a b } ^ { l } \sim \frac { 9 \pi ^ { 2 } } { 2 l ^ { 2 } } } \end{array}$ 9π22l2 as l → ∞.
296
+
297
+ Proof. In this case the correlation function $f$ is given by $f ( x ) = 2 \mathbb { E } [ ( Z _ { 1 } ) _ { + } ( x Z _ { 1 } + \sqrt { 1 - x ^ { 2 } } Z _ { 2 } ) _ { + } ]$ where $( x ) _ { + } : = x 1 _ { x > 0 }$ .
298
+
299
+ • Let $x \in [ 0 , 1 ]$ , note that $f$ is differentiable and satisfies,
300
+
301
+ $$
302
+ \begin{array} { r } { f ^ { \prime } ( x ) = 2 \mathbb { E } [ 1 _ { Z _ { 1 } > 0 } 1 _ { x Z _ { 1 } + \sqrt { 1 - x ^ { 2 } } Z _ { 2 } > 0 } ] , } \end{array}
303
+ $$
304
+
305
+ which is also differentiable. Simple algebra leads to
306
+
307
+ $$
308
+ f ^ { " } \left( x \right) = { \frac { 1 } { \pi { \sqrt { 1 - x ^ { 2 } } } } } .
309
+ $$
310
+
311
+ Since $\begin{array} { r } { \arcsin ^ { \prime } ( x ) = \frac { 1 } { \sqrt { 1 - x ^ { 2 } } } } \end{array}$ and $f ^ { \prime } ( 0 ) = 1 / 2$
312
+
313
+ $$
314
+ f ^ { \prime } ( x ) = { \frac { 1 } { \pi } } \arcsin ( x ) + { \frac { 1 } { 2 } } .
315
+ $$
316
+
317
+ We conclude using the fact that $\textstyle { \int \arcsin } = x \arcsin + { \sqrt { 1 - x ^ { 2 } } }$ and $f ( 1 ) = 1$ .
318
+
319
+ • We first derive a Taylor expansion of $f$ near 1. Consider the change of variable $x = 1 - t ^ { 2 }$ with $t$ close to 0, then
320
+
321
+ $$
322
+ \arcsin ( 1 - t ^ { 2 } ) = { \frac { \pi } { 2 } } - { \sqrt { 2 } } t - { \frac { \sqrt { 2 } } { 1 2 } } t ^ { 3 } + O ( t ^ { 5 } ) ,
323
+ $$
324
+
325
+ so that
326
+
327
+ $$
328
+ \arcsin ( x ) = { \frac { \pi } { 2 } } - { \sqrt { 2 } } ( 1 - x ) ^ { 1 / 2 } - { \frac { \sqrt { 2 } } { 1 2 } } ( 1 - x ) ^ { 3 / 2 } + O ( ( 1 - x ) ^ { 5 / 2 } ) ,
329
+ $$
330
+
331
+ and
332
+
333
+ $$
334
+ x \arcsin ( x ) = { \frac { \pi } { 2 } } - { \sqrt { 2 } } ( 1 - x ) ^ { 1 / 2 } + { \frac { 1 1 { \sqrt { 2 } } } { 1 2 } } ( 1 - x ) ^ { 3 / 2 } + O ( ( 1 - x ) ^ { 5 / 2 } ) .
335
+ $$
336
+
337
+ Since
338
+
339
+ $$
340
+ \sqrt { 1 - x ^ { 2 } } = \sqrt { 2 } ( 1 - x ) ^ { 1 / 2 } - \frac { \sqrt { 2 } } { 4 } ( 1 - x ) ^ { 3 / 2 } + O ( ( 1 - x ) ^ { 5 / 2 } ) ,
341
+ $$
342
+
343
+ we obtain that
344
+
345
+ $$
346
+ f ( x ) \mathop = _ { x \to 1 - } x + \frac { 2 \sqrt { 2 } } { 3 \pi } ( 1 - x ) ^ { 3 / 2 } + O ( ( 1 - x ) ^ { 5 / 2 } ) .
347
+ $$
348
+
349
+ Since $\begin{array} { r } { ( f ( x ) - x ) ^ { \prime } = \frac { 1 } { \pi } ( \arcsin ( x ) - \frac { \pi } { 2 } ) < 0 } \end{array}$ and $f ( 1 ) = 1$ , for all $x \in [ 0 , 1 [ , f ( x ) > x $ If $c ^ { l } < c ^ { l + 1 }$ then by taking the image by $f$ (which is increasing because $f ^ { \prime } \geq 0 .$ ) we have that $c ^ { l + 1 } < c ^ { l + 2 }$ , and we know that $c ^ { 1 } = f ( c ^ { 0 } ) \geq c ^ { 0 }$ , so by induction the sequence $c ^ { l }$ is increasing, and therefore it converges (because it is bounded) to the fixed point of $f$ which is 1.
350
+
351
+ Nowthat $\gamma _ { l } : = 1 - c _ { a b } ^ { l }$ $a , b$ d. We note so that $\begin{array} { r } { s = \frac { 2 \sqrt { 2 } } { 3 \pi } } \end{array}$ , from the series expansion we have $\gamma _ { l + 1 } = \gamma _ { l } - s \gamma _ { l } ^ { 3 / 2 } + O ( \gamma _ { l } ^ { 5 / 2 } )$
352
+
353
+ $$
354
+ \begin{array} { l } { { \gamma _ { l + 1 } ^ { - 1 / 2 } = \gamma _ { l } ^ { - 1 / 2 } ( 1 - s \gamma _ { l } ^ { 1 / 2 } + O ( \gamma _ { l } ^ { 3 / 2 } ) ) ^ { - 1 / 2 } = \gamma _ { l } ^ { - 1 / 2 } ( 1 + \frac { s } { 2 } \gamma _ { l } ^ { 1 / 2 } + O ( \gamma _ { l } ^ { 3 / 2 } ) ) } } \\ { { \nonumber } } \\ { { \qquad = \gamma _ { l } ^ { - 1 / 2 } + \frac { s } { 2 } + O ( \gamma _ { l } ) . } } \end{array}
355
+ $$
356
+
357
+ Thus, as $l$ goes to infinity
358
+
359
+ $$
360
+ \gamma _ { l + 1 } ^ { - 1 / 2 } - \gamma _ { l } ^ { - 1 / 2 } \sim \frac { s } { 2 }
361
+ $$
362
+
363
+ and by summing and equivalence of positive divergent series
364
+
365
+ $$
366
+ \gamma _ { l } ^ { - 1 / 2 } \sim \frac { s } { 2 } l ,
367
+ $$
368
+
369
+ which terminates the proof.
370
+
371
+ A.3 A BETTER CLASS OF ACTIVATION FUNCTIONS: PROOFS OF PROPOSITIONS 4, 5, 6 AND LEMMA 2
372
+
373
+ Proposition 4 (main result). Let √ $\phi$ be an activation function. Recall the definition of the variance function $F ( x ) : = \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ( { \sqrt { x } } Z ) ^ { 2 } ]$ . Assume that
374
+ (i) $\phi ( 0 ) = 0$ , and $\phi$ has right and left derivatives in zero and at least one of them is different from zero $( \phi ^ { \prime } ( 0 ^ { + } ) \neq 0$ or $\phi ^ { \prime } ( 0 ^ { - } ) \neq 0 ,$ ), and there exists $K > 0$ such that $\textstyle | { \frac { \phi ( x ) } { x } } | \leq K$ .
375
+ (ii) There exists $A > 0$ such that for any $\sigma _ { b } \in [ 0 , A ]$ , there exists $\sigma _ { w , E O C } > 0$ such that $( \sigma _ { b } , \sigma _ { w , E O C } ) \in$ EOC.
376
+ (iii) For any $\sigma _ { b } ~ \in ~ [ 0 , A ]$ , the function $F$ with parameters $( \sigma _ { b } , \sigma _ { w , E O C } )$ is non-decreasing and $\scriptstyle \operatorname* { l i m } _ { \sigma _ { b } \to 0 } q = 0$ where $q$ is the minimal fixed point of $F$ , $q : = \operatorname* { i n f } \{ x : F ( x ) = x \} .$ ).
377
+ $( i \nu )$ For any $\sigma _ { b } \in [ 0 , A ]$ , the correlation function $f$ with parameters $( \sigma _ { b } , \sigma _ { w , E O C } )$ introduced in Lemma $^ { l }$ is convex.
378
+
379
+ Then, for any $\sigma _ { b } \in [ 0 , A ]$ , we have $K _ { \phi , v a r } ( \sigma _ { b } , \sigma _ { w } ) \ge q$ , and
380
+
381
+ $$
382
+ \operatorname* { l i m } _ { \sigma _ { b } \to 0 } \operatorname* { s u p } _ { x \in [ 0 , 1 ] } | f ( x ) - x | = 0 .
383
+ $$
384
+
385
+ Proof. We first prove that $K _ { \phi , v a r } ( \sigma _ { b } , \sigma _ { w } ) \ge q$ . We assume that $\sigma _ { b } > 0$ , the case $\sigma _ { b } = 0$ is trivial since in this case $q = 0$ (the output of the network is zero in this case).
386
+
387
+ Since $F$ is continuous and $F ( 0 ) = \sigma _ { b } ^ { 2 } > 0$ , we have $x \leq F ( x ) \leq q$ for all $x \in [ 0 , q ]$ . Using the fact that $F$ is non-decreasing for any input $a$ such that $q _ { a } ^ { 1 } \leq q$ , we have $q ^ { l }$ is increasing and converges to the fixed point $q$ . Therefore $K _ { \phi , v a r } ( \sigma _ { b } , \sigma _ { w } ) \ge q$ .
388
+
389
+ Now we prove that on the edge of chaos, we have
390
+
391
+ $$
392
+ \operatorname* { l i m } _ { \sigma _ { b } \to 0 } \frac { \sigma _ { b } ^ { 2 } } { q } = 0 .
393
+ $$
394
+
395
+ The EOC equation is given by $\sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ^ { \prime } ( { \sqrt { q } } Z ) ^ { 2 } ] = 1$ . By taking the limit $\sigma _ { b } 0$ on the edge of chaos, and using the fact that $\scriptstyle \operatorname* { l i m } _ { \sigma _ { b } \to 0 } q = 0$ , we have $\begin{array} { r } { \sigma _ { w } ^ { 2 } \frac { \phi ^ { \prime } ( 0 ^ { + } ) ^ { 2 } + \phi ^ { \prime } ( 0 ^ { - } ) ^ { 2 } } { 2 } = 1 . } \end{array}$ . Moreover $q$ verifies
396
+
397
+ $$
398
+ \frac { F ( q ) } { q } = 1 = \frac { \sigma _ { b } ^ { 2 } } { q } + \sigma _ { w } ^ { 2 } \mathbb { E } [ ( \frac { \phi ( \sqrt { q } Z ) } { \sqrt { q } } ) ^ { 2 } ] ,
399
+ $$
400
+
401
+ so that by taking the limit $\sigma _ { b } 0$ , and using the dominated convergence theorem, we have that $\begin{array} { r } { 1 = \operatorname* { l i m } _ { \sigma _ { b } \to 0 } \frac { \sigma _ { b } ^ { 2 } } { q } + \sigma _ { w } ^ { 2 } \frac { \phi ^ { \prime } ( 0 ^ { + } ) ^ { 2 } + \phi ^ { \prime } ( 0 ^ { - } ) ^ { 2 } } { 2 } = \operatorname* { l i m } _ { \sigma _ { b } \to 0 } \frac { \sigma _ { b } ^ { 2 } } { q } + 1 } \end{array}$ and equation 6 holds.
402
+
403
+ Finally since $f$ is strictly convex, for all $x \in [ 0 , 1 ] f ^ { \prime } ( x ) \leq f ^ { \prime } ( 1 ) = 1$ if $( \sigma _ { b } , \sigma _ { w } ) \in E O C$ . Therefore $\begin{array} { r } { 0 \le f ( x ) - x \le f ( 0 ) = \frac { \sigma _ { b } ^ { 2 } } { q } } \end{array}$ σ 2b , we conclude using the fact that limσb→0 $\begin{array} { r } { \operatorname* { l i m } _ { \sigma _ { b } \to 0 } \frac { \sigma _ { b } ^ { 2 } } { q } = 0 } \end{array}$ .
404
+
405
+ Note however that for all $\sigma _ { b } > 0$ , if $( \sigma _ { b } , \sigma _ { w } ) \in E O C$ , for any inputs $a , b$ , we have $\begin{array} { r } { \operatorname* { l i m } _ { l \infty } c _ { a , b } ^ { l } = 1 } \end{array}$ Indeed, since $f$ is usually strictly convex (otherwise, $f$ would be equal to identity on at least a segment of $[ 0 , 1 ] \rangle$ ) and $f ^ { \prime } ( 1 ) = 1$ , we have that $f$ is a contraction (because $f ^ { \prime } \geq 0 \mathrm { \ : \ : }$ ), therefore the correlation converges to the unique fixed point of $f$ which is 1. Therefore, in most of the cases, the result of Proposition 4 should be seen as a way of slowing down the convergence of the correlation to 1.
406
+
407
+ Lemma 2. Under the conditions of Proposition 4, the only change being $\textstyle \operatorname* { l i m } _ { \sigma _ { b } \to 0 } q > 0$ , the result of Proposition 4 holds only if the activation function is linear.
408
+
409
+ Proof. Using the convexity of $f$ and the result of Proposition 4, we have in the limit $\sigma _ { b } 0$ , $f ^ { \prime } ( 0 ) ~ = ~ f ^ { \prime } ( 1 ) ~ = ~ 1$ , which is equivalent to $\mathbb { E } [ \phi ^ { \prime } ( \sqrt { q } \bar { Z } ) ^ { 2 } ] = \mathbb { E } [ \phi ^ { \prime } ( \sqrt { q } Z ) ] ^ { 2 }$ which implies that $\mathrm { v a r } ( \phi ^ { \prime } ( { \sqrt { q } } Z ) ) = 0$ . Therefore there exists a constant $a _ { 1 }$ such that $\phi ^ { \prime } ( { \sqrt { q } } { \dot { Z } } ) = a _ { 1 }$ almost surely. This implies $\phi ^ { \prime } = a _ { 1 }$ almost everywhere. □
410
+
411
+ Proposition 5. Let $\phi$ be a bounded function such that $\phi ( 0 ) = 0$ , $\phi ^ { \prime } ( 0 ) > 0$ , $\phi ^ { \prime } ( x ) \geq 0$ , $\phi ( - x ) =$ $- \phi ( x )$ , $x \phi ( x ) > 0$ and $x \phi ^ { \prime \prime } ( x ) < 0$ for $x \neq 0$ , and $\phi$ satisfies (ii) in Proposition 4. Then, $\phi$ satisfies all the conditions of Proposition 4.
412
+
413
+ Proof. Let $\phi$ be an activation function that satisfies the conditions of Proposition 5.
414
+
415
+ (i) we have $\phi ( 0 ) = 0$ and $\phi ^ { \prime } ( 0 ) > 0$ . Since $\phi$ is bounded and $0 < \phi ^ { \prime } ( 0 ) < \infty$ , then there exists $K$ such that $\textstyle \left| { \frac { \phi ( x ) } { x } } \right| \leq K$ .
416
+
417
+ (ii) The condition (ii) is satisfied by assumption.
418
+
419
+ (iii) Let $\sigma _ { b } > 0$ and $\sigma _ { w } > 0$ . Using equation 3 together with $\phi ^ { \prime } > 0$ , we have $F ^ { \prime } ( x ) \geq 0$ so that F is non-decreasing. Moreover, we have ${ \cal F } ( \mathbb { R } ^ { + } ) \subset \mathbf { \bar { \sigma } } [ B , C ] : = [ \sigma _ { b } ^ { 2 } , \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } M ^ { 2 } ]$ , therefore any fixed point of $F$ should be in $[ B , C ]$ . We have $F ( B ) \geq B$ and $F ( C ) \leq C$ and $\mathrm { F }$ is strictly increasing, therefore, there exists a fixed point $q$ of $F$ in $[ B , C ]$ . Now we prove that $\scriptstyle \operatorname* { l i m } _ { \sigma _ { b } \to 0 } q \ = \ 0$ . Using the EOC equation, q satisfies the equation q = σ2b + E[φ( qZ)2]E[φ0(√qZ)2] . Now let’s prove that the function $\begin{array} { r } { e ( x ) : = x - \frac { \mathbb { E } [ \phi ( \sqrt { x } Z ) ^ { 2 } ] } { \mathbb { E } [ \phi ^ { \prime } ( \sqrt { x } Z ) ^ { 2 } ] } } \end{array}$ is increasing near 0 which means it is an injection near 0, this is sufficient to conclude (because we take $q$ to be the minimal fixed point). After some calculus, we have
420
+
421
+ $$
422
+ \begin{array} { r } { e ^ { \prime } ( x ) = - \frac { \mathbb { E } [ \phi ^ { \prime \prime } ( \sqrt { x } Z ) ( \phi ( \sqrt { x } Z ) \mathbb { E } [ \phi ^ { \prime } ( \sqrt { x } Z ) ^ { 2 } ] - \frac { Z } { \sqrt { x } } \phi ^ { \prime } ( \sqrt { x } Z ) \mathbb { E } [ \phi ( \sqrt { x } Z ) ^ { 2 } ] ) ] } { \mathbb { E } [ \phi ^ { \prime } ( \sqrt { x } Z ) ^ { 2 } ] } } \end{array}
423
+ $$
424
+
425
+ Using Taylor expansion near 0, after a detailed but unenlightening calculation the numerator is equal√ to $- \bar { 2 } \phi ^ { \prime } ( \bar { 0 } ) ^ { 2 } \phi ^ { \prime \prime \prime } \bar { ( 0 ) } ^ { 2 } x \sqrt { x } + O ( x ^ { 2 } )$ , therefore the function $e$ is increasing near 0.
426
+
427
+ (iv) Finally, using the notations $U _ { 1 } : = \sqrt { q } Z _ { 1 }$ and $U _ { 2 } ( x ) = \sqrt { q } ( x Z _ { 1 } + \sqrt { 1 - x ^ { 2 } } Z _ { 2 } )$ , the first and second derivatives of the correlation function are given by
428
+
429
+ $$
430
+ f ^ { \prime } ( x ) = \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ^ { \prime } ( U _ { 1 } ) \phi ^ { \prime } ( U _ { 2 } ( x ) ) ] , \quad f ^ { \prime \prime } ( x ) = \sigma _ { w } ^ { 2 } q \mathbb { E } [ \phi ^ { \prime \prime } ( U _ { 1 } ) \phi ^ { \prime \prime } ( U _ { 2 } ( x ) ) ]
431
+ $$
432
+
433
+ where we used Gaussian integration by parts. Let $x > 0$ , we have that
434
+
435
+ $$
436
+ \begin{array} { r l } & { \mathbb { E } [ \phi ^ { \prime \prime } ( U _ { 1 } ) \phi ^ { \prime \prime } ( U _ { 2 } ( x ) ) ] = \mathbb { E } [ 1 _ { \{ U _ { 1 } \geq 0 \} } \phi ^ { \prime \prime } ( U _ { 1 } ) \phi ^ { \prime \prime } ( U _ { 2 } ( x ) ) ] + \mathbb { E } [ 1 _ { \{ U _ { 1 } \leq 0 \} } \phi ^ { \prime \prime } ( U _ { 1 } ) \phi ^ { \prime \prime } ( U _ { 2 } ( x ) ) ] } \\ & { \qquad = 2 \mathbb { E } [ 1 _ { \{ U _ { 1 } \geq 0 \} } \phi ^ { \prime \prime } ( U _ { 1 } ) \phi ^ { \prime \prime } ( U _ { 2 } ( x ) ) ] } \end{array}
437
+ $$
438
+
439
+ where we used the fact that $\left( Z _ { 1 } , Z _ { 2 } \right) = \left( - Z _ { 1 } , - Z _ { 2 } \right)$ (in distribution) and $\phi ^ { \prime \prime } ( - y ) = - \phi ^ { \prime \prime } ( y )$ for any $y$ .
440
+ Using $x \phi ^ { \prime \prime } ( x ) \leq 0$ , we have $1 _ { \{ u _ { 1 } \geq 0 \} } \phi ^ { \prime \prime } ( u _ { 1 } ) \leq 0$ . We also have for all $y > 0$ , $\mathbb { E } [ \phi ^ { \prime \prime } ( U _ { 2 } ( x ) ) | U _ { 1 } =$ $y ] < 0$ , this is a consequence of the fact that $\phi ^ { \prime \prime }$ is an odd function and that for $x > 0$ and $y > 0$ , the mapping $z _ { 2 } x y + \sqrt { 1 - x ^ { 2 } } z _ { 2 }$ moves the center of the Gaussian distribution to a strictly positive number, we conclude that $f ^ { \prime \prime } ( x ) > 0$ almost everywhere and assumption (iii) of Proposition 4 is verified.
441
+
442
+ Proposition 6. The Swish activation function $\begin{array} { r } { \phi _ { s w i s h } ( x ) = x \cdot s i g m o i d ( x ) = \frac { x } { 1 + e ^ { - x } } } \end{array}$ satisfies all the conditions of Proposition 4.
443
+
444
+ ![](images/7cb72ac0c8eeec0a795011e97ce394bfeee00941378fbd8c9788dccdd18301cc.jpg)
445
+ Figure 9: Graphs of ReLU and Swish
446
+
447
+ Proof. To abbreviate notation, we note $\phi : = \phi _ { S w i s h } = x e ^ { x } / ( 1 + e ^ { x } )$ and $h : = e ^ { x } / ( 1 + e ^ { x } )$ is the Sigmoid function. This proof should be seen as a sketch of the ideas and not a rigourous proof.
448
+
449
+ • we have $\phi ( 0 ) = 0$ and $\begin{array} { r } { \phi ^ { \prime } ( 0 ) = \frac { 1 } { 2 } } \end{array}$ and $\begin{array} { r } { | \frac { \phi ( x ) } { x } | \leq 1 } \end{array}$ • As illustrated in Table 1 in the main text, it is easy to see numerically that (ii) is satisfied. Moreover, we observe that $\scriptstyle \operatorname* { l i m } _ { \sigma _ { b } \to 0 } q = 0$ , which proves the second part of the (iii).
450
+
451
+ • Now we prove that $F ^ { \prime } > 0$ , we note $g ( x ) : = x \phi ^ { \prime } ( x ) \phi ( x )$ . We have
452
+
453
+ $$
454
+ g ( x ) = x ^ { 2 } { \frac { ( 1 + e ^ { - x } + x e ^ { - x } ) } { ( 1 + e ^ { - x } ) ^ { 3 } } }
455
+ $$
456
+
457
+ Define $G$ by
458
+
459
+ $$
460
+ G ( x ) = { \left\{ \begin{array} { l l } { g ( x ) } & { { \mathrm { i f ~ } } x \leq 0 } \\ { - g ( - x ) } & { { \mathrm { i f ~ } } x > 0 } \end{array} \right. }
461
+ $$
462
+
463
+ so that $G ( - x ) = - G ( x )$ for all $x \in \mathbb { R }$ and $g ( x ) \geq G ( x )$ for all $x \leq 0$ . Let $x > 0$ , then
464
+
465
+ $$
466
+ g ( x ) > G ( x ) \Longleftrightarrow 1 + e ^ { - x } + x e ^ { - x } \geq e ^ { - 3 x } ( - 1 - e ^ { x } + x e ^ { x } )
467
+ $$
468
+
469
+ which holds true for any positive number $x$ . We thus have $g ( x ) > G ( x )$ for all real numbers $x$ . Therefore $\mathbb { E } [ g ( { \sqrt { x } } { \dot { Z } } ) ] > 0$ almost everywhere and $F ^ { \prime } > 0$ . The second part of (iii) was already proven above.
470
+
471
+ • Let $\sigma _ { b } > 0$ and $\sigma _ { w } > 0$ such that $q$ exists. Recall that
472
+
473
+ $$
474
+ f ^ { \prime \prime } ( x ) = \sigma _ { w } ^ { 2 } q \mathbb { E } [ \phi ^ { \prime \prime } ( U _ { 1 } ) \phi ^ { \prime \prime } ( U _ { 2 } ( x ) ) ]
475
+ $$
476
+
477
+ In Figure 10, we show the graph of $\mathbb { E } [ \phi ^ { \prime \prime } ( U _ { 1 } ) \phi ^ { \prime \prime } ( U _ { 2 } ( x ) ) ]$ for different values of $q$ (from 0.1 to 10, the darkest line being for $q = 1 0$ ). A rigorous proof can be done but is omitted here.
478
+
479
+ ![](images/50125c94bb1f7692afb5f4c010aa22cd23ce249a6ff6240301bffbeed8c11ec8.jpg)
480
+ Figure 10: graphs of $\mathbb { E } [ \phi ^ { \prime \prime } ( U _ { 1 } ) \phi ^ { \prime \prime } ( U _ { 2 } ( x ) ) ]$ for different values of $q$ $\mathrm { f r o m } 0 . 1$ to 10, the darkest line corresponds to $q = 1 0$ )
481
+
482
+ We observe that $f ^ { \prime \prime }$ has very small values when $q$ is large, this is a result of the fact that $\phi ^ { \prime \prime }$ is concentrated around 0.
483
+
484
+ Remark : On the edge of chaos, we have $\sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ^ { \prime } ( \sqrt { q } Z ) ^ { 2 } ] = 1$ . Recall that $F ^ { \prime }$ can also be expressed
485
+
486
+ as
487
+
488
+ $$
489
+ F ^ { \prime } ( x ) = \sigma _ { w } ^ { 2 } ( \mathbb { E } [ \phi ^ { \prime } ( { \sqrt { x } } Z ) ^ { 2 } ] + \mathbb { E } [ \phi ^ { \prime \prime } ( { \sqrt { x } } Z ) \phi ( { \sqrt { x } } Z ) ] ) ,
490
+ $$
491
+
492
+ this yields
493
+
494
+ $$
495
+ F ^ { \prime } ( q ) = 1 + \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ^ { \prime \prime } ( { \sqrt { q } } Z ) \phi ( { \sqrt { q } } Z ) ] .
496
+ $$
497
+
498
+ The term $\mathbb { E } [ \phi ^ { \prime \prime } ( { \sqrt { q } } Z ) \phi ( { \sqrt { q } } Z ) ]$ is very small compared to 1 $( \sim 0 . 0 1 )$ , therefore $F ^ { \prime } ( q ) \approx 1$ .
499
+
500
+ Notice also that the theoretical results corresponds to the equivalent Gaussian process, which is just an approximation of the neural network. Thus, using a value of $\left( \sigma _ { b } , \sigma _ { w } \right)$ close to the $E O C$ should not essentially change the quality of the result. □
501
+
502
+ # B SUPPLEMENTARY THEORETICAL RESULTS
503
+
504
+ # B.1 SUFFICIENT CONDITIONS FOR BOUNDED ACTIVATION FUNCTIONS
505
+
506
+ We can replace the conditions $" \phi$ satisfies (ii)" in Proposition 5 by a sufficient condition. However, this condition is not satisfied by Tanh.
507
+
508
+ Proposition 7. Let $\phi$ be a bounded function such that $\phi ( 0 ) = 0$ , $\phi ^ { \prime } ( 0 ) > 0$ , $\phi ^ { \prime } ( x ) \geq 0$ , $\phi ( - x ) =$ $- \phi ( x )$ , $x \phi ( x ) > 0$ and $x \phi ^ { \prime \prime } ( x ) < \bar { 0 }$ for $x \neq 0$ , and $| \mathbb { E } \phi ^ { \prime } ( x Z ) ^ { 2 } | \gtrsim | x | ^ { - 2 \beta }$ for large $x$ and some $\beta \in ( 0 , 1 )$ . Then, $\phi$ satisfies all the conditions of Proposition 4.
509
+
510
+ Proof. Let $\phi$ be an activation function that satisfies the conditions of Proposition 7. The proof is similar to the one of 5, we only need to show that having $| \mathbb { E } \phi ^ { \prime } ( x Z ) ^ { 2 } | \gtrsim | x | ^ { \frac { \cdot } { - 2 \beta } }$ for large $x$ and some $\beta \in ( 0 , 1 )$ implies that (ii) of 4 is verified.
511
+
512
+ We have that $\sigma _ { w } ^ { 2 } | \mathbb { E } \phi ^ { \prime } ( \sqrt { q } Z ) ^ { 2 } | \gtrsim \sigma _ { w } ^ { 2 } q ^ { - 2 \beta } = \sigma _ { w } ^ { 2 } ( \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ( \sqrt { q } Z ) ^ { 2 } ] ) ^ { - \beta }$ , so that we can make the term $\sigma _ { w } ^ { 2 } | \mathbb { E } \phi ^ { \prime } ( { \sqrt { q } } Z ) ^ { 2 } |$ take any value between 0 and $\infty$ . Therefore, there exists $\sigma _ { w }$ such that $( \sigma _ { b } , \sigma _ { w } ) \in E O C$ , and assumption (ii) of Proposition 4 holds.
513
+
514
+ # B.2 IMPACT OF SMOOTHNESS
515
+
516
+ In the proof of Proposition 5, we used the condition on $\phi ^ { \prime \prime }$ (odd function) to prove that $f ^ { \prime \prime } > 0$ however, in some cases when we can explicitly calculate $f$ , we do not need $\phi ^ { \prime \prime }$ to be defined. This is the case for Hard-Tanh, which is a piecewise-linear version of Tanh. We give an explicit calculation
517
+
518
+ of $f ^ { \prime \prime }$ for the Hard-Tanh activation function which we note $H T$ in what follows. We compare the performance of $H T$ and Tanh based on a metric which we will define later.
519
+
520
+ $H T$ is given by
521
+
522
+ $$
523
+ H T ( x ) = { \left\{ \begin{array} { l l } { - 1 } & { { \mathrm { i f ~ } } x < - 1 } \\ { x } & { { \mathrm { i f ~ } } - 1 \leq x \leq 1 } \\ { 1 } & { { \mathrm { i f ~ } } x > 1 } \end{array} \right. }
524
+ $$
525
+
526
+ Recall the propagation of the variance $q ^ { l }$
527
+
528
+ $$
529
+ q ^ { l + 1 } = \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } \mathbb { E } ( H T ( { \sqrt { q ^ { l } } } Z ) ^ { 2 } )
530
+ $$
531
+
532
+ where $H T$ is the Hard-Tanh function. We have
533
+
534
+ $$
535
+ \begin{array} { l } { \displaystyle \mathbb { E } ( H T ( \sqrt { q ^ { l } } Z ) ^ { 2 } ) = \mathbb { E } ( 1 _ { Z < - \frac { 1 } { \sqrt { q ^ { l } } } } ) + \mathbb { E } ( 1 _ { - 1 / \sqrt { q ^ { l } } < Z < 1 / \sqrt { q ^ { l } } } Z ^ { 2 } ) + \mathbb { E } ( 1 _ { Z > 1 / \sqrt { q ^ { l } } } ) } \\ { \displaystyle = 1 - \frac { 2 } { \sqrt { q ^ { l } } } \frac { \exp ( - \frac { 1 } { 2 q ^ { l } } ) } { \sqrt { 2 \pi } } } \end{array}
536
+ $$
537
+
538
+ This yields
539
+
540
+ $$
541
+ q ^ { l + 1 } = g ( q ^ { l } )
542
+ $$
543
+
544
+ where
545
+
546
+ $$
547
+ g ( x ) = \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } ( 1 - \frac { 2 } { \sqrt { x } } \frac { \exp ( - \frac { 1 } { x } ) } { \sqrt { 2 \pi } } )
548
+ $$
549
+
550
+ - EDGE OF CHAOS :
551
+
552
+ To study the correlation behaviour, we will assume that the variance converges to . We have $\begin{array} { r } { \mathbb { E } ( H T ^ { \prime } ( \sqrt { q } Z ) ^ { 2 } ) = \mathbb { E } ( 1 _ { - \frac { 1 } { \sqrt { q } } < Z < \frac { 1 } { \sqrt { q } } } ) = 2 \Psi ( \frac { 1 } { \sqrt { q } } ) - 1 } \end{array}$ (where $\Psi$ is the cumulative distribution function of a standard normal variable). The edge of chaos is then given by the equation $\begin{array} { r } { \sigma _ { w } ^ { 2 } ( 2 \Psi ( \frac { 1 } { \sqrt { q } } ) - 1 ) = 1 } \end{array}$ We fix $\sigma _ { w }$ to its value on the edge.
553
+
554
+ Now let $a$ and $b$ be any two inputs. We have
555
+
556
+ $$
557
+ c ^ { l + 1 } = f ( c ^ { l } )
558
+ $$
559
+
560
+ where
561
+
562
+ $$
563
+ f ( x ) = \frac { \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } \mathbb { E } [ \phi ( U _ { 1 } ) \phi ( U _ { 2 } ( x ) ) ] } { q }
564
+ $$
565
+
566
+ with $U _ { 1 } : = \sqrt { q } Z _ { 1 }$ , and $U _ { 2 } ( x ) : = \sqrt { q } ( x Z _ { 1 } + \sqrt { 1 - x ^ { 2 } } Z _ { 2 } )$ .
567
+
568
+ Lemma 3. Suppose $q ^ { l }$ converges to a fixed point $q > 0$ . Then,
569
+
570
+ $$
571
+ \forall x \in [ 0 , 1 ] , f ^ { \prime \prime } ( x ) = { \frac { \sigma _ { w } ^ { 2 } } { \pi { \sqrt { 1 - x ^ { 2 } } } } } ( e ^ { - { \frac { 1 } { q ( 1 + x ) } } } - e ^ { - { \frac { 1 } { q ( 1 - x ) } } } )
572
+ $$
573
+
574
+ Proof. We note $\alpha : = 1 / \sqrt { q }$ . For $x \in [ 0 , 1 [$ , we have that :
575
+
576
+ $$
577
+ \begin{array} { r l } & { f ^ { \prime } ( x ) = \sigma _ { w } ^ { 2 } \mathbb { E } [ 1 _ { - \alpha < Z _ { 1 } < \alpha } \times 1 _ { - \alpha < x Z _ { 1 } + \sqrt { 1 - x ^ { 2 } } Z _ { 2 } < \alpha } ] } \\ & { \qquad = \sigma _ { w } ^ { 2 } \mathbb { E } [ 1 _ { - \alpha < Z _ { 1 } < \alpha } \times ( 1 _ { - \alpha < x Z _ { 1 } + \sqrt { 1 - x ^ { 2 } } Z _ { 2 } } - 1 _ { \alpha < x Z _ { 1 } + \sqrt { 1 - x ^ { 2 } } Z _ { 2 } } ) ] } \end{array}
578
+ $$
579
+
580
+ ![](images/9195e7216aa5aee30204de1ad9c55360e68b56e23eef8522af62ddbb65e5d2c6.jpg)
581
+ Figure 11: The correlation function on the edge of order-to-chaos for a Tanh network with small values of $\sigma _ { b }$
582
+
583
+ We deal with the first part $f _ { 1 } ( x ) = \sigma _ { w } ^ { 2 } \mathbb { E } [ 1 _ { - \alpha < Z _ { 1 } < \alpha } \times 1 _ { - \alpha < x Z _ { 1 } + \sqrt { 1 - x ^ { 2 } } Z _ { 2 } } ]$ , we have that :
584
+
585
+ $$
586
+ \begin{array} { l } { { f _ { 1 } ^ { \prime } ( x ) = \displaystyle \sigma _ { w } ^ { 2 } \mathbb { E } [ 1 _ { - \alpha < Z _ { 1 } < \alpha } \times \frac { 1 } { \sqrt { 1 - x ^ { 2 } } } ( Z _ { 1 } - \frac { x } { \sqrt { 1 - x ^ { 2 } } } Z _ { 2 } ) \delta _ { - \alpha = x Z _ { 1 } + \sqrt { 1 - x ^ { 2 } } Z _ { 2 } } ] } } \\ { { \displaystyle \quad = \frac { \sigma _ { w } ^ { 2 } } { \sqrt { 2 \pi } } \mathbb { E } [ 1 _ { - \alpha < Z _ { 1 } < \alpha } \times \frac { 1 } { \sqrt { 1 - x ^ { 2 } } } \frac { Z _ { 1 } + x \alpha } { 1 - x ^ { 2 } } \exp ( - \frac { ( x Z _ { 1 } + \alpha ) ^ { 2 } } { 2 ( 1 - x ^ { 2 } ) } ) ] } } \\ { { \displaystyle \quad = \frac { \sigma _ { w } ^ { 2 } } { 2 \pi \sqrt { 1 - x ^ { 2 } } } \int _ { - \alpha } ^ { \alpha } \frac { z _ { 1 } + x \alpha } { 1 - x ^ { 2 } } \exp ( - \frac { z _ { 1 } ^ { 2 } + 2 x \alpha z _ { 1 } + \alpha ^ { 2 } } { 2 ( 1 - x ^ { 2 } ) } ) d z _ { 1 } } } \\ { { \displaystyle \quad = \frac { \sigma _ { w } ^ { 2 } } { 2 \pi \sqrt { 1 - x ^ { 2 } } } ( e ^ { - \frac { \alpha ^ { 2 } } { 1 + x } } - e ^ { - \frac { \alpha ^ { 2 } } { 1 - x } } ) } } \end{array}
587
+ $$
588
+
589
+ we show a similar result for the second part and we conclude.
590
+
591
+ We proved that $f ^ { \prime \prime } > 0$ for Hard-Tanh, all other conditions of proposition 5 (excluding the conditions on $\phi ^ { \prime \prime }$ since those were only used to prove $f ^ { \prime \prime } > 0 _ { , }$ ) are verified, therefore the result of Proposition 4 holds for Hard-Tanh. we want to compare Tanh and Hard-Tanh when $\sigma _ { b }$ is small since this is the important case. The proof of Proposition 4 gives us an idea on how to compare them, the ratio $\frac { \sigma _ { b } ^ { 2 } } { q }$ controls the quality of approximation of f by the identity function, so a smaller ratio means a better approximation. Figure 2 shows that Tanh outperforms Hard-Tanh in this sense. This also means that for the same quality of approximation, we have bigger $q$ (bigger output variance) with Tanh compared to Hard-Tanh. This can particularly be due to the nonsmoothness of Hard-Tanh, which slows down the dominated convergence in the proof of Proposition 4.
592
+
593
+ # C SUPPLEMENTARY EXPERIMENTAL RESULTS
594
+
595
+ # C.1 ELU ACTIVATION
596
+
597
+ We show numerically that the activation function ELU defined by $\phi ( x ) = ( e ^ { x } - 1 ) 1 _ { x < 0 } + x 1 _ { x \geq 0 }$ satisfies the conditions of Proposition 4. We have $\phi ( x ) = 0 , \phi ^ { \prime } ( 0 ^ { + } ) = 1 , \phi ^ { \prime } ( 0 ^ { - } ) = 1$ and $\begin{array} { r } { | \frac { \phi ( x ) } { x } | \leq 1 } \end{array}$ . Other conditions of Proposition 4 are shown numerically in graphs below.
598
+
599
+ ![](images/e8fdfc29a4c81a85c4c20fee31bad891ca54cd1a44f746e1d4086e6d4a8c2bb4.jpg)
600
+ Figure 12: Experimental results for ELU activation
601
+
602
+ Figure 12a shows the EOC curve (condition (ii) is satisfied). Figure 12b shows that is non-decreasing and Figure 12d illustrates the fact that $\scriptstyle \operatorname* { l i m } _ { \sigma _ { b } \to 0 } q = 0$ . Finally, Figure 12c shows that function $f$ is convex. Although the figures of $F$ and $f$ are shown just for one value of $\left( \sigma _ { b } , \sigma _ { w } \right)$ , the results are true for any value of $\left( \sigma _ { b } , \sigma _ { w } \right)$ on the EOC.
603
+
604
+ # C.2 WHAT HAPPENS WHEN THE DEPTH IS LARGER THAN THE WIDTH?
605
+
606
+ Table 2 presents a comparative analysis of the validation accuracy of ReLU and Swish when the depth is larger than the width, in which case the approximation by a Gaussian process is not accurate (notice that in the approximation of a neural network by a Gaussian process, we first let $N _ { l } \to \infty$ , then we consider the limit of large $L$ ). ReLU tends to outperforms Swish when the width is smaller than the depth and both are small, however, we still observe a clear advantage of Swish for deeper architectures.
607
+
608
+ Table 3: Validation accuracy for different values of (width, depth)
609
+
610
+ <table><tr><td></td><td>(5,10)</td><td>(10,20)</td><td>(30,40)</td><td>(40,50)</td></tr><tr><td>ReLU</td><td>86.65</td><td>93.76</td><td>93.59</td><td>90.77</td></tr><tr><td>Swish</td><td>86.56</td><td>93.21</td><td>96.78</td><td>97.08</td></tr></table>
md/train/H1lK_lBtvS/H1lK_lBtvS.md ADDED
@@ -0,0 +1,275 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CLASSIFICATION-BASED ANOMALY DETECTION FOR GENERAL DATA
2
+
3
+ Liron Bergman Yedid Hoshen School of Computer Science and Engineering The Hebrew University of Jerusalem, Israel
4
+
5
+ # ABSTRACT
6
+
7
+ Anomaly detection, finding patterns that substantially deviate from those seen previously, is one of the fundamental problems of artificial intelligence. Recently, classification-based methods were shown to achieve superior results on this task. In this work, we present a unifying view and propose an open-set method, GOAD, to relax current generalization assumptions. Furthermore, we extend the applicability of transformation-based methods to non-image data using random affine transformations. Our method is shown to obtain state-of-the-art accuracy and is applicable to broad data types. The strong performance of our method is extensively validated on multiple datasets from different domains.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Detecting anomalies in perceived data is a key ability for humans and for artificial intelligence. Humans often detect anomalies to give early indications of danger or to discover unique opportunities. Anomaly detection systems are being used by artificial intelligence to discover credit card fraud, for detecting cyber intrusion, alert predictive maintenance of industrial equipment and for discovering attractive stock market opportunities. The typical anomaly detection setting is a one class classification task, where the objective is to classify data as normal or anomalous. The importance of the task stems from being able to raise an alarm when detecting a different pattern from those seen in the past, therefore triggering further inspection. This is fundamentally different from supervised learning tasks, in which examples of all data classes are observed.
12
+
13
+ There are different possible scenarios for anomaly detection methods. In supervised anomaly detection, we are given training examples of normal and anomalous patterns. This scenario can be quite well specified, however obtaining such supervision may not be possible. For example in cyber security settings, we will not have supervised examples of new, unknown computer viruses making supervised training difficult. On the other extreme, fully unsupervised anomaly detection, obtains a stream of data containing normal and anomalous patterns and attempts to detect the anomalous data. In this work we deal with the semi-supervised scenario. In this setting, we have a training set of normal examples (which contains no anomalies). After training the anomaly detector, we detect anomalies in the test data, containing both normal and anomalous examples. This supervision is easy to obtain in many practical settings and is less difficult than the fully-unsupervised case.
14
+
15
+ Many anomaly detection methods have been proposed over the last few decades. They can be broadly classified into reconstruction and statistically based methods. Recently, deep learning methods based on classification have achieved superior results. Most semi-supervised classificationbased methods attempt to solve anomaly detection directly, despite only having normal training data. One example is: Deep-SVDD (Ruff et al., 2018) - one-class classification using a learned deep space. Another type of classification-based methods is self-supervised i.e. methods that solve one or more classification-based auxiliary tasks on the normal training data, and this is shown to be useful for solving anomaly detection, the task of interest e.g. (Golan & El-Yaniv, 2018). Self-supervised classification-based methods have been proposed with the object of image anomaly detection, but we show that by generalizing the class of transformations they can apply to all data types.
16
+
17
+ In this paper, we introduce a novel technique, GOAD, for anomaly detection which unifies current state-of-the-art methods that use normal training data only and are based on classification. Our method first transforms the data into $M$ subspaces, and learns a feature space such that inter-class separation is larger than intra-class separation. For the learned features, the distance from the cluster center is correlated with the likelihood of anomaly. We use this criterion to determine if a new data point is normal or anomalous. We also generalize the class of transformation functions to include affine transformation which allows our method to generalize to non-image data. This is significant as tabular data is probably the most important for applications of anomaly detection. Our method is evaluated on anomaly detection on image and tabular datasets (cyber security and medical) and is shown to significantly improve over the state-of-the-art.
18
+
19
+ # 1.1 PREVIOUS WORKS
20
+
21
+ Anomaly detection methods can be generally divided into the following categories:
22
+
23
+ Reconstruction Methods: Some of the most common anomaly detection methods are reconstructionbased. The general idea behind such methods is that every normal sample should be reconstructed accurately using a limited set of basis functions, whereas anomalous data should suffer from larger reconstruction costs. The choice of features, basis and loss functions differentiates between the different methods. Some of the earliest methods use: nearest neighbors (Eskin et al., 2002), low-rank PCA (Jolliffe, 2011; Candes et al., 2011) or K-means (Hartigan & Wong, 1979) as the reconstruction \` basis. Most recently, neural networks were used (Sakurada & Yairi, 2014; Xia et al., 2015) for learning deep basis functions for reconstruction. Another set of recent methods (Schlegl et al., 2017; Deecke et al., 2018) use GANs to learn a reconstruction basis function. GANs suffer from mode-collapse and are difficult to invert, which limits the performance of such methods.
24
+
25
+ Distributional Methods: Another set of commonly used methods are distribution-based. The main theme in such methods is to model the distribution of normal data. The expectation is that anomalous test data will have low likelihood under the probabilistic model while normal data will have higher likelihoods. Methods differ in the features used to describe the data and the probabilistic model used to estimate the normal distribution. Some early methods used Gaussian or Gaussian mixture models. Such models will only work if the data under the selected feature space satisfies the probabilistic assumptions implicied by the model. Another set of methods used non-parametric density estimate methods such as kernel density estimate (Parzen, 1962). Recently, deep learning methods (autoencoders or variational autoencoders) were used to learn deep features which are sometimes easier to model than raw features (Yang et al., 2017). DAGMM introduced by Zong et al. (2018) learn the probabilistic model jointly with the deep features therefore shaping the features space to better conform with the probabilistic assumption.
26
+
27
+ Classification-Based Methods: Another paradigm for anomaly detection is separation between space regions containing normal data from all other regions. An example of such approach is One-Class SVM (Scholkopf et al., 2000), which trains a classifier to perform this separation. Learning a good feature space for performing such separation is performed both by the classic kernel methods as well as by the recent deep learning approach (Ruff et al., 2018). One of the main challenges in unsupervised (or semi-supervised) learning is providing an objective for learning features that are relevant to the task of interest. One method for learning good representations in a self-supervised way is by training a neural network to solve an auxiliary task for which obtaining data is free or at least very inexpensive. Auxiliary tasks for learning high-quality image features include: video frame prediction (Mathieu et al., 2016), image colorization (Zhang et al., 2016; Larsson et al., 2016), puzzle solving (Noroozi & Favaro, 2016) - predicting the correct order of random permuted image patches. Recently, Gidaris et al. (2018) used a set of image processing transformations (rotation by 0, 90, 180, 270 degrees around the image axis, and predicted the true image orientation has been used to learn high-quality image features. Golan & El-Yaniv (2018), have used similar image-processing task prediction for detecting anomalies in images. This method has shown good performance on detecting images from anomalous classes. In this work, we overcome some of the limitations of previous classification-based methods and extend their applicability of self-supervised methods to general data types. We also show that our method is more robust to adversarial attacks.
28
+
29
+ # 2 CLASSIFICATION-BASED ANOMALY DETECTION
30
+
31
+ Classification-based methods have dominated supervised anomaly detection. In this section we will analyse semi-supervised classification-based methods:
32
+
33
+ Let us assume all data lies in space $R ^ { L }$ (where $L$ is the data dimension). Normal data lie in subspace $X \subset R ^ { L }$ . We assume that all anomalies lie outside $X$ . To detect anomalies, we would therefore like to build a classifier $C$ , such that $C ( x ) = 1$ if $x \in X$ and $C ( x ) = 0$ if $x \in R ^ { L } \backslash X$ .
34
+
35
+ One-class classification methods attempt to learn $C$ directly as $P ( x \in X )$ . Classical approaches have learned a classifier either in input space or in a kernel space. Recently, Deep-SVDD (Ruff et al., 2018) learned end-to-end to i) transform the data to an isotropic feature space $f ( x )$ ii) fit the minimal hypersphere of radius $R$ and center $c _ { 0 }$ around the features of the normal training data. Test data is classified as anomalous if the following normality score is positive: $\| f ( x ) - \bar { c } _ { 0 } \| ^ { 2 } - R ^ { 2 }$ . Learning an effective feature space is not a simple task, as the trivial solution of $f ( x ) = 0 \ \forall \ x$ results in the smallest hypersphere, various tricks are used to avoid this possibility.
36
+
37
+ Geometric-transformation classification (GEOM), proposed by Golan & El-Yaniv (2018) first transforms the normal data subspace $X$ into $M$ subspaces $X _ { 1 } . . X _ { M }$ . This is done by transforming each image $x \in X$ using $M$ different geometric transformations (rotation, reflection, translation) into $T ( x , 1 ) . . T ( x , M )$ . Although these transformations are image specific, we will later extend the class of transformations to all affine transformations making this applicable to non-image data. They set an auxiliary task of learning a classifier able to predict the transformation label $m$ given transformed data point $T ( x , m )$ . As the training set consists of normal data only, each sample is $x \in X$ and the transformed sample is in $\cup _ { m } X _ { m }$ . The method attempts to estimate the following conditional probability:
38
+
39
+ $$
40
+ P ( m ^ { \prime } | T ( x , m ) ) = \frac { P ( T ( x , m ) \in X _ { m ^ { \prime } } ) P ( m ^ { \prime } ) } { \sum _ { \tilde { m } } P ( T ( x , m ) \in X _ { \tilde { m } } ) P ( \tilde { m } ) } = \frac { P ( T ( x , m ) \in X _ { m ^ { \prime } } ) } { \sum _ { \tilde { m } } P ( T ( x , m ) \in X _ { \tilde { m } } ) }
41
+ $$
42
+
43
+ Where the second equality follows by design of the training set, and where every training sample is transformed exactly once by each transformation leading to equal priors.
44
+
45
+ For anomalous data $x \in R ^ { L } \backslash X$ , by construction of the subspace, if the transformations $T$ are oneto-one, it follows that the transformed sample does not fall in the appropriate subspace: $T ( x , m ) \in$ $R _ { \mathrm { ~ - ~ } } ^ { L } \backslash X _ { m }$ . GEOM uses $P ( m | T ( x , m ) )$ as a score for determining if $x$ is anomalous i.e. that $x \in$ $R ^ { L } \backslash X$ . GEOM gives samples with low probabilities $P ( m | T ( x , m ) )$ high anomaly scores.
46
+
47
+ A significant issue with this methodology, is that the learned classifier $P ( m ^ { \prime } | T ( x , m ) )$ is only valid for samples $x \in X$ which were found in the training set. For $x \in R ^ { L } \backslash \mathrm { X }$ we should in fact have $P ( T ( x , m ) \in X _ { m ^ { \prime } } ) = 0$ for all $m = 1 . . M$ (as the transformed $x$ is not in any of the subsets). This makes the anomaly score $P ( m ^ { \prime } | T ( x , m ) )$ have very high variance for anomalies.
48
+
49
+ One way to overcome this issue is by using examples of anomalies $x _ { a }$ and training $P ( m | T ( x , m ) ) =$ $\frac { 1 } { M }$ on anomalous data. This corresponds to the supervised scenario and was recently introduced as Outlier Exposure (Hendrycks et al., 2018). Although getting such supervision is possible for some image tasks (where large external datasets can be used) this is not possible in the general case e.g. for tabular data which exhibits much more variation between datasets.
50
+
51
+ # 3 DISTANCE-BASED MULTIPLE TRANSFORMATION CLASSIFICATION
52
+
53
+ We propose a novel method to overcome the generalization issues highlighted in the previous section by using ideas from open-set classification (Bendale & Boult, 2016). Our approach unifies one-class and transformation-based classification methods. Similarly to GEOM, we transform $X$ to $X _ { 1 } . . X _ { M }$ . We learn a feature extractor $f ( x )$ using a neural network, which maps the original input data into a feature representation. Similarly to deep OC methods, we model each subspace $X _ { m }$ mapped to the feature space $\{ f ( x ) | x \in X _ { m } \}$ as a sphere with center $c _ { m }$ . The probability of data point $x$ after transformation $m$ is parameterized by $\begin{array} { r } { P ( T ( x , m ) \in X _ { m } ^ { \prime } ) = \frac { 1 } { Z } e ^ { - ( f ( T ( x , m ) ) - c _ { m } ^ { \prime } ) ^ { 2 } } } \end{array}$ . The classifier predicting transformation $m$ given a transformed point is therefore:
54
+
55
+ $$
56
+ P ( m ^ { \prime } | T ( x , m ) ) = \frac { e ^ { - \| f ( T ( x , m ) ) - c _ { m ^ { \prime } } \| ^ { 2 } } } { \sum _ { \tilde { m } } e ^ { - \| f ( T ( x , m ) ) - c _ { \tilde { m } } \| ^ { 2 } } }
57
+ $$
58
+
59
+ The centers $c _ { m }$ are given by the average feature over the training set for every transformation i.e. $\begin{array} { r } { c _ { m } = \frac { 1 } { N } \sum _ { x \in X } f ( \hat { T ( x , m ) } ) } \end{array}$ . One option is to directly learn $f$ by optimizing cross-entropy between
60
+
61
+ $P ( m ^ { \prime } | T ( x , m ) )$ and the correct label on the normal training set. In practice we obtained better results by training $f$ using the center triplet loss (He et al., 2018), which learns supervised clusters with low intra-class variation, and high-inter-class variation by optimizing the following loss function (where $s$ is a margin regularizing the distance between clusters):
62
+
63
+ $$
64
+ L = \sum _ { i } \operatorname* { m a x } ( \| f ( T ( x _ { i } , m ) ) - c _ { m } \| ^ { 2 } + s - m i n _ { m ^ { \prime } \neq m } \| f ( T ( x _ { i } , m ) ) - c _ { m ^ { \prime } } \| ^ { 2 } , 0 )
65
+ $$
66
+
67
+ Having learned a feature space in which the different transformation subspaces are well separated, we use the probability in Eq. 2 as a normality score. However, for data far away from the normal distributions, the distances from the means will be large. A small difference in distance will make the classifier unreasonably certain of a particular transformation. To add a general prior for uncertainty far from the training set, we add a small regularizing constant $\epsilon$ to the probability of each transformation. This ensures equal probabilities for uncertain regions:
68
+
69
+ $$
70
+ \tilde { P } ( m ^ { \prime } | T ( x , m ) ) = \frac { e ^ { - \| f ( T ( x , m ) ) - c _ { m ^ { \prime } } \| ^ { 2 } } + \epsilon } { \sum _ { \tilde { m } } e ^ { - \| f ( T ( x , m ) ) - c _ { \tilde { m } } \| ^ { 2 } } + M \cdot \epsilon }
71
+ $$
72
+
73
+ At test time we transform each sample by the $M$ transformations. By assuming independence between transformations, the probability that $x$ is normal (i.e. $x \in X$ ) is the product of the probabilities that all transformed samples are in their respective subspace. For log-probabilities the total score is given by:
74
+
75
+ $$
76
+ S c o r e ( x ) = - \log P ( x \in X ) = - \sum _ { m } \log \tilde { P } ( T ( x , m ) \in X _ { m } ) = - \sum _ { m } \log \tilde { P } ( m | T ( x , m ) )
77
+ $$
78
+
79
+ The score computes the degree of anomaly of each sample. Higher scores indicate a more anomalous sample.
80
+
81
+ <table><tr><td>Algorithm 1 GOAD: Training Algorithm</td></tr><tr><td>Input: Normal training data x1,x2...X N</td></tr><tr><td>Transformations T(,1),T(,2)..T(, M)</td></tr><tr><td>Output: Feature extractor f, centers C1, C2...CM T(xi,1),T(xi,2)..T(xi,M) ← xi</td></tr><tr><td>// Transform each sample by all transformations 1 to M Find f,c1, C2...CM that optimize the triplet loss in Eq. 3</td></tr></table>
82
+
83
+ # Algorithm 2 GOAD: Evaluation Algorithm
84
+
85
+ Input: Test sample: $x$ , feature extractor: $f$ , centers: c1, c2...cM , transformations: $T ( \ u , \ d ^ { 1 } ) , T ( \ u , \ d ^ { 2 } ) . . . T ( \ u , \ d M )$
86
+ Output: Score(x)
87
+ $T ( x , 1 ) , T ( x , 2 ) . . . T ( x , M ) \gets x$
88
+ // Transform test sample by all transformations 1 to M
89
+ $P ( m | T ( x , m ) ) f ( T ( x , m ) ) , c _ { 1 } , c _ { 2 } . . . c _ { M }$ // Likelihood of predicting the correct transformation (Eq. 4)
90
+ $S c o r e ( x ) \gets P ( 1 | T ( x , 1 ) ) , P ( 2 | T ( x , 2 ) ) . . . P ( M | T ( x , M ) )$ // Aggregate probabilities to compute anomaly score (Eq. 5)
91
+
92
+ # 4 PARAMETERIZING THE SET OF TRANSFORMATIONS
93
+
94
+ Geometric transformations have been used previously for unsupervised feature learning by Gidaris et al. (2018) as well as by GEOM (Golan & El-Yaniv, 2018) for classification-based anomaly detection. This set of transformations is hand-crafted to work well with convolutional neural networks (CNNs) which greatly benefit from preserving neighborhood between pixels. This is however not a requirement for fully-connected networks.
95
+
96
+ Anomaly detection often deals with non-image datasets e.g. tabular data. Tabular data is very commonly used on the internet e.g. for cyber security or online advertising. Such data consists of both discrete and continuous attributes with no particular neighborhoods or order. The data is onedimensional and rotations do not naturally generalize to it. To allow transformation-based methods to work on general data types, we therefore need to extend the class of transformations.
97
+
98
+ We propose to generalize the set of transformations to the class of affine transformations (where we have a total of $M$ transformations):
99
+
100
+ $$
101
+ T ( x , m ) = W _ { m } x + b _ { m }
102
+ $$
103
+
104
+ It is easy to verify that all geometric transformations in Golan & El-Yaniv (2018) (rotation by a multiple of 90 degrees, flips and translations) are a special case of this class ( $x$ in this case is the set of image pixels written as a vector). The affine class is however much more general than mere permutations, and allows for dimensionality reduction, non-distance preservation and random transformation by sampling $W$ , $b$ from a random distribution.
105
+
106
+ Apart from reduced variance across different dataset types where no apriori knowledge on the correct transformation classes exists, random transformations are important for avoiding adversarial examples. Assume an adversary wishes to change the label of a particular sample from anomalous to normal or vice versa. This is the same as requiring that $\tilde { P } ( m ^ { \prime } | T ( x , m ) )$ has low or high probability for $m ^ { \prime } = m$ . If $T$ is chosen deterministically, the adversary may create adversarial examples against the known class of transformations (even if the exact network parameters are unknown). Conversely, if $T$ is unknown, the adversary must create adversarial examples that generalize across different transformations, which reduces the effectiveness of the attack.
107
+
108
+ To summarize, generalizing the set of transformations to the affine class allows us to: generalize to non-image data, use an unlimited number of transformations and choose transformations randomly which reduces variance and defends against adversarial examples.
109
+
110
+ # 5 EXPERIMENTS
111
+
112
+ We perform experiments to validate the effectiveness of our distance-based approach and the performance of the general class of transformations we introduced for non-image data.
113
+
114
+ # 5.1 IMAGE EXPERIMENTS
115
+
116
+ Cifar10: To evaluate the performance of our method, we perform experiments on the Cifar10 dataset. We use the same architecture and parameter choices of Golan & El-Yaniv (2018), with our distance-based approach. We use the standard protocol of training on all training images of a single digit and testing on all test images. Results are reported in terms of AUC. In our method, we used a margin of $s = 0 . 1$ (we also run GOAD with $s = 1$ , shown in the appendix). Similarly to He et al. (2018), to stabilize training, we added a softmax $^ +$ cross entropy loss, as well as $L _ { 2 }$ norm regularization for the extracted features $f ( x )$ . We compare our method with the deep oneclass method of Ruff et al. (2018) as well as Golan & El-Yaniv (2018) without and with Dirichlet weighting. We believe the correct comparison is without Dirichlet post-processing, as we also do not use it in our method. Our distance based approach outperforms the SOTA approach by Golan & El-Yaniv (2018), both with and without Dirichlet (which seems to improve performance on a few classes). This gives evidence for the importance of considering the generalization behavior outside the normal region used in training. Note that we used the same geometric transformations as Golan & El-Yaniv (2018). Random affine matrices did not perform competitively as they are not pixel order preserving, this information is effectively used by CNNs and removing this information hurts performance. This is a special property of CNN architectures and image/time series data. As a rule of thumb, fully-connected networks are not pixel order preserving and can fully utilize random affine matrices.
117
+
118
+ Table 1: Anomaly Detection Accuracy on Cifar10 (ROC-AUC %)
119
+
120
+ <table><tr><td rowspan="2">Class</td><td colspan="4">Method</td></tr><tr><td>Deep-SVDD</td><td>GEOM (no Dirichlet)</td><td>GEOM (w. Dirichlet)</td><td>Ours</td></tr><tr><td>0</td><td>61.7 ± 1.3</td><td>76.0 ± 0.8</td><td>74.7 ± 0.4</td><td>77.2 ± 0.6</td></tr><tr><td>1</td><td>65.9 ± 0.7</td><td>83.0 ± 1.6</td><td>95.7 ± 0.0</td><td>96.7 ± 0.2</td></tr><tr><td>2</td><td>50.8 ± 0.3</td><td>79.5 ± 0.7</td><td>78.1 ± 0.4</td><td>83.3 ± 1.4</td></tr><tr><td>3</td><td>59.1 ± 0.4</td><td>71.4 ± 0.9</td><td>72.4 ± 0.5</td><td>77.7 ± 0.7</td></tr><tr><td>4</td><td>60.9 ± 0.3</td><td>83.5 ± 1.0</td><td>87.8 ± 0.2</td><td>87.8 ± 0.7</td></tr><tr><td>5</td><td>65.7 ± 0.8</td><td>84.0 ± 0.3</td><td>87.8 ± 0.1</td><td>87.8 ± 0.6</td></tr><tr><td>6</td><td>67.7 ± 0.8</td><td>78.4 ± 0.7</td><td>83.4 ± 0.5</td><td>90.0 ± 0.6</td></tr><tr><td>7</td><td>67.3 ± 0.3</td><td>89.3 ± 0.5</td><td>95.5 ± 0.1</td><td>96.1 ± 0.3</td></tr><tr><td>8</td><td>75.9 ± 0.4</td><td>88.6 ± 0.6</td><td>93.3 ± 0.0</td><td>93.8 ± 0.9</td></tr><tr><td>9</td><td>73.1 ± 0.4</td><td>82.4 ± 0.7</td><td>91.3 ± 0.1</td><td>92.0 ± 0.6</td></tr><tr><td>Average</td><td>64.8</td><td>81.6</td><td>86.0</td><td>88.2</td></tr></table>
121
+
122
+ Table 2: Anomaly Detection Accuracy on FashionMNIST (ROC-AUC %)
123
+
124
+ <table><tr><td rowspan="2">Class</td><td colspan="4">Method</td></tr><tr><td>Deep-SVDD</td><td>GEOM (no Dirichlet)</td><td>GEOM (w. Dirichlet)</td><td>Ours</td></tr><tr><td>0</td><td>98.2</td><td>77.8 ± 5.9</td><td>99.4 ± 0.0</td><td>94.1 ± 0.9</td></tr><tr><td>1</td><td>90.3</td><td>79.1 ± 16.3</td><td>97.6 ± 0.1</td><td>98.5 ± 0.3</td></tr><tr><td>2</td><td>90.7</td><td>80.8 ± 6.9</td><td>91.1 ± 0.2</td><td>90.8 ± 0.4</td></tr><tr><td>3</td><td>94.2</td><td>79.2 ± 9.1</td><td>89.9 ± 0.4</td><td>91.6 ± 0.9</td></tr><tr><td>4</td><td>89.4</td><td>77.8 ± 3.3</td><td>92.1 ± 0.0</td><td>91.4 ± 0.3</td></tr><tr><td>5</td><td>91.8</td><td>58.0 ± 29.4</td><td>93.4 ± 0.9</td><td>94.8 ± 0.5</td></tr><tr><td>6</td><td>83.4</td><td>73.6 ± 8.7</td><td>83.3 ± 0.1</td><td>83.4 ± 0.4</td></tr><tr><td>7</td><td>98.8</td><td>87.4 ± 11.4</td><td>98.9 ± 0.1</td><td>97.9 ± 0.4</td></tr><tr><td>8</td><td>91.9</td><td>84.6 ± 5.6</td><td>90.8 ± 0.1</td><td>98.9 ± 0.1</td></tr><tr><td>9</td><td>99.0</td><td>99.5 ± 0.0</td><td>99.2 ± 0.0</td><td>99.2 ± 0.3</td></tr><tr><td>Average</td><td>92.8</td><td>79.8</td><td>93.5</td><td>94.1</td></tr></table>
125
+
126
+ FasionMNIST: In Tab. 2, we present a comparison between our method (GOAD) and the strongest baseline methods (Deep SVDD and GEOM) on the FashionMNIST dataset. We used exactly the same setting as Golan & El-Yaniv (2018). GOAD was run with $s \ = \ 1$ . OCSVM and GEOM with Dirichlet were copied from their paper. We run their method without Dirichlet and presented it in the table (we verified the implementation by running their code with Dirichlet and replicated the numbers in the paper). It appears that GEOM is quite dependent on Dirichlet for this dataset, whereas we do not use it at all. GOAD outperforms all the baseline methods.
127
+
128
+ Adversarial Robustness: Let us assume an attack model where the attacker knows the architecture and the normal training data and is trying to minimally modify anomalies to look normal. We examine the merits of two settings i) the adversary knows the transformations used (non-random) ii) the adversary uses another set of transformations. To measure the benefit of the randomized transformations, we train three networks A, B, C. Networks A and B use exactly the same transformations but random parameter initialization prior to training. Network C is trained using other randomly selected transformations. The adversary creates adversarial examples using PGD (Madry et al., 2017) based on network A (making anomalies appear like normal data). On Cifar10, we randomly selected 8 transformations from the full set of 72 for $A$ and $B$ , another randomly selected 8 transformations are used for $C$ . We measure the increase of false classification rate on the adversarial examples using the three networks. The average increase in performance of classifying transformation correctly on anomalies (causing lower anomaly scores) on the original network $A$ was $1 2 . 8 \%$ , the transfer performance for B causes an increase by $5 . 0 \%$ on network $B$ which shared the same set of transformation, and $3 \%$ on network $C$ that used other rotations. This shows the benefits of using random transformations.
129
+
130
+ Table 3: Anomaly Detection Accuracy $( \% )$
131
+
132
+ <table><tr><td>Method</td><td colspan="7">Dataset</td></tr><tr><td></td><td colspan="2">Arrhythmia</td><td colspan="2">Thyroid</td><td colspan="2">KDD</td><td colspan="2">KDDRev</td></tr><tr><td></td><td>F1 Score</td><td>0</td><td>F1 Score</td><td>0</td><td>F1 Score</td><td>0</td><td>F1 Score</td><td>0</td></tr><tr><td>OC-SVM</td><td>45.8</td><td></td><td>38.9</td><td></td><td>79.5</td><td></td><td>83.2</td><td></td></tr><tr><td>E2E-AE</td><td>45.9</td><td></td><td>11.8</td><td></td><td>0.3</td><td></td><td>74.5</td><td></td></tr><tr><td>LOF</td><td>50.0</td><td>0.0</td><td>52.7</td><td>0.0</td><td>83.8</td><td>5.2</td><td>81.6</td><td>3.6</td></tr><tr><td>DAGMM</td><td>49.8</td><td></td><td>47.8</td><td></td><td>93.7</td><td></td><td>93.8</td><td></td></tr><tr><td>FB-AE</td><td>51.5</td><td>1.6</td><td>75.0</td><td>0.8</td><td>92.7</td><td>0.3</td><td>95.9</td><td>0.4</td></tr><tr><td>GOAD(Ours)</td><td>52.0</td><td>2.3</td><td>74.5</td><td>1.1</td><td>98.4</td><td>0.2</td><td>98.9</td><td>0.3</td></tr></table>
133
+
134
+ # 5.2 TABULAR DATA EXPERIMENTS
135
+
136
+ Datasets: We evaluate on small-scale medical datasets Arrhythmia, Thyroid as well as large-scale cyber intrusion detection datasets KDD and KDDRev. Our configuration follows that of Zong et al. (2018). Categorical attributes are encoded as one-hot vectors. For completeness the datasets are described in the appendix A.2. We train all compared methods on $5 0 \%$ of the normal data. The methods are evaluated on $5 0 \%$ of the normal data as well as all the anomalies.
137
+
138
+ Baseline methods: The baseline methods evaluated are: One-Class SVM (OC-SVM, Scholkopf et al. (2000)), End-to-End Autoencoder (E2E-AE), Local Outlier Factor (LOF, Breunig et al. (2000)). We also evaluated deep distributional method DAGMM (Zong et al., 2018), choosing their strongest variant. To compare against ensemble methods e.g. Chen et al. (2017), we implemented the Feature Bagging Autoencoder (FB-AE) with autoencoders as the base classifier, feature bagging as the source of randomization, and average reconstruction error as the anomaly score. OC-SVM, E2E-AE and DAGMM results are directly taken from those reported by Zong et al. (2018). LOF and FB-AE were computed by us.
139
+
140
+ Implementation of $G O A D$ : We randomly sampled transformation matrices using the normal distribution for each element. Each matrix has dimensionality $L \times r$ , where $L$ is the data dimension and $r$ is a reduced dimension. For Arryhthmia and Thyroid we used $r = 3 2$ , for KDD and KDDrev we used $r = 1 2 8$ and $r = 6 4$ respectively, the latter due to high memory requirements. We used 256 tasks for all datasets apart from KDD (64) due to high memory requirements. We set the bias term to 0. For $C$ we used fully-connected hidden layers and leaky-ReLU activations (8 hidden nodes for the small datasets, 128 and 32 for KDDRev and KDD). We optimized using ADAM with a learning rate of 0.001. Similarly to He et al. (2018), to stabilize the triplet center loss training, we added a softmax $^ +$ cross entropy loss. We repeated the large-scale experiments 5 times, and the small scale GOAD experiments 500 times (due to the high variance). We report the mean and standard deviation $( \sigma )$ . Following the protocol in Zong et al. (2018), the decision threshold value is chosen to result in the correct number of anomalies e.g. if the test set contains $N _ { a }$ anomalies, the threshold is selected so that the highest $N _ { a }$ scoring examples are classified as anomalies. True positives and negatives are evaluated in the usual way. Some experiments copied from other papers did not measure standard variation and we kept the relevant cell blank.
141
+
142
+ # Results
143
+
144
+ Arrhythmia: The Arrhythmia dataset was the smallest examined. A quantitative comparison on this dataset can be seen in Tab. 3. OC-SVM and DAGMM performed reasonably well. Our method is comparable to FB-AE. A linear classifier $C$ performed better than deeper networks (which suffered from overfitting). Early stopping after a single epoch generated the best results.
145
+
146
+ Thyroid: Thyroid is a small dataset, with a low anomaly to normal ratio and low feature dimensionality. A quantitative comparison on this dataset can be seen in Tab. 3. Most baselines performed about equally well, probably due to the low dimensionality. On this dataset, we also found that early stopping after a single epoch gave the best results. The best results on this dataset, were obtained with a linear classifier. Our method is comparable to FB-AE and beat all other baselines by a wide margin.
147
+
148
+ ![](images/a525875e49259446f38693aa0662d0b42abc1102c3d160bf98a7b77cf54d2a65.jpg)
149
+ Figure 1: Left: Classification error for our method and DAGMM as a function of percentage of the anomalous examples in the training set (on the KDDCUP99 dataset). Our method consistently outperforms the baseline. Right: Classification error as a function of the number of transformations (on the KDDRev dataset). The error and instability decrease as a function of the number of transformations. For both, lower is better.
150
+
151
+ KDDCUP99: The UCI KDD $1 0 \%$ dataset is the largest dataset examined. A quantitative comparison on this dataset can be seen in Tab. 3. The strongest baselines are FB-AE and DAGMM. Our method significantly outperformed all baselines. We found that large datasets have different dynamics from very small datasets. On this dataset, deep networks performed the best. We also, did not need early stopping. The results are reported after 25 epochs.
152
+
153
+ KDD-Rev: The KDD-Rev dataset is a large dataset, but smaller than KDDCUP99 dataset. A quantitative comparison on this dataset can be seen in Tab. 3. Similarly to KDDCUP99, the best baselines are FB-AE and DAGMM, where FB-AE significantly outperforms DAGMM. Our method significantly outperformed all baselines. Due to the size of the dataset, we did not need early stopping. The results are reported after 25 epochs.
154
+
155
+ Adversarial Robustness: Due to the large number of transformations and relatively small networks, adversarial examples are less of a problem for tabular data. PGD generally failed to obtain adversarial examples on these datasets. On KDD, transformation classification accuracy on anomalies was increased by $3 . 7 \%$ for the network the adversarial examples were trained on, $1 . 3 \%$ when transferring to the network with the same transformation and only $0 . 2 \%$ on the network with other randomly selected transformations. This again shows increased adversarial robustness due to random transformations.
156
+
157
+ # Further Analysis
158
+
159
+ Contaminated Data: This paper deals with the semi-supervised scenario i.e. when the training dataset contains only normal data. In some scenarios, such data might not be available but instead we might have a training dataset that contains a small percentage of anomalies. To evaluate the robustness of our method to this unsupervised scenario, we analysed the KDDCUP99 dataset, when $X \%$ of the training data is anomalous. To prepare the data, we used the same normal training data as before and added further anomalous examples. The test data consists of the same proportions as before. The results are shown in Fig. 1. Our method significantly outperforms DAGMM for all impurity values, and degrades more graceful than the baseline. This attests to the effectiveness of our approach. Results for the other datasets are presented in Fig. 3, showing similar robustness to contamination.
160
+
161
+ Number of Tasks: One of the advantages of GOAD, is the ability to generate any number of tasks. We present the anomaly detection performance on the KDD-Rev dataset with different numbers of tasks in Fig. 1. We note that a small number of tasks (less than 16) leads to poor results. From 16 tasks, the accuracy remains stable. We found that on the smaller datasets (Thyroid, Arrhythmia) using a larger number of transformations continued to reduce $F _ { 1 }$ score variance between differently initialized runs (Fig. 2).
162
+
163
+ # 6 DISCUSSION
164
+
165
+ Openset vs. Softmax: The openset-based classification presented by GOAD resulted in performance improvement over the closed-set softmax approach on Cifar10 and FasionMNIST. In our experiments, it has also improved performance in KDDRev. Arrhythmia and Thyroid were comparable. As a negative result, performance of softmax was better on KDD $F _ { 1 } = 0 . 9 9$ ).
166
+
167
+ Choosing the margin parameter $s$ : GOAD is not particularly sensitive to the choice of margin parameter $s$ , although choosing $s$ that is too small might cause some instability. We used a fixed value of $s = 1$ in our experiments, and recommend this value as a starting point.
168
+
169
+ Other transformations: GOAD can also work with other types of transformations such as rotations or permutations for tabular data. In our experiments, we observed that these transformation types perform comparably but a little worse than affine transformations.
170
+
171
+ Unsupervised training: Although most of our results are semi-supervised i.e. assume that no anomalies exist in the training set, we presented results showing that our method is more robust than strong baselines to a small percentage of anomalies in the training set. We further presented results in other datasets showing that our method degrades gracefully with a small amount of contamination. Our method might therefore be considered in the unsupervised settings.
172
+
173
+ Deep vs. shallow classifiers: Our experiments show that for large datasets deep networks are beneficial (particularly for the full KDDCUP99), but are not needed for smaller datasets (indicating that deep learning has not benefited the smaller datasets). For performance critical operations, our approach may be used in a linear setting. This may also aid future theoretical analysis of our method.
174
+
175
+ # 7 CONCLUSION
176
+
177
+ In this paper, we presented a method for detecting anomalies for general data. This was achieved by training a classifier on a set of random auxiliary tasks. Our method does not require knowledge of the data domain, and we are able to generate an arbitrary number of random tasks. Our method significantly improve over the state-of-the-art.
178
+
179
+ # REFERENCES
180
+
181
+ Arthur Asuncion and David Newman. Uci machine learning repository, 2007.
182
+
183
+ Abhijit Bendale and Terrance E Boult. Towards open set deep networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1563–1572, 2016.
184
+
185
+ Markus M Breunig, Hans-Peter Kriegel, Raymond T $\mathrm { N g }$ , and Jorg Sander. Lof: identifying density- ¨ based local outliers. In ACM sigmod record, volume 29, pp. 93–104. ACM, 2000.
186
+
187
+ Emmanuel J Candes, Xiaodong Li, Yi Ma, and John Wright. Robust principal component analysis? \` JACM, 2011.
188
+
189
+ Jinghui Chen, Saket Sathe, Charu Aggarwal, and Deepak Turaga. Outlier detection with autoencoder ensembles. In ICDM, 2017.
190
+
191
+ Lucas Deecke, Robert Vandermeulen, Lukas Ruff, Stephan Mandt, and Marius Kloft. Anomaly detection with generative adversarial networks. In ICLR, 2018.
192
+
193
+ Eleazar Eskin, Andrew Arnold, Michael Prerau, Leonid Portnoy, and Sal Stolfo. A geometric framework for unsupervised anomaly detection. In Applications of data mining in computer security, pp. 77–101. Springer, 2002.
194
+
195
+ Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. ICLR, 2018.
196
+
197
+ Izhak Golan and Ran El-Yaniv. Deep anomaly detection using geometric transformations. In NeurIPS, 2018.
198
+
199
+ John A Hartigan and Manchek A Wong. Algorithm as 136: A k-means clustering algorithm. Journal of the Royal Statistical Society. Series C (Applied Statistics), 1979.
200
+
201
+ Xinwei He, Yang Zhou, Zhichao Zhou, Song Bai, and Xiang Bai. Triplet-center loss for multiview 3d object retrieval. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1945–1954, 2018.
202
+
203
+ Dan Hendrycks, Mantas Mazeika, and Thomas G Dietterich. Deep anomaly detection with outlier exposure. arXiv preprint arXiv:1812.04606, 2018.
204
+
205
+ Ian Jolliffe. Principal component analysis. Springer, 2011.
206
+
207
+ Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Learning representations for automatic colorization. In ECCV, 2016.
208
+
209
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. arXiv preprint arXiv:1706.06083, 2017.
210
+
211
+ Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond mean square error. ICLR, 2016.
212
+
213
+ Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In ECCV, 2016.
214
+
215
+ Emanuel Parzen. On estimation of a probability density function and mode. The annals of mathematical statistics, 1962.
216
+
217
+ Shebuti Rayana. ODDS library http://odds.cs.stonybrook.edu, 2016.
218
+
219
+ Lukas Ruff, Nico Gornitz, Lucas Deecke, Shoaib Ahmed Siddiqui, Robert Vandermeulen, Alexander Binder, Emmanuel Muller, and Marius Kloft. Deep one-class classification. In ¨ ICML, 2018.
220
+
221
+ Mayu Sakurada and Takehisa Yairi. Anomaly detection using autoencoders with nonlinear dimensionality reduction. In MLSD. ACM, 2014.
222
+
223
+ Thomas Schlegl, Philipp Seebock, Sebastian M Waldstein, Ursula Schmidt-Erfurth, and Georg ¨ Langs. Unsupervised anomaly detection with generative adversarial networks to guide marker discovery. In International Conference on Information Processing in Medical Imaging, 2017.
224
+
225
+ Bernhard Scholkopf, Robert C Williamson, Alex J Smola, John Shawe-Taylor, and John C Platt. Support vector method for novelty detection. In NIPS, 2000.
226
+
227
+ Yan Xia, Xudong Cao, Fang Wen, Gang Hua, and Jian Sun. Learning discriminative reconstructions for unsupervised outlier removal. In ECCV, 2015.
228
+
229
+ Bo Yang, Xiao Fu, Nicholas D Sidiropoulos, and Mingyi Hong. Towards k-means-friendly spaces: Simultaneous deep learning and clustering. In ICML, 2017.
230
+
231
+ Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In ECCV, 2016.
232
+
233
+ Bo Zong, Qi Song, Martin Renqiang Min, Wei Cheng, Cristian Lumezanu, Daeki Cho, and Haifeng Chen. Deep autoencoding gaussian mixture model for unsupervised anomaly detection. ICLR, 2018.
234
+
235
+ # A APPENDIX
236
+
237
+ # A.1 IMAGE EXPERIMENTS
238
+
239
+ Sensitive to margin s: We run Cifar10 experiments with $s = 0 . 1$ and $s = 1$ and presented the results in Fig. 4. The results were not affected much by the margin parameter. This is in-line with the rest of our empirical observations that GOAD is not very sensitive to the margin parameter.
240
+
241
+ Table 4: Anomaly Detection Accuracy on Cifar10 $( \% )$
242
+
243
+ <table><tr><td rowspan="2">Class</td><td colspan="3">Method</td></tr><tr><td>GEOM (w. Dirichlet)</td><td>GOAD(s = 0.1)</td><td>GOAD(1.0)</td></tr><tr><td>0</td><td>74.7 ± 0.4</td><td>77.2 ± 0.6</td><td>77.9 ± 0.7</td></tr><tr><td>1</td><td>95.7 ± 0.0</td><td>96.7 ± 0.2</td><td>96.4 ± 0.9</td></tr><tr><td>2</td><td>78.1 ± 0.4</td><td>83.3 ± 1.4</td><td>81.8 ± 0.8</td></tr><tr><td>3</td><td>72.4 ± 0.5</td><td>77.7 ± 0.7</td><td>77.0 ± 0.7</td></tr><tr><td>4</td><td>87.8 ± 0.2</td><td>87.8 ± 0.7</td><td>87.7 ± 0.5</td></tr><tr><td>5</td><td>87.8 ± 0.1</td><td>87.8 ± 0.6</td><td>87.8 ± 0.7</td></tr><tr><td>6</td><td>83.4 ± 0.5</td><td>90.0 ± 0.6</td><td>90.9 ± 0.5</td></tr><tr><td>7</td><td>95.5 ± 0.1</td><td>96.1 ± 0.3</td><td>96.1 ± 0.2</td></tr><tr><td>8</td><td>93.3 ± 0.0</td><td>93.8 ± 0.9</td><td>93.3 ± 0.1</td></tr><tr><td>9</td><td>91.3 ± 0.1</td><td>92.0 ± 0.6</td><td>92.4 ± 0.3</td></tr><tr><td>Average</td><td>86.0</td><td>88.2</td><td>88.1</td></tr></table>
244
+
245
+ # A.2 TABULAR DATASETS
246
+
247
+ Following the evaluation protocol of Zong et al. (2018), 4 datasets are used in this comparison:
248
+
249
+ Arrhythmia: A cardiology dataset from the UCI repository (Asuncion & Newman, 2007) containing attributes related to the diagnosis of cardiac arrhythmia in patients. The datasets consists of 16 classes: class 1 are normal patients, 2-15 contain different arrhythmia conditions, and class 16 contains undiagnosed cases. Following the protocol established by ODDS (Rayana, 2016), the smallest classes: 3, 4, 5, 7, 8, 9, 14, 15 are taken to be anomalous and the rest normal. Also following ODDS, the categorical attributes are dropped, the final attributes total 274.
250
+
251
+ Thyroid: A medical dataset from the UCI repository (Asuncion & Newman, 2007), containing attributes related to whether a patient is hyperthyroid. Following ODDS (Rayana, 2016), from the 3 classes of the dataset, we designate hyperfunction as the anomalous class and the rest as normal. Also following ODDS only the 6 continuous attributes are used.
252
+
253
+ KDD: The KDD Intrusion Detection dataset was created by an extensive simulation of a US Air Force LAN network. The dataset consists of the normal and 4 simulated attack types: denial of service, unauthorized access from a remote machine, unauthorized access from local superuser and probing. The dataset consists of around 5 million TCP connection records. Following the evaluation protocol in Zong et al. (2018), we use the UCI KDD $1 0 \%$ dataset, which is a subsampled version of the original dataset. The dataset contains 41 different attributes. 34 are continuous and 7 are categorical. Following Zong et al. (2018), we encode the categorical attributes using 1-hot encoding.
254
+
255
+ Following Zong et al. (2018), we evaluate two different settings for the KDD dataset:
256
+
257
+ KDDCUP99: In this configuration we use the entire UCI $1 0 \%$ dataset. As the non-attack class consists of only $2 0 \%$ of the dataset, it is treated as the anomaly in this case, while attacks are treated as normal.
258
+
259
+ KDDCUP99-Rev: To better correspond to the actual use-case, in which the non-attack scenario is normal and attacks are anomalous, Zong et al. (2018) also evaluate on the reverse configuration, in which the attack data is sub-sampled to consist of $2 5 \%$ of the number of non-attack samples. The attack data is in this case designated as anomalous (the reverse of the KDDCUP99 dataset).
260
+
261
+ In all the above datasets, the methods are trained on $5 0 \%$ of the normal data. The methods are evaluated on $5 0 \%$ of the normal data as well as all the anomalies.
262
+
263
+ # A.3 NUMBER OF TASKS
264
+
265
+ We provide plots of the number of auxiliary tasks vs. the anomaly detection accuracy (measured by $F _ { 1 , }$ ) for all datasets. The results are presented in Fig. 2. Performance increases rapidly up to a certain number of tasks (around 16). Afterwards more tasks reduce the variance of $F _ { 1 }$ scores between runs.
266
+
267
+ ![](images/55ef42d627c9ba88b9baf86d4f5c32923b4d5808311593e446f3e1f9d9b39111.jpg)
268
+ Figure 2: Plots of the number of auxiliary tasks vs. the anomaly detection accuracy (measured by $F _ { 1 }$ ) a) Arrhythmia b) Thyroid c) KDDRev d) KDDCup99 Accuracy often increases with the number of tasks, although the rate diminishes with the number of tasks.
269
+
270
+ ![](images/1714725f825a4c3d69f4543913fba5904bbb19a3a0b1c21569169b1ff2e913bb.jpg)
271
+ Figure 3: Plots of the degree of contamination vs. the anomaly detection accuracy (measured by $F _ { 1 }$ ) (left) KDDRev (center) KDDCup99 (right) Arrhythmia. GOAD is generally robust to the degree of contamination.
272
+
273
+ # A.4 CONTAMINATION EXPERIMENTS
274
+
275
+ We conduct contamination experiments for 3 datasets. Thyroid was omitted due to not having a sufficient number of anomalies. The protocol is different than that of KDDRev as we do not have unused anomalies for contamination. Instead, we split the anomalies into train and test. Train anomalies are used for contamination, test anomalies are used for evaluation. As DAGMM did not present results for the other datasets, we only present GOAD. GOAD was reasonably robust to contamination on KDD, KDDRev and Arrhythmia. The results are presented in Fig. 3
md/train/H1vEXaxA-/H1vEXaxA-.md ADDED
@@ -0,0 +1,411 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EMERGENT TRANSLATION IN MULTI-AGENT COMMUNICATION
2
+
3
+ Jason Lee∗ New York University jason@cs.nyu.edu
4
+
5
+ Kyunghyun Cho New York University Facebook AI Research kyunghyun.cho@nyu.edu
6
+
7
+ Jason Weston Facebook AI Research jase@fb.com
8
+
9
+ Douwe Kiela Facebook AI Research dkiela@fb.com
10
+
11
+ # ABSTRACT
12
+
13
+ While most machine translation systems to date are trained on large parallel corpora, humans learn language in a different way: by being grounded in an environment and interacting with other humans. In this work, we propose a communication game where two agents, native speakers of their own respective languages, jointly learn to solve a visual referential task. We find that the ability to understand and translate a foreign language emerges as a means to achieve shared goals. The emergent translation is interactive and multimodal, and crucially does not require parallel corpora, but only monolingual, independent text and corresponding images. Our proposed translation model achieves this by grounding the source and target languages into a shared visual modality, and outperforms several baselines on both word-level and sentence-level translation tasks. Furthermore, we show that agents in a multilingual community learn to translate better and faster than in a bilingual communication setting.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ Building intelligent machines that can converse with humans is a longstanding challenge in artificial intelligence. Remarkable successes have been achieved in natural language processing (NLP) via the use of supervised learning approaches on large-scale datasets (Bahdanau et al., 2015; Wu et al., 2016; Gehring et al., 2017; Sennrich et al., 2017). Machine translation is no exception: most translation systems are trained to derive statistical patterns from huge parallel corpora. Parallel corpora, however, are expensive and difficult to obtain for many language pairs. This is especially the case for low resource languages, where parallel texts are often small or nonexistent. We address these issues by designing a multi-agent communication task, where agents interact with each other in their own native languages and try to work out what the other agent meant to communicate. We find that the ability to translate foreign languages emerges as a means to achieve a common goal.
18
+
19
+ Aside from the benefit of not requiring parallel data, we argue that our approach to learning to translate is also more natural than learning from large corpora. Humans learn languages by interacting with other humans and referring to their shared environment, i.e., by being grounded in physical reality. More abstract knowledge is built on top of this concrete foundation. It is natural to use vision as an intermediary: when communicating with someone who does not speak our language, we often directly refer to our surroundings. Even linguistically distant languages will, by physical and cognitive necessity, still refer to scenes and objects in the same visual space.
20
+
21
+ We compare our model against a number of baselines, including a nearest neighbor method and a recently proposed model (Nakayama & Nishida, 2017) that maps languages and images to a shared space, but lacks communication. We evaluate performance on both word- and sentence-level translation, and show that our model outperforms the baselines in both settings. Additionally, we show that multilingual communities of agents, comprised of native speakers of different languages, learn faster and ultimately become better translators.
22
+
23
+ # 2 PRIOR WORK
24
+
25
+ Recent work has used neural networks and reinforcement learning in multi-agent settings to solve a variety of tasks with communication, including simple coordination (Sukhbaatar et al., 2016), logic riddles (Foerster et al., 2016), complex coordination with verbal and physical interaction (Lowe et al., 2017), cooperative dialogue (Das et al., 2017) and negotiation (Lewis et al., 2017).
26
+
27
+ At the same time, there has been a surge of interest in communication protocols or languages that emerge from multi-agent communication in solving these various tasks. Lazaridou et al. (2017) first showed that simple neural network agents can learn to coordinate in an image referential game with single-symbol bandwidth. This work has been extended to induce communication protocols that are more similar to human language, allowing multi-turn communication (Jorge et al., 2016), adaptive communication bandwidth (Havrylov & Titov, 2017) and multi-turn communication with a variable-length conversation (Evtimova et al., 2017), and simple compositionality (Kottur et al., 2017; Mordatch & Abbeel, 2017). Meanwhile, Andreas et al. (2017) proposed a model to interpret continuous message vectors by “translating” them.
28
+
29
+ Our work is related to a long line of work on learning multimodal representations. Several approaches proposed to learn a joint space for images and text using Canonical Correlation Analysis (CCA) or its variants (Hodosh et al., 2013; Andrew et al., 2013; Chandar et al., 2016). Other works minimize pairwise ranking loss to learn multimodal embeddings (Socher et al., 2014; Kiros et al., 2014; Ma et al., 2015; Vendrov et al., 2015; Kiela et al., 2017). Most recently, others extended this work to learn joint representations between images and multiple languages (Gella et al., 2017; Calixto et al., 2017b; Rajendran et al., 2016).
30
+
31
+ In machine translation, our work is related to image-guided (Calixto et al., 2017a; Elliott & Kad´ ar, ´ 2017; Caglayan et al., 2016) and pivot-based (Firat et al., 2016; Hitschler et al., 2016) approaches. It is also related to previous work on multiagent translation for low-resource language pairs (without grounding) (He et al., 2016a). At word-level, there has been work on translation via a visual intermediate (Bergsma & Van Durme, 2011), including with convolutional neural network features (Kiela et al., 2015; Joulin et al., 2016).
32
+
33
+ It was recently shown that zero-resource translation is possible by separately learning an image encoder and a language decoder (Nakayama & Nishida, 2017). The main difference to our work is that their models do not perform communication.
34
+
35
+ # 3 TASK AND MODELS
36
+
37
+ # 3.1 COMMUNICATION TASK
38
+
39
+ We let two agents communicate with each other in their own respective languages to solve a visual referential task. One agent sees an image and describes it in its native language to the other agent. The other agent is given several images, one of which is the same image shown to the first agent, and has to choose the correct image using the description. The game is played in both directions simultaneously, and the agents are jointly trained to solve this task. We only allow agents to send a sequence of discrete symbols to each other, and never a continuous vector.
40
+
41
+ Our task is similar to Lazaridou et al. (2017), but with the following differences: communication (1) is bidirectional and (2) of variable length; (3) the speaker is trained on both the listener’s feedback and ground-truth annotations; and (4) the speaker only observes the target image and no distractors.
42
+
43
+ Let $P _ { A }$ and $P _ { B }$ be our agents, who speak the languages $L _ { A }$ and $L _ { B }$ respectively. We have two disjoint sets of image-annotation pairs: $( I _ { A } , M _ { A } )$ in language $L _ { A }$ and $( I _ { B } , M _ { B } )$ in language $L _ { B }$ .
44
+
45
+ Task in language $L _ { A }$ : $P _ { A }$ is the speaker and $P _ { B }$ is the listener.
46
+
47
+ 1. A target image and annotation $( i , m ) \in \{ I _ { A } , M _ { A } \}$ is drawn from the training set in $L _ { A }$
48
+
49
+ 2. Given $i$ , the speaker $( P _ { A } )$ produces a sequence of symbols $\hat { m }$ in language $L _ { A }$ to describe the image and sends it to the listener. The speaker’s goal is to produce a message that is both an accurate prediction of the ground-truth annotation $m$ , and helps the listener $( P _ { B } )$ identify the target image.
50
+
51
+ 3. $K - 1$ distracting images are drawn from $I _ { A }$ at random. The target image $i$ is added to this set and all $K$ images are shuffled.
52
+
53
+ 4. Given the message $\hat { m }$ and the $K$ images, the listener’s goal is to identify the target image.
54
+
55
+ Task with language $L _ { B }$ : The agents exchange the roles and play similarly.
56
+
57
+ We explore two different settings: (1) a word-level task where the agents communicate with a single word, and (2) a sentence-level task where agents can transmit a sequence of symbols.
58
+
59
+ # 3.2 MODEL ARCHITECTURE AND TRAINING
60
+
61
+ Each agent has an image encoder, a native speaker module and a foreign language encoder. In English-Japanese communication, for instance, the English-speaking agent $P _ { A }$ consists of an image encoder $\dot { E _ { \mathrm { I M G } } ^ { A } }$ , a native English speaker module $S _ { \mathrm { E N } } ^ { A }$ , and a Japanese encoder $E _ { \mathrm { J A } } ^ { A }$ . Similarly, the Japanese-speaking agent $P _ { B } = ( E _ { \mathrm { I M G } } ^ { B } , S _ { \mathrm { J A } } ^ { B } , E _ { \mathrm { E N } } ^ { B } )$ .
62
+
63
+ ![](images/f55d70a48a7c0202874339c4988fe3a345248b04b4950a134970866a4a077b82.jpg)
64
+ Figure 1: Sentence-level communication task and translation between English and Japanese. (a) The red dotted line delimits the agents and the gray dotted line delimits the communication tasks for different languages. Representations residing in the multimodal space of Agent A and B are shown in green and yellow, respectively. (b) An illustration of how the Japanese agent might translate an unseen English sentence to Japanese.
65
+
66
+ We now illustrate the architecture of our model using the English part of the communication task as an example (upper half of Figure 1a). We first describe the sentence-level model.
67
+
68
+ Speaker $( P _ { A } )$ Given an image-annotation pair $( i , m ) \in \{ I _ { \mathrm { E N } } , M _ { \mathrm { E N } } \}$ sampled from the English training set, let $i$ be represented as a $D _ { \mathrm { i m g } }$ -dimensional vector. $P _ { A }$ ’s speaker encodes $i$ into a $D _ { \mathrm { h i d } }$ - dimensional vector with a feedforward image encoder: $h _ { 0 } = E _ { \mathrm { I M G } } ^ { A } ( i )$ .
69
+
70
+ Our speaker module $S _ { \mathrm { E N } } ^ { A }$ is a recurrent neural network (RNN) with gated recurrent units (GRU, (Cho et al., 2014)). Our RNN takes the image representation $h _ { 0 }$ as initial hidden state and updates its state as $h _ { t + 1 } = \mathtt { G R U } ( h _ { t } , m _ { t } )$ where $m _ { t }$ is the $t$ -th token in $m$ . The output layer projects each hidden state $h _ { t }$ over the English vocabulary $\mathbb { V } _ { \mathrm { E N } }$ , followed by a softmax to predict the next token: $p _ { t } = { \tt s o f t m a x } ( W _ { o } h _ { t } + b _ { o } )$ . The speaker’s predictions are trained on the ground truth English
71
+
72
+ annotation $m$ using the cross entropy loss:
73
+
74
+ $$
75
+ \mathcal { I } _ { \mathrm { s p k } } ^ { \mathrm { E N } } = - \frac { 1 } { N _ { \mathrm { E N } } } \sum _ { ( i , m ) } ^ { \left\{ I _ { \mathrm { E N } } , M _ { \mathrm { E N } } \right\} } \sum _ { t = 1 } ^ { T _ { m } } \log p ( m _ { t } | m _ { ( < t ) } , i ) ,
76
+ $$
77
+
78
+ where $N _ { \mathrm { E N } }$ is the size of the English training set, and $T _ { m }$ is the length of $m$
79
+
80
+ To generate a sequence of tokens, we sample from the categorical distribution $\mathtt { C a t } ( p _ { t } )$ . However, sampling is a non-differentiable computation. To allow our model to be end-to-end differentiable, we use the straight-through Gumbel-softmax estimator (Jang et al., 2017; Maddison et al., 2017) to sample from $\mathtt { C a t } ( p _ { t } )$ and let the gradient flow, while the speaker sends a sequence of discrete symbols.1 The message $\hat { m }$ is a sequence of one-hot vectors: $\hat { m } = \{ y _ { t } \} _ { t = 1 } ^ { T _ { m } }$ , where $y _ { t } = \mathtt { G u m b e l { - } S T } ( p _ { t } )$ is discretized in the forward pass.
81
+
82
+ Listener $( P _ { B } )$ The Japanese-speaking agent $P _ { B }$ encodes the $K$ images into $D _ { \mathrm { h i d } }$ -dimensional multimodal space with its own feedforward image encoder: $\{ E _ { \mathrm { I M G } } ^ { B } ( i _ { k } ) \} _ { k = 1 } ^ { \tilde { K } }$ . It also feeds each token from Takin $\hat { m }$ into its English encoder RNN with he last hidden state, the representati $D _ { \mathrm { h i d } }$ - menis a l hidden states: -dimensional ve $\boldsymbol { s } _ { t + 1 } = \operatorname { G R U } ( \boldsymbol { s } _ { t } , \hat { m } _ { t } )$ .. $\hat { m }$ $D _ { \mathrm { h i d } }$ $E _ { \mathrm { E N } } ^ { B } ( \hat { m } ) = s _ { T _ { m } }$ Note, that encodings of the images and the message have the same dimensionality.
83
+
84
+ To encourage the listener to align the message representation closest to the target image, it is trained using a cross entropy loss where the logits are given by the reciprocal of the mean squared error (MSE) between the target image and the message representation: $\bar { \{ 1 / \big ( E _ { \mathrm { E N } } ^ { B } ( \hat { m } ) - E _ { \mathrm { I M G } } ^ { B } ( { i } _ { k } ) \big ) ^ { 2 } \} _ { k = 1 } ^ { K } }$
85
+
86
+ $$
87
+ \mathcal { I } _ { \mathrm { l s n } } ^ { \mathrm { E N } } = - \frac { 1 } { N _ { \mathrm { E N } } } \sum _ { i \in I _ { \mathrm { F N } } } \sum _ { \hat { m } } \log \left( \mathrm { s o f t m a x } \Big ( 1 / \big ( E _ { \mathrm { E N } } ^ { B } ( \hat { m } ) - E _ { \mathrm { I M G } } ^ { B } ( i ) \big ) ^ { 2 } \Big ) \right)
88
+ $$
89
+
90
+ where the softmax operation is performed over $K$ images. We observed that optimization significantly slows down after the initial stage of learning when training with the standard MSE loss. In order to ensure fast convergence throughout training, we use this modified form of MSE as a loss function whose slope gets steeper as the loss is minimized. See Appendix A for a discussion and a more thorough comparison and analysis.
91
+
92
+ Training These two agents are jointly trained by minimizing the sum of speaker and listener loss:
93
+
94
+ $$
95
+ \mathcal { T } = \sum _ { x \in \{ \mathrm { E N } , \mathrm { J A } \} } ( \mathcal { T } _ { \mathrm { s p k } } ^ { x } + \mathcal { T } _ { \mathrm { l s n } } ^ { x } ) .
96
+ $$
97
+
98
+ Note that the listener is only trained on $\mathcal { I } _ { \mathrm { l s n } }$ , while the speaker is trained on both $\mathcal { T } _ { \mathrm { l s n } }$ and $\mathcal { I } _ { \mathrm { s p k } }$
99
+
100
+ Word-level model The word-level model has a similar architecture to the sentence-level one: instead of an RNN, the speaker module $S _ { \mathrm { E N } } ^ { A }$ is a feedforward layer that projects $h _ { 0 }$ over the native vocabulary. We again use a straight-through Gumbel-softmax to sample a one-hot vector. Similarly, the foreign language encoder consists simply of the $D _ { \mathrm { h i d } }$ -dimensional foreign word embeddings.
101
+
102
+ General training details In both word- and sentence-level experiments, we use 2048-dimensional pre-softmax features from a pre-trained ResNet with 50 layers (He et al., 2016b), instead of raw images. Our models are trained using stochastic gradient descent with the Adam optimizer (Kingma & Ba, 2014). The norm of the gradient is clipped with a threshold of 1 (Pascanu et al., 2013). Gumbelsoftmax temperature is tuned on the validation set, but fixed throughout training, not annealed or learned.
103
+
104
+ # 3.3 HOW TRANSLATION ARISES
105
+
106
+ To translate an English sentence $m _ { \mathrm { s r c } }$ to Japanese, we let the Japanese-speaking agent $P _ { B }$ encode $m _ { \mathrm { s r c } }$ with its English encoder, and decode this representation using its Japanese speaker module:
107
+
108
+ $m _ { \mathrm { h y p } } = S _ { \mathrm { J A } } ^ { B } ( E _ { \mathrm { E N } } ^ { B } ( m _ { \mathrm { s r c } } ) )$ (see Figure 1b). Solving the image referential task requires aligning the foreign (source) sentence representation with the representation of the correct image, which will allow the speaker module to describe the source sentence in its native (target) language, as though it were an image.
109
+
110
+ # 4 WORD-LEVEL EXPERIMENTS
111
+
112
+ Task and dataset We train our model on a word-level communication task, where the agent $P _ { A }$ is given an image and needs to find the right word to communicate it so that the agent $P _ { B }$ can pick the right image from a set of distractors. We use the Bergsma500 dataset (Bergsma & Van Durme, 2011), a collection of up to 20 image search results per concept and language, for 500 common concepts across 6 languages: English, Spanish, German, French, Italian and Dutch. We train on $80 \%$ of the images, and choose the model with the best communication accuracy on the $20 \%$ validation set when reporting translation performance. As the Bergsma500 is an extremely small dataset, we do not have a separate test set to report the communication accuracy on. We only report the translation performance instead. Note that the translation task involves translating 500 words from the vocabulary, therefore the data split of images is not relevant for this task.
113
+
114
+ Baselines For our baselines, we use a variety of nearest neighbor methods based on similarity metrics in the ConvNet feature space (Kiela et al., 2015). Given a set of 20 ResNet image vectors per concept and language, we can either average them (CNN-Mean) or take the dimension-wise maximum (CNN-Max) to derive a single aggregated image vector. To find the German word for dog, for instance, we rank all German words based on cosine similarity between the image vector of dog and their image vectors. We then examine precision in retrieving the correct German word, Hund. Alternatively, we also consider the similarities between individual image vectors instead of their aggregation: Bergsma & Van Durme (2011) propose taking the average of the maximum similarity scores (CNN-AvgMax) and the maximum of the maximum similarity scores (CNN-MaxMax).
115
+
116
+ Experimental settings We train with 1 distractor $( K = 2 ) ^ { 2 }$ , learning rate 3e−4, and minibatch size 128. The embedding and hidden state dimensionalities are set to 400. When the validation accuracies of both the speaker and the listener stop improving, training terminates and we evaluate the performance on the word-level translation task, as described in $\ S 3 . 3$ . We consider all 15 language pairs in both directions, reporting results averaged across 30 translation cases.
117
+
118
+ Results In all 15 language pairs, we observe that translation performance improves with communication performance (Figure 3). In translation, our model outperforms all the nearest neighbor baselines (Table 2). This shows that our agents can learn foreign word representations that are not only effective in solving referential tasks, but also more meaningful than raw image features in translation. It also demonstrates that communication helps to identify and learn correspondences between concepts in different languages.
119
+
120
+ Figure 2: Word-level translation results, in precision at $k$ . Results are averaged over 30 translation cases (15 two-way pairs).
121
+
122
+ <table><tr><td>Model</td><td>P@1</td><td>P@5</td><td>P@20</td></tr><tr><td>CNN-AvgMax</td><td>53.00</td><td>68.30</td><td>78.36</td></tr><tr><td>CNN-MaxMax</td><td>49.85</td><td>65.91</td><td>77.17</td></tr><tr><td>CNN-Mean</td><td>51.89</td><td>66.47</td><td>77.14</td></tr><tr><td>CNN-Max</td><td>33.81</td><td>50.62</td><td>65.81</td></tr><tr><td>Our model</td><td>56.39</td><td>70.43</td><td>79.19</td></tr></table>
123
+
124
+ ![](images/e0d9502a310d495b8e4422e5e7079fbb48c6ab74fd5417d3d56bce5792b18f33.jpg)
125
+ Figure 3: Learning curve for the EN-DE word-level model.
126
+
127
+ Qualitative analysis As our agents learn foreign words by grounding them in visual space, we expect the learned foreign word embeddings to be semantically similar to corresponding images. We inspect the nearest neighbors of foreign word embeddings in each language, and find that concepts with similar images indeed have close word embeddings. See Appendix B for a discussion and relevant examples.
128
+
129
+ # 5 SENTENCE-LEVEL EXPERIMENTS
130
+
131
+ Task We next train our models on a sentence-level communication task where agent $P _ { A }$ is given an image, and needs to communicate its content in a sentence in its language $L _ { A }$ to allow agent $P _ { B }$ to identify the right image from a set of distractors (see §3.1).
132
+
133
+ Datasets and preprocessing We use three datasets of images with annotations in multiple languages. The Multi30k (Elliott et al., 2016) dataset contains $3 0 \mathrm { k }$ images and two types of bilingual annotations for two different tasks:
134
+
135
+ • (Task 1) English-German translation task, where this can be aided by images; and • (Task 2) German image captioning task, where this can be helped with English captions.
136
+
137
+ Training data for Task 1 consists of 1 English caption and its German translation for every image, translated by a professional translator. For Task 2, five English and five German captions are collected independently for every image. We use the original data split: $2 9 \mathrm { k }$ training, 1k validation and 1k test images.
138
+
139
+ We experiment with another language pair: English-Japanese. We use MS COCO (Lin et al., 2014; Chen et al., 2015), which contains $1 2 0 \mathrm { k }$ images and 5 English captions per image, and STAIR (Yoshikawa et al., 2017), a collection of Japanese annotations of the same dataset (also 5 per image). Following Karpathy & Li (2015), we use $1 1 0 \mathrm { k }$ training, 5k validation and $5 \mathrm { k }$ test images.
140
+
141
+ To ensure no parallel corpus is used to train our models, we partition the images in the training set into two parts (one for each langauge) and only use captions in one language for each half and not the other. With Multi30k, for instance, we have $1 4 . 5 \mathrm { k }$ English training images (whose German captions we discard) and 14.5k German training images.
142
+
143
+ We use tokenized Japanese captions in STAIR.3 We lowercase, normalize and tokenize English and German captions using preprocessing scripts from Moses.4 In addition, we tokenize German captions into subword symbols using the byte pair encoding (BPE) algorithm with 10k merge operations (Sennrich et al., 2015).
144
+
145
+ Baselines We compare against several baselines that similarly only make use of disjoint imagedescription data. In increasing order of sophistication:
146
+
147
+ Nearest neighbor To translate an English sentence into German, we use its corresponding image to find the closest image in our German training set. We then retrieve all corresponding German captions and compute BLEU score against the ground truth German test captions. This model is similar to our word-level nearest neighbor baselines.
148
+
149
+ NMT with neighboring pairs Given our non-aligned training set of English and German image captions, without any overlapping images, we can form new EN-DE sentence pairs by finding the closest German training image for every English training image. We then pair every corresponding German caption with every corresponding English caption, and train a standard NMT model without attention (Cho et al., 2014; Sutskever et al., 2014) on these pairs. We do not compare against an NMT model with attention because our models do not use attention (since incorporating attention would mean that agents have access to each other’s hidden states, which is no longer a multi-agent setting).
150
+
151
+ N&N We implement and train end-to-end models from (Nakayama & Nishida, 2017). Their twoway model learns separate encoders to align the source language and images in a multimodal space. Then, a captioning model in the target language is trained on image representations, and is used to decode source representations to translate them. Their three-way models align both source and target languages with images using a target language encoder. Their models are similar to our models, with two key differences: (1) they are trained on a fixed corpus, without interaction between agents or learned communication, and (2) their model unit-normalizes the output of every encoder and is trained on pairwise ranking loss. In order to specifically examine the effectiveness of communication in learning to translate, we train these baselines using both their original loss function and our own loss function (see Appendix A).
152
+
153
+ Models In our base model, the agents learn to speak their native languages simultaneously as they learn to communicate with each other (not pretrained). In a sense, this can be seen as a tabula rasa situation where both agents start from a blank slate. However, we also experiment with agents who already speak their languages, by using the weights from pretrained image captioning models in both languages to initialize our speaker modules and image encoders. Furthermore, we can freeze the parameters of image encoders or speaker modules to investigate their impact on communication and translation performance. In the most extreme case, where we pretrain and fix the speaker modules and image encoders (pretrained, spk $\pmb { \& }$ enc fixed), we only train the foreign language encoder, using only the listener loss. All other models are trained on both the speaker and listener loss.
154
+
155
+ Experimental settings We train with 1 distractor $( K = 2 ) ^ { 5 }$ and minibatch size 64. The hidden state size and embedding dimensionalities are 1024 and 512, respectively. The learning rate and dropout rate are tuned on the validation set for each task. The vocabulary sizes of each language used in our experiments are: EN (4k) and DE (5K) for Multi30k Task 1, EN (8k) and DE (13k) for Multi30k Task2 and EN (10k) and JP (13k) for MS COCO.
156
+
157
+ We train the model on the communication task, and early stop when the validation translation BLEU score stops improving. We use beam search at inference time, with beam width tuned on the validation set.
158
+
159
+ Table 1: Test BLEU scores for each model and dataset. The best performing (unaligned) model for each dataset is shown in bold. We show the results of baselines from (Nakayama & Nishida, 2017) using two different loss functions (Appendix A). Pretrained denotes initializing the speaker modules and image encoders with pretrained image captioning models. Fixed denotes fixing the parameters of either the speaker module or the image encoder.
160
+
161
+ <table><tr><td></td><td></td><td colspan="2">Multi30k Task 1 EN-DE DE-EN</td><td colspan="2">Multi30k Task 2 EN-DE DE-EN</td><td colspan="2">COCO &amp; STAIR EN-JA JA-EN</td></tr><tr><td>NMT with neighboring pairs</td><td>Nearest neighbor</td><td>1.41</td><td>1.77</td><td>3.75</td><td>5.87</td><td>15.88</td><td>10.94</td></tr><tr><td></td><td></td><td>3.07</td><td>3.41</td><td>6.83</td><td>14.78</td><td>32.17</td><td>22.39</td></tr><tr><td></td><td>N&amp;N, 2-way, img</td><td>2.57</td><td>2.69</td><td>5.22</td><td>12.78</td><td>28.68</td><td>20.61</td></tr><tr><td></td><td>N&amp;N, 3-way, img</td><td>2.01</td><td>3.51</td><td>6.19</td><td>14.60</td><td>29.81</td><td>21.25</td></tr><tr><td>Triiss</td><td>N&amp;N,3-way, desc</td><td>3.34</td><td>3.87</td><td>9.66</td><td>15.96</td><td>27.53</td><td>17.51</td></tr><tr><td></td><td>N&amp;N, 3-way, both</td><td>1.50</td><td>3.62</td><td>9.89</td><td>15.50</td><td>31.01</td><td>20.59</td></tr><tr><td></td><td>N&amp;N,2-way, img</td><td>4.20</td><td>6.04</td><td>11.95</td><td>17.22</td><td>33.10</td><td>23.43</td></tr><tr><td>ssor Jno</td><td>N&amp;N, 3-way, img</td><td>2.32</td><td>5.91</td><td>11.62</td><td>17.84</td><td>32.11</td><td>23.61</td></tr><tr><td></td><td>N&amp;N, 3-way, desc</td><td>5.13</td><td>6.02</td><td>11.07</td><td>17.01</td><td>26.65</td><td>17.82</td></tr><tr><td></td><td>N&amp;N,3-way, both</td><td>4.89</td><td>6.59</td><td>13.53</td><td>18.48</td><td>32.84</td><td>23.28</td></tr><tr><td>not pretrained</td><td></td><td>5.80</td><td>7.20</td><td>14.81</td><td>17.70</td><td>33.26</td><td>23.66</td></tr><tr><td></td><td> pretrained, spk &amp; enc fixed</td><td>5.81</td><td>7.36</td><td>13.87</td><td>18.68</td><td>35.25</td><td>24.61</td></tr><tr><td></td><td>pretrained, spk fixed</td><td>6.49</td><td>7.42</td><td>14.93</td><td>19.81</td><td>33.01</td><td>23.59</td></tr><tr><td>sopou gni</td><td>pretrained, not fixed</td><td>5.02</td><td>6.06</td><td>13.44</td><td>17.41</td><td>33.58</td><td>23.19</td></tr><tr><td colspan="2">Aligned NMT</td><td>17.21</td><td>16.65</td><td>19.99</td><td>21.44</td><td>38.55</td><td>28.36</td></tr></table>
162
+
163
+ Results We find that na¨ıvely looking up the nearest training image and retrieving its captions gives relatively poor BLEU scores (Table 1, Nearest neighbor). On the other hand, training an NMT model on these visually closest neighbor pairs gives much better translation performance.
164
+
165
+ From the results of baselines from (Nakayama & Nishida, 2017), it is clear that our loss function gives better performance than the pairwise ranking loss with unit-normalized encoder outputs. We note that these baselines perform worse than our models even when our loss function is used, an indication that communication helps in learning to translate. We conjecture that our listeners become better at aligning multimodal representations compared to these baselines, as our listeners are trained on speaker’s output, and hence are exposed to a bigger and more diverse set of image descriptions. In contrast, the N&N models only make use of the ground truth captions. We also note that their 3-way models have an additional encoder for the target language, which our models lack. Although this is not used at test time, their 3-way models have $33 \%$ more parameters to train $( 9 7 \mathrm { m } )$ than our models $( 7 3 \mathrm { m } )$ .
166
+
167
+ In contrast to (Nakayama & Nishida, 2017), where the best performance was obtained with endto-end trained models, we find that our models benefit from initializing weights with pretrained captioning models. The model with fixed speaker modules and non-fixed image encoders gave best results in two out of three datasets, even outperforming the (spk & enc fixed) model, which only produces messages that are trained to predict ground truth captions. This shows that learning to send messages differently from the pretrained image captioning models achieves better translation performance than learning to send ground truth captions. We provide sample translations for our baselines and models in Appendix C. We also qualitatively examine completely zero-resource German-Japanese translation in Appendix F.
168
+
169
+ We compare our results with a standard non-attentional NMT model trained on parallel data (Cho et al., 2014; Sutskever et al., 2014). On COCO & STAIR, we observe a gap of approximately 4 BLEU compared to our best models On Multi30k Task 2, which is slightly smaller, the gap grows up to 5 BLEU scores. On Multi30k Task 1, where the dataset is the smallest and also of the highest quality (annotated by professional translators), the gap is around 11 BLEU. In other words, we find that our approach performs closer to supervised NMT as more training data is available, but that there still is a gap, which is unsurprising given the lack of parallel data.
170
+
171
+ Qualitative analysis We conjecture that our models learn to translate by having a shared visual space to ground source and target languages onto. Indeed, we show that our translation system fails without a common visual modality (see Appendix D). We note that using a larger number of distractors helps the model learn faster initially, but does not affect translation performance (see also Appendix D).
172
+
173
+ As expected, our models struggle with translating abstract sentences, although we observe that they can capture some visual elements in the source sentence (see Appendix E). This observation applies to most current grounded NMT systems, and it is an avenue worth exploring in future work but beyond the scope of the current work.
174
+
175
+ Inspired by the movie Arrival (2016), we show that our agents can learn to play the referential game, and learn to translate, using an alien language (Klingon) with only a small number of captions (see Appendix G). This example is meant to illustrate the point that our models can learn to translate even in situations where there is no knowledge whatsoever of the other language, and where training a professional translator would potentially take a long time.
176
+
177
+ # 6 MULTILINGUAL COMMUNITY OF AGENTS
178
+
179
+ Task and dataset Humans learn to speak languages within communities. We next investigate whether we can learn to translate better in a community of different language speakers, where every agent interacts with every other agent. We use the recently released multilingual Multi30k Task 1, which contains annotations in English, German and French for $3 0 \mathrm { k }$ images (Elliott et al., 2017). We train a community of three agents (each speaking one language) and let each agent learn the other two languages simultaneously.
180
+
181
+ We again partition the set of images into two halves (M1 and M2 in Figure 4), and ensure that the speaker and the listener do not see the same set of images (see Figure 4a for example). We experiment with two different settings: 1) a full community model, where having a multilingual community allows us to expose agents to more data than in the single-pair model while maintaining disjoint sets of images between agents (Figure 4c); and 2) a fair community model where the agents are trained on exactly the same number of training examples (Figure 4b). We point out that the difference in training data should mainly affect the speaker module; the image encoder and foreign language encoder are trained on the same number of examples in all the models.
182
+
183
+ ![](images/e8067262d6d5c5d926de61450f3d79e027eca8e2ee21704e04ba4a4859c62dd4.jpg)
184
+ Figure 4: Training data in single-pair and community models. M1 EN denotes the English annotations for the first half images in Multi30k. Red and blue indicate training data for the English and the German agents’ speaker modules, respectively. Note that compared to the single pair model, English and German speakers see twice the amount of training data in the full model, but see the same number of examples in the fair model.
185
+
186
+ Experimental settings We train our base model (not pretrained) on a three-way sentence-level communication task. We sample a language pair with an equal probability every minibatch and let the two agents communicate. Every agent has one image encoder, one native speaker module and two foreign language encoders. We tokenize every corpus using BPE with 10k merge operations. We use the same architecture for the three models: $D _ { \mathrm { e m b } } = 1 2 8 , D _ { \mathrm { h i d } } = 2 5 6$ and we use a learning rate of 3e-4 and batch size of 128.
187
+
188
+ ![](images/42ac9b9e0a4d0838974aa89bfe3f2f5ae9cd65898675b4141291040beafeed4f.jpg)
189
+ Figure 5: DE-EN learning curve for different models.
190
+
191
+ <table><tr><td>Model</td><td>EN-DE</td><td>DE-EN</td><td>EN-FR</td><td>FR-EN</td><td>DE-FR</td><td>FR-DE</td></tr><tr><td>Single</td><td>3.85</td><td>5.36</td><td>5.20</td><td>5.87</td><td>4.31</td><td>3.92</td></tr><tr><td>Fair</td><td>3.73</td><td>5.56</td><td>4.81</td><td>5.96</td><td>5.08</td><td>4.00</td></tr><tr><td>Full</td><td>4.83</td><td>7.21</td><td>7.09</td><td>8.10</td><td>6.55</td><td>5.15</td></tr></table>
192
+
193
+ Table 2: Multi30k Task 1 Test BLEU scores. Results should be compared with the first two columns in Table 1.
194
+
195
+ Results We observe that multilingual communities learn better translations. By having access to more target-side data, the full community model achieves the best translation performance in every language pair (Table 2). The fair community model achieves comparable performance to the single pair model.
196
+
197
+ We show the learning curves of different models in Figure 5. The full community model clearly learns much faster than the other two. The fair community also learns faster than the single-pair model, as it learns with equivalent speed but with less exposure to individual language pairs, since we sample a language pair for each batch, rather than always having the same one.
198
+
199
+ # 7 CONCLUSIONS AND FUTURE WORK
200
+
201
+ In this paper, we have shown that the ability to understand a foreign language, and to translate it in the agent’s native language, can emerge from a communication task. We argue that this setting is natural, since humans learn language in a similar way: by trying to understand other humans while being grounded in a shared environment.
202
+
203
+ We empirically confirm that the capability to translate is facilitated by the fact that agents have a shared visual modality they can refer to in their respective languages. Our experiments show that our model outperforms recently proposed baselines where agents do not communicate, as well as several nearest neighbor based baselines, in both sentence- and word-level scenarios.
204
+
205
+ In future work, we plan to examine how we can enrich our agents with the ability to understand and translate abstract language, possibly through multi-task learning.
206
+
207
+ # ACKNOWLEDGEMENT
208
+
209
+ KC thanks support by eBay, TenCent, Facebook, Google and NVIDIA. We thank our colleagues from FAIR for helpful discussions.
210
+
211
+ # REFERENCES
212
+
213
+ Jacob Andreas, Anca D. Dragan, and Dan Klein. Translating neuralese. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pp. 232–242, 2017.
214
+
215
+ Galen Andrew, Raman Arora, Jeff A. Bilmes, and Karen Livescu. Deep canonical correlation analysis. In Proceedings of the 30th International Conference on Machine Learning, ICML 2013, Atlanta, GA, USA, 16-21 June 2013, pp. 1247–1255, 2013.
216
+
217
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In Proceedings of the International Conference on Learning Representations, 2015.
218
+
219
+ Shane Bergsma and Benjamin Van Durme. Learning bilingual lexicons using the visual similarity of labeled web images. In Proceedings of the Twenty-Second International Joint Conference on Artificial Intelligence, pp. 1764–1769, 2011.
220
+
221
+ Ozan Caglayan, Lo¨ıc Barrault, and Fethi Bougares. Multimodal attention for neural machine translation. arXiv preprint arXiv:1609.03976, 2016.
222
+
223
+ Iacer Calixto, Qun Liu, and Nick Campbell. Doubly-attentive decoder for multi-modal neural machine translation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pp. 1913–1924, 2017a.
224
+
225
+ Iacer Calixto, Qun Liu, and Nick Campbell. Multilingual multi-modal embeddings for natural language processing. arXiv preprint arXiv:1702.01101, 2017b.
226
+
227
+ Sarath Chandar, Mitesh M. Khapra, Hugo Larochelle, and Balaraman Ravindran. Correlational neural networks. Neural Computation, 28(2):257–285, 2016.
228
+
229
+ Xinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dollar, and ´ C. Lawrence Zitnick. Microsoft COCO captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325, 2015.
230
+
231
+ Kyunghyun Cho, Bart van Merrienboer, Dzmitry Bahdanau, and Yoshua Bengio. On the properties ¨ of neural machine translation: Encoder-decoder approaches. In Proceedings of the 8th Workshop on Syntax, Semantics, and Structure in Statistical Translation, pp. 103–111, 2014.
232
+
233
+ Grzegorz Chrupala, Akos K ´ ad´ ar, and Afra Alishahi. Learning language through pictures. In ´ Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics, pp. 112– 118, 2015.
234
+
235
+ Abhishek Das, Satwik Kottur, Jose M. F. Moura, Stefan Lee, and Dhruv Batra. Learning cooperative ´ visual dialog agents with deep reinforcement learning. arXiv preprint arXiv:1703.06585, 2017.
236
+
237
+ Desmond Elliott and Akos K ´ ad´ ar. Imagination improves multimodal translation. ´ arXiv preprint arXiv:1705.04350, 2017.
238
+
239
+ Desmond Elliott, Stella Frank, Khalil Sima’an, and Lucia Specia. Multi30k: Multilingual englishgerman image descriptions. In Proceedings of the 5th Workshop on Vision and Language, pp. 70–74, 2016.
240
+
241
+ Desmond Elliott, Stella Frank, Lo¨ıc Barrault, Fethi Bougares, and Lucia Specia. Findings of the second shared task on multimodal machine translation and multilingual image description. In Proceedings of the Second Conference on Machine Translation, pp. 215–233, 2017.
242
+
243
+ Katrina Evtimova, Andrew Drozdov, Douwe Kiela, and Kyunghyun Cho. Emergent language in a multi-modal, multi-step referential game. arXiv preprint arXiv:1705.10369, 2017.
244
+
245
+ Orhan Firat, Baskaran Sankaran, Yaser Al-Onaizan, Fatos T. Yarman-Vural, and Kyunghyun Cho. Zero-resource translation with multi-lingual neural machine translation. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, EMNLP 2016, Austin, Texas, USA, November 1-4, 2016, pp. 268–277, 2016.
246
+
247
+ Jakob N. Foerster, Yannis M. Assael, Nando de Freitas, and Shimon Whiteson. Learning to communicate with deep multi-agent reinforcement learning. In Advances in Neural Information Processing Systems, pp. 2137–2145, 2016.
248
+
249
+ Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N. Dauphin. Convolutional sequence to sequence learning. In Proceedings of the 34th International Conference on Machine Learning, pp. 1243–1252, 2017.
250
+
251
+ Spandana Gella, Rico Sennrich, Frank Keller, and Mirella Lapata. Image Pivoting for Learning Multilingual Multimodal Representations. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 2829–2835, 2017.
252
+
253
+ Serhii Havrylov and Ivan Titov. Emergence of language with multi-agent games: Learning to communicate with sequences of symbols. In Proceedings of the International Conference on Learning Representations Workshop Track, 2017.
254
+
255
+ Di He, Yingce Xia, Tao Qin, Liwei Wang, Nenghai Yu, Tieyan Liu, and Wei-Ying Ma. Dual learning for machine translation. In Advances in Neural Information Processing Systems, pp. 820–828, 2016a.
256
+
257
+ 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, 2016b.
258
+
259
+ Julian Hitschler, Shigehiko Schamoni, and Stefan Riezler. Multimodal pivots for image caption translation. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, 2016.
260
+
261
+ Micah Hodosh, Peter Young, and Julia Hockenmaier. Framing image description as a ranking task: Data, models and evaluation metrics. J. Artif. Intell. Res., 47:853–899, 2013.
262
+
263
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical Reparameterization with Gumbel-Softmax. In Proceedings of the International Conference on Learning Representations, 2017.
264
+
265
+ Emilio Jorge, Mikael Kageb ˚ ack, and Emil Gustavsson. Learning to play guess who? and inventing ¨ a grounded language as a consequence. arXiv preprint arXiv:1611.03218, 2016.
266
+
267
+ Armand Joulin, Laurens van der Maaten, Allan Jabri, and Nicolas Vasilache. Learning visual features from large weakly supervised data. In Computer Vision - ECCV 2016 - 14th European Conference, pp. 67–84, 2016.
268
+
269
+ Andrej Karpathy and Fei-Fei Li. Deep visual-semantic alignments for generating image descriptions. In IEEE Conference on Computer Vision and Pattern Recognition, pp. 3128–3137, 2015.
270
+
271
+ Douwe Kiela, Ivan Vulic, and Stephen Clark. Visual bilingual lexicon induction with transferred ´ convnet features. In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pp. 148–158, 2015.
272
+
273
+ Douwe Kiela, Alexis Conneau, Allan Jabri, and Maximilian Nickel. Learning visually grounded sentence representations. arXiv:1707.06320, 2017.
274
+
275
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of the 3rd International Conference for Learning Representations, 2014.
276
+
277
+ Ryan Kiros, Ruslan Salakhutdinov, and Richard S. Zemel. Unifying visual-semantic embeddings with multimodal neural language models. arXiv:1411.2539, 2014.
278
+
279
+ Satwik Kottur, Jose M. F. Moura, Stefan Lee, and Dhruv Batra. Natural language does not emerge ´ ’naturally’ in multi-agent dialog. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 2952–2957, 2017.
280
+
281
+ Angeliki Lazaridou, Alexander Peysakhovich, and Marco Baroni. Multi-agent cooperation and the emergence of (natural) language. In Proceedings of the International Conference on Learning Representations, 2017.
282
+
283
+ Mike Lewis, Denis Yarats, Yann N. Dauphin, Devi Parikh, and Dhruv Batra. Deal or no deal? endto-end learning for negotiation dialogues. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pp. 2433–2443, 2017.
284
+
285
+ 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 ´ Computer Vision - ECCV 2014 - 13th European Conference, pp. 740–755, 2014.
286
+
287
+ Ryan Lowe, Yi Wu, Aviv Tamar, Jean Harb, Pieter Abbeel, and Igor Mordatch. Multi-agent actorcritic for mixed cooperative-competitive environments. arXiv preprint arXiv:1706.02275, 2017.
288
+
289
+ Lin Ma, Zhengdong Lu, Lifeng Shang, and Hang Li. Multimodal convolutional neural networks for matching image and sentence. In 2015 IEEE International Conference on Computer Vision, ICCV 2015, Santiago, Chile, December 7-13, 2015, pp. 2623–2631, 2015.
290
+
291
+ Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The concrete distribution: A continuous relaxation of discrete random variables. In Proceedings of the International Conference on Learning Representations, 2017.
292
+
293
+ Igor Mordatch and Pieter Abbeel. Emergence of grounded compositional language in multi-agent populations. arXiv preprint arXiv:1705.10369, 2017.
294
+
295
+ Hideki Nakayama and Noriki Nishida. Zero-resource machine translation by multimodal encoder– decoder network with multimedia pivot. Machine Translation, 31(1):49–64, 2017.
296
+
297
+ Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. In Proceedings of the 30th International Conference on Machine Learning, pp. 1310– 1318, 2013.
298
+
299
+ Janarthanan Rajendran, Mitesh M. Khapra, Sarath Chandar, and Balaraman Ravindran. Bridge correlational neural networks for multilingual multimodal representation learning. In NAACL HLT 2016, The 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, San Diego California, USA, June 12-17, 2016, pp. 171–181, 2016.
300
+
301
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics, pp. 1715–1725, 2015.
302
+
303
+ Rico Sennrich, Alexandra Birch, Anna Currey, Ulrich Germann, Barry Haddow, Kenneth Heafield, Antonio Valerio Miceli Barone, and Philip Williams. The university of edinburgh’s neural MT systems for WMT17. In Proceedings of the Second Conference on Machine Translation, pp. 389–399, 2017.
304
+
305
+ Richard Socher, Andrej Karpathy, Quoc V. Le, Christopher D. Manning, and Andrew Y. Ng. Grounded compositional semantics for finding and describing images with sentences. TACL, 2:207–218, 2014.
306
+
307
+ Sainbayar Sukhbaatar, Arthur Szlam, and Rob Fergus. Learning multiagent communication with backpropagation. In Advances in Neural Information Processing Systems, pp. 2244–2252, 2016.
308
+
309
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In Advances in Neural Information Processing Systems, volume 27, pp. 3104–3112, 2014.
310
+
311
+ Ivan Vendrov, Ryan Kiros, Sanja Fidler, and Raquel Urtasun. Order-embeddings of images and language. arXiv:1511.06361, 2015.
312
+
313
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256, 1992.
314
+
315
+ Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V. Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Łukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason Smith, Jason Riesa, Alex Rudnick, Oriol Vinyals, Greg Corrado, Macduff Hughes, and Jeffrey Dean. Google’s neural machine translation system: Bridging the gap between human and machine translation. arXiv:1609.08144, 2016.
316
+
317
+ Yuya Yoshikawa, Yutaro Shigeto, and Akikazu Takeuchi. STAIR captions: Constructing a largescale japanese image caption dataset. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pp. 417–421, 2017.
318
+
319
+ # A CHOICE OF LISTENER LOSS FUNCTION
320
+
321
+ We compare two alternatives for training the listener: (1) a pairwise ranking loss, as used in Havrylov & Titov (2017) and Nakayama & Nishida (2017), and (2) the MSE loss, in addition to the one (Eq. (1)) used in this paper.
322
+
323
+ Pairwise ranking loss Denoting the message vector, the target image and the $k$ -th distractor image as $\hat { m } , i$ and $i _ { k }$ , respectively, this cost function is expressed as:
324
+
325
+ $$
326
+ \mathcal { I } _ { ( \mathrm { l s n } , \mathrm { r a n k } ) } = \sum _ { k = 1 } ^ { K } \operatorname* { m a x } \Big ( 0 , \alpha - \sin \big ( E _ { \mathrm { E N } } ^ { B } ( \hat { m } ) , E _ { \mathrm { I M G } } ^ { B } ( i ) \big ) + \sin \big ( E _ { \mathrm { E N } } ^ { B } ( \hat { m } ) , E _ { \mathrm { I M G } } ^ { B } ( i _ { k } ) \big ) \Big ) ,
327
+ $$
328
+
329
+ where $\alpha$ is a margin hyperparameter and $\mathrm { s i m } ( \cdot )$ is a function that computes the similarity between two vectors. The most common choice for $\mathrm { s i m } ( \cdot )$ in practice is cosine similarity (Nakayama & Nishida, 2017). Note, however, that this only aligns the direction of the message and the target image vectors, not the magnitude. To facilitate translation, the speaker module should take as input a normalized image vector. We found this use of normalized image vectors to consistently hurt performance in all our experiments.
330
+
331
+ MSE loss It has been found that minimizing the MSE loss can be effective in learning visually grounded representations of language (see, e.g., Chrupala et al., 2015). While our loss function is very similar to minimizing the MSE loss, there is an important distinction. Letting $x = E _ { \mathrm { E N } } ^ { B } ( \hat { m } ) \stackrel { \cdot } { - } E _ { \mathrm { I M G } } ^ { B } ( i )$ , the MSE loss function is given by $x ^ { 2 }$ , with a derivative of $2 x$ . Our loss function is $- \log ( 1 / x ^ { 2 } )$ , of which the derivative is $\bar { 2 } / x$ . Note that the gradient is initially small, when $x$ is large, but grows larger in magnitude as the listener loss is minimized.
332
+
333
+ ![](images/681ac53f3cb3e67802920f7035cd3f95b359a6e27f134b18d3a7891c3b9ffa3d.jpg)
334
+ Figure 6: Comparison of our listener loss function with MSE loss.
335
+
336
+ In Figure 6, we show the learning curve of our model on Multi30k Task 2 EN-DE trained using either our listener loss function or the MSE loss. At the initial stage of learning, the listener trained using our loss function learns very slowly due to a small gradient. As the listener becomes better at aligning target images and sentences, it begins to learn much more quickly. On the other hand, we observe that the listener trained using the MSE loss immediately starts to learn, but learning slows down quickly.
337
+
338
+ Our loss term $- \log ( 1 / x ^ { 2 } )$ is not defined at 0. In practice, $x$ is almost never 0, and we further add small noise to $x$ both to avoid $x = 0$ and to regularize learning. Empirically, we observe our formulation gives much better translation performance than both the pairwise ranking loss and the MSE loss.
339
+
340
+ # B WORD-LEVEL NEAREST NEIGHBOR ANALYSIS
341
+
342
+ Table 3 showcases three concepts in English and German, where for each concept, the most representative image is shown, as well as the five nearest neighboring words (by cosine similarity).
343
+
344
+ We note that nearest neighbors for most words correspond to our semantic judgments: galaxy is closest to universe in English and Galaxie to Universum in German. Similarly, plant or Pflanze is closest to leaf or Blatt. For concepts that evoke different senses across languages, however, we observe different nearest neighbors. For example, most images for Fox in the dataset contain a person, whereas images for Fuchs contain an animal. This encourages the German agent to associate Fox closely with Celebrity and Girl, whereas the English agent learns that Fuchs is a furry animal, similar to Kanguru ¨ or Lowe ¨ .
345
+
346
+ ![](images/71b253b646af357fdfe40e3d015b506be039eba8243bdf68a5631a8f5285cf45.jpg)
347
+
348
+ # C SENTENCE-LEVEL SAMPLE TRANSLATIONS
349
+
350
+ ![](images/1190db0935d3a19d3919f21c2b0b94ab613b1994684920eaa56b9ef049c0196c.jpg)
351
+
352
+ ![](images/5b8dbdfac70a9609f20a5433f4d79caf326f67f077c280000101fced18647f12.jpg)
353
+
354
+ ![](images/65d023ebe07a8a0fae680e5059a4cdb485f94a706a6ce08bcf42efc4ae0710e7.jpg)
355
+
356
+ Table 3: Nearest neighbors of foreign word embeddings learned from communication, along with a sample image for each concept in the dataset. The English word embeddings were learned by the German agent and vice versa.
357
+ Table 4: Sample DE-EN translations from Multi30k Task 2 test set. Images were not used to aid translation and are only shown for references. We show the source sentence as $S r c$ and one of the five target sentences as Ref. The outputs from the nearest neighbor baseline are shown as NN, NMT baseline with neighbor pairs as NMT, the 3-way, both decoder model from (Nakayama & Nishida, 2017) as N&N, and our (pretrained, spk fixed) model as Model.
358
+
359
+ <table><tr><td>Src</td><td>einhund springt auf einer wiese vor einem weiBen zaun in die luft</td><td>ein mann hängt an einem seil mit rollen das iber ein wasser gespannt ist .</td><td>ein skateboarder an einer boschung zu einem parkplatz.</td></tr><tr><td>Ref</td><td>a dogruns on the green grass near a wooden fence.</td><td>aman wearing bathing trunks is para- sailing in the water .</td><td>a skateboard is grinding on a curb with his skateboard</td></tr><tr><td>NN</td><td>a brunettephotographer is kneeling down to take a photo .</td><td>police watch some punk rock types at a protest.</td><td>a man is standing on the streets taking photographs.</td></tr><tr><td>NMT</td><td>a dog is jumping overa fence</td><td>a man ina blue shirt is ridinga bike.</td><td>aman in a blue shirt is ridinga bike</td></tr><tr><td>N&amp;N</td><td>a brown dog is running on the grass.</td><td>a man ina wetsuit is surfinga large wave.</td><td>aman ina blue shirt iswalking down the sidewalk .</td></tr><tr><td>Model</td><td>two dogs playing with a ballin the grass</td><td>a man is parasailing in the ocean.</td><td>a man in a blue shirt and black pants is skateboarding.</td></tr></table>
360
+
361
+ In Table 4, we compare sample translations from our nearest neighbor and NMT baselines, as well as the best model from (Nakayama & Nishida, 2017) and our best model. We observe that the nearest neighbor baseline generates translations that are mostly unrelated to the reference sentence. The NMT baseline, on the other hand, often generates the correct subject of the sentence, and seems capable of capturing the main actor in the scene. The 3-way, both decoder model from (Nakayama & Nishida, 2017) captures the main actors and the environment in the scene. Our model appears to capture even the minor details, such as quantity (number of dogs) and specific activity (parasailing, skateboarding).
362
+
363
+ D SENTENCE-LEVEL QUALITATIVE ANALYSIS
364
+
365
+ ![](images/03174d2e367e3ab1c1917d81e07eb837ce5cc419e08b2949f4f8fb86b74ec01c.jpg)
366
+ Figure 7: Sharing $E ^ { I }$
367
+
368
+ ![](images/89db8c45d18bf943a570b3a7d2c5c54717921914885c3ce24390b6f5ff42c89b.jpg)
369
+ Figure 8: Number of distractors.
370
+
371
+ We conjectured that grounding the native and foreign languages into a shared visual space allows agents to understand foreign languages. To verify this, we trained our base model (not pretrained) on COCO & STAIR, where agents have language-specific image encoders, e.g. the English agent has two separate image encoders: one for the English speaking module and another for the Japanese encoder. We compare this with our original model with the same architecture. We plot the communication accuracy and JA-EN validation BLEU scores in Figure 7. Red curves indicate validation communication accuracy (left axis), and green curves indicate BLEU score (right axis). Solid lines denote the standard model and dotted lines denote the model without sharing the image encoder.
372
+
373
+ We observe no significant difference in the communication performance: the model that does not share the image encoder performs just as well in the communication task. However, translation performance greatly suffers without access to the shared visual modality.
374
+
375
+ In Figure 8, we show the learning curve of four base models, with different number of distractors $( K )$ . We observe that a larger number of distractors helps the model learn faster initially, but otherwise gives no performance benefit.
376
+
377
+ # E TRANSLATION IN NON-CONCRETE DOMAINS
378
+
379
+ As our agents understand foreign languages through grounding in the visual modality, we investigate their ability to generalize to non-visual, abstract domains. We train our (pretrained, spk fixed) model on Multi30k Task 2, and let it translate German sentences from WMT’15 DE-EN validation and test set. See Table 5.
380
+
381
+ We note that our model is able to capture some visual elements in a sentence, such as snow or mountain, but generally produces poor quality translations. We observe that most words in the source sentence from WMT’15 do not occur in Multi30k’s training set, hence our model mostly receives ${ < } U N K { > }$ vectors.
382
+
383
+ # F ZERO-RESOURCE TRANSLATION
384
+
385
+ To showcase our models’ ability to learn to translate without parallel corpora, we train our base model on a communication task between a low-resource language pair: German and Japanese. We take the German corpus from Multi30k Task2, the Japanese corpus from STAIR, and train two models on a sentence-level communication task between the two languages. In Tables 6 and 7, we show the Japanese source sentence (src), the model output in German (hyp), and their translation to English using Google Translate. We observe that our model mostly generates reasonable sentences, and captures properties such as color and action in the scene.
386
+
387
+ Table 5: Sample translations from WMT’15 DE-EN validation and test set.
388
+
389
+ <table><tr><td rowspan=1 colspan=1>Src</td><td rowspan=1 colspan=1>Schnee liegt insbesondere auf den StraBen im Riesengebirge und im Gebirge Orlické hory.</td></tr><tr><td rowspan=1 colspan=1>Ref</td><td rowspan=1 colspan=1>Snow is particularly affecting the roads in the Krkonose and Orlicke mountains.</td></tr><tr><td rowspan=1 colspan=1>Hyp</td><td rowspan=1 colspan=1>a man is standing on a snow covered mountain.</td></tr><tr><td></td><td></td></tr><tr><td rowspan=1 colspan=1>Src</td><td rowspan=1 colspan=1>Das Tote Meer ist sogar noch wärmer und dort wird das ganze Jahr über gebadet.</td></tr><tr><td rowspan=1 colspan=1>Ref</td><td rowspan=1 colspan=1>The Dead Sea is even warmer,and people swim in it all year round.</td></tr><tr><td rowspan=1 colspan=1>Hyp</td><td rowspan=1 colspan=1>a man is surfing in the ocean.</td></tr><tr><td></td><td></td></tr><tr><td rowspan=1 colspan=1>Src</td><td rowspan=1 colspan=1>Esfolgten die erstenRadfahrerundLäuferum1O Uhr.</td></tr><tr><td rowspan=1 colspan=1>Ref</td><td rowspan=1 colspan=1>Then it was the turn of the cyclists and runners,who began at 1O am.</td></tr><tr><td rowspan=1 colspan=1>Hyp</td><td rowspan=1 colspan=1>a man ina red and white uniform is riding a dirtbike in front of a crowd.</td></tr><tr><td></td><td></td></tr><tr><td rowspan=1 colspan=1>Src</td><td rowspan=1 colspan=1>Das Baby,das so ergreifend von einem Spezialeinsatzkommando in Sicherheit getragen wurde</td></tr><tr><td rowspan=1 colspan=1>Ref</td><td rowspan=1 colspan=1>The baby who was carried poignantly to safety by a special forces commando</td></tr><tr><td rowspan=1 colspan=1>Hyp</td><td rowspan=1 colspan=1>a baby ina yellow shirt is sleeping.</td></tr></table>
390
+
391
+ ![](images/99e30d4727a80dd0582917bee7d5300486f8fc7c1d188cc5c81514885d3723c5.jpg)
392
+
393
+ Table 6: Sample JA-DE translations
394
+
395
+ <table><tr><td rowspan=1 colspan=1>Src</td><td rowspan=1 colspan=1>キよ構之る犬</td><td rowspan=1 colspan=1>赤と白の野球の二フオー着た少年ト構之い</td><td rowspan=1 colspan=1>黄色い機離瞬間</td></tr><tr><td rowspan=1 colspan=1>Hyp</td><td rowspan=1 colspan=1>ein hund fangt einen frisbee.</td><td rowspan=1 colspan=1>ein baseballspieler mit rotem helmund weibem trikot holt mit demschläger aus,um den heranfliegendenball zu treffen</td><td rowspan=1 colspan=1>ein flugzeug fliegt üiber eine flugzeug-piste.</td></tr><tr><td rowspan=1 colspan=1>Src (en)</td><td rowspan=1 colspan=1>Dogkeeps trying to catch Frisbee</td><td rowspan=1 colspan=1>A boy in a red and white baseball uni-form wears a bat</td><td rowspan=1 colspan=1>The moment when a yellow propellerplane takes off</td></tr><tr><td rowspan=1 colspan=1>Hyp (en)</td><td rowspan=1 colspan=1>a dog catchesa frisbee.</td><td rowspan=1 colspan=1>abaseball playerwitharedhelmetand a white tricot takes the bat out tohit the ball.</td><td rowspan=1 colspan=1>Anairplane flies over an airplane run-way.</td></tr></table>
396
+
397
+ ![](images/9b70299e70c4f91b4931e1cb4dfed6e0bf7ec8a3a4b4482fafcab38e40ca1768.jpg)
398
+
399
+ Table 7: Sample JA-DE translations
400
+
401
+ <table><tr><td rowspan=1 colspan=1>Src</td><td rowspan=1 colspan=1>黄色い打返女性</td><td rowspan=1 colspan=1>黄色いのト部分取付たパクに黄色い映い</td><td rowspan=1 colspan=1>木の枝に正目の周足赤い鳥</td></tr><tr><td rowspan=1 colspan=1>Hyp</td><td rowspan=1 colspan=1>eine tennisspielerin in weiBundgruinem oberteil spielt tennis</td><td rowspan=1 colspan=1>ein gelber bus steht geparkt vor einemnicht fertigen gebäude.</td><td rowspan=1 colspan=1>ein vogel sitzt auf einem ast .</td></tr><tr><td rowspan=1 colspan=1>Src (en)</td><td rowspan=1 colspan=1>A woman striking a yellow tennis ball</td><td rowspan=1 colspan=1>A yellow busis reflected on therearview mirror attached to the frontpart of the yellow bus.</td><td rowspan=1 colspan=1>Around the eyes stopping at thebranches of the tree and a red bird</td></tr><tr><td rowspan=1 colspan=1>Hyp (en)</td><td rowspan=1 colspan=1>atennis player in white and greenshell playing tennis</td><td rowspan=1 colspan=1>A yellow bus is parked in front of anon-finished building.</td><td rowspan=1 colspan=1>A bird sitting on a branch.</td></tr></table>
402
+
403
+ # G ALIEN LANGUAGE TRANSLATION
404
+
405
+ To demonstrate our models’ ability to learn to translate only with monolingual captions, we experiment with a language for which no parallel corpus exists, nor the knowledge of the language itself: Klingon. As no image captions are available in Klingon, we translate $1 5 \mathrm { k }$ English captions in Multi30k Task 1 into Klingon pIqaD6 using Bing Translator.7 We tokenize the Klingon captions and discard words occurring less than 5 times in the training data. We then train our base model (no pretraining) on English and Klingon communication. In Tables 9 and 10, the source sentence in English is shown as src, the Klingon model output in hyp, and the English translation of the output in hyp (en) (using Bing Translator). Although the Klingon training data is noisy and imperfect, we observe that our model learns to translate only with 15k Klingon captions. This example illustrates how we can learn to translate even if there is no knowledge of the other language, and where a professional translator would take a long time to first acquire the other language.
406
+
407
+ ![](images/11608736fe8b18530ce46fb801b14d5b5fe0db16985ea70fc8b5e5ad98009a68.jpg)
408
+ Figure 9: Sample English-Klingon translations
409
+
410
+ ![](images/6740918e4399b8d8a3eabd0458314605505e01fd42c730163c8995b214cd3a58.jpg)
411
+ Figure 10: Sample English-Klingon translations