ZHANGYUXUAN-zR commited on
Commit
ae5a26e
·
verified ·
1 Parent(s): a758365

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 +30 -0
  2. assets/pipeline.png +3 -0
  3. md/dev/5xEgrl_5FAJ/5xEgrl_5FAJ.md +3 -0
  4. md/train/3FK30d5BZdu/3FK30d5BZdu.md +445 -0
  5. md/train/AHm3dbp7D1D/AHm3dbp7D1D.md +525 -0
  6. md/train/B17JTOe0-/B17JTOe0-.md +308 -0
  7. md/train/B1em9h4KDS/B1em9h4KDS.md +388 -0
  8. md/train/B1esx6EYvr/B1esx6EYvr.md +278 -0
  9. md/train/BVSM0x3EDK6/BVSM0x3EDK6.md +384 -0
  10. md/train/BkM27IxR-/BkM27IxR-.md +274 -0
  11. md/train/BkM3ibZRW/BkM3ibZRW.md +438 -0
  12. md/train/Bklfsi0cKm/Bklfsi0cKm.md +436 -0
  13. md/train/BklmtJBKDB/BklmtJBKDB.md +388 -0
  14. md/train/BtZhsSGNRNi/BtZhsSGNRNi.md +616 -0
  15. md/train/BydLzGb0Z/BydLzGb0Z.md +279 -0
  16. md/train/CuQoImkKkIj/CuQoImkKkIj.md +336 -0
  17. md/train/Drynvt7gg4L/Drynvt7gg4L.md +206 -0
  18. md/train/HJGv1Z-AW/HJGv1Z-AW.md +263 -0
  19. md/train/HJgZrsC5t7/HJgZrsC5t7.md +327 -0
  20. md/train/HXjt-kRBzvu/HXjt-kRBzvu.md +391 -0
  21. md/train/HkmaTz-0W/HkmaTz-0W.md +334 -0
  22. md/train/QpNz8r_Ri2Y/QpNz8r_Ri2Y.md +0 -0
  23. md/train/S1FQEfZA-/S1FQEfZA-.md +230 -0
  24. md/train/S1TgE7WR-/S1TgE7WR-.md +588 -0
  25. md/train/S1VaB4cex/S1VaB4cex.md +259 -0
  26. md/train/S1en0sRqKm/S1en0sRqKm.md +200 -0
  27. md/train/S1gd7nCcF7/S1gd7nCcF7.md +229 -0
  28. md/train/S1xxx64YwH/S1xxx64YwH.md +285 -0
  29. md/train/S1zk9iRqF7/S1zk9iRqF7.md +458 -0
  30. md/train/SJl3h2EYvS/SJl3h2EYvS.md +224 -0
  31. md/train/SkC_7v5gx/SkC_7v5gx.md +305 -0
  32. md/train/SyyGPP0TZ/SyyGPP0TZ.md +257 -0
  33. md/train/_61Qh8tULj_/_61Qh8tULj_.md +286 -0
  34. md/train/lHmhW2zmVN/lHmhW2zmVN.md +248 -0
  35. md/train/r1My6sR9tX/r1My6sR9tX.md +388 -0
  36. md/train/rHCzkRd0UK/rHCzkRd0UK.md +489 -0
  37. md/train/rJgJDAVKvB/rJgJDAVKvB.md +570 -0
  38. md/train/rJgYxn09Fm/rJgYxn09Fm.md +289 -0
  39. md/train/rJxHsjRqFQ/rJxHsjRqFQ.md +344 -0
  40. md/train/rkgbYyHtwB/rkgbYyHtwB.md +424 -0
  41. md/train/ryg7vA4tPB/ryg7vA4tPB.md +363 -0
  42. md/train/uVPZCMVtsSG/uVPZCMVtsSG.md +0 -0
  43. md/train/ueGDv64HmO/ueGDv64HmO.md +303 -0
  44. md/train/wK2fDDJ5VcF/wK2fDDJ5VcF.md +163 -0
  45. md/train/x9jS8pX3dkx/x9jS8pX3dkx.md +211 -0
  46. md/train/xYGNO86OWDH/xYGNO86OWDH.md +421 -0
  47. md/train/zOngaSKrElL/zOngaSKrElL.md +258 -0
  48. parse/dev/4XMAzZasId/4XMAzZasId_layout.pdf +3 -0
  49. parse/dev/4XMAzZasId/4XMAzZasId_origin.pdf +3 -0
  50. parse/dev/4XMAzZasId/4XMAzZasId_span.pdf +3 -0
.gitattributes CHANGED
@@ -58,3 +58,33 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ split_metadata/dev.json filter=lfs diff=lfs merge=lfs -text
62
+ split_metadata/train.json filter=lfs diff=lfs merge=lfs -text
63
+ md/dev/5xEgrl_5FAJ/5xEgrl_5FAJ.md filter=lfs diff=lfs merge=lfs -text
64
+ parse/dev/BlF6CWzWKT7/BlF6CWzWKT7_layout.pdf filter=lfs diff=lfs merge=lfs -text
65
+ parse/dev/4XMAzZasId/4XMAzZasId_origin.pdf filter=lfs diff=lfs merge=lfs -text
66
+ parse/dev/4XMAzZasId/4XMAzZasId_span.pdf filter=lfs diff=lfs merge=lfs -text
67
+ parse/dev/gJLAfO4KUq/gJLAfO4KUq_span.pdf filter=lfs diff=lfs merge=lfs -text
68
+ parse/dev/gJLAfO4KUq/gJLAfO4KUq_origin.pdf filter=lfs diff=lfs merge=lfs -text
69
+ parse/dev/4XMAzZasId/4XMAzZasId_layout.pdf filter=lfs diff=lfs merge=lfs -text
70
+ parse/dev/ztcfHweENtU/ztcfHweENtU_layout.pdf filter=lfs diff=lfs merge=lfs -text
71
+ parse/dev/b9tUk-f_aG/b9tUk-f_aG_origin.pdf filter=lfs diff=lfs merge=lfs -text
72
+ parse/dev/gJLAfO4KUq/gJLAfO4KUq_layout.pdf filter=lfs diff=lfs merge=lfs -text
73
+ parse/dev/EAcWgk7JM58/EAcWgk7JM58_layout.pdf filter=lfs diff=lfs merge=lfs -text
74
+ parse/dev/EAcWgk7JM58/EAcWgk7JM58_span.pdf filter=lfs diff=lfs merge=lfs -text
75
+ parse/dev/ztcfHweENtU/ztcfHweENtU_origin.pdf filter=lfs diff=lfs merge=lfs -text
76
+ parse/dev/b9tUk-f_aG/b9tUk-f_aG_span.pdf filter=lfs diff=lfs merge=lfs -text
77
+ parse/dev/ztcfHweENtU/ztcfHweENtU_span.pdf filter=lfs diff=lfs merge=lfs -text
78
+ parse/dev/b9tUk-f_aG/b9tUk-f_aG_layout.pdf filter=lfs diff=lfs merge=lfs -text
79
+ parse/dev/agJEk7FhvKL/agJEk7FhvKL_span.pdf filter=lfs diff=lfs merge=lfs -text
80
+ parse/dev/agJEk7FhvKL/agJEk7FhvKL_origin.pdf filter=lfs diff=lfs merge=lfs -text
81
+ parse/dev/agJEk7FhvKL/agJEk7FhvKL_layout.pdf filter=lfs diff=lfs merge=lfs -text
82
+ parse/dev/fxdvWG4rJe/fxdvWG4rJe_span.pdf filter=lfs diff=lfs merge=lfs -text
83
+ parse/dev/fxdvWG4rJe/fxdvWG4rJe_origin.pdf filter=lfs diff=lfs merge=lfs -text
84
+ parse/dev/qUKsCztWlKq/qUKsCztWlKq_origin.pdf filter=lfs diff=lfs merge=lfs -text
85
+ parse/dev/NpsVSN6o4ul/NpsVSN6o4ul_origin.pdf filter=lfs diff=lfs merge=lfs -text
86
+ parse/dev/qUKsCztWlKq/qUKsCztWlKq_span.pdf filter=lfs diff=lfs merge=lfs -text
87
+ parse/dev/EAcWgk7JM58/EAcWgk7JM58_origin.pdf filter=lfs diff=lfs merge=lfs -text
88
+ parse/dev/NpsVSN6o4ul/NpsVSN6o4ul_span.pdf filter=lfs diff=lfs merge=lfs -text
89
+ parse/dev/qUKsCztWlKq/qUKsCztWlKq_layout.pdf filter=lfs diff=lfs merge=lfs -text
90
+ parse/dev/ySQH0oDyp7/ySQH0oDyp7_origin.pdf filter=lfs diff=lfs merge=lfs -text
assets/pipeline.png ADDED

Git LFS Details

  • SHA256: bb03e2d775cebe05337e1a27e4b79e62e4e8285585af19b949bc677d0d18c530
  • Pointer size: 131 Bytes
  • Size of remote file: 202 kB
md/dev/5xEgrl_5FAJ/5xEgrl_5FAJ.md ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:04c27a8f90468d8affabc1eeb92a4949ada4d389bcb03fa13d0e8db456ad9940
3
+ size 100046
md/train/3FK30d5BZdu/3FK30d5BZdu.md ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HIDDEN INCENTIVES FOR AUTO-INDUCED DISTRIBUTIONAL SHIFT
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Decisions made by machine learning systems have increasing influence on the world, yet it is common for machine learning algorithms to assume that no such influence exists. An example is the use of the i.i.d. assumption in content recommendation. In fact, the (choice of) content displayed can change users’ perceptions and preferences, or even drive them away, causing a shift in the distribution of users. We introduce the term auto-induced distributional shift (ADS) to describe the phenomenon of an algorithm causing a change in the distribution of its own inputs. Our goal is to ensure that machine learning systems do not leverage ADS to increase performance when doing so could be undesirable. We demonstrate that changes to the learning algorithm, such as the introduction of meta-learning, can cause hidden incentives for auto-induced distributional shift (HI-ADS) to be revealed. To address this issue, we introduce ‘unit tests’ and a mitigation strategy for HI-ADS, as well as a toy environment for modelling real-world issues with HIADS in content recommendation, where we demonstrate that strong meta-learners achieve gains in performance via ADS. We show meta-learning and Q-learning both sometimes fail unit tests, but pass when using our mitigation strategy.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Consider a content recommendation system whose performance is measured by accuracy of predicting what users will click. This system can achieve better performance by either 1) making better predictions, or 2) changing the distribution of users such that predictions are easier to make. We propose the term auto-induced distributional shift (ADS) to describe this latter kind of distributional shift, caused by the algorithm’s own predictions or behaviour (Figure 1).
12
+
13
+ ![](images/833d9ac6619b77e4b4c37b9014af227c1cffc0cdcc8236556ae4c01b6b89cd90.jpg)
14
+ Figure 1: Distributions of users over time. Left: A distribution which remains constant over time, following the i.i.d assumption. Right: Auto-induced Distributional Shift (ADS) results in a change in the distribution of users in our content recommendation environment. (see Section 5.2 for details).
15
+
16
+ ADS are not inherently bad, and are sometimes even desirable. But they can cause problems if they occur unexpectedly. It is typical in machine learning (ML) to assume (e.g. via the i.i.d. assumption) that (2) will not happen. However, given the increasing real-world use of ML algorithms, we believe it is important to model and experimentally observe what happens when assumptions like this are violated. This is the motivation of our work.
17
+
18
+ In many cases, including news recommendation, we would consider (2) a form of cheating—the algorithm changed the task rather than solving it as intended. We care which means the algorithm used to solve the problem (e.g. (1) and/or (2)), but we only told it about the ends, so it didn’t know not to ’cheat’. This is an example of a specification problem (Leike et al., 2017; Ortega et al., 2018): a problem which arises from a discrepancy between the performance metric (maximize accuracy) and “what we really meant”: in this case, to maximize accuracy via (1).
19
+
20
+ Ideally, we’d like to quantify the desirability of all possible means, e.g. assign appropriate rewards to all potential strategies and “side-effects”, but this is intractable for real-world settings. Using human feedback to learn reward functions which account for such impacts is a promising approach to specifying desired behavior (Leike et al., 2018; Christiano et al., 2017). But the same issue can arise whenever human feedback is used in training: one means of improving performance could be to alter human preferences, making them easier to satisfy. Thus in this work, we pursue a complementary approach: managing learners’ incentives.
21
+
22
+ A learner has an incentive to behave in a certain way when doing so can increase performance (e.g. accuracy or reward). Informally, we say an incentive is hidden when the learner behaves as if it were not present. But we note that changes to the learning algorithm or training regime could cause previously hidden incentives to be revealed, resulting in unexpected and potentially undesirable behaviour. Managing incentives (e.g. controlling which incentives are hidden/ revealed) can allow algorithm designers to disincentivize broad classes of strategies (such as any that rely on manipulating human preferences) without knowing their exact instantiation.1
23
+
24
+ The goal of our work is to provide insights and practical tools for understanding and managing incentives, specifically hidden incentives for auto-induced distributional shift: HI-ADS. To study which conditions cause HI-ADS to be revealed, we present unit tests for detecting HI-ADS in supervised learning (SL) and reinforcement learning (RL). We also create an environment that models ADS in news recommendation, illustrating possible effects of revealing HI-ADS in this setting.
25
+
26
+ The unit tests both have two means by which the learner can improve performance: one which creates ADS and one which does not. The intended method of improving performance is one that does not induce ADS; the other is ’hidden’ and we want it to remain hidden. A learner "fails" the unit test if it nonetheless pursues the incentive to increase performance via ADS. In both the RL and SL unit tests, we find that introducing an outer-loop of meta-learning (e.g. Population-Based Training (PBT) Jaderberg et al. (2017)) can lead to high levels of failure. Similarly, recommender systems trained with PBT induce larger drifts in user base and user interests. These results suggest that failure of our unit tests indicates that an algorithm is prone to revealing HI-ADS in other settings. Finally, we propose and test a mitigation strategy we call context swapping. The strategy consists of rotating learners through different environments throughout learning, so that they can’t see the results or correlations of their actions in one environment over longer time horizons. This effectively mitigates HI-ADS in our unit test environments, but did not work well in content recommendation experiments.
27
+
28
+ # 2 BACKGROUND
29
+
30
+ # 2.1 META-LEARNING AND POPULATION BASED TRAINING
31
+
32
+ Meta-learning is the use of machine learning techniques to learn machine learning algorithms. This involves instantiating multiple learning scenarios which run in an inner loop $\mathbf { \Pi } ( \mathbf { I I L } )$ , while an outer loop (OL) uses the outcomes of the inner loop(s) as data-points from which to learn which learning algorithms are most effective (Metz et al., 2019). The number of IL steps per OL step is called the interval. Many recent works focus on multi-task meta-learning, where the OL seeks to find learning rules that generalize to unseen tasks by training the IL on a distribution of tasks (Finn et al., 2017). Single-task meta-learning includes learning an optimizer for a single task (Gong et al., 2018), and adaptive methods for selecting models (Kalousis, 2000) or setting hyperparameters (Snoek et al., 2012). For simplicity in this initial study we focus on single-task meta-learning.
33
+
34
+ Population-based training (PBT; Jaderberg et al., 2017) is a meta-learning algorithm that trains multiple learners $L _ { 1 } , . . . , L _ { n }$ in parallel, after each interval ( $T$ steps of IL) applying an evolutionary OL step which consists of: (1) Evaluate the performance of each learner, (2) Replace both parameters and hyperparameters of $20 \%$ lowest-performing learners with copies of those from the $20 \%$ highperforming learners (EXPLOIT). (3) Randomly perturb the hyperparameters (but not the parameters) of all learners (EXPLORE).
35
+
36
+ # 2.2 DISTRIBUTIONAL SHIFT AND CONTENT RECOMMENDATION
37
+
38
+ In general, distributional shift refers to change of the data distribution over time. In supervised learning with data $\mathbf { x }$ and labels $y$ , this can be more specifically described as dataset shift: change in the joint distribution of $P ( \mathbf { x } , y )$ between the training and test sets (Moreno-Torres et al., 2012; Quionero-Candela et al., 2009). As identified by Moreno-Torres et al. (2012), two common kinds of shift are: (1) Covariate shift: changing $P ( \mathbf { x } )$ . In the example of content recommendation, this corresponds to changing the user base of the recommendation system. For instance, a media outlet which publishes inflammatory content may appeal to users with extreme views while alienating more moderate users. This self-selection effect (Kayhan, 2015) may appear to a recommendation system as an increase in performance, leading to a feedback effect, as previously noted by Shah et al. (2018). This type of feedback effect has been identified as contributing to filter bubbles and radicalization (Pariser, 2011; Kayhan, 2015). (2) Concept shift: changing $P ( \boldsymbol { y } | \mathbf { x } )$ . In the example of content recommendation, this corresponds to changing a given user’s interest in different kinds of content. For example, exposure to a fake news story has been shown to increase the perceived accuracy of (and thus presumably future interest in) the content, an example of the illusory truth effect (Pennycook et al., 2019). For further details on such effects in content recommendation, see Appendix 8.
39
+
40
+ # 3 AUTO-INDUCED DISTRIBUTION SHIFT (ADS)
41
+
42
+ Auto-induced distribution shift (ADS) is distributional shift caused by an algorithm’s behaviour. This is in contrast to distributional shift which would happen even if the learner were not present - e.g. for a crash prediction algorithm trained on data from the summer, encountering snowy roads is an example of distributional shift, but not auto-induced distributional shift (ADS).
43
+
44
+ ![](images/e073c2dfa79ed13d098885e0aecd106a567f60dc458af17cb1a90e8412bd2143.jpg)
45
+
46
+ Figure 2: The widely studied problems of reinforcement learning (RL) with state $s$ , action $a$ , reward $r$ tuples, and i.i.d. supervised learning (SL) with inputs $x$ , predictions $\hat { y }$ and loss $l$ (a,d) are free from incentive problems. We focus on cases where there are incentives present which the learner is not meant to pursue $^ { ( \mathbf { b } , \mathbf { c } ) }$ . Lines show paths of influence. The learner may have incentives to influence any nodes descending from its action, $A$ , or prediction, $\hat { y }$ . Which incentives are undesirable (orange) or desirable (cyan) for the learner to pursue is context-dependent.
47
+
48
+ We emphasize that ADS are not inherently bad or good; often ADS can even be desirable: consider an algorithm meant to alert drivers of imminent collisions. If it works well, such a system will help drivers avoid crashing, thus making self-refuting predictions which result in ADS. What separates desirable and undesirable ADS? The collision-alert system alters its data distribution in a way that is aligned with the goal of fewer collisions, whereas the news manipulation results in changes that are misaligned with the goal of better predicting existing users’ interests (Leike et al., 2018).
49
+
50
+ In reinforcement learning (RL), ADS are typically encouraged as a means to increase performance. On the other hand, in supervised learning (SL), the i.i.d. assumption precludes ADS in theory. In practice, however, the possibility of using ADS to increase performance (and thus an incentive to do so) often remains. For instance, this occurs in online learning. In our experiments, we explicitly model such situations where i.i.d. assumptions are violated: We study the behavior of SL and myopic RL algorithms, in environments designed to include incentives for ADS, in order to understand when incentives are effectively hidden. Fig. 2 contrasts these settings with typical RL and SL.
51
+
52
+ # 4 INCENTIVES
53
+
54
+ For our study of incentives, we use the following terminology: an incentive for a behavior (e.g. an action, a classification, etc.) is present (not absent) to the extent that the behaviour will increase performance (e.g. reward, accuracy, etc.) (Everitt & Hutter, 2019). This incentive is revealed to (not hidden from) a learner if it would, at higher than chance levels, learn to perform the behavior given sufficient capacity and training experience. The incentive is pursued (not eschewed) by a learner if it actually performs the incentivized behaviour. Note even when an incentive is revealed, it may not be pursued, e.g. due to limited capacity and/or data, or simply chance. See Fig 3.
55
+
56
+ For example, in content recommendation, the incentive to drive users away is present if some user types are easier to predict than others. But this incentive may be hidden from the learner by using a myopic algorithm, e.g. one that does not see the effects of its actions on the distribution of users. The incentive might instead be revealed to the outer loop of a meta-learning algorithm like PBT, which does see the effects of learner’s actions.
57
+
58
+ ![](images/2ade91d4be27c22a6f418d3a986aa9448815d5a0ddb40aa939127276f08bc9bc.jpg)
59
+ Figure 3: Types of incentives, and their relationship to ADS.
60
+
61
+ Even when this incentive is revealed, however, it might not end up being pursued. For example, this could happen if predicting which recommendations will drive away users is too difficult a learning problem, or if the incentive to do so is dominated by other incentives (e.g. change individual users’ interests, or improve accuracy of predictions). In general, it may be difficult to determine empirically which incentives are revealed, because failure to pursue an incentive can be due to limited capacity, insufficient training, and/or random chance. To address this challenge, we devise extremely simple environments (“unit tests”), where we can be confident that revealed incentives will be pursued.
62
+
63
+ # 4.1 HIDDEN INCENTIVES FOR AUTO-INDUCED DISTRIBUTIONAL SHIFT (HI-ADS)
64
+
65
+ Following from the definitions in Sections 3 and 4, HI-ADS are incentives for behaviors that cause Auto-induced Distributional Shift that are hidden from the learner, i.e. the learner would not learn to perform the incentivized behaviors at higher than chance levels, even given infinite capacity and training experience.
66
+
67
+ Like ADS, HI-ADS are not necessarily problematic. Indeed, hiding incentives can be an effective method of influencing learner behavior. For example, hiding the incentive to manipulate users from a content recommendation algorithm could prevent it from influencing users in a way they would not endorse. However, if machine learning practitioners are not aware that incentives are present, or that properties of the learning algorithm are hiding them, then seemingly innocuous changes to the learning algorithm may reveal HI-ADS, and lead to significant unexpected changes in behavior.
68
+
69
+ Hiding incentives for ADS may seem counter-intuitive and counter-productive in the context of reinforcement learning (RL), where moving towards high-reward states is typically desirable. However, for real-world applications of RL, the ultimate goal is not a system that achieves high reward, but rather one that behaves according to the designer’s intentions. And as we discussed in the introduction, it can be intractable to design reward functions that perfectly specify intended behavior. Thus managing (e.g. hiding) some incentives can provide a useful tool for specification, even in RL.
70
+
71
+ We have several reasons for focusing on HI-ADS: (1) The issue of HI-ADS has not yet been identified, and thus is liable to be neglected in practice. Indeed, our “unit tests” are the first published empirical methodology for assessing whether incentives are hidden or revealed by different learning algorithms. (2) Machine learning algorithms are commonly deployed in settings where ADS are present, violating assumptions used to analyze their properties theoretically. This means learners could exploit ADS in unexpected and undesirable ways if incentives for ADS are revealed. Hiding these incentives heuristically (e.g. via off-line training) is a common approach, but potentially brittle (if practitioners don’t understand how HI-ADS could become revealed). In particular, meta-learning can reveal HI-ADS in online learning settings. (3) Substantial real-world issues could result from improper management of learner’s incentives. Examples include tampering with human-generated reward signals (Everitt & Hutter, 2018) (e.g. selecting news articles which manipulate user interests), and creating “self-fulfilling prophecies” (e.g. driving up the value of an asset by publicly predicting its value will increase (Armstrong & O’Rorke, 2017)).
72
+
73
+ # 4.2 REMOVING HI-ADS VIA CONTEXT SWAPPING
74
+
75
+ We propose a technique called context swapping for removing incentives for ADS. The technique trains $N$ learners in parallel, and shuffles the learners through $N$ different copies of the same (or similar) environments.We use a deterministic permutation of learners in environment copies, so that the $i$ -th learner inhabits the $j$ -th environment on time-steps $t$ where $~ j ~ = ~ ( i + t )$ mod $N$ , makes an observation, takes an action, and receives a reward before moving to the next environment.
76
+
77
+ When $N$ is larger than the interval of the OL optimizer, each learner inhabits each copy for at most a single time-step before an OL step is applied. Under the assumption that different copies of the environment do not influence each other, this technique can address HI-ADS in practice, as we show in Sec. 5.1.1.
78
+
79
+ ![](images/06fd14fc3c3117d01ce92cc59924cf8d1fe7f705cf8d340291c9e7534c747cd1.jpg)
80
+ Figure 4: Context swapping (right).
81
+
82
+ # 5 EXPERIMENTS
83
+
84
+ In Section 5.1, we introduce ‘unit tests’ for HI-ADS. Our primary goal with these experiments is to convey a crisp understanding of potential issues caused by revealing HI-ADS. Put simply, our experiments show that you can have a learner which behaves as intended, and just by using metalearning (e.g. PBT), without changing the performance metric (e.g. loss or rewards), the learner’s behavior can change completely. We also show that context swapping is an effective mitigation technique in these environments. On the practical side, the unit tests can be used to compare learning algorithms and diagnose their propensity to reveal incentives.
85
+
86
+ In Section 5.2, we model a content recommendation system. The goal of these experiments is to demonstrate how HI-ADS could create issues for real-world content recommendation systems such as news feeds, search results, or automated suggestions. They also validate the usefulness of the unit tests: algorithms that failed the unit tests also reveal HI-ADS in this setting. We emphasize that ADS takes place in this environment by construction. The point of our experiments is that meta-learning can increase the rate and/or extent of ADS, by revealing this incentive. We find that context swapping is not effective in this environment, highlighting the need for alternative mitigation strategies.
87
+
88
+ # 5.1 HI-ADS UNIT TESTS
89
+
90
+ Unit test 1: Supervised Learning. This unit test consists of a simple prediction problem. There are no inputs, only an underlying state $s \in \{ 0 , 1 \}$ , and targets $\boldsymbol { y } \in \mathbb { R } ^ { 2 }$ with $\chi _ { 1 } , y _ { 2 } \sim \mathcal { N } ( 0 , s * \sigma ^ { 2 } ) , \mathcal { N } ( 0 , 1 )$ , with corresponding predictions $\hat { y } _ { 1 } , \hat { y } _ { 2 }$ . Additionally, $s _ { t + 1 } = 0$ iff $\hat { y } _ { 2 } >$ .5. We use Mean Squared Error as the loss function, so the optimal predictor is $\hat { y _ { 1 } } , \hat { y _ { 2 } } = ( 0 , 0 )$ . However, predicting $\hat { y } _ { 2 } > . 5$ reduces the variance of $\hat { y _ { 1 } }$ , i.e. reduces future loss. The baseline/IL predictor learns $\hat { y _ { 1 } } , \hat { y _ { 2 } }$ as parameters using SGD with a learning rate of 0.001. For experiments with meta-learning, PBT is the OL (with default settings, see Section 2.2), used to tune the learning rate, with negative loss on the final time-step of the interval as the performance measure for PBT.
91
+
92
+ Unit test 2: Myopic RL. This unit test is based on a modification of the prisoner’s dilemma (Prisner, 2014) where an agent plays each round against its past self. The reward function is presented in Table 1. An agent in this environment has a long-term, non-myopic, incentive for cooperation (with its future self), but a current-time-step, myopic, incentive for defection (from its future self).
93
+
94
+ The unit test evaluates whether a agent reveals the non-myopic incentive even when the agent is meant to optimize for the present reward only (i.e. uses discount rate $\gamma = 0$ ). Naively, we’d expect the nonmyopic incentive to be hidden from the agent in this case, and for the agent to consistently defect; learning algorithms that do so pass the test. But some learning algorithms also fail the unit test, revealing the incentive for the agent to cooperate with its future self. While aiming for myopic behavior
95
+
96
+ Table 1: Rewards for the RL unit test. Note that the myopic (defect (D)) action always increases reward at the current time-step, but decreases reward at the next time-step - the incentive to (cooperate (C)) with one’s future self is hidden from the point of view of a myopic learner.
97
+
98
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>at=D</td><td rowspan=1 colspan=1>at=C</td></tr><tr><td rowspan=1 colspan=1>St=at-1=D</td><td rowspan=1 colspan=1>-1/2</td><td rowspan=1 colspan=1>-1</td></tr><tr><td rowspan=1 colspan=1>St=at-1=C</td><td rowspan=1 colspan=1>1/2</td><td rowspan=1 colspan=1>0</td></tr></table>
99
+
100
+ may seem odd, myopic learners have no incentives to cause distributional shift, since it can only improve future performance. And while making learners myopic may seem like a ’brute-force’ guaranteed way to manage HI-ADS, we show it is in fact non-trivial to implement. See Appendix 9.1 for details and experiments varying the reward structure.
101
+
102
+ # 5.1.1 HI-ADS UNIT TESTS EXPERIMENTAL RESULTS AND DISCUSSION
103
+
104
+ We first show that agents trained with PBT fail the unit tests more often than “vanilla” algorithms which do not use meta-learning. We initialize the learning rate log-uniformly between 0.01 and 1.0 for all experiments (whether using PBT or not). We expect and confirm that the following two factors lead to higher rates of unit test failure: (1) Shorter intervals: These give the OL more opportunities to influence the population. (2) Larger populations: These make outliers with exceptional non-myopic performance more likely, and OL makes them likely to survive and propagate.
105
+
106
+ The baseline (no meta-learning) algorithms all pass the unit tests: hidden incentives are almost never revealed - see blue curves in Fig. 5. However, agents trained with meta-learning and large populations often fail the unit tests: see orange curves in top rows of Fig. 5.
107
+
108
+ Furthermore, we verify that context swapping significantly mitigates the effect of HI-ADS in both unit tests, decreasing undesirable behaviour to near-baseline levels - see bottom rows of Fig. 5. This effect can be explained as follows: Because context swapping transfers the benefits of one learner’s action to the next learner to inhabit that environment, it increases the second learner’s fitness, and thereby reduces the relative fitness (as evaluated by PBT’s EXPLOIT step) of the non-myopic cooperate behaviour. We observe some interesting exceptions with the combination of small populations and short PBT intervals: Although context swapping still significantly decreases the effect of HIADS, non-myopic cooperate behaviour is observed as much as $20 \%$ of the time (for #learner $_ { = 1 0 }$ , $T = 1$ ; see bottom-left plot).
109
+
110
+ We also observe that PBT reveals HI-ADS even when $T = 1$ , where the explanation that PBT operates on a longer time horizon than the inner loop does not apply. We provide a detailed explanation for how this might happen in Appendix 9.1.2, but in summary, we hypothesize that there are at least 2 mechanisms by which PBT is revealing HI-ADS: (1) optimizing over a longer time-scale, and (2) picking up on the correlation between an agent’s current policy and the underlying state. Mechanism (2) can be explained informally as reasoning as: “If I’m cooperating, then I was probably cooperating on the last time-step as well, so my reward should be higher”. As support for these hypotheses, we run control experiments identifying two algorithms (each sharing only one of these properties) that can fail the unit test. Context swapping remains effective.
111
+
112
+ # (1) Optimizing over a longer time-scale: replacing PBT with REINFORCE as an
113
+
114
+ ![](images/fb963b752d78b641eafae0011c4187a77f39ee589e94374f2b91ae0ecc03c850.jpg)
115
+ Figure 5: (A) Values of $\hat { y _ { 2 } }$ in the supervised learning (SL) unit test. Larger values mean sacrificing present performance for future performance (i.e. non-myopic exploitation of ADS). (B) Average level of non-myopic cooperate behavior observed in the RL unit test for HI-ADS, with two meta-learning algorithms (B1) PBT and (B2) REINFORCE. Lower is better, since the goal is for non-myopic incentives to remain hidden. Despite the inner loop being fully myopic (simple MLP in the SL test, $\gamma = 0$ in RL test), in all cases outer-loop (OL) optimizers reveal HI-ADS (top rows). Context swapping significantly mitigates HI-ADS (bottom rows).
116
+
117
+ outer-loop optimizer. The outer-loop optimizes the parameters to maximize the summed reward of the last $T$ time-steps. As with PBT, we observe non-myopic behavior, but now only when $T > 1$ This supports our hypothesis that exploitation of HI-ADS is due not to PBT in particular, but just to the introduction of sufficiently powerful meta-learning. See Fig. 5 B2.
118
+
119
+ (2) Exploiting correlation: Q-learning with $\gamma = 0$ an $\epsilon = 0 . 1$ -greedy behavior policy and no meta-learning. If either state was equally likely, the $\mathbf { Q }$ -values would be the average of the values in each column in Table 1, so the estimated $Q ( { \mathrm { d e f e c t } } )$ would be larger. But the $\epsilon$ -greedy policy correlates the previous action (i.e. the current state) and current action (so long as the policy did not just change), so the top-left and bottomright entries carry more weight in the estimates, sometimes causing $Q ( { \mathrm { d e f e c t } } ) \approx Q ($ (cooperate) and persistent nonmyopic behavior. See Fig. 6 for results, Appendix 9.1.4 for more results, and Appendix 9.1.3 for experimental details.
120
+
121
+ # 5.2 CONTENT RECOMMENDATION
122
+
123
+ ![](images/c27ce5d1176c26223b5a51441be7d7fafa717c25c484532ba211b635ec5f8ba5.jpg)
124
+ Figure 6: Q-learning can fail the unit test, playing ${ \sim } 8 0 { \cdot } 9 0 \%$ cooperate in 3 of 5 experiments (bottom row). Each column represents an independent experiment. Q-values for the cooperate and defect actions stay tightly coupled in the failure cases (col. 1,2,5), while in the cases passing the unit test (col. 3,4) the Q-value of cooperate decreases over time.
125
+
126
+ We now present a toy environment for modeling content recommendation of news articles, which includes the potential for ADS by incorporating the mechanisms mentioned in Sec. 2.2, discussed as contributing factors to the problems of fake news and filter bubbles. Specifically, the environment assumes that presenting an article to a user can influence (1) their interest in similar articles, and (2) their propensity to use the recommendation service. These correspond to modeling auto-induced concept shift of users, and auto-induced covariate shift of the user base, respectively (see Sec. 2.2).
127
+
128
+ This environment includes the following components, which change over (discrete) time: User type: $x ^ { t }$ , Article type: $y ^ { t }$ , User interests: $\bar { \mathbf { W } } ^ { t }$ (propensity for users of each type to click on articles of each type), and User loyalty: $\mathbf { g } ^ { t }$ (propensity for users of each type to use the platform). At each time step $t$ , a user $x ^ { t }$ is sampled from a categorical distribution, based on the loyalty of the different user types. The recommendation system (a classifier) selects which type of article to present in the top position, and finally the user ‘clicks’ an article $y ^ { t }$ , according to their interests. User loyalty for user type $x ^ { t }$ undergoes covariate shift: in accordance with the self-selection effect, $g ^ { t }$ increases or decreases proportionally to that user type’s interest in the top article. The interests of user type $x ^ { t }$ (represented by a column of $\mathbf { W } ^ { t }$ ) undergoing concept shift; in accordance with the illusory truth effect, interest in the topic of the top article chosen by the recommender system always increases.
129
+
130
+ # 5.2.1 CONTENT RECOMMENDATION EXPERIMENTAL RESULTS AND DISCUSSION
131
+
132
+ We run 20 trials using an MLP trained with SGD for the recommender system. We find that PBT yields significant improvements in training time and accuracy, but also greater distributional shift (Fig. 7). User base and user interests both change faster with PBT, and user interests change more overall. We measure concept/covariate shift using the cosine distance and KL-divergence, respectively. We observe that the distributions over user types typically saturate (to a single user type) after a few hundred time-steps (Fig 1 and Fig. 7, Right). We run long enough to reach such states, to demonstrate that the increase in ADS from PBT is not transitory. The environment has a number of free parameters, and our results are qualitatively consistent so long as the covariate shift rate $( \alpha _ { 1 } )$ is faster than the concept shift rate $\left( \alpha _ { 2 } \right)$ . See Appendix 9.2.1 for details.
133
+
134
+ ![](images/95efffd0c2948471a88671bd2e264c0a9ccf142775dc7e578a618fd609eb6f42.jpg)
135
+ Figure 7: Content recommendation experiments. Left: using Population Based Training (PBT) increases accuracy of predictions faster, leads to a faster and larger drift in users’ interests, $P ( \boldsymbol { y } | \mathbf { x } )$ , (Center); as well as the distribution of users, $P ( \mathbf { x } )$ , (Right). Shading shows std error over 20 runs.
136
+
137
+ # 6 RELATED WORK
138
+
139
+ ADS in practice: We introduce the term ADS, but we are far from the first to study it. Caruana et al. (2015) provide an example of asthmatic patients having lower predicted risk of pneumonia. Treating asthmatics with pneumonia less aggressively on this basis would be an example of harmful ADS; the reason they had lower pneumonia risk was because they had received more aggressive care already. Schulam & Saria (2017) note that such predictive models are commonly used to inform decision-making, and propose modeling counterfactuals (e.g. “how would this patient fare with less aggressive treatment”) to avoid making such self-refuting predictions. While their goal is to make accurate predictions in the presence of ADS, our goal is to identify and manage incentives for ADS.
140
+
141
+ Non-i.i.d bandits: Contextual bandits (Wang et al., 2005) are a common approach to content recommendation (Li et al., 2010). While bandit algorithms typically make the i.i.d. assumption, counter-examples exist (Gheshlaghi Azar et al., 2014; Auer et al., 1995). Closest to our work is Shah et al. (2018), who consider covariate shift caused by recommender systems’ recommendations. But while they seek to exploit ADS, our aim is to avoid hidden incentives for exploiting ADS.
142
+
143
+ Safety and incentives: Emergent incentives to influence the world (such as HI-ADS) are at the heart of many concerns about the safety of advanced AI systems (Omohundro, 2008; Bostrom, 2014). Understanding and managing the incentives of learners is also a focus of Armstrong & O’Rourke (2017); Everitt (2018); Everitt et al. (2019); Cohen et al.. While Everitt et al. (2019) focus on identifying which incentives are present, we note that incentives may be present and yet not be revealed or pursued - for example, in supervised learning, there is an incentive to make predictions that are over-fit to the test set, but we typically hide the test set from the learner, which effectively hides this incentive. While Carey et al. (2020); Everitt et al. (2019); Armstrong & O’Rourke (2017) discuss methods of removing problematic incentives, we note in practice incentives are often hidden rather than removed. Our work addresses the efficacy of this approach and ways in which it can fail.
144
+
145
+ HI-ADS and meta-learning: We believe our work is the first to consider HI-ADS and their relation to meta-learning. A few previous works have some relevance. Rabinowitz (2019) documents qualitative differences in learning behavior when meta-learning is applied. MacKay et al. (2019) and Lorraine & Duvenaud (2018) view meta-learning as a bilevel optimization problem, with the inner loop playing a best-response to the outer loop. In our work, the outer loop has a greater influence, and the inner loop often fails to play best-response. Sutton et al. (2007) noted that meta-learning can improve performance by preventing convergence of the inner loop to best response.
146
+
147
+ # 7 DISCUSSION AND CONCLUSION
148
+
149
+ We identify the phenomenon of auto-induced distributional shift (ADS) and problems that can arise when there are hidden incentives for learners to induce distributional shift (HI-ADS). We show that meta-learning can reveal HI-ADS and lead learners to use ADS as a means of increasing performance.
150
+
151
+ Our work highlights the interdisciplinary nature of issues with real-world deployment of ML systems - we show how HI-ADS could play a role in important technosocial issues like filter bubbles and the propagation of fake news. There are a number of potential implications for our work: (1) When HI-ADS are a concern, our methodology and environments can be used to help diagnose whether and to what extent the final performance/behavior of a learner is due to ADS and/or incentives for ADS, i.e. to quantify their influence on that learner. (2) Comparing this quantitative analysis for different algorithms could help us understand which features of algorithms affect their propensity to reveal HI-ADS, and aid in the development of safer and more robust algorithms. (3) Characterizing and identifying HI-ADS in these tests is a first step to analyzing and mitigating other (problematic) hidden incentives, as well as to developing theoretical understanding of hidden incentives.
152
+
153
+ Broadly speaking, our work emphasizes that the choice of machine learning algorithm plays an important role in specification, independently of the choice of performance metric. A learner can use ADS to increase performance according to the intended performance metric, and yet still behave in an undesirable way, if we did not intend the learner to improve performance by that method. In other words, performance metrics are typically incomplete specifications: they only specify our goals or ends, while our choice of learning algorithm plays a role in specifying the means by which we intend an learner to achieve those ends. With increasing deployment of ML algorithms in daily life, we believe that (1) understanding incentives and (2) specifying desired/allowed means of improving performance are important avenues of future work to ensure fair, robust, and safe outcomes.
154
+
155
+ # REFERENCES
156
+
157
+ Hunt Allcott and Matthew Gentzkow. Social media and fake news in the 2016 election. Journal of Economic Perspectives, 31(2):211–36, May 2017.
158
+
159
+ Michelle A. Amazeen and Bartosz W. Wojdynski. Reducing native advertising deception: Revisiting the antecedents and consequences of persuasion knowledge in digital news contexts. Mass Communication and Society, 0(0):1–26, 2018.
160
+
161
+ Stuart Armstrong and Xavier O’Rorke. Good and safe uses of ai oracles. arXiv preprint arXiv:1711.05541, 2017.
162
+
163
+ Stuart Armstrong and Xavier O’Rourke. Indifference methods for managing agent rewards. Technical report, Future of Humanity Institute, 2017.
164
+
165
+ K. J. Åström. Optimal control of Markov Processes with incomplete state information. Journal of Mathematical Analysis and Applications, 10:174–205, January 1965.
166
+
167
+ P. Auer, N. Cesa-Bianchi, Y. Freund, and R. E. Schapire. Gambling in a rigged casino: The adversarial multi-armed bandit problem. In Foundations of Computer Science, 1995.
168
+
169
+ Eytan Bakshy, Solomon Messing, and Lada A. Adamic. Exposure to ideologically diverse news and opinion on Facebook. Science, 348(6239):1130–1132, 2015. ISSN 0036-8075. doi: 10.1126/science.aaa1160. URL http://science.sciencemag.org/content/348/ 6239/1130.
170
+
171
+ Nick Bostrom. Superintelligence: Paths, Dangers, Strategies. Oxford University Press, Inc., New York, NY, USA, 1st edition, 2014.
172
+
173
+ Ryan Carey, Eric Langlois, Tom Everitt, and Shane Legg. The incentives that shape behaviour. arXiv preprint arXiv:2001.07118, 2020.
174
+
175
+ Rich Caruana, Yin Lou, Johannes Gehrke, Paul Koch, Marc Sturm, and Noemie Elhadad. Intelligible models for healthcare: Predicting pneumonia risk and hospital 30-day readmission. In International Conference on Knowledge Discovery and Data Mining, pp. 1721–1730, 2015.
176
+
177
+ Paul Christiano, Jan Leike, Tom B. Brown, Miljan Martic, Shane Legg, and Dario Amodei. Deep reinforcement learning from human preferences, 2017.
178
+
179
+ Michael K Cohen, Badri N Vellambi, and Marcus Hutter. Asymptotically unambitious artificial general intelligence.
180
+
181
+ Dominic DiFranzo and Kristine Gloria-Garcia. Filter bubbles and fake news. XRDS, 23(3):32–35, April 2017. ISSN 1528-4972. doi: 10.1145/3055153. URL http://doi.acm.org/10. 1145/3055153.
182
+
183
+ Mostafa M. El-Bermawy. Your echo chamber is destroying democracy, 2016. URL https: //www.wired.com/2016/11/filter-bubble-destroying-democracy/.
184
+
185
+ Tom Everitt. Towards Safe Artificial General Intelligence. PhD thesis, Australian National University, 2018.
186
+
187
+ Tom Everitt and Marcus Hutter. The alignment problem for bayesian history-based reinforcement learners. 2018.
188
+
189
+ Tom Everitt and Marcus Hutter. Reward tampering problems and solutions in reinforcement learning: A causal influence diagram perspective. arXiv preprint arXiv:1908.04734, 2019.
190
+
191
+ Tom Everitt, Pedro A. Ortega, Elizabeth Barnes, and Shane Legg. Understanding agent incentives using causal influence diagrams. part i: Single action settings, 2019.
192
+
193
+ Lisa K. Fazio, Nadia M. Brashier, B. Keith Payne, and Elizabeth J. Marsh. Knowledge does not protect against illusory truth. Journal of Experimental Psychology: General, 144(5):993–1002, 10 2015. ISSN 0096-3445. doi: 10.1037/xge0000098.
194
+
195
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning, 2017.
196
+
197
+ Seth Flaxman and Sharad Goel. Filter bubbles, echo chambers, and online news consumption. Public Opinion Quarterly, 2015.
198
+
199
+ Mohammad Gheshlaghi Azar, Alessandro Lazaric, and Emma Brunskill. Online stochastic optimization under correlated bandit feedback. ArXiv preprint, 2014.
200
+
201
+ Dong Gong, Zhen Zhang, Qinfeng Shi, Anton van den Hengel, Chunhua Shen, and Yanning Zhang. Learning an optimizer for image deconvolution. ArXiv preprint, 2018.
202
+
203
+ Jacob Groshek and Karolina Koc-Michalska. Helping populism win? Social media use, filter bubbles, and support for populist presidential candidates in the 2016 us election campaign. Information, Communication & Society, 20(9):1389–1407, 2017. doi: 10.1080/1369118X.2017.1329334. URL https://doi.org/10.1080/1369118X.2017.1329334.
204
+
205
+ Dylan Hadfield-Menell, Smitha Milli, Pieter Abbeel, Stuart Russell, and Anca Dragan. Inverse reward design. In Neural Information Processing Systems, 2017.
206
+
207
+ M. Jaderberg, V. Dalibard, S. Osindero, W. M. Czarnecki, J. Donahue, A. Razavi, O. Vinyals, T. Green, I. Dunning, K. Simonyan, C. Fernando, and K. Kavukcuoglu. Population Based Training of Neural Networks. ArXiv preprint, 2017.
208
+
209
+ Leslie Pack Kaelbling, Michael L. Littman, and Anthony R. Cassandra. Planning and acting in partially observable stochastic domains. Artificial Intelligence, 101(1-2):99–134, May 1998. ISSN 0004-3702.
210
+
211
+ A. Kalousis. Model selection via meta-learning: A comparative study. In IEEE International Conference on Tools with Artificial Intelligence, 2000.
212
+
213
+ Varol Kayhan. Confirmation bias: Roles of search engines and search contexts. In International Conference on Information Systems, 2015.
214
+
215
+ Ed. Lee Howell. Digital wildfires in a hyperconnected world. In Lee Howell (ed.), Global Risks 2013. World Economic Forum, 2013. URL http://reports.weforum.org/global-risks-2013/risk-case-1/ digital-wildfires-in-a-hyperconnected-world/.
216
+
217
+ Jan Leike, Miljan Martic, Victoria Krakovna, Pedro A. Ortega, Tom Everitt, Andrew Lefrancq, Laurent Orseau, and Shane Legg. AI safety gridworlds. Technical report, DeepMind, 2017.
218
+
219
+ Jan Leike, David Krueger, Tom Everitt, Miljan Martic, Vishal Maini, and Shane Legg. Scalable agent alignment via reward modeling: a research direction. Technical report, DeepMind Safety Research, 2018.
220
+
221
+ Lihong Li, Wei Chu, John Langford, and Robert E. Schapire. A contextual-bandit approach to personalized news article recommendation. In International Conference on World Wide Web, 2010.
222
+
223
+ Jonathan Lorraine and David Duvenaud. Stochastic hyperparameter optimization through hypernetworks. ArXiv preprint, 2018.
224
+
225
+ D. D. Luxton, J. D. June, and J. M. Fairall. Social media and suicide: A public health perspective. American journal of public health, 102(2):195–200, 2012.
226
+
227
+ Matthew MacKay, Paul Vicol, Jonathan Lorraine, David Duvenaud, and Roger Grosse. Self-tuning networks: Bilevel optimization of hyperparameters using structured best-response functions. ArXiv preprint, 2019.
228
+
229
+ Merriam-Webster. The real story of fake news, 2017. URL https://www.merriam-webster. com/words-at-play/the-real-story-of-fake-news.
230
+
231
+ Luke Metz, Niru Maheswaranathan, Brian Cheung, and Jascha Sohl-Dickstein. Learning unsupervised learning rules. In International Conference on Learning Representations, 2019.
232
+
233
+ Paul Mihailidis and Samantha Viotty. Spreadable spectacle in digital culture: Civic expression, fake news, and the role of media literacies in "post-fact" society. American Behavioural Scientist, 2017.
234
+
235
+ Jose G. Moreno-Torres, Troy Raeder, RocíO Alaiz-RodríGuez, Nitesh V. Chawla, and Francisco Herrera. A unifying view on dataset shift in classification. Pattern Recognition, 45(1):521–530, January 2012.
236
+
237
+ Tien T. Nguyen, Pik-Mai Hui, F. Maxwell Harper, Loren Terveen, and Joseph A. Konstan. Exploring the filter bubble: The effect of using recommender systems on content diversity. In Proceedings of the 23rd International Conference on World Wide Web, WWW ’14, pp. 677–686, New York, NY, USA, 2014. ACM. ISBN 978-1-4503-2744-2. doi: 10.1145/2566486.2568012. URL http://doi.acm.org/10.1145/2566486.2568012.
238
+
239
+ Safiya Umoja Noble. Algorithms of Oppression: How Search Engines Reinforce Racism. NYC Press, 2018.
240
+
241
+ Stephen M. Omohundro. The basic AI drives. In Conference on Artificial General Intelligence, 2008.
242
+
243
+ Pedro A. Ortega, Vishal Maini, et al. Building safe artificial intelligence: specification, robustness, and assurance, 2018.
244
+
245
+ Eli Pariser. The Filter Bubble: What the Internet Is Hiding from You. The Penguin Group, 2011.
246
+
247
+ Gordon Pennycook, Tyrone D Cannon, and David G. Rand. Prior exposure increases perceived accuracy of fake news. Journal of Experimental Psychology (forthcoming), 2019.
248
+
249
+ Erich Prisner. Game Theory Through Examples. Mathematical Association of America, 2014.
250
+
251
+ Joaquin Quionero-Candela, Masashi Sugiyama, Anton Schwaighofer, and Neil D. Lawrence. Dataset Shift in Machine Learning. The MIT Press, 2009.
252
+
253
+ Neil C. Rabinowitz. Meta-learners’ learning dynamics are unlike learners’. ArXiv preprint, 2019.
254
+
255
+ David Robson. The myth of the online echo chamber, 2018. URL http://www.bbc.com/ future/story/20180416-the-myth-of-the-online-echo-chamber.
256
+
257
+ Peter Schulam and Suchi Saria. Reliable decision support using counterfactual models. In Neural Information Processing Systems, 2017.
258
+
259
+ Virag Shah, Jose Blanchet, and Ramesh Johari. Bandit learning with positive externalities. Neural Information Processing Systems, 2018.
260
+
261
+ Chengcheng Shao, Giovanni Luca Ciampaglia, Onur Varol, Kai-Cheng Yang, Alessandro Flammini, and Filippo Menczer. The spread of low-credibility content by social bots. Nature Communications, 9(4787), 2018.
262
+
263
+ Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical Bayesian optimization of machine learning algorithms. In Neural Information Processing Systems, 2012.
264
+
265
+ Richard S Sutton and Andrew G Barto. Introduction to Reinforcement Learning. MIT Press, 1998.
266
+
267
+ Richard S Sutton, Anna Koop, and David Silver. On the role of tracking in stationary environments. In International conference on Machine learning, 2007.
268
+
269
+ Techopedia. Filter bubble, 2018. URL https://www.techopedia.com/definition/ 28556/filter-bubble.
270
+
271
+ Chih-Chun Wang, Sanjeev R Kulkarni, and H Vincent Poor. Bandit problems with side observations. IEEE Transactions on Automatic Control, 50(3):338–355, 2005.
272
+
273
+ Wikipedia contributors. Confirmation bias — Wikipedia, the free encyclopedia, 2018. URL https://en.wikipedia.org/w/index.php?title=Confirmation_bias& oldid=875026726. [Online; accessed 20-January-2019].
274
+
275
+ Ronald J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. In Machine Learning, pp. 229–256, 1992.
276
+
277
+ # APPENDICES
278
+
279
+ # 8 CONTENT RECOMMENDATION IN THE WILD
280
+
281
+ Filter bubbles, the spread of fake news, and other techno-social issues are widely reported to be responsible for the rise of populism (Groshek & Koc-Michalska, 2017), increase in racism and prejudice against immigrants and refugees (Noble, 2018), increase in social isolation and suicide (Luxton et al., 2012), and, particularly with reference to the 2016 US elections, are decried as threatening the foundations of democracy (El-Bermawy, 2016). Even in 2013, well before the 2016 American elections, a World Economic Forum report identified these problems as a global crisis (Lee Howell, 2013).
282
+
283
+ We focus on two related issues in which content recommendation algorithms play a role: fake news and filter bubbles.
284
+
285
+ # 8.1 FAKE NEWS
286
+
287
+ Fake news (also called false news or junk news) is an extreme version of yellow journalism, propaganda, or clickbait, in which media that is ostensibly providing information focuses on being eye-catching or appealing, at the expense of the quality of research and exposition of factual information. Fake news is distinguished by being specifically and deliberately created to spread falsehoods or misinformation (Merriam-Webster, 2017; Mihailidis & Viotty, 2017).
288
+
289
+ Why does fake news spread? It may at first seem the solution is simply to educate people about the truth, but research tells us the problem is more multifaceted and insidious, due to a combination of related biases and cognitive effects including confirmation bias (people are more likely to believe things that fit with their existing beliefs), priming (exposure to information unconsciously influences the processing of subsequent information, i.e. seeing something in a credible context makes things seem more credible) and the illusory truth effect (i.e. people are more likely to believe something simply if they are told it is true).
290
+
291
+ Allcott & Gentzkow (2017) track about 150 fake news stories during the 2016 US election, and find the average American adult saw 1-2 fake news stories, just over half believed the story was true, and likelihood of believing fake news increased with ideological segregation (polarization) of their social media. Shao et al. (2018) examine the role of social bots in spreading fake news by analyzing 14 million Twitter messages. They find that bots are far more likely than humans to spread misinformation, and that success of a fake news story (in terms of human retweets) was heavily dependent on whether bots had shared the story.
292
+
293
+ Pennycook et al. (2019) examine the role of the illusory truth effect in fake news. They find that even a single exposure to a news story makes people more likely to believe that it is true, and repeat viewings increase this likelihood. They find that this is not true for extremely implausible statements (e.g. “the world is a perfect cube”), but that “only a small degree of potential plausibility is sufficient for repetition to increase perceived accuracy” of the story. The situation is further complicated by peoples’ inability to distinguish promoted content from real news - Amazeen & Wojdynski (2018) find that fewer than 1/10 people were able to tell when content was an advertisement, even when it was explicitly labelled as such. Similarly, Fazio et al. (2015) find that repeated exposure to incorrect trivia make people more likely to believe it, even when they are later able to identify the trivia as incorrect.
294
+
295
+ # 8.2 FILTER BUBBLES
296
+
297
+ Filter bubbles, a term coined and popularized by Pariser (2011) are created by positive or negative feedback loops which encourage users or groups of users towards increasing within-group similarity, while driving up between-group dissimilarity. The curation of this echo chamber is called selfselection (people are more likely to look for or select things that fit their existing preferences), and favours what Techopedia (2018) calls intellectual isolation. In the context of social and political opinions, this is often called the polarization effect (Wikipedia contributors, 2018).
298
+
299
+ Filter bubbles can be encouraged by algorithms in two main ways. The first is the most commonly described: simply by showing content that is similar to what a user has already searched for, search or recommender systems create a positive feedback loop of increasingly-similar content (Pariser, 2011; Kayhan, 2015). The second way is similar but opposite - if the predictions of an algorithm are good for a certain group of people, but bad for others, the algorithm can do better on its metrics by driving hard-to-predict users away. Then new users to the site will either be turned off entirely, or see an artificially homogenous community of like-minded peers, a phenomena Shah et al. (2018) call positive externalities.
300
+
301
+ In a study of 50,000 US-based internet users, Flaxman & Goel (2015) find that two things increase with social media and search engine use: (1) exposure of an individual to opposing or different viewpoints, and (2) mean ideological distance between users. Many studies cite the first result as evidence of the benefits of internet and social media (Robson, 2018; Bakshy et al., 2015), but the correlation of exposure with ideological distances demonstrates that exposure is not enough, and might even be counterproductive.
302
+
303
+ Facebook’s own study on filter bubbles results show that the impact of the news feed algorithm on filter bubble “size” (a measure of homogeneity of posts relative to a baseline) is almost as large as the impact of friend group composition (Bakshy et al., 2015). Kayhan (2015) specifically study the role of search engines in confirmation bias, and find that search context and the similarity of results in search engine results both reinforce existing biases and increase the likelihood of future biased searches. Nguyen et al. (2014) similarly study the effect of recommender systems on individual users’ content diversity, and find that the set of options recommended narrows over time.
304
+
305
+ Filter bubbles create an ideal environment for the spread of fake news: they increase the likelihood of repeat viewings of similar content, and because of the illusory truth effect, that content is more likely to be believed and shared (Pennycook et al., 2019; DiFranzo & Gloria-Garcia, 2017; Pariser, 2011). We are not claiming that HI-ADS are entirely or even mostly responsible for these problems, but we do note that they can play a role that is worth addressing.
306
+
307
+ ![](images/5c7a8c62362379a4ec118b2d7cacc1bfea380d1d1281d25198b5cb5100eaef60.jpg)
308
+ incentive-compatible $\beta = 0 . 5$ )
309
+ Figure 8: Average level of non-myopic (i.e. cooperate) behavior learned by agents in the unit test for HI-ADS. Despite making the inner loop fully myopic $( \gamma = 0 )$ ), population-based training (PBT) can cause HI-ADS, leading agents to choose the cooperate action (top row). context swapping successfully prevents this (bottom row). Columns (from left to right) show results for populations of 10, 100, and 1000 learners. In the legend, “interval” refers to the interval $( T )$ of PBT (see Sec. 2.2). Sufficiently large populations and short intervals are necessary for PBT to induce nonmyopic behavior.
310
+
311
+ # 9 EXTRA EXPERIMENTS AND REPRODUCIBILITY DETAILS
312
+
313
+ # 9.1 HI-ADS UNIT TEST
314
+
315
+ We used REINFORCE (Williams, 1992) with discount factor $\gamma = 0$ as the baseline/IL optimizer. PBT (with default settings, see Section 2.2) is used to tune the learning rate, with reward on the final time-step of the interval as the performance measure for PBT.
316
+
317
+ Formally, the environment is not a $2 \mathbf { x } 2$ game (as the original prisoner’s dilemma); it’s a partially observable Markov Decision Process (Åström, 1965; Kaelbling et al., 1998):
318
+
319
+ $$
320
+ \begin{array} { r l r } & { } & { s _ { t } , o _ { t } = a _ { t - 1 } , \{ \} } \\ & { } & { a _ { t } \in \{ \mathsf { d e f e c t } , ~ \mathsf { c o o p e r a t e } \} } \\ & { } & { P ( s _ { t } , a _ { t } ) = \delta ( a _ { t } ) } \\ & { } & { R ( s _ { t } , a _ { t } ) = I ( s _ { t } = \mathsf { c o o p e r a t e } ) + \beta ~ I ( a _ { t } = \mathsf { c o o p e r a t e } ) - 1 / 2 } \end{array}
321
+ $$
322
+
323
+ where $I$ is an indicator function, and $\beta = - 1 / 2$ is a parameter controlling the alignment of incentives. The initial state is sampled as $s _ { 0 } \sim U ( { \tt d e f e c t }$ , cooperate). Policies are represented by a single real-valued parameter $\theta$ (initialized as $\theta \sim \mathcal { N } ( 0 , 1 ) \big )$ ) passed through a sigmoid whose output represents $P ( a _ { t } = \mathrm { \bar { d e f e c t } } )$ .
324
+
325
+ # 9.1.1 ALIGNMENT OF INCENTIVES EXPLORATION
326
+
327
+ This section presents an exploration of the parameter $\beta$ , which controls the alignment of incentives in the HI-ADS unit tests (see Table 2).
328
+
329
+ To clarify the interpretation of experiments, we distinguish between environments in which myopic (defect) vs. nonmyopic (cooperate) incentives are opposed, orthogonal, or compatible. Note that in this unit test myopic behaviour (defection) is what we want to see.
330
+
331
+ 1. Incentive-opposed: Optimal myopic behavior is incompatible with optimal nonmyopic behavior (classic prisoner’s dilemma; these experiments are in the main paper).
332
+ 2. Incentive-orthogonal: Optimal myopic behavior may or may not be optimal nonmyopic behavior.
333
+ 3. Incentive-compatible: Optimal myopic behavior is necessarily also optimal nonmyopic behavior.
334
+
335
+ We focused on incentive-opposed environment $( \beta = - 1 / 2 )$ ) in the main paper in order to demonstrate that HI-ADS can be powerful enough to change the behavior of the system in an undesirable way. Here we also explore incentive-compatible and incentive-orthogonal environments because they provide useful baselines, helping us distinguish a systematic bias towards nonmyopic behavior from other reasons (such as randomness or optimization issues) for behavior that does not follow a myopically optimal policy.
336
+
337
+ # 9.1.2 WORKING THROUGH A DETAILED EXAMPLE FOR PBT WITH $T = 1$
338
+
339
+ To help provide intuition on how (mechanistically) PBT could lead to persistent levels of cooperation, we walk through a simple example (with no inner loop). Consider PBT with $T = 1$ and a population of 5 deterministic agents $A _ { 1 } , . . . , A _ { 5 }$ playing cooperate and receiving reward of $r ( A _ { i } ) = 0$ . Now suppose $A _ { 1 }$ suddenly switches to play defect. Then $r ( A _ { 1 } ) = 1 / 2$ on the next time-step (while the other agents’ reward is still 0), and so PBT’s EXPLOIT step will copy $A _ { 1 }$ (without loss of generality to $A _ { 2 }$ ). On the following time-step, $r ( A _ { 2 } ) = 1 / 2$ , and $r ( A _ { 1 } ) = - 1 / 2$ , so PBT will clone $A _ { 2 }$ to $A _ { 1 }$ , and the cycle repeats. Similar reasoning applies for larger populations, and $T > 1$ .
340
+
341
+ # 9.1.3 Q-LEARNING EXPERIMENT DETAILS
342
+
343
+ We show that, under certain conditions, Q-learning can learn to (primarily) cooperate, and thus fails the HI-ADS unit test. We estimate Q-values using the sample-average method, which is guaranteed to converge in the fully observed, tabular case (Sutton & Barto, 1998). The agent follows the $\epsilon$ -greedy policy with $\epsilon = 0 . 1$ . In order to achieve this result, we additionally start the agent off with one synthetic memory where both state and action are defect and therefor $R ( \mathrm { d e f e c t } ) = - . 5$ , and we hard-code the starting state to be cooperate (which normally only happens $50 \%$ of the time). Without this kind of an initialization, the agent always learns to defect. However, under these conditions, we find that 10/30 agents learned to play cooperate most of the time, with $Q$ (cooperate) and $Q ( { \mathrm { d e f e c t } } )$ both hovering around $- 0 . 0 7$ , while others learn to always defect, with $Q ( { \mathrm { c o o p e r a t e } } ) \approx - 0 . 9 2$ and $Q ( { \mathrm { d e f e c t } } ) \approx - 0 . 4 5$ . context swapping, however, prevents majority-cooperate behavior from ever emerging, see Figure 11.
344
+
345
+ Table 2: $\beta$ controls the extent to which myopic and nonmyopic incentives are aligned.
346
+
347
+ <table><tr><td>β</td><td>Environment</td><td>Cooperating</td></tr><tr><td>&lt;0</td><td>incentive-opposed</td><td>yields less reward on the current time-step (myopically detrimental)</td></tr><tr><td>=0</td><td>incentive-orthogonal</td><td>does not affect the current reward (myopically indifferent)</td></tr><tr><td>v0</td><td>incentive-compatible</td><td>yields more reward on the current time-step (myopically beneficial)</td></tr></table>
348
+
349
+ # 9.1.4 Q-LEARNING: FURTHER RESULTS
350
+
351
+ To give a more representative picture of how often Q-learning fails the unit test, we run a larger set of experiments with Q-learning, results are in Figure 10. It’s possible that the failure of Q-learning is not persistent, since we have not proved otherwise, but we did run much longer experiments and still observe persistent failure, see Figure 9.
352
+
353
+ ![](images/93bc9858be4e122e4aa54709b97526f0b712f8b3de8f38002ec30b69c8b8d7ee.jpg)
354
+ Figure 9: The same experiments as Figures 6, 10, run for 50,000 time-steps instead of 3000, to illustrate the persistence of non-myopic behavior.
355
+
356
+ ![](images/3e860d515c7ba817cb56c44c846a248ed6df5909c2c2c53c73553c58f29bb252.jpg)
357
+ Figure 10: More independent experiments with Q-learning, exactly following Figure 6. Q-learning fails the unit test in a total of 10/30 experiments (including those from Figure 6).
358
+
359
+ ![](images/18011e0877d74bf4ea8b3877bc9a66d2f427d421200bb03d1cb2dd7167b3d022.jpg)
360
+ Figure 11: More independent experiments with Q-learning, exactly following Figure 6, except also using context swapping. This leads to a $100 \%$ success rate on the unit test.
361
+
362
+ # 9.2 CONTENT RECOMMENDATION
363
+
364
+ # 9.2.1 ENVIRONMENT DETAILS
365
+
366
+ The evironment has the following components:
367
+
368
+ 1. User type, $x ^ { t }$ : categorical variable representing different types of users. The content recommender conditions its predictions on the type of the current user.
369
+ 2. User loyalty, $\mathbf { g } ^ { t }$ : the propensity for users of each type to use the platform. User $x ^ { t }$ is sampled from a categorical distribution with parameters given by softmax $( \mathbf { g } ^ { t } )$ .
370
+ 3. Article type, $y ^ { t }$ : a categorical variable (one-hot encoding) representing the type of article selected by the user.
371
+ 4. User interests, $\mathbf { W } ^ { t }$ : a matrix whose entries $W _ { x , y } ^ { t }$ represent the average interest user of type $x$ have in articles of type $y$ .
372
+
373
+ At each time step $t$ , a user $x ^ { t }$ is sampled from a categorical distribution (based on the loyalty of the different user types), then the recommendation system selects which type of article to present in the top position, and finally, the user selects an article. The goal of the recommendation system is to predict the likelihood that the user would click on each of the available articles, in order to select the one which is most interesting to the user.
374
+
375
+ User loyalty for $x ^ { t }$ then changes in accordance with the self-selection effect, increasing or decreasing proportionally to their interest in the top article. The interests of user type $x ^ { t }$ (represented by a column of $\mathbf { W } ^ { t }$ ) also change; in accordance with the illusory truth effect, their interest in the topic of the top article (as chosen by the recommender system) always increases. Overall, this environment is an extremely crude representation of reality, but it allows us to incorporate both the effects of self-selection (via covariate shift), and the illusory truth effect (via concept shift).
376
+
377
+ Formally, this environment is similar to a POMDP\R, i.e. a POMDP with no reward function, also known as a world model (Armstrong & O’Rourke, 2017; Hadfield-Menell et al., 2017); the difference is that the learner observes the input before acting and only observes the target after acting. The states, observations, and actions given below.
378
+
379
+ $$
380
+ \begin{array} { c } { { \boldsymbol { s } ^ { t } = ( \mathbf { g } ^ { t } , \mathbf { W } ^ { t } , \boldsymbol { x } ^ { t } , \boldsymbol { y } ^ { t } ) } } \\ { { \boldsymbol { o } _ { \mathrm { p r e } } ^ { t } , ~ \boldsymbol { a } ^ { t } , ~ \boldsymbol { o } _ { \mathrm { p o s t } } ^ { t } = ( \boldsymbol { x } ^ { t } , \hat { \boldsymbol { y } } ^ { t } , \boldsymbol { y } ^ { t } ) } } \end{array}
381
+ $$
382
+
383
+ The state transition function is defined by:
384
+
385
+ $$
386
+ \begin{array} { r l r } { \mathbf { g } _ { x ^ { t } } ^ { t + 1 } = \mathbf { g } _ { x ^ { t } } ^ { t } + \alpha _ { 1 } W _ { x ^ { t } , \hat { y } ^ { t } } ^ { t } } & { } & \\ { \mathbf { W } _ { x ^ { t } , \hat { y } ^ { t } } ^ { t + 1 / 2 } = W _ { x ^ { t } , \hat { y } ^ { t } } ^ { t } + \alpha _ { 2 } ; \quad \mathbf { W } _ { x ^ { t } } ^ { t + 1 } = \frac { \mathbf { W } _ { x ^ { t } } ^ { t + 1 / 2 } } { \Vert \mathbf { W } _ { x ^ { t } } ^ { t + 1 / 2 } \Vert _ { 2 } } } & { } & \\ { x ^ { t + 1 } \sim \mathrm { s o f t m a x } ( \mathbf { g } ^ { t + 1 } ) } & { } & \\ { y ^ { t + 1 } \sim \mathrm { s o f t m a x } ( \mathbf { W } _ { x ^ { t + 1 } } ^ { t + 1 } ) } & { } & \end{array}
387
+ $$
388
+
389
+ Where $\hat { y } ^ { t }$ is the top article as chosen by the recommender, and $\alpha _ { 1 }$ , $\alpha _ { 2 }$ represent the rate of covariate and concept shift (respectively). The update for $\mathbf { W } ^ { t + 1 }$ merely increases the interest of user type $x ^ { t }$ in article type $\hat { y } ^ { t }$ , then normalizes the interests for that user type.
390
+
391
+ # 9.2.2 REPRODUCIBILITY DETAILS
392
+
393
+ For these experiments, the recommendation system is a ReLU-MLP with 1 hidden layer of 100 units, trained via supervised learning with SGD (learning rate $= 0 . 0 1 $ ) to predict which article a user will select. Actions are sampled from the MLP’s predictive distribution. We apply PBT without any hyperparameter selection (this amounts to just doing the EXPLOIT step), and an interval of 10, selecting on accuracy. We use a population of 20 learners (whether applying PBT or not), and match random seeds for the trials with and without PBT. We initialize $\mathbf { g } ^ { 1 }$ and $\dot { \mathbf { W } } ^ { 1 }$ to be the same across the 20 copies of the environment (i.e. the learners start with the same user population), but these values diverge throughout learning. For the environment, we set the number of user and article types both to 10. Initial user loyalties are randomly sampled from $\mathcal { N } ( 0 , 0 . 0 3 )$ , $\alpha _ { 1 } = 0 . 0 3$ , and $\alpha _ { 2 } = 0 . 0 0 3$ .
394
+
395
+ # 9.2.3 DETAILS OF EVALUATION
396
+
397
+ We measure concept shift (change in $P ( \boldsymbol { y } | \mathbf { x } ) .$ ) as the cosine distance between each user types’ initial and current interest vectors. And we measure covariate shift (change in $P ( \mathbf { x } ) )$ ) as the KL-divergence between the current and initial user distributions, parametrized by $\mathbf { g } ^ { 1 }$ and $\mathbf { g } ^ { t }$ , respectively. Results are presented in 7 (main text). In Figure 12, we additionally plot concept shift and covariate shift as a function of accuracy. We observe that for both types of ADS, at low levels of accuracy PBT actually causes less shift than occur in baseline agents; HI-ADS are only observed for accuracies above $60 \%$ . This suggests that only relatively strong performers are able to pick up on the HI-ADS revealed by PBT (Fig. 12).
398
+
399
+ ![](images/4ee83ea25b84d00e9bd2c93c72bcfe37100fc4c406703659c71aeb8e4ba6b65a.jpg)
400
+ Figure 12: Amount of auto-induced covariate shift (left) and auto-induced concept shift (right) as a function of performance (accuracy) averaged over all trials, learners, and time-steps. Only relatively strong learners (those which achieve accuracy $> 6 0 \%$ ) exhibit HI-ADS.
401
+
402
+ # 9.2.4 CONTEXT SWAPPING IN CONTENT RECOMMENDATION
403
+
404
+ We believe context swapping is not appropriate for the content recommendation environment, since when the environments diverge, optimal behavior may differ across environments. Nevertheless, we ran experiments with it for completeness. The main effect appears to be to hamper learning when PBT is not used, see Figure 13. Notably, it does not appear to significantly influence the rate or extent of ADS when combined with PBT.
405
+
406
+ # 9.2.5 EXPLORATION OF ENVIRONMENT PARAMETERS
407
+
408
+ In Figure 14, we examine the effect of the rate-of-change parameters $( \alpha _ { 1 } , \alpha _ { 2 } )$ of the content recommendation environment on the results provided in the paper. As noted there, our results are qualitatively consistent so long as (1) the initial user distribution is approximately uniform, and (2) the covariate shift rate $( \alpha _ { 1 } )$ is faster than the concept shift rate $\left( \alpha _ { 2 } \right)$ . These distributions are updated by different mechanisms, and are not directly comparable. Concept shift changes the task more radically, requiring a learner to change its predictions, rather than just become accurate on a wider range of inputs. We conjecture that changes in $P ( \boldsymbol { y } | \boldsymbol { x } )$ must therefore be kept smooth enough for the outer loop to have pressure to capitalize on HI-ADS.
409
+
410
+ ![](images/32bff10367ed93273e67c56861072a16c782eb88536e394129f2eaa0da72bbf8.jpg)
411
+ Figure 13: Context swapping doesn’t have the desired effect in the content recommendation environment.
412
+
413
+ ![](images/a89f27f3d6a426966da5d92bf05f995060ebcc886850b49f7d5327641103133d.jpg)
414
+ Figure 14: Content recommendation results for different values of $\alpha _ { 1 } , \alpha _ { 2 }$
415
+
416
+ # 10 OFFLINE Q-LEARNING CAN REVEAL INCENTIVES FOR ADS
417
+
418
+ First, recall that this unit test is a POMDP, and the state is not observed. Since there are only 2 possible actions, a policy is defined by a single parameter $\theta = p ( { \mathrm { c o o p e r a t e } } )$ . Now, the state distribution is $P ( s = { \mathrm { c o o p e r a t e } } ) = \theta$ (ignoring the first state, which is appropriate in the limit of infinite data). More specifically, the probability of each state-action combination are as follows:
419
+
420
+ Suppose we have a dataset of $N$ examples generated by following a fixed policy.
421
+
422
+ $$
423
+ \begin{array} { r l } & { Q ( C ) = \frac { | s = C , a = C | R ( s = C , a = C ) + | s = D , a = C | R ( s = D , a = C ) } { | a = C | } } \\ & { \quad \quad = \frac { N P ( s = C , a = C ) R ( s = C , a = C ) + N P ( s = D , a = C ) R ( s = D , a = C ) } { N P ( a = C ) } } \\ & { \quad \quad = \frac { P ( s = C , a = C ) R ( s = C , a = C ) + P ( s = D , a = C ) R ( s = D , a = C ) } { P ( a = C ) } } \\ & { \quad \quad = \frac { \theta ^ { 2 } R ( s = C , a = C ) + \theta ( 1 - \theta ) R ( s = D , a = C ) } { \theta } } \\ & { \quad \quad = \theta R ( s = C , a = C ) + ( 1 - \theta ) R ( s = D , a = C ) } \\ & { \quad \quad = \theta ( 0 ) + ( 1 - \theta ) ( - 1 ) } \\ & { \quad \quad = \theta - 1 } \end{array}
424
+ $$
425
+
426
+ $$
427
+ \begin{array} { l } { Q ( D ) = \frac { \left| s = C , a = D \right| R \left( s = C , a = D \right) + \left| s = D , a = D \right| R \left( s = D , a = D \right) } { \left| a = D \right| } } \\ { \ = \frac { P \left( s = C , a = D \right) R \left( s = C , a = D \right) + P \left( s = D , a = D \right) R \left( s = D , a = D \right) } { P \left( a = D \right) } } \\ { \ = P ( s = C ) R ( s = C , a = D ) + P ( s = D ) R ( s = D , a = D ) } \\ { \ = \theta ( 1 / 2 ) + ( 1 - \theta ) ( - 1 / 2 ) } \\ { \ = 1 / 2 ( 2 \theta - 1 ) } \\ { \ = \theta - 1 / 2 } \end{array}
428
+ $$
429
+
430
+ So we see that $Q ( D ) > Q ( C )$ , regardless of $\theta$ .
431
+
432
+ Now, suppose instead that we have $N$ examples from each of 2 different policies (given by parameters $\theta _ { 1 }$ and $\theta _ { 2 }$ ) operating in different environments. Intuitively, this sort of data might arise in practice from “A/B testing”, where 2 different users have been assigned to 2 different policies in order to compare the policies’ performance. We now use $_ { D C }$ to represent $s = D , a = C$ , etc.
433
+
434
+ $$
435
+ \begin{array} { r l } & { Q ^ { \theta _ { 1 } , \theta _ { 2 } } ( C ) = \frac { | C C | R ( C C ) + | D C | | R ( U C ) } { | C | } } \\ & { \quad \quad \quad = \frac { N \left( P ^ { \theta _ { 1 } } ( C C ) + P ^ { \theta _ { 2 } } ( C C ) \right) R ( C C ) + N ( P ^ { \theta _ { 1 } } ( D C ) + P ^ { \theta _ { 2 } } ( D C ) ) R ( D C ) } { N \left( P ^ { \theta _ { 1 } } ( C ) + P ^ { \theta _ { 2 } } ( C ) \right) } } \\ & { \quad \quad \quad = \frac { ( P ^ { \theta _ { 1 } } ( C C ) + P ^ { \theta _ { 2 } } ( C C ) ) I ( C C ) C + ( P ^ { \theta _ { 1 } } ( D C ) + P ^ { \theta _ { 2 } } ( D C ) ) R ( D C ) } { ( F ^ { \theta _ { 1 } } ( C ) + P ^ { \theta _ { 2 } } ( C ) ) } } \\ & { \quad \quad \quad = \frac { ( \theta _ { 1 } ^ { 2 } + \theta _ { 2 } ^ { 2 } ) R ( C C ) + ( \theta _ { 1 } ( 1 - \theta _ { 1 } ) + \theta _ { 2 } ( 1 - \theta _ { 2 } ) ) R ( D C ) } { \theta _ { 1 } + \theta _ { 2 } } } \\ & { \quad \quad \quad = - \frac { \theta _ { 1 } ( 1 - \theta _ { 1 } ) + \theta _ { 2 } ( 1 - \theta _ { 2 } ) } { \theta _ { 1 } + \theta _ { 2 } } } \\ & { \quad \quad \quad = \frac { \theta _ { 1 } ^ { 2 } - \theta _ { 1 } + \theta _ { 2 } ^ { 2 } - \theta _ { 2 } } { \theta _ { 1 } + \theta _ { 2 } } } \\ & { \quad \quad \quad = \frac { \theta _ { 1 } ^ { 2 } - \theta _ { 1 } + \theta _ { 2 } ^ { 2 } - \theta _ { 2 } } { \theta _ { 1 } + \theta _ { 2 } } } \\ & { \quad \quad \quad = \frac { \theta _ { 1 } ^ { 2 } - \theta _ { 1 } + \theta _ { 2 } ^ { 2 } - \theta _ { 2 } } { \theta _ { 1 } + \theta _ { 2 } } } \end{array}
436
+ $$
437
+
438
+ $$
439
+ \begin{array} { l } { { Q ^ { \theta _ { 1 } , \theta _ { 2 } } ( D ) = \frac { \left| C D \right| R \left( C D \right) + \left| D D \right| R \left( D D \right) } { \left| D \right| } } } \\ { { \ = \frac { \left( P ^ { \theta _ { 1 } } \left( C D \right) + P ^ { \theta _ { 2 } } \left( C D \right) \right) R \left( C D \right) + \left( P ^ { \theta _ { 1 } } \left( D D \right) + P ^ { \theta _ { 2 } } \left( D D \right) \right) R \left( D D \right) } { \left( P ^ { \theta _ { 1 } } \left( D \right) + P ^ { \theta _ { 2 } } \left( D \right) \right) } } } \\ { { \ = \frac { 1 / 2 \left( \theta _ { 1 } \left( 1 - \theta _ { 1 } \right) + \theta _ { 2 } \left( 1 - \theta _ { 2 } \right) \right) - 1 / 2 \left( ( 1 - \theta _ { 1 } ) ^ { 2 } + ( 1 - \theta _ { 2 } ) ^ { 2 } \right) } { 2 - \theta _ { 1 } - \theta _ { 2 } } } } \\ { { \ = \frac { \left( 2 \theta _ { 1 } - 1 \right) \left( 1 - \theta _ { 1 } \right) + \left( 2 \theta _ { 2 } - 1 \right) \left( 1 - \theta _ { 2 } \right) } { 4 - 2 \theta _ { 1 } - 2 \theta _ { 2 } } } } \end{array}
440
+ $$
441
+
442
+ Now, in Figure 15 we see that $Q ( C ) > Q ( D )$ when one of the policies cooperates with high probability, and the other defects with high probability. Intuitively, the result of pooling data from 2 such policies is very similar to collecting data from an $\epsilon$ -greedy policy trained online (as in Figure 6).
443
+
444
+ ![](images/f8cf957c6b390dfb762d079853f1b8f334d627fe895c972607d8fe3c71e3938d.jpg)
445
+ Figure 15: Offline Q-learning can also reveal HI-ADS, when pooling data from different (policy, environment) pairs. Yellow regions represent policy pairs for which $\mathbf { \bar { Q } } ( C ) > Q ( D )$ , resulting in non-myopic behavior.
md/train/AHm3dbp7D1D/AHm3dbp7D1D.md ADDED
@@ -0,0 +1,525 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SEED: SELF-SUPERVISED DISTILLATION FOR VISUAL REPRESENTATION
2
+
3
+ Zhiyuan Fang† , Jianfeng Wang‡, Lijuan Wang‡, Lei Zhang‡, Yezhou Yang†, Zicheng Liu‡
4
+
5
+ †Arizona State University, ‡Microsoft Corporation {zy.fang, yz.yang}@asu.edu {jianfw, lijuanw, leizhang, zliu}@microsoft.com
6
+
7
+ # ABSTRACT
8
+
9
+ This paper is concerned with self-supervised learning for small models. The problem is motivated by our empirical studies that while the widely used contrastive self-supervised learning method has shown great progress on large model training, it does not work well for small models. To address this problem, we propose a new learning paradigm, named SElf-SupErvised Distillation (SEED), where we leverage a larger network (as Teacher) to transfer its representational knowledge into a smaller architecture (as Student) in a self-supervised fashion. Instead of directly learning from unlabeled data, we train a student encoder to mimic the similarity score distribution inferred by a teacher over a set of instances. We show that SEED dramatically boosts the performance of small networks on downstream tasks. Compared with self-supervised baselines, SEED improves the top-1 accuracy from $4 2 . 2 \%$ to $6 7 . 6 \%$ on EfficientNet-B0 and from $3 6 . 3 \%$ to $6 8 . 2 \%$ on MobileNetV3-Large on the ImageNet-1k dataset.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ The burgeoning studies and success on self-supervised learning (SSL) for visual representation are mainly marked by its extraordinary potency of learning from unlabeled data at scale. Accompanying with the SSL is its phenomenal benefit of obtaining task-agnostic representations while allowing the training to dispense with prohibitively expensive data labeling. Major ramifications of visual SSL include pretext tasks (Noroozi & Favaro, 2016; Zhang et al., 2016; Gidaris et al., 2018; Zhang et al., 2019; Feng et al., 2019), contrastive representation learning (Wu et al., 2018; He et al., 2020; Chen et al., 2020a), online/offline clustering (Yang et al., 2016; Caron et al., 2018; Li et al., 2020; Caron et al., 2020; Grill et al., 2020), etc. Among them, several recent works (He et al., 2020; Chen et al., 2020a; Caron et al., 2020) have achieved comparable or even better accuracy than the supervised pre-training when transferring to downstream tasks, e.g. semi-supervised classification, object detection.
14
+
15
+ The aforementioned top-performing SSL algorithms all involve large networks (e.g., ResNet-50 (He et al., 2016) or larger), with, however, little attention on small networks. Empirically, we find that existing techniques like contrastive learning do not work well on small networks. For instance, the linear probe top-1 accuracy on ImageNet using MoCo-V2 (Chen et al., 2020c) is only $3 6 . 3 \%$ with MobileNetV3-Large (see Figure 1), which is much lower compared with its supervised training accuracy
16
+
17
+ ![](images/d4fb00f69f184e9fccdf211a9f298a6ff3e7571f5dfb94ff7b3d5393734ffc54.jpg)
18
+ Figure 1: SEED vs. MoCo-V2 (Chen et al., 2020c)) on ImageNet-1K linear probe accuracy. The vertical axis is the top-1 accuracy and the horizontal axis is the number of learnable parameters for different network architectures. Directly applying self-supervised contrastive learning (MoCo-V2) does not work well for smaller architectures, while our method (SEED) leads to dramatic performance boost. Details of the setting can be found in Section 4.
19
+
20
+ $7 5 . 2 \%$ (Howard et al., 2019). For EfficientNet-B0, the accuracy is $4 2 . 2 \%$ compared with its supervised training accuracy $7 7 . 1 \%$ (Tan & Le, 2019). We conjecture that this is because smaller models with fewer parameters cannot effectively learn instance level discriminative representation with large amount of data.
21
+
22
+ To address this challenge, we inject knowledge distillation (KD) (Bucilua et al. ˇ , 2006; Hinton et al., 2015) into self-supervised learning and propose self-supervised distillation (dubbed as SEED) as a new learning paradigm. That is, train the larger, and distill to the smaller both in self-supervised manner. Instead of directly conducting self-supervised training on a smaller model, SEED first trains a large model (as the teacher) in a self-supervised way, and then distills the knowledge to the smaller model (as the student). Note that the conventional distillation is for supervised learning, while the distillation here is in the self-supervised setting without any labeled data. Supervised distillation can be formulated as training a student to mimic the probability mass function over classes predicted by a teacher model. In unsupervised knowledge distillation setting, however, the distribution over classes is not directly attainable. Therefore, we propose a simple yet effective self-supervised distillation method. Similar to (He et al., 2020; Wu et al., 2018), we maintain a queue of data samples. Given an instance, we first use the teacher network to obtain its similarity scores with all the data samples in the queue as well as the instance itself. Then the student encoder is trained to mimic the similarity score distribution inferred by the teacher over these data samples.
23
+
24
+ The simplicity and flexibility that SEED brings are self-evident. 1) It does not require any clustering/prototypical computing procedure to retrieve the pseudo-labels or latent classes. 2) The teacher model can be pre-trained with any advanced SSL approach, e.g., MoCo-V2 (Chen et al., 2020c), SimCLR (Chen et al., 2020a), SWAV (Caron et al., 2020). 3) The knowledge can be distilled to any target small networks (either shallower, thinner, or totally different architectures).
25
+
26
+ To demonstrate the effectiveness, we comprehensively evaluate the learned representations on series of downstream tasks, e.g., fully/semi-supervised classification, object detection, and also assess the transferability to other domains. For example, on ImageNet-1k dataset, SEED improves the linear probe accuracy of EfficientNet-B0 from $4 2 . 2 \%$ to $6 7 . 6 \%$ (a gain over $2 5 \%$ ), and MobileNet-V3 from $3 6 . 3 \%$ to $6 8 . 2 \%$ (a gain over $3 1 \%$ ) compared to MoCo-V2 baselines, as shown in Figure 1 and Section 4.
27
+
28
+ Our contributions can be summarized as follows:
29
+
30
+ • We are the first to address the problem of self-supervised visual representation learning for small models. We propose a self-supervised distillation (SEED) technique to transfer knowledge from a large model to a small model without any labeled data. With the proposed distillation technique (SEED), we significantly improve the state-of-theart SSL performance on small models.
31
+ • We exhaustively compare a variety of distillation strategies to show the validity of SEED under multiple settings.
32
+
33
+ # 2 RELATED WORK
34
+
35
+ Among the recent literature in self-supervised learning, contrastive based approaches show prominent results on downstream tasks. Majority of the techniques along this direction are stemming from noise-contrastive estimation (Gutmann & Hyvärinen, 2010) where the latent distribution is estimated by contrasting with randomly or artificially generated noises. Oord et al. (2018) first proposed Info-NCE to learn image representations by predicting the future using an auto-regressive model for unsupervised learning. Follow-up works include improving the efficiency (Hénaff et al., 2019), and using multi-view as positive samples (Tian et al., 2019b). As these approaches can only have the access to limited negative instances, Wu et al. (2018) designed a memory-bank to store the previously seen random representations as negative samples, and treat each of them as independent categories (instance discrimination). However, this approach also comes with a deficiency that the previously stored vectors are inconsistent with the recently computed representations during the earlier stage of pre-training. Chen et al. (2020a) mitigate this issue by sampling negative samples from a large batch. Concurrently, He et al. (2020) improve the memory-bank based method and propose to use the momentum updated encoder for the remission of representation inconsistency. Other techniques include Misra & Maaten (2020) that combines the pretext-invariant objective loss with contrastive learning, and Wang & Isola (2020) that decomposes contrastive loss into alignment and uniformity objectiveness.
36
+
37
+ Knowledge distillation (Hinton et al., 2015) aims to transfer knowledge from a cumbersome model to a smaller one without losing too much generalization power, which is also well investigated in model compression (Bucilua et al. ˇ , 2006). Instead of mimicking the teacher’s output logit, attention transfer (Zagoruyko & Komodakis, 2016) formulates knowledge distillation on attention maps. Similarly, works in (Ahn et al., 2019; Yim et al., 2017; Koratana et al., 2019; Huang & Wang, 2017) have utilized different learning objectives including consistency on feature maps, consistency on probability mass function, and maximizing the mutual information. CRD (Tian et al., 2019a), which is derived from CMC (Tian et al., 2019b), optimizes the student network by a similar objective to Oord et al. (2018) using a derived lower bound on mutual information. However, the aforementioned efforts all focus on task-specific distillation (e.g., image classification) during the fine-tuning phase rather than a task-agnostic distillation in the pre-training phase for the representation learning. Several works on natural language pre-training proposed to leverage knowledge distillation for a smaller yet stronger small models. For instances, DistillBert (Sanh et al., 2019), TinyBert (Jiao et al., 2019), and MobileBert (Sun et al., 2020), have used knowledge distillation for model compression and shown their validity on multiple downstream tasks. Similar works also emphasize the value of smaller and faster models for language representation learning by leveraging knowledge distillation (Turc et al., 2019; Sun et al., 2019). These works all demonstrate the effectiveness of knowledge distillation for language representation learning in small models, while are not extended to the pre-training for visual representations. Notably, a recent concurrent work CompRess (Abbasi Koohpayegani et al., 2020) also point out the importance to develop better SSL method for smaller models. SEED closely relates to the above techniques but aims to facilitate visual representation learning during pre-training phase using distillation technique for small models, which as far as we know has not yet been investigated.
38
+
39
+ # 3 METHOD
40
+
41
+ # 3.1 PRELIMINARY ON KNOWLEDGE DISTILLATION
42
+
43
+ Knowledge distillation (Hinton et al., 2015; Bucilua et al.ˇ , 2006) is an effective technique to transfer knowledge from a strong teacher network to a target student network. The training task can be generalized as the following formulation:
44
+
45
+ $$
46
+ \hat { \theta } _ { S } = \underset { \theta _ { S } } { \arg \operatorname* { m i n } } \sum _ { i } ^ { N } \mathcal { L } _ { \mathrm { s u p } } ( \mathbf { x } _ { i } , \theta _ { S } , y _ { i } ) + \mathcal { L } _ { \mathrm { d i s t i l l } } ( \mathbf { x } _ { i } , \theta _ { S } , \theta _ { T } ) ,
47
+ $$
48
+
49
+ where $\mathbf { x } _ { i }$ is an image, $y _ { i }$ is the corresponding annotation, $\theta _ { S }$ is the parameter set for the student network, and $\theta _ { T }$ is the set for the teacher network. The loss $\mathcal { L } _ { \mathrm { s u p } }$ is the alignment error between the network prediction and the annotation. For example in image classification task (Mishra & Marr, 2017; Shen & Savvides, 2020; Polino et al., 2018; Cho & Hariharan, 2019), it is normally a cross entropy loss. For object detection (Liu et al., 2019; Chen et al., 2017), it includes bounding box regression as well. The loss of ${ \mathcal { L } } _ { \mathrm { d i s t i l l } }$ is the mimic error of the student network towards a pre-trained teacher network. For example in (Hinton et al., 2015), the teacher signal comes from the softmax prediction of multiple large-scale networks and the loss is measured by the Kullback–Leibler divergence. In Romero et al. (2014), the task is to align the intermediate feature map values and to minimize the squared $l 2$ distance. The effectiveness has been well demonstrated in the supervised setting with labeled data, but remains unknown for the unsupervised setting, which is our focus.
50
+
51
+ # 3.2 SELF-SUPERVISED DISTILLATION FOR VISUAL REPRESENTATION
52
+
53
+ Different from supervised distillation, SEED aims to transfer knowledge from a large model to a small model without requiring labeled data, so that the learned representations in small model can be used for downstream tasks. Inspired by contrastive SSL, we formulate a simple approach for the distillation on the basis of instance similarity distribution over a contrastive instance queue. Similar to He et al. (2020), we maintain an instance queue for storing data samples’ encoding output from the teacher. Given a new sample, we compute its similarity scores with all the samples in the queue using both the teacher and the student models. We require that the similarity score distribution computed by the student matches with that computed by the teacher, which is formulated as minimizing the cross entropy between the student and the teacher’s similarity score distributions (as illustrated in Figure 2).
54
+
55
+ ![](images/2f2a03a1e9389d9452c8beee5f2f9f477f5576361541704a7434d89396409316.jpg)
56
+ Figure 2: Illustration of our self-supervised distillation pipeline. The teacher encoder is pre-trained by SSL and kept frozen during the distillation. The student encoder is trained by minimizing the cross entropy of probabilities from teacher & student for an augmented view of an image, computed over a dynamically maintained queue.
57
+
58
+ Specifically, for a randomly augmented view $\mathbf { x } _ { i }$ of an image, it is first mapped and normalized into feature vector representations $\mathbf { z } _ { i } ^ { T } = f _ { \theta } ^ { T } ( \mathbf { x } _ { i } ) / \vert \vert f _ { \theta } ^ { T } ( \mathbf { x } _ { i } ) \vert \vert _ { 2 }$ , and $\mathbf { z } _ { i } ^ { S } = f _ { \theta } ^ { S } ( \mathbf { \bar { x } } _ { i } ^ { \star } ) / \vert \vert f _ { \theta } ^ { S } ( \mathbf { x } _ { i } ) \vert \vert _ { 2 }$ , where $\mathbf { z } _ { i } ^ { T } , \mathbf { z } _ { i } ^ { S } \in \mathbb { R } ^ { D }$ , and $f _ { \theta } ^ { T }$ and $f _ { \theta } ^ { S }$ θ θ θ θdenote the teacher and student encoders, respectively. Let $\mathbf { D } =$ $[ \mathbf { d } _ { 1 } . . . \mathbf { d } _ { K } ]$ denote the instance queue where $K$ is the queue length and ${ \bf d } _ { j }$ is the feature vector obtained from the teacher encoder. Similar to the contrastive learning framework, $\mathbf { D }$ is progressively updated under the “first-in first-out” strategy as distillation proceeds. That is, we en-queue the visual features of the current batch inferred by the teacher and de-queue the earliest seen samples at the end of iteration. Note that the maintained samples in queue $\mathbf { D }$ are mostly random and irrelevant to the target instance $\mathbf { x } _ { i }$ . Minimizing the cross entropy between the similarity score distribution computed by the student and teacher based on $\mathbf { D }$ softly contrasts $\mathbf { x } _ { i }$ with randomly selected samples, without directly aligning with the teacher encoder. To address this problem, we add the teacher’s embedding $( \mathbf { z } _ { i } ^ { T } )$ into the queue and form $\mathbf { D } ^ { + } = [ \mathbf { d } _ { 1 } . . . \mathbf { d } _ { K } , \mathbf { d } _ { K + 1 } ]$ with $\mathbf { d } _ { K + 1 } = \mathbf { z } _ { i } ^ { T }$ .
59
+
60
+ Let $\mathbf { p } ^ { T } ( \mathbf { x } _ { i } ; \boldsymbol { \theta } _ { T } ; \mathbf { D } ^ { + } )$ denote the similarity score between the extracted teacher feature $\mathbf { z } _ { i } ^ { T }$ and ${ \bf d } _ { j }$ ’s $( j = 1 , . . . , K + 1 )$ computed by the teacher model. $\mathbf { p } ^ { T } ( \mathbf { x } _ { i } ; \boldsymbol { \theta } _ { T } ; \mathbf { D } ^ { + } )$ is defined as
61
+
62
+ $$
63
+ \mathbf { p } ^ { T } ( \mathbf { x } _ { i } ; \theta _ { T } , \mathbf { D } ^ { + } ) = \left[ p _ { 1 } ^ { T } \dots p _ { K + 1 } ^ { T } \right] , \qquad p _ { j } ^ { T } = \frac { \exp ( \mathbf { z } _ { i } ^ { T } \cdot \mathbf { d } _ { j } / \tau ^ { T } ) } { \sum _ { \mathbf { d } \sim \mathbf { D } ^ { + } } \exp ( \mathbf { z } _ { i } ^ { T } \cdot \mathbf { d } / \tau ^ { T } ) } ,
64
+ $$
65
+
66
+ and $\tau ^ { T }$ is a temperature parameter for the teacher. Note, we use $( ) ^ { T }$ to represent the feature from the teacher network and use $( \cdot )$ to represent the inner product between two features.
67
+
68
+ Similarly let $\mathbf { p } ^ { S } ( x _ { i } ; \theta _ { S } , \mathbf { D } ^ { + } )$ denote the similarity score computed by the student model, which is defined as
69
+
70
+ $$
71
+ \mathbf { p } ^ { S } ( \mathbf { x } _ { i } ; \theta _ { S } , \mathbf { D } ^ { + } ) = \left[ p _ { 1 } ^ { S } \dots p _ { K + 1 } ^ { S } \right] , \qquad { \mathrm { w h e r e ~ } } p _ { j } ^ { S } = { \frac { \exp ( \mathbf { z } _ { i } ^ { S } \cdot \mathbf { d } _ { j } / \tau ^ { S } ) } { \sum _ { \mathbf { d } \sim \mathbf { D } ^ { + } } \exp ( \mathbf { z } _ { i } ^ { S } \cdot \mathbf { d } / \tau ^ { S } ) } } ,
72
+ $$
73
+
74
+ and $\tau ^ { S }$ is a temperature parameter for the student.
75
+
76
+ Our self-supervised distillation can be formulated as minimizing the cross entropy between the similarity scores of the teacher, $\mathbf { p } ^ { T } ( \mathbf { x } _ { i } ; \theta _ { T } , \mathbf { D } ^ { + } )$ , and the student, $\mathbf { p } ^ { S } ( \mathbf { x } _ { i } ; \boldsymbol { \theta } _ { S } , \mathbf { D } ^ { \dagger } )$ , over all the instances $\mathbf { x } _ { i }$ , that is,
77
+
78
+ $$
79
+ \begin{array} { r l } & { \boldsymbol { \hat { \theta } _ { S } } = \underset { \boldsymbol { \theta _ { S } } } { \arg \operatorname* { m i n } } \sum _ { i } ^ { N } - \mathbf { p } ^ { T } ( \mathbf { x } _ { i } ; \boldsymbol { \theta _ { T } } , \mathbf { D } ^ { + } ) \cdot \log \mathbf { p } ^ { S } ( \mathbf { x } _ { i } ; \boldsymbol { \theta _ { S } } , \mathbf { D } ^ { + } ) } \\ & { \quad = \underset { \boldsymbol { \theta _ { S } } } { \arg \operatorname* { m i n } } \sum _ { i } ^ { N } \sum _ { j } ^ { K + 1 } - \frac { \exp \left( \mathbf { z } _ { i } ^ { T } \cdot \mathbf { d } _ { j } / \tau ^ { T } \right) } { \sum _ { \mathbf { d } \sim \mathbf { D } ^ { + } } \exp \left( \mathbf { z } _ { i } ^ { T } \cdot \mathbf { d } / \tau ^ { T } \right) } \cdot \log \frac { \exp \left( \mathbf { z } _ { i } ^ { S } \cdot \mathbf { d } _ { j } / \tau ^ { S } \right) } { \sum _ { \mathbf { d } \sim \mathbf { D } ^ { + } } \exp \left( \mathbf { z } _ { i } ^ { S } \cdot \mathbf { d } / \tau ^ { S } \right) } . } \end{array}
80
+ $$
81
+
82
+ Since the teacher network is pre-trained and frozen, the queued features are consistent during training w.r.t. the student network. The higher the value of $p _ { j } ^ { I ^ { \prime } }$ is, the larger weight will be laid on $p _ { j } ^ { S }$ . Due to the l2 normalization, similarity score between ${ \mathbf z } _ { i } ^ { T }$ and ${ \bf d } _ { K + 1 }$ remains constant 1 before softmax normalization, which is the largest among $p _ { j } ^ { T }$ . Thus, the weight for $p _ { K + 1 } ^ { S }$ is the largest and can be adjusted solely by tuning the value of $\tau ^ { T }$ . By minimizing the loss, the feature of $\mathbf { z } _ { i } ^ { S }$ can be aligned with ${ \mathbf z } _ { i } ^ { T }$ and meanwhile contrasts with other unrelated image features in $\mathbf { D }$ . We further discuss the relation of these two goals with our learning objective in Appendix A.5.
83
+
84
+ Relations with Info-NCE loss. When $\tau ^ { T } \to 0$ , the softmax function for $\mathbf { p } ^ { T }$ smoothly approaches to a one-hot vector, where $p _ { K + 1 } ^ { T }$ equals 1 and all others 0. In this extreme case, the loss becomes
85
+
86
+ $$
87
+ \mathcal { L } _ { N C E } = \sum _ { i } ^ { N } - \log \frac { \exp ( \mathbf { z } _ { i } ^ { T } \cdot \mathbf { z } _ { i } ^ { S } / \tau ) } { \sum _ { \mathbf { d } \sim \mathbf { D } ^ { + } } \exp ( \mathbf { z } _ { i } ^ { S } \cdot \mathbf { d } / \tau ) } ,
88
+ $$
89
+
90
+ which is similar to the widely-used Info-NCE loss (Oord et al., 2018) in contrastive-based SSL (see discussion in Appendix A.6.
91
+
92
+ # 4 EXPERIMENT
93
+
94
+ # 4.1 PRE-TRAINING
95
+
96
+ Self-Supervised Pre-training of Teacher Network. By default, we use MoCo-V2 (Chen et al., 2020c) to pre-train the teacher network. Following (Chen et al., 2020a), we use ResNet as the network backbone with different depths/widths and append a multi-layer-perceptron (MLP) layer (two linear layers and one ReLU (Nair & Hinton, 2010) activation layer in between) at the end of the encoder after average pooling. The dimension of the last feature dimension is 128. All teacher networks are pre-trained for 200 epochs due to the computational limitation unless explicitly specified. As our distillation is independent with the teacher pre-training algorithm, we also show results with other self-supervised pre-trained models for teacher network, e.g., SWAV (Caron et al., 2020), SimCLR (Chen et al., 2020a).
97
+
98
+ Self-Supervised Distillation on Student Network. We choose multiple smaller networks with fewer learnable parameters as the student network: MobileNet-v3-Large (Howard et al., 2017), EfficientNet-B0 (Tan & Le, 2019), and smaller ResNet with fewer layers (ResNet-18, 34). Similar to the pre-training for teacher network, we add one additional MLP layer on the basis of the student network. Our distillation is trained with a standard SGD optimizer with momentum 0.9 and a weight decay parameter of 1e-4 for 200 epochs. The initial learning rate is set as 0.03 and updated by a cosine decay scheduler (Nair & Hinton, 2010) with 5 warm-up epochs and batch size 256. In Eq. 4, the teacher temperature is set as $\tau ^ { T } = 0 . 0 1$ and the student temperature is $\tau ^ { S } = 0 . 2$ . The queue size of $K$ is 65,536. In the following subsections and appendix, we also show results with different hyper-parameter values, e.g., for $\tau ^ { T }$ and $K$ .
99
+
100
+ # 4.2 FINE-TUNING AND EVALUATION
101
+
102
+ In order to validate the effectiveness of self-supervised distillation, we choose to assess the performance of representations of the student encoder on several downstream tasks. We first report its performances of linear evaluation and semi-supervised linear evaluation on the ImageNet ILSVRC2012 (Deng et al., 2009) dataset. To measure the feature transferability brought by distillation, we also conduct evaluations on other tasks, which include object detection and segmentation on the VOC07 (Everingham et al.) and MS-COCO (Lin et al., 2014) datasets. At the end, we compare the transferability of the features learned by distillation with ordinary self-supervised contrastive learning on the tasks of linear classification on datasets from different domains.
103
+
104
+ Linear and KNN Evaluation on ImageNet. We conduct the supervised linear classification on ImageNet-1K, which contains ${ \sim } 1 . 3 \mathbf { M }$ images for training, and 50,000 images for validation, spanning 1,000 categories. Following previous works in (He et al., 2020; Chen et al., 2020a), we train a single linear layer classifier on top of the frozen network encoder after self-supervised pretraining/distillation. SGD optimizer is used to train the linear classifier for 100 epochs with weight decay to be 0. The initial learning rate is set as 30 and is then reduced by a factor of 10 at 60 and 80 epochs (similar as in Tian et al. (2019a)). Notably, when training the linear classifier for MobileNet and EfficientNet, we reduce the initial learning rate to 3. The results are reported in terms of Top-1 and Top-5 accuracy. We also perform classification using $K$ -Nearest Neighbors (KNN) based on the learned 128d vector from the last MLP layer. The sample is classified by taking the most frequent label of its $K$ ( $K = 1 0$ ) nearest neighbors.
105
+
106
+ Table 1: ImageNet-1k test accuracy $( \% )$ using KNN and linear classification for multiple students and MoCov2 pre-trained deeper teacher architectures. $\pmb { \chi }$ denotes MoCo-V2 self-supervised learning baselines before distillation. \* indicates using a deeper teacher encoder pre-trained by SWAV, where additional small-patches are also utilized during distillation and trained for 800 epochs. $K$ denotes Top-1 accuracy using KNN. T-1 and T-5 denote Top-1 and Top-5 accuracy using linear evaluation. First column shows Top-1 Acc. of Teacher network. First row shows the supervised performances of student networks.
107
+
108
+ <table><tr><td rowspan="2">S T</td><td rowspan="2">T-1</td><td rowspan="2">K</td><td colspan="2">Eff-bo</td><td colspan="3">Eff-b1</td><td colspan="3">Mob-v3</td><td colspan="3">R-18</td><td colspan="3">R-34</td></tr><tr><td>T-1</td><td>T-5</td><td>K</td><td>T-1</td><td>T-5</td><td>K</td><td>T-1</td><td>T-5</td><td>K</td><td>T-1</td><td>T-5</td><td>K</td><td>T-1</td><td>T-5</td></tr><tr><td>Supervised Acc.</td><td></td><td></td><td>77.3</td><td></td><td></td><td>79.2</td><td></td><td></td><td>75.2</td><td></td><td></td><td>72.1</td><td></td><td></td><td>75.0</td><td></td></tr><tr><td>X</td><td></td><td>30.0</td><td>42.2</td><td></td><td>68.534.4</td><td>50.7</td><td>74.6</td><td>27.5</td><td>36.3</td><td>62.2</td><td>36.7</td><td>52.5</td><td>77.0</td><td>)41.5</td><td>57.4</td><td>81.6</td></tr><tr><td>R-50 △</td><td>67.4</td><td>46.0 +16.0</td><td>61.3 +19.1</td><td>82.7 +14.2</td><td>46.1 +16.1</td><td>61.4 +10.7</td><td>83.1 +8.8</td><td>44.8 +17.3</td><td>55.2 +18.9</td><td>80.3 +18.1</td><td>43.4 +6.7</td><td>57.9 +5.1</td><td>82.0 +4.8</td><td>45.2 +3.7</td><td>58.5 +1.1</td><td>82.6 +1.0</td></tr><tr><td>R-101 △</td><td>70.3</td><td>50.1 +20.1</td><td>63.0 +20.8</td><td>83.8 +15.3</td><td>50.3 +15.9</td><td>63.4 +12.7</td><td>84.6 +10.0</td><td>48.8 +21.3</td><td>59.9 +23.6</td><td>83.5 +21.3</td><td>48.6 +11.9</td><td>58.9 +6.4</td><td>82.5 +5.5</td><td>50.5 +9.0</td><td>61.6 +4.2</td><td>84.9 +3.3</td></tr><tr><td>R-152</td><td></td><td>50.7</td><td>65.3</td><td>86.0</td><td>52.4</td><td>67.3</td><td>86.9</td><td>49.5</td><td>61.4</td><td>84.6</td><td>49.1</td><td>59.5</td><td>83.3</td><td>51.4</td><td>62.7</td><td>85.8</td></tr><tr><td>△</td><td>74.2</td><td>+20.7</td><td>+23.1</td><td>+17.5</td><td>+18.0</td><td>+16.6</td><td>+12.3</td><td>+22.0</td><td>+25.1</td><td>+22.4</td><td>+12.4</td><td>+7.0</td><td>+6.3</td><td>+9.9</td><td>+5.3</td><td>+4.2</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><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><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>R50×2*</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>87.4</td><td>60.3</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>△</td><td>77.3</td><td>57.4 +27.4</td><td>67.6 +25.4</td><td>+18.9</td><td>+25.9</td><td>68.0 +17.3</td><td>87.6 +13.0</td><td>55.9 +18.9</td><td>68.2 +31.9</td><td>88.2 +26.0</td><td>55.3 +18.6</td><td>63.0 +10.5</td><td>84.9 +7.9</td><td>58.2 +16.7</td><td>65.7 +8.3</td><td>86.8 +5.2</td></tr></table>
109
+
110
+ ![](images/3623a3702ec553403c1eb676464c6cd00d584bc812cc122bd666f370eb648b7c.jpg)
111
+ Figure 3: ImageNet-1k Top-1 accuracy for semi-supervised evaluations using $1 \%$ (red line), $10 \%$ (blue line) of the annotations for linear fine-tuning, in comparison with the fully supervised (green line) linear evaluation baseline for SEED. For the points whose Teacher’s number of parameters is at 0, we show the semi-supervised linear evaluation results of MoCo-V2 without any distillation. The Student models tend to perform better on the semi-supervised tasks after distillation from larger Teachers.
112
+
113
+ Table 1 shows the results with various teacher networks and student networks. We list the baseline of contrastive self-supervised pre-training using MoCo-V2 (Chen et al., 2020c) in the first row for each student architecture. We can see clearly that smaller networks perform rather worse. For example, MobileNet-V3 can only reach $3 6 . 3 \%$ . This aligns well with previous conclusions from (Chen et al., 2020a;b) that bigger models are desired to perform better in contrastive-based self-supervised pretraining. We conjecture that this is mainly caused by the inability of smaller network to discriminate instances in a large-scale dataset. The results also clearly demonstrate that the distillation from a larger network helps boosting the performances of small networks, and show obvious improvement. For instance, with MoCo-V2 pre-trained ResNet-152 (for 400 epochs) as the teacher network, the Top-1 accuracy of MobileNet-V3-Large can be significantly improved from $3 6 . 3 \%$ to $6 1 . 4 \%$ . Furthermore, we use ResNet- $5 0 \times 2$ (provided in Caron et al. (2020)) as the teacher network and adopt the multi-crop trick (see A.2 for details). The accuracy can be further improved to $6 8 . 2 \%$ (last row of Table 1) for MobileNet-V3-Large with 800 epochs of distillation. We note that the gain benefited from distillation becomes more distinct on smaller architectures and we further study the effect of various teacher models in ablations.
114
+
115
+ Semi-Supervised Evaluation on ImageNet. Following (Oord et al., 2018; Kornblith et al., 2019; Kolesnikov et al., 2019), we evaluate the representation on the semi-supervised task, where a fixed $1 \%$ or $10 \%$ subsets of ImageNet training data (Chen et al., 2020a) are provided with the annotations. After the self-supervised learning with and without distillation, we also train a classifier on top of the representation. The results are shown in Figure 3, where the baseline without distillation is depicted when teacher parameters are 0. As we can see, the accuracy is also improved remarkably with SEED distillation, and a stronger teacher network with more parameters leads to a better performed student network.
116
+
117
+ Table 2: Object detection and instance segmentation results using contrastive self-supervised learning and SEED distillation using ResNet-18 as backbone: bounding-box AP $( \mathbf { A P } ^ { b b } )$ and mask AP $( \mathbf { A P } ^ { m k } )$ evaluated on VOC07-val and COCO testing split. More results on different backbones can be found in the Appendix. Subscript in green represents improvement is larger than 0.3.
118
+
119
+ <table><tr><td rowspan="2">S</td><td rowspan="2">T</td><td colspan="3">VOC Obj. Det.</td><td colspan="3">COCO Obj. Det.</td><td colspan="3">COCO Inst. Segm.</td></tr><tr><td>Apbb</td><td>AP</td><td>AP</td><td>Apbb</td><td>AP</td><td>APP</td><td>Apmk</td><td>AP</td><td>AP</td></tr><tr><td></td><td>X</td><td>46.1</td><td>74.5</td><td>48.6</td><td>35.0</td><td>53.9</td><td>37.7</td><td>31.0</td><td>51.1</td><td>33.1</td></tr><tr><td></td><td>R-50</td><td>46.1(0.0)</td><td>74.8(+0.3)</td><td>49.1(+0.5)</td><td>35.3(+0.3)</td><td>54.2(+0.3)</td><td>37.8(+0.1)</td><td>31.1(+0.1)</td><td>51.1(0.0)</td><td>33.2(+0.1)</td></tr><tr><td>R-18 R-101</td><td></td><td>46.8(+0.7)</td><td>75.8(+1.3)</td><td>49.3(+0.7)</td><td>35.3(+0.3)</td><td>54.3(+0.4)</td><td>37.9(+0.2)</td><td>31.3(+0.3)</td><td>51.3(+0.2)</td><td>33.4(+0.3)</td></tr><tr><td></td><td>R-152</td><td>46.8(+0.7)</td><td>75.9(+1.4)</td><td>50.2(+1.6)</td><td>35.4(+0.4)</td><td>54.4(+0.5)</td><td>38.0(+0.3)</td><td>31.3(+0.3)</td><td>51.4(+0.3)</td><td>33.4(+0.3)</td></tr></table>
120
+
121
+ ![](images/15d565abe6e76f1be7191527af52d1cfceecfa87f6083e78a4a48b0e6be4ff99.jpg)
122
+ Figure 4: ImageNet-1k Accuracy $( \% )$ of student network (EfficientNet-B0 and ResNet-18) transferred to other domains (CIFAR-10, CIFAR-100, SUN-397 datasets) with and without distillation from lager architectures (ResNet-50/101/152).
123
+
124
+ Transferring to Classification. To further study whether the improvement of the learned representations by distillation is confined to ImageNet, we evaluate on additional classification datasets to study the generalization and transferability of the feature representation. We strictly follow the linear evaluation and fine-tuning settings from (Kornblith et al., 2019; Chen et al., 2020a; Grill et al., 2020), that a linear layer is trained on the basis of frozen features. We report Top-1 Accuracy of models before and after distillation from various architectures on CIFAR-10, CIFAR-100 (Krizhevsky et al., 2009), SUN-397 (Xiao et al., 2010) datasets (see Figure 4). More details regarding pre-processing and training can be found in A.1.2. Notably, we observe that our distillation surpasses contrastive self-supervised pre-training consistently on all benchmarks, verifying the effectiveness of SEED. This also proves the generalization ability of the learned representations from distillation to a wide range of data domain and different classes.
125
+
126
+ Transferring to Detection and Segmentation. We conduct two downstream tasks here. The first is Faster R-CNN (Ren et al., 2015) model for object detection trained on VOC- $^ { 0 7 + 1 2 }$ train $^ +$ val set and evaluated on VOC-07 test split. The second is Mask R-CNN (He et al., 2017) model for the object detection and instance segmentation on COCO 2017 dataset (Lin et al., 2014). The pre-trained model serves as the initial weight and following He et al. (2020), we fine-tune all the layers of the model. More experiment settings can be found in A.2. The results are illustrated in Table 2. As we can see, on VOC, the distilled pre-trained model achieves a large improvement. With ResNet-152 as the teacher network, the Resnet18-based Faster R-CNN model shows $+ 0 . 7$ point improvement on AP, $+ 1 . 4$ improvement on $\mathrm { { A P } _ { 5 0 } }$ and $+ 1 . 6$ on $\mathsf { A P } _ { 7 5 }$ . On COCO, the improvement is relatively minor and the reason could be that COCO training set has ${ \sim } 1 1 8 \mathrm { k }$ training images while VOC has only ${ \sim } 1 6 . 5 \mathrm { k }$ training images. A larger training set with more fine-tuning iterations reduces the importance of the initial weights.
127
+
128
+ # 4.3 ABLATION STUDY
129
+
130
+ We now explore the effects of distillation using different Teacher architectures, Teacher Pre-training algorithms, various distillation strategies and hyper-parameters.
131
+
132
+ Table 3: ImageNet-1k Accuracy $( \% )$ of student network (ResNet-18) distilled from variants of selfsupervised ResNet-50. P-E/D-E represent the pretraining and distillation epochs. T./S.-Top represent testing accuracy of Teacher and Student. ∗ represents distillation using additional small patches. First row is the ResNet-18 SSL baseline using MoCo-v2 trained for 200 epochs.
133
+
134
+ <table><tr><td>Teacher</td><td></td><td>P-E D-E T.Top-1 S.Top-1 S.Top-5</td></tr><tr><td></td><td>X X</td><td>X 52.5 77.0</td></tr><tr><td>X</td><td>200</td><td></td></tr><tr><td>MoCo</td><td>200</td><td>60.6 52.1 77.0</td></tr><tr><td>SimCLR</td><td>200 200</td><td>65.6 57.5 81.7</td></tr><tr><td>MoCo-v2 200 800</td><td>200 67.4</td><td>57.9 82.0</td></tr><tr><td>SWAV 800</td><td>200 71.1</td><td>60.5 83.5</td></tr><tr><td></td><td>100 75.3</td><td>61.1 83.8</td></tr><tr><td>800</td><td>200 75.3</td><td>61.7 84.2</td></tr><tr><td>800</td><td>400 75.3</td><td>62.0 84.4</td></tr><tr><td>SWAV* 800</td><td>200 75.3</td><td>62.6 84.8</td></tr></table>
135
+
136
+ ![](images/8cecf45d517b8c5b96207f2fc90806edfe43935c7cfa9552a0ceb80d0db26208.jpg)
137
+ Figure 5: Accuracy $( \% )$ of student networks (EfficientNet-b0 and ResNet-18) on ImageNet distilled from wider MoCo-v2 pre-trained ResNet (ResNet-50/101/152×2).
138
+
139
+ Different Teacher Networks. Figure 5 summarizes the accuracy of ResNet-18 and EfficientNet-B0 distilled from wider and deeper ResNet architectures. We see clear performance improvement as depth and width of teacher network increase: compared to ResNet-50, deeper (ResNet-101) and wider (ResNet- ${ 5 0 \times 2 }$ ) substantially improve the accuracy. However, further architectural enlargement has relatively limited effects, and we suspect the accuracy might be limited by the student network capacity in this case.
140
+
141
+ Different Teacher Pre-training Algorithms. In Table 3, we show the Top-1 accuracy of ResNet-18 distilled from ResNet-50 with different pre-training algorithms, i.e., MoCo-V1 (He et al., 2020), MoCo-V2 (Chen et al., 2020c), SimCLR (Chen et al., 2020a), and SWAV (Caron et al., 2020)). Notably, the aforementioned methods all unanimously adopt contrastive-based pre-training except SWAV, which is based upon online clustering. We find that our SEED is agnostic to pre-training approaches, making it easy to use any self-supervised models (including clustering-based approach like SWAV) in self-supervised distillation. In addition, we observe that more training epochs for both teacher $S S L$ and distillation epochs can bring beneficial gain.
142
+
143
+ Other Distillation Strategies. We explore several alternative distillation strategies. l2-Distance: where the $l 2$ -distance of teacher & student’s embeddings are minimized, motivated by Romero et al. (2014). $K$ -Means: we exploit $K$ -Means clustering to assign a pseudo-label based on the teacher network’s representation. Online Clustering: we continuously update the clustering centers during distillation for pseudo-label generation. Binary Contrastive Loss: we adopt an Info-NCE alike loss for contrastive distillation (Tian et al., 2019a). We provide details for other strategies in A.4. Table 4 shows the results for each method on ResNet-18 (student) distilled from ResNet-50. From the results, the simple $l 2$ -distance minimizing approach can achieve a decent accuracy, which demonstrates the effectiveness of applying the distillation idea to the self-supervised learning. Beyond that, we study the effect of the original SSL (MoCo-V2) supervision as supplementary loss to SEED and find it does not bring additional benefits to distillation. We find close results from these two strategies (Top-1 linear Acc.), SEED achieves $5 7 . 9 \%$ , while $\mathbf { S E E D + M o C o - V } 2$ achieves $5 7 . 6 \%$ . This implies that the loss of SEED can to a large extent cover the original $S S L$ loss, and it is not necessary to conduct SSL any further during distillation. Meanwhile, our proposed SEED outperforms these alternatives with highest accuracy, which shows the superiority of aligning the student towards the teacher and contrasting with the irrelevant samples.
144
+
145
+ Other Hyper-Parameters. Table 5 summarizes the distillation performances on multiple datasets using different temperature $\tau ^ { T }$ . We observe a better performance when decreasing $\tau ^ { T }$ to 0.01 for ImageNet-1k and CIFAR-10 dataset, and to 1e-3 for CIFAR-100 datasets. When $\tau$ is large, the softmax-normalized similarity score of $p _ { j } ^ { T }$ between ${ \mathbf z } _ { i } ^ { T }$ and instance ${ \bf d } _ { j }$ in the queue $\mathbf { D } ^ { + }$ also becomes large, which means the student’s feature should be less discriminative with the features of other images to some extent. When $\tau ^ { T }$ is $_ 0$ , the teacher model will generate a one-hot vector, which only treats ${ \mathbf z } _ { i } ^ { T }$ as a positive instance and all others in the queue as negative. Thus, the best $\tau$ is a trade-off depending on the data distribution. We further compare effect of different hyper-parameters in A.8.
146
+
147
+ Table 4: Top-1/5 accuracy of linear classification results on ImageNet using different distillation strategies on ResNet-18 (student) and ResNet-50 (teacher) architectures.
148
+
149
+ <table><tr><td>Method</td><td colspan="2">Top-1 Acc. Top-5 Acc.</td></tr><tr><td>l2-Distance</td><td>55.3</td><td>80.3</td></tr><tr><td>K-Means</td><td>51.0</td><td>75.8</td></tr><tr><td>Online Clustering</td><td>56.4</td><td>81.2</td></tr><tr><td>Binary Contr. Loss</td><td>57.4</td><td>81.5</td></tr><tr><td>SEED +MoCo-V2</td><td>57.6</td><td>81.8</td></tr><tr><td>SEED</td><td>57.9</td><td>82.0</td></tr></table>
150
+
151
+ Table 5: Effect of $\tau ^ { T }$ for the distillation of ResNet-18 (student), ResNet-50 (teacher) on multiple datasets.
152
+
153
+ <table><tr><td rowspan="2">YT</td><td>ImageNet</td><td>CIFAR-10</td><td>CIFAR-100</td></tr><tr><td>Top-1 Top-5</td><td>Top-1</td><td>Top-1</td></tr><tr><td>0.3</td><td>54.8 80.0</td><td>78.7</td><td>46.6</td></tr><tr><td>0.1</td><td>54.9 80.1</td><td>83.0</td><td>50.1</td></tr><tr><td>0.05</td><td>56.5 81.3</td><td>84.4</td><td>56.2</td></tr><tr><td>0.01</td><td>57.9 82.0</td><td>87.5 </td><td>60.6</td></tr><tr><td>1e-3</td><td>57.6 81.8</td><td>86.9</td><td>60.8</td></tr></table>
154
+
155
+ # 5 CONCLUSIONS
156
+
157
+ Self-Supervised Learning is acknowledged for its remarkable ability in learning from unlabeled, and large scale data. However, a critical impedance for the SSL pre-training on smaller architecture comes from its low capacity of discriminating enormous number of instances. Instead of directly learning from unlabeled data, we proposed SEED as a novel self-supervised learning paradigm, which learns representation by self-supervised distillation from a bigger SSL pre-trained model. We show in extensive experiments that SEED effectively addresses the weakness of self-supervised learning for small models and achieves state-of-the-art results on various benchmarks of small architectures.
158
+
159
+ # REFERENCES
160
+
161
+ Soroush Abbasi Koohpayegani, Ajinkya Tejankar, and Hamed Pirsiavash. Compress: Self-supervised learning by compressing representations. Advances in Neural Information Processing Systems, 33, 2020.
162
+
163
+ Sungsoo Ahn, Shell Xu Hu, Andreas Damianou, Neil D Lawrence, and Zhenwen Dai. Variational information distillation for knowledge transfer. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 9163–9171, 2019.
164
+
165
+ 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, pp. 535–541, 2006.
166
+
167
+ Mathilde Caron, Piotr Bojanowski, Armand Joulin, and Matthijs Douze. Deep clustering for unsupervised learning of visual features. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 132–149, 2018.
168
+
169
+ Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. arXiv preprint arXiv:2006.09882, 2020.
170
+
171
+ Guobin Chen, Wongun Choi, Xiang Yu, Tony Han, and Manmohan Chandraker. Learning efficient object detection models with knowledge distillation. In Advances in Neural Information Processing Systems, pp. 742–751, 2017.
172
+
173
+ Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709, 2020a.
174
+
175
+ Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey Hinton. Big self-supervised models are strong semi-supervised learners. arXiv preprint arXiv:2006.10029, 2020b.
176
+
177
+ Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020c.
178
+
179
+ Jang Hyun Cho and Bharath Hariharan. On the efficacy of knowledge distillation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 4794–4802, 2019.
180
+
181
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009.
182
+
183
+ M. Everingham, L. Van Gool, C. K. I. Williams, J. Winn, and A. Zisserman. The PASCAL Visual Object Classes Challenge 2007 (VOC2007) Results. http://www.pascalnetwork.org/challenges/VOC/voc2007/workshop/index.html.
184
+
185
+ Zeyu Feng, Chang Xu, and Dacheng Tao. Self-supervised representation learning by rotation feature decoupling. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 10364–10374, 2019.
186
+
187
+ Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. arXiv preprint arXiv:1803.07728, 2018.
188
+
189
+ Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre H Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv preprint arXiv:2006.07733, 2020.
190
+
191
+ Yandong Guo, Lei Zhang, Yuxiao Hu, Xiaodong He, and Jianfeng Gao. Ms-celeb-1m: A dataset and benchmark for large-scale face recognition. In European conference on computer vision, pp. 87–102. Springer, 2016.
192
+
193
+ Michael Gutmann and Aapo Hyvärinen. Noise-contrastive estimation: A new estimation principle for unnormalized statistical models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 297–304, 2010.
194
+
195
+ 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.
196
+
197
+ Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In Proceedings of the IEEE international conference on computer vision, pp. 2961–2969, 2017.
198
+
199
+ Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9729–9738, 2020.
200
+
201
+ Olivier J Hénaff, Aravind Srinivas, Jeffrey De Fauw, Ali Razavi, Carl Doersch, SM Eslami, and Aaron van den Oord. Data-efficient image recognition with contrastive predictive coding. arXiv preprint arXiv:1905.09272, 2019.
202
+
203
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
204
+
205
+ Andrew Howard, Mark Sandler, Grace Chu, Liang-Chieh Chen, Bo Chen, Mingxing Tan, Weijun Wang, Yukun Zhu, Ruoming Pang, Vijay Vasudevan, et al. Searching for mobilenetv3. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1314–1324, 2019.
206
+
207
+ Andrew G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017.
208
+
209
+ Zehao Huang and Naiyan Wang. Like what you like: Knowledge distill via neuron selectivity transfer. arXiv preprint arXiv:1707.01219, 2017.
210
+
211
+ Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, and Qun Liu. Tinybert: Distilling bert for natural language understanding. arXiv preprint arXiv:1909.10351, 2019.
212
+
213
+ Alexander Kolesnikov, Xiaohua Zhai, and Lucas Beyer. Revisiting self-supervised visual representation learning. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pp. 1920–1929, 2019.
214
+
215
+ Animesh Koratana, Daniel Kang, Peter Bailis, and Matei Zaharia. Lit: Learned intermediate representation training for model compression. In International Conference on Machine Learning, pp. 3509–3518, 2019.
216
+
217
+ Simon Kornblith, Jonathon Shlens, and Quoc V Le. Do better imagenet models transfer better? In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2661–2671, 2019.
218
+
219
+ Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
220
+
221
+ Junnan Li, Pan Zhou, Caiming Xiong, Richard Socher, and Steven CH Hoi. Prototypical contrastive learning of unsupervised representations. arXiv preprint arXiv:2005.04966, 2020.
222
+
223
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pp. 740–755. Springer, 2014.
224
+
225
+ Yifan Liu, Ke Chen, Chris Liu, Zengchang Qin, Zhenbo Luo, and Jingdong Wang. Structured knowledge distillation for semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2604–2613, 2019.
226
+
227
+ Asit Mishra and Debbie Marr. Apprentice: Using knowledge distillation techniques to improve low-precision network accuracy. arXiv preprint arXiv:1711.05852, 2017.
228
+
229
+ Ishan Misra and Laurens van der Maaten. Self-supervised learning of pretext-invariant representations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6707–6717, 2020.
230
+
231
+ Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. In ICML, 2010.
232
+
233
+ Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In European Conference on Computer Vision, pp. 69–84. Springer, 2016.
234
+
235
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
236
+
237
+ Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. In Advances in neural information processing systems, pp. 8026–8037, 2019.
238
+
239
+ Antonio Polino, Razvan Pascanu, and Dan Alistarh. Model compression via distillation and quantization. arXiv preprint arXiv:1802.05668, 2018.
240
+
241
+ Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In Advances in neural information processing systems, pp. 91–99, 2015.
242
+
243
+ Adriana Romero, Nicolas Ballas, Samira Ebrahimi Kahou, Antoine Chassang, Carlo Gatta, and Yoshua Bengio. Fitnets: Hints for thin deep nets. 2014.
244
+
245
+ Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4510–4520, 2018.
246
+
247
+ Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108, 2019.
248
+
249
+ Zhiqiang Shen and Marios Savvides. Meal v2: Boosting vanilla resnet-50 to $80 \text{‰}$ top-1 accuracy on imagenet without tricks. arXiv preprint arXiv:2009.08453, 2020.
250
+
251
+ Siqi Sun, Yu Cheng, Zhe Gan, and Jingjing Liu. Patient knowledge distillation for bert model compression. arXiv preprint arXiv:1908.09355, 2019.
252
+
253
+ Zhiqing Sun, Hongkun Yu, Xiaodan Song, Renjie Liu, Yiming Yang, and Denny Zhou. Mobilebert: a compact task-agnostic bert for resource-limited devices. arXiv preprint arXiv:2004.02984, 2020.
254
+
255
+ Mingxing Tan and Quoc V Le. Efficientnet: Rethinking model scaling for convolutional neural networks. arXiv preprint arXiv:1905.11946, 2019.
256
+
257
+ Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive representation distillation. In International Conference on Learning Representations, 2019a.
258
+
259
+ Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. arXiv preprint arXiv:1906.05849, 2019b.
260
+
261
+ Iulia Turc, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Well-read students learn better: On the importance of pre-training compact models. arXiv preprint arXiv:1908.08962, 2019.
262
+
263
+ Tongzhou Wang and Phillip Isola. Understanding contrastive representation learning through alignment and uniformity on the hypersphere. arXiv preprint arXiv:2005.10242, 2020.
264
+
265
+ Yuxin Wu, Alexander Kirillov, Francisco Massa, Wan-Yen Lo, and Ross Girshick. Detectron2, 2019.
266
+
267
+ Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3733–3742, 2018.
268
+
269
+ Jianxiong Xiao, James Hays, Krista A Ehinger, Aude Oliva, and Antonio Torralba. Sun database: Large-scale scene recognition from abbey to zoo. In 2010 IEEE computer society conference on computer vision and pattern recognition, pp. 3485–3492. IEEE, 2010.
270
+
271
+ Jianwei Yang, Devi Parikh, and Dhruv Batra. Joint unsupervised learning of deep representations and image clusters. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5147–5156, 2016.
272
+
273
+ Sergey Zagoruyko and Nikos Komodakis. Paying more attention to attention: Improving the performance of convolutional neural networks via attention transfer. arXiv preprint arXiv:1612.03928, 2016.
274
+
275
+ Xiaohua Zhai, Avital Oliver, Alexander Kolesnikov, and Lucas Beyer. S4l: Self-supervised semisupervised learning. In Proceedings of the IEEE international conference on computer vision, pp. 1476–1485, 2019.
276
+
277
+ Liheng Zhang, Guo-Jun Qi, Liqiang Wang, and Jiebo Luo. Aet vs. aed: Unsupervised representation learning by auto-encoding transformations rather than data. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2547–2555, 2019.
278
+
279
+ Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In European conference on computer vision, pp. 649–666. Springer, 2016.
280
+
281
+ Xiao Zhang, Zhiyuan Fang, Yandong Wen, Zhifeng Li, and Yu Qiao. Range loss for deep face recognition with long-tailed training data. In Proceedings of the IEEE International Conference on Computer Vision, pp. 5409–5418, 2017.
282
+
283
+ # A APPENDIX
284
+
285
+ We discuss more details and different hyperparameters for SEED during distillation.
286
+
287
+ A.1 PSEUDO-IMPLEMENTATIONS
288
+
289
+ We provide pseudo-code of the SEED distillation in PyTorch Paszke et al. (2019) style:
290
+
291
+ ‘‘‘Q: maintaining queue of previous representations: (N X D)
292
+ 2 T: Cumbersome encoder as Teacher.
293
+ 3 S: Target encoder as Student.
294
+ 4 temp_T, temp_S: temperatures of the Teacher & Student.
295
+ 11
296
+ 6
297
+ 7 # activate evaluation mode for Teacher to freeze BN and updation.
298
+ 8 T.eval()
299
+ 9
300
+ 10 for images in enumerate(loader): # Enumerate single crop-view
301
+ 11
302
+ 12 # augment image to get one identical view
303
+ 13 images $=$ aug(images)
304
+ 14
305
+ 15 # Batch-size
306
+ 16 $\begin{array} { r l } { \mathrm { B } } & { { } = } \end{array}$ images.shape[0]
307
+ 17
308
+ 18 # extract embedding from S: 1 X D
309
+ 19 $\mathrm { ~ \cal ~ X ~ \_ ~ S ~ ~ } =$ S(images)
310
+ 20 $\mathrm { ~ \cal ~ X ~ \_ ~ S ~ ~ } =$ torch.norm(X_S, $\mathrm { p } { = } 2$ , dim $^ { = 1 }$ )
311
+ 21
312
+ 22 # use the gradient-free mode
313
+ 23 with torch.no_grad():
314
+ 24 X_T $=$ T(image) # embedding from T: 1 X D
315
+ 25 $\mathrm { ~ X ~ \_ ~ T ~ } =$ torch.norm(X_T, $\mathrm { p } { = } 2$ , dim $^ { = 1 }$ )
316
+ 26
317
+ 27 # insert the current batch embedding from T
318
+ 28 enqueue(Q, X_T)
319
+ 29
320
+ 30 # probability scores distribution for T, S: B X (N + 1)
321
+ 31 S_Dist $=$ torch.einsum(’bd, dn -> bn’, [X_S], Q.t().clone().detach())
322
+ 32 T_Dist $=$ torch.einsum(’bd, dn -> bn’, [X_T], Q.t().clone().detach())
323
+ 33
324
+ 34 # Apply temperatures for soft-labels
325
+ 35 S_Dist / $=$ temp_S
326
+ 36 T_Dist $=$ SoftMax(T_Dist/temp_T, dim $^ { = 1 }$ )
327
+ 37
328
+ 38 # loss computation, use log_softmax for stable computation
329
+ 39 loss $=$ -torch.mul(T_Dist, Log_SoftMax(S_Dist, dim $^ { 1 = 1 }$ )).sum()/B
330
+ 40
331
+ 41 # update the random sample queue
332
+ 42 dequeue(Q, B) # pop-out earliest B instances
333
+ 43
334
+ 44 # SGD updation
335
+ 45 loss.backward()
336
+ 46 update(S.params)
337
+
338
+ # A.1.1 DATA AUGMENTATIONS
339
+
340
+ Both our teacher pre-training and distillation adopt the data augmentations as follows:
341
+
342
+ Random Resized Crop: The image is randomly resized with a scale of {0.2, 1.0}, then cropped to the size of $2 2 4 \times 2 2 4$ .
343
+
344
+ Random Color Jittering: with brightness to be {0.4, 0.4, 0.4, 0.1} with probability at 0.8.
345
+
346
+ Random Gray Scale transformation: with probability at 0.2.
347
+
348
+ Random Gaussian Blur transformation: with $\sigma = \{ 0 . 1 , 0 . 2 \}$ and probability at 0.5.
349
+
350
+ Horizontal Flip: Horizontal flip is applied with probability at 0.5
351
+
352
+ # A.1.2 PRE-TRAINING AND DISTILLATION ON MOBILENET AND EFFICIENTNET
353
+
354
+ MobileNet (Howard et al., 2017) and EfficientNet (Tan & Le, 2019) have been considered as the smaller counterparts with larger models, i.e., ResNet-50 (with supervised training, EfficientNetB0 hits $7 7 . 2 \%$ Top-1 Acc., and MobileNet-V3-large reaches $7 2 . 2 \%$ on ImageNet testing split). Nevertheless, un-matched performances are observed in the task of self-supervised contrastive pretraining: i.e., Self-Supervised Learning (MoCo-V2) on MobileNet-V3 only yields $3 6 . 3 \%$ Top-1 Acc. on ImageNet. We conjecture that several reasons might lead to this dilemma:
355
+
356
+ 1. The inability of models with less parameters for handling large volume of categories and data, which exists also in other domains, i.e., face recognition (Guo et al., 2016; Zhang et al., 2017).
357
+ 2. Less possibility for optimum parameters to be chosen when transferring to downstream tasks: models with more parameters after pre-training might produce a plenty cornucopia of optimum parameters for fine-tuning.
358
+
359
+ To narrow the dramatic performance gap between smaller architectures using contrastive SSL with the larger, we explore with architectural manipulations and training hyper-parameters. In specific, we find that by adding a deeper projection head largely improves the representation quality, a.k.a., better performances on linear evaluation. We experiment with adding one additional linear projection head on the top of convolutional backbones.
360
+
361
+ Similarly, we also expand the MLP projection head on EfficientNet-b0. Though recent work shows that fine-tuning from a middle layer of the projection head can produce a largely different result (Chen et al., 2020b), we consistently just use the representations from convolutional trunk without adding extra layers during the phase of linear evaluation. As shown in Table 6, pre-training with a deeper projection head dramatically helps the improvement on linear evaluations, adding $17 \%$ Top-1. Acc. for Mobile-v3-large, and we report the improved baselines in the main paper (see the first row in Table 1 of the main paper). We keep most of the hyper-parameters as the distillation on ResNet except reducing the weight-decay of them to 1e-5, following (Tan & Le, 2019; Sandler et al., 2018).
362
+
363
+ Table 6: Linear evaluations on ImageNet of EfficientNet and MobileNet pre-trained using MoCo-v2. A deeper projection head largely boosts the linear evaluation performances on smaller architectures.
364
+
365
+ <table><tr><td>Model</td><td>Deeper MLPs</td><td>Top-1 Acc. Top-5 Acc.</td><td></td></tr><tr><td>EfficientNet-b0</td><td></td><td>39.1</td><td>64.6</td></tr><tr><td>EfficientNet-b0</td><td>×</td><td>42.2</td><td>68.5</td></tr><tr><td>Mobile-v3-large</td><td>X</td><td>19.0</td><td>41.3</td></tr><tr><td>Mobile-v3-large</td><td>√</td><td>36.3</td><td>62.2</td></tr></table>
366
+
367
+ # A.2 ADDITIONAL DETAILS OF EVALUATIONS
368
+
369
+ We list additional details regarding our evaluation experiments in this section.
370
+
371
+ ImageNet-1k Semi-Supervised Linear Evaluation. Following Zhai et al. (2019); Chen et al. (2020a), we train the FC layers on the basis of our student encoder after distillation using a fraction of labeled ImageNet-1k dataset ( $1 \%$ and $10 \%$ ), and evaluate it on the whole test split. The fraction of labeled dataset is constructed in a class-balanced way, with roughly 12 and 128 images per class∗. We use SGD optimizer and set initial learning rate to be 30 with a multiplier $=$ BatchSize/256 without weight decaying for 100 epochs. We use the step-wise scheduler for the learning rate updating with 5 warm-up epochs, and the learning rate is reduced by 10 at 60 and 80 epochs. On smaller architectures like EfficientNet and MobileNet, we reduce the initial learning rate to 3. During training, the image is center-cropped to the size of $2 2 4 \times 2 2 4$ with just Random Horizontal Flip as the data augmentation. For testing, we first resize the image to $2 5 6 \times 2 5 6$ and use the center cropped $2 2 4 \times 2 2 4$ for pre-processing. In Table 8, we show the distillation results on a larger encoder (ResNet-550) when using different teacher networks.
372
+
373
+ Table 7: Before and after distillation Top-1/5 test accuracy $( \% )$ on ImageNet of EfficientNet-b0 and MobileNetlarge without deeper MLPs.
374
+
375
+ <table><tr><td>Student</td><td>Teacher</td><td>Top-1</td><td>Top-5</td></tr><tr><td rowspan="3">EfficientNet-b0</td><td>X</td><td>39.1</td><td>64.6</td></tr><tr><td>ResNet-50</td><td>59.2</td><td>81.2</td></tr><tr><td>ResNet-101</td><td>62.8</td><td>84.7</td></tr><tr><td></td><td>ResNet-152</td><td>63.3</td><td>85.6</td></tr><tr><td rowspan="3">MobileNet-v3</td><td>X ResNet-50</td><td>19.0 50.9</td><td>41.3 77.7</td></tr><tr><td>ResNet-101</td><td>57.6</td><td>82.6</td></tr><tr><td>ResNet-152</td><td>58.3</td><td>82.9</td></tr></table>
376
+
377
+ Table 8: ImageNet-1k test accuracy $( \% )$ under KNN and linear classification on ResNet-50 encoder with deeper, MoCo-V2/SWAV pre-trained teacher architectures. $\pmb { \chi }$ denotes MoCo-V2 self-supervised learning baselines before distillation. \* indicates using a stronger teacher encoder pre-trained by SWAV with additional small-patches during distillation.
378
+
379
+ <table><tr><td></td><td>Stud.</td><td></td><td>ResNet-50</td><td></td></tr><tr><td>Teac.</td><td>Epoch</td><td>KNN</td><td>Top-1</td><td>Top-5</td></tr><tr><td>X ResNet-50</td><td>200</td><td>46.1 46.1</td><td>67.4 67.5</td><td>87.8 87.8</td></tr><tr><td>△ ResNet-101</td><td>200</td><td>+0.0 52.3</td><td>+0.1</td><td>+0.0</td></tr><tr><td>△</td><td>200</td><td>+6.2</td><td>69.1 +1.7</td><td>88.7 +0.9</td></tr><tr><td>ResNet-152 △</td><td>200</td><td>53.2 +7.1</td><td>70.4 +3.0</td><td>90.5 +2.7</td></tr><tr><td>ResNet-50×2* △</td><td>800</td><td>59.0 +12.9</td><td>74.3 +6.9</td><td>92.2 +4.4</td></tr></table>
380
+
381
+ Transfer Learning. We test the transferability of the representations learned from self-supervised distillation by conducting the linear evaluations using offline features on several other datasets. Specifically, a single layer logistic classifier is trained following (Chen et al., 2020a; Grill et al., 2020) using SGD optimizer without weight decay and momentum parameter at 0.9. We use CIFAR-10, CIFAR-100 (Krizhevsky et al., 2009) and SUN-397 (Xiao et al., 2010) as our testing beds.
382
+
383
+ CIFAR: As the size for CIFAR dataset is $3 2 \times 3 2$ , we resize all images to $2 2 4 \times 2 2 4$ pixels along the shorter side using bicubic resampling method, followed by a center crop operation. We set the learning rate at 1e-3 constantly and train it for 120 epochs. The hyper-parameters are searched using 10 fold cross-validation on the train split and report its final top-1 accuracy on the test split.
384
+
385
+ Table 9: Object detection and instance segmentation fine-tuned on VOC07: bounding-box AP $( \mathsf { A P } ^ { b b } )$ ) and mask AP $( \mathbf { A } \mathbf { P } ^ { m k } )$ ) evaluated on VOC07-val. The first row shows the baseline from MoCo-v2 backbones without distillation.
386
+
387
+ <table><tr><td rowspan="2">Student</td><td rowspan="2">Teacher</td><td colspan="3">VOC Object Detection</td></tr><tr><td>APbb</td><td>AP</td><td>AP</td></tr><tr><td rowspan="3">ResNet-34</td><td>X</td><td>53.6</td><td>79.1</td><td>58.7</td></tr><tr><td>ResNet-50</td><td>53.7 (+0.1)</td><td>79.4 (+0.3)</td><td>59.2 (+0.5)</td></tr><tr><td>ResNet-101 ResNet-152</td><td>54.1 (+0.5) 54.4 (+0.8)</td><td>79.8 (+0.7) 80.1 (+1.0)</td><td>59.1 (+0.4) ) 59.9 (+1.2)</td></tr><tr><td rowspan="2">ResNet-50</td><td>X</td><td>57.0</td><td>82.4</td><td>63.6</td></tr><tr><td>ResNet-50 ResNet-101</td><td>57.0 (+0.0) 57.1 (+0.1)</td><td>82.4 (+0.0) 82.8 (+0.4)</td><td>63.6 (+0.0) 63.8 (+0.2)</td></tr></table>
388
+
389
+ Table 10: Object detection and instance segmentation fine-tuned on COCO: bounding-box AP $( \mathbf { A P } ^ { b b } )$ and mask AP $( \mathbf { A } \mathbf { P } ^ { m k } )$ evaluated on COCO-val2017. The first several rows show the baselines from unsupervised backbones without distillation.
390
+
391
+ <table><tr><td rowspan="2">Student</td><td rowspan="2">Teacher</td><td colspan="3">Object Detection</td><td colspan="3">Instance Segmentation</td></tr><tr><td>Apbb</td><td>AP</td><td>APP</td><td>Apmk</td><td>AP</td><td>AP</td></tr><tr><td rowspan="4">ResNet34</td><td>X</td><td>38.1</td><td>56.8</td><td>40.7</td><td>33.0</td><td>53.2</td><td>35.3</td></tr><tr><td>ResNet50</td><td>38.4 (+0.3)</td><td>57.0 (+0.2)</td><td>41.0 (+0.3)</td><td>33.3 (+0.3)</td><td>53.6 (+0.4)</td><td>35.4 (+0.1)</td></tr><tr><td>ResNet101</td><td>38.5 (+0.4)</td><td>57.3 (+0.5)</td><td>41.4 (+0.7)</td><td>33.6 (+0.6)</td><td>54.1 (+0.9)</td><td>35.6 (+0.3)</td></tr><tr><td>ResNet152</td><td>38.4 (+0.3)</td><td>57.0 (+0.2)</td><td>41.0 (+0.3)</td><td>33.3 (+0.3)</td><td>53.7 (+0.5)</td><td>35.3 (+0.0)</td></tr></table>
392
+
393
+ SUN-397: We further extend our transferring evaluation to the scene dataset SUN-397 for a more diverse testing. The official dataset specifies 10 different train/test splits, with each contains 50 images per category covering 397 different scenes. We follow (Chen et al., 2020a; Grill et al., 2020) and use the first train/test split. For the validation set, we randomly pick 10 images (yielding $20 \%$ of the dataset), with identical optimizer parameters as CIFAR.
394
+
395
+ Object Detection and Instance Segmentation. As indicated by (He et al., 2020), features produced by self-supervised pre-training have divergent distributions in downstream tasks, thus resulting the supervised pre-training picked hyper-parameters not applicable. To relieve this, He et al. (2020) uses feature normalization during the fine-tuning phase and train the BN layers. Different from previous transferring and linear evaluations where we exploit only offline features, model for detection and segmentation is trained with all parameters tuned. For this reason, annotations on COCO for segmentation gives much higher influence for the backbone model than the VOC dataset (see Table 9), and gives an offset to the pre-training difference (see Table 10). Thus, this makes the performance boosting by pre-training less obvious, and leads to trivial AP differences before and after distillation.
396
+
397
+ Object Detection on PASCAL VOC-07: We train a C4 (He et al., 2017) based Faster R-CNN (Ren et al., 2015) as the detector with different ResNet architectures (ResNet-18, ResNet-34 and ResNet-50) for evaluating the transferability of features for object detection tasks. We use Detectron2 (Wu et al., 2019) for the implementations. We train our detector for 48k iterations with a batch size of 32 (8 images per GPU). The base learning rate is set to 0.01 with 200 warm-up iterations. We set the scale of images for training as [400, 800] and 800 at inference.
398
+
399
+ Object Detection and Segmentation on COCO: We use Mask R-CNN (He et al., 2017) with the C4 backbone for the object detection and instance segmentation task on COCO dataset, with $2 \times$ schedule. Similar to the VOC detection, we tune the BN layers and all parameters. The model is trained for $1 8 0 \mathrm { k }$ iterations with initial learning rate set to 0.02. We set the scale of images for training as [600, 800] and 800 at inference.
400
+
401
+ Table 11: Linear evaluations on ImageNet of ResNet-18 after distillation from the SWAV pre-trained ResNet-50 using either single view, cross-views, or small patch views.
402
+
403
+ <table><tr><td>Method</td><td>Multi-View(s)</td><td>Top-1 Acc.</td><td>Top-5 Acc.</td></tr><tr><td>Identical-View</td><td>1×224</td><td>61.7</td><td>84.2</td></tr><tr><td>Cross-Views</td><td>2×224</td><td>58.2</td><td>81.7</td></tr><tr><td>Multi-Crops + Cross-Views</td><td>1×224 + 6×96×96</td><td>61.9</td><td>84.4</td></tr><tr><td>Multi-Crops + Identical-View </td><td>1×224 +6×96×96</td><td>62.6</td><td>84.8</td></tr></table>
404
+
405
+ ![](images/0863ba5174cfabf1f7a4f95ce0b77df7bdbf71b58813b9c855df14a8e571182a.jpg)
406
+ Figure 6: We experiment with different strategies of using views during distillation, which include: (a). Identical view for distillation. (b). Cross view distillation. (c). Large-small cross view distillation. (d). Large-small identical view distillation.
407
+
408
+ # A.3 SINGLE CROP V.S. MULTI-CROPS VIEW(S) FOR DISTILLATION
409
+
410
+ In contrary with most contrastive SSL methods where two different augmented views of an image are utilized as the positive samples (see Figure 6-a), SEED uses an identical view for each image (see Figure 6-b) during distillation and yields better performances, as is shown in Table. 11. In addition, we have also experimented with two strategies of using small patches. To be specific, we follow the set-up in SWAV (Caron et al., 2020), that 6 small patches of the size $9 6 \times 9 6$ are sampled at the scale of (0.05, 0.14). Then, we apply the same augmentations as introduced previously as data pre-processing. Figure. 6-c shows the way that is similar in SWAV for small-patch learning, where both large and 6 small patches are fed into the student encoder, with the learning target $( \mathbf { z } ^ { T } )$ to be the embedding of large view from the teacher encoder. Figure. 6-d is the strategy we use during distillation, that both views are fed into student and teacher to produce the embeddings for small-views $( \mathbf { z } _ { s } ^ { S } , \mathbf { z } _ { s } ^ { T } )$ and large views $( \mathbf { z } _ { l } ^ { S } , \mathbf { z } _ { l } ^ { T } )$ . Based on that, the distillation is formulated separately on the small and large views. Notably, we maintain two independent queues for storing historical data samples for the large and small views.
411
+
412
+ # A.4 STRATEGIES FOR OTHER DISTILLATION METHODS
413
+
414
+ We compare the effect of distillation using different strategies with SEED.
415
+
416
+ $\mathbf { \xi } _ { l 2 }$ -Distance: We train the student encoder by minimizing the squared $l 2$ -distance of representations from student $( \mathbf { z } _ { i } ^ { S } )$ and teacher $( \mathbf { z } _ { i } ^ { T } )$ for an identical view $\mathbf { x } _ { i }$ .
417
+
418
+ $\pmb { K }$ -Means: We experiment with the $K$ -Means clustering method to retrieve pseudo class labels for distillation. Specifically, we first extract offline image features using the $S S L$ pre-trained Teacher network without any image augmentations. Based on this, we conduct our $K$ -Means clustering with $4 \mathrm { k }$ and $1 6 \mathrm { k }$ unique centroids. Then the final centroids are used to produce pseudo labels for unlabelled instances. With that, we carry out the distillation by training the model on a classification task using the produced labels as the ground-truth. To avoid trivial solutions that the majority of images are assigned to a few clusters, we sample images based on a uniform distribution over pseudo-labels as clustering proceeds. We observe very close results when adjusting numbers of centroids.
419
+
420
+ Online-Clustering: With $K$ -Means for pseudo-label generation training, it does not lead to satisfying results $( 5 1 . 0 \%$ on ResNet-18 with ResNet-50 as Teacher) as instances might have not been accurately categorized by limited frozen centroids. Similar to (Caron et al., 2018; Li et al., 2020), we resort to the “in-batch” and dynamical clustering to substitute the frozen $K$ -Means method. We conduct
421
+
422
+ $K$ -Means clustering within a batch and continuously update the centroid based on the teacher feature representation as distillation goes on. This alleviates the above problems and yields a substantial performance improvement on ResNet-18 to $5 6 . 4 \%$ .
423
+
424
+ Binary Contrastive Loss: We resort to CRD (Tian et al., 2019a) and adopt an info-NCE loss-alike training objective in unsupervised distillation tasks. Specifically, we treat representation features from Teacher and Student for instance $\mathbf { x } _ { i }$ as positive pairs, and random instances from $\mathbf { D }$ as negative samples:
425
+
426
+ $$
427
+ \hat { \theta } _ { S } = \underset { \theta _ { S } } { \arg \operatorname* { m i n } } \sum _ { i } ^ { N } \log h ( \mathbf { z } _ { i } ^ { S } , \mathbf { z } _ { i } ^ { T } ) + K \cdot [ \log h ( 1 - h ( \mathbf { z } _ { i } ^ { S } , \mathbf { d } _ { j } ^ { T } ) ) ] ,
428
+ $$
429
+
430
+ where $\mathbf { d } _ { j } ^ { T } \in \mathbf { D } , h ( \cdot )$ is any family of functions that satisfy $h$ : $\{ { \bf z } , { \bf d } \} [ 0 , 1 ]$ , e.g., cosine similarity.
431
+
432
+ # A.5 DISCUSSIONS ON SEED
433
+
434
+ Our proposed learning objective for SEED is composed of two goals, that is to align the encoding $\mathbf { z } ^ { S }$ by the student model with $\mathbf { z } ^ { T }$ produced by the teacher model; meanwhile, $\mathbf { z } ^ { S }$ also softly contrasts with random samples maintained in the $\mathbf { D }$ . This can be formulated more directly as minimizing the $l 2$ distance of ${ \mathbf z } ^ { T } , { \mathbf z } ^ { S }$ , together with the cross-entropy computed using $\mathbf { D }$ :
435
+
436
+ $$
437
+ \begin{array} { l } { \displaystyle \mathcal { L } = \frac { 1 } { N } \sum _ { i } ^ { N } \bigg \{ \lambda _ { a } \cdot \bigg \vert \bigg \vert \mathbf { z } _ { i } ^ { T } - \mathbf { z } _ { i } ^ { S } \bigg \vert \bigg \vert _ { 2 } - \lambda _ { b } \cdot \mathbf { p } ^ { T } ( \mathbf { x } _ { i } ; \boldsymbol { \theta } _ { T } , \mathbf { D } ) \cdot \log \mathbf { p } ^ { S } ( \mathbf { x } _ { i } ; \boldsymbol { \theta } _ { S } , \mathbf { D } ) \bigg \} } \\ { \displaystyle \quad = \sum _ { i } ^ { N } \bigg \{ - \lambda _ { a } \cdot \mathbf { z } _ { i } ^ { T } \cdot \mathbf { z } _ { i } ^ { S } - \lambda _ { b } \cdot \sum _ { j } ^ { K } \frac { \exp ( \mathbf { z } _ { i } ^ { T } \cdot \mathbf { d } _ { j } / \tau ^ { T } ) } { \sum _ { \mathbf { d } \setminus \mathbf { D } } \exp ( \mathbf { z } _ { i } ^ { T } \cdot \mathbf { d } / \tau ^ { T } ) } \cdot \log \frac { \exp ( \mathbf { z } _ { i } ^ { S } \cdot \mathbf { d } _ { j } / \tau ^ { S } ) } { \sum _ { \mathbf { d } \setminus \mathbf { D } } \exp ( \mathbf { z } _ { i } ^ { S } \cdot \mathbf { d } / \tau ^ { S } ) } \bigg \} , } \end{array}
438
+ $$
439
+
440
+ Directly optimizing Eq. 7 can lead to apparent difficulty in searching optimal hyper-parameters $( \lambda _ { a } , \lambda _ { b } , \bar { \tau } ^ { T }$ and $\tau ^ { S }$ ). Our proposed objective on $\mathbf { D } ^ { + }$ indeed is an approximated upper-bound of the above objectiveness however much simplified:
441
+
442
+ $$
443
+ \begin{array} { r l } & { \mathcal { L } _ { \mathrm { S E E D } } = \displaystyle \frac { 1 } { N } \sum _ { i } ^ { N } - \mathbf { p } ^ { T } ( \mathbf { x } _ { i } ; \boldsymbol { \theta } _ { T } , \mathbf { D } ^ { + } ) \cdot \log \mathbf { p } ^ { S } ( \mathbf { x } _ { i } ; \boldsymbol { \theta } _ { S } , \mathbf { D } ^ { + } ) } \\ & { \qquad = \displaystyle \sum _ { i } ^ { N } \sum _ { j } ^ { K + 1 } - \underbrace { \frac { \exp \left( \mathbf { z } _ { i } ^ { T } \cdot \mathbf { d } _ { j } / \tau ^ { T } \right) } { \sum _ { \mathbf { d } \sim \mathbf { D } ^ { + } } \exp \left( \mathbf { z } _ { i } ^ { T } \cdot \mathbf { d } / \tau ^ { T } \right) } } _ { \mathbf { w } _ { j } ^ { i } } \cdot \log \frac { \exp \left( \mathbf { z } _ { i } ^ { S } \cdot \mathbf { d } _ { j } / \tau ^ { S } \right) } { \sum _ { \mathbf { d } \sim \mathbf { D } ^ { + } } \exp \left( \mathbf { z } _ { i } ^ { S } \cdot \mathbf { d } / \tau ^ { S } \right) } , } \end{array}
444
+ $$
445
+
446
+ where we let $\mathbf { w } _ { j } ^ { i }$ denote the weighting term regulated under $\tau ^ { T }$ . Since the $( K + 1 )$ th element in $\mathbf { D } ^ { + }$ is our supplemented vector ${ \mathbf z } _ { i } ^ { T }$ , the above objective can be expanded into:
447
+
448
+ $$
449
+ \begin{array} { r l } & { \mathcal { L } _ { \mathrm { S E E D } } = \displaystyle \frac { 1 } { N } \sum _ { i } ^ { N } \Big \{ { \bf w } _ { K + 1 } ^ { i } \cdot \big ( - { \bf z } _ { i } ^ { S } \cdot { \bf z } _ { i } ^ { T } / \tau ^ { S } + \log \sum _ { \bf d \sim D ^ { + } } \exp ( { \bf z } _ { i } ^ { S } \cdot { \bf d } / \tau ^ { S } ) \big ) } \\ & { \qquad + \displaystyle \sum _ { j = 1 } ^ { K } { \bf w } _ { j } ^ { i } \cdot \big ( - { \bf z } _ { i } ^ { S } \cdot { \bf d } _ { j } / \tau ^ { S } + \log \sum _ { \bf d \sim D ^ { + } } \exp ( { \bf z } _ { i } ^ { S } \cdot { \bf d } / \tau ^ { S } ) \big ) \Big \} } \end{array}
450
+ $$
451
+
452
+ Note that the LSE term in the first line is strictly non-negative as the range of inner product for $\mathbf { z } ^ { S }$ and $\mathbf { d }$ lies between $\left[ - 1 , + 1 \right]$ :
453
+
454
+ $$
455
+ \mathrm { L S E } ( \mathbf { D } ^ { + } , \mathbf { z } _ { i } ^ { S } ) \geq \log \big ( M \cdot \exp ( - 1 / \tau ^ { S } ) \big ) = \log \big ( M \cdot \exp ( - 5 ) \big ) > 0 ,
456
+ $$
457
+
458
+ where $M$ denotes the cardinality of the maintained queue $\mathbf { D } ^ { + }$ and is set to 65,536 in our experiment with $\tau ^ { S } = 0 . 2$ constantly. Meanwhile, the LSE term in the second line satisfies the following inequality:
459
+
460
+ $$
461
+ \mathrm { L S E } ( \mathbf { D } ^ { + } , \mathbf { z } _ { i } ^ { S } ) \geq \mathrm { L S E } ( \mathbf { D } , \mathbf { z } _ { i } ^ { S } ) .
462
+ $$
463
+
464
+ Thus, this demonstrates that the objective for SEED as Eq. 8 is equivalent to minimizing a weakened upper-bound of e.q. 7:
465
+
466
+ $$
467
+ \begin{array} { l } { { \mathcal { L } _ { \mathrm { S E E D } } = \displaystyle \frac { 1 } { N } \sum _ { i } ^ { N } - { \bf p } ^ { T } ( { \bf x } _ { i } ; \boldsymbol { \theta } _ { T } , { \bf D } ^ { + } ) \cdot \log { \bf p } ^ { S } ( { \bf x } _ { i } ; \boldsymbol { \theta } _ { S } , { \bf D } ^ { + } ) } \ ~ } \\ { { \displaystyle \geq \frac { 1 } { N } \sum _ { i } ^ { N } \left\{ { \bf w } _ { K + 1 } ^ { i } \cdot ( - { \bf z } _ { i } ^ { S } \cdot { \bf z } _ { i } ^ { T } / \tau ^ { S } ) + \sum _ { j = 1 } ^ { K } { \bf w } _ { j } ^ { i } \cdot \left( - { \bf z } _ { i } ^ { S } \cdot { \bf d } _ { j } / \tau ^ { S } + \log \sum _ { \bf d \times D } ^ { C } \exp ( { \bf z } _ { i } ^ { S } \cdot { \bf d } / \tau ^ { S } ) \right) \right\} } \ ~ } \\ { { \displaystyle = \frac { 1 } { N } \sum _ { i } ^ { N } \Bigg \{ - \frac { { \bf w } _ { K + 1 } ^ { i } } { \tau ^ { S } } \cdot { \bf z } _ { i } ^ { S } \cdot { \bf z } _ { i } ^ { T } - { \bf p } ^ { T } ( { \bf x } _ { i } ; \boldsymbol { \theta } _ { T } , { \bf D } ) \cdot \log { \bf p } ^ { S } ( { \bf x } _ { i } ; \boldsymbol { \theta } _ { S } , { \bf D } ) \Bigg \} } \ ~ } \end{array}
468
+ $$
469
+
470
+ This proves that our $\mathcal { L } _ { \mathrm { S E E D } }$ directly relates to a more intuitive distillation formulation as Eq. 7 $( l 2 +$ cross entropy loss), and it implicitly contains the objective of aligning and contrasting. However, our training objective is much simplified. During practice, we find by regulating $\tau ^ { T }$ , both training losses produce equal results.
471
+
472
+ # A.6 DISCUSSION ON THE RELATIONSHIP OF SEED WITH INFO-NCE
473
+
474
+ The objective of distillation can be considered as a soft version of Info-NCE (Oord et al., 2018), with the only difference to be that SEED learns from the negative samples with probabilities instead of treating them all strictly as negative samples. To be more specific, following Info-NCE, the “hard” style contrastive distillation can be expressed as aligning with representations from the Teacher encoder and contrasting with all random instances:
475
+
476
+ $$
477
+ \hat { \theta } _ { S } = \underset { \theta _ { S } } { \arg \operatorname* { m i n } } \ : \mathcal { L } _ { N C E } = \underset { \theta _ { S } } { \arg \operatorname* { m i n } } \sum _ { i } ^ { N } - \log \frac { \exp ( \mathbf { z } _ { i } ^ { T } \cdot \mathbf { z } _ { i } ^ { S } / \tau ) } { \sum _ { \mathbf { d } \sim \mathbf { D } } \exp ( \mathbf { z } _ { i } ^ { S } \cdot \mathbf { d } / \tau ) }
478
+ $$
479
+
480
+ which can be further deduced with two sub-terms consisting of positive sample alignment and contrasting with negative instances:
481
+
482
+ $$
483
+ \mathcal { L } _ { N C E } = \sum _ { i } ^ { N } \Big \{ \underbrace { - \mathbf { z } _ { i } ^ { S } \cdot \mathbf { z } _ { i } ^ { T } / \tau } _ { a l i g n m e n t } + \underbrace { \log \sum _ { \mathbf { d } \sim \mathbf { D } } \exp ( \mathbf { z } _ { i } ^ { S } \cdot \mathbf { d } / \tau ) } _ { c o n t r a s t i n g } \Big \} .
484
+ $$
485
+
486
+ Similarly, the objective of SEED can be dissembled into the weighted form of alignment and contrasting terms:
487
+
488
+ $$
489
+ \begin{array} { r l } & { \mathcal { L } _ { \mathrm { S E E D } } = \displaystyle \frac { 1 } { N * M } \sum _ { i } ^ { N } \sum _ { j } ^ { K + 1 } - \frac { \exp ( { \bf z } _ { i } ^ { T } \cdot { \bf d } _ { j } / \tau ^ { T } ) } { \sum _ { \bf d } \sim \mathrm { D } ^ { + } } \cdot \log \Big \frac { \exp ( { \bf z } _ { i } ^ { S } \cdot { \bf d } _ { j } / \tau ^ { S } ) } { \sum _ { \bf d } \sim \mathrm { D } ^ { + } } } \\ & { \quad \quad \quad \quad = \frac { 1 } { N * M } \sum _ { i } ^ { N } \displaystyle \sum _ { j } ^ { K + 1 } \underbrace { \frac { \exp ( { \bf z } _ { i } ^ { T } \cdot { \bf d } _ { j } / \tau ^ { T } ) } { \sum _ { \bf d } \sim \mathrm { D } ^ { + } } } _ { { \bf w } _ { j } ^ { \bf d } } \cdot \underbrace { ( - { \bf z } _ { i } ^ { S } \cdot { \bf z } _ { i } ^ { T } / \tau ^ { S } ) } _ { a l i g n m e n t } \cdot \underbrace { ( \frac { \log \sum _ { i } ^ { S } \cdot { \bf d } _ { i } / \tau ^ { S } ) } { c \mathrm { o } n t r a s t i n g } } _ { c o n t r a s t i n g } ) , } \end{array}
490
+ $$
491
+
492
+ where the normalization term can be considered as soft labels, $\mathbf { W } ^ { i } = \left[ \mathbf { w } _ { 1 } ^ { i } \ldots \mathbf { w } _ { K + 1 } ^ { i } \right]$ , which can weight the above loss as:
493
+
494
+ $$
495
+ \mathcal { L } _ { \mathrm { S E E D } } = \frac { 1 } { N * M } \sum _ { i } ^ { N } \sum _ { j } ^ { K + 1 } \mathbf { w } _ { j } ^ { i } \cdot \Big \{ - \mathbf { z } _ { i } ^ { S } \cdot \mathbf { z } _ { i } ^ { T } / \tau ^ { S } + \log \sum _ { \mathbf { d } \sim \mathbf { D } } \exp ( \mathbf { z } _ { i } ^ { S } \cdot \mathbf { d } / \tau ^ { S } ) ) \Big \} ,
496
+ $$
497
+
498
+ When tuning hyper-parameter $\tau ^ { T }$ towards 0, $\mathbf { W } ^ { i }$ can be altered into the format of one-hot vector with $\mathbf { w } _ { K + 1 } ^ { i } = \dot { 1 }$ , which is then degraded to the case of contrastive distillation as in equation 14. In practice, the choice of an optimal $\tau ^ { T }$ can be dataset-specific. We show that the higher $\tau ^ { T }$ (with labels be more ‘soft’) can actually yield better results on other datasets, e.g., CIFAR-10 (Krizhevsky et al., 2009).
499
+
500
+ # A.7 COMPATIBILITY WITH SUPERVISED DISTILLATION
501
+
502
+ SEED conducts self-supervised distillation at the pre-training phase for the representation learning. However, we verify that SEED is compatible with traditional supervised distillation that happened during fine-tuning phrase at downstream, and can even produce better results. We begin with the SSL pre-training on a larger architecture (ResNet-152) using MoCo-V2 and train it for 200 epochs as the teacher network. As images in CIFAR-100 are in the size of $3 2 \times 3 2$ , we modify the first conv layer in ResNet with kernel size $= 3$ and stride $= 1$ .
503
+
504
+ We then compare the Top-1 accuracy of a smaller ResNet-18 on CIFAR-100 when using different distillation strategies when all parameters are trainable. First, we use SEED to pre-train ResNet-18 with Res-152 as the teacher model, and then evaluate in on the test split of CIFAR-100 using linear fine-tuning task. As we keep all parameters trainable during the fine-tuning phase, distillation on the pre-training only yields a trivial boost: $7 5 . 4 \%$ v.s. $7 5 . 2 \%$ . Then, we adopt the traditional distillation method, e.g., (Hinton et al., 2015), to first fine-tune the ResNet-152 model, and then use its output class probability to facilitate the linear classification task on ResNet-18 in the fine-tuning phrase. This improves the linear classification accuracy on ResNet-18 to $7 6 . 0 \%$ . At the end, we initialize the ResNet-18 with our SEED pre-trained ResNet-18, and equip it with the supervised classification distillation during fine-tuning. With that, we find that the performance of ResNet-18 is further boosted to $7 8 . 1 \%$ . We can conclude that our SEED is compatible with traditional supervised distillation that mostly happened at downstream for specific tasks, e.g., classification, object detection.
505
+
506
+ Table 12: CIFAR-100 Top-1 Accuracy $( \% )$ of ResNet-18 with (or without) distillation at different phase: selfsupervised pre-training stage, and supervised classification fine-tuning. All backbone parameters of ResNet-18 are trainable in experiments.
507
+
508
+ <table><tr><td colspan="3">Pre-training Distill. Fine-tuning Distill. Top-1 Acc</td></tr><tr><td>X</td><td>X</td><td>75.2</td></tr><tr><td>√</td><td>×</td><td>75.4</td></tr><tr><td>×</td><td>√</td><td>76.0</td></tr><tr><td>√</td><td>√</td><td>78.1</td></tr></table>
509
+
510
+ ![](images/d2dbbfad613f736ba1bbdacdf0d815fdcec0dd5cde93e27f656664f449c6e7cd.jpg)
511
+ Figure 7: Linear evaluation accuracy $( \% )$ of distillation between ResNet-18 (as the Student) and ResNet-50 (as the Teacher) using different size of queue when $\mathrm { L R } { = } 0 . 0 3$ and weight decay=1e-6. Note the axis is the log(·) value of queue lengths.
512
+
513
+ # A.8 ADDITIONAL ABLATION STUDIES
514
+
515
+ We study effects of different hyper-parameters to distillation using a ResNet-18 (as Student) and a SWAV pre-trained ResNet-50 (as Teacher) with small patch views. In specific, we list the Top-1 Acc. on validation split of ImageNet-1k using different lengths of queue $K { = } 1 2 8$ , 512, 1,024, 4,096, 8,192, 16,384, 65,536) in Figure. 7. With the increasing of random data samples, the distillation boosts the accuracy of learned representations, however within a limited range: $+ 1 . 5$ when the queue size is
516
+
517
+ Table 13: Linear evaluation accuracy $( \% )$ of distillation between ResNet-18 (as the Student) and ResNet-50 (as the Teacher) using different learning rates when the queue size is 65,536 and weight decay=1e-6.
518
+
519
+ <table><tr><td>LR</td><td>Top-1 Acc. Top-5 Acc.</td><td></td></tr><tr><td>1</td><td>58.9</td><td>83.1</td></tr><tr><td>0.1</td><td>62.9</td><td>85.3</td></tr><tr><td>0.03</td><td>63.3</td><td>85.4</td></tr><tr><td>0.01</td><td>62.6</td><td>85.0</td></tr></table>
520
+
521
+ Table 14: Linear evaluation accuracy $( \% )$ of distillation between ResNet-18 (as the Student) and ResNet-50 (as the Teacher) using different weight decays when the queue size is 65,536 and $\mathrm { L R } { = } 0 . 0 3$ .
522
+
523
+ <table><tr><td>WD</td><td>Top-1 Acc. Top-5 Acc.</td><td></td></tr><tr><td>1e-2</td><td>11.8</td><td>27.7</td></tr><tr><td>1e-3</td><td>62.3</td><td>84.7</td></tr><tr><td>1e-4</td><td>61.9</td><td>84.4</td></tr><tr><td>1e-5</td><td>61.6</td><td>84.2</td></tr><tr><td>1e-6</td><td>63.3</td><td>85.4</td></tr></table>
524
+
525
+ 65,536 compared with 256. Furthermore, Table. 13 and 14 summarize the linear evaluation accuracy under different learning rates and weight decays.
md/train/B17JTOe0-/B17JTOe0-.md ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EMERGENCE OF GRID-LIKE REPRESENTATIONS BYTRAINING RECURRENT NEURAL NETWORKS TOPERFORM SPATIAL LOCALIZATION
2
+
3
+ Christopher J. Cueva∗, Xue-Xin Wei∗ Columbia University New York, NY 10027, USA {ccueva,weixxpku}@gmail.com
4
+
5
+ # ABSTRACT
6
+
7
+ Decades of research on the neural code underlying spatial navigation have revealed a diverse set of neural response properties. The Entorhinal Cortex (EC) of the mammalian brain contains a rich set of spatial correlates, including grid cells which encode space using tessellating patterns. However, the mechanisms and functional significance of these spatial representations remain largely mysterious. As a new way to understand these neural representations, we trained recurrent neural networks (RNNs) to perform navigation tasks in 2D arenas based on velocity inputs. Surprisingly, we find that grid-like spatial response patterns emerge in trained networks, along with units that exhibit other spatial correlates, including border cells and band-like cells. All these different functional types of neurons have been observed experimentally. The order of the emergence of grid-like and border cells is also consistent with observations from developmental studies. Together, our results suggest that grid cells, border cells and others as observed in EC may be a natural solution for representing space efficiently given the predominant recurrent connections in the neural circuits.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Understanding the neural code in the brain has long been driven by studying feed-forward architectures, starting from Hubel and Wiesel’s famous proposal on the origin of orientation selectivity in primary visual cortex (Hubel & Wiesel, 1962). Inspired by the recent development in deep learning (Krizhevsky et al., 2012; LeCun et al., 2015; Hochreiter & Schmidhuber, 1997; Mnih et al., 2015), there has been a burst of interest in applying deep feedforward models, in particular convolutional neural networks (CNN) (LeCun et al., 1998), to study the sensory systems, which hierarchically extract useful features from sensory inputs (see e.g., Yamins et al. (2014); Kriegeskorte (2015); Kietzmann et al. (2017); Yamins & DiCarlo (2016)).
12
+
13
+ For more cognitive tasks, neural systems often need to maintain certain internal representations of relevant variables in the absence of external stimuli- a process that requires more than feature extraction. We will focus on spatial navigation, which typically requires the brain to maintain a representation of self-location and update it according to the animal’s movements and landmarks of the environment. Physiological studies done in rodents and other mammals (including humans, non-human primates and bats) have revealed a variety of neural correlates of space in Hippocampus and Entorhinal Cortex (EC), including place cells (O’Keefe, 1976), grid cells (Fyhn et al., 2004; Hafting et al., 2005; Fyhn et al., 2008; Yartsev et al., 2011; Killian et al., 2012; Jacobs et al., 2013), along with border cells (Solstad et al., 2008), band-like cells (Krupic et al., 2012) and others (see Figure 1a). In particular, each grid cell only fires when the animal occupies a distinct set of physical locations, and strikingly these locations lie on a lattice. The study of the neural underpinning of spatial cognition has provided an important window into how high-level cognitive functions are supported in the brain (Moser et al., 2008; Aronov et al., 2017).
14
+
15
+ How might the spatial navigation task be solved using a network of neurons? Recurrent neural networks (RNNs) (Hochreiter & Schmidhuber, 1997; Graves et al., 2013; Oord et al., 2016; Theis & Bethge, 2015; Gregor et al., 2015; Sussillo et al., 2015) seem particularly useful for these tasks. Indeed, recurrent-based continuous attractor networks have been one popular type of models proposed for the formation of grid cells (McNaughton et al., 2006; Burak & Fiete, 2009; Couey et al., 2013) and place cells (Samsonovich & McNaughton, 1997). Such models have provided valuable insights into one set of possible mechanisms that could support the formation of the grids. However, these models typically rely on fine-tuned connectivity patterns, in particular the models need a subtle yet systematic asymmetry in the connectivity pattern to move the attractor state according to the animal’s own movement. The existence of such a specific 2D connectivity in rodent EC remains unclear. Additionally, previous models have mainly focused on grid cells, while other types of responses that co-exist in the Entorhinal Cortex have been largely ignored. It would be useful to have a unified model that can simultaneously explain different types of neural responses in EC.
16
+
17
+ Motivated by these considerations, here we present an alternative modeling approach for understanding the representation of space in the neural system. Specifically, we trained a RNN to perform some spatial navigation tasks. By leveraging the recent development in RNN training and knowledge of the navigation system in the brain, we show that training a RNN with biologically relevant constraints naturally gives rise to a variety of spatial response profiles as observed in EC, including grid-like responses. To our knowledge, this is the first study to show that grid-like responses could emerge from training a RNN to perform navigation. Our result implies that the neural representation in EC may be seen as a natural way for the brain to solve the navigation task efficiently (Wei et al., 2015). More generally, it suggests that RNNs can be a powerful tool for understanding the neural mechanisms of certain high-level cognitive functions.
18
+
19
+ ![](images/8e6f9cf7feba198b2a18d2ed284d372bf5324606db8951624994c943f119c937.jpg)
20
+ Figure 1: a) Example neural data showing different kinds of neural correlates underlying spatial navigation in EC. All figures are replotted from previous publications. From left to right: a “grid cell” recorded when an animal navigates in a square environment, replotted from Krupic et al. (2012), with the heat map representing the firing rate of this neuron as a function of the animal’s location (red corresponds to high firing rate); a “band-like” cell from Krupic et al. (2012); a border cell from Solstad et al. (2008); an irregular spatially tuned cell from Diehl et al. (2017); a “speed cell” from Kropff et al. (2015), which exhibits roughly linear dependence on the rodent’s running speed; a “heading direction cell” from Sargolini et al. (2006), which shows systematic change of firing rate depending on animal’s heading direction. b) The network consists of $N = 1 0 0$ recurrently connected units (or neurons) which receive two external inputs, representing the animal’s speed and heading direction. The two outputs linearly weight the neurons in the RNN. The goal of training is to make the responses of the two output neurons accurately represent the animal’s physical location. c) Typical trajectory after training. As shown, the output of the RNN can accurately, though not perfectly, track the animal’s location during navigation.
21
+
22
+ # 2 MODEL
23
+
24
+ # 2.1 MODEL DESCRIPTION
25
+
26
+ Our network model consists of a set of recurrently connected units $N = 1 0 0$ ). The dynamics of each unit in the network $u _ { i } ( t )$ is governed by the standard continuous-time RNN equation:
27
+
28
+ $$
29
+ \tau \frac { d x _ { i } ( t ) } { d t } = - x _ { i } ( t ) + \sum _ { j = 1 } ^ { N } W _ { i j } ^ { \mathrm { r e c } } u _ { j } ( t ) + \sum _ { k = 1 } ^ { N _ { \mathrm { i n } } } W _ { i k } ^ { \mathrm { i n } } I _ { k } ( t ) + b _ { i } + \xi _ { i } ( t )
30
+ $$
31
+
32
+ for $i = 1 , \ldots , N$ . The activity of each unit, $u _ { i } ( t )$ , is related to the activation of that unit, $x _ { i } ( t )$ , through a nonlinearity which in this study we take to be $u _ { i } ( t ) = \operatorname { t a n h } ( x _ { i } ( t ) )$ . Each unit receives input from other units through the recurrent weight matrix $W ^ { \mathrm { r e c } }$ and also receives external input, $I ( t )$ , that enters the network through the weight matrix $W ^ { \mathrm { i n } }$ . Each unit has two sources of bias, $b _ { i }$ which is learned and $\xi _ { i } ( t )$ which represents noise intrinsic to the network and is taken to be Gaussian with zero mean and constant variance. The network was simulated using the Euler method for $T = 5 0 0$ timesteps of duration $\tau / 1 0$ .
33
+
34
+ To perform a 2D navigation task with the RNN, we linearly combine the firing rates of units in the network to estimate the current location of the animal. The responses of the two linear readout neurons, $y _ { 1 } ( t )$ and $y _ { 2 } ( t )$ , are given by the following equation:
35
+
36
+ $$
37
+ y _ { j } ( t ) = \sum _ { i = 1 } ^ { N } W _ { j i } ^ { \mathrm { o u t } } u _ { i } ( t )
38
+ $$
39
+
40
+ # 2.2 INPUT TO THE NETWORK
41
+
42
+ The network inputs and outputs were inspired by simple spatial navigation tasks in 2D open environments. The task resembles dead-reckoning (sometimes referred to as path integration), which is ethologically relevant for many animal species (Darwin, 1873; Mittelstaedt & Mittelstaedt, 1980; Etienne & Jeffery, 2004; McNaughton et al., 2006). To be more specific, the inputs to the network were the animal’s speed and direction at each time step. Experimentally, it has been shown that the velocity signals exist in EC (Sargolini et al., 2006; Kropff et al., 2015; Hinman et al., 2016), and there is also evidence that such signals are necessary for grid formation (Winter et al., 2015a;b).
43
+
44
+ Throughout the paper, we adopt the common assumption that the head direction of the animal coincides with the actual moving direction. The outputs were the x- and y-coordinates of the integrated position. The direction of the animal is modeled by modified Brownian motion to increase the probability of straight-runs, in order to be consistent with the typical rodent’s behavior in an open environment. The usage of such simple movement statistics has the advantage of having full control of the simulated trajectories. However, for future work it would be very interesting to test the model using different animals’ real movement trajectories to see how the results might change.
45
+
46
+ Special care is taken when the animal is close to the boundary. The boundary of the environment will affect the statistics of the movement, as the animal cannot cross the boundary. This fact was reflected in the model by re-sampling the angular input variable until the input angle did not lead the animal outside the boundary. In the simulations shown below, the animal always starts from the center of the arena, but we verified that the results are insensitive to the starting locations.
47
+
48
+ # 2.3 TRAINING
49
+
50
+ We optimized the network parameters $W ^ { \mathrm { r e c } } , W ^ { \mathrm { i n } } ,$ , $b$ and $W ^ { \mathrm { o u t } }$ to minimize the squared error in equation (3) between target $\mathbf { X } ^ { - }$ and $_ \textrm { y }$ -coordinates from a two dimensional navigation task (performed in rectangular, hexagonal, and triangular arenas) and the network outputs generated according to equation (2).
51
+
52
+ $$
53
+ E = \frac { 1 } { M T N _ { \mathrm { o u t } } } \sum _ { m , t , j = 1 } ^ { M , T , N _ { \mathrm { o u t } } } ( y _ { j } ( t , m ) - y _ { j } ^ { \mathrm { t a r g e t } } ( t , m ) ) ^ { 2 }
54
+ $$
55
+
56
+ Parameters were updated with the Hessian-free algorithm (Martens & Sutskever, 2011) using minibatches of size $M = 5 0 0$ trials. In addition to minimizing the error function in equation (3) we regularized the input and output weights according to equation (4) and the squared firing rates of the units (referred to as metabolic cost) according to equation (5). In sum, the training aims to minimize a loss function, that consists of the error of the animal, the metabolic cost, and a penalty for large network parameters.
57
+
58
+ $$
59
+ \begin{array} { l } { { \displaystyle R _ { L 2 } = \frac { 1 } { N N _ { \mathrm { i n } } } \sum _ { i , j = 1 } ^ { N , N _ { \mathrm { i n } } } ( W _ { i j } ^ { \mathrm { i n } } ) ^ { 2 } + \frac { 1 } { N N _ { \mathrm { o u t } } } \sum _ { i , j = 1 } ^ { N _ { \mathrm { o u t } } , N } ( W _ { i j } ^ { \mathrm { o u t } } ) ^ { 2 } } } \\ { { \displaystyle R _ { F R } = \frac { 1 } { N T M } \sum _ { i , t , m = 1 } ^ { N , T , M } u _ { i } ( t , m ) ^ { 2 } } } \end{array}
60
+ $$
61
+
62
+ We find that the results are qualitatively insensitive to the initialization schemes used for the recurrent weight matrix $W ^ { \mathrm { r e c } }$ . For the results presented in this paper, simulations in the hexagonal environment were obtained by initializing the elements of $W ^ { \mathrm { r e c } }$ to be zero mean Gaussian random variables with variance $1 . 5 ^ { 2 } \dot { / } N$ , and simulations in the square and triangular environments were initialized with an orthogonal $W ^ { \mathrm { r e c } }$ (Saxe et al., 2014). We initialized the bias $b$ and output weights $W ^ { \mathrm { o u t } }$ to be zero. The elements of $W ^ { \mathrm { i n } }$ were zero mean Gaussian variables with variance $1 / N _ { \mathrm { i n } }$ .
63
+
64
+ ![](images/7cde4a241b1b10ed008d3d0dbd8d11d439e41445d8cafe267c621ecd7571dd08.jpg)
65
+ Figure 2: Different types of spatial selective responses of units in the trained RNN. Example simulation results for three different environments (square, triangular, hexagon) are presented. Blue (yellow) represents low (high) activity. a) Grid-like responses. b) Band-like responses; c) Borderrelated responses; d) Spatially irregular responses. These responses can be spatially selective but they do not form a regular pattern defined in the conventional sense.
66
+
67
+ # 3 RESULTS
68
+
69
+ We run simulation experiments in arenas with different boundary shapes, including square, triangular and hexagonal. Figure 1c shows a typical example of the model performance after training; the network (red trace) accurately tracks the animal’s actual path (black).
70
+
71
+ # 3.1 TUNING PROPERTIES OF THE MODEL NEURONS
72
+
73
+ We are mostly interested in what kind of representation the RNN has learned to solve this navigation task, and whether such a representation resembles the response properties of neurons in EC (Moser et al., 2008).
74
+
75
+ # 3.1.1 SPATIAL TUNING
76
+
77
+ To test whether the trained RNN developed location-selective representations, we plot individual neurons’ mean activity level as a function of the animal’s location during spatial exploration. Note that these average response profiles should not be confused with the linear filters typically shown in feedforward networks. Surprisingly, we find neurons in the trained RNN show a range of interesting spatial response profiles. Examination of these response profiles suggests they can be classified into distinct functional types. Importantly, as we will show, these distinct spatial response profiles can be mapped naturally to known physiology in EC. The spatial responses of all units in trained networks are shown in the Appendix.
78
+
79
+ Grid-like responses Most interestingly, we find some of the units in the RNN exhibit clear grid-like responses (Figure 2a). These firing patterns typically exhibit multiple firing fields, with each firing field exhibiting roughly circular symmetric or ellipse shape. Furthermore, the firing fields are highly structured, i.e., when combined, are arranged on a regular lattice. Furthermore, the structure of the response lattice depends on the shape of the boundary. In particular, training the network to perform self-localization in a square environment tends to give rectangular grids. In hexagonal and triangular environments, the grids are closer to triangular.
80
+
81
+ Experimentally, it is shown that (medial) EC contains so-called grid cells which exhibit multiple firing fields that lie on a regular grid (Fyhn et al., 2004; Hafting et al., 2005). The grid-like firing patterns in our simulation are reminiscent of the grid cells in rodents and other mammals. However, we also notice that the the grid-like model responses typically exhibit few periods, not as many as experimental data (see Figure 1a). It is possible that using a larger network might reveal finer grid-patterns in our model. Nonetheless, it is surprising that the gird-like spatial representations can develop in our model, given there is no periodicity in the input. Another potential concern is that, experimentally it is reported that the grids are often on the corners of a triangular lattice (Hafting et al., 2005) even in square environments (see Figure 1a), though the grids are somewhat influenced by the shape of the environment. However, the rats in these experiments presumable had spatial experience in other environments with various boundary shapes. Experimentally, it would be interesting to see if grid cells would lie on a square lattice instead if the rats are raised in a single square environment - a situation we are simulating here.
82
+
83
+ Border responses Many neurons in the RNN exhibit selectivity to the boundary (Figure 2c). Typically, they only encode a portion of the boundary, e.g. one piece of wall in a square shaped environment. Such properties are similar to the border cells discovered in rodent EC (Solstad et al., 2008; Savelli et al., 2008; Lever et al., 2009). Experimentally, border cells mainly fire along one piece of wall, although some have been observed to fire along multiple borders or along the whole boundary of the environment; interestingly, these multi-border responses were also observed in some RNN models. Currently, it is unclear how the boundary-like response profiles emerge (Solstad et al., 2008; Savelli et al., 2008; Lever et al., 2009). Our model points to the possibility that the border cells may emerge without the presence of tactile cues. Furthermore, it suggests that border cell formation may be related to the movement statistics of the animals, i.e. due to the asymmetry of the movement statistics along the boundary.
84
+
85
+ Band-like responses Interestingly, some neurons in the RNN exhibit band-like responses (Figure 2b). In most of our simulations, these bands tend to be parallel to one of the boundaries. For some of the units, one of the bands overlaps the boundary, but for others, that is not the case. Experimentally, neurons with periodic-like firing patterns have been recently reported in rodent EC. In one study, it has been reported that a substantial portion of cells in EC exhibit band-like firing characteristics (Krupic et al., 2012). However, we note that based on the reported data in Krupic et al. (2012), the band pattern is not as clear as in our model.
86
+
87
+ Spatially-stable but non-regular responses Besides the units described above, most of the remaining units also exhibit stable spatial responses, but they do not belong to the above categories. These response profiles can exhibit either one large irregular firing field; or multiple circular firing fields, but these firing fields do not show a regular pattern. Experimentally these types of cells have also been observed. In fact, it is recently reported that the non-grid spatial cells constitute a large portion of the neurons in Layer II and III of rodent EC (Diehl et al., 2017).
88
+
89
+ # 3.1.2 SPEED TUNING AND HEAD DIRECTION TUNING
90
+
91
+ Speed tuning We next ask how neurons in the RNN are tuned to the inputs. Many of the model neurons exhibit linear responses to the running speed of the animal, while some neurons show no selectivity to speed, as suggested by the near-flat response functions. Example response profiles are shown in Figure 3. Interestingly, we observe that the model border cells tend to have almost zero speed-tuning (e.g., see Figure 3g,h).
92
+
93
+ ![](images/318a67b1eb08bdf270e30eebad468380d0e5a80e744e9f80d58a5d693f3a94ed.jpg)
94
+ Figure 3: Direction tuning and speed tuning for nine example units in an RNN trained in a triangular arena. For each unit, we show the spatial tuning, (head) directional tuning, speed tuning respectively, from left to right. a,b,c) The three model neurons show strong directional tuning, but the spatial tuning is weak and irregular. The three neurons also exhibit linear speed tuning. d,e,f) The three neurons exhibit grid-like firing patterns, and clear speed tuning. The strength of their direction tuning differ. ${ \bf g } , { \bf h } )$ Border cells exhibit weak and a bit complex directional tuning and almost no speed tuning. i) This band cell shows weak directional tuning, but strong speed tuning.
95
+
96
+ Head direction tuning A substantial portion of the model neurons show direction tuning. There are a diversity of direction tuning profiles, both in terms of the strength of the tuning and their preferred direction. Example tuning curves are shown in Figure 3, and the direction tuning curves of a complete population are shown in the Appendix. Interestingly, in general model neurons which show the strongest head direction tuning do not show a clear spatial firing pattern (see Figure 3a,b,c). This suggests that there are a group of neurons which are mostly responsible for encoding the direction. We also notice that neurons with clear grid-like firing can exhibit a variety of direction tuning strengths, from weak to strong (Figure 3d,e,f). In the Appendix, we quantify the relation between these different tuning properties at the whole population level, which show somewhat complex dependence.
97
+
98
+ Experimentally, the heading direction tuning in EC is well-known, e.g., Sargolini et al. (2006). Both the grid and non-grid cells in EC exhibit head direction tuning (Sargolini et al., 2006). Furthermore, the linear speed dependence of the model neurons is similar to the properties of speed cells reported recently in EC (Kropff et al., 2015). Our result is also consistent with another recent study reporting that the majority of neurons in EC exhibit some amount of speed tuning (Hinman et al., 2016). It remains an open question experimentally, at a population level, how different types of tuning characteristics in EC relate to each other.
99
+
100
+ # 3.1.3 DEVELOPMENT OF THE TUNING PROPERTIES
101
+
102
+ We next investigate how the spatial response profiles evolve as learning/training progresses. We report two main observations. First, neurons that fire selectively along the boundary typically emerge first. Second, the grid-like responses with finer spatial tuning patterns only emerge later in training. For visualization, we perform dimensionality reduction using the t-SNE algorithm (Maaten & Hinton, 2008). This algorithm embeds 100 model neurons during three phases of training (early, intermediate, and late) into a two-dimensional space according to the similarity of their temporal responses. Here the similarity metric is taken to be firing rate correlation. In this 2D space as shown in Figure 4a, border cell representations appear early and stably persist through the end of training. Furthermore, early during training all responses are similar to the border related responses. In contrast, grid-like cells typically undergo a substantial change in firing pattern during training before settling into their final grid-like representation (Figure 4b).
103
+
104
+ The developmental time line of the grid-like cells and border cells is roughly consistent with developmental studies in rodents. Experimentally, it is known that border cells emerge earlier in development, and they exist at about 2 weeks after the rat is born (Bjerknes et al., 2014). The grid cells mature only at about 4 weeks after birth (Langston et al., 2010; Wills et al., 2010; Bjerknes et al., 2014). Furthermore, our simulations suggest the reason why border cells emerge earlier in development may be that computationally it is easier to wire-up a network that gives rise to border cell responses.
105
+
106
+ ![](images/9c19816ea23656a00f78df190e6e407bf4c84fe0856a9d69293f60f5972dfa0a.jpg)
107
+ Figure 4: Development of border cells and grid-like cells. Early during training all responses are similar to the border related responses, and only as training continues do the grid-like cells emerge. We perform dimensionality reduction using the t-SNE algorithm on the firing rates of the neurons. Each dot represents one neuron $N = 1 0 0$ ), and the color represents different training stages (early/intermediate/late shown in blue/cyan/yellow). Each line shows the trajectory of a single highlighted neuron as its firing responses evolve during training. In panel a), we highlight the border representation. It appears there are four clusters of border cells, each responding to one wall of a square environment (spatial responses from four of these border cells are inset). These cells’ response profiles appear early and stably persist through training, illustrated by the short distance they travel in this space. In b), we show that the neurons which eventually become grid cells initially have tuning profiles similar to the border cells but then change their tuning substantially during learning. As a natural consequence, they need to travel a long distance in this space between the early and late phase of the training. Spatial responses are shown for four of these grid-like cells during the late phase of training.
108
+
109
+ # 3.2 THE IMPORTANCE OF REGULARIZATION
110
+
111
+ We find appropriate regularizations of the RNN to be crucial for the emergence of grid-like representations. We only observed grid-like representations when the network was encouraged to store information while perturbed by noise. This was accomplished by setting the speed input to zero, e.g. zero speed $90 \%$ of the time, and adding Gaussian noise to the network $\xi _ { i } ( t )$ in equation (1)); the precise method for setting the speed input to zero and the value of the noise variance is not crucial for our simulations to develop grid-like representations. The cost function which aims to capture the penalization on the metabolic cost of the neural activity also acts as an important regularization. Our simulations show that the grid-like representation did not emerge without this metabolic cost. In Figure 5, we show typical simulation results for a square environment, with and without proper metabolic regularization. In the Appendix, we illustrate the effect of regularization further, in particular the role of injecting noise into the RNN units.
112
+
113
+ Our results are consistent with the general notion on the importance of incorporating proper constraint for learning useful representations in neural networks (Bengio et al., 2013). Furthermore, it suggests that, to learn a model with response properties similar to neural systems it may be necessary to incorporate the relevant constraints, e.g., noise and metabolic cost.
114
+
115
+ # 3.3 ERROR CORRECTION AROUND THE BOUNDARY
116
+
117
+ One natural question is whether the trained RNNs are able to perform localization when the path length exceeds the typical length used during training (500 steps), in particular given that noise in the network would gradually accumulate, leading to a decrease in localization performance. We test this by simulating paths that are several orders of magnitude longer. Somewhat surprisingly, we find the RNNs still perform well (Figure 6b). In fact, the squared error (averaged over every 10000 steps) is stable. The spatial response profiles of individual units also remain stable. This implies that the RNNs have acquired intrinsic error-correction mechanisms during training.
118
+
119
+ ![](images/476435913a7b64388291eece485ed2e49a2bc8befbf4d07d7b0df7b3c97e20d4.jpg)
120
+ Figure 5: Complete set of spatial response profiles for 100 neurons in a RNN trained in a square environment. a) Without proper regularization, complex and periodic spatial response patterns do not emerge. b) With proper regularization, a rich set of periodic response patterns emerge, including grid-like responses. Regularization can also be adjusted to achieve spatial profiles intermediate between these two examples.
121
+
122
+ ![](images/1313022c4e140eff6c754917cddc7b20c35899670d67ff7b351c56f3f49df4d8.jpg)
123
+ Figure 6: Error-correction happens at the boundary and the error is stable over time. At the boundary, the direction is resampled to avoid input velocities that lead to a path extending beyond the boundary of the environment. These changing input statistics at the boundary, termed a boundary interaction, are the only cue the RNN receives about the boundary. We find that the RNN uses the boundary interactions to correct the accumulated error between the true integrated input and its prediction based on the linear readout of equation (2). Panel a), the mean squared error increases when there are no boundary interactions, but then decreases after a boundary interaction, with more boundary interactions leading to greater error reduction. In the absence of further boundary interaction, the squared error would gradually increase again (blue curve) at roughly a constant rate. b) The network was trained using mini-batches of 500 timesteps but has stable error over a duration at least four orders of magnitude larger. The error of the RNN output (mean and standard deviation shown in black, computed based on 10000 timesteps) is compared to the error that would be achieved by an RNN outputting the best constant values (red).
124
+
125
+ As shown earlier, during training some of the RNN units develop boundary-related firing (Figure 2c), presumably by exploiting the change of input statistics around the boundary. We hypothesize that boundary interactions may enable error-correction through signals based on these boundary-related activities. Indeed, we find that boundary interactions can dramatically reduce the accumulated error (Figure 6a). Figure 6a shows that, without boundary interactions, on average the squared error grows roughly linearly as expected, however, interactions with the boundaries substantially reduce the error, and more frequent boundary interactions can reduce the error further. Error-correction on grid cells via boundary interactions has been proposed (Hardcastle et al., 2015; Pollock et al., 2017), however, we emphasize that the model proposed here develops the grid-like responses, boundary responses and the error-correction mechanisms all within the same neural network, thus potentially providing a unifying account of a diverse set of phenomena.
126
+
127
+ # 4 DISCUSSION
128
+
129
+ In this paper, we trained RNNs to perform path integration (dead-reckoning) in 2D arenas. We found that after training RNNs with appropriate regularization, the model neurons exhibit a variety of spatial and velocity tuning profiles that match neurophysiology in EC. What’s more, there is also similarity in terms of when these distinct neuron types emerge during training/development. The EC has long been thought to be involved in path integration and localization of the animal’s location (Moser et al., 2008). The general agreement between the different response properties in our model and the neurophysiology provide strong evidence supporting the hypothesis that the neural population in EC may provide an efficient code for representation self-locations based on the velocity input.
130
+
131
+ Recently, there has been increased interest in using complex neural network models to understand the neural code. But the focus has been on using feedforward architectures, in particular CNNs (LeCun et al., 1998). Given the abundant recurrent connections in the brain, it seems a particularly fruitful avenue to take advantage of the recent development in RNNs to help with neuroscience questions (Mante et al., 2013; Song et al., 2016; Miconi, 2017; Sussillo et al., 2015). Here, we only show one instance following this approach. However, the insight from this work could be general, and potentially useful for other cognitive functions as well.
132
+
133
+ The finding that metabolic constraints lead to the emergence of grid-like responses may be seen as conceptually related to the efficient coding hypothesis in visual processing (Barlow, 1961), in particular the seminal work on the emergence of the V1-like Gabor filters in a sparse coding model by Olshausen & Field (1996). Indeed, our work is partly inspired by these results. While there are conceptual similarities, however, we should also note there are differences between the sparse coding work and ours. First, the sparsity constraint in sparse coding can be naturally viewed as a particular prior while in the context of the recurrent network, it is difficult to interpret that way. Second, the grid-like responses are not the most sparse solution one could imagine. In fact, they are still quite dense compared to a more spatially localized representation. Third, the grid-like patterns that emerged in our network are not filters based on the raw input, rather the velocity inputs need to be integrated first in order to encode spatial locations. Our work is also inspired by recent work using the efficient coding idea to explain the functional architecture of the grid cells (Wei et al., 2015). It has been shown that efficient coding considerations could explain the particular set of grid scales observed in rodents (Stensola et al., 2012). However, in that work, the firing patterns of the neurons are assumed to have a lattice structure to start with. Furthermore, our work is related to the study by Sussillo and others (Sussillo et al., 2015), in which they show that regularization of RNN models are important for generating solutions that are similar to the neural activity observed in motor cortex. In Sussillo et al., a smoothness constraint together with others lead to simple oscillatory neural dynamics that well matches the neural data. We have not incorporated a smoothness constraint into our network.
134
+
135
+ Additionally, we note that there are a few recent studies which use place cells as the input to generate grid cells (Dordek et al., 2016; Stachenfeld et al., 2016), which are fundamentally different from our work. In these feedforward network models, the grid cells essentially perform dimensionality reduction based on the spatial input from place cells. However, the main issue with these models is that, it is unclear how place cells acquire spatial tuning in the first place. To the contrary, our model takes the animal’s velocity as the input, and addresses the question of how the spatial tuning can be generated from such input, which are known to exist in EC (Sargolini et al., 2006; Kropff et al., 2015). In another related study (Kanitscheider & Fiete, 2016), the authors train a RNN with
136
+
137
+ LSTM units (Hochreiter & Schmidhuber, 1997) to perform different navigation tasks. However, no grid-like spatial firing patterns are reported.
138
+
139
+ Although our model shows a qualitative match to the neural responses observed in the EC, nonetheless it has several major limitations, with each offering interesting future research directions. First, the learning rule we use seems to be biologically implausible. We are interested in exploring how a more biologically plausible learning rule could give rise to similar results (Lillicrap et al., 2016; Miconi, 2017; Guerguiev et al., 2017). Second, the simulation results do not show a variety of spatial scales in grid-like cells. Experimentally, it is known that grid cells have multiple spatial scales, that scale geometrically with a ratio 1.4 (Stensola et al., 2012), and this particular scale ratio is predicted by efficient coding of space (Wei et al., 2015). We are investigating how to modify the model to get a hierarchy of spatial scales, perhaps by incorporating more neurons or modifying the regularization. Last but not least, we have focused on the representation produced by the trained RNN. An equally important set of questions concern how the networks actually support the generation of such a representation. As a preliminary effort, we have examined the connectivity patterns of the trained network, and they do not seem to resemble the connectivity patterns required by standard attractor network models. Maybe this should not be seen as too surprising. After all, the trained networks can produce a diverse set of neural responses, while the previous models only led to grid responses. It would be interesting for future work to systematically examine the questions related to the underlying mechanisms.
140
+
141
+ # 5 ACKNOWLEDGEMENTS
142
+
143
+ We thank members of the Center for Theoretical Neuroscience at Columbia University for useful discussions and three anonymous reviewers for constructive feedback. Research supported by NSF NeuroNex Award DBI-1707398 and NIH training grant 5T32NS064929 (CJC).
144
+
145
+ # REFERENCES
146
+
147
+ Dmitriy Aronov, Rhino Nevers, and David W Tank. Mapping of a non-spatial dimension by the hippocampalentorhinal circuit. Nature, 2017.
148
+
149
+ Horace B Barlow. Possible principles underlying the transformation of sensory messages. Sensory communication, pp. 217–234, 1961.
150
+
151
+ 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.
152
+
153
+ Tale L Bjerknes, Edvard I Moser, and May-Britt Moser. Representation of geometric borders in the developing rat. Neuron, 82(1):71–78, 2014.
154
+
155
+ Yoram Burak and Ila R Fiete. Accurate path integration in continuous attractor network models of grid cells. PLoS computational biology, 5(2):e1000291, 2009.
156
+
157
+ Jonathan J Couey, Aree Witoelar, Sheng-Jia Zhang, Kang Zheng, Jing Ye, Benjamin Dunn, Rafal Czajkowski, May-Britt Moser, Edvard I Moser, Yasser Roudi, et al. Recurrent inhibitory circuitry as a mechanism for grid formation. Nature neuroscience, 16(3):318–324, 2013.
158
+
159
+ Charles Darwin. Origin of certain instincts. Nature, 7:417–418, 1873.
160
+
161
+ Geoffrey W Diehl, Olivia J Hon, Stefan Leutgeb, and Jill K Leutgeb. Grid and nongrid cells in medial entorhinal cortex represent spatial location and environmental features with complementary coding schemes. Neuron, 94(1):83–92, 2017.
162
+
163
+ Yedidyah Dordek, Daniel Soudry, Ron Meir, and Dori Derdikman. Extracting grid cell characteristics from place cell inputs using non-negative principal component analysis. eLife, 5:e10094, 2016.
164
+
165
+ Ariane S Etienne and Kathryn J Jeffery. Path integration in mammals. Hippocampus, 14(2):180– 192, 2004.
166
+
167
+ Marianne Fyhn, Sturla Molden, Menno P Witter, Edvard I Moser, and May-Britt Moser. Spatial representation in the entorhinal cortex. Science, 305(5688):1258–1264, 2004.
168
+
169
+ Marianne Fyhn, Torkel Hafting, Menno P Witter, Edvard I Moser, and May-Britt Moser. Grid cells in mice. Hippocampus, 18(12):1230–1238, 2008.
170
+
171
+ Alex Graves, Abdel-Rahman Mohamed, and Geoffrey Hinton. Speech recognition with deep recurrent neural networks. In Acoustics, speech and signal processing (icassp), 2013 ieee international conference on, pp. 6645–6649. IEEE, 2013.
172
+
173
+ Karol Gregor, Ivo Danihelka, Alex Graves, Danilo Jimenez Rezende, and Daan Wierstra. Draw: A recurrent neural network for image generation. arXiv preprint arXiv:1502.04623, 2015.
174
+
175
+ Jordan Guerguiev, Timothy P Lillicrap, and Blake A Richards. Towards deep learning with segregated dendrites. eLife, 6, 2017.
176
+
177
+ Torkel Hafting, Marianne Fyhn, Sturla Molden, May-Britt Moser, and Edvard I Moser. Microstructure of a spatial map in the entorhinal cortex. Nature, 436(7052):801–806, 2005.
178
+
179
+ Kiah Hardcastle, Surya Ganguli, and Lisa M Giocomo. Environmental boundaries as an error correction mechanism for grid cells. Neuron, 86(3):827–839, 2015.
180
+
181
+ James R Hinman, Mark P Brandon, Jason R Climer, G William Chapman, and Michael E Hasselmo. Multiple running speed signals in medial entorhinal cortex. Neuron, 91(3):666–679, 2016.
182
+
183
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
184
+
185
+ David H Hubel and Torsten N Wiesel. Receptive fields, binocular interaction and functional architecture in the cat’s visual cortex. The Journal of physiology, 160(1):106–154, 1962.
186
+
187
+ Joshua Jacobs, Christoph T Weidemann, Jonathan F Miller, Alec Solway, John F Burke, Xue-Xin Wei, Nanthia Suthana, Michael R Sperling, Ashwini D Sharan, Itzhak Fried, et al. Direct recordings of grid-like neuronal activity in human spatial navigation. Nature neuroscience, 16(9):1188– 1190, 2013.
188
+
189
+ Ingmar Kanitscheider and Ila Fiete. Training recurrent networks to generate hypotheses about how the brain solves hard navigation problems. arXiv preprint arXiv:1609.09059, 2016.
190
+
191
+ Tim Christian Kietzmann, Patrick McClure, and Nikolaus Kriegeskorte. Deep neural networks in computational neuroscience. bioRxiv, pp. 133504, 2017.
192
+
193
+ Nathaniel J Killian, Michael J Jutras, and Elizabeth A Buffalo. A map of visual space in the primate entorhinal cortex. Nature, 491(7426):761–764, 2012.
194
+
195
+ Nikolaus Kriegeskorte. Deep neural networks: a new framework for modeling biological vision and brain information processing. Annual Review of Vision Science, 1:417–446, 2015.
196
+
197
+ 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.
198
+
199
+ Emilio Kropff, James E Carmichael, May-Britt Moser, and Edvard I Moser. Speed cells in the medial entorhinal cortex. Nature, 523(7561):419–424, 2015.
200
+
201
+ Julija Krupic, Neil Burgess, and John O?Keefe. Neural representations of location composed of spatially periodic bands. Science, 337(6096):853–857, 2012.
202
+
203
+ Rosamund F Langston, James A Ainge, Jonathan J Couey, Cathrin B Canto, Tale L Bjerknes, Menno P Witter, Edvard I Moser, and May-Britt Moser. Development of the spatial representation system in the rat. Science, 328(5985):1576–1580, 2010.
204
+
205
+ 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.
206
+
207
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 521(7553):436–444, 2015.
208
+
209
+ Colin Lever, Stephen Burton, Ali Jeewajee, John O’Keefe, and Neil Burgess. Boundary vector cells in the subiculum of the hippocampal formation. The journal of neuroscience, 29(31):9771–9777, 2009.
210
+
211
+ Timothy P Lillicrap, Daniel Cownden, Douglas B Tweed, and Colin J Akerman. Random synaptic feedback weights support error backpropagation for deep learning. Nature communications, 7, 2016.
212
+
213
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 9(Nov):2579–2605, 2008.
214
+
215
+ Valerio Mante, David Sussillo, Krishna V Shenoy, and William T Newsome. Context-dependent computation by recurrent dynamics in prefrontal cortex. Nature, 503(7474):78–84, 2013.
216
+
217
+ James Martens and Ilya Sutskever. Learning recurrent neural networks with hessian-free optimization. pp. 10331040, 2011.
218
+
219
+ Bruce L McNaughton, Francesco P Battaglia, Ole Jensen, Edvard I Moser, and May-Britt Moser. Path integration and the neural basis of the ’cognitive map’. Nature Reviews Neuroscience, 7(8): 663–678, 2006.
220
+
221
+ Thomas Miconi. Biologically plausible learning in recurrent neural networks reproduces neural dynamics observed during cognitive tasks. eLife, 6:e20899, 2017.
222
+
223
+ M-L Mittelstaedt and H Mittelstaedt. Homing by path integration in a mammal. Naturwissenschaften, 67(11):566–567, 1980.
224
+
225
+ 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.
226
+
227
+ Edvard I Moser, Emilio Kropff, and May-Britt Moser. Place cells, grid cells, and the brain’s spatial representation system. Annu. Rev. Neurosci., 31:69–89, 2008.
228
+
229
+ John O’Keefe. Place units in the hippocampus of the freely moving rat. Experimental neurology, 51 (1):78–109, 1976.
230
+
231
+ Bruno A Olshausen and David J Field. Emergence of simple-cell receptive field properties by learning a sparse code for natural images. Nature, 381(6583):607, 1996.
232
+
233
+ Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. arXiv preprint arXiv:1601.06759, 2016.
234
+
235
+ Eli Pollock, Niral Desai, Xue-Xin Wei, and Vijay B Balasubramanian. A mechanism for selforganized error-correction of grid cells by border cells. CoSyNe abstract, 2017.
236
+
237
+ Alexei Samsonovich and Bruce L McNaughton. Path integration and cognitive mapping in a continuous attractor neural network model. Journal of Neuroscience, 17(15):5900–5920, 1997.
238
+
239
+ Francesca Sargolini, Marianne Fyhn, Torkel Hafting, Bruce L McNaughton, Menno P Witter, MayBritt Moser, and Edvard I Moser. Conjunctive representation of position, direction, and velocity in entorhinal cortex. Science, 312(5774):758–762, 2006.
240
+
241
+ Francesco Savelli, D Yoganarasimha, and James J Knierim. Influence of boundary removal on the spatial representations of the medial entorhinal cortex. Hippocampus, 18(12):1270, 2008.
242
+
243
+ Andrew M Saxe, James L McClelland, and Surya Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. 2014.
244
+
245
+ Trygve Solstad, Charlotte N Boccara, Emilio Kropff, May-Britt Moser, and Edvard I Moser. Representation of geometric borders in the entorhinal cortex. Science, 322(5909):1865–1868, 2008.
246
+
247
+ H Francis Song, Guangyu R Yang, and Xiao-Jing Wang. Training excitatory-inhibitory recurrent neural networks for cognitive tasks: A simple and flexible framework. PLoS Comput Biol, 12(2): e1004792, 2016.
248
+
249
+ Kimberly Lauren Stachenfeld, Matthew M Botvinick, and Samuel J Gershman. The hippocampus as a predictive map. bioRxiv, pp. 097170, 2016.
250
+
251
+ Hanne Stensola, Tor Stensola, Trygve Solstad, Kristian Frøland, May-Britt Moser, and Edvard I Moser. The entorhinal grid map is discretized. Nature, 492(7427):72–78, 2012.
252
+
253
+ David Sussillo, Mark M Churchland, Matthew T Kaufman, and Krishna V Shenoy. A neural network that finds a naturalistic solution for the production of muscle activity. Nature neuroscience, 18(7): 1025–1033, 2015.
254
+
255
+ Lucas Theis and Matthias Bethge. Generative image modeling using spatial lstms. In Advances in Neural Information Processing Systems, pp. 1927–1935, 2015.
256
+
257
+ Xue-Xin Wei, Jason Prentice, and Vijay Balasubramanian. A principle of economy predicts the functional architecture of grid cells. Elife, 4:e08362, 2015.
258
+
259
+ B Willmore and DJ Tolhurst. Characterizing the sparseness of neural codes. Network, 12:255–270, 2001.
260
+
261
+ Tom J Wills, Francesca Cacucci, Neil Burgess, and John O’keefe. Development of the hippocampal cognitive map in preweanling rats. Science, 328(5985):1573–1576, 2010.
262
+
263
+ Shawn S. Winter, Benjamin J. Clark, and Jeffrey S. Taube. Disruption of the head direction cell network impairs the parahippocampal grid cell signal. Science, 347(6224):870–874, 2015a.
264
+
265
+ Shawn S. Winter, Max L. Mehlman, Benjamin J. Clark, and Jeffrey S. Taube. Passive transport disrupts grid signals in the parahippocampal cortex. Current Biology, 25:2493–2502, 2015b.
266
+
267
+ Daniel LK Yamins and James J DiCarlo. Using goal-driven deep learning models to understand sensory cortex. Nature neuroscience, 19(3):356–365, 2016.
268
+
269
+ Daniel LK Yamins, Ha Hong, Charles F Cadieu, Ethan A Solomon, Darren Seibert, and James J DiCarlo. Performance-optimized hierarchical models predict neural responses in higher visual cortex. Proceedings of the National Academy of Sciences, 111(23):8619–8624, 2014.
270
+
271
+ Michael M Yartsev, Menno P Witter, and Nachum Ulanovsky. Grid cells without theta oscillations in the entorhinal cortex of bats. Nature, 479(7371):103–107, 2011.
272
+
273
+ # A TRIANGULAR ENVIRONMENT
274
+
275
+ ![](images/9fec0b40f547311967f788a5e33c37ca83be210239a76a72034b231f75f6b016.jpg)
276
+
277
+ ![](images/76d7068d3c86954df82911a198a111d047595eeb46564b8603a26da4acf15c38.jpg)
278
+
279
+ Noise and metabolic cost are important for grid-like representations. The figure on the left shows the spatial responses for a network trained with noise and no metabolic cost. The figure on the right shows the spatial responses for a network trained with no noise and the metabolic cost.
280
+
281
+ ![](images/ace176f80461890db9b194a0b86e5c7936f97026efec6348b0297c43783b3061.jpg)
282
+
283
+ # B RECTANGULAR ENVIRONMENT
284
+
285
+ ![](images/fad2d973408af95191597a5e409766654c8b3a9862f0ad4f2a8de04f639ad5ee.jpg)![](images/97fb3c206da8fbace0f4d8eeba7efe4308290448d5d9e2cba584838472b30abd.jpg)
286
+
287
+ Speed input
288
+
289
+ # C HEXAGONAL ENVIRONMENT
290
+
291
+ ![](images/d7c955da2b4d05471ca42b23f6a780ea605e2aed77c7b520059872b81c33fead.jpg)
292
+
293
+ ![](images/64fe9f96b9155e2bd1b22d7a344f3085ff647a473ca40df4a123eb8758cf0801.jpg)
294
+
295
+ Angular input (0 to 360 degrees)
296
+
297
+ Speed tuning
298
+
299
+ ![](images/7eb735c5ab485558870c8b0720dd627699e69018e8cbacfa58c8d343cfc8a2d1.jpg)
300
+ Speed input
301
+
302
+ To quantify the speed selectivity of each unit we first fit a line to the tuning curve of unit activity as a function of speed. The speed selectivity is the absolute value of the slope. If the unit activity is not modulated by speed then the speed selectivity is 0. To quantify the direction selectivity of each unit we calculated the average unit activity as a function of direction input and then took the maximum minus minimum of this tuning curve. If the unit activity is not modulated by direction then the direction selectivity is 0. To quantify the spatial selectivity we used lifetime sparseness (Willmore & Tolhurst, 2001). If the unit activity is not modulated by spatial location then the spatial selectivity is 0. Each dot in the figures below show the selectivity for a single unit.
303
+
304
+ ![](images/7d81c0e39724fab8f48b0863c121f5336b8e91d07c652f62dff58ab0d2f8945e.jpg)
305
+
306
+ # E ADDITIONAL TRAINING DETAILS
307
+
308
+ During training we tried to balance all three terms we were minimizing $( E , R _ { L 2 }$ , and $R _ { F R }$ ) so no single term was neglected or dominated. At the beginning of training we weighted the regularization term $R _ { L 2 }$ to be equal to the error function $E$ and then decreased the weighting on $R _ { L 2 }$ according to the schedule used by Martens & Sutskever (2011). We adaptively adjusted the weighting on $R _ { F R }$ , starting from an initial value of $E / 1 0$ and enforcing an upper bound of $E / 3$ as training progressed. We found this training procedure improved training performance and led to more interesting representations.
md/train/B1em9h4KDS/B1em9h4KDS.md ADDED
@@ -0,0 +1,388 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GENERATIVE IMPUTATION AND STOCHASTIC PREDICTION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ In many machine learning applications, we are faced with incomplete datasets. In the literature, missing data imputation techniques have been mostly concerned with filling missing values. However, the existence of missing values is synonymous with uncertainties not only over the distribution of missing values but also over target class assignments that require careful consideration. In this paper, we propose a simple and effective method for imputing missing features and estimating the distribution of target assignments given incomplete data. In order to make imputations, we train a simple and effective generator network to generate imputations that a discriminator network is tasked to distinguish. Following this, a predictor network is trained using the imputed samples from the generator network to capture the classification uncertainties and make predictions accordingly. The proposed method is evaluated on CIFAR-10 image dataset as well as three real-world tabular classification datasets, under different missingness rates and structures. Our experimental results show the effectiveness of the proposed method in generating imputations as well as providing estimates for the class uncertainties in a classification task when faced with missing values.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ While a large body of the machine learning literature is built upon the assumption of having access to complete datasets, in many real-world problems only incomplete datasets are available. The existence of missing values can be due to many different causes such as human subjects not adhering to certain questions or features not being collected frequently due to financial or experimental limitations, sensors failures, and so forth. Data imputation techniques have been suggested as a solution to bridge this gap in the literature by replacing missing values with observed values.
12
+
13
+ Missing data imputation approaches can be categorized into single and multiple imputation methods. Single imputation methods try to replace each missing value with a plausible value that is the best fit given the value of other correlated features and knowledge extracted from the dataset (Hastie et al., 1999; Anderson, 1957). While these methods are easy to implement and use in practice, imputed values may induce bias by eliminating less likely but important values. Also, these methods do not suggest a way to measure to what extent the imputed values are representative of the missing values (Little & Rubin, 2019).
14
+
15
+ Multiple imputation (MI) techniques, as suggested by the name, try to use multiple imputed values to impute each missing value. The result would be having a set of imputed datasets that enables measuring how consistent and statistically significant are the results of the experiments (Rubin, 1976). While MI offers interesting statistical insights about the reliability of analysis on incomplete data, the insight is imprecise as it is mainly concerned about the population of data samples rather than individual instances. Specifically, MI methods reason about the statistical properties on a limited number of imputed datasets (less than 10 in most practical implementations) on the population of samples within the dataset (Schafer & Graham, 2002; Murray et al., 2018).
16
+
17
+ The existence of missing values is synonymous with having uncertainty over these values that requires careful consideration. In many real-world applications, we are dealing with supervised problems that demand modeling and prediction based on incomplete data. Take for instance, prediction of class assignments given an image in which a large portion of the frame is missing. In such a scenario, based on observed frame parts, there might be multiple probable class assignments each having a different likelihood. Here, we are not only interested in imputing missing values or measuring how robust our imputations are, but also it is highly desirable to measure the impact of missing values on the prediction outcome for each instance.
18
+
19
+ In this paper, we propose the idea of Generative Imputation and Stochastic Prediction (GI) as a novel approach to impute missing values and to measure class uncertainties arising from the distribution of missing values. The suggested approach is based on neural networks trained using an adversarial objective function. Additionally, a predictor is trained on the generated samples from the imputer network which is able to reflect the impact of uncertainties over missing values. This enables measuring different prediction outcomes and certainties for each specific instance. We evaluate the effectiveness of the proposed method on different incomplete image and tabular datasets under various missingness structures.
20
+
21
+ # 2 RELATED WORK
22
+
23
+ One of the simplest traditional methods for handling missing values includes imputing the occurrences of missing values with constant values such as zeros or using mean values. To enhance the accuracy of such imputations, alternatives such as $\mathbf { k }$ -nearest neighbors (KNN) (Hastie et al., 1999) and maximum likelihood estimation (MLE) (Anderson, 1957) have been suggested to estimate values to be used given an observed context. While these methods are easy to implement and analyze, they often fail to capture the complex feature dependencies as well as structures present in many problems.
24
+
25
+ Rubin (1976) suggested a categorization for missingness mechanisms: missing completely at random (MCAR), missing at random (MAR), and missing not at random (MNAR). Under the assumption of MAR, the authors suggested multiple imputation (MI) as a stochastic imputation method. Here, instead of imputing missing values using a single value, several values are sampled to represent the distribution over the missing value. MI generates a few imputed complete datasets that are then used independently in statistical modeling (Schafer & Graham, 2002; Little & Rubin, 2019). Usually, the final goal of MI is to measure the robustness of the final statistical analysis amongst the imputed datasets. In other words, it measures the quality of imputations and the statistical significance of analysis on the imputed data. It should be noted that the number of imputations used in MI is usually very limited. Also, often strong simplifying assumptions are made in modeling the data distribution (e.g., multi-variate Gaussian or Student’s t distribution) which limit the applicability of this method (Schafer & Graham, 2002; Murray et al., 2018).
26
+
27
+ More recently, autoencoder architectures have been suggested as powerful density estimators capable of capturing complex distributions. Perhaps, denoising autoencoders (DAE) (Vincent et al., 2008) are one of the most intuitive approaches in which a neural network is trained to reconstruct and denoise its input. Following a more probabilistic perspective, variational autoencoders (VAE) (Kingma & Welling, 2013) try to learn the data generating distribution via a latent representation. Specifically, conditional variational autoencoders (CVAE) (Sohn et al., 2015) can be used to sample missing values conditioned on observed values. For instance, Mattei & Frellsen (2018) suggested a method based on deep latent variable models and importance sampling that offers a tighter likelihood bound compared to the standard VAE bound. While these methods are powerful generative models applicable to missing data imputation, often samples generated using autoencoders are biased toward the mode of the distribution (e.g., resulting in blurry images, for vision tasks) (Goodfellow et al., 2014; Dumoulin et al., 2016).
28
+
29
+ Recently, due to the success of generative adversarial networks (GAN), there has been great attention toward applying them to impute missing values. For instance, Yoon et al. (2018) suggested an imputation method based on adversarial and reconstruction loss terms. Li et al. (2019) introduced the idea of using separate generator and discriminator networks to learn the missing data structure and data distribution. These methods have been quite successful and are able to present the state-of-the-art results. Though it should be noted that often the presence of additional loss terms may bias the generated samples toward the mode of the distribution being modeled. Also, these methods are often complicated to be applied in practical setups by practitioners. For instance, Yoon et al. (2018) requires setting hyperparameters to adjust the influence of an MSE loss term as well as the rate of discriminator hint vectors. Also as another example, Li et al. (2019) uses three generators and three discriminators for the final imputer architecture.
30
+
31
+ ![](images/c5713bc074e138a2a20d050db7edf84f541cc471e67603e24e6900e610f80f08.jpg)
32
+ Figure 1: Block diagram of the proposed adversarial imputation method. $h$ represents the blending function of (1), and $L$ is the adversarial loss function of (2).
33
+
34
+ From the perspective of supervised analysis, imputation and handling missing values are usually considered as a preprocessing step. A few exceptions exist such as Bayesian models and decision trees that permit direct analysis on incomplete data (Nielsen & Jensen, 2009; Zhang et al., 2005). Note that while certain Bayesian methods such as probabilistic Bayesian networks allow handling of missing values as unobserved variables. However, given an incomplete training dataset and without any known causal structure as a priori, learning such models is a very challenging problem with the complexity of at least NP-complete to learn the network architecture in addition to an iterative EM optimization to learn model parameters (Darwiche, 2009; Neapolitan et al., 2004). We argue that the simplistic approach of imputing missing values as a preprocessing step discards uncertainties that exist in original incomplete data samples. Instead, there is a need for methods that reflect these uncertainties on the final predicted target distribution. This work suggests the idea of training a predictor on different imputed samples to capture the uncertainties over class assignments. Compared to MI, the suggested method interleaves imputation and training a downstream prediction model, enabling to estimate classification uncertainties for each instance.
35
+
36
+ # 3 PROPOSED METHOD
37
+
38
+ # 3.1 PROBLEM DEFINITION
39
+
40
+ In this paper, we make the general assumption of having access to an incomplete dataset $\mathcal { D }$ consisting of a set of feature vector, mask vector, and target class pairs $( { \pmb x } _ { i } , { \pmb k } _ { i } , y _ { i } )$ . For each feature vector, $\pmb { x } _ { i } \in \mathbb { R } ^ { d }$ , only a subset of the features is available. The mask vector $\pmb { k } _ { i } \in \{ 0 , 1 \} ^ { d }$ is used to indicate available features and missing features by ones and zeros, respectively. Here, to represent features as fixed-width vectors, arbitrary (or NaN) values are used to fill missing values. Also, for convenience, we often use $\pmb { x } _ { i } ^ { o b s }$ and $\pmb { x } _ { i } ^ { m i s s }$ to refer to the set of observed and missing features for the feature vector $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ .
41
+
42
+ We define our objective in two steps: $( i )$ Imputing missing values via sampling from the conditional distribution of missing features given observed features i.e., $P ( \pmb { x } _ { i } ^ { m i s s } | \pmb { x } _ { i } ^ { o b s } )$ . $( i i )$ Estimating the distribution of target classes given the observed features and the distribution of missing features i.e., $P ( y | \mathbf { x } _ { i } ^ { o b s } , \mathbf { x } _ { i } ^ { m i s s } )$ . For the first part, we are interested in sampling from the conditional distribution rather than finding the mode of the distribution as the most probable imputation. Similarly, for the second part, we are interested in obtaining a distribution over the possible target assignments and the confidence of each class rather than maximum likelihood class assignments.
43
+
44
+ # 3.2 GENERATIVE IMPUTATION
45
+
46
+ To generate samples from the distribution of missing features conditioned on the observed features, we follow the idea first suggested by Yoon et al. (2018). In this paradigm, a generator network is responsible for generating imputations while a discriminator is trying to distinguish imputed features from observed features (see Figure 1).
47
+
48
+ Specifically, the generator function $G ( \pmb { x } _ { i } , \pmb { k } _ { i } , z ) \in \mathbb { R } ^ { d }$ generates an imputed feature vector, based on observed features, the corresponding mask, and a Gaussian noise vector $( z )$ . Note that, in order to achieve the final imputed vector, $\widehat { \pmb { x } } _ { i }$ , we blend (or, merge) the output of the generator with the input features to replace generated values with the exact values of observed features:
49
+
50
+ $$
51
+ \begin{array} { r } { \widehat { \pmb { x } } _ { i , j } = \left\{ \begin{array} { l l } { \pmb { x } _ { i , j } } & { \mathrm { i f } ~ \pmb { k } _ { i , j } = 1 } \\ { G ( \pmb { x } _ { i } , \pmb { k } _ { i } , z ) _ { j } } & { \mathrm { i f } ~ \pmb { k } _ { i , j } = 0 } \end{array} \right. , } \end{array}
52
+ $$
53
+
54
+ where $\mathbf { \delta } _ { \mathbf { x } _ { i , j } }$ refers to $j ^ { : }$ ’th feature of sample $i$ . Also, note that by sampling $_ { z }$ multiple times, we can obtain different imputation samples from the conditional distribution indicated by $\widehat { \pmb { x } } _ { i } ^ { l }$ where $l$ is the sample number.
55
+
56
+ A discriminator network, $D ( \widehat { \mathbf { x } } _ { i } )$ , is trained to distinguish real and imputed features by generating a predicted softmax mask output, $\widehat { \pmb { k } } _ { i }$ . Here a binary cross-entropy loss per mask element is used as the adversarial objective function:
57
+
58
+ $$
59
+ \operatorname* { m a x } _ { G } \operatorname* { m i n } _ { D } L ( G , D ) = \mathbb { E } _ { k \sim \mathcal { D } , \widehat { k } \sim D ( G ( x , k , z ) ) } \ [ k ^ { T } \log ( \widehat { k } ) \ + \ ( 1 - k ) ^ { T } \log ( 1 - \widehat { k } ) ] .
60
+ $$
61
+
62
+ The intuition behind this adversarial loss function is that given a generator function which captures the data distribution successfully, the discriminator would not be able to distinguish the parts of the feature vector that were originally missing.
63
+
64
+ Compared to Yoon et al. (2018), the objective function of (2) does not have an MSE loss term. Instead, we use recent advances in GAN stabilization and training to improve the training process (see Section 3.4). While it is quite prevalent in the adversarial learning literature to use additional loss terms such as mean squared error (MSE) to enhance the quality of generated samples, we decided to keep our solution as simple as possible. Additionally, in our experiments, we provide supporting evidence that this simple loss function enables us to sample from the conditional distribution and prevents biased inclinations toward distribution modes.
65
+
66
+ # 3.3 STOCHASTIC PREDICTION
67
+
68
+ To capture the distribution of target classes given incomplete data, we suggest the idea of stochastic prediction. As indicated in the previous section, the generator can be used to sample from the conditional distribution. Here, a predictor is trained based on the imputed samples to predict class assignments and to calculate the confidence of these assignments. For instance, for a specific test sample at hand, if a certain missing feature is a strong indicator of the target class, we would like to observe the impact of different imputations for that feature on the final hypothesis.
69
+
70
+ Formally, we are interested in finding the certainty of class assignments given observed features:
71
+
72
+ $$
73
+ \Psi = P ( y | \mathbf { x } _ { i } ^ { o b s } ) .
74
+ $$
75
+
76
+ Here, $\Psi$ is a vector where each element is representing a certain class. Rewriting (3) as a marginal we have:
77
+
78
+ $$
79
+ \Psi = \int P ( \pmb { x } _ { i } ^ { m i s s } ) P ( y | \pmb { x } _ { i } ^ { o b s } , \pmb { x } _ { i } ^ { m i s s } ) d \pmb { x } _ { i } ^ { m i s s } .
80
+ $$
81
+
82
+ Approximating the integration using a summation, given enough samples, $\Psi$ can be estimated by:
83
+
84
+ $$
85
+ \Psi \approx \frac { 1 } { N } \sum P ( y | \pmb { x } _ { i } ^ { o b s } , \widehat { \pmb { x } } _ { i } ^ { m i s s } ) ,
86
+ $$
87
+
88
+ where $\widehat { \pmb { x } } _ { i } ^ { m i s s }$ are samples taken from the conditional distribution of missing features given observed bones. We use the suggested generative imputation method to generate samples required for this approximation. Rewriting (1) using Hadamard product and as function of the noise vector:
89
+
90
+ $$
91
+ \widehat { \mathbf { x } } _ { i } = \pmb { k } _ { i } \odot \pmb { x } _ { i } + \left( 1 - \pmb { k } _ { i } \right) \odot G ( \pmb { x } _ { i } , \pmb { k } _ { i } , z )
92
+ $$
93
+
94
+ Assuming that a predictor, $F _ { \theta }$ , is available which predicts class assignments for a complete feature vector, $\Psi$ can be estimated as:
95
+
96
+ $$
97
+ \Psi = \mathbb { E } _ { \mathbf { z } } [ F _ { \boldsymbol { \theta } } ( \widehat { \mathbf { x } } _ { i } ) ] \approx \frac { 1 } { N } { \sum _ { l = 1 } ^ { N } } F _ { \boldsymbol { \theta } } ( \widehat { \mathbf { x } } _ { i } ^ { l } ) ~ .
98
+ $$
99
+
100
+ Algorithm 1 presents the suggested algorithm for training the predictor. It consists of taking samples from the incomplete dataset, then imputing them using our generator network, and using the imputed
101
+
102
+ <table><tr><td>Algorithm1: Training the predictor.</td></tr><tr><td>Input: G (trained imputer), D (dataset) Output: Fθ (trained predictor) foreachTrainingEpoch do foreach(xi,ki,yi) in D do z ~ N(0,I) Xi ←ki①xi+(1-ki)OG(xi,ki,z) loss ← L(yi,yred) Backpropagate loss</td></tr></table>
103
+
104
+ Algorithm 2: Estimating target distributions.
105
+ Input: $F _ { \theta }$ (trained predictor), $( x , k )$ (test sample), $\mathbf { N }$ (ensemble samples)
106
+ Output: $\Psi$ (distribution over target classes)
107
+ Ψ ← zeros ∈ R#classes
108
+ foreach Ensemble Sample $^ { l }$ to $N$ do z ∼ N (0, I) $\widehat { \mathbf { x } } k \odot x + ( 1 - k ) \odot G ( { \pmb { x } } , { \pmb { k } } , z )$ bypred ← Fθ(x) bj ← argmax(ypred) Ψj ← Ψj + 1N
109
+
110
+ samples to update the predictor. Note that, on each epoch and for each sample, the generator generates a new sample from the conditional distribution. Intuitively, it means that the predictor observes and learns to operate under different imputations for a given sample. This is different from approaches such as multiple imputation where several predictors are trained on different imputed versions of a dataset.
111
+
112
+ Algorithm 2 presents the suggested algorithm for making predictions and estimating target distributions given a trained predictor model. Here, a sample is imputed $N$ times and inference on this set results in an ensemble of predictions over different imputations. The output of this algorithm can be interpreted as a distribution over the confidence of class assignments given a partially observed test sample. The following claims justify the validity of Algorithm 1and Algorithm 2.
113
+
114
+ Claim 1. (Generalization of the predictor). If we assume imputed $\widehat { x _ { i } s }$ are samples from the underlying bfeature distribution, then the assigned training set labels can be modeled as labels generated from a noisy labeling process.
115
+
116
+ Claim 1 permits the analysis of the generalization and convergence for the predictor trained using Algorithm 1 based on current literature in training models with noisy labels (Natarajan et al., 2013; Reed et al., 2014; Chen et al., 2019). From the analysis provided by Chen et al. (2019), test accuracy in asymmetric label noise conditions is a quadratic function of the label noise:
117
+
118
+ $$
119
+ P ( y _ { i } = \widehat { y _ { i } } ) = ( 1 - \epsilon ) ^ { 2 } + \epsilon ^ { 2 } ,
120
+ $$
121
+
122
+ where $\widehat { y _ { i } }$ is underlying true label for the imputed feature vector $( \widehat { x _ { i } } )$ , and $y _ { i }$ is the label provided by bthe incomplete dataset. In (8), label noise ratio, $\epsilon$ b, represents the probability of the label transition from a certain target class to another:
123
+
124
+ $$
125
+ \epsilon = 1 - P ( \widehat { y _ { i } } = j | y _ { i } = j ) .
126
+ $$
127
+
128
+ In practice, $\epsilon$ is determined by the problem-specific underlying data distribution as well as the distribution of missing values.
129
+
130
+ Justification for claim 1 is straightforward, assume that $\{ \widehat { y _ { i } } ^ { 1 } \ldots \widehat { y _ { i } } ^ { N } \}$ are underlying true labels for each of $\{ \widehat { x _ { i } } ^ { 1 } \ldots \widehat { x _ { i } } ^ { N } \}$ b b. During training, for any imputed sample in $\{ \widehat { x _ { i } } ^ { 1 } \ldots \widehat { x _ { i } } ^ { N } \}$ , we use the dataset bprovided label, $y$ b b, to calculate the loss and to update model parameters. In the case that any of $\{ \widehat { y _ { i } } ^ { 1 } \ldots \widehat { y _ { i } } ^ { N } \}$ is different from $y$ , the loss term corresponding to that term would be calculated using b ba wrong label. Here, if we consider the average impact on gradients for batches of samples rather than individual cases, the overall impact on training would be very similar to the case of training using noisy labels.
131
+
132
+ Claim 2. (Approximation of the target distribution). If we assume: (i) imputed $\widehat { x _ { i } s }$ are valid samples from the underlying feature distribution, b(ii) a good predictor can be trained using the incomplete data, (iii) enough samples are used and the Monte Carlo estimator is unbiased, then the target distribution, $\Psi$ , can be estimated accurately.
133
+
134
+ This claim supports Algorithm 2 that is suggested to estimate the target distribution given a partially observed feature vector.
135
+
136
+ The first assumption is consistent with the theoretical analysis of generative adversarial networks that they can converge to the true underlying distribution (Arora et al., 2018; Liu et al., 2017). The second assumption is supported by Claim 1. Regarding the last assumption, each sample requires one forward computation of the generator and predictor networks which, based on the scalability of current network architectures, usually permits thousands of samples to be taken at a reasonable computational cost.
137
+
138
+ # 3.4 IMPLEMENTATION DETAILS
139
+
140
+ As we conduct experiments on image and tabular datasets, we use different architectures for each. For image datasets, we used a generator and discriminator architectures similar to the ones suggested by Wang et al. (2018). However, we improved these architectures using self-attention layers (Zhang et al., 2018). It should be noted that, while Zhang et al. (2018) suggests using a single self-attention layer in the middle of the network, we observed consistent improvements by inserting multiple self-attention layers before each residual block within the network. Furthermore, as input to the generator, we concatenate input image, mask, and a random $_ z$ frame along the channels dimension and use it as input. For tabular datasets, we use a simple 4 layer network consisting of fully-connected and batch-norm layers. Also, the input to the generator is the concatenation of a feature vector, mask vector, and a $_ { z }$ vector of size $\frac { 1 } { 8 }$ of the input. For all experiments, we use an ensemble size $( N )$ ) equal to 128.
141
+
142
+ We used Adam (Kingma & Ba, 2014) for model optimization. Two time-scale update rule (TTUR) (Heusel et al., 2017) was used to balance training the generator and discriminator networks. We explored best TTUR learning-rate settings from the set of {0.001, 0.0005, 0.0001, 0.00005}. Here, Adam parameters $\beta _ { 1 }$ and $\beta _ { 2 }$ are set to 0.5 and 0.999, respectively. Also, spectral normalization was used to stabilize both the generator and discriminator network in our experiments with image data (Miyato et al., 2018). For the predictor network, we used the default Adam settings as suggested by Kingma & Ba (2014). In all training procedures, we decay learning rate by a factor of 5 after reaching a plateau. For all experiments, we use a batch size of 64. Based on our experiments, we found that pretraining the discriminator while fixing the generator network for the first $5 \%$ of the training epochs helps the stability of training.
143
+
144
+ Further detail on exact architectures, experiments, software dependencies, etc. as well as ablation studies is provided in the appendices.
145
+
146
+ # 4 EXPERIMENTS
147
+
148
+ # 4.1 DATASETS
149
+
150
+ To evaluate the proposed method we use CIFAR-10 (Krizhevsky & Hinton, 2009) as an image classification dataset as well as three non-image datasets: UCI Landsat (Dua & Graff, 2017)2, MIT-BIH arrhythmia (Moody & Mark, 2001), and Diabetes classification (Kachuee et al., 2019) 3. CIFAR-10 dataset consists of $6 0 , 0 0 0 \ 3 2 \mathrm { x } \ 3 2$ images from 10 different classes. For this task, we use train and test sets as provided by the dataset. As a preprocessing step, we normalize pixel values to the range of [0,1] and subtract the mean image. The only data augmentation we use for this task is to randomly flip training images for each batch.
151
+
152
+ UCI Landsat consists of 6435 samples of 36 features from 6 different categories. We follow the same train and test split as provided by the dataset. MIT-BIH dataset consists of annotated heartbeat signals from which we used the preprocessed version available online4 consisting of 92062 samples of 5 different arrhythmia classes. Diabetes dataset is a real-world health dataset of 92,062 samples and 45 features from different categories such as questionnaire, demographics, medical examination, and lab results. The objective is to classify between three different diabetes conditions i.e., normal, pre-diabetes, and diabetes. As MIT-BIH and Diabetes datasets do not provide explicit train and test sets, we randomly select $80 \%$ of samples as a training set and the rest as a test set. To preprocess our tabular datasets, statistical and unity based normalization are used to balance the variance of different features and center them around zero. Also, while different encoding and representation methods are suggested in the literature to handle categorical features (Jang et al., 2016; Nazabal et al., 2018), in this paper, we take the simple approach of encoding categorical variables using one-hot representation and smoothing them by adding Gaussian noise with zero mean and variance equal to $5 \%$ of feature variances. In our experiments, we observed a reasonable performance using the suggested simple smoothing; however, more advanced encoding methods are also applicable in this setup and can be applied to enhance the performances even further.
153
+
154
+ # 4.2 MISSINGNESS MECHANISMS
155
+
156
+ In our experiments, we consider MCAR uniform and MCAR rectangular missingness structures. In MCAR uniform, each feature of each sample is missing based on a Bernoulli distribution with a certain missingness probability (i.e., missing rate) independent of other features. In addition to the case of uniform missingness, for image tasks, we use rectangular missingness/observation structure where rectangular regions of dataset images are missing/observed. To control the rate of missingness and decide on the regions that are missing for each case, we use a latent beta distribution that samples rectangular region’s width and height such that the average missing rate is maintained. For missing rates less than $50 \%$ we make the assumption of having a random rectangular region to be missing, whereas for missing rates more than $50 \%$ we assume that only a random rectangular region is observed and the rest of the image is missing.
157
+
158
+ We would like to note that while the suggested solution in this paper is readily compatible with MAR structures, in our experiments, to simplify the presentation of results and to have a fair comparison with other work that does not support the MAR assumption, we limited the scope of our experiments to MCAR. Furthermore, to simulate incomplete datasets and to make sure the same features are missing without explicitly storing masks, we use hashed feature vectors to seed random number generators used to sample missing features. More detail is provided in Appendix C.
159
+
160
+ # 4.3 EVALUATION MEASURES
161
+
162
+ Fréchet inception distance (FID) (Heusel et al., 2017) score is used to measure the quality of missing data imputation in experiments with images5. We also considered using root means squared error (RMSE); however, we decided not to use this measure as we observed an inconsistent behavior using RMSE in our comparisons as RMSE favors methods that show less variance rather than realistic and sharp samples from the distribution. Also, for each dataset and each missingness scenario, we report top-1 classification accuracy based on the majority vote estimated using Algorithm 2. Another measure that we use in this paper is the comparison between the estimated target certainties and average accuracies achieved for each confidence assignment. We run each experiment multiple times: 4 times for CIFAR-10 and 8 times for tabular datasets. We report the mean and standard deviation of results for each case.
163
+
164
+ We compare our results with MisGAN (Li et al., 2019) and GAIN (Yoon et al., 2018) as the state of the art imputation algorithms based on GANs as well as basic denoising autoencoder (DAE) (Vincent et al., 2008) and multiple imputation by chained equations (MICE) (Buuren & Groothuis-Oudshoorn, 2010) as baselines. For experiments using MisGAN, we used the same architectures and hyperparameters as suggested by the MisGAN authors6. The only modification was to adapt the last generator layer to generate images with resolutions as we use. Regarding GAIN, we used the same network architecture as our implementation of GI and hyper-parameters as used by the GAIN authors7. In the DAE implementation, due to the incomplete data assumption, only observed features appear in the loss function, ignoring reconstruction terms corresponding to missing features. Due to scalability issues, we were only able to use MICE for the smaller non-image datasets. For these methods, to train and evaluate classifiers, we use predictors trained on imputed datasets rather than the stochastic predictor suggested in Algorithm 1.
165
+
166
+ ![](images/7dee5514f122f68c96a6de74132a186a9e0266bbd52176e7a7dd6f46d002cb83.jpg)
167
+ Figure 2: Comparison of FID scores on CIFAR-10 dataset for (a) uniform and (b) rectangular missingness. Lower FID score is better. In many cases, variance values are very small and only observable by magnifying the figures.
168
+
169
+ # 4.4 RESULTS
170
+
171
+ Figure 2 presents the comparison of FID scores on the CIFAR-10 dataset at different missing rates for uniform and rectangular missingness. As it can be inferred from these plots, GI outperforms other alternatives in all cases. Also, it can be seen that GAIN is able to provide more reasonable results for uniform missing data structure compared to MisGAN which is mainly effective in the rectangular missing data structure. One possible explanation for this behavior might be the fact that GAIN has an MSE loss term acting similar to an autoencoder loss smoothing noisy missing pixels. On the other hand, MisGAN tries to explicitly model missingness structure and is more successful in capturing a more structured missingness such as the case of a rectangular structure. Table 1 provides a comparison between the top-1 classification accuracy achieved using each method at different missing rates and structures. From this table, GI outperforms other work by achieving the best results in 5 out of 6 cases8.
172
+
173
+ Table 2 presents a comparison of classification accuracies for Landsat, MIT-BIH, and Diabetes datasets at different missing rates. In the Landsat benchmark, GI outperforms other work in all cases. Regarding the MIT-BIH experiemts, GI outperforms other work for missing rates more than $30 \%$ while achieving similar accuracies to GAIN for lower missing rates. In the diabetes classification task, GI appears to be most effective imputing missing rates more than $20 \%$ .
174
+
175
+ Figure 3 shows a comparison of accuracy versus certainty plots for GI, MisGAN, and GAIN on Landsat dataset at the missing rate of $40 \%$ . To generate these figures we trained each imputation method and then used Algorithm 1 to train predictors on imputed samples. Finally, Algorithm 2 used to measure the average accuracy at different prediction confidence levels based on a sample of 128 imputations for each test example. As it can be seen from the plots, GI provides results closest to the ideal case of having average confidence values equal to average accuracies.
176
+
177
+ # 4.5 VISUALIZATION USING SYNTHESIZED DATA
178
+
179
+ In order to provide further insight into the operation of GI and how imputations can potentially influence the outcomes of predictions, we conduct experiments on a synthesized dataset. The original underlying data distribution is generated by sampling 5000 samples from 4 Gaussians of standard deviation 0.1 centered on the vertices of a unit square. We assign two different classes to each cluster
180
+
181
+ Table 1: Top-1 CIFAR-10 classification accuracy for different missing rates and structures.
182
+
183
+ <table><tr><td rowspan="2"></td><td colspan="5">Accuracy at Missing Rate (%) MCAR Rect.</td><td rowspan="2"></td></tr><tr><td colspan="2">MCARUniform</td><td colspan="3"></td></tr><tr><td>Method</td><td>20%</td><td>40%</td><td>60%</td><td>20%</td><td>40%</td><td>60%</td></tr><tr><td>GI</td><td>89.5 (±0.45)</td><td>87.1 (±0.54)</td><td>80.3 (±0.26)</td><td>84.0 (±0.03)</td><td>76.9 (±0.03)</td><td>66.1 (±0.16)</td></tr><tr><td>MisGAN</td><td>86.5 (±0.31)</td><td>83.7 (±0.40)</td><td>78.7 (±0.26)</td><td>82.9 (±0.44)</td><td>75.6 (±0.20)</td><td>65.0 (±0.31)</td></tr><tr><td>GAIN</td><td>88.7 (±0.45)</td><td>86.0 (±0.86)</td><td>81.8 (±0.03)</td><td>81.7 (±0.03)</td><td>73.6 (±0.35)</td><td>58.4 (±1.66)</td></tr><tr><td>DAE</td><td>88.0 (±0.22)</td><td>84.0 (±0.50)</td><td>79.8 (±0.71)</td><td>83.3 (±0.64)</td><td>75.5 (±0.44)</td><td>63.8 (±0.24)</td></tr><tr><td>Mean</td><td>85.7 (±0.02)</td><td>83.4 (±0.38)</td><td>79.2 (±0.16)</td><td>82.7 (±0.15)</td><td>75.3 (±0.16)</td><td>64.0 (±0.32)</td></tr></table>
184
+
185
+ Table 2: Comparison of classification accuracies for Landsat, MIT-BIH, and Diabetes datasets at different missing rates.
186
+
187
+ <table><tr><td></td><td></td><td colspan="4"> Accuracy at Missing Rate (%)a</td></tr><tr><td>Dataset</td><td>Method</td><td>10%</td><td>20%</td><td>30%</td><td>40%</td></tr><tr><td rowspan="5">Landsat (Dua &amp; Graff, 2017)</td><td>GI</td><td>89.9 (±0.36)</td><td>89.6 (±0.36)</td><td>89.0 (±0.03)</td><td>88.0 (±0.22)</td></tr><tr><td>MisGAN</td><td>87.2 (±0.01)</td><td>85.7 (±0.19)</td><td>84.0 (±0.61)</td><td>82.9 (±0.75)</td></tr><tr><td>GAIN</td><td>89.7 (±0.42)</td><td>89.4 (±0.56)</td><td>88.4 (±0.71)</td><td>87.7 (±0.10)</td></tr><tr><td>DAE</td><td>89.4 (±0.10)</td><td>88.6 (±0.54)</td><td>87.5 (±0.14)</td><td>86.6 (±0.21)</td></tr><tr><td>MICE</td><td>89.5 (±0.16)</td><td>89.3 (±0.10)</td><td>88.1 (±0.49)</td><td>87.5 (±0.03)</td></tr><tr><td rowspan="5">MIT-BIH(Moody &amp; Mark,2001)</td><td>GI</td><td>98.5 (±0.02)</td><td>98.4 (±0.03)</td><td>98.2 (±0.07)</td><td>97.7 (±0.03)</td></tr><tr><td>MisGAN</td><td>97.8 (±0.13)</td><td>97.4 (±0.07)</td><td>96.7 (±0.07)</td><td>96.2 (±0.09)</td></tr><tr><td>GAIN</td><td>98.5 (±0.02)</td><td>98.4 (±0.06)</td><td>98.0 (±0.09)</td><td>97.5 (±0.18)</td></tr><tr><td>DAE</td><td>98.4 (±0.02)</td><td>98.2 (±0.11)</td><td>97.9 (±0.09)</td><td>97.4 (±0.02)</td></tr><tr><td>MICE</td><td>98.4 (±0.01)</td><td>98.3 (±0.01)</td><td>98.1 (±0.01)</td><td>97.5 (±0.12)</td></tr><tr><td rowspan="5">Diabetes (Kachuee et al., 2019)</td><td>GI</td><td>89.6 (±0.13)</td><td>89.0 (±0.03)</td><td>88.2 (±0.62)</td><td>86.8 (±0.38)</td></tr><tr><td>MisGAN</td><td>89.7 (±0.01)</td><td>88.9 (±0.30)</td><td>87.6 (±0.02)</td><td>86.4 (±0.68)</td></tr><tr><td>GAIN</td><td>89.2 (±0.09)</td><td>88.3 (±0.02)</td><td>86.9 (±0.09)</td><td>83.8 (±1.44)</td></tr><tr><td>DAE</td><td>89.3 (±0.05)</td><td>88.2 (±0.19)</td><td>86.9 (±0.09)</td><td>84.8 (±0.03)</td></tr><tr><td>MICE</td><td>89.8 (±0.08)</td><td>88.8 (±0.01)</td><td>88.0 (±0.08)</td><td>86.1 (±0.02)</td></tr></table>
188
+
189
+ aBaseline accuracies for complete datasets (zero missing rate) are equal to $9 0 . 9 \%$ , $9 8 . 6 \%$ , and $9 0 . 7 \%$ for Landsat, MIT-BIH and Diabetes, respectively.
190
+
191
+ such that diagonal vertices are of the same class (see Figure 4a, classes are represented with colors).
192
+ From this underlying distribution, we make an incomplete dataset with $50 \%$ of values missing.
193
+
194
+ The incomplete synthesized dataset is used to train GI and other imputation methods. We take a random test sample in which the second feature has a value of about 0.1 and the other feature is missing. Ideally, in the imputation phase, we would like to sample from the condition distribution i.e. $P ( x _ { 1 } | x _ { 2 } = 0 . 1 )$ (see Figure 4b). Here, in the prediction phase, an ideal method would decide on not making a confident classification and report the uncertainty. Note that solely observing the value of 0.1 for the second feature does not provide any useful evidence for the prediction. Figure 4c-f provide samples and classification results for GI, MisGAN, GAIN, and DAE. As it can be inferred from these figures, GI generates reasonable samples from the conditional distribution and also reflects this uncertainty over the prediction. On the other hand MisGAN, probably due to its complexity of using three different generators and discriminator pairs, is suffering from mode collapse and is unable to generate samples from the other class, resulting in over-confident assignments. GAIN, perhaps due to the MSE loss terms, is inclined towards the mean of the conditional distribution at the origin.
195
+
196
+ ![](images/99ff87491c12b80a83f83e95b0f6597c20ef1cd8b2470028e19f5844c61fce0b.jpg)
197
+ Figure 3: Accuracy versus certainty plots for (a) GI, (b) MisGAN, and (c) GAIN on Landsat dataset at the missing rate of $40 \%$ .
198
+
199
+ DAE, as expected, due to its MSE loss term, only captures the expected value of the distribution mean hence reducing the MSE error and generates over-smoothed imputations.
200
+
201
+ ![](images/efa63b3362bf0eec014da42a29ee10be1a5bc69514aec9b20546466115db1b16.jpg)
202
+ Figure 4: Evaluation using synthesized data: (a) samples from the underlying distribution, (b) samples from the conditional underlying distribution, (c-f) samples from the conditional distribution generate by GI, MisGAN, GAIN, and DAE.
203
+
204
+ # 5 CONCLUSION
205
+
206
+ In this paper, we proposed a novel method to generate imputations and measure uncertainties over target class assignments based on incomplete feature vectors. We evaluated the effectiveness of the suggested approach on image and tabular data via using different measures such as FID distance, classification accuracy, and confidence versus accuracy plots. According to the experiments, the proposed method not only can generate accurate imputations but also is able to model prediction uncertainties arising from missing values. The proposed method is applicable to many real-world applications where only an incomplete dataset is available, and modeling classification uncertainties is a necessity.
207
+
208
+ # REFERENCES
209
+
210
+ Theodore W Anderson. Maximum likelihood estimates for a multivariate normal distribution when some observations are missing. Journal of the american Statistical Association, 52(278):200–203, 1957.
211
+
212
+ Sanjeev Arora, Andrej Risteski, and Yi Zhang. Do gans learn the distribution? some theory and empirics. 2018.
213
+
214
+ S van Buuren and Karin Groothuis-Oudshoorn. mice: Multivariate imputation by chained equations in r. Journal of statistical software, pp. 1–68, 2010.
215
+
216
+ Pengfei Chen, Benben Liao, Guangyong Chen, and Shengyu Zhang. Understanding and utilizing deep neural networks trained with noisy labels. arXiv preprint arXiv:1905.05040, 2019.
217
+
218
+ Adnan Darwiche. Modeling and reasoning with Bayesian networks. Cambridge university press, 2009.
219
+
220
+ Dheeru Dua and Casey Graff. UCI machine learning repository, 2017. URL http://archive. ics.uci.edu/ml.
221
+
222
+ Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Olivier Mastropietro, Alex Lamb, Martin Arjovsky, and Aaron Courville. Adversarially learned inference. arXiv preprint arXiv:1606.00704, 2016.
223
+
224
+ 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.
225
+
226
+ Trevor Hastie, Robert Tibshirani, Gavin Sherlock, Michael Eisen, Patrick Brown, and David Botstein. Imputing missing data for gene expression arrays, 1999.
227
+
228
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In Advances in Neural Information Processing Systems, pp. 6626–6637, 2017.
229
+
230
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical reparameterization with gumbel-softmax. arXiv preprint arXiv:1611.01144, 2016.
231
+
232
+ Mohammad Kachuee, Kimmo Karkkainen, Orpaz Goldstein, Davina Zamanzadeh, and Majid Sarrafzadeh. Nutrition and health data for cost-sensitive learning. arXiv preprint arXiv:1902.07102, 2019.
233
+
234
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
235
+
236
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
237
+
238
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
239
+
240
+ Steven Cheng-Xian Li, Bo Jiang, and Benjamin Marlin. Learning from incomplete data with generative adversarial networks. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $=$ S1lDV3RcKm.
241
+
242
+ Roderick JA Little and Donald B Rubin. Statistical analysis with missing data, volume 793. Wiley, 2019.
243
+
244
+ Shuang Liu, Olivier Bousquet, and Kamalika Chaudhuri. Approximation and convergence properties of generative adversarial learning. In Advances in Neural Information Processing Systems, pp. 5545–5553, 2017.
245
+
246
+ Pierre-Alexandre Mattei and Jes Frellsen. missiwae: Deep generative modelling and imputation of incomplete data. arXiv preprint arXiv:1812.02633, 2018.
247
+
248
+ Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. arXiv preprint arXiv:1802.05957, 2018.
249
+
250
+ George B Moody and Roger G Mark. The impact of the mit-bih arrhythmia database. IEEE Engineering in Medicine and Biology Magazine, 20(3):45–50, 2001.
251
+
252
+ Jared S Murray et al. Multiple imputation: a review of practical and theoretical findings. Statistical Science, 33(2):142–159, 2018.
253
+
254
+ Nagarajan Natarajan, Inderjit S Dhillon, Pradeep K Ravikumar, and Ambuj Tewari. Learning with noisy labels. In Advances in neural information processing systems, pp. 1196–1204, 2013.
255
+
256
+ Alfredo Nazabal, Pablo M Olmos, Zoubin Ghahramani, and Isabel Valera. Handling incomplete heterogeneous data using vaes. arXiv preprint arXiv:1807.03653, 2018.
257
+
258
+ Richard E Neapolitan et al. Learning bayesian networks, volume 38. Pearson Prentice Hall Upper Saddle River, NJ, 2004.
259
+
260
+ Thomas Dyhre Nielsen and Finn Verner Jensen. Bayesian networks and decision graphs. Springer Science & Business Media, 2009.
261
+
262
+ Scott Reed, Honglak Lee, Dragomir Anguelov, Christian Szegedy, Dumitru Erhan, and Andrew Rabinovich. Training deep neural networks on noisy labels with bootstrapping. arXiv preprint arXiv:1412.6596, 2014.
263
+
264
+ Donald B Rubin. Inference and missing data. Biometrika, 63(3):581–592, 1976.
265
+
266
+ Joseph L Schafer and John W Graham. Missing data: our view of the state of the art. Psychological methods, 7(2):147, 2002.
267
+
268
+ Kihyuk Sohn, Honglak Lee, and Xinchen Yan. Learning structured output representation using deep conditional generative models. In Advances in neural information processing systems, pp. 3483–3491, 2015.
269
+
270
+ Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoine Manzagol. Extracting and composing robust features with denoising autoencoders. In Proceedings of the 25th international conference on Machine learning, pp. 1096–1103. ACM, 2008.
271
+
272
+ Ting-Chun Wang, Ming-Yu Liu, Jun-Yan Zhu, Andrew Tao, Jan Kautz, and Bryan Catanzaro. Highresolution image synthesis and semantic manipulation with conditional gans. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8798–8807, 2018.
273
+
274
+ Jinsung Yoon, James Jordon, and Mihaela Van Der Schaar. Gain: Missing data imputation using generative adversarial nets. arXiv preprint arXiv:1806.02920, 2018.
275
+
276
+ Han Zhang, Ian Goodfellow, Dimitris Metaxas, and Augustus Odena. Self-attention generative adversarial networks. arXiv preprint arXiv:1805.08318, 2018.
277
+
278
+ Shichao Zhang, Zhenxing Qin, Charles X Ling, and Shengli Sheng. " missing is useful": missing values in cost-sensitive decision trees. IEEE transactions on knowledge and data engineering, 17 (12):1689–1693, 2005.
279
+
280
+ # A IMPLEMENTATION AND EXPERIMENTS
281
+
282
+ Table 3 presents the list of software dependencies and versions used in our implementation. To produce results related to this paper, we used a workstation with 4 NVIDIA GeForce RTX-2080Ti GPUs, a 12 core Intel Core i9-7920X processor, and 128 GB memory. Each experiment took between about 4 hours to 48 hours, based on the task and method being tested.
283
+
284
+ Table 3: Software dependencies.
285
+
286
+ <table><tr><td>Dependency</td><td>Version</td></tr><tr><td>python</td><td>3.7.1</td></tr><tr><td>pytorch</td><td>1.0.0</td></tr><tr><td>cuda100</td><td>1.0</td></tr><tr><td>ipython</td><td>7.2.0</td></tr><tr><td>jupyter</td><td>1.0.0</td></tr><tr><td>numpy</td><td>1.15.4</td></tr><tr><td>pandas</td><td>0.24.1</td></tr><tr><td>scikit-learn</td><td>0.20.1</td></tr><tr><td>scipy</td><td>1.1.0</td></tr><tr><td>torchvision</td><td>0.2.1</td></tr><tr><td>tqdm</td><td>4.28.1</td></tr><tr><td>matplotlib</td><td>3.0.1</td></tr></table>
287
+
288
+ # B NETWORK ARCHITECTURES
289
+
290
+ Table 4 shows the exact architectures used in this paper. To show each layer or block we used the following notation. $\mathtt { C x S y P z - t }$ represents a 2-d convolution layer of kernel size $_ \textrm { x }$ , stride y, padding $_ { \textrm { Z } }$ , and number of output channels $\scriptstyle \pm$ followed by ReLU activation. Attn represents a self-attention layer similar to Zhang et al.9. $_ \mathrm { R - x }$ represents a residual block consisting of two 2-d convolutions with kernel size 3 (padding size 1), batch normalization, and ReLU activation. $\mathsf { C T x S y P z - t }$ is the convolution transpose corresponding to $\mathtt { C x S y P z - t }$ . $\operatorname { F C - x }$ is representing a linear fully-connected layer of $_ \textrm { x }$ output neurons with biases. We use spectral normalization as suggested by Miyato et al.10 for all convolutional layers in both generator and discriminator networks.
291
+
292
+ Table 4: Network architectures used in our experiments.
293
+
294
+ <table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>Generator/Discriminator Architecture</td><td rowspan=1 colspan=1>Predictor Architecture</td></tr><tr><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>C7S1P3-64,C3S2P1-128,Attn,R-128,Attn,R-128,Attn,R-128,Attn,R-128,CT3S2P1-128,CT7S1P3-3,Tanh/Sigmoid</td><td rowspan=1 colspan=1>ResNet-18 11,12</td></tr><tr><td rowspan=1 colspan=1>Landsat</td><td rowspan=1 colspan=1>FC-64,Sigmoid,BNorm,FC-64,Sigmoid,BNorm,FC-64,Sigmoid,BNorm,FC-36,Tanh/Sigmoid</td><td rowspan=1 colspan=1>FC-64,ReLU,BNorm,FC-64,ReLU,BNorm,FC-6,Softmax</td></tr><tr><td rowspan=1 colspan=1>MIT-BIH</td><td rowspan=1 colspan=1>FC-1860,ReLU,BNorm,FC-1860,ReLU,BNorm,FC-1860,ReLU,BNorm, FC-186,Tanh/Sigmoid</td><td rowspan=1 colspan=1>FC-1860,ReLU,BNorm,FC-1860,ReLU,BNorm,FC-5,Softmax</td></tr><tr><td rowspan=1 colspan=1>Diabetes</td><td rowspan=1 colspan=1>FC-45,ReLU,BNorm,FC-45,ReLU,BNorm,FC-45,ReLU,BNorm,FC-45,Tanh/Sigmoid</td><td rowspan=1 colspan=1>FC-22,ReLU,BNorm,FC-22,ReLU,BNorm,FC-3,Softmax</td></tr></table>
295
+
296
+ # C MISSING DATA MECHANISMS
297
+
298
+ In this paper, we conduct experiments on two mechanisms for missing values: MCAR uniform and MCAR rectangular. As in our experiments and comparisons, we consider the case where only an incomplete dataset is available for training. It is crucial to guarantee that each method has only access to a unique incomplete version of each sample. However, it is relatively expensive to load and store feature masks for each sample in the dataset. Instead, we generate missing values during the data load for each batch. A hashing mechanism is used to ensure that the same parts are missing for each sample throughout the training. Note that we set system, python, and external library hash seeds to fixed values to ensure the consistency between different runs.
299
+
300
+ Algorithm 3 presents the procedure used for generating missing values with uniform structure. This algorithm is sampling independent Bernoulli distributions with probabilities equal to the missing rate. Algorithm 4 shows the outline for the rectangular missing structure used in image experiments. It consists of selecting a random point as the center of the rectangle and then deciding on parameters to be used for the beta distribution based on the missing rate. Finally, the width and height of the rectangular region are sampled from the latent beta distribution. In other words, we generate rectangular regions centered at random locations within the image which have width and height values determined by samples from a latent beta distribution. Here, distribution parameters, $\alpha$ and $\beta$ , are used to control the average missing rate. The outcome would be rectangular regions of different shape at different locations within the frame with the expected portion of missing area equal to the missing rate.
301
+
302
+ In order to decide on the beta distribution parameters i.e. $\alpha$ and $\beta$ we use numerical simulations. Specifically, we fix one of the parameters to 1 and change the other parameter in the range of [1,10], while measuring the average missing rate caused by each case. Figure 5 shows the missing rates caused by different beta distribution parameters. The first half of Figure 5 (missing rates less than about 0.18) corresponds to setting $\beta$ to 1 and changing $\alpha$ values; and the other half fixing $\alpha$ to 1 and changing $\beta$ values. To generate missing rates more than $50 \%$ we invert our masks and limit the observation to the rectangular region while the rest of the image is missing. Note that missing rates indicate the ratio of features that are missing on the average case. As we are using a latent model for sampling width and height for the rectangles, the actual missing ratios for each specific sample differs between samples. See Table 5 for visual examples of different missing rates and missing structures.
303
+
304
+ # Algorithm 3: MCAR uniform generation.
305
+
306
+ Input: $_ { \textbf { \em x } }$ (complete feature), $r$ (missing rate) Output: ${ \pmb x } _ { m }$ (incomplete feature) $\begin{array} { r l } & { s e e d _ { x } h a s h ( \pmb { x } ) } \\ & { \pmb { k } 1 - B e r n o u l l i ( s e e d _ { x } , s h a p e ( x ) , p r o b = r ) } \\ & { \pmb { x } _ { m } \pmb { k } \odot \pmb { x } + ( 1 - \pmb { k } ) \odot N a N } \end{array}$
307
+
308
+ # Algorithm 4: MCAR rect. generation.
309
+
310
+ Input: $_ { \textbf { \em x } }$ (complete feature), $r$ (missing rate)
311
+ Output: ${ \pmb x } _ { m }$ (incomplete feature)
312
+ $s e e d _ { x } \gets h a s h ( { \pmb x } )$
313
+ n $\iota _ { x } , n _ { y } \gets s h a p e ( { \pmb x } )$
314
+ $( p _ { x } , \bar { p _ { y } } ) \sim ( u n i f o r m ( 0 , n _ { x } ) , u n i f o r m ( 0 , n _ { y } ) )$
315
+ α, β ← beta_params(r) // beta_params gives $\alpha , \beta$ for each missing rate based on numerical simulations
316
+ $\begin{array} { r l } & { ( \boldsymbol { w } , h ) \sim ( B e t a ( \alpha , \beta ) \times n _ { x } ) , B e t a ( \alpha , \beta ) \times n _ { y } ) ) } \\ & { \boldsymbol { k } r e c t \_ m a s k ( p _ { x } , p _ { y } , w , h ) } \\ & { \mathbf { \boldsymbol { x } } _ { m } \boldsymbol { k } \odot \mathbf { \boldsymbol { x } } + ( 1 - \boldsymbol { k } ) \odot N a N } \end{array}$
317
+
318
+ ![](images/29b1ccc7a90bf84d0c4b18de35c4df32b98f105fff00abdb71b3fde7ca644a3b.jpg)
319
+ Figure 5: Simulation results for measuring average missing rate given different beta distribution parameters.
320
+
321
+ ![](images/b85dc27446c318885a97542d42c9e6453ece8284078aca51ca167c500d3ddc30.jpg)
322
+
323
+ # D ABLATION STUDY
324
+
325
+ Figure 6 presents a comparison between using (GI W/ Atten.) and not using (GI W/O Atten.) self-attention layers before each residual block in the proposed architecture. We report FID scores on CIFAR-10 with rectangular missingness. As it can be inferred from this comparison, using self-attention achieves a consistent improvement over the baseline. We also examined the case of uniform missingness; however, we did not observe any significant improvement for this case. One possible explanation could be the fact that imputing missing data with a uniform structure can be done by processing local regions and does not require attending to different distant regions across the image.
326
+
327
+ ![](images/555f58484ccab468a30f31b8a1a2e7e6951c3a282f1c5c77ff9c483cf318fc49.jpg)
328
+ Figure 6: Comparison of FID scores achieved with (GI W/ Atten.) and without (GI W/O Atten.) self-attention layers on CIFAR-10 dataset and rectangular missingness. Lower FID score is better.
329
+
330
+ Figure 7 shows a comparison of classification accuracies for the Landsat dataset achieved using different ensemble sizes $( N )$ . As it can be seen from this figure, higher values of $N$ result in improved accuracies, especially for higher missing rates. Also, it can be observed that for N values more than 64 the difference is negligible.
331
+
332
+ ![](images/12c219ac2d3a48f6cc52d091728437b57a1e9af830f5bd30babc7198f2bac84e.jpg)
333
+ Figure 7: Comparison of classification accuracies achieved with different ensemble size $( N )$ .
334
+
335
+ To study the benefits of the suggested stochastic predictor, we conducted experiments comparing GI with its non-stochastic variation $( \mathrm { N } { = } 1 )$ ). Here, the CIFAR-10 dataset with the rectangular missing structure and missing rates from $20 \%$ to as high as $90 \%$ is used. From Table 6 it can be inferred that as the rate of missingness increases, the benefits of the suggested predictor algorithm increase significantly. We hypothesize that at higher rates of missingness, the conditional distribution of missing features becomes multimodal. In such a scenario, the suggested method captures the uncertainties over the target distribution resulting in the predictor to make more reliable class assignments.
336
+
337
+ Table 6: Comparison of CIFAR-10 accuracies for the stochastic $\mathrm { ( N = 1 2 8 ) }$ ) and the deterministic $\left( \mathrm { N } { = } 1 \right)$ ) predictor under rectangular missingness.
338
+
339
+ <table><tr><td></td><td colspan="6">Accuracy at Missing Rate (%)</td></tr><tr><td>Method</td><td>20%</td><td>40%</td><td>60%</td><td>70%</td><td>80%</td><td>90%</td></tr><tr><td>GI (N=128)</td><td>84.0</td><td>76.9</td><td>66.1</td><td>59.1</td><td>46.0</td><td>32.1</td></tr><tr><td>GI (N=1)</td><td>83.6</td><td>75.7</td><td>65.1</td><td>56.7</td><td>42.8</td><td>29.4</td></tr><tr><td>% difference (normalized)</td><td>0.5</td><td>1.6</td><td>1.5</td><td>4.1</td><td>6.9</td><td>8.4</td></tr></table>
340
+
341
+ # E VISUAL COMPARISON
342
+
343
+ Table 7 and 8 provide a visual comparison of GI, MisGAN, and GAIN. For each missingness structure, we compare the best two imputation methods based on FID scores in Figure 2 i.e., GI versus MisGAN for rectangular missingness and GI versus GAIN for uniform missingness. From Table 7 it can be seen that GI is more capable in the reconstruction of fine details such as horse legs, car wheels, or plane wings. Regarding the results provided in Table 8, GI imputed samples are generally sharper and more realistic, which is consistent with our hypothesis about the drawbacks of the MSE term in the GAIN objective function.
344
+
345
+ ![](images/61024c4babfabb7e7dd65df430bff40654a51f9e986c3d422c05dfe4e0963228.jpg)
346
+
347
+ ![](images/3958733293402574782f6e1c021c4a754f6dbed20e2753d3f34209f404938a06.jpg)
348
+
349
+ # F ANALYSIS OF THE RMSE MEASURE
350
+
351
+ Table 9 presents the comparison of different imputation methods using the RMSE measure on CIFAR-10 for different missing structures and rates. Generally, RMSE values for the uniform missing structure are lower than their rectangular counterparts. It is consistent with our intuition that imputing uniform missingness is most similar to denoising problems where the RMSE measure is frequently used. Additionally, comparing the performance of different imputation methods using the FID measure (Section 4.4) does not demonstrate a clear correlation to results shown in Table 9. Nonetheless, it is well-known that the FID measure is more suited to measuring the performance of generated images from the underlying distribution (Heusel et al., 2017).
352
+
353
+ Similarly, in Table 10, we provide RMSE values corresponding to experiments on the tabular datasets. Here, GAIN and DAE provide very similar results that are generally better than GI or MisGAN. This signifies our hypothesis that the MSE loss term may skew generated samples toward the mean of the distribution, resulting in better RMSE values but not necessarily higher final classification accuracies (see Table 2).
354
+
355
+ Table 9: Comparison of imputation RMSE values for CIFAR-10 at different missing structures and rates.
356
+
357
+ <table><tr><td></td><td colspan="5">RMSE at Missing Rate (%)</td><td></td></tr><tr><td></td><td colspan="5">MCAR Uniform</td><td>MCAR Rect.</td></tr><tr><td>Method</td><td>20%</td><td>40%</td><td>60%</td><td>20%</td><td>40%</td><td>60%</td></tr><tr><td>GI</td><td>0.026 (±0.003)</td><td>0.057 (±0.008)</td><td>0.090 (±0.006)</td><td>0.097 (±0.02)</td><td>0.148 (±0.001)</td><td>0.660 (±0.010)</td></tr><tr><td>MisGAN</td><td>0.079 (±0.001)</td><td>0.161 (±0.001)</td><td>0.257 (±0.002)</td><td>0.106 (±0.005)</td><td>0.158 (±0.004)</td><td>0.250 (±0.001)</td></tr><tr><td>GAIN</td><td>0.027 (±0.003)</td><td>0.045 (±0.001)</td><td>0.072 (±0.005)</td><td>0.340 (±0.047)</td><td>0.511 (±0.001)</td><td>0.660 (±0.010)</td></tr><tr><td>DAE</td><td>0.036 (±0.001)</td><td>0.075 (±0.002)</td><td>0.121 (±0.005)</td><td>0.116 (±0.007)</td><td>0.160 (±0.001)</td><td>0.233 (±0.029)</td></tr></table>
358
+
359
+ Table 10: Comparison of imputation RMSE values for Landsat, MIT-BIH, and Diabetes datasets at different missing rates.
360
+
361
+ <table><tr><td colspan="2"></td><td colspan="4">RMSE at Missing Rate (%)</td></tr><tr><td>Dataset</td><td>Method</td><td>10%</td><td>20%</td><td>30%</td><td>40%</td></tr><tr><td rowspan="4">Landsat (Dua &amp; Graff,2017)</td><td>GI</td><td>0.040 (±0.005)</td><td>0.067 (±0.007)</td><td>0.076 (±0.020)</td><td>0.136 (±0.002)</td></tr><tr><td>MisGAN</td><td>0.068 (±0.001)</td><td>0.096 (±0.001)</td><td>0.118 (±0.001)</td><td>0.136 (±0.001)</td></tr><tr><td>GAIN</td><td>0.018 (±0.001)</td><td>0.024 (±0.001)</td><td>0.030 (±0.001)</td><td>0.037 (±0.001)</td></tr><tr><td>DAE</td><td>0.020 (±0.001)</td><td>0.031 (±0.001)</td><td>0.041 (±0.001)</td><td>0.052 (±0.001)</td></tr><tr><td rowspan="4">MIT-BIH(Moody &amp; Mark,2001)</td><td>GI</td><td>0.038 (±0.001)</td><td>0.060 (±0.004)</td><td>0.071 (±0.002)</td><td>0.095 (±0.002)</td></tr><tr><td>MisGAN</td><td>0.073 (±0.007)</td><td>0.092 (±0.002)</td><td>0.115 (±0.003)</td><td>0.111 (±0.001)</td></tr><tr><td>GAIN</td><td>0.032 (±0.008)</td><td>0.046 (±0.001)</td><td>0.055 (±0.004)</td><td>0.067 (±0.007)</td></tr><tr><td>DAE</td><td>0.029 (±0.001)</td><td>0.048 (±0.008)</td><td>0.061 (±0.009)</td><td>0.068 (±0.003)</td></tr><tr><td rowspan="4">Diabetes (Kachuee et al., 2019)</td><td>GI</td><td>0.080 (±0.002)</td><td>0.118 (±0.008)</td><td>0.149 (±0.020)</td><td>0.189 (±0.009)</td></tr><tr><td>MisGAN</td><td>0.082 (±0.004)</td><td>0.111 (±0.002)</td><td>0.133 (±0.001)</td><td>0.151 (±0.001)</td></tr><tr><td>GAIN</td><td>0.064 (±0.001)</td><td>0.092 (±0.001)</td><td>0.119 (±0.001)</td><td>0.140 (±0.001)</td></tr><tr><td>DAE</td><td>0.065 (±0.001)</td><td>0.093 (±0.001)</td><td>0.118 (±0.001)</td><td>0.143 (±0.001)</td></tr></table>
362
+
363
+ # G IMPACT OF TRAINING NOISE
364
+
365
+ Addition of noise to input vectors often serves as an input augmentation and results in improved generalization accuracies. In order to verify that the improved GI performance is not merely due to the introduction of noise in the suggested architecture, we conducted an experiment by adding different amounts of Gaussian noise during the training process for GAIN and GI. Specifically, we compared how the CIFAR-10 test accuracies change at different degrees of training noise for uniform and rectangular missingess structures at the average missing rate of $40 \%$ .
366
+
367
+ According to Table 11, adding small amounts of Gaussian noise (e.g., std=0.0125) improves the generalization under uniform missingness for both GI and GAIN. Even in this case, GI is still outperforming GAIN in terms of final classification performance. It is also interesting to point out that for the case of rectangular missingness adding Gaussian noise results in a consistent reduction in the classification accuracy for both methods.
368
+
369
+ Table 11: Top-1 CIFAR-10 classification accuracy at $40 \%$ missing rate using added training noise.
370
+
371
+ <table><tr><td></td><td colspan="2">Accuracy (%)</td></tr><tr><td>Noise STD</td><td>MCAR Uniform (40%) GI GAIN</td><td>MCAR Rect. (40%) GI GAIN</td></tr><tr><td>0.0</td><td>87.1 86.0</td><td>76.9 73.6</td></tr><tr><td>0.0125</td><td>87.3 86.3</td><td>76.8 73.3</td></tr><tr><td>0.025</td><td>86.5 86.6</td><td>76.7 73.2</td></tr><tr><td>0.05</td><td>85.6 84.7</td><td>73.7 72.4</td></tr><tr><td>0.1</td><td>82.0 80.6</td><td>68.7 67.0</td></tr></table>
372
+
373
+ # H IMPACT OF THE MSE LOSS TERM
374
+
375
+ In our earlier discussions, we stated that the MSE loss term used in GAIN would bias the distribution of generated samples toward the mean of the distribution. Here, a synthesized dataset is used to illustrate the impact of MSE loss term on the distribution of generated samples. A hyperparameter, $\lambda$ , controls the weight of the MSE term in the final objective function. As it can be observed from Figure 8, the higher the $\lambda$ parameter, the lower the variance of the generated samples (i.e., more bias toward the mean of the distribution).
376
+
377
+ ![](images/e6f566e62f5c08205f49f8240037709b45a8d8f533c27ee98af701aa8fdcd47f.jpg)
378
+ Figure 8: Comparison of generating samples from a Gaussian distribution (a) samples from the original distribution, (b) samples generated using GAIN imputers with different significance of the MSE term (controlled by $\lambda$ ).
379
+
380
+ # I IMPACT OF THE DISCRIMINATOR HINT VECTOR
381
+
382
+ Yoon et al. (2018) suggested the idea of guiding the discriminator network using a hint mechanism. A hint vector reveals a subset of features that are missing to the discriminator. In Figure 9 and 10 we provide a comparison of learning curves for GI implemented using different hint rates. From Figure 9, using the hint mechanism does not result in any noticeable improvement in the final imputation quality justifying the added complexity. For the case of the rectangular missing structure in Figure 10; however, using the hint vector causes instabilities in the training process. One possible explanation is: providing even a small portion of the mask as a hint, due to the deterministic nature of the rectangular shape it is equivalent to providing region boundaries to the discriminator making it obvious for the discriminator. In GAN training we generally want to have equal competition between the generator and discriminator.
383
+
384
+ ![](images/d1773a0973e8e20e8a1e95585cf0570e2f70c7ae32a782150bd1926ef6c94fdd.jpg)
385
+ Figure 9: Learning curves for CIFAR-10 with uniform missing structure at different discriminator hint rates.
386
+
387
+ ![](images/1d860d6685302d772bd786609a2406e9a1cc659ad5aaf397983d57ed6fba2242.jpg)
388
+ Figure 10: Learning curves for CIFAR-10 with rectangular missing structure at different discriminator hint rates.
md/train/B1esx6EYvr/B1esx6EYvr.md ADDED
@@ -0,0 +1,278 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A CRITICAL ANALYSIS OF SELF-SUPERVISION, ORWHAT WE CAN LEARN FROM A SINGLE IMAGE
2
+
3
+ Yuki M. Asano Christian Rupprecht
4
+
5
+ Andrea Vedaldi
6
+
7
+ Visual Geometry Group
8
+ University of Oxford
9
+ {yuki,chrisr,vedaldi}@robots.ox.ac.uk
10
+
11
+ # ABSTRACT
12
+
13
+ We look critically at popular self-supervision techniques for learning deep convolutional neural networks without manual labels. We show that three different and representative methods, BiGAN, RotNet and DeepCluster, can learn the first few layers of a convolutional network from a single image as well as using millions of images and manual labels, provided that strong data augmentation is used. However, for deeper layers the gap with manual supervision cannot be closed even if millions of unlabelled images are used for training. We conclude that: (1) the weights of the early layers of deep networks contain limited information about the statistics of natural images, that (2) such low-level statistics can be learned through self-supervision just as well as through strong supervision, and that (3) the low-level statistics can be captured via synthetic transformations instead of using a large image dataset.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ Despite tremendous progress in supervised learning, learning without external supervision remains difficult. Self-supervision has recently emerged as one of the most promising approaches to address this limitation. Self-supervision builds on the fact that convolutional neural networks (CNNs) transfer well between tasks (Shin et al., 2016; Oquab et al., 2014; Girshick, 2015; Huh et al., 2016). The idea then is to pre-train networks via pretext tasks that do not require expensive manual annotations and can be automatically generated from the data itself. Once pre-trained, networks can be applied to a target task by using only a modest amount of labelled data.
18
+
19
+ Early successes in self-supervision have encouraged authors to develop a large variety of pretext tasks, from colorization to rotation estimation and image autoencoding. Recent papers have shown performance competitive with supervised learning by learning complex neural networks on very large image datasets. Nevertheless, for a given model complexity, pre-training by using an off-theshelf annotated image datasets such as ImageNet remains much more efficient.
20
+
21
+ In this paper, we aim to investigate the effectiveness of current self-supervised approaches by characterizing how much information they can extract from a given dataset of images. Since deep networks learn a hierarchy of representations, we further break down this investigation on a per-layer basis. We are motivated by the fact that the first few layers of most networks extract low-level information (Yosinski et al., 2014), and thus learning them may not require the high-level semantic information captured by manual labels.
22
+
23
+ Concretely, in this paper we answer the following simple question: “is self-supervision able to exploit the information contained in a large number of images in order to learn different parts of a neural network?”
24
+
25
+ We contribute two key findings. First, we show that as little as a single image is sufficient, when combined with self-supervision and data augmentation, to learn the first few layers of standard deep networks as well as using millions of images and full supervision (Figure 1). Hence, while selfsupervised learning works well for these layers, this may be due more to the limited complexity of such features than the strength of the supervisory technique. This also confirms the intuition that early layers in a convolutional network amounts to low-level feature extractors, analogous to early learned and hand-crafted features for visual recognition (Olshausen & Field, 1997; Lowe, 2004; Dalal & Triggs, 2005). Finally, it demonstrates the importance of image transformations in learning such low-level features as opposed to image diversity.1
26
+
27
+ ![](images/170a22e5e719a53efa60993ee606484b35b4465c1a6a9fe2204b521c8d69c3b5.jpg)
28
+
29
+ ![](images/f6e9438a75e6c4530cb249d7647d3dfd569bce7aadafc4b938fc22c16106a227.jpg)
30
+ Figure 1: Single-image self-supervision. We show that several self-supervision methods can be used to train the first few layers of a deep neural networks using a single training image, such as this Image A, B or even C (above), provided that sufficient data augmentation is used.
31
+
32
+ Our second finding is about the deeper layers of the network. For these, self-supervision remains inferior to strong supervision even if millions of images are used for training. Our finding is that this is unlikely to change with the addition of more data. In particular, we show that training these layers with self-supervision and a single image already achieves as much as two thirds of the performance that can be achieved by using a million different images.
33
+
34
+ We show that these conclusions hold true for three different self-supervised methods, BiGAN (Donahue et al., 2017), RotNet (Gidaris et al., 2018) and DeepCluster (Caron et al., 2018), which are representative of the spectrum of techniques that are currently popular. We find that performance as a function of the amount of data is dependent on the method, but all three methods can indeed leverage a single image to learn the first few layers of a deep network almost “perfectly”.
35
+
36
+ Overall, while our results do not improve self-supervision per-se, they help to characterize the limitations of current methods and to better focus on the important open challenges.
37
+
38
+ # 2 RELATED WORK
39
+
40
+ Our paper relates to three broad areas of research: (a) self-supervised/unsupervised learning, (b) learning from a single sample, and (c) designing/learning low-level feature extractors. We discuss closely related work for each.
41
+
42
+ Self-supervised learning: A wide variety of proxy tasks, requiring no manual annotations, have been proposed for the self-training of deep convolutional neural networks. These methods use various cues and tasks namely, in-painting (Pathak et al., 2016), patch context and jigsaw puzzles (Doersch et al., 2015; Noroozi & Favaro, 2016; Noroozi et al., 2018; Mundhenk et al., 2017), clustering (Caron et al., 2018), noise-as-targets (Bojanowski & Joulin, 2017), colorization (Zhang et al., 2016; Larsson et al., 2017), generation (Jenni & Favaro, 2018; Ren & Lee, 2018; Donahue et al., 2017), geometry (Dosovitskiy et al., 2016; Gidaris et al., 2018) and counting (Noroozi et al., 2017). The idea is that the pretext task can be constructed automatically and easily on images alone. Thus, methods often modify information in the images and require the network to recover them. Inpainting or colorization techniques fall in this category. However these methods have the downside that the features are learned on modified images which potentially harms the generalization to unmodified ones. For example, colorization uses a gray scale image as input, thus the network cannot learn to extract color information, which can be important for other tasks.
43
+
44
+ Slightly less related are methods that use additional information to learn features. Here, often temporal information is used in the form of videos. Typical pretext tasks are based on temporalcontext (Misra et al., 2016; Wei et al., 2018; Lee et al., 2017; Sermanet et al., 2018), spatio-temporal cues (Isola et al., 2015; Gao et al., 2016; Wang et al., 2017), foreground-background segmentation via video segmentation (Pathak et al., 2017), optical-flow (Gan et al., 2018; Mahendran et al., 2018), future-frame synthesis (Srivastava et al., 2015), audio prediction from video (de Sa, 1994; Owens et al., 2016), audio-video alignment (Arandjelovic & Zisserman ´ , 2017), ego-motion estimation (Jayaraman & Grauman, 2015), slow feature analysis with higher order temporal coherence (Jayaraman & Grauman, 2016), transformation between frames (Agrawal et al., 2015) and patch tracking in videos (Wang & Gupta, 2015). Since we are interested in learning features from as little data as one image, we cannot make use of methods that rely on video input.
45
+
46
+ Our contribution inspects three unsupervised feature learning methods that use very different means of extracting information from the data: BiGAN (Donahue et al., 2017) utilizes a generative adversarial task, RotNet (Gidaris et al., 2018) exploits the photographic bias in the dataset and DeepCluster (Caron et al., 2018) learns stable feature representations under a number of image transformations by proxy labels obtained from clustering. These are described in more detail in the Methods section.
47
+
48
+ Learning from a single sample: In some applications of computer vision, the bold idea of learning from a single sample comes out of necessity. For general object tracking, methods such as max margin correlation filters (Rodriguez et al., 2013) learn robust tracking templates from a single sample of the patch. A single image can also be used to learn and interpolate multi-scale textures with a GAN framework (Rott Shaham et al., 2019). Single sample learning was pursued by the semi-parametric exemplar SVM model (Malisiewicz et al., 2011). They learn one SVM per positive sample separating it from all negative patches mined from the background. While only one sample is used for the positive set, the negative set consists of thousands of images and is a necessary component of their method. The negative space was approximated by a multi-dimensional Gaussian by the Exemplar LDA (Hariharan et al., 2012). These SVMs, one per positive sample, are pooled together using a max aggregation. We differ from both of these approaches in that we do not use a large collection of negative images to train our model. Instead we restrict ourselves to a single or a few images with a systematic augmentation strategy.
49
+
50
+ Classical learned and hand-crafted low-level feature extractors: Learning and hand-crafting features pre-dates modern deep learning approaches and self-supervision techniques. For example the classical work of (Olshausen & Field, 1997) shows that edge-like filters can be learned via sparse coding of just 10 natural scene images. SIFT (Lowe, 2004) and HOG (Dalal & Triggs, 2005) have been used extensively before the advent of convolutional neural networks and, in many ways, they resemble the first layers of these networks. The scatter transform of Bruna & Mallat (2013); Oyallon et al. (2017) is an handcrafted design that aims at replacing at least the first few layers of a deep network. While these results show that effective low-level features can be handcrafted, this is insufficient to clarify the power and limitation of self-supervision in deep networks. For instance, it is not obvious whether deep networks can learn better low level features than these, how many images may be required to learn them, and how effective self-supervision may be in doing so. For instance, as we also show in the experiments, replacing low-level layers in a convolutional networks with handcrafted features such as Oyallon et al. (2017) may still decrease the overall performance of the model. Furthermore, this says little about deeper layers, which we also investigate.
51
+
52
+ In this work we show that current deep learning methods learn slightly better low-level representations than hand crafted features such as the scattering transform. Additionally, these representations can be learned from one single image with augmentations and without supervision. The results show how current self-supervised learning approaches that use one million images yield only relatively small gains when compared to what can be achieved from one image and augmentations, and motivates a renewed focus on augmentations and incorporating prior knowledge into feature extractors.
53
+
54
+ # 3 METHODS
55
+
56
+ We discuss first our data and data augmentation strategy (section 3.1) and then we summarize the three different methods for unsupervised feature learning used in the experiments (section 3.2).
57
+
58
+ # 3.1 DATA
59
+
60
+ Our goal is to understand the performance of representation learning methods as a function of the image data used to train them. To make comparisons as fair as possible, we develop a protocol where only the nature of the training data is changed, but all other parameters remain fixed.
61
+
62
+ In order to do so, given a baseline method trained on $d$ source images, we replace those with another set of $d$ images. Of these, now only $N \ll d$ are source images (i.e. i.i.d. samples), while the remaining $d - N$ are augmentations of the source ones. Thus, the amount of information in the training data is controlled by $N$ and we can generate a continuum of datasets that vary from one extreme, utilizing a single source image $N = 1$ , to the other extreme, using all $N { = } d$ original training set images. For example, if the baseline method is trained on ImageNet, then $d = 1 , 2 8 1 , 1 6 7$ . When $N = 1$ , it means that we train the method using a single source image and generate the remaining 1,281,166 images via augmentation. Other baselines use CIFAR-10/100 images, so in those cases $d = 5 0 , 0 0 0$ instead.
63
+
64
+ The data augmentation protocol, is an extreme version of augmentations already employed by most deep learning protocols. Each method we test, in fact, already performs some data augmentation internally. Thus, when the method is applied on our augmented data, this can be equivalently thought of as incrementing these “native” augmentations by concatenating them with our own.
65
+
66
+ Choice of augmentations. Next, we describe how the $N$ source images are expanded to additional $d - N$ images so that the models can be trained on exactly $d$ images, independent from the choice of $N$ . The idea is to use an aggressive form of data augmentation involving cropping, scaling, rotation, contrast changes, and adding noise. These transformations are representative of invariances that one may wish to incorporate in the features. Augmentation can be seen as imposing a prior on how we expect the manifold of natural images to look like. When training with very few images, these priors become more important since the model cannot extract them directly from data.
67
+
68
+ Given a source image of size size $H \times W$ , we first extract a certain number of random patches of size $( w , h )$ , where $w \leq W$ and $h \leq H$ satisfy the additional constraints $\beta \le \frac { w h } { W H }$ and $\begin{array} { r } { \gamma \leq \frac { h } { w } \leq \gamma ^ { - 1 } } \end{array}$ . Thus, the smallest size of the crops is limited to be at least $\beta W H$ and at most the whole image. Additionally, changes to the aspect ratio are limited by $\gamma$ . In practice we use $\beta = 1 0 ^ { - 3 }$ and $\textstyle \gamma = { \frac { 3 } { 4 } }$ .
69
+
70
+ Second, good features should not change much by small image rotations, so images are rotated (before cropping to avoid border artifacts) by $\alpha \in \mathsf { \Gamma } ( - 3 5 , 3 5 )$ degrees. Due to symmetry in image statistics, images are also flipped left-to-right with $50 \%$ probability.
71
+
72
+ Illumination changes are common in natural images, we thus expect image features to be robust to color and contrast changes. Thus, we employ a set of linear transformations in RGB space to model this variability in real data. Additionally, the color/intensity of single pixels should not affect the feature representation, as this does not change the contents of the image. To this end, color jitter with additive brightness, contrast and saturation are sampled from three uniform distributions in (0.6, 1.4) and hue noise from $( - 0 . 1 , 0 . 1 )$ is applied to the image patches. Finally, the cropped and transformed patches are scaled to the color range $( - 1 , 1 )$ and then rescaled to full $S \times S$ resolution to be supplied to each representation learning method, using bilinear interpolation. This formulation ensures that the patches are created in the target resolution $S$ , independent from the size and aspect ratio $W , H$ of the source image.
73
+
74
+ Real samples. The images used for the $N { = } 1$ and $N { = } 1 0$ experiments are shown in Figure 1 and the appendix respectively (this is all the training data used in such experiments). For the special case of using a single training image, i.e. $N { = } 1$ , we have chosen one photographic $( 2 5 6 0 \times 1 9 2 0 )$ ) and one drawn image $( 6 0 0 \times 2 2 5 )$ , which we call Image A and Image $B$ , respectively. The two images were manually selected as they contain rich texture and are diverse, but their choice was not optimized for performance. We test only two images due to the cost of running a full set of experiments (each image is expanded up to $1 . 2 \mathbf { M }$ times for training some of the models, as explained above). However, this is sufficient to prove our main points. We also test another $( 1 1 6 5 \times 5 8 5 )$ ) Image $C$ to ablate the “crowdedness” of an image, as this latter contains large areas covering no objects. While resolution matters to some extent as a bigger image contains more pixels, the information within is still far more correlated, and thus more redundant than sampling several smaller images. In particular, the resolution difference in Image $\mathtt { A }$ and $_ \mathrm { B }$ appears to be negligible in our experiments. For CIFAR-10, where $S = 3 2$ we only use Image B due to the resolution difference. In direct comparison, Image B is the size of about 132 CIFAR images which is still much less than $d = 5 0 { , } 0 0 0$ . For $N > 1$ , we select the source images randomly from each method’s training set.
75
+
76
+ # 3.2 REPRESENTATION LEARNING METHODS
77
+
78
+ Generative models. Generative Adversarial Networks (GANs) (Goodfellow et al., 2014) learn to generate images using an adversarial objective: a generator network maps noise samples to image samples, approximating a target image distribution and a discriminator network is tasked with distinguishing generated and real samples. Generator and discriminator are pitched one against the other and learned together; when an equilibrium is reached, the generator produces images indistinguishable (at least from the viewpoint of the discriminator) from real ones.
79
+
80
+ Bidirectional Generative Adversarial Networks (BiGAN) (Donahue et al., 2017; Dumoulin et al., 2016) are an extension of GANs designed to learn a useful image representation as an approximate inverse of the generator through joint inference on an encoding and the image. This method’s native augmentation uses random crops and random horizontal flips to learn features from $S = 1 2 8$ sized images. As opposed to the other two methods discussed below it employs leaky ReLU nonlinearities as is typical in GAN discriminators.
81
+
82
+ Rotation. Most image datasets contain pictures that are ‘upright’ as this is how humans prefer to take and look at them. This photographer bias can be understood as a form of implicit data labelling. RotNet (Gidaris et al., 2018) exploits this by tasking a network with predicting the upright direction of a picture after applying to it a random rotation multiple of 90 degrees (in practice this is formulated as a 4-way classification problem). The authors reason that the concept of ‘upright’ requires learning high level concepts in the image and hence this method is not vulnerable to exploiting low-level visual information, encouraging the network to learn more abstract features. In our experiments, we test this hypothesis by learning from impoverished datasets that may lack the photographer bias. The native augmentations that RotNet uses on the $S { = } 2 5 6$ inputs only comprise horizontal flips and non-scaled random crops to $2 2 4 \times 2 2 4$ .
83
+
84
+ Clustering. DeepCluster (Caron et al., 2018) is a recent state-of-the-art unsupervised representation learning method. This approach alternates $k$ -means clustering to produce pseudo-labels for the data and feature learning to fit the representation to these labels. The authors attribute the success of the method to the prior knowledge ingrained in the structure of the convolutional neural network (Ulyanov et al., 2018).
85
+
86
+ The method alternatives between a clustering step, in which $k$ -means is applied on the PCA-reduced features with ID for each i $k = 1 0 ^ { 4 }$ , and a learning step, in which the network is trainedder a set of augmentations (random resized crops with usterand $\beta { \dot { = } } 0 . 0 8 , \gamma = { \textstyle \frac { 3 } { 4 } }$ horizontal flips) that constitute its native augmentations used on top of the $S { = } 2 5 6$ input images.
87
+
88
+ # 4 EXPERIMENTS
89
+
90
+ We evaluate the representation learning methods on ImageNet and CIFAR-10/100 using linear probes (Section 4.1). After ablating various choices of transformations in our augmentation protocol (Section 4.2), we move to the core question of the paper: whether a large dataset is beneficial to unsupervised learning, especially for learning early convolutional features (Section 4.3).
91
+
92
+ # 4.1 LINEAR PROBES AND BASELINE ARCHITECTURE
93
+
94
+ In order to quantify if a neural network has learned useful feature representations, we follow the standard approach of using linear probes (Zhang et al., 2017). This amounts to solving a difficult task such as ImageNet classification by training a linear classifier on top of pre-trained feature representations, which are kept fixed. Linear classifiers heavily rely on the quality of the representation since their discriminative power is low.
95
+
96
+ We apply linear probes to all intermediate convolutional layers of networks and train on the ImageNet LSVRC-12 (Deng et al., 2009) and CIFAR-10/100 (Krizhevsky, 2009) datasets, which are the standard benchmarks for evaluation in self-supervised learning. Our base encoder architecture is AlexNet (Krizhevsky et al., 2012) with BatchNorm, since this is a good representative model and is most often used in other unsupervised learning work for the purpose of benchmarking. This model has five convolutional blocks (each comprising a linear convolution later followed by ReLU and optionally max pooling). We insert the probes right after the ReLU layer in each block, and denote these entry points conv1 to conv5. Applying the linear probes at each convolutional layer allows studying the quality of the representation learned at different depths of the network.
97
+
98
+ Table 1: Ablating data augmentation using MonoGAN (left). Training a linear classifier on the features extracted at different depths of the network for CIFAR-10.
99
+
100
+ <table><tr><td></td><td colspan="4">CIFAR-10</td></tr><tr><td></td><td>conv1</td><td>conv2</td><td>conv3</td><td>conv4</td></tr><tr><td>(a) Fully sup.</td><td>66.5</td><td>70.1</td><td>72.4</td><td>75.9</td></tr><tr><td>(b) Random feat.</td><td>57.8</td><td>55.5</td><td>54.2</td><td>47.3</td></tr><tr><td>(c) No aug.</td><td>57.9</td><td>56.2</td><td>54.2</td><td>47.8</td></tr><tr><td>d) Jitter</td><td>58.9</td><td>58.0</td><td>57.0</td><td>49.8</td></tr><tr><td>通 Rotation</td><td>61.4</td><td>58.8</td><td>56.1</td><td>47.5</td></tr><tr><td>(f) Scale</td><td>67.9</td><td>69.3</td><td>67.9</td><td>59.1</td></tr><tr><td>(g) Rot.&amp;jitter</td><td>64.9</td><td>63.6</td><td>61.0</td><td>53.4</td></tr><tr><td>? Rot.&amp; scale</td><td>67.6</td><td>69.9</td><td>68.0</td><td>60.7</td></tr><tr><td>i Jitter &amp; scale</td><td>68.1</td><td>71.3</td><td>69.5</td><td>62.4</td></tr><tr><td>i All</td><td>68.1</td><td>72.3</td><td>70.8</td><td>63.5</td></tr></table>
101
+
102
+ Table 2: ImageNet LSVRC-12 linear probing evaluation (below). A linear classifier is trained on the (downsampled) activations of each layer in the pretrained model. We report classification accuracy averaged over 10 crops. The ‡ indicated that numbers are taken from (Zhang et al., 2017).
103
+
104
+ <table><tr><td rowspan="2">Method, Reference</td><td rowspan="2"></td><td colspan="6">ILSVRC-12</td></tr><tr><td>#images</td><td>conv1</td><td>conv2</td><td>conv3</td><td>conv4</td><td>conv5</td></tr><tr><td>(a)</td><td>Full-supervision‡</td><td>1,281,167</td><td>19.3</td><td>36.3</td><td>44.2</td><td>48.3</td><td>50.5</td></tr><tr><td>(b)</td><td>(Oyallon et al., 2017): Scattering</td><td>0</td><td>-</td><td>18.9</td><td>-</td><td>1</td><td>1</td></tr><tr><td>(c)</td><td>Random*</td><td>0</td><td>11.6</td><td>17.1</td><td>16.9</td><td>16.3</td><td>14.1</td></tr><tr><td>(d)</td><td>(Krahenbuhl et al., 2016):k-means‡</td><td>~160</td><td>17.5</td><td>23.0</td><td>24.5</td><td>23.2</td><td>20.6</td></tr><tr><td>(e)</td><td>(Donahue et al., 2017): BiGAN‡</td><td>1,281,167</td><td>17.7</td><td>24.5</td><td>31.0</td><td>29.9</td><td>28.0</td></tr><tr><td>(f)</td><td>mono,Image A</td><td>1</td><td>20.4</td><td>30.9</td><td>33.4</td><td>28.4</td><td>16.0</td></tr><tr><td>(g)</td><td>mono, Image B</td><td>1</td><td>20.5</td><td>30.4</td><td>31.6</td><td>27.0</td><td>16.8</td></tr><tr><td>(h)</td><td>deka</td><td>10</td><td>16.2</td><td>16.5</td><td>16.5</td><td>13.1</td><td>7.5</td></tr><tr><td>(i</td><td>kilo</td><td>1,000</td><td>16.1</td><td>17.7</td><td>18.3</td><td>17.6</td><td>13.5</td></tr><tr><td>i</td><td>(Gidaris et al., 2018): RotNet</td><td>1,281,167</td><td>18.8</td><td>31.7</td><td>38.7</td><td>38.2</td><td>36.5</td></tr><tr><td>()</td><td>mono,Image A</td><td>1</td><td>19.9</td><td>30.2</td><td>30.6</td><td>27.6</td><td>21.9</td></tr><tr><td>1</td><td>mono, Image B</td><td>1</td><td>17.8</td><td>27.6</td><td>27.9</td><td>25.4</td><td>20.2</td></tr><tr><td>(m)</td><td>deka</td><td>10</td><td>19.6</td><td>30.7</td><td>32.6</td><td>28.9</td><td>22.6</td></tr><tr><td>(n)</td><td>kilo</td><td>1,000</td><td>21.0</td><td>33.5</td><td>36.5</td><td>34.0</td><td>29.4</td></tr><tr><td>(0)</td><td>(Caron et al., 2018): DeepCluster</td><td>1,281,167</td><td>18.0</td><td>32.5</td><td>39.2</td><td>37.2</td><td>30.6</td></tr><tr><td>(p)</td><td>mono, Image A</td><td>1</td><td>20.7</td><td>31.5</td><td>32.5</td><td>28.5</td><td>21.0</td></tr><tr><td>(q)</td><td>mono,Image B</td><td>1</td><td>19.7</td><td>30.1</td><td>31.6</td><td>28.5</td><td>20.4</td></tr><tr><td>(r)</td><td>mono, Image C</td><td>1</td><td>18.9</td><td>29.2</td><td>31.5</td><td>28.9</td><td>23.5</td></tr><tr><td>(s)</td><td>deka</td><td>10</td><td>18.5</td><td>29.0</td><td>31.1</td><td>28.2</td><td>21.9</td></tr><tr><td>(t</td><td>kilo</td><td>1,000</td><td>19.5</td><td>29.8</td><td>33.0</td><td>31.7</td><td>26.8</td></tr></table>
105
+
106
+ Table 3: CIFAR-10/100. Accuracy of linear classifiers on different network layers.
107
+
108
+ <table><tr><td rowspan="2">Dataset</td><td colspan="4"></td><td colspan="4">CIFAR-100</td></tr><tr><td>conv1</td><td>conv2</td><td>CIFAR-10 conv3</td><td>conv4</td><td>conv1</td><td>conv2</td><td>conv3</td><td>conv4</td></tr><tr><td>Fully supervised</td><td>66.5</td><td>70.1</td><td>72.4</td><td>75.9</td><td>38.7</td><td>43.6</td><td>44.4</td><td>46.5</td></tr><tr><td>Random</td><td>57.8</td><td>55.5</td><td>54.2</td><td>47.3</td><td>30.9</td><td>29.8</td><td>28.6</td><td>24.1</td></tr><tr><td>RotNet</td><td>64.4</td><td>65.6</td><td>65.6</td><td>59.1</td><td>36.0</td><td>35.9</td><td>34.2</td><td>25.8</td></tr><tr><td>GAN (CIFAR-10)</td><td>67.7</td><td>73.0</td><td>72.5</td><td>69.2</td><td>39.6</td><td>46.0</td><td>45.1</td><td>39.9</td></tr><tr><td>GAN (CIFAR-100)</td><td>1</td><td>1</td><td>1</td><td>1</td><td>38.1</td><td>42.2</td><td>44.0</td><td>46.6</td></tr><tr><td>MonoGAN</td><td>68.1</td><td>72.3</td><td>70.8</td><td>63.5</td><td>39.9</td><td>46.9</td><td>44.5</td><td>38.8</td></tr></table>
109
+
110
+ Details. While linear probes are conceptually straightforward, there are several technical details that affect the final accuracy by a few percentage points. Unfortunately, prior work has used several slightly different setups, so that comparing results of different publications must be done with caution. To make matters more difficult, not all papers released evaluation source code. We prove this standardized testing code here2.
111
+
112
+ In our implementation, we follow the original proposal (Zhang et al., 2017) in pooling each representation to a vector with 9600, 9216, 9600, 9600, 9216 dimensions for $\mathtt { c o n v l - 5 }$ using adaptive max-pooling, and absorb the batch normalization weights into the preceding convolutions. For evaluation on ImageNet we follow RotNet to train linear probes: images are resized such that the shorter edge has a length of 256 pixels, random crops of $2 2 4 \times 2 2 4$ are computed and flipped horizontally with $5 0 \%$ probability. Learning lasts for 36 epochs and the learning rate schedule starts from 0.01 and is divided by five at epochs 5, 15 and 25. The top-1 accuracy of the linear classifier is then measured on the ImageNet validation subset. This uses DeepCluster’s protocol, extracting 10 crops for each validation image (four at the corners and one at the center along with their horizontal flips) and averaging the prediction scores before the accuracy is computed. For CIFAR-10/100 data, we follow the same learning rate schedule and for both training and evaluation we do not reduce the dimensionality of the representations and keep the images’ original size of $3 2 \times 3 2$ .
113
+
114
+ # 4.2 EFFECT OF AUGMENTATIONS
115
+
116
+ In order to better understand which image transformations are important to learn a good feature representations, we analyze the impact of augmentation settings. For speed, these experiments are conducted using the CIFAR-10 images $Q = 5 0$ , 000 in the training set) and with the smaller source Image $_ \mathrm { B }$ and a GAN using the Wasserstein GAN formulation with gradient penalty (Gulrajani et al., 2017). The encoder is a smaller AlexNet-like CNN consisting of four convolutional layers (kernel sizes: $7 , 5 , 3 , 3$ ; strides: 3, 2, 2, 1) followed by a single fully connected layer as the discriminator. Given that the GAN is trained on a single image (w/ augmentations), we call this setting MonoGAN.
117
+
118
+ Table 1 reports all $2 ^ { 3 }$ combinations of the three main augmentations (scale, rotation, and jitter) and a randomly initialized network baseline (see Table 1 (b)) using the linear probes protocol discussed above. Without data augmentation the model only achieves marginally better performance than the random network (which also achieves a non-negligible level of performance (Ulyanov et al., 2017; Caron et al., 2018)). This is understandable since the dataset literally consists of a single training image cloned $d$ times. Color jitter and rotation slightly improve the performance of all probes by 1- $2 \%$ points, but random rescaling adds at least ten points at every depth (see Table 1 (f,h,i)) and is the most important single augmentation. A similar conclusion can be drawn when two augmentations are combined, although there are diminishing returns as more augmentations are combined. Overall, we find all three types of augmentations are of importance when training in the ultra-low data setting.
119
+
120
+ # 4.3 BENCHMARK EVALUATION
121
+
122
+ We analyze how performance varies as a function $N$ , the number of actual samples that are used to generated the augmented datasets, and compare it to the gold-standard setup (in terms of choice of training data) defined in the papers that introduced each method. The evaluation is again based on linear probes (Section 4.1).
123
+
124
+ Mono is enough. From Table 2 we make the following observations. Training with just a single source image (f,g,k,l,p,q) is much better than random initialization (c) for all layers. Notably, these models also outperform Gabor-like filters from Scattering networks (Bruna & Mallat, 2013), which are hand crafted image features, replacing the first two convolutional layers as in (Oyallon et al., 2017). Using the same protocol as in the paper, this only achieves an accuracy of $1 8 . 9 \%$ compared to (p)’s conv $2 > 3 0 \%$ .
125
+
126
+ More importantly, when comparing within pretext task, even with one image we are able to improve the quality of conv1–conv3 features compared to full (unsupervised) ImageNet training for GAN based self-supervision (e-i). For the other methods $( \mathrm { j \cdot }$ -n, o-s) we reach and also surpass the performance for the first layer and are within $1 . 5 \%$ points for the second. Given that the best unsupervised performance for conv2 is 32.5, our method using a single source Image A (Table 2, p) is remarkably close with 31.5.
127
+
128
+ Image contents. While we surpass the GAN based approach of (Donahue et al., 2017) for both single source images, we find more nuanced results for the other two methods: For RotNet, as expected, the photographic bias cannot be extracted from a single image. Thus its performance is low with little training data and increases together with the number of images (Table 2, j-n). When comparing Image A and B trained networks for RotNet, we find that the photograph yields better performance than the hand drawn animal image. This indicates that the method can extract rotation information from low level image features such as patches which is at first counter intuitive. Considering that the hand-drawn image does not work well, we can assume that lighting and shadows even in small patches can indeed give important cues on the up direction which can be learned even from a single (real) image. DeepCluster shows poor performance in conv1 which we can improve upon in the single image setting (Table 2, o-r). Naturally, the image content matters: a trivial image without any image gradient (e.g. picture of a white wall) would not provide enough signal for any method. To better understand this issue, we also train DeepCluster on the much less cluttered Image C to analyze how much the image influences our claims. We find that even though this image contains large parts of sky and sea, the performance is only slightly lower than that of Image A. This finding indicates that the augmentations can even compensate for large untextured areas and the exact choice of image is not critical.
129
+
130
+ ![](images/47da3d26c9e9068651078be6be738408c464663bb72932691e02010a521e8e9a.jpg)
131
+ Figure 2: conv1 filters trained using a single image. The 96 learned $( 3 \times 1 1 \times 1 1 )$ filters for the first layer of AlexNet are shown for each single training image and method along with their linear classifier performance. For visualization, each filter is normalized to be in the range of $( - 1 , 1 )$ .
132
+
133
+ More than one image. While BiGAN fails to converge for $N \in \{ 1 0 , 1 0 0 0 \}$ , most likely due to issues in learning from a distribution which is neither whole images nor only patches, we find that both RotNet and DeepCluster improve their performance in deeper layers when increasing the number of training images. However, for conv1 and conv2, a single image is enough. In deeper layers, DeepCluster seems to require large amounts of source images to yield the reported results as the deka- and kilo- variants start improving over the single image case (Table 2, o-t). This need for data also explains the gap between the two input images which have different resolutions. Summarizing Table 2, we can conclude that learning conv1, conv2 and for the most part conv3 (33.4 vs. 39.4) on over 1M images does not yield a significant performance increase over using one single training image — a highly unexpected result.
134
+
135
+ Generalization. In Table 3, we show the results of training linear classifiers for the CIFAR-10 dataset and compare against various baselines. We find that the GAN trained on the smaller Image B outperforms all other methods including the fully-supervised trained one for the first convolutional layer. We also outperform the same architecture trained on the full CIFAR-10 training set using RotNet, which might be due to the fact that either CIFAR images do not contain much information about the orientation of the picture or because they do not contain as many objects as in ImageNet. While the GAN trained on the whole dataset outperforms the MonoGAN on the deeper layers, the gap stays very small until the last layer. These findings are also reflected in the experiments on the CIFAR-100 dataset shown in Table 3. We find that our method obtains the best performance for the first two layers, even against the fully supervised version. The gap between our mono variant and the other methods increases again with deeper layers, hinting to the fact that we cannot learn very high level concepts in deeper layers from just one single image. These results corroborate the finding that our method allows learning very generalizable early features that are not domain dependent.
136
+
137
+ # 4.4 QUALITATIVE ANALYSIS
138
+
139
+ Visual comparison of weights. In Figure 2, we compare the learned filters of all first-layer convolutions of an AlexNet trained with the different methods and a single image. First, we find that the filters closely resemble those obtained via supervised training: Gabor-like edge detectors and various color blobs. Second, we find that the look is not easily predictive of its performance, e.g.
140
+
141
+ while generatively learned filters (BiGAN) show many edge detectors, its linear probes performance is about the same as that of DeepCluster which seems to learn many somewhat redundant point features. However, we also find that some edge detectors are required, as we can confirm from RotNet and DeepCluster trained on Image B, which yield less crisp filters and worse performances.
142
+
143
+ Table 4: Finetuning experiments The pretrained model’s first two convolutions are left frozen (or replaced by the Scattering transform) and the nework is retrained using ImageNet LSVRC-12 training set.
144
+
145
+ <table><tr><td></td><td>Top-1</td></tr><tr><td>Full sup.</td><td>59.4</td></tr><tr><td>Random</td><td>42.6</td></tr><tr><td>Scattering</td><td>49.2</td></tr><tr><td>BiGAN, A</td><td>51.4</td></tr><tr><td>RotNet, A</td><td>49.5</td></tr><tr><td>DeepCluster A</td><td>52.5</td></tr></table>
146
+
147
+ ![](images/28641601f8b033094919f1f4d9ec2805f166320615575ce7240f102b217c3607.jpg)
148
+ Figure 3: Style transfer with single-image pretraining. We show two style transfer results using the Image A trained BiGAN and the ImageNet pretrained AlexNet.
149
+
150
+ Fine-tuning instead of freezing. In Tab. 4, we show the results of retraining a network with the first two convolutional filters, or the scattering transform from (Oyallon et al., 2017), left frozen. We observe that our single image trained DeepCluster and BiGAN models achieve performances closes to the supervised benchmark. Notably, the scattering transform as a replacement for conv1-2 performs slightly worse than the analyzed single image methods. We also show in the appendix the results of retraining a network initialized with the first two convolutional layers obtained from a single image and subsequently linearly probing the model. The results are shown in Appendix Tab. 5 and we find that we can recover the performance of fully-supervised networks, i.e. the first two convolutional filters trained from just a single image generalize well and do not get stuck in an image specific minimum.
151
+
152
+ Neural style transfer. Lastly, we show how our features trained on only a single image can be used for other applications. In Figure 3 we show two basic style transfers using the method of (Gatys et al., 2016) from an official PyTorch tutorial3. Image content and style are separated and the style is transferred from the source to target image using all CNN features, not just the shallow layers. We visually compare the results of using our features and from full ImageNet supervision. We find almost no visual differences in the stylized images and can conclude that our early features are equally powerful as fully supervised ones for this task.
153
+
154
+ # 5 CONCLUSIONS
155
+
156
+ We have made the surprising observation that we can learn good and generalizable features through self-supervision from one single source image, provided that sufficient data augmentation is used. Our results complement recent works (Mahajan et al., 2018; Goyal et al., 2019) that have investigated self-supervision in the very large data regime. Our main conclusion is that these methods succeed perfectly in capturing the simplest image statistics, but that for deeper layers a gap exist with strong supervision which is compensated only in limited manner by using large datasets. This novel finding motivates a renewed focus on the role of augmentations in self-supervised learning and critical rethinking of how to better leverage the available data.
157
+
158
+ # ACKNOWLEDGEMENTS.
159
+
160
+ We thank Aravindh Mahendran for fruitful discussions. Yuki Asano gratefully acknowledges support from the EPSRC Centre for Doctoral Training in Autonomous Intelligent Machines & Systems (EP/L015897/1). The work is supported by ERC IDIU-638009.
161
+
162
+ REFERENCES
163
+ Pulkit Agrawal, Joao Carreira, and Jitendra Malik. Learning to see by moving. In Proc. ICCV, pp. 37–45. IEEE, 2015. 3
164
+ R. Arandjelovic and A. Zisserman. Look, listen and learn. In ´ Proc. ICCV, 2017. 3
165
+ Piotr Bojanowski and Armand Joulin. Unsupervised learning by predicting noise. In Proc. ICML, pp. 517–526. PMLR, 2017. 2
166
+ Joan Bruna and Stephane Mallat. Invariant scattering convolution networks. ´ IEEE transactions on pattern analysis and machine intelligence, 35(8):1872–1886, 2013. 3, 7
167
+ M. Caron, P. Bojanowski, A. Joulin, and M. Douze. Deep clustering for unsupervised learning of visual features. In Proc. ECCV, 2018. 2, 3, 5, 6, 7, 13
168
+ N. Dalal and B Triggs. Histogram of Oriented Gradients for Human Detection. In Proc. CVPR, volume 2, pp. 886–893, 2005. 2, 3
169
+ Virginia R de Sa. Learning classification with unlabeled data. In NIPS, pp. 112–119, 1994. 3
170
+ J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. Imagenet: A large-scale hierarchical image database. In Proc. CVPR, 2009. 5
171
+ Carl Doersch, Abhinav Gupta, and Alexei A Efros. Unsupervised visual representation learning by context prediction. In Proc. ICCV, pp. 1422–1430, 2015. 2
172
+ Jeff Donahue, Philipp Krhenbhl, and Trevor Darrell. Adversarial feature learning. Proc. ICLR, 2017. 2, 3, 5, 6, 7
173
+ A. Dosovitskiy, P. Fischer, J. T. Springenberg, M. Riedmiller, and T. Brox. Discriminative unsupervised feature learning with exemplar convolutional neural networks. IEEE PAMI, 38(9):1734–1747, Sept 2016. ISSN 0162-8828. doi: 10.1109/TPAMI.2015.2496141. 2
174
+ V. Dumoulin, I. Belghazi, B. Poole, O. Mastropietro, A. Lamb, M. Arjovsky, and A. Courville. Adversarially learned inference. arXiv preprint arXiv:1606.00704, 2016. 5
175
+ D. Erhan, Y. Bengio, A. Courville, and P. Vincent. Visualizing higher-layer features of a deep network. Technical Report 1341, University of Montreal, Jun 2009. 13
176
+ Chuang Gan, Boqing Gong, Kun Liu, Hao Su, and Leonidas J Guibas. Geometry guided convolutional neural networks for self-supervised video representation learning. In Proc. CVPR, 2018. 3
177
+ Rouhan Gao, Dinesh Jayaraman, and Kristen Grauman. Object-centric representation learning from unlabeled videos. In Proc. ACCV, 2016. 3
178
+ Leon A Gatys, Alexander S Ecker, and Matthias Bethge. Image style transfer using convolutional neural networks. In Proc. CVPR, pp. 2414–2423, 2016. 2, 9
179
+ R. Geirhos, P. Rubisch, C. Michaelis, M. Bethge, F. A. Wichmann, and W. Brendel. Imagenet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness. In International Conference on Learning Representations, 2019. 14
180
+ Spyros Gidaris, Praveen Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. In Proc. ICLR, 2018. 2, 3, 5, 6
181
+ R. B. Girshick. Fast R-CNN. In Proc. ICCV, 2015. 1
182
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, pp. 2672–2680, 2014. 5
183
+ Priya Goyal, Dhruv Mahajan, Abhinav Gupta, and Ishan Misra. Scaling and benchmarking self-supervised visual representation learning. arXiv preprint arXiv:1905.01235, 2019. 9
184
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville. Improved training of wasserstein gans. In NIPS, pp. 5767–5777, 2017. 7
185
+ B. Hariharan, J. Malik, and D. Ramanan. Discriminative decorrelation for clustering and classification. In Proc. ECCV, 2012. 3
186
+ M. Huh, P. Agrawal, and A. A. Efros. What makes imagenet good for transfer learning? arXiv preprint arXiv:1608.08614, 2016. 1
187
+ Phillip Isola, Daniel Zoran, Dilip Krishnan, and Edward H Adelson. Learning visual groups from cooccurrences in space and time. In Proc. ICLR, 2015. 3
188
+ Dinesh Jayaraman and Kristen Grauman. Learning image representations tied to ego-motion. In Proc. ICCV, 2015. 3
189
+ Dinesh Jayaraman and Kristen Grauman. Slow and steady feature analysis: higher order temporal coherence in video. In Proc. CVPR, 2016. 3
190
+ Simon Jenni and Paolo Favaro. Self-supervised feature learning by learning to spot artifacts. In Proc. CVPR, 2018. 2
191
+ J. Johnson, A. Alahi, and L. Fei-Fei. Perceptual losses for real-time style transfer and super-resolution. In Proc. ECCV, pp. 694–711, 2016. 2
192
+ R. Kat, R. Jevnisek, and S. Avidan. Matching pixels using co-occurrence statistics. In Proc. ICCV, pp. 1751– 1759, 2018. 2
193
+ Philipp Krahenb ¨ uhl, Carl Doersch, Jeff Donahue, and Trevor Darrell. Data-dependent initializations of convo-¨ lutional neural networks. Proc. ICLR, 2016. 6
194
+ A. Krizhevsky, I. Sutskever, and G. E. Hinton. ImageNet classification with deep convolutional neural networks. In NIPS, pp. 1106–1114, 2012. 5
195
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009. 5
196
+ Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Colorization as a proxy task for visual understanding. In Proc. CVPR, 2017. 2
197
+ Hsin-Ying Lee, Jia-Bin Huang, Maneesh Kumar Singh, and Ming-Hsuan Yang. Unsupervised representation learning by sorting sequence. In Proc. ICCV, 2017. 2
198
+ D. Lowe. Distinctive image features from scale-invariant keypoints. IJCV, 60(2):91–110, 2004. 2, 3
199
+ Dhruv Mahajan, Ross Girshick, Vignesh Ramanathan, Kaiming He, Manohar Paluri, Yixuan Li, Ashwin Bharambe, and Laurens van der Maaten. Exploring the limits of weakly supervised pretraining. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 181–196, 2018. 9
200
+ A. Mahendran, J. Thewlis, and A. Vedaldi. Cross pixel optical-flow similarity for self-supervised learning. In Proc. ACCV, 2018. 3
201
+ T. Malisiewicz, A. Gupta, and A. A. Efros. Ensemble of exemplar-SVMs for object detection and beyond. In Proc. ICCV, 2011. 3
202
+ Ishan Misra, C. Lawrence Zitnick, and Martial Hebert. Shuffle and learn: Unsupervised learning using temporal order verification. In Proc. ECCV, 2016. 2
203
+ T Mundhenk, Daniel Ho, and Barry Y. Chen. Improvements to context based self-supervised learning. In Proc. CVPR, 2017. 2
204
+ Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In Proc. ECCV, pp. 69–84. Springer, 2016. 2
205
+ Mehdi Noroozi, Hamed Pirsiavash, and Paolo Favaro. Representation learning by learning to count. In Proc. ICCV, 2017. 2
206
+ Mehdi Noroozi, Ananth Vinjimoor, Paolo Favaro, and Hamed Pirsiavash. Boosting self-supervised learning via knowledge transfer. In Proc. CVPR, 2018. 2
207
+ Chris Olah, Arvind Satyanarayan, Ian Johnson, Shan Carter, Ludwig Schubert, Katherine Ye, and Alexander Mordvintsev. The building blocks of interpretability. Distill, 3(3):e10, 2018. 13
208
+ B. A. Olshausen and D. J. Field. Sparse coding with an overcomplete basis set: A strategy employed by V1? Vision Research, 37(23):3311–3325, 1997. 2, 3
209
+ M. Oquab, L. Bottou, I. Laptev, and J. Sivic. Learning and Transferring Mid-Level Image Representations using Convolutional Neural Networks. In Proc. CVPR, 2014. 1
210
+ Andrew Owens, Phillip Isola, Josh H. McDermott, Antonio Torralba, Edward H. Adelson, and William T. Freeman. Visually indicated sounds. In Proc. CVPR, pp. 2405–2413, 2016. 3
211
+ Edouard Oyallon, Eugene Belilovsky, and Sergey Zagoruyko. Scaling the scattering transform: Deep hybrid networks. pp. 5618–5627, 2017. 3, 6, 7, 9
212
+ Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, and Alexei A Efros. Context encoders: Feature learning by inpainting. In Proc. CVPR, pp. 2536–2544, 2016. 2
213
+ Deepak Pathak, Ross Girshick, Piotr Dollar, Trevor Darrell, and Bharath Hariharan. Learning features by ´ watching objects move. In Proc. CVPR, 2017. 3
214
+ Zhongzheng Ren and Yong Jae Lee. Cross-domain self-supervised multi-task feature learning using synthetic imagery. In Proc. CVPR, 2018. 2
215
+ A. Rodriguez, V. Naresh Boddeti, BVK V. Kumar, and A. Mahalanobis. Maximum margin correlation filter: A new approach for localization and classification. IEEE Transactions on Image Processing, 22(2):631–643, 2013. 3
216
+ Tamar Rott Shaham, Tali Dekel, and Tomer Michaeli. Singan: Learning a generative model from a single natural image. In Computer Vision (ICCV), IEEE International Conference on, 2019. 3
217
+ Pierre Sermanet et al. Time-contrastive networks: Self-supervised learning from video. In Proc. Intl. Conf. on Robotics and Automation, 2018. 2
218
+ H. Shin, H. R. Roth, M. Gao, L. Lu, Z. Xu, I. Nogues, J. Yao, D. Mollura, and R. M. Summers. Deep convolutional neural networks for computer-aided detection: Cnn architectures, dataset characteristics and transfer learning. IEEE Trans. on Medical Imaging, 35(5):1285–1298, May 2016. ISSN 0278-0062. 1
219
+ N. Srivastava, E. Mansimov, and R. Salakhudinov. Unsupervised learning of video representations using lstms. In Proc. ICML, 2015. 3
220
+ I. Talmi, R. Mechrez, and L. Zelnik-Manor. Template matching with deformable diversity similarity. In Proc. CVPR, pp. 175–183, 2017. 2
221
+ D. Ulyanov, A. Vedaldi, and V. Lempitsky. Improved texture networks: Maximizing quality and diversity in feed-forward stylization and texture synthesis. In Proc. CVPR, 2017. 7
222
+ D. Ulyanov, A. Vedaldi, and V. Lempitsky. Deep image prior. In Proc. CVPR, 2018. 5
223
+ X. Wang and A. Gupta. Unsupervised learning of visual representations using videos. In Proc. ICCV, pp. 2794–2802, 2015. 3
224
+ Xiaolong Wang, Kaiming He, and Abhinav Gupta. Transitive invariance for self-supervised visual representation learning. In Proc. ICCV, 2017. 3
225
+ D. Wei, J. Lim, A. Zisserman, and W. T. Freeman. Learning and using the arrow of time. In Proc. CVPR, 2018. 2
226
+ J. Yosinski, J. Clune, Y. Bengio, and H. Lipson. How transferable are features in deep neural networks? In NIPS, pp. 3320–3328, 2014. 1
227
+ M. D. Zeiler and Rob Fergus. Visualizing and understanding convolutional networks. In Proc. ECCV, 2014. 13
228
+ Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In Proc. ECCV, pp. 649–666. Springer, 2016. 2
229
+ Richard Zhang, Phillip Isola, and Alexei A. Efros. Split-brain autoencoders: Unsupervised learning by crosschannel prediction. In Proc. CVPR, 2017. 5, 6, 7, 13
230
+
231
+ # A APPENDIX
232
+
233
+ # A.1 IMAGENET TRAINING IMAGES
234
+
235
+ ![](images/046e21f8bf046efcf2184e9d1086c428f27cb732dddd0a050c1fa62dee848678.jpg)
236
+ Figure 4: ImageNet images for the $N { = } 1 0$ experiments.
237
+
238
+ The images used for the $N { = } 1 0$ experiments are shown in fig. 4.
239
+
240
+ # A.2 VISUAL COMPARISON OF FILTERS
241
+
242
+ ![](images/2f5f075fffec40a9fe974918f1470779b27b8abdc86af77cd7e6cd3a644973b5.jpg)
243
+ Figure 5: Filter visualization. We show activation maximization (left) and retrieval of top 9 activated images from the training set of ImageNet (right) for four random non-cherrypicked target filters. From top to bottom: conv1-5 of the BiGAN trained on a single image A. The filter visualization is obtained by learning a (regularized) input image that maximizes the response to the target filter using the library Lucid (Olah et al., 2018).
244
+
245
+ In order to understand what deeper neurons are responding to in our model, we visualize random neurons via activation maximization (Erhan et al., 2009; Zeiler & Fergus, 2014) in each layer. Additionally, we retrieve the top-9 images in the ImageNet training set that activate each neuron most in Figure 5. Since the mono networks are not trained on the ImageNet dataset, it can be used here for visualization. From the first convolutional layer we find typical neurons strongly reacting to oriented edges. In layers 2-4 we find patterns such as grids (conv2:3), and textures such as leopard skin (conv2:2) and round grid cover (conv4:4). Confirming our hypothesis that the neural network is only extracting patterns and not semantic information, we do not find any neurons particularly specialized to certain objects even in higher levels as for example dog faces or similar which can be fund in supervised networks. This finding aligns with the observations of other unsupervised methods (Caron et al., 2018; Zhang et al., 2017). As most neurons extract simple patterns and textures, the surprising effectiveness of training a network using a single image can be explained by the recent finding that even CNNs trained on ImageNet rely on texture (as opposed to shape) information to classify (Geirhos et al., 2019).
246
+
247
+ Table 5: Finetuning experiments Models are initialized using conv1 and conv2 from various single image trained models and the whole network is fine-tuned using ImageNet LSVRC-12 training set. Accuracy is averaged over 10 crops.
248
+
249
+ <table><tr><td>c1</td><td>c2 c3</td><td>c4</td><td>c5</td></tr><tr><td>Full sup.</td><td>19.3 36.3 44.2</td><td>48.3 50.5</td><td></td></tr><tr><td>BiGAN, A</td><td>22.5 37.6 44.2</td><td>47.6 48.3</td><td></td></tr><tr><td>RotNet, A</td><td>22.0 38.2</td><td>44.8 49.2 51.8</td><td></td></tr><tr><td>DeepCluster, A 21.8 35.9</td><td>43.6</td><td>48.8</td><td>50.4</td></tr></table>
250
+
251
+ # A.3 RETRAINING FROM SINGLE IMAGE INITIALIZATION
252
+
253
+ In Table 5, we initialize AlexNet models using the first two convolutional filters learned from a single image and retrain them using ImageNet. We find that the networks recover their performance fully and the first filters do not make the network stuck in a bad local minimum despite having been trained on a single image from a different distribution. The difference from the BiGAN to the full supervision model is likely due to it using a smaller input resolution (112 instead of 224), as the BiGAN’s output resolution is limited.
254
+
255
+ # A.4 LINEAR PROBES ON IMAGENET
256
+
257
+ We show two plots of the ImageNet linear probes results (Table 2 of the paper) in fig. 6. On the left we plot performance per layer in absolute scale. Naturally the performance of the supervised model improves with depth, while all unsupervised models degrade after conv3. From the relative plot on the right, it becomes clear that with our training scheme, we can even slightly surpass supervised performance on conv1 presumably since our model is trained with sometimes very small patches, thus receiving an emphasis on learning good low level filters. The gap between all self-supervised methods and the supervised baseline increases with depth, due to the fact that the supervised model is trained for this specific task, whereas the self-supervised models learn from a surrogate task without labels.
258
+
259
+ ![](images/9bb9bbb4170ebecfa72682345ec6c7569f3b6ee0c4cf53fa2ee208649efb83a1.jpg)
260
+ Figure 6: Linear Classifiers on ImageNet. Classification accuracies of linear classifiers trained on the representations from Table 2 are shown in absolute scale.
261
+
262
+ # A.5 EXAMPLE AUGMENTED TRAINING DATA
263
+
264
+ In figs. 7 to 10 we show example patches generated by our augmentation strategy for the datasets with different N. Even though the images and patches are very different in color and shape distribu
265
+
266
+ tion, our model learns weights that perform similarly in the linear probes benchmark (see Table 2 in the paper).
267
+
268
+ ![](images/d7b4139a73a054c21258fc27b0228d0a962fd351f9792c2826ceaccf0656d21e.jpg)
269
+ Figure 7: Example crops of Image A ( $N = 1$ ) dataset.
270
+
271
+ ![](images/edd8e1f5572325341cf862f150b4183d8a280538461d8991f5f2d6aa06e81d59.jpg)
272
+ Figure 8: Example crops of Image B $N = 1$ ) dataset. 50 samples were selected randomly.
273
+
274
+ ![](images/181050cf9ad7ded511060047fb8ebdbc14b65be193fdd00679f0687df8f35d45.jpg)
275
+ Figure 9: Example crops of deka $N = 1 0$ ) dataset. 50 samples were selected randomly.
276
+
277
+ ![](images/5f1fd0a8bdc394bef8d19a152e1205bbd6f49971803be773b209278e19a9fa63.jpg)
278
+ Figure 10: Example crops of kilo ( $\overline { { N = 1 0 0 0 } }$ ) dataset. 50 samples were selected randomly.
md/train/BVSM0x3EDK6/BVSM0x3EDK6.md ADDED
@@ -0,0 +1,384 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ROBUST AND GENERALIZABLE VISUAL REPRESENTATION LEARNING VIA RANDOM CONVOLUTIONS
2
+
3
+ Zhenlin $\mathbf { X } \mathbf { u } ^ { 1 }$ , Deyi $\mathbf { L i u } ^ { 1 }$ , Junlin Yang2, Colin Raffel1, and Marc Niethammer1
4
+
5
+ 1 University of North Carolina at Chapel Hill 2 Yale University 1{zhenlinx, mn, craffel}@cs.unc.edu, deyi@live.unc.edu 2junlin.yang@yale.edu
6
+
7
+ # ABSTRACT
8
+
9
+ While successful for various computer vision tasks, deep neural networks have shown to be vulnerable to texture style shifts and small perturbations to which humans are robust. In this work, we show that the robustness of neural networks can be greatly improved through the use of random convolutions as data augmentation. Random convolutions are approximately shape-preserving and may distort local textures. Intuitively, randomized convolutions create an infinite number of new domains with similar global shapes but random local texture. Therefore, we explore using outputs of multi-scale random convolutions as new images or mixing them with the original images during training. When applying a network trained with our approach to unseen domains, our method consistently improves the performance on domain generalization benchmarks and is scalable to ImageNet. In particular, in the challenging scenario of generalizing to the sketch domain in PACS and to ImageNet-Sketch, our method outperforms state-of-art methods by a large margin. More interestingly, our method can benefit downstream tasks by providing a more robust pretrained visual representation. 1
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Generalizability and robustness to out-of-distribution samples have been major pain points when applying deep neural networks (DNNs) in real world applications (Volpi et al., 2018). Though DNNs are typically trained on datasets with millions of training samples, they still lack robustness to domain shift, small perturbations, and adversarial examples (Luo et al., 2019). Recent research has shown that neural networks tend to use superficial features rather than global shape information for prediction even when trained on large-scale datasets such as ImageNet (Geirhos et al., 2019). These superficial features can be local textures or even patterns imperceptible to humans but detectable to DNNs, as is the case for adversarial examples (Ilyas et al., 2019). In contrast, image semantics often depend more on object shapes rather than local textures. For image data, local texture differences are one of the main sources of domain shift, e.g., between synthetic virtual images and real data (Sun & Saenko, 2014). Our goal is therefore to learn visual representations that are invariant to local texture and that generalize to unseen domains. While texture and color may be treated as different concepts, we follow the convention in Geirhos et al. (2019) and include color when talking about texture.
14
+
15
+ We address the challenging setting of robust visual representation learning from single domain data. Limited work exists in this setting. Proposed methods include data augmentation (Volpi et al., 2018; Qiao et al., 2020; Geirhos et al., 2019), domain randomization (Tobin et al., 2017; Yue et al., 2019), self-supervised learning (Carlucci et al., 2019), and penalizing the predictive power of low-level network features (Wang et al., 2019a). Following the spirit of adding inductive bias towards global shape information over local textures, we propose using random convolutions to improve the robustness to domain shifts and small perturbations. While recently Lee et al. (2020) proposed a similar technique for improving the generalization of reinforcement learning agents in unseen environments, we focus on visual representation learning and examine our approach on visual domain generalization benchmarks. Our method also includes the multiscale design and a mixing variant. In addition, considering that many computer vision tasks rely on training deep networks based on ImageNet-pretrained weights (including some domain generalization benchmarks), we ask “Can a more robust pretrained model make the finetuned model more robust on downstream tasks?” Different from (Kornblith et al., 2019; Salman et al., 2020) who studied the transferability of a pretrained ImageNet representation to new tasks while focusing on in-domain generalization, we explore generalization performance on unseen domains for new tasks.
16
+
17
+ ![](images/fd7c9f9d8b200815c39951855989c43207583b7b966425745cfdd84427e984b8.jpg)
18
+ Figure 1: Top: Illustration that RandConv randomize local texture but preserve shapes in the image. Middle: First column is the input image of size $2 2 4 ^ { 2 }$ ; following columns are convolutions results using random filters of different sizes $k$ . Bottom: Mixing results between an image and one of its random convolution results with different mixing coefficients $\alpha$ .
19
+
20
+ We make the following contributions:
21
+
22
+ • We develop RandConv, a data augmentation technique using multi-scale random-convolutions to generate images with random texture while maintaining global shapes. We explore using the RandConv output as training images or mixing it with the original images. We show that a consistency loss can further enforce invariance under texture changes. • We provide insights and justification on why RandConv augments images with different local texture but the same semantics with the shape-preserving property of random convolutions. We validate RandConv and its mixing variant in extensive experiments on synthetic and realworld benchmarks as well as on the large-scale ImageNet dataset. Our methods outperform single domain generalization approaches by a large margin on digit recognition datasets and for the challenging case of generalizing to the Sketch domain in PACS and to ImageNet-Sketch. • We explore if the robustness/generalizability of a pretrained representation can transfer. We show that transferring a model pretrained with RandConv on ImageNet can further improve domain generalization performance on new downstream tasks on the PACS dataset.
23
+
24
+ # 2 RELATED WORK
25
+
26
+ Domain Generalization (DG) aims at learning representations that perform well when transferred to unseen domains. Modern techniques range between feature fusion (Shen et al., 2019), metalearning (Li et al., 2018a; Balaji et al., 2018), and adversarial training (Shao et al., 2019; Li et al., 2018b). Note that most current DG work (Ghifary et al., 2016; Li et al., 2018a;b) requires a multisource training setting to work well. However, in practice, it might be difficult and expensive to collect data from multiple sources, such as collecting data from multiple medical centers (Raghupathi & Raghupathi, 2014). Instead, we consider the more strict single-domain generalization DG setting, where we train the model on source data from a single domain and generalize it to new unseen domains (Carlucci et al., 2019; Wang et al., 2019b).
27
+
28
+ Domain Randomization (DR) was first introduced as a DG technique by Tobin et al. (2017) to handle the domain gap between simulated and real data. As the training data in (Tobin et al., 2017) is synthesized in a virtual environment, it is possible to generate diverse training samples by randomly selecting background images, colors, lighting, and textures of foreground objects. When a simulation environment is not accessible, image stylization can be used to generate new domains (Yue et al., 2019; Geirhos et al., 2019). However, this requires extra effort to collect data and to train an additional model; further, the number of randomized domains is limited by the number of predefined styles.
29
+
30
+ Data Augmentation has been widely used to improve the generalization of machine learning models (Simard et al., 2003). DR approaches can be considered a type of synthetic data augmentation. To improve performance on unseen domains, Volpi et al. (2018) generate adversarial examples to augment the training data; Qiao et al. (2020) extend this approach via meta-learning. As with other adversarial training algorithms, significant extra computation is required to obtain adversarial examples.
31
+
32
+ Learning Representations Biased towards Global Shape Geirhos et al. (2019) demonstrated that convolutional neural networks (CNNs) tend to use superficial local features even when trained on large datasets. To counteract this effect, they proposed to train on stylized ImageNet, thereby forcing a network to rely on object shape instead of textures. Wang et al. improved out-of-domain performance by penalizing the correlation between a learned representation and superficial features such as the gray-level co-occurrence matrix (Wang et al., 2019b), or by penalizing the predictive power of local, low-level layer features in a neural network via an adversarial classifier (Wang et al., 2019a). Our approach shares the idea that learning representations invariant to local texture helps generalization to unseen domains. However, RandConv avoids searching over many hyper-parameters, collecting extra data, and training other networks. It also scales to large-scale datasets since it adds minimal computation overhead.
33
+
34
+ Random Mapping in Machine Learning Random projections have also been effective for dimensionality reduction based on the distance-preserving property of the Johnson–Lindenstrauss lemma (Johnson & Lindenstrauss, 1984). (Vinh et al., 2016) applied random projections on entire images as data augmentation to make neural networks robust to adversarial examples. Lee et al. (2020) recently used random convolutions to help reinforcement learning (RL) agents generalize to new environments. Neural networks with fixed random weights can encode meaningful representations (Saxe et al., 2011) and are therefore useful for neural architecture search (Gaier & Ha, 2019), generative models (He et al., 2016b), natural language processing (Wieting & Kiela, 2019), and RL (Osband et al., 2018; Burda et al., 2019). In contrast, RandConv uses non-fixed randomly-sampled weights to generate images with different local texture.
35
+
36
+ # 3 RANDCONV: RANDOMIZE LOCAL TEXTURE AT DIFFERENT SCALES
37
+
38
+ We propose using a convolution layer with non-fixed random weights as the first layer of a DNN during training. This strategy generates images with random local texture but consistent shapes, and is beneficial for robust visual representation learning. Sec. 3.1 justifies the shape-preserving property of a random convolution layer. Sec. 3.2 describes RandConv, our data augmentation algorithm using a multi-scale randomized convolution layer and input mixing.
39
+
40
+ # 3.1 A RANDOM CONVOLUTION LAYER PRESERVES GLOBAL SHAPES
41
+
42
+ Convolution is the key building block for deep convolutional neural networks. Consider a convolution layer with filters $\pmb { \Theta } \doteq \mathbb { R } ^ { h \times w \times C _ { i n } \times C _ { o u t } }$ with an input image $\mathbf { I } \in \mathbb { R } ^ { H \times W \times C _ { i n } }$ , where $H$ and $W$ are the height and width of the input and $C _ { i n }$ and $C _ { o u t }$ are the number of feature channels for the input and output, and $h$ and $w$ are the height and width of the layer’s filter. The output (with appropriate input padding) will be $\mathbf { g } = \mathbf { I } * \mathbf { \Theta } \Theta$ with $\mathbf { g } \in \mathbb { R } ^ { H \times W \times C _ { o u t } }$ .
43
+
44
+ In images, nearby pixels with similar color or texture can be grouped into primitive shapes that represent parts of objects or the background. A convolution layer linearly projects local image patches to features at corresponding locations on the output map using shared parameters. While a convolution with random filters can project local patches to arbitrary output features, the output of a random linear projection approximately preserves relative similarity between input patches, proved in Appendix B. In other words, since any two locations within the same shape have similar local textures in the input image, they tend to be similar in the output feature map. Therefore, shapes that emerge in the output feature map are similar to shapes in the input image provided that the filter size is sufficiently small compared to the size of a typical shape.
45
+
46
+ In other words, the size of a convolution filter determines the smallest shape it can preserve. For example, 1x1 random convolutions preserve shapes at the single-pixel level and thus work as a random color mapping; large filters perturb shapes smaller than the filter size that are considered local texture of a shape at this larger scale. See Fig. 1 for examples. More discussion and a formal proof are in Appendix A and $B$ .
47
+
48
+ # Algorithm 1 Learning with Data Augmentation by Random Convolutions
49
+
50
+ 1: Input: Model $\Phi$ , task loss $\mathcal { L } _ { t a s k }$ , training images $\{ I _ { i } \} _ { i = 1 } ^ { N }$ and their labels $\{ y _ { i } \} _ { i = 1 } ^ { N }$ , pool of filter sizes
51
+ $\mathcal { K } = \{ 1 , . . . , n \}$ , fraction of original data $p$ , whether to mix with original images, consistency loss weight $\lambda$
52
+ 2: function RA N DCO N V(I, $\kappa$ , mix, $p$ )
53
+ 3: Sample $p _ { 0 } \sim U ( 0 , 1 )$
54
+ 4: if $p _ { 0 } < p$ and mix is False then
55
+ 5: return $I$ . When not in mix mode, use the original image with probability $p$
56
+ 6: else
57
+ 7: 8: Sample scale Sample conv $k \sim \kappa$ weights $\Theta \in \mathbb { R } ^ { k \times k \times 3 \times 3 } \sim N ( 0 , \frac { 1 } { 3 k ^ { 2 } } )$
58
+ 9: $I _ { r c } \bar { = } I * \Theta$ . Apply convolution on $I$
59
+ 10: if mix is True then
60
+ 11: Sample $\alpha \sim U ( 0 , 1 )$
61
+ 12: return $\alpha I + ( 1 - \alpha ) I _ { r c }$ . Mix with original images
62
+ 13: else
63
+ 14: return $I _ { r c }$
64
+ 15: Learning Objective:
65
+ 16: for $i = 1 N$ do
66
+ 17: for $j = 1 3$ do
67
+ 18: $\hat { y } _ { i } ^ { j } = \Phi ( \mathrm { R a n d C o n v } ( I _ { i } ) )$ . Predict labels for three augmented variants of the same image
68
+ 19: $\begin{array} { r } { \mathcal { L } _ { c o n s } = \lambda \sum _ { j = 1 } ^ { 3 } \mathrm { K L } ( \hat { y } _ { i } ^ { j } | | \bar { y } _ { i } ) } \end{array}$ where $\textstyle { \bar { y } } _ { i } = \sum _ { j = 1 } ^ { 3 } { \hat { y } } _ { i } ^ { j } / 3$ . Consistency Loss
69
+ 20: $\mathcal { L } = \mathcal { L } _ { t a s k } ( \hat { y } _ { i } ^ { 1 } , y _ { i } ) + \lambda \mathcal { L } _ { c o n s }$ . Learning with the task loss and the consistency loss
70
+
71
+ Sec. 3.1 discussed how outputs of randomized convolution layers approximately maintain shape information at a scale larger than their filter sizes. Here, we develop our RandConv data augmentation technique using a randomized convolution layer with $C _ { o u t } = C _ { i n }$ to generate shape-consistent images with randomized texture (see Alg. 1). Our goal is not to use RandConv to parameterize or represent texture as in previous filter-bank based texture models (Heeger & Bergen, 1995; Portilla & Simoncelli, 2000). Instead, we only use the three-channel outputs of RandConv as new images with the same shape and different “style” (loosely referred to as "texture"). We also note that, a convolution layer is different from a convolution operation in image filtering. Standard image filtering applies the same 2D filter on three color channels separately. In contrast, our convolution layer applies three different $3 D$ filters and each takes all color channels as input and generates one channel of the output. Our proposed RandConv variants are as follows:
72
+
73
+ $\mathbf { R C _ { i m g } }$ : Augmenting Images with Random Texture A simple approach is to use the randomized convolution layer outputs, $I * \Theta$ , as new images; where $\Theta$ are the randomly sampled weights and $I$ is a training image. If the original training data is in the domain $D ^ { 0 }$ , a sampled weight $\Theta _ { k }$ generates images with consistent global shape but random texture forming the random domain $D ^ { k }$ . Thus, by random weight sampling, we obtain an infinite number of random domains $D ^ { 1 } , D ^ { 1 } , \ldots , D ^ { \infty }$ . Input image intensities are assumed to be a standard normal distribution $N ( 0 , 1 )$ (which is often true in practice thanks to data whitening). As the outputs of RandConv should follow the same distribution,√ we sample the convolution weights from $N ( 0 , \sigma ^ { 2 } )$ where $\sigma = 1 / \sqrt { C _ { i n } \times h \times w }$ , which is commonly applied for network initialization (He et al., 2015). We include the original images for training at a ratio $p$ as a hyperparameter.
74
+
75
+ $\mathbf { R C _ { m i x } }$ : Mixing Variant As shown in Fig. 1, outputs from $\mathrm { R C } _ { \mathrm { i m g } }$ can vary significantly from the appearance of the original images. Although generalizing to domains with significantly different local texture distributions is useful, we may not want to sacrifice much performance on domains similar to the training domain. Inspired by the AugMix (Hendrycks et al., 2020b) strategy, we propose to blend the original image with the outputs of the RandConv layer via linear convex combinations $\alpha I + ( 1 - \alpha { \bar { ) } } ( I * \Theta )$ , where $\alpha$ is the mixing weight uniformly sampled from $[ 0 , 1 ]$ .In $\operatorname { R C } _ { \operatorname* { m i x } }$ , the RandConv outputs provide shape-consistent perturbations of the original images. Varying $\alpha$ , we continuously interpolate between the training domain and the randomly sampled domains of $\mathtt { R C } _ { \mathtt { i m g } }$
76
+
77
+ Multi-scale Texture Corruption As discussed in Sec. 3.1„ image shape information at a scale smaller than a filter’s size will be corrupted by RandConv. Therefore, we can use filters of varying sizes to preserve shapes at various scales. We choose to uniformly randomly sample a filter size $k$ from a pool $\mathcal { K } = 1 , 3 , . . . n$ before sampling convolution weights $\pmb { \Theta } \in \mathbb { R } ^ { k \times k \times C _ { i n } ^ { \bot } \times C _ { o u t } }$ from a Gaussian distribution $\begin{array} { r } { N ( 0 , \frac { 1 } { k ^ { 2 } C _ { i n } } ) } \end{array}$ . Fig. 1 shows examples of multi-scale RandConv outputs.
78
+
79
+ Consistency Regularization To learn representations invariant to texture changes, we use a loss encouraging consistent network predictions for the same RandConv-augmented image for different random filter samples. Approaches for transform-invariant domain randomization (Yue et al., 2019), data augmentation (Hendrycks et al., 2020b), and semi-supervised learning (Berthelot et al., 2019) use similar strategies. We use Kullback-Leibler (KL) divergence to measure consistency. However, enforcing prediction similarity of two augmented variants may be too strong. Instead, following (Hendrycks et al., 2020b), we use RandConv to obtain 3 augmentation samples of image $I$ : $G _ { j } =$ $\mathtt { R a n d C o n v } ^ { j } ( I )$ for $j = 1 , 2 , 3$ and obtain their predictions with a model $\Phi$ : $y ^ { j } = \Phi ( G ^ { j } )$ . We then compute the relaxed loss as $\textstyle \lambda \sum _ { j = 1 } ^ { 3 } \mathrm { K L } ( y ^ { j } | | \bar { y } )$ , where $\textstyle { \bar { y } } = \sum _ { j = 1 } ^ { 3 } y ^ { j } / 3$ is the sample average.
80
+
81
+ # 4 EXPERIMENTS
82
+
83
+ Secs. 4.1 to 4.3 evaluate our methods on the following datasets: multiple digit recognition datasets, PACS, and ImageNet-sketch. Sec. 4.4 uses PACS to explore the out-of-domain generalization of a pretrained representation in transfer learning by checking if pretraining on ImageNet with our method improves the domain generalization performance in downstream tasks. All experiments are in the single-domain generalization setting where training and validation sets are drawn from one domain. Additional experiments with ResNet18 as the backbone are given in the Appendix.
84
+
85
+ # 4.1 DIGIT RECOGNITION
86
+
87
+ The five digit recognition datasets (MNIST (LeCun et al., 1998), MNIST-M (Ganin et al., 2016), SVHN (Netzer et al., 2011), SYNTH (Ganin & Lempitsky, 2014) and USPS (Denker et al., 1989)) have been widely used for domain adaptation and generalization research (Peng et al., 2019a;b; Qiao et al., 2020). Following the setups in (Volpi et al., 2018) and (Qiao et al., 2020), we train a simple CNN with 10,000 MNIST samples and evaluate the accuracy on the test sets of the other four datasets. We also test on MNIST-C (Mu & Gilmer, 2019), a robustness benchmark with 15 common corruptions of MNIST and report the average accuracy over all corruptions.
88
+
89
+ ![](images/286ba736abe267b08e4fb701d0feca1de7966d9429056f4bfd681517880dd19b.jpg)
90
+ Figure 2: Average accuracy and 5-run variance of MNIST model on MNIST-M, SVHN, SYNTH and USPS. Studies for: (a) original data fraction $p$ for $\mathrm { R C } _ { \mathrm { i m g } }$ ; (b) multiscale design (1-n refers to using scales 1,3,..,n) for $\mathrm { R C } _ { \mathrm { i m g } , p = 0 . 5 }$ (orange) and $\mathrm { R C } _ { \mathrm { m i x } }$ (blue); (c) consistency loss weight $\lambda$ for $\mathrm { R C } _ { \mathrm { i m g 1 - 7 } , p = 0 . 5 }$ (orange) and $\mathrm { R C } _ { \mathrm { m i x 1 - 7 } }$ (blue).
91
+
92
+ Selecting Hyperparameters and Ablation Study. Fig. 2(a) shows the effect of the hyperparameter $p$ on $\mathrm { R C } _ { \mathrm { i m g } }$ with filter size 1. We see that adding only $1 0 \%$ RandConv data $( p = 0 . 9 )$ ) immediately improves the average performance (DG-Avg) on MNIST-M, SVHN, SYNTH and USPS performance from 53.53 to 69.19, outperforming all other approaches (see Tab. 1) for every dataset. We choose $p = 0 . 5$ , which obtains the best DG-Avg. Fig. 2(b) shows results for a multiscale ablation study. Increasing the pool of filter sizes up to 7 improves DG-Avg performance. Therefore we use multiscale 1-7 to study the consistency loss weight $\lambda$ , shown in Fig. 2(c). Adding the consistency loss improves both RandConv variants on DG-avg: $\mathrm { R C } _ { \mathrm { m i x 1 - 7 } }$ favors $\lambda = 1 0$ while $\mathrm { R C } _ { \mathrm { i m g 1 - 7 } , p = 0 . 5 }$ performs similarly for $\lambda = 5$ and $\lambda = 1 0$ . We choose $\lambda = 1 0$ for all subsequent experiments.
93
+
94
+ Results. Tab. 1 compares the performance of $\operatorname { R C } _ { \operatorname* { i m g 1 - 7 } , p = 0 . 5 , \lambda = 1 0 }$ and $\mathrm { R C } _ { \mathrm { m i x 1 - 7 } , \lambda = 1 0 }$ with other state-of-the-art approaches. We show results of the adversarial training based methods GUD (Volpi et al., 2018), M-ADA (Qiao et al., 2020), and PAR (Wang et al., 2019a). The baseline model is trained only on the standard classification loss. To show RandConv is more than a trivial color/contrast adjustment method, we also compare to ColorJitter2 data augmentation (which randomly changes image brightness, contrast, and saturation) and GreyScale (where images are transformed to greyscale for training and testing). We also tested data augmentation with a fixed Laplacian of Gaussian filter (Band-Pass) of size $^ { = 3 }$ and $\sigma = 1$ and the data augmentation pipeline (Multi-Aug) that was used in a recently proposed large scale study on domain generalization algorithms and datasets (Gulrajani & Lopez-Paz, 2020). RandConv and its mixing variant outperforms the best competing method (MADA) by $17 \%$ on DG-Avg and achieves the best $9 1 . 6 2 \%$ accuracy on MNIST-C. While the difference between the two variants of RandConv is marginal, $\mathrm { R C } _ { \mathrm { m i x 1 - 7 } , \lambda = 1 0 }$ performs better on both DG-Avg and MNIST-C. When combined with Multi-Aug, RandConv achieves improved performance except on MNIST-C. Fig 3 shows t-SNE image feature plots for unseen domains generated by the baseline approach and $\mathrm { R C } _ { \mathrm { m i x 1 - 7 } , \lambda = 1 0 }$ . The RandConv embeddings suggest better generalization to unseen domains.
95
+
96
+ Table 1: Average accuracy and 5-run standard deviation (in parenthesis) of MNIST10K model on MNIST-M, SVHN, SYNTH, USPS and their average (DG-avg); and average accuracy of 15 types of corruptions in MNIST-C. Both RandConv variants significantly outperform all other methods.
97
+
98
+ <table><tr><td></td><td>MNIST</td><td>MNIST-M</td><td>SVHN</td><td>USPS</td><td>SYNTH</td><td>DG-Avg</td><td>MNIST-C</td></tr><tr><td>Baseline</td><td>98.40(0.84)</td><td>58.87(3.73)</td><td>33.41(5.28)</td><td>79.27(2.70)</td><td>42.43(5.46)</td><td>53.50(4.23)</td><td>88.20(2.10)</td></tr><tr><td>GreyScale</td><td>98.82(0.02)</td><td>58.41(0.99)</td><td>36.06(1.48)</td><td>80.45(1.00)</td><td>45.00(0.80)</td><td>54.98(0.86)</td><td>89.15(0.44)</td></tr><tr><td>ColorJitter</td><td>98.72(0.05)</td><td>62.72(0.66)</td><td>39.61(0.88)</td><td>79.18(0.60)</td><td>46.40(0.34)</td><td>56.98(0.39)</td><td>89.48(0.18)</td></tr><tr><td>BandPass</td><td>98.65(0.11)</td><td>70.22(2.73)</td><td>48.34(2.56)</td><td>78.60(0.82)</td><td>57.17(2.01)</td><td>63.58(1.89)</td><td>87.89(0.68)</td></tr><tr><td>MultiAug</td><td>98.80(0.05)</td><td>62.32(0.66)</td><td>39.07(0.68)</td><td>79.31(1.02)</td><td>46.48(0.80)</td><td>56.79(0.34)</td><td>89.54(0.11)</td></tr><tr><td>PAR (our imp)</td><td>98.79(0.05)</td><td>61.16(0.21)</td><td>36.08(1.27)</td><td>79.95(1.18)</td><td>45.48(0.35)</td><td>55.67(0.33)</td><td>89.34(0.45)</td></tr><tr><td>GUD</td><td>-</td><td>60.41</td><td>35.51</td><td>77.26</td><td>45.32</td><td>54.62</td><td>=</td></tr><tr><td>M-ADA</td><td>-</td><td>67.94</td><td>42.55</td><td>78.53</td><td>48.95</td><td>59.49</td><td></td></tr><tr><td>RCimg1-7, p=0.5, λ=5</td><td>98.86(0.05)</td><td>87.67(0.37)</td><td>54.95(1.90)</td><td>82.08(1.46)</td><td>63.37(1.58)</td><td>72.02(1.15)</td><td>90.94(0.51)</td></tr><tr><td>RCmix1-7,λ=10</td><td>98.85(0.04)</td><td>87.76(0.83)</td><td>57.52(2.09)</td><td>83.36(0.96)</td><td>62.88(0.78)</td><td>72.88(0.58)</td><td>91.62(0.77)</td></tr><tr><td>RCmix1-7,λ=10 + MultiAug</td><td>98.82(0.06)</td><td>87.89(0.29)</td><td>62.07(0.62)</td><td>84.39(1.02)</td><td>63.90(0.63)</td><td>74.56(0.46)</td><td>91.40(0.93)</td></tr></table>
99
+
100
+ # 4.2 PACS EXPERIMENTS
101
+
102
+ The PACS dataset (Li et al., 2018b) considers 7-class classification on 4 domains: photo, art painting, cartoon, and sketch, with very different texture styles. Most recent domain generalization work studies the multi-source domain setting on PACS and uses domain labels of the training data. Although we follow the convention to train on 3 domains and to test on the fourth, we simply pool the data from the 3 training domains as in (Wang et al., 2019a), without using domain labels during the training.
103
+
104
+ Baseline and State-of-the-Art. Following (Li et al., 2017), we use Deep-All as the baseline, which finetunes an ImageNet-pretrained AlexNet on 3 domains using only the classification loss and tests on the fourth domain. We test our RandConv variants $\mathrm { R C } _ { \mathrm { i m g 1 - 7 } , p = 0 . 5 }$ and $\mathrm { R C } _ { \mathrm { m i x 1 - 7 } }$ with and without consistency loss, and ColorJitter/GreyScale/BandPass/MultiAug data augmentation as in the digit datasets. We also implemented PAR (Wang et al., 2019a) using our baseline model. $\mathrm { R C } _ { \mathrm { m i x 1 - 7 } }$ combined with MultiAug is also tested. Further, we compare to the following state-of-the-art approaches: Jigen (Carlucci et al., 2019) using self-supervision, MLDG (Li et al., 2018a) using meta-learning, and the conditional invariant deep domain generalization method CIDDG (Li et al., 2018c). Note that previous methods used different Deep-All baselines which make the final accuracy not directly comparable, and MLDG and CIDDG use domain labels for training.
105
+
106
+ ![](images/0574c25d544c459afac183f78e6f79fa57e894dc0efe08614a8851a189d684c6.jpg)
107
+ Figure 3: t-SNE feature embedding visualization for digit datasets for models trained on MNIST without (top) and with our $\mathrm { R C } _ { \mathrm { m i x 1 - 7 } , \lambda = 1 0 }$ approach (bottom). Different colors denote different classes.
108
+
109
+ Table 2: Mean and 5-run standard deviation (in parenthesis) results for domain generalization on PACS. Best results with our Deep-All baseline are in bold. The domain name in each column represents the target domain. Base column indicates different baselines and results under different baselines are not directly comparable. MLDG and CIDDF used domain labels for training.
110
+
111
+ <table><tr><td>Base</td><td>Method</td><td>Photo</td><td>Art</td><td>Cartoon</td><td>Sketch</td><td>Average</td></tr><tr><td rowspan="9">Ours</td><td>Deep-All</td><td>86.77(0.42) 83.93(1.47)</td><td>60.11(1.33) 61.60(1.18)</td><td>64.12(0.32) 62.12(0.61)</td><td>55.28(4.71) 60.07(2.47)</td><td>66.57(1.36) 66.93(0.83)</td></tr><tr><td>GreyScale</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ColorJitter</td><td>84.61(0.83)</td><td>59.01(0.24)</td><td>61.43(0.68)</td><td>62.44(1.68)</td><td>66.88(0.33)</td></tr><tr><td>BandPass</td><td>87.08(0.57)</td><td>59.46(0.27)</td><td>64.39(0.51)</td><td>55.39(2.95)</td><td>66.58(0.73)</td></tr><tr><td>MultiAug</td><td>85.21(0.47)</td><td>59.51(0.38)</td><td>62.88(1.01)</td><td>61.67(0.76)</td><td>67.32(0.23)</td></tr><tr><td>PAR (our imp.)</td><td>87.21(0.42)</td><td>60.17(0.95)</td><td>63.63(0.88)</td><td>55.83(2.57)</td><td>66.71(0.58)</td></tr><tr><td>RCimg1-7, p=0.5</td><td>86.50(0.72)</td><td>61.10(0.38)</td><td>64.24(0.62)</td><td>68.50(1.83)</td><td>70.09(0.43)</td></tr><tr><td>RCmix1-7</td><td>86.60(0.67)</td><td>61.74(0.90)</td><td>64.05(0.66)</td><td>69.74(0.66)</td><td>70.53(0.25)</td></tr><tr><td>RCmix1-7 + MultiAug</td><td>86.23(0.74)</td><td>61.91(0.76)</td><td>62.69(0.76)</td><td>67.74(1.21)</td><td>69.64(0.49) 68.72(0.58)</td></tr><tr><td rowspan="5"></td><td>RCimg1-7, p=0.5, λ=10 RCmix1-7,=10</td><td>81.15(0.76) 81.78(1.11)</td><td>59.56(0.79) 61.14(0.51)</td><td>62.42(0.59) 63.57(0.29)</td><td>71.74(0.43) 71.97(0.38)</td><td>69.62(0.24)</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Results below are not directly comparable due to different Deep-All implementations.</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Deep-All (our run)</td><td>88.40</td><td>66.26</td><td>66.58</td><td>59.40</td><td>70.16</td></tr><tr><td>PAR (our run)</td><td>88.40</td><td>65.19</td><td>68.58</td><td>61.86</td><td>71.10</td></tr><tr><td rowspan="2">Carlucci et al. (2019)</td><td>PAR (reported)</td><td>89.6</td><td>66.3</td><td>68.3</td><td>64.1</td><td>72.08</td></tr><tr><td>Deep-All</td><td>89.98</td><td>66.68</td><td>69.41</td><td>60.02</td><td>71.52</td></tr><tr><td rowspan="2">Li et al. (2018a)</td><td>Jigen Deep-All</td><td>89.00</td><td>67.63</td><td>71.71</td><td>65.18</td><td>73.38</td></tr><tr><td>MLDG (use domain labels)</td><td>86.67 88.00</td><td>64.91</td><td>64.28</td><td>53.08</td><td>67.24</td></tr><tr><td rowspan="2">Li et al. (2018c)</td><td></td><td></td><td>66.23</td><td>66.88</td><td>58.96</td><td>70.01</td></tr><tr><td>Deep-All CIDDG (use domain labels)</td><td>77.98 78.65</td><td>57.55 62.70</td><td>67.04 69.73</td><td>58.52 64.45</td><td>65.27 68.88</td></tr></table>
112
+
113
+ Results. Tab. 2 shows significant improvements on Sketch for both RandConv variants. Sketch is the most challenging domain with no color and much less texture compared to the other 3 domains. The success on Sketch demonstrates that our methods can guide the DNN to learn global representations focusing on shapes that are robust to texture changes. Without using the consistency loss, $\mathrm { R C } _ { \mathrm { m i x 1 - 7 } }$ achieves the best overall result improving over Deep-All by ${ \sim } 4 \%$ but adding MultiAug does not further improve the performance. Adding the consistency loss with $\lambda = 1 0$ , $\mathrm { R C } _ { \mathrm { m i x 1 - 7 } }$ and $\mathrm { R C } _ { \mathrm { i m g 1 - 7 } , p = 0 . 5 }$ performs better on Sketch but degrades performance on the other 3 domains, so do GreyScale and ColorJitter. This observation will be discussed in Sec 4.4.
114
+
115
+ 4.3 GENERALIZING AN IMAGENET MODEL TO IMAGENET-SKETCH Table 3: Accuracy of ImageNet-trained AlexNet on ImageNet-Sketch (IN-S) data. Our methods outperform PAR by $5 \%$ and are on par with a Stylized-ImageNet (SIN) trained model. Note that PAR was built on top of a stronger baseline than our model, and both PAR and SIN fine-tuned the baseline model which helped the performance, while we train RandConv model from scratch.
116
+
117
+ <table><tr><td></td><td>Baseline (Wang et al.,2019a)</td><td>PAR (Wang et al.,2019a)</td><td>Baseline</td><td>RCimg1-7, p=0.5,=10</td><td>RCmix1-7, 入=10</td><td>SIN (Geirhos et al., 2019)</td></tr><tr><td>Top1</td><td>12.04</td><td>13.06</td><td>10.28</td><td>18.09</td><td>16.91</td><td>17.62</td></tr><tr><td>Top5</td><td>25.60</td><td>26.27</td><td>21.60</td><td>35.40</td><td>33.99</td><td>36.22</td></tr></table>
118
+
119
+ ImageNet-Sketch (Wang et al., 2019a) is an out-of-domain test set for models trained on ImageNet. We trained AlexNet from scratch with $\mathrm { R C } _ { \mathrm { i m g 1 - 7 } , p = 0 . 5 , \lambda = 1 0 }$ and $\mathrm { R C } _ { \mathrm { m i x 1 - 7 } , \lambda = 1 0 }$ . We evaluate their performance on ImageNet-Sketch. We use the AlexNet model trained without RandConv as our baseline. Tab. 3 compares PAR and its baseline model and AlexNet trained with Stylized ImageNet (SIN) (Geirhos et al., 2019) on ImageNet-Sketch. Although PAR uses a stronger baseline, RandConv achieves significant improvements over our baseline and outperforms PAR by a large margin. Our methods achieve more than a $7 \%$ accuracy improvement over the baseline and surpass PAR by $5 \%$ . SIN as an image stylization approach that can modify image texture in a hierarchical and realistic way. However, albeit its complexity, it still performs on par with RandConv. Note that image stylization techniques require additional data and heavy precomputation. Further, the images for the style source also need to be chosen. In contrast, RandConv is much easier to use: it can be applied to any dataset via a simple convolution layer. We also measure the shape-bias metric proposed by Geirhos et al. (2019) for RandConv trained AlexNet. $\mathrm { R C } _ { \mathrm { i m g 1 - 7 } , p = 0 . 5 , \lambda = 1 0 }$ and $\mathsf { R C } _ { \operatorname* { m i x } 1 - 7 , \lambda = 1 0 }$ improve the baseline from $2 5 . 3 6 \%$ to $4 8 . 2 4 \%$ and $5 4 . 8 5 \%$ respectively.
120
+
121
+ # 4.4 REVISITING PACS WITH MORE ROBUST PRETRAINED REPRESENTATIONS
122
+
123
+ A common practice for many computer vision tasks (including the PACS benchmark) is transfer learning, i.e. finetuning a backbone model pretrained on ImageNet. Recently, how the accuracy on ImageNet (Kornblith et al., 2019) and adversial robustness (Salman et al., 2020) of the pretrained model affect transfer learning has been studied in the context of domain generalization. Instead, we study how out-of-domain generalizability transfers from pretraining to downstream tasks and shed light on how to better use pretrained models.
124
+
125
+ Impact of ImageNet Pretraining A model trained on ImageNet may be biased towards textures (Geirhos et al., 2019). Finetuning ImageNet pretrained models on PACS may inherit this texture bias, thereby benefitting generalization on the Photo domain (which is similar to ImageNet), but hurting performance on the Sketch domain. Therefore, as shown in Sec. 4.2, using RandConv to correct this texture bias improves results on Sketch, but degrades them on the Photo domain. Since pretraining has such a strong impact on transfer performance to new tasks, we ask: "Can the generalizability of a pretrained model transfer to downstream tasks? I.e., does a pretrained model with better generalizability improve performance on unseen domains on new tasks?" To answer this, we revisit the PACS tasks based on ImageNet-pretrained weights where our two RandConv variants of Sec. 4.3 are used during ImageNet training. We study if this results in performance changes for the Deep-All baseline and for finetuning with RandConv.
126
+
127
+ Better Performance via RandConv pretrained model We start by testing the Deep-All baselines using the two RandConv-trained ImageNet models of Sec. 4.3 as initialization. Tab. 4 shows significant improvements on Sketch. Results are comparable to finetuning with RandConv on a normal pretrained model. Art is also consistently improved. Performance drops slightly on Photo as expected, since we reduced the texture bias in the pretrained model, which is helpful for the Photo domain. A similar performance improvement is observed when using the SIN-trained AlexNet as initialization. Using RandConv for both ImageNet training and PACS finetuning, we achieve $7 6 . 1 1 \%$ accuracy on Sketch. As far as we know, this is the best performance using an AlexNet baseline. This approach even outperforms Jigen (Carlucci et al., 2019) $( 7 1 . 3 5 \% )$ with a stronger ResNet18 baseline model. Cartoon and Art are also improved. The best average domain generalization accuracy is $7 3 . 0 3 \%$ , with a more than $6 \%$ improvement over our initial Deep-All baseline.
128
+
129
+ Table 4: Generalization results on PACS with RandConv and SIN pretrained AlexNet. ImageNet column shows how the pretrained model is trained on ImageNet (baseline represents training the ImageNet model using only the classification loss); PACS column indicates the methods used for finetuning on PACS. Best and second best accuracy for each target domain are highlighted in bold and underlined.
130
+
131
+ <table><tr><td>PACS</td><td>ImageNet</td><td>Photo</td><td>Art</td><td>Cartoon</td><td>Sketch</td><td>Avg</td></tr><tr><td rowspan="4">Deep-All</td><td>Baseline</td><td>86.77(0.42)</td><td>60.11(1.33)</td><td>64.12(0.32)</td><td>55.28(4.71)</td><td>66.57(1.36)</td></tr><tr><td>RCimg1-7,p=0.5,=10</td><td>84.48(0.52)</td><td>62.61(1.23)</td><td>66.13(0.80)</td><td>69.24(0.80)</td><td>70.61(0.53)</td></tr><tr><td>RCmix1-7,λ=10</td><td>85.59(0.40)</td><td>63.30(0.99)</td><td>63.83(0.85)</td><td>68.29(1.27)</td><td>70.25(0.45)</td></tr><tr><td>SIN</td><td>85.33(0.66)</td><td>65.85(0.87)</td><td>65.39(0.62)</td><td>65.75(0.59)</td><td>70.58(0.21)</td></tr><tr><td rowspan="3">RCimg1-7, p=0.5,=10</td><td>Baseline</td><td>81.15(0.76)</td><td>59.56(0.79)</td><td>62.42(0.59)</td><td>71.74(0.43)</td><td>68.72(0.58)</td></tr><tr><td>RCimg1-7,p=0.5,入=10</td><td>84.36(0.36)</td><td>63.73(0.91)</td><td>68.07(0.55)</td><td>75.41(0.57)</td><td>72.89(0.33)</td></tr><tr><td>RCmix1-7,λ=10</td><td>84.63(0.97)</td><td>63.41(1.22)</td><td>66.36(0.43)</td><td>74.59(0.84)</td><td>72.25(0.54)</td></tr><tr><td rowspan="3">RCmix1-7 入=10</td><td>Baseline</td><td>81.78(1.11)</td><td>61.14(0.51)</td><td>63.57(0.29)</td><td>71.97(0.38)</td><td>69.62(0.24)</td></tr><tr><td>RCimg1-7,p=0.5,&gt;=10</td><td>85.16(1.03)</td><td>63.17(0.38)</td><td>67.68(0.60)</td><td>76.11(0.43)</td><td>73.03(0.46)</td></tr><tr><td>RCmix1-7,λ=10</td><td>86.17(0.56)</td><td>65.33(1.05)</td><td>65.52(1.13)</td><td>73.21(1.03)</td><td>72.56(0.50)</td></tr></table>
132
+
133
+ This experiment confirms that generalizability may transfer: removing texture bias may not only make a pretrained model more generalizable, but it may help generalization on downstream tasks. For similar target and pretraining domains like Photo and ImageNet, where learning texture bias may actually be beneficial, performance may degrade slightly.
134
+
135
+ # 5 CONCLUSION AND DISCUSSION
136
+
137
+ Randomized convolution (RandConv) is a simple but powerful data augmentation technique for randomizing local image texture. RandConv helps focus visual representations on global shape information rather than local texture. We theoretically justified the approximate shape-preserving property of RandConv and developed RandConv techniques using multi-scale and mixing designs. We also make use of a consistency loss to encourage texture invariance. RandConv outperforms state-of-the-art approaches on the digit recognition benchmark and on the sketch domain of PACS and on ImageNet-Sketch by a large margin. By finetuning a model pretrained with RandConv on PACS, we showed that the generalizability of a pretrained model may transfer to and benefit a new downstream task. This resulted in a new state-of-art performance on PACS in the Sketch domain.
138
+
139
+ RandConv can help computer vision tasks when a shape-biased model is helpful e.g. for object detection. RandConv can also provide a shape-biased pretrained model to improve performance on downstream tasks when generalizing to unseen domains. However, local texture features can be useful for many computer vision tasks, especially for fixed-domain fine-grained visual recognition. In such cases, visual representations that are invariant to local texture may hurt in-domain performance. Therefore, important future work includes learning representations that disentangle shape and texture features and building models to use such representations in an explainable way.
140
+
141
+ Adversarial robustness of deep neural networks has received significant recent attention. Interestingly, Zhang & Zhu (2019) find that adversarially-trained models are more shape biased; Shi et al. (2020) show that their method for increasing shape bias also helps adversarial robustness, especially when combined with adversarial training. Therefore, exploring how RandConv affects the adversarial robustness of models could be interesting future work. Moreover, recent biologically inspired models for improving adversarial robustness (Dapello et al., 2020) use Gabor filters with fixed random configurations followed by a stochastic layer to add Gaussian noise to the network input, which may explain the importance of randomness in RandConv. Exploring connections between RandConv and biological mechanisms in the human visual system would be interesting future work.
142
+
143
+ Acknowledgments We thank Zhiding Yu for discussions on initial ideas and the experimental setup.
144
+ We also thank Nathan Cahill for advice on proving the properties of random convolutions.
145
+
146
+ # REFERENCES
147
+
148
+ Yogesh Balaji, Swami Sankaranarayanan, and Rama Chellappa. Metareg: Towards domain generalization using meta-regularization. In Advances in Neural Information Processing Systems, pp. 998–1008, 2018.
149
+
150
+ David Berthelot, Nicholas Carlini, Ian Goodfellow, Nicolas Papernot, Avital Oliver, and Colin A Raffel. Mixmatch: A holistic approach to semi-supervised learning. In Advances in Neural Information Processing Systems, pp. 5049–5059, 2019.
151
+
152
+ Yuri Burda, Harrison Edwards, Amos Storkey, and Oleg Klimov. Exploration by random network distillation. In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id ${ . } =$ H1lJJnR5Ym.
153
+
154
+ Fabio M Carlucci, Antonio D’Innocente, Silvia Bucci, Barbara Caputo, and Tatiana Tommasi. Domain generalization by solving jigsaw puzzles. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2229–2238, 2019.
155
+
156
+ Joel Dapello, Tiago Marques, Martin Schrimpf, Franziska Geiger, David Cox, and James J DiCarlo. Simulating a primary visual cortex at the front of cnns improves robustness to image perturbations. Advances in Neural Information Processing Systems, 33, 2020.
157
+
158
+ John S Denker, WR Gardner, Hans Peter Graf, Donnie Henderson, Richard E Howard, W Hubbard, Lawrence D Jackel, Henry S Baird, and Isabelle Guyon. Neural network recognizer for handwritten zip code digits. In Advances in neural information processing systems, pp. 323–331, 1989.
159
+
160
+ Adam Gaier and David Ha. Weight agnostic neural networks. In Advances in Neural Information Processing Systems, pp. 5364–5378, 2019.
161
+
162
+ Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. arXiv preprint arXiv:1409.7495, 2014.
163
+
164
+ Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The Journal of Machine Learning Research, 17(1):2096–2030, 2016.
165
+
166
+ Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix A. Wichmann, and Wieland Brendel. Imagenet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id ${ . } = { }$ Bygh9j09KX.
167
+
168
+ Muhammad Ghifary, David Balduzzi, W Bastiaan Kleijn, and Mengjie Zhang. Scatter component analysis: A unified framework for domain adaptation and domain generalization. IEEE transactions on pattern analysis and machine intelligence, 39(7):1414–1430, 2016.
169
+
170
+ Ishaan Gulrajani and David Lopez-Paz. In search of lost domain generalization. arXiv preprint arXiv:2007.01434, 2020.
171
+
172
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pp. 1026–1034, 2015.
173
+
174
+ 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, 2016a.
175
+
176
+ Kun He, Yan Wang, and John Hopcroft. A powerful generative model using random weights for the deep image representation. In Advances in Neural Information Processing Systems, pp. 631–639, 2016b.
177
+
178
+ David J Heeger and James R Bergen. Pyramid-based texture analysis/synthesis. In Proceedings of the 22nd annual conference on Computer graphics and interactive techniques, pp. 229–238, 1995.
179
+
180
+ Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, et al. The many faces of robustness: A critical analysis of out-of-distribution generalization. arXiv preprint arXiv:2006.16241, 2020a.
181
+
182
+ Dan Hendrycks, Norman Mu, Ekin Dogus Cubuk, Barret Zoph, Justin Gilmer, and Balaji Lakshminarayanan. Augmix: A simple method to improve robustness and uncertainty under data shift. In International Conference on Learning Representations, 2020b. URL https: //openreview.net/forum?id $\scriptstyle = \mathrm { S 1 }$ gmrxHFvB.
183
+
184
+ Andrew Ilyas, Shibani Santurkar, Dimitris Tsipras, Logan Engstrom, Brandon Tran, and Aleksander Madry. Adversarial examples are not bugs, they are features. In Advances in Neural Information Processing Systems, pp. 125–136, 2019.
185
+
186
+ William B Johnson and Joram Lindenstrauss. Extensions of lipschitz mappings into a hilbert space. Contemporary mathematics, 26(189-206):1, 1984.
187
+
188
+ Simon Kornblith, Jonathon Shlens, and Quoc V Le. Do better imagenet models transfer better? In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2661–2671, 2019.
189
+
190
+ 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.
191
+
192
+ Kimin Lee, Kibok Lee, Jinwoo Shin, and Honglak Lee. Network randomization: A simple technique for generalization in deep reinforcement learning. In International Conference on Learning Representations. https://openreview. net/forum, 2020.
193
+
194
+ Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy M Hospedales. Deeper, broader and artier domain generalization. In Proceedings of the IEEE international conference on computer vision, pp. 5542–5550, 2017.
195
+
196
+ Da Li, Yongxin Yang, Yi-Zhe Song, and Timothy M Hospedales. Learning to generalize: Metalearning for domain generalization. In Thirty-Second AAAI Conference on Artificial Intelligence, 2018a.
197
+
198
+ Haoliang Li, Sinno Jialin Pan, Shiqi Wang, and Alex C Kot. Domain generalization with adversarial feature learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5400–5409, 2018b.
199
+
200
+ Ya Li, Xinmei Tian, Mingming Gong, Yajing Liu, Tongliang Liu, Kun Zhang, and Dacheng Tao. Deep domain generalization via conditional invariant adversarial networks. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 624–639, 2018c.
201
+
202
+ Yawei Luo, Liang Zheng, Tao Guan, Junqing Yu, and Yi Yang. Taking a closer look at domain shift: Category-level adversaries for semantics consistent domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2507–2516, 2019.
203
+
204
+ Norman Mu and Justin Gilmer. Mnist-c: A robustness benchmark for computer vision. arXiv preprint arXiv:1906.02337, 2019.
205
+
206
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. NIPS Workshop on Deep Learning and Unsupervised Feature Learning, 2011.
207
+
208
+ Ian Osband, John Aslanides, and Albin Cassirer. Randomized prior functions for deep reinforcement learning. In Advances in Neural Information Processing Systems, pp. 8617–8629, 2018.
209
+
210
+ Xingchao Peng, Qinxun Bai, Xide Xia, Zijun Huang, Kate Saenko, and Bo Wang. Moment matching for multi-source domain adaptation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1406–1415, 2019a.
211
+
212
+ Xingchao Peng, Zijun Huang, Ximeng Sun, and Kate Saenko. Domain agnostic learning with disentangled representations. In ICML, 2019b.
213
+
214
+ Javier Portilla and Eero P Simoncelli. A parametric texture model based on joint statistics of complex wavelet coefficients. International journal of computer vision, 40(1):49–70, 2000.
215
+
216
+ Fengchun Qiao, Long Zhao, and Xi Peng. Learning to learn single domain generalization. arXiv preprint arXiv:2003.13216, 2020.
217
+
218
+ Wullianallur Raghupathi and Viju Raghupathi. Big data analytics in healthcare: promise and potential. Health information science and systems, 2(1):3, 2014.
219
+
220
+ Hadi Salman, Andrew Ilyas, Logan Engstrom, Ashish Kapoor, and Aleksander Madry. Do adversarially robust imagenet models transfer better? arXiv preprint arXiv:2007.08489, 2020.
221
+
222
+ Andrew M Saxe, Pang Wei Koh, Zhenghao Chen, Maneesh Bhand, Bipin Suresh, and Andrew Y Ng. On random weights and unsupervised feature learning. In ICML, volume 2, pp. 6, 2011.
223
+
224
+ Rui Shao, Xiangyuan Lan, Jiawei Li, and Pong C Yuen. Multi-adversarial discriminative deep domain generalization for face presentation attack detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 10023–10031, 2019.
225
+
226
+ William B Shen, Danfei Xu, Yuke Zhu, Leonidas J Guibas, Li Fei-Fei, and Silvio Savarese. Situational fusion of visual representation for visual navigation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2881–2890, 2019.
227
+
228
+ Baifeng Shi, Dinghuai Zhang, Qi Dai, Zhanxing Zhu, Yadong Mu, and Jingdong Wang. Informative dropout for robust representation learning: A shape-bias perspective. In International Conference on Machine Learning, 2020.
229
+
230
+ Patrice Y Simard, David Steinkraus, John C Platt, et al. Best practices for convolutional neural networks applied to visual document analysis. In Icdar, volume 3, 2003.
231
+
232
+ Baochen Sun and Kate Saenko. From virtual to reality: Fast adaptation of virtual object detectors to real domains. In Proceedings of the British Machine Vision Conference. BMVA Press, 2014.
233
+
234
+ Josh Tobin, Rachel Fong, Alex Ray, Jonas Schneider, Wojciech Zaremba, and Pieter Abbeel. Domain randomization for transferring deep neural networks from simulation to the real world. In 2017 IEEE/RSJ international conference on intelligent robots and systems (IROS), pp. 23–30. IEEE, 2017.
235
+
236
+ Nguyen Xuan Vinh, Sarah Erfani, Sakrapee Paisitkriangkrai, James Bailey, Christopher Leckie, and Kotagiri Ramamohanarao. Training robust models using random projection. In 2016 23rd International Conference on Pattern Recognition (ICPR), pp. 531–536. IEEE, 2016.
237
+
238
+ Riccardo Volpi, Hongseok Namkoong, Ozan Sener, John C Duchi, Vittorio Murino, and Silvio Savarese. Generalizing to unseen domains via adversarial data augmentation. In Advances in Neural Information Processing Systems, pp. 5334–5344, 2018.
239
+
240
+ Haohan Wang, Songwei Ge, Zachary Lipton, and Eric P Xing. Learning robust global representations by penalizing local predictive power. In Advances in Neural Information Processing Systems, pp. 10506–10518, 2019a.
241
+
242
+ Haohan Wang, Zexue He, and Eric P. Xing. Learning robust representations by projecting superficial statistics out. In International Conference on Learning Representations, 2019b. URL https: //openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ rJEjjoR9K7.
243
+
244
+ John Wieting and Douwe Kiela. No training required: Exploring random encoders for sentence classification. In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ BkgPajAcY7.
245
+
246
+ Xiangyu Yue, Yang Zhang, Sicheng Zhao, Alberto Sangiovanni-Vincentelli, Kurt Keutzer, and Boqing Gong. Domain randomization and pyramid consistency: Simulation-to-real generalization without accessing target domain data. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2100–2110, 2019.
247
+
248
+ Tianyuan Zhang and Zhanxing Zhu. Interpreting adversarially trained convolutional neural networks. In International Conference on Machine Learning, pp. 7502–7511, 2019.
249
+
250
+ ![](images/6c99ccc2a9d3fe69059bf93875355bdf5cbd0abb2fba9d4d9c3b1b8270762221.jpg)
251
+ Figure 4: Left: An image with texture and shapes at different scales; Middle: The output of RandConv with a small filter size which largely preserves the shapes of the stones. Right: The output of RandConv with a large filter size distorts the shape of the stones as well.
252
+
253
+ This supplementary material provides additional details. Specifically, in Sec. A and B, we discuss definitions of shapes and textures in images and justify why random convolution preserves global shapes and disrupts local texture formally by proving Theorem 1. This theorem shows that random linear projections are approximately distance preserving. We also discuss our simulation-based bound based on $80 \%$ distance rescaling on real image data. Sec. C provides more experimental details for the different datasets. Sec. D shows experimental results with a stronger backbone architecture and on a new benchmark ImageNet-R (Hendrycks et al., 2020a). Sec. E provides more detailed results regarding hyperparameter selection and ablation studies. Lastly, Sec. F shows example visualizations of RandConv outputs and for its mixing variant.
254
+
255
+ # A SHAPES AND TEXTURE IN IMAGES
256
+
257
+ As discussed in the main text, we define shapes in images that are preserved by a random convolution layer as primitive shapes: spatial clusters of pixels with similar local texture. An object in a image can be a single primitive shape alone but in most cases it is the composition of multiple primitive shapes e.g. a car includes wheels, body frames, windshields. Note that the definition of texture is not necessarily opposite to shapes, since the texture of a larger shape can includes smaller shapes. For example, in Fig.4, the left occluded triangle shape has texture composed by shapes of cobble stones while cobble stones have their own texture. Random convolution can preserve those large shapes that usually define the image semantics while distorting the small shapes as local texture.
258
+
259
+ To formally define the shape-preserving property, we assume $( x _ { 1 } , y _ { 1 } )$ , $( x _ { 2 } , y _ { 2 } )$ and $( x _ { 3 } , y _ { 3 } )$ are three locations on a image and $( x _ { 1 } , y _ { 1 } )$ has closer color and local texture with $( x _ { 2 } , y _ { 2 } )$ than $( x _ { 3 } , y _ { 3 } )$ . For example, $( x _ { 1 } , y _ { 1 } )$ and $( x _ { 2 } , y _ { 2 } )$ are within the same shape while $( x _ { 3 } , y _ { 3 } )$ is located at a neighboring shape. Then we have kp $( x _ { 1 } , y _ { 1 } ) - \mathbf { p } ( x _ { 2 } , y _ { 2 } ) \| < \| \mathbf { p } ( x _ { 1 } , y _ { 1 } ) - \mathbf { p } ( x _ { 3 } , y _ { 3 } ) \|$ , where $\mathbf { p } ( x _ { i } , y _ { i } )$ is the image patch at location $( x _ { i } , y _ { i } )$ . A transformation $f$ is shape-preserving if it maintains such relative distance relations for most location triplets, i.e.
260
+
261
+ $$
262
+ \| f ( \mathbf { p } ( x _ { i } , y _ { i } ) ) - f ( \mathbf { p } ( x _ { j } , y _ { j } ) ) \| / \| \mathbf { p } ( x _ { i } , y _ { i } ) - \mathbf { p } ( x _ { j } , y _ { j } ) \| \approx r
263
+ $$
264
+
265
+ for any two spatial location $( x _ { i } , y _ { i } )$ and $( x _ { j } , y _ { j } ) ; r \ge 0$ is a constant.
266
+
267
+ # B RANDOM CONVOLUTION IS SHAPE-PRESERVING AS RANDOM LINEAR PROJECTION IS DISTANCE PRESERVING
268
+
269
+ We can express a convolution layer as a local linear projection:
270
+
271
+ $$
272
+ \mathbf { g } ( x , y ) = \mathbf { U } \mathbf { p } ( x , y ) ,
273
+ $$
274
+
275
+ where $ { \mathbf { p } } ( x , y ) \in { \mathbb { R } } ^ { d }$ ${ \bf \chi } d = h \times w \times C _ { i n } )$ is the vectorized image patch centerized at location $( x , y )$ , $\mathbf { g } ( x , y ) \in \mathbb { R } ^ { C _ { o u t } }$ is the output feature at location $( x , y )$ , and $\breve { \mathbf { U } } \in \breve { \mathbb { R } } ^ { C _ { o u t } \times d }$ is the matrix expressing the convolution layer filters $\Theta$ . I.e., for each sliding window centered at $( x , y )$ , a convolution layer applies a linear transform $f : \mathbb { R } ^ { d } \mathbb { R } ^ { C _ { o u t } }$ projecting the $d$ dimensional local image patch $\mathbf { p } ( x , y )$ to its $C _ { o u t }$ dimensional feature ${ \bf g } ( x , y )$ . When $\Theta$ is independently randomly sampled, e.g. from a Gaussian distribution, the convolution layer preserves global shapes since that a random linear projection is approximately distance-preserving by bounding the range of $r$ in Eq. 1 in Theorem 1.
276
+
277
+ Theorem 1. Suppose we have $N$ data points $\mathbf { z } _ { 1 } , \allowbreak \cdots , \allowbreak \mathbf { z } _ { N } \in \mathbb { R } ^ { d }$ . Let $f ( \mathbf { z } ) = \mathbf { U } \mathbf { z }$ be a random linear projection $f : \mathbb { R } ^ { d } \mathbb { R } ^ { m }$ such that $\mathbf { U } \in \mathbb { R } ^ { m \times d }$ and $\mathbf { U } _ { i , j } \sim N ( 0 , \sigma ^ { 2 } )$ . Then we have:
278
+
279
+ $$
280
+ \begin{array} { r l } & { P \Big ( \underset { i \neq j ; i , j \in [ N ] } { \operatorname* { s u p } } \Big \{ r _ { i , j } : = \frac { \| f ( \mathbf { z } _ { i } ) - f ( \mathbf { z } _ { j } ) \| } { \| \mathbf { z } _ { i } - \mathbf { z } _ { j } \| } \Big \} > \delta _ { 1 } \Big ) \leq \epsilon , } \\ & { P \Big ( \underset { i \neq j ; i , j \in [ N ] } { \operatorname* { i n f } } \Big \{ r _ { i , j } : = \frac { \| f ( \mathbf { z } _ { i } ) - f ( \mathbf { z } _ { j } ) \| } { \| \mathbf { z } _ { i } - \mathbf { z } _ { j } \| } \Big \} < \delta _ { 2 } \Big ) \leq \epsilon , } \end{array}
281
+ $$
282
+
283
+ where $\delta _ { 1 } : = \sigma \sqrt { \chi _ { \frac { 2 \epsilon } { N ( N - 1 ) } } ^ { 2 } ( m ) }$ and $\delta _ { 2 } : = \sigma \sqrt { \chi _ { 1 - \frac { 2 \epsilon } { N ( N - 1 ) } } ^ { 2 } \left( m \right) }$ . Here, $\chi _ { \alpha } ^ { 2 } ( m )$ denotes the $\alpha$ -upper quantile of the $\chi ^ { 2 }$ distribution with m degrees of freedom.
284
+
285
+ Thm. 1 tells us that for any data pair $( \mathbf { z } _ { i } , \mathbf { z } _ { j } )$ in a set of $N$ points, the distance rescaling ratio $r _ { i , j }$ after a random linear projection is bounded by $\delta _ { 1 }$ and $\delta _ { 2 }$ with probability $1 - \epsilon$ . A Smaller $N$ and a larger output dimension $m$ give better bounds. E.g., when $m = 3$ , $N = 1 , 0 0 0$ , $\sigma = 1$ and $\epsilon = 0 . 1$ , $\delta _ { 1 } = 5 . 8$ and $\delta _ { 2 } = 0 . 0 1$ . Thm. 1 gives a theoretical bound for all the $N ( N - 1 ) / 2$ pairs. However, in practice, preserving distances for a majority of $N ( N - 1 ) / 2$ pairs is sufficient. To empirically verify this, we test the range of central $8 0 \%$ of $\{ r _ { i , j } \}$ on real image data. Using the same $( m , N , \sigma , \epsilon )$ , $8 0 \%$ of the pairs lie in [0.56, 2.87], which is significantly better than the strict bound: [0.01, 5.8]. A proof of the theorem and simulation details are given in the following.
286
+
287
+ Proof. Let ${ \bf U } _ { k }$ represent to the $k$ -th row of $\mathbf { U }$ . It is easy to check that $\mathbf { v } _ { k } : = \langle \mathbf { U } _ { k } , \mathbf { z } _ { i } - \mathbf { z } _ { j } \rangle / \lVert \mathbf { z } _ { i } - \mathbf { z } _ { j } \rVert \sim$ $N ( 0 , \sigma ^ { 2 } )$ . Therefore,
288
+
289
+ $$
290
+ { \frac { \| f ( \mathbf { z } _ { i } ) - f ( \mathbf { z } _ { j } ) \| ^ { 2 } } { \sigma ^ { 2 } \| \mathbf { z } _ { i } - \mathbf { z } _ { j } \| ^ { 2 } } } = { \frac { 1 } { \sigma ^ { 2 } } } { \frac { ( \mathbf { z } _ { i } - \mathbf { z } _ { j } ) ^ { \top } \mathbf { U } ^ { \top } \mathbf { U } ( \mathbf { z } _ { i } - \mathbf { z } _ { j } ) } { \| \mathbf { z } _ { i } - \mathbf { z } _ { j } \| ^ { 2 } } } = \sum _ { k = 1 } ^ { m } { \frac { \mathbf { v } _ { k } ^ { 2 } } { \sigma ^ { 2 } } } \sim \chi ^ { 2 } ( m ) .
291
+ $$
292
+
293
+ Therefore, for $0 < \epsilon < 1$ , we have
294
+
295
+ $$
296
+ P \Big ( \frac { \| f ( \mathbf { z } _ { i } ) - f ( \mathbf { z } _ { j } ) \| ^ { 2 } } { \sigma ^ { 2 } \| \mathbf { z } _ { i } - \mathbf { z } _ { j } \| ^ { 2 } } > \chi _ { \frac { 2 \epsilon } { N ( N - 1 ) } } ^ { 2 } ( m ) \Big ) \leq \frac { 2 \epsilon } { N ( N - 1 ) } .
297
+ $$
298
+
299
+ From the above inequality, we have
300
+
301
+ $$
302
+ \begin{array} { r l } & { P \Big ( \operatorname* { s u p } _ { i \not = j ; i , j \in [ N ] } \Big \{ \frac { \| f ( \alpha _ { i } ) - f ( z _ { j } ) \| ^ { 2 } } { \| z _ { i } - z _ { j } \| ^ { 2 } } \Big \} > \sigma ^ { 2 } \chi _ { \frac { 2 \epsilon } { N ( N - 1 ) } } ^ { 2 } ( m ) \Big ) } \\ & { = P \Big ( \operatorname* { s u p } _ { i \not = j ; i , j \in [ N ] } \Big \{ \frac { \| f ( \alpha _ { i } ) - f ( z _ { j } ) \| ^ { 2 } } { \sigma ^ { 2 } \| z _ { i } - z _ { j } \| ^ { 2 } } \Big \} > \chi _ { \frac { 2 \epsilon } { N ( N - 1 ) } } ^ { 2 } ( m ) \Big ) } \\ & { = P \Big ( \underset { i \not = j ; i , j \in [ N ] } { \bigcup } \Big \{ \frac { \| f ( \alpha _ { i } ) - f ( z _ { j } ) \| ^ { 2 } } { \sigma ^ { 2 } \| z _ { i } - z _ { j } \| ^ { 2 } } > \chi _ { \frac { 2 \epsilon } { N ( N - 1 ) } } ^ { 2 } ( m ) \Big \} \Big ) } \\ & { \le \underset { i \not = j ; i , j \in [ N ] } { \sum } P \Big ( \frac { \| f ( z _ { i } ) - f ( z _ { j } ) \| ^ { 2 } } { \sigma ^ { 2 } \| z _ { i } - z _ { j } \| ^ { 2 } } > \chi _ { \frac { 2 \epsilon } { N ( N - 1 ) } } ^ { 2 } ( m ) \Big ) } \\ & { \le \epsilon , } \end{array}
303
+ $$
304
+
305
+ which is equivalent to
306
+
307
+ $$
308
+ P \Big ( \operatorname* { s u p } _ { \substack { i \neq j ; i , j \in [ N ] } } \Big \{ \frac { \| f ( \mathbf { z } _ { i } ) - f ( \mathbf { z } _ { j } ) \| } { \| \mathbf { z } _ { i } - \mathbf { z } _ { j } \| } \Big \} > \sigma \sqrt { \chi _ { \frac { 2 \epsilon } { N ( N - 1 ) } } ^ { 2 } ( m ) } \Big ) \leq \epsilon .
309
+ $$
310
+
311
+ Similarly, we have
312
+
313
+ $$
314
+ P \Big ( \operatorname* { i n f } _ { \substack { i \neq j ; i , j \in [ N ] } } \Big \{ \frac { \| f ( \mathbf { z } _ { i } ) - f ( \mathbf { z } _ { j } ) \| } { \| \mathbf { z } _ { i } - \mathbf { z } _ { j } \| } \Big \} < \sigma \sqrt { \chi _ { 1 - \frac { 2 \epsilon } { N ( N - 1 ) } } ^ { 2 } ( m ) } \Big ) \leq \epsilon .
315
+ $$
316
+
317
+ Simulation on Real Image Data To better understand the relative distance preservation property of random linear projections in practice, we use Algorithm 2 to empirically obtain a bound for real image data. We choose $m = 3$ , $N = 1 , 0 0 0$ , $\sigma = 1$ and $\epsilon = 0 . 1$ as in computing our theoretical bounds. We use $M = 1 , 0 0 0$ real images from the PACS dataset for this simulation. Note that the image patch size or $d$ does not affect the bound. We use a patch size of $3 \times 3$ resulting in $d = 2 7$ This simulation tell us that applying linear projections with a randomly sampled $U$ on $N$ local images patches in every image, we have a $1 - \epsilon$ chance that $8 0 \%$ of $r _ { i , j }$ is in the range $\left[ \delta _ { 1 0 \% } , \delta _ { 9 0 \% } \right]$ .
318
+
319
+ Algorithm 2 Simulate the range of central $80 \%$ of $\boldsymbol { r } _ { i , j }$ on real image data
320
+
321
+ 1: Input: $M$ images $\{ I _ { i } \} _ { i = 1 } ^ { M }$ , number of data points $N$ , projection output dimension $m$ , standard deviation $\sigma$ of normal distribution, confidence level $\epsilon$ .
322
+ 2: for 3: $m = 1 M$ dos patches in at 1,000 locations and vectorize them as $I _ { m }$ $\{ \mathbf { z } _ { l } ^ { m } \} _ { l = 1 } ^ { N }$
323
+ 4: Sample a projection matrix $\mathbf { U } \in \mathbb { R } ^ { m \times d }$ and $\mathbf { U } _ { i , j } \sim N ( 0 , \sigma ^ { 2 } )$
324
+ 5: for $i = 1 N$ do
325
+ 6: for $j = i + 1 N$ do
326
+ 7: Compute $\begin{array} { r } { r _ { i , j } ^ { m } = \frac { \| f ( \mathbf { z } _ { i } ^ { m } ) - f ( \mathbf { z } _ { j } ^ { m } ) \| } { \| \mathbf { z } _ { i } ^ { m } - \mathbf { z } _ { j } ^ { m } \| } } \end{array}$ , where $f ( \mathbf { z } ) = \mathbf { U } \mathbf { z }$
327
+ 8: $q _ { 1 0 \% } ^ { m } = 1 0 \%$ quantile of $r _ { i , j } ^ { m }$ for $I _ { m }$
328
+ 9: 10: $q _ { 9 0 \% } ^ { m } = 9 0 \%$ quantile of all $r _ { i , j } ^ { m }$ for $I _ { m }$ . Get the central $80 \%$ of $\boldsymbol { r } _ { i , j }$ in each image $\delta _ { 1 0 \% } = \epsilon$ $q _ { 1 0 \% } ^ { m }$
329
+ 11: $\delta _ { 9 0 \% } = ( 1 - \epsilon )$ quantile of all $q _ { 9 0 \% } ^ { m }$ . Get the  confident bound for qm10% and qm90%
330
+ 12: return $\delta _ { 1 0 \% }$ , $\delta _ { 9 0 \% }$
331
+
332
+ # C EXPERIMENTAL DETAILS
333
+
334
+ Digits Recognition The network for our digits recognition experiments is composed of two $C o n \nu { 5 } \times { 5 } .$ ReLU-MaxPool2 $^ { \prime } \times 2$ blocks with 64/128 output channels and three fully connected layer with 1024/1024/10 output channels. We train the network with batch size 32 for 10,000 iterations. During training, the model is validated every 250 iterations and saved with the best validation score for testing. We apply the Adam optimizer with an initial learning rate of 0.0001.
335
+
336
+ PACS We use the official data splits for training/validation/testing; no extra data augmentation is applied. We use the official PyTorch implementation and the pretrained weights of AlexNet for our PACS experiments. AlextNet is finetuned for 50,000 iterations with a batch size 128. Samples are randomly selected from the training data mixed between the three domains. We use the validation data of source domains only at every 100 iterations. We use the SGD optimizer for training with an initial learning rate of 0.001, Nesterov momentum, and weight decay set to 0.0005. We let the learning rate decay by a factor of 0.1 after finishing $80 \%$ of the iterations.
337
+
338
+ ImageNet Following the PyTorch example 3 on training ImageNet models, we set the batch size to 256 and train AlexNet from scratch for 90 epochs. We apply the SGD optimizer with an initial learning rate of 0.01, momentum 0.9, and weight decay 0.0001. We reduce the learning rate via a factor of 0.1 every 30 epochs.
339
+
340
+ # D MORE EXPERIMENTS WITH RESNET-18
341
+
342
+ In this section, we demonstrate that RandConv also works on other stronger backbone architectures, e.g. for a Residual Network He et al. (2016a). Specifically, we run the PACS and ImageNet experiments with ResNet-18 as the baseline and RandConv. As Table 5 shows, RandConv improves the baseline using ResNet18 on ImageNet-sketch by $1 0 . 5 \%$ accuracy. When using a RandConv pretrained ResNet-18 on PACS, the performance of finetuning with DeepAll and RandConv are both improved shown in Table 7. The best average domain generalization accuracy is $8 4 . 0 9 \%$ , with a more than $8 \%$ improvement over our initial Deep-All baseline. A model pretrained with $\mathrm { R C } _ { \mathrm { m i x 1 - 7 } , \lambda = 1 0 }$ generally performs better than when pretrained with $\mathrm { R C } _ { \mathrm { i m g 1 - 7 } , p = 0 . 5 , \lambda = 1 0 }$ . We also provide the ResNet-18 performance of JiGen (Carlucci et al., 2019) on PACS as reference. Note that JiGen uses extra data augmentation and a different data split than our approach and it only improves over its own baseline by $1 . 5 \%$ . In addition, we test RandConv trained ResNet-18 on ImageNet-R (Hendrycks et al., 2020a), a domain generalization benchmark that contains images of artistic renditions of 200 object classes from the original ImageNet dataset. As Table 6 shows, RandConv also improve the generalization performance on ImageNet-R and reduce the gap between the in-domain (ImageNet-200) and out-of-domain (ImageNet-R) performance.
343
+
344
+ Table 5: Accuracy of ImageNet-trained ResNet-18 on ImageNet-Sketch data.
345
+
346
+ <table><tr><td></td><td>Baseline</td><td>RCimg1-7,p=0.5, λ=10</td><td>RCmix1-7, 入=10</td></tr><tr><td>Top1</td><td>20.23</td><td>28.79</td><td>30.70</td></tr><tr><td>Top5</td><td>37.26</td><td>49.02</td><td>51.80</td></tr></table>
347
+
348
+ Table 6: Top 1 Accuracy of ImageNet-trained ResNet-18 on ImageNet-R data. ImageNet-200 are the original ImageNet data with the same 200 classes as ImageNet-R.
349
+
350
+ <table><tr><td></td><td>Baseline</td><td>RCimg1-7,p=0.5,&gt;=10</td><td>RCmix1-7, =10</td></tr><tr><td>ImageNet-200 (%)</td><td>88.15</td><td>83.72</td><td>72.7</td></tr><tr><td>ImageNet-R (%)</td><td>33.06</td><td>37.38</td><td>35.75</td></tr><tr><td>Gap</td><td>55.09</td><td>46.34</td><td>36.95</td></tr></table>
351
+
352
+ Table 7: Generalization results on PACS with RandConv pretrained model using ResNet-18. ImageNet column shows how the pretrained model is trained on ImageNet (baseline represents training using only the classification loss); PACS column indicates the methods used for finetuning on PACS. Best and second best accuracy for each target domain are highlighted in bold and underlined. The performance of JiGen (Carlucci et al., 2019) and its baseline using ResNet-18 is also given.
353
+
354
+ <table><tr><td>PACS</td><td>ImageNet</td><td>Photo</td><td>Art</td><td>Cartoon</td><td>Sketch</td><td>Avg</td></tr><tr><td rowspan="3">Deep-All</td><td>Baseline</td><td>95.45(0.43)</td><td>74.96(0.99)</td><td>71.48(1.22)</td><td>62.09(1.12)</td><td>76.00(0.37)</td></tr><tr><td>RCimg1-7,p=0.5,λ=10</td><td>94.65(0.16)</td><td>73.85(0.97)</td><td>74.78(0.58)</td><td>73.51(1.16)</td><td>79.20(0.40)</td></tr><tr><td>RCmix1-7,λ=10</td><td>94.10(0.43)</td><td>76.72(1.43)</td><td>73.41(1.29)</td><td>77.60(0.55)</td><td>80.46(0.74)</td></tr><tr><td rowspan="3">RCimg1-7, p=0.5,=10</td><td>Baseline</td><td>92.37(0.54)</td><td>76.50(0.55)</td><td>71.33(0.29)</td><td>79.65(1.32)</td><td>79.96(0.53)</td></tr><tr><td>RCimg1-7,p=0.5,=10</td><td>94.43(0.22)</td><td>79.80(1.03)</td><td>73.40(0.37)</td><td>81.51(0.85)</td><td>82.28(0.38)</td></tr><tr><td>RCmix1-7,λ=10</td><td>94.57(0.45)</td><td>81.32(1.00)</td><td>76.28(0.82)</td><td>84.18(0.94)</td><td>84.09(0.61)</td></tr><tr><td rowspan="3">RCmix1-7 入=10</td><td>Baseline</td><td>93.57(0.40)</td><td>77.73(0.91)</td><td>71.24(0.91)</td><td>75.53(2.17)</td><td>79.52(0.61)</td></tr><tr><td>RCimg1-7,p=0.5,入=10</td><td>95.23(0.30)</td><td>80.56(0.82)</td><td>74.18(0.53)</td><td>80.70(1.43)</td><td>82.67(0.46)</td></tr><tr><td>RCmix1-7,=10</td><td>95.01(0.32)</td><td>81.09(1.24)</td><td>76.04(0.92)</td><td>83.02(0.93)</td><td>83.79(0.60)</td></tr><tr><td rowspan="2">Deep-All JiGen</td><td rowspan="2">Baseline</td><td>95.73</td><td>77.85</td><td>74.86</td><td>67.74</td><td>79.05</td></tr><tr><td>96.03</td><td>79.42</td><td>75.25</td><td>71.35</td><td>80.51</td></tr></table>
355
+
356
+ # E HYPERPARAMETER SELECTIONS AND ABLATION STUDIES ON DIGITS RECOGNITION BENCHMARKS
357
+
358
+ We provide detailed experimental results for the digits recognition datasets. Table 8 shows results for different hyperameters $p$ for $\mathrm { R C _ { i m g 1 } }$ . Table 9 shows results for an ablation study on the multi-scale design for $\operatorname { R C } _ { \operatorname* { m i x } }$ and $\mathrm { R C } _ { \mathrm { i m g } , p = 0 . 5 }$ . Table 10 shows results for studying the consistency loss weight $\lambda$ for $\mathrm { R C } _ { \mathrm { m i x 1 - 7 } }$ and $\mathrm { R C } _ { \mathrm { i m g 1 - 7 } , p = 0 . 5 }$ . Tables 8, 9, and 10 correspond to Fig. 2 (a)(b)(c) in the main text respectively.
359
+
360
+ Table 8: Ablation study of hyperparameter $p$ for $\mathrm { R C _ { i m g 1 } }$ on digits recognition benchmarks. DG-Avg is the average performance on MNIST-M, SVHN, SYNTH and USPS. Best results are bold.
361
+
362
+ <table><tr><td></td><td>MNIST-10k</td><td>MNIST-M</td><td>SVHN</td><td>USPS</td><td>SYNTH</td><td>DG Avg</td><td>MNIST-C</td></tr><tr><td>Baseline</td><td>98.40(0.84)</td><td>58.87(3.73)</td><td>33.41(5.28)</td><td>79.27(2.70)</td><td>42.43(5.46)</td><td>53.50(4.23)</td><td>88.20(2.10)</td></tr><tr><td>RCimg1, p=0.9</td><td>98.68(0.06)</td><td>83.53(0.37)</td><td>53.67(1.54)</td><td>80.38(1.41)</td><td>59.19(0.85)</td><td>69.19(0.34)</td><td>89.79(0.44)</td></tr><tr><td>RCimg1,p=0.7</td><td>98.64(0.07)</td><td>84.17(0.61)</td><td>54.50(1.55)</td><td>80.85(0.91)</td><td>60.25(0.85)</td><td>69.94(0.50)</td><td>89.20(0.60)</td></tr><tr><td>RCimg1, p=0.5</td><td>98.72(0.08)</td><td>85.17(1.12)</td><td>55.97(0.54)</td><td>80.31(0.85)</td><td>61.07(0.47)</td><td>70.63(0.42)</td><td>88.66(0.62)</td></tr><tr><td>RCimg1, p=0.3</td><td>98.71(0.12)</td><td>85.45(0.87)</td><td>54.62(1.52)</td><td>79.78(1.40)</td><td>60.51(0.41)</td><td>70.09(0.60)</td><td>89.02(0.32)</td></tr><tr><td>RCimg1, p=0.1</td><td>98.66(0.06)</td><td>85.57(0.79)</td><td>54.34(1.52)</td><td>79.21(0.44)</td><td>60.18(0.63)</td><td>69.83(0.38)</td><td>88.53(0.38)</td></tr><tr><td>RCimg1,p=0</td><td>98.55(0.13)</td><td>86.27(0.42)</td><td>52.48(3.00)</td><td>79.01(1.11)</td><td>59.53(1.14)</td><td>69.32(1.19)</td><td>88.01(0.36)</td></tr></table>
363
+
364
+ Table 9: Ablation study of multi-scale RandConv on digits recognition benchmarks for $\mathrm { R C } _ { \mathrm { m i x } }$ and $\mathrm { R C } _ { \mathrm { i m g } , p = 0 . 5 }$ . Best entries for each variant are bold.
365
+
366
+ <table><tr><td></td><td>|MNIST-10k</td><td>MNIST-M</td><td>SVHN</td><td>USPS</td><td>SYNTH</td><td>DG Avg</td><td>MNIST-C</td></tr><tr><td>RCmix1</td><td>98.62(0.06)</td><td>83.98(0.98)</td><td>53.26(2.59)</td><td>80.57(1.09)</td><td>59.25(1.38)</td><td>69.26(1.35)</td><td>88.59(0.38)</td></tr><tr><td>RCmix1-3</td><td>98.76(0.02)</td><td>84.66(1.67)</td><td>55.89(0.83)</td><td>80.95(1.15)</td><td>60.07(1.05)</td><td>70.39(0.58)</td><td>89.80(0.94)</td></tr><tr><td>RCmix1-5</td><td>98.76(0.06)</td><td>84.32(0.43)</td><td>56.50(2.68)</td><td>81.85(1.05)</td><td>60.76(1.02)</td><td>70.86(0.86)</td><td>90.06(0.80)</td></tr><tr><td>RCmix1-7</td><td>98.82(0.06)</td><td>84.91(0.68)</td><td>55.61(2.63)</td><td>82.09(1.00)</td><td>62.15(1.30)</td><td>71.19(1.21)</td><td>90.30(0.44)</td></tr><tr><td>RCmix1-9</td><td>98.81(0.12)</td><td>85.13(0.72)</td><td>54.18(3.36)</td><td>82.07(1.28)</td><td>61.85(1.41)</td><td>70.81(1.24)</td><td>90.83(0.52)</td></tr><tr><td>RCimg1, p=0.5</td><td>98.66(0.05)</td><td>85.12(0.96)</td><td>55.59(0.29)</td><td>80.65(0.71)</td><td>60.85(0.48)</td><td>70.55(0.15)</td><td>89.00(0.45)</td></tr><tr><td>RCimg1-3,p=0.5</td><td>98.79(0.07)</td><td>85.36(1.04)</td><td>55.60(1.09)</td><td>80.99(0.99)</td><td>61.26(0.80)</td><td>70.80(0.86)</td><td>89.84(0.70)</td></tr><tr><td>RCimg1-5, p=0.5</td><td>98.83(0.07)</td><td>86.33(0.47)</td><td>54.99(2.48)</td><td>80.82(1.83)</td><td>62.61(0.75)</td><td>71.19(1.25)</td><td>90.70(0.43)</td></tr><tr><td>RCimg1-7, p=0.5</td><td>98.83(0.07)</td><td>86.08(0.27)</td><td>54.93(1.27)</td><td>81.58(0.74)</td><td>62.78(0.86)</td><td>71.34(0.61)</td><td>91.18(0.38)</td></tr><tr><td>RCimg1-9, p=0.5</td><td>98.80(0.12)</td><td>85.63(0.70)</td><td>52.82(2.01)</td><td>81.48(1.22)</td><td>62.55(0.74)</td><td>70.62(0.73)</td><td>90.79(0.48)</td></tr></table>
367
+
368
+ Table 10: Ablation study of consistency loss weight $\lambda$ on digits recognition benchmarks for $\mathrm { R C } _ { \mathrm { m i x 1 - 7 } }$ and $\mathrm { R C } _ { \mathrm { i m g 1 - 7 } , p = 0 . 5 }$ . DG-Avg is the average performance on MNIST-M, SVHN, SYNTH and USPS. Best results for each variant are bold.
369
+
370
+ <table><tr><td></td><td>入</td><td>MNIST-10k</td><td>MNIST-M</td><td>SVHN</td><td>USPS</td><td>SYNTH</td><td>DG Avg</td><td>MNIST-C</td></tr><tr><td rowspan="6">RCmix1-7</td><td>20</td><td>98.90 (0.05)</td><td>87.18 (0.81)</td><td>57.68 (1.64)</td><td>83.55 (0.83)</td><td>63.08 (0.50)</td><td>72.87 (0.47)</td><td>91.14 (0.53)</td></tr><tr><td>10</td><td>98.85 (0.04)</td><td>87.76 (0.83)</td><td>57.52 (2.09)</td><td>83.36 (0.96)</td><td>62.88 (0.78)</td><td>72.88 (0.58)</td><td>91.62 (0.77)</td></tr><tr><td>5</td><td>98.94 (0.09)</td><td>87.53 (0.51)</td><td>55.70 (2.22)</td><td>83.12 (1.08)</td><td>62.37 (0.98)</td><td>72.18 (1.04)</td><td>91.46 (0.50)</td></tr><tr><td>1</td><td>98.95 (0.05)</td><td>86.77 (0.79)</td><td>56.00 (2.39)</td><td>83.13 (0.71)</td><td>63.18 (0.97)</td><td>72.27 (0.82)</td><td>91.15 (0.42)</td></tr><tr><td>0.1</td><td>98.84 (0.07)</td><td>85.41 (1.02)</td><td>56.51 (1.58)</td><td>81.84 (1.14)</td><td>61.86 (1.44)</td><td>71.41 (0.98)</td><td>90.72 (0.60)</td></tr><tr><td>0</td><td>98.82 (0.06)</td><td>84.91 (0.68)</td><td>55.61 (2.63)</td><td>82.09 (1.00)</td><td>62.15 (1.30)</td><td>71.19 (1.21)</td><td>90.30 (0.44)</td></tr><tr><td rowspan="6">RCimg1-7,p=0.5</td><td>20</td><td>98.79 (0.04)</td><td>87.53 (0.79)</td><td>53.92 (1.59)</td><td>81.83 (0.70)</td><td>62.16 (0.37)</td><td>71.36 (0.49)</td><td>91.20 (0.53)</td></tr><tr><td>10</td><td>98.86 (0.05)</td><td>87.67 (0.37)</td><td>54.95 (1.90)</td><td>82.08 (1.46)</td><td>63.37 (1.58)</td><td>72.02 (1.15)</td><td>90.94 (0.51)</td></tr><tr><td></td><td>98.90 (0.04)</td><td>87.77 (0.72)</td><td>55.00 (1.40)</td><td>82.10 (0.55)</td><td>63.58 (1.33)</td><td>72.11 (0.62)</td><td>90.83 (0.71)</td></tr><tr><td>5</td><td>98.86 (0.04)</td><td>86.74 (0.32)</td><td>53.26 (2.99)</td><td>81.51 (0.48)</td><td>62.00 (1.15)</td><td>70.88 (0.93)</td><td>91.11 (0.62)</td></tr><tr><td>0.1</td><td>98.85 (0.14)</td><td>86.85 (0.31)</td><td>53.55 (3.63)</td><td>81.23 (1.02)</td><td>62.77 (0.80)</td><td>71.10 (1.31)</td><td>91.13 (0.69)</td></tr><tr><td>0</td><td>98.83 (0.07)</td><td>86.08 (0.27)</td><td>54.93 (1.27)</td><td>81.58 (0.74)</td><td>62.78 (0.86)</td><td>71.34 (0.61)</td><td>91.18 (0.38)</td></tr></table>
371
+
372
+ # F MORE EXAMPLES OF RA N DCO N V DATA AUGMENTATION
373
+
374
+ We provide additional examples of RandConv outputs for different convolution filter sizes in Fig. 6 and for its mixing variants at scale $k = 7$ with different mixing coefficients in Fig. 5. We observe that RandConv with different filter sizes retains shapes at different scales. The mixing strategy can continuously interpolate between the training domain and a randomly sampled domain.
375
+
376
+ ![](images/b51a4c5250677ed5324645f25d5c5926a998a7c82c5f58fd3a2d67246e4f246c.jpg)
377
+ Figure 5: Examples of the RandConv mixing variant $\mathrm { R C } _ { \mathrm { m i x 7 } }$ on images of size $2 2 4 ^ { 2 }$ with different mixing coefficients $\alpha$ . When $\alpha = 1$ , the output is just the original image input;when $\alpha = 0$ , we use the output of the random convolution layer as the augmented image.
378
+
379
+ $$
380
+ k = 1 \mathrm { ~ } k = 3 \mathrm { ~ } k = 5 \mathrm { ~ } k = 7 \mathrm { ~ } k = 1 1 \mathrm { ~ } k = 1 5
381
+ $$
382
+
383
+ ![](images/613f26d3b91db3efa35f9b74d1d77d87aaa54b9c830838a0f79c1e5ed5f62ad2.jpg)
384
+ Figure 6: RandConv data augmentation examples on images of size $2 2 4 ^ { 2 }$ . First column is the input image; following columns are convolution results using random filters of different sizes $k$ . We can see that the smaller filter sizes help maintain the finer shapes.
md/train/BkM27IxR-/BkM27IxR-.md ADDED
@@ -0,0 +1,274 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING TO OPTIMIZE NEURAL NETS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Learning to Optimize (Li & Malik, 2016) is a recently proposed framework for learning optimization algorithms using reinforcement learning. In this paper, we explore learning an optimization algorithm for training shallow neural nets. Such high-dimensional stochastic optimization problems present interesting challenges for existing reinforcement learning algorithms. We develop an extension that is suited to learning optimization algorithms in this setting and demonstrate that the learned optimization algorithm consistently outperforms other known optimization algorithms even on unseen tasks and is robust to changes in stochasticity of gradients and the neural net architecture. More specifically, we show that an optimization algorithm trained with the proposed method on the problem of training a neural net on MNIST generalizes to the problems of training neural nets on the Toronto Faces Dataset, CIFAR-10 and CIFAR-100.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Machine learning is centred on the philosophy that learning patterns automatically from data is generally better than meticulously crafting rules by hand. This data-driven approach has delivered: today, machine learning techniques can be found in a wide range of application areas, both in AI and beyond. Yet, there is one domain that has conspicuously been left untouched by machine learning: the design of tools that power machine learning itself.
12
+
13
+ One of the most widely used tools in machine learning is optimization algorithms. We have grown accustomed to seeing an optimization algorithm as a black box that takes in a model that we design and the data that we collect and outputs the optimal model parameters. The optimization algorithm itself largely stays static: its design is reserved for human experts, who must toil through many rounds of theoretical analysis and empirical validation to devise a better optimization algorithm. Given this state of affairs, perhaps it is time for us to start practicing what we preach and learn how to learn.
14
+
15
+ Recently, Li & Malik (2016) and Andrychowicz et al. (2016) introduced two different frameworks for learning optimization algorithms. Whereas Andrychowicz et al. (2016) focuses on learning an optimization algorithm for training models on a particular task, Li & Malik (2016) sets a more ambitious objective of learning an optimization algorithm for training models that is task-independent. We study the latter paradigm in this paper and develop a method for learning an optimization algorithm for high-dimensional stochastic optimization problems, like the problem of training shallow neural nets.
16
+
17
+ Under the “Learning to Optimize” framework proposed by Li & Malik (2016), the problem of learning an optimization algorithm is formulated as a reinforcement learning problem. We consider the general structure of an unconstrained continuous optimization algorithm, as shown in Algorithm 1. In each iteration, the algorithm takes a step $\Delta x$ and uses it to update the current iterate $\boldsymbol { x } ^ { ( i ) }$ . In hand-engineered optimization algorithms, $\Delta x$ is computed using some fixed formula $\phi$ that depends on the objective function, the current iterate and past iterates. Often, it is simply a function of the current and past gradients.
18
+
19
+ Different choices of $\phi$ yield different optimization algorithms and so each optimization algorithm is essentially characterized by its update formula $\phi$ . Hence, by learning $\phi$ , we can learn an optimization algorithm. Li & Malik (2016) observed that an optimization algorithm can be viewed as a Markov decision process (MDP), where the state includes the current iterate, the action is the step vector $\Delta x$
20
+
21
+ Require: Objective function $f$ $\bar { x ^ { ( 0 ) } } \gets$ random point in the domain of $f$ for $i = 1 , 2 , \dots { \bf d }$ o $\Delta x \gets \acute { \phi } ( f , \{ x ^ { ( 0 ) } , \ldots , x ^ { ( i - 1 ) } \} )$ if stopping condition is met then return x(i−1) end if $x ^ { ( i ) } \gets x ^ { ( i - 1 ) } + \Delta x$ end for
22
+
23
+ and the policy is the update formula $\phi$ . Hence, the problem of learning $\phi$ simply reduces to a policy search problem.
24
+
25
+ In this paper, we build on the method proposed in (Li & Malik, 2016) and develop an extension that is suited to learning optimization algorithms for high-dimensional stochastic problems. We use it to learn an optimization algorithm for training shallow neural nets and show that it outperforms popular hand-engineered optimization algorithms like ADAM (Kingma & Ba, 2014), AdaGrad (Duchi et al., 2011) and RMSprop (Tieleman & Hinton, 2012) and an optimization algorithm learned using the supervised learning method proposed in (Andrychowicz et al., 2016). Furthermore, we demonstrate that our optimization algorithm learned from the experience of training on MNIST generalizes to training on other datasets that have very dissimilar statistics, like the Toronto Faces Dataset, CIFAR10 and CIFAR-100.
26
+
27
+ # 2 RELATED WORK
28
+
29
+ The line of work on learning optimization algorithms is fairly recent. Li & Malik (2016) and Andrychowicz et al. (2016) were the first to propose learning general optimization algorithms. Li & Malik (2016) explored learning task-independent optimization algorithms and used reinforcement learning to learn the optimization algorithm, while Andrychowicz et al. (2016) investigated learning task-dependent optimization algorithms and used supervised learning.
30
+
31
+ In the special case where objective functions that the optimization algorithm is trained on are loss functions for training other models, these methods can be used for “learning to learn” or “metalearning”. While these terms have appeared from time to time in the literature (Baxter et al., 1995; Vilalta & Drissi, 2002; Brazdil et al., 2008; Thrun & Pratt, 2012), they have been used by different authors to refer to disparate methods with different purposes. These methods all share the objective of learning some form of meta-knowledge about learning, but differ in the type of meta-knowledge they aim to learn. We can divide the various methods into the following three categories.
32
+
33
+ # 2.1 LEARNING WHAT TO LEARN
34
+
35
+ Methods in this category Thrun & Pratt (2012) aim to learn what parameter values of the base-level learner are useful across a family of related tasks. The meta-knowledge captures commonalities shared by tasks in the family, which enables learning on a new task from the family to be performed more quickly. Most early methods fall into this category; this line of work has blossomed into an area that has later become known as transfer learning and multi-task learning.
36
+
37
+ # 2.2 LEARNING WHICH MODEL TO LEARN
38
+
39
+ Methods in this category Brazdil et al. (2008) aim to learn which base-level learner achieves the best performance on a task. The meta-knowledge captures correlations between different tasks and the performance of different base-level learners on those tasks. One challenge under this setting is to decide on a parameterization of the space of base-level learners that is both rich enough to be capable of representing disparate base-level learners and compact enough to permit tractable search over this space. Brazdil et al. (2003) proposes a nonparametric representation and stores examples of different base-level learners in a database, whereas Schmidhuber (2004) proposes representing baselevel learners as general-purpose programs. The former has limited representation power, while the latter makes search and learning in the space of base-level learners intractable. Hochreiter et al. (2001) views the (online) training procedure of any base-learner as a black box function that maps a sequence of training examples to a sequence of predictions and models it as a recurrent neural net. Under this formulation, meta-training reduces to training the recurrent net, and the base-level learner is encoded in the memory state of the recurrent net.
40
+
41
+ Hyperparameter optimization can be seen as another example of methods in this category. The space of base-level learners to search over is parameterized by a predefined set of hyperparameters. Unlike the methods above, multiple trials with different hyperparameter settings on the same task are permitted, and so generalization across tasks is not required. The discovered hyperparameters are generally specific to the task at hand and hyperparameter optimization must be rerun for new tasks. Various kinds of methods have been proposed, such those based on Bayesian optimization (Hutter et al., 2011; Bergstra et al., 2011; Snoek et al., 2012; Swersky et al., 2013; Feurer et al., 2015), random search (Bergstra & Bengio, 2012) and gradient-based optimization (Bengio, 2000; Domke, 2012; Maclaurin et al., 2015).
42
+
43
+ # 2.3 LEARNING HOW TO LEARN
44
+
45
+ Methods in this category aim to learn a good algorithm for training a base-level learner. Unlike methods in the previous categories, the goal is not to learn about the outcome of learning, but rather the process of learning. The meta-knowledge captures commonalities in the behaviours of learning algorithms that achieve good performance. The base-level learner and the task are given by the user, so the learned algorithm must generalize across base-level learners and tasks. Since learning in most cases is equivalent to optimizing some objective function, learning a learning algorithm often reduces to learning an optimization algorithm. This problem was explored in (Li & Malik, 2016) and (Andrychowicz et al., 2016). Closely related is (Bengio et al., 1991), which learns a Hebblike synaptic learning rule that does not depend on the objective function, which does not allow for generalization to different objective functions.
46
+
47
+ Various work has explored learning how to adjust the hyperparameters of hand-engineered optimization algorithms, like the step size (Hansen, 2016; Daniel et al., 2016; Fu et al., 2016) or the damping factor in the Levenberg-Marquardt algorithm (Ruvolo et al., 2009). Related to this line of work is stochastic meta-descent (Bray et al., 2004), which derives a rule for adjusting the step size analytically. A different line of work (Gregor & LeCun, 2010; Sprechmann et al., 2013) parameterizes intermediate operands of special-purpose solvers for a class of optimization problems that arise in sparse coding and learns them using supervised learning.
48
+
49
+ # 3 LEARNING TO OPTIMIZE
50
+
51
+ # 3.1 SETTING
52
+
53
+ In the “Learning to Optimize” framework, we are given a set of training objective functions $f _ { 1 } , \ldots , f _ { n }$ drawn from some distribution $\mathcal { F }$ . An optimization algorithm $\mathcal { P }$ takes an objective function $f$ and an initial iterate $x ^ { ( 0 ) }$ as input and produces a sequence of iterates $x ^ { ( 1 ) } , \ldots , x ^ { ( T ) }$ , where $x ^ { ( T ) }$ is the solution found by the optimizer. We are also given a distribution $\mathcal { D }$ that generates the initial iterate $x ^ { ( 0 ) }$ and a meta-loss $\mathcal { L }$ , which takes an objective function $f$ and a sequence of iterates $x ^ { ( 1 ) } , \ldots , x ^ { ( T ) }$ produced by an optimization algorithm as input and outputs a scalar that measures the quality of the iterates. The goal is to learn an optimization algorithm ${ \mathcal { P } } ^ { * }$ such that $\mathbb { E } _ { f \sim \mathcal { F } , x ^ { ( 0 ) } \sim \mathcal { D } } \left[ \mathcal { L } ( f , \mathcal { P } ^ { * } ( f , x ^ { ( 0 ) } ) ) \right]$ is minimized. The meta-loss is chosen to penalize optimization algorithms that exhibit behaviours we find undesirable, like slow convergence or excessive oscillations. Assuming we would like to learn an algoritha good choice of meta-loss would then simply be regret and can be interpreted as the area under the $\textstyle \sum _ { i = 1 } ^ { T } f ( x ^ { ( i ) } )$ zes the objective function it is given,, which is equivalent to cumulativective values over time.
54
+
55
+ The objective functions $f _ { 1 } , \ldots , f _ { n }$ may correspond to loss functions for training base-level learners, in which case the algorithm that learns the optimization algorithm can be viewed as a meta-learner. In this setting, each objective function is the loss function for training a particular base-learner on a particular task, and so the set of training objective functions can be loss functions for training a base-learner or a family of base-learners on different tasks. At test time, the learned optimization algorithm is evaluated on unseen objective functions, which correspond to loss functions for training base-learners on new tasks, which may be completely unrelated to tasks used for training the optimization algorithm. Therefore, the learned optimization algorithm must not learn anything about the tasks used for training. Instead, the goal is to learn an optimization algorithm that can exploit the geometric structure of the error surface induced by the base-learners. For example, if the base-level model is a neural net with ReLU activation units, the optimization algorithm should hopefully learn to leverage the piecewise linearity of the model. Hence, there is a clear division of responsibilities between the meta-learner and base-learners. The knowledge learned at the meta-level should be pertinent for all tasks, whereas the knowledge learned at the base-level should be task-specific. The meta-learner should therefore generalize across tasks, whereas the base-learner should generalize across instances.
56
+
57
+ # 3.2 RL PRELIMINARIES
58
+
59
+ The goal of reinforcement learning is to learn to interact with an environment in a way that minimizes cumulative costs that are expected to be incurred over time. The environment is formalized as a partially observable Markov decision process $( \mathrm { P O M D P } ) ^ { 1 }$ , which is defined by the tuple $( S , \mathcal { O } , \mathcal { A } , p _ { i } , p , p _ { o } , c , T )$ , where $\mathcal { S } \subseteq \mathbb { R } ^ { D }$ is the set of states, $\mathcal { O } \subseteq \mathbb { R } ^ { D ^ { \prime } }$ is the set of observations, $\mathcal { A } \subseteq \mathbb { R } ^ { d }$ is the set of actions, $p _ { i } \left( s _ { 0 } \right)$ is the probability density over initial states $s _ { 0 }$ , $p \left( { { s } _ { t + 1 } } \left| { { s } _ { t } } , { { a } _ { t } } \right. \right)$ is the probability density over the subsequent state $s _ { t + 1 }$ given the current state $s _ { t }$ and action $a _ { t }$ , $p _ { o } \left( o _ { t } \bar { | } _ { s _ { t } } \right)$ is the probability density over the current observation $o _ { t }$ given the current state $s _ { t }$ , $c : { \mathcal { S } } \mathbb { R }$ is a function that assigns a cost to each state and $T$ is the time horizon. Often, the probability densities $p$ and $p _ { o }$ are unknown and not given to the learning algorithm.
60
+
61
+ A policy $\pi \left( \boldsymbol { a } _ { t } | \boldsymbol { o } _ { t } , t \right)$ is a conditional probability density over actions $a _ { t }$ given the current observation $o _ { t }$ and time step $t$ . When a policy is independent of $t$ , it is known as a stationary policy. The goal of the reinforcement learning algorithm is to learn a policy $\pi ^ { * }$ that minimizes the total expected cost over time. More precisely,
62
+
63
+ $$
64
+ \pi ^ { * } = \arg \operatorname* { m i n } _ { \pi } \mathbb { E } _ { s _ { 0 } , a _ { 0 } , s _ { 1 } , \dots , s _ { T } } \left[ \sum _ { t = 0 } ^ { T } c ( s _ { t } ) \right] ,
65
+ $$
66
+
67
+ where the expectation is taken with respect to the joint distribution over the sequence of states and actions, often referred to as a trajectory, which has the density
68
+
69
+ $$
70
+ \begin{array} { c } { { \displaystyle q \big ( s _ { 0 } , a _ { 0 } , s _ { 1 } , \ldots , s _ { T } \big ) = \int _ { o _ { 0 } , \ldots , o _ { T } } p _ { i } \left( s _ { 0 } \right) p _ { o } \left( o _ { 0 } \big | s _ { 0 } \right) } } \\ { { { \displaystyle \prod _ { t = 0 } ^ { T - 1 } \pi \left( \left. a _ { t } \right| o _ { t } , t \right) p \left( \left. s _ { t + 1 } \right| s _ { t } , a _ { t } \right) p _ { o } \left( \left. o _ { t + 1 } \right| s _ { t + 1 } \right) . } } } \end{array}
71
+ $$
72
+
73
+ To make learning tractable, $\pi$ is often constrained to lie in a parameterized family. A common assumption is that $\pi \left( \left. a _ { t } \right| o _ { t } , t \right) = \mathcal { N } \left( \mu ^ { \pi } ( o _ { t } ) , \Sigma ^ { \pi } ( o _ { t } ) \right)$ , where $\textstyle { \mathcal { N } } ( { \boldsymbol { \mu } } , { \boldsymbol { \Sigma } } )$ denotes the density of a Gaussian with mean $\mu$ and covariance $\Sigma$ . The functions $\mu ^ { \pi } ( \cdot )$ and possibly $\Sigma ^ { \pi } ( \cdot )$ are modelled using function approximators, whose parameters are learned.
74
+
75
+ # 3.3 FORMULATION
76
+
77
+ In our setting, the state $s _ { t }$ consists of the current iterate $x ^ { ( t ) }$ and features $\Phi ( \cdot )$ that depend on the history of iterates $x ^ { ( 1 ) } , \ldots , x ^ { ( t ) }$ , (noisy) gradients $\nabla \hat { f } ( x ^ { ( 1 ) } ) , \ldots , \nabla \hat { f } ( x ^ { ( t ) } )$ and (noisy) objective values ${ \hat { f } } ( x ^ { ( 1 ) } ) , \ldots , { \hat { f } } ( x ^ { ( t ) } )$ . The action $a _ { t }$ is the step $\Delta x$ that will be used to update the iterate. The observation $o _ { t }$ excludes $x ^ { ( t ) }$ and consists of features $\Psi ( \cdot )$ that depend on the iterates, gradient and objective values from recent iterations, and the previous memory state of the learned optimization algorithm, which takes the form of a recurrent neural net. This memory state can be viewed as a statistic of the previous observations that is learned jointly with the policy.
78
+
79
+ Under this formulation, the initial probability density $p _ { i }$ captures how the initial iterate, gradient and objective value tend to be distributed. The transition probability density $p$ captures the how the gradient and objective value are likely to change given the step that is taken currently; in other words, it encodes the local geometry of the training objective functions. Assuming the goal is to learn an optimization algorithm that minimizes the objective function, the cost $c$ of a state $\boldsymbol { s } _ { t } = \left( \boldsymbol { x } ^ { ( t ) } , \Phi \left( \cdot \right) \right) ^ { T }$ is simply the true objective value $f ( \boldsymbol { x } ^ { ( t ) } )$ .
80
+
81
+ Any particular policy $\pi \left( \boldsymbol { a } _ { t } \left| \boldsymbol { o } _ { t } , t \right. \right)$ , which generates $a _ { t } ~ = ~ \Delta x$ at every time step, corresponds to a particular (noisy) update formula $\phi$ , and therefore a particular (noisy) optimization algorithm. Therefore, learning an optimization algorithm simply reduces to searching for the optimal policy.
82
+
83
+ The mean of the policy is modelled as a recurrent neural net fragment that corresponds to a single time step, which takes the observation features $\Psi ( \cdot )$ and the previous memory state as input and outputs the step to take.
84
+
85
+ # 3.4 GUIDED POLICY SEARCH
86
+
87
+ The reinforcement learning method we use is guided policy search (GPS) (Levine et al., 2015), which is a policy search method designed for searching over large classes of expressive non-linear policies in continuous state and action spaces. It maintains two policies, $\psi$ and $\pi$ , where the former lies in a time-varying linear policy class in which the optimal policy can found in closed form, and the latter lies in a stationary non-linear policy class in which policy optimization is challenging. In each iteration, it performs policy optimization on $\psi$ , and uses the resulting policy as supervision to train $\pi$ .
88
+
89
+ More precisely, GPS solves the following constrained optimization problem:
90
+
91
+ $$
92
+ \operatorname* { m i n } _ { \theta , \eta } \mathbb { E } _ { \psi } \left[ \sum _ { t = 0 } ^ { T } c ( s _ { t } ) \right] \mathrm { ~ s . t . ~ } \psi \left( \left. a _ { t } \right| s _ { t } , t ; \eta \right) = \pi \left( \left. a _ { t } \right| s _ { t } ; \theta \right) \forall a _ { t } , s _ { t } , t
93
+ $$
94
+
95
+ where $\eta$ and $\theta$ denote the parameters of $\psi$ and $\pi$ respectively, $\mathbb { E } _ { \rho } \left[ \cdot \right]$ denotes the expectation taken with respect to the trajectory induced by a policy $\rho$ and $\begin{array} { r } { \pi \left( \left. a _ { t } \right| s _ { t } ; \theta \right) : = \int _ { o _ { t } } \pi \left( \left. a _ { t } \right| o _ { t } ; \theta \right) p _ { o } \left( \left. o _ { t } \right| s _ { t } \right) ^ { 2 } } \end{array}$ .
96
+
97
+ Since there are an infinite number of equality constraints, the problem is relaxed by enforcing equality on the mean actions taken by $\psi$ and $\pi$ at every time step3. So, the problem becomes:
98
+
99
+ $$
100
+ \operatorname* { m i n } _ { \theta , \eta } \mathbb { E } _ { \psi } [ \sum _ { t = 0 } ^ { T } c ( s _ { t } ) ] \mathrm { ~ s . t . ~ } \mathbb { E } _ { \psi } [ a _ { t } ] = \mathbb { E } _ { \psi } [ \mathbb { E } _ { \pi } [ a _ { t } | s _ { t } ] ] \forall t
101
+ $$
102
+
103
+ This problem is solved using Bregman ADMM (Wang & Banerjee, 2014), which performs the following updates in each iteration:
104
+
105
+ $$
106
+ \begin{array} { r l } & { \eta \gets \arg \underset { \eta } { \operatorname* { m i n } } \sum _ { t = 0 } ^ { T } \mathbb { E } _ { \psi } [ c ( s _ { t } ) - \lambda _ { t } ^ { T } a _ { t } ] + \nu _ { t } D _ { t } ( \eta , \theta ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \theta \gets \arg \underset { \theta } { \operatorname* { m i n } } \sum _ { t = 0 } ^ { T } \lambda _ { t } ^ { T } \mathbb { E } _ { \psi } [ \mathbb { E } _ { \pi } [ a _ { t } | s _ { t } ] ] + \nu _ { t } D _ { t } ( \theta , \eta ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \lambda _ { t } \gets \lambda _ { t } + \alpha \nu _ { t } ( \mathbb { E } _ { \psi } [ \mathbb { E } _ { \pi } [ a _ { t } | s _ { t } ] ] - \mathbb { E } _ { \psi } [ a _ { t } ] ) \ \forall t , } \\ & { \mathrm { ~ } \mathrm { ~ } : \mathrm { r e } \quad D _ { t } ( \theta , \eta ) \quad : = \quad \mathbb { E } _ { \psi } [ D _ { K L } ( \pi ( a _ { t } | s _ { t } ; \theta ) ) ] \ \psi ( a _ { t } | s _ { t } , t ; \eta ) ) ] \quad \mathrm { ~ a n d ~ } \quad D _ { t } ( \eta , \theta ) } \\ & { [ D _ { K L } ( \psi ( a _ { t } | s _ { t } , t ; \eta ) ] ) | \ \pi ( a _ { t } | s _ { t } ; \theta ) ) | . } \end{array}
107
+ $$
108
+
109
+ The algorithm assumes that $\psi \left( \left. a _ { t } \right| s _ { t } , t ; \eta \right) = \mathcal { N } \left( K _ { t } s _ { t } + k _ { t } , G _ { t } \right)$ , where $\boldsymbol { \eta } : = \left( K _ { t } , k _ { t } , G _ { t } \right) _ { t = 1 } ^ { T }$ and $\pi \left( a _ { t } | o _ { t } ; \theta \right) = \mathcal { N } \left( \mu _ { \omega } ^ { \pi } ( o _ { t } ) , \Sigma ^ { \pi } \right)$ , where $\boldsymbol { \theta } : = ( \omega , \Sigma ^ { \pi } )$ and $\mu _ { \omega } ^ { \pi } ( \cdot )$ can be an arbitrary function that is typically modelled using a nonlinear function approximator like a neural net.
110
+
111
+ At the start of each iteration, the algorithm constructs a model of the transition probability density $\tilde { p } \left( \left. s _ { t + 1 } \right| s _ { t } , a _ { t } , t ; \zeta \right) = \mathcal { N } ( A _ { t } s _ { t } + B _ { t } a _ { t } + c _ { t } , F _ { t } )$ , where $\boldsymbol { \zeta } : = \left( A _ { t } , B _ { t } , c _ { t } , F _ { t } \right) _ { t = 1 } ^ { T }$ is fitted to samples of $s _ { t }$ drawn from the trajectory induced by $\psi$ , which essentially amounts to a local linearization of the true transition probability $p \left( \left. s _ { t + 1 } \right| s _ { t } , a _ { t } , t \right)$ . We will use $\mathbb { E } _ { \widetilde { \psi } } \left[ \cdot \right]$ to denote expectation taken with respect to the trajectory induced by $\psi$ under the modelled transition probability $\tilde { p }$ . Additionally, the algorithm fits local quadratic approximations to $c ( s _ { t } )$ around samples of $s _ { t }$ drawn from the trajectory induced by $\psi$ so that $\begin{array} { r } { c ( s _ { t } ) \approx \dot { \tilde { c } } \dot { ( s _ { t } ) } : = \frac { 1 } { 2 } s _ { t } ^ { T } C _ { t } s _ { t } + \dot { d _ { t } ^ { T } } s _ { t } + h _ { t } } \end{array}$ for $s _ { t }$ ’s that are near the samples.
112
+
113
+ With these assumptions, the subproblem that needs to be solved to update $\eta ~ = ~ ( K _ { t } , k _ { t } , G _ { t } ) _ { t = 1 } ^ { T }$ becomes:
114
+
115
+ $$
116
+ \begin{array} { r l r } & { \underset { \eta } { \operatorname* { m i n } } \displaystyle \sum _ { t = 0 } ^ { T } \mathbb { E } _ { \boldsymbol { \tilde { \psi } } } [ \boldsymbol { \tilde { c } } ( s _ { t } ) - \lambda _ { t } ^ { T } \boldsymbol { a } _ { t } ] + \nu _ { t } D _ { t } ( \eta , \theta ) } & \\ & { \mathrm { s . t . } \displaystyle \sum _ { t = 0 } ^ { T } \mathbb { E } _ { \boldsymbol { \tilde { \psi } } } [ D _ { K L } ( \boldsymbol { \psi } ( \boldsymbol { a } _ { t } | \boldsymbol { s } _ { t } , t ; \eta ) | \Big | \psi ( \boldsymbol { a } _ { t } | \boldsymbol { s } _ { t } , t ; \eta ^ { \prime } ) ) ] \leq \epsilon , } \end{array}
117
+ $$
118
+
119
+ where $\eta ^ { \prime }$ denotes the old $\eta$ from the previous iteration. Because $\tilde { p }$ and $\tilde { c }$ are only valid locally around the trajectory induced by $\psi$ , the constraint is added to limit the amount by which $\eta$ is updated. It turns out that the unconstrained problem can be solved in closed form using a dynamic programming algorithm known as linear-quadratic-Gaussian (LQG) regulator in time linear in the time horizon $T$ and cubic in the dimensionality of the state space $D$ . The constrained problem is solved using dual gradient descent, which uses LQG as a subroutine to solve for the primal variables in each iteration and increments the dual variable on the constraint until it is satisfied.
120
+
121
+ Updating $\theta$ is straightforward, since expectations taken with respect to the trajectory induced by $\pi$ are always conditioned on $s _ { t }$ and all outer expectations over $s _ { t }$ are taken with respect to the trajectory induced by $\psi$ . Therefore, $\pi$ is essentially decoupled from the transition probability $p \left( \left. s _ { t + 1 } \right| s _ { t } , a _ { t } , t \right)$ and so its parameters can be updated without affecting the distribution of $s _ { t }$ ’s. The subproblem that needs to be solved to update $\theta$ therefore amounts to a standard supervised learning problem.
122
+
123
+ Since $\psi \left( \boldsymbol { a } _ { t } | \boldsymbol { s } _ { t } , t ; \boldsymbol { \eta } \right)$ and $\pi \left( \boldsymbol { a } _ { t } | \boldsymbol { s } _ { t } ; \boldsymbol { \theta } \right)$ are Gaussian, $D _ { t } \left( { \theta , \eta } \right)$ can be computed analytically. More concretely, if we assume $\Sigma ^ { \pi }$ to be fixed for simplicity, the subproblem that is solved for updating $\theta = \left( \omega , \Sigma ^ { \pi } \right)$ is:
124
+
125
+ $$
126
+ \begin{array} { l } { \displaystyle \operatorname* { m i n } _ { \theta } \mathbb { E } _ { \psi } [ \sum _ { t = 0 } ^ { T } \lambda _ { t } ^ { T } \mu _ { \omega } ^ { \pi } ( o _ { t } ) + \frac { \nu _ { t } } { 2 } ( \operatorname { t r } ( G _ { t } ^ { - 1 } \Sigma ^ { \pi } ) - \log | \Sigma ^ { \pi } | ) } \\ { \displaystyle + \frac { \nu _ { t } } { 2 } ( \mu _ { \omega } ^ { \pi } ( o _ { t } ) - \mathbb { E } _ { \psi } [ a _ { t } | s _ { t } , t ] ) ^ { T } G _ { t } ^ { - 1 } ( \mu _ { \omega } ^ { \pi } ( o _ { t } ) - \mathbb { E } _ { \psi } [ a _ { t } | s _ { t } , t ] ) ] } \end{array}
127
+ $$
128
+
129
+ Note that the last term is the squared Mahalanobis distance between the mean actions of $\psi$ and $\pi$ at time step $t$ , which is intuitive as we would like to encourage $\pi$ to match $\psi$ .
130
+
131
+ # 3.5 CONVOLUTIONAL GPS
132
+
133
+ The problem of learning high-dimensional optimization algorithms presents challenges for reinforcement learning algorithms due to high dimensionality of the state and action spaces. For example, in the case of GPS, because the running time of LQG is cubic in dimensionality of the state space, performing policy search even in the simple class of linear-Gaussian policies would be prohibitively expensive when the dimensionality of the optimization problem is high.
134
+
135
+ Fortunately, many high-dimensional optimization problems have underlying structure that can be exploited. For example, the parameters of neural nets are equivalent up to permutation among certain coordinates. More concretely, for fully connected neural nets, the dimensions of a hidden layer and the corresponding weights can be permuted arbitrarily without changing the function they compute. Because permuting the dimensions of two adjacent layers can permute the weight matrix arbitrarily, an optimization algorithm should be invariant to permutations of the rows and columns of a weight matrix. A reasonable prior to impose is that the algorithm should behave in the same manner on all coordinates that correspond to entries in the same matrix. That is, if the values of two coordinates in all current and past gradients and iterates are identical, then the step vector produced by the algorithm should have identical values in these two coordinates. We will refer to the set of coordinates on which permutation invariance is enforced as a coordinate group. For the purposes of learning an optimization algorithm for neural nets, a natural choice would be to make each coordinate group correspond to a weight matrix or a bias vector. Hence, the total number of coordinate groups is twice the number of layers, which is usually fairly small.
136
+
137
+ ![](images/c32356121b006ac72da2adddd464187f503567b08623692799a8cd7bffe7f36e.jpg)
138
+ Figure 1: Comparison of the various hand-engineered and learned algorithms on training neural nets with 48 input and hidden units on (a) TFD, (b) CIFAR-10 and (c) CIFAR-100 with mini-batches of size 64. The vertical axis is the true objective value and the horizontal axis represents the iteration. Best viewed in colour.
139
+
140
+ In the case of GPS, we impose this prior on both $\psi$ and $\pi$ . For the purposes of updating $\eta$ , we first impose a block-diagonal structure on the parameters $A _ { t } , B _ { t }$ and $F _ { t }$ of the fitted transition probability density $\tilde { p } \left( \left. s _ { t + 1 } \right| s _ { t } , a _ { t } , t ; \zeta \right) = \mathcal { N } ( A _ { t } s _ { t } + B _ { t } a _ { t } + c _ { t } , F _ { t } )$ , so that for each coordinate in the optimization problem, the dimensions of $s _ { t + 1 }$ that correspond to the coordinate only depend on the dimensions of $s _ { t }$ and $a _ { t }$ that correspond to the same coordinate. As a result, $\tilde { p } \big ( s _ { t + 1 } \big | s _ { t } , a _ { t } , t ; \zeta \big )$ decomposes into multiple independent probability densities $\tilde { p } ^ { j } \left( s _ { t + 1 } ^ { j } \Big | s _ { t } ^ { j } , a _ { t } ^ { j } , t ; \zeta ^ { j } \right)$ , one for each coordinate $j$ . Similarly, we also impose a block-diagonal structure on $C _ { t }$ for fitting $\tilde { c } ( s _ { t } )$ and on the parameter matrix of the fitted model for $\pi \left( a _ { t } | \boldsymbol s _ { t } \bar { ; \boldsymbol \theta } \right)$ . Under these assumptions, $K _ { t }$ and $G _ { t }$ are guaranteed to be block-diagonal as well. Hence, the Bregman divergence penalty term, $D \left( \eta , \theta \right)$ decomposes into a sum of Bregman divergence terms, one for each coordinate.
141
+
142
+ We then further constrain dual variables $\lambda _ { t }$ , sub-vectors of parameter vectors and sub-matrices of parameter matrices corresponding to each coordinate group to be identical across the group. Additionally, we replace the weight $\nu _ { t }$ on $D \left( \eta , \theta \right)$ with an individual weight on each Bregman divergence term for each coordinate group. The problem then decomposes into multiple independent subproblems, one for each coordinate group. Because the dimensionality of the state subspace corresponding to each coordinate is constant, LQG can be executed on each subproblem much more efficiently.
143
+
144
+ Similarly, for $\pi$ , we choose a $\mu _ { \omega } ^ { \pi } ( \cdot )$ that shares parameters across different coordinates in the same group. We also impose a block-diagonal structure on $\Sigma ^ { \pi }$ and constrain the appropriate sub-matrices to share their entries.
145
+
146
+ # 3.6 FEATURES
147
+
148
+ We describe the features $\Phi ( \cdot )$ and $\Psi ( \cdot )$ at time step $t$ , which define the state $s _ { t }$ and observation $o _ { t }$ respectively.
149
+
150
+ Because of the stochasticity of gradients and objective values, the state features $\Phi ( \cdot )$ are defined in terms of summary statistics of the history of iterates $\left\{ x ^ { ( i ) } \right\} _ { i = 0 } ^ { t }$ , gradients $\left\{ \nabla \hat { f } ( x ^ { ( i ) } ) \right\} _ { i = 0 } ^ { t }$ and objective values $\left\{ \hat { f } ( \boldsymbol x ^ { ( i ) } ) \right\} _ { i = 0 } ^ { t }$ We define the following statistics, which we will refer to as the average recent iterate, gradient and objective value respectively:
151
+
152
+ $$
153
+ \begin{array} { r } { \overline { { \boldsymbol { x } ^ { ( i ) } } } : = \frac { 1 } { \operatorname* { m i n } ( i + 1 , 3 ) } \sum _ { j = \operatorname* { m a x } ( i - 2 , 0 ) } ^ { i } \boldsymbol { x } ^ { ( j ) } } \end{array}
154
+ $$
155
+
156
+ ![](images/3fea8480e1dc0f7dbc3c3a6dc8993cac0f6ffab3eae77436f1e3e961bbffec59.jpg)
157
+ Figure 2: Comparison of the various hand-engineered and learned algorithms on training neural nets with 100 input units and 200 hidden units on (a) TFD, (b) CIFAR-10 and (c) CIFAR-100 with minibatches of size 64. The vertical axis is the true objective value and the horizontal axis represents the iteration. Best viewed in colour.
158
+
159
+ $$
160
+ \begin{array} { r l } & { \bullet \ \overline { { \nabla \hat { f } ( x ^ { ( i ) } ) } } : = \frac { 1 } { \operatorname* { m i n } ( i + 1 , 3 ) } \sum _ { j = \operatorname* { m a x } ( i - 2 , 0 ) } ^ { i } { \nabla \hat { f } ( x ^ { ( j ) } ) } } \\ & { \bullet \ \overline { { \hat { f } ( x ^ { ( i ) } ) } } : = \frac { 1 } { \operatorname* { m i n } ( i + 1 , 3 ) } \sum _ { j = \operatorname* { m a x } ( i - 2 , 0 ) } ^ { i } \hat { f } ( x ^ { ( j ) } ) } \end{array}
161
+ $$
162
+
163
+ The state features $\Phi ( \cdot )$ consist of the relative change in the average recent objective value, the average recent gradient normalized by the magnitude of the a previous average recent gradient and a previous change in average recent iterate relative to the current change in average recent iterate:
164
+
165
+ $$
166
+ \begin{array} { r l } & { \bullet \{ ( \hat { f } ( x ^ { ( t - 5 i ) } ) - \widehat { f } ( x ^ { ( t - 5 ( i + 1 ) ) } ) ) / \widehat { f } ( x ^ { ( t - 5 ( i + 1 ) ) } ) \} _ { i = 0 } ^ { 2 4 } } \\ & { \bullet \{ \overline { { \nabla \hat { f } ( x ^ { ( t - 5 i ) } ) } } / ( | \overline { { \nabla \hat { f } ( x ^ { ( m a x ( t - 5 ( i + 1 ) , t \mathrm { m o d } 5 ) ) } ) } } | + 1 ) \} _ { i = 0 } ^ { 2 5 } } \\ & \bullet \{ \frac { | \frac { \overline { { x ^ { ( \mathrm { m a x } ( t - 5 ( i + 1 ) , t \mathrm { m o d } 5 + 5 ) ) } } } - \overline { { x ^ { ( \mathrm { m a x } ( t - 5 ( i + 2 ) , t \mathrm { m o d } 5 ) ) } } } } { | \overline { { x ^ { ( t - 5 i ) } } } - \overline { { x ^ { ( t - 5 ( i + 1 ) ) } } } | + 0 . 1 } \} _ { i = 0 } ^ { 2 4 } \} _ { i = 0 } ^ { 2 } } \end{array}
167
+ $$
168
+
169
+ Note that all operations are applied element-wise. Also, whenever a feature becomes undefined (i.e.: when the time step index becomes negative), it is replaced with the all-zeros vector.
170
+
171
+ Unlike state features, which are only used when training the optimization algorithm, observation features $\Psi ( \cdot )$ are used both during training and at test time. Consequently, we use noisier observation features that can be computed more efficiently and require less memory overhead. The observation features consist of the following:
172
+
173
+ $$
174
+ \begin{array} { r l } { \bullet } & { \left( \hat { f } ( x ^ { ( t ) } ) - \hat { f } ( x ^ { ( t - 1 ) } ) \right) / \hat { f } ( x ^ { ( t - 1 ) } ) } \\ & { \bullet \ \nabla \hat { f } ( x ^ { ( t ) } ) / \left( \left| \nabla \hat { f } ( x ^ { ( \operatorname* { m a x } ( t - 1 , 0 ) ) } ) \right| + 1 \right) } \\ & { \bullet \ \frac { \left| x ^ { ( \operatorname* { m a x } ( t - 1 , 1 ) ) } - x ^ { ( \operatorname* { m a x } ( t - 2 , 0 ) ) } \right| } { \left| x ^ { ( t ) } - x ^ { ( t - 1 ) } \right| + 0 . 1 } } \end{array}
175
+ $$
176
+
177
+ # 4 EXPERIMENTS
178
+
179
+ For clarity, we will refer to training of the optimization algorithm as “meta-training” to differentiate it from base-level training, which will simply be referred to as “training”.
180
+
181
+ We meta-trained an optimization algorithm on a single objective function, which corresponds to the problem of training a two-layer neural net with 48 input units, 48 hidden units and 10 output units on a randomly projected and normalized version of the MNIST training set with dimensionality 48 and unit variance in each dimension. We modelled the optimization algorithm using an recurrent neural net with a single layer of 128 LSTM (Hochreiter & Schmidhuber, 1997) cells. We used a time horizon of 400 iterations and a mini-batch size of 64 for computing stochastic gradients and objective values. We evaluate the optimization algorithm on its ability to generalize to unseen objective functions, which correspond to the problems of training neural nets on different tasks/datasets.
182
+
183
+ ![](images/dba70d81f44e9b66aeedbf35fb705247b4161ee34db83bed3b4ba0993a37fd89.jpg)
184
+ Figure 3: Comparison of the various hand-engineered and learned algorithms on training neural nets with 48 input and hidden units on (a) TFD, (b) CIFAR-10 and (c) CIFAR-100 with mini-batches of size 10. The vertical axis is the true objective value and the horizontal axis represents the iteration. Best viewed in colour.
185
+
186
+ ![](images/afba0d91683764d4cd4161719336a9f48fc43fabd99a2b8440e62626e6cabcb3.jpg)
187
+ Figure 4: Comparison of the various hand-engineered and learned algorithms on training neural nets with 100 input units and 200 hidden units on (a) TFD, (b) CIFAR-10 and (c) CIFAR-100 with minibatches of size 10. The vertical axis is the true objective value and the horizontal axis represents the iteration. Best viewed in colour.
188
+
189
+ We evaluate the learned optimization algorithm on three datasets, the Toronto Faces Dataset (TFD), CIFAR-10 and CIFAR-100. These datasets are chosen for their very different characteristics from MNIST and each other: TFD contains 3300 grayscale images that have relatively little variation and has seven different categories, whereas CIFAR-100 contains 50,000 colour images that have varied appearance and has 100 different categories.
190
+
191
+ All algorithms are tuned on the training objective function. For hand-engineered algorithms, this entails choosing the best hyperparameters; for learned algorithms, this entails meta-training on the objective function. We compare to the seven hand-engineered algorithms: stochastic gradient descent, momentum, conjugate gradient, L-BFGS, ADAM, AdaGrad and RMSprop. In addition, we compare to an optimization algorithm meta-trained using the method described in (Andrychowicz et al., 2016) on the same training objective function (training two-layer neural net on randomly projected and normalized MNIST) under the same setting (a time horizon of 400 iterations and a mini-batch size of 64).
192
+
193
+ First, we examine the performance of various optimization algorithms on similar objective functions. The optimization problems under consideration are those for training neural nets that have the same number of input and hidden units (48 and 48) as those used during meta-training. The number of output units varies with the number of categories in each dataset. We use the same mini-batch size as that used during meta-training. As shown in Figure 1, the optimization algorithm meta-trained using our method (which we will refer to as Predicted Step Descent) consistently descends to the optimum the fastest across all datasets. On the other hand, other algorithms are not as consistent and the relative ranking of other algorithms varies by dataset. This suggests that Predicted Step Descent has learned to be robust to variations in the data distributions, despite being trained on only one objective function, which is associated with a very specific data distribution that characterizes MNIST. It is also interesting to note that while the algorithm meta-trained using (Andrychowicz et al., 2016) (which we will refer to as L2LBGDBGD) performs well on CIFAR, it is unable to reach the optimum on TFD.
194
+
195
+ ![](images/2226d92233c78e2cc8398fe5882a7f24065a5392b547b417b88d986cc9309d20.jpg)
196
+ Figure 5: Comparison of the various hand-engineered and learned algorithms on training neural nets with 100 input units and 200 hidden units on (a) TFD, (b) CIFAR-10 and (c) CIFAR-100 for 800 iterations with mini-batches of size 64. The vertical axis is the true objective value and the horizontal axis represents the iteration. Best viewed in colour.
197
+
198
+ Next, we change the architecture of the neural nets and see if Predicted Step Descent generalizes to the new architecture. We increase the number of input units to 100 and the number of hidden units to 200, so that the number of parameters is roughly increased by a factor of 8. As shown in Figure 2, Predicted Step Descent consistently outperforms other algorithms on each dataset, despite having not been trained to optimize neural nets of this architecture. Interestingly, while it exhibited a bit of oscillation initially on TFD and CIFAR-10, it quickly recovered and overtook other algorithms, which is reminiscent of the phenomenon reported in (Li & Malik, 2016) for low-dimensional optimization problems. This suggests that it has learned to detect when it is performing poorly and knows how to change tack accordingly. L2LBGDBGD experienced difficulties on TFD and CIFAR10 as well, but slowly diverged.
199
+
200
+ We now investigate how robust Predicted Step Descent is to stochasticity of the gradients. To this end, we take a look at its performance when we reduce the mini-batch size from 64 to 10 on both the original architecture with 48 input and hidden units and the enlarged architecture with 100 input units and 200 hidden units. As shown in Figure 3, on the original architecture, Predicted Step Descent still outperforms all other algorithms and is able to handle the increased stochasticity fairly well. In contrast, conjugate gradient and L2LBGDBGD had some difficulty handling the increased stochasticity on TFD and to a lesser extent, on CIFAR-10. In the former case, both diverged; in the latter case, both were progressing slowly towards the optimum.
201
+
202
+ On the enlarged architecture, Predicted Step Descent experienced some significant oscillations on TFD and CIFAR-10, but still managed to achieve a much better objective value than all the other algorithms. Many hand-engineered algorithms also experienced much greater oscillations than previously, suggesting that the optimization problems are inherently harder. L2LBGDBGD diverged fairly quickly on these two datasets.
203
+
204
+ Finally, we try doubling the number of iterations. As shown in Figure 5, despite being trained over a time horizon of 400 iterations, Predicted Step Descent behaves reasonably beyond the number of iterations it is trained for.
205
+
206
+ # 5 CONCLUSION
207
+
208
+ In this paper, we presented a new method for learning optimization algorithms for high-dimensional stochastic problems. We applied the method to learning an optimization algorithm for training shallow neural nets. We showed that the algorithm learned using our method on the problem of training a neural net on MNIST generalizes to the problems of training neural nets on unrelated tasks/datasets like the Toronto Faces Dataset, CIFAR-10 and CIFAR-100. We also demonstrated that the learned optimization algorithm is robust to changes in the stochasticity of gradients and the neural net architecture.
209
+
210
+ # REFERENCES
211
+
212
+ Marcin Andrychowicz, Misha Denil, Sergio Gomez, Matthew W Hoffman, David Pfau, Tom Schaul, and Nando de Freitas. Learning to learn by gradient descent by gradient descent. arXiv preprint arXiv:1606.04474, 2016.
213
+
214
+ Jonathan Baxter, Rich Caruana, Tom Mitchell, Lorien Y Pratt, Daniel L Silver, and Sebastian Thrun. NIPS 1995 workshop on learning to learn: Knowledge consolidation and transfer in inductive systems. https://web.archive.org/web/20000618135816/http://www. cs.cmu.edu/afs/cs.cmu.edu/user/caruana/pub/transfer.html, 1995. Accessed: 2015-12-05.
215
+
216
+ Y Bengio, S Bengio, and J Cloutier. Learning a synaptic learning rule. In Neural Networks, 1991., IJCNN-91-Seattle International Joint Conference on, volume 2, pp. 969–vol. IEEE, 1991.
217
+
218
+ Yoshua Bengio. Gradient-based optimization of hyperparameters. Neural computation, 12(8):1889– 1900, 2000.
219
+
220
+ James Bergstra and Yoshua Bengio. Random search for hyper-parameter optimization. The Journal of Machine Learning Research, 13(1):281–305, 2012.
221
+
222
+ James S Bergstra, Remi Bardenet, Yoshua Bengio, and Bal ´ azs K ´ egl. Algorithms for hyper-parameter ´ optimization. In Advances in Neural Information Processing Systems, pp. 2546–2554, 2011.
223
+
224
+ M Bray, E Koller-Meier, P Muller, L Van Gool, and NN Schraudolph. 3D hand tracking by rapid stochastic gradient descent using a skinning model. In Visual Media Production, 2004.(CVMP). 1st European Conference on, pp. 59–68. IET, 2004.
225
+
226
+ Pavel Brazdil, Christophe Giraud Carrier, Carlos Soares, and Ricardo Vilalta. Metalearning: applications to data mining. Springer Science & Business Media, 2008.
227
+
228
+ Pavel B Brazdil, Carlos Soares, and Joaquim Pinto Da Costa. Ranking learning algorithms: Using ibl and meta-learning on accuracy and time results. Machine Learning, 50(3):251–277, 2003.
229
+
230
+ Christian Daniel, Jonathan Taylor, and Sebastian Nowozin. Learning step size controllers for robust neural network training. In Thirtieth AAAI Conference on Artificial Intelligence, 2016.
231
+
232
+ Justin Domke. Generic methods for optimization-based modeling. In AISTATS, volume 22, pp. 318–326, 2012.
233
+
234
+ John Duchi, Elad Hazan, and Yoram Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12(Jul):2121–2159, 2011.
235
+
236
+ Matthias Feurer, Jost Tobias Springenberg, and Frank Hutter. Initializing bayesian hyperparameter optimization via meta-learning. In AAAI, pp. 1128–1135, 2015.
237
+
238
+ Jie Fu, Zichuan Lin, Miao Liu, Nicholas Leonard, Jiashi Feng, and Tat-Seng Chua. Deep q-networks for accelerating the training of deep neural networks. arXiv preprint arXiv:1606.01467, 2016.
239
+
240
+ Karol Gregor and Yann LeCun. Learning fast approximations of sparse coding. In Proceedings of the 27th International Conference on Machine Learning (ICML-10), pp. 399–406, 2010.
241
+
242
+ Samantha Hansen. Using deep q-learning to control optimization hyperparameters. arXiv preprint arXiv:1602.04062, 2016.
243
+
244
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
245
+
246
+ Sepp Hochreiter, A Steven Younger, and Peter R Conwell. Learning to learn using gradient descent. In International Conference on Artificial Neural Networks, pp. 87–94. Springer, 2001.
247
+
248
+ Frank Hutter, Holger H Hoos, and Kevin Leyton-Brown. Sequential model-based optimization for general algorithm configuration. In Learning and Intelligent Optimization, pp. 507–523. Springer, 2011.
249
+
250
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
251
+
252
+ Sergey Levine, Chelsea Finn, Trevor Darrell, and Pieter Abbeel. End-to-end training of deep visuomotor policies. arXiv preprint arXiv:1504.00702, 2015.
253
+
254
+ Ke Li and Jitendra Malik. Learning to optimize. CoRR, abs/1606.01885, 2016.
255
+
256
+ Dougal Maclaurin, David Duvenaud, and Ryan P Adams. Gradient-based hyperparameter optimization through reversible learning. arXiv preprint arXiv:1502.03492, 2015.
257
+
258
+ Paul L Ruvolo, Ian Fasel, and Javier R Movellan. Optimization on a budget: A reinforcement learning approach. In Advances in Neural Information Processing Systems, pp. 1385–1392, 2009.
259
+
260
+ Jurgen Schmidhuber. Optimal ordered problem solver. ¨ Machine Learning, 54(3):211–254, 2004.
261
+
262
+ Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical bayesian optimization of machine learning algorithms. In Advances in neural information processing systems, pp. 2951–2959, 2012.
263
+
264
+ Pablo Sprechmann, Roee Litman, Tal Ben Yakar, Alexander M Bronstein, and Guillermo Sapiro. Supervised sparse analysis and synthesis operators. In Advances in Neural Information Processing Systems, pp. 908–916, 2013.
265
+
266
+ Kevin Swersky, Jasper Snoek, and Ryan P Adams. Multi-task bayesian optimization. In Advances in neural information processing systems, pp. 2004–2012, 2013.
267
+
268
+ Sebastian Thrun and Lorien Pratt. Learning to learn. Springer Science & Business Media, 2012.
269
+
270
+ Tijmen Tieleman and Geoffrey Hinton. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural networks for machine learning, 4(2), 2012.
271
+
272
+ Ricardo Vilalta and Youssef Drissi. A perspective view and survey of meta-learning. Artificial Intelligence Review, 18(2):77–95, 2002.
273
+
274
+ Huahua Wang and Arindam Banerjee. Bregman alternating direction method of multipliers. CoRR, abs/1306.3203, 2014.
md/train/BkM3ibZRW/BkM3ibZRW.md ADDED
@@ -0,0 +1,438 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADVERSARIALLY REGULARIZED AUTOENCODERS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ While autoencoders are a key technique in representation learning for continuous structures, such as images or wave forms, developing general-purpose autoencoders for discrete structures, such as text sequence or discretized images, has proven to be more challenging. In particular, discrete inputs make it more difficult to learn a smooth encoder that preserves the complex local relationships in the input space. In this work, we propose an adversarially regularized autoencoder (ARAE) with the goal of learning more robust discrete-space representations. ARAE jointly trains both a rich discrete-space encoder, such as an RNN, and a simpler continuous space generator function, while using generative adversarial network (GAN) training to constrain the distributions to be similar. This method yields a smoother contracted code space that maps similar inputs to nearby codes, and also an implicit latent variable GAN model for generation. Experiments on text and discretized images demonstrate that the GAN model produces clean interpolations and captures the multimodality of the original space, and that the autoencoder produces improvements in semi-supervised learning as well as state-of-the-art results in unaligned text style transfer task using only a shared continuous-space representation.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Recent work on regularized autoencoders, such as variational (Kingma & Welling, 2014; Rezende et al., 2014) and denoising (Vincent et al., 2008) variants, has shown significant progress in learning smooth representations of complex, high-dimensional continuous data such as images. These codespace representations facilitate the ability to apply smoother transformations in latent space in order to produce complex modifications of generated outputs, while still remaining on the data manifold.
12
+
13
+ Unfortunately, learning similar latent representations of discrete structures, such as text sequences or discretized images, remains a challenging problem. Initial work on VAEs for text has shown that optimization is difficult, as the decoder can easily degenerate into a unconditional language model (Bowman et al., 2015b). Recent work on generative adversarial networks (GANs) for text has mostly focused on getting around the use of discrete structures either through policy gradient methods (Che et al., 2017; Hjelm et al., 2017; Yu et al., 2017) or with the Gumbel-Softmax distribution (Kusner & Hernandez-Lobato, 2016). However, neither approach can yet produce robust representations directly.
14
+
15
+ A major difficulty of discrete autoencoders is mapping a discrete structure to a continuous code vector while also smoothly capturing the complex local relationships of the input space. Inspired by recent work combining pretrained autoencoders with deep latent variable models, we propose to target this issue with an adversarially regularized autoencoder (ARAE). Specifically we jointly train a discrete structure encoder and continuous space generator, while constraining the two models with a discriminator to agree in distribution. This approach allows us to utilize a complex encoder model, such as an RNN, and still constrain it with a very flexible, but more limited generator distribution. The full model can be then used as a smoother discrete structure autoencoder or as a latent variable GAN model where a sample can be decoded, with the same decoder, to a discrete output. Since the system produces a single continuous coded representation—in contrast to methods that act on each RNN state—it can easily be further regularized with problem-specific invariants, for instance to learn to ignore style, sentiment or other attributes for transfer tasks.
16
+
17
+ Experiments apply ARAE to discretized images and sentences, and demonstrate that the key properties of the model. Using the latent variable model (ARAE-GAN), the model is able to generate varied samples that can be quantitatively shown to cover the input spaces and to generate consistent image and sentence manipulations by moving around in the latent space via interpolation and offset vector arithmetic. Using the discrete encoder, the model can be used in a semi-supervised setting to give improvement in a sentence inference task. When the ARAE model is trained with task-specific adversarial regularization, the model improves the current best results on sentiment transfer reported in Shen et al. (2017) and produces compelling outputs on a topic transfer task using only a single shared code space. All outputs are listed in the Appendix 9 and code is available at (removed for review).
18
+
19
+ # 2 RELATED WORK
20
+
21
+ In practice unregularized autoencoders often learn a degenerate identity mapping where the latent code space is free of any structure, so it is necessary to apply some method of regularization. A popular approach is to regularize through an explicit prior on the code space and use a variational approximation to the posterior, leading to a family of models called variational autoencoders (VAE) (Kingma & Welling, 2014; Rezende et al., 2014). Unfortunately VAEs for discrete text sequences can be challenging to train—for example, if the training procedure is not carefully tuned with techniques like word dropout and KL annealing (Bowman et al., 2015b), the decoder simply becomes a language model and ignores the latent code (although there has been some recent successes with convolutional models (Semeniuta et al., 2017; Yang et al., 2017)). One possible reason for the difficulty in training VAEs is due to the strictness of the prior (usually a spherical Gaussian) and/or the parameterization of the posterior. There has been some work on making the prior/posterior more flexible through explicit parameterization (Rezende & Mohamed, 2015; Kingma et al., 2016; Chen et al., 2017). A notable technique is adversarial autoencoders (AAE) (Makhzani et al., 2015) which attempt to imbue the model with a more flexible prior implicitly through adversarial training. In AAE framework, the discriminator is trained to distinguish between samples from a fixed prior distribution and the input encoding, thereby pushing the code distribution to match the prior. While this adds more flexibility, it has similar issues for modeling text sequences and suffers from mode-collapse in our experiments. Our approach has similar motivation, but notably we do not sample from a fixed prior distribution—our ‘prior’ is instead parameterized through a flexible generator. Nonetheless, this view (which has been observed by various researchers (Tran et al., 2017; Mescheder et al., 2017; Makhzani & Frey, 2017)) provides an interesting connection between VAEs and GANs.
22
+
23
+ The success of GANs on images have led many researchers to consider applying GANs to discrete data such as text. Policy gradient methods are a natural way to deal with the resulting non-differentiable generator objective when training directly in discrete space (Glynn, 1987; Williams, 1992). When trained on text data however, such methods often require pre-training/co-training with a maximum likelihood (i.e. language modeling) objective (Che et al., 2017; Yu et al., 2017; Li et al., 2017). This precludes there being a latent encoding of the sentence, and is also a potential disadvantage of existing language models (which can otherwise generate locally-coherent samples). Another direction of work has been through reparameterizing the categorical distribution with the Gumbel-Softmax trick (Jang et al., 2017; Maddison et al., 2017)—while initial experiments were encouraging on a synthetic task (Kusner & Hernandez-Lobato, 2016), scaling them to work on natural language is a challenging open problem. There has also been a flurry of recent, related approaches that work directly with the soft outputs from a generator (Gulrajani et al., 2017; Sai Rajeswar, 2017; Shen et al., 2017; Press et al., 2017). For example, Shen et al. (Shen et al., 2017) exploits adversarial loss for unaligned style transfer between text by having the discriminator act on the RNN hidden states and using the soft outputs at each step as input to an RNN generator, utilizing the Professor-forcing framework (Lamb et al., 2016). Our approach instead works entirely in code space and does not require utilizing RNN hidden states directly.
24
+
25
+ # 3 BACKGROUND
26
+
27
+ Discrete Structure Autoencoders Define $\mathcal { X } = \mathcal { V } ^ { n }$ to be a set of discrete structures where $\nu$ is a vocabulary of symbols and $\mathbb { P } _ { x }$ to be a distribution over this space. For instance, for binarized images $\mathcal { V } = \{ 0 , 1 \}$ and $n$ is the number of pixels, while for sentences $\nu$ is the vocabulary and $n$ is the sentence length. A discrete autoencoder consists of two parameterized functions: a deterministic encoder function $\mathrm { e n c } _ { \phi } : \mathcal { X } \mapsto \mathcal { C }$ with parameters $\phi$ that maps from input to code space and a conditional decoder distribution $p _ { \psi } ( \mathbf { x } \mid \mathbf { c } )$ over structures $\mathcal { X }$ with parameters $\psi$ . The parameters are trained on a cross-entropy reconstruction loss:
28
+
29
+ $$
30
+ { \mathcal { L } } _ { \mathrm { r e c } } ( \phi , \psi ) = - \log p _ { \psi } ( \mathbf { x } \mid \mathrm { e n c } _ { \phi } ( \mathbf { x } ) )
31
+ $$
32
+
33
+ The choice of the encoder and decoder parameterization is specific to the structure of interest, for example we use RNNs for sequences. We use the notation, $\hat { \mathbf { x } } = \arg \operatorname* { m a x } _ { \mathbf { x } } p _ { \psi } ( \mathbf { x } \mid \mathrm { e n c } _ { \phi } ( \mathbf { x } ) )$ for the (approximate) decoder mode. When $\mathbf { x } = { \hat { \mathbf { x } } }$ the autoencoder is said to perfectly reconstruct x.
34
+
35
+ Generative Adversarial Networks GANs are a class of parameterized implicit generative models (Goodfellow et al., 2014). The method approximates drawing samples from a true distribution $\mathbf { c } \sim \mathbb { P } _ { r }$ by instead employing a latent variable $\mathbf { z }$ and a parameterized deterministic generator function $\tilde { \mathbf { c } } = g _ { \theta } ( \mathbf { z } )$ to produce samples $\tilde { \mathbf { c } } \sim \mathbb { P } _ { g }$ . Initial work on GANs minimizes the Jensen-Shannon divergence between the distributions. Recent work on Wasserstein GAN (WGAN) (Arjovsky et al., 2017), replaces this with the Earth-Mover (Wasserstein-1) distance.
36
+
37
+ GAN training utilizes two separate models: a generator $g _ { \boldsymbol \theta } ( \mathbf { z } )$ maps a latent vector from some easy-to-sample source distribution to a sample and a critic/discriminator $f _ { w } ( { \bf c } )$ aims to distinguish real data and generated samples from $g _ { \theta }$ . Informally, the generator is trained to fool the critic, and the critic to tell real from generated. WGAN training uses the following min-max optimization over generator parameters $\theta$ and critic parameters $w$ ,
38
+
39
+ $$
40
+ \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { w \in \mathcal { W } } \mathbb { E } _ { \mathbf { c } \sim \mathbb { P } _ { r } } [ f _ { w } ( \mathbf { c } ) ] - \mathbb { E } _ { \tilde { \mathbf { c } } \sim \mathbb { P } _ { g } } [ f _ { w } ( \tilde { \mathbf { c } } ) ] ,
41
+ $$
42
+
43
+ where $f _ { w } : { \mathcal { C } } \mapsto \mathbb { R }$ denotes the critic function, c˜ is obtained from the generator, $\tilde { \mathbf { c } } = g _ { \theta } ( \mathbf { z } )$ , and $\mathbb { P } _ { r }$ and $\mathbb { P } _ { g }$ are real and generated distributions. If the critic parameters $w$ are restricted to an 1-Lipschitz function set $\mathcal { W }$ , this term correspond to minimizing Wasserstein-1 distance $W ( \mathbb { P } _ { r } , \mathbb { P } _ { g } )$ . We use a naive approximation to enforce this property by weight-clipping, i.e. $w = [ - \epsilon , \epsilon ] ^ { d }$ (Arjovsky et al., 2017).
44
+
45
+ # 4 MODEL: ADVERSARIALLY REGULARIZED AUTOENCODER
46
+
47
+ Ideally, a discrete autoencoder should be able to reconstruct $x$ from $c .$ , but also smoothly assign similar codes $c$ and $c ^ { \prime }$ to similar $x$ and $x ^ { \prime }$ . For continuous autoencoders, this property can be enforced directly through explicit regularization. For instance, contractive autoencoders (Rifai et al., 2011) regularize their loss by the functional smoothness of enc $\phi$ . However, this criteria does not apply when inputs are discrete and we lack even a metric on the input space. How can we enforce that similar discrete structures map to nearby codes?
48
+
49
+ Adversarially regularized autoencoders target this issue by learning a parallel continuous-space generator with a restricted functional form to act as a smoother reference encoding. The joint objective regularizes the autoencoder to constrain the discrete encoder to agree in distribution with its continuous counterpart:
50
+
51
+ $$
52
+ \begin{array} { r l } { \underset { \phi , \psi , \theta } { \operatorname* { m i n } } } & { { } \mathcal { L } _ { \mathrm { r e c } } ( \phi , \psi ) + \lambda ^ { ( 1 ) } W ( \mathbb { P } _ { r } , \mathbb { P } _ { g } ) } \end{array}
53
+ $$
54
+
55
+ Above $W$ is the Wasserstein-1 distance between $\mathbb { P } _ { r }$ the distribution of codes from the discrete encoder model (enc ${ } _ { \phi } ( x )$ where $x \sim \mathbb { P } ( x ) )$ and $\mathbb { P } _ { g }$ is the distribution of codes from the continuous generator model $( g _ { \boldsymbol { \theta } } ( z )$ for some $z$ , e.g. $z \sim \mathcal { N } ( 0 , I ) )$ . To approximate Wasserstein-1 term, the $W$ function includes an embedded critic function which is optimized adversarially to the encoder and generator as described in the background. The full model is shown in Figure 1.
56
+
57
+ To train the model, we use a block coordinate descent to alternate between optimizing different parts of the model: (1) the encoder and decoder to minimize reconstruction loss, (2) the WGAN critic function to approximate the $W$ term, (3) the encoder and generator to adversarially fool the critic to minimize $W$ :
58
+
59
+ $$
60
+ \begin{array} { r l r l r l } { { 1 } ) \underset { \phi , \psi } { \mathrm { m i n } } } & { \quad } & & { \mathcal { L } _ { \mathrm { r e c } } ( \phi , \psi ) } & & { } \\ { 2 ) \underset { w \in \mathcal { W } } { \mathrm { m i n } } } & { \quad } & & { \mathcal { L } _ { \mathrm { c r i } } ( w ) = } & { \quad } & & { \underset { w \in \mathcal { W } } { \mathrm { m a x } } \quad \mathbb { E } _ { \mathbf { x } \sim \mathbb { P } _ { x } } \left[ f _ { w } ( \mathbf { e n c } _ { \phi } ( \mathbf { x } ) ) \right] - \mathbb { E } _ { \widetilde { \mathbf { c } } \sim \mathbb { P } _ { g } } \left[ f _ { w } ( \widetilde { \mathbf { c } } ) \right] } \\ { 3 ) \underset { \phi , \theta } { \mathrm { m i n } } } & { \quad } & & { \mathcal { L } _ { \mathrm { e n c s } } ( \phi , \theta ) = } & { \quad } & & { \underset { \phi , \theta } { \mathrm { m i n } } } & { \quad \mathbb { E } _ { \mathbf { x } \sim \mathbb { P } _ { x } } \left[ f _ { w } ( \mathbf { e n c } _ { \phi } ( \mathbf { x } ) ) \right] - \mathbb { E } _ { \widetilde { \mathbf { c } } \sim \mathbb { P } _ { g } } \left[ f _ { w } ( \widetilde { \mathbf { c } } ) \right] } \end{array}
61
+ $$
62
+
63
+ The full training algorithm is shown in Algorithm 1.
64
+
65
+ ![](images/ca36a5089dd4385655adadbef891cf50e331699403af8d1054ab6e0dad78b413.jpg)
66
+ Figure 1: ARAE architecture. The model can be used as an autoencoder, where a structure $\mathbf { x }$ is encoded and decoded to produce $\hat { \bf x }$ , and as a GAN (ARAE-GAN), where a sample $\mathbf { z }$ is passed though a generator $g _ { \theta }$ to produce a code vector, which is similarly decoded to $\tilde { \mathbf { x } }$ . The critic function $f _ { w }$ is only used at training to help approximate $W$ .
67
+
68
+ # Algorithm 1 ARAE Training
69
+
70
+ <table><tr><td>for number of training iterations do (1) Train the autoencoder for reconstruction [Lrec(Φ,)].</td><td></td><td></td></tr><tr><td>Sample {x()}m1~P andcomputecode-vectors c(i) =en(x().</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>(2) Train the critic [Lcri(w)] (Repeat k times)</td><td></td><td></td></tr><tr><td>Sample {x)1~P and {z@1~N(0,I).</td><td></td><td></td></tr><tr><td>Compute code-vectors c(i)=en(x()and c()= ge(z().</td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>(3) Train the generator and encoder adversarially to critic [Lencs(,0)]</td><td></td><td></td></tr><tr><td>Sample {x)ym1~P and {z)}1~N(0,I)</td><td></td><td></td></tr><tr><td>Compute code-vectors c(i) = enc(x(i)) and c(i) = ge(z(i).</td><td></td><td></td></tr><tr><td>Backpropagate adversariallossm∑1 f(c(i))-∑=1 fu(c()and update.</td><td></td><td></td></tr></table>
71
+
72
+ Extension: Code Space Transfer One benefit of the ARAE framework is that it compresses the input to a single code vector. This framework makes it ideal for manipulating discrete objects while in continuous code space. For example, consider the problem of unaligned transfer, where we want to change an attribute of a discrete input without supervised examples, e.g. to change the topic or sentiment of a sentence. First, we extend the decoder to condition on a transfer variable denoting this attribute $\mathbf { y }$ which is known during training, to learn $p _ { \psi } ( \mathbf { x } \mid \mathbf { c } , y )$ . Next, we train the code space to be invariant to this attribute, to force it to be learned fully by the decoder. Specifically, we further regularize the code space to map similar $x$ with different attribute labels $y$ near enough to fool a code space attribute classifier, i.e.:
73
+
74
+ $$
75
+ \operatorname* { m i n } _ { \phi , \psi , \theta } \quad \mathcal { L } _ { \mathrm { r e c } } ( \phi , \psi ) + \lambda ^ { ( 1 ) } W ( \mathbb { P } _ { r } , \mathbb { P } _ { g } ) - \lambda ^ { ( 2 ) } \mathcal { L } _ { \mathrm { c l a s s } } ( \phi , u )
76
+ $$
77
+
78
+ where $\mathcal { L } _ { \mathrm { c l a s s } } ( \phi , u )$ is the loss of a classifier $p _ { u } ( y \mid \mathbf { c } )$ from code space to labels (in our experiments we always set $\lambda ^ { ( 2 ) } = 1 \AA$ ). To incorporate this additional regularization, we simply add two more gradient update steps: (2b) training a classifier to discriminate codes, and (3b) adversarially training the encoder to fool this classifier. The algorithm is shown in Algorithm 2. Note that similar technique has been introduced in other domains, notably in images (Lample et al., 2017) and video modeling (Denton $\&$ Birodkar, 2017).
79
+
80
+ # 5 METHODS AND ARCHITECTURES
81
+
82
+ We experiment with three different ARAE models: (1) an autoencoder for discretized images trained on the binarized version of MNIST, (2) an autoencoder for text sequences trained using the Stanford Natural Language Inference (SNLI) corpus (Bowman et al., 2015a), and (3) an autoencoder trained
83
+
84
+ # Algorithm 2 ARAE Transfer Extension
85
+
86
+ <table><tr><td>[Each loop additionally:] (2b) Train the code classifier [minu Lclass(,u)]</td></tr><tr><td></td></tr><tr><td> Sample {x()}m=1 ~ Px,lookup y(),and computecode-vectors c(i) = enc(x(i).</td></tr><tr><td></td></tr><tr><td>(3b) Train the encoder adversarially to code classifier [max Lclass(,u)]</td></tr><tr><td>Sample {x()}m1P,lookupy(),ndcomputecode-vectors c(i) =ec(x(i).</td></tr><tr><td></td></tr></table>
87
+
88
+ for text transfer (Section 6.2) based on the Yelp and Yahoo datasets for unaligned sentiment and topic transfer. All three models utilize the same generator architecture, $g _ { \theta }$ . The generator architecture uses a low dimensional $\mathbf { z }$ with a Gaussian prior $p ( \mathbf { z } ) = \mathcal { N } ( 0 , \mathbf { I } )$ , and maps it to c. Both the critic $f _ { w }$ and the generator $g _ { \theta }$ are parameterized as feed-forward MLPs.
89
+
90
+ The image model uses fully-connected NN to autoencode binarized images. Here $\mathcal { X } = \{ 0 , 1 \} ^ { n }$ where $n$ is the image size. The encoder used is a feed-forward MLP network mapping from $\{ 0 , 1 \} ^ { n } \mapsto \mathbb { R } ^ { m }$ , ${ \mathrm { e n c } } _ { \phi } ( \mathbf { x } ) = \mathbf { M L P } ( \mathbf { x } ; \phi ) = \mathbf { c }$ . The decoder predicts each pixel in $\mathbf { x }$ as a parameterized logistic regression, $\begin{array} { r } { p _ { \psi } ( \mathbf { x } \mid \mathbf { c } ) = \prod _ { j = 1 } ^ { n } \sigma ( \mathbf { h } ) ^ { x _ { j } } ( 1 - \sigma ( \mathbf { h } ) ) ^ { 1 - x _ { j } } } \end{array}$ where $\mathbf { h } = \mathbf { M L P } ( \mathbf { c } ; \psi )$ .
91
+
92
+ The text model uses a recurrent neural network (RNN) for both the encoder and decoder. Here $\mathcal { X } = \mathcal { V } ^ { n }$ where $n$ is the sentence length and $\nu$ is the vocabulary of the underlying language. Define an RNN as a parameterized recurrent function $\mathbf { h } _ { j } = \mathrm { R N N } ( x _ { j } , \mathbf { h } _ { j - 1 } ; \phi )$ for $j = 1 \ldots n$ (with $\mathbf { h } _ { 0 } = \mathbf { 0 } .$ ) that maps a discrete input structure $\mathbf { x }$ to hidden vectors $\mathbf { h } _ { 1 } \ldots . . . \mathbf { h } _ { n }$ . For the encoder, we define $\mathbf { e n c } _ { \phi } ( \mathbf { x } ) = \mathbf { h } _ { n } = \mathbf { c }$ . For decoding we feed $\mathbf { c }$ as an additional input to the decoder RNN at each time step, i.e. $\tilde { \mathbf { h } } _ { j } = \mathrm { R N N } ( x _ { j } , \tilde { \mathbf { h } } _ { j - 1 } , \mathbf { c } ; \psi )$ , and further calculate the distribution over $\nu$ at each time step via softmax, $\begin{array} { r } { p _ { \psi } ( \mathbf { x } \mid \mathbf { \bar { c } } ) = \prod _ { j = 1 } ^ { n } \mathrm { s o f t m a x } ( \mathbf { W } \tilde { \mathbf { h } } _ { j } + \mathbf { b } ) _ { x _ { j } } } \end{array}$ where $\mathbf { W }$ and $\mathbf { b }$ are parameters (part of $\psi$ ). Finding the most likely sequence $\tilde { \bf x }$ under this distribution is intractable, but it is possible to approximate it using greedy search or beam search. In our experiments we use an LSTM architecture (Hochreiter & Schmidhuber, 1997) for both the encoder/decoder and decode using greedy search. The text transfer model uses the same architecture as the text model but extends it with a code space classifier $p ( y | \mathbf { c } )$ which is modeled using an MLP and trained to minimize cross-entropy.
93
+
94
+ Our baselines utilize a standard autoencoder (AE) and the cross-aligned autoencoder (Shen et al., 2017) for transfer. Note that in both our ARAE and standard AE experiments, the encoded code from the encoder is normalized to lie on the unit sphere, and the generated code is bounded to lie in $( - 1 , 1 ) ^ { n }$ by the tanh function at output layer. We additionally experimented with the sequence VAE introduced by Bowman et al. (2015b) and the adversarial autoencoder (AAE) model (Makhzani et al., 2015) on the SNLI dataset. However despite extensive parameter tuning we found that neither model was able to learn meaningful latent representations—the VAE simply ignored the latent code and the AAE experienced mode-collapse and repeatedly generated the same samples. The Appendix 12 includes detailed descriptions of the hyperparameters, model architecture, and training regimes.
95
+
96
+ # 6 EXPERIMENTS
97
+
98
+ Our experiments consider three aspects of the model. First we measure the empirical impact of regularization on the autoencoder. Next we apply the discrete autoencoder to two applications, unaligned style transfer and semi-supervised learning. Finally we employ the learned generator network as an implicit latent variable model (ARAE-GAN) over discrete sequences.
99
+
100
+ # 6.1 IMPACT OF REGULARIZATION ON DISCRETE ENCODING
101
+
102
+ Our main goal for ARAE is to regularize the model produce a smoother encoder by requiring the distribution from the encoder to match the distribution from the continuous generator over a simple latent variable. To examine this claim we consider two basic statistical properties of the code space during training of the text model on SNLI, shown in Figure 2. On the left, we see that the $\ell 2$ norm of c and code c˜ converge quickly in ARAE training. The encoder code is always restricted to be on the unit sphere, and the generated code c˜ quickly learns to match it. The middle plot shows the convergence of the trace of the covariance matrix between the generator and the encoder as training progresses. We find that variance of the encoder and the generator match after several epochs. To check the smoothness of the model, for both ARAE/AE, we take a sentence and calculate the average cosine similarity of 100 randomly-selected sentences that had an edit-distance of at most 5 to the original sentence. We do this for 250 sentences and calculate the mean of the average cosine similarity. Figure 2 (right) shows that the cosine similarity of nearby sentences is quite high for the ARAE than in the case for the AE. Edit-distance is not an ideal proxy for similarity in sentences, but it is often a sufficient condition.
103
+
104
+ ![](images/cdd4cb1a96e120505ce485a5de0b9d938f8ffd9e8488c2dff6d54dbadd0d3010.jpg)
105
+ Figure 2: Left: \`2 norm of encoder code c and generator code c˜ during ARAE training. The encoder c is normalized by the model, whereas the generator learns to match this as training progresses. Middle: Sum of the dimension-wise variances of the encoder codes $\mathbb { P } _ { r }$ and generator codes $\mathbb { P } _ { g }$ compared to that of the standard AE. Right: Average cosine similarity of nearby sentences (edit-distance wise) for the ARAE and AE.
106
+
107
+ Table 1: Left. Reconstruction error (negative log-likelihood averaged over sentences) of the original sentence from a corrupted sentence. Here $k$ is the number of swaps performed on the original sentence. Right. Samples generated from AE and ARAE where the input is noised by swapping words.
108
+
109
+ <table><tr><td>k</td><td>AE</td><td>ARAE</td><td>Original Noised</td><td>A woman wearing sunglasses .</td><td>Original Noised</td><td>They have been swimming . been have They swimming.</td></tr><tr><td>0</td><td>1.06</td><td>2.19</td><td>AE</td><td>A woman sunglasses wearing A woman sunglasses wearing sunglasses .</td><td>AE</td><td>been have been swimming.</td></tr><tr><td>1</td><td>4.51</td><td>4.07</td><td>ARAE</td><td>A woman wearing sunglasses .</td><td>ARAE</td><td>Children have been swimming .</td></tr><tr><td>2</td><td>6.61</td><td>5.39</td><td>Original</td><td>Pets galloping down the street .</td><td>Original</td><td>The child is sleeping .</td></tr><tr><td>3</td><td>9.14</td><td>6.86</td><td>Noised</td><td>Pets down the galloping street .</td><td>Noised</td><td>child The is sleeping.</td></tr><tr><td></td><td></td><td></td><td>AE</td><td>Pets riding the down galloping .</td><td>AE</td><td>The child is sleeping is .</td></tr><tr><td>4</td><td>9.97</td><td>7.47</td><td>ARAE</td><td>Pets congregate down the street near a ravine .</td><td>ARAE</td><td>The child is sleeping.</td></tr></table>
110
+
111
+ Finally an ideal representation should be robust to small changes of the input around the training examples in code space (Rifai et al., 2011). We can test this property by feeding a noised input to the encoder and (i) calculating the score given to the original input, and (ii) checking the reconstructions. Table 1 (right) shows an experiment for text where we add noise by permuting $k$ words in each sentence. We observe that the ARAE is able to map a noised sentence to a natural sentence, (though not necessarily the denoised sentence). Table 1 (left) shows empirical results for these experiments. We obtain the reconstruction error (i.e. negative log likelihood) of the original (non-noised) sentence under the decoder, utilizing the noised code. We find that when $k = 0$ (i.e. no swaps), the regular AE better reconstructs the input as expected. However, as we increase the number of swaps and push the input further away from the data manifold, the ARAE is more likely to produce the original sentence. We note that unlike denoising autoencoders which require a domain-specific noising function (Hill et al., 2016; Vincent et al., 2008), the ARAE is not explicitly trained to denoise an input, but learns to do so as a byproduct of adversarial regularization.
112
+
113
+ # 6.2 APPLICATIONS OF DISCRETE AUTOENCODER
114
+
115
+ Unaligned Text Transfer A smooth autoencoder combined with low reconstruction error should make it possible to more robustly manipulate discrete objects through code space without dropping off the data manifold. To test this hypothesis, we experimented with two unaligned text transfer tasks. For these tasks, we attempt to change one attribute of a sentence without aligned examples of this change. To perform this transfer, we learn a code space that can represent an input that is agnostic to this attribute, and a decoder that can incorporate the attribute (as described in Section 4). We experiment with unaligned transfer of sentiment on the Yelp corpus and topic on the Yahoo corpus (Zhang et al., 2015).
116
+
117
+ Table 2: Experiments on sentiment transfer. Left shows the automatic metrics (Transfer/BLEU/PPL/Reverse PPL) while right shows human evaluation metrics (Transfer/Similarity/Naturalness). Cross-Aligned AE is from Shen et al. (2017)
118
+
119
+ <table><tr><td></td><td colspan="4">Automatic Evaluation</td><td colspan="3">Human Evaluation</td></tr><tr><td>Model</td><td>Transfer</td><td>BLEU</td><td>PPL</td><td>Reverse PPL</td><td>Transfer</td><td>Similarity</td><td>Naturalness</td></tr><tr><td>Cross-Aligned AE</td><td>77.1%</td><td>17.75</td><td>65.9</td><td>124.2</td><td>57%</td><td>3.8</td><td>2.7</td></tr><tr><td>AE</td><td>59.3%</td><td>37.28</td><td>31.9</td><td>68.9</td><td>-</td><td>1</td><td>-</td></tr><tr><td>ARAE, 入(1</td><td>73.4%</td><td>31.15</td><td>29.7</td><td>70.1</td><td>-</td><td>-</td><td>1</td></tr><tr><td>ARAE,X</td><td>81.8%</td><td>20.18</td><td>27.7</td><td>77.0</td><td>74%</td><td>3.7</td><td>3.8</td></tr></table>
120
+
121
+ <table><tr><td></td><td>Positive = Negative</td><td></td><td>Negative=Positive</td></tr><tr><td></td><td>great indoor mall</td><td></td><td>hell no !</td></tr><tr><td>ARAE</td><td>no smoking mall.</td><td>ARAE</td><td>hell great!</td></tr><tr><td>Cross-AE</td><td>terrible outdoor urine .</td><td>Cross-AE</td><td>incredible pork !</td></tr><tr><td></td><td>it has a great atmosphere,with wonderful service .</td><td></td><td>small,smokey,dark and rude management .</td></tr><tr><td>ARAE</td><td>it has no taste,with a complete jerk .</td><td>ARAE</td><td>small, intimate,and cozy friendly staff .</td></tr><tr><td>Cross-AE</td><td>it has a great horrible food and run out service .</td><td>Cross-AE</td><td>great,,,chips and wine .</td></tr><tr><td></td><td>we came on the recommendation of a bellboy and the food was amazing .</td><td></td><td>the people who ordered off the menu did n&#x27;t seem to do much better .</td></tr><tr><td>ARAE</td><td>we came on the recommendation and the food was a joke .</td><td>ARAE</td><td>the people who work there are super friendly and the menu is good</td></tr><tr><td>Cross-AE</td><td>we went on the car of the time and the chicken was awful .</td><td>Cross-AE</td><td>the place,one of the office is always worth you do a business</td></tr></table>
122
+
123
+ Table 3: Sentiment transfer results. Original sentence and transferred output (from ARAE and the Cross-Aligned AE) of 6 randomly-drawn examples.
124
+
125
+ For sentiment we follow the same setup as Shen et al. (2017) and split the Yelp corpus into two sets of unaligned positive and negative reviews. We train an ARAE as an autoencoder with two separate decoders, one for positive and one for negative sentiment, and incorporate adversarial training of the encoder to remove sentiment information from the code space. We test by encoding in sentences of one class and decoding, greedily, with the opposite decoder.
126
+
127
+ Our evaluation is based on four automatic metrics, shown in Table 2: (i) Transfer: measuring how successful the model is at transferring sentiment based on an automatic classifier (we use the fastText library (Joulin et al., 2016)). (ii) BLEU: measuring the consistency between the transferred text and the original. We expect the model to maintain as much information as possible and transfer only the style; (iii) Perplexity: measuring the fluency of the generated text; (iv) Reverse Perplexity: measuring the extent to which the generations are representative of the underlying data distribution.1 Both perplexity numbers are obtained by training an RNN language model.
128
+
129
+ We additionally perform human evaluations on the cross-aligned AE and our best ARAE model. We randomly select 1000 sentences (500/500 positive/negative), obtain the corresponding transfers from both models, and ask Amazon Mechanical Turkers to evaluate the sentiment (Positive/Neutral/Negative) and naturalness (1-5, 5 being most natural) of the transferred sentences. We create a separate task in which we show the Turkers the original and the transferred sentences, and ask them to evaluate the similarity based on sentence structure (1-5, 5 being most similar). We explicitly ask the Turkers to disregard sentiment in their similarity assessment.
130
+
131
+ In addition to comparing against the cross-aligned AE of Shen et al. (2017), we also compare against a vanilla AE trained without adversarial regularization. For ARAE, we experimented with different $\lambda ^ { ( 1 ) }$ weighting on the adversarial loss (see section 4) with $\lambda _ { a } ^ { ( 1 ) } = 1 , \lambda _ { b } ^ { ( 1 ) } = 1 0$ . We generally set $\lambda ^ { ( 2 ) } = 1$ . Experimentally the adversarial regularization enhances transfer and perplexity, but tends to make the transferred text less similar to the original, compared to the AE. Some randomly selected sentences are shown in figure 6 and more samples are shown available in Appendix 9.
132
+
133
+ The same method can be applied to other style transfer tasks, for instance the more challenging Yahoo QA data (Zhang et al., 2015). For Yahoo we chose 3 relatively distinct topic classes for transfer: Science & Math, Entertainment & Music, and Politics & Government. As the dataset contains both
134
+
135
+ questions and answers, we separated our experiments into titles (questions) and replies (answers). The qualitative results are showed in table 4. See Appendix 9 for additional generation examples.
136
+ Table 4: Random samples from Yahoo topic transfer. Note the first row is from ARAE trained on titles while the following ones are from replies.
137
+
138
+ <table><tr><td></td><td colspan="2">Original Science</td><td colspan="2">Original Music</td><td>Original Politics</td></tr><tr><td></td><td>what is an event horizon with regards to black holes ?</td><td></td><td>do you know a website that you can find people who want to join bands ?</td><td></td><td>republicans :would you vote for a cheney /satan ticket in 2008 ?</td></tr><tr><td>Music</td><td>what is your favorite sitcom with adam sandler ?</td><td>Science</td><td>do you know a website that can help me with sci- ence ?</td><td>Science</td><td>guys : how would you solve this question ?</td></tr><tr><td>Politics</td><td>what is an event with black people ?</td><td>Politics</td><td>do you think that you can find a person who is in prison ?</td><td>Music</td><td>guys : would you rather be a good movie ?</td></tr><tr><td>50ml.</td><td>take lml of hcl(concentrated )and dilute it to</td><td></td><td>all three are fabulous artists,with just incredible talent!!</td><td></td><td>4 years of an idiot in office + electing the idiot again = ?</td></tr><tr><td>Music</td><td>take em to you and shout it to me</td><td>Science</td><td>all three are genetically bonded with water,but just as many substances ,are capable of producing</td><td>Science</td><td>4 years of an idiot in the office of science ?</td></tr><tr><td>Politics</td><td>take bribes to islam and it will be punished .</td><td>Politics</td><td>a special case . all three are competing with the government, just as far as i can.</td><td>Music</td><td>4 )&lt;unk&gt; in an idiot ,the idiot is the best of the two points ever !</td></tr><tr><td>of the other .</td><td> just multiply the numerator of one fraction by that</td><td></td><td>but there are so many more ican &amp;apos;t think of</td><td></td><td>anyone who doesnt have a billion dollars for all the publicity cant win .</td></tr><tr><td>Music</td><td>just multiply the fraction of the other one that</td><td>Science</td><td>but there are so many more of the number of ques-</td><td>Science</td><td>anyone who doesnt have a decent chance is the</td></tr><tr><td>Politics</td><td>&amp;apos;s just like it. just multiply the same fraction of other countries.</td><td>Politics</td><td>tions. but there are so many more of the can i think of today.</td><td>Music</td><td>same for all the other . anyone who doesnt have a lot of the show for the publicity.</td></tr></table>
139
+
140
+ Semi-Supervised Training We further utilize ARAE in a standard AE setup for semi-supervised training. We experiment on a natural language inference task, shown in Table 5 (right). We use $2 2 . 2 \%$ , $1 0 . 8 \%$ and $5 . 2 5 \%$ of the original labeled training data, and use the rest of the training set for unlabeled training. The labeled set is randomly picked. The full SNLI training set contains $5 4 3 \mathrm { k }$ sentence pairs, and we use supervised sets of 120k, $5 9 \mathrm { k }$ and 28k sentence pairs respectively for the three settings. As a baseline we use an AE trained on the additional data, similar to the setting explored in Dai & Le (2015). For ARAE we use the subset of unsupervised data of length $< 1 5$ , which roughly includes $6 5 5 \mathrm { k }$ single sentences (due to the length restriction, this is a subset of 715k sentences that were used for AE training). As observed by Dai & Le (2015), training on unlabeled data with an AE objective improves upon a model just trained on labeled data. Training with adversarial regularization provides further gains.
141
+
142
+ # .3 A LATENT VARIABLE MODEL FOR DISCRETE STRUCTURES
143
+
144
+ After training, an ARAE can also be used as an implicit latent variable model controlled by $\mathbf { z }$ and the generator $g _ { \theta }$ , which we refer to as ARAE-GAN. While models of this form have been widely used for generation in other modalities, they have been less effective for discrete structures. In this section, we attempt to measure the effectiveness of this induced discrete GAN.
145
+
146
+ A common test for a GANs ability mimic the true distribution $\mathbb { P } _ { r }$ is to train a simple model on generated samples from $\mathbb { P } _ { g }$ . While there are pitfalls of this evaluation (Theis et al., 2016), it provides a starting point for text modeling. Here we generate $1 0 0 \mathrm { k }$ samples from (i) ARAE-GAN, (ii) an $\mathsf { A E } ^ { 2 }$ , (iii) a RNN LM trained on the same data, and (iv) the real training set (samples from the models are
147
+
148
+ 2To “sample” from an AE we fit a multivariate Gaussian to the code space after training and generate code vectors from this Gaussian to decode back into sentence space.
149
+
150
+ <table><tr><td>Data for LM</td><td>Reverse PPL</td></tr><tr><td>Real data</td><td>27.4</td></tr><tr><td>LM samples</td><td>90.6</td></tr><tr><td>AE samples</td><td>97.3</td></tr><tr><td>ARAE-GAN samples</td><td>82.2</td></tr></table>
151
+
152
+ <table><tr><td>Model</td><td>Medium</td><td>Small</td><td>Tiny</td></tr><tr><td>Supervised Encoder</td><td>65.9%</td><td>62.5%</td><td>57.9%</td></tr><tr><td>Semi-Supervised AE</td><td>68.5%</td><td>64.6%</td><td>59.9%</td></tr><tr><td>Semi-Supervised ARAE</td><td>70.9%</td><td>66.8%</td><td>62.5%</td></tr></table>
153
+
154
+ Table 5: Left. Semi-Supervised accuracy on the natural language inference (SNLI) test set, respectively using $2 2 . 2 \%$ (medium), $1 0 . 8 \%$ (small), $5 . 2 5 \%$ (tiny) of the supervised labels of the full SNLI training set (rest used for unlabeled AE training). Right. Perplexity (lower is better) of language models trained on the synthetic samples from a GAN/AE/LM, and evaluated on real data (Reverse PPL).
155
+
156
+ #
157
+
158
+ A man is on the corner in a sport area .
159
+ A man is on corner in a road all .
160
+ A lady is on outside a racetrack .
161
+ A lady is outside on a racetrack .
162
+ A lot of people is outdoors in an urban setting .
163
+ A lot of people is outdoors in an urban setting .
164
+ A lot of people is outdoors in an urban setting . A man is on a ship path with the woman .
165
+ A man is on a ship path with the woman .
166
+ A man is passing on a bridge with the girl .
167
+ A man is passing on a bridge with the girl .
168
+ A man is passing on a bridge with the girl .
169
+ A man is passing on a bridge with the dogs .
170
+ A man is passing on a bridge with the dogs .
171
+
172
+ A man in a cave is used an escalator .
173
+
174
+ A man in a cave is used an escalator A man in a cave is used chairs A man in a number is used many equipment A man in a number is posing so on a big rock . People are posing in a rural area . People are posing in a rural area.
175
+
176
+ Figure 3: Sample interpolations from the ARAE-GAN. Constructed by linearly interpolating in the latent space and decoding to the output space. Word changes are highlighted in black. Results of the ARAE. The top block shows output generation of the decoder taking fake hidden codes generated by the GAN; the bottom block shows sample interpolation results.
177
+
178
+ <table><tr><td>Transform</td><td>Match %</td><td>Prec</td></tr><tr><td>walking</td><td>85</td><td>79.5</td></tr><tr><td>man</td><td>92</td><td>80.2</td></tr><tr><td>two</td><td>86</td><td>74.1</td></tr><tr><td>dog</td><td>88</td><td>77.0</td></tr><tr><td>standing</td><td>89</td><td>79.3</td></tr><tr><td>several</td><td>70</td><td>67.0</td></tr></table>
179
+
180
+ A man in a tie is sleeping and clapping on balloons .
181
+ A person is standing in the air beneath a criminal .
182
+ The jewish boy is trying to stay out of his skateboard .
183
+ The people works in a new uniform studio .
184
+ Some child head a playing plastic with drink .
185
+ A baby workers is watching steak with the water .
186
+ The people shine or looks into an area .
187
+ The boy ’s babies is wearing a huge factory .
188
+ A women are walking outside near a man .
189
+ The dogs are sleeping in front of the dinner .
190
+ A side child listening to a piece with steps playing on a table .
191
+ Two children are working in red shirt at the cold field . ⇒walking A man in a tie is clapping and walking dogs .
192
+ ⇒walking A person is walking in the air beneath a pickup .
193
+ ⇒man The jewish man is trying to stay out of his horse .
194
+ ⇒man A man works in a new studio uniform .
195
+ ⇒Two Two children playing a head with plastic drink .
196
+ ⇒Two Two workers watching baby steak with the grass .
197
+ ⇒dog The dog arrives or looks into an area .
198
+ ⇒dog The dog ’s babies is wearing a huge ears .
199
+ ⇒standing Three women are standing near a man walking .
200
+ ⇒standing Two dogs are standing in front of the dinner .
201
+ ⇒Several Several child playing a guitar on side with a table .
202
+ ⇒Several Several children working in red shirt are cold at the field .
203
+
204
+ ![](images/7c4347f7aebd494f7ebcd51df16ea27ea9fe42effbe8ace90a650f1c0ba63ee4.jpg)
205
+ Figure 4: Left. Quantitative evaluation of transformations. Match $\%$ refers to the $\%$ of samples where at least one decoder samples (per 100) had the desired transformation in the output, while Prec. measures the average precision of the output against the original sentence. Right. Examples (out of 100 decoder samples per sentence) where the offset vectors produced successful transformations of the original sentence. See Appendix 11 for full methodology.
206
+
207
+ shown in Appendix 10). All models are of the same size to allow for fair comparison. We train an RNN language model on generated samples and evaluate on held-out data to calculate the reverse perplexity. As can be seen from Table 5, training on real data (understandably) outperforms training on generated data by a large margin. Surprisingly however, we find that a language model trained on ARAE-GAN data performs slightly better than one trained on LM-generated/AE-generated data. We further found that the reverse PPL of an AAE (Makhzani et al., 2015) was quite high (980) due to mode-collapse.
208
+
209
+ Another property of GANs (and VAEs) is that the Gaussian form of $\mathbf { z }$ induces the ability to smoothly interpolate between outputs by exploiting the structure of the latent space. While language models may provide a better estimate of the underlying probability space, constructing this style of interpolation would require combinatorial search, which makes this a useful feature of text GANs. We experiment with this property by sampling two points $\mathbf { z } _ { 0 }$ and $\mathbf { z } _ { 1 }$ from $p ( \mathbf { z } )$ and constructing intermediary points ${ \bf z } _ { \lambda } = \lambda { \bf \bar { z } } _ { 1 } + ( 1 - \lambda ) { \bf z } _ { 0 }$ . For each we generate the argmax output $\tilde { \mathbf { x } } _ { \lambda }$ . The samples are shown in Figure 3 (left) for text and in Figure 3 (right) for a discretized MNIST ARAE-GAN.
210
+
211
+ A final intriguing property of image GANs is the ability to move in the latent space via offset vectors (similar to the case with word vectors (Mikolov et al., 2013)). For example, Radford et al. (Radford et al., 2016) observe that when the mean latent vector for “men with glasses” is subtracted from the mean latent vector for “men without glasses” and applied to an image of a “woman without glasses”, the resulting image is that of a “woman with glasses”. To experiment with this property we generate 1 million sentences from the ARAE-GAN and compute vector transforms in this space to attempt to change main verbs, subjects and modifier (details in Appendix 11). Some examples of successful transformations are shown in Figure 4 (right). Quantitative evaluation of the success of the vector transformations is given in Figure 4 (left).
212
+
213
+ # 7 CONCLUSION
214
+
215
+ We present adversarially regularized autoencoders, as a simple approach for training a discrete structure autoencoder jointly with a code-space generative adversarial network. The model learns a improved autoencoder as demonstrated by semi-supervised experiments and improvements on text transfer experiments. It also learns a useful generative model for text that exhibits a robust latent space, as demonstrated by natural interpolations and vector arithmetic. We do note that (as has been frequently observed when training GANs) our model seemed to be quite sensitive to hyperparameters. Finally, while many useful models for text generation already exist, text GANs provide a qualitatively different approach influenced by the underlying latent variable structure. We envision that such a framework could be extended to a conditional setting, combined with other existing decoding schemes, or used to provide a more interpretable model of language.
216
+
217
+ # REFERENCES
218
+
219
+ Martin Arjovsky, Soumith Chintala, and Léon Bottou. Wasserstein gan. arXiv:1701.07875, 2017.
220
+
221
+ Samuel R. Bowman, Gabor Angeli, Christopher Potts, and Christopher D. Manning. A large annotated corpus for learning natural language inference. In Proceedings of EMNLP, 2015a.
222
+
223
+ Samuel R Bowman, Luke Vilnis, Oriol Vinyals, Andrew M Dai, Rafal Jozefowicz, and Samy Bengio. Generating sentences from a continuous space. arXiv preprint arXiv:1511.06349, 2015b.
224
+
225
+ Tong Che, Yanran Li, Ruixiang Zhang, R Devon Hjelm, Wenjie Li, Yangqui Song, and Yoshua Bengio. Maximum-Likelihood Augment Discrete Generative Adversarial Networks. arXiv:1702.07983, 2017.
226
+
227
+ Xi Chen, Diederik P. Kingma, Tim Salimans, Yan Duan, Prafulla Dhariwal, John Schulman, Ilya Sutskever, and Pieter Abbeel. Variational Lossy Autoencoder. In Proceedings of ICLR, 2017.
228
+
229
+ Andrew M Dai and Quoc V Le. Semi-supervised sequence learning. In Proceedings of NIPS, 2015.
230
+
231
+ Emily Denton and Vighnesh Birodkar. Unsupervised learning of disentangled representations from video. arXiv preprint arXiv:1705.10915, 2017.
232
+
233
+ Peter Glynn. Likelihood Ratio Gradient Estimation: An Overview. In Proceedings of Winter Simulation Conference, 1987.
234
+
235
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Proceedings of NIPS, 2014.
236
+
237
+ Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, and Aaron Courville Vincent Dumoulin. Improved Training of Wasserstein GANs. arXiv:1704.00028, 2017.
238
+
239
+ Felix Hill, Kyunghyun Cho, and Anna Korhonen. Learning distributed representations of sentences from unlabelled data. In Proceedings of NAACL, 2016.
240
+
241
+ R Devon Hjelm, Athul Paul Jacob, Tong Che, Kyunghyun Cho, and Yoshua Bengio. BoundarySeeking Generative Adversarial Networks. arXiv:1702.08431, 2017.
242
+
243
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8): 1735–1780, 1997.
244
+
245
+ Eric Jang, Shixiang Gu, and Ben Poole. Categorical Reparameterization with Gumbel-Softmax. In Proceedings of ICLR, 2017.
246
+
247
+ Armand Joulin, Edouard Grave, Piotr Bojanowski, and Tomas Mikolov. Bag of tricks for efficient text classification. arXiv preprint arXiv:1607.01759, 2016.
248
+
249
+ Diederik P. Kingma and Max Welling. Auto-Encoding Variational Bayes. In Proceedings of ICLR, 2014.
250
+
251
+ Diederik P. Kingma, Tim Salimans, and Max Welling. Improving Variational Inference with Autoregressive Flow. arXiv:1606.04934, 2016.
252
+
253
+ Matt Kusner and Jose Miguel Hernandez-Lobato. GANs for Sequences of Discrete Elements with the Gumbel-Softmax Distribution. arXiv:1611.04051, 2016.
254
+
255
+ Alex M Lamb, Anirudh Goyal, Ying Zhang, Saizheng Zhang, Aaron C Courville, and Yoshua Bengio. Professor forcing: A new algorithm for training recurrent networks. In Advances In Neural Information Processing Systems, pp. 4601–4609, 2016.
256
+
257
+ Guillaume Lample, Neil Zeghidour, Nicolas Usuniera, Antoine Bordes, Ludovic Denoyer, and Marc’Aurelio Ranzato. Fader networks: Manipulating images by sliding attributes. In Proceedings of NIPS, 2017.
258
+
259
+ Jiwei Li, Will Monroe, Tianlin Shi, Sébastien Jean, Alan Ritter, and Dan Jurafsky. Adversarial Learning for Neural Dialogue Generation. arXiv:1701.06547, 2017.
260
+
261
+ Chris J. Maddison, Andriy Mnih, and Yee Whye Teh. The Concrete Distribution: A Continuous Relaxation of Discrete Random Variables. In Proceedings of ICLR, 2017.
262
+
263
+ Alireza Makhzani and Brendan Frey. PixelGAN Autoencoders. arXiv:1706.00531, 2017.
264
+
265
+ Alireza Makhzani, Jonathon Shlens, Navdeep Jaitly, Ian Goodfellow, and Brendan Frey. Adversarial Autoencoders. arXiv:1511.05644, 2015.
266
+
267
+ Lars Mescheder, Sebastian Nowozin, and Andreas Geiger. Adversarial Variational Bayes: Unifying Variational Autoencoders and Generative Adversarial Networks. arXiv:1701.04722, 2017.
268
+
269
+ Tomas Mikolov, Scott Wen tau Yih, and Geoffrey Zweig. Linguistic Regularities in Continuous Space Word Representations. In Proceedings of NAACL, 2013.
270
+
271
+ Ofir Press, Amir Bar, Ben Bogin, Jonathan Berant, and Lior Wolf. Language Generation with Recurrent Generative Adversarial Networks without Pre-training. arXiv:1706.01399, 2017.
272
+
273
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised Representation Learning with Deep Convolutional Generative Adversarial Networks. In Proceedings of ICLR, 2016.
274
+
275
+ Danilo J. Rezende and Shakir Mohamed. Variational Inference with Normalizing Flows. In Proceedings of ICML, 2015.
276
+
277
+ Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic Backpropagation and Approximate Inference in Deep Generative Models. In Proceedings of ICML, 2014.
278
+
279
+ Salah Rifai, Pascal Vincent, Xavier Muller, Xavier Glorot, and Yoshua Bengio. Contractive AutoEncoders: Explicit Invariance During Feature Extraction. In Proceedings of ICML, 2011.
280
+
281
+ Francis Dutil Christopher Pal Aaron Courville Sai Rajeswar, Sandeep Subramanian. Adversarial Generation of Natural Language. arXiv:1705.10929, 2017.
282
+
283
+ Stanislau Semeniuta, Aliaksei Severyn, and Erhardt Barth. A Hybrid Convolutional Variational Autoencoder for Text Generation. arXiv:1702.02390, 2017.
284
+
285
+ Tianxiao Shen, Tao Lei, Regina Barzilay, and Tommi Jaakkola. Style Transfer from Non-Parallel Text by Cross-Alignment. arXiv:1705.09655, 2017.
286
+
287
+ Lucas Theis, Aaron van den Oord, and Matthias Bethge. A note on the evaluation of generative models. In Proceedings of ICLR, 2016.
288
+
289
+ Dustin Tran, Rajesh Ranganath, and David M. Blei. Deep and Hierarchical Implicit Models. arXiv:1702.08896, 2017.
290
+
291
+ Cédric Villani. Optimal transport: old and new, volume 338. Springer Science & Business Media, 2008.
292
+
293
+ Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoine Manzagol. Extracting and Composing Robust Features with Denoising Autoencoders. In Proceedings of ICML, 2008.
294
+
295
+ Ronald J. Williams. Simple Statistical Gradient-following Algorithms for Connectionist Reinforcement Learning. Machine Learning, 8, 1992.
296
+
297
+ Zichao Yang, Zhiting Hu, Ruslan Salakhutdinov, and Taylor Berg-Kirkpatrick. Improved Variational Autoencoders for Text Modeling using Dilated Convolutions. In Proceedings of ICML, 2017.
298
+
299
+ Lantao Yu, Weinan Zhang, Jun Wang, and Yong Yu. SeqGAN: Sequence Generative Adversarial Nets with Policy Gradient. In Proceedings of AAAI, 2017.
300
+
301
+ Xiang Zhang, Junbo Zhao, and Yann LeCun. Character-level convolutional networks for text classification. In Advances in neural information processing systems, pp. 649–657, 2015.
302
+
303
+ # 8 APPENDIX: OPTIMALITY PROPERTY
304
+
305
+ One can interpret the ARAE framework as a dual pathway network mapping two distinct distributions into a similar one; $\mathrm { e n c } _ { \phi }$ and $g _ { \theta }$ both output code vectors that are kept similar in terms of Wasserstein distance as measured by the critic. We provide the following proposition showing that under our parameterization of the encoder and the generator, as the Wasserstein distance converges, the encoder distribution $( \mathbf { c } \sim \mathbb { P } _ { r } $ ) converges to the generator distribution $( \tilde { \mathbf { c } } \sim \mathbb { P } _ { g } )$ ), and further, their moments converge.
306
+
307
+ This is ideal since under our setting the generated distribution is simpler than the encoded distribution, because the input to the generator is from a simple distribution (e.g. spherical Gaussian) and the generator possesses less capacity than the encoder. However, it is not so simple that it is overly restrictive (e.g. as in VAEs). Empirically we observe that the first and second moments do indeed converge as training progresses (Section 6.1).
308
+
309
+ Proposition 1. Let $\mathbb { P }$ be a distribution on a compact set $\chi$ , and $( \mathbb { P } _ { n } ) _ { n \in N }$ be a sequence of distributions on $\chi$ . Further suppose that $W ( \mathbb { P } _ { n } , \mathbb { P } ) \to 0$ . Then the following statements hold:
310
+
311
+ (i) $\mathbb { P } _ { n } \sim \mathbb { P }$ (i.e. convergence in distribution).
312
+
313
+ (ii) All moments converge, i.e. for all $k > 1 , k \in \mathbb { N } ,$ ,
314
+
315
+ $$
316
+ \mathbb { E } _ { X \sim \mathbb { P } _ { n } } \bigg [ \prod _ { i = 1 } ^ { d } X _ { i } ^ { p _ { i } } \bigg ] \mathbb { E } _ { X \sim \mathbb { P } } \bigg [ \prod _ { i = 1 } ^ { d } X _ { i } ^ { p _ { i } } \bigg ]
317
+ $$
318
+
319
+ for all $p _ { 1 } , \ldots , p _ { d }$ such that $\textstyle \sum _ { i = 1 } ^ { d } p _ { i } = k$
320
+
321
+ Proof. (i) has been proved in Villani (2008) Theorem 6.9.
322
+
323
+ For (ii), using The Portmanteau Theorem, (i) is equivalent to:
324
+
325
+ $\mathbb { E } _ { X \sim \mathbb { P } _ { n } } [ f ( X ) ] \mathbb { E } _ { X \sim \mathbb { P } } [ f ( X ) ]$ for all bounded and continuous function $f \colon { \mathbb { R } ^ { d } } \to { \mathbb { R } }$ , where $d$ is the dimension of the random variable.
326
+
327
+ The $k$ -th moment of a distribution is given by
328
+
329
+ $$
330
+ \mathbb { E } \Big [ \prod _ { i = 1 } ^ { d } X _ { i } ^ { p _ { i } } \Big ] \mathrm { ~ s u c h ~ t h a t ~ } \sum _ { i = 1 } ^ { d } p _ { i } = k
331
+ $$
332
+
333
+ Our encoded code is bounded as we normalize the encoder output to lie on the unit sphere, and our generated code is also bounded to lie in $( - 1 , 1 ) ^ { n }$ by the tanh function. Hence $\begin{array} { r } { f ( X ) = \prod _ { i = 1 } ^ { d } X _ { i } ^ { q _ { i } } } \end{array}$ is a bounded continuous function for all $q _ { i } > 0$ . Therefore,
334
+
335
+ $$
336
+ \mathbb { E } _ { X \sim \mathbb { P } _ { n } } \Big [ \prod _ { i = 1 } ^ { d } X _ { i } ^ { p _ { i } } \Big ] \to \mathbb { E } _ { X \sim \mathbb { P } } \Big [ \prod _ { i = 1 } ^ { d } X _ { i } ^ { p _ { i } } \Big ]
337
+ $$
338
+
339
+ where $\textstyle \sum _ { i = 1 } ^ { d } p _ { i } = k$
340
+
341
+ # 9 APPENDIX: SHEET OF STYLE-TRANSFER SAMPLES
342
+
343
+ # YELP TRANSFER
344
+
345
+ Table 6: Full sheet of sentiment transfer result
346
+
347
+ <table><tr><td></td><td>Positive to Negative</td><td></td><td>Negative to Positive</td></tr><tr><td>Original</td><td>great indoor mall .</td><td>Original</td><td>hell no !</td></tr><tr><td>ARAE</td><td>no smoking mall.</td><td>ARAE</td><td>hell great!</td></tr><tr><td>Cross-AE</td><td>terrible outdoor urine .</td><td>Cross-AE</td><td>incredible pork !</td></tr><tr><td>Original</td><td>great blooming onion.</td><td>Original</td><td>highly disappointed !</td></tr><tr><td>ARAE</td><td>no receipt onion .</td><td>ARAE</td><td>highly recommended !</td></tr><tr><td>Cross-AE</td><td>terrible of pie .</td><td>Cross-AE</td><td>highly clean !</td></tr><tr><td>Original</td><td>i really enjoyed getting my nails done by peter .</td><td>Original</td><td>bad products .</td></tr><tr><td>ARAE</td><td>i really needed geting my nails done by now .</td><td>ARAE</td><td>good products .</td></tr><tr><td>Cross-AE</td><td>i really really told my nails done with these things .</td><td>Cross-AE</td><td>good prices .</td></tr><tr><td>Original</td><td>definitely a great choice for sushi in las vegas !</td><td>Original</td><td>i was so very disappointed today at lunch .</td></tr><tr><td>ARAE</td><td>definitely a_num_star rating for_num_sushi in las vegas .</td><td>ARAE</td><td>i highly recommend this place today .</td></tr><tr><td>Cross-AE</td><td>not a great choice for breakfast in las vegas vegas !</td><td>Cross-AE</td><td>i was so very pleased to this</td></tr><tr><td>Original</td><td>the best piece of meat i have ever had !</td><td>Original</td><td>i have n&#x27;t received any response to anything.</td></tr><tr><td>ARAE</td><td>the worst piece of meat i have ever been to !</td><td>ARAE</td><td>i have n&#x27;t received any problems to please.</td></tr><tr><td>Cross-AE</td><td>the worst part of that i have ever had had !</td><td>Cross-AE</td><td>i have always the desert vet.</td></tr><tr><td>Original</td><td>really good food,super casual and really friendly</td><td>Original</td><td>all the fixes were minor and the bill ?</td></tr><tr><td>ARAE</td><td>really bad food,really generally really low and decent food.</td><td>ARAE</td><td>all the barbers were entertaining and the bill did n&#x27;t disappoint .</td></tr><tr><td>Cross-AE</td><td>really good food,super horrible and not the price .</td><td>Cross-AE</td><td>all the flavors were especially and one !</td></tr><tr><td>Original</td><td>it has a great atmosphere,with wonderful service .</td><td>Original</td><td>small,smokey,dark and rude management .</td></tr><tr><td>ARAE</td><td>it has no taste ,with a complete jerk .</td><td>ARAE</td><td>small,intimate ,and cozy friendly staff .</td></tr><tr><td>Cross-AE</td><td>it has a great horrible food and run out service .</td><td>Cross-AE</td><td>great,,,chips and wine.</td></tr><tr><td>Original</td><td>their menu is extensive ,even have italian food .</td><td>Original</td><td>the restaurant did n&#x27;t meet our standard though .</td></tr><tr><td>ARAE</td><td>their menu is limited,even if i have an option .</td><td>ARAE</td><td>the restaurant did n&#x27;t disappoint our expectations though .</td></tr><tr><td>Cross-AE</td><td>their menu is decent ,i have gotten italian food</td><td>Cross-AE</td><td>the restaurant is always happy and knowledge .</td></tr><tr><td>Original</td><td>everyone who works there is incredibly friendly as well</td><td>Original</td><td>you could not see the stage at all !</td></tr><tr><td>ARAE</td><td>everyone who works there is incredibly rude as well</td><td>ARAE</td><td>you could see the difference at the counter !</td></tr><tr><td>Cross-AE</td><td>everyone who works there is extremely clean and as well .</td><td>Cross-AE</td><td>you could definitely get the fuss !</td></tr><tr><td>Original</td><td>there are a couple decent places to drink and eat in here as well .</td><td>Original</td><td>room is void of all personality,no pictures or any sort of decorations .</td></tr><tr><td>ARAE</td><td>there are a couple slices of options and _num_wings in the place .</td><td>ARAE</td><td>room is eclectic,lots of flavor and all of the best .</td></tr><tr><td>Cross-AE</td><td>there are a few night places to eat the car here are a crowd .</td><td>Cross-AE</td><td>it&#x27;s a nice that amazing,that one &#x27;s some of flavor .</td></tr><tr><td>Original</td><td>if you &#x27;re in the mood to be adventurous ,this is your place !</td><td>Original</td><td>waited in line to see how long a wait would be for three people .</td></tr><tr><td>ARAE</td><td>if you &#x27;re in the mood to be disappointed,this is not the place . if you &#x27;re in the drive to the work,this is my place !</td><td>ARAE</td><td>waited in line for a long wait and totally worth it.</td></tr><tr><td>Cross-AE</td><td></td><td>Cross-AE</td><td>another great job to see and a lot going to be from dinner .</td></tr><tr><td>Original</td><td>we came on the recommendation of a bell boy and the food was amazing .</td><td>Original</td><td>the people who ordered off the menu did n&#x27;t seem to do much better .</td></tr><tr><td>Cross-AE</td><td>we came on the recommendation and the food was a joke.</td><td>ARAE</td><td>the people who work there are super friendly and the menu is good .</td></tr><tr><td>Cross-AE</td><td>we went on the car of the time and the chicken was awful .</td><td>Cross-AE</td><td>the place,one of the office is always worth you do a business .</td></tr><tr><td>Original</td><td>service is good but not quick,just enjoy the wine and your company .</td><td>Original</td><td>they told us in the beginning to make sure they do n&#x27;teat anything .</td></tr><tr><td>ARAE</td><td>service is good but not quick,but the service is horrible .</td><td>ARAE</td><td>they told us in the mood to make sure they do great food</td></tr><tr><td>Cross-AE</td><td>service is good,and horrible,is the same and worst time ever .</td><td>Cross-AE</td><td>they &#x27;re us in the next for us as you do n&#x27;t eat.</td></tr><tr><td>Original</td><td>the steak was really juicy with my side of salsa to balance the flavor .</td><td>Original</td><td>the person who was teaching me how to control my horse was pretty rude .</td></tr><tr><td>ARAE</td><td>the steak was really bland with the sauce and mashed potatoes .</td><td>ARAE</td><td>the person who was able to give me a pretty good price .</td></tr><tr><td>Cross-AE</td><td>the fish was so much,the most of sauce had got the flavor .</td><td>Cross-AE</td><td>the owner &#x27;s was gorgeous when i had a table and was friendly .</td></tr><tr><td>Original</td><td>other than that one hell hole of a star bucks they ‘re all great !</td><td>Original</td><td>he was cleaning the table next to us with gloves on and a rag .</td></tr><tr><td>ARAE</td><td>other than that one star rating the toilet they ‘re not allowed .</td><td>ARAE</td><td>he was prompt and patient with us and the staff is awesome .</td></tr><tr><td>Cross-AE</td><td>a wonder our one came in a_num_months,you &#x27;re so better !</td><td>Cross-AE</td><td>he was like the only thing to get some with with my hair .</td></tr></table>
348
+
349
+ # YAHOO TRANSFER
350
+
351
+ Table 7: Full sheet of Yahoo titles transfer result
352
+
353
+ <table><tr><td></td><td>from Science</td><td></td><td>from Music</td><td></td><td>from Politics</td></tr><tr><td>Original</td><td>what is an event horizon with regards to black holes ?</td><td>Original</td><td>do you know a website that you can find people who want to join bands ?</td><td>Original</td><td>republicans :would you vote for a cheney /satan ticket in 2008 ?</td></tr><tr><td>Music</td><td>what is your favorite sitcom with adam sandler ?</td><td>Science</td><td>do you know a website that can help me with sci- ence?</td><td>Science</td><td>guys : how would you solve this question ?</td></tr><tr><td>Politics</td><td>what is an event with black people ?</td><td>Politics</td><td>do you think that you can find a person who is in prison?</td><td>Music</td><td>guys : would you rather be a good movie ?</td></tr><tr><td>Original</td><td>what did john paul jones do in the american revo- lution ?</td><td>Original</td><td>do people who quote entire poems or song lyrics ever actually get chosen best answer ?</td><td>Original</td><td>if i move to the usa do ilose my pension in canada ?</td></tr><tr><td>Music</td><td>what did john lennon do in the new york family ?</td><td>Science</td><td>do you think that scientists learn about human anatomy and physiology of life ?</td><td>Science</td><td>if i move the &lt;unk&gt; in the airi have to do my math homework ?</td></tr><tr><td>Politics</td><td>what did john mccain do in the next election ?</td><td>Politics</td><td>do people who knows anything about the recent issue of &lt;unk&gt; leadership ?</td><td>Music</td><td>if i move to the music do you thinkifeel better ?</td></tr><tr><td>Original</td><td>can anybody suggest a good topic for a statistical survey?</td><td>Original</td><td>from big brother,what is the girls name who had &lt;unk&gt; in her apt ?</td><td>Original</td><td>what is your reflection on what will be our organi- zations in the future ?</td></tr><tr><td>Music</td><td>can anybody suggest a good site fora techno ?</td><td>Science</td><td>in big bang what is the&lt;unk&gt;of &lt;unk&gt;,what is the difference between &lt;unk&gt; and &lt;unk&gt; ?</td><td>Science</td><td>what is your opinion on what will be the future in our future ?</td></tr><tr><td>Politics</td><td>can anybody suggest a good topic for a student visa ��</td><td>Politics</td><td>is big brother in the &lt;unk&gt; what do you think of her ?</td><td>Music</td><td>what is your favorite music videos on the may i find ?</td></tr><tr><td>Original</td><td>can a kidney infection effect a woman &amp;apos;s &lt;unk&gt;cycle ?</td><td>Original</td><td>where is the tickets for the filming of the suite life of zack and cody ?</td><td>Original</td><td>wouldn &amp;apos;t it be fun if we the people veto or passed bills ?</td></tr><tr><td>Music</td><td>can anyone give me a good film &lt;unk&gt; ?</td><td>Science</td><td>where is the best place of the blood stream for the production of the cell ?</td><td>Science</td><td>isnt it possible to be cloned if we put the moon or it?</td></tr><tr><td>Politics</td><td>can a landlord officer have a &lt;unk&gt; &lt;unk&gt; ?</td><td>Politics</td><td>where is the best place of the navy and the senate of the union ?</td><td>Music</td><td>isnt it possible or if we &amp;apos;re getting married ?</td></tr><tr><td>Original</td><td>where does the term &amp;quot;sweating &lt;unk&gt; &amp;quot; come from ?</td><td>Original</td><td>the &lt;unk&gt; singers was a band in 1963 who had a hit called &lt;unk&gt; man ?</td><td>Original</td><td>can anyone tell me how icould go about interview- ing north vietnamese soldiers ?</td></tr><tr><td>Music</td><td>where does the term &amp;quot; &lt;unk&gt; &amp;quot; come from ?</td><td>Science</td><td>the &lt;unk&gt;river in a &lt;unk&gt; was created by a &lt;unk&gt; who was born in the last century ?</td><td>Science</td><td>can anyone tell me how i could find how to build a robot ?</td></tr><tr><td>Politics</td><td>where does the term &amp;quot; &lt;unk&gt; &amp;quot; come from?</td><td>Politics</td><td>the &lt;unk&gt; are &lt;unk&gt; in a &lt;unk&gt; who was shot an &lt;unk&gt;?</td><td>Music</td><td>can anyone tell me how i could find out about my parents ?</td></tr><tr><td>Original</td><td>what other &lt;unk&gt; sources are there than burning fossil fuels.</td><td>Original</td><td>what is the first metal band in the early 6O &amp;apos;s ...?????</td><td>Original</td><td>if the us did not exist would the world be a better place?</td></tr><tr><td>Music</td><td>what other &lt;unk&gt; are /who are the greatest gui- tarist currently on tv today ?</td><td>Science</td><td>what is the first country in the universe ?</td><td>Science</td><td>if the world did not exist,would it be possible ?</td></tr><tr><td>Politics</td><td>what other &lt;unk&gt; are there for veterans who lives ?</td><td>Politics</td><td>who is the first president in the usa ???????? ????????????????</td><td>Music</td><td>if you could not have a thing who would it be ?</td></tr></table>
354
+
355
+ Table 8: Full sheet of Yahoo answers transfer result
356
+
357
+ <table><tr><td></td><td>from Science</td><td></td><td>from Music</td><td></td><td>from Politics</td></tr><tr><td>Original</td><td>take lml of hcl(concentrated )and dilute it to 50ml.</td><td>Original</td><td>all three are fabulous artists,with just incredible talent!!</td><td>Original</td><td>4 years of an idiot in office +electing the idiot again=?</td></tr><tr><td>Music</td><td>take em to you and shout it to me</td><td>Science</td><td>all three are genetically bonded with water ,but just as many substances,are capable of producing</td><td>Science</td><td>4 years of an idiot in the office of science ?</td></tr><tr><td>Politics</td><td>take bribes to islam and it will be punished .</td><td>Politics</td><td>a special case. all three are competing with the government,just as far as i can.</td><td>Music</td><td>4 )&lt;unk&gt; in an idiot ,the idiot is the best of the two points ever !</td></tr><tr><td>Original</td><td>oils do not do this,they do not &amp;quot; set &amp;quot;</td><td>Original</td><td>she ,too ,wondered about the underwear outside</td><td>Original</td><td>send me $10o and i &amp;apos;ll send you a copy</td></tr><tr><td>Music</td><td>cucumbers do not do this ,they do not &amp;quot; do</td><td>Science</td><td>the clothes . she,too,i know,the clothes outside the clothes .</td><td>Science</td><td>honest . send me an email andi &amp;apos;ll send you a copy.</td></tr><tr><td>Politics</td><td>&amp;quot;. corporations do not do this,but they do not.</td><td>Politics</td><td>she,too,ithink that the cops are theonly thing about the outside of the u.s..</td><td>Music</td><td>send me $10o andi &amp;apos;ll send you a copy.</td></tr><tr><td>Original</td><td>the average high tempsin jan and feb are about 48</td><td>Original</td><td>i like rammstein and idon &amp;apos;t speak or under-</td><td>Original</td><td>wills can be &lt;unk&gt;,or typed and signed without</td></tr><tr><td>Music</td><td>deg. the average high school in seattle and is about 15</td><td>Science</td><td>stand german. i like googling and i don &amp;apos;t understand or</td><td>Science</td><td>needing an attorney . euler can be &lt;unk&gt;,and without any type of op-</td></tr><tr><td>Politics</td><td>minutes . the average high infantry division is in afghanistan and alaska.</td><td>Politics</td><td>speak. i like mccain and idon &amp;apos;t care about it .</td><td>Music</td><td>erations,or &lt;unk&gt;. madonna can be &lt;unk&gt;,and signed without open- ing or &lt;unk&gt;.</td></tr><tr><td>Original</td><td>the light from you lamps would move away from</td><td>Original</td><td>mark is great,but the guest hosts were cool too !</td><td>Original</td><td>hungary:20 january 1945,(formerly a member</td></tr><tr><td>Music</td><td>you at light speed the light from you tube would move away from</td><td>Science</td><td>mark is great,but the water will be too busy for</td><td>Science</td><td>of the axis) nh3 :20 january,78(a)</td></tr><tr><td>Politics</td><td>you the light from you could go away from your state</td><td>Politics</td><td>the same reason. mark twain,but the great lakes ,the united states of america is too busy.</td><td>Music</td><td>1966 - 20 january 1961(a)1983 song</td></tr><tr><td>Original</td><td>van &lt;unk&gt;,on the other hand,had some serious</td><td>Original</td><td>they all offer terrific information about the cast</td><td>Original</td><td>bulgaria: 8 september 1944,(formerly a member</td></tr><tr><td>Music</td><td>issues ... van &lt;unk&gt; on the other hand,had some serious</td><td>Science</td><td>and characters,. they all offer insight about the characteristics of</td><td>Science</td><td>of the axis) moreover,83+(x+7)(x2)=(a2)</td></tr><tr><td>Politics</td><td>issues. van &lt;unk&gt;,on the other hand ,had some serious issues.</td><td>Politics</td><td>the earth,and are composed of many stars. they all offer legitimate information about the in- vasion of iraq and the u.s.,and all aspects of his-</td><td>Music</td><td>harrison :8 september 1961(a)(1995)</td></tr><tr><td>Original</td><td> just multiply the numerator of one fraction by that</td><td>Original</td><td>tory. but there are so many more i can &amp;apos;t think of</td><td>Original</td><td>anyone who doesnt have a billion dollars for all</td></tr><tr><td>Music</td><td>of the other . just multiply the fraction of the other one that</td><td>Science</td><td>! but there are so many more of the number of ques-</td><td>Science</td><td>the publicity cant win . anyone who doesnt have a decent chance is the</td></tr><tr><td>Politics</td><td>&amp;apos;s just like it . just multiply the same fraction of other countries .</td><td>Politics</td><td>tions. but there are so many more of the can i think of</td><td>Music</td><td>same for all the other. anyone who doesnt have a lot of the show for the</td></tr><tr><td>Original</td><td>civil engineering is still an umbrella field com-</td><td>Original</td><td>today. i love zach he is sooo sweet in his own way !</td><td>Original</td><td>publicity. the theory is that cats don &amp;apos;t take to being</td></tr><tr><td>Music</td><td>prised of many related specialties . civil rights is still an art union .</td><td>Science</td><td>the answer is he &amp;apos;s definitely in his own way</td><td>Science</td><td>tied up but thats &lt;unk&gt;. the theory is that cats don &amp;apos;t grow up to</td></tr><tr><td>Politics</td><td>civil law is still an issue .</td><td>Politics</td><td>i love letting he is sooo smart in his own way </td><td>Music</td><td>&lt;unk&gt;. the theory is that dumb but don &amp;apos;t play</td></tr><tr><td>Original</td><td>h2o2(hydrogen peroxide ) naturally decomposes</td><td>Original</td><td>remember the industry is very shady so keep your</td><td>Original</td><td>&lt;unk&gt; to &lt;unk&gt;. the fear they are trying to instill in the common</td></tr><tr><td>Music</td><td>to form o2 and water . jackieand brad pittboth great albums and they are</td><td>Science</td><td>eyes open ! remember the amount of water is so very impor-</td><td>Science</td><td>man is based on what ? the fear they are trying to find the common ances-</td></tr><tr><td>Politics</td><td>my fav. kennedy and blair hate america to invade them.</td><td>Politics</td><td>tant. remember the amount of time the politicians are</td><td>Music</td><td>tor in the world . the fear theyare trying to find out what is wrong</td></tr><tr><td>Original</td><td>the quieter it gets ,the more white noise you can</td><td>Original</td><td>open your mind . but can you fake it,for just one more show ?</td><td>Original</td><td>in the song. think about how much planning and people would</td></tr><tr><td>Music</td><td>here. the fray it gets,the more you can hear.</td><td>Science</td><td>but can you fake it,just for more than one ?</td><td>Science</td><td>have to be involved in what happened. think about how much time would you have to do</td></tr><tr><td>Politics</td><td>the gop gets it,the more you can here .</td><td>Politics</td><td>but can you fake it for more than one ?</td><td>Music</td><td>think about how much money and what would be &lt;unk&gt; about in the world ?</td></tr><tr><td>Original</td><td>h2co3(carbonic acid ) naturally decomposes to</td><td>Original</td><td>i am going to introduce you to the internet movie</td><td>Original</td><td>this restricts the availability of cash to them and</td></tr><tr><td>Music</td><td>form water and co2. phoebe and jack ,he &amp;apos;s gorgeous and she</td><td>Science</td><td>database. i am going to investigate the internet to google.</td><td>Science</td><td>other countries too start banning them . this reduces the intake of the other molecules to</td></tr><tr><td>Politics</td><td>loves to get him ! nixon(captured)he lied and voted for bush to cause his country .</td><td>Politics</td><td>i am going to skip the internet to get you checked</td><td>Music</td><td>produce them and thus are too large . this is the cheapest package of them too.</td></tr></table>
358
+
359
+ # 10 APPENDIX: SAMPLE GENERATIONS
360
+
361
+ # ARAE-GAN Samples
362
+
363
+ # AE Samples
364
+
365
+ # LM Samples
366
+
367
+ A woman preparing three fish .
368
+ A woman is seeing a man in the river .
369
+ There passes a woman near birds in the air .
370
+ Some ten people is sitting through their office .
371
+ The man got stolen with young dinner bag .
372
+ Monks are running in court .
373
+ The Two boys in glasses are all girl .
374
+ The man is small sitting in two men that tell a children .
375
+ The two children are eating the balloon animal .
376
+ A woman is trying on a microscope .
377
+ The dogs are sleeping in bed . Two Three woman in a cart tearing over of a tree A man is hugging and art .
378
+ The fancy skier is starting under the drag cup in . A dog are <unk> a
379
+ A man is not standing .
380
+ The Boys in their swimming .
381
+ A surfer and a couple waiting for a show .
382
+ A couple is a kids at a barbecue .
383
+ The motorcycles is in the ocean loading
384
+ I ’s bike is on empty
385
+ The actor was walking in a a small dog area . no dog is young their mother a man walking outside on a dirt road , sitting on the dock .
386
+ A large group of people is taking a photo for Christmas and at night .
387
+ Someone is avoiding a soccer game .
388
+ The man and woman are dressed for a movie .
389
+ Person in an empty stadium pointing at a mountain . Two children and a little boy are <unk> a man in a blue shirt .
390
+ A boy rides a bicycle .
391
+ A girl is running another in the forest .
392
+ the man is an indian women .
393
+
394
+ # 11 APPENDIX: VECTOR ARITHMETIC
395
+
396
+ We generate 1 million sentences from the ARAE-GAN and parse the sentences to obtain the main verb, subject, and modifier. Then for a given sentence, to change the main verb we subtract the mean latent vector (t) for all other sentences with the same main verb (in the first example in Figure 4 this would correspond to all sentences that had “sleeping” as the main verb) and add the mean latent vector for all sentences that have the desired transformation (with the running example this would be all sentences whose main verb was “walking”). We do the same to transform the subject and the modifier. We decode back into sentence space with the transformed latent vector via sampling from $p _ { \psi } ( g ( \mathbf { z + t } ) )$ . Some examples of successful transformations are shown in Figure 4 (right). Quantitative evaluation of the success of the vector transformations is given in Figure 4 (left). For each original vector $\mathbf { z }$ we sample 100 sentences from $p _ { \psi } ( g ( \mathbf { z } + \mathbf { t } ) )$ over the transformed new latent vector and consider it a match if any of the sentences demonstrate the desired transformation. Match $\%$ is proportion of original vectors that yield a match post transformation. As we ideally want the generated samples to only differ in the specified transformation, we also calculate the average word precision against the original sentence (Prec) for any match.
397
+
398
+ # 12 APPENDIX: EXPERIMENTAL DETAILS
399
+
400
+ MNIST EXPERIMENTS
401
+
402
+ • The encoder is a three-layer MLP, $7 8 4 - 8 0 0 - 4 0 0 - 1 0 0$ .
403
+ • Additive Gaussian noise is added into c which is then fed into the decoder. The standard deviation of that noise is initialized to be 0.4, and then exponentially decayed to 0.
404
+ • The decoder is a four-layer MLP, $1 0 0 - 4 0 0 - 8 0 0 - 1 0 0 0 - 7 8 4$
405
+ • The autoencoder is optimized by Adam, with learning rate $5 \mathrm { e } { - } 0 4$ .
406
+ • An MLP generator $3 2 - 6 4 - 1 0 0 - 1 5 0 - 1 0 0$ , using batch normalization, and ReLU nonlinearity.
407
+ An MLP critic $1 0 0 { - } 1 0 0 { - } 6 0 { - } 2 0 { - } 1$ with weight clipping $\epsilon = 0 . 0 5$ . The critic is trained by 10 iterations within each GAN loop.
408
+ • Both components of GAN is optimized by Adam, with learning rate $5 \mathrm { e } ^ { - 0 4 }$ on the generator, and $5 \mathrm { e } \mathrm { - } 0 5$ on the critic.
409
+ • Weighing factor $\lambda ^ { ( 1 ) } = 0 . 2$ .
410
+
411
+ # TEXT EXPERIMENTS
412
+
413
+ • The encoder is an one-layer LSTM with 300 hidden units.
414
+ • Gaussian noise into c before feeding it into the decoder. The standard deviation of that noise is initialized to be 0.2, and then exponentially decayed every 100 iterations by a factor of 0.995.
415
+ • The decoder is a one-layer LSTM with 300 hidden units.
416
+ • The decoding process at each time step takes the top layer LSTM hidden state and concatenates it with the hidden codes c, before feeding them into the output (i.e. vocabulary projection) and the softmax layer. The word embedding is of size 300.
417
+ • We adopt a grad clipping on the encoder/decoder, with max grad_norm $= 1$ .
418
+ • The encoder/decoder is optimized by vanilla SGD with learning rate 1.
419
+ • An MLP generator $1 0 0 { - } 3 0 0 { - } 3 0 0$ , using batch normalization, and ReLU non-linearity.
420
+ • An MLP critic $3 0 0 { - } 3 0 0 { - } 1$ with weight clipping $\epsilon = 0 . 0 1$ . The critic is trained by 5 iterations within each GAN loop.
421
+ • Both components of GAN are optimized by Adam, with learning rate $5 \mathrm { e } \mathrm { - } 0 5$ on the generator, and $\mathtt { 1 e - 0 5 }$ on the critic.
422
+ • We increment the number of GAN training $\log ^ { 3 }$ by 1 (it initially is set to 1) , respectively at the beginning of epoch #2, epoch $\# 4$ and epoch #6.
423
+
424
+ # SEMI-SUPERVISED EXPERIMENTS
425
+
426
+ Similar to the SNLI generation experiment setup, with the following changes:
427
+
428
+ • We employ larger network to GAN components: MLP generator $1 0 0 - 1 5 0 - 3 0 0 - 5 0 0$ and MLP critic $5 0 0 - 5 0 0 - 1 5 0 - 8 0 - 2 0 - 1$ with weight clipping factor $\epsilon = 0 . 0 2$ . The critic is trained by 10 iterations within each GAN loop.
429
+
430
+ # YELP/YAHOO TRANSFER
431
+
432
+ Similar to the SNLI setup, with the following changes
433
+
434
+ • The encoder and decoder size are both increased to 500 hidden units.
435
+ The style adversarial classifier is an MLP with structure $3 0 0 { - } 2 0 0 { - } 1 0 0$ , with learning rate 0.1 trained with SGD.
436
+ • We employ both larger generator and discriminator architectures in GAN: generator $2 0 0 { - } 4 0 0 { - } 8 0 0$ with $z$ dim being set to 64; discriminator $3 0 0 { - } 1 6 0 { - } 8 0 { - } 2 0$ .
437
+ • Weighing factor for critic gradient $\lambda _ { a } ^ { ( 1 ) } = 1$ , $\lambda _ { b } ^ { ( 1 ) } = 1 0$ .
438
+ • No GAN loop scheduling is employed here.
md/train/Bklfsi0cKm/Bklfsi0cKm.md ADDED
@@ -0,0 +1,436 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DEEP CONVOLUTIONAL NETWORKS AS SHALLOW GAUSSIAN PROCESSES
2
+
3
+ Adrià Garriga-Alonso department of Engineering University of Cambridge ag919@cam.ac.uk
4
+
5
+ Laurence Aitchison
6
+ Department of Engineering
7
+ University of Cambridge
8
+ laurence.aitchison@gmail.com
9
+
10
+ # ABSTRACT
11
+
12
+ We show that the output of a (residual) convolutional neural network (CNN) with an appropriate prior over the weights and biases is a Gaussian process (GP) in the limit of infinitely many convolutional filters, extending similar results for dense networks. For a CNN, the equivalent kernel can be computed exactly and, unlike “deep kernels”, has very few parameters: only the hyperparameters of the original CNN. Further, we show that this kernel has two properties that allow it to be computed efficiently; the cost of evaluating the kernel for a pair of images is similar to a single forward pass through the original CNN with only one filter per layer. The kernel equivalent to a 32-layer ResNet obtains $0 . 8 4 \%$ classification error on MNIST, a new record for GPs with a comparable number of parameters.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Convolutional Neural Networks (CNNs) have powerful pattern-recognition capabilities that have recently given dramatic improvements in important tasks such as image classification (Krizhevsky et al., 2012). However, as CNNs are increasingly being applied in real-world, safety-critical domains, their vulnerability to adversarial examples (Szegedy et al., 2013; Kurakin et al., 2016), and their poor uncertainty estimates are becoming increasingly problematic. Bayesian inference is a theoretically principled and demonstrably successful (Snoek et al., 2012; Deisenroth & Rasmussen, 2011) framework for learning in the face of uncertainty, which may also help to address the problems of adversarial examples (Gal & Smith, 2018). Unfortunately, Bayesian inference in CNNs is extremely difficult due to the very large number of parameters, requiring highly approximate factorised variational approximations (Blundell et al., 2015; Gal & Ghahramani, 2015), or requiring the storage (Lakshminarayanan et al., 2017) of large numbers of posterior samples (Welling & Teh, 2011; Mandt et al., 2017).
17
+
18
+ Other methods such as those based on Gaussian Processes (GPs) are more amenable to Bayesian inference, allowing us to compute the posterior uncertainty exactly (Rasmussen & Williams, 2006). This raises the question of whether it might be possible to combine the pattern-recognition capabilities of CNNs with exact probabilistic computations in GPs. Two such approaches exist in the literature. First, deep convolutional kernels (Wilson et al., 2016) parameterise a GP kernel using the weights and biases of a CNN, which is used to embed the input images into some latent space before computing their similarity. The CNN parameters of the resulting kernel then have to be optimised by gradient descent. However, the large number of kernel parameters in the CNN reintroduces the risk of overconfidence and overfitting. To avoid this risk, we need to infer a posterior over the CNN kernel parameters, which is as difficult as directly inferring a posterior over the parameters of the original CNN. Second, it is possible to define a convolutional GP (van der Wilk et al., 2017) or a deep convolutional GP (Kumar et al., 2018) by defining a GP that takes an image patch as input, and using that GP as a component in a larger CNN-like system. However, inference in such systems is very computationally expensive, at least without the use of potentially severe variational approximations (van der Wilk et al., 2017).
19
+
20
+ An alternative approach is suggested by the underlying connection between Bayesian neural networks (NNs) and GPs. In particular, Neal (1996) showed that the function defined by a single-layer fully-connected NN with infinitely many hidden units, and random independent zero-mean weights and biases is equivalent to a GP, implying that we can do exact Bayesian inference in such a NN by working with the equivalent GP. Recently, this result was extended to arbitrarily deep fullyconnected NNs with infinitely many hidden units at each layer (Lee et al., 2017; Matthews et al., 2018a). However, these fully-connected networks are rarely used in practice, as they are unable to exploit important properties of images such as translational invariance, raising the question of whether state-of-the-art architectures such as CNNs (LeCun et al., 1990) and ResNets (He et al., 2016a) have equivalent GP representations. Here, we answer in the affirmative, giving the GP kernel corresponding to arbitrarily deep CNNs and to (convolutional) residual neural networks (He et al., 2016a). In this case, if each hidden layer has an infinite number of convolutional filters, the network prior is equivalent to a GP.
21
+
22
+ Furthermore, we show that two properties of the GP kernel induced by a CNN allow it to be computed very efficiently. First, in previous work it was necessary to compute the covariance matrix for the output of a single convolutional filter applied at all possible locations within a single image (van der Wilk et al., 2017), which was prohibitively computationally expensive. In contrast, under our prior, the downstream weights are independent with zero-mean, which decorrelates the contribution from each location, and implies that it is necessary only to track the patch variances, and not their covariances. Second, while it is still necessary to compute the variance of the output of a convolutional filter applied at all locations within the image, the specific structure of the kernel induced by the CNN means that the variance at every location can be computed simultaneously and efficiently as a convolution.
23
+
24
+ Finally, we empirically demonstrate the performance increase coming from adding translationinvariant structure to the GP prior. Without computing any gradients, and without augmenting the training set (e.g. using translations), we obtain $0 . 8 4 \%$ error rate on the MNIST classification benchmark, setting a new record for nonparametric GP-based methods.
25
+
26
+ # 2 GP BEHAVIOUR IN A CNN
27
+
28
+ For clarity of exposition, we will treat the case of a 2D convolutional NN. The result applies straightforwardly to $n \mathbf { D }$ convolutions, dilated convolutions and upconvolutions (“deconvolutions”), since they can be represented as linear transformations with tied coefficients (see Fig. 1).
29
+
30
+ # 2.1 A 2D CONVOLUTIONAL NETWORK PRIOR
31
+
32
+ The network takes an arbitrary input image $\mathbf { X }$ of height $H ^ { ( 0 ) }$ and width $D ^ { ( 0 ) }$ , as a $C ^ { ( 0 ) } \times ( H ^ { ( 0 ) } D ^ { ( 0 ) } )$ real matrix. Each row, which we denote $\mathbf { x } _ { 1 } , \mathbf { x } _ { 2 } , \ldots , \mathbf { x } _ { C ^ { ( 0 ) } }$ , corresponds to a channel of the image (e.g. $C ^ { ( 0 ) } = 3$ for RGB), flattened to form a vector. The first activations $\mathbf { A } ^ { ( 1 ) } ( \mathbf { X } )$ are a linear transformation of the inputs. For $i \in \{ 1 , \ldots , C ^ { ( 1 ) } \}$ :
33
+
34
+ $$
35
+ \mathbf { a } _ { i } ^ { ( 1 ) } ( \mathbf { X } ) : = b _ { i } ^ { ( 1 ) } \mathbf { 1 } + \sum _ { j = 1 } ^ { C ^ { ( 0 ) } } \mathbf { W } _ { i , j } ^ { ( 1 ) } \mathbf { x } _ { j } \ .
36
+ $$
37
+
38
+ We consider a network with $L$ hidden layers. The other activations of the network, from $\mathbf { A } ^ { ( 2 ) } ( \mathbf { X } )$ up to $\mathbf { A } ^ { ( L + 1 ) } ( \mathbf { X } )$ , are defined recursively:
39
+
40
+ $$
41
+ \mathbf { a } _ { i } ^ { ( \ell + 1 ) } ( \mathbf { X } ) : = b _ { i } ^ { ( \ell + 1 ) } \mathbf { 1 } + \sum _ { j = 1 } ^ { C ^ { ( \ell ) } } \mathbf { W } _ { i , j } ^ { ( \ell + 1 ) } \phi \left( \mathbf { a } _ { j } ^ { ( \ell ) } ( \mathbf { X } ) \right) .
42
+ $$
43
+
44
+ ![](images/b76e3f5dce59ce270069488ab3ea5f08d6e69a5c74ce89a25358ac556f83a901.jpg)
45
+ Figure 1: The 2D convolution U(i, $\mathbf { U } _ { i , j } ^ { ( 0 ) } * \mathbf { x } _ { j }$ 0)j ∗ xj as the dot product W(0)i,j xj . The blank elements of W(0)i,j are zeros. The µth row of W(0)i,j corresponds to applying the filter to the $\mu$ th convolutional patch of the channel $\mathbf { x } _ { j }$ .
46
+
47
+ The activations $\mathbf { A } ^ { ( \ell ) } ( \mathbf { X } )$ are $C ^ { ( \ell ) } \times ( H ^ { ( \ell ) } D ^ { ( \ell ) } )$ matrices. Each row $\mathbf { a } _ { i } ^ { ( \ell + 1 ) }$ represents the flattened $j$ th channel of the image that results from applying a convolutional filter to $\phi ( \mathbf { A } ^ { ( \ell ) } ( \mathbf { X } ) )$ .
48
+
49
+ and The structure of the pseudo-weight matrices W(\`+1)i,j , depends on the archite and biases or a convolu $b _ { i } ^ { ( \ell + 1 ) }$ , for layer, $i \in \{ 1 , \ldots , C ^ { ( \ell + 1 ) } \}$ $j \in \{ 1 , \ldots , C ^ { ( \ell ) } \}$ $\mathbf { W } _ { i , j } ^ { ( \ell + 1 ) }$ xj represents applying the convolutional filter U(\`+1)i,j to the $j$ th channel. Thus, the elements of each row of where it do W(\`+1) are: 0 where the filter does not apply and the corresponding element of strated in Fig. 1. $\mathbf { U } _ { i , j } ^ { ( \ell + 1 ) }$
50
+
51
+ The outputs of the network are the last activations, $\mathbf { A } ^ { ( L + 1 ) } ( \mathbf { X } )$ . In the classification or regression setting, the outputs are not spatially extended, so we have $H ^ { ( L + 1 ) } = D ^ { ( L + 1 ) } = 1$ , which is equivalent to a fully-connected output layer. In this case, the pseudo-weights W(L+1)i,j only have one row, and the activations $\mathbf { a } _ { i } ^ { ( L + 1 ) }$ are single-element vectors.
52
+
53
+ Finally, we define the prior distribution over functions by making the filters $\mathbf { U } _ { i , j } ^ { ( \ell ) }$ and biases $b _ { i } ^ { ( \ell ) }$ be independent Gaussian random variables (RVs). For each layer $\ell$ , channels $i , j$ and locations within the filter $x , y$ :
54
+
55
+ $$
56
+ U _ { i , j , x , y } ^ { ( \ell ) } \sim \mathcal { N } \left( 0 , \sigma _ { w } ^ { 2 } / C ^ { ( \ell ) } \right) , \qquad b _ { i } ^ { ( \ell ) } \sim \mathcal { N } \left( 0 , \sigma _ { b } ^ { 2 } \right) .
57
+ $$
58
+
59
+ Note that, to keep the activation variance constant, the weight variance is divided by the number of input channels. The weight variance can also be divided by the number of elements of the filter, which makes it equivalent to the NN weight initialisation scheme introduced by He et al. (2016a).
60
+
61
+ # 2.2 ARGUMENT FOR GP BEHAVIOUR
62
+
63
+ We follow the proofs by Lee et al. (2017) and Matthews et al. (2018a) to show that the output of the CNN described in the previous section, $\mathbf { A } ^ { ( L + 1 ) }$ , defines a GP indexed by the inputs, $\mathbf { X }$ . Their proof (Lee et al., 2017) proceeds by applying the multivariate Central Limit Theorem (CLT) to each layer in sequence, i.e. taking the limit as $N ^ { ( 1 ) } \infty$ , then $N ^ { ( 2 ) } \infty$ etc, where $N ^ { ( \ell ) }$ is the number of hidden units in layer $\ell$ . By analogy, we sequentially apply the multivariate CLT by taking the limit as the number of channels goes to infinity, i.e. $\dot { C ^ { ( 1 ) } } \stackrel { - } { } \infty$ , then $C ^ { ( 2 ) } \infty$ etc. While this is the simplest approach to taking the limits, other potentially more realistic approaches also exist (Matthews et al., 2018a).
64
+
65
+ The fundamental quantity we consider is a vector formed by concatenating the feature maps (or equivalently channels), ${ \bf a } _ { j } ^ { ( \ell ) } ( { \bf X } )$ and $\mathbf { a } _ { j } ^ { ( \ell ) } ( \mathbf { X } ^ { \prime } )$ from data points $\mathbf { X }$ and $\mathbf { X } ^ { \prime }$ ,
66
+
67
+ $$
68
+ \begin{array} { r } { { \bf a } _ { i } ^ { ( \ell ) } ( { \bf X } , { \bf X } ^ { \prime } ) = \left( { \bf a } _ { i } ^ { ( \ell ) } ( { \bf X } ) \right) . } \end{array}
69
+ $$
70
+
71
+ This quantity (and the following arguments) can all be extended to the case of countably finite numbers of input points.
72
+
73
+ Induction base case. For any pair of data points, $\mathbf { X }$ and $\mathbf { X } ^ { \prime }$ the feature-maps corresponding to the $j$ th channel, $\mathbf { a } _ { j } ^ { ( 1 ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } )$ have a multivariate Gaussian joint distribution. This is because each element is a linear combination of shared Gaussian random variables: the biases, ${ \bf b } _ { j } ^ { ( 0 ) }$ and the filters, $\mathbf { U } _ { j , : } ^ { ( 0 ) }$ . Following Eq. (1),
74
+
75
+ $$
76
+ \mathbf { a } _ { i } ^ { ( 1 ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) = b _ { i } ^ { ( 1 ) } \mathbf { 1 } + \sum _ { i = 1 } ^ { C ^ { ( 0 ) } } \left( \begin{array} { c c } { \mathbf { W } _ { i , j } ^ { ( 1 ) } } & { \mathbf { 0 } } \\ { \mathbf { 0 } } & { \mathbf { W } _ { i , j } ^ { ( 1 ) } } \end{array} \right) \left( \begin{array} { c } { \mathbf { x } _ { i } } \\ { \mathbf { x } _ { i } ^ { \prime } } \end{array} \right) ,
77
+ $$
78
+
79
+ where 1 is a vector of all-ones. While the elements within a feature map display strong correlations, different feature maps are independent and identically distributed (iid) conditioned on the data (i.e. $\mathbf { a } _ { i } ^ { ( 1 ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } )$ and $\mathbf { a } _ { i ^ { \prime } } ^ { ( \mathrm { i } ) } ( \mathbf { X } , \mathbf { X ^ { \prime } } )$ are iid for $i \neq i ^ { \prime }$ ), because the parameters for different feature-maps (i.e. the biases, $b _ { i } ^ { ( 1 ) }$ and the filters, $\mathbf { W } _ { i , : } ^ { ( 1 ) }$ ) are themselves iid.
80
+
81
+ Induction step. Consider the feature maps at the \`th layer, $\mathbf { a } _ { j } ^ { ( \ell ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } )$ , to be iid multivariate Gaussian RVs (i.e. for $j \neq j ^ { \prime }$ , $\mathbf { a } _ { j } ^ { ( \ell ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } )$ and $\mathbf { a } _ { j ^ { \prime } } ^ { ( \ell ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } )$ are iid). Our goal is to show that, taking the number of channels at layer $\ell$ to infinity (i.e. $C ^ { ( \ell ) } \to \infty ^ { \cdot }$ ), the same properties hold at the next layer (i.e. all feature maps, a(\`+1)i (X, X0), are iid multivariate Gaussian RVs). Writing eq. (2) for two training examples, $\mathbf { X }$ and $\mathbf { X } ^ { \prime }$ , we obtain,
82
+
83
+ $$
84
+ \mathbf { a } _ { i } ^ { ( \ell + 1 ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) = b _ { i } ^ { ( \ell + 1 ) } \mathbf { 1 } + \sum _ { j = 1 } ^ { C ^ { ( \ell ) } } \left( \begin{array} { c c } { \mathbf { W } _ { i , j } ^ { ( \ell + 1 ) } } & { \mathbf { 0 } } \\ { \mathbf { 0 } } & { \mathbf { W } _ { i , j } ^ { ( \ell + 1 ) } } \end{array} \right) \phi ( \mathbf { a } _ { j } ^ { ( \ell ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) )
85
+ $$
86
+
87
+ We begin by showing that $\mathbf { a } _ { i } ^ { ( \ell + 1 ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } )$ is a multivariate Gaussian RV. The first term is multivariate Gaussian, as it is a linear function of $b _ { i } ^ { ( \ell + 1 ) }$ , which is itself iid Gaussian. We can apply the multivariate CLT to show that the second term is also Gaussian, because, in the limit as $C ^ { ( \ell ) } \to \infty$ , it is the sum of infinitely many iid terms: $\mathbf { a } _ { j } ^ { ( \ell ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } )$ are iid by assumption, and $\mathbf { W } _ { i , j } ^ { ( \ell + 1 ) }$ are iid by definition. Note that the same argument applies to all feature maps jointly, so all elements of $\mathbf { A } ^ { ( \ell + 1 ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } )$ (defined by analogy with eq. 4) are jointly multivariate Gaussian.
88
+
89
+ Following Lee et al. (2017), to complete the argument, we need to show that the output feature maps are iid, i.e. $\mathbf { a } _ { i } ^ { ( \ell + 1 ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } )$ )(X, X0) and a(\`i0 $\mathbf { a } _ { i ^ { \prime } } ^ { ( \ell + 1 ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } )$ are iid for $i \neq i ^ { \prime }$ . They are identically distributed, re as b(\`+1) a nd r tha $\mathbf { W } _ { i , j } ^ { ( \ell + 1 ) }$ and and $\phi ( \mathbf { a } _ { j } ^ { ( \ell ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) )$ is shared. To show that they are independent,are jointly Gaussian, so it is sufficient to show $\mathbf { a } _ { i } ^ { ( \ell + 1 ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } )$ $\mathbf { a } _ { i ^ { \prime } } ^ { ( \ell + 1 ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } )$
90
+ that they are uncorrelated, and we can show that they are uncorrelated because the weights, $\mathbf { W } _ { i , j } ^ { ( \ell + 1 ) }$ are independent with zero-mean, eliminating any correlations that might arise through the shared RV, $\phi ( \mathbf { a } _ { j } ^ { ( \ell ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) )$ . In the appendix, we consider the more complex case where we take limits simultaneously.
91
+
92
+ # 3 THE CONVNET AND RESNET KERNELS
93
+
94
+ Here we derive a computationally efficient kernel corresponding to the CNN described in the previous section. It is surprising that we can compute the kernel efficiently because the feature maps, ${ \bf a } _ { i } ^ { ( \ell ) } ( { \bf X } )$ , display rich covariance structure due to the shared convolutional filter. Computing and representing these covariances would be prohibitively computationally expensive. However, in many cases we only need the variance of the output, e.g. in the case of classification or regression with a final dense layer. It turns out that this propagates backwards through the convolutional network, implying that for every layer, we only need the “diagonal covariance” of the activations: the covariance between the corresponding elements of ${ \bf a } _ { j } ^ { ( \ell ) } ( { \bf X } )$ and $\mathbf { a } _ { j } ^ { ( \ell ) } ( \mathbf { X } ^ { \prime } )$ (i.e. $\mathrm { d i a g } \left( \mathbb { C } \left[ \mathbf { a } _ { j } ^ { ( \ell ) } ( \mathbf { X } ) , \mathbf { a } _ { j } ^ { ( \ell ) } ( \mathbf { X } ^ { \prime } ) \right] \right) )$ .
95
+
96
+ # 3.1 GP MEAN AND COVARIANCE
97
+
98
+ A GP is completely specified by its mean and covariance (kernel) functions. These give the parameters of the joint Gaussian distribution of the RVs indexed by any two inputs, $\mathbf { X }$ and $\mathbf { X } ^ { \prime }$ . For the purposes of computing the mean and covariance, it is easiest to consider the network as being written entirely in index notation,
99
+
100
+ $$
101
+ A _ { i , \mu } ^ { ( \ell + 1 ) } ( \mathbf { X } ) = b _ { i } ^ { ( \ell + 1 ) } + \sum _ { j = 1 } ^ { C ^ { ( \ell ) } } \sum _ { \nu = 1 } ^ { H ^ { ( \ell ) } D ^ { ( \ell ) } } W _ { i , j , \mu , \nu } ^ { ( \ell + 1 ) } \phi ( A _ { j , \nu } ^ { ( \ell ) } ( \mathbf { X } ) ) .
102
+ $$
103
+
104
+ where $\ell$ and $\ell + 1$ denote the input and output layers respectively, $j$ and $i \in \{ 1 , \ldots , C ^ { ( \ell + 1 ) } \}$ denote the input and output channels, and $\nu$ and $\mu \in \{ 1 , \ldots , H ^ { ( \ell + 1 ) } D ^ { ( \ell + 1 ) } \}$ denote the location within the input and output channel or feature-maps.
105
+
106
+ The mean function is thus easy to compute
107
+
108
+ $$
109
+ \mathbb { E } \left[ A _ { i , \mu } ^ { ( \ell + 1 ) } ( \mathbf { X } ) \right] = \mathbb { E } \left[ b _ { i } ^ { ( \ell + 1 ) } \right] + \sum _ { j = 1 } ^ { C ^ { ( \ell ) } } \sum _ { \nu = 1 } ^ { H ^ { ( \ell ) } D ^ { ( \ell ) } } \mathbb { E } \left[ W _ { i , j , \mu , \nu } ^ { ( \ell + 1 ) } \phi ( A _ { j , \nu } ^ { ( \ell ) } ( \mathbf { X } ) ) \right] = 0 .
110
+ $$
111
+
112
+ as b(\`+1)i a nd W (\`+1)i,j,µ,ν have zero mean, and W (\`+1)i,j,ν,µ are independent of the activations at the previous layer, $\phi ( A _ { j , \nu } ^ { ( \ell ) } ( \mathbf { X } ) )$ .
113
+
114
+ Now we show that it is possible to efficiently compute the covariance function. This is surprising because for many networks, we nlocations in the feature map (i.e. $\mathbb { C } \left[ A _ { i , \mu } ^ { ( \ell + 1 ) } ( \mathbf { \bar { X } } ) , A _ { i , \mu ^ { \prime } } ^ { ( \ell + 1 ) } ( \mathbf { X } ^ { \prime } ) \right]$ ce ofor $\mu , \mu ^ { \prime } \in \{ 1 , \ldots , H ^ { ( \ell + 1 ) } D ^ { ( \ell + 1 ) } \} )$ and this object is extremely high-dimensional, $N ^ { 2 } ( H ^ { ( \ell + 1 ) } D ^ { \overline { { ( \ell + 1 ) } } } ) ^ { 2 }$ . However, it turns out that we only need to consider the “diagonal” covariance, (i.e. we only need $\mathbb { C } \left[ A _ { i , \mu } ^ { ( \ell + 1 ) } ( \mathbf { X } ) , A _ { i , \mu } ^ { ( \ell + 1 ) } ( \mathbf { X } ^ { \prime } ) \right]$ fo r $\mu \in \{ 1 , \ldots , H ^ { ( \ell + 1 ) } D ^ { ( \ell + 1 ) } \} )$ , which is a more manageable quantity of size $N ^ { 2 } ( H ^ { ( \ell + 1 ) } D ^ { ( \ell + 1 ) } )$ .
115
+
116
+ This is true at the output layer $( L + 1 )$ : in order to achieve an output suitable for classification or regression, we use only a single output location $H ^ { ( L + 1 ) } = D ^ { ( L + 1 ) } = 1$ , with a number of “channels” equal to the number of of outputs/classes, so it is only possible to compute the covariance at that single location. We now show that, if we only need the covariance at corresponding locations in the outputs, we only need the covariance at corresponding locations in the inputs, and this requirement propagates backwards through the network.
117
+
118
+ Formally, as the activations are composed of a sum of terms, their covariance is the sum of the covariances of all those underlying terms,
119
+
120
+ $$
121
+ \begin{array} { r l } { \mathbb { C } \left[ A _ { i , \mu } ^ { ( \ell + 1 ) } ( \mathbf { X } ) , A _ { i , \mu } ^ { ( \ell + 1 ) } ( \mathbf { X } ^ { \prime } ) \right] = \mathbb { V } \left[ b _ { i } ^ { ( \ell ) } \right] + } & { } \\ { \displaystyle \sum _ { j = 1 } ^ { C ^ { ( \ell ) } } \sum _ { j ^ { \prime } = 1 } ^ { C ^ { ( \ell ) } } \sum _ { \nu = 1 } ^ { H ^ { ( \ell ) } D ^ { ( \ell ) } } \sum _ { \nu ^ { \prime } = 1 } ^ { H ^ { ( \ell ) } D ^ { ( \ell ) } } \mathbb { C } \left[ W _ { i , j , \mu , \nu } ^ { ( \ell + 1 ) } \phi ( A _ { j , \nu } ^ { ( \ell ) } ( \mathbf { X } ) ) , W _ { i , j ^ { \prime } , \mu , \nu ^ { \prime } } ^ { ( \ell + 1 ) } \phi ( A _ { j ^ { \prime } , \nu ^ { \prime } } ^ { ( \ell ) } ( \mathbf { X } ^ { \prime } ) ) \right] . } \end{array}
122
+ $$
123
+
124
+ As the terms in the covariance have mean zero, and as the weights and activations from the previous layer are independent,
125
+
126
+ $$
127
+ \begin{array} { r l } { \mathbb { C } \left[ A _ { i , \mu } ^ { ( \ell + 1 ) } ( \mathbf { X } ) , A _ { i , \mu } ^ { ( \ell + 1 ) } ( \mathbf { X } ^ { \prime } ) \right] = \sigma _ { \mathrm { b } } ^ { 2 } + } & { } \\ { \quad } & { \qquad \sum _ { j = 1 } ^ { { \ell ^ { ( \ell ) } } } \displaystyle \sum _ { j ^ { \prime } = 1 } ^ { { \ell ^ { ( \ell ) } } } \sum _ { \nu = 1 } ^ { { H ^ { ( \ell ) } } D ^ { ( \ell ) } } \sum _ { \nu ^ { \prime } = 1 } ^ { H ^ { ( \ell ) } D ^ { ( \ell ) } } \mathbb { E } \left[ W _ { i , j , \mu , \nu } ^ { ( \ell + 1 ) } W _ { i , j ^ { \prime } , \mu , \nu ^ { \prime } } ^ { ( \ell + 1 ) } \right] \mathbb { E } \left[ \phi ( A _ { j , \nu } ^ { ( \ell ) } ( \mathbf { X } ) ) \phi ( A _ { j ^ { \prime } , \nu ^ { \prime } } ^ { ( \ell ) } ( \mathbf { X } ^ { \prime } ) ) \right] . } \end{array}
128
+ $$
129
+
130
+ # Algorithm 1 The ConvNet kernel $k ( \mathbf { X } , \mathbf { X } ^ { \prime } )$
131
+
132
+ 1: Input: two images, X, X0 ∈ RC(0)×(H(0)W (0)).
133
+ 2: Compute $K _ { \mu } ^ { ( 1 ) } ( { \bf X } , { \bf X } )$ , $K _ { \mu } ^ { ( 1 ) } ( { \bf X } , { \bf X ^ { \prime } } )$ , and $K _ { \mu } ^ { ( 1 ) } ( \mathbf { X } ^ { \prime } , \mathbf { X } ^ { \prime } )$ for $\mu \in \{ 1 , \ldots , H ^ { ( 1 ) } D ^ { ( 1 ) } \}$ ; using Eq. (10).
134
+ 3: for $\ell = 1 , 2 , \dots , L$ do
135
+ 4: Compute $V _ { \mu } ^ { ( \ell ) } ( { \bf X } , { \bf X ^ { \prime } } )$ , $V _ { \mu } ^ { ( \ell ) } ( { \bf X } , { \bf X ^ { \prime } } )$ and $V _ { \mu } ^ { ( \ell ) } ( { \bf X } , { \bf X ^ { \prime } } )$ for $\mu \in \{ 1 , \ldots , H ^ { ( \ell ) } D ^ { ( \ell ) } \}$ ; using
136
+ 5: Compute Eq. (13), or some other nonlinearity. $K _ { \mu } ^ { ( \ell + 1 ) } ( { \mathbf { X } } , { \mathbf { X } } )$ , $K _ { \mu } ^ { ( \ell + 1 ) } ( { \bf X } , { \bf X ^ { \prime } } )$ , and $K _ { \mu } ^ { ( \ell + 1 ) } ( { \mathbf { X } } ^ { \prime } , { \mathbf { X } } ^ { \prime } )$ for $\mu$ ∈ $\{ 1 , \ldots , H ^ { ( \ell + 1 ) } D ^ { ( \ell + 1 ) } \}$ ; using Eq. (11).
137
+
138
+ 6: end for
139
+ 7: Output the scalar $K _ { 1 } ^ { ( L + 1 ) } ( { \bf X } , { \bf X ^ { \prime } } )$ .
140
+
141
+ nt ffor ent channels: Further, each $\mathbf { W } _ { i , j } ^ { ( \ell + 1 ) }$ and of the $\mathbf { W } _ { i , j ^ { \prime } } ^ { ( \ell + 1 ) }$ are iid f matrices $j \neq j ^ { \prime }$ , sonly contains independent variables or zeros (Fig. 1), so $\mathbb { E } \left[ W _ { i , j , \mu , \nu } ^ { ( \ell + 1 ) } W _ { i , j ^ { \prime } , \mu , \nu ^ { \prime } } ^ { ( \ell + 1 ) } \right] = 0$ $j \neq j ^ { \prime }$ $\mathbb { E } \left[ W _ { i , j , \mu , \nu } ^ { ( \ell + 1 ) } W _ { i , j ^ { \prime } , \mu , \nu ^ { \prime } } ^ { ( \ell + 1 ) } \right] = 0$ $\mu$ for $\nu \neq \nu ^ { \prime }$ $\mathbf { W } _ { i , j } ^ { ( \ell + 1 ) }$ . Thus, we can eliminate the sums over $j ^ { \prime }$ and $\nu ^ { \prime }$ :
142
+
143
+ $$
144
+ \Sigma \left[ A _ { i , \mu } ^ { ( \ell + 1 ) } ( \mathbf { X } ) , A _ { i , \mu } ^ { ( \ell + 1 ) } ( \mathbf { X ^ { \prime } } ) \right] = \sigma _ { \mathrm { b } } ^ { ( \ell ) } + \sum _ { j = 1 } ^ { Q ^ { ( \ell ) } } \sum _ { \nu = 1 } ^ { H ^ { ( \ell ) } D ^ { ( \ell ) } } \mathbb { E } \left[ W _ { i , j , \mu , \nu } ^ { ( \ell + 1 ) } W _ { i , j , \mu , \nu } ^ { ( \ell + 1 ) } \right] \mathbb { E } \left[ \phi ( A _ { j , \nu } ^ { ( \ell ) } ( \mathbf { X } ) ) \phi ( A _ { j , \nu } ^ { ( \ell ) } ( \mathbf { X ^ { \prime } } ) ) \right] .
145
+ $$
146
+
147
+ The µth row of W(\`+1)i,j i s zero for indices $\nu$ that do not belong to its convolutional patch, so we can restrict the sum over $\nu$ to that region. We also define $v _ { g } ^ { ( 1 ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } )$ , to emphasise that the covariances are independent of the output channel, $j$ . The variance of the first layer is
148
+
149
+ $$
150
+ K _ { \mu } ^ { ( 1 ) } ( \mathbf { X } , \mathbf { X ^ { \prime } } ) = \mathbb { C } \left[ A _ { i , \mu } ^ { ( 1 ) } ( \mathbf { X } ) , A _ { i , \mu } ^ { ( 1 ) } ( \mathbf { X ^ { \prime } } ) \right] = \sigma _ { \mathrm { b } } ^ { 2 } + \frac { \sigma _ { \mathrm { w } } ^ { 2 } } { C ^ { ( 0 ) } } \sum _ { i = 1 } ^ { C ^ { ( 0 ) } } \sum _ { \nu \in \mu \mathrm { t h } \mathrm { p a t c h } } X _ { i , \nu } X _ { i , \nu } ^ { \prime } .
151
+ $$
152
+
153
+ And we do the same for the other layers,
154
+
155
+ $$
156
+ K _ { \mu } ^ { ( \ell + 1 ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) = \mathbb { C } \left[ A _ { i , \mu } ^ { ( \ell + 1 ) } ( \mathbf { X } ) , A _ { i , \mu } ^ { ( \ell + 1 ) } ( \mathbf { X } ^ { \prime } ) \right] = \sigma _ { \mathrm { b } } ^ { 2 } + \sigma _ { \mathrm { w } } ^ { 2 } \sum _ { \nu \in \mu \mathrm { t h p a t c h } } V _ { \nu } ^ { ( \ell ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) ,
157
+ $$
158
+
159
+ where
160
+
161
+ $$
162
+ V _ { \nu } ^ { ( \ell ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) = \mathbb { E } \left[ \phi ( A _ { j , \nu } ^ { ( \ell ) } ( \mathbf { X } ) ) \phi ( A _ { j , \nu } ^ { ( \ell ) } ( \mathbf { X } ^ { \prime } ) ) \right]
163
+ $$
164
+
165
+ is the covariance of the activations, which is again independent of the channel.
166
+
167
+ # 3.2 COVARIANCE OF THE ACTIVITIES
168
+
169
+ The elementwise covariance in the right-hand side of Eq. (11) can be computed in closed form for many choices of $\phi$ if the activations are Gaussian. For each element of the activations, one needs to keep track of the 3 distinct entries of the bivariate covariance matrix between the inputs, $K _ { \mu } ^ { ( \ell + 1 ) } ( { \mathbf { X } } , { \mathbf { X } } ) , K _ { \mu } ^ { ( \ell + 1 ) } ( { \mathbf { X } } , { \mathbf { X } } ^ { \prime } )$ and $K _ { \mu } ^ { ( \ell + 1 ) } ( { \mathbf { X } } ^ { \prime } , { \mathbf { X } } ^ { \prime } )$ .
170
+
171
+ For example, for the ReLU nonlinearity $( \phi ( x ) = \operatorname* { m a x } ( 0 , x ) )$ , one can adapt Cho & Saul (2009) in the same way as Matthews et al. (2018a, section 3) to obtain
172
+
173
+ $$
174
+ V _ { \nu } ^ { ( \ell ) } ( { \mathbf { X } } , { \mathbf { X ^ { \prime } } } ) = \frac { \sqrt { K _ { \nu } ^ { ( \ell ) } ( { \mathbf { X } } , { \mathbf { X } } ) K _ { \nu } ^ { ( \ell ) } ( { \mathbf { X ^ { \prime } } } , { \mathbf { X ^ { \prime } } } ) } } { \pi } \left( \sin \theta _ { \nu } ^ { ( \ell ) } + ( \pi - \theta _ { \nu } ^ { ( \ell ) } ) \cos \theta _ { \nu } ^ { ( \ell ) } \right)
175
+ $$
176
+
177
+ where $\theta _ { \nu } ^ { ( \ell ) } = \cos ^ { - 1 } \bigg ( K _ { \nu } ^ { ( \ell ) } ( { \mathbf X } , { \mathbf X ^ { \prime } } ) / \sqrt { K _ { \nu } ^ { ( \ell ) } ( { \mathbf X } , { \mathbf X } ) K _ { \nu } ^ { ( \ell ) } ( { \mathbf X ^ { \prime } } , { \mathbf X ^ { \prime } } ) } \bigg ) .$
178
+
179
+ # 3.3 EFFICIENCY OF THE CONVNET KERNEL
180
+
181
+ We now have all the pieces for computing the kernel, as written in Algorithm 1.
182
+
183
+ Putting together Eq. (11) and Eq. (13) gives us the surprising result that the diagonal covariances of the activations at layer $\ell + 1$ only depend on the diagonal covariances of the activations at layer $\ell$ . This is very important, because it makes the computational cost of the kernel be within a constant factor of the cost of a forward pass for the equivalent CNN with 1 filter per layer.
184
+
185
+ Thus, the algorithm is more efficient that one would naively think. A priori, one needs to compute the covariance between all the elements of ${ \bf a } _ { j } ^ { ( \ell ) } ( { \bf X } )$ and $\mathbf { a } _ { j } ^ { ( \ell ) } ( \mathbf { X } ^ { \prime } )$ combined, yielding a $2 H ^ { ( \ell ) } D ^ { ( \ell ) } \times$ $2 H ^ { ( \ell ) } D ^ { ( \ell ) }$ covariance matrix for every pair of points. Instead, we only need to keep track of a $H ^ { ( \ell ) } D ^ { ( \ell ) }$ -dimensional vector per layer and pair of points.
186
+
187
+ Furthermore, the particular form for the kernel (eq. 1 and eq. 2) implies that the required variances and covariances at all required locations can be computed efficiently as a convolution.
188
+
189
+ # 3.4 KERNEL FOR A RESIDUAL CNN
190
+
191
+ The induction step in the argument for GP behaviour from Sec. 2.2 depends only on the previous activations being iid Gaussian. Since all the activations are iid Gaussian, we can add skip connections between the activations of different layers while preserving GP behaviour, e.g. $\mathbf { A } ^ { ( \ell + 1 ) }$ and $\mathbf { A } ^ { ( \ell - s ) }$ where $s$ is the number of layers that the skip connection spans. If we change the NN recursion (Eq. 2) to
192
+
193
+ $$
194
+ \mathbf { a } _ { i } ^ { ( \ell + 1 ) } ( \mathbf { X } ) : = \mathbf { a } _ { i } ^ { ( \ell - s ) } ( \mathbf { X } ) + \mathbf { b } _ { i } ^ { ( \ell + 1 ) } + \sum _ { j = 1 } ^ { C ^ { ( \ell ) } } \mathbf { W } _ { i , j } ^ { ( \ell ) } \phi \left( \mathbf { a } _ { j } ^ { ( \ell ) } ( \mathbf { X } ) \right) ,
195
+ $$
196
+
197
+ then the kernel recursion (Eq. 11) becomes
198
+
199
+ $$
200
+ K _ { \mu } ^ { ( \ell + 1 ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) = K _ { \mu } ^ { ( \ell - s ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) + \sigma _ { b } ^ { 2 } + \sigma _ { w } ^ { 2 } \sum _ { \nu \in \mu \mathrm { t h } \mathrm { p a t c h } } V _ { \nu } ^ { ( \ell ) } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) .
201
+ $$
202
+
203
+ This way of adding skip connections is equivalent to the “pre-activation” shortcuts described by He et al. (2016b). Remarkably, the natural way of adding residual connections to NNs is the one that performed best in their empirical evaluations.
204
+
205
+ # 4 EXPERIMENTS
206
+
207
+ We evaluate our kernel on the MNIST handwritten digit classification task. Classification likelihoods are not conjugate for GPs, so we must make an approximation, and we follow Lee et al. (2017), in re-framing classification as multi-output regression.
208
+
209
+ The training set is split into $N = 5 0 0 0 0$ training and 10000 validation examples. The regression targets $\mathbf { Y } \in \{ - 1 , 1 \} ^ { \overline { { N } } \times 1 0 }$ are a one-hot encoding of the example’s class: $y _ { n , c } = 1$ if the $n$ th example belongs to class $c$ , and $- 1$ otherwise.
210
+
211
+ Training is exact conjugate likelihood GP regression with noiseless targets $\mathbf { Y }$ (Rasmussen & Williams, 2006). First we compute the $N \times N$ kernel matrix ${ \bf K } _ { x x }$ , which contains the kernel between every pair of examples. Then we compute ${ \mathbf { K } } _ { x x } ^ { - 1 } { \mathbf { Y } }$ using a linear system solver.
212
+
213
+ The test set has $N _ { T } = 1 0 0 0 0$ examples. We compute the $N _ { T } \times N$ matrix $\mathbf { K } _ { x ^ { * } x }$ , the kernel between each test example and all the training examples. The predictions are given by the row-wise maximum of $\mathbf { K } _ { x ^ { * } x } \mathbf { K } _ { x x } ^ { - 1 } \bar { \mathbf { Y } }$ .
214
+
215
+ For the “ConvNet GP” and “Residual CNN GP”, (Table 1) we optimise the kernel hyperparameters by random search. We draw $M$ random hyperparameter samples, compute the resulting kernel’s performance in the validation set, and pick the highest performing run. The kernel hyperparameters are: $\sigma _ { b } ^ { 2 }$ , $\sigma _ { w } ^ { 2 }$ ; the number of layers; the convolution stride, filter sizes and edge behaviour; the nonlinearity (we consider the error function and ReLU); and the frequency of residual skip connections (for Residual CNN GPs). We do not retrain the model on the validation set after choosing hyperparameters.
216
+
217
+ Table 1: MNIST classification results. #samples gives the number of kernels that were randomly sampled for the hyperparameter search. “ConvNet GP” and “Residual CNN GP” are random CNN architectures with a fixed filter size, whereas “ResNet GP” is a slight modification of the architecture by He et al. (2016b). Entries labelled “SGD” used stochastic gradient descent for tuning hyperparameters, by maximising the likelihood of the training set. The last two methods use parametric neural networks. The hyperparameters of the ResNet GP were not optimised (they were fixed based on the architecture from He et al., 2016b).
218
+
219
+ <table><tr><td>Method</td><td>#samples</td><td>Validation error</td><td>Test error</td></tr><tr><td>NNGP (Lee et al., 2017)</td><td>~250</td><td>1</td><td>1.21%</td></tr><tr><td>Convolutional GP (van der Wilk et al., 2017)</td><td>SGD</td><td></td><td>1.17%</td></tr><tr><td>Deep Conv. GP (Kumar et al., 2018)</td><td>SGD</td><td>1</td><td>1.34%</td></tr><tr><td>ConvNetGP</td><td>27</td><td>0.71%</td><td>1.03%</td></tr><tr><td>Residual CNN GP</td><td>27</td><td>0.72%</td><td>0.96%</td></tr><tr><td>ResNet GP</td><td>1</td><td>0.68%</td><td>0.84%</td></tr><tr><td>GP + parametric deep kernel (Bradshaw et al., 2017)</td><td>SGD</td><td>1</td><td>0.60%</td></tr><tr><td>ResNet (Chen et al.,2018)</td><td>一</td><td></td><td>0.41%</td></tr></table>
220
+
221
+ The “ResNet GP” (Table 1) is the kernel equivalent to a 32-layer version of the basic residual architecture by He et al. (2016a). The differences are: an initial $3 \times 3$ convolutional layer and a final dense layer instead of average pooling. We chose to remove the pooling because computing its output variance requires the off-diagonal elements of the filter covariance, in which case we could not exploit the efficiency gains described in Sec. 3.3.
222
+
223
+ We found that the despite it not being optimised, the 32-layer ResNet GP outperformed all other comparable architectures (Table 1), including the NNGP in Lee et al. (2017), which is state-ofthe-art for non-convolutional networks, and convolutional GPs (van der Wilk et al., 2017; Kumar et al., 2018). That said, our results have not reached state-of-the-art for methods that incorporate a parametric neural network, such as a standard ResNet (Chen et al., 2018) and a Gaussian process with a deep neural network kernel Bradshaw et al. (2017).
224
+
225
+ To check whether the GP limit is applicable to relatively small networks used practically (with of the order of 100 channels in the first layers), we randomly sampled 10, 000 32-layer ResNets, with 3, 10, 30 and 100 channels in the first layers, and, following the usual practice for ResNets we increase the number the number of hidden units when we downsample the feature maps. The probability density plots show a good match around 100 channels (Fig. 2A), which matches a more sensitive graphical procedure based on quantile-quantile plots (Fig. 2B). Notably, even for only 30 channels, the moments match closely (Fig. 2C). For comparison, typical ResNets use from 64 (He et al., 2016a) to 192 (Zagoruyko & Komodakis, 2016) channels in their first layers. We believe that this is because the moment propagation equations only require the Gaussianity assumption for propagation through the relu, and presumably this is robust to non-Gaussian input activations.
226
+
227
+ Computational efficiency. Asymptotically, computing the kernel matrix takes $O ( N ^ { 2 } L D )$ time, where $L$ is the number of layers in the network and $D$ is the dimensionality of the input, and inverting the kernel matrix takes $O ( \bar { N } ^ { 3 } )$ . As such, we expect that for very large datasets, inverting the kernel matrix will dominate the computation time. However, on MNIST, $N ^ { 3 }$ is only around a factor of 10 larger than $N ^ { 2 } L D$ . In practice, we found that it was more expensive to compute the kernel matrix than to invert it. For the ResNet kernel, the most expensive, computing ${ \bf K } _ { x x }$ , and ${ \bf K } _ { x x * }$ for validation and test took 3h 40min on two Tesla P100 GPUs. In contrast, inverting ${ \bf K } _ { x x }$ and computing validation and test performance took $4 3 . 2 5 \pm 8 . 8$ seconds on a single Tesla P100 GPU.
228
+
229
+ # 5 RELATED WORK
230
+
231
+ Van der Wilk et al. (van der Wilk et al., 2017) also adapted GPs to image classification. They defined a prior on functions $f$ that takes an image and outputs a scalar. First, draw a function $g \sim \mathcal { G P } ( 0 , k _ { p } ( \mathbf { X } , \mathbf { X } ^ { \prime } ) )$ . Then, $f$ is the sum of the output of $g$ applied to each of the convolutional patches. Their approach is also inspired by convolutional NNs, but their kernel $k _ { p }$ is applied to all pairs of patches of $\mathbf { X }$ and $\mathbf { X } ^ { \prime }$ . This makes their convolutional kernel expensive to evaluate, requiring inter-domain inducing point approximations to remain tractable. The kernels in this work, directly motivated by the infinite-filter limit of a CNN, only apply something like $k _ { p }$ to the corresponding pairs of patches within $\mathbf { X }$ and $\mathbf { X } ^ { \prime }$ (Eq. 10). As such, the CNN kernels are cheaper to compute and exhibit superior performance (Table 1), despite the use of an approximate likelihood function.
232
+
233
+ ![](images/855e86413bd7de48d01d9cca88bd8f2c7466cd7a38d25eebae9541aa8c975eaf.jpg)
234
+ Figure 2: Comparison of the infinite limit, and outputs from finite 32-layer ResNets with 3, 10, 30, and 100 channels in their first layers. A Comparison of the empirical and limiting probability densities. B A more sensitive test of Gaussianity is a quantile-quantile plot, which shows converges with 100 channels. C The moments (variances and covariances) for 100 training inputs shows gives a good match for all numbers of channels.
235
+
236
+ Kumar et al. (2018) define a prior over functions by stacking several GPs with van der Wilk’s convolutional kernel, forming a “Deep GP” (Damianou & Lawrence, 2013). In contrast, the kernel in this paper confines all hierarchy to the definition of the kernel, and the resulting GPs is shallow.
237
+
238
+ Wilson et al. (2016) introduced and Bradshaw et al. (2017) improved deep kernel learning. The inputs to a classic GP kernel $k$ (e.g. RBF) are preprocessed by applying a feature extractor $g$ (a deep NN) prior to computing the kernel: $k _ { \mathrm { d e e p } } ( \mathbf { X } , \bar { \mathbf { X } } ^ { \prime } ) : = k ( g ( \mathbf { X } ; \theta ) , \bar { g ( \mathbf { X } ^ { \prime } , \theta ) } )$ . The NN parameters are optimised by gradient ascent using the likelihood as the objective, as in standard GP kernel learning (Rasmussen & Williams, 2006, Chapter 5). Since deep kernel learning incorporates a state-of-the-art NN with over $1 0 ^ { 6 }$ parameters, we expect it to perform similarly to a NN applied directly to the task of image classification. At present both CNNs and deep kernel learning display superior performance to the GP kernels in this work. However, the kernels defined here have far fewer parameters (around 10, compared to their $1 0 ^ { 6 }$ ).
239
+
240
+ Borovykh (2018) also suggests that a CNN exhibits GP behaviour. However, they take the infinite limit with respect to the filter size, not the number of filters. Thus, their infinite network is inapplicable to real data which is always of finite dimension.
241
+
242
+ Finally, there is a series of papers analysing the mean-field behaviour of deep NNs and CNNs which aims to find good random initializations, i.e. those that do not exhibit vanishing or exploding gradients or activations (Schoenholz et al., 2016; Yang & Schoenholz, 2017). Apart from their very different focus, the key difference to our work is that they compute the variance for a single trainingexample, whereas to obtain the GPs kernel, we additionally need to compute the output covariances for different training/test examples (Xiao et al., 2018).
243
+
244
+ # 6 CONCLUSIONS AND FUTURE WORK
245
+
246
+ We have shown that deep Bayesian CNNs with infinitely many filters are equivalent to a GP with a recursive kernel. We also derived the kernel for the GP equivalent to a CNN, and showed that, in handwritten digit classification, it outperforms all previous GP approaches that do not incorporate a parametric NN into the kernel. Given that most state-of-the-art neural networks incorporate structure (convolutional or otherwise) into their architecture, the equivalence between CNNs and GPs is potentially of considerable practical relevance. In particular, we hope to apply GP CNNs in domains as widespread as adversarial examples, lifelong learning and $\mathbf { k }$ -shot learning, and we hope to improve them by developing efficient multi-layered inducing point approximation schemes.
247
+
248
+ # REFERENCES
249
+
250
+ JR Blum, H Chernoff, M Rosenblatt, and H Teicher. Central limit theorems for interchangeable processes. Canad. J. Math, 10:222–229, 1958.
251
+
252
+ Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural network. In International Conference on Machine Learning, pp. 1613–1622, 2015.
253
+
254
+ Anastasia Borovykh. A gaussian process perspective on convolutional neural networks. ResearchGate, 05 2018.
255
+
256
+ John Bradshaw, Alexander G de G Matthews, and Zoubin Ghahramani. Adversarial examples, uncertainty, and transfer testing robustness in gaussian process hybrid deep networks. arXiv preprint arXiv:1707.02476, 2017.
257
+
258
+ Tian Qi Chen, Yulia Rubanova, Jesse Bettencourt, and David Duvenaud. Neural ordinary differential equations. arXiv preprint arXiv:1806.07366, 2018.
259
+
260
+ Youngmin Cho and Lawrence K Saul. Kernel methods for deep learning. In Advances in neural information processing systems, pp. 342–350, 2009. URL http://papers.nips.cc/ paper/3628-kernel-methods-for-deep-learning.pdf.
261
+
262
+ Andreas Damianou and Neil Lawrence. Deep gaussian processes. In Carlos M. Carvalho and Pradeep Ravikumar (eds.), Proceedings of the Sixteenth International Conference on Artificial Intelligence and Statistics, volume 31 of Proceedings of Machine Learning Research, pp. 207– 215, Scottsdale, Arizona, USA, 29 Apr–01 May 2013. PMLR. URL http://proceedings. mlr.press/v31/damianou13a.html.
263
+
264
+ Marc Deisenroth and Carl E Rasmussen. PILCO: A model-based and data-efficient approach to policy search. In Proceedings of the 28th International Conference on machine learning (ICML11), pp. 465–472, 2011.
265
+
266
+ Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. arXiv preprint arXiv:1506.02142, 2015.
267
+
268
+ Yarin Gal and Lewis Smith. Idealised bayesian neural networks cannot have adversarial examples: Theoretical and empirical study. arXiv preprint arXiv:1806.00667, 2018.
269
+
270
+ 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, 2016a. URL https://arxiv.org/pdf/1512.03385.pdf.
271
+
272
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European conference on computer vision, pp. 630–645. Springer, 2016b.
273
+
274
+ Daniel Hernández-lobato, Jose M. Hernández-lobato, and Pierre Dupont. Robust multiclass gaussian process classification. In J. Shawe-Taylor, R. S. Zemel, P. L. Bartlett, F. Pereira, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 24, pp. 280–288. 2011. URL http://papers.nips.cc/paper/ 4241-robust-multi-class-gaussian-process-classification.pdf.
275
+
276
+ 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.
277
+
278
+ Vinayak Kumar, Vaibhav Singh, PK Srijith, and Andreas Damianou. Deep gaussian processes with convolutional kernels. arXiv preprint arXiv:1806.01655, 2018.
279
+
280
+ Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial examples in the physical world. arXiv preprint arXiv:1607.02533, 2016.
281
+
282
+ 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.
283
+
284
+ Yann LeCun, Bernhard E Boser, John S Denker, Donnie Henderson, Richard E Howard, Wayne E Hubbard, and Lawrence D Jackel. Handwritten digit recognition with a back-propagation network. In Advances in neural information processing systems, pp. 396–404, 1990.
285
+
286
+ Jaehoon Lee, Yasaman Bahri, Roman Novak, Samuel S Schoenholz, Jeffrey Pennington, and Jascha Sohl-Dickstein. Deep neural networks as gaussian processes. arXiv preprint arXiv:1711.00165, 2017.
287
+
288
+ Stephan Mandt, Matthew D Hoffman, and David M Blei. Stochastic gradient descent as approximate bayesian inference. The Journal of Machine Learning Research, 18(1):4873–4907, 2017.
289
+
290
+ Alexander G. de G. Matthews, Jiri Hron, Mark Rowland, Richard E. Turner, and Zoubin Ghahramani. Gaussian process behaviour in wide deep neural networks. In International Conference on Learning Representations, 2018a. URL https://openreview.net/forum?id $=$ H1-nGgWC-.
291
+
292
+ Alexander G de G Matthews, Mark Rowland, Jiri Hron, Richard E Turner, and Zoubin Ghahramani. Gaussian process behaviour in wide deep neural networks. arXiv preprint arXiv:1804.11271, 2018b.
293
+
294
+ De G Matthews, G Alexander, Mark Van Der Wilk, Tom Nickson, Keisuke Fujii, Alexis Boukouvalas, Pablo León-Villagrá, Zoubin Ghahramani, and James Hensman. GPflow: A gaussian process library using TensorFlow. The Journal of Machine Learning Research, 18(1):1299–1304, 2017.
295
+
296
+ Radford M. Neal. Bayesian Learning for Neural Networks. Springer-Verlag, Berlin, Heidelberg, 1996. ISBN 0387947248.
297
+
298
+ Carl Edward Rasmussen and Christopher KI Williams. Gaussian processes for machine learning, volume 1. MIT press Cambridge, 2006.
299
+
300
+ Samuel S Schoenholz, Justin Gilmer, Surya Ganguli, and Jascha Sohl-Dickstein. Deep information propagation. arXiv preprint arXiv:1611.01232, 2016.
301
+
302
+ Jasper Snoek, Hugo Larochelle, and Ryan P Adams. Practical bayesian optimization of machine learning algorithms. In Advances in neural information processing systems, pp. 2951–2959, 2012.
303
+
304
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, and Rob Fergus. Intriguing properties of neural networks. arXiv preprint arXiv:1312.6199, 2013.
305
+
306
+ Mark van der Wilk, Carl Edward Rasmussen, and James Hensman. Convolutional gaussian processes. In Advances in Neural Information Processing Systems, pp. 2845–2854, 2017.
307
+
308
+ Max Welling and Yee W Teh. Bayesian learning via stochastic gradient langevin dynamics. In Proceedings of the 28th International Conference on Machine Learning (ICML-11), pp. 681–688, 2011.
309
+
310
+ Andrew Gordon Wilson, Zhiting Hu, Ruslan Salakhutdinov, and Eric P. Xing. Deep kernel learning. In Arthur Gretton and Christian C. Robert (eds.), Proceedings of the 19th International Conference on Artificial Intelligence and Statistics, volume 51 of Proceedings of Machine Learning Research, pp. 370–378, Cadiz, Spain, 09–11 May 2016. PMLR. URL http: //proceedings.mlr.press/v51/wilson16.html.
311
+
312
+ Lechao Xiao, Yasaman Bahri, Jascha Sohl-Dickstein, Samuel S Schoenholz, and Jeffrey Pennington. Dynamical isometry and a mean field theory of cnns: How to train 10,000-layer vanilla convolutional neural networks. arXiv preprint arXiv:1806.05393, 2018.
313
+
314
+ Ge Yang and Samuel Schoenholz. Mean field residual networks: On the edge of chaos. In Advances in neural information processing systems, pp. 7103–7114, 2017.
315
+
316
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
317
+
318
+ # 7 APPENDIX
319
+
320
+ # 7.1 TECHNICAL NOTES ON LIMITS
321
+
322
+ The key technical issues in the proof (and the key differences between Lee et al. 2017 and Matthews et al. 2018b) arise from exactly how and where we take limits. In particular, consider the activations as being functions of the activities at the previous layer,
323
+
324
+ $$
325
+ { \bf A } ^ { ( 4 ) } = { \bf A } ^ { ( 4 ) } ( { \bf A } ^ { ( 3 ) } ( { \bf A } ^ { ( 2 ) } ( { \bf A } ^ { ( 1 ) } ( { \bf X } ) ) ) )
326
+ $$
327
+
328
+ Now, there are two approaches to taking limits. First, both our argument in the main text, and the argument in Lee et al. (2017) is valid if we are able to take limits “inside” the network,
329
+
330
+ $$
331
+ \mathbf { A } _ { \mathrm { L } } ^ { ( 4 ) } = \operatorname* { l i m } _ { C ^ { ( 3 ) } \to \infty } \mathbf { A } ^ { ( 4 ) } \left( \operatorname* { l i m } _ { C ^ { ( 2 ) } \to \infty } \mathbf { A } ^ { ( 3 ) } \left( \operatorname* { l i m } _ { C ^ { ( 1 ) } \to \infty } \mathbf { A } ^ { ( 2 ) } \left( \mathbf { A } ^ { ( 1 ) } ( \mathbf { X } ) \right) \right) \right) .
332
+ $$
333
+
334
+ However, Matthews et al. (2018a;b) argue that is preferable to take limits “outside” the network. In particular, Matthews et al. (2018b) take the limit with all layers simultaneously,
335
+
336
+ $$
337
+ { \bf A } _ { \mathrm { M } } ^ { ( 4 ) } = \operatorname* { l i m } _ { n \infty } { \bf A } ^ { ( 4 ) } ( { \bf A } ^ { ( 3 ) } ( { \bf A } ^ { ( 2 ) } ( { \bf A } ^ { ( 1 ) } ( { \bf X } ) ) ) ) ,
338
+ $$
339
+
340
+ where $C ^ { ( \ell ) } = C ^ { ( \ell ) } ( n )$ goes to infinity as $n \to \infty$ . That said, similar technical issues arise if we take limits in sequence, but outside the network.
341
+
342
+ # 7.2 EXTENDING THE DERIVATIONS OF MATTHEWS ET AL. (2018B) TO THE CONVOLUTIONAL CASE
343
+
344
+ In the main text, we follow Lee et al. (2017) in sequentially taking the limit of each layer to infinity (i.e. $C ^ { ( 1 ) } \to \infty$ , then $C ^ { ( 2 ) } \infty$ etc.). This dramatically simplified the argument, because taking the number of units in the previous layer to infinity means that the inputs from that layer are exactly Gaussian distributed. However, Matthews et al. (2018b) argue that the more practically relevant limit is where we take all layers to infinity simultaneously. This raises considerable additional difficulties, because we must reason about convergence in the case where the previous layer is finite. Note that this section is not intended to stand independently: it is intended to be read alongside Matthews et al. (2018b), and we use several of their results without proof.
345
+
346
+ Mirroring Definition 3 in Matthews et al. (2018b), we begin by choosing a set of “width” functions, $C ^ { ( \ell ) } ( n )$ , for $\ell \in \{ 1 , \ldots , L \}$ which all approach infinity as $n \infty$ . In Matthews et al. (2018b), these functions described the number of hidden units in each layer, whereas here they describe the number of channels. Our goal is then to extend the proofs in Matthews et al. (2018b) (in particular, of theorem 4), to show that the output of our convolutional networks converge in distribution to a Gaussian process as $n \infty$ , with mean zero and covariance given by the recursion in Eqs. (10 – 12).
347
+
348
+ The proof in Matthews et al. (2018b) has three main steps. First, they use the Cramér-Wold device, to reduce the full problem to that of proving convergence of scalar random variables to a Gaussian with specified variance. Second, if the previous layers have finite numbers of channels, then the channels ${ \bf a } _ { j } ^ { ( \ell ) } ( { \bf X } )$ and $\mathbf { a } _ { j } ^ { ( \ell ) } ( \mathbf { X } ^ { \prime } )$ are uncorrelated but no longer independent, so we cannot apply the CLT directly, as we did in the main text. Instead, they write the activations as a sum of exchangeable random variables, and derive an adapted CLT for exchangeable (rather than independent) random variables (Blum et al., 1958). Third, they show that moment conditions required by their exchangeable CLT are satisfied.
349
+
350
+ To extend their proofs to the convolutional case, we begin by defining our networks in a form that is easier to manipulate and as close as possible to Eq. (21-23) in Matthews et al. (2018b),
351
+
352
+ $$
353
+ \begin{array} { c } { { A _ { i , \mu } ^ { ( 1 ) } = f _ { i , \mu } ^ { ( 1 ) } ( x ) = \displaystyle \frac { \sigma _ { \mathbf { w } } } { \sqrt { C ^ { ( 0 ) } } } \sum _ { j = 1 } ^ { C ^ { ( 0 ) } } \sum _ { \nu \in \mu \mathbb { h } \mathrm { p a t e h } } \epsilon _ { i , j , \mu , \nu } ^ { ( 1 ) } x _ { j , \nu } + b _ { i } ^ { ( 1 ) } , \quad i \in \mathbb { N } } } \\ { { g _ { i , \mu } ^ { ( \ell ) } ( x ) = \phi \left( f _ { i , \mu } ^ { ( \ell ) } ( x ) \right) } } \\ { { A _ { i , \mu } ^ { ( \ell + 1 ) } = f _ { i , \mu } ^ { ( \ell + 1 ) } ( x ) = \displaystyle \frac { \sigma _ { \mathbf { w } } } { \sqrt { C ^ { ( \ell ) } ( n ) } } \sum _ { j = 1 } ^ { C ^ { ( \ell ) } } \sum _ { \nu \in \mu \mathrm { t h } \mathrm { p a t e h } } \epsilon _ { i , j , \mu , \nu } ^ { ( \ell + 1 ) } g _ { j , \nu } ^ { ( \ell ) } ( x ) + b _ { i } ^ { ( \ell + 1 ) } , \quad i \in \mathbb { N } } } \end{array}
354
+ $$
355
+
356
+ where,
357
+
358
+ $$
359
+ \epsilon _ { i , j , \mu , \nu } \sim \mathcal { N } ( 0 , 1 ) .
360
+ $$
361
+
362
+ The first step is to use the Cramér-Wold device (Lemma 6 in Matthews et al., 2018b), which indicates that convergence in distribution of a sequence of finite-dimensional vectors is equivalent to convergence on all possible linear projections to the corresponding real-valued random variable. Mirroring Eq. 25 in Matthews et al. (2018b), we consider convergence of random vectors, $f _ { i , \mu } ^ { ( \ell ) } ( x ) [ n ] - b _ { i } ^ { ( \ell ) }$ , projected onto α(x,i,µ),
363
+
364
+ $$
365
+ \mathcal { T } ^ { ( \ell ) } \left( \mathcal { L } , \alpha \right) \left[ n \right] = \sum _ { ( x , i , \mu ) \in \mathcal { L } } \alpha ^ { ( x , i , \mu ) } \left[ f _ { i , \mu } ^ { ( \ell ) } ( x ) [ n ] - b _ { i } ^ { ( \ell ) } \right] .
366
+ $$
367
+
368
+ where $\mathcal { L } \subset \mathcal { X } \times \mathbb { N } \times \{ 1 , \ldots , H ^ { ( \ell ) } D ^ { ( \ell ) } \}$ is a finite set of tuples of data points and channel indicies, $i$ , and indicies of elements within channels/feature maps, $\mu$ . The suffix $[ n ]$ indicates width functions that are instantiated with input, $n$ .
369
+
370
+ Now, we must prove that these projections converge in distribution a Gaussian. We begin by defining summands, as in Eq. 26 in Matthews et al. (2018b),
371
+
372
+ $$
373
+ \gamma _ { j } ^ { ( \ell ) } \left( \mathcal { L } , \alpha \right) [ n ] : = \sigma _ { \mathrm { w } } \sum _ { ( x , i , \mu ) \in \mathcal { L } } \alpha ^ { ( x , i , \mu ) } \sum _ { \nu \in \mu \mathrm { t h p a t c h } } \epsilon _ { i , j , \mu , \nu } ^ { ( \ell ) } g _ { j , \nu } ^ { ( \ell - 1 ) } ( x ) [ n ] ,
374
+ $$
375
+
376
+ such that the projections can be written as a sum of the summands, exactly as in Eq. 27 in Matthews et al. (2018b),
377
+
378
+ $$
379
+ \mathcal { T } ^ { ( \ell ) } \left( \mathcal { L } , \alpha \right) [ n ] = \frac { 1 } { \sqrt { C ^ { ( \ell - 1 ) } ( n ) } } \sum _ { j = 1 } ^ { C ^ { ( \ell - 1 ) } ( n ) } \gamma _ { j } ^ { ( \ell ) } \left( \mathcal { L } , \alpha \right) [ n ] .
380
+ $$
381
+
382
+ Now we can apply the exchangeable CLT to prove that ${ \mathcal { T } } ^ { ( \ell ) } \left( { \mathcal { L } } , \alpha \right) [ n ]$ converges to the limiting Gaussian implied by the recursions in the main text. To apply the exchangeable CLT, the first step is to mirror Lemma 8 in Matthews et al. (2018b), in showing that for each fixed $n$ and $\ell \in \{ 2 , \ldots , L +$ $1 \}$ , the summands, $\gamma _ { j } ^ { ( \ell ) } \left( \mathcal { L } , \alpha \right) [ n ]$ are exchangeable with respect to the index $j$ . In particular, we apply de Finetti’s theorem, which states that a sequence of random variables is exchangeable if and only if they are i.i.d. conditional on some set of random variables, so it is sufficient to exhibit such a set of random variables. Mirroring Eq. 29 in Matthews et al. (2018b), we apply the recursion,
383
+
384
+ $$
385
+ \overset { ( \ell ) } { j } ( \mathcal { L } , \alpha ) [ n ] : = \sigma _ { \mathrm { w } } \sum _ { ( x , i , \mu ) \in \mathcal { L } } \alpha ^ { ( x , i , \mu ) } \sum _ { \nu \in \mu \mathrm { t h } \mathrm { p a t e h } } \epsilon _ { i , j , \mu , \nu } ^ { ( \ell ) } \phi ( \frac { \sigma _ { \mathrm { w } } } { \sqrt { C ^ { ( \ell - 2 ) } ( n ) } } \sum _ { k = 1 } ^ { C ^ { ( \ell - 2 ) } ( n ) } \sum _ { \xi \in \nu \mathrm { t h } \mathrm { p a t e h } } \epsilon _ { j , k , \nu ; \xi } ^ { ( \ell - 1 ) } g _ { k , \xi } ^ { ( \ell - 2 ) } ) ,
386
+ $$
387
+
388
+ As such, the summands are iid conditional on the finite set of random variables $\left\{ g _ { k , \xi } ^ { ( \ell - 2 ) } ( x ) [ n ] : k \in \{ 1 , \ldots , C ^ { ( \ell - 2 ) } \} , \xi \in \left\{ 1 , \ldots , H ^ { ( \ell - 2 ) } D ^ { ( \ell - 2 ) } \right\} , x \in \mathcal { L } _ { \mathcal { X } } \right\}$ , where $\mathcal { L } _ { \mathcal { X } }$ is the set of input points in $\mathcal { L }$ .
389
+
390
+ The exchangeable CLT in Lemma 10 in Matthews et al. (2018b) indicates that ${ \mathcal { T } } ^ { ( \ell ) } \left( { \mathcal { L } } , \alpha \right) [ n ]$ converges in distribution to $\mathcal { N } \left( 0 , \sigma _ { * } ^ { 2 } \right)$ if the summands are exchangeable (which we showed above), and if three conditions hold,
391
+
392
+ $$
393
+ \begin{array} { r l } & { \mathrm { a ) ~ \mathbb { E } } _ { n } [ \gamma _ { j } ^ { ( \ell ) } \gamma _ { j ^ { \prime } } ^ { ( \ell ) } ] = 0 } \\ & { \mathrm { b ) ~ \operatorname* { l i m } _ { n \infty } \mathbb { E } } _ { n } [ ( \gamma _ { j } ^ { ( \ell ) } ) ^ { 2 } ( \gamma _ { j ^ { \prime } } ^ { ( \ell ) } ) ^ { 2 } ] = \sigma _ { * } ^ { 4 } } \\ & { \mathrm { c ) ~ \mathbb { E } } _ { n } [ | \gamma _ { j } ^ { ( \ell ) } | ^ { 3 } ] = o ( \sqrt { C ^ { ( \ell ) } ( n ) } ) } \end{array}
394
+ $$
395
+
396
+ Condition a) follows immediately as the summands are uncorrelated and zero-mean. Conditions b) and c) are more involved as convergence in distribution in the previous layers does not imply convergence in moments for our activation functions.
397
+
398
+ We begin by considering the extension of Lemma 20 in Matthews et al. (2018b), which allow us to show conditions b) and c) above, even in the case of unbounded but linearly enveloped nonlinearities (Definition 1 in Matthews et al., 2018b). Lembounded by a finite constant independent of states that the eighth moments of . We prove this by induction. Th $f _ { i , \mu } ^ { ( t ) } ( x ) [ n ]$ aree is $n \in \mathbb N$
399
+ trivial, as $f _ { j , \mu } ^ { ( 1 ) } ( x ) [ n ]$ is Gaussian. Following Matthews et al. (2018b), assume the condition holds up to $\ell - 1$ , and show that the condition holds for layer $\ell$ . Using Eq. (21), we can bound the activations at layer $\ell$ ,
400
+
401
+ $$
402
+ \mathbb { E } \left[ | f _ { i , \mu } ^ { ( \ell ) } ( x ) [ n ] | ^ { 8 } \right] \leq 2 ^ { 8 - 1 } \mathbb { E } \left[ | b _ { i } ^ { ( \ell ) } | ^ { 8 } + \left| \frac { \sigma _ { \mathbf { w } } } { \sqrt { C ^ { ( \ell - 1 ) } } } \sum _ { j = 1 } ^ { C ^ { ( \ell - 1 ) } ( n ) } \sum _ { \nu \in \mu \mathrm { t h } \mathrm { p a t e h } } \epsilon _ { i , j , \mu , \nu } ^ { ( \ell ) } g _ { j , \nu } ^ { ( \ell - 1 ) } ( x ) [ n ] \right| ^ { 8 } \right]
403
+ $$
404
+
405
+ Following Eq. 48 in Matthews et al. (2018b), which uses Lemma 19 in Matthews et al. (2018b), we have,
406
+
407
+ $$
408
+ \begin{array} { r l } { \mathbb { E } \left[ \left| \frac { \sigma _ { \mathrm { w } } } { \sqrt { C ^ { ( \ell - 1 ) } } } \sum _ { j = 1 } ^ { C ^ { ( \ell - 1 ) } ( n ) } \displaystyle \sum _ { \nu \in \mu \mathrm { t h } \mathrm { p a t e h } } \epsilon _ { i , j , \mu , \nu } ^ { ( \ell ) } g _ { j , \nu } ^ { ( \ell - 1 ) } ( x ) [ n ] \right| ^ { 8 } \right] } & { } \\ { = \frac { 2 ^ { 4 } \Gamma ( 4 + 1 / 2 ) } { \Gamma ( 1 / 2 ) } \mathbb { E } \left[ \left| \frac { \sigma _ { \mathrm { w } } ^ { 2 } } { C ^ { ( \ell - 1 ) } ( n ) } \| g _ { j \in \{ 1 , \dots , C ^ { ( \ell - 1 ) } ( n ) \} , \nu \in \mu \mathrm { t h } \mathrm { p a t c h } } ^ { ( \ell - 1 ) } ( x ) [ n ] \| _ { 2 } ^ { 2 } \right| ^ { 4 } \right] . } \end{array}
409
+ $$
410
+
411
+ wher e g(\`−1)j∈{1,...,C(\`−1)(n)},ν∈µth patch(x)[n] is the set of post-nonlinearities corresponding to j ∈ $\{ 1 , \ldots , C ^ { ( \ell - 1 ) } ( n ) \}$ and $\nu \in \mu \mathrm { t h }$ patch. Following Matthews et al. (2018b), observe that,
412
+
413
+ $$
414
+ \begin{array} { r } { \frac { 1 } { \sum ^ { ( \ell - 1 ) } \left( n \right) } \| g _ { j \in \{ 1 , \dots , C ^ { ( \ell - 1 ) } ( n ) \} , \nu \in \mu \mathrm { t h p a t e h } } ^ { ( \ell - 1 ) } ( x ) [ n ] \| _ { 2 } ^ { 2 } = \frac { 1 } { C ^ { ( \ell - 1 ) } ( n ) } \displaystyle \sum _ { j = 1 } ^ { C ^ { ( \ell - 1 ) } ( n ) } \sum _ { \nu \in \mu \mathrm { t h p a t e h } } \left( g _ { j , \nu } ^ { ( \ell - 1 ) } ( x ) [ n ] \right) ^ { 2 } } \\ { \leq \frac { 1 } { C ^ { ( \ell - 1 ) } ( n ) } \displaystyle \sum _ { j = 1 } ^ { C ^ { ( \ell - 1 ) } ( n ) } \sum _ { \nu \in \mu \mathrm { t h p a t e h } } ^ { C ^ { ( \ell - 1 ) } ( n ) } \left( c + m \big | f _ { j , \nu } ^ { ( \ell - 1 ) } ( x ) \big | \right. } \end{array}
415
+ $$
416
+
417
+ by the linear envelope property, $| \phi ( u ) | \leq c + m | u |$ . Following Matthews et al. (2018b), we substitute this bound back into Eq. (28) and suppress a multiplicative constant independent of $x$ and $n$ ,
418
+
419
+ $$
420
+ \begin{array} { r l } & { \mathbb { E } \left[ \left| \frac { \sigma _ { \mathbf { w } } } { \sqrt { C ^ { ( \ell - 1 ) } ( n ) } } \sum _ { j = 1 } ^ { C ^ { ( \ell - 1 ) } ( n ) } \sum _ { \nu \in \mu \mathrm { t h p a t c h } } \epsilon _ { i , j , \mu , \nu } ^ { ( \ell ) } g _ { j , \nu } ^ { ( \ell - 1 ) } ( x ) [ n ] \right| ^ { 8 } \right] } \\ & { \leq \frac { 1 } { \left( C ^ { ( \ell - 1 ) } ( n ) \right) ^ { 4 } } \mathbb { E } \left[ \left| \sum _ { j = 1 } ^ { C ^ { ( \ell - 1 ) } ( n ) } \sum _ { \nu \in \mu \mathrm { t h p a c h } } c ^ { 2 } + 2 c m | f _ { j , \mu } ^ { ( \ell - 1 ) } ( x ) [ n ] | + m ^ { 2 } | f _ { j , \mu } ^ { ( \ell - 1 ) } ( x ) [ n ] | ^ { 2 } \right| ^ { 4 } \right] } \end{array}
421
+ $$
422
+
423
+ This can be multiplied out, yielding a weighted sum of expectations of the form,
424
+
425
+ $$
426
+ \mathbb { E } \left[ | f _ { k , \nu } ^ { ( \ell - 1 ) } ( x ) [ n ] | ^ { p _ { 1 } } | f _ { l , \xi } ^ { ( \ell - 1 ) } ( x ) [ n ] | ^ { p _ { 2 } } | f _ { r , \pi } ^ { ( \ell - 1 ) } ( x ) [ n ] | ^ { p _ { 3 } } | f _ { q , \rho } ^ { ( \ell - 1 ) } ( x ) [ n ] | ^ { p _ { 4 } } \right]
427
+ $$
428
+
429
+ with $p _ { i } \in \{ 0 , 1 , 2 \}$ for $i = { 1 , 2 , 3 , 4 }$ , and $k , l , r , q \in \{ 1 , \dots , C ^ { ( \ell - 1 ) } ( n ) \}$ , and $\nu , \xi , \pi , \rho \in \mu \mathrm { t h }$ patch where the weights of these terms are independent of (2018b), each of these terms is bounded if the eighth mo $n$ . Usinents of in Matthews et al.are bounded, which $f _ { k , \mu } ^ { ( \ell - 1 ) } ( x ) [ n ]$ $\left( 2 C ^ { ( \ell - 1 ) } ( n ) | \mu \mathrm { t h } \mathrm { p a t c h } | \right) ^ { 4 }$ , where $| \mu \mathrm { t h } \ p a \mathrm { t c h } |$ is the number of elements in a convolutional patch. Thus, we can use the same constant for any due to the $1 / \left( C ^ { ( \ell - 1 ) } ( n ) \right) ^ { 4 }$ scaling. As in Matthews et al. (2018b), noting that $f _ { j , \mu } ^ { ( \ell - 1 ) } ( x ) [ n ]$ are exchangeable over $j$ for any $x$ and $n$ concludes the proof. Using this result, we can obtain a straightforward adaptation of Lemmas 15, 16 and 21 in Matthews et al. (2018b). Lemma 15 gives condition b), Lemma 16 gives condition c); Lemma 15 requires uniform integrability, which is established by Lemma 21.
430
+
431
+ # 7.3 CALIBRATION OF GAUSSIAN PROCESS UNCERTAINTY
432
+
433
+ It is important to check that the estimates of uncertainty produced by our Gaussian process are reasonable. However, to make this assessment, we needed to use a proper likelihood, and not the squared-error loss in the main text. We therefore used our kernel to perform the full, multi-class classification problem in GPflow Matthews et al. (2017), with a RobustMax likelihood (Hernándezlobato et al., 2011). The more difficult non-conjugate inference problem forced us to use 1000 inducing points, randomly chosen from the training inputs. Both our kernel and an RBF kernel have similar calibration curves, that closely track the diagonal, indicating accurate uncertainty estimation. However, even in the inducing point setting, our convolutional kernel gave considerably better performance than the RBF kernel $2 . 4 \%$ error vs $3 . 4 \%$ error).
434
+
435
+ ![](images/8864ab9d76c33870f50470fe5185392a7878cda9c47764b2ab0ca5045ac895b3.jpg)
436
+ Figure 3: Calibration plots for an RBF kernel (left) and the ResNet kernel (right). The $\mathbf { X }$ -axis gives GP prediction for the label probability. The points give corresponding proportion of test points with that label, and the bars give the proportion of training examples in each bin.
md/train/BklmtJBKDB/BklmtJBKDB.md ADDED
@@ -0,0 +1,388 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CONDITIONAL FLOW VARIATIONAL AUTOENCODERS FOR STRUCTURED SEQUENCE PREDICTION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Prediction of future states of the environment and interacting agents is a key competence required for autonomous agents to operate successfully in the real world. Prior work for structured sequence prediction based on latent variable models imposes priors with limited expressiveness or are difficult to optimize e.g. determining the number of Gaussian mixture components which makes it challenging to fully capture the multi-modality of the distribution of the future states. In this work, we introduce Conditional Flow Variational Autoencoders $C F .$ VAE) using our novel conditional normalizing flow based prior to capture complex multi-modal conditional distributions for effective structured sequence prediction. Moreover, we propose two novel regularization schemes which stabilizes training and deals with posterior collapse for stable training and better fit to the target data distribution. Our experiments on three multi-modal structured sequence prediction datasets – MNIST Sequences, Stanford Drone and HighD – show that the proposed method obtains state of art results across different evaluation metrics.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Anticipating future states of the environment is a key competence necessary for the success of autonomous agents. In complex real world environments, the future is highly uncertain. Therefore, structured predictions, one to many mappings of the likely future states of the world, are important. In many scenarios, these tasks can be cast as sequence prediction problems. Particularly, Conditional Variational Autoencoders (CVAE) (Sohn et al., 2015; Bayer & Osendorfer, 2014; Chung et al., 2015) have been very successful – from prediction of pedestrians trajectories (Lee et al., 2017; Bhattacharyya et al., 2018; Pajouheshgar & Lampert, 2018) to outcomes of robotic actions (Babaeizadeh et al., 2018). The distribution of future sequences is diverse and highly multi-modal. CVAEs model diverse futures by factorizing the distribution of future states using a set of latent variables which are mapped to likely future states. However, CVAEs assume a standard Gaussian prior on the latent variables which induces a strong model bias (Hoffman & Johnson, 2016; Tomczak & Welling, 2018) which makes it challenging to capture multi-modal distributions. This also leads to missing modes due to posterior collapse (Bowman et al., 2016; Razavi et al., 2019).
12
+
13
+ Recent work (Tomczak & Welling, 2018; Wang et al., 2017; Gu et al., 2018) has therefore focused on more complex Gaussian mixture based priors. Gaussian mixtures still have limited expressiveness and optimization suffers from complications e.g. determining the number of mixture components. Normalizing flows are more expressive and enable the modelling of complex multi-modal priors. Recent work on flow based priors (Chen et al., 2017; Ziegler & Rush, 2019), have focused only on the unconditional (plain VAE) case. However, this not sufficient for CVAEs because in the conditional case the complexity of the distributions are highly dependent on the condition.
14
+
15
+ In this work, 1. We propose Conditional Flow Variational Autoencoders (CF-VAE) based on novel conditional normalizing flow based priors In order to model complex multi-modal conditional distributions over sequences. In Figure 1, we show example predictions of MNIST handwriting stroke of our CF-VAE. We observe that, given a starting stroke, our CF-VAE model with data dependent normalizing flow based latent prior captures the two main modes of the conditional distribution – i.e. 1 and 8 – while CVAEs with fixed uni-modal Gaussian prior predictions have limited diversity. 2. We propose a regularization scheme that stabilizes the optimization of the evidence lower bound and leads to better fit to the target data distribution. 3. We leverage our conditional flow prior to deal with posterior collapse which causes standard CVAEs to ignore modes in sequence prediction tasks. 4. Finally, our method outperforms the state of the art on three structured sequence prediction tasks – handwriting stroke prediction on MNIST, trajectory prediction on Stanford Drone and HighD.
16
+
17
+ ![](images/2dd848aa9b523138419d8ded367d1d10054388c6945d9c0432ce1d1d2c0baa35.jpg)
18
+ Figure 1: Clustered stroke predictions on MNIST sequences. Our multi-modal Conditional Normalizing Flow based prior (right) enables our regularized CF-VAE to capture the two modes of the conditional distribution, while predictions with uni-modal Gaussian prior (left) have limited diversity. Note, our 64D CF-VAE latent distribution is (approximately) projected to 2D using tSNE and KDE.
19
+
20
+ # 2 RELATED WORK
21
+
22
+ Normalizing Flows. Normalizing flows are a powerful class of density estimation methods with exact inference. (Dinh et al., 2015) introduced affine normalizing flows with triangular Jacobians. (Dinh et al., 2017) extend flows with masked convolutions which allow for complex (non-autoregessive) dependence between the dimensions. In (Kingma & Dhariwal, 2018), $1 \times 1$ convolutions were proposed for improved image generation compared to (Dinh et al., 2017). In (Huang et al., 2018) normalizing flows are auto-regressive and (Behrmann et al., 2019) extend it to ResNet. (Lu & Huang, 2019) extended normalizing flows to model conditional distributions. Here, we propose conditional normalizing flows to learn conditional priors for variational latent models.
23
+
24
+ Variational Autoencoders. The original variational autoencoder (Kingma & Welling, 2014) used uni-modal Gaussian prior and posterior distributions. Thereafter, two lines of work have focused on developing either more expressive prior or posterior distributions. Rezende & Mohamed (2015) propose normalizing flows to model complex posterior distributions. Kingma et al. (2016); Tomczak & Welling (2016); Berg et al. (2018) present more complex inverse autoregessive flows, householder and Sylvester normalizing flow based posteriors. Here, we focus on the orthogonal direction of more expressive priors and the above approaches are compatible with our approach.
25
+
26
+ Recent work which focus more expressive priors include (Nalisnick & Smyth, 2017) which proposes a Dirichlet process prior and (Goyal et al., 2017) which proposes a nested Chinese restaurant process prior. However, these methods require sophisticated learning methods. In contrast, (Tomczak & Welling, 2018) proposes a mixture of Gaussians based prior (with fixed number of components) which is easier to train and shows promising results on some image generation tasks. (Chen et al., 2017), proposes a inverse autoregressive flow based prior which leads to improvements in complex image generation tasks like CIFAR-10. (Ziegler & Rush, 2019) proposes a prior for VAE based text generation using complex non-linear flows which allows for complex multi-modal priors. While these works focus on unconditional priors, we aim to develop more expressive conditional priors.
27
+
28
+ Posterior Collapse. Posterior collapse arises when the latent posterior does not encode useful information. Most prior work (Yang et al., 2017; Dieng et al., 2019; Higgins et al., 2017) concentrate on unconditional VAEs and modify the training objective – the KL divergence term is annealed to prevent collapse to the prior. Liu et al. (2019) extends KL annealing to CVAEs. However, KL annealing does not optimize a true lower bound of the ELBO for most of training. Zhao et al. (2017) also modifies the objective to choose the model with the maximal rate. Razavi et al. (2019) propose anti-causal sequential priors for text modelling tasks. Bowman et al. (2016); Gulrajani et al. (2017) proposes to weaken the decoder so that the latent variables cannot be ignored, however only unconditional VAEs are considered. Wang & Wang (2019) shows the advantage of normalizing flow based posteriors for preventing posterior collapse. In contrast, we study for the first time posterior collapse in conditional models on datasets with minor modes.
29
+
30
+ Structured Sequence Prediction. Helbing & Molnar (1995); Robicquet et al. (2016); Alahi et al.
31
+ (2016); Gupta et al. (2018); Zhao et al. (2019); Sadeghian et al. (2019) consider the problem of traffic participant trajectory prediction in a social context. Notably, (Gupta et al., 2018; Zhao et al., 2019;
32
+ Sadeghian et al., 2019) use generative adversarial networks to generate socially compliant trajectories.
33
+ However, the predictions are uni-modal. Starting from Bayer & Osendorfer (2014); Chung et al.
34
+
35
+ (2015), more recently Lee et al. (2017); Bhattacharyya et al. (2018); Rhinehart et al. (2018); Deo & Trivedi (2019); Pajouheshgar & Lampert (2018) considers structured (one to many) predictions using – a CVAE, improved CVAE training, pushforward policies for vehicle ego-motion prediction, motion planning, spatio-temporal convolutional network respectively. Kumar et al. (2019) proposes a normalizing flow based model for video sequence prediction, however the sequences considered have very limited diversity compared to the trajectory prediction tasks considered here. Here, we focus on improving structured predictions using conditional normalizing flows based priors.
36
+
37
+ # 3 CONDITIONAL FLOW VARIATIONAL AUTOENCODER (CF-VAE)
38
+
39
+ Our Conditional Flow Variational Autoencoder is based on the conditional variational autoencoder (Sohn et al., 2015) which is a deep directed graphical model for modeling conditional data distributions $p _ { \theta } ( \mathbf { y } | \mathbf { x } )$ . Here, $\mathbf { X }$ is the sequence up to time $t$ , $\boldsymbol { x } = \left[ x ^ { 1 } , \cdots , x ^ { t } \right]$ and $_ \textrm { y }$ is the sequence to be predicted up to time $T$ , $y = \left[ y ^ { t + 1 } , \cdot \cdot \cdot , y ^ { T } \right]$ . CVAEs factorize the conditional distribution using latent variables z. In detail, $\begin{array} { r } { p _ { \theta } ( \mathbf { y } \vert \mathbf { x } ) = \int p _ { \theta } ( \mathbf { y } \vert \mathbf { z } , \mathbf { x } ) p ( \mathbf { z } \vert \mathbf { x } ) d \mathbf { z } } \end{array}$ , where $p ( \mathbf { z } | \mathbf { x } )$ is the prior on the latent variables. During training, amortized variational inference is used and the posterior distribution $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } )$ is learnt using a recognition network. The ELBO is maximized, given by,
40
+
41
+ $$
42
+ \begin{array} { r } { \log ( p _ { \theta } ( \mathbf { y } \vert \mathbf { x } ) ) \geq \mathbb { E } _ { q _ { \phi } ( \mathbf { z } \vert \mathbf { x } , \mathbf { y } ) } \log ( p _ { \theta } ( \mathbf { y } \vert \mathbf { z } , \mathbf { x } ) ) - D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } \vert \mathbf { x } , \mathbf { y } ) \vert \vert p ( \mathbf { z } \vert \mathbf { x } ) ) . } \end{array}
43
+ $$
44
+
45
+ In practice, to simplify learning, simple unconditional standard Gaussian priors are used (Sohn et al., 2015). However, the complexity e.g. the number of modes of the target distributions $p _ { \theta } ( \mathbf { y } | \mathbf { x } )$ , is highly dependent upon the condition $x$ . An unconditional prior demands identical latent distributions irrespective complexity of the target conditional distribution – a very strong constraint on the recognition network. Moreover, the latent variables cannot encode any conditioning information and this leaves the burden of learning the dependence on the condition completely on the decoder.
46
+
47
+ Furthermore, on complex conditional multi-modal data, Gaussian priors have been shown to induce a strong model bias (Tomczak & Welling, 2016; Ziegler & Rush, 2019). It becomes increasingly difficult to map complex multi-modal distributions to uni-modal Gaussian distributions, further complicated by the sensitivity of the RNNs encoder/decoders to subtle variations in the hidden states (Bowman et al., 2016). Moreover, the standard closed form estimate of the KL-divergence pushes the encoded latent distributions to the mean of the Gaussian leading to latent variable collapse (Wang et al., 2017; Gu et al., 2018) while discriminator based approaches (Tolstikhin et al., 2017) lead to underestimates of the KL-divergence (Rosca et al., 2017).
48
+
49
+ Therefore, we propose conditional priors based on conditional normalizing flows to enable the latent variables to encode conditional information and allow for complex multi-modal latent representations. Next, we introduce our new conditional non-linear normalizing flows followed by our regularized Conditional Flow Variational Autoencoder (CF-VAE) formulation.
50
+
51
+ # 3.1 CONDITIONAL NORMALIZING FLOWS
52
+
53
+ Recently, normalizing flow (Tabak et al., 2010; Dinh et al., 2015) based priors for VAEs have been proposed (Chen et al., 2017; Ziegler & Rush, 2019). Normalizing flows allows for complex priors by transforming a simple base density e.g. standard Gaussian to a complex multi-modal density through a series of $n$ layers of invertible transformations $f _ { i }$ ,
54
+
55
+ $$
56
+ \epsilon \longleftrightarrow { \mathrm { h _ { 1 } } } \longleftrightarrow { \mathrm { h _ { 2 } } } \to { \mathrm { h _ { 2 } } } \cdots \langle ^ { f _ { n } } \rangle { \mathrm { z } } .
57
+ $$
58
+
59
+ However, such flows cannot model conditional priors. In contrast to prior work, we utilize conditional normalizing flows to model complex conditional priors. Conditional normalizing flows also consists of a series of $n$ layers of invertible transformations $f _ { i }$ (with parameters $\psi$ ), however we modify the transformations $f _ { i }$ such that they are dependent on the condition $\mathbf { X }$ ,
60
+
61
+ $$
62
+ \epsilon | \mathbf { x } \ { \overset { f _ { 1 } | \mathbf { x } } { \longleftrightarrow } } \ \mathbf { h } _ { 1 } | \mathbf { x } \ { \overset { f _ { 2 } | \mathbf { x } } { \longleftrightarrow } } \ \mathbf { h } _ { 2 } | \mathbf { x } \cdot \cdot \cdot \ { \overset { f _ { n } | \mathbf { x } } { \longleftrightarrow } } \ \mathbf { z } | \mathbf { x } .
63
+ $$
64
+
65
+ Further, in contrast to prior work (Lu & Huang, 2019; Atanov et al., 2019; Ardizzone et al., 2019) which use affine flows $( f _ { i } )$ , we build upon (Ziegler & Rush, 2019) and introduce conditional nonlinear normalizing flows with split coupling. Split couplings ensure invertibility by applying a flow
66
+
67
+ layer $f _ { i }$ on only half of the dimensions at a time. To compute (5), we split the dimensions $\boldsymbol { z } ^ { D }$ of the latent variable into halfs, $\mathbf { z } ^ { L } = \{ 1 , \cdots , D / 2 \}$ and $\mathsf { z } ^ { R } = \{ \overset { \cdot } { D } / 2 , \cdot \cdot \cdot , d \}$ at each invertible layer $f _ { i }$ . Our transformation takes the following form for each dimension $\mathbf { z } ^ { j }$ alternatively from $ { \boldsymbol { z } } ^ { L }$ or $\hat { z ^ { R } }$ ,
68
+
69
+ $$
70
+ f _ { i } ^ { - 1 } ( z ^ { j } | z ^ { R } , \mathbf { x } ) = \epsilon ^ { j } = a ( \mathbf { z } ^ { R } , \mathbf { x } ) + b ( \mathbf { z } ^ { R } , \mathbf { x } ) \times \mathbf { z } ^ { j } + \frac { c ( \mathbf { z } ^ { R } , \mathbf { x } ) } { 1 + \big ( d ( \mathbf { z } ^ { R } , \mathbf { x } ) \times \mathbf { z } ^ { j } + g \big ( \mathbf { z } ^ { R } , \mathbf { x } \big ) \big ) ^ { 2 } } .
71
+ $$
72
+
73
+ where, $\mathbf { z } ^ { j } \in \mathbf { z } ^ { L }$ . Details of the forward (generating) operation $f _ { i }$ are in Appendix A. To ensure that the generated prior distribution is conditioned on $\mathbf { X }$ , in (4) and in the corresponding forward operation $f _ { i }$ , the coefficients $\{ a , b , c , d , g \} \in \mathbb { R }$ are functions of both the other half of the dimensions of $\mathbf { Z }$ and the condition $\mathbf { X }$ (unlike Ziegler $\&$ Rush (2019)). Finally, due to the expressive power of our conditional non-linear normalizing flows, simple spherical Gaussians base distributions were sufficient.
74
+
75
+ # 3.2 VARIATIONAL INFERENCE USING CONDITIONAL NORMALIZING FLOWS BASED PRIORS
76
+
77
+ Here, we derive the ELBO (1) for our regularized CF-VAE with our conditional flow based prior. In case of the standard CVAE with the Gaussian prior, the KL divergence term in the ELBO has a simple closed form expression. In case of our conditional flow based prior, we can use the change of variables formula to compute the KL divergence. In detail, given the base density $p ( \epsilon \vert \mathbf { x } )$ and the Jacobian $J _ { i }$ of each layer $i$ of the transformation, the log-likelihood of the latent variable $\mathbf { Z }$ under the prior can be expressed using the change of variables formula,
78
+
79
+ $$
80
+ \log ( p _ { \psi } ( \mathbf { \boldsymbol { z } } | \mathbf { \boldsymbol { x } } ) ) = \log ( p ( \boldsymbol { \epsilon } | \mathbf { \boldsymbol { x } } ) ) + \sum _ { i = 1 } ^ { n } \log ( | \operatorname* { d e t } J _ { i } | ) .
81
+ $$
82
+
83
+ This change of variables allows us to evaluate the likelihood of latent variable $\mathbf { Z }$ over the base distribution instead of the complex conditional prior and to express the KL divergence as,
84
+
85
+ $$
86
+ \begin{array} { r l r } { { - D _ { \mathrm { K L } } ( q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) | | p _ { \psi } ( \mathbf { z } | \mathbf { x } ) ) = - \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) } \log ( q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) ) + \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) } \log ( p _ { \psi } ( \mathbf { z } | \mathbf { x } ) ) } } \\ & { } & { = \mathcal { H } ( q _ { \phi } ) + \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } ) } \log ( p ( \boldsymbol { \epsilon } | \mathbf { x } ) ) + \sum _ { i = 1 } ^ { n } \log ( | \operatorname* { d e t } J _ { i } | ) . } \end{array}
87
+ $$
88
+
89
+ where, $\mathcal { H } ( q _ { \phi } )$ is the entropy of the variational distribution. Therefore, the ELBO can be expressed as,
90
+
91
+ $$
92
+ \log ( p _ { \theta } ( \mathbf { y } | \mathbf { x } ) ) \geq \mathbb { E } _ { q _ { \phi } ( z | \mathbf { x } , \mathbf { y } ) } \log ( p _ { \theta } ( \mathbf { y } | \mathbf { z } , \mathbf { x } ) ) + \mathcal { H } ( q _ { \phi } ) + \mathbb { E } _ { q _ { \phi } ( z | \mathbf { x } , \mathbf { y } ) } \log ( p ( \boldsymbol { \epsilon } | \mathbf { x } ) ) + \sum _ { i = 1 } ^ { n } \log ( | \operatorname* { d e t } J _ { i } | )
93
+ $$
94
+
95
+ To learn complex conditional priors, we alternately optimize both the variational posterior distribution $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } )$ and the conditional prior ${ \dot { p } } _ { \psi } ( { \bf z } | { \bf x } )$ in (7). This would allow the variational posterior $q _ { \theta }$ to match the conditional prior and vice-versa so that the ELBO (7) is maximized. However, in practice we observe instabilities during training and posterior collapse. Next, we introduce our novel regularization schemes to deal with both these problems.
96
+
97
+ Posterior Regularization for Stability $\mathbf { \Pi } ( \mathbf { p } \mathbf { R } )$ . The entropy and the log-Jacobian of the CF-VAE objective (7) are at odds with each other. The log-Jacobian favours the contraction of the base density. Therefore, log-Jacobian at the right of (7) is maximized when the conditional flow maps the base distribution $( \epsilon z$ in Figure 2) to a low entropy conditional prior and thus a low entropy variational distribution $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } )$ . Therefore, in practice we observe instabilities during training. We observe that either the entropy or the log-Jacobian term dominates and the data log-likelihood is fully or partially ignored. Therefore, we regularize the posterior $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } )$ by fixing the variance to C. This leads to a constant entropy term which in turn bounds the maximum possible amount of contraction, thus upper bounding the log-Jacobian. This encourages our model to concentrate on explaining the data and leads better fit to the target data distribution. Note that, although $q _ { \phi } ( \mathbf { z } | \mathbf { x } , \mathbf { y } )$
98
+
99
+ ![](images/86b295e9ae3398cb690828a8b3a03114f9ecb10a4d0d6a2ef3882dfcfed39582.jpg)
100
+ Figure 2: CF-VAE. The decoder is regularized by removing conditioning (grey arrow) to prevent posterior collapse.
101
+
102
+ has fixed variance, this does not significantly effect sample quality as the marginal $q _ { \phi } ( \mathbf { z } | \mathbf { x } )$ can be arbitrarily complex due to our conditional flow prior. Moreover, we observe that the LSTM based decoders employed demonstrate robust performance across a wide range of values $\mathbf { C } = [ 0 . 0 5 , 0 . 2 5 ]$
103
+
104
+ Condition Regularization for Posterior Collapse (cR). We observe missing modes when the target conditional data distribution has a major mode(s) and one or more minor modes (corresponding to rare events). This is because the condition x on the decoder is already enough to model the main mode(s). If the cost of ignoring the minor modes is out-weighed by the cost of encoding a more complex latent distribution reflecting all modes, the minor modes and the latent variables are ignored. We propose a regularization scheme by removing the additional conditioning $\mathbf { X }$ on the decoder, when the dataset in question has a dominating mode(s). This enabled by our conditional flow prior, which ensures that conditioning information is encoded in the latent space and $p _ { \theta } ( \mathbf { y } | \mathbf { z } )$ can match $p _ { \theta } ( \mathbf { y } | \mathbf { x } , \mathbf { z } )$ . Leading to a simpler factorization, $\begin{array} { r } { p _ { \theta } ( \mathbf { y } | \mathbf { x } ) = \int p _ { \theta } ( \mathbf { y } | \mathbf { z } ) p _ { \psi } ( \mathbf { z } | \mathbf { x } ) d \mathbf { z } } \end{array}$ . Equivalently, this ensures that the latent variable z cannot be ignored by the CF-VAE and thus must encode useful information. Note that this regularization scheme is only possible due to our conditional prior, the unconditional Gaussian prior of CVAE would always need to condition the decoder.
105
+
106
+ The parallel work of Klushyn et al. (2019) also proposes a similar regularization scheme. However, we employ this regularization to deal with posterior collapse only in case of distributions with dominant modes. We also provide a more detailed analysis of their proposed prior in Appendix E.
107
+
108
+ Finally, we discuss the integration of diverse sources of contextual information into the conditional prior $p _ { \psi } ( { \boldsymbol { \mathbf { z } } } | { \boldsymbol { \mathbf { x } } } )$ for even richer conditional latent distributions of our regularized CF-VAE.
109
+
110
+ # 3.3 CONDITIONING PRIORS ON CONTEXTUAL INFORMATION
111
+
112
+ For prediction tasks, it is often crucial to integrate sources of contextual information e.g. past trajectories or environmental information for accurate predictions. As these sources are heterogeneous, we employ source specific networks to extract fixed length vectors from each source.
113
+
114
+ Past Trajectory. We encode the past trajectories using a LSTM to an fixed length vector $\mathbf { X } _ { t }$ . For efficiency we share the condition encoder between the conditional flow and the CF-VAE decoder.
115
+
116
+ Environmental Map. We use a CNN to encode environmental information to a set of region specific feature vectors. We apply attention conditioned on the past trajectory to extract a fixed length conditioning vector $\mathbf { X } _ { m }$ , such that $\mathbf { X } _ { m }$ contains information relevant to the future trajectory.
117
+
118
+ Interacting Agents. To encode information of interacting traffic participants/agents, we build on Deo & Trivedi (2018) and propose a fully convolutional social pooling layer. We aggregate information of interacting agents using a grid overlayed on the environment. This grid is represented using a tensor, where the past trajectory information of traffic participants are aggregated into the tensor indexed corresponding to the grid in the environment. In Deo & Trivedi (2018) past trajectory information is aggregated using a LSTM. We aggregate the past trajectory information into the tensor using $1 \times 1$ convolutions as it allows for stable learning and is computationally efficient. Finally, we apply several layers of $k \times k$ convolutions to capture interaction aware contextual features $\mathbf { X } _ { p }$ of traffic participants in the scene.
119
+
120
+ Due to the expressive power of our conditional non-linear normalizing flows, simple concatenation into a single vector $\mathbf { x } = \left\{ { \mathbf { x } } _ { t } , { \mathbf { x } } _ { m } , { \mathbf { x } } _ { t } \right\}$ was sufficient to learn powerful conditional priors.
121
+
122
+ # 4 EXPERIMENTS
123
+
124
+ We evaluate our CF-VAE on three popular and highly multi-modal sequence prediction datasets. We begin with a description of our evaluation metrics and model architecture.
125
+
126
+ Evaluation Metrics. In line with prior work (Lee et al., 2017; Bhattacharyya et al., 2018; Pajouheshgar & Lampert, 2018; Deo & Trivedi, 2019; Bhattacharyya et al., 2019), we use the negative conditional log-likelihood (-CLL) and mean Euclidean distances of the oracle Top $n \%$ of $N$ predictions. The oracle Top $n \%$ metric measures not only the coverage of all modes but also discourages random guessing for a reasonably large value of $n$ (e.g. $n = 1 0 \%$ ). This is because, a model can only improve this metric by moving randomly guessed samples from an overestimated mode to the correct modes (detailed analysis in Appendix F).
127
+
128
+ ![](images/bc15a1a4cd35f188f2ad3cb9c4662d11886de5162e0be0b775766c1ecd61fb15.jpg)
129
+ Figure 3: Random samples clustered using k-means. The number of clusters is set manually to the number of expected digits. The corresponding priors of our $\mathrm { C F - V A E + p R }$ on the right. Note, our 64D CF-VAE latent distribution is (approximately) projected to 2D using tSNE and KDE.
130
+
131
+ Conditional Flow Model Architecture. Our conditional flow prior consists of 16 layers of conditional non-linear flows with split coupling. Increasing the number of conditional non-linear flows generally led to “over-fitting” on the training latent distribution.
132
+
133
+ # 4.1 MNIST SEQUENCES
134
+
135
+ The MNIST Sequence dataset (D. De Jong, 2016) consists of sequences of handwriting strokes of the MNIST digits. The state-of-the-art approach is the “Best-of-Many”-CVAE (Bhattacharyya et al., 2018) with a Gaussian prior. We follow the evaluation protocol of Bhattacharyya et al. (2018) and predict the complete stroke given the first ten steps. We also compare with, 1. A standard CVAE with uni-modal Gaussian prior; 2. A CVAE with a data dependent conditional mixture of Gaussians (MoG) prior; 3. A CF-VAE without any regularization ; 4. A CF-VAE without the conditional non-linear flow layers (CF-VAE-Affine, replaced with affine flows (Lu & Huang, 2019; Atanov et al., 2019)). We also experiment with a conditional MoG prior (see Appendix D and E). We use the same model architecture (Bhattacharyya et al., 2018) across all baselines.
136
+
137
+ We report the results in Table 1. We see that our CFVAE with posterior regularization (pR) performs best. It has a performance advantage of over $20 \%$ against the state of the art BMS-CVAE. We see that without regularization $\left( \mathrm { p R } \right)$ $\mathrm { { C } = 0 . 2 }$ ) there is a $40 \%$ drop in performance, highlighting the effectiveness of our proposed regularization scheme. We further illustrate the modes captured and the learnt multi-modal conditional flow priors in Figure 3. We do not use condition regularization here (cR) as we do not observe posterior collapse. In contrast, the BMS-CVAE is unable to fully capture all modes – its predictions are pushed to the mean due to the strong model bias induced by the Gaussian prior. The results improve considerably with the multi-modal MoG prior $M = 3$ components work best). We also experiment with optimizing the standard CVAE architecture. This improves performance only slightly (after increasing LSTM encoder/decoder units to 256 from 48, increasing the number of layers did not help). Moreover, our experiments with a conditional (MoG) AAE/WAE (Gu et al., 2018) based baseline did not improve performance beyond the standard (MoG) CVAE, because the discriminator based KL estimate tends to be an underestimate (Rosca et al., 2017). This illustrates that in practice it is difficult to map highly multi-modal sequences to a Gaussian prior and highlights the need of a data-dependent multi-modal priors. Our CF-VAE still significantly outperforms the MoG-CVAE as normalizing flows are better at learning complex multi-modal distributions (Kingma & Dhariwal, 2018). We also see that affine conditional flow based priors leads to a drop in performance (77.2 vs 74.9 CLL) illustrating the advantage of our non-linear conditional flows.
138
+
139
+ Table 1: Evaluation on MNIST Sequences.
140
+
141
+ <table><tr><td>Method</td><td>-CLL↓</td></tr><tr><td>CVAE (Sohn et al.,2015)</td><td>96.4</td></tr><tr><td>BMS-CVAE (Bhattacharyya et al., 2018)</td><td>95.6</td></tr><tr><td>CVAE+ increased capacity (Ours)</td><td>94.5</td></tr><tr><td>CVAE + conditional prior (Ours)</td><td>88.9</td></tr><tr><td>MoG-CVAE,M= 3</td><td>84.6</td></tr><tr><td>CF-VAE -no regularization (Ours)</td><td>104.3</td></tr><tr><td>CF-VAE - Affine + pR, C = 0.2 (Ours)</td><td>77.2</td></tr><tr><td>CF-VAE + pR,C= 0.2 (Ours)</td><td>74.9</td></tr></table>
142
+
143
+ Sampled Predictions Latent Prior Sampled Predictions Latent Prior Sampled Predictions Latent Prior
144
+
145
+ <table><tr><td>Method</td><td>Visual</td><td>Error @1sec</td><td>Error@ 2sec</td><td>Error @ 3sec</td><td>Error@4sec</td><td>-CLL↓</td></tr><tr><td>“Shotgun&quot;(Top 10%)(Pajouheshgar &amp; Lampert,2018)</td><td>None</td><td>0.7</td><td>1.7</td><td>3.0</td><td>4.5</td><td>91.6</td></tr><tr><td>DESIRE-SI-IT4 (Top 10%) (Lee et al.,2017)</td><td>RGB</td><td>1.2</td><td>2.3</td><td>3.4</td><td>5.3</td><td>X</td></tr><tr><td>STCNN (Top 10%)(Pajouheshgar &amp; Lampert, 2018)</td><td>RGB</td><td>1.2</td><td>2.1</td><td>3.3</td><td>4.6</td><td>X</td></tr><tr><td>BMS-CVAE(Top 10%)(Bhattacharyya et al.,2018)</td><td>RGB</td><td>0.8</td><td>1.7</td><td>3.1</td><td>4.6</td><td>126.6</td></tr><tr><td>MoG-CVAE,M=3(Top 10%)</td><td>None</td><td>0.8</td><td>1.7</td><td>2.7</td><td>3.9</td><td>86.1</td></tr><tr><td>CF-VAE- no regularization (Ours,Top 10%)</td><td>None</td><td>0.9</td><td>1.9</td><td>3.3</td><td>4.7</td><td>96.2</td></tr><tr><td>CF-VAE+pR,C= 0.2 (Ours,Top 10%)</td><td>None</td><td>0.7</td><td>1.5</td><td>2.5</td><td>3.6</td><td>84.6</td></tr><tr><td>CF-VAE+ pR,C= 0.2(Ours,Top 10%)</td><td>RGB</td><td>0.7</td><td>1.5</td><td>2.4</td><td>3.5</td><td>84.1</td></tr></table>
146
+
147
+ Table 2: Five fold cross validation on the Stanford Drone dataset. Euclidean error at $( 1 / 5 )$ resolution.
148
+
149
+ # 4.2 STANFORD DRONE
150
+
151
+ ![](images/f9410f85f74be21149edc7c0684080d5141c2ddf06f3bb6f7c5f8ff2bdda370c.jpg)
152
+ Figure 4: Randomly sampled predictions of our CF-VAE $^ +$ pR model on the Stanford Drone. We observe that our prediction are highly multi-modal and is reflected by the Conditional Flow Priors. Note, our 64D CF-VAE latent distribution is (approximatly) projected to 2D using tSNE and KDE.
153
+
154
+ ![](images/fe6f9329e565ee70293a41a0ed330f4a45591301f3759d178dc6f17ec8a71a8b.jpg)
155
+ Figure 5: Comparison of our CF-VAE $^ +$ pR (Red) and the “Shoutgun” baseline (Yellow) of (Pajouheshgar & Lampert, 2018), Groundtruth (Blue). Initial conditioning trajectory in white. Our CF-VAE not only learns to capture the correct modes but also generates more fine-grained predictions.
156
+
157
+ The Stanford Drone dataset (Robicquet et al., 2016) consists of multi-model trajectories of traffic participant e.g. pedestrians, bicyclists, cars captured from a drone. Prior works follow two different evaluation protocols, 1. (Lee et al., 2017; Bhattacharyya et al., 2018; Pajouheshgar & Lampert, 2018) use 5 fold cross validation, 2. (Robicquet et al., 2016; Sadeghian et al., 2018; 2019; Deo & Trivedi, 2019) use a single split. We evaluate using the first protocol in Table 2 and the second in Table 3.
158
+
159
+ Additionally, Pajouheshgar & Lampert (2018) suggest a “Shotgun” baseline. This baseline extrapolates the trajectory from the last known position and orientation in 10 different ways – 5 orientations: $( 0 ^ { \circ } , \pm 8 ^ { \circ } , \pm 1 5 ^ { \circ } )$ and 5 velocities: None or exponentially weighted over the past with coefficients (0, 0.3, 0.7, 1.0). This baseline obtains results at par with the state-of-the-art because it a good template which covers the most likely possible futures (modes) for traffic participant motion in this dataset. We report the results using 5 fold cross validation in Table 2. We additionally compare to a mixture of Gaussians prior (Appendix D). We use the same model architecture as in Bhattacharyya et al. (2018) and a CNN encoder with attention to extract features from the last observed RGB image (Appendix C). These visual features serve as additional conditioning $\left( \mathbf { { x } } _ { m } \right)$ to our Conditional Flow model. We see that our CF-VAE model with RGB input and posterior regularization $\left( \mathrm { p R } \right)$ performs best – outperforming the state-of-art “Shotgun” and BMS-CVAE by over $20 \%$ (Error $@$ 4sec). We see that our conditional flows are able to utilize visual scene (RGB) information to improve performance (3.5 vs 3.6 Error $@$ 4sec). We also see that the MoG-CVAE and our $\mathrm { C F - V A E + p R }$ outperforms the BMS-CVAE, even without visual scene information. This again reinforces our claim that the standard Gaussian prior induces a strong model bias and data dependent multi-modal priors are needed for best performance. The performance advantage of CF-VAE over the MoG-CVAE again illustrates the advantage of normalizing flows at learning complex conditional multi-modal distributions. The performance advantage over the “Shotgun” baseline shows that our $\mathrm { C F - V A E + p R }$ not only learns to capture the correct modes but also generates more fine-grained predictions. The qualitative examples in Figure 5 shows that our CF-VAE is better able to capture complex trajectories with sharp turns.
160
+
161
+ <table><tr><td>Method</td><td>mADE↓</td><td>mFDE↓</td></tr><tr><td>SocialGAN(Gupta et al., 2018)</td><td>27.2</td><td>41.4</td></tr><tr><td>MATF GAN (Zhao et al., 2019)</td><td>22.5</td><td>33.5</td></tr><tr><td>SoPhie (Sadeghian et al., 2019)</td><td>16.2</td><td>29.3</td></tr><tr><td>Goal Prediction (Deo &amp; Trivedi,2019)</td><td>15.7</td><td>28.1</td></tr><tr><td>CF-VAE+pR,C=0.2(Ours)</td><td>12.6</td><td>22.3</td></tr></table>
162
+
163
+ Table 3: Evaluation on the Stanford Drone dataset on a single split (see also Table 2).
164
+
165
+ We report results using the single train/test split of (Robicquet et al., 2016; Sadeghian et al., 2018; 2019; Deo & Trivedi, 2019) in Table 3. We use the minimum Average Displacement Error (mADE) and minimum Final Displacement Error (mFDE) metrics as in (Deo & Trivedi, 2019). The minimum is over as set of predictions of size $N$ . Although this metric is less robust to random guessing compared to the Top $n \%$ metric, it avoids rewarding random guessing for a small enough value of $N$ . We choose $N = 2 0$ as in (Deo & Trivedi, 2019). Similar to the results with 5 fold cross validation, we observe $20 \%$ improvement over the state-of-the-art.
166
+
167
+ # 4.3 HIGHD
168
+
169
+ The HighD dataset (Krajewski et al., 2018) consists of vehicle trajectories recorded using a drone over highways. In contrast to other vehicle trajectory datasets e.g. NGSIM it contains minimal false positive trajectory collisions or physically improvable velocities.
170
+
171
+ The HighD dataset is challenging because lane changes or interactions are rare $\sim 1 0 \%$ of all trajectories. The distribution of future trajectories contain a single main mode (linear continuations) along with several minor modes. Thus, approaches which predict a single mean trajectory (targeting the main mode) are challenging to outperform. In Table 4, we see that the simple Feed Forward (FF) model performs well and the Graph
172
+
173
+ <table><tr><td>Method</td><td>Context</td><td>ADE↓</td><td>FDE↓</td><td>-CLL↓</td></tr><tr><td>Constant Velocity</td><td>None</td><td>1.09</td><td>2.66</td><td>X</td></tr><tr><td>FF (Diehl et al.,2019)</td><td>None</td><td>0.45</td><td>1.09</td><td>X</td></tr><tr><td>GAT (Diehl et al., 2019)</td><td>Yes</td><td>0.47</td><td>1.04</td><td>X</td></tr><tr><td>CVAE(Top 10%)</td><td>None</td><td>0.45</td><td>0.96</td><td>5.32</td></tr><tr><td>CVAE+Cyclic KL(Top 10%)</td><td>None</td><td>0.38</td><td>0.80</td><td>4.80</td></tr><tr><td>CF-VAE + pR,(Ours,Top 10%)</td><td>None</td><td>0.44</td><td>0.94</td><td>4.71</td></tr><tr><td>CF-VAE+{pR,cR},(Ours,Top 10%)</td><td>None</td><td>0.30</td><td>0.57</td><td>3.64</td></tr><tr><td>CF-VAE+{pR.cR},(Ours,Top 10%)</td><td>Yes</td><td>0.29</td><td>0.55</td><td>3.42</td></tr></table>
174
+
175
+ Table 4: Evaluation on the HighD dataset.
176
+
177
+ Convolutional GAT model of Diehl et al. (2019), which captures interactions, only narrowly outperforms the FF model. This dataset is challenging for CVAE based models as they frequently suffer from posterior collapse when a single mode dominates. This is clearly observed with our CVAE baseline in Table 4. To prevent posterior collapse, we use the cyclic KL annealing scheme proposed in Liu et al. (2019) (using a MoG prior did not help). This already leads to significant improvement over the deterministic FF and GAT baselines. We also observe posterior collapse with our CF-VAE model. Therefore, we regularize by removing additional conditioning (cR). Our $\mathrm { C F - V A E + \{ p R , c R \} }$ with condition regularization significantly outperforms the $\mathrm { C F - V A E + p R }$ and CVAE baselines (with cyclic KL annealing), demonstrating the effectiveness of our condition regularization scheme (cR) in preventing posterior collapse. The addition of contextual information of interacting traffic participants using our convolutional social pooling network with $1 \times 1$ convolutions significantly improves performance (also see Appendix G), demonstrating the effectiveness of our conditional normalizing flow based priors.
178
+
179
+ # 5 CONCLUSION
180
+
181
+ In this work, we presented the first variational model for learning multi-modal conditional data distributions with Conditional Flow based priors – the Conditional Flow Variational Autoencoder (CF-VAE). Furthermore, we propose two novel regularization techniques – posterior regularization (pR) and condition regularization (cR) – which stabilizes training solutions and prevents posterior collapse leading to better fit to the target distribution. This techniques lead to better match to the target distribution. Our experiments on diverse sequence prediction datasets show that our CF-VAE achieves state-of-the-art results across different performance metrics.
182
+
183
+ # REFERENCES
184
+
185
+ Alexandre Alahi, Kratarth Goel, Vignesh Ramanathan, Alexandre Robicquet, Li Fei-Fei, and Silvio Savarese. Social lstm: Human trajectory prediction in crowded spaces. In CVPR, 2016.
186
+
187
+ Lynton Ardizzone, Jakob Kruse, Sebastian Wirkert, Daniel Rahner, Eric W Pellegrini, Ralf S Klessen, Lena Maier-Hein, Carsten Rother, and Ullrich Kothe. Analyzing inverse problems with invertible ¨ neural networks. In ICLR, 2019.
188
+
189
+ Andrei Atanov, Alexandra Volokhova, Arsenii Ashukha, Ivan Sosnovik, and Dmitry Vetrov. Semiconditional normalizing flows for semi-supervised learning. In ICML Workshop, 2019.
190
+
191
+ Mohammad Babaeizadeh, Chelsea Finn, Dumitru Erhan, Roy H Campbell, and Sergey Levine. Stochastic variational video prediction. In ICLR, 2018.
192
+
193
+ Justin Bayer and Christian Osendorfer. Learning stochastic recurrent networks. arXiv preprint arXiv:1411.7610, 2014.
194
+
195
+ Jens Behrmann, David Duvenaud, and Jorn-Henrik Jacobsen. Invertible residual networks. In ¨ ICML, 2019.
196
+
197
+ Rianne van den Berg, Leonard Hasenclever, Jakub M Tomczak, and Max Welling. Sylvester normalizing flows for variational inference. In UAI, 2018.
198
+
199
+ Apratim Bhattacharyya, Bernt Schiele, and Mario Fritz. Accurate and diverse sampling of sequences based on a best of many sample objective. In CVPR, 2018.
200
+
201
+ Apratim Bhattacharyya, Mario Fritz, and Bernt Schiele. Bayesian prediction of future street scenes using synthetic likelihoods. In ICLR, 2019.
202
+
203
+ Samuel R Bowman, Luke Vilnis, Oriol Vinyals, Andrew M Dai, Rafal Jozefowicz, and Samy Bengio. Generating sentences from a continuous space. CONLL, 2016.
204
+
205
+ Xi Chen, Diederik P Kingma, Tim Salimans, Yan Duan, Prafulla Dhariwal, John Schulman, Ilya Sutskever, and Pieter Abbeel. Variational lossy autoencoder. In ICLR, 2017.
206
+
207
+ Junyoung Chung, Kyle Kastner, Laurent Dinh, Kratarth Goel, Aaron C Courville, and Yoshua Bengio. A recurrent latent variable model for sequential data. In NIPS, 2015.
208
+
209
+ Edwin D. De Jong. The mnist sequence dataset. https://edwin-de-jong.github.io/ blog/mnist-sequence-data/, 2016. Accessed: 2019-07-07.
210
+
211
+ Nachiket Deo and Mohan M Trivedi. Convolutional social pooling for vehicle trajectory prediction. In CVPR Workshop, 2018.
212
+
213
+ Nachiket Deo and Mohan M Trivedi. Scene induced multi-modal trajectory forecasting via planning. In ICRA Workshop, 2019.
214
+
215
+ Frederik Diehl, Thomas Brunner, Michael Truong Le, and Alois Knoll. Graph neural networks for modelling traffic participant interaction. In ITSC, 2019.
216
+
217
+ Adji B Dieng, Yoon Kim, Alexander M Rush, and David M Blei. Avoiding latent variable collapse with generative skip models. AISTATS, 2019.
218
+
219
+ Laurent Dinh, David Krueger, and Yoshua Bengio. Nice: Non-linear independent components estimation. In ICLR, 2015.
220
+
221
+ Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real nvp. In ICLR, 2017.
222
+
223
+ Prasoon Goyal, Zhiting Hu, Xiaodan Liang, Chenyu Wang, and Eric P Xing. Nonparametric variational auto-encoders for hierarchical representation learning. In ICCV, 2017.
224
+
225
+ Xiaodong Gu, Kyunghyun Cho, Jung-Woo Ha, and Sunghun Kim. Dialogwae: Multimodal response generation with conditional wasserstein auto-encoder. arXiv preprint arXiv:1805.12352, 2018.
226
+
227
+ Ishaan Gulrajani, Kundan Kumar, Faruk Ahmed, Adrien Ali Taiga, Francesco Visin, David Vazquez, and Aaron Courville. Pixelvae: A latent variable model for natural images. In ICLR, 2017.
228
+
229
+ Agrim Gupta, Justin Johnson, Li Fei-Fei, Silvio Savarese, and Alexandre Alahi. Social gan: Socially acceptable trajectories with generative adversarial networks. In CVPR, 2018.
230
+
231
+ Dirk Helbing and Peter Molnar. Social force model for pedestrian dynamics. Physical review E, 51, 1995.
232
+
233
+ 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.
234
+
235
+ Matthew D Hoffman and Matthew J Johnson. Elbo surgery: yet another way to carve up the variational evidence lower bound. In NIPS Workshop, 2016.
236
+
237
+ GC Holmes. The use of hyperbolic cosines in solving cubic polynomials. The Mathematical Gazette.
238
+
239
+ Chin-Wei Huang, David Krueger, Alexandre Lacoste, and Aaron Courville. Neural autoregressive flows. In ICML, 2018.
240
+
241
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In ICLR, 2014.
242
+
243
+ Durk P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. In NeurIPS, 2018.
244
+
245
+ Durk P Kingma, Tim Salimans, Rafal Jozefowicz, Xi Chen, Ilya Sutskever, and Max Welling. Improved variational inference with inverse autoregressive flow. In NIPS, 2016.
246
+
247
+ Alexej Klushyn, Nutan Chen, Botond Cseke, Justin Bayer, and Patrick van der Smagt. Increasing the generalisaton capacity of conditional vaes. In ICANN, 2019.
248
+
249
+ Robert Krajewski, Julian Bock, Laurent Kloeker, and Lutz Eckstein. The highd dataset: A drone dataset of naturalistic vehicle trajectories on german highways for validation of highly automated driving systems. In ITSC, 2018.
250
+
251
+ Manoj Kumar, Mohammad Babaeizadeh, Dumitru Erhan, Chelsea Finn, Sergey Levine, Laurent Dinh, and Durk Kingma. Videoflow: A flow-based generative model for video. arXiv preprint arXiv:1903.01434, 2019.
252
+
253
+ Namhoon Lee, Wongun Choi, Paul Vernaza, Christopher B Choy, Philip HS Torr, and Manmohan Chandraker. Desire: Distant future prediction in dynamic scenes with interacting agents. In CVPR, 2017.
254
+
255
+ Xiaodong Liu, Jianfeng Gao, Asli Celikyilmaz, Lawrence Carin, et al. Cyclical annealing schedule: A simple approach to mitigating kl vanishing. In NAACL, 2019.
256
+
257
+ You Lu and Bert Huang. Structured output learning with conditional generative flows. In ICML Workshop, 2019.
258
+
259
+ Eric Nalisnick and Padhraic Smyth. Stick-breaking variational autoencoders. In ICLR, 2017.
260
+
261
+ Ehsan Pajouheshgar and Christoph H Lampert. Back to square one: probabilistic trajectory forecasting without bells and whistles. In NeurIPs Workshop, 2018.
262
+
263
+ Ali Razavi, Aaron van den Oord, Ben Poole, and Oriol Vinyals. Preventing posterior collapse with ¨ delta-vaes. In ICLR, 2019.
264
+
265
+ Danilo Jimenez Rezende and Shakir Mohamed. Variational inference with normalizing flows. In ICML, 2015.
266
+
267
+ Nicholas Rhinehart, Kris M Kitani, and Paul Vernaza. R2p2: A reparameterized pushforward policy for diverse, precise generative path forecasting. In ECCV, 2018.
268
+
269
+ Alexandre Robicquet, Amir Sadeghian, Alexandre Alahi, and Silvio Savarese. Learning social etiquette: Human trajectory understanding in crowded scenes. In ECCV, 2016.
270
+
271
+ Mihaela Rosca, Balaji Lakshminarayanan, David Warde-Farley, and Shakir Mohamed. Variational approaches for auto-encoding generative adversarial networks. arXiv preprint arXiv:1706.04987, 2017.
272
+
273
+ Amir Sadeghian, Ferdinand Legros, Maxime Voisin, Ricky Vesel, Alexandre Alahi, and Silvio Savarese. Car-net: Clairvoyant attentive recurrent network. In ECCV, 2018.
274
+
275
+ Amir Sadeghian, Vineet Kosaraju, Ali Sadeghian, Noriaki Hirose, S Hamid Rezatofighi, and Silvio Savarese. Sophie: An attentive gan for predicting paths compliant to social and physical constraints. In CVPR, 2019.
276
+
277
+ Kihyuk Sohn, Honglak Lee, and Xinchen Yan. Learning structured output representation using deep conditional generative models. In NIPS, 2015.
278
+
279
+ Esteban G Tabak, Eric Vanden-Eijnden, et al. Density estimation by dual ascent of the log-likelihood. In Communications in Mathematical Sciences, volume 8, 2010.
280
+
281
+ Ilya Tolstikhin, Olivier Bousquet, Sylvain Gelly, and Bernhard Schoelkopf. Wasserstein auto-encoders. arXiv preprint arXiv:1711.01558, 2017.
282
+
283
+ Jakub M Tomczak and Max Welling. Improving variational auto-encoders using householder flow. In NIPS Workshop, 2016.
284
+
285
+ Jakub M Tomczak and Max Welling. Vae with a vampprior. In AISTATS, 2018.
286
+
287
+ Liwei Wang, Alexander Schwing, and Svetlana Lazebnik. Diverse and accurate image description using a variational auto-encoder with an additive gaussian encoding space. In Advances in Neural Information Processing Systems, pp. 5756–5766, 2017.
288
+
289
+ Prince Zizhuang Wang and William Yang Wang. Riemannian normalizing flow on variational wasserstein autoencoder for text modeling. In NAACL, 2019.
290
+
291
+ Zichao Yang, Zhiting Hu, Ruslan Salakhutdinov, and Taylor Berg-Kirkpatrick. Improved variational autoencoders for text modeling using dilated convolutions. In ICML, 2017.
292
+
293
+ Shengjia Zhao, Jiaming Song, and Stefano Ermon. Infovae: Information maximizing variational autoencoders. In arXiv preprint arXiv:1706.02262, 2017.
294
+
295
+ Tianyang Zhao, Yifei Xu, Mathew Monfort, Wongun Choi, Chris Baker, Yibiao Zhao, Yizhou Wang, and Ying Nian Wu. Multi-agent tensor fusion for contextual trajectory prediction. In CVPR, 2019.
296
+
297
+ Zachary M Ziegler and Alexander M Rush. Latent normalizing flows for discrete sequences. In ICML, 2019.
298
+
299
+ # APPENDIX A. CONDITIONAL NON-LINEAR NORMALIZING FLOWS
300
+
301
+ In Subsection 3.1 of the main paper, we describe the inverse operation $f _ { i } ^ { - 1 }$ of our non-linear conditional normalizing flows. Here, we describe the forward operation. Note that while the forward operation is necessary to compute the likelihood (3) (in the main paper) during training, the forward operation is necessary to sample from the latent prior distribution of our CF-VAE. The forward operation consists of solving for the roots of the following equation (more details in (Ziegler & Rush, 2019)),
302
+
303
+ $$
304
+ \begin{array} { l } { { - b d ^ { 2 } ( \epsilon ^ { j } ) ^ { 3 } + ( ( { \bf z } ^ { j } - a ) d ^ { 2 } - 2 d g b ) ( \epsilon ^ { j } ) ^ { 2 } } } \\ { { + ( 2 d g ( { \bf z } ^ { j } - a ) - b ( { g } ^ { 2 } + 1 ) ) \epsilon ^ { j } + ( ( { \bf z } ^ { j } - a ) ( { g } ^ { 2 } + 1 ) - c ) = 0 } } \end{array}
305
+ $$
306
+
307
+ This equation has one real root which can be found analytically (Holmes). As mentioned in the main paper, note that the coefficients $\{ a , b , c , d , g \}$ are also functions of the condition $\mathbf { X }$ (unlike (Ziegler & Rush, 2019)).
308
+
309
+ APPENDIX B. ADDITIONAL EVALUATION OF CONDITIONAL NON-LINEAR FLOWS
310
+
311
+ <table><tr><td>Given x in,</td><td>p(yx)</td><td>Cond Affine Flow</td><td>Our Cond NL Flow</td></tr><tr><td></td><td>::</td><td></td><td>:</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td></tr></table>
312
+
313
+ We compare conditional affine flows of (Atanov et al., 2019; Lu & Huang, 2019) and our conditional non-linear (Cond NL) flows in Figure 6 and Figure 7. We plot the conditional distribution $p ( \mathbf { y } \vert \mathbf { x } )$ and the corresponding condition x in the second and first columns. We use 8 and 16 layers of flow in case of the densities in Figure 6 and Figure 7 respectively. We see that the estimated density by the conditional affine flows of (Atanov et al., 2019; Lu & Huang, 2019) contains distinctive “tails” in case of Figure 6 and discontinuities in case of Figure 7. In comparison our conditional non-linear flows does not have distinctive “tails” or discontinuities and is able to complex capture the multi-modal distributions better. Note, the “ring”-like distributions in Figure 7 cannot be well captured by more traditional methods like Mixture of Gaussians. We see in Figure 8 that even with 64 mixture components, the learnt density is not smooth in comparison to our conditional non-linear flows. This again demonstrates the advantage of our conditional non-linear flows.
314
+
315
+ ![](images/48fc7f7e970558434c92488bebd00eb98cf1260c46c8d46969901cbc801ca1f7.jpg)
316
+ Figure 7: Comparison between conditional affine flows of (Atanov et al., 2019; Lu & Huang, 2019) and our conditional non-linear (Cond NL) flows. We see that the conditional affine flows cannot fully capture “ring”-like conditional distributions (note the discontinuity at the top), while our conditional non-linear flows does not have such discontinuities.
317
+
318
+ ![](images/0e75227c1d8b81b0f6569af3e1d72b60342c5ffd9943119b5a9a35d26b24447e.jpg)
319
+ Figure 8: Comparison between our conditional non-linear (Cond NL) flows and a Mixture of Gaussians (MoG) model. We see that even with 64 mixture components, the learnt density is not smooth in comparison to our conditional non-linear flows.
320
+
321
+ # APPENDIX C. ADDITIONAL DETAILS OF OUR MODEL ARCHITECTURES
322
+
323
+ Here, we provide details of the model architectures used across the three datasets used in the main paper.
324
+
325
+ MNIST Sequences. We use the same model architecture as in Bhattacharyya et al. (2018). The LSTM condition encoder on the input sequence x, the LSTM recognition network $q _ { \theta }$ and the decoder LSTM network has 48 hidden neurons each. Also as in Bhattacharyya et al. (2018), we use a 64 dimensional latent space.
326
+
327
+ Stanford Drone. Again, we use the same model architecture as in Bhattacharyya et al. (2018) except for the CNN encoder. The LSTM condition encoder on the input sequence $\mathbf { X }$ and the decoder LSTM network has 64 hidden neurons each. The LSTM recognition network $q _ { \theta }$ has 128 hidden neurons. Also as in Bhattacharyya et al. (2018), we use a 64 dimensional latent space. Our CNN encoder has 6 convolutional layers of size 32, 64, 128, 256, 512 and 512. We predict the attention weights on the final feature vectors using the encoding of the LSTM condition encoder. The attention weighted feature vectors are passed through a final fully connected layer to obtain the final CNN encoding. Furthermore, we found it helpful to additionally encode the past trajectory as an image (as in (Pajouheshgar & Lampert, 2018)) as provide this as an additional channel to the CNN encoder.
328
+
329
+ HighD. We use the same model architecture with both the CVAE and CF-VAE models. As in the Stanford drone dataset, we use LSTM condition encoder on the input sequence x and the decoder LSTM network with 64 hidden neurons each and the LSTM recognition network $q _ { \theta }$ with 128 hidden neurons. The contextual information of interacting traffic participants are encoded into a spatial grid tensor of size $1 3 \times 3$ (see Section 3.2 of the main paper). We use a CNN with 5 layers of sizes 64, 128, 256, 256 and 256 to extract contextual features.
330
+
331
+ # APPENDIX D. DETAILS OF THE MIXTURE OF GAUSSIANS (MOG) BASELINE
332
+
333
+ In the main paper, we include results on the MNIST Sequence and Stanford Drone dataset with a Mixture of Gaussians (MoG) prior. In detail, instead of a normalizing flow, we set the prior to a MoG form,
334
+
335
+ $$
336
+ p _ { \xi } ( \mathbf { z } | \mathbf { x } ) = \sum _ { i = 1 } ^ { M } p ( \mathbf { c } _ { i } | \mathbf { x } ) \mathcal { N } ( \mathbf { z } ; \mu _ { i } , \sigma _ { i } | \mathbf { x } ) .
337
+ $$
338
+
339
+ We use a simple feed forward neural network that takes in the condition $\mathbf { X }$ (see Section 3.4 of the main paper) and predicts the parameters of the MoG, $\xi = \{ \mathbf { c } _ { 1 } , \mu _ { 1 } , \sigma _ { 1 } , \cdots , \mathbf { c } _ { M } , \mu _ { M } , \sigma _ { M } \}$ . Note, to ensure a reasonable number of parameters, we consider spherical Gaussians. Similar to (5) in the main paper, the ELBO can be expressed as,
340
+
341
+ $$
342
+ \begin{array} { r } { \log \bigl ( p _ { \theta } ( \mathbf { y } | \mathbf { x } ) \bigr ) \geq \mathbb { E } _ { q _ { \phi } ( z | \mathbf { x } , \mathbf { y } ) } \log \bigl ( p _ { \theta } ( \mathbf { y } | \mathbf { z } , \mathbf { x } ) \bigr ) + \mathcal { H } ( q _ { \phi } ) + \mathbb { E } _ { q _ { \phi } ( z | \mathbf { x } , \mathbf { y } ) } \log \bigl ( p _ { \xi } ( z | \mathbf { x } ) \bigr ) . } \end{array}
343
+ $$
344
+
345
+ Note that we fix the entropy of the posterior distribution $q _ { \phi }$ for stability
346
+
347
+ # APPENDIX E. ADDITIONAL EVALUATION ON THE MNIST SEQUENCE DATASET
348
+
349
+ Here, we perform a comprehensive evaluation using the MoG prior with varying mixture components, a CVAE with unconditional non-linear flow based prior (NL-CVAE), our CF-VAE with Volumepreserving constant Jacobian conditional NICE flows based on Dinh et al. (2015), a CVAE with the conditional VampPrior (CDV) of (Klushyn et al., 2019), our CF-VAE with varying hyper-parameters $C = [ 0 . 0 5 , 0 . 2 5 ]$ of our posterior regularization (pR) scheme and finally analyze the effect of our posterior regularization (pR) scheme in detail. We report the results in Table 5.
350
+
351
+ Table 5: Evaluation on MNIST Sequences (CLL: lower is better).
352
+
353
+ <table><tr><td rowspan=1 colspan=4>Method -CLL↓</td></tr><tr><td rowspan=1 colspan=4>NL-CVAE 107.6±1.2CVAE(M = 1) (Sohn et al., 2015) 96.4±0.2</td></tr><tr><td rowspan=1 colspan=4>MoG-CVAE, M = 2 85.3±0.4MoG-CVAE, M = 3 84.6±0.5MoG-CVAE, M = 4 85.7±0.4MoG-CVAE, M = 5 86.3±0.6CDV (Klushyn et al., 2019), M = 12 99.4±0.7</td></tr><tr><td rowspan=1 colspan=4>CF-VAE - NICE (Ours) 78.9±0.2</td></tr><tr><td rowspan=1 colspan=1> CF-VAE+ pR.</td><td rowspan=1 colspan=2>C=0.05,(Ours)</td><td rowspan=1 colspan=1>75.9±0.5</td></tr><tr><td rowspan=3 colspan=2>CF-VAE + pR,(</td><td rowspan=3 colspan=1>,C = 0.10,(Ours)</td><td></td></tr><tr><td rowspan=1 colspan=1>7</td></tr><tr><td rowspan=1 colspan=1>75.4±0.3</td></tr><tr><td rowspan=1 colspan=4>CF-VAE + pR,C: = 0.15, (Ours) 75.1±0.3CF-VAE + pR,C= 0.20,(Ours) 74.9±0.2CF-VAE + pR, C = 0.25,(Ours) 75.8±0.4</td></tr></table>
354
+
355
+ MoG Prior. As mentioned in the main paper, we see that the MoG-CVAE outperforms the plain CVAE. This again reinforces our claim that the standard Gaussian prior induces a strong model bias. We see that using $M = 3$ components with the variance of the posterior distribution fixed to $C = 0 . 2$ leads to the best performance. This is expected as 3 is the most frequent number of possible strokes in the MNIST Sequence dataset. Also note that the results with the MoG prior are also relatively robust across $\mathbf { C } = [ 0 . 0 5 , 0 . 2 5 ]$ as we learn the variance of the prior (see the section above). Finally, our $\mathrm { C F - V A E + p R }$ still significantly outperforms the MoG-CVAE (74.9 vs 84.6). This is expected as normalizing flows are more powerful compared to MoG at learning complex multi-modal distributions (Kingma & Dhariwal, 2018) (also see Figure 8).
356
+
357
+ ![](images/50a15d633cd65996bc46084a5bd7bce523dc1a79afdd807f07ca89c64a1e2b37.jpg)
358
+ Figure 9: Random samples using the CDV Prior of (Klushyn et al., 2019) clustered using $\mathbf { k } .$ -means. The number of clusters is set manually to the number of expected digits. The CDV Prior latent distribution on the right. Note, the 64D latent distribution is (approximately) projected to 2D using tSNE and KDE. In comparison to the samples and latent spaces of our CF-VAE (Figure 3) we see that the latent spaces are more simplistic and samples are of poorer quality.
359
+
360
+ NL-CVAE. We also see that using an unconditional non-linear flow based prior actually harms performance (107.6 vs 96.4). This is because the latent distribution is highly dependent upon the condition. Therefore, without conditioning information the non-linear conditional flow learns a global representation of the latent space which leads to out-of-distribution samples at prediction time.
361
+
362
+ CF-VAE with conditional NICE flows (Dinh et al., 2015). We have added results with the volume preserving NICE flows in Table 5. We observe that even without our posterior regularization scheme (pR) volume preserving NICE flows (Dinh et al., 2015) performs well – because of the constant Jacobian term. However, our conditional non-linear flows with posterior regularization still perform significantly better (78.9 vs 74.9 -CLL). This is because of the additional expressive power of our conditional non-linear flows combined with the stability offered by our posterior regularization scheme.
363
+
364
+ Comparison to Klushyn et al. (2019). We also perform additional experiments with the conditional VampPrior (CDV) of Klushyn et al. (2019) using $M = 1 2$ components. Using more components makes training/inference significantly slower in comparison to plain CVAEs, Mog-CVAE ( $M = 3$ ) or our CF-VAE. Furthermore, with $M = 1 2$ components we observe that it is outperformed by the simpler MoG-CVAE. This is because the mean and variance parameters of the ( $M = 1 2$ ) components are obtained using the recognition network $q _ { \phi }$ . The recognition network $q _ { \phi }$ has to learn to both reconstruct the data and maintain a latent space representative of full conditional data distribution $p ( \mathbf { y } | \mathbf { x } )$ . These objectives are at odds with each other. In practice, we find that this leads to simplistic latent spaces along with lower overall data log-likelihood in comparison with our CF-VAE (Figure 3). This can be seen in the samples and corresponding latent spaces in Figure 9.
365
+
366
+ Hyper-parameter analysis of our posterior regularization scheme (pR). We provide additional analysis of our posterior regularization scheme in Table 5. We observe that our CF-VAE is relatively robust across $C = [ 0 . 0 5 , 0 2 5 ]$ , with only small variance in performance. This is because our posterior regularization scheme encourages our CF-VAE to focus on explaining the data well. We explain this further in the following paragraph.
367
+
368
+ Analysis of our posterior regularization scheme (pR). We provide additional analysis of our posterior regularization scheme (pR) in Figure 10. We show each term of our objective (7) in Figure 10. First, we see that with our posterior regularization scheme, our CF-VAE focuses on explaining the data well – the data log-likelihood is best with our posterior regularization (pR) scheme Figure 10a, with $C = 0 . 2$ having a advantage over $C = \{ 0 . 0 5 , 0 . 1 \}$ . Furthermore, we see that without our posterior regularization scheme the Jacobian term dominates while entropy term decreases (Figure 10b vs Figure 10d) – the contraction of the base density is favoured. Interestingly, the likelihood under the prior Figure 10c is similar across methods – with our posterior regularization providing additional stability. We also experimented with re-weighting these terms (although its no longer a valid lower bound on the true data log-likelihood). This leads to the opposite behaviour – the entropy term dominates over the Jacobian term at the cost of the data log-likelihood. On the other hand, we observe that all terms of our objective are stable with our posterior regularization scheme, illustrating the advantage of our posterior regularization scheme.
369
+
370
+ ![](images/ddecc9ab2431b6098f5848ee87462eb50e266afb273c9704a024c0b3a63f769b.jpg)
371
+ Figure 10: Analysis of all four terms of our CF-VAE objective (7) at training time, with $C =$ $\{ 0 . \bar { 0 5 } , 0 . 1 0 , 0 . 2 0 \bar { \} } )$ and without our posterior regularization (pR) scheme. We observe better data log-likelihoods and stable training with our posterior regularization (pR) scheme. Without pR, we observe that the Jacobian term dominates at the cost of data log-likelihood.
372
+
373
+ # APPENDIX F. EVALUATION OF THE ROBUSTNESS OF THE TOP $N \%$ METRIC
374
+
375
+ We use two simpler uniform “Shotgun” baselines to study the robustness of the Top ${ \mathfrak { n } } \%$ metric against random guessing. In particular, we consider the “Shotgun”- $\mathbf { \nabla } \cdot \mathbf { u } 9 0 ^ { \circ }$ and “Shotgun”- $\mathbf { \cdot u l 3 5 ^ { \circ } }$ baselines which: given a budget of N predictions, it uniformly distributes the predictions between $\left( - 9 0 ^ { \circ } , 9 0 ^ { \circ } \right)$ and $\left( - 1 3 5 ^ { \circ } , 1 3 5 ^ { \circ } \right)$ respectively of the original orientation and using the velocity of the last time-step. In Table 6 we compare the Top 1 (best guess) to Top $10 \%$ metric with $\mathrm { N } = 5 0$ , 100, 500 predictions.
376
+
377
+ We see that in case of both the “Shotgun”- $\mathbf { \nabla } \cdot \mathbf { u } 9 0 ^ { \circ }$ and “Shotgun”- $\mathbf { \cdot u l 3 5 ^ { \circ } }$ baselines, the Top 1 (best guess) metric improves with increasing number of guesses. This effect is even more pronounced in case of the “Shotgun”- $\cdot \mathrm { { u 1 3 5 ^ { \circ } } }$ baseline as the random guesses are distributed over a larger spatial range. In contrast, the Top $10 \%$ metric remains remarkably stable. This is because, in order to improve the Top $10 \%$ metric, random guessing is not enough – the predictions have to be on the correct modes. In other words, the only way to improve the Top $10 \%$ metric is move random predictions to any of the correct modes.
378
+
379
+ APPENDIX G. QUALITATIVE EXAMPLES ON THE HIGHD DATASET
380
+
381
+ <table><tr><td>Method</td><td>K</td><td>Error @1sec</td><td>Error @ 2sec</td><td>Error @ 3sec</td><td>Error @ 4sec</td></tr><tr><td></td><td colspan="5">Top 1 (Best Guess)</td></tr><tr><td>“Shotgun&quot;-u90°</td><td>50</td><td>0.9</td><td>1.9</td><td>3.1</td><td>4.4</td></tr><tr><td>“Shotgun&quot;-u90°</td><td>100</td><td>0.9</td><td>1.9</td><td>3.0</td><td>4.3</td></tr><tr><td>&quot;Shotgun&quot;-u90°</td><td>500</td><td>0.9</td><td>1.9</td><td>3.0</td><td>4.3</td></tr><tr><td></td><td colspan="5">Top 10%</td></tr><tr><td>“Shotgun&quot;-u90°</td><td>50</td><td>1.2</td><td>2.5</td><td>3.9</td><td>5.4</td></tr><tr><td>“Shotgun&quot;-u90°</td><td>100</td><td>1.2</td><td>2.5</td><td>3.9</td><td>5.4</td></tr><tr><td>“Shotgun&quot;-u90°</td><td>500</td><td>1.2</td><td>2.5</td><td>3.9</td><td>5.4</td></tr><tr><td></td><td colspan="5">Top 1 (Best Guess)</td></tr><tr><td>“Shotgun&quot;-u135°</td><td>50</td><td>0.9</td><td>2.0</td><td>3.1</td><td>4.5</td></tr><tr><td>“Shotgun&quot;-u135°</td><td>100</td><td>0.9</td><td>1.9</td><td>3.0</td><td>4.3</td></tr><tr><td>“Shotgun&quot;-u135°</td><td>500</td><td>0.9</td><td>1.9</td><td>3.0</td><td>4.2</td></tr><tr><td></td><td colspan="5">Top 10%</td></tr><tr><td>“Shotgun&quot;-u135°</td><td>50</td><td>1.4</td><td>2.9</td><td>4.5</td><td>6.2</td></tr><tr><td>&quot;Shotgun&quot;-u135°</td><td>100</td><td>1.4</td><td>2.9</td><td>4.5</td><td>6.2</td></tr><tr><td>&quot;Shotgun&quot;-u135°</td><td>500</td><td>1.4</td><td>2.9</td><td>4.5</td><td>6.2</td></tr></table>
382
+
383
+ Table 6: Five fold cross validation on the Stanford Drone dataset. Euclidean error at $( 1 / 5 )$ resolution.
384
+
385
+ ![](images/d834c03a140771003f59337ab88e45dab1c004e269af3abbd0cc11c101285b6d.jpg)
386
+ Figure 11: Predictions on the HighD dataset. Left: 128 random samples from the HighD test set (in yellow). Middle: CVAE predictions (5 samples per test set example). Right: Our CV-VAE $^ +$ $\{ \mathrm { p R } , \mathrm { c R } \}$ predictions (5 samples per test set example). While the predictions by the CVAE are linear continuations, our CF-VAE sample predictions are much more diverse and cover events like lane changes e.g. top most sample track from the test set.
387
+
388
+ We show qualitative examples on the HighD dataset in Figure 11. In the left of Figure 11 we show 128 random samples from the HighD test set. In the middle we show predictions on these samples by the CVAE (with cyclic KL annealing (Liu et al., 2019)). We see that even with cyclic KL annealing, we observe posterior collapse. All samples have been pushed towards the mean and the variance in the 5 samples per test set example is minimal. E.g. note the top most sample track from the test set in Figure 11 (left). All CVAE sample predictions are a linear continuation of the trajectory (continuing on the same lane), while there is in fact a turn (change of lanes). In contrast, our $\mathsf { \bar { C } F - V A \bar { E } + \{ p R , c R \} }$ sample predictions are much more diverse and cover such eventualities. This also shows that our $\mathrm { C F - \bar { V } A \bar { E } + \{ p R , c R \} }$ does not suffer from such posterior variable collapse.
md/train/BtZhsSGNRNi/BtZhsSGNRNi.md ADDED
@@ -0,0 +1,616 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # COPING WITH LABEL SHIFT VIA DISTRIBUTIONALLY ROBUST OPTIMISATION
2
+
3
+ Jingzhao Zhang
4
+ Massachusetts Institute of Technology
5
+ jzhzhang@mit.edu
6
+
7
+ Aditya Krishna Menon & Andreas Veit & Srinadh Bhojanapalli & Sanjiv Kumar Google Research {adityakmenon, aveit, bsrinadh, sanjivk}@mit.edu
8
+
9
+ # Suvrit Sra
10
+
11
+ Massachusetts Institute of Technology suvrit@mit.edu
12
+
13
+ # ABSTRACT
14
+
15
+ The label shift problem refers to the supervised learning setting where the train and test label distributions do not match. Existing work addressing label shift usually assumes access to an unlabelled test sample. This sample may be used to estimate the test label distribution, and to then train a suitably re-weighted classifier. While approaches using this idea have proven effective, their scope is limited as it is not always feasible to access the target domain; further, they require repeated retraining if the model is to be deployed in multiple test environments. Can one instead learn a single classifier that is robust to arbitrary label shifts from a broad family? In this paper, we answer this question by proposing a model that minimises an objective based on distributionally robust optimisation (DRO). We then design and analyse a gradient descent-proximal mirror ascent algorithm tailored for large-scale problems to optimise the proposed objective. Finally, through experiments on CIFAR-100 and ImageNet, we show that our technique can significantly improve performance over a number of baselines in settings where label shift is present.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Classical supervised learning involves learning a model from a training distribution that generalises well on test samples drawn from the same distribution. While the assumption of identical train and test distributions has given rise to useful methods, it is often violated in many practical settings (Kouw & Loog, 2018). The label shift problem is one such important setting, wherein the training distribution over the labels does not reflect what is observed during testing (Saerens et al., 2002). For example, consider the problem of object detection in self-driving cars: a model trained in one city may see a vastly different distribution of pedestrians and cars when deployed in a different city. Such shifts in label distribution can significantly degrade model performance. As a concrete example, consider the performance of a ResNet-50 model on ImageNet. While the overall error rate is $\bar { \sim } 2 4 \%$ , Figure 1 reveals that certain classes suffer an error as high as $\sim 8 0 \%$ . Consequently, a label shift that increases the prevalence of the more erroneous classes in the test set can significantly degrade performance.
20
+
21
+ Most existing work on label shift operates in the setting where one has an unlabelled test sample that can be used to estimate the shifted label probabilities (du Plessis & Sugiyama, 2014; Lipton et al., 2018; Azizzadenesheli et al., 2019). Subsequently, one can retrain a classifier using these probabilities in place of the training label probabilities. While such techniques have proven effective, it is not always feasible to access an unlabelled set. Further, one may wish to deploy a learned model in multiple test environments, each one of which has its own label distribution. For example, the label distribution for a vehicle detection camera may change continuously while driving across the city. Instead of simply deploying a separate model for each scenario, deploying a single model that is robust to shifts may be more efficient and practical. Hence, we address the following question in this work: can we learn a single classifier that is robust to a family of arbitrary shifts?
22
+
23
+ ![](images/d5231af0b56246bc7a94d2537570ed911eb95f9facbe659051a1b1d7d0c020da.jpg)
24
+ Figure 1: Distribution of per-class test errors of a ResNet-50 on ImageNet (left). While the average error rate is $\sim 2 4 \%$ , some classes achieve an error as high as $\sim 8 0 \%$ . An adversary can thus significantly degrade test performance (right) by choosing $p _ { \mathrm { t e } } ( y )$ with more weight on these classes.
25
+
26
+ We answer the above question by modeling label shift via distributionally robust optimisation (DRO) (Shapiro et al., 2014; Rahimian & Mehrotra, 2019). DRO offers a convenient way of coping with distribution shift, and have lead to successful applications (e.g. Faury et al. (2020)). Intuitively, by seeking a model that performs well on all label distributions that are “close” to the training data label distribution, this task can be cast as a game between the learner and an adversary, with the latter allowed to pick label distributions that maximise the learner’s loss. We remark that while adversarial perspectives have informed popular paradigms such as GANs, these pursue fundamentally different objectives from DRO (see Appendix A for details).
27
+
28
+ Although several previous works have explored DRO for tackling the problem of example shift (e.g., adversarial examples) (Namkoong & Duchi, 2016; 2017; Duchi & Namkoong, 2018), an application of DRO to the label shift setting poses several challenges: (a) updating the adversary’s distribution na¨ıvely requires solving a nontrivial convex optimisation subproblem with limited tractability, and also needs careful parameter tuning; and (b) na¨ıvely estimating gradients under the adversarial distribution on a randomly sampled minibatch can lead to unstable behaviour (see §3.1). We overcome these challenges by proposing the first algorithm that successfully optimises a DRO objective for label shift on a large scale dataset (i.e., ImageNet). Our objective encourages robustness to arbitrary label distribution shifts within a KL-divergence ball of the empirical label distribution. Importantly, we show that this choice of robustness set admits an efficient and stable update step.
29
+
30
+ # Summary of contributions
31
+
32
+ (1) We design a gradient descent-proximal mirror ascent algorithm tailored for optimising large-scale problems with minimal computational overhead, and prove its theoretical convergence.
33
+ (2) With the proposed algorithm, we implement a practical procedure to successfully optimise the robust objective on ImageNet scale for the label shift application.
34
+ (3) We show through experiments on ImageNet and CIFAR-100 that our technique significantly improves over baselines when the label distribution is adversarially varied.
35
+
36
+ # 2 BACKGROUND AND PROBLEM FORMULATION
37
+
38
+ In this section we formalise the label shift problem and motivate its formulation as an adversarial optimisation problem. Consider a multiclass classification problem with distribution $p _ { \mathrm { t r } }$ over instances $\mathcal { X }$ and labels $\ Y = [ L ]$ . The goal is to learn a classifier $h _ { \theta } \colon \mathcal { X } \mathcal { Y }$ parameterised by $\theta \in \Theta$ , with the aim of ensuring good predictive performance on future samples drawn from $p _ { \mathrm { t r } }$ . More formally, the goal is to minimise the objective $\mathrm { n i n } _ { \theta } \mathbb { E } _ { ( x , y ) \sim p _ { \mathrm { t r } } } [ \ell ( x , y , \theta ) ]$ , where $\ell \colon \mathcal { X } \times \mathcal { Y } \times \Theta \mathbb { R } _ { + }$ is a loss function. In practice, we only have access to a finite sample $\mathcal { S } = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n } \sim p _ { \mathrm { t r } } ^ { n }$ , which motivates us to use the empirical distribution $\begin{array} { r } { p _ { \mathrm { e m p } } ( x , y ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \mathbb { 1 } ( \bar { x } = x _ { i } , \bar { y } = y _ { i } ) } \end{array}$ tr in place of $p _ { \mathrm { t r } }$ . Doing so, we arrive at the objective of minimising the empirical risk:
39
+
40
+ $$
41
+ \operatorname* { m i n } _ { \theta } \ \mathbb { E } _ { p _ { \mathrm { e m p } } } [ \ell ( x , y , \theta ) ] : = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell ( x _ { i } , y _ { i } , \theta ) .
42
+ $$
43
+
44
+ The assumption underlying the above formulation is that test samples are drawn from the same distribution $p _ { \mathrm { t r } }$ that is used during training. However, this assumption is violated in many practical settings. The problem of learning from a training distribution $p _ { \mathrm { t r } }$ , while attempting to perform well on a test distribution $p _ { \mathrm { t e } } \neq p _ { \mathrm { t r } }$ is referred to as domain adaptation (Ben-David et al., 2007). In the special case of label shift, one posits that $p _ { \mathrm { t e } } ( x \mid y ) = p _ { \mathrm { t r } } ( x \mid y )$ , but the label distribution $p _ { \mathrm { t e } } ( \bar { y } ) \neq p _ { \mathrm { t r } } ( y )$ (Saerens et al., 2002); i.e., the test distribution satisfies $\dot { p } _ { \mathrm { t e } } ( x , y ) = p _ { \mathrm { t e } } ( y ) p _ { \mathrm { t r } } ( x \mid y )$ . The label shift problem admits the following three distinct settings (see Table 1 for a summary):
45
+
46
+ Table 1: Summary of approaches to learning with a modified label distribution.
47
+
48
+ <table><tr><td>Label distribution</td><td>Reference</td></tr><tr><td>Train distribution</td><td>Standard ERM</td></tr><tr><td>Specified a-priori (e.g., balanced)</td><td>(Elkan,2001; Xie &amp; Manski, 1989; Cao et al., 2019)</td></tr><tr><td>Estimated test distribution</td><td>(du Plessis &amp; Sugiyama, 2014; Lipton et al., 2018; Azizzadenesheli et al., 2019; Garg et al., 2020; Combes et al., 2020)</td></tr><tr><td>Worst-performing class</td><td>(Hashimoto et al., 2018; Mohri et al., 2019; Sagawa et al., 2020)</td></tr><tr><td>Worst k-performing classes</td><td>(Fan et al.,2017; Williamson &amp; Menon,2019; Curi et al.,2019; Duchi et al., 2020)</td></tr><tr><td>Adversarial shifts within KL-divergence</td><td>This paper</td></tr></table>
49
+
50
+ (1) Fixed label shift. Here, one assumes $a$ -priori knowledge of $p _ { \mathrm { t e } } ( y )$ . One may then adjust the outputs of a probabilistic classifier post-hoc to improve test performance (Elkan, 2001). Even when the precise distribution is unknown, it is common to posit a uniform $p _ { \mathrm { t e } } ( y )$ . Minimising the resulting balanced error has been the subject of a large body of work (He & Garcia, 2009), with recent developments including Cui et al. (2019); Cao et al. (2019); Kang et al. (2020); Guo et al. (2020).
51
+
52
+ (2) Estimated label shift. Here, we assume that $p _ { \mathrm { t e } } ( y )$ is unknown, but that we have access to an unlabelled test sample. This sample may be used to estimate $p _ { \mathrm { t e } } ( y )$ , e.g., via kernel meanmatching (Zhang et al., 2013), minimisation of a suitable KL divergence (du Plessis & Sugiyama, 2014), or using black-box classifier outputs (Lipton et al., 2018; Azizzadenesheli et al., 2019; Garg et al., 2020). One may then use these estimates to minimise a suitably re-weighted empirical risk.
53
+
54
+ (3) Adversarial label shift. Here, we assume that $p _ { \mathrm { t e } } ( y )$ is unknown, and guard against a suitably defined worst-case choice. Observe that an extreme case of label shift involves placing all probability mass on a single $y ^ { \ast } \in \mathcal { Y }$ . This choice can be problematic, as (1) may be rewritten as
55
+
56
+ $$
57
+ \operatorname* { m i n } _ { \theta } \sum _ { y \in [ L ] } p _ { \mathrm { e m p } } ( y ) \cdot \bigg \{ \frac { 1 } { n _ { y } } \sum _ { i : y _ { i } = y } \ell ( x _ { i } , y _ { i } , \theta ) \bigg \} ,
58
+ $$
59
+
60
+ where $n _ { y }$ is the number of training samples with label $y$ . The empirical risk is thus a weighted average of the per-class losses. Observe that if some $y ^ { \ast } \in \mathcal { Y }$ has a large per-class loss, then an adversary could degrade performance by choosing a $p _ { \mathrm { t e } }$ with $p _ { \mathrm { t e } } ( y ^ { \ast } )$ being large. One means of guarding against such adversarial label shifts is to minimise the minimax risk (Alaiz-Rodr´ıguez et al., 2007; Davenport et al., 2010; Hashimoto et al., 2018; Mohri et al., 2019; Sagawa et al., 2020)
61
+
62
+ $$
63
+ \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \pi \in \Delta ^ { L } } \sum _ { y \in [ L ] } \pi ( y ) \cdot { \biggl \{ } { \frac { 1 } { n _ { y } } } \sum _ { i : \ y _ { i } = y } \ell ( x _ { i } , y _ { i } , \theta ) { \biggr \} } ,
64
+ $$
65
+
66
+ where $\Delta ^ { L }$ denotes the simplex. In (2), we combine the per-label risks according to the worst-case label distribution. In practice, focusing on the worst-case label distribution may be overly pessimistic. One may temper this by instead constraining the label distribution. A popular choice is to enforce that $\| \pi \| _ { \infty } \leq \frac { 1 } { k }$ for suitable $k$ , which corresponds to minimising the average of the top- $k$ largest per-class losses for integer $k$ (Williamson & Menon, 2019; Curi et al., 2019; Duchi et al., 2020).
67
+
68
+ We focus on the adversarial label shift setting, as it meets the desiderata of training a single model that is robust to multiple label distributions, and not requiring access to test samples. Adversarial robustness has been widely studied (see Appendix A for more related work), but its application to label shift is much less explored. Amongst techniques in this area, Mohri et al. (2019); Sagawa et al. (2020) are most closely related to our work. These works optimise the worst-case loss over subgroups induced by the labels. However, both works consider settings with a relatively small $( \le 1 0 )$ number of subgroups; the resultant algorithms face many challenges when trained with many labels (see Section 4). We now detail how a suitably constrained DRO formulation, coupled with optimisation choices, can overcome this limitation.
69
+
70
+ $\Delta \mathrm { l g o r i t h m 1 A D V S H I F T } ( \theta _ { 0 } , \gamma _ { c } , \lambda , \tt N N O p t , \ / p _ { \mathrm { e m p } } , \eta _ { \pi } )$
71
+
72
+ <table><tr><td colspan="2">1:Initialise adversary distribution as π1 =(,,). for t=1,...,Tdo</td></tr><tr><td>2: 3:</td><td>Sample mini-batch of b examples {(xi,yi)}=1:</td></tr><tr><td>4:</td><td>Evaluate stochastic gradient ge = 1 ∑i=1 pemp(i) 1 b πt(yi) .Vel(xi,yi,0t)</td></tr><tr><td>5:</td><td>Update neural network parameters 0t+1 = NNOpt(ge)</td></tr><tr><td>6:</td><td>Update Lagrangian variable α =Oif r &gt;KL(πt,Pemp),α = 2γc入 if r&lt;KL(πt, Pemp).</td></tr><tr><td>7:</td><td>Evaluate adversarial gradient gπ(i) = 1∑=1 Pemp() 1{yj=.Vπl(xj,yj,0t+1).</td></tr><tr><td>8:</td><td>Update adversariadistribution Tt+1= (πt : Pemp)1/(1+α).exp(nπ)/C</td></tr></table>
73
+
74
+ # 3 ALGORITHM: DISTRIBUTIONALLY ROBUST KL-DIVERGENCE MINIMISATION
75
+
76
+ To address the adversarial label shift problem, we propose to replace the empirical risk (1) with
77
+
78
+ $$
79
+ \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \pi \in \mathcal { P } } \mathbb { E } _ { \pi } [ \ell ( x , y , \theta ) ] , \quad \mathcal { P } : = \{ \pi \in \Delta ^ { L } \mid d ( \pi , p _ { \mathrm { e m p } } ) \leq r \} ,
80
+ $$
81
+
82
+ where $\mathcal { P }$ is an uncertainty set containing perturbations of the empirical distribution $p _ { \mathrm { e m p } }$ . This is an instance of distributionally robust optimisation $( D R O )$ (Shapiro et al., 2014), a framework where one minimises the worst-case expected loss over a family of distributions. In this work, we instantiate DRO with $\mathcal { P }$ being a parameterised family of distributions with varying marginal label distributions in KL-divergence, i.e., $d ( p , q ) = \mathbb { E } _ { y \sim q } \left[ - \log p ( y ) / q ( y ) \right] .$ (We use this divergence, as opposed to a generic $f$ -divergence, as it affords closed-form updates; see $\ S 3 . 3 .$ ) Solving (3) thus directly addresses adversarial label shift, as it ensures our model performs well on arbitrary label distributions from $\mathcal { P }$ Observe further that the existing minimax risk (2) is a special case of (3) with $r = + \infty$ .
83
+
84
+ Having stated our learning objective, we now turn to the issue of how to optimise it. One natural thought is to leverage strategies pursued in the literature on example-level $D R O$ using $f$ -divergences. For example, Namkoong $\&$ Duchi (2016) propose an algorithm that alternately performs iterative gradient updates for model parameters $\theta$ and adversarial distribution $\pi$ , assuming access to projection oracles, and the ability to sample from the adversarial distribution. However, there are challenges in applying such techniques on large-scale problems (e.g., ImageNet):
85
+
86
+ (1) directly sampling from $\pi$ is challenging in most data loading pipelines for ImageNet. (2) projecting $\pi$ onto the feasible set $\mathcal { P }$ requires solving a constrained convex optimization problem at every iteration, which can incur non-trivial overhead (see Appendix E).
87
+
88
+ We now describe ADVSHIFT (Algorithm 1), our approach to solve these problems. In a nutshell, we iteratively update model parameters $\theta$ and adversarial distributions $\pi$ . In the former, we update exactly as per ERM optimization (e.g., ADAM, SGD), which we denote as $\mathrm { N N O p t }$ (neural network optimiser); in the latter, we introduce a Lagrange multiplier to avoid projection. Extra care is needed to obtain unbiased gradients and speed up adversarial convergence, as we now detail.
89
+
90
+ # 3.1 ESTIMATING THE ADVERSARIAL MINIBATCH GRADIENT
91
+
92
+ For a fixed $\pi \in \Delta ^ { L }$ , to estimate the parameter gradient $\mathbb { E } _ { \pi } [ \nabla _ { \theta } \ell ( x , y , \theta ) ]$ on a training sample $\mathcal { S } = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n }$ , we employ the importance weighting identity and write
93
+
94
+ $$
95
+ \mathbb { E } _ { \pi } [ \nabla _ { \theta } \ell ( x , y , \theta ) ] = \mathbb { E } _ { p _ { \mathrm { e m p } } } \left[ \frac { 1 } { p _ { \mathrm { e m p } } ( y ) } \cdot \nabla _ { \theta } \ell ( x , y , \theta ) \right] = \frac { 1 } { n } \sum _ { i } \frac { \pi ( y _ { i } ) } { p _ { \mathrm { e m p } } ( y _ { i } ) } \cdot \nabla _ { \theta } \ell ( x _ { i } , y _ { i } , \theta ) .
96
+ $$
97
+
98
+ We may thus draw a minibatch as usual from S, and apply suitable weighting to obtain unbiased gradient estimates. A similar reweighting is necessary to compute the adversary gradients $\mathbb { E } _ { \pi } [ \nabla _ { \pi } \ell ( x , \bar { y } , \theta ) ]$ . Making the adversarial update efficient requires further effort, as we now discuss.
99
+
100
+ # 3.2 REMOVING CONSTRAINTS BY LAGRANGIAN DUALITY
101
+
102
+ To efficiently update the adversary distribution $\pi$ in (3), we would like to avoid the cost of projecting onto $\mathcal { P }$ . To bypass this difficulty, we make the following observation based on Lagrangian duality.
103
+
104
+ Proposition 1. Suppose $\ell$ is bounded, and $p _ { \mathrm { e m p } }$ is not on the boundary of the simplex. Then, $\forall r > 0$ , $\exists \gamma ^ { * } > 0$ such that for every $\gamma _ { c } \geq \gamma ^ { * }$ , the constrained objective is solvable in unconstrained form:
105
+
106
+ $$
107
+ \operatorname * { a r g m a x } _ { \pi \in \Delta L , { \mathrm { \tiny ~ K L } } ( \pi , p _ { \mathrm { c m p } } ) \leq r } \mathbb { E } _ { \pi } [ \ell ( x , y , \theta ) ] = \operatorname * { a r g m a x } _ { \pi \in \Delta L } \mathbb { E } _ { \pi } [ \ell ( x , y , \theta ) ] + \operatorname* { m i n } \{ 0 , \gamma _ { c } ( r - \mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) ) \} .
108
+ $$
109
+
110
+ Motivated by this, we may thus transform the objective (3) into:
111
+
112
+ $$
113
+ \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \pi \in \Delta ^ { L } } \mathbb { E } _ { \pi } [ \ell ( x , y , \theta ) ] + \operatorname* { m i n } \{ 0 , \gamma _ { c } ( r - \mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) ) \} ,
114
+ $$
115
+
116
+ where $\gamma _ { c } > 0$ is a sufficiently large constant; in practice, this may be chosen by a bisection search.
117
+ The advantage of this formulation is that it admits an efficient update for $\pi$ , as we now discuss.
118
+
119
+ # 3.3 ADVERSARIAL DISTRIBUTION UPDATES
120
+
121
+ We now detail how we can employ proximal mirror descent to efficiently update $\pi$ . Observe that we may decompose the adversary’s (negated) objective into two terms: $f ( \theta , \pi ) : = - \mathbb { E } _ { \pi } [ \ell ( x , y , \theta ) ]$ and $h ( \pi ) : = \bar { \operatorname* { m a x } } \{ 0 , \gamma _ { c } ( \mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) ^ { } - r ) \}$ , where $h ( \pi )$ is independent of the samples. Such decomposable objectives suggest using proximal updates (Combettes & Pesquet, 2011):
122
+
123
+ $$
124
+ \pi _ { t + 1 } = \mathrm { p r o x } _ { \lambda h } ( \pi _ { t } - \lambda \nabla _ { \pi } f ( \theta _ { t } , \pi _ { t } ) ) : = \underset { \pi \in \Delta ^ { L } } { \mathrm { a r g m i n } } h ( \pi ) + \frac { 1 } { 2 \lambda } ( \| \pi _ { t } - \pi \| ^ { 2 } + 2 \lambda \langle \nabla _ { \pi } f ( \theta _ { t } , \pi _ { t } ) , \pi \rangle ) ,
125
+ $$
126
+
127
+ where $\lambda$ serves as the learning rate. The value of proximal descent relies on the ability to efficiently solve the minimisation problem in (5). Unfortunately, this does not hold as-is for our choice of $h ( \pi )$ , essentially due to a mismatch between the use of KL-divergence in $h$ , and Euclidean distance $\| \dot { \pi } _ { t } - \pi \| ^ { 2 }$ in (5). Motivated by the advantages of mirror descent over gradient descent on the simplex (Bubeck, 2014), we propose to replace the Euclidean distance with KL-divergence:
128
+
129
+ $$
130
+ \pi _ { t + 1 } = \operatorname * { a r g m i n } _ { \pi \in \Delta ^ { L } } h ( \pi ) + \frac { 1 } { 2 \lambda } ( \mathrm { K L } ( \pi , \pi _ { t } ) + 2 \lambda \langle g _ { t } , \pi \rangle ) ,
131
+ $$
132
+
133
+ where $g _ { t }$ is an unbiased estimator of $\nabla _ { \pi } f ( \theta _ { t } , \pi _ { t } )$ . We have the following closed-form update.
134
+
135
+ Lemma 2. Assume the optimal solution $\pi _ { t + 1 }$ to (6) satisfies $\mathrm { K L } ( \pi _ { t + 1 } , p _ { \mathrm { e m p } } ) \neq r$ , and that all the classes appeared at least once in the empirical distribution, i.e. $\forall i , p _ { \mathrm { e m p } } ^ { i } > 0$ . Let $\gamma = \gamma _ { c } i f r <$ $\mathrm { K L } ( \pi _ { t + 1 } , p _ { \mathrm { e m p } } )$ , and $\gamma = 0$ if $r > \mathrm { K L } ( \pi _ { t + 1 } , p _ { \mathrm { e m p } } )$ , then $\pi _ { t + 1 }$ permits a closed form solution
136
+
137
+ $$
138
+ \pi _ { t + 1 } = ( \pi _ { t } \odot p _ { \mathrm { e m p } } ^ { \alpha } ) ^ { 1 / ( 1 + \alpha ) } \exp { ( \eta _ { \pi } g _ { t } ) / C } ,
139
+ $$
140
+
141
+ where $\begin{array} { r } { \eta _ { \pi } = \frac { 1 } { ( \gamma + 1 / 2 \lambda ) ( 1 + \alpha ) } } \end{array}$ , $\alpha = 2 \gamma \lambda$ , $C = \| ( \pi _ { t } \odot p _ { \mathrm { e m p } } ^ { \alpha } ) ^ { 1 / ( 1 + \alpha ) } \exp \left( \eta _ { \pi } g _ { t } \right) \| _ { 1 }$ projects $\pi _ { t + 1 }$ onto the simplex, and $a \odot b$ is the element-wise product between two vectors $a , b$ .
142
+
143
+ In Algorithm 1, we set $\gamma = \gamma _ { c }$ if $r < \mathrm { K L } ( \pi _ { t } , p _ { \mathrm { e m p } } )$ and 0 otherwise to appoximate the true $\gamma$ . Such approximation works well when $r - \mathrm { K L } ( \pi _ { t } , p _ { \mathrm { e m p } } )$ does not change sign frequently.
144
+
145
+ # 3.4 CONVERGENCE ANALYSIS
146
+
147
+ We provide below a convergence analysis of our gradient descent-proximal mirror ascent method for nonconvex-concave stochastic saddle point problems. For the composite objective $\begin{array} { r } { \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \pi \in \Delta ^ { L } } f ( \theta , \pi ) + h ( \pi ) } \end{array}$ , and fixed learning rate $\eta _ { \theta }$ , we abstract the Algorithm 1 update as:
148
+
149
+ $$
150
+ \theta _ { t + 1 } = \theta _ { t } - \eta _ { \theta } g ( \theta _ { t } ) , \quad \pi _ { t + 1 } = \operatorname * { a r g m a x } _ { \pi } h ( \pi ) - \frac { 1 } { 2 \lambda } ( \mathrm { K L } ( \pi , \pi _ { t } ) + 2 \lambda \langle g ( \pi _ { t } ) , \pi \rangle ) ,
151
+ $$
152
+
153
+ where $g ( \pi ) , g ( \theta )$ are stochastic gradients assumed to satisfy the following.
154
+
155
+ Assumption 1. The stochastic gradient $g ( \theta )$ with respect to $\theta$ satisfies that for some $\sigma > 0$
156
+
157
+ $$
158
+ \begin{array} { r } { \mathbb { E } [ g ( \theta ) ] = \nabla _ { \theta } f ( \theta , \pi ) , \mathrm { ~ a n d ~ } \mathbb { E } [ \| g ( \theta ) - \mathbb { E } [ g ( \theta ) ] \| ^ { 2 } ] \le \sigma ^ { 2 } . } \end{array}
159
+ $$
160
+
161
+ Assumption 2. The stochastic gradient $g ( \pi )$ with respect to $\pi$ satisfies that for some $G > 0$ ,
162
+
163
+ $$
164
+ \begin{array} { r } { \mathbb { E } [ g ( \pi ) ] = \nabla _ { \pi } f ( \theta , \pi ) , \ \mathrm { a n d } \ \mathbb { E } [ \| g ( \pi ) \| _ { \infty } ^ { 2 } ] \leq G ^ { 2 } . } \end{array}
165
+ $$
166
+
167
+ We make the following assumptions about the objective, similar to Lin et al. (2019; 2020):
168
+
169
+ Assumption 3. $f ( \theta , \pi ) + h ( \pi )$ is $L -$ smooth and l−Lipschitz; $f ( \theta , \pi )$ and $h ( \pi )$ are concave in $\pi$ . Assumption 4. Every adversarial distribution iterate $\pi _ { t }$ satisfies $\mathrm { K L } ( \pi _ { t } , p _ { \mathrm { e m p } } ) \leq R$ for some $R > 0$
170
+
171
+ Assumption 3 and 4 may be enforced by adding a constant $\epsilon$ to the adversarial updates, which prevents $\pi _ { t }$ from approaching the boundary of the simplex. Assumption 2 in the label shift setting implies that the loss is upper and lower bounded. Such an assumption may be enforced by clipping the loss for computing the adversarial gradient, which can significantly speed up training (see Appendix ??). Furthermore, this is a standard assumption for analyzing nonconvex-concave problems (Lin et al., 2019). The assumption that the square $L _ { \infty }$ norm is bounded is weaker than $L _ { 2 }$ norm being bounded; such a relaxation results from using mirror rather than Euclidean update.
172
+
173
+ Given that the function $F ( \theta ) : = \operatorname* { m a x } _ { \pi \in \Delta } f ( \theta , \pi ) + h ( \pi )$ is nonconvex, our goal is to find a stationary point instead of approximating global optimum. Yet, due to the minimax formulation, the function $F ( \theta )$ may not necessarily be differentiable. Hence, we define convergence following some recent works (Davis & Drusvyatskiy, 2019; Lin et al., 2019; Thekumparampil et al., 2019) on nonconvexconcave optimisation. First, Assumption 3 implies $F ( \theta )$ is $L -$ weakly convex and $l$ -Lipschitz (Lin et al., 2019, Lemma 4.7). Hence, we define stationarity in the language of weakly convex functions.
174
+
175
+ Definition 1. A point $\theta$ is an $\epsilon -$ stationary point of a weakly convex function $F$ if $\| \nabla F _ { 1 / 2 L } ( \theta ) \| \le \epsilon .$ where $F _ { 1 / 2 L } ( \theta )$ denotes the Moreau envelope $\begin{array} { r } { F _ { 1 / 2 L } ( \theta ) = \mathrm { m i n } _ { w } F ( w ) + L \| w - \theta \| ^ { 2 } } \end{array}$ .
176
+
177
+ With the above definition, we can establish convergence of the following update:
178
+
179
+ Theorem 3 (informal). Under Assumptions 1–4, the update in (8) finds a point $\theta$ with $\mathbb { E } [ \| \nabla F _ { \frac { 1 } { 2 L } } ( \theta ) \| ] \le \epsilon$ in $\mathcal { O } ( \epsilon ^ { - 8 } )$ iterations.
180
+
181
+ For a precise description of the theorem, please see Appendix H. The above result matches the best known rate in Lin et al. (2019) for optimising nonconvex-concave problem with stochastic gradients. To our knowledge, this is the first result that studies convergence of composite objectives with proximal methods under nonconvex-concave settings. By utilizing the proximal operator, it solves the objective with an extra $h ( \pi )$ term without incurring additional complexity cost.
182
+
183
+ # .5 CLIPPING AND REGULARISING FOR FASTER CONVERGENCE
184
+
185
+ In addition to the proposed algorithm, we apply two additional techniques. We explain them here with motivations. First, we also observe that the adversarial’s update could be very sensitive to the adversarial gradient $g _ { k }$ , i.e. label-wise loss in each minibatch, because the gradient appears in the exponential of the update. To avoid convergence degradation resulted from the noise in $g _ { k }$ , we clip the label-wise loss at value 2. Second, we notice that the KL divergence from any interior point of a simplex to its boundary is infinity. Hence, updates near boundary can be highly unstable due to the nonsmooth KL loss. To cope with this, we add a constant $\epsilon$ term on the adversarial distribution to avoid the adversarial distribution reaching any of the vertices on the simplex. The $\epsilon$ term and clipping is critical in both training and convergence analysis. We conduct an ablation of the sensitivity to these parameters in Figures 5 and 6. Note that the experiments show that even without these tricks, our proposed algorithm alone still outperform baselines.
186
+
187
+ # 3.6 DISCUSSION AND COMPARISON TO EXISTING ALGORITHMS
188
+
189
+ A number of existing learning paradigms (e.g., fairness, adversarial training, and domain adaptation) have connections to the problem of adversarial label shift; see Appendix A for details.
190
+
191
+ We comment on some key differences between ADVSHIFT and related techniques in the literature. For the problem of minimising the worst-case loss (2) — which is equivalent to setting the radius $r = + \infty$ in (3) — Sagawa et al. (2020) propose an algorithm that assumes the ability to sample data from a given group in order to evaluate adversarial gradients. Such sampling is cumbersome to implement in most ImageNet data loading pipelines. Mohri et al. (2019) propose a way to evaluate gradients using importance sampling, and then apply projected gradient descent-ascent. This method suffers from instability owing to sampling (upon which we improve with proximal updates), and incurs a non-trivial computational overhead due to the projection step. We will illustrate these problems in our subsequent experiments (see results for AGNOSTIC in $\ S \ O $ ). Finally, for an uncertainty set $\mathcal { P }$ based on the CVaR, Curi et al. (2019) provide an algorithm that updates weights using EXP3. This approach relies on a determinantal point process, which has a poor dimension-dependence.
192
+
193
+ ![](images/bd060e946aeec34579e27012cc1429007d2e585fb4aa017b5179722123f08d23.jpg)
194
+ Figure 2: Comparison of performance on ImageNet under adversarial label distributions. For each method, we vary the KL divergence threshold $\tau$ , and for each $\tau$ report the maximal validation error induced by the adversarial shift within the threshold. Subplots (a) (b) compare the performance of ADVSHIFT trained with different DRO radius $r$ against the default ERM training. We subtract the baseline error of ERM from all values for easy visualization. Absolute values can be found in Figure 8 in the Appendix. Combined with (c), (d), we see that ADVSHIFT can reduce the adversarial validation error by over $\sim 2 . 5 \%$ compared to the BASELINE method and is consistently superior to the AGNOSTIC, BALANCED and FIXED methods. Figure 3(c) illustrates adversarial distributions for varying thresholds $\tau$ .
195
+
196
+ # 4 EXPERIMENTAL RESULTS
197
+
198
+ We now present a series of experiments to evaluate the performance of the proposed ADVSHIFT algorithm and how it compares to related approaches from the literature. We first explain our experiment setups and evaluation methods. We then present the results on ImageNet dataset, and show that under the adversarial validation setting, our proposed algorithm significantly outperforms other methods discussed in Table 1. Similar results on CIFAR-100 are shown in the Appendix.
199
+
200
+ # 4.1 EXPERIMENTAL SETUP
201
+
202
+ To evaluate the proposed method, we use the standard image classification setup of training a ResNet50 on ImageNet using SGD with momentum as the neural network optimiser. All algorithms are run for 90 epochs, and are found to take almost the same clock time. Note that ImageNet has a largely balanced training label distributions, and perfectly balanced validation label distributions.
203
+
204
+ We assess the performance of models under adversarial label shift as follows. First, we train a model on the training set and compute its error distribution on the validation set. Next, we pick a threshold $\tau$ on the allowable KL divergence between the train and target distribution and find the adversarial distribution within this threshold which achieves the worst-possible validation error. Finally, we compute the validation performance under this distribution. Note that $\tau = 0$ corresponds to the train distribution, while $\tau = + \infty$ corresponds to the worst-case label distribution (see Figure 1).
205
+
206
+ We evaluate the following methods, each corresponding to one row in Table 1: (i) standard empirical risk minimisation (BASELINE) (ii) balanced empirical risk minimisation (BALANCED) (iii) agnostic federated learning algorithm of Mohri et al. (2019), which minimises the worst-case loss (AGNOSTIC) (iv) our proposed KL-divergence based algorithm, for various choices of adversarial radius $r$ (ADVSHIFT) (v) training with ADVSHIFT with a fixed adversarial distribution extracted from Figure 3(c) (FIXED). This corresponds to the estimated test distribution row in Table 1 with an ideal estimator.
207
+
208
+ # 4.2 RESULTS AND DISCUSSION
209
+
210
+ Figure 2 shows the train and validation performance on ImageNet. Each curve represents the average and standard deviation across 10 independent trials. To better illustrate the differences amongst methods, we plot the difference in error to the BASELINE method. (See Figure 8 in the Appendix for unnormalised plots.) Subfigures (a) and (b) compre the performance of ADVSHIFT for various choices of radius $r$ to the ERM baseline; (c) and (d) compare ADVSHIFT to the remaining methods.
211
+
212
+ ![](images/d0972a62dbacdf91096b72ea52e590c9fde2b7d2c0a645535fd27ae0e3844d9a.jpg)
213
+
214
+ ![](images/a56805e8b54572eb762726077a3a6a6dd4345b75740409610bb307993378fbf2.jpg)
215
+ Figure 3: Subplots (a) (b) show violin plots of the distribution of errors for both the BASELINE and our ADVSHIFT methods over the course of training. On the training set, ADVSHIFT significantly reduces the worst-case error, evidenced by lower upper endpoints of the distribution. On the validation set, the reduction is consistent, albeit less pronounced owing to a generalisation gap. Subplot (c) illustrates adversarial distributions at KL distances of 1, 2 and 3 for model trained with BASELINE. Even at $\tau = 1$ , the adversarial distribution is highly concentrated on only a few hard labels.
216
+ Figure 4: Evolution of learned adversarial distribution $( \pi )$ across training epochs. Starting off from a uniform distribution over labels, the adversary quickly infers the relative difficulty of a small fraction of labels, assigning nearly $2 \times$ the weight on them compared to the average. This distribution remains largely stable in subsequent iterations, getting gradually more concentrated as training converges.
217
+
218
+ Hyperparameters for each method are separately tuned. FIXED 1, 2, 3 corresponds to training with each of the three adversarial distributions in Figure 3(c). We see that:
219
+
220
+ • the reduction offered by ADVSHIFT is consistently superior to that afforded by the AGNOSTIC, BALANCED and FIXED methods. On the training set, we observe significant $( \sim 8 \%$ ) reduction in performance for large KL divergence thresholds. On the validation set, the gains are less pronounced $( \sim 2 . 5 \% )$ , indicating some degradation due to a generalisation gap. while ADVSHIFT consistently improves above the baseline across adversarial radii, we observe best performance for $r = 0 . 1$ . Smaller values of $r$ lead to smaller improvements, while training becomes increasingly unstable for larger radii. Please see the discussion in the last section. • during training, AGNOSTIC either learns the adversarial distribution too slowly (such that it behaves like ERM), or uses too large a learning rate for the adversary (such that the training fails). This highlights the importance of the proximal mirror ascent updates in our algorithm.
221
+
222
+ Illustration of distributions at fixed KL thresholds. Figure 3(c) visualises the adversarial distributions corresponding to a few values of the KL threshold $\tau$ . At a threshold of $\tau = 3$ , the adversarial distribution is concentrated on only a few hard labels. Consequently, the resulting performance on such distributions is highly reflective of the worst-case distribution that can happen in reality.
223
+
224
+ Training with a fixed adversarial distribution. Suppose we take the final adversarial distributions shown in Figure 3(c), and then employ them as fixed distributions during training; this corresponds to the specified a-priori and estimated validation distribution approaches in Table 1. Does the resulting model similarly reduce the error on hard classes? Surprisingly, Figure 2(d) indicates this is not so, and performance is in fact significantly worse on the “easy” classes. Employing a fixed adversarial distribution may thus lead to underfitting, which has an intuitive explanation: the model must struggle to fit difficult patterns from early stages of training. Similar issues with importance weighting in conjunction with neural networks have been reported in Byrd & Lipton (2019).
225
+
226
+ Evolution of error distributions. To dissect the evolution of performance during training, Figure 3 shows violin plots of the distribution of errors for both the BASELINE and our ADVSHIFT methods after fixed training epochs. We observe that on the training set, ADVSHIFT significantly reduces the worst-case error, evidenced by the upper endpoints of the distribution being reduced. Note also that, as expected, the adversarial algorithm is slower to reduce the error on the “easy” classes early in training, evidenced by the lower endpoints of the distribution initially taking higher values. On the validation set, the reduction is consistent, albeit less pronounced owing to a generalisation gap.
227
+
228
+ ![](images/ba926640db87c4f5979005fe8e78d890cc4d046b35521466d363ad71385950ae.jpg)
229
+ Figure 5: Ablation of loss clipping threshold. We see that when the clipping threshold is either too large or too small, validation performance of the model tends to suffer.
230
+
231
+ ![](images/a31cf2fa1f54c02267afad99f761807a44b9c79901c8f5cbae7de4fe0f119724.jpg)
232
+ Figure 6: Ablation of gradient stabilisation parameter $\epsilon$ , which is a constant added to the gradient updates to prevent iterates from reaching the vertices of the simplex. We see that without any gradient stabilisation, the model’s performance rapidly degrades as the adversarial radius increases. Conversely, performance also suffers when the stablisation is too high.
233
+
234
+ Evolution of learned adversarial weights. To understand the evolution of the adversarial distribution across training epochs, Figure 4 plots the histogram of adversary weights at fixed training epochs. Starting off from a uniform distribution, the adversary is seen to quickly infer the relative difficulty of a small fraction of labels, assigning $\sim 2 \times$ the weight on them compared to the average. In subsequent iterations the distribution becomes more concentrated, and gradually reduces the largest weights.
235
+
236
+ # Ablation of clipping threshold and gradient stabiliser.
237
+
238
+ Figures 5 and 6 show an ablation of the choice of loss clipping threshold, and the gradient stabiliser . We see that when the clipping threshold is either too large or too small, validation performance of the model tends to suffer (albeit still better than the baseline). Similarly, we see that without any gradient stabilisation, the model’s performance rapidly degrades as the adversarial radius increases. Conversely, performance also suffers when the stablisation is too high.
239
+
240
+ In summary, our experiments show that our proposed DRO formulation can be effectively solved with ADVSHIFT, and results in a model that is robust to adversarial label shift.
241
+
242
+ # 5 DISCUSSION AND FUTURE WORK
243
+
244
+ We proposed ADVSHIFT, an algorithm for coping with label shift based on distributionally robust optimisation, and illustrated its effectiveness of real-world datasets. Despite this, our approach does not solve the problem fully. First, Figure 2(a)(b) shows that the generalization gap increases as the perturbation radius increases. Understanding why there is a correlation between hard examples and bad generalization could improve robustness. Second, Figure 2(a) shows that even on the train set, the algorithm threshold $r$ does not translate to the model’s level of robustness. We conjecture this results from the interplay of model expressivity and data distribution, whose future study is of interest.
245
+
246
+ # REFERENCES
247
+
248
+ Roc´ıo Alaiz-Rodr´ıguez, Alicia Guerrero-Curieses, and Jesus Cid-Sueiro. Minimax regret classifier ´ for imprecise class distributions. Journal of Machine Learning Research, 8:103–130, May 2007. ISSN 1532-4435.
249
+
250
+ Martin Arjovsky, Leon Bottou, Ishaan Gulrajani, and David Lopez-Paz. Invariant risk minimization, ´ 2019.
251
+
252
+ Kamyar Azizzadenesheli, Anqi Liu, Fanny Yang, and Animashree Anandkumar. Regularized learning for domain adaptation under label shifts. In International Conference on Learning Representations, 2019.
253
+
254
+ Shai Ben-David, John Blitzer, Koby Crammer, and Fernando Pereira. Analysis of representations for domain adaptation. In Advances in neural information processing systems, pp. 137–144, 2007.
255
+
256
+ Sebastien Bubeck. Convex optimization: Algorithms and complexity, 2014. ´
257
+
258
+ Jonathon Byrd and Zachary Chase Lipton. What is the effect of importance weighting in deep learning? In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, volume 97 of Proceedings of Machine Learning Research, pp. 872–881. PMLR, 2019.
259
+
260
+ Kaidi Cao, Colin Wei, Adrien Gaidon, Nikos Arechiga, and Tengyu Ma. Learning imbalanced datasets with label-distribution-aware margin loss. In Advances in Neural Information Processing Systems, 2019.
261
+
262
+ Remi Tachet des Combes, Han Zhao, Yu-Xiang Wang, and Geoff Gordon. Domain adaptation with conditional distribution matching and generalized label shift. arXiv preprint arXiv:2003.04475, 2020.
263
+
264
+ Patrick L Combettes and Jean-Christophe Pesquet. Proximal splitting methods in signal processing. In Fixed-point algorithms for inverse problems in science and engineering, pp. 185–212. Springer, 2011.
265
+
266
+ Yin Cui, Menglin Jia, Tsung-Yi Lin, Yang Song, and Serge Belongie. Class-balanced loss based on effective number of samples. In CVPR, 2019.
267
+
268
+ Sebastian Curi, Kfir. Y. Levy, Stefanie Jegelka, and Andreas Krause. Adaptive sampling for stochastic risk-averse learning, 2019.
269
+
270
+ M. A. Davenport, R. G. Baraniuk, and C. D. Scott. Tuning support vector machines for minimax and neyman-pearson classification. IEEE Transactions on Pattern Analysis and Machine Intelligence, 32(10):1888–1898, 2010.
271
+
272
+ Damek Davis and Dmitriy Drusvyatskiy. Stochastic model-based minimization of weakly convex functions. SIAM Journal on Optimization, 29(1):207–239, 2019.
273
+
274
+ Michele Donini, Luca Oneto, Shai Ben-David, John Shawe-Taylor, and Massimiliano Pontil. Empirical risk minimization under fairness constraints. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, NIPS’18, pp. 2796–2806, Red Hook, NY, USA, 2018. Curran Associates Inc.
275
+
276
+ Marthinus Christoffel du Plessis and Masashi Sugiyama. Semi-supervised learning of class balance under class-prior change by distribution matching. Neural Networks, 50:110–119, 2014.
277
+
278
+ J. Duchi and H. Namkoong. Learning models with uniform performance via distributionally robust optimization. arXiv preprint arXiv:1810.08750, 2018.
279
+
280
+ John Duchi, Tatsunori Hashimoto, and Hongseok Namkoong. Distributionally robust losses for latent covariate mixtures, 2020.
281
+
282
+ Charles Elkan. The foundations of cost-sensitive learning. In Proceedings of the 17th International Joint Conference on Artificial Intelligence - Volume 2, IJCAI’01, pp. 973–978, San Francisco, CA, USA, 2001. Morgan Kaufmann Publishers Inc. ISBN 1558608125.
283
+
284
+ Yanbo Fan, Siwei Lyu, Yiming Ying, and Baogang Hu. Learning with average top-k loss. In Advances in neural information processing systems, pp. 497–505, 2017.
285
+
286
+ Louis Faury, Ugo Tanielian, Elvis Dohmatob, Elena Smirnova, and Flavian Vasile. Distributionally robust counterfactual risk minimization. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 3850–3857, 2020.
287
+
288
+ Saurabh Garg, Yifan Wu, Sivaraman Balakrishnan, and Zachary C. Lipton. A unified view of label shift estimation, 2020.
289
+
290
+ Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron C. Courville, and Yoshua Bengio. Generative adversarial nets. In Zoubin Ghahramani, Max Welling, Corinna Cortes, Neil D. Lawrence, and Kilian Q. Weinberger (eds.), Advances in Neural Information Processing Systems 27: Annual Conference on Neural Information Processing Systems 2014, December 8-13 2014, Montreal, Quebec, Canada, pp. 2672–2680, 2014.
291
+
292
+ Jiaxian Guo, Mingming Gong, Tongliang Liu, Kun Zhang, and Dacheng Tao. Ltf: A label transformation framework for correcting label shift. In International Conference on Machine Learning, pp. 3843–3853. PMLR, 2020.
293
+
294
+ Tatsunori Hashimoto, Megha Srivastava, Hongseok Namkoong, and Percy Liang. Fairness without demographics in repeated loss minimization. In Jennifer Dy and Andreas Krause (eds.), International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 1929–1938, Stockholmsmassan, Stockholm Sweden, 10–15 Jul 2018. PMLR. ¨
295
+
296
+ Haibo He and Edwardo A. Garcia. Learning from imbalanced data. IEEE Transactions on Knowledge and Data Engineering, 21(9):1263–1284, 2009.
297
+
298
+ Weihua Hu, Gang Niu, Issei Sato, and Masashi Sugiyama. Does distributionally robust supervised learning give robust classifiers? In Jennifer G. Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmassan, ¨ Stockholm, Sweden, July 10-15, 2018, volume 80 of Proceedings of Machine Learning Research, pp. 2034–2042. PMLR, 2018.
299
+
300
+ Bingyi Kang, Saining Xie, Marcus Rohrbach, Zhicheng Yan, Albert Gordo, Jiashi Feng, and Yannis Kalantidis. Decoupling representation and classifier for long-tailed recognition. In Eighth International Conference on Learning Representations (ICLR), 2020.
301
+
302
+ Wouter M. Kouw and Marco Loog. An introduction to domain adaptation and transfer learning. CoRR, abs/1812.11806, 2018. URL http://arxiv.org/abs/1812.11806.
303
+
304
+ Daniel Levy, Yair Carmon, John C Duchi, and Aaron Sidford. Large-scale methods for distributionally robust optimization. Advances in Neural Information Processing Systems, 33, 2020.
305
+
306
+ Tianyi Lin, Chi Jin, and Michael I. Jordan. On gradient descent ascent for nonconvex-concave minimax problems, 2019.
307
+
308
+ Tianyi Lin, Chi Jin, and Michael. I. Jordan. Near-optimal algorithms for minimax optimization, 2020.
309
+
310
+ Zachary Lipton, Yu-Xiang Wang, and Alexander Smola. Detecting and correcting for label shift with black box predictors. In Jennifer Dy and Andreas Krause (eds.), International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 3122–3130, Stockholmsmassan, Stockholm Sweden, 10–15 Jul 2018. PMLR. ¨
311
+
312
+ Mehryar Mohri, Gary Sivek, and Ananda Theertha Suresh. Agnostic federated learning. In International Conference on Machine Learning, 2019.
313
+
314
+ Krikamol Muandet, David Balduzzi, and Bernhard Scholkopf. Domain generalization via invariant ¨ feature representation. In Sanjoy Dasgupta and David McAllester (eds.), International Conference on Machine Learning, Proceedings of Machine Learning Research, pp. 10–18, Atlanta, Georgia, USA, 17–19 Jun 2013. PMLR.
315
+
316
+ H. Namkoong and J. Duchi. Stochastic gradient methods for distributionally robust optimization with f-divergences. In Advances in Neural Information Processing Systems (NeurIPS), 2016.
317
+
318
+ Hongseok Namkoong and John C Duchi. Variance-based regularization with convex objectives. 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. 2971–2980. Curran Associates, Inc., 2017.
319
+
320
+ Hamed Rahimian and Sanjay Mehrotra. Distributionally robust optimization: A review, 2019.
321
+
322
+ Marco Saerens, Patrice Latinne, and Christine Decaestecker. Adjusting the outputs of a classifier to new a priori probabilities: A simple procedure. Neural Computation, 14(1):21–41, 2002.
323
+
324
+ 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 (ICLR), 2020.
325
+
326
+ Alexander Shapiro, Darinka Dentcheva, and Andrzej Ruszczynski. ´ Lectures on Stochastic Programming: Modeling and Theory, Second Edition. Society for Industrial and Applied Mathematics, Philadelphia, PA, 2014. doi: 10.1137/1.9781611973433.
327
+
328
+ Aman Sinha, Hongseok Namkoong, and John Duchi. Certifying some distributional robustness with principled adversarial training. arXiv preprint arXiv:1710.10571, 2017.
329
+
330
+ Aman Sinha, Hongseok Namkoong, and John Duchi. Certifiable distributional robustness with principled adversarial training. In International Conference on Learning Representations, 2018.
331
+
332
+ Amos J Storkey and Masashi Sugiyama. Mixture regression for covariate shift. In B. Scholkopf,¨ J. C. Platt, and T. Hoffman (eds.), Advances in Neural Information Processing Systems 19, pp. 1337–1344. MIT Press, 2007.
333
+
334
+ Kiran Koshy Thekumparampil, Prateek Jain, Praneeth Netrapalli, and Sewoong Oh. Efficient algorithms for smooth minimax optimization, 2019.
335
+
336
+ Robert C. Williamson and Aditya Krishna Menon. Fairness risk measures. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, pp. 6786–6797, 2019.
337
+
338
+ Yu Xie and Charles F. Manski. The logit model and response-based samples. Sociological Methods & Research, 17(3):283–302, 1989.
339
+
340
+ Muhammad Bilal Zafar, Isabel Valera, Manuel Gomez Rodriguez, and Krishna P. Gummadi. Fairness beyond disparate treatment & disparate impact: Learning classification without disparate mistreatment. In Proceedings of the 26th International Conference on World Wide Web, WWW ’17, pp. 1171–1180, Republic and Canton of Geneva, CHE, 2017. International World Wide Web Conferences Steering Committee. ISBN 9781450349130.
341
+
342
+ Kun Zhang, Bernhard Scholkopf, Krikamol Muandet, and Zhikun Wang. Domain adaptation under ¨ target and conditional shift. In Proceedings of the 30th International Conference on International Conference on Machine Learning - Volume 28, ICML’13, pp. III–819–III–827. JMLR.org, 2013.
343
+
344
+ # A RELATED PROBLEMS
345
+
346
+ Example-level DRO. Existing work on DRO has largely focussed on the setting where $\mathcal { P }$ encompasses shifts in the instance space (Namkoong & Duchi, 2016; 2017; Sinha et al., 2018; Duchi & Namkoong, 2018; Levy et al., 2020). This notion of robustness has a natural link with adversarial training (Sinha et al., 2017), and involves a more challenging problem, as it requires parameterising the adversary’s distribution. Hu et al. (2018) illustrate the potential pitfalls of DRO, owing to a mismatch between surrogate and 0-1 losses. They also propose to encode an uncertainty set based on latent label distribution shift (Storkey & Sugiyama, 2007), which requires domain knowledge. The techniques in example-level DRO are mostly designed for small scale dataset with SVM models, as these techniques require sampling according to adversarial distribution, which can be very unstable if implemented with importance sampling only. It also requires maintaining a vector proportional to the number of labels and indexing each sample during training to match up the sample index, which is not available in most dataloading pipelines.
347
+
348
+ Fairness. Adversarial label shift may be related to algorithmic fairness. Abstractly, this concerns the mitigation of systematic bias in predictions on sensitive subgroups (e.g., country of origin). One fairness criteria posits that the per-subgroup errors should be equal (Zafar et al., 2017; Donini et al., 2018), an ideal that may be targetted by minimising the worst-subgroup error (Mohri et al., 2019; Sagawa et al., 2020). When the subgroups correspond to labels, ensuring this notion of fairness is tantamount to guarding against an adversary that can place all mass on the worst performing label.
349
+
350
+ GANs. GANs (Goodfellow et al., 2014) involve solving a min-max objective that bears some similarity to the DRO formulation (3), but is fundamentally different in details: while DRO considers reweighting of samples according to a fixed family, GANs involve a parameterised adversarial family, with the training objective augmented with an additional penalty.
351
+
352
+ Domain adaptation. Label shift can be viewed as a special case of domain adaptation, where $p _ { \mathrm { t r } }$ and $p _ { \mathrm { t e } }$ can systematically differ. Typically, one assumes access to a small sample from $p _ { \mathrm { t e } }$ , which may be used to estimate importance weights (Combes et al., 2020), or samples from multiple domains, which may be used to estimate a generic domain-agnostic representation (Muandet et al., 2013). In causal inference, there has been interest in similar classes of models (Arjovsky et al., 2019).
353
+
354
+ # B ALGORITHM IMPLEMENTATION DETAILS
355
+
356
+ We introduce some additional details in our implementation of ADVSHIFT. First, as observed in Section 3.1, our algorithm requires knowing the empirical label distribution. As the exact value is not always available, we estimate the empirical label distribution online for all the experiments presented later in Section 4 using an exponential moving average, $p _ { \mathrm { e m p } } = \beta \cdot p _ { \mathrm { e m p } } + ( 1 - \beta ) \cdot p _ { \mathrm { b a t c h } }$ , where $p _ { \mathrm { b a t c h } }$ is the label distribution in the minibatch. We set $\beta = 0 . 9 9 9$ . The number is set such that the exponential moving average has a half-life roughly equal to the number of iterations in one epoch of ImageNet training using our setup.
357
+
358
+ In all the experiments, we set $2 \gamma _ { c } \lambda = 1$ in Algorithm 1 for simplicity. For learning the adversarial distribution, we only tune the adversarial learning rate $\eta _ { \pi }$ .
359
+
360
+ # C ADDITIONAL EXPERIMENTAL RESULTS
361
+
362
+ We present here additional experimental results, including:
363
+
364
+ • for ImageNet, an illustration of the lack of correlation between a label’s frequency in the training set, and its validation error. (Figure 7) unnormalised versions of the results on ImageNet shown in the body, where we do not subtract the baseline performance from each of the curves; this gives a sense of the absolute performance numbers obtained by each method. (Figure 8)
365
+ • an ablation of the loss clipping threshold and gradient stabiliser $\epsilon$ as introduced above. (Figure 5,6)
366
+ • results on CIFAR-100, to complement those for ImageNet. (Figure 9,10)
367
+
368
+ ![](images/a520e8b289893455646126cfd5ca63e844157e7dcdaa15105a6be6f5a79a7806.jpg)
369
+ Figure 7: Illustration that training label frequency does not strongly correlate with test error. Observe that several classes with a high error appear frequently in the training set.
370
+
371
+ ![](images/86d4b0e48f8565e0e2549c4dc207d0b33c9bd820cd3d5fcc24e8241af0af2c6e.jpg)
372
+ Figure 8: Comparison of performance of various methods on ImageNet under adversarial label distributions. For each plot, we vary a KL divergence threshold $\tau$ , and for a given $\tau$ construct the label distribution which results in maximal test error for the baseline model. We then compute the test error under this distribution. Note that the case $\tau = 0$ corresponds to using the train distribution, while $\tau = + \infty$ corresponds to using the worst-case label distribution, which is concentrated on the worst-performing label. Our proposed ADVSHIFT can reduce the adversarial test error by over $\sim 2 . 5 \%$ over the baseline method.
373
+
374
+ # C.1 BALANCED LABELS $\nRightarrow$ BALANCED PERFORMANCE
375
+
376
+ Figure 7 shows that training label frequency does not strongly correlate with test error. Observe that several classes with a high error appear frequently in the training set. Indeed, the three classes with highest error – casette player, maillot, and water jug – all appear an equal number of times in the training set.
377
+
378
+ # C.2 UNNORMALISED PLOTS ON IMAGENET
379
+
380
+ Figure 8 presents plots of the unnormalised performance of the various methods compared in the body. Here, rather than subtract the performance of the baseline, we show the absolute accuracy of each method as the adversarial radius is varied. Evidently, the baseline and AGNOSTIC models tend to suffer in their validation error as the adversarial radius increases.
381
+
382
+ # C.3 RESULTS ON CIFAR-100
383
+
384
+ Figure 9 shows results on CIFAR-100, where we train various methods using a CIFAR-ResNet-18 as the underlying architecture, Here, we see a consistent and sizable improvement from ADVSHIFT over the baseline method. On this dataset, AGNOSTIC fares better, and eventually matches the performance of ADVSHIFT with a large adversarial radius. This is in keeping with the intended use-case of AGNOSTIC, i.e., minimising the worst-case loss. Figure 10 supplements these plots with unnormalised versions, to illustrate the absolute performance differences.
385
+
386
+ ![](images/0a7a04ccdfa5ecafabe929e79af042a313f6ca9119019b280e522edc085aa52f.jpg)
387
+ Figure 9: Comparison of performance of various methods on CIFAR-100.
388
+
389
+ ![](images/fec85174177b8c4435ef89c5a745fdb755c48cbee98c794a89b21e8bb1b3a962.jpg)
390
+ Figure 10: Comparison of performance of various methods on CIFAR-100 (unnormalised).
391
+
392
+ We remark here that the choice of a CIFAR-ResNet-18 results in an underparameterised model, which does not perfectly fit the training data. In the overparameterised case, there are challenges with employing DRO, as noted by Sagawa et al. (2020). Addressing these challenges in settings where the training data is balanced remains an interesting open question.
393
+
394
+ # D CONSTRAINED DRO DOES NOT PERMIT A BOLTZMAN SOLUTION
395
+
396
+ We start with a simple example with three label classes $\{ a , b , c \}$ with class losses $l = \{ 1 , 2 , 4 \}$ respectively. We assume an uniform empirical distribution, i.e. $p _ { \mathrm { e m p } } = \{ 1 / 3 , 1 / 3 , 1 / \bar { 3 } \}$ . We consider two different problems. The first is to find the optimal solution to regularised objective,
397
+
398
+ $$
399
+ \begin{array} { r } { p = \mathrm { a r g m i n } _ { p } p ^ { \top } l + \gamma \mathrm { K L } ( p , p _ { \mathrm { e m p } } ) . } \end{array}
400
+ $$
401
+
402
+ This problem is well known (e.g. see 2.7.2 of lecture ) to permit a solution of form $p ( x ) \ =$ P exp lx/tx0∈{a,b,c} exp l0x/t for some t.
403
+
404
+ In contrast, we show that distributions of the above form does not solve the constrained version of the problem. In particular, we consider the following optimisation problem:
405
+
406
+ $$
407
+ \operatorname* { m a x } _ { \boldsymbol { p } } p ^ { \intercal } l
408
+ $$
409
+
410
+ If the solution is of form $\begin{array} { r } { p ( x ) = \frac { \exp { l _ { x } / t } } { \sum _ { x ^ { \prime } \in \{ a , b , c \} } { \exp { l _ { x } ^ { \prime } / t } } } } \end{array}$ , then we know for ${ \mathit { l } } _ { b } \neq { \mathit { l } } _ { c }$
411
+
412
+ $$
413
+ ( \log ( p _ { a } ) - \log ( p _ { c } ) ) / ( \log ( p _ { b } ) - \log ( p _ { c } ) ) = ( l _ { a } - l _ { c } ) / ( l _ { b } - l _ { c } ) .
414
+ $$
415
+
416
+ We solve the above problem with a convex optimizer using $r = 0 . 0 1$ and found $p _ { a } = 0 . 2 8 3 , p _ { b } =$ $0 . 3 2 2 , p _ { c } = 0 . 3 9 5$ .
417
+
418
+ $$
419
+ ( \log ( p _ { a } ) - \log ( p _ { c } ) ) / ( \log ( p _ { b } ) - \log ( p _ { c } ) ) = 1 . 6 4 \neq ( l _ { a } - l _ { c } ) / ( l _ { b } - l _ { c } ) = 1 . 5 .
420
+ $$
421
+
422
+ Note that the above example shows that not all solutions of the contrained problem can be written a Boltzman distribution, i.e. $\begin{array} { r } { p ( x ) = \frac { \exp { l _ { x } / t } } { \sum _ { x ^ { \prime } \in \{ a , b , c \} } { \exp { l _ { x } ^ { \prime } / t } } } } \end{array}$ . Yet, this does not contradict with results
423
+
424
+ [e.g. Lemma 4, Faury et al. (2020)] that claim there is a Boltzman distribution whose function value matches the optimal value of the constraint problem. Mathematically, we can have $p \neq p ^ { \prime }$ but $\mathbb { E } _ { p } [ l ( x ) ] = \mathbb { E } _ { p ^ { \prime } } [ l ( x ) ]$ .
425
+
426
+ # E PROJECTING AN ADVERSARIAL DISTRIBUTION
427
+
428
+ The projection operator in our setting aims to project a distribution $p$ into the set ${ \mathcal { P } } = \{ q : \mathrm { K L } ( q , { \hat { p } } ) \leq$ $r \}$ by solving the following problem:
429
+
430
+ $$
431
+ \begin{array} { c } { \displaystyle \operatorname* { m i n } _ { { q } } \| q - p \| ^ { 2 } } \\ { \displaystyle } \\ { \mathrm { s u c h ~ t h a t ~ } \sum _ { i } q _ { i } \log ( q _ { i } / p _ { i } ) \leq r } \\ { \displaystyle \sum _ { i } q _ { i } = 1 , } \\ { \forall i , q _ { i } \geq 0 , } \end{array}
432
+ $$
433
+
434
+ where $q _ { i } , p _ { i }$ denotes the $i _ { t h }$ component of $q , p$ and $n$ denotes number of classes. Given that our implementation is based on Tensorflow, we use the “trust-region constrained algorithm” provided by SciPy for easy integration with our python-based training procedure. However, even after extensive tuning, solving each problem up to $1 \%$ relative constraint error requires more than 1 minute when $n = 1 0 0 0$ (the number of labels in ImageNet). This means that if we train ResNet50 on ImageNet for $1 0 0 \mathrm { k }$ iterations, we need to spend $1 0 0 k$ minutes on projection operation, which is not affordable.
435
+
436
+ # F PROOF OF PROPOSITION 1
437
+
438
+ Proof. We only need to show that for large enough $\gamma _ { c }$ , any minimiser $p ^ { * }$ of the unconstrained problem satisfies that $\mathrm { K L } ( p ^ { * } , p _ { \mathrm { e m p } } ) \leq r$ . Since the distance from boundary of the simplex to any interior point is $+ \infty$ , we can safely assume that the point lies within the relative interior of the simplex. To prove the proposition, denote $c = \operatorname* { i n f } \{ | | { \hat { \nabla } } _ { p } \mathrm { K L } ( p , p _ { \mathrm { e m p } } ) | | \mid p \in \Delta ^ { L } , s . t . \mathrm { K L } ( p , p _ { \mathrm { e m p } } ) { \stackrel { . } { > } } r \} \quad$ By strict convexity of KL divergence and the fact that $r \ > \ 0$ , we know $c > 0$ . Denote the upper bound of loss as $M$ , then when $\gamma _ { c } > M / c$ , we know that $\mathrm { K L } ( p , p _ { \mathrm { e m p } } ) > r \implies 0 \notin$ $\partial _ { \pi } ( \mathbb { E } _ { \pi } [ \ell ( x , y , \theta ) ] + \operatorname* { m i n } \{ 0 , \gamma _ { c } ( r - \mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) ) \} )$ . However, since $p$ minimises the objective if and only if $0 \in \partial _ { \pi } ( \mathbb { E } _ { \pi } [ \ell ( x , y , \theta ) ] + \operatorname* { m i n } \{ 0 , \gamma _ { c } ( r - \mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) ) \} )$ , we have that any minimiser $p$ must satisfy $\mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) ) \leq r$ . □
439
+
440
+ # G PROOF OF LEMMA 2
441
+
442
+ Recall that we want to find $\pi _ { k + 1 }$ that minimises the following objective,
443
+
444
+ $$
445
+ \begin{array} { l } { \displaystyle \pi _ { k + 1 } = \underset { \pi \in \Delta } { \mathrm { a r g m i n } } h ( \pi ) + \frac { 1 } { 2 \lambda } ( \mathrm { K L } ( \pi , \pi _ { k } ) + 2 \lambda \langle g _ { k } , \pi \rangle ) } \\ { = \underset { \pi \in \Delta } { \mathrm { a r g m i n } } \operatorname* { m a x } \left\{ 0 , \frac { \alpha _ { c } } { 1 + \alpha _ { c } } \mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) \right\} + \frac { 1 } { 1 + \alpha _ { c } } ( \mathrm { K L } ( \pi , \pi _ { k } ) - \eta \langle g _ { k } , \pi \rangle ) , } \end{array}
446
+ $$
447
+
448
+ where $\eta = 1 / ( 2 \gamma _ { c } + 1 / \lambda )$ , $\alpha _ { c } = 2 \gamma _ { c } \lambda$ . Denote $v ( i )$ as the $i _ { t h }$ component of vector $v$ . Notice that the simplex can be written as a constraint that $\begin{array} { r } { \sum _ { i } \pi ( i ) = 1 ; \forall i , \pi ( i ) \ge 0 } \end{array}$ . Based on this constraint, we first write (6)’s Lagrangian dual
449
+
450
+ $$
451
+ \begin{array} { r } { L ( { a } , { b } , \pi ) = \displaystyle \sum _ { i } ( a _ { i } \pi ( i ) ) + b ( \displaystyle \sum _ { i } \pi ( i ) - 1 ) + \operatorname* { m a x } \left\{ 0 , \frac { \alpha _ { c } } { 1 + \alpha _ { c } } ( \mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) - r ) \right\} } \\ { + \frac { 1 } { 1 + \alpha _ { c } } ( \mathrm { K L } ( \pi , \pi _ { k } ) - \eta \langle { g } _ { k } , \pi \rangle ) } \end{array}
452
+ $$
453
+
454
+ where $\pi ( i )$ denotes the $i _ { t h }$ component of $\pi$ . If $\pi _ { k } > 0$ component-wise, then the optimal $\pi$ cannot lie on the boundary (i.e. $\forall i , \pi ( i ) > 0 \rangle$ , which results in $\mathrm { K L } ( \pi , \pi _ { k } ) = \infty$ . By Lagrangian duality and
455
+
456
+ complementary slackness, we know that for if $\mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) > r$
457
+
458
+ $$
459
+ 0 = { \frac { \partial } { \partial \pi ( i ) } } L ( a , b , \pi ) = b + { \frac { \alpha _ { c } } { 1 + \alpha _ { c } } } \log ( \pi ( i ) / p _ { \mathrm { e m p } } ( i ) ) + { \frac { 1 } { 1 + \alpha _ { c } } } \log ( \pi ( i ) / \pi _ { k } ( i ) ) - \eta g _ { k } ( i ) + 1 .
460
+ $$
461
+
462
+ On the other hand, if $\mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) < r$
463
+
464
+ $$
465
+ 0 = \frac { \partial } { \partial \pi ( i ) } L ( a , b , \pi ) = b + \frac { 1 } { 1 + \alpha _ { c } } \log ( \pi ( i ) / \pi _ { k } ( i ) ) - \eta g _ { k } ( i ) + 1 .
466
+ $$
467
+
468
+ We discuss the case when $\mathrm { K L } ( \pi , p _ { \mathrm { e m p } } ) < r$ , and the other case follows similarly. Rearrange the optimality condition of Lagrangian multiplier, we get
469
+
470
+ $$
471
+ \frac { \alpha } { 1 + \alpha } \log ( \pi ( i ) / p _ { \mathrm { e m p } } ( i ) ) + \frac { 1 } { 1 + \alpha _ { c } } \log ( \pi ( i ) / \pi _ { k } ( i ) ) - \eta g _ { k } ( i ) = - b - 1 .
472
+ $$
473
+
474
+ Since $b$ is a constant for all coordinates,
475
+
476
+ $$
477
+ \begin{array} { r } { \pi ( i ) \propto ( p _ { \mathrm { e m p } } ( i ) _ { c } ^ { \alpha } \pi _ { k } ( i ) ) ^ { 1 / ( 1 + \alpha _ { c } ) } \exp { ( \frac { \eta g _ { k } ( i ) } { 1 + \alpha _ { c } } ) } . } \end{array}
478
+ $$
479
+
480
+ The result follows by noting that $\begin{array} { r } { \sum _ { i } \pi ( i ) = 1 } \end{array}$ .
481
+
482
+ # H PROOF OF THEOREM 3
483
+
484
+ For completeness, we define several terms used in optimisation. A function $f ( \theta )$ is $l$ −Lipschitz if for all $\theta , \theta ^ { \prime }$ ,
485
+
486
+ $$
487
+ \begin{array} { r } { | f ( \theta ) - f ( \theta ^ { \prime } ) | \leq l \| \theta - \theta ^ { \prime } \| . } \end{array}
488
+ $$
489
+
490
+ A function $f ( \theta )$ is $L$ −smooth if for all $\theta , \theta ^ { \prime }$ ,
491
+
492
+ $$
493
+ \| \nabla f ( \theta ) - \nabla f ( \theta ^ { \prime } ) \| \leq L \| \theta - \theta ^ { \prime } \| .
494
+ $$
495
+
496
+ A function $f ( \theta )$ is $L -$ weakly convex if $\begin{array} { r } { f ( \theta ) + \frac { L } { 2 } \lVert \theta \rVert ^ { 2 } } \end{array}$ is convex.
497
+
498
+ Then we can state the formal theorem below.
499
+
500
+ Theorem 4 (formal version of Theorem 3). Under Assumptions 1–4, the update in (8) generates a sequence of points $\theta _ { 1 } , . . . , \theta _ { T }$ with the following property:
501
+
502
+ $$
503
+ \begin{array} { r l } & { \frac { 1 } { T } \displaystyle \sum _ { t } \mathbb { E } [ \| \nabla F _ { 1 / 2 L } ( \theta _ { t } ) \| ^ { 2 } ] \leq \frac { 1 } { T ^ { 1 / 4 } } \left( \frac { 2 } { L } ( F _ { 1 / 2 L } ( \theta _ { 0 } ) - F _ { 1 / 2 L } ^ { \ast } ) + 2 G + G ^ { 2 } + \frac { R } { 2 } + ( l ^ { 2 } + \sigma ^ { 2 } ) ^ { 1 / 2 } ) \right) } \\ & { \quad \quad \quad \quad \quad + ( h ^ { \ast } - h ( \pi _ { 0 } ) ) / T } \end{array}
504
+ $$
505
+
506
+ Proof. For convenience, denote $\Phi ( \theta , \pi ) = f ( \theta , \pi ) + h ( \pi ) , F ( \theta ) = \mathrm { m a x } _ { p } \Phi ( \theta , p )$ . We start by following the standard SGD proof. Denote $g _ { \theta }$ as the stochastic gradient evaluated at step $t - 1$ with respect to $\theta$ . Denote $\begin{array} { r } { \hat { \theta } = \mathrm { p r o x } _ { F / 2 L } ( \theta ) : = \arg \operatorname* { m i n } _ { w } \{ F ( w ) + 2 L \| w - \theta \| ^ { 2 } \} . } \end{array}$ . Conditioned on $\theta _ { t - 1 }$ , we have
507
+
508
+ $$
509
+ \begin{array} { r l } & { \mathbb { E } [ \| \hat { \theta } _ { t - 1 } - \theta _ { t } \| ^ { 2 } ] = \| \theta _ { t - 1 } - \hat { \theta } _ { t - 1 } \| ^ { 2 } + 2 \eta _ { \theta } \mathbb { E } [ \langle \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } , g _ { \theta } \rangle ] + \eta _ { \theta } ^ { 2 } \mathbb { E } [ \| g _ { \theta } \| ^ { 2 } ] } \\ & { \qquad \leq \| \theta _ { t - 1 } - \hat { \theta } _ { t - 1 } \| ^ { 2 } + 2 \eta _ { \theta } \langle \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } , \nabla _ { \theta } \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) \rangle + \eta _ { \theta } ^ { 2 } ( L ^ { 2 } + \sigma ^ { 2 } ) } \end{array}
510
+ $$
511
+
512
+ where the first equality follows by $\theta _ { t } = \theta _ { t - 1 } - \eta _ { \theta } \nabla _ { \theta } \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } )$ . Next, we observe that
513
+
514
+ $$
515
+ \begin{array} { r l r } { { \langle \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } , \nabla _ { \theta } \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) \rangle \leq \Phi ( \hat { \theta } _ { t - 1 } , \pi _ { t - 1 } ) - \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) + \frac { L } { 2 } \| \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } \| ^ { 2 } } } \\ & { } & \\ & { } & { \leq F ( \hat { \theta } _ { t - 1 } ) - \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) + \displaystyle \frac { L } { 2 } \| \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } \| ^ { 2 } } \\ & { } & \\ & { } & { \leq F ( \theta _ { t - 1 } ) - \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) - \displaystyle \frac { L } { 2 } \| \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } \| ^ { 2 } } \end{array}
516
+ $$
517
+
518
+ The first line follows by convexity and $L -$ smoothness. The second line by definition of $F$ . The third line by definition of $\hat { \theta }$ . Next, by definition of Moreau envelop,
519
+
520
+ $$
521
+ F _ { 1 / 2 L } ( \theta _ { t } ) \leq F ( \hat { \theta } _ { t - 1 } ) + L \Vert \hat { \theta } _ { t - 1 } - \theta _ { t } \Vert ^ { 2 }
522
+ $$
523
+
524
+ Take expectation on both sides and we get
525
+
526
+ $$
527
+ \begin{array} { r l } & { \cdots _ { \ell } \binom { n - 1 } { \ell - 1 } + \mathcal { L } [ L \| \hat { \theta } _ { t - 1 } - \theta _ { t } \| ^ { 2 } ] } \\ & { \leq F ( \hat { \theta } _ { t - 1 } ) + \mathbb { E } [ L \| \hat { \theta } _ { t - 1 } - \theta _ { t } \| ^ { 2 } ] } \\ & { = F ( \hat { \theta } _ { t - 1 } ) + L ( \| \theta _ { t - 1 } - \hat { \theta } _ { t - 1 } \| ^ { 2 } + 2 \eta _ { \theta } \langle \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } , \nabla _ { \theta } \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) \rangle + \eta _ { \theta } ^ { 2 } ( l ^ { 2 } + \sigma ^ { 2 } ) ) } \\ & { \leq F _ { 1 / 2 L } ( \theta _ { t - 1 } ) + 2 L \eta _ { \theta } ( \Phi ( \hat { \theta } _ { t - 1 } , \pi _ { t - 1 } ) - \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) - \displaystyle \frac { L } { 2 } \| \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } \| ^ { 2 } ) + L \eta _ { \theta } ^ { 2 } ( l ^ { 2 } + \sigma ^ { 2 } ) } \end{array}
528
+ $$
529
+
530
+ The second line substitutes in (9). The third line follows by convexity and $L -$ smoothness. Denote that $\Delta _ { t } : = F ( \hat { \theta } _ { t - 1 } ) - \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } ) \geq \Phi ( \hat { \theta } _ { t - 1 } , \pi _ { t - 1 } ) - \Phi ( \theta _ { t - 1 } , \pi _ { t - 1 } )$ . We can sum over $t$ and take expectation recursively to get,
531
+
532
+ $$
533
+ \begin{array} { r l r } { { \sum _ { t } \mathbb { E } [ \| \nabla F _ { 1 / 2 L } ( \theta _ { t } ) \| ^ { 2 } ] = 2 L \sum _ { t } \mathbb { E } [ \| \hat { \theta } _ { t - 1 } - \theta _ { t - 1 } \| ^ { 2 } ] } } \\ & { } & { \leq \frac { 2 } { L \eta _ { \theta } } ( F _ { 1 / 2 L } ( \theta _ { 0 } ) - F _ { 1 / 2 L } ^ { * } ) + 4 \sum _ { t } \Delta _ { t } + T \eta _ { \theta } ( l ^ { 2 } + \sigma ^ { 2 } ) ) } \end{array}
534
+ $$
535
+
536
+ where $F _ { 1 / 2 L } ^ { * } = \operatorname* { m i n } _ { \theta } F _ { 1 / 2 L } ( \theta )$ . The first equality follows by the definition of Moreau envelope. The second inequality follows by rearranging (11).
537
+
538
+ Next, we aim to bound the accumulated error $\textstyle \sum _ { t } \Delta _ { t }$ .
539
+
540
+ Recall that the update for the $\pi$ is as follows for $\mathbb { E } [ g _ { \pi } ] = \nabla _ { \pi } f ( \theta , \pi )$ ,
541
+
542
+ $$
543
+ \begin{array} { r } { \pi _ { k + 1 } : = \operatorname * { a r g m i n } _ { \pi \in \Delta ^ { L } } \{ - 2 \lambda \langle g _ { \pi } , \pi \rangle - 2 \lambda h ( \pi ) + \mathrm { K L } ( \pi , \pi _ { k } ) \} } \end{array}
544
+ $$
545
+
546
+ Applying Lemma 5 with ${ \cal L } ( \pi ) = - 2 \lambda \langle g _ { \pi } , \pi \rangle + - 2 \lambda h ( \pi )$ , we get
547
+
548
+ $$
549
+ \begin{array} { r l } & { - h ( \pi ^ { * } ( \theta _ { s } ) ) - \langle g _ { \pi } , \pi ^ { * } ( \theta _ { s } ) \rangle + \mathrm { K L } ( \pi ^ { * } , \pi _ { k } ) } \\ & { \qquad \ge - \langle g _ { \pi } , \pi _ { k + 1 } \rangle - h ( \pi _ { k + 1 } ) + \mathrm { K L } ( \pi _ { k + 1 } , \pi _ { k } ) + \mathrm { K L } ( \pi ^ { * } , \pi _ { k + 1 } ) } \end{array}
550
+ $$
551
+
552
+ Rearrange and take expectation we get
553
+
554
+ $$
555
+ \begin{array} { r l } & { 2 \lambda ( \mathbb { E } [ \langle - g _ { \pi } , \pi _ { k } - \pi ^ { * } ( \theta _ { s } ) \rangle ] - \mathbb { E } [ h ( \pi _ { k + 1 } ) ] + \mathbb { E } [ h ( \pi ^ { * } ( \theta _ { s } ) ) ] ) } \\ & { \ \leq - \mathbb { E } [ \mathrm { K L } ( \pi _ { k + 1 } , \pi _ { k } ) ] + \mathrm { K L } ( \pi ^ { * } , \pi _ { k + 1 } ) - \mathrm { K L } ( \pi ^ { * } , \pi _ { k } ) + 2 \lambda ( \mathbb { E } [ \langle g _ { \pi } , \pi _ { k } - \pi _ { k + 1 } \rangle ] ) } \\ & { \ \leq - \mathbb { E } [ \mathrm { K L } ( \pi _ { k } , \pi ^ { * } ) ] + \mathbb { E } [ \mathrm { K L } ( \pi ^ { * } , \pi _ { k + 1 } ) ] - \| \pi ^ { * } - \pi _ { k } \| _ { 1 } ^ { 2 } / 2 + 2 \lambda ^ { 2 } \mathbb { E } [ \| g _ { \pi } \| _ { \infty } ^ { 2 } ] + \| \pi ^ { * } - \pi _ { k } \| _ { 1 } ^ { 2 } / 2 } \end{array}
556
+ $$
557
+
558
+ The second inequality follows by the fact that $K L -$ divergence is strongly convex with respect to $L _ { 1 }$ norm and Cauchy-Schwartz inequality. We further observe that
559
+
560
+ $$
561
+ \begin{array} { r l } & { - \mathbb { E } [ \langle g _ { \pi } , \pi _ { k } - \pi ^ { * } ( \theta _ { s } ) \rangle ] = - \langle \nabla _ { \pi } f ( \theta _ { k } , \pi _ { k } ) , \pi _ { k } - \pi ^ { * } ( \theta _ { s } ) \rangle \geq - f ( \theta _ { k } , \pi _ { k } ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { s } ) ) } \\ & { \quad \quad \quad \quad = - f ( \theta _ { k } , \pi _ { k } ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) - f ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { s } ) ) } \\ & { \quad \quad \quad \geq - f ( \theta _ { k } , \pi _ { k } ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) - f ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) + f ( \theta _ { s } , \pi ^ { * } ( \theta _ { k } ) ) } \\ & { \quad \quad \quad - f ( \theta _ { s } , \pi ^ { * } ( \theta _ { s } ) ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { s } ) ) } \\ & { \quad \quad \quad \geq - f ( \theta _ { k } , \pi _ { k } ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) - 2 l \| \theta _ { s } - \theta _ { k } \| } \end{array}
562
+ $$
563
+
564
+ The first inequality follows by concavity. The third line follows by $f ( \theta _ { s } , \pi ^ { * } ( \theta _ { k } ) ) \leq f ( \theta _ { s } , \pi ^ { * } ( \theta _ { s } ) )$ The last inequality follows by Lipschitzness. Similarly,
565
+
566
+ $$
567
+ - h ( \theta _ { k } , \pi _ { k } ) + h ( \theta _ { k } , \pi ^ { * } ( \theta _ { s } ) ) \geq - h ( \theta _ { k } , \pi _ { k } ) + h ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) - 2 l \| \theta _ { s } - \theta _ { k } \|
568
+ $$
569
+
570
+ We can take iterative expectation and get sum over $k = s + 1 , . . . , s + B$ to get
571
+
572
+ $$
573
+ \begin{array} { r l r } { { \sum _ { k = s + 1 } ^ { s + B } \mathbb { E } [ - f ( \theta _ { k } , \pi _ { k } ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) - h ( \pi _ { k } ) + h ( \pi ^ { * } ( \theta _ { k } ) ) ] } } \\ & { } & \\ & { } & { \leq - h ( \pi _ { s } ) + \mathbb { E } [ h ( \pi _ { s + B } ) ] + 4 l \sum _ { k = s + 1 } ^ { s + B } \sum _ { j = s } ^ { k } \mathbb { E } [ \| \theta _ { j } - \theta _ { j + 1 } \| ] + \lambda B G ^ { 2 } } \\ & { } & \\ & { } & { \quad + \frac { 1 } { 2 \lambda } ( \mathbb { E } [ \mathrm { K L } ( \pi ^ { * } ( \theta _ { s } ) , \pi _ { 0 } ) ] - \mathbb { E } [ \mathrm { K L } ( \pi ^ { * } ( \theta _ { s } ) , \pi _ { s } ) ] ) } \end{array}
574
+ $$
575
+
576
+ Note that $\Delta _ { k } = - f ( \theta _ { k } , \pi _ { k } ) + f ( \theta _ { k } , \pi ^ { * } ( \theta _ { k } ) ) - h ( \pi _ { k } ) + h ( \pi ^ { * } ( \theta _ { k } ) )$ , hence
577
+
578
+ $$
579
+ \begin{array} { r l r } { { \sum _ { k = s + 1 } ^ { s + B } \mathbb { E } [ \Delta _ { k } ] \le - h ( \pi _ { s } ) + \mathbb { E } [ h ( \pi _ { s + B } ) ] + 2 \eta _ { \theta } l B ^ { 2 } G + \lambda B G ^ { 2 } } } \\ & { } & { \quad + \displaystyle \frac { 1 } { 2 \lambda } ( \mathbb { E } [ { \mathrm { K L } } ( \pi ^ { \ast } ( \theta _ { s } ) , \pi _ { 0 } ) ] - \mathbb { E } [ { \mathrm { K L } } ( \pi ^ { \ast } ( \theta _ { s } ) , \pi _ { s } ) ] ) } \end{array}
580
+ $$
581
+
582
+ By further sum over all blocks and divide by total number of iterations $T$ , we get
583
+
584
+ $$
585
+ \begin{array} { r l r } { { \frac { 1 } { T } \sum _ { b = 1 } ^ { T / B } \sum _ { k = b s + 1 } ^ { s + B } \mathbb { E } [ \Delta _ { k } ] \le ( - h ( \pi _ { 0 } ) + \mathbb { E } [ h ( \pi _ { T } ) ] ) / T + 2 \eta _ { \theta } B G + \lambda G ^ { 2 } } } \\ & { } & { \quad \quad + \frac { 1 } { 2 \lambda B } ( \mathbb { E } [ \mathrm { K L } ( \pi ^ { * } ( \theta _ { s } ) , \pi _ { 0 } ) ] - \mathbb { E } [ \mathrm { K L } ( \pi ^ { * } ( \theta _ { s } ) , \pi _ { s } ) ] ) } \end{array}
586
+ $$
587
+
588
+ Substitute the above inequality into (12) and we get
589
+
590
+ $$
591
+ \begin{array} { r l } { \displaystyle \frac { 1 } { T } \sum _ { t } \mathbb { E } [ \| \nabla F _ { 1 / 2 L } ( \theta _ { t } ) \| ^ { 2 } ] \leq \frac { 2 } { T L \eta _ { \theta } } ( F _ { 1 / 2 L } ( \theta _ { 0 } ) - F _ { 1 / 2 L } ^ { \ast } ) + 4 ( - h ( \pi _ { 0 } ) + \mathbb { E } [ h ( \pi _ { T } ) ] ) / T + 2 \eta _ { \theta } B G + \lambda G } & { } \\ { + \displaystyle \frac { 1 } { 2 \lambda B } ( \mathbb { E } [ \mathrm { K L } ( \pi ^ { \ast } ( \theta _ { s } ) , \pi _ { 0 } ) ] - \mathbb { E } [ \mathrm { K L } ( \pi ^ { \ast } ( \theta _ { T } ) , \pi _ { T } ) ] ) + \eta _ { \theta } ( l ^ { 2 } + \sigma ^ { 2 } ) ^ { 1 / 2 } ) } & { } \end{array}
592
+ $$
593
+
594
+ If we set $\eta _ { \theta } = T ^ { - 3 / 4 } , B = T ^ { 1 / 2 } , \lambda = T ^ { - 1 / 4 }$ , then we see that
595
+
596
+ $$
597
+ \begin{array} { l } { \displaystyle \frac { 1 } { T } \sum _ { t } \mathbb { E } [ \| \nabla F _ { 1 / 2 L } ( \theta _ { t } ) \| ^ { 2 } ] \leq \frac { 1 } { T ^ { 1 / 4 } } \left( \frac { 2 } { L } ( F _ { 1 / 2 L } ( \theta _ { 0 } ) - F _ { 1 / 2 L } ^ { \ast } ) + 2 G + G ^ { 2 } + \frac { R } { 2 } + ( l ^ { 2 } + \sigma ^ { 2 } ) ^ { 1 / 2 } ) \right) } \\ { \displaystyle \qquad + ( - h ( \pi _ { 0 } ) + h ^ { \ast } ) / T } \end{array}
598
+ $$
599
+
600
+ Lemma 5. For any differentiable convex function $\begin{array} { r } { L , i f x ^ { * } = \operatorname * { a r g m i n } _ { x \in \Delta } \{ L ( x ) + \operatorname { K L } ( x , x _ { 0 } ) \} } \end{array}$ , then for any $x ^ { \prime } \in \Delta$ , we have
601
+
602
+ $$
603
+ \ell ( x ^ { \prime } ) + \mathrm { K L } ( x ^ { \prime } , x _ { 0 } ) \geq \ell ( x ^ { * } ) + \mathrm { K L } ( x ^ { * } , x _ { 0 } ) + \mathrm { K L } ( x ^ { \prime } , x ^ { * } ) .
604
+ $$
605
+
606
+ Proof. This Lemma is well-known, but we include a proof for completeness. By optimality of $x ^ { * }$ and convexity of $\Delta$ , we know that
607
+
608
+ $$
609
+ \langle \nabla \ell ( x ^ { * } ) + \nabla \phi ( x ^ { * } ) - \nabla \phi ( x _ { 0 } ) , x - x ^ { * } \rangle \geq 0 ,
610
+ $$
611
+
612
+ where $\begin{array} { r } { \phi ( x ) = \sum _ { i } x _ { i } \log ( x _ { i } ) } \end{array}$ , and the Bregman divergence defined according to $\phi$ is KL-divergence. Then
613
+
614
+ $$
615
+ \begin{array} { r l } & { \ell ( x ^ { \prime } ) \geq \ell ( x ^ { * } ) + \langle \nabla \ell ( x ^ { * } ) , x ^ { \prime } - x ^ { * } \rangle } \\ & { \qquad \geq \ell ( x ^ { * } ) + \langle \nabla \phi ( x _ { 0 } ) - \nabla \phi ( x ^ { * } ) , x - x ^ { * } \rangle } \\ & { = \ell ( x ^ { * } ) - \langle \nabla \phi ( x _ { 0 } ) , x ^ { * } - x _ { 0 } \rangle + \phi ( x ^ { * } ) - \phi ( x _ { 0 } ) } \\ & { \qquad + \left. \nabla \phi ( x _ { 0 } ) , x ^ { \prime } - x _ { 0 } \right. + \phi ( x ^ { \prime } ) - \phi ( x _ { 0 } ) - \langle \nabla \phi ( x ^ { * } ) , x ^ { \prime } - x ^ { * } \rangle + \phi ( x ^ { \prime } ) - \phi ( x ^ { * } ) } \\ & { = \ell ( x ^ { * } ) + \mathrm { K L } ( x ^ { * } , x _ { 0 } ) - \mathrm { K L } ( x ^ { \prime } , x _ { 0 } ) + \mathrm { K L } ( x ^ { \prime } , x ^ { * } ) } \end{array}
616
+ $$
md/train/BydLzGb0Z/BydLzGb0Z.md ADDED
@@ -0,0 +1,279 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TWIN NETWORKS: MATCHING THE FUTURE FOR SEQUENCE GENERATION
2
+
3
+ Dmitriy Serdyuk,\* ♦ Nan Rosemary Ke,\* ♦ ‡ Alessandro Sordoni♥ Adam Trischler,♥ Chris $\mathbf { P a l } ^ { \bullet \bullet }$ & Yoshua Bengio¶ ♦
4
+
5
+ ♦ Montreal Institute for Learning Algorithms (MILA), Canada
6
+ ♥ Microsoft Research, Canada
7
+ ♣ Ecole Polytechnique, Canada
8
+ ¶ CIFAR Senior Fellow
9
+ ‡ Work done at Microsoft Research
10
+ \* Authors contributed equally
11
+ serdyuk@iro.umontreal.ca, rosemary.nan.ke@gmail.com
12
+
13
+ # ABSTRACT
14
+
15
+ We propose a simple technique for encouraging generative RNNs to plan ahead. We train a “backward” recurrent network to generate a given sequence in reverse order, and we encourage states of the forward model to predict cotemporal states of the backward model. The backward network is used only during training, and plays no role during sampling or inference. We hypothesize that our approach eases modeling of long-term dependencies by implicitly forcing the forward states to hold information about the longer-term future (as contained in the backward states). We show empirically that our approach achieves $9 \%$ relative improvement for a speech recognition task, and achieves significant improvement on a COCO caption generation task.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Recurrent Neural Networks (RNNs) are the basis of state-of-art models for generating sequential data such as text and speech. RNNs are trained to generate sequences by predicting one output at a time given all previous ones, and excel at the task through their capacity to remember past information well beyond classical $n$ -gram models (Bengio et al., 1994; Hochreiter & Schmidhuber, 1997). More recently, RNNs have also found success when applied to conditional generation tasks such as speech-to-text (Chorowski et al., 2015; Chan et al., 2016), image captioning (Xu et al., 2015) and machine translation (Sutskever et al., 2014; Bahdanau et al., 2014).
20
+
21
+ RNNs are usually trained by teacher forcing: at each point in a given sequence, the RNN is optimized to predict the next token given all preceding tokens. This corresponds to optimizing one-stepahead prediction. As there is no explicit bias toward planning in the training objective, the model may prefer to focus on the most recent tokens instead of capturing subtle long-term dependencies that could contribute to global coherence. Local correlations are usually stronger than long-term dependencies and thus end up dominating the learning signal. The consequence is that samples from RNNs tend to exhibit local coherence but lack meaningful global structure. This difficulty in capturing long-term dependencies has been noted and discussed in several seminal works (Hochreiter, 1991; Bengio et al., 1994; Hochreiter & Schmidhuber, 1997; Pascanu et al., 2013).
22
+
23
+ Recent efforts to address this problem have involved augmenting RNNs with external memory (Dieng et al., 2016; Grave et al., 2016; Gulcehre et al., 2017a), with unitary or hierarchical architectures (Arjovsky et al., 2016; Serban et al., 2017), or with explicit planning mechanisms (Gulcehre et al., 2017b). Parallel efforts aim to prevent overfitting on strong local correlations by regularizing the states of the network, by applying dropout or penalizing various statistics (Moon et al., 2015; Zaremba et al., 2014; Gal & Ghahramani, 2016; Krueger et al., 2016; Merity et al., 2017).
24
+
25
+ ![](images/71380f8284009840161a47174fc671717566c045a27af572921be21466521547.jpg)
26
+ Figure 1: The forward and the backward networks predict the sequence $s = \{ x _ { 1 } , . . . , x _ { 4 } \}$ independently. The penalty matches the forward (or a parametric function of the forward) and the backward hidden states. The forward network receives the gradient signal from the log-likelihood objective as well as $L _ { t }$ between states that predict the same token. The backward network is trained only by maximizing the data log-likelihood. During the evaluation part of the network colored with orange is discarded. The cost $L _ { t }$ is either a Euclidean distance or a learned metric $| | g ( h _ { t } ^ { f } ) - h _ { t } ^ { b } | | _ { 2 }$ with an affine transformation $g$ . Best viewed in color.
27
+
28
+ In this paper, we propose TwinNet,1 a simple method for regularizing a recurrent neural network that encourages modeling those aspects of the past that are predictive of the long-term future. Succinctly, this is achieved as follows: in parallel to the standard forward RNN, we run a “twin” backward RNN (with no parameter sharing) that predicts the sequence in reverse, and we encourage the hidden state of the forward network to be close to that of the backward network used to predict the same token. Intuitively, this forces the forward network to focus on the past information that is useful to predicting a specific token and that is also present in and useful to the backward network, coming from the future (Fig. 1).
29
+
30
+ In practice, our model introduces a regularization term to the training loss. This is distinct from other regularization methods that act on the hidden states either by injecting noise (Krueger et al., 2016) or by penalizing their norm (Krueger & Memisevic, 2015; Merity et al., 2017), because we formulate explicit auxiliary targets for the forward hidden states: namely, the backward hidden states. The activation regularizer (AR) proposed by Merity et al. (2017), which penalizes the norm of the hidden states, is equivalent to the TwinNet approach with the backward states set to zero. Overall, our model is driven by the intuition (a) that the backward hidden states contain a summary of the future of the sequence, and (b) that in order to predict the future more accurately, the model will have to form a better representation of the past. We demonstrate the effectiveness of the TwinNet approach experimentally, through several conditional and unconditional generation tasks that include speech recognition, image captioning, language modelling, and sequential image generation. To summarize, the contributions of this work are as follows:
31
+
32
+ • We introduce a simple method for training generative recurrent networks that regularizes the hidden states of the network to anticipate future states (see Section 2); • The paper provides extensive evaluation of the proposed model on multiple tasks and concludes that it helps training and regularization for conditioned generation (speech recognition, image captioning) and for the unconditioned case (sequential MNIST, language modelling, see Section 4); • For deeper analysis we visualize the introduced cost and observe that it negatively correlates with the word frequency (more surprising words have higher cost).
33
+
34
+ # 2 MODEL
35
+
36
+ Given a dataset of sequences $\mathcal { S } = \{ s ^ { 1 } , \ldots , s ^ { n } \}$ , where each $s ^ { k } = \{ x _ { 1 } , \ldots , x _ { T _ { k } } \}$ is an observed sequence of inputs $x _ { i } \in { \mathcal { X } }$ , we wish to estimate a density $p ( s )$ by maximizing the log-likelihood of the observed data L = Pni=1 log p(si). Using the chain rule, the joint probability over a sequence $x _ { 1 } , \ldots , x _ { T }$ decomposes as:
37
+
38
+ $$
39
+ p ( x _ { 1 } , \dots , x _ { T } ) = p ( x _ { 1 } ) p ( x _ { 2 } | x _ { 1 } ) . . . = \prod _ { t = 1 } ^ { T } p ( x _ { t } | x _ { 1 } , \dots , x _ { t - 1 } ) .
40
+ $$
41
+
42
+ This particular decomposition of the joint probability has been widely used in language modeling (Bengio et al., 2003; Mikolov, 2010) and speech recognition (Bahl et al., 1983). A recurrent neural network is a powerful architecture for approximating this conditional probability. At each step, the RNN updates a hidden state $h _ { t } ^ { f }$ , which iteratively summarizes the inputs seen up to time $t$ :
43
+
44
+ $$
45
+ h _ { t } ^ { f } = \Phi _ { f } ( x _ { t - 1 } , h _ { t - 1 } ^ { f } ) ,
46
+ $$
47
+
48
+ where $f$ symbolizes that the network reads the sequence in the forward direction, and $\Phi _ { f }$ is typically a non-linear function, such as a LSTM cell (Hochreiter & Schmidhuber, 1997) or a GRU (Cho et al., 2014). Thus, $h _ { t } ^ { f }$ forms a representation summarizing information about the sequence’s past. The prediction of the next symbol $x _ { t }$ is performed using another non-linear transformation on top of $h _ { t } ^ { f }$ , i.e. $p _ { f } ( x _ { t } | \boldsymbol x _ { < t } ) = \Psi _ { f } ( h _ { t } ^ { f } )$ , which is typically a linear or affine transformation (followed by a softmax when $x _ { t }$ is a symbol). The basic idea of our approach is to encourage $h _ { t } ^ { f }$ to contain information that is useful to predict $x _ { t }$ and which is also compatible with the upcoming (future) inputs in the sequence. To achieve this, we run a twin recurrent network that predicts the sequence in reverse and further require the hidden states of the forward and the backward networks to be close. The backward network updates its hidden state according to:
49
+
50
+ $$
51
+ h _ { t } ^ { b } = \Phi _ { b } ( x _ { t + 1 } , h _ { t + 1 } ^ { b } ) ,
52
+ $$
53
+
54
+ and predicts $p _ { b } ( x _ { t } | x _ { > t } ) = \Psi _ { b } ( h _ { t } ^ { b } )$ using information only about the future of the sequence. Thus, $h _ { t } ^ { f }$ and $h _ { t } ^ { b }$ both contain useful information for predicting $x _ { t }$ , coming respectively from the past and future. Our idea consists in penalizing the distance between forward and backward hidden states leading to the same prediction. For this we use the Euclidean distance (see Fig. 1):
55
+
56
+ $$
57
+ L _ { t } ( s ) = \| g ( h _ { t } ^ { f } ) - h _ { t } ^ { b } \| _ { 2 } ,
58
+ $$
59
+
60
+ where the dependence on $x$ is implicit in the definition of $h _ { t } ^ { f }$ and $h _ { t } ^ { b }$ . The function $g$ adds further capacity to the model and comes from the class of parameterized affine transformations. Note that this class includes the identity tranformation. As we will show experimentally in Section 4, a learned affine transformation gives more flexibility to the model and leads to better results. This relaxes the strict match between forward and backward states, requiring just that the forward hidden states are predictive of the backward hidden states.2
61
+
62
+ The total objective maximized by our model for a sequence $s$ is a weighted sum of the forward and backward log-likelihoods minus the penalty term, computed at each time-step:
63
+
64
+ $$
65
+ \mathcal { F } ( s ) = \sum _ { t } \log p _ { f } ( x _ { t } | x _ { < t } ) + \log p _ { b } ( x _ { t } | x _ { > t } ) - \alpha L _ { t } ( s ) ,
66
+ $$
67
+
68
+ where $\alpha$ is an hyper-parameter controlling the importance of the penalty term. In order to provide a more stable learning signal to the forward network, we only propagate the gradient of the penalty term through the forward network. That is, we avoid co-adaptation of the backward and forward networks. During sampling and evaluation, we discard the backward network.
69
+
70
+ The proposed method can be easily extended to the conditional generation case. The forward hiddenstate transition is modified to
71
+
72
+ $$
73
+ h _ { t } ^ { f } = \Phi _ { f } \left( x _ { t - 1 } , \left[ h _ { t - 1 } ^ { f } , c \right] \right) ,
74
+ $$
75
+
76
+ # 3 RELATED WORK
77
+
78
+ Bidirectional neural networks (Schuster & Paliwal, 1997) have been used as powerful feature extractors for sequence tasks. The hidden state at each time step includes both information from the past and the future. For this reason, they usually act as better feature extractors than the unidirectional counterpart and have been successfully used in a myriad of tasks, e.g. in machine translation (Bahdanau et al., 2015), question answering (Chen et al., 2017) and sequence labeling (Ma & Hovy, 2016). However, it is not straightforward to apply these models to sequence generation (Zhang et al., 2018) due to the fact that the ancestral sampling process is not allowed to look into the future. In this paper, the backward model is used to regularize the hidden states of the forward model and thus is only used during training. Both inference and sampling are strictly equivalent to the unidirectional case.
79
+
80
+ Gated architectures such as LSTMs (Hochreiter & Schmidhuber, 1997) and GRUs (Chung et al., 2014) have been successful in easing the modeling of long term-dependencies: the gates indicate time-steps for which the network is allowed to keep new information in the memory or forget stored information. Graves et al. (2014); Dieng et al. (2016); Grave et al. (2016) effectively augment the memory of the network by means of an external memory. Another solution for capturing long-term dependencies and avoiding gradient vanishing problems is equipping existing architectures with a hierarchical structure (Serban et al., 2017). Other works tackled the vanishing gradient problem by making the recurrent dynamics unitary (Arjovsky et al., 2016). In parallel, inspired by recent advances in “learning to plan” for reinforcement learning (Silver et al., 2016; Tamar et al., 2016), recent efforts try to augment RNNs with an explicit planning mechanism (Gulcehre et al., 2017b) to force the network to commit to a plan while generating, or to make hidden states predictive of the far future (Li et al., 2017).
81
+
82
+ Regularization methods such as noise injection are also useful to shape the learning dynamics and overcome local correlations to take over the learning process. One of the most popular methods for neural network regularization is dropout (Srivastava et al., 2014). Dropout in RNNs has been proposed in (Moon et al., 2015), and was later extended in (Semeniuta et al., 2016; Gal & Ghahramani, 2016), where recurrent connections are dropped at random. Zoneout (Krueger et al., 2016) modifies the hidden state to regularize the network by effectively creating an ensemble of different length recurrent networks. Krueger & Memisevic (2015) introduce a “norm stabilization” regularization term that ensures that the consecutive hidden states of an RNN have similar Euclidean norm. Recently, Merity et al. (2017) proposed a set of regularization methods that achieve state-of-the-art on the Penn Treebank language modeling dataset. Other RNN regularization methods include the weight noise (Graves, 2011), gradient clipping (Pascanu et al., 2013) and gradient noise (Neelakantan et al., 2015).
83
+
84
+ # 4 EXPERIMENTAL SETUP AND RESULTS
85
+
86
+ We now present experiments on conditional and unconditional sequence generation, and analyze the results in an effort to understand the performance gains of TwinNet. First, we examine conditional generation tasks such as speech recognition and image captioning, where the results show clear improvements over the baseline and other regularization methods. Next, we explore unconditional language generation, where we find our model does not significantly improve on the baseline. Finally, to further determine what tasks the model is well-suited to, we analyze a sequential imputation task, where we can vary the task from unconditional to strongly conditional.
87
+
88
+ # 4.1 SPEECH RECOGNITION
89
+
90
+ We evaluated our approach on the conditional generation for character-level speech recognition, where the model is trained to convert the speech audio signal to the sequence of characters. The forward and backward RNNs are trained as conditional generative models with softattention (Chorowski et al., 2015). The context information $c$ is an encoding of the audio sequence and the output sequence $s$ is the corresponding character sequence. We evaluate our model on the Wall Street Journal (WSJ) dataset closely following the setting described in Bahdanau et al. (2016). We use 40 mel-filter bank features with delta and delta-deltas with their energies as the acoustic in
91
+
92
+ Table 1: Average character error rate (CER, $\%$ ) on WSJ dataset decoded with the beam size 10. We compare the attention model for speech recognition (“Baseline,” Bahdanau et al., 2016); the regularizer proposed by Krueger & Memisevic (2015) (“Stabilizing norm”); penalty on the L2 norm of the forward states (Merity et al., 2017) (“AR”), which is equivalent to TwinNet when all the hidden states of the backward network are set to zero. We report the results of our model (“TwinNet”) both with $g = I$ , the identity mapping, and with a learned $g$ .
93
+
94
+ <table><tr><td>Model</td><td>Test CER</td><td>Valid CER</td></tr><tr><td>Baseline</td><td>6.8</td><td>9.0</td></tr><tr><td>Baseline +Gaussian noise</td><td>6.9</td><td>9.1</td></tr><tr><td>Baseline + Stabilizing Norm</td><td>6.6</td><td>9.0</td></tr><tr><td>Baseline+AR</td><td>6.5</td><td>8.9</td></tr><tr><td>Baseline + TwinNet (g = I)</td><td>6.6</td><td>8.7</td></tr><tr><td>Baseline + TwinNet (learnt g)</td><td>6.2</td><td>8.4</td></tr></table>
95
+
96
+ puts to the model, these features are generated according to the Kaldi s5 recipe (Povey et al., 2011).
97
+ The resulting input feature dimension is 123.
98
+
99
+ We observe the Character Error Rate (CER) for our validation set, and we early stop on the best CER observed so far. We report CER for both our validation and test sets. For all our models and the baseline, we follow the setup in Bahdanau et al. (2016) and pretrain the model for 1 epoch, within this period, the context window is only allowed to move forward. We then perform 10 epochs of training, where the context window looks freely along the time axis of the encoded sequence, we also perform annealing on the models with 2 different learning rates and 3 epochs for each annealing stage. We use the AdaDelta optimizer for training. We perform a small hyper-parameter search on the weight $\alpha$ of our twin loss, $\alpha \in \{ 2 . 0 , 1 . 5 , 1 . 0 , 0 . 5 , 0 . 2 5 , 0 . 1 \} \nonumber$ , and select the best one according to the CER on the validation set.3
100
+
101
+ Results We summarize our findings in Table 1. Our best performing model shows relative improvement of $12 \%$ comparing to the baseline. We found that the TwinNet with a learned metric (learnt $g$ ) is more effective than strictly matching forward and hidden states. In order to gain insights on whether the empirical usefulness comes from using a backward recurrent network, we propose two ablation tests. For “Gaussian Noise,” the backward states are randomly sampled from a Gaussian distribution, therefore the forward states are trained to predict white noise. For “AR,” the backward states are set to zero, which is equivalent to penalizing the norm of the forward hidden states (Merity et al., 2017). Finally, we compare the model with the “Stabilizing Norm” regularizer (Krueger & Memisevic, 2015), that penalizes the difference of the norm of consecutive forward hidden states. Results shows that the information included in the backward states is indeed useful for obtaining a significant improvement.
102
+
103
+ Analysis The training/validation curve comparison for the baseline and our network is presented in Figure 2a.4 The TwinNet converges faster than the baseline and generalizes better. The L2 cost raises in the beginning as the forward and backward network start to learn independently. Later, due to the pressure of this cost, networks produce more aligned hidden representations. Figure 3 provides examples of utterances with L2 plotted along the time axis. We observe that the high entropy words produce spikes in the loss for such words as “uzi.” This is the case for rare words which are hard to predict from the acoustic information. To elaborate on this, we plot the L2 cost averaged over a word depending on the word frequency. The average distance decreases with the increasing frequency. The histogram comparison (Figure 2b) for the cost of rare and frequent words reveal that the not only the average cost is lower for frequent words, but the variance is higher for rare words. Additionally, we plot the dependency of the L2 cost cross-entropy cost of the forward network (Figure 2c) to show that the conditioning also plays the role in the entropy of the output, the losses are not absolutely correlated.
104
+
105
+ ![](images/65bf7a391596f728f9455b710810ba7fc977198a004e4810b4e82303658c9219.jpg)
106
+ Figure 2: Analysis for speech recognition experiments. (a): Training curves comparison for TwinNets and the baseline network. Dotted vertical lines denote stages of pre-training, training, and two stages of annealing. The L2 cost is plotted alongside. The TwinNet converges to a better solution as well as provides better generalization. (b): Comparison of histograms of the cost for rare words (first 1500) versus frequent words (all other). The cost is averaged over characters of a word. The distribution of rare words is wider and tends to produce higher L2 cost. (c): L2 loss vs. average cross-entropy loss.
107
+
108
+ ![](images/b4d567b88d393438a5fd29e3fcb65191022c1f07ab47f5bfab69fcbca281ad64.jpg)
109
+ Figure 3: Example of the L2 loss plotted along the time axis. Notice that spikes correspond to rare words given the acoustic information where the entropy of the prediction is high. Dotted vertical lines are plotted at word boundary positions.
110
+
111
+ # 4.2 IMAGE CAPTIONING
112
+
113
+ We evaluate our model on the conditional generation task of image captioning task on Microsoft COCO dataset (Lin et al., 2014). The MS COCO dataset covers 82,783 training images and 40,504 images for validation. Due to the lack of standardized split of training, validation and test data, we follow Karpathy’s split (Karpathy & Fei-Fei, 2015; Xu et al., 2015; Wang et al., 2016). These are 80,000 training images and 5,000 images for validation and test. We do early stopping based on the validation CIDEr scores and we report BLEU-1 to BLEU-4, CIDEr, and Meteor scores. To evaluate the consistency of our method, we tested TwinNet on both encoder-decoder (‘Show&Tell’, Vinyals et al., 2015) and soft attention (‘Show, Attend and Tell’, Xu et al., 2015) image captioning models.5
114
+
115
+ We use a Resnet (He et al., 2016) with 101 and 152 layers pre-trained on ImageNet for image classification. The last layer of the Resned is used to extract 2048 dimensional input features for the attention model (Xu et al., 2015). We use an LSTM with 512 hidden units for both “Show & Tell” and soft attention. Both models are trained with the Adam (Kingma & Ba, 2014) optimizer with a
116
+
117
+ Table 2: Results for image captioning on the MS COCO dataset, the higher the better for all metrics (BLEU 1 to 4, METEOR, and CIDEr). We reimplement both Show&Tell (Vinyals et al., 2015) and Soft Attention (Xu et al., 2015) in order to add the twin cost. We use two types of images features extracted either with Resnet-101 or Resnet-152.
118
+
119
+ <table><tr><td>Models</td><td>B-1</td><td>B-2</td><td>B-3</td><td>B-4</td><td>METEOR</td><td>CIDEr</td></tr><tr><td>DeepVS (Karpathy &amp; Fei-Fei,2015)</td><td>62.5</td><td>45.0</td><td>32.1</td><td>23.0</td><td>19.5</td><td>66.0</td></tr><tr><td>ATT-FCN (You et al., 2016)</td><td>70.9</td><td>53.7</td><td>40.2</td><td>30.4</td><td>24.3</td><td>1</td></tr><tr><td>Show &amp; Tell(Vinyals et al.,2015)</td><td>-</td><td></td><td>1</td><td>27.7</td><td>23.7</td><td>85.5</td></tr><tr><td>Soft Attention (Xu et al.,2015)</td><td>70.7</td><td>49.2</td><td>34.4</td><td>24.3</td><td>23.9</td><td>-</td></tr><tr><td>Hard Attention (Xu et al., 2015)</td><td>71.8</td><td>50.4</td><td>35.7</td><td>25.0</td><td>23.0</td><td>-</td></tr><tr><td>MSM (Yao et al., 2016)</td><td>73.0</td><td>56.5</td><td>42.9</td><td>32.5</td><td>25.1</td><td>98.6</td></tr><tr><td>Adaptive Attention (Lu et al., 2017)</td><td>74.2</td><td>58.0</td><td>43.9</td><td>33.2</td><td>26.6</td><td>108.5</td></tr><tr><td>No attention, Resnet101</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Show&amp;Tell (Our impl.)</td><td>69.4</td><td>51.6</td><td>36.9</td><td>26.3</td><td>23.4</td><td>84.3</td></tr><tr><td>+ TwinNet</td><td>71.8</td><td>54.5</td><td>39.4</td><td>28.0</td><td>24.0</td><td>87.7</td></tr><tr><td>Attention, Resnet101</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Soft Attention (Our impl.)</td><td>71.0</td><td>53.7</td><td>39.0</td><td>28.1</td><td>24.0</td><td>89.2</td></tr><tr><td>+ TwinNet</td><td>72.8</td><td>55.7</td><td>41.0</td><td>29.7</td><td>25.2</td><td>96.2</td></tr><tr><td>No attention, Resnet152</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Show&amp;Tell (Our impl.)</td><td>71.7</td><td>54.4</td><td>39.7</td><td>28.8</td><td>24.8</td><td>93.0</td></tr><tr><td>+ TwinNet</td><td>72.3</td><td>55.2</td><td>40.4</td><td>29.3</td><td>25.1</td><td>94.7</td></tr><tr><td>Attention, Resnet152</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Soft Attention (Our impl.)</td><td>73.2</td><td>56.3</td><td>41.4</td><td>30.1</td><td>25.3</td><td>96.6</td></tr><tr><td>+ TwinNet</td><td>73.8</td><td>56.9</td><td>42.0</td><td>30.6</td><td>25.2</td><td>97.3</td></tr></table>
120
+
121
+ Table 3: (left) Test set negative log-likelihood for binarized sequential MNIST, where H denotes lower performance of our model with respect to the baselines. (right) Perplexity results on WikiText-2 and Penn Treebank (Merity et al., 2017). AWD-LSTM refers to the model of (Merity et al., 2017) trained with the official implementation at http://github.com/salesforce/awd-lstm/.
122
+
123
+ <table><tr><td>Model</td><td>MNIST</td></tr><tr><td>DBN 2hl (Germain et al., 2015) NADE (Uria et al., 2016)</td><td>~84.55</td></tr><tr><td>EoNADE-5 2hl (Raiko et al.,2014)</td><td>88.33</td></tr><tr><td>DLGM 8 (Salimans et al.,2014)</td><td>84.68</td></tr><tr><td>DARN 1hl (Gregor et al., 2015)</td><td>~85.51 ~84.13</td></tr><tr><td>DRAW (Gregor et al.,2015)</td><td>≤80.97</td></tr><tr><td>P-Forcing(-layer) (Lamb et al.,2016)</td><td>79.58</td></tr><tr><td>PixelRNN(1-layer) (Oord et al.,2016b)</td><td></td></tr><tr><td>PixelRNN(7-layer) (Oord et al.,2016b)</td><td>80.75</td></tr><tr><td>PixelVAE (Gulrajani et al.,2016)</td><td>79.20</td></tr><tr><td>MatNets (Bachman,2016)</td><td>79.02 78.50</td></tr><tr><td>Baseline LSTM(3-layers)</td><td>79.87</td></tr><tr><td>+ TwinNet(3-layers)</td><td>79.35</td></tr><tr><td>Baseline LSTM(3-layers) + dropout + TwinNet(3-layers)</td><td>79.59 79.12</td></tr></table>
124
+
125
+ <table><tr><td>Penn Treebank</td><td>Valid</td><td>Test</td></tr><tr><td>LSTM (Zaremba et al., 2014) 4-layer LSTM (Melis et al., 2017) 5-layer RHN (Melis et al.,2017)</td><td>82.2 67.9</td><td>78.4 65.4</td></tr><tr><td>AWD-LSTM</td><td>64.8 61.2</td><td>62.2 58.8</td></tr><tr><td>+ TwinNet</td><td>61.0</td><td>58.3</td></tr><tr><td>WikiText-2 5-layer RHN (Melis et al.,2017)</td><td>Valid</td><td>Test</td></tr><tr><td>1-layer LSTM (Melis et al., 2017) 2-layer LSTM(Melis et al., 2017)</td><td>78.1 69.3 69.1</td><td>75.6 65.9</td></tr><tr><td>AWD-LSTM</td><td>68.7</td><td>65.9</td></tr><tr><td>+ TwinNet</td><td>68.0</td><td>65.8 64.9</td></tr></table>
126
+
127
+ learning rate of $1 0 ^ { - 4 }$ . TwinNet showed consistent improvements over “Show & Tell” (Table 2). For the soft attention model we observe small but consistent improvements for majority of scores.
128
+
129
+ # 4.3 UNCONDITIONAL GENERATION: SEQUENTIAL MNIST AND LANGUAGE MODELING
130
+
131
+ We investigate the performance of our model in pixel-by-pixel generation for sequential MNIST. We follow the setting described by Lamb et al. (2016): we use an LSTM with 3-layers of 512 hidden units for both forward and backward LSTMs, batch size 20, learning rate 0.001 and clip the gradient norms to 5. We use Adam (Kingma & Ba, 2014) as our optimization algorithm and we decay the learning rate by half after 5, 10, and 15 epochs. Our results are reported at the Table 3 (left). Our baseline LSTM implementation achieves 79.87 nats on the test set. We observe that by adding the TwinNet regularization cost consistently improves performance in this setting by about 0.52 nats. Adding dropout to the baseline LSTM is beneficial. Further gains were observed by adding both dropout and the TwinNet regularization cost. This last model achieves 79.12 nats on test set. Note that this result is competitive with deeper models such as PixelRNN (Oord et al., 2016b) (7-layers) and PixelVAE (Gulrajani et al., 2016) which uses an autoregressive decoder coupled with a deep stochastic auto-encoder.
132
+
133
+ As a last experiment, we report results obtained on a language modelling task using the PennTree Bank and WikiText-2 datasets (Merity et al., 2017). We augment the state-of-the-art AWD-LSTM model (Merity et al., 2017) with the proposed TwinNet regularization cost. The results are reported in Table 3 (right).
134
+
135
+ # 5 DISCUSSION
136
+
137
+ In this paper, we presented a simple recurrent neural network model that has two separate networks running in opposite directions during training. Our model is motivated by the fact that states of the forward model should be predictive of the entire future sequence. This may be hard to obtain by optimizing one-step ahead predictions. The backward path is discarded during the sampling and evaluation process, which makes the sampling process efficient. Empirical results show that the proposed method performs well on conditional generation for several tasks. The analysis reveals an interpretable behaviour of the proposed loss.
138
+
139
+ One of the shortcomings of the proposed approach is that the training process doubles the computation needed for the baseline (due to the backward network training). However, since the backward network is discarded during sampling, the sampling or inference process has the exact same computation steps as the baseline. This makes our approach applicable to models that requires expensive sampling steps, such as PixelRNNs (Oord et al., 2016b) and WaveNet (Oord et al., 2016a). One of future work directions is to test whether it could help in conditional speech synthesis using WaveNet.
140
+
141
+ We observed that the proposed approach yield minor improvements when applied to language modelling with PennTree bank. We hypothesize that this may be linked to the amount of entropy of the target distribution. In these high-entropy cases, at any time-step in the sequence, the distribution of backward states may be highly multi-modal (many possible futures may be equally likely for the same past). One way of overcoming this problem would be to replace the proposed L2 loss (which implicitly assumes a unimodal distribution of the backward states) by a more expressive loss obtained by either employing an inference network (Kingma & Welling, 2013) or distribution matching techniques (Goodfellow et al., 2014). We leave that for future investigation.
142
+
143
+ # ACKNOWLEDGMENTS
144
+
145
+ The authors would like to acknowledge the support of the following agencies for research funding and computing support: NSERC, Calcul Quebec, Compute Canada, the Canada Research Chairs, ´ CIFAR, and Samsung. We would also like to thank the developers of Theano Theano Development Team (2016), Blocks and Fuel van Merrienboer et al. (2015), and Pytorch for developments of great ¨ frameworks. We thank Aaron Courville, Sandeep Subramanian, Marc-Alexandre Cotˆ e, Anirudh ´ Goyal, Alex Lamb, Philemon Brakel, Devon Hjelm, Kyle Kastner, Olivier Breuleux, Phil Bachman, and Gaetan Marceau Caron for useful feedback and discussions. ´
146
+
147
+ # REFERENCES
148
+
149
+ Martin Arjovsky, Amar Shah, and Yoshua Bengio. Unitary evolution recurrent neural networks. In ICML, 2016.
150
+
151
+ Philip Bachman. An architecture for deep, hierarchical generative models. In NIPS, 2016.
152
+
153
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. arXiv preprint arXiv:1409.0473, 2014.
154
+
155
+ Dzmitry Bahdanau, Dmitriy Serdyuk, Philemon Brakel, Nan Rosemary Ke, Jan Chorowski, Aaron C. Courville, and Yoshua Bengio. Task loss estimation for sequence prediction. 2015.
156
+
157
+ Dzmitry Bahdanau, Jan Chorowski, Dmitriy Serdyuk, Philemon Brakel, and Yoshua Bengio. Endto-end attention-based large vocabulary speech recognition. ICASSP, 2016.
158
+
159
+ Lalit R Bahl, Frederick Jelinek, and Robert L Mercer. A maximum likelihood approach to continuous speech recognition. IEEE transactions on pattern analysis and machine intelligence, (2), 1983.
160
+
161
+ Yoshua Bengio, Patrice Simard, and Paolo Frasconi. Learning long-term dependencies with gradient descent is difficult. IEEE transactions on neural networks, 1994.
162
+
163
+ Yoshua Bengio, Rejean Ducharme, Pascal Vincent, and Christian Jauvin. A neural probabilistic ´ language model. JMLR, 2003.
164
+
165
+ Leon Bottou. Curiously fast convergence of some stochastic gradient descent algorithms. In ´ Proceedings of the symposium on learning and data science, Paris, 2009.
166
+
167
+ William Chan, Navdeep Jaitly, Quoc V Le, and Oriol Vinyals. Listen, attend and spell. ICASSP, 2016.
168
+
169
+ Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading Wikipedia to answer opendomain questions. arXiv preprint arXiv:1704.00051, 2017.
170
+
171
+ 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. 2014.
172
+
173
+ Jan K Chorowski, Dzmitry Bahdanau, Dmitriy Serdyuk, Kyunghyun Cho, and Yoshua Bengio. Attention-based models for speech recognition. In NIPS. 2015.
174
+
175
+ Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv:1412.3555, 2014.
176
+
177
+ Adji B Dieng, Chong Wang, Jianfeng Gao, and John Paisley. TopicRNN: A recurrent neural network with long-range semantic dependency. arXiv preprint arXiv:1611.01702, 2016.
178
+
179
+ Yarin Gal and Zoubin Ghahramani. A theoretically grounded application of dropout in recurrent neural networks. In NIPS, 2016.
180
+
181
+ Mathieu Germain, Karol Gregor, Iain Murray, and Hugo Larochelle. MADE: Masked autoencoder for distribution estimation. In ICML, 2015.
182
+
183
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, 2014.
184
+
185
+ Edouard Grave, Armand Joulin, and Nicolas Usunier. Improving neural language models with a continuous cache. arXiv preprint arXiv:1612.04426, 2016.
186
+
187
+ Alex Graves. Practical variational inference for neural networks. In NIPS, 2011.
188
+
189
+ Alex Graves, Greg Wayne, and Ivo Danihelka. Neural turing machines. arXiv preprint arXiv:1410.5401, 2014.
190
+
191
+ Karol Gregor, Ivo Danihelka, Alex Graves, Danilo Jimenez Rezende, and Daan Wierstra. DRAW: A recurrent neural network for image generation. arXiv preprint arXiv:1502.04623, 2015.
192
+
193
+ Caglar Gulcehre, Sarath Chandar, and Yoshua Bengio. Memory augmented neural networks with wormhole connections. arXiv preprint arXiv:1701.08718, 2017a.
194
+
195
+ Caglar Gulcehre, Francis Dutil, Adam Trischler, and Yoshua Bengio. Plan, attend, generate: Planning for sequence-to-sequence models. In Proc. of NIPS, 2017b.
196
+
197
+ Ishaan Gulrajani, Kundan Kumar, Faruk Ahmed, Adrien Ali Taiga, Francesco Visin, David Vazquez, and Aaron Courville. PixelVAE: A latent variable model for natural images. arXiv preprint arXiv:1611.05013, 2016.
198
+
199
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
200
+
201
+ Sepp Hochreiter. Untersuchungen zu dynamischen neuronalen netzen. Diploma, Technische Universitat M¨ unchen ¨ , 91, 1991.
202
+
203
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 1997.
204
+
205
+ Andrej Karpathy and Li Fei-Fei. Deep visual-semantic alignments for generating image descriptions. In CVPR, 2015.
206
+
207
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
208
+
209
+ Diederik P Kingma and Max Welling. Auto-encoding variational Bayes. arXiv preprint arXiv:1312.6114, 2013.
210
+
211
+ David Krueger and Roland Memisevic. Regularizing RNNs by stabilizing activations. arXiv:1511.08400, 2015.
212
+
213
+ David Krueger, Tegan Maharaj, Janos Kram ´ ar, Mohammad Pezeshki, Nicolas Ballas, Nan Rose- ´ mary Ke, Anirudh Goyal, Yoshua Bengio, Hugo Larochelle, Aaron Courville, and Chistopher Pal. Zoneout: Regularizing RNNs by randomly preserving hidden activations. 2016.
214
+
215
+ Alex M Lamb, Anirudh Goyal, Ying Zhang, Saizheng Zhang, Aaron C Courville, and Yoshua Bengio. Professor forcing: A new algorithm for training recurrent networks. In NIPS, 2016.
216
+
217
+ Jiwei Li, Will Monroe, and Dan Jurafsky. Learning to decode for future success. 2017.
218
+
219
+ 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, 2014.
220
+
221
+ Jiasen Lu, Caiming Xiong, Devi Parikh, and Richard Socher. Knowing when to look: Adaptive attention via a visual sentinel for image captioning. In Proc. of CVPR 17, 2017.
222
+
223
+ Xuezhe Ma and Eduard Hovy. End-to-end sequence labeling via bi-directional LSTM-CNNs-CRF. arXiv preprint arXiv:1603.01354, 2016.
224
+
225
+ Gabor Melis, Chris Dyer, and Phil Blunsom. On the state of the art of evaluation in neural language ´ models. arXiv preprint arXiv:1707.05589, 2017.
226
+
227
+ Stephen Merity, Nitish Shirish Keskar, and Richard Socher. Regularizing and optimizing LSTM language models. arXiv preprint arXiv:1708.02182, 2017.
228
+
229
+ Tomas Mikolov. Recurrent neural network based language model. 2010.
230
+
231
+ Taesup Moon, Heeyoul Choi, Hoshik Lee, and Inchul Song. RNNDROP: A novel dropout for RNNs in ASR. In ASRU, 2015.
232
+
233
+ Arvind Neelakantan, Luke Vilnis, Quoc V Le, Ilya Sutskever, Lukasz Kaiser, Karol Kurach, and James Martens. Adding gradient noise improves learning for very deep networks. 2015.
234
+
235
+ 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, 2016a.
236
+
237
+ Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. arXiv preprint arXiv:1601.06759, 2016b.
238
+
239
+ Razvan Pascanu, Tomas Mikolov, and Yoshua Bengio. On the difficulty of training recurrent neural networks. In ICML, 2013.
240
+
241
+ Daniel Povey, Arnab Ghoshal, Gilles Boulianne, Lukas Burget, Ondrej Glembek, Nagendra Goel, Mirko Hannemann, Petr Motlicek, Yanmin Qian, Petr Schwarz, et al. The Kaldi speech recognition toolkit. In IEEE 2011 workshop on automatic speech recognition and understanding, 2011.
242
+
243
+ Tapani Raiko, Yao Li, Kyunghyun Cho, and Yoshua Bengio. Iterative neural autoregressive distribution estimator nade-k. In NIPS, 2014.
244
+
245
+ Tim Salimans, Diederik P Kingma, and Max Welling. Markov chain monte carlo and variational inference: Bridging the gap. arXiv preprint arXiv:1410.6460, 2014.
246
+
247
+ Mike Schuster and Kuldip K Paliwal. Bidirectional recurrent neural networks. IEEE Transactions on Signal Processing, 1997.
248
+
249
+ Stanislau Semeniuta, Aliaksei Severyn, and Erhardt Barth. Recurrent dropout without memory loss. 2016.
250
+
251
+ Iulian Vlad Serban, Alessandro Sordoni, Ryan Lowe, Laurent Charlin, Joelle Pineau, Aaron C Courville, and Yoshua Bengio. A hierarchical latent variable encoder-decoder model for generating dialogues. 2017.
252
+
253
+ David Silver, Hado van Hasselt, Matteo Hessel, Tom Schaul, Arthur Guez, Tim Harley, Gabriel Dulac-Arnold, David Reichert, Neil Rabinowitz, Andre Barreto, et al. The predictron: End-toend learning and planning. arXiv preprint arXiv:1612.08810, 2016.
254
+
255
+ Nitish Srivastava, Geoffrey E Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. JMLR, 2014.
256
+
257
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. In NIPS, 2014.
258
+
259
+ Aviv Tamar, Yi Wu, Garrett Thomas, Sergey Levine, and Pieter Abbeel. Value iteration networks. In NIPS, 2016.
260
+
261
+ Theano Development Team. Theano: A Python framework for fast computation of mathematical expressions. 2016.
262
+
263
+ Benigno Uria, Marc-Alexandre Cotˆ e, Karol Gregor, Iain Murray, and Hugo Larochelle. Neural ´ autoregressive distribution estimation. JMLR, 17(205), 2016.
264
+
265
+ Bart van Merrienboer, Dzmitry Bahdanau, Vincent Dumoulin, Dmitriy Serdyuk, David Warde-¨ Farley, Jan Chorowski, and Yoshua Bengio. Blocks and fuel: Frameworks for deep learning. 2015.
266
+
267
+ Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. In CVPR, 2015.
268
+
269
+ Cheng Wang, Haojin Yang, Christian Bartz, and Christoph Meinel. Image captioning with deep bidirectional LSTMs. In Proceedings of the 2016 ACM on Multimedia Conference. ACM, 2016.
270
+
271
+ Kelvin Xu, Jimmy Ba, Ryan Kiros, Kyunghyun Cho, Aaron Courville, Ruslan Salakhudinov, Rich Zemel, and Yoshua Bengio. Show, attend and tell: Neural image caption generation with visual attention. In ICML, 2015.
272
+
273
+ Ting Yao, Yingwei Pan, Yehao Li, Zhaofan Qiu, and Tao Mei. Boosting image captioning with attributes. arXiv preprint arXiv:1611.01646, 2016.
274
+
275
+ Quanzeng You, Hailin Jin, Zhaowen Wang, Chen Fang, and Jiebo Luo. Image captioning with semantic attention. In CVPR, 2016.
276
+
277
+ Wojciech Zaremba, Ilya Sutskever, and Oriol Vinyals. Recurrent neural network regularization. 2014.
278
+
279
+ Xiangwen Zhang, Jinsong Su, Yue Qin, Yang Liu, Rongrong Ji, and Hongji Wang. Asynchronous bidirectional decoding for neural machine translation. arXiv preprint arXiv:1801.05122, 2018.
md/train/CuQoImkKkIj/CuQoImkKkIj.md ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Robust and differentially private mean estimation
2
+
3
+ Xiyang Liu, Weihao Kong, Sham Kakade, Sewoong Oh
4
+
5
+ Paul G. Allen School of Computer Science and Engineering, University of Washington {xiyangl,whkong,sham,sewoong}@cs.washington.edu
6
+
7
+ # Abstract
8
+
9
+ In statistical learning and analysis from shared data, which is increasingly widely adopted in platforms such as federated learning and meta-learning, there are two major concerns: privacy and robustness. Each participating individual should be able to contribute without the fear of leaking one’s sensitive information. At the same time, the system should be robust in the presence of malicious participants inserting corrupted data. Recent algorithmic advances in learning from shared data focus on either one of these threats, leaving the system vulnerable to the other. We bridge this gap for the canonical problem of estimating the mean from i.i.d. samples. We introduce PRIME, which is the first efficient algorithm that achieves both privacy and robustness for a wide range of distributions. We further complement this result with a novel exponential time algorithm that improves the sample complexity of PRIME, achieving a near-optimal guarantee and matching a known lower bound for (non-robust) private mean estimation. This proves that there is no extra statistical cost to simultaneously guaranteeing privacy and robustness.
10
+
11
+ # 1 Introduction
12
+
13
+ When releasing database statistics on a collection of entries from individuals, we would ideally like to make it impossible to reverse-engineer each individual’s potentially sensitive information. Privacy-preserving techniques add just enough randomness tailored to the statistical task to guarantee protection. At the same time, it is becoming increasingly common to apply such techniques to databases collected from multiple sources, not all of which can be trusted. Emerging data access frameworks, such as federated analyses across users’ devices or data silos [50], make it easier to temper with such collected datasets, leaving private statistical analyses vulnerable to a malicious corruption of a fraction of the data.
14
+
15
+ Differential privacy has emerged as a widely accepted de facto measure of privacy, which is now a standard in releasing the statistics of the U.S. Census data [2] statistics and also deployed in real-world commercial systems [74, 40, 41]. A statistical analysis is said to be differentially private (DP) if the likelihood of the (randomized) outcome does not change significantly when a single arbitrary entry is added/removed (formally defined in $\ S 1 . 2 )$ . This provides a strong privacy guarantee: even a powerful adversary who knows all the other entries in the database cannot confidently identify whether a particular individual is participating in the database based on the outcome of the analysis. This ensures plausible deniability, central to protecting an individual’s privacy.
16
+
17
+ In this paper, we focus on one of the most canonical problems in statistics: estimating the mean of a distribution from i.i.d. samples. For distributions with unbounded support, such as sub-Gaussian and heavy-tailed distributions, fundamental trade-offs between accuracy, sample size, and privacy have only recently been identified [58, 52, 54, 3] and efficient private estimators proposed. However, these approaches are brittle when a fraction of the data is corrupted, posing a real threat, referred to as data poisoning attacks [19, 79]. In defense of such attacks, robust (but not necessarily private) statistics has emerged as a popular setting of recent algorithmic and mathematical breakthroughs [73, 30].
18
+
19
+ One might be misled into thinking that privacy ensures robustness since DP guarantees that a single outlier cannot change the estimation too much. This intuition is true only in a low dimension; each sample has to be an obvious outlier to significantly change the mean. However, in a high dimension, each corrupted data point can look perfectly uncorrupted but still shift the mean significant when colluding together (e.g., see Fig. 1). Focusing on the canonical problem of mean estimation, we introduce novel algorithms that achieve robustness and privacy simultaneously even when a fraction of data is corrupted arbitrarily. For such algorithms, there is a fundamental question of interest: do we need more samples to make private mean estimation also robust against adversarial corruption?
20
+
21
+ Sub-Gaussian distributions. If we can afford exponential run-time in the dimension, robustness can be achieved without extra cost in sample complexity. We introduce a novel estimator that (i) satisfies $( \varepsilon , \delta )$ -DP, $( i i )$ achieves near-optimal robustness under $\alpha$ -fraction of corrupted data, achieving accuracy of $O ( \alpha \sqrt { \log ( 1 / \alpha ) } )$ nearly matching the fundamental lower bound of $\Omega ( \alpha )$ that holds even for a (non-private) robust mean estimation with infinite samples, and $( i i i )$ achieves near-optimal sample complexity matching that of a fundamental lower bound for a (non-robust) private mean estimation as shown in Table 1.
22
+
23
+ Theorem 1 (Informal Theorem 7, exponential time). Algorithm 2 is $( \varepsilon , \delta )$ -DP. When $\alpha$ fraction of the data is arbitrarily corrupted from $n$ samples from a $d$ -dimensional sub-Gaussian distribution with mean $\mu$ and an identity sub-Gaussian parameter, if $\begin{array} { r } { n = \widetilde \Omega ( d / \alpha ^ { 2 } + ( d + d ^ { 1 / 2 } \log ( 1 / \delta ) ) / ( \alpha \varepsilon ) ) } \end{array}$ then Algorithm 2 achieves $\| \hat { \mu } - \mu \| _ { 2 } = O ( \alpha \sqrt { \log ( 1 / \alpha ) } ) \ : w . h . p$ .
24
+
25
+ We introduce PRIME (PRIvate and robust Mean Estimation) in $\ S 2 . 3$ with details in Algorithm 9 in Appendix E.1, to achieve computational efficiency. It requires a run-time of only $\widetilde { \cal O } ( d ^ { 3 } + n d ^ { 2 } )$ , but at the cost of requiring extra $d ^ { 1 / 2 }$ factor larger number of samples. This cannot be improved upon with current techniques since efficient robust estimators rely on the top PCA directions of the covariance matrix to detect outliers. [78] showed that $\widetilde \Omega ( d ^ { 3 / 2 } )$ samples are necessary to compute PCA directions while preserving $( \varepsilon , \delta )$ -DP when $\| x _ { i } \| _ { 2 } = O ( { \sqrt { d } } )$ . It remains an open question if this $\widetilde \Omega ( d ^ { 3 / 2 } / ( \alpha \varepsilon ) )$ bottleneck is fundamental; no matching lower bound is currently known.
26
+
27
+ Theorem 2 (Informal Theorem 6, polynomial time). PRIME is $( \varepsilon , \delta )$ -DP and under the assumption of Thm.1, if $\begin{array} { r } { \dot { n } = \widetilde \Omega ( d / \alpha ^ { 2 } + ( d ^ { 3 / 2 } \log ( 1 / \delta ) ) / ( \alpha \varepsilon ) ) . } \end{array}$ , achieves $\begin{array} { r } { \| \hat { \mu } - \mu \| _ { 2 } = O ( \alpha \sqrt { \log ( 1 / \alpha ) } ) ~ w . h . p . } \end{array}$ .
28
+
29
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Upper bound (poly-time)</td><td rowspan=1 colspan=1>Upper bound (exp-time)</td><td rowspan=1 colspan=1>Lower bound</td></tr><tr><td rowspan=1 colspan=1>(ε,δ)-DP[52]</td><td rowspan=1 colspan=1>0+dlog1/2(1/8))Qε</td><td rowspan=1 colspan=1>+)</td><td rowspan=1 colspan=1>(+)</td></tr><tr><td rowspan=1 colspan=1>α-corruption [36]</td><td rowspan=1 colspan=1>0(</td><td rowspan=1 colspan=1>(</td><td rowspan=1 colspan=1>(</td></tr><tr><td rowspan=1 colspan=1>α-corruption and(ε,δ)-DP (this paper)</td><td rowspan=1 colspan=1>(+/210g(1/8))αε[Theorem6]</td><td rowspan=1 colspan=1>0(+d+d1/210g(1/8))Q[Theorem7]</td><td rowspan=1 colspan=1>()[52]</td></tr></table>
30
+
31
+ Table 1: For estimating the mean $\mu \in \mathbb { R } ^ { d }$ of a sub-Gaussian distribution with a known covariance, we list the sufficient or necessary conditions on the sample sizes to achieve an error $\| \hat { \mu } - \mu \| _ { 2 } = \widetilde { O } ( \alpha )$ under $( \varepsilon , \delta )$ -DP, corruption of an $\alpha$ -fraction of samples, and both. √ $\clubsuit$ requires the distribution to be a Gaussian [14] and $\spadesuit$ requires $\delta \leq \sqrt { d } / n$ .
32
+
33
+ Heavy-tailed distributions. When samples are drawn from a distribution with a bounded covariance, parameters of Algorithm 2 can be modified to nearly match the optimal sample complexity of (nonrobust) private mean estimation in Table 2. This algorithm also matches the fundamental limit on the accuracy of (non-private) robust estimation, which in this case is $\Omega ( \alpha ^ { 1 / 2 } )$ .
34
+
35
+ Theorem 3 (Informal Theorem 8, exponential time). From a distribution with mean $\mu \in \mathbb { R } ^ { d }$ and covariance $\Sigma \preceq \mathbf { I }$ , $n$ samples are drawn and $\alpha$ -fraction is corrupted. Algorithm 2 is $( \varepsilon , \delta )$ -DP and $i f$ $n = \widetilde \Omega ( ( d + d ^ { 1 / 2 } \log ( 1 / \delta ) ) / ( \alpha \varepsilon ) + d ^ { 1 / 2 } \log ^ { 3 / 2 } ( 1 / \delta ) / \varepsilon )$ achieves $\| \hat { \mu } - \mu \| _ { 2 } = O ( \alpha ^ { 1 / 2 } ) \ : w . h . p .$ .
36
+
37
+ The proposed PRIME-HT for covariance bounded distributions achieve computational efficiency at the cost of an extra factor of $d ^ { 1 / 2 }$ in sample size. This bottleneck is also due to DP PCA, and it remains open whether this gap can be closed by an efficient estimator.
38
+
39
+ Theorem 4 (Informal Theorem 9, polynomial time). PRIME-HT is $( \varepsilon , \delta ) – D P$ and if $n \_ =$ $\widetilde \Omega ( ( d ^ { 3 / 2 } \log ( 1 / \delta ) ) / ( \alpha \varepsilon ) )$ achieves $\| \hat { \mu } - \mu \| _ { 2 } = O ( \alpha ^ { 1 / 2 } ) \ : w . h . p$ . under the assumptions of Thm. 3.
40
+
41
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Upper bound (poly-time)</td><td rowspan=1 colspan=1>Upper bound (exp-time)</td><td rowspan=1 colspan=1>Lower bound</td></tr><tr><td rowspan=1 colspan=1>(ε,δ)-DP [54]</td><td rowspan=1 colspan=1>O(d10g1/2(1/)Qε</td><td rowspan=1 colspan=1>O(d10g1/2(1/0))Qε</td><td rowspan=1 colspan=1>2()</td></tr><tr><td rowspan=1 colspan=1>α-corruption [36]</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>α-corruption and(ε,δ)-DP (this paper)</td><td rowspan=1 colspan=1>0((/210g(1/8))αε[Theorem 9]</td><td rowspan=1 colspan=1>(+d1721g/2(18)αε[Theorem 8]</td><td rowspan=1 colspan=1>(([54])</td></tr></table>
42
+
43
+ Table 2: For estimating the mean $\mu \in \mathbb { R } ^ { d }$ of a covariance bounded distribution, we list the sufficient or necessary conditions on the sample size to achieve an error $\| \hat { \mu } - \mu \| _ { 2 } = O ( \alpha ^ { 1 / 2 } )$ under $( \varepsilon , \delta )$ -DP, corruption of an $\alpha$ -fraction of samples, and both.
44
+
45
+ # 1.1 Technical contributions
46
+
47
+ We introduce PRIME which simultaneously achieves $( \varepsilon , \delta )$ -DP and robustness against $\alpha$ -fraction of corruption. A major challenge in making a standard filter-based robust estimation algorithm (e.g., [30]) private is the high sensitivity of the filtered set that we pass from one iteration to the next. We propose a new framework which makes private only the statistics of the set, hence significantly reducing the sensitivity. Our major innovation is a tight analysis of the end-to-end sensitivity of this multiple interactive accesses to the database. This is critical in achieving robustness while preserving privacy and is also of independent interest in making general iterative filtering algorithms private.
48
+
49
+ The classical filter approach (see, e.g. [30]) needs to access the database √ $O ( d )$ times, which brings an extra $O ( { \sqrt { d } } )$ factor in the sample complexity due to DP composition. In order to reduce the iteration complexity, following the approach in [36], we propose filtering multiple directions simultaneously using a new score based on the matrix multiplicative weights (MMW). In order to privatize the MMW filter, our major innovation is a novel adaptive filtering algorithm DPTHRESHOLD(·) that outputs a single private threshold which guarantees sufficient progress at every iteration. This brings the number of database accesses from $O ( d )$ to $O ( ( \log d ) ^ { 2 } )$ .
50
+
51
+ One downside of PRIME is that it requires an extra $d ^ { 1 / 2 }$ factor in the sample complexity, compared to known lower bounds for (non-robust) DP mean estimation. To investigate whether this is also necessary, we propose a sample optimal exponential time robust mean estimation algorithm in $\ S 4$ and prove that there is no extra statistical cost to jointly requiring privacy and robustness. Our major technical innovations is in using resilience property of the dataset to not only find robust mean (which is the typical use case of resilience) but also bound sensitivity of that robust mean.
52
+
53
+ # 1.2 Preliminary on differential privacy (DP)
54
+
55
+ DP is a formal metric for measuring privacy leakage when a dataset is accessed with a query [37].
56
+
57
+ Definition 1.1. Given two datasets $S = \{ x _ { i } \} _ { i = 1 } ^ { n }$ and $S ^ { \prime } = \{ x _ { i } ^ { \prime } \} _ { i = 1 } ^ { n ^ { \prime } }$ , we say $S$ and $S ^ { \prime }$ are neighboring $i f d _ { \triangle } ( S , S ^ { \prime } ) \leq 1$ where $d _ { \triangle } ( S , S ^ { \prime } ) \triangleq \operatorname* { m a x } \{ | S \setminus S ^ { \prime } | , | S ^ { \prime } \setminus S | \}$ , which is denoted by $S \sim S ^ { \prime }$ . For an output of a stochastic query q on a database, we say q satisfies $( \varepsilon , \delta )$ -differential privacy for some $\varepsilon > 0$ and $\delta \in ( 0 , 1 )$ i $\begin{array} { r } { \textstyle f \mathbb { P } ( q ( S ) \in A ) \le e ^ { \varepsilon } \mathbb { P } ( q ( S ^ { \prime } ) \in A ) + \delta } \end{array}$ for all $S \sim S ^ { \prime }$ and all subset $A$ .
58
+
59
+ Let $z \sim \mathrm { L a p } ( b )$ be a random vector with entries i.i.d. sampled from Laplace distribution with pdf $( 1 / 2 b ) e ^ { - | z | / b }$ . Let $z \sim \mathcal { N } ( \mu , \Sigma )$ denote a Gaussian random vector with mean $\mu$ and covariance $\Sigma$ .
60
+
61
+ Definition 1.2. The sensitivity of a query $f ( S ) ~ \in ~ \mathbb { R } ^ { k }$ is defined as $\Delta _ { p } ~ = ~ \operatorname* { s u p } _ { S \sim S ^ { \prime } } \| f ( S ) ~ -$ $f ( S ^ { \prime } ) \| _ { p }$ for a norm $\begin{array} { r } { \| { \boldsymbol x } \| _ { p } ~ = ~ ( \sum _ { i \in [ k ] } | x _ { i } | ^ { p } ) ^ { 1 / p } } \end{array}$ . For $p ~ = ~ 1$ , the Laplace mechanism outputs $f ( S ) + \mathrm { L a p } ( { \Delta _ { 1 } } / { \varepsilon } )$ and achieves $( \varepsilon , 0 ) – D P \ : I 3 7 J$ . For $p = 2$ , the Gaussian mechanism outputs $f ( S ) + \mathcal { N } ( 0 , ( \Delta _ { 2 } ( \sqrt { 2 \log ( 1 . 2 5 / \delta ) } ) / \varepsilon ) ^ { 2 } \mathbf { I } )$ and achieves $( \varepsilon , \delta ) – D P / 3 8 J$ .
62
+
63
+ We use these output perturbation mechanisms along with the exponential mechanism [69] as building blocks. Appendix A provides detailed survey of privacy and robust estimation.
64
+
65
+ # 1.3 Problem formulation
66
+
67
+ We are given $n$ samples from a sub-Gaussian distribution with a known covariance but unknown mean, and $\alpha$ fraction of the samples are corrupted by an adversary. Our goal is to estimate the unknown mean. We follow the standard definition of adversary in [30], which can adaptively choose which samples to corrupt and arbitrarily replace them with any points.
68
+
69
+ Assumption 1. An uncorrupted dataset $S _ { \mathrm { g o o d } }$ consists of $n$ i.i.d. samples from a $d$ -dimensional sub-Gaussian distribution with mean $\mu \in \mathbb { R } ^ { d }$ and covariance $\mathbb { E } [ x x ^ { \top } ] = \mathbf { I } _ { d } ,$ , which is 1-sub-Gaussian, i.e., $\mathbb { E } [ \exp ( v ^ { \top } x ) ] \leq \exp ( \| v \| _ { 2 } ^ { 2 } / 2 )$ for all $v \in \mathbb { R } ^ { d }$ . For some $\alpha \in ( 0 , 1 / 2 )$ , we are given a corrupted dataset $S = \{ x _ { i } \in \mathbb { R } ^ { d } \} _ { i = 1 } ^ { n }$ where an adversary adaptively inspects all the samples in $S _ { \mathrm { g o o d } }$ , removes αn of them, and replaces them with $S _ { \mathrm { b a d } }$ which are αn arbitrary points in $\mathbb { R } ^ { d }$ .
70
+
71
+ Similarly, we consider the same problem for heavy-tailed distributions with a bounded covariance.
72
+ We present the assumption and main results for covariance bounded distributions in Appendix B.
73
+
74
+ Notations. Let $[ n ] = \{ 1 , 2 , \dots , n \}$ . For $x \in \mathbb { R } ^ { d }$ , we use $\textstyle \| x \| _ { 2 } = ( \sum _ { i \in [ d ] } ( x _ { i } ) ^ { 2 } ) ^ { 1 / 2 }$ to denote the Euclidean norm. For $X \in \mathbb { R } ^ { d \times d }$ , we use $\begin{array} { r } { \| X \| _ { 2 } = \operatorname* { m a x } _ { \| v \| _ { 2 } = 1 } \| X v \| _ { 2 } } \end{array}$ to denote the spectral norm. The $d \times d$ identity matrix is $\mathbf { I } _ { d \times d }$ . Whenever it is clear from context, we use $S$ to denote both a set of data points and also the set of indices of those data points. $\widetilde O$ and $\widetilde \Omega$ hide poly-logarithmic factors in $d , n , 1 / \alpha$ , and the failure probability.
75
+
76
+ Outline. We present PRIME for sub-Gaussian distribution in $\ S 2$ , and present theoretical analysis in $\ S 3$ . We then introduce an exponential time algorithm with near optimal guarantee in $\ S 4$ . Due to space constraints, analogous results for heavy-tailed distributions are presented in Appendix B.
77
+
78
+ # 2 PRIME: efficient algorithm for robust and DP mean estimation
79
+
80
+ In order to describe the proposed algorithm PRIME, we need to first describe a standard (non-private) iterative filtering algorithm for robust mean estimation.
81
+
82
+ # 2.1 Background on (non-private) iterative filtering for robust mean estimation
83
+
84
+ Non-private robust mean estimation approaches recursively apply the following filter, whose framework is first proposed in [28]. Given a dataset $S = \{ x _ { i } \} _ { i = 1 } ^ { n }$ , the current set $S _ { 0 } \subseteq [ n ]$ of data points is updated starting with $S _ { 1 } = [ n ]$ . At each step, the following filter (Algorithm 1 in [63]) attempts to detect the corrupted data points and remove them.
85
+
86
+ 1. Compute the top eigenvector $v _ { t } \gets \arg \operatorname* { m a x } _ { v : \| v \| _ { 2 } = 1 } v ^ { \top } \mathrm { C o v } ( S _ { t - 1 } ) v$ of the covariance of the current data set $\{ x _ { i } \} _ { i \in S _ { t - 1 } }$ ;
87
+ 2. Compute scores for all data points $j \in S _ { t - 1 } \colon \tau _ { j } \gets \left( v _ { t } ^ { \top } \left( x _ { j } - \mathrm { M e a n } ( S _ { t - 1 } ) \right) \right) ^ { 2 } \ ;$
88
+ 3. Draw a random threshold: $Z _ { t } \gets \mathrm { U n i f } ( [ 0 , 1 ] )$ ;
89
+ 4. Remove outliers from $S _ { t - 1 }$ defined as $\{ i \in S _ { t - 1 } : \tau _ { i }$ is in the largest $2 \alpha$ -tail of $\{ \tau _ { j } \} _ { j \in S _ { t - 1 } }$ and $\tau _ { i } \geq Z _ { t } \tau _ { \operatorname* { m a x } } \}$ , where $\tau _ { \mathrm { m a x } } = \operatorname* { m a x } _ { j \in S _ { t - 1 } } \tau _ { j }$
90
+
91
+ This is repeated until the empirical covariance is sufficiently small and the empirical mean $\hat { \mu }$ is output. At a high level, the correctness of this algorithm relies on the key observation that the $\alpha$ -fraction of adversarial corruption can not significantly change the mean of the dataset without introducing large eigenvalues in the empirical covariance. Therefore, the algorithm finds top eigenvector of the empirical covariance in step 1, and tries to correct the empirical covariance by removing corrupted data points. Each data point is assigned a score in step 2 which indicates the “badness” of the data points, and a threshold $Z _ { t }$ in step 3 is carefully designed such that step 4 guarantees to remove more corrupted data points than good data points (in expectation). This guarantees the following bound achieving the near-optimal sample complexity shown in the second row of Table 1. A formal description of this algorithm is in Algorithm 4 in Appendix C.
92
+
93
+ Proposition 2.1 (Corollary of [63, Theorem 2.1]). Under assumption $^ { l }$ , the above filtering algorithm achieves accuracy $\| \hat { \mu } - \mu \| _ { 2 } \le O ( \alpha \sqrt { \log ( 1 / \alpha ) } ) \ w . p . \ 0 . 9 i f n \ge \widetilde { \Omega } ( d / \alpha ^ { 2 } ) \ / .$ .
94
+
95
+ Challenges in making robust mean estimation private. To get a DP and robust mean, a naive attempt is to apply a standard output perturbation mechanism to $\hat { \mu }$ . However, this is obviously challenging since the end-to-end sensitivity is intractable. The standard recipe to circumvent this is to make the current “state” $S _ { t }$ private at every iteration. Once $S _ { t - 1 }$ is private (hence, public knowledge), making the next “state” $S _ { t }$ private is simpler. We only need to analyze the sensitivity of a single step and apply some output perturbation mechanism with $\left( \varepsilon _ { t } , \delta _ { t } \right)$ . End-to-end privacy is guaranteed by accounting for all these $\left( \varepsilon _ { t } , \delta _ { t } \right)$ ’s using the advanced composition [51]. This recipe has been quite successful, for example, in training neural networks with (stochastic) gradient descent [1], where the current state can be the optimization variable $\mathbf { x } _ { t }$ . However, for the above (non-private) filtering algorithm, this standard recipe fails, since the state $S _ { t }$ is a set and has large sensitivity. Changing a single data point in $S _ { t }$ can significantly alter which (and how many) samples are filtered out.
96
+
97
+ # 2.2 A new framework for private iterative filtering
98
+
99
+ Instead of making the (highly sensitive) $S _ { t }$ itself private, we propose a new framework which makes private only the statistics of $S _ { t }$ : the mean $\mu _ { t }$ and the top principal direction $v _ { t }$ . There are two versions of this algorithm, which output the exactly same $\hat { \mu }$ with the exactly same privacy guarantees, but are written from two different perspectives. We present here the interactive version from the perspective of an analyst accessing the dataset via DP queries $\cdot q _ { \mathrm { r a n g e } }$ , $q _ { \mathrm { s i z e } }$ , $q _ { \mathrm { m e a n } }$ , $q _ { \mathrm { n o r m } }$ and $q _ { \mathrm { P C A } } ,$ ), because this version makes clear the inner operations of each private mechanisms, hence making $( i )$ the sensitivity analysis transparent, $( i i )$ checking the correctness of privacy guarantees easy, and $( i i i )$ tracking privacy accountant simple. In practice, one should implement the centralized version (Algorithm 7 in Appendix D), which is significantly more efficient.
100
+
101
+ # Algorithm 1: Private iterative filtering (interactive version)
102
+
103
+ Input: $S = \{ x _ { i } \} _ { i \in [ n ] }$ , $\alpha \in ( 0 , 1 / 2 )$ , probability $\zeta \in ( 0 , 1 )$ , # of iterations $T = \Theta ( d ) , ( \varepsilon , \delta )$
104
+ 1 $( \bar { x } , B ) \gets q _ { \mathrm { r a n g e } } ( S , 0 . 0 1 \varepsilon , 0 . 0 1 \delta )$
105
+ 2 $\varepsilon _ { 1 } \gets \operatorname* { m i n } \{ 0 . 9 9 \varepsilon , 0 . 9 \} / ( 4 \sqrt { 2 T \log ( 2 / \delta ) } )$ ), δ1 ← 0.99δ/(8T )
106
+ 3 if $n < ( 4 / \varepsilon _ { 1 } ) \log ( 1 / ( 2 \delta _ { 1 } ) )$ then Output: $\varnothing$
107
+ 4 for $t = 1 , \dots , T$ do
108
+ 5 $n _ { t } q _ { \mathrm { s i z e } } ( \{ ( \mu _ { \ell } , v _ { \ell } , Z _ { \ell } ) \} _ { \ell \in [ t - 1 ] } , \varepsilon _ { 1 } , \bar { x } , B )$ , if $n _ { t } < 3 n / 4$ then Output: $\varnothing$
109
+ 6 $\mu _ { t } q _ { \mathrm { m e a n } } ( \{ ( \mu _ { \ell } , v _ { \ell } , Z _ { \ell } ) \} _ { \ell \in [ t - 1 ] } , \varepsilon _ { 1 } , \bar { x } , B )$
110
+ 7 $\lambda _ { t } \gets q _ { \mathrm { n o r m } } ( \{ ( \mu _ { \ell } , v _ { \ell } , Z _ { \ell } ) \} _ { \ell \in [ t - 1 ] } , \mu _ { t } , \varepsilon _ { 1 } , \bar { x } , B )$
111
+ 8 if $\lambda _ { t } \le ( C - 0 . 0 1 ) \alpha \log { 1 / \alpha }$ then Output: $\mu _ { t }$
112
+ 9 $\boldsymbol { v } _ { t } q _ { \mathrm { P C A } } ( \{ ( \mu _ { \ell } , v _ { \ell } , Z _ { \ell } ) \} _ { \ell \in [ t - 1 ] } , \mu _ { t } , \varepsilon _ { 1 } , \delta _ { 1 } , \bar { x } , B ) )$
113
+ 10 $Z _ { t } \gets \mathrm { U n i f } ( [ 0 , 1 ] )$
114
+
115
+ # Output: $\mu _ { t }$
116
+
117
+ We give a high-level explanation of each step of Algorithm 1 here and give the formal definitions of all the queries in Appendix D. First, $q _ { \mathrm { r a n g e } }$ returns (the parameters of) a hypercube $\bar { x } + [ - B / 2 , B / 2 ] ^ { d }$ that is guaranteed to include all uncorrupted samples while preserving privacy. This is achieved by running $d$ coordinate-wise private histograms and selecting $\bar { x } _ { j }$ as the center of the largest bin for the $j$ -th coordinate. Since covariance is I, $q _ { \mathrm { r a n g e } }$ returns a fixed $B = 8 \sigma \sqrt { \log ( d n / \zeta ) }$ . Such an adaptive estimate of the support is critical in tightly bounding the sensitivity of all subsequent queries, which operate on the clipped dataset; all data points are projected as $\mathcal { P } _ { \bar { x } + [ - B / 2 , B / 2 ] ^ { d } } ( x ) =$ arg $\begin{array} { r } { \operatorname* { m i n } _ { y \in \bar { x } + [ - B / 2 , B / 2 ] ^ { c } } } \end{array}$ $\lVert y - x \rVert _ { 2 }$ in all the queries that follow. With clipping, a single data point can now change at most by $B \sqrt { d }$ .
118
+
119
+ The subsequent steps perform the non-private filtering algorithm of $\ S 2 . 1$ , but with private statistics $\mu _ { t }$ and $v _ { t }$ . As the set $S _ { t }$ changes over time, we lower bound its size (which we choose to be $| S _ { t } | > n / 2 )$ ) to upper bound the sensitivity of other queries $q _ { \mathrm { m e a n } } , q _ { \mathrm { n o r m } }$ and $q _ { \mathrm { P C A } }$ .
120
+
121
+ At the $t$ -th iterations, every time a query is called the data curator $( i )$ uses $( { \bar { x } } , B )$ to clip the data, $( i i )$ computes $S _ { t }$ by running $t - 1$ steps of the non-private filtering algorithm of $\ S 2 . 1$ but with a given fixed set of parameters $\{ ( \mu _ { \ell } , v _ { \ell } ) \} _ { \ell \in [ t - 1 ] }$ (and the given randomness $\{ Z _ { \ell } \} _ { \ell \in [ t - 1 ] } )$ , and $( i i i )$ computes the queried private statistics of $S _ { t }$ . If the private spectral norm of the covariance of $S _ { t }$ (i.e., $\lambda _ { t } ,$ ) is sufficiently small, we output the private and robust mean $\hat { \mu } = \mu _ { t }$ (line 8). Otherwise, we compute the private top PCA direction $v _ { t }$ and draw an randomness $Z _ { t }$ to be used in the next step of filtering, as in the non-private filtering algorithm. We emphasize that $\{ S _ { \ell } \}$ are not private, and hence never returned to the analyst. We also note that this interactive version is redundant as every query is re-computing $S _ { t }$ . In our setting, the analyst has the dataset and there is no need to separate them. This leads to a centralized version we provide in Algorithm 7 in the appendix, which avoids redundant computations and hence is significantly more efficient.
122
+
123
+ The main challenge in this framework is the privacy analysis. Because $\{ S _ { \ell } \} _ { \ell \in [ t - 1 ] }$ is not private, each query runs $t - 1$ steps of filtering whose end-to-end sensitivity could blow-up. Algorithmically, $( i )$ we start with a specific choice of a non-private iterative filtering algorithm (among several variations that are equivalent in non-private setting but widely differ in its sensitivity), and $( i i )$ make appropriate changes in the private queries (Algorithm 1) to keep the sensitivity small. Analytically, the following key technical lemma allows a sharp analysis of the end-to-end sensitivity of iterative filtering.
124
+
125
+ Lemma 2.2. Let $S _ { t } ( S )$ denote the resulting subset of samples after $t$ iterations of the filtering in the queries $( q _ { \mathrm { s i z e } }$ , $q _ { \mathrm { m e a n } }$ , $q _ { \mathrm { n o r m } }$ , and $q _ { \mathrm { P C A } } )$ are applied to a dataset $s$ using fixed parameters $\{ ( \mu _ { \ell } , v _ { \ell } , Z _ { \ell } ) \} _ { \ell = 1 } ^ { t }$ . Then, we have $d _ { \triangle } ( S _ { t } ( S ) , S _ { t } ( S ^ { \prime } ) ) \leq d _ { \triangle } ( S , S ^ { \prime } )$ , where $d _ { \triangle } ( S , S ^ { \prime } ) \triangleq \operatorname* { m a x } \{ | S \ \backslash$ $S ^ { \prime } | , | S ^ { \prime } \backslash S | \}$ .
126
+
127
+ Recall that two datasets are neighboring, i.e., $\boldsymbol { S } \sim \boldsymbol { S } ^ { \prime }$ , iff $d _ { \triangle } ( S , S ^ { \prime } ) \leq 1$ . This lemma implies that if two datasets are neighboring, then they are still neighboring after filtering with the same parameters, no matter how many times we filter them. Hence, this lemma allows us to use the standard outputperturbation mechanisms with $( \varepsilon _ { 1 } , \delta _ { 1 } )$ -DP. Advanced composition ensures that end-to-end guarantee of $4 T$ such queries is $( 0 . 9 9 \varepsilon , 0 . 9 9 \delta )$ -DP. Together with $( 0 . 0 1 \varepsilon , 0 . 0 1 \delta )$ -DP budget used in $q _ { \mathrm { r a n g e } }$ , this satisfied the target privacy. Analyzing the utility of this algorithm, we get the following guarantee.
128
+
129
+ Theorem 5. Algorithm $^ { l }$ is $( \varepsilon , \delta )$ -DP. Under Assumption $^ { l }$ , there exists a universal constant $c \in$ $( 0 , 0 . 1 )$ such that if $\alpha \leq c$ and $n = \widetilde \Omega \left( ( d / \alpha ^ { 2 } ) + d ^ { 2 } ( \log ( 1 / \delta ) ) ^ { 3 / 2 } / ( \varepsilon \alpha ) \right)$ then Algorithm 1 achieves $\| \hat { \mu } - \mu \| _ { 2 } \leq O ( \alpha \sqrt { \log ( 1 / \alpha ) } )$ with probability 0.9.
130
+
131
+ The first term $O ( d / \alpha ^ { 2 } )$ in the sample complexity is optimal (cf. Table 1), but there is a factor of $d$ gap in the second term. This is due to the fact that we need to run $O ( d )$ iterations in the worst-case. Such numerous accesses to the database result in large noise to be added at each iteration, requiring large sample size to combat that extra noise. We introduce PRIME to reduce the number of iterations to ${ \bar { O } } ( ( \log { d } ) ^ { 2 } )$ and significantly reduce the sample complexity.
132
+
133
+ # 2.3 PRIME: novel robust and private mean estimator
134
+
135
+ Algorithm 1 (specifically Filter(·) in Algorithm 1) accesses the database $O ( d )$ times. This is necessary for two reasons. First, the filter checks only one direction $v _ { t }$ at each iteration. In the worst case, the corrupted samples can be scattered in $\Omega ( d )$ orthogonal directions such that the filter needs to be repeated $O ( d )$ times. Secondly, even if the corrupted samples are clustered together in one direction, the filter still needs to be repeated $O ( d )$ times. This is because we had to use a large (random) threshold of $d B ^ { 2 } Z _ { t } = { \cal { O } } ( d )$ to make the threshold data-independent so that we can keep the sensitivity of Filter(·) low, which results in slow progress. We propose filtering multiple directions simultaneously using a new score $\{ \tau _ { i } \}$ based on the matrix multiplicative weights. Central to this approach is a novel adaptive filtering algorithm DPTHRESHOLD $( \cdot )$ that guarantees sufficient decrease in the total score at every iteration.
136
+
137
+ # 2.3.1 Matrix Multiplicative Weight (MMW) scoring
138
+
139
+ The MMW-based approach, pioneered in [36] for non-private robust mean estimation, filters out multiple directions simultaneously. It runs over $O ( \log d )$ epochs and every epoch consists of $O ( \log d )$ iterations. At every epoch $s$ and iteration $t$ , step 2 of the iterative filtering in $\ S 2 . 1$ is replaced by a new score $\tau _ { i } = ( x _ { i } - \mathrm { M e a n } ( S _ { t } ^ { ( s ) } ) ) ^ { T } U _ { t } ^ { ( s ) } ( x _ { i } - \mathrm { M e a n } ( S _ { t } ^ { ( s ) } ) )$ where $U _ { t } ^ { ( s ) }$ now accounts for all directions in $\mathbb { R } ^ { d }$ but appropriately weighted. Precisely, it is defined via the matrix multiplicative update:
140
+
141
+ $$
142
+ U _ { t } ^ { ( s ) } = \frac { \exp \left( \alpha ^ { ( s ) } \sum _ { r \in [ t ] } ( \mathrm { C o v } ( S _ { r } ^ { ( s ) } ) - { \bf I } ) \right) } { \mathrm { T r } \big ( \exp ( \alpha ^ { ( s ) } \sum _ { r \in [ t ] } ( \mathrm { C o v } ( S _ { r } ^ { ( s ) } ) - { \bf I } ) ) \big ) } ,
143
+ $$
144
+
145
+ for some choice of $\alpha ^ { ( s ) } > 0$ . If we set the number of iterations to one, a choice of $\alpha ^ { ( s ) } = \infty$ recovers the previous score that relied on the top singular vector from $\ S 2 . 1$ and a choice of $\alpha ^ { ( s ) } = 0$ gives a simple norm based score $\tau _ { i } = \| x _ { i } \| _ { 2 } ^ { 2 }$ . An appropriate choice of $\alpha ^ { ( s ) }$ smoothly interpolates between these two extremes, which ensures that $O ( \log d )$ iterations are sufficient for the spectral norm of the covariance to decrease strictly by a constant factor. This guarantees that after $O ( \log d )$ epochs, we sufficiently decrease the covariance to ensure that the empirical mean is accurate enough. Critical in achieving this gain is our carefully designed filtering algorithm DPTHRESHOLD that uses the privately computed MMW-based scores using Gaussian mechanism on the covariance matrices as shown in Algorithm 11 in Appendix E.
146
+
147
+ # 2.3.2 Adaptive filtering with DPTHRESHOLD
148
+
149
+ Novelty. The corresponding non-private filtering of [36, Algorithm 9] for robust mean estimation takes advantage of an adaptive threshold, but filters out each sample independently resulting in a prohibitively large sensitivity; the coupling between each sample and the randomness used to filter it can change widely between two neighboring datasets. On the other hand, Algorithm 1 (i.e., Filter(·) in Algorithm 6) takes advantage of jointly filtering all points above a single threshold $B ^ { 2 } d Z _ { t }$ with a single randomness $Z _ { t } \sim \mathrm { U n i f } [ 0 , 1 ]$ , but the non-adaptive (and hence large) choice of the range $B ^ { 2 } d$ results in a large number of iterations because each filtering only decrease the score by little. To sufficiently reduce the total score while maintaining a small sensitivity, we introduce a filter with a single and adaptive threshold.
150
+
151
+ Algorithm. Our goal here is to privately find a single scalar $\rho$ such that when a randomized filter is applied on the scores $\{ \tau _ { i } \}$ with a (random) threshold $\rho Z$ (with $Z$ drawn uniform in $[ 0 , 1 ] )$ , we filter out enough samples to make progress in each iteration while ensuring that we do not remove too many uncorrupted samples. This is a slight generalization of the non-private algorithm in Section 2.1, which simply set $\rho = \operatorname* { m a x } _ { j \in S _ { t } } \tau _ { j }$ . While this guarantees the filter removes more corrupted samples than good samples, it does not make sufficient progress in reducing the total score of the samples.
152
+
153
+ Ideally, we want the thresholding to decrease the total score by a constant multiplicative factor, which will in the end allow the algorithm to terminate within logarithmic iterations. To this end, we propose a new scheme of using the largest $\rho$ such that the following inequality holds:
154
+
155
+ $$
156
+ \sum _ { \tau _ { i } > \rho } ( \tau _ { i } - \rho ) \geq 0 . 3 1 \sum _ { \tau _ { i } \in S _ { t } } ( \tau _ { i } - 1 ) .
157
+ $$
158
+
159
+ We use a private histogram of the scores to approximate this threshold. Similar to [55, 58], we use geometrically increasing bin sizes such that we use only $O ( \log B ^ { 2 } d )$ bins while achieving a preferred multiplicative error in our quantization. At each epoch $s$ and iteration $t$ , we run DPTHRESHOLD sketched in the following to approximate $\rho$ followed by a random filter. Step 3 replaces the non-private condition in Eq. (1). A complete description is provided in Algorithm 11.
160
+
161
+ 1. Privately compute scores for all data points $i \in S _ { t } ^ { ( s ) } : \tau _ { i } \gets ( x _ { i } - \mu _ { t } ) ^ { \top } U _ { t } ^ { ( s ) } ( x _ { i } - \mu _ { t } ) ;$ ;
162
+ 2. Compute a private histogram $\{ \tilde { h } _ { j } \} _ { j = 1 } ^ { 2 + \log ( B ^ { 2 } d ) }$ t i i t t i t of the scores over geometrically sized bins
163
+ $I _ { 1 } = [ 1 / 4 , 1 / 2 )$ , $I _ { 2 } = [ 1 / 2 , 1 ) , \ldots , \bar { I } _ { 2 + \log ( B ^ { 2 } d ) } = [ 2 ^ { \log ( B ^ { 2 } d ) - 1 } , 2 ^ { \log ( B ^ { 2 } d ) } ]$ ;
164
+ 3. Privately find the largest $\ell$ satisfying $\begin{array} { r } { \sum _ { j \ge \ell } ( 2 ^ { j } - 2 ^ { \ell } ) \tilde { h } _ { j } \ge 0 . 3 1 \sum _ { i \in S _ { t } ^ { ( s ) } } ( \tau _ { i } - 1 ) ; } \end{array}$ ;
165
+ 4. Output $\rho = 2 ^ { \ell }$ .
166
+
167
+ # 3 Analyses of PRIME
168
+
169
+ Building on the framework of Algorithm 1, PRIME (Algorithm 9) replaces the score with the MMWbased score presented in $\ S 2 . 3 . 1$ and the filter with the adaptive DPTHRESHOLD. This reduces the number of iterations to $T = O ( ( \log d ) ^ { 2 } )$ achieving the following bound.
170
+
171
+ Theorem 6. PRIME is $( \varepsilon , \delta )$ -differentially private. Under Assumption $I$ there exists a universal constant $c \in ( 0 , 0 . 1 )$ such that if $\alpha \leq c$ and $n = \widetilde \Omega ( ( d / \alpha ^ { 2 } ) + ( d ^ { 3 / 2 } / ( \varepsilon \alpha ) ) \log ( 1 / \delta ) )$ , then PRIME achieves $\| \hat { \mu } - \mu \| _ { 2 } = O ( \alpha \sqrt { \log ( 1 / \alpha ) } )$ with probability 0.9.
172
+
173
+ A proof is provided in Appendix F. The notation $\widetilde { \Omega } ( \cdot )$ hides logarithmic terms in $d , R$ , and $1 / \alpha$ . To achieve an error of $O ( \alpha \sqrt { \log ( 1 / \alpha ) } )$ , the first term $\widetilde \Omega ( d / \alpha ^ { 2 } \log ( 1 / \alpha ) )$ is necessary even if there is no corruption. The accuracy of $O ( \alpha \sqrt { \log ( 1 / \alpha ) } )$ matches the lower bound shown in [33] for any polynomial time statistical query algorithm, and it nearly matches the information theoretical lower bound on robust estimation of $\Omega ( \alpha )$ . On the other hand, the second term of $\widetilde \Omega ( d ^ { 3 / 2 } / ( \varepsilon \alpha \log ( 1 / \alpha ) ) )$
174
+
175
+ has an extra factor of $d ^ { 1 / 2 }$ compared to the optimal one achieved by exponential time Algorithm 2. It is an open question if this gap can be closed by a polynomial time algorithm.
176
+
177
+ The bottleneck is the private matrix multiplicative weights. Such spectral analyses are crucial in filter-based robust estimators. Even for a special case of privately computing the top principal component, the best polynomial time algorithm requires $\bar { O } ( d ^ { 3 / 2 } )$ samples [39, 18, 78], and this sample complexity is also necessary as shown in [39, Corollary 25].
178
+
179
+ To boost the success probability to $1 - \zeta$ for some small $\zeta > 0$ , we need an extra $\log ( 1 / \zeta )$ factor in the sample complexity to make sure the dataset satisfies the regularity condition with probability $\zeta / 2$ . Then we can run PRIME $\log ( 1 / \zeta )$ times and choose the output of a run that satisfies $n ^ { ( s ) } > n ( 1 { - } 1 0 \alpha )$ and $\lambda ^ { ( s ) } \le C \alpha \log ( 1 / \alpha )$ at termination.
180
+
181
+ ![](images/46a53c55cd9bcc36cd60657375546149f2ff820d7058a98083ffc81ea44ac394.jpg)
182
+ Figure 1: Private mean estimators (e.g., DP mean [52]) are vulnerable to adversarial corruption especially in high dimensions, while the proposed PRIME achieves robustness (and privacy) regardless of the dimension of the samples.
183
+
184
+ Numerical experiments support our theoretical claims. The left figure with $( \alpha , \varepsilon , \delta , n ) \ =$ $( 0 . 0 5 , 2 0 , 0 . 0 1 , 1 0 ^ { 6 } )$ is in the large $\alpha$ regime where the DP Mean error is dominates by $\alpha \sqrt { d }$ and PRIME error by $\alpha \sqrt { \log ( 1 / \alpha ) }$ . Hence, PRIME error is constant whereas DP Mean error increases with the dimension $d$ . The second figure with √ $( \alpha , \varepsilon , \delta , n ) = ( 0 . 0 0 1 , 2 0 , 0 . 0 1 , 1 0 ^ { 6 } )$ is in the small $\alpha$ regime when DP Mean error consists of $\alpha \sqrt { d } + \sqrt { d / n }$ and PRIME is dominated by $\sqrt { d / n }$ . Both increase with the dimension $d$ , and the gap can be made large by increasing $\alpha$ . The right figure√ with $( \alpha , \delta , d , n ) = ( 0 . 1 , 0 . 0 1 , 1 0 , 1 0 ^ { 6 } )$ is when DP Mean error is dominated by $\alpha \sqrt { d }$ and PRIME by $\alpha \sqrt { \log ( 1 / \alpha ) }$ when $\varepsilon > c d ^ { 1 . 5 } / ( \alpha n )$ . Below this threshold, which happens in this example around $\varepsilon = 0 . 0 5$ , the added noise in the private mechanism starts to dominate with decreasing $\varepsilon$ . Both algorithms have respective thresholds below which the error increases with decreasing $\varepsilon$ . This threshold is larger for PRIME because it uses the privacy budget to perform multiple operations and hence the noise added to the final output is larger compared to DP Mean. Below this threshold, which can be easily determined based on the known parameters $( \varepsilon , \delta , n , \alpha )$ , we should either collect more data (which will decrease the threshold) or give up filtering and spend all privacy budget on $q _ { \mathrm { r a n g e } }$ and the empirical mean (which will reduce the error). Details of the experiments are in Appendix L.
185
+
186
+ # 4 Exponential time algorithm with near-optimal sample complexity
187
+
188
+ Novelty. An existing exponential time algorithm for robust and private mean estimation in [14] strictly requires the uncorrupted samples to be drawn from a Gaussian distribution. We also provide a similar algorithm based on private Tukey median in Appendix I and its analysis in Appendix J. In this section, we introduce a novel estimator that achieves near-optimal guarantees for more general sub-Gaussian distributions (and also covariance bounded distributions) but takes an exponential run-time. Its innovation is in leveraging on the resilience property of well-behaved distributions not only to estimate the mean robustly (which is the standard use of the property) but also to adaptively bound the sensitivity of the estimator, thus achieving optimal privacy-accuracy tradeoff.
189
+
190
+ Definition 4.1 (Resilience from Definition 1 in [73]). $A$ set of points $\{ x _ { i } \} _ { i \in S }$ lying in $\mathbb { R } ^ { d }$ is $( \sigma , \alpha )$ - resilient around a point $\mu$ $\begin{array} { r } { . i f \| ( 1 / | T | ) \sum _ { i \in T } ( x _ { i } - \mu ) \| _ { 2 } \leq \sigma } \end{array}$ for all subsets $T \subset S$ of size $( 1 - \alpha ) | S |$ .
191
+
192
+ Algorithm. As data is corrupted, we define $R ( S )$ as a surrogate for resilience of the uncorrupted part of the set. If $S$ indeed consists of a $1 - \alpha$ fraction of independent samples from the promised class of distributions, the goodness score $R ( S )$ will be close to the resilience property of the good data.
193
+
194
+ Definition 4.2 (Goodness of a set). For $\mu ( S ) = ( 1 / | S | ) \sum _ { i \in S } x _ { i }$ , let us define
195
+
196
+ $$
197
+ R ( S ) \stackrel { \Delta } { = } \operatorname* { m i n } _ { \substack { S ^ { \prime } \subset S , | S ^ { \prime } | = ( 1 - 2 \alpha ) | S | . } } \operatorname* { m a x } _ { \substack { T \subset S ^ { \prime } , | T | = ( 1 - \alpha ) | S ^ { \prime } | . } } \| \mu ( T ) - \mu ( S ^ { \prime } ) \| _ { 2 } .
198
+ $$
199
+
200
+ Algorithm 2 first checks if the resilience matches that of the promised distribution. The data is pre-processed with $q _ { \mathrm { r a n g e } }$ to ensure we can check $R ( S )$ privately. Once resilience is cleared, we can safely use the exponential mechanism based on the score function $d ( \hat { \mu } , S )$ in Definition 4.3 to select an approximate robust mean $\hat { \mu }$ privately. The choice of the sensitivity critically relies on the fact that resilient datasets have small sensitivity of ${ \cal O } ( ( 1 / n ) \sqrt { \log ( 1 / \alpha ) } )$ . Without the resilience check, the sensitivity is $O ( d ^ { 1 / 2 } / n )$ resulting in an extra factor of $\sqrt { d }$ in the sample complexity.
201
+
202
+ Input: $S = \{ x _ { i } \} _ { i \in [ n ] } , \alpha \in ( 0 , 1 / 2 ) , ( \varepsilon , \delta )$
203
+ 1 if $n < c d ^ { 1 / 2 } \log ( 1 / \delta ) / \left( \varepsilon \alpha \sqrt { \log ( 1 / \alpha ) } \right)$ then Output: $\emptyset \ [ \ c d ^ { 1 / 2 } \log ( 1 / \delta ) / \ ( \varepsilon \alpha )$ for hevay-tail]
204
+ 2 $( \bar { x } , B ) \gets q _ { \mathrm { r a n g e } } ( S , ( 1 / 3 ) \varepsilon , ( 1 / 3 ) \delta )$ $[ \ q _ { \mathrm { r a n g e - h t } } ( \cdot )$ for hevay-tail]
205
+ 3 Project the data points onto the ball: $x _ { i } \mathcal { P } _ { B _ { \sqrt { d } B / 2 } ( \bar { x } ) } ( x _ { i } )$ , for all $i \in [ n ]$
206
+ 4 $\widehat { R } ( S ) \gets R ( S ) + \mathrm { L a p } ( 3 B d ^ { 1 / 2 } / ( n \varepsilon ) )$
207
+ 5 if $\widehat { R } ( S ) > 2 \alpha \sqrt { \log ( 1 / \alpha ) }$ then Output: $\varnothing$ $[ \widehat { R } ( S ) > 2 c _ { \zeta } \sqrt { \alpha }$ for hevay-tail]
208
+ 6 else Output: a randomly drawn point $\hat { \mu } \in \mathcal { B } _ { \sqrt { d } B / 2 } ( \bar { x } )$ sampled from a density
209
+ 7 r(ˆµ) ∝ e−(1/(24 log(1/α)))ε n d(ˆµ,S) $[ e ^ { - ( \varepsilon n \sqrt { \alpha } / ( 2 4 c _ { \zeta } ) ) d ( \hat { \mu } , S ) }$ for heavy-tail]
210
+
211
+ We propose the score function $d ( \hat { \mu } , S )$ in the following definition, which is a robust estimator of the distance between the mean and the candidate $\hat { \mu }$ .
212
+
213
+ Definition 4.3. For a set of data $\{ x _ { i } \} _ { i \in S }$ lying in $\mathbb { R } ^ { d }$ , for any $v \in \mathbb { S } ^ { d - 1 }$ , define $\mathcal { T } ^ { v }$ to be the $3 \alpha | S |$ points with the largest $v ^ { \top } x _ { i }$ value, $B ^ { v }$ to be the $3 \alpha | S |$ points with the smallest $v ^ { \top } x _ { i }$ value, and $\mathcal { M } ^ { v } = S \setminus ( \mathcal { T } ^ { v } \cup B ^ { v } )$ . Define $\begin{array} { r l r } { d ( \hat { \mu } , S ) } & { \triangleq } & { \operatorname* { m a x } _ { v \in \mathbb { S } ^ { d - 1 } } \left. v ^ { \top } \left( \mu ( \mathcal { M } ^ { v } ) - \hat { \mu } \right) \right. } \end{array}$ .
214
+
215
+ Analysis. For any direction $v$ , the truncated mean estimator $\mu ( \mathcal { M } ^ { v } )$ provides a robust estimation of the true mean along the direction $v$ , thus the distance can be simply defined by taking the maximum over all directions $v$ . We show the sensitivity of this simple estimator is bounded by the resilience property $\sigma$ divided by $n$ , which is ${ \cal O } ( ( 1 / n ) \sqrt { \log ( 1 / \alpha ) } )$ once the resilience check is passed. This leads to the following near-optimal sample complexity. We provide a proof in Appendix H.2.
216
+
217
+ Theorem 7 (Exponential time algorithm for sub-Gaussian distributions). Algorithm 2 is $( \varepsilon , \delta )$ -DP. Under Assumption $^ { l }$ , this algorithm achieves $\| \hat { \mu } - \mu \| _ { 2 } = O ( \alpha \sqrt { \log ( 1 / \alpha ) } )$ with probability $1 - \zeta i f$
218
+
219
+ $$
220
+ n = \widetilde \Omega \Big ( \frac { d + \log \frac { 1 } { \xi } } { \alpha ^ { 2 } \log \frac { 1 } { \alpha } } + \frac { d \log \Big ( d \sqrt { \log ( d n / \zeta ) } / \alpha \Big ) + d ^ { 1 / 2 } \log \frac { 1 } { \delta } + \log \frac { 1 } { \zeta } } { \varepsilon \alpha } + \frac { \sqrt { d \log \frac { 1 } { \delta } } \log \frac { d } { \zeta \delta } } { \varepsilon } \Big ) ~ .
221
+ $$
222
+
223
+ Run-time. Computing $R ( S )$ exactly can take $O ( d e ^ { \Theta ( n ) } )$ operations. The exponential mechanism implemented with $\alpha$ -covering for $\hat { \mu }$ and a constant covering for $v$ can take $O ( n d ( \sqrt { \log ( d n / \zeta ) } / \alpha ) ^ { d } )$ operations.
224
+
225
+ # 5 Conclusion
226
+
227
+ Differentially private mean estimation is brittle against a small fraction of the samples being corrupted by an adversary. We show that robustness can be achieved without any increase in the sample complexity by introducing a novel DP mean estimator, which requires run-time exponential in the dimension of the samples. The technical contribution is in leveraging the resilience property of well-behaved distributions in an innovative way to not only find robust mean (which is the typical use case of resilience) but also bound sensitivity for optimal privacy guarantee. To cope with the computational challenge, we propose an efficient algorithm, which we call PRIME, that achieves the optimal target accuracy at the cost of an increased sample complexity. The technical contributions are $( i )$ a novel framework for private iterative filtering and its tight analysis of the end-to-end sensitivity and $( i i )$ novel filtering algorithm of DPTHRESHOLD which is critical in privately running matrix multiplicative weights and hence significantly reducing the number of accesses to the database. With appropriately chosen parameters, we show that our exponential time approach achieves near-optimal guarantees for both sub-Gaussian and covariance bounded distributions and PRIME achieves the same accuracy efficiently but at the cost of an increased sample complexity by a $d ^ { 1 / 2 }$ factor.
228
+
229
+ There are several directions for improving our results further and applying the framework to solve other problems. PRIME provides a new design principle for private and robust estimation. This can be more broadly applied to fundamental statistical analyses such as robust covariance estimation [28, 30, 64] robust PCA [60, 48], and robust linear regression [59, 35].
230
+
231
+ PRIME could be improved in a few directions. First, the sample complexity of $\widetilde \Omega ( ( d / ( \alpha ^ { 2 } \log ( 1 / \alpha ) ) ) +$ $( d ^ { 3 / 2 } / ( \varepsilon \alpha \log ( 1 / \alpha ) ) ) \log ( 1 / \delta ) )$ in Theorem 6 is suboptimal in the second term. Improving the $d ^ { 3 / 2 }$ factor requires bypassing differentially private singular value decomposition, which seems to be a challenging task. However, it might be possible to separate the $\bar { \log ( 1 / \delta ) }$ factor from the rest of the terms and get an additive error of the form $\widetilde \Omega ( ( d / ( \alpha ^ { 2 } \log ( 1 / \alpha ) ) ) + ( d ^ { 3 / 2 } / ( \varepsilon \alpha \log ( 1 / \alpha ) ) ) +$ $( 1 / \varepsilon ) \log ( 1 / \delta ) )$ . This requires using Laplace mechanism in private MMW (line 16 Algortihm 10). Secondly, the time complexity of PRIME is dominated by computation time of the matrix exponential in (line 16 Algortihm 10). Total number of operations scale as ${ \widetilde { O } } ( d ^ { 3 } + n d ^ { 2 } )$ . One might hope to achieve $\widetilde O ( n d )$ time complexity using approximate computations of $\tau _ { j }$ ’s using techniques from [36]. This does not improve the sample complexity, as the number of times the dataset is accessed remains the same. Finally, for (non-robust) private mean estimation, COINPRESS provides a practical improvement in the small sample regime by progressively refining the search space [12]. The same principle could be applied to PRIME to design a robust version of COINPRESS. One important question remains open; how are differential privacy and robust statistics fundamentally related? We believe our exponential time algorithm hints on a fundamental connection between robust statistics of a data projected onto one-dimensional subspace and sensitivity of resulting score function for the exponential mechanism. It is an interesting direction to pursue this connection further to design novel algorithms that bridge privacy and robustness.
232
+
233
+ # Acknowledgement
234
+
235
+ Sham Kakade acknowledges funding from the National Science Foundation under award CCF1703574. Sewoong Oh acknowledges funding from Google faculty research award, NSF grants IIS-1929955, CCF-1705007, CNS-2002664, CCF 2019844 as a part of Institute for Foundation of Machine Learning, and CNS-2112471 as a part of Institute for Future Edge Networks and Distributed Intelligence.
236
+
237
+ # References
238
+
239
+ [1] Martin Abadi, Andy Chu, Ian Goodfellow, H Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. Deep learning with differential privacy. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, pages 308–318, 2016.
240
+ [2] John M Abowd. The us census bureau adopts differential privacy. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 2867–2867, 2018.
241
+ [3] Ishaq Aden-Ali, Hassan Ashtiani, and Gautam Kamath. On the sample complexity of privately learning unbounded high-dimensional gaussians. arXiv preprint arXiv:2010.09929, 2020.
242
+ [4] Zeyuan Allen-Zhu, Zhenyu Liao, and Lorenzo Orecchia. Spectral sparsification and regret minimization beyond matrix multiplicative updates. In Proceedings of the forty-seventh annual ACM symposium on Theory of computing, pages 237–245, 2015.
243
+ [5] Edoardo Amaldi and Viggo Kann. The complexity and approximability of finding maximum feasible subsystems of linear relations. Theoretical computer science, 147(1-2):181–210, 1995.
244
+ [6] Frank J Anscombe. Rejection of outliers. Technometrics, 2(2):123–146, 1960. [7] Ainesh Bakshi and Pravesh Kothari. List-decodable subspace recovery via sum-of-squares. arXiv preprint arXiv:2002.05139, 2020.
245
+ [8] S. Balakrishnan, S. S. Du, J. Li, and A. Singh. Computationally efficient robust sparse estimation in high dimensions. In Proceedings of the 30th Conference on Learning Theory, COLT 2017, pages 169–212, 2017.
246
+ [9] Amos Beimel, Shay Moran, Kobbi Nissim, and Uri Stemmer. Private center points and learning of halfspaces. arXiv preprint arXiv:1902.10731, 2019.
247
+ [10] K. Bhatia, P. Jain, P. Kamalaruban, and P. Kar. Consistent robust regression. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, pages 2107–2116, 2017.
248
+ [11] Kush Bhatia, Prateek Jain, and Purushottam Kar. Robust regression via hard thresholding. In Advances in Neural Information Processing Systems, pages 721–729, 2015.
249
+ [12] Sourav Biswas, Yihe Dong, Gautam Kamath, and Jonathan Ullman. Coinpress: Practical private mean and covariance estimation. arXiv preprint arXiv:2006.06618, 2020.
250
+ [13] Avrim Blum, Cynthia Dwork, Frank McSherry, and Kobbi Nissim. Practical privacy: the sulq framework. In Proceedings of the twenty-fourth ACM SIGMOD-SIGACT-SIGART symposium on Principles of database systems, pages 128–138, 2005.
251
+ [14] Mark Bun, Gautam Kamath, Thomas Steinke, and Steven Z Wu. Private hypothesis selection. In Advances in Neural Information Processing Systems, pages 156–167, 2019.
252
+ [15] T Tony Cai, Yichen Wang, and Linjun Zhang. The cost of privacy: Optimal rates of convergence for parameter estimation with differential privacy. arXiv preprint arXiv:1902.04495, 2019.
253
+ [16] Clément L Canonne, Gautam Kamath, Audra McMillan, Jonathan Ullman, and Lydia Zakynthinou. Private identity testing for high-dimensional distributions. arXiv preprint arXiv:1905.11947, 2019.
254
+ [17] Moses Charikar, Jacob Steinhardt, and Gregory Valiant. Learning from untrusted data. In Proceedings of the 49th Annual ACM SIGACT Symposium on Theory of Computing, pages 47–60, 2017.
255
+ [18] Kamalika Chaudhuri, Anand D Sarwate, and Kaushik Sinha. A near-optimal algorithm for differentially-private principal components. The Journal of Machine Learning Research, 14(1):2905–2943, 2013.
256
+ [19] Xinyun Chen, Chang Liu, Bo Li, Kimberly Lu, and Dawn Song. Targeted backdoor attacks on deep learning systems using data poisoning. arXiv preprint arXiv:1712.05526, 2017.
257
+ [20] Yu Cheng, Ilias Diakonikolas, and Rong Ge. High-dimensional robust mean estimation in nearly-linear time. In Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 2755–2771. SIAM, 2019.
258
+ [21] Yu Cheng, Ilias Diakonikolas, Rong Ge, and David P Woodruff. Faster algorithms for highdimensional robust covariance estimation. In Conference on Learning Theory, pages 727–757. PMLR, 2019.
259
+ [22] Yeshwanth Cherapanamjeri, Sidhanth Mohanty, and Morris Yau. List decodable mean estimation in nearly linear time. arXiv preprint arXiv:2005.09796, 2020.
260
+ [23] Arnak Dalalyan and Philip Thompson. Outlier-robust estimation of a sparse linear model using $\ell _ { 1 }$ -penalized huber’s $m$ -estimator. In Advances in Neural Information Processing Systems, pages 13188–13198, 2019.
261
+ [24] Jules Depersin and Guillaume Lecué. Robust subgaussian estimation of a mean vector in nearly linear time. arXiv preprint arXiv:1906.03058, 2019.
262
+ [25] Luc Devroye and Gábor Lugosi. Combinatorial methods in density estimation. Springer Science & Business Media, 2012.
263
+
264
+ [26] Aditya Dhar and Jason Huang. Designing differentially private estimators in high dimensions. arXiv preprint arXiv:2006.01944, 2020.
265
+
266
+ [27] Ilias Diakonikolas, Samuel B Hopkins, Daniel Kane, and Sushrut Karmalkar. Robustly learning any clusterable mixture of gaussians. arXiv preprint arXiv:2005.06417, 2020.
267
+
268
+ [28] Ilias Diakonikolas, Gautam Kamath, Daniel Kane, Jerry Li, Ankur Moitra, and Alistair Stewart. Robust estimators in high-dimensions without the computational intractability. SIAM Journal on Computing, 48(2):742–864, 2019.
269
+
270
+ [29] Ilias Diakonikolas, Gautam Kamath, Daniel Kane, Jerry Li, Jacob Steinhardt, and Alistair Stewart. Sever: A robust meta-algorithm for stochastic optimization. In International Conference on Machine Learning, pages 1596–1606, 2019.
271
+
272
+ [30] Ilias Diakonikolas, Gautam Kamath, Daniel M. Kane, Jerry Li, Ankur Moitra, and Alistair Stewart. Being Robust (in High Dimensions) Can Be Practical. arXiv e-prints, page arXiv:1703.00893, March 2017.
273
+
274
+ [31] Ilias Diakonikolas, Gautam Kamath, Daniel M Kane, Jerry Li, Ankur Moitra, and Alistair Stewart. Robustly learning a gaussian: Getting optimal error, efficiently. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 2683–2702. SIAM, 2018.
275
+
276
+ [32] Ilias Diakonikolas and Daniel M Kane. Recent advances in algorithmic high-dimensional robust statistics. arXiv preprint arXiv:1911.05911, 2019.
277
+
278
+ [33] Ilias Diakonikolas, Daniel M Kane, and Alistair Stewart. Statistical query lower bounds for robust estimation of high-dimensional gaussians and gaussian mixtures. In 2017 IEEE 58th Annual Symposium on Foundations of Computer Science (FOCS), pages 73–84. IEEE, 2017.
279
+
280
+ [34] Ilias Diakonikolas, Daniel M Kane, and Alistair Stewart. List-decodable robust mean estimation and learning mixtures of spherical gaussians. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, pages 1047–1060, 2018.
281
+
282
+ [35] Ilias Diakonikolas, Weihao Kong, and Alistair Stewart. Efficient algorithms and lower bounds for robust linear regression. In Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 2745–2754. SIAM, 2019.
283
+
284
+ [36] Yihe Dong, Samuel Hopkins, and Jerry Li. Quantum entropy scoring for fast robust mean estimation and improved outlier detection. In Advances in Neural Information Processing Systems, pages 6067–6077, 2019.
285
+
286
+ [37] Cynthia Dwork, Frank McSherry, Kobbi Nissim, and Adam Smith. Calibrating noise to sensitivity in private data analysis. In Theory of cryptography conference, pages 265–284. Springer, 2006.
287
+
288
+ [38] Cynthia Dwork and Aaron Roth. The algorithmic foundations of differential privacy. Foundations and Trends in Theoretical Computer Science, 9(3-4):211–407, 2014.
289
+
290
+ [39] Cynthia Dwork, Kunal Talwar, Abhradeep Thakurta, and Li Zhang. Analyze gauss: optimal bounds for privacy-preserving principal component analysis. In Proceedings of the forty-sixth annual ACM symposium on Theory of computing, pages 11–20, 2014.
291
+
292
+ [40] Úlfar Erlingsson, Vasyl Pihur, and Aleksandra Korolova. Rappor: Randomized aggregatable privacy-preserving ordinal response. In Proceedings of the 2014 ACM SIGSAC conference on computer and communications security, pages 1054–1067, 2014.
293
+
294
+ [41] Giulia Fanti, Vasyl Pihur, and Úlfar Erlingsson. Building a rappor with the unknown: Privacypreserving learning of associations and data dictionaries. Proceedings on Privacy Enhancing Technologies, 2016(3):41–61, 2016.
295
+
296
+ [42] Chao Gao et al. Robust regression via mutivariate regression depth. Bernoulli, 26(2):1139–1170, 2020.
297
+
298
+ [43] Sam Hopkins, Jerry Li, and Fred Zhang. Robust and heavy-tailed mean estimation made simple, via regret minimization. Advances in Neural Information Processing Systems, 33, 2020.
299
+
300
+ [44] Samuel B Hopkins. Mean estimation with sub-gaussian rates in polynomial time. Annals of Statistics, 48(2):1193–1213, 2020.
301
+ [45] Samuel B Hopkins and Jerry Li. Mixture models, robustness, and sum of squares proofs. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, pages 1021–1034, 2018.
302
+ [46] Samuel B Hopkins and Jerry Li. How hard is robust mean estimation? In Conference on Learning Theory, pages 1649–1682. PMLR, 2019.
303
+ [47] Peter J. Huber. Robust Estimation of a Location Parameter. The Annals of Mathematical Statistics, 35(1):73 – 101, 1964.
304
+ [48] Arun Jambulapati, Jerry Li, and Kevin Tian. Robust sub-gaussian principal component analysis and width-independent schatten packing. Advances in Neural Information Processing Systems, 33, 2020.
305
+ [49] He Jia and Santosh Vempala. Robustly clustering a mixture of gaussians. arXiv preprint arXiv:1911.11838, 2019.
306
+ [50] Peter Kairouz, H Brendan McMahan, Brendan Avent, Aurélien Bellet, Mehdi Bennis, Arjun Nitin Bhagoji, Keith Bonawitz, Zachary Charles, Graham Cormode, Rachel Cummings, et al. Advances and open problems in federated learning. arXiv preprint arXiv:1912.04977, 2019.
307
+ [51] Peter Kairouz, Sewoong Oh, and Pramod Viswanath. The composition theorem for differential privacy. In International conference on machine learning, pages 1376–1385, 2015.
308
+ [52] Gautam Kamath, Jerry Li, Vikrant Singhal, and Jonathan Ullman. Privately learning highdimensional distributions. In Conference on Learning Theory, pages 1853–1902, 2019.
309
+ [53] Gautam Kamath, Or Sheffet, Vikrant Singhal, and Jonathan Ullman. Differentially private algorithms for learning mixtures of separated gaussians. In 2020 Information Theory and Applications Workshop (ITA), pages 1–62. IEEE, 2020.
310
+ [54] Gautam Kamath, Vikrant Singhal, and Jonathan Ullman. Private mean estimation of heavy-tailed distributions. arXiv preprint arXiv:2002.09464, 2020.
311
+ [55] Haim Kaplan, Katrina Ligett, Yishay Mansour, Moni Naor, and Uri Stemmer. Privately learning thresholds: Closing the exponential gap. In Conference on Learning Theory, pages 2263–2285. PMLR, 2020.
312
+ [56] Sushrut Karmalkar, Adam Klivans, and Pravesh Kothari. List-decodable linear regression. In Advances in Neural Information Processing Systems, pages 7423–7432, 2019.
313
+ [57] Sushrut Karmalkar and Eric Price. Compressed sensing with adversarial sparse noise via l1 regression. In 2nd Symposium on Simplicity in Algorithms, 2019.
314
+ [58] Vishesh Karwa and Salil Vadhan. Finite sample differentially private confidence intervals. arXiv preprint arXiv:1711.03908, 2017.
315
+ [59] Adam Klivans, Pravesh K Kothari, and Raghu Meka. Efficient algorithms for outlier-robust regression. In Conference On Learning Theory, pages 1420–1430, 2018.
316
+ [60] Weihao Kong, Raghav Somani, Sham Kakade, and Sewoong Oh. Robust meta-learning for mixed linear regression with small batches. Advances in Neural Information Processing Systems, 33, 2020.
317
+ [61] Pravesh K Kothari, Jacob Steinhardt, and David Steurer. Robust moment estimation and improved clustering via sum of squares. In Proceedings of the 50th Annual ACM SIGACT Symposium on Theory of Computing, pages 1035–1046, 2018.
318
+ [62] Kevin A Lai, Anup B Rao, and Santosh Vempala. Agnostic estimation of mean and covariance. In 2016 IEEE 57th Annual Symposium on Foundations of Computer Science (FOCS), pages 665–674. IEEE, 2016.
319
+ [63] Jerry Li. CSE 599-M, Lecture Notes: Robustness in Machine Learning , 2019. URL: https: //jerryzli.github.io/robust-ml-fall19/lec7.pdf.
320
+ [64] Jerry Li and Guanghao Ye. Robust gaussian covariance estimation in nearly-matrix multiplication time. Advances in Neural Information Processing Systems, 33, 2020.
321
+ [65] Liu Liu, Yanyao Shen, Tianyang Li, and Constantine Caramanis. High dimensional robust sparse regression. arXiv preprint arXiv:1805.11643, 2018.
322
+ [66] Xiaohui Liu. Fast implementation of the tukey depth. Computational Statistics, 32(4):1395– 1410, 2017.
323
+ [67] Xiaohui Liu, Karl Mosler, and Pavlo Mozharovskyi. Fast computation of tukey trimmed regions and median in dimension p> 2. Journal of Computational and Graphical Statistics, 28(3):682–697, 2019.
324
+ [68] Gábor Lugosi, Shahar Mendelson, et al. Sub-gaussian estimators of the mean of a random vector. Annals of Statistics, 47(2):783–794, 2019.
325
+ [69] Frank McSherry and Kunal Talwar. Mechanism design via differential privacy. In 48th Annual IEEE Symposium on Foundations of Computer Science (FOCS’07), pages 94–103. IEEE, 2007.
326
+ [70] Bhaskar Mukhoty, Govind Gopakumar, Prateek Jain, and Purushottam Kar. Globally-convergent iteratively reweighted least squares for robust regression problems. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 313–322, 2019.
327
+ [71] A. Prasad, A. S. Suggala, S. Balakrishnan, and P. Ravikumar. Robust estimation via robust gradient estimation. arXiv preprint arXiv:1802.06485, 2018.
328
+ [72] Prasad Raghavendra and Morris Yau. List decodable learning via sum of squares. In Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms, pages 161–180. SIAM, 2020.
329
+ [73] Jacob Steinhardt, Moses Charikar, and Gregory Valiant. Resilience: A criterion for learning in the presence of arbitrary outliers. In 9th Innovations in Theoretical Computer Science Conference (ITCS 2018). Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik, 2018.
330
+ [74] Jun Tang, Aleksandra Korolova, Xiaolong Bai, Xueqiang Wang, and Xiaofeng Wang. Privacy loss in apple’s implementation of differential privacy on macos 10.12. arXiv preprint arXiv:1709.02753, 2017.
331
+ [75] Terence Tao. Topics in random matrix theory, volume 132. American Mathematical Soc., 2012.
332
+ [76] John W Tukey. A survey of sampling from contaminated distributions. Contributions to probability and statistics, pages 448–485, 1960.
333
+ [77] Martin J Wainwright. High-dimensional statistics: A non-asymptotic viewpoint, volume 48. Cambridge University Press, 2019.
334
+ [78] Lu Wei, Anand D Sarwate, Jukka Corander, Alfred Hero, and Vahid Tarokh. Analysis of a privacy-preserving pca algorithm using random matrix theory. In 2016 IEEE Global Conference on Signal and Information Processing (GlobalSIP), pages 1335–1339. IEEE, 2016.
335
+ [79] Huang Xiao, Battista Biggio, Gavin Brown, Giorgio Fumera, Claudia Eckert, and Fabio Roli. Is feature selection secure against training data poisoning? In International Conference on Machine Learning, pages 1689–1698. PMLR, 2015.
336
+ [80] Huanyu Zhang, Gautam Kamath, Janardhan Kulkarni, and Zhiwei Steven Wu. Privately learning markov random fields. arXiv preprint arXiv:2002.09463, 2020.
md/train/Drynvt7gg4L/Drynvt7gg4L.md ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ADASPEECH: ADAPTIVE TEXT TO SPEECH FOR CUSTOM VOICE
2
+
3
+ Mingjian Chen∗, Xu Tan∗, Bohan Li, Yanqing Liu, Tao Qin, Sheng Zhao, Tie-Yan Liu
4
+ Microsoft Research Asia, Microsoft Azure Speech
5
+ {xuta,taoqin,szhao,tyliu}@microsoft.com
6
+
7
+ # ABSTRACT
8
+
9
+ Custom voice, a specific text to speech (TTS) service in commercial speech platforms, aims to adapt a source TTS model to synthesize personal voice for a target speaker using few speech from her/him. Custom voice presents two unique challenges for TTS adaptation: 1) to support diverse customers, the adaptation model needs to handle diverse acoustic conditions which could be very different from source speech data, and 2) to support a large number of customers, the adaptation parameters need to be small enough for each target speaker to reduce memory usage while maintaining high voice quality. In this work, we propose AdaSpeech, an adaptive TTS system for high-quality and efficient customization of new voices. We design several techniques in AdaSpeech to address the two challenges in custom voice: 1) To handle different acoustic conditions, we model the acoustic information in both utterance and phoneme level. Specifically, we use one acoustic encoder to extract an utterance-level vector and another one to extract a sequence of phoneme-level vectors from the target speech during pre-training and fine-tuning; in inference, we extract the utterance-level vector from a reference speech and use an acoustic predictor to predict the phonemelevel vectors. 2) To better trade off the adaptation parameters and voice quality, we introduce conditional layer normalization in the mel-spectrogram decoder of AdaSpeech, and fine-tune this part in addition to speaker embedding for adaptation. We pre-train the source TTS model on LibriTTS datasets and fine-tune it on VCTK and LJSpeech datasets (with different acoustic conditions from LibriTTS) with few adaptation data, e.g., 20 sentences, about 1 minute speech. Experiment results show that AdaSpeech achieves much better adaptation quality than baseline methods, with only about 5K specific parameters for each speaker, which demonstrates its effectiveness for custom voice. The audio samples are available at https://speechresearch.github.io/adaspeech/.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Text to speech (TTS) aims to synthesize natural and intelligible voice from text, and attracts a lot of interests in machine learning community (Arik et al., 2017; Wang et al., 2017; Gibiansky et al., 2017; Ping et al., 2018; Shen et al., 2018; Ren et al., 2019). TTS models can synthesize natural human voice when training with a large amount of high-quality and single-speaker recordings (Ito, 2017), and has been extended to multi-speaker scenarios (Gibiansky et al., 2017; Ping et al., 2018; Zen et al., 2019; Chen et al., 2020) using multi-speaker corpora (Panayotov et al., 2015; Veaux et al., 2016; Zen et al., 2019). However, these corpora contain a fixed set of speakers where each speaker still has a certain amount of speech data.
14
+
15
+ Nowadays, custom voice has attracted increasing interests in different application scenarios such as personal assistant, news broadcast and audio navigation, and has been widely supported in commercial speech platforms (some custom voice services include Microsoft Azure, Amazon AWS and Google Cloud). In custom voice, a source TTS model is usually adapted on personalized voices with few adaptation data, since the users of custom voice prefer to record as few adaptation data as possible (several minutes or seconds) for convenient purpose. Few adaptation data presents great challenges on the naturalness and similarity of adapted voice. Furthermore, there are also several distinctive challenges in custom voice: 1) The recordings of the custom users are usually of different acoustic conditions from the source speech data (the data to train the source TTS model). For example, the adaptation data is usually recorded with diverse speaking prosodies, styles, emotions, accents and recording environments. The mismatch in these acoustic conditions makes the source model difficult to generalize and leads to poor adaptation quality. 2) When adapting the source TTS model to a new voice, there is a trade-off between the fine-tuning parameters and voice quality. Generally speaking, more adaptation parameters will usually result in better voice quality, which, as a result, increases the memory storage and serving cost1.
16
+
17
+ While previous works in TTS adaptation have well considered the few adaptation data setting in custom voice, they have not fully addressed the above challenges. They fine-tune the whole model (Chen et al., 2018; Kons et al., 2019) or decoder part (Moss et al., 2020; Zhang et al., 2020), achieving good quality but causing too many adaptation parameters. Reducing the amount of adaptation parameters is necessary for the deployment of commercialized custom voice. Otherwise, the memory storage would explode as the increase of users. Some works only fine-tune the speaker embedding (Arik et al., 2018; Chen et al., 2018), or train a speaker encoder module (Arik et al., 2018; Jia et al., 2018; Cooper et al., 2020; Li et al., 2017; Wan et al., 2018) that does not need fine-tuning during adaptation. While these approaches lead a light-weight and efficient adaptation, they result in poor adaptation quality. Moreover, most previous works assume the source speech data and adaptation data are in the same domain and do not consider the setting with different acoustic conditions, which is not practical in custom voice scenarios.
18
+
19
+ In this paper, we propose AdaSpeech, an adaptive TTS model for high-quality and efficient customization of new voice. AdaSpeech employ a three-stage pipeline for custom voice: 1) pre-training; 2) fine-tuning; 3) inference. During the pre-training stage, the TTS model is trained on large-scale multi-speaker datasets, which can ensure the TTS model to cover diverse text and speaking voices that is helpful for adaptation. During the fine-tuning stage, the source TTS model is adapted on a new voice by fine-tuning (a part of) the model parameters on the limited adaptation data with diverse acoustic conditions. During the inference stage, both the unadapted part (parameters shared by all custom voices) and the adapted part (each custom voice has specific adapted parameters) of the TTS model are used for the inference request. We build AdaSpeech based on the popular non-autoregressive TTS models (Ren et al., 2019; Peng et al., 2020; Kim et al., 2020; Ren et al., 2021) and further design several techniques to address the challenges in custom voice:
20
+
21
+ • Acoustic condition modeling. In order to handle different acoustic conditions for adaptation, we model the acoustic conditions in both utterance and phoneme level in pre-training and fine-tuning. Specifically, we use two acoustic encoders to extract an utterance-level vector and a sequence of phoneme-level vectors from the target speech, which are taken as the input of the mel-spectrogram decoder to represent the global and local acoustic conditions respectively. In this way, the decoder can predict speech in different acoustic conditions based on these acoustic information. Otherwise, the model would memorize the acoustic conditions and cannot generalize well. In inference, we extract the utterance-level vector from a reference speech and use another acoustic predictor that is built upon the phoneme encoder to predict the phoneme-level vectors.
22
+
23
+ • Conditional layer normalization. To fine-tune as small amount of parameters as possible while ensuring the adaptation quality, we modify the layer normalization (Ba et al., 2016) in the melspectrogram decoder in pre-training, by using speaker embedding as the conditional information to generate the scale and bias vector in layer normalization. In fine-tuning, we only adapt the parameters related to the conditional layer normalization. In this way, we can greatly reduce adaptation parameters and thus memory storage2 compared with fine-tuning the whole model, but maintain high-quality adaptation voice thanks to the flexibility of conditional layer normalization.
24
+
25
+ To evaluate the effectiveness of our proposed AdaSpeech for custom voice, we conduct experiments to train the TTS model on LibriTTS datasets and adapt the model on VCTK and LJSpeech datasets with different adaptation settings. Experiment results show that AdaSpeech achieves better adaptation quality in terms of MOS (mean opinion score) and SMOS (similarity MOS) than baseline methods, with
26
+
27
+ only about 5K specific parameters for each speaker, demonstrating its effectiveness for custom voice.
28
+ Audio samples are available at https://speechresearch.github.io/adaspeech/.
29
+
30
+ # 2 ADASPEECH
31
+
32
+ In this section, we first describe the overall design of our proposed AdaSpeech, and then introduce the key techniques to address the challenges in custom voice. At last, we list the pre-training, finetuning and inference pipeline of AdaSpeech for custom voice.
33
+
34
+ The model structure of AdaSpeech is shown in Figure 1. We adopt FastSpeech 2 (Ren et al., 2021) as the model backbone considering the FastSpeech (Ren et al., 2019; 2021) series are one of the most popular models in non-autoregressive TTS. The basic model backbone consists of a phoneme encoder, a mel-spectrogram decoder, and a variance adaptor which provides variance information including duration, pitch and energy into the phoneme hidden sequence following Ren et al. (2021). As shown in Figure 1, we design two additional components to address the distinctive challenges in custom voice: 1) to support diverse customers, we use acoustic condition modeling to capture the diverse acoustic conditions of adaptation speech in different granularities; 2) to support a large number of customers with affordable memory storage, we use conditional layer normalization in decoder for efficient adaptation with few parameters while high voice quality. In the next subsections, we introduce the details of these components respectively.
35
+
36
+ # 2.1 ACOUSTIC CONDITION MODELING
37
+
38
+ In custom voice, the adaptation data can be spoken with diverse prosodies, styles, accents, and can be recorded under various environments, which can make the acoustic conditions far different from that in source speech data. This presents great challenges to adapt the source TTS model, since the source speech cannot cover all the acoustic conditions in custom voice. A practical way to alleviate this issue is to improve the adaptability (generalizability) of source TTS model. In text to speech, since the input text lacks enough acoustic conditions (such as speaker timbre, prosody and recording environments) to predict the target speech, the model tends to memorize and overfit on the training data (Ren et al., 2021), and has poor generalization during adaptation. A natural way to solve such problem is to provide corresponding acoustic conditions as input to make the model learn reasonable text-to-speech mapping towards better generalization instead of memorizing.
39
+
40
+ ![](images/b16230a0b3471c9cf7166d42bf87e2d4d83fb2c8fad20fc0c5c9c58c2c644de2.jpg)
41
+ Figure 1: AdaSpeech.
42
+
43
+ To better model the acoustic conditions with different granularities, we categorize the acoustic conditions in different levels as shown in Figure 2a: 1) speaker level, the coarse-grained acoustic conditions to capture the overall characteristics of a speaker; 2) utterance level, the fine-grained acoustic conditions in each utterance of a speaker; 3) phoneme level, the more fine-grained acoustic conditions in each phoneme of an utterance, such as accents on specific phonemes, pitches, prosodies and temporal environment noises3. Since speaker ID (embedding) is widely used to capture speakerlevel acoustic conditions in multi-speaker scenario (Chen et al., 2020), speaker embedding is used by default. We describe the utterance-level and phoneme-level acoustic condition modeling as follows.
44
+
45
+ • Utterance Level. We use an acoustic encoder to extract a vector from a reference speech, similar to Arik et al. (2018); Jia et al. (2018); Cooper et al. (2020), and then expand and add it to the phoneme hidden sequence to provide the utterance-level acoustic conditions. As shown in Figure 2b, the acoustic encoder consists of several convolutional layers and a mean pooling layer to get a single vector. The reference speech is the target speech during training, while a randomly chosen speech of this speaker during inference.
46
+
47
+ • Phoneme Level. We use another acoustic encoder (shown in Figure 2c) to extract a sequence of phoneme-level vectors from the target speech and add it to the phoneme hidden sequence to provide the phoneme-level acoustic conditions4. In order to extract phoneme-level information from speech, we first average the speech frames corresponding to the same phoneme according to alignment between phoneme and mel-spectrogram sequence (shown in Figure 2a), to convert to length of speech frame sequence into the length of phoneme sequence, similar to Sun et al. (2020); Zeng et al. (2020). During inference, we use another phoneme-level acoustic predictor (shown in Figure 2d) which is built upon the original phoneme encoder to predict the phoneme-level vectors.
48
+
49
+ ![](images/1b8115e8378ff3f0bce5e8c218cc53e46a1027bcc95a6b54cc7689458e994c80.jpg)
50
+ Figure 2: (a) The overall structure of acoustic condition modeling. (b) Utterance-level acoustic encoder. (c) Phoneme-level acoustic encoder, where phoneme-level mel means the mel-frames aligned to the same phoneme are averaged. (d) Phoneme-level acoustic predictor, where phoneme hiddens is the hidden sequence from the phoneme encoder in Figure 1. ‘Conv1D $( m , n ) $ means the kernel size and stride size in 1D convolution is $m$ and $n$ respectively. ‘LN’ means layer normalization. As shown in Figure 2a, the phoneme-level vectors are directly added element-wisely into the hidden sequence, and the utterance-level and speaker level vector/embedding are first expanded to the same length and then added element-wisely into the hidden sequence.
51
+
52
+ Using speech encoders to extract a single vector or a sequence of vectors to represent the characteristics of a speech sequence has been adopted in previous works (Arik et al., 2018; Jia et al., 2018; Cooper et al., 2020; Sun et al., 2020; Zeng et al., 2020). They usually leverage them to improve the speaker timbre or prosody of the TTS model, or improve the controllability of the model. The key contribution in our acoustic condition modeling in this work is the novel perspective to model the diverse acoustic conditions in different granularities to make the source model more adaptable to different adaptation data. As analyzed in Section 4.2, utterance-level and phoneme-level acoustic modeling can indeed help the learning of acoustic conditions and is critical to ensure the adaptation quality.
53
+
54
+ # 2.2 CONDITIONAL LAYER NORMALIZATION
55
+
56
+ Achieving high adaptation quality while using small adaptation parameters is challenging. Previous works use zero-shot adaptation with speaker encoder (Arik et al., 2018; Jia et al., 2018; Cooper et al., 2020) or only fine-tune the speaker embedding cannot achieve satisfied quality. Can we greatly increase the voice quality at the cost of slightly more but negligible parameters? To this end, we analyze the model parameters of FastSpeech 2 (Ren et al., 2021), which is basically built upon the structure of Transformer (Vaswani et al., 2017), with a self-attention network and a feed-forward network in each Transformer block. Both the matrix multiplications in the query, key, value and output of self-attention and two-layer feed-forward networks are parameter-intensive, which is not efficient to adapt. We find that layer normalization (Ba et al., 2016) is adopted in each self-attention and feed-forward network in decoder, which can greatly influence the hidden activation and final prediction with a light-weight learnable scale vector $\gamma$ and bias vector $\beta$ : $\begin{array} { r } { L N ( x ) = \gamma \frac { x - \mu } { \sigma } + \beta } \end{array}$ , where $\mu$ and $\sigma$ are the mean and variance of hidden vector $x$ .
57
+
58
+ ![](images/a66e8ffc76fa99ca95e58f3c7f706be919dbfefddd07a11631defff56ae26599.jpg)
59
+ Figure 3: Conditional LayerNorm.
60
+
61
+ If we can determine the scale and bias vector in layer normalization with the corresponding speaker characteristics using a small conditional network, then we can fine-tune this conditional network when adapting to a new voice, and greatly reduce the adaptation parameters while ensuring the adaptation quality. As shown in Figure 3, the conditional network consists of two simple linear layers $W _ { c } ^ { \gamma }$ and $\hat W _ { c } ^ { \beta }$ that take speaker embedding $E ^ { s }$ as input and output the scale and bias vector respectively:
62
+
63
+ $$
64
+ \gamma _ { c } ^ { s } = E ^ { s } * W _ { c } ^ { \gamma } , \beta _ { c } ^ { s } = E ^ { s } * W _ { c } ^ { \beta } ,
65
+ $$
66
+
67
+ where $s$ denotes the speaker ID, and $c \in [ C ]$ denotes there are $C$ conditional layer normalizations in the decoder (the number of decoder layer is $( C - 1 ) / 2$ since each layer has two conditional layer normalizations corresponding to self-attention and feed-forward network in Transformer, and there is an additional layer normalization at the final output) and each uses different conditional matrices.
68
+
69
+ # 2.3 PIPELINE OF ADASPEECH
70
+
71
+ We list the pre-training, fine-tuning and inference pipeline of AdaSpeech in Algorithm 1. During fine-tuning, we only fine-tune the two matrices $W _ { c } ^ { \gamma }$ and $W _ { c } ^ { \beta }$ in each conditional layer normalization in decoder and the speaker embedding $E ^ { s }$ , fixing other model parameters including the utterance-level and phoneme-level acoustic encoders and phoneme-level acoustic predictor as described in Section 2.1. During inference, we do not directly use the two matrices $W _ { c } ^ { \gamma }$ and $W _ { c } ^ { \beta }$ in each conditional layer normalization since they still have large parameters. Instead we use the two matrices to calculate each scale and bias vector $\gamma _ { c } ^ { s }$ and $\beta _ { c } ^ { s }$ from speaker embedding $E _ { s }$ according to Equation 1 considering $E _ { s }$ is fixed in inference. In this way, we can save a lot of memory storage5.
72
+
73
+ Algorithm 1 Pre-training, fine-tuning and inference of AdaSpeech
74
+
75
+ 1: Pre-training: Train the AdaSpeech model $\theta$ with source training data $D$ .
76
+ 2: Fine-tuning: Fine-tune $W _ { c } ^ { \gamma }$ and $W _ { c } ^ { \beta }$ in each conditional layer normalization $c \in [ C ]$ and speaker embedding $E ^ { s }$ with the adaptation data $D ^ { s }$ for each custom speaker/voice $s$ .
77
+ 3: Inference: Deployment: 1) Calculate $\gamma _ { c , } ^ { s } \beta _ { c } ^ { s }$ in each conditional layer normalization $c \in [ C ]$ , and get the parameters $\theta ^ { s } = \{ \{ \gamma _ { c } ^ { s } , \beta _ { c } ^ { s } \} _ { c = 1 } ^ { C } , E ^ { s } \}$ for speaker $s$ . 2) Deploy the shared model parameters $\tilde { \theta }$ (not fine-tuned in $\theta$ during adaptation) and speaker specific parameters $\theta ^ { s }$ for $s$ . Inference: Use $\tilde { \theta }$ and $\theta ^ { s }$ to synthesize custom voice for speaker $s$ .
78
+
79
+ # 3 EXPERIMENTAL SETUP
80
+
81
+ Datasets We train the AdaSpeech source model on LibriTTS (Zen et al., 2019) dataset, which is a multi-speaker corpus (2456 speakers) derived from LibriSpeech (Panayotov et al., 2015) and contains 586 hours speech data. In order to evaluate AdaSpeech in custom voice scenario, we adapt the source model to the voices in other datasets including VCTK (Veaux et al., 2016) (a multi-speaker datasets with 108 speakers and 44 hours speech data) and LJSpeech (Ito, 2017) (a single-speaker high-quality dataset with 24 hours speech data), which have different acoustic conditions from LibriTTS. As a comparison, we also adapt the source model to the voices in the same LibriTTS dataset.
82
+
83
+ We randomly choose several speakers (including both male and female) from the training set of LibriTTS and VCTK and the only single speaker from the training set of LJSpeech for adaptation. For each chosen speaker, we randomly choose $K = 2 0$ sentences for adaptation and also study the effects of smaller $K$ in experiment part. We use all the speakers in the training set of LibriTTS (exclude those chosen for adaptation) to train the source AdaSpeech model, and use the original test sets in these datasets corresponding to the adaptation speakers to evaluate the adaptation voice quality.
84
+
85
+ We conduct the following preprocessing on the speech and text data in these corpora: 1) convert the sampling rate of all speech data to 16kHz; 2) extract the mel-spectrogram with $1 2 . 5 \mathrm { m s }$ hop size and $5 0 \mathrm { m s }$ window size following the common practice in Shen et al. (2018); Ren et al. (2019); 3) convert text sequence into phoneme sequence with grapheme-to-phoneme conversion (Sun et al., 2019) and take phoneme as the encoder input.
86
+
87
+ Model Configurations The model of AdaSpeech follows the basic structure in FastSpeech 2 (Ren et al., 2021), which consists of 4 feed-forward Transformer blocks for the phoneme encoder and melspectrogram decoder. The hidden dimension (including the phoneme embedding, speaker embedding, the hidden in self-attention, and the input and output hidden of feed-forward network) is set to 256. The number of attention heads, the feed-forward filter size and kernel size are set to 2, 1024 and 9 respectively. The output linear layer converts the 256-dimensional hidden into 80-dimensional mel-spectrogram. Other model configurations follow Ren et al. (2021) unless otherwise stated.
88
+
89
+ The phoneme-level acoustic encoder (Figure 2c) and predictor (Figure 2d) share the same structure, which consists of 2 convolutional layers with filter size and kernel size of 256 and 3 respectively, and a linear layer to compress the hidden to a dimension of 4 (we choose the dimension of 4 according to our preliminary study and is also consistent with previous works (Sun et al., 2020; Zeng et al., 2020)). We use MFA (McAuliffe et al., 2017) to extract the alignment between the phoneme and mel-spectrogram sequence, which is used to prepare the input of the phoneme-level acoustic encoder. We also tried to leverage VQ-VAE (Sun et al., 2020) into the phoneme-level acoustic encoder but found no obvious gains. The utterance-level acoustic encoder consists of 2 convolutional layers with filter size, kernel size and stride size of 256, 5 and 3, and a pooling layer to obtain a single vector.
90
+
91
+ Training, Adaptation and Inference In the source model training process, we first train AdaSpeech for 60,000 steps, and all the model parameters are optimized except the parameters of phoneme-level acoustic predictor. Then we train AdaSpeech and the phoneme-level acoustic predictor jointly for the remaining 40,000 steps, where the output hidden of the phoneme-level acoustic encoder is used as the label (the gradient is stopped to prevent flowing back to the phoneme-level acoustic encoder) to train the phoneme-level acoustic predictor with mean square error (MSE) loss. We train AdaSpeech on 4 NVIDIA P40 GPUs and each GPU has a batch size of about 12,500 speech frames. Adam optimizer is used with $\beta _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 8$ , $\epsilon = 1 0 ^ { - 9 }$ .
92
+
93
+ In the adaptation process, we fine-tune AdaSpeech on 1 NVIDIA P40 GPU for 2000 steps, where only the parameters of speaker embedding and conditional layer-normalization are optimized. In the inference process, the utterance-level acoustic conditions are extracted from another reference speech of the speaker, and the phoneme-level acoustic conditions are predicted from phoneme-level acoustic predictor. We use MelGAN (Kumar et al., 2019) as the vocoder to synthesize waveform from the generated mel-spectrogram.
94
+
95
+ # 4 RESULTS
96
+
97
+ In this section, we first evaluate the quality of the adaptation voices of AdaSpeech, and conduct ablation study to verify the effectiveness of each component in AdaSpeech, and finally we show some analyses of our method.
98
+
99
+ # 4.1 THE QUALITY OF ADAPTATION VOICE
100
+
101
+ We evaluate the quality of adaption voices in terms of naturalness (how the synthesized voices sound natural like human) and similarity (how the synthesized voices sound similar to this speaker). Therefore, we conduct human evaluations with MOS (mean opinion score) for naturalness and SMOS (similarity MOS) for similarity. Each sentence is listened by 20 judgers. For VCTK and LibriTTS, we average the MOS and SMOS scores of multiple adapted speakers as the final scores. We compare AdaSpeech with several settings: 1) GT, the ground-truth recordings; 2) GT mel $^ +$ Vocoder, using ground-truth mel-spectrogram to synthesize waveform with MelGAN vocoder; 3) Baseline (spk emb), a baseline system based on FastSpeech2 which only fine-tunes the speaker embedding during adaptation, and can be regarded as our lower bound; 4) Baseline (decoder), another baseline system based on FastSpeech2 which fine-tunes the whole decoder during adaptation, and can be regarded as a strong comparable system since it uses more parameters during adaptation; 5) AdaSpeech, our proposed AdaSpeech system with utterance-/phoneme-level acoustic condition modeling and conditional layer normalization during adaptation6.
102
+
103
+ Table 1: The MOS and SMOS scores with $9 5 \%$ confidence intervals when adapting the source AdaSpeech model (trained on LibriTTS) to LJSpeech, VCTK and LibriTTS datasets. The third column shows the number of additional parameters for each custom voice during adaptation (the number in bracket shows the number of parameters in inference following the practice in Section 2.3).
104
+
105
+ <table><tr><td>Metric</td><td>Setting</td><td>|#Params/Speaker</td><td>LJSpeech</td><td>VCTK</td><td>LibriTTS</td></tr><tr><td rowspan="5">MOS</td><td>GT</td><td>/</td><td>3.98±0.12</td><td>3.87± 0.11</td><td>3.72 ± 0.12</td></tr><tr><td>GT mel + Vocoder</td><td>/</td><td>3.75 ±0.10</td><td>3.74 ±0.11</td><td>3.65 ± 0.12</td></tr><tr><td>Baseline (spk emb) Baseline (decoder)</td><td>256 (256) 14.1M (14.1M)</td><td>2.37 ± 0.14</td><td>2.36 ±0.10</td><td>3.02±0.13</td></tr><tr><td></td><td></td><td>3.44 ± 0.13</td><td>3.35 ± 0.12</td><td>3.51 ±0.11</td></tr><tr><td>AdaSpeech</td><td>1.2M (4.9K)</td><td>3.45 ± 0.11</td><td>3.39 ±0.10</td><td>3.55± 0.12</td></tr><tr><td rowspan="5">SMOS</td><td>GT</td><td>/</td><td>4.36 ± 0.11</td><td>4.44 ± 0.10</td><td>4.31 ± 0.07</td></tr><tr><td>GT mel + Vocoder</td><td>/</td><td>4.29 ± 0.11</td><td>4.36 ± 0.11</td><td>4.31± 0.07</td></tr><tr><td>Baseline (spk emb)</td><td>256 (256)</td><td>2.79 ± 0.19</td><td>3.34± 0.19</td><td>4.00 ± 0.12</td></tr><tr><td>Baseline (decoder)</td><td>14.1M (14.1M)</td><td>3.57± 0.12</td><td>3.90± 0.12</td><td>4.10 ±0.10</td></tr><tr><td> AdaSpeech</td><td>1.2M (4.9K)</td><td>3.59 ± 0.15</td><td>3.96± 0.15</td><td>4.13± 0.09</td></tr></table>
106
+
107
+ The MOS and SMOS results are shown in Table 1. We have several observations: 1) Adapting the model (trained on LibriTTS) to the cross-domain datasets (LJSpeech and VCTK) is more difficult than adapting to the in-domain datasets (LibriTTS), since the MOS and SMOS gap between the adaptation models (two baselines and AdaSpeech) and the ground-truth mel $^ +$ vocoder setting is bigger on cross-domain datasets7. This also confirms the challenges of modeling different acoustic conditions in custom voice scenarios. 2) Compared with only fine-tuning speaker embedding, i.e., Baseline (spk emb), AdaSpeech achieves significant improvements in terms of both MOS and SMOS in the three adaptation datasets, by only leveraging slightly more parameters in conditional layer normalization. We also analyze in next subsection (Table 3) that even if we increase the adaptation parameters of baseline to match or surpass that in AdaSpeech, it still performs much worse than AdaSpeech. 3) Compared with fine-tuning the whole decoder, i.e., Baseline (decoder), AdaSpeech achieves slightly better quality in both MOS and SMOS and importantly with much smaller adaptation parameters, which demonstrates the effectiveness and efficiency of our proposed acoustic condition modeling and conditional layer normalization. Note that fine-tuning the whole decoder causes too much adaptation parameters that cannot satisfy the custom voice scenario.
108
+
109
+ # 4.2 METHOD ANALYSIS
110
+
111
+ In this section, we first conduct ablation studies to verify the effectiveness of each component in AdaSpeech, including utterance-level and phonemelevel acoustic condition modeling, and conditional layer normalization, and then conduct more detailed analyses on our proposed AdaSpeech.
112
+
113
+ Table 2: The CMOS of the ablation study on VCTK. UL-ACM and PL-ACM represents utterance-level and phoneme-level acoustic condition modeling, and CLN represents conditional layer normalization.
114
+
115
+ <table><tr><td>Setting</td><td>CMOS</td></tr><tr><td>AdaSpeech</td><td>0</td></tr><tr><td>AdaSpeech w/o UL-ACM AdaSpeech w/o PL-ACM AdaSpeech w/o CLN</td><td>-0.12 -0.21 -0.14</td></tr></table>
116
+
117
+ Ablation Study We compare the CMOS (comparison MOS) of the adaptation voice quality when removing each component in AdaSpeech on VCTK testset (each sentence is listened by 20 judgers). Specifically, when removing conditional layer normalization, we only fine-tune the speaker embedding. From Table 2, we can see that removing utterance-level and phoneme-level acoustic modeling, and conditional layer normalization all result in performance drop in voice quality, demonstrating the effectiveness of each component in AdaSpeech.
118
+
119
+ Analyses on Acoustic Condition Modeling We analyze the vectors extracted from the utterancelevel acoustic encoder for several speakers on LibriTTS datasets. We use t-SNE (Maaten & Hinton,
120
+
121
+ ![](images/20d44f231397740e61ebc70e686f9e8cb055d74084454170043752107ac8df7c.jpg)
122
+ Figure 4: (a) The visualization of utterance-level acoustic vectors for several speakers (each number in the legend represents a speaker ID in LibriTTS datasets). (b) The MOS of different adaptation data on LJSpeech and VCTK.
123
+
124
+ 2008) to illustrate them in Figure 4a, where each point represents an utterance-level vector and each color belongs to the same speaker. It can be seen that different utterances of the same speaker are clustered together but have difference in acoustic conditions. There are some exceptions, such as the two pink points one blue point in the brown solid circle. According to our investigation on the corresponding speech data, these points correspond to the utterances with short and emotional voice, and thus are close to each other although belonging to different speakers.
125
+
126
+ Analyses on Conditional Layer Normalization We further compare conditional layer normalization (CLN) with other two settings: 1) $\mathrm { L N } +$ fine-tune scale/bias: removing the condition on speaker embedding, and only fine-tuning scale/bias in layer normalization and speaker embedding; 2) $\mathrm { ~ L N ~ } +$ fine-tuning others: removing the condition on speaker embedding, and instead fine-tuning other (similar or even larger amount of) parameters in the decoder8. The CMOS evaluations are shown in Table 3. It can be seen that both settings result in worse quality compared with conditional layer normalization, which verifies its effectiveness.
127
+
128
+ <table><tr><td>Setting CMOS</td></tr><tr><td>CLN 0</td></tr><tr><td>LN + fine-tune scale/bias -0.18</td></tr><tr><td>LN + fine-tune others -0.24</td></tr></table>
129
+
130
+ Table 3: The CMOS on VCTK for the comparison of conditional layer normalization.
131
+
132
+ Varying Adaptation Data We study the voice quality with different amount of adaptation data (fewer than the default setting) on VCTK and LJSpeech, and conduct MOS evaluation as shown in Figure 4b. It can be seen that the voice quality continue drops when adaptation data decreases, and drops quickly when the adaptation data is fewer than 10 sentences.
133
+
134
+ # 5 CONCLUSIONS
135
+
136
+ In this paper, we have developed AdaSpeech, an adaptive TTS system to support the distinctive requirements in custom voice. We propose acoustic condition modeling to make the source TTS model more adaptable for custom voice with various acoustic conditions. We further design conditional layer normalization to improve the adaptation efficiency: fine-tuning few model parameters to achieve high voice quality. We finally present the pipeline of pre-training, fine-tuning and inference in AdaSpeech for custom voice. Experiment results demonstrate that AdaSpeech can support custom voice with different acoustic conditions with few memory storage and at the same time with high voice quality. For future work, we will further improve the modeling of acoustic conditions in the source TTS model and study more diverse acoustic conditions such as noisy speech in custom voice. We will also investigate the adaptation setting with untranscribed data (Yan et al., 2021) and further compress the model size (Luo et al., 2021) to support more custom voices.
137
+
138
+ # REFERENCES
139
+
140
+ Sercan Arik, Jitong Chen, Kainan Peng, Wei Ping, and Yanqi Zhou. Neural voice cloning with a few samples. In Advances in Neural Information Processing Systems, pp. 10019–10029, 2018.
141
+
142
+ Sercan O Arik, Mike Chrzanowski, Adam Coates, Gregory Diamos, Andrew Gibiansky, Yongguo Kang, Xian Li, John Miller, Andrew $\mathrm { N g }$ , Jonathan Raiman, et al. Deep voice: Real-time neural text-to-speech. arXiv preprint arXiv:1702.07825, 2017.
143
+
144
+ Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
145
+
146
+ Mingjian Chen, Xu Tan, Yi Ren, Jin Xu, Hao Sun, Sheng Zhao, and Tao Qin. Multispeech: Multispeaker text to speech with transformer. Proc. Interspeech 2020, pp. 4024–4028, 2020.
147
+
148
+ Yutian Chen, Yannis Assael, Brendan Shillingford, David Budden, Scott Reed, Heiga Zen, Quan Wang, Luis C Cobo, Andrew Trask, Ben Laurie, et al. Sample efficient adaptive text-to-speech. arXiv preprint arXiv:1809.10460, 2018.
149
+
150
+ Erica Cooper, Cheng-I Lai, Yusuke Yasuda, Fuming Fang, Xin Wang, Nanxin Chen, and Junichi Yamagishi. Zero-shot multi-speaker text-to-speech with state-of-the-art neural speaker embeddings. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6184–6188. IEEE, 2020.
151
+
152
+ 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.
153
+
154
+ Keith Ito. The lj speech dataset. https://keithito.com/LJ-Speech-Dataset/, 2017.
155
+
156
+ Ye Jia, Yu Zhang, Ron Weiss, Quan Wang, Jonathan Shen, Fei Ren, Patrick Nguyen, Ruoming Pang, Ignacio Lopez Moreno, Yonghui Wu, et al. Transfer learning from speaker verification to multispeaker text-to-speech synthesis. In Advances in neural information processing systems, pp. 4480–4490, 2018.
157
+
158
+ Jaehyeon Kim, Sungwon Kim, Jungil Kong, and Sungroh Yoon. Glow-tts: A generative flow for text-to-speech via monotonic alignment search. arXiv preprint arXiv:2005.11129, 2020.
159
+
160
+ Zvi Kons, Slava Shechtman, Alex Sorin, Carmel Rabinovitz, and Ron Hoory. High quality, lightweight and adaptable tts using lpcnet. arXiv preprint arXiv:1905.00590, 2019.
161
+
162
+ Kundan Kumar, Rithesh Kumar, Thibault de Boissiere, Lucas Gestin, Wei Zhen Teoh, Jose Sotelo, Alexandre de Brébisson, Yoshua Bengio, and Aaron C Courville. Melgan: Generative adversarial networks for conditional waveform synthesis. In Advances in Neural Information Processing Systems, pp. 14910–14921, 2019.
163
+
164
+ Chao Li, Xiaokong Ma, Bing Jiang, Xiangang Li, Xuewei Zhang, Xiao Liu, Ying Cao, Ajay Kannan, and Zhenyao Zhu. Deep speaker: an end-to-end neural speaker embedding system. arXiv preprint arXiv:1705.02304, 2017.
165
+
166
+ Renqian Luo, Xu Tan, Rui Wang, Tao Qin, Jinzhu Li, Sheng Zhao, Enhong Chen, and Tie-Yan Liu. Lightspeech: Lightweight and fast text to speech with neural architecture search. In 2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2021.
167
+
168
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(Nov):2579–2605, 2008.
169
+
170
+ Michael McAuliffe, Michaela Socolof, Sarah Mihuc, Michael Wagner, and Morgan Sonderegger. Montreal forced aligner: Trainable text-speech alignment using kaldi. In Interspeech, pp. 498–502, 2017.
171
+
172
+ Henry B Moss, Vatsal Aggarwal, Nishant Prateek, Javier González, and Roberto Barra-Chicote. Boffin tts: Few-shot speaker adaptation by bayesian optimization. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 7639–7643. IEEE, 2020.
173
+
174
+ Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. Librispeech: an asr corpus based on public domain audio books. In 2015 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5206–5210. IEEE, 2015.
175
+
176
+ Kainan Peng, Wei Ping, Zhao Song, and Kexin Zhao. Non-autoregressive neural text-to-speech. ICML, 2020.
177
+
178
+ 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 International Conference on Learning Representations, 2018.
179
+
180
+ 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 NeurIPS, 2019.
181
+
182
+ Yi Ren, Chenxu Hu, Xu Tan, Tao Qin, Sheng Zhao, Zhou Zhao, and Tie-Yan Liu. Fastspeech 2: Fast and high-quality end-to-end text-to-speech. In ICLR, 2021.
183
+
184
+ Jonathan Shen, Ruoming Pang, Ron J Weiss, Mike Schuster, Navdeep Jaitly, Zongheng Yang, Zhifeng Chen, Yu Zhang, Yuxuan Wang, Rj Skerrv-Ryan, et al. Natural tts synthesis by conditioning wavenet on mel spectrogram predictions. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4779–4783. IEEE, 2018.
185
+
186
+ Guangzhi Sun, Yu Zhang, Ron J Weiss, Yuan Cao, Heiga Zen, Andrew Rosenberg, Bhuvana Ramabhadran, and Yonghui Wu. Generating diverse and natural text-to-speech samples using a quantized fine-grained vae and autoregressive prosody prior. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 6699–6703. IEEE, 2020.
187
+
188
+ Hao Sun, Xu Tan, Jun-Wei Gan, Hongzhi Liu, Sheng Zhao, Tao Qin, and Tie-Yan Liu. Token-level ensemble distillation for grapheme-to-phoneme conversion. In INTERSPEECH, 2019.
189
+
190
+ 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.
191
+
192
+ Christophe Veaux, Junichi Yamagishi, Kirsten MacDonald, et al. Superseded-cstr vctk corpus: English multi-speaker corpus for cstr voice cloning toolkit. 2016.
193
+
194
+ Li Wan, Quan Wang, Alan Papir, and Ignacio Lopez Moreno. Generalized end-to-end loss for speaker verification. In 2018 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 4879–4883. IEEE, 2018.
195
+
196
+ 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 preprint arXiv:1703.10135, 2017.
197
+
198
+ Yuzi Yan, Xu Tan, Bohan Li, Tao Qin, Sheng Zhao, Yuan Shen, and Tie-Yan Liu. Adaspeech 2: Adaptive text to speech with untranscribed data. In 2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2021.
199
+
200
+ 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. arXiv preprint arXiv:1904.02882, 2019.
201
+
202
+ Zhen Zeng, Jianzong Wang, Ning Cheng, and Jing Xiao. Prosody learning mechanism for speech synthesis system without text length limit. arXiv preprint arXiv:2008.05656, 2020.
203
+
204
+ Chen Zhang, Yi Ren, Xu Tan, Jinglin Liu, Kejun Zhang, Tao Qin, Sheng Zhao, and Tie-Yan Liu. Denoispeech: Denoising text to speech with frame-level noise modeling. In 2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2021.
205
+
206
+ 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.
md/train/HJGv1Z-AW/HJGv1Z-AW.md ADDED
@@ -0,0 +1,263 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # EMERGENCE OF LINGUISTIC COMMUNICATION FROM REFERENTIAL GAMES WITH SYMBOLIC AND PIXEL INPUT
2
+
3
+ Angeliki Lazaridou∗, Karl Moritz Hermann, Karl Tuyls, Stephen Clark
4
+ DeepMind,
5
+ London, UK
6
+
7
+ # ABSTRACT
8
+
9
+ The ability of algorithms to evolve or learn (compositional) communication protocols has traditionally been studied in the language evolution literature through the use of emergent communication tasks. Here we scale up this research by using contemporary deep learning methods and by training reinforcement-learning neural network agents on referential communication games. We extend previous work, in which agents were trained in symbolic environments, by developing agents which are able to learn from raw pixel data, a more challenging and realistic input representation. We find that the degree of structure found in the input data affects the nature of the emerged protocols, and thereby corroborate the hypothesis that structured compositional language is most likely to emerge when agents perceive the world as being structured.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ The study of emergent communication is important for two related problems in language development, both human and artificial: language evolution, the development of communication protocols from scratch (Nowak & Krakauer, 1999); and language acquisition, the ability of an embodied agent to learn an existing language. In this paper we focus on the problem of how environmental or pre-linguistic conditions affect the nature of the communication protocol that an agent learns. The increasing realism and complexity of environments being used for grounded language learning (Brockman et al., 2016; Hermann et al., 2017) present an opportunity to analyse these effects in detail.
14
+
15
+ In line with previous work on emergent communication, we are strongly motivated by the view that language derives meaning from its use (Wittgenstein, 1953; Wagner et al., 2003). This perspective especially motivates the study of language emergence in cases where co-operative agents try to achieve shared goals in game scenarios (Steels, 2003; Brighton & Kirby, 2006; Mordatch & Abbeel, 2017), and is related to the study of multi-agent and self-play methods that have found great success in other areas of machine learning (Bansal et al., 2017; Silver et al., 2017). Here we focus on simple referential games, in which one agent must communicate to another a target object in the agent’s environment.
16
+
17
+ One of the most important properties of natural language is compositionality. Smaller building blocks (e.g. words, morphemes) are used to generate unbounded numbers of more complex forms (e.g. sentences, multi-word expressions), with the meaning of the larger form being determined by the meanings of its parts and how they are put together (Frege, 1892). Compositionality is an advantage in any communication protocol as it allows in principle infinite expression through a finite dictionary and a finite set of combination rules. In emergent communication research, previous work has shown that agents can produce (somewhat) compositional protocols when engaging in language games (Steels, 2003). However, the computational agents were typically situated in artificial worlds containing just a handful of objects, represented as disentangled, structured, and sometimes even atomic symbols, e.g. attribute-based or one-hot vectors (Batali, 1998; Brighton, 2002; Franke, 2015; Andreas & Klein, 2017; Mordatch & Abbeel, 2017). However, humans receive raw sensorimotor rather than symbolic input, and little work to date has tested whether these findings carry over when agents are situated in less idealized worlds that bear more similarity to the kind of entangled and noisy environments to which humans are typically exposed.1
18
+
19
+ ![](images/aea3a2fceb920cffdae0270c243ac52b72776e4d05ae8e6a4c4b0000f5f4d17a.jpg)
20
+ Figure 1: High-level overview of the referential game.
21
+
22
+ In this work, in the context of referential communication games (see Figure 1), we contrast the results of two studies that lie at the extremes of how much structure is provided by the environment. The first study (Section 3) focuses on symbolic representations, where objects are represented as bags-of-attributes; this representation is inherently disentangled since dimensions encode individual properties. The second study (Section 4) considers raw perceptual input, hence data that more closely resembles what humans are exposed to. Clearly, the latter is a more challenging and realistic scenario as the computational agents are operating on entangled inputs with no pre-coded semantics. Crucially, both studies use the same referential game setup, the same learning procedure (policy learning methods) and the same neural network agent architectures.
23
+
24
+ We show that reinforcement learning agents can successfully communicate, not only when presented with symbolic and highly structured input data, but (and more importantly) even when presented with raw pixel input. This result opens up the possibility of more realistic simulations of language emergence. We successfully use the learning signal from the referential game to train agents end-to-end, including cases where the agents need to perform visual processing of images with a convolutional neural network. However, we find that the agents struggle to produce structured messages when presented with entangled input data (Bengio et al., 2013) due to the difficulty of uncovering the true factors of variation, corroborating the hypothesis of Smith et al. (2003) that structured (compositional) language is most likely to emerge when agents perceive the world as structured.
25
+
26
+ # 2 REFERENTIAL GAMES AS MULTI-AGENT CO-OPERATIVEREINFORCEMENT LEARNING
27
+
28
+ The referential game is implemented as an instance of multi-agent co-operative reinforcement learning, in which two agents take discrete actions in their environment in order to maximize a shared reward.
29
+
30
+ # 2.1 GAME AND TERMINOLOGY
31
+
32
+ The referential game is a variant of the Lewis signaling game (Lewis, 1969), which has been extensively used in linguistic and cognitive studies in the context of language evolution (e.g., Briscoe, 2002; Cangelosi & Parisi, 2002; Steels & Loetzsch, 2012; Spike et al., 2016; Lazaridou et al., 2017).
33
+
34
+ Figure 1 provides a schematic description of our setup. First, a speaker is presented with a target object (highlighted as CAR in the symbolic example on the left, and highlighted as the far right image in the pixel example on the right). Then, by making use of an alphabet consisting of primitive discrete symbols $( ^ { \ast \cdot } 2 2 ^ { \cdot \prime } , ^ { \cdot \cdot } 1 0 ^ { \cdot \prime } , ^ { \cdot \cdot } 0 ^ { \cdot \prime } , ^ { \cdot \cdot } 2 ^ { \cdot \prime } )$ , the speaker constructs a message describing that object (“22 $2 0 ^ { \circ } )$ . We will refer to the set of all distinct messages generated by the speaker as their lexicon or protocol. Finally, the listener is presented with the target and a set of distractor objects, and—by making use of the speaker’s message—has to identify the target object from the set of candidate objects. Communicative success is defined as the correct identification of the target by the listening agent.
35
+
36
+ Formally, the attribute-based object vectors (disentangled) or the pixel-based images (entangled) are the set of pre-linguistic items $W = \{ o _ { 1 } , \ldots , o _ { N } \}$ . From this set we draw a target $t \in W$ and subsequently $K - 1$ distractors $D = \{ d _ { 1 } , \dots , d _ { K - 1 } \} \subset W$ s.t. ∀j $t \neq d _ { j }$ . The speaker has only access to the target $t$ , while the listener receives candidate set $C = t \cup D$ , not knowing which of the elements in $C$ is target $t$ .
37
+
38
+ # 2.2 AGENTS
39
+
40
+ The speaker encodes $t$ into a dense representation $u$ using an encoder $f ^ { S } ( t , \theta _ { f } ^ { S } )$ . The function of this encoder depends on the type of pre-linguistic data used and is discussed separately for each study. Given an alphabet $A$ of discrete unit symbols (akin to words) and $u$ , the speaker next generates a discrete, variable-length, bounded message m by sampling symbols from a recurrent policy $\pi ^ { S }$ defined by a decoder $\check { g } ^ { S } ( u , \theta _ { g } ^ { S } )$ . The sequence generation is terminated either by the production of a stop symbol or when the maximum length $L$ has been reached. We implement the decoder as a single-layer LSTM (Hochreiter $\&$ Schmidhuber, 1997). Note that the symbols in the agents’ alphabet $A$ have no a priori meaning; rather, these symbols get grounded during the game.
41
+
42
+ The listening agent uses a similar encoder to the speaker but has independent network weights $( \theta _ { f } ^ { L } )$ . Applying this encoder to all candidate objects results in a set $U = \{ f ^ { L } ( c , \theta _ { f } ^ { L } ) \mid c \in C \}$ . For encoding the message $\mathbf { m }$ , we use a single-layer LSTM, denoted $h ^ { L }$ , which produces an encoding $z$ : $z = h ^ { L } ( \mathbf { \bar { m } } , \theta _ { h } ^ { L } )$ .
43
+
44
+ Given encoded message $z$ and candidates $U$ , the listener predicts a target object $t ^ { \prime } \in C$ following a policy $\pi ^ { L }$ implemented using a non-parametric pointing module; this module samples the predicted object from a Gibbs distribution computed via the dot product between vector $z$ and all encoded candidates $u \in U$ . See Appendix B for information regarding the agents’ architecture.
45
+
46
+ At inference time, we replace the stochastic sampling of the speaker’s message and the listener’s stochastic pointing module with deterministic processes. For the pointing module, the object with the highest probability is chosen. For the speaker’s message, this is generated in a greedy fashion by selecting the highest-probability symbol at each step.
47
+
48
+ # 2.3 LEARNING
49
+
50
+ All weights of the speaker and listener agents, $\theta = \{ \theta _ { f } ^ { S } , \theta _ { g } ^ { S } , \theta _ { f } ^ { L } , \theta _ { h } ^ { L } \}$ , are jointly optimized while playing the game. We emphasize that no weights are shared between the speaker and the listener, and the only supervision used is communicative success, i.e. whether the listener identified the correct target. The objective function that the two agents maximize for one training instance is:
51
+
52
+ $$
53
+ R ( t ^ { \prime } ) \left( \sum _ { l = 1 } ^ { L } \log p ( m _ { t } ^ { l } | m _ { t } ^ { < l } , u ) + \log p ( u _ { t ^ { \prime } } | z , U ) \right)
54
+ $$
55
+
56
+ where $R$ is the reward function returning 1 if $t = t ^ { \prime }$ (if the listener pointed to the correct target) and 0 otherwise. To maintain exploration in the speaker’s policy $\pi ^ { S }$ of generating a message, and the listener’s policy $\pi ^ { L }$ of pointing to the target, we add to the loss an entropy regularization term (Mnih et al., 2016). The parameters are estimated using the REINFORCE update rule (Williams, 1992). See Appendix $\mathbf { B }$ for more details regarding the learning.
57
+
58
+ <table><tr><td>max length</td><td>alphabet size</td><td>lexicon size</td><td>training accuracy</td><td>topographic p</td></tr><tr><td>2</td><td>10</td><td>31</td><td>92.0%</td><td>0.13</td></tr><tr><td>5</td><td>17</td><td>293</td><td>98.2%</td><td>0.16</td></tr><tr><td>10</td><td>40</td><td>355</td><td>98.5%</td><td>0.26</td></tr></table>
59
+
60
+ Table 1: Commumicative success (training accuracy in percentage) with varying maximum message length. alphabet size denotes the effective size of the symbol set used from a maximum of 100. lexicon size is the effective number of unique messages used. topographic $\rho$ reports the structural similarity in terms of Spearman $\rho$ correlation between the message and the object vector space. All Spearman $\rho$ correlations throughout the paper are significant with $p < 0 . 0 1$ .
61
+
62
+ # 3 STUDY 1: REFERENTIAL GAME WITH SYMBOLIC DATA
63
+
64
+ We first present experiments where agents are learning to communicate when presented with structured and disentangled input. We use the Visual Attributes for Concepts Dataset (VisA) of Silberer et al. (2013), which contains human-generated per-concept attribute annotations for 500 concrete concepts (e.g., cat, sofa, car) spanning across different categories (e.g., mammals, furniture, vehicles), annotated with 636 general attributes (e.g., has tail, is black, has wheels). We disregarded homonym concepts (e.g., bat), thus reducing our working set of concepts to 463 and the number of attributes to 573 (after eliminating any attribute that did not occur with the working concepts). On average, each concept has 11 attributes. All pre-linguistic objects are represented in terms of binary vectors $o \in \{ 0 , 1 \} ^ { 5 7 3 }$ . Note that these representations do carry some inherent structure; the dimensions in the object vectors are disentangled and so each object can be seen as a conjunction of properties. Speaker and listener convert the pre-linguistic representations to dense representations $u$ by using a single-layer MLP with a sigmoid activation function.
65
+
66
+ In all experiments, we set the number of candidate objects $K$ to five, meaning there were four wrong choices per correct one (resulting in a $2 0 \%$ random baseline). Inspired by Kottur et al. (2017), who show that non-compositional language emerges in the case of overcomplete alphabets, we set the size of alphabet $A$ to 100 symbols, which is smaller than the size of the set of objects (463).
67
+
68
+ # 3.1 AGENT PERFORMANCE AND AMBIGUITY
69
+
70
+ We first report model performance on the training data, comparing different settings for the maximal allowed message length (2, 5 or 10 symbols). Results are presented in Table 1 (ignore the last row topographic $\rho$ which will be explained in later sections).
71
+
72
+ In the case of the shortest message settings (maximum length 2), our trained agents on average only develop a protocol of 31 unique messages used to describe 363 training concepts (leaving aside 100 for testing). This indicates high levels of ambiguity, with each message being used to denote 11 concepts on average. Interestingly, recent findings suggest that ambiguity is a design feature of language that prevents the inefficient use of redundant codes, since some of the message content can be extracted from context: “the most efficient communication system will not convey information already provided by the context” (Piantadosi et al., 2012). In our case, we do no explicitly encode any bias towards ambiguity. We hypothesize that ambiguity arises due to the difficult exploration problem that agents are faced with, in combination with the fact that ambiguous protocols present a good local optimum that is over-represented in the hypothesis search space. As a result, in the absence of environmental pressures (e.g., a high number of carefully constructed distractors) a suboptimal policy can still achieve a reasonably high accuracy $( 9 2 \% )$ , making it even harder during training to escape from such a solution.
73
+
74
+ In classic signaling games, this polysemy phenomenon manifests itself as different states receiving the same signal and is termed partial pooling equilibrium (Skyrms, 2010). Perhaps rather counterintuitively, Skyrms (p.131) suggests that a way to obtain communication protocols that are robust to this type of local communication minima is to allow the invention of new signals, essentially increasing the search space of signals. Motivated by this suggestion, we play variants of the game in which we allow the agents to produce messages of greater maximum length (5 and 10), which leads to improved communicative success $9 8 . 2 \%$ and $9 8 . 5 \%$ respectively). We observe that the number of messages in the protocol increases from 31 to 293 and 355, respectively, reducing the average number of concepts a message can denote from 11 concepts to (approximately) 1 concept.
75
+
76
+ ![](images/f54b6c616adb9b6e25c20297338305d82c03c1c6cbacf39ded5809edadfd7eb1.jpg)
77
+ Figure 2: Training curves of different experimental setups with uniform and context-dependent target selection.
78
+
79
+ # 3.2 REALISTIC CONTEXT DISTRIBUTION
80
+
81
+ In the real world, when speakers refer to cats, listeners would likely be in a situation where they had to discriminate a cat in the context of a couch or a dog, rather than in the context of a mirror or a cow.2 Simply put, objects in the world do not appear in random contexts, but rather there is regularity in the distribution of situational and visual co-occurrences. This property of the world is typically not captured in referential games studied in the language emergence literature, with distractors usually drawn from a uniform distribution.
82
+
83
+ We address this issue and design an additional experiment with distractors sampled from a targetspecific context distribution reflecting normalized object co-occurrence statistics. Co-occurrence data is extracted from the MSCOCO caption dataset (Lin et al., 2014). This leads to more plausible distractor sets with, for instance, the target goat more likely being mixed with sheep and cow as distractors rather than bike or eggplant.
84
+
85
+ We find that the distractor selection process (uniform vs context-dependent) affects the language learning dynamics; see Figure 2 for training curves for different experimental configurations. While the non-uniform distractor sampling of the context-dependent setting can be exploited to learn a degenerate strategy —giving up to $40 \%$ communicative success shortly after the start of training— subsequently learning under this scenario takes longer. This effect is likely a combination of the local minimum achieved by the degenerate strategy of picking a target at random from only the topically relevant set of distractors, which initially makes the problem easier; however, the fact that the co-occurrence statistics tend to align with the feature vectors, means that similar objects are more likely to appear as distractors and hence the overall game becomes more difficult.
86
+
87
+ We now consider the question of how objects denoted by the same (ambiguous) message are related. When the context is drawn uniformly, object similarity is a predictor of object confusability, as similar objects tend to be mapped onto the same message (0.26 and 0.43 median pairwise cosine similarities of objects that received the same message as computed on the VisA space, for maximum message length 2 and 5, respectively). In the non-uniform case, we observe object confusability to be less influenced by object similarity (0.15 and 0.17 median pairwise cosine similarities of objects that received the same message, for maximum message length 2 and 5, respectively), but rather driven by the visual context co-occurrences. Simply put, in the non-uniform case confusability is less influenced by similarity since the agents must learn to distinguish between objects that naturally co-occur (e.g. sheep and goat). Thus, the choice of distractors, an experimental design decision that in existing language emergence literature has been neglected, has an effect on the organization (and potentially the naturalness) of the emerged language, for example as reflected in the semantics of ambiguous or homonym words in the language.
88
+
89
+ Table 2: Communicative success (acc in percentage) of agents evaluated on training (first row) and novel (last three rows) data. lexicon size column reports the percentage of novel messages (i.e., messages that were not used during the training).
90
+
91
+ <table><tr><td>Data</td><td>length 2 lexicon size</td><td>acc.</td><td>length 5 lexicon size</td><td>acc.</td><td>length 10 lexicon size</td><td>acc.</td></tr><tr><td>training data</td><td>31</td><td>92.0</td><td>293</td><td>98.2</td><td>355</td><td>98.5</td></tr><tr><td>test data</td><td>1</td><td>74.2</td><td>70</td><td>76.8</td><td>98</td><td>81.6</td></tr><tr><td>unigram chimera</td><td>5</td><td>39.3</td><td>88</td><td>40.5</td><td>99</td><td>47.0</td></tr><tr><td>uniform chimera</td><td>3</td><td>31.2</td><td>87</td><td>32.2</td><td>100</td><td>42.6</td></tr></table>
92
+
93
+ # 3.3 STRUCTURAL PROPERTIES OF EMERGED PROTOCOLS
94
+
95
+ Quantifying the degree of compositionality and structure found in the emerged language is a challenging task; to the best of our knowledge, there is no formal mathematical definition of compositionality that would allow for a definitive quantitative measure. Thus, research on this topic usually relies on defining necessary requirements that any language claiming to be compositional should adhere to, such as the ability to generalize to novel situations (Batali, 1998; Franke, 2015; Kottur et al., 2017). We adopt a similar strategy by measuring the extent to which an emerged language is able to generalize to novel objects (Section 3.3.1). Moreover, we also report quantitative results (Section 3.3.2) using a measure of message structure proposed in the language evolution literature (Brighton & Kirby, 2006; Carr et al., 2017).
96
+
97
+ # 3.3.1 GENERALIZATION TO NOVEL OBJECTS
98
+
99
+ We perform experiments where trained agents from Section 3.1 are exposed to different types of unseen objects, each of them differing to the degree to which the unseen objects resemble the objects found in the training data. In the test scenario, objects come from the same data distribution as the training data, but were not presented to the agents during training (e.g., a mouse); in the unigram chimeras scenario, the novel objects are constructed by sampling properties from a property-based distribution inferred from the training data, thus breaking any feature correlation (e.g., a mouselike animal with wheels); in the uniform chimeras scenario, the novel objects are constructed by uniformly sampling properties (e.g., a square red furry metallic object).
100
+
101
+ Table 2 reports the communicative success. While there is a drop in performance for unseen objects, agents are performing above random chance $( 2 0 \% )$ . The emerged language is indeed able to generalize to unseen objects; however, the degree of generalization is a function of the similarity between the training and unseen objects, thus resulting in the uniform chimeras setting obtaining the lowest performance.
102
+
103
+ Moreover, we observe examples of productivity, a key feature of compositionality. At test time, speakers are able to concoct novel messages on-the-fly (i.e., messages that are not part of their lexicon induced during training) to describe unseen objects. See the last three rows of Table 2, and the lexicon size column, for the percentage of novel messages. Even though listeners were not trained to associate novel messages with novel objects, they are still able comprehend such messages and correctly identify the target object. In the test data and length 10 cases, novel messages account for almost all of the generated messages, but with performance at $8 1 . 6 \%$ , providing evidence of the structure found in the messages.
104
+
105
+ # 3.3.2 TOPOGRAPHIC SIMILARITY
106
+
107
+ Given a set of objects, their meanings and the associated signals, Brighton & Kirby (2006) define topographic similarity to be the correlation of the distances between all the possible pairs of meanings and the corresponding pairs of signals. Figure 3 shows mappings between states and signals for examples of holistic (b) and compositional (c,d) languages, with the topographic similarity of compositional languages being higher than that of holistic. The intuition behind this measure is that semantically similar objects should have similar messages.
108
+
109
+ ![](images/cd5d57f50366fee02fe1b3ce12b993334e48d59f130b088d0fbe530764268416.jpg)
110
+ Figure 3: left: Three languages with different properties, taken from Brighton & Kirby (2006). The mapping between states and signals shown in (b) is random; there is no relationship between points in the meaning and signal space. In (c) and (d), similar meanings map to similar signals, i.e., there is a topographic relation between meanings and signals. right: Relation between objects’ cosine similarity and their message Levenshtein distance for trained and random agents.
111
+
112
+ To compute this measure, we first compute two lists of numbers: (i) the Levenshtein distances between all pairs of objects’ messages; and (ii) the cosine similarity between all pairs of objects’ VisA vectors. Given these two lists, the topographic similarity is defined as their negative Spearman $\rho$ correlation (since we are correlating distances with similarities, negative values of correlation indicate topographic similarity of the two spaces). Intuitively, if similar objects share much of the message structure (e.g., common prefixes or suffixes), and dissimilar objects have little common structure in their respective messages, then the topographic similarity should be high, the highest possible value being 1.
113
+
114
+ Results presented back in Table 1, in the topographic $\rho$ column, show that topographic similarity is positive in all experimental setups, indicating that similar objects receive similar messages $( p < 0 . 0 1$ , permutation test). A qualitative analysis of the messages generated in the length 10 and training data cases showed that, for example, $32 \%$ of the mammal objects had as a message prefix the bigram $9 5 \# 1 0 ^ { \star }$ ; $36 \%$ of vehicle objects had $\cdot 6 8 \# 9 5 $ ; and $11 \%$ of tool objects had ‘0#61’, suggesting that these prefix bigrams encode category-specific information.
115
+
116
+ Next, for each object pair, we calculate their Levenshtein message distance and respective cosine similarity, and plot in Figure 3 (right), for each distance, the average cosine similarities of the pairs with that distance (this is done for the length 10 and training data experiment). We observe that there is a clear relation between message similarity and meaning similarity (as measured by overlap in the VisA properties). In Figure 3, we also plot a similar correlation curve for an emerged language obtained by producing messages with randomly initialized and untrained speaker/listener architectures. This emerged language is at random in terms of communicative success; however, the generated messages do show signs of structure, since similar objects obtain somewhat similar messages. This seems to suggest that structured and disentangled pre-linguistic representations are, perhaps, a sufficient condition for the emergence of structured language, especially in neural network-based agents which, due to the nature of representation and information flow, favor similar inputs to trigger similar outputs.
117
+
118
+ # 4 STUDY 2: REFERENTIAL GAME WITH RAW PIXEL DATA
119
+
120
+ In this section, we present experiments in which agents receive as input entangled data in the form of raw pixel input, and have to learn to perform visual conceptual processing guided by the communication-based reward.
121
+
122
+ We use a synthetic dataset of scenes consisting of geometric objects generated using the MuJoCo physics engine (Todorov et al., 2012). We generate RGB images of resolution $1 2 4 \times 1 2 4$ depicting single object scenes. For each object, we pick one of eight colors (blue, red, white, black, yellow, green, cyan, magenta) and five shapes (box, sphere, cylinder, capsule, ellipsoid) resulting in 40 combinations, for each of which we generate 100 variations, varying the floor color and the object location in the image. Moreover, we introduce different variants of the game: game A with 19 distractors; game B with 1 distractor; game C with 1 distractor, and with speaker and listener having different viewpoints of the target object (the target object on the listener’s side is in a different location); game D with 1 distractor, with speaker and listener having different viewpoints, and with balanced numbers of shapes and color (obtained by downsampling from 8 colors to 5 and removing any image containing objects of the 3 disregarded objects). For each game, we create train and test splits with proportions 75/25 (i.e., 3000/1000 for games A and B, and 1850/650 for games C and D).
123
+
124
+ Pre-linguistic objects are presented in the form of pixel input, $o \in [ 0 , 2 5 5 ] ^ { 3 \times 1 2 4 \times 1 2 4 }$ . Speaker and listener convert the images $o$ to dense representations $u$ , each of them using an 8-layer convolutional neural network (ConvNet). Crucially, we do not pre-train the ConvNets on an object classification task; the only learning signal is the communication-based reward. Despite this fact, we observe that the lower layers of the ConvNets are encoding similar information to a ConvNet pre-trained on ImageNet (Deng et al., 2009).3 Conceptually, we can think of the whole speaker/listener architecture as an encoder-decoder with a discrete bottleneck (the message). Given our initial positive findings, this reward-based learning signal induced from the communication game setup could be used for classagnostic large-scale ConvNet training. Moreover, we find that, even though no weights were shared, the agents’ conceptual spaces get aligned at different levels, reminiscent of theories of interactive conceptual alignment during dialogue (Garrod & Pickering, 2004) (see Appendix A for the related experiment).
125
+
126
+ # 4.1 COMMUNICATIVE SUCCESS AND EMERGENT PROTOCOLS
127
+
128
+ Unlike the experiments of Section 3, where agents start from disentangled representations, starting from raw perceptual input presents a greater challenge: the agents have to establish naming conventions about scenes, while at the same time learning to process the input with their own visual conceptual system. Since we do not pre-train their ConvNets on an object recognition task, the dense representations $u$ used to derive the message contain no bias towards any image- or scene-specific information (e.g, object color, shape or location). The extraction of visual properties is thus driven entirely by the communication game. This contrasts with the cases of Havrylov & Titov (2017) and Lazaridou et al. (2017) who use pre-trained visual vectors, and qualitatively observe that the induced communication protocols encode information about objects. Table 3 presents the results in terms of communicative train and test success (see Appendix C for additional experiments when having access to gold object attribute classifiers). Moreover, we also report the topographic similarity (column topographic $\rho \mathrm { \Sigma }$ ) between the symbolic attribute-based representations of scenes (floor color, object color, shape and location) and the generated messages.
129
+
130
+ Overall, despite the challenges posed in this setup due to the raw nature of the data, performance across all games is well above chance, indicating that reinforcement learning agents trained end-toend are able to establish a communication protocol in this grounded environment. In game A, the agents reach $9 3 . 7 \%$ accuracy, with their lexicon consisting of 1068 messages, describing 3000 training objects. Most importantly, as captured by the positive topographic similarity, agents produce messages that respect (even to a limited degree) the compositional nature of scenes (i.e., objects as bags-of-attributes), indicating that similar scenes receive similar messages. Indeed, by examining their protocol (see Table 4), we find that messages encode in a structurally consistent way information about absolute location of objects, with the message prefix and suffix denoting the horizontal and vertical co-ordinate, respectively. Interestingly, this communication strategy is also typically followed by human players of referential games (Kazemzadeh et al., 2014).
131
+
132
+ ![](images/1a48df6cd3a8b1c8b52b9ee8420e381abf4d505b03645f3a5586570289a52a63.jpg)
133
+ Figure 4: Target images and their associated messages from game A and game B.
134
+
135
+ Table 3: Communicative success of agents playing different games. Columns random, train and test report percentage accuracies. Column topographic $\rho$ reports the topographic similarity between the symbolic representation of scenes and the generated messages $( p < 0 . 0 1$ , permutation test).
136
+
137
+ <table><tr><td>game</td><td>distractors</td><td>balanced</td><td>viewpoints</td><td>lexicon size</td><td>random</td><td>train</td><td>test</td><td>topographic p</td></tr><tr><td>A</td><td>20</td><td>No</td><td>No</td><td>1068</td><td>5.0</td><td>93.7</td><td>93.6</td><td>0.13</td></tr><tr><td>B</td><td>2</td><td>No</td><td>No</td><td>13</td><td>50.0</td><td>93.2</td><td>93.4</td><td>0.006</td></tr><tr><td>C</td><td>2</td><td>No</td><td>Yes</td><td>8</td><td>50.0</td><td>86.0</td><td>85.7</td><td>0.07</td></tr><tr><td>D</td><td>2</td><td>Yes</td><td>Yes</td><td>5</td><td>50.0</td><td>90.4</td><td>89.9</td><td>0.06</td></tr></table>
138
+
139
+ However, we find the emerged protocols to be very unstable and too grounded in the specific game situation. Small modifications of the game setup, while having close to no negative impact on the communicative performance, can radically alter the form, semantics and interpretability of the communication protocol. In game B, performance remains at the same level $( 9 3 . 2 \% )$ as game A. However, we observe that the protocol consists of 13 unique messages which do not reflect the objects’ attributes (as indicated by the close to zero topographic similarity), thus making the messages harder to interpret (see Figure 4 for randomly sampled examples). When we change the viewpoint of the agents in game C, biasing them against communicating about absolute object location, the players derive a compact communication protocol consisting of 8 unique messages that describe primarily color. Finally, when color and shape are balanced, as in game $\mathbf { D }$ , we still observe a bias towards describing the color of objects, with the five induced messages providing a perfect clustering of the objects according to their colors.4
140
+
141
+ In an entangled world, agents do not possess a priori visual biases and knowledge of concepts. Since objects can be conceptualized in indefinitely many ways, the type of information encoded in the messages is tied to the environmental pressures; communication behaviour is a function of the environment, which also dictates what data structures can emerge. The implication of this observation is that protocols essentially overfit to the particular game situation, to the degree that they become specialized ad-hoc naming conventions.
142
+
143
+ Interestingly, the emergence of ad-hoc naming conventions has also been observed during humanhuman interaction: when participants engage in some specific game situation (e.g., communicating about abstract tangram shapes), they tend to form highly specialized naming conceptions (conceptual pacts) that allow them to communicate with maximum efficiency (Brennan & Clark, 1996). While in this study we do not address the issue of how a stable and general language could emerge in entangled worlds, we believe that to alleviate the formation of such ad-hoc communication protocols, it is essential to increase the complexity of the games as well as requiring transfer across a variety of games.
144
+
145
+ <table><tr><td>game (random baseline)</td><td>object position (20.0)</td><td>object shape (20.0)</td><td>object color (12.0)</td><td>floor color (33.0)</td></tr><tr><td>A</td><td>95.3</td><td>90.2</td><td>24.7</td><td>36.4</td></tr><tr><td>B</td><td>88.6</td><td>41.2</td><td>63.8</td><td>45.4</td></tr><tr><td>C</td><td>85.9</td><td>43.5</td><td>65.8</td><td>43.8</td></tr><tr><td>D</td><td>89.4</td><td>47.1</td><td>82.0</td><td>42.3</td></tr></table>
146
+
147
+ Table 4: Accuracy of probe linear classifiers of speaker’s induced visual representations (all accuracies are in percentage format).
148
+
149
+ # 4.2 PROBE MODELS
150
+
151
+ In order to investigate what information gets captured by the speaker’s ConvNet, we probe the inferred visual representations $u$ used to derive the message. Specifically, we design 4 probe classifiers for the color and shape of the object; object position which is derived by discretizing each co-ordinate into 3 bins; and floor color which is obtained by clustering the RGB color representation of the floor. For each probe, we performed 5-fold cross validation with a linear classifier, and report accuracy results in Table 4. Overall, different games result in visual representations with different predictive power; object position is almost always encoded in the speaker’s visual representation, even in situations where location of the object is not a good strategy for communication. On the other hand, object shape seems to provide less salient information, despite the fact that it is relevant for communication, at least in the C&D games.
152
+
153
+ As expected, the structure and semantics of the emergent protocols are a function of the information captured in the visual representations. The degree to which the agents are able to pull apart the objects’ factors of variation impacts their ability to communicate about those factors, with the most extreme case being game D, where the message ignores the shape entirely. Thus, disentanglement seems to be a necessary condition for communication, at least in the case of pixel input.
154
+
155
+ # 5 CONCLUSION
156
+
157
+ We presented a series of studies investigating the properties of protocols emerging when reinforcement learning agents are trained end-to-end on referential communication games. We found that when agents are presented with disentangled input data in the form of attribute vectors, this inherent compositional structure is successfully retained in the output. Moreover, we showed that communication can also be achieved in cases where agents are presented with raw pixel data, a type of input that aligns better with the raw sensorimotor data that humans are exposed to. At the same time, we found that their ability to form compositional protocols in these cases is hampered by their ability to pull apart the objects’ factors of variations. Altogether, we were able to successfully scale up traditional research from the language evolution literature on emergent communication tasks to the contemporary deep learning framework, thus opening avenues to more realistic, and large scale, computational simulations of language emergence with complex image stimuli.
158
+
159
+ # ACKNOWLEDGEMENTS
160
+
161
+ We would like to thank Murray Shanahan, Laura Rimell and Gabor Melis for their very helpful feedback on this paper, as well as the rest of the DeepMind language team for many discussions. AL would also like to thank Marco Baroni and Alex Peysakhovich for the email correspondence and discussions from a year ago, which provided inspiration for some of the experiments on this paper.
162
+
163
+ # REFERENCES
164
+
165
+ Jacob Andreas and Dan Klein. Analogs of linguistic structure in deep representations. arXiv preprint arXiv:1707.08139, 2017.
166
+
167
+ Trapit Bansal, Jakub Pachocki, Szymon Sidor, Ilya Sutskever, and Igor Mordatch. Emergent complexity via multi-agent competition. arXiv preprint arXiv:1710.03748, 2017.
168
+
169
+ John Batali. Computational simulations of the emergence of grammar. pp. 405–426, 1998.
170
+
171
+ 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.
172
+
173
+ Susan E Brennan and Herbert H Clark. Conceptual pacts and lexical choice in conversation. Journal of Experimental Psychology: Learning, Memory, and Cognition, 22(6):1482, 1996.
174
+
175
+ Henry Brighton. Compositional syntax from cultural transmission. Artificial life, 8(1):25–54, 2002.
176
+
177
+ Henry Brighton and Simon Kirby. Understanding linguistic evolution by visualizing the emergence of topographic mappings. Artificial life, 12(2):229–242, 2006.
178
+
179
+ Ted Briscoe (ed.). Linguistic evolution through language acquisition. Cambridge University Press, Cambridge, UK, 2002.
180
+
181
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016.
182
+
183
+ Angelo Cangelosi and Domenico Parisi (eds.). Simulating the evolution of language. Springer, New York, 2002.
184
+
185
+ Jon W Carr, Kenny Smith, Hannah Cornish, and Simon Kirby. The cultural evolution of structured languages in an open-ended, continuous world. Cognitive science, 41(4):892–923, 2017.
186
+
187
+ 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.
188
+
189
+ 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.
190
+
191
+ Michael Franke. The evolution of compositionality in signaling games. Journal of Logic, Language and Information, pp. 1–23, 2015.
192
+
193
+ Gottlob Frege. Uber Sinn und Bedeutung. ¨ Zeitschrift fur Philosophie und philosophische Kritik ¨ , 100:25–50, 1892.
194
+
195
+ Simon Garrod and Martin J Pickering. Why is conversation so easy? Trends in cognitive sciences, 8(1):8–11, 2004.
196
+
197
+ Serhii Havrylov and Ivan Titov. Emergence of language with multi-agent games: Learning to communicate with sequences of symbols. arXiv preprint arXiv:1705.11192, 2017.
198
+
199
+ 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.
200
+
201
+ Karl Moritz Hermann, Felix Hill, Simon Green, Fumin Wang, Ryan Faulkner, Hubert Soyer, David Szepesvari, Wojtek Czarnecki, Max Jaderberg, Denis Teplyashin, et al. Grounded language learning in a simulated 3d world. arXiv preprint arXiv:1706.06551, 2017.
202
+
203
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
204
+
205
+ Sahar Kazemzadeh, Vicente Ordonez, Mark Matten, and Tamara L Berg. Referitgame: Referring to objects in photographs of natural scenes. In EMNLP, pp. 787–798, 2014.
206
+
207
+ Satwik Kottur, Jose MF Moura, Stefan Lee, and Dhruv Batra. Natural language does not ´ emerge’naturally’in multi-agent dialog. arXiv preprint arXiv:1706.08502, 2017.
208
+
209
+ Angeliki Lazaridou, Alexander Peysakhovich, and Marco Baroni. Multi-agent cooperation and the emergence of (natural) language. In ICLR, 2017.
210
+
211
+ David Lewis. Convention. Harvard University Press, Cambridge, MA, 1969.
212
+
213
+ 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.
214
+
215
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, pp. 1928–1937, 2016.
216
+
217
+ Igor Mordatch and Pieter Abbeel. Emergence of grounded compositional language in multi-agent populations. arXiv preprint arXiv:1703.04908, 2017.
218
+
219
+ Martin A Nowak and David C Krakauer. The evolution of language. Proceedings of the National Academy of Sciences, 96(14):8028–8033, 1999.
220
+
221
+ Steven T Piantadosi, Harry Tily, and Edward Gibson. The communicative function of ambiguity in language. Cognition, 122(3):280–291, 2012.
222
+
223
+ Carina Silberer, Vittorio Ferrari, and Mirella Lapata. Models of semantic representation with visual attributes. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 572–582, Sofia, Bulgaria, August 2013. Association for Computational Linguistics. URL http://www.aclweb.org/anthology/P13-1056.
224
+
225
+ David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, Yutian Chen, Timothy Lillicrap, Fan Hui, Laurent Sifre, George van den Driessche, Thore Graepel, and Demis Hassabis. Mastering the game of go without human knowledge. Nature, 550:354–359, 2017.
226
+
227
+ Brian Skyrms. Signals: Evolution, learning, and information. Oxford University Press, 2010.
228
+
229
+ Kenny Smith, Simon Kirby, and Henry Brighton. Iterated learning: A framework for the emergence of language. Artificial life, 9(4):371–386, 2003.
230
+
231
+ Matthew Spike, Kevin Stadler, Simon Kirby, and Kenny Smith. Minimal requirements for the emergence of learned signaling. Cognitive Science, 2016. In press.
232
+
233
+ Luc Steels. Social language learning. In Mario Tokoro and Luc Steels (eds.), The Future of Learning, pp. 133–162. IOS, Amsterdam, 2003.
234
+
235
+ Luc Steels and Martin Loetzsch. The grounded naming game. In Luc Steels (ed.), Experiments in Cultural Language Evolution, pp. 41–59. John Benjamins, Amsterdam, 2012.
236
+
237
+ 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.
238
+
239
+ Kyle Wagner, James A Reggia, Juan Uriagereka, and Gerald S Wilkinson. Progress in the simulation of emergent communication and language. Adaptive Behavior, 11(1):37–69, 2003.
240
+
241
+ Ronald J. Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Mach. Learn., 8(3-4):229–256, May 1992. ISSN 0885-6125. doi: 10.1007/ BF00992696. URL https://doi.org/10.1007/BF00992696.
242
+
243
+ Ludwig Wittgenstein. Philosophical Investigations. Blackwell, Oxford, UK, 1953. Translated by G.E.M. Anscombe.
244
+
245
+ # A CONCEPTUAL ALIGNMENT OF SPEAKER AND LISTENER
246
+
247
+ During conversation, communication allows interlocutors to achieve interactive conceptual alignment (Garrod & Pickering, 2004). We are able to communicate because we have established a common ground and our representations at different levels become aligned (e.g., participants mutually understand that “he” in the conversation refers to Bob). We investigated whether the agents’ conceptual systems achieve a similar structural alignment. We measure the alignment in terms of Spearman $\rho$ correlation of the intra-agent pairwise object cosine similarities as calculated via representing objects as activations from ConvNet layers.
248
+
249
+ Interestingly, we observe a gradual increase in the structural similarity as we represent the objects with layer activations closer to the pixel space. Conceptual spaces are more aligned the closer they are to the raw pixel input $\mathrm { ~ \ ' ~ } \rho = 0 . 9 7 \mathrm { - } 0 . 9 1$ , depending on the game) and become more dissimilar as the representations become more abstract. We can draw the analogy to language processing, as first ConvNet layers perform some low-level processing analogous to phoneme recognition or word segmentation (and are thus more objective) while higher layers perform more abstract processing, vaguely analogous to semantics and pragmatics (thus, represent more subjective knowledge). In cases of successful communication, speakers’ and listeners’ conceptual spaces closer to the communication point are structurally very similar $\prime \rho = 0 . 8 5 – 0 . 6 2$ , depending on the game), however this similarity drops dramatically in cases of failure of communication $\mathit { \Pi } _ { \rho } = 0 . 1 5 $ ).
250
+
251
+ # B HYPERPARAMETER DETAILS
252
+
253
+ All LSTM hidden states of the “speaking” and “listening” module as well and the “seeing” prelinguistic feed-forward encoders (see Section 3), have dimension 50. The “seeing” pre-linguistic ConvNet encoders (see Section 4) has 8 layers, 32 filters with the kernel size 3 for every layer and with strides $[ 2 , 1 , 1 , 2 , 1 , 2 , 1 , 2 ]$ for each layer. We use ReLU as activation function as well as batch normalization for every layer.
254
+
255
+ For learning, we used the Rmsprop optimizer, with learning rate 0.0001. We use a separate value of entropy regularization for each policy. For $\pi ^ { S }$ we use 0.01 and for $\pi ^ { L }$ we use 0.001. We use a mini-batch of 32.
256
+
257
+ # C COMMUNICATIVE SUCCESS USING GOLD ATTRIBUTE CLASSIFIERS
258
+
259
+ We assume a model which has access to perfect attribute classifiers for color, shape and object position, for the latter using a classifier operating on the discretized annotations we obtained in Section 4.2 after quantazing the real-valued object location. For computing the performance of this model using gold attribute classifiers, we first remove from the distractors any candidate not matching the target’s attributes and them pick at random. We repeat this experiment for single attribute classifiers and their pairwise combinations. Table 5 reports the communicative success results obtained empirically by averaging across 1000 simulations, alongside the training and test accuracies of the trained agents of Section 4.1 for comparison.
260
+
261
+ Table 5: Communicative success of trained models from Section 4.1 (train and test) as well as models with access to gold classifiers. All accuracies are in percentage format.
262
+
263
+ <table><tr><td> game</td><td>train</td><td>test</td><td>color</td><td>shape</td><td>position</td><td>color &amp; shape</td><td> position &amp; shape</td><td>position &amp; color</td></tr><tr><td>A</td><td>93.7</td><td>93.6</td><td>37.2</td><td>24.8</td><td>69.3</td><td>80.4</td><td>92.1</td><td>95.6</td></tr><tr><td>B</td><td>93.2</td><td>93.4</td><td>93.2</td><td>90.1</td><td>97.2</td><td>98.8</td><td>99.3</td><td>99.4</td></tr><tr><td>C</td><td>86.0</td><td>85.7</td><td>93.2</td><td>90.1</td><td>-</td><td>98.8</td><td>1</td><td>1</td></tr><tr><td>D</td><td>90.4</td><td>89.9</td><td>89.6</td><td>89.2</td><td>1</td><td>98.5</td><td>1</td><td>1</td></tr></table>
md/train/HJgZrsC5t7/HJgZrsC5t7.md ADDED
@@ -0,0 +1,327 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # IMPROVING ON-POLICY LEARNING WITH STATISTICAL REWARD ACCUMULATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Deep reinforcement learning has obtained significant breakthroughs in recent years. Most methods in deep-RL achieve good results via the maximization of the reward signal provided by the environment, typically in the form of discounted cumulative returns. Such reward signals represent the immediate feedback of a particular action performed by an agent. However, tasks with sparse reward signals are still challenging to on-policy methods. In this paper, we introduce an effective characterization of past reward statistics (which can be seen as long-term feedback signals) to supplement this immediate reward feedback. In particular, value functions are learned with multi-critics supervision, enabling complex value functions to be more easily approximated in on-policy learning, even when the reward signals are sparse. We also introduce a novel exploration mechanism called “hot-wiring” that can give a boost to seemingly trapped agents. We demonstrate the effectiveness of our advantage actor multi-critic (A2MC) method across the discrete domains in Atari games as well as continuous domains in the MuJoCo environments. A video demo is provided at https://youtu.be/zBmpf3Yz8tc and source codes will be made available upon paper acceptance.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Advances in deep learning have mobilized the research community to adopt deep reinforcement learning (RL) agents for challenging control problems, typically in complex environments with raw sensory state-spaces. Breakthroughs by Mnih et al. (2015) show RL-agents can reach abovehuman performance in Atari 2600 games, and AlphaGo Zero Silver et al. (2017) becomes the world champions on the game of Go. Still, training RL agents is non-trivial. Off-policy methods typically require days of training to obtain competitive performance, while on-policy methods could be trapped in local minima. Recent techniques featuring on-policy learning Mnih et al. (2016); Schulman et al. (2017); Wu et al. (2017) have shown promising results in stabilizing the learning processes, enabling an agent to solve a variety of tasks in much less time. In particular, the state-of-the-art on-policy ACKTR agent by Wu et al. (2017) shows improved sample efficiency with the help of Kronecker-factored (K-Fac) approximate curvature for natural gradient updates, resulting in stable and effective model updates towards a more promising direction.
12
+
13
+ However, tasks with sparse rewards remain challenging to on-policy methods. An agent could take massive amount of exploration before reaching non-zero rewards; and as the agent learns on-policy, the sparseness of reward feedback (receiving all-zero rewards from most actions performed by the agent) could be malicious and render an agent to falsely predict all states in an environment towards a value of zero. As there does not exist a universal criterion for measuring “task sparseness”, we show an ad-hoc metric in Figure 1 in an attempt to provide intuition. For example, we observe that the ACKTR agent is unable to receive sufficient non-zero immediate rewards that can provide instructive agent updates in Atari games “Freeway” and “Enduro”, resulting in failures when solving these two games. Moreover, if ACKTR gets drawn to and trapped in unfavorable states (as in games like Boxing and WizardOfWor), it could again take long hours of exploration before the agent can get out of the local minima. Such evidence shows that on-policy agent could indeed suffer from the insufficiencies of guidance provided by the exclusive immediate reward signals from the environment.
14
+
15
+ In this paper, we introduce an effective auxiliary reward signal in tasks with sparse rewards to remedy the deficiencies of learning purely from standard immediate reward feedbacks. As on-policy agents may take many explorations before reaching non-zero immediate rewards, we argue that we can leverage past reward statistics to provide more instructive feedbacks to agents in the same environment. To this end, we propose to characterize the past reward statistics in order to gauge the “long-term” performance of an agent (detailed in Section 4). After performing an action, an agent will receive a long-term reward signal describing its past performance upon this step, as well as the conventional immediate reward from the environment. To effectively characterize the long-term performance of the agent, we take into considerations both the crude amount of rewards and the volatility of rewards received in the past, where highly volatile distributions of long-term rewards are explicitly penalized. This enables complex value functions to be more easily approximated in multi-critics supervision. We find in practice that by explicitly penalizing highly volatile long-term rewards while maximizing the expectation of short-term rewards, the learning process and the overall performance are improved regarding both sample efficiency and final rewards. We further propose a “hot-wiring” exploration mechanism that can boost seemingly trapped agent in the earlier stage of learning. By leveraging the characterization of long/short-term reward statistics, our proposed advantage actor multi-critic model (A2MC) shows significantly improved performance on the Atari 2600 games and the MuJoCo tasks as compared to the state-of-the-art on-policy methods.
16
+
17
+ ![](images/cd753a39ce5a48461924628e1e3afe7243006032133b48f3e336125002681ed3.jpg)
18
+ Figure 1: Performance of A2MC on Atari games trained with 15 million timesteps. Our method has a winning rate of $5 5 . 3 \%$ among all the Atari games tested, as compared to the ACKTR. Our A2MC learns quickly in some of the hardest games for on-policy methods, such as “Boxing”, “Enduro”, “Freeway”, “Robotank” and “WizardOfWor”. The sparseness of a game is defined as the sparseness of average rewards $\mathbf { x }$ obtained by ACKTR within the first $n = 1 0 ^ { 6 }$ timesteps by $\begin{array} { r } { \varphi ( \mathbf { x } ) ^ { \mathbf { \tilde { \alpha } } } = \left( \sqrt { n } - \frac { \| \mathbf { x } \| _ { 1 } } { \| \mathbf { x } \| _ { 2 } } \right) \tilde { \mathbf { \alpha } } ( \sqrt { n } - 1 ) } \end{array}$ . A higher value of sparseness indicates sparser rewards. A relative performance margin (in terms of final reward) larger than $1 0 \%$ is deemed as winning / losing. The shaded region denotes the standard deviation over 2 random seeds.
19
+
20
+ # 2 RELATED WORK
21
+
22
+ Reward shaping and pseudo-rewards: To tackle the challenge in tasks with rarely observed rewards, pseudo-rewards maximization is adopted in earlier works Konidaris & Barto (2009); Silver & Ciosek (2012). Auxiliary vision tasks (e.g., learning pixel changes or network features) are adopted in the off-policy UNREAL agent Jaderberg et al. (2016) in order to facilitate learning better feature representations, particularly for sparse reward environments. Another direction of effort involves directly engineering a better reward function or shaping the reward signal. Andrychowicz et al. (2017) enhances off-policy learning by re-producing informative reward in hindsight for sequences of actions that do not lead to success previously. The HRA approach Van Seijen et al. (2017) exploits domain knowledge to define a set of environment-specific rewards based on reward categories. And the winning approach that learns playing “Doom” Lample & Chaplot (2017) shows promising success in the FPS game that carefully crafting the task rewards would indeed be beneficial. In contrast to heuristically defining vision-related auxiliary tasks, our proposed A2MC agent learns from the characterization of intrinsic past reward statistics obtainable from any environment; and different from the hybrid architecture pertaining to Ms. Pacman only and the reward shaping settings tailored specifically to ”Doom”, our proposed reward characterization mechanism is generic and our A2MC generalizes well to a variety of tasks without the need to engineer a decomposition of problemspecific environment rewards. Moreover, the capability of the proposed method to further boost reward shaping is evidenced in our case study on playing Doom (see Appendix F).
23
+
24
+ Multi-agents: The multi-agent approaches Lanctot et al. (2017); Lowe et al. (2017); Jin et al. (2018) present another promising direction for learning. They propose to train multiple agents in parallel when solving a task, and to combine multiple action-value functions with a centralized action-value function. The multi-critics supervision in our proposed A2MC model can be seen as a form of joint-task or multi-task learning Teh et al. (2017) for both long-term and short-term rewards.
25
+
26
+ On-policy v.s. Off-policy: Our empirical results based on learning the characterization of long/shortterm reward statistics also echo the effectiveness of a recently proposed off-policy reinforcement learning framework Bellemare et al. (2017) that features a distributional variant of Q-learning, wherein the value functions are learned to match the distribution of standard immediate returns. Also, Wang et al. (2016) shows that applying experience replay to on-policy methods can further enhance learning stability. Schulman et al. (2016) proposes a variant of advantage function using eligibility traces that provides both low-variance and low-bias gradient estimates. These works are orthogonal to our approach can potentially be combined with the proposed characterization of past reward statistics to further enhance learning performance. While our extensive experiments (see also Appendix E and Appendix F) show promising results of our approach in both on- and off-policy frameworks, we focus on “on-policy” methods (i.e., those that do not involve off-policy trajectories or experience replay) as in $\mathrm { W u }$ et al. (2017) in the main text in order to systematically evaluate the potential of our proposed reward mechanism within the scope of this work.
27
+
28
+ # 3 PRELIMINARY
29
+
30
+ Consider the standard reinforcement learning setting where an agent interacts with an environment over a number of discrete time step. At each time step $t$ , the agent receives an environment state $s _ { t }$ , then executes an action $a _ { t }$ based on policy $\pi _ { t }$ . The environment produces reward $r _ { t }$ and next state $s _ { t + 1 }$ , according to which the agent gets feedback of its immediate action and will decide its next action $a _ { t + 1 }$ . The process $< { \bf S } , { \bf A } , { \bf R } , { \bf S } >$ , typically considered as a Markov Decision Process, continues until a terminal state $s _ { T }$ upon which the environment resets itself and produces a new episode. Under conventional settings, the return is calculated as the discounted summation of rewards $r _ { t }$ accumulated from time step $t$ onwards $\begin{array} { r } { R _ { t } = \sum _ { k = 0 } ^ { \infty } \gamma ^ { k } r _ { t + k } } \end{array}$ . The goal of the agent is to maximize the expected return from each state $s _ { t }$ while following policy $\pi$ . Each policy has a corresponding action-value function defined as $Q ^ { \pi } ( s , a ) = \mathbb { E } [ R _ { t } | s _ { t } = s , a _ { t } = a ; \pi ]$ . Similarly, each state $s \in S$ under policy $\pi$ has a value function defined as: $V ^ { \pi } ( s ) = \mathbb { E } [ R _ { t } | s _ { t } = s ]$ . In value-based approaches (e.g., Q-learning Mnih et al. (2015)), function approximator $Q ( s , a ; \theta )$ can be used to approximate the optimal action value function $Q ^ { * } ( s , a )$ . This is conventionally learned by iteratively minimizing the below loss function:
31
+
32
+ $$
33
+ L ( \theta ) = \mathbb { E } [ ( y _ { t } ^ { t a r g e t } - Q ( s _ { t } , a _ { t } ; \theta ) ) ^ { 2 } ] ,
34
+ $$
35
+
36
+ where ytargett = rt + γ maxa0 Q(st+1, a0; θ) and st+1 is the next state following state st.
37
+
38
+ In policy-based approaches (e.g., policy gradient methods), the optimal policy $\pi ^ { * } ( a | s )$ is approximated using the approximator $\pi ( a | s ; \theta )$ . The policy approximator is then learned by gradient ascent on $\nabla _ { \boldsymbol { \theta } } \mathbb { E } [ h _ { t } ] \approx \dot { \nabla _ { \boldsymbol { \theta } } } \log \pi ( a _ { t } | s _ { t } ; \boldsymbol { \theta } ) \dot { R } _ { t }$ . The REINFORCE method Williams (1992) further incorporates a baseline $b ( s _ { t } )$ to reduce the variance of the gradient estimator: $\nabla _ { \theta } \mathbb { E } [ R _ { t } ] _ { R E I N F O R C E } \approx$ $\nabla _ { \theta } \log \pi ( a _ { t } | s _ { t } ; \theta ) \dot { ( R _ { t } - b ( s _ { t } ) ) }$
39
+
40
+ In actor-critic based approaches, the variance reduction further evolves into the advantage function $A ( s _ { t } , a _ { t } ) = Q ( s _ { t } , a _ { t } ) - V ( s _ { t } )$ in Mnih et al. (2016), where the action value $Q ^ { \pi } ( s _ { t } , a _ { t } )$ is approximated by $R _ { t }$ and $b ( s _ { t } )$ is replaced by $V ^ { \pi } ( s _ { t } )$ , deriving the advantage actor-critic architecture where actor-head $\pi ( \cdot | s )$ and the critic-head $V ( s )$ share low-level features. The gradient update rule w.r.t. the action-head is $\nabla _ { \theta } \log \pi ( a _ { t } | s _ { t } ; \theta ) ( R _ { t } - V ( s _ { t } ; \theta ) )$ . The gradient update w.r.t. the critic-head is: $\nabla _ { \boldsymbol { \theta } } ( R _ { t } - V ( s _ { t } ; \boldsymbol { \theta } ) ) ^ { 2 }$ , where $R _ { t } = r _ { t } + \gamma V ( s _ { t + 1 } )$ .
41
+
42
+ ![](images/691a77d1436be9adc6c816257080ddb1982e633dec02a7c34a27ed2085021986.jpg)
43
+ Figure 2: Illustration of the proposed variability-weighted reward (VWR). The first row shows the raw reward sequence (blue) while the second row presents the post-processed sequence $\vec { \mathcal { R } }$ (green) and the zero-variability reference $\vec { \mathcal { R } } ^ { z e r o }$ (orange), and $\mathcal { R } _ { H }$ is calculated as a reflection of how high the immediate reward is. The third row shows the volatility statistics of $\delta _ { \mathcal { R } }$ , representing how varied past rewards were. We curated 3 hypothetical reward sequences – (a) highly varied sequence with low immediate reward, resulting in the lowest VWR; (b) highly varied sequence with high immediate reward, leading to a relatively high VWR; (c) stable sequence with high immediate reward, achieving the best VWR. More examples can be found in the Appendix A.
44
+
45
+ # 4 CHARACTERIZATION OF PAST REWARD STATISTICS
46
+
47
+ The conventional reward $r _ { t }$ received from the environment at time step $t$ after an action $a _ { t }$ is performed represents the immediate reward regarding this particular action. This “immediacy” could be interpreted as a short-term horizon of how the agent is doing, i.e., evaluating the agent via judging its actions by immediate rewards. We argue that the deficiencies of learning solely from immediate rewards mainly come from this limitation that the agent is learning from one single type of exclusive short-term feedback.
48
+
49
+ As the goal of providing reward feedback to an agent is to inform the agent of its performance, we seek to find an auxiliary performance metric that can measure whether the agent is performing consistently well. Inspired by the formulation of Sharpe Ratio $\begin{array} { r } { ( \mathbb { E } [ r ] \times \frac { 1 } { \sigma _ { r } } ) } \end{array}$ in evaluating the long-term performance of porfolio strategies where the return $\mathbb { E } [ r ]$ is inversely weighted by the risk $\sigma _ { r }$ , an effective characterization of historical reward statistics should take into account at least two factors, namely 1) how high the immediate reward is and 2) how varied past rewards were, bringing the desired notion of “risk-adjusted return” as in Sharpe (1994).
50
+
51
+ # 4.1 VARIABILITY-WEIGHTED REWARD
52
+
53
+ To this end, we follow insights behind Dowd (2000); Sharpe (1994) and define a variability-weighted characterization of past rewards. This is illustrated in Figure 2. We consider a historical sequence of $T$ rewards upon timestep $t$ (looking backward $T - 1$ timesteps): $\vec { \mathbf { r } } = \left[ r _ { t - ( T - 1 ) } . . . , r _ { t - 2 } , r _ { t - 1 } , r _ { t } \right]$ . In order to evaluate how high and varied the reward sequence is, a few steps of pre-processing $\mathcal { G }$ is applied, denoted as $\vec { \mathcal { R } } = \mathcal { G } ( \vec { \bf r } )$ . Specifically, we first derive the reward change at each timestep (similar to the “differential return” concept in Sharpe (1994)) with $d _ { n } = r _ { n } - r _ { n - 1 }$ :
54
+
55
+ $$
56
+ \vec { \mathbf { d } } = [ d _ { t - ( T - 1 ) } , d _ { t - ( T - 2 ) } , \dots , d _ { t } ] = [ r _ { t - ( T - 1 ) } , r _ { t - ( T - 2 ) } - r _ { t - ( T - 1 ) } , \dots , r _ { t } - r _ { t - 1 } ] .
57
+ $$
58
+
59
+ Then we re-order the sequence by flipping 1 with $f _ { n } = d _ { t + 1 - n }$ :
60
+
61
+ $$
62
+ \vec { \mathbf { f } } = [ f _ { 1 } , f _ { 2 } , \dotsc , f _ { T } ] = [ d _ { t } , d _ { t - 1 } , \dotsc , d _ { t - ( T - 1 ) } ] .
63
+ $$
64
+
65
+ Next we append $f _ { 0 } = 1$ to the head of sequence $\vec { \mathbf { f } }$ and take the normalized cumulative sum to obtain the post-processed reward sequence as $\begin{array} { r } { \vec { \mathcal { R } } = [ \mathcal { R } _ { 0 } , \mathcal { R } _ { 1 } , \ldots , \mathcal { R } _ { T } ] = \frac { 1 } { T + 1 } [ f _ { 0 } , f _ { 0 } + f _ { 1 } , \ldots , \sum _ { i = 0 } ^ { T } f _ { i } ] } \end{array}$ . Under such processing, numerical instability (see Eq. 4) when all rewards in the sequence are zero can be alleviated, while the averaging term $\\frac { 1 } { T + 1 }$ mitigates the effect of introducing the artificial $f _ { 0 }$ .
66
+
67
+ The resulting $\vec { \mathcal { R } }$ is a reward sequence with $\begin{array} { r } { \mathcal { R } _ { T } - \mathcal { R } _ { 0 } = \frac { 1 } { T + 1 } r _ { t } } \end{array}$ , and $\begin{array} { r } { \mathcal { R } _ { n } - \mathcal { R } _ { n - 1 } = \frac { 1 } { T + 1 } ( r _ { t + 1 - n } - } \end{array}$ $r _ { t - n } )$ . Therefore, the difference between $\mathcal { R } _ { T }$ and $\mathcal { R } _ { 0 }$ represents the immediate reward and the whole sequence $\vec { \mathcal { R } }$ reflects the volatility of past rewards. In Figure 2, three examples of processed sequence are presented in the second row with the corresponding raw rewards shown in the first row. We account for how high the immediate reward is by defining the relative percentage log total return as:
68
+
69
+ $$
70
+ \mathcal { R } _ { H } = 1 0 0 \times \left( e ^ { \frac { 1 } { T } \ln \frac { \mathcal { R } _ { T } } { \mathcal { R } _ { 0 } } } - 1 \right) = \frac { { \mathcal { R } _ { T } } ^ { 1 / T } - { \mathcal { R } _ { 0 } } ^ { 1 / T } } { { \mathcal { R } _ { 0 } } ^ { 1 / T } } \times 1 0 0 .
71
+ $$
72
+
73
+ To account for how varied past rewards were, we first define a smooth zero-variability reference as: $\vec { \mathcal { R } } ^ { z e r o } = [ \mathcal { R } _ { 0 } ^ { z e r o } , \mathcal { R } _ { 1 } ^ { z e r o } , \ldots , \mathcal { R } _ { T } ^ { z e r o } ] = \mathcal { R } _ { 0 } [ e ^ { 0 \times \widetilde { \mathcal { R } } } , e ^ { 1 \times \widetilde { \mathcal { R } } } , \ldots , e ^ { T \widetilde { \mathcal { R } } } ]$ with $\begin{array} { r } { \widetilde { \mathcal { R } } = \frac { 1 } { T } \ln \frac { \mathcal { R } _ { T } } { \mathcal { R } _ { 0 } } } \end{array}$ , represent a smooth monotonic reference sequence from $\mathcal { R } _ { 0 }$ to $\mathcal { R } _ { T }$ . Then we define the reward differential $\delta _ { \mathcal { R } }$ as the differential reward versus its zero-variability reference as $\begin{array} { r } { \delta _ { \mathcal { R } } ( n ) = \frac { \mathcal { R } _ { n } - \mathcal { R } _ { n } ^ { z e r o } } { \mathcal { R } _ { n } ^ { z e r o } } } \end{array}$ , whose statistics are sketched in the third row of Figure 2. With maximally allowed volatility as $\sigma _ { m a x }$ , the variability weights can be defined as: $\begin{array} { r } { \omega = 1 - \big [ { \frac { \sigma ( \delta _ { \mathcal { R } } ) } { \sigma _ { m a x } } } \big ] ^ { \tau } } \end{array}$ , where $\sigma ( \cdot )$ is the standard deviation and $\tau$ controls the rate to penalize highly volatile reward distribution. Finally we can derive the variability-weighted past reward indicator $r ^ { v w r }$ for the characterization of past reward statistics:
74
+
75
+ $$
76
+ r ^ { v w r } = \left. \begin{array} { c c } { \mathcal { R } _ { H } ( 1 - [ \frac { \sigma ( \delta _ { \mathcal { R } } ) } { \sigma _ { m a x } } ] ^ { \tau } ) } & { \mathrm { i f } \sigma ( \delta _ { \mathcal { R } } ) < \sigma _ { m a x } , \mathcal { R } _ { T } > 0 } \\ { 0 } & { \mathrm { o t h e r w i s e } } \end{array} \right.
77
+ $$
78
+
79
+ The formulation of Equation 5 share principled themes as in Sharpe (1994) and Dowd (2000):
80
+
81
+ 1. Dowd (2000) compares the newly obtained $\mathbf { S R } ^ { n e w }$ with the previous $\mathbf { S R } ^ { o l d }$ in choosing new assets; we derive $\mathcal { R } _ { H }$ in Eq. 4 by comparing the latest reward $\mathcal { R } _ { T }$ with $\mathcal { R } _ { 0 }$ to explicitly encourage the agent to aim for reward improvements in “choosing new actions”; 2. Both the Sharpe Ratio (SR) and Eq. 5 involve “variability weights” to adjust for the unit risk of return $\mathbb { E } [ \mathcal { R } ]$ Sharpe (1994) (i.e., $\scriptstyle { \frac { 1 } { \sigma _ { r } } }$ for SR and $\begin{array} { r } { 1 - \big [ \frac { \sigma ( \delta \mathcal { R } ) } { \sigma _ { m a x } } \big ] ^ { \tau } } \end{array}$ [ σ(δR) ]τ for rvwr ); 3. Whereas Dowd (2000) introduces the concept of “minimum required return” based on the elasticity of value at risk (VaR), we consider the maximum tolerance level $\sigma _ { m a x }$ with elasticity controlled by $\tau$ for improved learning stability of $r ^ { v w r }$ (see also Appendix H).
82
+
83
+ Example computed values of $r ^ { v w r }$ for the characterization of different reward statistics are shown in Figure 2 and we show strong empirical results (in Section 6) to confirm the validity and robustness of the proposed formulation in multiple reinforcement learning domains.
84
+
85
+ # 4.2 MULTI-CRITIC ARCHITECTURE
86
+
87
+ A higher value of $r ^ { v w r }$ indicates better agent performance as the result of the historical sequence of actions. The same set of optimization procedures for conventional value function (i.e., via maximization of immediate reward signal $r$ ) update can be applied accordingly. The actual returns computed from both the “long-term” and “short-term” rewards are discounted by the same factor $\gamma$ In particular, for standard $N$ -step look-ahead approaches, we have:
88
+
89
+ $$
90
+ R _ { t } ^ { \mathrm { { s h o r t . e r m } } } = \sum _ { n = 0 } ^ { N - 1 } \gamma ^ { n } r _ { t + n } + \gamma ^ { N } V ( s _ { t + N } ) , \ : \ : \ : R _ { t } ^ { \mathrm { l o n g . e r m } } = \sum _ { n = 0 } ^ { N - 1 } \gamma ^ { n } r _ { t + n } ^ { v w r } + \gamma ^ { N } V ^ { v w r } ( s _ { t + N } )
91
+ $$
92
+
93
+ Similar to the standard state value function $V ( s )$ , we further define $V ^ { v w r } ( s )$ as the value function w.r.t the variability-weighted reward $r ^ { v w r }$ . These value functions form multiple critics judging a given state $s$ . The gradients w.r.t. the critics then become:
94
+
95
+ $$
96
+ \nabla _ { \theta ^ { \mathrm { s h o r i c m } } } [ ( R _ { t } ^ { \mathrm { s h o r t - e r m } } - V ( s _ { t } ; \theta ^ { \mathrm { s h o r t - e r m } } ) ) ^ { 2 } ] + \nabla _ { \theta ^ { \mathrm { l o r g - t e r m } } } [ ( R _ { t } ^ { \mathrm { l o n g - t e r m } } - V ^ { v w r } ( s _ { t } ; \theta ^ { \mathrm { l o n g - t e r m } } ) ) ^ { 2 } ]
97
+ $$
98
+
99
+ ![](images/fd2a20fd68d11f839066eb2b4cb98f37deca225e98926d444892f991d6494b10.jpg)
100
+ Figure 3: Performance of A2MC on Atari games. “Hot-Wiring” exploration makes the agent easier to figure out how to play challenging games like “Robotank” and “WizardOfWor”, and for most games, it provides a better initial state for the agent to start off at a game and hence to obtain better final results. The number in figure legend shows the average reward among the last 100 episodes and the percentage shows the performance margin as compared to ACKTR. The shaded region denotes the standard deviation over 2 random seeds.
101
+
102
+ where the standard grading clipping approach can be applied in Eq. 7 for enhanced stability. More advanced methods for estimating $R _ { t } ^ { \mathrm { s h o r t - t e r m } }$ and $R _ { t } ^ { \mathrm { { l o n g - t e r m } } }$ above, such as the online variant of generalized advantage estimation (GAE) using eligibility traces Schulman et al. (2016) can be adopted in place of Eq. 6, as shown below (see also Appendix $\mathbf { G }$ ):
103
+
104
+ $$
105
+ \begin{array} { r l } & { A _ { t } ^ { \mathrm { s h o r t . t e r m } } = \displaystyle \sum _ { n = 0 } ^ { \infty } ( \gamma \lambda ) ^ { n } \delta _ { t + n } ^ { v w r } , \mathrm { w i t h } \delta _ { t } = r _ { t } + \gamma V ( s _ { t + 1 } ) - V ( s _ { t } ) } \\ & { A _ { t } ^ { \mathrm { l o n g . t e r m } } = \displaystyle \sum _ { n = 0 } ^ { \infty } ( \gamma \lambda ) ^ { n } \delta _ { t + n } ^ { v w r } , \mathrm { w i t h } \delta _ { t } ^ { v w r } = r _ { t } ^ { v w r } + \gamma V ^ { v w r } ( s _ { t + 1 } ) - V ^ { v w r } ( s _ { t } ) } \end{array}
106
+ $$
107
+
108
+ where the generalized estimator of the advantage function $A _ { t } ^ { \mathrm { s h o r t - t e r m } }$ and $A _ { t } ^ { \mathrm { l o n g - t e r m } }$ allows a trade-off of bias $\nu . s .$ . variance using the parameter $0 \leq \lambda \leq 1$ , similar to the $\mathrm { T D } ( \lambda )$ approach for eligibility traces. We show the effectiveness of the proposed characterization of past reward statistics in multiple advantage actor-critic frameworks (i.e., ACKTR and PPO), where the two different value functions can share the same low-level feature representation, enabling a single agent to learn multiple critics parameterized by $\theta ^ { j } , j \in \{ \mathrm { s h o r t - t e r m } , \mathrm { l o n g - t e r m } \}$ . (See also Appendix I for the full algorithm).
109
+
110
+ # 5 HOT-WIRE $\epsilon$ -EXPLORATION
111
+
112
+ Being handed a game-stick, a human most likely would try out all the available buttons on it to see which particular button entails whatever actions on the game screen, hence receiving useful feedbacks. Inspired by this, we propose to hot-wire the agent to perform an identical sequence of randomly chosen actions in the N-step look-ahead during the initial stage (randomly pressing down a game-stick button for a while):
113
+
114
+ $$
115
+ a _ { t + k } = \left\{ \begin{array} { l l } { { \mathrm { ~ a ~ r a n d o m ~ a c t i o n ~ i d e n t i c a l ~ f o r ~ a l l ~ k ~ } } } & { { \mathrm { w i t h ~ p r o b ~ } \epsilon } } \\ { { \pi ( a _ { t + k } | s _ { t + k } ) ~ \mathrm { f o r } ~ k = 0 , 1 , 2 , . . . , N - 1 } } & { { \mathrm { w i t h ~ p r o b ~ } 1 - \epsilon } } \end{array} \right.
116
+ $$
117
+
118
+ We show that by enabling the “hot-wiring” mechanism2, a seemingly trapped agent can be boosted to learn to quickly solve problems where rewards can only be triggered by particular action sequences, as shown in games like “Robotank” and “WizardOfWor” in Figure 3.
119
+
120
+ # 6 EXPERIMENTS
121
+
122
+ We use the same network architecture and natural gradient optimization method as in the ACKTR model Wu et al. (2017). We set $\sigma _ { m a x } = 1 . 0$ , $\tau = 2 . 0$ and $T = 2 0$ in the computation of variabilityweighted reward (see Appendix C for hyperparameter studies). For hot-wiring exploration, we choose $\epsilon = 0 . 2 0$ and initial stage to be first $\scriptstyle { \frac { 1 } { 4 0 } }$ of the total training period for all experiments. Other hyperparameters such as learning rate and gradient clipping remain the same as in the ACKTR model Wu et al. (2017), in addition to adopting GAE Schulman et al. (2016) for a stronger ACKTR baseline (see Sec 4.2). We first present results of evaluating the proposed A2MC model in two standard benchmarks, the discrete Atari experiments and the continuous MuJoCo domain. Then we show ablation studies on the robustness of the hyper-parameters involved as well as evaluating the extensibility of the proposed long/short-term reward characterizations to other on-policy methods. Further extensions to off-policy domains are presented in Appendix E and Appendix F.
123
+
124
+ # 6.1 ATARI 2600 GAMES
125
+
126
+ We follow standard evaluation protocol to evaluate A2MC in a variety of Atari game environments (starting with 30 no-op actions). We train our models for 15 million timesteps for each game environment and score each game based on the average episode rewards obtained among the last 100 episodes as in Wu et al. (2017). The learning results on 12 Atari games are shown in Figure 3 where we also included an ablation experiment of A2MC without hot-wiring. We observe that on average A2MC improves upon ACKTR in terms of final performance under the same training budget. Our A2MC is able to consistently improve agent performance based on the proposed characterization of reward statistics, hence the agent is able to get out of local minima in less time (higher sample efficiency) compared to ACKTR. The complete learning results on all games are attached in the Appendix B.
127
+
128
+ Table 1: Comparison of average episode rewards at the end of 50 million timesteps in Atari experiments. The reward scores and the first episodes reaching human-level performance Mnih et al. (2015) are reported as in Wu et al. (2017). A2MC is able to solve games that are challenging to ACKTR and also retain comparable performance in the rest of games.
129
+
130
+ <table><tr><td colspan="2"></td><td colspan="2">ACKTR</td><td colspan="2">A2MC</td></tr><tr><td>Domain</td><td>Human Level</td><td>Rewards</td><td>Episode</td><td>Rewards</td><td>Episode</td></tr><tr><td>Asteroids</td><td>47388.7</td><td>34171.0</td><td>N/A</td><td>830232.5</td><td>11314</td></tr><tr><td>Beamrider</td><td>5775.0</td><td>13581.4</td><td>3279</td><td>13564.3</td><td>3012</td></tr><tr><td>Boxing</td><td>12.1</td><td>1.5</td><td>N/A</td><td>99.1</td><td>158</td></tr><tr><td>Breakout</td><td>31.8</td><td>735.7</td><td>4097</td><td>411.4</td><td>3664</td></tr><tr><td>Double Dunk</td><td>-16.4</td><td>-0.5</td><td>742</td><td>21.3</td><td>544</td></tr><tr><td>Enduro</td><td>860.5</td><td>0.0</td><td>N/A</td><td>3492.2</td><td>730</td></tr><tr><td>Freeway</td><td>29.6</td><td>0.0</td><td>N/A</td><td>32.7</td><td>1058</td></tr><tr><td>Pong</td><td>9.3</td><td>20.9</td><td>904</td><td>19.4</td><td>804</td></tr><tr><td>Q-bert</td><td>13455.0</td><td>21500.3</td><td>6422</td><td>25229.0</td><td>7259</td></tr><tr><td>Robotank</td><td>11.9</td><td>16.5</td><td>-</td><td>25.7</td><td>4158</td></tr><tr><td>Seaquest</td><td>20182.0</td><td>1776.0</td><td>N/A</td><td>1798.6</td><td>N/A</td></tr><tr><td>Space Invaders</td><td>1652.0</td><td>19723.0</td><td>14696</td><td>11774.0</td><td>11064</td></tr><tr><td>Wizard of Wor</td><td>4756.5</td><td>702</td><td>N/A</td><td>7471.0</td><td>8119</td></tr></table>
131
+
132
+ We further expand the training budget and continue learning the games until 50 million timesteps as in Wu et al. (2017). As shown in Table 1, our A2MC model can solve games like “Boxing”, “Freeway” and “Enduro” that are challenging for the baseline ACKTR model. For a full picture of model performance in Atari games, A2MC has a human-level performance rate of $7 4 . 5 \%$ (38 out of 51 games) in the Atari benchmarks, compared to $6 3 . 6 \%$ reached by ACKTR. Individual game scores for all the Atari games are reported in the Appendix B.
133
+
134
+ # 6.2 CONTINUOUS CONTROL
135
+
136
+ For the evaluations on continuous control tasks simulated in MuJoCo environment, we first follow $\mathrm { W u }$ et al. (2017) and tune a different set of hyper-parameters from Atari experiments. Specifically, all
137
+
138
+ ![](images/3a06f904da805d4c7acb1d86247f9e70b0ea241d1cad9dbdc73b865f57ba7291.jpg)
139
+ Figure 4: Performance on the MuJoCo benchmark. A2MC is also competitive on MuJoCo continuous domain when compared to ACKTR. The shaded region denotes std over 3 random seeds.
140
+
141
+ MuJoCo experiments are trained with a larger batch size of 2500. The results of eight MuJoCo environments trained for 1 million timesteps are shown in Figure 4. We observe that A2MC also performs well in all MuJoCo continuous control tasks. In particular, A2MC has brought significant improvement on the tasks of HalfCheetah, Swimmer and Walker2d (see Table 2).
142
+
143
+ To test the robustness of A2MC, we perform another set of evaluations on MuJoCo tasks by keeping an identical set of hyper-parameters used in the Atari experiments. Figure 7 in Appendix C shows this ablation result. We observe that even under sub-optimal hyper-parameters, our A2MC model can still learn to solve the MuJoCo control tasks in the long run. Moreover, it is less prone to overfitting when compared to ACKTR under such “stress testing”. Additional hyper-parameter studies can be found in Appendix C.
144
+
145
+ We also evaluate a multi-critics variant of the proximal policy optimization (PPO) model on the MuJoCo tasks with our proposed long/short-term rewards. In particular, we observe that our proposed variability-weighted reward generalizes well with the vanilla PPO, and our multi-critics PPO variant (MC-PPO) shows more favorable performance, as shown in Table 2. Specifically, MC-PPO shows the best performance on Hopper and Walker- $_ { 2 d }$ among all models under the 1-million timesteps training budget. Both of our multi-critics variants (A2MC and MC-PPO) have won 6 out of the 8 MuJoCo tasks with relative performance margins (percentages in parentheses) larger than $2 5 \%$ (see Table 2).
146
+
147
+ Table 2: Average episode rewards obtained among the last 10 episodes upon 1 million timesteps of training in MuJoCo experiments.
148
+
149
+ <table><tr><td>GAMES</td><td>ACKTR</td><td colspan="2">Our A2MC</td><td>PPO</td><td colspan="2">Our MC-PPO</td></tr><tr><td>Ant</td><td>1671.6</td><td>2216.1</td><td>(32.5%)</td><td>411.4 (± 107.7)</td><td>618.9</td><td>(50.4%)</td></tr><tr><td>HalfCheetah</td><td>1676.2</td><td>2696.6</td><td>(60.8%)</td><td>1433.7 (± 83.9)</td><td>2473.4</td><td>(72.5%)</td></tr><tr><td>Hopper</td><td>2259.1</td><td>2835.7</td><td>(25.5%)</td><td>2055.8 (± 274.6)</td><td>3131.3</td><td>(52.3%)</td></tr><tr><td>InvertedDoublePendulum 6295.4</td><td></td><td>7872.6</td><td>(25.0%)</td><td>4454.1 (± 1098.1)</td><td>7648.7</td><td>(71.7%)</td></tr><tr><td>InvertedPendulum</td><td>1000.0</td><td>957.2</td><td>(-4.2%)</td><td>839.7 (± 127.1)</td><td>777.4</td><td>(-7.4%)</td></tr><tr><td>Reacher</td><td>-4.2</td><td>-3.9</td><td>(0.4%)</td><td>-5.47 (± 0.3)</td><td>-10.3</td><td>(-8.5%)</td></tr><tr><td>Swimmer</td><td>43.2</td><td></td><td>187.4 (333.7%)</td><td>79.1 (± 31.2)</td><td>102.9</td><td>(30.2%)</td></tr><tr><td>Walker2d</td><td>1090.8</td><td>2405.9 (120.5%)</td><td></td><td>2300.8 (± 397.6)</td><td>3718.1</td><td>(61.6%)</td></tr><tr><td>Win—Fair—Lose</td><td>N/A</td><td>6-2-0</td><td></td><td>N/A</td><td>6—2-0</td><td></td></tr></table>
150
+
151
+ # 7 CONCLUSION
152
+
153
+ In this work, we introduce an effective auxiliary reward signal to remedy the deficiencies of learning solely from the standard environment rewards. Our proposed characterization of past reward statistics results in improved learning and higher sample efficiencies for on-policy methods, especially in challenging tasks with sparse rewards. Experiments on both discrete tasks in Atari environment and MuJoCo continuous control tasks validate the effectiveness of utilizing the proposed long/short-term reward statistics for on-policy methods using multi-critic architectures. This suggests that expanding the form of reward feedbacks in reinforcement learning is a promising research direction.
154
+
155
+ # REFERENCES
156
+
157
+ Marcin Andrychowicz, Filip Wolski, Alex Ray, Jonas Schneider, Rachel Fong, Peter Welinder, Bob McGrew, Josh Tobin, OpenAI Pieter Abbeel, and Wojciech Zaremba. Hindsight experience replay. In Advances in Neural Information Processing Systems, pp. 5048–5058, 2017.
158
+
159
+ Marc G Bellemare, Will Dabney, and Remi Munos. A distributional perspective on reinforcement ´ learning. arXiv preprint arXiv:1707.06887, 2017.
160
+
161
+ Kevin Dowd. Adjusting for risk:: An improved sharpe ratio. International review of economics & finance, 9(3):209–222, 2000.
162
+
163
+ 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. 2018.
164
+
165
+ Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. arXiv preprint arXiv:1611.05397, 2016.
166
+
167
+ Junqi Jin, Chengru Song, Han Li, Kun Gai, Jun Wang, and Weinan Zhang. Real-time bidding with multi-agent reinforcement learning in display advertising. arXiv preprint arXiv:1802.09756, 2018.
168
+
169
+ George Konidaris and Andrew G Barto. Skill discovery in continuous reinforcement learning domains using skill chaining. In Advances in neural information processing systems, pp. 1015–1023, 2009.
170
+
171
+ Guillaume Lample and Devendra Singh Chaplot. Playing fps games with deep reinforcement learning. In AAAI, 2017.
172
+
173
+ Marc Lanctot, Vinicius Zambaldi, Audrunas Gruslys, Angeliki Lazaridou, Julien Perolat, David Silver, Thore Graepel, et al. A unified game-theoretic approach to multiagent reinforcement learning. In Advances in Neural Information Processing Systems, pp. 4193–4206, 2017.
174
+
175
+ Ryan Lowe, Yi Wu, Aviv Tamar, Jean Harb, OpenAI Pieter Abbeel, and Igor Mordatch. Multi-agent actor-critic for mixed cooperative-competitive environments. In Advances in Neural Information Processing Systems, pp. 6382–6393, 2017.
176
+
177
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015.
178
+
179
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, pp. 1928–1937, 2016.
180
+
181
+ John Schulman, Philipp Moritz, Sergey Levine, Michael Jordan, and Pieter Abbeel. High-dimensional continuous control using generalized advantage estimation. ICLR, 2016.
182
+
183
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
184
+
185
+ William F Sharpe. The sharpe ratio. Journal of portfolio management, 21(1):49–58, 1994.
186
+
187
+ David Silver and Kamil Ciosek. Compositional planning using optimal option models. arXiv preprint arXiv:1206.6473, 2012.
188
+
189
+ David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, et al. Mastering the game of go without human knowledge. Nature, 550(7676):354, 2017.
190
+
191
+ Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018.
192
+
193
+ Yee Teh, Victor Bapst, Wojciech M Czarnecki, John Quan, James Kirkpatrick, Raia Hadsell, Nicolas Heess, and Razvan Pascanu. Distral: Robust multitask reinforcement learning. In Advances in Neural Information Processing Systems, pp. 4499–4509, 2017.
194
+
195
+ Harm Van Seijen, Mehdi Fatemi, Joshua Romoff, Romain Laroche, Tavian Barnes, and Jeffrey Tsang. Hybrid reward architecture for reinforcement learning. In NIPS, pp. 5392–5402, 2017.
196
+
197
+ Ziyu Wang, Victor Bapst, Nicolas Heess, Volodymyr Mnih, Remi Munos, Koray Kavukcuoglu, and Nando de Freitas. Sample efficient actor-critic with experience replay. arXiv preprint arXiv:1611.01224, 2016.
198
+
199
+ Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. In Reinforcement Learning, pp. 5–32. Springer, 1992.
200
+
201
+ Yuhuai Wu, Elman Mansimov, Roger B Grosse, Shun Liao, and Jimmy Ba. Scalable trust-region method for deep reinforcement learning using kronecker-factored approximation. In Advances in neural information processing systems, pp. 5285–5294, 2017.
202
+
203
+ # APPENDIX
204
+
205
+ # A EFFECTS OF FLIPPING
206
+
207
+ While introducing the variability-weighted reward, a flipping operation is conducted in the preprocessing of the reward sequence as formulated in Eq. (3). In Figure 5 and 6, we construct 4 reward sequences to show that the flipping operation can further penalize the oscillation in the recent past rewards while encourage recent stable rewards. (a1, a2, b1, b2) share the same value of immediate reward at $t = 9$ and thus the $\mathcal { R } _ { H }$ of all reward sequences are the same. Therefore, the variability-weighted reward only depends on the volatility statistics of $\delta _ { R }$ , i.e., how varied past rewards were.
208
+
209
+ ![](images/b8c96c2bfb2986a8131744bff4f87fb64d6ad7d6ab6465c97ddc8d0c4bc5483f.jpg)
210
+ Figure 5: Calculation without flipping.
211
+
212
+ ![](images/03f318fa74dc2f857ea0e3562e3d4f2c6896c003afc641c8b8400191574d409c.jpg)
213
+ Figure 6: Calculation with flipping.
214
+
215
+ Without flipping. In Figure 5, sequence $( a l )$ and $( a 2 )$ are mirror symmetrical to the $y$ -axis, and the only difference between them is that the recent past rewards $( t = 5 , 6 , 7 , 8 )$ ) of $( a 2 )$ are more stable than (a1). Intuitively, we want to encourage stable past rewards like $( a 2 )$ while penalizing oscillation in (a1). As presented in the third row of Figure 5, the $r ^ { v w r }$ difference of $( a I )$ and $( a 2 )$ is less than 1 without flipping in the pre-processing.
216
+
217
+ With flipping. In Figure 6, (b1, b2) exactly have the same reward sequence as $( a l , a 2 )$ , respectively. However, flipping is performed as a step of pre-processing, largely increasing the $r ^ { v w r }$ gap (from less than 1 to nearly 4) between the two constructed sequences. Comparing $( b l , b 2 )$ with $( a l , a 2 )$ , the post-processed sequences $\vec { \mathcal { R } }$ (shown in green) become centrosymmetric to those without flipping. Specifically, the recent reward drops at $t = 6 , 7 , 8$ are reflected as high values at the beginning of $\vec { \mathcal { R } }$ as shown in $( b l )$ , while oscillations long ago are transformed into high values at the end of $\vec { \mathcal { R } }$ as presented in $( b 2 )$ . When compared to the zero-variability reference (shown in orange), which is designed as an exponential function, the flipping leads to a higher variability for the former sequence while a lower variability for the latter one, enlarging the $r ^ { v w r }$ gap between those two sequences.
218
+
219
+ # B COMPLETE RESULTS IN ATARI 2600 GAMES
220
+
221
+ We show the learning curves for 15 million timesteps on all Atari games in Figure 12 and in Table 3 we show the complete results of training til 50 million timesteps. report the mean episode reward as in Wu et al. (2017). Entries with $\sim$ indicates approximated value as retrieved from learning figures published by Wu et al. (2017). Results from other models are taken from Wu et al. (2017) and Mnih et al. (2015). We show that A2MC has reached a human-level performance rate of $7 4 . 5 \%$ (38 out of 51 games) as compared to $6 3 . 6 \%$ reached by ACKTR. The relative performance margin of A2MC as compared to ACKTR is also shown.
222
+
223
+ # C HYPER-PARAMETER STUDIES
224
+
225
+ The proposed variability-weighted reward mechanism considers the volatility of rewards by keeping a $T$ -step history of agent’s performance. The hyper-parameter $T = 2 0$ is empirically chosen to be the same as the look-ahead parameter $N$ in standard on-policy methods, so as to keep the same period $\textstyle T = N = 2 0$ ) in “T-step history” and “N-step forward”. And $\sigma _ { m a x } = 1$ is chosen as the maximum of the observed volatility based on statistics in the $\mathrm { T }$ history rewards of the ACKTR models. As parameter choices could be vital, we perform an additional ablation study shown below. The result shows that the performance of A2MC is robust across different parameters of choice and is not too sensitive to changes on either of the hyper-params.
226
+
227
+ <table><tr><td>Games</td><td>ACKTR</td><td>A2MC w/</td><td>T=20 Omax=1</td><td>T=10 Omax=1</td><td>T=10 0max=2</td><td>T=40 Omax=1</td><td>T=40 Omax=2</td></tr><tr><td>Boxing</td><td>1.23</td><td></td><td>99.19</td><td>94.76</td><td>98.51</td><td>99.18</td><td>98.07</td></tr><tr><td>Jamesbond</td><td>409.50</td><td></td><td>453.50</td><td>438.50</td><td>470.00</td><td>442.25</td><td>457.75</td></tr><tr><td>Wizard of Wor</td><td>744.50</td><td></td><td>5448.00</td><td>5601.00</td><td>5363.50</td><td>2528.50</td><td>3287.50</td></tr></table>
228
+
229
+ ![](images/162bf3e0520ec61e2d4440c63fcb2a71cb0c9e75a49eabbe055eb3df783697fa.jpg)
230
+ Figure 7: “Stress testing” ablation study on the MuJoCo continuous benchmark using hyperparameters tuned in Atari discrete control. Although this set of hyperparameters is suboptimal for the MuJoCo continuous control tasks, A2MC still obtain reasonable performance in the long run and it is less prone to overfitting.
231
+
232
+ Table 3: Raw scores across all games, starting with 30 no-op actions. Scores are reported by averaging the last 500 episodes upon 50 million timesteps of training as in Wu et al. (2017). A relative margin comparing A2MC to ACKTR is shown. Scores from other models are taken from Wu et al. (2017) and Mnih et al. (2015).
233
+
234
+ <table><tr><td>GAME</td><td>Human</td><td>DQN</td><td>DDQN Prior. Duel</td><td></td><td>ACKTR OurA2MC</td><td></td><td>(Margin)</td></tr><tr><td>Alien</td><td>7127.7</td><td>1620</td><td>3747.7</td><td>3941</td><td>3197.1</td><td>2986.3</td><td>-6.6%</td></tr><tr><td>Amidar</td><td>1719.5</td><td>978</td><td>1793.3</td><td>2296.8</td><td>1059.4</td><td>2040.1</td><td>92.6%</td></tr><tr><td>Assault</td><td>742.0</td><td>4280.4</td><td>5393.2</td><td>11477</td><td>10777.7</td><td>9892.4</td><td>-8.2%</td></tr><tr><td>Asterix</td><td>8503.3</td><td>4359</td><td>17356.5</td><td>375080</td><td>31583.0</td><td>32671.0</td><td>3.4%</td></tr><tr><td>Asteroids</td><td>47388.7</td><td>1364.5</td><td>734.7</td><td>1192.7</td><td>34171.6</td><td>828931.6</td><td>2325.8%</td></tr><tr><td>Atlantis</td><td>29028.1</td><td>279987</td><td>106056</td><td>395762</td><td>3433182.0</td><td>2886274.0</td><td> -15.9%</td></tr><tr><td>Bankheist</td><td>753.1</td><td>455</td><td>1030.6</td><td>1503.1</td><td>1289.7</td><td>1290.6</td><td>0.1%</td></tr><tr><td>Battlezone</td><td>37187.5</td><td>29900</td><td>31700</td><td>35520</td><td>8910.0</td><td>10570.0</td><td>18.6%</td></tr><tr><td>Beamrider</td><td>16926.5</td><td>8627.5</td><td>13772.8</td><td>30276.5</td><td>13581.4</td><td>13715.6</td><td>1.0%</td></tr><tr><td>Berzerk</td><td>2630.4</td><td>585.6</td><td>1225.4</td><td>3409</td><td>927.2</td><td>974.0</td><td>5.0%</td></tr><tr><td>Bowling</td><td>160.7</td><td>50.4</td><td>68.1</td><td>46.7</td><td>24.3</td><td>31.6</td><td>30.0%</td></tr><tr><td>Boxing</td><td>12.1</td><td>88</td><td>91.6</td><td>98.9</td><td>1.5</td><td>93.5</td><td>6344.8%</td></tr><tr><td>Breakout</td><td>30.5</td><td>385.5</td><td>418.5</td><td>366</td><td>735.7</td><td>420.6</td><td>-42.8%</td></tr><tr><td>Centipede</td><td>12017.0</td><td>4657.7</td><td>5409.4</td><td>7687.5</td><td>7125.3</td><td>12096.5</td><td>69.8%</td></tr><tr><td>Choppercommand</td><td>9882.0</td><td>N/A</td><td>N/A</td><td>N/A</td><td>~8000</td><td>12149.0</td><td>~42.5%</td></tr><tr><td>Crazyclimber</td><td>35829.4</td><td>110763</td><td>117282</td><td>162224</td><td>150444.0</td><td>152439.0</td><td>1.3%</td></tr><tr><td>Demonattack</td><td>1971.0</td><td>12149.4</td><td>58044.2</td><td>72878.6</td><td>274176.7</td><td>361807.1</td><td>32.0%</td></tr><tr><td>Doubledunk</td><td>-16.4</td><td>-6.6</td><td>-5.5</td><td>-12.5</td><td>-0.5</td><td>20.6</td><td>3907.5%</td></tr><tr><td>Enduro</td><td>860.5</td><td>729</td><td>1211.8</td><td>2306.4</td><td>0.0</td><td>3550.6</td><td>8%</td></tr><tr><td>Fishingderby</td><td>-38.7</td><td>-4.9</td><td>15.5</td><td>41.3</td><td>33.7</td><td>38.4</td><td>13.9%</td></tr><tr><td>Freeway</td><td>29.6</td><td>30.8</td><td>33.3</td><td>33</td><td>0.0</td><td>32.7</td><td>0%</td></tr><tr><td>Frostbite</td><td>4335.0</td><td>N/A</td><td>N/A</td><td>N/A</td><td>~280</td><td>293.7</td><td>~5.1%</td></tr><tr><td>Gopher</td><td>2412.5</td><td>8777.4</td><td>14840.8</td><td>104368.2</td><td>47730.8</td><td>86101.4</td><td>80.4%</td></tr><tr><td>Gravitar</td><td>2672.0</td><td>N/A</td><td>N/A</td><td>N/A</td><td>~300</td><td>995.0</td><td>-2.9%</td></tr><tr><td>Icehockey</td><td>0.9</td><td>-1.9</td><td>-2.7</td><td>-0.4</td><td>-4.2</td><td>-2.1</td><td>16.3%</td></tr><tr><td>Jamesbond</td><td>302.8</td><td>768.5</td><td>1358</td><td>812</td><td>490.0</td><td>545.0</td><td>11.2%</td></tr><tr><td>Kangaroo</td><td>3035.0</td><td>7259</td><td>12992</td><td>1792</td><td>3150.0</td><td>11269.0</td><td>257.7%</td></tr><tr><td>Krull</td><td>2665.5</td><td>8422.3</td><td>7920.5</td><td>10374.4</td><td>9686.9</td><td>10245.4</td><td>5.8%</td></tr><tr><td>Kungfumaster</td><td>22736.3</td><td>26059</td><td>29710</td><td>48375</td><td>34954.0</td><td>39773.0</td><td>13.8%</td></tr><tr><td>Mspacman</td><td>15693.0</td><td>N/A</td><td>N/A</td><td>N/A</td><td>~3500</td><td>5006.1</td><td>~34.5%</td></tr><tr><td>Namethisgame</td><td>4076.0</td><td>N/A</td><td>N/A</td><td>N/A</td><td>~12500</td><td>12569.9</td><td>~0.6%</td></tr><tr><td>Phoenix</td><td>7242.6</td><td>8485.2</td><td>12252.5</td><td>70324.3</td><td>133433.7</td><td>221288.3</td><td>65.8%</td></tr><tr><td>Pitfall</td><td>6463.7</td><td>-286.1</td><td>-29.9</td><td>0</td><td>-1.1</td><td>-2.5</td><td>-0.3%</td></tr><tr><td>Pong</td><td>14.6</td><td>20.9</td><td>21</td><td>20.9</td><td>20.9</td><td>19.7</td><td>-5.9%</td></tr><tr><td>Privateeye</td><td>69571.0</td><td>N/A</td><td>N/A</td><td>N/A</td><td>~560</td><td>507.0</td><td>-9.5%</td></tr><tr><td>Qbert</td><td>13455.0</td><td>13117.3</td><td>15088.5</td><td>18760.3</td><td>23151.5</td><td>24075.8</td><td>4.0%</td></tr><tr><td>Riverraid</td><td>17118.0</td><td>7377.6</td><td>14884.5</td><td>20607.6</td><td>17762.8</td><td>18671.9</td><td>5.1%</td></tr><tr><td>Roadrunner</td><td>7845.0</td><td>39544</td><td>44127</td><td>62151</td><td>53446.0</td><td>50071.0</td><td>-6.3%</td></tr><tr><td>Robotank</td><td>11.9</td><td>63.9</td><td>65.1</td><td>27.5</td><td>16.5</td><td>26.5</td><td>60.5%</td></tr><tr><td>Seaquest</td><td>42054.7</td><td>5860.6</td><td>16452.7</td><td>931.6</td><td>1776.0</td><td>1805.6</td><td>1.7%</td></tr><tr><td>Solaris</td><td>12326.7</td><td>3482.8</td><td>3067.8</td><td>133.4</td><td>2368.6</td><td>2277.2</td><td>-3.9%</td></tr><tr><td>Spaceinvaders</td><td>1668.7</td><td>1692.3</td><td>2525.5</td><td>15311.5</td><td>19723.0</td><td>13544.2</td><td>-31.3%</td></tr><tr><td>Stargunner</td><td>10250.0</td><td>54282</td><td>60142</td><td>125117</td><td>82920.0</td><td>89616.0</td><td>8.1%</td></tr><tr><td>Tennis</td><td>-8.9</td><td>N/A</td><td>N/A</td><td>N/A</td><td>~-12</td><td>-4.7</td><td>~20.4%</td></tr><tr><td>Timepilot</td><td>5229.2</td><td>4870</td><td>8339</td><td>7553</td><td>22286.0</td><td>21992.0</td><td>-1.3%</td></tr><tr><td>Tutankham</td><td>167.6</td><td>68.1</td><td>218.4</td><td>245.9</td><td>314.3</td><td>193.7</td><td>-38.4%</td></tr><tr><td>Upndown</td><td>11693.2</td><td>9989.9</td><td>22972.2</td><td>33879.1</td><td>436665.8</td><td>563659.3</td><td>29.1%</td></tr><tr><td>Videopinball</td><td>17667.9</td><td>196760.4</td><td>309941.9</td><td>479197</td><td>100496.0</td><td>127452.4</td><td>26.8%</td></tr><tr><td>Wizardofwor YarsRevenge</td><td>4756.5</td><td>2704</td><td>7492</td><td>12352</td><td>702.0 125169.0</td><td>7864.0 143141.5</td><td>1020.2% 14.4%</td></tr></table>
235
+
236
+ # D EXTENSION TO MULTI-CRITIC PPO (MC-PPO)
237
+
238
+ The learning results of the proposed MC-PPO model on the MuJoCo tasks are shown in Figure 8. MC-PPO shows the best performance on Hopper and Walker- $_ { 2 d }$ among all models under the 1-million timesteps training budget. Both of our multi-critics variants (A2MC and MC-PPO) have won 6 out of the 8 MuJoCo tasks with relative performance margins (percentages in parentheses) larger than $2 5 \%$ .
239
+
240
+ ![](images/47b1442f99fadd4e266ec71e7ffe602454c89c06ae82dbdc9f5bc465cc0f2b12.jpg)
241
+ Figure 8: Performance on the MuJoCo continuous control benchmarks using PPO-based methods. Our proposed long/short-term reward characterization can be extended to the PPO method, i.e., the proposed multi-critic variant of PPO (MC-PPO). The shaded region denotes the standard deviation over 3 random seeds.
242
+
243
+ # E EXTENSION TO OFF-POLICY METHODS
244
+
245
+ Methods involving experience replay belong to the family of off-policy methods as they learn from off-policy trajectories. They were considered to be beyond the scope of this work, as we set out to improve the family of “on-policy” methods and we try to present as complete the analyses as possible (on both Atari and MuJoCo) in the main text.
246
+
247
+ Notwithstanding this, we have been actively exploring the potential of applying the proposed reward mechanism with off-policy methods (in particular, on the strong baseline Rainbow Hessel et al. (2018). For consistencies in comparisons, all hyperparameters (e.g., learning rate, distributional atoms, noisy net $\sigma _ { 0 }$ ) are kept identical as in Hessel et al. (2018) except that we used a smaller replay buffer size of 50,000 for both the baseline and our method (due to limited compute). Moreover, we use the same experiment settings as in Sec 6 and we have NOT further tuned any parameters in VWR. We show preliminary results at 10 million time steps on Atari games in Figure 9 and we observe it is promising that introducing the proposed characterization of variability-weighted reward mechanism improves off-policy methods as well.
248
+
249
+ The robustness of our proposed reward mechanism across both on-policy and off-policy frameworks suggests that the concept of “risk-adjusted return” Sharpe (1994) should apply in reinforcement learning in general, as it brings the desired property in faciliating better sample efficiency and learning stability. Given limited time and computing resources we are not able to present a full analysis on all the off-policy frameworks as we did for the on-policy methods within this paper (since training off-policy models takes significantly longer time). Potentially we aim to have the complete results in an additional paper in our future works.
250
+
251
+ ![](images/49950388de336cc09e187e4bf97c4e8d8151b5317eb9c6ae2d692622fb39fa69.jpg)
252
+ Figure 9: Performance of applying the variability-weighted reward to the Rainbow model on the Atari benchmark. We observe that introducing the proposed reward characterizations significantly expediate the learning in games such as “Jamesbond” and “NameThisName”, while showing consistent improvement towards the rest. The shaded region denotes the standard deviation over 2 random seeds.
253
+
254
+ # F CASE STUDY: PLAYING DOOM WITH REWARD SHAPING
255
+
256
+ It is worth investigating whether the proposed auxiliary reward signal VWR can work “side-by-side” with carefully shaped rewards specific to some particular game scenario – for example, the FPS game Doom Lample & Chaplot (2017). As our proposed reward characterization is generic in design and orthogonal to reward shaping, we aim to validate that the concept of risk-adjusted return and variability weights can be equally applied under such shaping settings.
257
+
258
+ To this end, we adopt the off-policy agent “Arnold” Lample & Chaplot (2017) with experience replay as our baseline and we calculate VWR (see Section 4]) based on the historical sequence of the shaped rewards defined in Lample & Chaplot (2017) (See the Table 4). For VWR parameters, we set $\sigma _ { m a x } = 5$ since the maximum (minimum) attainable reward is $5 . 0 \ : ( - 5 . 0 )$ under such reward shaping3. The rest of the game setup and bot numbers are defaulted to the code released by Lample & Chaplot (2017).
259
+
260
+ Table 4: Reward shaping settings as in Arnold Lample & Chaplot (2017)
261
+
262
+ <table><tr><td>Type</td><td>Base /Dist Kill</td><td></td><td></td><td></td><td> Suicide Death Injured Use ammo Weapon /Ammo /Medkit /Armor</td></tr><tr><td>Value</td><td>0.0 5.0 -5.0</td><td>-5.0 -1.0</td><td></td><td>-0.2</td><td>1.0 / 1.0/ 1.0 /1.0</td></tr></table>
263
+
264
+ We follow the evaluation criterion of Track-1 in ViZDoom AI Competition 2016 using “Frags per episode”, i.e., the number of kills minus the number of suicides for the agent in one round of game (higher is better). The result under 50 training hours is shown in Figure 10 and we consistently observe that the Arnold agent can be significantly boosted with the help of VWR. This confirms that our proposed reward characterization is able to bring further improvements on top of both reward shaping and experience replay methods across domains.
265
+
266
+ <table><tr><td colspan="3">(a) Game statistics in 50 hours</td></tr><tr><td>After 24 hours</td><td>Arnold</td><td>Arnod + VWR</td></tr><tr><td>Kills</td><td>105</td><td>183</td></tr><tr><td>Frags</td><td>87</td><td>173</td></tr><tr><td>K/D ratio</td><td>1.48</td><td>2.08</td></tr><tr><td>After 50 hours</td><td></td><td></td></tr><tr><td>Kills</td><td>116</td><td>244</td></tr><tr><td>Frags</td><td>113</td><td>223</td></tr><tr><td>K/D ratio</td><td>2.00</td><td>2.65</td></tr></table>
267
+
268
+ ![](images/db55751aa06be9678b9b3cbbc236a6556fe7f569ecf88f6d40f94b718c84ff35.jpg)
269
+ Figure 10: Doom - Limited Deathmatch (Track-1)
270
+
271
+ (b) Learning results averaged over 2 random seeds
272
+
273
+ # G ABLATION STUDY: VWR V.S. ELIGIBILITY TRACE
274
+
275
+ Eligibility traces $\mathrm { T D } ( \lambda )$ is widely used in bridging TD algorithms to Monte Carlo (MC) methods.
276
+ Essentially, the discounted cumulative return can be formulated by not just toward “any n-step” return (using n-step look ahead), but toward any average of n-step look-ahead returns Sutton & Barto (2018).
277
+ The online variant of generalized advantage estimation using eligibility traces (GAE) Schulman et al.
278
+ (2016) confirms that on-policy methods can benefit from $\mathrm { T D } ( \lambda )$ learning.
279
+
280
+ For the proposed variability-weighted reward, the design theme is to look explicitly backward and to assess the past performance of the agent via the “risk-adjusted return” concept. These two mechanisms can be combined seamlessly via Eq. 8 and our empirical results suggest VWR brings further improvements on top of eligibility traces.
281
+
282
+ As VWR and eligibility traces are thematically similar in some sense, we further perform an ablation study to contrast the contributions brought by VWR. As shown in Figure 11, we compare three different settings: (1) ACKTR $^ +$ GAE, (2) ACKTR $^ +$ vwr and (3) $\mathbf { A C K T R } + \mathbf { G A E } + \mathbf { v w r }$ (i.e., the proposed A2MC). We observe that on average VWR brings greater improvements compared to eligibility traces, and the combination of both (i.e., A2MC) results in consistently good performance across the Atari testbed.
283
+
284
+ ![](images/07967da42241a720cc821748d81b04ae5e04c2e52c7cff56b270943ae05ee01a.jpg)
285
+ Figure 11: Ablation study of separately applying the (1) the eligibility traces (GAE) and (2) variabilityweighted reward (VWR) to the ACKTR model on the Atari benchmark. We observe that the combination of both (i.e., A2MC) results in consistently good performance across the Atari testbed. The shaded region denotes the standard deviation over 2 random seeds.
286
+
287
+ # H THE SHARPE RATIO ITSELF
288
+
289
+ We have explored other forms of reward that fits the general idea of introducing variability weights to the reward shaping mechanism. One example is the “Sharpe Ratio” itself, which is defined as $\begin{array} { r } { r ^ { S R } \ = \ \frac { \mathbb { E } [ r ] } { \sigma ( r ) } } \end{array}$ . In our initial studies, we found it only improved upon the baseline marginally, as rSR could end up emphasizing on penalizing high-variations and it might discourage the agent too intensively (see Figure below). Thats why we have sought an alternative formulation using the proposed $r ^ { v w r }$ and found that $A 2 M C _ { V \bar { W } R } ~ > ~ A 2 M \bar { C _ { S R } } ~ > ~ A C K T R$ . An example highlighting the vwr benefit is provided in Appendix A and a more thorough survey on key components in reward designs/formulations will be included in our future works.
290
+
291
+ # I ALGORITHM
292
+
293
+ The learning algorithm of A2MC is shown in Algorithm 1.
294
+
295
+ ![](images/253d4905e0b1e4bda4a2e88e4a8861653c091bb27f95f978262ed8fdd7f93806.jpg)
296
+
297
+ # Algorithm 1 Advantage Actor Multi-Critic Learning (A2MC)
298
+
299
+ 1: Initialize parameters: $\theta _ { a } , \theta _ { v } ^ { j } , j \in \{ \mathrm { s h o r t - t e r m } , \mathrm { l o n g - t e r m } \}$
300
+ 2: Initialize look-ahead steps: $N$ , step counter: $T = 0$ , maximum step: $T _ { m a x }$
301
+ 3: Initialize hot-wire probability: $\epsilon$
302
+ 4: Initialize environment: Env
303
+ 5: Initialize reward history: \~r
304
+ 6: repeat
305
+ 7: Reset gradients: $d \theta \gets 0$ and $d \theta _ { v } ^ { j } \gets 0 , j \in \{ \mathrm { s h o r t } \mathrm { - t e r m } , \mathrm { l o n g } \mathrm { - t e r m } \}$
306
+ 8: Get state: $s _ { t } \gets E n v$
307
+ 9: $f l a g = 1$ , $a _ { r a n d }$ is uniformly sampled in action space with probability $\epsilon$ , otherwise $f l a g = 0$
308
+ 10: for $t = 0 : N - 1$ do
309
+ 11: Perform $a _ { t }$ according to policy $\pi ( a _ { t } | s _ { t } ; \theta _ { a } )$ if not f lag else $a _ { t } = a _ { r a n d }$
310
+ 12: Received reward $r _ { t }$ and new state $s _ { t + 1 }$ , append $r _ { t }$ to $\vec { \bf r }$
311
+ 13: Calculate $r _ { t } ^ { v w r }$ from $\vec { \mathbf { r } }$ based on Eq. (2-7)
312
+ 14: $T \gets T + \dot { 1 }$
313
+ 15: end for
314
+ 16: $R ^ { \mathrm { s h o r t - t e r m } } = V ( s _ { N } ; \theta _ { v } ^ { \mathrm { s h o r t - t e r m } } )$
315
+ 17: $R ^ { \mathrm { { l o n g - t e r m } } } = V ( s _ { N } ; \theta _ { v } ^ { \mathrm { { l o n g - t e r m } } } )$
316
+ 18: for $i = N - 1$ to 0 step $- 1$ do
317
+ 19: $\begin{array} { l } { { R _ { } ^ { \mathrm { s h o r t - t e r m } } r _ { i } + \bar { \gamma } R ^ { \mathrm { s h o r t - t e r m } } } } \\ { { R _ { } ^ { \mathrm { l o n g - t e r m } } r _ { i } ^ { v w r } + \gamma R ^ { \mathrm { l o n g - t e r m } } } } \end{array}$
318
+ 20:
319
+ 21: Advantange gradients wrt $\begin{array} { r } { \theta _ { a } : d \theta _ { a } \gets d \theta _ { a } + \nabla _ { \theta _ { a } } \log \pi ( a _ { i } | s _ { i } ; \theta _ { a } ) \sum _ { j } ( R ^ { j } - V ( s _ { i } ; \theta _ { v } ^ { j } ) ) } \end{array}$
320
+ 22: for $j \in$ {short-term, long-term} do
321
+ 23: Accumulate gradients wrt $\dot { \theta } _ { v } ^ { j } : d \theta _ { v } ^ { j } d \theta _ { v } ^ { j } + \partial ( R ^ { j } - V ( s _ { i } ; \theta _ { v } ^ { j } ) ) ^ { 2 } / \partial \theta _ { v } ^ { j }$
322
+ 24: end for
323
+ 25: end for
324
+ 26: until $T \geq T _ { m a x }$
325
+
326
+ ![](images/9fd25f5ccbc9cf96954f6fdd9cbc44a1bd0277357795eda6b54b4793ba59308d.jpg)
327
+ Figure 12: Performance of A2MC on Atari games. The number in figure legend shows the average reward among the last 100 episodes upon 15 million timesteps and the percentage shows the performance margin as compared to ACKTR. The shaded region denotes the standard deviation over 2 random seeds.
md/train/HXjt-kRBzvu/HXjt-kRBzvu.md ADDED
@@ -0,0 +1,391 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Bayesian Network Structure Learning using Digital Annealer
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Annealing processors, which efficiently solve a quadratic unconstrained binary
11
+ 2 optimization (QUBO), are a potential breakthrough in improving the accuracy
12
+ 3 of score-based Bayesian network structure learning. However, currently, the bit
13
+ 4 capacity of an annealing processor is very limited. To utilize the power of an
14
+ 5 nealing processors, it is necessary to encode score-based learning problems into
15
+ 6 QUBO within the upper bound of bits. In this paper, we propose a novel approach
16
+ 7 with direct encoding of candidate parent sets in the form of Cartesian products.
17
+ 8 Experimental results on benchmark networks with 27 to 70 variables show that
18
+ 9 our approach requires lesser bits than the bit capacity of the second-generation
19
+ 10 Fujitsu digital annealer, a fully coupled annealing processor developed by with
20
+ 11 semiconductor technology. Moreover, we demonstrate that the digital annealer
21
+ 12 with our conversion method consistently outperforms the state-of-the-art heuristic
22
+ 13 algorithms on the benchmark networks.
23
+
24
+ # 14 1 Introduction
25
+
26
+ 15 A Bayesian network is a probabilistic graphical model that represents the structure of a joint probabil
27
+ 16 ity distribution among random variables in a directed acyclic graph (DAG) [Pearl, 1988]. One class
28
+ 17 of associated computational problems is learning the structure of a Bayesian network from data. We
29
+ 18 focus on score-based Bayesian network structure learning for finding the DAG with a maximal score
30
+ 19 that depends on the data [Cooper and Herskovits, 1992, Cowell, 2001].
31
+ 20 The Bayesian network learning problem is NP-hard [Chickering et al., 2004]; therefore, the standard
32
+ 21 methodology is using heuristic approaches. Many algorithms have been proposed to improve the
33
+ 22 accuracy and to reduce the running time. A search over the space of orderings [Teyssier and Koller,
34
+ 23 2005, Scanagatta et al., 2015] is one of the most successful heuristic approaches.
35
+ 24 Annealing processors may contribute to finding a high-scoring network structure in a realistic
36
+ 25 timeframe. An annealing processor is expected to be an alternative hardware to von Neumann
37
+ 26 computers for quadratic unconstrained binary optimization (QUBO) problems. In particular, it is
38
+ 27 reported that complementary metal oxide semiconductor (CMOS) annealing processors already
39
+ 28 outperform conventional computers on the speed of solving max-cut problems [Gyoten et al., 2018].
40
+ 29 We note that the bit capacity of an annealing processor is currently limited. Therefore, we need an
41
+ 30 efficient conversion method of Bayesian network structure learning into QUBO within the limited
42
+ 31 bits. Additionally, it is also important to show the lower bounds of penalty coefficients because the
43
+ 32 precision for the biases and variable couplers is limited.
44
+ 33 Annealing processors are classified into the nearest neighbor type and the fully connected type
45
+ 34 [Yamamoto, 2020]. While the coupling nodes of a nearest neighbor annealing processor is limited to
46
+ 35 only between adjacent nodes, the coupling exists between arbitrary nodes of a fully coupled annealing
47
+ 36 processor. Though the scalability of nearest neighbor annealing processors is high, it is necessary to
48
+ 37 consider the additional bits for minor embedding [Choi, 2008, 2010].
49
+ 38 O’Gorman et al. 2014 proposed a method to convert score-based Bayesian network structure learning
50
+ 39 into QUBO that requires $\mathcal { O } ( n ^ { 2 } )$ bits for $n$ random variables and a maximum parent set size $m = 2$ .
51
+ 40 They also demonstrated the sufficient lower bounds of penalty coefficients. However, when $m \geq 3$ ,
52
+ 41 the number of necessary auxiliary variables for a quadratization [Boros and Gruber, 2014] is at most
53
+ 42 $O ( n ( n - 1 ) ^ { \frac { m } { 2 } } )$ . This is a significant disadvantage for the current limited bit capacity of annealing
54
+ 43 processors.
55
+ 44 In this study, we propose an efficient conversion method based on the advanced identification of
56
+ 45 candidate parent sets and their representation in the form of Cartesian products. We also provide a
57
+ 46 greedy algorithm to decompose the candidate parent sets into the form of Cartesian products and
58
+ 47 prove the sufficient lower bounds of penalty coefficients.
59
+ 48 Experimental results on benchmark networks with 27 to 70 variables show that our conversion method
60
+ 49 reduces the required bits significantly in comparison to the previous work [O’Gorman et al., 2014].
61
+ 50 Our approach allows us to utilize the power of the second generation Fujitsu digital annealer, a fully
62
+ 51 coupled CMOS annealing processor [Aramon et al., 2019]. We demonstrate that the digital annealer
63
+ 52 consistently outperforms the ordering space search algorithms on the benchmark networks.
64
+
65
+ # 53 2 Background
66
+
67
+ # 2.1 Score-based Bayesian Network Structure Learning
68
+
69
+ 55 The goal of score-based Bayesian network structure learning is to find a DAG with maximal score.
70
+ 56 Given to random variables $\mathscr { X } = ( X _ { i } ) _ { i = 1 } ^ { n }$ and a complete data set of $N$ instances $\mathcal { D } = \{ D _ { 1 } , \cdot \cdot \cdot , D _ { N } \}$ ,
71
+ 57 we optimize the parent set $\Pi _ { i }$ of each random variable,
72
+
73
+ $$
74
+ \Pi _ { 1 } ^ { * } , \cdot \cdot \cdot , \Pi _ { n } ^ { * } = \underset { \Pi _ { 1 } , \cdots , \Pi _ { n } \subset { \cal X } } { \arg \operatorname* { m i n } } \sum _ { i = 1 } ^ { n } - \log S ^ { ( i ) } ( \Pi _ { i } \mid { \mathcal { D } } ) ,
75
+ $$
76
+
77
+ where 58 ${ \mathcal { G } } = ( \mathcal { V } , { \mathcal { E } } ) , \mathcal { V } = \{ 1 , \cdots , n \} , { \mathcal { E } } = \{ ( j , i ) | j , i \in \{ 1 , \cdots , n \} , X _ { j } \in \Pi _ { i } \} ,$ and $S _ { i } : \Pi _ { i } \mathbb { R }$ is a local score function corresponding to 59 $X _ { i }$ . The Bayesian Dirichlet equivalent uniform (BDeu) score 60 [Buntine, 1991] is one of the commonly used scores,
78
+
79
+ $$
80
+ S _ { \mathrm { B D e u } } ^ { ( i ) } ( \Pi _ { i } \mid \mathcal { D } ) \equiv \prod _ { j = 1 } ^ { \beta _ { i } } \frac { \Gamma ( \alpha _ { i , j } ) } { \Gamma ( N _ { i , j } + \alpha _ { i , j } ) } \prod _ { k = 1 } ^ { \gamma _ { i } } \frac { \Gamma ( N _ { i , j , k } + \alpha _ { i , j , k } ) } { \Gamma ( \alpha _ { i , j , k } ) } ,
81
+ $$
82
+
83
+ 61 ere $\begin{array} { r } { N = \sum _ { j = 1 } ^ { \beta _ { i } } N _ { i , j } , N _ { i , j } = \sum _ { k = 1 } ^ { \gamma _ { i } } N _ { i , j , k } , \alpha _ { i , j } = \sum _ { k = 1 } ^ { \gamma _ { i } } \alpha _ { i , j , k } , \beta _ { i } } \end{array}$ is the numb f joint states of $\Pi _ { i }$ is the number of states of $X _ { i }$ , $N _ { i , j , k }$ is the number of cases of the parent set $\Pi _ { i }$ 63 and Xi in its k-th state, αi,j,k = αβ γ is the hyperparameter of the Dirichlet function, and $0 < \alpha \in \mathbb { R }$ 64 is called equivalent sample size [Heckerman et al., 1995a].
84
+
85
+ # 65 2.2 Hamiltonian
86
+
87
+ 66 The Hamiltonian, which is the objective function of an annealing processor, is a quadratic pseudo
88
+ 67 Boolean function,
89
+
90
+ $$
91
+ H ( \pmb { \sigma } ) = \sum _ { i \in \mathcal { V } _ { \mathrm { A P } } } h _ { i } \sigma _ { i } + \sum _ { ( i , j ) \in \mathcal { E } _ { \mathrm { A P } } } J _ { i , j } \sigma _ { i } \sigma _ { j } ,
92
+ $$
93
+
94
+ 68 where ${ \pmb \sigma } = ( { \boldsymbol \sigma } _ { i } ) _ { i = 1 } ^ { | { \boldsymbol \nu } _ { \mathrm { A P } } | } \in \mathbb { B } ^ { | { \boldsymbol \nu } _ { \mathrm { A P } } | }$ , the biases $h _ { i } \in \mathbb { R }$ for all $i \in \mathcal { V } _ { \mathrm { A P } }$ , the couplers $J _ { i , j } \in \mathbb { R }$ for all
95
+ 69 $( i , j ) \in \mathcal { E } _ { \mathrm { A P } }$ , and the graph $\mathcal { G } _ { \mathrm { A P } } = ( \nu _ { \mathrm { A P } } , \mathcal { E } _ { \mathrm { A P } } )$ . Higher degree problems are reformed into quadratic
96
+ 70 ones using auxiliary variables. This reformulation is called quadratization.
97
+
98
+ 71 Definition 1. If a quadratic polynomial function $g ( \pmb { v } , \pmb { h } )$ is a quadratization of a pseudo-Boolean function 72 $f ( v )$ , then $f ( v ) = \operatorname* { m i n } _ { h \in \mathbb { B } ^ { J } } g ( v , h )$ for all $\pmb { v } \in \mathbb { B } ^ { I }$ .
99
+
100
+ 73 Anthony et al. 2016 proved that every pseudo-Boolean function of $I$ variables and of degree $K$ has
101
+ 74 a quadratization involving at most $\dot { \mathcal { O } } ( \dot { I } ^ { \frac { K } { 2 } } )$ auxiliary variables. In particular, at most $\check { \mathcal { O } ( 2 ^ { \frac { I } { 2 } } ) }$ when
102
+ 75 $K = I$ . It is well known that every pseudo-Boolean function can be uniquely represented as a
103
+ 76 multilinear polynomial in its variables [Boros and Hamme, 2002].
104
+
105
+ # 77 2.3 Basic Conversion of Score-based Bayesian Network Structure Learning
106
+
107
+ Using 78 $n ( n - 1 )$ bits to encode the paths into $\pmb { d } = ( ( d _ { j , i } ) _ { 1 \leq j \leq n , j \neq i } ) _ { i = 1 } ^ { n } \in \mathbb { B } ^ { n ( n - 1 ) }$ $( d _ { j , i } = 1$ if 79 $X _ { j }$ is the parent of $X _ { i }$ , $d _ { j , i } = 0$ otherwise) and $\binom { n } { 2 }$ bits to encode the topological orders into 80 $r = ( r _ { i , j } ) _ { 1 \leq i < j \leq n } \in \mathbb { B } ^ { \binom { n } { 2 } } ( r _ { i , j } =$ if the order of $X _ { i }$ is higher than $X _ { j }$ , $r _ { i , j } = 1$ otherwise), it is 81 possible to represent eq. (1) on the Hamiltonian,
108
+
109
+ $$
110
+ H _ { \mathrm { t o t a l } } ( d , r ) \equiv \sum _ { i = 1 } ^ { n } H _ { \mathrm { s c o r e } } ^ { ( i ) } ( d , i ) + H _ { \mathrm { c y c l e } } ( d , r ) .
111
+ $$
112
+
113
+ 82 The states of $d _ { \cdot , i }$ are mapped one-to-one to the states of $\Pi _ { i }$ . Let $\Pi _ { i } = \pi ^ { ( i ) } ( d _ { \cdot , i } )$ for all $1 \leq i \leq n$ .
114
+ 83 The local score of the Hamiltonian is
115
+
116
+ $$
117
+ H _ { \mathrm { s c o r e } } ^ { ( i ) } ( d _ { \cdot , i } ) \equiv - \log S ^ { ( i ) } ( \pi ^ { ( i ) } ( d _ { \cdot , i } ) \mid \mathcal { D } ) + \log S ^ { ( i ) } ( \phi \mid \mathcal { D } ) ,
118
+ $$
119
+
120
+ 84 for all $1 \leq i \leq n$ . The score function has a quadratization involving at most $\mathcal { O } ( n 2 ^ { \frac { n - 1 } { 2 } } )$ auxiliary
121
+ 85 variables. O’Gorman et al. 2014 added the maximum parent set size constraint to the Hamiltonian.
122
+ 86 In this case, the number of auxiliary variables is at most $\mathcal { O } ( n ( n - 1 ) ^ { \frac { m } { 2 } } )$ . The cycle constraint of the
123
+ 87 Hamiltonian consists of the topological order constraint and the consistency constraint,
124
+
125
+ $$
126
+ H _ { \mathrm { c y c l e } } ( d , r ) \equiv \sum _ { 1 \leq i < j < k \leq n } \delta _ { 1 } R ( r _ { i , j } , r _ { j , k } , r _ { i , k } ) + \sum _ { 1 \leq i < j \leq n } \delta _ { 2 } ( d _ { i , j } r _ { i , j } + d _ { j , i } ( 1 - r _ { i , j } ) ) ,
127
+ $$
128
+
129
+ 88 where $R ( r _ { 1 } , r _ { 2 } , r _ { 3 } ) = r _ { 1 } r _ { 2 } ( 1 - r _ { 3 } ) + ( 1 - r _ { 1 } ) ( 1 - r _ { 2 } ) r _ { 3 }$ for all $r _ { 1 } , r _ { 2 } , r _ { 3 } \in \mathbb { B }$ . When the penalty
130
+ 89 coefficients $0 < \delta _ { 1 } , \delta _ { 2 } \in \mathbb { R }$ are sufficiently large, the DAG constraint is satisfied indirectly through
131
+ 90 the relationship of the paths $^ d$ and the topological order $\pmb { r }$ . If it holds that
132
+
133
+ $$
134
+ \operatorname* { m a x } \{ 0 , \operatorname* { m a x } _ { \substack { 1 \leq j ^ { * } , i ^ { * } \leq n d _ { \cdot , j ^ { * } } \in \mathbb { B } ^ { n - 1 } } } ( H _ { \mathrm { s c o r e } } ^ { ( i ^ { * } ) } ( d _ { \cdot , i ^ { * } } ^ { ( j ^ { * } , i ^ { * } ) } ) - H _ { \mathrm { s c o r e } } ^ { ( i ^ { * } ) } ( d _ { \cdot , i ^ { * } } ) ) \} < \delta _ { 1 } < \frac { \delta _ { 2 } } { n - 2 } ,
135
+ $$
136
+
137
+ 91 then there is no cycle on the paths of the ground state, where ∗ ∗ ∗ ∗ ${ \pmb d } ^ { ( j ^ { \ast } , i ^ { \ast } ) } = ( ( d _ { j , i } ) _ { 1 \leq j \leq n , j \neq i } ^ { ( j ^ { \ast } , i ^ { \ast } ) } ) _ { i = 1 } ^ { n }$
138
+ 92 $d _ { j , i } ^ { ( j ^ { * } , i ^ { * } ) } = 0$ if $( j , i ) = ( j ^ { * } , i ^ { * } )$ , $d _ { j , i } ^ { ( j ^ { * } , i ^ { * } ) } = d _ { j , i }$ otherwise. The computational cost to obtain the left
139
+ 93 side of eq. (7) is at most $\mathcal { O } ( n ^ { m + 1 } )$ . In particular, at most $O ( n ^ { 2 } 2 ^ { n - 2 } )$ when $m = n - 1$ .
140
+
141
+ # 94 3 Candidate Parent Set Decomposition
142
+
143
+ Parent set identification is a major technique to narrow the search space of structure optimization, based on the relationship between parent sets and local scores under the DAG constraints [de Campos and Ji, 2011, Correia et al., 2020]. The collection of candidate parent sets of a random variable $X _ { i }$ is $\{ W \subseteq { \mathcal { X } } \setminus \{ X _ { i } \} \mid W ^ { \prime } \subset W \Rightarrow S ^ { ( i ) } ( W ^ { \prime } \mid { \mathcal { D } } ) < S ^ { ( i ) } ( W \mid { \mathcal { D } } ) \}$ . To reduce the required bits of the score component of the Hamiltonian, we propose an efficient conversion method with the parent set identification. We directly encode the candidate parent sets instead of using the paths $^ d$ .
144
+
145
+ Moreover, we decompose the candidate parent sets $( W _ { h , i } ) _ { h = 0 } ^ { \lambda _ { i } }$ of each random variable into the form of Cartesian products as follows:
146
+
147
+ 1. Decompose $( W _ { h , i } ) _ { h = 0 } ^ { \lambda _ { i } }$ into $( W _ { h , i } \cap Z _ { i } ) _ { h = 0 } ^ { \lambda _ { i } } , ( W _ { h , i } \cap ( { \mathcal { X } } \setminus Z _ { i } ) ) _ { h = 0 } ^ { \lambda _ { i } } ,$
148
+ 2. Remove duplicates in the elements of $( W _ { h , i } \cap Z _ { i } ) _ { h = 0 } ^ { \lambda _ { i } } , ( W _ { h , i } \cap ( { \mathcal { X } } \setminus Z _ { i } ) ) _ { h = 0 } ^ { \lambda _ { i } } ,$
149
+
150
+ $$
151
+ \because ( W _ { h , i } \cap Z _ { i } ) _ { h = 0 } ^ { \lambda _ { 1 , i } } , ( W _ { h , i } \cap ( \mathcal { X } \setminus Z _ { i } ) ) _ { h = 0 } ^ { \lambda _ { 2 , i } } \mathrm { ~ i n ~ } ( U _ { h , i } ) _ { h = 0 } ^ { \lambda _ { 1 , i } } , ( V _ { h , i } ) _ { h = 0 } ^ { \lambda _ { 2 , i } } ,
152
+ $$
153
+
154
+ where 106 $Z _ { i } \subseteq \cup _ { h = 0 } ^ { \lambda _ { i } } W _ { h , i } , W _ { 0 , i } = U _ { 0 , i } = V _ { 0 , i } = \phi , \lambda _ { i } , \lambda _ { 1 , i } , \lambda _ { 2 , i } \in \mathbb { N } \cup \{ 0 \}$ for all $1 \leq i \leq n$ . There 107 is a clear relationship,
155
+
156
+ $$
157
+ \begin{array} { r } { \{ W _ { 0 , i } , \cdots , W _ { \lambda _ { i } , i } \} \subseteq \{ U \cup V \mid ( U , V ) \in \{ U _ { 0 , i } , \cdots , U _ { \lambda _ { 1 , i } , i } \} \times \{ V _ { 0 , i } , \cdots , V _ { \lambda _ { 2 , i } , i } \} \} , } \end{array}
158
+ $$
159
+
160
+ 108 for all $1 \leq i \leq n$ . Here, given that the Hamiltonian is a quadratic pseudo-Boolean function, we can represent the score against 109 fore, it is possible to encod110 $U _ { h , i } \cup V _ { h ^ { \prime } , i }$ by allocating ate parent sets $U _ { h , i } , V _ { h ^ { \prime } , i }$ to two bits on thamiltonian using $( U _ { h , i } ) _ { h = 0 } ^ { \lambda _ { 1 , i } } , ( V _ { h , i } ) _ { h = 0 } ^ { \lambda _ { 2 , i } }$ 111 The number of required bits of the score component of the Hamiltonian is ${ \textstyle \sum _ { i = 1 } ^ { n } } ( \lambda _ { 1 , i } + \lambda _ { 2 , i } )$ .
161
+
162
+ 112 Example 1. An example of the candidate parent sets in the form of Cartesian products as follows:
163
+
164
+ $$
165
+ \begin{array} { r l } & { \mathcal { X } = \{ X _ { 1 } , X _ { 2 } , X _ { 3 } , X _ { 4 } \} , \ Z _ { i } = \{ X _ { 1 } , X _ { 2 } \} , \ \lambda _ { i } = 5 , \ \lambda _ { 1 , i } = 2 , \ \lambda _ { 2 , i } = 1 } \\ & { ( W _ { h , i } ) _ { h = 0 } ^ { \lambda _ { i } } = ( \phi , \{ X _ { 1 } \} , \{ X _ { 1 } , X _ { 2 } \} , \{ X _ { 3 } , X _ { 4 } \} , \{ X _ { 1 } , X _ { 3 } , X _ { 4 } \} , \{ X _ { 1 } , X _ { 2 } , X _ { 3 } , X _ { 4 } \} ) , } \\ & { ( W _ { h , i } \cap Z _ { i } ) _ { h = 0 } ^ { \lambda _ { i } } = ( \phi , \{ X _ { 1 } \} , \{ X _ { 1 } , X _ { 2 } \} , \phi , \{ X _ { 1 } \} , \{ X _ { 1 } , X _ { 2 } \} ) , } \\ & { ( W _ { h , i } \cap ( \mathcal { X } \setminus Z _ { i } ) ) _ { h = 0 } ^ { \lambda _ { i } } = ( \phi , \phi , \phi , \{ X _ { 3 } , X _ { 4 } \} , \{ X _ { 3 } , X _ { 4 } \} , \{ X _ { 3 } , X _ { 4 } \} ) , } \\ & { ( U _ { h , i } ) _ { h = 0 } ^ { \lambda _ { 1 , i } } = ( \phi , \{ X _ { 1 } \} , \{ X _ { 1 } , X _ { 2 } \} ) , \ ( V _ { h , i } ) _ { h = 0 } ^ { \lambda _ { 2 , i } } = ( \phi , \{ X _ { 3 } , X _ { 4 } \} ) . } \end{array}
166
+ $$
167
+
168
+ We optimize 113 $Z _ { i } \subseteq \cup _ { h = 0 } ^ { \lambda _ { i } } W _ { h , i }$ to minimize $\lambda _ { 1 , i } + \lambda _ { 2 , i }$ . However, it is often infeasible to search all 114 elements of the power set $\mathcal { P } ( \cup _ { h = 0 } ^ { \lambda _ { i } } W _ { h , i } )$ . Therefore, we heuristically search 3 $Z _ { i }$ adding elements one by one, as algorithm 1. The computational cost is at most $1 \leq i \leq n$
169
+
170
+ # Algorithm 1 Greedy Candidate Parent Set Decomposition
171
+
172
+ 1: Input: $( W _ { h , i } ) _ { h = 0 } ^ { \lambda _ { i } }$ Output: $Z$ Initialize: $\lambda \lambda _ { i } , Z ^ { \prime } \phi , Z \phi$ .
173
+ 2: for $d = 1$ to $| \cup _ { h = 0 } ^ { \lambda _ { i } } W _ { h , i } | - 1$ do
174
+ 3: for $X$ in $\cup _ { h = 0 } ^ { \lambda _ { i } } W _ { h , i } \setminus Z$ do
175
+ 4: if $\lambda _ { 1 , i } + \lambda _ { 2 , i } < \lambda$ for $Z _ { i } = Z \cup \{ X \}$ then $\lambda \lambda _ { 1 , i } + \lambda _ { 2 , i } , Z ^ { \prime } Z \cup \{ X \} .$ .
176
+ 5: if $Z \neq Z ^ { \prime }$ then $Z Z ^ { \prime }$ else break
177
+
178
+ 115
179
+
180
+ 116 Example 2. An example of the bit reduction flow of algorithm 1 is as follows:
181
+
182
+ $$
183
+ \begin{array} { r l } & { Z _ { i } = \phi , \lambda _ { 1 , i } = 0 , \lambda _ { 2 , i } = 5 : ( \phi ) \times ( \phi , \{ X _ { 1 } \} , \{ X _ { 1 } , X _ { 2 } \} , \{ X _ { 3 } , X _ { 4 } \} , \{ X _ { 1 } , X _ { 3 } , X _ { 4 } \} , \{ X _ { 1 } , X _ { 2 } , X _ { 3 } , X _ { 4 } \} , \{ X _ { 1 } , X _ { 3 } , X _ { 3 } \} , } \\ & { Z _ { i } = \{ X _ { 1 } \} , \lambda _ { 1 , i } = 1 , \lambda _ { 2 , i } = 3 : ( \phi , \{ X _ { 1 } \} ) \times ( \phi , \{ X _ { 2 } \} , \{ X _ { 3 } , X _ { 4 } \} , \{ X _ { 2 } , X _ { 3 } , X _ { 4 } \} ) , } \\ & { Z _ { i } = \{ X _ { 1 } , X _ { 2 } \} , \lambda _ { 1 , i } = 2 , \lambda _ { 2 , i } = 1 : ( \phi , \{ X _ { 1 } \} , \{ X _ { 1 } , X _ { 2 } \} ) \times ( \phi , \{ X _ { 3 } , X _ { 4 } \} ) . } \end{array}
184
+ $$
185
+
186
+ # 117 4 Efficient Conversion of Score-based Bayesian Network Structure Learning
187
+
188
+ We make 118 $( U _ { h , i } ) _ { h = 0 } ^ { \lambda _ { 1 , i } } , ( V _ { h , i } ) _ { h = 0 } ^ { \lambda _ { 2 , i } }$ correspond to $( p _ { h , i } ) _ { h = 0 } ^ { \lambda _ { 1 , i } } , ( q _ { h , i } ) _ { h = 0 } ^ { \lambda _ { 2 , i } }$ one-to-one, where $p _ { h , i } , q _ { h ^ { \prime } , i } \in \mathbb { B }$ 119 for all $0 \leq h \leq \lambda _ { 1 , i } , 0 \leq h ^ { \prime } \leq \lambda _ { 2 , i } , 1 \leq i \leq n$ . To identify the parent sets, we use the one-to-one 120 correspondence constraint that $\begin{array} { r } { \sum _ { h = 0 } ^ { \lambda _ { 1 , i } } p _ { h , i } = \sum _ { h = 0 } ^ { \lambda _ { 2 , i } } q _ { h , i } = 1 } \end{array}$ for all $1 \leq i \leq n$ . The Hamiltonian 121 consists of the score component, the one-to-one correspondence constraint, and the cycle constraint,
189
+
190
+ $$
191
+ H _ { \mathrm { t o t a l } } ^ { * } ( p , q , r ) \equiv \sum _ { i = 1 } ^ { n } ( H _ { \mathrm { s c o r e } } ^ { * ( i ) } ( p . , i , q . , i ) + H _ { \mathrm { o n e } } ^ { * ( i ) } ( p . , i , q . , i ) ) + H _ { \mathrm { c y c l e } } ^ { * } ( p , q , r ) ,
192
+ $$
193
+
194
+ where 122 $\pmb { p } = ( ( p _ { h , i } ) _ { h = 0 } ^ { \lambda _ { 1 , i } } ) _ { i = 1 } ^ { n } , \pmb { q } = ( ( q _ { h , i } ) _ { h = 0 } ^ { \lambda _ { 2 , i } } ) _ { i = 1 } ^ { n }$ . Under the one-to correspondence constraint,
195
+ 123 we can represent the paths among random variables indirectly using $\mathbf { \omega } _ { p , q }$
196
+ 124 variables,
197
+
198
+ $$
199
+ d _ { j , i } ^ { * } \equiv \sum _ { 1 \leq h \leq \lambda _ { 1 , i } \atop \overline { { X } } _ { j } \in U _ { h , i } } p _ { h , i } + \sum _ { 1 \leq h \leq \lambda _ { 2 , i } \atop \overline { { X } } _ { j } \in V _ { h , i } } q _ { h , i } ,
200
+ $$
201
+
202
+ ![](images/d4f7e8cc2ac82f681ab72206ecf688f4b23e1a397be97e5c0273bc55dfd11cd4.jpg)
203
+ Figure 1: An example of bit allocation for our conversion method. $n = 4 , \lambda _ { 1 , 1 } = 3 , \lambda _ { 2 , 1 } = 1 , \lambda _ { 1 , 2 } =$ 1 $\bar { \lambda } _ { 2 , 2 } = 0 , \lambda _ { 1 , 3 } = \bar { 1 } , \lambda _ { 2 , 3 } = 1 , \lambda _ { 1 , 4 } = 0 , \lambda _ { 2 , 4 } = 0 , U _ { 1 , 1 } = \{ 2 , 3 \} , U _ { 2 , 1 } = \{ 3 \} , U _ { 3 , 1 } = \{ 2 \} , V _ { 1 , 1 } = \{ 3 \} , U _ { 2 , 2 } = \{ 3 \} , U _ { 3 , 2 } = \{ 3 \} , U _ { 2 , 2 } = \{ 3 \} ,$ $\{ 4 \} , U _ { 1 , 2 } = \{ 3 \} , U _ { 1 , 3 } = \{ 1 \} , V _ { 1 , 3 } = \{ 4 \}$ . Circle : $\mathbf { \mu } _ { p , q }$ . Square $: \textbf { { r } }$ . Red lines include in the score component of the Hamiltonian, a green line in the one-to-one correspondence constraint, and blue lines in the cycle constraint.
204
+
205
+ 125 for all $1 \leq j , i \leq n$ . Figure 1 is an example of bit allocation using our conversion method. The 126 number of bits required in our conversion method is $\begin{array} { r } { \sum _ { i = 1 } ^ { n } ( \lambda _ { 1 , i } + \lambda _ { 2 , i } ) + \binom { n } { 2 } } \end{array}$ . Note that we do not directly encode127 $p _ { 0 , i } , q _ { 0 , i }$ on the Hamiltonian.
206
+
207
+ 128 Score Component. The local score component of the Hamiltonian is
208
+
209
+ $$
210
+ H _ { \mathrm { s c o r r e } } ^ { * ( i ) } ( { \pmb p } _ { . , i } , { \pmb q } _ { . , i } ) \equiv \sum _ { h = 1 } ^ { \lambda _ { 1 , i } } s _ { 1 , h , i } p _ { h , i } + \sum _ { h = 1 } ^ { \lambda _ { 2 , i } } s _ { 2 , h , i } q _ { h , i } + \sum _ { h = 1 } ^ { \lambda _ { 1 , i } } \sum _ { h ^ { \prime } = 1 } ^ { \lambda _ { 2 , i } } t _ { h , h ^ { \prime } , i } p _ { h , i } q _ { h ^ { \prime } , i } ,
211
+ $$
212
+
213
+ 129 for all $1 \leq i \leq n$ . We can get these coefficients by solving simultaneous equations under the
214
+ 130 one-to-one correspondence constraint, $s _ { 1 , h , i } = \_ \log S ^ { ( i ) } ( U _ { h , i } \mid \mathcal { D } ) + \log S ^ { ( i ) } ( \phi \mid \mathcal { D } ) , s _ { 2 , h , i } =$
215
+ 131 $\begin{array} { r } { - \log S ^ { ( i ) } ( V _ { h , i } \mid \mathcal D ) + \log S ^ { ( i ) } ( \phi \mid \mathcal D ) , t _ { h , h ^ { \prime } , i } = - \log S ^ { ( i ) } ( U _ { h , i } \cup V _ { h ^ { \prime } , i } \mid \mathcal D ) + \log S ^ { ( i ) } ( U _ { h , i } \mid \mathcal D ) + } \end{array}$
216
+ 132 $\log S ^ { ( i ) } ( V _ { h ^ { \prime } , i } \mid \mathcal { D } ) - \log S ^ { ( i ) } ( \phi \mid \mathcal { D } )$ .
217
+
218
+ 133 One-to-One element from 134 $( U _ { h , i } ) _ { h = 0 } ^ { \lambda _ { 1 , i } } , ( V _ { h , i } ) _ { h = 0 } ^ { \lambda _ { 2 , i } }$ nstraint. We penalize the connection among bits to select each ,
219
+
220
+ $$
221
+ H _ { \mathrm { o n e } } ^ { * ( i ) } ( p . , . , q . , i ) \equiv \sum _ { 1 \leq h < h ^ { \prime } \leq \lambda _ { 1 , i } } \xi _ { 1 , i } p _ { h , i } p _ { h ^ { \prime } , i } + \sum _ { 1 \leq h < h ^ { \prime } \leq \lambda _ { 2 , i } } \xi _ { 2 , i } q _ { h , i } q _ { h ^ { \prime } , i } ,
222
+ $$
223
+
224
+ 135 136 $1 \leq i \leq n$ penalty coefficient is induced indirectly $0 < \xi _ { 1 , i } , \xi _ { 2 , i } \in \mathbb { R }$ . If $\xi _ { 1 , i } , \xi _ { 2 , i }$ is sufficient large, $\begin{array} { r } { \sum _ { h = 0 } ^ { \lambda _ { 1 , i } } p _ { h , i } = \sum _ { h = 0 } ^ { \lambda _ { 2 , i } } q _ { h , i } = 1 } \end{array}$
225
+
226
+ 137 Cycle Constraint. Compared to eq. (6), the cycle constraint of the Hamiltonian is
227
+
228
+ $$
229
+ H _ { \mathrm { c y c l e } } ^ { * } ( p , q , r ) \equiv \sum _ { 1 \leq i < j < k \leq n } \delta _ { 1 } ^ { * } R ( r _ { i , j } , r _ { j , k } , r _ { i , k } ) + \sum _ { 1 \leq i < j \leq n } \delta _ { 2 } ^ { * } ( d _ { i , j } ^ { * } r _ { i , j } + d _ { j , i } ^ { * } ( 1 - r _ { i , j } ) ) ,
230
+ $$
231
+
232
+ where the penalty coefficients 138 $0 < \delta _ { 1 } ^ { * } , \delta _ { 2 } ^ { * } \in \mathbb { R }$ . By setting $\delta _ { 1 } ^ { * } , \delta _ { 2 } ^ { * }$ appropriately, we can prevent the 139 cycle from occurring.
233
+
234
+ 141 We demonstrate the sufficient lower bounds of penalty coefficients. The basic idea is that we find the
235
+ 142 range of penalty coefficients so that the change in return value of the Hamiltonian is negative when
236
+ 143 the input state changes to the state we desire to induce.
237
+ 144 One-to-One Correspondence Constraint. We consider to decrease the value of $\scriptstyle \sum _ { h = 1 } ^ { \lambda _ { 1 , i ^ { * } } } p _ { h , i ^ { * } }$ by
238
+ 145 146 $\begin{array} { r } { p _ { h ^ { * } , i ^ { * } } = 1 , \sum _ { h = 1 } ^ { \lambda _ { 1 , i ^ { * } } } p _ { h , i ^ { * } } > 1 } \end{array}$ , e $H _ { \mathrm { t o t a l } } ^ { * } ( p , q , r ) -$
239
+ $\begin{array} { r } { H _ { \mathrm { t o t a l } } ^ { * } ( p ^ { ( h ^ { * } , i ^ { * } ) } , q , r ) \geq \xi _ { 1 , i ^ { * } } + s _ { 1 , h ^ { * } , i ^ { * } } + \sum _ { h = 1 } ^ { \lambda _ { 2 , i } } t _ { h ^ { * } , h , i ^ { * } } q _ { h , i ^ { * } } . } \end{array}$ $\pmb { p } ^ { ( h ^ { * } , i ^ { * } ) } = ( ( p _ { h , i } ^ { ( h ^ { * } , i ^ { * } ) } ) _ { h = 0 } ^ { \lambda _ { 1 , i } } ) _ { i = 1 } ^ { n }$
240
+ 147 and p(h∗,i∗)h,i = 0 if (h, i) = (h∗, i∗), p(h∗,h,i otherwise. Considering the case where $\pmb { p }$ and $\pmb q$
241
+ 148 are swapped in the above, if $\xi _ { 1 , i } , \xi _ { 2 , i }$ satisfy that
242
+
243
+ $$
244
+ \begin{array} { r l r } & { } & { \displaystyle \operatorname* { m a x } _ { 0 \le h \le \lambda _ { 1 , i } } \bigl ( - s _ { 1 , h , i } - \sum _ { h ^ { \prime } = 1 } ^ { \lambda _ { 2 , i } } \operatorname* { m i n } \bigl \{ 0 , t _ { h , h ^ { \prime } , i } \bigr \} \bigr ) \bigr ) < \xi _ { 1 , i } , } \\ & { } & { \displaystyle \operatorname* { m a x } _ { 0 \le h \le \lambda _ { 2 , i } } \bigl ( - s _ { 2 , h , i } - \sum _ { h ^ { \prime } = 1 } ^ { \lambda _ { 1 , i } } \operatorname* { m i n } \bigl \{ 0 , t _ { h ^ { \prime } , h , i } \bigr \} \bigr ) \bigr ) < \xi _ { 2 , i } , } \end{array}
245
+ $$
246
+
247
+ 149 for all $1 \leq i \leq n$ , then the grand state does not violate the one-to-one correspondence constraint.
248
+ 150 The computational cost to obtain the left side of eq. (14) and eq. (15) is at most $\mathcal { O } ( \lambda _ { 1 , i } \lambda _ { 2 , i } )$ for all
249
+ 151 $1 \leq i \leq n$ .
250
+ 152 Cycle Constraint. We consider four patterns of $( r _ { i ^ { * } , j ^ { * } } , d _ { j ^ { * } , i ^ { * } } ^ { * } , d _ { i ^ { * } , j ^ { * } } ^ { * } )$ violating the consistency
251
+ 153 constraint. It is assumed that $X _ { j ^ { * } } ~ \in ~ U _ { h ^ { * } , i ^ { * } } , X _ { j ^ { * } } ~ \notin ~ U _ { h ^ { * * } , i ^ { * } } ~ \subset ~ U _ { h ^ { * } , i ^ { * } } , p _ { h ^ { * } , i ^ { * } } ~ = ~ 1 , p _ { h ^ { * * } , i ^ { * } } ~ = ~ 0$ .
252
+ 154 155 In thewhere $r ^ { ( i ^ { * } , j ^ { * } ) } = ( r _ { i , j } ^ { ( i ^ { * } , j ^ { * } ) } ) _ { 1 \leq i < j \leq n }$ $( 0 , 1 , 0 )$ t , $H _ { \mathrm { t o t a l } } ^ { * } ( p , q , r ) - H _ { \mathrm { t o t a l } } ^ { * } ( p , q , r ^ { ( i ^ { * } , j ^ { * } ) } ) \geq \delta _ { 2 } ^ { * } - ( n - 2 ) \delta _ { 1 } ^ { * }$ $r _ { i , j } ^ { ( i ^ { * } , j ^ { * } ) } = 1 - r _ { i , j }$ $( i , j ) = ( i ^ { * } , j ^ { * } ) , r _ { i , j } ^ { ( i ^ { * } , j ^ { * } ) } = r _ { i , j }$
253
+ 156 otherwise. Similarly, it is possible to consider the case of $( 1 , 0 , 1 )$ . In the case of $( 0 , 1 , 1 )$ ,
254
+ 157 it holds that $\begin{array} { r } { H _ { \mathrm { t o t a l } } ^ { * } ( p , q , r ) - H _ { \mathrm { t o t a l } } ^ { * } ( p ^ { ( h ^ { * } , h ^ { * * } , i ^ { * } ) } , q , r ) \ge \delta _ { 2 } ^ { * } + s _ { 1 , h ^ { * } , i ^ { * } } + \sum _ { h = 1 } ^ { \lambda _ { 2 , i } } t _ { h ^ { * } , h , i ^ { * } } q _ { h , i ^ { * } } - \frac { 1 - \lambda _ { 1 } } { \lambda _ { 2 } } | \nabla p _ { h } ( q _ { h } ^ { * } , h ^ { * } , i ^ { * } ) | _ { \mathbb { H } } ( q _ { h } ^ { * } , h ^ { * } , i ^ { * } ) , } \end{array}$
255
+ 158 $\begin{array} { r } { s _ { 1 , h ^ { * * } , i ^ { * } } - \sum _ { h = 1 } ^ { \lambda _ { 2 , i } } t _ { h ^ { * * } , h , i ^ { * } } q _ { h , i ^ { * } } } \end{array}$ , where $\pmb { p } ^ { ( h ^ { * } , h ^ { * * } , i ^ { * } ) } = ( ( p _ { h , i } ^ { ( h ^ { * } , h ^ { * * } , i ^ { * } ) } ) _ { h = 0 } ^ { \lambda _ { 1 , i } } ) _ { i = 1 } ^ { n }$ h=, and $p _ { h , i } ^ { ( h ^ { * } , h ^ { * * } , i ^ { * } ) } = 0$
256
+ 159 if $( h , i ) \ = \ ( h ^ { * } , i ^ { * } ) , p _ { h , i } ^ { ( h ^ { * } , h ^ { * * } , i ^ { * } ) } \ = \ 1$ p(h∗,h∗∗,i∗)h,i = 1 if (h, i) = (h∗∗, i∗), p(h∗,h,i $p _ { h , i } ^ { ( h ^ { * } , h ^ { * * } , i ^ { * } ) } = p _ { h , i }$ otherwise. Sim
257
+ 160 ilarly, it is possible to consider the case of $( 1 , 1 , 1 )$ . These results suggest the relationship of
258
+ 161 $\delta _ { 1 } ^ { * } , \delta _ { 2 } ^ { * }$ to induce the consistency constraint. Here, based on theorem 1, we consider a strategy
259
+ 162 to repeat picking up one element from $\mathbfit { \Delta } \mathbf { r }$ and switching its value until $H _ { \mathrm { t r a n s } } ( r ) = 0$ . It is as
260
+ 163 164 sumed that $\begin{array} { r } { T _ { \mathrm { t o t a l } } ^ { * } \big ( p ^ { ( h ^ { * } , h ^ { * * } , i ^ { * } ) } , q , r ^ { ( i ^ { * } , j ^ { * } ) } \big ) \geq \delta _ { 1 } ^ { * } + s _ { 1 , h ^ { * } , i ^ { * } } + \sum _ { h = 1 } ^ { \lambda _ { 2 , i } } t _ { h ^ { * } , h , i ^ { * } } q _ { h , i ^ { * } } - s _ { 1 , h ^ { * * } , i ^ { * } } - \sum _ { h = 1 } ^ { \lambda _ { 2 , i } } t _ { h ^ { * * } , h , i ^ { * } } q _ { h , i ^ { * } } . } \end{array}$ $H _ { \mathrm { t r a n s } } ( \mathbf { \bar { r } } ) > H _ { \mathrm { t r a n s } } ( { r ^ { ( i ^ { * } , j ^ { * } ) } } )$ . In the case of $( 1 , 1 , 0 )$ , it holds that $H _ { \mathrm { t o t a l } } ^ { * } ( p , q , r ) \sim$
261
+ 165 Similarly, it is possible to consider the case of $( 0 , 0 , 1 )$ . In the case of $( 1 , 0 , 0 )$ or $( 0 , 0 , 0 )$ , it holds
262
+ 166 that $\bar { H _ { \mathrm { t o t a l } } ^ { * } } ( p , \bar { q } , r ) - \bar { H _ { \mathrm { t o t a l } } ^ { * } } ( p , q , r ^ { ( i ^ { * } , j ^ { * } ) } ) \geq \delta _ { 1 } ^ { * }$ . These results suggest the lower bound of ${ { \delta } _ { 1 } ^ { * } }$ to
263
+ 167 induce the topological order constraint. Considering the case where $\pmb { p }$ and $\pmb q$ are swapped in the
264
+ 168 above, if $\delta _ { 1 } ^ { * } , \delta _ { 2 } ^ { * }$ satisfy that
265
+
266
+ $$
267
+ \begin{array} { c } { \displaystyle \operatorname* { m a x } _ { 1 \leq i \leq n } \operatorname* { m a x } \{ \eta _ { 1 , i } , \eta _ { 2 , i } \} < \delta _ { 1 } ^ { * } < \displaystyle \frac { \delta _ { 2 } ^ { * } } { n - 2 } , } \\ { \displaystyle \operatorname* { m a x } _ { 1 \leq j \leq n } \displaystyle \operatorname* { m a x } _ { 1 \leq i \leq 1 _ { 1 , i } } \operatorname* { m a x } _ { 0 \leq h ^ { \prime } \leq \lambda _ { 1 , i } } \operatorname* { m a x } _ { 0 \leq h ^ { \prime } \leq \lambda _ { 2 , i } } ( - s _ { 1 , h , i } - t _ { h , h ^ { \prime \prime } , i } + s _ { 1 , h ^ { \prime } , i } + t _ { h ^ { \prime } , h ^ { \prime \prime } , i } ) , } \\ { \displaystyle \eta _ { 1 , i } \equiv \displaystyle \operatorname* { m a x } _ { 1 \leq j \leq n } \displaystyle \frac { \operatorname* { m a x } _ { i } } { X _ { j } \in U _ { h , i } } \operatorname* { m a x } _ { X _ { j } \in U _ { h , i } } \operatorname* { m a x } _ { 0 \leq h ^ { \prime \prime } \leq \lambda _ { 1 , i } } ( - s _ { 2 , h , i } - t _ { h ^ { \prime \prime } , h , i } + s _ { 2 , h ^ { \prime } , i } + t _ { h ^ { \prime \prime } , h ^ { \prime \prime } , i } ) , } \\ { \displaystyle \eta _ { 2 , i } \equiv \displaystyle \operatorname* { m a x } _ { 1 \leq j \leq n } \displaystyle \operatorname* { m a x } _ { 0 \leq h ^ { \prime } \leq \lambda _ { 2 , i } } \operatorname* { m a x } _ { 0 \leq h ^ { \prime } \leq \lambda _ { 2 , i } } ( - s _ { 2 , h , i } - t _ { h ^ { \prime \prime } , h , i } + s _ { 2 , h ^ { \prime } , i } + t _ { h ^ { \prime \prime } , h ^ { \prime } , i } ) , } \\ { \displaystyle \sum _ { k \geq \ell \leq n } \displaystyle \sum _ { X _ { j } \in V _ { h , i } } \sum _ { j \in V _ { h ^ { \prime } } , i \subset V _ { h , i } } ( \operatorname* { m a x } _ { 0 \leq h ^ { \prime \prime } \leq \lambda _ { 1 , i } } ( - s _ { 2 , h , i } - t _ { h ^ { \prime \prime } , h , i } + s _ { 2 , h ^ { \prime } , i } + t _ { h ^ { \prime \prime } , h ^ { \prime \prime } , i } ) , } \end{array}
268
+ $$
269
+
270
+ 169 for $n \geq 3$ , then the grand state does not violate the cycle constraint under the one-to-one cor
271
+ 170 respondence constraint. The computational cost to obtain the left side of eq. (16) is at most
272
+ 171 $\begin{array} { r l } { { \mathcal { O } ( \sum _ { i = 1 } ^ { n } n \lambda _ { 1 , i } \lambda _ { 2 , i } ( \lambda _ { 1 , i } + \lambda _ { 2 , i } ) ) } \quad } & { { } } \end{array}$ .
273
+ 172 Theorem 1. If it holds that $\begin{array} { r } { H _ { \mathrm { t r a n s } } ( { \pmb r } ) \equiv \sum _ { 1 \leq i < j < k \leq n } R ( r _ { i , j } , r _ { j , k } , r _ { i , k } ) > 0 } \end{array}$ , then there exists
274
+ 173 at least one index pair $1 \leq i ^ { * } < j ^ { * } \leq n$ which satisfy $H _ { \mathrm { t r a n s } } ( r ) > H _ { \mathrm { t r a n s } } ( r ^ { ( i ^ { * } , j ^ { * } ) } )$ , where
275
+ 174 r(i∗,j∗) = (r(i∗,i,j $R ( r _ { 1 } , r _ { 2 } , r _ { 3 } ) = r _ { 1 } r _ { 2 } ( 1 - r _ { 3 } ) + ( 1 - r _ { 1 } ) ( 1 - r _ { 2 } ) r _ { 3 }$ $r ^ { ( i ^ { * } , j ^ { * } ) } = ( r _ { i , j } ^ { ( i ^ { * } , j ^ { * } ) } ) _ { 1 \leq i < j \leq n }$ $r _ { i , j } ^ { ( i ^ { * } , j ^ { * } ) } = 1 - r _ { i , j } \ i f ( i , j ) = ( i ^ { * } , j ^ { * } )$ $r _ { 1 } , r _ { 2 } , r _ { 3 } \in \mathbb { B }$ ,, $r _ { i , j } ^ { ( i ^ { * } , j ^ { * } ) } = r _ { i , j }$ $r = ( r _ { i , j } ) _ { 1 \leq i < j \leq n } \in \mathbb { B } ^ { \binom { n } { 2 } }$
276
+ 176 Proof. It does not lose the generality by considering the case of $( r _ { 1 , 2 } , r _ { 2 , 3 } , r _ { 1 , 3 } ) = ( 1 , 1 , 0 )$ . Here, it
277
+ 177 holds that $R ( r _ { 1 , 2 } , r _ { 2 , 3 } , r _ { 1 , 3 } ) - R ( 1 - r _ { 1 , 2 } , r _ { 2 , 3 } , r _ { 1 , 3 } ) + R ( r _ { 1 , 2 } , r _ { 2 , 3 } , r _ { 1 , 3 } ) - R ( r _ { 1 , 2 } , 1 - r _ { 2 , 3 } , r _ { 1 , 3 } ) + R ( r _ { 1 , 2 } , 1 - r _ { 2 , 3 } , r _ { 1 , 3 } )$
278
+ 178 $R ( r _ { 1 , 2 } , r _ { 2 , 3 } , r _ { 1 , 3 } ) - R ( r _ { 1 , 2 } , r _ { 2 , 3 } , 1 - r _ { 1 , 3 } ) = 3 .$ . Additionally, it holds that $R ( r _ { 1 , 2 } , r _ { 2 , i } , r _ { 1 , i } ) - R ( 1 -$
279
+ 179 $r _ { 1 , 2 } , r _ { 2 , i } , r _ { 1 , i } ) + R ( r _ { 2 , 3 } , r _ { 3 , i } , r _ { 2 , i } ) - R ( 1 - r _ { 2 , 3 } , r _ { 3 , i } )$ ${ } _ { 3 } , r _ { 3 , i } , r _ { 2 , i } ) + R ( r _ { 1 , 3 } , r _ { 3 , i } , r _ { 1 , i } ) - R ( 1 - r _ { 1 , 3 } , r _ { 3 , i } , r _ { 1 } )$ ,i) =
280
+ 180 0 for all $3 < i$ . Therefore, it holds that $H _ { \mathrm { t r a n s } } ( \pmb { r } ) - H _ { \mathrm { t r a n s } } ( \pmb { r } ^ { ( 1 , 2 ) } ) + H _ { \mathrm { t r a n s } } ( \pmb { r } ) - H _ { \mathrm { t r a n s } } ( \pmb { r } ^ { ( 2 , 3 ) } ) +$
281
+ 181 $H _ { \mathrm { t r a n s } } ( \pmb { r } ) - H _ { \mathrm { t r a n s } } ( \pmb { r } ^ { ( 1 , 3 ) } ) = 3 .$ . From this result, it holds that $H _ { \mathrm { t r a n s } } ( \pmb { r } ) - H _ { \mathrm { t r a n s } } ( \pmb { r } ^ { ( i ^ { * } , j ^ { * } ) } ) > 0$ for
282
+ 182 at least one index pair $( i ^ { * } , j ^ { * } ) \in \{ ( 1 , 2 ) , ( 2 , 3 ) , ( 1 , 3 ) \}$ . □
283
+
284
+ Table 1: The benchmark networks from Bayesian network repository.
285
+ Algorithm 2 Greedy Candidate Parent Set Identification
286
+
287
+ <table><tr><td rowspan="2">Name</td><td rowspan="2">n</td><td rowspan="2">m</td><td rowspan="2">∑=1 |IIil n</td><td rowspan="2">∑=1 βi( -1)</td><td colspan="3">Ωi=1X n *</td></tr><tr><td>N=100</td><td>N= 1000</td><td>N = 10000</td></tr><tr><td>insurance</td><td>27</td><td>3</td><td>52</td><td>984</td><td>353</td><td>883</td><td>4036</td></tr><tr><td>water</td><td>32</td><td>5</td><td>66</td><td>10083</td><td>165</td><td>216</td><td>735</td></tr><tr><td>alarm</td><td>37</td><td>4</td><td>46</td><td>509</td><td>1829</td><td>2272</td><td>9081</td></tr><tr><td>barley</td><td>48</td><td>4</td><td>84</td><td>114005</td><td>181</td><td>310</td><td>1552</td></tr><tr><td>hailfinder</td><td>56</td><td>4</td><td>66</td><td>2656</td><td>144</td><td>692</td><td>4277</td></tr><tr><td>hepar2</td><td>70</td><td>6</td><td>123</td><td>1453</td><td>4837</td><td>665</td><td>4782</td></tr></table>
288
+
289
+ The average for 10 simulated datasets.
290
+
291
+ # 183 6 Experimental Results
292
+
293
+ To validate the performance of our approach, we use 10 simulated datasets for each instance size $N = 1 0 0 , 1 0 0 0 , 1 0 0 0 0$ and each benchmark network. The benchmark networks are discrete networks from Bayesian network repository 1. The score function is the BDeu score with $\alpha = 1$ . It is often infeasible to identify exact candidate parent sets by searching the power set $\mathcal { P } ( \mathcal { X } \backslash \{ X _ { i } \} )$ in a realistic timeframe. We use the candidate parent sets from algorithm 2. Note that the candidate parent sets depend on the heuristic search algorithms, but we do not focus on their performance in this study. Table 1 displays the information of benchmark networks. The code to replicate each experiment in this paper is available 2.
294
+
295
+ 1: Input: $\mathcal { D } , i , m$ Output: $\mathcal { L }$ Initialize: ${ \mathcal { L } } \gets \{ \phi \} , { \mathcal { L } } ^ { \prime } \gets \{ \phi \} , { \mathcal { L } } ^ { \prime \prime } \gets \phi$
296
+ 2: for $d = 1$ to $m$ do
297
+ 3: for $W$ in $\mathcal { L } ^ { \prime }$ do
298
+ 4: for $X$ in $\chi \setminus \{ X _ { i } \} \setminus W$ do
299
+ 5: if $S _ { i } ( W ^ { \prime } \mid \mathcal { D } ) < S _ { i } ( W \cup \{ X \} \mid \mathcal { D } )$ for all $W ^ { \prime } \subset W \cup \{ X \} , W ^ { \prime } \in { \mathcal { L } }$ then
300
+ 6: ${ \mathcal { L } } ^ { \prime \prime } \gets { \mathcal { L } } ^ { \prime \prime } \cup \{ W \cup \{ X \} \}$ .
301
+ 7: if ${ \mathcal { L } } ^ { \prime \prime } \neq \phi$ then $\mathcal { L } \gets \mathcal { L } \cup \mathcal { L } ^ { \prime \prime } , \mathcal { L } ^ { \prime } \mathcal { L } ^ { \prime \prime } , \mathcal { L } ^ { \prime \prime } \phi$ else break
302
+ 8: for $W$ in $\mathcal { L }$ do
303
+ 9: if there exist $W ^ { \prime } \subset W$ that satisfies $S _ { i } ( W \mid \mathcal { D } ) \le S _ { i } ( W ^ { \prime } \mid \mathcal { D } )$ then ${ \mathcal { L } } \gets { \mathcal { L } } \setminus \{ W \}$ .
304
+
305
+ # 192 6.1 Number of Required Bits for Score Component
306
+
307
+ In comparison to the existing method [O’Gorman et al., 2014], we reduce the number of required bits for the score component by encoding the candidate parent sets directly. While $\textstyle \sum _ { i = 1 } ^ { n } \lambda _ { i }$ candidate parent sets is encoded in our approach, $n ( n - 1 )$ paths plus at most $O ( n ( n - 1 ) ^ { \frac { m } { 2 } } )$ auxiliary variables for $m > 2$ in the existing method. The left side of table 2 shows the reduction rate of the number of required bits for the score component. Moreover, we reduce the number of required bits for the score component to ${ \textstyle \sum _ { i = 1 } ^ { n } } ( \lambda _ { 1 , i } + \lambda _ { 2 , i } )$ by decomposing the candidate parent sets in the form of Cartesian products. The right side of table 2 shows that algorithm 1 reduces the number of required bits for the score component although there is some variation among the networks.
308
+
309
+ Table 2: The reduction rate of the number of required bits for score component.
310
+
311
+ <table><tr><td rowspan="2">Name</td><td colspan="3">£ λi/n(n-1)²</td><td colspan="3">Σ=1 (1,i+λ2,i)/∑=1 1</td></tr><tr><td>N=100</td><td>N=1000</td><td>N = 10000</td><td>N = 100</td><td>N= 1000</td><td>N = 10000</td></tr><tr><td>insurance</td><td>0.09873</td><td>0.24677</td><td>1.12742</td><td>0.61367</td><td>0.47285</td><td>0.32476</td></tr><tr><td>Water</td><td>0.00097</td><td>0.00126</td><td>0.00429</td><td>0.72680</td><td>0.70588</td><td>0.44014</td></tr><tr><td>alarm</td><td>0.03814</td><td>0.04738</td><td>0.18938</td><td>0.45332</td><td>0.35537</td><td>0.21617</td></tr><tr><td>barley</td><td>0.00171</td><td>0.00292</td><td>0.01464</td><td>0.76717</td><td>0.75538</td><td>0.54149</td></tr><tr><td>hailfinder</td><td>0.00085</td><td>0.00409</td><td>0.02525</td><td>0.82773</td><td>0.60178</td><td>0.33365</td></tr><tr><td>hepar2</td><td>0.00021</td><td>0.00003</td><td>0.00021</td><td>0.49694</td><td>0.63346</td><td>0.31284</td></tr></table>
312
+
313
+ \* The average ratio for 10 simulated datasets.
314
+
315
+ Table 3: The number of required bits for fully coupled and nearest neighbor annealing processors.
316
+
317
+ <table><tr><td rowspan="2">Name</td><td colspan="3">∑i=1(1,i+ 入2,i)+(2) *</td><td colspan="3">∑=1(入1,i + λ2,i)(入1,i +λ2,i + 1) + (2)</td></tr><tr><td>N= 100</td><td>N =1000</td><td>N = 10000</td><td>N= 100</td><td>N= 1000</td><td>N = 10000</td></tr><tr><td>insurance</td><td>566</td><td>767</td><td>1661</td><td>3375</td><td>9023</td><td>85482</td></tr><tr><td>water</td><td>613</td><td>648</td><td>820</td><td>1434</td><td>1720</td><td>5881</td></tr><tr><td>alarm</td><td>1489</td><td>1472</td><td>2628</td><td>36761</td><td>27985</td><td>169004</td></tr><tr><td>barley</td><td>1247</td><td>1362</td><td>1968</td><td>6758</td><td>3446</td><td>24796</td></tr><tr><td>hailfinder</td><td>1659</td><td>1957</td><td>2967</td><td>2212</td><td>7084</td><td>80578</td></tr><tr><td>hepar2</td><td>4777</td><td>2836</td><td>3910</td><td>449916</td><td>9164</td><td>136939</td></tr></table>
318
+
319
+ \* The average ratio for 10 simulated datasets.
320
+
321
+ # 6.2 Selection of Annealing Processor
322
+
323
+ From the following discussion, the Fujitsu digital annealer is suitable for our approach from the viewpoint of bit capacity.
324
+
325
+ Fully Connected Type. To the best of our knowledge, the bit capacity of the Fujitsu digital annealer is the largest in fully coupled annealing processors. The second generation Fujitsu digital annealer can deal with problems on a scale of 8192 bits [Matsubara et al., 2020]. The left side of table 3 shows that it is possible to encode all the logical conversion results for benchmark networks to the circuit of the digital annealer within bit capacity.
326
+
327
+ Nearest Neighbor Type. The number of additional bits required for minor embedding depends on the design of the hardware graphs. Oku et al. 2019 proposed a heuristic minor embedding algorithm for the Hitachi CMOS annealing machine [Masanao et al., 2010]. Using this algorithm, the number of required physical spins when embedding a fully connected graph is $I ^ { 2 } + I$ for $I$ variables. The conversion method proposed in this study has $n$ local fully connected graphs on $\mathbf { \Delta } _ { p , q }$ . Therefore, the number of required physical spins must be at least $\begin{array} { r } { \sum _ { i = 1 } ^ { n } ( \lambda _ { 1 , i } + \lambda _ { 2 , i } ) ( \lambda _ { 1 , i } + \lambda _ { 2 , i } + 1 ) + \binom { n } { 2 } } \end{array}$ . From the right side of table 3, it is currently infeasible to encode logical conversion results for at least some networks to the circuit of CMOS annealing machine within its 102400 nodes [Sugie et al., 2021]. As far as we know, the bit capacity of the Hitachi CMOS annealing machine is the largest in nearest neighbor annealing processors.
328
+
329
+ # 6.3 Score Maximization
330
+
331
+ We demonstrate the performance of Fujitsu digital annealer for score-based Bayesian network structure learning using the conversion results of $N = 1 0 0 0 0$ simulated datasets. The running time for each simulated dataset is 6000 [s].
332
+
333
+ ![](images/4b44701b9cc855182e35704f11ec0fbc3d89db610c0991e089d4b455ff631577.jpg)
334
+ Figure 2: Results of score maximization by the baseline algorithms. For each simulated dataset and each baseline algorithm, we normalized $\begin{array} { r } { \sum _ { i = 1 } ^ { \bar { n } } ( \log S ^ { ( i ) } ( \Pi _ { i } \vert \mathcal { \bar { D } } ) - \log S ^ { ( i ) } ( \phi \vert \mathcal { D } ) ) } \end{array}$ by dividing it by the corresponding value of the Fujitsu digital annealer. In this experiment, we used the second-generation Fujitsu digital annealer. SA : simulated annealing, OBS : ordering-based search, ASOBS : acyclic selection ordering-based search.
335
+
336
+ Baselines. We compare the results obtained by the digital annealer with those of three heuristic algorithms. One algorithm is the simulated annealing algorithm [Heckerman et al., 1995b] with a QUBO same as the one encoded into the digital annealer. Other algorithms are the ordering space search algorithms, i.e., ordering-based search and acyclic selection ordering-based search. For a fair comparison, the running time of the simulated annealing algorithm for each simulated dataset is 6000 [s] and that of the ordering space search algorithms is 6000 [s] plus the running time of algorithm 1. The computing environment is Microsoft Windows 10 Pro, 3.6 GHz Intel Core i9 processor, and 64 GB memory.
337
+
338
+ Result. Figure 2 shows that the digital annealer is better than all the baselines for all the simulated datasets from all the benchmark networks.
339
+
340
+ # 7 Conclusion
341
+
342
+ We proposed a novel approach of converting a score-based Bayesian network structure learning into QUBO. The essence of this approach lies in reducing the number of required bits through the advanced identification of candidate parent sets and their representation as Cartesian products. The Fujitsu digital annealer with our conversion method improved the BDeu score for 27 to 70 variables benchmark networks over existing methods. The bit capacity limitation of annealing processor is being relaxed rapidly 3. Though our approach is still a disadvantage for larger-scale networks, we expect that our proposed algorithms will be effectively applied to larger-scale score-based Bayesian network structure learning in the near future.
343
+
344
+ Potential Negative Societal Impacts. The development of annealing processor technology could have an impact on various industry fields. However, the number of companies that have commercialized the API usage of annealing processors is still small. Therefore, there is a concern that the market of annealing processors will not work well and the disparities among stakeholders will be widen. Researchers are required to properly evaluate the value of technology and communicate it to the business side.
345
+
346
+ 248 References
347
+ 249 Judea Pearl, editor. Probabilistic Reasoning in Intelligent Systems: Networks of Plausible Inference. Morgan Kaufmann, 1988. Gregory F. Cooper and Edward Herskovits. A bayesian method for the induction of probabilistic networks from data. Journal of Machine Learning, 9(4), 1992. Robert G. Cowell. Conditions under which conditional independence and scoring methods lead to identical selection of bayesian network models. In Jack Breese and Daphne Koller, editors, Proceedings of the 17th Conference on Uncertainty in Artificial Intelligence, pages 91–97. Morgan Kaufmann Publishers, 2001. David M. Chickering, David Heckerman, and Christopher Meek. Large-sample learning of bayesian networks is np-hard. Journal of Machine Learning Research, 20:1287–1330, 2004. Marc Teyssier and Daphne Koller. Ordering-based search: A simple and effective algorithm for learning bayesian networks. In Proceedings of the 21th Conference on Uncertainty in Artificial Intelligence, pages 584–590, 2005. Mauro Scanagatta, Cassio Polpo de Campos, Giorgio Corani, and Marco Zaffalon. Learning bayesian networks with thousands of variables. In Proceedings of the 28th International Conference on Neural Information Processing Systems, pages 1864–1872, 2015. Hidenori Gyoten, Masayuki Hiromoto, and Takashi Sato. Area efficient annealing processor for ising model without random number generator. IEICE Transactions on Information and Systems, E101.D(2):314–323, 2018. Kasho Yamamoto. Research on Annealing Processors for Large-Scale Combinatorial Optimization Problems. PhD thesis, Graduate School of Information Science and Technology Hokkaido University, 2020. Vicky Choi. Minor-embedding in adiabatic quantum computation: I. the parameter setting problem. Quantum Information Processing, 7:193–209, 2008. Vicky Choi. Minor-embedding in adiabatic quantum computation: Ii. minor-universal graph design. Quantum Information Processing, 10:343–352, 2010. Bryan A. O’Gorman, Alejandro Perdomo-Ortiz, Ryan Babbush, Alan Aspuru-Guzik, and Vadim Smelyanskiy. Bayesian network structure learning using quantum annealing. The European Physical Journal Special Topics, 225(1), 2014.
348
+ 276 Endre Boros and Aritanan Gruber. On quadratization of pseudo-boolean functions. CoRR, abs/1404.6538, 2014.
349
+ 277 Maliheh Aramon, Gili Rosenberg, Elisabetta Valiante, Toshiyuki Miyazawa, Hirotaka Tamura, and Helmut G. Katzgraber. Physics-inspired optimization for quadratic unconstrained problems using a digital annealer. Frontiers in Physics, 7(48), 2019. Wray Buntine. Theory refinement of bayesian networks. In Proceedings of the 7th Conference on Uncertainty in Artificial Intelligence, pages 52–60, 1991. David Heckerman, Dan Geiger, and David M. Chickering. Learning bayesian networks: The combination of knowledge and statistical data. Journal of Machine Learning, 20(3):197–243, 1995a.
350
+ 284 Martin Anthony, Endre Boros, Yves Crama, and Aritanan Gruber. Quadratic reformulations of nonlinear binary optimization problems. Mathematical Programming, 162(1):115–144, 2016. Endre Boros and Peter L. Hamme. Pseudo-boolean optimization. Journal of Discrete Applied Mathematics, 123: 155–225, 2002. Cassio P. de Campos and Qiang Ji. Efficient structure learning of bayesian networks using constraints. Journal of Machine Learning Research, 12:663–689, 2011. Alvaro H. C. Correia, James Cussens, and Cassio de Campos. On pruning for score-based bayesian network structure learning. Journal of Machine Learning Research, 108:2709–2718, 2020. Satoshi Matsubara, Motomu Takatsu, Toshiyuki Miyazawa, Takayuki Shibasaki, Yasuhiro Watanabe, Kazuya Takemoto, and Hirotaka Tamura. Digital annealer for high-speed solving of combinatorial optimization problems and its applications. In Proceedings of the 25th Asia and South Pacific Design Automation Conference, pages 667–672, 2020.
351
+ 296 David Eppstein. Finding large clique minors is hard. Graph Algorithms and Applications, 13(2):197–204, 2009.
352
+ Daisuke Oku, Kotaro Terada, Masato Hayashi, Masanao Yamaoka, Shu Tanaka, and Nozomu Togawa. A fully-connected ising model embedding method and its evaluation for cmos annealing machines. IEICE Transactions on Information and Systems, E102-D(9):1696–1706, 2019.
353
+ Yamaoka Masanao, Yoshimura Chihiro, Hayashi Masato, Okuyama Takuya, Aoki Hidetaka, and Mizuno Hiroyuki. A 20k-spin ising chip to solve combinatorial optimization problems with cmos annealing. IEEE Journal of Solid-State Circuits, 51(1), 2010.
354
+ Yuya Sugie, Yuki Yoshida, Normann Mertig, Takashi Takemoto, Hiroshi Teramoto, Atsuyoshi Nakamura, Ichigaku Takigawa, Shin ichi Minato, Masanao Yamaoka, and Tamiki Komatsuzaki. Minor-embedding heuristics for large-scale annealing processors with sparse hardware graphs of up to 102,400 nodes. Soft Computing, 2021.
355
+ Daphne Koller and Nir Friedman, editors. Probabilistic Graphical Models: Principles and Techniques. The MIT Press, Cambridge, Massachusetts, 2009.
356
+ David Heckerman, Dan Geiger, and David M. Chickering. Learning bayesian networks: Search methods and experimental results. In Preliminary Papers of the 5th International Workshop on Artificial, pages 112–128, 1995b.
357
+
358
+ # Checklist
359
+
360
+ 1. For all authors...
361
+
362
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
363
+ (b) Did you describe the limitations of your work? [Yes] See section 7.
364
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] See section 7.
365
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
366
+
367
+ 2. If you are including theoretical results...
368
+
369
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] See section 4.
370
+ (b) Did you include complete proofs of all theoretical results? [Yes] See section 5.
371
+
372
+ 3. If you ran experiments...
373
+
374
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] in the supplemental material
375
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See section 6.
376
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See fig. 2.
377
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See section 6.3.
378
+
379
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
380
+
381
+ (a) If your work uses existing assets, did you cite the creators? [Yes] in the supplemental material
382
+ (b) Did you mention the license of the assets? [N/A]
383
+ (c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
384
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
385
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
386
+
387
+ If you used crowdsourcing or conducted research with human subjects...
388
+
389
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
390
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
391
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/HkmaTz-0W/HkmaTz-0W.md ADDED
@@ -0,0 +1,334 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VISUALIZING THE LOSS LANDSCAPE OF NEURAL NETS
2
+
3
+ # Anonymous authors
4
+
5
+ Paper under double-blind review
6
+
7
+ # ABSTRACT
8
+
9
+ Neural network training relies on our ability to find “good” minimizers of highly non-convex loss functions. It is well known that certain network architecture designs (e.g., skip connections) produce loss functions that train easier, and wellchosen training parameters (batch size, learning rate, optimizer) produce minimizers that generalize better. However, the reasons for these differences, and their effect on the underlying loss landscape, is not well understood.
10
+
11
+ In this paper, we explore the structure of neural loss functions, and the effect of loss landscapes on generalization, using a range of visualization methods. First, we introduce a simple “filter normalization” method that helps us visualize loss function curvature, and make meaningful side-by-side comparisons between loss functions. Then, using a variety of visualizations, we explore how network architecture effects the loss landscape, and how training parameters affect the shape of minimizers.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Training neural networks requires minimizing a high-dimensional non-convex loss function – a task that is hard in theory, but sometimes easy in practice. Despite the NP-hardness of training general neural loss functions (Blum & Rivest, 1989), simple gradient methods often find global minimizers (parameter configurations with zero or near-zero training loss), even when data and labels are randomized before training (Zhang et al., 2017). However, this good behavior is not universal; the trainability of neural nets is highly dependent on network architecture design choices, the choice of optimizer, variable initialization, and a variety of other considerations. Unfortunately, the effect of each of these choices on the structure of the underlying loss surface is unclear. Because of the prohibitive cost of loss function evaluations (which requires looping over all the data points in the training set), studies in this field have remained predominantly theoretical.
16
+
17
+ ![](images/a14706c29d892ca8c4fe95f8306eb80e5ef1b4694e7c755e61d5a5f55c9ef4dd.jpg)
18
+ Figure 1: The loss surfaces of ResNet-56 with/without skip connections. The vertical axis is logarithmic to show dynamic range. The proposed filter normalization scheme is used to enable comparisons of sharpness/flatness between the two figures.
19
+
20
+ Our goal is to use high-resolution visualizations to provide an empirical characterization of neural loss functions, and to explore how different network architecture choices affect the loss landscape. Furthermore, we explore how the non-convex structure of neural loss functions relates to their trainability, and how the geometry of neural minimizers (i.e., their sharpness/flatness, and their surrounding landscape), affects their generalization properties.
21
+
22
+ To do this in a meaningful way, we propose a simple “filter normalization” scheme that enables us to do side-by-side comparisons of different minima found by different methods. We then use visualizations to explore sharpness/flatness of minimizers found by different methods, as well as the effect of network architecture choices (use of skip connections, number of filters, network depth) on the loss landscape. Out goal is to understand how differences in loss function geometry effect the generalization of neural nets.
23
+
24
+ # 1.1 CONTRIBUTIONS
25
+
26
+ In this article, we study methods for producing meaningful loss function visualizations. Then, using these visualization methods, we explore how loss landscape geometry effects generalization error and trainability. More specifically, we address the following issues:
27
+
28
+ • We reveal faults in a number of visualization methods for loss functions, and show that simple visualization strategies fail to accurately capture the local geometry (sharpness or flatness) of loss function minimizers. We present a simple visualization method based on “filter normalization” that enables side-by-side comparisons of different minimizers. The sharpness of minimizers correlates well with generalization error when this visualization is used, even when making sharpness comparisons across disparate network architectures and training methods.
29
+ • We observe that, when networks become sufficiently deep, neural loss landscapes suddenly transition from being nearly convex to being highly chaotic. This transition from convex to chaotic behavior, which seem to have been previously unnoticed, coincides with a dramatic drop in generalization error, and ultimately to a lack of trainability. We show that skip connections promote flat minimizers and prevent the transition to chaotic behavior, which helps explain why skip connections are necessary for training extremely deep networks.
30
+ • We study the visualization of SGD optimization trajectories. We explain the difficulties that arise when visualizing these trajectories, and show that optimization trajectories lie in an extremely low dimensional space. This low dimensionality can be explained by the presence of large nearly convex regions in the loss landscape, such as those observed in our 2-dimensional visualizations.
31
+
32
+ # 2 THEORETICAL BACKGROUND & RELATED WORK
33
+
34
+ Visualizations have the potential to help us answer several important questions about why neural networks work. In particular, why are we able to minimize highly non-convex neural loss functions? And why do the resulting minima generalize?
35
+
36
+ Because of the difficultly of visualizing loss functions, most studies of loss landscapes are largely theoretical in nature. A number of authors have studied our ability to minimize neural loss functions. Using random matrix theory and spin glass theory, several authors have shown that local minima are of low objective value (Dauphin et al., 2014; Choromanska et al., 2015). It can also be shown that local minima are global minima, provided one assumes linear neurons (Hardt & Ma, 2017), very wide layers (Nguyen & Hein, 2017), or full rank weight matrices (Yun et al., 2017). These assumptions have been relaxed by Kawaguchi (2016) and Lu & Kawaguchi (2017), although some assumptions (e.g., of the loss functions) are still required. Soudry & Hoffer (2017); Freeman & Bruna (2017); Xie et al. (2017) also analyzed shallow networks with one or two hidden layers under mild conditions.
37
+
38
+ Another approach is to show that we can expect good minimizers, not simply because of the endogenous properties of neural networks, but because of the optimizers. For restricted network classes such as those with one hidden layer, with some extra assumptions on the sample distribution, globally optimal or near-optimal solutions can be found by common optimization methods (Soltanolkotabi et al., 2017; Li & Yuan, 2017; Tian, 2017). For networks with specific structures, Safran & Shamir (2016) and Haeffele & Vidal (2017) show there likely exists a monotonically decreasing path from an initialization to a global minimum. Swirszcz et al. (2017) show counterexamples that achieve “bad” local minima for toy problems.
39
+
40
+ Also of interest is work on assessing the sharpness/flatness of local minima. Hochreiter & Schmidhuber (1997) defined “flatness” as the size of the connected region around the minimum where the training loss remains low. Keskar et al. (2017) propose $\epsilon$ -sharpness, which looks at the maximum loss in a bounded neighborhood of a minimum. Flatness can also be defined using the local curvature of the loss function at a critical point. Keskar et al. (2017) suggests that this information is encoded in the eigenvalues of the Hessian. However, Dinh et al. (2017) show that these quantitative measure of sharpness are problematic because they are not invariant to symmetries in the network, and are thus not sufficient to determine its generalization ability. This issue was addressed in Chaudhari et al. (2017), who used local entropy as a measure of sharpness. This measure is invariant to the simple transformation used by Dinh et al. (2017), but difficult to quantify for large networks.
41
+
42
+ Theoretical results make some restrictive assumptions such as the independence of the input samples, or restrictions on non-linearities and loss functions. For this reason, visualizations play a key role in verifying the validity of theoretical assumptions, and understanding loss function behavior in real-world systems. In the next section, we briefly review methods that have been used for this purpose.
43
+
44
+ # 3 THE BASICS OF LOSS FUNCTION VISUALIZATION
45
+
46
+ Neural networks are trained on a corpus of feature vectors (e.g., images) $\{ x _ { i } \}$ and accompanying labels $\{ y _ { i } \}$ by minimizing a loss of the form
47
+
48
+ $$
49
+ L ( \theta ) = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \ell ( x _ { i } , y _ { i } ; \theta )
50
+ $$
51
+
52
+ where $\theta$ denotes the parameters (weights) of the neural network, the function $\ell ( x _ { i } , y _ { i } ; \theta )$ measures how well the neural network with parameters $\theta$ predicts the label of a data sample, and $m$ is the number of data samples.
53
+
54
+ Neural nets contain many parameters, and so their loss functions live in a very high-dimensional space. Unfortunately, visualizations are only possible using low-dimensional 1D (line) or 2D (surface) plots. Several methods exist for closing this dimensionality gap.
55
+
56
+ 1-Dimensional Linear Interpolation One simple and lightweight way to plot loss functions is to choose two sets of parameters $\theta _ { 1 }$ and $\theta _ { 2 }$ , and plot the values of the loss function along the line connecting these two points. We can parameterize this line by choosing a scalar parameter $\alpha$ , and defining the weighted average
57
+
58
+ $$
59
+ \theta _ { \alpha } = ( 1 - \alpha ) \theta _ { 1 } + \alpha \theta _ { 2 } .
60
+ $$
61
+
62
+ Finally, we plot the function $f ( \alpha ) = L ( \theta _ { \alpha } )$ . This strategy was taken by Goodfellow et al. (2015), who studied the loss surface along the line between a (random) initial guess, and a nearby minimizer obtained by stochastic gradient descent. This method has been widely used to study the “sharpness” and “flatness��� of different minima, and the dependence of sharpness on batch-size (Keskar et al., 2017; Dinh et al., 2017). Smith & Topin (2017) use the same 1D interpolation technique to show different minima and the “peaks” between them, while Im et al. (2016) plot the line between minima obtained via different optimizers.
63
+
64
+ The 1D linear interpolation method suffers from several weaknesses. First, it is difficult to visualize non-convexities using 1D plots. Indeed, the authors of (Goodfellow et al., 2015) found that loss functions appear to lack local minima along the minimization trajectory. We will see later, using 2D methods, that some loss functions have extreme non-convexities, and that these non-convexities correlate with the difference in generalization between different network architectures. Second, this method does not consider batch normalization or invariance symmetries in the network. For this reason, the visual sharpness comparisons produced by 1D interpolation plots may be misleading; this issue will be explored in depth in Section 5.
65
+
66
+ 2D Contour Plots To use this approach, one chooses a center point $\theta ^ { * }$ in the graph, and chooses two direction vectors, $\delta$ and $\eta$ . One then plots a function of the form $f ( \alpha ) = L ( { \bar { \theta } } ^ { * } { \bar { + } } \alpha \delta )$ in the 1D (line) case, or
67
+
68
+ $$
69
+ f ( \alpha , \beta ) = L ( \theta ^ { * } + \alpha \delta + \beta \eta )
70
+ $$
71
+
72
+ in the 2D (surface) case. This approach was used in (Goodfellow et al., 2015) to explore the trajectories of different minimization methods. It was also used in (Im et al., 2016) to show that different optimization algorithms find different local minima within the 2D projected space.
73
+
74
+ Because of the computational burden of 2D plotting, these methods generally result in low-resolution plots of small regions that have not captured the complex non-convexity of loss surfaces. Below, we use high-resolution visualizations over large slices of weight space to visualize how network design affects non-convex structure.
75
+
76
+ # 4 PROPOSED VISUALIZATION: FILTER-WISE NORMALIZATION
77
+
78
+ This study relies heavily on plots of the form (1) produced using random direction vectors, $\delta$ and $\eta$ , each sampled from a random Gaussian distribution with appropriate scaling (described below).
79
+
80
+ While the “random directions” approach to plotting is simple, it cannot be used to compare the geometry of two different minimizers or two different networks. This is because of the scale invariance in network weights. When ReLU non-linearities are used, the network remains unchanged if we (for example) multiply the weights in one layer of a network by 10, and divide the next layer by 10. This invariance is even more prominent when batch normalization is used. In this case, the size (i.e., norm) of a filter is irrelevant because the output of each layer is re-scaled during batch normalization. For this reason, a network’s behavior remains unchanged if we re-scale the weights.
81
+
82
+ Scale invariance prevents us from making meaningful comparisons between plots, unless special precautions are taken. A neural network with large weights may appear to have a smooth and slowly varying loss function; perturbing the weights by one unit will have very little effect on network performance if the weights live on a scale much larger than one. However, if the weights are much smaller than one, then that same one unit perturbation may have a catastrophic effect, making the loss function appear quite sensitive to weight perturbations. Keep in mind that neural nets are scale invariant; if the small-parameter and large-parameter networks in this example are equivalent (because one is simply a re-scaling of the other), then any apparent differences in the loss function are merely an artifact of scale invariance. This scale invariance was exploited by Dinh et al. (2017) to build pairs of equivalent networks that have different apparent sharpness.
83
+
84
+ To remove this scaling effect, we plot loss functions using filter-wise normalized directions. To obtain such directions for a network with parameters $\theta$ , we begin by producing a random Gaussian direction vector $d$ with dimensions compatible with $\theta$ . Then we normalize each filter in $d$ to have the same norm of the corresponding filter in $\theta$ . In other words, we make the replacement
85
+
86
+ $$
87
+ d _ { i } { \frac { d _ { i } } { \Vert d _ { i } \Vert } } \Vert \theta _ { i } \Vert ,
88
+ $$
89
+
90
+ where $d _ { i }$ represents the ith filter of $d$ (not the ith weight), and $\lVert \boldsymbol { \theta } _ { i } \rVert$ denotes the Frobenius norm of the ith filter of $\theta$ . Note that the filter-wise normalization is different from that of (Im et al., 2016), which normalize the direction without considering the norm of individual filters.
91
+
92
+ The proposed scaling is an important factor when making meaningful plots of loss function geometry. We will explore the importance of proper scaling below as we explore the sharpness/flatness of different minimizers. In this context, we show that the sharpness of filter-normalized plots correlates with generalization error, while plots without filter normalization can be very misleading.
93
+
94
+ # 5 THE SHARP VS FLAT DILEMMA
95
+
96
+ Section 4 introduces the concept of filter normalization, and provides an intuitive justification for its use. In this section, we address the issue of whether sharp minimizers generalize better than flat minimizers. In doing so, we will see that the sharpness of minimizers correlates well with generalization error when filter normalization is used. This enables side-by-side comparisons between plots. In contrast, the sharpness of non-filter normalized plots may appear distorted and unpredictable.
97
+
98
+ It is widely thought that small-batch SGD produces “flat” minimizers that generalize better, while large batch sizes produce “sharp” minima with poor generalization (Chaudhari et al., 2017; Keskar et al., 2017; Hochreiter & Schmidhuber, 1997). This claim is disputed though, with Dinh et al. (2017); Kawaguchi et al. (2017) arguing that generalization is not directly related to the curvature of loss surfaces, and some authors proposing specialized training methods that achieve good performance with large batch sizes (Hoffer et al., 2017; Goyal et al., 2017; De et al., 2017).
99
+
100
+ Here, we explore the difference between sharp and flat minimizers. We begin by discussing difficulties that arise when performing such a visualization, and how proper normalization can prevent such plots from producing distorted results.
101
+
102
+ We train a CIFAR-10 classifier using a 9-layer VGG network (Simonyan & Zisserman, 2015) with Batch Normalization (Ioffe & Szegedy, 2015). We use two batch sizes: a large batch size of 8192 ( $1 6 . 4 \%$ of the training data of CIFAR-10), and a small batch size of 128. Let $\theta _ { s }$ and $\theta _ { l }$ indicate the solutions obtained by running SGD using small and large batch sizes, respectively1. Using the linear interpolation approach (Goodfellow et al., 2015), we plot the loss values on both training and testing data sets of CIFAR-10, along a direction containing the two solutions, i.e., $f ( \alpha ) = L ( \theta _ { s } + \alpha ( \theta _ { l } - \theta _ { s } ) )$ .
103
+
104
+ ![](images/ef50b7737be38ec876e0cdb95e3e3af393016f78c52f3f6208f9ac227293847e.jpg)
105
+ Figure 2: 1D linear interpolation of solutions obtained by small-batch and large-batch methods for VGG9. The blue lines are loss values and the red lines are accuracies. The solid lines are training curves and the dashed lines are for testing. Small batch is at abscissa 0, and large batch is at abscissa 1.
106
+
107
+ Table 1: Test errors of VGG-9 on CIFAR-10 with different optimization algorithms and hyperparameters.
108
+
109
+ <table><tr><td rowspan="3"></td><td rowspan="3"></td><td colspan="2">SGD</td><td colspan="2">Adam</td></tr><tr><td>bs=128</td><td>bs=8192</td><td>bs=128</td><td>bs=8192</td></tr><tr><td>VGG-9</td><td>WD= 0</td><td>7.37</td><td>11.07</td><td>7.44</td><td>10.91</td></tr><tr><td></td><td>WD = 5e-4</td><td>6.00</td><td>10.19</td><td>7.80</td><td>9.52</td></tr></table>
110
+
111
+ Similar to Keskar et al. (2017), we also superimpose the classification accuracy in red. This plot is shown in Figure 2.
112
+
113
+ Figures 2(a) and 2(b) show linear interpolation plots with $\theta _ { s }$ at $\mathbf { X }$ -axis location 0, and $\theta _ { l }$ at location $1 ^ { 2 }$ . As observed by Keskar et al. (2017), we can clearly see that the small-batch solution is quite wide, while the large-batch solution is sharp. However, this sharpness balance can be flipped simply by turning on weight decay (Krogh & Hertz, 1992). Figures 2(c) and 2(d) show results of the same experiment, except this time with a non-zero weight decay parameter. This time, the large batch minimizer is considerably flatter than the sharp small batch minimizer. However, we see from Table 1 that small batches generalize better in all 4 experiments; there is no apparent correlation between sharpness and generalization. We will see that these side-by-side sharpness comparisons are extremely misleading, and fail to capture the endogenous properties of the minima.
114
+
115
+ The apparent differences in sharpness in Figure 2 can be explained by examining the weights of each minimizer. Histograms of the networks weights are shown for each experiment in Figure 3. We see that, when a large batch is used with zero weight decay, the resulting weights tends to be smaller than in the small batch case. We reverse this effect by adding weight decay; in this case the large batch minimizer has much larger weights than the small batch minimizer. This difference in scale occurs for a simple reason: A smaller batch size results in more weight updates per epoch than a large batch size, and so the shrinking effect of weight decay (which imposes a penalty on the norm of the weights) is more pronounced.
116
+
117
+ Figure 2 in not visualizing the endogenous sharpness of minimizers, but rather just the (irrelevant) weight scaling. The scaling of weights in these networks is irrelevant because batch normalization re-scales the outputs to have unit variance. However, small weights still appear more sensitive to perturbations, and produce sharper looking minimizers.
118
+
119
+ Filter normalized plots We repeat the experiment in Figure 2, but this time we plot the loss function near each minimizer separately using random filter-normalized directions. This removes the apparent differences in geometry caused by the scaling depicted in Figure 3. The results, presented in Figure 4, still show differences in sharpness between small batch and large batch minima, however these differences are much more subtle than it would appear in the un-normalized plots.
120
+
121
+ We also visualize these results using two random directions and contour plots. As shown in Figure 5, the weights obtained with small batch size and non-zero weight decay have wider contours than the sharper large batch minimizers. Similar for Resnet-56 appear in Figure 12 of the Appendix.
122
+
123
+ ![](images/c5a7d4f64b3d10940e5b0e8fcf8a2ad96ebd92066bfd9cc81dc1eeb9a61973a2.jpg)
124
+ Figure 3: Histogram of weights. With zero weight decay, small-batch methods produce large weights. With non-zero weight decay, small-batch methods produce smaller weights.
125
+
126
+ ![](images/0089ebcfa1e4c7c29fcc8cf3c9b44b137d8e12613e49aba8c463103b971b4e17.jpg)
127
+ Figure 4: The shape of minima obtained using different optimization algorithms, with varying batch size and weight decay. The title of each subfigure contains the optimizer, batch size, and test error. The first row has no weight decay and the second row uses weight decay 5e-4.
128
+
129
+ ![](images/19fc60a8c5a0284a9dbe8f9ce56c82c214fd602dbeff6b22bd17998217d2f207.jpg)
130
+ Figure 5: 2D visualization of solutions obtained by SGD with small-batch and large-batch. Similar to Figure 4, the first row uses zero weight decay and the second row sets weight decay to 5e-4.
131
+
132
+ Generalization and Flatness Using the filter-normalized plots in Figures 4 and 5, we can make side-by-side comparisons between minimizers, and we see that now sharpness correlates well with generalization error. Large batches produced visually sharper minima (although not dramatically so) with higher test error. Interestingly, the Adam optimizer attained larger test error than SGD, and, as predicted, the corresponding minima are visually sharper. Results of a similar experiment using ResNet-56 are presented in the Appendix (Figure 12).
133
+
134
+ # 6 WHAT MAKES NEURAL NETWORKS TRAINABLE? INSIGHTS ON THE (NON) CONVEXITY STRUCTURE OF LOSS SURFACES
135
+
136
+ Our ability to find global minimizers to neural loss functions is not universal; it seems that some neural architectures are easier to minimize than others. For example, using skip connections, He et al. (2016) were able to train extremely deep architectures, while comparable architectures without skip connections are not trainable. Furthermore, our ability to train seems to depend strongly on the initial parameters from which training starts.
137
+
138
+ Using visualization methods, we do an empirical study of neural architectures to explore why the non-convexity of loss functions seems to be problematic in some situations, but not in others. We aim to provide insight into the following questions: Do loss functions have significant non-convexity at all? If prominent non-convexities exist, why are they not problematic in all situations? Why are some architectures easy to train, and why are results so sensitive to the initialization? We will see that different architectures have extreme differences in non-convexity structure that answer these questions, and that these differences correlate with generalization error.
139
+
140
+ # 6.1 EXPERIMENTAL SETUP
141
+
142
+ To understand the effects of network architecture on non-convexity, we trained a number of networks, and plotted the landscape around the obtained minimizers using the filter-normalized random direction method described in Section 4.
143
+
144
+ We consider three classes of neural networks:
145
+
146
+ • Residual networks that are optimized for performance on CIFAR (He et al., 2016). We consider ResNet-20, ResNet-56, and ResNet-110, where each name is labeled with the number of convolutional layers it has. “VGG-like” networks that do not contain shortcut/skip connections. We produced these networks simply by removing the skip connections from the CIFAR-optimized ResNets. We call these networks ResNet-20-noshort, ResNet-56-noshort, and ResNet-110-noshort. Note that these networks do not all perform well on the CIFAR-10 task. We use them purely for experimental purposes to explore the effect of shortcut connections. “Wide” ResNets that have been optimized for ImageNet rather than CIFAR. These networks have more filters per layer than the CIFAR optimized networks, and also have different numbers of layers. These models include ResNet-18, ResNet-34, and ResNet-50.
147
+
148
+ All models are trained on the CIFAR-10 dataset using SGD with Nesterov momentum, batch-size 128, and 0.0005 weight decay for 300 epochs. The learning rate was initialized at 0.1, and decreased by a factor of 10 at epochs 150, 225 and 275. Deeper experimental VGG-like networks (e.g., ResNet-56-noshort, as described below) required a smaller initial learning rate of 0.01.
149
+
150
+ High resolution 2D plots of the minimizers for different neural networks are shown in Figure 6. Results are shown as contour plots rather than surface plots because this makes it extremely easy to see non-convex structures and evaluate sharpness. For surface plots of ResNet-56, see Figure 1. Note that the center of each plot corresponds to the minimizer, and the two axes parameterize two random directions with filter-wise normalization as in (1). We make several observations below about how architecture effects the loss landscape. We also provide loss and error values for these networks in Table 2, and convergence curves in Figure 14 of the Appendix.
151
+
152
+ # 6.2 THE EFFECT OF NETWORK DEPTH
153
+
154
+ From Figure 6, we see that network depth has a dramatic effect on the loss surfaces of neural networks when skip connections are not used. The network ResNet-20-noshort has a fairly benign landscape dominated by a region with convex contours in the center, and no dramatic non-convexity. This isn’t too surprising: the original VGG networks for ImageNet had 19 layers and could be trained effectively (Simonyan & Zisserman, 2015).
155
+
156
+ However, as network depth increases, the loss surface of the VGG-like nets spontaneously transitions from (nearly) convex to chaotic. ResNet-56-noshort has dramatic non-convexities and large regions where the gradient directions (which are normal to the contours depicted in the plots) do not point towards the minimizer at the center. Also, the loss function becomes extremely large as we move in some directions. ResNet-110-noshort displays even more dramatic non-convexities, and becomes extremely steep as we move in all directions shown in the plot. Furthermore, note that the minimizers at the center of the deep VGG-like nets seem to be fairly sharp. In the case of ResNet-56-noshort, the minimizer is also fairly ill-conditioned, as the contours near the minimizer have significant eccentricity.
157
+
158
+ ![](images/09e1fa6d53f9c16d0e4f2124e26f3227824bd8d411eafd3b74ff9db658ad4338.jpg)
159
+ Figure 6: 2D visualization of the solutions of different networks.
160
+
161
+ Table 2: Loss values and errors for different architectures.
162
+
163
+ <table><tr><td></td><td>Filters</td><td>Training Loss</td><td>Training Error</td><td>Test Error</td></tr><tr><td rowspan="2">ResNet-20 ResNet-20-noshort</td><td rowspan="2">16</td><td>0.017</td><td>0.286</td><td>7.37</td></tr><tr><td>0.025</td><td>0.560</td><td>8.18</td></tr><tr><td>ResNet-56</td><td rowspan="2">16</td><td>0.004</td><td>0.052</td><td>5.89</td></tr><tr><td>ResNet-56-noshort</td><td>0.024</td><td>0.704</td><td>10.83</td></tr><tr><td>ResNet-110</td><td rowspan="2">16</td><td>0.002</td><td>0.042</td><td>5.79</td></tr><tr><td>ResNet-110-noshort</td><td>0.258</td><td>8.732</td><td>16.44</td></tr><tr><td>ResNet-18</td><td rowspan="2">64 64</td><td>0.002</td><td>0.026</td><td>5.42</td></tr><tr><td>ResNet-34</td><td>0.001</td><td>0.014</td><td>4.73</td></tr><tr><td>ResNet-50</td><td>64</td><td>0.001</td><td>0.006</td><td>4.55</td></tr></table>
164
+
165
+ # 6.3 SHORTCUT CONNECTIONS TO THE RESCUE
166
+
167
+ Shortcut connections have a dramatic effect of the geometry of the loss functions. In Figure 6, we see that residual connections prevent the transition to chaotic behavior as depth increases. In fact, the width and shape of the 0.1-level contour is almost identical for the 20- and 110-layer networks.
168
+
169
+ Interestingly, the effect of skip connections seems to be most important for deep networks. For the more shallow networks (ResNet-20 and ResNet-20-noshort), the effect of skip connections is fairly unnoticeable. However residual connections prevent the explosion of non-convexity that occurs when networks get deep. This effect seems to apply to other kinds of skip connections as well; Figure 13 of the Appendix shows the loss landscape of DenseNet (Huang et al., 2017), which shows no noticeable non-convexity.
170
+
171
+ # 6.4 WIDE MODELS VS THIN MODELS
172
+
173
+ To see the effect of the number of convolutional filters per layer, we compare the narrow CIFARoptimized ResNets (ResNet-20/56/110) with wider ResNets (ResNet-18/34/50) that have more filters and were optimized for ImageNet. From Figure 6, we see that the wider models have loss landscapes with no noticeable chaotic behavior. Increased network width resulted in flat minima and wide regions of apparent convexity.
174
+
175
+ This effect is also validated by Figure 7, in which we plot the landscape of ResNet-56, but we multiple the number of filter per layer by $k = 2 , 4$ , and 8. We see that increased width prevents chaotic behavior, and skip connections dramatically widen minimizers. Finally, note that sharpness correlates extremely well with test error.
176
+
177
+ ![](images/c55cb4af6dfc31fb4a6c5b394992c8d9c6370fc38dc358befd09e109f60dd5bd.jpg)
178
+ Figure 7: Wide-ResNet-56 (WRN-56) on CIFAR-10 both with shortcut connections (top) and without (bottom). The label $k = 2$ means twice as many filters per layer, $k = 4$ means 4 times, etc. Test error is reported below each figure.
179
+
180
+ # 6.5 IMPLICATIONS FOR NETWORK INITIALIZATION
181
+
182
+ One of the most interesting observations seen in Figure 6 is that loss landscapes for all the networks considered seem to be partitioned into a well-defined region of low loss value and convex contours, surrounded by a well-defined region of high loss value and non-convex contours.
183
+
184
+ This partitioning of chaotic and convex regions may explain the importance of good initialization strategies, and also the easy training behavior of “good” architectures. When using normalized random initialization strategies such as those proposed by Glorot & Bengio (2010), typical neural networks attain an initial loss value less than 2.5. The well behaved loss landscapes in Figure 6 (ResNets, and shallow VGG-like nets) are dominated by large, flat, nearly convex attractors that rise to a loss value of 4 or greater. For such landscapes, a random initialization will likely lie in the “well- behaved” loss region, and the optimization algorithm might never “see” the pathological non-convexities that occur on the high loss chaotic plateaus.
185
+
186
+ Chaotic loss landscapes (ResNet-56-noshort and ResNet-110-noshort) have shallower regions of convexity that rise to lower loss values. For sufficiently deep networks with shallow enough attractors, the initial iterate will likely lie in the chaotic region where the gradients are uninformative. In our experiments, SGD was unable to train a 156 layer network without skip connections (even with very low learning rates), which adds weight to this hypothesis.
187
+
188
+ # 6.6 LANDSCAPE GEOMETRY AFFECTS GENERALIZATION
189
+
190
+ Table 2 displays the training and test error for the networks depicted in Figure 6. Both Figures 6 and 7 show that landscape geometry has a dramatic effect on generalization. First, note that visually flatter minimizers consistently correspond to lower test error, which further strengthens our assertion that filter normalization is a natural way to visualize loss function geometry.
191
+
192
+ Second, we notice that chaotic landscapes (deep networks without skip connections) result in worse training and test error, while more convex landscapes have lower error values. In fact, the most convex landscapes (the wide ResNets in the bottom row of Figure 6) generalize the best of all the networks. This latter class of networks show no noticeable chaotic behavior at all.
193
+
194
+ # 7 VISUALIZING OPTIMIZATION PATHS
195
+
196
+ Finally, we explore methods for visualizing the trajectories of different optimizers. For this application, random directions are ineffective. We will provide a theoretical explanation for why random directions fail, and explore methods for effectively plotting trajectories on top of loss function contours.
197
+
198
+ Several authors have observed that random direction fail to capture the variation in optimization trajectories, including Gallagher & Downs (2003); Lorch (2016); Lipton (2016); Liao & Poggio (2017). Several failed visualizations are depicted in Figure 8. In Figure 8(a), we see the iterates of SGD projected onto the plane defined by two random directions. Almost none of the motion is captured (notice the super-zoomed-in axes and the seemingly random walk). This problem was noticed by Goodfellow et al. (2015), who then visualized trajectories using one direction that points from initialization to solution, and one random direction. This approach is shown in Figure 8(b). As seen in Figure 8(c), the random axis captures almost no variation, leading to the (misleading) appearance of a straight line path.
199
+
200
+ ![](images/6b58a26902081c8eab5b05e4d0561fdea81fbc2a651f28634198198c59d961af.jpg)
201
+ Figure 8: Ineffective visualizations of optimizer trajectories. These visualizations suffer from the orthogonality of random directions in high dimensions.
202
+
203
+ # 7.1 WHY RANDOM DIRECTIONS FAIL: LOW DIMENSIONAL OPTIMIZATION TRAJECTORIES
204
+
205
+ It is well known that two random vectors in a high dimensional space will be nearly orthogonal with high probability. In fact, the expected cosine similarity between Gaussian random vectors in $n$ dimensions is roughly $\sqrt { 2 / ( \pi n ) }$ (Goldstein & Studer (2016), Lemma 5).
206
+
207
+ This is problematic when optimization trajectories lie in extremely low dimensional spaces. In this case, a randomly chosen vector will lie orthogonal to the low-rank space containing the optimization path, and a projection onto a random direction will capture almost no variation. Figure 8(b) suggests that optimization trajectories are low dimensional because the random direction captures orders of magnitude less variation than the vector that points along the optimization path. Below, we use PCA directions to directly validate this low dimensionality, and also to produce effective visualizations.
208
+
209
+ # 7.2 EFFECTIVE TRAJECTORY PLOTTING USING PCA DIRECTIONS
210
+
211
+ To capture variation in trajectories, we need to use non-random (and carefully chosen) directions. Here, we suggest an approach based on PCA that allows us to measure how much variation we’ve captured; we also provide plots of these trajectories along the contours of the loss surface.
212
+
213
+ Let $\theta _ { i }$ denote model parameters at epoch $i$ and the final solution as $\theta _ { n }$ . Given $m$ training epochs, we can apply PCA to the matrix $M = [ \theta _ { 0 } - \theta _ { n } ; \cdot \cdot \cdot ; \theta _ { n - 1 } - \theta _ { n } ]$ , and then select the two most explanatory directions. Optimizer trajectories (blue dots) and loss surfaces along PCA directions are shown in Figure 9. Epochs where the learning rate was decreased are shown as red dots. On each axis, we measure the amount of variation in the descent path captured by that PCA direction.
214
+
215
+ We see some interesting behavior in these plots. At early stages of training, the paths tend to move perpendicular to the contours of the loss surface, i.e., along the gradient directions as one would expect from non-stochastic gradient descent. The stochasticity becomes fairly pronounced in several plots during the later stages of training. This is particularly true of the plots that use weight decay and small batches (which leads to more gradient noise, and a more radical departure from deterministic gradient directions). When weight decay and small batches are used, we see the path turn nearly parallel to the contours and “orbit” the solution when the stepsize is large. When the stepsize is dropped (at the red dot), the effective noise in the system decreases, and we see a kink in the path as the trajectory falls into the nearest local minimizer.
216
+
217
+ Finally, we can directly observe that the descent path is very low dimensional: between $40 \%$ and $90 \%$ of the variation in the descent paths lies in a space of only 2 dimensions. The optimization trajectories in Figure 9 appear to be dominated by movement in the direction of a nearby attractor. This low dimensionality is compatible with the observations in Section 6.5, where we observed that non-chaotic landscapes are dominated by wide, flat minimizers.
218
+
219
+ ![](images/8d33544243937b60993d712bc2c60f7cc045d69afe806c2a339b6f5d0aca7c66.jpg)
220
+ Figure 9: Projected learning trajectories use normalized PCA directions for VGG-9. The left plot in each subfigure uses batch size 128, and the right one uses batch size 8192.
221
+
222
+ # 8 CONCLUSION
223
+
224
+ In this paper, we presented a new, more accurate visualization technique that provided insights into the consequences of a variety of choices facing the neural network practitioner, including network architecture, optimizer selection, and batch size.
225
+
226
+ Neural networks have advanced dramatically in recent years, largely on the back of anecdotal knowledge and theoretical results with complex assumptions. For progress to continue to be made, a more general understanding of the structure of neural networks is needed. Our hope is that effective visualization, when coupled with continued advances in theory, can result in faster training, simpler models, and better generalization.
227
+
228
+ # REFERENCES
229
+
230
+ Avrim Blum and Ronald L Rivest. Training a 3-node neural network is np-complete. In Advances in neural information processing systems, pp. 494–501, 1989.
231
+
232
+ Pratik Chaudhari, Anna Choromanska, Stefano Soatto, and Yann LeCun. Entropy-sgd: Biasing gradient descent into wide valleys. ICLR, 2017.
233
+
234
+ Anna Choromanska, Mikael Henaff, Michael Mathieu, Gerard Ben Arous, and Yann LeCun. The ´ loss surfaces of multilayer networks. In AISTATS, 2015.
235
+
236
+ Yann N Dauphin, Razvan Pascanu, Caglar Gulcehre, Kyunghyun Cho, Surya Ganguli, and Yoshua Bengio. Identifying and attacking the saddle point problem in high-dimensional non-convex optimization. In Advances in neural information processing systems, pp. 2933–2941, 2014.
237
+
238
+ Soham De, Abhay Yadav, David Jacobs, and Tom Goldstein. Automated inference with adaptive batches. In Artificial Intelligence and Statistics, pp. 1504–1513, 2017.
239
+
240
+ Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp minima can generalize for deep nets. ICLR, 2017.
241
+
242
+ C Daniel Freeman and Joan Bruna. Topology and geometry of half-rectified network optimization. ICLR, 2017.
243
+
244
+ Marcus Gallagher and Tom Downs. Visualization of learning in multilayer perceptron networks using principal component analysis. IEEE Transactions on Systems, Man, and Cybernetics, Part B (Cybernetics), 33(1):28–34, 2003.
245
+
246
+ Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 249–256, 2010.
247
+
248
+ Tom Goldstein and Christoph Studer. Phasemax: Convex phase retrieval via basis pursuit. arXiv preprint arXiv:1610.07531, 2016.
249
+
250
+ Ian J Goodfellow, Oriol Vinyals, and Andrew M Saxe. Qualitatively characterizing neural network optimization problems. ICLR, 2015.
251
+
252
+ Priya Goyal, Piotr Dollar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, ´ Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
253
+
254
+ Benjamin D Haeffele and Rene Vidal. Global optimality in neural network training. In ´ Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7331–7339, 2017.
255
+
256
+ Moritz Hardt and Tengyu Ma. Identity matters in deep learning. ICLR, 2017.
257
+
258
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. In CVPR, 2016.
259
+
260
+ Sepp Hochreiter and Jurgen Schmidhuber. Flat minima. ¨ Neural Computation, 9(1):1–42, 1997.
261
+
262
+ Elad Hoffer, Itay Hubara, and Daniel Soudry. Train longer, generalize better: closing the generaliza tion gap in large batch training of neural networks. NIPS, 2017.
263
+
264
+ Gao Huang, Zhuang Liu, Kilian Q Weinberger, and Laurens van der Maaten. Densely connected convolutional networks. CVPR, 2017.
265
+
266
+ Daniel Jiwoong Im, Michael Tao, and Kristin Branson. An empirical analysis of deep network loss surfaces. arXiv preprint arXiv:1612.04010, 2016.
267
+
268
+ Sergey Ioffe and Christian Szegedy. Batch Normalization: Accelerating Deep Network Training by Reducing Internal Covariate Shift. 2015.
269
+
270
+ Kenji Kawaguchi. Deep learning without poor local minima. NIPS, 2016.
271
+
272
+ Kenji Kawaguchi, Leslie Pack Kaelbling, and Yoshua Bengio. Generalization in deep learning. arXiv preprint arXiv:1710.05468, 2017.
273
+
274
+ Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. ICLR, 2017.
275
+
276
+ Anders Krogh and John A Hertz. A simple weight decay can improve generalization. In NIPS, 1992.
277
+
278
+ Yuanzhi Li and Yang Yuan. Convergence analysis of two-layer neural networks with relu activation. arXiv preprint arXiv:1705.09886, 2017.
279
+
280
+ Qianli Liao and Tomaso Poggio. Theory of deep learning ii: Landscape of the empirical risk in deep learning. arXiv preprint arXiv:1703.09833, 2017.
281
+
282
+ Zachary C Lipton. Stuck in a what? adventures in weight space. ICLR Workshop, 2016.
283
+
284
+ Eliana Lorch. Visualizing deep network training trajectories with pca. ICML WorkshopWorkshop on Visualization for Deep Learning, 2016.
285
+
286
+ Haihao Lu and Kenji Kawaguchi. Depth creates no bad local minima. arXiv preprint arXiv:1702.08580, 2017.
287
+
288
+ Quynh Nguyen and Matthias Hein. The loss surface of deep and wide neural networks. International Conference on Machine Learning, 2017.
289
+
290
+ Itay Safran and Ohad Shamir. On the quality of the initial basin in overspecified neural networks. In International Conference on Machine Learning, pp. 774–782, 2016.
291
+
292
+ Karen Simonyan and Andrew Zisserman. Very Deep Convolutional Networks for Large-Scale Image Recognition. In ICLR, 2015.
293
+
294
+ Leslie N Smith and Nicholay Topin. Exploring loss function topology with cyclical learning rates. arXiv preprint arXiv:1702.04283, 2017.
295
+
296
+ Mahdi Soltanolkotabi, Adel Javanmard, and Jason D Lee. Theoretical insights into the optimization landscape of over-parameterized shallow neural networks. arXiv preprint arXiv:1707.04926, 2017.
297
+
298
+ Daniel Soudry and Elad Hoffer. Exponentially vanishing sub-optimal local minima in multilayer neural networks. arXiv preprint arXiv:1702.05777, 2017.
299
+
300
+ Grzegorz Swirszcz, Wojciech Marian Czarnecki, and Razvan Pascanu. Local minima in training of neural networks. stat, 1050:17, 2017.
301
+
302
+ Yuandong Tian. An analytical formula of population gradient for two-layered relu network and its applications in convergence and critical point analysis. ICML, 2017.
303
+
304
+ Bo Xie, Yingyu Liang, and Le Song. Diverse neural network learns true target functions. In Artificial Intelligence and Statistics, pp. 1216–1224, 2017.
305
+
306
+ Chulhee Yun, Suvrit Sra, and Ali Jadbabaie. Global optimality conditions for deep neural networks. arXiv preprint arXiv:1707.02444, 2017.
307
+
308
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. ICLR, 2017.
309
+
310
+ # 9 APPENDIX
311
+
312
+ ![](images/610175cbc64cf1ae69b262234cde47d9ff25b3b42f6d1c8fb9c0e9c8696c1bab.jpg)
313
+ Figure 10: 1D linear interpolation of solutions obtained by small-batch and large-batch methods for ResNet56. The blue lines are loss values and the red lines are error. The solid lines are training curves and the dashed lines are for testing.
314
+
315
+ ![](images/5dc79c487760afd5e52819863f3727b33d7f93699648a1573eb732d6e3055567.jpg)
316
+ Figure 11: The shape of minima obtained via different optimization algorithms for ResNet-56, with varying batch size and weight decay. Similar to Figure 4, the first row uses zero weight decay and the second row uses 5e-4 weight decay.
317
+
318
+ Generalization error for each plot is shown in Table 3.
319
+
320
+ ![](images/51c9dc79a1510514ec1b5270885d6f3c0f59cca940263448f32e6e8e3acc82d5.jpg)
321
+ Figure 12: 2D visualization of solutions of ResNet-56 obtained by SGD/Adam with small-batch and large-batch. Similar to Figure 11, the first row uses zero weight decay and the second row sets weight decay to 5e-4.
322
+
323
+ Table 3: Test error for ResNet-56 with different optimization algorithms and batch-size/weight-decay parameters.
324
+
325
+ <table><tr><td rowspan="3"></td><td colspan="2">SGD</td><td colspan="2">Adam</td></tr><tr><td>bs=128</td><td>bs=4096</td><td>bs=128</td><td>bs=4096</td></tr><tr><td>WD= 0</td><td>8.26</td><td>13.93</td><td>9.55</td><td>14.30</td></tr><tr><td>WD = 5e-4</td><td>5.89</td><td>10.59</td><td>7.67</td><td>12.36</td></tr></table>
326
+
327
+ ![](images/82ab00c5f26ae528c7ab8fa745db3229313bdbdc5c56807e9c7afd9f1c347d5d.jpg)
328
+ Figure 13: The loss landscape for DenseNet-121 trained on CIFAR-10. The final training error is 0.002 and the testing error is 4.37
329
+
330
+ ![](images/0baeb9b3d7877532ae268f66b858c5530fc075aaa8c9a1edf0c0f6e79f301065.jpg)
331
+ Figure 14: Convergence curves for different architectures. The first row is for training loss and the second row are training and testing error curves.
332
+
333
+ ![](images/0c310c541da47bed32b8513c30c1792a62f50b9bcacdcb51b6f31d18970657bd.jpg)
334
+ Figure 15: Training and testing loss curves for VGG-9. Dashed lines are for testing, solid for training.
md/train/QpNz8r_Ri2Y/QpNz8r_Ri2Y.md ADDED
The diff for this file is too large to render. See raw diff
 
md/train/S1FQEfZA-/S1FQEfZA-.md ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A CLASSIFICATION–BASED PERSPECTIVE ON GAN DISTRIBUTIONS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ A fundamental, and still largely unanswered, question in the context of Generative Adversarial Networks (GANs) is whether GANs are actually able to capture the key characteristics of the datasets they are trained on. The current approaches to examining this issue require significant human supervision, such as visual inspection of sampled images, and often offer only fairly limited scalability. In this paper, we propose new techniques that employ classification–based perspective to evaluate synthetic GAN distributions and their capability to accurately reflect the essential properties of the training data. These techniques require only minimal human supervision and can easily be scaled and adapted to evaluate a variety of state-of-the-art GANs on large, popular datasets. They also indicate that GANs have significant problems in reproducing the more distributional properties of the training dataset. In particular, the diversity of such synthetic data is orders of magnitude smaller than that of the original data.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Generative Adversarial Networks (GANs) (Goodfellow et al., 2014) have garnered a significant amount of attention due to their ability to learn generative models of multiple natural image datasets (Radford et al., 2015; Denton et al., 2015; Zhang et al., 2016; Zhu et al., 2017). Since their conception, a fundamental question regarding GANs is to what extent they truly learn the underlying data distribution. This is a key issue for multiple reasons. From a scientific perspective, understanding the capabilities of common GANs can shed light on what precisely the adversarial training setup allows the GAN to learn. From an engineering standpoint, it is important to grasp the power and limitations of the GAN framework when applying it in concrete applications. Due to the broad potential applicability of GANs, researchers have investigated this question in a variety of ways.
12
+
13
+ When we evaluate the quality of a GAN, an obvious first check is to establish that the generated samples lie in the support of the true distribution. In the case of images, this corresponds to checking if the generated samples look realistic. Indeed, visual inspection of generated images is currently the most common way of assessing the quality of a given GAN. Individual humans can performs this task quickly and reliably, and various GANs have achieved impressive results for generating realistic-looking images of faces and indoor scenes (Salimans et al., 2016; Denton et al., 2015).
14
+
15
+ Once we have established that GANs produce realistic-looking images, the next concern is that the GAN might simply be memorizing the training dataset. While this hypothesis cannot be ruled out entirely, there is evidence that GANs perform at least some non-trivial modeling of the unknown distribution. Previous studies show that interpolations in the latent space of the generator produce novel and meaningful image variations (Radford et al., 2015), and that there is a clear disparity between generated samples and their nearest neighbors in the true dataset (Arora & Zhang, 2017).
16
+
17
+ Taken together, these results provide evidence that GANs could constitute successful distribution learning algorithms, which motivates studying their distributions in more detail. The direct approach is to compare the probability density assigned by the generator with estimates of the true distribution (Wu et al., 2016). However, in the context of GANs and high-dimensional image distributions, this is complicated by two factors. First, GANs do not naturally provide probability estimates for their samples. Second, estimating the probability density of the true distribution is a challenging problem itself (the adversarial training framework specifically avoids this issue). Hence prior work has only investigated the probability density of GANs on simple datasets such as MNIST (Wu et al., 2016).
18
+
19
+ Since reliably computing probability densities in high dimensions is challenging, we can instead study the behavior of GANs in low-dimensional problems such as two-dimensional Gaussian mixtures. Here, a common failure of GANs is mode collapse, wherein the generator assigns a disproportionately large mass to a subset of modes from the true distribution (Goodfellow, 2016). This raises concerns about a lack of diversity in the synthetic GAN distributions, and recent work shows that the learned distributions of two common GANs indeed have (moderately) low support size for the CelebA dataset (Arora & Zhang, 2017). However, the approach of Arora & Zhang (2017) heavily relies on a human annotator in order to identify duplicates. Hence it does not easily scale to comparing many variants of GANs or asking more fine-grained questions than collision statistics. Overall, our understanding of synthetic GAN distributions remains blurry, largely due to the lack of versatile tools for a quantitative evaluation of GANs in realistic settings. The focus of this work is precisly to address this question:
20
+
21
+ # Can we develop principled and quantitative approaches to study synthetic GAN distributions?
22
+
23
+ To this end, we propose two new evaluation techniques for synthetic GAN distributions. Our methods are inspired by the idea of comparing moments of distributions, which is at the heart of many methods in classical statistics. Although simple moments of high-dimensional distributions are often not semantically meaningful, we can extend this idea to distributions of realistic images by leveraging image statistics identified using convolutional neural networks. In particular, we train image classifiers in order to construct test functions corresponding to semantically meaningful properties of the distributions. An important feature of our approach is that it requires only light human supervision and can easily be scaled to evaluating many GANs and large synthetic datasets.
24
+
25
+ Using our new evaluation techniques, we study five state-of-the-art GANs on the CelebA and LSUN datasets, arguably the two most common testbeds for advanced GANs. We find that most of the GANs significantly distort the relative frequency of even basic image attributes, such as the hair style of a person or the type of room in an indoor scene. This clearly indicates a mismatch between the true and synthetic distributions. Moreover, we conduct experiments to explore the diversity of GAN distributions. We use synthetic GAN data to train image classifiers and find that these have significantly lower accuracy than classifiers trained on the true data set. This points towards a lack of diversity in the GAN data, and again towards a discrepancy between the true and synthetic distributions. In fact, our additional examinations show that the diversity in GANs is only comparable to a subset of the true data that is $1 0 0 \times$ smaller.
26
+
27
+ # 2 UNDERSTANDING GANS THROUGH THE LENS OF CLASSIFICATION
28
+
29
+ When comparing two distributions, a common first test is to compute low-order moments such as the mean and the variance. If the distributions are simple enough, these quantities provide a good understanding for how similar they are. Moreover, low-order moments have a precise definition and are usually quick to compute. On the other hand, low-order moments can also be misleading for more complicated, high-dimensional distributions. As a concrete example, consider a generative model of digits (such as MNIST). If a generator produces digits that are shifted by a significant amount yet otherwise perfect, we will probably still consider this as a good approximation of the true distribution. However, the expectation (mean moment) of the generator distribution can be very different from the expectation of the true data distribution. This raises the question of what other properties of high-dimensional image distributions are easy to test yet semantically meaningful.
30
+
31
+ In the next two subsections, we describe two concrete approaches to evaluate synthetic GAN data that are easy to compute yet capture relevant information about the distribution. The common theme is that we employ convolutional neural networks in order to capture properties of the distributions that are hard to describe in a mathematically precise way, but usually well-defined for a human (e.g., what fraction of the images shows a smiling person?). Automating the process of annotating images with such high-level information will allow us to study various aspects of synthetic GAN data.
32
+
33
+ # 2.1 QUANTIFYING MODE COLLAPSE
34
+
35
+ Mode collapse refers to the tendency of the generator to concentrate a large probability mass on a few modes of the true distribution. While there is ample evidence for the presence of mode-collapse in GANs (Goodfellow, 2016; Arora & Zhang, 2017; Metz et al., 2016), elegant visualizations of this phenomena are somewhat restricted to toy problems on low-dimensional distributions (Goodfellow,
36
+
37
+ 2016; Metz et al., 2016). For image datasets, it is common to rely on human annotators and derived heuristics (see Section 2.3). While these methods have their merits, they are restrictive both in the scale and granularity of testing. Here we propose a classification-based tool to assess how good GANs are at assigning the right mass across broad concepts/modes. To do so, we use a trained classifier as an expert “annotator” that labels important features in synthetic data, and then analyze the resulting distribution. Specifically, our goal is to investigate if a GAN trained on a well-balanced dataset (i.e., contains equal number of samples from each class) can learn to reproduce this balanced structure. Let $D = ( \dot { X } , Y ) = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N }$ represent a dataset of size $N$ with $C$ classes, where $( x _ { i } , y _ { i } )$ denote an image-label pair drawn from true data. If the dataset $D$ is balanced, it contains $N / C$ images per class. The procedure for computing class distribution in synthetic data is:
38
+
39
+ 1. Train an annotator (a multi-class classifier) using the dataset $D$ .
40
+ 2. Train an unconditional GAN on the images $X$ from dataset $D$ , without using class labels.
41
+ 3. Create a synthetic dataset by sampling $N$ images from a GAN and labeling them using the annotator from Step 1.
42
+
43
+ The annotated data generated via the above procedure can provide insight into the GAN’s class distribution at the scale of the entire dataset. Moreover, we can vary the granularity of mode analysis by choosing richer classification tasks, i.e., more challenging classes or a larger number of them. In Section 3.3, we use this technique to visualize mode collapse in several state-of-the-art GANs on the CelebA and LSUN datasets. All the studied GANs show significant mode collapse and the effect becomes more pronounced when the granularity of the annotator is increased (larger number of classes). We also investigate the temporal aspect of the GAN setup and find that the dominant mode varies widely over the course of training. Our approach also enables us to benchmark and compare GANs on different datasets based on the extent of mode collapse in the learned distributions.
44
+
45
+ # 2.2 MEASURING DIVERSITY
46
+
47
+ Our above method for inspecting distribution of modes in synthetic data provides a coarse look at the statistics of the underlying distribution. While the resulting quantities are semantically meaningful, they capture only simple notions of diversity. To get a more holistic view on the sample diversity in the synthetic distribution, we now describe a second classification-based approach for evaluating GAN distributions. The main question that motivates it is: Can GANs recover the key aspects of real data to enable training a good classifier? We believe that this is an interesting measure of sample diversity for two reasons. First, classification of high-dimensional image data is a challenging problem, so a good training dataset will require a sufficiently diverse sample from the distribution. Second, augmenting data for classification problems is one of the proposed use cases of GANs (e.g., see the recent work of Shrivastava et al. (2017)).
48
+
49
+ If GANs are truly able to capture the quality and diversity of the underlying data distribution, we expect almost no gap between classifiers trained on true data and synthetic data from a GAN. A generic method to produce data from GANs for classification is to train separate GANs for each class in the dataset $D$ .1 Samples from these class-wise GANs can then be pooled together to get a labeled synthetic dataset. Note that the labels are trivially determined based on the class modeled by the particular GAN from which a sample is drawn. We perform the following steps to assess the classification performance of synthetic data vs. true data:
50
+
51
+ 1. Train a classifier on the true data $D$ (from Section 2.1) as a benchmark for comparison. 2. Train $C$ separate unconditional GANs, one per class in dataset D. 3. Generate a balanced synthetic labeled dataset of size $_ \mathrm { N }$ by consolidating an equal number of samples drawn from each of these $C$ GANs. The labels obtained by aggregating samples from per-class GANs are designated as “default” labels for the synthetic dataset. Note that by design, both true and synthetic datasets have $N$ samples, with $N / C$ examples per class. 4. Use synthetic labeled data from Step 3 to train classifier with the same architecture as Step 1.
52
+
53
+ Comparing the classifiers from Steps 1 and 4 can then shed light on the disparity between the two distributions. Radford et al. (2015) conducted an experiment similar to Step 2 on the MNIST dataset using a conditional GAN. They found that samples from their DCGAN performed comparably to true data on nearest neighbor classification. We obtained similar good results on MNIST, which could be due to the efficacy of GANs in learning the MNIST distribution or due to the ease of getting good accuracy on MNIST even with a small training set (Rolnick et al., 2017). To clarify this question, we restrict our analysis to more complex datasets, specifically CelebA and LSUN.
54
+
55
+ We evaluate the two following properties in our classification task:
56
+
57
+ (i) How well can the GANs recover nuances of the decision boundary, which is reflected by how easily the classifier can fit the training data?
58
+ (ii) How does the diversity of synthetic data compare to that of true data when measured by classification accuracy on a hold-out set of true data?
59
+
60
+ We observe that all the studied GANs have very low diversity in this metric. In particular, the accuracy achieved by a classifier trained on GAN data is comparable only to the accuracy of a classifier trained on a $1 0 0 \times$ (or more) subsampled version of the true dataset. Even if we draw more samples from the GANs to produce a training set several times larger than the true dataset, there is no improvement in performance. Looking at the classification accuracy gives us a way to compare different models on a potential downstream application of GANs. Interestingly, we find that visual quality of samples does not necessarily correlate with good classification performance.
61
+
62
+ # 2.3 RELATED WORK
63
+
64
+ In GAN literature, it is common to investigate performance using metrics that involve human supervision. Arora & Zhang (2017) proposed a measure based on manually counting duplicates in GAN samples as a heuristic for the support or diversity of the learned distribution. In Wu et al. (2016), manual classification of a small sample (100 images) of GAN generated MNIST images is used as a test for the GAN is missing certain modes. Such annotator-based metrics have clear advantages in identifying relevant failure-modes of synthetic samples, which explains why visual inspection (eyeballing) is still the most popular approach to assess GAN samples.
65
+
66
+ There have also been various attempts to build good metrics for GANs that are not based on manual heuristics. Parzen window estimation can be used to approximate the log-likelihood of the distribution, though it is known to work poorly for high-dimensional data (Theis et al., 2016). Wu et al. (2016) develop a method to get a better estimate for log-likelihood using annealed importance sampling. Salimans et al. (2016) propose a metric known as Inception Score, where the entropy in the labels predicted by a pre-trained Inception network is used to assess the diversity in GAN samples.
67
+
68
+ # 3 EXPERIMENTS
69
+
70
+ In the following sub-sections we describe the setup and results for our classification-based GAN benchmarks. Additional details can be found in Section 5 in the Appendix.
71
+
72
+ # 3.1 DATASETS
73
+
74
+ GANs have shown promise in generating realistic samples, resulting in efforts to apply them to a broad spectrum of datasets. However, the Large-scale CelebFaces Attributes (CelebA) (Liu et al., 2015) and Large-Scale Scene Understanding (LSUN) (Yu et al., 2015) datasets remain the most popular and canonical ones in developing and evaluating GAN variants. Conveniently, these datasets also have rich annotations, making them particularly suited for our classification–based evaluations. Details on the setup for classification tasks for these datasets are given in the Appendix (Section 5).
75
+
76
+ # 3.2 MODELS
77
+
78
+ Using our framework, we perform a comparative study of several popular variants of GANs:
79
+
80
+ 1. Deep Convolutional GAN (DCGAN): Convolutional GAN trained using a Jensen–Shannon divergence–based objective (Goodfellow et al., 2014; Radford et al., 2015).
81
+ 2. Wasserstein GAN (WGAN): GAN that uses a Wasserstein distance–based objective (Arjovsky et al., 2017).
82
+ 3. Adversarially Learned Inference (ALI): GAN that uses joint adversarial training of generative and inference networks (Dumoulin et al., 2017).
83
+ 4. Boundary Equilibrium GAN (BEGAN): Auto-encoder style GAN trained using Wasserstein distance objective (Berthelot et al., 2017).
84
+
85
+ ![](images/62ced381625d83d2930cddcf355b5368dc556dd7a50f2dae5311314091417820.jpg)
86
+ Figure 1: Visualizations of mode collapse in the synthetic, GAN-generated data produced after training on our chosen subsets of CelebA and LSUN datasets. Left panel shows the relative distribution of classes in samples drawn from synthetic datasets extracted at the end of the training process, and compares is to the true data distribution (leftmost plots). On the right, shown is the evolution of analogous class distribution for different GANs over the course of training. BEGAN did not converge on the LSUN tasks and hence is excluded from the corresponding analysis.
87
+
88
+ 5. Improved GAN (ImGAN): GAN that uses semi-supervised learning (labels are part of GAN training), with various other architectural and procedural improvements (Salimans et al., 2016).
89
+
90
+ All the aforementioned GANs are unconditional, however, ImGAN has access to class labels as a part of the semi-supervised training process. We use standard implementations for each of these models, details of which are provided in the Appendix (Section 5). We also used the prescribed hyper-parameter settings for each GAN, including number of iterations we train them for. Our analysis is based on $6 4 \times 6 4$ samples, which is a size at which GAN generated samples tend to be of high quality. We also use visual inspection to ascertain that the perceptual quality of GAN samples in our experiments is comparable to those reported in previous studies. We demonstrate sample images in Figures 2 and 3 in the Appendix. BEGAN did not converge in our experiments on the LSUN dataset and hence is excluded from the corresponding analysis.
91
+
92
+ In our study, we use two types of classification models:
93
+
94
+ 1. ResNet: 32-Layer Residual network He et al. (2016). Here, we choose a ResNet as it is a standard classifier in vision and yields high accuracy on various datasets, making it a reliable baseline.
95
+ 2. Linear Model: This is a network with one-fully connected layer between the input and output (no hidden layers) with a softmax non-linearity. If the dimensions of input $x$ and output $\hat { y }$ , are $D$ and $C$ (number of classes) respectively, then linear models implement the function $\bar { y } = \bar { \sigma ( W ^ { T } x + b ) }$ ,
96
+
97
+ where $W$ is a $D \times C$ matrix, $b$ is a $C \times 1$ vector and $\sigma ( \cdot )$ is the softmax function. Due to it’s simplicity, this model will serve as a useful baseline in some of our experiments.
98
+
99
+ We always train the classifiers to convergence, with decaying learning rate and no data augmentation.
100
+
101
+ # 3.3 EXAMINATION OF MODE COLLAPSE
102
+
103
+ Experimental results for quantifying mode collapse through classification tasks, described in Section 2.1, are presented below. Table 2 in the Appendix gives details on datasets (subsets of CelebA and LSUN) used in our analysis, such as size $( N )$ , number of classes $( C )$ , and accuracy of the annotator, i.e., a classifier pre-trained on true data, which is then used to label the synthetic, GANgenerated data. Figure 1 presents class distribution in synthetic data, as specified by these annotators. The left panel compares the relative distribution of modes in true data (uniform) with that in various GAN-generated datasets. Each of these datasets is created by drawing $N$ samples from the GAN after it was trained on the corresponding true dataset. The right panel illustrates the evolution of class distributions in various GANs over the course of training2.
104
+
105
+ Results: These visualization lead to the following findings:
106
+
107
+ • All GANs seem to suffer from significant mode-collapse. This becomes more apparent when the annotator granularity is increased, by considering a larger set of classes. For instance, one should compare the relatively balanced class distributions in the 3-class LSUN task to the near-absence of some modes in the 5-class task. • Mode collapse is prevalent in GANs throughout the training process, and does not seem to recede over time. Instead the dominant mode(s) often fluctuate wildly over the course of the training. • For each task, often there is a common set of modes onto which the distint GANs exhibit collapse.
108
+
109
+ In addition to viewing our method as an approach to analyze the mode collapse, we can also use it as a benchmark for GAN comparison. From this perspective, we can observe that, on CelebA, DCGAN and ALI learn somewhat balanced distributions, while WGAN, BEGAN and Improved GAN show prominent mode collapse. This is in contrast to the results obtained LSUN, where, for example, WGAN exhibit relatively small mode collapse, while ALI suffers from significant mode collapse even on the simple 3-class task. This highlights the general challenge in real world applications of GANs: they often perform well on the datasets they were designed for (e.g. ALI on CelebA and WGAN on LSUN), but extension to new datasets is not straightforward. Temporal analysis of mode-collapse shows that there is wide variation in the dominant mode for WGAN and Improved GAN, whereas for BEGAN, the same mode(s) often dominates the entire training process.
110
+
111
+ # 3.4 DIVERSITY EXPERIMENTS
112
+
113
+ Using the procedure outlined in Section 2.2, we perform a quantitative assessment of sample diversity in GANs on the CelebA and LSUN datasets. We restrict our experiments to binary classification as we find they have sufficient complexity to highlight the disparity between true and synthetic data. Selected results for classification-based evaluation of GANs are presented in Table 1. A more extensive study is presented in Table 3, and Figures 4 and 5 in the Appendix (Section 5).
114
+
115
+ As a preliminary check, we inspect the quality of our labeled GAN datasets. For this, we use high-accuracy annotators from Section 2.1 to predict labels for GAN generated data and measure consistency between the predicted and default labels (label correctness). We also inspect confidence scores, defined as the softmax probabilities for predicted class, of the annotator. The motivation behind these metrics is that if the classifier can correctly and with high-confidence predict labels for labeled GAN samples, then it is likely that they are convincing examples of that class, and hence of good “quality”. Empirical results for label agreement and annotator confidence of GAN generated datasets are shown in Tables 1 and 3, and Figure 4. We also report an equivalent Inception Score (Salimans et al., 2016), similar to that described in Section 2.3. Using the Inception network to get the label distribution may not be meaningful for face or scene images. Instead, we compute the Inception Score using the label distribution predicted from the annotator networks. Score is computed as $e x p ( \mathbb { E } _ { x } [ { \bf K L } ( p ( y | x ) ) | | p ( y ) ] )$ , where $y$ refers to label predictions from the annotators 3.
116
+
117
+ <table><tr><td rowspan=5 colspan=1>Task</td><td rowspan=1 colspan=13>Classification Performance</td></tr><tr><td rowspan=4 colspan=1>Data Source</td><td rowspan=4 colspan=2>LabelCorrectness(%)</td><td rowspan=4 colspan=2>Inception Score(μ±σ)</td><td rowspan=1 colspan=8>Accuracy (%)</td></tr><tr><td rowspan=1 colspan=7>Linear model</td><td rowspan=1 colspan=1>ResNet</td></tr><tr><td rowspan=1 colspan=5>↑1</td><td rowspan=1 colspan=2>↑10</td><td rowspan=1 colspan=1>↑</td></tr><tr><td rowspan=1 colspan=3>Train</td><td rowspan=1 colspan=2>Test</td><td rowspan=1 colspan=1>Train</td><td rowspan=1 colspan=1>Test</td><td rowspan=1 colspan=1>Test</td></tr><tr><td rowspan=8 colspan=1>CelebASmiling (Y/N)# Images: 156160</td><td rowspan=3 colspan=1>TrueTrue↓64True↓256True、↓512True↓1024</td><td rowspan=3 colspan=2>92.4</td><td rowspan=3 colspan=2>1.69 ± 0.0074</td><td rowspan=2 colspan=3>85.787.691.593.7</td><td rowspan=3 colspan=2>85.685.082.480.076.2</td><td rowspan=3 colspan=1></td><td rowspan=3 colspan=1></td><td rowspan=1 colspan=1>92.4</td></tr><tr><td rowspan=2 colspan=1>87.882.177.871.2</td></tr><tr><td rowspan=1 colspan=3>95.0</td></tr><tr><td rowspan=5 colspan=1>DCGANWGANALIBEGANImproved GAN</td><td rowspan=5 colspan=2>96.198.293.393.598.4</td><td rowspan=5 colspan=2>1.67 ± 0.00281.68 ± 0.00311.71 ± 0.00271.74 ± 0.00281.88 ± 0.0021</td><td rowspan=2 colspan=3>100.096.8</td><td rowspan=2 colspan=2>77.183.4</td><td rowspan=2 colspan=1>100.096.8</td><td rowspan=2 colspan=1>77.183.5</td><td rowspan=2 colspan=1>63.365.3</td></tr><tr><td rowspan=1 colspan=2>27</td></tr><tr><td rowspan=1 colspan=3>94.5</td><td rowspan=3 colspan=2>80.169.570.2</td><td rowspan=3 colspan=1>95.098.5100.0</td><td rowspan=3 colspan=1>82.469.670.1</td><td rowspan=3 colspan=1>55.864.161.6</td></tr><tr><td rowspan=1 colspan=3>98.5</td></tr><tr><td rowspan=1 colspan=3>100.0</td></tr><tr><td rowspan=6 colspan=1>LSUNBedroom/Kitchen# Images: 200000</td><td rowspan=2 colspan=1>TrueTrue↓512True↓1024True↓2048True4096</td><td rowspan=2 colspan=2>98.2</td><td rowspan=2 colspan=2>1.94 ± 0.0217</td><td rowspan=1 colspan=3>64.764.765.298.7</td><td rowspan=2 colspan=2>64.164.064.056.255.1</td><td rowspan=2 colspan=1></td><td rowspan=2 colspan=1></td><td rowspan=2 colspan=1>99.176.466.956.555.1</td></tr><tr><td rowspan=1 colspan=3>100.0</td><td rowspan=1 colspan=1>.0</td><td rowspan=1 colspan=1>55.1</td></tr><tr><td rowspan=4 colspan=1>DCGANWGANALIImproved GAN</td><td rowspan=4 colspan=2>92.787.880.484.2</td><td rowspan=1 colspan=2>1.85± 0.0036</td><td rowspan=1 colspan=2>90</td><td rowspan=1 colspan=2>90.8</td><td rowspan=1 colspan=2>56.5</td><td rowspan=1 colspan=1>91.2</td><td rowspan=1 colspan=1>56.3</td><td rowspan=4 colspan=1>51.255.750.551.2</td></tr><tr><td rowspan=2 colspan=1>87.880.4</td><td rowspan=1 colspan=2>1.70 ± 0.0023</td><td rowspan=1 colspan=3>86.2</td><td rowspan=1 colspan=1>58</td><td rowspan=1 colspan=1>96.3</td><td rowspan=2 colspan=1>54.150.8</td></tr><tr><td rowspan=2 colspan=2>1.62 ± 0.00261.68 ± 0.0030</td><td rowspan=1 colspan=3>80.7</td><td rowspan=1 colspan=2>49.7</td><td rowspan=1 colspan=1>81.7</td></tr><tr><td rowspan=1 colspan=3>91.6</td><td rowspan=1 colspan=2>55.9</td><td rowspan=1 colspan=1>90.8</td><td rowspan=1 colspan=1>56.5</td></tr></table>
118
+
119
+ Table 1: Select results from the comparative study on classification performance of true data vs. GANs on the CelebA and LSUN datasets. Label correctness measures the agreement between default labels for the synthetic datasets, and those predicted by the annotator, a classifier trained on true data. Shown alongside are the equivalent inception scores computed using labels predicted by the annotator (rather than an Inception Network). Training and test accuracies for a linear model on the various true and synthetic datasets are reported. Also presented are the corresponding accuracies for this classifier trained on down-sampled true data $\left( \downarrow _ { M } \right)$ and oversampled synthetic data $( \uparrow _ { L } )$ . Test accuracy for ResNets trained on these datasets is also shown (training accuracy was always $1 0 0 \%$ ), though it is noticeable that deep networks suffer from issues when trained on synthetic datasets.
120
+
121
+ Next, we train classifiers using the true and labeled GAN-generated datasets and study their performance in terms of accuracy on a hold-out set of true data. ResNets (and other deep variants) yield good classification performance on true data, but suffer from severe overfitting on the synthetic data, leading to poor test accuracy. This already indicates a possible problem with GANs and the diversity of the data they generate. But to highlight this problem better and avoid the issues that stem from overfitting, we also look for a classifier which does not always overfit on the synthetic data. We, however, observed that even training simple networks, such as one fully connected layer with few hidden units, led to overfitting on synthetic data. Hence, we resorted to a very basic linear model described in Section 3.2. Tables 1 and 3 shows results from binary classification experiments using linear models, with the training and test accuracies of the classifier on various datasets.
122
+
123
+ Finally, to get a better understanding of the underlying ”diversity” of synthetic datasets, we train linear models using down-sampled versions of true data (no augmentation), and compare this to the performance of synthetic data, as shown in Tables 1 and 3. Down-sampling the data by a factor of $M$ , denoted as $\downarrow _ { M }$ implies selecting a random $N / M$ subset of the data $D$ . Visualizations of how GAN classification performance compares with (down-sampled) true data are in Figure 5 in the Appendix. A natural argument in the defense of GANs is that we can oversample them, i.e. generate datasets much larger than the size of training data. Results for linear models trained using a 10-fold oversampling of GANs (drawing $1 0 N$ samples), denoted by $\uparrow _ { 1 0 }$ , are show in Tables 1 and 3.
124
+
125
+ Results: The major findings from these experiments are:
126
+
127
+ • Based on Tables 1 and 3, and Figure 4, we see strong agreement between annotator labels and true labels for synthetic data, on par with the scores for the test set of true data. It is thus apparent that the GAN images are of high-quality, as expected based on the visual inspection. These scores are lower for LSUN than CelebA, potentially due to lower quality of generated LSUN images. From these results, we can get a broad understanding of how good GANs are at producing convincing/representative samples from different classes across datasets. This also shows that simple classification-based benchmarks can highlight relevant properties of synthetic datasets.
128
+
129
+ • The equivalent inception score is not very informative and is similar for the true (hold-out set) and synthetic datasets. This is not surprising given the simple nature of our binary classification task and the fact that the true and synthetic datasets have almost a uniform distribution over labels. • It is evident from Table 1 that there is a large performance gap between true and synthetic data on classification tasks. Inspection of training accuracies shows that linear models are able to nearly fit the synthetic datasets, but are grossly underfitting on true data. Given the high scores of synthetic data on the previous experiments to assess dataset ‘quality’ (Tables 1 and 3, and Figure 4), it is likely that the poor classification performance is more indicative of lack of ‘diversity’. Comparing GAN performance to that of down-sampled true data reveals that the learned distribution, which was trained on datasets that have around hundred thousand data points exhibits diversity that is on par with what only mere couple of hundreds of true data samples constitute! This shows that, at least from the point of view of classification, the diversity of the GAN generated data is severely lacking. • Oversampling GANs by 10-fold to produce larger datasets does not improve classification performance. The disparity between true and synthetic data remains nearly unchanged even after this significant oversampling, further highlighting the lack of diversity in GANs.
130
+
131
+ In terms of the conclusions of relative performance of various GANs, we observe that WGAN and ALI (on CelebA) perform better than the other GANs. While BEGAN samples have good perceptual quality (see Figure 2), they consistently perform badly on our classification tasks. On the other hand, WGAN samples have relatively poor visual quality but seem to outperform other GANs in classification tasks. This is a strong indicator of the need to consider other metrics, such as the ones proposed in this paper, in addition to visual inspection to study GANs. For LSUN, the gap between true and synthetic data is much larger, with the classifiers getting near random performance on all the synthetic datasets. Note that these classifiers get poor test accuracy on LSUN but are not overfitting on the training data. In this case, we speculate the lower performance could be due to both lower quality and diversity of LSUN samples.
132
+
133
+ In summary, our key experimental finding is that even simple classification–based tests can hold tremendous potential to shed insight on the learned distribution in GANs. This not only helps us to get a deeper understanding of many of the underlying issues, but also provides with a more quantitative and rigorous platform on which to compare different GANs. Our techniques could, in principle, be also applied to assess other generative models such as Variational Auto-Encoders (VAEs) Kingma & Welling (2014). However, VAEs have significant problems in generating realistic samples on the datasets used in our analysis in the first place – see Arora & Zhang (2017).
134
+
135
+ # 4 CONCLUSIONS
136
+
137
+ In this paper, we put forth techniques for examining the ability of GANs to capture key characteristics of the training data, through the lens of classification. Our tools are scalable, quantitative and automatic (no need for visual inspection of images). They thus are capable of studying state-ofthe-art GANs on realistic, large-scale image datasets. Further, they serve as a mean to perform a nuanced comparison of GANs and to identify their relative merits, including properties that cannot be discerned from mere visual inspection.
138
+
139
+ We then use the developed techniques to perform empirical studies on popular GANs on the CelebA and LSUN datasets. Our examination shows that mode collapse is indeed a prevalent issue for GANs. Also, we observe that synthetic GAN-generated datasets have significantly reduced diversity, at least when examined from a classification perspective. In fact, the diversity of such synthetic data is often few orders of magnitude smaller than that of the true data. Furthermore, this gap in diversity does not seem to be bridged by simply producing much larger datasets by oversampling GANs. Finally, we also notice that good perceptual quality of samples does not necessarily correlate – and might sometime even anti-correlate – with distribution diversity. These findings suggest that we need to go beyond the visual inspection–based evaluations and look for more quantitative tools for assessing quality of GANs, such as the ones presented in this paper.
140
+
141
+ # REFERENCES
142
+
143
+ Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks. ´ In International Conference on Machine Learning, pp. 214–223, 2017.
144
+
145
+ Sanjeev Arora and Yi Zhang. Do GANs actually learn the distribution? An empirical study. arXiv preprint arXiv:1706.08224, 2017.
146
+
147
+ David Berthelot, Tom Schumm, and Luke Metz. BEGAN: Boundary equilibrium generative adversarial networks. arXiv preprint arXiv:1703.10717, 2017.
148
+
149
+ 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.
150
+
151
+ Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Alex Lamb, Martin Arjovsky, Olivier Mastropietro, and Aaron Courville. Adversarially learned inference. In International Conference on Learning Representations, Apr 2017. URL https://arxiv.org/abs/1606.00704.
152
+
153
+ Ian Goodfellow. Nips 2016 tutorial: Generative adversarial networks. arXiv preprint arXiv:1701.00160, 2016.
154
+
155
+ 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.
156
+
157
+ 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.
158
+
159
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In International Conference on Learning Representations, Apr 2014. URL https://arxiv.org/abs/1312.6114.
160
+
161
+ Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), 2015.
162
+
163
+ Luke Metz, Ben Poole, David Pfau, and Jascha Sohl-Dickstein. Unrolled generative adversarial networks. arXiv preprint arXiv:1611.02163, 2016.
164
+
165
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. arXiv preprint arXiv:1511.06434, 2015.
166
+
167
+ David Rolnick, Andreas Veit, Serge Belongie, and Nir Shavit. Deep learning is robust to massive label noise. arXiv preprint arXiv:1705.10694, 2017.
168
+
169
+ 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.
170
+
171
+ Ashish Shrivastava, Tomas Pfister, Oncel Tuzel, Joshua Susskind, Wenda Wang, and Russell Webb. Learning from simulated and unsupervised images through adversarial training. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
172
+
173
+ L. Theis, A. van den Oord, and M. Bethge. A note on the evaluation of generative models. In International Conference on Learning Representations, Apr 2016. URL http://arxiv.org/ abs/1511.01844.
174
+
175
+ Yuhuai Wu, Yuri Burda, Ruslan Salakhutdinov, and Roger Grosse. On the quantitative analysis of decoder-based generative models. arXiv preprint arXiv:1611.04273, 2016.
176
+
177
+ Fisher Yu, Yinda Zhang, Shuran Song, Ari Seff, and Jianxiong Xiao. LSUN: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
178
+
179
+ Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaolei Huang, Xiaogang Wang, and Dimitris Metaxas. Stackgan: Text to photo-realistic image synthesis with stacked generative adversarial networks. arXiv preprint arXiv:1612.03242, 2016.
180
+
181
+ Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. arXiv preprint arXiv:1703.10593, 2017.
182
+
183
+ # 5 APPENDIX
184
+
185
+ # 5.1 EXPERIMENTAL SETUP
186
+
187
+ # 5.1.1 DATASETS FOR CLASSIFICATION TASKS
188
+
189
+ To assess GAN performance from the perspective of classification, we construct a set of classification tasks on the CelebA and LSUN datasets. In the case of the LSUN dataset, images are annotated with scene category labels, which makes it straightforward to use this data for binary and multiclass classification. On the other hand, each image in the CelebA dataset is labeled with 40 binary attributes. As a result, a single image has multiple associated attribute labels. Here, we construct classification tasks can by considering binary combinations of an attribute(s) (examples are shown in Figure 2). Attributes used in our experiments were chosen such that the resulting dataset was large, and classifiers trained on true data got high-accuracy so as to be good annotators for the synthetic data. Details on datasets used in our classification tasks, such as training set size $( N )$ , number of classes $( C )$ , and accuracy of the annotator, i.e., a classifier pre-trained on true data which is used to label the synthetic GAN-generated data, are provided in Table 2.
190
+
191
+ <table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>N</td><td rowspan=1 colspan=1>C</td><td rowspan=1 colspan=1>Annotator&#x27;s Accuracy (%)</td></tr><tr><td rowspan=1 colspan=1>CelebA: Makeup, Smiling</td><td rowspan=1 colspan=1>102,436</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>90.9, 92.4</td></tr><tr><td rowspan=1 colspan=1>CelebA: Male, Mouth Open</td><td rowspan=1 colspan=1>115,660</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>97.9, 93.5</td></tr><tr><td rowspan=1 colspan=1>CelebA: Bangs, Smiling</td><td rowspan=1 colspan=1>45,196</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>93.9,92.4</td></tr><tr><td rowspan=1 colspan=1>LSUN: Bedroom, Kitchen, Classroom</td><td rowspan=1 colspan=1>150,000</td><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>98.7</td></tr><tr><td rowspan=1 colspan=1>LSUN: Bedroom, Conference Room, Dining Room,Kitchen,Living Room</td><td rowspan=1 colspan=1>250,000</td><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>93.7</td></tr></table>
192
+
193
+ Table 2: Details of CelebA and LSUN subsets used for the studies in Section 3.3. Here, we use a classifier trained on true data as an annotator that let’s us infer label distribution for the synthetic, GAN-generated data. $N$ is the size of the training set and $C$ is the number of classes in the true and synthetic datasets. Annotator’s accuracy refers to the accuracy of the classifier on a test set of true data. For CelebA, we use a combination of attribute-wise binary classifiers as annotators due their higher accuracy compared to a single classifier trained jointly on all the four classes.
194
+
195
+ # 5.1.2 MODELS
196
+
197
+ Benchmarks were performed on standard implementations - • DCGAN: https://github.com/carpedm20/DCGAN-tensorflow • WGAN: https://github.com/martinarjovsky/WassersteinGAN • ALI: https://github.com/IshmaelBelghazi/ALI • BEGAN :https://github.com/carpedm20/BEGAN-tensorflow • Improved GAN: https://github.com/openai/improved-gan • ResNet Classifier: Variation of the standard TensorFlow ResNet https://github.com/ tensorflow/models/blob/master/research/resnet/resnet_model.py
198
+
199
+ # 5.2 ADDITION EXPERIMENTAL RESULTS
200
+
201
+ # 5.2.1 SAMPLE QUALITY
202
+
203
+ For each of our benchmark experiments, we ascertain that the visual quality of samples produced by the GANs is comparable to that reported in prior work. Examples of random samples drawn for multi-class datasets from both true and synthetic data are shown in Figure 2 for the CelebA dataset, and in Figure!3 for the LSUN dataset.
204
+
205
+ # 5.2.2 MODE COLLAPSE EXPERIMENTS
206
+
207
+ In the studies to observe mode collapse in GANs described in Sections 2.1 and 3.3, we use a pretrained classifier as an annotator to obtain the class distribution for datasets generated from unconditional GANs. Figure 4 shows histograms of annotator confidence for the datasets used for benchmarking listed in Table 2. As can be seen in these figures, the annotator confidence for the synthetic data is comparable to that on the hold-out set of true data. Thus, it seems likely that the
208
+
209
+ ![](images/ffd1eadad3e04387b4653a31d59a532c5b3dd825d3c778538887a71a3f4fdf6e.jpg)
210
+ Figure 2: Illustration of datasets from CelebA used in proposed classification-based benchmarks to evaluate GANs. Shown alongside are images sampled from various unconditional GANs trained on this dataset. Labels for the GAN samples are obtained using a pre-trained classifier as an annotator.
211
+
212
+ GAN generated samples are of good quality and are truly representative examples of their respective classes, as expected based on visual inspection.
213
+
214
+ # 5.2.3 DIVERSITY EXPERIMENTS
215
+
216
+ Table 3 presents an extension of the comparative study of classification performance of true and GAN generated data provided in Table 1. Visualizations of how test accuracies of a linear model classifier trained on GAN data compares with one trained on true data is shown in Figure 5. For each task, the bold curve shows test accuracy of a classifier trained on true data as a function of true dataset size. A down-sampling factor of $M$ corresponds to training the classifier on a random $N / M$ subset of true data. The dashed curves show test accuracy of classifiers trained on GAN datasets, obtained by drawing $N$ samples from GANs at the culmination of the training process. Based on these visualizations, it is apparent that GANs have comparable classification performance to a subset of training data that is more than a $1 0 0 \mathbf { x }$ smaller. Thus, from the perspective of classification, GANs have diversity on par with a few hundred true data samples.
217
+
218
+ ![](images/e5b8ba0ba9dfbdfd0a8afcc1a9e78e8a86380ad9f5d7993dbf0217cebfd010d4.jpg)
219
+ (b) 5-class dataset from LSUN for Bedroom, Conference Room, Dining Room, Kitchen, Living Room.
220
+
221
+ ![](images/2ebb51f850f33b6ea62b998998d116ae8a6c587d4bac7ba0cb1ceccba4d70787.jpg)
222
+ Figure 3: Illustration of datasets from LSUN used in proposed classification-based benchmarks to evaluate GANs. Shown alongside are images sampled from various unconditional GANs trained on this dataset. Labels for the GAN samples are obtained using a pre-trained classifier as an annotator.
223
+ Figure 4: Histograms of annotator confidence (softmax probability) during label prediction on true data (test set) and synthetic data for tasks on the CelebA and LSUN datasets (see Section 3.4).
224
+
225
+ ![](images/bcdf6de7631c3992c2acb9241b93e99085cff09b8f2d85b8369478a356137e12.jpg)
226
+ Figure 5: Illustration of the classification performance of true data compared with GAN-generated synthetic datasets based on experiments described in Section 3.4. Classification is performed using a basic linear model, described in Section 3.2, and performance is reported in terms of accuracy on a hold-out set of true data. In the plots, the bold curve captures the classification performance of models trained on true data vs the size of the true dataset (maximum size is $N$ ). Dashed lines represent performance of classifiers trained on various GAN-generated datasets of size $N$ . These plots indicate that GAN samples have ”diversity” comparable to a small subset (few hundred samples) of true data. Here the notion of diversity is one that is relevant for classification tasks.
227
+
228
+ <table><tr><td rowspan=5 colspan=1>Task</td><td rowspan=1 colspan=8>Classification Performance</td></tr><tr><td rowspan=4 colspan=1>Data Source</td><td rowspan=4 colspan=1>LabelCorrectness(%)</td><td rowspan=4 colspan=1>Inception Score(μ±σ)</td><td rowspan=1 colspan=5>Accuracy (%)</td></tr><tr><td rowspan=1 colspan=4>Linear model</td><td rowspan=1 colspan=1>ResNet</td></tr><tr><td rowspan=1 colspan=2>↑1</td><td rowspan=1 colspan=2>↑10</td><td rowspan=1 colspan=1>↑1</td></tr><tr><td rowspan=1 colspan=1>Train</td><td rowspan=1 colspan=1>Test</td><td rowspan=1 colspan=1>Train</td><td rowspan=1 colspan=1>Test</td><td rowspan=1 colspan=1>Test</td></tr><tr><td rowspan=6 colspan=1>CelebAMale (Y/N)# Images: 136522</td><td rowspan=2 colspan=1>TrueTrue↓64True↓256True↓512True↓1024</td><td rowspan=2 colspan=1>97.9</td><td rowspan=2 colspan=1>1.98 ± 0.0033</td><td rowspan=2 colspan=1>88.189.691.696.3100.0</td><td rowspan=2 colspan=1>88.888.786.983.883.1</td><td rowspan=2 colspan=1></td><td rowspan=2 colspan=1></td><td rowspan=1 colspan=1>97.992.9</td></tr><tr><td rowspan=1 colspan=1>89.882.681.4</td></tr><tr><td rowspan=4 colspan=1>DCGANWGANALIBEGANImproved GAN</td><td rowspan=4 colspan=1>98.298.399.299.399.8</td><td rowspan=4 colspan=1>1.97± 0.00131.97 ± 0.00131.99 ± 0.00081.99 ± 0.00061.99 ± 0.0004</td><td rowspan=4 colspan=1>100.096.795.897.9100.0</td><td rowspan=4 colspan=1>79.284.086.778.075.6</td><td rowspan=4 colspan=1>100.096.795.898.0100.0</td><td rowspan=1 colspan=1>79.6</td><td rowspan=1 colspan=1>56.4</td></tr><tr><td rowspan=3 colspan=1>83.986.778.271.0</td><td rowspan=1 colspan=1>50.0</td></tr><tr><td rowspan=1 colspan=1>58.9</td></tr><tr><td rowspan=1 colspan=1>55.471.7</td></tr><tr><td rowspan=4 colspan=1>CelebASmiling (Y/N)# Images: 156160</td><td rowspan=2 colspan=1>TrueTrue64True↓256True↓512True↓1024</td><td rowspan=2 colspan=1>92.4</td><td rowspan=2 colspan=1>1.69 ± 0.0074</td><td rowspan=2 colspan=1>85.787.691.593.795.0</td><td rowspan=2 colspan=1>85.685.082.480.076.2</td><td rowspan=2 colspan=1></td><td rowspan=2 colspan=1></td><td rowspan=1 colspan=1>92.487.8</td></tr><tr><td rowspan=1 colspan=1>82.177.871.2</td></tr><tr><td rowspan=2 colspan=1>DCGANWGANALIBEGANImproved GAN</td><td rowspan=2 colspan=1>96.198.293.393.598.4</td><td rowspan=1 colspan=1>1.67± 0.00281.68 ± 0.00311.71 ± 0.0027</td><td rowspan=1 colspan=1>100.096.894.5</td><td rowspan=1 colspan=1>77.183.480.1</td><td rowspan=1 colspan=1>100.096.895.0</td><td rowspan=1 colspan=1>77.183.582.4</td><td rowspan=1 colspan=1>63.365.355.8</td></tr><tr><td rowspan=1 colspan=1>1.74 ± 0.00281.88 ± 0.0021</td><td rowspan=1 colspan=1>98.5100.0</td><td rowspan=1 colspan=1>69.570.2</td><td rowspan=1 colspan=1>98.5100.0</td><td rowspan=1 colspan=1>69.670.1</td><td rowspan=1 colspan=1>64.161.6</td></tr><tr><td rowspan=2 colspan=1>CelebABlack Hair (Y/N)#Images: 77812</td><td rowspan=1 colspan=1>TrueTrue↓64True↓256True↓512True↓1024</td><td rowspan=1 colspan=1>84.5</td><td rowspan=1 colspan=1>1.68 ± 0.0112</td><td rowspan=1 colspan=1>76.479.786.389100.0</td><td rowspan=1 colspan=1>76.575.472.668.765.4</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>84.580.075.873.972.7</td></tr><tr><td rowspan=1 colspan=1>DCGANWGANALIBEGANImproved GAN</td><td rowspan=1 colspan=1>86.776.079.487.686.7</td><td rowspan=1 colspan=1>1.68 ± 0.00401.60 ± 0.00551.63 ± 0.00281.74 ± 0.00281.64 ± 0.0045</td><td rowspan=1 colspan=1>100.094.494.994.1100.0</td><td rowspan=1 colspan=1>70.973.771.067.670.3</td><td rowspan=1 colspan=1>100.094.394.994.1100.0</td><td rowspan=1 colspan=1>70.573.470.267.769.1</td><td rowspan=1 colspan=1>53.458.555.767.270.2</td></tr><tr><td rowspan=3 colspan=1>LSUNBedroom/Kitchen#Images: 200000</td><td rowspan=1 colspan=1>TrueTrue↓512True↓1024True↓2048True4096</td><td rowspan=1 colspan=1>98.2</td><td rowspan=1 colspan=1>1.94 ± 0.0217</td><td rowspan=1 colspan=1>64.764.765.298.7100.0</td><td rowspan=1 colspan=1>64.164.064.056.255.1</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>99.176.466.956.555.1</td></tr><tr><td rowspan=2 colspan=1>DCGANWGANALIImproved GAN</td><td rowspan=2 colspan=1>92.787.880.484.2</td><td rowspan=1 colspan=1>1.85± 0.00361.70 ± 0.0023</td><td rowspan=1 colspan=1>90.886.2</td><td rowspan=1 colspan=1>56.558.2</td><td rowspan=1 colspan=1>91.296.3</td><td rowspan=1 colspan=1>56.354.1</td><td rowspan=1 colspan=1>31.255.7</td></tr><tr><td rowspan=1 colspan=1>1.62 ± 0.00261.68 ± 0.0030</td><td rowspan=1 colspan=1>80.791.6</td><td rowspan=1 colspan=1>49.755.9</td><td rowspan=1 colspan=1>81.790.8</td><td rowspan=1 colspan=1>50.856.5</td><td rowspan=1 colspan=1>50.551.2</td></tr></table>
229
+
230
+ Table 3: Detailed version of the comparative study of the classification performance of true data and GANs on the CelebA and LSUN datasets shown in Table 1, based on experiments described in Section 3.4. Label correctness measures the agreement between default labels for the synthetic datasets, and those predicted by the annotator, a classifier trained on the true data. Shown alongside are the equivalent inception scores computed using labels predicted by the annotator (instead of the Inception Network). Training and test accuracies for a linear model classifier on the various true and synthetic datasets are reported. Also presented are the corresponding accuracies for a linear model trained on down-sampled true data $\left( \downarrow _ { M } \right)$ and oversampled synthetic data $( \uparrow _ { L } )$ . Test accuracy for ResNets trained on these datasets is also shown (training accuracy was always $1 0 0 \%$ ), though it is noticeable that deep networks suffer from issues when trained on synthetic datasets.
md/train/S1TgE7WR-/S1TgE7WR-.md ADDED
@@ -0,0 +1,588 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # COVARIANT COMPOSITIONAL NETWORKS FOR LEARNING GRAPHS
2
+
3
+ Risi Kondor, Truong Son Hy, Horace Pan & Brandon M. Anderson
4
+
5
+ Department of Computer Science
6
+ The University of Chicago
7
+ Chicago, IL - 60637
8
+ {risi,hytruongson,hopan,brandona}@cs.uchicago.edu
9
+
10
+ Shubhendu Trivedi Toyota Technological Institute Chicago, IL - 60637 shubhendu@ttic.edu
11
+
12
+ # ABSTRACT
13
+
14
+ Most existing neural networks for learning graphs address permutation invariance by conceiving of the network as a message passing scheme, where each node sums the feature vectors coming from its neighbors. We argue that this imposes a limitation on their representation power, and instead propose a new general architecture for representing objects consisting of a hierarchy of parts, which we call covariant compositional networks (CCNs). Here, covariance means that the activation of each neuron must transform in a specific way under permutations, similarly to steerability in CNNs. We achieve covariance by making each activation transform according to a tensor representation of the permutation group, and derive the corresponding tensor aggregation rules that each neuron must implement. Experiments show that CCNs can outperform competing methods on standard graph learning benchmarks.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ Learning on graphs has a long history in the kernels literature, including approaches based on random walks (Gartner, 2002; Borgwardt & Kriegel, 2005; Feragen et al., 2013), counting subgraphs ¨ (Shervashidze et al., 2009), spectral ideas (Vishwanathan et al., 2010), label propagation schemes with hashing (Shervashidze et al., 2011; Neumann et al., 2016), and even algebraic ideas (Kondor & Borgwardt, 2008). Many of these papers address moderate size problems in chemo- and bioinformatics, and the way they represent graphs is essentially fixed.
19
+
20
+ Recently, with the advent of deep learning and much larger datasets, a sequence of neural network based approaches have appeared to address the same problem, starting with (Scarselli et al., 2009). In contrast to the kernels framework, neural networks effectively integrate the classification or regression problem at hand with learning the graph representation itself, in a single, end-to-end system. In the last few years, there has been a veritable explosion in research activity in this area. Some of the proposed graph learning architectures (Duvenaud et al., 2015; Kearnes et al., 2016; Niepert et al., 2016) directly seek inspiration from the type of classical CNNs that are used for image recognition (LeCun et al., 1998; Krizhevsky et al., 2012). These methods involve first fixing a vertex ordering, then moving a filter across vertices while doing some computation as a function of the local neighborhood to generate a representation. This process is then repeated multiple times like in classical CNNs to build a deep graph representation. Other notable works on graph neural networks include (Li et al., 2016; Schutt et al., 2017; Battaglia et al., 2016; Kipf & Welling, 2017). ¨ Very recently, (Gilmer et al., 2017) showed that many of these approaches can be seen to be specific instances of a general message passing formalism, and coined the term message passing neural networks (MPNNs) to refer to them collectively.
21
+
22
+ While MPNNs have been very successful in applications and are an active field of research, they differ from classical CNNs in a fundamental way: the internal feature representations in CNNs are equivariant to such transformations of the inputs as translation and rotations (Cohen & Welling, 2016; 2017), the internal representations in MPNNs are fully invariant. This is a direct result of the fact that MPNNs deal with the permutation invariance issue in graphs simply by summing the messages coming from each neighbor. In this paper we argue that this is a serious limitation that restricts the representation power of MPNNs.
23
+
24
+ MPNNs are ultimately compositional (part-based) models, that build up the representation of the graph from the representations of a hierarchy of subgraphs. To address the covariance issue, we study the covariance behavior of such networks in general, introducing a new general class of neural network architectures, which we call compositional networks (comp-nets). One advantage of this generalization is that instead of focusing attention on the mechanics of how information propagates from node to node, it emphasizes the connection to convolutional networks, in particular, it shows that what is missing from MPNNs is essentially the analog of steerability.
25
+
26
+ Steerability implies that the activations (feature vectors) at a given neuron must transform according to a specific representation (in the algebraic sense) of the symmetry group of its receptive field, in our case, the group of permutations, $\mathbb { S } _ { m }$ . In this paper we only consider the defining representation and its tensor products, leading to first, second, third etc. order tensor activations. We derive the general form of covariant tensor propagation in comp-nets, and find that each “channel” in the network corresponds to a specific way of contracting a higher order tensor to a lower order one. Note that here by tensor activations we mean not just that each activation is expressed as a multidimensional array of numbers (as the word is usually used in the neural networks literature), but also that it transforms in a specific way under permutations, which is a more stringent criterion. The parameters of our covariant comp-nets are the entries of the mixing matrix that prescribe how these channels communicate with each other at each node. Our experiments show that this new architecture can beat scalar message passing neural networks on several standard datasets.
27
+
28
+ # 2 LEARNING GRAPHS
29
+
30
+ Graph learning encompasses a broad range of problems where the inputs are graphs and the outputs are class labels (classification), real valued quantities (regression) or more general, possibly combinatorial, objects. In the standard supervised learning setting this means that the training set consists of $m$ input/output pairs $\left\{ { ( G _ { 1 } , y _ { 1 } ) , ( G _ { 2 } , y _ { 2 } ) , \dots , ( G _ { m } , y _ { m } ) } \right\}$ , where each $G _ { i }$ is a graph and $y _ { i }$ is the corresponding label, and the goal is to learn a function $h \colon G \to y$ that will successfully predict the labels of further graphs that were not in the training set.
31
+
32
+ By way of fixing our notation, in the following we assume the each graph $G$ is a pair $( V , E )$ , where $V$ is the vertex set of $G$ and $E \subseteq V \times V$ is its edge set. For simplicity, we assume that $V = \{ 1 , 2 , \dots , n \}$ . We also assume that $G$ has no self-loops $( ( i , i ) \notin E$ for any $i \in V .$ ) and that $G$ is symmetric, i.e., $( i , j ) \in E \Rightarrow ( j , i ) \in E ^ { 1 }$ . We will, however, allow each edge $( i , j )$ to have a corresponding weight $w _ { i , j }$ , and each vertex $i$ to have a corresponding feature vector (vertex label) $l _ { i } \in \mathbb { R } ^ { d }$ . The latter, in particular, is important in many scientific applications, where $l _ { i }$ might encode, for example, what type of atom occupies a particular site in a molecule, or the identity of a protein in a biochemical interaction network. All the topological information about $G$ can be summarized in an adjacency matrix $A \in \mathbb { R } ^ { n \times n }$ , where $A _ { i , j } = w _ { i , j }$ if $i$ and $j$ are connected by an edge, and otherwise $A _ { i , j } = 0$ . When dealing with labeled graphs, we also have to provide $\left( l _ { 1 } , \ldots , l _ { n } \right)$ to fully specify $G$ .
33
+
34
+ One of the most fascinating aspects of graphs, but also what makes graph learning challenging, is that they involve structure at multiple different scales. In the case when $G$ is the graph of a protein, for example, an ideal graph learning algorithm would represent $G$ in a manner that simultaneously captures structure at the level of individual atoms, functional groups, interactions between functional groups, subunits of the protein, and the protein’s overall shape.
35
+
36
+ The other major requirement for graph learning algorithms relates to the fact that the usual ways to store and present graphs to learning algorithms have a critical spurious symmetry: If we were to permute the vertices of $G$ by any permutation $\sigma \colon \{ 1 , 2 , \ldots , n \} \to \{ 1 , 2 , \ldots , n \}$ (in other words, rename vertex 1 as $\sigma ( 1 )$ , vertex 2 as $\sigma ( 2 )$ , etc.), then the adjacency matrix would change to
37
+
38
+ ![](images/b079f02a32e4e9a1eb95fdd65106bcb063f8214b5aa9215a677ac5d9f5e43e96.jpg)
39
+ Figure 1: (a) A small graph $G$ with 6 vertices and its adjacency matrix. (b) An alternative form $G ^ { \prime }$ of the same graph, derived from $G$ by renumbering the vertices by a permutation $\sigma \colon \{ 1 , 2 , \ldots , 6 \} \mapsto$ $\{ 1 , 2 , \ldots , 6 \}$ . The adjacency matrices of $G$ and $G ^ { \prime }$ are different, but topologically they represent the same graph. Therefore, we expect the feature map $\phi$ to satisfy $\phi ( G ) \bar { = } \phi ( \bar { G } ^ { \prime } )$ .
40
+
41
+ $$
42
+ A _ { i , j } ^ { \prime } = A _ { \sigma ^ { - 1 } ( i ) , \sigma ^ { - 1 } ( j ) } ,
43
+ $$
44
+
45
+ and simultaneously the vertex labels would change to $\left( l _ { 1 } ^ { \prime } , \ldots , l _ { n } ^ { \prime } \right)$ , where ${ l ^ { \prime } } _ { i } = l _ { \sigma ^ { - 1 } ( i ) }$ . However, $G ^ { \prime } = ( A ^ { \prime } , l _ { 1 } ^ { \prime } , \ldots , l _ { n } ^ { \prime } )$ would still represent exactly the same graph as $G = ( A , l _ { 1 } , \ldots , l _ { n } )$ . In particular, (a) in training, whether $G$ or $G ^ { \prime }$ is presented to the algorithm must not make a difference to the final hypothesis $h$ that it returns, (b) $h$ itself must satisfy $\bar { h } ( G ) = h ( G ^ { \prime } )$ for any labeled graph and its permuted variant.
46
+
47
+ Most learning algorithms for combinatorial objects hinge on some sort of fixed or learned internal representation of data, called the feature map, which, in our case we denote $\phi ( G )$ . The set of all $n !$ possible permutations of $\{ 1 , 2 , \ldots , n \}$ forms a group called the symmetric group of order $n$ , denoted $\mathbb { S } _ { n }$ . The permutation invariance criterion can then be formulated as follows (Figure 1).
48
+
49
+ Definition 1. Let $\mathcal { A }$ be a graph learning algorithm that uses a feature map $G \mapsto \phi ( G )$ . We say that the feature map $\phi$ (and consequently the algorithm $\mathcal { A }$ ) is permutation invariant $i f ,$ given any $n \in \mathbb N$ , any $n$ vertex labeled graph $G = ( A , l _ { 1 } , \dots , l _ { n } ) $ , and any permutation $\sigma \in \mathbb { S } _ { n }$ , letting $G ^ { \prime } = ( A ^ { \prime } , l _ { 1 } ^ { \prime } , \ldots , l _ { n } ^ { \prime } )$ , where $A _ { i , j } ^ { \prime } = { A _ { \sigma } } - 1 ( i ) , \sigma ^ { - 1 } ( j )$ and $l _ { i } ^ { \prime } = l _ { \sigma ^ { - 1 } ( i ) }$ , we have that $\phi ( G ) = \phi ( G ^ { \prime } )$ .
50
+
51
+ Capturing multiscale structure and respecting permutation invariance are the two the key constraints around which most of the graph learning literature revolves. In kernel based learning, for example, invariant kernels have been constructed by counting random walks (Gartner, 2002), matching ¨ eigenvalues of the graph Laplacian (Vishwanathan et al., 2010) and using algebraic ideas (Kondor & Borgwardt, 2008).
52
+
53
+ # 3 COMPOSITIONAL NETWORKS
54
+
55
+ Many recent graph learning papers, whether or not they make this explicit, employ a compositional approach to modeling graphs, building up the representation of $G$ from representations of subgraphs. At a conceptual level, this is similar to part-based modeling, which has a long history in machine learning (Fischler & Elschlager, 1973; Ohta et al., 1978; Tu et al., 2005; Felzenszwalb & Huttenlocher, 2005; Zhu & Mumford, 2006; Felzenszwalb et al., 2010). In this section we introduce a general, abstract architecture called compositional networks (comp-nets) for representing complex objects as a combination of their parts, and show that several exisiting graph neural networks can be seen as special cases of this framework.
56
+
57
+ Definition 2. Let $\mathcal { G }$ be a compound object with n elementary parts (atoms) $\mathcal { E } = \{ e _ { 1 } , \ldots , e _ { n } \}$ . A composition scheme for $\mathcal { G }$ is a directed acyclic graph (DAG) $\mathcal { M }$ in which each node ${ \mathfrak { n } } _ { i }$ is associated with some subset $\mathcal { P } _ { i }$ of $\mathcal { E }$ (these subsets are called the parts of $\mathcal { G }$ ) in such a way that
58
+
59
+ 1. If ${ \mathfrak { n } } _ { i }$ is a leaf node, then $\mathcal { P } _ { i }$ contains a single atom ${ e _ { \xi ( i ) } } ^ { 2 }$ .
60
+ 2. $\mathcal { M }$ has a unique root node ${ \mathfrak { n } } _ { r }$ , which corresponds to the entire set $\{ e _ { 1 } , \ldots , e _ { n } \}$ .
61
+ 3. For any two nodes ${ \mathfrak { n } } _ { i }$ and ${ \mathfrak { n } } _ { j }$ , $i f { \mathfrak { n } } _ { i }$ is a descendant of ${ \mathfrak { n } } _ { j }$ , then $\mathcal { P } _ { i } \subset \mathcal { P } _ { j }$ .
62
+
63
+ We define a compositional network as a composition scheme in which each node ${ \mathfrak { n } } _ { i }$ also carries a feature vector $f _ { i }$ that provides a representation of the corresponding part (Figure 2). When we want to emphasize the connection to more classical neural architectures, we will refer to ${ \mathfrak { n } } _ { i }$ as the $i ^ { \because }$ ’th neuron, $\mathcal { P } _ { i }$ as its receptive field3, and $f _ { i }$ as its activation.
64
+
65
+ ![](images/d5a99f82a0d8332cec0992d2ec5b746ec2e02c9612f36eb9e4be87cd3bc7392c.jpg)
66
+ Figure 2: (a) A composition scheme for an object $\mathcal { G }$ is a DAG in which the leaves correspond to atoms, the internal nodes correspond to sets of atoms, and the root corresponds to the entire object. (b) A compositional network is a composition scheme in which each node ${ \mathfrak { n } } _ { i }$ also carries a feature vector $f _ { i }$ . The feature vector at ${ \mathfrak { n } } _ { i }$ is computed from the feature vectors of the children of ${ \mathfrak { n } } _ { i }$ .
67
+
68
+ ![](images/5eb2ddf7a5ac4bb48bfcbaa0d27baa486f0ad9c00099b449f5edd57c0f1427c9.jpg)
69
+ Figure 3: A minimal requirement for composition schemes is that they be invariant to permutation, i.e. that if the numbering of the atoms is changed by a permutation $\sigma$ , then we must get an isomorphic DAG. Any node in the new DAG that corresponds to $\{ e _ { i _ { 1 } } ^ { \prime } , \ldots , e _ { i _ { k } } ^ { \prime } \}$ must have a corrresponding node in the old DAG corresponding to $\{ e _ { \sigma ^ { - 1 } \left( i _ { 1 } \right) } , \ldots , e _ { \sigma ^ { - 1 } \left( i _ { k } \right) } \}$ .
70
+
71
+ Definition 3. Let $\mathcal { G }$ be a compound object in which each atom $e _ { i }$ carries a label $l _ { i }$ , and $\textit { \textbf { M } a }$ composition scheme for $\mathcal { G }$ . The corresponding compositional network $\mathcal { N }$ is a $D A G$ with the same structure as $\mathcal { M }$ in which each node ${ \mathfrak { n } } _ { i }$ also has an associated feature vector $f _ { i }$ such that
72
+
73
+ 1. If ${ \mathfrak { n } } _ { i }$ is a leaf node, then $f _ { i } = l _ { \xi ( i ) }$
74
+
75
+ 2. If $\mathsf { \Pi } _ { \mathfrak { n } _ { i } }$ is a non-leaf node, and its children are $\mathfrak { n } _ { c _ { 1 } } , \ldots , \mathfrak { n } _ { c _ { k } }$ , then $f _ { i } = \Phi ( f _ { c _ { 1 } } , f _ { c _ { 2 } } , \dots , f _ { c _ { k } } )$ for some aggregation function $\Phi$ . (Note: in general, $\Phi$ can also depend on the relationships between the subparts, but for now, to keep the discussion as simple as possible, we ignore this possibility.)
76
+
77
+ The representation $\phi ( \mathcal G )$ afforded by the comp-net is given by the feature vector $f _ { r }$ of the root.
78
+
79
+ Note that while, for the sake of concreteness, we call the $f _ { i }$ ’s “feature vectors”, there is no reason a priori why they need to be vectors rather than some other type of mathematical object. In fact, in the second half of the paper we make a point of treating the $f _ { i }$ ’s as tensors, because that is what will make it the easiest to describe the specific way that they transform with respect to permutations.
80
+
81
+ In compositional networks for graphs, the atoms will usually be the vertices, and the $\mathcal { P } _ { i }$ parts will correspond to clusters of nodes or neighborhoods of given radii. Comp-nets are particularly attractive in this domain because they can combine information from the graph at different scales. The comp-net formalism also suggests a natural way to satisfy the permutation invariance criterion of Definition 1.
82
+
83
+ Definition 4. Let $\mathcal { M }$ be the composition scheme of an object $\mathcal { G }$ with n atoms and $\mathcal { M } ^ { \prime }$ the composition scheme of another object that is equivalent in structure to $\mathcal { G }$ , except that its atoms have been permuted by some permutation $\sigma \in \mathbb { S } _ { n }$ $( e _ { i } ^ { \prime } = e _ { \sigma ^ { - 1 } ( i ) }$ and $\ell _ { i } ^ { \prime } = \ell _ { \sigma ^ { - 1 } ( i ) } )$ . We say that $\mathcal { M }$ (more precisely, the algorithm generating $\mathcal { M }$ ) is permutation invariant if there is a bijection $\psi \colon { \mathcal { M } } \to { \mathcal { M } } ^ { \prime }$ taking each ${ \mathfrak { n } } _ { a } \in { \mathcal { M } }$ to some $\mathfrak { n } _ { b } ^ { \prime } \in \mathcal { M } ^ { \prime }$ such that if $\mathcal { P } _ { a } = \{ e _ { i _ { 1 } } , . . . , e _ { i _ { k } } \}$ , then $\mathcal { P } _ { b } ^ { \prime } = \{ e _ { \sigma ( i _ { 1 } ) } ^ { \prime } , \cdot \cdot \cdot , e _ { \sigma ( i _ { k } ) } ^ { \prime } \}$ .
84
+
85
+ Proposition 1. Let $\phi ( \mathcal G )$ be the output of a comp-net based on a composition scheme $\mathcal { M }$ . Assume 1. $\mathcal { M }$ is permutation invariant in the sense of Definition 4.
86
+
87
+ 2. The aggregation function $\Phi ( f _ { c _ { 1 } } , f _ { c _ { 2 } } , \dots , { \bar { f } } _ { c _ { k } } )$ used to compute the feature vector of each node from the feature vectors of its children is invariant to the permutations of its arguments.
88
+
89
+ Then the overall representation $\phi ( \mathcal G )$ is invariant to permutations of the atoms. In particular, if $\mathcal { G }$ is a graph and the atoms are its vertices, then $\phi$ is a permutation invariant graph representation.
90
+
91
+ # 3.1 MESSAGE PASSING NEURAL NETWORKS AS A SPECIAL CASE OF COMP-NETS
92
+
93
+ Graph learning is not the only domain where invariance and multiscale structure are important: the most commonly cited reasons for the success of convolutional neural networks (CNNs) in image tasks is their ability to address exactly these two criteria in the vision context. Furthermore, each neuron ${ \mathfrak { n } } _ { i }$ in a CNN aggregates information from a small set of neurons from the previous layer, therefore its receptive field, corresponding to $\mathcal { P } _ { i }$ , is the union of the receptive fields of its “children”, so we have a hierarchical structure very similar to that described in the previous section. In this sense, CNNs are a specific kind of compositional network, where the atoms are pixels. This connection has inspired several authors to frame graph learning as a generalization of convolutional nets to the graph domain (Bruna et al., 2014; Henaff et al., 2015; Duvenaud et al., 2015; Defferrard et al., 2016; Kipf & Welling, 2017). While in mathematics convolution has a fairly specific meaning that is side-stepped by this analogy, the CNN analogy does suggest that a natural way to define the $\Phi$ aggregation functions is to let $\mathbf { \bar { \Phi } } ( f _ { c _ { 1 } } , f _ { c _ { 2 } } , \ldots , f _ { c _ { k } } )$ be a linear function of $f _ { c _ { 1 } } , f _ { c _ { 2 } } , \ldots , f _ { c _ { k } }$ followed by a pointwise nonlinearity, such as a ReLU operation.
94
+
95
+ To define a comp-net for graphs we also need to specify the composition scheme $\mathcal { M }$ . Many algorithms define $\mathcal { M }$ in layers, where each layer (except the last) has one node for each vertex of $G$ :
96
+
97
+ $\mathcal { M } 1$ . In layer $\ell = 0$ each node ${ \mathfrak { n } } _ { i } ^ { 0 }$ represents the single vertex $\mathcal { P } _ { i } ^ { 0 } = \{ i \}$ .
98
+
99
+ $\mathcal { M } 2$ . In layers $\ell = 1 , 2 , \ldots , L$ , node ${ \mathfrak { n } } _ { i } ^ { \ell }$ is connected to all nodes from the previous level that are neighbors of $i$ in $G$ , i.e., the children of ${ \mathfrak { n } } _ { i } ^ { \ell }$ are
100
+
101
+ $$
102
+ \mathrm { c h } ( \mathfrak { n } _ { i } ^ { \ell } ) = \\\\mathfrak { n } _ { j } ^ { \ell - 1 } \ | \ j \in \mathcal { N } ( i ) \} ,
103
+ $$
104
+
105
+ where $\mathcal { N } ( i )$ denotes the set of neighbors of $i$ in $G$ . Therefore, $\begin{array} { r } { \mathcal { P } _ { i } ^ { \ell } = \bigcup _ { j \in \mathcal { N } ( i ) } \mathcal { P } _ { j } ^ { \ell - 1 } } \end{array}$ .
106
+
107
+ $\mathcal { M } 3$ . In layer $L { + 1 }$ we have a single node ${ \mathfrak { n } } _ { r }$ that represents the entire graph and collects information from all nodes at level $L$ .
108
+
109
+ Since this construction only depends on topological information about $G$ , the resulting composition scheme is guaranteed to be permutation invariant in the sense of Definition 4.
110
+
111
+ A further important consequence of this way of defining $\mathcal { M }$ is that the resulting comp-net can be equivalently interpreted as label propagation algorithm, where in each round $\ell = 1 , 2 , \dots , L$ , each vertex aggregates information from its neighbors and then updates its own label.
112
+
113
+ <table><tr><td>Algorithm1 The label propagation algorithm corresponding to M1-M3</td></tr><tr><td>foreachvertex i</td></tr><tr><td>f←l</td></tr><tr><td>forl=1 to L</td></tr><tr><td>for each vertexi f←Φ(fe-1 fl-1) where N(i)={𝑖1,...,i}</td></tr></table>
114
+
115
+ Many authors choose to describe graph neural networks exclusively in terms of label propagation, without mentioning the compositional aspect of the model. Gilmer et al. (2017) call this general approach message passing neural networks, and point out that a range of different graph learning architectures are special cases of it. More broadly, the classic Weisfeiler–Lehman test of isomorphism also follows the same logic (Weisfeiler & Lehman, 1968; Read & Corneil, 1977; Cai et al., 1992), and so does the related Weisfeiler–Lehman kernel, arguably the most successful kernel-based approach to graph learning (Shervashidze et al., 2011). Note also that in label propagation or message passing algorithms there is a clear notion of the source domain of vertex $i$ at round $\ell$ , as the set of vertices that can influence $f _ { i } ^ { \ell }$ , and this corresponds exactly to the receptive field $\mathcal { P } _ { i } ^ { \ell }$ of “neuron” ${ \mathfrak { n } } _ { i } ^ { \ell }$ in the comp-net picture.
116
+
117
+ The following proposition is immediate from the form of Algorithm 1 and reassures us that message passing neural networks, as special cases of comp-nets, do indeed produce permutation invariant representations of graphs.
118
+
119
+ Proposition 2. Any label propagation scheme in which the aggregation function $\Phi$ is invariant to the permutations of its arguments is invariant to permutations in the sense of Definition $^ { l }$ .
120
+
121
+ In the next section we argue that invariant message passing networks are limited in their representation power, however, and describe a generalization via comp-nets that overcomes some of these limitations.
122
+
123
+ # 4 COVARIANT COMPOSITIONAL NETWORKS
124
+
125
+ One of the messages of the present paper is that invariant message passing algorithms, of the form described in the previous section, are not the most general possible compositional models for producing permutation invariant representations of graphs (or of compound objects, in general).
126
+
127
+ Once again, an analogy with image recognition is helpful. Classical CNNs face two types of basic image transformations: translations and rotations. With respect to translations (barring pooling, edge effects and other complications), CNNs behave in a quasi-invariant way, in the sense that if the input image is translated by any integer amount $( t _ { x } , t _ { y } )$ , the activations in each layer $\ell = 1 , 2 , \ldots L$ translate the same way: the activation of any neuron n\`i,j is simply transferred to neuron n\`i+t1,j+t2 , i.e., $f ^ { \prime } { } _ { i + t _ { 1 } , j + t _ { 2 } } ^ { \ell } { = } f _ { i , j } ^ { \ell }$ . This is the simplest manifestation of a well studied property of CNNs called equivariance (Cohen & Welling, 2016; Worrall et al., 2017).
128
+
129
+ With respect to rotations, however, the situation is more complicated: if we rotate the input image by, e.g., 90 degrees, not only will the part of the image that fell in the receptive field of a particular neuron $\mathfrak { n } _ { i , j } ^ { \ell }$ move to the receptive field of a different neuron $\mathfrak { n } _ { j , - i } ^ { \ell }$ , but the orientation of the receptive field will also change (Figure 4). Consequently, features which were, for example, prevup by horizontal filters will now be picked up by vertical filters. Therefore, in general, $f ^ { \prime } { } _ { j , - i } ^ { \ell } \neq f _ { i , j } ^ { \ell }$ d. It can be shown that one cannot construct a CNN for images that behaves in a quasi-invariant way with respect to both translations and rotations unless every filter is directionless.
130
+
131
+ It is, however, possible to construct a CNN in which the activations transform in a predictable and reversible way, in particular, $f _ { \ j , - i } ^ { \prime \ell } = R ( f _ { i , j } ^ { \ell } )$ for some fixed invertible function $R$ . This phenomenon is called steerability, and has a significant literature in both classical signal processing (Freeman & Adelson, 1991; Simoncelli et al., 1992; Perona, 1995; Teo & Hel-Or, 1998; Manduchi et al., 1998) and the neural networks field (Cohen & Welling, 2017).
132
+
133
+ ![](images/9f571f8517fddf7beece745085bf7d286713d9e1f1954fcc58dfb54fe8ad2ba8.jpg)
134
+ Figure 4: In convolutional neural networks if thewhat used to fall in the receptive field of neuron t image is translated by some amois moved to the receptive field of $( t _ { 1 } , t _ { 2 } )$ i,j Therefore, the activations transform in the very simple way tions not only move the receptive fields around, but also perm $f _ { i + t _ { 1 } , j + t _ { 2 } } ^ { \prime \ell } = f _ { i , j } ^ { \ell }$ i+t1,j+t2 . In contrast, rota- the receptive field internally, therefore, in general, horizontal filter (blue) and a vert $f _ { j , - i } ^ { \prime \ell } \neq f _ { i , j } ^ { \ell }$ . The right hand figure shows that if the CNN has ad) then their activations are exchanged by a 90 degree rotation. In steerable CNNs, if $( i , j ) \mapsto ( i ^ { \prime } , j ^ { \prime } )$ , then $f _ { \ i ^ { \prime } , j ^ { \prime } } ^ { \prime \ell } = R ( f _ { i , j } ^ { \ell } )$ for some fixed linear function
135
+
136
+ The situation in compositional networks is similar. The comp-net and message passing architectures that we have examined so far, by virtue of the aggregation function being symmetric in its arguments, are all quasi-invariant (with respect to permutations) in the following sense.
137
+
138
+ Definition 5. Let $\mathcal { G }$ be a compound object of $n$ parts and $\mathcal { G } ^ { \prime }$ an equivalent object in which the atoms have been permuted by some permutation $\sigma$ . Let $\mathcal { N }$ be a comp-net for $\mathcal { G }$ based on an invariant composition scheme, and $\mathcal { N } ^ { \prime }$ be the corresponding network for $\mathcal { G } ^ { \prime }$ . We say that $\mathcal { N }$ is quasi-invariant if for any $\mathfrak { n } _ { i } \in \mathcal { N }$ , letting ${ \mathfrak { n } } _ { j } ^ { \prime }$ be the corresponding node in $\mathcal { N } ^ { \prime }$ , $f _ { i } = f _ { j } ^ { \prime }$ for any $\sigma \in \mathbb { S } _ { n }$
139
+
140
+ Quasi-invariance in comp-nets is equivalent to the assertion that the activation $f _ { i }$ at any given node must only depend on $\mathcal { P } _ { i } = \{ e _ { j _ { 1 } } , . . . , e _ { j _ { k } } \}$ as a set, and not on the internal ordering of the atoms $e _ { j _ { 1 } } , \dotsc , e _ { j _ { k } }$ making up the receptive field. At first sight this seems desirable, since it is exactly what we expect from the overall representation $\phi ( G )$ . On closer examination, however, we realize that this property is potentially problematic, since it means that ${ \mathfrak { n } } _ { i }$ has lost all information about which vertex in its receptive field has contributed what to the aggregate information $f _ { i }$ . In the CNN analogy, we can say that we have lost information about the orientation of the receptive field. In particular, if, further upstream, $f _ { i }$ is combined with some other feature vector $f _ { j }$ from a node with an overlapping receptive field, the aggregation process has no way of taking into account which parts of the information in $f _ { i }$ and $f _ { j }$ come from shared vertices and which parts do not (Figure 5).
141
+
142
+ The solution is to upgrade the $\mathcal { P } _ { i }$ receptive fields to be ordered sets, and explicitly establish how $f _ { i }$ co-varies with the internal ordering of the receptive fields. To emphasize that henceforth the $\mathcal { P } _ { i }$ sets are ordered, we will use parentheses rather than braces to denote their content.
143
+
144
+ Definition 6. Let $\mathcal { G } , \mathcal { G } ^ { \prime }$ , $\mathcal { N }$ and $\mathcal { N } ^ { \prime }$ be as in Definition 5. Let ${ \mathfrak { n } } _ { i }$ be any node of $\mathcal { N }$ and ${ \mathfrak { n } } _ { j }$ the corresponding node of $\mathcal { N } ^ { \prime }$ . Assume that $\mathcal { P } _ { i } = ( e _ { p _ { 1 } } , . . . , e _ { p _ { m } } )$ while $\mathcal { P } _ { j } ^ { \prime } = ( e _ { q _ { 1 } } , \dots , e _ { q _ { m } } )$ , and let $\pi \in \mathbb { S } _ { m }$ be the permutation that aligns the orderings of the two receptive fields, i.e., for which $e _ { q _ { \pi ( a ) } } = e _ { p _ { a } }$ . We say that $\mathcal { N }$ is covariant to permutations if for any $\pi$ , there is a corresponding function $R _ { \pi }$ such that $f _ { j } ^ { \prime } = R _ { \pi } ( f _ { i } )$ .
145
+
146
+ # 4.1 FIRST ORDER COVARIANT COMP-NETS
147
+
148
+ The form of covariance prescribed by Definition 6 is very general. To make it more specific, in line with the classical literature on steerable representations, we make the assumption that the $\{ f \mapsto R _ { \pi } ( f ) \} _ { \pi \in \mathbb { S } _ { m } }$ maps are linear, and by abuse of notation, from now on simply treat them as matrices (with $\stackrel { \triangledown } { R _ { \pi } } ( f ) \stackrel { - } { = } R _ { \pi } f ;$ ). The linearity assumption automatically implies that $\{ R _ { \pi } \} _ { \pi \in \mathbb { S } _ { m } }$ is a representation of $\mathbb { S } _ { m }$ in the group theoretic sense of the word (for the definition of group representations, see the Appendix)4.
149
+
150
+ Proposition 3. If for any $\pi \in \mathbb { S } _ { m } ,$ , the $f \mapsto R _ { \pi } ( f )$ map appearing in Definition $6$ is linear, then the corresponding $\{ R _ { \pi } \} _ { \pi \in \mathbb { S } _ { m } }$ matrices form a representation of $\mathbb { S } _ { m }$ .
151
+
152
+ ![](images/43063f92f2da83a2f4849e94038eb4a3b1dcf539320d5b4ea45ff4dd16bd3e03.jpg)
153
+ Figure 5: Top left: At level $\ell = 1 \ \mathfrak { n } _ { 3 }$ aggregates information from $\{ \mathfrak { n } _ { 4 } , \mathfrak { n } _ { 5 } \}$ and ${ \mathfrak { n } } _ { 2 }$ aggregates information $\{ \mathfrak { n } _ { 5 } , \mathfrak { n } _ { 6 } \}$ . At $\ell = 2$ , ${ \mathfrak { n } } _ { 1 }$ collects this summary information from ${ \mathfrak { n } } _ { 3 }$ and ${ \mathfrak { n } } _ { 2 }$ . Bottom left: This graph is not isomorphic to the top one, but the activations of $\mathfrak { n } _ { 3 }$ and ${ \mathfrak { n } } _ { 2 }$ at $\ell = 1$ will be identical. Therefore, at $\ell = 2$ , ${ \mathfrak { n } } _ { 1 }$ will get the same inputs from its neighbors, irrespective of whether or not ${ \mathfrak { n } } _ { 5 }$ and ${ \mathfrak { n } } _ { 7 }$ are the same node or not. Right: Aggregation at different levels. For keeping the figure legible only the neighborhood around one node in higher levels is marked.
154
+
155
+ The representation theory of symmetric groups is a rich subject that goes beyond the scope of the present paper (Sagan, 2001). However, there is one particular representation of $\mathbb { S } _ { m }$ that is likely familiar even to non-algebraists, the so-called defining representation, given by the $P _ { \pi } \in \mathbb { R } ^ { n \times \bar { n } }$ permutation matrices
156
+
157
+ $$
158
+ [ P _ { \pi } ] _ { i , j } = { \left\{ \begin{array} { l l } { 1 } & { { \mathrm { i f } } \ \pi ( j ) = i } \\ { 0 } & { { \mathrm { o t h e r w i s e . } } } \end{array} \right. }
159
+ $$
160
+
161
+ It is easy to verify that $P _ { \pi _ { 2 } \pi _ { 1 } } = P _ { \pi _ { 2 } } P _ { \pi _ { 1 } }$ for any $\pi _ { 1 } , \pi _ { 2 } \in \mathbb { S } _ { m }$ , so $\{ P _ { \pi } \} _ { \pi \in \mathbb { S } _ { m } }$ is indeed a representation of $\mathbb { S } _ { m }$ . If the transformation rules of the $f _ { i }$ activations in a given comp-net are dictated by this representation, then each $f _ { i }$ must necessarily be a $| \mathcal { P } _ { i } |$ dimensional vector, and intuitively each component of $f _ { i }$ carries information related to one specific atom in the receptive field, or the interaction of that specific atom with all the others. We call this case first order permutation covariance.
162
+
163
+ Definition 7. We say that ${ \mathfrak { n } } _ { i }$ is a first order covariant node in a comp-net if under the permutation of its receptive field $\mathcal { P } _ { i }$ by any $\pi \in \mathbb { S } _ { | P _ { i } | }$ , its activation trasforms as $f _ { i } \mapsto P _ { \pi } f _ { i }$ .
164
+
165
+ # 4.2 SECOND ORDER COVARIANT COMP-NETS
166
+
167
+ It is easy to verify that given any representation $( R _ { g } ) _ { g \in \mathfrak { G } }$ of a group $\mathfrak { G }$ , the matrices $( R _ { g } \otimes R _ { g } ) _ { g \in \mathfrak { G } }$ also furnish a representation of $\mathfrak { G }$ . Thus, one step up in the hierarchy from $P _ { \pi }$ –covariant comp-nets are $P _ { \pi } \otimes P _ { \pi }$ –covariant comp-nets, where the $f _ { i }$ feature vectors are now $\left| \mathcal { P } _ { i } \right| ^ { 2 }$ dimensional vectors that transform under permutations of the internal ordering by $\pi$ as $f _ { i } \mapsto ( { \stackrel { . } { P } } _ { \pi } \otimes P _ { \pi } ) f _ { i }$ .
168
+
169
+ If we reshape $f _ { i }$ into a matrix $F _ { i } \in \mathbb { R } ^ { | \mathcal { P } _ { i } | \times | \mathcal { P } _ { i } | }$ , then the action
170
+
171
+ $$
172
+ F _ { i } \mapsto P _ { \pi } F _ { i } P _ { \pi } ^ { \top }
173
+ $$
174
+
175
+ is equivalent to $P _ { \pi } \otimes P _ { \pi }$ acting on $f _ { i }$ . In the following, we will prefer this more intuitive matrix view, since it clearly expresses that feature vectors that transform this way express relationships between the different constituents of the receptive field. Note, in particular, that if we define $A \downarrow _ { \mathcal { P } _ { i } }$ as the restriction of the adjacency matrix to $\mathcal { P } _ { i }$ (i.e., if $\mathcal { P } _ { i } = ( e _ { p _ { 1 } } , \ldots , e _ { p _ { m } } )$ then $[ A \downarrow _ { \mathcal { P } _ { i } } ] _ { a , b } = A _ { p _ { a } , p _ { b } } )$ , then $A \downarrow _ { \mathcal { P } _ { i } }$ transforms exactly as $F _ { i }$ does in the equation above.
176
+
177
+ Definition 8. We say that ${ \mathfrak { n } } _ { i }$ is a second order covariant node in a comp-net if under the permutation of its receptive field $\mathcal { P } _ { i }$ by any $\pi \in \mathbb { S } _ { | \mathcal { P } _ { i } | }$ , its activation transforms as $\bar { F _ { i } } \mapsto \bar { P _ { \pi } } F _ { i } P _ { \pi } ^ { \top }$ .
178
+
179
+ # 4.3 THIRD AND HIGHER ORDER COVARIANT COMP-NETS
180
+
181
+ Taking the pattern further lets us consider third, fourth, and general, $k$ ’th order nodes in our compnet, in which the activations are $k$ ’th order tensors, transforming under permutations as
182
+
183
+ $$
184
+ F _ { i } \mapsto F _ { i } ^ { \prime } \qquad \mathrm { w h e r e } \qquad [ F _ { i } ^ { \prime } ] _ { j _ { 1 } , \dots , j _ { k } } = \sum _ { j _ { 1 } ^ { \prime } } \sum _ { j _ { 2 } ^ { \prime } } \dots \sum _ { j _ { k } ^ { \prime } } [ P _ { \pi } ] _ { j _ { 1 } , j _ { 1 } ^ { \prime } } [ P _ { \pi } ] _ { j _ { 2 } , j _ { 2 } ^ { \prime } } \dots [ P _ { \pi } ] _ { j _ { k } , j _ { k } ^ { \prime } } [ F _ { i } ] _ { j _ { 1 } ^ { \prime } , \dots , j _ { k } ^ { \prime } } ,
185
+ $$
186
+
187
+ In the more compact, so called Einstein notation5,
188
+
189
+ $$
190
+ [ F _ { i } ^ { \prime } ] _ { j _ { 1 } , \dots , j _ { k } } = [ P _ { \pi } ] _ { j _ { 1 } } { } ^ { j _ { 1 } ^ { \prime } } [ P _ { \pi } ] _ { j _ { 2 } } { } ^ { j _ { 2 } ^ { \prime } } \dots [ P _ { \pi } ] _ { j _ { k } } { } ^ { j _ { k } ^ { \prime } } [ F _ { i } ] _ { j _ { 1 } ^ { \prime } , \dots , j _ { k } ^ { \prime } } .
191
+ $$
192
+
193
+ In general, we will call any quantity which transforms according to this equation a $\mathbf { k }$ ’th order Ptensor. Note that this notion of tensors is distinct from the common usage of the term in neural networks, and more similar to how the word is used in Physics, because it not only implies that $F _ { i }$ is a quanity representable by an $m \times m \times \ldots \times m$ array of numbers, but also that $F _ { i }$ transforms in a specific way.
194
+
195
+ Since scalars, vectors and matrices can be considered as $0 ^ { \mathrm { t h } }$ , $1 ^ { \mathrm { s t } }$ and $2 ^ { \mathrm { n d } }$ order tensors, respectively, the following definition covers Definitions 5, 7 and 8 as special cases (with quasi-invariance being equivalent to zeroth order equivariance). To unify notation and terminology, regardless of the dimensionality, in the following we will always talk about feature tensors rather than feature vectors, and denote the activations with $F _ { i }$ rather than $f _ { i }$ , as we did in the first half of the paper.
196
+
197
+ Definition 9. We say that ${ \mathfrak { n } } _ { i }$ is a k’th order covariant node in a comp-net if the corresponding activation $F _ { i }$ is a $k$ ’th order $P$ –tensor, i.e., it transforms under permutations of $\mathcal { P } _ { i }$ according to $( I )$ , or the activation is a sequence of c separate $P$ –tensors $F _ { i } ^ { ( 1 ) } , \ldots , F _ { i } ^ { ( c ) }$ corresponding to c distinct channels.
198
+
199
+ # 5 TENSOR AGGREGATION RULES
200
+
201
+ The previous sections prescribed how activations must transform in comp-nets of different orders, but did not explain how this can be assured, and what it entails for the $\Phi$ aggregation functions. Fortunately, tensor arithmetic provides a compact framework for deriving the general form of these operations. Recall the four basic operations that can be applied to tensors6:
202
+
203
+ 1. The tensor product of $A \in { \mathcal { T } } ^ { k }$ with $B \in \tau ^ { p }$ yields a tensor $C = A \otimes B \in { \mathcal { T } } ^ { p + k }$ where
204
+
205
+ $$
206
+ C _ { i _ { 1 } , i _ { 2 } , . . . , i _ { k + p } } = A _ { i _ { 1 } , i _ { 2 } , . . . , i _ { k } } B _ { i _ { k + 1 } , i _ { k + 2 } , . . . , i _ { k + p } } .
207
+ $$
208
+
209
+ 2. The elementwise product of $A \in { \mathcal { T } } ^ { k }$ with $B \in \tau ^ { p }$ along dimensions $( a _ { 1 } , a _ { 2 } , \ldots , a _ { p } )$ yields a tensor $C = A \odot _ { ( a _ { 1 } , \ldots , a _ { p } ) } B \in \mathcal { T } ^ { k }$ where
210
+
211
+ $$
212
+ C _ { i _ { 1 } , i _ { 2 } , . . . , i _ { k } } = A _ { i _ { 1 } , i _ { 2 } , . . . , i _ { k } } B _ { i _ { a _ { 1 } } , i _ { a _ { 2 } } , . . . , i _ { a _ { p } } } .
213
+ $$
214
+
215
+ 3. The projection (summation) of $A \in \tau ^ { k }$ along dimensions $\{ a _ { 1 } , a _ { 2 } , \ldots , a _ { p } \}$ yields a tensor $C = A \ J _ { \psi _ { a _ { 1 } , \ldots , a _ { p } } } \in \mathcal { T } ^ { k - p }$ with
216
+
217
+ $$
218
+ C _ { i _ { 1 } , i _ { 2 } , \ldots , i _ { k } } = \sum _ { i _ { a _ { 1 } } } \sum _ { i _ { a _ { 2 } } } \ldots \sum _ { i _ { a _ { p } } } A _ { i _ { 1 } , i _ { 2 } , \ldots , i _ { k } } ,
219
+ $$
220
+
221
+ where we assume that $i _ { a _ { 1 } } , \ldots , i _ { a _ { p } }$ have been removed from amongst the indices of $C$
222
+
223
+ 4. The contraction of $A \in { \mathcal { T } } ^ { k }$ along the pair of dimensions $\{ a , b \}$ (assuming $a < b$ ) yields a $k - 2$ order tensor
224
+
225
+ $$
226
+ C _ { i _ { 1 } , i _ { 2 } , \dots , i _ { k } } = \sum _ { j } A _ { i _ { 1 } , \dots , i _ { a - 1 } , j , i _ { a + i } , \dots , i _ { b - 1 } , j , i _ { b + 1 } , \dots , k } ,
227
+ $$
228
+
229
+ where again we assume that $i _ { a }$ and $i _ { b }$ have been removed from amongst the indices of $C$ . Using Einstein notation this can be written much more compactly as
230
+
231
+ $$
232
+ C _ { i _ { 1 } , i _ { 2 } , . . . , i _ { k } } = A _ { i _ { 1 } , i _ { 2 } , . . . , i _ { k } } \delta ^ { i _ { a } , i _ { b } } ,
233
+ $$
234
+
235
+ where $\delta ^ { i _ { a } , i _ { b } }$ is the diagonal tensor with $\delta ^ { i , j } = 1$ if $i = j$ and 0 otherwise. In a somewhat unorthodox fashion, we also generalize contractions to (combinations of) larger sets of indices $\{ \{ a _ { 1 } ^ { 1 } , \dotsc , a _ { p _ { 1 } } ^ { 1 } \} , \{ a _ { 1 } ^ { 2 } , \dotsc , a _ { p _ { 2 } } ^ { 2 } \} , \dotsc , \{ a _ { 1 } ^ { q } , \dotsc , a _ { p _ { q } } ^ { q } \} \}$ as the $( k - \textstyle \sum _ { j } p _ { j } )$ order tensor
236
+
237
+ $$
238
+ C _ { \ldots } = A _ { i _ { 1 } , i _ { 2 } , \ldots , i _ { k } } \delta ^ { a _ { 1 } ^ { 1 } , \ldots , a _ { p _ { 1 } } ^ { 1 } } \delta ^ { a _ { 1 } ^ { 2 } , \ldots , a _ { p _ { 2 } } ^ { 2 } } \ldots \delta ^ { a _ { 1 } ^ { q } , \ldots , a _ { p _ { q } } ^ { q } } .
239
+ $$
240
+
241
+ Note that this subsumes projections, since it allows us to write $A \downarrow _ { { a _ { 1 } } , \ldots , { a _ { p } } }$ in the slightly unusual looking form
242
+
243
+ $$
244
+ A \downarrow _ { a _ { 1 } , \dots , a _ { p } } = A _ { i _ { 1 } , i _ { 2 } , \dots , i _ { k } } \delta ^ { i _ { a _ { 1 } } } \delta ^ { i _ { a _ { 2 } } } \dots \delta ^ { i _ { a _ { k } } } .
245
+ $$
246
+
247
+ The following proposition shows that, remarkably, all of the above operations (as well as taking linear conbinations) preserve the way that $P -$ –tensors behave under permutations and thus they can be freely “mixed and matched” within $\Phi$ .
248
+
249
+ Proposition 4. Assume that $A$ and $B$ are $k$ ’th and $p$ ’th order $P$ –tensors, respectively. Then
250
+
251
+ 1. $A \otimes B$ is a $k + p$ ’th order $P$ –tensor.
252
+ 2. $A \odot _ { ( a _ { 1 } , \ldots , a _ { p } ) } B$ k’th orde $P -$ –tensor.
253
+ 3. A↓a1,...,ap $k - p$ $P$
254
+ 4. $A _ { i _ { 1 } , i _ { 2 } , \dots , i _ { k } } \delta ^ { a _ { 1 } ^ { 1 } , \dots , a _ { p _ { 1 } } ^ { 1 } } \dots \delta ^ { a _ { 1 } ^ { q } , \dots , a _ { p _ { q } } ^ { q } }$ is a $k - \textstyle \sum _ { j } p _ { j }$ ’th order $P -$ –tensor.
255
+
256
+ In addition, if $A _ { 1 } , \ldots , A _ { u }$ are $k$ ’th order $P$ –tensors and $\alpha _ { 1 } , \ldots , \alpha _ { u }$ are scalars, then $\textstyle \sum _ { j } { \alpha _ { j } A _ { j } }$ is a $k$ ’th order $P$ –tensor.
257
+
258
+ The more challenging part of constructing the aggregation scheme for comp-nets is establishing how to relate $P -$ –tensors at different nodes. The following two propositions answer this question.
259
+
260
+ Proposition 5. Assume that node ${ \mathfrak { n } } _ { a }$ is a descendant of node ${ \mathfrak { n } } _ { b }$ in a comp-net $\mathcal { N }$ , $\begin{array} { r l } { \mathcal { P } _ { a } } & { { } = } \end{array}$ $( e _ { p _ { 1 } } , \ldots , e _ { p _ { m } } )$ and $\mathcal { P } _ { b } = ( e _ { q _ { 1 } } , . . . , e _ { q _ { m ^ { \prime } } } )$ are the corresponding ordered receptive fields (note that this implies that, as sets, $\mathcal { P } _ { a } \subseteq \mathcal { P } _ { b } ,$ ), and $\chi ^ { a b } \in \mathbb { R } ^ { m \times m ^ { \prime } }$ is an indicator matrix defined
261
+
262
+ $$
263
+ \chi _ { i , j } ^ { a b } = \{ { \begin{array} { l l } { 1 } & { i f \ q _ { j } = p _ { i } } \\ { 0 } & { o t h e r w i s e . } \end{array} }
264
+ $$
265
+
266
+ Assume that $F$ is a $k$ ’th order $P$ –tensor with respect to permutations of $( e _ { p _ { 1 } } , \ldots , e _ { p _ { m } } )$ . Then, dropping the $a { } b$ superscript for clarity,
267
+
268
+ $$
269
+ \widetilde { F } _ { i _ { 1 } , \dots , i _ { k } } = \chi _ { i _ { 1 } } { } ^ { j _ { 1 } } \chi _ { i _ { 2 } } { } ^ { j _ { 2 } } \dots \chi _ { i _ { k } } { } ^ { j _ { k } } F _ { j _ { 1 } , \dots , j _ { k } }
270
+ $$
271
+
272
+ is a k’th order $P$ –tensor with respect to permutations of $( e _ { q _ { 1 } } , \dots , e _ { q _ { m ^ { \prime } } } )$
273
+
274
+ Equation 2 tells us that when node ${ \mathfrak { n } } _ { b }$ aggregates $P -$ –tensors from its children, it first has to “promote” them to being $P$ –tensors with respect to the contents of its own receptive field by contracting along each of their dimensions with the appropriate $\chi ^ { a b }$ matrix. This is a critical element in comp-nets to guarantee covariance.
275
+
276
+ Proposition 6. Let $\mathfrak { n } _ { c _ { 1 } } , \ldots , \mathfrak { n } _ { c _ { s } }$ be the children of ${ \mathfrak { n } } _ { t }$ in a message passing type comp-net with corresponding $k$ ’th order tensor activations $F _ { c _ { 1 } } , \ldots , F _ { c _ { s } }$ . Let
277
+
278
+ $$
279
+ [ \widetilde { F } _ { c _ { u } } ] _ { i _ { 1 } , \dots , i _ { k } } = [ \chi ^ { c _ { u } t } ] _ { i _ { 1 } } ^ { ~ j _ { 1 } } [ \chi ^ { c _ { u } t } ] _ { i _ { 2 } } ^ { ~ j _ { 2 } } \dots [ \chi ^ { c _ { u } t } ] _ { i _ { k } } ^ { ~ j _ { k } } [ F _ { c _ { u } } ] _ { j _ { 1 } , \dots , j _ { k } }
280
+ $$
281
+
282
+ be the promotions of these activations to $P -$ –tensors of ${ \mathfrak { n } } _ { t : }$ Assume that $\mathcal { P } _ { t } = ( e _ { p _ { 1 } } , \ldots , e _ { p _ { m } } )$ . Now let $\overline { F }$ be a $k + 1$ ’th order object in which the $j$ ’th slice is $F _ { p _ { j } } \ i f \mathfrak { n } _ { p _ { j } }$ is one of the children of ${ \mathfrak { n } } _ { t }$ , i.e.,
283
+
284
+ $$
285
+ \overline { { F } } _ { i _ { 1 } , \dots , i _ { k } , j } = [ \widetilde { F } _ { p _ { j } } ] _ { i _ { 1 } , \dots , i _ { k } } ,
286
+ $$
287
+
288
+ and zero otherwise. Then $\overline { F }$ is a $k + 1$ ’th order $P -$ –tensor of ${ \mathfrak { n } } _ { t }$
289
+
290
+ Finally, as already mentioned, the restriction of the adjacency matrix to $\mathcal { P } _ { i }$ is a second order $P -$ tensor, which gives an easy way of explicitly adding topological information to the activation.
291
+
292
+ Proposition 7. If $F _ { i }$ is a $k$ ’th order $P$ –tensor at node ${ \mathfrak { n } } _ { i }$ , and $A \downarrow _ { \mathcal { P } _ { i } }$ is the restriction of the adjacency matrix to $\mathcal { P } _ { i }$ as defined in Section 4.2, then $F \otimes A \downarrow _ { \mathcal { P } _ { i } }$ is a $k + 2$ ’th order $P$ –tensor.
293
+
294
+ Combining all the above results, assuming that node ${ \mathfrak { n } } _ { t }$ has children $\mathfrak { n } _ { c _ { 1 } } , \ldots , \mathfrak { n } _ { c _ { s } }$ , we arrive at the following general algorithm for the aggregation rule $\Phi _ { t }$ :
295
+
296
+ 1. Collect all the $k$ ’th order activations $F _ { c _ { 1 } } , \ldots , F _ { c _ { s } }$ of the children.
297
+ 2. Promote each activation to $\widetilde { F } _ { c _ { 1 } } , \ldots , \widetilde { F } _ { c _ { s } }$ (Proposition 5).
298
+ 3. Stack $\widetilde { F } _ { c _ { 1 } } , \ldots , \widetilde { F } _ { c _ { s } }$ together into a $k + 1$ order tensor $T$ (Proposition 6).
299
+ 4. Optionally form the tensor product of $T$ with $A \downarrow _ { \mathcal { P } _ { t } }$ to get a $k { + 3 }$ order tensor $H$ (otherwise just set $H = T$ ) (Proposition 7).
300
+ 5. Contract $H$ along some number of combinations of dimensions to get $s$ separate lower order tensors $Q _ { 1 } , \ldots , Q _ { s }$ (Proposition 4).
301
+ 6. Mix $Q _ { 1 } , \ldots , Q _ { s }$ with a matrix $W \in \mathbb { R } ^ { s ^ { \prime } \times s }$ and apply a nonlinearity $\Upsilon$ to get the final activation of the neuron, which consists of the $s ^ { \prime }$ output tensors
302
+
303
+ $$
304
+ F ^ { ( i ) } = \Upsilon \bigg [ \sum _ { j = 1 } ^ { s } W _ { i , j } Q _ { j } + b _ { i } \mathbb { 1 } \bigg ] \quad \qquad i = 1 , 2 , \ldots s ^ { \prime } ,
305
+ $$
306
+
307
+ where the $b _ { i }$ scalars are bias terms, and $\mathbb { 1 }$ is the $\left| \mathcal { P } _ { t } \right| \times \ldots \times \left| \mathcal { P } _ { t } \right|$ dimensional all ones tensor.
308
+
309
+ A few remarks are in order about this general scheme:
310
+
311
+ 1. Since $\widetilde { F } _ { c _ { 1 } } , \ldots , \widetilde { F } _ { c _ { s } }$ are stacked into a larger tensor and then possibly also multiplied by $A \downarrow _ { \mathcal { P } _ { t } }$ , the general tendency would be for the tensor order to increase at every node, and the corresponding storage requirements to increase exponentially. The purpose of the contractions in Step 5 is to counteract this tendency, and pull the order of the tensors back to some small number, typically 1, 2 or 3.
312
+ 2. However, since contractions can be done in many different ways, the number of channels will increase. When the number of input channels is small, this is reasonable, since otherwise the number of learnable weights in the algorithm would be too small. However, if unchecked, this can also become problematic. Fortunately, mixing the channels by $W$ on Step 6 gives an opportunity to stabilize the number of channels at some value $s ^ { \prime }$ .
313
+ 3. In the pseudocode above, for simplicity, the number of input channels is one and the number of output channels is $s ^ { \prime }$ . More realistically, the inputs would also have multiple channels (say, $s _ { 0 . }$ ) which would be propagated through the algorithm independently up to the mixing stage, making $W$ an $s ^ { \prime } \times s \times s _ { 0 }$ dimension tensor (not in the $P -$ –tensor sense!).
314
+ 4. The conventional part of the entire algorithm is Step 6, and the only learnable parameters are the entries of the $W$ matrix (tensor) and the $b _ { i }$ bias terms. These parameters are shared by all nodes in the network and learned in the usual way, by stochastic gradient descent.
315
+ 5. Our scheme could be elaborated further while maintaining permutation covariance by, for example taking the tensor product of $T$ with itself, or by introducing $A \downarrow _ { \mathcal { P } _ { t } }$ in a different way. However, the way that $\widetilde { F } _ { c _ { 1 } } , \ldots , \widetilde { F } _ { c _ { s } }$ and $A \downarrow _ { \mathcal { P } _ { t } }$ are combined by tensor products is already much more general and expressive than conventional message passing networks.
316
+ 6. Our framework admits many design choices, including the choice of the order odf the activations, the choice of contractions, and $c ^ { \prime }$ . However, the overall structure of Steps 1–5 is fully dictated by the covariance constraint on the network.
317
+ 7. The final output of the network $\phi ( G ) = F _ { r }$ must be permutation invariant. That means that the root node ${ \mathfrak { n } } _ { r }$ must produce a tuple of zeroth order tensors (scalars) $( F _ { r } ^ { ( 1 ) } , \dots , F _ { r } ^ { ( c ) } )$ . This is similar to how many other graph representation algorithms compute $\phi ( G )$ by summing the activations at level $L$ or creating histogram features.
318
+
319
+ We consider a few special cases to explain how tensor aggregation relates to more conventional message passing rules.
320
+
321
+ # 5.1.1 ZEROTH ORDER TENSOR AGGREGATION
322
+
323
+ Constraining both the input tensors $F _ { c _ { 1 } } , \ldots , F _ { c _ { s } }$ and the outputs to be zeroth order tensors, i.e., no need for promotions, and scalars, and foregoing multiplication by $T$ Ptis just the vector $A \downarrow _ { \mathcal { P } _ { t } }$ greatly simplifies the form of $( F _ { c _ { 1 } } ^ { \ell } , \ldots , F _ { c _ { s } } ^ { \ell } )$ . There is only one way to contract $\Phi$ . In this case there is a vector into a scalar, and that is to sum its elements. Therefore, in this case, the entire aggregation algorithm reduces to the simple formula
324
+
325
+ $$
326
+ F _ { i } = \Upsilon \Big ( w \sum _ { u = 1 } ^ { c } F _ { c _ { u } } + b \Big ) .
327
+ $$
328
+
329
+ For a neural network this is too simplistic. However, it’s interesting to note that the Weisfeiler– Lehmann isomorphism test essentially builds on just this formula, with a specific choice of $\Upsilon$ (Read & Corneil, 1977). If we allow more channels in the inputs and the outputs, $W$ becomes a matrix, and we recover the simplest form of neural message passing algorithms (Duvenaud et al., 2015).
330
+
331
+ # 5.1.2 FIRST ORDER TENSOR AGGREGATION
332
+
333
+ In first order tensor aggregation, assuming that $| { \mathcal { P } } _ { i } | = m$ , $\widetilde { F } _ { c _ { 1 } \ldots } , \ldots , \widetilde { F } _ { c _ { s } }$ are $m$ dimensional column vectors, and $T$ is an $m \times m$ matrix consisting of $F _ { c _ { 1 } } , \ldots , F _ { c _ { s } }$ stacked columnwise. There are two ways of contracting (in our generalized sense) a matrix into a vector: by summing over its rows, or summing over its columns. The second of these choices leads us back to summing over all contributions from the children, while the first is more interesting because it corresponds to summing $\widetilde { F } _ { c _ { 1 } } , \ldots , \widetilde { F } _ { c _ { s } }$ as vectors individually. In summary, we get an aggregation function that transforms a single input channel to two output channels of the form
334
+
335
+ $$
336
+ F _ { i } ^ { ( 1 ) } = \Upsilon \Big [ w _ { 1 , 1 } ( T ^ { \top } \mathbf { 1 } ) + w _ { 1 , 2 } ( T \mathbf { 1 } ) + b _ { 1 } \mathbf { 1 } \Big ] , \qquad F _ { i } ^ { ( 2 ) } = \Upsilon \Big [ w _ { 2 , 1 } ( T ^ { \top } \mathbf { 1 } ) + w _ { 2 , 2 } ( T \mathbf { 1 } ) + b _ { 2 } \mathbf { 1 } \Big ] ,
337
+ $$
338
+
339
+ where 1 denotes the $m$ dimensional all ones vector. Thus, in this layer $W \in \mathbb { R } ^ { 2 \times 2 }$ . Unless constrained by $c ^ { \prime }$ , in each subsequent layer the number of channels doubles further and these channels can all mix with each other, so $W ^ { ( 2 ) } { \in } \mathbb { R } ^ { 4 \times 4 }$ , $W ^ { ( 3 ) } \in \mathbb { R } ^ { 8 \times 8 }$ , and so on.
340
+
341
+ # 5.1.3 SECOND ORDER TENSOR AGGREGATION WITHOUT THE ADJACENCY MATRIX
342
+
343
+ In second order tensor aggregation, $T$ is a third order $P$ –tensor, which can be contracted back to second order in three different ways, by projecting it along each of its dimensions. Therefore the outputs will be the three matrices
344
+
345
+ $$
346
+ F ^ { ( i ) } = \Upsilon \big ( w _ { i , 1 } T \downarrow _ { 1 } + w _ { i , 2 } T \downarrow _ { 2 } + w _ { i , 3 } T \downarrow _ { 3 } + b _ { i } { \bf 1 } _ { m \times m } \big ) \qquad i \in \{ 1 , 2 , 3 \} ,
347
+ $$
348
+
349
+ and the weight matrix is $W \in \mathbb { R } ^ { 3 \times 3 }$ .
350
+
351
+ # 5.1.4 SECOND ORDER TENSOR AGGREGATION WITH THE ADJACENCY MATRIX
352
+
353
+ The first nontrivial tensor contraction case occurs when $\widetilde { F } _ { c _ { 1 } } , \ldots , \widetilde { F } _ { c _ { s } }$ are second order tensors, and we multiply with $A \downarrow _ { \mathcal { P } _ { t } }$ , since in that case $T$ is 5th order, and can be contracted down to second order in a total of 50 different ways:
354
+
355
+ 1. The “ $1 + 1 + 1 ^ { , }$ case contracts $T$ in the form $T _ { i _ { 1 } , i _ { 2 } , i _ { 3 } , i _ { 4 } , i _ { 5 } } \delta ^ { i _ { a _ { 1 } } } \delta ^ { i _ { a _ { 2 } } } \delta ^ { i _ { a _ { 3 } } }$ , i.e., it projects $T$ down along 3 of its 5 dimensions. This alone can be done in ${ \binom { 5 } { 3 } } = 1 0 .$ different ways7 2. The $^ { 6 6 } 1 { + } 2 ^ { 5 }$ case contracts $T$ in the form $T _ { i _ { 1 } , i _ { 2 } , i _ { 3 } , i _ { 4 } , i _ { 5 } } \delta ^ { i _ { a _ { 1 } } } \delta ^ { i _ { a _ { 2 } } , i _ { a _ { 3 } } }$ , i.e., it projects $T$ along one dimension, and contracts it along two others. This can be done in $3 { \binom { 5 } { 3 } } = 3 0$ ways. 3. The $\mathbf { \bar { \Psi } } ^ { 6 6 } 3 ^ { \mathfrak { s } }$ case is a single 3-fold contraction $T _ { i _ { 1 } , i _ { 2 } , i _ { 3 } , i _ { 4 } , i _ { 5 } } \delta ^ { i _ { a _ { 1 } } , i _ { a _ { 2 } } , i _ { a _ { 3 } } }$ , which again can be done in ${ \binom { 5 } { 3 } } = 1 0$ different ways.
356
+
357
+ The tensor $\mathcal { T } _ { i _ { 1 } , i _ { 2 } , i _ { 3 } , i _ { 4 } , i _ { 5 } }$ will be symmetric with respect to two sets of indices, following the structure of the promotion tensors and the adjacency matrix. Including these symmetries, the number of contractions is 18 including: five $^ { \ 6 } 1 + 1 + 1 \ '$ , ten $^ { } 1 { + } 2 ^ { \circ }$ , and three $\mathbf { \bar { \Psi } } ^ { 6 6 } 3 ^ { \mathfrak { s } }$ .
358
+
359
+ ![](images/69128a399e98e7c84471301683172e6a6a2ef3306b9b8a14871cecf443ca354f.jpg)
360
+ Figure 6: The activations of vertices in the receptive field $\mathcal { P } _ { \ell } ^ { v } = \{ w _ { 1 } , w _ { 2 } , w _ { 3 } \}$ of vertex $v$ at level $\ell \cdot$ -th are stacked into a 3rd order tensor and undergo a tensor product operation with the restricted adjacency matrix, and then contracted in different ways. In this figure, we only consider single channel, each channel is represented by a 5th order tensor. In the general case of multi channels, the resulting tensor would have 6th order, but we contract on each channel separately.
361
+
362
+ # 6 EXPERIMENTS
363
+
364
+ We compared the second order variant (CCN 2D) of our CCNs framework (Section 4.2) to several standard graph learning algorithms on three types of datasets that involve learning the properties of molecules from their structure:
365
+
366
+ 1. The Harvard Clean Energy Project (Hachmann et al., 2011), consisting of 2.3 million organic compounds that are candidates for use in solar cells. The regression target in this case is Power Conversion Efficiency (PCE). Due to time constraints, instead of using the entire dataset, the experiments were ran on a random subset of 50,000 molecules.
367
+ 2. QM9, which is a dataset of all 133k organic molecules with up to nine heavy atoms (C,O,N and F) out of the GDB-17 universe of molecules. Each molecule has 13 target properties to predict. The dataset does contain spatial information relating to the atomic configurations, but we only used the chemical graph and atom node labels. For our experiments we normalized each target variable to have mean 0 and standard deviation 1. We report both MAE and RMSE for all normalized learning targets.
368
+ 3. Graph kernels datasets, specifically (a) MUTAG, which is a dataset of 188 mutagenic aromatic and heteroaromatic compounds (Debnat et al., 1991); (b) PTC, which consists of 344 chemical compounds that have been tested for positive or negative toxicity in lab rats (Toivonen et al., 2003); (c) NCI1 and NCI109, which have 4110 and 4127 compounds respectively, each screened for activity against small cell lung cancer and ovarian cancer lines (Wale et al., 2008).
369
+
370
+ In the case of HCEP, we compared CCN to lasso, ridge regression, random forests, gradient boosted trees, optimal assignment Wesifeiler–Lehman graph kernel (Kriege et al., 2016) (WL), neural graph fingerprints (Duvenaud et al., 2015), and the “patchy-SAN” convolutional type algorithm from (Niepert et al., 2016) (referred to as PSCN). For the first four of these baseline methods, we created simple feature vectors from each molecule: the number of bonds of each type (i.e. number of $_ \mathrm { H - H }$ bonds, number of ${ \mathrm { C } } { \mathrm { - } } 0$ bonds, etc) and the number of atoms of each type. Molecular graph fingerprints uses atom labels of each vertex as base features. For ridge regression and lasso, we cross validated over $\lambda$ . For random forests and gradient boosted trees, we used 400 trees, and cross validated over max depth, minimum samples for a leaf, minimum samples to split a node, and learning rate (for GBT). For neural graph fingerprints, we used 2 layers and a hidden layer size of 10. In PSCN, we used a patch size of 10 with two convolutional layers and a dense layer on top as described in their paper.
371
+
372
+ For the graph kernels datasets, we compare against graph kernel results as reported in (Kondor & Pan, 2016) (which computed kernel matrices using the Weisfeiler–Lehman, Weisfeiler–edge, shortest paths, graphlets and multiscale Laplacian graph kernels and used a C-SVM on top), Neural graph fingerprints (with 2 levels and a hidden size of 10) and PSCN. For QM9, we compared against the Weisfeiler–Lehman graph kernel (with C-SVM on top), neural graph fingerprints, and PSCN. The settings for NGF and PSCN are as described for HCEP.
373
+
374
+ For our own method, second order CCN, we initialized the base features of each vertex with computed histogram alignment features, inspired by (Kriege et al., 2016), of depth up to 10. Each vertex receives a base label $l _ { i } = \mathrm { c o n c a t } _ { j = 1 } ^ { 1 0 } \bar { H _ { j } } ( i )$ where $\bar { H _ { j } } ( i ) \in \mathbb { R } ^ { d }$ (with $d$ being the total number of distinct discrete node labels) is the vector of relative frequencies of each label for the set of vertices at distance equal to $j$ from vertex $i$ . We use exactly 18 unique contractions defined in 5.1.4 that result in additional channels. We used up to three levels and the intermediate number of channels increases 18 time at each level. To avoid exponentially growing channels, we applied learnable weight matrices to compress the channels into a fixed number of channels.
375
+
376
+ In each experiment we used $80 \%$ of the dataset for training, $10 \%$ for validation, and evaluated on the remaining $10 \%$ test set. For the kernel datasets we performed the experiments on 10 separate training/validation/test stratified splits and averaged the resulting classification accuracies. We used Adam optimization method (Kingma & Ba, 2015). Our initial learning rate was set to 0.001 after experimenting on a held out set. The learning rate decayed linearly after each step towards a minimum of $1 0 ^ { - 6 }$ .
377
+
378
+ # 6.1 GRAPHFLOW DEEP LEARNING FRAMEWORK
379
+
380
+ We developed our custom Deep Learning framework in $\mathrm { C + + / C U D A }$ named GraphFlow that supports symbolic/automatic differentiation, dynamic computation graphs, specialized tensor operations, and computational acceleration with GPU. Our method, Covariant Compositional Networks, and other graph neural networks such as Neural Graph Fingerprints (Duvenaud et al., 2015), PSCN (Niepert et al., 2016) and Gated Graph Neural Networks (Li et al., 2016) are implemented based on the GraphFlow framework. Our source code can be found at https://github.com/HyTruongSon/ GraphFlow.
381
+
382
+ One challenge of the implementation of Covariant Compositional Networks is that the high-order tensors (for example, in figure 6, we have a 5th order tensor after the tensor product operation) cannot be stored explicitly in the memory. Our solution is to propose a virtual indexing system in such a way that we never compute the whole sparse high-order tensor at once, but only compute its elements when given the indices. Basically, we always work with a virtual tensor, and that allows us to implement our tensor reduction/contraction operations efficiently with GPU.
383
+
384
+ # 6.2 DISCUSSION
385
+
386
+ On the subsampled HCEP dataset, CCN outperforms all other methods by a very large margin. For the graph kernels datasets, SVM with the Weisfeiler–Lehman kernels achieve the highest accuracy on NCI1 and NCI109, while CCN wins on MUTAG and PTC. Perhaps this poor performance is to be expected, since the datasets are small and neural network approaches usually require tens of thousands of training examples at minimum to be effective. Indeed, neural graph fingerprints and PSCN also perform poorly compared to the Weisfeiler–Lehman kernels.
387
+
388
+ In the QM9 experiments, CCN beats the three other algorithms in both mean absolute error and root mean squared error. It should be noted that (Gilmer et al., 2017) obtained stronger results on QM9, but we cannot properly compare our results with theirs because our experiments only use the adjacency matrices and atom labels of each node, while theirs includes comprehensive chemical features that better inform the target quantum properties.
389
+
390
+ Table 1: HCEP regression results
391
+
392
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Test MAE</td><td rowspan=1 colspan=1>Test RMSE</td></tr><tr><td rowspan=1 colspan=1>Lasso</td><td rowspan=1 colspan=1>0.867</td><td rowspan=1 colspan=1>1.437</td></tr><tr><td rowspan=1 colspan=1>Ridge regression</td><td rowspan=1 colspan=1>0.854</td><td rowspan=1 colspan=1>1.376</td></tr><tr><td rowspan=1 colspan=1>Random forest</td><td rowspan=1 colspan=1>1.004</td><td rowspan=1 colspan=1>1.799</td></tr><tr><td rowspan=1 colspan=1>Gradient boosted trees</td><td rowspan=1 colspan=1>0.704</td><td rowspan=1 colspan=1>1.005</td></tr><tr><td rowspan=1 colspan=1>WL graph kernel</td><td rowspan=1 colspan=1>0.805</td><td rowspan=1 colspan=1>1.096</td></tr><tr><td rowspan=1 colspan=1>Neural graph fingerprints</td><td rowspan=1 colspan=1>0.851</td><td rowspan=1 colspan=1>1.177</td></tr><tr><td rowspan=1 colspan=1>PSCN (k = 10)</td><td rowspan=1 colspan=1>0.718</td><td rowspan=1 colspan=1>0.973</td></tr><tr><td rowspan=1 colspan=1>CCN 2D</td><td rowspan=1 colspan=1>0.340</td><td rowspan=1 colspan=1>0.449</td></tr></table>
393
+
394
+ Table 2: Kernel Datasets Classification results (accuracy $+ / -$ standard deviation)
395
+
396
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>MUTAG</td><td rowspan=1 colspan=1>PTC</td><td rowspan=1 colspan=1>NCI1</td><td rowspan=1 colspan=1>NCI109</td></tr><tr><td rowspan=1 colspan=1>WL</td><td rowspan=1 colspan=1>84.50 ± 2.16</td><td rowspan=1 colspan=1>59.97 ± 1.60</td><td rowspan=1 colspan=1>84.76 ± 0.32</td><td rowspan=1 colspan=1>85.12 ± 0.29</td></tr><tr><td rowspan=1 colspan=1>WL-edge</td><td rowspan=1 colspan=1>82.94 ± 2.33</td><td rowspan=1 colspan=1>60.18 ± 2.19</td><td rowspan=1 colspan=1>84.65 ± 0.25</td><td rowspan=1 colspan=1>85.32 ± 0.34</td></tr><tr><td rowspan=1 colspan=1>SP</td><td rowspan=1 colspan=1>85.50 ± 2.50</td><td rowspan=1 colspan=1>59.53 ± 1.71</td><td rowspan=1 colspan=1>73.61 ± 0.36</td><td rowspan=1 colspan=1>73.23 ± 0.26</td></tr><tr><td rowspan=1 colspan=1>Graphlet</td><td rowspan=1 colspan=1>82.44 ± 1.29</td><td rowspan=1 colspan=1>55.88 ± 0.31</td><td rowspan=1 colspan=1>62.40 ± 0.27</td><td rowspan=1 colspan=1>62.35 ± 0.28</td></tr><tr><td rowspan=1 colspan=1>p-RW</td><td rowspan=1 colspan=1>80.33 ± 1.35</td><td rowspan=1 colspan=1>59.85 ± 0.95</td><td rowspan=1 colspan=1>TIMED OUT</td><td rowspan=1 colspan=1>TIMED OUT</td></tr><tr><td rowspan=1 colspan=1>MLG</td><td rowspan=1 colspan=1>87.94 ± 1.61</td><td rowspan=1 colspan=1>63.26 ± 1.48</td><td rowspan=1 colspan=1>81.75 ± 0.24</td><td rowspan=1 colspan=1>81.31 ± 0.22</td></tr><tr><td rowspan=1 colspan=1>PSCN k = 10 (Niepert et al.)</td><td rowspan=1 colspan=1>88.95 ± 4.37</td><td rowspan=1 colspan=1>62.29 ± 5.68</td><td rowspan=1 colspan=1>76.34 ± 1.68</td><td rowspan=1 colspan=1>N/A</td></tr><tr><td rowspan=1 colspan=1>Neural graph fingerprints</td><td rowspan=1 colspan=1>89.00± 7.00</td><td rowspan=1 colspan=1>57.85 ± 3.36</td><td rowspan=1 colspan=1>62.21 ± 4.72</td><td rowspan=1 colspan=1>56.11 ± 4.31</td></tr><tr><td rowspan=1 colspan=1>CCN 2D</td><td rowspan=1 colspan=1>91.64 ± 7.24</td><td rowspan=1 colspan=1>70.62 ± 7.04</td><td rowspan=1 colspan=1>76.27 ± 4.13</td><td rowspan=1 colspan=1>75.54 ± 3.36</td></tr></table>
397
+
398
+ # 7 CONCLUSIONS
399
+
400
+ We have presented a general framework called covariant compositional networks (CCNs) for constructing covariant graph neural networks, which encompasses other message passing approaches as special cases, but takes a more general and principled approach to ensuring covariance with respect to permutations. Experimental results on several benchmark datasets show that CCNs can outperform other state-of-the-art algorithms.
401
+
402
+ Table 3: QM9 regression results (MAE)
403
+
404
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>WLGK</td><td rowspan=1 colspan=1>NGF</td><td rowspan=1 colspan=1>PSCN (k =10)</td><td rowspan=1 colspan=1>CCN 2D</td></tr><tr><td rowspan=1 colspan=1>alpha</td><td rowspan=1 colspan=1>0.46</td><td rowspan=1 colspan=1>0.43</td><td rowspan=1 colspan=1>0.20</td><td rowspan=1 colspan=1>0.16</td></tr><tr><td rowspan=1 colspan=1>Cv</td><td rowspan=1 colspan=1>0.59</td><td rowspan=1 colspan=1>0.47</td><td rowspan=1 colspan=1>0.27</td><td rowspan=1 colspan=1>0.23</td></tr><tr><td rowspan=1 colspan=1>G</td><td rowspan=1 colspan=1>0.51</td><td rowspan=1 colspan=1>0.46</td><td rowspan=1 colspan=1>0.33</td><td rowspan=1 colspan=1>0.29</td></tr><tr><td rowspan=1 colspan=1>gap</td><td rowspan=1 colspan=1>0.72</td><td rowspan=1 colspan=1>0.67</td><td rowspan=1 colspan=1>0.60</td><td rowspan=1 colspan=1>0.54</td></tr><tr><td rowspan=1 colspan=1>H</td><td rowspan=1 colspan=1>0.52</td><td rowspan=1 colspan=1>0.47</td><td rowspan=1 colspan=1>0.34</td><td rowspan=1 colspan=1>0.30</td></tr><tr><td rowspan=1 colspan=1>HOMO</td><td rowspan=1 colspan=1>0.64</td><td rowspan=1 colspan=1>0.58</td><td rowspan=1 colspan=1>0.51</td><td rowspan=1 colspan=1>0.39</td></tr><tr><td rowspan=1 colspan=1>LUMO</td><td rowspan=1 colspan=1>0.70</td><td rowspan=1 colspan=1>0.65</td><td rowspan=1 colspan=1>0.59</td><td rowspan=1 colspan=1>0.53</td></tr><tr><td rowspan=1 colspan=1>mu</td><td rowspan=1 colspan=1>0.69</td><td rowspan=1 colspan=1>0.63</td><td rowspan=1 colspan=1>0.54</td><td rowspan=1 colspan=1>0.48</td></tr><tr><td rowspan=1 colspan=1>omega1</td><td rowspan=1 colspan=1>0.72</td><td rowspan=1 colspan=1>0.63</td><td rowspan=1 colspan=1>0.57</td><td rowspan=1 colspan=1>0.45</td></tr><tr><td rowspan=1 colspan=1>R2</td><td rowspan=1 colspan=1>0.55</td><td rowspan=1 colspan=1>0.49</td><td rowspan=1 colspan=1>0.22</td><td rowspan=1 colspan=1>0.19</td></tr><tr><td rowspan=1 colspan=1>U</td><td rowspan=1 colspan=1>0.52</td><td rowspan=1 colspan=1>0.47</td><td rowspan=1 colspan=1>0.34</td><td rowspan=1 colspan=1>0.29</td></tr><tr><td rowspan=1 colspan=1>U0</td><td rowspan=1 colspan=1>0.52</td><td rowspan=1 colspan=1>0.47</td><td rowspan=1 colspan=1>0.34</td><td rowspan=1 colspan=1>0.29</td></tr><tr><td rowspan=1 colspan=1>ZPVE</td><td rowspan=1 colspan=1>0.57</td><td rowspan=1 colspan=1>0.51</td><td rowspan=1 colspan=1>0.43</td><td rowspan=1 colspan=1>0.39</td></tr></table>
405
+
406
+ Table 4: QM9 regression results (RMSE)
407
+
408
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>WLGK</td><td rowspan=1 colspan=1>NGF</td><td rowspan=1 colspan=1>PSCN (k =10)</td><td rowspan=1 colspan=1>CCN 2D</td></tr><tr><td rowspan=1 colspan=1>alpha</td><td rowspan=1 colspan=1>0.68</td><td rowspan=1 colspan=1>0.65</td><td rowspan=1 colspan=1>0.31</td><td rowspan=1 colspan=1>0.26</td></tr><tr><td rowspan=1 colspan=1>Cv</td><td rowspan=1 colspan=1>0.78</td><td rowspan=1 colspan=1>0.65</td><td rowspan=1 colspan=1>0.34</td><td rowspan=1 colspan=1>0.30</td></tr><tr><td rowspan=1 colspan=1>G</td><td rowspan=1 colspan=1>0.67</td><td rowspan=1 colspan=1>0.62</td><td rowspan=1 colspan=1>0.43</td><td rowspan=1 colspan=1>0.38</td></tr><tr><td rowspan=1 colspan=1>gap</td><td rowspan=1 colspan=1>0.86</td><td rowspan=1 colspan=1>0.82</td><td rowspan=1 colspan=1>0.75</td><td rowspan=1 colspan=1>0.69</td></tr><tr><td rowspan=1 colspan=1>H</td><td rowspan=1 colspan=1>0.68</td><td rowspan=1 colspan=1>0.62</td><td rowspan=1 colspan=1>0.44</td><td rowspan=1 colspan=1>0.40</td></tr><tr><td rowspan=1 colspan=1>HOMO</td><td rowspan=1 colspan=1>0.91</td><td rowspan=1 colspan=1>0.81</td><td rowspan=1 colspan=1>0.70</td><td rowspan=1 colspan=1>0.55</td></tr><tr><td rowspan=1 colspan=1>LUMO</td><td rowspan=1 colspan=1>0.84</td><td rowspan=1 colspan=1>0.79</td><td rowspan=1 colspan=1>0.73</td><td rowspan=1 colspan=1>0.68</td></tr><tr><td rowspan=1 colspan=1>mu</td><td rowspan=1 colspan=1>0.92</td><td rowspan=1 colspan=1>0.87</td><td rowspan=1 colspan=1>0.75</td><td rowspan=1 colspan=1>0.67</td></tr><tr><td rowspan=1 colspan=1>omega1</td><td rowspan=1 colspan=1>0.84</td><td rowspan=1 colspan=1>0.77</td><td rowspan=1 colspan=1>0.73</td><td rowspan=1 colspan=1>0.65</td></tr><tr><td rowspan=1 colspan=1>R2</td><td rowspan=1 colspan=1>0.81</td><td rowspan=1 colspan=1>0.71</td><td rowspan=1 colspan=1>0.31</td><td rowspan=1 colspan=1>0.27</td></tr><tr><td rowspan=1 colspan=1>U</td><td rowspan=1 colspan=1>0.67</td><td rowspan=1 colspan=1>0.62</td><td rowspan=1 colspan=1>0.44</td><td rowspan=1 colspan=1>0.40</td></tr><tr><td rowspan=1 colspan=1>U0</td><td rowspan=1 colspan=1>0.67</td><td rowspan=1 colspan=1>0.62</td><td rowspan=1 colspan=1>0.44</td><td rowspan=1 colspan=1>0.39</td></tr><tr><td rowspan=1 colspan=1>ZPVE</td><td rowspan=1 colspan=1>0.72</td><td rowspan=1 colspan=1>0.66</td><td rowspan=1 colspan=1>0.55</td><td rowspan=1 colspan=1>0.51</td></tr></table>
409
+
410
+ # REFERENCES
411
+
412
+ P. Battaglia, R. Pascanu, M. Lai, D. J. Rezende, and K. Kavukcuoglu. Interaction networks for learning about objects, relations and physics. 29:4502–4510, 2016.
413
+
414
+ K. M. Borgwardt and H. P. Kriegel. Shortest-path kernels on graphs. 5:74–81, 2005.
415
+
416
+ J. Bruna, W. Zaremba, A. Szlam, and Y. LeCun. Spectral networks and locally connected networks on graphs. 3, 2014.
417
+
418
+ J. Y. Cai, M. Furer, and N. Immerman. An optimal lower bound on the number of variables for graph identification. Combinatorica, 12:389–410, 12 1992.
419
+
420
+ T. Cohen and M. Welling. Group equivariant convolutional networks. 33:2990–2999, 2016.
421
+
422
+ T. Cohen and M. Welling. Steerable cnns. Proc. ICLR, 5, 2017.
423
+
424
+ A. K. Debnat, R. L. Lopez de Compadre, G. Debnath, A. J. Shusterman, and C. Hansch. Structureactivity relationship of mutagenic aromatic and heteroaromatic nitro compounds. correlation with molecular orbital energies and hydrophobicity. J. Med. Chem., 34:786–97, 1991.
425
+
426
+ M. Defferrard, X. Bresson, and P. Vandergheynst. Convolutional neural networks on graphs with fast localized spectral filtering. 29, 2016.
427
+
428
+ D. K. Duvenaud, D. Maclaurin, J. Iparraguirre, R. Bombarell, T. Hirzel, A. Aspuru-Guzik, and R. P. Adams. Convolutional networks on graphs for learning molecular fingerprints. 28:2224–2232, 2015.
429
+
430
+ P. F. Felzenszwalb and D. P. Huttenlocher. Pictorial structures for object recognition. Int. J. Comput. Vis., 61:55–71, 2005.
431
+
432
+ P. F. Felzenszwalb, R. B. Girshick, D. McAllester, and D. Ramanan. Object detection with discriminatively trained part-based models. IEEE Trans. Pattern Anal. Mach. Intell., 32:541–551, 2010.
433
+
434
+ A. Feragen, N. Kasenburg, J. Peterson, M. de Bruijne, and K. M. Borgwardt. Scalable kernels for graphs with continuous attributes. 26, 2013.
435
+
436
+ M. Fischler and R. Elschlager. The representation and matching of pictorial structures. IEEE Trans. Comput., C-22:67–92, 1973.
437
+
438
+ W. T. Freeman and E. H. Adelson. The design and use of steerable filters. IEEE Trans. Pattern Anal. Mach. Intell., 13:891–906, 09 1991.
439
+
440
+ T. Gartner. Exponential and geometric kernels for graphs. Principles of modeling nonvectorial data, ¨ 2002.
441
+
442
+ J. Gilmer, S. S. Schoenholz, P. F. Riley, O. Vinyals, and G. E. Dahl. Neural message passing for quantum chemistry. In Doina Precup and Yee Whye Teh (eds.), Proc. ICML, volume 70 of Proceedings of Machine Learning Research, pp. 1263–1272, International Convention Centre, Sydney, Australia, 08 2017. PMLR. URL http://proceedings.mlr.press/v70/ gilmer17a.html.
443
+ J. Hachmann, R. Olivares-Amaya, S. Atahan-Evrenk, C. Amador-Bedolla, R. S. Sanchez-Carrera, A. Gold-Parker, L. Vogt, A. M. Brockway, and A. Aspuru-Guzik. The harvard clean energy project: Large-scale computational screening and design of organic photovoltaics on the world community grid. J. Phys. Chem. Lett., 2:2241–2251, 2011.
444
+ M. Henaff, J. Bruna, and Y. LeCun. Deep convolutional networks on graph-structured data. arXiv preprint arXiv:1506.05163, 06 2015.
445
+ S. Kearnes, K. McCloskey, M. Brendl, V. Pande, and P. Riley. Molecular graph convolutions: moving beyond fingerprints. J. Comput. Aided Mol. Des., 30:595–608, 2016.
446
+ D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. In Proc. ICLR, San Diego, 2015.
447
+ T. N. Kipf and M. Welling. Semi-supervised classification with graph convolutional networks. 5, 2017.
448
+ R. Kondor and K. M. Borgwardt. The skew spectrum of graphs. 25:496–503, 2008.
449
+ R. Kondor and H. Pan. The multiscale laplacian graph kernel. 29:2982–2990, 2016.
450
+ N. M. Kriege, P. Giscard, and R. Wilson. On valid optimal assignment kernels and applications to graph classification. Adv. NIPS, 20:1623–1631, 2016.
451
+ A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. 25:1097–1105, 01 2012.
452
+ Y. LeCun, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proc. IEEE, pp. 2278–2324, 1998.
453
+ Y. Li, D. Tarlow, M. Brockschmidt, and R. Zemel. Gated graph sequence neural networks. Proc. ICLR, 4, 2016.
454
+ R. Manduchi, P. Perona, and D. Shy. Efficient deformable filter banks. IEEE Trans. on Signal Process., 46:1168–1173, 04 1998.
455
+ M. Neumann, R. Garnett, C. Baukhage, and K. Kersting. Propagation kernels: efficient graph kernels from propagated information. 102, 02 2016.
456
+ M. Niepert, M. Ahmed, and K. Kutzkov. Learning convolutional neural networks for graphs. 33: 2014–2023, 2016.
457
+ Y. Ohta, T. Kanade, and T. Sakai. An analysis system for scenes containing objects with substructures. 4:752–754, 1978.
458
+ P. Perona. Deformable kernels for early vision. IEEE Trans. Pattern Anal. Mach. Intell., 17:488– 499, 05 1995.
459
+ R. C. Read and D. G. Corneil. The graph isomorphism disease. J. Graph Theory, 1:339–363, 1977.
460
+ B. E. Sagan. The Symmetric Group. Grad. Texts in Math. Springer, 2001.
461
+ F. Scarselli, M. Gori, A. C. Tsoi, M. Hagenbuchner, and G. Monfardini. The graph neural network model. IEEE Trans. on Neural Netw., 20:61–80, 2009.
462
+ K. T. Schutt, Kristof T., F. Arbabzadah, S. Chmiela, K. R. M ¨ uller, and A. Tkatchenko. Quantum- ¨ chemical insights from deep tensor neural networks. Nat. Commun., 8:13890, 01 2017.
463
+ N. Shervashidze, S. V. N. Vishwanathan, T. Petri, K. M., and K. M. Borgwardt. Efficient graphlet kernels for large graph comparison. 12:488–495, 2009.
464
+ N. Shervashidze, P. Schweitzer, E. J. van Leeuwan, K. Mehlhorn, and K. M. Borgwardt. Weisfeilerlehman graph kernels. J. Mach. Learn. Res., 12:2539–2561, 2011.
465
+ E. P. Simoncelli, W. T. Freeman, E. H. Adelson, and D. J. Heeger. Shiftable multiscale transforms. IEEE Trans. Inf. Theory., 38:587–607, 03 1992.
466
+ P. C. Teo and Y. Hel-Or. Lie generators for computing steerable functions. Pattern Recognit. Lett., 16:7–17, 10 1998.
467
+ H. Toivonen, A. Srinivasan, R. D. King, S. Kramer, and C. Helma. Statistical evaluation of the predictive toxicology challenge. Bioinformatics, 19:1183–1193, 2003.
468
+ Z. W. Tu, X. R. Chen, A. L. Yuille, and S. C. Zhu. Image parsing: Unifying segmentation, detection, and recognition. Int. J. Comput. Vis., 63:113–140, 2005.
469
+ S. V. N. Vishwanathan, N. N. Schraudolf, R. Kondor, and K. M. Bogwardt. Graph kernels. J. Mach. Learn. Res., 11:1201–1242, 2010.
470
+ N. Wale, I. A. Watson, and G. Karypis. Comparison of descriptor spaces for chemical compound retrieval and classification. Knowl. Info. Sys., 14:347–375, 2008.
471
+ B. Weisfeiler and A. A. Lehman. A reduction of a graph to a canonical form and an algebra arising during this reduction. Nauchno-Technicheskaya Informatsia, 9, 1968.
472
+ D. E. Worrall, S. Garbin, D. Turmukhambetov, and G. J. Brostow. Harmonic networks: Deep translation and rotation equivariance. Proc. IEEE CVPR, 07 2017.
473
+ S. Zhu and D. Mumford. A stochastic grammar of images. Found. Trends Comput. Graphics Vis., 2:259–362, 2006.
474
+
475
+ # A MATHEMATICAL BACKGROUND
476
+
477
+ Groups. A group is a set $G$ endowed with an operation $G \times G \to G$ (usually denoted multiplicatively) obeying the following axioms:
478
+
479
+ G1. for any $u , v \in G , \ u v \in G$ (closure);
480
+ G2. for any $u , v , w \in G$ , $u ( v w ) = ( u v ) w$ (associativity);
481
+ G3. there is a unique $e \in G$ , called the identity of $G$ , such that $e u = u e = u$ for any $u \in G$ ;
482
+ G4. for any $u \in G$ , there is a corresponding element $u ^ { - 1 } \in G$ called the inverse of $u$ , such that $u u ^ { - 1 } \bar { } = u ^ { - 1 } u = e .$ .
483
+
484
+ We do not require that the group operation be commutative, i.e., in general, $u v \ne v u$ . Groups can be finite or infinite, countable or uncountable, compact or non-compact. While most of the results in this paper would generalize to any compact group, the keep the exposition as simple as possible, throughout we assume that $G$ is finite or countably infinite. As usual, $| G |$ will denote the size (cardinality) of $G$ , sometimes also called the order of the group.
485
+
486
+ Representations. A (finite dimensional) representation of a group $G$ over a field $\mathbb { F }$ is a matrixvalued function $R \colon G \to \mathbb { F } ^ { d _ { \rho } \times d _ { \rho } }$ such that $R ( x ) R ( y ) = R ( x y )$ for any $x , y \in G$ . We generally assume that $\mathbb { F } = \mathbb { C }$ , however in the special case when $G$ is the symmetric group $\mathbb { S } _ { n }$ we can restrict ourselves to only considering real-valued representations, i.e., $\mathbb { F } = \mathbb { R }$ .
487
+
488
+ # B PROOFS
489
+
490
+ Proof of Proposition 1. Let $\mathcal { G }$ and $\mathcal { G } ^ { \prime }$ be two compound objects, where $\mathcal { G } ^ { \prime }$ is equivalent to $\mathcal { G }$ up to a permutation $\sigma \in \mathbb { S } _ { n }$ of the atoms. For any node ${ \mathfrak { n } } _ { a }$ of $\mathcal { G }$ we let ${ \mathfrak { n } } _ { a } ^ { \prime }$ be the corresponding node of $\mathcal { G } ^ { \prime }$ , and let $f _ { a }$ and $f _ { a } ^ { \prime }$ be their activations.
491
+
492
+ We prove that $f _ { a } = f _ { a } ^ { \prime }$ for every node in $\mathcal { G }$ by using induction on the distance of ${ \mathfrak { n } } _ { a }$ from its farthest descendant that is a leaf, which we call its height and denote $h ( a )$ . For $h ( a ) = 0$ , the statment is
493
+
494
+ clearly true, since $f _ { a } = f _ { a } ^ { \prime } = \ell _ { \xi ( a ) }$ . Now assume that it is true for all nodes with height up to $h ^ { * }$ . For any node ${ \mathfrak { n } } _ { a }$ with $h ( a ) = h ^ { * } + 1$ , $f _ { a } = \Phi ( f _ { c _ { 1 } } , f _ { c _ { 2 } } , . . . , f _ { c _ { k } } )$ , where each of the children $c _ { 1 } , \ldots , c _ { k }$ are of height at most $h ^ { * }$ , therefore
495
+
496
+ $$
497
+ f _ { a } = \Phi ( f _ { c _ { 1 } } , f _ { c _ { 2 } } , \dots , f _ { c _ { k } } ) = \Phi ( f _ { c _ { 1 } } ^ { \prime } , f _ { c _ { 2 } } ^ { \prime } , \dots , f _ { c _ { k } } ^ { \prime } ) = f _ { a } ^ { \prime } .
498
+ $$
499
+
500
+ Thus, $f _ { a } = f _ { a } ^ { \prime }$ for every node in $\mathcal { G }$ . The proposition follows by $\phi ( \mathcal { G } ) = f _ { r } = f _ { r } ^ { \prime } = \phi ( \mathcal { G } ^ { \prime } )$
501
+
502
+ Proof of Proposition 3. Let ${ \mathcal { G } } , { \mathcal { G } } ^ { \prime }$ , $\mathcal { N }$ and $\mathcal { N } ^ { \prime }$ be as in Definition 5. As in Definition 6, for each node (neuron) ${ \mathfrak { n } } _ { i }$ in $\mathcal { N }$ there is a node ${ \mathfrak { n } } _ { j } ^ { \prime }$ in $\mathcal { N } ^ { \prime }$ such that their receptive fields are equivalent up to permutation. That is, if $| { \mathcal { P } } _ { i } | = m$ , then $\left. \mathcal { P } _ { j } ^ { \prime } \right. = m$ , and there is a permutation $\pi \in \mathbb { S } _ { m }$ , such that if $\mathcal { P } _ { i } = ( e _ { p _ { 1 } } , \dots , e _ { p _ { m } } )$ and $\mathcal { P } _ { j } ^ { \prime } = ( e _ { q _ { 1 } } , \ldots , e _ { q _ { m } } )$ , then $e _ { q _ { \pi ( a ) } } = e _ { p _ { a } }$ . By covariance, then $f _ { j } ^ { \prime } = R _ { \pi } ( f _ { i } )$ .
503
+
504
+ Now let $\mathcal { G } ^ { \prime \prime }$ be a third equivalent object, and $\mathcal { N } ^ { \prime \prime }$ the corresponding comp-net. $\mathcal { N } ^ { \prime \prime }$ must also have a node, $\mathfrak { n } _ { k } ^ { \prime \prime }$ , that corresponds to ${ \mathfrak { n } } _ { i }$ and ${ \mathfrak { n } } _ { j } ^ { \prime }$ . In particular, letting its receptive field be $\mathcal { P } _ { k } ^ { \prime \prime } = ( e _ { r _ { 1 } } , \ldots , e _ { r _ { m } } )$ , there is a permutation $\sigma \in \mathbb { S } _ { m }$ for which $e _ { r _ { \sigma ( b ) } } = e _ { q _ { b } }$ . Therefore, $f _ { k } ^ { \prime \prime } = R _ { \sigma } ( f _ { j } ^ { \prime } )$ .
505
+
506
+ At the same time, ${ \mathfrak { n } } _ { k } ^ { \prime \prime }$ is also in correspondence with ${ \mathfrak { n } } _ { i }$ . In particular, letting $\tau = \sigma \pi$ (which corresponds to first applying the permutation $\pi$ , then applying $\sigma$ ), $e _ { r _ { \tau ( a ) } } = e _ { p _ { a } }$ , and therefore $f _ { k } ^ { \prime \prime } { = } R _ { \tau } ( f _ { i } )$ . Hence, the $\{ R _ { \pi } \}$ maps must satisfy
507
+
508
+ $$
509
+ R _ { \sigma \pi } ( f _ { i } ) = R _ { \sigma } ( f _ { j } ^ { \prime } ) = R _ { \sigma } ( R _ { \pi } ( f _ { i } ) ) ,
510
+ $$
511
+
512
+ for any $f _ { i }$ . More succinctly, $R _ { \sigma \pi } = R _ { \sigma } \circ R _ { \pi }$ for any $\pi , \sigma \in \mathbb { S } _ { m }$ . In the case that the $\{ R _ { \pi } \}$ maps are linear and represented by matrices, this reduces to $R _ { \sigma \pi } = R _ { \sigma } R _ { \pi }$ , which is equivalent to saying that they form a group representation of $\mathbb { S } _ { m }$ . 
513
+
514
+ Proof of Proposition 4. Under the action of a permutation $\pi \in \mathbb { S } _ { m }$ , $A$ and $B$ transform as
515
+
516
+ $$
517
+ \begin{array} { l l l l l l } { { A \mapsto A ^ { \prime } } } & { { \qquad } } & { { [ A ^ { \prime } ] _ { j _ { 1 } , \dots , j _ { k } } } } & { { = } } & { { [ P _ { \pi } ] _ { j _ { 1 } } j _ { 1 } ^ { \prime } [ P _ { \pi } ] _ { j _ { 2 } } ^ { \prime } \dots [ P _ { \pi } ] _ { j _ { k } } j _ { k } ^ { \prime } [ A ] _ { j _ { 1 } ^ { \prime } , \dots , j _ { k } ^ { \prime } } , } } \\ { { B \mapsto B ^ { \prime } } } & { { \qquad } } & { { [ B ^ { \prime } ] _ { j _ { 1 } , \dots , j _ { p } } } } & { { = } } & { { [ P _ { \pi } ] _ { j _ { 1 } } j _ { 1 } ^ { \prime } [ P _ { \pi } ] _ { j _ { 2 } } ^ { \prime } \dots [ { P _ { \pi } } ] _ { j _ { p } } j _ { p } ^ { \prime } [ B ] _ { j _ { 1 } ^ { \prime } , \dots , j _ { p } ^ { \prime } } . } } \end{array}
518
+ $$
519
+
520
+ Case 1. Let $C = A \otimes B$ . Under (3) and (4), $C$ transforms into
521
+
522
+ $$
523
+ \begin{array} { r l } & { [ C ^ { \prime } ] _ { i _ { 1 } , \dots , i _ { k + p } } = \left( [ P _ { \pi } ] _ { i _ { 1 } } \dotsi _ { 1 } [ P _ { \pi } ] _ { i _ { k } } ^ { i } [ A ] _ { i _ { 1 } ^ { \prime } , \dots , i _ { k } ^ { \prime } } \right) \left( [ P _ { \pi } ] _ { i _ { k + 1 } } \underset { \dots } { \overset { i _ { k } ^ { \prime } } { _ { k + 1 } } } \dotsi [ P _ { \pi } ] _ { i _ { k + p } } \ [ B ] _ { i _ { k + 1 } ^ { \prime } , \dots , i _ { k + p } ^ { \prime } } \right) } \\ & { \qquad = [ P _ { \pi } ] _ { i _ { 1 } ^ { \prime } } \dots [ P _ { \pi } ] _ { i _ { k + p } } \ C _ { i _ { 1 } ^ { \prime } , \dots , i _ { k + p } ^ { \prime } } , } \end{array}
524
+ $$
525
+
526
+ therefore, $C$ is a $k + p ^ { \mathrm { : } }$ ’th order $P -$ –tensor.
527
+
528
+ Case 2. Let $\begin{array} { r } { C = A \odot _ { ( a _ { 1 } , . . . , a _ { p } ) } B } \end{array}$ . Under (3) and (4), $C$ transforms as
529
+
530
+ $$
531
+ \begin{array} { r l } { [ C ^ { \prime } ] _ { i _ { 1 } , \dots , i _ { k } } = \left( [ P _ { \pi } ] _ { i _ { 1 } } i _ { 1 } ^ { \prime } \dots [ P _ { \pi } ] _ { i _ { k } } i _ { k } ^ { \prime } [ A ] _ { i _ { 1 } ^ { \prime } , \dots , i _ { k } ^ { \prime } } \right) \left( [ P _ { \pi } ] _ { i _ { a _ { 1 } } } i _ { 2 1 } ^ { \prime } \dots [ P _ { \pi } ] _ { i _ { a _ { p } } } ^ { \phantom { \dagger } } [ B ] _ { i _ { a _ { 1 } } ^ { \prime } , \dots , i _ { a _ { p } } ^ { \prime } } \right) = } & { } \\ { = [ P _ { \pi } ] _ { i _ { 1 } ^ { \prime } } \dots [ P _ { \pi } ] _ { i _ { k } ^ { \prime } } \dots [ P _ { \pi } ] _ { i _ { a _ { 1 } } ^ { \prime } } \dots [ P _ { \pi } ] _ { i _ { a _ { 1 } } } i _ { 2 1 } ^ { \prime } \dots [ P _ { \pi } ] _ { i _ { a _ { p } } ^ { \prime } } \dots [ C ] _ { i _ { 1 } ^ { \prime } \dots , i _ { k } ^ { \prime } } . } & { } \end{array}
532
+ $$
533
+
534
+ Note that each of the [Pπ ]iaji0aj factors in this expression repeats one of the earlier appearing $[ P _ { \pi } ] _ { i _ { 1 } } { } ^ { i _ { 1 } ^ { \prime } } , ~ . ~ . ~ . ~ , [ P _ { \pi } ] _ { i _ { k } } { } ^ { i _ { k } ^ { \prime } }$ factors, but since $P _ { \pi }$ only has zero and one entries $[ { \cal P } _ { \pi } ] _ { a , b } ^ { 2 } \ = \ [ { \cal P } _ { \pi } ] _ { a , b }$ , so these factors can be dropped. Thus, $C$ is a $k$ ’th order $P -$ –tensor.
535
+
536
+ Case 3. Let $C = A { \downarrow } _ { a _ { 1 } , \dots , a _ { p } }$ and $b _ { 1 } , \dotsc , b _ { k - p }$ be the indices (in increasing order) that are not amongst $\{ a _ { 1 } , \ldots , a _ { p } \}$ . Under (3), $C$ becomes
537
+
538
+ $$
539
+ \begin{array} { l } { { [ { \cal C } ^ { \prime } ] _ { i _ { b _ { 1 } } , \dots , i _ { b _ { k - p } } } = \displaystyle \sum _ { i _ { a _ { 1 } } } \dots \sum _ { i _ { a _ { p } } } [ P _ { \pi } ] _ { i _ { 1 } } i _ { 1 } ^ { \prime } ~ \dots ~ [ P _ { \pi } ] _ { i _ { k } } ^ { i _ { k } ^ { \prime } } ~ [ A ] _ { i _ { 1 } ^ { \prime } , \dots , i _ { k } ^ { \prime } } } } \\ { { { } } } \\ { { { } = [ P _ { \pi } ] _ { i _ { b _ { 1 } } } i _ { b _ { 1 } } ^ { \prime } ~ \dots ~ [ P _ { \pi } ] _ { i _ { b _ { k - p } } } \sum _ { i _ { a _ { 1 } } ^ { \prime } } \dots \sum _ { i _ { a _ { p } } ^ { \prime } } [ A ] _ { i _ { 1 } ^ { \prime } , \dots , i _ { k } ^ { \prime } } } } \end{array}
540
+ $$
541
+
542
+ Thus, $C$ is a $k - p$ ’th order $P -$ –tensor.
543
+
544
+ Case 4. Follows directly from 3.
545
+
546
+ Case 5. Finally, if $A _ { 1 } , . . . , A _ { u }$ are $k ^ { \mathrm { : } }$ ’th order $P -$ –tensors and $\begin{array} { r } { C = \sum _ { j } \alpha _ { j } A _ { j } } \end{array}$ then
547
+
548
+ $$
549
+ [ C ^ { \prime } ] _ { i _ { 1 } , \ldots , i _ { k } } = \sum _ { j } \alpha _ { j } [ P _ { \pi } ] _ { i _ { 1 } ^ { \prime } } \ldots [ P _ { \pi } ] _ { i _ { k } ^ { \prime } } [ A _ { j } ^ { \prime } ] _ { i _ { 1 } ^ { \prime } , \ldots , i _ { k } ^ { \prime } } = [ P _ { \pi } ] _ { i _ { 1 } ^ { \prime } } \ldots [ P _ { \pi } ] _ { i _ { k } ^ { \prime } } \sum _ { j } \alpha _ { k } [ A _ { j } ^ { \prime } ] _ { i _ { 1 } ^ { \prime } , \ldots , i _ { k } ^ { \prime } } ,
550
+ $$
551
+
552
+ so $C$ is a $k$ ’th order $P$ –tensor.
553
+
554
+ Proof of Proposition 5. Under the action of a permutation $\pi \in \mathbb { S } _ { m ^ { \prime } }$ on $\mathcal { P } _ { b } , \chi$ (dropping the $a { } b$ superscipt) transforms to $\chi ^ { \prime }$ , where $\chi _ { i , j } ^ { \prime } = \chi _ { \pi ^ { - 1 } ( i ) , j }$ . However, this can also be written as
555
+
556
+ $$
557
+ \chi _ { i , j } ^ { \prime } = [ P _ { \pi } \chi ] _ { i , j } = \sum _ { i ^ { \prime } } [ P _ { \pi } ] _ { i , i ^ { \prime } } \chi _ { i ^ { \prime } , j } .
558
+ $$
559
+
560
+ Therefore, $\widetilde { F } _ { i _ { 1 } , \dots , i _ { k } }$ transforms to
561
+
562
+ $$
563
+ \widetilde { F } _ { i _ { 1 } , \ldots , i _ { k } } ^ { \prime } = \chi _ { i _ { 1 } } ^ { \prime ~ j _ { 1 } } \chi _ { i _ { 2 } } ^ { \prime ~ j _ { 2 } } \ldots \chi _ { i _ { k } } ^ { \prime ~ j _ { k } } F _ { j _ { 1 } , \ldots , j _ { k } } = [ P _ { \pi } ] _ { i _ { 1 } } i _ { 1 } ^ { i _ { 1 } ^ { \prime } } \ldots [ P _ { \pi } ] _ { i _ { k } } i _ { k } ^ { i _ { k } ^ { \prime } } \chi _ { i _ { 1 } ^ { \prime } } ^ { \prime ~ j _ { 1 } } \chi _ { i _ { 2 } ^ { \prime } } ^ { \prime ~ j _ { 2 } } \ldots \chi _ { i _ { k } ^ { \prime } } ^ { \prime ~ j _ { k } } F _ { j _ { 1 } , \ldots , j _ { k } } ,
564
+ $$
565
+
566
+ so $\widetilde { F }$ is a $P$ –tensor.
567
+
568
+ Proof of Proposition 6. By Proposition 5, under the action of any permutation $\pi$ , each of the $\widetilde { F } _ { p _ { j } }$ slices of $\overline { F }$ transforms as
569
+
570
+ $$
571
+ [ \widetilde { F } _ { p _ { j } } ^ { \prime } ] _ { i _ { 1 } , \dots , i _ { k } } = [ P _ { \pi } ] _ { i _ { 1 } } \widetilde { \phantom { - } } _ { \dots } ^ { i _ { 1 } ^ { \prime } } \dots [ P _ { \pi } ] _ { i _ { k } } \widetilde { \phantom { - } } [ \widetilde { F } _ { p _ { j } } ^ { \prime } ] _ { i _ { 1 } , \dots , i _ { k } } .
572
+ $$
573
+
574
+ At the same time, $\pi$ also permutes the slices amongst each other according to
575
+
576
+ $$
577
+ \overline { { { F } } } _ { i _ { 1 } , \dots , i _ { k } , j } ^ { \prime } = [ \widetilde { F } _ { p _ { \pi ^ { - 1 } ( j ) } } ] _ { i _ { 1 } , \dots , i _ { k } } = \overline { { { F } } } _ { i _ { 1 } , \dots , i _ { k } , \pi ^ { - 1 } ( j ) } ^ { \prime } .
578
+ $$
579
+
580
+ Therefore
581
+
582
+ $$
583
+ \overline { { F } } _ { i _ { 1 } , \dots , i _ { k } , j } ^ { \prime } = [ P _ { \pi } ] _ { i _ { 1 } } { } ^ { i _ { 1 } ^ { \prime } } \dots [ P _ { \pi } ] _ { i _ { k } } { } ^ { i _ { k } ^ { \prime } } [ P _ { \pi } ] _ { j } ^ { j ^ { \prime } } \overline { { F } } _ { i _ { 1 } , \dots , i _ { k } , j } ,
584
+ $$
585
+
586
+ so $\overline { F }$ is a $k + 1$ ’th order $P -$ –tensor.
587
+
588
+ Proof of Proposition 7. Under any permutation $\pi \in \mathbb { S } _ { m }$ of $\mathcal { P } _ { i }$ , $A \downarrow _ { \mathcal { P } _ { i } ^ { \prime } }$ transforms to $A \downarrow _ { \mathcal { P } _ { i } ^ { \prime } }$ , where $[ A \downarrow _ { \mathcal { P } _ { i } ^ { \prime } } ] _ { \pi ( a ) , \pi ( b ) } = [ A \downarrow _ { \mathcal { P } _ { i } } ] _ { a , b }$ . Therefore, $A \downarrow _ { \mathcal { P } _ { i } }$ is a second order $P$ –tensor. By the first case of Proposition 4, $F \otimes A \downarrow _ { \mathcal { P } _ { i } }$ is then a $k + 2$ ’th order $P .$ –tensor. 
md/train/S1VaB4cex/S1VaB4cex.md ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # FRACTALNET: ULTRA-DEEP NEURAL NETWORKS WITHOUT RESIDUALS
2
+
3
+ Gustav Larsson University of Chicago larsson@cs.uchicago.edu
4
+
5
+ Michael Maire TTI Chicago mmaire@ttic.edu
6
+
7
+ Gregory Shakhnarovich TTI Chicago greg@ttic.edu
8
+
9
+ # ABSTRACT
10
+
11
+ We introduce a design strategy for neural network macro-architecture based on selfsimilarity. Repeated application of a simple expansion rule generates deep networks whose structural layouts are precisely truncated fractals. These networks contain interacting subpaths of different lengths, but do not include any pass-through or residual connections; every internal signal is transformed by a filter and nonlinearity before being seen by subsequent layers. In experiments, fractal networks match the excellent performance of standard residual networks on both CIFAR and ImageNet classification tasks, thereby demonstrating that residual representations may not be fundamental to the success of extremely deep convolutional neural networks. Rather, the key may be the ability to transition, during training, from effectively shallow to deep. We note similarities with student-teacher behavior and develop drop-path, a natural extension of dropout, to regularize co-adaptation of subpaths in fractal architectures. Such regularization allows extraction of highperformance fixed-depth subnetworks. Additionally, fractal networks exhibit an anytime property: shallow subnetworks provide a quick answer, while deeper subnetworks, with higher latency, provide a more accurate answer.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Residual networks (He et al., 2016a), or ResNets, lead a recent and dramatic increase in both depth and accuracy of convolutional neural networks, facilitated by constraining the network to learn residuals. ResNet variants (He et al., 2016a;b; Huang et al., 2016b) and related architectures (Srivastava et al., 2015) employ the common technique of initializing and anchoring, via a pass-through channel, a network to the identity function. Training now differs in two respects. First, the objective changes to learning residual outputs, rather than unreferenced absolute mappings. Second, these networks exhibit a type of deep supervision (Lee et al., 2014), as near-identity layers effectively reduce distance to the loss. He et al. (2016a) speculate that the former, the residual formulation itself, is crucial.
16
+
17
+ We show otherwise, by constructing a competitive extremely deep architecture that does not rely on residuals. Our design principle is pure enough to communicate in a single word, fractal, and a simple diagram (Figure 1). Yet, fractal networks implicitly recapitulate many properties hard-wired into previous successful architectures. Deep supervision not only arises automatically, but also drives a type of student-teacher learning (Ba & Caruana, 2014; Urban et al., 2017) internal to the network. Modular building blocks of other designs (Szegedy et al., 2015; Liao & Carneiro, 2015) resemble special cases of a fractal network’s nested substructure.
18
+
19
+ For fractal networks, simplicity of training mirrors simplicity of design. A single loss, attached to the final layer, suffices to drive internal behavior mimicking deep supervision. Parameters are randomly initialized. As they contain subnetworks of many depths, fractal networks are robust to choice of overall depth; make them deep enough and training will carve out a useful assembly of subnetworks.
20
+
21
+ The entirety of emergent behavior resulting from a fractal design may erode the need for recent engineering tricks intended to achieve similar effects. These tricks include residual functional forms with identity initialization, manual deep supervision, hand-crafted architectural modules, and studentteacher training regimes. Section 2 reviews this large body of related techniques. Hybrid designs could certainly integrate any of them with a fractal architecture; we leave open the question of the degree to which such hybrids are synergistic.
22
+
23
+ ![](images/389e48bd72030062303ac6da089f1bd92ce9277af84c158fee8a805381e555a4.jpg)
24
+ Figure 1: Fractal architecture. Left: A simple expansion rule generates a fractal architecture with $C$ intertwined columns. The base case, $f _ { 1 } ( z )$ , has a single layer of the chosen type (e.g. convolutional) between input and output. Join layers compute element-wise mean. Right: Deep convolutional networks periodically reduce spatial resolution via pooling. A fractal version uses $f _ { C }$ as a building block between pooling layers. Stacking $B$ such blocks yields a network whose total depth, measured in terms of convolution layers, is $B \cdot \bar { 2 } ^ { C - 1 }$ . This example has depth 40 $B = 5$ , $C = 4$ ).
25
+
26
+ Our main contribution is twofold:
27
+
28
+ • We introduce FractalNet, the first simple alternative to ResNet. FractalNet shows that explicit residual learning is not a requirement for building ultra-deep neural networks. • Through analysis and experiments, we elucidate connections between FractalNet and an array of phenomena engineered into previous deep network designs.
29
+
30
+ As an additional contribution, we develop drop-path, a novel regularization protocol for ultradeep fractal networks. Without data augmentation, fractal networks, trained with drop-path and dropout (Hinton et al., 2012), exceed the performance of residual networks regularized via stochastic depth (Huang et al., 2016b). Though, like stochastic depth, it randomly removes macro-scale components, drop-path further exploits our fractal structure in choosing which components to disable.
31
+
32
+ Drop-path constitutes not only a regularization strategy, but also provides means of optionally imparting fractal networks with anytime behavior. A particular schedule of dropped paths during learning prevents subnetworks of different depths from co-adapting. As a consequence, both shallow and deep subnetworks must individually produce correct output. Querying a shallow subnetwork thus yields a quick and moderately accurate result in advance of completion of the full network.
33
+
34
+ Section 3 elaborates the technical details of fractal networks and drop-path. Section 4 provides experimental comparisons to residual networks across the CIFAR-10, CIFAR-100 (Krizhevsky, 2009), SVHN (Netzer et al., 2011), and ImageNet (Deng et al., 2009) datasets. We also evaluate regularization and data augmentation strategies, investigate subnetwork student-teacher behavior during training, and benchmark anytime networks obtained using drop-path. Section 5 provides synthesis. By virtue of encapsulating many known, yet seemingly distinct, design principles, selfsimilar structure may materialize as a fundamental component of neural architectures.
35
+
36
+ # 2 RELATED WORK
37
+
38
+ Deepening feed-forward neural networks has generally returned dividends in performance. A striking example within the computer vision community is the improvement on the ImageNet (Deng et al., 2009) classification task when transitioning from AlexNet (Krizhevsky et al., 2012) to VGG (Simonyan & Zisserman, 2015) to GoogLeNet (Szegedy et al., 2015) to ResNet (He et al., 2016a). Unfortunately, greater depth also makes training more challenging, at least when employing a firstorder optimization method with randomly initialized layers. As the network grows deeper and more non-linear, the linear approximation of a gradient step becomes increasingly inappropriate. Desire to overcome these difficulties drives research on both optimization techniques and network architectures.
39
+
40
+ On the optimization side, much recent work yields improvements. To prevent vanishing gradients, ReLU activation functions now widely replace sigmoid and tanh units (Nair & Hinton, 2010). This subject remains an area of active inquiry, with various tweaks on ReLUs, e.g. PReLUs (He et al., 2015), and ELUs (Clevert et al., 2016). Even with ReLUs, employing batch normalization (Ioffe & Szegedy, 2015) speeds training by reducing internal covariate shift. Good initialization can also ameliorate this problem (Glorot & Bengio, 2010; Mishkin & Matas, 2016). Path-SGD (Neyshabur et al., 2015) offers an alternative normalization scheme. Progress in optimization is somewhat orthogonal to our architectural focus, with the expectation that advances in either are ripe for combination.
41
+
42
+ Notable ideas in architecture reach back to skip connections, the earliest example of a nontrivial routing pattern within a neural network. Recent work further elaborates upon them (Maire et al., 2014; Hariharan et al., 2015). Highway networks (Srivastava et al., 2015) and ResNet (He et al., 2016a;b) offer additional twists in the form of parameterized pass-through and gating. In work subsequent to our own, Huang et al. (2016a) investigate a ResNet variant with explicit skip connections. These methods share distinction as the only other designs demonstrated to scale to hundreds of layers and beyond. ResNet’s building block uses the identity map as an anchor point and explicitly parameterizes an additive correction term (the residual). Identity initialization also appears in the context of recurrent networks (Le et al., 2015). A tendency of ResNet and highway networks to fall-back to the identity map may make their effective depth much smaller than their nominal depth.
43
+
44
+ Some prior results hint at what we experimentally demonstrate in Section 4. Namely, reduction of effective depth is key to training extremely deep networks; residuals are incidental. Huang et al. (2016b) provide one clue in their work on stochastic depth: randomly dropping layers from ResNet during training, thereby shrinking network depth by a constant factor, provides additional performance benefit. We build upon this intuition through drop-path, which shrinks depth much more drastically.
45
+
46
+ The success of deep supervision (Lee et al., 2014) provides another clue that effective depth is crucial. Here, an auxiliary loss, forked off mid-level layers, introduces a shorter path during backpropagation. The layer at the fork receives two gradients, originating from the main loss and the auxiliary loss, that are added together. Deep supervision is now common, being adopted, for example, by GoogLeNet (Szegedy et al., 2015). However, irrelevance of the auxiliary loss at test time introduces the drawback of having a discrepancy between the actual objective and that used for training.
47
+
48
+ Exploration of the student-teacher paradigm (Ba & Caruana, 2014) illuminates the potential for interplay between networks of different depth. In the model compression scenario, a deeper network (previously trained) guides and improves the learning of a shallower and faster student network (Ba & Caruana, 2014; Urban et al., 2017). This is accomplished by feeding unlabeled data through the teacher and having the student mimic the teacher’s soft output predictions. FitNets (Romero et al., 2015) explicitly couple students and teachers, forcing mimic behavior across several intermediate points in the network. Our fractal networks capture yet another alternative, in the form of implicit coupling, with the potential for bidirectional information flow between shallow and deep subnetworks.
49
+
50
+ Widening networks, by using larger modules in place of individual layers, has also produced performance gains. For example, an Inception module (Szegedy et al., 2015) concatenates results of convolutional layers of different receptive field size. Stacking these modules forms the GoogLeNet architecture. Liao & Carneiro (2015) employ a variant with maxout in place of concatenation. Figure 1 makes apparent our connection with such work. As a fractal network deepens, it also widens. Moreover, note that stacking two 2D convolutional layers with the same spatial receptive field (e.g. $3 \times 3 ,$ ) achieves a larger $( 5 \times 5 )$ receptive field. A horizontal cross-section of a fractal network is reminiscent of an Inception module, except with additional joins due to recursive structure.
51
+
52
+ # 3 FRACTAL NETWORKS
53
+
54
+ We begin with a more formal presentation of the ideas sketched in Figure 1. Convolutional neural networks serve as our running example and, in the subsequent section, our experimental platform. However, it is worth emphasizing that our framework is more general. In principle, convolutional layers in Figure 1 could be replaced by a different layer type, or even a custom-designed module or subnetwork, in order to generate other fractal architectures.
55
+
56
+ Let $C$ denote the index of the truncated fractal $f _ { C } ( \cdot )$ . Our network’s structure, connections and layer types, is defined by $f _ { C } ( \cdot )$ . A network consisting of a single convolutional layer is the base case:
57
+
58
+ $$
59
+ f _ { 1 } ( z ) = \mathrm { c o n v } ( z )
60
+ $$
61
+
62
+ We define successive fractals recursively:
63
+
64
+ $$
65
+ f _ { C + 1 } ( z ) = \left[ ( f _ { C } \circ f _ { C } ) ( z ) \right] \oplus [ \mathrm { c o n v } ( z ) ]
66
+ $$
67
+
68
+ where $\bigcirc$ denotes composition and $\textcircled{+}$ a join operation. When drawn in the style of Figure 1, $C$ corresponds to the number of columns, or width, of network $f _ { C } ( \cdot )$ . Depth, defined to be the number of conv layers on the longest path between input and output, scales as $2 ^ { \overbrace { C } - 1 }$ . Convolutional networks for classification typically intersperse pooling layers. We achieve the same by using $f _ { C } ( \cdot )$ as a building block and stacking it with subsequent pooling layers $B$ times, yielding total depth $B \cdot 2 ^ { C - 1 }$
69
+
70
+ The join operation $\textcircled{+}$ merges two feature blobs into one. Here, a blob is the result of a conv layer: a tensor holding activations for a fixed number of channels over a spatial domain. The channel count corresponds to the size of the filter set in the preceding conv layer. As the fractal is expanded, we collapse neighboring joins into a single join layer which spans multiple columns, as shown on the right side of Figure 1. The join layer merges all of its input feature blobs into a single output blob.
71
+
72
+ Several choices seem reasonable for the action of a join layer, including concatenation and addition. We instantiate each join to compute the element-wise mean of its inputs. This is appropriate for convolutional networks in which channel count is set the same for all conv layers within a fractal block. Averaging might appear similar to ResNet’s addition operation, but there are critical differences:
73
+
74
+ • ResNet makes clear distinction between pass-through and residual signals. In FractalNet, no signal is privileged. Every input to a join layer is the output of an immediately preceding conv layer. The network structure alone cannot identify any as being primary. Drop-path regularization, as described next in Section 3.1, forces each input to a join to be individually reliable. This reduces the reward for even implicitly learning to allocate part of one signal to act as a residual for another. Experiments show that we can extract high-performance subnetworks consisting of a single column (Section 4.2). Such a subnetwork is effectively devoid of joins, as only a single path is active throughout. They produce no signal to which a residual could be added.
75
+
76
+ Together, these properties ensure that join layers are not an alternative method of residual learning.
77
+
78
+ # 3.1 REGULARIZATION VIA DROP-PATH
79
+
80
+ Dropout (Hinton et al., 2012) and drop-connect (Wan et al., 2013) modify interactions between sequential network layers in order to discourage co-adaptation. Since fractal networks contain additional macro-scale structure, we propose to complement these techniques with an analogous coarse-scale regularization scheme.
81
+
82
+ Figure 2 illustrates drop-path. Just as dropout prevents co-adaptation of activations, drop-path prevents co-adaptation of parallel paths by randomly dropping operands of the join layers. This discourages the network from using one input path as an anchor and another as a corrective term (a configuration that, if not prevented, is prone to overfitting). We consider two sampling strategies:
83
+
84
+ • Local: a join drops each input with fixed probability, but we make sure at least one survives. • Global: a single path is selected for the entire network. We restrict this path to be a single column, thereby promoting individual columns as independently strong predictors.
85
+
86
+ ![](images/90121a668d72375db114b3617bbdcce2116550e84a2571d28c89b49996affdc3.jpg)
87
+ Figure 2: Drop-path. A fractal network block functions with some connections between layers disabled, provided some path from input to output is still available. Drop-path guarantees at least one such path, while sampling a subnetwork with many other paths disabled. During training, presenting a different active subnetwork to each mini-batch prevents co-adaptation of parallel paths. A global sampling strategy returns a single column as a subnetwork. Alternating it with local sampling encourages the development of individual columns as performant stand-alone subnetworks.
88
+
89
+ As with dropout, signals may need appropriate rescaling. With element-wise means, this is trivial;
90
+ each join computes the mean of only its active inputs.
91
+
92
+ In experiments, we train with dropout and a mixture model of $5 0 \%$ local and $5 0 \%$ global sampling for drop-path. We sample a new subnetwork each mini-batch. With sufficient memory, we can simultaneously evaluate one local sample and all global samples for each mini-batch by keeping separate networks and tying them together via weight sharing.
93
+
94
+ While fractal connectivity permits the use of paths of any length, global drop-path forces the use of many paths whose lengths differ by orders of magnitude (powers of 2). The subnetworks sampled by drop-path thus exhibit large structural diversity. This property stands in contrast to stochastic depth regularization of ResNet, which, by virtue of using a fixed drop probability for each layer in a chain, samples subnetworks with a concentrated depth distribution (Huang et al., 2016b).
95
+
96
+ Global drop-path serves not only as a regularizer, but also as a diagnostic tool. Monitoring performance of individual columns provides insight into both the network and training mechanisms, as Section 4.3 discusses in more detail. Individually strong columns of various depths also give users choices in the trade-off between speed (shallow) and accuracy (deep).
97
+
98
+ # 3.2 DATA AUGMENTATION
99
+
100
+ Data augmentation can reduce the need for regularization. ResNet demonstrates this, achieving $2 7 . 2 2 \%$ error rate on CIFAR-100 with augmentation compared to $4 4 . 7 6 \%$ without (Huang et al., 2016b). While augmentation benefits fractal networks, we show that drop-path provides highly effective regularization, allowing them to achieve competitive results even without data augmentation.
101
+
102
+ # 3.3 IMPLEMENTATION DETAILS
103
+
104
+ We implement FractalNet using Caffe (Jia et al., 2014). Purely for convenience, we flip the order of pool and join layers at the end of a block in Figure 1. We pool individual columns immediately before the joins spanning all columns, rather than pooling once immediately after them.
105
+
106
+ We train fractal networks using stochastic gradient descent with momentum. As now standard, we employ batch normalization together with each conv layer (convolution, batch norm, then ReLU).
107
+
108
+ <table><tr><td>Method</td><td>C100</td><td>C100+</td><td>C100++</td><td>C10</td><td>C10+</td><td>C10++</td><td>SVHN</td></tr><tr><td>Network in Network (Lin et al.,2013)</td><td>35.68</td><td>1</td><td></td><td>10.41 1</td><td>8.81</td><td></td><td>2.35</td></tr><tr><td>Generalized Pooling (Lee et al., 2016)</td><td>32.37</td><td>1</td><td></td><td>7.62 1</td><td>6.05</td><td></td><td>1.69</td></tr><tr><td>Recurrent CNN (Liang &amp; Hu, 2015)</td><td>31.75</td><td>=</td><td></td><td>8.69</td><td>7.09</td><td>=</td><td>1.77</td></tr><tr><td>Multi-scale (Liao &amp; Carneiro, 2015)</td><td>27.56</td><td>一</td><td></td><td>6.87 一</td><td></td><td>=</td><td>1.76</td></tr><tr><td>FitNet Romero et al. (2015)</td><td>1</td><td>一 35.04</td><td>=</td><td>- 一</td><td>8.39</td><td>=</td><td>2.42</td></tr><tr><td>Deeply Supervised (Lee et al., 2014)</td><td>=</td><td>一 34.57 一</td><td></td><td>9.69 一</td><td>7.97</td><td>1</td><td>1.92</td></tr><tr><td>All-CNN (Springenberg et al., 2014)</td><td></td><td>33.71 一</td><td>=</td><td>9.08</td><td>7.25</td><td>4.41</td><td>1</td></tr><tr><td>Highway Net (Srivastava et al., 2015)</td><td></td><td>32.39 一</td><td></td><td>=</td><td>7.72</td><td>、</td><td>1</td></tr><tr><td>ELU (Clevert et al., 2016)</td><td></td><td>一 24.28</td><td></td><td>一 =</td><td>6.55</td><td>-</td><td>1</td></tr><tr><td>Scalable BO (Snoek et al.,2015)</td><td></td><td>一</td><td>27.04</td><td>一 = 一</td><td>=</td><td>6.37</td><td>1.77</td></tr><tr><td>Fractional Max-Pool (Graham,2014)</td><td>=</td><td>一 1 1</td><td>26.32</td><td>= 一</td><td>1</td><td>3.47</td><td>1</td></tr><tr><td>FitResNet (Mishkin &amp; Matas, 2016)</td><td>=</td><td>一 27.66</td><td></td><td>一 =</td><td>5.84</td><td>=</td><td>1</td></tr><tr><td>ResNet (He et al., 2016a)</td><td>1</td><td>一 -</td><td>=</td><td>=</td><td>1 6.61</td><td>=</td><td>=</td></tr><tr><td>ResNet by (Huang et al., 2016b)</td><td>44.76</td><td>一 27.22</td><td></td><td>13.63</td><td>一 6.41</td><td>=</td><td>2.01</td></tr><tr><td>Stochastic Depth (Huang et al., 2016b)</td><td>37.80</td><td>一 24.58</td><td></td><td>11.66</td><td>一 5.23</td><td></td><td>1.75</td></tr><tr><td>Identity Mapping (He et al.,2016b)</td><td>=</td><td>一 22.68</td><td></td><td></td><td>4.69</td><td></td><td>-</td></tr><tr><td>ResNet in ResNet (Targ et al., 2016)</td><td></td><td>一 22.90</td><td></td><td>=</td><td>5.01</td><td></td><td></td></tr><tr><td>Wide (Zagoruyko &amp; Komodakis, 2016)</td><td>1</td><td>一 20.50 一</td><td></td><td>- 1</td><td>4.17</td><td></td><td>= 1</td></tr><tr><td>DenseNet-BC (Huang et al., 2016a)1</td><td>19.64</td><td>一 17.60</td><td>=</td><td>5.19</td><td>一 3.62</td><td></td><td>1.74</td></tr><tr><td>FractalNet (20 layers, 38.6M params)</td><td>35.34</td><td>一 23.30</td><td>22.85</td><td>10.18 一</td><td></td><td>-</td><td></td></tr><tr><td>+ drop-path + dropout</td><td>28.20</td><td>一 23.73</td><td>23.36</td><td>7.33 一</td><td>5.22 4.60</td><td>5.11</td><td>2.01</td></tr><tr><td>Ldeepest column alone</td><td>29.05</td><td>24.32</td><td>23.60</td><td>7.27</td><td>4.68</td><td>4.59 4.63</td><td>1.87</td></tr><tr><td>FractalNet (40layers,2.9params)</td><td>1</td><td></td><td></td><td></td><td></td><td></td><td>1.89</td></tr><tr><td></td><td></td><td>一 22.49</td><td>21.49</td><td>1</td><td>一 5.24</td><td>5.21</td><td>1</td></tr></table>
109
+
110
+ Table 1: CIFAR-100/CIFAR-10/SVHN. We compare test error $( \% )$ with other leading methods, trained with either no data augmentation, translation/mirroring $( + )$ , or more substantial augmentation $( + + )$ . Our main point of comparison is ResNet. We closely match its benchmark results using data augmentation, and outperform it by large margins without data augmentation. Training with drop-path, we can extract from FractalNet single-column (plain) networks that are highly competitive.
111
+
112
+ # 4 EXPERIMENTS
113
+
114
+ The CIFAR, SVHN, and ImageNet datasets serve as testbeds for comparison to prior work and analysis of FractalNet’s internal behavior. We evaluate performance on the standard classification task associated with each dataset. For CIFAR and SVHN, which consist of $3 2 \times 3 2$ images, we set our fractal network to have 5 blocks $\mathrm { \Delta B = 5 }$ ) with $2 \times 2$ non-overlapping max-pooling and subsampling applied after each. This reduces the input $3 2 \times 3 2$ spatial resolution to $1 \times 1$ over the course of the entire network. A softmax prediction layer attaches at the end of the network. Unless otherwise noted, we set the number of filter channels within blocks 1 through 5 as p64, 128, 256, 512, 512q, mostly matching the convention of doubling the number of channels after halving spatial resolution.
115
+
116
+ For ImageNet, we choose a fractal architecture to facilitate direct comparison with the 34-layer ResNet of He et al. (2016a). We use the same first and last layer as ResNet-34, but change the middle of the network to consist of 4 blocks $B = 4$ ), each of 8 layers $C = 4$ columns). We use a filter channel progression of p128, 256, 512, 1024q in blocks 1 through 4.
117
+
118
+ # 4.1 TRAINING
119
+
120
+ For experiments using dropout, we fix drop rate per block at $0 \%$ , $1 0 \%$ , $2 0 \%$ , $3 0 \%$ , $4 0 \%$ q, similar to Clevert et al. (2016). Local drop-path uses $1 5 \%$ drop rate across the entire network.
121
+
122
+ Table 2: ImageNet (validation set, 10-crop).
123
+
124
+ <table><tr><td>Method</td><td>Top-1 (%)</td><td>Top-5 (%)</td></tr><tr><td>VGG-16</td><td>28.07</td><td>9.33</td></tr><tr><td>ResNet-34 C</td><td>24.19</td><td>7.40</td></tr><tr><td>FractalNet-34</td><td>24.12</td><td>7.39</td></tr></table>
125
+
126
+ <table><tr><td>Model</td><td>Depth</td><td>Train Loss</td><td>Error (%)</td></tr><tr><td>Plain</td><td>5</td><td>0.786</td><td>36.62</td></tr><tr><td>Plain</td><td>10</td><td>0.159</td><td>32.47</td></tr><tr><td>Plain</td><td>20</td><td>0.037</td><td>31.31</td></tr><tr><td>Plain</td><td>40</td><td>0.580</td><td>38.84</td></tr><tr><td>Fractal Col #1</td><td>5</td><td>0.677</td><td>37.23</td></tr><tr><td>Fractal Col #2</td><td>10</td><td>0.141</td><td>32.85</td></tr><tr><td>Fractal Col #3</td><td>20</td><td>0.029</td><td>31.31</td></tr><tr><td>Fractal Col #4</td><td>40</td><td>0.016</td><td>31.75</td></tr><tr><td>Fractal Full</td><td>40</td><td>0.015</td><td>27.40</td></tr></table>
127
+
128
+ Table 3: Ultra-deep fractal networks (CIFAR- $1 0 0 { + + }$ ). Increasing depth greatly improves accuracy until eventual diminishing returns. Contrast with plain networks, which are not trainable if made too deep (Table 4).
129
+
130
+ <table><tr><td>Cols.</td><td>Depth</td><td>Params.</td><td>Error (%)</td></tr><tr><td>1</td><td>5</td><td>0.3M</td><td>37.32</td></tr><tr><td>2</td><td>10</td><td>0.8M</td><td>30.71</td></tr><tr><td>3</td><td>20</td><td>2.1M</td><td>27.69</td></tr><tr><td>4</td><td>40</td><td>4.8M</td><td>27.38</td></tr><tr><td>5</td><td>80</td><td>10.2M</td><td>26.46</td></tr><tr><td>6</td><td>160</td><td>21.1M</td><td>27.38</td></tr></table>
131
+
132
+ Table 4: Fractal structure as a training apparatus (CIFAR- $1 0 0 + +$ ). Plain networks perform well if moderately deep, but exhibit worse convergence during training if instantiated with great depth. However, as a column trained within, and then extracted from, a fractal network with mixed drop-path, we recover a plain network that overcomes such depth limitation (possibly due to a student-teacher effect).
133
+
134
+ We run for 400 epochs on CIFAR, 20 epochs on SVHN, and 70 epochs on ImageNet. Our learning rate starts at 0.02 (for ImageNet, 0.001) and we train using stochastic gradient descent with batch size 100 (for ImageNet, 32) and momentum 0.9. For CIFAR/SVHN, we drop the learning rate by a factor of 10 whenever the number of remaining epochs halves. For ImageNet, we drop by a factor of 10 at epochs 50 and 65. We use Xavier initialization (Glorot & Bengio, 2010).
135
+
136
+ A widely employed (Lin et al., 2013; Clevert et al., 2016; Srivastava et al., 2015; He et al., 2016a;b; Huang et al., 2016b; Targ et al., 2016) scheme for data augmentation on CIFAR consists of only horizontal mirroring and translation (uniform offsets in $[ - 4 , 4 ] )$ , with images zero-padded where needed after mean subtraction. We denote results achieved using no more than this degree of augmentation by appending a $" + "$ to the dataset name (e.g. CIFAR- $1 0 0 +$ ). A $" + + "$ marks results reliant on more data augmentation; here exact schemes may vary. Our entry in this category is modest and simply changes the zero-padding to reflect-padding.
137
+
138
+ # 4.2 RESULTS
139
+
140
+ Table 1 compares performance of FractalNet on CIFAR and SVHN with competing methods. FractalNet (depth 20) outperforms the original ResNet across the board. With data augmentation, our CIFAR-100 accuracy is close to that of the best ResNet variants. With neither augmentation nor regularization, FractalNet’s performance on CIFAR is superior to both ResNet and ResNet with stochastic depth, suggesting that FractalNet may be less prone to overfitting. Most methods perform similarly on SVHN. Increasing depth to 40, while borrowing some parameter reduction tricks (Iandola et al., 2016), reveals FractalNet’s performance to be consistent across a range of configuration choices.
141
+
142
+ Experiments without data augmentation highlight the power of drop-path regularization. On CIFAR100, drop-path reduces FractalNet’s error rate from $3 5 . 3 4 \%$ to $2 8 . 2 0 \%$ . Unregularized ResNet is far behind $( 4 4 . 7 6 \% )$ and ResNet with stochastic depth $( 3 7 . 8 0 \% )$ ) does not catch up to our unregularized starting point of $3 5 . 3 4 \%$ . CIFAR-10 mirrors this story. With data augmentation, drop-path provides a boost (CIFAR-10), or does not significantly influence FractalNet’s performance (CIFAR-100).
143
+
144
+ Note that the performance of the deepest column of the fractal network is close to that of the full network (statistically equivalent on CIFAR-10). This suggests that the fractal structure may be more important as a learning framework than as a final model architecture.
145
+
146
+ Table 2 shows that FractalNet scales to ImageNet, matching ResNet (He et al., 2016a) at equal depth. Note that, concurrent with our work, refinements to the residual network paradigm further improve the state-of-the-art on ImageNet. Wide residual networks (Zagoruyko & Komodakis, 2016) of 34-layers reduce single-crop Top-1 and Top-5 validation error by approximately $2 \%$ and $1 \%$ , respectively, over
147
+
148
+ ![](images/a6248c9240c55983fd50617f4bd57bfcc51f4b9ffadcbc4d3106e909a5485df5.jpg)
149
+ Figure 3: Implicit deep supervision. Left: Evolution of loss for plain networks of depth 5, 10, 20 and 40 trained on CIFAR-100. Training becomes increasingly difficult for deeper networks. At 40 layers, we are unable to train the network satisfactorily. Right: We train a 4 column fractal network with mixed drop-path, monitoring its loss as well as the losses of its four subnetworks corresponding to individual columns of the same depth as the plain networks. As the 20-layer subnetwork starts to stabilize, drop-path puts pressure on the 40-layer column to adapt, with the rest of the network as its teacher. This explains the elbow-shaped learning curve for Col #4 that occurs around 25 epochs.
150
+
151
+ ResNet-34 by doubling feature channels in each layer. DenseNets (Huang et al., 2016a) substantially improve performance by building residual blocks that concatenate rather than add feature channels.
152
+
153
+ Table 3 demonstrates that FractalNet resists performance degradation as we increase $C$ to obtain extremely deep networks (160 layers for $C \ = \ 6$ ). Scores in this table are not comparable to those in Table 1. For time and memory efficiency, we reduced block-wise feature channels to p16, 32, 64, 128, 128q and the batch size to 50 for the supporting experiments in Tables 3 and 4.
154
+
155
+ Table 4 provides a baseline showing that training of plain deep networks begins to degrade by the time their depth reaches 40 layers. In our experience, a plain 160-layer completely fails to converge. This table also highlights the ability to use FractalNet and drop-path as an engine for extracting trained networks (columns) with the same topology as plain networks, but much higher test performance.
156
+
157
+ # 4.3 INTROSPECTION
158
+
159
+ With Figure 3, we examine the evolution of a 40-layer FractalNet during training. Tracking columns individually (recording their losses when run as stand-alone networks), we observe that the 40-layer column initially improves slowly, but picks up once the loss of the rest of the network begins to stabilize. Contrast with a plain 40-layer network trained alone (dashed blue line), which never makes fast progress. The column has the same initial plateau, but subsequently improves after 25 epochs, producing a loss curve uncharacteristic of plain networks.
160
+
161
+ We hypothesize that the fractal structure triggers effects akin to deep supervision and lateral studentteacher information flow. Column #4 joins with column #3 every other layer, and in every fourth layer this join involves no other columns. Once the fractal network partially relies on the signal going through column #3, drop-path puts pressure on column #4 to produce a replacement signal when column #3 is dropped. This task has constrained scope. A particular drop only requires two consecutive layers in column $\# 4$ to substitute for one in column #3 (a mini student-teacher problem).
162
+
163
+ This explanation of FractalNet dynamics parallels what, in concurrent work, Greff et al. (2017) claim for ResNet. Specifically, Greff et al. (2017) suggest residual networks learn unrolled iterative estimation, with each layer performing a gradual refinement on its input representation. The deepest FractalNet column could behave in the same manner, with the remainder of the network acting as a scaffold for building smaller refinement steps by doubling layers from one column to the next.
164
+
165
+ These interpretations appear not to mesh with the conclusions of Veit et al. (2016), who claim that ensemble-like behavior underlies the success of ResNet. This is certainly untrue of some very deep networks, as FractalNet provides a counterexample: we can extract a single column (plain network topology) and it alone (no ensembling) performs nearly as well as the entire network. Moreover, the gradual refinement view may offer an alternative explanation for the experiments of Veit et al. (2016). If each layer makes only a small modification, removing one may look, to the subsequent portion of the network, like injecting a small amount of input noise. Perhaps noise tolerance explains the gradual performance degradation that Veit et al. (2016) observe when removing ResNet layers.
166
+
167
+ # 5 CONCLUSION
168
+
169
+ Our experiments with fractal networks provide strong evidence that path length is fundamental for training ultra-deep neural networks; residuals are incidental. Key is the shared characteristic of FractalNet and ResNet: large nominal network depth, but effectively shorter paths for gradient propagation during training. Fractal architectures are arguably the simplest means of satisfying this requirement, and match residual networks in experimental performance. Fractal networks are resistant to being too deep; extra depth may slow training, but does not impair accuracy.
170
+
171
+ With drop-path, regularization of extremely deep fractal networks is intuitive and effective. Drop-path doubles as a method of enforcing speed (latency) vs. accuracy tradeoffs. For applications where fast responses have utility, we can obtain fractal networks whose partial evaluation yields good answers.
172
+
173
+ Our analysis connects the internal behavior of fractal networks with phenomena engineered into other networks. Their substructure resembles hand-crafted modules used as components in prior work. Their training evolution may emulate deep supervision and student-teacher learning.
174
+
175
+ # ACKNOWLEDGMENTS
176
+
177
+ We gratefully acknowledge the support of NVIDIA Corporation with the donation of GPUs used for this research.
178
+
179
+ # REFERENCES
180
+
181
+ Jimmy Ba and Rich Caruana. Do deep nets really need to be deep? NIPS, 2014.
182
+
183
+ Djork-Arné Clevert, Thomas Unterthiner, and Sepp Hochreiter. Fast and accurate deep network learning by exponential linear units (ELUs). ICLR, 2016.
184
+
185
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. CVPR, 2009.
186
+
187
+ Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. AISTATS, 2010.
188
+
189
+ Benjamin Graham. Fractional max-pooling. arXiv:1412.6071, 2014.
190
+
191
+ Klaus Greff, Rupesh Kumar Srivastava, and Jürgen Schmidhuber. Highway and residual networks learn unrolled iterative estimation. ICLR, 2017.
192
+
193
+ Bharath Hariharan, Pablo Arbelaez, Ross Girshick, and Jitendra Malik. Hypercolumns for object segmentation and fine-grained localization. CVPR, 2015.
194
+
195
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on ImageNet classification. ICCV, 2015.
196
+
197
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CVPR, 2016a.
198
+
199
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. ECCV, 2016b.
200
+
201
+ Geoffrey E. Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. arXiv:1207.0580, 2012.
202
+
203
+ Gao Huang, Zhuang Liu, and Kilian Q. Weinberger. Densely connected convolutional networks. arXiv:1608.06993, 2016a.
204
+
205
+ Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Weinberger. Deep networks with stochastic depth. ECCV, 2016b.
206
+
207
+ Forrest N. Iandola, Matthew W. Moskewicz, Khalid Ashraf, Song Han, William J. Dally, and Kurt Keutzer. SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and ${ < } 1 \mathbf { M } \mathbf { B }$ model size. arXiv:1602.07360, 2016.
208
+
209
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. ICML, 2015.
210
+
211
+ Yangqing Jia, Evan Shelhamer, Jeff Donahue, Sergey Karayev, Jonathan Long, Ross Girshick, Sergio Guadarrama, and Trevor Darrell. Caffe: Convolutional architecture for fast feature embedding. arXiv:1408.5093, 2014.
212
+
213
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
214
+
215
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. ImageNet classification with deep convolutional neural networks. NIPS, 2012.
216
+
217
+ Quoc V Le, Navdeep Jaitly, and Geoffrey E Hinton. A simple way to initialize recurrent networks of rectified linear units. arXiv:1504.00941, 2015.
218
+
219
+ Chen-Yu Lee, Saining Xie, Patrick Gallagher, Zhengyou Zhang, and Zhuowen Tu. Deeply-supervised nets. NIPS Workshop on Deep Learning and Representation Learning, 2014.
220
+
221
+ Chen-Yu Lee, Patrick W Gallagher, and Zhuowen Tu. Generalizing pooling functions in convolutional neural networks: Mixed, gated, and tree. AISTATS, 2016.
222
+
223
+ Ming Liang and Xiaolin Hu. Recurrent convolutional neural network for object recognition. CVPR, 2015.
224
+
225
+ Zhibin Liao and Gustavo Carneiro. Competitive multi-scale convolution. arXiv:1511.05635, 2015.
226
+
227
+ Min Lin, Qiang Chen, and Shuicheng Yan. Network in network. ICLR, 2013.
228
+
229
+ Michael Maire, Stella X. Yu, and Pietro Perona. Reconstructive sparse code transfer for contour detection and semantic labeling. ACCV, 2014.
230
+
231
+ Dmytro Mishkin and Jiri Matas. All you need is a good init. ICLR, 2016.
232
+
233
+ Vinod Nair and Geoffrey E Hinton. Rectified linear units improve restricted boltzmann machines. ICML, 2010.
234
+
235
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y. Ng. Reading digits in natural images with unsupervised feature learning. NIPS Workshop on Deep Learning and Unsupervised Feature Learning, 2011.
236
+
237
+ Behnam Neyshabur, Ruslan Salakhutdinov, and Nathan Srebro. Path-SGD: Path-normalized optimization in deep neural networks. NIPS, 2015.
238
+
239
+ Adriana Romero, Nicolas Ballas, Samira Ebrahimi Kahou, Antoine Chassang, Carlo Gatta, and Yoshua Bengio. Fitnets: Hints for thin deep nets. ICLR, 2015.
240
+
241
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. ICLR, 2015.
242
+
243
+ Jasper Snoek, Oren Rippel, Kevin Swersky, Ryan Kiros, Nadathur Satish, Narayanan Sundaram, Md Patwary, Mostofa Ali, Ryan P Adams, et al. Scalable bayesian optimization using deep neural networks. ICML, 2015.
244
+
245
+ Jost Tobias Springenberg, Alexey Dosovitskiy, Thomas Brox, and Martin Riedmiller. Striving for simplicity: The all convolutional net. ICLR (workshop track), 2014.
246
+
247
+ Rupesh Kumar Srivastava, Klaus Greff, and Jürgen Schmidhuber. Highway networks. ICML, 2015.
248
+
249
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. CVPR, 2015.
250
+
251
+ Sasha Targ, Diogo Almeida, and Kevin Lyman. Resnet in resnet: Generalizing residual architectures. arXiv:1603.08029, 2016.
252
+
253
+ Gregor Urban, Krzysztof J. Geras, Samira Ebrahimi Kahou, Ozlem Aslan, Shengjie Wang, Abdelrahman Mohamed, Matthai Philipose, Matt Richardson, and Rich Caruana. Do deep convolutional nets really need to be deep and convolutional? ICLR, 2017.
254
+
255
+ Andreas Veit, Michael Wilber, and Serge Belongie. Residual networks behave like ensembles of relatively shallow networks. NIPS, 2016.
256
+
257
+ Li Wan, Matthew Zeiler, Sixin Zhang, Yann L Cun, and Rob Fergus. Regularization of neural networks using dropconnect. ICML, 2013.
258
+
259
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. BMVC, 2016.
md/train/S1en0sRqKm/S1en0sRqKm.md ADDED
@@ -0,0 +1,200 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ON THE COMPUTATIONAL INEFFICIENCY OF LARGE BATCH SIZES FOR STOCHASTIC GRADIENT DESCENT
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Increasing the mini-batch size for stochastic gradient descent offers significant opportunities to reduce wall-clock training time, but there are a variety of theoretical and systems challenges that impede the widespread success of this technique (Das et al., 2016; Keskar et al., 2016). We investigate these issues, with an emphasis on time to convergence and total computational cost, through an extensive empirical analysis of network training across several architectures and problem domains, including image classification, image segmentation, and language modeling. Although it is common practice to increase the batch size in order to fully exploit available computational resources, we find a substantially more nuanced picture. Our main finding is that across a wide range of network architectures and problem domains, increasing the batch size beyond a certain point yields no decrease in wall-clock time to convergence for either train or test loss. This batch size is usually substantially below the capacity of current systems. We show that popular training strategies for large batch size optimization begin to fail before we can populate all available compute resources, and we show that the point at which these methods break down depends more on attributes like model architecture and data complexity than it does directly on the size of the dataset.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Mini-batch stochastic gradient descent (SGD) is the dominant optimization method for training deep neural networks (DNNs) (Bengio & LeCun, 2007; Bottou, 2010). In the face of unprecedented growth in dataset size, a large body of work has attempted to scale SGD to train DNN models on increasingly large datasets, while keeping wall-clock time manageable (Iandola et al., 2015; Goyal et al., 2017; Smith & Le, 2018; Devarakonda et al., 2017). The most common approach to train large models at scale is distributed synchronous mini-batch SGD, which exploits additional computational resources through data parallelism. This technique reduces wall-clock training time by increasing the mini-batch size, i.e., the number of examples used to compute a stochastic estimate of the gradient of the loss function at each training iteration, while holding the number of epochs constant. Proponents of large batch size training often argue that the merits stem from its ability to decrease wall-clock training time while maintaining final model performance. Indeed, an enormous amount of work has gone into designing systems that seem to operate under an assumption that equates large batch size training with machine learning at scale (Goyal et al., 2017; Jia et al., 2018; Puri et al., 2018).
12
+
13
+ Increasing the batch size improves the scaling performance of SGD per epoch, and there are significant challenges in building efficient distributed systems that are able to exploit additional computational resources to use large batch sizes (Jia et al., 2018). However, even if we were able to address these systems challenges, there are still more fundamental limitations to this approach. Large batch sizes often negatively impact important performance metrics of interest, including total computational cost (which usually determines monetary cost) and prediction quality.
14
+
15
+ In this paper, we will measure the total computational cost as the number of training iterations times the work done per iteration—in order to simplify measurements, we use the number of training iterations as a proxy for the wall-clock time. We do this because the implementation of parallel algorithms depends on software and hardware choices, and our goal is to draw more general conclusions about the performance of SGD-based methods.
16
+
17
+ Based on this model for total computational cost and wall-clock time, the following should be clear: unless increasing the batch size leads to a commensurate decrease in the total number of training iterations needed to find a good model, large batch training will result in greater total computational cost with little-to-no decrease in wall-clock training time.
18
+
19
+ Based on our empirical results across a range of datasets and architectures, we find that as the batch size becomes larger, there are three main phases of scaling behavior for convergence speed: (1) there is a small regime of batch sizes in which increasing the batch size results in linear gains in convergence speed; (2) there is a larger regime of batch sizes that results in sublinear gains in convergence speed—in this regime, increasing the batch size can improve wall-clock training time at the expense of greater total computational cost; (3) eventually, we reach a third regime where a higher batch size results in marginal or non-existent reductions in convergence speed. In our experiments, we find that this third regime begins at a batch size that is too small to let us fully utilize available compute. Training past this batch size increases the total computational cost without reducing wall-clock training time or prediction quality. While there has been considerable excitement around heuristics that have been shown to make large batch training practical for certain problems (Goyal et al., 2017; Smith & Le, 2018), we demonstrate that these techniques still suffer from the same convergence trends we observe, and they often decrease stability of the training process.
20
+
21
+ Recent work has observed that the final test performance of models trained with large batch sizes degrades after training for a fixed number of epochs (Yao et al., 2018; Keskar et al., 2016). This phenomenon is known as the generalization gap. Previous work addressing this problem has focused on training for more iterations in the large batch case (Hoffer et al., 2017) or adopting various heuristics to select a learning rate for larger batch sizes (Goyal et al., 2017; Smith & Le, 2018). Based on our empirical results, we find that existing techniques to mitigate the generalization gap do not work on some problems, and for other problems they only work for batch sizes that do not allow us to fully utilize our available compute. Perhaps more importantly, they do little to affect the diminishing returns in rates of convergence for training loss as batch size increases.
22
+
23
+ Our objective is to understand the behavior of SGD and existing large batch techniques for many network architectures and problem domains, e.g., image classification/segmentation and natural language processing (NLP). We observe markedly worse performance for these techniques in domains other than image classification, where large batch optimization has received the most attention (Jia et al., 2018; You et al., 2017b). Because we eschew the challenges of an efficient distributed implementation by measuring number of iterations instead of wall-clock time, our results assume the most optimistic circumstances for large batch training. Our key observations are:
24
+
25
+ • Increasing the batch size beyond a certain point yields no improvement in wall-clock time to convergence, even for a system with perfect parallelism. We observe that larger batch sizes result in a limited reduction in the number of training iterations needed to achieve low training or test error, and that eventually these gains become near-zero. Increasing the batch size leads to a significant increase in generalization error, which cannot be mitigated by existing techniques. We observe that these techniques often result in divergent training behavior or that they only mitigate degradation in test performance for small batch sizes relative to available compute. Dataset size is not the only factor determining the computational efficiency of large batch training. We observe that both the diminishing returns in convergence speed and the failure of existing methods correlate more with factors like model architecture and data complexity than dataset size alone. As a result, training time may significantly increase with dataset size in spite of increasingly available compute resources.
26
+
27
+ In Section 2, we review the formulation of SGD as well as existing strategies to train with large batch sizes. In Section 3, we review recent theoretical results regarding the convergence rates of SGD in highly over-parameterized settings and discuss the potential impact of these results on the computational efficiency of SGD for deep learning. Section 4 presents our empirical results that demonstrate the inefficiencies of training SGD with large batch sizes, and we show that these persist when using existing large batch optimization techniques.
28
+
29
+ # 2 BACKGROUND AND RELATED WORK
30
+
31
+ Stochastic Gradient Descent. SGD is the most widely used algorithm to train DNN models. The model is parameterized by weights $\mathbf { w } \in \mathbb { R } ^ { d }$ , and the objective is to minimize the empirical loss over $n$ data points $\mathbf { x } _ { i }$ :
32
+
33
+ $$
34
+ L ( \mathbf { w } ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell ( \mathbf { w } , \mathbf { x } _ { i } ) ,
35
+ $$
36
+
37
+ where $\ell ( \cdot , \cdot )$ is a loss, e.g., cross-entropy or squared error. This loss gives a corresponding gradient
38
+
39
+ $$
40
+ \mathbf { g } ( \mathbf { w } ) : = \nabla L ( \mathbf { w } ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \nabla \ell ( \mathbf { w } , \mathbf { x } _ { i } ) .
41
+ $$
42
+
43
+ A mini-batch $B _ { m }$ of size $m < n$ is a collection of $m$ indices randomly drawn from the set $\{ 1 , \ldots , n \}$ , and we can use it to form an unbiased estimate of the gradient at iteration $k$ , as well as the corresponding SGD update:
44
+
45
+ $$
46
+ \mathbf { g } _ { m } ( \mathbf { w } _ { k } ) = \frac { 1 } { m } \sum _ { i \in \mathcal { B } _ { m } } \nabla \ell ( \mathbf { w } _ { k } , \mathbf { x } _ { i } ) \quad \mathrm { ~ a n d ~ } \quad \mathbf { w } _ { k + 1 } = \mathbf { w } _ { k } - \eta _ { k } \mathbf { g } _ { m } ( \mathbf { w } _ { k } ) ,
47
+ $$
48
+
49
+ where $\eta _ { k } > 0$ is the learning rate for iteration $k$ . One iteration of training for SGD corresponds to a single gradient computation / weight update. One epoch corresponds to $n / m$ iterations of training. This constitutes a single pass over the dataset, assuming the dataset is sampled without replacement.
50
+
51
+ Efficient distributed systems reduce wall-clock training time by parallelizing gradient calculations across many machines. When the batch size is large enough to populate all available compute resources, this allows us to amortize the cost of coordination for each weight update.
52
+
53
+ Existing large batch techniques. With the hope of keeping training times manageable as dataset sizes escalate, recent work has focused on the development of techniques that allow practitioners to increase the batch size to make use of growing computational resources (Jin et al., 2016; Jia et al., 2018; You et al., 2017a). However, there is a growing body of theoretical and empirical results suggesting that large batch sizes adversely affect the generalization performance of the final model (Yao et al., 2018; Keskar et al., 2016; Devarakonda et al., 2017).
54
+
55
+ In response to this, recent work has proposed changing two parameters in relation to batch size: the number of training iterations and the learning rate. However, they also make assumptions that limit the effectiveness of their proposals as useful heuristics for practitioners.
56
+
57
+ • Training longer: Hoffer et al. (2017) suggest increasing the number of training iterations. Even if this does reduce the generalization gap, it significantly increases both wall-clock training time and computational cost. Moreover, in some problems it does not lead to minima with better generalization performance (as we found when running our experiments). • Square root LR scaling: Scaling the learning rate as $\eta _ { 0 } \propto \sqrt { m }$ attempts to keep the weight increment length statistics constant, but the distance between SGD iterates is governed more by properties of the objective function than the ratio of learning rate to batch size (Chaudhari & Soatto, 2017; Zhu et al., 2018). This rule has also been found to be empirically sub-optimal in various problem domains (Krizhevsky, 2014). Linear LR scaling: The performance of large batch training can also be improved by using the linear scaling rule, which suggests choosing a learning rate proportional to the batch size $( \eta _ { 0 } \propto m )$ (Goyal et al., 2017). There are two motivations for this rule: the first assumes that one large-batch gradient step should resemble a series of small-batch gradient steps in order for convergence rates to improve linearly (Goyal et al., 2017); the other regards the SGD update equation as the Euler-Maruyama discretization of a stochastic differential equation (Sauer, 2012; Xing et al., 2018), and attempts to maintain a constant level of minibatch noise to help SGD explore the loss landscape (Chaudhari & Soatto, 2017; Zhu et al., 2018; Smith & Le, 2018).
58
+
59
+ Both justifications for the linear scaling rule implicitly impose strong conditions on the loss function by requiring that it behave linearly near SGD iterates; therefore, if the loss function is highly nonlinear along the SGD trajectory or the step size is not small enough, then we should not expect these rules to provide useful guidance for many problems. Whereas several groups have successfully used this rule to train on the ImageNet dataset in under an hour, e.g. (Goyal et al., 2017; You et al., 2017b), applying this heuristic to other datasets has not led to similarly impressive results so far (Puri et al., 2018).
60
+
61
+ The focus of this paper, however, is on more fundamental limitations of large batch training, and we empirically show that the above approaches fail to prevent diminishing returns in the rate of convergence for large batch sizes. We believe that these diminishing returns are of more immediate concern than the generalization gap and warrant more careful examination: if we cannot even minimize training error quickly, there is no real opportunity to minimize test error quickly, regardless of the difference in final test error across batch sizes by the time the model has converged.
62
+
63
+ # 3 CRITICAL BATCH SIZES AND DIMINISHING RETURNS
64
+
65
+ The convergence rate of SGD, denoted by $k _ { \epsilon } ( m )$ , is the number of iterations needed to achieve training error less than a fixed constant $\epsilon > 0$ by using SGD with batch size $m$ (we will drop the subscript $\epsilon$ when it is unambiguous). In order to guarantee that large batch sizes speed up training, $k ( m )$ should continue to decrease near-linearly with $m$ . Otherwise, a larger batch size increases computational cost with only limited reductions in wall-clock training time. For near-constant $k ( m )$ , the benefit of large batch sizes becomes near-zero.
66
+
67
+ Ma et al. (2017) showed theoretically that in convex, over-parameterized settings, the reduction in convergence time obtained by increasing the batch size decays dramatically to a near-constant level after a critical batch size that is independent of the dataset size. This speedup is measured with respect to the number of SGD iterations required to reach some fixed loss error for some baseline batch size $m _ { 0 }$ , and for this purpose we define the speedup ratio $s ( m ; m _ { 0 } ) = k ( m _ { 0 } ) / k ( m )$ . The speedup ratio represents the amount of time we save by increasing the batch size to $m$ . Beyond the critical batch size mentioned above, even with no communication overhead and unlimited resources (where each batch size requires the same amount of wall-clock time to process) we would prefer to use the critical batch size because it requires less overall computation.
68
+
69
+ This result is surprising because researchers have asserted that it should be possible to achieve linear gains in convergence speed so long as the batch size is small relative to dataset size (Smith & Le, 2018). This will present significant difficulties for future optimization work (large mini-batch training) because it prevents us from using large batch sizes as a catch-all approach to quickly train models on large datasets.
70
+
71
+ # 4 EMPIRICAL EVALUATION
72
+
73
+ Recent work studying large batch training has looked primarily at image classification (Jastrzebski et al., 2018; Yao et al., 2018), especially on the ImageNet dataset (Deng et al., 2009). We perform large batch size experiments across both traditional image classification (IC) tasks (such as on CIFAR-10/100 (Krizhevsky & Hinton, 2009)), as well as previously unexplored tasks like image segmentation (IS) using the Cityscapes dataset (Cordts et al., 2016), and natural language processing (NLP) using the WikiText-2 dataset (Merity et al., 2016). We also test how these results vary across other modern DNN architectures, namely ResNets (He et al., 2016), LSTMs (Hochreiter & Schmidhuber, 1997; Gers et al., 2000), AlexNet (Krizhevsky et al., 2012), VGG (Simonyan & Zisserman, 2014), Dilated Residual Networks (Yu et al., 2017), and MobileNetV2 (Sandler et al., 2014). We tested all of the large batch training techniques described in Section 2. We tried training longer based on the work of Hoffer et al. (2017), but we found that this necessarily cannot improve the convergence speed and often does not improve final test performance. The two other techniques include the square root scaling rule strategy (SRSR) and the linear scaling rule strategy (LSR). For the latter, we used a warm-up period at the start of training as suggested by Goyal et al. (2017). Table 1 reports our datasets, models and different training strategies. For each model, we evaluated against a base learning rate strategy (BLR) that used the same learning rate across all batch sizes. We selected this learning rate based on its performance on a small baseline batch size.
74
+
75
+ ![](images/b45c386a5ec3b1dee617dd3ed5dfe50c26a309dd84ec1efd0f4dcdac283a893c.jpg)
76
+ Figure 1: Contour plots of training losses for various problem domains on a log scale. Lighter colors indicate lower loss values. Since we train each batch size for a fixed number of epochs, the total number of training iterations scales down linearly. For each loss value, we can observe how many iterations it takes to converge to that value given a particular batch size, by tracing the level curve for the associated color. For all problems, there is a batch size after which the number of training iterations necessary to converge does not decrease.
77
+
78
+ # 4.1 DIMINISHING RETURNS IN RATES OF CONVERGENCE
79
+
80
+ We demonstrate the rapidly diminishing returns in rates of convergence across various problem domains and network configurations. Researchers increase the batch size in an attempt to achieve nearly linear speedups in convergence compared to a small mini-batch size. In particular, if the speedup is near-linear, i.e. $s ( m ; \bar { m } _ { 0 } ) = k ( \bar { m } _ { 0 } ) / k ( m ) \approx m / m _ { 0 }$ , then the computational cost remains nearly constant for large and small mini-batch SGD. However, if $s ( m ) \ \bar { \ll } \ m / m _ { 0 }$ , then the benefit of using large batch size training is negligible.
81
+
82
+ In Figure 1, we show contour plots of training loss as a function of both the batch size and the number of training iterations of ResNet34 on CIFAR-10, an LSTM on WikiText-2, and DRN-D-22 on Cityscapes. Consider, for example, the contour plot for ResNet34 trained on CIFAR-10. We can see that as the batch size increases from 16 to 2048, the number of SGD iterations needed to achieve a particular loss value decreases linearly. Exceeding this regime, however, the speedup ratio becomes increasingly sublinear and soon we have $s ( m ; \bar { m _ { 0 } } ) \ll \bar { m } / m _ { 0 }$ . For batch size 8196, the training procedure does not achieve the lowest training loss, and from this perspective, even if we did not care about computational cost or training time, we would not be able to find an accurate model. We observe even worse scaling behavior for test performance (please see Figure 5 for details).
83
+
84
+ Table 1: A description of the problem configurations and training strategies used in this paper. $\eta _ { 0 }$ is the initial learning rate, $W$ is the number of epochs used for warm-up in the linear scaling rule, $E$ is the total number of epochs trained
85
+
86
+ <table><tr><td>Dataset</td><td>Task</td><td>Architecture</td><td>Training Strategy</td><td>BS range</td></tr><tr><td> MNIST</td><td>IC</td><td>ResNet34</td><td>BLR,LSR (no = 0.1, W = 10, E = 200)</td><td>26 -214</td></tr><tr><td>CIFAR-10</td><td>IC</td><td>AlexNet, MobileNetV2 ResNet34, VGG16</td><td>BLR,LSR, SRSR (mo = 0.1,W=10,E= 200)</td><td>26-214</td></tr><tr><td>CIFAR-100</td><td>IC</td><td>ResNet34</td><td>BLR,LSR (no = 0.1,W = 10, E = 200)</td><td>2 -214</td></tr><tr><td>SVHN</td><td>IC</td><td>ResNet34</td><td>BLR,LSR (no =0.1,W =10,E= 200)</td><td>26-214</td></tr><tr><td> WikiText-2</td><td> NLP</td><td>LSTM</td><td>BLR,LSR (no = 20,W = 3,E = 40)</td><td>2³ -210</td></tr><tr><td>Cityscapes</td><td>IS</td><td>DRN-D-22</td><td>BLR,LSR (no = 0.01,W = 10,E= 100)</td><td>23 -211</td></tr></table>
87
+
88
+ ![](images/2f39da181bbafada9ee2bf61d16e3221282ee2f410345f6758d773bf18d978e5.jpg)
89
+ Figure 2: On the left: speedup curves when applying several popular techniques to avoid the generalization gap. Base LR uses a single learning rate for all batch sizes. On the right: the effect of the linear approximation error on final test accuracy when using the linear LR scaling rule.
90
+
91
+ For NLP and IS, note that the gain from large batch training diminishes even faster. Neither the LSTM on WikiText-2 nor DRN-D-22 on Cityscapes can reach their respective baseline performances after reasonably small batch sizes of about 32 and 64, respectively. Although Puri et al. (2018) showed that training on the Amazon Reviews dataset (McAuley et al., 2015) can be done within 4 hours, they tune hyper-parameters heavily. This poses an issue for many practical deployments because these problems are often already slow to train.
92
+
93
+ # 4.2 EXISTING STRATEGIES BREAK DOWN FOR LARGE BATCH SIZES
94
+
95
+ We further explore how training with the linear and square root scaling rules compares to training with a fixed baseline learning rate (BLR) that does not change with batch size. In the left subfigure of Figure 2, we show the speedup curves of BLR, LSR, and SRSR strategies for ResNet34 on CIFAR10. Note that LSR and SRSR outperform BLR from batch size 256 to 2048 which implies that LSR and SRSR can help the model train for small-to-medium batch sizes. However, the speedup of LSR and SRSR is still worse than the ideal linear case, and the curves plateau quickly after a batch size of 2048, at which point BLR becomes better than LSR and SRSR. This means that for certain problems, scaling up the learning rate to compensate for an increased batch size hurts performance.
96
+
97
+ In the right subfigure of Figure 2, we plot the test performance and the approximation error for LSR of ResNet34 on CIFAR-10. We measure the approximation error at the end of training, with final weights $\mathbf { w } ^ { * }$ . We take this error to be the absolute difference between the true loss value $L ( \mathbf { w } )$ and the linear approximation at $\mathbf { w } ^ { * }$ , given by $\hat { L } ( \mathbf { w } ) = L ( \mathbf { w } ^ { * } ) + \langle \mathbf { g } _ { m } ( \mathbf { w } ^ { * } ) , \mathbf { w } - \mathbf { w } ^ { * } \rangle$ . The approximation is calculated for $\mathbf { w } = \mathbf { w } ^ { * } - \eta \frac { m } { m _ { 0 } } \mathbf { g } _ { m } \big ( \mathbf { w } ^ { * } \big )$ to understand the behavior of the approximation along the trajectory for a single SGD iterate using the LSR. It appears that there exists a strong relationship between linear approximation error and test accuracy: as the linear approximation error increases, the test accuracy drops. Note the transition that happens at the critical batch size of 2048. After this point, the test accuracy drops significantly and the linear approximation error exceeds 1, showing that we quickly exit the regime in which the linear approximation is valid.
98
+
99
+ ![](images/8e5a9c2868609d6811e018f9aa938f74636a8e7c872b18be0773d9a10cb99683.jpg)
100
+ Figure 3: Speedup curves across different problem configurations. Left: different architectures result in different rates of convergence on CIFAR-10. Right: ResNet34 exhibits different rates of convergence on CIFAR-10, CIFAR-100, and SVHN. Loss thresholds are obtained by computing the lower quartile of loss values achieved by the largest batch size.
101
+
102
+ # 4.3 CONVERGENCE SPEED HAS A WEAK DEPENDENCE ON DATASET SIZE
103
+
104
+ Previous works have conjectured that the maximum batch size that can result in a good model is proportional to the size of the whole dataset (Smith et al., 2017; Smith & Le, 2018). However, for convex, over-parameterized problems, Ma et al. (2017) show that there is a model-dependent critical batch size after which we observe rapidly diminishing returns in convergence speed. In this section, to observe if a similar critical batch size exists in the non-convex case, we compare how changing model architecture or data complexity affects the shapes of speedup curves compared to changing the dataset size alone.
105
+
106
+ First, in order to show that these diminishing returns depend on data complexity and DNN architecture, we plot speedup curves in Figure 3 to compare the scaling behaviors across different models and dataset configurations. For the error threshold , we chose the lowest quartile loss value reached by the largest batch size to make a fair comparison across configurations. This setup actually favors the large batch case, because there are lower loss thresholds that are attainable only in the small batch case. On the left, for the CIFAR-10 dataset, we compared four model architectures. For each architecture, we plotted the speedup curve obtained by training this model on the dataset for various batch sizes. The variety of speedup curve shapes indicates that model architecture is an important factor in determining the convergence speed of training for large batch sizes. For MobileNetV2/AlexNet, the diminishing returns become visible when batch size is 1024. However, for VGG16/ResNet34, the speedup does not flatten out until batch size 8196. Hence, in practice, the choice of model strongly affects our ability to use large batch sizes in SGD.
107
+
108
+ On the right, in order to investigate the effect of problem complexity, we compared the performance of ResNet34 on four datasets of the same size: CIFAR-10, CIFAR-100, MNIST, and the SVHN dataset (we cut off MNIST and SVHN to $5 0 k$ training examples each). Although all problems display diminishing returns in rates of convergence, the point at which the curves plateau varies according to problem complexity. It is not hard to see that, for simpler problems such as SVHN, the curves flatten out later than for harder problems (e.g. CIFAR-10/100).
109
+
110
+ In all of the above cases, the diminishing rates of return in convergence speed become visible after only moderate increases in the batch size. Previous works have only studied convergence behavior for a fairly limited range of batch sizes (e.g., up to 4096 for CIFAR-10) (Hoffer et al., 2017; Keskar et al., 2016). By increasing the batch size past this point, it becomes immediately apparent that the primary issue with large batch size optimization is training speed, not the generalization gap.
111
+
112
+ ![](images/96bab39fb3c982480548f52bd526a04980c2093b687c837893866a29eef23e63.jpg)
113
+ Figure 4: Speedup curves as dataset size varies for different datasets. Even as dataset size increases back up to the baseline of $1 0 0 \%$ , there is no noticeable improvement in convergence speed.
114
+
115
+ In order to test whether the sublinear behavior of $s ( m ; m _ { 0 } )$ depends primarily on dataset size, we compare the speedup curves obtained when training a single model on different fractions of the original training data. We trained ResNet34 models on the CIFAR-10 and SVHN datasets (for SVHN in this experiment, we train on all $6 0 0 k$ available training images). For each dataset, we trained on $1 0 0 \%$ , $5 0 \%$ , and then $2 5 \%$ of the available training data.
116
+
117
+ In Figure 4, we plot the resulting speedup curves for the various partitions. In order to maintain a fair comparison (as baseline loss values change for different dataset sizes), we again choose the loss threshold to be the lower quartile of loss values obtained by the largest batch size.1 Notably, the batch size at which the curves begin to plateau remains constant as dataset size changes. For ResNet34 on CIFAR-10, the linear speedup behavior breaks around batch size 128 for all three curves. By a batch size of 1024, all curves have flattened. We can see similar behavior for ResNet34 on SVHN. Overall, looking back to Figure 3, the choice of model and the complexity of the dataset appear to be more related to the shape of speedup curve than dataset size alone.
118
+
119
+ # 5 CONCLUSION
120
+
121
+ By experimenting across a wide range of network architectures and problem domains, we find that, after a certain point, increasing the batch size fails to decrease wall-clock time to convergence and results in low computational efficiency, even assuming perfect parallelism. The critical batch size after which these returns diminish tends to be small relative to existing system capabilities. These trends present impediments to progress in developing effective machine learning systems that are capable of handling growing data demands.
122
+
123
+ Recent works also suggest heuristics to decrease the generalization gap, but we find that these heuristics cannot be used to solve the underlying issue of training convergence speed. Moreover, we find that they usually only help decrease the generalization error in a small-to-medium batch size regime. There does not seem to be a simple training heuristic to improve large batch performance in general.
124
+
125
+ These results suggest that we should not assume that increasing the batch size for larger datasets will keep training times manageable for all problems. Even though it is a natural form of data parallelism for large-scale optimization, alternative forms of parallelism should be explored to utilize all of our data more efficiently.
126
+
127
+ # REFERENCES
128
+
129
+ Yoshua Bengio and Yann LeCun. Scaling Learning Algorithms Towards AI. In Large Scale Kernel Machines. MIT Press, 2007.
130
+
131
+ Leon Bottou. Large-scale machine learning with stochastic gradient descent. In ´ Proceedings of COMPSTAT’2010, pp. 177–186. Springer, 2010.
132
+
133
+ Pratik Chaudhari and Stefano Soatto. Stochastic gradient descent performs variational inference, converges to limit cycles for deep networks. arXiv:1710.11029, 10 2017.
134
+
135
+ Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The Cityscapes Dataset for Semantic Urban Scene Understanding. In Proc. of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
136
+
137
+ Dipankar Das, Sasikanth Avancha, Dheevatsa Mudigere, Karthikeyan Vaidyanathan, Srinivas Sridharan, Dhiraj D. Kalamkar, Bharat Kaul, and Pradeep Dubey. Distributed Deep Learning Using Synchronous Stochastic Gradient Descent. arXiv:1602.06709, 2016.
138
+
139
+ 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.
140
+
141
+ Aditya Devarakonda, Maxim Naumov, and Michael Garland. AdaBatch: Adaptive Batch Sizes for Training Deep Neural Networks. arXiv:1712.02029, 2017.
142
+
143
+ Felix A. Gers, Jurgen A. Schmidhuber, and Fred A. Cummins. Learning to Forget: Continual ¨ Prediction with LSTM. Neural Computing, 12(10):2451–2471, 10 2000.
144
+
145
+ Priya Goyal, Piotr Dollar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, An-´ drew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch SGD: training ImageNet in 1 hour. arXiv:1706.02677, 2017.
146
+
147
+ 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.
148
+
149
+ Sepp Hochreiter and Jurgen Schmidhuber. Long Short-Term Memory. ¨ Neural Computing, 9(8): 1735–1780, 11 1997.
150
+
151
+ Elad Hoffer, Itay Hubara, and Daniel Soudry. Train longer, generalize better: closing the generalization gap in large batch training of neural networks. In Advances in Neural Information Processing Systems, pp. 1731–1741, 2017.
152
+
153
+ Forrest N. Iandola, Khalid Ashraf, Matthew W. Moskewicz, and Kurt Keutzer. FireCaffe: near-linear acceleration of deep neural network training on compute clusters. arXiv:1511.00175, 11 2015.
154
+
155
+ Stanislaw Jastrzebski, Zachary Kenton, Devansh Arpit, Nicolas Ballas, Asja Fischer, Yoshua Bengio, and Amos J. Storkey. Three Factors Influencing Minima in SGD. arXiv:1711.04623, 11 2018.
156
+
157
+ Xianyan Jia, Shutao Song, Wei He, Yangzihao Wang, Haidong Rong, Feihu Zhou, Liqiang Xie, Zhenyu Guo, Yuanzhou Yang, Liwei Yu, Tiegang Chen, Guangxiao Hu, Shaohuai Shi, and Xiaowen Chu. Highly Scalable Deep Learning Training System with Mixed-Precision: Training ImageNet in Four Minutes. arXiv:1807.11205, 07 2018.
158
+
159
+ Peter H. Jin, Qiaochu Yuan, Forrest N. Iandola, and Kurt Keutzer. How to scale distributed deep learning? arXiv:1611.04581, 11 2016.
160
+
161
+ Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. arXiv:1609.04836, 2016.
162
+
163
+ Alex Krizhevsky. One weird trick for parallelizing convolutional neural networks. arXiv:1404.5997, 04 2014.
164
+
165
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
166
+
167
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. ImageNet Classification with Deep Convolutional Neural Networks. In Proceedings of the 25th International Conference on Neural Information Processing Systems - Volume 1, NIPS’12, pp. 1097–1105. Curran Associates Inc., 2012.
168
+
169
+ Siyuan Ma, Raef Bassily, and Mikhail Belkin. The Power of Interpolation: Understanding the Effectiveness of SGD in Modern Over-parametrized Learning. arXiv:1712.06559, 2017.
170
+
171
+ Julian McAuley, Christopher Targett, Qinfeng Shi, and Anton van den Hengel. Image-Based Recommendations on Styles and Substitutes. In Proceedings of the 38th International ACM SIGIR Conference on Research and Development in Information Retrieval, SIGIR ’15, pp. 43–52. ACM, 2015.
172
+
173
+ Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer Sentinel Mixture Models. arXiv:1609.07843, 09 2016.
174
+
175
+ Raul Puri, Robert Kirby, Nikolai Yakovenko, and Bryan Catanzaro. Large Scale Language Modeling: Converging on 40GB of Text in Four Hours. arXiv:1808.01371, 08 2018.
176
+
177
+ Mark Sandler, Andrew G. Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Very Deep Convolutional Networks for Large-Scale Image Recognition. arXiv:1801.04381, 09 2014.
178
+
179
+ Timothy Sauer. Numerical solution of stochastic differential equations in finance. In Handbook of computational finance, pp. 529–550. Springer, 2012.
180
+
181
+ Karen Simonyan and Andrew Zisserman. Very Deep Convolutional Networks for Large-Scale Image Recognition. arXiv:1409.1556, 09 2014.
182
+
183
+ Samuel L. Smith and Quoc V. Le. A Bayesian Perspective on Generalization and Stochastic Gradient Descent. In International Conference on Learning Representations, 2018.
184
+
185
+ Samuel L Smith, Pieter-Jan Kindermans, and Quoc V Le. Don’t Decay the Learning Rate, Increase the Batch Size. arXiv:1711.00489, 2017.
186
+
187
+ Chen Xing, Devansh Arpit, Christos Tsirigotis, and Yoshua Bengio. A Walk with SGD. arXiv:1802.08770, 2018.
188
+
189
+ Zhewei Yao, Amir Gholami, Qi Lei, Kurt Keutzer, and Michael W Mahoney. Hessian-based Analysis of Large Batch Training and Robustness to Adversaries. arXiv:1802.08241, 2018.
190
+
191
+ Yang You, Igor Gitman, and Boris Ginsburg. Large Batch Training of Convolutional Networks. arXiv:1708.03888, 2017a.
192
+
193
+ Yang You, Zhao Zhang, Cho-Jui Hsieh, and James Demmel. 100-epoch ImageNet Training with AlexNet in 24 Minutes. arXiv:1709.05011, 2017b.
194
+
195
+ Fisher Yu, Vladlen Koltun, and Thomas Funkhouser. Dilated Residual Networks. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 636–644, 07 2017.
196
+
197
+ Zhanxing Zhu, Jingfeng Wu, Bing Yu, Lei Wu, and Jinwen Ma. The Anisotropic Noise in Stochastic Gradient Descent: Its Behavior of Escaping from Minima and Regularization Effects. arXiv:1803.00195, 2018.
198
+
199
+ ![](images/e2d22d36762c86eb7114a858df3deb4cc64fe830391fe3ba4a35dd5954e98afa.jpg)
200
+ Figure 5: Contour plots of test losses for various problem domains on a log scale. The test losses for BLR are on the left, while the losses for the LSR strategy are on the right. Lighter colors indicate lower loss values. Since we train each batch size for a fixed number of epochs, the total number of training iterations scales down linearly. For each loss value, we can observe how many iterations it takes to converge to that value given a particular batch size, by tracing the level curve for the associated color. For all problems, there is a batch size after which the number of training iterations necessary to converge does not decrease.
md/train/S1gd7nCcF7/S1gd7nCcF7.md ADDED
@@ -0,0 +1,229 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SELF-SUPERVISED GENERALISATION WITH META AUXILIARY LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Auxiliary learning has been shown to improve the generalisation performance of a principal task. But typically, this requires manually-defined auxiliary tasks based on domain knowledge. In this paper, we consider that it may be possible to automatically learn these auxiliary tasks to best suit the principal task, towards optimum auxiliary tasks without any human knowledge. We propose a novel method, Meta Auxiliary Learning (MAXL), which we design for the task of image classification, where the auxiliary task is hierarchical sub-class image classification. The role of the meta learner is to determine sub-class target labels to train a multi-task evaluator, such that these labels improve the generalisation performance on the principal task. Experiments on three different CIFAR datasets show that MAXL outperforms baseline auxiliary learning methods, and is competitive even with a method which uses human-defined sub-class hierarchies. MAXL is self-supervised and general, and therefore offers a promising new direction towards automated generalisation.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Auxiliary learning is a method to improve the generalisation of a task. It works by training on additional auxiliary tasks simultaneously with the principal task. Extra data may be available for those auxiliary tasks, but not the principal task. If the auxiliary tasks and the principal task share some common reasoning, then the prediction model is encouraged to learn additional relevant features which otherwise would not be learned from single-task learning. The broader support of these features then assists with generalisation of the principal task.
12
+
13
+ We now rethink this generalisation by considering that not all auxiliary tasks are created equal. In supervised auxiliary learning (Liebel & Korner, 2018; Toshniwal et al., 2017), auxiliary tasks can be ¨ carefully chosen to complement the principal task, but at the expense of a dependency on labelled data. Unsupervised auxiliary learning (Flynn et al., 2016; Zhou et al., 2017; Zhang et al., 2018; Jaderberg et al., 2017) alleviates this, but at the expense of a limited set of auxiliary tasks which may not be well aligned with the principal task. By combining the merits of both supervised and unsupervised auxiliary learning, the ideal auxiliary learning framework is one with the flexibility to automatically determine the optimum auxiliary tasks, but without the requirement of any manuallylabelled data.
14
+
15
+ In this paper, we propose to achieve such a framework with a simple and general meta-learning algorithm which we call Meta AuXiliary Learning (MAXL). Given a principal task, the goal of MAXL is to discover the auxiliary tasks which, when trained alongside the principal task, give the greatest generalisation performance of the principal task on a meta dataset. In our work, we focus on the problem of image classification, where an auxiliary task is required to assign a sub-class label to an image. As such, data is classified both at a coarse level as the principal task, and at a fine level as the auxiliary task. The meta learner’s role is then to determine the target labels for this sub-class labelling, in such a way that the learned features induced by learning these additional, more complex auxiliary tasks generate the best generalisation performance for the principal task.
16
+
17
+ As well as our method being able to automatically learn the optimum auxiliary tasks, we achieve this in an unsupervised manner, giving potential to scale well beyond any datasets without manuallylabelled auxiliary tasks, such as a class hierarchy as in our experiments. And even when such a hierarchy is available, in our experiments we show that MAXL is at least as competitive despite this hierarchy being learned in an unsupervised manner. In our experiments, we define the auxiliary tasks as sub-class labelling with MAXL learning to generate target sub-class labels, but MAXL is general and in future work this could be relaxed to actually learn the auxiliary tasks themselves. The ability to learn these tasks in a purely unsupervised and scalable manner opens up an exciting new way of thinking about how we can achieve generalisation in an automated manner.
18
+
19
+ ![](images/9be7e47f76a69d61e122286e9e1ded5295110c346ed9a4f5ad2eac73b4c4eaa3.jpg)
20
+ Figure 1: Illustration of our proposed MAXL framework. The Multi-task evaluator takes an input image and is trained to predict both the principal class (e.g. Dog), and the auxiliary class (e.g. Border Collie). The principal class has a ground-truth label, but the label for the auxiliary class is determined by the meta generator. The meta generator is trained by outputting auxiliary class labels which, when used to train the multi-task evaluator, improve its prediction performance on the principal task.
21
+
22
+ # 2 RELATED WORK
23
+
24
+ This work brings ideas together from a number of related areas of machine learning.
25
+
26
+ Multi-task & Transfer Learning The aim of multi-task learning (MTL) is to achieve shared representations by simultaneously training a set of related learning tasks. In this case, the learned knowledge used to share across domains is encoded into the feature representations, to improve performance of each individual task, since knowledge distilled from related tasks are interdependent. The success of deep neural networks has led to some recent methods advancing the multi-task architecture design, such as applying a linear combination of task-specific features (Misra et al., 2016; Doersch & Zisserman, 2017; Kokkinos, 2017). Liu et al. (2018) applied soft-attention modules as feature selectors, allowing learning of both task-shared and task-specific features in a selfsupervised, end-to-end manner. Transfer learning is another common approach to improve generalisation, by incorporating knowledge learned from one or more related domains. Pre-training a model with a large-scale dataset such as ImageNet (Deng et al., 2009) has become standard practise in many vision-based applications. The transferability of different convolutional layers in CNNs has also been investigated in Yosinski et al. (2014).
27
+
28
+ Auxiliary Learning Whilst in multi-task learning the goal is high test accuracy across all tasks, auxiliary learning differs in that high test accuracy is only required for a single principal task, and the role of the auxiliary tasks is to assist in generalisation of this principal task. Toshniwal et al. (2017) applied auxiliary supervision with phoneme recognition at intermediate low-level representations of deep networks to improve the performance of conversational speech recognition. Liebel & Korner ¨ (2018) chose auxiliary tasks which can be obtained with low effort, such as global descriptions of a scene, to boost the performance for single scene depth estimation and semantic segmentation. By carefully choosing a pair of learning tasks, we may also perform auxiliary learning without ground truth labels, in an unsupervised manner. Jaderberg et al. (2017) introduced a method for improving the learning agents in Atari games, by building unsupervised auxiliary tasks to predict the onset of immediate rewards from a short historical context. Flynn et al. (2016); Zhou et al. (2017) proposed image synthesis networks to perform unsupervised monocular depth estimation by predicting the relative pose of multiple cameras. Different from these works which require prior knowledge to manually define suitable auxiliary tasks, our proposed method requires no additional task knowledge, since our meta learner generates useful auxiliary knowledge in a purely unsupervised fashion. The most similar work to ours is Zhang et al. (2018), in which meta learning was used in auxiliary data selection. However, this still requires manually-labelled data from which these selections are made, whilst our method is able to generate auxiliary data from scratch.
29
+
30
+ Meta Learning Meta learning (or learning to learn) aims to design a higher-level learning system which itself is trained using the experiences of a lower-level learning system, in an attempt to improve this lower-level system. Early works in meta learning explored automatically learning update rules for neural models (Bengio et al., 1990; 1992; Schmidhuber, 1992). Recent approaches have focused on learning optimisers for deep networks based on LSTMs (Ravi & Larochelle, 2016) or synthetic gradients (Andrychowicz et al., 2016; Jaderberg et al., 2016). Meta learning has also been studied for finding optimal hyper-parameters (Li et al., 2017) and a good initialisation for few-shot learning (Finn et al., 2017). (Santoro et al., 2016) also investigated few shot learning via an external memory module. Vinyals et al. (2016); Snell et al. (2017) realised few shot learning in the instance space via a differentiable nearest-neighbour approach. Our method also performs in the instance space, but induces auxiliary knowledge as an implicit regularisation to improve generalisation of the principal task.
31
+
32
+ # 3 META AUXILIARY LEARNING
33
+
34
+ In this section, we introduce our method for automatically generating optimum auxiliary tasks, which we call Meta AuXiliary Learning (MAXL).
35
+
36
+ # 3.1 PROBLEM SETUP
37
+
38
+ The goal of meta auxiliary learning is to train a meta generator that can generate higher complexity auxiliary tasks, to improve performance of the principal task. To accomplish this, we use two networks: a multi-task evaluator which trains on the principal and auxiliary tasks, and evaluates the performance of the auxiliary tasks on a meta set, and a meta generator which generates these auxiliary tasks. For simplicity, we consider image classification tasks in this section, where the auxiliary task is sub-class labelling, and the meta generator determines target sub-class labels, but the approach can be considered general for any type of task.
39
+
40
+ We denote the multi-task evaluator as a function $f _ { \theta _ { 1 } } ( x )$ that takes an input $x$ with network parameters $\theta _ { 1 }$ , and the meta generator as a function $g _ { \theta _ { 2 } } ( x )$ that takes the same input $x$ with network parameters $\theta _ { 2 }$ . For a dataset with input $x$ and ground-truth label $y$ for the principal task, we split into three subsets: training $( x _ { \mathrm { t r a i n } } , y _ { \mathrm { t r a i n } } )$ , meta-training $( x _ { \mathrm { m e t a } } , y _ { \mathrm { m e t a } } )$ , and test $( x _ { \mathrm { t e s t } } , y _ { \mathrm { t e s t } } )$ . Training data is used for updating $\theta _ { 1 }$ , meta-training data is used for updating the $\theta _ { 2 }$ , and test data is used for overall evaluation.
41
+
42
+ In the multi-task evaluator, we apply a hard parameter sharing approach (Ruder, 2017) in which we predict the principal and auxiliary tasks using the shared set of features $\theta _ { 1 }$ in the multi-task network. At the end of the last feature layer $f _ { \theta _ { 1 } } ( x )$ , we then apply further task-specific layers to output the corresponding prediction for each task. We denote the predicted principal labels by $f _ { \theta _ { 1 } } ^ { \mathrm { p r i } } ( x )$ and predicted auxiliary labels by $f _ { \theta _ { 1 } } ^ { \mathrm { a u x } } ( x )$ .
43
+
44
+ In the meta generator, we pre-define a hierarchical structure $\psi$ which determines the number of subclasses for each class in the principal task. At the end of the last feature layer $g _ { \theta _ { 2 } } ( x )$ , this hierarchy, together with the ground-truth label $y$ for the principal task, are used to generate the target auxiliary labels, denoted by $g _ { \theta _ { 2 } } ^ { \mathrm { g e n } } ( x , y , \psi )$ . We allow for soft assignment labelling rather than enforcing onehot encoding, which enables greater flexibility to learn optimum auxiliary tasks. The meta generator uses a masked SoftMax to ensure that each output node represents a sub-class label for only one class in the principal task, as described further in Section 3.3. The visualisation of the our proposed MAXL approach is shown in Figure 2.
45
+
46
+ ![](images/727e86b2ef0470221fae2f43e47889a0ae8a621f009cf89078060a2777ebee3a.jpg)
47
+ Figure 2: (a) Illustration of the two networks which make up our meta auxiliary learning algorithm. (b) Illustration of vanilla SoftMax and Mask SoftMax with 3 principal classes. Vanilla SoftMax outputs over all 5 auxiliary classes, where as Mask Softmax outputs over a hierarchical structure $\psi \overset { = } { = } [ 2 , 2 , 1 ]$ to constrain the prediction space.
48
+
49
+ # 3.2 MODEL OBJECTIVES
50
+
51
+ The multi-task evaluator is trained in a tightly-coupled manner with the meta generator: the meta generator determines target labels for the multi-task evaluator, which in turn determines the suitability of those labels.
52
+
53
+ Given target labels as determined by the meta generator, the multi-task evaluator is trained to predict these labels, alongside the ground-truth labels for the principal task. For both the principal and auxiliary classification tasks, we apply focal loss (Lin et al., 2017) with a focusing parameter $\gamma = 2$ , defined as:
54
+
55
+ $$
56
+ \mathcal { L } ( \hat { y } , y ) = - y ( 1 - \hat { y } ) ^ { \gamma } \log ( \hat { y } ) ,
57
+ $$
58
+
59
+ where $\hat { y }$ is the predicted label and $y$ is the ground-truth label. The focal loss helps to focus on the incorrectly predicted labels, which we found improved performance during our experimental evaluation compared with the regular cross-entropy log loss.
60
+
61
+ To update parameters $\theta _ { 1 }$ in the multi-task evaluator, we define the multi-task objective as follows:
62
+
63
+ $$
64
+ \underset { \theta _ { 1 } } { \arg \operatorname* { m i n } } \left( \mathcal { L } ( f _ { \theta _ { 1 } } ^ { \mathrm { p r i } } ( x _ { \mathrm { t r a i n } } ^ { ( i ) } ) , y _ { \mathrm { t r a i n } } ^ { ( i ) } ) + \mathcal { L } ( f _ { \theta _ { 1 } } ^ { \mathrm { a u x } } ( x _ { \mathrm { t r a i n } } ^ { ( i ) } ) , g _ { \theta _ { 2 } } ^ { \mathrm { g e n } } ( x _ { \mathrm { t r a i n } } ^ { ( i ) } , y _ { \mathrm { t r a i n } } ^ { ( i ) } , \psi ) ) \right) \ ,
65
+ $$
66
+
67
+ where $( i )$ represents the $i ^ { t h }$ batch from the training data.
68
+
69
+ The meta generator is then trained by encouraging target labels for the auxiliary task to be chosen such that, if the multi-task evaluator were to be trained on these labels, the performance on the principal task would be maximised. This requires evaluation on a separate dataset, the meta-training set, to train the meta generator, to ensure that the target auxiliary labels encourage generalisation beyond the data supplied to the multi-task evaluator.
70
+
71
+ To update parameters $\theta _ { 2 }$ in the meta generator, we define the meta objective as follows:
72
+
73
+ $$
74
+ \underset { \theta _ { 2 } } { \arg \operatorname* { m i n } } \mathcal { L } ( f _ { \theta _ { 1 } ^ { + } } ^ { \mathrm { p r i } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } ) , y _ { \mathrm { m e t a } } ^ { ( i ) } ) ~ .
75
+ $$
76
+
77
+ Here $\theta _ { 1 } ^ { + }$ represents the weights of the multi-task network were it to be trained, with one gradient update, using auxiliary labels $y _ { \mathrm { { m e t a } } }$ :
78
+
79
+ $$
80
+ \begin{array} { r } { \theta _ { 1 } ^ { + } = \theta _ { 1 } - \alpha \nabla _ { \theta _ { 1 } } \left( \mathcal { L } \big ( f _ { \theta _ { 1 } } ^ { \mathrm { p r i } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } ) , y _ { \mathrm { m e t a } } ^ { ( i ) } \big ) + \mathcal { L } \big ( f _ { \theta _ { 1 } } ^ { \mathrm { a u x } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } ) , g _ { \theta _ { 2 } } ^ { \mathrm { g e n } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } , y _ { \mathrm { m e t a } } ^ { ( i ) } , \psi ) \Big ) \right) , } \end{array}
81
+ $$
82
+
83
+ where $\alpha$ is the learning rate.
84
+
85
+ The trick in this meta objective is that we perform the derivative over a derivative (a Hessian matrix) to update $\theta _ { 2 }$ , by using a retained computational graph of $\theta _ { 1 } ^ { + }$ in order to compute derivatives with respect to $\theta _ { 2 }$ . This second derivative trick in meta learning was also proposed in Finn et al. (2017) and Zhang et al. (2018).
86
+
87
+ However, we found that the generated auxiliary labels can easily collapse (i.e. degenerate by simply learning a similar level of complexity as the principal task), which leaves parameters $\theta _ { 2 }$ in a local minimum without producing any extra useful knowledge. Thus, to encourage the network to learn more complex and informative auxiliary tasks, we further apply an entropy loss $\mathcal { H } ( g _ { \theta _ { 2 } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } , y _ { \mathrm { m e t a } } ^ { ( i ) } , \psi ) )$ as a regularisation term in the meta objective. A detailed explanation of the entropy loss and the collapsing label problem will be given in Section 3.4.
88
+
89
+ Finally, the entire MAXL algorithm is defined as follows:
90
+
91
+ # Algorithm 1: The MAXL algorithm
92
+
93
+ Dataset: $D = \left\{ ( x _ { \mathrm { t r a i n } } , y _ { \mathrm { t r a i n } } ) , ( x _ { \mathrm { m e t a } } , y _ { \mathrm { m e t a } } ) \right\}$
94
+ Initialise: Network parameters: $\theta _ { 1 } , \theta _ { 2 }$ ; Hierarchical structure: $\psi$
95
+ Initialise: Hyper-parameter (learning rate): $\alpha , \beta$ ; Hyper-parameter (task weighting): $\lambda$
96
+ for each training iteration $i$ do $\left\{ \left( x _ { \mathrm { t r a i n } } ^ { ( i ) } , y _ { \mathrm { t r a i n } } ^ { ( i ) } \right) , \big ( x _ { \mathrm { m e t a } } ^ { ( i ) } , y _ { \mathrm { m e t a } } ^ { ( i ) } \big ) \right\} \in \left\{ \left( x _ { \mathrm { t r a i n } } , y _ { \mathrm { t r a i n } } \right) , \big ( x _ { \mathrm { m e t a } } , y _ { \mathrm { m e t a } } \big ) \right\}$ $\begin{array} { r } { \theta _ { 1 } \theta _ { 1 } - \alpha \nabla _ { \theta _ { 1 } } ( \mathcal { L } \big ( f _ { \theta _ { 1 } } ^ { \mathrm { p i } } ( x _ { \mathrm { t r a i n } } ^ { ( i ) } ) , y _ { \mathrm { t r a i n } } ^ { ( i ) } \big ) + \mathcal { L } \big ( f _ { \theta _ { 1 } } ^ { \mathrm { a u x } } ( x _ { \mathrm { t r a i n } } ^ { ( i ) } ) , g _ { \theta _ { 2 } } ( x _ { \mathrm { t r a i n } } ^ { ( i ) } , y _ { \mathrm { t r a i n } } ^ { ( i ) } , \psi ) \Big ) } \end{array}$ # meta-training step Update: Compute $\begin{array} { r l } & { \theta _ { 1 } ^ { + } = \theta _ { 1 } ^ { ' } - \alpha \nabla _ { \theta _ { 1 } } ( \mathcal { L } ( f _ { \theta _ { 1 } } ^ { \mathrm { p i } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } ) , y _ { \mathrm { m e t a } } ^ { ( i ) } ) + \mathcal { L } ( f _ { \theta _ { 1 } } ^ { \mathrm { a u x } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } ) , g _ { \theta _ { 2 } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } , y _ { \mathrm { m e t a } } ^ { ( i ) } , \psi ) ) } \\ & { \mathfrak { i } _ { 2 } \theta _ { 2 } - \beta \nabla _ { \theta _ { 2 } } ( \mathcal { L } ( f _ { \theta _ { 1 } } ^ { \mathrm { p i } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } ) , y _ { \mathrm { m e t a } } ^ { ( i ) } ) + \lambda \mathcal { H } ( g _ { \theta _ { 2 } } ^ { \mathrm { g e n } } ( x _ { \mathrm { m e t a } } ^ { ( i ) } , y _ { \mathrm { m e t a } } ^ { ( i ) } , \psi ) ) ) } \end{array}$
97
+ end
98
+
99
+ # 3.3 MASK SOFTMAX FOR HIERARCHICAL PREDICTIONS
100
+
101
+ In the prediction layer of the meta generator, we designed a modified SoftMax function to predict target auxiliary labels which conform to a pre-defined hierarchy $\psi$ . As shown in Figure 2 (upper right), the original softmax function does not constrain sub-class labelling to lie within this hierarchy. Our mask SoftMax structure resolves this issue by applying a binary mask to the original SoftMax function.
102
+
103
+ The overall hierarchical structure $\psi$ determines the number of sub-classes $\psi [ i ]$ in each principal class $i$ . As such, the total prediction space for auxiliary labels is $\textstyle \sum _ { i } \psi [ i ]$ . This hierarchy, together with the ground-truth principal class label $y$ of the current image, creates the mask with a binarise function $\bar { \boldsymbol { M } } = \boldsymbol { B } ( \boldsymbol { y } , \bar { \boldsymbol { \psi } } )$ . Using the principal ground-truth label $y$ , the corresponding range of sub-classes $\psi [ y ]$ is selected, and a binary mask $M$ is created with size $\textstyle \sum _ { i } \psi [ i ]$ with a multi one-hot encoding $\begin{array} { r } { \mathbb { 1 } \sum _ { i < y } \psi [ i ] \colon \sum _ { i < y + 1 } \psi [ i ] } \end{array}$ $\scriptstyle \mathbf { 1 } _ { a : b }$ is denoted as a multi one-hot encoding in which indexes from $a$ to $b$ are encoded as 1).
104
+
105
+ Using the example in Figure 2, consider the principal task to have 3 classes with ground truth labels $y = 0 , 1 , 2$ , and hierarchical structure $\psi \stackrel { - } { = } [ 2 , \stackrel { - } { 2 } , 1 ]$ . In this case, the auxiliary prediction space is equal to 5 and the corresponding binary masks are $M = [ 1 , 1 , 0 , 0 , 0 ] , [ 0 , 0 , 1 , 1 , 0 ] , [ 0 , 0 , 0 , 0 , 1 ]$ respectively.
106
+
107
+ Finally, we apply binary mask $M$ with an element-wise multiplication on the original SoftMax function for the final auxiliary task predictions:
108
+
109
+ $$
110
+ p ( \hat { y } _ { i } ) = \frac { \exp \hat { y } _ { i } } { \sum _ { i } \exp \hat { y } _ { i } } , \qquad \mathrm { M a s k ~ S o f t M a x : } \quad p ( \hat { y } _ { i } ) = \frac { \exp M \odot \hat { y } _ { i } } { \sum _ { i } \exp M \odot \hat { y } _ { i } } , \quad M = \mathcal { B } ( y , \psi ) ,
111
+ $$
112
+
113
+ where $p ( \hat { y } _ { i } )$ represents the probability of the predicted principal label $\hat { y }$ over class $i$ , and $\odot$ represents element-wise multiplication.
114
+
115
+ # 3.4 THE COLLAPSING CLASS PROBLEM
116
+
117
+ As previously discussed, we predict each auxiliary label within a hierarchical structure $\psi$ . However, the number of sub-classes defined in $\psi [ i ]$ is the maximum auxiliary label prediction space, with no guarantee that all $\psi [ i ]$ classes will be predicted. This may result in some auxiliary labels defined in $\psi [ i ]$ being overlooked, with the output of the meta generator collapsing into a smaller sub-class space. In experiments, we found that this phenomenon is particularly apparent when we either have a large learning rate for training the meta generator, or a large sub-class prediction space $\psi$ .
118
+
119
+ To avoid the collapsing class problem, we introduced an additional regularisation loss, which we call the entropy loss $\mathcal { H } ( \hat { y } ^ { ( i ) } )$ . This encourages the meta generator to utilise the full prediction space, by encouraging a large prediction entropy across this space.
120
+
121
+ Assuming we have a well-balanced dataset, the entropy loss calculates the KL divergence between the predicted auxiliary label space $\hat { y } ^ { ( i ) }$ , and a uniform distribution $\mathcal { U }$ for each $i ^ { t h }$ batch. This is equivalent to calculating the entropy of the predicted label space, and is defined as:
122
+
123
+ $$
124
+ \mathcal { H } ( \hat { y } ^ { ( i ) } ) = \sum _ { k = 1 } ^ { K } \overline { { y _ { k } } } \log \overline { { y _ { k } } } , \quad \overline { { y _ { k } } } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \hat { y } ^ { ( i ) } .
125
+ $$
126
+
127
+ where $K$ is the number of auxiliary labels and $N$ is the training batch size.
128
+
129
+ The entropy loss is essential to achieve human-level performance, as shown in our experiments. The higher entropy in the auxiliary target labels results in a more complex auxiliary task. This avoids local minima during training, such as assigning a single label to all examples of a principal class.
130
+
131
+ # 4 EXPERIMENTS
132
+
133
+ In this section, we present experimental results to evaluate MAXL with respect to several baselines and datasets on image classification tasks.
134
+
135
+ # 4.1 EXPERIMENTAL SETUP
136
+
137
+ Datasets We evaluated on three different datasets: CIFAR100, CIFAR10, and CIFAR10.1v6 (Recht et al., 2018). CIFAR100 consists of 100 principal classes, whilst CIFAR10 and CIFAR10.1v6 consist of 10 principal classes and have the same training dataset as each other, but two different test datasets. To assess the generalisation across different task complexities, we tested a range of different combinations in the numbers of principal and auxiliary classes. For CIFAR100, we expanded the dataset’s provided 2-level hierarchy (20 and 100 classes) into a 4-level hierarchy (additional 3 and 10 classes), by manually assigning examples for these new hierarchy levels (see Appendix A). Based on the new hierarchy, we then tested on all 6 possible combinations of principal and auxiliary class numbers. Note that for MAXL, the hierarchy was used only to define the structure of $\psi$ and the principal task labels, to ensure a fair comparison with a method using human-defined auxiliary tasks, but the auxiliary task labelling within that structure was learned by MAXL itself. CIFAR10 and CIFAR10.1v6 do not have an associated manually-defined hierarchy, and so we defined a range of hierarchical structures $\psi [ i ] = 2 , 5 , 1 0 , 2 0 , 5 0 , 1 0 0 , \forall i$ .
138
+
139
+ Baselines We compared MAXL to a number of baselines. Single Task trains only with the principal class label. Random Assignment trains with auxiliary classes, and randomly assigns the auxiliary class labels. Prototypical Net is a clustering method based on (Snell et al., 2017), where prototypes for auxiliary classes are defined by embedding examples from meta-training data, which has human-defined auxiliary classes, using a pre-trained ImageNet network. Unsupervised, differentiable, nearest-neighbour clustering is then used to produce the final auxiliary class labelling for the remaining training data. The key difference to MAXL is that, whilst both methods are unsupervised, the auxiliary class labelling with MAXL actually evaluates the generalisation performance of this labelling on the principal task, whilst the Prototypical Net method does not. Finally, Human trains with auxiliary classes, using the human-defined hierarchy. Note that due to the need for a manually-defined hierarchy, Prototypical Net and Human were only evaluated on CIFAR100. For all baselines, we use the same network architecture and training procedure as MAXL’s multi-task evaluator. For the meta-training for MAXL and Prototypical Net, we split each training dataset and used $10 \%$ for meta-training the auxiliary labelling, and $90 \%$ for training the multi-task evaluator. For all other baselines, we used the full training set for training the multi-task evaluator.
140
+
141
+ Training For both the multi-task evaluator and the meta generator use VGG-16 as its core (Simonyan & Zisserman, 2014), together with batch normalisation. For all experiments, we used a learning rate of 0.01 for the multi-task evaluator. For MAXL’s meta generator, we found that a smaller learning rate of $1 0 ^ { - 5 }$ was necessary to help prevent the class collapsing problem. For all training, we drop the learning rate by half after every 50 epochs, and train for a total of 200 epochs, using vanilla stochastic gradient descent. For the meta generator, we apply an $L _ { 1 }$ norm weight decay of $5 \cdot 1 0 ^ { - 4 }$ on the meta generator, with no regularisation on the multi-task evaluator. We chose the weighting of the entropy regularisation loss term to be 0.2 based on empirical performance.
142
+
143
+ # 4.2 TEST PERFORMANCE
144
+
145
+ We now evaluate the performance of MAXL compared to these baselines, on all three datasets. Results for CIFAR100 are presented in Figure 3, and results for CIFAR10 and CIFAR10.1v6 are presented in Appendix B.
146
+
147
+ ![](images/ba3262f7dc28e5b4ee5046e70d3d7172a3449a226d32b38995b81556ee528b59.jpg)
148
+ Figure 3: Learning curves for the CIFAR100 test dataset, comparing MAXL with baseline methods. We provide results in all 6 different combinations of principal and auxiliary class numbers.
149
+
150
+ For CIFAR100, we observe that MAXL performs similarly to when human knowledge is used in 4 out of the 6 hierarchical structures, and performs worse in 2 out of the 6. For all other baselines, MAXL performs at least as well, and in the majority of cases outperforms other baselines by a significant margin. We therefore see that MAXL is able to learn auxiliary tasks effectively by tightly coupling the auxiliary task generation and the principal task training, in a superior manner than when these auxiliary tasks are assigned independently, such as with random assignment or using prototypical net. With performance of MAXL approaching that of a system using a human-defined auxiliary tasks, we see strong evidence that MAXL is able to learn to generalise effectively in an unsupervised manner.
151
+
152
+ # 4.3 EFFECT OF AUXILIARY TASK COMPLEXITY
153
+
154
+ We now evaluate how the complexity of the auxiliary tasks affects the performance of the principal task. In Figure 4 (a), we present results from CIFAR10 and CIFAR10v1.6 showing the performance increase over single-task learning, when there are 10 principal classes, but a range of auxiliary class numbers $( \psi [ i ] \stackrel { } { = } 2 , 5 , 1 0 , 2 0 , 5 \bar { 0 } , 1 0 0 , \forall i )$ . For each data point, the performance is calculated by averaging the test accuracy from the last 5 epochs, after a total of 200 epochs. Experiments were performed both with and without the entropy loss term to show the benefit of this regularisation.
155
+
156
+ We observe an interesting trend in which test performance rises as the number of auxiliary classes increases, but then begins to fall. This suggests that for a given complexity of principal task, there is an optimum complexity in the auxiliary tasks. One explanation for this may be that as the auxiliary tasks increase in complexity, the learned features favour learning these auxiliary tasks rather than the principal task, encouraging further generalisation beyond the features learned only for the principal task. But if the auxiliary task is too complex, then these features begin to overfit and lose the overlap between the reasoning required for the principal and auxiliary tasks, begins to decrease.
157
+
158
+ ![](images/6bc3b5c36a2651f5b22fd1f302e32729193f45fadac730c3aea84650018312cd.jpg)
159
+ Figure 4: Performance improvement in percentages when training with MAXL compared with single-task learning, with 10 principal classes and a range of auxiliary classes.
160
+
161
+ # 4.4 VISUALISATIONS OF GENERATED KNOWLEDGE
162
+
163
+ In Figure 5, we visualise 2D embeddings of examples from the CIFAR100 test dataset, on two different task complexities. This was computed using t-SNE (Maaten & Hinton, 2008) on the final feature layer of the multi-task evaluator, and compared across three methods: our MAXL method, our baseline using human-defined hierarchy, and our baseline using single-task learning.
164
+
165
+ ![](images/46a8f308f35fa53f6ad6b14f92ada0dc6d31c499ebea64196dceb57ec646934e.jpg)
166
+ Figure 5: t-SNE visualisation of the learned final layer of the multi-task evaluator network, trained with two combinations of principal and auxiliary class numbers from CIFAR100. Colours represent the principal classes.
167
+
168
+ This visualisation shows the separability of principal classes after being trained with the multi-task evaluator. We see that both MAXL and Human show better separation of the principal classes than with Single-Task, owing to the generalisation effect of the auxiliary task learning. The distinction between the separability of the MAXL and Human visualisations is not as clear, despite their very similar performance for these two task complexities in Figure 3. But given that MAXL uses the same hierarchical structure as Human, we see from the visualisation that these two methods are clearly learning different representations.
169
+
170
+ We also show examples of images assigned to the same auxiliary class through MAXL’s multi-task evaluator. Figure 6 shows example images with the highest prediction probabilities for three random auxiliary classes from CIFAR100, using the combination of 20 principal classes and 5 auxiliary classes per principal class, which showed the best performance of MAXL in Figure 3. In addition, we also applied MAXL to MNIST, in which 3 auxiliary classes were used for each of the 10 principal classes.
171
+
172
+ ![](images/0b1148d6aa97dee0e59d1c7049362ee17c4d34a79f73ca4fd59a1950a15f582f.jpg)
173
+ Figure 6: Visualisation of 5 test examples with the highest prediction probability, for each of 3 randomly selected auxiliary classes, for a number of different principal classes. We present the visualisation for CIFAR100 (top) when trained with 20 principal classes and 5 auxiliary classes per principal class, and for MNIST (bottom) when trained with 10 principal classes and 3 auxiliary classes per principal class.
174
+
175
+ To our initial surprise, the generated auxiliary labels visualised in both datasets show no clear human-understandable knowledge. In particular, there are no obvious similarities within each auxiliary class whether in terms of shape, colour, style, structure or semantic meaning. However, this makes more sense when we re-consider the task of the meta generator, which is to assign auxiliary labels which assist the principal task. Rather than grouping images in terms of semantic or visual similarity, the meta generator would therefore be more effective it it were to group images in terms of a shared aspect of reasoning which the multi-task evaluator is currently facing difficulty on. If the multi-task evaluator is then able to improve its ability to determine the auxiliary class of an image in such a cluster, then the learned features will help in overcoming this challenging aspect of reasoning. It therefore makes sense that the examples within an auxiliary class do not share semantic or visual similarity, but instead share a more complex underlying property.
176
+
177
+ Further, we discovered that the generated auxiliary knowledge is not deterministic, since the top predicted candidates are different when we re-train the network from scratch. We therefore speculate that using a human-defined hierarchy is just one out of a potentially infinite number of local optima, and on each run of training the meta generator produces another of these local optimums.
178
+
179
+ # 5 CONCLUSION & FUTURE WORK
180
+
181
+ In this paper, we have presented and evaluated Meta AuXiliary Learning (MAXL). MAXL learns to generate optimum auxiliary tasks which, when trained alongside a principal task in a multi-task setup, maximise the generalisation of the principal task across a validation dataset. Rather than employing domain knowledge and human-defined auxiliary tasks as is typically required, MAXL is self-supervised and, combined with its general nature, has the potential to automate the process of generalisation to new levels.
182
+
183
+ Our evaluations on three image datasets have shown the performance of MAXL in an image classification setup, where the auxiliary task is to predict sub-class, hierarchical labels for an image. We have shown that MAXL significantly outperforms other auxiliary learning baselines, and even when human-defined knowledge is used to manually construct the auxiliary tasks, MAXL performs similarly in the majority of experiments.
184
+
185
+ Despite this impressive performance from a self-supervised method, questioning why auxiliary tasks generated by MAXL do not outperform those constructed by a human opens exciting future research in this direction. Perhaps, human-defined auxiliary tasks are optimal themselves and cannot be surpassed. However, we believe this not to be the case since such tasks are typically chosen due to the availability of labelled data for these tasks, and not necessarily their optimality when combined with the principal task. Alternatively, perhaps the power of the human knowledge is not from the domain specific labels, but from higher-level reasoning about how auxiliary tasks should be structured. In our experiments, training MAXL using the same structure as a human-defined hierarchy, but learning its own auxiliary labels, typically led to similar performance as when the human-defined labels were used.
186
+
187
+ The general nature of MAXL also opens up questions about how self-supervised auxiliary learning may be used to learn generic auxiliary tasks beyond sub-class labelling. During our experiments, we also ran preliminary experiments on predicting arbitrary vectors as the auxiliary task, but results so far have been inconclusive. However, the ability of MAXL to potentially learn flexible auxiliary tasks which can automatically be tuned for the principal task now offers an exciting direction towards automated generalisation across a wide range of more complex tasks.
188
+
189
+ # REFERENCES
190
+
191
+ Marcin Andrychowicz, Misha Denil, Sergio Gomez, Matthew W Hoffman, David Pfau, Tom Schaul, Brendan Shillingford, and Nando De Freitas. Learning to learn by gradient descent by gradient descent. In Advances in Neural Information Processing Systems, pp. 3981–3989, 2016.
192
+ Samy Bengio, Yoshua Bengio, Jocelyn Cloutier, and Jan Gecsei. On the optimization of a synaptic learning rule. In Preprints Conf. Optimality in Artificial and Biological Neural Networks, pp. 6–8. Univ. of Texas, 1992.
193
+ Yoshua Bengio, Samy Bengio, and Jocelyn Cloutier. Learning a synaptic learning rule. Universite´ de Montreal, D ´ epartement d’informatique et de recherche op ´ erationnelle, 1990. ´
194
+ 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.
195
+ Carl Doersch and Andrew Zisserman. Multi-task self-supervised visual learning. In The IEEE International Conference on Computer Vision (ICCV), Oct 2017.
196
+ 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.
197
+ John Flynn, Ivan Neulander, James Philbin, and Noah Snavely. Deepstereo: Learning to predict new views from the world’s imagery. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5515–5524, 2016.
198
+ Max Jaderberg, Wojciech Marian Czarnecki, Simon Osindero, Oriol Vinyals, Alex Graves, David Silver, and Koray Kavukcuoglu. Decoupled neural interfaces using synthetic gradients. arXiv preprint arXiv:1608.05343, 2016.
199
+ Max Jaderberg, Volodymyr Mnih, Wojciech Marian Czarnecki, Tom Schaul, Joel Z Leibo, David Silver, and Koray Kavukcuoglu. Reinforcement learning with unsupervised auxiliary tasks. International Conference on Learning Representations, 2017.
200
+ Iasonas Kokkinos. Ubernet: Training a universal convolutional neural network for low-, mid-, and high-level vision using diverse datasets and limited memory. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), July 2017.
201
+ Zhenguo Li, Fengwei Zhou, Fei Chen, and Hang Li. Meta-sgd: Learning to learn quickly for few shot learning. arXiv preprint arXiv:1707.09835, 2017.
202
+ Lukas Liebel and Marco Korner. Auxiliary tasks in multi-task learning. ¨ arXiv preprint arXiv:1805.06334, 2018.
203
+ Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense object ´ detection. arXiv preprint arXiv:1708.02002, 2017.
204
+ Shikun Liu, Edward Johns, and Andrew J Davison. End-to-end multi-task learning with attention. arXiv preprint arXiv:1803.10704, 2018.
205
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(Nov):2579–2605, 2008.
206
+ Ishan Misra, Abhinav Shrivastava, Abhinav Gupta, and Martial Hebert. Cross-stitch networks for multi-task learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3994–4003, 2016.
207
+ Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. 2016.
208
+ Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do cifar-10 classifiers generalize to cifar-10? arXiv preprint arXiv:1806.00451, 2018.
209
+ Sebastian Ruder. An overview of multi-task learning in deep neural networks. arXiv preprint arXiv:1706.05098, 2017.
210
+ Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Oneshot learning with memory-augmented neural networks. arXiv preprint arXiv:1605.06065, 2016.
211
+ Jurgen Schmidhuber. Learning complex, extended sequences using the principle of history com- ¨ pression. Neural Computation, 4(2):234–242, 1992.
212
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
213
+ Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In Advances in Neural Information Processing Systems, pp. 4077–4087, 2017.
214
+ Shubham Toshniwal, Hao Tang, Liang Lu, and Karen Livescu. Multitask learning with low-level auxiliary tasks for encoder-decoder based speech recognition. arXiv preprint arXiv:1704.01631, 2017.
215
+ 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.
216
+ Jason Yosinski, Jeff Clune, Yoshua Bengio, and Hod Lipson. How transferable are features in deep neural networks? In Advances in neural information processing systems, pp. 3320–3328, 2014.
217
+ Yabin Zhang, Hui Tang, and Kui Jia. Fine-grained visual categorization using meta-learning optimization with sample selection of auxiliary data. arXiv preprint arXiv:1807.10916, 2018.
218
+ Tinghui Zhou, Matthew Brown, Noah Snavely, and David G Lowe. Unsupervised learning of depth and ego-motion from video. In CVPR, 2017.
219
+
220
+ # A 4-LEVEL CIFAR100 DATASET
221
+
222
+ Table 1: Building a 4-level hierarchy for image classification task based on CIFAR100 dataset. Originally, a 20-class and 100-class heirarchiy was provided, and we manually introduced a 3-class and 10 class layer.
223
+
224
+ <table><tr><td>3 Class</td><td>10 Class</td><td>20 Class</td><td>100 Class</td></tr><tr><td rowspan="10">animals</td><td rowspan="2">large animals</td><td>reptiles</td><td>crocodile,dinosaur,lizard,snake,turtle</td></tr><tr><td>large carnivores</td><td>bear,leopard, lion, tiger, wolf</td></tr><tr><td rowspan="2"></td><td></td><td>large omnivores and herbivores camel,catle,chimpanzee,elephant,kangaroo</td></tr><tr><td>aquatic mammals</td><td>beaver,dolphin,otter,seal, whale</td></tr><tr><td rowspan="2"></td><td>medium-sized mammals</td><td>fox,porcupine,possum, raccoon, skunk</td></tr><tr><td>small mammals</td><td>hamster,mouse,rabbit, shrew,squirrel</td></tr><tr><td rowspan="2"></td><td>fish</td><td>aquarium fish,flatfish,ray,shark,trout</td></tr><tr><td>insects</td><td>bee, beetle, butterfly,caterpillar,cockroach</td></tr><tr><td rowspan="2">people</td><td>non-insect invertebrates</td><td>crab,lobster,snail, spider, worm</td></tr><tr><td>people</td><td>baby,boy,girl,man,woman</td></tr><tr><td rowspan="3">vegetations</td><td rowspan="3">vegetations</td><td>flowers</td><td>orchids, poppies,roses,sunflowers,tulips</td></tr><tr><td>fruit and vegetables</td><td>apples,mushrooms,oranges, pears, peppers</td></tr><tr><td>trees</td><td>maple,oak,palm, pine,willow</td></tr><tr><td rowspan="7">objects and scenes construction</td><td rowspan="3"></td><td>food containers</td><td>bottles,bowls,cans,cups,plates</td></tr><tr><td>household objects household electrical devices</td><td>clock,keyboard,lamp,telephone,television</td></tr><tr><td>household furniture</td><td>bed,chair,couch,table,wardrobe</td></tr><tr><td></td><td>large man-made outdoor things</td><td>sbridge,castle,house,road,skyscraper</td></tr><tr><td>natural scenes</td><td>large natural outdoor scenes</td><td>cloud,forest, mountain, plain, sea</td></tr><tr><td rowspan="2">vehicles</td><td>vehicles 1</td><td>bicycle, bus, motorcycle,pickup truck, train</td></tr><tr><td>vehicles 2</td><td>lawn-mower, rocket, streetcar, tank, tractor</td></tr></table>
225
+
226
+ # B LEARNING CURVES FOR CIFAR10/10.1V6
227
+
228
+ ![](images/5683941fcf7c15570684d5af976f175c72cd2f1ac4fcb778a27b828a724a25e3.jpg)
229
+ Figure 7: Testing performance on CIFAR10 (bottom) and CIFAR10.1v6 (top) datasets, across 6 different numbers of auxiliary classes.
md/train/S1xxx64YwH/S1xxx64YwH.md ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ECOLOGICAL REINFORCEMENT LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Reinforcement learning algorithms have been shown to effectively learn tasks in a variety of static, deterministic, and simplistic environments, but their application to environments which are characteristic of dynamic lifelong settings encountered in the real world has been limited. Understanding the impact of specific environmental properties on the learning dynamics of reinforcement learning algorithms is important as we want to align the environments in which we develop our algorithms with the real world, and this is strongly coupled with the type of intelligence which can be learned. In this work, we study what we refer to as ecological reinforcement learning: the interaction between properties of the environment and the reinforcement learning agent. To this end, we introduce environments with characteristics that we argue better reflect natural environments: non-episodic learning, uninformative “fundamental drive” reward signals, and natural dynamics that cause the environment to change even when the agent fails to take intelligent actions. We show these factors can have a profound effect on the learning progress of reinforcement learning algorithms. Surprisingly, we find that these seemingly more challenging learning conditions can often make reinforcement learning agents learn more effectively. Through this study, we hope to shift the focus of the community towards learning in realistic, natural environments with dynamic elements.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ A central goal in current AI research, especially in reinforcement learning (RL), is to develop algorithms that are general, in the sense that the same method can be used to train an effective model for a wide variety of tasks, problems, and domains. In RL, this means designing algorithms that can solve any Markov decision process (MDP). However, natural intelligence – e.g., humans and animals – exists in the context of a natural environment. People and animals cannot be understood separately from the environments that they inhabit any more than brains can be understood separately from the bodies they control. In the same way, perhaps a complete understanding of artificial intelligence can also only be obtained in the context of an environment, or at least a set of assumptions on that environment.
12
+
13
+ There has been comparatively little study in the field of reinforcement learning to understand how properties of the environment impact the learning process for complex RL agents. Many of the environments used in modern reinforcement learning research differ in fundamental ways from the real world. First, standard RL benchmarks, such as the arcade learning environment (ALE) (Bellemare et al., 2013) and Gym (Brockman et al., 2016) are episodic, while natural environments are continual and lack a “reset” mechanism, requiring an agent to learn through continual interaction. Second, most of these environments include detailed reward functions that not only correspond to overall task success, but also provide intermediate learning signal, thus shaping the learning process. These signals can aid in learning, but they can also bias the learning process. Third, the environments are typically static, in the sense that only the agent’s own actions substantively impact the world. In contrast, natural environments are stochastic and dynamic: an agent that does nothing will still experience many different states, due to the behavior of natural processes and other creatures.
14
+
15
+ In this paper, we aim to study how these properties affect the learning process. At the core of our work is the concept of ecological reinforcement learning: the idea that the behavior and learning dynamics of an agent, like that of an animal, must be understood in the context of the environment in which it is situated. We therefore study how particular properties of the environment can facilitate or harm the emergence of complex behaviors. We focus our attention on the three properties outlined above: (1) continual, non-episodic environments where the agent must learn over the course of one “lifetime,” (2) environments that lack detailed reward shaping, but instead provides a reward signal based on a simple “fundamental drive,” (3) environments that are inherently dynamic, evolving on their own around the agent even if the agent does not take meaningful or useful actions. We study how each of these properties affects the learning process. Although on the surface these properties would seem to make the learning process harder, we observe that in some cases, they can actually make reinforcement learning easier.
16
+
17
+ ![](images/03b0179dec31be1505bc07b040d399247bfbc699801aeb21bcdd26643d86d28b.jpg)
18
+ Figure 1: We study three properties of realistic environments that can have a large effect on the difficulty of reinforcement learning: (left) non-episodic learning, where the agent is not reset automatically to the same initial state distribution, but must handle whatever situation it puts itself in; (middle) environment shaping as an alternative to reward shaping, where the agent has a single, sparse reward, but the environment is varied so as to provide a curriculum (e.g., due to its natural dynamics, or by a cooperative teacher agent); (right) dynamic environments, where the environment changes due to the actions of other agents and natural phenomena, even if the agent does not take a coordinated course of action – such dynamic phenomena can, as we will show, alleviate some of the difficulties in non-episodic learning.
19
+
20
+ The degree to which these properties make learning easier is highly dependent on the degree of scaffolding that is provided by an environment. For example, an agent tasked with collecting and making food pellets might struggle to learn if it must first complete a complex sequence of actions. However, if food pellets are initially plentiful, the agent can first learn that food pellets are rewarding, and then gradually learn to make them out of raw ingredients as the initial supply becomes scarce. This provides a natural scaffolding and curriculum without requiring manual reward engineering. More generally, “environment shaping” can be used as a way to craft the agent’s curriculum without modifying its reward function. This benefit is counter-balanced by the fact that non-episodic learning is inherently harder – the resets in episodic tasks provide a more stationary learning problem, preventing the agent from getting “stuck” due to a bad initial policy. However, natural environments can also counteract this difficulty: a dynamic environment that gradually changes on its own can provide a sort of “soft” reset that can mitigate the difficulties of reset-free learning, and we observe this empirically in our experiments. We illustrate some of these ideas in Figure 1.
21
+
22
+ The contribution of this work is an empirical study of how the properties of environments – particularly properties that we believe reflect realistic environments – impact reinforcement learning. We study the effect of (1) continual, non-episodic learning, (2) learning with and without reward shaping, and (3) learning in dynamic environments that evolve on their own. We find that, though each of these properties can make learning harder, they can also be combined in realistic ways to actually make learning easier. We also provide an open-source environment for future experiments studying “ecological” reinforcement learning, and we hope that our experimental conclusions will encourage future research that studies how the nature of the environment in which the RL agent is situated can facilitate learning and the emergence of complex skills. This exercise helps us determine which types of algorithmic challenges we should focus our development efforts towards in order to solve natural environments that agents might encounter.
23
+
24
+ # 2 RELATED WORK
25
+
26
+ Solving general RL problems can be extremely hard in general (Kakade & Langford, 2002). Reward shaping is a common technique to guide learning $\mathrm { N g }$ et al., 1999; Devlin & Kudenko, 2012; Brys et al., 2015) but is usually hand crafted and must be carefully designed by human experts (Griffith et al., 2013). Shaping the reward may also lead to suboptimal solutions, as it alters the objective of the learning problem. Curriculum learning can be used to first provide the agent with easier tasks, followed by more challenging tasks (Bengio et al., 2009; Graves et al., 2017; Randløv & Alstrøm, 1998; Wang et al., $2 0 1 9 \mathrm { a }$ ; Yu et al., 2018; Heess et al., 2017). Curriculum learning can also be viewed in the context of multiple learning agents in an adversarial or cooperative setting (Silver et al., 2016; Al-Shedivat et al., 2017; Sukhbaatar et al., 2017; Omidshafiei et al., 2018) or where the curriculum is automatically generated (Florensa et al., 2017b;a; Riedmiller et al., 2018; Wang et al., 2019b). The “environment shaping” that we study in our experiments can be viewed as a kind of curriculum learning, and we argue – and show empirically – that this environment shaping approach can in some cases be more effective than more commonly used reward shaping.
27
+
28
+ Improved exploration methods are a possible solution to solving sparse reward tasks. Prior work has used approximate state-visitation counts (Tang et al., 2016; Bellemare et al., 2013), information gain, or prediction error (Houthooft et al., 2016; Pathak et al., 2017), or model ensemble uncertainty (Osband et al., 2016). A recent work (Ecoffet et al., 2019) maintains a set of novel states and first returns to the novel states before exploring from this frontier. Our work could be combined with an exploration method, however, this work indicates that sparse reward tasks can be solved with an appropriately shaped environment.
29
+
30
+ Prior work on RL without resets has focused on safe exploration (Moldovan & Abbeel, 2012; Chatzilygeroudis et al., 2018) or learning a policy to reset the environment (Eysenbach et al., 2017; Han et al., 2015). Even-Dar et al. (2005) studies reset free RL in POMDPs and implements a homing strategy which approximately resets the agent. Rather than trying to convert the reset-free problem to one that looks more like a scenario with resets, our experiments study under which conditions reset-free learning can actually be easier, and show that dynamic environments – which we argue better reflect the real world – actually make learning without resets easier.
31
+
32
+ Learning in non-episodic settings has been studied from the perspective of continual learning Ring (1997), where a number of tasks are learned in sequence. These algorithms typically consider the problem of “catastrophic forgetting” (Mccloskey, 1989; French, 1999), where previously learned tasks are forgotten while learning new tasks. To solve this problem, algorithms use methods such as explicit memorization (Rusu et al., 2016; Schwarz et al., 2018), generative replay (Shin et al., 2017) and explicit weight regularization (Kirkpatrick et al., 2016; Kaplanis et al., 2018). These works assume that resets and task boundaries are available whereas we assume that the agent is unable to reset. There has also been work on building more complex tasks in large diverse worlds with Mujoco (Todorov et al., 2012; Singh et al., 2019; Yu et al., 2019), Malmo (Johnson et al., 2016; Guss et al., 2019), DeepMind Lab (Beattie et al., 2016), and many others, however, again, these environments are studied in the context of episodic-learning.
33
+
34
+ # 3 PROPERTIES OF NATURAL ENVIRONMENTS
35
+
36
+ In contrast to most simulated environments that are used for reinforcement learning experiments (Brockman et al., 2016), agents learning in natural environments experience a continual stream of experience, without episode boundaries. The typical reward function engineering that is often employed in reinforcement learning experiments is also generally unavailable in the real world, where agents must rely on their own low-level perception to understand the world. Finally, natural environments change on their own, even when the agent does not follow a coordinated or intelligent course of action. This dynamism can create additional challenges, but can also facilitate learning, mitigating some of the issues due to non-episodic and non-resettable learning settings. In this paper, our aim is to study how these aspects of the environment impact the performance of reinforcement learning agents. We term this approach ecological reinforcement learning, in that it deals specifically with the relationship between properties of the environment and the reinforcement learning agent, rather than studying reinforcement learning algorithms in the general case, regardless of the particular properties of the learning environment. We believe that the properties outlined above are broadly reflected in real-world settings, and are often absent in simulated reinforcement learning benchmarks. In this section, we discuss each of these properties, and formulate our hypotheses about how these properties might influence learning.
37
+
38
+ Continual non-episodic learning. In the real world, all learning must at some level be nonepisodic: though we may instrument environments to make them appear episodic, there is always a single underlying temporal process. In general, this makes the learning problem harder: when the agent is not reset to randomly chosen initial states, mistakes early on in training can put it into undesirable situations, from which it might be harder to recover and – more importantly – harder to learn. A non-episodic learning process is non-stationary, and the agent can become trapped in difficult regions of the state space.
39
+
40
+ Hypothesis 1: Non-episodic learning is more difficult than episodic learning because the agent must handle a non-stationary learning problem, and can become trapped in difficult states. We will study this hypothesis in our experiments, and show how some of the other properties of natural environments can help alleviate this difficulty.
41
+
42
+ Sparse rewards and environment shaping. While in principle RL algorithms can handle relatively uninformative rewards, in practice reward shaping is often an essential tool for getting RL methods to acquire effective policies. For example, an agent that must learn a policy to collect resources to make an axe (see Figure 2) might make use of a reward function that specifies the distance to the nearest resource, or at least provides a small reward for each resource obtained, as opposed to a reward given only for obtaining the final goal. However, well-shaped rewards are generally not available and difficult to provide in the real world, since they require knowledge of privileged state variables (e.g., positions of objects) or the process by which the task must be completed (e.g., required resources), both of which should in principle be learned automatically by the agent. Furthermore, reward shaping might introduce bias, since the optimal policy for a shaped reward may not in fact be optimal for the original task reward. On the other hand, agents in the real world do not learn in a vacuum: even for humans and animals, it is reasonable to assume a reasonably cooperative environment that has been set up so as to facilitate learning. For humans, this kind of “scaffolding” is often provided by other agents (e.g., parents and teachers). But even without other agents, natural environments might provide automatic scaffolding – e.g., an animal might find apples that fell from a tree, and thereby learn that apples are a source of food. Once the fallen apples are exhausted, the animal might use its knowledge of the value of apples to learn to climb the tree to obtain the apples on its own. This kind of “environment shaping” could serve as a tool for guiding the learning process, without the bias or manual engineering inherent in reward shaping.
43
+
44
+ Hypothesis 2: Environment shaping can enable agents to learn even with simple sparse rewards, and can in fact result in more proficient policies if applied correctly, as opposed to reward shaping.
45
+
46
+ Dynamic environments. Standard reinforcement learning benchmark tasks are typically situated in static environments (Brockman et al., 2016; Bellemare et al., 2013), in the sense that the environment does not change substantially unless the agent takes a coordinated course of action. On the other hand, real-world settings are typically dynamic, in the sense that the environment changes even if the agent does not follow any coordinated course of action: animals will move around, times of day will change, seasons will change, etc. Dynamic environments present their own challenges, but they can also facilitate learning, by automatically exposing the agent to a wide variety of situations.
47
+
48
+ Hypothesis 3: While dynamic environments could make learning more difficult, in fact they can alleviate some of the challenges associated with non-episodic learning, by providing the agent with a variety of learning conditions even in the absence of coordinated and intelligent behavior (as is the case, e.g., early on in training).
49
+
50
+ # 4 EXPERIMENTAL SETUP
51
+
52
+ To carry out our ecological RL study, we construct three simulated tasks. The simulator for two of them is built on top of the grid-like environment proposed by Chevalier-Boisvert et al. (2018). We chose a grid-based discrete-action environment over a more complex, high-dimensional one to study the aforementioned properties in isolation, without other confounding factors involving highdimensional observations and representation learning. The goal is not to simulate a completely visually realistic and life-like system, but to study those properties of the MDP that will be particularly important in natural environments, and have not been addressed in detail in prior work.
53
+
54
+ The environment is an $N \times N$ grid of tiles, where each tile contains at most one object, but the agent is free to move over any tile and can pick up and carry one object at a time. The agent can use objects in its environment to construct new ones by dropping a carried object onto an existing object. Objects include wood, metal, deer, axe, and food. The agent can combine wood with metal to construct an axe and apply the axe to a deer to produce food. The agent consumes resources such as food by picking them up. There are movement actions associated with each of the cardinal directions, as well as to pick up or drop an object. The environment is partially observed, and the agent receives a local egocentric view around it, represented by the shaded region in Figure 2, which is a $5 \times 5 \times C$ grid, where $C$ is the number of object types, and each grid position contains a one-hot vector representation of the object type. We use the following two tasks in our evaluation, which are illustrated in Figure 2:
55
+
56
+ ![](images/851f30e059be396a7c250cb4546b2faf89727a9fa36f95820145a7594a566770.jpg)
57
+ Figure 2: Tasks in our partially observed stochastic environment for crafting an axe (left) and hunting a deer (middle). The agent (purple triangle) receives a local observation (shaded gray square) and must interact with objects in the correct sequences to complete the task. In the food collection task in Unity (right), the agent’s goal is to collect green food and avoid red poison.
58
+
59
+ Tool-making: The agent must combine wood and metal to craft an axe, and then pick up the axe. Wood and metal appear at random locations initially, and continue to spawn with some probability as time progresses in the dynamic setting.
60
+
61
+ Hunting: The agent uses an axe to hunt a deer, which produces food that it can pick up to eat. Axes and deer appear at random locations. The deer can move around in the environment in the dynamic setting, and can appear at different distances from the agent.
62
+
63
+ In order to study our hypotheses in varied settings, we additionally investigate these environmental properties, enumerated at the end of this section, in the context of the Food Collector environment available as part of the Unity ML-Agents toolkit provided by Juliani et al. (2018). The environment features a continuous state space with raycast partial observations representing the directional view of the agent. The action space is 27-dimensional, with separate action streams corresponding to forward, lateral, and rotational movement. The task is taken as-is, wherein the agent must maximize the number of healthy food items eaten (represented by green spheres) while avoiding consuming poisonous food (red sphere). We modify the environment dynamics and initial conditions within this task setting to investigate our hypotheses.
64
+
65
+ To study the hypotheses discussed in the previous section, we vary a number of properties of these environments, and examine their effect on the learning process:
66
+
67
+ Non-episodic learning. The non-episodic version of each task does not allow the agent to reset to the initial state, and instead requires it to learn the task effectively over one very long episode, as illustrated in the figure on the right. For example, in the Unity Food Collector task, the agent must learn to continually collect as many healthy food items as possible while avoiding the poisonous food across its lifetime. We will compare this against the episodic case, where the agent is reset to an initial state distribution after completing the task or after a fixed time horizon. This will allow us to study hypothesis $H l$ .
68
+
69
+ ![](images/66d6015d129a90f30b572326f81d0d85664dda57c68e5a10b91ccf41eea1d2f6.jpg)
70
+
71
+ Reward shaping. Reward shaping is often used to assist the agent in finding a good policy by providing more signal to the agent. The environment allows us to experiment with different reward functions, such as a shaped distance-based reward function that rewards the agent for how close it is to the nearest resource it needs, and a larger bonus for interacting with the right object. A sparse reward function will b based on a simple “fundamental drive:” whether or not the agent has just acquired the axe (in th tool-making task), deer (hunting), or food (food collector).
72
+
73
+ ![](images/e8be49462fb9af660e8f7942b2e28f64b948ed3c1ad8532352adf8296771af09.jpg)
74
+
75
+ Environment shaping. Instead of shaping rewards, which can be unrealistic and can bias the learning process, we can instead change the types and distribution of states the agent observes while learning. In our tasks, we can scaffold the learning process by controlling the maximum distance from the agent at which the resources (wood, metal, deer, and food) can appear. We can gradually increase this distance as the learning progresses, as illustrated the figure on the right, which shows the deer appearing progressively further away during training, thus inducing a curriculum. This type of environment shaping can remove the need for reward shaping, and potentially alleviates its shortcomings. We will use this setting to study hypothesis $H 2$ .
76
+
77
+ Dynamic vs. static environments. We can construct dynamic versions of both of our tasks by varying the probability that the environment changes at any given time, regardless of the agent’s actions. This captures the fact that natural environments will change on their own, regardless of what the agent does: other animals will move around, weather will change, etc. In both grid domains, we define a continuous spectrum of dynamic effects, in terms of a dynamic event probability. In the tool-making task, the dynamic effect probability $p$ controls the resource generation, determining the probability that a resource will spawn in empty squares no less than two squares away from the agent at each time step. To keep the expected quantity of resources constant throughout the trajectory we allow resources to decay (disappear) after a lifespan of $\frac { I } { p }$ timesteps, where $I$ is the number of instances of this resource that appear in the initial environment. In the hunting task, the dynamic effect probability $p$ is the probability that a deer will move to a random adjacent square on each time step, as illustrated in the figure above. The static version of these environments will have $p = 0$ , such that resources are in fixed positions and only respawn as needed when the agent completes the task, and deer do not move. In the Unity Food Collector environment, the dynamic property is given by the speed at which both healthy and poisonous food move, which was tested across the range of $v = 0$ to $v = 1 6$ , corresponding to the velocities set for the food objects in the Unity engine. The static setting here corresponds to stationary food. By studying dynamic and static environments in episodic and non-episodic settings, we can analyze hypothesis $H 3$ .
78
+
79
+ ![](images/5e33e9c6293a07bee59285c53718ccffc8cb1bfc8c2d25b61290025efc3d3ccd.jpg)
80
+
81
+ In order to compare agents trained under the different environment conditions, we must construct a single consistent evaluation protocol. We use the same agent network architecture and RL algorithm for all experiments, with details provided in Appendix A. We evaluate all agents on a set of validation tasks that are chosen to be as close as possible to the “standard” RL setting, which is episodic and static. We generate 100 validation tasks by randomly generating environments with varying initial resource and agent locations. Performance is measured by the proportion of validation tasks solved. We first study non-episodic learning and dynamic vs. static environments by varying these training settings with sparse reward and no environment shaping. We will then study reward shaping and environment shaping in the dynamic non-episodic setting. The training settings are:
82
+
83
+ Static episodic: In this setting, $p$ is set to 0 so positions of the resources will be static unless the agent moves them. When the agent finishes the task, the environment is reset to a random initial configuration. The environment is also reset when the episode length reaches 200.
84
+
85
+ Static non-episodic: Here, $p = 0$ and there are no resets. When the agent has used up the available resources, more resources are generated randomly.
86
+
87
+ Dynamic non-episodic: This setting explores the lifelong case with a changing environment, where the dynamic property $p$ is varied between 0 and 1. For tool-making, $p$ is the probability of resources spawning at each timestep in a random location. There is initially two of each type of resource. This environment is lifelong and does not reset when the agent completes the task.
88
+
89
+ Dynamic episodic: This is the same as the dynamic non-episodic version except that the environment is reset to a random initial configuration when the agent completes the task.
90
+
91
+ # 5 EXPERIMENTAL RESULTS
92
+
93
+ To study the hypotheses in Section 3, we perform experiments where we train RL agents on the tasks described above and vary different properties of the environment during training.
94
+
95
+ # 5.1 NON-EPISODIC LEARNING IN DYNAMIC AND STATIC ENVIRONMENTS
96
+
97
+ In the real world, environments are generally dynamic and non-episodic, meaning that the agent is never reset to an initial state distribution, and many parts of the environment are changing without the agent’s intervention. In this section we study the effects of both a dynamic, changing environment and the ability to reset on the learning agent, corresponding to hypotheses $H l$ and $H 3$ . These settings will use sparse reward and no environment shaping.
98
+
99
+ ![](images/9e64ce211a9f989420a7c3b3d8508323116658264d9d1bfe128fb4b42af85412.jpg)
100
+ Figure 3: Proportion of validation tasks solved in each setting. Agents learning in static non-episodic environments struggle to learn useful behaviors, while agents learning in dynamic non-episodic environments are substantially more successful. Episodic learning is easier than non-episodic learning on the first task, but non-episodic learning in dynamic environments is almost as effective as episodic learning on the hunting task.
101
+
102
+ Effect of resets on learning. In regard to $H l$ , we find that learning tasks in static, reset-free, nonepisodic environments is difficult. In Figure 3, we compare the performance of the agent trained in each of the four conditions. Recall that all evaluations are conducted in the same setting, with resets and static environments, regardless of how the agent is actually trained. For the tool-making task, we observe that removing resets makes learning more difficult in the typical static case. The agent trained in a static environment without resets obtains the lowest performance $0 \%$ evaluation tasks solved). Adding in resets to the static case helps with performance $( 1 2 \% )$ . In the static environment, we observe that the agent frequently becomes stuck in corners of the map or in areas with no resources.
103
+
104
+ The results indicate that disabling resets makes the standard static learning condition substantially harder. Indeed, the static no reset agent is unable to learn effectively for either task, even though the static episodic agent does learn the task to a moderate proficiency. However, making the environment dynamic substantially improves performance, in both the episodic and non-episodic setting, as shown in Figure 3. These results suggest that dynamic environments to a large extent alleviate the challenges associated with non-episodic learning, confirming hypothesis $H 3$ . The lesson that we might draw from this is that, although individual properties of natural environments (such as non-episodic learning) can make the learning process harder, combining these properties (i.e., as in the non-episodic dynamic setting) can actually alleviate these challenges, since the dynamics of the environment naturally cause the agent to experience a variety of different situations, even before it has learned to take meaningful and coordinated actions.
105
+
106
+ Dynamic environments and non-episodic learning. We conclude that, when resets are not available, dynamic environments can also help with non-episodic RL. In this section, we study how the frequency of dynamic effects impacts learning. In Figure 3, we can see that making the environment more dynamic increases performance to $7 0 \%$ , compared to the static non-episodic case $( 0 \% )$ . Having both a dynamic environment and resets achieves the highest performance $( 9 5 \% )$ , indicating that both are helpful on their own. However, an environment that is too dynamic hinders performance, as we observe in Figure 4, where a dynamic effect probability of 0.5 performs worse than 0.1. This implies that environment dynamics represent a tradeoff: the environment should be stable enough for the agent to learn meaningful behavior, but dynamic enough to present interesting situations. This in some sense resembles the tradeoff typically encountered with exploration constants, e.g. in $\epsilon$ -greedy exploration. From this experiment, we can conclude that, although $H 3$ is generally true, the particular choice of environment settings can greatly impact learning performance. To understand this better, we analyze and compare the effect of “environment shaping,” as defined in Section 4, in the following subsection.
107
+
108
+ ![](images/ce2d75d532b6a31167f4909ade1a8830c40e4f93eb9ceafc27133e08559ea894.jpg)
109
+ Figure 4: Proportion of validation tasks solved as the dynamic effect probability (i.e., resource probability and deer movement probability) is varied in the non-episodic setting. For all tasks, the standard static environment does not allow for effective learning, but a number of dynamic environment variants allow the agent to learn the task successfully. Evaluation is still carried out in a static environment.
110
+
111
+ # 5.2 REWARD SHAPING AND ENVIRONMENT SHAPING
112
+
113
+ Next, we study how reward shaping and environment shaping compare in terms of their capacity to assist learning in reset-free environments, to study hypothesis $H 2$ . We perform experiments where we train RL agents on the same tool-making task, in the non-episodic case. We compare shaping the environment during training to shaping the reward function during training. The training environments have one of each resource, spawning at locations sampled uniformly over the world every 20 timesteps which is a much more difficult setting than the ones used in the previous section. We evaluate a range of reward and environment shaping conditions. For all methods the agent is given a reward of 100 each time it completes the task. Resource interaction means picked up a required resource resource. The methods are:
114
+
115
+ No shaping with sparse reward: Resources spawn uniformly and the agent receives task completion reward.
116
+
117
+ Distance reward shaping: The agent is provided with a dense distance-based reward which grants $( - 0 . 0 1 *$ distance to nearest required resource) and (1) for resource interaction.
118
+
119
+ One-time reward shaping: This is less dense than the distance based reward. The agent is given reward (1) for resource interaction and $- 1 0 0$ for dropping the resource. This resource reward is only granted the first time and resets every time the task is completed.
120
+
121
+ Environment shaping with subgoal reward: We design a simple shaping method that gradually increases the distance away from the agent at which resources spawn. This distances increases linearly until the resources are placed uniformly over the grid world, as in the shaped reward version. We tried various schedules and found a schedule that starts at a distance of 2 and increases by 1 every 1e5 environment steps to work well. The subgoal reward is simpler than the one-time reward. The agent is given reward (1) for resource interaction. This reward does not keep track of previous object interactions and grants the bonus multiple times.
122
+
123
+ Environment shaping with sparse reward: We shape the environment as in the previous method but only use the task reward.
124
+
125
+ Environment shaping can replace reward shaping. We compare performance of these methods in Figure 5 for both the episodic and non-episodic case. We find that, even in the episodic case, environment shaping works well and outperforms reward shaping in the long run. Improper reward shaping can alter the optimal policy, thereby biasing learning and resulting in a solution that is worse
126
+
127
+ ![](images/0efdf540d052076509be282730b717372725807a3f1a3c313bfe633e86530f6a.jpg)
128
+ Figure 5: Proportion of validation tasks solved for environment shaping with sparse reward, subgoal reward, and different forms of reward shaping. We see that environment shaping can obtain better final performance than reward shaping.
129
+
130
+ with respect to the desired performance measure, which typically corresponds to the sparse reward.
131
+ These behaviors are shown in Appendix D.
132
+
133
+ Interestingly, we find that environment shaping works better for the more difficult task of Hunting. As task complexity grows, so does the difficulty of constructing an unbiased shaped reward for the tasks. In this case, environment shaping benefits from its ease of use and general applicability to various tasks. Further experiments on a harder environment are detailed in Appendix C.
134
+
135
+ Human guided environment shaping. In the real world, environment shaping can be done by doing what we already do for other human learners (e.g., children and pupils in school): arranging the environment to be conducive to learning. We also conducted a study of this setting, by having an actual human user interactively specify how the environment should be altered to facilitate the agent’s learning process. In this case, the human user was able to provide an environment shaping schedule that outperformed the one we specified manually. Full results for this experiment are provided in Appendix B. These results suggest that environment shaping is not only effective, but is also readily intuitive for a human user to specify interactively, suggesting that it can be a viable way to provide guidance to reinforcement learning agents and may be intuitive to specify, in comparison with reward shaping, which can at times be difficult and counter-intuitive.
136
+
137
+ # 5.3 EXPERIMENTAL CONCLUSIONS
138
+
139
+ Our experiments confirm hypothesis $H l$ by showing that non-episodic is indeed substantially harder than episodic learning in standard static environments. However, our experiments also show that, for all considered tasks, introducing dynamic effects can allow non-episodic learning to succeed, in some cases to a degree that is comparable to the episodic setting, confirming hypothesis $H 3$ . However, this result is sensitive to the degree of stochasticity, suggesting that the specific dynamics and design of the environment has a large impact on learning. Based on this conclusion, we study how shaping the environment influences the learning process, and conclude that appropriate environment shaping can, in our tasks, supplant the need for more traditional reward shaping, confirming hypothesis $H 2$ . We further show the human users can effectively select environment shaping schedules manually, suggesting that this is an intuitive way to guide the learning of reinforcement learning agents. Our conclusions support the notion that ecological reinforcement learning – the study of the interaction between an RL agent and its environment – is an important topic for further study.
140
+
141
+ # 6 DISCUSSION
142
+
143
+ We study how certain properties of natural environments – namely, non-episodic learning without resets, simple “fundamental drive” reward functions, and dynamic environments that evolve on their own even when the agent does not actively intervene – affect the reinforcement learning process. We use the term ecological reinforcement learning to refer to this sort of study, which aims to analyze interactions between RL agents and the environment in which learning occurs. Although these properties by themselves tend to make learning harder, we find that environments that exhibit several of these traits can actually be easier to learn in, and agents trained in such settings can actually outperform agents trained in more conventional episodic settings on the same evaluation tasks. We conclude that in dynamic environments, the variability of situations created by the environment’s dynamics and simple rewards that are difficult for the agent to exploit can create a kind of natural curriculum that guides an agent through the emergence of increasingly complex behaviors.
144
+
145
+ Aside from these potentially surprising observations, the framework of ecological reinforcement learning also points to a new way to approach the design of RL agents. While reward function design is typically considered the primary modality for specifying tasks to RL agents, ecological reinforcement learning suggests that the form and structure of the environment can help to guide the emergence and specification of skills. Combined with the guidance and curricula afforded by natural environments, this suggests that studying and systematizing the interaction between RL agents and various environment properties is an important and interesting direction for future research.
146
+
147
+ # REFERENCES
148
+
149
+ Maruan Al-Shedivat, Trapit Bansal, Yura Burda, Ilya Sutskever, Igor Mordatch, and Pieter Abbeel. Continuous adaptation via meta-learning in nonstationary and competitive environments. ArXiv, abs/1710.03641, 2017.
150
+
151
+ Charles Beattie, Joel Z. Leibo, Denis Teplyashin, Tom Ward, Marcus Wainwright, Heinrich Kuttler, ¨ Andrew Lefrancq, Simon Green, V´ıctor Valdes, Amir Sadik, Julian Schrittwieser, Keith Ander- ´ son, Sarah York, Max Cant, Adam Cain, Adrian Bolton, Stephen Gaffney, Helen King, Demis Hassabis, Shane Legg, and Stig Petersen. Deepmind lab. CoRR, abs/1612.03801, 2016. URL http://arxiv.org/abs/1612.03801.
152
+
153
+ Marc G. Bellemare, Yavar Naddaf, Joel Veness, and Michael H. Bowling. The arcade learning environment: An evaluation platform for general agents. In J. Artif. Intell. Res., 2013.
154
+
155
+ Yoshua Bengio, Jer´ ome Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ˆ ICML, 2009.
156
+
157
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym. ArXiv, abs/1606.01540, 2016.
158
+
159
+ Tim Brys, Anna Harutyunyan, Halit Bener Suay, Sonia Chernova, Matthew E. Taylor, and Ann Nowe. Reinforcement learning from demonstration through shaping. In ´ IJCAI, 2015.
160
+
161
+ Konstantinos Chatzilygeroudis, Vassilis Vassiliades, and Jean-Baptiste Mouret. Reset-free trialand-error learning for robot damage recovery. Robotics and Autonomous Systems, 100:236–250, 2018.
162
+
163
+ Maxime Chevalier-Boisvert, Lucas Willems, and Suman Pal. Minimalistic gridworld environment for openai gym. https://github.com/maximecb/gym-minigrid, 2018.
164
+
165
+ Sam Devlin and Daniel Kudenko. Dynamic potential-based reward shaping. In AAMAS, 2012.
166
+
167
+ Adrien Ecoffet, Joost Huizinga, Joel Lehman, Kenneth O. Stanley, and Jeff Clune. Go-explore: a new approach for hard-exploration problems. ArXiv, abs/1901.10995, 2019.
168
+
169
+ Eyal Even-Dar, Sham M. Kakade, and Yishay Mansour. Reinforcement learning in pomdps without resets. In IJCAI, 2005.
170
+
171
+ Benjamin Eysenbach, Shixiang Gu, Julian Ibarz, and Sergey Levine. Leave no trace: Learning to reset for safe and autonomous reinforcement learning. ArXiv, abs/1711.06782, 2017.
172
+
173
+ Carlos Florensa, David Held, Xinyang Geng, and Pieter Abbeel. Automatic goal generation for reinforcement learning agents. ArXiv, abs/1705.06366, 2017a.
174
+
175
+ Carlos Florensa, David Held, Markus Wulfmeier, Michael Zhang, and Pieter Abbeel. Reverse curriculum generation for reinforcement learning. In CoRL, 2017b.
176
+
177
+ Robert M French. Catastrophic forgetting in connectionist networks. Trends in cognitive sciences, 3(4):128–135, 1999.
178
+
179
+ Alex Graves, Marc G. Bellemare, Jacob Menick, Remi Munos, and Koray Kavukcuoglu. Automated ´ curriculum learning for neural networks. In ICML, 2017.
180
+
181
+ Shane Griffith, Kaushik Subramanian, Jonathan Scholz, Charles Lee Isbell, and Andrea Lockerd Thomaz. Policy shaping: Integrating human feedback with reinforcement learning. In NIPS, 2013.
182
+
183
+ William H. Guss, Cayden Codel, Katja Hofmann, Brandon Houghton, Noboru Kuno, Stephanie Milani, Sharada Mohanty, Diego Perez Liebana, Ruslan Salakhutdinov, Nicholay Topin, et al. The MineRL competition on sample efficient reinforcement learning using human priors. NeurIPS Competition Track, 2019.
184
+
185
+ Weiqiao Han, Sergey Levine, and Pieter Abbeel. Learning compound multi-step controllers under unknown dynamics. 2015 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 6435–6442, 2015.
186
+
187
+ Nicolas Manfred Otto Heess, TB Dhruva, Srinivasan Sriram, Jay Lemmon, Josh Merel, Greg Wayne, Yuval Tassa, Tom Erez, Ziyu Wang, S. M. Ali Eslami, Martin A. Riedmiller, and David Silver. Emergence of locomotion behaviours in rich environments. ArXiv, abs/1707.02286, 2017.
188
+
189
+ Rein Houthooft, Xi Chen, Yan Duan, John Schulman, Filip De Turck, and Pieter Abbeel. Vime: Variational information maximizing exploration. In NIPS, 2016.
190
+
191
+ Matthew Johnson, Katja Hofmann, Tim Hutton, and David Bignell. The malmo platform for artificial intelligence experimentation. In Proceedings of the Twenty-Fifth International Joint Conference on Artificial Intelligence, IJCAI, 2016.
192
+
193
+ Arthur Juliani, Vincent-Pierre Berges, Esh Vckay, Yuan Gao, Hunter Henry, Marwan Mattar, and Danny Lange. Unity: A general platform for intelligent agents, 2018.
194
+
195
+ Sham M. Kakade and John Langford. Approximately optimal approximate reinforcement learning. In ICML, 2002.
196
+
197
+ Christos Kaplanis, Murray Shanahan, and Claudia Clopath. Continual reinforcement learning with complex synapses. ICML, abs/1802.07239, 2018.
198
+
199
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. CoRR, abs/1412.6980, 2014.
200
+
201
+ James Kirkpatrick, Razvan Pascanu, Neil C. Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A. Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, Demis Hassabis, Claudia Clopath, Dharshan Kumaran, and Raia Hadsell. Overcoming catastrophic forgetting in neural networks. CoRR, abs/1612.00796, 2016.
202
+
203
+ M. Mccloskey. Catastrophic interference in connectionist networks: The sequential learning problem” the psychology. 1989.
204
+
205
+ Teodor Mihai Moldovan and Pieter Abbeel. Safe exploration in markov decision processes. ArXiv, abs/1205.4810, 2012.
206
+
207
+ Andrew Y. $\mathrm { N g }$ , Daishi Harada, and Stuart J. Russell. Policy invariance under reward transformations: Theory and application to reward shaping. In ICML, 1999.
208
+
209
+ Shayegan Omidshafiei, Dong-Ki Kim, Miao Liu, Gerald Tesauro, Matthew Riemer, Christopher Amato, Murray Campbell, and Jonathan P. How. Learning to teach in cooperative multiagent reinforcement learning. In AAAI, 2018.
210
+
211
+ Ian Osband, Charles Blundell, Alexander Pritzel, and Benjamin Van Roy. Deep exploration via bootstrapped dqn. In NIPS, 2016.
212
+
213
+ Deepak Pathak, Pulkit Agrawal, Alexei A. Efros, and Trevor Darrell. Curiosity-driven exploration by self-supervised prediction. 2017 IEEE Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), pp. 488–489, 2017.
214
+
215
+ Jette Randløv and Preben Alstrøm. Learning to drive a bicycle using reinforcement learning and shaping. In ICML, 1998.
216
+
217
+ Martin A. Riedmiller, Roland Hafner, Thomas Lampe, Michael Neunert, Jonas Degrave, Tom Van de Wiele, Volodymyr Mnih, Nicolas Manfred Otto Heess, and Jost Tobias Springenberg. Learning by playing solving sparse reward tasks from scratch. In ICML, 2018.
218
+
219
+ Mark B. Ring. Child: A first step towards continual learning. In Machine Learning, pp. 77–104, 1997.
220
+
221
+ Andrei A. Rusu, Neil C. Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. ArXiv, abs/1606.04671, 2016.
222
+
223
+ Jonathan Schwarz, Jelena Luketina, Wojciech Marian Czarnecki, Agnieszka Grabska-Barwiska, Yee Whye Teh, Razvan Pascanu, and Raia Hadsell. Progress & compress: A scalable framework for continual learning. ArXiv, abs/1805.06370, 2018.
224
+
225
+ Hanul Shin, Jung Kwon Lee, Jaehong Kim, and Jiwon Kim. Continual learning with deep generative replay. In NeurNIPS, 2017.
226
+
227
+ David Silver, Aja Huang, Chris J. Maddison, Arthur Guez, Laurent Sifre, George van den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Vedavyas Panneershelvam, Marc Lanctot, Sander Dieleman, Dominik Grewe, John Nham, Nal Kalchbrenner, Ilya Sutskever, Timothy P. Lillicrap, Madeleine Leach, Koray Kavukcuoglu, Thore Graepel, and Demis Hassabis. Mastering the game of go with deep neural networks and tree search. Nature, 529:484–489, 2016.
228
+
229
+ Avi Singh, Larry Yang, Kristian Hartikainen, Chelsea Finn, and Sergey Levine. End-to-end robotic reinforcement learning without reward engineering. ArXiv, abs/1904.07854, 2019.
230
+
231
+ Sainbayar Sukhbaatar, Ilya Kostrikov, Arthur Szlam, and Rob Fergus. Intrinsic motivation and automatic curricula via asymmetric self-play. ArXiv, abs/1703.05407, 2017.
232
+
233
+ Haoran Tang, Rein Houthooft, Davis Foote, Adam Stooke, Xi Chen, Yan Duan, John Schulman, Filip De Turck, and Pieter Abbeel. #exploration: A study of count-based exploration for deep reinforcement learning. In NIPS, 2016.
234
+
235
+ Emanuel Todorov, Tom Erez, and Yuval Tassa. Mujoco: A physics engine for model-based control. 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 5026–5033, 2012.
236
+
237
+ Hado van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double qlearning. In AAAI, 2015.
238
+
239
+ Rui Wang, Joel Lehman, Jeff Clune, and Kenneth O. Stanley. Paired open-ended trailblazer (POET): endlessly generating increasingly complex and diverse learning environments and their solutions. CoRR, abs/1901.01753, 2019a.
240
+
241
+ Rui Wang, Joel Lehman, Jeff Clune, and Kenneth O. Stanley. Paired open-ended trailblazer (poet): Endlessly generating increasingly complex and diverse learning environments and their solutions. ArXiv, abs/1901.01753, 2019b.
242
+
243
+ Tianhe Yu, Deirdre Quillen, Zhanpeng He, Ryan Julian, Karol Hausman, Chelsea Finn, and Sergey Levine. Meta-world: A benchmark and evaluation for multi-task and meta reinforcement learning. CoRL, 2019.
244
+
245
+ Wenhao Yu, Greg Turk, and Chuanjian Liu. Learning symmetric and low-energy locomotion. ACM Trans. Graph., 37:144:1–144:12, 2018.
246
+
247
+ # A AGENT ARCHITECTURE AND TRAINING
248
+
249
+ We use the same agent network architecture and RL algorithm for all our experiments with minor modification to account for the properties we vary such as reset free RL. Agents are parametrized by an MLP. The environment grid size is $8 \times 8$ . The partial grid observation is flattened and processed by a 2 layer MLP of size (64, 64, 32). The inventory observation is processed by a 2 layer MLP of size (16, 16, 16). These outputs are concatenated and then processed by a final MLP of size (16, action dim). All layers are followed by ReLU nonlinearities except the final layer which uses a softmax to output the action distribution.
250
+
251
+ We train the agents using double DQN (van Hasselt et al., 2015) and the Adam optimizer (Kingma & Ba, 2014) with a learning rate of 0.0001, selected by sweeping across a range of learning rates, with results shown in Figure 6. Training is done in batch mode such that we alternate between collecting 500 environment steps and taking 500 gradient steps (with batch size 256) over the replay buffer of size 5e5. For environments with resets, the horizon length is set to 200. We swept over various horizon lengths and found 200 to work the best. We also tried setting the horizon length very short (20 and 50) to help with the episodic methods but found no effect. We use epsilon greedy exploration for the policy where epsilon starts at 1 and decays linearly by 0.0001 each timestep to 0.1. For each training method we run 10 random seeds.
252
+
253
+ ![](images/442b293f21b72a483c6e1df5c8ca44c583cb634441a9a3cf3a648878ac9172fd.jpg)
254
+ Figure 6: Proportion of validation tasks solved in each setting. Agents learning in static non-episodic environments struggle to learn useful behaviors, while agents learning in dynamic non-episodic environments are substantially more successful. Episodic learning is easier than non-episodic learning on the first task, but non-episodic learning in dynamic environments is almost as effective as episodic learning on the hunting task.
255
+
256
+ # B HUMAN GUIDED ENVIRONMENT SHAPING
257
+
258
+ ![](images/dbd4f5c771bffa7ecaa38ce25688e4b83d38c26686609d1ec4af82b7bdecd8fc.jpg)
259
+ Figure 7: Performance of human guided environment shaping. We ask a human user to interactively shape the environment and observe the human can effectively guide the shaping compared to a predefined environment shaping schedule.
260
+
261
+ In the real world, environment shaping can be done by humans. In this section, we study if a human user can effectively guide the environment shaping during training, instead of using our predefined curriculum. We use the tool-making task in the non-episodic setting with sparse reward. The form of environment shaping is setting the distance from the agent within which resources can spawn, which can be increased over time to “teach” the agent to reach further-away resources. The human is tasked with providing this distance schedule interactively based on the performance of the agent. At each interaction, the human is given a video demonstrating the agent’s current behavior on the training environment and a graph with the agent’s validation performance to date. The human user produces two numbers: the resource spawn distance and for how many training epochs to continue training before requesting another input. This allows the human to adaptively adjust the environment shaping depending on the agent’s performance and minimize the amount of human supervision. Interestingly, the human controlled environment shaping does better than our linearly annealed environment shaping, as shown in Figure 7. The human user specifies a slower resource schedule than our programmed environment shaping.
262
+
263
+ ![](images/33971ce3a2b21989ef9c693e12eed00ff85c9dc0493cdcebcbd8707cf6b4ce63.jpg)
264
+ C ROBUSTNESS OF ENVIRONMENT SHAPING VS. REWARD SHAPING
265
+ Figure 8: Performance of environment shaping and reward shaping on the axe-making task in an environment with wall obstacles. The distance-based reward suffers while environment shaping, despite operating off of a sparse reward, obtains peak validation performance. We find that this advantage in robustness of environment shaping is present in both the episodic and non-episodic settings, but is enhanced in the former.
266
+
267
+ We examine the robustness of the different methods of shaping the learning of the agent by studying the performance of the agent in a more challenging environment which contain walls and are more maze-like. This makes the environment less easily navigable and provides more chances for the agent to become trapped in a particular region of the state space. We find in Figure 8 that environment shaping is the best-performing method under this structural challenge under both episodic and non-episodic settings. However, the episodic setting demonstrates a larger gap between the performance of environment shaping and that of reward shaping. We visualize the state visitation counts of the agent under the different shaping methods in Figures 9 (non-episodic) and 10 (episodic) to understand the differences in performance. In the non-episodic setting, the distance-based reward shaping results in the agent getting trapped in corners and therefore spending a high proportion of time there. This demonstrates that reward shaping can be easier to exploit as it alters the true objective. In contrast environment shaping methods results in greater coverage of the grid. This is consistent with their superior performance in Figure 8.
268
+
269
+ # D LEARNED BEHAVIOR
270
+
271
+ In Figure 11, we demonstrate the learned behavior under environment shaping with a sparse reward and reward shaping with the one-time reward. With environment shaping, the agent accomplishes the desired task in 15 timesteps. On the other hand, despite the fact that the one-time reward provides a reward only for the first interaction with the metal, the reward-shaped agent obtains the metal and repeatedly drops and picks it up afterwards, eventually failing to solve it within the allotted 100 timesteps, demonstrating the biasing effect of reward shaping.
272
+
273
+ In Figure 12, we visualize trajectories from the hunting environment and analyze the learned behavior of two environment-shaped agents, a distance-based reward shaped agent, and a one-time reward shaped agent. The first environment-shaped agent is able to use resources that start out on opposite sides of the world, such that they are never both in view of the agent at the same time. This is notable because the form of environment shaping used is one wherein the agent is provided with resources near it and gradually weaned off over time. The second environment-shaped agent, while presented with a task in which the resources start out on adjacent squares, faces the challenge of the deer moving right before the agent approaches it. We observe that the trained policy is able to make a second attempt at catching the deer, and is successful. The agent trained with distance-based reward shaping displays suboptimal behavior of approaching the axe and then the deer while failing to interact with either, which can be seen as a bias resulting from a reward that incentivizes proximity to resources. Finally, the agent trained with one-time reward shaping also shows suboptimal behavior that is explained by the biases of the reward. The agent picks up the axe and then remains stationary throughout the remainder of the trajectory, failing to hunt the deer due to a reward that provides it a small reward bonus for accomplishing the first portion of the task.
274
+
275
+ ![](images/a96d248b8c8ce80a18a381840894e7c0f1e801edee7ac45c210e47bc5edb7c12.jpg)
276
+ Figure 9: State visitation counts for the non-episodic setting visualized at 4 stages during training under the different methods of shaping. Yellow corresponds to high visitation, dark purple corresponds to low visitation. The darkest purple around the borders and in the map correspond to walls, which cannot be traversed by the agent. We find that the distance-based reward shaping results in the agent getting stuck in the corners of the grid, while the one-time reward and both environment shaping methods result in the most uniform state visitation distribution over the grid during training, indicating that they were able to traverse the grid and explaining their superior performance shown in Figure 8.
277
+
278
+ ![](images/1333f5e91dd24befb57d79137f3aea567ff20cc9a04a50615a5bb458b1cab812.jpg)
279
+ Figure 10: State visitation counts for the episodic setting visualized at 4 stages during training under the different methods of shaping. Yellow corresponds to high visitation, dark purple corresponds to low visitation. The darkest purple around the borders and in the map correspond to walls, which cannot be traversed by the agent. All shaping methods result in a more uniform state visitation distribution than in the non-episodic setting in Figure 9, which aligns with intuition since the resets in the episodic setting help the agent get “unstuck.”
280
+
281
+ ![](images/59e3c911bca86d9277dc5c3fd787b86ebf393f308c24c0b7e6efbe41ad8cb55d.jpg)
282
+ Figure 11: Sample trajectories on validation environments demonstrating learned behavior trained under environment shaping with sparse reward (left) as well as under shaping with the one-time reward (right), both in the non-episodic setting. The shaded region represents the agent’s ego-centric partial view of the environment.
283
+
284
+ ![](images/2595169463c02b01ea535e5d6c22dee3a2bb551b6a0e10ea27a21b53ea470fa9.jpg)
285
+ Figure 12: Sample trajectories on validation environments demonstrating learned behavior trained under environment shaping with sparse reward (top two), distance-based reward shaping (third), and one-time reward shaping (bottom), all in the non-episodic setting. While the environment shaped agents accomplish the desired task within 15 timesteps, biased task specification in the last two result in interpretable but suboptimal behavior. The distance-based reward shaped agent goes to the correct resources in order, but without interacting with either. The one-time reward shaped agent picks up the axe, but fails to do anything afterwards. Both reward shaped agents here fail to solve the task within the allotted 100 timesteps.
md/train/S1zk9iRqF7/S1zk9iRqF7.md ADDED
@@ -0,0 +1,458 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PATE-GAN: GENERATING SYNTHETIC DATA WITHDIFFERENTIAL PRIVACY GUARANTEES
2
+
3
+ James Jordon∗
4
+ Engineering Science Department
5
+ University of Oxford, UK
6
+ james.jordon@wolfson.ox.ac.uk
7
+ Jinsung Yoon∗
8
+ Department of Electrical and Computer Engineering
9
+ UCLA, California, USA
10
+ jsyoon0823@g.ucla.edu
11
+ Mihaela van der Schaar
12
+ University of Cambridge, UK
13
+ Department of Electrical and Computer Engineering, UCLA, California, USA
14
+ Alan Turing Institute, London, UK
15
+ mihaela@ee.ucla.edu
16
+
17
+ # ABSTRACT
18
+
19
+ Machine learning has the potential to assist many communities in using the large datasets that are becoming more and more available. Unfortunately, much of that potential is not being realized because it would require sharing data in a way that compromises privacy. In this paper, we investigate a method for ensuring (differential) privacy of the generator of the Generative Adversarial Nets (GAN) framework. The resulting model can be used for generating synthetic data on which algorithms can be trained and validated, and on which competitions can be conducted, without compromising the privacy of the original dataset. Our method modifies the Private Aggregation of Teacher Ensembles (PATE) framework and applies it to GANs. Our modified framework (which we call PATE-GAN) allows us to tightly bound the influence of any individual sample on the model, resulting in tight differential privacy guarantees and thus an improved performance over models with the same guarantees. We also look at measuring the quality of synthetic data from a new angle; we assert that for the synthetic data to be useful for machine learning researchers, the relative performance of two algorithms (trained and tested) on the synthetic dataset should be the same as their relative performance (when trained and tested) on the original dataset. Our experiments, on various datasets, demonstrate that PATE-GAN consistently outperforms the stateof-the-art method with respect to this and other notions of synthetic data quality.
20
+
21
+ # 1 INTRODUCTION
22
+
23
+ More and more large datasets are becoming available in a wide variety of communities. In the U.S. medical community, for example, the fraction of providers using electronic health records (EHR) increased from $9 . 4 \%$ in 2008 to $8 3 . 8 \%$ in 2015 [20]. The availability of large datasets presents enormous opportunities for collaboration between the data-holders and the machine learning community. However, many of these large datasets, especially EHR, include sensitive information that prevents data-holders from sharing the data.
24
+
25
+ The most common way to mitigate the privacy risk of sharing sensitive records is to de-identify the records - but it is by now well-known that records that have been de-identified can be easily re-identified by linking them to other identifiable datasets [30; 13; 24; 22; 14]. (This is especially true for medical records of patients who have rare diseases.) However, if the purpose of sharing the data is to develop and validate machine learning methods for a particular task (e.g. prognostic risk scoring), real data is not necessary; it would suffice to have synthetic data that is sufficiently like the real data.
26
+
27
+ Precisely what this means depends on how the synthetic data will be used. For example, the synthetic data may be used to train models that will be deployed directly on real data. In this setting it is important that these methods (which we trained entirely on synthetic data) perform as well as if they had been trained on real data. Another setting to consider is one in which data-holders wish to use the synthetic data to identify the best method(s) to be used on the real data [11]. In this setting, it is not important that training on synthetic data leads to good performance on real data, but rather that comparing two methods on the synthetic data results in conclusions similar to those that would have been drawn from comparing the two methods on the real data. We evaluate our method in both settings.
28
+
29
+ Generative Adversarial Networks (GAN) [19] provide a powerful method for using real data to generate synthetic data but it does not provide any rigorous privacy guarantees. Our method modifies the GAN machinery in a way that does guarantee privacy; the synthetic data is (differentially) private [12] with respect to the original data. To do this we modify the training procedure of the discriminator to be differentially private by using a modified version of the Private Aggregation of Teacher Ensembles (PATE) [25; 26] framework. The Post-Processing Theorem [12] then guarantees that the GAN generator - which is trained only using the differentially private discriminator - will also be differentially private and thus so will the synthetic data it generates. We call our proposed framework PATE-GAN.
30
+
31
+ Using two Kaggle datasets, two different real-world medical datasets and two UCI datasets, we evaluate the utility of the samples generated by PATE-GAN in various settings with various levels of differential privacy. In line with the settings outlined above, we consider two methods for evaluating the similarity of synthetic datasets with a real dataset. The first method, first proposed in [15], compares the predictive performance of models trained on the synthetic datasets and tested on the real dataset. The second method, which we propose for the first time here, compares the performance rankings of predictive models on the synthetic datasets with their performance rankings on the real dataset. We demonstrate that, for both of these methods, PATE-GAN consistently produces synthetic datasets that are ”more like” the original real dataset than the synthetic datasets produced by the state-of-the-art benchmark (DPGAN [32]).
32
+
33
+ The contributions of this paper can be summarized as follows: (1) we modify the PATE framework and apply it to GANs to generate synthetic data, (2) we demonstrate in the experiments section that using PATE to enforce differential privacy results in higher quality synthetic data than DPGAN using various real-world datasets, (3) we propose a novel new metric for evaluating the generated synthetic data.
34
+
35
+ # 2 RELATED WORKS
36
+
37
+ The most related previous work to this paper is DPGAN [32]. Like us, DPGAN proposes a framework for modifying the GAN framework to be differentially private, also relying on the PostProcessing Theorem to change the problem of learning a differentially private generator to learning a differentially private discriminator. Their work uses a technique introduced by [1] that provides a differentially private mechanism for training deep networks. The key idea is that noise is added to the gradient of the discriminator during training to create differential privacy guarantees. These ideas are also used in [2]. Our method is similar in spirit; during training of the discriminator differentially private training data is used, which results in noisy gradients, however, we use the mechanism introduced in [25] which we believe gives tighter differential privacy guarantees (via tighter bounds on the effect of a single sample) than those provided in [1]. This means that for the same privacy guarantees, our method is capable of producing higher quality synthetic data. For a visual representation of both PATE-GAN and DPGAN, see the Appendix.
38
+
39
+ The proposed model modifies the PATE framework [25; 26] for use in a generative model setting (specifically for use with GANs). The key to the GAN framework is that the discriminator is a differentiable module trained to classify samples as either real or generated. The PATE framework provides a differentially private mechanism for classification by training multiple teacher models on disjoint partitions of the data. To classify a new sample each teacher’s output is evaluated on the sample and then all outputs are noisily aggregated. This noisy aggregation, though, results in a classifier that is not differentiable with respect to the parameters of the generator. In order to overcome this problem we follow the idea of the student model, also proposed in [25], that involves taking some public unlabelled data, labelling it using the standard PATE mechanism and then training the student using the resulting labelled data. Because access to any public data is often an unreasonable assumption in synthetic data generation, we adapt this training paradigm in a way that does not require public data by training the student using only outputs from the (differentially private) generator.
40
+
41
+ Some previous works generate synthetic data using summary statistics of the original data [23] or based on specific domain-knowledge [6]; however, those methods are limited to low-dimensional feature spaces, specific fields and do not provide any differential privacy guarantees. [9] generates synthetic patient records using a GAN framework. However, [9] focuses only on generating discrete variables, whereas PATE-GAN is capable of generating mixed-type (continuous, discrete, and binary) variables. Furthermore, [9] also does not provide any differential privacy guarantees and instead uses ad-hoc notions of privacy which are only validated empirically.
42
+
43
+ Finally, it is worth remarking that it is known to be hard in the worst-case to generate private synthetic data [31] and so techniques such as GANs are necessary to address this challenge.
44
+
45
+ # 3 BACKGROUND
46
+
47
+ Let us denote the feature space by $\mathcal { X }$ , the label space by $\mathcal { V }$ and write $\mathcal { U } = \mathcal { X } \times \mathcal { Y }$ . Let the dimension of $\mathcal { U }$ be $d$ . Suppose that $\mathbf { X }$ and $Y$ are random variables over $\mathcal { X }$ and $\mathcal { V }$ . We write $\mathbf { U } = ( \mathbf { X } , Y )$ and $\mathbf { x } , y , \mathbf { u }$ to denote realizations med i.i.d. according to $\mathbf { X } , Y$ and oted $\mathbf { U }$ , $\mathcal { D }$ onsists of . $N$ samples of $\mathbf { u }$ ${ \mathcal { P } } _ { U }$ $\mathcal { D } \overset { ^ { . } } { = } \{ \mathbf { u } _ { i } \} _ { i = 1 } ^ { \check { N } } = \{ ( \mathbf { x } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N }$
48
+
49
+ # 3.1 DIFFERENTIAL PRIVACY
50
+
51
+ We first provide some preliminaries on differential privacy [12] before describing PATE-GAN; we refer interested readers to [12] for a thorough exposition of differential privacy. We will denote an algorithm by $\mathcal { M }$ , which takes as input a dataset $\mathcal { D }$ and outputs a value from some output space, $\mathcal { O }$ .
52
+
53
+ Definition 1. (Neighboring Datasets) Two datasets $\mathcal { D } , \mathcal { D } ^ { \prime }$ are said to be neighboring if
54
+
55
+ $$
56
+ \exists x \in { \mathcal { D } } s . t . { \mathcal { D } } \setminus \{ x \} = { \mathcal { D } } ^ { \prime } .
57
+ $$
58
+
59
+ Definition 2. (Differential Privacy) $A$ randomized algorithm, $\mathcal { M }$ , is $( \epsilon , \delta )$ -differentially private if for all $s \subset \mathcal { O }$ and for all neighboring datasets $\mathcal { D } , \mathcal { D } ^ { \prime }$ :
60
+
61
+ $$
62
+ \mathbb { P } ( \mathcal { M } ( \mathcal { D } ) \in \mathcal { S } ) \leq e ^ { \epsilon } \mathbb { P } ( \mathcal { M } ( \mathcal { D ^ { \prime } } ) \in \mathcal { S } ) + \delta
63
+ $$
64
+
65
+ where $\mathbb { P }$ is taken with respect to the randomness of $\mathcal { M }$
66
+
67
+ Differential privacy provides an intuitively understandable notion of privacy - a particular sample’s inclusion or exclusion in the dataset does not change the probability of a particular outcome very much: it does so by a multiplicative factor of $e ^ { \epsilon }$ and an additive amount, $\delta$ .
68
+
69
+ The following theorem, a proof of which can be found in [12], allows us to move the burden of differential privacy to the discriminator; the differential privacy of the generator will follow by the theorem.
70
+
71
+ Theorem. (Post-processing) Let $\mathcal { M }$ be an $( \epsilon , \delta )$ -differentially private algorithm and let $f : \mathcal { O } \mathcal { O } ^ { \prime }$ where $\mathcal { O } ^ { \prime }$ is any arbitrary space. Then $f \circ { \mathcal { M } }$ is $( \epsilon , \delta )$ -differentially private.
72
+
73
+ # 3.2 PRIVATE AGGREGATION OF TEACHER ENSEMBLES (PATE)
74
+
75
+ In this section we describe the PATE mechanism first defined in [25] and later improved upon by [26]. The PATE mechanism provides a differentially private method for classification, a core component of the GAN framework; the discriminator is a classifier trained to identify whether samples are real/fake.
76
+
77
+ In order to build a differentially private classifier, the dataset is first divided into $k$ disjoint subsets $\mathcal { D } _ { 1 } , . . . , \mathcal { D } _ { k }$ . $k$ classifiers, $T _ { 1 } , . . . , T _ { k }$ (referred to as teachers) are then trained separately on the $k$ sub-datasets (i.e. $T _ { i }$ is only trained on $\mathcal { D } _ { i }$ ). Given a new input feature vector $\mathbf { x }$ to classify, the differentially private output is given by passing $\mathbf { x }$ to each of the $k$ teachers, and then performing a noisy aggregation of the resulting outputs.
78
+
79
+ Formally, given the $k$ teachers, $m$ possible classes and an input feature vector, $\mathbf { x }$ , set
80
+
81
+ $$
82
+ n _ { j } ( \mathbf { x } ) = | \{ T _ { i } : T _ { i } ( \mathbf { x } ) = j \} | \ \mathrm { f o r } \ j = 1 , . . . , m
83
+ $$
84
+
85
+ so that $n _ { j } ( \mathbf { x } )$ is the number of teachers that output class $j$ for $\mathbf { x }$ . The output of the $\mathrm { P A T E } _ { \lambda }$ mechanism for input $\mathbf { x }$ is then defined as
86
+
87
+ $$
88
+ \mathrm { P A T E } _ { \lambda } ( \mathbf { x } ) = \underset { j \in [ m ] } { \arg \operatorname* { m a x } } ( n _ { j } ( \mathbf { x } ) + Y _ { j } )
89
+ $$
90
+
91
+ where $Y _ { 1 } , . . . , Y _ { m }$ are i.i.d. $L a p ( \lambda )$ random variables. The following result, found in [25], follows from [12].
92
+
93
+ Theorem. The output of a single query to the $P A T E _ { \lambda }$ mechanism is $\textstyle { \bigl ( } { \frac { 1 } { \lambda } } , 0 { \bigr ) }$ -differentially private.
94
+
95
+ In order to apply this framework in the GAN framework, however, we require that the discriminator be differentiable, which the output of this classification mechanism is not (note that accessing the internal parameters of the teachers would violate differential privacy, the only thing we have access to in this case is the output). Instead, we draw on the PATE extension (also introduced in [25]) in which a student model is trained. This student model (after being trained) is free to access, not only its outputs given inputs but also its internal parameters. The model itself is differentially private.
96
+
97
+ Formally, the student, $S$ , is a classifier that is trained by taking some public, unlabelled data, $\mathbf { \mathcal { P } } = \{ \tilde { \mathbf { x } _ { i } } \} _ { i = 1 } ^ { K }$ , passing each sample, $\mathbf { x } _ { i }$ , through the (standard) PATE mechanism, to receive a differentially private label, $\hat { y } _ { i }$ , and forming a new (noisy-)teacher-labelled dataset $\hat { \mathcal { P } } = \{ ( \mathbf { x } _ { i } , \hat { y } _ { i } ) \} _ { i = 1 } ^ { K }$ on which the student is then trained.
98
+
99
+ Importantly, we can make the student differentiable - it can be modelled using any classifier, such as a neural net. Moreover, querying the student is “free” - there is no privacy cost associated with passing an input to the student and receiving an output, the only privacy cost is in acquiring the data on which to train the student. We state the following result which follows from the analysis in [25].
100
+
101
+ Theorem. The student, $S$ , trained on the dataset $\hat { \mathcal { P } }$ where labels were generated according to the $P A T E _ { \lambda }$ mechanism using $\begin{array} { r } { \lambda = \frac { K } { 2 \epsilon } } \end{array}$ , is $( \epsilon , 0 )$ -differentially private with respect to the original data $\mathcal { D }$ .
102
+
103
+ # 4 PROPOSED METHOD: PATE-GAN
104
+
105
+ The proposed method builds on GAN and PATE frameworks. We replace the GAN discriminator with a PATE mechanism so that our discriminator is differentially private, but require the (differentiable) student version to allow back-propagation to the generator. We modify the implementation of the student, noting that the training paradigm presented in [25] is not appropriate for this setting due to the lack of publicly available data. Before training, we partition the dataset into $k$ subsets, $\mathcal { D } _ { 1 } , . . . , \mathcal { D } _ { k }$ , with $\begin{array} { r } { | \mathcal { D } _ { i } | = \frac { | \mathcal { D } | } { k } } \end{array}$ for $\forall i$ .
106
+
107
+ # 4.1 GENERATOR
108
+
109
+ The generator, $G$ , is as in the standard GAN framework. Formally it is a function $G ( \cdot ; \theta _ { G } ) \ :$ $[ 0 , 1 ] ^ { \breve { d } } \mathcal { U }$ , parametrized by $\theta _ { G }$ that takes random noise, $\mathbf { z } \sim \mathrm { U n i f } ( [ 0 , 1 ] ^ { d } )$ , as input and outputs a vector in $\mathcal { U } = \mathcal { X } \times \mathcal { Y }$ . The generator will be trained to minimize its loss with respect to the student-discriminator. Given $n$ i.i.d. samples of $\mathrm { U n i f } ( [ 0 , 1 ] ^ { d } )$ , $\mathbf { z } _ { 1 } , . . . , \mathbf { z } _ { n }$ , the empirical loss of $G$ at $\theta$ for fixed $S$ is defined by
110
+
111
+ $$
112
+ \mathcal { L } _ { G } ( \theta _ { G } ; S ) = \sum _ { j = 1 } ^ { n } \log ( 1 - S ( G ( \mathbf { z } _ { j } ; \theta _ { G } ) ) ) .
113
+ $$
114
+
115
+ We will denote by $\mathcal { P } _ { G }$ the distribution induced by $G$ over $\mathcal { U }$ .
116
+
117
+ # 4.2 DISCRIMINATOR
118
+
119
+ In the standard GAN framework, there is a single discriminator, $D$ , that is trained in a directly adversarial fashion with $G$ , where at each iteration either $G$ is trying to improve its loss with respect to $D$ or $D$ is trying to improve its loss with respect to $G$ . In our proposed model, however, we replace $D$ with the PATE mechanism. This means we introduce $k$ teacher-discriminators, $T ^ { 1 } , . . . , T ^ { k }$ , and a student discriminator, $S$ . A noticeable difference is that the adversarial training is no longer symmetrical: the teachers are now being trained to improve their loss with respect to $G$ but $G$ is being trained to improve its loss with respect to the student $S$ which in turn is being trained to improve its loss with respect to the teachers.
120
+
121
+ # 4.2.1 TEACHER-DISCRIMINATORS
122
+
123
+ Formally, the teacher-discriminators (which we will refer to simply as teachers) are functions $T _ { 1 } ( \cdot ; \theta _ { T } ^ { 1 } ) , . . . , T _ { k } ( \cdot ; \theta _ { T } ^ { k } ) : \mathcal { U } \to [ 0 , 1 ]$ each parametrized by $\theta _ { T } ^ { i }$ . The teachers are given either a real sample from their corresponding partition of the dataset (i.e. $T _ { i }$ may receive a sample from $\mathcal { D } _ { i }$ ) as input or a sample from the generator. The teachers are then trained to classify them.
124
+
125
+ Given $n$ i.i.d. samples of $\mathrm { U n i f } ( [ 0 , 1 ] ^ { d } )$ , $\mathbf { z } _ { 1 } , . . . , \mathbf { z } _ { n }$ , we define the empirical loss of teacher $i$ with weights $\theta _ { T } ^ { i }$ for fixed $G$ by
126
+
127
+ $$
128
+ \mathcal { L } _ { T } ^ { i } ( \theta _ { T } ^ { i } ) = - \Big [ \sum _ { \mathbf { u } \in \mathcal { D } _ { i } } \log T _ { i } ( \mathbf { u } ; \theta _ { T } ^ { i } ) + \sum _ { j = 1 } ^ { n } \log ( 1 - T _ { i } ( G ( \mathbf { z } _ { j } ) ; \theta _ { T } ^ { i } ) ) \Big ] .
129
+ $$
130
+
131
+ Each teacher is trained in the same way the discriminator is trained in a standard GAN framework, except that here the teacher only ever sees its partition of the real data.
132
+
133
+ # 4.2.2 STUDENT-DISCRIMINATORS
134
+
135
+ The main innovation of our paper comes from our implementation of the student-discriminator (which we will refer to simply as the student) in this setting. The differential privacy guarantee provided by the standard student model is only with respect to the original data, $\mathcal { D }$ , and not the public data, $\mathcal { P }$ , used to train the student. In our setting, where the entire focus is on generating synthetic data because no data is publicly available, we must propose a novel methodology to train the student without public data.
136
+
137
+ We first note, that the student training paradigm described in [25] would involve training the student using data similar to that used to train the generator - i.e. by taking an equal number of samples from each and then labelling those using the standard $\mathrm { P A T E } _ { \lambda }$ mechanism (where here “labelling” refers to assigning them a real/fake label - not the label $y$ present in the data). We consider the implications of training the student on teacher-labelled generated samples only.
138
+
139
+ We first observe that during training of the generator, the discriminator is only evaluated on samples from the generator itself, and not the real data, so by training the student only on generated samples we are in fact training it on the distribution we need it to perform well on. However, we note that if the student only sees unrealistic samples from the generator (i.e. generated samples that most teachers label as fake), then the student will not contain any information that the generator can use to improve its generated samples. It is therefore important that some of the generated samples the student is trained on are realistic. We then note that if $\operatorname { S u p p } ( \mathcal { P } _ { U } ) \subset \operatorname { S u p p } ( \mathcal { P } _ { G } )$ then some of the generated samples will be realistic.
140
+
141
+ In order to ensure $\operatorname { S u p p } ( { \mathcal { P } } _ { U } ) \subset \operatorname { S u p p } ( { \mathcal { P } } _ { G } )$ , we normalize the data into $[ 0 , 1 ] ^ { d }$ and then initialize the parameters of the generator randomly using Xavier initialization. It follows that $\operatorname { S u p p } ( \mathcal { P } ) \subset$ $[ 0 , \hat { 1 ] } ^ { d } \subset G ( [ 0 , 1 ] ^ { d } ) = \mathbf { \bar { \Gamma } } ^ { } G ( \operatorname { S u p p } ( \mathbf { Z } ) ) = \operatorname { S u p p } ( G ( \mathbf { Z } ) )$ when $\mathbf { Z } \sim \operatorname { U n i f } ( [ 0 , 1 ] ^ { d } )$ .
142
+
143
+ We create our training data for the student by taking $n$ i.i.d. samples of $\mathrm { U n i f } ( [ 0 , 1 ] ^ { d } )$ , $\mathbf { z } _ { 1 } , . . . , \mathbf { z } _ { n }$ , generating $n$ samples using the generator, $\hat { \mathbf { u } } _ { 1 } , . . . , \hat { \mathbf { u } } _ { n }$ with $\hat { \mathbf { u } } _ { j } = G ( \mathbf { z } _ { j } )$ , and using the teachers to label these using $\mathrm { P A T E } _ { \lambda }$ , setting $r _ { j } = \mathrm { P A T E } _ { \lambda } ( \hat { \mathbf { u } } _ { j } )$ . We train the student, $S ( \cdot ; \theta _ { S } ) \overset { \cdot } { : } \mathcal { U } [ 0 , 1 ]$ , to maximize the standard cross-entropy loss on this teacher-labelled data, i.e.
144
+
145
+ $$
146
+ \mathcal { L } _ { S } ( \boldsymbol { \theta } _ { S } ) = \sum _ { j = 1 } ^ { n } r _ { j } \log S ( \hat { \mathbf { u } } _ { j } ; \boldsymbol { \theta } _ { S } ) + ( 1 - r _ { j } ) \log ( 1 - S ( \hat { \mathbf { u } } _ { j } ; \boldsymbol { \theta } _ { S } ) ) .
147
+ $$
148
+
149
+ Although a priori the above mechanism does not appear to depend on the number of teachers, it should be noted that for fixed $\lambda$ , more teachers results in the teacher-labelled dataset being less noisy - the noise being added is smaller relative to the counts $n _ { j }$ . This introduces a trade-off - for a small number of teachers, the noise may be too large and thus render the output meaningless; with a larger number of teachers, less data can be used to train each teacher, which may also render the output meaningless, even though the noise has a smaller effect. Finding the right balance in this problem is key. In our experiments, we use $d$ real and $d$ generated samples to train each teacher where $d$ is the dimension of the input space. Although the utility of a single teacher may be low, by aggregating (even noisily) the resulting classifier actually has high utility. Moreover, by using a minimal number of samples for each teacher, the effect of any individual sample on the output is small (because there are more teachers and each sample can effect at most 1 teacher) which means that our differential privacy guarantees are tighter - if we used fewer teachers, the mechanism still assumes that, in the worst case, the presence (or absence) of a single sample can completely flip a teacher’s vote and so we still need to add the same noise.
150
+
151
+ We train $G , T ^ { 1 } , . . . , T ^ { k }$ and $S$ iteratively1, with each iteration of $G$ consisting of first performing $n _ { T }$ updates on all teachers, then performing $n _ { S }$ updates of the student. We perform generator iterations until our privacy constraint, $\epsilon .$ , has been reached. A block diagram of PATE-GAN can be found in the Appendix.
152
+
153
+ To calculate the privacy of our algorithm we use the moments accountant method given in [25] to derive a data-dependent privacy guarantee at run-time. Details of its definition, and key results we use can be found in the Appendix. We denote the moments accountant of PATE-GAN by $\alpha ( l )$ . The moments accountant allows us to more tightly bound the total privacy cost of our mechanism than standard composition theorems would, and moreover attributes a lower privacy cost to accessing the noisy aggregation of the teachers when the teachers have a stronger consensus with the intuition being that when the teachers have a strong consensus, a single teacher (and therefore a single sample) has a much lower influence on the output than when the votes $\cdot n _ { 0 }$ and $n _ { 1 }$ ) are close. Pseudo-code for PATE-GAN can be found in Algorithm 1.
154
+
155
+ We now state the main theorem of the paper, which follows from the theory in [25].
156
+
157
+ Theorem 1. Algorithm 1, which takes as input $\delta > 0$ , a dataset, $\mathcal { D }$ , and outputs $G$ and $\epsilon$ is $( \epsilon , \delta )$ differentially private.
158
+
159
+ The proof relies on applying the post-processing theorem where the discriminator corresponds to the mechanism $\mathcal { M }$ which takes outputs in $\mathcal { O }$ (in our case this corresponds to the weights of the discriminator), and the generator corresponds to the function $f$ which maps from $\mathcal { O }$ to $\mathcal { O }$ (which corresponds to the weights of the generator). For full details of the proof and further details of the theory required for it, see the Appendix.
160
+
161
+ # 5 EXPERIMENTS
162
+
163
+ In this section, we use a real-world Kaggle dataset (Credit card fraud detection dataset [11]) to evaluate PATE-GAN against the state-of-the-art benchmark (DPGAN [32]). In addition, we provide high-level (average) results for five additional datasets (with various characteristics): MAGGIC [27], UNOS-Heart wait-list [7], Kaggle cervical cancer dataset [16], UCI ISOLET dataset and UCI Epileptic Seizure Recognition dataset. A more detailed breakdown of the results for these datasets is given in the Appendix. Details of all six datasets can be also found in the Appendix.
164
+
165
+ # 5.1 EXPERIMENTAL SETTINGS
166
+
167
+ To empirically validate the quality of the generated dataset we introduce three different trainingtesting settings. Setting A: train the predictive models on the real training set, test the performance of the models on the real testing set. Setting $B$ : train on the synthetic training set, test on the real testing set ([15]), Setting $C .$ : train on the synthetic training set, test on the synthetic testing set. Note that the training set and the testing set are disjoint in both the real and synthetic datasets.
168
+
169
+ We are interested in two comparisons. If we see a high predictive performance on the real data for models that were trained on synthetic data (Setting B), we can infer that the synthetic data has
170
+
171
+ # Algorithm 1 Pseudo-code of PATE-GAN
172
+
173
+ 1: Input: δ, $\mathcal { D }$ , $n _ { T }$ , $n _ { S }$ , batch size $n$ , number of teachers $k$ , noise size $\lambda$
174
+ 2: Initialize: $\theta _ { G }$ ${ \bf \Sigma } _ { G } , \theta _ { T } ^ { 1 } , . . . , \theta _ { T } ^ { k }$ , $\theta _ { S }$ , $\alpha ( l ) = 0$ for $l = 1 , . . . , L$
175
+ 3: Partition dataset into $k$ subsets $\mathcal { D } _ { 1 } , . . . , \mathcal { D } _ { k }$ of size $\frac { | { \mathcal { D } } | } { k }$
176
+ 4: while $\hat { \epsilon } < \epsilon$ do
177
+ 5: 6: for $t _ { 2 } = 1 , . . . , n _ { T }$ Sample $\mathbf { z } _ { 1 } , . . . , \mathbf { z } _ { n } \overset { \mathrm { i . i . d . } } { \sim } \mathcal { P } _ { \mathcal { Z } }$ do
178
+ 7: for $i = 1 , . . . , k$ do
179
+ 8: Sample $\mathbf { u } _ { 1 } , . . . , \mathbf { u } _ { n } \stackrel { \mathrm { i . i . d . } } { \sim } { \mathcal { D } } _ { i }$
180
+ 9: Update teacher, $T _ { i }$ , using SGD
181
+ 10: $\begin{array} { r } { \nabla _ { \theta _ { T } ^ { i } } - \left[ \sum _ { j = 1 } ^ { d } \log ( T _ { i } ( \mathbf { u } _ { j } ) ) + \log ( 1 - T _ { i } ( G ( \mathbf { z } _ { j } ) ) ) \right] } \end{array}$
182
+ 11: 12: for Sample $t _ { 3 } = 1 , . . . , n _ { S }$ $\mathbf { z } _ { 1 } , . . . , \mathbf { z } _ { n } \overset { ^ { 1 . 1 . 0 } } { \sim } \mathcal { P } _ { \mathcal { Z } }$ do
183
+ 13: for $j = 1 , . . . , n$ do
184
+ 14: $\hat { \mathbf { u } } _ { j } G ( \mathbf { z } _ { j } )$
185
+ 15: $r _ { j } \gets \mathrm { P A T E } _ { \lambda } ( \hat { \mathbf { u } } _ { i } )$ for $j = 1 , . . . , n$
186
+ 16: Update moments accountant
187
+ 17: q ← 4 exp(λ|n0−n1|) 2+λ|n0−n1|
188
+ 18: for $l = 1 , . . . , L$ do
189
+ 19: $\alpha ( l ) \gets \alpha ( l ) + \operatorname* { m i n } \{ 2 \lambda ^ { 2 } l ( l + 1 ) , \log ( \left( 1 - q \right) \left( \frac { 1 - q } { 1 - e ^ { 2 \lambda } q } \right) ^ { l } + q e ^ { 2 \lambda l } ) \}$
190
+ 20: Update the student, $S$ , using SGD
191
+ 21: $\begin{array} { r } { \dot { \nabla _ { \theta _ { S } } } - \sum _ { j = 1 } ^ { n } r _ { j } \log S ( \hat { \mathbf { u } } _ { j } ) \stackrel { \smile } { + } ( 1 - r _ { j } ) \log ( 1 - S ( \hat { \mathbf { u } } _ { j } ) ) } \end{array}$
192
+ 22: Sample z1, ..., zn i.i.d. ∼ PZ
193
+ 23: Update the generator, $G$ , using SGD
194
+ 24: ∇θG - Pni=1 log(1 − S(G(zi))
195
+ 25: ˆ ← min α(l)+log( 1δ ) l l
196
+
197
+ captured the relationship between features and labels well. Moreover, synthetic data that does well in this setting can be used to train models without ever seeing the real data.
198
+
199
+ On the other hand, when we consider synthetic data for use in competitions such as Kaggle, we need synthetic data that allows researchers to do meaningful comparisons on the synthetic data. In this setting, the researchers will only be able to use the synthetic data as both the training and testing set, and will need to develop their algorithms using results on the synthetic data. Now it becomes important that the relative performance of two algorithms when trained and tested on the synthetic data (Setting C), is similar to their relative performance when trained and tested on the real data (Setting A). A simple requirement would be that if model 1 is better than model 2 on the real data, then model 1 is better than model 2 on the synthetic data. This allows researchers to use the synthetic data to choose the best method(s) to try on the real data (or rather to give to the data-holder to try on the real data).
200
+
201
+ For both comparisons, we use 12 different predictive models, shown in Table 1. We use two performance metrics to measure the capability of each model in predicting the label: (1) area under the receiver operating characteristics curve (AUROC), (2) area under the precision recall curve (AUPRC). Throughout the experiments we fix $\delta = 1 0 ^ { - 5 }$ for use as input to PATE-GAN and DPGAN. We also report the performance of the original GAN framework (”GAN”), which serves to indicate an upper bound on performance and allows us to see how much performance is lost due to the two differential privacy mechanisms (PATE-GAN and DPGAN). The details of hyper-parameter optimization and benchmark implementations can be found in the Appendix.
202
+
203
+ <table><tr><td rowspan="2"></td><td colspan="3">三 AUROC</td><td colspan="3">川I AUPRC</td></tr><tr><td>II GAN</td><td>PATE-GAN</td><td>DPGAN</td><td>GAN</td><td>PATE-GAN</td><td>DPGAN</td></tr><tr><td>Logistic Regression</td><td>0.8950</td><td>0.8728</td><td>0.8720</td><td>0.4069</td><td>0.3907</td><td>0.3923</td></tr><tr><td>Random Forests [5]</td><td>0.9075</td><td>0.8980</td><td>0.8730</td><td>0.3219</td><td>0.3157</td><td>0.2926</td></tr><tr><td>Gaussian Naive Bayes [29]</td><td>0.8861</td><td>0.8817</td><td>0.8522</td><td>0.1963</td><td>0.1858</td><td>0.1601</td></tr><tr><td>Bermoulli Naive Bayes [29]</td><td>0.8997</td><td>0.8968</td><td>0.8891</td><td>0.2169</td><td>0.2099</td><td>0.2069</td></tr><tr><td>Linear SVM[10]</td><td>0.7611</td><td>0.7523</td><td>0.7502</td><td>0.4473</td><td>0.4466</td><td>0.4464</td></tr><tr><td>Decision Tree [28]</td><td>0.9102</td><td>0.9011</td><td>0.8647</td><td>0.4071</td><td>0.3978</td><td>0.3672</td></tr><tr><td>LDA [3]</td><td>Ⅱ 0.8710</td><td>0.8510</td><td>0.8487</td><td>0.1956</td><td>0.1852</td><td>0.1788</td></tr><tr><td>AdaBoost [17]</td><td>0.9143</td><td>0.8952</td><td>0.8809</td><td>0.4530</td><td>0.4366</td><td>0.4234</td></tr><tr><td>Bagging [4]</td><td>0.8951</td><td>0.8877</td><td>0.8657</td><td>0.3303</td><td>0.3221</td><td>0.3073</td></tr><tr><td>GBM[18]</td><td>1 0.8848</td><td>0.8709</td><td>0.8499</td><td>0.3057</td><td>0.2974</td><td>0.2773</td></tr><tr><td>Multi-layer Perceptron</td><td>0.9086</td><td>0.8925</td><td>0.8787</td><td>0.4790</td><td>0.4693</td><td>0.4600</td></tr><tr><td>XgBoost[8]</td><td>1 0.9058</td><td>0.8904</td><td>0.8637</td><td>0.3837</td><td>0.3700</td><td>0.3440</td></tr><tr><td>Average</td><td>1 0.8866</td><td>0.8737</td><td>0.8578</td><td>0.3453</td><td>0.3351</td><td>0.3219</td></tr></table>
204
+
205
+ Table 1: Performance comparison of 12 different predictive models in Setting B (trained on synthetic, tested on real) in terms of AUROC and AUPRC (the generators of PATE-GAN and DPGAN are $( 1 , 1 0 ^ { - 5 } )$ -differentially private).
206
+
207
+ # 5.2 RESULTS WITH SETTING B
208
+
209
+ In this subsection, we evaluate PATE-GAN and DPGAN in Setting B (trained on synthetic, tested on real) to understand whether or not the models are capturing the feature-label relationships well. Intuitively, if a synthetic dataset is such that a model trained on it performs well when performance is measured on real data, then the relationship between feature and label in the synthetic data is similar to that in the real data. In Table 1 we give the results for the Kaggle Credit dataset for all 12 predictive models. In Table 2, we give the performance on each dataset averaged across the 12 methods for each of the 6 datasets. A breakdown of the performance of each predictive model for each dataset can be found in the Appendix. Across all datasets, we see that PATE-GAN is capable of generating synthetic samples that better preserve the feature-label relationship (according to AUROC and AUPRC) than DPGAN.
210
+
211
+ <table><tr><td rowspan="2">Datasets</td><td colspan="3">I AUROC</td><td colspan="3">I AUPRC</td></tr><tr><td>Ⅱ GAN</td><td>PATE-GAN</td><td>DPGAN</td><td>GAN</td><td>PATE-GAN</td><td>DPGAN</td></tr><tr><td>Kaggle Credit</td><td>Ⅱ 0.8866</td><td>0.8737</td><td>0.8578</td><td>0.3453</td><td>0.3351</td><td>0.3219</td></tr><tr><td>MAGGIC</td><td>三 0.6574</td><td>0.6446</td><td>0.6286</td><td>0.3054</td><td>0.2952</td><td>0.2820</td></tr><tr><td>UNOS</td><td>0.6277</td><td>0.5996</td><td>0.5552</td><td>0.6554</td><td>0.6282</td><td>0.5862</td></tr><tr><td>Kaggle Cervical Cancer</td><td>0.9268</td><td>0.9108</td><td>0.8699</td><td>0.5994</td><td>0.5460</td><td>0.4851</td></tr><tr><td>UCI ISOLET</td><td>1 0.8171</td><td>0.6399</td><td>0.5577</td><td>0.5561</td><td>0.2953</td><td>0.2146</td></tr><tr><td>UCI Epileptic Seizure Recognition</td><td>0.9173</td><td>0.7681</td><td>0.6718</td><td>0.8133</td><td>0.6512</td><td>0.5369</td></tr></table>
212
+
213
+ Table 2: Performance comparison of 12 different predictive models in Setting B (trained on synthetic, tested on real) in terms of AUROC and AUPRC (the generators of PATE-GAN and DPGAN are $( 1 , 1 \dot { 0 } ^ { - 5 } )$ -differentially private) over 6 different datasets. GAN is $( \infty , \infty )$ -differentially private and is given to indicate an upper bound of PATE-GAN and DPGAN.
214
+
215
+ We note that the performance of all models, including the original GAN model (i.e. PATE-GAN - or equivalently DPGAN - with $( \infty , \infty )$ -differential privacy) in the high dimensional UCI ISOLET and UCI Epileptic Seizure Recognition datasets is lower than in lower dimensional datasets (when compared to the baseline AUROC and AUPRC found in the Appendix). We do, however, see that both PATE-GAN and DPGAN show more significant decreases in performance than the original GAN in these high-dimensional settings. In the case of PATE-GAN, we believe this may be due to the fact that the student discriminator is trained only using data from the generator, and therefore requires that some of the generated data look somewhat realistic from the start, which is a harder requirement to satisfy as the data has more dimensions. On the other hand, in DPGAN, noise must be added to each component of the gradient (of the discriminator) and so in higher dimensions the norm of the noise added is larger. Note that in PATE-GAN, noise is added only to the teacher outputs, whose dimension (typically 1) does not depend on the dimension of the input data, and so this phenomena does not present itself in PATE-GAN. The results on both the UCI datasets would suggest that the loss from increasing noise norm (for DPGAN) is greater than from difficulty in randomly generating realistic samples (for PATE-GAN).
216
+
217
+ # 5.3 VARYING THE PRIVACY CONSTRAINT ()
218
+
219
+ ![](images/6e325ea9f3839f5631b73dba0204ee5467047c62f3a8c41be66f013cc319f54d.jpg)
220
+ Figure 1: Average AUROC performance across 12 different predictive models trained on the synthetic dataset generated by PATE-GAN and DPGAN with various $\epsilon$ (with $\dot { \delta } = 1 0 ^ { - 5 }$ ) (Setting B).
221
+
222
+ In Fig. 1, we investigate the trade off between privacy constraint and utility. In the table we report the average performance of AUROC over the 12 different predictive models for PATE-GAN and the benchmark for various $\epsilon$ (with $\delta = 1 0 ^ { - 5 }$ ). As can be seen in Fig. 1, PATE-GAN is consistently better than DPGAN over the entire range of tested $\epsilon$ . We believe this is because the PATE mechanism allows us to more tightly bound the influence of a single sample on the discriminator, and hence we can provide tighter differential privacy guarantees - when the differential privacy guarantee is fixed, this results in higher quality synthetic data. Of course, as we increase $\epsilon$ (i.e. decrease the required privacy) both methods converge to the performance of GAN and the increase in performance of PATE-GAN over DPGAN becomes smaller.
223
+
224
+ # 5.4 SETTING A VS SETTING C: PRESERVING THE RANKING OF PREDICTIVE MODELS
225
+
226
+ As discussed at the beginning of this section, it is important that a synthetic dataset respects the ranking of models (in terms of their prediction performances) [21]. To evaluate this, we now introduce a new metric, which we refer to as the Synthetic Ranking Agreement (SRA). Suppose that we have $L$ predictive models, $f _ { 1 } , f _ { 2 } , . . . , f _ { L } { } ^ { 2 }$ . Furthermore, suppose that the performance of model $i$ when trained and tested on the real data (Setting A) is $A _ { i } \in \mathbb { R }$ and that the performance of model $i$ when trained and tested on the synthetic data (Setting C) is $C _ { i } \in \mathbb { R }$ . Then we define the Synthetic Ranking Agreement by
227
+
228
+ $$
229
+ \mathbf { S R A } ( \{ A _ { i } \} _ { i = 1 } ^ { L } , \{ C _ { i } \} _ { i = 1 } ^ { L } ) = { \frac { 1 } { L ( L - 1 ) } } \sum _ { j = 1 } ^ { L } \sum _ { k \neq j } \mathbb { I } \Bigl ( ( A _ { j } - A _ { k } ) \times ( C _ { j } - C _ { k } ) > 0 \Bigr )
230
+ $$
231
+
232
+ where $\mathbb { I }$ is an indicator function. Note that the summand is 1 when the ordering of algorithms $j$ and $k$ are the same in both settings, and is 0 when the ordering in one setting differs from the ordering in the other.
233
+
234
+ $$
235
+ \begin{array}{c} \frac { \mathrm { ~ \textcircled ~ { 1 } ~ P A T E - G A N ~ } \mid \mathrm { ~ \bf ~ D P G A N ~ } \mid } { \epsilon = 0 . 0 1 ~ \parallel } ~ \mathrm { ~ \bf ~ O . B O 0 0 ~ } \\ { \frac { \epsilon = 0 . 0 1 ~ } { \epsilon = 0 . 0 5 ~ \parallel } ~ 0 . 0 9 9 ~ \mid ~ 0 . 5 2 7 3 ~ \parallel ~ \epsilon = 1 ~ \parallel ~ 0 . 8 3 6 4 ~ \mid ~ 0 . 8 0 0 0 } \\ { \frac { \epsilon = 0 . 0 5 ~ } { \epsilon = 0 . 1 ~ \parallel } ~ 0 . 0 7 4 5 5 ~ \mid ~ 0 . 6 9 0 9 ~ \parallel ~ \epsilon = 5 ~ \parallel ~ 0 . 8 9 0 9 ~ \mid ~ 0 . 8 3 6 4 } \\ { \frac { \epsilon = 0 . 1 ~ \parallel } { \epsilon = 0 . 1 ~ \parallel } ~ 0 . 0 8 1 ~ \mid ~ 0 . 7 4 5 5 ~ \parallel ~ \epsilon = 1 0 ~ \parallel ~ 0 . 9 0 9 1 ~ \mid ~ 0 . 8 9 0 9 } \\ { \frac { \epsilon = 0 . 5 ~ } { \epsilon = 0 . 5 ~ \parallel } ~ 0 . 0 . 8 0 0 0 ~ \mid ~ 0 . 7 8 1 8 ~ \parallel ~ \epsilon = 5 0 ~ \parallel ~ 0 . 9 0 9 1 ~ \mid ~ 0 . 9 0 9 1 ~ } \end{array}
236
+ $$
237
+
238
+ Table 3: Synthetic Ranking Probability of PATE-GAN and the benchmark when comparing Setting A and Setting C for various $\epsilon$ (with $\delta = 1 0 ^ { - 5 }$ ) in terms of AUROC. The Synthetic Ranking Agreement of Original GAN is 0.9091, which is also attained by both PATE-GAN and DPGAN for $\epsilon = 5 0$ .
239
+
240
+ We compare the SRA of PATE-GAN and the benchmark for various $\epsilon$ (with $\delta = 1 0 ^ { - 5 } )$ 3 . As can be seen in Table 3, PATE-GAN achieves the best SRA across all values of $\epsilon$ .
241
+
242
+ In the Appendix, we perform a similar experiment in which we compare the ranking of features by their importance (determined by their absolute Pearson correlation coefficient with the label) on the original dataset and on the synthetic dataset (generated by PATE-GAN and the benchmark) and report the results using a metric that is identical to SRA, with the model performances $( \{ A _ { i } \} , \{ C _ { i } \} )$ substituted for feature importances.
243
+
244
+ # 5.5 QUANTITATIVE ANALYSIS ON THE NUMBER OF TEACHERS
245
+
246
+ The number of teachers is a hyper-parameter of PATE-GAN and we choose the number of teachers among $\{ N / 1 0 , N / 5 0 , N / 1 0 0 , N / 5 0 0 , N / 1 0 0 0 , N / 5 0 0 0 , N / 1 0 0 0 0 \}$ where $N$ is the total number of samples. As we described in the previous section, there is a trade-off between number of teachers and the corresponding quality of the synthetic data. Table 4 quantitatively shows the trade-off between the number of teachers and the performance (in terms of both AUROC and AUPRC).
247
+
248
+ <table><tr><td># of teachers</td><td>N/10</td><td>N/50</td><td>N/100</td><td>N/500</td><td>N/1000</td><td>N/5000</td><td>N/10000</td></tr><tr><td>AUROC AUPRC</td><td>0.5425 0.1273</td><td>0.6398 0.2484</td><td>0.7638 0.2900</td><td>0.8343 0.3184</td><td>0.8737 0.3351</td><td>0.8655 0.3278</td><td>0.8282 0.3092</td></tr></table>
249
+
250
+ Table 4: Trade-off between the number of teachers and the performances (AUROC, AUPRC)
251
+
252
+ # 6 DISCUSSION
253
+
254
+ In this paper we introduced a novel methodology for generating differentially private synthetic data. Through several experiments we demonstrated the ability of our method to produce high quality synthetic data while being able to give strict differential privacy guarantees.
255
+
256
+ In order to apply PATE to the GAN setting, we needed to use the original GAN framework. Extending PATE to the regression setting so that, for example, a Wasserstein GAN can be used instead, is an open and interesting question, and a potential direction for future research.
257
+
258
+ # ACKNOWLEDGEMENT
259
+
260
+ The authors would like to thank the reviewers for their helpful comments. The research presented in this paper was supported by the Office of Naval Research (ONR) and the NSF (Grant number: ECCS1462245, ECCS1533983, and ECCS1407712).
261
+
262
+ REFERENCES
263
+ [1] Martin Abadi, Andy Chu, Ian Goodfellow, H Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. Deep learning with differential privacy. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, pp. 308–318. ACM, 2016.
264
+ [2] Brett K Beaulieu-Jones, Zhiwei Steven Wu, Chris Williams, and Casey S Greene. Privacypreserving generative deep neural networks support clinical data sharing. BioRxiv, pp. 159756, 2017.
265
+ [3] David M Blei, Andrew Y Ng, and Michael I Jordan. Latent dirichlet allocation. Journal of machine Learning research, 3(Jan):993–1022, 2003.
266
+ [4] Leo Breiman. Bagging predictors. Machine learning, 24(2):123–140, 1996.
267
+ [5] Leo Breiman. Random forests. Machine learning, 45(1):5–32, 2001.
268
+ [6] Anna L Buczak, Steven Babin, and Linda Moniz. Data-driven approach for creating synthetic electronic medical records. BMC medical informatics and decision making, 10(1):59, 2010.
269
+ [7] J Michael Cecka and Paul I Terasaki. The unos scientific renal transplant registry. Clinical transplants, pp. 1–18, 1993.
270
+ [8] Tianqi Chen and Carlos Guestrin. Xgboost: A scalable tree boosting system. In Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining, pp. 785–794. ACM, 2016.
271
+ [9] Edward Choi, Siddharth Biswal, Bradley Malin, Jon Duke, Walter F Stewart, and Jimeng Sun. Generating multi-label discrete electronic health records using generative adversarial networks. arXiv preprint arXiv:1703.06490, 2017.
272
+ [10] Corinna Cortes and Vladimir Vapnik. Support-vector networks. Machine learning, 20(3): 273–297, 1995.
273
+ [11] Andrea Dal Pozzolo, Olivier Caelen, Reid A Johnson, and Gianluca Bontempi. Calibrating probability with undersampling for unbalanced classification. In Computational Intelligence, 2015 IEEE Symposium Series on, pp. 159–166. IEEE, 2015.
274
+ [12] Cynthia Dwork, Aaron Roth, et al. The algorithmic foundations of differential privacy. Foundations and Trends $\textsuperscript { \textregistered }$ in Theoretical Computer Science, 9(3–4):211–407, 2014.
275
+ [13] Khaled El Emam, David Buckeridge, Robyn Tamblyn, Angelica Neisa, Elizabeth Jonker, and Aman Verma. The re-identification risk of canadians from longitudinal demographics. BMC medical informatics and decision making, 11(1):46, 2011.
276
+ [14] Yaniv Erlich and Arvind Narayanan. Routes for breaching and protecting genetic privacy. Nature Reviews Genetics, 15(6):409–421, 2014.
277
+ [15] Cristobal Esteban, Stephanie L Hyland, and Gunnar R ´ atsch. Real-valued (medical) time series ¨ generation with recurrent conditional gans. arXiv preprint arXiv:1706.02633, 2017.
278
+ [16] Kelwin Fernandes, Jaime S Cardoso, and Jessica Fernandes. Transfer learning with partial observability applied to cervical cancer screening. In Iberian conference on pattern recognition and image analysis, pp. 243–250. Springer, 2017.
279
+ [17] Yoav Freund, Robert E Schapire, et al. Experiments with a new boosting algorithm. In Icml, volume 96, pp. 148–156. Bari, Italy, 1996.
280
+ [18] Jerome H Friedman. Greedy function approximation: a gradient boosting machine. Annals of statistics, pp. 1189–1232, 2001.
281
+ [19] 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.
282
+
283
+ [20] J Henry, Y Pylypchuk, T Searcy, and V Patel. Adoption of electronic health record systems among us non-federal acute care hospitals: 2008–2015. may 2016. Accessed via:¡ https://dashboard. healthit. gov/evaluations/data-briefs/non-federal-acute-care-hospital-ehradoption-2008-2015. php¿. Accessed on June, 21, 2017.
284
+
285
+ [21] James Jordon, Jinsung Yoon, and Mihaela van der Schaar. Measuring the quality of synthetic data for use in competitions. arXiv preprint arXiv:1806.11345, 2018.
286
+
287
+ [22] Bradley Malin and Latanya Sweeney. How (not) to protect genomic data privacy in a distributed network: using trail re-identification to evaluate and design anonymity protection systems. Journal of biomedical informatics, 37(3):179–192, 2004.
288
+
289
+ [23] Scott McLachlan, Kudakwashe Dube, and Thomas Gallagher. Using the caremap with health incidents statistics for generating the realistic synthetic electronic healthcare record. In Healthcare Informatics (ICHI), 2016 IEEE International Conference on, pp. 439–448. IEEE, 2016.
290
+
291
+ [24] Arvind Narayanan and Vitaly Shmatikov. Robust de-anonymization of large sparse datasets. In Security and Privacy, 2008. SP 2008. IEEE Symposium on, pp. 111–125. IEEE, 2008.
292
+
293
+ [25] Nicolas Papernot, Mart´ın Abadi, Ulfar Erlingsson, Ian Goodfellow, and Kunal Talwar. Semisupervised knowledge transfer for deep learning from private training data. arXiv preprint arXiv:1610.05755, 2016.
294
+
295
+ [26] Nicolas Papernot, Shuang Song, Ilya Mironov, Ananth Raghunathan, Kunal Talwar, and Ulfar ´ Erlingsson. Scalable private learning with pate. arXiv preprint arXiv:1802.08908, 2018.
296
+
297
+ [27] Stuart J Pocock, Cono A Ariti, John JV McMurray, Aldo Maggioni, Lars Køber, Iain B Squire, Karl Swedberg, Joanna Dobson, Katrina K Poppe, Gillian A Whalley, et al. Predicting survival in heart failure: a risk score based on 39 372 patients from 30 studies. European heart journal, 34(19):1404–1413, 2012.
298
+
299
+ [28] J. Ross Quinlan. Induction of decision trees. Machine learning, 1(1):81–106, 1986.
300
+
301
+ [29] Irina Rish. An empirical study of the naive bayes classifier. In IJCAI 2001 workshop on empirical methods in artificial intelligence, volume 3, pp. 41–46. IBM, 2001.
302
+
303
+ [30] Latanya Sweeney. Weaving technology and policy together to maintain confidentiality. The Journal of Law, Medicine & Ethics, 25(2-3):98–110, 1997.
304
+
305
+ [31] Jonathan Ullman and Salil Vadhan. Pcps and the hardness of generating private synthetic data. In Theory of Cryptography Conference, pp. 400–416. Springer, 2011.
306
+
307
+ [32] Liyang Xie, Kaixiang Lin, Shu Wang, Fei Wang, and Jiayu Zhou. Differentially private generative adversarial network. arXiv preprint arXiv:1802.06739, 2018.
308
+
309
+ # APPENDIX
310
+
311
+ THEORY REQUIRED FOR THEOREM 1
312
+
313
+ Theorem 2. Algorithm 1, which takes as input $\delta > 0$ , a dataset, $\mathcal { D }$ , and outputs $G$ and $\epsilon$ is $( \epsilon , \delta )$ - differentially private.
314
+
315
+ In order to prove our theorem, we define the moments accountant [1] and state the theorems that the data-dependent privacy guarantees of the PATE mechanism rely on. For proofs of the results below, see [25] and the references therein.
316
+
317
+ Definition 3. (Privacy Loss) Let $\mathcal { M }$ be a randomized algorithm taking outputs in a space $\mathcal { O }$ and $\mathcal { D } , \mathcal { D } ^ { \prime }$ be neighbouring datasets. Let aux denote an auxiliary input. For an outcome $o \in \mathcal { O }$ , the privacy loss at o is defined as:
318
+
319
+ $$
320
+ c ( o ; \mathcal { M } , a u x , \mathcal { D } , \mathcal { D ^ { \prime } } ) = \log \frac { \mathbb { P } ( \mathcal { M } ( a u x , \mathcal { D } ) = o ) } { \mathbb { P } \left( \mathcal { M } ( a u x , \mathcal { D ^ { \prime } } ) = o \right) } .
321
+ $$
322
+
323
+ The privacy loss random variable $C ( \mathcal { M } , a u x , \mathcal { D } , \mathcal { D } ^ { \prime } )$ is defined as $c ( \mathcal { M } ( \mathcal { D } ) ; \mathcal { M } , a u x , \mathcal { D } , \mathcal { D } ^ { \prime } )$ , i.e.
324
+ the random variable defined by evaluating the privacy loss at an outcome sampled from $\mathcal { M } ( \mathcal { D } )$ .
325
+
326
+ Definition 4. (Moments accountant) Let $\mathcal { M }$ be a randomized algorithm. The moments accountant is defined as:
327
+
328
+ $$
329
+ \alpha _ { \mathcal { M } } ( l ) = \operatorname* { m a x } _ { a u x , \mathcal { D } , \mathcal { D ^ { \prime } } } \alpha _ { \mathcal { M } } ( l ; a u x , \mathcal { D } , \mathcal { D ^ { \prime } } )
330
+ $$
331
+
332
+ where $\alpha _ { \mathcal { M } } ( l ; a u x , \mathcal { D } , \mathcal { D ^ { \prime } } ) = \log \mathbb { E } ( \exp ( l C ( \mathcal { M } , a u x , \mathcal { D } , \mathcal { D ^ { \prime } } ) ) )$ ) is the moment generating function of the privacy loss random variable and the max is taken over neighbouring datasets $\mathcal { D } , \mathcal { D } ^ { \prime }$ .
333
+
334
+ Theorem 3. (Composability) Suppose that an algorithm $\mathcal { M }$ consists of a sequence of adaptive algorithms $\mathcal { M } _ { 1 } , . . . , \mathcal { M } _ { k }$ where $\mathcal { M } _ { i }$ outputs in $\mathcal { O } _ { i }$ and takes inputs from $\Pi _ { j = 1 } ^ { i - 1 } { \mathcal { O } } _ { j }$ as well as the dataset $\mathcal { D }$ . Then for any output sequence $o _ { 1 } , . . . , o _ { k - 1 }$ and any $l$
335
+
336
+ $$
337
+ \alpha _ { \mathcal { M } } ( l ; \mathcal { D } , \mathcal { D } ^ { \prime } ) = \sum _ { i = 1 } ^ { k } \alpha _ { \mathcal { M } _ { i } } ( l ; o _ { 1 } , . . . , o _ { i - 1 } , \mathcal { D } , \mathcal { D } ^ { \prime } )
338
+ $$
339
+
340
+ where $\alpha _ { \mathcal { M } }$ is conditioned on each $\mathcal { M } _ { i }$ ’s output being $o _ { i }$
341
+
342
+ Theorem 4. (Tail bound) Let $\mathcal { M }$ be a randomized algorithm. For any $\epsilon > 0$ , $\mathcal { M }$ is $( \epsilon , \delta )$ differentially private for
343
+
344
+ $$
345
+ \delta = \operatorname* { m i n } _ { l } \exp ( \alpha _ { \mathcal { M } } ( l ) - l \epsilon ) .
346
+ $$
347
+
348
+ The following theorem combines Theorems 2, 3 and Lemma 4 from [25].
349
+
350
+ Theorem 5. (Data-dependent privacy guarantee for PATE) Let $\mathcal { M }$ be the PATE mechanism defined in Section 3 of the paper. Let n0, n1 be as defined in Equation 3 of the paper. Let q = 2+λ|n0−n1|4 exp(λ|n −n |) . Then
351
+
352
+ $$
353
+ \alpha _ { \mathcal { M } } ( l ) \leq \operatorname* { m i n } \{ 2 \lambda ^ { 2 } l ( l + 1 ) , \log ( ( 1 - q ) \left( \frac { 1 - q } { 1 - e ^ { 2 \lambda } q } \right) ^ { l } + q e ^ { 2 \lambda l } ) \} .
354
+ $$
355
+
356
+ Proof of Theorem 2. We use Theorem 5 to bound the moments accountant for each query to the PATE mechanism during the training of our algorithm (i.e. each time a generated sample is labeled by the teachers). Theorem 3 then allows us to sum the individual bounds for each query to bound the moments accountant of the entire algorithm. Theorem 4 then allows us to derive a value for $\epsilon$ given $\delta$ . □
357
+
358
+ # DATA DESCRIPTIONS
359
+
360
+ # KAGGLE CREDIT CARD FRAUD DETECTION DATA DESCRIPTION
361
+
362
+ The Kaggle credit card fraud detection dataset [11] contains transactions made by credit cards in September 2013 by European cardholders and the label is whether or not the transaction is fraudulent. The total number of features is 29 (binary: 0, continuous: 29) and the number of samples in this dataset is 284,807. Among the 284,807 samples, 492 $( 0 . 2 \% )$ samples are fraudulent transactions.
363
+
364
+ # MAGGIC DATA DESCRIPTION
365
+
366
+ The Meta-analysis Global Group in Chronic Heart Failure (MAGGIC) dataset [27] is a collection of 30 different datasets from 30 different medical studies containing patients who experienced heart failure. We set the label of each patient as 1-year all-cause mortality, excluding all patients who are censored before 1-year. The total number of features is 29 (binary: 20, continuous: 9) and the number of patients in this dataset is 30,389. Among the 30,389 patients, 5,723 $( 1 8 . 8 \% )$ patients died within 1 year.
367
+
368
+ # UNOS DATA DESCRIPTION
369
+
370
+ The United Network for Organ Transplantation (UNOS) dataset [7] provides information about all patients in the U.S. who have received a transplantation or were on the wait-list during the period 1985-2015. In this paper, we focus on the patients who were on the heart transplant wait-list. The objective is to predict 1-year all-cause mortality. The total number of features is 20 (binary: 18, continuous: 2) and the number of patients in this dataset is 23,706. Among the 23,706 patients, 12,606 $( 5 3 . 2 \% )$ patients died within 1 year.
371
+
372
+ # KAGGLE CERVICAL CANCER DATA DESCRIPTION
373
+
374
+ The Kaggle cervical cancer dataset [16] was collected at ’Hospital Universitario de Caracas’ in Caracas, Venezuela. It contains demographic information, habits, and historic medical records. The total number of features is 35 (binary: 24, continuous: 11) and the number of patients in this dataset is 858. Among the 858 patients, 55 $( 6 . 4 \% )$ patients have positive biopsy.
375
+
376
+ # UCI ISOLET DATA DESCRIPTION
377
+
378
+ The UCI ISOLET dataset https://archive.ics.uci.edu/ml/datasets/isolet was generated by speaking the name of each letter of the alphabet. The task is to classify each spoken letter as either a vowel or a consonant (binary classification). The total number of features is 617 and the number of samples in this dataset is 7797. Among the 7797 samples, 1500 $1 9 . 2 \% )$ samples are vowels.
379
+
380
+ # UCI EPILEPTIC SEIZURE RECOGNITION DATA DESCRIPTION
381
+
382
+ The UCI Epileptic Seizure Recognition dataset https://archive.ics.uci.edu/ml/ datasets/Epileptic+Seizure+Recognition was generated by recording brain activity. The task is to classify activity as seizure activity (binary classification). The total number of features is 179 and the number of samples in this dataset is 11500. Among the 11500 samples, 2300 $( 2 0 . 0 \% )$ samples correspond to seizure activity.
383
+
384
+ # DATA SUMMARY AND SETTING A PERFORMANCE
385
+
386
+ Table 5 summarises the 6 datasets we use and provides a baseline performance for a predictive model on each dataset - recall that Setting A refers to training and testing on the real data. The AUROC and AUPRC in this setting are upper bounds on the AUROC and AUPRC we could hope to achieve in Setting B.
387
+
388
+ <table><tr><td rowspan=1 colspan=2>Datasets No of samples</td><td rowspan=1 colspan=3> No of features AUROC AUPRC</td></tr><tr><td rowspan=1 colspan=1>Kaggle Credit</td><td rowspan=1 colspan=1>284807</td><td rowspan=1 colspan=2>29 0.9438</td><td rowspan=1 colspan=1>0.7020</td></tr><tr><td rowspan=1 colspan=1>MAGGIC</td><td rowspan=1 colspan=1>30389</td><td rowspan=1 colspan=1>29</td><td rowspan=1 colspan=1>0.7069</td><td rowspan=1 colspan=1>0.3638</td></tr><tr><td rowspan=1 colspan=1>UNOS</td><td rowspan=1 colspan=1>23706</td><td rowspan=1 colspan=1>20</td><td rowspan=1 colspan=1>0.6416</td><td rowspan=1 colspan=1>0.6677</td></tr><tr><td rowspan=1 colspan=1> Kaggle Cervical cancer</td><td rowspan=1 colspan=1>858</td><td rowspan=1 colspan=1>35</td><td rowspan=1 colspan=1>0.9354</td><td rowspan=1 colspan=1>0.6314</td></tr><tr><td rowspan=1 colspan=1>UCI ISOLET</td><td rowspan=1 colspan=1>7797</td><td rowspan=1 colspan=1>617</td><td rowspan=1 colspan=1>0.9671</td><td rowspan=1 colspan=1>0.8758</td></tr><tr><td rowspan=1 colspan=1>UCI Epileptic Seizure Recognition</td><td rowspan=1 colspan=1>11500</td><td rowspan=1 colspan=1>179</td><td rowspan=1 colspan=1>0.9809</td><td rowspan=1 colspan=1>0.9511</td></tr></table>
389
+
390
+ Table 5: No of samples, No of features, Average AUROC and AUPRC performance across 12 different predictive models trained and tested on the real data (Setting A) for the 6 datasets: Kaggle Credit, MAGGIC, UNOS, Kaggle Cervical Cancer, UCI ISOLET, UCI Epileptic Seizure Recognition.
391
+
392
+ # HYPER-PARAMETER OPTIMIZATION
393
+
394
+ In all experiments, the depth of the generator and discriminator (student-discriminator in our case) in both PATE-GAN and the DPGAN benchmark [32] is set to 3. The depth of the teacher discriminators is set to 1. The number of hidden nodes in each layer is $d , d / 2$ and $d$ (where $d$ is the feature dimension), respectively. We use relu as the activation functions of each layer except for the output layer where we use the sigmoid activation function and the batch size is 64 for both the generator and discriminator. We set $n _ { T } = n _ { S } = 5$ . Using cross validation, we select the number of teachers, $k$ , among $\mathrm { N } / 1 0 \mathrm { N } / 5 0 \mathrm { N } / 1 0 0 \mathrm { N } / 5 0 0 \mathrm { N } / 1 0 0 0 \mathrm { N } / 5 0 0 0 \mathrm { N } / 1 0 0 0 0$ . The learning rate is $1 0 ^ { - 4 }$ and we use Adam Optimizer to minimize the loss function.
395
+
396
+ We use tensorflow to implement PATE-GAN and DPGAN. For DPGAN we use the code from the following link: https://github.com/illidanlab. We use the sklearn package in python to implement the 12 predictive models: Logistic Regression (LogisticRegression), Random Forests (RandomForestClassifier), Gaussian Naive Bayes (GaussianNB), Bernoulli Naive Bayes (BernoulliNB), Linear Support Vector Machine (svm), Decision Tree (DecisionTree), Linear Discriminant Analysis Classifier (LinearDiscriminantAnalysis), Adaptive Boosting (AdaBoost) (AdaBoostClassifier), Bootstrap Aggregating (Bagging) (BaggingClassifier), Gradient Boosting Machine (GBM) (GradientBoostingClassifier), Multi-layer Perceptron (MLPClassifier), and XgBoost (XGBoostRegressor).
397
+
398
+ # VARYING THE PRIVACY CONSTRAINT () IN TERMS OF AUPRC
399
+
400
+ ![](images/acac5f4590f7e198ea53b875e95af5e77177f1387bc837fc24538ae593ca4a08.jpg)
401
+ Figure 2: Average AUPRC performance across 12 different predictive models trained on the synthetic dataset generated by PATE-GAN and DPGAN with various $\epsilon$ (with $\dot { \delta } = 1 0 ^ { - 5 }$ ) (Setting B).
402
+
403
+ Similar to Fig. 1 in the main manuscript, Fig. 2 shows the trade off between the privacy constraint and utility, where utility is now measured in terms of AUPRC (rather than AUROC). We report the average performance in terms of AUPRC over the 12 different predictive models for PATE-GAN and the benchmark for various $\epsilon$ (with $\delta = 1 0 ^ { - 5 }$ ). As can be seen in Fig. 2, PATE-GAN consistently outperforms DPGAN over the entire range of tested $\epsilon$ in terms of AUPRC as well.
404
+
405
+ # PRESERVING THE RANKING OF VARIABLE IMPORTANCE IN KAGGLE CREDIT DATASET
406
+
407
+ We compare the ranking of variables by their importance (according to absolute Pearson correlation coefficient with the label) on the original dataset and on both synthetic datasets. We report the results using agreed ranking probability. As can be seen in Table 6, PATE-GAN achieves consistently better agreed ranking probability across all values of tested $\epsilon$ (with $\delta = 1 0 ^ { - 5 }$ ).
408
+
409
+ $$
410
+ \frac { \mathrm { ~ \# ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ \phi ~ } ~ } } { \epsilon = 0 . 0 1 ~ \| \mathrm { ~ { ~ \bf ~ \phi ~ } ~ { ~ \bf ~ 0 . 8 7 8 } ~ } }
411
+ $$
412
+
413
+ Table 6: Agreed ranking probability of PATE-GAN and the benchmark to order the features by variable importance in terms of absolute Pearson correlation coefficient
414
+
415
+ HIGH-DIMENSIONAL RESULTS: UCI ISOLET AND UCI EPILEPTIC SEIZURE RECOGNITION
416
+
417
+ <table><tr><td rowspan="2">三 (e,8)</td><td colspan="3">AUROC</td><td colspan="3">AUPRC</td></tr><tr><td>I GAN</td><td>PATE-GAN</td><td>DPGAN</td><td>三 GAN</td><td>PATE-GAN</td><td>DPGAN</td></tr><tr><td>(10,10-5) (1,10-5)</td><td>0.8171</td><td>0.7688 0.6399</td><td>0.7390 0.5577</td><td>0.5561</td><td>0.4734 0.2953</td><td>0.3831 0.2146</td></tr></table>
418
+
419
+ Table 7: Average AUROC and AUPRC performance of 12 different predictive models trained on the synthetic datasets for $\epsilon = 1 , 1 0$ with $\delta = 1 0 ^ { - 5 }$ - Setting B using UCI ISOLET dataset. GAN is $( \infty , \infty )$ -differentially private and is given to indicate an upper bound of PATE-GAN and DPGAN.
420
+
421
+ <table><tr><td rowspan="2">川 (,)</td><td colspan="3">AUROC 1</td><td colspan="3">AUPRC</td></tr><tr><td>I GAN</td><td>PATE-GAN</td><td>DPGAN</td><td>GAN</td><td>PATE-GAN</td><td>DPGAN</td></tr><tr><td>(10,10-5) (1,10-5)</td><td>0.9173</td><td>0.8718 0.7681</td><td>0.8189 0.6718</td><td>0.8133</td><td>0.7662 0.6512</td><td>0.7201 0.5369</td></tr></table>
422
+
423
+ Table 8: Average AUROC and AUPRC performance across 12 different predictive models trained on the synthetic datasets with various $\epsilon = 1 , 1 0$ with $\delta = 1 0 ^ { - 5 }$ - Setting B using UCI Epileptic Seizure Recognition dataset. GAN is $( \infty , \infty )$ -differentially private and is given to indicate an upper bound of PATE-GAN and DPGAN.
424
+
425
+ # MAGGIC DATASET RESULT
426
+
427
+ <table><tr><td rowspan="2">I</td><td colspan="3">AUROC</td><td colspan="3">I AUPRC</td></tr><tr><td>川 GAN</td><td>PATE-GAN</td><td>DPGAN</td><td>GAN</td><td>PATE-GAN</td><td>DPGAN</td></tr><tr><td>Logistic Regression</td><td>0.6645 1</td><td>0.6413</td><td>0.6415</td><td>0.3113</td><td>0.2951</td><td>0.2967</td></tr><tr><td>Random Forests</td><td>0.6492</td><td>0.6397</td><td>0.6147</td><td>0.2953</td><td>0.2891</td><td>0.2660</td></tr><tr><td>Gaussian Naive Bayes</td><td>0.6770</td><td>0.6726</td><td>0.6431</td><td>0.3258</td><td>0.3153</td><td>0.2896</td></tr><tr><td>Bernoulli Naive Bayes</td><td>0.6647</td><td>0.6618</td><td>0.6541</td><td>0.3008</td><td>0.2938</td><td>0.2908</td></tr><tr><td>Linear SVM</td><td>0.6410</td><td>0.6301</td><td>0.6322</td><td>0.2911</td><td>0.2904</td><td>0.2902</td></tr><tr><td>Decision Tree</td><td> 0.6689</td><td>0.6598</td><td>0.6234</td><td>0.3163</td><td>0.3070</td><td>0.2764</td></tr><tr><td>LDA</td><td>I 0.6656</td><td>0.6433</td><td>0.6456</td><td>0.3118</td><td>0.2950</td><td>0.3014</td></tr><tr><td>AdaBoost</td><td>Ⅱ 0.6524</td><td>0.6333</td><td>0.6190</td><td>0.3054</td><td>0.2890</td><td>0.2758</td></tr><tr><td>Bagging</td><td> 0.6454</td><td>0.6380</td><td>0.6160</td><td>0.2912</td><td>0.2830</td><td>0.2682</td></tr><tr><td>GBM</td><td>0.6609</td><td>0.6470</td><td>0.6260</td><td>0.3106</td><td>0.3023</td><td>0.2822</td></tr><tr><td>Multi-layer Perceptron</td><td>0.6390</td><td>0.6229</td><td>0.6091</td><td>0.2921</td><td>0.2824</td><td>0.2731</td></tr><tr><td>XgBoost</td><td>0.6604</td><td>0.6450</td><td>0.6183</td><td>0.3133</td><td>0.2996</td><td>0.2736</td></tr><tr><td>Average</td><td>1 0.6574</td><td>0.6446</td><td>0.6286</td><td>0.3054</td><td>0.2952</td><td>0.2820</td></tr></table>
428
+
429
+ Table 9: Performance comparison of 12 different predictive models in Setting B (trained on synthetic, tested on real) in terms of AUROC and AUPRC (the generators of PATE-GAN and DPGAN are $( 1 , 1 \dot { 0 } ^ { - 5 } )$ -differentially private). GAN is $( \infty , \infty )$ -differentially private and is given to indicate an upper bound of PATE-GAN and DPGAN.
430
+
431
+ UNOS HEART WAIT DATASET RESULT
432
+
433
+ <table><tr><td rowspan="2">I</td><td colspan="3">AUROC 三</td><td colspan="3">AUPRC</td></tr><tr><td>Ⅱ GAN</td><td>PATE-GAN</td><td>DPGAN</td><td>GAN</td><td>PATE-GAN</td><td>DPGAN</td></tr><tr><td>Logistic Regression</td><td>0.6407 1</td><td>0.6155</td><td>0.5548</td><td>0.6691</td><td>0.6450</td><td>0.5901</td></tr><tr><td>Random Forests</td><td>Ⅱ 0.6159</td><td>0.5950</td><td>0.5574</td><td>0.6436</td><td>0.6129</td><td>0.5768</td></tr><tr><td>Gaussian Naive Bayes</td><td>0.6323</td><td>0.6015</td><td>0.5343</td><td>0.6648</td><td>0.6371</td><td>0.5824</td></tr><tr><td>Bernoulli Naive Bayes</td><td>0.6213</td><td>0.6045</td><td>0.5763</td><td>0.6501</td><td>0.6363</td><td>0.6077</td></tr><tr><td>Linear SVM</td><td>Ⅱ 0.6244</td><td>0.5979</td><td>0.5581</td><td>0.6486</td><td>0.6254</td><td>0.5892</td></tr><tr><td>Decision Tree</td><td>I 0.6209</td><td>0.6019</td><td>0.5590</td><td>0.6496</td><td>0.6284</td><td>0.5819</td></tr><tr><td>LDA</td><td>Ⅱ 0.6403</td><td>0.6077</td><td>0.5530</td><td>0.6682</td><td>0.6406</td><td>0.5882</td></tr><tr><td>AdaBoost</td><td>Ⅱ 0.6222</td><td>0.5928</td><td>0.5527</td><td>0.6404 1</td><td>0.6194</td><td>0.5826</td></tr><tr><td>Bagging</td><td> 0.6084</td><td>0.5858</td><td>0.5493</td><td>0.6325</td><td>0.6074</td><td>0.5693</td></tr><tr><td>GBM</td><td>0.6374</td><td>0.6040</td><td>0.5585</td><td>0.6679</td><td>0.6352</td><td>0.5920</td></tr><tr><td>Multi-layer Perceptron</td><td>0.6328</td><td>0.5927</td><td>0.5562</td><td>0.6629</td><td>0.6240</td><td>0.5856</td></tr><tr><td>XgBoost</td><td> 0.6362</td><td>0.5956</td><td>0.5533</td><td>0.6676</td><td>0.6267</td><td>0.5880</td></tr><tr><td>Average</td><td> 0.6277</td><td>0.5996</td><td>0.5552</td><td>0.6554</td><td>0.6282</td><td>0.5862</td></tr></table>
434
+
435
+ Table 10: Performance comparison of 12 different predictive models in Setting B (trained on synthetic, tested on real) in terms of AUROC and AUPRC (the generators of PATE-GAN and DPGAN are $( 1 , 1 0 ^ { - 5 } )$ -differentially private). GAN is $( \infty , \infty )$ -differentially private and is given to indicate an upper bound of PATE-GAN and DPGAN.
436
+
437
+ KAGGLE CERVICAL CANCER DATASET RESULT
438
+
439
+ <table><tr><td rowspan="2">I</td><td colspan="3">AUROC 三</td><td colspan="3">AUPRC</td></tr><tr><td>Ⅱ GAN</td><td>PATE-GAN</td><td>DPGAN</td><td>GAN</td><td>PATE-GAN</td><td>DPGAN</td></tr><tr><td>Logistic Regression</td><td>0.9188 1</td><td>0.9102</td><td>0.8945</td><td>0.5949</td><td>0.5605</td><td>0.4672</td></tr><tr><td>Random Forests</td><td>Ⅱ 0.9515</td><td>0.9373</td><td>0.9237</td><td>0.6366</td><td>0.6361</td><td>0.5735</td></tr><tr><td>Gaussian Naive Bayes</td><td>0.9393</td><td>0.8890</td><td>0.7973</td><td>0.5605</td><td>0.4422</td><td>0.3702</td></tr><tr><td>Bernoulli Naive Bayes</td><td>0.8421</td><td>0.8331</td><td>0.8296</td><td>0.2491</td><td>0.2211</td><td>0.2160</td></tr><tr><td>Linear SVM</td><td>1 0.9282</td><td>0.9086</td><td>0.9050</td><td>0.6031</td><td>0.5921</td><td>0.5665</td></tr><tr><td>Decision Tree</td><td>Ⅱ 0.9451</td><td>0.9434</td><td>0.9283</td><td>0.6455</td><td>0.6094</td><td>0.5734</td></tr><tr><td>LDA</td><td>1 0.9358</td><td>0.9155</td><td>0.8667</td><td>0.6518</td><td>0.6061</td><td>0.5629</td></tr><tr><td>AdaBoost</td><td>Ⅱ 0.9361</td><td>0.8898</td><td>0.7989</td><td>0.6881 1</td><td>0.5587</td><td>0.4281</td></tr><tr><td>Bagging</td><td>I 0.9425</td><td>0.9275</td><td>0.9080</td><td>0.6257</td><td>0.5871</td><td>0.5809</td></tr><tr><td>GBM</td><td>1 0.9398</td><td>0.9333</td><td>0.9017</td><td>0.6927</td><td>0.6165</td><td>0.5422</td></tr><tr><td>Multi-layer Perceptron</td><td>0.9005</td><td>0.9064</td><td>0.7933</td><td>0.5675</td><td>0.5246</td><td>0.3746</td></tr><tr><td>XgBoost</td><td>I 0.9408</td><td>0.9351</td><td>0.8919</td><td>0.6784</td><td>0.5978</td><td>0.5657</td></tr><tr><td>Average</td><td>Ⅱ 0.9268</td><td>0.9108</td><td>0.8699</td><td>0.5994</td><td>0.5460</td><td>0.4851</td></tr></table>
440
+
441
+ Table 11: Performance comparison of 12 different predictive models in Setting B (trained on synthetic, tested on real) in terms of AUROC and AUPRC (the generators of PATE-GAN and DPGAN are $( 1 , 1 0 ^ { - 5 } )$ -differentially private). GAN is $( \infty , \infty )$ -differentially private and is given to indicate an upper bound of PATE-GAN and DPGAN.
442
+
443
+ # BLOCK DIAGRAMS
444
+
445
+ # PATE-GAN
446
+
447
+ The two figures below indicate the iterative training procedure carried out by PATE-GAN; the figures correspond to a single generator update.
448
+
449
+ ![](images/8870fb48cfcf4ae0f51b091d74b00f1fa86db1f69acf366d2dd788762bd87de4.jpg)
450
+ Figure 3: Block diagram of the training procedure for the teacher-discriminator during a single generator iteration. Teacher-discriminators are trained to minimize the classification loss when classifying samples as real samples or generated samples. During this step only the parameters of the teachers are updates (and not the generator).
451
+
452
+ ![](images/88df77a63a3fb0339f743d2aaf36fcdbed4d779ca7dc03736fc950c508cd3642.jpg)
453
+ Figure 4: Block diagram of the training procedure for the student-discriminator and the generator. The studentdiscriminator is trained using noisy teacher-labelled generated samples (the noise provides the DP guarantees). The student is trained to minimize classification loss on this noisily labelled dataset, while the generator is trained to maximize the student loss. Note that the teachers are not updated during this step, only the student and the generator.
454
+
455
+ # DPGAN [32]
456
+
457
+ ![](images/dfc4424c04898a25bbcad9e7912df95f1c35b2c3f30f91192742a2c8e1d73467.jpg)
458
+ Figure 5: Block diagram of the DPGAN benchmark. It uses the standard WGAN framework. To guarantee differential privacy of the generator (with Post-processing Theorem), noise is added to the gradient of the discriminator during training to create a differentially private discriminator.
md/train/SJl3h2EYvS/SJl3h2EYvS.md ADDED
@@ -0,0 +1,224 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CLAREL: CLASSIFICATION VIA RETRIEVAL LOSS FOR ZERO-SHOT LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ We address the problem of learning fine-grained cross-modal representations. We propose an instance-based deep metric learning approach in joint visual and textual space. The key novelty of this paper is that it shows that using per-image semantic supervision leads to substantial improvement in zero-shot performance over using class-only supervision. On top of that, we provide a probabilistic justification for a metric rescaling approach that solves a very common problem in the generalized zero-shot learning setting, i.e., classifying test images from unseen classes as one of the classes seen during training. We evaluate our approach on two finegrained zero-shot learning datasets: CUB and FLOWERS. We find that on the generalized zero-shot classification task CLAREL consistently outperforms the existing approaches on both datasets.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep learning-based approaches have demonstrated superior flexibility and generalization capabilities in information processing on a wide variety of tasks, such as vision, speech and language (LeCun et al., 2015). However, it has been widely realized that the transfer of deep representations to real-world applications is challenging due to the typical reliance on massive hand-labeled datasets. Learning in the low-labeled data regime, especially in the zero-shot (Wang et al., 2019) and the few-shot (Wang & Yao, 2019) setups, have recently received significant attention in the literature. In the problem of zero-shot learning (ZSL), the objective is to recognize categories that have not been seen during the training (Larochelle et al., 2008). This is typically done by relying on anchor embeddings learned in one modality as prototypes and by associating a query embedding from the other modality with the closest prototype. In the generalized ZSL (GZSL) case (Xian et al., 2018c), the objective is more challenging as recognition is performed in the joint space of seen and unseen categories. ZSL, as well as its generalized counterpart, provide a viable framework to learn cross-modal representations that are flexible and adaptive. For example, in this paradigm, the adaptation to a new classification task based on text/image representation space alignment could be as easy as defining/appending/modifying a set of text sentences to define classes of new classifiers. This is an especially relevant problem as machine learning is challenged with the long tail of classes, and the idea of learning from pairs of images and sentences, abundant on the web, looks like a natural solution. Therefore, in this paper we specifically target the fine-grained scenario of paired images and their respective text descriptions. The uniqueness of this scenario is in the fact that the co-occurance of image and text provides a rich source of information. The ways of leveraging this source have not been sufficiently explored in the context of GZSL. Although we focus exclusively on the GZSL recognition setup in this paper, we believe that the research in this direction has potential to enable zero-shot flexibility in a wider array of high-level tasks such as segmentation or conditional image generation (Zhang et al., 2018). The contributions of this work can be characterized under the following two themes.
12
+
13
+ Instance-based training loss. Most prominent zero-shot learning approaches rely heavily on classlevel modality alignment (Xian et al., 2018c). We propose a new composite loss function that balances instance-based pairwise image/text retrieval loss and the usual classifier loss. The retrieval loss term does not use class labels. We demonstrate that the class-level information is important, but in the fine-grained text/image pairing scenarios, most of the GZSL accuracy can be extracted from the instance-based retrieval loss. To the best of our knowledge, this type of training has not been used in the GZSL literature. Its impressive performance opens up new promising research directions.
14
+
15
+ ![](images/c5306e54b7867e3eb7aee45c6499213721005da29ec547a7ed5a3a76968503c1.jpg)
16
+ Figure 1: The architecture and training diagram describing the proposed method. Each batch consists of randomly sampled instances, i.e. pairs of images and their corresponding texts. Images are embedded via ResNet and texts are embedded via a CNN/LSTM stack. Image and text features are projected via a fully connected layer into the same dimensional space. In this space, distances between text and image features from different instances are computed. The negative distances are fed into softmax to train on both the image and the text retrieval tasks. The image retrieval task consists of retrieving the image corresponding to the given text of the same instance and the text retrieval task is vice versa. In addition to that, image and text embeddings are trained on auxiliary image and text classification tasks on the class labels corresponding to instances.
17
+
18
+ Metric space rescaling. Metric-based ZSL approaches rely on distances between prototypes and query embeddings during inference. They are known to suffer from imbalanced performance on seen and unseen classes (Liu et al., 2018). Previous work proposed to use a heuristic trick, calibrated stacking (Chao et al., 2016) or calibration (Das & Lee, 2019), to solve the problem. We refer to this technique as metric rescaling in our work, and provide a sound probabilistic justification for it.
19
+
20
+ # 2 PROPOSED METHOD
21
+
22
+ In this paper, we specifically target the fine-grained visual description scenario, as defined by Reed et al. (2016). In this setting, the dataset consists of a number of images from a given set of classes and each image is accompanied by a number of textual descriptions. The task is to learn a joint representation space for images and texts that can be used for zero-shot recognition. An instance of the zero-shot multimodal representation learning problem can then be defined as follows. Given a training set $S = \{ ( v _ { n } , t _ { n } , y _ { n } ) \mid v _ { n } \in \mathcal { V }$ , $t _ { n } \in \mathcal { T } , y _ { n } \in \mathcal { V } , n = 1 \ldots N \}$ of image, text and label tuples, we are interested in finding representations $f _ { \phi } : \mathcal { V } \to \mathcal { Z }$ of image, parameterized by $\phi$ , and $f _ { \theta } : \mathcal { T } \mathcal { Z }$ of text, parameterized by $\theta$ , in a common embedding space $\mathcal { Z }$ . Furthermore, GZSL problem is defined using the sets of seen $\mathcal { V } ^ { t r }$ and unseen $\mathcal { V } ^ { t s }$ classes, such that $\mathcal { V } = \mathcal { V } ^ { t r } \cup \mathcal { V } ^ { t s }$ and $\bar { \mathcal { V } } ^ { t r } \cap \mathcal { V } ^ { t s } = \emptyset$ . The training set will then only contain the seen classes, i.e. $S ^ { t r } = \{ ( v _ { n } , t _ { n } , y _ { n } ) \mid v _ { n } \in$ $\nu$ , $t _ { n } \in \mathcal { T } , y _ { n } \in \mathcal { y } ^ { t r } \}$ and the task is to build a classifier function $g : \mathcal { Z } \times \mathcal { Z } \mathcal { V }$ . This is different from the ZSL scenario focusing on $g : \mathcal { Z } \times \mathcal { Z } \mathcal { Y } ^ { t s }$ .
23
+
24
+ To build $g$ , most approaches to joint representation learning rely on class labeling to train a representation. For example, all the methods reviewed by Xian et al. (2018c) require the access to class labels at train time. We hypothesise that in the fine-grained learning scenario, such as the one described by Reed et al. (2016), a lot of information can be extracted simply from pairwise image/text cooccurrences. The class labels really only become critically necessary when we define class prototypes, i.e. at zero-shot test time. Following this intuition, we define a composite loss function that relies both on the pairwise relationships and on the class labels. The high-level description of the proposed framework is depicted in Figure 1. The framework enables us, among other things, to experiment with the effects of train-time availability of class labels on the quality of zero-shot representations. The framework is based on projecting texts and images into a common space and then learning a representation based on a mixture of four loss functions: a pairwise text retrieval loss, a pairwise image retrieval loss, a text classifier loss and an image classifier loss (see Algorithm 1).
25
+
26
+ Algorithm 1 Loss calculation for a single optimization iteration of the proposed method. $N$ is the number of instances in the training set ${ \mathcal { S } } ^ { t r }$ , $B$ is the number of instances per batch, $C$ is the number of classes in the train set. $\mathrm { R A N D O M S A M P L E } ( S , B )$ denotes a set of $B$ elements chosen uniformly at random from a set $s$ , without replacement.
27
+
28
+ <table><tr><td colspan="3">Input: Training set Str = {(U1,t1,yi),...,(UN,tN,yN)},λ ∈ [0,1], κ ∈ [0,1]. Output: The loss J(,θ) for a randomly sampled training batch. I← RANDOMSAMPLE({1,...,N},B) &gt;Select B instance indices for batch</td></tr><tr><td>Jrc(Θ),J1c(Φ)←0,0 foriinZdo</td><td colspan="3">Initialize classification losses Embed images and texts Image classifier probabilities</td></tr><tr><td colspan="3">Zui,Zt←f(Ui),fθ(ti)</td></tr><tr><td colspan="2">p ← softmax(Wizui +b1) PT ← sOftmax(WTZt +br)</td></tr><tr><td colspan="2">Textclassifierprobabilities JTc(0) ← JTc(0)+ crossentropy(pr,yi) Text classification loss</td></tr><tr><td colspan="2">JIc(𝜙) ← Jic(Φ)+ crossentropy(p1, yi) Image classification loss end for</td></tr><tr><td colspan="2">JTR(Φ,0),J1R(Φ,0)←0,0 Initialize retrieval losses</td></tr><tr><td colspan="2">foriinZdo 1 Text retrieval loss</td></tr><tr><td colspan="2">JTR(Φ,0)←JTR(Φ,0)+ d(zu,Zt)+log∑ exp(-d(Zu,Ztj)) B j∈I</td></tr><tr><td colspan="2">1-B JIR(Φ,0)←JIR(Φ,0)+ d(Zui,Zti) + log∑exp(-d(Zt , Zuj))|&gt; Image retrieval loss</td></tr><tr><td colspan="2">j∈I</td></tr><tr><td colspan="2">J(,θ)←λJTR(𝜙,0)+(1-λ)JIR(Φ,0) Add retrieval loss to the total loss J(Φ,θ)←(1-κ)J(,0)+(Jrc(0)+JIc()) Add classification loss to the total loss</td></tr></table>
29
+
30
+ # 2.1 RETRIEVAL LOSS FUNCTION
31
+
32
+ Pairwise cross-modal loss function is based solely on the pairwise relationships between texts and images. We choose to use the metric learning approach to capture the relationship between images and texts. Now, suppose $d$ is a metric $d : \mathcal { Z } \times \mathcal { Z } \mathbb { R } ^ { + }$ , $v _ { i }$ is an image and $\tau = \{ t _ { j ^ { \prime } } \}$ is a collection of arbitrary texts sampled uniformly at random, of which text $t _ { j }$ belongs to $v _ { i }$ . We propose the following model for the probability of image $v _ { i }$ and text $t _ { j }$ to belong to the same object instance:
33
+
34
+ $$
35
+ p _ { \phi , \theta } ( i = j | v _ { i } , t _ { j } , \tau ) = \frac { \exp ( - d ( f _ { \phi } ( v _ { i } ) , f _ { \theta } ( t _ { j } ) ) ) } { \sum _ { t _ { j ^ { \prime } } \in \tau } \exp ( - d ( f _ { \phi } ( v _ { i } ) , f _ { \theta } ( t _ { j ^ { \prime } } ) ) ) } \ .
36
+ $$
37
+
38
+ The learning is then based on the following cross-entropy loss defined on the batch of size $B$ :
39
+
40
+ $$
41
+ J _ { T R } ( \phi , \theta ) = - \frac { 1 } { B } \sum _ { i , j = 1 } ^ { B } \ell _ { i , j } \log p _ { \phi , \theta } ( i = j | v _ { i } , t _ { j } , \{ t _ { j ^ { \prime } } \} _ { j ^ { \prime } = 1 } ^ { B } ) ,
42
+ $$
43
+
44
+ where $\ell _ { i , j }$ is a binary indicator of the true match $\mathcal { \ell } _ { i , j } = 1$ , if $i = j$ and 0 otherwise). Note that the expression above has the interpretation of the text retrieval loss. It attains its smallest value when for each image in the batch we manage to assign probability 1 to its respective text and 0 to all other texts. This can be further expanded as:
45
+
46
+ $$
47
+ J _ { T R } ( \phi , \theta ) = \frac { 1 } { B } \sum _ { i = 1 } ^ { B } \left( d ( f _ { \phi } ( v _ { i } ) , f _ { \theta } ( t _ { i } ) ) + \log \Big [ \sum _ { t _ { j ^ { \prime } } \in \tau } \exp ( - d ( f _ { \phi } ( v _ { i } ) , f _ { \theta } ( t _ { j ^ { \prime } } ) ) ) \Big ] \right) .
48
+ $$
49
+
50
+ Exchanging the order of image and text in the probability model (1) leads to the image retrieval loss, $J _ { I R } ( \phi , \bar { \theta } )$ . The two losses are mixed using parameter $\lambda \in [ 0 , 1 ]$ as shown in Algorithm 1.
51
+
52
+ The pairwise retrieval loss functions are responsible for the modality alignment. In addition to those, we propose to include, as mentioned above, the usual image and text classifier losses. These losses are responsible for reducing the intraclass variability of representations. The classifier losses are added to the retrieval losses using a mixing parameter $\kappa \in [ 0 , 1 ]$ as shown in Algorithm 1.
53
+
54
+ # 2.2 BALANCING ACCURACY ON THE SEEN AND UNSEEN CLASSES
55
+
56
+ Let us define class prototypes $\mathbf p ( y )$ , each based on the set of texts $\mathcal { T } _ { y }$ belonging to class $y$ , $\mathbf { \{ p ( } y \mathbf { ) = }$ $\begin{array} { r } { \frac { 1 } { | T _ { y } | } \sum _ { t _ { i } \in \mathcal { T } _ { y } } f _ { \theta } ( t _ { i } ) \ | \ y \in \mathcal { V } \} } \end{array}$ . In the context of GZSL, the nearest neighbor decision rule for a given image $v$ and its features ${ \bf z } _ { v } = f _ { \phi } ( v )$ has the following form:
57
+
58
+ $$
59
+ \boldsymbol { \widehat { y } } = \arg \operatorname* { m i n } _ { \boldsymbol { y } \in \mathcal { V } } d ( \mathbf { z } _ { v } , \mathbf { p } ( \boldsymbol { y } ) ) .
60
+ $$
61
+
62
+ The most acute problem faced in this setup is the accuracy imbalance between seen and unseen classes. A very representative case clearly outlining the imbalance problem is presented in Table 6 of (Xian et al., 2018c), where accuracy on the seen classes is always significantly greater than the accuracy on unseen ones. In order to measure and control the imbalance, three metrics are commonly used to assess the classification performance in the GZSL scenario: the Top-1 accuracy on the seen categories (s), the Top-1 accuracy on the unseen categories $\mathbf { \Pi } ^ { ( \mathbf { u } ) }$ and their harmonic mean, $\mathbf { H } = \mathbf { u } \cdot \mathbf { s } / ( \mathbf { u } + \mathbf { s } )$ . The main metric to assess GZSL performance is then $\mathbf { H }$ , which quantifies both $\mathbf { u }$ and s.
63
+
64
+ To formalize the problem, we first introduce $y _ { v }$ , the true class label of image $v$ . Mathematically, the main GZSL pain point is that $\mathbb { P } \{ \widehat { y } \in \mathcal { y } ^ { t r } | y _ { v } \in \mathcal { y } ^ { t s } \}$ is significantly greater than $\mathbb { P } \{ \widehat { y } \in \mathcal { y } ^ { t s } | y _ { v } \in$ $\mathcal { V } ^ { t r } \}$ b b. In other words, the problem is that a given image is more likely to be confused with one of the seen classes if it belongs to an unseen class than vice versa. Our approach to solving the problem is based on the following probabilistic representation of the event space for the decision rule in Equation (4):
65
+
66
+ $$
67
+ \mathbb { P } \{ \boldsymbol { { \widehat { y } } } \in { \mathcal { Y } } ^ { t r } | y _ { v } \in { \mathcal { Y } } ^ { t s } \} = \mathbb { P } \left\{ \operatorname* { m i n } _ { y \in { \mathcal { Y } } ^ { t r } } d ( \mathbf { z } _ { v } , \mathbf { p } ( y ) ) < \operatorname* { m i n } _ { y \in { \mathcal { Y } } ^ { t s } } d ( \mathbf { z } _ { v } , \mathbf { p } ( y ) ) \mid y _ { v } \in { \mathcal { Y } } ^ { t s } \right\} .
68
+ $$
69
+
70
+ Rephrasing, the most acute GZSL error happens when the prototype of one of the seen classes is closer to an image embedding from an unseen class than any of the prototypes of the unseen classes.
71
+
72
+ To rectify the situation we propose the following very direct solution to balance $\mathbb { P } \{ \widehat { y } \in \mathcal { y } ^ { t r } | y _ { v } \in \mathcal { y } ^ { t s } \}$ and $\mathbb { P } \{ \hat { \mathcal { Y } } \in \mathcal { Y } ^ { t s } | y _ { v } \in \mathcal { Y } ^ { t \bar { r } } \}$ . We introduce a positive scalar $\alpha \in \mathbb { R } ^ { + }$ band scale all the distances bcorresponding to the seen prototypes by $1 + \alpha$ . This gives rise to the following scaled distance $d _ { \alpha }$ :
73
+
74
+ $$
75
+ d _ { \alpha } ( \mathbf { z } _ { v } , \mathbf { p } ( y ) ) = \left\{ \begin{array} { l l } { ( 1 + \alpha ) d ( \mathbf { z } _ { v } , \mathbf { p } ( y ) ) , } & { \mathrm { i f ~ } y \in \mathcal { Y } ^ { t r } } \\ { d ( \mathbf { z } _ { v } , \mathbf { p } ( y ) ) , } & { \mathrm { o t h e r w i s e } } \end{array} \right. .
76
+ $$
77
+
78
+ The misclassification between unseen as seen classes for the classifier $\widehat { y } _ { \alpha }$ , based on (6) is then:
79
+
80
+ $$
81
+ \mathbb { P } \{ \widehat { y } _ { \alpha } \in \mathcal { Y } ^ { t r } | y _ { v } \in \mathcal { Y } ^ { t s } \} = \mathbb { P } \left\{ \left( 1 + \alpha \right) \operatorname* { m i n } _ { y \in \mathcal { Y } ^ { t r } } d ( \mathbf { z } _ { v } , \mathbf { p } ( y ) ) < \operatorname* { m i n } _ { y \in \mathcal { Y } ^ { t s } } d ( \mathbf { z } _ { v } , \mathbf { p } ( y ) ) | y _ { v } \in \mathcal { Y } ^ { t s } \right\} \ ,
82
+ $$
83
+
84
+ and it has the following property: for any $0 \leq \alpha _ { 1 } \leq \alpha _ { 2 }$ , $\mathbb { P } \{ \widehat { y } _ { \alpha _ { 1 } } ~ \in ~ \mathcal { Y } ^ { t r } | y _ { v } ~ \in ~ \mathcal { Y } ^ { t s } \} ~ \geq ~ \mathbb { P } \{ \widehat { y } _ { \alpha _ { 2 } } ~ \in ~$ $\mathcal { V } ^ { t r } | y _ { v } \in \mathcal { V } ^ { t s } \}$ , i.e. $\mathbb { P } \{ \widehat { y } _ { \alpha } \in \mathcal { V } ^ { t \bar { r } } | y _ { v } \in \mathcal { V } ^ { t s } \}$ b is a monotone non-increasing function of $\alpha$ b and we bcan reduce it by increasing $\alpha$ (please refer to Appendix A for a proof). Consider now $\mathbb { P } \{ \widehat { y } _ { \alpha } \in$ $\mathcal { V } ^ { t r } | y _ { v } \in \mathcal { V } ^ { t r } \big \}$ , which is a probability that we classify an image $v$ bfrom one of the seen classes as still one of the seen classes. Using exactly the same chain of arguments as in Appendix A, it is straightforward to show that the probability is a non-increasing function of $\alpha$ . Hence the probability $\mathbb { P } \{ \hat { y } _ { \alpha } ^ { \sim } \in \mathcal { V } ^ { t s } | y _ { v } \in \mathcal { V } ^ { t r } \} = 1 - \mathbb { P } \{ \hat { y } _ { \alpha } \in \mathcal { V } ^ { \hat { t r } } | y _ { v } \in \mathcal { V } ^ { t r } \}$ is a non-decreasing function of $\alpha$ . Therefore, as $\alpha$ increases, we expect more classification errors in classifying images from seen classes, because some of them will be classified as one of the unseen classes.
85
+
86
+ To sum up, given the arguments presented above we expect that by varying $\alpha > 0$ we can balance the error rate $\mathbb { P } \mathbf { \bar { \{ y _ { \alpha } \in \mathcal { V } ^ { t r } \vert y _ { v } \in \mathcal { V } ^ { t s } \} } }$ of leaking the unseen class images into seen class classification bdecision and the error rate $\mathbb { P } \{ \widehat { y } _ { \alpha } ^ { } \in \mathcal { V } ^ { t s } | y _ { v } ^ { - } \in \mathcal { V } ^ { t r } \}$ of leaking the seen class images into unseen bclass classification decision. This is possible as we just showed above that $\mathbb { P } \{ \widehat { y } _ { \alpha } \in \mathcal { V } ^ { t r } | y _ { v } \in \mathcal { V } ^ { t s } \}$ is a non-increasing function of $\alpha$ , while $\mathbb { P } \{ \widehat { y } _ { \alpha } \in \mathcal { V } ^ { t s } | y _ { v } \in \mathcal { V } ^ { t r } \}$ b is a non-decreasing one. It is also important to emphasize that $\alpha$ bis applied only to distances between the query embedding and the prototypes of seen classes and it is constant over seen classes. Therefore, the application of $\alpha$ does not at all affect the classification error rates either within $\mathcal { V } ^ { t r }$ or within $\mathcal { V } ^ { t s }$ . Varying $\alpha$ balances exclusively the classification errors arising from transitions between seen and unseen class labels. We study the empirical aspects of balancing $\alpha$ in Section 4.4.
87
+
88
+ Table 1: Generalized zero-shot Top-1 classification accuracy.
89
+
90
+ <table><tr><td></td><td colspan="3">CUB</td><td colspan="3">FLOWERS</td></tr><tr><td></td><td>u</td><td>S</td><td>H</td><td>u</td><td>s</td><td>H</td></tr><tr><td>CADA-VAE (Schönfeld et al., 2019)</td><td>n/a</td><td>n/a</td><td>53.4</td><td>n/a</td><td>n/a</td><td>n/a</td></tr><tr><td>f-CLSWGAN (Xian et al., 2018d)</td><td>50.3</td><td>58.3</td><td>54.0</td><td>59.0</td><td>73.8</td><td>65.6</td></tr><tr><td>f-VAEGAN-D2 (Xian et al.,2019)</td><td>48.4</td><td>60.1</td><td>53.6</td><td>56.8</td><td>74.9</td><td>64.6</td></tr><tr><td>cycle-(U)WGAN (Felix et al., 2018)</td><td>47.9</td><td>59.3</td><td>53.0</td><td>61.6</td><td>69.2</td><td>65.2</td></tr><tr><td>COSMO+f-CLSWGAN (Atzmon &amp; Chechik, 2019)</td><td>n/a</td><td>n/a</td><td>n/a</td><td>59.6</td><td>81.4</td><td>68.8</td></tr><tr><td>CLAREL (Ours)</td><td>59.3</td><td>52.6</td><td>55.8</td><td>73.0</td><td>73.6</td><td>73.3</td></tr></table>
91
+
92
+ Table 2: Zero-shot Top-1 classification accuracy.
93
+
94
+ <table><tr><td></td><td>CUB</td><td>FLOWERS</td></tr><tr><td>CADA-VAE (Schonfeld et al., 2019)</td><td>n/a</td><td>n/a</td></tr><tr><td>f-CLSWGAN (Xian et al., 2018d)</td><td>57.3</td><td>67.2</td></tr><tr><td>f-VAEGAN-D2 (Xian et al., 2019)</td><td>61.0</td><td>67.7</td></tr><tr><td>cycle-(U)WGAN (Felix et al., 2018)</td><td>58.6</td><td>70.3</td></tr><tr><td>CLAREL (Ours)</td><td>66.7</td><td>76.8</td></tr></table>
95
+
96
+ # 3 RELATED WORK
97
+
98
+ ZSL approaches aim at recognizing objects belonging to classes unseen during training (Larochelle et al., 2008; Palatucci et al., 2009). This has been extended to the GZSL framework in which the decision space consists of both seen and unseen classes (Socher et al., 2013; Xian et al., 2018c). The classical zero-shot approaches build a joint visual-semantic space, relying on a linear cross-modal compatibility function (e.g. dot-product between query embedding and semantic prototypes or a variation of a hinge loss) (Frome et al., 2013; Akata et al., 2015; 2016; Reed et al., 2016). Non-linear variants of the compatibility has also been explored (Xian et al., 2016; Socher et al., 2013). Extending previously proposed cross-modal transfer approaches based on auto-encoders (Hubert Tsai et al., 2017) and cross-domain learning (Gretton et al., 2007), more recent line of work (Schönfeld et al., 2019; Xian et al., 2018d; 2019; Felix et al., 2018; Verma et al., 2018) relies on combining these approaches and their variations with dataset augmentation tools such as GAN (Goodfellow et al., 2014) and VAE (Kingma & Welling, 2014). It is argued that the use of those tools helps to resolve one of the prominent problems in GZSL scenario: classifying images from unseen classes as one of the seen classes. There exist approaches that try to tackle this same problem via temperature calibration (Liu et al., 2018) originally proposed by Hinton et al. (2015). Chao et al. (2016); Das & Lee (2019) proposed an approach to seen/unseen accuracy balancing that is very similar to ours, based on heuristic arguments. We extend this line of work here by providing a probabilistic justification for the balancing effect observed when applying metric rescaling. Atzmon & Chechik (2019) propose a more sophisticated way to deal with seen/unseen imbalance via adaptive confidence smoothing and gating, yet as authors note it is much simpler to train than the existing GAN-based zero-shot approaches. In this work, we introduce arguably the simplest zero-shot representation training approach of all, and we demonstrate that when the image level text information is available, it achieves the state-of-the-art results on GZSL task on two well-known datasets.
99
+
100
+ # 4 EXPERIMENTAL RESULTS
101
+
102
+ # 4.1 DATASETS
103
+
104
+ We focus on learning embeddings for fine-grained visual descriptions and test them in ZSL/GZSL scenario. To test the quality of trained embeddings we focus on datasets that provide paired images and text descriptions, such as Caltech-UCSD-Birds (CUB) (Welinder et al., 2010) and Oxford Flowers (FLOWERS) (Nilsback & Zisserman, 2008), that were augmented with textual descriptions by Reed et al. (2016). We use the GZSL splits proposed by Xian et al. (2018c). The attribute-based datasets, such as SUN (Patterson et al., 2014) and AWA (Lampert et al., 2014) do not contain this information and do not have a notion of entity of a class in them. They are out of the scope of the current paper.
105
+
106
+ ![](images/6c68eb4c7e42a907d13836d18bd23fbf8d9cba1c7819eebd0cbae1133409eec9.jpg)
107
+ Figure 2: Harmonic mean Top-1 accuracy on seen and unseen, $\mathbf { H }$ , against the value of $\alpha$ on the validation set. The curves represent the mean and $9 5 \%$ confidence intervals over 10 optimization runs. Results are stable over different runs. $\mathbf { H }$ exhibits a distinct inverted U-shape w.r.t. $\alpha$ .
108
+
109
+ # 4.2 ARCHITECTURE AND TRAINING DETAILS
110
+
111
+ Below, we provide more detailed description of parameters used to build and train the architecture depicted in Figure 1. We use exactly the same hyperparameter settings for CUB and FLOWERS. The text feature extractor is built by cascading two ResNet blocks, followed by a BiLSTM. Each ResNet block has 3 convolutional/batch norm layers. The number of filters in the ResNet blocks is 128 and 256, BiLSTM has 512 filters for forward and backward branches (1024 total). All variables in the convolutional stack (including the batch normalization parameters $\gamma$ and $\beta$ ) are L2-penalized with weight 0.001. The image feature extractor is a ResNet-101 with fixed weights pretrained on the split of ImageNet proposed by Xian et al. (2018c). In this work we use precomputed image features, available in (Xian et al., 2018a) for CUB and in (Xian et al., 2018b) for FLOWERS. Image and text features are projected in the common embedding space of size 1024 with FC layers with no non-linearity. They are preceded with a dropout of 0.25. The trainable components of the model are trained for $1 5 0 \mathrm { k }$ batches of size 32 using SGD with initial learning rate of 0.1 that is annealed by a factor of 10 every $5 0 \mathrm { k }$ batches. For each batch, we sample 32 instances, each instance includes a vector of precomputed ResNet-101 features and 10 text descriptions corresponding to it, according to the original dataset definition Reed et al. (2016). All 10 text descriptions are processed via the CNN/LSTM stack and the resulting embeddings are average pooled to create a vector representation of length 1024.
112
+
113
+ # 4.3 KEY RESULTS
114
+
115
+ Our key empirical results are compared in Table 1 and in Table 2 against the latest state of the art. Our results are based on the settings of $\lambda = 0 . 5$ , $\kappa = 0 . 5$ and $\alpha$ selected on the validation sets of CUB and FLOWERS datasets. Please refer to Section 4.5 for the analysis of stability with respect to the choices of $\lambda$ and $\kappa$ and Sections 2.2 and 4.4 for more details on the selection of $\alpha$ . The combination of the proposed training method and the rebalancing of the metric space results in the state-of-the-art performance. Most of the current methods rely on the dataset augmentation techniques based on GANs, VAEs or combinations thereof. Those are clearly complementary w.r.t. our method and their addition to the training procedure is likely to further boost the performance of our proposed approach. However, this is outside of the scope of the current work. Moreover, the proposed method is state-of-the-art on FLOWERS even when compared against (Atzmon & Chechik, 2019) that uses both more sophisticated GAN based embedding learning approach and a more sophisticated seen/unseen error rate balancing based on COSMO. It is important to note that Atzmon & Chechik (2019) did not report the sentence level results on CUB. Yet, when applied on attributes together with f-CLSWGAN (Xian et al., 2018d) COSMO resulted in $0 . 8 \%$ performance drop and when applied with LAGO (Atzmon & Chechik, 2018) it achieved $0 . 5 \%$ improvement over the attribute based state of the art.
116
+
117
+ ![](images/3f384a4e76f0bc5c58077471f4b2954c58239b2f85fada1da5ff845d8c8bbbae.jpg)
118
+ Figure 3: Harmonic mean Top-1 accuracy on seen and unseen, H, against $\lambda$ , the relative weight of image and text retrieval loss terms. $\lambda = 0$ corresponds to the case of image retrieval loss having weight 1 and text retrieval loss having weight 0. Mean over 10 optimization runs.
119
+
120
+ ![](images/a157ed151bbb217f07fbd4f1af909679c63192783007d447465bf462d40594e9.jpg)
121
+ Figure 4: The plot of the harmonic mean Top-1 accuracy on seen and unseen, $\mathbf { H }$ , against $\kappa$ , the relative weight of the retrieval and the classification loss terms. $\kappa = 0$ corresponds to the case of classification loss having weight 0. The curves represent the mean over 10 optimization runs.
122
+
123
+ # 4.4 ON THE SEEN/UNSEEN ACCURACY BALANCING
124
+
125
+ Figure 2 demonstrates the plot of harmonic mean Top-1 accuracy, $\mathbf { H }$ , against the value of $\alpha$ on the validation sets of CUB and FLOWERS datasets. The validation set is constructed by further splitting the train set on both datasets. For example, CUB has a train set of 5875 images from 100 seen classes and a validation set of 2946 images from 50 unseen classes. We further divide the train set into 4700 train images from 100 seen classes, 1175 seen validation images $( 4 7 0 0 + 1 1 7 5 = 5 8 7 5 )$ and we use all the 2946 images from 50 classes as the unseen validation set. Once the value of $\alpha$ is determined we train the representation on the full train $^ +$ val subset and report results on the test split (the usual practice in GZSL). We confirm on the validation set that H exhibits an inverted U-shape behavior as a function of $\alpha$ , which was theoretically predicted in Section 2.2. Therefore, $\alpha$ can be selected on the validation set and then applied to re-scale the metric space to balance the accuracy on seen and unseen classes during test time as described in Section 2.2.
126
+
127
+ # 4.5 ABLATION STUDY
128
+
129
+ Figure 3 presents the results of the ablation study on the importance of image and text retrieval losses. We see that all of the Top-1 accuracies $( \mathbf { H } , \mathbf { s } , \mathbf { u } )$ are stable in the range of $\lambda \in [ 0 . 2 , 0 . 9 ]$ , when both losses have tangible weight. Removing either text or image retrieval losses (setting $\lambda$ to 0 or 1 respectively) leads to performance drop in both cases. Removing the text retrieval loss (case $\lambda = 0$ ) results in the most significant drop. This is due to the fact that the text retrieval task is more tightly related to the GZSL task. At the batch level, retrieving the right text given an image is equivalent to identifying the correct class encoded by a text prototype during ZSL inference step. The image retrieval task is not directly related to solving the ZSL problem and yet it does yield a positive regularizing effect on both CUB and FLOWERS.
130
+
131
+ Figure 4 shows the results of the ablation study of the interplay between the retrieval loss and the classification loss. We observe, just as in the case with $\lambda$ , that there exists a reasonably flat and stable range of $\kappa \in [ 0 . 2 , 0 . 6 ]$ . The range for $\kappa$ is a bit smaller. $\kappa = 1$ results in the catastrophic performance drop: the classification losses by themselves do not enforce any modality alignment (please refer to Fig. 1 and Algorithm 1 clearly demonstrating this).
132
+
133
+ Table 3: Generalized zero-shot Top-1 classification accuracy, ablation study.
134
+
135
+ <table><tr><td></td><td></td><td></td><td></td><td>CUB</td><td></td><td colspan="3">FLOWERS</td></tr><tr><td>α</td><td>入</td><td>K</td><td>u</td><td>S</td><td>H</td><td>u</td><td>s</td><td>H</td></tr><tr><td>0.0</td><td>0.5</td><td>0.5</td><td>38.3</td><td>65.3</td><td>48.3</td><td>55.1</td><td>84.6</td><td>66.7</td></tr><tr><td>0.0</td><td>0.5</td><td>0.0</td><td>39.3</td><td>57.5</td><td>46.7</td><td>54.0</td><td>78.1</td><td>63.8</td></tr><tr><td>√</td><td>0.5</td><td>0.0</td><td>53.8</td><td>49.6</td><td>51.6</td><td>71.7</td><td>67.2</td><td>69.4</td></tr><tr><td>√</td><td>0.0</td><td>0.5</td><td>47.4</td><td>36.6</td><td>41.3</td><td>51.5</td><td>60.5</td><td>55.6</td></tr><tr><td>√</td><td>1.0</td><td>0.5</td><td>53.9</td><td>53.8</td><td>53.8</td><td>69.5</td><td>73.9</td><td>71.6</td></tr><tr><td>厂</td><td>0.5</td><td>0.5</td><td>59.3</td><td>52.6</td><td>55.8</td><td>73.0</td><td>73.6</td><td>73.3</td></tr></table>
136
+
137
+ Table 3 studies the effects of different loss terms on the harmonic mean Top-1 accuracy H. The best result is achieved when all loss terms are active and when the metric space rescaling is on (the case of $\lambda = 0 . 5$ , $\kappa = 0 . 5$ and $\alpha$ is checked, the last line in the table). Comparing this with the case when there is no metric space rescaling (first line with $\alpha = 0$ ), we see that the rescaling helps to decrease the gap between seen and unseen classification accuracy. For CUB, the discrepancy reduction is from around $30 \%$ to around $6 \%$ , for FLOWERS it is from around $30 \%$ to around $1 \%$ . We would like to stress that we only use images and texts from the training set to achieve that. Going to the second line in the table (the image/text classification loss is inactive, $\kappa = 0$ ) and comparing it to the first one, we assess the effect of the image/text classification loss. It barely affects the performance on unseen set, but it significantly boosts the classification accuracy on the seen set (around $8 \%$ on both datasets). This is logical: adding a classifier loss results in a better classifier of the test images from the seen classes. This alone does not make it a better GZSL classifier, however. Only when applied together with metric space rescaling, this results in the performance boost (please refer to lines 1 and 6 in Table 3). Our interpretation is that the addition of the image/text classifier loss helps to reduce the intraclass variability in embeddings and provides for tighter clustering. However, this also leads to overfit on the classification task. This is accounted for by metric rescaling that enables the learnings from the image/text classification task be transferred effectively into the GZSL task.
138
+
139
+ The comparison of the last four rows of Table 3 leads us to believe that all the proposed loss terms outlined in Fig. 1 and Algorithm 1 are important for achieving the state-of-the-art performance. Excluding any one of them (corresponding to the extreme values $\lambda = 0$ , $\lambda = 1$ , $\kappa = 0$ ) leads to performance deterioration. Finally, an interesting observation can be made by comparing line 3 of Table 3 with performance of algorithms in Table 1. In this case our algorithm does not use any class labels and relies on training using exclusively the retrieval losses that can be calculated only based on the pairwise relationships between texts and images. We can see that using this type of supervision alone already results in a very high-quality representation. The representation is competitive against the latest GAN/VAE based approaches on CUB and is state-of-the-art on FLOWERS. This opens up new exploration avenues showing that in the case when very fine-grained modality outputs are available (image and text description pairs being a very prominent example), the high-quality representations may be learned without relying on manually supplied class labels.
140
+
141
+ # 5 CONCLUSIONS
142
+
143
+ We propose and empirically validate two improvements to the process of learning fine-grained crossmodal representations. First, we confirm the hypothesis that in the context of paired images and texts, a deep metric learning approach can be driven by an instance-based retrieval loss resulting in competitive generalized zero shot classification results. Combined with an additional class label based image/text crossentropy term this results in state-of-the-art performance on two well known datasets, CUB and FLOWERS. This is an interesting result demonstrating that high-quality deep representations can be trained relying largely on pairwise relationships between modalities. On top of that, we propose a solution to one of the prominent problems in GZSL: classifying instances of unseen classes as seen ones. We mathematically analyze and empirically validate the method of adjusting a single scalar that transcends in its effectiveness advanced dataset augmentation and training approaches based on GANs and VAEs.
144
+
145
+ # REFERENCES
146
+
147
+ Zeynep Akata, Scott Reed, Daniel Walter, Honglak Lee, and Bernt Schiele. Evaluation of output embeddings for fine-grained image classification. In CVPR, 2015.
148
+
149
+ Zeynep Akata, Florent Perronnin, Zaid Harchaoui, and Cordelia Schmid. Label-embedding for image classification. TPAMI, 2016.
150
+
151
+ Yuval Atzmon and Gal Chechik. Probabilistic AND-OR attribute grouping for zero-shot learning. In UAI, 2018.
152
+
153
+ Yuval Atzmon and Gal Chechik. Adaptive confidence smoothing for generalized zero-shot learning. In CVPR, 2019.
154
+
155
+ Wei-Lun Chao, Soravit Changpinyo, Boqing Gong, and Fei Sha. An empirical study and analysis of generalized zero-shot learning for object recognition in the wild. In ECCV (2), pp. 52–68, 2016.
156
+
157
+ Debasmit Das and C Lee. Zero-shot image recognition using relational matching, adaptation and calibration. In International Joint Conference on Neural Networks, 2019.
158
+
159
+ Rafael Felix, Vijay Kumar B G, Ian Reid, and Gustavo Carneiro. Multi-modal cycle-consistent generalized zero-shot learning. In ECCV, 2018.
160
+
161
+ Andrea Frome, Greg S Corrado, Jon Shlens, Samy Bengio, Jeff Dean, Marc Aurelio Ranzato, and Tomas Mikolov. DeViSE: A deep visual-semantic embedding model. In NIPS, pp. 2121–2129, 2013.
162
+
163
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NIPS, pp. 2672–2680, 2014.
164
+
165
+ Arthur Gretton, Karsten M Borgwardt, Malte Rasch, Bernhard Schölkopf, and Alex J Smola. A kernel method for the two-sample-problem. In NIPS, 2007.
166
+
167
+ Geoffrey Hinton, Oriol Vinyals, and Jeffrey Dean. Distilling the knowledge in a neural network. In NIPS Workshop, 2015.
168
+
169
+ Yao-Hung Hubert Tsai, Liang-Kang Huang, and Ruslan Salakhutdinov. Learning robust visualsemantic embeddings. In CVPR, 2017.
170
+
171
+ Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. In ICLR, 2014.
172
+
173
+ C. H. Lampert, H. Nickisch, and S. Harmeling. Attribute-based classification for zero-shot visual object categorization. TPAMI, 2014.
174
+
175
+ Hugo Larochelle, Dumitru Erhan, and Yoshua Bengio. Zero-data learning of new tasks. In AAAI, 2008.
176
+
177
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. Nature, 2015.
178
+
179
+ Shichen Liu, Mingsheng Long, Jianmin Wang, and Michael I Jordan. Generalized zero-shot learning with deep calibration network. In NIPS, 2018.
180
+
181
+ M. Nilsback and A. Zisserman. Automated flower classification over a large number of classes. In 2008 Sixth Indian Conference on Computer Vision, Graphics Image Processing, 2008.
182
+
183
+ Mark Palatucci, Dean Pomerleau, Geoffrey E Hinton, and Tom M Mitchell. Zero-shot learning with semantic output codes. In NIPS, 2009.
184
+
185
+ Genevieve Patterson, Chen Xu, Hang Su, and James Hays. The sun attribute database: Beyond categories for deeper scene understanding. IJCV, 2014.
186
+
187
+ Scott E. Reed, Zeynep Akata, Honglak Lee, and Bernt Schiele. Learning deep representations of fine-grained visual descriptions. In CVPR, 2016.
188
+
189
+ Edgar Schönfeld, Sayna Ebrahimi, Samarth Sinha, Trevor Darrell, and Zeynep Akata. Generalized zero-and few-shot learning via aligned variational autoencoders. CVPR, 2019.
190
+
191
+ Richard Socher, Milind Ganjoo, Christopher D Manning, and Andrew Ng. Zero-shot learning through cross-modal transfer. In NIPS, 2013.
192
+ Vinay Kumar Verma, Gundeep Arora, Ashish Mishra, and Piyush Rai. Generalized zero-shot learning via synthesized examples. In CVPR, 2018.
193
+ Wei Wang, Vincent W. Zheng, Han Yu, and Chunyan Miao. A survey of zero-shot learning: Settings, methods, and applications. ACM Trans. Intell. Syst. Technol., 2019.
194
+ Yaqing Wang and Quanming Yao. Few-shot learning: A survey. In arXiv, 2019.
195
+ P. Welinder, S. Branson, T. Mita, C. Wah, F. Schroff, S. Belongie, and P. Perona. Caltech-UCSD Birds 200. Technical report, California Institute of Technology, 2010.
196
+ Yongqin Xian, Zeynep Akata, Gaurav Sharma, Quynh N. Nguyen, Matthias Hein, and Bernt Schiele. Latent embeddings for zero-shot classification. In CVPR, 2016.
197
+ Yongqin Xian, Christoph H. Lampert, Bernt Schiele, and Zeynep Akata. Pretrained CUB features, 2018a. URL http://datasets.d2.mpi-inf.mpg.de/xian/xlsa17.zip.
198
+ Yongqin Xian, Christoph H. Lampert, Bernt Schiele, and Zeynep Akata. Pretrained FLOWERS features, 2018b. URL http://datasets.d2.mpi-inf.mpg.de/xian/cvpr18xian. zip.
199
+ Yongqin Xian, H. Christoph Lampert, Bernt Schiele, and Zeynep Akata. Zero-shot learning: A comprehensive evaluation of the good, the bad and the ugly. TPAMI, 2018c.
200
+ Yongqin Xian, Tobias Lorenz, Bernt Schiele, and Zeynep Akata. Feature generating networks for zero-shot learning. In CVPR, 2018d.
201
+ Yongqin Xian, Saurabh Sharma, Bernt Schiele, and Zeynep Akata. f-vaegan-d2: A feature generating framework for any-shot learning. CVPR, 2019.
202
+ H. Zhang, T. Xu, H. Li, S. Zhang, X. Wang, X. Huang, and D. N. Metaxas. StackGAN $^ { + + }$ : Realistic image synthesis with stacked generative adversarial networks. PAMI, 2018.
203
+
204
+ # A THE ANALYSIS OF ERROR RATES
205
+
206
+ We show that $\mathbb { P } \{ \widehat { y } ~ \in ~ \mathcal { Y } ^ { t r } | y _ { v } ~ \in ~ \mathcal { Y } ^ { t s } \} ~ \geq ~ \mathbb { P } \{ \widehat { y } _ { \alpha } ~ \in ~ \mathcal { Y } ^ { t r } | y _ { v } ~ \in ~ \mathcal { Y } ^ { t s } \}$ . Let us define $\delta _ { t r } \equiv$ $\begin{array} { r } { \operatorname* { m i n } _ { y \in \mathcal { y } ^ { t r } } d ( \mathbf { z } _ { v } , \mathbf { p } ( y ) ) } \end{array}$ and $\begin{array} { r } { \delta _ { t s } \equiv \operatorname* { m i n } _ { y \in \mathcal { V } ^ { t s } } d ( \mathbf { z } _ { v } , \mathbf { p } ( y ) ) } \end{array}$ , then Equation (7) can be rewritten as:
207
+
208
+ $$
209
+ \mathbb { P } \{ \widehat { y } _ { \alpha } \in \mathcal { V } ^ { t r } | y _ { v } \in \mathcal { V } ^ { t s } \} = \mathbb { P } \left\{ ( 1 + \alpha ) \delta _ { t r } < \delta _ { t s } | y _ { v } \in \mathcal { V } ^ { t s } \right\} \mathrm { ~ . ~ }
210
+ $$
211
+
212
+ Let us consider the probability of event $\delta _ { t r } < \delta _ { t s }$ and decompose it as follows:
213
+
214
+ $$
215
+ \begin{array} { r l } & { \mathbb { P } \left\{ \delta _ { t r } < \delta _ { t s } \middle | y _ { v } \in \mathcal { Y } ^ { t s } \right\} = \mathbb { P } \left\{ ( 1 + \alpha ) \delta _ { t r } < ( 1 + \alpha ) \delta _ { t s } | y _ { v } \in \mathcal { Y } ^ { t s } \right\} } \\ & { = \mathbb { P } \left\{ ( 1 + \alpha ) \delta _ { t r } < \delta _ { t s } \cup \delta _ { t s } \leq ( 1 + \alpha ) \delta _ { t r } < ( 1 + \alpha ) \delta _ { t s } | y _ { v } \in \mathcal { Y } ^ { t s } \right\} } \\ & { = \mathbb { P } \left\{ ( 1 + \alpha ) \delta _ { t r } < \delta _ { t s } | y _ { v } \in \mathcal { Y } ^ { t s } \right\} + \mathbb { P } \left\{ \delta _ { t s } \leq ( 1 + \alpha ) \delta _ { t r } < ( 1 + \alpha ) \delta _ { t s } | y _ { v } \in \mathcal { Y } ^ { t s } \right\} } \\ & { - \mathbb { P } \left\{ ( 1 + \alpha ) \delta _ { t r } < \delta _ { t s } \cap \delta _ { t s } \leq ( 1 + \alpha ) \delta _ { t r } < ( 1 + \alpha ) \delta _ { t s } | y _ { v } \in \mathcal { Y } ^ { t s } \right\} } \\ & { = \mathbb { P } \left\{ ( 1 + \alpha ) \delta _ { t r } < \delta _ { t s } | y _ { v } \in \mathcal { Y } ^ { t s } \right\} + \mathbb { P } \left\{ \delta _ { t s } \leq ( 1 + \alpha ) \delta _ { t r } < ( 1 + \alpha ) \delta _ { t s } | y _ { v } \in \mathcal { Y } ^ { t s } \right\} } \end{array}
216
+ $$
217
+
218
+ The transitions are based on the relationship between probabilities of arbitrary events $A$ and $B$ , $\mathbb { P } \{ A \cup B \} = \mathbb { P } \{ A \} + \mathbb { P } \{ B \} - \mathbb { P } \{ A \cap B \}$ , and in our case ${ \mathbb { P } } \{ A \cap B \} = 0$ . This implies that:
219
+
220
+ $$
221
+ \begin{array} { r l r } { { \mathbb { P } \{ \widehat { y } _ { \alpha } \in \mathcal { Y } ^ { t r } | y _ { v } \in \mathcal { Y } ^ { t s } \} = \mathbb { P } \{ \widehat { y } \in \mathcal { Y } ^ { t r } | y _ { v } \in \mathcal { Y } ^ { t s } \} - \mathbb { P } \{ \frac { \delta _ { t s } } { ( 1 + \alpha ) } \leq \delta _ { t r } < \delta _ { t s } | y _ { v } \in \mathcal { Y } ^ { t s } \} } } \\ & { } & { \leq \mathbb { P } \{ \widehat { y } \in \mathcal { Y } ^ { t r } | y _ { v } \in \mathcal { Y } ^ { t s } \} . } \end{array}
222
+ $$
223
+
224
+ We have just shown that for a non-negative $\alpha$ the probability of misclassifying an image from an unseen class as one of the seen classes is smaller for the decision rule $\widehat { y } _ { \alpha }$ than for the original decision rule $\widehat { y }$ . In fact, we can make a stronger claim. Since $\delta _ { t s }$ and $\delta _ { t r }$ are non-negative, it is bclear that the length of interval $[ \delta _ { t s } / ( 1 + \alpha ) , \delta _ { t s } \overline { { ) } }$ increases as $\alpha$ increases, and hence probability that $\delta _ { t r }$ falls in this interval is non-decreasing with increasing $\alpha$ . Thus we have for any $0 \leq \alpha _ { 1 } \leq \alpha _ { 2 }$ , $\mathbb { P } \{ \widehat { y } _ { \alpha _ { 1 } } \in \mathcal { Y } ^ { t r } | y _ { v } \in \mathcal { Y } ^ { t s } \} \geq \mathbb { P } \{ \widehat { y } _ { \alpha _ { 2 } } \in \mathcal { Y } ^ { \bar { t } r } | y _ { v } \in \mathcal { Y } ^ { t s } \}$ , i.e. $\mathbb { P } \{ \widehat { y } _ { \alpha } \in \mathcal { V } ^ { t r } | y _ { v } \in \mathcal { V } ^ { t s } \}$ is a monotone bnon-increasing function of $\alpha$ b band we can reduce it by increasing $\alpha$ .
md/train/SkC_7v5gx/SkC_7v5gx.md ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # THE POWER OF SPARSITY IN CONVOLUTIONAL NEURAL NETWORKS
2
+
3
+ Mark Sandler and Andrey Zhmoginov
4
+
5
+ Soravit Changpinyo ∗ Department of Computer Science University of Southern California Los Angeles, CA 90020, USA schangpi@usc.edu
6
+
7
+ Google Inc. 1600 Amphitheatre Parkway Mountain View, CA 94043, USA {sandler,azhmogin}@google.com
8
+
9
+ # ABSTRACT
10
+
11
+ Deep convolutional networks are well-known for their high computational and memory demands. Given limited resources, how does one design a network that balances its size, training time, and prediction accuracy? A surprisingly effective approach to trade accuracy for size and speed is to simply reduce the number of channels in each convolutional layer by a fixed fraction and retrain the network. In many cases this leads to significantly smaller networks with only minimal changes to accuracy. In this paper, we take a step further by empirically examining a strategy for deactivating connections between filters in convolutional layers in a way that allows us to harvest savings both in run-time and memory for many network architectures. More specifically, we generalize 2D convolution to use a channel-wise sparse connection structure and show that this leads to significantly better results than the baseline approach for large networks including VGG and Inception V3.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Deep neural networks combined with large-scale labeled data have become a standard recipe for achieving state-of-the-art performance on supervised learning tasks in recent years. Despite of their success, the capability of deep neural networks to model highly nonlinear functions comes with high computational and memory demands both during the model training and inference. In particular, the number of parameters of neural network models is often designed to be huge to account for the scale, diversity, and complexity of data that they learn from. While advances in hardware have somewhat alleviated the issue, network size, speed, and power consumption are all limiting factors when it comes to production deployment on mobile and embedded devices. On the other hand, it is wellknown that there is significant redundancy among the weights of neural networks. For example, Denil et al. (2013) show that it is possible to learn less than $5 \%$ of the network parameters and predict the rest without losing predictive accuracy. This evidence suggests that neural networks are often over-parameterized.
16
+
17
+ These motivate the research on neural network compression. However, several immediate questions arise: Are these parameters easy to identify? Could we just make the network $5 \%$ of its size and retrain? Or are more advanced methods required? There is an extensive literature in the last few years that explores the question of network compression using advanced techniques, including network prunning, loss-based compression, quantization, and matrix decomposition. We overview many of these directions in the next section. However, there is surprisingly little research on whether this over-parameterization can simply be re-captured by more efficient architectures that could be obtained from original architectures via simple transformations.
18
+
19
+ Our approach is inspired by a very simple yet successful method called depth multiplier (Howard, 2017). In this method the depth (the number of channels) of each convolutional layer in a given network is simply reduced by a fixed fraction and the network is retrained. We generalize this approach by removing the constraint that every input filter (or channel) must be fully connected to every output filter. Instead, we use a sparse connection matrix, where each output convolution channel is connected only to a small random fraction of the input channels. Note that, for convolutional networks, this still allows for efficient computation since the one channel spatial convolution across the entire plane remains unchanged.
20
+
21
+ We empirically demonstrate the effectiveness of our approach on four networks (MNIST, CIFAR Net, Inception-V3 and VGG-16) of different sizes. Our results suggest that our approach outperforms dense convolutions with depth multiplier at high compression rates.
22
+
23
+ For Inception V3 (Szegedy et al., 2016), we show that we can train a network with only about 300K of convolutional parameters1 and about 100M multiply-adds that achieves above $52 \%$ accuracy after it is fully trained. The corresponding depth-multiplier network has only about $41 \%$ accuracy. Another network that we consider is VGG-16n, a slightly modified version of VGG-16 (Simonyan & Zisserman, 2015), with $7 \mathbf { x }$ fewer parameters and similar accuracy.2 We found VGG-16n to start training much faster than the original VGG-16 which was trained incrementally in the original literature. We explore the impact of sparsification and the number of parameters on the quality of the network by building the networks up to $3 0 \mathrm { x }$ smaller than VGG-16n $2 0 0 \mathrm { x }$ smaller than the original VGG-16).
24
+
25
+ In terms of model flexibility, sparse connections allow for an incremental training approach, where connection structure between layers can be densified as training progresses. More importantly, the incremental training approach can potentially speed up the training significantly due to savings in the early stages of training.
26
+
27
+ The rest of the paper is organized as follows. Section 2 summarizes relevant work. We describe our approach in Section 3 and then present some intuition in Section 4. Finally, we show our experimental results in Section 5.
28
+
29
+ # 2 RELATED WORK
30
+
31
+ # 2.1 COMPRESSION TECHNIQUES FOR NEURAL NETWORKS
32
+
33
+ Our work is closely related to a compression technique based on network pruning. However, the important difference is that we do not try to select the connections which are redundant. Instead, we just fix a random connectivity pattern and let the network train around it. We also give a brief overview of other two popular techniques: quantization and decomposition, though these directions are not the main focus and could be complementary to our work.
34
+
35
+ Network pruning Much initial work on neural network compression focuses on removing unimportant connections using weight decay. Hanson & Pratt (1989) introduce hyperbolic and exponential biases to the objective. Optimal Brain Damage (LeCun et al., 1989) and Optimal Brain Surgeon (Hassibi & Stork, 1993) prune the networks based on second-order derivatives of the objectives. Recent work by Han et al. (2015; 2016a) alternates between pruning near-zero weights, which are encouraged by $\ell { 1 }$ or $\ell 2$ regularization, and retraining the pruned networks.
36
+
37
+ More complex regularizers have also been considered. Wen et al. (2016) and Li et al. (2016) put structured sparsity regularizers on the weights, while Murray & Chiang (2015) put them on the hidden units. Feng & Darrell (2015) explore a nonparametric prior based on the Indian buffet processes (Griffiths & Ghahramani, 2011) on layers. Hu et al. (2016) prune neurons based on the analysis of their outputs on a large dataset. Anwar et al. (2015b) consider special sparsity patterns: channel-wise (removing a feature map/channel from a layer), kernel-wise (removing all connections between two feature maps in consecutive layers), and intra-kernel-strided (removing connections between two features with particular stride and offset). They also propose to use particle filter to decide the importance of connections and paths during training.
38
+
39
+ Another line of work explores fixed network architectures with some subsets of connections removed. For example, LeCun et al. (1998) remove connections between the first two convolutional feature maps in a completely uniform manner. This is similar to our approach but they only consider a pre-defined pattern in which the same number of input feature map are assigned to each output feature map (Random Connection Table in Torch’s SpatialConvolutionMap function). Further, they do not explore how sparse connections affect performance compared to dense networks. Along a similar vein, Cires¸an et al. (2011) remove random connections in their MNIST experiments. However, they do not try to preserve the spatial convolutional density and it might be a challenge to harvest the savings on existing hardware. Ioannou et al. (2016a) explore three types of hierarchical arrangements of filter groups for CNNs, which depend on different assumptions about co-dependency of filters within each layer. These arrangements include columnar topologies inspired by AlexNet (Krizhevsky et al., 2012), tree-like topologies previously used by Ioannou et al. (2016b), and root-like topologies. Finally, Howard (2017) proposes the depth multiplier method to scale down the number of filters in each convolutional layer by a factor. In this case, depth multiplier can be thought of channel-wise pruning mentioned in (Anwar et al., 2015b). However, depth multiplier modifies the network architectures before training and removes each layer’s feature maps in a uniform manner.
40
+
41
+ With the exception of (Anwar et al., 2015b; Li et al., 2016; Ioannou et al., 2016a) and depth multiplier (Howard, 2017), the above previous work performs connection pruning that leads to irregular network architectures. Thus, those techniques require additional efforts to represent network connections and might or might not allow for direct computational savings.
42
+
43
+ Quantization Reducing the degree of redundancy of model parameters can be done in the form of quantization of network parameters. Hwang & Sung (2014); Arora et al. (2014) and Courbariaux et al. (2015; 2016); Rastegari et al. (2016) propose to train CNNs with ternary weights and binary weights, respectively. Gong et al. (2014) use vector quantization for parameters in fully connected layers. Anwar et al. (2015a) quantize a network with the squared error minimization. Chen et al. (2015) randomly group network parameters using a hash function. We note that this technique could be complementary to network pruning. For example, Han et al. (2016a) combine connection pruning in (Han et al., 2015) with quantization and Huffman coding.
44
+
45
+ Decomposition Another approach is based on low-rank decomposition of the parameters. Decomposition methods include truncated SVD (Denton et al., 2014), decomposition to rank-1 bases (Jaderberg et al., 2014), CP decomposition (PARAFAC or CANDECOMP) (Lebedev et al., 2015), Tensor-Train decomposition of Oseledets (2011) (Novikov et al., 2015), sparse dictionary learning of Mairal et al. (2009) and PCA (Liu et al., 2015), asymmetric (3D) decomposition using reconstruction loss of non-linear responses combined with a rank selection method based on PCA accumulated energy (Zhang et al., 2015b;a), and Tucker decomposition using the kernel tensor reconstruction loss combined with a rank selection method based on global analytic variational Bayesian matrix factorization (Kim et al., 2016).
46
+
47
+ # 2.2 REGULARIZATION OF NEURAL NETWORKS
48
+
49
+ Hinton et al. (2012); Srivastava et al. (2014) propose Dropout for regularizing fully connected layers within neural networks layers by randomly setting a subset of activations to zero during training. Wan et al. (2013) later propose DropConnect, a generalization of Dropout that instead randomly sets a subset of weights or connections to zero. Our approach could be thought as related to DropConnect, but (1) we remove connections before training; (2) we focus on connections between convolutional layers; and (3) we kill connections in a more regular manner by restricting connection patterns to be the same along spatial dimensions.
50
+
51
+ Recently, Han et al. (2016b) and Jin et al. (2016) propose a form of regularization where dropped connections are unfrozen and the network is retrained. This idea is similar to our incremental training approach. However, (1) we do not start with a full network; (2) we do not unfreeze connections all at once; and (3) we preserve regularity of the convolution operation.
52
+
53
+ # 2.3 NEURAL NETWORK ARCHITECTURES
54
+
55
+ Network compression and architectures are closely related. The goal of compression is to remove redundancy in network parameters; therefore, the knowledge about traits that determine architecture’s success would be desirable. Other than the discovery that depth is an important factor (Ba & Caruana, 2014), little is known about such traits.
56
+
57
+ Some previous work performs architecture search but without the main goal of doing compression (Murray & Chiang, 2015; De Brabandere et al., 2016). Recent work proposes shortcut/skip connections to convolutional networks. See, among others, highway networks (Srivastava et al., 2015), residual networks (He et al., 2016a;b), networks with stochastic depth (Huang et al., 2016b), and densely connected convolutional networks (Huang et al., 2016a).
58
+
59
+ # 3 APPROACH
60
+
61
+ A CNN architecture consist of (1) convolutional layers, (2) pooling layers, (3) fully connected layers, and (4) a topology that governs how these layers are organized. Given an architecture, our general goal is to transform it into another architecture with a smaller number of parameters. In this paper, we limit ourselves to transformation functions that keep the general topology of the input architecture intact. Moreover, the main focus will be on the convolutional layers and convolution operations, as they impose highest computational and memory burden for most if not all large networks.
62
+
63
+ # 3.1 DEPTH MULTIPLIER
64
+
65
+ We first give a description of the depth multiplier method used in Howard (2017). Given a hyperparameter $\alpha \in ( 0 , 1 ]$ , the depth multiplier approach scales down the number of filters in each convolutional layers by $\alpha$ . Note that depth here refers to the third dimension of the activation volume of a single layer, not the number of layers in the whole network.
66
+
67
+ Let $n _ { l - 1 }$ and $n _ { l }$ be the number of input and output filters at layer $l$ , respectively. After the operation $n _ { l - 1 }$ and $n _ { l }$ become $\lceil \alpha n _ { l - 1 } \rceil$ and $\lceil \alpha n _ { l } \rceil$ and the number of parameters (and the number of multiplications) becomes $\approx \alpha ^ { 2 }$ of the original number.
68
+
69
+ The result of this operation is a network that is both $1 / \alpha ^ { 2 }$ smaller and faster. Many large networks can be significantly reduced in size using this method with only a small loss of precision (Howard, 2017). It is our belief that this method establishes a strong baseline to which any other advanced techniques should compare themselves. To the best of our knowledge, we are not aware of such comparisons in the literature.
70
+
71
+ # 3.2 SPARSE RANDOM
72
+
73
+ Instead of looking at depth multiplier as deactivating channels in the convolutional layers, we can look at it from the perspective of deactivating connections. From this point of view, depth multiplier kills the connections between two convolutional layers such that (a) the connection patterns are still the same across spatial dimensions and (b) all “alive” input channels are fully connected to all “alive” output channels.
74
+
75
+ We generalize this approach by relaxing (b) while maintaining (a). That is, for every output channel, we connect it to a small subset of input channels. In other words, dense connections between a small number of channels become sparse connections between larger number of channels. This can be summarized in Fig. 1. The advantage of this is that the actual convolution can still be computed efficiently because sparsity is introduced only at the outer loop of the convolution operation and we can still take the advantage of the continuous memory layout. For more details regarding implementations of the two approaches, please refer to the Appendix.
76
+
77
+ More concretely, let $n _ { l - 1 }$ and $n _ { l }$ be the number of channels of layer $l - 1$ and layer $l$ , respectively. For a sparsity coefficient $\alpha$ , each output filter $j$ only connects to an $\alpha$ fraction of filters of the previous layer. Thus, instead of having a connectivity matrix $W _ { s i j }$ of dimension $k ^ { 2 } \times n _ { l - 1 } \times n _ { l }$ , we have a sparse matrix with non-zero entries at $W _ { s a _ { i j } j }$ , where $a _ { i j }$ is an index matrix of dimension $k ^ { 2 } \times \alpha n _ { l - 1 } \times n _ { l }$ and $k$ is the kernel size.
78
+
79
+ # 3.2.1 INCREMENTAL TRAINING
80
+
81
+ In contrast to depth multiplier, a sparse convolutional network defines a connection pattern on a much bigger network. Therefore, an interesting extension is to consider incremental training: we start with a network that only contains a small fraction of connections (in our experiments we use $1 \%$ and $0 . 1 \%$ ) and add connections over time. This is motivated by an intuition that the network can use learned channels in new contexts by introducing additional connections. The potential practical advantage of this approach is that since we start training with very small networks and grow them over time, this approach has a potential to speed up the whole training process significantly. We note that depth multiplier will not benefit from this approach as any newly activated connections would require learning new filters from scratch.
82
+
83
+ ![](images/66fc8a8512a12ff04f8f7dc6aab17648934eff7a1161c2536e3fa54b1fa83cde.jpg)
84
+ Figure 1: Connection tensors of depth multiplier (left) and sparse random (right) approaches for $n _ { l - 1 } = 5$ and $n _ { l } = 1 0$ . Yellow denotes active connections. For both approaches, the connection pattern is the same across spatial dimension and fixed before training. However, in the sparse random approach, each output channel is connected to a (possibly) different subset of input channels, and vice versa.
85
+
86
+ # 4 ANALYSIS
87
+
88
+ In this section, we approach a question of why sparse convolutions are frequently more efficient than the dense convolutions with the same number of parameters. Our main intuition is that the sparse convolutional networks promote diversity. It is much harder to learn equivalent set of channels as, at high sparsity, channels have distinct connection structure or even overlapping connections. This can be formalized with a simple observation that any dense network is in fact a part of an exponentially large equivalence class, which is guaranteed to produce the same output for every input.
89
+
90
+ Lemma 1 Any dense convolutional neural network with no cross-channel nonlinearities, distinct weights and biases, and with l hidden layers of sizes $n _ { 1 }$ , $n _ { 2 }$ , . . . , $n _ { l }$ , has at least $\textstyle \prod _ { i = 1 } ^ { l } n _ { i } !$ distinct equivalent networks which produce the same output.
91
+
92
+ Proof Let $I$ denote the input to the network, $C _ { i }$ be the convolutional operator, $\sigma _ { i }$ denote the nonlinearity operator applied to the $i$ -th convolution layer and $S$ be a final transformation (e.g. softmax classifier). We assume that $\sigma _ { i }$ is a function that operates on each of the channels independently. We note that this is the case for almost any modern network. The output of the network can then be written as:
93
+
94
+ $$
95
+ \mathcal { N } ( I ) \equiv S \circ \sigma _ { l } \circ C _ { l } \circ \sigma _ { l - 1 } \circ \cdots \circ \sigma _ { 1 } \circ C _ { 1 } ( I )
96
+ $$
97
+
98
+ where we use $\circ$ to denote function composition to avoid numerous parentheses. The convolution operator $C _ { i }$ operates on input with $n _ { i - 1 }$ channels and produces an output with $n _ { i }$ channels. Now, fix arbitrary set of permutation functions $\pi _ { i }$ , where $\pi _ { i }$ can permute depth of size $n _ { i }$ . Since $\pi _ { i }$ is a linear function, it follows that $C _ { i } ^ { \prime } = \pi _ { i } ^ { - 1 } C _ { i } \pi _ { i - 1 }$ is a valid convolutional operator, which can be obtained from $C _ { i }$ by permuting its bias according to $\pi _ { i }$ and its weight matrix along input and output dimensions according to $\pi _ { i - 1 }$ and $\pi _ { i }$ respectively. For a new network defined as:
99
+
100
+ $$
101
+ \mathcal { N } ^ { \prime } ( I ) = S ^ { \prime } \circ \sigma _ { l } \circ C _ { l } ^ { \prime } \circ \sigma _ { l - 1 } \circ \cdots \circ \sigma _ { 1 } \circ C _ { 1 } ^ { \prime } ( I ) ,
102
+ $$
103
+
104
+ where $\pi _ { 0 }$ is an identity operator and $S ^ { \prime } \equiv S \circ \pi _ { l }$ , we claim that $\mathcal { N } ^ { \prime } ( I ) \equiv \mathcal { N } ( I )$ . Indeed, since nonlinearities do not apply cross-depth we have $\pi _ { n } \sigma _ { n } \pi _ { n } ^ { - 1 } \equiv \sigma _ { n }$ and thus:
105
+
106
+ $$
107
+ \begin{array} { r l } & { \mathscr { N } ^ { \prime } ( I ) = S ^ { \prime } \circ \sigma _ { l } \circ C _ { l } ^ { \prime } \circ \sigma _ { l - 1 } \circ \cdots \circ \sigma _ { 1 } \circ C _ { 1 } ^ { \prime } ( I ) = } \\ & { \qquad = S \circ \pi _ { l } \circ \sigma _ { l } \circ \pi _ { l } ^ { - 1 } \circ C _ { l } \circ \pi _ { l - 1 } \circ \cdots \circ \pi _ { 1 } \circ \sigma _ { 1 } \circ \pi _ { 1 } ^ { - 1 } \circ C _ { 1 } ( I ) = \mathscr { N } ( I ) . } \end{array}
108
+ $$
109
+
110
+ Thus, any set of permutations on hidden units defines an equivalent network.
111
+
112
+ It is obvious that sparse networks are much more immune to parameter permutation – indeed every channel at layer $l$ is likely to have a unique tree describing its connection matrix all the way down. Exploring this direction is an interesting open question.
113
+
114
+ # 5 EXPERIMENTS
115
+
116
+ In this section, we demonstrate the effectiveness of the sparse random approach by comparing it to the depth multiplier approach at different compression rates. Moreover, we examine several settings in the incremental training where connections gradually become active during the training process.
117
+
118
+ # 5.1 SETUP
119
+
120
+ Networks and Datasets Our experiments are conducted on 4 networks for 3 different datasets.
121
+ All our experiments use open-source TensorFlow networks Abadi et al. (2015).
122
+
123
+ MNIST AND CIFAR-10 We use standard networks provided by TensorFlow. For MNIST, it has 3-layer convolutional layers and achieves $9 9 . 5 \%$ accuracy when fully trained. For CIFAR-10, it has 2 convolutional layers and achieves $87 \%$ accuracy.
124
+
125
+ IMAGENET We use open source Inception-V3 (Szegedy et al., 2016) network and a slightly modified version of VGG-16 (Simonyan & Zisserman, 2015) called VGG-16n on ImageNet ILSVRC 2012 (Deng et al., 2009; Russakovsky et al., 2015).
126
+
127
+ Random connections Connections are activated according to their likelihood from the uniform distribution. In addition, they are activated in such a way that there are no connections going in or coming out of dead filters (i.e., any connection must have a path to input image and a path to the final prediction.). All connections in fully connected layers are retained.
128
+
129
+ Implementation details All code is implemented in TensorFlow (Abadi et al., 2015). Deactivating connections is done by applying masks to parameter tensors. The Inception-v3 and VGG-16n networks are trained on 8 Tesla K80 GPUs, each with batch size 256 (32 per gpu) and batch normalization was used for all networks.
130
+
131
+ 5.2 COMPARISON BETWEEN SPARSE RANDOM AND DEPTH MULTIPLIER
132
+
133
+ # 5.2.1 MNIST AND CIFAR-10
134
+
135
+ We first compare depth multiplier and sparse random for the two small networks on MNIST and CIFAR-10. We compare the accuracy of the two approaches when the numbers of connections are roughly the same, based on a hyperparameter $\alpha$ . For dense convolutions, we pick a multiplier $\alpha$ and each filter depth is scaled down by $\sqrt { \alpha }$ and then rounded up. In sparse convolutions, a fraction $\alpha$ of connections are randomly deactivated if those parameters connect at least two filters on each layer; otherwise, a fraction of $\sqrt { \alpha }$ is used instead if the parameters connect layers with only one filter left. The accuracy numbers are averaged over 5 rounds for MNIST and 2 rounds on CIFAR-10.
136
+
137
+ We show in Fig. 2 and Fig. 3 that the sparse networks have comparable or higher accuracy for the same number of parameters, with comparable accuracy at higher density. We note however that these networks are so small that at high compression rates most of operations are concentrated at the first layer, which is negligible for large networks. Moreover, in MNIST example, the size of network changes most dramatically from 2000 to 2 million parameters, while affecting accuracy only by $1 \%$ . This observation suggests that there might be benefits of maintaining the number of filters to be high and/or breaking the symmetry of connections. We explore this in the next section.
138
+
139
+ # 5.2.2 INCEPTION-V3 ON IMAGENET
140
+
141
+ We consider different values of sparsity ranging from 0.003 to 1, and depth multiplier from 0.05 to 1. Our experiments show (see Table 1 and Fig. 4) significant advantage of sparse networks over equivalently sized dense networks. We note that due to time constraints the reported quantitative numbers are preliminary, as the networks have not finished converging. We expect the final numbers to match the reported number for Inception V3 Szegedy et al. (2016), and the smaller networks to have comparable improvement.
142
+
143
+ ![](images/65926ca6ffb9b876a5add68d622ccc4f1c7a0fd94934ef67cf453485cb422141.jpg)
144
+ Figure 2: Comparison of accuracy (averaged over 5 rounds) vs. Number of parameters/Number of multiply-adds between dense and sparse convolutions on MNIST dataset. Note that though sparse convolution result in better parameter trade-off curve, the multiply-add curve shows the opposite pattern.
145
+
146
+ Table 1: Inception V3: Preliminary quantitative results after 100 Epochs. Note the smallest sparse network is actually a hybrid network - we used both depth multiplier (0.5) and sparsity (0.01). The number of parameters is the number of parameters excluding the softmax layer.
147
+
148
+ Accuracy for sparse convolutions
149
+
150
+ <table><tr><td>Sparsity</td><td>MAdds Params</td><td>P@1</td></tr><tr><td>0.50/0.01 0.003</td><td>43.0M 90k 158k</td><td>40.3 46.1</td></tr><tr><td>0.01</td><td>82.0M 104M</td><td>52.3</td></tr><tr><td>0.03</td><td>287k 208M 724k</td><td></td></tr><tr><td>0.10</td><td></td><td>59.5</td></tr><tr><td>0.30</td><td>628M 2.3 M</td><td>67.2</td></tr><tr><td></td><td>1.80 B 6.6M</td><td>73</td></tr><tr><td>0.60</td><td>3.50B 13M 22 M</td><td>75</td></tr><tr><td>1.00</td><td>5.70 B</td><td>77</td></tr></table>
151
+
152
+ Accuracy for Depth Multiplier
153
+
154
+ <table><tr><td>Multiplier</td><td>MAdds</td><td>Params P@1</td></tr><tr><td>0.05</td><td>55.0M 56k</td><td>24.6</td></tr><tr><td>0.10</td><td>75.0M</td><td>170k 38.6</td></tr><tr><td>0.20</td><td>183M 718k</td><td>54.2</td></tr><tr><td>0.30</td><td>439M 1.8M</td><td>64.0</td></tr><tr><td>0.50</td><td>1.40B 5.4M</td><td>72.3</td></tr><tr><td>0.80</td><td>3.40B 13M</td><td>75.6</td></tr></table>
155
+
156
+ Original network: 5.70 B 22 M 77 (78.8)
157
+
158
+ # 5.2.3 VGG-16 ON IMAGENET
159
+
160
+ In our experiments with the VGG-16 network (Simonyan & Zisserman, 2015), we modify the model architecture (calling it VGG-16n) by removing the two fully-connected layers with depth 4096 and replacing them with a $2 \times 2$ maxpool layer followed by a $3 \times 3$ convolutional layer with the depth of 1024. This alone sped up our training significantly. The comparison between depth multiplier and sparse connection approaches is shown in Fig. 5. The modified VGG-16n network has about 7 times fewer parameters, but appears to have comparable precision.
161
+
162
+ ![](images/f4cf6c184c4020dc5874321b477ae62c97ddf25c9d68322157c1a605a04d32e7.jpg)
163
+ Figure 3: Comparison of accuracy (averaged over 2 rounds) vs. Number of parameters/Number of multiply-adds between dense and sparse convolutions on CIFAR-10 dataset.
164
+
165
+ ![](images/1cf4cc4464141afef87dfda693d69954f6e151da17bb74348a13d18643a16d98.jpg)
166
+ Figure 4: Inception V3: Comparison of Precision $@ 1$ vs. Number of parameters/Number of multiply-adds between dense and sparse convolutions on ImageNet/Inception-V3. The full network corresponds to the right-most point of the curve.
167
+
168
+ ![](images/a57e0b1ff2bb1e2c18547e1723279c8b784b21823938c56fcb8383c2d7879efa.jpg)
169
+ Figure 5: VGG 16: Preliminary Quantitative Results. Comparison of Precision $@ 1$ vs. Number of parameters/Number of multiply-adds between dense and sparse convolutions on ImageNet/VGG16n. The full network corresponds to the right-most point of the curve. Original VGG-16 as described in Simonyan & Zisserman (2015) (blue star) and the same model trained by us from scratch (red cross) are also shown.
170
+
171
+ # 5.3 INCREMENTAL TRAINING
172
+
173
+ ![](images/f704c8a1c6906e9b1cd74e0b702c578d2acd95067c474ee8b78c09edf9df95a7.jpg)
174
+ Figure 6: Incremental Training Of Inception V3: We show Precision $@ 1$ during the training process, where the networks densify over time. The saturation points show where the networks actually reach their full density.
175
+
176
+ Finally, we show that incremental training is a promising direction. We start with a very sparse model and increase its density over time, using the approach described in Sect. 3.2.1. We note that a naive approach where we simply add filters results in training process basically equivalent to as if it started from scratch in every step. On the other hand, when the network densifies over time, all channels already possess some discriminative power and that information is utilized.
177
+
178
+ In our experiments, we initially start training Inception-V3 with only $1 \%$ or $0 . 1 \%$ of connections enabled. Then, we double the number of connections every $T$ steps. We use $T = 1 0 , 0 0 0$ , $T =$ 25, 000 and $T = 5 0 , 0 0 0$ . The results are presented in Fig. 6. We show that the networks trained with the incremental approach regardless of the doubling period can catch up with the full Inception-V3 network (in some cases with small gains). Moreover, they recover very quickly from adding more (untrained) connections. In fact, the recovery is so fast that it is shorter than our saving interval for all the networks except for the network with 10K doubling period (resulting in the sharp drop). We believe that incremental training is a promising direction to speeding up the training of large convolutional neural networks since early stages of the training require much less computation.
179
+
180
+ # 6 CONCLUSION
181
+
182
+ We have proposed a new compression technique that uses a sparse random connection structure between input-output filters in convolutional layers of CNNs. We fix this structure before training and use the same structure across spatial dimensions to harvest savings from modern hardware. We show that this approach is especially useful at very high compression rates for large networks. For example, this simple method when applied to Inception V3 (Fig. 4), achieves AlexNet-level accuracy (Krizhevsky et al., 2012) with fewer than 400K parameters and VGG-level one (Fig. 5) with roughly $3 . 5 \mathrm { M }$ parameters. The simplicity of our approach is instructive in that it establishes a strong baseline to compare against when developing more advanced techniques. On the other hand, the uncanny match in performance of dense and equivalently-sized sparse networks with sparsity $> 0 . 1$ suggests that there might be some fundamental property of network architectures that is controlled by the number of parameters, regardless of how they are organized. Exploring this further might yield additional insights on understanding neural networks.
183
+
184
+ In addition, we show that our method leads to an interesting novel incremental training technique, where we take advantage of sparse (and smaller) models to build a dense network. One interesting open direction is to enable incremental training not to simply densify the network over time, but also increase the number of channels. This would allow us to grow the network without having to fix its original shape in place.
185
+
186
+ # REFERENCES
187
+
188
+ Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, Mike Schuster, Jonathon Shlens, Benoit ´ Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, ´ Oriol Vinyals, Pete Warden, Martin Wattenberg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL http://tensorflow.org/. Software available from tensorflow.org.
189
+
190
+ Sajid Anwar, Kyuyeon Hwang, and Wonyong Sung. Fixed point optimization of deep convolutional neural networks for object recognition. In ICASSP, 2015a.
191
+
192
+ Sajid Anwar, Kyuyeon Hwang, and Wonyong Sung. Structured pruning of deep convolutional neural networks. arXiv preprint arXiv:1512.08571, 2015b.
193
+
194
+ Sanjeev Arora, Aditya Bhaskara, Rong Ge, and Tengyu Ma. Provable bounds for learning some deep representations. In ICML, 2014.
195
+
196
+ Jimmy Ba and Rich Caruana. Do deep nets really need to be deep? In NIPS, 2014.
197
+
198
+ Wenlin Chen, James T. Wilson, Stephen Tyree, Kilian Q. Weinberger, and Yixin Chen. Compressing neural networks with the hashing trick. In ICML, 2015.
199
+
200
+ Dan C. Cires¸an, Ueli Meier, Jonathan Masci, Luca M. Gambardella, and Jurgen Schmidhuber. High- ¨ performance neural networks for visual object classification. arXiv preprint arXiv:1102.0183, 2011.
201
+ Matthieu Courbariaux, Yoshua Bengio, and Jean-Pierre David. Binaryconnect: Training deep neural networks with binary weights during propagations. In NIPS, 2015.
202
+ Matthieu Courbariaux, Itay Hubara, Daniel Soudry, Ran El-Yaniv, and Yoshua Bengio. Binarized neural networks: Training deep neural networks with weights and activations constrained to $+ 1$ or -1. arXiv preprint arXiv:1602.02830, 2016.
203
+ Bert De Brabandere, Xu Jia, Tinne Tuytelaars, and Luc Van Gool. Dynamic filter networks. In NIPS, 2016.
204
+ Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009.
205
+ Misha Denil, Babak Shakibi, Laurent Dinh, Marc Aurelio Ranzato, and Nando de Freitas. Predicting parameters in deep learning. In NIPS, 2013.
206
+ Emily L. Denton, Wojciech Zaremba, Joan Bruna, Yann LeCun, and Rob Fergus. Exploiting linear structure within convolutional networks for efficient evaluation. In NIPS, 2014.
207
+ Jiashi Feng and Trevor Darrell. Learning the structure of deep convolutional networks. In ICCV, 2015.
208
+ Yunchao Gong, Liu Liu, Ming Yang, and Lubomir Bourdev. Compressing deep convolutional networks using vector quantization. arXiv preprint arXiv:1412.6115, 2014.
209
+ Thomas L. Griffiths and Zoubin Ghahramani. The indian buffet process: An introduction and review. Journal of Machine Learning Research, 12(Apr):1185–1224, 2011.
210
+ Song Han, Jeff Pool, John Tran, and William Dally. Learning both weights and connections for efficient neural network. In NIPS, 2015.
211
+ Song Han, Huizi Mao, and William J. Dally. Deep compression: Compressing deep neural network with pruning, trained quantization and huffman coding. In ICLR, 2016a.
212
+ Song Han, Jeff Pool, Sharan Narang, Huizi Mao, Shijian Tang, Erich Elsen, Bryan Catanzaro, John Tran, and William J. Dally. Dsd: Regularizing deep neural networks with dense-sparse-dense training flow. arXiv preprint arXiv:1607.04381, 2016b.
213
+ Stephen Jose Hanson and Lorien Y. Pratt. Comparing biases for minimal network construction with back- ´ propagation. In NIPS, 1989.
214
+ Babak Hassibi and David G. Stork. Second order derivatives for network pruning: Optimal brain surgeon. In NIPS, 1993.
215
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016a.
216
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In ECCV, 2016b.
217
+ Geoffrey E. Hinton, Nitish Srivastava, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Improving neural networks by preventing co-adaptation of feature detectors. arXiv preprint arXiv:1207.0580, 2012.
218
+ Andrew G. Howard. Mobilenets: Efficient convolutional neural networks for mobile vision applications. In forthcoming, 2017.
219
+ Hengyuan Hu, Rui Peng, Yu-Wing Tai, and Chi-Keung Tang. Network trimming: A data-driven neuron pruning approach towards efficient deep architectures. arXiv preprint arXiv:1607.03250, 2016.
220
+ Gao Huang, Zhuang Liu, and Kilian Q. Weinberger. Densely connected convolutional networks. arXiv preprint arXiv:1608.06993, 2016a.
221
+ Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Weinberger. Deep networks with stochastic depth. arXiv preprint arXiv:1603.09382, 2016b.
222
+ Kyuyeon Hwang and Wonyong Sung. Fixed-point feedforward deep neural network design using weights $+ 1$ , 0, and -1. In IEEE Workshop on Signal Processing Systems (SiPS), 2014.
223
+
224
+ Yani Ioannou, Duncan Robertson, Roberto Cipolla, and Antonio Criminisi. Deep roots: Improving cnn efficiency with hierarchical filter groups. arXiv preprint arXiv:1605.06489, 2016a.
225
+
226
+ Yani Ioannou, Duncan Robertson, Jamie Shotton, Roberto Cipolla, and Antonio Criminisi. Training cnns with low-rank filters for efficient image classification. In ICLR, 2016b.
227
+
228
+ Max Jaderberg, Andrea Vedaldi, and Andrew Zisserman. Speeding up convolutional neural networks with low rank expansions. In BMVC, 2014.
229
+
230
+ Xiaojie Jin, Xiaotong Yuan, Jiashi Feng, and Shuicheng Yan. Training skinny deep neural networks with iterative hard thresholding methods. arXiv preprint arXiv:1607.05423, 2016.
231
+
232
+ Yong-Deok Kim, Eunhyeok Park, Sungjoo Yoo, Taelim Choi, Lu Yang, and Dongjun Shin. Compression of deep convolutional neural networks for fast and low power mobile applications. In ICLR, 2016.
233
+
234
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E. Hinton. Imagenet classification with deep convolutional neural networks. In NIPS, 2012.
235
+
236
+ Vadim Lebedev, Yaroslav Ganin, Maksim Rakhuba, Ivan Oseledets, and Victor Lempitsky. Speeding-up convolutional neural networks using fine-tuned cp-decomposition. In ICLR, 2015.
237
+
238
+ Yann LeCun, John S. Denker, Sara A. Solla, Richard E. Howard, and Lawrence D. Jackel. Optimal brain damage. In NIPS, 1989.
239
+
240
+ 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.
241
+
242
+ Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. arXiv preprint arXiv:1608.08710, 2016.
243
+
244
+ Baoyuan Liu, Min Wang, Hassan Foroosh, Marshall Tappen, and Marianna Pensky. Sparse convolutional neural networks. In CVPR, 2015.
245
+
246
+ Julien Mairal, Francis Bach, Jean Ponce, and Guillermo Sapiro. Online dictionary learning for sparse coding. In ICML, 2009.
247
+
248
+ Kenton Murray and David Chiang. Auto-sizing neural networks: With applications to n-gram language models. In EMNLP, 2015.
249
+
250
+ Alexander Novikov, Dmitrii Podoprikhin, Anton Osokin, and Dmitry P. Vetrov. Tensorizing neural networks. In NIPS, 2015.
251
+
252
+ Ivan V. Oseledets. Tensor-train decomposition. SIAM Journal on Scientific Computing, 33(5):2295–2317, 2011.
253
+
254
+ Mohammad Rastegari, Vicente Ordonez, Joseph Redmon, and Ali Farhadi. Xnor-net: Imagenet classification using binary convolutional neural networks. In ECCV, 2016.
255
+
256
+ 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.
257
+
258
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
259
+
260
+ Nitish Srivastava, Geoffrey E. Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(1): 1929–1958, 2014.
261
+
262
+ Rupesh K. Srivastava, Klaus Greff, and Jurgen Schmidhuber. Training very deep networks. In ¨ NIPS, 2015.
263
+
264
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In CVPR, 2016.
265
+
266
+ Li Wan, Matthew Zeiler, Sixin Zhang, Yann LeCun, and Rob Fergus. Regularization of neural networks using dropconnect. In ICML, 2013.
267
+
268
+ Wei Wen, Chunpeng Wu, Yandan Wang, Yiran Chen, and Hai Li. Learning structured sparsity in deep neural networks. In NIPS, 2016.
269
+
270
+ Xiangyu Zhang, Jianhua Zou, Kaiming He, and Jian Sun. Accelerating very deep convolutional networks for classification and detection. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2015a.
271
+
272
+ Xiangyu Zhang, Jianhua Zou, Xiang Ming, Kaiming He, and Jian Sun. Efficient and accurate approximations of nonlinear convolutional networks. In CVPR, 2015b.
273
+
274
+ # A ADDITIONAL DETAILS ON DENSE VS. SPARSE CONVOLUTIONS
275
+
276
+ We contrast naive implementations of dense and sparse convolutions (cf. Sect. 3) in Algorithm. 1 and Algorithm 2. We emphasize that we do not use sparse matrices and only introduce sparsity from channel to channel. Thus, walltime will be mostly in terms of Multiply-Adds; the basic operation (convolving the entire image plane in Line 8 of both algorithms) is unchanged.
277
+
278
+ # Algorithm 1 Naive implementation of dense convolution
279
+
280
+ 1: Inputs:
281
+ 2: - input: Data tensor
282
+ 3: - W : Parameter tensor
283
+ 4: - input channels: Array of input channel IDs
284
+ 5: - output channels: Array of output channel IDs
285
+ 6: for $i$ in input channels do
286
+ 7: for $o$ in output channels do
287
+ 8: $o u t p u t [ o ] \gets o u t p u t [ o ] + \mathrm { c o n v o l v e } ( i n p u t [ i ] , W [ i , o , . . . ] )$
288
+ 9: end for
289
+ 10: end for
290
+ 11: return output
291
+
292
+ Algorithm 2 Naive implementation of sparse convolution
293
+
294
+ 1: Inputs:
295
+ 2: - input: Data tensor
296
+ 3: - W : Parameter tensor
297
+ 4: - input channels: Array of input channel IDs
298
+ 5: - output channels connected to i: Array of array of output channel IDs specifying connec
299
+ tions to each input channel
300
+ 6: for $i$ in input channels do
301
+ 7: for index, $o$ in enumerate(output channels connected to i[i]) do
302
+ 8: output[o] $\gets$ output[o] $^ +$ convolve(input[i], W [i, index, . . .])
303
+ 9: end for
304
+ 10: end for
305
+ 11: return output
md/train/SyyGPP0TZ/SyyGPP0TZ.md ADDED
@@ -0,0 +1,257 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # REGULARIZING AND OPTIMIZING LSTM LANGUAGE MODELS
2
+
3
+ Stephen Merity, Nitish Shirish Keskar & Richard Socher Salesforce Research
4
+ Palo Alto, CA 94301, USA
5
+ {smerity,nkeskar,rsocher}@salesforce.com
6
+
7
+ # ABSTRACT
8
+
9
+ In this paper, we consider the specific problem of word-level language modeling and investigate strategies for regularizing and optimizing LSTM-based models. We propose the weight-dropped LSTM, which uses DropConnect on hidden-tohidden weights, as a form of recurrent regularization. Further, we introduce NTAvSGD, a non-monotonically triggered (NT) variant of the averaged stochastic gradient method (AvSGD), wherein the averaging trigger is determined using a NT condition as opposed to being tuned by the user. Using these and other regularization strategies, our AvSGD Weight-Dropped LSTM (AWD-LSTM) achieves state-of-the-art word level perplexities on two data sets: 57.3 on Penn Treebank and 65.8 on WikiText-2. In exploring the effectiveness of a neural cache in conjunction with our proposed model, we achieve an even lower state-of-the-art perplexity of 52.8 on Penn Treebank and 52.0 on WikiText-2. We also explore the viability of the proposed regularization and optimization strategies in the context of the quasi-recurrent neural network (QRNN) and demonstrate comparable performance to the AWD-LSTM counterpart. The code for reproducing the results is open sourced and is available at https://github.com/salesforce/ awd-lstm-lm.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Effective regularization techniques for deep learning have been the subject of much research in recent years. Given the over-parameterization of neural networks, generalization performance crucially relies on the ability to regularize the models sufficiently. Strategies such as dropout (Srivastava et al., 2014) and batch normalization (Ioffe & Szegedy, 2015) have found great success and are now ubiquitous in feed-forward and convolutional neural networks. Na¨ıvely applying these approaches to the case of recurrent neural networks (RNNs) has not been highly successful however. Many recent works have hence been focused on the extension of these regularization strategies to RNNs; we briefly discuss some of them below.
14
+
15
+ A na¨ıve application of dropout (Srivastava et al., 2014) to an RNN’s hidden state is ineffective as it disrupts the RNN’s ability to retain long term dependencies (Zaremba et al., 2014). Gal & Ghahramani (2016) propose overcoming this problem by retaining the same dropout mask across multiple time steps as opposed to sampling a new binary mask at each timestep. Another approach is to regularize the network through limiting updates to the RNN’s hidden state. One such approach is taken by Semeniuta et al. (2016) wherein the authors drop updates to network units, specifically the input gates of the LSTM, in lieu of the units themselves. This is reminiscent of zoneout (Krueger et al., 2016) where updates to the hidden state may fail to occur for randomly selected neurons.
16
+
17
+ Instead of operating on the RNN’s hidden states, one can regularize the network through restrictions on the recurrent matrices as well. This can be done either through restricting the capacity of the matrix (Arjovsky et al., 2016; Wisdom et al., 2016; Jing et al., 2016) or through element-wise interactions (Balduzzi & Ghifary, 2016; Bradbury et al., 2016; Seo et al., 2016).
18
+
19
+ Other forms of regularization explicitly act upon activations such as batch normalization (Ioffe & Szegedy, 2015), recurrent batch normalization (Cooijmans et al., 2016), and layer normalization (Ba et al., 2016). These all introduce additional training parameters and can complicate the training process while increasing the sensitivity of the model.
20
+
21
+ In this work, we investigate a set of regularization strategies that are not only highly effective but which can also be used with no modification to existing LSTM implementations. The weightdropped LSTM applies recurrent regularization through a DropConnect mask on the hidden-tohidden recurrent weights. Other strategies include the use of randomized-length backpropagation through time (BPTT), embedding dropout, activation regularization (AR), and temporal activation regularization (TAR).
22
+
23
+ As no modifications are required of the LSTM implementation these regularization strategies are compatible with black box libraries, such as NVIDIA cuDNN, which can be many times faster than na¨ıve LSTM implementations.
24
+
25
+ Effective methods for training deep recurrent networks have also been a topic of renewed interest. Once a model has been defined, the training algorithm used is required to not only find a good minimizer of the loss function but also converge to such a minimizer rapidly. The choice of the optimizer is even more important in the context of regularized models since such strategies, especially the use of dropout, can impede the training process. Stochastic gradient descent (SGD), and its variants such as Adam (Kingma & Ba, 2014) and RMSprop (Tieleman & Hinton, 2012) are amongst the most popular training methods. These methods iteratively reduce the training loss through scaled (stochastic) gradient steps. In particular, Adam has been found to be widely applicable despite requiring less tuning of its hyperparameters. In the context of word-level language modeling, past work has empirically found that SGD outperforms other methods in not only the final loss but also in the rate of convergence. This is in agreement with recent evidence pointing to the insufficiency of adaptive gradient methods (Wilson et al., 2017).
26
+
27
+ Given the success of SGD, especially within the language modeling domain, we investigate the use of averaged SGD (AvSGD) (Polyak & Juditsky, 1992) which is known to have superior theoretical guarantees. AvSGD carries out iterations similar to SGD, but instead of returning the last iterate as the solution, returns an average of the iterates past a certain, tuned, threshold $T$ . This threshold $T$ is typically tuned and has a direct impact on the performance of the method. We propose a variant of AvSGD where $T$ is determined on the fly through a non-monotonic criterion and show that it achieves better training outcomes compared to SGD.
28
+
29
+ # 2 WEIGHT-DROPPED LSTM
30
+
31
+ We refer to the mathematical formulation of the LSTM,
32
+
33
+ $$
34
+ \begin{array} { r l } & { { i _ { t } } = \sigma ( { W ^ { i } } { x _ { t } } + { U ^ { i } } { h _ { t - 1 } } ) } \\ & { { f _ { t } } = \sigma ( { W ^ { f } } { x _ { t } } + { U ^ { f } } { h _ { t - 1 } } ) } \\ & { { o _ { t } } = \sigma ( { W ^ { o } } { x _ { t } } + { U ^ { o } } { h _ { t - 1 } } ) } \\ & { { { \tilde { c } } _ { t } } = \operatorname { t a n h } ( { W ^ { c } } { x _ { t } } + { U ^ { c } } { h _ { t - 1 } } ) } \\ & { { c _ { t } } = i _ { t } \odot { { \tilde { c } } _ { t } } + { f _ { t } } \odot + { { \tilde { c } } _ { t - 1 } } } \\ & { { h _ { t } } = o _ { t } \odot \operatorname { t a n h } ( { c _ { t } } ) } \end{array}
35
+ $$
36
+
37
+ where $[ W ^ { i } , W ^ { f } , W ^ { o } , U ^ { i } , U ^ { f } , U ^ { o } ]$ are weight matrices, $x _ { t }$ is the vector input to the timestep $t$ , $h _ { t }$ is the current exposed hidden state, $c _ { t }$ is the memory cell state, and $\odot$ is element-wise multiplication.
38
+
39
+ Preventing overfitting within the recurrent connections of an RNN has been an area of extensive research in language modeling. The majority of previous recurrent regularization techniques have acted on the hidden state vector $h _ { t - 1 }$ , most frequently introducing a dropout operation between timesteps, or performing dropout on the update to the memory state $c _ { t }$ . These modifications to a standard LSTM prevent the use of black box RNN implementations that may be many times faster due to low-level hardware-specific optimizations.
40
+
41
+ We propose the use of DropConnect (Wan et al., 2013) on the recurrent hidden to hidden weight matrices which does not require any modifications to an RNN’s formulation. As the dropout operation is applied once to the weight matrices, before the forward and backward pass, the impact on training speed is minimal and any standard RNN implementation can be used, including inflexible but highly optimized black box LSTM implementations such as NVIDIA’s cuDNN LSTM.
42
+
43
+ By performing DropConnect on the hidden-to-hidden weight matrices $[ U ^ { i } , U ^ { f } , U ^ { o } , U ^ { c } ]$ within the LSTM, we can prevent overfitting from occurring on the recurrent connections of the LSTM. This regularization technique would also be applicable to preventing overfitting on the recurrent weight matrices of other RNN cells.
44
+
45
+ As the same weights are reused over multiple timesteps, the same individual dropped weights remain dropped for the entirety of the forward and backward pass. The result is similar to variational dropout, which applies the same dropout mask to recurrent connections within the LSTM by performing dropout on $h _ { t - 1 }$ , except that the dropout is applied to the recurrent weights. DropConnect could also be used on the non-recurrent weights of the LSTM $[ W ^ { i } , W ^ { f } , W ^ { o } ]$ though our focus was on preventing overfitting on the recurrent connection.
46
+
47
+ # 3 OPTIMIZATION
48
+
49
+ SGD is among the most popular methods for training deep learning models across various modalities including computer vision, natural language processing, and reinforcement learning. The training of deep networks can be posed as a non-convex empirical risk minimization problem
50
+
51
+ $$
52
+ \operatorname* { m i n } _ { w } \quad \frac { 1 } { N } \sum _ { i = 1 } ^ { N } f _ { i } ( w ) ,
53
+ $$
54
+
55
+ where $f _ { i }$ is the loss function for the $i ^ { t h }$ data point, $w$ are the weights of the network, and the expectation is taken over the data. In this context, given a sequence of learning rates, $\gamma _ { k }$ , SGD iteratively takes steps of the form
56
+
57
+ $$
58
+ w _ { k + 1 } = w _ { k } - \gamma _ { k } \hat { \nabla } f ( w _ { k } ) ,
59
+ $$
60
+
61
+ where the subscript denotes the iteration number and the $\hat { \nabla }$ denotes a stochastic gradient that may be computed on a minibatch of data points. SGD demonstrably performs well in practice and also possesses several attractive theoretical properties such as linear convergence (Bottou et al., 2016), saddle point avoidance (Panageas & Piliouras, 2016) and better generalization performance (Hardt et al., 2015). For the specific task of neural language modeling, traditionally SGD without momentum has been found to outperform other algorithms such as momentum SGD (Sutskever et al., 2013), Adam (Kingma & Ba, 2014), Adagrad (Duchi et al., 2011) and RMSProp (Tieleman & Hinton, 2012) by a statistically significant margin.
62
+
63
+ Motivated by this observation, we investigate averaged SGD (AvSGD) to further improve the training process. AvSGD has been analyzed in depth theoretically and many surprising results have been shown including its asymptotic second-order convergence (Polyak & Juditsky, 1992; Mandt et al., 2017). AvSGD tsolution, returns $\textstyle { \frac { 1 } { ( K - T + 1 ) } } \sum _ { i = T } ^ { K } w _ { i }$ to equa, where $K$ n (1) but instead of returning the lastis the total number of iterations and $T < K$ s theis a user-specified averaging trigger.
64
+
65
+ Despite its theoretical appeal, AvSGD has found limited practical use in training of deep networks. This may be in part due to unclear tuning guidelines for the learning-rate schedule $\gamma _ { k }$ and averaging trigger $T$ . If the averaging is triggered too soon, the efficacy of the method is impacted, and if it is triggered too late, many additional iterations may be needed to converge to the solution. In this section, we describe a non-monotonically triggered variant of AvSGD (NT-AvSGD), which obviates the need for tuning $T$ . Further, the algorithm uses a constant learning rate throughout the experiment and hence no further tuning is necessary for the decay scheduling.
66
+
67
+ Ideally, averaging needs to be triggered when the SGD iterates converge to a steady-state distribution (Mandt et al., 2017). This is roughly equivalent to the convergence of SGD to a neighborhood around a solution. In the case of SGD, certain learning-rate reduction strategies such as the stepwise strategy analogously reduce the learning rate by a fixed quantity at such a point. A common strategy employed in language modeling is to reduce the learning rates by a fixed proportion when the performance of the model’s primary metric (such as perplexity) worsens or stagnates. Along the same lines, one could make a triggering decision based on the performance of the model on the
68
+
69
+ # Algorithm 1 Non-monotonically Triggered AvSGD (NT-AvSGD)
70
+
71
+ Inputs: Initial point $w _ { 0 }$ , learning rate $\gamma$ , logging interval L, non-monotone interval n.
72
+ 1: Initialize $k 0$ , $t \gets 0$ , $T \gets 0$ , $\mathrm { 1 0 9 5 [ ] }$
73
+ 2: while stopping criterion not met do
74
+ 3: Compute stochastic gradient $\hat { \nabla } f ( \boldsymbol { w } _ { k } )$ and take SGD step (1).
75
+ 4: if $\mod ( k , L ) = 0$ and $T = 0$ then
76
+ 5: Compute validation perplexity $v$ .
77
+ 6: if $t > n$ and $v > \qquad \mathrm { m i n } \qquad \mathrm { l o q s [ 1 ] ~ } \mathbf { t h e l }$ n
78
+ l∈{0,··· ,t−n−1}
79
+ 7: Set $T \gets k$
80
+ 8: end if
81
+ 9: Append $v$ to logs
82
+ 10: $t \gets t + 1$
83
+ 11: end if
84
+ 12: k ← k + 1
85
+ 13: end while
86
+ return Pki=T wi
87
+
88
+ validation set. However, instead of averaging immediately after the validation metric worsens, we propose a non-monotonic criterion that conservatively triggers the averaging when the validation metric fails to improve for multiple cycles; see Algorithm 1. Given that the choice of triggering is irreversible, this conservatism ensures that the randomness of training does not play a major role in the decision. Analogous strategies have also been proposed for learning-rate reduction in SGD (Keskar & Saon, 2015).
89
+
90
+ While the algorithm introduces two additional hyperparameters, the logging interval $L$ and nonmonotone interval $n$ , we found that setting $L$ to be the number of iterations in an epoch and $n = 5$ worked well across various models and data sets. As such, we use this setting in all of our NTAvSGD experiments in the following section and demonstrate that it achieves better training outcomes as compared to SGD.
91
+
92
+ # 4 EXTENDED REGULARIZATION TECHNIQUES
93
+
94
+ In addition to the regularization and optimization techniques above, we explored additional regularization techniques that aimed to improve data efficiency during training and to prevent overfitting of the RNN model.
95
+
96
+ # 4.1 VARIABLE LENGTH BACKPROPAGATION SEQUENCES
97
+
98
+ Given a fixed sequence length that is used to break a data set into fixed length batches, the data set is not efficiently used. To illustrate this, imagine being given 100 elements to perform backpropagation through with a fixed backpropagation through time (BPTT) window of 10. Any element divisible by 10 will never have any elements to backprop into, no matter how many times you may traverse the data set. Indeed, the backpropagation window that each element receives is equal to $i$ mod 10 where $i$ is the element’s index. This is data inefficient, preventing $\frac { 1 } { 1 0 }$ of the data set from ever being able to improve itself in a recurrent fashion, and resulting in $\frac { 8 } { 1 0 }$ of the remaining elements receiving only a partial backpropagation window compared to the full possible backpropagation window of length 10.
99
+
100
+ To prevent such inefficient data usage, we randomly select the sequence length for the forward and backward pass in two steps. First, we select the base sequence length to be seq with probability $p$ and $\frac { \mathrm { s e q } } { 2 }$ with probability $1 - p$ , where $p$ is a high value approaching 1. This spreads the starting point for the BPTT window beyond the base sequence length. We then select the sequence length according to $\mathcal { N } ( \mathrm { s e q } , s )$ , where seq is the base sequence length and $s$ is the standard deviation. This jitters the starting point such that it doesn’t always fall on a specific word divisible by seq or $\frac { \mathrm { s e q } } { 2 }$ . From these, the sequence length more efficiently uses the data set, ensuring that when given enough epochs all the elements in the data set experience a full BPTT window, while ensuring the average sequence length remains around the base sequence length for computational efficiency.
101
+
102
+ During training, we rescale the learning rate depending on the length of the resulting sequence compared to the original specified sequence length. The rescaling step is necessary as sampling arbitrary sequence lengths with a fixed learning rate favors short sequences over longer ones. This linear scaling rule has been noted as important for training large scale minibatch SGD without loss of accuracy (Goyal et al., 2017) and is a component of unbiased truncated backpropagation through time (Tallec & Ollivier, 2017).
103
+
104
+ # 4.2 VARIATIONAL DROPOUT
105
+
106
+ In standard dropout, a new binary dropout mask is sampled each and every time the dropout function is called. New dropout masks are sampled even if the given connection is repeated, such as the input $x _ { 0 }$ to an LSTM at timestep $t = 0$ receiving a different dropout mask than the input $x _ { 1 }$ fed to the same LSTM at $t = 1$ . A variant of this, variational dropout (Gal & Ghahramani, 2016), samples a binary dropout mask only once upon the first call and then to repeatedly use that locked dropout mask for all repeated connections within the forward and backward pass.
107
+
108
+ While we propose using DropConnect rather than variational dropout to regularize the hidden-tohidden transition within an RNN, we use variational dropout for all other dropout operations, specifically using the same dropout mask for all inputs and outputs of the LSTM within a given forward and backward pass. Each example within the minibatch uses a unique dropout mask, rather than a single dropout mask being used over all examples, ensuring diversity in the elements dropped out.
109
+
110
+ # 4.3 EMBEDDING DROPOUT
111
+
112
+ Following Gal & Ghahramani (2016), we employ embedding dropout. This is equivalent to performing dropout on the embedding matrix at a word level, where the dropout is broadcast across all the word vector’s embedding. The remaining non-dropped-out word embeddings are scaled by $\frac { 1 } { 1 - p _ { e } }$ where $p _ { e }$ is the probability of embedding dropout. As the dropout occurs on the embedding matrix that is used for a full forward and backward pass, this means that all occurrences of a specific word will disappear within that pass, equivalent to performing variational dropout on the connection between the one-hot embedding and the embedding lookup.
113
+
114
+ # 4.4 WEIGHT TYING
115
+
116
+ Weight tying (Inan et al., 2016; Press & Wolf, 2016) shares the weights between the embedding and softmax layer, substantially reducing the total parameter count in the model. The technique has theoretical motivation (Inan et al., 2016) and prevents the model from having to learn a one-to-one correspondence between the input and output, resulting in substantial improvements to the standard LSTM language model.
117
+
118
+ # 4.5 INDEPENDENT EMBEDDING SIZE AND HIDDEN SIZE
119
+
120
+ In most natural language processing tasks, both pre-trained and trained word vectors are of relatively low dimensionality—frequently between 100 and 400 dimensions in size. Most previous LSTM language models tie the dimensionality of the word vectors to the dimensionality of the LSTM’s hidden state. Even if reducing the word embedding size was not beneficial in preventing overfitting, the easiest reduction in total parameters for a language model is reducing the word vector size. To achieve this, the first and last LSTM layers are modified such that their input and output dimensionality respectively are equal to the reduced embedding size.
121
+
122
+ 4.6 ACTIVATION REGULARIZATION (AR) AND TEMPORAL ACTIVATION REGULARIZATION (TAR)
123
+
124
+ $L _ { 2 }$ -regularization is often used on the weights of the network to control the norm of the resulting model and reduce overfitting. In addition, $L _ { 2 }$ decay can be used on the individual unit activations and on the difference in outputs of an RNN at different time steps; these strategies labeled as activation regularization (AR) and temporal activation regularization (TAR) respectively (Merity et al., 2017). AR penalizes activations that are significantly larger than 0 as a means of regularizing the network. Concretely, AR is defined as
125
+
126
+ $$
127
+ \alpha L _ { 2 } ( m \odot h _ { t } )
128
+ $$
129
+
130
+ where $m$ is the dropout mask, $L _ { 2 } ( \cdot ) = \| \cdot \| _ { 2 } , h _ { t }$ is the output of the RNN at timestep $t$ , and $\alpha$ is a scaling coefficient. TAR falls under the broad category of slowness regularizers (Hinton, 1989; Foldi ¨ ak, 1991; Luciw´ $\&$ Schmidhuber, 2012; Jonschkowski & Brock, 2015) which penalize the model from producing large changes in the hidden state. Using the notation from AR, TAR is defined as
131
+
132
+ $$
133
+ \beta L _ { 2 } ( h _ { t } - h _ { t + 1 } )
134
+ $$
135
+
136
+ where $\beta$ is a scaling coefficient. As in Merity et al. (2017), the AR and TAR loss are only applied to the output of the final RNN layer as opposed to being applied to all layers.
137
+
138
+ # 5 EXPERIMENT DETAILS
139
+
140
+ For evaluating the impact of these approaches, we perform language modeling over a preprocessed version of the Penn Treebank (PTB) (Mikolov et al., 2010) and the WikiText-2 (WT2) data set (Merity et al., 2016).
141
+
142
+ PTB: The Penn Treebank data set has long been a central data set for experimenting with language modeling. The data set is heavily preprocessed and does not contain capital letters, numbers, or punctuation. The vocabulary is also capped at 10,000 unique words, quite small in comparison to most modern datasets, which results in a large number of out of vocabulary (OoV) tokens.
143
+
144
+ WT2: WikiText-2 is sourced from curated Wikipedia articles and is approximately twice the size of the PTB data set. The text is tokenized and processed using the Moses tokenizer (Koehn et al., 2007), frequently used for machine translation, and features a vocabulary of over 30,000 words. Capitalization, punctuation, and numbers are retained in this data set.
145
+
146
+ All experiments use a three-layer LSTM model with 1150 units in the hidden layer and an embedding of size 400. The loss was averaged over all examples and timesteps. All embedding weights were uniformly initialized in the interval $[ - 0 . 1 , 0 . 1 ]$ and all other weights were initialized between $[ - \frac { 1 } { \sqrt { H } } , \frac { 1 } { \sqrt { H } } ]$ , where $H$ is the hidden size.
147
+
148
+ For training the models, we use the NT-AvSGD algorithm discussed in the previous section for 750 epochs with $L$ equivalent to one epoch and $n = 5$ . We use a batch size of 80 for WT2 and 40 for PTB. Empirically, we found relatively large batch sizes (e.g., 40-80) performed better than smaller sizes (e.g., 10-20) for NT-AvSGD. After completion, we run AvSGD with $T = 0$ and hot-started $w _ { 0 }$ as a fine-tuning step to further improve the solution. For this fine-tuning step, we terminate the run using the same non-monotonic criterion detailed in Algorithm 1.
149
+
150
+ We carry out gradient clipping with maximum norm 0.25 and use an initial learning rate of 30 for all experiments. We use a random BPTT length which is $\mathcal { N } ( 7 0 , 5 )$ with probability 0.95 and $\mathcal { N } ( 3 5 , 5 )$ with probability 0.05. The values used for dropout on the word vectors, the output between LSTM layers, the output of the final LSTM layer, and embedding dropout where (0.4, 0.3, 0.4, 0.1) respectively. For the weight-dropped LSTM, a dropout of 0.5 was applied to the recurrent weight matrices. For WT2, we increase the input dropout to 0.65 to account for the increased vocabulary size. For all experiments, we use AR and TAR values of 2 and 1 respectively, and tie the embedding and softmax weights. These hyperparameters were chosen through trial and error and we expect further improvements may be possible if a fine-grained hyperparameter search were to be conducted. In the results, we abbreviate our approach as AWD-LSTM for AvSGD Weight-Dropped LSTM. The code for reproducing our results is open sourced and available at https://github.com/ salesforce/awd-lstm-lm.
151
+
152
+ Table 1: Single model perplexity on validation and test sets for the Penn Treebank language modeling task. Parameter numbers with $^ \ddag$ are estimates based upon our understanding of the model and with reference to (Merity et al., 2016). Models noting tied use weight tying on the embedding and softmax weights. Our model, AWD-LSTM, stands for AvSGD Weight-Dropped LSTM.
153
+
154
+ <table><tr><td>Model</td><td>Parameters</td><td>Validation</td><td>Test</td></tr><tr><td>Mikolov&amp; Zweig (2012) - KN-5</td><td>2M</td><td></td><td>141.2</td></tr><tr><td>Mikolov &amp; Zweig (2012) - KN5 + cache</td><td>2M</td><td></td><td>125.7</td></tr><tr><td>Mikolov&amp; Zweig (2012) - RNN</td><td>6Mt</td><td></td><td>124.7</td></tr><tr><td>Mikolov &amp; Zweig (2012) - RNN-LDA</td><td>7M</td><td></td><td>113.7</td></tr><tr><td>Mikolov &amp; Zweig (2012) - RNN-LDA + KN-5 + cache</td><td>9M</td><td></td><td>92.0</td></tr><tr><td>Zaremba et al. (2014) -LSTM (medium)</td><td>20M</td><td>86.2</td><td>82.7</td></tr><tr><td>Zaremba et al. (2014) - LSTM (large)</td><td>66M</td><td>82.2</td><td>78.4</td></tr><tr><td>Gal &amp; Ghahramani (2O16)- Variational LSTM</td><td>20M</td><td>1</td><td>78.6</td></tr><tr><td>Gal &amp; Ghahramani (2O16)- Variational LSTM</td><td>66M</td><td>1</td><td>73.4</td></tr><tr><td>Kim et al. (2016) - CharCNN</td><td>19M</td><td>1</td><td>78.9</td></tr><tr><td>Merity et al. (2016) - Pointer Sentinel-LSTM</td><td>21M</td><td>72.4</td><td>70.9</td></tr><tr><td>Grave et al. (2016) - LSTM Grave et al. (2016) - LSTM + continuous cache pointer</td><td>1</td><td>1</td><td>82.3</td></tr><tr><td>Inan et al.(2O16) -Variational LSTM(tied) +augmented loss</td><td>一</td><td>1</td><td>72.1</td></tr><tr><td>Inan et al. (2016) - Variational LSTM (tied) + augmented loss</td><td>24M</td><td>75.7</td><td>73.2</td></tr><tr><td>Zilly et al. (2016) - Variational RHN (tied)</td><td>51M</td><td>71.1</td><td>68.5</td></tr><tr><td>Zoph &amp; Le (2016) - NAS Cell (tied)</td><td>23M</td><td>67.9</td><td>65.4</td></tr><tr><td></td><td>25M</td><td>1</td><td>64.0</td></tr><tr><td>Zoph &amp; Le (2016) - NAS Cell (tied)</td><td>54M</td><td>一</td><td>62.4</td></tr><tr><td>Melis et al. (2017) - 4-layer skip connection LSTM (tied)</td><td>24M</td><td>60.9</td><td>58.3</td></tr><tr><td>AWD-LSTM - 3-layer LSTM (tied)</td><td>24M</td><td>60.0</td><td>57.3</td></tr><tr><td>AWD-LSTM - 3-layer LSTM (tied) + continuous cache pointer</td><td>24M</td><td>53.9</td><td>52.8</td></tr></table>
155
+
156
+ Table 2: Single model perplexity over WikiText-2. Models noting tied use weight tying on the embedding and softmax weights. Our model, AWD-LSTM, stands for AvSGD Weight-Dropped LSTM.
157
+
158
+ <table><tr><td>Model</td><td>Parameters</td><td>Validation</td><td>Test</td></tr><tr><td>Inan et al. (2016) - Variational LSTM (tied)</td><td>28M</td><td>92.3</td><td>87.7</td></tr><tr><td>Inan et al. (2016) - Variational LSTM (tied) + augmented loss</td><td>28M</td><td>91.5</td><td>87.0</td></tr><tr><td>Grave et al. (2016) - LSTM</td><td>1</td><td>1</td><td>99.3</td></tr><tr><td>Grave et al. (2016) - LSTM + continuous cache pointer</td><td>1</td><td>1</td><td>68.9</td></tr><tr><td>Melis et al. (2017)- 1-layer LSTM (tied)</td><td>24M</td><td>69.3</td><td>65.9</td></tr><tr><td>Melis et al. (2017) - 2-layer skip connection LSTM (tied)</td><td>24M</td><td>69.1</td><td>65.9</td></tr><tr><td>AWD-LSTM- 3-layer LSTM (tied)</td><td>33M</td><td>68.6</td><td>65.8</td></tr><tr><td>AWD-LSTM - 3-layer LSTM (tied) + continuous cache pointer</td><td>33M</td><td>53.8</td><td>52.0</td></tr></table>
159
+
160
+ # 6 EXPERIMENTAL ANALYSIS
161
+
162
+ We present the single-model perplexity results for both our models (AWD-LSTM) and other competitive models in Table 1 and 2 for PTB and WT2 respectively 1. On both data sets we improve the state-of-the-art, with our vanilla LSTM model beating the state of the art by approximately 1 unit on PTB and 0.1 units on WT2.
163
+
164
+ In comparison to other recent state-of-the-art models, our model uses a vanilla LSTM. Zilly et al. (2016) propose the recurrent highway network, which extends the LSTM to allow multiple hidden state updates per timestep. Zoph & Le (2016) use a reinforcement learning agent to generate an RNN cell tailored to the specific task of language modeling, with the cell far more complex than the LSTM.
165
+
166
+ Independently of our work, Melis et al. (2017) apply extensive hyperparameter search to an LSTM based language modeling implementation, analyzing the sensitivity of RNN based language models to hyperparameters. Unlike our work, they use a modified LSTM, which caps the input gate $i _ { t }$ to be $\operatorname* { m i n } ( 1 - f _ { t } , i _ { t } )$ , use Adam with $\beta _ { 1 } = 0$ rather than SGD or AvSGD, use skip connections between LSTM layers, and use a black box hyperparameter tuner for exploring models and settings. Of particular interest is that their hyperparameters were tuned individually for each data set compared to our work which shared almost all hyperparameters between PTB and WT2, including the embedding and hidden size for both data sets. Due to this, they used less model parameters than our model and found shallow LSTMs of one or two layers worked best for WT2.
167
+
168
+ Like our work, Melis et al. (2017) find that the underlying LSTM architecture can be highly effective compared to complex custom architectures when well tuned hyperparameters are used. The approaches used in our work and (Melis et al., 2017) may be complementary and would be worth exploration.
169
+
170
+ # 6.1 POINTER MODELS
171
+
172
+ In past work, pointer based attention models have been shown to be highly effective in improving language modeling (Merity et al., 2016; Grave et al., 2016). Given such substantial improvements to the underlying neural language model, it remained an open question as to how effective pointer augmentation may be, especially when improvements such as weight tying may act in mutually exclusive ways.
173
+
174
+ The neural cache model (Grave et al., 2016) can be added on top of a pre-trained language model at negligible cost. The neural cache stores the previous hidden states in memory cells and then uses a simple convex combination of the probability distributions suggested by the cache and the language model for prediction. The cache model has three hyperparameters: the memory size (window) for the cache, the coefficient of the combination (which determines how the two distributions are mixed), and the flatness of the cache distribution. All of these are tuned on the validation set once a trained language model has been obtained and require no training by themselves, making it quite inexpensive to use. The tuned values for these hyperparameters were (2000, 0.1, 1.0) for PTB and (3785, 0.1279, 0.662) for WT2 respectively.
175
+
176
+ In Tables 1 and 2, we show that the model further improves the perplexity of the language model by as much as 6 perplexity points for PTB and 11 points for WT2. While this is smaller than the gains reported in Grave et al. (2016), which used an LSTM without weight tying, this is still a substantial drop. Given the simplicity of the neural cache model, and the lack of any trained components, these results suggest that existing neural language models remain fundamentally lacking, failing to capture long term dependencies or remember recently seen words effectively.
177
+
178
+ To understand the impact the pointer had on the model, specifically the validation set perplexity, we detail the contribution that each word has on the cache model’s overall perplexity in Table 3. We compute the sum of the total difference in the loss function value (i.e., log perplexity) between the LSTM-only and LSTM-with-cache models for the target words in the validation portion of the WikiText-2 data set. We present results for the sum of the difference as opposed to the mean since the latter undesirably overemphasizes infrequently occurring words for which the cache helps significantly and ignores frequently occurring words for which the cache provides modest improvements that cumulatively make a strong contribution.
179
+
180
+ The largest cumulative gain is in improving the handling of ${ \tt { < u n k > } }$ tokens, though this is over 11540 instances. The second best improvement, approximately one fifth the gain given by the ${ \mathrm { \ c u n k { \mathrm { > } } } }$ tokens, is for Meridian, yet this word only occurs 161 times. This indicates the cache still helps significantly even for relatively rare words, further demonstrated by Churchill, Blythe, or Sonic. The cache is not beneficial when handling frequent word categories, such as punctuation or stop words, for which the language model is likely well suited. These observations motivate the design of a cache framework that is more aware of the relative strengths of the two models.
181
+
182
+ # 6.2 AWD-QRNN
183
+
184
+ Several architectures for learning sequential data based on convolutions, instead of recurrences, have been proposed recently. We briefly mention experiments on the same language modeling using quasi-recurrent neural networks (QRNNs) (Bradbury et al., 2016) instead of LSTMs; we label this setup the AWD-QRNN. As in the case of AWD-LSTM, we regularize the network through weight, embedding and variational dropouts along with variable sequence lengths, weight tying, AR and TAR. The networks were designed such that they had the same number of parameters as their LSTM counterparts and were trained using NT-AvSGD. Despite the same size of the network, QRNNs were $2 - 4 \times$ faster per epoch as compared to their LSTM counterparts and required fewer epochs to converge. We report the results in Table 4. As is evident from the table, the QRNN model achieves comparable results to the LSTM suggesting the generality of the proposed regularization techniques. Interestingly, the hyperparameter values for the various regularization components, including the optimization procedure, needed minimal changes from the LSTM to the QRNN models for competitive performance. For full details and hyperparameters, refer to the released code.
185
+
186
+ Table 3: The sum total difference in loss (log perplexity) that a given word results in over all instances in the validation data set of WikiText-2 when the continuous cache pointer is introduced. The right column contains the words with the twenty best improvements (i.e., where the cache was advantageous), and the left column the twenty most deteriorated (i.e., where the cache was disadvantageous).
187
+
188
+ <table><tr><td>Word</td><td>Count</td><td>△loss</td><td>Word</td><td>Count</td><td>△loss</td></tr><tr><td>·</td><td>7632</td><td>-696.45</td><td>&lt;unk&gt;</td><td>11540</td><td>5047.34</td></tr><tr><td>,</td><td>9857</td><td>-687.49</td><td>Meridian</td><td>161</td><td>1057.78</td></tr><tr><td>of</td><td>5816</td><td>-365.21</td><td>Churchill</td><td>137</td><td>849.43</td></tr><tr><td>=</td><td>2884</td><td>-342.01</td><td>-</td><td>67</td><td>682.15</td></tr><tr><td>to</td><td>4048</td><td>-283.10</td><td>Blythe</td><td>97</td><td>554.95</td></tr><tr><td>in</td><td>4178</td><td>-222.94</td><td>Sonic</td><td>75</td><td>543.85</td></tr><tr><td>&lt;eos&gt;</td><td>3690</td><td>-216.42</td><td>Richmond</td><td>101</td><td>429.18</td></tr><tr><td>and</td><td>5251</td><td>-215.38</td><td>Starr</td><td>74</td><td>416.52</td></tr><tr><td>the</td><td>12481</td><td>-209.97</td><td>Australian</td><td>234</td><td>366.36</td></tr><tr><td>a</td><td>3381</td><td>-149.78</td><td>Pagan</td><td>54</td><td>365.19</td></tr><tr><td>”</td><td>2540</td><td>-127.99</td><td>Asahi</td><td>39</td><td>316.24</td></tr><tr><td>that</td><td>1365</td><td>-118.09</td><td>Japanese</td><td>181</td><td>295.97</td></tr><tr><td>by</td><td>1252</td><td>-113.05</td><td>Hu</td><td>43</td><td>285.58</td></tr><tr><td>was</td><td>2279</td><td>-107.95</td><td>Hedgehog</td><td>29</td><td>266.48</td></tr><tr><td>)</td><td>1101</td><td>-94.74</td><td>Burma</td><td>35</td><td>263.65</td></tr><tr><td>with</td><td>1176</td><td>-93.01</td><td>29</td><td>92</td><td>260.88</td></tr><tr><td>for</td><td>1215</td><td>-87.68</td><td>Mississippi</td><td>72</td><td>241.59</td></tr><tr><td>on</td><td>1485</td><td>-81.55</td><td>German</td><td>108</td><td>241.23</td></tr><tr><td>as</td><td>1338</td><td>-77.05</td><td>mill</td><td>67</td><td>237.76</td></tr><tr><td>at</td><td>879</td><td>-59.86</td><td>Cooke</td><td>33</td><td>231.11</td></tr></table>
189
+
190
+ Table 4: Comparison of AWD-LSTM and AWD-QRNN for the same model size on the PTB and WikiText-2 data sets.
191
+
192
+ <table><tr><td rowspan="2">Model</td><td colspan="2">PTB</td><td colspan="2">WT2</td></tr><tr><td>Validation</td><td>Test</td><td>Validation</td><td>Test</td></tr><tr><td>AWD-LSTM only training</td><td>60.7</td><td>58.3</td><td>69.1</td><td>66.0</td></tr><tr><td>+ fine tune</td><td>60.0</td><td>57.3</td><td>68.6</td><td>65.8</td></tr><tr><td>+ fine tune + continuous cache pointer</td><td>53.9</td><td>52.8</td><td>53.8</td><td>52.0</td></tr><tr><td>QRNN-LSTM only training</td><td>60.6</td><td>58.3</td><td>69.3</td><td>66.8</td></tr><tr><td>+ fine tune</td><td>59.1</td><td>56.7</td><td>68.5</td><td>65.9</td></tr><tr><td>+ fine tune + continuous cache pointer</td><td>53.4</td><td>52.6</td><td>53.6</td><td>52.1</td></tr></table>
193
+
194
+ # 6.3 MODEL ABLATION ANALYSIS
195
+
196
+ In Table 5, we present the values of validation and testing perplexity for different variants of our best-performing LSTM model. Each variant removes a form of optimization or regularization.
197
+
198
+ Table 5: Model ablations for our best LSTM models reporting results over the validation and test set on Penn Treebank and WikiText-2. Ablations are split into optimization and regularization variants, sorted according to the achieved validation perplexity on WikiText-2.
199
+
200
+ <table><tr><td rowspan="2">Model</td><td colspan="2">PTB</td><td colspan="2">WT2</td></tr><tr><td>Validation</td><td>Test</td><td>Validation</td><td>Test</td></tr><tr><td>AWD-LSTM (tied)</td><td>60.0</td><td>57.3</td><td>68.6</td><td>65.8</td></tr><tr><td>- fine-tuning</td><td>60.7</td><td>58.8</td><td>69.1</td><td>66.0</td></tr><tr><td>- NT-AvSGD</td><td>66.3</td><td>63.7</td><td>73.3</td><td>69.7</td></tr><tr><td>- variable sequence lengths</td><td>61.3</td><td>58.9</td><td>69.3</td><td>66.2</td></tr><tr><td>- embedding dropout</td><td>65.1</td><td>62.7</td><td>71.1</td><td>68.1</td></tr><tr><td>- weight decay</td><td>63.7</td><td>61.0</td><td>71.9</td><td>68.7</td></tr><tr><td>- AR/TAR</td><td>62.7</td><td>60.3</td><td>73.2</td><td>70.1</td></tr><tr><td>- full sized embedding</td><td>68.0</td><td>65.6</td><td>73.7</td><td>70.7</td></tr><tr><td>- weight-dropping</td><td>71.1</td><td>68.9</td><td>78.4</td><td>74.9</td></tr></table>
201
+
202
+ The first two variants deal with the optimization of the language models while the rest deal with the regularization. For the model using SGD with learning rate reduced by 2 using the same nonmonotonic fashion, there is a significant degradation in performance. This stands as empirical evidence regarding the benefit of averaging of the iterates. Using a monotonic criterion instead also hampered performance. Similarly, the removal of the fine-tuning step expectedly also degrades the performance. This step helps improve the estimate of the minimizer by resetting the memory of the previous experiment. While this process of fine-tuning can be repeated multiple times, we found little benefit in repeating it more than once.
203
+
204
+ The removal of regularization strategies paints a similar picture; the inclusion of all of the proposed strategies was pivotal in ensuring state-of-the-art performance. The most extreme perplexity jump was in removing the hidden-to-hidden LSTM regularization provided by the weight-dropped LSTM. Without such hidden-to-hidden regularization, perplexity rises substantially, up to 11 points. This is in line with previous work showing the necessity of recurrent regularization in state-of-the-art models (Gal & Ghahramani, 2016; Inan et al., 2016).
205
+
206
+ We also experiment with static sequence lengths which we had hypothesized would lead to inefficient data usage. This also worsens the performance by approximately one perplexity unit. Next, we experiment with reverting to matching the sizes of the embedding vectors and the hidden states. This significantly increases the number of parameters in the network (to 43M in the case of PTB and 70M for WT2) and leads to degradation by almost 8 perplexity points, which we attribute to overfitting in the word embeddings. While this could potentially be improved with more aggressive regularization, the computational overhead involved with substantially larger embeddings likely outweighs any advantages. Finally, we experiment with the removal of embedding dropout, AR/TAR and weight decay. In all of the cases, the model suffers a perplexity increase of 2–6 points which we hypothesize is due to insufficient regularization in the network.
207
+
208
+ # 7 CONCLUSION
209
+
210
+ In this work, we discuss regularization and optimization strategies for neural language models. We propose the weight-dropped LSTM, a strategy that uses a DropConnect mask on the hidden-tohidden weight matrices, as a means to prevent overfitting across the recurrent connections. Further, we investigate the use of averaged SGD with a non-monontonic trigger for training language models and show that it outperforms SGD by a significant margin. We investigate other regularization strategies including the use of variable BPTT length and achieve a new state-of-the-art perplexity on the PTB and WikiText-2 data sets. Our models outperform custom-built RNN cells and complex regularization strategies that preclude the possibility of using optimized libraries such as the NVIDIA cuDNN LSTM. We explore the use of a neural cache in conjunction with our proposed model and show that this further improves the performance, thus attaining an even lower state-of-the-art perplexity. We also explore the viability of using the proposed regularization and optimization strategies in the context of a quasi-recurrent neural network (QRNN) and demonstrate comparable performance to the LSTM counterpart. While the regularization and optimization strategies proposed are demonstrated on the task of language modeling, we anticipate that they would be generally applicable across other sequence learning tasks.
211
+
212
+ # REFERENCES
213
+
214
+ M. Arjovsky, A. Shah, and Y. Bengio. Unitary evolution recurrent neural networks. In International Conference on Machine Learning, pp. 1120–1128, 2016.
215
+ J. Ba, J. Kiros, and G. E. Hinton. Layer normalization. CoRR, abs/1607.06450, 2016.
216
+ D. Balduzzi and M. Ghifary. Strongly-typed recurrent neural networks. arXiv preprint arXiv:1602.02218, 2016.
217
+ L. Bottou, F. E. Curtis, and J. Nocedal. Optimization methods for large-scale machine learning. arXiv preprint arXiv:1606.04838, 2016.
218
+ J. Bradbury, S. Merity, C. Xiong, and R. Socher. Quasi-Recurrent Neural Networks. arXiv preprint arXiv:1611.01576, 2016.
219
+ T. Cooijmans, N. Ballas, C. Laurent, and A. C. Courville. Recurrent batch normalization. CoRR, abs/1603.09025, 2016.
220
+ J. Duchi, E. Hazan, and Y. Singer. Adaptive subgradient methods for online learning and stochastic optimization. Journal of Machine Learning Research, 12(Jul):2121–2159, 2011.
221
+ P. Foldi ¨ ak. Learning invariance from transformation sequences. ´ Neural Computation, 3(2):194–200, 1991.
222
+ Y. Gal and Z. Ghahramani. A theoretically grounded application of dropout in recurrent neural networks. In NIPS, 2016.
223
+ P. Goyal, P. Dollar, R. Girshick, P. Noordhuis, L. Wesolowski, A. Kyrola, A. Tulloch, Y. Jia, ´ and K. He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
224
+ E. Grave, A. Joulin, and N. Usunier. Improving neural language models with a continuous cache. arXiv preprint arXiv:1612.04426, 2016.
225
+ M. Hardt, B. Recht, and Y. Singer. Train faster, generalize better: Stability of stochastic gradient descent. arXiv preprint arXiv:1509.01240, 2015.
226
+ G. E. Hinton. Connectionist learning procedures. Artificial intelligence, 40(1-3):185–234, 1989.
227
+ H. Inan, K. Khosravi, and R. Socher. Tying Word Vectors and Word Classifiers: A Loss Framework for Language Modeling. arXiv preprint arXiv:1611.01462, 2016.
228
+ S. Ioffe and C. Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
229
+ L. Jing, Y. Shen, T. Dubcek, J. Peurifoy, S. Skirlo, M. Tegmark, and M. Solja ˇ ciˇ c. Tunable ´ Efficient Unitary Neural Networks (EUNN) and their application to RNN. arXiv preprint arXiv:1612.05231, 2016.
230
+ R. Jonschkowski and O. Brock. Learning state representations with robotic priors. Auton. Robots, 39:407–428, 2015.
231
+ N. Keskar and G. Saon. A nonmonotone learning rate strategy for sgd training of deep neural networks. In Acoustics, Speech and Signal Processing (ICASSP), 2015 IEEE International Conference on, pp. 4974–4978. IEEE, 2015.
232
+ Y. Kim, Y. Jernite, D. Sontag, and A. M. Rush. Character-aware neural language models. In Thirtieth AAAI Conference on Artificial Intelligence, 2016.
233
+ D. Kingma and J. Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
234
+ P. Koehn, H. Hoang, A. Birch, C. Callison-Burch, M. Federico, N. Bertoldi, B. Cowan, W. Shen, C. Moran, R. Zens, C. Dyer, O. Bojar, A. Constantin, and E. Herbst. Moses: Open source toolkit for statistical machine translation. In ACL, 2007.
235
+ D. Krueger, T. Maharaj, J. Kramar, M. Pezeshki, N. Ballas, N. Ke, A. Goyal, Y. Bengio, ´ H. Larochelle, A. Courville, et al. Zoneout: Regularizing RNNss by randomly preserving hidden activations. arXiv preprint arXiv:1606.01305, 2016.
236
+ M. Luciw and J. Schmidhuber. Low complexity proto-value function learning from sensory observations with incremental slow feature analysis. Artificial Neural Networks and Machine Learning– ICANN 2012, pp. 279–287, 2012.
237
+ S. Mandt, M. D. Hoffman, and D. M. Blei. Stochastic gradient descent as approximate bayesian inference. arXiv preprint arXiv:1704.04289, 2017.
238
+ G. Melis, C. Dyer, and P. Blunsom. On the State of the Art of Evaluation in Neural Language Models. arXiv preprint arXiv:1707.05589, 2017.
239
+ S. Merity, C. Xiong, J. Bradbury, and R. Socher. Pointer Sentinel Mixture Models. arXiv preprint arXiv:1609.07843, 2016.
240
+ S. Merity, B. McCann, and R. Socher. Revisiting activation regularization for language rnns. arXiv preprint arXiv:1708.01009, 2017.
241
+ T. Mikolov and G. Zweig. Context dependent recurrent neural network language model. SLT, 12: 234–239, 2012.
242
+ T. Mikolov, M. Karafiat, L. Burget, J. Cernock ´ y, and S. Khudanpur. Recurrent neural network based ´ language model. In INTERSPEECH, 2010.
243
+ I. Panageas and G. Piliouras. Gradient descent converges to minimizers: The case of non-isolated critical points. CoRR, abs/1605.00405, 2016.
244
+ B. Polyak and A. Juditsky. Acceleration of stochastic approximation by averaging. SIAM Journal on Control and Optimization, 30(4):838–855, 1992.
245
+ O. Press and L. Wolf. Using the output embedding to improve language models. arXiv preprint arXiv:1608.05859, 2016.
246
+ S. Semeniuta, A. Severyn, and E. Barth. Recurrent dropout without memory loss. In COLING, 2016.
247
+ M. Seo, S. Min, A. Farhadi, and H. Hajishirzi. Query-Reduction Networks for Question Answering. arXiv preprint arXiv:1606.04582, 2016.
248
+ N. Srivastava, G. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15: 1929–1958, 2014.
249
+ I. Sutskever, J. Martens, G. Dahl, and G. Hinton. On the importance of initialization and momentum in deep learning. In International conference on machine learning, pp. 1139–1147, 2013.
250
+ C. Tallec and Y. Ollivier. Unbiasing truncated backpropagation through time. arXiv preprint arXiv:1705.08209, 2017.
251
+ T. Tieleman and G. Hinton. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural networks for machine learning, 4(2):26–31, 2012.
252
+ L. Wan, M. Zeiler, S. Zhang, Y LeCun, and R. Fergus. Regularization of neural networks using dropconnect. In Proceedings of the 30th international conference on machine learning (ICML13), pp. 1058–1066, 2013.
253
+ A. C Wilson, R. Roelofs, M. Stern, N. Srebro, and B. Recht. The marginal value of adaptive gradient methods in machine learning. arXiv preprint arXiv:1705.08292, 2017.
254
+ S. Wisdom, T. Powers, J. Hershey, J. Le Roux, and L. Atlas. Full-capacity unitary recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 4880–4888, 2016.
255
+ W. Zaremba, I. Sutskever, and O. Vinyals. Recurrent neural network regularization. arXiv preprint arXiv:1409.2329, 2014.
256
+ J. G. Zilly, R. K. Srivastava, J. Koutn´ık, and J. Schmidhuber. Recurrent highway networks. arXiv preprint arXiv:1607.03474, 2016.
257
+ B. Zoph and Q. V. Le. Neural architecture search with reinforcement learning. arXiv preprint arXiv:1611.01578, 2016.
md/train/_61Qh8tULj_/_61Qh8tULj_.md ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Conflict-Averse Gradient Descent for Multi-task Learning
2
+
3
+ †Bo Liu, †Xingchao Liu, ‡Xiaojie Jin, †,§Peter Stone, †Qiang Liu †The University of Texas at Austin, §Sony AI, $^ \ddag$ Bytedance Research {bliu,xcliu,pstone,lqiang}@cs.utexas.edu, xjjin0731@gmail.com
4
+
5
+ # Abstract
6
+
7
+ The goal of multi-task learning is to enable more efficient learning than single task learning by sharing model structures for a diverse set of tasks. A standard multi-task learning objective is to minimize the average loss across all tasks. While straightforward, using this objective often results in much worse final performance for each task than learning them independently. A major challenge in optimizing a multi-task model is the conflicting gradients, where gradients of different task objectives are not well aligned so that following the average gradient direction can be detrimental to specific tasks’ performance. Previous work has proposed several heuristics to manipulate the task gradients for mitigating this problem. But most of them lack convergence guarantee and/or could converge to any Pareto-stationary point. In this paper, we introduce Conflict-Averse Gradient descent (CAGrad) which minimizes the average loss function, while leveraging the worst local improvement of individual tasks to regularize the algorithm trajectory. CAGrad balances the objectives automatically and still provably converges to a minimum over the average loss. It includes the regular gradient descent (GD) and the multiple gradient descent algorithm (MGDA) in the multi-objective optimization (MOO) literature as special cases. On a series of challenging multi-task supervised learning and reinforcement learning tasks, CAGrad achieves improved performance over prior state-of-the-art multi-objective gradient manipulation methods. Code is available at https://github.com/Cranial-XIX/CAGrad.
8
+
9
+ # 1 Introduction
10
+
11
+ Multi-task learning (MTL) refers to learning a single model that can tackle multiple different tasks [11, 28, 44, 38]. By sharing parameters across tasks, MTL methods learn more efficiently with an overall smaller model size compared to learning with separate models [38, 40, 25]. Moreover, it has been shown that MTL could in principle improve the quality of the learned representation and therefore benefit individual tasks [35, 43, 34]. For example, an early MTL result by [2] demonstrated that training a neural network to recognize doors could be improved by simultaneously training it to recognize doorknobs.
12
+
13
+ However, learning multiple tasks simultaneously can be a challenging optimization problem because it involves multiple objectives [38]. The most popular MTL objective in practice is the average loss over all tasks. Even when this average loss is exactly the true objective (as opposed to only caring about a single task as in the door/doorknob example), directly optimizing the average loss could lead to undesirable performance, e.g. the optimizer struggles to make progress so the learning performance significantly deteriorates. A known cause of this phenomenon is the conflicting gradients [41]: gradients from different tasks 1) may have varying scales with the largest gradient dominating the update, and 2) may point in different directions so that directly optimizing the average loss can be quite detrimental to a specific task’s performance.
14
+
15
+ ![](images/14d2ae6187fa423d10a6e6e4e172d11a36640fdd1044a7d8913cb1c05d44c78d.jpg)
16
+ Figure 1: The optimization challenges faced by gradient descent (GD) and existing gradient manipulation methods like the multiple gradient descent algorithm (MGDA) [6] and PCGrad [41]. MGDA, PCGrad and CAGrad are applied on top of the Adam optimizer [16]. For each methods, we repeat 3 runs of optimization from different initial points (labeled with $\bullet$ ). Each optimization trajectory is colored from red to yellow. GD with Adam gets stuck on two of the initial points because the gradient of one task overshadows that of the other task, causing the algorithm to jump back and forth between the walls of a steep valley without making progress along the floor of the valley. MGDA and PCGrad stop optimization as soon as they reach the Pareto set.
17
+
18
+ To address this problem, previous work either adaptively re-weights the objectives of each task based on heuristics [3, 15] or seeks a better update vector [30, 41] by manipulating the task gradients. However, existing work often lacks convergence guarantees or only provably converges to any point on the Pareto set of the objectives. This means the final convergence point of these methods may largely depend on the initial model parameters. As a result, it is possible that these methods over-optimize one objective while overlooking the others (See Fig. 1).
19
+
20
+ Motivated by the limitation of current methods, we introduce Conflict-Averse Gradient descent (CAGrad), which reduces the conflict among gradients and still provably converges to a minimum of the average loss. The idea of CAGrad is simple: it looks for an update vector that maximizes the worst local improvement of any objective in a neighborhood of the average gradient. In this way, CAGrad automatically balances different objectives and smoothly converges to an optimal point of the average loss. Specifically, we show that vanilla gradient descent (GD) and the multiple gradient descent algorithm (MGDA) are special cases of CAGrad (See Sec. 3.1). We demonstrate that CAGrad can improve over prior state-of-the-art gradient manipulation methods on a series of challenging multi-task supervised, semi-supervised, and reinforcement learning problems.
21
+
22
+ # 2 Background
23
+
24
+ In this section, we first introduce the problem setup of multi-task learning (MTL). Then we analyze the optimization challenge of MTL and discuss the limitation of prior gradient manipulation methods.
25
+
26
+ # 2.1 Multi-task Learning and its Challenge
27
+
28
+ In multi-task learning (MTL), we are given $K \geq 2$ different tasks, each of which is associated with a loss function $L _ { i } ( \theta )$ for a shared set of parameters $\theta$ . The goal is to find an optimal $\theta \in \mathbb { R } ^ { m }$ that achieves low losses across all tasks. In practice, a standard objective for MTL is minimizing the average loss over all tasks:
29
+
30
+ $$
31
+ \theta ^ { * } = \underset { \theta \in \mathbb { R } ^ { m } } { \arg \operatorname* { m i n } } \left\{ L _ { 0 } ( \theta ) \triangleq \frac { 1 } { K } \sum _ { i = 1 } ^ { K } L _ { i } ( \theta ) \right\} .
32
+ $$
33
+
34
+ Unfortunately, directly optimizing (1) using gradient descent may significantly compromise the optimization of individual losses in practice. A major source of this phenomenon is known as the conflicting gradients [41].
35
+
36
+ Optimization Challenge: Conflicting Gradients Denote by $g _ { i } = \nabla L _ { i } ( \theta )$ the gradient of task $i$ , and $\begin{array} { r } { g _ { 0 } = \nabla L _ { 0 } ( \theta ) = \frac { 1 } { K } \sum _ { i } ^ { K } g _ { i } } \end{array}$ the averaged gradient. With learning rate $\alpha \in \mathbb { R } ^ { + }$ , $\theta \theta - \alpha g _ { 0 }$ is the steepest descent update that appears to be the most natural update to follow when optimizing (1). However, $g _ { 0 }$ may conflict with individual gradients, i.e. $\exists \ i$ , $\langle g _ { i } , g _ { 0 } \rangle < 0$ . When this conflict is large, following $g _ { 0 }$ will decrease the performance on task $i$ . As observed by [41] and illustrated in Fig. 1, when $\theta$ is near a steep “valley", where a specific task’s gradient dominates the update, manipulating the direction and magnitude of $g _ { 0 }$ often leads to better optimization.
37
+
38
+ # 2.2 Prior Attempts and Convergence Issues
39
+
40
+ Several methods have been proposed to manipulate the task gradients to form a new update vector and have shown improved performance on MTL. Sener et al. apply the multiple-gradient descent algorithm (MGDA) [6] for MTL, which directly optimizes towards the Pareto set [30]. Chen et al. dynamically re-weight each $L _ { i }$ using a pre-defined heuristic [3]. More recently, PCGrad identifies conflicting gradients as the motivation behind manipulating the gradients and projects each task gradient to the normal plane of others to reduce the conflict [41]. While all these methods have shown success at improving the learning performance of MTL, they manipulate the gradient without respecting the original objective (1). Therefore, these methods could in principle converge to any point in the Pareto set (See Fig. 1 and Sec. 3.2). We provide the detailed algorithms of MGDA and PCGrad in Appendix A.1 and A.2, and a visualization of the update vector by each method in Fig. 2.
41
+
42
+ # 3 Method
43
+
44
+ We introduce our main algorithm, Conflict-Averse Gradient descent in Sec. 3.1, and then show theoretical analysis in Sec. 3.2.
45
+
46
+ # 3.1 Conflict-Averse Gradient Descent
47
+
48
+ Assume we update $\theta$ by $\theta ^ { \prime } \theta - \alpha d$ , where $\alpha$ is a step size and $d$ an update vector. We want to choose $d$ to decrease not only the average loss $L _ { 0 }$ , but also every individual loss. To do so, we consider the minimum decrease rate across the losses,
49
+
50
+ $$
51
+ R ( \theta , d ) = \operatorname* { m a x } _ { i \in [ K ] } \left\{ { \frac { 1 } { \alpha } } \left( L _ { i } ( \theta - \alpha d ) - L _ { i } ( \theta ) \right) \right\} \approx - \operatorname* { m i n } _ { i \in [ K ] } \langle g _ { i } , d \rangle ,
52
+ $$
53
+
54
+ where we use the first-order Taylor approximation assuming $\alpha$ is small. If $R ( \theta , d ) < 0$ , it means that all losses are decreased with the update given a sufficiently small $\alpha$ . Therefore, $R ( \theta , d )$ can be regarded as a measurement of conflict among objectives.
55
+
56
+ With the above measurement, our algorithm finds an update vector that minimizes such conflict to mitigate the optimization challenge while still converging to an optimum of the main objective $L _ { 0 } ( \theta )$ . To this end, we introduce Conflict-Averse Gradient descent (CAGrad), which on each optimization step determines the update $d$ by solving the following optimization problem:
57
+
58
+ $$
59
+ \operatorname* { m a x } _ { d \in \mathbb { R } ^ { m } } \operatorname* { m i n } _ { i \in [ K ] } \langle g _ { i } , d \rangle \quad \mathrm { s . t . } \quad \left\| d - g _ { 0 } \right\| \leq c \left\| g _ { 0 } \right\| ,
60
+ $$
61
+
62
+ Here, $c \in [ 0 , 1 )$ is a pre-specified hyper-parameter that controls the convergence rate (See Sec. 3.2). The optimization problem (3) looks for the best update vector within a local ball centered at the averaged gradient $g _ { 0 }$ , which also minimizes the conflict in losses measured by (2). Since we focus on MTL and choose the average loss as the main objective, $g _ { 0 }$ is the average gradient. However, CAGrad also applies when $g _ { 0 }$ is the gradient of some other user-specified objective. We leave exploring this possibility as a future direction.
63
+
64
+ Dual Objective The optimization problem (3) involves decision variable $d$ that has the same dimension as the number of parameters in $\theta$ , which could be millions for a deep neural network. It is not practical to directly solve for $d$ on every optimization step. However, the dual problem of Eq. (3), as we will derive in the following, only involves solving for a decision variable $w \in \mathbb { R } ^ { K }$ , which can be efficiently found using standard optimization libraries [7]. Specifically, first note that $\begin{array} { r } { \operatorname* { m i n } _ { i } \langle g _ { i } , d \rangle = \operatorname* { m i n } _ { w \in \mathcal { W } } \langle \sum _ { i } w _ { i } \bar { g } _ { i } , d \rangle } \end{array}$ , where $w = ( w _ { 1 } , \dots , w _ { K } ) \in \mathbb { R } ^ { K }$ and $\mathcal { W }$ denotes the probability simplex, i.e. $\begin{array} { r } { \mathcal { W } = \{ w : \sum _ { i } w _ { i } = 1 } \end{array}$ and $w _ { i } ~ \geq ~ 0 \}$ . Denote $\begin{array} { r } { g _ { w } \ = \ \sum _ { i } w _ { i } g _ { i } } \end{array}$ and $\phi = c ^ { 2 } \left\| g _ { 0 } \right\| ^ { 2 }$ . The Lagrangian of the objective in Eq. (3) is
65
+
66
+ $$
67
+ \operatorname* { m a x } _ { d \in \mathbb { R } ^ { m } } \operatorname* { m i n } _ { \lambda \geq 0 , w \in \mathcal { W } } g _ { w } ^ { \top } d - \lambda ( \left. g _ { 0 } - d \right. ^ { 2 } - \phi ) / 2 .
68
+ $$
69
+
70
+ Since the objective for $d$ is concave with linear constraints, by switching the min and max, we reach the dual form without changing the solution by Slater’s condition:
71
+
72
+ $$
73
+ \operatorname* { m i n } _ { \lambda \geq 0 , w \in \mathcal { W } } \operatorname* { m a x } _ { d \in \mathbb { R } ^ { m } } g _ { w } ^ { \top } d - \lambda \left. g _ { 0 } - d \right. ^ { 2 } / 2 + \lambda \phi / 2 .
74
+ $$
75
+
76
+ <table><tr><td>Input: Initial model parameter vector 0o,differentiable loss functions {Li}=1,a constant c ∈ [0,1) and learning rate α ∈ R+.</td></tr><tr><td>repeat</td></tr><tr><td>At the t-th optimization step,define go = k∑i-1 VLi(θt-1) and =c² /ol²2. 1K Solve</td></tr><tr><td>K min, F(w) := gg +√Φ|lgull,where gω = 1 M wiVLi(0t-1).</td></tr><tr><td>K wEW i=1</td></tr><tr><td></td></tr><tr><td>Update 0t = 0t-1-α (go+ i 1/2 9w). 1igwll</td></tr><tr><td>until convergence</td></tr><tr><td></td></tr></table>
77
+
78
+ We end up with the following optimization problem w.r.t. $w$ after several steps of calculus,
79
+
80
+ $$
81
+ \boldsymbol { w } ^ { * } = \underset { \boldsymbol { w } \in \mathcal { W } } { \arg \operatorname* { m i n } } \ : g _ { \boldsymbol { w } } ^ { \top } \boldsymbol { g } _ { 0 } + \sqrt { \phi } \left\| \boldsymbol { g } _ { \boldsymbol { w } } \right\| ,
82
+ $$
83
+
84
+ where the optimal $\lambda ^ { * } = \| g _ { w ^ { * } } \| / \phi ^ { 1 / 2 }$ and the optimal update $d ^ { * } = g _ { 0 } + g _ { w ^ { * } } / \lambda ^ { * }$ . The detailed derivation is provided in Appendix A.3 and the entire CAGrad algorithm is summarized in Alg. 1. The dimension of $w$ equals to the number of objectives $K$ , which usually ranges from 2 to tens and is much smaller than the number of parameters in a neural network. Therefore, in practice, we solve the dual objective to perform the update of CAGrad.
85
+
86
+ Remark In Alg. 1, when $c = 0$ , CAGrad recovers the typical gradient descent with $d = g _ { 0 }$ . On the other hand, when $c \to \infty$ , then minimizing $F ( w )$ is equivalent to $\operatorname* { m i n } _ { w } \left\| g _ { w } \right\|$ . This coincides with the multiple gradient descent algorithm (MGDA) [6], which uses the minimum norm vector in the convex hull of the individual gradients as the update direction (see Fig. 2; second column). MGDA is a gradient-based multi-objective optimization designed to converge to an arbitrary point on the Pareto set, that is, it leaves all the points on the Pareto set as fixed points (and hence can not control which specific point it will converge to). It is different from our method which targets to minimize $L _ { 0 }$ while using gradient conflict to regularize the optimization trajectory. As we will analyze in the following section, to guarantee that CAGrad converges to an optimum of $L _ { 0 } ( \theta )$ , we have to ensure $0 \leq c < 1$
87
+
88
+ # 3.2 Convergence Analysis
89
+
90
+ In this section we first formally introduce the related Pareto concepts and then analyze CAGrad’s convergence property. Particularly, in Alg. 1, when $c < 1$ , CAGrad is guaranteed to converge to a minimum point of the average loss $L _ { 0 }$ .
91
+
92
+ Pareto Concepts Unlike single task learning where any two parameter vectors $\theta _ { 1 }$ and $\theta _ { 2 }$ can be ordered in the sense that either $L ( \theta _ { 1 } ) \leq L ( \mathsf { \bar { \theta } } _ { 2 } )$ or $L ( \theta _ { 1 } ) \ge L \bar { ( \theta _ { 2 } ) }$ holds, MTL could have two parameter vectors where one performs better for task $i$ and the other performs better for task $j \neq i$ To this end, we need the notion of Pareto-optimality [13].
93
+
94
+ Definition 3.1 (Pareto optimal and stationary points). Let $\pmb { L } ( \theta ) = \{ L _ { i } ( \theta ) \colon i \in [ K ] \}$ be a set of differentiable loss functions from $\mathbb { R } ^ { m }$ to $\mathbb { R }$ . For two points $\theta , \theta ^ { \prime } \in \mathbb { R } ^ { m }$ , we say that $\theta$ is Pareto dominated by $\theta ^ { \prime }$ , denoted by $\mathbf { } \cdot \mathbf { L } ( \theta ^ { \prime } ) \prec L ( \theta )$ , if $L _ { i } ( \theta ^ { \prime } ) \leq L _ { i } ( \theta )$ for all $i \in [ K ]$ and $\pmb { L } ( \theta ^ { \prime } ) \neq \pmb { L } ( \theta )$ . A point $\theta \in \mathbb { R } ^ { m }$ is said to be Pareto-optimal if there exists no $\theta ^ { \prime } \in \mathbb { R } ^ { m }$ such that $\mathbf { \dot { L } } ( \theta ^ { \prime } ) \prec \dot { \mathbf { L } } ( \theta )$ . The set of all Pareto-optimal points is called the Pareto set. $A$ point $\theta$ is called Pareto-stationary if we have $\mathrm { m i n } _ { w \in \mathcal { W } } \| g _ { w } ( \theta ) \| = 0$ , where $\begin{array} { r } { g _ { w } ( \theta ) = \sum _ { i = 1 } ^ { K } w _ { i } \nabla L _ { i } ( \theta ) } \end{array}$ , and $\mathcal { W }$ is the probability simplex on $[ K ]$ .
95
+
96
+ Similar to the case of single-objective differentiable optimization, a local Pareto optimal point $\theta$ must be Pareto stationary (see e.g., [6]).
97
+
98
+ Theorem 3.2 (Convergence of CAGrad). Assume the individual loss functions $L _ { 0 } , L _ { 1 } , \dots , L _ { K }$ are differentiable on $\mathbb { R } ^ { m }$ and their gradients $\nabla L _ { i } ( \theta )$ are all $H$ -Lipschitz, i.e. $\lVert \nabla L _ { i } ( x ) - \nabla L _ { i } ( y ) \rVert \leq$ $H \parallel x - y \parallel$ for $i = 0 , 1 , \ldots , K$ where $0 \leq H \leq \infty$ . Assume $L _ { 0 } ^ { * } = \operatorname* { i n f } _ { \theta \in \mathbb { R } ^ { m } } \dot { L } _ { 0 } ( \theta ) > - \infty$ .
99
+
100
+ With a fixed step size $\alpha$ satisfying $0 < \alpha \leq 1 / H$ , we have for the CAGrad in Alg. 1:
101
+
102
+ ![](images/5c9c3173a60de5bc0f95c0dd8cfdd3adf5f1660683b1fd79cd70859bb92f45e3.jpg)
103
+ Figure 2: The combined update vector $d$ (in red) of a two-task learning problem with gradient descent (GD), multiple gradient descent algorithm (MGDA), PCGrad and Conflict-Averse Gradient descent (CAGrad). The two task-specific gradients are labeled $g _ { 1 }$ and $g _ { 2 }$ . MGDA’s objective is given in its primal form (See Appendix A.1). For PCGrad, each gradient is first projected onto the normal plane of the other (the dashed arrows). Then the final update vector is the average of the two projected gradients. CAGrad finds the best update vector within a ball around the average gradient that maximizes the worse local improvement between task 1 and task 2.
104
+
105
+ 1) For any $c \geq 1$ , all the fixed points of CAGrad are Pareto-stationary points of $( L _ { 0 } , L _ { 1 } , \ldots , L _ { K } )$
106
+
107
+ 2) In particular, if we take $0 \leq c < 1$ , then CAGrad satisfies
108
+
109
+ $$
110
+ \sum _ { t = 0 } ^ { T } \left. \nabla L _ { 0 } ( \theta _ { t } ) \right. ^ { 2 } \leq \frac { 2 ( L _ { 0 } ( \theta _ { 0 } ) - L _ { 0 } ^ { * } ) } { \alpha ( 1 - c ^ { 2 } ) } .
111
+ $$
112
+
113
+ This means that the algorithm converges to a stationary point of $\nabla L _ { 0 }$ if we take $0 \leq c < 1$ . The proof is in Appendix A.3. As we discuss earlier, unlike our method, MGDA is designed to converge to an arbitrary point on the Pareto set, without explicit control of which point it will converges to. Another algorithm with similar property is PCGrad [41], which is a gradient-based algorithm that mitigates the conflicting gradients problem by removing the conflicting components of each gradient with respect to the other gradients before averaging them to form the final update; see Fig. 2, third column for the illustration. Similar to MGDA, as shown in [41], PCGrad also converges to an arbitrary Pareto point without explicit control of which point it will arrive at.
114
+
115
+ # 3.3 Practical Speedup
116
+
117
+ A typical drawback of methods that manipulate gradients is the computation overhead. For computing the optimal update vector, a method usually requires $K$ back-propagations to find all individual gradients $g _ { i }$ , in addition to the time required for optimization. This can be prohibitive for the scenario with many tasks. To this end, we propose to only sample a subset of tasks $S \subseteq [ K ]$ , compute their corresponding gradients $\{ g _ { i } \mid i \in { \overline { { S } } } \}$ and the averaged gradient $g _ { 0 }$ . Then we optimize $d$ in:
118
+
119
+ $$
120
+ \operatorname* { m a x } _ { d \in \mathbb { R } ^ { m } } \operatorname* { m i n } \left( \langle \frac { K g _ { 0 } - \sum _ { i \in S } g _ { i } } { K - | S | } , d \rangle , \ : \ : \operatorname* { m i n } _ { i \in S } \langle g _ { i } , d \rangle \right) \mathrm { s . t . } \| d - g _ { 0 } \| \leq c \| g _ { 0 } \|
121
+ $$
122
+
123
+ Remark Note that the convergence guarantee in Thm. 3.2 still holds for Eq. 4 as the constraint does not change (See Appendix A.3). The time complexity is $\mathcal { O } ( ( \vert S \vert N + T )$ , where $N$ denotes the time for one pass of back-propagation and $T$ denotes the optimization time. For few-task learning $K < 1 0$ ), usually $T \ll N$ . When $S = [ K ]$ , we recover the full CAGrad algorithm.
124
+
125
+ # 4 Related Work
126
+
127
+ Multi-task Learning Due to its benefit with regards to data and computational efficiency, multi-task learning (MTL) has broad applications in vision, language, and robotics [11, 28, 22, 44, 38]. A number of MTL-friendly architectures have been proposed using task-specific modules [25, 11], attentionbased mechanisms [21] or activating different paths along the deep networks to tackle MTL [27, 40]. Apart from designing new architectures, another branch of methods focus on decomposing a large problem into smaller local problems that could be quickly learned by smaller models [29, 26, 37, 8]. Then a unified policy is learned from the smaller models using knowledge distillation [12].
128
+
129
+ MTL Optimization In this work, we focus on the optimization challenge of MTL [38]. Gradient manipulation methods are designed specifically to balance the learning of each task. The simplest form of gradient manipulation is to re-weight the task losses based on specific criteria, e.g., uncertainty [15], gradient norm [3], or difficulty [9]. These methods are mostly heuristics and their performance can be unstable. Recently, two methods [30, 41] that manipulate the gradients to find a better local update vector have become popular. Sener et al [30] view MTL as a multi-objective optimization problem, and use multiple gradient descent algorithm for optimization. PCGrad [41] identifies a major optimization challenge for MTL, the conflicting gradients, and proposes to project each task gradient to the normal plane of other task gradients before combining them together to form the final update vector. Though yielding good empirical performance, both methods can only guarantee convergence to a Pareto-stationary point, but not knowing where it exactly converges to. More recently, GradDrop [4] randomly drops out task gradients based on how much they conflict. IMTLG [20] seeks an update vector that has equal projections on each task gradient. RotoGrad [14] separately scales and rotates task gradients to mitigate optimization conflict.
130
+
131
+ Our method, CAGrad, also manipulates the gradient to find a better optimization trajectory. Like other MTL optimization techniques, CAGrad is model-agnostic. However, unlike prior methods, CAGrad converges to the optimal point in theory and achieves better empirical performance on both toy multi-objective optimization tasks and real-world applications.
132
+
133
+ # 5 Experiment
134
+
135
+ We conduct experiments to answer the following questions:
136
+
137
+ Question (1) Do CAGrad, MGDA and PCGrad behave consistently with their theoretical properties in practice? (yes)
138
+
139
+ Question (2) Does CAGrad recover GD and MGDA when varying the constant $c ?$ (yes)
140
+
141
+ Question (3) How does CAGrad perform in both performance and computational efficiency compared to prior state-of-the-art methods, on challenging multi-task learning problems under the supervised, semi-supervised and reinforcement learning settings? (CAGrad improves over prior state-of-the-art methods under all settings)
142
+
143
+ # 5.1 Convergence and Ablation over c
144
+
145
+ To answer questions (1) and (2), we create a toy optimization example to evaluate the convergence of CAGrad compared to MGDA and PCGrad. On the same toy example, we ablate over the constant $c$ and show that CAGrad recovers GD and MGDA with proper $c$ values. Next, to test CAGrad on more complicated neural models, we perform the same set of experiments on the Multi-Fashion+MNIST benchmark [19] with a shrinked LeNet architecture [18] (in which each layer has a reduced number of neurons compared to the original LeNet). Please refer to Appendix B for more details.
146
+
147
+ For the toy optimization example, we modify the toy example used by $\mathrm { Y u }$ et al. [41] and consider $\theta = ( \theta _ { 1 } , \bar { \theta _ { 2 } } ) \overset { \cdot } { \in } \mathbb { R } ^ { 2 }$ with the following individual loss functions:
148
+
149
+ $$
150
+ \begin{array} { r l } & { L _ { 1 } ( \theta ) = c _ { 1 } ( \theta ) f _ { 1 } ( \theta ) + c _ { 2 } ( \theta ) g _ { 1 } ( \theta ) \mathrm { ~ a n d ~ } L _ { 2 } ( \theta ) = c _ { 1 } ( \theta ) f _ { 2 } ( \theta ) + c _ { 2 } ( \theta ) g _ { 2 } ( \theta ) , \forall } \\ & { f _ { 1 } ( \theta ) = \log \big ( \operatorname* { m a x } ( | 0 . 5 ( - \theta _ { 1 } - 7 ) - \operatorname { t a n h } { ( - \theta _ { 2 } ) } | , \ 0 . 0 0 0 0 0 5 ) \big ) + 6 , } \\ & { f _ { 2 } ( \theta ) = \log \big ( \operatorname* { m a x } ( | 0 . 5 ( - \theta _ { 1 } + 3 ) - \operatorname { t a n h } { ( - \theta _ { 2 } ) } + 2 | , \ 0 . 0 0 0 0 0 5 ) \big ) + 6 , } \\ & { g _ { 1 } ( \theta ) = \big ( ( - \theta _ { 1 } + 7 ) ^ { 2 } + 0 . 1 * ( - \theta _ { 2 } - 8 ) ^ { 2 } \big ) / 1 0 - 2 0 , } \\ & { g _ { 2 } ( \theta ) = \big ( ( - \theta _ { 1 } - 7 ) ^ { 2 } + 0 . 1 * ( - \theta _ { 2 } - 8 ) ^ { 2 } \big ) / 1 0 - 2 0 , } \\ & { c _ { 1 } ( \theta ) = \operatorname* { m a x } ( \operatorname { t a n h } { ( 0 . 5 * \theta _ { 2 } ) } , \ 0 ) \mathrm { ~ a n d ~ } c _ { 2 } ( \theta ) = \operatorname* { m a x } ( \operatorname { t a n h } { ( - 0 . 5 * \theta _ { 2 } ) } , \ 0 ) . } \end{array}
151
+ $$
152
+
153
+ The average loss $L _ { 0 }$ and individual losses $L _ { 1 }$ and $L _ { 2 }$ are shown in Fig. 1. We then pick 5 initial parameter vectors $\theta _ { \mathrm { i n i t } } \in \{ ( - 8 . 5 , 7 . 5 ) , ( - 8 . 5 , 5 ) , ( 0 , 0 ) , ( 9 , 9 ) , ( 1 0 , - 8 ) \}$ and plot the corresponding optimization trajectories with different methods in Fig. 3. As shown in Fig. 3, GD gets stuck in 2 out of the 5 runs while other methods all converge to the Pareto set. MGDA and PCGrad converge to different Pareto-stationary points depending on $\theta _ { \mathrm { i n i t } }$ . CAGrad with $c = 0$ recovers GD and CAGrad with $c = 1 0$ approximates MGDA well (in theory it requires $c \to \infty$ to exactly recover MGDA).
154
+
155
+ ![](images/75d2f251d4cdaccd9c44f7ec6d7b1f0f9b38469e21607d25f96a255236d70ce3.jpg)
156
+ Figure 3: The left four plots are 5 runs of each algorithms from 5 different initial parameter vectors, where trajectories are colored from red to yellow. The right two plots are CAGrad’s results with a varying $\bar { c ^ { \prime } } \in \{ 0 , 0 . 2 , 0 . 5 , 0 . 8 , 1 0 \}$ .
157
+
158
+ Next, we apply the same set of experiments on the multi-task classification benchmark MultiFashion+MNIST [19]. This benchmark consists of images that are generated by overlaying an image from FashionMNIST dataset [39] on top of another image from MNIST dataset [5]. The two images are positioned on the top-left and bottom-right separately. We consider a shrinked LeNet as our model, and train it with Adam [16] optimizer with a 0.001 learning rate for 50 epochs using a batch size of 256. Due to the highly non-convex nature of the neural network, we are not able to visualize the entire Pareto set. But we provide the final training losses of different methods over three independent runs in Fig. 4. As shown, CAGrad achieves the lowest average loss with $c = 0 . 2$ . In addition, PCGrad and MGDA focus on optimizing task 1 and task 2 separately. Lastly, CAGrad with $c = 0$ and $c = 1 0$ roughly recovers the final performance of GD and MGDA. By increasing $c _ { \cdot }$ , the model performance shifts from more GD-like to more MGDA-like, though due to the non-convex nature of neural networks, CAGrad with $0 \leq c < 1$ does not necessarily converge to the exact same point.
159
+
160
+ ![](images/bee5020abe60ded51f7f3f7db9c65b38616afcdb9d451be9bb97a872fad1223b.jpg)
161
+ Figure 4: The average and individual training losses on the Fashion-and-MNIST benchmark by running GD, MGDA, PCGrad and CAGrad with different $c$ values. GD gets stuck at the steep valley (the area with a cloud of dots), which other methods can pass. MGDA and PCGrad converge randomly on the Pareto set.
162
+
163
+ # 5.2 Multi-task Supervised Learning
164
+
165
+ To answer question (3) in the supervised learning setting, we follow the experiment setup from Yu et al. [41] and consider the NYU-v2 and CityScapes vision datasets. NYU-v2 contains 3 tasks: 13- class semantic segmentation, depth estimation, and surface normal prediction. CityScapes similarly contains 2 tasks: 7-class semantic segmentation and depth estimation. Here, we follow [41] and combine CAGrad with a state-of-the-art MTL method MTAN [21], which applies attention mechanism on top of the SegNet architecture [1]. We compare CAGrad with PCGrad, vanilla MTAN and CrossStitch [25], which is another MTL method that modifies the network architecture. MTAN originally experiments with equal loss weighting and two other dynamic loss weighting heuristics [15, 3]. For a fair comparison, all methods are applied under the equal weighting scheme and we use the same training setup from [3]. We search $\bar { c } \in \{ 0 . 1 , 0 . 2 , . . . \bar { 0 } . 9 \}$ with the best average training loss for CAGrad on both datasets (0.4 for NYU-v2 and 0.2 for Cityscapes). We perform a two-tailed, Student’s $t$ -test under equal sample sizes, unequal variance setup and mark the results that are significant with an $^ *$ . Following Maninis et al.[24], we also compute the average per-task performance drop of method $m$ with respect to the single-tasking baseline $b$ : 1K PKi=1(−1)li (Mm,i − Mb,i)/Mb,i where $l _ { i } = 1$ if a higher value is better for a criterion $M _ { i }$ on task $i$ and 0 otherwise. The single-tasking baseline (independent) refers to training individual tasks with a vanilla SegNet. Results are shown in Tab. 1 and Tab. 2.
166
+
167
+ Given the single task performance, CAGrad performs better on the task that is overlooked by other methods (Surface Normal in NYU-v2 and Depth in CityScapes) and matches other methods’ performance on the rest of the tasks. We also provide the final test losses and the per-epoch training time of each method in Fig. 5 in Appendix B.2.
168
+
169
+ Table 1: Multi-task learning results on NYU-v2 dataset. #P denotes the relative model size compared to the vanilla SegNet. Each experiment is repeated over 3 random seeds and the mean is reported. The best average result among all multi-task methods is marked in bold. MGDA, PCGrad, GradDrop and CAGrad are applied on the MTAN backbone. CAGrad has statistically significant improvement over baselines methods with an $^ *$ , tested with a $p$ -value of 0.1.
170
+
171
+ <table><tr><td rowspan="3">#P.</td><td rowspan="3">Method</td><td colspan="2">Segmentation</td><td colspan="2">Depth</td><td colspan="5">Surface Normal</td><td rowspan="3">△m%</td></tr><tr><td colspan="2">(Higher Better)</td><td colspan="2">(Lower Better)</td><td colspan="2">Angle Distance (Lower Better)</td><td colspan="2">Within t° (Higher Better)</td></tr><tr><td>mIoU</td><td>Pix Acc</td><td>Abs Err</td><td>Rel Err</td><td>Mean Median</td><td>11.25</td><td>22.5</td><td>30</td></tr><tr><td>3</td><td>Independent</td><td>38.30</td><td>63.76</td><td>0.6754</td><td>0.2780</td><td>25.01</td><td>19.21</td><td>30.14</td><td>57.20</td><td>69.15</td><td></td></tr><tr><td>~3</td><td>Cross-Stitch [25]</td><td>37.42</td><td>63.51</td><td>0.5487</td><td>0.2188</td><td>*28.85</td><td>*24.52</td><td>*22.75</td><td>*46.58</td><td>*59.56</td><td>6.96</td></tr><tr><td>1.77</td><td>MTAN [21]</td><td>39.29</td><td>65.33</td><td>0.5493</td><td>0.2263</td><td>*28.15</td><td>*23.96</td><td>*22.09</td><td>*47.50</td><td>*61.08</td><td>5.59</td></tr><tr><td>1.77</td><td>MGDA [30]</td><td>*30.47</td><td>*59.90</td><td>*0.6070</td><td>*0.2555</td><td>24.88</td><td>19.45</td><td>29.18</td><td>56.88</td><td>69.36</td><td>1.38</td></tr><tr><td>1.77</td><td>PCGrad [41]</td><td>38.06</td><td>64.64</td><td>0.5550</td><td>0.2325</td><td>*27.41</td><td>*22.80</td><td>*23.86</td><td>*49.83</td><td>*63.14</td><td>3.97</td></tr><tr><td>1.77</td><td>GradDrop [4]</td><td>39.39</td><td>65.12</td><td>0.5455</td><td>0.2279</td><td>*27.48</td><td>*22.96</td><td>*23.38</td><td>*49.44</td><td>*62.87</td><td>3.58</td></tr><tr><td>1.77</td><td>CAGrad (ours)</td><td>39.79</td><td>65.49</td><td>0.5486</td><td>0.2250</td><td>26.31</td><td>21.58</td><td>25.61</td><td>52.36</td><td>65.58</td><td>0.20</td></tr></table>
172
+
173
+ Table 2: Multi-task learning results on CityScapes Challenge. Each experiment is repeated over 3 random seeds and the mean is reported. The best average result among all multi-task methods is marked in bold. PCGrad and CAGrad are applied on the MTAN backbone. CAGrad has statistically significant improvement over baselines methods with an $^ *$ , tested with a $p$ -value of 0.1.
174
+
175
+ <table><tr><td rowspan="2">#P.</td><td rowspan="2">Method</td><td colspan="2">Segmentation</td><td colspan="2">Depth</td><td rowspan="2">△m%</td></tr><tr><td>mIoU</td><td>(Higher Better) Pix Acc</td><td>(Lower Better) Abs Err</td><td>Rel Err</td></tr><tr><td>2</td><td>Independent</td><td>74.01</td><td>93.16</td><td>0.0125</td><td>27.77</td><td></td></tr><tr><td>~3</td><td>Cross-Stitch [25]</td><td>*73.08</td><td>*92.79</td><td>*0.0165</td><td>*118.5</td><td>90.02</td></tr><tr><td>1.77</td><td>MTAN [21]</td><td>75.18</td><td>93.49</td><td>*0.0155</td><td>*46.77</td><td>22.60</td></tr><tr><td>1.77</td><td>MGDA [30]</td><td>*68.84</td><td>*91.54</td><td>0.0309</td><td>33.50</td><td>44.14</td></tr><tr><td>1.77</td><td>PCGrad [41]</td><td>75.13</td><td>93.48</td><td>0.0154</td><td>42.07</td><td>18.29</td></tr><tr><td>1.77</td><td>GradDrop [4]</td><td>75.27</td><td>93.53</td><td>*0.0157</td><td>*47.54</td><td>23.73</td></tr><tr><td>1.77</td><td>CAGrad (ours)</td><td>75.16</td><td>93.48</td><td>0.0141</td><td>37.60</td><td>11.64</td></tr></table>
176
+
177
+ # 5.3 Multi-task Reinforcement Learning
178
+
179
+ To answer question (3) in the reinforcement learning (RL) setting, we apply CAGrad on the MT10 and MT50 benchmarks from the Meta-World environment [42]. In particular, MT10 and MT50 contains 10 and 50 robot manipulation tasks. Following [33], we use Soft Actor-Critic (SAC) [10] as the underlying RL training algorithm. We compare against Multi-task SAC (SAC with a shared model), Multi-headed SAC (SAC with a shared backbone and task-specific head), Multi-task SAC $^ +$ Task Encoder (SAC with a shared model and the input includes a task embedding) [42] and PCGrad [41]. We also compare with Soft Modularization [40] that routes different modules in a shared model to form different policies. Lastly, we also include a recent method (CARE) that considers language metadata and uses a mixture of expert encoder for MTL. We follow the same experiment setup from [33]. The results are shown in Tab. 3. CAGrad outperforms all baselines except for CARE which benefits from extra information from the metadata. We also apply the practical speedup in Sec. 3.3 and sub-sample 4 and 8 tasks for MT10 and MT50 (CAGrad-Fast). CAGrad-fast achieves comparable performance against the state-of-the-art method while achieving a $2 \mathbf { x }$ (MT10) and $5 \mathbf { x }$ (MT50) speedup over PCGrad. We provide a visualization of tasks from MT10 and MT50, and the comparison of computational efficiency in Appendix B.3.
180
+
181
+ # 5.4 Semi-supervised Learning with Auxiliary Tasks
182
+
183
+ Training with auxiliary tasks to improve the performance of a main task is another popular application of MTL. Here, we take semi-supervised learning as an instance. We combine different optimization
184
+
185
+ <table><tr><td rowspan="2">Method</td><td>MetaworldMT10</td><td>MetaworldMT50</td></tr><tr><td>success (mean ± stderr)</td><td>success (mean ± stderr)</td></tr><tr><td>Multi-task SAC [42]</td><td>0.49 ±0.073</td><td>0.36 ±0.013</td></tr><tr><td>Multi-task SAC+ Task Encoder [42]</td><td>0.54 ±0.047</td><td>0.40 ±0.024</td></tr><tr><td>Multi-headed SAC [42]</td><td>0.61 ±0.036</td><td>0.45 ±0.064</td></tr><tr><td>PCGrad [41]</td><td>0.72 ±0.022</td><td>0.50 ±0.017</td></tr><tr><td>Soft Modularization [40]</td><td>0.73 ±0.043</td><td>0.50 ±0.035</td></tr><tr><td>CAGrad (ours)</td><td>0.83 ±0.045</td><td>0.52 ±0.023</td></tr><tr><td>CAGrad-Fast (ours)</td><td>0.82 ±0.039</td><td>0.50 ±0.016</td></tr><tr><td>CARE [33]</td><td>0.84 ±0.051</td><td>0.54 ±0.031</td></tr><tr><td>One SAC agent per task (upper bound)</td><td>0.90 ±0.032</td><td>0.74 ±0.041</td></tr></table>
186
+
187
+ Table 3: Multi-task reinforcement learning results on the Metaworld benchmarks. Results are averaged over 10 independent runs and the best result is marked in bold.
188
+
189
+ algorithms with Auxiliary Task Reweighting for Minimum-data Learning (ARML) [31], a state-ofthe-art semi-supervised learning algorithm. The loss function is composed of the main task and two auxiliary tasks:
190
+
191
+ $$
192
+ \begin{array} { r } { L _ { 0 } = L _ { C E } ( \theta ; D _ { l } ) + w _ { 1 } L _ { a u x } ^ { 1 } ( \theta ; D _ { u } ) + w _ { 2 } L _ { a u x } ^ { 2 } ( \theta ; D _ { u } ) , } \end{array}
193
+ $$
194
+
195
+ where are au $L _ { C E }$ is the main cross-entropy classification loss on the lay unsupervised learning losses on the unlabeled dataset d dataset . We use $D _ { l }$ , and sam $L _ { a u x } ^ { 1 } , L _ { a u x } ^ { 2 }$ $D _ { u }$ $w _ { 1 }$ $w _ { 2 }$ from ARML, and use the CIFAR10 dataset [17], which contains 50,000 training images and 10,000 test images. $10 \%$ of the training images is held out as the validation set. We test PCGrad, MGDA and CAGrad with 500, 1000 and 2000 labeled images. The rest of the training set is used for auxiliary tasks. For all the methods, we use the same labeled dataset, the same learning rate and train them for 200 epochs with the Adam [16] optimizer. Please refer to Appendix B.4 for more experimental details. Results are shown in Tab. 4. With all the different number of labels, CAGrad yields the best averaged test accuracy. We observed that MGDA performs much worse than the ARML baseline, because it significantly overlooks the main classification task. We also compare different gradient manipulation methods on the same task with GradNorm [3], which dynamically adjusts $w _ { 1 }$ and $w _ { 2 }$ during training. The results and conclusions are similar to those for ARML.
196
+
197
+ <table><tr><td>Method</td><td>500 labels</td><td>1000 labels</td><td>2000 labels</td></tr><tr><td>ARML [31]</td><td>67.05 ±0.16</td><td>73.22 ±0.26</td><td>81.35 ±0.36</td></tr><tr><td>ARML + PCGrad [41]</td><td>67.49 ±0.64</td><td>73.23 ±0.62</td><td>81.91 ±0.19</td></tr><tr><td>ARML +MGDA[30]</td><td>49.27 ±0.68</td><td>60.11 ±2.35</td><td>60.78 ±0.17</td></tr><tr><td>ARML +CAGrad (Ours)</td><td>68.25 ±0.37</td><td>74.37 ±0.42</td><td>82.81 ±0.48</td></tr><tr><td>GradNorm [3]</td><td>67.35 ±0.15</td><td>73.53 ±0.23</td><td>81.03 ±0.71</td></tr><tr><td>GradNorm + PCGrad [41]</td><td>67.83 ±0.19</td><td>73.91 ±0.09</td><td>82.72 ±0.19</td></tr><tr><td>GradNorm + MGDA [30]</td><td>36.99 ±2.11</td><td>57.94 ±0.92</td><td>59.12 ±0.63</td></tr><tr><td>GradNorm + CAGrad (Ours)</td><td>67.53 ±0.26</td><td>74.72 ±0.19</td><td>83.15 ±0.56</td></tr></table>
198
+
199
+ Table 4: Semi-supervised Learning with auxiliary tasks on CIFAR10. We report the average test accuracy over 3 independent runs for each method and mark the best result in bold.
200
+
201
+ # 6 Conclusion
202
+
203
+ In this work, we introduce the Conflict-Averse Gradient descent (CAGrad) algorithm that explicitly optimizes the minimum decrease rate of any specific task’s loss while still provably converging to the optimum of the average loss. CAGrad generalizes the gradient descent and multiple gradient descent algorithm, and demonstrates improved performance across several challenging multi-task learning problems compared to the state-of-the-art methods. While we focus mainly on optimizing the average loss, an interesting future direction is to look at main objectives other than the average loss under the multi-task setting.
204
+
205
+ # Acknowledgements
206
+
207
+ The research was conducted in the statistical learning and AI group (SLAI) and the Learning Agents Research Group (LARG) in computer science at UT Austin. SLAI research is supported in part by CAREER-1846421, SenSE-2037267, EAGER-2041327, and Office of Navy Research, and NSF AI Institute for Foundations of Machine Learning (IFML). LARG research is supported in part by NSF (CPS-1739964, IIS-1724157, FAIN-2019844), ONR (N00014-18-2243), ARO (W911NF-19-2-0333), DARPA, Lockheed Martin, GM, Bosch, and UT Austin’s Good Systems grand challenge. Peter Stone serves as the Executive Director of Sony AI America and receives financial compensation for this work. The terms of this arrangement have been reviewed and approved by the University of Texas at Austin in accordance with its policy on objectivity in research. Xingchao Liu is supported in part by a funding from BP.
208
+
209
+ # References
210
+
211
+ [1] Vijay Badrinarayanan, Alex Kendall, and Roberto Cipolla. Segnet: A deep convolutional encoder-decoder architecture for image segmentation. IEEE transactions on pattern analysis and machine intelligence, 39(12):2481–2495, 2017.
212
+ [2] Rich Caruana. Multitask learning. Machine learning, 28(1):41–75, 1997.
213
+ [3] Zhao Chen, Vijay Badrinarayanan, Chen-Yu Lee, and Andrew Rabinovich. Gradnorm: Gradient normalization for adaptive loss balancing in deep multitask networks. In International Conference on Machine Learning, pages 794–803. PMLR, 2018. [4] Zhao Chen, Jiquan Ngiam, Yanping Huang, Thang Luong, Henrik Kretzschmar, Yuning Chai, and Dragomir Anguelov. Just pick a sign: Optimizing deep multitask models with gradient sign dropout. arXiv preprint arXiv:2010.06808, 2020.
214
+ [5] Li Deng. The mnist database of handwritten digit images for machine learning research. IEEE Signal Processing Magazine, 29(6):141–142, 2012.
215
+ [6] Jean-Antoine Désidéri. Multiple-gradient descent algorithm (mgda) for multiobjective optimization. Comptes Rendus Mathematique, 350(5-6):313–318, 2012. [7] Steven Diamond and Stephen Boyd. CVXPY: A Python-embedded modeling language for convex optimization. Journal of Machine Learning Research, 17(83):1–5, 2016. [8] Dibya Ghosh, Avi Singh, Aravind Rajeswaran, Vikash Kumar, and Sergey Levine. Divide-andconquer reinforcement learning. arXiv preprint arXiv:1711.09874, 2017.
216
+ [9] Michelle Guo, Albert Haque, De-An Huang, Serena Yeung, and Li Fei-Fei. Dynamic task prioritization for multitask learning. In Proceedings of the European Conference on Computer Vision (ECCV), pages 270–287, 2018.
217
+ [10] Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Offpolicy maximum entropy deep reinforcement learning with a stochastic actor. In International Conference on Machine Learning, pages 1861–1870. PMLR, 2018.
218
+ [11] Kazuma Hashimoto, Caiming Xiong, Yoshimasa Tsuruoka, and Richard Socher. A joint manytask model: Growing a neural network for multiple nlp tasks. arXiv preprint arXiv:1611.01587, 2016.
219
+ [12] Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
220
+ [13] Harold M Hochman and James D Rodgers. Pareto optimal redistribution. The American economic review, 59(4):542–557, 1969.
221
+ [14] Adrián Javaloy and Isabel Valera. Rotograd: Dynamic gradient homogenization for multi-task learning. arXiv preprint arXiv:2103.02631, 2021.
222
+ [15] Alex Kendall, Yarin Gal, and Roberto Cipolla. Multi-task learning using uncertainty to weigh losses for scene geometry and semantics. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 7482–7491, 2018.
223
+ [16] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
224
+ [17] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
225
+ [18] 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.
226
+ [19] Xi Lin, Hui-Ling Zhen, Zhenhua Li, Qingfu Zhang, and Sam Kwong. Pareto multi-task learning. arXiv preprint arXiv:1912.12854, 2019.
227
+ [20] Liyang Liu, Yi Li, Zhanghui Kuang, Jing-Hao Xue, Yimin Chen, Wenming Yang, Qingmin Liao, and Wayne Zhang. Towards impartial multi-task learning. In International Conference on Learning Representations, 2020.
228
+ [21] Shikun Liu, Edward Johns, and Andrew J Davison. End-to-end multi-task learning with attention. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1871–1880, 2019.
229
+ [22] Xingchao Liu, Xing Han, Na Zhang, and Qiang Liu. Certified monotonic neural networks. arXiv preprint arXiv:2011.10219, 2020.
230
+ [23] Debabrata Mahapatra and Vaibhav Rajan. Multi-task learning with user preferences: Gradient descent with controlled ascent in pareto optimization. In International Conference on Machine Learning, pages 6597–6607. PMLR, 2020.
231
+ [24] Kevis-Kokitsi Maninis, Ilija Radosavovic, and Iasonas Kokkinos. Attentive single-tasking of multiple tasks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1851–1860, 2019.
232
+ [25] Ishan Misra, Abhinav Shrivastava, Abhinav Gupta, and Martial Hebert. Cross-stitch networks for multi-task learning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3994–4003, 2016.
233
+ [26] Emilio Parisotto, Jimmy Lei Ba, and Ruslan Salakhutdinov. Actor-mimic: Deep multitask and transfer reinforcement learning. arXiv preprint arXiv:1511.06342, 2015.
234
+ [27] Clemens Rosenbaum, Tim Klinger, and Matthew Riemer. Routing networks: Adaptive selection of non-linear functions for multi-task learning. arXiv preprint arXiv:1711.01239, 2017.
235
+ [28] Sebastian Ruder. An overview of multi-task learning in deep neural networks. arXiv preprint arXiv:1706.05098, 2017.
236
+ [29] Andrei A Rusu, Sergio Gomez Colmenarejo, Caglar Gulcehre, Guillaume Desjardins, James Kirkpatrick, Razvan Pascanu, Volodymyr Mnih, Koray Kavukcuoglu, and Raia Hadsell. Policy distillation. arXiv preprint arXiv:1511.06295, 2015.
237
+ [30] Ozan Sener and Vladlen Koltun. Multi-task learning as multi-objective optimization. arXiv preprint arXiv:1810.04650, 2018.
238
+ [31] Baifeng Shi, Judy Hoffman, Kate Saenko, Trevor Darrell, and Huijuan Xu. Auxiliary task reweighting for minimum-data learning. Advances in Neural Information Processing Systems, 33, 2020.
239
+ [32] Shagun Sodhani and Amy Zhang. Mtrl - multi task rl algorithms. Github, 2021.
240
+ [33] Shagun Sodhani, Amy Zhang, and Joelle Pineau. Multi-task reinforcement learning with context-based representations. arXiv preprint arXiv:2102.06177, 2021.
241
+ [34] Charles Stein. Inadmissibility of the usual estimator for the mean of a multivariate normal distribution. In Contribution to the Theory of Statistics, pages 197–206. University of California Press, 2020.
242
+ [35] Kevin Swersky, Jasper Snoek, and Ryan Prescott Adams. Multi-task bayesian optimization. 2013.
243
+ [36] Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 1195–1204, 2017.
244
+ [37] Yee Whye Teh, Victor Bapst, Wojciech Marian Czarnecki, John Quan, James Kirkpatrick, Raia Hadsell, Nicolas Heess, and Razvan Pascanu. Distral: Robust multitask reinforcement learning. arXiv preprint arXiv:1707.04175, 2017.
245
+ [38] Simon Vandenhende, Stamatios Georgoulis, Wouter Van Gansbeke, Marc Proesmans, Dengxin Dai, and Luc Van Gool. Multi-task learning for dense prediction tasks: A survey. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021.
246
+ [39] Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017.
247
+ [40] Ruihan Yang, Huazhe Xu, Yi Wu, and Xiaolong Wang. Multi-task reinforcement learning with soft modularization. arXiv preprint arXiv:2003.13661, 2020.
248
+ [41] Tianhe Yu, Saurabh Kumar, Abhishek Gupta, Sergey Levine, Karol Hausman, and Chelsea Finn. Gradient surgery for multi-task learning. arXiv preprint arXiv:2001.06782, 2020.
249
+ [42] Tianhe Yu, Deirdre Quillen, Zhanpeng He, Ryan Julian, Karol Hausman, Chelsea Finn, and Sergey Levine. Meta-world: A benchmark and evaluation for multi-task and meta reinforcement learning. In Conference on Robot Learning, pages 1094–1100. PMLR, 2020.
250
+ [43] Amir R Zamir, Alexander Sax, William Shen, Leonidas J Guibas, Jitendra Malik, and Silvio Savarese. Taskonomy: Disentangling task transfer learning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3712–3722, 2018.
251
+ [44] Yu Zhang and Qiang Yang. A survey on multi-task learning. IEEE Transactions on Knowledge and Data Engineering, 2021.
252
+
253
+ # Checklist
254
+
255
+ 1. For all authors...
256
+
257
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] See Sec. 3.2 for the convergence analysis, Fig. 1 for the challenges faced by previous methods, and Sec. 5 for empirical evaluation of these challenges and the advantage of CAGrad.
258
+ (b) Did you describe the limitations of your work? [Yes] See Sec. 6. Currently we mainly focus on optimizing the average loss, which could be replaced by other main objectives.
259
+ (c) Did you discuss any potential negative societal impacts of your work? [N/A] Our method does not have potential negative societal impacts.
260
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
261
+
262
+ 2. If you are including theoretical results...
263
+
264
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] The assumptions are stated in Thm. 3.2.
265
+ (b) Did you include complete proofs of all theoretical results? [Yes] The complete proof is included in Appendix A.3.
266
+
267
+ 3. If you ran experiments...
268
+
269
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We mention most of the details to reproduce the result in Sec. 5 and provide the rest of details of each experiment in Appendix.B. The code comes with the supplementary material.
270
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix.B and Sec. 5.
271
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] For each experiment except for the toy (since there is no stochasticity), we run over multiple $\left( \geq 3 \right)$ seeds.
272
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] We explicitly compare the computational efficiency in Fig. 5. More details on the resources are provided in the corresponding sections in Appendix.B.
273
+
274
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
275
+
276
+ (a) If your work uses existing assets, did you cite the creators? [Yes] For most of the experiment, we follow the exact experiment setup and use the corresponding opensource code from previous works and have cited and compared against them.
277
+ (b) Did you mention the license of the assets? [Yes] All code and data are publicly available under MIT license
278
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No] No new assets are introduced for our experiment. The only thing we modified is a shrinked LeNet, where the details are provided in Appendix.B.
279
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
280
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] The data we use are publicly available data that has been used by a lot of prior research. There should be no personally identifiable information or offensive content.
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] No human subjects involved.
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/lHmhW2zmVN/lHmhW2zmVN.md ADDED
@@ -0,0 +1,248 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Attention over learned object embeddings enables complex visual reasoning
2
+
3
+ David Ding Felix Hill Adam Santoro Malcolm Reynolds Matt Botvinick DeepMind London, United Kingdom
4
+ {fding, felixhill, adamsantoro, mareynolds, botvinick}@google.com
5
+
6
+ # Abstract
7
+
8
+ Neural networks have achieved success in a wide array of perceptual tasks but often fail at tasks involving both perception and higher-level reasoning. On these more challenging tasks, bespoke approaches (such as modular symbolic components, independent dynamics models or semantic parsers) targeted towards that specific type of task have typically performed better. The downside to these targeted approaches, however, is that they can be more brittle than general-purpose neural networks, requiring significant modification or even redesign according to the particular task at hand. Here, we propose a more general neural-network-based approach to dynamic visual reasoning problems that obtains state-of-the-art performance on three different domains, in each case outperforming bespoke modular approaches tailored specifically to the task. Our method relies on learned object-centric representations, self-attention and self-supervised dynamics learning, and all three elements together are required for strong performance to emerge. The success of this combination suggests that there may be no need to trade off flexibility for performance on problems involving spatio-temporal or causal-style reasoning. With the right soft biases and learning objectives in a neural network we may be able to attain the best of both worlds.
9
+
10
+ # 1 Introduction
11
+
12
+ Despite the popularity of artificial neural networks, a body of recent work has focused on their limitations as models of cognition and reasoning. Experiments with dynamical reasoning datasets such as CLEVRER [41], CATER [12], and ACRE [44] show that neural networks can fail to adequately reason about the spatio-temporal, compositional or causal structure of visual scenes. On CLEVRER, where models must answer questions about the dynamics of colliding objects, previous experiments show that neural networks can adequately describe the video, but fail when asked to predict, explain, or consider counterfactual possibilities. Similarly, on CATER, an object-tracking task, models have trouble tracking the movement of objects when they are hidden in a container. Finally, on ACRE, a dataset testing for causal inference, popular models only learned correlations between visual scenes and not the deeper causal logic.
13
+
14
+ Failures such as these on reasoning (rather than perception) problems have motivated the adoption of pipeline-style approaches that combine a general purpose neural network (such as a convolutional block) with a task-specific module that builds in the core logic of the task. For example, on CLEVRER the NS-DR method [41] applies a hand-coded symbolic logic engine (that has the core logic of CLEVRER built-in) to the outputs of a “perceptual” neural front-end, achieving better results than neural network baselines, particularly on counterfactual and explanatory problems. One limitation of these pipeline approaches, however, is that they are typically created with a single problem or problem domain in mind, and may not apply out-of-the-box to other related problems. For example, to apply NS-DR to CATER, the entire symbolic module needs to be rewritten to handle the new interactions and task logic of CATER: the custom logic to handle collisions and object removal must be replaced with new custom logic to handle occlusions and grid-resolution, and these changes require further modifications to the perceptual front-end to output data in a new format. This brittleness is not exclusive to symbolic approaches. While Hungarian-matching between object embeddings may be well-suited for object-tracking tasks [45], it is not obvious how it would help for causal inference tasks.
15
+
16
+ Here, we describe a more general neural-network-based approach to visual spatio-temporal reasoning problems, which does not rely on task-specific integration of modular components. In place of these components, our model relies on three key aspects:
17
+
18
+ • Self-attention to effectively integrate information over time
19
+ • Soft-discretization of the input at the most informative level of abstraction – above pixels and local features, and below entire frames—corresponding approximately to ‘objects’
20
+ Self-supervised learning, i.e. requiring the model to infer masked out objects, to extract more information about dynamics from each sample.
21
+
22
+ While many past models have applied each individual ingredient separately (including on the tasks we study), we show that it is the combination of all three ingredients in the right way that allows our model to succeed.
23
+
24
+ The resulting model, which we call Aloe (Attention over Learned Object Embeddings), outperforms both pipeline and neural-network-based approaches on three different task domains designed to test physical and dynamical reasoning from pixel inputs. We highlight our key results here:
25
+
26
+ • CLEVRER (explanatory, predictive, and counterfactual reasoning): Aloe achieves significantly higher accuracy than both more task-specific, modular approaches, and previous neural network methods on all question types. On counterfactual questions, thought to be most challenging for neural-only architectures, we achieve $75 \%$ vs $46 \%$ accuracy for more specialised methods. • CATER (object-permanence): Aloe achieves accuracy exceeding or matching other current models. Notably, the strongest alternative models were expressly designed for object-tracking, whereas our architecture is applicable without modification to other reasoning tasks as well. ACRE (causal-inference “beyond the simple strategy of inducing causal relationships by covariation” [44]): Overall, Aloe achieves $94 \%$ vs the $67 \%$ accuracy achieved by the top neuro-symbolic model. On the most challenging tasks, we achieve, for “backward-blocking” inference, $9 4 . 4 8 \%$ (vs $1 6 . 0 6 \%$ by the best modular, neuro-symbolic systems), and, for “screenoff” inference, $9 8 . 9 7 \%$ (vs ${ \bf0 . 0 0 \% }$ by a CNN-BERT baseline).
27
+
28
+ As we have emphasized, the previous best performing models for each task all contain task-specific design elements, whereas Aloe can be applied to all the tasks without modification. On CLEVRER, we also show that Aloe matches the performance of the previous best models with $40 \%$ less training data, which demonstrates that our approach is data-efficient as well as performant.
29
+
30
+ # 2 Methods
31
+
32
+ A guiding motivation for the design of Aloe is the converging evidence for the value of self-attention mechanisms operating on a finite sequences of discrete entities. Written language is inherently discrete and hence is well-suited to self-attention-based approaches. In other domains, such as raw audio or vision, it is less clear how to leverage self-attention. We hypothesize that the application of self-attention-based models to visual tasks could benefit from an approximate ‘discretization’ process, and determining the right level of discretization is an important choice that can significantly affect model performance.
33
+
34
+ At the finest level, data could simply be discretized into pixels (as is already the case for most machine-processed visual data). Pixels are too fine-grained for many applications, however—for one, the memory required to support self-attention across all pixels is prohibitive. Partly for this reason, coarser representations, such as the downsampled “hyper-pixel” outputs of a convolutional network, are often used instead (e.g. [27, 43]). In the case of videos, previous work considered even coarser discretization schemes, such as frame or subclip level representations [35].
35
+
36
+ ![](images/fb75c68d2f8c0da36c1f5ab1ea3c806bea16df8a72eccf44e82552a1d3195e0e.jpg)
37
+ Figure 1: A schematic of the model architecture. See the main text for details.
38
+
39
+ The neuroscience literature, however, suggests that biological visual systems infer and exploit the existence of objects, rather than spatial or temporal blocks with artificial boundaries [5, 30, 32]. Because objects are the atomic units of physical interactions, it makes sense to discretize on the level of objects. Numerous object segmentation algorithms have been proposed [15, 19, 29]. We chose to use MONet, an unsupervised object segmentation algorithm [2]. Because MONet is unsupervised, we can train it directly in our domain of interest without the need for object segmentation labels. We emphasize that our choice of MONet is an implementation detail, and in Appendix B, we show that our framework of attention over learned object embeddings also works with other object-segmentation schemes. We also do not need to place strong demands on the object segmentation algorithm, e.g. for it to produce aligned output or to have a built-in dynamics model.
40
+
41
+ To segment each frame into object representations, MONet uses a recurrent attention network to obtain a set of $N _ { o }$ “object attention masks” ( $\mathrm { \Delta } N _ { o }$ is a fixed parameter). Each attention mask represents the probability that any given pixel belongs to that mask’s object. The pixels assigned to the mask are encoded into latent variables with means $\mu _ { t i } \in \mathbb { R } ^ { d }$ , where $i$ indexes the object slot and $t$ the frame. These means are used as the object embeddings in Aloe. More details are provided in Appendix A.1.
42
+
43
+ The self-attention component is a transformer model [37] operating on a sequence of vectors in $\mathbb { R } ^ { d }$ : the object representations $\mu _ { t i }$ for all $t$ and $i$ , a trainable vector $\mathbf { \bar { \mathit { C L S } } } \in \mathbf { \bar { \mathbb { R } } ^ { d } }$ used to generate classification results (analogous to the CLS token in BERT [9]), and (for CLEVRER) the embedded words $\mathbf { w } _ { i }$ from the question (and choice for multiple choice questions). For the object representations $\mu _ { t i }$ and word embeddings $\mathbf { w } _ { i }$ , we append a two-dimensional one-hot vector to $\mu _ { t i }$ and $\mathbf { w } _ { i }$ to indicate whether the input is a word or an object. Because the transformer is shared between the modalities, information can flow between objects and words to solve the task, as we show in Section 3.1.
44
+
45
+ We pass this sequence of vectors through a transformer with $N _ { T }$ layers. All inputs are first projected (via a linear layer and ReLU activation) to $\mathbb { R } ^ { N _ { H } \times d }$ , where $N _ { H }$ is the number of self-attention heads. We add a relative sinusoidal positional encoding at each layer of the transformer to give the model knowledge of the word and frame order [7]. The transformed value of $C L S$ is passed through an MLP (with one hidden layer of size $N _ { H }$ ) to generate the final answer. A schema of our architecture is shown in Figure 1.
46
+
47
+ Note that in the model presented above (which we call global attention), the transformer sees no distinction between objects of different frames (other than through the position encoding). Another intuitive choice, which we call hierarchical attention, is to have one transformer acting on the objects of each frame independently, and another transformer acting on the concatenated outputs of the first transformer (this temporal division of input data is commonly used, e.g. in [35]). In pseudo-code, global attention can be expressed as
48
+
49
+ ![](images/8b8974247844831b2889dcf142e48a4d89360d0c23450734c7b5e9c93722a7eb.jpg)
50
+ Figure 2: Different masking schemes for self-supervised learning applied to Aloe.
51
+
52
+ out $=$ transformer(reshape(objects, [B, F \* N, D])
53
+
54
+ and hiearchical attention as
55
+
56
+ out $=$ transformer1(reshape(objects, [B \* F, N, D])) out $=$ transformer2(reshape(out, [B, F, N $\star$ D])) .
57
+
58
+ We study the importance of global attention (objects as the atomic entities) vs hierarchical attention (objects, and subsequently frames as the atomic entities). The comparison is shown in Table 1.
59
+
60
+ # 2.1 Self-supervised learning
61
+
62
+ We explored whether self-supervised learning could improve the performance of Aloe beyond the benefits conveyed by object-level representation, i.e. in ways that support the model’s interpretation of scene dynamics rather than just via improved perception of static observations. Our approach is inspired by the loss used in BERT [9], where a transformer model is trained to predict certain words that are masked from the input. In our case, we mask object embeddings, and train the model to infer the content of the masked object representations using its knowledge of unmasked objects.
63
+
64
+ Concretely, during training, we multiply each MONet latent $\mu _ { t i }$ by a masking indicator, $m _ { t i } \in \{ 0 , 1 \}$ . Let $\mu _ { t i } ^ { \prime }$ be the transformed value of $m _ { t i } \mu _ { t i }$ after passing through the transformer. We expect the transformer to understand the underlying dynamics of the video, so that the masked out slot $\mu _ { t i }$ could be predicted from $\mu _ { t i } ^ { \prime }$ . To guide the transformer in learning effective representations capable of this type of dynamics prediction, we add an auxiliary loss:
65
+
66
+ $$
67
+ { \mathrm { a u x i l i a r y ~ l o s s } } = \sum _ { t , i } { \tau _ { t i } l \left( f ( \mu _ { t i } ^ { \prime } ) , \mu \right) } ,
68
+ $$
69
+
70
+ where $f$ is a learned linear mapping to $\mathbb { R } ^ { d }$ , $l$ a loss function, and $\tau _ { t i } \in \{ 0 , 1 \}$ are one-hot indicator variables identifying the prediction targets (not necessarily just the masked out entries, since the prediction targets could be a subset of the masked out entries). We propagate gradients only to the parameters of $f$ and the transformer and not to the learned word and $C L S$ embeddings. This auxiliary loss is added to the main classification loss with weighting $\lambda$ , and both losses are minimized simultaneously by the optimizer. We do not pretrain the model with only the auxiliary loss.
71
+
72
+ We tested two different loss functions for $l$ , an L2 loss and a contrastive loss (formulas given in Appendix A.2), and six different masking schemes (settings of $m _ { t i }$ and $\tau _ { t i }$ ), as illustrated in Figure 2. This exploration was motivated by the observation that video inputs at adjacent timesteps are highly correlated in a way that adjacent words are not. We thus hypothesized that BERT-style prediction of adjacent words might not be optimal. A different masking strategy, in which prediction targets are separated from the context by more than a single timestep, may stimulate capacity in the network to acquire knowledge that permits context-based unrolls and better long-horizon predictions.
73
+
74
+ The simplest approach would be to set $m _ { t i } = 1$ uniformly at random across $t$ and $i$ , fixing the expected proportion of the $m _ { t i }$ set to 1 (schema $^ b$ in Figure 2). The targets would simply be the unmasked slots, $\tau _ { t i } = 1 - m _ { t i }$ . One potential problem with this approach is that multiple objects could be masked out in a single frame. MONet can unpredictably switch object-to-slot assignments multiple times in a single video. If multiple slots are masked out, the transformer cannot determine with certainty which missing object to assign to each slot. Thus, the auxiliary loss could penalize the model even if it predicted all the objects correctly. To avoid this problem, we also try constraining the mask such that exactly one slot is masked out per frame (schema $a$ ).
75
+
76
+ To pose harder prediction challenges, we can add a buffer between the context (where $m _ { t i } = 1$ ) and the infilling targets (where $\tau _ { t i } = 1$ ). For $t$ in this buffer zone, both $m _ { t i } = 0$ and $\tau _ { t i } = 0$ (schemas $c { - } f )$ . We choose a single cutoff $T$ randomly, and we set $m _ { t i } = 0$ for $t < T$ and $m _ { t i } = 1$ for $t \geq T$ . In the presence of this buffer, we compared prediction (where the context is strictly before the targets; schema $c , d$ ) versus infilling (where the context surrounds the targets; schema $e , f ,$ ). We also compared setting the targets as individual objects (schema $c , e$ ) versus targets as all objects in the scene (schema $d , f )$ . We visually inspect the efficacy of this self-supervised loss in encouraging better representations (beyond improvements of scores on tasks) in Appendix D.
77
+
78
+ # 3 Experiments
79
+
80
+ We tested Aloe on three datasets, CLEVRER [41], CATER [12], and ACRE [44]. For each dataset, we pretrained a MONet model on individual frames. More training details and a table of hyperparameters are given in Appendix A.3; these hyperparameters were obtained through a hyperparameter sweep. All error bars are standard deviations computed over at least 5 random seeds.
81
+
82
+ # 3.1 CLEVRER
83
+
84
+ CLEVRER features videos of CLEVR objects [21] that move and collide with each other. For each video, several questions are posed to test the model’s understanding of the scene. Unlike most other visual question answering datasets, which test for only descriptive understanding (“what happened?”), CLEVRER poses other more complex questions, including explanatory questions (“why did something happen?”), predictive questions (“what will happen next?”), and counterfactual questions (“what would happen in a unseen circumstance?”) [41].
85
+
86
+ We compare Aloe to state-of-the-art models reported in the literature: MAC $\left( \mathrm { V } + \right)$ and NS-DR [41], as well as the DCL model [6] (simultaneous to our work). MAC $\left( \mathrm { V } + \right)$ (based on the MAC network [20]) is an end-to-end network augmented with object information and trained using ground truth labels for object segmentation masks and features (e.g. color, shape). NS-DR and DCL are hybrid models that apply a symbolic logic engine to outputs of various neural networks. The neural networks are used to detect objects, predict dynamics, and parse the question into a program, and the symbolic executor runs the parsed program to obtain the final output. NS-DR is trained using ground truth labels and ground truth parsed programs, while DCL requires only the ground truth parsed programs.
87
+
88
+ Table 1 shows the result of Aloe compared to these models. Across all categories, Aloe significantly outperforms the previous best models. Moreover, compared to the other models, Aloe does not use any labeled data other than the correct answer for the questions, nor does it require pretraining on any other dataset. Aloe also was not specifically designed for this task, and it straightforwardly generalizes to other tasks as well, such as CATER [12] and ACRE [44]. We provide a few sample model classifications on a randomly selected set of videos and questions in Appendix E.1 and detailed analysis of counterfactual questions in Appendix C. These examples suggest qualitatively that, for most instances where the model was incorrect, humans would plausibly furnish the same answer.
89
+
90
+ Attention analysis (More analyses are given in Appendix D) We analyzed the cross-modal attention between question-words and the MONet objects. For each word, we determined the object that attended to that word with highest weight (for one head in the last layer). In the visualization below, the bounding boxes show the objects found by MONet, and each word is colored according to the
91
+
92
+ Table 1: Performance (per question accuracy) on CLEVRER of Aloe compared to results from literature and to ablations: 1) MLP instead of self-attention; 2) ResNet superpixels instead of MONet objects; 3) hierarchical frame-level and intra-frame attention instead of global cross-frame object attention; 4) no auxiliary loss.
93
+
94
+ <table><tr><td>Model</td><td>Descriptive</td><td>Explanatory</td><td>Predictive</td><td>Counterfactual</td></tr><tr><td>MAC (V+)</td><td>86.4</td><td>22.3</td><td>42.9</td><td>25.1</td></tr><tr><td>NS-DR</td><td>88.1</td><td>79.6</td><td>68.7</td><td>42.2</td></tr><tr><td>DCL</td><td>90.7</td><td>82.8</td><td>82.0</td><td>46.5</td></tr><tr><td>Aloe</td><td>94.0 ± 0.4</td><td>96.0 ± 0.6</td><td>87.5 ± 3.0</td><td>75.6 ± 3.8</td></tr><tr><td>Aloe- self-attention+MLP</td><td>45.4</td><td>16.0</td><td>27.7</td><td>9.9</td></tr><tr><td>Aloe- object-repr. +ResNet</td><td>74.9</td><td>66.1</td><td>58.3</td><td>32.4</td></tr><tr><td>Aloe - global + hierarchical attn.</td><td>80.6</td><td>87.4</td><td>73.5</td><td>55.1</td></tr><tr><td>Aloe- self-supervised loss</td><td>91.0</td><td>92.8</td><td>82.8</td><td>68.7</td></tr></table>
95
+
96
+ object that attended to it with highest weight (black represents a MONet slot without any objects).
97
+ We observe that generally, objects attend heavily to the words that describe them.
98
+
99
+ ![](images/229b16c4fda57fa6be8830ae071ce6a0ec54820c6c821a7f96d21f78abffa24d.jpg)
100
+
101
+ Q: If the cylinder is removed, which event will not happen?
102
+
103
+ 1. The brown object collides with the green object.
104
+ 2. The yellow object and the metal cube collide.
105
+ 3. The yellow cube collides with the green object.
106
+
107
+ We also looked at the objects that were most heavily attended upon in determining the final answer. The image below illustrates the attention weights for the $C L S$ token attending on each object (for one head in the last layer), when the model is tasked with assessing the first choice of the question above. The bounding boxes show the two most heavily attended upon objects for one transformer head. We observe that this head focuses on the green and brown objects (asked about in choice 1), but switches its focus to the cyan cylinder when it looks like the cylinder might collide with the cubes and change the outcome.
108
+
109
+ ![](images/f9813d948a0c16a84c18a5a51d92a5b3b2434d16be376473d12c2adad84e34ba.jpg)
110
+
111
+ Model ablation Table 1 shows the contributions of various components of Aloe. First, self-attention is necessary for solving this problem. For comparison, we replace Aloe’s transformer with four fully connected layers with 2048 units per layer1. We find that an MLP is unable to answer non-descriptive questions effectively, despite using more parameters (20M vs 15M parameters).
112
+
113
+ Second, we verify that an object-based discretization scheme is essential to the performance of Aloe. We compare with a version of the architecture where the MONet object representations $\mu _ { t i }$ are replaced with ResNet hyperpixels as in Zambaldi et al. [43]. Concretely, we flatten the output of the final convolutional layer of the ResNet to obtain a sequence of feature vectors that is fed into the transformer as the discrete entities. To match MONet’s pretraining regimen, we pretrain the ResNet on CLEVR [21] by training an Aloe model (using a ResNet instead of MONet) on the CLEVR task and initializing the ResNet used in the CLEVRER task with these pre-trained weights. We find that an object level representation, such as one output by MONet, greatly outperforms the locality-aware but object-agnostic ResNet representation.
114
+
115
+ We also observe the importance of global attention between all objects across all frames, compared to a hierarchical attention model where objects within a frame could attend to each other but frames could only attend to each other as an atomic entity. We hypothesize that global attention may be important because with hierarchical attention, objects in different frames can only attend to each other at the “frame” granularity. A cube attending to a cube in a different frame would then gather information about the other non-cube objects, muddling the resulting representation.
116
+
117
+ ![](images/3444a8a096a123941b20407702c07de6ac1b82d124cdf4ea73c3ff1606e480c9.jpg)
118
+ Figure 3: Accuracy with/without auxiliary loss for different proportions of CLEVRER (row 1) and CATER (row 2) training data. We also show comparisons with previous and concurrent work. For CLEVRER, the lighter yellow bar represents the best neurosymbolic model DCL, and the darker yellow bar represents the previous best distributed model, MAC $\left( \mathrm { V } + \right)$ . For CATER, the lighter yellow bar represents Hopper and the darker yellow bar represents $\mathrm { R 3 D + N L }$ , the best published results for the moving camera dataset.
119
+
120
+ Finally, we see that an auxiliary self-supervised loss improves the performance of the model by between 4 and 6 percentage points, with the greatest improvement on the counterfactual questions.
121
+
122
+ Self-supervision strategies We compared the various masking schemes and loss functions for our auxiliary loss; a detailed figure is provided in Appendix A (Figure 4). We find that for all question types in CLEVRER, an L2 loss performs better than a contrastive loss, and among the masking schemes, masking one object per frame is the most effective. This particular result runs counter to our hypothesis that predictions or infilling in which the target is temporally removed from the context could encourage the model to learn more about scene dynamics and object interactions than (BERT-style) local predictions of adjacent targets. Of course, there may be other settings or loss functions that reveal the benefits of non-local prediction or constrastive losses; we leave this investigation to future work.
123
+
124
+ Data efficiency We investigated how model performance varies as a function of the number of labelled (question-answer) pairs it learns from. To do so, we train models on $N \%$ of the videos and their associated labeled data. We evaluate the effect of including the auxiliary self-supervised loss (applied to the entire dataset, not just the labelled portion) in this low data regime. This scenario, where unlabeled data is plentiful while labeled data is scarce, occurs frequently in practice, since collecting labeled data is much more expensive than collecting unlabeled data.
125
+
126
+ Figure 3 shows that our best model reaches the approximate level of the previous state-of-the-art approaches using only $50 \% - 6 0 \%$ of the data. The self-supervised auxiliary loss makes a particular improvement to performance in low-data regimes. For instance, when trained on only $50 \%$ of the available labelled data, self-supervised learning enables the model to reach a performance of $37 \%$ on counterfactual questions (compared to $2 5 \%$ by MAC $( \mathrm { V } + )$ and $42 \%$ by NS-DR on the full dataset), while without self-supervision, the model only reaches a performance of $13 \%$ (compared to the $10 \%$ achieved by answering randomly [41]).
127
+
128
+ Table 2: Performance on CATER of Aloe compared to the best results from literature. We report top 1 accuracy, top 5 accuracy, and L1 distance between the predicted grid cell and true grid cell. The labels (S) and (M) refer to static and moving cameras.
129
+
130
+ <table><tr><td>Model</td><td>Top 1 (S)</td><td>Top 5 (S)</td><td>L1(S)</td><td>Top 1 (M)</td><td>Top 5 (M)</td><td>L1 (M)</td></tr><tr><td>R3DLSTM R3D+NL LSTM OPNet</td><td>60.2 46.2 74.8 73.2</td><td>81.8 69.9 1 93.8</td><td>1.2 1.5 0.54 0.85</td><td>28.6 38.6 1 1</td><td>63.3 70.2 1 1</td><td>1.7 1.5 -</td></tr><tr><td>Hopper Aloe (no auxiliary) Aloe Aloe (with L1 loss)</td><td>60.5 70.6 74.0 ± 0.3</td><td>84.5 93.0 94.0 ± 0.4</td><td>0.90 0.53 0.44 ± 0.01</td><td>46.8 56.6 59.7 ± 0.5</td><td>75.1 87.0 90.1 ± 0.6</td><td>- 1.3 0.82 0.69 ± 0.01</td></tr></table>
131
+
132
+ # 3.2 CATER
133
+
134
+ In a second experiment, we tested Aloe on CATER, a widely-used object-tracking dataset [12, 14, 31, 45]. In CATER, objects from the CLEVR dataset [21] move and potentially occlude other objects, and the goal is to predict the location of a target object (called the snitch) in the final frame. Because the snitch could be occluded by multiple objects that could move in the meantime, a successful model must be sensitive to notions of object permanence. CATER also includes a moving camera variant, which introduces additional complexities for the model.
135
+
136
+ Concretely, CATER is setup as a classification challenge. Objects are located in an xyz coordinate system, where x and y range from -3 to 3. The xy plane is divided into a 6 by 6 grid, and the task is to predict the grid index of the snitch in the final frame. For Aloe, we use a classification loss (cross entropy over the 36 possible grid indices) and an L1 loss (L1 distance between predicted grid cell and the true grid cell).
137
+
138
+ Table 2 shows Aloe compared to state-of-the-art models in the literature on both static and moving camera videos. R3D and R3D NL are the strongest two models evaluated by Girdhar and Ramanan [12]. OPNet, or the Object Permanence Network [31], is an architecture with inductive biases designed for object tracking tasks; it was trained with extra supervised labels, namely the bounding boxes for all objects (including occluded ones). Hopper is a multi-hop transformer model developed simultaneously with this work [45]. One key component of Hopper is Hungarian matching between objects of different frames, a strong inductive bias for object tracking.
139
+
140
+ We train Aloe simultaneously on both static and moving camera videos. Aloe outperforms the R3D models for both static and moving cameras. We also ran Aloe with an additional auxiliary loss consisting of the L1 distance between the predicted cell and the actual cell. With this additional loss, we get comparable results in the moving camera case as the R3D models for the static camera case. Moreover, we achieve comparable accuracy as OPNet for accuracy and L1 distance, despite requiring less supervision to train. Appendix E.2 gives a few sample outputs from Aloe; in particular we note that it is able to find the target object in several cases where the object was occluded, demonstrating that Aloe is able to do some level of object tracking. Finally,we find that an auxiliary self-supervised loss helps the model perform well in the low data regime for CATER as well, as shown in Figure 3.
141
+
142
+ # 3.3 ACRE
143
+
144
+ Finally, we measured Aloe’s performance on ACRE, a causal induction dataset inspired by the Blicket task from developmental psychology [13, 44]. ACRE is divided into a set of problems. In each problem, certain objects are chosen to be “Blickets”, and this assignment changes across problems. Each problem presents a context of six images to the model, where different objects are placed on a Blicket machine that lights up if one of those objects is a Blicket. The model is asked whether an unseen combination of objects will light up the Blicket machine. Besides “yes” and “no”, a third possible answer is “undetermined”, which is the case if it is impossible to determine for certain if the objects will light up the machine. Correct inference goes beyond mere correlation: even if every context scene involving object A has a lit-up machine, A’s Blicketness is still uncertain if each of those scenes can potentially be explained by another object (deduction of A’s Blicketness is backward-blocked).
145
+
146
+ Table 3: Performance on ACRE of Aloe compared to the best results from Zhang et al. [44], split across inference type $\mathrm { { D . R = } } 1$ Direct, I.D $\Vdash$ Indirect, ${ \bf { S . O } } \mathrm { { = } } \mathrm { { ; } }$ Screen-Off, B.B $\ c =$ Backwards Blocking) and generalization type ( $\mathrm { C } =$ Compositional, ${ \bf S } =$ Systematic).
147
+
148
+ <table><tr><td>Model</td><td>All (C)</td><td>D.R.</td><td>I.D.</td><td>S.0.</td><td>B.B.</td><td>All (S)</td><td>D.R.</td><td>1.D.</td><td>S.0.</td><td>B.B</td></tr><tr><td>CNN-BERT</td><td>43.79</td><td>54.07</td><td>46.88</td><td>40.57</td><td>28.79</td><td>39.93</td><td>55.97</td><td>68.25</td><td>0.00</td><td>45.59</td></tr><tr><td>NS-OPT</td><td>69.04</td><td>92.5</td><td>76.05</td><td>88.33</td><td>13.48</td><td>67.44</td><td>94.73</td><td>88.38</td><td>82.76</td><td>16.06</td></tr><tr><td>Aloe</td><td>91.76</td><td>97.14</td><td>90.8</td><td>96.8</td><td>78.81</td><td>93.90</td><td>97.18</td><td>71.24</td><td>98.97</td><td>94.48</td></tr></table>
149
+
150
+ Inference problems in ACRE are categorized by reasoning type: reasoning from direct evidence (one of the context frames show the query objects on a machine), reasoning from indirect evidence (Blicketness must be deduced by combining evidence from several frames), screened-off reasoning (presence of non-Blickets do not matter if a single Blicket is present), and backward-blocked reasoning (Blicketness cannot be deduced due to confounding variables). Please see Zhang et al. [44] for a more detailed discussion of these reasoning types.
151
+
152
+ Table 3 show Aloe performance compared to a CNN-BERT baseline and to NS-OPT, a neuro-symbolic model introduced in Zhang et al. [44]. Aloe outperforms all extant models for almost all reasoning types and train-test splits. We did not need to do any tuning to apply our model to ACRE—settings from CATER yielded the reported results on the first attempt. Contrary to widely-held opinions that neural networks cannot generalize, Aloe generalizes in scenarios where the training and test sets contain different visual features (compositional split) or different numbers of activated machines in the context (systematic split). Moreover, Aloe achieved by far the best performance on the backwardblocking task, which requires the model to “go beyond the simple covariation strategy to discover the hidden causal relations” [44], dispelling the notion that neural networks can only find correlation. Comparison with NS-OPT (which uses object representations) and CNN-BERT (which uses attention) shows that neither object representations nor attention alone is sufficient for the task; combining these two ideas, as done in Aloe for instance, is essential for this complex reasoning task as well.
153
+
154
+ # 4 Related work
155
+
156
+ Self-attention for reasoning Various studies have shown that transformers [37] can manipulate symbolic data in a manner traditionally associated with symbolic computation. For example, in Lample and Charton [23], a transformer model learned to do symbolic integration and solve ordinary differential equations symbolically, tasks traditionally reserved for symbolic computer algebra systems. Similarly, in Hahn et al. [17], a transformer model learned to solve formulas in propositional logic and demonstrated some degree of generalization to out of distribution formulas. Finally, Brown et al. [1] showed that a transformer trained for language modeling can also do simple analogical reasoning tasks without explicit training. Although these models do not necessarily beat carefully tuned symbolic algorithms in all cases (especially on out of distribution data), they are an important motivation for our proposed recipe for attaining strong reasoning capabilities from self-attention-based models on visually grounded tasks.
157
+
158
+ Object representations A wide body of research points to the importance of object segmentation and representation learning (see e.g. Garnelo and Shanahan [11] for a discussion). Various methods have been proposed for object detection and feature extraction [2, 10, 15, 19, 25, 26, 29]. Past research have also investigated using object based representations in downstream tasks [8, 28].
159
+
160
+ Self-supervised learning Another line of research concerns learning good representations through self-supervised learning, with an unsupervised auxiliary loss to encourage the discovery of better representations. These better representations could lead to improved performance on supervised tasks, especially when labeled data is scarce. In Devlin et al. [9], for instance, an auxiliary infill loss allows the BERT model to benefit from pretraining on a large corpus of unlabeled data. Our approach to object-centric self-supervised learning is heavily inspired by the BERT infilling loss. Other studies have shown similar benefits to auxiliary learning in vision as well [4, 16, 18]. These works apply various forms of contrastive losses to predict scene dynamics, and the better representations that result carry downstream benefits to supervised and reinforcement learning tasks.
161
+
162
+ Vision and language in self-attention models Recently, many works have emerged on applying transformer models to visual and multimodal data, for static images [24, 27, 33, 36] and videos [34, 35, 43]. These approaches combine the output of convolutional networks with language in various ways using self-attention. While these previous works focused on popular visual question answering tasks, which typically consist of descriptive questions only [41], we focus on understanding deeper causal dynamics of videos. Together with these works, we provide more evidence that self-attention between visual and language elements enables good performance on a diverse set of tasks.
163
+
164
+ In addition, while the use of object representations for discretization in tasks involving static images is becoming more popular, the right way to discretize videos is less clear. We provide strong evidence in the form of ablation studies for architectural decisions that we claim are essential for higher reasoning for this type of data: visual elements should correspond to physical objects in the videos and inter-frame attention between sub-frame entities (as opposed to inter-frame attention of entire frames) is crucial. We also demonstrate the success of using unsupervised object segmentation methods as opposed to the supervised methods used in past work.
165
+
166
+ # 5 Conclusion
167
+
168
+ We have presented Aloe, a model that obtains state-of-the-art performance on three different task domains involving spatiotemporal reasoning about objects. In each of these tasks, previous state-ofthe-art results were established by models with modular, task-specific components. Aloe, by contrast, is a unified solution to all three domains. Its flexibility comes from a reliance on only soft biases and learning objectives: self-attention over learned object embeddings and self-supervised learning of dynamics. We believe the simplicity of this approach is its strength, and hope that this fact, together with the provided code, makes it easy for others to adopt and apply to arbitrary spatio-temporal reasoning problems.
169
+
170
+ On many of these spatio-temporal reasoning problems, previous state-of-the-art was achieved by neuro-symbolic models [6, 11, 40, 41, 44]. Compared to neuro-symbolic models, Aloe can more easily be adapted to other tasks. Indeed, the symbolic components of neuro-symbolic models are often task-specific and not straightforwardly applicable to other tasks. Neuro-symbolic models do have a few advantages, however. First, they are often easier to interpret. Despite the insights that can be gleaned from Aloe’s attention weights, these soft computations are harder to interpret than the explicit symbolic computation found in neuro-symbolic models. Moreover, neuro-symbolic models can be structured in a more modular fashion, which can enable effective generalization to sub-tasks of the task on which the model was trained [6].
171
+
172
+ Aloe also has some important limitations. First, it has only been applied to synthetic datasets. This limitation is mainly due to the lack of real-world datasets that test for higher-order spatiotemporal reasoning, although we are excited that new datasets such as Traffic QA will be released soon [38]. Second, while the domains where Aloe is applied have been widely adopted and well-received by the research community, it remains possible that they do not evaluate the capacities that they aim to evaluate because of hidden biases or other factors. Regardless, we hope that this work stimulates the design and development of more challenging tasks that more closely approximate the ultimate goal of human or super-human-level visual, spatiotemporal and causal reasoning. Finally, from an ethical point of view, our model may share the common drawback of deep-learning models in perpetuating biases found in the training data, especially when applied to real world data. Development of causal reasoning models could also invite problematic applications involving automated assignment of blame.
173
+
174
+ References
175
+ [1] Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
176
+ [2] Chris P. Burgess, Loic Matthey, Nick Watters, Rishabh Kabra, Irina Higgins, Matt Botvinick, and Alex Lerchner. MONet: Unsupervised scene decomposition and representation. arXiv preprint arXiv:1901.11390, 2019.
177
+ [3] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, 2020.
178
+ [4] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709, 2020.
179
+ [5] Zhe Chen. Object-based attention: A tutorial review. Attention, Perception, & Psychophysics, 74:784–802, 2012. URL https://doi.org/10.3758/s13414-012-0322-z.
180
+ [6] Zhenfang Chen, Jiayuan Mao, Jiajun Wu, Kwan-Yee Kenneth Wong, Joshua B. Tenenbaum, and Chuang Gan. Grounding physical object and event concepts through dynamic visual reasoning. In International Conference on Learning Representations, 2021. URL https: //arxiv.org/pdf/2103.16564.pdf.
181
+ [7] Zihang Dai, Zhilin Yang, Yiming Yang, William W Cohen, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. arXiv preprint arXiv:1901.02860, 2019.
182
+ [8] Mikyas T. Desta, Larry Chen, and Tomasz Kornuta. Object-based reasoning in VQA. CoRR, abs/1801.09718, 2018. URL http://arxiv.org/abs/1801.09718.
183
+ [9] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
184
+ [10] Yilun Du, Kevin Smith, Tomer Ulman, Joshua Tenenbaum, and Jiajun Wu. Unsupervised discovery of 3d physical objects from video. arXiv preprint arXiv:2007.12348, 2020.
185
+ [11] Marta Garnelo and Murray Shanahan. Reconciling deep learning with symbolic artificial intelligence: representing objects and relations. Current Opinion in Behavioral Sciences, 29: 17–23, 2019.
186
+ [12] Rohit Girdhar and Deva Ramanan. CATER: A diagnostic dataset for Compositional Actions and TEmporal Reasoning. In ICLR, 2020.
187
+ [13] Alison Gopnik and David Sobel. Detecting blickets: how young children use information about novel causal powers in categorization and induction. Child Dev, pages 1205–22, 2000. doi: 10.1111/1467-8624.00224.
188
+ [14] Anirudh Goyal, Aniket Didolkar, Alex Lamb, Kartikeya Badola, Nan Rosemary Ke, Nasim Rahaman, Jonathan Binas, Charles Blundell, Michael Mozer, and Yoshua Bengio. Coordination among neural modules through a shared global workspace. CoRR, abs/2103.01197, 2021. URL https://arxiv.org/abs/2103.01197.
189
+ [15] Klaus Greff, Raphaël Lopez Kaufman, Rishabh Kabra, Nick Watters, Christopher Burgess, Daniel Zoran, Loïc Matthey, Matthew Botvinick, and Alexander Lerchner. Multi-object representation learning with iterative variational inference. CoRR, abs/1903.00450, 2019. URL http://arxiv.org/abs/1903.00450.
190
+ [16] Karol Gregor, Danilo Jimenez Rezende, Frederic Besse, Yan Wu, Hamza Merzic, and Aaron van den Oord. Shaping belief states with generative environment models for rl. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d’ Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems 32, pages 13475–13487. Curran Associates, Inc., 2019. URL http://papers.nips.cc/paper/ 9503-shaping-belief-states-with-generative-environment-models-f pdf.
191
+
192
+ [17] Christopher Hahn, Frederik Schmitt, Jens U. Kreber, Markus N. Rabe, and Bernd Finkbeiner. Transformers generalize to the semantics of logics. arXiv preprint arXiv:2003.04218, 2020.
193
+
194
+ [18] Tengda Han, Weidi Xie, and Andrew Zisserman. Video representation learning by dense predictive coding. In Workshop on Large Scale Holistic Video Understanding, ICCV, 2019.
195
+
196
+ [19] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross B. Girshick. Mask R-CNN. CoRR, abs/1703.06870, 2017. URL http://arxiv.org/abs/1703.06870.
197
+
198
+ [20] Drew A Hudson and Christopher D Manning. Compositional attention networks for machine reasoning. 2018.
199
+
200
+ [21] Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Li Fei-Fei, C. Lawrence Zitnick, and Ross B. Girshick. CLEVR: A diagnostic dataset for compositional language and elementary visual reasoning. CoRR, abs/1612.06890, 2016. URL http://arxiv.org/abs/1612. 06890.
201
+
202
+ [22] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
203
+
204
+ [23] Guillaume Lample and François Charton. Deep learning for symbolic mathematics. In International Conference on Learning Representations, 2020. URL https://openreview.net/ forum?id ${ . } = { }$ S1eZYeHFDS.
205
+
206
+ [24] Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. Visualbert: A simple and performant baseline for vision and language. arXiv preprint arXiv:1908.03557, 2019.
207
+
208
+ [25] Zhixuan Lin, Yi-Fu Wu, Skand Vishwanath Peri, Weihao Sun, Gautam Singh, Fei Deng, Jindong Jiang, and Sungjin Ahn. SPACE: Unsupervised object-oriented scene representation via spatial attention and decomposition. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ rkl03ySYDH.
209
+
210
+ [26] Francesco Locatello, Dirk Weissenborn, Thomas Unterthiner, Aravindh Mahendran, Georg Heigold, Jakob Uszkoreit, Alexey Dosovitskiy, and Thomas Kipf1. Object-Centric Learning with Slot Attention. In Advances in Neural Information Processing Systems (NIPS), 2020.
211
+
212
+ [27] Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. arXiv preprint arXiv:1908.02265, 2019.
213
+
214
+ [28] David Raposo, Adam Santoro, David G. T. Barrett, Razvan Pascanu, Timothy P. Lillicrap, and Peter W. Battaglia. Discovering objects and their relations from entangled scene representations. CoRR, abs/1702.05068, 2017. URL http://arxiv.org/abs/1702.05068.
215
+
216
+ [29] Shaoqing Ren, Kaiming He, Ross B. Girshick, and Jian Sun. Faster R-CNN: towards realtime object detection with region proposal networks. CoRR, abs/1506.01497, 2015. URL http://arxiv.org/abs/1506.01497.
217
+
218
+ [30] Pieter R. Roelfsema, Victor A. Lamme, and Henk Spekreijse. Object-based attention in the primary visual cortex of the macaque monkey. Nature, 395:376–381, 1998. doi: 10.1038/26475.
219
+
220
+ [31] Aviv Shamsian, Ofri Kleinfeld, Amir Globerson, and Gal Chechik. Learning object permanence from video. arXiv preprint arXiv:2003.10469, 2020.
221
+
222
+ [32] Elizabeth Spelke. Core knowledge. The American psychologist, 55:1233–43, 12 2000. doi: 10.1037/0003-066X.55.11.1233.
223
+
224
+ [33] Weijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. Vl-bert: Pretraining of generic visual-linguistic representations. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ SygXPaEYvH.
225
+
226
+ [34] Chen Sun, Fabien Baradel, Kevin Murphy, and Cordelia Schmid. Contrastive bidirectional transformer for temporal representation learning. CoRR, abs/1906.05743, 2019. URL http: //arxiv.org/abs/1906.05743.
227
+
228
+ [35] Chen Sun, Austin Myers, Carl Vondrick, Kevin Murphy, and Cordelia Schmid. Videobert: A joint model for video and language representation learning. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), October 2019.
229
+
230
+ [36] Hao Tan and Mohit Bansal. Lxmert: Learning cross-modality encoder representations from transformers. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing, 2019.
231
+
232
+ [37] 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, pages 5998–6008, 2017.
233
+
234
+ [38] Li Xu, He Huang, and Jun Liu. Sutd-trafficqa: A question answering benchmark and an efficient network for video reasoning over traffic events. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2021.
235
+
236
+ [39] Kexin Yi, Jiajun Wu, Chuang Gan, Antonio Torralba, Pushmeet Kohli, and Joshua B Tenenbaum. Neural-Symbolic VQA: Disentangling Reasoning from Vision and Language Understanding. In Advances in Neural Information Processing Systems (NIPS), 2018.
237
+
238
+ [40] Kexin Yi, Jiajun Wu, Chuang Gan, Antonio Torralba, Pushmeet Kohli, and Joshua B. Tenenbaum. Neural-symbolic vqa: Disentangling reasoning from vision and language understanding. In Advances in Neural Information Processing Systems, pages 1039–1050, 2018.
239
+
240
+ [41] Kexin Yi, Chuang Gan, Yunzhu Li, Pushmeet Kohli, Jiajun Wu, Antonio Torralba, and Joshua B. Tenenbaum. CLEVRER: Collision events for video representation and reasoning. In International Conference on Learning Representations, 2020. URL https: //openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HkxYzANYDB.
241
+
242
+ [42] Yang You, Jing Li, Sashank Reddi, Jonathan Hseu, Sanjiv Kumar, Srinadh Bhojanapalli, Xiaodan Song, James Demmel, and Cho-Jui Hsieh. Large batch optimization for deep learning: Training BERT in 76 minutes. Technical Report UCB/EECS-2019-103, EECS Department, University of California, Berkeley, Jun 2019. URL http://www2.eecs.berkeley.edu/Pubs/ TechRpts/2019/EECS-2019-103.html.
243
+
244
+ [43] Vinicius Zambaldi, David Raposo, Adam Santoro, Victor Bapst, Yujia Li, Igor Babuschkin, Karl Tuyls, David Reichert, Timothy Lillicrap, Edward Lockhart, Murray Shanahan, Victoria Langston, Razvan Pascanu, Matthew Botvinick, Oriol Vinyals, and Peter Battaglia. Deep reinforcement learning with relational inductive biases. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HkxaFoC9KQ.
245
+
246
+ [44] Chi Zhang, Baoxiong Jia, Mark Edmonds, Song-Chun Zhu, and Yixin Zhu. Acre: Abstract causal reasoning beyond covariation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
247
+
248
+ [45] Honglu Zhou, Asim Kadav, Farley Lai, Alexandru Niculescu-Mizil, Martin Renqiang Min, Mubbasir Kapadia, and Hans Peter Graf. Hopper: Multi-hop transformer for spatiotemporal reasoning. In International Conference on Learning Representations, 2021. URL https: //arxiv.org/abs/2103.10574.
md/train/r1My6sR9tX/r1My6sR9tX.md ADDED
@@ -0,0 +1,388 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # UNSUPERVISED LEARNING VIA META-LEARNING
2
+
3
+ Kyle Hsu†
4
+ University of Toronto
5
+ kyle.hsu@mail.utoronto.ca
6
+
7
+ Sergey Levine, Chelsea Finn University of California, Berkeley {svlevine,cbfinn}@eecs.berkeley.edu
8
+
9
+ # ABSTRACT
10
+
11
+ A central goal of unsupervised learning is to acquire representations from unlabeled data or experience that can be used for more effective learning of downstream tasks from modest amounts of labeled data. Many prior unsupervised learning works aim to do so by developing proxy objectives based on reconstruction, disentanglement, prediction, and other metrics. Instead, we develop an unsupervised meta-learning method that explicitly optimizes for the ability to learn a variety of tasks from small amounts of data. To do so, we construct tasks from unlabeled data in an automatic way and run meta-learning over the constructed tasks. Surprisingly, we find that, when integrated with meta-learning, relatively simple task construction mechanisms, such as clustering embeddings, lead to good performance on a variety of downstream, human-specified tasks. Our experiments across four image datasets indicate that our unsupervised meta-learning approach acquires a learning algorithm without any labeled data that is applicable to a wide range of downstream classification tasks, improving upon the embedding learned by four prior unsupervised learning methods.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Unsupervised learning is a fundamental, unsolved problem (Hastie et al., 2009) and has seen promising results in domains such as image recognition (Le et al., 2013) and natural language understanding (Ramachandran et al., 2017). A central use case of unsupervised learning methods is enabling better or more efficient learning of downstream tasks by training on top of unsupervised representations (Reed et al., 2014; Cheung et al., 2015; Chen et al., 2016) or fine-tuning a learned model (Erhan et al., 2010). However, since the downstream objective requires access to supervision, the objectives used for unsupervised learning are only a rough proxy for downstream performance. If a central goal of unsupervised learning is to learn useful representations, can we derive an unsupervised learning objective that explicitly takes into account how the representation will be used?
16
+
17
+ The use of unsupervised representations for downstream tasks is closely related to the objective of meta-learning techniques: finding a learning procedure that is more efficient and effective than learning from scratch. However, unlike unsupervised learning methods, meta-learning methods require large, labeled datasets and hand-specified task distributions. These dependencies are major obstacles to widespread use of these methods for few-shot classification.
18
+
19
+ To begin addressing these problems, we propose an unsupervised meta-learning method: one which aims to learn a learning procedure, without supervision, that is useful for solving a wide range of new, human-specified tasks. With only raw, unlabeled observations, our model’s goal is to learn a useful prior such that, after meta-training, when presented with a modestly-sized dataset for a human-specified task, the model can transfer its prior experience to efficiently learn to perform the new task. If we can build such an algorithm, we can enable few-shot learning of new tasks without needing any labeled data nor any pre-defined tasks.
20
+
21
+ To perform unsupervised meta-learning, we need to automatically construct tasks from unlabeled data. We study several options for how this can be done. We find that a good task distribution should be diverse, but also not too difficult: na¨ıve random approaches for task generation produce tasks that contain insufficient regularity to enable useful meta-learning. To that end, our method proposes tasks by first leveraging prior unsupervised learning algorithms to learn an embedding of the input data, and then performing an overcomplete partitioning of the dataset to construct numerous categorizations of the data. We show how we can derive classification tasks from these categorizations for use with meta-learning algorithms. Surprisingly, even with simple mechanisms for partitioning the embedding space, such as $k$ -means clustering, we find that meta-learning acquires priors that, when used to learn new, human-designed tasks, learn those tasks more effectively than methods that directly learn on the embedding. That is, the learning algorithm acquired through unsupervised meta-learning achieves better downstream performance than the original representation used to derive meta-training tasks, without introducing any additional assumptions or supervision. See Figure 1 for an illustration of the complete approach.
22
+
23
+ The core idea in this paper is that we can leverage unsupervised embeddings to propose tasks for a meta-learning algorithm, leading to an unsupervised meta-learning algorithm that is particularly effective as pre-training for human-specified downstream tasks. In the following sections, we formalize our problem assumptions and goal, which match those of unsupervised learning, and discuss several options for automatically deriving tasks from embeddings. We instantiate our method with two meta-learning algorithms and compare to prior state-of-the-art unsupervised learning methods. Across four image datasets (MNIST, Omniglot, miniImageNet, and CelebA), we find that our method consistently leads to effective downstream learning of a variety of human-specified tasks, including character recognition tasks, object classification tasks, and facial attribute discrimination tasks, without requiring any labels or hand-designed tasks during meta-learning and where key hyperparameters of our method are held constant across all domains. We show that, even though our unsupervised meta-learning algorithm trains for one-shot generalization, one instantiation of our approach performs well not only on few-shot learning, but also when learning downstream tasks with up to 50 training examples per class. In fact, some of our results begin to approach the performance of fully-supervised meta-learning techniques trained with fully-specified task distributions.
24
+
25
+ ![](images/2aa42c4a43d437245b1ba217e8b16d1cdbed8dd1add1db4a9609cd8a7a78f543.jpg)
26
+ Figure 1: Illustration of the proposed unsupervised meta-learning procedure. Embeddings of raw observations are clustered with $k$ -means to construct partitions, which give rise to classification tasks. Each task involves distinguishing between examples from $N = 2$ clusters, with $K _ { \mathrm { m - t r } } = 1$ example from each cluster being a training input. The meta-learner’s aim is to produce a learning procedure that successfully solves these tasks.
27
+
28
+ # 2 UNSUPERVISED META-LEARNING
29
+
30
+ In this section, we describe our problem setting in relation to that of unsupervised and semisupervised learning, provide necessary preliminaries, and present our approach.
31
+
32
+ # 2.1 PROBLEM STATEMENT
33
+
34
+ Our goal is to leverage unlabeled data for the efficient learning of a range of human-specified downstream tasks. We only assume access to an unlabeled dataset $\mathcal { D } = \{ \mathbf { x } _ { i } \}$ during meta-training. After learning from the unlabeled data, which we will refer to as unsupervised meta-training, we want to apply what was learned towards learning a variety of downstream, human-specified tasks from a modest amount of labeled data, potentially as few as a single example per class. These downstream tasks may, in general, have different underlying classes or attributes (in contrast to typical semi-supervised problem assumptions), but are assumed to have inputs from the same distribution as the one from which datapoints in $\mathcal { D }$ are drawn. Concretely, we assume that downstream tasks are $M$ -way classification tasks, and that the goal is to learn an accurate classifier using $K$ labeled datapoints $\left( \mathbf { x } _ { k } , \mathbf { y } _ { k } \right)$ from each of the $M$ classes, where $K$ is relatively small (i.e. between 1 and 50).
35
+
36
+ The unsupervised meta-training phase aligns with the unsupervised learning problem in that it involves no access to information about the downstream tasks, other than the fact that they are $M$ -way classification tasks, for variable $M$ upper-bounded by $N$ . The upper bound $N$ is assumed to be known during unsupervised meta-training, but otherwise, the values of $M$ and $K$ are not known $a$ priori. As a result, the unsupervised meta-training phase needs to acquire a sufficiently general prior for applicability to a range of classification tasks with variable quantities of data and classes. This problem definition is our prototype for a practical use-case in which a user would like to train an application-specific image classifier, but does not have an abundance of labeled data.
37
+
38
+ # 2.2 PRELIMINARIES
39
+
40
+ Unsupervised embedding learning. An unsupervised embedding learning algorithm $\mathcal { E }$ is a procedure that takes as input an unlabeled dataset $\mathcal { D } = \left\{ \mathbf { x } _ { i } \right\}$ and outputs a mapping from $\{ { \bf { x } } _ { i } \}$ to embeddings $\left\{ \mathbf { z } _ { i } \right\}$ . These embedded points are typically lower-dimensional and arranged such that distances correspond to meaningful differences between inputs, in contrast to distances between the original inputs, such as image pixels, which are not meaningful measures of image similarity.
41
+
42
+ Task. An $M$ -way $K$ -shot classification task $\tau$ consists of $K$ training datapoints and labels $\{ ( \mathbf { x } _ { k } , \ell _ { k } ) \}$ per class, which are used for learning a classifier, and $Q$ query datapoints and labels per class, on which the learned classifier is evaluated. That is, in a task there are $K + Q = R$ datapoints and labels for each of the $M$ classes.
43
+
44
+ Meta-learning. A supervised meta-learning algorithm $\mathcal { M } ( \cdot )$ takes as input a set of supervised metatraining tasks $\{ \mathcal { T } _ { t } \}$ . It produces a learning procedure $\mathcal F ( \cdot )$ , which, in turn, ingests the supervised training data of a task to produce a classifier $f ( \cdot )$ . The goal of $\mathcal { M }$ is to learn $\mathcal { F }$ such that, when faced with a meta-test time task $\mathcal { T } _ { t ^ { \prime } }$ held-out from $\{ \mathcal { T } _ { t } \}$ , $\mathcal { F }$ can learn a $f _ { t ^ { \prime } }$ that accomplishes $\mathcal { T } _ { t ^ { \prime } }$ . At a high level, the quintessential meta-learning strategy is to have $\mathcal { M }$ iterate over $\{ \mathcal { T } _ { t } \}$ , cycling between applying the current form of $\mathcal { F } _ { t }$ on training data from $\mathcal { T } _ { t }$ to learn $f _ { t }$ , assessing its performance by calculating some meta-loss $\mathcal { L }$ on held-out data from the task, and optimizing $\mathcal { L }$ to improve the learning procedure.
45
+
46
+ We build upon two meta-learning algorithms: model agnostic meta-learning (MAML) (Finn et al., 2017) and prototypical networks (ProtoNets) (Snell et al., 2017). MAML aims to learn the initial parameters of a deep network such that one or a few gradient steps leads to effective generalization; it specifies $\mathcal { F }$ as gradient descent starting from the meta-learned parameters. ProtoNets aim to metalearn a representation in which a class is effectively identified by its prototype, defined to be the mean of the class’ training examples in the meta-learned space; $\mathcal { F }$ is the computation of these class prototypes, and $f$ is a linear classifier that predicts the class whose prototype is closest in Euclidean distance to the query’s representation.
47
+
48
+ Task generation for meta-learning. We briefly summarize how tasks are typically generated from labeled datasets $\left\{ \left( \mathbf { x } _ { i } , \mathbf { y } _ { i } \right) \right\}$ for supervised meta-learning, as introduced by Santoro et al. (2016). For simplicity, consider the case where the labels are discrete scalar values $y _ { i }$ . To construct an $N$ -way classification task $\tau$ (assuming $N$ is not greater than the number of unique $y _ { i }$ ), we can sample $N$ classes, sample $R$ datapoints $\{ { \bf { x } } _ { r } \} _ { n }$ for each of the $N$ classes, and sample a permutation of $N$ distinct one-hot vectors $( \ell _ { n } )$ to serve as task-specific labels of the $N$ sampled classes. The task is then defined as $\mathcal { T } = \{ ( \mathbf { x } _ { n , r } , \ell _ { n } ) ~ | ~ \mathbf { x } _ { n , r } \in \{ \mathbf { x } _ { r } \} _ { n } \}$ . Of course, this procedure is only possible with labeled data; in the next section, we discuss how we can construct tasks without ground-truth labels.
49
+
50
+ # 2.3 UNSUPERVISED META-LEARNING WITH AUTOMATICALLY CONSTRUCTED TASKS
51
+
52
+ We approach our problem from a meta-learning perspective, framing the problem as the acquisition, from unlabeled data, of an efficient learning procedure that is transferable to human-designed tasks. In particular, we aim to construct classification tasks from the unlabeled data and then learn how to efficiently learn these tasks. If such tasks are adequately diverse and structured, then metalearning these tasks should enable fast learning of new, human-provided tasks. A key question, then, is how to automatically construct such tasks from unlabeled data $\mathcal { D } = \left\{ \mathbf { x } _ { i } \right\}$ . Notice that in the supervised meta-learning task generation procedure detailed in Section 2.2, the labels $y _ { i }$ induce a partition $\mathcal { P } = \{ \mathcal { C } _ { c } \}$ over $\{ { \bf { x } } _ { i } \}$ by assigning all datapoints with label $y _ { c }$ to subset $\mathcal { C } _ { c }$ . Once a partition is obtained, task generation is simple; we can reduce the problem of constructing tasks to that of constructing a partition over $\{ { \bf { x } } _ { i } \}$ . All that’s left is to find a principled alternative to human labels for defining the partition.
53
+
54
+ A na¨ıve approach is to randomly partition the data $\mathcal { D }$ . While such a scheme introduces diverse tasks, there is no structure; that is, there is no consistency between a task’s training data and query data, and hence nothing to be learned during each task, let alone across tasks. As seen in Table 3, providing a meta-learner with purely random tasks results in failed meta-learning.
55
+
56
+ To construct tasks with structure that resembles that of human-specified labels, we need to group datapoints into consistent and distinct subsets based on salient features. With this motivation in mind, we propose to use $k$ -means clustering. Consider the partition $\mathcal { P } = \{ \mathcal { C } _ { c } \}$ learned by $k$ -means as a simplification of a Gaussian mixture model $p ( \mathbf { x } | c ) p ( \bar { c } )$ . If the clusters can recover a semblance of the true class-conditional generative distributions $p ( \mathbf { x } | c )$ , creating tasks based on treating these clusters as classes should result in useful unsupervised meta-training. However, the result of $k$ -means is critically dependent on the metric space on which its objective is defined. Clustering in pixel-space is unappealing for two reasons: (1) distance in pixel-space correlates poorly with semantic meaning, and (2) the high dimensionality of raw images renders clustering difficult in practice. We empirically show in Table 3 that meta-learning with tasks defined by pixel-space clusters, with preprocessing as directed by Coates & $\mathrm { N g }$ (2012), also fails.
57
+
58
+ We are now motivated to cluster in spaces in which common distance functions correlate to semantic meaning. However, we must satisfy the constraints of our problem statement in the process of learning such spaces. To these ends, we use state-of-the-art unsupervised learning methods to produce useful embedding spaces. For qualitative evidence in the unsupervised learning literature that such embedding spaces exhibit semantic meaning, see Cheung et al. (2015); Bojanowski & Joulin (2017); Donahue et al. (2017). We note that while a given embedding space may not be directly suitable for highly-efficient learning of new tasks (which would require the embedding space to be precisely aligned or adaptable to the classes of those tasks), we can still leverage it for the construction of structured tasks, a process for which requirements are less strict.
59
+
60
+ Thus, we first run an out-of-the-box unsupervised embedding learning algorithm $\mathcal { E }$ on $\mathcal { D }$ , then map the data $\{ { \bf { x } } _ { i } \}$ into the embedding space $\mathcal { Z }$ , producing $\left\{ \mathbf { z } _ { i } \right\}$ . To produce a diverse task set, we generate $P$ partitions $\{ \mathcal P _ { p } \}$ by running clustering $P$ times, applying random scaling to the dimensions of $\mathcal { Z }$ to induce a different metric, represented by diagonal matrix A, for each run of clustering. With $\pmb { \mu } _ { c }$ denoting the learned centroid of cluster $\mathcal { C } _ { c }$ , a single run of clustering can be summarized with
61
+
62
+ $$
63
+ \mathcal { P } , \{ \pmb { \mu } _ { c } \} = \underset { \{ \mathcal { C } _ { c } \} , \{ \pmb { \mu } _ { c } \} } { \arg \operatorname* { m i n } } \sum _ { c = 1 } ^ { k } \sum _ { \mathbf { z } \in \mathcal { C } _ { c } } \| \mathbf { z } - \pmb { \mu } _ { c } \| _ { \mathbf { A } } ^ { 2 }
64
+ $$
65
+
66
+ We derive tasks for meta-learning from the partitions using the procedure detailed in Section 2.2, except we begin the construction of each task by sampling a partition from the uniform distribution $\mathcal { U } ( \mathcal { P } )$ , and for ${ \bf x } _ { i } \in \mathcal { C } _ { c }$ , specify $y _ { i } = c$ . To avoid imbalanced clusters dominating the meta-training tasks, we opt not to sample from $p ( c ) \propto | \mathcal { C } _ { c } |$ , but instead sample $N$ clusters uniformly without replacement for each task. We note that Caron et al. (2018) are similarly motivated in their design decision of sampling data from a uniform distribution over clusters.
67
+
68
+ With the partitions being constructed over $\left\{ \mathbf { z } _ { i } \right\}$ , we have one more design decision to make: should we perform meta-learning on embeddings or images? We consider that, to successfully solve new tasks at meta-test time, a learning procedure $\mathcal { F }$ that takes embeddings as input would depend on the embedding function’s ability to generalize to out-of-distribution observations. On the other hand, by meta-learning on images, $\mathcal { F }$ can separately adapt $f$ to each evaluation task from the rawest level of representation. Thus, we choose to meta-learn on images.
69
+
70
+ We call our method clustering to automatically construct tasks for unsupervised meta-learning (CACTUs). We detail the task construction algorithm in Algorithm 1, and provide an illustration of the complete unsupervised meta-learning approach for classification in Figure 1.
71
+
72
+ # 3 RELATED WORK
73
+
74
+ The method we propose aims to address the unsupervised learning problem (Hastie et al., 2009; Le et al., 2013), namely acquiring a transferable learning procedure without labels. We show that our
75
+
76
+ # Algorithm 1 CACTUs for classification
77
+
78
+ <table><tr><td colspan="2">1: procedure CACTUs(ε,D,P,k,T,N,Km-tr, Q)</td><td colspan="4"></td></tr><tr><td>2:</td><td colspan="4">Run embedding learning algorithm ε on D and produce embeddings {zi} from observations {xi}.</td></tr><tr><td>3:</td><td colspan="4">Run k-means on {zi} P times (with random scaling) to generate a set of partitions {Pp = {Cc}p}.</td></tr><tr><td>4:</td><td colspan="4">for t from 1 to the number of desired tasks T do</td></tr><tr><td>5:</td><td colspan="4">Sample a partition P uniformly at random from the set of partitions {Pp}.</td></tr><tr><td>6:</td><td colspan="4">Sample a cluster Cn uniformly without replacement from P for each of the N classes desired for a task.</td></tr><tr><td>7:</td><td colspan="4">Sample an embedding Zr without replacement from Cn for each of the R= Km-tr+Q training and</td></tr><tr><td>8:</td><td colspan="4">query examples desired for each class, and record the corresponding datapoint Xn,r. Sample a permutation(ln) of N one-hot labels.</td></tr><tr><td>9:</td><td colspan="4">Construct Tt ={(xn,r,ln)}.</td></tr><tr><td>10:</td><td colspan="4">return {Tt}</td></tr></table>
79
+
80
+ method is complementary to a number of unsupervised learning methods, including ACAI (Berthelot et al., 2018), BiGAN (Donahue et al., 2017; Dumoulin et al., 2017), DeepCluster (Caron et al., 2018), and InfoGAN (Chen et al., 2016): we leverage these prior methods to learn embeddings used for constructing meta-learning tasks, and demonstrate that our method learns a more useful representation than the embeddings. The ability to use what was learned during unsupervised pretraining to better or more efficiently learn a variety of downstream tasks is arguably one of the most practical applications of unsupervised learning methods, which has a long history in neural network training (Hinton et al., 2006; Bengio et al., 2007; Ranzato et al., 2006; Vincent et al., 2008; Erhan et al., 2010). Unsupervised pre-training has demonstrated success in a number of domains, including speech recognition (Yu et al., 2010), image classification (Zhang et al., 2017), machine translation (Ramachandran et al., 2017), and text classification (Dai & Le, 2015; Howard & Ruder, 2018; Radford et al., 2018). Our approach, unsupervised meta-learning, can be viewed as an unsupervised learning algorithm that explicitly optimizes for few-shot transferability. As a result, we can expect it to better learn human-specified downstream tasks, compared to unsupervised learning methods that optimize for other metrics, such as reconstruction (Vincent et al., 2010; Higgins et al., 2017), fidelity of constructed images (Radford et al., 2016; Salimans et al., 2016; Donahue et al., 2017; Dumoulin et al., 2017), representation interpolation (Berthelot et al., 2018), disentanglement (Bengio et al., 2013; Reed et al., 2014; Cheung et al., 2015; Chen et al., 2016; Mathieu et al., 2016; Denton & Birodkar, 2017), and clustering (Coates & Ng, 2012; Krahenb ¨ uhl et al., 2016; Bojanowski & Joulin, ¨ 2017; Caron et al., 2018). We empirically evaluate this hypothesis in the next section. In contrast to many previous evaluations of unsupervised pre-training, we focus on settings in which only a small amount of data for the downstream tasks is available, since this is where the unlabeled data can be maximally useful.
81
+
82
+ Unsupervised pre-training followed by supervised learning can be viewed as a special case of the semi-supervised learning problem (Zhu, 2011; Kingma et al., 2014; Rasmus et al., 2015; Oliver et al., 2018). However, in contrast to our problem statement, semi-supervised learning methods assume that a significant proportion of the unlabeled data, if not all of it, shares underlying labels with the labeled data. Additionally, our approach and other unsupervised learning methods are wellsuited for transferring their learned representation to many possible downstream tasks or labelings, whereas semi-supervised learning methods typically optimize for performance on a single task, with respect to a single labeling of the data.
83
+
84
+ Our method builds upon the ideas of meta-learning (Schmidhuber, 1987; Bengio et al., 1991; Naik & Mammone, 1992) and few-shot learning (Santoro et al., 2016; Vinyals et al., 2016; Ravi & Larochelle, 2017; Munkhdalai & Yu, 2017; Snell et al., 2017). We apply two meta-learning algorithms, model-agnostic meta-learning (Finn et al., 2017) and prototypical networks (Snell et al., 2017), to tasks constructed in an unsupervised manner. Similar to our problem setting, some prior works have aimed to learn an unsupervised learning procedure with supervised data (Garg & Kalai, 2017; Metz et al., 2018). Instead, we consider a problem setting that is entirely unsupervised, aiming to learn efficient learning algorithms using unlabeled datasets. Our problem setting is similar to that considered by Gupta et al. (2018), but we develop an approach that is suitable for supervised downstream tasks, rather than reinforcement learning problems, and demonstrate our algorithm on problems with high-dimensional visual observations.
85
+
86
+ # 4 EXPERIMENTS
87
+
88
+ We begin the experimental section by presenting our research questions and how our experiments are designed to address them. Links to code for the experiments can be found at https://sites. google.com/view/unsupervised-via-meta.
89
+
90
+ Benefit of meta-learning. Is there any significant benefit to doing meta-learning on tasks derived from embeddings, or is the embedding function already sufficient for downstream supervised learning of new tasks? To investigate this, we run MAML and ProtoNets on tasks generated via CACTUs (CACTUs-MAML, CACTUs-ProtoNets). We compare to five alternate algorithms, with four being supervised learning methods on top of the embedding function. i) Embedding $k _ { \mathrm { n n } }$ -nearest neighbors first infers the embeddings of the downstream task images. For a query test image, it predicts the plurality vote of the labels of the $k _ { \mathrm { n n } }$ training images that are closest in the embedding space to the query’s embedding. ii) Embedding linear classifier also begins by inferring the embeddings of the downstream task images. It then fits a linear classifier using the $N K$ training embeddings and labels, and predicts labels for the query embeddings using the classifier. iii) Embedding multilayer perceptron instead uses a network with one hidden layer of 128 units and tuned dropout (Srivastava et al., 2014). iv) To isolate the effect of meta-learning on images, we also compare to embedding cluster matching, i.e. directly using the meta-training clusters for classification by labeling clusters with a task’s training data via plurality vote. If a query datapoint maps to an unlabeled cluster, the closest labeled cluster is used. v) As a baseline, we forgo any unsupervised pre-training and train a model with the MAML architecture from standard random network initialization via gradient descent separately for each evaluation task.
91
+
92
+ Different embedding spaces. Does CACTUs result in successful meta-learning for many distinct task-generating embeddings? To investigate this, we run unsupervised meta-learning using four embedding learning algorithms: ACAI (Berthelot et al., 2018), BiGAN (Donahue et al., 2017), DeepCluster (Caron et al., 2018), and InfoGAN (Chen et al., 2016). These four approaches collectively cover the following range of objectives and frameworks in the unsupervised learning literature: generative modeling, two-player games, reconstruction, representation interpolation, discriminative clustering, and information maximization. We describe these methods in more detail in Appendix A.
93
+
94
+ Applicability to different tasks. Can unsupervised meta-learning yield a good prior for a variety of task types? In other words, can unsupervised meta-learning yield a good representation for tasks that assess the ability to distinguish between features on different scales, or tasks with various amounts of supervision signal? To investigate this, we evaluate our procedure on tasks assessing recognition of character identity, object identity, and facial attributes. For this purpose we choose to use the existing Omniglot (Santoro et al., 2016) and miniImageNet (Ravi & Larochelle, 2017) datasets and few-shot classification tasks and, inspired by Finn et al. (2018), also construct a new few-shot classification benchmark based on the CelebA dataset and its binary attribute annotations. For miniImageNet, we consider both few-shot downstream tasks and tasks involving larger datasets (up to 50-shot). Specifics on the datasets and human-designed tasks are presented in Appendix B.
95
+
96
+ Oracle. How does the performance of our unsupervised meta-learning method compare to supervised meta-learning with a human-specified, near-optimal task distribution derived from a labeled dataset? To investigate this, we use labeled versions of the meta-training datasets to run MAML and ProtoNets as supervised meta-learning algorithms (Oracle-MAML, Oracle-ProtoNets). To facilitate fair comparison with the unsupervised variants, we control for the relevant hyperparameters.
97
+
98
+ Task construction ablation. How do the alternatives for constructing tasks from the embeddings compare? To investigate this, we run MAML on tasks constructed via clustering (CACTUs-MAML) and MAML on tasks constructed via random hyperplane slices of the embedding space with varying margin (Hyperplanes-MAML). The latter partitioning procedure is detailed in Appendix C. For the experiments where tasks are constructed via clustering, we also investigate the effect of sampling based on a single partition versus multiple partitions. We additionally experiment with tasks based on random assignments of images to “clusters” (Random-MAML) and tasks based on pixel-space clusters (Pixels CACTUs-MAML) with the Omniglot dataset.
99
+
100
+ To investigate the limitations of our method, we also consider an easier version of our problem statement where the data distributions at meta-training and meta-test time perfectly overlap, i.e. the images share a common set of underlying labels (Appendix D). Finally, we present results on miniImageNet after unsupervised meta-learning on most of ILSVRC 2012 (Appendix G).
101
+
102
+ ![](images/da015e73e499847b381f6ba35cc8ae17e2cc6b8b08026a9f2a626ccbe7e0ef3c.jpg)
103
+ Figure 2: Examples of three DeepCluster-embedding cluster-based classes (a) and a 2-way 5-shot test task (b) for two datasets. (a) Some of the clusters correspond well to unseen labels (top left, bottom left). Others exhibit semantic meaning despite members not being grouped as such in the labeled version of the dataset (top middle: pair of objects, bottom middle: white hat). Still others are uninterpretable (top right) or are based on image artifacts (bottom right). (b) We evaluate unsupervised pre-training based on the ability to learn downstream, human-designed tasks with held-out images and underlying classes.
104
+
105
+ # 4.1 EXPERIMENTAL PROTOCOL SUMMARY
106
+
107
+ As discussed by Oliver et al. (2018), keeping proper experimental protocol is particularly important when evaluating unsupervised and semi-supervised learning algorithms. Our foremost concern is to avoid falsely embellishing the capabilities of our approach by overfitting to the specific datasets and task types that we consider. To this end, we adhere to two key principles. We do not perform any architecture engineering: we use architectures from prior work as-is, or lightly adapt them to our needs if necessary. We also keep hyperparameters related to the unsupervised meta-learning stage as constant as possible across all experiments, including the MAML and ProtoNets model architectures. Details on hyperparameters and architectures are presented in Appendix E. We assume knowledge of an upper bound on the number of classes $N$ present in each downstream meta-testing task for each dataset. However, regardless of the number of shots $K$ , we do not assume knowledge of $K$ during unsupervised meta-learning. We use $N$ -way 1-shot tasks during meta-training, but test on larger values of $K$ during meta-testing.
108
+
109
+ We partition each dataset into meta-training, meta-validation, and meta-testing splits. For Omniglot and miniImageNet, these splits contain disjoint sets of classes. For all algorithms, we run unsupervised pre-training on the unlabeled meta-training split and report performance on downstream tasks dictated by the labeled data of the meta-testing split, generated using the procedure from prior work recounted in Section 2.2. For the supervised meta-learning oracles, meta-training tasks are constructed in the same manner but from the dataset’s meta-training split. See Figure 2 for illustrative examples of embedding-derived clusters and human-designed test tasks.
110
+
111
+ To facilitate analysis on meta-overfitting, we use the labels of the meta-validation split (instead of clustering embeddings) to construct tasks for meta-validation. However, because our aim is to perform meta-learning without supervision, we do not tune hyperparameters on this labeled data. We use a fixed number of meta-training iterations, since there is no suitable criterion for early stopping.
112
+
113
+ When we experiment with the embedding-plus-supervised-learning methods used as fair comparisons to unsupervised meta-learning, we err on the side of providing more supervision and data than technically allowed. Specifically, we separately tune the supervised learning hyperparameters for each dataset and each task difficulty on the labeled version of the meta-validation split. With DeepCluster embeddings, we also use the entire meta-testing split’s statistics to perform dimensionality reduction (via PCA) and whitening, which is unfair as this shares information across tasks.
114
+
115
+ # 4.2 RESULTS
116
+
117
+ Our primary results are summarized in Tables 1 and 2. Task construction ablations are summarized in Tables 3 and 4.
118
+
119
+ Benefit of meta-learning. CACTUs-MAML consistently yields a learning procedure that results in more successful downstream task performance than all other unsupervised methods, including those that learn on top of the embedding that generated meta-training tasks for MAML. We find the same result for CACTUs-ProtoNets for 1-shot downstream tasks. However, as noted by Snell et al. (2017), ProtoNets perform best when meta-training shot and meta-testing shot are matched; this characteristic prevents ProtoNets from improving upon ACAI for 20-way 5-shot Omniglot and upon DeepCluster for 50-shot miniImageNet. We attribute the success of CACTUs-based meta-learning over the embedding-based methods to two factors: its practice in distinguishing between many distinct sets of clusters from modest amounts of signal, and the underlying classes of the meta-testing split data being out-of-distribution. In principle, the latter factor is solely responsible for the success over embedding cluster matching, since this algorithm can be viewed as a meta-learner on embeddings that trivially obtains perfect accuracy (via memorization) on the meta-training tasks. The same factor also helps explain why training from standard network initialization is, in general, competitive with directly using the task-generating embedding as a representation. On the other hand, the MNIST results (Table 7 in Appendix F) suggest that when the meta-training and meta-testing data distributions have perfect overlap and the embedding is well-suited enough that embedding cluster matching can already achieve high performance, CACTUs-MAML yields only a small benefit, as we would expect.
120
+
121
+ Table 1: Results of unsupervised learning on Omniglot images, averaged over 1000 downstream character recognition tasks. CACTUs experiments use $k = 5 0 0$ clusters for each of $P = 1 0 0$ partitions. Embedding cluster matching uses the same $k$ . For complete results with confidence intervals, see Table 8 in Appendix F.
122
+
123
+ <table><tr><td>Algorithm</td><td>(way, shot)</td><td>(5,1)</td><td>(5,5)</td><td>(20,1)</td><td>(20,5)</td></tr><tr><td>Training from scratch</td><td>52.50%</td><td></td><td>74.78%</td><td>24.91%</td><td>47.62%</td></tr><tr><td>ACAI knn-nearest neighbors</td><td></td><td>57.46%</td><td>81.16%</td><td>39.73%</td><td>66.38%</td></tr><tr><td>ACAIlinear classifier</td><td></td><td>61.08%</td><td>81.82%</td><td>43.20%</td><td>66.33%</td></tr><tr><td>ACAI MLP with dropout</td><td></td><td>51.95%</td><td>77.20%</td><td>30.65%</td><td>58.62%</td></tr><tr><td>ACAI cluster matching</td><td></td><td>54.94%</td><td>71.09%</td><td>32.19%</td><td>45.93%</td></tr><tr><td>ACAI CACTUs-MAML (ours)</td><td>68.84%</td><td></td><td>87.78%</td><td>48.09%</td><td>73.36%</td></tr><tr><td>ACAI CACTUs-ProtoNets (ours)</td><td>68.12%</td><td></td><td>83.58%</td><td>47.75%</td><td>66.27%</td></tr><tr><td>BiGAN knn-nearest neighbors</td><td>49.55%</td><td></td><td>68.06%</td><td>27.37%</td><td>46.70%</td></tr><tr><td>BiGAN linearclassifier</td><td>48.28%</td><td></td><td>68.72%</td><td>27.80%</td><td>45.82%</td></tr><tr><td>BiGAN MLP with dropout</td><td>40.54%</td><td></td><td>62.56%</td><td>19.92%</td><td>40.71%</td></tr><tr><td>BiGAN cluster matching</td><td>43.96%</td><td></td><td>58.62%</td><td>21.54%</td><td>31.06%</td></tr><tr><td>BiGAN CACTUs-MAML (ours)</td><td>58.18%</td><td></td><td>78.66%</td><td>35.56%</td><td>58.62%</td></tr><tr><td>BiGAN CACTUs-ProtoNets (ours)</td><td>54.74%</td><td></td><td>71.69%</td><td>33.40%</td><td>50.62%</td></tr><tr><td>Oracle-MAML (control)</td><td>94.46%</td><td></td><td>98.83%</td><td>84.60%</td><td>96.29%</td></tr><tr><td>Oracle-ProtoNets (control)</td><td>98.35%</td><td></td><td>99.58%</td><td>95.31%</td><td>98.81%</td></tr></table>
124
+
125
+ Different embedding spaces. CACTUs is effective for a variety of embedding learning methods used for task generation. The performance of unsupervised meta-learning can largely be predicted by the performance of the embedding-based non-meta-learning methods. For example, the ACAI embedding does well with Omniglot, leading to the best unsupervised results with ACAI CACTUsMAML. Likewise, on miniImageNet, the best performing prior embedding (DeepCluster) also corresponds to the best performing unsupervised meta-learner (DeepCluster CACTUs-MAML).
126
+
127
+ Applicability to different tasks. CACTUs-MAML learns an effective prior for a variety of task types. This can be attributed to the application-agnostic task-generation process and the expressive power of MAML (Finn & Levine, 2018). We also observe that, despite all meta-learning models being trained for $N$ -way 1-shot classification of unsupervised tasks, the models work well for a variety of $M$ -way $K$ -shot tasks, where $M \ \leq \ N$ and $K \ \leq \ 5 0$ . As mentioned previously, the representation that CACTUs-ProtoNets learns is best suited for downstream tasks which match the single shot used for meta-training.
128
+
129
+ Oracle. The penalty for not having ground truth labels to construct near-optimal tasks ranges from substantial to severe, depending on the difficulty of the downstream task. Easier downstream tasks (which have fewer classes and/or more supervision) incur less of a penalty. We conjecture that with such tasks, the difference in the usefulness of the priors matters less since the downstream task-specific evidence has more power to shape the posterior.
130
+
131
+ Table 2: Results of unsupervised learning on miniImageNet and CelebA images, averaged over 1000 downstream human-designed tasks. CACTUs experiments use $k = 5 0 0$ for each of $P = 5 0$ partitions. Embedding cluster matching uses the same $k$ . For complete results with confidence intervals, see Tables 9 and 10 in Appendix F.
132
+
133
+ <table><tr><td></td><td colspan="4">miniImageNet</td><td>CelebA</td></tr><tr><td></td><td>(5,1)</td><td>(5,5)</td><td>(5,20)</td><td>(5,50)</td><td>(2,5)</td></tr><tr><td>Training from scratch</td><td>27.59%</td><td>38.48%</td><td>51.53%</td><td>59.63%</td><td>63.19%</td></tr><tr><td>BiGAN knn-nearest neighbors</td><td>25.56%</td><td>31.10%</td><td>37.31%</td><td>43.60%</td><td>56.15%</td></tr><tr><td>BiGAN linear classifier</td><td>27.08%</td><td>33.91%</td><td>44.00%</td><td>50.41%</td><td>58.44%</td></tr><tr><td>BiGAN MLP with dropout</td><td>22.91%</td><td>29.06%</td><td>40.06%</td><td>48.36%</td><td>56.26%</td></tr><tr><td>BiGAN cluster matching</td><td>24.63%</td><td>29.49%</td><td>33.89%</td><td>36.13%</td><td>56.20%</td></tr><tr><td>BiGAN CACTUs-MAML (ours)</td><td>36.24%</td><td>51.28%</td><td>61.33%</td><td>66.91%</td><td>74.98%</td></tr><tr><td>BiGAN CACTUs-ProtoNets (ours)</td><td>36.62%</td><td>50.16%</td><td>59.56%</td><td>63.27%</td><td>65.58%</td></tr><tr><td>DeepCluster knn-nearest neighbors</td><td>28.90%</td><td>42.25%</td><td>56.44%</td><td>63.90%</td><td>61.47%</td></tr><tr><td>DeepCluster linear classifier</td><td>29.44%</td><td>39.79%</td><td>56.19%</td><td>65.28%</td><td>59.57%</td></tr><tr><td>DeepCluster MLP with dropout</td><td>29.03%</td><td>39.67%</td><td>52.71%</td><td>60.95%</td><td>60.65%</td></tr><tr><td>DeepCluster cluster matching</td><td>22.20%</td><td>23.50%</td><td>24.97%</td><td>26.87%</td><td>51.51%</td></tr><tr><td>DeepCluster CACTUs-MAML (ours)</td><td>39.90%</td><td>53.97%</td><td>63.84%</td><td>69.64%</td><td>73.79%</td></tr><tr><td>DeepCluster CACTUs-ProtoNets (ours)</td><td>39.18%</td><td>53.36%</td><td>61.54%</td><td>63.55%</td><td>74.15%</td></tr><tr><td>Oracle-MAML (control)</td><td>46.81%</td><td>62.13%</td><td>71.03%</td><td>75.54%</td><td>87.10%</td></tr><tr><td>Oracle-ProtoNets (control)</td><td>46.56%</td><td>62.29%</td><td>70.05%</td><td>72.04%</td><td>85.13%</td></tr></table>
134
+
135
+ Task construction ablation. As seen in Tables 3 and 4, CACTUs-MAML consistently outperforms Hyperplanes-MAML with any margin. We hypothesize that this is due to the issues with zero-margin Hyperplanes-MAML pointed out in Appendix C, and the fact that nonzero-margin HyperplanesMAML is able to use less of the meta-training split to generate tasks than CACTUs-MAML is. We find that using multiple partitions for CACTUs-MAML, while beneficial, is not strictly necessary. Using non-zero margin with Hyperplanes-MAML is crucial for miniImageNet, but not for Omniglot. We conjecture that the enforced degree of separation between classes is needed for miniImageNet because of the dataset’s high diversity. Meta-learning on random tasks or tasks derived from pixel-space clustering (Table 3) results in a prior that is much less useful than any other considered algorithm, including a random network initialization; evidently, practicing badly is worse than not practicing at all.
136
+
137
+ Note on overfitting. Because of the combinatorially many unsupervised tasks we can create from multiple partitions of the dataset, we do not observe substantial overfitting to the unsupervised metatraining tasks. However, we observe that meta-training performance is sometimes worse than metatest time performance, which is likely due to a portion of the automatically generated tasks being based on nonsensical clusters (for examples, see Figure 2). Additionally, we find that, with a few exceptions, using multiple partitions has a regularizing effect on the meta-learner: a diverse task set reduces overfitting to the meta-training tasks and increases the applicability of the learned prior.
138
+
139
+ Table 3: Ablation study of task construction methods on Omniglot. For a more complete set of results with confidence intervals, see Table 8 in Appendix F.
140
+
141
+ <table><tr><td>Algorithm</td><td>(5,1)</td><td>(5,5)</td><td>(20,1)</td><td>(20,5)</td></tr><tr><td>Random-MAML,P= 2400,k = 500</td><td>25.99%</td><td>25.74%</td><td>6.51%</td><td>6.74%</td></tr><tr><td>Pixels CACTUs-MAML,P=1, k = 500</td><td>30.55%</td><td>40.19%</td><td>12.05%</td><td>19.01%</td></tr><tr><td>ACAIHyperplanes-MAML,P= 2400,m= 0</td><td>62.34%</td><td>81.81%</td><td>39.30%</td><td>63.18%</td></tr><tr><td>ACAI Hyperplanes-MAML,P= 2400,m =1.2</td><td>62.44%</td><td>83.20%</td><td>41.86%</td><td>65.23%</td></tr><tr><td>ACAI CACTUs-MAML,P=1,k = 500</td><td>66.49%</td><td>85.60%</td><td>45.04%</td><td>69.14%</td></tr><tr><td>ACAICACTUs-MAML,P=100,k = 500</td><td>68.84%</td><td>87.78%</td><td>48.09%</td><td>73.36%</td></tr><tr><td>BiGANHyperplanes-MAML,P= 2400,m = 0</td><td>53.60%</td><td>74.60%</td><td>29.02%</td><td>50.77%</td></tr><tr><td>BiGANHyperplanes-MAML,P= 2400,m = 0.5</td><td>53.18%</td><td>73.55%</td><td>29.98%</td><td>50.14%</td></tr><tr><td>BiGANCACTUs-MAML,P=1,k= 500</td><td>55.92%</td><td>76.28%</td><td>32.44%</td><td>54.22%</td></tr><tr><td>BiGANCACTUs-MAML,P=100,k= 500</td><td>58.18%</td><td>78.66%</td><td>35.56%</td><td>58.62%</td></tr></table>
142
+
143
+ Table 4: Ablation study of task construction methods on miniImageNet. For a more complete set of results with confidence intervals, see Table 9 in Appendix F.
144
+
145
+ <table><tr><td>Algorithm</td><td>(5,1)</td><td>(5,5)</td><td>(5,20)</td><td>(5,50)</td></tr><tr><td>BiGANHyperplanes-MAML,P= 4800,m =0</td><td>20.00%</td><td>20.00%</td><td>20.00%</td><td>20.00%</td></tr><tr><td>BiGAN Hyperplanes-MAML,P= 4800,m = 0.9</td><td>29.67%</td><td>41.92%</td><td>51.32%</td><td>54.72%</td></tr><tr><td>BiGAN CACTUs-MAML,P=1,k= 500</td><td>37.75%</td><td>52.59%</td><td>62.70%</td><td>67.98%</td></tr><tr><td>BiGANCACTUs-MAML,P= 50,k= 500</td><td>36.24%</td><td>51.28%</td><td>61.33%</td><td>66.91%</td></tr><tr><td>DeepCluster Hyperplanes-MAML,P= 4800,m = 0</td><td>20.02%</td><td>20.01%</td><td>20.00%</td><td>20.01%</td></tr><tr><td>DeepClusterHyperplanes-MAML,P= 4800,m= 0.1</td><td>35.85%</td><td>49.54%</td><td>60.68%</td><td>65.55%</td></tr><tr><td>DeepCluster CACTUs-MAML,P= 1,k = 500</td><td>38.75%</td><td>52.73%</td><td>62.72%</td><td>67.77%</td></tr><tr><td>DeepCluster CACTUs-MAML,P= 50,k = 500</td><td>39.90%</td><td>53.97%</td><td>63.84%</td><td>69.64%</td></tr></table>
146
+
147
+ # 5 DISCUSSION
148
+
149
+ We demonstrate that meta-learning on tasks produced using simple mechanisms based on embeddings improves upon the utility of these representations in learning downstream, human-specified tasks. We empirically show that this holds across benchmark datasets and tasks in the few-shot classification literature (Santoro et al., 2016; Ravi & Larochelle, 2017; Finn et al., 2018), task difficulties, and embedding learning methods while fixing key hyperparameters across all experiments.
150
+
151
+ In a sense, CACTUs can be seen as a facilitating interface between an embedding learning method and a meta-learning algorithm. As shown in the results, the meta-learner’s performance significantly depends on the nature and quality of the task-generating embeddings. We can expect our method to yield better performance as the methods that produce these embedding functions improve, becoming better suited for generating diverse yet distinctive clusterings of the data. However, the gap between unsupervised and supervised meta-learning will likely persist because, with the latter, the meta-training task distribution is human-designed to mimic the expected evaluation task distribution as much as possible. Indeed, to some extent, supervised meta-learning algorithms offload the effort of designing and tuning algorithms onto the effort of designing and tuning task distributions. With its evaluation-agnostic task generation, CACTUs-based meta-learning trades off performance in specific use-cases for broad applicability and the ability to train on unlabeled data. In principle, CACTUs-based meta-learning may outperform supervised meta-learning when the latter is trained on a misaligned task distribution. We leave this investigation to future work.
152
+
153
+ While we have demonstrated that $k$ -means is a broadly useful mechanism for constructing tasks from embeddings, it is unlikely that combinations of $k$ -means clusters in learned embedding spaces are universal approximations of arbitrary class definitions. An important direction for future work is to find examples of datasets and human-designed tasks for which CACTUs-based meta-learning results in ineffective downstream learning. This will result in better understanding of the practical scope of applicability for our method, and spur further development in automatic task construction mechanisms for unsupervised meta-learning.
154
+
155
+ A potential concern of our experimental evaluation is that MNIST, Omniglot, and miniImageNet exhibit particular structure in the underlying class distribution (i.e., perfectly balanced classes), since they were designed to be supervised learning benchmarks. In more practical applications of machine learning, such structure would likely not exist. Our CelebA results indicate that CACTUs is effective even in the case of a dataset without neatly balanced classes or attributes. An interesting direction for future work is to better characterize the performance of CACTUs and other unsupervised pretraining methods with highly-unstructured, unlabeled datasets.
156
+
157
+ Since MAML and ProtoNets produce nothing more than a learned representation, our method can be viewed as deriving, from a previous unsupervised representation, a new representation particularly suited for learning downstream tasks. Beyond visual classification tasks, the notion of using unsupervised pre-training is generally applicable to a wide range of domains, including regression, speech (Oord et al., 2018), language (Howard & Ruder, 2018), and reinforcement learning (Shelhamer et al., 2017). Hence, our unsupervised meta-learning approach has the potential to improve unsupervised representations for a variety of such domains, an exciting avenue for future work.
158
+
159
+ # ACKNOWLEDGMENTS
160
+
161
+ We thank Kelvin Xu, Richard Zhang, Brian Cheung, Ben Poole, Aaron van den Oord, Luke Metz, ¨ Siddharth Reddy, and the anonymous reviewers for feedback on an early draft of this paper.
162
+
163
+ # REFERENCES
164
+
165
+ Yoshua Bengio, Samy Bengio, and Jocelyn Cloutier. Learning a synaptic learning rule. In International Joint Conference on Neural Networks (IJCNN), 1991.
166
+
167
+ Yoshua Bengio, Pascal Lamblin, Dan Popovici, and Hugo Larochelle. Greedy layer-wise training of deep networks. In Advances in Neural Information Processing Systems (NIPS), 2007.
168
+
169
+ Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 2013.
170
+
171
+ David Berthelot, Colin Raffel, Aurko Roy, and Ian Goodfellow. Understanding and improving interpolation in autoencoders via an adversarial regularizer. arXiv preprint arXiv:1807.07543, 2018.
172
+
173
+ Piotr Bojanowski and Armand Joulin. Unsupervised learning by predicting noise. In International Conference on Machine Learning (ICML), 2017.
174
+
175
+ Mathilde Caron, Piotr Bojanowski, Armand Joulin, and Matthijs Douze. Deep clustering for unsupervised learning of visual features. In European Conference on Computer Vision (ECCV), 2018.
176
+
177
+ Xi Chen, Yan Duan, Rein Houthooft, John Schulman, Ilya Sutskever, and Pieter Abbeel. InfoGAN: Interpretable representation learning by information maximizing generative adversarial nets. In Neural Information Processing Systems (NIPS), 2016.
178
+
179
+ Brian Cheung, Jesse A Livezey, Arjun K Bansal, and Bruno A Olshausen. Discovering hidden factors of variation in deep networks. In International Conference on Learning Representations (ICLR), 2015.
180
+
181
+ Adam Coates and Andrew Y Ng. Learning feature representations with k-means. In Neural Networks: Tricks of the Trade. Springer, 2012.
182
+
183
+ Andrew M Dai and Quoc V Le. Semi-supervised sequence learning. In Neural Information Processing Systems (NIPS), 2015.
184
+
185
+ Emily L Denton and Vighnesh Birodkar. Unsupervised learning of disentangled representations from video. In Neural Information Processing Systems (NIPS), 2017.
186
+
187
+ Jeff Donahue, Philipp Krahenb ¨ uhl, and Trevor Darrell. Adversarial feature learning. In ¨ International Conference on Learning Representations (ICLR), 2017.
188
+
189
+ Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Olivier Mastropietro, Alex Lamb, Martin Arjovsky, and Aaron Courville. Adversarially learned inference. In International Conference on Learning Representations (ICLR), 2017.
190
+
191
+ Dumitru Erhan, Yoshua Bengio, Aaron Courville, Pierre-Antoine Manzagol, Pascal Vincent, and Samy Bengio. Why does unsupervised pre-training help deep learning? Journal of Machine Learning Research (JMLR), 2010.
192
+
193
+ Chelsea Finn and Sergey Levine. Meta-learning and universality: Deep representations and gradient descent can approximate any learning algorithm. In International Conference on Learning Representations (ICLR), 2018.
194
+
195
+ Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning (ICML), 2017.
196
+
197
+ Chelsea Finn, Kelvin Xu, and Sergey Levine. Probabilistic model-agnostic meta-learning. In Neural Information Processing Systems (NIPS), 2018.
198
+
199
+ Vikas K Garg and Adam Kalai. Supervising unsupervised learning. arXiv preprint arXiv:1709.05262, 2017.
200
+
201
+ Abhishek Gupta, Benjamin Eysenbach, Chelsea Finn, and Sergey Levine. Unsupervised metalearning for reinforcement learning. arXiv preprint arXiv:1806.04640, 2018.
202
+
203
+ Trevor Hastie, Robert Tibshirani, and Jerome Friedman. Unsupervised learning. In The Elements of Statistical Learning. Springer, 2009.
204
+
205
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. European Conference on Computer Vision (ECCV), 2016.
206
+
207
+ 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 (ICLR), 2017.
208
+
209
+ Geoffrey E Hinton, Simon Osindero, and Yee-Whye Teh. A fast learning algorithm for deep belief nets. Neural Computation, 2006.
210
+
211
+ Jeremy Howard and Sebastian Ruder. Universal language model fine-tuning for text classification. In Association for Computational Linguistics (ACL), 2018.
212
+
213
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International Conference on Machine Learning (ICML), 2015.
214
+
215
+ Jaehong Kim, Sangyeul Lee, Sungwan Kim, Moonsu Cha, Jung Kwon Lee, Youngduck Choi, Yongseok Choi, Dong-Yeon Cho, and Jiwon Kim. Auto-Meta: Automated gradient based meta learner search. arXiv preprint arXiv:1806.06927, 2018.
216
+
217
+ Diederik Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of the 3rd International Conference on Learning Representations (ICLR), 2014.
218
+
219
+ Diederik P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In Neural Information Processing Systems (NIPS), 2014.
220
+
221
+ Philipp Krahenb ¨ uhl, Carl Doersch, Jeff Donahue, and Trevor Darrell. Data-dependent initializa- ¨ tions of convolutional neural networks. In International Conference on Learning Representations (ICLR), 2016.
222
+
223
+ Quoc V Le, Marc’Aurelio Ranzato, Rajat Monga, Matthieu Devin, Gregory S. Corrado, Kai Chen, Jeffrey Dean, and Andrew Y Ng. Building high-level features using large scale unsupervised learning. In International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2013.
224
+
225
+ Michael F Mathieu, Junbo Jake Zhao, Junbo Zhao, Aditya Ramesh, Pablo Sprechmann, and Yann LeCun. Disentangling factors of variation in deep representation using adversarial training. In Neural Information Processing Systems (NIPS), 2016.
226
+
227
+ Luke Metz, Niru Maheswaranathan, Brian Cheung, and Jascha Sohl-Dickstein. Learning to learn without labels. In International Conference on Learning Representations (ICLR), 2018.
228
+
229
+ Tsendsuren Munkhdalai and Hong Yu. Meta networks. In International Conference on Machine Learning (ICML), 2017.
230
+
231
+ Devang K Naik and RJ Mammone. Meta-neural networks that learn by learning. In International Joint Conference on Neural Networks (IJCNN), 1992.
232
+
233
+ Avital Oliver, Augustus Odena, Colin Raffel, Ekin D Cubuk, and Ian J Goodfellow. Realistic evaluation of deep semi-supervised learning algorithms. In International Conference on Learning Representations (ICLR), 2018.
234
+
235
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
236
+
237
+ Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In International Conference on Learning Representations (ICLR), 2016.
238
+
239
+ Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. Preprint, 2018.
240
+
241
+ Prajit Ramachandran, Peter J Liu, and Quoc V Le. Unsupervised pretraining for sequence to sequence learning. In Empirical Methods in Natural Language Processing (EMNLP), 2017.
242
+
243
+ Marc’Aurelio Ranzato, Christopher Poultney, Sumit Chopra, and Yann LeCun. Efficient learning of sparse representations with an energy-based model. In Neural Information Processing Systems (NIPS), 2006.
244
+
245
+ Antti Rasmus, Mathias Berglund, Mikko Honkala, Harri Valpola, and Tapani Raiko. Semisupervised learning with ladder networks. In Neural Information Processing Systems (NIPS), 2015.
246
+
247
+ Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In International Conference on Learning Representations (ICLR), 2017.
248
+
249
+ Scott Reed, Kihyuk Sohn, Yuting Zhang, and Honglak Lee. Learning to disentangle factors of variation with manifold interaction. In International Conference on Machine Learning (ICML), 2014.
250
+
251
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Fei-Fei Li. ImageNet large scale visual recognition challenge. International Journal of Computer Vision (IJCV), 2015.
252
+
253
+ Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training GANs. In Neural Information Processing Systems (NIPS), 2016.
254
+
255
+ Adam Santoro, Sergey Bartunov, Matthew Botvinick, Daan Wierstra, and Timothy Lillicrap. Metalearning with memory-augmented neural networks. In International Conference on Machine Learning (ICML), 2016.
256
+
257
+ Jurgen Schmidhuber. ¨ Evolutionary principles in self-referential learning. PhD thesis, Institut fur¨ Informatik, Technische Universitat M¨ unchen, 1987.¨
258
+
259
+ Evan Shelhamer, Parsa Mahmoudieh, Max Argus, and Trevor Darrell. Loss is its own reward: Selfsupervision for reinforcement learning. In International Conference on Learning Representations (ICLR), 2017.
260
+
261
+ Jake Snell, Kevin Swersky, and Richard S Zemel. Prototypical networks for few-shot learning. In Neural Information Processing Systems (NIPS), 2017.
262
+
263
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research (JMLR), 2014.
264
+
265
+ Pascal Vincent, Hugo Larochelle, Yoshua Bengio, and Pierre-Antoine Manzagol. Extracting and composing robust features with denoising autoencoders. In International Conference on Machine Learning (ICML), 2008.
266
+
267
+ Pascal Vincent, Hugo Larochelle, Isabelle Lajoie, Yoshua Bengio, and Pierre-Antoine Manzagol. Stacked denoising autoencoders: Learning useful representations in a deep network with a local denoising criterion. Journal of Machine Learning Research (JMLR), 2010.
268
+
269
+ Oriol Vinyals, Charles Blundell, Timothy Lillicrap, Koray Kavukcuoglu, and Daan Wierstra. Matching networks for one shot learning. In Neural Information Processing Systems (NIPS), 2016.
270
+
271
+ Dong Yu, Li Deng, and George Dahl. Roles of pre-training and fine-tuning in context-dependent DBN-HMMs for real-world speech recognition. In NIPS Workshop on Deep Learning and Unsupervised Feature Learning, 2010.
272
+
273
+ Richard Zhang, Phillip Isola, and Alexei A Efros. Split-brain autoencoders: Unsupervised learning by cross-channel prediction. In Computer Vision and Pattern Recognition (CVPR), 2017.
274
+
275
+ Xiaojin Zhu. Semi-supervised learning. In Encyclopedia of Machine Learning. Springer, 2011.
276
+
277
+ # APPENDIX A THE EMBEDDING LEARNING ZOO
278
+
279
+ We evaluate four distinct methods from prior work for learning the task-generating embeddings.
280
+
281
+ In adversarially constrained autoencoder interpolation (ACAI), a convolutional autoencoder’s pixelwise $L ^ { 2 }$ loss is regularized with a term encouraging meaningful interpolations in the latent space (Berthelot et al., 2018). Specifically, a critic network takes as input a synthetic image generated from a convex combination of the latents of two dataset samples, and regresses to the mixing factor. The decoder of the autoencoder and the generator for the critic are one and the same. The regularization term is minimized when the autoencoder fools the critic into predicting that the synthetic image is a real sample.
282
+
283
+ The bidirectional GAN (BiGAN) is an instance of a generative-adversarial framework in which the generator produces both synthetic image and embedding from real embedding and image, respectively (Donahue et al., 2017; Dumoulin et al., 2017). Discrimination is done in joint imageembedding space.
284
+
285
+ The DeepCluster method does discriminative clustering by alternating between clustering the features of a convolutional neural network and using the clusters as labels to optimize the network weights via backpropagating a standard classification loss (Caron et al., 2018).
286
+
287
+ The InfoGAN framework conceptually decomposes the generator’s input into a latent code and incompressible noise (Chen et al., 2016). The structure of the latent code is hand-specified based on knowledge of the dataset. The canonical GAN minimax objective is regularized with a mutual information term between the code and the generated image. In practice, this term is optimized using variational inference, involving the approximation of the posterior with an auxiliary distribution $Q$ (code|image) parameterized by a recognition network.
288
+
289
+ Whereas ACAI explicitly optimizes pixel-wise reconstruction error, BiGAN only encourages the fidelity of generated image and latent samples with respect to their respective prior distributions. While InfoGAN also encourages the fidelity of generated images, it leverages domain-specific knowledge to impose a favorable structure on the embedding space and information-theoretic methods for optimization. DeepCluster departs from the aforementioned methods in that it is not concerned with generation or decoding, and only seeks to learn general-purpose visual features by way of end-to-end discriminative clustering.
290
+
291
+ # APPENDIX B DATASET INFORMATION
292
+
293
+ The Omniglot dataset consists of 1623 characters each with 20 hand-drawn examples. Ignoring the alphabets from which the characters originate, we use 1100, 100, and 423 characters for our meta-training, meta-validation, and meta-testing splits. The miniImageNet dataset consists of 100 classes each with 600 examples. The images are predominantly natural and realistic. We use the same meta-training/meta-validation/meta-testing splits of 64/16/20 classes as proposed by Ravi & Larochelle (2017). The CelebA dataset includes 202,599 facial images of celebrities and 40 binary attributes that annotate every image. We follow the prescribed 162,770/19,867/19,962 data split.
294
+
295
+ For Omniglot and miniImageNet, supervised meta-learning tasks and evaluation tasks are constructed exactly as detailed in Section 2.2: for an $N$ -way $K$ -shot task with $Q$ queries per class, we sample $N$ classes from the data split and $K + Q$ datapoints per class, labeling the task’s data with a random permutation of $N$ one-hot vectors.
296
+
297
+ For CelebA, we consider binary classification tasks (i.e., 2-way), each defined by 3 attributes and an ordering of 3 Booleans, one for each attribute. Every image in a task-specific class shares all task-specific attributes with each other and none with images in the other class. For example, the task illustrated in Figure 2 involves distinguishing between images whose subjects satisfy not Sideburns, Straight Hair, and not Young, and those whose subjects satisfy Sideburns, not Straight Hair, and Young. To keep with the idea of having distinct classes for meta-training and meta-testing, we split the task-defining attributes. For the supervised meta-learning oracle, we construct meta-training tasks from the first 20 attributes (when alphabetically ordered), meta-validation tasks from the next 10, and meta-testing tasks from the last 10. Discarding tasks with too few examples in either class, this results in 4287, 391, and 402 task prototypes (but many more possible tasks). We use the same meta-test time tasks to evaluate the unsupervised methods. We only consider assessment with 5-shot tasks because, given that there are multiple attributes other than the task-defining ones, any 1-shot task is likely to be ill-defined.
298
+
299
+ # APPENDIX C TASK CONSTRUCTION VIA RANDOM HYPERPLANES
300
+
301
+ Given a set of embedding points $\left\{ \mathbf { z } _ { i } \right\}$ in a space $\mathcal { Z }$ , a simple way of defining a partition $\mathcal { P } = \{ \mathcal { C } _ { c } \}$ on $\left\{ \mathbf { z } _ { i } \right\}$ is to use random hyperplanes to slice $\mathcal { Z }$ into subspaces and assign the embeddings that lie in the $c$ -th subspace to subset $\mathcal { C } _ { c }$ . However, a hyperplane slicing can group together two arbitrarily far embeddings, or separate two arbitrarily close ones; given our assumption that good embedding spaces have a semantically meaningful metric, this creates ill-defined classes. This problem can be partially alleviated by extending the hyperplane boundaries with a non-zero margin, as empirically shown in Section 4.2.
302
+
303
+ We now describe how to generate tasks via random hyperplanes in the embedding space. We first describe a procedure to generate a partition $\mathcal { P }$ of the set of embeddings $\left\{ \mathbf { z } _ { i } \right\}$ for constructing metatraining tasks. A given hyperplane slices the embedding space into two, so for an $N$ -way task, we need $\bar { H } = \lceil \log _ { 2 } \bar { N } \rceil$ hyperplanes to define sufficiently many subsets/classes for a task. To randomly define a hyperplane in $d$ -dimensional embedding space, we sample a normal vector $\mathbf { n }$ and a point on the plane $\mathbf { z } _ { 0 }$ , each with $d$ elements. For an embedding point $\mathbf { z }$ , the signed point-plane distance is given by $\frac { \mathbf { n } } { \left| \mathbf { n } \right| _ { 2 } } \cdot \left( \mathbf { z } - \mathbf { z } _ { 0 } \right)$ . Defining $H$ hyperplanes in this manner, we discard embeddings for which the signed point-plane distance to any of the $H$ hyperplanes lies within $( - m , m )$ , where $m$ is a desired margin. The $H$ hyperplanes collectively define $\mathbf { \bar { 2 } } ^ { H }$ subspaces. We assign embedding points in the $c$ -th subspace to subset $\mathcal { C } _ { c }$ . We define the partition as $\mathcal { P } = \{ \mathcal { C } _ { c } \}$ . We prune subsets that do not have at least $R = K _ { \mathrm { m - t r } } + Q$ members, and check that the partition has at least $N$ remaining subsets; if not, we reject the partition and restart the procedure. After obtaining partitions $\{ \mathcal P _ { p } \}$ , meta-training tasks can be generated by following Algorithm 1 from Line 4.
304
+
305
+ In terms of practical implementation, we pre-compute 1000 hyperplanes and pruned pairs of subsets of $\left\{ \mathbf { z } _ { i } \right\}$ . We generate partitions by sampling combinations of the hyperplanes and taking intersections of their associated subsets to define the elements of the partition. We determine the number of partitions needed for a given Hyperplanes-MAML run by the number of meta-training tasks desired for the meta-learner: we fix 100 tasks per partition.
306
+
307
+ # APPENDIX D MNIST EXPERIMENTS
308
+
309
+ The MNIST dataset consists of 70,000 hand-drawn examples of the 10 numerical digits. Our split respects the original MNIST 60,000/10,000 training/testing split. We assess on 10-way classification tasks. This setup results in examples from all 10 digits being present for both meta-training and meta-testing, making the probem setting essentially equivalent to that of semi-supervised learning sans a fixed permutation of the labels. The MNIST scenario is thus a special case of the problem setting considered in the rest of the paper. For MNIST, we only experiment with MAML as the meta-learning algorithm.
310
+
311
+ For ACAI and InfoGAN we constructed the meta-validation split from the last 5,000 examples of the meta-training split; for BiGAN this figure was 10,000. After training the ACAI model and inferring embeddings, manually assigning labels to 10 clusters by inspection results in a classification accuracy of $9 6 . 0 0 \%$ on the testing split. As the ACAI authors observe, we found it important to whiten the ACAI embeddings before clustering. The same metric for the InfoGAN embedding (taking an argmax over the categorical dimensions instead of actually running clustering) is $9 6 . 8 3 \%$ . Note that these results are an upper-bound for embedding cluster matching. To see this, consider the 10-way 1-shot scenario. 1 example sampled from each cluster is insufficient to guarantee the optimal label for that cluster; 1 example sampled from each label is not guaranteed to each end up in the optimal category.
312
+
313
+ Aside from CACTUs-MAML, embedding $k _ { \mathrm { n n } }$ -nearest neighbors, embedding linear classifier, and embedding direct clustering, we also ran CACTUs-MAML on embeddings instead of raw images, using a simple model with 2 hidden layers with 64 units each and ReLU activation, and all other MAML hyperparameters being the same as in Table 5.
314
+
315
+ Departing from the fixed $k = 5 0 0$ used for all other datasets, we deliberately use $k = 1 0$ to better understand the limitations of CACTUs-MAML. The results can be seen in Table 7 in Appendix B. In brief, with the better embeddings (ACAI and InfoGAN), there is only little benefit of CACTUsMAML over embedding cluster matching. Additionally, even in the best cases, CACTUs-MAML falls short of state-of-the-art semi-supervised learning methods.
316
+
317
+ # APPENDIX E HYPERPARAMETERS AND ARCHITECTURES
318
+
319
+ # E.1 MAML
320
+
321
+ Table 5: MAML hyperparameter summary.
322
+
323
+ <table><tr><td>Hyperparameter</td><td>MNIST</td><td>Omniglot</td><td>miniImageNet</td><td>CelebA</td></tr><tr><td>Input size</td><td>28×28</td><td>28×28</td><td>84 ×84×3</td><td>84 ×84×3</td></tr><tr><td>Outer (meta) learning rate</td><td>0.001</td><td>0.001</td><td>0.001</td><td>0.001</td></tr><tr><td>Inner learning rate</td><td>0.05</td><td>0.05</td><td>0.05</td><td>0.05</td></tr><tr><td>Task batch size</td><td>8</td><td>8</td><td>8</td><td>8</td></tr><tr><td>Inner adaptation steps (meta-training)</td><td>5</td><td></td><td>5</td><td>5</td></tr><tr><td>Meta-training iterations</td><td>30,000</td><td>5 30,000</td><td>60,000</td><td>60,000</td></tr><tr><td>Adaptation steps (evaluation)</td><td>50</td><td>50</td><td>50</td><td>50</td></tr><tr><td>Classes per task (meta-training)</td><td>10</td><td>20</td><td>5</td><td>2</td></tr><tr><td>Shots per class (meta-training)</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>Queries per class</td><td>5</td><td>5</td><td>5</td><td>5</td></tr></table>
324
+
325
+ For MNIST and Omniglot we use the same 4-block convolutional architecture as used by Finn et al. (2017) for their Omniglot experiments, but with 32 filters (instead of 64) for each convolutional layer for consistency with the model used for miniImageNet and CelebA, which is the same as what Finn et al. (2017) used for their miniImageNet experiments. When evaluating the meta-learned 20-way Omniglot model with 5-way tasks, we prune the unused output dimensions. The outer optimizer is Adam (Kingma & Ba, 2014), and the inner optimizer is SGD. We build on the authors’ publicly available codebase found at https://github.com/cbfinn/maml.
326
+
327
+ When using batch normalization (Ioffe & Szegedy, 2015) to process a task’s training or query inputs, we observe that using only 1 query datapoint per class can allow the model to exploit batch statistics, learning a strategy analogous to a process of elimination that causes significant, but spurious, improvement in accuracy. To mitigate this, we fix 5 queries per class for every task’s evaluation phase, meta-training or meta-testing.
328
+
329
+ # E.2 PROTONETS
330
+
331
+ Table 6: ProtoNets hyperparameter summary.
332
+
333
+ <table><tr><td>Hyperparameter</td><td>Omniglot</td><td>miniImageNet</td><td>CelebA</td></tr><tr><td>Input size</td><td>28×28</td><td>84×84×3</td><td>84×84×3</td></tr><tr><td>Learning rate</td><td>0.001</td><td>0.001</td><td>0.001</td></tr><tr><td>Task batch size</td><td>1</td><td>1</td><td>1</td></tr><tr><td>Training iterations</td><td>30,000</td><td>60,000</td><td>60,000</td></tr><tr><td>Classes per task (meta-training)</td><td>20</td><td>5</td><td>2</td></tr><tr><td>Shots per class (meta-training)</td><td>1</td><td>1</td><td>1</td></tr><tr><td>Queries per class (meta-training/meta-testing)</td><td>15/5</td><td>15/5</td><td>15/5</td></tr></table>
334
+
335
+ For the three considered datasets we use the same architecture as used by Snell et al. (2017) for their Omniglot and miniImageNet experiments. This is a 4-block convolutional architecture with each block consisting of a convolutional layer with $6 4 \ 3 \times 3$ filters, stride 1, and padding 1, followed by BatchNorm, ReLU activation, and $2 \times 2$ MaxPooling. The ProtoNets embedding is simply the flattened output of the last block. We follow the authors and use the Adam optimizer, but do not use a learning rate scheduler. We build upon the authors’ publicly available codebase found at https://github.com/jakesnell/prototypical-networks.
336
+
337
+ # E.3 CACTUS
338
+
339
+ For Omniglot, miniImageNet, and CelebA we fix the number of clusters $k$ to be 500. For Omniglot we choose the number of partitions $P = 1 0 0$ , but in the interest of keeping runtime manageable, choose $P = 5 0$ for miniImageNet and CelebA.
340
+
341
+ # E.4 USE OF UNSUPERVISED LEARNING METHODS
342
+
343
+ ACAI (Berthelot et al., 2018): We run ACAI for MNIST and Omniglot. We pad the images by 2 and use the authors’ architecture. We use a 256-dimensional embedding for all datasets. We build upon the authors’ publicly available codebase found at https://github.com/ brain-research/acai.
344
+
345
+ We unsuccessfully try running ACAI on $6 4 \times 6 4$ miniImageNet and CelebA. To facilitate this input size, we add one block consisting of two convolutional layers (512 filters each) and one downsampling/upsampling layer to the encoder and decoder. However, because of ACAI’s pixel-wise reconstruction loss, for these datasets the ACAI embedding prioritizes information about the few “features” that dominate the reconstruction pixel count, resulting in clusters that only corresponded to a limited range of factors, such as background color and pose. For curiosity’s sake, we tried running meta-learning on tasks derived from these uninteresting clusters anyways, and found that the meta-learner quickly produced a learning procedure that obtained high accuracy on the meta-training tasks. However, this learned prior was not useful for solving downstream tasks.
346
+
347
+ BiGAN (Donahue et al., 2017): For MNIST, we follow the BiGAN authors and specify a uniform 50-dimensional prior on the unit hypercube for the latent. The BiGAN authors use a 200- dimensional version of the same prior for their ImageNet experiments, so we follow suit for Omniglot, miniImageNet, and CelebA. For MNIST and Omniglot, we use the permutation-invariant architecture (i.e. fully connected layers only) used by the authors for their MNIST results; for miniImageNet and CelebA, we randomly crop to $6 4 \times 6 4$ and use the AlexNet-inspired architecture used by Donahue et al. (2017) for their ImageNet results. We build upon the authors’ publicly available codebase found at https://github.com/jeffdonahue/bigan.
348
+
349
+ DeepCluster (Caron et al., 2018): We run DeepCluster for miniImageNet and CelebA, which we respectively randomly crop and resize to $6 4 \times 6 4$ . We modify the first layer of the AlexNet architecture used by the authors to accommodate this input size. We follow the authors and use the input to the (linear) output layer as the embedding. These are 4096-dimensional, so we follow the authors and apply PCA to reduce the dimensionality to 256, followed by whitening. We build upon the authors’ publicly available codebase found at https://github.com/facebookresearch/ deepcluster.
350
+
351
+ InfoGAN (Chen et al., 2016): We only run InfoGAN for MNIST. We follow the InfoGAN authors and specify the product of a 10-way categorical distribution and a 2-dimensional uniform distribution as the latent code. We use the authors’ architecture. Given an image, we use the recognition network to obtain its embedding. We build upon the authors’ publicly available codebase found at https: //github.com/openai/InfoGAN.
352
+
353
+ # APPENDIX F EXPERIMENTAL RESULTS
354
+
355
+ This section containsfull experimental results for the MNIST, Omniglot, miniImageNet, and CelebA datasets, including consolidated versions of the tables found in the main text. The metric is classification accuracy averaged over 1000 tasks based on human-specified labels of the testing split, with $9 5 \%$ confidence intervals. $d$ : dimensionality of embedding, $h$ : number of hidden units in a fully connected layer, $k$ : number of clusters in a partition, $P$ : number of partitions used during meta-learning, $m$ : margin on boundary-defining hyperplanes.
356
+
357
+ <table><tr><td rowspan=1 colspan=1>(0101)</td><td rowspan=4 colspan=1>% LI&#x27;0干06&#x27;16% 01.0581555% 71&#x27;0 干 10&#x27;96% 710 67&#x27;96% II&#x27;0干08&#x27;96% L70干08&#x27;88% 11011.55% 910 76.56% 71&#x27;0干80&#x27;96% 110 干 9596% 780 6444% 18031.95% 7109 8535% 40.0 99.56% 870 LL&#x27;46C[ = y[= T (sani) sSuiPPq Tt Tr-shyt[ = y[ = T (sA) P T T-SAT r rrrrret gaasetr Srrpeirrlrer iaerrertrrnrrltgFaraeregarrgrrirrettA4=P444</td><td rowspan=2 colspan=1>% 0509 86:10% 1£&#x27;0干0L09%50055672% 67089&#x27;89% 0000658% 104530% 01004535% 44061.44% 141 65:14%70015:35%03.0335.55% 0ε0干 S0&#x27;LL% 51081:14%41044:44</td><td rowspan=1 colspan=1>% 700 47.99% 11&#x27;0干 58&#x27;96% 01&#x27;0干 66&#x27;96% 010 干 87&#x27; L6% 600 干13&#x27; L6% 01756% 010 6</td><td rowspan=1 colspan=1>% L0&#x27;0 干 1S&#x27;86</td></tr><tr><td rowspan=2 colspan=1>(s01)</td><td rowspan=2 colspan=1>% LI&#x27;0干 S0&#x27;96% 170干19&#x27;96% 110T 6696% 010干8126% 010776% 010干£1L6% 010干 80&#x27;L6</td><td rowspan=2 colspan=1>% L00干1S&#x27;86</td></tr><tr><td rowspan=1 colspan=1>% 44061.44% 141 65:14%70015:35%03.0335.55% 0ε0干 S0&#x27;LL% 51081:14%41044:44</td></tr><tr><td rowspan=1 colspan=1>(101)(tous em)1oila</td><td rowspan=1 colspan=1>%230325:65% 680 F980%57025224%944144% 14011.64%85033335% 3:271:31[[ = y O = T‘(sIni) suipP-qs u Tr-t[ = y = (sani) supPqa uu Trn-st[[ = y OII = T (I1I) SSA- V T-NC[ = yI=T sa -T=grrrraree geasepr rripegahrlerserrerarrnriirenggareregaerrriipetP=P-14</td><td rowspan=1 colspan=1>% 155311:55% 7408126% 31.074.16%050333:5% 610干80&#x27;96% LI0干 6996% L10 干8596C = y[= T(sa) supq c -[[ = y O = T‘(sni) sYuiPPqs uu Tr-sntC = y O = T () P 1 TI-sC=y[= T(I)A T T-sAg rrirpre aaetr rrirearrger serrerarrnriirertggaraerrarrrriiiertt=p 4</td><td rowspan=1 colspan=1>% L1&#x27;0干Iε&#x27;L6Surreend pasiersnnGOLnaier Giii-larei</td></tr></table>
358
+
359
+ ers per convolutional layer, 3×data augmentation, and folded the validation set
360
+
361
+
362
+ <table><tr><td rowspan=7 colspan=1>(s 0)(107)(s‘s)(1‘s)(ous em)oiiral</td><td rowspan=7 colspan=1>% 944% 810 449% 67&#x27;0干 10&#x27;61% 110013.55% 810 11&#x27;9%1102555% 6908&#x27;44% 690441% 1∠&#x27;06100%20035174% 32056577%33357530PPT =γ[= TIIII-SALAI SI11.1ay = y = 111A1--4111rres ionnaieraBeesees</td><td rowspan=4 colspan=1>% 90.038399% 33.333339% 350 79:11 %80085.8 % 990 41.69 % 1333 3334% L00干 L7&#x27;996%83033139% 670227/4%3330730 % 30033331% 8109835% 4404 44.14 % 1 1124</td><td rowspan=1 colspan=1>% 90001.95% 2102 78.14% 401141% L£&#x27;0干90% 6£&#x27;0干 LL&#x27;0 %37:227755% 8057788</td><td rowspan=1 colspan=2>% 0105 6796% L0&#x27;0干18&#x27;86</td></tr><tr><td rowspan=1 colspan=1>% 90001.95% 2102 78.14% 401141% L£&#x27;0干90% 6£&#x27;0干 LL&#x27;0 %37:227755% 8057788% 30:0377.3050</td><td rowspan=2 colspan=2>% 0105 6796% L0&#x27;0干18&#x27;86% 700339:55% 810533.55</td></tr><tr><td rowspan=2 colspan=1>%11033135% 190 08:27% 770955.66%71224115% 210370.65% 200586.655210224555%335395559% 33033151</td></tr><tr><td></td><td rowspan=1 colspan=1>土+</td></tr><tr><td rowspan=3 colspan=1>% LS0干9118%8107818%S9007&#x27;LL% LL&#x27;0干60&#x27;IL% 09&#x27;0干18&#x27;18%8703355% 353355.55% 0S&#x27;0 干8L&#x27;L8% 3903 8138% 1113 1511% 711 819% 7.0 16:14 %7.055 % 08&#x27;0 干 64&#x27;99 % 480 71896260 = = () T- CCT = y TT=1 (In) s11T1II-SSCC = γ OII = 1 ‘(S.I1I) T1I1-SALOCY =γ[=T (SIAI) TIII-SAI8 = Y inodop p PT SuippggregreemysppegarierereereirrA44=P4444</td><td rowspan=1 colspan=1></td><td></td></tr><tr><td rowspan=1 colspan=1>% I∠&#x27;0干 90&#x27;89% 99&#x27;0 干7L&#x27;89% 6/0 9579%8/07985% 69&#x27;009&#x27;L% 6905555% 19085.94% S9&#x27;0 干99&#x27;8L% L0干69</td><td rowspan=2 colspan=2>% 710£8&#x27;86% 60&#x27;0干85&#x27;66% 11.03.9555% 773523:32Surureree peseeedn GDi Drirr eoeiiioriireri(OLDLier Girr-aarei</td></tr><tr><td rowspan=1 colspan=1>% 71 1171% 1742 1185% 6104544% 080 964% 5039.02 % 0807650% 18081&#x27;89% 71:044440 = O = P (I) T-sdHP&#x27; = = P(s) -s-L CC =y OII = 1 (SIAN) TSII-SA/S0C = y = (i) sTod-snt8 = Y inidoip pm d SuippqC =yI =1 (SIA) T-SAagrrpaee easeta Srrplgrhgier neeennr neipreggarerrgrereippegPP =P 4400</td></tr></table>
363
+
364
+ denotes a 95% confidence interval. d: dimensionality of embedding,
365
+
366
+ <table><tr><td rowspan=1 colspan=1>(0s&#x27;s)(2 &#x27;0)(s‘s)(1‘s)(ous Xem)Woirai</td><td rowspan=1 colspan=1>% 5/.05 39.61% 533112% 9908589% 67003735Yrirlrriiir reirraperreeees</td><td rowspan=1 colspan=1>% 230309.3% 31:15:11% 1/.0 91&#x27;81%55333.99% 00&#x27;0干00&#x27; % 89&#x27;0干 86&#x27;L% 89&#x27;0干 16&#x27;99% L9:0 17:99546%344231.21% 100404% 7/0 9000 %8900L&#x27;79%57003515% 5703.31%£9090:65%81096565% 0000000 %15457171% 850 87.15%05099511% 3513 95:75% 1 8 2 470036.74 %990干8000干(09.4士22.5519&#x27;6725&#x27;330 = w Xs = (s) Ti-H6&#x27;0 = 1 O = P (s) T--H CC1 = yO1= P (SIA4) PIII-SA/CT1 =yFT= (sT) s1TI-sg = Y iniip pi P grippC =y[=1 (SIA) TI-SAS =yrrrpaee gaisnpa Seippegger nsereny iprgasereresteippeggPP=P4440</td><td rowspan=1 colspan=1>% 8030639%5500854% £9&#x27;0干 56:09% 1555585% 70&#x27;0干I0% 99055% 79&#x27;0LL% £90干 5969% 553515:396566% 1440444.94%5506554 %41:045.44 % 0105809% 89045:1989&#x27;0921% 42:015%0706/:66 277333755 %1/044:64% 71172% 010 1690% 3303.73.51% 17:5--55.85%% %%119.03 30.67990干 5503066120.00555555830 = Os = P (sI1I) Tt--AdL1HT&#x27;0 = 1s= P sa) T-H C=yE1=PIA S-ACC = y I= P ((I) sTTd-SHg = Y iniip pi P grippaggC1 =yT=1A) T-SNarrpiereisepaSerpggrhler errrairrireigrrsesereesseippeggz =pashisea4</td><td rowspan=1 colspan=1>% 77:045:14% 09044% 69000.14% 590F 50.00% 7/0511.79% 1/0 6777% LL&#x27;0干 18&#x27;94% 9/0 95.94Surererrer lseeetdnnODTLr) Giii-rriOrnerer eeeinerrceeret</td></tr></table>
367
+
368
+ denotes a 95% confidence interval. d: dimensionality of embeddi
369
+
370
+ Table 10: CelebA facial attribute classification results averaged over 1000 tasks. $\pm$ denotes a $9 5 \%$ confidence interval. $d$ : dimensionality of embedding, $h$ : number of hidden units in a fully connected layer, $k$ : number of clusters in a partition, $P$ : number of partitions used during meta-learning.
371
+
372
+ <table><tr><td>Algorithm</td><td>(2,5)</td></tr><tr><td>Baselines Training from scratch</td><td>63.19 ± 1.06 %</td></tr><tr><td>BiGAN,d= 200</td><td></td></tr><tr><td>Embedding knn-nearest neighbors Embedding linearclassifier</td><td>56.15 ± 0.89 % 58.44 ± 0.90 %</td></tr><tr><td>Embedding MLP with dropout,h = 128</td><td>56.26 ± 0.94 %</td></tr><tr><td>Embedding cluster matching,k = 500</td><td>56.20 ±1.00 %</td></tr><tr><td>CACTUs-MAML(ours),P= 50,k= 500 CACTUs-ProtoNets (ours),P= 50,k = 500</td><td>74.98 ± 1.02 %</td></tr><tr><td></td><td>65.58 ± 1.04 %</td></tr><tr><td>DeepCluster,d= 256 Embedding knn-nearest neighbors</td><td></td></tr><tr><td>Embedding linear classifier</td><td>61.47 ± 0.99 % 59.57 ± 0.98 %</td></tr><tr><td>Embedding MLP with dropout,h = 128</td><td>60.65 ± 0.98 %</td></tr><tr><td>Embedding cluster matching,k = 500</td><td>51.51 ± 0.89 %</td></tr><tr><td>CACTUs-MAML (ours),P= 50,k = 500</td><td>73.79 ± 1.01 %</td></tr><tr><td>CACTUs-ProtoNets (ours),P= 50,k = 500</td><td>74.15 ± 1.02 %</td></tr><tr><td></td><td></td></tr><tr><td>Supervised meta-learning</td><td></td></tr><tr><td>Oracle-MAML (control)</td><td>87.10 ± 0.85 %</td></tr><tr><td></td><td></td></tr><tr><td>Oracle-ProtoNets (control)</td><td>85.13 ± 0.92 %</td></tr></table>
373
+
374
+ # APPENDIX G IMAGENET EXPERIMENTS
375
+
376
+ We investigate unsupervised meta-learning in the context of a larger unsupervised meta-training dataset by using the ILSVRC 2012 dataset’s training split (Russakovsky et al., 2015), which is a superset of the miniImageNet dataset (including meta-validation and meta-testing data) consisting of 1000 classes and over 1,200,000 images. To facilitate comparison to the previous miniImageNet experiments, for meta-validation and meta-test we use the miniImageNet meta-validation and metatest splits. To avoid task leakage, we hold out all data from these 36 underlying classes from the rest of the data to construct the meta-training split.
377
+
378
+ For CACTUs, we use the best-performing unsupervised learning method from the previous experiments, DeepCluster, to obtain the embeddings. Following Caron et al. (2018), we run DeepCluster using the VGG-16 architecture with a 256-dimensional feature space and 10,000 clusters on the meta-training data until the normalized mutual information between the data-cluster mappings of two consecutive epochs converges. To our knowledge, no prior works have yet been published on using MAML for ImageNet-sized meta-learning. We extend the standard convolutional neural network model class with residual connections (He et al., 2016), validate hyperparameters with supervised meta-learning, then use it for unsupervised meta-learning without further tuning. See Table 11 for MAML hyperparameters. The training from scratch, embedding $k _ { \mathrm { n n } }$ -nearest neighbors, and embedding linear classifier algorithms are the same as they were in the previous sets of experiments. For Oracle-MAML, we generated tasks using the ground-truth 964 ImageNet meta-training classes. We also run semi-supervised MAML, with the meta-training tasks consisting of CACTUs-based tasks as well as tasks constructed from the 64 miniImageNet meta-training classes. The unsupervised/supervised task proportion split was fixed according to the ratio of the number of data available to each task proposal method. As before, the meta-learning methods only meta-learned on 1-shot tasks.
379
+
380
+ Table 11: MAML hyperparameter summary for ImageNet.
381
+
382
+ <table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Input size</td><td>224× 224</td></tr><tr><td>Outer (meta) learning rate</td><td>0.0001</td></tr><tr><td>Inner learning rate</td><td>0.001</td></tr><tr><td>Task batch size</td><td>3</td></tr><tr><td>Inner adaptation steps (meta-training)</td><td>5</td></tr><tr><td>Meta-training iterations</td><td>240,000</td></tr><tr><td>Adaptation steps (evaluation)</td><td>100</td></tr><tr><td>Classes per task (meta-training)</td><td>5</td></tr><tr><td>Shots per class (meta-training)</td><td>1</td></tr><tr><td>Queries per class</td><td>5</td></tr><tr><td>Residual blocks</td><td>5</td></tr><tr><td>Layers per residual block</td><td>2</td></tr></table>
383
+
384
+ We find that the vastly increased amount of unlabeled meta-training data (in comparison to miniImageNet) results in significant increases for all methods over their counterparts in Table 9 (other than training from scratch, which does not use this data). We find that CACTUs-MAML slightly outperforms embedding linear classifier for the 1-shot test tasks, but that the linear classifier on top of the unsupervised embedding becomes better as the amount of test time supervision increases. Augmenting the unsupervised tasks with (a small number of) supervised tasks during meta-training results in slight improvement for the 1-shot test tasks. The lackluster performance of CACTUs-MAML is unsurprising insofar as meta-learning with large task spaces is still an open problem: higher shot Oracle-MAML only marginally stays ahead of the embedding linear classifier, which is not the case in the other, smaller-scale experiments. We expect that using a larger architecture in conjunction with MAML (such as Kim et al. (2018)) would result in increased performance for all methods based on MAML. Further, given the extensive degree to which unsupervised learning methods have been studied, we suspect that unsupervised task construction coupled with better meta-learning algorithms and architectures will result in improved performance on the entire unsupervised learning problem. We leave such investigation to future work.
385
+
386
+ denotes a 95% confidence interval. d: dimensionality of
387
+
388
+ <table><tr><td>(os&#x27;s) (07&#x27;s) (s‘s) (1‘s) (ous xem) 1loirrra</td><td>% LL0干 89&#x27;6S% SL0干 L9&#x27;εS % 3901/30% 11:059:85 Ppt =pessstsesg Yrrlrriiir liiiiera reneseg</td><td>% 41:0 4244 % L70 干 0106 % 3705 75.77 % 040 18.61 % 130 11:11 % 990F 5878 % 17034355 % 00 1064 % 1/0494 % I9&#x27;0 干 LI&#x27;01 % 7703181 % 4101109 [[V[ = γ[=1 ‘(SJ1) TII-SALO0 ohhgrer serrerarg nrippegg garreerrnrilpestg</td><td>% 190 L728 % 690£8&#x27;78 %0/0£494 % SL&#x27;0 干 SL&#x27;19 Sururersritu prseetdeesntts Jra psrsN-</td><td>% 1/0 £7&#x27;98 % L/071:4 Srinerniar peseadn DEDLLrr Tirr-larrt</td><td>% 990 干 90℃6% 69&#x27;0干4116</td></tr></table>
md/train/rHCzkRd0UK/rHCzkRd0UK.md ADDED
@@ -0,0 +1,489 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Linear-Time Gromov Wasserstein Distances using Low Rank Couplings and Costs
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ The ability to compare and align related datasets living in heterogeneous spaces plays an increasingly important role in machine learning. The Gromov-Wasserstein (GW) formalism can help tackle this problem. Its main goal is to seek an assignment (more generally a coupling matrix) that can register points across otherwise incomparable datasets. As a non-convex and quadratic generalization of optimal transport (OT), GW is NP-hard. Yet, heuristics are known to work reasonably well in practice, the state of the art approach being to solve a sequence of nested regularized OT problems. While popular, that heuristic remains too costly to scale, with cubic complexity in the number of samples $n$ . We show in this paper how a recent variant of the Sinkhorn algorithm can substantially speed up the resolution of GW. That variant restricts the set of admissible couplings to those admitting a low rank factorization as the product of two sub-couplings. By updating alternatively each sub-coupling, our algorithm computes a stationary point of the problem in quadratic time with respect to the number of samples. When cost matrices have themselves low rank, our algorithm has time complexity ${ \mathcal { O } } ( n )$ . We demonstrate the efficiency of our method on simulated and real data.
11
+
12
+ # 17 1 Introduction
13
+
14
+ 18 The ever increasing interest for Gromov-Wasserstein... Several problems in machine learning
15
+ 19 involve comparing families of points that live in heterogeneous spaces. This situation arises typically
16
+ 20 when realigning two distinct sets of feature representations obtained from the similar source. Recent
17
+ 21 applications to single-cell genomics [15] and NLP [12, 1] provide two cases in point: Thousands
18
+ 22 of cells taken from the same tissue are split in two groups, each group is processed with a different
19
+ 23 experimental protocol, resulting in two distinct sets of heterogeneous feature vectors; Thousands of
20
+ 24 word embeddings for two languages are learned independently. In both cases, one expects to find
21
+ 25 a meaningful way to register points across sets living in heteregeneous spaces, since they contain
22
+ 26 similar overall information. That realignment is usually carried out using the Gromov-Wasserstein
23
+ 27 (GW) machinery proposed by Mémoli [26] and Sturm [36], which seeks a relaxed assignment matrix
24
+ 28 that is as “close” to an isometry as possible, using a quadratic score to quantify that closeness. GW
25
+ 29 has a lot of practical appeal: It has been used in supervised learning [41], generative modeling [7],
26
+ 30 domain adaptation [9], structured prediction [37], quantum chemistry [27] and alignment layers [17].
27
+ 31 ... despite its cubic cost. Because it is an NP-hard problem, these applications rely on approximating
28
+ 32 GW, typically by solving a sequence of OT problems using entropic regularization. This heuristic is
29
+ 33 efficient yet costly, since it requires $\mathcal { O } ( n ^ { 3 } )$ operations to register two sets of $n$ samples, a price that is
30
+ 34 paid when re-instantiating each OT problem. Our goal is to reduce substantially that complexity by
31
+ 35 exploiting low-factorization of both parameters (data) and variable (relaxed assignment) matrices in
32
+ 36 the GW problem, while maintaining state of the art performance in applications.
33
+ 37 Wasserstein: from cubic to linear complexity. A comparatively simpler problem is the registration
34
+ 38 of two populations embedded in the same space. This corresponds to the classic optimal transport
35
+ 39 (OT) problem, which has received considerable attention in ML [28]. OT has found applications
36
+ 40 in computer vision [29], NLP [24], single cell tracking [33] or multi-task regression in neuro
37
+ 41 imaging [22]. While the OT problem is originally cast as a linear program, with a ${ \overline { { O ( n ^ { 3 } \log ( n ) } } } )$ cost,
38
+ 42 many of these works rely on solving instead a penalized OT problem using Sinkhorn’s algorithm [34,
39
+ 43 13]. In its most naive implementation, the Sinkhorn has quadratic complexity [2]. Recent works
40
+ 44 achieve $O ( n )$ complexity by targeting the matrix-vector updates in Sinkhorn’s algorithm using
41
+ 45 low-rank approximations of the data kernel matrix [4, 3, 31]. This idea can be further improved by
42
+ 46 imposing the low-rank constraint on the optimization variables of the original OT problem [19], to
43
+ 47 modify Sinkorn’s steps by enforcing a low rank factorization of the coupling variable [32].
44
+ 48 Gromov-Wasserstein: from NP-hard to linear approximations. The GW problem replaces
45
+ 49 the linear objective function in OT by a non-convex quadratic objective. Much like OT is a re
46
+ 50 laxation of the optimal assignment problem, GW can be seen as a relaxation of the quadratic
47
+ 51 assignment problem (QAP). Both GW and QAP are NP-hard to solve [8]. In practice, iteratively
48
+ 52 minimizing a linearization of that quadratic objective using Sinkhorn works surprisingly well [20, 35].
49
+ 53 This method corresponds to a mirror-descent scheme [27],
50
+ 54 and in the special case of Euclidean distance matrices, the
51
+ 55 loss is concave and it can be also interpreted as a bi-linear
52
+ 56 relaxation [23]. In the most general case, this results in an
53
+ 57 $O ( n ^ { 4 } )$ algorithm (the objective is a quadratic function of a
54
+ 58 $n \times n$ relaxed assignment matrix), that is reduced to $O ( n ^ { 3 } )$
55
+ 59 when using separable losses [27], a price that remains too
56
+ 60 high for several ML applications. It is possible to replace
57
+ 61 the GW distance by cheaper yet only distantly related prox
58
+ 62 ies, such as lower bounds based on OT [26] (see also [30])
59
+ 63 or sliced projections [38]. Whether GW can be efficiently
60
+ 64 sped up remains an open question. We propose in this
61
+ 65 work a novel approach that leverages, as done recently for
62
+ 66 OT, low-rank methods. A very recent line of works attacks
63
+ 67 this problem by quantizing first the two input spaces to
64
+ 68 solve a GW problem of reduced size, thus effectively pro
65
+ 69 ducing an ad-hoc low-rank coupling [11]. A nice feature
66
+ 70 of this approach is that it maintains the triangular inequal
67
+ 71 ity and provides a valid upper-bound on the GW distance.
68
+ 72 Related approaches which also approximate GW distance
69
+ 73 using clustering methods (possibly in a recursive way)
70
+ 74 are [6] and [40]. We take in this paper a direct approach:
71
+ 75 instead of separating clustering and GW resolution in 2
72
+ 76 independent steps, we propose do address them simulta
73
+ 77 neously: our method seeks the least-costly (in GW sense)
74
+ 78 coupling with a low rank constraint, as illustrated in Fig. 1.
75
+ 79 Contributions We introduce the low-rank-GW problem, by imposing a low rank constraint on
76
+ 80 feasible couplings. This method works hand-in-hand with entropic regularization and leads to a
77
+ 81 Sinkhorn-like algorithm. Because of its exclusive reliance on matrix-vector products, the method
78
+ 82 streams well on GPUs. This method can also leverage low-rank factorizations of the input data
79
+ 83 matrices to further reduce the complexity of each iteration to reach linear time. Numerical evaluations
80
+ 84 on simulated and real datasets show that this low-rank approximation maintains the favorable
81
+ 85 property of entropic-regularized GW (namely its ability to compute “good” local minima) for a linear
82
+ 86 computational price, thus paving the way for larger scale uses of GW in ML.
83
+
84
+ ![](images/75f07794a62ec3be032add0ebc59f95a5f74a2fe87bba8885a69e073ad67fc1a.jpg)
85
+ Figure 1: Top row: we compute the GW coupling between two curves in 2D and 3D, with $n = m = 1 0 0 0 0$ points. These points are endowed with the squared L2 distance. Bottom row: coupling obtained with the SoTA entropic approach [20, 27], compared with our linear method with rank $r = 1 0$ . See Appendix D.1 for more details.
86
+
87
+ # 87 2 Background on the Gromov-Wasserstein Framework
88
+
89
+ 88 Comparing measured metric spaces. Let $( \mathcal { X } , d _ { \mathcal { X } } )$ and $( \mathcal { V } , d _ { \mathcal { V } } )$ be two metric spaces, and $\mu$ and
90
+ 89 $\nu$ two discrete probability measures on $\mathcal { X }$ and $\mathcal { V }$ , respectively. We write $\textstyle \mu : = \sum _ { i = 1 } ^ { n } a _ { i } \delta _ { x _ { i } }$ and
91
+ 90 $\begin{array} { r } { \nu : = \sum _ { i = j } ^ { m } b _ { j } \delta _ { y _ { j } } } \end{array}$ where $n , m \geq 1 , a , b$ are two histograms in the probability simplicies $\Delta _ { n } , \Delta _ { m }$ of
92
+ 91 respective size $n$ and $m$ , and $( x _ { 1 } , \ldots , x _ { n } )$ , $\left( y _ { 1 } , \ldots , y _ { m } \right)$ are two families in $\mathcal { X }$ and $\mathcal { V }$ . For $q \geq 1$ ,
93
+ 92 let us also denote $A : = ( d _ { \mathcal { X } } ^ { q } ( x _ { i } , x _ { i ^ { \prime } } ) ) _ { 1 \leq i , i ^ { \prime } \leq n } \in \mathbb { R } ^ { n \times n }$ and $B : = ( d _ { \mathcal { V } } ^ { q } ( x _ { j } , x _ { j ^ { \prime } } ) ) _ { 1 \leq i , i ^ { \prime } \leq m } \in \mathbb { R } ^ { m \times m }$
94
+ 93 X Ytwo pairwise cost matrices between the points in the respective supports of $\mu$ and $\nu$ . The Gromov
95
+ 94 Wasserstein (GW) discrepancy between two discrete metric measure spaces $( \mu , d _ { \mathcal { X } } )$ and $( \nu , d _ { 3 } )$ is
96
+ 95 the solution of the following non-convex quadratic problem, instantiated here for simplicity as a
97
+ 96 function of $( a , A )$ and $( b , B )$ , which contain all the information that is needed:
98
+
99
+ $$
100
+ \mathbf { G } \mathbf { W } ( ( a , A ) , ( b , B ) ) = \operatorname* { m i n } _ { P \in \Pi _ { a , b } } \mathcal { E } _ { A , B } ( P ) , \mathrm { w h e r e ~ } \Pi _ { a , b } : = \{ P \in \mathbb { R } _ { + } ^ { n \times m } | P \mathbf { 1 } _ { m } = a , P ^ { T } \mathbf { 1 } _ { n } = b \} ,
101
+ $$
102
+
103
+ 97 and the energy $\mathcal { E } _ { A , B }$ is a quadratic function parameterized by a loss $L : \mathbb { R } \times \mathbb { R } \to \mathbb { R }$ :
104
+
105
+ $$
106
+ \mathcal { E } _ { A , B } ( P ) : = \sum _ { i , j , i ^ { \prime } , j ^ { \prime } } L ( A _ { i , i ^ { \prime } } , B _ { j , j ^ { \prime } } ) P _ { i , j } P _ { i ^ { \prime } , j ^ { \prime } } \ .
107
+ $$
108
+
109
+ 98 A typical choice of the loss is the $L ^ { p }$ distance $L ( a , b ) = | a - b | ^ { p }$ with $p \geq 1$ . In that case, [26]
110
+ 99 proves that $\mathrm { G W } ^ { 1 / p }$ defines a distance on the space of metric measure spaces quotiented by measure
111
+ 100 preserving isometries. When $p = 2$ , as we consider from now on, the GW objective can be evaluated
112
+ 101 efficiently using the marginal constraints imposed on $P$ , as follows [27]:
113
+
114
+ $$
115
+ \begin{array} { r } { \mathcal { E } _ { A , B } ( P ) = \langle A ^ { \odot 2 } a , a \rangle + \langle B ^ { \odot 2 } b , b \rangle - 2 \langle A P B , P \rangle . } \end{array}
116
+ $$
117
+
118
+ 02 Indeed, (3) can be computed efficiently in $\mathcal { O } ( n ^ { 2 } m + n m ^ { 2 } )$ operations, using only matrix/matrix multiplications, instead of the 103 $\mathcal { O } ( n ^ { 2 } m ^ { 2 } )$ complexity of the naive evaluation of (2).
119
+
120
+ 104 Entropic Gromov-Wasserstein. The original GW problem (1) can be regularized using an entropic
121
+ 105 term [20, 35, 27], leading to the following problem:
122
+
123
+ $$
124
+ \mathbf { G } \mathbf { W } _ { \varepsilon } ( ( a , A ) , ( b , B ) ) = \operatorname* { m i n } _ { P \in \Pi _ { a , b } } \mathcal { E } _ { A , B } ( P ) - \varepsilon H ( P ) ,
125
+ $$
126
+
127
+ 106 where $\begin{array} { r } { H ( P ) ~ : = ~ - \sum _ { i , j } P _ { i , j } ( \log ( P _ { i , j } ) ~ - ~ 1 ) } \end{array}$ is the entropy of $P$ . By applying a Mirror
128
+ 107 Descent (MD) scheme with respect to the KL divergence and by choosing the step-size to
129
+ 108 be $\gamma ~ = ~ 1 / \varepsilon$ , Peyré et al. [27] provide a simple algorithm which consists in solving a se
130
+ 109 quence of regularized OT problem as presented in Algorithm 1. Indeed, each KL pro
131
+ 110 jection in Algorithm 1 can be computed efficiently thanks to the Sinkhorn algorithm [13].
132
+ 112 Computational complexity. Given a cost matrix $C$ , the
133
+ 113 KL projection of $K _ { \varepsilon }$ onto the polytope $\textstyle \prod ( a , b )$ , where
134
+ 114 ${ \mathrm { K L } } ( { \bar { P } } , { \bar { Q } } ) = \langle P , \log ( P / Q ) - 1 \rangle$ , is carried out in the inner
135
+ 115 loop of Algo. 1 using the Sinkhorn algorithm, through
136
+ 116 matrix-vector products. This quadratic complexity (in
137
+ 117 red) is dominated by the cost of updating matrix $C$ at each
138
+ 118 iteration in Algorithm 1, which requires $\mathcal { O } ( n ^ { 2 } m + n m ^ { 2 } )$
139
+ 119 algebraic operations (cubic, in violet). As noted above,
140
+ 120 evaluating the objective $\mathcal { E } _ { A , B } ( \boldsymbol { P } )$ has the same order. In
141
+ 121 the following we show that by considering a low rank
142
+ 122 exact decomposition (or approximation) of the distance
143
+ 123 matrices, the cubic cost of reupdating $C$ and subsequently
144
+ 124 evaluating $\mathcal { E } _ { A , B }$ can be brought down to quadratic.
145
+
146
+ # Algorithm 1 Entropic-GW
147
+
148
+ # 25 3 Exploiting a Low-Rank Factorization for Cost Matrices
149
+
150
+ Exact factorization of cost matrices. In this section we consider the case where the cost matrices $A$ and $B$ admit a low-rank factorization. More precisely, we make the following assumption.
151
+
152
+ Assumption 1. Assume that $A$ and $B$ admit a low-rank factorization, that is there exists $A _ { 1 } , A _ { 2 } \in$ $\mathbb { R } ^ { n \times d }$ and $B _ { 1 } , B _ { 2 } \in \mathbb { R } ^ { m \times d ^ { \prime } }$ such that $A = A _ { 1 } A _ { 2 } ^ { T }$ and $B = B _ { 1 } B _ { 2 } ^ { T }$ , where $d \ll n , d ^ { \prime } \ll m$ .
153
+
154
+ 130 A case in point is when both $A$ and $B$ are squared Euclidean distance matrices, with a sample size
155
+ 131 that is larger than ambient dimension. This case is highly relevant, covering many applications of OT
156
+ 132 to ML. The $d \ll n$ assumption is also likely to hold for most applications, since cases where $d \gg n$
157
+ 133 are known to pose challenges to the estimation of OT [16, 39]. Writing $X = [ x _ { 1 } , \ldots , x _ { n } ] \in \mathbb { R } ^ { d \times n }$ , if
158
+
159
+ 134 $A = \left[ \Vert x _ { i } - x _ { j } \Vert _ { 2 } ^ { 2 } \right] _ { i , j }$ , then one has, writing $z = ( X ^ { \odot 2 } ) ^ { T } \mathbf { 1 } _ { d } \in \mathbb { R } ^ { n }$ that $A = z \mathbf { 1 } _ { n } ^ { T } + \mathbf { 1 } _ { n } z ^ { T } - 2 X ^ { T } X$ . Therefore by denoting 135 $A _ { 1 } = [ z , \mathbf { 1 } _ { n } , - \sqrt { 2 } X ^ { T } ] \in \mathbb { R } ^ { n \times ( d + 2 ) }$ and $A _ { 2 } = [ \mathbf { 1 } _ { n } , z , \sqrt { 2 } X ^ { T } ] \in \mathbb { R } ^ { n \times ( d + 2 ) }$ 136 we obtain the factorization above.
160
+
161
+ 137 Under Assumption 1, the complexity of Algo. 1 is downgraded to quadratic in sample size: the two
162
+ 138 operations that make Algo. 1 cubic lie in the updates of the cost and the computation of the objective.
163
+ 139 Observe that for any given $P \in \mathbb { R } ^ { n \times m }$ , one can compute at each iteration
164
+
165
+ $$
166
+ \begin{array} { r } { C = - 4 A _ { 1 } A _ { 2 } ^ { T } P B _ { 1 } B _ { 2 } ^ { T } } \end{array}
167
+ $$
168
+
169
+ 140 in $n m ( d + d ^ { \prime } ) + d d ^ { \prime } ( n + m )$ algebraic operations. Moreover thanks to the reformulation of
170
+ 141 $\mathcal { E } _ { A , B } ( \boldsymbol { P } )$ given in (3), one can compute it in quadratic time as well. Indeed writing $G _ { 1 } : =$
171
+ 142 $A _ { 1 } ^ { T } P B _ { 2 }$ and $G _ { 2 } : = A _ { 2 } ^ { T } P B _ { 1 }$ , both in $\mathbb { R } ^ { d \times d ^ { \prime } }$ , one has $\langle A P B , P \rangle = \mathbf { 1 } _ { d } ^ { T } ( G _ { 1 } \odot G _ { 2 } ) \mathbf { 1 } _ { d ^ { \prime } }$ . Com
172
+ 143 puting $G _ { 1 } , G _ { 2 }$ given $P$ requires only $2 ( n m d + m d d ^ { \prime } )$ , and computing their dot product adds
173
+ 144 $d d ^ { \prime }$ algebraic operations. The overall complexity to compute $\mathcal { E } _ { A , B } ( { \cal P } )$ is $\mathcal { O } ( n m d + m d d ^ { \prime } )$ .
174
+ 146 General distance matrices. When the original
175
+ 147 cost matrices $A$ , are not low-rank but describe
176
+ 148 distances, we propose to use a recent body of
177
+ 149 work that output their low-rank approximation
178
+ 150 in linear time [5, 21]. These algorithms produce,
179
+ 151 for any distance matrix $D \in \bar { \mathbb { R } } ^ { n \times m }$ and $\gamma > 0$ ,
180
+ 152 matrices $D _ { 1 } \in \mathbb { R } ^ { n \times d }$ , $D _ { 2 } \in \mathbb { R } ^ { m \times d }$ in $\mathcal { O } ( ( m +$
181
+ 153 $\scriptstyle n ) \mathtt { p o l y } ( { \frac { d } { \gamma } } ) )$ algebraic operations such that with
182
+ 154 probability at least 0.99 one has
183
+
184
+ # Algorithm 2 Quadratic Entropic-GW
185
+
186
+ $$
187
+ \| D - D _ { 1 } D _ { 2 } ^ { T } \| _ { F } ^ { 2 } \leq \| D - C _ { d } \| _ { F } ^ { 2 } + \gamma \| D \| _ { F } ^ { 2 }
188
+ $$
189
+
190
+ 155 where $C _ { d }$ denotes the best rank- $d$ approximation
191
+ 156 to $D$ . We fall back on this approach to obtain a
192
+ 157 low-rank factorization of a distance matrix in lin
193
+ 158 ear time whenever needed, aware that this incurs
194
+ 159 an additional approximation. See Appendix B
195
+ 160 for more details.
196
+
197
+ # end
198
+
199
+ $$
200
+ \begin{array} { r l } & { c _ { 1 } \gets \langle A ^ { \odot 2 } a , a \rangle + \langle B ^ { \odot 2 } b , b \rangle \quad \mathcal { O } ( \mathrm { n r } } \\ & { G _ { 2 } \gets A _ { 2 } ^ { T } P B _ { 1 } \quad \mathrm { n m d ~ + ~ m d d } ^ { \flat } , } \\ & { G _ { 1 } \gets A _ { 1 } ^ { T } P B _ { 2 } \quad \mathrm { n m d ~ + ~ m d d } ^ { \flat } } \\ & { c _ { 2 } \gets - 2 \mathbf { 1 } _ { d } ^ { T } ( G _ { 1 } \odot G _ { 2 } ) \mathbf { 1 } _ { d ^ { \prime } } \quad \mathcal { O } ( \mathrm { d d } ^ { \flat } ) } \\ & { \xi _ { A , B } ( P ) \gets c _ { 1 } + c _ { 2 } } \\ & { \mathbf { R e t u r n } \colon \mathcal { E } _ { A , B } ( P ) } \end{array}
201
+ $$
202
+
203
+ # 161 4 Imposing a Low Nonnegative Low-Rank for the Coupling
204
+
205
+ In this section, we shift our attention to a different opportunity for speed-ups, without assuming that Assumption 1 holds: we regularize the GW problem problem by decomposing the coupling as a product of two low-rank couplings, in the footsteps of [18, 32], using the following definition:
206
+
207
+ 165 Definition 1. Given $M \in \mathbb { R } ^ { n \times m }$ , the nonnegative (NN) rank of $M$ is the smallest number of
208
+ 166 nonnegative rank-one matrices into which the matrix can be decomposed additively:
209
+
210
+ $$
211
+ \operatorname { r k } _ { + } ( M ) : = \operatorname* { m i n } \left\{ q | M = \sum _ { i = 1 } ^ { q } R _ { i } , \forall i , \operatorname { r k } ( R _ { i } ) = 1 , R _ { i } \geq 0 \right\} .
212
+ $$
213
+
214
+ 167 Following [18, 32], we propose to constrain GW, enforcing a rank $r$ on the coupling:
215
+
216
+ $$
217
+ \mathrm { G W } \mathrm { L R } ^ { ( r ) } ( ( a , A ) , ( b , B ) ) : = \operatorname* { m i n } _ { P \in \Pi _ { a , b } ( r ) } \xi _ { A , B } ( P ) , \mathrm { ~ w h e r e ~ } \Pi _ { a , b } ( r ) : = \{ P \in \Pi _ { a , b } , \mathrm { r k } _ { + } ( P ) \leq r \} \ : .
218
+ $$
219
+
220
+ 168 Note that the minimum is always attained as $\Pi _ { a , b } ( r )$ is compact and the objective is continuous.
221
+ 169 In [32], the authors show that one can parameterize any coupling in $\Pi _ { a , b } ( r )$ as a product of two
222
+ 170 low-rank couplings linked by a common marginal. For any $g \in \Delta _ { r } ^ { * }$ , the interior of $\Delta _ { r }$ , writing
223
+
224
+ $$
225
+ \Pi _ { a , g , b } : = \Bigl \{ P \in \mathbb { R } _ { + } ^ { n \times m } , P = Q \mathrm { d i a g } ( 1 / g ) { R } ^ { T } , Q \in \Pi _ { a , g } , \mathrm { a n d } R \in \Pi _ { b , g } \Bigr \} .
226
+ $$
227
+
228
+ one has that 171 $\begin{array} { r } { \bigcup _ { g \in \Delta _ { r } ^ { * } } \Pi _ { a , g , b } = \Pi _ { a , b } ( r ) } \end{array}$ . Therefore GW-LR introduced in (5) can be reformulated as 172 the following optimization problem
229
+
230
+ $$
231
+ \mathrm { G W - L R } ^ { ( r ) } ( ( a , A ) , ( b , B ) ) = \operatorname* { m i n } _ { ( Q , R , g ) \in { \mathcal C } ( a , b , r ) } { \mathcal E } _ { A , B } ( Q \mathrm { d i a g } ( 1 / g ) R ^ { T } )
232
+ $$
233
+
234
+ 173 where $\mathcal { C } ( a , b , r ) : = \mathcal { C } _ { 1 } ( a , b , r ) \cap \mathcal { C } _ { 2 } ( r )$ , with
235
+
236
+ $$
237
+ \begin{array} { r } { \mathcal { C } _ { 1 } ( a , b , r ) : = \Big \{ ( Q , R , g ) \in \mathbb { R } _ { + } ^ { n \times r } \times \mathbb { R } _ { + } ^ { m \times r } \times \big ( \mathbb { R } _ { + } ^ { * } \big ) ^ { r } \mathrm { s . t . } Q \mathbf { 1 } _ { r } = a , R \mathbf { 1 } _ { r } = b \Big \} , } \\ { \mathcal { C } _ { 2 } ( r ) : = \Big \{ ( Q , R , g ) \in \mathbb { R } _ { + } ^ { n \times r } \times \mathbb { R } _ { + } ^ { m \times r } \times \mathbb { R } _ { + } ^ { r } \mathrm { s . t . } Q ^ { T } \mathbf { 1 } _ { n } = R ^ { T } \mathbf { 1 } _ { m } = g \Big \} . } \end{array}
238
+ $$
239
+
240
+ 174 Stabilization of the Method. [32] propose to stabilize the objective defined in (6) by adding to the
241
+ 175 constraints a lower bound $\alpha$ on the weight vector $g$ such that $g \geq \alpha$ coordinate-wise. Indeed, as
242
+ 176 a solution of (6) must satisfies $g > 0$ coordinate-wise, then for $\alpha$ sufficiently small, the solution
243
+ 177 of the same problem where one adds the constraint $g \geq \alpha$ will remain the same. Therefore let us
244
+ 178 introduce our new set of constraints $\mathcal { C } ( a , b , r , \alpha ) : = \mathcal { C } _ { 1 } ( a , b , r , \alpha ) \cap \mathcal { C } _ { 2 } ( r )$ where $\mathcal { C } _ { 1 } ( a , b , r , \alpha ) : =$
245
+ 179 $\mathcal { C } _ { 1 } ( a , b , r ) \cap \{ ( Q , R , g ) \mid g \geq \alpha \}$ . Another way to stabilize the method is by considering a double
246
+ 180 regularization scheme as proposed in [32] where in addition of constraining the nonnegative rank
247
+ 181 of the coupling, we regularize the objective by adding an entropic term in $( Q , R , g )$ , which is to be
248
+ 182 understood as that of the values of the three respective entropies evaluated for each term.
249
+
250
+ $$
251
+ \mathrm { G W } \mathrm { L R } _ { \varepsilon , \alpha } ^ { ( r ) } ( ( a , A ) , ( b , B ) ) : = \operatorname* { m i n } _ { ( Q , R , g ) \in { \mathscr C } ( a , b , r , \alpha ) } { \mathscr E } _ { A , B } ( Q \mathrm { d i a g } ( 1 / g ) R ^ { T } ) - \varepsilon H ( ( Q , R , g ) ) ~ .
252
+ $$
253
+
254
+ 183 Mirror Descent Scheme. As in [27], we propose to use a MD scheme with respect to the $\mathrm { K L }$
255
+ 184 divergence to approximate $\mathbf { G } \mathbf { W } \mathbf { - L R } _ { \varepsilon , \alpha } ^ { ( r ) }$ in (7). More precisely, for any $\varepsilon \geq 0$ , the MD scheme leads
256
+ 185 for all $k \geq 0$ to the following updates which require solving a convex barycenter problem per step:
257
+
258
+ $$
259
+ ( Q _ { k + 1 } , R _ { k + 1 } , g _ { k + 1 } ) : = \underset { \zeta \in \mathcal { C } ( a , b , r , \alpha ) } { \mathrm { a r g m i n ~ } } \mathrm { K L } ( \zeta , K _ { k } )
260
+ $$
261
+
262
+ 186 where $( Q _ { 0 } , R _ { 0 } , g _ { 0 } ) \in \mathcal { C } ( a , b , r )$ is an initial point such that $ { Q _ { 0 } } \ > \ 0$ and $\begin{array} { r l r } { R _ { 0 } } & { { } > } & { 0 } \end{array}$ ,
263
+ 187 $P _ { k } : = Q _ { k } \mathrm { d i a g } ( 1 / g _ { k } ) R _ { k } ^ { T }$ $\mathring { \mathbf { \ i } } _ { k } , \ \mathbf { K } _ { k } : = \big ( \boldsymbol { K } _ { k } ^ { ( 1 ) } , \boldsymbol { K } _ { k } ^ { ( 2 ) } , \boldsymbol { K } _ { k } ^ { ( 3 ) } \big ) , \ \boldsymbol { K } _ { k } ^ { ( 1 ) } : = \mathrm { e x p } ( 4 \gamma A P _ { k } B R _ { k } \operatorname { d i a g } ( 1 /$
264
+ 188 $( \gamma \varepsilon \mathrm { ~ - ~ } 1 ) \log ( Q _ { k } ) )$ , $\begin{array} { r c l } { K _ { k } ^ { ( z ) } } & { : = } & { \exp ( 4 \gamma B P _ { k } ^ { T } D Q _ { k } \mathrm { d i a g } ( 1 / g _ { k } ) - ( \gamma \varepsilon - 1 ) \log ( R _ { k } ) ) } \end{array}$ , $K _ { k } ^ { ( 3 ) } \ : =$
265
+ 189 $\exp ( - 4 \gamma \omega _ { k } / g _ { k } ^ { 2 } - ( \gamma \varepsilon - 1 ) \log ( g _ { k } ) )$ with $[ \omega _ { k } ] _ { i } : = [ Q _ { k } ^ { T } A P _ { k } B R _ { k } ] _ { i , i }$ for all $i \in \{ 1 , \ldots , r \}$ and
266
+ 190 $\gamma$ is a positive step size. Solving (8) can be done efficiently thanks to the Dykstra’s Algorithm as
267
+ 191 showed in [32]. See Appendix $\textrm { C }$ for more details.
268
+
269
+ Initialization. To initialize our algorithm, we adapt the First Lower Bound of [26] to our case of interest. More precisely, we show the following Proposition. See appendix A for the proof.
270
+
271
+ 194 Proposition 1. Let us denote $\tilde { x } = A ^ { \odot 2 } a \in \mathbb { R } ^ { n }$ , $\tilde { y } = B ^ { \odot 2 } b \in \mathbb { R } ^ { m }$ and $\tilde { C } = ( | \tilde { x } _ { i } - \tilde { y } _ { j } | ^ { 2 } ) _ { i , j } \in \mathbb { R } ^ { n \times m }$
272
+ 195 Then for all $\varepsilon \geq 0$ and $r \geq 1$ we have,
273
+
274
+ $$
275
+ \mathrm { G W - L R } ^ { ( r ) } ( ( a , A ) , ( b , B ) ) \geq \operatorname* { m i n } _ { ( Q , R , g ) \in { \mathcal C } ( a , b , r , \alpha ) } \langle \tilde { C } , Q \mathrm { d i a g } ( 1 / g ) R ^ { T } \rangle - \varepsilon H ( ( Q , R , g ) ) ~ .
276
+ $$
277
+
278
+ 196 Note that the RHS of the inequality (9) is exactly the problem studied in [32] for which an algorithm
279
+ 197 was proposed. Therefore to initialize our algorithm, we propose to use their approach. Note that here
280
+ 198 the cost $\tilde { C }$ is the squared Euclidean distance between two families $\{ \tilde { x } _ { 1 } , \ldots , \tilde { x } _ { n } \}$ and $\{ \tilde { y } _ { 1 } , \dots , \tilde { y } _ { m } \}$
281
+ 199 in 1-D which admits a low-rank factorization. Therefore we can apply the linear-time version of the
282
+ 200 algorithm presented in [32] to compute the solution. Algorithm 3 summarizes our approach, where
283
+ 201 $\mathcal { D } ( \cdot )$ denotes the operator extracting the diagonal of a square matrix.
284
+ 202 Computational Cost. Computing the initialization goes through the computations of $\tilde { x }$ and $\tilde { y }$ which
285
+ 203 requires $O ( n ^ { 2 } + m ^ { 2 } )$ algebraic operations. Moreover, applying the algorithm proposed in [32]
286
+ 204 when the underlying cost is the squared Euclidean distances between two families in 1-D needs
287
+ 205 only $\mathcal { O } ( ( n + m ) r )$ algebraic operations. Solving the barycenter problem as defined in (8) can be
288
+ 206 207 done given $( K _ { k } ^ { ( 1 ) } , \dot { K } _ { k } ^ { ( 2 ) } , K _ { k } ^ { ( 3 ) } )$ ) Dykstra’s Algorithm. Indeed in [32, Algorithm, each iteration of their algorithm requires only $\mathcal { O } ( ( n + m ) r )$ show thatalgebraic
289
+ 208 operations since it involves only matrix/vector multiplications. However computing the kernel
290
+ 209 matrices $( K _ { k } ^ { ( 1 ) } , K _ { k } ^ { ( 2 ) } , K _ { k } ^ { ( 3 ) } )$ at each iteration of Algorithm 3 requires a quadratic complexity with
291
+ 210 respect to the number of samples. Overall the proposed algorithm, while faster than the cubic
292
+ 211 implementation proposed in [27], still needs $\mathcal { O } ( ( n ^ { 2 } + m ^ { 2 } ) r )$ operations per iteration. In the following
293
+ 212 we will see that by combining both nonnegative low-rank constraints on the coupling and low-rank
294
+ 213 approximations of the distance matrices, we can obtain a linear time algorithm with respect to the
295
+ 214 number of samples which computes an approximation of the GW distance.
296
+
297
+ $\mathrm { A l g o r i t h m } 3 \mathrm { L o w - R a n k } \mathrm { G W } , \mathrm { G W - L R } _ { \varepsilon , \alpha } ^ { ( r ) } ( ( a , A ) , ( b , B ) )$
298
+
299
+ for $k = 1 , \dots$ do
300
+
301
+ # end
302
+
303
+ Return:
304
+
305
+ 215 Convergence of the mirror descent. Even if the objective (7) is not convex in $( Q , R , g )$ , we obtain
306
+ 216 the non-asymptotic stationary convergence of the MD algorithm in this setting. For that purpose
307
+ 217 we consider the same convergence criterion as the one proposed in [32] to obtain non-asymptotic
308
+ 218 stationary convergence of the MD scheme defined as
309
+
310
+ $$
311
+ \Delta _ { \varepsilon , \alpha } ( \pmb { \xi } , \gamma ) : = \frac { 1 } { \gamma ^ { 2 } } ( \mathrm { K L } ( \pmb { \xi } , \mathcal { G } _ { \varepsilon , \alpha } ( \pmb { \xi } , \gamma ) ) + \mathrm { K L } ( \mathcal { G } _ { \varepsilon , \alpha } ( \pmb { \xi } , \gamma ) , \pmb { \xi } ) )
312
+ $$
313
+
314
+ where 219 $\begin{array} { r } { \mathcal { G } _ { \varepsilon , \alpha } ( \pmb { \xi } , \gamma ) : = \mathrm { a r g m i n } _ { \zeta \in \mathcal { C } ( a , b , r , \alpha ) } \{ \langle \nabla \mathcal { E } _ { A , B } ( \pmb { \xi } ) , \pmb { \zeta } \rangle + \frac { 1 } { \gamma } \mathrm { K L } ( \zeta , \pmb { \xi } ) \} } \end{array}$ . For any $1 / r \ge \alpha > 0$ , we 220 show in the following proposition the non-asymptotic stationary convergence of the MD scheme 221 applied to the problem (7). See Appendix A for the proof.
315
+
316
+ 222 Proposition 2. Let $\varepsilon \geq 0$ , $\textstyle { \frac { 1 } { r } } \geq \alpha > 0$ and $N \geq 1$ . By denoting $L _ { \varepsilon , \alpha } : = 2 7 ( \| A \| _ { 2 } \| B \| _ { 2 } / \alpha ^ { 4 } + \varepsilon )$ and by considering a constant stepsize in the MD scheme 223 $\begin{array} { r } { { \bf \Phi } ^ { \left( 8 \right) } \gamma = \frac { 1 } { 2 L _ { \varepsilon , \alpha } } } \end{array}$ , we obtain that
317
+
318
+ $$
319
+ \operatorname* { m i n } _ { 1 \leq k \leq N } \Delta _ { \varepsilon , \alpha } ( ( Q _ { k } , R _ { k } , g _ { k } ) , \gamma ) \leq \frac { 4 L _ { \varepsilon , \alpha } D _ { 0 } } { N } .
320
+ $$
321
+
322
+ where 224 $D _ { 0 } : = \mathscr { E } _ { A , B } ( Q _ { 0 } \mathrm { d i a g } ( 1 / g _ { 0 } R _ { 0 } ^ { T } ) - \mathbf { G } \mathbf { W } \mathbf { - } \mathbf { L R } ^ { ( r ) } ( ( a , A ) , ( b , B ) )$ is the distance of the initial value 225 to the optimal one.
323
+
324
+ Recall that for $\alpha$ sufficiently small, we have $\mathrm { { \bf G W - L R } } _ { \varepsilon , \alpha } ^ { ( r ) } ( ( a , A ) , ( b , B ) ) = { \bf G W - L R } _ { \varepsilon } ^ { ( r ) } ( ( a , A ) , ( b , B ) )$ . Thus Proposition 2 show that our algorithm reach a stationary point of (7). In particular, if $\varepsilon = 0$ , the proposed algorithm converges towards a stationary point of (5).
325
+
326
+ # 229 5 Double Low-rank Approach for Linear Time GW
327
+
328
+ Almost all operations in Algorithm 3 are linear time, except for the three updates highlighted in red, involving $C _ { 1 }$ and $C _ { 2 }$ , and the computations of $\tilde { x } = A ^ { \odot \tilde { 2 } } a$ and $\tilde { y } = B ^ { \odot 2 } b$ as they still require a quadratic number of algebraic operations. When adding Assumption 1 from $\ S 3$ to the rank constrained approach from $\ S 4$ , we notice that the strengths of both approaches can work hand in hand, both in easier initial evaluations of $\tilde { x } , \tilde { y }$ , but, most importantly, at each new recomputation of a factorized linearization of the quadratic objective:
329
+
330
+ Linear time outfactorization for rms. Because . Indeed, rema $A$ admits a that for a low-rank. Therefore $A ^ { \odot 2 }$ $\begin{array} { r } { \boldsymbol { x } , \boldsymbol { y } \in \mathbb { R } ^ { d } , \langle \boldsymbol { x } , \boldsymbol { y } \rangle ^ { 2 } = \sum _ { i , j = 1 } ^ { d } x _ { i } x _ { j } y _ { i } y _ { j } } \end{array}$
331
+
332
+ by studying the rows of matrices $A _ { 1 } : = [ a _ { 1 } ^ { ( 1 ) } ; . . . ; a _ { n } ^ { ( 1 ) } ]$ and $A _ { 2 } : = [ a _ { 1 } ^ { ( 2 ) } ; . . . ; a _ { n } ^ { ( 2 ) } ]$ , if one writes $\psi ( \boldsymbol { x } ) : = \mathrm { V e c t } ( \boldsymbol { x } \boldsymbol { x } ^ { T } ) \in \mathbb { R } ^ { d ^ { 2 } }$ where $\mathrm { V e c t } ( \cdot )$ is the vectorization operation, we obtain that
333
+
334
+ $$
335
+ \begin{array} { r } { A ^ { \odot 2 } = \tilde { A } _ { 1 } \tilde { A _ { 2 } } ^ { T } \mathrm { ~ w h e r e ~ } \tilde { A _ { 1 } } = [ \psi ( a _ { 1 } ^ { ( 1 ) } ) , \dots , \psi ( a _ { n } ^ { ( 1 ) } ) ] ^ { T } , \tilde { A _ { 2 } } = [ \psi ( a _ { 1 } ^ { ( 2 ) } ) , \dots , \psi ( a _ { n } ^ { ( 2 ) } ) ] ^ { T } \ . } \end{array}
336
+ $$
337
+
338
+ In Algorithm 3, the line “Step 236 $( \star ) ^ { \dagger }$ can thus be replaced by $\tilde { x } \gets \tilde { A _ { 1 } } \tilde { A _ { 2 } } ^ { T } a$ and $\tilde { y } \gets \tilde { B _ { 1 } } \tilde { B _ { 2 } } ^ { T } b$ Note 237 that computing $\tilde { A } _ { 1 }$ given $A _ { 1 }$ requires only $\mathcal { O } ( n d ^ { 2 } )$ operations, so that this alternate code only takes 238 $\mathcal { O } ( n d ^ { 2 } ) \bar { + } \mathcal { O } ( \bar { m } ( d ^ { \prime } ) ^ { 2 } )$ operations.
339
+
340
+ 239 Linear time linearization of the GW objective. The linearization step, the critical step in Algo.1
341
+ 240 that consists in updating $C$ at each iteration, consumes a substantial portion of the computational
342
+ 241 budget of GW. Introducing the low-rank Sinkhorn approach makes this step quadratic in Algo.3; the
343
+ 242 complexity of that step is also quadratic using the low-rank assumption on costs $A$ and $B$ , in Algo.2.
344
+ 243 There is therefore an opportunity to marry both to speed-up that important step. We argue that this is
345
+ 244 indeed what happens, in the sense that combining the two yields indeed linear time complexities in
346
+ 245 sample sizes, by replacing in Algorithm 3, the lines “Step $( \star \star ) ^ { \flat }$ b y
347
+
348
+ $$
349
+ { \cal C } _ { 1 } \gets - A _ { 1 } A _ { 2 } ^ { T } Q \mathrm { d i a g } ( 1 / g ) \quad \mathrm { a n d } \quad { \cal C } _ { 2 } \gets R ^ { T } B _ { 2 } B _ { 1 } ^ { T } .
350
+ $$
351
+
352
+ 246 Note that this speed-up would not be achieved using other approaches that output a low rank
353
+ 247 approximation of the transport plan [4, 3, 31]. The crucial obstacle to using these methods here is that
354
+ 248 the cost matrix $C$ in GW is “synthetic“, in the sense that it is the output of a matrix product $A P B$
355
+ 249 involving the very last transport $P$ . This stands in stark contrast with the requirements in [4, 3, 31]
356
+ 250 that the kernel matrix corresponding to $K _ { \varepsilon } = e ^ { - C / \varepsilon }$ admits favorable properties, such as being p.s.d
357
+ 251 or admitting an explicit (random or not) finite dimensional feature approximation. Since $C$ changes
358
+ 252 at each iteration in Algo.1, they are not directly applicable.
359
+ 53 Combining the results in $\ S 4$ with those from $\ S _ { \mathbf { B } }$ results in updates for $C _ { 1 }$ and $C _ { 2 }$ that only require
360
+ 54 $\mathcal { O } ( n r d )$ and $\mathcal { O } ( m r d ^ { \prime } )$ operations.
361
+
362
+ Linear time GW. Finally all the quadratic operations appearing in Algorithm (3) can be replaced by linear counterparts. The iterations that have not been modified had an overall complexity of $\bar { \mathcal { O } } ( m r ( r + d ^ { \prime } ) + \bar { n } r ( r + d ) )$ at each iteration. The initialization and linearization steps can now be performed in linear time, with respective complexity of respectively $\mathcal { O } ( n ( r + d ^ { 2 } ) + \mathrm { \dot { \ m } } ( ( d ^ { \prime } ) ^ { 2 } + r ) )$ and $\mathcal { O } ( ( n r ( r + d ) + m r ( r + d ^ { \prime } ) )$ .
363
+
364
+ # 260 6 Experiments
365
+
366
+ Our goal in this section is to demonstrate that, for a far smaller computational budget, the GW-LR approach is competitive with the direct entropic approach on datasets that are either synthesized to exhibit local clusters, or directly validated on a real high-dimensional dataset as well. Because both approaches have different hyperparameters, our goal is to stick to a realistic evaluation that stresses both optimality of solutions as a function of computational effort, as well as performance in real life applications. We start by investigating the sensitivity of hyperparamaters $\varepsilon$ and $\gamma$ on our method. Since GW is not convex, these may interact in unexpected ways. Experiments were run on a personal MacBook Pro 2019 laptop. We reused code from github.com/meyerscetbon/LOT, and downloaded genomics data from github.com/rsinghlab/SCOT.
367
+
368
+ Benchmarks. We consider three synthetic problems and one real world problem to evaluate timeaccuracy trade-offs, and also compare the couplings obtained by our method and that of the entropic version [27]. More precisely, we compare the quadratic approach in GW-LR computed with algorithm (3) (and its linear time counterpat, Lin GW-LR as presented in $\ S 5$ ), with EntropicGW, the cubic implementation of [27] (as well as its quadratic counterpart, Quad Entropic-GW presented in Algo. 2). For GW-LR and Lin GW-LR, and in all experiments, we set the lower bound on entries of g to ↵ = 1010 .
369
+
370
+ Initialization To initialize all algorithms with a common strategy, we adapted the first lower bound of [26, Def. 6.1] to the entropic case. In all experiments showing time-accuracy tradeoffs, we choose to use number of operations to provide platform independent quantities. Accuracy is measured by evaluating the ground-truth energy $\mathcal { E } _ { , B }$ (even in scenarios when the method uses a low rank approximation for $A , B$ at optimization time).
371
+
372
+ ![](images/ced3128aec5a3e2f1ee8b3a2ad54bff8f7dd8e662233522796a537c2ee35f7a0.jpg)
373
+ Figure 3: The number of cluster in each distribution is 10 and the number of samples is $n = m = 5 0 0 0$ . The ground cost is the Euclidean distance. As we can evaluate the distance between two arbitrary points, we can obtain in linear-time an efficient approximation of the distance matrices $A$ and $B$ as presented in 3. The rank of their factorizations is fixed to be $d = d ^ { \prime } = 1 0 0$ . GW-LR and EntropicGW corresponds to the case where the full matrices $A$ and $B$ are considered while Lin GW-LR and Quad Entropic-GW take as inputs the low-rank approximations of the distance matrices. We plot the time-accuracy tradeoff for multiple choices of $\gamma$ and rank $r$ defined as a fraction of $n$ . For Entropic-GW and Quad Entropic-GW, we set $\varepsilon = 1 / \gamma$ as proposed in [27]. Recall that for low-rank methods, we set $\varepsilon = 0$ .
374
+
375
+ Sensitivity to $\gamma$ and $\varepsilon$ Here we aim at showing the dependence in both $\gamma$ and $\varepsilon$ of our proposed method. In Figure 2, we compare the GW loss obtained by our algorithm when varying $\varepsilon$ and $\gamma$ on two mixtures. We show that when $\varepsilon = 0$ , the proposed method manage to consistently obtain small GW loss whatever $\gamma$ is. 8 By allowing $\varepsilon > 0$ , the algorithm is able to reach even smaller GW loss, however, the choice of $\varepsilon$ depends highly on $\gamma$ . Therefore in the following experiments, we fix $\varepsilon = 0$ for our method. We also show the dependence in $\gamma$ and $\varepsilon$ of our method in other settings and observe similar behaviors. See Appendix D.2 for 4 more details.
376
+
377
+ Remark 1. As shown in Figure 8 in Appendix D.2, allowing $\varepsilon > 0$ may also increase the speed of convergence of the algorithm. However choosing well $\varepsilon$ for a given $\gamma$ must be done carefully and we prefer in the following experiments to present the performance of our method in the simplest setting where $\varepsilon = 0$ .
378
+
379
+ ![](images/58a709d7ba81bc3cb25edfaf380271a8b7d1638e8c02cdcfc50025f0b4029cf8.jpg)
380
+ Figure 2: In this experiment, we consider two mixtures of (2 and 3) Gaussians in respectively 5-D and 10-D, sampled as discrete measures with $n = m = 5 0 0 0$ points, see more details on setup in Appendix D.2. The ground cost is the squared Euclidean distance, which provides an exact low-rank factorization of the cost as presented in $\ S \ O 3$ . Results on speed (in Appendix) are therefore obtained using Lin GW-LR. The nonnegative rank of the coupling is set to $r = 5 0 = n / 1 0 0$ . We plot the GW loss obtained by Lin GW-LR when varying $\epsilon$ for multiple choices of $\gamma$ . Both size and color have been used to quantify visually the value of the loss at that parameter pair. Occasional inversions are due to the nonconvex nature of the GW problem.
381
+
382
+ 01 Synthetic low-rank problem In this experiment
383
+ 02 we aim at comparing the time-accuracy tradeoff of
384
+ 03 the different methods when the underlying distribu
385
+ 04 tions has a low-rank structure. For that purpose, we
386
+ 05 consider two distributions in respectively 10-D and
387
+ 06 15-D, where the support of each distributions is the
388
+ 07 concatenation of clusters of points, and where the eu
389
+ 08 clidean distance between the centroids of the clusters
390
+ 09 is bigger than a threshold $\beta$ . Here we set $\beta = 1 0$ .
391
+ 10 Both distributions are uniform, have the same number
392
+ 311 of clusters and the same number of points in each cluster. Some illustrations of the simulated data
393
+ 312 is provided in Appendix D.3. In Figure 3, when the underlying cost is the (not squared) Euclidean
394
+ 313 distance, our methods manage to consistently obtain similar accuracy that the ones obtained by
395
+ 314 entropic methods, with very low rank $r = n / 5 0 0$ , while being orders of magnitude faster. In Figure 4,
396
+ 315 we also compare the time-accuracy tradeoffs in the more favorable case where the underlying cost
397
+ 316 is the squared Euclidean distance and obtain similar results. We also show more experiments for
398
+ 317 different number of clusters in Appendix D.3, leading to similar conclusions.
399
+
400
+ ![](images/205bfafdd7068632b78380a9723796c677156a099b7b76bf03b8ebfa0f53f9ad.jpg)
401
+ Figure 4: The number of clusters in each distribution is 5 and the number of samples considered here is $n = m = 1 0 0 0 0$ . The ground cost is the squared Euclidean distance. We compare Lin GW-LR and Quad Entropic-GW as we have an exact factorization of the matrices $A$ and $B$ . We plot the time-accuracy tradeoff when varying $\gamma$ for multiple choices of $r$ . For Quad Entropic-GW, we set $\varepsilon = 1 / \gamma$ and for Lin GW-LR we set $\varepsilon = 0$ .
402
+
403
+ ![](images/f357507bc64ee0a9d0b9ea5317bd8491b5252e6d657cf1bfa6c8e18bf3b3b8cf.jpg)
404
+ Figure 5: We plot, for each cells of the SNAREseq dataset, the FOSCTTM ranked in the increasing order for both GW-LR and Entropic-GW.
405
+
406
+ ![](images/44a0b85b7dc95af7583f8947b4baaddc578e9a97e8c9a0235263eef73478c8a8.jpg)
407
+ Figure 6: Plot of the time-accuracy tradeoff when varying $\gamma$ for multiple choices of rank $r$ on the SNAREseq dataset. For Entropic-GW we set $\varepsilon = 1 / \gamma$ , for GW-LR, we set $\varepsilon = 0$ .
408
+
409
+ Experiments on Single Cell Genomics Data. We reproduce the single-cell alignment experiment introduced in [14]. The dataset consists in single-cell multi-omics data generated by co-assays. In that setup, the ground truth one–to-one correspondence information between cells is known, and can therefore be used to benchmark GW strategies. The dataset considered is the SNAREseq [10], with $n = m = 1 0 4 7$ . We apply the exact same pre-processing steps as proposed in [14] by computing intra-domain distance matrices $A$ and $B$ with a k-NN graphs based on correlations, to compute shortest path distance matrices. Note that in that case, one cannot obtain directly in linear time a low-rank factorization of $A$ and $B$ using [5, 21], since the shortest path distances need to be computed first. Therefore we only consider the quadratic GW-LR and the cubic Entropic-GW. In Figure 6, we compare the alignment performance through the “fraction of samples closer than the true match” (FOSCTTM) introduced in [25]. We see that both algorithm obtain similar performance. However, in Figure 5, we show that whatever the $\gamma$ chosen, GW-LR reaches better accuracy while being order of magnitude faster than Entropic-GW for a very small rank $r = 1 0$ .
410
+
411
+ Conclusion. While the factorization introduced in [32] held the promise to speed up classic OT, we have shown in this work that it delivers an even larger impact when applied to the GW problem: Indeed, the combination of low-rank Sinkhorn factorization with-low rank cost matrices is the only one, to our knowledge, that ensures that the linearization step of the GW objective can be carried out with a linear complexity, throughout outer iterations. This linear complexity is comparable to that of the most recent OT solvers, yet still retains the appealing properties of the Entropic approach, such as stability and convergence to meaningful solutions.
412
+
413
+ # References
414
+
415
+ [1] Jean Alaux, Edouard Grave, Marco Cuturi, and Armand Joulin. Unsupervised hyperalignment for multilingual word embeddings. arXiv preprint arXiv:1811.01124, 2018.
416
+ [2] Jason Altschuler, Jonathan Weed, and Philippe Rigollet. Near-linear time approximation algorithms for optimal transport via sinkhorn iteration. arXiv preprint arXiv:1705.09634, 2017.
417
+ [3] Jason Altschuler, Francis Bach, Alessandro Rudi, and Jonathan Niles-Weed. Massively scalable sinkhorn distances via the nyström method, 2018.
418
+ [4] Jason Altschuler, Francis Bach, Alessandro Rudi, and Jonathan Weed. Approximating the quadratic transportation metric in near-linear time. arXiv preprint arXiv:1810.10046, 2018.
419
+ [5] Ainesh Bakshi and David P. Woodruff. Sublinear time low-rank approximation of distance matrices, 2018.
420
+ [6] Andrew J Blumberg, Mathieu Carriere, Michael A Mandell, Raul Rabadan, and Soledad Villar. Mrec: a fast and versatile framework for aligning and matching point clouds with applications to single cell molecular data. arXiv preprint arXiv:2001.01666, 2020.
421
+ [7] Charlotte Bunne, David Alvarez-Melis, Andreas Krause, and Stefanie Jegelka. Learning generative models across incomparable spaces. arXiv preprint arXiv:1905.05461, 2019.
422
+ [8] Rainer E Burkard, Eranda Cela, Panos M Pardalos, and Leonidas S Pitsoulis. The quadratic assignment problem. In Handbook of combinatorial optimization, pages 1713–1809. Springer, 1998.
423
+ [9] Laetitia Chapel, Mokhtar Alaya, and Gilles Gasso. Partial optimal transport with applications on positive-unlabeled learning. In Advances in Neural Information Processing Systems 33 (NeurIPS 2020), 2020.
424
+ [10] Song Chen, Blue B Lake, and Kun Zhang. High-throughput sequencing of the transcriptome and chromatin accessibility in the same cell. Nature biotechnology, 37(12):1452–1457, 2019.
425
+ [11] Samir Chowdhury, David Miller, and Tom Needham. Quantized gromov-wasserstein. arXiv preprint arXiv:2104.02013, 2021.
426
+ [12] Alexis Conneau, Guillaume Lample, Marc’Aurelio Ranzato, Ludovic Denoyer, and Hervé Jégou. Word translation without parallel data. arXiv preprint arXiv:1710.04087, 2017.
427
+ [13] Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In Advances in neural information processing systems, pages 2292–2300, 2013.
428
+ [14] Pinar Demetci, Rebecca Santorella, Björn Sandstede, William Stafford Noble, and Ritambhara Singh. Gromov-wasserstein optimal transport to align single-cell multi-omics data. bioRxiv, 2020. doi: 10.1101/2020.04.28.066787.
429
+ [15] Pinar Demetci, Rebecca Santorella, Bjorn Sandstede, William Stafford Noble, and Ritambhara Singh. Gromov-wasserstein optimal transport to align single-cell multi-omics data. BioRxiv, 2020.
430
+ [16] Richard Mansfield Dudley et al. Weak convergence of probabilities on nonseparable metric spaces and empirical measures on euclidean spaces. Illinois Journal of Mathematics, 10(1): 109–126, 1966.
431
+ [17] Danielle Ezuz, Justin Solomon, Vladimir G Kim, and Mirela Ben-Chen. Gwcnn: A metric alignment layer for deep shape analysis. In Computer Graphics Forum, volume 36, pages 49–57. Wiley Online Library, 2017.
432
+ [18] Aden Forrow, Jan-Christian Hütter, Mor Nitzan, Philippe Rigollet, Geoffrey Schiebinger, and Jonathan Weed. Statistical optimal transport via factored couplings, 2018.
433
+ [19] Aden Forrow, Jan-Christian Hütter, Mor Nitzan, Philippe Rigollet, Geoffrey Schiebinger, and Jonathan Weed. Statistical optimal transport via factored couplings. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 2454–2465. PMLR, 2019.
434
+ [20] Steven Gold and Anand Rangarajan. Softassign versus softmax: Benchmarks in combinatorial optimization. Advances in neural information processing systems, pages 626–632, 1996.
435
+ [21] Piotr Indyk, Ali Vakilian, Tal Wagner, and David Woodruff. Sample-optimal low-rank approximation of distance matrices, 2019.
436
+ [22] Hicham Janati, Thomas Bazeille, Bertrand Thirion, Marco Cuturi, and Alexandre Gramfort. Multi-subject meg/eeg source imaging with sparse multi-task regression. NeuroImage, page 116847, 2020.
437
+ [23] Hiroshi Konno. Maximization of a convex quadratic function under linear constraints. Mathematical programming, 11(1):117–127, 1976.
438
+ [24] Matt Kusner, Yu Sun, Nicholas Kolkin, and Kilian Q Weinberger. From word embeddings to document distances. In Proc. of the 32nd Intern. Conf. on Machine Learning, pages 957–966, 2015.
439
+ [25] Jie Liu, Yuanhao Huang, Ritambhara Singh, Jean-Philippe Vert, and William Stafford Noble. Jointly embedding multiple single-cell omics measurements. BioRxiv, page 644310, 2019.
440
+ [26] Facundo Mémoli. Gromov–wasserstein distances and the metric approach to object matching. Foundations of computational mathematics, 11(4):417–487, 2011.
441
+ [27] Gabriel Peyré, Marco Cuturi, and Justin Solomon. Gromov-wasserstein averaging of kernel and distance matrices. In International Conference on Machine Learning, pages 2664–2672, 2016.
442
+ [28] Gabriel Peyré and Marco Cuturi. Computational optimal transport. Foundations and Trends in Machine Learning, 11(5-6), 2019. ISSN 1935-8245.
443
+ [29] Yossi Rubner, Carlo Tomasi, and Leonidas J. Guibas. The earth mover’s distance as a metric for image retrieval. International Journal of Computer Vision, 40(2):99–121, November 2000.
444
+ [30] Ryoma Sato, Marco Cuturi, Makoto Yamada, and Hisashi Kashima. Fast and robust comparison of probability measures in heterogeneous spaces. arXiv preprint arXiv:2002.01615, 2020.
445
+ [31] Meyer Scetbon and Marco Cuturi. Linear time sinkhorn divergences using positive features, 2020.
446
+ [32] Meyer Scetbon, Marco Cuturi, and Gabriel Peyré. Low-rank sinkhorn factorization, 2021.
447
+ [33] Geoffrey Schiebinger, Jian Shu, Marcin Tabaka, Brian Cleary, Vidya Subramanian, Aryeh Solomon, Joshua Gould, Siyan Liu, Stacie Lin, Peter Berube, et al. Optimal-transport analysis of single-cell gene expression identifies developmental trajectories in reprogramming. Cell, 176 (4):928–943, 2019.
448
+ [34] Richard Sinkhorn. A relationship between arbitrary positive matrices and doubly stochastic matrices. Ann. Math. Statist., 35:876–879, 1964.
449
+ [35] Justin Solomon, Gabriel Peyré, Vladimir G Kim, and Suvrit Sra. Entropic metric alignment for correspondence problems. ACM Transactions on Graphics (TOG), 35(4):1–13, 2016.
450
+ [36] Karl-Theodor Sturm. The space of spaces: curvature bounds and gradient flows on the space of metric measure spaces. arXiv preprint arXiv:1208.0434, 2012.
451
+ [37] Titouan Vayer, Laetita Chapel, Rémi Flamary, Romain Tavenard, and Nicolas Courty. Fused gromov-wasserstein distance for structured objects: theoretical foundations and mathematical properties. arXiv preprint arXiv:1811.02834, 2018.
452
+ [38] Titouan Vayer, Rémi Flamary, Romain Tavenard, Laetitia Chapel, and Nicolas Courty. Sliced gromov-wasserstein. arXiv preprint arXiv:1905.10124, 2019.
453
+ [39] Jonathan Weed and Francis Bach. Sharp asymptotic and finite-sample rates of convergence of empirical measures in wasserstein distance. Bernoulli, 25(4A):2620–2648, 2019.
454
+ [40] Hongteng Xu, Dixin Luo, and Lawrence Carin. Scalable gromov-wasserstein learning for graph partitioning and matching. arXiv preprint arXiv:1905.07645, 2019.
455
+ [41] Hongteng Xu, Dixin Luo, Hongyuan Zha, and Lawrence Carin Duke. Gromov-wasserstein learning for graph matching and node embedding. In International conference on machine learning, pages 6932–6941. PMLR, 2019.
456
+
457
+ # Checklist
458
+
459
+ 1. For all authors...
460
+
461
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] The main claim of the paper is a linear time (w.r.t. sample size, as commonly understood in OT) computation for GW. Sections $\ S 3 , 4$ and 5 build up that answer. This is experimentally validated across several experiments, both synthetic, to help the reader form intuitions, and on real data where GW was deemed useful.
462
+ (b) Did you describe the limitations of your work?[Yes] Because the GW problem is nonconvex, these limitations are naturally discussed in the experimental section, Section $\ S 6$ We discuss the effects of $\gamma$ and $\varepsilon$ on the method, which are not easy to parse due to the non-convexity of the method.
463
+ (c) Did you discuss any potential negative societal impacts of your work?[N/A] As a purely methodological paper, we do not envision potentially negative impact of this work on its own.
464
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them?[Yes] We have read these guidelines and confirm our paper does conform to them.
465
+
466
+ 2. If you are including theoretical results...
467
+
468
+ (a) Did you state the full set of assumptions of all theoretical results?[Yes] Our theoretical results are of two nature: a bound in Proposition 1, and a guarantee on convergence in Proposition 2, which has no direct consequence on our empirical findings, yet remain useful. Theory is not our main contribution, but rather algorithms.
469
+ (b) Did you include complete proofs of all theoretical results?[Yes] all proofs are in the appendix. Space in the main body of the paper was prioritized to include experimental validation, which, for this non-convex problem, we believe to be equally important.
470
+
471
+ 3. If you ran experiments...
472
+
473
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)?[Yes] We have included portions of the code that we have used. We pledge to make the entire code available later in the reviewing process.
474
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)?[Yes] The main contribution is compute efficiency, that we have considered across several parameter choices.
475
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)?[N/A] Our experiments are deterministic, since we use a predefined initialization.
476
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)?[Yes] The experiments were run with basic computational means, a macbook pro.
477
+
478
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
479
+
480
+ (a) If your work uses existing assets, did you cite the creators?[Yes] We have reused a single toolbox, and accessed data available publicly.
481
+ (b) Did you mention the license of the assets? [Yes] All licenses are open source, see supplementary.
482
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Yes, code is shared in the supplementary.
483
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes]
484
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
485
+
486
+ 5. If you used crowdsourcing or conducted research with human subjects...
487
+
488
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
489
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
md/train/rJgJDAVKvB/rJgJDAVKvB.md ADDED
@@ -0,0 +1,570 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING TO PLAN IN HIGH DIMENSIONS VIA NEURAL EXPLORATION-EXPLOITATION TREES
2
+
3
+ ∗Binghong Chen1, $\mathbf { \mathbf { \mathbf { \mathbf { \mathbf { \mathbf { B } } } } } } \mathbf { \mathbf { 0 } } \mathbf { \mathbf { \mathbf { \mathbf { D } } } } \mathbf { \mathbf { a } } \mathbf { i } ^ { 2 }$ , Qinjie $\mathbf { L i n ^ { 3 } }$ , Guo $\mathbf { Y e ^ { 3 } }$ , Han Liu3, Le Song1,4 1Georgia Institute of Technology 2Google Research, Brain Team 3Northwestern University 4Ant Financial
4
+
5
+ # ABSTRACT
6
+
7
+ We propose a meta path planning algorithm named Neural Exploration-Exploitation Trees (NEXT) for learning from prior experience for solving new path planning problems in high dimensional continuous state and action spaces. Compared to more classical sampling-based methods like RRT, our approach achieves much better sample efficiency in high-dimensions and can benefit from prior experience of planning in similar environments. More specifically, NEXT exploits a novel neural architecture which can learn promising search directions from problem structures. The learned prior is then integrated into a UCB-type algorithm to achieve an online balance between exploration and exploitation when solving a new problem. We conduct thorough experiments to show that NEXT accomplishes new planning problems with more compact search trees and significantly outperforms state-of-the-art methods on several benchmarks.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Path planning is a fundamental problem with many real-world applications, such as robot manipulation and autonomous driving. A simple planning problem within low-dimensional state space can be solved by first discretizing the continuous state space into a grid, and then searching for a path on top of it using graph search algorithms such as $A ^ { * }$ (Hart et al., 1968). However, due to the curse of dimensionality, these approaches do not scale well with the number of dimensions of the state space. For high-dimensional planning problems, people often resort to sampling-based approaches to avoid explicit discretization. Sampling-based planning algorithms, such as probabilistic roadmaps (PRM) (Kavraki et al., 1996), rapidly-exploring random trees (RRT) (LaValle, 1998), and their variants (Karaman & Frazzoli, 2011) incrementally build an implicit representation of the state space using probing samples. These generic algorithms typically employ a uniform sampler which does not make use of the structures of the problem. Therefore they may require lots of samples to obtain a feasible solution for complicated problems. To improve the sample efficiency, heuristic biased samplers, such as Gaussian sampler (Boor et al., 1999), bridge test (Hsu et al., 2003) and reachability-guided sampler (Shkolnik et al., 2009) have been proposed. All these sampling heuristics are designed manually to address specific structural properties, which may or may not be valid for a new problem, and may lead to even worse performance compared to the uniform proposal.
12
+
13
+ Online adaptation in path planning has also been investigated for improving sample efficiency in current planning problem. Specifically, Hsu et al. (2005) exploits online algorithms to dynamically adapts the mixture weights of several manually designed biased samplers. Burns & Brock (2005a;b) fit a model for the planning environment incrementally and use the model for planning. Yee et al. (2016) mimics the Monte-Carlos tree search (MCTS) for problems with continuous state and action spaces. These algorithms treat each planning problem independently, and the collected data from previous experiences and built model will be simply discarded when solving a new problem. However, in practice, similar planning problems may be solved again and again, where the problems are different but sharing common structures. For instance, grabbing a coffee cup on a table at different time are different problems, since the layout of paper and pens, the position and orientation of coffee cups may be different every time; however, all these problems show common structures of handling similar objects which are placed in similar fashions. Intuitively, if the common characteristics across problems can be learned via some shared latent representation, a planner based on such representation can then be transferred to new problems with improved sample efficiency.
14
+
15
+ Several methods have been proposed recently to learn from past planning experiences to conduct more efficient and generalizable planning for future problems. These works are limited in one way or the other. Zucker et al. (2008); Zhang et al. (2018); Huh & Lee (2018) treat the sampler in the sampling-based planner as a stochastic policy to be learned and apply policy gradient or TD-algorithm to improve the policy. Finney et al. (2007); Bowen & Alterovitz (2014); Ye & Alterovitz (2017); Ichter et al. (2018); Kim et al. (2018); Kuo et al. (2018) apply imitation learning based on the collected demonstrations to bias for better sampler via variants of probabilistic models, e.g., (mixture of) Gaussians, conditional VAE, GAN, HMM and RNN. However, many of these approaches either rely on specially designed local features or assume the problems are indexed by special parameters, which limits the generalization ability. Deep representation learning provides a promising direction to extract the common structure among the planning problems, and thus mitigate such limitation on handdesigned features. However, existing work, e.g., motion planning networks (Qureshi et al., 2019), value iteration networks (VIN) (Tamar et al., 2016), and gated path planning networks (GPPN) (Lee et al., 2018), either apply off-the-shelf MLP architecture ignoring special structures in planning problems or can only deal with discrete state and action spaces in low-dimensional settings.
16
+
17
+ In this paper, we present Neural EXploration-EXploitation Tree (NEXT), a meta neural path planning algorithm for high-dimensional continuous state space problems. The core contribution is a novel attention-based neural architecture that is capable of learning generalizable problem structures from previous experiences and produce promising search directions with automatic online exploration-exploitation balance adaption. Compared to existing learning-based planners,
18
+
19
+ • NEXT is more generic. We propose an architecture that can embed high dimensional continuous state spaces into low dimensional discrete spaces, on which a neural planning module is used to extract planning representation. These module will be learned end-to-end. • NEXT balances exploration-exploitation trade-off. We integrate the learned neural prior into an upper confidence bound (UCB) style algorithm to achieve an online balance between exploration and exploitation when solving a new problem.
20
+
21
+ Empirically, we show that NEXT can exploit past experiences to reduce the number of required samples drastically for solving new planning problems, and significantly outperforms previous state-of-the-arts on several benchmark tasks.
22
+
23
+ # 1.1 RELATED WORKS
24
+
25
+ Designing non-uniform sampling strategies for random search to improve the planning efficiency has been considered as we discussed above. Besides the mentioned algorithms, there are other works along this line, including informed RRT∗ (Gammell et al., 2014) and batch informed Trees $\mathrm { ( B I T ^ { * } ) }$ (Gammell et al., 2015) as the representative work. Randomized $A ^ { * }$ (Diankov & Kuffner, 2007) and sampling-based $A ^ { * }$ (Persson & Sharf, 2014) expand the search tree with hand-designed heuristics. These methods incorporate the human prior knowledge via hard-coded rules, which is fixed and unable to adapt to problems, and thus, may not universally applicable. Choudhury et al. (2018); Song et al. (2018) attempt to learn search heuristics. However, both methods are restricted to planning on discrete domains. Meanwhile, the latter one always employs an unnecessary hierarchical structure for path planning, which leads to inferior sample efficiency and extra computation.
26
+
27
+ The online exploration-exploitation trade-off is also an important issue in planning. For instance, Rickert et al. (2009) constructs a potential field sampler and tuned the sampler variance based on collision rate for the trade-off heuristically. Paxton et al. (2017) separates the action space into high-level discrete options and low-level continuous actions, and only considered the trade-off at the discrete option level, ignoring the exploration-exploitation in the fine action space. These existing works address the trade-off in an ad-hoc way, which may be inferior for the balance.
28
+
29
+ There have been sevearl non-learning-based planning methods that can also leverage experiences (Kavraki et al., 1996; Phillips et al., 2012) by utilizing search graphs created in previous problems. However, they are designed for largely fixed obstacles and cannot be generalized to unseen tasks from the same planning problems distribution.
30
+
31
+ # 2 SETTINGS FOR LEARNING TO PLAN
32
+
33
+ Let $S \subseteq \mathbb { R } ^ { q }$ be the state space of the problem, e.g., all the configurations of a robot and its base location in the workspace, $S _ { o b s } \subsetneq S$ be the obstacles set, $S _ { f r e e } : = \mathcal { S } \setminus \mathcal { S } _ { o b s }$ be the free space, $s _ { i n i t } \in S _ { f r e e }$ be the initial state and $\mathcal { S } _ { g o a l } \subsetneq S _ { f r e e }$ be the goal region. Then the space of all collisionfree paths can be defined as a continuous function $\Xi : = \{ \bar { \xi } ( \cdot ) : \bar { [ 0 , 1 ] } S _ { f r e e } \}$ . Let $c \left( \cdot \right) : \Xi \mapsto \mathbb { R }$ be the cost functional over a path. The optimal path planning problem is to find the optimal path in terms of cost $c ( \cdot )$ from start $s _ { i n i t }$ to goal $\mathcal { S } _ { g o a l }$ in free space $\boldsymbol { S } _ { f r e e }$ , i.e.,
34
+
35
+ $$
36
+ \begin{array} { r } { \xi ^ { * } = \mathrm { a r g m i n } _ { \xi \in \Xi } \ c \left( \xi \right) , \quad \mathrm { s . t . } \xi ( 0 ) = s _ { i n i t } , \xi ( 1 ) \in S _ { g o a l } . } \end{array}
37
+ $$
38
+
39
+ Traditionally (Karaman & Frazzoli, 2011), the planner has direct access to $( s _ { i n i t } , S _ { g o a l } , c \left( \cdot \right) )$ and the workspace map (Ichter et al., 2018; Tamar et al., 2016; Lee et al., 2018), $\mathtt { m a p } ( \cdot ) : \mathbb { R } ^ { 2 }$ or $\mathbb { R } ^ { 3 } \mapsto \{ 0 , 1 \}$ , (0: free spaces and 1: obstacles). Since $\boldsymbol { S } _ { f r e e }$ often has a very irregular geometry (illustrated in Figure 10 in Appendix A), it is usually represented via a collision detection module which is able to detect the obstacles in a path segment. For the same reason, the feasible paths in $\Xi$ are hard to be described in parametric forms, and thus, the nonparametric $\xi$ , such as a sequence of interconnected path segments $\left[ s _ { 0 } , s _ { 1 } \right] , \left[ s _ { 1 } , s _ { 2 } \right] , \ldots , \left[ s _ { T - 1 } , s _ { T } \right] \subset \mathcal { S }$ with $\xi ( 0 ) = s _ { 0 } = s _ { i n i t }$ and $\xi ( 1 ) = s _ { T }$ , is used with an additive cost $\textstyle \sum _ { i = 1 } ^ { T } c \left( \left[ s _ { i - 1 } , s _ { i } \right] \right)$ −.
40
+
41
+ Assuming given th planning problems $\{ U _ { i } : = ( s _ { i n i t } , S _ { g o a l } , S , S _ { f r e e } , \mathtt { m a p } , c \left( \cdot \right) ) \} _ { i = 1 } ^ { N }$ sampled from some distribution $\mathcal { U }$ , we are interested in learning an algorithm $\mathsf { a l g } \left( \cdot \right)$ , which can produce the (nearly)-optimal path efficiently from the observed planning problems. Formally, the learning to plan is defined as
42
+
43
+ $$
44
+ \begin{array} { r } { \mathbf { a } \mathbf { 1 g } ^ { * } \left( \cdot \right) = \operatorname * { a r g m i n } _ { \mathbf { a } \mathbf { 1 g } \in \mathcal { A } } \mathbb { E } _ { U \in \mathcal { U } } \left[ \ell \left( \mathbf { a } \mathbf { 1 g } ( U ) \right) \right] , } \end{array}
45
+ $$
46
+
47
+ where $\mathcal { A }$ denotes the planning algorithm family, and $\ell \left( \cdot \right)$ denotes some loss function which evaluates the quality of the generated path and the efficiency of the $\mathsf { a l g } \left( \cdot \right)$ , e.g., size of the search tree. We elaborate each component in Eq (2) in the following sections. We first introduce the tree-based sampling algorithm template in Section 3, upon which we instantiate the $\mathsf { a l g } \left( \cdot \right)$ via a novel attention-based neural parametrization in Section 4.2 with exploration-exploitation balance mechanism in Section 4.1. We design the $\ell$ -loss function and the meta learning algorithm in Section 4.3. Composing every component together, we obtain the neural exploration-exploitation trees (NEXT) which achieves outstanding performances in Section 5. Repeat
48
+
49
+ ![](images/c81f5245215344ac0251524c1e65b7b0d359bb22ec9a016d0918f1939b8a9b94.jpg)
50
+ Figure 1: Illustration of NEXT. In each epoch, NEXT is executed on a randomly generated planning problem. The search tree grows with $\tilde { V } ^ { * }$ and $\tilde { \pi } ^ { * }$ guidance. $\{ \tilde { V } ^ { * } , \tilde { \pi } ^ { * } \}$ will be updated according to the successful path. Such planning and learning iteration is continued interactively.
51
+
52
+ # 3 PRELIMINARIES
53
+
54
+ # 1 Problem:
55
+
56
+ # Algorithm 1: Tree-based Sampling Algorithm
57
+
58
+ The sampling-based planners are more practical and become dominant for high-dimensional path planning problems (Elbanhawi & Simic, 3 2014). We describe a unifying view for many 4 existing tree-based sampling algorithms (TSA), 5 which we will also base our algorithm upon. More specifically, this family of algorithms 6 maintain a search tree $\tau$ rooted at the initial point $s _ { i n i t }$ and connecting all sampled points $\nu$ 7 in the configuration space with edge set $\mathcal { E }$ . The 8 tree will be expanded by incorporating more sampled states until some leaf reaches $\mathcal { S } _ { g o a l }$ 9. Then, a feasible solution for the path planning
59
+
60
+ $U = ( s _ { i n i t } , S _ { g o a l } , S , S _ { f r e e } , \mathrm { { m a p } , \it { c ( \cdot ) } ) }$ ;
61
+ 2 Initialize $\boldsymbol { \mathcal { T } } = ( \boldsymbol { \mathcal { V } } , \boldsymbol { \mathcal { E } } )$ with $\mathcal { V } \{ s _ { i n i t } \}$ , $\mathcal { E } \emptyset$ ;
62
+ for $t \gets 0$ to $T$ do sparent, $s _ { n e w } \mathrm { E }$ xpand $( \mathcal { T } , U )$ ; if ObstacleFree( $\prime s _ { p a r e n t } , s _ { n e w } )$ ) then $\mathcal { V } \mathcal { V } \cup \{ s _ { n e w } \}$ and $\mathcal { E } \mathcal { E } \cup \{ [ s _ { p a r e n t } , s _ { n e w } ] \}$ ; T ← Postprocess(T , U) ; $\triangleright$ Optional if $s _ { n e w } \in S _ { g o a l }$ then return T ;
63
+
64
+ problem will be extracted based on the tree $\tau$ . The template of tree-based sampling algorithms is summarized in Algorithm 1 and illustrated in Fig. 1(c). A key component of the algorithm is the Expand operator, which generates the next exploration point $s _ { n e w }$ and its parent $s _ { p a r e n t } \in \mathcal { V }$ . To ensure the feasibility of the solution, the $s _ { n e w }$ must be reachable from $\tau$ , i.e., $[ \bar { s _ { p a r e n t } } , s _ { n e w } ]$ is collision-free, which is checked by a collision detection function. As we will discuss in Appendix B, by instantiating different Expand operators, we will arrive at many existing algorithms, such as RRT (LaValle, 1998) and EST (Hsu et al., 1997; Phillips et al., 2004).
65
+
66
+ One major limitation of existing TSAs is that they solve each problem independently from scratch and ignore past planning experiences in similar environments. We introduce the neural components into TSA template to form the learnable planning algorithm family $\mathcal { A }$ , which can explicitly take advantages of the past successful experiences to bias the Expand towards more promising regions.
67
+
68
+ # 4 NEURAL EXPLORATION-EXPLOITATION TREES
69
+
70
+ Based on the TSA framework, we introduce a learnable neural based Expand operator, which can balance between exploration and exploitation, to instantiate $\mathcal { A }$ in Eq (2). With the self-improving training, we obtain the meta NEXT algorithm illustrated in Figure 1.
71
+
72
+ # 4.1 GUIDED PROGRESSIVE EXPANSION
73
+
74
+ We start with our design of the Expand. We assume having an estimated value function ${ \tilde { V } } ^ { * } ( s | U )$ , which stands for the optimal cost from $s$ to target in planning problem $U$ , and a policy $\tilde { \pi } ^ { * } \left( s ^ { \prime } | s , U \right)$ , which generates the promising action $s ^ { \prime }$ from state $s$ . The concrete parametriza
75
+
76
+ <table><tr><td>Algorithm 2: NExT :: Expand(T = (V,ε),U)</td></tr><tr><td>Sparent ← argmaxs∈vΦ(s) ; Selection</td></tr><tr><td>{s1,*..,Sk} id π*(s&#x27;sparent,U); &gt;Candidates</td></tr><tr><td> Snew ← argmaxs&#x27;∈{s1,.,sk}(s&#x27;); DExpansion</td></tr><tr><td>4 return Sparent, Snew;</td></tr></table>
77
+
78
+ tion of ${ \tilde { V } } ^ { * }$ and $\tilde { \pi } ^ { * }$ will be explained in Section 4.2 and learned in Section 4.3. We will use these functions to construct the learnable Expand with explicit exploration-exploitation balancing.
79
+
80
+ The Expand operator will expand the current search tree $\tau$ by a new neighboring state $s _ { n e w }$ around $\tau$ . We design the expansion as a two-step procedure: (i) select a state $s _ { p a r e n t }$ from existing tree $\tau$ ; (ii) expand a state $s _ { n e w }$ in the neighborhood of $s _ { p a r e n t }$ . More specifically,
81
+
82
+ Selecting $s _ { p a r e n t }$ from $\tau$ in step (i). Consider the negative value function $- \tilde { V } ^ { \ast } \left( s | U \right)$ as the rewards $r \left( s \right)$ , step (i) shares some similarity with the multi-armed bandit problem by viewing existing nodes $s \in \mathcal V$ as arms. However, the vanilla UCB algorithm is not directly applicable, since the number of states is increasing as the algorithm proceeds and the value of these adjacent states are naturally correlated. We address this challenge by modeling the correlation explicitly as in contextual bandits. Specifically, we parametrize the UCB of the reward function as $\phi \left( s \right)$ , and select a node from $\tau$ according to $\phi ( s )$
83
+
84
+ $$
85
+ \begin{array} { r } { s _ { p a r e n t } = \mathrm { a r g m a x } _ { s \in \mathcal { V } } \phi ( s ) : = \bar { r } _ { t } \left( s \right) + \lambda \sigma _ { t } \left( s \right) , } \end{array}
86
+ $$
87
+
88
+ t t the sequence of where and denote the average reward and variance estimator after $t$ selected tree nodes so far as $S _ { t } = \{ s _ { p a r e n t } ^ { 1 } , . . . , s _ { p a r e n t } ^ { t } \}$ $t$ -calls to Expand. Denote , then we can use kernel smoothing estimator for $\begin{array} { r } { \bar { r } _ { t } ( s ) = \frac { \sum _ { s ^ { \prime } \in { \mathcal S } _ { t } } k \left( s ^ { \prime } , s \right) r \left( s ^ { \prime } \right) } { \sum _ { s ^ { \prime } \in { \mathcal S } _ { t } } k \left( s ^ { \prime } , s \right) } } \end{array}$ and $\begin{array} { r } { \sigma _ { t } ( s ) = \sqrt { \frac { \log { \sum _ { s ^ { \prime } \in { \mathcal S } _ { t } } w ( s ^ { \prime } ) } } { w ( s ) } } } \end{array}$ where $k ( s ^ { \prime } , s )$ is a kernel function and $\begin{array} { r } { w ( s ) = \sum _ { s ^ { \prime } \in S _ { t } } k ( s ^ { \prime } , s ) } \end{array}$ . Other parametrizations of $\bar { r } _ { t }$ and $\sigma _ { t }$ are also possible, such as Gaussian Process parametrization in Appendix C. The average reward exploits more promising states, while the variance promotes exploration towards less frequently visited states; and the exploration versus exploitation is balanced by a tunable weight $\lambda > 0$ .
89
+
90
+ Expanding a reachable $s _ { n e w }$ in step (ii). Given the selected $s _ { p a r e n t }$ , we consider expanding a reachable state in the neighborhood $s _ { p a r e n t }$ as an infinite-armed bandit problem. Although one can first samples $k$ arms uniformly from a neighborhood around $s _ { p a r e n t }$ and runs a UCB algorithm on the randomly generated finite arms (Wang et al., 2009), such uniform sampler ignores problem structures, and will lead to unnecessary samples. Instead we will employ a policy $\bar { \tilde { \pi } } ^ { * } ( s ^ { \prime } \vert s , \bar { U } ) ^ { 1 }$ for guidance when generating the candidates. The final choice for next move will be selected from these candidates with max $\phi \left( s \right)$ defined in (3). As explained in more details in Section 4.2, $\tilde { \pi } ^ { * }$ will be trained to mimic previous successful planning experiences across different problems, that is, biasing the sampling towards the states with higher successful probability.
91
+
92
+ ![](images/659fdd9f888e78d83e6532bb1c8c3abf8ec8cc26808c966e6aef6311a6ac402b.jpg)
93
+ Figure 2: Our neural network model maps a $N$ -link robot from the original planning space (a $( N + 2 )$ -d configuration space) to a 3d discrete latent planning space in which we plan a path using value iteration. The result of value iteration is then used as features for defining $\tilde { V } ^ { * } \left( s | U \right)$ and $\tilde { \pi } ^ { * } \left( s ^ { \prime } | s , U \right)$ .
94
+
95
+ With these detailed step (i) and (ii), we obtain NEXT :: Expand in Algorithm 2 (illustrated in Figure 1(b) and (c)). Plugging it into the TSA in 1, we construct $\tt a l g \left( \cdot \right) \in \mathcal { A }$ which will be learned.
96
+
97
+ The guided progressive expansion bears similarity to MCTS but deals with high dimensional continuous spaces. Moreover, the essential difference lies in the way to select state in $\tau$ for expansion: the MCTS only expands the leaf states in $\tau$ due to the hierarchical assumption, limiting the exploration ability and incurring extra unnecessary UCB sampling for internal traversal in $\tau$ ; while the proposed operation enables expansion from each visited state, particularly suitable for path planning problems.
98
+
99
+ # 4.2 NEURAL ARCHITECTURE FOR VALUE FUNCTION AND EXPANSION POLICY
100
+
101
+ In this section, we will introduce our neural architectures for $\tilde { V } ^ { * } \left( s | U \right)$ and $\tilde { \pi } ^ { * } \left( s ^ { \prime } | s , U \right)$ used in NEXT :: Expand. The proposed neural architectures can be understood as first embedding the state and problem into a discrete latent representation via an attention-based module in Section 4.2.1, upon which the neuralized value iteration, introduced in Section 4.2.2, is performed to extract features for defining $\tilde { V } ^ { * } \left( s | U \right)$ and $\tilde { \pi } ^ { * } \left( s ^ { \prime } | s , U \right)$ , as illustrated in Figure 2.
102
+
103
+ # 4.2.1 CONFIGURATION SPACE EMBEDDING
104
+
105
+ Our network for embedding high-dimension configuration space into a latent representation is designed based on an attention mechanism. More specifically, let $s ^ { w }$ denote the workspace in state and ${ \bf \bar { \Phi } } _ { s } h$ denote the remaining dimensions of the state, i.e. $s = \mathbf { \bar { \rho } } ( s ^ { w } , s ^ { h } )$ . $s ^ { w }$ and $s ^ { h }$ will be embedded by different sub-neural networks and combined for the final representation, as illustrated in Figure 3. For simplicity of exposition, we will focus on the 2d workspace, i.e., $s ^ { w } \in \mathbb { R } ^ { 2 }$ . However, our method applies to 3d workspace as well.
106
+
107
+ ![](images/1f9670de482ed991ba97956d7ebba8ef1a8b77c6a4180f100db30cdc84a6e86c.jpg)
108
+ Figure 3: Attention-based state embedding module. $\boldsymbol { s } ^ { w } = ( x , y )$ and $\mathbf { z } = s ^ { h }$ . The upper part is spatial attention, with the first two channels being $_ x$ and $_ y$ , and the last two channels being constant templates with the row and column coordinates, as shown with a $d$ set to 3. The bottom module learns the representation for $\mathbf { z }$ . The final embedding is obtained by outer-product of these two attention parts.
109
+
110
+ • Spatial attention. The workspace information $s ^ { w }$ will be embedded as $\mu ^ { w } ( s ^ { w } ) \in \mathbb { R } ^ { d \times d }$ , $d$ is a hyperparameter related to map (see remark below). The spatial embedding module (upper part in Figure 3) is composed of $k _ { w }$ convolution layers, i.e.,
111
+
112
+ $$
113
+ \mu ^ { w } ( s ^ { w } ) = { \tt s o f t m a x 2 d } ( f _ { k _ { w } } ^ { w } ( s ^ { w } ) ) , \qquad f _ { i + 1 } ^ { w } ( s ^ { w } ) = { \tt r e l u } ( \theta _ { i } ^ { w } \oplus f _ { i } ^ { w } ( s ^ { w } ) ) ,
114
+ $$
115
+
116
+ where $\theta _ { i } ^ { w }$ denotes the convolution kernels, $\oplus$ denotes the convolution operator and $f _ { i } ^ { w } ( s ^ { w } ) \in$ $\mathbb { R } ^ { d \times d \times d _ { i } }$ with $d _ { i }$ channels. The first layer $f _ { 0 } ^ { w }$ is designed to represent $s ^ { w }$ into a $d \times d \times 4$ tensor as $f _ { 0 } ^ { w } ( s ^ { w } ) _ { i j } = [ s _ { 1 } ^ { w } , s _ { 2 } ^ { w } , i , j ] , i , j = 1 , \ldots , a$ 0, without any loss of information.
117
+
118
+ ![](images/e690ebd6ddc08b67ba7f0c4c102d2ba25dbff64c677153964eecb7a40240d491.jpg)
119
+ Figure 4: Overall model architecture. Current and goal states are embedded through attention module. Then the embedding of the goal state is concatenated with the map to produce $\nu ^ { * ( 0 ) }$ and $\bar { \tilde { \boldsymbol { R } } }$ as the input to the planning module. The output of the planning module is aggregated with the embedding of the current state to produce feature $\psi ( s )$ for defining $\tilde { V } ^ { \ast }$ and $\tilde { \pi } ^ { * }$ .
120
+
121
+ • Configuration attention. The remaining configuration state information will be embedded as $\mu ^ { h } ( s ^ { h } )$ through $k _ { h }$ fully-connected layers (bottom-left part in Figure 3), i.e.
122
+
123
+ $$
124
+ \mu ^ { h } ( s ^ { h } ) = \mathsf { s o f t m a x } ( f _ { k _ { h } } ^ { h } ( s ^ { h } ) ) , \qquad f _ { i + 1 } ^ { h } ( s ^ { h } ) = \mathtt { r e l u } ( \theta _ { i } ^ { h } f _ { i } ^ { h } ( s ^ { h } ) + b _ { i } ) ,
125
+ $$
126
+
127
+ where $\mu ^ { h } ( s ^ { h } ) \in \mathbb { R } ^ { d _ { a } }$ and $f _ { 0 } ^ { h } ( s ^ { h } ) = s ^ { h }$ .
128
+
129
+ The final representation $\mu _ { \boldsymbol { \theta } } ( s )$ will be obtained by multiplying $\mu ^ { w } ( s ^ { w } )$ with $\mu ^ { h } ( s ^ { h } )$ element-wisely, $\mu _ { \boldsymbol \theta } ( s ) _ { i j l } = \bar { \mu } ^ { w } ( s ^ { w } ) _ { i j } \cdot \bar { \mu } ^ { h } ( \bar { s } ^ { h } ) _ { l }$ , which is a $d \times d \times d _ { a }$ tensor attention map with $\mu _ { \theta } ( s ) _ { i j l } \geqslant$ 0, and $\begin{array} { r } { \sum _ { i j l } \mu _ { \theta } ( s ) _ { i j l } = 1 } \end{array}$ (bottom-right part in Figure 3). Intuitively, one can think of $d _ { a }$ as the level of the learned discretization of the configuration space $s ^ { h }$ , and the entries in softly assign the actual state $s$ to these discretized locations. $\theta : = ( \{ \theta _ { i } ^ { w } \} _ { i = 0 } ^ { k _ { w } - 1 } , \{ \theta _ { i } ^ { h } , b _ { i } \} _ { i = 0 } ^ { k _ { h } - 1 } )$ are the parameters to be
130
+
131
+ Remark (different map size): To process map using convolution neural networks, we resize it to a $d \times d$ image, with the same size as the spatial attention in Eq (4), where $d$ is a hyperparameter.
132
+
133
+ # 4.2.2 NEURAL VALUE ITERATION
134
+
135
+ We then apply neuralized value iteration on top of the configuration space embedding to extract further planning features (Tamar et al., 2016; Lee et al., 2018). Specifically, we first produce the embedding $\mu _ { \theta } \big ( s _ { g o a l } \big )$ of the center of the goal region $s _ { g o a l }$ . We execute $T$ steps of neuralized Bellman updates (planning module in Figure 4) in the embedding space,
136
+
137
+ $$
138
+ \nu ^ { * ( t ) } = \operatorname* { m i n } \left( W _ { 1 } \oplus \left[ \nu ^ { * ( t - 1 ) } , \tilde { R } \right] \right) , \quad \mathrm { w i t h } \quad \left( \nu ^ { * ( 0 ) } , \tilde { R } \right) = \sigma \left( W _ { 0 } \oplus \left[ \mu _ { \theta } \big ( s _ { g o a l } \big ) , \mathtt { m a p l } \right) \right) ,
139
+ $$
140
+
141
+ and obtain $\nu ^ { * ( T ) } \in \mathbb { R } ^ { d \times d \times d _ { a } \times p }$ . Both $W _ { 0 }$ and $W _ { 1 }$ are 3d convolution kernels, min implements the pooling across channels. Accordingly, $\nu ^ { * ( T ) }$ now can be understood as a latent representation of the value function $\tilde { V } ^ { * } ( \cdot )$ in learned embedding space for the problem $U$ with $s _ { g o a l }$ in map.
142
+
143
+ To define the value function for particular state $s$ , i.e., $\tilde { V } ^ { * } \left( s | U \right)$ , from the latent representation $\nu ^ { * ( T ) }$ , we first construct another attention model between the embedding of state $s$ using $\mu _ { \boldsymbol { \theta } } ( s )$ and $\nu ^ { * ( T ) }$ , i.e., $\begin{array} { r } { \psi \left( s \right) _ { k } = \sum _ { i j l } \nu _ { i j l k } ^ { * ( T ) } \cdot \mu _ { \theta } \left( s \right) _ { i j l } } \end{array}$ , for $k = 1 , \hdots , p$ . Finally we define
144
+
145
+ $$
146
+ \tilde { V } ^ { \ast } \left( s | U \right) = h _ { W _ { 2 } } \left( \psi ( s ) \right) , \quad \mathrm { a n d } \quad \tilde { \pi } ^ { \ast } \left( s ^ { \prime } | s , U \right) = \mathcal { N } \left( h _ { W _ { 3 } } \left( \psi ( s ) \right) , \sigma ^ { 2 } \right)
147
+ $$
148
+
149
+ where $h _ { W _ { 2 } }$ and $h _ { W _ { 3 } }$ are fully connected dense layers with parameters $W _ { 2 }$ and $W _ { 3 }$ respectively, and $\mathcal { N } ( h _ { W _ { 3 } } \left( \psi ( s ) \right) , \sigma ^ { 2 } )$ is a Gaussian distribution with variance $\sigma ^ { 2 }$ . Note that we also parametrize the policy $\tilde { \pi } ^ { * } \left( s ^ { \prime } | s , U \right)$ using the embedding $\nu ^ { * ( T ) }$ , since the policy is connected to the value function via $\begin{array} { r } { \pi ^ { * } \left( s ^ { \prime } | s , U \right) = \mathrm { a r g m i n } _ { s ^ { \prime } \in S } c \left( \left[ s , s ^ { \prime } \right] \right) + V ^ { * } \left( s ^ { \prime } | U \right. } \end{array}$ ). It should also be emphasized that in our parametrization, the calculation of $\nu ^ { * ( T ) }$ only relies on the $\mu _ { \theta } \left( s _ { g o a l } \right)$ , which can be reused for evaluating $\tilde { V } ^ { * } \left( s | U \right)$ and $\tilde { \pi } ^ { * } \left( s ^ { \prime } | s , U \right)$ over different $s$ , saving computational resources. Using this trick the algorithm runs $1 0 \times - 1 0 0 \times$ faster empirically.
150
+
151
+ The overall model architecture in $\mathsf { a l g } \left( \cdot \right)$ is illustrated in Figure 4. The parameters $W =$ $( W _ { 0 } , W _ { 1 } , W _ { 2 } , W _ { 3 } , \theta )$ will be learned together by our meta self-improving learning. For the details of the parameterization and the size of convolution kernels in our implementation, please refer to Figure 12 in Appendix D.
152
+
153
+ # 4.3 META SELF-IMPROVING LEARNING
154
+
155
+ The learning of the planner $\mathsf { a l g } \left( \cdot \right)$ reduces to learning the parameters in $\tilde { V } ^ { * } \left( s | U \right)$ and $\tilde { \pi } ^ { * } \left( s ^ { \prime } | s , U \right)$ and is carried out while planning experiences accumulate. We do not have an explicit training and testing phase separation. Particularly, we use a mixture of RRT :: Expand and NEXT :: Expand with probability $\epsilon$ and $1 - \epsilon$ , respectively, inside the TSA framework in Algorithm 1. The RRT∗ postprocessing step is used in the template. The $\epsilon$ is set to be 1 initially since $\{ \tilde { V } ^ { * } , \tilde { \pi } ^ { * } \}$ are not well-trained, and thus, the algorithm behaves like $\mathbf { R R T ^ { * } }$ . As the training proceeds, we anneal $\epsilon$ gradually as the sampler becomes more efficient.
156
+
157
+ The dataset $\mathcal { D } _ { n } = \{ ( \mathcal { T } _ { j } , U _ { j } ) \} _ { j = 1 } ^ { n }$ for the $n$ -th training epoch is collected from the previous successful planning experiences across multiple random problems. We fix the size of dataset and update $\mathcal { D }$ in the same way as experience reply buffer (Lin, 1992; Schaul et al., 2015). For an experience $( { \mathcal { T } } , U ) \in { \mathcal { D } } _ { n }$ , we can reconstruct the successful path $\{ s ^ { i } \} _ { i = 1 } ^ { m }$ from the search tree $\tau$ ( $\mathrm { ~ m ~ }$ is the region, i.e., number of segments), and the value of each state $\begin{array} { r } { y ^ { i } : = \sum _ { l = i } ^ { m - 1 } c ( [ s ^ { l } , s ^ { l + 1 } ] ) } \end{array}$ . We learn $\{ \tilde { V } ^ { * } , \tilde { \pi } ^ { * } \}$ $s ^ { i }$ in the path will be the sum of cost to the goal by optimizing objective
158
+
159
+ $$
160
+ \operatorname* { m i n } _ { W } \sum _ { ( { \cal T } , { \cal U } ) \in { \mathcal D } _ { n } } \ell ( \tilde { V } ^ { * } , \tilde { \pi } ^ { * } ; { \cal T } , { \cal U } ) : = - \sum _ { { \mathcal D } _ { n } } \sum _ { i = 1 } ^ { m - 1 } \log \tilde { \pi } ^ { * } \left( s ^ { i + 1 } | s ^ { i } \right) + \sum _ { i = 1 } ^ { m } ( \tilde { V } ^ { * } \left( s ^ { i } \right) - y ^ { i } ) _ { 2 } ^ { 2 } + \lambda \left\| { \cal W } \right\| ^ { 2 } .
161
+ $$
162
+
163
+ The loss (6) pushes the ${ \tilde { V } } ^ { * }$ and $\tilde { \pi } ^ { * }$ to chase the successful trajectories, providing effective guidance in $\mathsf { a l g } \left( \cdot \right)$ for searching, and therefore leading to efficient searching procedure with less sample complexity and better solution. On one hand, the value function and policy estimation $\{ \tilde { V } ^ { * } , \tilde { \pi } ^ { * } \}$ is improved based upon the successful outcomes from NEXT itself on previous problems. On the other hand, the updated $\{ \tilde { V } ^ { * } , \bar { \pi } ^ { * } \}$ will be applied in the next epoch to improve the performance. Therefore, the training is named as Meta Self-Improving Learning (MSIL). Since all the trajectories we collected for learning are feasible, the reachability of the proposed samples is enforced implicitly via imitating these successful paths.
164
+
165
+ By putting every components together into the 10 learning to plan framework in Eq (2), the over
166
+
167
+ # Algorithm 3: Meta Self-Improving Learning
168
+
169
+ 1 Initialize dataset $\mathcal { D } _ { 0 }$ ;
170
+ $^ 2$ for epoch $n \gets 1$ to $N$ do
171
+ $^ 3$ Sample a planning problem $U$ ;
172
+ 4 $\mathcal { T } \mathrm { T S A } ( U )$ with $\epsilon \sim \mathcal { U } n i f [ 0 , 1 ]$ , and $\epsilon$ ·RRT :: Expand $+ ( 1 - \epsilon )$ ·NEXT :: Expand; Postprocessing with $\mathbb { R R T } ^ { * }$ :: Postprocess;
173
+ 5 ${ \mathcal { D } } _ { n } \gets { \mathcal { D } } _ { n - 1 } \bar { \cup } \{ ( { \mathcal { T } } , U ) \}$ if successful else $\mathcal { D } _ { n - 1 }$ ;
174
+ 6 for $j 0$ to $L$ do
175
+ 7 Sample Reconst $( \tau _ { j } , U _ { j } )$ from -optim $\mathcal { D } _ { n }$ ;path $\{ s ^ { i } \} _ { i = 1 } ^ { m }$ and the cost of paths based on $\tau _ { j }$ ;
176
+ 9 Update parameters $W W - \eta \nabla _ { W } \ell ( \tilde { V } ^ { * } , \tilde { \pi } ^ { * } ; T _ { j } , U _ { j } ) ;$ Anneal $\epsilon = \alpha \epsilon$ , $\alpha \in ( 0 , 1 )$ ;
177
+
178
+ all procedure is summarized in Algorithm 3 and illustrated in Figure 1.
179
+
180
+ # 5 EXPERIMENTS
181
+
182
+ In this section, we evaluate the proposed NEXT empirically on different planning tasks in a variety of environments. Comparing to the existing planning algorithms, NEXT achieves the state-of-the-art performances, in terms of both success rate and the quality of the found solutions. We further demonstrate the power of the proposed two components by the corresponding ablation study. We also include a case study on a real-world robot arm control problem at the end of the section.
183
+
184
+ # 5.1 EXPERIMENT SETUP
185
+
186
+ Benchmark environments. We designed four benchmark tasks to demonstrate the effectiveness of our algorithm for high-dimensional planning. The first three involve planning in a 2d workspace with a 2 DoF (degrees of freedom) point robot, a 3 DoF stick robot and a 5 DoF snake robot, respectively. The last one involves planning a 7 DoF spacecraft in a 3d workspace. For all problems in each benchmark task, the workspace maps were randomly generated from a fixed distribution; the initial and goal states were sampled uniformly randomly in the free space; the cost function $c \left( \cdot \right)$ was set as the sum of the Euclidean path length and the control effort penalty of rotating the robot joints.
187
+
188
+ Baselines. We compared NEXT with RRT∗ (Karaman & Frazzoli, 2011), $\mathrm { B I T ^ { * } }$ (Gammell et al., 2015), CVAE-plan (Ichter et al., 2018), Reinforce-plan (Zhang et al., 2018), and an improved version of GPPN (Lee et al., 2018) in terms of both planning time and solution quality. RRT∗ and $\mathrm { B I T ^ { * } }$ are two widely used effective instances of TSA in Algorithm 1. In our experiments, we equipped $\mathrm { R R T ^ { * } }$ with the goal biasing heuristic to improve its performance. $\mathrm { B I T ^ { * } }$ adopts the informed search strategy (Gammell et al., 2015) to accelerate planning. CVAE-plan and Reinforce-plan are two learning-enhanced TSA planners proposed recently. CVAE-plan learns a conditional VAE as the sampler (Sohn et al., 2015), which will be trained by near-optimal paths produced by $\mathbf { R R T ^ { * } }$ . Reinforce-plan learns to do rejection sampling with policy gradient methods. For the improved GPPN, we combined its architecture for map with a fully-connected MLP for the rest state, such that it can be applied to high-dimensional continuous spaces. Please refer to Appendix E for more details.
189
+
190
+ ![](images/b0b18ba9b0a2a21dab4fe0925d12969b8bbd06feb8546ddafdca1a81131ba122.jpg)
191
+ Figure 5: Search trees and the learned ${ \tilde { V } } ^ { * }$ and $\tilde { \pi } ^ { * }$ produced by NEXT. Obstacles are colored in blue. The start and goal locations are denoted by orange and brown dots. In (a) to (c), samples are represented with yellow circles. In (d), the level of redness denotes the value of the cost-to-go estimate $\tilde { V } ^ { * }$ . The cyan arrows point from a given state $s$ to the mean of the learned policy $\tilde { \pi } ^ { * } ( s ^ { \prime } | s , U )$ .
192
+
193
+ ![](images/e9b64d33b209ec3b631b087dbd2e5d1f20da83a228d5b5ee93466c67d2fe104a.jpg)
194
+ Figure 6: Search trees and a solution path produced in an instance of spacecraft planning. The 7 DOF spacecraft has a yellow body and two 2 DOF red arms. NEXT-KS produced a nearly minimum viable search tree while ${ \mathrm { R R T } } ^ { * }$ failed to find a path within limited trials.
195
+
196
+ Settings. For each task, we randomly generated 3000 different problems from the same distribution without duplicated maps. We trained all learning-based baselines using the first 2000 problems, and reserved the rest for testing. The parameters for $\mathrm { { R R T ^ { * } } }$ and $\mathrm { B I T ^ { * } }$ are also tuned using the first 2000 problems. For NEXT, we let it improve itself using MSIL over the first 2000 problems. In this period, for every 200 problems, we updated its parameters and annealed $\epsilon$ once.
197
+
198
+ # 5.2 RESULTS AND ANALYSIS
199
+
200
+ Comparison results. Examples of all four environments are illustrated in Appendix F.1 and Figure 6, where NEXT finds high-quality solutions as shown. We also illustrated the comparison of the search trees on two 2d and 7d planning tasks between NEXT and RRT\* in Figure 5 (a)-(c) and Figure 6 (b) and (c). Obviously, the proposed NEXT algorithm explores with guidance and achieves better quality solutions with fewer samples, while the RRT\* expands randomly which may fail to find a solution. The learned ${ \tilde { V } } ^ { * }$ and $\tilde { \pi } ^ { * }$ in the 2d task are also shown in Figure 5(d). As we can see, they are consistent with our expectation, towards the ultimate target in the map. For more search tree comparisons for all four experiments, please check Figure 18, 19, 20 and 21 in Appendix F.
201
+
202
+ To systematically evaluate the algorithms, we recorded the cost of time (measured by the number of collision checks used) to find a collision-free path, the success rate within time limits, and the cost of the solution path for each run. The results of the reserved 1000 test problems of each environment are shown in the top row of Figure 7. We set the maximal number of samples as 500 for all algorithms. Both the kernel smoothing (NEXT-KS) and the Gaussian process (NEXT-GP) version of NEXT achieves the state-of-the-art performances, under all three criteria in all test environments. Although the $\mathrm { B I T ^ { * } }$ utilizes the heuristic particularly suitable for 3d maze in 7d task and performs quite well, the NEXT algorithm still outperform every competitor by a large margin, no matter learning-based or prefixed heuristic planner, demonstrating the advantages of the proposed NEXT algorithm.
203
+
204
+ ![](images/e1b7307ae6db488a13797cccd31ec60ba79f87159ac956c545b9f9d1f3fe33ce.jpg)
205
+ Figure 7: First row: histograms of results, in terms of success rate, average collision checks, and average cost of the solution paths; Second row: NEXT improvement curves in the 5d experiments. All algorithms are set to use up to 500 samples, except $\mathrm { R R T ^ { * } }$ -10k, which uses 10,000 samples. The value of collision checks and path costs are normalized w.r.t. the performance of $\mathrm { R R T ^ { * } }$ .
206
+
207
+ Self-improving. We plot the performance improvement curves of our algorithms on the 5d planning task in the bottom row of Figure 7. For comparison, we also plot the performance of RRT∗. At the beginning phase of self-improving, our algorithms are comparable to $\mathrm { R R T ^ { * } }$ . They then gradually learn from previous experiences and improve themselves as they see more problems and better solutions. In the end, NEXT-KS is able to match the performance of RRT∗-10k using only one-twentieth of its samples, while the competitors perform consistently without any improvements.
208
+
209
+ Due to the space limits, we put improvement curves on other environments in Figure 17 and the quantitative evaluation in Table 1, 2, and 3 in Appendix F. Please refer to the details there.
210
+
211
+ # 5.3 ABLATION STUDIES
212
+
213
+ Ablation study I: guided progressive expansion. To demonstrate the power of NEXT :: Expand, we replace it with breadth-first search (BFS) (Kim et al., 2018), another expanding strategy, while keeping other components the same. Specifically, BFS uses a search queue in planning. It repeatedly pops a state $s$ out from the search queue, samples $k$ states from $\pi \left( \cdot | s \right)$ , and pushes all generated samples and state $s$ back to the queue, until the goal is reached. For fairness, we use the learned sampling policy $\pi \left( s ^ { \prime } | s , U \right)$ by NEXT-KS in BFS. As shown in Figure 7, BFS obtained worse paths with a much larger number of collision checks and far lower success rate, which justifies the importance of the balance between exploration versus exploitation achieved by the proposed NEXT :: Expand.
214
+
215
+ Ablation study II: neural architecture. To further demonstrate the benefits of the proposed neural architecture for learning generalizable representations in high-dimension planning problems, We replaced our attention-based neural architecture with an improved GPPN, as explained in Appendix E, for ablation study. We extended the GPPN for continuous space by adding an extra reactive policy network to its final layers. We emphasize the original GPPN is not applicable to the tasks in our experiments. Intuitively, the improved GPPN first produces a ‘rough plan’ by processing the robot’s discretized workspace positions. Then the reactive policy network predicts a continuous action from both the workspace feature and the full configuration state of the robot. We provide more preference to the improved GPPN by training it to imitate the near-optimal paths produced by RRT\* in the training problems. During test time it is also combined with both versions of the guided progressive expansion operators. As we can see, both GPPN-KS and GPPN-GP are clearly much worse than NEXT-KS and NEXT-GP, demonstrating the advantage of our proposed attention-based neural architecture in high-dimensional planning tasks.
216
+
217
+ ![](images/a7f19f8a9284429626e2ad6f69c231d6aa6a4e1e1021040a5d3d6919d297a607.jpg)
218
+ Figure 8: The success rate and average path cost of the different planners under varying time limits. Running NEXT for 1 second achieves the same success rate as running $\mathrm { B I T ^ { * } }$ for 50 seconds.
219
+
220
+ Ablation study III: learning versus heuristic. The NEXT algorithm in Figure 5 shows similar behavior as the Dijkstra heuristic, i.e. sampling on the shortest path connecting the start and the goal in workspace. However, in higher dimensional space, the Dijkstra heuristic will fail. To demonstrate that, we replace the policy and value network with Dijkstra heuristic, using the best direction in workspace to guide sampling. NEXT performs much better than Dijkstra in all but the 2d case, in which the workspace happens to be the state space.
221
+
222
+ # 5.4 CASE STUDY: ROBOT ARM CONTROL
223
+
224
+ We conduct a real-world case study on controlling robot arms to move objects on a shelf. On this representative real-time task, we demonstrate the advantages of the NEXT in terms of the wall-clock.
225
+
226
+ In each planning task, there is a shelf of multiple levels, with each level horizontally divided into multiple bins. The task is to plan a path from a location in one bin to another, i.e., the end effectors of the start and goal configurations are in different bins. The heights of levels, widths of bins, and the start and goal are randomly drawn from some fixed distribution. Different from previous experiments, the base of the robot is fixed. We consider the $\mathrm { B I T ^ { * } }$ instead of $\mathrm { R R T ^ { * } }$ as the imperfect expert in 3000 training problems. We then evaluate the algorithm on a separated 1000 testing problems. We compare NEXT(- KS) with the highly tuned $\mathrm { B I T ^ { * } }$ and RRT\* in OMPL, and also CVAE-plan and Reinforce-plan in Figure 8. As seen from the visualization of the found paths in Figure 9, this is a very difficult task. Our NEXT outperforms the baselines by a large margin, requiring only 1 second to reach the same success rate as running 50 seconds of $\mathrm { B I T ^ { * } }$ .
227
+
228
+ ![](images/2c27831a81842e20acfb22f33643b38f7e0d636dac989887fae6e6036e1293d0.jpg)
229
+ Figure 9: The collision-free path produced by NEXT for robot arm planning. The start and goal configurations have end-effectors in different bins of the shelf.
230
+
231
+ Due to space limits, we put details of the experiment setups, more results and analysis in Appendix F.4.
232
+
233
+ # 6 CONCLUSION
234
+
235
+ In this paper, we propose a self-improving planner, Neural EXploration-EXploitation Trees (NEXT), which can generalize and achieve better performance with experiences accumulated. The algorithm achieves a delicate balance between exploration-exploitation via our carefully designed UCB-type expansion operation. To obtain the generalizable ability across different problems, we proposed a new parametrization for the value function and policy, which captures the Bellman recursive structure in the high-dimensional continuous state and action space. We demonstrate the power of the proposed algorithm by outperforming previous state-of-the-art planners with significant margins on planning problems in a variety of different environments.
236
+
237
+ # ACKNOWLEDGEMENT
238
+
239
+ We thank the Google Research Brain team members for helpful thoughts and discussions as well as the anonymous reviewers for their insightful comments and suggestions. This work is supported in part by NSF grants CDS&E-1900017 D3SC, CCF-1836936 FMitF, IIS-1841351, CAREER IIS1350983 to L.S, and by NSF grants BIGDATA 1840866, CAREER 1841569, TRIPODS 1740735, DARPA-PA-18-02-09-QED-RML-FP-003, an Alfred P Sloan Fellowship, a PECASE award to H.L.
240
+
241
+ # REFERENCES
242
+
243
+ Auer, P., Cesa-Bianchi, N., and Fischer, P. Finite-time analysis of the multiarmed bandit problem. Machine learning, 47(2-3):235–256, 2002.
244
+
245
+ Mohak Bhardwaj, Sanjiban Choudhury, and Sebastian Scherer. Learning heuristic search via imitation. arXiv preprint arXiv:1707.03034, 2017.
246
+
247
+ Boor, V., Overmars, M. H., and Van Der Stappen, A. F. The gaussian sampling strategy for probabilistic roadmap planners. In Robotics and automation, 1999. proceedings. 1999 ieee international conference on, volume 2, pp. 1018–1023. IEEE, 1999.
248
+
249
+ Burns, B. and Brock, O. Sampling-based motion planning using predictive models. In Robotics and Automation, 2005. ICRA 2005. Proceedings of the 2005 IEEE International Conference on, pp. 3120–3125. IEEE, 2005a.
250
+
251
+ Burns, B. and Brock, O. Toward optimal configuration space sampling. In Robotics: Science and Systems, pp. 105–112. Citeseer, 2005b.
252
+
253
+ Bowen, Chris, and Ron Alterovitz. Closed-loop global motion planning for reactive execution of learned tasks. In IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 1754-1760, 2014.
254
+
255
+ Cadena Cesar, Luca Carlone, Henry Carrillo, Yasir Latif, Davide Scaramuzza, José Neira, Ian Reid, and John J. Leonard. Past, present, and future of simultaneous localization and mapping: Toward the robust-perception age. IEEE Transactions on Robotics, 32(6), 2016.
256
+
257
+ Sanjiban Choudhury, Mohak Bhardwaj, Sankalp Arora, Ashish Kapoor, Gireeja Ranade, Sebastian Scherer, and Debadeepta Dey. Data-driven planning via imitation learning. The International Journal of Robotics Research, 37(13-14):1632–1672, 2018.
258
+
259
+ Chu, W., Li, L., Reyzin, L., and Schapire, R. Contextual bandits with linear payoff functions. In Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, pp. 208–214, 2011.
260
+
261
+ Couëtoux, A., Hoock, J.-B., Sokolovska, N., Teytaud, O., and Bonnard, N. Continuous upper confidence trees. In International Conference on Learning and Intelligent Optimization, pp. 433–445. Springer, 2011.
262
+
263
+ Rosen Diankov. Automated Construction of Robotic Manipulation Programs. PhD thesis, Carnegie Mellon University, Robotics Institute, August 2010.
264
+
265
+ Rosen Diankov and James Kuffner. Randomized statistical path planning. In 2007 IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 1–6. IEEE, 2007.
266
+
267
+ Elbanhawi, M. and Simic, M. Sampling-based robot motion planning: A review. Ieee access, 2: 56–77, 2014.
268
+
269
+ Finney, S., Kaelbling, L. P., and Lozano-Perez, T. Predicting partial paths from planning problem parameters. In Robotics Science and Systems, 2007.
270
+
271
+ Fulgenzi, Chiara and Tay, Christopher and Spalanzani, Anne and Laugier, Christian Probabilistic navigation in dynamic environment using rapidly-exploring random trees and gaussian processes In IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 1056–1062, 2008.
272
+
273
+ Gammell, J. D., Srinivasa, S. S., and Barfoot, T. D. Informed $\mathrm { { r r t } ^ { * } }$ : Optimal sampling-based path planning focused via direct sampling of an admissible ellipsoidal heuristic. arXiv preprint arXiv:1404.2334, 2014.
274
+ Gammell, J. D., Srinivasa, S. S., and Barfoot, T. D. Batch informed trees (bit\*): Sampling-based optimal planning via the heuristically guided search of implicit random geometric graphs. In Robotics and Automation (ICRA), 2015 IEEE International Conference on, pp. 3067–3074. IEEE, 2015.
275
+ Guez, Arthur and Weber, Théophane and Antonoglou, Ioannis and Simonyan, Karen and Vinyals, Oriol and Wierstra, Daan and Munos, Rémi and Silver, David Learning to search with mctsnets arXiv preprint arXiv:1802.04697, 2018.
276
+ Peter E Hart, Nils J Nilsson, and Bertram Raphael. A formal basis for the heuristic determination of minimum cost paths. IEEE transactions on Systems Science and Cybernetics, 4(2):100–107, 1968.
277
+ Hsu, D., Latombe, J.-C., and Motwani, R. Path planning in expansive configuration spaces. In Robotics and Automation, 1997. Proceedings., 1997 IEEE International Conference on, volume 3, pp. 2719–2726. IEEE, 1997.
278
+ Hsu, D., Jiang, T., Reif, J., and Sun, Z. The bridge test for sampling narrow passages with probabilistic roadmap planners. In Robotics and Automation, 2003. Proceedings. ICRA’03. IEEE International Conference on, volume 3, pp. 4420–4426. IEEE, 2003.
279
+ Hsu, D., Sánchez-Ante, G., and Sun, Z. Hybrid prm sampling with a cost-sensitive adaptive strategy. In Robotics and Automation, 2005. ICRA 2005. Proceedings of the 2005 IEEE International Conference on, pp. 3874–3880. IEEE, 2005.
280
+ Huh, Jinwook and Lee, Daniel Efficient Sampling With Q-Learning to Guide Rapidly Exploring Random Trees. IEEE Robotics and Automation Letters, 3:3868–3875, 2018.
281
+ Ichter, B., Harrison, J., and Pavone, M. Learning sampling distributions for robot motion planning. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 7087–7094. IEEE, 2018.
282
+ Karaman, S. and Frazzoli, E. Sampling-based algorithms for optimal motion planning. The international journal of robotics research, 30(7):846–894, 2011.
283
+ Karkus, P., Hsu, D., and Lee, W. S. Qmdp-net: Deep learning for planning under partial observability. In Advances in Neural Information Processing Systems, pp. 4694–4704, 2017.
284
+ Kavraki, L. E., Svestka, P., Latombe, J.-C., and Overmars, M. H. Probabilistic roadmaps for path planning in high-dimensional configuration spaces. IEEE Transactions on Robotics and Automation, 12(4), 1996.
285
+ Kim, B., Kaelbling, L. P., and Lozano-Pérez, T. Guiding search in continuous state-action spaces by learning an action sampler from off-target search experience. 2018.
286
+ Kocsis, L. and Szepesvári, C. Bandit based monte-carlo planning. In European conference on machine learning, pp. 282–293. Springer, 2006.
287
+ Krause, A. and Ong, C. S. Contextual gaussian process bandit optimization. In Advances in Neural Information Processing Systems, pp. 2447–2455, 2011.
288
+ Kuo, Yen-Ling and Barbu, Andrei and Katz, Boris Deep sequential models for sampling-based planning In IEEE/RSJ International Conference on Intelligent Robots and Systems, pp. 6490–6497, 2018.
289
+ Langford, J. and Zhang, T. The epoch-greedy algorithm for multi-armed bandits with side information. In Advances in neural information processing systems, pp. 817–824, 2008.
290
+ LaValle, S. M. Rapidly-exploring random trees: A new tool for path planning. 1998.
291
+ Lee, L., Parisotto, E., Chaplot, D. S., Xing, E., and Salakhutdinov, R. Gated path planning networks. arXiv preprint arXiv:1806.06408, 2018.
292
+
293
+ Long-Ji Lin. Self-improving reactive agents based on reinforcement learning, planning and teaching. Machine learning, 8(3-4):293–321, 1992.
294
+
295
+ Paxton, Chris and Raman, Vasumathi and Hager, Gregory D and Kobilarov, Marin Combining neural networks and tree search for task and motion planning in challenging environments In IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 6059–6066, 2017.
296
+
297
+ Sven Mikael Persson and Inna Sharf. Sampling-based a\* algorithm for robot path-planning. The International Journal of Robotics Research, 33(13):1683–1708, 2014.
298
+
299
+ Phillips, J. M., Bedrossian, N., and Kavraki, L. E. Guided expansive spaces trees: A search strategy for motion-and cost-constrained state spaces. In IEEE International Conference on Robotics and Automation, pp. 3968–3973, 2004.
300
+
301
+ Mike Phillips, Benjamin J Cohen, Sachin Chitta, and Maxim Likhachev. E-graphs: Bootstrapping planning with experience graphs. In Robotics: Science and Systems, volume 5, pp. 110, 2012.
302
+
303
+ Qureshi, Ahmed H and Simeonov, Anthony and Bency, Mayur J and Yip, Michael C. Motion planning networks. In IEEE International Conference on Robotics and Automation, 2019.
304
+
305
+ Reif, J. H. Complexity of the mover’s problem and generalizations. In Foundations of Computer Science, 1979., 20th Annual Symposium on, pp. 421–427. IEEE, 1979.
306
+
307
+ Rickert, Markus and Brock, Oliver and Knoll, Alois. Balancing exploration and exploitation in motion planning In IEEE International Conference on Robotics and Automation, pp. 2812–2817. IEEE, 2008.
308
+
309
+ Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. arXiv preprint arXiv:1511.05952, 2015.
310
+
311
+ Shkolnik, A., Walter, M., and Tedrake, R. Reachability-guided sampling for planning under differential constraints. In Robotics and Automation, 2009. ICRA’09. IEEE International Conference on, pp. 2859–2865. IEEE, 2009.
312
+
313
+ Silver, David and Hubert, Thomas and Schrittwieser, Julian and Antonoglou, Ioannis and Lai, Matthew and Guez, Arthur and Lanctot, Marc and Sifre, Laurent and Kumaran, Dharshan and Graepel, Thore and others Mastering chess and shogi by self-play with a general reinforcement learning algorithm. arXiv preprint arXiv:1712.01815, 2017.
314
+
315
+ Sohn, K., Lee, H., and Yan, X. Learning structured output representation using deep conditional generative models. In Advances in Neural Information Processing Systems, pp. 3483–3491, 2015.
316
+
317
+ Jialin Song, Ravi Lanka, Albert Zhao, Yisong Yue, and Masahiro Ono. Learning to search via retrospective imitation. arXiv preprint arXiv:1804.00846, 2018.
318
+
319
+ Srinivas, N., Krause, A., Kakade, S. M., and Seeger, M. Gaussian process optimization in the bandit setting: No regret and experimental design. arXiv preprint arXiv:0912.3995, 2009.
320
+
321
+ Ioan A. ¸Sucan, Mark Moll, and Lydia E. Kavraki. The Open Motion Planning Library. IEEE Robotics & Automation Magazine, 19(4):72–82, December 2012. doi: 10.1109/MRA.2012.2205651. http://ompl.kavrakilab.org.
322
+
323
+ Tamar, A., Wu, Y., Thomas, G., Levine, S., and Abbeel, P. Value iteration networks. In Advances in Neural Information Processing Systems, pp. 2154–2162, 2016.
324
+
325
+ Wang, Y., Audibert, J.-Y., and Munos, R. Algorithms for infinitely many-armed bandits. In Advances in Neural Information Processing Systems, pp. 1729–1736, 2009.
326
+
327
+ Ye, Gu and Alterovitz, Ron Guided motion planning. In Robotics research, pp. 291–6307. Springer, 2017.
328
+
329
+ Yee, T., Lisy, V., and Bowling, M. Monte carlo tree search in continuous action spaces with execution uncertainty. In Proceedings of the Twenty-Fifth International Joint Conference on Artificial Intelligence, pp. 690–696. AAAI Press, 2016.
330
+
331
+ Zhang, C., Huh, J., and Lee, D. D. Learning implicit sampling distributions for motion planning. arXiv preprint arXiv:1806.01968, 2018.
332
+
333
+ Zucker, M., Kuffner, J., and Bagnell, J. A. Adaptive workspace biasing for sampling-based planners. In Robotics and Automation, 2008. ICRA 2008. IEEE International Conference on, pp. 3757–3762. IEEE, 2008.
334
+
335
+ # Appendix
336
+
337
+ # A ILLUSTRATION OF THE DIFFICULTY IN PLANNING PROBLEMS
338
+
339
+ The Figure 10(a) illustrates a concrete planning problem for a stick robot in 2d workspace. With one extra continuous action for rotation, the configuration state is visualized in Figure 10(b), which is highly irregular and unknown to the planner.
340
+
341
+ ![](images/03f4d274b006a2d945a961a75df61f65f470c9506bae0cc5429f4ef3d09ead9c.jpg)
342
+ Figure 10: Different views of the same planning problem. In (a) we color the obstacles, the starting and the goal position of the robot in deep blue, orange and brown, respectively. The stick robot can move and rotate. The corresponding configuration space is 3d, as visualized in (b), with the extra dimension being the rotation angle w.r.t. the $\mathbf { X }$ -axis. The blue region indicates the feasible state space, i.e., the set of collision-free states. The starting and the goal position are denoted with an orange and a brown dot, respectively. Although the workspace looks trivial, the configuration space is irregular, which makes the planning difficult.
343
+
344
+ # B MORE PRELIMINARIES
345
+
346
+ Tree-based sampling planner The tree-based sampling planner algorithm is illustrated in Figure 11. The Expand in Algorithm 1 operator returns an existing node in the tree $s _ { p a r e n t } \in \mathcal { V }$ and a new state $s _ { n e w } \in S$ sampled from the neighborhood of $s _ { p a r e n t }$ . Then the line segment $[ s _ { p a r e n t } , s _ { n e w } ]$ is passed to function ObstacleFree for collision checking. If the line segment $[ s _ { p a r e n t } , s _ { n e w } ]$ is collision-free (no obstacle in the middle, or called reachable from $\tau$ ), then $s _ { n e w }$ is added to the tree vertex set $\nu$ , and the line segment is added to the tree edge set $\mathcal { E }$ . If the newly added node $s _ { n e w }$ has reached the target $\mathcal { S } _ { g o a l }$ , the algorithm will return. Optionally, some concrete algorithms can define a Postprocess operator to refine the search tree. For an example of the Expand operator, as shown in Figure 1 (c), since there is no obstacle on the dotted edge $[ s _ { p a r e n t } , s _ { n e w } ]$ , i.e., $s _ { n e w }$ is reachable, the new state and edge will be added to the search tree (connected by the solid edges).
347
+
348
+ ![](images/be00082f31c012e5df15315075e706a96419afcb7dbc1ba05cf0204fbd263e3d.jpg)
349
+ Figure 11: Illustration for one iteration of Algorithm 1. The left and right figures illustrate two different cases where the sample returned by the Expand operator is unreachable and reachable from the search tree.
350
+
351
+ Now we will provide two concrete algorithm examples. For instance, • If we instantiate the Expand operator as Algorithm 4, then we obtain the rapidly-exploring random trees (RRT) algorithm (LaValle, 1998), which first samples a state $s$ from the configuration space
352
+
353
+ # $\mathbf { A l g o r i t h m 4 : R R T : : E x p a n d } ( { T } , { U } )$
354
+
355
+ Data: $\mathcal { T } = ( \mathcal { V } , \mathcal { E } ) , U = \left( s _ { i n i t } , S _ { g o a l } , S , S _ { f r e e } , \mathtt { m a p } , c ( \cdot ) \right)$ 1 $s _ { r a n d } \gets \mathcal { U } n i f ( \mathcal { S } )$ ; 2 $\begin{array} { r } { s _ { p a r e n t } \gets \operatorname * { a r g m i n } _ { s \in \mathcal { V } } \left\| s _ { r a n d } - s \right\| } \end{array}$ ; 3 $s _ { n e w } \gets \mathrm { a r g m i n } _ { s \in \mathcal { B } ( s _ { p a r e n t } , \eta ) } \left\| s - s _ { r a n d } \right\|$ ;
356
+
357
+ 4 return $s _ { p a r e n t } , s _ { n e w }$ . Sample configuration space . Pull to a tree node
358
+
359
+ # $\mathbf { A l g o r i t h m 5 : E S T : : E x p a n d } ( T , U )$
360
+
361
+ Data: $\mathcal { T } = ( \mathcal { V } , \mathcal { E } ) , U = \left( s _ { i n i t } , S _ { g o a l } , S , S _ { f r e e } , \mathtt { m a p } , c ( \cdot ) \right)$ ,1 sparent $\sim \phi ( s ) , s \in \mathcal { V }$ ;2 $\hat { s _ { n e w } } \mathcal { U } n i f ( B ( s _ { p a r e n t } ) )$ ;3 return snearest, snew;
362
+
363
+ . Sample a tree node . Sample neighborhood
364
+
365
+ $s$ and then pulls it toward the neighborhood of current tree $\tau$ measured by a ball of radius $\eta$
366
+
367
+ Moreover, if the Postprocess operator is introduced to modify the maintained search tree as in $\mathrm { { R R T ^ { * } } }$ (Karaman & Frazzoli, 2011), the algorithm is provable to obtain the optimal path asymptotically.
368
+
369
+ • If we instantiate the Expand operator as Algorithm 5, then we obtain the expansive-space trees (EST) algorithm (Hsu et al., 1997; Phillips et al., 2004), which samples a state $s$ from the nodes of the existing tree, and then draw a sample from the neighborhood of $s$ .
370
+
371
+ UCB-based algorithms Specifically, in a $K$ -armed bandit problem, the UCB algorithm will first play each of the arms once, and then keep track of the average reward $\bar { r } _ { i }$ and the visitation count $n _ { i }$ for each arm. After $T$ rounds of trials, the UCB algorithm will maintain a set of information $\{ ( \bar { r } _ { i } , n _ { i } ) \} _ { i = 1 } ^ { K }$ with $\textstyle \sum _ { i = 1 } ^ { K } n _ { i } = T$ . Then, for the next round, the UCB algorithm will select the next arm based on the one-sided confidence interval estimation provided by the Chernoff-Hoeffding bound,
372
+
373
+ $$
374
+ \begin{array} { r } { a _ { T + 1 } ^ { * } = \operatorname * { a r g m a x } _ { i \in \{ 1 , \ldots , K \} } \bar { r } _ { i } + \lambda \sqrt { \frac { \log T } { n _ { i } } } , } \end{array}
375
+ $$
376
+
377
+ where $\lambda$ controls the exploration-exploration trade-off. It has been shown that the UCB algorithm achieves $\mathcal { O } \left( \log T \right)$ regret. However, the MCTS is not directly applicable to continuous state-action spaces.
378
+
379
+ There have been many attempts to generalize the UCB and UCT algorithms to continuous state-action spaces (Chu et al., 2011; Krause & Ong, 2011; Couëtoux et al., 2011; Yee et al., 2016). For instance, contextual bandit algorithms allow continuous arms but involve a non-trivial high dimensional non-convex optimization to select the next arm. In UCT, the progressive widening technique has been designed to deal with continuous actions (Wang et al., 2009). Even with these extensions, the MCTS restricts the exploration only from leaves states, implicitly adding an unnecessary hierarchical structure for path planning, resulting inferior exploration efficiency and extra computation in path planning tasks.
380
+
381
+ Although these off-the-shelf algorithms are not directly applicable to our path planning setting, their successes show the importance of exploration-exploitation trade-off and will provide the principles for our algorithm for continuous state-action planning problems.
382
+
383
+ Planning networks Value iteration networks (Tamar et al., 2016) employ neural networks to embed the value iteration algorithm from planning and then use this embedded algorithm to extract input features and define downstream models such as value functions and policies.
384
+
385
+ Specifically, VIN mimics the following recursive application of Bellman update operator $\mathcal { G }$ to value function $V ^ { * }$ ,
386
+
387
+ $$
388
+ V ^ { * } \left( s | U \right) = \left( \mathcal { G } V ^ { * } \right) ( s ) : = \operatorname* { m i n } _ { a } \sum _ { s ^ { \prime } } P ( s ^ { \prime } | s , a ) ( c \left( \left[ s , s ^ { \prime } \right] \right) + V ^ { * } \left( s ^ { \prime } | U \right) ) .
389
+ $$
390
+
391
+ where $P ( s ^ { \prime } | s , a )$ is the state transition model. When the state space for $s$ and action space for $a$ are low dimensional, these spaces can be discretized into grids. Then, the local cost function $c ( [ s , s ^ { \prime } ] )$ and the value function $V ^ { * } ( s ^ { \prime } | U )$ can be represented as matrices (2d) or tensors (3d) with each entry indexed by grid locations. Furthermore, if the transition model $P ( s ^ { \prime } | s , a )$ is local, that is $P ( s ^ { \prime } | \dot { s } , a ) = 0$ for $\bar { \boldsymbol { s } } ^ { \prime } \notin B ( \boldsymbol { s } )$ , it resembles a set of convolution kernels, each indexed by a discrete action $a$ . And the Bellman update operator essentially convolves $P ( s ^ { \prime } | s , a )$ with $c ( [ s , s ^ { \bar { \prime } } ] )$ and $V ^ { * } ( s ^ { \prime } | U )$ , and then performs a min-pooling operation across the convolution channels.
392
+
393
+ Inspired by the above computation pattern of the Bellman operator, value iteration networks design the neural architecture as follows,
394
+
395
+ $$
396
+ \begin{array} { r l } & { \tilde { V } ^ { * 0 } = \operatorname* { m i n } \ \left( W _ { 1 } \oplus \left[ \tt { m a p } , \tilde { R } \right] \right) } \\ & { \tilde { V } ^ { * t } = \operatorname* { m i n } \ \left( W _ { 1 } \oplus \left[ \tilde { V } ^ { * t - 1 } , \tilde { R } \right] \right) } \end{array}
397
+ $$
398
+
399
+ where $\oplus$ is the convolution operation, both map, $\tilde { V } ^ { * t }$ and $\tilde { R }$ are $d \times d$ matrices, and the parameter $W _ { 1 }$ are $k _ { c }$ convolution kernels of size $k \times k$ . The min implements the pooling across $k _ { c }$ convolution channels.
400
+
401
+ The gated path planning networks (GPPN) (Lee et al., 2018) improves the VIN by replacing the VIN cell (9) with the well-established LSTM update, i.e.,
402
+
403
+ $$
404
+ \tilde { V } ^ { t } , \tilde { c } ^ { t } = \mathrm { L S T M } \left( \sum \left( W _ { 1 } \oplus \left[ \tilde { V } ^ { t } , \tilde { R } \right] \right) , \tilde { c } ^ { t } \right) ,
405
+ $$
406
+
407
+ where the summation is taking over all the $k _ { c }$ convolution channels.
408
+
409
+ After constructing the VIN and GPPN, the parameters of the model, i.e., $\left\{ \tilde { R } , W _ { 1 } \right\}$ can be learned by imitation learning or reinforcement learning.
410
+
411
+ The application of planning networks are restricted in low-dimension tasks. However, their success enlightens our neural architecture for generalizable representation for high-dimension planning tasks.
412
+
413
+ # C PARAMETRIZED UCB ALGORITHMS
414
+
415
+ We list two examples of parametrized UCB as the instantiation of (3) used in GPE:
416
+
417
+ • GP-UCB: The GP-UCB Chu et al. (2011) is derived by parameterizing via Gaussian Processes (GP) with kernel $k \left( s , s ^ { \prime } \right)$ , i.e., E $[ r ( s ) | \mathcal { T } , U ] \sim \mathcal { \bar { G } } \mathcal { P } ( 0 , k )$ , GP-UCB maintains an UCB of the reward after t-step asφ (s) := ¯rt (s) + λσt (s) , (12)
418
+
419
+ where
420
+
421
+ $$
422
+ \begin{array} { r c l } { { { \bar { r } } _ { t } } \left( s \right) } & { { = } } & { { { k _ { t } } \left( s \right) \left( K _ { t } + \alpha I \right) ^ { - 1 } { r _ { t } } , } } \\ { { \sigma _ { t } ^ { 2 } \left( s \right) } } & { { = } } & { { { k \left( s , s \right) - k _ { t } } \left( s \right) ^ { \top } \left( K _ { t } + \alpha I \right) ^ { - 1 } k _ { t } \left( s \right) , } } \end{array}
423
+ $$
424
+
425
+ with $\boldsymbol { k } _ { t } \left( \boldsymbol { s } \right) = \left[ k \left( s _ { i } , \boldsymbol { s } \right) \right] _ { s _ { i } \in \boldsymbol { S } _ { t } }$ , $K _ { t } = [ k \left( s , s ^ { \prime } \right) ] _ { s , s ^ { \prime } \in S _ { t } }$ , and ${ \cal { S } } _ { t } = \{ s _ { 1 } , s _ { 2 } , \ldots , s _ { t } \}$ denotes the sequence of selected nodes in current trees. The variance estimation $\sigma _ { t } ^ { 2 } \left( s \right)$ takes the number of visits into account in an implicit way: the variance will reduce, as the neighborhood of $s$ is visited more frequently (Srinivas et al., 2009).
426
+
427
+ • KS-UCB: We can also use kernel regression as an alternative parametrization for (7) (Yee et al., 2016), which leads to an UCB of the reward after $t$ -step as
428
+
429
+ $$
430
+ \phi \left( s \right) : = { \bar { r } } _ { t } \left( s \right) + \lambda \sigma _ { t } \left( s \right) ,
431
+ $$
432
+
433
+ where
434
+
435
+ $$
436
+ \begin{array} { r l r } { \bar { r } _ { t } \left[ s \right] } & { = } & { \frac { \sum _ { s ^ { \prime } \in S _ { t } } k \left( s ^ { \prime } , s \right) r \left( s ^ { \prime } \right) } { \sum _ { s ^ { \prime } \in S _ { t } } k \left( s ^ { \prime } , s \right) } , } \\ { \sigma _ { t } \left( s \right) } & { = } & { \sqrt { \frac { \log \sum _ { s ^ { \prime } \in S _ { t } } w \left( s ^ { \prime } \right) } { w \left( s \right) } } , } \end{array}
437
+ $$
438
+
439
+ with $\begin{array} { r } { w \left( s \right) = \sum _ { s ^ { \prime } \in S _ { t } } k \left( s ^ { \prime } , s \right) } \end{array}$ . Clearly, the variance estimation is to promote exploration towards less frequently visited states.
440
+
441
+ As we can see, in both two examples of the parametrized UCB, we parametrize the observed rewards, leading to generalizable UCB for increased states by considering the correlations.
442
+
443
+ # D POLICY AND VALUE NETWORK ARCHITECTURE
444
+
445
+ We explain the implementation details of the proposed parametrization for policy and value function. Figure 12 and Figure 13 are neural architectures for the attention module, the policy/value network, and the planning module, respectively.
446
+
447
+ ![](images/fb3272bba1630226b3a65a134ae6d6e537e4da69dcd4e45215968c4d3b3ba712.jpg)
448
+ Figure 12: Left: attention module, instantiating the Figure 3; Right: policy/value network, instantiating the Figure 4.
449
+
450
+ In the figures, we use rectangle blocks to denote inputs, intermediate results and outputs, stadium shape blocks to denote operations, and rounded rectangle blocks to denote modules. We use different colors for different operations. In particular, we use blue for convolutional/LSTM layers, green for dense layers, and orange for anything else. For convolutional layers, "Conv $1 \times 1$ , 32, relu" denotes a layer with $1 \times 1$ kernels, 32 channels, followed by a rectified linear unit; for dense layers, "Dense, 64, relu" denotes a layer of size 64, followed by a rectified linear unit.
451
+
452
+ The attention module (Figure 12-left) embeds a state to a $d \times d \times d _ { a }$ tensor. The planning module (Figure 13) is a one-step LSTM update which takes the result of a convolutional layer as input. Both the input and hidden size of the LSTM cell are $d _ { e }$ . All $d \times d$ locations share one set of parameters and are processed by the LSTM in one batch.
453
+
454
+ The main architecture is illustrated in Figure 12-right. It takes maze map, state and goal as input, and outputs the action and the value. Refer to Section 4.2 for details for computing $\psi ( s )$ . In our experiments, we set the values of the hyper-parameters to be $( d , d _ { e } , d _ { a } , p ) = ( 1 \bar { 5 } , 6 4 , \bar { 8 } , 8 )$ .
455
+
456
+ ![](images/093f34c3bdcd9d32756f1eaf06749627ebe9c0724c310e6d0259da319ce67d5a.jpg)
457
+ Figure 13: planning module
458
+
459
+ # E EXPERIMENT DETAILS
460
+
461
+ # E.1 BENCHMARK ENVIRONMENTS
462
+
463
+ We used four benchmark environments in our experiment. For the first three, the workspace dimension is 2d. We generated the maze maps with the recursive backtracker algorithm using the following implementation: https://github.com/lileee/gated-path-planning-networks/blob/master/generate_dataset.py. Examples of the workspace are shown in Figure 15. Three environments differ in the choice of robots:
464
+
465
+ • Workspace planning (2d). The robot is abstracted with a point mass moving in the plane. Without higher dimensions, this problem reduces to planning in the workspace.
466
+ • Rigid body navigation (3d). A rigid body robot, abstracted as a thin rectangle, is used here. The extra rotation dimension is added to the planning problem. This robot can rotate and move freely without any constraints in the free space.
467
+ • 3-link snake (5d). The robot is a 5 DoF snake with two joints. Two more angle dimensions are added to the planning task. To prevent links from folding, we restrict the angles to the range of $[ - \pi / 4 , \pi / 4 ]$ .
468
+
469
+ The fourth environment has a 3d workspace. Cuboid obstacles were generated uniformly randomly in space with density $\approx 2 0 \%$ . Example of the workspace is shown in Figure 6 and 16, where the blue cuboids are obstacles. The environment is described below:
470
+
471
+ • Spacecraft planning (7d). The robot is a spacecraft with a cuboid body and two 2 DoF arms connecting to two opposite sides of the body. There is a joint in the middle of each arm. The outer arm can rotate around this joint. Each arm can also rotate as a whole around its connection point with the body. All rotation angles are restricted in the range of $[ 0 , \pi / 2 ]$ . The spacecraft itself cannot rotate.
472
+
473
+ # E.2 HYPERPARAMETER FOR MSIL
474
+
475
+ During self-improving over the first 2000 problems, NEXT updated its parameters and annealed $\epsilon$ once for every 200 problems. The value of the annealing $\epsilon$ was set as the following:
476
+
477
+ $$
478
+ \epsilon = \left\{ \begin{array} { l l } { 1 , } & { \mathrm { i f ~ } i < 1 0 0 0 , } \\ { 0 . 5 - 0 . 1 \cdot \lfloor ( i - 1 0 0 0 ) / 2 0 0 \rfloor , } & { \mathrm { i f ~ } 1 0 0 0 \leqslant i < 2 0 0 0 , } \\ { 0 . 1 , } & { \mathrm { o t h e r w i s e , } } \end{array} \right.
479
+ $$
480
+
481
+ with $i$ denoting the problem number.
482
+
483
+ # E.3 BASELINE: THE IMPROVED GPPN
484
+
485
+ The original GPPN is not directly applicable to our experiments. Inspired by Tamar et al. (2016), we add a fully-connected MLP to its final layers, so that the improved architecture can be applied to high-dimensional continuous domain. As shown in Figure 14, the GPPN first processes the discretized
486
+
487
+ ![](images/1197e1a0f579ba28f10b818c4b2e442327f2cb38b96543bbc6dbcfb1e5ec6325.jpg)
488
+ Figure 14: Improved GPPN architecture
489
+
490
+ workspace locations. Its output and the full robot configurations are processed together by the MLP, which then produces the current value and action estimates. The improved GPPN is trained using supervisions from the near-optimal paths produced by RRT\*.
491
+
492
+ # F EXPERIMENT RESULTS
493
+
494
+ ![](images/45835db4516f023ab21e7a5a2bb8b4907c34df7064909a1410c42cc4f9f92003.jpg)
495
+ Figure 15: The solution path produced by NEXT in a workspace planning task (2d), rigid body navigation task (3d), 3-link snake task (5d) from left to right. The orange dot and the brown dot are starting and goal locations, respectively.
496
+
497
+ ![](images/28558e709732ca4be6503115df6e181bb722fcd64cd5ffe0ac9a8fec10b06a19.jpg)
498
+ Figure 16: The solution paths produced by NEXT in spacecraft planning task (7d). Spacecraft has a yellow body and two 2 DoF (red) arms. Blue cuboids are obstacles.
499
+
500
+ # F.2 DETAILS OF QUANTITATIVE EVALUATION
501
+
502
+ More detailed results are shown in Table 1, 2, 3, including learning-based and non-learning-based ones, on the last 1000 problems in each experiment. We normalized the number of collision checks and the cost of paths based on the solution of RRT∗. The success rate result is not normalized. The best planners in each experiment are in bold. NEXT-KS and NEXT-GP outperform the current state-of-the-art planning algorithm with large margins.
503
+
504
+ Table 1: Success rate results. The higher the better. NEXT-KS performs the best.
505
+
506
+ <table><tr><td></td><td>NEXT-KS</td><td>NEXT-GP</td><td>GPPN-KS</td><td>GPPN-GP</td><td>RRT*</td><td>BIT*</td><td>BFS</td><td>CVAE</td><td>Reject</td></tr><tr><td>2d</td><td>0.988</td><td>0.981</td><td>0.718</td><td>0.632</td><td>0.735</td><td>0.710</td><td>0.185</td><td>0.535</td><td>0.720</td></tr><tr><td>3d</td><td>0.943</td><td>0.841</td><td>0.689</td><td>0.554</td><td>0.490</td><td>0.514</td><td>0.121</td><td>0.114</td><td>0.498</td></tr><tr><td>5d</td><td>0.883</td><td>0.768</td><td>0.633</td><td>0.515</td><td>0.455</td><td>0.497</td><td>0.030</td><td>0.476</td><td>0.444</td></tr><tr><td>7d</td><td>0.931</td><td>0.906</td><td>0.634</td><td>0.369</td><td>0.361</td><td>0.814</td><td>0.288</td><td>0.272</td><td>0.370</td></tr></table>
507
+
508
+ Table 2: Average number of collision checks results. The lower the better. The score is normalized based on the solution of $\mathbf { R R T ^ { * } }$ . NEXT-KS performs the best in 3 benchmarks.
509
+
510
+ <table><tr><td></td><td>NEXT-KS</td><td>NEXT-GP</td><td>GPPN-KS</td><td>GPPN-GP</td><td>RRT*</td><td>BIT*</td><td>BFS</td><td>CVAE</td><td>Reject</td></tr><tr><td>2d</td><td>0.177</td><td>0.243</td><td>2.342</td><td>3.484</td><td>1.000</td><td>5.945</td><td>9.247</td><td>1.983</td><td>1.011</td></tr><tr><td>3d</td><td>0.694</td><td>1.334</td><td>2.214</td><td>3.125</td><td>1.000</td><td>7.924</td><td>7.292</td><td>2.162</td><td>0.988</td></tr><tr><td>5d</td><td>0.888</td><td>1.520</td><td>1.800</td><td>2.706</td><td>1.000</td><td>7.483</td><td>5.758</td><td>1.188</td><td>0.997</td></tr><tr><td>7d</td><td>0.653</td><td>0.502</td><td>1.877</td><td>1.313</td><td>1.000</td><td>4.683</td><td>3.856</td><td>1.591</td><td>0.987</td></tr></table>
511
+
512
+ Table 3: Average cost of paths. The lower the better. The score is normalized based on the solution of $\mathrm { R R T ^ { * } }$ . The NEXT-KS achieves the best solutions.
513
+
514
+ <table><tr><td></td><td>NEXT-KS</td><td>NEXT-GP</td><td>GPPN-KS</td><td>GPPN-GP</td><td>RRT*</td><td>BIT*</td><td>BFS</td><td>CVAE</td><td>Reject</td></tr><tr><td>2d</td><td>0.172</td><td>0.193</td><td>1.049</td><td>1.333</td><td>1.000</td><td>1.140</td><td>2.811</td><td>1.649</td><td>1.050</td></tr><tr><td>3d</td><td>0.116</td><td>0.315</td><td>0.612</td><td>0.875</td><td>1.000</td><td>0.955</td><td>1.720</td><td>1.734</td><td>0.984</td></tr><tr><td>5d</td><td>0.215</td><td>0.426</td><td>0.673</td><td>0.890</td><td>1.000</td><td>0.923</td><td>1.780</td><td>0.961</td><td>1.020</td></tr><tr><td>7d</td><td>0.108</td><td>0.147</td><td>0.573</td><td>0.987</td><td>1.000</td><td>0.291</td><td>1.114</td><td>1.139</td><td>0.986</td></tr></table>
515
+
516
+ We demonstrated the performance improvement curves for 2d workspace planning, 3d rigid body navigation in Figure 17. As we can see, similar to the performances on 5d 3-link snake planning task in Figure 7, in these tasks, the NEXT-KS and NEXT-GP improve the performances along with more and more experiences collected, justified the self-improvement ability by learning ${ \tilde { V } } ^ { * }$ and $\tilde { \pi } ^ { * }$ .
517
+
518
+ # F.3 SEARCH TREES COMPARISON
519
+
520
+ We illustrate the search trees generated by $\mathrm { R R T ^ { * } }$ and the proposed NEXT algorithms with 500 samples in Figure 18, Figure 19, Figure 20 and Figure 21 on several 2d, 3d, 5d and 7d planning tasks, respectively. To help readers better understand how the trees were expanded, we actually visualize the RRT\* search trees without edge rewiring, which is equivalent to the RRT search trees, however the vertex set is the same. Comparing to the search trees generated by $\mathbf { R R T ^ { * } }$ side by side, we can clearly see the advantages and the efficiency of the proposed NEXT algorithms. In all the tasks, even in 2d workspace planning task, the $\mathrm { R R T ^ { * } }$ indeed randomly searches without realizing the goals, and thus cannot complete the missions, while the NEXT algorithms search towards the goals with the guidance from ${ \tilde { V } } ^ { * }$ and $\tilde { \pi } ^ { * }$ , therefore, successfully provides high-quality solutions.
521
+
522
+ ![](images/4c7753cd5f57fdbee146ea4f7042a6906667f2b11da11f1627ca15e30997b485.jpg)
523
+ Figure 17: The first and second rows display the improvement curves of our algorithms on all 3000 problems of the 2d workspace planning and 3d rigid body navigation problems. We compare our algorithms with $\mathrm { R R T ^ { * } }$ . Three columns correspond to the success rate, the average collision checks, and the average cost of the solution paths for each algorithm.
524
+
525
+ ![](images/e12728f87cbc3a880f7afe9bb7ba0f37c6e5a599ae9915a27fe8f8e4dd07bd7e.jpg)
526
+
527
+ (a) $\mathrm { R R T ^ { * } }$ (w/o rewiring) (b) NEXT-KS search tree (c) NEXT-GP search tree (d) learned ${ \tilde { V } } ^ { * }$ and $\tilde { \pi } ^ { * }$
528
+
529
+ Figure 18: Column (a) to (c) are the search trees produced by the $\mathrm { R R T ^ { * } }$ , NEXT-KS, and NEXT-GP on the same workspace planning task (2d). The learned $\tilde { V } ^ { \ast }$ and $\tilde { \pi } ^ { * }$ from NEXT-KS are plotted in column (d). In the figures, obstacles are colored in deep blue, the starting and goal locations are denoted by orange and brown dots, respectively. In column (a) to (c), samples are represented with hollow yellow circles, and edges are colored in green. In column (d), the level of redness denotes the value of the cost-to-go estimate $\tilde { V } ^ { \ast }$ , and the cyan arrows point from a given state $s$ to the center of the proposal distribution $\tilde { \pi } ^ { * } \bigl ( s ^ { \prime } | s , U \bigr )$ . We set the maximum number of samples to be 500.
530
+
531
+ ![](images/e0735fc244ea4c94bcec57f2daf0ecaa89ac9d792df1ae99e175f050da010796.jpg)
532
+ Figure 19: Each column corresponds to one example from the rigid body navigation problem (3d). The top and the bottom rows are the search trees produced by the RRT\* and NEXT-KS, respectively. In the figures, obstacles are colored in deep blue, and the rigid bodies are represented with matchsticks. The samples, starting states, and goal states are denoted by yellow, orange, and brown matchsticks, respectively. Edges are colored in green. We set the maximum number of samples to be 500.
533
+
534
+ ![](images/cfa7ea4cfcbf4aafa0403606ed187484f2a7a371df073fcdcf9d9b4c8e59fe6c.jpg)
535
+ Figure 20: Each column corresponds to one example from the 3-link snake problem (5d). The top and the bottom rows are the search trees produced by the RRT\* and NEXT-KS, respectively. In the figures, obstacles are colored in deep blue, and the rigid bodies are represented with matchsticks. The samples, starting states, and goal states are denoted by yellow, orange, and brown matchsticks, respectively. Edges are colored in green. We set the maximum number of samples to be 500.
536
+
537
+ ![](images/acacf1ccb84450bee6725175dc3f6794eeb8b2a6eca9fd60b1ef87035d99e36d.jpg)
538
+ Figure 21: Each column corresponds to one example from the spacecraft planning problem (7d). The top and the bottom rows are the search trees produced by the $\mathrm { R R T ^ { * } }$ and NEXT-KS, respectively. In the figures, obstacles are colored in blue, and each spacecraft has a yellow body and two 2 DoF red arms. We set the maximum number of samples to be 500.
539
+
540
+ # F.4 CASE STUDY DETAILS
541
+
542
+ We conduct a real-world case study on controlling robot arms to move objects on a shelf. This is a representative of common scenarios in practice where the robot needs to plan its motion in real-time to reach the inside of some narrow space. For this case study, we focus more on the practical aspect to evaluate how much can we improve on the wall-clock time by learning from similar planning problems.
543
+
544
+ # F.4.1 TASK DESCRIPTION
545
+
546
+ We generate planning problems randomly to form the training set and test set. In each planning task, there is a shelf of multiple levels, with each level horizontally divided into multiple bins. The heights of levels and widths of bins are randomly drawn from some fixed distribution. Samples of shelves are shown in Figure 22. Both the start and goal configurations are randomly sampled from a distribution within the reachable region of the robot arm. The planning environment is created with the OpenRave simulator (Diankov, 2010).
547
+
548
+ The task is to find a path for the 7 DoF robot arm to move from a location in one bin to another, i.e., the end effectors of the start and goal configurations are in different bins, as illustrated in Figure 23. In this case, the base of the robot is fixed and we are planning the movement of arm. We generated 3000 problems for training and 1000 problems for testing.
549
+
550
+ # F.4.2 BASELINES AND TRAINING
551
+
552
+ For traditional planners, we include $\mathrm { C } + +$ OMPL ( ¸Sucan et al., 2012) implementation of $\mathrm { B I T ^ { * } }$ (Gammell et al., 2015) and $\mathrm { R R T ^ { * } }$ (Karaman & Frazzoli, 2011) as baselines. The hyperparameters of RRT\* and $\mathbf { B I T ^ { * } }$ are specially tuned for this experiment. We also compare with learning-based planners CVAE-plan (Ichter et al., 2018) and Reinforce-plan (Zhang et al., 2018). The supervisions for CVAE-plan are produced by the well-tuned $\mathrm { B I T ^ { * } }$ on the training set. To train NEXT, we consider the $\mathrm { B I T ^ { * } }$ instead of RRT\* as the imperfect expert in training problems.
553
+
554
+ # F.4.3 RESULTS
555
+
556
+ We evaluate the algorithms on the separated testing problems, and record the success rate using 10 different time limits. The success rate and average path quality are plot in Figure 8 and recorded in Table 4 and Table 5. The solution paths found by NEXT and $\mathrm { B I T ^ { * } }$ are illustrated in Figure 23. In terms of both success rate and solution path quality, NEXT dominates all the planners under all time limits.
557
+
558
+ ![](images/1a68418f9fc5b8db4c0728ef4e4b915a1ac7b12ca2d6815c4396b38f554580ed.jpg)
559
+ Figure 22: Examples of different shelves sampled from the distribution.
560
+
561
+ ![](images/4918f228ef3bb16fc560cb6a309ed28b7f1abfcfd2648d63098ec7552a0228e2.jpg)
562
+ Figure 23: First row: robot arm solution trajectories produced by NEXT(-KS) in four planning problems; Second row: $\mathrm { B I T ^ { * } }$ solutions on the same planning problems. NEXT only takes 5 seconds to complete each problem while $\mathrm { B I T ^ { * } }$ needs 250 seconds to find a solution for the hardest problems (last two columns).
563
+
564
+ Table 4: Success rates of different planners under varying time limits, the higher the better.
565
+
566
+ <table><tr><td></td><td>5s</td><td>10s</td><td>15s</td><td>20s</td><td>25s</td><td>30s</td><td>35s</td><td>40s</td><td>45s</td><td>50s</td></tr><tr><td>NEXT</td><td>0.579</td><td>0.657</td><td>0.703</td><td>0.709</td><td>0.745</td><td>0.743</td><td>0.746</td><td>0.752</td><td>0.772</td><td>0.763</td></tr><tr><td>CVAE</td><td>0.354</td><td>0.437</td><td>0.482</td><td>0.509</td><td>0.507</td><td>0.539</td><td>0.553</td><td>0.551</td><td>0.579</td><td>0.580</td></tr><tr><td>Reinforce</td><td>0.160</td><td>0.170</td><td>0.200</td><td>0.150</td><td>0.180</td><td>0.190</td><td>0.175</td><td>0.180</td><td>0.225</td><td>0.175</td></tr><tr><td>BIT*</td><td>0.226</td><td>0.288</td><td>0.320</td><td>0.365</td><td>0.364</td><td>0.429</td><td>0.425</td><td>0.422</td><td>0.443</td><td>0.475</td></tr><tr><td>RRT*</td><td>0.135</td><td>0.148</td><td>0.144</td><td>0.136</td><td>0.147</td><td>0.159</td><td>0.152</td><td>0.158</td><td>0.157</td><td>0.165</td></tr></table>
567
+
568
+ Table 5: Average path costs of different planners under varying time limits, the lower the better.
569
+
570
+ <table><tr><td></td><td>5s</td><td>10s</td><td>15s</td><td>20s</td><td>25s</td><td>30s</td><td>35s</td><td>40s</td><td>45s</td><td>50s</td></tr><tr><td>NEXT</td><td>25.143</td><td>21.873</td><td>20.052</td><td>19.773</td><td>18.318</td><td>18.381</td><td>18.274</td><td>18.047</td><td>17.224</td><td>17.587</td></tr><tr><td>CVAE</td><td>34.414</td><td>30.815</td><td>28.909</td><td>27.717</td><td>27.784</td><td>26.408</td><td>25.776</td><td>25.883</td><td>24.665</td><td>24.659</td></tr><tr><td>Reinforce</td><td>42.781</td><td>42.471</td><td>41.142</td><td>43.295</td><td>42.129</td><td>41.657</td><td>42.235</td><td>42.093</td><td>40.269</td><td>42.282</td></tr><tr><td>BIT*</td><td>39.543</td><td>37.086</td><td>35.744</td><td>34.002</td><td>34.007</td><td>31.414</td><td>31.587</td><td>31.651</td><td>30.841</td><td>29.601</td></tr><tr><td>RRT*</td><td>43.368</td><td>42.855</td><td>42.981</td><td>43.355</td><td>42.919</td><td>42.410</td><td>42.680</td><td>42.441</td><td>42.504</td><td>42.165</td></tr></table>
md/train/rJgYxn09Fm/rJgYxn09Fm.md ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LEARNING IMPLICITLY RECURRENT CNNS THROUGH PARAMETER SHARING
2
+
3
+ Pedro Savarese TTI-Chicago savarese@ttic.edu
4
+
5
+ Michael Maire University of Chicago mmaire@uchicago.edu
6
+
7
+ # ABSTRACT
8
+
9
+ We introduce a parameter sharing scheme, in which different layers of a convolutional neural network (CNN) are defined by a learned linear combination of parameter tensors from a global bank of templates. Restricting the number of templates yields a flexible hybridization of traditional CNNs and recurrent networks. Compared to traditional CNNs, we demonstrate substantial parameter savings on standard image classification tasks, while maintaining accuracy.
10
+
11
+ Our simple parameter sharing scheme, though defined via soft weights, in practice often yields trained networks with near strict recurrent structure; with negligible side effects, they convert into networks with actual loops. Training these networks thus implicitly involves discovery of suitable recurrent architectures. Though considering only the design aspect of recurrent links, our trained networks achieve accuracy competitive with those built using state-of-the-art neural architecture search (NAS) procedures.
12
+
13
+ Our hybridization of recurrent and convolutional networks may also represent a beneficial architectural bias. Specifically, on synthetic tasks which are algorithmic in nature, our hybrid networks both train faster and extrapolate better to test examples outside the span of the training set.
14
+
15
+ # 1 INTRODUCTION
16
+
17
+ The architectural details of convolutional neural networks (CNNs) have undergone rapid exploration and improvement via both human hand-design (Simonyan & Zisserman, 2015; Szegedy et al., 2015; He et al., 2016; Huang et al., 2017; Zhu et al., 2018) and automated search methods (Zoph & Le, 2017; Liu et al., 2018). Yet, this vast array of work limits itself to a circuit-like view of neural networks. Here, a CNN is regarded as a fixed-depth feed-forward circuit, with a distinct parameter governing each internal connection. These circuits are often trained to perform tasks which, in a prior era, might have been (less accurately) accomplished by running a traditional computer program coded by humans. Programs, and even traditional hardware circuits, have a more reusable internal structure, including subroutines or modules, loops, and associated control flow mechanisms.
18
+
19
+ We bring one aspect of such modularity into CNNs, by making it possible to learn a set of parameters that is reused across multiple layers at different depths. As the pattern of reuse is itself learned, our scheme effectively permits learning the length (iteration count) and content of multiple loops defining the resulting CNN. We view this approach as a first step towards learning neural networks with internal organization reminiscent of computer programs. Though we focus solely on loop-like structures, leaving subroutines and dynamic control flow to future work, this simple change suffices to yield substantial quantitative and qualitative benefits over the standard baseline CNN models.
20
+
21
+ While recurrent neural networks (RNNs) possess a loop-like structure by definition, their loop structure is fixed a priori, rather than learned as part of training. This can actually be a disadvantage in the event that the length of the loop is mismatched to the target task. Our parameter sharing scheme for CNNs permits a mix of loops and feed-forward layers to emerge. For example, trained with our scheme, a 50-layer CNN might learn a 2-layer loop that executes 5 times between layers 10 and 20, a 3-layer loop that runs 4 times from layers 30 to 42, while leaving the remaining layers to assume independent parameter sets. Our approach generalizes both CNNs and RNNs, creating a hybrid.
22
+
23
+ ![](images/a2c9b5bb263d8cd0bf0d9985922b8c7f6508fe346bcd32491b1fd6dc3f69077c.jpg)
24
+ Figure 1: Parameter sharing scheme. Left: A CNN (possibly a variant such as a residual network), with each convolutional layer $_ { i }$ containing an individual parameter set $\boldsymbol { \mathsf { W } } ^ { ( i ) }$ . Middle: Parameter sharing among layers, where parameter templates $\boldsymbol { \mathsf { T } } ^ { ( 1 ) }$ , ${ \boldsymbol { \mathsf { T } } } ^ { ( 2 ) }$ are shared among each layer $_ { i }$ , which now only contains a 2-dimensional parameter $\mathbf { \pmb { \alpha } } ^ { ( i ) }$ . Weights $\boldsymbol { \mathsf { W } } ^ { ( i ) }$ (no longer parameters, illustrated with dotted boxes) used by layer $i$ are generated from $\mathbf { \pmb { \alpha } } ^ { ( i ) }$ and templates ${ \boldsymbol { \mathsf { T } } } ^ { ( 1 ) }$ , ${ \boldsymbol { \mathsf { T } } } ^ { ( 2 ) }$ . Right: If weights $\boldsymbol { \mathsf { W } } ^ { ( i ) }$ are outputs of a linear function (as in our method), learning parameter templates can be viewed as learning layer templates, offering a new (although equivalent) perspective for the middle diagram. Non-linearities are omitted for simplicity.
25
+
26
+ Figure 1 diagrams the parameter sharing scheme facilitating this hybridization. Inspired by dictionary learning, different network layers share, via weighted combination, global parameter templates. This re-parameterization is fully differentiable, allowing learning of sharing weights and template parameters. Section 3 elaborates, and also introduces tools for analyzing learned loop structures.
27
+
28
+ Section 4 demonstrates advantages of our hybrid CNNs across multiple experimental settings. Taking a modern CNN design as a baseline, and re-parameterizing it according to our scheme improves:
29
+
30
+ • Parameter efficiency. Here, we experiment with the standard task of image classification using modern residual networks (He et al., 2016; Zagoruyko & Komodakis, 2016). This task is a good proxy for general usefulness in computer vision, as high-performance classification architectures often serve as a backbone for many other vision tasks, such as semantic segmentation (Chen et al., 2016; Zhao et al., 2017).
31
+
32
+ Our parameter sharing scheme drastically reduces the number of unique parameters required to achieve a given accuracy on CIFAR (Krizhevsky, 2009) or ImageNet (Russakovsky et al., 2015) classification tasks. Re-parameterizing a standard residual network with our scheme cuts parameters, without triggering any drop in accuracy. This suggests that standard CNNs may be overparameterized in part because, by design (and unlike RNNs), they lack capacity to learn reusable internal operations.
33
+
34
+ • Extrapolation and generalization. Here, we explore whether our hybrid networks expand the class of tasks that one can expect to train neural networks to accomplish. This line of inquiry, focusing on synthetic tasks, shares motivations with work on Neural Turing Machines (Graves et al., 2014). Specifically, we would like neural networks to be capable of learning to perform tasks for which there are concise traditional solution algorithms. Graves et al. (2014) uses sorting as an example task. As we examine an extension of CNNs, our tasks take the form of queries about planar graphs encoded as image input.
35
+
36
+ On these tasks, we observe improvements to both generalization ability and learning speed for our hybrid CNNs, in comparison to standard CNNs or RNNs. Our parameter sharing scheme, by virtue of providing an architectural bias towards networks with loops, appears to assist in learning to emulate traditional algorithms.
37
+
38
+ An additional side effect, seen in practice in many of our experiments, is that two different learned layers often snap to the same parameter values. That is, layers $i$ and $j$ , learn coefficient vectors $\mathbf { \alpha } \alpha ^ { ( i ) }$ and $\pmb { \alpha } ^ { ( j ) }$ (see Figure 1) that converge to be the same (up to scaling). This is a form of architecture discovery, as it permits representation of the CNN as a loopy wiring diagram between repeated layers. Section 4.3 presents example results. We also draw comparisons to existing neural architecture search (NAS) techniques. By simply learning recurrent structure as byproduct of training with standard stochastic gradient descent, we achieve accuracy competitive with current NAS procedures.
39
+
40
+ Before delving into the details of our method, Section 2 provides additional context in terms of prior work on recurrent models, parameter reduction techniques, and program emulation. Sections 3 and 4 describe our hybrid shared-parameter CNN, experimental setup, and results. Section 5 concludes with commentary on our results and possible future research pathways.1
41
+
42
+ # 2 RELATED WORK
43
+
44
+ Recurrent variants of CNNs are used extensively for visual tasks. Recently, Zamir et al. (2017) propose utilizing a convolutional LSTM (Shi et al., 2015) as a generic feedback architecture. RNN and CNN combinations have been used for scene labeling (Pinheiro & Collobert, 2014), image captioning with attention (Xu et al., 2015), and understanding video (Donahue et al., 2015), among others. These works combine CNNs and RNNs at a coarse scale, and in a fixed hand-crafted manner. In contrast, we learn the recurrence structure itself, blending it into the inner workings of a CNN.
45
+
46
+ Analysis of residual networks (He et al., 2016) reveals possible connections to recurrent networks stemming from their design (Liao & Poggio, 2016). Greff et al. (2017) provide evidence that residual networks learn to iteratively refine feature representations, making an analogy between a very deep residual network and an unrolled loop. Jastrzebski et al. (2018) further explore this connection, and experiment with training residual networks in which some layers are forced to share identical parameters. This hard parameter sharing scheme again builds a predetermined recurrence structure into the network. It yields successfully trained networks, but does not exhibit the type of performance gains that Section 4 demonstrates for our soft parameter sharing scheme.
47
+
48
+ Closely related to our approach is the idea of hypernetworks (Ha et al., 2016), in which one part of a neural network is parameterized by another neural network. Our shared template-based reparameterization could be viewed as one simple choice of hypernetwork implementation. Perhaps surprisingly, this class of ideas has not been well explored for the purpose of reducing the size of neural networks. Rather, prior work has achieved parameter reduction through explicit representation bottlenecks (Iandola et al., 2016), sparsifying connection structure (Prabhu et al., 2018; Huang et al., 2018; Zhu et al., 2018), and pruning trained networks (Han et al., 2016).
49
+
50
+ Orthogonal to the question of efficiency, there is substantial interest in extending neural networks to tackle new kinds of tasks, including emulation of computer programs. Some approach this problem using additional supervision in the form of execution traces (Reed & de Freitas, 2016; Cai et al., 2017), while other focus on development of network architectures that can learn from input-output pairs alone (Graves et al., 2014; 2016; Zaremba et al., 2016; Trask et al., 2018). Our experiments on synthetic tasks fall into the latter camp. At the level of architectural strategy, Trask et al. (2018) benefit from changing the form of activation function to bias the network towards correctly extrapolating common mathematical formulae. We build in a different implicit bias, towards learning iterative procedures within a CNN, and obtain a boost on correctly emulating programs.
51
+
52
+ # 3 SOFT PARAMETER SHARING
53
+
54
+ In convolutional neural networks (CNNs) and variants such as residual CNNs (ResNets) (He et al., 2016) and DenseNets (Huang et al., 2017), each convolutional layer $i$ contains a set of parameters $\boldsymbol { \mathsf { W } } ^ { ( i ) }$ , with no explicit relation between parameter sets of different layers. Conversely, a strict structure is imposed to layers of recurrent neural networks (RNNs), where, in standard models (Hochreiter & Schmidhuber, 1997), a single parameter set $\pmb { \mathsf { W } }$ is shared among all time steps. This leads to a program-like computational flow, where RNNs can be seen as loops with fixed length and content. While some RNN variants (Graves et al., 2013; Koutn´ık et al., 2014; Yang et al., 2018) are less strict on the length or content of loops, these are still typically fixed beforehand.
55
+
56
+ As an alternative to learning hard parameter sharing schemes – which correspond to the strict structure present in RNNs – our method consists of learning soft sharing schemes through a relaxation of this structure. We accomplish this by expressing each layer’s parameters $\boldsymbol { \mathsf { W } } ^ { ( i ) }$ as a linear combination of parameter templates $\mathbf { \overline { { I } } } ^ { ( 1 ) } , \ldots , \mathbf { \overline { { I } } } ^ { ( k ) }$ , each with the same dimensionality as $\boldsymbol { \mathsf { W } } ^ { ( i ) }$ :
57
+
58
+ ![](images/30aa8071d0e5ad98b194b3c861782577cf515638614a5ad4b9997a5766ff7be7.jpg)
59
+ Figure 2: Connection between the LSM matrix $S$ where $\begin{array} { r } { S _ { i , j } = \frac { | \langle { \pmb { \alpha } } ^ { ( i ) } , { \pmb { \alpha } } ^ { ( j ) } \rangle | } { \| { \pmb { \alpha } } ^ { ( i ) } \| \| { \pmb { \alpha } } ^ { ( j ) } \| } \ ) } \end{array}$ and the structure of the network. White and black entries correspond to maximum and minimum similarities $( S _ { i , j } = 1$ and $S _ { i , j } = 0$ , respectively). Left: Empirically, CNNs present no similarity between parameters of different layers. Middle: Trained with our method, the layer similarity matrix (LSM) captures similarities between different layers, including pairs with close to maximum similarity. Such pairs (depicted by same-colored coefficients and weights, and by white entries in the LSM) perform similar operations on their inputs. Right: We can tie together parameters of similar layers, creating a hard parameter sharing scheme. The network can then be folded, creating self-loops and revealing an explicit recurrent computation structure.
60
+
61
+ $$
62
+ \pmb { \mathsf { W } } ^ { ( i ) } : = \sum _ { j = 1 } ^ { k } \alpha _ { j } ^ { ( i ) } \pmb { \mathsf { T } } ^ { ( j ) }
63
+ $$
64
+
65
+ where $k$ is the number of parameter templates (chosen freely as a hyperparameter) and $\mathbf { \alpha } \alpha ^ { ( i ) }$ , a $k$ - dimensional vector, is the coefficients of layer $i$ . Figure 1 (left and middle) illustrates the difference between networks trained with and without our method. This relaxation allows for coefficients and parameter templates to be (jointly) optimized with gradient-based methods, yielding negligible extra computational cost, with a single constraint that only layers with same parameter sizes can share templates. Note that constraining coefficients $\mathbf { \alpha } \alpha ^ { ( i ) }$ to be one-hot vectors leads to hard sharing schemes, at the cost of non-differentiability.
66
+
67
+ Having $k$ as a free parameter decouples the number of parameters in network from its depth. Typically, $L$ convolutional layers with constant channel and kernel sizes $C , K$ have $O ( L C ^ { 2 } { \dot { K } } ^ { 2 } )$ total parameters. Our soft sharing scheme changes the total number of parameters to $O ( k L + k C ^ { 2 } K ^ { 2 } ) =$ $\scriptstyle \dot { O } ( k C ^ { 2 } K ^ { 2 } )$ . Sections 4.1 and 4.2 show that we can decrease the parameter count of standard models without significantly impacting accuracy, or simply attain higher accuracy with $k = L$ .
68
+
69
+ In the next two subsections, we discuss two consequences of the linearity of Equation (1). First, it enables alternative interpretations of our method. Second, and a major advantage, as is the case in many linear relaxations of integer problems, we are able to extract hard sharing schemes in practice, and consequently detect implicit self-loops in a CNN trained with our method.
70
+
71
+ # 3.1 INTERPRETATION
72
+
73
+ For layers $i$ that are linear in $\boldsymbol { \mathsf { W } } ^ { ( i ) }$ (e.g. matrix multiplication, convolution), we can view our method as learning template layers which are shared among a network. More specifically, for a convolutional layer $\mathbf { U } ^ { ( i ) } ( \mathbf { X } ) = \mathbf { W } ^ { ( i ) } \ast \mathbf { X }$ , and considering Equation (1):
74
+
75
+ $$
76
+ \mathbf { U } ^ { ( i ) } ( \mathbf { X } ) = \mathbf { W } ^ { ( i ) } * \mathbf { X } = \sum _ { j = 1 } ^ { k } \alpha _ { j } ^ { ( i ) } \mathbf { T } ^ { ( j ) } * \mathbf { X }
77
+ $$
78
+
79
+ where $\pmb { \mathsf { T } } ^ { ( j ) } * \pmb { \mathsf { X } }$ , the result of a convolution with filter sets $\bar { \mathsf { T } } ^ { ( j ) }$ , can be seen as the output of a template layer with individual parameters $\boldsymbol { \mathsf { T } } ^ { ( j ) }$ . Such layers can be seen as global feature extractors,
80
+
81
+ and coefficients $\mathbf { \alpha } \alpha ^ { ( i ) }$ determine which features are relevant for the $i$ ’th computation of a network.
82
+ This is illustrated in Figure 1 (right diagram).
83
+
84
+ This view gives a clear connection between coefficients $_ { \pmb { \alpha } }$ and the network’s structure. Having $\pmb { \alpha } ^ { ( i ) } = \pmb { \alpha } ^ { ( i + 2 ) }$ yields $\begin{array} { r } { \mathbf { W } ^ { ( i ) } = \sum _ { j = 1 } ^ { k } \alpha _ { j } ^ { ( i ) } \overline { { \mathbf { T } ^ { ( j ) } } } = \sum _ { j = 1 } ^ { k } \alpha _ { j } ^ { ( i + 2 ) } \overline { { \mathbf { T } ^ { ( j ) } } } = \mathbf { W } ^ { ( i + 2 ) } } \end{array}$ α(i+2)T(j) = W(i+2), and hence layers i and $i + 2$ are functionally equivalent. Such a network can be folded to generate an equivalent model with two layers and a self-loop, an explicitly recurrent network. While this is also possible for networks without parameter sharing, a learned alignment of $C ^ { 2 } K ^ { 2 }$ parameters is required (unlikely in practice), instead of aligning only $k \leq L$ parameters.
85
+
86
+ # 3.2 IMPLICIT RECURRENCES
87
+
88
+ To identify which layers in a network perform approximately the same operation, we can simply check whether their coefficients are similar. We can condense this information for all pairs of layers $i , j$ in a similarity matrix $S$ , where $S _ { i , j } = s ( \pmb { \alpha } ^ { ( i ) } , \pmb { \alpha } ^ { ( j ) } )$ for some similarity measure $s$ .
89
+
90
+ For networks with normalization layers, the network’s output is invariant to weight rescaling. In this setting, a natural measure is $\begin{array} { r } { s ( \pmb { \alpha } ^ { ( i ) } , \pmb { \alpha } ^ { ( j ) } ) = \frac { | \langle \pmb { \alpha } ^ { ( i ) } , \pmb { \alpha } ^ { ( j ) } \rangle | } { \| \pmb { \alpha } ^ { ( i ) } \| \| \pmb { \alpha } ^ { ( j ) } \| } } \end{array}$ (absolute value of cosine similarity), since it possess this same property.2 We call $S$ the layer similarity matrix (LSM). Figure 2 illustrates and Section 4.3 shows experimentally how it can be used to extract recurrent loops from trained CNNs.
91
+
92
+ While structure might emerge naturally, having a bias towards more structured (recurrent) models might be desirable. In this case, we can add a recurrence regularizer to the training objective, pushing parameters to values which result in more structure. For example, we can add the negative of sum of elements of the LSM: $\begin{array} { r } { \mathcal { L } _ { R } = \mathcal { L } - \lambda _ { R } \sum _ { i , j } S _ { i , j } } \end{array}$ , where $\mathcal { L }$ is the original objective. The larger $\lambda _ { R }$ is, the closer the elements of $S$ will be to 1. At an extreme case, this regularizer will push all elements in $S$ to 1, resulting in a network with a single layer and a self-loop.
93
+
94
+ # 4 EXPERIMENTS
95
+
96
+ We begin by training variants of standard models with soft parameter sharing, observing that it can offer parameter savings with little impact on performance, or increase performance at the same parameter count. Section 4.3 demonstrates conversion of a trained model into explicitly recurrent form. We then examine synthetic tasks (Section 4.4), where parameter sharing improves generalization. Appendix B contains details on the initialization for the coefficients $_ { \pmb { \alpha } }$ .
97
+
98
+ # 4.1 CLASSIFICATION ON CIFAR
99
+
100
+ The CIFAR-10 and CIFAR-100 datasets (Krizhevsky, 2009) are composed of 60, 000 colored $3 2 \times 3 2$ images, labeled among 10 and 100 classes respectively, and split into 50, 000 and 10, 000 examples for training and testing. We pre-process the training set with channel-wise normalization, and use horizontal flips and random crops for data augmentation, following He et al. (2016).
101
+
102
+ Using Wide ResNets (WRN) (Zagoruyko & Komodakis, 2016) as a base model, we train networks with the proposed soft parameter sharing method. Since convolution layers have different number of channels and kernel sizes throughout the network, we create 3 layer groups and only share templates among layers in the same group. More specifically, WRNs for CIFAR consist of 3 stages whose inputs and outputs mostly have a constant number of channels ( $C$ , $2 C$ and $_ { 4 C }$ , for some $C$ ). Each stage contains $\frac { L - 4 } { 3 }$ layers for a network with depth $L$ , hence we group layers in the same stage together, except for the first two, a residual block whose input has a different number of channels.
103
+
104
+ Thus, all layers except for the first 2 in each stage perform parameter sharing (illustrated in left diagram of Figure 4). Having $k$ templates per group means that $\textstyle { \frac { L - 4 } { 3 } } - 2$ convolution layers share $k$ parameter templates. We denote by SWRN- $L$ -w- $k$ a WRN with $L$ layers, widen factor $w$ and $k$ parameter templates per group (trained with our method). Setting $k \doteq \textstyle { \frac { L - 4 } { 3 } } - 2$ L−4 − 2 means we have
105
+
106
+ Table 1: Test error $( \% )$ on CIFAR-10 and CIFAR100. SWRN 28-10, the result of training a WRN 28- 10 with our method and one template per layer, significantly outperforms the base model, suggesting that our method aids optimization (both models have the same capacity). SWRN 28-10-1, with a single template per sharing group, performs close to WRN 28-10 while having significantly less parameters and capacity. \* indicates models trained with dropout $p = 0 . 3$ (Srivastava et al., 2014). Results are average of 5 runs.
107
+
108
+ <table><tr><td rowspan=1 colspan=1>CIFAR</td><td rowspan=1 colspan=1>Params</td><td rowspan=1 colspan=2>C-10+</td><td rowspan=1 colspan=1>C-10+</td></tr><tr><td rowspan=2 colspan=1>WRN 28-10WRN 28-10*</td><td rowspan=2 colspan=1>36M36M</td><td rowspan=1 colspan=2>4.0</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=2>3.89</td><td></td></tr><tr><td rowspan=2 colspan=1>SWRN28-10SWRN 28-10*SWRN 28-10-1</td><td rowspan=2 colspan=1>36M36M12M</td><td rowspan=1 colspan=2>3.74</td><td rowspan=1 colspan=1>18.78</td></tr><tr><td rowspan=1 colspan=2>3.884.01</td><td rowspan=1 colspan=1>18.4319.73</td></tr></table>
109
+
110
+ Table 2: Performance of wider SWRNs. Parameter reduction $k = 2$ ) leads to lower errors for CIFAR-10, with models being competitive against newer model families that have bottleneck layers, group convolutions, or many layers. Best SWRN results are in bold, and best overall results are underlined.
111
+
112
+ <table><tr><td rowspan=1 colspan=1>CIFAR</td><td rowspan=1 colspan=1>Params</td><td rowspan=1 colspan=1>C-10+</td><td rowspan=1 colspan=1>C-100+</td></tr><tr><td rowspan=2 colspan=1>ResNeXt-2916x64DenseNet 100-24DenseNet 190-40</td><td rowspan=1 colspan=1>68M</td><td rowspan=1 colspan=1>3.58</td><td rowspan=1 colspan=1>17.31</td></tr><tr><td rowspan=1 colspan=1>27M26M</td><td rowspan=1 colspan=1>3.743.46</td><td rowspan=1 colspan=1>19.2517.18</td></tr><tr><td rowspan=4 colspan=1>SWRN 28-10*SWRN 28-10-2*SWRN 28-14*-SWRN 28-14-2*SWRN 28-18*SWRN 28-18-2*</td><td rowspan=3 colspan=1>36M17M71M33M</td><td rowspan=1 colspan=1>3.88</td><td rowspan=1 colspan=1>18.43</td></tr><tr><td rowspan=1 colspan=1>3.75</td><td rowspan=1 colspan=1>18.66</td></tr><tr><td rowspan=1 colspan=1>3.673.69</td><td rowspan=1 colspan=1>18.2518.37</td></tr><tr><td rowspan=1 colspan=1>118M55M</td><td rowspan=1 colspan=1>3.483.43</td><td rowspan=1 colspan=1>17.4317.75</td></tr></table>
113
+
114
+ ![](images/518464ecb2ecb59b86a82552d2161e01f30f11f898a98ee94b417a56caf2307c.jpg)
115
+ Figure 3: Parameter efficiency for different models. On both CIFAR-10 and CIFAR-100, SWRNs are significantly more efficient than WRNs. DN and RNX denotes DenseNet and ResNeXt, respectively, and are plotted for illustration: both models employ orthogonal efficiency techniques, such as bottleneck layers. Best viewed in color.
116
+
117
+ one parameter template per layer, and hence no parameter reduction. We denote SWRN-L- $\mathbf { \nabla } \cdot w$ (thus omitting $k$ ) as a model in this setting.
118
+
119
+ Following Zagoruyko & Komodakis (2016), we train each model for 200 epochs with SGD and Nesterov momentum of 0.9 and a batch size of 128. The learning rate is initially set to 0.1 and decays by a factor of 5 at epochs 60, 120 and 160. We also apply weight decay of $\mathrm { 5 \times 1 0 ^ { - 4 } }$ on all parameters except for the coefficients $_ \alpha$ .
120
+
121
+ Tables 1 and 2 present results. Networks trained with our method yield superior performance in the setting with no parameter reduction: SWRN 28-10 presents $6 . 5 \%$ and $2 . 5 \%$ lower relative test errors on C-10 and C-100, compared to the base WRN 28-10 model. With fewer templates than layers, SWRN 28-10-1 (all 6 layers of each group perform the same operation), performs virtually the same as the base WRN 28-10 network, while having $\frac 1 3$ of its parameters. On CIFAR-10, parameter reduction $k = 2$ ) is beneficial to test performance: the best performance is achieved by SWRN 28-18-2 ( $3 . 4 3 \%$ test error), outperforming the ResNeXt-29 16x64 model (Xie et al., 2017), while having fewer parameters (55M against 68M) and no bottleneck layers.
122
+
123
+ Figure 3 shows that our parameter sharing scheme uniformly improves accuracy-parameter efficiency; compare the WRN model family (solid red) to our SWRN models (dotted red).
124
+
125
+ Table 4 presents a comparison between our method and neural architecture search (NAS) techniques (Zoph & Le, 2017; Xie et al., 2019; Liu et al., 2019; Pham et al., 2018; Real et al., 2018) on CIFAR-10 – results differ from Table 2 solely due to cutout (DeVries & Taylor, 2017), which is commonly used in NAS literature; NAS results are quoted from their respective papers. Our method outperforms architectures discovered by recent NAS algorithms, such as DARTS (Liu et al., 2019),
126
+
127
+ Table 3: (below) ImageNet classification results: training WRN 50-2 with soft parameter sharing leads to better performance by itself, without any tuning on the number of templates $k$ . Top-1 and Top-5 errors $( \% )$ are computed using a single crop.
128
+
129
+ <table><tr><td rowspan=1 colspan=1>ImageNet</td><td rowspan=1 colspan=1>Params</td><td rowspan=1 colspan=1>Top-1</td><td rowspan=1 colspan=1>Top-5</td></tr><tr><td rowspan=4 colspan=1>WRN 50-2DenseNet-264ResNet-200SWRN 50-2</td><td rowspan=1 colspan=1>69M</td><td rowspan=1 colspan=1>22.0</td><td rowspan=1 colspan=1>6.05</td></tr><tr><td rowspan=3 colspan=1>33M65M69M</td><td rowspan=1 colspan=1>22.15</td><td rowspan=1 colspan=1>6.12</td></tr><tr><td rowspan=1 colspan=1>21.66</td><td rowspan=2 colspan=1>5.795.95</td></tr><tr><td rowspan=1 colspan=1>21.74</td></tr></table>
130
+
131
+ Table 4: (right) Test error $( \% )$ on CIFAR-10 of SWRNs and models found via neural architecture search (NAS) (all trained with cutout). Networks trained with soft parameter sharing provide competitive performance against NAS methods while having low computational cost.
132
+
133
+ <table><tr><td rowspan=1 colspan=1>CIFAR-10</td><td rowspan=1 colspan=1>Params(M)</td><td rowspan=1 colspan=1>Training Time(GPU days)</td><td rowspan=1 colspan=1>Test Error(%)</td></tr><tr><td rowspan=8 colspan=1>NASNet-ANASNet-AAmoebaNet-BAmoebaNet-BAmoebaNet-BAmoebaNet-BDARTSSNASENAS</td><td rowspan=1 colspan=1>3.3</td><td rowspan=1 colspan=1>1800</td><td rowspan=1 colspan=1>2.65</td></tr><tr><td rowspan=1 colspan=1>27.6</td><td rowspan=1 colspan=1>1800</td><td rowspan=1 colspan=1>2.4</td></tr><tr><td rowspan=1 colspan=1>2.8</td><td rowspan=1 colspan=1>3150</td><td rowspan=1 colspan=1>2.55</td></tr><tr><td rowspan=1 colspan=1>13.7</td><td rowspan=1 colspan=1>3150</td><td rowspan=1 colspan=1>2.31</td></tr><tr><td rowspan=1 colspan=1>26.7</td><td rowspan=1 colspan=1>3150</td><td rowspan=1 colspan=1>2.21</td></tr><tr><td rowspan=1 colspan=1>34.9</td><td rowspan=1 colspan=1>3150</td><td rowspan=1 colspan=1>2.13</td></tr><tr><td rowspan=1 colspan=1>3.4</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>2.83</td></tr><tr><td rowspan=1 colspan=1>2.84.6</td><td rowspan=1 colspan=1>1.50.45</td><td rowspan=1 colspan=1>2.852.89</td></tr><tr><td rowspan=1 colspan=1>WRN28-10(baseline with cutout)</td><td rowspan=1 colspan=1>36.4</td><td rowspan=1 colspan=1>0.4</td><td rowspan=1 colspan=1>3.08</td></tr><tr><td rowspan=4 colspan=1>SWRN 28-4-2SWRN 28-6-2SWRN 28-10SWRN 28-10-2SWRN 28-14SWRN 28-14-2</td><td rowspan=1 colspan=1>2.7</td><td rowspan=1 colspan=1>0.12</td><td rowspan=2 colspan=1>3.453.0</td></tr><tr><td rowspan=1 colspan=1>6.1</td><td rowspan=1 colspan=1>0.25</td></tr><tr><td rowspan=1 colspan=1>36.417.1</td><td rowspan=1 colspan=1>0.40.4</td><td rowspan=1 colspan=1>2.72.69</td></tr><tr><td rowspan=1 colspan=1>71.433.5</td><td rowspan=1 colspan=1>0.70.7</td><td rowspan=1 colspan=1>2.552.53</td></tr></table>
134
+
135
+ SNAS (Xie et al., 2019) and ENAS (Pham et al., 2018), while having similarly low training cost. We achieve $2 . 6 9 \%$ test error after training less than 10 hours on a single NVIDIA GTX 1080 Ti. This accuracy is only bested by NAS techniques which are several orders of magnitude more expensive to train. Being based on Wide ResNets, our models do, admittedly, have more parameters.
136
+
137
+ Comparison to recent NAS algorithms, such as DARTS and SNAS, is particularly interesting as our method, though motivated differently, bears some notable similarities. Specifically, all three methods are gradient-based and use an extra set of parameters (architecture parameters in DARTS and SNAS) to perform some kind of soft selection (over operations/paths in DARTS/SNAS; over templates in our method). As Section 4.3 will show, our learned template coefficients $_ { \pmb { \alpha } }$ can often be used to transform our networks into an explicitly recurrent form - a discovered CNN-RNN hybrid.
138
+
139
+ To the extent that our method can be interpreted as a form of architecture search, it might be complementary to standard NAS methods. While NAS methods typically search over operations (e.g. activation functions; $3 \times 3$ or $5 \times 5$ convolutions; non-separable, separable, or grouped filters; dilation; pooling), our soft parameter sharing can be seen as a search over recurrent patterns (which layer processes the output at each step). These seem like orthogonal aspects of neural architectures, both of which may be worth examining in an expanded search space. When using SGD to drive architecture search, these aspects take on distinct forms at the implementation level: soft parameter sharing across layers (our method) vs hard parameter sharing across networks (recent NAS methods).
140
+
141
+ # 4.2 CLASSIFICATION ON IMAGENET
142
+
143
+ We use the ILSVRC 2012 dataset (Russakovsky et al., 2015) as a stronger test of our method. It is composed of 1.2M training and 50, 000 validation images, drawn from 1000 classes. We follow Gross & Wilber (2016), as in Zagoruyko & Komodakis (2016); Huang et al. (2017); Xie et al. (2017), and report Top-1 and Top-5 errors on the validation set using single $2 2 4 \times 2 2 4$ crops. For this experiment, we use WRN 50-2 as a base model, and train it with soft sharing and no parameter reduction. Having bottleneck blocks, this model presents less uniform number of channels of layer inputs and outputs. To apply our method, we group convolutions in 12 groups: for each of the 4 stages in a WRN 50-2, we create 3 groups, one for each type of layer in a bottleneck unit $C B$ , $B B$ and $B C$ channel mappings, for bottleneck $B$ ). Without any change in hyperparameters, the network trained with our method outperforms the base model and also deeper models such as DenseNets (though using more parameters), and performs close to ResNet-200, a model with four times the number of layers and a similar parameter count. See Table 3.
144
+
145
+ ![](images/b732ae6be691db0bfcb9987fe694e903c55b587b5610872d701c1f589fd45a91.jpg)
146
+ Figure 4: Extracting implicit recurrences from a SWRN 28-10-4. Left: Illustration of the stages of a SWRN28-10-4 (residual connections omitted for clarity). The first two layers contain individual parameter sets, while the other six share four templates. All 3 stages of the network follow this structure. Middle: LSM for each stage after training on CIFAR-10, with many elements close to 1. Hard sharing schemes can be created for pairs with large similarity by tying their coefficients (or, equivalently, their effective weights). Right: Folding stages 2 and 3 leads to self-loops and a CNN with recurrent connections – LSM for stage 2 is a repetition of 2 rows/columns, and folding decreases the number of parameters.
147
+
148
+ # 4.3 LEARNING IMPLICIT RECURRENCES
149
+
150
+ Results on CIFAR suggest that training networks with few parameter templates $k$ in our soft sharing scheme results in performance comparable to the base models, which have significantly more parameters. The lower $k$ is, the larger we should expect the layer similarities to be: in the extreme case where $k = 1$ , all layers in a sharing scheme have similarity 1, and can be folded into a single layer with a self-loop.
151
+
152
+ For the case $k > 1$ , there is no trivial way to fold the network, as layer similarities depend on the learned coefficients. We can inspect the model’s layer similarity matrix (LSM) and see if it presents implicit recurrences: a form of recurrence in the rows/columns of the LSM. Surprisingly, we observe that rich structures emerge naturally in networks trained with soft parameter sharing, even without the recurrence regularizer. Figure 4 shows the per-stage LSM for CIFAR-trained SWRN 28-10-4. Here, the six layers of its stage-2 block can be folded into a loop of two layers, leading to an error increase of only $0 . 0 2 \%$ . Appendix A contains an additional example of network folding, diversity of LSM patterns across different runs, and an epoch-wise evolution of the LSM, showing that many patterns are observable after as few as 5 epochs of training.
153
+
154
+ # 4.4 EVALUATION ON NATURALLY RECURRENT TASKS
155
+
156
+ While the propensity of our parameter sharing scheme to encourage learning of recurrent networks is a useful parameter reduction tool, we would also like to leverage it for qualitative advantages over standard CNNs. On tasks for which a natural recurrent algorithm exists, does training CNNs with soft parameter sharing lead to better extrapolation?
157
+
158
+ To answer this, we set up a synthetic algorithmic task: computing shortest paths. Examples are $3 2 \times 3 2$ grids containing two query points and randomly (with probability 0.1) placed obstacles. The objective is to indicate which grid points belong to a shortest path between the query points.
159
+
160
+ We use curriculum learning for training, allowing us to observe how well each model adapts to more difficult examples as training phases progress. Moreover, for this task curriculum learning causes faster learning and superior performance for all trained models.
161
+
162
+ ![](images/4c18a6433c8b4ef4f71dfc645665348dda2d2c2330d29e897fbe70e58b1e7d07.jpg)
163
+
164
+ ![](images/5797e1d23a50ae81bd8845709e604165aa331d04a7a0159a8e27a17f5d892741.jpg)
165
+
166
+ (a) Generated example for the synthetic shortest paths task. Blue pixels indicate the query points; red pixels represent obstacles, and white pixels are points in a shortest path (in terms of Manhattan distance) between query pixels. The task consists of predicting the white pixels (shortest paths) from the blue and red ones (queries and obstacles).
167
+
168
+ (b) Training curves for the shortest paths task, where difficulty of examples increases every 50 epochs. A SCNN adapts faster than a CNN to new phases and performs better, suggesting better extrapolation capacity. With a recurrence regularizer $\lambda _ { R } = 0 . 0 1$ (SCNN-R), the model makes faster progress on the first phase, but fails to adapt to harder examples.
169
+
170
+ Figure 5: Shortest paths task. Best viewed in color.
171
+
172
+ Training consists of 5 curriculum phases, each one containing 5000 examples. The maximum allowed distance between the two query points increases at each phase, thus increasing difficulty. In the first phase, each query point is within a $5 \times 5$ grid around the other query point, and the grid size increases by 2 on each side at each phase, yielding a final grid size of $2 1 \times 2 1$ at phase 5.
173
+
174
+ We train a CNN, a CNN with soft parameter sharing and one template per layer (SCNN), and an SCNN with recurrence regularizer $\lambda _ { R } = 0 . 0 1$ . Each model trains for 50 epochs per phase with Adam (Kingma & Ba, 2015) and a fixed learning rate of 0.01. As classes are heavily unbalanced and the balance itself changes during phases, we compare $F _ { 1 }$ scores instead of classification error.
175
+
176
+ Each model starts with a $1 \times 1$ convolution, mapping the 2 input channels to 32 output channels. Next, there are 20 channel-preserving $3 \times 3$ convolutions, followed by a final $1 \times 1$ convolution that maps 32 channels to 1. Each of the $2 0 3 \times 3$ convolutions is followed by batch normalization (Ioffe & Szegedy, 2015), a ReLU non-linearity (Nair & Hinton, 2010), and has a 1-skip connection.
177
+
178
+ Figure 5 shows one example from our generated dataset and the training curves for the 3 trained models: the SCNN not only outperforms the CNN, but adapts better to harder examples at new curriculum phases. The SCNN is also advantaged over a more RNN-like model: with the recurrence regularizer $\lambda _ { R } = 0 . 0 1$ , all entries in the LSM quickly converge 1, as in a RNN. This leads to faster learning during the first phase, but presents issues in adapting to difficulty changes in latter phases.
179
+
180
+ # 5 CONCLUSION
181
+
182
+ In this work, we take a step toward more modular and compact CNNs by extracting recurrences from feed-forward models where parameters are shared among layers. Experimentally, parameter sharing yields models with lower error on CIFAR and ImageNet, and can be used for parameter reduction by training in a regime with fewer parameter templates than layers. Moreover, we observe that parameter sharing often leads to different layers being functionally equivalent after training, enabling us to collapse them into recurrent blocks. Results on an algorithmic task suggest that our shared parameter structure beneficially biases extrapolation. We gain a more flexible form of behavior typically attributed to RNNs, as our networks adapt better to out-of-domain examples. Our form of architecture discovery is also competitive with neural architecture search (NAS) algorithms, while having a smaller training cost than state-of-the-art gradient-based NAS.
183
+
184
+ As the only requirement for our method is for a network to have groups of layers with matching parameter sizes, it can be applied to a plethora of CNN model families, making it a general technique with negligible computational cost. We hope to raise questions regarding the rigid definitions of
185
+
186
+ CNNs and RNNs, and increase interest in models that fall between these definitions. Adapting our method for models with non-uniform layer parameter sizes (Huang et al., 2017; Zhu et al., 2018) might be of particular future interest.
187
+
188
+ # REFERENCES
189
+
190
+ Jonathon Cai, Richard Shin, and Dawn Song. Making neural programming architectures generalize via recursion. ICLR, 2017.
191
+
192
+ Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. DeepLab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected CRFs. arXiv:1606.00915, 2016.
193
+
194
+ Terrance DeVries and Graham W. Taylor. Improved regularization of convolutional neural networks with cutout. Journal of Machine Learning Research, 2017.
195
+
196
+ Jeffrey Donahue, Lisa Anne Hendricks, Sergio Guadarrama, Marcus Rohrbach, Subhashini Venugopalan, Kate Saenko, and Trevor Darrell. Long-term recurrent convolutional networks for visual recognition and description. CVPR, 2015.
197
+
198
+ Alex Graves, Abdel-rahman Mohamed, and Geoffrey Hinton. Speech recognition with deep recurrent neural networks. ICASSP, 2013.
199
+
200
+ Alex Graves, Greg Wayne, and Ivo Danihelka. Neural Turing Machines. arXiv:1410.5401, 2014.
201
+
202
+ Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka GrabskaBarwinska, Sergio G ´ omez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, ´ Adria Puigdom \` enech Badia, Karl Moritz Hermann, Yori Zwols, Georg Ostrovski, Adam Cain, \` Helen King, Christopher Summerfield, Phil Blunsom, Koray Kavukcuoglu, and Demis Hassabis. Hybrid computing using a neural network with dynamic external memory. Nature, 2016.
203
+
204
+ K. Greff, R. K. Srivastava, and J. Schmidhuber. Highway and residual networks learn unrolled iterative estimation. ICLR, 2017.
205
+
206
+ Sam Gross and Martin Wilber. Training and investigating residual nets. https://github.com/ facebook/fb.resnet.torch, 2016.
207
+
208
+ David Ha, Andrew Dai, and Quoc V. Le. Hypernetworks. arXiv:1609.09106, 2016.
209
+
210
+ Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. ICLR, 2016.
211
+
212
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CVPR, 2016.
213
+
214
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 1997.
215
+
216
+ Gao Huang, Zhuang Liu, Laurens van der Maaten, and Kilian Q. Weinberger. Densely connected convolutional networks. CVPR, 2017.
217
+
218
+ Gao Huang, Shichen Liu, Laurens van der Maaten, and Kilian Q. Weinberger. CondenseNet: An efficient DenseNet using learned group convolutions. CVPR, 2018.
219
+
220
+ Forrest N. Iandola, Matthew W. Moskewicz, Khalid Ashraf, Song Han, William J. Dally, and Kurt Keutzer. SqueezeNet: AlexNet-level accuracy with 50x fewer parameters and ${ < } 1 \mathbf { M } \mathbf { B }$ model size. arXiv:1602.07360, 2016.
221
+
222
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. ICML, 2015.
223
+
224
+ Stanislaw Jastrzebski, Devansh Arpit, Nicolas Ballas, Vikas Verma, Tong Che, and Yoshua Bengio. Residual connections encourage iterative inference. ICLR, 2018.
225
+
226
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. ICLR, 2015.
227
+
228
+ Jan Koutn´ık, Klaus Greff, Faustino Gomez, and Jurgen Schmidhuber. A clockwork RNN. ¨ arXiv:1402.3511, 2014.
229
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
230
+ Qianli Liao and Tomaso A. Poggio. Bridging the gaps between residual learning, recurrent neural networks and visual cortex. arXiv:1604.03640, 2016.
231
+ Chenxi Liu, Barret Zoph, Jonathon Shlens, Wei Hua, Li-Jia Li, Li Fei-Fei, Alan L. Yuille, Jonathan Huang, and Kevin Murphy. Progressive neural architecture search. ECCV, 2018.
232
+ Hanxiao Liu, Karen Simonyan, and Yiming Yang. DARTS: Differentiable architecture search. ICLR, 2019.
233
+ Vinod Nair and Geoffrey E. Hinton. Rectified linear units improve restricted boltzmann machines. ICML, 2010.
234
+ Hieu Pham, Melody Guan, Barret Zoph, Quoc Le, and Jeff Dean. Efficient neural architecture search via parameters sharing. ICML, 2018.
235
+ Pedro O. Pinheiro and Ronan Collobert. Recurrent convolutional neural networks for scene labeling. ICML, 2014.
236
+ Ameya Prabhu, Girish Varma, and Anoop M. Namboodiri. Deep expander networks: Efficient deep networks from graph theory. ECCV, 2018.
237
+ Esteban Real, Alok Aggarwal, Yanping Huang, and Quoc V Le. Regularized evolution for image classifier architecture search. arXiv:1802.01548, 2018.
238
+ Scott E. Reed and Nando de Freitas. Neural programmer-interpreters. ICLR, 2016.
239
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael S. Bernstein, Alexander C. Berg, and Fei-Fei Li. Imagenet large scale visual recognition challenge. IJCV, 115(3), 2015.
240
+ Andrew M. Saxe, James L. McClelland, and Surya Ganguli. Exact solutions to the nonlinear dynamics of learning in deep linear neural networks. arXiv:1312.6120, 2013.
241
+ Xingjian Shi, Zhourong Chen, Hao Wang, Dit-Yan Yeung, Wai-Kin Wong, and Wang-chun Woo. Convolutional LSTM network: A machine learning approach for precipitation nowcasting. NIPS, 2015.
242
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. ICLR, 2015.
243
+ Nitish Srivastava, Geoffrey E. Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(1), 2014.
244
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott E. Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. CVPR, 2015.
245
+ Andrew Trask, Felix Hill, Scott Reed, Jack Rae, Chris Dyer, and Phil Blunsom. Neural arithmetic logic units. arXiv:1808.00508, 2018.
246
+ Saining Xie, Ross B. Girshick, Piotr Dollar, Zhuowen Tu, and Kaiming He. Aggregated residual ´ transformations for deep neural networks. CVPR, 2017.
247
+ Sirui Xie, Hehui Zheng, Chunxiao Liu, and Liang Lin. SNAS: stochastic neural architecture search. ICLR, 2019.
248
+ 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. ICML, 2015.
249
+
250
+ Yibo Yang, Zhisheng Zhong, Tiancheng Shen, and Zhouchen Lin. Convolutional neural networks with alternately updated clique. CVPR, 2018.
251
+
252
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. BMVC, 2016.
253
+
254
+ Amir Roshan Zamir, Te-Lin Wu, Lin Sun, William B. Shen, Jitendra Malik, and Silvio Savarese. Feedback networks. CVPR, 2017.
255
+
256
+ Wojciech Zaremba, Tomas Mikolov, Armand Joulin, and Rob Fergus. Learning simple algorithms from examples. ICML, 2016.
257
+
258
+ Hengshuang Zhao, Jianping Shi, Xiaojuan Qi, Xiaogang Wang, and Jiaya Jia. Pyramid scene parsing network. CVPR, 2017.
259
+
260
+ Ligeng Zhu, Ruizhi Deng, Zhiwei Deng, Greg Mori, and Ping Tan. Sparsely aggregated convolutional networks. ECCV, 2018.
261
+
262
+ Barret Zoph and Quoc V. Le. Neural architecture search with reinforcement learning. ICLR, 2017.
263
+
264
+ # Appendix
265
+
266
+ # A ADDITIONAL RESULTS FOR IMPLICIT RECURRENCES
267
+
268
+ Section 4.3 presents an example of implicit recurrences and folding of a SWRN 28-10-4 trained on CIFAR-10, where, for example, the last 6 layers in the second stage of the network fold into 2 layers with a self-loop.
269
+
270
+ Figure 6 presents an additional example, where non-trivial recurrences (unlike the one in Figure 4) emerge naturally, resulting in a model that is rich in structure.
271
+
272
+ ![](images/fc06843966b9e39486f71756cf26d0765bf6de008dc1755452226992594fc940.jpg)
273
+ Figure 6: SWRN 40-8-8 (8 parameter templates shared among groups of $\frac { 4 0 - 4 } { 3 } - 2 = 1 0$ layers) trained with soft parameter sharing on CIFAR-10. Each stage (originally with 12 layers – the first two do not participate in parameter sharing) can be folded to yield blocks with complex recurrences. For clarity, we use colors to indicate the computational flow: red takes precedence over green, which in turn has precedence over blue. Colored paths are only taken once per stage. Although not trivial to see, recurrences in each stage’s folded form are determined by row/column repetitions in the respective Layer Similarity Matrix. For example, for stage 2 we have $S _ { 5 , 3 } \approx S _ { 6 , 4 } \approx 1$ , meaning that layers 3, 4, 5 and 6 can be folded into layers 3 and 4 with a loop (captured by the red edge). The same holds for $S _ { 7 , 1 }$ $_ 1 , S _ { 8 , 2 } , S _ { 9 , 3 }$ and $S _ { 1 0 , 4 }$ , hence after the loop with layers 3 and 4, the flow returns to layer 1 and goes all the way to layer 4, which generates the stage’s output. Even though there is an approximation when folding the network (in this example, we are tying layers with similarity close to 0.8), the impact on the test error is less than $0 . 3 \%$ . Also note that the folded model has a total of 24 layers (20 in the stage diagrams, plus 4 which are not shown, corresponding to the first layer of the network and three $1 \times 1$ convolutions in skip-connections), instead of the original 40.
274
+
275
+ ![](images/fdc8c958fab5e3a2b0f2446ac5890d9310f5a57da70a5ba719a29d7cb24d7e4b.jpg)
276
+ Figure 7: LSMs of a SWRN 40-8-8 (composed of 3 stages, each with 10 layers sharing 8 templates) trained on CIFAR-10 for 5 runs with different random seeds. Although the LSMs differ across different runs, hard parameter sharing can be observed in all cases (off-diagonal elements close to 1, depicted by white), characterizing implicit recurrences which would enable network folding. Moreover, the underlying structure is similar across runs, with hard sharing typically happening among layers $_ { i }$ and $i + 2$ , leading to a “chessboard” pattern.
277
+
278
+ ![](images/5de972993320487ca663b8f5109f332ee4d92857e74173a62c2f72f4841412cd.jpg)
279
+ Figure 8: LSMs of a SWRN 40-8-8 (composed of 3 stages, each with 10 layers sharing 8 templates) at different epochs during training on CIFAR-10. The transition from an identity matrix to the final LSM happens mostly in the beginning of training: at epoch 50, the LSM is almost indistinguishable from the final LSM at epoch 200, and most of the final patterns are observable already at epoch 25.
280
+
281
+ # B INITIALIZATION OF COEFFICIENTS
282
+
283
+ During our initial experiments, we explored different initializations for the coefficients $_ { \pmb { \alpha } }$ of each layer, and observed that using an orthogonal initialization (Saxe et al., 2013) resulted in superior performance compared to uniform or normal initialization schemes.
284
+
285
+ Denote $\pmb { A }$ as the $L \times k$ matrix ( $L$ is the number of layers sharing parameters and $k$ the number of templates) with each $\because$ ’th row containing the coefficient of the $i ^ { \because }$ ’th layer $\mathbf { \alpha } \alpha ^ { ( i ) }$ . We initialize it such that $A ^ { T } A = I$ , leading to $\forall _ { i }$ , $\langle \pmb { \alpha } ^ { ( i ) } , \pmb { \alpha } ^ { ( i ) } \rangle = 1$ and $\forall _ { i \neq j } , \langle { \pmb { \alpha } } ^ { ( i ) } , { \pmb { \alpha } } ^ { ( j ) } \rangle = 0$ . While our choice for this is mostly empirical, we believe that there is likely a connection with the motivation for using orthogonal initialization for RNNs.
286
+
287
+ Moreover, we discovered that other initialization options for $\pmb { A }$ work similarly to the orthogonal one. More specifically, either initializing $\pmb { A }$ with the identity matrix when $L = k$ (which naturally leads to $A ^ { T } A = I $ ) or enforcing some sparsity (initialize $\pmb { A }$ with a uniform or normal distribution and randomly setting half of its entries to zero) performs similarly to the orthogonal initialization in a consistent manner. We believe the sparse initialization to be the simplest one, as each coefficient $_ { \pmb { \alpha } }$ can be initialized independently.
288
+
289
+ Finally, note that having $A ^ { T } A = I$ results in the Layer Similarity Matrix also being the identity at initialization (check that Si,j = $\begin{array} { r } { S _ { i , j } = \frac { | \langle { \pmb { \alpha } } ^ { ( i ) } , { \pmb { \alpha } } ^ { ( j ) } \rangle | } { \| { \pmb { \alpha } } ^ { ( i ) } \| \| { \pmb { \alpha } } ^ { ( j ) } \| } = \frac { | ( { \pmb { A } } ^ { T } { \pmb { A } } ) _ { i , j } | } { \| { \pmb { \alpha } } ^ { ( i ) } \| \| { \pmb { \alpha } } ^ { ( j ) } \| } } \end{array}$ |(AT A)i,j |kα(i)kkα(j)k , so if (AT A)i,j = 1, then Si,j = 1, and the same holds for 0. Surprisingly, even though the orthogonal initialization leads to a LSM that has no structure in the beginning of training, the rich patterns that we observe still emerge naturally after optimization.
md/train/rJxHsjRqFQ/rJxHsjRqFQ.md ADDED
@@ -0,0 +1,344 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HYPERBOLIC ATTENTION NETWORKS
2
+
3
+ Caglar Gulcehre, Misha Denil, Mateusz Malinowski, Ali Razavi, Razvan Pascanu, Karl Moritz Hermann, Peter Battaglia, Victor Bapst, David Raposo, Adam Santoro, Nando de Freitas
4
+
5
+ DeepMind
6
+
7
+ # ABSTRACT
8
+
9
+ Recent approaches have successfully demonstrated the benefits of learning the parameters of shallow networks in hyperbolic space. We extend this line of work by imposing hyperbolic geometry on the embeddings used to compute the ubiquitous attention mechanisms for different neural networks architectures. By only changing the geometry of embedding of object representations, we can use the embedding space more efficiently without increasing the number of parameters of the model. Mainly as the number of objects grows exponentially for any semantic distance from the query, hyperbolic geometry –as opposed to Euclidean geometry– can encode those objects without having any interference. Our method shows improvements in generalization on neural machine translation on WMT’14 (English to German), learning on graphs (both on synthetic and real-world graph tasks) and visual question answering (CLEVR) tasks while keeping the neural representations compact.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ The focus of this work is to endow neural network representations with suitable geometry to capture fundamental properties of data, including hierarchy and clustering behaviour. These properties emerge in many real-world scenarios that approximately follow power-law distributions (Newman, 2005; Clauset et al., 2009). This includes a wide range of natural phenomena in physics (Lin and Tegmark, 2017), biology (McGill et al., 2006), and even human-made structures such as metabolic-mass relationships (Borg, 1982), social networks (Krioukov et al., 2010; Papadopoulos et al., 2010), and frequencies of words (Powers, 1998; Piantadosi, 2014; Takahashi and Tanaka-Ishii, 2017).
14
+
15
+ Complex networks (Krioukov et al., 2010), which connect distinguishable heterogeneous sets of elements represented as nodes, provide us an intuitive way of understanding these structures. They will also serve as our starting point for introducing hyperbolic geometry, which is by itself difficult to visualize. Nodes in complex networks are referred to as heterogeneous, in the sense that they can be divided into sub-nodes which are themselves distinguishable from each other. The scale-free structure of natural data manifests itself as a power law distribution on the node degrees of the complex network that describes it.
16
+
17
+ Complex networks can be approximated with tree-like structures, such as taxonomies and dendrograms, and as lucidly presented by Krioukov et al. (2010), hyperbolic spaces can be thought of as smooth trees abstracting the hierarchical organization of complex networks. Let us begin by recalling a simple property of $n$ -ary trees that will help us understand hyperbolic space and why hyperbolic geometry is well suited to model relational data.
18
+
19
+ In an $n$ -ary tree, the number of nodes at distance $r$ from the root and the number of nodes at distance no more than $r$ from the root both grow as $n ^ { r }$ . Similarly, in a two-dimensional hyperbolic space with curvature $- \zeta ^ { 2 } , \zeta > 0$ , the circumference and area of a disc of radius $r$ grows as $2 \pi { \mathrm { s i n h } } ( \zeta r )$ and $2 \pi ( \cosh ( \zeta r ) - 1 )$ , respectively, both of are exponential in $r$ (Krioukov et al., 2009; 2010). The growth of volume in hyperbolic space should be contrasted with Euclidean space where the corresponding quantities expand polynomially, circumference as $2 \pi r$ and area as $\pi r ^ { 2 }$ .
20
+
21
+ In the two-dimensional example of Figure 1, the expanding rings show examples at a fixed semantic distance from the central object (“pug”). The number of concepts grows quickly with semantic distance forcing each successive ring to be more crowded in order to maintain a fixed distance to the center. In contrast, the extra volume of hyperbolic spheres (depicted by reducing the size of the examples) allows all of the examples to remain well separated from their semantic neighbours.
22
+
23
+ ![](images/917015691c7380fd6981c92a366234722e36b16c14b1a9c068b3a31e7d42e0b8.jpg)
24
+ Figure 1: An intuitive depiction of how images might be embedded in 2D. The location of the embeddings reflects the similarity between each image and that of a pug. Since the number of instances within a given semantic distance from the central object grows exponentially, the Euclidean space is not able to compactly represent such structure (left). In hyperbolic space (right) the volume grows exponentially, allowing for sufficient room to embed the images. For visualization, we have shrunk the images in this Euclidean diagram, a trick also used by Escher.
25
+
26
+ Mechanically, the computed embeddings by a random network for objects at a given semantic distance might still seem epsilon distance away from each other (or crowded) as the ones obtained by using Euclidean geometry. However, enforcing hyperbolic geometry intuitively means that all operations with these embeddings take into account, the density in that particular region of the space. For example, any noise introduced in the system (e.g., in gradients) will also be corrected by the density. In contrast to working in Euclidean space, this means that the embeddings will be equally distinguishable regardless of the density.
27
+
28
+ The intimate connection between hyperbolic space and scale free networks (where node degree follows a power law) is made more precise in Krioukov et al. (2010). In particular, there it is shown that the heterogeneous topology implies hyperbolic geometry, and conversely hyperbolic geometry yields heterogeneous topology. Moreover, Sarkar (2011) describes a construction that embeds trees in two-dimensional hyperbolic space with arbitrarily low distortion, which is not possible in Euclidean space of any dimension (Linial et al., 1998). Following this exciting line of research, recently the machine learning community has gained interest in learning non-Euclidean embeddings directly from data (Nickel and Kiela, 2017; Chamberlain et al., 2017; Ritter, 1999; Ontrup and Ritter, 2002; Tay et al., 2018; Bronstein et al., 2017).
29
+
30
+ Fuelled by the desire of increasing the capacity of neural networks without increasing the number of trainable parameters so as to match the complexity of data, we propose hyperbolic attention networks. As opposed to previous approaches, which impose hyperbolic geometry on the parameters of shallow networks (Nickel and Kiela, 2017; Chamberlain et al., 2017), we impose hyperbolic geometry on the activations of deep networks. This allows us to exploit hyperbolic geometry to reason about embeddings produced by deep networks. We introduce efficient hyperbolic operations to express the popular, ubiquitous mechanism of attention (Bahdanau et al., 2014; Duan et al., 2017; Vaswani et al., 2017; Wang et al., 2017). Our method shows improvements in terms of generalization on neural machine translation (Vaswani et al., 2017), learning on graphs and visual question answering (Antol et al., 2015; Malinowski and Fritz, 2014; Johnson et al., 2017) tasks while keeping the representations compact. Simultaneously to our work, Cho et al. (2018) proposed a method to learn SVMs in the hyperboloid model of hyperbolic space, and Nickel and Kiela (2018) proposed a method to learn shallow embeddings of graphs in hyperbolic space by using the hyperboloid model.
31
+
32
+ # 2 MODELS OF HYPERBOLIC SPACE
33
+
34
+ Hyperbolic space cannot be isometrically embedded into Euclidean space (Krioukov et al., 2010); however, there are several ways to endow different subsets of Euclidean space with a hyperbolic metric, leading to different models of hyperbolic space. This leads to the well known Poincaré ball model (Iversen, 1992) and many others.
35
+
36
+ The different models of hyperbolic space are all essentially the same, but different models define different coordinate systems, which offer different affordances for computation. In this paper, we primarily make use of the hyperboloid (or Lorentz) model of the hyperbolic space. Since the hyperboloid is unbounded, it a convenient target for projecting into hyperbolic space. We also make use of the Klein model, because it admits an efficient expression for the hyperbolic aggregation operation we define in Section 4.2.
37
+
38
+ We briefly review the definitions of the hyperboloid and Klein models and the relationship between them, in just enough detail to support the presentation in the remainder of the paper. A more thorough treatment can be found in Iversen (1992). The geometric relationship between the Klein and hyperboloid models is diagrammed in Figure 5 of the supplementary material.
39
+
40
+ Hyperboloid model: This model of $n$ dimensional hyperbolic space is a manifold in the $n + 1$ dimensional Minkowski space. The Minkowski space is $\bar { \mathbb { R } ^ { n + 1 } }$ endowed with the indefinite Minkowski bilinear form
41
+
42
+ $$
43
+ \langle \mathbf { q } , \mathbf { k } \rangle _ { M } { = } \sum _ { i = 1 } ^ { n } q _ { i } k _ { i } { - } q _ { n + 1 } k _ { n + 1 } .
44
+ $$
45
+
46
+ The hyperboloid model consists of the set
47
+
48
+ $$
49
+ \mathbb { H } ^ { n } = \{ \mathbf { x } \in \mathbb { R } ^ { n + 1 } | \langle \mathbf { x } , \mathbf { x } \rangle _ { M } = - 1 , x _ { n + 1 } > 0 \}
50
+ $$
51
+
52
+ endowed with the distance metric $d _ { \mathbb { H } } ( \mathbf { q } , \mathbf { k } ) = \operatorname { a r c c o s h } ( - \left. \mathbf { q } , \mathbf { k } \right. _ { M } )$
53
+
54
+ Klein model: This model of hyperbolic space is a subset of $\mathbb { R } ^ { n }$ given by $\mathbb { K } ^ { n } = \left\{ \mathbf { x } \in \mathbb { R } ^ { n } | \| \mathbf { x } \| < 1 \right\}$ , and a point in the Klein model can be obtained from the corresponding point in the hyperboloid model by projection
55
+
56
+ $$
57
+ \pi _ { \mathbb { H } \mathbb { K } } ( \mathbf { x } ) _ { i } = \frac { x _ { i } } { x _ { n + 1 } } ,
58
+ $$
59
+
60
+ with its inverse given by
61
+
62
+ $$
63
+ \pi _ { \mathbb { K } \to \mathbb { H } } ( \mathbf { x } ) = \frac { 1 } { \sqrt { 1 - \left\| \mathbf { x } \right\| ^ { 2 } } } ( \mathbf { x } , 1 )
64
+ $$
65
+
66
+ Distance computations in the Klein model can be inherited from the hyperboloid, in the sense that $d _ { \mathbb { K } } ( \mathbf { q } , \mathbf { k } ) = d _ { \mathbb { H } } ( \pi _ { \mathbb { K } \mathbb { H } } ( \mathbf { k } ) , \pi _ { \mathbb { K } \mathbb { H } } ( \mathbf { q }$ ).
67
+
68
+ # 3 ATTENTION AS A BUILDING BLOCK FOR RELATIONAL REASONING
69
+
70
+ Learning relations in a graph by using neural networks to model the interactions or relations has shown promising results in visual question answering (Santoro et al., 2017), modelling physical dynamics (Battaglia et al., 2016), and reasoning over graphs (Li et al., 2015; Vendrov et al., 2016; Kipf et al., 2018; Kool and Welling, 2018). Graph neural networks (Li et al., 2015; Battaglia et al., 2016) incorporate a message passing as part of the architecture in order to capture the intrinsic relations between entities. Graph convolution networks (Bruna et al., 2013; Kipf and Welling, 2016; Defferrard et al., 2016) use convolutions to efficiently learn a continuous-space representation for a graph of interest.
71
+
72
+ Many of these relational reasoning models can be expressed in terms of an attentive read operation. In the following subsection, we give a general description of the attentive read, and then discuss its specific instantiations in two relational reasoning models from the literature.
73
+
74
+ # 3.1 ATTENTIVE READ
75
+
76
+ First introduced for translation in Bahdanau et al. (2014), attention has seen widespread use in deep learning, not only for applications in NLP but also for image processing (Wang et al., 2017) imitation
77
+
78
+ learning (Duan et al., 2017) and memory (Graves et al., 2016). The core computation is the attentive read operation, which has the following form:
79
+
80
+ $$
81
+ \mathbf { r } ( \mathbf { q } _ { i } , \{ \mathbf { k } _ { j } \} _ { j } ) = \sum _ { j } \frac { f ( \mathbf { q } _ { i } , \mathbf { k } _ { j } ) } { Z } \mathbf { v } _ { i j } .
82
+ $$
83
+
84
+ Here $\mathbf { q } _ { i }$ is a vector called the query and the $\mathbf { k } _ { j }$ ’s are the keys for the memory locations being read from. The pairwise function $f ( \cdot , \cdot )$ computes a scalar matching score between a query and a key, and the vector $\mathbf { v } _ { i j }$ is a value to be read from location $j$ by query $i$ . $Z > 0$ is a normalization factor for the full sum. Both $\mathbf { v } _ { i j }$ and $Z$ are free to depend on arbitrary information, but we leave any dependencies here implicit.
85
+
86
+ It will be useful in the discussion to break this operation down into two parts. The first is the matching, which computes attention weights $\alpha _ { i j } = f ( \mathbf { q } _ { i } , \mathbf { k } _ { j } )$ and the second is the aggregation, which takes a weighted average of the values using these weights,
87
+
88
+ $$
89
+ m _ { i } ( \{ \alpha _ { i j } \} _ { j } , \{ \mathbf { v } _ { i j } \} _ { j } ) = \sum _ { j } \frac { \alpha _ { i j } } { Z } \mathbf { v } _ { i j } .
90
+ $$
91
+
92
+ Instantiating a particular attentive read operation involves specifying both $f ( \cdot , \cdot )$ and $\mathbf { v } _ { i j }$ along with the normalization constant $Z$ .
93
+
94
+ If one performs an attentive read for each element of the set $j$ then the resulting operation corresponds in a natural way to message passing on a graph, where each node $i$ aggregates messages $\{ \mathbf { v } _ { i j } \} _ { j }$ from its neighbours along edges of weight $f ( \mathbf { q } _ { i } , \mathbf { k } _ { j } ) / Z$ .
95
+
96
+ We can express many (although not all) message passing neural network architectures (Gilmer et al., 2017) using the attentive read operation of Equation 1 as a primitive. In the following sections we do this for two architectures and then discuss how we can replace both the matching and aggregation steps with versions that leverage hyperbolic geometry.
97
+
98
+ # 3.2 RELATION NETWORKS
99
+
100
+ Relation Networks (RNs) (Santoro et al., 2017) are a neural network architecture designed for reasoning about the relationships between objects. An RN operates on a set of objects $O$ by applying a shared operator to each pair of objects $( \mathbf { o } _ { i } , \mathbf { o } _ { j } ) { \in } O \times O$ . The pairs can be augmented by a global information, and the result of each relational operation is passed through a further global transformation.
101
+
102
+ Using the notation of the previous section, we can write the RN as
103
+
104
+ $$
105
+ R N ( O , \mathbf { c } ) = h \left( \sum _ { i } \mathbf { r } ( \mathbf { o } _ { i } , \{ \mathbf { o } _ { j } \} _ { j } ) ) \right) ,
106
+ $$
107
+
108
+ where $f ( \mathbf { o } _ { i } , \mathbf { o } _ { j } ) = 1$ , $\mathbf { v } _ { i j } = g ( \mathbf { o } _ { i } , \mathbf { o } _ { j } , \mathbf { c } )$ , $Z = 1$ . $h$ is the global transformation, $g$ is the local transformation and $\mathbf { c }$ is the global context, as described in Santoro et al. (2017). We augment the basic RN to allow $f ( \mathbf { o } _ { i } , \mathbf { o } _ { j } ) \in [ 0 , \bar { 1 } ]$ to be a general learnable function.
109
+
110
+ Interpreting the RN as learned message passing on a graph over objects, the attention weights take on the semantics of edge weights, where $\alpha _ { i j }$ can be thought of as the probability of the (directed) edge $\mathbf { o } _ { j } \mathbf { o } _ { i }$ appearing in the underlying reasoning graph.
111
+
112
+ # 3.3 SCALED DOT-PRODUCT ATTENTION
113
+
114
+ In the Transformer model of Vaswani et al. (2017) the authors define an all-to-all message passing operation on a set of vectors which they call scaled dot-product attention. In the language of Section 3.1 the scaled dot-product attention operation performs several attentive reads in parallel, one for each element of the input set.
115
+
116
+ Vaswani et al. (2017) write scaled dot-product attention as $\scriptstyle \mathbf { R } = \operatorname { s o f t m a x } \left( { \frac { \mathbf { Q } \mathbf { K } ^ { T } } { \sqrt { d } } } \right) \mathbf { V }$ , where ${ \bf Q } , { \bf K }$ and $\mathbf { V }$ are referred to as the queries, keys, and values respectively, and $d$ is the shared dimensionality of the queries and keys. Using lowercase letters to denote rows of the corresponding matrices, we can write each row of $\mathbf { R }$ as the result of an attentive read with
117
+
118
+ $$
119
+ f ( \mathbf { q } _ { i } , \mathbf { k } _ { j } ) = \exp \left( \frac { 1 } { \sqrt { d } } \langle \mathbf { q } _ { i } , \mathbf { k } _ { j } \rangle \right) , \qquad \mathbf { v } _ { i j } = \mathbf { v } _ { j } , \qquad Z = \sum _ { j } f ( \mathbf { q } _ { i } , \mathbf { k } _ { j } ) .
120
+ $$
121
+
122
+ We experiment with both softmax and sigmoid operations for computing the attention weights in our hyperbolic models. The motivation for considering sigmoid attention weights is that in some applications (e.g. visual question answering), it makes sense for the attention weights over different entities to not compete with each other.
123
+
124
+ # 4 HYPERBOLIC ATTENTION NETWORKS
125
+
126
+ In this section we show how to redefine the attentive read operation of Section 3.1 as an operation on points in hyperbolic space. The key for doing this is to define new matching and aggregation functions that operate on hyperbolic points and take advantage of the metric structure of the manifold they live on. However, in order to apply these operations inside of a network we first we need a way to interpret network activations as points in hyperbolic space.
127
+
128
+ We describe how to map an arbitrary point in $\mathbb { R } ^ { n }$ onto the hyperboloid, where we can interpret the result as a point in hyperbolic space. The choice of mapping is important since we must ensure that the rapid scaling behavior of hyperbolic space is maintained. Armed with an appropriate mapping we proceed to describe the hyperbolic matching and aggregation operations that operate on these points.
129
+
130
+ # 4.1 HYPERBOLIC NETWORK ACTIVATIONS
131
+
132
+ Mapping neural network activations into hyperbolic space requires care, since network activations might live anywhere in $\mathbb { R } ^ { n }$ , but hyperbolic structure can only be imposed on special subsets of Euclidean space (Krioukov et al., 2010). This means we need a way to map activations into an appropriate manifold. We choose to map into the hyperboloid, which is convenient since it is the only unbounded model of hyperbolic space in common use.
133
+
134
+ Pseudo-polar coordinates: In polar coordinates, we express an $n$ -dimensional point as a scalar radius, and $n { - } 1$ angles. Pseudo-polar coordinates consist of a radius $r$ , as in ordinary polar coordinates, and an $n$ -dimensional vector d representing the direction of the point from the origin. In the following discussion we assume that the coordinates are normalized, i.e. that $\lVert \mathbf { d } \rVert = 1$ .
135
+
136
+ If $( \mathbf { d } , r ) \in \mathbb { R } ^ { n + 1 }$ are the activations of a layer in the network, we map them onto the hyperbolid in $\mathbb { R } ^ { n + 1 }$ using $\pi ( ( \mathbf { d } , r ) ) = ( \sinh ( r ) \mathbf { d } , \cosh ( r ) )$ , which increases the scale by an exponential factor.
137
+
138
+ It is easily verified that the resulting point lies in the hyperboloid, and to verify that we maintain the appropriate scaling properties we compute the distance between a point and the origin using this projection:
139
+
140
+ $$
141
+ d _ { \mathbb { H } } ( \mathbf { 0 } , ( \mathbf { d } , r ) ) { = } \mathrm { a r c c o s h } ( - \langle \pi ( \mathbf { 0 } ) , \pi ( ( \mathbf { d } , r ) ) \rangle _ { M } ) { = } r ~ ,
142
+ $$
143
+
144
+ which shows that this projection preserves exponential growth in volume for a linear increase in $r$ . Without the exponential scaling factor the effective distance of $\pi ( ( \mathbf { d } , r ) )$ from the origin grows logarithmically in hyperbolic space.1
145
+
146
+ # 4.2 HYPERBOLIC ATTENTION
147
+
148
+ In this section, we show how to build an attentive read operation that operates on points in hyperbolic space. We consider how to exploit hyperbolic geometry in both the matching and the aggregation steps of the attentive read operation separately.
149
+
150
+ Hyperbolic matching: The most natural way to exploit hyperbolic geometry for matching pairs of points is to use the hyperbolic distance between them. Given a query $\mathbf { q } _ { i }$ and a key $\mathbf { k } _ { j }$ both lying in hyperbolic space we take,
151
+
152
+ $$
153
+ \alpha ( { \bf q } _ { i } , { \bf k } _ { j } ) = f ( - \beta d _ { \mathbb { H } } ( { \bf q } _ { i } , { \bf k } _ { j } ) - c ) ~ ,
154
+ $$
155
+
156
+ where $d _ { \mathbb { H } } ( \cdot , \cdot )$ is the hyperbolic distance, and $\beta$ and $c$ are parameters that can be set manually or learned along with the rest of the network. Having the bias parameter $c$ is useful because distances are non-negative. We take the function $f ( \cdot )$ to be either $\exp ( \cdot )$ , in which case we set the normalization appropriately to obtain a softmax, or sigmoid $( \cdot )$ .
157
+
158
+ ![](images/d84a53f0e9de207b75f14bab09afb67e7fbb20fbfc60af2b7bd7c6cda602effc.jpg)
159
+ Figure 2: The computational graph for the self-attention mechanism of the hyperbolic Transformer.
160
+
161
+ Hyperbolic aggregation: The path to extend the weighted midpoint to hyperbolic space is much less obvious, but fortunately such a extension already exists as the Einstein midpoint. The Einstein midpoint is straightforward to compute by adjusting the aggregation weights appropriately (see Ungar (2005, Definition 4.21))
162
+
163
+ $$
164
+ m _ { i } ( \{ \alpha _ { i j } \} _ { j } , \{ { \bf v } _ { i j } \} _ { j } ) = \sum _ { j } \left[ \frac { \alpha _ { i j } \gamma ( { \bf v } _ { i j } ) } { \sum _ { \ell } \alpha _ { i \ell } \gamma ( { \bf v } _ { i \ell } ) } \right] { \bf v } _ { i j } ,
165
+ $$
166
+
167
+ where the $\gamma ( \mathbf { v } _ { i j } )$ are the Lorentz factors, that are given by $\begin{array} { r } { \gamma ( \mathbf { v } _ { i j } ) = \frac { 1 } { \sqrt { 1 - \| \mathbf { v } _ { i j } \| ^ { 2 } } } } \end{array}$ The norm in the denominator of the Lorentz factor is the Euclidean norm of the Klein coordinates of the point $\mathbf { v } _ { i j }$ , and the correctness of Equation 3 also relies on the points $\mathbf { v } _ { i j }$ being represented by their Klein coordinates. Fortunately the various models of hyperbolic space in common use are all isomorphic, so we can work in an arbitrary hyperbolic model and simply project to and from the Klein model to execute midpoint computations, as discussed in Section 2.
168
+
169
+ The reason for using the Einstein midpoint for hyperbolic aggregation is that it obeys many of the properties that we expect from a weighted average in Euclidean space. In particular, translating the $\mathbf { v } _ { i j }$ ’s by a fixed distance in a common direction also translates the midpoint, and it is invariant to rotations of the constellation of points about the midpoint. The derivation of this operation is quite involved, and beyond the scope of this paper. We point the interested reader to Ungar (2005; 2008) for a full exposition.
170
+
171
+ # 5 EXPERIMENTS
172
+
173
+ We evaluate our models on synthetic and real-world tasks. Experiments where the underlying graph structure is explicitly known clearly show the benefits of using hyperbolic geometry as an inductive bias. At the same time, we show that real-world tasks within implicit graph structure such as a diagnostic visual question answering task (Johnson et al., 2017), and neural machine translation, equally benefit from relying on hyperbolic geometry. We provide experiments with feed-forward networks, the Transformer (Vaswani et al., 2017) and Relation Networks (Santoro et al., 2017) endowed with hyperbolic attention.
174
+
175
+ Our results show the effectiveness of our approach on diverse tasks and architectures. The benefit of our approach is particularly prominent in relatively small models, which supports our hypothesis that hyperbolic geometry induces compact representations and is therefore better able to represent complex functions in limited space.
176
+
177
+ # 5.1 MODELING SCALE-FREE GRAPHS
178
+
179
+ We use the algorithm of von Looz et al. (2015) to efficiently generate large scale-free graphs, and define two predictive tasks that test our model’s ability to represent different aspects of the structure of these networks. For both tasks in this section, we train Recursive Transformer (RT) models, using hyperbolic and Euclidean attention. A Recursive Transformer is identical to the original transformer, except that the weights of each self-attention layer are tied across depth. Simultaneously to our work,
180
+
181
+ ![](images/d237011714960f4e38f8f8d7ea965840240a47c2ae93d9d1bbc33197f838a908.jpg)
182
+ Figure 3: Left: Performance of the Recursive Transformer models on the Shortest Path Length Prediction task on graphs of various sizes. The black dashed line indicates chance performance. Center: Results on Link Prediction Tasks. Right: The histogram of the radiuses for a model trained on a graph with 100 and 400 nodes.
183
+
184
+ Dehghani et al. (2018) have proposed the same model as a generalization of the Transformer model and they referred to it as "Universal Transformers". We use models with 3 recursive self-attention layers, each of which has 4 heads with 4 units each for each of q, k, and v. This model has similarities to Graph Attention Networks (Velickovi ˇ c et al., 2017; Kool and Welling, 2018). ´
185
+
186
+ Link prediction (LP): Link prediction is a classical graph problem, where the task is to predict if an edge exists between two nodes in the graph. We experimented with graphs of 1000 and 1200 nodes and observed that the hyperbolic RT performs better than the Euclidean RT on both tasks. We report the results in Figure 3 (middle). In general, we observed that for graphs of size 1000 and 1200 the hyperbolic transformer performs better than the Euclidean transformer given the same amount of capacity.
187
+
188
+ Shortest path length prediction (SPLP): In this task, the goal is to predict the length of the shortest path between a pair of nodes in the graph. We treat this as a classification problem with a maximum pathlength of 25 which becomes naturally an unbalanced classification problem. We use rejection sampling during training to ensure the network is trained on an approximately uniform distribution of path lengths. At test time we sample paths uniformly at random, so the length distribution follows that of the underlying graphs. We report the results in Figure 3 (left). In Figure 3 (right), we visualize the distribution of the scale of the learned activations $\dot { \boldsymbol { r } }$ in the projection of Section 4.1) when training on graphs of size 100 and 400. We observe that our model tends to use larger scales for the larger graphs. As a baseline, we compare to the optimal constant predictor, which always predicts the most common expected path length. This baseline does quite well since the path length distribution on the test set is quite skewed.
189
+
190
+ For both tasks, we generate training data online. Each example is a new graph in which we query the connectivity of a randomly chosen pair of nodes. To make training easier, we use a curriculum, whereby we start training on smaller graphs and gradually increase the number of vertices towards the final number. More details on the dataset generation procedure and the curriculum scheme are found in the supplementary material.
191
+
192
+ # 5.2 SORT-OF-CLEVR
193
+
194
+ Since we expect hyperbolic attention to be particularly well suited to relational modelling, we investigate our models on the relational variant of the Sort-of-CLEVR dataset (Santoro et al., 2017). This dataset consists of simple visual scenes allowing us to solely focus on the relational aspect of the problem. Our models extend Relation Nets (RNs) with the attention mechanism in hyperbolic space (with the Euclidean or Einstein midpoint aggregation), but otherwise we follow the standard setup-up (Santoro et al., 2017). Our best method yields accuracy of $9 9 . 2 \%$ that significantly exceeds the accuracy of the original RN $( 9 6 \% )$ .
195
+
196
+ However, we are more interested in evaluating models on the low-capacity regime. Indeed, as Figure 4 (left) shows, the attention mechanism computed in the hyperbolic space improves around 20 percent points over the standard RN, where all the models use only two units of the relational MLP.
197
+
198
+ # 5.3 EXPERIMENTS ON CITESEER AND CORA
199
+
200
+ We use two of the standard graph transduction benchmark datasets, Citeseer and Cora (Sen et al., 2008) and used the same experimental protocol defined in Velickovi ˇ c et al. (2017). We use ´ graph attention
201
+
202
+ ![](images/425a0b24b227f503fb044f953043d558bef80a15982e7465eda5cd1a38dc7d38.jpg)
203
+ Figure 4: Left: Comparison of our models with low-capacity on the Sort-of-CLEVR dataset. The “EA” refers to the model that uses hyperbolic attention weights with Euclidean aggregation. Right: Performance of Relation Network extended by attention mechanism in either Euclidean or hyperbolic space on the CLEVR dataset.
204
+
205
+ <table><tr><td colspan="3">Transductive</td></tr><tr><td>Method</td><td>Cora</td><td>Citeseer</td></tr><tr><td>GCN (Kipf and Welling, 2016)</td><td>81.5%</td><td>70.3%</td></tr><tr><td>GAT (Velickovic et al., 2017)</td><td>83.0%±0.14</td><td>72.5%± 0.14</td></tr><tr><td>H-GAT</td><td>83.5% ± 0.12</td><td>72.9% ± 0.078</td></tr></table>
206
+
207
+ Table 1: Results on graph transduction tasks. We have used the same setup that is described in (Velickovi ˇ c et al., 2017). H-GAT refers to our graph attention network with hyperbolic attention ´ mechanism. Table shows the mean performance over 100 random seeds, along with $9 5 \%$ confidence intervals for this estimate.
208
+
209
+ networks (GAT) as our baseline and developed a hyperbolic version of GAT (H-GAT) by replacing the original attention mechanism with the hyperbolic attention using softmax.
210
+
211
+ We report our results in Table 1 and compare against the GAT with the Euclidean attention mechanism. We compute the standard deviations over 100 seeds and got improvements both on Citeseer and Cora datasets over the original GAT model. We show the visualizations of the learned hyperbolic embeddings of q and k in A.4.
212
+
213
+ # 5.4 CLEVR
214
+
215
+ We train our Relation Network with various attention mechanisms on the CLEVR dataset (Johnson et al., 2017). CLEVR is a synthetic visual question answering datasets consisting of 3D rendered objects like spheres, cubes, or cylinders of various size, material, or color. In contrast to other visual question answering datasets (Antol et al., 2015; Malinowski and Fritz, 2014; Zhu et al., 2016), the focus of CLEVR is on relational reasoning.
216
+
217
+ In our experiments, we closely follow the procedure established in (Santoro et al., 2017), both in terms of the model architecture, capacity, or the choice of the hyperparameters, and only differ by the attention mechanism (Euclidean or hyperbolic attention), or sigmoid activations.
218
+
219
+ Results are shown in Figure 4 (Right). For each model, we vary the capacity of the relational part of the network and report the resulting test accuracy. We find that hyperbolic attention with sigmoid consistently outperforms other models. Our RN with hyperbolic attention and sigmoid achieves ${ \bar { 9 } } 5 . 7 \%$ accuracy on the test set at the same capacity level as RN, whereas the latter reportedly achieves $9 5 . 5 \%$ accuracy (Santoro et al., 2017).
220
+
221
+ # 5.5 NEURAL MACHINE TRANSLATION
222
+
223
+ The Transformer (Vaswani et al., 2017) is a recently introduced state of the art model for neural machine translation that relies heavily on attention as its core operation. As described in Section 3.3,
224
+
225
+ <table><tr><td></td><td colspan="3">WMT 2014 En-De BLEU Scores</td></tr><tr><td></td><td>Tiny</td><td>Base</td><td>Big</td></tr><tr><td>Transformer (Vaswani et al. (2017))</td><td>1</td><td>27.3</td><td>28.4</td></tr><tr><td>Transformer (Latest)</td><td>17.3</td><td>27.1</td><td>-</td></tr><tr><td>Hyperbolic Transformer (+Sigmoid)</td><td>17.5</td><td>27.4</td><td>1</td></tr><tr><td>Hyperbolic Transformer(+Softmax,+Pseudo-Polar)</td><td>17.9</td><td>27.4</td><td>=</td></tr><tr><td>Hyperbolic Transformer (+Sigmoid, +Pseudo-Polar)</td><td>18.6</td><td>27.9</td><td>28.52</td></tr></table>
226
+
227
+ Table 2: Results for the WMT14 English to German translation task. Results are computed following the procedure in Vaswani et al. (2017). Citations indicate results taken from the literature. Latest is the result of training a new model using an unmodified version of the same code where we added hyperbolic attention (we have observed that the exact performance of the transformer on this task varies as the Tensor2tensor codebase evolves).
228
+
229
+ we have extended the Transformer2 by replacing its scaled dot-product attention operation with its hyperbolic counterpart. We evaluate all the models on the WMT14 En-De dataset (Bojar et al., 2014).
230
+
231
+ We train several versions of the Transformer model with hyperbolic attention. They use different coordinate systems (Cartesian or pseudo-polar), or different attention normalization functions (softmax or sigmoid). We consider three model sizes, referred to here as tiny, base and big. The tiny model has two layers of encoders and decoders, each with 128 units and 4 attention heads. The base model has 6 layers of encoders and decoders, each with 512 units and 8 attention heads. All hyperparameter configurations for the Euclidean versions of these models are available in the Tensor2tensor repository.
232
+
233
+ Results are shown in Table 2. We observe improvements over the Euclidean model by using hyperbolic attention, in particular when coupled with the sigmoid activation function for the attention weights. The improvements are more significant when the model capacity is restricted.
234
+
235
+ In addition, our best model (with sigmoid activation function and without pseudo-polar coordinates) using the big architecture from Tensor2tensor, achieves 28.52 BLEU score, whereas Vaswani et al. (2017) report 28.4 BLEU score with the original version of this model.3.
236
+
237
+ # 6 CONCLUSION
238
+
239
+ We have presented a novel way to impose the inductive biases from hyperbolic geometry on the activations of deep neural networks. Our proposed hyperbolic attention operation makes use of hyperbolic geometry in both the computation of the attention weights, and in the aggregation operation over values. We implemented our proposed hyperbolic attention mechanism in both Relation Networks and the Transformer and showed that we achieve improved performance on a diverse set of tasks. We have shown improved performance on link prediction and shortest path length prediction in scale free graphs, on two visual question answering datasets, real-world graph transduction tasks and finally on English to German machine translation. The gains are particularly prominent in relatively small models, which confirms our hypothesis that hyperbolic geometry induces more compact representations.
240
+
241
+ Yang and Rush (2016) have proposed to imposed the activations of the neural network to lie on a Lie-group manifold in the memory. Similarly as a future work, an interesting potential future direction is to use hyperbolic geometry as an inductive bias for the activation of neural networks in the memory.
242
+
243
+ # ACKNOWLEDGEMENTS
244
+
245
+ We would like to thank Neil Rabinowitz, Chris Dyer for constructive comments on earlier versions of this draft. We thank Yannis Asseal for helping us with the styles of the plots in this draft. We would like to thank Thomas Paine for the constructive comments.
246
+
247
+ REFERENCES
248
+ Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C Lawrence Zitnick, and Devi Parikh. Vqa: Visual question answering. In Proceedings of the IEEE International Conference on Computer Vision, pages 2425–2433, 2015.
249
+ Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In International Conference on Learning Representations, 2014.
250
+ Peter Battaglia, Razvan Pascanu, Matthew Lai, Danilo Jimenez Rezende, et al. Interaction networks for learning about objects, relations and physics. In Advances in neural information processing systems, pages 4502–4510, 2016.
251
+ Ondrej Bojar, Christian Buck, Christian Federmann, Barry Haddow, Philipp Koehn, Johannes Leveling, Christof Monz, Pavel Pecina, Matt Post, Herve Saint-Amand, Radu Soricut, Lucia Specia, and Aleš Tamchyna. Findings of the 2014 workshop on statistical machine translation. In Proceedings of the Ninth Workshop on Statistical Machine Translation, pages 12–58, Baltimore, Maryland, USA, June 2014. Association for Computational Linguistics. URL http://www.aclweb.org/anthology/W/W14/W14-3302.
252
+ Gunnar A Borg. Psychophysical bases of perceived exertion. Med sci sports exerc, 14(5):377–381, 1982.
253
+ Michael M Bronstein, Joan Bruna, Yann LeCun, Arthur Szlam, and Pierre Vandergheynst. Geometric deep learning: going beyond euclidean data. IEEE Signal Processing Magazine, 34(4):18–42, 2017.
254
+ Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. arXiv preprint arXiv:1312.6203, 2013.
255
+ Benjamin Paul Chamberlain, James Clough, and Marc Peter Deisenroth. Neural embeddings of graphs in hyperbolic space. arXiv preprint arXiv:1705.10359, 2017.
256
+ Hyunghoon Cho, Benjamin DeMeo, Jian Peng, and Bonnie Berger. Large-margin classification in hyperbolic space. arXiv preprint arXiv:1806.00437, 2018.
257
+ Aaron Clauset, Cosma Rohilla Shalizi, and Mark EJ Newman. Power-law distributions in empirical data. SIAM review, 51(4):661–703, 2009.
258
+ Michaël Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on graphs with fast localized spectral filtering. In Advances in Neural Information Processing Systems, pages 3844–3852, 2016.
259
+ Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Łukasz Kaiser. Universal transformers. arXiv preprint arXiv:1807.03819, 2018.
260
+ Yan Duan, Marcin Andrychowicz, Bradly Stadie, OpenAI Jonathan Ho, Jonas Schneider, Ilya Sutskever, Pieter Abbeel, and Wojciech Zaremba. One-shot imitation learning. In Advances in neural information processing systems, pages 1087–1098, 2017.
261
+ Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. arXiv preprint arXiv:1704.01212, 2017.
262
+ Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka Grabska-Barwinska, ´ 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.
263
+ Birger Iversen. Hyperbolic geometry, volume 25. Cambridge University Press, 1992.
264
+ Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Li Fei-Fei, C Lawrence Zitnick, and Ross Girshick. Clevr: A diagnostic dataset for compositional language and elementary visual reasoning. In Computer Vision and Pattern Recognition (CVPR), 2017 IEEE Conference on, pages 1988–1997. IEEE, 2017.
265
+ Thomas Kipf, Ethan Fetaya, Kuan-Chieh Wang, Max Welling, and Richard Zemel. Neural relational inference for interacting systems. arXiv preprint arXiv:1802.04687, 2018.
266
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
267
+ WWM Kool and M Welling. Attention solves your tsp. arXiv preprint arXiv:1803.08475, 2018.
268
+ Dmitri Krioukov, Fragkiskos Papadopoulos, Amin Vahdat, and Marián Boguná. Curvature and temperature of complex networks. Physical Review E, 80(3):035101, 2009.
269
+ Dmitri Krioukov, Fragkiskos Papadopoulos, Maksim Kitsak, Amin Vahdat, and Marián Boguná. Hyperbolic geometry of complex networks. Physical Review E, 82(3):036106, 2010.
270
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. arXiv preprint arXiv:1511.05493, 2015.
271
+ Henry W Lin and Max Tegmark. Critical behavior in physics and probabilistic formal languages. Entropy, 19 (7):299, 2017.
272
+ Nathan Linial, Avner Magen, and Michael E Saks. Low distortion euclidean embeddings of trees. Israel Journal of Mathematics, 106(1):339–348, 1998.
273
+ Mateusz Malinowski and Mario Fritz. A multi-world approach to question answering about real-world scenes based on uncertain input. In Advances in neural information processing systems, pages 1682–1690, 2014.
274
+ Brian J McGill, Brian J Enquist, Evan Weiher, and Mark Westoby. Rebuilding community ecology from functional traits. Trends in ecology & evolution, 21(4):178–185, 2006.
275
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529, 2015.
276
+ Mark EJ Newman. Power laws, pareto distributions and zipf’s law. Contemporary physics, 46(5):323–351, 2005.
277
+ Maximilian Nickel and Douwe Kiela. Learning continuous hierarchies in the lorentz model of hyperbolic geometry. arXiv preprint arXiv:1806.03417, 2018.
278
+ Maximillian Nickel and Douwe Kiela. Poincaré embeddings for learning hierarchical representations. In Advances in Neural Information Processing Systems, pages 6341–6350, 2017.
279
+ Jorg Ontrup and Helge Ritter. Hyperbolic self-organizing maps for semantic navigation. In Advances in neural information processing systems, pages 1417–1424, 2002.
280
+ Fragkiskos Papadopoulos, Dmitri Krioukov, Marián Boguñá, and Amin Vahdat. Greedy forwarding in dynamic scale-free networks embedded in hyperbolic metric spaces. In INFOCOM, 2010 Proceedings IEEE, pages 1–9. IEEE, 2010.
281
+ Steven T Piantadosi. Zipf’s word frequency law in natural language: A critical review and future directions. Psychonomic bulletin & review, 21(5):1112–1130, 2014.
282
+ David MW Powers. Applications and explanations of zipf’s law. In Proceedings of the joint conferences on new methods in language processing and computational natural language learning, pages 151–160. Association for Computational Linguistics, 1998.
283
+ Helge Ritter. Self-organizing maps on non-euclidean spaces. In Kohonen maps, pages 97–109. Elsevier, 1999.
284
+ Adam Santoro, David Raposo, David G Barrett, Mateusz Malinowski, Razvan Pascanu, Peter Battaglia, and Tim Lillicrap. A simple neural network module for relational reasoning. In Advances in neural information processing systems, pages 4974–4983, 2017.
285
+ Rik Sarkar. Low distortion delaunay embedding of trees in hyperbolic plane. In International Symposium on Graph Drawing, pages 355–366. Springer, 2011.
286
+ Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina Eliassi-Rad. Collective classification in network data. AI magazine, 29(3):93, 2008.
287
+ Shuntaro Takahashi and Kumiko Tanaka-Ishii. Do neural nets learn statistical laws behind natural language? PloS one, 12(12):e0189326, 2017.
288
+ Yi Tay, Luu Anh Tuan, and Siu Cheung Hui. Hyperbolic representation learning for fast and efficient neural question answering. In Proceedings of the Eleventh ACM International Conference on Web Search and Data Mining, pages 583–591. ACM, 2018.
289
+ Abraham Albert Ungar. Analytic hyperbolic geometry: Mathematical foundations and applications. World Scientific, 2005.
290
+ Abraham Albert Ungar. A gyrovector space approach to hyperbolic geometry. Synthesis Lectures on Mathematics and Statistics, 1(1):1–194, 2008.
291
+ 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, pages 6000–6010, 2017.
292
+ Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua Bengio. Graph ´ attention networks. arXiv preprint arXiv:1710.10903, 2017.
293
+ Ivan Vendrov, Ryan Kiros, Sanja Fidler, and Raquel Urtasun. Order-embeddings of images and language. In ICLR, 2016.
294
+ Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Advances in Neural Information Processing Systems, pages 2692–2700, 2015.
295
+ Moritz von Looz, Henning Meyerhenke, and Roman Prutkin. Generating random hyperbolic graphs in subquadratic time. In International Symposium on Algorithms and Computation, pages 467–478. Springer, 2015.
296
+ Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. arXiv preprint arXiv:1711.07971, 2017.
297
+ Greg Yang and Alexander M. Rush. Lie access neural turing machine. arXiv preprint arXiv:1602.08671, 2016.
298
+ Yuke Zhu, Oliver Groth, Michael Bernstein, and Li Fei-Fei. Visual7w: Grounded question answering in images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4995–5004, 2016.
299
+
300
+ # A APPENDIX
301
+
302
+ # A.1 MORE ON MODELS OF HYPERBOLIC SPACE
303
+
304
+ In Figure 5, we illustrate the relationship between different models of hyperbolic space. There are one-to-one isometric transformations defined between each different models of the hyperbolic space. Hyperboloid model is unbounded, whereas Klein and Poincare models are bounded in a disk.
305
+
306
+ ![](images/41f4a49d70b83c38929ce3d8718b494f6d1c81c34f1cdb2969748fad366f5fdc.jpg)
307
+ Figure 5: Relationships between different representations of points used in the paper. Left: The relationship between pseudo-polar coordinates in $\mathbb { R } ^ { n }$ and the hyperboloid in $\mathbb { R } ^ { n + 1 }$ . Right: Projections relating the hyperboloid, Klein and Poincaré models of hyperbolic space.
308
+
309
+ # A.2 SCALE-FREE GRAPH GENERATION
310
+
311
+ We use the algorithm described by von Looz et al. (2015). In our experiments, we set the $\alpha$ to 0.95 and edge_radius_R_factor to 0.35. We will release our code both for generating and the operations in the hyperbolic space along with the camera-ready version of our paper.
312
+
313
+ # A.3 SCALE-FREE GRAPH CURRICULUM
314
+
315
+ Curriculum was an essential part of our training on the scale-free graph tasks. On LP and SPLP tasks, we use a curriculum where we extract the connected components from the graph by cutting the disk that the graphs generated on into slices by starting from a 30 degree angle and gradually increasing the size of the slice from the disk by increasing the angle during the training according to the number of lessons that are involved in the curriculum. This process is also visualized in Figure 6.
316
+
317
+ # A.4 VISUALIZATION OF QUERY AND KEY EMBEDDINGS ON CORA
318
+
319
+ In Figure 8 and 9, we visualize the embeddings of the query $( q )$ and the keys $( k )$ going into the hyperbolic matching function on the Poincare Ball model. In Figure 8, the embeddings of a model trained with dropout are bounded in a ball with smaller volume than the model trained without dropout. Also as clearly can be seen from the embedding visualizations k’s and q’s are clustered on different regions of the space.
320
+
321
+ # A.5 TRAVELLING SALESMAN PROBLEM (TSP)
322
+
323
+ We train an off-policy DQN-like agent (Mnih et al., 2015) with the HRT. The graphs for the TSP is generated following the procedure introduced in (Vinyals et al., 2015).
324
+
325
+ On this task, as an ablation we just compared the hyperbolic networks with and The results are provided in Figure 4 (Right) with and without implicit coordinates. Overall, we found that the hyperbolic transformer networks performs better when using the implicit polar coordinates.
326
+
327
+ # A.6 HYPERBOLIC RECURSIVE TRANSFORMER
328
+
329
+ As shown in Figure ??, the hyperbolic RT is an extension of transformer that ties the parameters of the self-attention layers. The self-attention layer gets the representations of the nodes of the graph coming from the encoder and the decoder decodes that representation from the recursive self-attention layers for the prediction.
330
+
331
+ ![](images/ffa7a6033a2daacb09745bba54dd38baace27eac981747e6caed41e2406d1ee5.jpg)
332
+ Figure 6: We show an example of a curriculum on the hyperbolic disk. In the first lesson, we take slices from the graph only between angle 0 and $\pi / 2$ . In the second lesson we will have to take the slice from 0 to $\pi$ .
333
+
334
+ ![](images/2b77d45c72ea00f743e01860b6db1df360e2ea5da868bd7487ae61a8b9f8440c.jpg)
335
+ Figure 7: An illustration of how trees can be represented in hyperbolic (left) and Euclidean geometry (right) in a cone. In hyperbolic space, as the tree grows the angles between the edges $\mathbf { \eta } ^ { ( \theta ) }$ can be preserved from one level to the next. In Euclidean space, since the number of nodes in the tree grows faster than the rate that the volume grows, angles may not be preserved ( $\boldsymbol { \theta }$ to $\alpha$ ). Lines in the left diagram are straight in hyperbolic space, but appear curved in this Euclidean diagram.
336
+
337
+ ![](images/50c796e2835fe35a0d7ba5a320b7318cd3265492d5aea900d09c92c80dc78571.jpg)
338
+ Figure 8: Hyperbolic embedding of $q$ (red) and $k$ (blue) in a Poincare Ball on Cora dataset. Each point corresponds to a node in the graph. This visualization is obtained from a model trained with dropout. The graph on the left is the embeddings going into the attention obtained from the first layer. The Figure on the right is for the embedding of the second layer.
339
+
340
+ ![](images/7cca480e2e9184bdad70ba87b2d79f8801c20858f96bcacc8f3a63211a2645a5.jpg)
341
+ Figure 9: Hyperbolic embeddings of q (red) and k (blue) in a Poincare Ball on Cora dataset. Each point corresponds to a node in the graph. This visualization is obtained from a model trained without dropout. The figure on the left shows the embeddings going into the attention obtained from the first layer. The figure on the right shows the embedding of the second layer.
342
+
343
+ ![](images/bf47e1dd9f14dc878172815ae0d1d82ca15f62ff5c6e5c5671e9d8ba8cdd5112.jpg)
344
+ Figure 10: The comparisons between a hyperbolic recursive transformer with and without pseudo-polar (denoted as $^ +$ spherical in the legend) coordinates on the travelling salesman problem.
md/train/rkgbYyHtwB/rkgbYyHtwB.md ADDED
@@ -0,0 +1,424 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DISAGREEMENT-REGULARIZED IMITATION LEARNING
2
+
3
+ Kiante Brantley ´ ∗ University of Maryland kdbrant@cs.umd.edu
4
+
5
+ Wen Sun Microsoft Research sun.wen@microsoft.com
6
+
7
+ Mikael Henaff Microsoft Research mihenaff@microsoft.com
8
+
9
+ # ABSTRACT
10
+
11
+ We present a simple and effective algorithm designed to address the covariate shift problem in imitation learning. It operates by training an ensemble of policies on the expert demonstration data, and using the variance of their predictions as a cost which is minimized with RL together with a supervised behavioral cloning cost. Unlike adversarial imitation methods, it uses a fixed reward function which is easy to optimize. We prove a regret bound for the algorithm which is linear in the time horizon multiplied by a coefficient which we show to be low for certain problems on which behavioral cloning fails. We evaluate our algorithm empirically across multiple pixel-based Atari environments and continuous control tasks, and show that it matches or significantly outperforms behavioral cloning and generative adversarial imitation learning.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Training artificial agents to perform complex tasks is essential for many applications in robotics, video games and dialogue. If success on the task can be accurately described using a reward or cost function, reinforcement learning (RL) methods offer an approach to learning policies which has proven to be successful in a wide variety of applications (Mnih et al., 2015; 2016; Lillicrap et al., 2016; Hessel et al., 2018). However, in other cases the desired behavior may only be roughly specified and it is unclear how to design a reward function to characterize it. For example, training a video game agent to adopt more human-like behavior using RL would require designing a reward function which characterizes behaviors as more or less human-like, which is difficult.
16
+
17
+ Imitation learning (IL) offers an elegant approach whereby agents are trained to mimic the demonstrations of an expert rather than optimizing a reward function. Its simplest form consists of training a policy to predict the expert’s actions from states in the demonstration data using supervised learning. While appealingly simple, this approach suffers from the fact that the distribution over states observed at execution time can differ from the distribution observed during training. Minor errors which initially produce small deviations become magnified as the policy encounters states further and further from its training distribution. This phenomenon, initially noted in the early work of (Pomerleau, 1989), was formalized in the work of (Ross & Bagnell, 2010) who proved a quadratic $\mathcal { O } ( \epsilon T ^ { 2 } )$ bound on the regret and showed that this bound is tight. The subsequent work of (Ross et al., 2011) showed that if the policy is allowed to further interact with the environment and make queries to the expert policy, it is possible to obtain a linear bound on the regret. However, the ability to query an expert can often be a strong assumption.
18
+
19
+ In this work, we propose a new and simple algorithm called DRIL (Disagreement-Regularized Imitation Learning) to address the covariate shift problem in imitation learning, in the setting where the agent is allowed to interact with its environment. Importantly, the algorithm does not require any additional interaction with the expert. It operates by training an ensemble of policies on the demonstration data, and using the disagreement in their predictions as a cost which is optimized through RL together with a supervised behavioral cloning cost. The motivation is that the policies in the ensemble will tend to agree on the set of states covered by the expert, leading to low cost, but are more likely to disagree on states not covered by the expert, leading to high cost. The RL cost thus guides the agent back towards the distribution of the expert, while the supervised cost ensures that it mimics the expert within the expert’s distribution.
20
+
21
+ Our theoretical results show that, subject to realizability and optimization oracle assumptions1, our algorithm obtains a $\mathcal { O } ( \epsilon \kappa T )$ regret bound, where $\kappa$ is a measure which quantifies a tradeoff between the concentration of the demonstration data and the diversity of the ensemble outside the demonstration data. We evaluate DRIL empirically across multiple pixel-based Atari environments and continuous control tasks, and show that it matches or significantly outperforms behavioral cloning and generative adversarial imitation learning, often recovering expert performance with only a few trajectories.
22
+
23
+ # 2 PRELIMINARIES
24
+
25
+ We consider episodic finite horizon MDP in this work. Denote by $s$ the state space, $\mathcal { A }$ the action space, and $\Pi$ the class of policies the learner is considering. Let $T$ denote the task horizon and $\pi ^ { \star }$ the expert policy whose behavior the learner is trying to mimic. For any policy $\pi$ , let $d _ { \pi }$ denote the distribution over states induced by following $\pi$ . Denote $C ( s , a )$ the expected immediate cost of performing action $a$ in state $s$ , which we assume is bounded in [0, 1]. In the imitation learning setting, we do not necessarily know the true costs $C ( s , a )$ , and instead we observe expert demonstrations. Our goal is to find a policy $\pi$ which minimizes an observed surrogate loss $\ell$ between its actions and the actions of the expert under its induced distribution of states, i.e.
26
+
27
+ $$
28
+ \hat { \pi } = \arg \operatorname* { m i n } \mathbb { E } _ { s \sim d _ { \pi } } [ \ell ( \pi ( s ) , \pi ^ { \star } ( s ) ) ]
29
+ $$
30
+
31
+ For the following, we will assume $\ell$ is the total variation distance (denoted by $\| \cdot \| )$ , which is an upper bound on the $0 - 1$ loss. Our goal is thus to minimize the following quantity, which represents the distance between the actions taken by our policy $\pi$ and the expert policy $\pi ^ { \star }$ :
32
+
33
+ $$
34
+ J _ { \exp } ( \pi ) = \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \| \pi ( \cdot | s ) - \pi ^ { \star } ( \cdot | s ) \| \Big ]
35
+ $$
36
+
37
+ Denote $\begin{array} { r } { \mathbb { E } \left[ \sum _ { \tau = t } ^ { T } C ( s _ { \tau } , a _ { \tau } ) | ( s _ { t } , a _ { t } ) = ( s , a ) , a _ { \tau } \sim \pi \right] } \end{array}$ $Q _ { t } ^ { \pi } ( s , a )$ as the standard Q-function of the policy . The following result shows that if $\pi$ , which is defined as $\ell$ $Q _ { t } ^ { \pi } ( s , a ) \ =$ is an upper bound on the $0 - 1$ loss and $C$ satisfies certain smoothness conditions, then minimizing this loss within $\epsilon$ translates into an $\mathcal { O } ( \epsilon T )$ regret bound on the true task cost $J _ { \mathrm { C } } ( \pi ) = \mathbb { E } _ { s , a \sim d _ { \pi } } [ C ( \bar { s } , a ) ]$ :
38
+
39
+ Theorem 1. (Ross et al., 2011) If $\pi$ satisfies $J _ { \mathrm { e x p } } ( \pi ) = \epsilon _ { \mathrm { : } }$ , and $Q _ { T - t + 1 } ^ { \pi ^ { \star } } ( s , a ) - Q _ { T - t + 1 } ^ { \pi ^ { \star } } ( s , \pi ^ { \star } ) \leq u$ for all time steps $t$ , actions a and states s reachable by $\pi$ , then $J _ { \mathrm { C } } ( \pi ) \le J _ { \mathrm { C } } ( \pi ^ { \star } ) + u T \epsilon$ .
40
+
41
+ Unfortunately, it is often not possible to optimize $J _ { \exp }$ directly, since it requires evaluating the expert policy on the states induced by following the current policy. The supervised behavioral cloning cost $J _ { \mathrm { B C } }$ , which is computed on states induced by the expert, is often used instead:
42
+
43
+ $$
44
+ J _ { \mathrm { B C } } ( \pi ) = \mathbb { E } _ { s \sim d _ { \pi ^ { \star } } } [ \| \pi ^ { \star } ( \cdot | s ) - \pi ( \cdot | s ) \| ]
45
+ $$
46
+
47
+ Minimizing this loss within $\epsilon$ yields a quadratic regret bound on regret:
48
+
49
+ Theorem 2. (Ross & Bagnell, 2010) Let $J _ { \mathrm { B C } } ( \pi ) = \epsilon ,$ then $J _ { \mathrm { C } } ( \pi ) \leq J _ { \mathrm { C } } ( \pi ^ { \star } ) + T ^ { 2 } \epsilon .$
50
+
51
+ Furthermore, this bound is tight: as we will discuss later, there exist simple problems which match the worst-case lower bound.
52
+
53
+ # 3 ALGORITHM
54
+
55
+ Our algorithm is motivated by two criteria: i) the policy should act similarly to the expert within the expert’s data distribution, and ii) the policy should move towards the expert’s data distribution
56
+
57
+ 1: Input: Expert demonstration data $\mathcal { D } = \{ ( s _ { i } , a _ { i } ) \} _ { i = 1 } ^ { N }$
58
+ 2: Initialize policy $\pi$ and policy ensemble $\Pi _ { \mathrm { E } } = \{ \pi _ { 1 } , . . . , \pi _ { E } \}$
59
+ 3: for $e = 1 , E$ do
60
+ 4: Sample $\mathcal { D } _ { e } \sim \mathcal { D }$ with replacement, with $| \mathcal { D } _ { e } | = | \mathcal { D } |$ .
61
+ 5: Train $\pi _ { e }$ to minimize $J _ { \mathrm { B C } } ( \pi _ { e } )$ on $\mathcal { D } _ { e }$ to convergence.
62
+ 6: end for
63
+ 7: for $i = 1 , \dots$ do
64
+ 8: Perform one gradient update to minimize $J _ { \mathrm { B C } } ( \pi )$ using a minibatch from $\mathcal { D }$ .
65
+ 9: Perform one step of policy gradient to minimize $\mathbb { E } _ { s \sim d _ { \pi } , a \sim \pi ( \cdot | s ) } [ C _ { \mathrm { U } } ^ { \mathrm { c l i p } } ( s , a ) ]$ .
66
+ 10: end for
67
+
68
+ if it is outside of it. These two criteria are addressed by combining two losses: a standard behavior cloning loss, and an additional loss which represents the variance over the outputs of an ensemble $\Pi _ { \mathrm { E } } = \mathbf { \bar { \Pi } } \{ \pi _ { 1 } , . . . , \pi _ { E } \}$ of policies trained on the demonstration data $\mathcal { D }$ . We call this the uncertainty cost, which is defined as:
69
+
70
+ $$
71
+ C _ { \mathrm { U } } ( s , a ) = \mathrm { V a r } _ { \pi \sim \Pi _ { \mathrm { E } } } ( \pi ( a | s ) ) = \frac { 1 } { E } \sum _ { i = 1 } ^ { E } \left( \pi _ { i } ( a | s ) - \frac { 1 } { E } \sum _ { i = 1 } ^ { E } \pi _ { i } ( a | s ) \right) ^ { 2 }
72
+ $$
73
+
74
+ The motivation is that the variance over plausible policies is high outside the expert’s distribution, since the data is sparse, but it is low inside the expert’s distribution, since the data there is dense. Minimizing this cost encourages the policy to return to regions of dense coverage by the expert. Intuitively, this is what we would expect the expert policy $\pi ^ { \star }$ to do as well. The total cost which the algorithm optimizes is given by:
75
+
76
+ $$
77
+ \begin{array} { r } { J _ { \mathrm { { a l g } } } ( \pi ) = \underbrace { { \mathbb { E } } _ { s \sim d _ { \pi ^ { \star } } } \left[ | | \pi ^ { \star } ( \cdot | s ) - \pi ( \cdot | s ) | | \right] } _ { J _ { \mathrm { { B C } } } ( \pi ) } + \underbrace { { \mathbb { E } } _ { s \sim d _ { \pi } , a \sim \pi ( \cdot | s ) } \left[ C _ { \mathrm { U } } ( s , a ) \right] } _ { J _ { \mathrm { { U } } } ( \pi ) } } \end{array}
78
+ $$
79
+
80
+ The first term is a behavior cloning loss and is computed over states generated by the expert policy, of which the demonstration data $\mathcal { D }$ is a representative sample. The second term is computed over the distribution of states generated by the current policy and can be optimized using policy gradient.
81
+
82
+ Note that the demonstration data is fixed, and this ensemble can be trained once offline. We then interleave the supervised behavioral cloning updates and the policy gradient updates which minimize the variance of the ensemble. The full algorithm is shown in Algorithm 1. We also found that dropout (Srivastava et al., 2014), which has been proposed as an approximate form of ensembling, worked well (see Appendix D).
83
+
84
+ In practice, for the supervised loss we optimize the KL divergence between the actions predicted by the policy and the expert actions, which is an upper bound on the total variation distance due to Pinsker’s inequality. We also found it helpful to use a clipped uncertainty cost:
85
+
86
+ $$
87
+ C _ { \mathrm { U } } ^ { \mathrm { c l i p } } ( s , a ) = { \left\{ \begin{array} { l l } { - 1 } & { { \mathrm { i f } } \ C _ { \mathrm { U } } ( s , a ) \leq q } \\ { + 1 } & { { \mathrm { e l s e } } } \end{array} \right. }
88
+ $$
89
+
90
+ where the threshold $q$ is a top quantile of the raw uncertainty costs computed over the demonstration data. The threshold $q$ defines a normal range of uncertainty based on the demonstration data, and values above this range incur a positive cost (or negative reward).
91
+
92
+ The RL cost can be optimized using any policy gradient method. In our experiments we used advantage actor-critic (A2C) (Mnih et al., 2016) or PPO (Schulman et al., 2017), which estimate the expected cost using rollouts from multiple parallel actors all sharing the same policy (see Appendix C for details). We note that model-based RL methods could in principle be used as well if sample efficiency is a constraint.
93
+
94
+ # 4 ANALYSIS
95
+
96
+ # 4.1 COVERAGE COEFFICIENT
97
+
98
+ We now analyze DRIL for MDPs with discrete action spaces and potentially large or infinite state spaces. We will show that, subject to assumptions that the policy class contains an optimal policy and that we are able to optimize costs within $\epsilon$ of their global minimum, our algorithm obtains a regret bound which is linear in $\kappa T$ , where $\kappa$ is a quantity which depends on the environment dynamics, the expert distribution $d _ { \pi } ^ { \star }$ , and our learned ensemble. Intuitively, $\kappa$ represents a tradeoff between how concentrated the demonstration data is and how high the variance of the ensemble is outside the expert distribution.
99
+
100
+ Assumption 1. (Realizability) $\pi ^ { \star } \in \Pi$
101
+
102
+ Assumption 2. (Optimization Oracle) For any given cost function $J$ , our minimization procedure returns a policy ${ \hat { \pi } } \in \Pi$ such that $J ( \widehat { \pi } ) \leq \arg \operatorname* { m i n } _ { \pi \in \Pi } J ( \pi ) + \epsilon .$ .
103
+
104
+ The motivation behind our algorithm is that the policies in the ensemble agree inside the expert’s distribution and disagree outside of it. This defines a reward function which pushes the learner back towards the expert’s distribution if it strays away. However, what constitutes inside and outside the distribution, or sufficient agreement or disagreement, is ambiguous. Below we introduce quantities which makes these ideas precise.
105
+
106
+ Definition 1. For any set $\begin{array} { r l r } { \mathcal { U } } & { { } \subseteq } & { S } \end{array}$ , define the concentrability inside of $\mathcal { U }$ as $\begin{array} { r l } { \alpha ( \mathcal { U } ) } & { { } = } \end{array}$ $\begin{array} { r } { \operatorname* { m a x } _ { \pi \in \Pi } \operatorname* { s u p } _ { s \in \mathcal { U } } \frac { d _ { \pi } ( s ) } { d _ { \pi ^ { \star } ( s ) } } } \end{array}$
107
+
108
+ The notion of concentrability has been previously used to give bounds on the performance of value iteration (Munos & Szepesvari, 2008). For a set ´ $\mathcal { U }$ , $\alpha ( \mathcal { U } )$ will be low if the expert distribution has high mass at the states in $\mathcal { U }$ that are reachable by policies in the policy class.
109
+
110
+ Definition 2. Define the minimum variance of the ensemble outside of $\mathcal { U }$ as $\begin{array} { r l } { \beta ( \mathcal { U } ) } & { { } = } \end{array}$ $\begin{array} { r } { \operatorname* { m i n } _ { s \not \in \mathcal { U } , a \in \mathcal { A } } \operatorname { V a r } _ { \pi \sim \Pi _ { \mathrm { E } } } [ \pi ( a | s ) ] } \end{array}$ .
111
+
112
+ We now define the $\kappa$ coefficient as the minimum ratio of these two quantities over all possible subsets of $s$ .
113
+
114
+ Definition 3. We define κ = minU⊆S α(U)β(U) .
115
+
116
+ We can view $\kappa$ as the quantity which minimizes the tradeoff over different subsets $\mathcal { U }$ between coverage by the expert policy inside of $\mathcal { U }$ , and variance of the ensemble outside of $\mathcal { U }$ .
117
+
118
+ # 4.2 REGRET BOUND
119
+
120
+ We now establish a relationship between the $\kappa$ coefficient just defined, the cost our algorithm optimizes, and $J _ { \mathrm { e x p } }$ defined in Equation (2) which we would ideally like to minimize and which translates into a regret bound. All proofs can be found in Appendix A.
121
+
122
+ Lemma 1. For any $\pi \in \Pi$ , we have $J _ { \mathrm { e x p } } ( \pi ) \le \kappa J _ { \mathrm { a l g } } ( \pi )$ .
123
+
124
+ This result shows that if $\kappa$ is not too large, and we are able to make our cost function $J _ { \mathrm { a l g } } ( \pi )$ small, then we can ensure $J _ { \exp } ( \pi )$ is also small. This result is only useful if our cost function can indeed achieve a small minimum. The next lemma shows that this is the case.
125
+
126
+ Lemma 2. $\begin{array} { r } { \operatorname* { m i n } _ { \pi \in \Pi } J _ { \mathrm { a l g } } ( \pi ) \le 2 \epsilon } \end{array}$ .
127
+
128
+ Here $\epsilon$ is the threshold specified in Assumption 2. Combining these two lemmas with the previous result of Ross et al. (2011), we get a regret bound which is linear in $\kappa T$ .
129
+
130
+ Theorem 3. Let πˆ be the result of minimizing $J _ { \mathrm { a l g } }$ using our optimization oracle, and assume that $Q _ { T - t + 1 } ^ { \pi ^ { \star } } ( s , a ) - Q _ { T - t + 1 } ^ { \pi ^ { \star } } ( s , \pi ^ { \star } ) \leq u$ for all actions $a$ , time steps $t$ and states s reachable by $\pi$ . Then $\hat { \pi }$ satisfies $J _ { \scriptscriptstyle \mathrm { C } } ( \hat { \pi } ) \leq J _ { \scriptscriptstyle \mathrm { C } } ( \pi ^ { \star } ) + 3 u \kappa \epsilon T$ .
131
+
132
+ Our bound is an improvement over that of behavior cloning if $\kappa$ is less than $\mathcal { O } ( T )$ . Note that DRIL does not require knowledge of $\kappa$ . The quantity $\kappa$ is problem-dependent and depends on the environment dynamics, the expert policy and the policies in the learned ensemble. We next compute $\kappa$ exactly for a problem for which behavior cloning is known to perform poorly, and show that it is independent of $T$ .
133
+
134
+ ![](images/68e4a2dec40b01d14eecadff2090a4ffad0c8c08dd4e6d1606d486e68d71db80.jpg)
135
+ Figure 1: Example of a problem where behavioral cloning incurs quadratic regret.
136
+
137
+ Example 1. Consider the tabular MDP given in (Ross & Bagnell, 2010) as an example of a problem where behavioral cloning incurs quadratic regret, shown in Figure 1. There are $^ 3$ states $\boldsymbol { S } = \left( { { s _ { 0 } } , { s _ { 1 } } , { s _ { 2 } } } \right)$ and two actions $( a _ { 1 } , \underset { - } { a _ { 2 } } )$ . Each policy $\pi$ can be represented as a set of probabilities $\pi ( a _ { 1 } | s )$ for each state $s \in S ^ { \ 2 }$ . Assume the models in our ensemble are drawn from a posterior $p ( \pi ( a _ { 1 } | s ) | \mathcal { D } )$ given by a Beta distribution with parameters $B e t a ( n _ { 1 } + 1 , n _ { 2 } + 1 )$ where $n _ { 1 } , n _ { 2 }$ are the number of times the pairs $( s , a _ { 1 } )$ and $( s , a _ { 2 } )$ occur, respectively, in the demonstration data $\mathcal { D }$ . The agent always starts in $s _ { 0 }$ and the expert’s policy is given by $\pi ^ { \star } ( a _ { 1 } | s _ { 0 } ) =$ $1 , \pi ^ { \star } ( a _ { 1 } | s _ { 1 } ) = 0 , \pi ^ { \star } ( a _ { 1 } | s _ { 2 } ) = 1$ . For any $( s , a )$ pair, the task cost is $C ( s , a ) = 0$ if $a = \pi ^ { \star } ( s )$ and 1 otherwise. Here $\begin{array} { r } { d _ { \pi } ^ { \star } \ = \ ( \frac { 1 } { T } , \frac { T - 1 } { T } , 0 ) } \end{array}$ . For any $\pi$ , $\begin{array} { r } { d _ { \pi } ( s _ { 0 } ) \ = \ \frac { 1 } { T } } \end{array}$ and $\begin{array} { r } { d _ { \pi } ( s _ { 1 } ) \ \leq \ \frac { T - 1 } { T } } \end{array}$ due to the dynamics of the MDP, so $\begin{array} { r } { \frac { d _ { \pi } ( s ) } { d _ { \pi } ^ { \star } ( s ) } \le 1 } \end{array}$ for $s \in \{ s _ { 0 } , s _ { 1 } \}$ . Writing out $\alpha ( \{ s _ { 0 } , s _ { 1 } \} )$ , we get: $\begin{array} { r } { \alpha ( \{ s _ { 0 } , s _ { 1 } \} ) = \operatorname* { m a x } _ { \pi \in \Pi } \operatorname* { s u p } _ { s \in \{ s _ { 0 } , s _ { 1 } \} } \frac { d _ { \pi } ( s ) } { d _ { \pi } ^ { \star } ( s ) } \le 1 . } \end{array}$
138
+
139
+ Furthermore, since $s _ { 2 }$ is never visited in the demonstration data, for each policy $\pi _ { i }$ in the ensemble we have $\pi _ { i } ( a _ { 1 } | s _ { 2 } ) , \pi _ { i } ( a _ { 2 } | s _ { 2 } ) \sim B e t a ( 1 , 1 ) = U n i f o r m ( 0 , 1 )$ . It follows that $\mathrm { V a r } _ { \pi \sim \Pi _ { \mathrm { E } } } ( \pi ( a | s _ { 2 } ) )$ is approximately equal 3 to the variance of a uniform distribution over $[ 0 , 1 ]$ , i.e. $\textstyle { \frac { 1 } { 1 2 } }$ . Therefore:
140
+
141
+ $$
142
+ \kappa = \operatorname* { m i n } _ { \mathcal { U } \subseteq \mathcal { S } } \frac { \alpha ( \mathcal { U } ) } { \beta ( \mathcal { U } ) } \leq \frac { \alpha ( \{ s _ { 0 } , s _ { 1 } \} ) } { \beta ( \{ s _ { 0 } , s _ { 1 } \} ) } \lesssim \frac { 1 } { \frac { 1 } { 1 2 } } = 1 2
143
+ $$
144
+
145
+ Applying our result from Theorem 3, we see that our algorithm obtains an $\mathcal { O } ( \epsilon T )$ regret bound on this problem, in contrast to the $\mathcal { O } ( \epsilon T ^ { 2 } )$ regret of behavioral cloning4.
146
+
147
+ # 5 RELATED WORK
148
+
149
+ The idea of learning through imitation dates back at least to the work of (Pomerleau, 1989), who trained a neural network to imitate the steering actions of a human driver using images as input. The problem of covariate shift was already observed, as the author notes: “the network must not solely be shown examples of accurate driving, but also how to recover once a mistake has been made”.
150
+
151
+ This issue was formalized in the work of (Ross & Bagnell, 2010), who on one hand proved an $\mathcal { O } ( \epsilon T ^ { 2 } )$ regret bound, and on the other hand provided an example showing this bound is tight. The subsequent work (Ross et al., 2011) proposed the DAGGER algorithm which obtains linear regret, provided the agent can both interact with the environment, and query the expert policy. Our approach also requires environment interaction, but importantly does not need to query the expert. Also of note is the work of (Venkatraman et al., 2015), which extended DAGGER to time series prediction problems by using the true targets as expert corrections.
152
+
153
+ Imitation learning has been used within the context of modern RL to help improve sample efficiency (Chang et al., 2015; Ross & Bagnell, 2014; Sun et al., 2017; Hester et al., 2018; Le et al., 2018; Cheng & Boots, 2018) or overcome exploration (Nair et al., 2017). These settings assume the reward is known and that the policies can then be fine-tuned with reinforcement learning. In this case, covariate shift is less of an issue since it can be corrected using the reinforcement signal.
154
+
155
+ The work of (Luo et al., 2019) also proposed a method to address the covariate shift problem when learning from demonstrations when the reward is known, by conservatively extrapolating the value function outside the training distribution using negative sampling. This addresses a different setting from ours, and requires generating plausible states which are off the manifold of training data, which may be challenging when the states are high dimensional such as images. The work of (Reddy et al., 2019) proposed to treat imitation learning within the Q-learning framework, setting a positive reward for all transitions inside the demonstration data and zero reward for all other transitions in the replay buffer. This rewards the agent for repeating (or returning to) the expert’s transitions. The work of (Sasaki et al., 2019) also incorporates a mechanism for reducing covariate shift by fitting a Q-function that classifies whether the demonstration states are reachable from the current state. Random Expert Distillation (Wang et al., 2019) uses Random Network Distillation (RND) (Burda et al., 2019) to estimate the support of the expert’s distribution in state-action space, and minimizes an RL cost designed to guide the agent towards the expert’s support. This is related to our method, but differs in that it minimizes the RND prediction error rather than the ensemble variance and does not include a behavior cloning cost. The behavior cloning cost is essential to our theoretical results and avoids certain failure modes, see Appendix B for more discusion.
156
+
157
+ Generative Adversarial Imitation Learning (GAIL) (Ho & Ermon, 2016) is a state-of-the-art algorithm which addresses the same setting as ours. It operates by training a discriminator network to distinguish expert states from states generated by the current policy, and the negative output of the discriminator is used as a reward signal to train the policy. The motivation is that states which are outside the training distribution will be assigned a low reward while states which are close to it will be assigned a high reward. This encourages the policy to return to the expert distribution if it strays away from it. However, the adversarial training procedure means that the reward function is changing over time, which can make the algorithm unstable or difficult to tune. In contrast, our approach uses a simple fixed reward function. We include comparisons to GAIL in our experiments.
158
+
159
+ Using disagreement between models in an ensemble to represent uncertainty has recently been explored in several contexts. The works of (Shyam et al., 2018; Pathak et al., 2019; Henaff, 2019) used disagreement between different dynamics models to drive exploration in the context of modelbased RL. Conversely, (Henaff et al., 2019) used variance across different dropout masks to prevent policies from exploiting error in dynamics models. Ensembles have also been used to represent uncertainty over Q-values in model-free RL in order to encourage exploration (Osband et al., 2016). Within the context of imitation learning, the work of (Menda et al., 2018) used the variance of the ensemble together with the DAGGER algorithm to decide when to query the expert demonstrator to minimize unsafe situations. Here, we use disagreement between different policies trained on demonstration data to address covariate shift in the context of imitation learning.
160
+
161
+ # 6 EXPERIMENTS
162
+
163
+ # 6.1 TABULAR MDPS
164
+
165
+ As a first experiment, we applied DRIL to the tabular MDP of (Ross & Bagnell, 2010) shown in Figure 1. We computed the posterior over the policy parameters given the demonstration data using a separate Beta distribution for each state $s$ with parameters determined by the number of times each action was performed in s. For behavior cloning, we sampled a single policy from this posterior. For DRIL, we sampled an ensemble of 5 policies and used their negative variance to define an additional reward function. We combined this with a reward which was the probability density function of a given state-action pair under the posterior distribution, which corresponds to the supervised learning loss, and used tabular Q-learning to optimize the sum of these two reward functions. This experiment was repeated 500 times for time horizon lengths up to 500 and $N = 1 , 5 , 1 0$ expert demonstration trajectories.
166
+
167
+ ![](images/2493ce67dfd3a36789481b8ea016ce3a998184660878b9d06f5905f8bf05413a.jpg)
168
+ Figure 2: Results on tabular MDP from (Ross & Bagnell, 2010). Shaded region represents range between $5 ^ { \mathrm { t h } }$ and $9 5 ^ { \mathrm { t h } }$ quantiles, computed across 500 trials. Behavior cloning exhibits poor worstcase regret, whereas DRIL has low regret across all trials.
169
+
170
+ Figure 2 shows plots of the regret over the 500 different trials across different time horizons. Although BC achieves good average performance, it exhibits poor worst-case performance with some trials incurring very high regret, especially when using fewer demonstrations. Our method has low regret across all trials, which stays close to constant independantly of the time horizon, even with a single demonstration. This performance is better than that suggested by our analysis, which showed a worst-case linear bound with respect to time horizon.
171
+
172
+ # 6.2 ATARI ENVIRONMENTS
173
+
174
+ We next evaluated our approach on six different Atari environments. We used pretrained PPO (Schulman et al., 2017) agents from the stable baselines repository (Hill et al., 2018) to generate $N = \{ 1 , 3 , 5 , 1 0 , 1 5 , 2 0 \}$ expert trajectories. We compared against two other methods: standard behavioral cloning (BC) and Generative Adversarial Imitation Learning (GAIL). Results are shown in Figure 3a. DRIL outperforms behavioral cloning across most environments and numbers of demonstrations, often by a substantial margin. In many cases, our method is able to match the expert’s performance using a small number of trajectories. Figure 3b shows the evolution of the uncertainty cost and the policy reward throughout training. In all cases, the reward improves while the uncertainty cost decreases.
175
+
176
+ We were not able to obtain meaningful performance for GAIL on these domains, despite performing a hyperparameter search across learning rates for the policy and discriminator, and across different numbers of discriminator updates. We additionally experimented with clipping rewards in an effort to stabilize performance. These results are consistent with those of (Reddy et al., 2019), who also reported negative results when running GAIL on images. While improved performance might be possible with more sophisticated adversarial training techniques, we note that this contrasts with our method which uses a fixed reward function obtained through simple supervised learning.
177
+
178
+ In Appendix D we provide ablation experiments examining the effects of the cost function clipping and the role of the BC loss. We also compare the ensemble approach to a dropout-based approximation and show that DRIL works well in both cases.
179
+
180
+ # 6.3 CONTINUOUS CONTROL
181
+
182
+ We next report results of running our method on 6 different continuous control tasks from the PyBullet5 and OpenAI Gym (Brockman et al., 2016) environments. We again used pretrained agents to generate expert demonstrations, and compared to Behavior Cloning and GAIL.
183
+
184
+ Results for all methods are shown in Figure 4. In these environments we found Behavior Cloning to be a much stronger baseline than for the Atari environments: in several tasks it was able to match expert performance using as little as 3 trajectories, suggesting that covariate shift may be less of an issue. Our method performs similarly to Behavior Cloning on most tasks, except on Walker2D, where it yields improved performance for $N = 1 , 3 , 5$ trajectories. GAIL performs somewhat better than DRIL on HalfCheetah and Walker2D, but performs worse than both DRIL and BC on LunarLander and BipedalWalkerHardcore. The fact that DRIL is competitive across all tasks provides evidence of its robustness.
185
+
186
+ ![](images/b0edd841d3208a643e7aedc62d719e9e8c99705771d310ccf6e981b64bc6aa90.jpg)
187
+ Figure 3: Results on Atari environments. a) Median final policy performance for different numbers of expert trajectories, taken over 4 seeds (shaded regions are min/max performance) b) Evolution of policy reward and uncertainty cost during training with $N = 3$ trajectories.
188
+
189
+ # 7 CONCLUSION
190
+
191
+ Addressing covariate shift has been a long-standing challenge in imitation learning. In this work, we have proposed a new method to address this problem by penalizing the disagreement between an ensemble of different policies trained on the demonstration data. Importantly, our method requires no additional labeling by an expert. Our experimental results demonstrate that DRIL can often match expert performance while using only a small number of trajectories across a wide array of tasks, ranging from tabular MDPs to pixel-based Atari games and continuous control tasks. On the theoretical side, we have shown that our algorithm can provably obtain a low regret bound for problems in which the $\kappa$ parameter is low.
192
+
193
+ ![](images/fc439a33e8fbac82cfd89450bec241d73107c1c8a1ca073b97a8ff5756290cd0.jpg)
194
+ Figure 4: Results on continuous control tasks.
195
+
196
+ There are multiple directions for future work. On the theoretical side, characterizing the $\kappa$ parameter on a larger array of problems would help to better understand the settings where our method can expect to do well. Empirically, there are many other settings in structured prediction (Daume´ et al., 2009) where covariate shift is an issue and where our method could be applied. For example, in dialogue and language modeling it is common for generated text to become progressively less coherent as errors push the model off the manifold it was trained on. Our method could potentially be used to fine-tune language or translation models (Cho et al., 2014; Welleck et al., 2019) after training by applying our uncertainty-based cost function to the generated text.
197
+
198
+ # REFERENCES
199
+
200
+ Greg Brockman, Vicki Cheung, Ludwig Pettersson, Jonas Schneider, John Schulman, Jie Tang, and Wojciech Zaremba. Openai gym, 2016.
201
+
202
+ Yuri Burda, Harrison Edwards, Amos Storkey, and Oleg Klimov. Exploration by random network distillation. In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id ${ . } = { }$ H1lJJnR5Ym.
203
+
204
+ Kai-Wei Chang, Akshay Krishnamurthy, Alekh Agarwal, John Langford, and Hal Daume III. Learn- ´ ing to search better than your teacher. 2015.
205
+
206
+ Ching-An Cheng and Byron Boots. Convergence of value aggregation for imitation learning. arXiv preprint arXiv:1801.07292, 2018.
207
+
208
+ Kyunghyun Cho, Bart van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, ¨ Holger Schwenk, and Yoshua Bengio. Learning phrase representations using RNN encoder– decoder for statistical machine translation. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 1724–1734, Doha, Qatar, October 2014. Association for Computational Linguistics. doi: 10.3115/v1/D14-1179. URL https://www.aclweb.org/anthology/D14-1179.
209
+
210
+ Hal Daume, John Langford, and Daniel Marcu. Search-based structured prediction. ´ CoRR, abs/0907.0786, 2009. URL http://arxiv.org/abs/0907.0786.
211
+
212
+ Mikael Henaff. Explicit explore-exploit algorithms in continuous state spaces. In H. Wallach, H. Larochelle, A. Beygelzimer, F. Alche-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 9377– 9387. Curran Associates, Inc., 2019. URL http://papers.nips.cc/paper/ 9135-explicit-explore-exploit-algorithms-in-continuous-state-spaces. pdf.
213
+
214
+ Mikael Henaff, Alfredo Canziani, and Yann LeCun. Model-predictive policy learning with uncertainty regularization for driving in dense traffic. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HygQBn0cYm.
215
+
216
+ Matteo Hessel, Joseph Modayil, Hado P. van Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, Mohammad Gheshlaghi Azar, and David Silver. Rainbow: Combining improvements in deep reinforcement learning. In AAAI, 2018.
217
+
218
+ Todd Hester, Matej Vecer´ık, Olivier Pietquin, Marc Lanctot, Tom Schaul, Bilal Piot, Dan Horgan, John Quan, Andrew Sendonaris, Ian Osband, Gabriel Dulac-Arnold, John Agapiou, Joel Z. Leibo, and Audrunas Gruslys. Deep q-learning from demonstrations. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI-18), the 30th innovative Applications of Artificial Intelligence (IAAI-18), and the 8th AAAI Symposium on Educational Advances in Artificial Intelligence (EAAI-18), New Orleans, Louisiana, USA, February 2-7, 2018, pp. 3223–3230, 2018. URL https://www.aaai.org/ocs/index.php/AAAI/ AAAI18/paper/view/16976.
219
+
220
+ Ashley Hill, Antonin Raffin, Maximilian Ernestus, Adam Gleave, Rene Traore, Prafulla Dhariwal, Christopher Hesse, Oleg Klimov, Alex Nichol, Matthias Plappert, Alec Radford, John Schulman, Szymon Sidor, and Yuhuai Wu. Stable baselines. https://github.com/hill-a/ stable-baselines, 2018.
221
+
222
+ Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. In D. D. Lee, M. Sugiyama, U. V. Luxburg, I. Guyon, and R. Garnett (eds.), Advances in Neural Information Processing Systems 29, pp. 4565–4573. Curran Associates, Inc., 2016.
223
+
224
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization, 2014. URL http://arxiv.org/abs/1412.6980. cite arxiv:1412.6980Comment: Published as a conference paper at the 3rd International Conference for Learning Representations, San Diego, 2015.
225
+
226
+ Ilya Kostrikov. Pytorch implementations of reinforcement learning algorithms. https:// github.com/ikostrikov/pytorch-a2c-ppo-acktr-gail, 2018.
227
+
228
+ Hoang M Le, Nan Jiang, Alekh Agarwal, Miroslav Dud´ık, Yisong Yue, and Hal Daume III. Hierar-´ chical imitation and reinforcement learning. arXiv preprint arXiv:1803.00590, 2018.
229
+
230
+ Timothy P. Lillicrap, Jonathan J. Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. CoRR, abs/1509.02971, 2016.
231
+
232
+ Yuping Luo, Huazhe Xu, and Tengyu Ma. Learning self-correctable policies and value functions from demonstrations with negative sampling. CoRR, abs/1907.05634, 2019. URL http:// arxiv.org/abs/1907.05634.
233
+
234
+ Kunal Menda, Katherine Rose Driggs-Campbell, and Mykel J. Kochenderfer. Ensembledagger: A bayesian approach to safe imitation learning. ArXiv, abs/1807.08364, 2018.
235
+
236
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A. Rusu, Joel Veness, Marc G. Bellemare, Alex Graves, Martin Riedmiller, Andreas K. Fidjeland, Georg Ostrovski, Stig Petersen, Charles Beattie, Amir Sadik, Ioannis Antonoglou, Helen King, Dharshan Kumaran, Daan Wierstra, Shane Legg, and Demis Hassabis. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, February 2015. ISSN 00280836. URL http://dx.doi.org/10.1038/nature14236.
237
+
238
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In Maria Florina Balcan and Kilian Q. Weinberger (eds.), Proceedings of The 33rd International Conference on Machine Learning, volume 48 of Proceedings of Machine Learning Research, pp. 1928–1937, New York, New York, USA, 20–22 Jun 2016. PMLR. URL http: //proceedings.mlr.press/v48/mniha16.html.
239
+
240
+ Remi Munos and Csaba Szepesv ´ ari. Finite-time bounds for fitted value iteration. ´ J. Mach. Learn. Res., 9:815857, June 2008. ISSN 1532-4435.
241
+
242
+ Ashvin Nair, Bob McGrew, Marcin Andrychowicz, Wojciech Zaremba, and Pieter Abbeel. Overcoming exploration in reinforcement learning with demonstrations. 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 6292–6299, 2017.
243
+
244
+ Ian Osband, Charles Blundell, Alexander Pritzel, and Benjamin Van Roy. Deep exploration via bootstrapped DQN. CoRR, abs/1602.04621, 2016. URL http://arxiv.org/abs/1602. 04621.
245
+
246
+ Deepak Pathak, Dhiraj Gandhi, and Abhinav Gupta. Self-supervised exploration via disagreement. In ICML, 2019.
247
+
248
+ Dean A. Pomerleau. Alvinn: An autonomous land vehicle in a neural network. In D. S. Touretzky (ed.), Advances in Neural Information Processing Systems 1, pp. 305–313. Morgan-Kaufmann, 1989. URL http://papers.nips.cc/paper/ 95-alvinn-an-autonomous-land-vehicle-in-a-neural-network.pdf.
249
+
250
+ Siddharth Reddy, Anca D. Dragan, and Sergey Levine. SQIL: imitation learning via regularized behavioral cloning. CoRR, abs/1905.11108, 2019. URL http://arxiv.org/abs/1905. 11108.
251
+
252
+ Stephane Ross and Drew Bagnell. Efficient reductions for imitation learning. In Yee Whye Teh and Mike Titterington (eds.), Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, volume 9 of Proceedings of Machine Learning Research, pp. 661–668, Chia Laguna Resort, Sardinia, Italy, 13–15 May 2010. PMLR. URL http://proceedings. mlr.press/v9/ross10a.html.
253
+
254
+ Stephane Ross and J Andrew Bagnell. Reinforcement and imitation learning via interactive no-regret learning. arXiv preprint arXiv:1406.5979, 2014.
255
+
256
+ Stephane Ross, Geoffrey Gordon, and Drew Bagnell. A reduction of imitation learning and structured prediction to no-regret online learning. In Geoffrey Gordon, David Dunson, and Miroslav Dudk (eds.), Proceedings of the Fourteenth International Conference on Artificial Intelligence and Statistics, volume 15 of Proceedings of Machine Learning Research, pp. 627–635, Fort Lauderdale, FL, USA, 11–13 Apr 2011. PMLR. URL http://proceedings.mlr.press/ v15/ross11a.html.
257
+
258
+ Fumihiro Sasaki, Tetsuya Yohira, and Atsuo Kawaguchi. Sample efficient imitation learning for continuous control. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ BkN5UoAqF7.
259
+
260
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. CoRR, abs/1707.06347, 2017. URL http://arxiv.org/abs/ 1707.06347.
261
+
262
+ Pranav Shyam, Wojciech Jaskowski, and Faustino Gomez. Model-based active exploration. CoRR, abs/1810.12162, 2018.
263
+
264
+ Nitish Srivastava, Geoffrey E. Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(1):1929–1958, 2014. URL http://www.cs.toronto.edu/˜rsalakhu/ papers/srivastava14a.pdf.
265
+
266
+ Wen Sun, Arun Venkatraman, Geoffrey J Gordon, Byron Boots, and J Andrew Bagnell. Deeply aggrevated: Differentiable imitation learning for sequential prediction. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pp. 3309–3318. JMLR. org, 2017.
267
+
268
+ Arun Venkatraman, Martial Hebert, and J. Andrew Bagnell. Improving multi-step prediction of learned time series models. In Proceedings of the Twenty-Ninth AAAI Conference on Artificial Intelligence, AAAI’15, pp. 3024–3030. AAAI Press, 2015. ISBN 0-262-51129-0. URL http: //dl.acm.org/citation.cfm?id=2888116.2888137.
269
+
270
+ Ruohan Wang, Carlo Ciliberto, Pierlugi Amadori, and Yiannis Demiris. Random expert distillation: Imitation learning via expert policy support estimation. In Proceedings of International Conference on Machine Learning. ACM, 2019.
271
+
272
+ Sean Welleck, Kiante Brantley, Hal Daum ´ e III, and Kyunghyun Cho. Non-monotonic sequential text ´ generation. CoRR, abs/1902.02192, 2019. URL http://arxiv.org/abs/1902.02192.
273
+
274
+ # A PROOFS
275
+
276
+ Lemma 1. For any $\pi \in \Pi$ we have $J _ { \mathrm { e x p } } ( \pi ) \le \kappa J _ { \mathrm { a l g } } ( \pi )$
277
+
278
+ Proof. We will first show that for any $\pi \in \Pi$ and $\mathcal { U } \subseteq \mathcal { S }$ , we have $\begin{array} { r } { J _ { \mathrm { e x p } } ( \pi ) \le \frac { \alpha ( \mathcal { U } ) } { \beta ( \mathcal { U } ) } J _ { \mathrm { a l g } } ( \pi ) } \end{array}$ . We can rewrite this as:
279
+
280
+ $$
281
+ \begin{array} { r l } & { J _ { \mathrm { e x p } } ( \pi ) = \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \| \pi ( \cdot | s ) - \pi ^ { \star } ( \cdot | s ) \| \Big ] } \\ & { \qquad = \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \mathbb { I } ( s \in \mathcal { U } ) \| \pi ( \cdot | s ) - \pi ^ { \star } ( \cdot | s ) \| \Big ] + \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \mathbb { I } ( s \notin \mathcal { U } ) \| \pi ( \cdot | s ) - \pi ^ { \star } ( \cdot | s ) \| \Big ] } \end{array}
282
+ $$
283
+
284
+ We begin by bounding the first term:
285
+
286
+ $$
287
+ \begin{array} { r l } { \mathbb { E } _ { s \sim \theta _ { 0 } } \bigg [ \big ( | s - z | \big ) \| \pi \langle | s \rangle - \pi ^ { * } ( | s ) \big \| \bigg ] = \displaystyle \sum _ { s \in \theta _ { 0 } } d _ { \pi } ( s ) \| \pi \langle | s \rangle - \pi ^ { * } ( | s ) \| } \\ & { \quad = \displaystyle \sum _ { s \in \theta _ { 0 } } \frac { \lambda _ { \pi } ( s ) } { d \pi ^ { s } ( s ) } d _ { \pi ^ { s } ( s ) } \| x ( s ) - \pi ^ { * } ( | s | ) \| } \\ & { \quad \le \displaystyle \sum _ { s \in \theta _ { 0 } } \bigg ( \frac { \eta _ { 0 } \kappa \kappa \kappa \| s \| } { \pi \langle s | \theta _ { 0 } \rangle ( \pi ^ { s } ( s ) \rangle } \bigg ) d _ { \pi ^ { s } ( s ) } \langle s | \pi | ( s ) \rangle - \pi ^ { * } ( | s | ) \bigg \| } \\ & { \quad \quad \sim \epsilon ( | L \eta \langle \frac { \eta _ { 0 } \kappa \kappa \| } { \pi \langle s | \theta _ { 0 } \rangle ( \pi ^ { s } ( s ) \rangle } \Big ) d _ { \pi ^ { s } ( s ) } \bigg \| \pi ( s | \delta ) \| \pi ( s ) - \pi ^ { * } ( | s | ) \| } \\ & { \quad \quad = \epsilon ( | L \eta \sum _ { s \in \theta _ { 0 } } d _ { \pi ^ { s } ( s ) } \langle \theta | \pi ( s ) \rangle - \pi ^ { * } ( | s | ) \| } \\ & { \quad \le \alpha ( | L \eta \langle \frac { \eta _ { 0 } \kappa \| } { \pi \langle s | \theta _ { 0 } \rangle ( \pi ^ { s } ( s ) \rangle } \| x ( s ) - x ^ { * } ( | s ) \| } \\ & { \quad \quad = \epsilon ( | L \eta \langle \frac { \eta _ { 0 } \kappa \kappa \| } { \pi \langle s | \theta _ { 0 } \rangle ( \pi ^ { s } ( s ) \rangle } \| x ( s ) - x ^ { * } ( | s ) \| } \\ & { \quad = \epsilon ( | L \eta \langle \frac { \eta _ { 0 } \kappa \| } { \pi \langle s | \theta _ { 0 } \rangle ( \pi ^ { s } ( s ) \rangle } \| x ( s ) - x ^ { * } ( | s ) \| } \\ & { \quad = \epsilon ( | L \eta \langle \frac { \eta _ { 0 } \kappa \| } { \pi \langle s | \theta _ { 0 } \rangle } \| x ( s ) - x ^ { * } ( | s ) \| } \\ & \end{array}
288
+ $$
289
+
290
+ We next bound the second term:
291
+
292
+ $$
293
+ \begin{array} { r l } { \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \mathbb { I } ( s \notin \mathcal { U } ) \| \pi ( \cdot | s ) - \pi ^ { \star } ( \cdot | s ) \| \Big ] \leq \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \mathbb { I } ( s \notin \mathcal { U } ) \Big ] } & { } \\ & { \leq \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \mathbb { I } ( s \notin \mathcal { U } ) \frac { \operatorname* { m i n } _ { a \in A } \operatorname { V a r } _ { \pi _ { i } \sim \Pi _ { \mathrm { E } } } \big [ \pi _ { i } ( a | s ) \big ] } { \beta ( \mathcal { U } ) } \Big ] } \\ & { = \displaystyle \frac { 1 } { \beta ( \mathcal { U } ) } \mathbb { E } _ { s \sim d _ { \pi } } \Big [ \mathbb { I } ( s \notin \mathcal { U } ) \sum _ { a \in A } \pi ( a | s ) \operatorname { V a r } _ { \pi _ { i } \sim \Pi _ { \mathrm { E } } } \big [ \pi _ { i } ( a | s ) \big ] \Big ] } \\ & { = \displaystyle \frac { 1 } { \beta ( \mathcal { U } ) } \sum _ { s \notin \mathcal { U } } d _ { \pi } ( s ) \sum _ { a \in \mathcal { A } } \pi ( a | s ) \operatorname { V a r } _ { \pi _ { i } \sim \Pi _ { \mathrm { E } } } \big [ \pi _ { i } ( a | s ) \big ] } \end{array}
294
+ $$
295
+
296
+ Now observe we can decompose the RL cost as follows:
297
+
298
+ $$
299
+ \begin{array} { r l } & { J _ { \mathrm { U } } ( \boldsymbol { \pi } ) = \mathbb { E } _ { s \sim d _ { \boldsymbol { \pi } } , a \sim \boldsymbol { \pi } ( \cdot \vert s ) } \left[ \mathrm { V a r } _ { \boldsymbol { \pi } _ { i } \sim \Pi _ { \mathrm { E } } } \pi _ { i } ( a \vert s ) \right] } \\ & { \qquad = \displaystyle \sum _ { s } d _ { \boldsymbol { \pi } } ( s ) \sum _ { a } \pi ( a \vert s ) \left[ \mathrm { V a r } _ { \boldsymbol { \pi } _ { i } \sim \Pi _ { \mathrm { E } } } \pi _ { i } ( a \vert s ) \right] } \\ & { \qquad = \displaystyle \sum _ { s \in U } d _ { \boldsymbol { \pi } } ( s ) \sum _ { a } \pi ( a \vert s ) \left[ \mathrm { V a r } _ { \boldsymbol { \pi } _ { i } \sim \Pi _ { \mathrm { E } } } \pi _ { i } ( a \vert s ) \right] } \\ & { \qquad = \underbrace { \sum _ { s \in U } d _ { \boldsymbol { \pi } } ( s ) \sum _ { a } \pi ( a \vert s \vert ) \left[ \mathrm { V a r } _ { \boldsymbol { \pi } _ { i } \sim \Pi _ { \mathrm { E } } } \pi _ { i } ( a \vert s ) \right] } _ { B ( \boldsymbol { \pi } ) } + \underbrace { \sum _ { s \neq l } d _ { \boldsymbol { \pi } } ( s ) \sum _ { a } \pi ( a \vert s ) \left[ \mathrm { V a r } _ { \boldsymbol { \pi } _ { i } \sim \Pi _ { \mathrm { E } } } \pi _ { i } ( a \vert s ) \right] } _ { A ( \boldsymbol { \pi } ) } } \end{array}
300
+ $$
301
+
302
+ Putting these together, we get the following:
303
+
304
+ $$
305
+ \begin{array} { r l } { J _ { \mathrm { c s p } } ( \pi ) \le \alpha ( \mathcal { U } ) J _ { \mathrm { R C } } ( \pi ) + \displaystyle \frac { 1 } { \beta ( \mathcal { U } ) } A ( \pi ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \alpha ( \mathcal { U } ) \beta ( \mathcal { U } ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \alpha ( \mathcal { U } ) } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ & \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \end{array}
306
+ $$
307
+
308
+ Here we have used the fact that β(U ) ≤ 1 since 0 ≤ π(a|s) ≤ 1 and α(U ) ≥ sups∈U d?π(s)d?π(s) hence $\begin{array} { r } { \frac { 1 } { \alpha ( \mathcal { U } ) } \le 1 } \end{array}$ . Taking the minimum over subsets $\mathcal { U } \subseteq \mathcal { S }$ , we get $J _ { \mathrm { e x p } } ( \pi ) \le \kappa J _ { \mathrm { a l g } } ( \pi )$ .
309
+
310
+ Lemma 2. $\begin{array} { r } { \operatorname* { m i n } _ { \pi \in \Pi } J _ { \mathrm { a l g } } ( \pi ) \le 2 \epsilon } \end{array}$
311
+
312
+ Proof. Plugging the optimal policy into $J _ { \mathrm { a l g } }$ , we get:
313
+
314
+ $$
315
+ \begin{array} { r l } { J _ { \mathrm { B E } } ( \pi ^ { * } ) = J _ { \mathrm { B C } } ( \pi ^ { * } ) + J _ { \mathrm { U } } ( \pi ^ { * } ) } \\ & { \qquad = 0 + \mathbb { E } _ { s \sim \mathcal { A } _ { s } , \pi \sim \pi ^ { * } ( \cdot ) s } \Big [ \mathrm { V a r } _ { \pi _ { s } \sim \Pi _ { \pi } } \big [ \pi _ { s } ( a | s ) \big ] \Big ] } \\ & { \qquad = \mathbb { E } _ { s \sim d _ { \pi ^ { * } } , a \sim \pi ^ { * } ( \cdot ) s } \Big [ \displaystyle \frac { 1 } { E } \sum _ { i = 1 } ^ { E } \Big ( \pi _ { s } ( a | s ) - \pi _ { i } ( a | s ) \Big ) ^ { 2 } \Big ] } \\ & { \qquad \le \mathbb { E } _ { s \sim d _ { \pi ^ { * } } , a \sim \pi ^ { * } ( \cdot ) s } \Big [ \displaystyle \frac { 1 } { E } \sum _ { i = 1 } ^ { E } \Big ( \pi _ { i } ( a | s ) - \pi ^ { * } ( a | s ) \Big ) ^ { 2 } + \Big ( \pi ( a | s ) - \pi ^ { * } ( a | s ) \Big ) ^ { 2 } \Big ] } \\ & { \qquad = \underbrace { \mathbb { E } _ { s \sim d _ { \pi ^ { * } } , a \sim \pi ^ { * } ( \cdot ) s } } _ { \texttt { D e r m i l } } \Big [ \displaystyle \frac { 1 } { E } \sum _ { i = 1 } ^ { E } \Big ( \pi _ { i } ( a | s ) - \pi ^ { * } ( a | s ) \Big ) ^ { 2 } \Big ] + \underbrace { \mathbb { E } _ { s \sim d _ { \pi ^ { * } } , a \sim \pi ^ { * } ( \cdot ) s } } _ { \texttt { T e m m 2 } } \Big ( \Big | \Big ( \pi ( a | s ) - \pi ^ { * } ( a | s ) \Big ) \Big ) } \end{array}
316
+ $$
317
+
318
+ We will first bound Term 1:
319
+
320
+ $$
321
+ \begin{array} { r l } { \displaystyle \sum _ { k \to \alpha < \alpha , \nu \to \nu + \nu + 1 ; \nu } [ \displaystyle \frac { 1 } { E } \sum _ { i = 1 } ^ { E } ( \pi _ { i } ( \alpha | \boldsymbol s ) - \pi ^ { * } ( \alpha | \boldsymbol s ) ) ^ { 2 } ] = \frac { 1 } { E } \mathbb { E } _ { \alpha \to \alpha , \nu } \Bigg [ \sum _ { \alpha \in A } \boldsymbol s ^ { \star } ( \alpha | \boldsymbol s ) \sum _ { \nu = 1 } ^ { E } \Bigg ( \alpha _ { 1 } ( \alpha | \boldsymbol s ) - \pi ^ { * } ( \alpha | \boldsymbol s ) \Bigg ) ^ { 2 } } & { } \\ & { \leq \frac { 1 } { E } \mathbb { E } _ { \alpha \to \alpha , \nu } \Bigg [ \sum _ { \alpha \in A } \boldsymbol s \Bigg ( \alpha | \boldsymbol s \rangle \sum _ { \nu = 1 } ^ { E } \Big | \alpha ( \boldsymbol s | \boldsymbol s ) - \pi ^ { * } ( \alpha | \boldsymbol s ) \Big | \Bigg ] } \\ & { \leq \frac { 1 } { E } \mathbb { E } _ { \alpha \to \alpha , \nu } \Bigg [ \displaystyle \sum _ { \alpha \in B \times \alpha } \Bigg [ \sum _ { \alpha \in A \times \alpha } \Bigg ] ^ { E } \pi _ { i } ( \alpha | \boldsymbol s ) - \pi ^ { * } ( \alpha | \boldsymbol s ) \Bigg ] \Bigg ] } \\ & { \leq \frac { 1 } { E } \frac { E } { E } \sum _ { \alpha \to \alpha , \nu \to \nu + 1 } \Bigg [ \displaystyle \frac { 1 } { E } \sum _ { \alpha \in B \times \alpha } \Bigg [ | \boldsymbol s | \boldsymbol s \rangle - \pi ^ { * } ( \alpha | \boldsymbol s ) \Big | \Bigg ] } \\ & { \leq \frac { 1 } { E } \displaystyle \sum _ { \alpha \to \alpha , \nu \to \nu + 1 } ^ { E } [ | \overline { { \alpha } } _ { 1 } ( \boldsymbol s | \boldsymbol s ) - \pi ^ { * } ( | \boldsymbol s | \boldsymbol s | ] ] } \\ & { \leq \frac { 1 } { E } \displaystyle \sum _ { \alpha \to \alpha } ^ { E } \exp ( \sum _ { \alpha \in B \times \alpha } \Bigg [ \exp ( \alpha | \boldsymbol s | \boldsymbol s | \boldsymbol s | \boldsymbol s | \boldsymbol s | \boldsymbol s | \boldsymbol s | \boldsymbol s ) - \pi ^ { * } ( | \boldsymbol s | \boldsymbol s | \boldsymbol s | \boldsymbol s | \boldsymbol s ) | \Bigg ] } \\ & { \leq \frac { 1 } { E } \displaystyle \sum _ { \alpha \to \infty } ^ { E } \mathrm { e } } \\ & { = \varepsilon } \end{array}
322
+ $$
323
+
324
+ We will next bound Term 2:
325
+
326
+ $$
327
+ \begin{array} { r l } { \exp _ { \tau } \left( \tau \mathrm { d } \boldsymbol { \theta } \right) } & \leq \exp _ { \tau } \left( \tau \mathrm { d } \boldsymbol { \theta } \right) , \quad \forall \mathrm { d } \boldsymbol { \theta } \right) \} \left\{ \sum _ { j = 1 , \ldots , N - 1 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , \quad \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) \right\} ^ { \frac { 1 } { N } } \\ & { = \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , \quad \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , \quad k = \frac { N } { N } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , } \\ & { = \sum _ { k = 0 } ^ { N } \exp _ { \tau } \exp _ { \tau } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , \quad k = \frac { N } { N } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , } \\ & { = \sum _ { k = 0 } ^ { N } \exp _ { \tau } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , } \\ & { \leq \sum _ { k = 0 } ^ { N } \exp _ { \tau } \exp _ { \tau } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , } \\ & { = \sum _ { k = 0 } ^ { N } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , \quad \mathrm { ~ a ~ n ~ d ~ } \mathrm { ~ N ~ o ~ s i g h ~ } \mathrm { ~ } } \\ & { = \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol { \theta } \right) , \quad \mathrm { ~ a ~ n ~ d ~ } \mathrm { ~ N ~ o ~ s i g h ~ } \mathrm { ~ H ~ } } \\ & \leq \frac { 1 } { N } \sum _ { k = 0 } ^ { N } \exp _ { \tau } \left( \mathrm { d } \boldsymbol \ \end{array}
328
+ $$
329
+
330
+ The last step follows from our optimization oracle assumption: $\begin{array} { r } { 0 \leq \operatorname* { m i n } _ { \pi \in \Pi } J _ { \mathrm { B C } } ( \pi ) \leq J _ { \mathrm { B C } } ( \pi ^ { \star } ) = } \end{array}$ 0, hence $J _ { \mathrm { B C } } ( \pi _ { i } ) \le 0 + \epsilon = \epsilon$ . Combining the bounds on the two terms, we get $J _ { \mathrm { a l g } } ( \pi ^ { \star } ) \leq 2 \epsilon$ . Since $\pi ^ { \star } \in \Pi$ , the result follows.
331
+
332
+ Theorem 1. Let $\hat { \pi }$ be the result of minimizing $J _ { \mathrm { a l g } }$ using our optimization oracle, and assume that $Q _ { T - t + 1 } ^ { \pi ^ { \star } } ( s , a ) - Q _ { T - t + 1 } ^ { \pi ^ { \star } } ( s , \pi ^ { \star } ) \leq u$ for all $a \in \mathcal { A } , t \in \{ 1 , 2 , . . . , T \} , d _ { \pi } ^ { t } ( s ) > 0 ,$ . Then $\hat { \pi }$ satisfies $J ( \hat { \pi } ) \le J ( \pi ^ { \star } ) + 3 u \kappa \epsilon T$ .
333
+
334
+ Proof. By our optimization oracle and Lemma 2, we have
335
+
336
+ $$
337
+ \begin{array} { r l } & { J _ { \mathrm { a l g } } ( \hat { \pi } ) \leq \displaystyle \operatorname* { m i n } _ { \pi \in \Pi } J _ { \mathrm { a l g } } ( \pi ) + \epsilon } \\ & { \qquad \leq 2 \epsilon + \epsilon } \\ & { \qquad = 3 \epsilon } \end{array}
338
+ $$
339
+
340
+ Combining with Lemma 1, we get:
341
+
342
+ $$
343
+ \begin{array} { l } { { J _ { \mathrm { e x p } } ( \hat { \pi } ) \leq \kappa J _ { \mathrm { a l g } } ( \hat { \pi } ) } } \\ { { \leq 3 \kappa \epsilon } } \end{array}
344
+ $$
345
+
346
+ Applying Theorem 1 from (Ross et al., 2011), we get $J ( \hat { \pi } ) \le J ( \pi ^ { \star } ) + 3 u \kappa \epsilon T$ .
347
+
348
+ # B IMPORTANCE OF BEHAVIOR CLONING COST
349
+
350
+ The following example shows how minimizing the uncertainty cost alone without the BC cost can lead to highly sub-optimal policies if the demonstration data is generated by a stochastic policy which is only slightly suboptimal. Consider the following deterministic chain MDP:
351
+
352
+ $$
353
+ a _ { 0 } \underbrace \sum _ { \left( { \begin{array} { l } { s _ { 0 } } \end{array} } \right) } ^ { a _ { 1 } } { \overbrace { \left( s _ { 1 } \right) } ^ { a _ { 1 } } } _ { a _ { 0 } } ^ { a _ { 1 } } { \overbrace { \left( s _ { 2 } \right) } ^ { a _ { 1 } } } _ { a _ { 0 } } ^ { a _ { 1 } } { \overbrace { \left( s _ { 2 } \right) } ^ { a _ { 1 } } { \overbrace { \left( s _ { 3 } \right) } ^ { a _ { 2 } } } ^ { a _ { 1 } } } _ { a _ { 0 } } ^ { a _ { 1 } }
354
+ $$
355
+
356
+ The agent always starts in $s _ { 1 }$ , and gets a reward of 1 in $s _ { 3 }$ and 0 elsewhere. The optimal policy is given by:
357
+
358
+ $$
359
+ \begin{array} { r } { \pi ^ { \star } ( \cdot | s _ { 0 } ) = ( 0 , 1 ) } \\ { \pi ^ { \star } ( \cdot | s _ { 1 } ) = ( 0 , 1 ) } \\ { \pi ^ { \star } ( \cdot | s _ { 2 } ) = ( 0 , 1 ) } \\ { \pi ^ { \star } ( \cdot | s _ { 3 } ) = ( 0 , 1 ) } \end{array}
360
+ $$
361
+
362
+ Assume the demonstration data is generated by the following policy, which is only slightly suboptimal:
363
+
364
+ $$
365
+ \begin{array} { r l } & { \pi _ { \mathrm { d e m o } } ( \cdot | s _ { 0 } ) = ( 0 , 1 ) } \\ & { \pi _ { \mathrm { d e m o } } ( \cdot | s _ { 1 } ) = ( 0 , 1 ) } \\ & { \pi _ { \mathrm { d e m o } } ( \cdot | s _ { 2 } ) = ( 0 . 1 , 0 . 9 ) } \\ & { \pi _ { \mathrm { d e m o } } ( \cdot | s _ { 3 } ) = ( 0 , 1 ) } \end{array}
366
+ $$
367
+
368
+ Let us assume realizability and perfect optimization for simplicity. If both transitions $( s _ { 2 } , a _ { 0 } )$ and $( s _ { 2 } , a _ { 1 } )$ appear in the demonstration data, then Random Expert Distillation (RED) will assign zero cost to both transitions. If we do not use bootstrapped samples to train the ensemble, then DRIL without the BC cost (we will call this UO-DRIL for Uncertainty-Only DRIL) will also assign zero cost to both transitions since all models in the ensemble would recover the Bayes optimal solution given the demonstration data. If we are using bootstrapped samples, then the Bayes optimal solution for each bootstrapped sample may differ and thus the different policies in the ensemble might disagree in their predictions, although given enough demonstration data we would expect these differences (and thus the uncertainty cost) to be small.
369
+
370
+ Note also that since no samples at the state $s _ { 0 }$ occur in the demonstration data, both RED and UODRIL will likely assign high uncertainty costs to state-action pairs at $( s _ { 0 } , a _ { 0 } ) , ( s _ { 0 } , a _ { 1 } )$ and thus avoid highly suboptimal policies which get stuck at $s _ { 0 }$ .
371
+
372
+ Now consider policies $\hat { \pi } _ { 1 } , \hat { \pi } _ { 2 }$ given by:
373
+
374
+ $$
375
+ \begin{array} { r } { \hat { \pi } _ { 1 } ( \cdot | s _ { 0 } ) = ( 0 , 1 ) } \\ { \hat { \pi } _ { 1 } ( \cdot | s _ { 1 } ) = ( 0 , 1 ) } \\ { \hat { \pi } _ { 1 } ( \cdot | s _ { 2 } ) = ( 1 , 0 ) } \\ { \hat { \pi } _ { 1 } ( \cdot | s _ { 3 } ) = ( 0 , 1 ) } \end{array}
376
+ $$
377
+
378
+ and
379
+
380
+ $$
381
+ \begin{array} { r l } & { \hat { \pi } _ { 2 } ( \cdot | s _ { 0 } ) = ( 0 , 1 ) } \\ & { \hat { \pi } _ { 2 } ( \cdot | s _ { 1 } ) = ( 0 , 1 ) } \\ & { \hat { \pi } _ { 2 } ( \cdot | s _ { 2 } ) = ( 0 . 2 , 0 . 8 ) } \\ & { \hat { \pi } _ { 2 } ( \cdot | s _ { 3 } ) = ( 0 , 1 ) } \end{array}
382
+ $$
383
+
384
+ Both of these policies only visit state-action pairs which are visited by the demonstration policy. In the case described above, both RED and UO-DRIL will assign $\hat { \pi } _ { 1 }$ and $\hat { \boldsymbol { \pi } } _ { 2 }$ similarly low costs. However, $\hat { \pi } _ { 1 }$ will cycle forever between $s _ { 1 }$ and $s _ { 2 }$ , never collecting reward, while $\hat { \boldsymbol { \pi } } _ { 2 }$ will with high probability reach $s _ { 3 }$ and stay there, thus achieving high reward. This shows that minimizing the uncertainty cost alone does not necessarily distinguish between good and bad policies. However, $\hat { \pi } _ { 1 }$ will incur a higher BC cost than $\hat { \boldsymbol { \pi } } _ { 2 }$ , since $\hat { \boldsymbol { \pi } } _ { 2 }$ more closely matches the demonstration data at $s _ { 2 }$ . This shows that including the BC cost can be important for further disambiguating between policies which all stay within the distribution of the demonstration data, but have different behavior within that distribution.
385
+
386
+ # C EXPERIMENTAL DETAILS
387
+
388
+ # C.1 ATARI ENVIRONMENTS
389
+
390
+ All behavior cloning models were trained to minimize the negative log-likelihood classification loss on the demonstration data for 500 epochs using Adam (Kingma & Ba, 2014) and a learning rate of $2 . 5 \cdot 1 0 ^ { - 4 }$ . We stopped training once the validation error did not improve for 20 epochs. For our method, we initially performed a hyperparameter search on Space Invaders over the values shown in Table 1
391
+
392
+ Table 1: Hyperparameters for DRIL
393
+
394
+ <table><tr><td>Hyperparameter</td><td>Values Considered</td><td>Final Value</td></tr><tr><td>Policy Learning rate</td><td>2.5:10-2,2.5:10 -3,2.5:10-4</td><td>2.5:10-3</td></tr><tr><td>Quantile cutoff</td><td>0.8, 0.9, 0.95, 0.98</td><td>0.98</td></tr><tr><td>Number of supervised updates</td><td>1,5</td><td>1</td></tr><tr><td>Number of policies in ensemble</td><td>5</td><td>5</td></tr><tr><td>Gradient clipping</td><td>0.1</td><td>0.1</td></tr><tr><td>Entropy coefficient</td><td>0.01</td><td>0.01</td></tr><tr><td>Value loss coeffcient</td><td>0.5</td><td>0.5</td></tr><tr><td>Number of steps</td><td>128</td><td>128</td></tr><tr><td>Parallel Environments</td><td>16</td><td>16</td></tr></table>
395
+
396
+ We then chose the best values and kept those hyperparameters fixed for all other environments. All other A2C hyperparameters follow the default values in the repo (Kostrikov, 2018): policy networks consisted of 3-layer convolutional networks with $8 - 3 2 - 6 4 $ feature maps followed by a single-layer MLP with 512 hidden units.
397
+
398
+ For GAIL, we used the implementation in (Kostrikov, 2018) and replaced the MLP discriminator by a CNN discriminator with the same architecture as the policy network. We initially performed a hyperparameter search on Breakout with 10 demonstrations over the values shown in Table 2. However, we did not find any hyperparameter configuration which performed better than behavioral cloning.
399
+
400
+ Table 2: Hyperparameters for GAIL
401
+
402
+ <table><tr><td>Hyperparameter</td><td>Values Considered</td><td>Final Value</td></tr><tr><td>Policy Learning rate</td><td>2.5· 10-2,2.5· 10-3,2.5·10-4</td><td>2.5:10-3</td></tr><tr><td>Discriminator Learning rate</td><td>2.5 : 10-2,2.5 : 10-3,2.5· 10-4</td><td>2.5 : 10-3</td></tr><tr><td>Number of discriminator updates</td><td>1,5,10</td><td>5</td></tr><tr><td>Gradient clipping</td><td>0.1</td><td>0.1</td></tr><tr><td>Entropy coefficient</td><td>0.01</td><td>0.01</td></tr><tr><td>Value loss coefficient</td><td>0.5</td><td>0.5</td></tr><tr><td>Number of steps</td><td>128</td><td>128</td></tr><tr><td>Parallel Environments</td><td>16</td><td>16</td></tr></table>
403
+
404
+ # C.2 CONTINUOUS CONTROL
405
+
406
+ All behavior cloning and ensemble models were trained to minimize the mean-squared error regression loss on the demonstration data for 500 epochs using Adam (Kingma & Ba, 2014) and a learning rate of $2 . 5 \cdot 1 0 ^ { - 4 }$ . Policy networks were 2-layer fully-connected MLPs with tanh activations and 64 hidden units.
407
+
408
+ Table 3: Hyperparameters (our method)
409
+
410
+ <table><tr><td>Hyperparameter</td><td>Values Considered</td><td>Final Value</td></tr><tr><td>Policy Learning rate</td><td>2.5·10-3,2.5.10-4,1·10-4,5:10-5</td><td>2.5:10-5</td></tr><tr><td>Quantile cutoff</td><td>0.98</td><td>0.98</td></tr><tr><td>Number of supervised updates</td><td>1</td><td>1</td></tr><tr><td>Number of policies in ensemble</td><td>5</td><td>5</td></tr><tr><td>Gradient clipping</td><td>0.1</td><td>0.1</td></tr><tr><td>Entropy coefficient</td><td>0.01</td><td>0.01</td></tr><tr><td>Value loss coefficient</td><td>0.5</td><td>0.5</td></tr><tr><td>Number of steps</td><td>128</td><td>128</td></tr><tr><td>Parallel Environments</td><td>16</td><td>16</td></tr></table>
411
+
412
+ # D ABLATION EXPERIMENTS
413
+
414
+ In this section we provide ablation experiments examining the effects of the cost function clipping and the role of the BC loss. We also compare the ensemble approach to a dropout-based approximation and show that DRIL works well in both cases.
415
+
416
+ Table 4: Ablation Experiments with 3 expert trajectories
417
+
418
+ <table><tr><td>Environment</td><td>SpaceInvaders</td><td>Breakout</td><td>BeamRider</td></tr><tr><td>DRIL (ensemble)</td><td>555.7</td><td>286.7</td><td>2033.4</td></tr><tr><td>DRIL (dropout)</td><td>581.4</td><td>205.4</td><td>2124.5</td></tr><tr><td>DRIL (raw cost)</td><td>421.8</td><td>70.9</td><td>1265.5</td></tr><tr><td>DRIL (no BC cost)</td><td>102.1</td><td>78.3</td><td>538.4</td></tr><tr><td>BC</td><td>257.0</td><td>2.7</td><td>689.7</td></tr></table>
419
+
420
+ Results are shown in Figure 4. First, switching from the clipped cost in $\{ - 1 , + 1 \}$ to the the raw cost causes a drop in performance. One explanation may be that since the raw costs are always positive (which corresponds to a reward which is always negative), the agent may learn to terminate the episode early in order to minimize the total cost incurred. Using a cost/reward which has both positive and negative values avoids this behavior.
421
+
422
+ Second, optimizing the pure BC cost performs better than the pure uncertainty cost for some environments (SpaceInvaders, BeamRider) while optimizing the pure uncertainty cost performs better than BC in Breakout. DRIL, which optimizes both, has robust performance and performs the best over all environments.
423
+
424
+ For the dropout approximation we trained a single policy network with a dropout rate of 0.1 applied to all layers except the last, and estimated the variance for each state-action pair using 5 different dropout masks. Similarly to the ensemble approach, we computed the $9 8 ^ { \mathrm { t h } }$ quantile of the variance on the demonstration data and used this value in our clipped cost. MC-dropout performs similarly to the ensembling approach, which shows that our method can be paired with different approaches to posterior estimation.
md/train/ryg7vA4tPB/ryg7vA4tPB.md ADDED
@@ -0,0 +1,363 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # RIGGING THE LOTTERY: MAKING ALL TICKETS WINNERS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Sparse neural networks have been shown to be more parameter and compute efficient compared to dense networks and in some cases they are even successfully used to decrease wall clock inference times. There is a large body of work on training dense networks to yield sparse networks for inference (Molchanov et al., 2017; Zhu & Gupta, 2018; Louizos et al., 2017; Li et al., 2016; Guo et al., 2016). This limits the size of the largest trainable sparse model to that of the largest trainable dense model. In this paper we introduce a method to train sparse neural networks with a fixed parameter count and a fixed computational cost throughout training, without sacrificing accuracy relative to existing dense-to-sparse training methods. Our method updates the topology of the network during training by using parameter magnitudes and infrequent gradient calculations. We show that this approach requires fewer floating-point operations (FLOPs) to achieve a given level of accuracy compared to prior techniques. We demonstrate state-of-the-art sparse training results with ResNet-50, MobileNet v1 and MobileNet v2 on the ImageNet-2012 dataset, WideResNets on the CIFAR-10 dataset and RNNs on the WikiText-103 dataset. Finally, we provide some insights into why allowing the topology to change during the optimization can overcome local minima encountered when the topology remains static.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The parameter and floating point operation (FLOP) efficiency of sparse neural networks is now well demonstrated on a variety of problems (Han et al., 2015; Srinivas et al., 2017). Some work has even shown inference time speedups are possible on Recurrent Neural Networks (RNNs) (Kalchbrenner et al., 2018) and Convolutional Neural Networks (ConvNets) (Park et al., 2016). Currently, the most accurate sparse models are obtained with techniques that require, at a minimum, the cost of training a dense model in terms of memory and FLOPs (Zhu & Gupta, 2018; Guo et al., 2016), and sometimes significantly more (Molchanov et al., 2017). This paradigm has two main limitations:
12
+
13
+ 1. The maximum size of sparse models is limited to the largest dense model that can be trained. Even if sparse models are more parameter efficient, we can’t use pruning to train models that are larger and more accurate than the largest possible dense models.
14
+ 2. It is inefficient. Large amounts of computation must be performed for parameters that are zero valued or that will be zero during inference.
15
+
16
+ Additionally, it remains unknown if the performance of the current best pruning algorithms are an upper bound on the quality of sparse models. Gale et al. (2019) found that three different dense-tosparse training algorithms all achieve about the same sparsity / accuracy trade-off. However, this is far from conclusive proof that no better performance is possible. In this work we show the surprising result that dynamic sparse training, which includes the method we introduce below, can find more accurate models than the current best approaches to pruning initially dense networks. Importantly, our method does not change the FLOPs required to execute the model during training, allowing one to decide on a specific inference cost prior to training.
17
+
18
+ The Lottery Ticket Hypothesis (Frankle & Carbin, 2019) hypothesized that if we can find a sparse neural network with iterative pruning, then we can train that sparse network from scratch, to the same level of accuracy, by starting from the original initial conditions. In this paper we introduce a new method for training sparse models without the need of a “lucky” initialization; for this reason, we call our method “The Rigged Lottery” or $R i g L ^ { * }$ . We show that this method is:
19
+
20
+ • Memory efficient: It requires memory only proportional to the size of the sparse model. It never requires storing quantities that are the size of the dense model. This is in contrast to Dettmers & Zettlemoyer (2019) which requires storing the momentum for all parameters, even those that are zero valued.
21
+ • Computationally efficient: The amount of computation required to train the model is proportional to the number of nonzero parameters in the model.
22
+ • Accurate: The performance achieved by the method matches and sometimes exceeds the performance of pruning based approaches.
23
+
24
+ Our method works by infrequently using instantaneous gradient information to inform a re-wiring of the network. We show that this allows the optimization to escape local minima where it would otherwise become trapped if the sparsity pattern were to remain static. Crucially, as long as the full gradient information is needed less than every $\frac { 1 } { 1 - s p a r s i t y }$ iterations, then the overall work remains proportional to the model sparsity.
25
+
26
+ # 2 RELATED WORK
27
+
28
+ Research on finding sparse neural networks dates back decades; for example, at least to Thimm & Fiesler (1995) who concluded that pruning weights based on magnitude was a simple and powerful technique. Strom (1997) later introduced the idea of retraining the previously pruned network to ¨ increase accuracy. Han et al. (2016b) went further and introduced multiple rounds of magnitude pruning and retraining. This is, however, relatively inefficient, requiring ten rounds of retraining when removing $2 0 \%$ of the connections to reach a final sparsity of $9 0 \%$ . To overcome this problem, Narang et al. (2017) introduced gradual pruning, where connections are slowly removed over the course of a single round of training. Zhu & Gupta (2018) refined the technique to minimize the amount of hyper-parameter selection required.
29
+
30
+ A diversity of approaches not based on magnitude based pruning have also been proposed. LeCun et al. (1990) and Hassibi & Stork (1993) are some early examples, but impractical for modern neural networks as they use information from the Hessian to prune a trained network. More recent work includes $L _ { 0 }$ Regularization (Christos Louizos, 2018), Variational Dropout (Molchanov et al., 2017), Dynamic Network Surgery (Guo et al., 2016) and Sensitivity Driven Regularization (Tartaglione et al., 2018). Gale et al. (2019) examined magnitude pruning, $L _ { 0 }$ Regularization and Variational Dropout and concluded that they all achieve about the same accuracy versus sparsity trade-off on ResNet-50 and Transformer architectures.
31
+
32
+ Training techniques that allow for sparsity throughout the entire training process were, to our knowledge, first introduced in Deep Rewiring (DeepR) (Bellec et al., 2017). In DeepR, the standard Stochastic Gradient Descent (SGD) optimizer is augmented with a random walk in parameter space. Additionally, connections have a pre-defined sign assigned at random; when the optimizer would normally flip the sign, the weight is set to 0 instead and new weights are activated at random.
33
+
34
+ Sparse Evolutionary Training (SET) (Mocanu et al., 2018) proposed a simpler scheme where weights are pruned according to the standard magnitude criterion used in pruning and are added back at random. The method is simple and achieves reasonable performance in practice. Dynamic Sparse Reparameterization (DSR) (Mostafa & Wang, 2019) introduced the idea of allowing the parameter budget to shift between different layers of the model, allowing for non-uniform sparsity. This allows the model to distribute parameters where they are most effective. Unfortunately, the models under consideration are mostly convolutional networks, so the result of this parameter reallocation (which is to decrease the sparsity of early layers and increase the sparsity of later layers) has the overall effect of increasing the FLOP count because the spatial size is largest at the beginning. Sparse Networks from Scratch (SNFS) (Dettmers & Zettlemoyer, 2019) introduces the idea of using the momentum of each parameter as the criterion to be used for growing weights and demonstrates it leads to an improvement in test accuracy. Like DSR, they allow the sparsity of each layer to change and focus on a constant parameter, not FLOP, budget. Importantly, the method requires computing gradients and updating the momentum for every parameter in the model, even those that are zero, at every iteration. This can result in a significant amount of overall computation. Additionally, depending on the model and training setup, the required storage for the full momentum tensor could be prohibitive. Single-Shot Network Pruning (SNIP) (Lee et al., 2019) attempts to find an initial mask with one-shot pruning and uses the saliency score of parameters to decide which parameters to keep. After pruning training proceeds with this static sparse network. Properties of the different sparse training techniques are summarized in Table 1.
35
+
36
+ Table 1: Comparison of different sparse training techniques. Drop and Grow columns correspond to the strategies used during the mask update. Selectable $F L O P s$ is possible if the cost of training the model is fixed at the beginning of training.
37
+
38
+ <table><tr><td>Method</td><td>Drop</td><td>Grow</td><td>Selectable FLOPs</td><td>Space &amp;FLOPs X</td></tr><tr><td>SNIP</td><td>min(10 * VL(0)I)</td><td>none</td><td>yes</td><td>sparse</td></tr><tr><td>DeepR</td><td>stochastic</td><td>random</td><td>yes</td><td>sparse</td></tr><tr><td>SET</td><td>min(l0))</td><td>random</td><td>yes</td><td>sparse</td></tr><tr><td>DSR</td><td>min(le)</td><td>random</td><td>no</td><td>sparse</td></tr><tr><td>SNFS</td><td>min(l0))</td><td>momentum</td><td>no</td><td>dense</td></tr><tr><td>RigL (ours)</td><td>min(l0)</td><td>gradient</td><td>yes</td><td>sparse</td></tr></table>
39
+
40
+ There has also been a line of work investigating the Lottery Ticket Hypothesis (Frankle & Carbin, 2019). Frankle et al. (2019) showed that the formulation must be weakened to apply to larger networks such as ResNet-50 (He et al., 2015). In large networks, instead of the original initialization, the values after thousands of optimization steps must be used for initialization. Zhou et al. (2019) showed that lottery tickets obtain non-random accuracies even before the training has started. Though the possibility of training sparse neural networks with a fixed sparsity mask using lottery tickets is intriguing, it remains unclear whether it is possible to generate such initializations – for both masks and parameters – de novo.
41
+
42
+ # 3 RIGGING THE LOTTERY
43
+
44
+ Our method, RigL, is illustrated in Figure 1. At regularly spaced intervals our method removes a fraction of connections based on weight magnitudes and activates new ones using instantaneous gradient information. After updating the connectivity, training continues with the updated network until the next update. The main parts of our algorithm, Sparsity Distribution, Update Schedule, Drop Criterion, Grow Criterion, and the various options we considered for each, are explained below. The improved performance of $R i g L$ is due to two reasons: the use of a new method for activating connections that is efficient and more effective than choosing at random, and the use of a natural extension to an existing method for distributing parameters statically among convolutional layers.
45
+
46
+ (0) Notation. Given a dataset $D$ with individual inputs $x _ { i }$ and targets $y _ { i }$ , one can train a neural network to minimize the loss function $\textstyle \sum _ { i } L ( f _ { \theta } ( x _ { i } ) , y _ { i } )$ , where $f _ { \boldsymbol { \theta } } ( \boldsymbol { x } )$ is the neural network with parameters $\theta$ of length $N$ . The vector $\theta$ can be decomposed into parameters $\theta ^ { l }$ , of length $N ^ { l }$ , for each layer $l$ . A sparse network keeps only a fraction $D \in ( 0 , 1 )$ of all connections, resulting in a sparsity of $S = 1 - D$ . More precisely, denoting the sparsity of individual layers with $s ^ { l }$ , the total parameter count of the sparse neural network satisfies $\begin{array} { r } { \dot { \sum _ { l } } ( 1 - s ^ { l } ) N ^ { l } = ( 1 - \bar { S } ) * N } \end{array}$ .
47
+
48
+ ![](images/c4f8c255dd49151f0525882b1c8f56ef8e1197a1ff58bb53e4c69623eb1ec0b1.jpg)
49
+ Figure 1: Dynamic sparse training aims to change connectivity during training to help out optimzation.
50
+
51
+ (1) Sparsity Distribution. There are many ways of distributing the non-zero weights across the layers while satisfying the equality above. We avoid re-allocating parameters between layers during the training process as it makes it difficult to target a specific final FLOP budget, which is important for many inference applications. We consider the following three strategies:
52
+
53
+ 1. Uniform: The sparsity $s ^ { l }$ of each individual layer is the same as the total sparsity $S$ . We keep the first layer dense $\boldsymbol s ^ { 0 } = 0 ,$ ), since it has negligible number of parameters.
54
+ 2. Erdos-R ˝ enyi: ´ As introduced in Mocanu et al. (2018), $s ^ { l }$ scales with n +n nl−1∗nl , where nl denotes number of neurons at layer l. This enables the number of connections in a sparse layer to scale with the sum of the number of output and input channels.
55
+ 3. Erdos-R ˝ enyi-Kernel (ERK): ´ This method modifies the original Erdos-R ˝ enyi formulation ´ by including the kernel dimensions in the scaling factors. In other words, the number of parameters of the sparse convolutional layers are scaled proportional to 1− nl−1+nl+wl+hlnl−1∗nl∗wl∗hl , where $w ^ { l }$ and $h ^ { l }$ are the width and the height of the $\mathbf { \nabla } _ { l } ,$ ’th convolutional kernel. Sparsity of the fully connected layers scale as in the original Erdos-R ˝ enyi formulation. Similar to Erd ´ os- ˝ Renyi, ERK allocates higher sparsities to the layers with more parameters while allocating ´ lower sparsities to the smaller ones.
56
+
57
+ In all methods, the bias and batch-norm parameters are kept dense.
58
+
59
+ (2) Update Schedule. The update schedule is defined by the following parameters: (1) the number of iterations between sparse connectivity updates $( \Delta T )$ , (2) the iteration at which to stop updating the sparse connectivity $( T _ { e n d } )$ , (3) the initial fraction of connections updated $( \alpha )$ and (4) a function $f _ { d e c a y }$ , invoked every $\Delta T$ iterations until $T _ { e n d }$ , possibly decaying the fraction of updated connections over time. For the latter we choose to use cosine annealing, as we find it slightly outperforms the other methods considered.
60
+
61
+ $$
62
+ f _ { d e c a y } ( t ) = \frac { \alpha } { 2 } \left( 1 + c o s \left( \frac { t \pi } { T _ { e n d } } \right) \right)
63
+ $$
64
+
65
+ Alternatives to cosine annealing like a constant schedule and inverse power annealing are studied in the Appendix F.
66
+
67
+ (3) Drop criterion. Over the course of training, we drop the lowest magnitude weights according to the update schedule since they are expected to effect the training loss least. Specifically, we drop the connections given by
68
+
69
+ $T o p K ( - | \theta ^ { l } | , f _ { d e c a y } ( t ) \dot { ( } 1 - s ^ { l } ) N ^ { l } ) ^ { \ddag } .$
70
+
71
+ (4) Grow criterion. The novelty of our method lies in how we grow new connections. We grow the connections with highest magnitude gradients, $T o p K _ { w \notin \theta _ { a c t i v e } ^ { l } } \breve { ( | { g r a d ( \theta ^ { l } ) } | } , f _ { d e c a y } ( t ) ( 1 - s ^ { l } ) \breve { N } ^ { l } ) .$ , where $\theta _ { a c t i v e } ^ { l }$ is the set of active connections after the drop step. Newly activated connections are initialized to zero and therefore don’t effect the output of the network. However they are expected to receive gradients with high magnitudes in the next iteration and therefore reduce the loss fastest. This procedure can be applied to each layer in sequence and the dense gradients can be discarded immediately after selecting the top connections. If a layer is too large to materialize the full gradient with respect to the weights, then we can further reduce the memory requirements by performing an iterative calculation:
72
+
73
+ 1. Initialize the set $T K = \{ \}$ .
74
+ 2. Materialize a subset of size M of the full gradient, which we denote $G _ { i : i + M }$ .
75
+ 3. Update $T K$ to contain the Top- $\mathbf { \nabla } \cdot \mathbf { K }$ elements of $G _ { i : i + M }$ concatenated with $T K$ .
76
+ 4. Repeat steps 1 through 3 until all of the gradients have been materialized. The final set $T K$
77
+ contains the connections we wish to grow.
78
+
79
+ ![](images/dfa7237fe18adc99e80cc225a8c395a896800044e15fa934ef6beb417685da6e.jpg)
80
+ Figure 2: (left) Performance of various dynamic sparse training methods on ImageNet-2012 classification task. We use $80 \%$ sparse ResNet-50 architecture with uniform sparsity distribution. Points at each curve correspond to the individual training runs with training multipliers from 1 to 5 (except pruning which is scaled between 0.5 and 2). We repeat training 3 times at every multiplier and report the mean accuracies. The number of FLOPs required to train a standard dense Resnet-50 along with its performance is indicated with a dashed red line. (right) Performance of RigL at different sparsity levels with extended training. Results are averaged over 3 runs.
81
+
82
+ As long as $\Delta T > \frac { 1 } { 1 - s }$ the total work in calculating dense gradients is amortized and still proportional to $1 - S$ . This is in contrast to the method of Dettmers & Zettlemoyer (2019), which requires calculating and storing the full gradients at each optimization step.
83
+
84
+ # 4 EMPIRICAL EVALUATION
85
+
86
+ Our experiments include image classification using CNNs on the ImageNet-2012 (Russakovsky et al., 2015) and CIFAR-10 (Krizhevsky et al.) datasets and character based language modelling using RNNs with the WikiText-103 dataset (Merity et al., 2016). We use the TensorFlow Model Pruning library (Zhu & Gupta, 2018) for our pruning baselines. A Tensorflow (Abadi et al., 2015) implementation of our method along with three other baselines (SET, SNFS, SNIP) will be open sourced. When we increase the training steps by a factor $M$ , the anchor epochs of the learning rate schedule and the end iteration of the mask update schedule are also scaled by the same factor; we indicate this scaling with a subscript (e.g. ${ \mathrm { R i g L } } _ { M \times } ,$ ).
87
+
88
+ # 4.1 IMAGENET-2012 DATASET
89
+
90
+ In all experiments in this section, we use SGD with momentum as our optimizer. We set the momentum coefficient of the optimizer to 0.9, $L _ { 2 }$ regularization coefficient to 0.0001, and label smoothing (Szegedy et al., 2016) to 0.1. The learning rate schedule starts with a linear warm up reaching its maximum value of 1.6 at epoch 5 which is then dropped by a factor of 10 at epochs 30, 70 and 90. We train our networks with a batch size of 4096 for 32000 steps which roughly corresponds to 100 epochs of training. Our training pipeline uses standard data augmentation, which includes random flips and crops.
91
+
92
+ # 4.1.1 RESNET-50
93
+
94
+ Figure 2-left summarizes the performance of various methods on training an $80 \%$ sparse ResNet-50. We also train small dense networks with equivalent parameter count. All sparse networks use the constant sparsity distribution and a cosine update schedule $\mathrm { ~ \ : ( \alpha ~ ) = ~ 0 . 3 ~ }$ , $\Delta T = 1 0 0$ ). Overall, we observe that the performance of all methods improves with training time; thus, for each method we run extended training with up to $5 \times$ the training steps of the original.
95
+
96
+ As noted by Gale et al. (2019), Evci et al. (2019), Frankle et al. (2019), and Mostafa & Wang (2019), training a network with fixed sparsity from scratch (Static) leads to inferior performance. Training a small dense network with the same number of parameters gets better results than Static, but fails to match the performance of dynamic sparse models. Similarly $S E T$ improves the performance over Small-Dense, however saturates around $7 5 \%$ accuracy indicating the limits of growing new connec
97
+
98
+ <table><tr><td>Method</td><td>Top-1 Accuracy</td><td>FLOPs (Train)</td><td>FLOPs (Test)</td><td>Top-1 Accuracy</td><td>FLOPs (Train)</td><td>FLOPs (Test)</td></tr><tr><td>Dense</td><td>76.8±0.09</td><td>1x (3.2e18)</td><td>1x (8.2e9)</td><td colspan="3"></td></tr><tr><td>Static</td><td colspan="3">S=0.8</td><td colspan="3">S=0.9</td></tr><tr><td>SNIP</td><td>70.6±0.06 72.0±0.10</td><td>0.23x 0.23x</td><td>0.23x 0.23x</td><td>65.8±0.04 67.2±0.12</td><td>0.10x 0.10x</td><td>0.10x 0.10x</td></tr><tr><td>Small-Dense</td><td>72.1±0.12</td><td>0.20x</td><td>0.20x</td><td>68.9±0.10</td><td>0.12x</td><td>0.12x</td></tr><tr><td>SET</td><td>72.9±0.39</td><td>0.23x</td><td>0.23x</td><td>69.6±0.23</td><td>0.10x</td><td>0.10x</td></tr><tr><td>RigL</td><td>74.6±0.06</td><td>0.23x</td><td>0.23x</td><td>72.0±0.05</td><td>0.10x</td><td>0.10x</td></tr><tr><td>Small-Dense5x RigL5x</td><td>73.9±0.07</td><td>1.01x</td><td>0.20x</td><td>71.3±0.10</td><td>0.60x</td><td>0.12x</td></tr><tr><td>Static (ERK)</td><td>76.6±0.06</td><td>1.14x</td><td>0.23x</td><td>75.7±0.06</td><td>0.52x</td><td>0.10x</td></tr><tr><td>DSR*</td><td>72.1±0.04 73.3</td><td>0.42x 0.40x</td><td>0.42x 0.40x</td><td>67.7±0.12</td><td>0.24x</td><td>0.24x</td></tr><tr><td></td><td></td><td></td><td></td><td>71.6</td><td>0.30x</td><td>0.30x</td></tr><tr><td>RigL (ERK)</td><td>75.1±0.05</td><td>0.42x</td><td>0.42x</td><td>73.0±0.04</td><td>0.25x</td><td>0.24x</td></tr><tr><td>RigL5x (ERK)</td><td>77.1±0.06</td><td>2.09x</td><td>0.42x</td><td>76.4±0.05</td><td>1.23x</td><td>0.24x</td></tr><tr><td>SNFS*</td><td>74.2</td><td>n/a</td><td>n/a</td><td>72.3</td><td>n/a</td><td>n/a</td></tr><tr><td>SNFS (ERK)</td><td>75.2±0.11</td><td>0.61x</td><td>0.42x</td><td>72.9±0.06</td><td>0.50x</td><td>0.24x</td></tr><tr><td>Pruning* (Zhu)</td><td>73.2</td><td>1.00x</td><td>0.23x</td><td>70.3</td><td>1.00x</td><td>0.10x</td></tr><tr><td>Pruning* (Gale)</td><td>75.6</td><td>1.00x</td><td>0.23x</td><td>73.9</td><td>1.00x</td><td>0.10x</td></tr><tr><td>Pruning1.5× (Gale)</td><td>76.5</td><td>1.50x</td><td>0.23x</td><td></td><td>1.50x</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>75.2</td><td></td><td>0.10x</td></tr></table>
99
+
100
+ Table 2: Performance and cost of sparse training methods on training $80 \%$ and $90 \%$ sparse ResNet50s. FLOPs needed for training and test are normalized with the FLOPs of a dense model (see Appendix G for details on how FLOPs are calculated). Methods with a subscript indicate a rescaled training time, whereas ‘\*’ indicates reported results. (ERK) corresponds to the sparse networks with Erdos-Renyi-Kernel sparsity distribution.˝ $\mathrm { R i g L } _ { \mathrm { 5 } \times }$ (ERK) achieves $7 7 . 1 \%$ Top-1 Accuracy using only $20 \%$ of the parameters of a dense model and $42 \%$ of its FLOPs.
101
+
102
+ tions randomly. Methods that use gradient information to grow new connections (RigL and SNFS) obtain higher accuracies, but RigL achieves the highest accuracy and does so while consistently requiring fewer FLOPs than the other methods.
103
+
104
+ Given that different applications or scenarios might require a limit on the number of FLOPs for inference, we investigate the performance of our method at various sparsity levels. As mentioned previously, one strength of our method is that its resource requirements are constant throughout training and we can choose the level of sparsity that fits our training and/or inference constraints. In Figure 2-right we show the performance of our method at different sparsities and compare them with the pruning results of Gale et al. (2019), which uses $1 . 5 \mathrm { x }$ training steps, relative to the original 32k iterations. To make a fair comparison with regards to FLOPs, we scale the learning schedule of all other methods by ${ 5 } \mathbf { x }$ . Note that even after extending the training, it takes less FLOPs to train sparse networks using rigL (except for the $80 \%$ sparse RigL-ERK) compared to the pruning method.
105
+
106
+ RigL, our method with constant sparsity distribution, exceeds the performance of magnitude based iterative pruning in all sparsity levels while requiring less FLOPs to train. Sparse networks that use Erdos-Renyi-Kernel (ERK) ˝ sparsity distribution obtains even greater performance. For example ResNet-50 with $9 6 . 5 \%$ sparsity achieves a remarkable $7 2 . 7 5 \%$ Top-1 Accuracy, around $3 . 5 \%$ higher than the extended magnitude pruning results reported by Gale et al. (2019). As observed earlier, smaller dense models (with the same number of parameters) or sparse models with a static connectivity can not perform at a comparable level.
107
+
108
+ A more fine grained comparison of sparse training methods is presented in Table 2. Methods using uniform sparsity distribution and whose FLOP/memory footprint scales directly with (1-S) are placed in the first sub-group of the table. The second sub-group includes DSR and networks with ERK sparsity distribution which require a higher number of FLOPs for inference with same parameter count. The final sub-group includes methods that require the space and the work proportional to training a dense model.
109
+
110
+ ![](images/8ad076c5d43264442c51ef52152072882fb12f6803ab3f5d550b0ad517566e72.jpg)
111
+ Figure 3: (left) RigL significantly improves the performance of Sparse MobileNets on ImageNet2012 dataset and exceeds the pruning results reported by Zhu & Gupta (2018). Performance of the dense MobileNets are indicated with red lines. (right) Performance of sparse MobileNet-v1 architectures presented with their inference FLOPs. Networks with ERK distribution get better performance with the same number of parameters but take more FLOPs to run. Training wider sparse models with RigL (Big-Sparse) yields a significant performance improvement over the dense model.
112
+
113
+ <table><tr><td rowspan=1 colspan=1>S</td><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Top-1</td><td rowspan=1 colspan=1>FLOPs</td></tr><tr><td rowspan=1 colspan=1>0.75</td><td rowspan=1 colspan=1>Small-Dense5×Pruning (Zhu)RigL5×RigL5x(ERK)</td><td rowspan=1 colspan=1>66.0±0.1167.771.5±0.0671.9±0.01</td><td rowspan=1 colspan=1>0.23x0.27x0.27x0.52x</td></tr><tr><td rowspan=1 colspan=1>0.90</td><td rowspan=1 colspan=1>Small-Dense5xPruning (Zhu)RigL5×RigL5x(ERK)</td><td rowspan=1 colspan=1>57.7±0.3461.867.0±0.1768.1±0.11</td><td rowspan=1 colspan=1>0.09x0.12x0.12x0.27x</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Dense</td><td rowspan=1 colspan=1>72.1±0.17</td><td rowspan=1 colspan=1>1x (1.1e9)</td></tr><tr><td rowspan=1 colspan=1>0.75</td><td rowspan=1 colspan=1>Big-Sparse5×Big-Sparse5x(ERK)</td><td rowspan=1 colspan=1>76.4±0.0577.0±0.08</td><td rowspan=1 colspan=1>0.98x1.91x</td></tr></table>
114
+
115
+ # 4.1.2 MOBILENET
116
+
117
+ MobileNet is a compact architecture that performs remarkably well in resource constrained settings. Due to its compact nature with separable convolutions it is known to be difficult to sparsify (Zhu & Gupta, 2018). In this section we apply our method to MobileNet-v1 (Howard et al., 2017) and MobileNet-v2 (Sandler et al., 2018). Due to its low parameter count we keep the first layer dense, and use ERK and Uniform sparsity distributions to sparsify the remaining layers.
118
+
119
+ The performance of sparse MobileNets trained with RigL as well as the baselines are shown in Figure 3. We do extended training (5x of the original number of steps) for all runs in this section. Although MobileNets are more sensitive to sparsity compared to the ResNet-50 architecture, RigL successfully trains sparse MobileNets at high sparsities and exceeds the performance of previously reported pruning results.
120
+
121
+ To demonstrate the advantages of sparse models, next, we train wider MobileNets while keeping the FLOPs and total number of parameters the same as the dense baseline using sparsity. A sparse MobileNet-v1 with width multiplier 1.98 and constant $7 5 \%$ sparsity has the same FLOPs and parameter count as the dense baseline. Training this network with RigL yields an impressive $4 . 3 \%$ absolute improvement in Top-1 Accuracy.
122
+
123
+ # 4.2 CHARACTER LEVEL LANGUAGE MODELLING
124
+
125
+ Most prior work has only examined sparse training on vision networks [the exception is the earliest work - Deep Rewiring (Bellec et al., 2017) which trained an LSTM (Hochreiter & Schmidhuber, 1997) on the TIMIT (Garofolo et al., 1993) dataset]. To fully understand these techniques it is important to examine different architectures on different datasets. Kalchbrenner et al. (2018) found sparse GRUs (Cho et al., 2014) to be very effective at modeling speech, however the dataset they used is not available. We choose a proxy task with similar characteristics (dataset size and vocabulary size are approximately the same) - character level language modeling on the publicly available WikiText-103 (Merity et al., 2016) dataset.
126
+
127
+ Our network consists of a shared embedding with dimensionality 128, a vocabulary size of 256, a GRU with a state size of 512, a readout from the GRU state consisting of two linear layers with 256 units and 128 units respectively. We train the next step prediction task with the standard cross entropy loss, the Adam optimizer, a learning rate of $7 e - 4$ , an L2 regularization coefficient of $5 e { - 4 }$ , a sequence length of 512, a batch size of 32 and gradient absolute value clipping of values larger (in magnitude) than 10. Baseline training length is 200,000 iterations. When inducing sparsity with magnitude pruning (Zhu & Gupta, 2018), we perform pruning between iterations 50,000 and
128
+
129
+ ![](images/f16a2ec71b43df85e1a6ff38138e0337a2c670eede9c85bef31c854aa486fd2f.jpg)
130
+ Figure 4: (left) Final validation loss of various sparse training methods on character level language modelling task. Cross entropy loss is converted to bits (from nats). Performance and the training cost of a dense model is indicated with dashed red lines. (right) Test accuracies of sparse WideResNet22-2’s on CIFAR-10 task.
131
+
132
+ 150,000 with a pruning frequency of 1,000. We initialize sparse networks with a uniform sparsity distribution and use a cosine update schedule with $\alpha = 0 . 1$ and $\Delta T = 1 0 0$ . Unlike the previous experiments we keep updating the mask until the end of the training; we observed this performed slightly better than stopping at iteration 150,000.
133
+
134
+ In Figure 4-left we report the validation loss of various solutions at the end of the training. For each method we perform extended runs to see how they scale with increasing training time. As observed before, SET performs worst than the other dynamic training methods and its performance improves only slightly with increased training time. On the other hand the performance of RigL and SNFS improves constantly with more training steps. Both of these methods falls short of matching the pruning performance.
135
+
136
+ # 4.3 WIDERESNET-22-2 ON CIFAR-10
137
+
138
+ In this section, we evaluate the performance of RigL on CIFAR-10 image classification benchmark. We train Wide Residual Network’s (Zagoruyko & Komodakis, 2016) with 22 layers using a width multiplier of 2 for 250 epochs (97656 steps). Learning rate starts at 0.1 and scaled down by a factor of 5 every 30,000 iterations. We use an L2 regularization coefficient of 5e-4, a batch size of 128 and a momentum coefficient of 0.9. We keep the hyper-parameters specific to RigL same as the ImageNet experiments, except the final iteration for mask updates; which is adjusted to 75000. Results with different mask update intervals can be found in Appendix H.
139
+
140
+ Performance of RigL across different sparsity levels is presented in Figure 4-right. Corresponding final training losses of the trained networks can be found in Appendix H. The dense baseline obtains $9 4 . 1 \%$ test accuracy. Networks with half of the connections removed $50 \%$ sparsity) achieves roughly the same accuracy as the dense baseline. Surprisingly, some of the networks at this sparsity level generalize better than the dense baseline demonstrating the regularization aspect of using sparsity. With increased sparsity, we start to see a performance gap between the Static and Pruning solutions. Training static RigL networks longer seems to have limited effect on the final performance. On the other hand, RigL, matches the performance of pruning using only a fraction of resources needed for training a dense network.
141
+
142
+ # 4.4 ANALYZING THE PERFORMANCE OF RigL
143
+
144
+ In this section we study the effect of sparsity distributions, update schedules, and dynamic connections on the performance of our method. The results for SET and SNFS are similar and are discussed in Appendices B and E.
145
+
146
+ Effect of Mask Initialization: Figure 5-left shows how the sparsity distribution affects the final test accuracy of sparse ResNet-50s trained with RigL. Erdos-R ˝ enyi-Kernel (ERK) performs consis- ´ tently better than the other two distributions. ERK automatically allocates more parameters to the layers with few parameters by decreasing their sparsities†. This reallocation seems to be crucial for preserving the capacity of the network at high sparsity levels where ERK outperforms other distributions by a greater margin. Though it performs better, the ERK distribution requires approximately twice as many FLOPs compared to a uniform distribution. This highlights an interesting trade-off between accuracy and computational efficiency even though both models have the same number of parameters.
147
+
148
+ ![](images/5800160114d0737b3e2907dc82a457c52f3b8ccbcf1ecf67ee038a009c690904.jpg)
149
+ Figure 5: (left) Performance of RigL at different sparsities using different sparsity masks (right) Ablation study on cosine schedule. Other methods are in the appendix.
150
+
151
+ Effect of Update Schedule and Frequency: In Figure 5-right, we evaluate the performance of our method on update intervals $\Delta T \in [ 5 0 , 1 0 0 , 5 0 0 , 1 0 0 0 ]$ and initial drop fractions $\alpha \in [ 0 . 1 , 0 . 3 , 0 . 5$ ]. The best accuracies are obtained when the mask is updated every 100 iterations with an initial drop fraction of 0.3 or 0.5. Notably, even with frequent update intervals (e.g. every 1000 iterations), RigL performs above $7 3 . 5 \%$ .
152
+
153
+ Effect of Dynamic connections: Frankle et al. (2019) and Mostafa & Wang (2019) observed that static sparse training converges to a solution with a higher loss than dynamic sparse training. In Figure 6-left we examine the loss landscape lying between a solution found via static sparse training and a solution found via pruning to understand whether former lies in a basin isolated from the latter. Performing a linear interpolation between the two reveals the expected result – high-loss barrier – demonstrating that the loss landscape is not trivially connected. However, this is only one of infinitely many paths between the two points optimization can be used to find parametric curves that connects solutions (Garipov et al., 2018; Draxler et al., 2018) subject to constraints. For example Garipov et al. (2018) showed different dense solutions lie in the same basin by finding 2nd order Bezier curves with low energy between the two solutions. Following their method, we attempt ´ to find quadratic and cubic Bezier curves between the two sparse solutions. Surprisingly, even with a ´ cubic curve, we fail to find a path without a high-loss barrier. These results suggest that static sparse training can get stuck at local minima that are isolated from improved solutions. On the other hand, when we optimize the quadratic Bezier curve across the full ´ dense space we find a near-monotonic path to the improved solution, suggesting that allowing new connections to grow lends dynamic sparse training greater flexibility in navigating the loss landscape.
154
+
155
+ ![](images/96e95693d928d87ad902426e986b917f4232a0de25740f3cd1cb80a5c1a6297c.jpg)
156
+ Figure 6: (left) Training loss evaluated at various points on interpolation curves between a magnitude pruning model (0.0) and a model trained with static sparsity (1.0). (right) Training loss of RigL and Static methods starting from the static sparse solution, and their final accuracies.
157
+
158
+ In Figure 6-right we train RigL starting from the sub-optimal solution found by static sparse training, demonstrating that it is able to escape the local minimum, whereas re-training with static sparse training cannot. RigL first removes connections with the smallest magnitudes since removing these connections have been shown to have a minimal effect on the loss (Han et al., 2015; Evci, 2018). Next, it activates connections with the high gradients, since these connections are expected to decrease the loss fastest. We hypothesize in Appendix A that RigL escapes bad critical points by replacing saddle directions with high gradient dimensions.
159
+
160
+ # 5 DISCUSSION & CONCLUSION
161
+
162
+ In this work we introduced ‘Rigged Lottery’ or RigL, an algorithm for training sparse neural networks efficiently. For a given computational budget RigL achieves higher accuracies than existing dense-to-sparse and sparse-to-sparse training algorithms. RigL is useful in three different scenarios: (1) To improve the accuracy of sparse models intended for deployment; (2) To improve the accuracy of large sparse models which can only be trained for a limited number of iterations; and (3) Combined with sparse primitives to enable training of extremely large sparse models which otherwise would not be possible.
163
+
164
+ The third scenario is unexplored due to the lack of hardware and software support for sparsity. Nonetheless, work continues to improve the performance of sparse networks on current hardware (Hong et al., 2019; Merrill & Garland, 2016), and new types of hardware accelerators will have better support for parameter sparsity (Wang et al., 2018; Mike Ashby, 2019; Liu et al., 2018; Han et al., 2016a; Chen et al., 2019). RigL provides the tools to take advantage of, and motivation for, such advances.
165
+
166
+ # REFERENCES
167
+
168
+ Mart´ın Abadi, Ashish Agarwal, Paul Barham, Eugene Brevdo, Zhifeng Chen, Craig Citro, Greg S. Corrado, Andy Davis, Jeffrey Dean, Matthieu Devin, Sanjay Ghemawat, Ian Goodfellow, Andrew Harp, Geoffrey Irving, Michael Isard, Yangqing Jia, Rafal Jozefowicz, Lukasz Kaiser, Manjunath Kudlur, Josh Levenberg, Dan Mane, Rajat Monga, Sherry Moore, Derek Murray, Chris Olah, ´ Mike Schuster, Jonathon Shlens, Benoit Steiner, Ilya Sutskever, Kunal Talwar, Paul Tucker, Vincent Vanhoucke, Vijay Vasudevan, Fernanda Viegas, Oriol Vinyals, Pete Warden, Martin Watten- ´ berg, Martin Wicke, Yuan Yu, and Xiaoqiang Zheng. TensorFlow: Large-scale machine learning on heterogeneous systems, 2015. URL http://tensorflow.org/.
169
+
170
+ Guillaume Bellec, David Kappel, Wolfgang Maass, and Robert A. Legenstein. Deep rewiring: Training very sparse deep networks. CoRR, abs/1711.05136, 2017. URL http://arxiv. org/abs/1711.05136.
171
+
172
+ Y. Chen, T. Yang, J. Emer, and V. Sze. Eyeriss v2: A flexible accelerator for emerging deep neural networks on mobile devices. IEEE Journal on Emerging and Selected Topics in Circuits and Systems, 9(2):292–308, June 2019. doi: 10.1109/JETCAS.2019.2910232.
173
+
174
+ Kyunghyun Cho, B van Merrienboer, Caglar Gulcehre, F Bougares, H Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. In Conference on Empirical Methods in Natural Language Processing (EMNLP 2014), 2014.
175
+
176
+ Diederik P. Kingma Christos Louizos, Max Welling. Learning sparse neural networks through $l _ { 0 }$ regularization. In International Conference on Learning Representations, 2018.
177
+
178
+ Tim Dettmers and Luke Zettlemoyer. Sparse networks from scratch: Faster training without losing performance. ArXiv, 2019. URL http://arxiv.org/abs/1907.04840.
179
+
180
+ Felix Draxler, Kambis Veschgini, Manfred Salmhofer, and Fred A Hamprecht. Essentially No Barriers in Neural Network Energy Landscape. In International Conference on Machine Learning, 2018.
181
+
182
+ Utku Evci. Detecting dead weights and units in neural networks. CoRR, 2018. URL http: //arxiv.org/abs/1806.06068.
183
+
184
+ Utku Evci, Fabian Pedregosa, Aidan N. Gomez, and Erich Elsen. The difficulty of training sparse neural networks. ArXiv, 2019. URL http://arxiv.org/abs/1906.10732.
185
+
186
+ Jonathan Frankle and Michael Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019, 2019. URL https://openreview.net/forum?id $=$ rJl-b3RcF7.
187
+
188
+ Jonathan Frankle, Gintare Karolina Dziugaite, Daniel M. Roy, and Michael Carbin. The lottery ticket hypothesis at scale. ArXiv, 2019. URL http://arxiv.org/abs/1903.01611.
189
+
190
+ Trevor Gale, Erich Elsen, and Sara Hooker. The state of sparsity in deep neural networks. CoRR, abs/1902.09574, 2019. URL http://arxiv.org/abs/1902.09574.
191
+
192
+ Timur Garipov, Pavel Izmailov, Dmitrii Podoprikhin, Dmitry P Vetrov, and Andrew Gordon Wilson. Loss surfaces, mode connectivity, and fast ensembling of dnns. In Advances in Neural Information Processing Systems, 2018.
193
+
194
+ J. S. Garofolo, L. F. Lamel, W. M. Fisher, J. G. Fiscus, D. S. Pallett, and N. L. Dahlgren. Darpa timit acoustic phonetic continuous speech corpus cdrom, 1993.
195
+
196
+ Yiwen Guo, Anbang Yao, and Yurong Chen. Dynamic network surgery for efficient DNNs. CoRR, abs/1608.04493, 2016. URL http://arxiv.org/abs/1608.04493.
197
+
198
+ Song Han, Jeff Pool, John Tran, and William Dally. Learning both weights and connections for efficient neural network. In Advances in neural information processing systems, 2015.
199
+
200
+ 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 Proceedings of the 43rd International Symposium on Computer Architecture, 2016a.
201
+
202
+ Song Han, Huizi Mao, and William J. Dally. Deep compression: Compressing deep neural network with pruning, trained quantization and huffman coding. In 4th International Conference on Learning Representations, ICLR 2016, San Juan, Puerto Rico, May 2-4, 2016, Conference Track Proceedings, 2016b. URL http://arxiv.org/abs/1510.00149.
203
+
204
+ B. Hassibi and D. Stork. Second order derivatives for network pruning: Optimal Brain Surgeon. 1993.
205
+
206
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the 2015 IEEE International Conference on Computer Vision (ICCV), 2015.
207
+
208
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural Comput., 9(8):1735– 1780, November 1997. ISSN 0899-7667. doi: 10.1162/neco.1997.9.8.1735. URL http://dx. doi.org/10.1162/neco.1997.9.8.1735.
209
+
210
+ Changwan Hong, Aravind Sukumaran-Rajam, Israt Nisa, Kunal Singh, and P. Sadayappan. Adaptive sparse tiling for sparse matrix multiplication. In Proceedings of the 24th Symposium on Principles and Practice of Parallel Programming, PPoPP ’19, pp. 300–314, New York, NY, USA, 2019. ACM. ISBN 978-1-4503-6225-2. doi: 10.1145/3293883.3295712. URL http://doi.acm. org/10.1145/3293883.3295712.
211
+
212
+ 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. CoRR, abs/1704.04861, 2017. URL http://arxiv.org/abs/ 1704.04861.
213
+
214
+ Nal Kalchbrenner, Erich Elsen, Karen Simonyan, Seb Noury, Norman Casagrande, Edward Lockhart, Florian Stimberg, Aaron Oord, Sander Dieleman, and Koray Kavukcuoglu. Efficient neural audio synthesis. In International Conference on Machine Learning (ICML), 2018.
215
+
216
+ Alex Krizhevsky, Vinod Nair, and Geoffrey Hinton. Cifar-10 (canadian institute for advanced research). URL http://www.cs.toronto.edu/˜kriz/cifar.html.
217
+
218
+ Yann LeCun, John S. Denker, and Sara A. Solla. Optimal Brain Damage. In Advances in Neural Information Processing Systems, 1990.
219
+
220
+ Namhoon Lee, Thalaiyasingam Ajanthan, and Philip H. S. Torr. SNIP: Single-shot Network Pruning based on Connection Sensitivity. In International Conference on Learning Representations (ICLR), 2019, 2019.
221
+
222
+ Hao Li, Asim Kadav, Igor Durdanovic, Hanan Samet, and Hans Peter Graf. Pruning filters for efficient convnets. In International Conference on Learning Representations, 2016.
223
+
224
+ Chen Liu, Guillaume Bellec, Bernhard Vogginger, David Kappel, Johannes Partzsch, Felix Neumaerker, Sebastian Hoppner, Wolfgang Maass, Stephen B. Furber, Robert A. Legenstein, and ¨ Christian Mayr. Memory-efficient deep learning on a spinnaker 2 prototype. In Front. Neurosci., 2018.
225
+
226
+ Christos Louizos, Karen Ullrich, and Max Welling. Bayesian compression for deep learning. In Advances in Neural Information Processing Systems, 2017.
227
+
228
+ Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. ArXiv, 2016. URL http://arxiv.org/abs/1609.07843.
229
+
230
+ Duane Merrill and Michael Garland. Merge-based sparse matrix-vector multiplication (spmv) using the csr storage format. In Proceedings of the 21st ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPoPP ’16, pp. 43:1–43:2, New York, NY, USA, 2016. ACM. ISBN 978-1-4503-4092-2. doi: 10.1145/2851141.2851190. URL http://doi.acm.org/ 10.1145/2851141.2851190.
231
+
232
+ Peter Baldwin Martijn Bastiaan Oliver Bunting Aiken Cairncross Christopher Chalmers Liz Corrigan Sam Davis Nathan van Doorn Jon Fowler Graham Hazel Basile Henry David Page Jonny Shipton Shaun Steenkamp Mike Ashby, Christiaan Baaij. Exploiting unstructured sparsity on next-generation datacenter hardware. 2019. URL https://myrtle.ai/wp-content/ uploads/2019/06/IEEEformatMyrtle.ai_.21.06.19_b.pdf.
233
+
234
+ Decebal Constantin Mocanu, Elena Mocanu, Peter Stone, Phuong H Nguyen, Madeleine Gibescu, and Antonio Liotta. Scalable training of artificial neural networks with adaptive sparse connectivity inspired by network science. Nature Communications, 2018.
235
+
236
+ Dmitry Molchanov, Arsenii Ashukha, and Dmitry P. Vetrov. Variational Dropout Sparsifies Deep Neural Networks. In Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017, pp. 2498–2507, 2017.
237
+
238
+ Pavlo Molchanov, Stephen Tyree, Tero Karras, Timo Aila, and Jan Kautz. Pruning Convolutional Neural Networks for Resource Efficient Transfer Learning. CoRR, abs/1611.06440, 2016.
239
+
240
+ Hesham Mostafa and Xin Wang. Parameter efficient training of deep convolutional neural networks by dynamic sparse reparameterization. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, pp. 4646–4655, 2019. URL http://proceedings.mlr.press/v97/mostafa19a.html.
241
+
242
+ Sharan Narang, Greg Diamos, Shubho Sengupta, and Erich Elsen. Exploring sparsity in recurrent neural networks. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings, 2017. URL https: //openreview.net/forum?id=BylSPv9gx.
243
+
244
+ Jongsoo Park, Sheng R. Li, Wei Wen, Hai Li, Yiran Chen, and Pradeep Dubey. Holistic SparseCNN: Forging the trident of accuracy, speed, and size. CoRR, abs/1608.01409, 2016. URL http: //arxiv.org/abs/1608.01409.
245
+
246
+ Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li FeiFei. Imagenet large scale visual recognition challenge. International Journal of Computer Vision (IJCV), 2015.
247
+
248
+ M. Sandler, A. Howard, M. Zhu, A. Zhmoginov, and L. Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4510–4520, June 2018. doi: 10.1109/CVPR.2018.00474.
249
+
250
+ S. Srinivas, A. Subramanya, and R. V. Babu. Training sparse neural networks. In 2017 IEEE Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), pp. 455–462, July 2017. doi: 10.1109/CVPRW.2017.61.
251
+
252
+ Nikko Strom. Sparse Connection and Pruning in Large Dynamic Artificial Neural Networks. In ¨ EUROSPEECH, 1997.
253
+
254
+ Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of IEEE Conference on Computer Vision and Pattern Recognition,, 2016. URL http://arxiv.org/abs/1512. 00567.
255
+
256
+ Enzo Tartaglione, Skjalg Lepsøy, Attilio Fiandrotti, and Gianluca Francini. Learning sparse neural networks via sensitivity-driven regularization. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, NIPS’18, pp. 3882–3892, USA, 2018. Curran Associates Inc. URL http://dl.acm.org/citation.cfm?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ 3327144.3327303.
257
+
258
+ Georg Thimm and Emile Fiesler. Evaluating pruning methods. In National Chiao-Tung University, pp. 2, 1995.
259
+
260
+ Peiqi Wang, Yu Ji, Chi Hong, Yongqiang Lyu, Dongsheng Wang, and Yuan Xie. Snrram: An efficient sparse neural network computation architecture based on resistive random-access memory. In Proceedings of the 55th Annual Design Automation Conference, DAC ’18, pp. 106:1–106:6, New York, NY, USA, 2018. ACM. ISBN 978-1-4503-5700-5. doi: 10.1145/3195970.3196116. URL http://doi.acm.org/10.1145/3195970.3196116.
261
+
262
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In BMVC, 2016.
263
+
264
+ Hattie Zhou, Janice Lan, Rosanne Liu, and Jason Yosinski. Deconstructing Lottery Tickets: Zeros, Signs, and the Supermask. ArXiv, 2019.
265
+
266
+ Michael Zhu and Suyog Gupta. To Prune, or Not to Prune: Exploring the Efficacy of Pruning for Model Compression. In International Conference on Learning Representations Workshop, 2018.
267
+
268
+ # A EFFECT OF MASK UPDATES ON THE ENERGY LANDSCAPE
269
+
270
+ To update the connectivity of our sparse network, we first need to drop a fraction $d$ of the existing connections for each layer independently to create a budget for growing new connections. Following the recipe of magnitude based pruning(Han et al., 2015), we order parameters at layer $i$ by magnitude $| \theta _ { i } |$ and drop the $N * ( 1 - S ) * d$ parameters with lowest magnitude. The effectiveness of this simple criteria can be explained through the first order Taylor approximation of the loss $L$ around the current set of parameters $\theta$ .
271
+
272
+ $$
273
+ \Delta L = L ( \theta + \Delta \theta ) - L ( \theta ) = \nabla _ { \theta } L ( \theta ) \Delta \theta + R ( | | \Delta \theta | | _ { 2 } ^ { 2 } )
274
+ $$
275
+
276
+ The main goal of dropping connections is to remove parameters with minimal impact on the neural network and therefore on its performance. Since removing the connection $\theta _ { i }$ corresponds to setting it to zero, it incurs a change of $\Delta \theta ~ = ~ - \theta _ { i }$ in that direction and a change of $\begin{array} { r l } { \Delta L _ { i } } & { { } = } \end{array}$ $- \nabla _ { \boldsymbol { \theta } _ { i } } \mathbf { \bar { L } } ( \boldsymbol { \theta } ) \boldsymbol { \theta } _ { i } + R ( \boldsymbol { \theta } _ { i } ^ { 2 } )$ in the loss, where the first term is usually defined as the saliency of a connection. Though using saliency to remove connections has been used as a criteria for removing connections (Molchanov et al., 2016), it has been shown to produce inferior results compared to magnitude based removal, especially when used to remove multiple connections at once (Evci, 2018). In contrast, picking the lowest magnitude connections ensures a small remainder term in addition to a low saliency, limiting the damage we make when we drop connections. Additionally, we note that connections with small magnitude can only remain small if the gradient is also small, meaning that the saliency is likely small when the parameter itself is small. Therefore we argue that the connections removed by RigL are likely to be saddle directions of the energy landscape.
277
+
278
+ After the removal of insignificant connections, we enable new connections that have the highest expected gradients. Since we initialize these new connections to zero, they are guaranteed to have high gradients in the proceeding iteration and therefore to reduce the loss quickly. By definition a direction with high magnitude gradient is not a saddle direction. Combining this observation with the previous ( $R i g L$ is likely to remove saddle directions) and the results in Section 4.4 we suggest that RigL improves the energy landscape of the optimization by replacing saddle directions with the ones with high gradient. This helps the optimization procedure to escape bad critical points and find solutions with higher quality.
279
+
280
+ # B EFFECT OF SPARSITY DISTRIBUTION ON OTHER METHODS
281
+
282
+ In Figure 7-left we show the effect of sparsity distribution choice on 4 different sparse training methods. ERK distribution performs better than other distributions for each training method.
283
+
284
+ # C EFFECT OF MOMENTUM COEFFICIENT FOR SNFS
285
+
286
+ In Figure 7 right we show the effect of the momentum coefficient on the performance of SNFS. Our results shows that using a coefficient of 0.99 brings the best performance. On the other hand using the most recent gradient only (coefficient of 0) performs as good as using a coefficient of 0.9. This result might be due to the large batch size we are using (4096), but it still motivates using RigL and instantaneous gradient information only when needed, instead of accumulating them.
287
+
288
+ # D EXISTENCE OF LOTTERY TICKETS
289
+
290
+ We perform the following experiment to see whether Lottery Tickets exist in our setting. We take the sparse network found by RigL and restart training using original initialization, both with RigL and with fixed topology as in the original Lottery Ticket Hypothesis. Results in table 3 demonstrate that training with a fixed topology is significantly worse than training with RigL and that RigL does not benefit from starting again with the final topology and the original initialization - training for twice as long instead of rewiring is more effective. In short, there are no special tickets, with RigL all tickets seems to win.
291
+
292
+ ![](images/f433bd443059bd764822e9e7a3060af7bbc37812c757ca9ad010a470abc0a839.jpg)
293
+ Figure 7: (left) Effect of sparsity distribution choice on sparse training methods at different sparsity levels. We average over 3 runs and report the standard deviations for each. (right) Effect of momentum value on the performance of SNFS algorithm. Setting the momentum coefficient of the SNFS algorithm to 0 seems to perform best, suggesting the accumulated values are not important.
294
+
295
+ Table 3: Effect of lottery ticket initialization on the final performance. There are no special tickets and dynamic connectivity provided by RigL is critical for good performance.
296
+
297
+ <table><tr><td>Initialization</td><td>Training Method</td><td>Test Accuracy</td><td>Training FLOPs</td></tr><tr><td>Lottery</td><td>Static</td><td>70.82±0.07</td><td>0.46x</td></tr><tr><td>Lottery</td><td>RigL</td><td>73.93±0.09</td><td>0.46x</td></tr><tr><td>Random</td><td>RigL</td><td>74.55±0.06</td><td>0.23x</td></tr><tr><td>Random</td><td>RigL2x</td><td>76.06±0.09</td><td>0.46x</td></tr></table>
298
+
299
+ # E EFFECT OF UPDATE SCHEDULES ON OTHER DYNAMIC SPARSE METHODS
300
+
301
+ In Figure 8 we repeat the hyper-parameter sweep done for RigL in Figure 5-right, using SET and SNFS. Cosine schedule with $\Delta T = 5 0$ and $\alpha = 0 . 1$ seems to work best across all methods. An interesting observation is that higher drop fractions $( \alpha )$ seem to work better with longer intervals $\Delta T$ . For example, SET with $\Delta T = 1 0 0 0$ seems to work best with $\alpha = 0 . 5$ .
302
+
303
+ # F ALTERNATIVE UPDATE SCHEDULES
304
+
305
+ In Figure 9, we share the performance of two alternative annealing functions:
306
+
307
+ 1. Constant: $f _ { d e c a y } ( t ) = \alpha$ .
308
+ 2. Inverse Power: The fraction of weights updated decreases similarly to the schedule used in Zhu & Gupta (2018) for iterative pruning: $\begin{array} { r } { f _ { d e c a y } ( t ) = \alpha ( 1 - \frac { t } { T _ { e n d } } ) ^ { k } } \end{array}$ )k. In our experiments we tried $k = 1$ which is the linear decay and their default $k = 3$ .
309
+
310
+ Constant seems to perform well with low initial drop fractions like $\alpha = 0 . 1$ , but it starts to perform worse with increasing $\alpha$ . Inverse Power for ${ \bf k } = 3$ and ${ \mathrm { k } } { = } 1$ (Linear) seems to perform similarly for low $\alpha$ values. However the performance drops noticeably for ${ \bf k } = 3$ when we increase the update interval. As reported by Dettmers & Zettlemoyer (2019) linear $( \mathrm { k } { = } 1$ ) seems to provide similar results as the cosine schedule.
311
+
312
+ # G CALCULATING FLOPS OF MODELS AND METHODS
313
+
314
+ In order to calculate FLOPs needed for a single forward pass of a sparse model, we count the total number of multiplications and additions layer by layer for a given layer sparsity $s ^ { l }$ . The total FLOPs is then obtained by summing up all of these multiply and adds.
315
+
316
+ Different sparsity distributions require different number of FLOPs to compute a single prediction. For example Erdos-Renyi-Kernel ˝ distributions usually cause earlier layers to be less sparse than the later layers (see Appendix I). The inputs of earlier layers have greater spatial dimensions, so a convolutional kernel that works on such inputs will require more FLOPs to compute the output features compared to later layers. Thus, having earlier layers which are less sparse results in a higher total number of FLOPs required by a model.
317
+
318
+ ![](images/b3e467a52c2f5b11283887318ea99ba50224d604ca1a45394151b61438546ee9.jpg)
319
+ Figure 8: Cosine update schedule hyper-parameter sweep done using dynamic sparse training methods SET (left) and SNFS (right).
320
+
321
+ Training a neural network consists of 2 main steps:
322
+
323
+ 1. forward pass: Calculating the loss of the current set of parameters on a given batch of data. During this process layer activations are calculated in sequence using the previous activations and the parameters of the layer. Activation of layers are stored in memory for the backward pass.
324
+ 2. backward pass: Using the loss value as the initial error signal, we back-propagate the error signal while calculating the gradient of parameters. During the backward pass each layer calculates 2 quantities: the gradient of the activations of the previous layer and the gradient of its parameters. Therefore in our calculations we count backward passes as two times the computational expense of the forward pass. We omit the FLOPs needed for batch normalization and cross entropy.
325
+
326
+ Dynamic sparse training methods require some extra FLOPs to update the connectivity of the neural network. We omit FLOPs needed for dropping the lowest magnitude connections in our calculations. For a given dense architecture with FLOPs $f _ { D }$ and a sparse version with FLOPs $f _ { S }$ , the total FLOPs required to calculate the gradient on a single sample is computed as follows:
327
+
328
+ • Static Sparse and Dense. Scales with $3 * f _ { S }$ and $3 * f _ { D }$ FLOPs, respectively.
329
+ • Snip. We omit the initial dense gradient calculation since it is negligible, which means Snip scales in the same way as Static methods: $3 * f _ { S }$ FLOPs.
330
+ • SET. We omit the extra FLOPs needed for growing random connections, since this operation can be done on chip efficiently. Therefore, the total FLOPs for SET scales with $3 * f _ { S }$ . SNFS. Forward pass and back-propagating the error signal needs $2 * f _ { S }$ FLOPs. However, the dense gradient needs to be calculated at every iteration. Thus, the total number of FLOPs scales with $2 * f _ { S } + f _ { D }$ . RigL. Iterations with no connection updates need $3 * f _ { S }$ FLOPs. However, at every $\Delta T$ iteration we need to calculate the dense gradients. This results in the average FLOPs for RigL given by $\frac { ( 3 * f _ { S } * \Delta T + 2 * f _ { S } + f _ { D } ) } { ( \Delta T + 1 ) }$ .
331
+
332
+ # H ADDITIONAL PLOTS AND EXPERIMENTS FOR CIFAR-10
333
+
334
+ In Figure 10-left, we plot the final training loss of experiments presented in Section 4.3 to investigate the generalization properties of the algorithms considered. Poor performance of Static reflects itself in training loss clearly across all sparsity levels. RigL achieves similar final loss as the pruning, despite having around half percent less accuracy. Training longer with RigL decreases the final loss further and the test accuracies start matching pruning (see Figure 4-right) performance. These results show that RigL improves the optimization as promised, however generalizes slightly worse than pruning.
335
+
336
+ ![](images/bf63372d44ae944bab2fb94af7feac16fac25a9bc8f8d3818b33dd4260972182.jpg)
337
+ Figure 9: Using other update schedules with RigL: (left) Constant (middle) Exponential $\left( \mathrm { k } \mathrm { = } 3 \right)$ and (right) Linear
338
+
339
+ ![](images/e207781847e04baa8da603b4cc537a5073cb27d1d766bb864de9512780d702bc.jpg)
340
+ Figure 10: Final training loss of sparse models (left) and performance of $R i g L$ at different mask update intervals (right).
341
+
342
+ In Figure 10-right, we sweep mask update interval $\Delta T$ and plot the final test accuracies. We fix initial drop fraction $\alpha$ to 0.3 and evaluate two different sparsity distributions: Uniform and $E R K$ . Both curves follow a similar pattern as in Imagenet-2012 sweeps (see Figure 8) and best results are obtained when $\Delta T = 1 0 0$ .
343
+
344
+ # I SPARSITY OF INDIVIDUAL LAYERS FOR SPARSE RESNET-50
345
+
346
+ Sparsity of ResNet-50 layers given by the Erdos-R ˝ enyi-Kernel sparsity distribution plotted in Figure ´ 11.
347
+
348
+ # J BUGS DISCOVERED DURING EXPERIMENTS
349
+
350
+ Our initial implementations contained some subtle bugs, which while not affecting the general conclusion that RigL is more effective than other techniques, did result in lower accuracy for all sparse training techniques. We detail these issues here with the hope that others may learn from our mistakes.
351
+
352
+ 1. Random operations on multiple replicas. We use data parallelism to split a mini-batch among multiple replicas. Each replica independently calculates the gradients using a different sub-mini-batch of data. The gradients are aggregated using an ALL-REDUCE operation before the optimizer update. Our implementation of SET, SNFS and RigL depended on each replica independently choosing to drop and grow the same connections. However, due to the nature of random operations in Tensorflow, this did not happen. Instead, different replicas diverged after the first drop/grow step. This was most pronounced in SET where each replica chose at random and much less so for SNFS and RigL where randomness is only needed to break ties. If left unchecked this might be expected to be catastrophic, but due to the behavior of Estimators and/or TF-replicator, the values on the first replica are broadcast to the others periodically (every approximately 1000 steps in our case).
353
+
354
+ We fixed this bug by using stateless random operations. As a result the performance of SET improved slightly $0 . 1 \%$ higher on Table 2).
355
+
356
+ 2. Synchronization between replicas. RigL and SNFS depend on calculating dense gradients with respect to the masked parameters. However, as explained above, in the multiple replica setting these gradients need to be aggregated. Normally this aggregation is automatically done by the optimizer, but in our case, this does not happen (only the gradients with respect to the unmasked parameters are aggregated automatically). This bug affected SNFS and RigL, but not SET since SET does not rely on the gradients to grow connections. Again, the synchronization of the parameters from the first replica every approximately 1000 steps masked this bug.
357
+
358
+ We fixed this bug by explicitly calling ALL-REDUCE on the gradients with respect to the masked parameters. With this fix, the performance of RigL and SNFS improved significantly, particularly for default training lengths (around $0 . 5 – 1 \%$ improvement).
359
+
360
+ ![](images/0b1f9b452aac571c6f076bd13ec4d1e1e1f13be162984229dcfda1d2c8d58426.jpg)
361
+ Figure 11: Sparsities of individual layers of the ResNet-50.
362
+
363
+ 3. SNIP Experiments. Our first implementation of SNIP used the gradient magnitudes to decide which connections to keep causing its performance to be worse than static. Upon our discussions with the authors of SNIP, we realized that the correct metric is the saliency (gradient times parameter magnitude). With this correction SNIP performance improved dramatically to better than random (Static) even at Resnet-50/ImageNet scale. It is surprising that picking connections with the highest gradient magnitudes can be so detrimental to training (it resulted in much worse than random performance).
md/train/uVPZCMVtsSG/uVPZCMVtsSG.md ADDED
Binary file (64.6 kB). View file
 
md/train/ueGDv64HmO/ueGDv64HmO.md ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Exploiting the Intrinsic Neighborhood Structure for Source-free Domain Adaptation
2
+
3
+ Shiqi Yang1, Yaxing Wang1,2∗, Joost van de Weijer1, Luis Herranz1, Shangling Jui3 1 Computer Vision Center, Universitat Autonoma de Barcelona, Barcelona, Spain 2 PCALab, Nanjing University of Science and Technology, China 3 Huawei Kirin Solution, Shanghai, China
4
+ {syang,yaxing,joost,lherranz}@cvc.uab.es, jui.shangling@huawei.com
5
+
6
+ # Abstract
7
+
8
+ Domain adaptation (DA) aims to alleviate the domain shift between source domain and target domain. Most DA methods require access to the source data, but often that is not possible (e.g. due to data privacy or intellectual property). In this paper, we address the challenging source-free domain adaptation (SFDA) problem, where the source pretrained model is adapted to the target domain in the absence of source data. Our method is based on the observation that target data, which might no longer align with the source domain classifier, still forms clear clusters. We capture this intrinsic structure by defining local affinity of the target data, and encourage label consistency among data with high local affinity. We observe that higher affinity should be assigned to reciprocal neighbors, and propose a self regularization loss to decrease the negative impact of noisy neighbors. Furthermore, to aggregate information with more context, we consider expanded neighborhoods with small affinity values. In the experimental results we verify that the inherent structure of the target features is an important source of information for domain adaptation. We demonstrate that this local structure can be efficiently captured by considering the local neighbors, the reciprocal neighbors, and the expanded neighborhood. Finally, we achieve state-of-the-art performance on several 2D image and 3D point cloud recognition datasets. Code is available in https://github.com/Albert0147/SFDA_neighbors.
9
+
10
+ # 1 Introduction
11
+
12
+ Most deep learning methods rely on training on large amount of labeled data, while they cannot generalize well to a related yet different domain. One research direction to address this issue is Domain Adaptation (DA), which aims to transfer learned knowledge from a source to a target domain. Most existing DA methods demand labeled source data during the adaptation period, however, it is often not practical that source data are always accessible, such as when applied on data with privacy or property restrictions. Therefore, recently, there have emerged a few works [16, 17, 20, 21] tackling a new challenging DA scenario where instead of source data only the source pretrained model is available for adapting, i.e., source-free domain adaptation (SFDA). Among these methods, USFDA [16] addresses universal DA [57] and SF [17] addresses open-set DA [36]. In both universal and open-set DA the label set is different for source and target domains. SHOT [21] and 3C-GAN [20] are for closed-set DA where source and target domains have the same categories. 3C-GAN [20] is based on target-style image generation with a conditional GAN, and SHOT [21] is based on mutual information maximization and pseudo labeling. Finally, BAIT [56] extends MCD [35] to the SFDA setting. However, these methods ignore the intrinsic neighborhood structure of the target data in feature space which can be very valuable to tackle SFDA.
13
+
14
+ ![](images/343b4b429f7a34d25d762b61bf6977f13ba8eaac4be276860b5d2170fa2f18be.jpg)
15
+ Figure 1: (a) t-SNE visualization of target features by source model. (b) Ratio of different type of nearest neighbor features of which: the predicted label is the same as the feature, K is the number of nearest neighbors. The features in (a) and (b) are on task $\mathrm { A r } { } \mathrm { R w }$ of Office-Home. (c) Illustration of our method. In the left shows we distinguish reciprocal and non-reciprocal neighbors. The adaptation is achieved by pushed the features towards reciprocal neighbors heavily.
16
+
17
+ In this paper, we focus on closed-set source-free domain adaptation. Our main observation is that current DA methods do not exploit the intrinsic neighborhood structure of the target data. We use this term to refer to the fact that, even though the target data might have shifted in the feature space (due to the covariance shift), target data of the same class is still expected to form a cluster in the embedding space. This can be implied to some degree from the t-SNE visualization of target features on the source model which suggests that significant cluster structure is preserved (see Fig. 1 (a)). This assumption is implicitly adopted by most DA methods, as instantiated by a recent DA work [42]. A well-established way to assess the structure of points in high-dimensional spaces is by considering the nearest neighbors of points, which are expected to belong to the same class. However, this assumption is not true for all points; the blue curve in Figure 1(b) shows that around $7 5 \%$ of the nearest neighbors has the correct label. In this paper, we observe that this problem can be mitigated by considering reciprocal nearest neighbors (RNN); the reciprocal neighbors of a point have the point as their neighbor. Reciprocal neighbors have been studied before in different contexts [14, 31, 60]. The reason why reciprocal neighbors are more trustworthy is illustrated in Fig. 1(c). Fig. 1(b) shows the ratio of neighbors which have the correct prediction for different kinds of nearest neighbors. The curves show that reciprocal neighbors indeed have more chances to predict the true label than non-reciprocal nearest neighbors (nRNN).
18
+
19
+ The above observation and analysis motivate us to assign different weights to the supervision from nearest neighbors. Our method, called Neighborhood Reciprocity Clustering (NRC), achieves sourcefree domain adaptation by encouraging reciprocal neighbors to concord in their label prediction. In addition, we will also consider a weaker connection to the non-reciprocal neighbors. We define affinity values to describe the degree of connectivity between each data point and its neighbors, which is also utilized to encourage class-consistency between neighbors, and we propose to use a self-regularization to decrease the negative impact of potential noisy neighbors. Furthermore, inspired by recent graph based methods [1, 3, 61] which show that the higher order neighbors can provide relevant context, and also considering neighbors of neighbors is more likely to provide datapoints that are close on the data manifold [43]. Thus, to aggregate wider local information, we further retrieve the expanded neighbors, i.e, neighbor of the nearest neighbors, for auxiliary supervision.
20
+
21
+ Our contributions can be summarized as follows, to achieve source-free domain adaptation: (i) we explicitly exploit the fact that same-class data forms cluster in the target embedding space, we do this by considering the predictions of neighbors and reciprocal neighbors, (ii) we further show that considering an extended neighborhood of data points further improves results (iii) the experiments results on three 2D image datasets and one 3D point cloud dataset show that our method achieves state-of-the-art performance compared with related methods.
22
+
23
+ # 2 Related Work
24
+
25
+ Domain Adaptation. Most DA methods tackle domain shift by aligning the feature distributions. Early DA methods such as [23, 41, 45] adopt moment matching to align feature distributions. And in recent years, plenty of works have emerged that achieve alignment by adversarial training. DANN [7] formulates domain adaptation as an adversarial two-player game. The adversarial training of CDAN [24] is conditioned on several sources of information. DIRT-T [40] performs domain adversarial training with an added term that penalizes violations of the cluster assumption. Additionally, [18, 26, 35] adopts prediction diversity between multiple learnable classifiers to achieve local or category-level feature alignment between source and target domains. AFN [52] shows that the erratic discrimination of target features stems from much smaller norms than those found in the source features. SRDC [42] proposes to directly uncover the intrinsic target discrimination via discriminative clustering to achieve adaptation. More related, [27] resorts to K-means clustering for open-set adaptation while considering global structure. Our method instead only focuses on nearest neighbors (local structure) for source-free adaptation.
26
+
27
+ Source-free Domain Adaptation. Source-present methods need supervision from the source domain during adaptation. Recently, there are several methods investigating source-free domain adaptation. USFDA [16] and FS [17] explore source-free universal DA [57] and open-set DA [36], and they propose to synthesize extra training samples to make the decision boundary compact, thereby allowing to recognise the open classes. For closed-set DA setting. SHOT [21] proposes to fix the source classifier and match the target features to the fixed classifier by maximizing mutual information and a proposed pseudo label strategy which considers global structure. 3C-GAN [20] synthesizes labeled target-style training images based on the conditional GAN to provide supervision for adaptation. Finally, SFDA [22] is for segmentation based on synthesizing fake source samples.
28
+
29
+ Graph Clustering. Our method shares some similarities with graph clustering work such as [38, 48, 54, 55] by utilizing neighborhood information. However, our methods are fundamentally different. Unlike those works which require labeled data to train the graph network for estimating the affinity, we instead adopt reciprocity to assign affinity.
30
+
31
+ # 3 Method
32
+
33
+ Notation. We denote the labeled source domain data with $n _ { s }$ samples as $\mathcal { D } _ { s } = \{ ( x _ { i } ^ { s } , y _ { i } ^ { s } ) \} _ { i = 1 } ^ { n _ { s } }$ , where $y _ { i } ^ { s }$ orresponding label of . Both domains have t $x _ { i } ^ { s }$ , andsame e unlabeled target domain data with classes (closed-set setting). Under the $n _ { t }$ samples asFDA setting $\mathcal { D } _ { t } \overset { \vartriangle } { = } \{ x _ { j } ^ { t } \} _ { j = 1 } ^ { n _ { t } }$ $C$ $\mathcal { D } _ { s }$ is only available for model pretraining. Our method is based on a neural network, which we split into two parts: a feature extractor $f$ , and a classifier $g$ . The feature output by the feature extractor is denoted as $z ( x ) = f \left( x \right)$ , the output of network is denoted as $p ( x ) = \bar { \delta } ( g ( \dot { z } ) ) \in \mathcal { R } ^ { C }$ where $\delta$ is the softmax function, for readability we will abandon the input and use $z , p$ in the following sections.
34
+
35
+ Overview. We assume that the source pretrained model has already been trained. As discusses in the introduction, the target features output by the source model form clusters. We exploit this intrinsic structure of the target data for SFDA by considering the neighborhood information, and the adaptation is achieved with the following objective:
36
+
37
+ $$
38
+ \mathcal { L } = - \frac { 1 } { n _ { t } } \sum _ { x _ { i } \in \mathcal { D } _ { t } } \sum _ { x _ { j } \in \mathrm { N e i g h } ( x _ { i } ) } \frac { D _ { s i m } ( p _ { i } , p _ { j } ) } { D _ { d i s } ( x _ { i } , x _ { j } ) }
39
+ $$
40
+
41
+ where the $\mathrm { { N e i g h } } ( x _ { i } )$ means the nearest neighbors of $x _ { i }$ , $D _ { s i m }$ computes the similarity between predictions, and $D _ { d i s }$ is a constant measuring the semantic distance (dissimilarity) between data. The principle behind the objective is to push the data towards their semantically close neighbors by encouraging similar predictions. In the next sections, we will define $D _ { s i m }$ and $D _ { d i s }$ .
42
+
43
+ # 3.1 Encouraging Class-Consistency with Neighborhood Affinity
44
+
45
+ To achieve adaptation without source data, we use the prediction of the nearest neighbor to encourage prediction consistency. While the target features from the source model are not necessarily totally intrinsic discriminative, meaning some neighbors belong to different class and will provide the wrong supervision. To decrease the potentially negative impact of those neighbors, we propose to weigh the supervision from neighbors according to the connectivity (semantic similarity). We define affinity values to signify the connectivity between the neighbor and the feature, which corresponds to the $\frac { 1 } { D _ { d i s } }$ in Eq. 1 indicating the semantic similarity.
46
+
47
+ To retrieve the nearest neighbors for batch training, similar to [33, 50, 62], we build two memory banks: $\mathcal { F }$ stores all target features, and $s$ stores corresponding prediction scores:
48
+
49
+ $$
50
+ \mathcal { F } = [ z _ { 1 } , z _ { 2 } , \dotsc , z _ { n _ { t } } ] \mathrm { a n d } \ S = [ p _ { 1 } , p _ { 2 } , \dotsc , p _ { n _ { t } } ]
51
+ $$
52
+
53
+ We use the cosine similarity for nearest neighbors retrieving. The difference between ours and [33, 50] lies in the fact that we utilize the memory bank to retrieve nearest neighbors while [33, 50] adopts the memory bank to compute the instance discrimination loss. Before every mini-batch training, we simply update the old items in the memory banks corresponding to current mini-batch. Note that updating the memory bank is only done to replace the old low-dimension vectors with new ones computed by the model, and does not require any additional computation.
54
+
55
+ We then use the prediction of the neighbors to supervise the training weighted by the affinity values, with the following objective adapted from Eq. 1:
56
+
57
+ $$
58
+ \mathcal { L } _ { \mathcal { N } } = - \frac { 1 } { n _ { t } } \sum _ { i } \sum _ { k \in \mathcal { N } _ { K } ^ { i } } A _ { i k } \boldsymbol { S } _ { k } ^ { \top } \boldsymbol { p } _ { i }
59
+ $$
60
+
61
+ where we use the dot product to compute the similarity between predictions, corresponding to $D _ { s i m }$ in Eq.1, the $k$ is the index of the $k$ -th nearest neighbors of $z _ { i }$ , $\scriptstyle { S _ { k } }$ is the $k$ -th item in memory bank $s$ , $A _ { i k }$ is the affinity value of $k$ -th nearest neighbors of feature $z _ { i }$ . Here the $\mathcal { N } _ { K } ^ { i }$ is the index $\mathrm { { \dot { s e t } } } ^ { 2 }$ of the $K$ -nearest neighbors of feature $z _ { i }$ . Note that all neighbors are retrieved from the feature bank $\mathcal { F }$ . With the affinity value as weight, this objective pushes the features to their neighbors with strong connectivity and to a lesser degree to those with weak connectivity.
62
+
63
+ To assign larger affinity values to semantic similar neighbors, we divide the nearest neighbors retrieved into two groups: reciprocal nearest neighbors (RNN) and non-reciprocal nearest neighbors (nRNN). The feature $z _ { j }$ is regarded as the RNN of the feature $z _ { i }$ if it meets the following condition:
64
+
65
+ $$
66
+ j \in \mathcal { N } _ { K } ^ { i } \wedge i \in \mathcal { N } _ { M } ^ { j }
67
+ $$
68
+
69
+ Other neighbors which do not meet the above condition are nRNN. Note that the normal definition of reciprocal nearest neighbors [31] applies $K = M$ , while in this paper $K$ and $M$ can be different. We find that reciprocal neighbors have a higher potential to belong to the same cluster as the feature (Fig. 1(b)). Thus, we assign a high affinity value to the RNN features. Specifically for feature $z _ { i }$ , the affinity value of its $j$ -th $\mathrm { K }$ -nearest neighbor is defined as:
70
+
71
+ $$
72
+ A _ { i , j } = { \left\{ \begin{array} { l l } { 1 } & { { \mathrm { i f ~ } } j \in { \mathcal { N } } _ { K } ^ { i } \land i \in { \mathcal { N } } _ { M } ^ { j } } \\ { r } & { { \mathrm { o t h e r w i s e . } } } \end{array} \right. }
73
+ $$
74
+
75
+ where $r$ is a hyperparameter. If not specified $r$ is set to 0.1.
76
+
77
+ To further reduce the potential impact of noisy neighbors in $\mathcal { N } _ { K }$ , which belong to the different class but still are RNN, we propose a simply yet effective way dubbed self-regularization, that is, to not ignore the current prediction of ego feature:
78
+
79
+ $$
80
+ \mathcal { L } _ { s e l f } = - \frac { 1 } { n _ { t } } \sum _ { i } ^ { n _ { t } } S _ { i } ^ { \top } p _ { i }
81
+ $$
82
+
83
+ where $s _ { i }$ means the stored prediction in the memory bank, note this term is a constant vector and is identical to the $p _ { i }$ since we update the memory banks before the training, here the loss is only back-propagated for variable $p _ { i }$ .
84
+
85
+ Require: $\mathcal { D } _ { s }$ (only for source model training), $\mathcal { D } _ { t }$
86
+
87
+ 1: Pre-train model on $\mathcal { D } _ { s }$
88
+ 2: Build feature bank $\mathcal { F }$ and score bank $s$ for $\mathcal { D } _ { t }$
89
+ 3: while Adaptation do
90
+ 4: Sample batch $\tau$ from $\mathcal { D } _ { t }$
91
+ 5: Update $\mathcal { F }$ and $s$ corresponding to current batch $\tau$
92
+ 6: Retrieve nearest neighbors $\mathcal { N }$ for each of $\tau$
93
+ 7: Compute affinity value $A$
94
+ 8: Retrieve expanded neighborhoods $E$ for each of $\mathcal { N }$
95
+ 9: Compute loss and update the model
96
+ 10: end while
97
+
98
+ . Eq.5 . Eq. 9
99
+
100
+ To avoid the degenerated solution [8, 39] where the model predicts all data as some specific classes (and does not predict other classes for any of the target data), we encourage the prediction to be balanced. We adopt the prediction diversity loss which is widely used in clustering [8, 9, 13] and also in several domain adaptation works [21, 39, 42]:
101
+
102
+ $$
103
+ \mathcal { L } _ { d i v } = \sum _ { c = 1 } ^ { C } \mathrm { K L } ( \bar { p } _ { c } | | q _ { c } ) , \mathrm { w i t h } \bar { p } _ { c } = \frac { 1 } { n _ { t } } \sum _ { i } p _ { i } ^ { ( c ) } , \mathrm { a n d } q _ { \{ c = 1 , . . , C \} } = \frac { 1 } { C }
104
+ $$
105
+
106
+ where the $p _ { i } ^ { ( c ) }$ is the score of the $c$ -th class and $\bar { p } _ { c }$ is the empirical label distribution, it represents the predicted possibility of class $c$ and q is a uniform distribution.
107
+
108
+ # 3.2 Expanded Neighborhood Affinity
109
+
110
+ As mentioned in Sec. 1, a simple way to achieve the aggregation of more information is by considering more nearest neighbors. However, a drawback is that larger neighborhoods are expected to contain more datapoint from multiple classes, defying the purpose of class consistency. A better way to include more target features is by considering the $M$ -nearest neighbor of each neighbor in $\mathcal { N } _ { K }$ of $z _ { i }$ in Eq. 4, i.e., the expanded neighbors. These target features are expected to be closer on the target data manifold than the features that are included by considering a larger number of nearest neighbors [43]. The expanded neighbors of feature $z _ { i }$ are defined as $\bar { E _ { M } } ( z _ { i } ) \bar { = } \mathcal { N } _ { M } ( z _ { j } ) \forall j \in \mathcal { N } _ { K } ( z _ { i } \bar { ) }$ , note that $E _ { M } ( z _ { i } )$ is still an index set and $i$ (ego feature) $\not \in E _ { M } ( z _ { i } )$ . We directly assign a small affinity value $r$ to those expanded neighbors, since they are further than nearest neighbors and may contain noise. We utilize the prediction of those expanded neighborhoods for training:
111
+
112
+ $$
113
+ \mathcal { L } _ { E } = - \frac { 1 } { n _ { t } } \sum _ { i } \sum _ { k \in \mathcal { N } _ { K } ^ { i } } \sum _ { m \in E _ { M } ^ { k } } r \mathcal { S } _ { m } ^ { \top } p _ { i }
114
+ $$
115
+
116
+ where $E _ { M } ^ { k }$ contain the $M$ -nearest neighbors of neighbor $k$ in $\mathcal { N } _ { K }$
117
+
118
+ Although the affinity values of all expanded neighbors are the same, it does not necessarily mean that they have equal importance. Taking a closer look at the expanded neighbors $E _ { M } ( z _ { i } )$ , some neighbors will show up more than once, for example $z _ { m }$ can be the nearest neighbor of both $z _ { h }$ and $z _ { j }$ where $h , j \in \mathcal N _ { K } ( \bar { z } _ { i } )$ , and the nearest neighbors can also serve as expanded neighbor. It implies that those neighbors form compact cluster, and we posit that those duplicated expanded neighbors have potential to be semantically closer to the ego-feature $z _ { i }$ . Thus, we do not remove duplicated features in $E _ { M } ( z _ { i } )$ , as those can lead to actually larger affinity value for those expanded neighbors. This is one advantage of utilizing expanded neighbors instead of more nearest neighbors, we will verify the importance of maintaining the duplicated features in the experimental section.
119
+
120
+ Final objective. Our method, called Neighborhood Reciprocity Clustering (NRC), is illustrated in Algorithm. 1. The final objective for adaptation is:
121
+
122
+ $$
123
+ \mathcal { L } = \mathcal { L } _ { d i v } + \mathcal { L } _ { \mathcal { N } } + \mathcal { L } _ { E } + \mathcal { L } _ { s e l f } .
124
+ $$
125
+
126
+ # 4 Experiments
127
+
128
+ Datasets. We use three 2D image benchmark datasets and a 3D point cloud recognition dataset.
129
+ Office-31 [32] contains 3 domains (Amazon, Webcam, DSLR) with 31 classes and 4,652 images.
130
+
131
+ Table 1: Accuracies $( \% )$ on Office-31 for ResNet50-based methods.
132
+
133
+ <table><tr><td>Method</td><td>SF</td><td>A→D</td><td>A→W</td><td>D→W</td><td>W→D</td><td>D→A</td><td>W→A</td><td>Avg</td></tr><tr><td>MCD [35]</td><td>X</td><td>92.2</td><td>88.6</td><td>98.5</td><td>100.0</td><td>69.5</td><td>69.7</td><td>86.5</td></tr><tr><td>CDAN [24]</td><td>X</td><td>92.9</td><td>94.1</td><td>98.6</td><td>100.0</td><td>71.0</td><td>69.3</td><td>87.7</td></tr><tr><td>MDD [59]</td><td>X</td><td>90.4</td><td>90.4</td><td>98.7</td><td>99.9</td><td>75.0</td><td>73.7</td><td>88.0</td></tr><tr><td>BNM[4]</td><td>X</td><td>90.3</td><td>91.5</td><td>98.5</td><td>100.0</td><td>70.9</td><td>71.6</td><td>87.1</td></tr><tr><td>DMRL [49]</td><td>X</td><td>93.4</td><td>90.8</td><td>99.0</td><td>100.0</td><td>73.0</td><td>71.2</td><td>87.9</td></tr><tr><td>BDG[53]</td><td>X</td><td>93.6</td><td>93.6</td><td>99.0</td><td>100.0</td><td>73.2</td><td>72.0</td><td>88.5</td></tr><tr><td>MCC[15]</td><td>X</td><td>95.6</td><td>95.4</td><td>98.6</td><td>100.0</td><td>72.6</td><td>73.9</td><td>89.4</td></tr><tr><td>SRDC[42]</td><td>X</td><td>95.8</td><td>95.7</td><td>99.2</td><td>100.0</td><td>76.7</td><td>77.1</td><td>90.8</td></tr><tr><td>RWOT[51]</td><td>X</td><td>94.5</td><td>95.1</td><td>99.5</td><td>100.0</td><td>77.5</td><td>77.9</td><td>90.8</td></tr><tr><td>RSDA-MSTN[10]</td><td>X</td><td>95.8</td><td>96.1</td><td>99.3</td><td>100.0</td><td>77.4</td><td>78.9</td><td>91.1</td></tr><tr><td>SHOT [21]</td><td>√</td><td>94.0</td><td>90.1</td><td>98.4</td><td>99.9</td><td>74.7</td><td>74.3</td><td>88.6</td></tr><tr><td>3C-GAN[20]</td><td>【</td><td>92.7</td><td>93.7</td><td>98.5</td><td>99.8</td><td>75.3</td><td>77.8</td><td>89.6</td></tr><tr><td>NRC</td><td></td><td>96.0</td><td>90.8</td><td>99.0</td><td>100.0</td><td>75.3</td><td>75.0</td><td>89.4</td></tr></table>
134
+
135
+ Table 2: Accuracies $( \% )$ on Office-Home for ResNet50-based methods.
136
+
137
+ <table><tr><td>Method</td><td></td><td>SFAr-&gt;CIAr-→PrAr-→RwC1-→ArCI-→PrCI-→&gt;RwPr-→ArPr-→&gt;CIPr-→RwRw-→ArRw-→CIRw-→PrAvg</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>MCD [35]</td><td>xxxxxxxxxx</td><td>48.9 68.3</td><td>74.6</td><td>61.3</td><td>67.6</td><td>68.8</td><td>57.0</td><td>47.1</td><td>75.1</td><td>69.1</td><td>52.2</td><td>79.6</td><td>64.1</td></tr><tr><td>CDAN [24]</td><td></td><td>50.7</td><td>70.6 76.0</td><td>57.6</td><td>70.0</td><td>70.0</td><td>57.4</td><td>50.9</td><td>77.3</td><td>70.9</td><td>56.7</td><td>81.6</td><td>65.8</td></tr><tr><td>SAFN [52]</td><td></td><td>52.0</td><td>71.7 76.3</td><td>64.2</td><td>69.9</td><td>71.9</td><td>63.7</td><td>51.4</td><td>77.1</td><td>70.9</td><td>57.1</td><td>81.5</td><td>67.3</td></tr><tr><td>Symnets [58]</td><td></td><td>47.7 72.9</td><td>78.5</td><td>64.2</td><td>71.3</td><td>74.2</td><td>64.2</td><td>48.8</td><td>79.5</td><td>74.5</td><td>52.6</td><td>82.7</td><td>67.6</td></tr><tr><td>MDD [59]</td><td></td><td>54.9 73.7</td><td>77.8</td><td>60.0</td><td>71.4</td><td>71.8</td><td>61.2</td><td>53.6</td><td>78.1</td><td>72.5</td><td>60.2</td><td>82.3</td><td>68.1</td></tr><tr><td>TADA [47]</td><td></td><td>53.1</td><td>72.3 77.2</td><td>59.1</td><td>71.2</td><td>72.1</td><td>59.7</td><td>53.1</td><td>78.4</td><td>72.4</td><td>60.0</td><td>82.9</td><td>67.6</td></tr><tr><td>BNM[4]</td><td></td><td>52.3</td><td>73.9 80.0</td><td>63.3</td><td>72.9</td><td>74.9</td><td>61.7</td><td>49.5</td><td>79.7</td><td>70.5</td><td>53.6</td><td>82.2</td><td>67.9</td></tr><tr><td>BDG [53]</td><td></td><td>51.5 73.4</td><td>78.7</td><td>65.3</td><td>71.5</td><td>73.7</td><td>65.1</td><td>49.7</td><td>81.1</td><td>74.6</td><td>55.1</td><td>84.8</td><td>68.7</td></tr><tr><td>SRDC [42]</td><td></td><td>52.3 76.3</td><td>81.0</td><td>69.5</td><td>76.2</td><td>78.0</td><td>68.7</td><td>53.8</td><td>81.7</td><td>76.3</td><td>57.1</td><td>85.0</td><td>71.3</td></tr><tr><td>RSDA-MSTN[10]</td><td></td><td>53.2</td><td>77.7 81.3</td><td>66.4</td><td>74.0</td><td>76.5</td><td>67.9</td><td>53.0</td><td>82.0</td><td>75.8</td><td>57.8</td><td>85.4</td><td>70.9</td></tr><tr><td>SHOT [21]</td><td></td><td>57.1</td><td>78.1 81.5</td><td>68.0</td><td>78.2</td><td>78.1</td><td>67.4</td><td>54.9</td><td>82.2</td><td>73.3</td><td>58.8</td><td>84.3</td><td>71.8</td></tr><tr><td>NRC</td><td>区</td><td>57.7</td><td>80.3 82.0</td><td>68.1</td><td>79.8</td><td>78.6</td><td>65.3</td><td>56.4</td><td>83.0</td><td>71.0</td><td>58.6</td><td>85.6</td><td>72.2</td></tr></table>
138
+
139
+ Office-Home [46] contains 4 domains (Real, Clipart, Art, Product) with 65 classes and a total of 15,500 images. VisDA [28] is a more challenging dataset, with 12-class synthetic-to-real object recognition tasks, its source domain contains of $1 5 2 \mathrm { k }$ synthetic images while the target domain has 55k real object images. PointDA-10 [30] is the first 3D point cloud benchmark specifically designed for domain adaptation, it has 3 domains with 10 classes, denoted as ModelNet-10, ShapeNet-10 and ScanNet-10, containing approximately $2 7 . 7 \mathrm { k }$ training and 5.1k testing images together.
140
+
141
+ Evaluation. We compare with existing source-present and source-free DA methods. All results are the average on three random runs. SF in the tables denotes source-free.
142
+
143
+ Model details. For fair comparison with related methods, we also adopt the backbone of ResNet-50 [11] for Office-Home and ResNet-101 for VisDA, and PointNet [29] for PointDA10. Specifically, for 2D image datasets, we use the same network architecture as SHOT [21], i.e., the final part of the network is: fully connected layer − Batch Normalization [12] − fully connected layer with weight normalization [37]. And for PointDA-10 [29], we use the code released by the authors for fair comparison with PointDAN [29], and only use the backbone without any of their proposed modules. To train the source model, we also adopt label smoothing as SHOT does. We adopt SGD with momentum 0.9 and batch size of 64 for all 2D datasets, and Adam for PointDA-10. The learning rate for Office-31 and Office-Home is set to 1e-3 for all layers, except for the last two newly added fc layers, where we apply 1e-2. Learning rates are set 10 times smaller for VisDA. Learning rate for PointDA-10 is set to 1e-6. We train 30 epochs for Office-31 and OfficeHome while 15 epochs for VisDA, and 100 for PointDA-10. For the number of nearest neighbors (K) and expanded neighborhoods (M), we use 3,2 for Office-31, Office-Home and PointDA-10, since VisDA is much larger we set K, M to 5. Experiments are conducted on a TITAN Xp.
144
+
145
+ # 4.1 Results
146
+
147
+ 2D image datasets. We first evaluate the target performance of our method compared with existing DA and SFDA methods on three 2D image datasets. As shown in Table 1-3, the top part shows results for the source-present methods with access to source data during adaptation. The bottom shows results for the source-free DA methods. On Office-31, our method gets similar results compared with source-free method 3C-GAN and lower than source-present method RSDA-MSTN. And our method achieves state-of-the-art performance on Office-Home and VisDA, especially on VisDA our method surpasses the source-free method SHOT and source-present method RWOT by a wide margin $3 \%$ and $1 . 9 \%$ respectively). The reported results clearly demonstrate the efficiency of the proposed method for source-free domain adaptation. Interestingly, like already observed in the SHOT paper, source-free methods outperform methods that have access to source data during adaptation.
148
+
149
+ Table 3: Accuracies $( \% )$ on VisDA-C (Synthesis Real) for ResNet101-based methods.
150
+
151
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>SF</td><td rowspan=1 colspan=1>[SF|plane bcycl bus car horse knife mcycl person plant sktbrd train truck Per-class</td></tr><tr><td rowspan=5 colspan=1>ADR [34]CDAN [24]CDAN+BSP[2]SAFN [52]SWD[19]MDD [59]DMRL [49]MCC[15]STAR [26]RWOT[51]</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>94.248.584.0 72.990.174.292.6 72.580.861.882.2 28.8 73.5</td></tr><tr><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>85.266.983.0 50.884.274.988.1 74.583.476.081.9 38.0 73.9</td></tr><tr><td rowspan=3 colspan=1>×</td><td rowspan=2 colspan=1>61.081.0 57.5 89.080.690.1 77.084.277.982.1 38.4 75.9</td></tr><tr><td rowspan=1 colspan=1>92.493.690.8</td></tr><tr><td rowspan=1 colspan=1>93.661.384.1 70.6 94.179.091.8 79.689.955.689.0 24.4 76.190.882.5 81.7 70.5 91.769.586.3 77.587.463.685.6 29.2 76.4- 1 1 1 1 1 1 1 1 - 1 1 74.6- = = = = = = = = 75.588.780.3 80.5 71.5 90.1 93.285.0 71.689.473.8 85.0 36.9 78.895.084.084.6 73.0 91.691.885.9 78.494.484.787.0 42.2 82.795.180.383.7 90.092.468.092.5 82.287.978.490.4 68.2 84.0</td></tr><tr><td rowspan=3 colspan=1>3C-GAN [20]SHOT[21]NRC</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>94.873.468.8 74.893.195.488.6 84.7 89.184.783.5 48.1 81.6</td></tr><tr><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>94.388.580.1 57.3 93.194.980.7 80.391.589.186.3 58.2 82.9</td></tr><tr><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>96.891.382.4 62.4 96.295.986.1 80.694.894.190.4 59.7 85.9</td></tr></table>
152
+
153
+ Table 4: Accuracies $( \% )$ on PointDA-10. The results except ours are from PointDAN [30].
154
+
155
+ <table><tr><td colspan="2"></td><td colspan="4">|SF|Model-→Shape Model-→Scan Shape-→Model Shape-&gt;Scan Scan→Model Scan-→Shape Avg</td></tr><tr><td>MMD [25]</td><td></td><td>57.5 27.9</td><td>40.7</td><td>26.7</td><td>47.3</td><td>54.8</td><td>42.5</td></tr><tr><td>DANN [6]</td><td>xxxxx</td><td>58.7 29.4</td><td>42.3</td><td>30.5</td><td>48.1</td><td>56.7</td><td>44.2</td></tr><tr><td>ADDA [44]</td><td></td><td>61.0 30.5</td><td>40.4</td><td>29.3</td><td>48.9</td><td>51.1</td><td>43.5</td></tr><tr><td>MCD [35]</td><td></td><td>62.0 31.0</td><td>41.4</td><td>31.3</td><td>46.8</td><td>59.3</td><td>45.3</td></tr><tr><td>PointDAN [30]</td><td></td><td>64.2 33.0</td><td>47.6</td><td>33.9</td><td>49.1</td><td>64.1</td><td>48.7</td></tr><tr><td>Source-only</td><td></td><td>43.1</td><td>17.3 40.0</td><td>15.0</td><td>33.9</td><td>47.1</td><td>32.7</td></tr><tr><td>NRC</td><td>&lt;</td><td>64.8</td><td>25.8 59.8</td><td>26.9</td><td>70.1</td><td>68.1</td><td>52.6</td></tr></table>
156
+
157
+ 3D point cloud dataset. We also report the result for the PointDA-10. As shown in Table 4, our method outperforms PointDA [30], which demands source data for adaptation and is specifically tailored for point cloud data with extra attention modules, by a large margin $(4 \% )$ .
158
+
159
+ # 4.2 Analysis
160
+
161
+ Ablation study on neighbors $\mathcal { N }$ , $E$ and affinity $A$ . In the first two tables of Table 5, we conduct the ablation study on Office-Home and VisDA. The 1-st row contains results from the source model and the 2-nd row from only training with the diversity loss $\mathcal { L } _ { d i v }$ . From the remaining rows, several conclusions can be drawn.
162
+
163
+ First, the original supervision, which considers all neighbors equally can lead to a decent performance (67.1 on Office-Home). Second, considering higher affinity values for reciprocal neighbors leads to a large performance gain (69.1 on Office-Home). Last but not the least, the expanded neighborhoods can also be helpful, but only when combined with the affinity values $A$ (72.2 on Office-Home). Using expanded neighborhoods without affinity obtains bad performance (65,2 on Office-Home). We conjecture that those expanded neighborhoods, especially those neighbors of nRNN, may be noisy as discussed in Sec. 3.2. Removing the affinity $A$ means we treat all those neighbors equally, which is not reasonable.
164
+
165
+ Table 5: Ablation study of different modules on Office-Home (left) and VisDA (middle), comparison between using expanded neighbors and larger nearest neighbors (right).
166
+
167
+ <table><tr><td>Ldiv</td><td>LN</td><td>LE LEA</td><td>Avg</td><td>Ldiv</td><td>LN</td><td></td><td>LE LEA</td><td></td><td>Acc</td></tr><tr><td></td><td></td><td></td><td>59.5</td><td></td><td></td><td></td><td></td><td></td><td>44.6</td></tr><tr><td></td><td></td><td></td><td>62.1</td><td></td><td></td><td></td><td></td><td></td><td>47.8</td></tr><tr><td></td><td></td><td></td><td>67.1</td><td></td><td></td><td></td><td></td><td></td><td>74.6</td></tr><tr><td></td><td></td><td></td><td>√ 69.1</td><td></td><td></td><td></td><td></td><td>√</td><td>81.5</td></tr><tr><td></td><td></td><td></td><td>65.2</td><td></td><td></td><td></td><td></td><td></td><td>61.2</td></tr><tr><td></td><td></td><td></td><td>72.2</td><td></td><td></td><td></td><td></td><td>!</td><td>85.9</td></tr><tr><td></td><td></td><td></td><td>69.1 [</td><td></td><td></td><td></td><td></td><td></td><td>82.0</td></tr></table>
168
+
169
+ <table><tr><td rowspan=1 colspan=1>Method&amp;Dataset</td><td rowspan=1 colspan=1>Acc</td></tr><tr><td rowspan=1 colspan=1>VisDA (K=M=5)VisDA w/o E (K=30)</td><td rowspan=1 colspan=1>85.984.0</td></tr><tr><td rowspan=1 colspan=1>OH(K=3,M=2)OH w/o E (K=9)</td><td rowspan=1 colspan=1>72.269.5</td></tr></table>
170
+
171
+ Table 6: Runtime analysis on SHOT and our method. For SHOT, pseudo labels are computed at each epoch. $20 \%$ , $10 \%$ and $5 \%$ denote the percentage of target features which are stored in the memory bank.
172
+
173
+ <table><tr><td>VisDA</td><td colspan="2">Runtime (s/epoch)Per-class (%)</td></tr><tr><td>SHOT</td><td>618.82</td><td>82.9</td></tr><tr><td>NRC</td><td>540.89</td><td>85.9</td></tr><tr><td>NRC(20%) 6formemorybank)</td><td>507.15</td><td>85.3</td></tr><tr><td>NRC(10% for memory bank)</td><td>499.49</td><td>85.2</td></tr><tr><td>NRC(5% for memory bank)</td><td>499.28</td><td>85.1</td></tr></table>
174
+
175
+ ![](images/e1748829bba37f8f3b6d43d90dfdbea6be91a7b5cbb5e87bd18f0bf9bd522aa6.jpg)
176
+ Figure 2: (Left and middle) Ablation study of $\mathcal { L } _ { s e l f }$ on Office-Home and VisDA respectively. (Right) Performance with different $r$ on VisDA.
177
+
178
+ We also show that duplication in the expanded neighbors is important in the last row of Table 5, where the $\mathcal { L } _ { \hat { E } }$ means we remove duplication in Eq. 8. The results show that the performance will degrade significantly when removing them, implying that the duplicated expanded neighbors are indeed more important than others.
179
+
180
+ Next we ablate the importance of the expanded neighborhood in the right of Table5. We show that if we increase the number of datapoints considered for class-consistency by simply considering a larger K, we obtain significantly lower scores. We have chosen $K$ so that the total number of points considered is equal to our method (i.e. $5 { + } 5 ^ { * } 5 { = } 3 0$ and $3 + 3 ^ { * } 2 { = } 9 ,$ ). Considering neighbors of neighbors is more likely to provide datapoints that are close on the data manifold [43], and are therefore more likely to share the class label with the ego feature.
181
+
182
+ Runtime analysis. Instead of storing all feature vectors in the memory bank, we follow the same memory bank setting as in [5] which is for nearest neighbor retrieval. The method only stores a fixed number of target features, we update the memory bank at the end of each iteration by taking the $n$ (batch size) embeddings from the current training iteration and concatenating them at the end of the memory bank, and discard the oldest $n$ elements from the memory bank. We report the results with this type of memory bank of different buffer size in the Table 6. The results show that indeed this could be an efficient way to reduce computation on very large datasets.
183
+
184
+ Ablation study on self-regularization. In the left and middle of Fig 2, we show the results with and without self-regularization $\mathcal { L } _ { s e l f }$ . The $\mathcal { L } _ { s e l f }$ can improve the performance when adopting only nearest neighbors $\mathcal { N }$ or all neighbors $\mathcal { N } + E$ . The results imply that self-regularization can effectively reduce the negative impact of the potential noisy neighbors, especially on the Office-Home dataset.
185
+
186
+ Sensitivity to hyperparameter. There are three hyperparameters in our method: K and M which are the number of nearest neighbors and expanded neighbors, $r$ which is the affinity value assigned to nRNN. We show the results with different $r$ in the right of Fig. 2. Note we keep the affinity of expanded neighbors as 0.1. $r = 1$ means no affinity. $r = - 1$ means treating supervision of nRNN feature as totally wrong, which is not always the case and will lead to quite lower result. $r = 0$ can also achieve good performance, signifying RNN can already work well. Results with $r = 0 . 1 / 0 . 1 5 / 0 . 2$ show that our method is not sensitive to the choice of a reasonable $r$ . Note in DA, there is no validation set for hyperparameter tuning, we show the results varying the number of neighbors in the right of Tab. 3, demonstrating the robustness to the choice of $K$ and $M$ .
187
+
188
+ ![](images/52c51cde4275a75094e8c62c8d4fd77f70977cdffb6dcc8e5fcf1796cfa99e42.jpg)
189
+ Figure 3: (Left) The three curves are (on VisDA): target accuracy (Blue), ratio of features which have 5-nearest neighbors all sharing the same predicted label (dashed Red), and ratio of features which have 5-nearest neighbors all sharing the same and correct predicted label (dashed Black). (Right) Ablation study on choice of K and M on VisDA.
190
+
191
+ ![](images/fd8c9cc81f0a4968ed7f3124861b6deeb77a38f4952bd4cbfedaa30cfe215f98.jpg)
192
+ Figure 4: (Left) Ratio of different type of nearest neighbor features which have the correct predicted label, before and after adaptation. (Right) Visualization of target features after adaptation.
193
+
194
+ Training curve. We show the evolution of several statistics during adaptation on VisDA in the left of Tab. 3. The blue curve is the target accuracy. The dashed red and black curves are the ratio of features which have 5-nearest neighbors all sharing the same (dashed Red), or the same and also correct (dashed Black) predicted label. The curves show that the target features are clustering during the training. Another interesting finding is that the curve ’Per Shared’ correlates with the accuracy curve, which might therefore be used to determine training convergence.
195
+
196
+ Accuracy of supervision from neighbors. We also show the accuracy of supervision from neighbors on task $\mathrm { A r } { } \mathrm { R w }$ of Office-Home in Fig. 4(left). It shows that after adaptation, the ratio of all types of neighbors having more correct predicted label, proving the effectiveness of the method.
197
+
198
+ t-SNE visualization. We show the t-SNE feature visualization on task $\mathrm { A r } { } \mathrm { R w }$ of target features before (Fig. 1(a)) and after (Fig. 4(right)) adaptation. After adaptation, the features are more compactly clustered.
199
+
200
+ # 5 Conclusions
201
+
202
+ We introduce a source-free domain adaptation (SFDA) method by uncovering the intrinsic target data structure. We propose to achieve the adaptation by encouraging label consistency among local target features. We differentiate between nearest neighbors, reciprocal neighbors and expanded neighborhood. Experimental results verify the importance of considering the local structure of the target features. Finally, our experimental results on both 2D image and 3D point cloud datasets testify the efficacy of our method.
203
+
204
+ Acknowledgement We acknowledge the support from Huawei Kirin Solution, and the project PID2019-104174GB-I00 (MINECO, Spain) and RTI2018-102285-A-I00 (MICINN, Spain), Ramón y Cajal fellowship RYC2019-027020-I, and the CERCA Programme of Generalitat de Catalunya.
205
+
206
+ # References
207
+
208
+ [1] Kristen M Altenburger and Johan Ugander. Monophily in social networks introduces similarity among friends-of-friends. Nature human behaviour, 2(4):284–290, 2018.
209
+ [2] Xinyang Chen, Sinan Wang, Mingsheng Long, and Jianmin Wang. Transferability vs. discriminability: Batch spectral penalization for adversarial domain adaptation. In International Conference on Machine Learning, pages 1081–1090, 2019.
210
+ [3] Alex Chin, Yatong Chen, Kristen M. Altenburger, and Johan Ugander. Decoupled smoothing on graphs. In The World Wide Web Conference, pages 263–272, 2019.
211
+ [4] Shuhao Cui, Shuhui Wang, Junbao Zhuo, Liang Li, Qingming Huang, and Qi Tian. Towards discriminability and diversity: Batch nuclear-norm maximization under label insufficient situations. CVPR, 2020.
212
+ [5] Debidatta Dwibedi, Yusuf Aytar, Jonathan Tompson, Pierre Sermanet, and Andrew Zisserman. With a little help from my friends: Nearest-neighbor contrastive learning of visual representations. ICCV, 2021.
213
+ [6] Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. arXiv preprint arXiv:1409.7495, 2014.
214
+ [7] Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, François Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The Journal of Machine Learning Research, 17(1):2096–2030, 2016.
215
+ [8] Kamran Ghasedi Dizaji, Amirhossein Herandi, Cheng Deng, Weidong Cai, and Heng Huang. Deep clustering via joint convolutional autoencoder embedding and relative entropy minimization. In Proceedings of the IEEE international conference on computer vision, pages 5736–5745, 2017.
216
+ [9] Ryan Gomes, Andreas Krause, and Pietro Perona. Discriminative clustering by regularized information maximization. 2010.
217
+ [10] Xiang Gu, Jian Sun, and Zongben Xu. Spherical space domain adaptation with robust pseudo-label loss. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9101–9110, 2020.
218
+ [11] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
219
+ [12] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
220
+ [13] Mohammed Jabi, Marco Pedersoli, Amar Mitiche, and Ismail Ben Ayed. Deep clustering: On the link between discriminative models and k-means. IEEE transactions on pattern analysis and machine intelligence, 2019.
221
+ [14] Herve Jegou, Hedi Harzallah, and Cordelia Schmid. A contextual dissimilarity measure for accurate and efficient image search. In 2007 IEEE Conference on Computer Vision and Pattern Recognition, pages 1–8. IEEE, 2007.
222
+ [15] Ying Jin, Ximei Wang, Mingsheng Long, and Jianmin Wang. Minimum class confusion for versatile domain adaptation. ECCV, 2020.
223
+ [16] Jogendra Nath Kundu, Naveen Venkat, and R Venkatesh Babu. Universal source-free domain adaptation. CVPR, 2020.
224
+ [17] Jogendra Nath Kundu, Naveen Venkat, Ambareesh Revanur, R Venkatesh Babu, et al. Towards inheritable models for open-set domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12376–12385, 2020.
225
+ [18] Chen-Yu Lee, Tanmay Batra, Mohammad Haris Baig, and Daniel Ulbricht. Sliced wasserstein discrepancy for unsupervised domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2019.
226
+ [19] Chen-Yu Lee, Tanmay Batra, Mohammad Haris Baig, and Daniel Ulbricht. Sliced wasserstein discrepancy for unsupervised domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 10285–10295, 2019.
227
+ [20] Rui Li, Qianfen Jiao, Wenming Cao, Hau-San Wong, and Si Wu. Model adaptation: Unsupervised domain adaptation without source data. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9641–9650, 2020.
228
+ [21] Jian Liang, Dapeng Hu, and Jiashi Feng. Do we really need to access the source data? source hypothesis transfer for unsupervised domain adaptation. ICML, 2020.
229
+ [22] Yuang Liu, Wei Zhang, and Jun Wang. Source-free domain adaptation for semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1215–1224, 2021.
230
+ [23] Mingsheng Long, Yue Cao, Jianmin Wang, and Michael I Jordan. Learning transferable features with deep adaptation networks. ICML, 2015.
231
+ [24] Mingsheng Long, Zhangjie Cao, Jianmin Wang, and Michael I Jordan. Conditional adversarial domain adaptation. In Advances in Neural Information Processing Systems, pages 1647–1657, 2018.
232
+ [25] Mingsheng Long, Jianmin Wang, Guiguang Ding, Jiaguang Sun, and Philip S Yu. Transfer feature learning with joint distribution adaptation. In Proceedings of the IEEE international conference on computer vision, pages 2200–2207, 2013.
233
+ [26] Zhihe Lu, Yongxin Yang, Xiatian Zhu, Cong Liu, Yi-Zhe Song, and Tao Xiang. Stochastic classifiers for unsupervised domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9111–9120, 2020.
234
+ [27] Yingwei Pan, Ting Yao, Yehao Li, Chong-Wah Ngo, and Tao Mei. Exploring category-agnostic clusters for open-set domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13867–13875, 2020.
235
+ [28] Xingchao Peng, Ben Usman, Neela Kaushik, Judy Hoffman, Dequan Wang, and Kate Saenko. Visda: The visual domain adaptation challenge. arXiv preprint arXiv:1710.06924, 2017.
236
+ [29] Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 652–660, 2017.
237
+ [30] Can Qin, Haoxuan You, Lichen Wang, C-C Jay Kuo, and Yun Fu. Pointdan: A multi-scale 3d domain adaption network for point cloud representation. Advances in Neural Information Processing Systems, 32:7192–7203, 2019.
238
+ [31] Danfeng Qin, Stephan Gammeter, Lukas Bossard, Till Quack, and Luc Van Gool. Hello neighbor: Accurate object retrieval with k-reciprocal nearest neighbors. In CVPR 2011, pages 777–784. IEEE, 2011.
239
+ [32] Kate Saenko, Brian Kulis, Mario Fritz, and Trevor Darrell. Adapting visual category models to new domains. In European conference on computer vision, pages 213–226. Springer, 2010.
240
+ [33] Kuniaki Saito, Donghyun Kim, Stan Sclaroff, and Kate Saenko. Universal domain adaptation through self supervision. Advances in Neural Information Processing Systems, 33, 2020.
241
+ [34] Kuniaki Saito, Yoshitaka Ushiku, Tatsuya Harada, and Kate Saenko. Adversarial dropout regularization. ICLR, 2018.
242
+ [35] Kuniaki Saito, Kohei Watanabe, Yoshitaka Ushiku, and Tatsuya Harada. Maximum classifier discrepancy for unsupervised domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3723–3732, 2018.
243
+ [36] Kuniaki Saito, Shohei Yamamoto, Yoshitaka Ushiku, and Tatsuya Harada. Open set domain adaptation by backpropagation. In Proceedings of the European Conference on Computer Vision (ECCV), pages 153–168, 2018.
244
+ [37] Tim Salimans and Diederik P Kingma. Weight normalization: A simple reparameterization to accelerate training of deep neural networks. arXiv preprint arXiv:1602.07868, 2016.
245
+ [38] Saquib Sarfraz, Vivek Sharma, and Rainer Stiefelhagen. Efficient parameter-free clustering using first neighbor relations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8934–8943, 2019.
246
+ [39] Yuan Shi and Fei Sha. Information-theoretical learning of discriminative clusters for unsupervised domain adaptation. In Proceedings of the 29th International Coference on International Conference on Machine Learning, pages 1275–1282, 2012.
247
+ [40] Rui Shu, Hung H Bui, Hirokazu Narui, and Stefano Ermon. A dirt-t approach to unsupervised domain adaptation. ICLR, 2018.
248
+ [41] Baochen Sun, Jiashi Feng, and Kate Saenko. Return of frustratingly easy domain adaptation. In Thirtieth AAAI Conference on Artificial Intelligence, 2016.
249
+ [42] Hui Tang, Ke Chen, and Kui Jia. Unsupervised domain adaptation via structurally regularized deep clustering. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8725–8735, 2020.
250
+ [43] Joshua B Tenenbaum, Vin De Silva, and John C Langford. A global geometric framework for nonlinear dimensionality reduction. science, 290(5500):2319–2323, 2000.
251
+ [44] Eric Tzeng, Judy Hoffman, Kate Saenko, and Trevor Darrell. Adversarial discriminative domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7167–7176, 2017.
252
+ [45] Eric Tzeng, Judy Hoffman, Ning Zhang, Kate Saenko, and Trevor Darrell. Deep domain confusion: Maximizing for domain invariance. arXiv preprint arXiv:1412.3474, 2014.
253
+ [46] Hemanth Venkateswara, Jose Eusebio, Shayok Chakraborty, and Sethuraman Panchanathan. Deep hashing network for unsupervised domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5018–5027, 2017.
254
+ [47] Ximei Wang, Liang Li, Weirui Ye, Mingsheng Long, and Jianmin Wang. Transferable attention for domain adaptation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 5345–5352, 2019.
255
+ [48] Zhongdao Wang, Liang Zheng, Yali Li, and Shengjin Wang. Linkage based face clustering via graph convolution network. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1117–1125, 2019.
256
+ [49] Yuan Wu, Diana Inkpen, and Ahmed El-Roby. Dual mixup regularized learning for adversarial domain adaptation. ECCV, 2020.
257
+ [50] Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3733–3742, 2018.
258
+ [51] Renjun Xu, Pelen Liu, Liyan Wang, Chao Chen, and Jindong Wang. Reliable weighted optimal transport for unsupervised domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4394–4403, 2020.
259
+ [52] Ruijia Xu, Guanbin Li, Jihan Yang, and Liang Lin. Larger norm more transferable: An adaptive feature norm approach for unsupervised domain adaptation. In The IEEE International Conference on Computer Vision (ICCV), October 2019.
260
+ [53] Guanglei Yang, Haifeng Xia, Mingli Ding, and Zhengming Ding. Bi-directional generation for unsupervised domain adaptation. In AAAI, pages 6615–6622, 2020.
261
+ [54] Lei Yang, Dapeng Chen, Xiaohang Zhan, Rui Zhao, Chen Change Loy, and Dahua Lin. Learning to cluster faces via confidence and connectivity estimation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13369–13378, 2020.
262
+ [55] Lei Yang, Xiaohang Zhan, Dapeng Chen, Junjie Yan, Chen Change Loy, and Dahua Lin. Learning to cluster faces on an affinity graph. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2298–2306, 2019.
263
+ [56] Shiqi Yang, Yaxing Wang, Joost van de Weijer, Luis Herranz, and Shangling Jui. Unsupervised domain adaptation without source data by casting a bait. arXiv preprint arXiv:2010.12427, 2020.
264
+ [57] Kaichao You, Mingsheng Long, Zhangjie Cao, Jianmin Wang, and Michael I Jordan. Universal domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2720–2729, 2019.
265
+ [58] Yabin Zhang, Hui Tang, Kui Jia, and Mingkui Tan. Domain-symmetric networks for adversarial domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5031–5040, 2019.
266
+ [59] Yuchen Zhang, Tianle Liu, Mingsheng Long, and Michael Jordan. Bridging theory and algorithm for domain adaptation. In International Conference on Machine Learning, pages 7404–7413, 2019.
267
+ [60] Zhun Zhong, Liang Zheng, Donglin Cao, and Shaozi Li. Re-ranking person re-identification with kreciprocal encoding. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 1318–1327, 2017.
268
+ [61] Jiong Zhu, Yujun Yan, Lingxiao Zhao, Mark Heimann, Leman Akoglu, and Danai Koutra. Beyond homophily in graph neural networks: Current limitations and effective designs. Advances in Neural Information Processing Systems, 33, 2020.
269
+ [62] Chengxu Zhuang, Alex Lin Zhai, and Daniel Yamins. Local aggregation for unsupervised learning of visual embeddings. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6002–6012, 2019.
270
+
271
+ # Checklist
272
+
273
+ 1. For all authors...
274
+
275
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
276
+ (b) Did you describe the limitations of your work? [No]
277
+ (c) Did you discuss any potential negative societal impacts of your work? [No]
278
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
279
+
280
+ 2. If you are including theoretical results...
281
+
282
+ (a) Did you state the full set of assumptions of all theoretical results? [N/A] (b) Did you include complete proofs of all theoretical results? [N/A]
283
+
284
+ 3. If you ran experiments...
285
+
286
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We attach the code in the supplemental material.
287
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] As in the model details in Sec.4
288
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] All main results are average over three running with random seeds.
289
+ (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]
290
+
291
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
292
+
293
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
294
+ (b) Did you mention the license of the assets? [No]
295
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
296
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No]
297
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No]
298
+
299
+ 5. If you used crowdsourcing or conducted research with human subjects...
300
+
301
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
302
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
303
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/train/wK2fDDJ5VcF/wK2fDDJ5VcF.md ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Learning to Walk in Minutes Using Massively Parallel Deep Reinforcement Learning
2
+
3
+ Nikita Rudin ETH Zurich and NVIDIA rudinn@ethz.ch
4
+
5
+ David Hoeller ETH Zurich and NVIDIA dhoeller@ethz.ch
6
+
7
+ Philipp Reist NVIDIA preist@nvidia.com
8
+
9
+ Marco Hutter ETH Zurich mahutter@ethz.com
10
+
11
+ Abstract: In this work, we present and study a training set-up that achieves fast policy generation for real-world robotic tasks by using massive parallelism on a single workstation GPU. We analyze and discuss the impact of different training algorithm components in the massively parallel regime on the final policy performance and training times. In addition, we present a novel game-inspired curriculum that is well suited for training with thousands of simulated robots in parallel. We evaluate the approach by training the quadrupedal robot ANYmal to walk on challenging terrain. The parallel approach allows training policies for flat terrain in under four minutes, and in twenty minutes for uneven terrain. This represents a speedup of multiple orders of magnitude compared to previous work. Finally, we transfer the policies to the real robot to validate the approach. We open-source our training code to help accelerate further research in the field of learned legged locomotion: https://leggedrobotics.github.io/legged_gym/.
12
+
13
+ Keywords: Reinforcement Learning, Legged Robots, Sim-to-real
14
+
15
+ ![](images/b6480bd30beb6d1b9762af85125a32c3c8067d4548699e684f5c674891d50b92.jpg)
16
+ Figure 1: Thousands of robots learning to walk in simulation.
17
+
18
+ # 1 Introduction
19
+
20
+ Deep reinforcement learning (DRL) is proving to be a powerful tool for robotics. Tasks such as legged locomotion [1], manipulation [2], and navigation [3], have been solved using these new tools, and research continues to keep adding more and more challenging tasks to the list. The amount of data required to train a policy increases with the task complexity. For this reason, most work focuses on training in simulation before transferring to real robots. We have reached a point where multiple days or even weeks are needed to fully train an agent with current simulators. For example, OpenAI’s block reorientation task was trained for up to 14 days and their Rubik’s cube solving policy took several months to train [4]. The problem is exacerbated by the fact that deep reinforcement learning requires hyper-parameter tuning to obtain a suitable solution which requires sequentially rerunning time-consuming training. Reducing training times using massively parallel approaches such as presented here can therefore help improve the quality and time-to-deployment of DRL policies, as a training setup can be iterated on more often in the same time frame.
21
+
22
+ In this paper, we examine the effects of massive parallelism for on-policy DRL algorithms and present considerations in how the standard RL formulation and the most commonly used hyperparameters should be adapted to learn efficiently in the highly parallel regime. Additionally, we present a novel game-inspired curriculum which automatically adapts the task difficulty to the performance of the policy. The proposed curriculum architecture is straightforward to implement, does not require tuning, and is well suited for the massively parallel regime. Common robotic simulators such as Mujoco [5], Bullet [6], or Raisim [7] feature efficient multi-body dynamics implementations. However, they have been developed to run on CPUs with only a reduced amount of parallelism. In this work, we use NVIDIA’s Isaac Gym simulation environment [8], which runs both the simulation and training on the GPU and is capable of simulating thousands of robots in parallel.
23
+
24
+ The massively parallel training regime has been explored before [4, 9] in the context of distributed systems with a network of thousands of CPUs each running a separate instance of the simulation. The parallelization was achieved by averaging the gradients between the different workers without reducing the number of samples provided by each agent. This results in large batch sizes of millions of samples for each policy update which improves the learning dynamics, but does not optimize the overall training time. In parallel, recent works have aimed to increase the simulation throughput and reduce training times of standard DRL benchmark tasks. A framework combining parallel simulation with multi-GPU training [10] was proposed to achieve fast training using hundreds of parallel agents. In the context of visual navigation, large batch simulation has been used to increase the training throughput [11]. Furthermore, GPU accelerated physics simulation has been shown to significantly improve the training time of the Humanoid running task [12]. A differentiable simulator running on Google’s TPUs has also been shown to greatly accelerate the training of multiple tasks [13]. We build upon [10, 12] by pushing the parallelization further, optimizing the training algorithm, and applying the approach to a challenging real-world robotics task.
25
+
26
+ Perceptive and dynamic locomotion for legged robots in unstructured environments is a demanding task that, until recently, had only been partially demonstrated with complex model-based approaches [14, 15]. Learning-based approaches are emerging as a promising alternative. For quadrupeds, DRL has been used to train blind policies robust to highly uneven ground [16] (12 hours of training). Perceptive locomotion over challenging terrain has been achieved by combining learning with optimal control techniques [17, 18] (82 and 88 hours of training) and recently, a fully learned approach has shown great robustness in this setting [19] (120 hours of training). Similarly, bipedal robots have also been trained to walk blindly on stairs [20] (training time not reported). With our approach we can train a perceptive policy in under 20 minutes on a single GPU, with the complexity of simto-real transfer to the hardware, which increases the performance and robustness requirements and provides clear validation of the overall approach. Training such behaviors in minutes opens up new exciting possibilities ranging from automatic tuning to customized training using scans of particular environments.
27
+
28
+ # 2 Massively Parallel Reinforcement Learning
29
+
30
+ Current (on-policy) reinforcement learning algorithms are divided into two parts: data collection and policy update. The policy update, which corresponds to back-propagation for neural networks, is easily performed in parallel on the GPU. Parallelizing data collection is not as straightforward. Each step consists of policy inference, simulation, reward, and observation calculation. Current popular pipelines have the simulation and reward/observation calculation computed on the CPU, making the GPU unsuitable for policy inference because of communication bottle-necks. Data transfer over PCIe is known to be the weakest link of GPU acceleration, and can be as much as 50 times slower than the GPU processing time alone [21]. Furthermore, with CPU data collection, a large amount of data must be sent to the GPU for each policy update, slowing down the overall process. Limited parallelization can be achieved by using multiple CPU cores and spawning many processes, each running the simulation for one agent. However, the number of agents is quickly limited by the number of cores and other issues such as memory usage. We explore the potential of massive parallelism with Isaac Gym’s end-to-end data collection and policy updates on the GPU, significantly reducing data copying and improving simulation throughput.
31
+
32
+ # 2.1 Simulation Throughput
33
+
34
+ The main factor affecting the total simulation throughput is the number of robots simulated in parallel. Modern GPUs can handle tens of thousands of parallel instructions. Similarly, IsaacGym’s PhysX engine can process thousands of robots in a single simulation and all other computations of our pipeline are vectorized to scale favorably with the number of robots. Using a single simulation with thousands of robots presents some new challenges. For example, a single common terrain mesh must be used, and it cannot be easily changed at each reset. We circumvent this problem by creating the whole mesh with all terrain types and levels tiled side by side. We change the terrain level of the robots by physically moving them on the mesh. In supplementary material, we show the computational time of different parts of the pipeline, examine how these times scale with the number of robots, and provide other techniques to optimize the simulation throughput.
35
+
36
+ # 2.2 DRL Algorithm
37
+
38
+ We build upon a custom implementation of the Proximal Policy Optimization (PPO) algorithm [22]. Our implementation is designed to perform every operation and store all the data on the GPU. In order to efficiently learn from thousands of robots in parallel, we perform some essential modifications to the algorithm and change some of the commonly used hyper-parameter values.
39
+
40
+ # 2.2.1 Hyper-Parameters Modification
41
+
42
+ In an on-policy algorithm such as PPO, a fixed policy collects a selected amount of data before doing the next policy update. This batch size, $B$ , is a crucial hyper-parameter for successful learning. With too little data, the gradients will be too noisy, and the algorithm will not learn effectively. With too much data, the samples become repetitive, and the algorithm cannot extract more information from them. These samples represent wasted simulation time and slow down the overall training. We have $B = n _ { r o b o t s } n _ { s t e p s }$ , where $ { n _ { s t e p s } }$ is the number of steps each robot takes per policy update and $n _ { r o b o t s }$ the number of robots simulated in parallel. Since we increase $n _ { r o b o t s }$ by a few orders of magnitude, we must choose a small $n _ { s t e p s }$ to keep $B$ reasonable and hence optimize training times, which is a setting that has not been extensively explored for on-policy reinforcement learning algorithms. It turns out that we can not choose $n _ { s t e p s }$ to be arbitrarily low. The algorithm requires trajectories with coherent temporal information to learn effectively. Even though, in theory, information of single steps could be used, we find that the algorithm fails to converge to the optimal solution below a certain threshold. This can be explained by the fact that we use Generalized Advantage Estimation (GAE) [23], which requires rewards from multiple time steps to be effective. For our task, we find that the algorithm struggles when we provide fewer than 25 consecutive steps, corresponding to $0 . 5 \mathrm { s }$ of simulated time. It is important to distinguish $ { n _ { s t e p s } }$ from the maximum episode length leading to a time-out and a reset, which we define as $2 0 \mathrm { s }$ . The environments are reset when they reach this maximum length and not after each iteration, meaning that a single episode can cover many policy updates. This limits the total number of robots training in parallel, and consequently, prohibits us from using the full computational capabilities of the GPU.
43
+
44
+ The mini-batch size represents the size of the chunks in which the batch size is split to perform backpropagation. We find that having mini-batch sizes much larger than what is usually considered best practice is beneficial for our massively parallel use case. We use mini-batches of tens of thousands of samples and observe that it stabilizes the learning process without increasing the total training time.
45
+
46
+ # 2.2.2 Reset Handling
47
+
48
+ During training, the robots must be reset whenever they fall, and also after some time to keep them exploring new trajectories and terrains. The PPO algorithm includes a critic predicting an infinite horizon sum of future discounted rewards. Resets break this infinite horizon assumption and can lead to inferior critic performance if not handled carefully. Resets based on failure or reaching a goal are not a problem because the critic can predict them. However, a reset based on a time out can not be predicted (we do not provide episode time in the observations). The solution is to distinguish the two termination modes and augment the reward with the expected infinite sum of discounted future rewards in a time-out case. In other words, we bootstrap the target of the critic with its own prediction. This solution has been discussed in [24], but interestingly, this distinction is not part of the widely used Gym environment interface [25] and is ignored by popular implementations such as Stable-Baselines $[ 2 6 ] ^ { 1 }$ . After investigating multiple implementations, we conclude that this important detail is often avoided by assuming that the environments either never time out or only on the very last step of a batch collection. In our case, with few robot steps per batch, we can not make such an assumption since a meaningful episode length covers the collection of many batches. We modify the standard Gym interface to detect time-outs and implement the bootstrapping solution. In supplementary material, we show the effect of this solution on the total reward as well as the critic loss.
49
+
50
+ ![](images/9b48083b251353c43d2e71ff8968b79f99600e9e05461c3dd723d12ace8ceddd.jpg)
51
+ Figure 2: Terrain types used for training and testing in simulation. (a) Randomly rough terrain with variations of $0 . 1 \mathrm { m }$ . (b) Sloped terrain with an inclination of $2 5 \mathrm { d e g }$ . (c) Stairs with a width of $0 . 3 \mathrm { m }$ and height of $\mathrm { 0 . 2 m }$ . (d) Randomized, discrete obstacles with heights of up to $\pm 0 . 2 \mathrm { m }$ .
52
+
53
+ # 3 Task Description
54
+
55
+ A quadruped robot must learn to walk across challenging terrain, including uneven surfaces, slopes, stairs, and obstacles, while following base-heading and linear-velocity commands. We conduct most of the simulation and real-world deployment experiments on the ANYbotics ANYmal C robot. However, in simulation, we demonstrate the broader applicability of the approach by additionally training policies for ANYmal B, ANYmal C with an attached arm, and the Unitree A1 robots.
56
+
57
+ # 3.1 Game-Inspired Curriculum
58
+
59
+ The terrains are selected to be representative of real-world environments. We create five types of procedurally generated terrains presented in Fig. 2: flat, sloped, randomly rough, discrete obstacles, and stairs. The terrains are tiled squares with $8 \mathrm { m }$ sides. The robots start at the center of the terrain and are given randomized heading and velocity commands (kept constant for the duration of an episode) pushing them to walk across the terrain. Slopes and stairs are organized in pyramids to allow traversability in all directions.
60
+
61
+ Previous works have shown the benefits of using an automated curriculum of task difficulty to learn complex locomotion policies [28, 29, 16]. Similarly, we find that it is essential to first train the policy on less challenging terrain before progressively increasing the complexity. We adopt a solution inspired by [16], but replace the particle filter approach with a new game-inspired automatic curriculum. All robots are assigned a terrain type and a level that represents the difficulty of that terrain. For stairs and randomized obstacles, we gradually increase the step height from $5 \mathrm { c m }$ to $2 0 \mathrm { c m }$ . Sloped terrain inclination is increased from 0 deg to 25 deg. If a robot manages to walk past the borders of its terrain, its level is increased, and at the next reset, it will start on more difficult terrain. However, if at the end of an episode it moved by less than half of the distance required by its target velocity, its level is reduced again. Robots solving the highest level are looped back to a randomly selected level to increase the diversity and avoid catastrophic forgetting. This approach has the advantage of training the robots at a level of difficulty tailored to their performance without requiring any external tuning. It adapts the difficulty level for each terrain type individually and provides us with visual and quantitative feedback on the progress of the training. When the robots have reached the final level and are evenly spread across all terrains due to looping back, we can conclude they have fully learned to solve the task.
62
+
63
+ ![](images/ecaf8198256af450c96e9b482c8d3d3a06909d2addf9a2530c761fb4193fd419.jpg)
64
+ Figure 3: 4000 robots progressing through the terrains with automatic curriculum, after 500 (top) and 1000 (bottom) policy updates. The robots start the training session on the first row (closest to the camera) and progressively reach harder terrains.
65
+
66
+ The proposed curriculum structure is well suited for the massively parallel regime. With thousands of robots we can directly use their current progress in the curriculum as the distribution of the policy’s performance, and do not need learn it with a generator network [30]. Furthermore, our method doesn’t require tuning and is straightforward to implement in a parallel manner with nearzero processing cost. We remove the computational overhead of re-sampling and re-generating new terrains needed for the particle filter approach.
67
+
68
+ Fig. 3 shows robots progressing through the terrains at two different stages of the training process. On complex terrain types, the robots require more training iterations to reach the highest levels. The distribution of robots after 500 iterations shows that while the policy is able to cross sloped terrains and to go down stairs, climbing stairs and traversing obstacles requires more training iterations. However, after 1000 iterations, the robots have reached the most challenging level for all terrain types and are spread across the map. We train for a total for 1500 iterations to let the policy converge to its highest performance.
69
+
70
+ # 3.2 Observations, Actions, and Rewards
71
+
72
+ The policy receives proprioceptive measurements of the robot as well as terrain information around the robot’s base. The observations are composed of: base linear and angular velocities, measurement of the gravity vector, joint positions and velocities, the previous actions selected by the policy, and finally, 108 measurements of the terrain sampled from a grid around the robot’s base. Each measurement is the distance from the terrain surface to the robot’s base height.
73
+
74
+ The total reward is a weighted sum of nine terms, detailed in supplementary material. The main terms encourage the robot to follow the commanded velocities while avoiding undesired base velocities along other axes. In order to create a smoother, more natural motion, we also penalize joint torques, joint accelerations, joint target changes, and collisions. Contacts with the knees, shanks or between the feet and a vertical surface are considered collisions, while contacts with the base are considered crashes and lead to resets. Finally, we add an additional reward term encouraging the robot to take longer steps, which results in a more visually appealing behavior. We train a single policy with the same rewards for all terrains.
75
+
76
+ The actions are interpreted as desired joint positions sent to the motors. There, a PD controller produces motor torques. In contrast to other works [16, 20], neither the reward function nor the action space has any gait-dependent elements.
77
+
78
+ # 3.3 Sim-to-Real Additions
79
+
80
+ In order to make the trained policies amenable for sim-to-real transfer, we randomize the friction of the ground, add noise to the observations and randomly push the robots during the episode to teach them a more stable stance. Each robot has a friction coefficient sampled uniformly in [0.5, 1.25]. The pushes happen every $1 0 \mathrm { s }$ . The robots’ base is accelerated up to $\pm 1 \mathrm { m } / \mathrm { s }$ in both $\mathbf { X }$ and y directions. The amount of noise is based on real data measured on the robot and is detailed in supplementary material.
81
+
82
+ The ANYmal robot uses series elastic actuators with fairly complex dynamics, which are hard to model in simulation. For this reason and following the methodology of previous work [1], we use a neural network to compute torques from joint position commands. However, we simplify the inputs of the model. Instead of concatenating past measurements at fixed time steps and sending all of that information to a standard feed-forward network, we only provide the current measurements to an LSTM network. A potential drawback of this set-up is that the policy does not have the temporal information of the actuators as in previous work. We have experimented with various ways of providing that information through memory mechanisms for the policy but found that it does not improve the final performance.
83
+
84
+ # 4 Results
85
+
86
+ # 4.1 Effects of Massive Parallelism
87
+
88
+ In this section, we study the effects of the number of parallel robots on the final performance of the policy. In order to use the total reward as a single representative metric, we have to remove the curriculum, otherwise a more performant policy sees its task difficulty increase and consequently a decrease in the total reward. As such, we simplify the task by reducing the maximum step size of stairs and obstacles and directly train robots on the full range of difficulties.
89
+
90
+ We begin by setting a baseline with $n _ { r o b o t s } = 2 0 0 0 0$ and $n _ { s t e p s } = 5 0$ , resulting in a batch size of 1M samples. Using this very large batch size results in the best policy but at the cost of a relatively long training time.
91
+
92
+ We then conduct experiments in which we increase the number of robots while keeping the batch size constant. As a result, the number of steps each robot takes per policy update decreases. In this case, the training time decreases with a higher number of robots, but the policy performance drops if that number is too high. We start from 128 robots corresponding to the level of parallelization of previous CPU implementations and increase that number up to 16384, which is close to the maximum amount of robots we could simulate on rough terrain with Isaac Gym running on a single workstation GPU.
93
+
94
+ In Fig. 4, we compare these results with the baseline, which allows us to select the most favorable trade-off between policy performance and training time. We see two interesting effects at play. First, when the number of robots is too high, the performance drops sharply, which can be explained by the time horizon of each robot becoming too small. As expected, with larger batch sizes, the overall reward is higher, and the time horizon effect is shifted, meaning that we can use more robots before seeing the drop. On the other hand, below a certain threshold, we see a slow decrease in performance with fewer robots. We believe this is explained by the fact that the samples are very similar with many steps per robot because of the relatively small time steps between them. This means that for the same amount of samples, there is less diversity in the data. In other words, with a low number of robots, we are further from the standard assumption that the samples are independent and identically distributed, which seems to have a noticeable effect on the training process. In terms of training time, we see a nearly linear scaling up to 4000 robots, after which simulation throughput gains slow down. As such, we can conclude that increasing the number of robots is beneficial for both final performance and training time, but there is an upper limit on this number after which an on-policy algorithm cannot learn effectively. Increasing the batch size to values much larger than what is typically used in similar works seems highly beneficial. Unfortunately, it also scales the training time so it is a trade-off that must be balanced. From the third plot we can conclude that using 2048 to 4096 robots with a batch size of $\approx 1 0 0 k$ or $\approx 2 0 0 k$ provides the best trade-off for this specific task.
95
+
96
+ ![](images/b511ee0c2aca987f5fa8e39a0d14f3ee54098cf431491e0a271f167d3bdcff6f.jpg)
97
+ Figure 4: (a) Average and standard deviation (over 5 runs) of the total reward of an episode after 1500 policy updates for different number of robots and 3 different batch sizes. The ideal case of a batch size of 1M samples with 20000 robots is shown in red. (b) Total training time for the same experiments. (c) Reward dependency on total training time. Colors represent the number of robots, while shapes show the batch size (circles: 49152, crosses: 98304, triangles: 196608). Points in the upper left part of the graph (highlighted in green) represent the most desirable configuration.
98
+
99
+ ![](images/f15e005bc1e3d3db64d82f1f7796d15a227032608677590845862fc30d3d7da3.jpg)
100
+ Figure 5: Success rate of the tested policy on increasing terrain complexities. Robots start in the center of the terrain and are given a forward velocity command of $0 . 7 5 \mathrm { m } / \mathrm { s }$ , and a side velocity command randomized within $[ - 0 . 1 , 0 . 1 ] \mathrm { m } / \mathrm { s }$ . (a) Success rate for climbing stairs, descending stairs and traversing discrete obstacles. (b) Success rate for climbing and descending sloped terrains.
101
+
102
+ ![](images/4eab7c74f6cac548026b3ff28e7f10ab6832f65e03b74ce577a9f1ea90202882.jpg)
103
+ Figure 6: ANYmal C with a fixed arm, ANYmal B, A1 and Cassie in simulation.
104
+
105
+ # 4.2 Simulation
106
+
107
+ For our simulation and deployment experiments, we use a policy trained with 4096 robots and a batch size of 98304, which we train for 1500 policy updates in under 20 minutes2. We begin by measuring the performance of our trained policy in simulation. To that end, we perform robustness and traversability tests. For each terrain type, we command the robots to traverse the representative difficulty of the terrain at high forward velocity and measure the success rate. A success is defined as managing to cross the terrain while avoiding any contacts on the robot’s base. Fig. 5 shows the results for the different terrains. For stairs, we see a nearly $1 0 0 \%$ success rate for steps up to $\mathrm { 0 . 2 m }$ , which is the hardest stair difficulty we train on and close to the kinematic limits of our robot. Randomized obstacles seem to be more demanding, with the success rate decreasing steadily. We must note that in this case, the largest step is double the reported height since neighboring obstacles can have positive and negative heights. In the case of slopes, we can observe that after $2 5 \mathrm { d e g }$ the robots are not able to climb anymore but still learn to slide down with a moderate success rate.
108
+
109
+ Given our relatively simple rewards and action space, the policy is free to adopt any gait and behavior. Interestingly, it always converges to a trotting gait, but there are often artifacts in the behavior, such as a dragging leg or unreasonably high or low base heights. After tuning of the reward weights, we can obtain a policy that respects all our constraints and can be transferred to the physical robot.
110
+
111
+ To verify the generalizability of the approach, we train policies for multiple robots with the same set-up. We use the ANYmal C robot with a fixed robotic arm, which adds about $2 0 \%$ of additional weight, and the ANYmal B robot, which has comparable dimensions but modified kinematic and dynamic properties. In these two cases, we can retrain a policy without any modifications to the rewards or algorithm hyper-parameters and obtain a very similar performance. Next, we use the Unitree A1 robot, which has smaller dimensions, four times lower weight, and a different leg configuration. In this case, we remove the actuator model of the ANYdrive motors, reduce PD gains and the torque penalties, and change the default joint configurations. We can train a dynamic policy that learns to solve the same terrains even with the reduced size of the robot. Finally, we apply our approach to Agility Robotics’ bipedal robot Cassie. We find that an additional reward encouraging standing on a single foot is necessary to achieve a walking gait. With this addition, we are able to train the robot on the same terrains as its quadrupedal counterparts. Fig. 6 shows the different robots.
112
+
113
+ ![](images/f0dd8a9ddc78c32773c604659ba9f56cbd659b68c879ccbb91f00fe6ccb27b59.jpg)
114
+ Figure 7: Locomotion policy, trained in under $2 0 \mathrm { { m i n } }$ , deployed on the physical robot.
115
+
116
+ # 4.3 Sim-to-real Transfer
117
+
118
+ On the physical robot, our policy is fixed. We compute the observations from the robot’s sensors, feed them to the policy, and directly send the produced actions as target joint positions to the motors. We do not apply any additional filtering or constraint satisfaction checks. The terrain height measurements are queried from an elevation map that the robot is building from Lidar scans.
119
+
120
+ Unfortunately, this height map is far from perfect, which results in a decrease in robustness between simulation and reality. We observe that these issues mainly occur at high velocities and therefore reduce the maximum linear velocity commands to $0 . 6 \mathrm { m } / \mathrm { s }$ for policies deployed on the hardware. The robot can walk up and down stairs and handles obstacles in a dynamic manner. We show samples of these experiments in Fig. 7 and in the supplementary video. To overcome issues with imperfect terrain mapping or state estimation drift, the authors of [19] implemented a teacher-student set-up, which provided outstanding robustness even in adverse conditions. As part of future work, we plan to merge the two approaches.
121
+
122
+ # 5 Conclusion
123
+
124
+ In this work, we demonstrated that a complex real-world robotics task can be trained in minutes with an on-policy deep reinforcement learning algorithm. Using an end-to-end GPU pipeline with thousands of robots simulated in parallel, combined with our proposed curriculum structure, we showed that the training time can be reduced by multiple orders of magnitude compared to previous work. We discussed multiple modifications to the learning algorithm and the standard hyper-parameters required to use the massively parallel regime effectively. Using our fast training pipeline, we performed many training runs, simplified the set-up, and kept only essential components. We showed that the task can be solved using simple observation and action spaces as well as relatively straightforward rewards without encouraging particular gaits or providing motion primitives.
125
+
126
+ The purpose of this work is not to obtain the absolute best-performing policy with the highest robustness. For that use case, many other techniques can be incorporated into the pipeline. We aim to show that a policy can be trained in record time with our set-up while still being usable on the real hardware. We wish to shift other researchers’ perspective on the required training time for a real-world application, and hope that our work can serve as a reference for future research. We expect many other tasks to benefit from the massively parallel regime. By reducing the training time of these future robotic tasks, we can greatly accelerate the developments in this field.
127
+
128
+ # Acknowledgments
129
+
130
+ We would like to thank Mayank Mittal, Joonho Lee, Takahiro Miki, and Peter Werner for their valuable suggestions and help with hardware experiments as well as the Isaac Gym and PhysX teams for their continuous support.
131
+
132
+ # References
133
+
134
+ [1] J. Hwangbo, J. Lee, A. Dosovitskiy, D. Bellicoso, V. Tsounis, V. Koltun, and M. Hutter. Learning agile and dynamic motor skills for legged robots. Science Robotics, 4(26), 2019.
135
+ [2] S. Gu, E. Holly, T. Lillicrap, and S. Levine. Deep reinforcement learning for robotic manipulation with asynchronous off-policy updates. In IEEE International Conference on Robotics and Automation (ICRA), May 2017.
136
+ [3] G. Kahn, A. Villaflor, B. Ding, P. Abbeel, and S. Levine. Self-supervised deep reinforcement learning with generalized computation graphs for robot navigation. In IEEE International Conference on Robotics and Automation (ICRA), 2018.
137
+ [4] OpenAI, I. Akkaya, M. Andrychowicz, M. Chociej, M. Litwin, B. McGrew, A. Petron, A. Paino, M. Plappert, G. Powell, R. Ribas, J. Schneider, N. Tezak, J. Tworek, P. Welinder, L. Weng, Q. Yuan, W. Zaremba, and L. Zhang. Solving rubik’s cube with a robot hand, 2019.
138
+ [5] E. Todorov, T. Erez, and Y. Tassa. Mujoco: A physics engine for model-based control. In IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), 2012.
139
+ [6] E. Coumans and Y. Bai. Pybullet, a python module for physics simulation for games, robotics and machine learning. http://pybullet.org, 2016–2021.
140
+ [7] J. Hwangbo, J. Lee, and M. Hutter. Per-contact iteration method for solving contact dynamics. IEEE Robotics and Automation Letters, 3(2), 2018. URL www.raisim.com.
141
+ [8] V. Makoviychuk, L. Wawrzyniak, Y. Guo, M. Lu, K. Storey, M. Macklin, D. Hoeller, N. Rudin, A. Allshire, A. Handa, and G. State. Isaac gym: High performance GPU based physics simulation for robot learning. In Conference on Neural Information Processing Systems (NeurIPS) Datasets and Benchmarks Track, 2021.
142
+ [9] N. Heess, D. TB, S. Sriram, J. Lemmon, J. Merel, G. Wayne, Y. Tassa, T. Erez, Z. Wang, S. M. A. Eslami, M. A. Riedmiller, and D. Silver. Emergence of locomotion behaviours in rich environments. CoRR, abs/1707.02286, 2017.
143
+ [10] A. Stooke and P. Abbeel. Accelerated methods for deep reinforcement learning. CoRR, abs/1803.02811, 2018.
144
+ [11] B. Shacklett, E. Wijmans, A. Petrenko, M. Savva, D. Batra, V. Koltun, and K. Fatahalian. Large batch simulation for deep reinforcement learning. In International Conference on Learning Representations (ICLR), 2021.
145
+ [12] J. Liang, V. Makoviychuk, A. Handa, N. Chentanez, M. Macklin, and D. Fox. Gpu-accelerated robotic simulation for distributed reinforcement learning. In Conference on Robot Learning (CoRL), 2018.
146
+ [13] C. D. Freeman, E. Frey, A. Raichuk, S. Girgin, I. Mordatch, and O. Bachem. Brax - a differentiable physics engine for large scale rigid body simulation. In 35th Conference on Neural Information Processing Systems (NeurIPS) Datasets and Benchmarks Track, 2021.
147
+ [14] A. Bouman, M. F. Ginting, N. Alatur, M. Palieri, D. D. Fan, T. Touma, T. Pailevanian, S.- K. Kim, K. Otsu, J. Burdick, and A.-a. Agha-Mohammadi. Autonomous spot: Long-range autonomous exploration of extreme environments with legged locomotion. In IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), 2020.
148
+ [15] C. Gehring, P. Fankhauser, L. Isler, R. Diethelm, S. Bachmann, M. Potz, L. Gerstenberg, and M. Hutter. Anymal in the field: Solving industrial inspection of an offshore hvdc platform with a quadrupedal robot. In Field and Service Robotics, 2021.
149
+ [16] J. Lee, J. Hwangbo, L. Wellhausen, V. Koltun, and M. Hutter. Learning quadrupedal locomotion over challenging terrain. Science Robotics, 5(47), 2020.
150
+ [17] V. Tsounis, M. Alge, J. Lee, F. Farshidian, and M. Hutter. Deepgait: Planning and control of quadrupedal gaits using deep reinforcement learning. IEEE Robotics and Automation Letters, PP, 03 2020.
151
+ [18] S. Gangapurwala, M. Geisert, R. Orsolino, M. Fallon, and I. Havoutis. Real-time trajectory adaptation for quadrupedal locomotion using deep reinforcement learning. In IEEE International Conference on Robotics and Automation (ICRA), 2021.
152
+ [19] T. Miki, J. Lee, L. Wellhausen, V. Koltun, and M. Hutter. Wild anymal: Robust zero-shot perceptive locomotion. Submitted to Science Robotics, 2021.
153
+ [20] J. Siekmann, K. Green, J. Warila, A. Fern, and J. W. Hurst. Blind bipedal stair traversal via sim-to-real reinforcement learning. CoRR, abs/2105.08328, 2021.
154
+ [21] C. Gregg and K. Hazelwood. Where is the data? why you cannot debate cpu vs. gpu performance without the answer. In IEEE International Symposium on Performance Analysis of Systems and Software (ISPASS), 2011.
155
+ [22] J. Schulman, F. Wolski, P. Dhariwal, A. Radford, and O. Klimov. Proximal policy optimization algorithms. CoRR, abs/1707.06347, 2017.
156
+ [23] J. Schulman, P. Moritz, S. Levine, M. Jordan, and P. Abbeel. High-dimensional continuous control using generalized advantage estimation. In Proceedings of the International Conference on Learning Representations (ICLR), 2016.
157
+ [24] F. Pardo, A. Tavakoli, V. Levdik, and P. Kormushev. Time limits in reinforcement learning. CoRR, abs/1712.00378, 2017.
158
+ [25] G. Brockman, V. Cheung, L. Pettersson, J. Schneider, J. Schulman, J. Tang, and W. Zaremba. Openai gym, 2016.
159
+ [26] A. Hill, A. Raffin, M. Ernestus, A. Gleave, A. Kanervisto, R. Traore, P. Dhariwal, C. Hesse, O. Klimov, A. Nichol, M. Plappert, A. Radford, J. Schulman, S. Sidor, and Y. Wu. Stable baselines. https://github.com/hill-a/stable-baselines, 2018.
160
+ [27] J. Achiam. Spinning up in deep reinforcement learning, 2018. URL https://spinningup. openai.com/en/latest/.
161
+ [28] R. Wang, J. Lehman, J. Clune, and K. O. Stanley. Paired open-ended trailblazer (POET): endlessly generating increasingly complex and diverse learning environments and their solutions. CoRR, abs/1901.01753, 2019.
162
+ [29] Z. Xie, H. Y. Ling, N. H. Kim, and M. van de Panne. Allsteps: Curriculum-driven learning of stepping stone skills. Proceedings of ACM SIGGRAPH / Eurographics Symposium on Computer Animation, 2020.
163
+ [30] C. Florensa, D. Held, X. Geng, and P. Abbeel. Automatic goal generation for reinforcement learning agents. In Proceedings of the 35th International Conference on Machine Learning (ICML), volume 80 of Proceedings of Machine Learning Research, 2018.
md/train/x9jS8pX3dkx/x9jS8pX3dkx.md ADDED
@@ -0,0 +1,211 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Gradient Inversion with Generative Image Prior
2
+
3
+ Jinwoo $\mathbf { J e o n ^ { 1 * } }$ , Jaechang $\mathbf { K i m ^ { 2 * } }$ , Kangwook $\mathbf { L e e ^ { 3 } }$ , Sewoong $\mathbf { O h ^ { 4 } }$ , Jungseul $\mathbf { O k } ^ { 1 , 2 }$
4
+ 1 Department of Computer Science & Engineering, Pohang University of Science and Technology 2 Graduate School of Artificial Intelligence, Pohang University of Science and Technology
5
+ 3 Department of Electrical and Computer Engineering, University of Wisconsin-Madison, Madison 4 Paul G. Allen School of Computer Science & Engineering, University of Washington
6
+
7
+ # Abstract
8
+
9
+ Federated Learning (FL) is a distributed learning framework, in which the local data never leaves clients’ devices to preserve privacy, and the server trains models on the data via accessing only the gradients of those local data. Without further privacy mechanisms such as differential privacy, this leaves the system vulnerable against an attacker who inverts those gradients to reveal clients’ sensitive data. However, a gradient is often insufficient to reconstruct the user data without any prior knowledge. By exploiting a generative model pretrained on the data distribution, we demonstrate that data privacy can be easily breached. Further, when such prior knowledge is unavailable, we investigate the possibility of learning the prior from a sequence of gradients seen in the process of FL training. We experimentally show that the prior in a form of generative model is learnable from iterative interactions in FL. Our findings strongly suggest that additional mechanisms are necessary to prevent privacy leakage in FL.
10
+
11
+ # 1 Introduction
12
+
13
+ Federated learning (FL) is an emerging framework for distributed learning, where central server aggregates model updates, rather than user data, from end users [5, 17]. The main premise of federated learning is that this particular way of distributed learning can protect users’ data privacy as there is no explicit data shared by the end users with the central server.
14
+
15
+ However, a recent line of work [34, 31, 9, 29] demonstrates that one may recover the private user data used for training by observing the gradients. This process of recovering the training data from gradients, so-called gradient inversion, poses a huge threat to the federated learning community, as it may imply the fundamental flaw of its main premise.
16
+
17
+ Even more worryingly, recent works suggest that such gradient inversion attacks can be made even stronger if certain side-information is available. For instance, Geiping et al. [9] show that if the attacker knows a prior that user data consists of natural images, then the gradient inversion attack can leverage such prior, achieving a more accurate recovery of the user data. Another instance is when batch norm statistics are available at the attacker in addition to gradients. This can actually happen if the end users share their local batch norm statistics as in [17]. Yin et al. [29] show that such batch normalization statistics can significantly improve the strength of the gradient inversion attack, enabling precise recovery of high-resolution images.
18
+
19
+ In this paper, we systematically study how one can maximally utilize and even obtain the prior information when inverting gradients. We first consider the case that the attacker has a generative model pretrained on the exact or approximate distribution of the user data as a prior. For this, we propose an efficient gradient inversion algorithm that utilizes the generative model prior. In particular, the algorithm consists of two steps, in which the first step searches the latent space (of lower dimension) defined by the generative model instead of the ambient input space (of higher dimension), and then the second step adapts the generative model to each input given the gradient. Each step provides substantial improvement in the reconstruction. We name the algorithm as gradient inversion in alternative spaces (GIAS). Figure 1 represents reconstruction results with the proposed method and existing one.
20
+
21
+ ![](images/b81bb14fb3a48de6867d8a38581f8cf29cb13a06887b9c8990eaed2b11ce75bc.jpg)
22
+ existing method [9]
23
+ Figure 1: An example showing the superiority of GIAS compared to existing method. Images of the authors are reconstructed from gradients by exploiting a generative model pretrained on human face images.
24
+
25
+ We then consider a realistic scenario in which the user data distribution is not known in advance, and thus the attacker needs to learn it from gradients. For this scenario, we develop a meta-learning framework, called gradient inversion to meta-learn (GIML), which learns a generative model on user data from observing and inverting multiple gradients computed on the data, e.g. across different FL epochs or participating nodes. Our experimental results demonstrate that one can learn a generative model via GIML and reconstruct data by making use of the learned generative model.
26
+
27
+ This implies a great threat on privacy leakage in FL since our methods can be applied for any data type in most FL scenarios unless a specialized architecture prevents the gradient leakage explicitly, e.g., [18].
28
+
29
+ Our main contributions are as follows:
30
+
31
+ • We introduce GIAS that fully utilizes a pretrained generative model to invert gradient. In addition, we propose GIML which can train generative model from gradients only in FL. • We demonstrate significant privacy leakage occurring by GIAS with a pretrained generative model in various FL scenarios which are challenging to other existing methods, e.g., [9, 29]. • We experimentally show that GIML can learn a generative model on the user data from only gradients, which provides the same level of data recovery with a given pretrained model. To our best knowledge, GIML is the first capable of learning explicit prior on a set of gradient inversion tasks. We note that a gradient inversion technique defines a standard on defence mechanism in FL for privacy [28]. By substantiating that our proposed methods are able to break down defense mechanisms that were safe according to the previous standard, we give a strong warning to the FL community to use a higher standard defined by our attack methods, and raise the necessity of a more conservative choice of defense mechanisms.
32
+
33
+ # 2 Related work
34
+
35
+ Privacy attacks in FL. Early works [19, 24] investigate membership inference from gradients to check the possibility of privacy leakage in FL. Phong et al. [21] demonstrate that it is possible to reconstruct detailed input image when FL trains a shallow network such as single-layer perceptron. Fan et al. [7] and Zhu and Blaschko [32] consider a wider class of learning model and propose an analytical approach solving a sequence of linear systems to reveal the output of each layer recursively. To study the limit of the gradient inversion in practical scenarios of training deep networks via FL, a sequence of effort has been made formulating optimization problem to minimize discrepancy comparing gradients from true data and reconstructed data [9, 27, 29, 31, 34].
36
+
37
+ Gradient inversion with prior. The optimization-based approaches are particularly useful as one can easily utilize prior knowledge by adding regularization terms, e.g., total variation [27, 9] and BN statistics [29], or changing discrepancy measure [9] . In [29], a privacy attack technique using a generative model is introduced. They however require a pretrained model, while we propose a meta learning framework training generative model from gradients only. In addition, our method of inverting gradient maximally exploit a given generative model by alternating search spaces, which are analogous to the state-of-the-art GAN inversion techniques [3, 4, 33].
38
+
39
+ Generative model revealing private data. Training a generative model with transmitted gradients also demonstrates privacy leakage in FL. Hitaj et al. [11] introduce an algorithm to train a GAN regarding shared model in FL framework as a discriminator. Wang et al. [27] use reconstructed data from gradient to train a GAN. Those works require some auxiliary dataset given in advance to enable the training of GAN, while we train a generative model using transmitted gradients only. Also, we not only train a generative model but also utilize it for reconstruction, while the generative models in [11, 27] are not used for the reconstruction. Hence, in our approach, the generative model and reconstruction can be improved interactively to each other as shown in Figure 6. In addition, [27] is less sample-efficient than ours in a sense that they use gradients to reconstruct images and then train a generative model with the reconstructed images, i.e., if the reconstruction fails, then the corresponding update of the generative model fails too, whereas we train the generative model directly from gradients.
40
+
41
+ # 3 Problem formulation
42
+
43
+ In this section, we formally describe the gradient inversion (GI) problem. Consider a standard supervised learning for classification, which optimizes neural network model $f _ { \theta }$ parameterized by $\theta$ as follows:
44
+
45
+ $$
46
+ \operatorname* { m i n } _ { \theta } \sum _ { ( x , y ) \in \mathcal { D } } \ell ( f _ { \theta } ( x ) , y ) \ ,
47
+ $$
48
+
49
+ where $\ell$ is a point-wise loss function and $\mathcal { D }$ is a dataset of input $x \in \mathbb { R } ^ { m }$ and label $y \in \{ 0 , 1 \} ^ { L }$ (one-hot vector). In federated learning framework, each node reports the gradient of $\ell ( f _ { \theta } ( x ) , y )$ for sampled data $( x , y )$ ’s instead of directly transferring the data. The problem of inverting gradient is to reconstruct the sampled data used to compute the reported gradient. Specifically, when a node computes the gradient $g$ using a batch $\{ ( x _ { 1 } ^ { * } , y _ { 1 } ^ { * } ) , . . . , ( x _ { B } ^ { * } , y _ { B } ^ { * } ) \}$ , i.e., $\begin{array} { r } { \boldsymbol { g } = \frac { \top } { B } \sum _ { j = 1 } ^ { B } \dot { \nabla } \ell ( f _ { \theta } ( x _ { j } ^ { * } ) , y _ { j } ^ { * } ) } \end{array}$ we consider the following problem of inverting gradient:
50
+
51
+ $$
52
+ \operatorname* { m i n } _ { ( x _ { 1 } , y _ { 1 } ) , \cdots , ( x _ { B } , y _ { B } ) } d \left( \frac { 1 } { B } \sum _ { j = 1 } ^ { B } \nabla \ell ( f _ { \theta } ( x _ { j } ) , y _ { j } ) , g \right) \ ,
53
+ $$
54
+
55
+ where $d ( \cdot , \cdot )$ is a measure of the discrepancy between two gradient, e.g., $\ell _ { 2 }$ -distance [34, 29] or negative cosine similarity [9]. It is known that label $y$ can be almost accurately recovered by simple methods just observing the gradient at the last layer [31, 29], while reconstructing input $x$ remains still challenging as it is often under-determined even when the true label is given. For simplicity, we hence focus on the following minimization to reveal the inputs from the gradient given the true labels:
56
+
57
+ $$
58
+ \operatorname* { m i n } _ { \substack { x _ { 1 } , \ldots , x _ { B } \in \mathbb { R } ^ { m } } } c \left( x _ { 1 } , . . . , x _ { B } ; \theta , g \right) ,
59
+ $$
60
+
61
+ where we denote by $c \left( x _ { 1 } , . . . , x _ { B } ; \theta , g \right)$ the cost function in (2) given $y _ { j } = y _ { j } ^ { * }$ for each $j = 1 , . . . , B$
62
+
63
+ # 4 Methods
64
+
65
+ The key challenge of inverting gradient is that solving (2) is often under-determined, i.e., a gradient contains only insufficient information to recover data. Such an issue is observed even when the dimension of gradient is much larger than that of input data. Indeed, Zhu and Blaschko [32] show that there exist a pair of different data having the same gradient, so called twin data, even when the learning model is large. To alleviate this issue, a set of prior knowledge on the nature of data can be considered.
66
+
67
+ When inverting images, Geiping et al. [9] propose to add the total variation regularization $R _ { \mathrm { T V } } ( x )$ to the cost function in (3) since neighboring pixels of natural images are likely to have similar values. More formally,
68
+
69
+ $$
70
+ R _ { \mathrm { T V } } ( x ) : = \sum _ { ( i , j ) } \sum _ { ( i ^ { \prime } , j ^ { \prime } ) \in \partial ( i , j ) } \Vert x ( i , j ) - x ( i ^ { \prime } , j ^ { \prime } ) \Vert ^ { 2 } ,
71
+ $$
72
+
73
+ where $\partial ( i , j )$ is the set of neighbors of $( i , j )$ . This method is limited to the natural image data.
74
+
75
+ For general type of data, one can consider exploiting the batch normalization (BN) statistics from nodes. This is available in the case that the server wants to utilize batch normalization (BN) in $\mathrm { F L }$ , and thus collects the BN statistics (mean and variance) of batch from each node, in addition, with every gradient report [17]. To be specific, Yin et al. [29] propose to employ the regularizer $R _ { \mathrm { B N } } ( x _ { 1 } , . . . , x _ { B } ; \theta )$ which quantifies the discrepancy between the BN statistics of estimated $x _ { j }$ ’s and those of true $\boldsymbol { x } _ { j } ^ { * }$ ’s on each layer of the learning model. More formally,
76
+
77
+ $$
78
+ R _ { \mathrm { B N } } ( x _ { 1 } , . . . , x _ { B } ; \theta ) : = \sum _ { l } \| \mu _ { l } - \mu _ { l , \mathrm { e x a c t } } \| _ { 2 } + \| \sigma _ { l } ^ { 2 } - \sigma _ { l , \mathrm { e x a c t } } ^ { 2 } \| _ { 2 } ,
79
+ $$
80
+
81
+ where $\mu _ { l } ( x _ { 1 } , . . . , x _ { B } ; \theta )$ and $\sigma _ { l } ^ { 2 } ( x _ { 1 } , . . . , x _ { B } ; \theta )$ (resp. $\mu _ { l , \mathrm { { e x a c t } } } ( x _ { 1 } ^ { * } , . . . , x _ { B } ^ { * } ; \theta )$ and $\sigma _ { l , \mathrm { { e x a c t } } } ^ { 2 } ( x _ { 1 } ^ { * } , . . . , x _ { B } ^ { * } ; \theta ) )$ are the mean and variance of $l$ -th layer feature maps for the estimated batch $x _ { 1 } , . . . , x _ { B }$ (resp. the true batch $x _ { 1 } ^ { * } , . . . , x _ { B } ^ { * } )$ given $\theta$ . This is available only if clients agree to report their exact BN statistics at every round. But not every FL framework report BN statistics [15, 2]. In that case, Yin et al. [29] also propose to use the BN statistics over the entire data distribution as a proxy of the true BN statistics, and reports that the gain from the approximated BN statistics is comparable to that from the exact ones. The applicability of $R _ { \mathrm { B N } }$ with the approximated BN statistics is still limited as the proxy needs to be additionally recomputed over the entire data distribution at every change of $\theta$ . However, this demonstrates the significant impact of knowing the data distribution in the gradient inversion and motivates our methods using and learning a generative model on the user data, described in what follows.
82
+
83
+ # 4.1 Gradient inversion with trained generative model
84
+
85
+ Consider a decent generative model $G _ { w } : \mathbb { R } ^ { k } \mapsto \mathbb { R } ^ { m }$ trained on the approximate (possibly exact) distribution of user data $\mathcal { D }$ such that $x ^ { * } \approx G _ { w } ( z ^ { * } )$ for $( x ^ { \ast } , \cdot ) \in \bar { \mathcal { D } }$ and its latent code $z ^ { * } =$ $\mathrm { a r g m i n } _ { z } \| G _ { w } ( z ) - x ^ { * } \|$ . To fully utilize such a pretrained generative model, we propose gradient inversion in alternative spaces (GIAS), of which pseudocode is presented in Appendix A, which performs latent space search over $z$ and then parameter space search over $w$ . We also illustrate the overall procedure of GIAS in Figure 2.
86
+
87
+ Latent space search. Note that the latent space is typically much smaller than the ambient input space, i.e., $k \ll m$ , for instances, DCGAN [25] of $k = 1 0 0$ and StyleGAN [12] of $k = 5 1 2 \times 1 6$ for image data of $m = ( \mathrm { w i d t h } ) \times ( \mathrm { h e i g h t } ) \times ( \mathrm { c o l o r } )$ such as $3 2 \times 3 2 \times 3$ , $2 5 6 \times 2 5 6 \times 3$ , or larger. Using such a pretrained generative model with $k \ll m$ , the under-determined issues of (3) can be directly mitigated by narrowing down the searching space from $\mathbb { R } ^ { m }$ to $\{ G _ { w } ( z ) : z \in \mathbb { R } ^ { k } \}$ . Hence, GIAS first performs the latent space search in the followings:
88
+
89
+ $$
90
+ \operatorname* { m i n } _ { \substack { z _ { 1 } , \ldots , z _ { B } \in \mathbb { R } ^ { k } } } c \left( G _ { w } ( z _ { 1 } ) , . . . , G _ { w } ( z _ { B } ) \right) .
91
+ $$
92
+
93
+ Considering a canonical class of neural network model $f _ { \theta }$ , we can show that the reconstruction of $x ^ { * }$ by latent space search in (5) aligns with that by input space search in (3) if the generative model $G _ { w }$ approximates input data with small enough error.
94
+
95
+ ![](images/86214e463c23aef68db3947ced6b1f76f55c86ba1e2dd66943856f0c1dfa79be.jpg)
96
+ Figure 2: An overview of GIAS. GIAS optimizes a latent code $z$ and generative model parameters $w$ to reconstruct the data which matches the gradient.
97
+
98
+ Property 1. For an input data $x ^ { * } \in [ 0 , 1 ] ^ { m }$ consider the gradient inversion problem of minimizing cost c in (3), where a canonical form of deep learning for classification is considered and the discrepancy measure $d$ is $\ell _ { 2 }$ -distance. Suppose that it has the unique global minimizer at $x ^ { * }$ . Let $\varepsilon \geq 0$ be the approximation error bound on $x ^ { * }$ for generative model $\mathring { G } _ { w } : [ 0 , 1 ] ^ { k } \mapsto [ 0 , 1 ] ^ { m }$ Then, there exists $\delta ( \varepsilon ) \geq 0$ such that for any $z ^ { * } \in \arg \operatorname* { m i n } _ { z } c ( G _ { w } ( z ) ) ,$ ,
99
+
100
+ $$
101
+ \| G _ { w } ( z ^ { * } ) - x ^ { * } \| \leq \delta ( \varepsilon ) ,
102
+ $$
103
+
104
+ of which upper bound $\delta ( \varepsilon ) 0$ as $\varepsilon \to 0$ .
105
+
106
+ A rigorous statement of Property 1 and its proof are provided in Appendix B, where we prove and use that the cost function is continuous around $x ^ { * }$ under the assumptions. This property justifies solving the latent space search in (5) for $\mathrm { F L }$ scenarios training neural network model while it requires an accurate generative model.
107
+
108
+ Parameter space search. Using the latent space search only, there can be inevitable reconstruction error due to the imperfection of generative model. This is mainly because we cannot perfectly prepare the generative model for every plausible data in advance. Similar difficulty of the latent space search has been reported even when inverting GAN [33, 3, 4] for plausible but new data directly, i.e., $\mathrm { m i n } _ { z } \parallel G _ { w } ( z ) - x ^ { * } \parallel$ given $x ^ { * }$ , rather than inverting gradient. Bau et al. [3] propose an instance-specific model adaptation, which slightly adjusts the model parameter $w$ to (a part of source image) $x ^ { * }$ after obtaining a latent code $z ^ { * }$ for $x ^ { * }$ . Inspired by such an instance-specific adaptation, GIAS performs the following parameter space search over $w$ preceded by the latent space search over $z$ :
109
+
110
+ $$
111
+ \operatorname * { m i n } _ { w _ { 1 } , . . . , w _ { B } } \ c \left( G _ { w _ { 1 } } ( z _ { 1 } ) , . . . , G _ { w _ { B } } ( z _ { B } ) \right) \ ,
112
+ $$
113
+
114
+ where $z _ { 1 } , \dots , z _ { B }$ are obtained from (5).
115
+
116
+ Remark. We propose the optimization over $w$ followed by that over $z$ sequentially This is to maximally utilize the benefit of mitigating the under-determined issue from reducing the searching space on the pretrained model. However, the benefit would be degenerated if $z$ and $w$ are optimized jointly or $w$ is optimized first. We provide an empirical justification on the proposed searching strategy in Section 5.1.
117
+
118
+ We perform each search in GIAS using a standard gradient method to the cost function directly. It is worth noting that those optimizations (5) and (7) with generative model can be tackled in a recursive manner as R-GAP [32] reconstructs each layer from output to input. We provide details and performance of the recursive procedure in Appendix C, where employing generative model improves the inversion accuracy of R-GAP substantially, while R-GAP apparently suffers from an error accumulation issue when $f _ { \theta }$ is a deep neural network.
119
+
120
+ ![](images/3e98af5f62fd12872d10b40932ee68ec2b13001baf19a78e4df336bdfc8cd337.jpg)
121
+ Figure 3: Comparison of different searching spaces. (a) Each row shows reconstructed images of different optimization domains. The first three rows share the same latent space search of 1, 500 iterations, and ${ \mathrm { G I } } { - z } / w$ is verified to be the best option to fully exploits the knowledge inside the generative model. (b) Cost function over iterations of different optimization domains.
122
+
123
+ # 4.2 Gradient inversion to meta-learn generative model
124
+
125
+ For the case that pretrained generative model is unavailable, we devise an algorithm to train a generative model $G _ { w }$ for a set $\mathcal { S } = \{ ( \theta _ { i } , g _ { i } ) \}$ of gradient inversion tasks. Since each inversion task can be considered as a small learning task to adapt generative model per data, we hence call it gradient inversions to meta-learn (GIML). The detailed procedure of GIML is presented in Appendix A. We start with an arbitrary initialization of $w$ , and iteratively update toward $w ^ { \prime }$ from a variant of GIAS for $N$ tasks sub-sampled from $s$ , which is different than multiple applications of GIAS for each task in two folds: (i) $\ell _ { 2 }$ -regularization in latent space search; and (ii) an integrated optimization on model parameter. The variant first finds optimal latent codes $\boldsymbol { z } _ { i } ^ { * } = ( z _ { i 1 } ^ { * } , . . . , z _ { i B } ^ { * } )$ for each task $i$ with respect to the same cost function of GIAS but additional $\ell _ { 2 }$ -regularization. Note that the latent space search with untrained generative model easily diverges. The $\ell _ { 2 }$ -regularization is added to prevent the divergence of $z _ { i } ^ { * }$ . Once we obtained $z _ { i } ^ { * }$ ’s, $w ^ { \prime }$ is computed by few steps of gradient descents for an integrated parameter search to minimize $\begin{array} { r } { \sum _ { i } c ( G _ { w ^ { \prime } } ( z _ { i 1 } ^ { * } ) , . . . , \bar { G } _ { w ^ { \prime } } ( z _ { i B } ^ { * } ) ; \theta _ { i } , g _ { i } ) } \end{array}$ . This is because in GIML, we want meta information $w$ to help GIAS for each task rather than solving individual tasks, while after performing GIML to train $w$ , we perform GIAS to invert gradient with the trained $w$ . This is analogous to the Reptile in [20].
126
+
127
+ # 5 Experiments
128
+
129
+ Setup. Unless stated otherwise, we consider the image classification task on the validation set of ImageNet [22] dataset scaled down to $6 4 \times 6 4$ pixels (for computational tractability) and use a randomly initialized ResNet18 [10] for training. For deep generative models in GIAS, we use StyleGAN2 [13] trained on ImageNet. We use a batch size of $B \ = \ 4$ as default and use the negative cosine to measure the gradient dissimilarity $d ( \cdot , \cdot )$ . We present detailed setup in Appendix H. Our experiment code is available at https://github.com/ml-postech/ gradient-inversion-generative-image-prior.
130
+
131
+ Algorithms. We evaluate several algorithms for the gradient inversion (GI) task in (3). They differ mainly in which spaces each algorithm searches over: the input $x$ , the latent code $z$ , and/or the model parameter $w$ . Each algorithm is denoted by GI-(·), where the suffix indicates the search space(s). For instances, GI- $z / w$ is identical to the proposed method, GIAS, and GI- $x$ is the one proposed by Geiping et al. [9].
132
+
133
+ ![](images/05927611c6cf240c845850b9daf59ed7a0462bf6d541e6a943eb9a3ea192a47a.jpg)
134
+ Figure 4: Comparison of state-of-the-art models and ours. Replacing GI- $x$ with GI- $z / w$ (GIAS) regardless of using BN [29] or not [9] provides substantial improvement in the reconstruction accuracy. (a) Average PSNR and best PSNR in a batch throughout the experiments. (b) An ablation study and comparison of reconstruction results with our models and state-of-the-art models. We highlight the proposed models in bold.
135
+
136
+ Table 1: Comparison of our methods with state-of-the-art methods. Adding our method makes performance improvement versus two baseline methods. PSNR, SSIM, and LPIPS[30] are used to evaluate reconstruction results. We highlight the best performances in bold.
137
+
138
+ <table><tr><td>Method</td><td>GI-x [9]</td><td>GI-z (ours)</td><td>GI-w (ours)</td><td>GI-z/w (GIAS,ours)</td><td>GI-x+BN[29]</td><td>GI-z/w+BN (ours)</td></tr><tr><td>PSNR↑</td><td>13.78</td><td>14.27</td><td>14.70</td><td>15.58</td><td>15.52</td><td>16.31</td></tr><tr><td>SSIM↑</td><td>0.2542</td><td>0.3106</td><td>0.3519</td><td>0.3895</td><td>0.3513</td><td>0.4311</td></tr><tr><td>LPIPS↓</td><td>0.4376</td><td>0.3233</td><td>0.5121</td><td>0.3023</td><td>0.3645</td><td>0.2861</td></tr></table>
139
+
140
+ # 5.1 Justification of GIAS design
141
+
142
+ We first provide an empirical justification of the specific order of searching spaces in GIAS (corresponding to $\mathbf { G I } { - } z / w ,$ ) to fully utilize a pretrained generative model. To do so, we provide Figure 4b comparing algorithms with different searching spaces: GI- $z / w$ , GI- $z / x$ , $\mathrm { G I } { - } z$ , and $_ { \mathrm { G I - } x }$ , of which the first three share the same latent space search over $z$ for the first 1, 500 iterations. As shown in Figure 3(a), the latent space search over $z$ quickly finds plausible image in a much shorter number of iterations than GI- $x$ , while it does not improve after a certain point due to the imperfection of pretrained generative model. Such a limitation of $\mathrm { G I } { - } z$ is also captured in Figure 3(b), where the cost function of GI- $z$ is not decreasing after a certain number of optimization steps. To further minimize the cost function, one alternative to GI- $z / w$ (GIAS) is ${ \mathrm { G I } } { - } z / x$ , which can further reduce the loss function whereas the parameter search in GI- $z / w$ seems to provide more natural reconstruction of the image than ${ \mathrm { G I } } { - } z / { \bar { x } }$ . The superiority of ${ \mathrm { G I } } { - z } / w$ over ${ \mathrm { G I } } { - } z / x$ may come from that the parameter space search exploits an implicit bias from optimizing a good architecture for expressing images, c.f., deep image prior [26]. In Appendix E and Figure 1, we also present the same comparison on FFHQ (human-face images) [12] where diversity is much smaller than that of ImageNet. On such a less diverse dataset, the distribution can be easily learned, and the gain from training a generative model is larger.
143
+
144
+ # 5.2 The gain from fully exploiting pretrained generative model
145
+
146
+ Comparison with state-of-the-art models. Our method can be easily added to previous methods [9, 29]. In Table 1 and Figure 4, we compare the state-of-the-art methods both with and without the proposed generative modelling. In Table 1, comparing GI- $x$ to ${ \mathrm { G I } } { - } z / w$ and GI- $x + { \tt B N }$ to ${ \mathrm { G I } } { - } z / w +$ BN, adding the proposed generative modelling provides additional gain in terms of all the measures (PSNR, SSIM, LPIPS) of reconstruction quality. GI- $z / w$ without BN has lower reconstruction error than GI- $x + { \tt B N }$ , which is the method of [29]. This implies that the gain from the generative model is comparable to that from BN statistics. However, while the generative model only requires a global (and hence coarse) knowledge on the entire dataset, BN statistics are local to the batch in hand and hence requires significantly more detailed information on the exact batch used to compute gradient.
147
+
148
+ ![](images/eaebaa7d2c36a894aebb95c062ddacad082b8c4df28b7ce3593656951181c37f.jpg)
149
+ Figure 5: Comparison of state-of-the-art models and $G I - z / w$ with varying difficulties. Larger batch size, higher sparsity, and larger gradient noise increases reconstruction difficulty. GI- $z / w$ always surpasses GI- $x$ thanks to the pretrained generative model. All subfigures share the y-axis.
150
+
151
+ As shown in Figure 4, the superiority of our method compared to the others is clear in terms of the best-in-batch performance than the average one, where the former is more suitable to show actual privacy threat in the worst case than the latter. It is also interesting to note that GI- $w$ with untrained $w$ provides substantial gain compared to GI- $x$ . This may imply that there is a gain of the implicit bias, c.f., [26], from training the architecture of deep generative model.
152
+
153
+ Evaluation against possible defense methods We evaluate the gain of using a generative model for various FL scenarios with varying levels of difficulty in the inversion. As batch size, gradient sparsity1 [28] and gradient noise level increase, the risk of having under-determined inversion increases and the inversion task becomes more challenging. Figure 5 shows that for all the levels of difficulty, the generative model provides significant gain in reconstruction quality. In particular, the averaged PSNR of GI- $x$ with a batch size of 4 is comparable to that of ${ \mathrm { G I } } { - z } / w$ with a batch size 32. It is also comparable to that of ${ \mathrm { G I } } { - z } / w$ with a gradient sparsity of $9 9 \%$ . To measure the impact of the noisy gradient, we experimented gradient inversion with varying gaussian noise level in aforementioned settings. Figure 5(c) shows that adding enough noise to the gradient can mitigate the privacy leakage. GI- $z / w$ with a noise level of 0.01, which is relatively large, still surpasses GI- $_ x$ without noise. A large noise of 0.1 can diminish the gain of exploiting a pretrained generative model. However, the fact that adding large noise to the gradient slows down training makes it difficult for FL practitioners to choose suitable hyperparameters. The results imply our method is more robust to defense methods against gradient inversion, but can be blocked by a high threshold. Note that our results of gradient sparsity and gradient noise implies the Differential Privacy(DP) is still a valid defense method, when applied with a more conservative threshold. For more discussion about possible defense methods in FL framework, see Appendix F.
154
+
155
+ # 5.3 Learning generative model from gradients
156
+
157
+ We demonstrate the possibility of training a generative model only with gradients. For computational tractability, we use DCGAN and images from FFHQ [12] resized to $3 2 \mathbf { x } 3 2$ . We generate a set of gradients from 4 rounds of gradient reports from 200 nodes, in which node computes gradient for a classification task based on the annotation provided in [6]. From the set of gradients, we perform GIML to train a DCGAN to potentially generate FFHQ data.
158
+
159
+ Figure 6 shows the evolution of generative model improves the reconstruction quality when performing either $\mathrm { G I } { - } z$ and ${ \mathrm { G I } } { - z } / w$ . We can clearly see the necessity of parameter space search. Figure 6(a) shows that the quality of images from the generative model is evolving in the training process of GIML. As the step $t$ of GIML increases, the generative model $G _ { w ^ { ( t ) } } ( z )$ for arbitrary $z$ outputs more plausible image of human face. When using generative model trained on wrong dataset (CIFAR10), GI- $z$ completely fails at recovering data.
160
+
161
+ ![](images/11a9bf0deccf6f26645320b1714e23bf518f3cf71177c576ecd107d8a4e5a1fa.jpg)
162
+ Figure 6: Qualitative and quantitative result of GIML. (a) Results validating generative model trained with GIML. Images on the first row are sampled from different GIML training steps. The same latent code $z$ was used to sample images in same rows. Images on the second row and third row are results of $\mathrm { G I } { - } z$ and GI- $z / w$ using generative model trained with GIML and pretrained model which is trained with CIFAR10 images. Experiments were done with gradient sparsity 0.95 for comparison in difficult setting. Last column represents the ground truth image and result of GI- $\boldsymbol { w }$ with untrained model. (b) A comparison of GIAS with meta-learned generative model and GIAS using improper generative model. Proper generative model boosts GIAS performance.
163
+
164
+ In Figure $6 ( \mathbf { b } )$ , as GIML iteration step increases, the performance of $\mathrm { G I } { - } z$ and ${ \mathrm { G I } } { - z } / w$ with GIML surpass GI- $z$ and ${ \mathrm { G I } } { - z } / w$ with wrong prior knowledge. GI- $z / w$ using generative model trained on wrong dataset and GI- $\boldsymbol { \cdot } \boldsymbol { w }$ which starts with an untrained generative model show lower averaged PSNR compared to ${ \mathrm { G I } } { - z } / w$ with GIML. GI- $z / w$ with GIML to train generative model on right data shows the best performance in terms of not only quality (Figure 6) but also convergence speed. We provide a comparison of the convergence speed in Appendix G.
165
+
166
+ # 6 Conclusion
167
+
168
+ We propose GIAS fully exploit the prior information on user data from a pretrained generative model when inverting gradient. We demonstrate significant privacy leakage using GIAS with pretrained generative model in various challenging scenarios, where our method provides substantial gain additionally to any other existing methods [9, 29]. In addition, we propose GIML which can train a generative model using only the gradients seen in the FL classifier training. We experimentally show that GIML can meta-learn a generative model on the user data from only gradients, which improves the quality of each individual recovered image. To our best knowledge, GIML is the first capable of learning explicit prior on a set of gradient inversion tasks.
169
+
170
+ # Acknowledgments
171
+
172
+ This work was partly supported by Institute of Information & communications Technology Planning & Evaluation (IITP) grant funded by the Korea government (MSIT) (No. 2019-0-01906, Artificial Intelligence Graduate School Program (POSTECH)) and (No. 2021-0-00739, Development of Distributed/Cooperative AI based $^ { 5 \mathrm { G } + }$ Network Data Analytics Functions and Control Technology). Jinwoo Jeon and Jaechang Kim were supported by the Institute of Information & Communications Technology Planning & Evaluation (IITP) grant funded by Korea(MSIT) (2020-0-01594, PSAI industry-academic joint research and education program). Kangwook Lee was supported by NSF/Intel Partnership on Machine Learning for Wireless Networking Program under Grant No. CNS-2003129 and NSF Award DMS-2023239. Sewoong Oh acknowledges funding from NSF IIS-1929955, NSF CCF 2019844, and Google faculty research award.
173
+
174
+ # References
175
+
176
+ [1] R. Abdal, Y. Qin, and P. Wonka. Image2stylegan++: How to edit the embedded images? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR),
177
+
178
+ June 2020.
179
+ [2] M. Andreux, J. O. du Terrail, C. Beguier, and E. W. Tramel. Siloed federated learning for multi-centric histopathology datasets. In S. Albarqouni, S. Bakas, K. Kamnitsas, M. J. Cardoso, B. Landman, W. Li, F. Milletari, N. Rieke, H. Roth, D. Xu, and Z. Xu, editors, Domain Adaptation and Representation Transfer, and Distributed and Collaborative Learning, pages 129–139, Cham, 2020. Springer International Publishing. ISBN 978-3-030-60548-3.
180
+ [3] D. Bau, H. Strobelt, W. Peebles, J. Wulff, B. Zhou, J.-Y. Zhu, and A. Torralba. Semantic photo manipulation with a generative image prior. ACM Trans. Graph., 38(4), July 2019. ISSN 0730-0301. doi: 10.1145/3306346.3323023. URL https://doi.org/10.1145/3306346. 3323023.
181
+ [4] D. Bau, J.-Y. Zhu, J. Wulff, W. Peebles, H. Strobelt, B. Zhou, and A. Torralba. Seeing what a gan cannot generate. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), October 2019.
182
+ [5] T. S. Brisimi, R. Chen, T. Mela, A. Olshevsky, I. C. Paschalidis, and W. Shi. Federated learning of predictive models from federated electronic health records. International Journal of Medical Informatics(IJMI), 2018.
183
+ [6] DCGM. ffhq-features-dataset, 2019. URL https://github.com/DCGM/ ffhq-features-dataset.
184
+ [7] L. Fan, K. W. Ng, C. Ju, T. Zhang, C. Liu, C. S. Chan, and Q. Yang. Rethinking privacy preserving deep learning: How to evaluate and thwart privacy attacks. In Q. Yang, L. Fan, and H. Yu, editors, Federated Learning: Privacy and Incentive, pages 32–50. Springer, 2020.
185
+ [8] C. Finn, P. Abbeel, and S. Levine. Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks. International Conference on Machine Learning (ICML), 2017.
186
+ [9] J. Geiping, H. Bauermeister, H. Dröge, and M. Moeller. Inverting gradients–How easy is it to break privacy in federated learning? In Neural Information Processing Systems(NeurIPS), 2020.
187
+ [10] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
188
+ [11] B. Hitaj, G. Ateniese, and F. Perez-Cruz. Deep models under the GAN: Information leakage from collaborative deep learning. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security (CCS), 2017.
189
+ [12] T. Karras, S. Laine, and T. Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2019.
190
+ [13] T. Karras, S. Laine, M. Aittala, J. Hellsten, J. Lehtinen, and T. Aila. Analyzing and improving the image quality of StyleGAN. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition(CVPR), 2020.
191
+ [14] D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. In Y. Bengio and Y. LeCun, editors, 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015. URL http: //arxiv.org/abs/1412.6980.
192
+ [15] X. Li, M. Jiang, X. Zhang, M. Kamp, and Q. Dou. FedBN: Federated learning on non-IID features via local batch normalization. In International Conference on Learning Representations (ICLR), 2021.
193
+ [16] Y. Lin, S. Han, H. Mao, Y. Wang, and W. J. Dally. Deep Gradient Compression: Reducing the communication bandwidth for distributed training. In The International Conference on Learning Representations (ICLR), 2018.
194
+ [17] B. McMahan, E. Moore, D. Ramage, S. Hampson, and B. A. y Arcas. Communication-efficient learning of deep networks from decentralized data. In A. Singh and J. Zhu, editors, Proceedings of the 20th International Conference on Artificial Intelligence and Statistics(AISTATS), volume 54 of Proceedings of Machine Learning Research, pages 1273–1282, 2017.
195
+ [18] H. B. McMahan, D. Ramage, K. Talwar, and L. Zhang. Learning differentially private recurrent language models. In 6th International Conference on Learning Representations (ICLR), 2018.
196
+ [19] L. Melis, C. Song, E. De Cristofaro, and V. Shmatikov. Exploiting unintended feature leakage in collaborative learning. In IEEE Symp. Security and Privacy $( S P )$ , pages 691–706, 2019. doi: 10.1109/SP.2019.00029.
197
+ [20] A. Nichol, J. Achiam, and J. Schulman. On first-order meta-learning algorithms. arXiv preprint arXiv:1803.02999, 2018.
198
+ [21] L. T. Phong, Y. Aono, T. Hayashi, L. Wang, and S. Moriai. Privacy-preserving deep learning via additively homomorphic encryption. IEEE Transactions on Information Forensics and Security, 13(5):1333–1345, 2018.
199
+ [22] O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, A. C. Berg, and L. 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.
200
+ [23] A. Segal, A. Marcedone, B. Kreuter, D. Ramage, H. B. McMahan, K. Seth, K. A. Bonawitz, S. Patel, and V. Ivanov. Practical secure aggregation for privacy-preserving machine learning. In CCS, 2017. URL https://eprint.iacr.org/2017/281.pdf.
201
+ [24] R. Shokri, M. Stronati, C. Song, and V. Shmatikov. Membership inference attacks against machine learning models. In 2017 IEEE Symposium on Security and Privacy (SP), pages 3–18, 2017. doi: 10.1109/SP.2017.41.
202
+ [25] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
203
+ [26] D. Ulyanov, A. Vedaldi, and V. Lempitsky. Deep image prior. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2018.
204
+ [27] Z. Wang, M. Song, Z. Zhang, Y. Song, Q. Wang, and H. Qi. Beyond inferring class representatives: User-level privacy leakage from federated learning. In IEEE INFOCOM 2019 - IEEE Conference on Computer Communications, pages 2512–2520, 2019.
205
+ [28] W. Wei, L. Liu, M. Loper, K.-H. Chow, M. E. Gursoy, S. Truex, and Y. Wu. A framework for evaluating client privacy leakages in federated learning. In L. Chen, N. Li, K. Liang, and S. Schneider, editors, Computer Security – ESORICS 2020, pages 545–566, Cham, 2020. Springer International Publishing. ISBN 978-3-030-58951-6.
206
+ [29] H. Yin, A. Mallya, A. Vahdat, J. M. Alvarez, J. Kautz, and P. Molchanov. See through gradients: Image batch recovery via gradinversion. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops (CVPR), 2021.
207
+ [30] R. Zhang, P. Isola, A. A. Efros, E. Shechtman, and O. Wang. The unreasonable effectiveness of deep features as a perceptual metric. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2018.
208
+ [31] B. Zhao, K. R. Mopuri, and H. Bilen. iDLG: Improved deep leakage from gradients. arXiv preprint arXiv:2001.02610, 2020.
209
+ [32] J. Zhu and M. B. Blaschko. R-GAP: Recursive gradient attack on privacy. In International Conference on Learning Representations (ICLR), 2021.
210
+ [33] J. Zhu, Y. Shen, D. Zhao, and B. Zhou. In-domain gan inversion for real image editing. In Proceedings of European Conference on Computer Vision (ECCV), 2020.
211
+ [34] L. Zhu, Z. Liu, and S. Han. Deep leakage from gradients. In Annual Conference on Neural Information Processing Systems (NeurIPS), 2019.
md/train/xYGNO86OWDH/xYGNO86OWDH.md ADDED
@@ -0,0 +1,421 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ISOTROPY IN THE CONTEXTUAL EMBEDDING SPACE: CLUSTERS AND MANIFOLDS
2
+
3
+ Xingyu Cai, Jiaji Huang, Yuchen Bian, Kenneth Church Baidu Research, 1195 Bordeaux Dr, Sunnyvale, CA 94089, USA {xingyucai,huangjiaji,yuchenbian,kennethchurch}@baidu.com
4
+
5
+ # ABSTRACT
6
+
7
+ The geometric properties of contextual embedding spaces for deep language models such as BERT and ERNIE, have attracted considerable attention in recent years. Investigations on the contextual embeddings demonstrate a strong anisotropic space such that most of the vectors fall within a narrow cone, leading to high cosine similarities. It is surprising that these LMs are as successful as they are, given that most of their embedding vectors are as similar to one another as they are. In this paper, we argue that the isotropy indeed exists in the space, from a different but more constructive perspective. We identify isolated clusters and low dimensional manifolds in the contextual embedding space, and introduce tools to both qualitatively and quantitatively analyze them. We hope the study in this paper could provide insights towards a better understanding of the deep language models.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ The polysemous English word “bank” has two common senses: 1. the money sense, a place that people save or borrow money; 2. the river sense, a slope of earth that prevents the flooding. In modern usage, the two senses are very different from one another, though interestingly, both senses share similar etymologies (and both can be traced back to the same word in Proto-Germanic). In the static embedding, multiple instances of the same word (e.g. “bank”) will be represented using the same vector. On the contrary, the contextual embedding assigns different vectors to different instances of the same word, depending on the context. Historically, static embedding models like Word2vec (Mikolov et al., 2013b) and GloVe (Pennington et al., 2014), predated contextual embedding models such as ELMo (Peters et al., 2018), GPT (Radford et al., 2018), BERT (Devlin et al., 2018) and ERNIE (Sun et al., 2019). Much of the literature on language modeling has moved to contextual embeddings recently, largely because of their superior performance on the downstreaming tasks.
12
+
13
+ # 1.1 RELATED WORK
14
+
15
+ The static embeddings are often found to be easier to interpret. For example, the Word2Vec and GloVe papers discuss adding and subtracting vectors, such as: $\operatorname { v e c } ( \operatorname { k i n g } ) - \operatorname { v e c } ( \operatorname* { m a n } ) + \operatorname { v e c } ( \operatorname { w o m e n } ) =$ vec(queen). Inspired by this relationship, researchers started to explore geometric properties of static embedding spaces. For example, Mu & Viswanath (2018) proposed a very counter-intuitive method that removes the top principle components (the dominating directions in the transformed embedding space), which surprisingly improved the word representations. Rather than completely discarding the principle components, Liu et al. (2019) proposed to use a technique called Conceptor Negation, to softly suppress transformed dimensions with larger variances. Both approaches, simply removing certain principle components as well as Conceptor Negation, produce significant improvements over vanilla embeddings obtained by static language models. In Huang et al. (2020), the authors studied how to effectively transform static word embeddings from one language to another.
16
+
17
+ Unfortunately, the strong illustrative representation like the king-queen example above, is no longer obvious in a general contextual embedding space. Arguing that syntax structure indeed exists in the contextual embeddings, Hewitt & Manning (2019) proposed a structural probe to identify the syntax trees buried in the space, and found the evidence of implicit syntax tree in BERT and ELMo. The advantage of contextual embedding over the static counterpart, mainly come from its capability to assign different vectors to the same word, depending on the word sense in the context. Researchers in (Reif et al., 2019) found such a geometric representation of word senses in the BERT model. These papers reveal the existence of linguistic features embedded implicitly in the contextual vector spaces.
18
+
19
+ The geometric properties of contextual embedding space are also investigated and compared with the static embedding space. Mimno & Thompson (2017) found anisotropy when negative sampling is used. In (Ethayarajh, 2019), the authors characterize how vectors are distributed in the contextual space. They found that most vectors occupy in a relatively narrow cone in the space. Pairs of vectors within this cone have large cosines. This phenomenon can be found in most state-of-the-art contextual embedding models. In (Gao et al., 2019), the authors named this phenomenon ”representation degeneration”, and attempted to mitigate the problem by introducing a regularization term that minimizes cosine similarities between vectors. In a very recent work, Demeter et al. (2020) suggest there is a structure weakness in the space that leads to bias when using soft-max, as is common with deep language models.
20
+
21
+ # 1.2 MOTIVATION AND CONTRIBUTIONS
22
+
23
+ Isotropy often makes the space more effectively utilized and more robust to perturbations (no extreme directions that lead to high condition number). It is counter-intuitive and not clear why those contextual embedding models perform remarkably well on many tasks given their anisotropic embeddings bring all the vectors close together, hard to distinguish one from another. On one hand, it is widely believed that contextual embeddings encode the relevant linguistic information (e.g. (Reif et al., 2019)), but on the other hand, it is also widely believed that the contextual space is anisotropic that representations become degenerated (e.g. (Mimno & Thompson, 2017), (Gao et al., 2019), (Ethayarajh, 2019)). These motivate us to find a reasonable understanding that bridges this gap.
24
+
25
+ This paper is similar in spirit to (Mu & Viswanath, 2018), but different in three aspects. First, we generalize their work on traditional static embeddings to more modern contextual embeddings. Second, we introduce clustering methods to isolate the space, whereas they used PCA to remove dominant dimensions (that tend to dominate the variance). Finally, we identify low dimensional manifolds in the space, and introduce an alternative approach (LID) to characterize local subspaces.
26
+
27
+ Key Contributions: This paper takes a deeper look into the contextual embedding spaces of popular pre-trained models. It identifies the following facts that were misunderstood or not known before: 1) We find isotropy within clusters in the contextual embedding space, in contrast to previous reports of anisotropy (caused by misleading isolated clusters). We introduce clustering and center shifting to reveal the isotropy, and show more consistent layer-wise behavior across models. 2) We find a Swiss-Roll manifold in GPT/GPT2 embeddings, but not in BERT/DistilBERT embeddings. The manifold is related to word frequency, suggesting a difference in how models evolve as they see more data. We use approximate Local Intrinsic Dimension (LID) to characterize the manifold, and find contextual embedding models, including all BERT, GPT families and ELMo, often have small LIDs. The small LIDs can be viewed as the local anisotropy of the space. The code for this paper could be found at https://github.com/TideDancer/IsotropyContxt.
28
+
29
+ # 2 ANALYSIS SETTINGS
30
+
31
+ # 2.1 MODELS AND DATASETS
32
+
33
+ In this paper, we consider popular pre-trained contextual embedding models, including BERT, DistilBERT (Sanh et al., 2019) (or denoted as D-BERT in the rest of the paper), GPT, GPT2 (Radford et al., 2019) and ELMo. For the BERT and GPT families, we perform our evaluations on the pretrained uncased base models from Huggingface (https://huggingface.co/transformers/index.html#). The pre-trained ELMo model is from AllenNLP (https://docs.allennlp.org/v1.0.0/). BERT and DBERT are non-causal models because of their attention mechanism, where tokens can attend to any token in the input, regardless of their relative positions. In contrast, GPT and GPT2 are causal models because attention is limited to the tokens previously seen in the input.
34
+
35
+ Different models achieve contextual embedding in different ways. For instance, BERT adds positional embeddings to the token embeddings, while ELMo performs vector concatenation. Most models start with an initial layer that maps token ids to vectors. This paper is not concerned with that lookup table layer, and only focuses on the layers after that. The base BERT, GPT and GPT2 models have 12 layers of interest, indexed from 0 to 11, while D-BERT has 6 layers and ELMo has two.
36
+
37
+ We use Penn Tree Bank (PTB) (Marcus et al., 1993) and WikiText-2 (Merity et al., 2016) datasets. The PTB has 0.88 million words and WikiText-2 has 2 million. Both of them are the standard datasets for language models. In the rest of the paper, we report on PTB since we see similar results with both datasets. Details on WikiText-2 analysis could be found in Appendix.
38
+
39
+ # 2.2 NOTATION
40
+
41
+ For each position in a corpus, we have a word. Words are converted into tokens, using the appropriate tokenizer for the model. Tokenizers could split some words into subwords, therefore, the number of obtained tokens (denoted as $n$ ) could be more than number of words in the corpus. PTB, for example, contains 0.88 million words, but has $n = 1 . 2$ million tokens, when processed by BERT’s tokenizer. Let $V$ be the vocabulary, a set of distinct tokens. For any element in the vocabulary $V$ , we call it a type. For example, BERT has a vocabulary of roughly 30, 000 types. We may mix using “word” and “type” for ease of reading. We denote the $i$ -th type in $V$ as $t _ { i }$ . Let $\Phi ( t _ { i } ) = \{ \phi _ { 1 } ( t _ { i } ) , \phi _ { 2 } \bar { ( } t _ { i } ) , . . . \}$ be the set of all embedding instances of $t _ { i }$ (note that different contexts in the corpus yield different embeddings of $t _ { i }$ ). By construction, $\begin{array} { r } { \sum _ { t } | \Phi ( t ) | = n } \end{array}$ . We define the inter-type cosine similarity as
42
+
43
+ $$
44
+ S _ { \mathrm { i n t e r } } \triangleq \mathbb { E } _ { i \neq j } \left[ \cos { ( \phi ( t _ { i } ) , \phi ( t _ { j } ) ) } \right]
45
+ $$
46
+
47
+ where $\phi ( t _ { i } )$ is one random sample from $\Phi ( t _ { i } )$ , and the same for $\phi ( t _ { j } ) \in \Phi ( t _ { j } )$ . The expectation is taken over all pairs of different types. Similarly, we define the intra-type cosine similarity as
48
+
49
+ $$
50
+ S _ { \mathrm { i n t r a } } \triangleq \mathbb { E } _ { i } \left[ \mathbb { E } _ { k \neq l } \left[ \cos { ( \phi _ { k } ( t _ { i } ) , \phi _ { l } ( t _ { i } ) ) } \right] \right]
51
+ $$
52
+
53
+ where the inner expectation is over different embeddings $\phi ( t _ { i } )$ for the same type $t _ { i }$ , and the outer expectation is over all types. Both $S _ { \mathrm { i n t e r } }$ and $S _ { \mathrm { i n t r a } }$ take values between $- 1$ and 1. Note that for i.i.d. Gaussian random samples $x , y$ , the expected cosine similarity $\mathbb { E } [ \cos ( x , y ) ] = 0$ . A cosine value closer to 0 often indicates strong isotropy.
54
+
55
+ Clearly, the inter-type metric describes the similarity between different types, where the intra-type one measures similarity between same type’s embedding instances. Our definitions of $S _ { \mathrm { i n t e r } }$ and $S _ { \mathrm { i n t r a } }$ are similar to the measures used in Ethayarajh (2019), but at the corpus level. Note that some types are more frequent than others, especially under a Zipfian distribution (Piantadosi, 2014), and therefore, the size of $\Phi ( t )$ varies dramatically with the frequency of type $t$ .
56
+
57
+ # 2.3 AN INITIAL LOOK AT ANISOTROPY
58
+
59
+ Inspired by Ethayarajh (2019), we follow their procedure and take a first look at the anisotropy identified by Mimno & Thompson (2017) and Ethayarajh (2019), in the contextual embedding space.
60
+
61
+ ![](images/450b687e2c311c12b27e0cf64c746ae2ed7551681cbf37cfbd957ea7f3951a75.jpg)
62
+ Figure 1: $S _ { \mathrm { i n t e r } }$ (left) and $S _ { \mathrm { i n t r a } }$ (right). The $S _ { \mathrm { i n t e r } }$ increases as layer goes deeper, especially for GPT2’s last layer. The $S _ { \mathrm { i n t r a } }$ are generally high. This means arbitrary vectors have high cosine similarities.
63
+
64
+ Figure 1 shows strong anisotropy effects in a number of models. These findings are consistent with Ethayarajh (2019), though we use slightly different metrics. The plots show expected cosine $S _ { \mathrm { i n t e r } }$ and $S _ { \mathrm { { i n t r a . } } }$ ) as a function of layer. For efficiency, we approximate $S _ { \mathrm { i n t r a } }$ by imposing a limit of 1,000 samples for frequent types, $t$ , if $| \Phi ( t ) | > 1 0 0 0$ . From the figure we can see the following:
65
+
66
+ • Both $S _ { \mathrm { i n t e r } }$ and $S _ { \mathrm { i n t r a } }$ are high $( \gg 0 )$ ) across almost all the layers and all the models. In particular, the same as reported in Ethayarajh (2019), GPT2 is relatively more anisotropic. $S _ { \mathrm { { i n t e r } } }$ tends to increase with layer, in contrast with $S _ { \mathrm { i n t r a } }$ which in general decreases but with fluctuations. This means that embeddings for different types are moving closer to one another at deeper layers, while embeddings for the same type’s instances are spreading away.
67
+
68
+ • The last layer is often special. Note that the last layer has smaller cosines than the second last in most cases, with the notable exception of GPT2.
69
+
70
+ In summary, we observe large cosines (across layers/models), especially for the GPT2 model. When cosines are close to 1, embeddings lie in a subspace defined by a very narrow cone (Ethayarajh, 2019). One might expect embeddings to be more effective if they took advantage of a larger subspace. Are these models missing an opportunity to have the benefits from isotropy (Mu & Viswanath, 2018)? We answer this question in the following sections.
71
+
72
+ # 3 CLUSTERS IN THE EMBEDDING SPACE
73
+
74
+ # 3.1 EFFECTIVE DIMENSIONS
75
+
76
+ There are $m = 7 6 8$ embedding dimensions for BERT, D-BERT, GPT and GPT2, and $m = 1 0 2 4$ dimensions for ELMo. We perform PCA to reduce the number of dimensions from $m$ down to $k$ . For each layer of each model, we start with the data matrix, $M \in \mathcal { R } ^ { n \times m }$ , where $n$ is the number of input tokens $\ R = 1 . 2 M$ for PTB dataset), and $m$ is the original number of dimensions. After PCA, we end up with a smaller matrix, $\hat { M } \in \mathcal { R } ^ { n \times k }$ . Let the explained variance ratio be: $\begin{array} { r } { r _ { k } = \sum _ { i = 0 } ^ { k - 1 } \sigma _ { i } / \sum _ { i = 0 } ^ { m - 1 } \sigma _ { i } } \end{array}$ , where $\sigma _ { i }$ is the $i$ -th largest eigen value of $M$ ’s covariance matrix. In this way, we define the $\epsilon$ -effective-dimension to be: $d ( \epsilon ) \triangleq \arg \operatorname* { m i n } _ { k } r _ { k } \geq \epsilon .$ . For example, $d ( 0 . 8 ) = 2$ means that 2 dimensions capture $8 0 \%$ of the variance. There is a direct connection between $d$ and isotropy: the larger $d$ often implies more isotropy, as data spreads in multiple dimensions.
77
+
78
+ Table 1: The effective dimension $d ( 0 . 8 )$
79
+
80
+ <table><tr><td>Layer</td><td>0</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><td>9</td><td>10</td><td>11</td></tr><tr><td>BERT</td><td>262</td><td>273</td><td>271</td><td>273</td><td>276</td><td>283</td><td>288</td><td>282</td><td>282</td><td>282</td><td>283</td><td>270</td></tr><tr><td>D-BERT</td><td>244</td><td>226</td><td>232</td><td>227</td><td>217</td><td>175</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>GPT</td><td>265</td><td>141</td><td>65</td><td>76</td><td>173</td><td>210</td><td>205</td><td>217</td><td>221</td><td>253</td><td>269</td><td>307</td></tr><tr><td>GPT2</td><td>114</td><td>73</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td><td>8</td><td>26</td><td>66</td><td>116</td><td>1</td></tr><tr><td>ELMo</td><td>455</td><td>367</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
81
+
82
+ Table 1 reports $d ( 0 . 8 )$ for different layers and models. It is surprising that GPT2 has so few effective dimensions, especially, $d ( 0 . 8 ) = 1$ for layer 2 to 6. The surprisingly small effective dimensionality is another way of saying that GPT2 vectors fall in a narrow cone, and consequently, their pairwise cosines are large. If all the vectors lie on a 1-D line, all the cosines would be 1, and there would be hardly any model capacity. These observations motivate us to look deeper into the embedding space.
83
+
84
+ # 3.2 ISOLATED CLUSTERS
85
+
86
+ ![](images/117dcd6ffe45834dcc6afef290d48b527046ad06bbf9802243931025414ad887.jpg)
87
+ Figure 2: Isolated clusters exist in the embedding spaces for all the models. Here we only show a few representative middle layers for each model. The full visualization can be found in supplementary.
88
+
89
+ By performing PCA to project the original data into a 3-D view, we can visualize GPT2’s layer 6’s embedding space in Figure 2a. The three axes refer to the first three principle components, which account for $8 2 . 8 \%$ of the total variance. All the explained variance ratio will be reported throughout the rest of the paper. The axes values are raw coordinates after PCA. In Figure 2a, there are two disconnected islands that are far away from each other. Note that the first dimension coordinate values spans from 0 to 3000, significantly wider than the other 2 dimensions. In fact this first principle dimension dominates the total variance. The left island is bigger than the one on the right. The fact that the two islands are so well separated by the first principle component suggests that classifying points by island membership accounts for much of the variance. This two-island property is exhibited in layers 2 through 10 for GPT2. The two islands merge into a single large cluster in the last layer.
90
+
91
+ We observe similar clustering behavior for all the models across all the layers, though the separations are less distinct, as illustrated in other panels of Figure 2. This is also consistent with Table 1, the less separation, the higher $d ( \epsilon )$ values. For GPT2, we had hoped to find that some types are associated with one cluster and other types are associated with the other cluster, but that is not verified in our experiments. Please refer to the supplementary for visualizations of all layers in all the models.
92
+
93
+ # 3.3 CLUSTERING
94
+
95
+ Previous literature estimated the space isotropy on pairs of arbitrary tokens, which could reside in two disconnected clusters. But given that the variance is dominated by distances between clusters, such estimation would be biased by the inter-cluster distances. It is more meaningful to consider a per-cluster investigation rather than a global estimate.
96
+
97
+ We start by performing clustering on the embedding space. There are many methods for clustering. We chose K-Means (https://scikit-learn.org/stable/modules/classes.html#), because it is reasonably fast for large inputs $n = 1 . 2$ million vectors) in high $m \geq 7 6 8 )$ dimensions. DBSCAN algorithm (Ester et al., 1996) could be an alternative as it is density based, but only works on small dataset. We use the Silhouette method (Rousseeuw, 1987) to determine the number of clusters, $| C |$ . After running $\mathrm { K }$ -means, each point $p$ (one of the $n$ vectors in $M$ ) is assigned to one of $C$ clusters. For a data point $p$ assigned to the cluster $c \in C$ , calculate the following:
98
+
99
+ $$
100
+ a _ { p } = \frac { 1 } { | c | - 1 } \sum _ { q \in c , p \neq q } \operatorname { d i s t } ( p , q ) ; b _ { p } = \operatorname * { m i n } _ { \tilde { c } \neq c } \sum _ { q \in \tilde { c } } \operatorname { d i s t } ( p , q ) ; s _ { p } = \left\{ \frac { b _ { p } - a _ { p } } { \operatorname { m a x } ( a _ { p } , b _ { p } ) } , \mathrm { ~ i f ~ } | c | > 1 \right\} .
101
+ $$
102
+
103
+ where $a _ { p }$ is the mean distance between $p$ and other points in the same cluster; $b _ { p }$ is the minimum (min over $\tilde { c }$ ) mean distance between $p$ to points of another cluster $\tilde { c }$ ; and $s _ { p }$ is the Silhouette score for point $p \in c$ . The $s _ { p }$ takes value $\in [ - 1 , 1 ]$ . The higher $s _ { p }$ , the better assignment of $p$ to its cluster. Better choices of $| C |$ would lead to better values of $s _ { p }$ (and better clustering). We define the MaximumMean-Silhouette (MMS) score for the embedding space as: $\mathbf { M M S } { \stackrel { \Delta } { = } } \operatorname* { m a x } _ { \mathbf { d i f f e r e n t } } \left| C \right| { \mathbb { E } } _ { p } \left[ s _ { p } \right]$ , where the maximum is over different $| C |$ values for K-Means. Since it is not feasible to evaluate all choices of $| C | \in [ 1 , n ]$ , we consider $| \dot { C } | \in [ 1 , 1 5 ]$ . The expectation $\mathbb { E } _ { p } [ s _ { p } ]$ (the mean Silhouette score), is estimated from 20, 000 sample vectors in $M$ . We select the best $| C |$ that yields MMS.
104
+
105
+ The MMS values provide a systematic way to describe how the clusters are distributed in the space. If the clusters are very distinct and splitted, this yields a higher MMS. On the other hand, if clusters are overlapping, blurring together, the MMS score will be low. Note that if $\mathrm { M M S } < 0 . 1$ , we set $| C |$ to be 1, as the Silhouette score does not show significant evidence of more clusters.
106
+
107
+ Table 2: Number of clusters $| C |$
108
+
109
+ <table><tr><td>Layer</td><td>BERT</td><td>D-BERT</td><td>GPT</td><td>GPT2</td><td>ELMo</td></tr><tr><td>0</td><td>6</td><td>7</td><td>1</td><td>2</td><td>2</td></tr><tr><td>12345678</td><td>6</td><td>10</td><td></td><td>2</td><td>2</td></tr><tr><td></td><td>443</td><td>15</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td>14</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td>10</td><td></td><td></td><td></td></tr><tr><td></td><td>14</td><td>2</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>622П</td><td></td><td></td><td></td><td></td></tr><tr><td>9</td><td></td><td></td><td>222222221</td><td></td><td></td></tr><tr><td>10</td><td>2</td><td></td><td>1</td><td>222222222</td><td></td></tr><tr><td>11</td><td>9</td><td></td><td>1</td><td>2</td><td></td></tr></table>
110
+
111
+ ![](images/af709fea2fbae351086b0ebcd74fb05e81a67ed08634b0943ae81b32cff89fb6.jpg)
112
+ Figure 3: The MMS for all the models. GPT2 has significantly higher MMS scores than other models from layer 1 to layer 11. This means the cluster effects are more severe in GPT2.
113
+
114
+ Table 2 makes it clear that clustering plays an important role in most layers of most models. Some models (BERT and D-BERT) have more clusters, and some have fewer (GPT, GPT2, ELMo). This dichotomy of models is also reflected in Figure 2.
115
+
116
+ Maximum-Mean-Silhouette scores are shown in Figure 3. There are significantly higher MMS values for GPT2, starting from the 2nd layer. Recall in Figure 2a, we showed that two far-away islands exist in the space and their distance dominates the variance. In Figure 3, the high MMS scores also verifies that. Another interesting observation is, for causal models GPT, GPT2 and ELMo, they all have higher MMS in their middle layers but lower MMS in the end. This means their initial layer and final layers’ embeddings tend to merge. On the contrary, the BERT and DistilBERT have increasing MMS in deeper layers, meaning that the clusters in their embeddings are becoming clearer in deeper layers.
117
+
118
+ # 3.4 ISOTROPY IN CENTERED SPACE WITHIN CLUSTERS
119
+
120
+ As suggest by Mu & Viswanath (2018), the embedding space should be measured after shifting the mean to the origin. We subtract the mean for each cluster, and calculate the adjusted $S _ { \mathrm { i n t e r } }$ . Assuming we have a total of $| C |$ clusters, let $\Phi ^ { c } ( t ) = \{ \phi _ { 1 } ^ { c } ( t ) , \phi _ { 2 } ^ { c } ( t ) , \ldots \}$ be the set of type $t$ ’s embeddings in cluster $c \in C$ , and $\phi ^ { c } ( t )$ be one random sample in $\Phi ^ { c } ( t )$ . Define the adjusted similarity:
121
+
122
+ $$
123
+ S _ { \mathrm { i n t e r } } ^ { \prime } \triangleq \mathbb { E } _ { c } \left[ \mathbb { E } _ { i \neq j } \left[ \cos \left( \bar { \phi } ^ { c } ( t _ { i } ) , \bar { \phi } ^ { c } ( t _ { j } ) \right) \right] \right] , \mathrm { w h e r e } \bar { \phi } ^ { c } ( t ) = \phi ^ { c } ( t ) - \mathbb { E } _ { \phi ^ { c } } \left[ \phi ^ { c } ( t ) \right]
124
+ $$
125
+
126
+ Here $\mathbb { E } _ { c }$ is the average over different clusters, and $\bar { \phi } ^ { c } ( t )$ is the original embedding shifted by mean (subtract the mean), where the mean is taken over the samples in cluster $c$ . Similarly we define
127
+
128
+ $$
129
+ S _ { \mathrm { i n t r a } } ^ { \prime } \triangleq \mathbb { E } _ { c } \left[ \mathbb { E } _ { i } \left[ \mathbb { E } _ { k \neq l } \left[ \cos \left( \bar { \phi } _ { k } ^ { c } ( t _ { i } ) , \bar { \phi } _ { l } ^ { c } ( t _ { i } ) \right) \right] \right] \right]
130
+ $$
131
+
132
+ ![](images/7f09db5e9e8f988b0d46680cb0baf952d389782e0b41c59625673b275260dea1.jpg)
133
+ Figure 4: $S _ { \mathrm { i n t e r } } ^ { \prime }$ (left) and $S _ { \mathrm { i n t r a } } ^ { \prime }$ (right). The adjusted $S _ { \mathrm { i n t e r } } ^ { \prime }$ are close to zero, meaning that the space is isotropic under the adjusted measure.
134
+
135
+ The Figure 4 illustrates the adjusted cosine similarities $S _ { \mathrm { i n t e r } } ^ { \prime }$ and $S _ { \mathrm { i n t r a } } ^ { \prime }$ . It reveals that:
136
+
137
+ • For the adjusted inter-type cosine (the left plot), all models are having consistent near-zero $S _ { \mathrm { i n t e r } } ^ { \prime }$ last layer of GPT2 and BERT has slightly worse isotropic behavior, nevertheless, general inter-type isotropy stays across all layers. This reveals the distinguishable embedding vectors. The general decreasing trend of intra-type cosine (the right plot) shows that the multiple instances for the same type/word, is slowly spreading over the layers. This is consistent with the un-centered intra-type cosine shown in Figure 1.
138
+
139
+ # 4 LOW-DIMENSIONAL MANIFOLDS
140
+
141
+ # 4.1 SWISS ROLL MANIFOLD OF GPT/GPT2
142
+
143
+ While BERT and D-BERT tend to distribute embeddings along more dimensions, GPT and GPT2 embed tokens in low-dimensional manifolds in their contextual embedding spaces. More specifically, we discover that most of the tokens are embedded on a spiral band, and that band gets thicker in the later layers thereafter form a Swiss Roll shaped surface.
144
+
145
+ Figure 5a and 5b show the 2-D front view of the manifold in GPT and GPT2. Figure 5a zooms into the large cluster illustrated in Figure 2a (the left one), and discards the smaller one (the right one).
146
+
147
+ ![](images/0f374686d2f6401f149cbb706c4ff88bd2d571f02766a381e7f14d7577254e33.jpg)
148
+ Figure 5: The 2-D and 3-D view of low-dimensional manifold in GPT/GPT2’s embedding spaces
149
+
150
+ 3-D plots are shown in Figure 5c and 5d to demonstrate two manifolds, a band shaped manifold and a Swiss Roll shaped manifold. These plots were computed over PTB dataset. Similar results have been obtained from WikiText-2 in supplementary. Figure 6 tracks the progression of a narrow band into a Swiss Roll. The Swiss Roll becomes taller and taller with deeper and deeper layers.
151
+
152
+ ![](images/5ea1c3c6cc4901c9f8aac1cd94ebec8f2c4d49d68c0f35ede8ffcb49d15902d6.jpg)
153
+ Figure 6: The evolution from a narrow band into a taller and taller Swiss Roll with deeper layers.
154
+
155
+ # 4.2 TOKENS IN THE SPACE
156
+
157
+ To verify the manifold structure in GPT family, we study the token embeddings in the space. It is believed that similar embeddings (e.g. the embeddings for two instances of the same word) tend to stay close together in a Euclidean space, as they should have high cosine similarities. Figure 7 drills down into the embeddings for six frequent words: three punctuation symbols (“\”, “&”, “.”) and three common words (“the”, “first”, “man”). Each panel uses four colors: three colors (black, red, green) for three words of interest, plus gold color for all the other tokens.
158
+
159
+ ![](images/337622418101df1f4f4cd1c664f43628d5aaaa243e9bb6faffd11a34f69d72a5.jpg)
160
+ Figure 7: Embeddings for symbol tokens and word tokens, in layer 3 of BERT and GPT. This shows that GPT has manifold structure, such that vectors are along the spiral band. BERT’s space is closer to a Euclidean space as similar vectors are in concentrated clusters.
161
+
162
+ As shown in Figure 7a 7b, the BERT model indeed group similar embeddings into small regions in the space (the red, black and green clusters). However, the GPT models are assigning similar embeddings along the manifold we observed before. In Figure 7c 7d, the embeddings for the tokens occupy a spiral band that almost cross the entire space. It does not comply with the Euclidean space geometry as points in such a spiral band would not have high cosine similarity. A Riemannian metric must exist, such that the manifold has larger distance between two spiral bands, but smaller distance on the band. Note that the 3-D plots are obtained using PCA, so there is no density-based nor non-linear reduction involved. Therefore, the manifold structures in GPT embedding spaces are verified.
163
+
164
+ # 4.3 WORD FREQUENCY
165
+
166
+ Another key finding is that all the models are trying to map the high frequent words/types to some specific region in the embedding spaces, rather than spreading them out to the entire space. In Figure 8, embeddings ( 8a 8c ) and corresponding word frequencies ( 8b 8d ) of GPT’s layer 8 and 9 are shown. The darker red denoted higher frequency and blue is lower frequency. The numbers at the colorbar show the number of occurrence (of a particular word / type).
167
+
168
+ ![](images/e89001d54c8ae5db3d86ed07710f60a19ab9b5d908681a00b0e1040a10fffb51.jpg)
169
+ Figure 8: Word frequency heatmap in GPT layer 8 and 9. Red is high frequency, blue is low. High frequency words are at the front end of the Swiss Roll, while low frequency words at the other end. ( 8b 8d are drawn using matplotlib.tricontourf, so the ring at 8b’s bottom should not be closed.)
170
+
171
+ The Figure $\operatorname { 8 a 8 c }$ are after PCA, and selecting the two most significant dimensions. From GPT layer 8 to layer 9, as the Swiss Roll becomes taller, more variance is accounted for along the height of the Swiss Roll. Thus, the perspective switches from a front view to a side view when moving to layer 9.
172
+
173
+ Figures 8b and 8d show that the most frequent words appear at the head of the Swiss Roll, followed by bands of less and less frequent words. The least frequent words appear at the far end of the Swiss Roll. This pattern suggests the model distinguishes more frequent from less frequent words. As the model finds more and more rare words, it appends them at the end of the Swiss Roll.
174
+
175
+ # 4.4 MANIFOLD LOCAL INTRINSIC DIMENSION
176
+
177
+ Although the original space dimension is 768 (1024 for ELMo), the manifold we observed has a lower intrinsic dimension. It means the data point on the manifold has fewer degrees of freedom to move around. For example, on a Swiss Roll in a 3-D space, any point can only have 2-D freedom thus the intrinsic dimension is only 2. A recent research on the intrinsic dimension for deep networks could be found at (Ansuini et al., 2019). In this section, we adopt the Local Intrinsic Dimension (LID) that estimates dimension locally with respect to a reference point. LID is introduced by Houle (2013), and being used in deep learning model characterization recently, e.g. (Ma et al., 2018). The LID is often derived using expansion models (Houle et al., 2012), which tries to obtain the local dimension in the vicinity of a reference point from the growth (expansion) characteristics. To illustrate this, we borrow an example from Ma et al. (2018). Let $\gamma$ be the radius of an $m$ -D ball in the Euclidean space, denote its volume as $\nu$ , then the volume’s growth rate is proportional to $\gamma ^ { m }$ , i.e. $\nu _ { 2 } / \nu _ { 1 } = ( \gamma _ { 2 } / \bar { \gamma _ { 1 } } ) ^ { m }$ , from which we can infer the local dimension $\tilde { m }$ by $\tilde { m } = \log ( \nu _ { 2 } / \nu _ { 1 } ) / \log ( \gamma _ { 2 } / \gamma _ { 1 } )$ .
178
+
179
+ Accurately computing LID is a hard problem which requires a tremendous amount of data samples and enough density around the reference point. So fewer-sample estimate of LID is being studied in the past decade. One of the efficient estimation is proposed by Amsaleg et al. (2015). This technique relies on $K$ nearest neighbor search ( $K$ -NN). For a reference point $p$ , denote the set of its $K$ nearest neighbor points as $\Psi _ { p } = \{ q _ { 1 } , \dots , q _ { K } \}$ . Then the estimate of LID is computed as: $\begin{array} { r } { \mathbf { L } \mathbf { \tilde { I } } \mathbf { D } ( p ) = - \left( \frac { 1 } { K } \sum _ { i = 1 } ^ { K } \log \frac { \mathrm { d i s t } ( p , q _ { i } ) } { \operatorname* { m a x } _ { i } ( \mathrm { d i s t } ( p , q _ { i } ) ) } \right) ^ { - 1 } } \end{array}$ , where the term inside log is the ratio of distance between $p$ to its neighbor, over the maximum distance among them. In our analysis, we use an efficient nearest neighbor computation package FAISS (Johnson et al., 2017) (https://github.com/facebookresearch/faiss) to perform the $K$ -NN. We set $K \ : = \ : 1 0 0$ , the same as in (Aumuller & Ceccarello, 2019). ¨ $\ell _ { 2 }$ distance is used, i.e. $\mathrm { d i s t } ( p , q ) = \| p - q \| _ { 2 }$ . We report the mean LID over all the samples $p$ , as $\mathbb { E } _ { p } [ \mathrm { L } \tilde { \mathrm { I D } } ( p ) ]$ , in Figure 9.
180
+
181
+ ![](images/05827c4a9a84e3e5c58f5e2e6d054af54762972c5d545b9fc40c214024bd9873.jpg)
182
+ Figure 9: The average LID using Euclidean distance. ELMo’s original embdding dimension is 1024, larger than other models’ 768.
183
+
184
+ Table 3: A comparison of LIDs (using cosine similarity) among contextual and static embedding spaces.
185
+
186
+ <table><tr><td></td><td>Model</td><td>n</td><td>m</td><td>avg LID</td></tr><tr><td>Contxt Embeds</td><td>BERT D-BERT GPT GPT2</td><td>1.19 M 1.19 M 0.96 M 1.09 M</td><td>768 768 768 768</td><td>5.6 7.3 6.8 7.0</td></tr><tr><td>Static Embeds</td><td>ELMo GloVe GloVe-2M GNEWS</td><td>0.88 M 1.18 M 2.20M 3.00 M</td><td>1024 100 300 300</td><td>9.1 18.0 26.1 21.1</td></tr></table>
187
+
188
+ As shown in Figure 9, the mean LIDs for all the models in all the layers are below 12. The small mean LID values reveals that the manifold’s intrinsic dimension is relatively low, especially considering that this is a 768-D (1024 for ELMo) embedding space. Since ELMo’s 1024-D is larger than other models 768-D dimension, its LID is also slightly higher than other models as shown in the figure. The existence of a low-dimensional embedding is also suggested in (Reif et al., 2019) when they study the BERT embedding geometry.
189
+
190
+ In all the contextual embedding layers, there is a clear trend of increasing LID values. In Figure 9, we can also see a nearly-linear relationship between layer id and LID. With deeper and deeper layers in the net, the manifold is diffusing and slowly loses concentration. This would lead to data samples spreading, consistent with Figure 4 (recall that intra-type cosines decrease with depth). Note that as layer goes deeper, each token embedding is collecting information from context by adding their embeddings (and non-linear transforms concatenated). This could explain the spreading $/$ expanding of the local subspace, and therefore the LID increases in deeper layers.
191
+
192
+ Table 3 compares LIDs for static and contextual embeddings. The table reports results for three static embeddings: GloVe / GloVe-2M (Pennington et al., 2014), and GNEWS (Mikolov et al., 2013a). Results for static embedding LIDs are based on Aumuller & Ceccarello (2019). Following Aum ¨ uller ¨ & Ceccarello (2019), we use cosine distance here: $\begin{array} { r } { \mathbf { d i s t } ^ { \prime } ( p , q ) = 1 - \cos ( p , q ) = 1 - \frac { \langle p , q \rangle } { \| p \| _ { 2 } \| q \| _ { 2 } } } \end{array}$ Note that estimates for LID using cosines are very close to the estimates using $\ell _ { 2 }$ distances. Table 3 reports averages of LIDs over each model’s layers. Even though GloVe (Pennington et al., 2014) in Table 3 has much fewer embedding dimensions (100-D compared with BERT’s 768-D), the LID is still higher than all of the contextual embedding models. From the table we can find that static embedding spaces generally have higher LID than the contextual ones. This means that the data points are more isotropic in the static embeddings, possibly due to their large vocabularies.
193
+
194
+ # 5 CONCLUSIONS AND FUTURE WORK
195
+
196
+ Previous works have reported the strong anisotropy in deep LMs, which is hard to explain the superior performance achieved by these models. We suggest that the anisotropy is a global view, being largely misled by distinct clusters resided in the space. Our analysis show that it is more constructive to isolate and transform the space to measure the isotropy. From this view, within the clusters, the spaces of different models all have nearly perfect isotropy that could explain the large model capacity. In addition, we investigate the space geometry for different models. Our visualization demonstrates a low-dimensional Swiss Roll manifold for GPT and GPT2 embeddings, that has not been reported before. The tokens and word frequencies are presented to qualitatively show the manifold structure. We propose to use the approximate LID to quantitatively measure the local subspace, and compared with static embedding spaces. The results show smaller LID values for the contextual embedding models, which can be seen as a local anisotropy in the space. We hope this line of research could bring a comprehensive geometric view of contextual embedding space, and gain insights on how the embeddings are affected by attention, compression, multilingualism, etc. Therefore the model performance could be further improved based on the findings.
197
+
198
+ # REFERENCES
199
+
200
+ Laurent Amsaleg, Oussama Chelly, Teddy Furon, Stephane Girard, Michael E Houle, Ken-ichi ´ Kawarabayashi, and Michael Nett. Estimating local intrinsic dimensionality. In Proceedings of the 21th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 29–38, 2015.
201
+
202
+ Alessio Ansuini, Alessandro Laio, Jakob H Macke, and Davide Zoccolan. Intrinsic dimension of data representations in deep neural networks. In Advances in Neural Information Processing Systems, pp. 6111–6122, 2019.
203
+
204
+ Martin Aumuller and Matteo Ceccarello. The role of local intrinsic dimensionality in benchmarking ¨ nearest neighbor search. In International Conference on Similarity Search and Applications, pp. 113–127. Springer, 2019.
205
+
206
+ Alexis Conneau and Guillaume Lample. Cross-lingual language model pretraining. In Advances in Neural Information Processing Systems, pp. 7059–7069, 2019.
207
+
208
+ David L Davies and Donald W Bouldin. A cluster separation measure. IEEE transactions on pattern analysis and machine intelligence, (2):224–227, 1979.
209
+
210
+ David Demeter, Gregory Kimmel, and Doug Downey. Stolen probability: A structural weakness of neural language models. Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, 2020.
211
+
212
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
213
+
214
+ Martin Ester, Hans-Peter Kriegel, Jorg Sander, Xiaowei Xu, et al. A density-based algorithm for ¨ discovering clusters in large spatial databases with noise. In Kdd, volume 96, pp. 226–231, 1996.
215
+
216
+ Kawin Ethayarajh. How contextual are contextualized word representations? comparing the geometry of bert, elmo, and gpt-2 embeddings. 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. 55–65, 2019.
217
+
218
+ Jun Gao, Di He, Xu Tan, Tao Qin, Liwei Wang, and Tieyan Liu. Representation degeneration problem in training natural language generation models. In International Conference on Learning Representations, 2019.
219
+
220
+ John Hewitt and Christopher D Manning. A structural probe for finding syntax in word representations. 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. 4129–4138, 2019.
221
+
222
+ Michael E Houle. Dimensionality, discriminability, density and distance distributions. In 2013 IEEE 13th International Conference on Data Mining Workshops, pp. 468–473. IEEE, 2013.
223
+
224
+ Michael E Houle, Hisashi Kashima, and Michael Nett. Generalized expansion dimension. In 2012 IEEE 12th International Conference on Data Mining Workshops, pp. 587–594. IEEE, 2012.
225
+
226
+ Jiaji Huang, Xingyu Cai, and Kenneth Church. Improving bilingual lexicon induction for low frequency words. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 1310–1314, 2020.
227
+
228
+ Jeff Johnson, Matthijs Douze, and Herve J ´ egou. Billion-scale similarity search with gpus. ´ arXiv preprint arXiv:1702.08734, 2017.
229
+
230
+ Tianlin Liu, Lyle Ungar, and Joao Sedoc. Unsupervised post-processing of word vectors via conceptor negation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 6778– 6785, 2019.
231
+
232
+ Xingjun Ma, Bo Li, Yisen Wang, Sarah M Erfani, Sudanthi Wijewickrema, Grant Schoenebeck, Dawn Song, Michael E Houle, and James Bailey. Characterizing adversarial subspaces using local intrinsic dimensionality. In International Conference on Learning Representations, 2018.
233
+
234
+ Mitchell Marcus, Beatrice Santorini, and Mary Ann Marcinkiewicz. Building a large annotated corpus of english: The penn treebank. 1993.
235
+
236
+ Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. arXiv preprint arXiv:1609.07843, 2016.
237
+
238
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013a.
239
+
240
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In Advances in neural information processing systems, pp. 3111–3119, 2013b.
241
+
242
+ David Mimno and Laure Thompson. The strange geometry of skip-gram with negative sampling. In Empirical Methods in Natural Language Processing, 2017.
243
+
244
+ Jiaqi Mu and Pramod Viswanath. All-but-the-top: Simple and effective post-processing for word representations. In 6th International Conference on Learning Representations, ICLR 2018, 2018.
245
+
246
+ Jeffrey Pennington, Richard Socher, and Christopher D Manning. Glove: Global vectors for word representation. In Proceedings of the 2014 conference on empirical methods in natural language processing (EMNLP), pp. 1532–1543, 2014.
247
+
248
+ Matthew E Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. arXiv preprint arXiv:1802.05365, 2018.
249
+
250
+ Steven T. Piantadosi. Zipf’s word frequency law in natural language: A critical review and future directions. Psychonomic bulletin & review, 21(5):1112–1130, 2014.
251
+
252
+ Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training, 2018.
253
+
254
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. OpenAI Blog, 1(8):9, 2019.
255
+
256
+ Emily Reif, Ann Yuan, Martin Wattenberg, Fernanda B Viegas, Andy Coenen, Adam Pearce, and Been Kim. Visualizing and measuring the geometry of bert. In Advances in Neural Information Processing Systems, pp. 8594–8603, 2019.
257
+
258
+ Peter J Rousseeuw. Silhouettes: a graphical aid to the interpretation and validation of cluster analysis. Journal of computational and applied mathematics, 20:53–65, 1987.
259
+
260
+ Victor Sanh, Lysandre Debut, Julien Chaumond, and Thomas Wolf. Distilbert, a distilled version of bert: smaller, faster, cheaper and lighter. arXiv preprint arXiv:1910.01108, 2019.
261
+
262
+ Yu Sun, Shuohuan Wang, Yukun Li, Shikun Feng, Xuyi Chen, Han Zhang, Xin Tian, Danxiang Zhu, Hao Tian, and Hua Wu. Ernie: Enhanced representation through knowledge integration. arXiv preprint arXiv:1904.09223, 2019.
263
+
264
+ # SUPPLEMENTARY: FULL RESULTS ON PTB AND WIKITEXT-2 DATASETS
265
+
266
+ A RESULTS ON WIKITEXT-2 DATASET
267
+
268
+ A.1 THE UNADJUSTED INTER AND INTRA COSINE SIMILARITY
269
+
270
+ Note that ”dist” in the following legends represents DistilBERT model.
271
+
272
+ ![](images/d3b31b73869877931ca23d5335d8e559b86505992ae72bab6d01eea5408d73db.jpg)
273
+ (a) Inter-type cosine similarity. As layers goes deeper, inter-type cosine goes higher. All models’ last layer behaves slightly differently.
274
+
275
+ ![](images/fd112fcbdd7851f1e89a735db24e549230ca05a99c4286c76d3969c383abcae9.jpg)
276
+ (b) Intra-type cosine similarity. The intratype cosine decreases showing the same type’s embedding instances are spreading in deeper layers.
277
+
278
+ # A.2 THE CENTER-SHIFTED AND CLUSTERED COSINE SIMILARITY
279
+
280
+ The inter-type and intra-type cosines are adjusted using the proposed center-shifting and clustering methods. Now it reflects the isotropy in almost all layers in all models.
281
+
282
+ ![](images/27d062567129ed55049d928946d8298204602844f53ff6425e780483f68710d6.jpg)
283
+ (a) The clustered inter-type cosine (center shifted). It shows strong isotropy as the average cosine between different types is close to 0 across all layers in all models. The GPT2’s last layer still has slighly higher cosine compared with others.
284
+ (b) The clustered intra-type cosine (center shifted). The intra-type cosines are much more consistent than the unadjusted counterpart (the cosine decreases nearly monotonically as layers goes deeper).
285
+
286
+ # A.3 THE APPROXIMATE LOCAL INTRINSIC DIMENSIONS
287
+
288
+ ![](images/9d2d424665076507dee26cec957ddc3a85a28d6236f015a5454e21a850ca6376.jpg)
289
+ Figure 12: Local Intrinsic Dimensions. The LID increases as layer goes deeper, reflecting embeddings spreading out in all models’ deeper layers (becoming more locally isotropic).
290
+
291
+ # B FULL VISUALIZATION - PTB DATASET
292
+
293
+ # B.1 BERT
294
+
295
+ ![](images/2e4eaef7513b51bb72fdd99fac9c371d18f71af1418a19c10e5c3bdd8fe2a32c.jpg)
296
+
297
+ # B.2 DISTILBERT AND ELMO
298
+
299
+ ![](images/f5ab49376c5293ae84918964f8ec0d3832317d6dda68fbb0fb601df09cae06a8.jpg)
300
+
301
+ # B.3 GPT
302
+
303
+ ![](images/658c078f041c7f147c5d6a9c00e6fc8005b4f72b6aa37c5876f641601e8ed051.jpg)
304
+
305
+ # B.4 GPT2
306
+
307
+ ![](images/10dc438ddf4b4974ea74c1c03f1afb6172c2fa1415440f1b0694e3657180c496.jpg)
308
+
309
+ # C FULL VISUALIZATION - WIKITEXT-2 DATASET
310
+
311
+ # C.1 BERT
312
+
313
+ ![](images/494ce7bd1b5153c302f3e3bf4176a80030af640fe34fcb735798932f23eb4ef4.jpg)
314
+
315
+ # C.3 GPT
316
+
317
+ ![](images/d3536c57f6da080aaec22a26a2c68bcd539e11588c0e371e08dd478c37f7686c.jpg)
318
+
319
+ # C.4 GPT2
320
+
321
+ ![](images/71c302876402c4800c25f59fac14ac2d2292172d999f401b2fdcf9d5590b1d87.jpg)
322
+
323
+ # D ADDITIONAL STUDIES
324
+
325
+ # D.1 K-MEANS CLUSTERING ACCURACY
326
+
327
+ We use K-Means to perform clustering, which raises two issues here. First, K-Means is very sensitive to initialization, different initialization could leads to different clustering results. However, note that in our task, we are not seeking for optimal clustering. Sub-optimal, e.g. treating two overlapping clusters as a big one, is totally fine.
328
+
329
+ To illustrate this, we add another metric, Davies-Boulding (DB) index (Davies & Bouldin, 1979), to show that slightly different $K$ is fine. This DB index is the average similarity between each cluster and its closest cluster. The value closer to 0, the better clustering is done. We still search in [2, 15], and choose $K$ with the minimum DB index (MDB). MDB sometimes gives different $K$ than that by MMS metric. If MDB is $> 4$ , we discard MDB and treat all data as one single cluster. We provide the comparison of selecting $K$ using MMS (left) and MDB (right) here in Table 4. We can see that for less-distinct clusters, e.g. in BERT, two metric could yield different $K$ values, due to merging or splitting. For very separated clusters, e.g. in GPT2, the two metric agrees. We plot the cosines using MDB’s $K$ values, in Figure 21. It is similar to Figure 4, which uses slightly different $K$ from MMS. The values are close to 0 indicating isotropy in the center-shifted clusters. This means that the procedure to reveal isotropy, is not sensitive to $K$ in K-Means.
330
+
331
+ Table 4: $K$ by MMS(left) vs MDB(right)
332
+
333
+ <table><tr><td rowspan=1 colspan=1>Layer</td><td rowspan=1 colspan=2>BERT D-BERT</td><td rowspan=1 colspan=3>GPT GPT2ELMo</td></tr><tr><td rowspan=1 colspan=1>0</td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>7 9</td><td rowspan=1 colspan=1>18</td><td rowspan=1 colspan=1>25</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>1015</td><td rowspan=1 colspan=1>22</td><td rowspan=1 colspan=1>22</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>412</td><td rowspan=1 colspan=1>155</td><td rowspan=1 colspan=1>22</td><td rowspan=1 colspan=1>22</td><td rowspan=10 colspan=1></td></tr><tr><td rowspan=1 colspan=1>3</td><td rowspan=1 colspan=1>415</td><td rowspan=1 colspan=1>1411</td><td rowspan=1 colspan=1>22</td><td rowspan=1 colspan=1>22</td></tr><tr><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>314</td><td rowspan=1 colspan=1>102</td><td rowspan=1 colspan=1>22</td><td rowspan=1 colspan=1>22</td></tr><tr><td rowspan=1 colspan=1>5</td><td rowspan=1 colspan=1>1413</td><td rowspan=1 colspan=1>24</td><td rowspan=1 colspan=1>22</td><td rowspan=1 colspan=1>22</td></tr><tr><td rowspan=1 colspan=1>6</td><td rowspan=1 colspan=1>614</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>22</td><td rowspan=1 colspan=1>22</td></tr><tr><td rowspan=1 colspan=1>7</td><td rowspan=1 colspan=1>215</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>22</td><td rowspan=1 colspan=1>22</td></tr><tr><td rowspan=1 colspan=1>8</td><td rowspan=1 colspan=1>27</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>22</td><td rowspan=1 colspan=1>22</td></tr><tr><td rowspan=1 colspan=1>9</td><td rowspan=1 colspan=1>116</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>12</td><td rowspan=1 colspan=1>22</td></tr><tr><td rowspan=1 colspan=1>10</td><td rowspan=1 colspan=1>24</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>110</td><td rowspan=1 colspan=1>22</td></tr><tr><td rowspan=1 colspan=1>11</td><td rowspan=1 colspan=1>93</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>22</td></tr></table>
334
+
335
+ ![](images/c74b9f11688be8777c2d718b7ae66e0014c01a49d8b1ef2041c8c50ca7353255.jpg)
336
+ Figure 21: The adjusted inter-type cosines, computed using $K$ from the criteria of minimizing DB index. The values are still close to 0.
337
+
338
+ Another issue is that K-Means implicitly assumes convex clusters, which often does not hold. In fact, it assumes isotropic convex clusters because we simply use $\ell _ { 2 }$ distance. However, density-based clustering such as DBSCAN, is too slow thus cannot handle these datasets (million level). This is a trade-off to use K-Means, and empirical results above show that it is efficient and very useful to distinguish separated clusters.
339
+
340
+ # D.2 CLUSTERS AND WORDS
341
+
342
+ We study the tokens and their relationship to the clusters existed in the contextual embedding spaces. We picked some representative tokens to see how they are distributed. We also study the very unique small cluster in GPT2, and how it connects to the main cluster that is far away. We obtain the following observations:
343
+
344
+ • For BERT, high frequent words (e.g. ’the’) stays at one side of the main big cluster, while low-frequent words are at the other side.
345
+ • For BERT, punctuation are random but occupy distinct islands: ’!’ is a small cluster close to the main island; ’‘’ and ’are distinct islands far away; ’?’ and some others are on the main ´ cluster.
346
+ • For GPT2, almost all single letters (a to z) and mid-to-high frequent would occupy both the left (big) and right (small) islands.
347
+ • For GPT2, we didn’t find any token that only appears in the right small island. It seems the token in the small island always has mirrors in the left big cluster.
348
+
349
+ • For word types, e.g. noun, verb, etc, we didn’t find a clear pattern. We suspect word frequency affects more than categories.
350
+
351
+ We provide a few examples. Figure 22, 23 show BERT layer 3, Figure 24, 25 show GPT2 layer 3.
352
+
353
+ ![](images/aa6919e04668010698db22808030aee83973b3ffbe8e31660f5f094e7c307d5b.jpg)
354
+ Figure 22: BERT Layer 3 Punctuation
355
+
356
+ ![](images/e9503c3fe8b70d306c1306c53809c6e81e2a7c7e621f9de2a1515cde4c47d270.jpg)
357
+ Figure 23: BERT Layer 3 Words
358
+
359
+ (a) Frequent words and infrequent words are on the main cluster, but at two sides. An evidence that words are distributed based on the frequency.
360
+
361
+ ![](images/5a26b55f9580f90ab89586cd6bef05c01ca251fb8c049898500383a8088fd153.jpg)
362
+ Figure 24: GPT2 Layer 3 Punctuation
363
+
364
+ Based on these observations, we have concluded that frequency plays an important role in the token distributions. High frequent words and low frequent words are often taking opposite sides of the space. This is also revealed in Section 4.3. We are yet not clear what causes this, but we suspect it is related to the training process. During training, high frequent words are updated more times. Also, since they are used in many many different context, they play a role as some shared embedding across context. Similar to the XLM model, the shared embedding are often more isotropic and more concentrated. However, this is early hypothesis and due to future research.
365
+
366
+ ![](images/61bcc139cf80ad60418f5affb2f714d3232f2857d1ad86733ec3149d77f18162.jpg)
367
+ Figure 25: GPT2 Layer 3 Words
368
+
369
+ (a) Mid-to-high frequent words often occupy both distinct islands (notice that the right small cluster is also colored), where a roll-shaped alignment can be observed on the larger island.
370
+
371
+ # D.3 EMBEDDING OF TRANSLATION LANGUAGE MODEL XLM
372
+
373
+ We also perform analysis and visualization on the XLM model (Conneau & Lample, 2019). BERT is mask language model (MLM), GPT is causal language model (CLM), and XLM is translation language model (TLM). We provide visualization of XLM’s 6 layers embeddings here. This is on WikiText-2 dataset.
374
+
375
+ ![](images/806dbebb04a4975490ba49bdc803f110776f93f63fded2c8151eadfdb3f3efcb.jpg)
376
+
377
+ We try to establish a systematic view of embedding geometry for different types of deep LMs. We have hypothesis and very preliminary results here. BERT (an MLM) show spreading clusters, but not very distinct. GPT (an CLM) shows highly separated clusters. XLM (an TLM) does not demonstrate clustering effect, and the embedding are centered.
378
+
379
+ One possible explanation for XLM’s behavior, is that this is a multi-lingual model, and the embedding space have to be shared between languages. This is forced during the training process of this translation language models. In that case, a single cluster residing in the center, would be a good shared embedding across languages. However, this is just hypothesis and requires further study on more models.
380
+
381
+ # D.4 LID ESTIMATION ROBUSTNESS
382
+
383
+ We follow (Aumuller & Ceccarello, 2019) to choose ¨ $K = 1 0 0$ for K-Nearest-Neighbor (K-NN) search for LID approximation, and make a direct comparison with them. It raises the concern that 100 samples might not be enough to effectively estimate the local dimension. We conduct additional experiments here to select $K = 2 0 0$ , 500, 1000, and demonstrate that the LID estimation is robust. They provide similar LID estimates across all layers, in all the models. Though using more samples indeed obtain very slightly higher values of LID (in Figure 27, we can see a little bit up-shifting from left-most plot to the right-most plot). This is expected, as less number of samples often tends to under-estimate, and over-smoothing of LID. Nevertheless, the LID is still much smaller than the original dimension 768, so using 100 samples is a good trade-off to efficiently approximate LID.
384
+
385
+ ![](images/a5cd6892ab66d2515b9ffc0312780f17a2e20d75b9fb0caf49ca9208b01539d5.jpg)
386
+ Figure 27: LID estimate using different number of samples for nearest neighbor search.
387
+
388
+ As layer goes deeper, the LID increases. In other words, the local space dimension expands, at a cost of losing density. For example, the spiral band (1-D) in GPT’s front layer, becomes a Swiss Roll (2-D), and the roll surface get thickness (3-D), as layer increases. But we are not clear about the reasons yet, only suspect that data is spreading as more context info is added in later layers (the embedding for a token in deeper layer is based on summation of all embeddings in the context, due to attention). This is due to future study.
389
+
390
+ # D.5 ABLATION ANALYSIS ON CLUSTERING
391
+
392
+ To better study the clustering effect, we conduct experiment that computes the inter-type cosines, on clusterd-only embeddings and clustered plus center-shifted embeddings. The following figure shows GPT2’s cosine on original embeddings without adjustment (blue), the clustering-only embeddings (orange), and full (clustering $^ +$ centering) adjustment (green).
393
+
394
+ ![](images/3dfdde2bfa21ba167cb9517485ea0e877cedf95bdaa8fc62274a36eb7a729fa2.jpg)
395
+
396
+ In the original embedding without adjustment, we see inconsistent behavior in the last layers. However, if we perform clustering and measure the $S _ { \mathrm { i n t e r } }$ within the clusters (orange), we can see much more consistent behavior across layers (more flat curve). This indicates that the clustering effect exists in all the layers, which is also verified by layer-wise visualization in Appendix B.4 and C.4.
397
+
398
+ Meanwhile, the large values of cosines in the orange curve are expected. Now cosines are only computed within clusters, where those clusters are not at the origin. The higher values here, the more concentrated clusters are. These indicate that after clustering, the subspace within each cluster are now consistent, across all the layers. Finally, we shift those clusters to the origin, and get the green curve (values near 0), indicating isotropic cluster shapes.
399
+
400
+ # D.6 POSITIONAL ENCODING IN THE GEOMETRY
401
+
402
+ It is very interesting to investigate whether the positional encoding affects the geometry in the contextual embedding spaces. In particular, since GPT/GPT2 have a unique Swiss-Roll shaped manifold, that is not observed in other models, we look at how the manifold is related to the positional encoding in GPT2. Note that we truncate the whole PTB text into 512-length segments, and feed those segments into the models. The positional encoding is applied to each 512-length segment. We pick a few punctuation and words, and draw them in the space labeled by their relative positions in their corresponding segments. The position ID ranges from 0 to 511.
403
+
404
+ ![](images/4d8857bcef41a545cb24d43fde5ecda6c5151e4852d99c5f604a03bc29255186.jpg)
405
+ Figure 29: GPT2 Layer 3 Punctuation. The position ID is monotonically increasing along the manifold.
406
+
407
+ ![](images/b7340eac72344ac4942d9c8ade5da4b2fd722cdc2dc7ef6bf94ffabee7f3a5f6.jpg)
408
+ Figure 30: GPT2 Layer 3 Words. The position ID is monotonically increasing along the manifold.
409
+
410
+ We select 4 punctuation, “, ’ & $\$ 7$ , and four words “the first super man”, draw them in Figure 29 30. The color bar on the side indicates the relative position ID in their segment. Darker color is smaller IDs and lighter color is bigger IDs. Clearly, for both punctuation and words, the center of the Swiss-Roll corresponds to lower position IDs, where the other end of the manifold are high IDs. Also, the distribution is monotonic. From the center to the far end, the position ID increases. This suggests that the positional encoding is indeed highly correlated with the Swiss-Roll manifold for GPT models. The reason causing this is deferred to future study.
411
+
412
+ Note that this finding is consistent with that reported in (Reif et al., 2019), where they found that positions of the token matters (tokens take all neighbors’ information indiscriminately, rather than only attending up to their semantic boundaries) in the BERT embedding geometry. We also study the context/semantic influence of the embeddings in the next subsection.
413
+
414
+ # D.7 CONTEXT IN THE GEOMETRY
415
+
416
+ We also look at how the context information influences the geometry. It is more sophisticated to analyze the context, so we pick a few examples to look at their context and corresponding positions in the embedding spaces. In particular, we choose the common polysemous words “like” and “interest”, as two examples. The word “like” often has two different use cases: 1. favor; 2. similar to. There are also some fixed phrases such as “would like”. The word “interest” has two senses as well: 1. like to do something; 2. the money sense.
417
+
418
+ We identified the target word token (“like” or “interest”), and then print out 5 tokens before and after the target, as the context for illustration in Figure 31. From the figure we are not able to identify a clear pattern that word sense is correlated with the geometric space. However, this is only inspected by manually checking a few samples. A full statistical analysis should be carried out in the future work.
419
+
420
+ ![](images/52c0ef7a1a1af05fee8d2a5073039265f2911d975831698d802a0a2d86d83e76.jpg)
421
+ Figure 31: The context and positions in the embedding space.
md/train/zOngaSKrElL/zOngaSKrElL.md ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Self-Supervised Bug Detection and Repair
2
+
3
+ Miltiadis Allamanis, Henry Jackson-Flux∗, Marc Brockschmidt Microsoft Research, Cambridge, UK {miallama, mabrocks}@microsoft.com
4
+
5
+ # Abstract
6
+
7
+ Machine learning-based program analyses have recently shown the promise of integrating formal and probabilistic reasoning towards aiding software development. However, in the absence of large annotated corpora, training these analyses is challenging. Towards addressing this, we present BUGLAB, an approach for selfsupervised learning of bug detection and repair. BUGLAB co-trains two models: (1) a detector model that learns to detect and repair bugs in code, (2) a selector model that learns to create buggy code for the detector to use as training data. A Python implementation of BUGLAB improves by up to $30 \%$ upon baseline methods on a test dataset of 2374 real-life bugs and finds 19 previously unknown bugs in open-source software.
8
+
9
+ # 1 Introduction
10
+
11
+ Detecting and repairing bugs in source code requires strong reasoning skills over formal structures (e.g. data and control flow) and ambiguous information (e.g. identifier names, coding idioms, and comments). Traditional program analyses are able to detect critical bugs through formal reasoning and combinatorial search, but need to be manually coded by experts. That is a lengthy and costly process, which misses the opportunity to use ambiguous information pervasive within code.
12
+
13
+ Towards broadening the applicability of such methods, and utilizing ambiguous information, deep learning-based bug detection methods are being investigated [22, 3, 13]. These methods have the potential to further improve the engineering of software we rely on every day. However, many challenges in the area remain open, such as creating robust bug detection and repair methods that cover a wide range of common bugs in the absence of large supervised training corpora. Existing work focuses on randomly inserted bugs [22, 13], Cloze test proxy tasks [3], corpora of small code edits that may contain bugs [9] or build errors [28]. All these approaches rely on datasets of very limited size or ones known not to be representative of the characteristics of bugs found in real code.
14
+
15
+ In this work, we propose BUGLAB, a self-supervised approach that trains robust bug detectors by co-training a bug selector that learns to create hard-to-detect bugs (Sec. 2). For example, for a given code snippet with two well-named variables, a variable misuse bug may be easy to detect and repair, whereas an incorrect comparison operator might be significantly harder to identify. We propose a neural architecture for BUGLAB (Sec. 3) and implement it for Python (Sec. 4). Our implementation considers four broad classes of seemingly simple, yet hard-to-detect bugs and shows improved performance over training with randomly-inserted bugs on PYPIBUGS, a new, manually curated test set of 2374 real-life bugs (Sec. 5). Furthermore, we tested our trained models on popular open-source Python packages and identified 19 previously unreported bugs, though false positive rates of $\sim 9 8 \%$ remain impractical. We hope that creating machine learning methods that can detect these bugs early and assist developers will speed up software development and allow engineers to deliver more robust software. We release PyPIBugs and our code at https://github.com/ microsoft/neurips21-self-supervised-bug-detection-and-repair.
16
+
17
+ # 2 Self-Supervised Bug Detection
18
+
19
+ In this section, we first introduce the concept of code rewriting, and then use it to define BUGLAB as a framework for self-supervised learning of bug detection and repair.
20
+
21
+ Code Rewriting Rewriting is common within compilers and their optimizations, test-driven searchbased bug repair tools, mutation testing, and refactoring tools. Rewrites can be semantics-preserving (e.g. renamings of local variables), or semantics-altering (e.g. replacing $> = \log ~ ! = )$ .
22
+
23
+ Let $s$ denote the set of all syntax trees (not necessarily rooted in the start symbol of the language grammar). Syntax tree locations $\ell \in \{ \epsilon \} \cup \mathbb { N } ^ { * }$ in a syntax tree $\mathrm { s } \in { \mathcal { S } }$ are recursively defined, where $\mathrm { s } _ { \vert \epsilon } = \mathrm { s }$ and $\mathrm { s } _ { | \ell }$ for $\ell = \ell ^ { \prime } \circ i$ is the $i$ -th child of $\mathrm { s } _ { \vert \ell ^ { \prime } }$ (i.e. s|(2,3) denotes the third child of the second child of s). We define a rewrite rule $\rho = ( \mathrm { m } _ { \rho } , \mathrm { t } _ { \rho } )$ as a pair of a matching function $\operatorname { m } _ { \rho } : S \{ t r u e , f a l s e \}$ and a transformation function $\mathrm { t } _ { \rho } : { \mathcal { S } } { \mathcal { S } }$ . The matching function $\mathrm { m } _ { \rho } ( \mathrm { s } )$ yields true iff the rule $\rho$ is applicable at the root of a subtree s. The transformation function can be applied to obtain a transformed syntax tree. For convenience, we define $\mathrm { t } _ { \rho } ( \mathrm { s } ) = \mathrm { s }$ iff $\mathrm { m } _ { \rho } ( \mathrm { s } ) = f a l s e$ . We then write $\rho ( \mathrm { s } )$ to indicate the modification of a syntax tree s using $\rho$ when possible, and otherwise the identity function. For reversible rewrite rules $\rho$ , we denote the inverse rule as $\rho ^ { - 1 }$ such that $\rho ^ { - 1 } ( \rho ( \mathrm { s } ) ) = \mathbf { \dot { s } }$ holds. We discuss concrete rewrite rules $\rho$ in Sec. 4.
24
+
25
+ Given a set of rewrite rules $\mathcal { R }$ we define the set of “potential rewrites” in a syntax tree s as $R _ { \mathrm { s } } ^ { \mathcal { R } } =$ $\{ \langle \ell , \rho \rangle \mid \rho \in { \mathcal { R } } , \ell$ location in s, $, \mathbf { m } _ { \rho } ( \mathbf { s } _ { | \ell } ) = t r u e \}$ . For each tuple $\langle \ell , \rho \rangle \in R _ { \mathrm { s } } ^ { \mathcal { R } }$ , we use $\mathrm { s } ^ { \prime } = \mathrm { s } [ \rho ] \varrho$ to denote the new syntax tree obtained by applying $\rho$ at location $\ell$ of s. In BUGLAB, we train models that use rewrites from $R _ { \mathrm { s } } ^ { \mathcal { R } }$ to insert and repair bugs. We will discuss such neural models in Sec. 3.
26
+
27
+ BUGLAB In BUGLAB, we are interested in selfsupervised training of a robust bug detector model $D _ { \theta }$ with parameters $\theta$ on an unannotated codebase $C$ . Let $\mathcal { R }$ be a set of rewrite rules2 that allows to insert and repair bugs. We train $D _ { \theta }$ to be able to recognize the “hardest” possible rewrites that could be applied on our codebase $C$ For this, we consider the loss $\mathcal { L } _ { D _ { \theta } }$ of $D _ { \theta }$ on a rewritten code snippet $\mathrm { s } [ \rho ] _ { \ell }$ , for which the model needs to predict the repairing rewrite $\langle \ell , \rho ^ { - 1 } \rangle$ . Formally, we want to minimize the objective
28
+
29
+ $$
30
+ E _ { \mathrm { s } \sim C } \left[ \operatorname* { m a x } _ { \langle \ell , \rho \rangle \in R _ { \mathrm { s } } ^ { \mathcal { R } } } \mathcal { L } _ { D _ { \theta } } \left( \mathrm { s } [ \rho ] _ { \ell } , \left. \ell , \rho ^ { - 1 } \right. \right) \right] .
31
+ $$
32
+
33
+ ![](images/6a90afa1a44c13ced3e725f045bc326e6741157b1e8e404cd0b3127444e41f05.jpg)
34
+ Figure 1: BUGLAB overview: a selector model $S _ { \phi }$ decides which (bugintroducing) rewrite to apply to an input code snippet. Then a bug detector $D _ { \theta }$ tries to locate and repair the inserted bug (if one was inserted).
35
+
36
+ However, for any useful detector the set of rewrites $R _ { \mathrm { s } } ^ { \mathcal { R } }$ is commonly very large or unbounded and computing the maximum over all $\langle \bar { \ell , } \rho \rangle \in R _ { \mathrm { s } } ^ { \mathcal { R } }$ is practically intractable. To address this, BUGLAB introduces a bug selector model $S _ { \phi }$ (with parameters $\phi _ { , }$ ), whose goal is to approximate the intractable $\mathrm { m a x } _ { \langle \ell , \rho \rangle \in R _ { \mathrm { s } } ^ { \mathcal { R } } } \mathcal { L } _ { D _ { \theta } } \left( \cdot \right)$ . We can then sample rewrites from $S _ { \phi }$ instead of computing the maximum. We denote this as $\langle \ell , \rho \rangle \sim S _ { \phi } ( s )$ and the overall BUGLAB training objective can be written as a min-max optimization problem:
37
+
38
+ $$
39
+ \operatorname* { m a x } _ { \phi } \operatorname* { m i n } _ { \theta } E _ { \mathrm { s } \sim C } \left[ E _ { \langle \ell , \rho \rangle \sim S _ { \phi } ( \mathrm { s } ) } \left[ \mathcal { L } _ { D _ { \theta } } \left( \mathrm { s } [ \rho ] _ { \ell } , \langle \ell , \rho ^ { - 1 } \rangle \right) \right] \right] .
40
+ $$
41
+
42
+ The two models $S$ and $D$ in BUGLAB are “symmetric” in the sense that they both predict rewrites on code snippets, and only differ in their objectives — one aiming to introduce bugs and one aiming to repair them. In practice, we can and do use the same architecture to model both $S$ and $D$ , which we will discuss in the next section. At test time, we discard $S$ and only use the trained detector $D$ to locate and repair bugs.
43
+
44
+ # 3 Neural Models
45
+
46
+ In this section, we discuss how we represent code in BUGLAB and the neural models we use to learn how to rewrite code in the selector and detector models.
47
+
48
+ Code Representation We consider source code as a set of entities $v _ { i } ~ \in ~ V$ which relate to each other with a set of typed relations $e _ { k } \in E$ , where a relation $e _ { k } = ( v _ { i } , r , v _ { j } )$ denotes a relationship between entities $v _ { i }$ and $v _ { j }$ with type $r$ . The entities and relations can be thought as a heterogeneous graph $G = ( V , E )$ . The choice of code entities and their relationships is a form of high-level feature extraction. We discuss concrete entities and relationships for Python in Sec. 4. We also define a projection function $\mathbb { P } _ { t o k }$ that accepts $V$ and $E$ and returns a sequence $V _ { t o k }$ of the token entities in $V$ with the nodes appearing in relations in $E$ deterministically mapped to elements of $V _ { t o k }$ , i.e. $E _ { t o k } = \{ ( p ( v _ { i } ) , r , p ( \hat { v _ { j } } ) ) \}$ , where $p$ maps the entities in $V$ to $V _ { t o k } . \mathbb { P } _ { t o k }$ will be used for relational transformer models.
49
+
50
+ To learn a neural representation of the code entities $v _ { i }$ , first we define an embedding function $e ( v _ { i } )$ which maps the content of each entity to an initial $D$ -dimensional representation. Throughout this work — similar to Allamanis et al. [4] and other previous work — we deterministically split the string representation of each node into subtokens (e.g., fooBar is split into foo and bar), embed them through a learned embedding matrix, and use max pooling to get a single vector. We then “contextualize” the entity representations within $G$ using one of two models: a MLP-based GNN model with max message aggregation and the GREAT relational transformer of Hellendoorn et al. [13] over the token sequence and relations $V _ { t o k } , E _ { t o k } = \mathbb { P } _ { t o k } ( V , E )$ . GREAT uses both positional encodings and the projected relations in $E _ { t o k }$ . See Appx. A for detailed architecture descriptions. Other models to compute entity representations can be used, but were not explored in this work.
51
+
52
+ We use $\mathbfit { \Delta } \mathbf { r } _ { \ell }$ to denote the computed vector representation of the entity at location $\ell$ , independent of the model used to produce it. We use these representations to define our code rewriting models.
53
+
54
+ Probabilistic Code Rewriting Models Both bug selection and bug detection require to model the probability of applying a specific rewrite at a location in a code snippet s, either to introduce or repair a bug. For this, we factorize this task into localization and rewrite-given-location models, i.e.
55
+
56
+ $$
57
+ p \left( \langle \ell , \rho \rangle \mid \mathrm { s } , R _ { \mathrm { s } } ^ { \mathcal { R } } \right) = p _ { l o c } { \big ( } \ell \mid \mathrm { s } , R _ { \mathrm { s } } ^ { \mathcal { R } } { \big ) } p _ { r e w } { \big ( } \rho \mid \ell , \mathrm { s } , R _ { \mathrm { s } } ^ { \mathcal { R } } { \big ) } .
58
+ $$
59
+
60
+ We model $p _ { l o c }$ as a probability distribution over the relevant locations $\{ \ell \mid \langle \ell , \rho \rangle \in R _ { \mathrm { s } } ^ { \mathcal { R } } \} \cup \{ \mathrm { N o B U G } \}$ , where NoBug is a special location used to indicate that the code is not buggy. In practice, we implement this similar to a pointer net [19] using the representations $\mathbfit { \Delta } \mathbf { r } _ { \ell }$ (see Appx. A for details).
61
+
62
+ To select rewrites, we use rewrite type-specific learnable rule score functions $w _ { \rho } \left( r _ { \ell } , \mathcal { M } _ { \rho } ( \mathrm { s } , \ell ) \right)$ . This function maps a vector representation of an entity $\mathbf { \Delta } _ { \mathbf { \lambda } ^ { \mathbf { r } } \ell }$ and potential additional metadata onto a scalar score. The rule-specific metadata $\mathcal { M } _ { \rho } ( \mathrm { s } , \ell )$ is defined for some rewrites, e.g. containing representations of other entities that could be used in the location $\ell$ . We will discuss three concrete rule score functions in Sec. 4. The rewrite probability distribution $p _ { r e w }$ is then modeled by a softmax over the scores of all applicable rewrites at a target location $\ell$ , i.e.
63
+
64
+ $$
65
+ p _ { r e w } \left( \rho \mid \ell , \mathbf { s } , R _ { \mathbf { s } } ^ { \mathcal { R } } \right) = \operatorname * { s o f t m a x } _ { \langle \ell , \rho ^ { \prime } \rangle \in R _ { \mathbf { s } } ^ { \mathcal { R } } } \left( w _ { \rho ^ { \prime } } \left( r _ { \ell } , \mathcal { M } _ { \rho ^ { \prime } } ( \mathbf { s } , \ell ) \right) \right) .
66
+ $$
67
+
68
+ # 4 A Python Implementation
69
+
70
+ This section presents an implementation of BUGLAB for Python called PYBUGLAB. PYBUGLAB currently tackles a large subset of “stupid simple bugs” [16]. Fixing these bugs requires small changes to the code, but commonly has significant impact on code correctness. Such bugs may be thought as a form of a typographical mistake or a copy-paste error, and are often relatively hard to locate by humans but obvious after the fact. They are also quite common, as observed in the empirical statistics of Karampatsis and Sutton [16] and Just et al. [14]. Future work may focus on a broader set of rewrite rules or even learnable rewrites, but as we will observe in Sec. 5 more work is needed towards this. Almost all ideas in PYBUGLAB transfer straightforwardly to other programming languages other than Python, but would require some engineering effort to implement.
71
+
72
+ PYBUGLAB Code Entities and Relations In this work, we follow related literature (see Sec. 6 for more) and extract entities and relationships that are readily available by tokenizers, parsers, existing simple program analyses, or other Python-specific program analysis tools. The complete list of entities and relationships can be found in Appx. B and include syntactic entities and relations, relations about the intraprocedural data and control flow, types, and documentation. Some notable entities include SyntaxNodes, Tokens, and Symbols (references to variables and functions). Fig. 4 in Appx. B shows a graph of the entities and relationships of the snippet in Fig. 2.
73
+
74
+ ![](images/6fa04aa00a25535c0128e4a64746beb8ef02776ba155a61e8b37f97000e3c308.jpg)
75
+ Figure 2: Code snippet and rewrites available to PYBUGLAB.
76
+
77
+ # 4.1 Bug-Inducing PYBUGLAB Rewrite Rules
78
+
79
+ PYBUGLAB focuses on four common kinds of bugs. Fig. 2 shows a code snippet and the rewrites allowed for each location, which number 63 even for this small example.
80
+
81
+ Variable Misuse Originally defined by Allamanis et al. [3] as a Cloze test for source code, Vasic et al. [30] and Hellendoorn et al. [13] reformulated the task to localizing a variable misuse bug (if any) within a snippet and repairing it. PYBUGLAB uses the latter representation. Variable misuse bugs are common, with $1 2 . 8 \AA - 1 4 . 8 \%$ found in the ManySStuBs4J corpus [16] and about $6 \%$ of them caught during Java compilation in the Google build system [28]. To insert and repair variable misuse bugs, PYBUGLAB supports variable-swapping rewrites, such as in locations $l _ { 1 }$ , $l _ { 3 }$ and $l _ { 4 }$ (amongst others) in Fig. 2. To score a variable-swapping rewrite, we use the representation of the rewrite location $\mathbfit { \Delta } \mathbf { r } _ { \ell }$ along with the representation $\mathbf { \Delta } _ { r _ { \sigma } }$ of a variable Symbol $\sigma$ that could replace the current variable, i.e. is in-scope and has been defined before $\ell$ . The rule score function $w _ { \rho }$ for replacing the variable at $\ell$ with the symbol $\sigma$ is then computed as the inner product $\boldsymbol { r } _ { \ell } ^ { \top } \boldsymbol { r } _ { \sigma }$ .
82
+
83
+ Argument Swapping (or Argument Selection) First coined by Rice et al. [26], it refers to swapping the arguments of a function invocation, e.g. in $l _ { 6 }$ of Fig. 2. Rice et al. [26] and DeepBugs [22] tackled this problem when all arguments are single identifiers. PYBUGLAB extends this to swapping arbitrary argument expressions. The rule score function $w _ { \rho }$ for an argument swapping rewrite is a two-layer MLP applied to the concatenation of the output representations of the representation of the parameter and the to-be-swapped arguments arg1, and arg2: MLP $\left( [ r _ { \mathrm { p a r a m s } } , r _ { \mathrm { a r g 1 } } , r _ { \mathrm { a r g 2 } } ] \right)$ .
84
+
85
+ Wrong Operator Corrupting operators has a long history in mutation testing [14]. Detecting incorrect operators with deep learning was first tackled by DeepBugs [22] by using learnable embeddings of operators, operands and literals for arithmetic and comparison operators. DeepBugs focused only on binary operators. In PYBUGLAB we tackle all binary operators, including Boolean, arithmetic and comparison operators and two unary operators: logical and arithmetic negation. Locations $l _ { 1 1 }$ , $l _ { 1 4 }$ , $l _ { 1 6 }$ , and $l _ { 2 0 }$ in Fig. 2 are rewrites related to wrong operators. The rule score function $w _ { \rho }$ for an operator rewrite again uses an inner product, $\boldsymbol { r } _ { \ell } ^ { \top } \boldsymbol { r } _ { \mathtt { \diamond p } }$ , where $\pmb { r } _ { \tt o p }$ is a learned embedding for operator op. Note that we rewrite operators only to compatible operators (e.g. $<$ to $>$ but not $^ +$ ).
86
+
87
+ Wrong Literal Corrupting operands, and specifically, literals appearing in the source code, is also a common strategy in mutation testing. As in mutation testing, PYBUGLAB handles a limited number of commonly used literals, allowing rewrites to replace integer literals within the set of $- 2 , - 1 , 0 , 1 , 2$ and swapping the Boolean literal True with False and vice versa. The scoring function is identical to the operator rewrite, using a learnable embedding ${ \bf { r } } _ { \mathrm { { 1 i t } } }$ for each literal lit.
88
+
89
+ # 4.2 PYBUGLAB Rewrite Rules for Data Augmentation
90
+
91
+ We additionally consider more rewrite rules that are not meant to change the program semantics, using them as a form of data augmentation. This is in spirit similar to ideas in computer vision where images are transformed (e.g. rotated, cropped) but maintain their original content. Such rewrites
92
+
93
+ Require: Code dataset $C$ , initial detector/selector model parameters $\theta ^ { ( 0 ) }$ , $\phi ^ { ( 0 ) }$
94
+
95
+ 1: for meta-epoch $i = 0$ to $I$ do
96
+ 2: // Create dataset of buggy programs:
97
+ 3: $C _ { D } ^ { ( i ) } \gets \left\{ \left( \mathrm { s } [ \rho ] _ { \ell } , \left. \ell , \rho ^ { - 1 } \right. \right) \mid \mathrm { s } \in C , k \mathrm { \ s a m p l e s \ } \left. \ell , \rho \right. \sim S _ { \phi ^ { ( i ) } } ( \mathrm { s } ) \right\}$
98
+ 4: $\theta ^ { ( i + 1 ) } $ update $\theta ^ { ( i ) }$ by training $D$ on $C _ { D } ^ { ( i ) }$
99
+ 5: // Create dataset of hard-to-detect bugs:
100
+ 6: $\begin{array} { r } { C _ { S } ^ { ( i ) } \gets \left\{ \left( \mathrm { s } , \mathrm { a r g } \operatorname* { m a x } _ { \langle \ell , \rho \rangle \in R _ { \mathrm { s } } ^ { \mathcal { R } } } \left( \mathcal { L } _ { D _ { \theta ^ { ( i + 1 ) } } } \left( \mathrm { s } [ \rho ] _ { \ell } , \langle \ell , \rho ^ { - 1 } \rangle \right) \right) \right) \mid \mathrm { s } \in C \right\} } \end{array}$
101
+ 7: $\phi ^ { ( i + 1 ) } $ update $\phi ^ { ( i ) }$ by training $S$ on $C _ { S } ^ { ( i ) }$
102
+
103
+ have been shown to yield adversarially robust models of code [23]. Although our goal is not to provide adversarial robustness, we believe that such rewrites can help generalization. PYBUGLAB implements the following rewrites for this purpose:
104
+
105
+ • Variable Renaming renames a local variable to a random name not already in scope. • Comment Deletion removes code comments, including docstrings and inline comments. Such comments commonly contain natural language information that is useful for code comprehension, but usually do not affect program semantics. • Comparison Expression Mirroring swaps the two sides of a comparison operator and changes it appropriately. For example, $\mathtt { a } < \mathtt { b }$ is transformed to $\mathtt { b } > \mathtt { a }$ . Note that in cases such as $\mathbf { f } \circ \circ ( ) \ < \ \mathsf { b a r } ( )$ , this will change the order of execution of foo and bar, possibly altering program semantics. • If-Else Branch Swapping negates the test condition of an if-else statement or a ternary expressions using DeMorgan’s law and swaps the then body with the else body.
106
+
107
+ # 4.3 Implementation Details
108
+
109
+ To make the training computationally tractable we approximate Eq. 1. A simplified, sequential version of our training procedure is shown in Alg. 1. Intuitively, we alternate between training the two models, as the (discrete) sampling of rewrite rules in the selector models precludes direct endto-end training. We first use the current state of the selector model to generate “hard” samples and train the detector model on these samples (we always include the unmodified (i.e., NoBug case) as a sample). Then, we use the loss of the detector model to identify those generated samples that were hardest to detect and train the selector model to produce such samples.
110
+
111
+ In practice, we implemented the training procedure as a system of asynchronously communi$C _ { D / S } ^ { ( 0 ) } , \bar { C } _ { D / S } ^ { ( 1 ) } , \dots$ , and all of the described steps happen in parallel. We do not use “generations”of datasets, but instead use two constantly updated “pools” of training data, one state of the corresponding data pool. We remove samples from the data pool once they have been sampled $\nu$ times for use in training, in spirit similar to replay buffers in reinforcement learning. In our experiments, $\nu$ was set to 4. We regularly (in separate, concurrent processes) take snapshots of the the current state of the $D$ and $S$ models to generate new elements that are updated to the data pools, matching the procedure described in Alg. 1. We approximate the arg max in line 6 by only considering the $k$ samples chosen in line 3 for each input program. During training of $S$ , we then mask out the unobserved choices before computing the loss.
112
+
113
+ # 5 Evaluation
114
+
115
+ We now discuss our new dataset and evaluate PYBUGLAB. We $\divideontimes$ . . . . . . . . . .highlight. . . . .key . . . . . . . .results.
116
+
117
+ Datasets To train PYBUGLAB we retrieve the 4k most downloaded packages in the Python package index (PyPI) and take $3 . 4 \mathrm { k }$ of them as training packages, using the rest for test purposes. During training, PYBUGLAB installs each package along with all its dependencies. Installing all the dependencies is important for extracting the entities and the relations beyond local syntactic ones (e.g. type inference, method resolution). For each file, PYBUGLAB checks if it is a duplicate of a file that has already been seen in the training following the method of Allamanis [1] and runs all the relevant program analyses to extract the entities and relationships in each function. When we use additional rewrites for data augmentation, these are applied at the input of the PYBUGLAB pipeline as a form of pre-processing. Following Alg. 1, the bug selector $S$ selects $k = 5$ bugs to introduce, rewrites the source code text, and then the program analyses extract the new entities and relationships for the rewritten code snippets. The initial and rewritten code snippets are then used to create the training data for the detector and selector models.
118
+
119
+ We use two testsets to measure performance. First, we create RANDOMBUGS, a testset of 761 445 snippets derived from functions from the $6 0 0 \mathrm { P y P I }$ test packages (not seen during training). For each function we find within these packages we add it to the dataset along with 9 rewritten functions with a randomly inserted bug. On average graphs have 260 nodes, 601 edges, 25 rewrite locations, and 130 possible rewrites. We also collect a testset of real bugs. Although we conjecture that, in practice, the vast majority of bugs like those discussed in Sec. 4.1 are fixed when developers locally test their software, a few of those slip and then are fixed across different revisions checked into a version control systems. We have crawled the accessible repositories of all $2 8 5 \mathrm { k }$ packages in the Python Package Index (PyPI), collected and manually filtered bugs captured by the rewrites from Sec. 4.1. $\divideontimes$ . . . . .This. . . . . .new . . . . . . . . .dataset, . . . . . . . . . . . . . . .PYPIBUGS,. . . . . . . . . .contains. . . . . . .2374 . . . . . . . . . . . . .real-world,. . . . . . .small . . . . . . .bugs. We describe the data collection process in detail in Appx. D. In addition, we consider PYPIBUGS-PostFix: the examples from PYPIBUGS after a bug was fixed - we believe these samples are very likely to not contain any bugs anymore. We publish the dataset at https://www.microsoft.com/en-us/download/103554 and include it in the supplementary material.
120
+
121
+ # 5.1 Quantitative Evaluation
122
+
123
+ Our first experiment aims to evaluate whether the BUGLAB training framework yields more precise bug detectors. We consider two model architectures, using either GNNs or the GREAT transformer to compute embeddings of code entities (architecture details and hyperparameter choices can be found in Appx. A). We use four different training strategies: “supervised” is training only a bug detector on a fixed dataset of 1 million functions from the $3 . 4 \mathrm { k }$ training packages with randomly inserted bugs. “Random Selector” refers to a variant of PYBUGLAB using a bug selector model that uniformly at random picks a rewrite to insert bugs. Finally, PYBUGLAB and PYBUGLAB $+ \mathrm { A u g }$ use our framework from Sec. 2, with the latter also using additional rewrites to augment our code corpus. For the fully supervised model, we train with early stopping over a validation set; the other models are trained for a fixed number of 300 epochs (with $2 0 0 \mathrm { k }$ training samples per epoch) for the bug detector3 and the last detector model is used for evaluation.
124
+
125
+ Table 1: Accuracies $( \% )$ for different training strategies and model architectures on RANDOMBUGS.
126
+
127
+ <table><tr><td rowspan="3"></td><td colspan="6">RANDOMBUGS</td></tr><tr><td></td><td>GNN</td><td></td><td></td><td>GREAT</td><td></td></tr><tr><td>Joint</td><td>Loc</td><td>Repair</td><td>Joint</td><td>Loc</td><td>Repair</td></tr><tr><td>Supervised</td><td>62.4</td><td>73.6</td><td>81.2</td><td>51.0</td><td>61.9</td><td>76.3</td></tr><tr><td>Random Selector</td><td>69.4</td><td>79.6</td><td>84.0</td><td>63.9</td><td>73.6</td><td>82.0</td></tr><tr><td>PYBUGLAB</td><td>69.6</td><td>80.4</td><td>84.2</td><td>64.0</td><td>74.3</td><td>82.3</td></tr><tr><td>PYBUGLAB +Aug</td><td>70.3</td><td>81.1</td><td>84.5</td><td>65.3</td><td>75.3</td><td>82.5</td></tr></table>
128
+
129
+ Effectiveness of BUGLAB Training We first consider the performance of different models on the synthetic RANDOMBUGS dataset. Tbl. 1 shows the accuracy of predicting a full bug repair correctly (“Joint”) and analogous to Eq. 2 break this up into a localization accuracy (“Loc”) of predicting the correct location (or NoBug for correct examples) and a repair accuracy (“Repair”) for selecting the correct rewrite given the buggy location.
130
+
131
+ We observe that $\divideontimes$ . . . . . . . . . . . . . . . . . . . . .BUGLAB-training. . . . . . .leads. . . .to . . . . . . .more. . . . . . . .robust. . . . . .bug . . . . . . . . . . .detectors. . . . . . . . . . . . .compared. . .to. . . . . . . .other methods .......... for both GNNs and GREAT. Random selector models — a form of data augmentation — improve performance over supervised methods but mostly on in-distribution RANDOMBUGS samples. As expected, $\divideontimes$ . . . . . . . . . . . . .augmenting. . . . .the . . . . . .code. . . . . . . . .dataset. . . . . . .helps . . . . . . . . . . . . . . . . .generalization, but does not make a substantial difference. Expanding the kinds of rewrites used to augment the data and learning to select them may improve performance in the future.
132
+
133
+ Table 2: Results for different training strategies and model architectures on PYPIBUGS.
134
+
135
+ <table><tr><td></td><td colspan="6">PYPIBUGS</td><td colspan="4">PYPIBUGS-PostFix</td></tr><tr><td></td><td colspan="3">GNN</td><td colspan="3">GREAT</td><td colspan="2">GNN</td><td colspan="2">GREAT</td></tr><tr><td></td><td>Joint</td><td>Loc</td><td>Repair</td><td>Joint</td><td>Loc</td><td>Repair</td><td>Loc</td><td>Joint AUC</td><td>Loc</td><td>Joint AUC</td></tr><tr><td>Supervised</td><td>20.0</td><td>28.4</td><td>61.8</td><td>16.8</td><td>25.8</td><td>58.6</td><td>17.8</td><td>0.087</td><td>20.7</td><td>0.044</td></tr><tr><td>Random Selector</td><td>21.2</td><td>27.0</td><td>69.2</td><td>20.6</td><td>26.8</td><td>67.2</td><td>47.5</td><td>0.108</td><td>52.5</td><td>0.117</td></tr><tr><td>PYBUGLAB</td><td>24.2</td><td>31.3</td><td>70.7</td><td>24.0</td><td>32.8</td><td>67.9</td><td>32.9</td><td>0.160</td><td>28.6</td><td>0.140</td></tr><tr><td>PYBUGLAB +Aug</td><td>26.4</td><td>33.5</td><td>72.0</td><td>23.2</td><td>29.7</td><td>68.8</td><td>32.6</td><td>0.187</td><td>48.2</td><td>0.129</td></tr></table>
136
+
137
+ Table 3: Localization and Repair Accuracy $( \% )$ per bug kind for the PYBUGLAB +Aug model.
138
+
139
+ <table><tr><td rowspan="3">Bug Type</td><td colspan="4">RANDOMBUGS</td><td colspan="4">PYPIBUGS</td></tr><tr><td colspan="2">GNN</td><td colspan="2">GREAT</td><td colspan="2">GNN</td><td colspan="2">GREAT</td></tr><tr><td>Loc</td><td>Repair</td><td>Loc</td><td>Repair</td><td>Loc</td><td>Repair</td><td>Loc</td><td>Repair</td></tr><tr><td>Argument Swapping</td><td>85.0</td><td>57.3</td><td>65.5</td><td>57.2</td><td>33.2</td><td>73.9</td><td>24.3</td><td>72.7</td></tr><tr><td>Wrong Assign Op</td><td>96.1</td><td>99.1</td><td>94.5</td><td>98.6</td><td>20.0</td><td>68.9</td><td>14.0</td><td>58.1</td></tr><tr><td>Wrong Binary Op</td><td>83.0</td><td>85.2</td><td>77.3</td><td>81.4</td><td>27.2</td><td>54.3</td><td>36.6</td><td>43.7</td></tr><tr><td>Wrong Boolean Op</td><td>71.8</td><td>99.5</td><td>43.6</td><td>99.5</td><td>27.6</td><td>96.9</td><td>15.7</td><td>97.2</td></tr><tr><td>Wrong Comparison Op</td><td>83.9</td><td>79.3</td><td>80.0</td><td>76.4</td><td>33.7</td><td>66.1</td><td>31.1</td><td>53.5</td></tr><tr><td>Wrong Literal</td><td>71.7</td><td>74.7</td><td>66.6</td><td>71.6</td><td>21.6</td><td>78.4</td><td>17.9</td><td>79.5</td></tr><tr><td>Variable Misuse</td><td>84.9</td><td>88.4</td><td>78.2</td><td>86.3</td><td>35.3</td><td>70.5</td><td>34.0</td><td>69.4</td></tr><tr><td>NoBUG</td><td>53.8</td><td></td><td>62.5</td><td></td><td></td><td></td><td></td><td></td></tr></table>
140
+
141
+ Furthermore, $\ast { \mathrm { l o u g } } .$ . . . . . . . . . . . . . .localization . . .is . . . . . . .much . . . . . . . .harder. . . . . .than . . . . . . . .repair . . .at . .a . . . . . . .given . . . . . . . . . .location. This is somewhat expected: there are many more candidate locations compared to potential repairs at a given location. However, this suggests that research should focus on the localization problem rather than repair.
142
+
143
+ We now turn to the results on PYPIBUGS, shown in Tbl. 2, which also includes the accuracy of choosing the special NoBug location on the PYPIBUGS-PostFix dataset, as well as the area under the precision recall curve for the results on both PYPIBUGS and PYPIBUGS-PostFix.
144
+
145
+ We find that $\divideontimes$ . . . . . . . . . .detecting. . . . .and. . . . . . . . . . . .repairing . . . . . . . . .real-life. . . . . . .bugs . .is. . . . . . . . . . . . . . .significantly. . . . . . . .harder. . . . . .than. . . . . . . . . . .handling . . . . . . . . . . . .randomly . . . . . . . . .inserted. . . . . .bugs. As PYBUGLAB models trained using a learned bug selector outperform those using a “Random Selector”, we speculate that the learned selector avoids generating easy-to-detect bugs, focusing the detector model on recognizing deeper semantic patterns. Despite this, improvements in RANDOMBUGS often correlate with improvements in PYPIBUGS. This is encouraging: collecting PYPIBUGS-like datasets is costly; corpora with random bugs can help measure relative improvements to some extent. Finally, we find that $\divideontimes$ . . . . . . . . . . . . . .recognizing . . . . . . . . . . . . .non-buggy . . . . . . . . . .samples. . .is . . . . . .very . . . . . .hard, and in particular, does not always profit from training in PYBUGLAB.
146
+
147
+ In our qualitative analysis (Sec. 5.2), we observed that the models raised some confident but incorrect warnings at very “odd” locations. However, these warnings were different across models. We have tested an ensembling strategy averaging the output probabilities of five separately trained GNN models. This results in localization and repair accuracies of $8 3 . 0 \%$ and $8 5 . 4 \%$ on RANDOMBUGS (vs. $8 1 . 1 \%$ and $8 4 . 5 \%$ ) and $3 4 . 4 \%$ and $7 2 . 2 \%$ on PYPIBUGS (vs. $3 3 . 5 \%$ and $7 2 . 0 \%$ ). As we discuss in Sec. 5.2 finding the cause of the “spurious” warnings is important future work.
148
+
149
+ Per-Bug Evaluation To better understand which bugs are hard to detect, we break down the results the best-performing PYBUGLAB $+ \mathrm { A u g }$ models on RANDOMBUGS by type of bug in Tbl. 3. We observe that incorrect literals are some of the hardest bugs to detect. Incorrect assignment operators $( e . g . = \mathrm { a n d } + = )$ ) are easy to detect in RANDOMBUGS, but significantly harder in PYPIBUGS. This may be attributed to class imbalance, with simple assignment $( = )$ being the majority class. $\divideontimes$ Detecting . . . . . . . . . . . . . .if .a. . . . . . . . .snippet. . . . .has . .a . . . . .bug . . .or . . . .not. . . . . . . .seems . . .to . . .be. . . .the. . . . . . . . .hardest. . . . . .task:. . . .no. . . . . . . .model . . . . . . . . . .achieves. . . . . . . . . . .accuracy. . . . . . . . .beyond. $6 3 \%$ .
150
+
151
+ We note that in our experiments, GNNs-based models seem to often outperform GREAT, somewhat contradicting the results of Hellendoorn et al. [13]. We have performed substantial additional experiments to investigate and verify these results, cf. Sec. A.2. This may have to do with the performance of these models on long sequences or that the GNN has access to more fine-grained information, instead of relations over the projected token sequences. For example, this could be attributed to the lack of syntax and symbol nodes in the representation used in GREAT. Nevertheless, GREAT is noticeably better ( $6 2 . 5 \%$ vs. $5 3 . 8 \%$ ) at detecting NoBug and locating wrong binary operators in PYPIBUGS.
152
+
153
+ Table 5: Bug distribution $( \% )$ in different datasets
154
+
155
+ <table><tr><td>Bug Kind</td><td>PYPIBUGS</td><td>RANDOMBUGS</td><td>Selector Samples</td></tr><tr><td>Argument Swapping</td><td>11.9</td><td>8.4</td><td>23.8</td></tr><tr><td>Wrong Assignment</td><td>1.9</td><td>8.5</td><td>5.3</td></tr><tr><td>Wrong Binary Operator</td><td>3.4</td><td>2.4</td><td>2.3</td></tr><tr><td>Wrong Boolean Operator</td><td>8.1</td><td>2.2</td><td>6.4</td></tr><tr><td>Wrong Comparison Operator</td><td>17.1</td><td>8.2</td><td>7.4</td></tr><tr><td>Wrong Literal</td><td>3.7</td><td>11.6</td><td>12.4</td></tr><tr><td>Variable Misuse</td><td>53.8</td><td>58.6</td><td>42.5</td></tr></table>
156
+
157
+ Bug Selector Performance To understand how training of the bug selector proceeds, we perform two experiments. In our first experiment, we take a snapshot of the selector model during training of the PYBUGLAB $+ \mathrm { A u g }$ (GNN) model every 24 hours, after an initial burn-in phase of 12 hours. We then generate 10000 buggy samples using each of these snapshots and then test a fixed model on each of these snapshots. The results of this are shown in Tbl. 4, using a fully trained PYBUGLAB $+ \mathrm { A u g }$ (GNN) model from another training run as a fixed model. We conclude that . . . . . . . . . . . . . . . . . . . . . . . . .PYBUGLAB succeeds. . . .in . . . . . . . . . .learning . . .to . . . . . . . . . .generate. . . . . . . .harder. . .to find ..........bugs, though we can observe the selector model trading off “harder-to-localize” and “harder-tofix” properties. Tests on other models show similar trends, confirming the robustness of this result.
158
+
159
+ Table 4: Development of Performance on Bug Selector Samples
160
+
161
+ <table><tr><td>Training&#x27; Time</td><td>Joint</td><td>Loc</td><td>Repair</td></tr><tr><td>0.5 days</td><td>64.2</td><td>83.8</td><td>72.1</td></tr><tr><td>1.5 days</td><td>62.5</td><td>80.7</td><td>72.9</td></tr><tr><td>2.5 days</td><td>62.0</td><td>83.0</td><td>69.8</td></tr><tr><td>3.5 days</td><td>61.7</td><td>82.5</td><td>69.8</td></tr><tr><td>4.5 days</td><td>61.9</td><td>83.0</td><td>69.5</td></tr><tr><td>5.5 days</td><td>61.1</td><td>83.0</td><td>68.6</td></tr><tr><td>6.5 days</td><td>60.5</td><td>78.7</td><td>72.4</td></tr></table>
162
+
163
+ In a second experiment, we compare the distribution of different bug kinds in PYPIBUGS and RANDOMBUGS with the distribution of bugs sampled from the final snapshot of our selector model from above. The results are shown in Tbl. 5, where we can see that a number of bugs (argument swapping, use of wrong literals and of assignment operators) are substantially over-represented, whereas mistakes in comparison operators and variable misuse are under-represented. This indicates that . . . . . . . . . . . . . . . . . . . . . . . . . .PYBUGLAB generates. . . . . .hard . . .to . . . . . .find, . . . .but. . . .not. . . . . . . . . . . . . .necessarily . . . . . . . . . .realistic . . . . . .bugs.
164
+
165
+ Comparison to CuBERT Finally, we compare our models to CuBERT [15], which uses a masked language modeling objective to pre-train a BERT-like model and then learns bug detectors specific to a class of bugs (e.g., wrong binary operators) on top of this pre-trained model. Note that CuBERT detects $i f$ a bug exists but does not localize it. For the comparison, we create two sub-datasets of PYPIBUGS: PYPIBUGS-WrongOp contains the 501 samples that involve the binary operators supported by CuBERT, and PYPIBUGS-VarMisuse, which contains the 1278 bugs that involve variable misuses. We complete both of these datasets with 501 (resp. 1278) random NoBug code samples from our RANDOMBUGS, to match the 1:1 buggy/non-buggy distribution used in CuBERT’s training. Since CuBERT classification models focus on a single bug type, to compare to PYBUGLAB we mask out all code locations that do not correspond to a bug that could be detected by the corresponding CuBERT model. We then treat the prediction of the NoBug location as a “non-buggy” prediction and all other locations as a “buggy” prediction. For example, for the snippet in Fig. 2, only the locations $l _ { 2 }$ , $l _ { 1 1 }$ , $l _ { 1 4 }$ , $l _ { 1 6 }$ , and $l _ { 2 0 }$ and their corresponding rewrites are considered by PYBUGLAB for the comparison on PYPIBUGS-WrongOp.
166
+
167
+ Tbl. 6 shows the results of comparing the released CuBERT snapshots with the PYBUGLAB +Aug GNN model. We observe that $\divideontimes$ . . . .the . . . . . . . . . . . . . . . . . . . . . . . . .PYBUGLAB models
168
+
169
+ Table 6: Comparison with CuBERT [15]
170
+
171
+ <table><tr><td rowspan="2"></td><td colspan="3">CuBERT</td><td colspan="3">PYBUGLAB (GNN)</td></tr><tr><td>Prec</td><td>Recall</td><td>F1</td><td>Prec</td><td>Recall</td><td>F1</td></tr><tr><td>PYPIBUGs-WrongOp</td><td>0.764</td><td>0.251</td><td>0.378</td><td>0.730</td><td>0.764</td><td>0.746</td></tr><tr><td>PYPIBUGS-VarMisuse</td><td>0.632</td><td>0.403</td><td>0.493</td><td>0.740</td><td>0.840</td><td>0.787</td></tr></table>
172
+
173
+ . . . . .have. . . . . . . . . . . . . . . .substantially . . . . . . .better. . . . . . .recall. . . . . .than. . . . . . . . . . . . . . . . . . .CuBERT-based . . . . . . . . .models, even though they were trained to detect more bug types. When calibrating the CuBERT models to have a recall equal to PYBUGLAB, heir precision drops substantially. In particular, on PYPIBUGS-WrongOp, it is reduced to 0.609, and
174
+
175
+ 1 def make_id(name):
176
+ 2 $\mathbf { r } \ =$ get_rand_string(12)
177
+ 3 if len(name) <= 22:
178
+ 4 name $=$ name[:22]
179
+ 5 return name $\textrm { + } \textrm { -- } \textrm { + } \textrm { \pmb { r } }$ (a) A wrong comparison operator bug (red box) in PYPIBUGS detected and repaired by the GNN PYBUGLAB +Aug models.
180
+
181
+ 1 def update(self, roomId,
182
+ 2 title, \*\*request_params):
183
+ 3 check_type(roomId, basestring)
184
+ 4 check_type(roomId, basestring)
185
+ 5 [...]
186
+
187
+ (b) A variable misuse (red box) caught in an open-source project. GNN PYBUGLAB $+ \mathrm { A u g }$ suggests to rewrite roomId to title. The fixing pull request is found here.
188
+
189
+ Figure 3: Bugs found by PYBUGLAB. Snippets reformatted and abbreviated to fit figure.
190
+
191
+ on PYPIBUGS-VarMisuse, it is reduced to 0.613; in both cases, PYBUGLAB outperforms CuBERT substantially.
192
+
193
+ # 5.2 Qualitative Inspection of Raised Warnings
194
+
195
+ We now take a qualitative look at the raised warnings raised by PYBUGLAB. As example, Fig. 3a shows a sample of PYPIBUGS where the developer used an incorrect comparison operator. Once pointed to it, it is clear to a human that the truncation statement in line 4 has no effect (under the reasonable assumption that name is a string), and that a different comparison operator $( > )$ is necessary.
196
+
197
+ To gain an understanding of the performance of PYBUGLAB on realistic data, we performed an indepth analysis of the cases flagged as bugs by our best-performing model on the code found within the 4k top PyPI packages. We observed a mixture of false positives with few previously unseen real-life bugs, matching the quantitative results in Tbl. 3. First, we find that the majority of the false positives are “incorrect literal” detections. This suggests that learning to detect such bugs is a hard problem. Furthermore, many literals serve as default “configurations” (e.g. the number of retries for a network request) and different values are not bugs. We posit that a large percentage of literal replacements the selector learns to make fall in this category.
198
+
199
+ We also found that some repairs suggested by the model actually produce semantically equivalent code. For example, the model lacks knowledge that two variables refer to the same object in memory (aliasing), and so attempts to “repair” variable misuse bugs by switching between these. Other examples includes checking the return values of standard functions such as Python’s str.find, which returns $^ { - 1 }$ if the query string is not found. In such cases, PYBUGLAB often suggested to rewrite an if $\mathbf { x } \lrcorner \mathbf { f i n d } ( \mathbf { y } ) \ \ll \ - 1$ to if $\mathbf { x } \lrcorner \mathbf { f i n d } ( \mathbf { y } ) \ = - 1$ , which makes no difference in practice. These false negatives can be attributed to the fact that the bug selector model considers such changes as introducing bugs, even though they are not actually changing behavior. This suggests that for better results, the rewrite rules need to ensure that the rewrites are not semantics-preserving and represent bugs.
200
+
201
+ Finally, some reported issues were sufficiently complex that it took us (the human authors) a couple of minutes of thought to conclude that a warning is spurious. Simultaneously, there are some warnings that are “obviously” incorrect to us, but the reasons why the neural models raise them is unclear. This highlights the importance of research on explainability techniques along with better ways to calibrate model confidence. The fact that selectors may introduce spurious “bugs” may also be affecting how the detector model learns. Ideas that have appeared in reinforcement learning, such as the one of Dennis et al. [8], may allow models to improve their performance in spite of spurious bugs.
202
+
203
+ Overall, $\yen 123,456,7$ . . .of. . . . .the . . . . . .1000. . . . . . . . . . .reported . . . . . . . . . . .warnings . . . . . .were. . . . . . . .found . . .to . . .be. . . . . . . . . .real-life. . . . . . .bugs. Of these 19, we reported 11 on GitHub (6 already merged, 5 pending approval). See Appx. G for details. 3 other bugs had already been fixed between the version PYBUGLAB processed and the current version or the project was deprecated, whereas another 5 bugs are minor and we decided not to report them. One of the detected bugs is shown in Fig. 3b. Overall, most of the detected bugs appear within unit tests, logging, or exception handling, possibly because bugs there do not impact the core functionality of a project. However, given the number of such bugs we collected in PYPIBUGS, we believe that such bugs arise equally often in other code, but that they are detected and fixed more quickly.
204
+
205
+ Although our analysis only forms a lower bound on the precision of PYBUGLAB and related methods, it suggests that there is still ample room for future improvements towards making machine learningbased bug detection and repair practically useful.
206
+
207
+ # 6 Related Work
208
+
209
+ Detecting bugs in source code has been researched since the early days of computing. Traditionally, bug detection is tackled as a formal task, where any code that cannot be proved to satisfy some correctness property may contain a bug. This is essential for security- and safety-critical bugs, but not for other — equally common — bugs. In the last decade, software engineering and programming language research have increasingly realized ambiguous information within code (e.g. variable names, comments) contains valuable information and using this information can yield valuable results [2]. The main premise is that patterns in source code, such as patterns in names, control, and data flow can be informative. This information can also be exploited to detect some bugs. For example, Ray et al. [24] noted that even simple language models tend to assign lower probability to buggy code.
210
+
211
+ Multiple static analysis methods have been researched that combine some form of data-oriented bug detection. This ranges from language model-based tools, such as the early work of Wang et al. [32] to specification-mining tools such as the work of Eberhardt et al. [10]. BUGLAB is related to DeepBugs [22] which uses an MLP over a limited window of code tokens and train separate models to detect wrong operators, operands, and argument swappings. BUGLAB opts for a more structured representation of code and a single model. Allamanis et al. [3], Vasic et al. [30], Hellendoorn et al. [13] tackle variable misuse bugs (one of the kinds of bugs included in PYBUGLAB) but either by randomly introducing the bugs in code or using a Cloze-like test. Instead, BUGLAB opts for a selfsupervised approach and tackles a broader range of bugs. Concurrently to this work, Patra and Pradel [21] showed an alternative method for learning to generate realistic bugs. Dinella et al. [9] learn a supervised sequential model that performs graph transformations that replicate small edits in code (refactoring, introducing functionality, bug fixing, etc.). Their model — Hoppity — could serve as a learnable rewrite operation in BUGLAB in future work. Dynamic analysis methods have also been researched with promising results [31], but collecting representative dynamic traces over a diverse set of programs at scale (e.g. from the top Python packages used in this work) is practically impossible.
212
+
213
+ BUGLAB is related to ideas around self-supervised learning recently explored in deep learning, computer vision, and NLP. In our case, we aim to train a bug detection model without using training data from real-life bugs. BUGLAB resembles ELECTRA [6], with the important difference that the rewrites to the input code go beyond single token replacement that need to respect strict constraints of programming languages (syntax, variable scopes) and the model is directly used for bug detection, rather than for pre-training. The main BUGLAB objective Eq. 1 also resembles GANs [12] with the exception that the objective is non-differentiable (introducing a bug alters the discrete data representation), the selector is a structured probabilistic code rewriting model, and that we are mainly interested in the bug detector (analogous to the discriminator) rather than the selector.
214
+
215
+ # 7 Discussion and Conclusions
216
+
217
+ Learned program analyses offer the promise to improve how we develop software. They also offer a great opportunity to study machine learning models that combine formal and probabilistic reasoning. Towards achieving these we presented BUGLAB, a self-supervised approach for learning program analyses, that improves upon baseline methods and detects bugs in real-life code. We also empirically show the limitations of existing bug-detecting machine learning methods, which suffer from impractical false-positive rates. Importantly, we show the large gap of performance of existing methods on corpora of randomly inserted bugs — commonly used in prior work — and real-life bugs.
218
+
219
+ # Acknowledgements
220
+
221
+ We want to thank Sebastian Nowozin and Marwin Segler for helpful discussions, Marwin Segler for comments on a draft of this work, and the anonymous reviewers for useful questions and suggestions. Finally, we would like to thank the contributors to the following open-source tools used: PyTorch [20], PyDriller [27], MessagePack, LibCST, Jedi, Kubernetes, Helm.
222
+
223
+ References
224
+ [1] M. Allamanis. The adverse effects of code duplication in machine learning models of code. In Proceedings of the 2019 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software, pages 143–153, 2019.
225
+ [2] M. Allamanis, E. T. Barr, P. Devanbu, and C. Sutton. A survey of machine learning for big code and naturalness. ACM Computing Surveys (CSUR), 51(4):1–37, 2018.
226
+ [3] M. Allamanis, M. Brockschmidt, and M. Khademi. Learning to represent programs with graphs. In International Conference on Learning Representations (ICLR), 2018.
227
+ [4] M. Allamanis, E. Barr, S. Ducousso, and Z. Gao. Typilus: Neural type hints. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 91–105. Association for Computing Machinery (ACM), 2020.
228
+ [5] T. Bachlechner, B. P. Majumder, H. H. Mao, G. W. Cottrell, and J. McAuley. Rezero is all you need: Fast convergence at large depth. arXiv preprint arXiv:2003.04887, 2020.
229
+ [6] K. Clark, M.-T. Luong, Q. V. Le, and C. D. Manning. ELECTRA: Pre-training text encoders as discriminators rather than generators. arXiv preprint arXiv:2003.10555, 2020.
230
+ [7] M. Cvitkovic, B. Singh, and A. Anandkumar. Deep learning on code with an unbounded vocabulary. In Machine Learning 4 Programming, 2018.
231
+ [8] M. Dennis, N. Jaques, E. Vinitsky, A. Bayen, S. Russell, A. Critch, and S. Levine. Emergent complexity and zero-shot transfer via unsupervised environment design. arXiv preprint arXiv:2012.02096, 2020.
232
+ [9] E. Dinella, H. Dai, Z. Li, M. Naik, L. Song, and K. Wang. Hoppity: Learning graph transformations to detect and fix bugs in programs. In International Conference on Learning Representations, 2019.
233
+ [10] J. Eberhardt, S. Steffen, V. Raychev, and M. Vechev. Unsupervised learning of API aliasing specifications. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 745–759, 2019.
234
+ [11] J. Gilmer, S. S. Schoenholz, P. F. Riley, O. Vinyals, and G. E. Dahl. Neural message passing for quantum chemistry. In International Conference on Machine Learning, pages 1263–1272, 2017.
235
+ [12] I. J. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial networks. arXiv preprint arXiv:1406.2661, 2014.
236
+ [13] V. J. Hellendoorn, C. Sutton, R. Singh, P. Maniatis, and D. Bieber. Global relational models of source code. In International Conference on Learning Representations, 2020.
237
+ [14] R. Just, D. Jalali, L. Inozemtseva, M. D. Ernst, R. Holmes, and G. Fraser. Are mutants a valid substitute for real faults in software testing? In Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering, pages 654–665, 2014.
238
+ [15] A. Kanade, P. Maniatis, G. Balakrishnan, and K. Shi. Learning and evaluating contextual embedding of source code. In International Conference on Machine Learning (ICML), 2020.
239
+ [16] R.-M. Karampatsis and C. Sutton. How often do single-statement bugs occur? the ManySStuBs4J dataset. In Proceedings of the 17th International Conference on Mining Software Repositories, pages 573–577, 2020.
240
+ [17] J. Katz. Libraries.io Open Source Repository and Dependency Metadata, Jan. 2020. URL https://doi.org/10.5281/zenodo.3626071.
241
+ [18] Y. Li, D. Tarlow, M. Brockschmidt, and R. Zemel. Gated graph sequence neural networks. In International Conference on Learning Representations (ICLR), 2016.
242
+
243
+ [19] S. Merity, C. Xiong, J. Bradbury, and R. Socher. Pointer sentinel mixture models. In International Conference on Learning Representations (ICLR), 2017.
244
+
245
+ [20] A. Paszke, S. Gross, S. Chintala, G. Chanan, E. Yang, Z. DeVito, Z. Lin, A. Desmaison, L. Antiga, and A. Lerer. Automatic differentiation in PyTorch. 2017.
246
+ [21] J. Patra and M. Pradel. Semantic bug seeding: a learning-based approach for creating realistic bugs. In Proceedings of the 29th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, pages 906–918, 2021.
247
+ [22] M. Pradel and K. Sen. DeepBugs: A learning approach to name-based bug detection. Proceedings of the ACM on Programming Languages, 2(OOPSLA):1–25, 2018.
248
+ [23] G. Ramakrishnan, J. Henkel, Z. Wang, A. Albarghouthi, S. Jha, and T. Reps. Semantic robustness of models of source code. arXiv preprint arXiv:2002.03043, 2020.
249
+ [24] B. Ray, V. Hellendoorn, S. Godhane, Z. Tu, A. Bacchelli, and P. Devanbu. On the ”naturalness” of buggy code. In 2016 IEEE/ACM 38th International Conference on Software Engineering (ICSE), pages 428–439. IEEE, 2016.
250
+ [25] V. Raychev, M. Vechev, and A. Krause. Predicting program properties from Big Code. In Principles of Programming Languages (POPL), 2015.
251
+ [26] A. Rice, E. Aftandilian, C. Jaspan, E. Johnston, M. Pradel, and Y. Arroyo-Paredes. Detecting argument selection defects. Proceedings of the ACM on Programming Languages, 1(OOPSLA): 1–22, 2017.
252
+ [27] D. Spadini, M. Aniche, and A. Bacchelli. PyDriller: Python framework for mining software repositories. In Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering - ESEC/FSE 2018, pages 908–911, New York, New York, USA, 2018. ACM Press. ISBN 9781450355735. doi: 10.1145/3236024.3264598. URL http://dl.acm.org/citation. cfm?doid $\equiv$ 3236024.3264598.
253
+ [28] D. Tarlow, S. Moitra, A. Rice, Z. Chen, P.-A. Manzagol, C. Sutton, and E. Aftandilian. Learning to fix build errors with Graph2Diff neural networks. In Proceedings of the IEEE/ACM 42nd International Conference on Software Engineering Workshops, pages 19–20, 2020.
254
+ [29] H. Touvron, M. Cord, A. Sablayrolles, G. Synnaeve, and H. Jegou. Going deeper with image ´ transformers. arXiv preprint arXiv:2103.17239, 2021.
255
+ [30] M. Vasic, A. Kanade, P. Maniatis, D. Bieber, and R. Singh. Neural program repair by jointly learning to localize and repair. arXiv preprint arXiv:1904.01720, 2019.
256
+ [31] K. Wang and Z. Su. Blended, precise semantic program embeddings. In Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 121–134, 2020.
257
+ [32] S. Wang, D. Chollak, D. Movshovitz-Attias, and L. Tan. Bugram: bug detection with n-gram language models. In Proceedings of the 31st IEEE/ACM International Conference on Automated Software Engineering, pages 708–719, 2016.
258
+ [33] J. Wei, M. Goyal, G. Durrett, and I. Dillig. LambdaNet: Probabilistic type inference using graph neural networks. arXiv preprint arXiv:2005.02161, 2020.
parse/dev/4XMAzZasId/4XMAzZasId_layout.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:161f9ac1c171c18d38544d3197b6b9fdaf3325893eedc232c758324e3bb973df
3
+ size 1378519
parse/dev/4XMAzZasId/4XMAzZasId_origin.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:550864391d70a1b2830da3429b544d9f3a4be65abf0fa9bd65834af8e476d272
3
+ size 870224
parse/dev/4XMAzZasId/4XMAzZasId_span.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9b626ed9e046672fab4609716b0401495548c40a86e5370986ea383a30111905
3
+ size 1399975