ZHANGYUXUAN-zR commited on
Commit
aef60f4
·
verified ·
1 Parent(s): fe21bae

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. parse/train/BkglSTNFDB/BkglSTNFDB.md +683 -0
  2. parse/train/BkglSTNFDB/BkglSTNFDB_content_list.json +0 -0
  3. parse/train/BkglSTNFDB/BkglSTNFDB_middle.json +0 -0
  4. parse/train/BkglSTNFDB/BkglSTNFDB_model.json +0 -0
  5. parse/train/LAKplpLMbP8/LAKplpLMbP8.md +387 -0
  6. parse/train/LAKplpLMbP8/LAKplpLMbP8_content_list.json +1690 -0
  7. parse/train/LAKplpLMbP8/LAKplpLMbP8_middle.json +0 -0
  8. parse/train/LAKplpLMbP8/LAKplpLMbP8_model.json +0 -0
  9. parse/train/Xh5eMZVONGF/Xh5eMZVONGF.md +501 -0
  10. parse/train/Xh5eMZVONGF/Xh5eMZVONGF_content_list.json +0 -0
  11. parse/train/Xh5eMZVONGF/Xh5eMZVONGF_middle.json +0 -0
  12. parse/train/Xh5eMZVONGF/Xh5eMZVONGF_model.json +0 -0
  13. parse/train/rJerHlrYwH/rJerHlrYwH.md +298 -0
  14. parse/train/rJerHlrYwH/rJerHlrYwH_content_list.json +1615 -0
  15. parse/train/rJerHlrYwH/rJerHlrYwH_middle.json +0 -0
  16. parse/train/rJerHlrYwH/rJerHlrYwH_model.json +0 -0
  17. parse/train/tqc8n6oHCtZ/tqc8n6oHCtZ.md +232 -0
  18. parse/train/tqc8n6oHCtZ/tqc8n6oHCtZ_content_list.json +1314 -0
  19. parse/train/tqc8n6oHCtZ/tqc8n6oHCtZ_middle.json +0 -0
  20. parse/train/tqc8n6oHCtZ/tqc8n6oHCtZ_model.json +0 -0
  21. vlm/dev/3R3Pz5i0tye/0.png +3 -0
  22. vlm/dev/3R3Pz5i0tye/1.png +3 -0
  23. vlm/dev/3R3Pz5i0tye/10.png +3 -0
  24. vlm/dev/3R3Pz5i0tye/11.png +3 -0
  25. vlm/dev/3R3Pz5i0tye/12.png +3 -0
  26. vlm/dev/3R3Pz5i0tye/13.png +3 -0
  27. vlm/dev/3R3Pz5i0tye/2.png +3 -0
  28. vlm/dev/3R3Pz5i0tye/3.png +3 -0
  29. vlm/dev/3R3Pz5i0tye/4.png +3 -0
  30. vlm/dev/3R3Pz5i0tye/5.png +3 -0
  31. vlm/dev/3R3Pz5i0tye/6.png +3 -0
  32. vlm/dev/3R3Pz5i0tye/7.png +3 -0
  33. vlm/dev/3R3Pz5i0tye/8.png +3 -0
  34. vlm/dev/3R3Pz5i0tye/9.png +3 -0
  35. vlm/dev/401LFvBGIb/0.png +3 -0
  36. vlm/dev/401LFvBGIb/1.png +3 -0
  37. vlm/dev/401LFvBGIb/2.png +3 -0
  38. vlm/dev/401LFvBGIb/3.png +3 -0
  39. vlm/dev/401LFvBGIb/4.png +3 -0
  40. vlm/dev/401LFvBGIb/5.png +3 -0
  41. vlm/dev/401LFvBGIb/6.png +3 -0
  42. vlm/dev/401LFvBGIb/7.png +3 -0
  43. vlm/dev/401LFvBGIb/8.png +3 -0
  44. vlm/dev/6u6N8WWwYSM/0.png +3 -0
  45. vlm/dev/6u6N8WWwYSM/1.png +3 -0
  46. vlm/dev/6u6N8WWwYSM/10.png +3 -0
  47. vlm/dev/6u6N8WWwYSM/11.png +3 -0
  48. vlm/dev/6u6N8WWwYSM/12.png +3 -0
  49. vlm/dev/6u6N8WWwYSM/13.png +3 -0
  50. vlm/dev/6u6N8WWwYSM/14.png +3 -0
parse/train/BkglSTNFDB/BkglSTNFDB.md ADDED
@@ -0,0 +1,683 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Q-LEARNING WITH UCB EXPLORATION IS SAMPLE EFFICIENT FOR INFINITE-HORIZON MDP
2
+
3
+ Kefan Dong\*, Yuanhao Wang∗
4
+ Institute for Interdisciplinary Information Sciences, Tsinghua University
5
+ {dkf16,yuanhao-16}@mails.tsinghua.edu.
6
+ Xiaoyu Chen
7
+ Key Laboratory of Machine Perception, MOE, School of EECS,
8
+ Peking University
9
+ cxy30@pku.edu.cn
10
+ Liwei Wang
11
+ Key Laboratory of Machine Perception, MOE, School of EECS
12
+ Center for Data Science, Peking University
13
+ wanglw@cis.pku.edu.cn
14
+
15
+ # ABSTRACT
16
+
17
+ A fundamental question in reinforcement learning is whether model-free algorithms are sample efficient. Recently, Jin et al. (2018) proposed a Q-learning algorithm with UCB exploration policy, and proved it has nearly optimal regret bound for finite-horizon episodic MDP. In this paper, we adapt Q-learning with UCB-exploration bonus to infinite-horizon MDP with discounted rewards without accessing a generative model. We show that the sample complexity of exploration of our algorithm is bounded by $\begin{array} { r } { \tilde { O } \big ( \frac { S A } { \epsilon ^ { 2 } ( 1 - \gamma ) ^ { 7 } } \big ) } \end{array}$ . This improves the previously best known result of $\begin{array} { r } { \tilde { O } \big ( \frac { S A } { \epsilon ^ { 4 } ( 1 - \gamma ) ^ { 8 } } \big ) } \end{array}$ in this setting achieved by delayed Q-learning (Strehl et al., 2006), and matches the lower bound in terms of $\epsilon$ as well as and up to logarithmic factors.
18
+
19
+ # 1 INTRODUCTION
20
+
21
+ The goal of reinforcement learning (RL) is to construct efficient algorithms that learn and plan in sequential decision making tasks when the underlying system dynamics are unknown. A typical model in RL is Markov Decision Process (MDP). At each time step, the environment is in a state $s$ . The agent takes an action $a$ , obtain a reward $r$ , and then the environment transits to another state. In reinforcement learning, the transition probability distribution is unknown. The algorithm needs to learn the transition dynamics of MDP, while aiming to maximize the cumulative reward. This poses the exploration-exploitation dilemma: whether to act to gain new information (explore) or to act consistently with past experience to maximize reward (exploit).
22
+
23
+ Theoretical analyses of reinforcement learning fall into two broad categories: those assuming a simulator (a.k.a. generative model), and those without a simulator. In the first category, the algorithm is allowed to query the outcome of any state action pair from an oracle. The emphasis is on the number of calls needed to estimate the $Q$ value or to output a near-optimal policy. There has been extensive research in literature following this line of research, the majority of which focuses on discounted infinite horizon MDPs (Azar et al., 2011; Even-Dar & Mansour, 2003; Sidford et al., 2018b). The current results have achieved near-optimal time and sample complexities (Sidford et al., 2018b;a).
24
+
25
+ Without a simulator, there is a dichotomy between finite-horizon and infinite-horizon settings. In finite-horizon settings, there are straightforward definitions for both regret and sample complexity; the latter is defined as the number of samples needed before the policy becomes near optimal. In this setting, extensive research in the past decade (Jin et al., 2018; Azar et al., 2017; Jaksch et al., 2010; Dann et al., 2017) has achieved great progress, and established nearly-tight bounds for both regret and sample complexity.
26
+
27
+ The infinite-horizon setting is a very different matter. First of all, the performance measure cannot be a straightforward extension of the sample complexity defined above (See Strehl & Littman (2008) for detailed discussion). Instead, the measure of sample efficiency we adopt is the so-called sample complexity of exploration (Kakade et al., 2003), which is also a widely-accepted definition. This measure counts the number of times that the algorithm “makes mistakes” along the whole trajectory. See also (Strehl & Littman, 2008) for further discussions regarding this issue.
28
+
29
+ Several model based algorithms have been proposed for infinite horizon MDP, for example Rmax (Brafman & Tennenholtz, 2003), MoRmax (Szita & Szepesvári, 2010) and UCRL- $\gamma$ (Lattimore & Hutter, 2012). It is noteworthy that there still exists a considerable gap between the state-of-the-art algorithm and the theoretical lower bound (Lattimore & Hutter, 2012) regarding $1 / ( 1 - \gamma )$ factor.
30
+
31
+ Though model-based algorithms have been proved to be sample efficient in various MDP settings, most state-of-the-art RL algorithms are developed in the model-free paradigm (Schulman et al., 2015; Mnih et al., 2013; 2016). Model-free algorithms are more flexible and require less space, which have achieved remarkable performance on benchmarks such as Atari games and simulated robot control problems.
32
+
33
+ For infinite horizon MDPs without access to simulator, the best model-free algorithm has a sample complexity of exploration $\begin{array} { r } { \tilde { \mathcal { O } } \big ( \frac { S A } { \epsilon ^ { 4 } ( 1 - \gamma ) ^ { 8 } } \big ) } \end{array}$ , achieved by delayed Q-learning (Strehl et al., 2006). The authors provide a novel strategy of argument when proving the upper bound for the sample complexity of exploration, namely identifying a sufficient condition for optimality, and then bound the number of times that this condition is violated.
34
+
35
+ However, the results of Delayed Q-learning still leave a quadratic gap in $1 / \epsilon$ from the best-known lower bound. This is partly because the updates in Q-value are made in an over-conservative way. In fact, the loose sample complexity bound is a result of delayed Q-learning algorithm itself, as well as the mathematical artifact in their analysis. To illustrate this, we construct a hard instance showing that Delayed Q-learning incurs $\Omega ( 1 / \epsilon ^ { 3 } )$ sample complexity. This observation, as well as the success of the Q-learning with UCB algorithm (Jin et al., 2018) in proving a regret bound in finite-horizon settings, motivates us to incorporate a UCB-like exploration term into our algorithm.
36
+
37
+ In this work, we propose a Q-learning algorithm with UCB exploration policy. We show the sample complexity of exploration bound of our algorithm is $\begin{array} { r } { \tilde { \mathcal { O } } \big ( \frac { S A } { \epsilon ^ { 2 } ( 1 - \gamma ) ^ { 7 } } \big ) } \end{array}$ . This strictly improves the previous best known result due to Delayed Q-learning. It also matches the lower bound in the dependence on $\epsilon$ , $S$ and $A$ up to logarithmic factors.
38
+
39
+ We point out here that the infinite-horizon setting cannot be solved by reducing to finite-horizon setting. There are key technical differences between these two settings: the definition of sample complexity of exploration, time-invariant policies and the error propagation structure in Q-learning. In particular, the analysis techniques developed in (Jin et al., 2018) do not directly apply here. We refer the readers to Section 3.2 for detailed explanations and a concrete example.
40
+
41
+ The rest of the paper is organized as follows. After introducing the notation used in the paper in Section 2, we describe our infinite Q-learning with UCB algorithm in Section 3. We then state our main theoretical results, which are in the form of PAC sample complexity bounds. In Section 4 we present some interesting properties beyond sample complexity bound. Finally, we conclude the paper in Section 5.
42
+
43
+ # 2 PRELIMINARY
44
+
45
+ We consider a Markov Decision Process defined by a five tuple $\langle S , \mathcal { A } , p , r , \gamma \rangle$ , where $s$ is the state space, $\mathcal { A }$ is the action space, $p ( s ^ { \prime } | s , a )$ is the transition function, $r : S \times \mathcal { A } [ 0 , 1 ]$ is the deterministic reward function, and $0 \leq \gamma < 1$ is the discount factor for rewards. Let $S = | S |$ and $A = | { \mathcal { A } } |$ denote the number of states and the number of actions respectively.
46
+
47
+ Starting from a state $s _ { 1 }$ , the agent interacts with the environment for infinite number of time steps. At each time step, the agent observes state $s _ { t } \in S$ , picks action $a _ { t } \in \mathcal A$ , and receives reward $r _ { t }$ ; the system then transits to next state $s _ { t + 1 }$ .
48
+
49
+ Using the notations in Strehl et al. (2006), a policy $\pi _ { t }$ refers to the non-stationary control policy of the algorithm since step $t$ . We use $V ^ { \pi _ { t } } ( s )$ to denote the value function under policy $\pi _ { t }$ , which is defined as $\begin{array} { r } { V ^ { \pi _ { t } } ( s ) = \mathbb { E } \bigl [ \sum _ { i = 1 } ^ { \infty } \gamma ^ { i - 1 } r ( s _ { i } , \pi _ { t + i - 1 } ( s _ { i } ) ) | s _ { 1 } = s \bigr ] } \end{array}$ . We also use $V ^ { * } ( s ) = \operatorname* { s u p } _ { \pi } V ^ { \pi } ( s )$ to denote the value function of the optimal policy. Accordingly, we define $\begin{array} { r } { \mathbb { E } [ \sum _ { i = 2 } ^ { \infty } \gamma ^ { i - 1 } r ( s _ { i } , \pi _ { t + i - 1 } ( s _ { i } ) ) | s _ { 1 } = \stackrel { \cdot } { s } , a _ { 1 } = \stackrel { \cdot } { a } ] } \end{array}$ as the $\mathrm { Q }$ function under policy $Q ^ { \pi _ { t } } ( s , a ) = r ( s , a ) +$ $\pi _ { t }$ ; $Q ^ { * } ( s , a )$ is the Q function under optimal policy $\pi ^ { * }$ .
50
+
51
+ We use the sample complexity of exploration defined in Kakade et al. (2003) to measure the learning efficiency of our algorithm. This sample complexity definition has been widely used in previous works Strehl et al. (2006); Lattimore & Hutter (2012); Strehl $\&$ Littman (2008).
52
+
53
+ Definition 1. Sample complexity of Exploration of an algorithm $\mathcal { A L G }$ is defined as the number of time steps t such that the non-stationary policy $\pi _ { t }$ at time $t$ is not $\epsilon$ -optimal for current state $s _ { t }$ , i.e. $\dot { V } ^ { \pi _ { t } } \left( s _ { t } \right) \dot { < } V ^ { * } \left( s _ { t } \right) - \epsilon .$ .
54
+
55
+ Roughly speaking, this measure counts the number of mistakes along the whole trajectory. We use the following definition of PAC-MDP Strehl et al. (2006).
56
+
57
+ Definition 2. An algorithm $\mathcal { A L G }$ is said to be PAC-MDP (Probably Approximately Correct in Markov Decision Processes) $i f ,$ for any  and $\delta$ , the sample complexity of $\mathcal { A L G }$ is less than some polynomial in the relevant quantities $( S , A , 1 / \epsilon , 1 / \delta , 1 / ( 1 - \gamma ) )$ , with probability at least $1 - \delta$ .
58
+
59
+ Finally, recall that Bellman equation is defined as the following:
60
+
61
+ $$
62
+ \left\{ \begin{array} { l l } { V ^ { \pi _ { t } } ( s ) = Q ^ { \pi _ { t } } \left( s , \pi _ { t } ( s ) \right) } \\ { Q ^ { \pi _ { t } } ( s , a ) : = \left( r _ { t } + \gamma \mathbb { P } V ^ { \pi _ { t + 1 } } \right) ( s , a ) , } \end{array} \right. \quad \left\{ \begin{array} { l l } { V ^ { * } ( s ) = Q ^ { * } \left( s , \pi ^ { * } ( s ) \right) } \\ { Q ^ { * } ( s , a ) : = \left( r _ { t } + \gamma \mathbb { P } V ^ { * } \right) ( s , a ) , } \end{array} \right.
63
+ $$
64
+
65
+ which is frequently used in our analysis. Here we denote $\left[ \mathbb { P } V ^ { \pi _ { t } } \right] ( s , a ) : = \mathbb { E } _ { s ^ { \prime } \sim p ( \cdot \vert s , a ) } V ^ { \pi _ { t + 1 } } ( s ^ { \prime } ) .$
66
+
67
+ # 3 MAIN RESULTS
68
+
69
+ In this section, we present the UCB Q-learning algorithm and the sample complexity bound.
70
+
71
+ # 3.1 ALGORITHM
72
+
73
+ # Algorithm 1 Infinite Q-learning with UCB
74
+
75
+ Parameters: , γ, δ Initializ $\begin{array} { r l } & { \textnormal { \texttt { e } } Q ( s , a ) , \hat { Q } ( s , a ) \gets \frac { 1 } { 1 - \gamma } , N ( s , a ) \gets 0 , \epsilon _ { 1 } \gets \frac { \epsilon } { 2 4 R M \ln \frac { 1 } { 1 - \gamma } } , H \gets \frac { \ln 1 / ( ( 1 - \gamma ) \epsilon _ { 1 } ) } { \ln 1 / \gamma } . } \\ & { \cdot ( k ) = \ln ( S A ( k + 1 ) ( k + 2 ) / \delta ) , \alpha _ { k } = \frac { H + 1 } { H + k } . } \end{array}$ Define for $t = 1 , 2 , \dots \mathbf { d o }$
76
+ 5: Take action $a _ { t } \gets \arg \operatorname* { m a x } _ { a ^ { \prime } } \hat { Q } ( s _ { t } , a ^ { \prime } )$ Receive reward rt and transit to st+1 $\begin{array} { r l r } & { N ( s _ { t } , a _ { t } ) \gets N ( s _ { t } , a _ { t } ) + 1 } & \\ & { N ( s _ { t } , a _ { t } ) \gets N ( s _ { t } , a _ { t } ) + 1 } & \\ & { k \gets N ( s _ { t } , a _ { t } ) , b _ { k } \gets \frac { c _ { 2 } } { 1 - \gamma } \sqrt { \frac { H ( k ) } { k } } } & \\ & { \hat { V } ( s _ { t + 1 } ) \gets \operatorname* { m a x } _ { a \in A } \hat { Q } ( s _ { t + 1 } , a ) } & \\ & { Q ( s _ { t } , a _ { t } ) \gets ( 1 - \alpha _ { k } ) Q ( s _ { t } , a _ { t } ) + \alpha _ { k } \left[ r ( s _ { t } , a _ { t } ) + b _ { k } + \gamma \hat { V } ( s _ { t + 1 } ) \right] } \\ & { \hat { Q } ( s _ { t } , a _ { t } ) \gets \operatorname* { m i n } ( \hat { Q } ( s _ { t } , a _ { t } ) , Q ( s _ { t } , a _ { t } ) ) } & \end{array}$ t and can be set to $4 { \sqrt { 2 } }$
77
+ 10: end for
78
+
79
+ Here $c _ { 2 } = 4 \sqrt { 2 }$ is a constant. $\begin{array} { r } { R = \lceil \ln \frac { 3 } { \epsilon ( 1 - \gamma ) } / ( 1 - \gamma ) \rceil } \end{array}$ , while the choice of $M$ can be found in Section. 3.3. ${ \cal { \left( M = 0 \left( \ln 1 / ( 1 - \gamma ) \epsilon \right) \right) } }$ ). The learning rate is defined as $\alpha _ { k } = ( H + 1 ) / ( H + k )$ . $H$ is chosen as $\frac { \ln { 1 } / ( ( 1 - \gamma ) \epsilon _ { 1 } ) } { \ln { 1 } / \gamma }$ , which satisfies $H \leq \frac { \ln 1 / ( ( 1 - \gamma ) \epsilon _ { 1 } ) } { 1 - \gamma }$ .
80
+
81
+ Our UCB Q-learning algorithm (Algorithm 1) maintains an optimistic estimation of action value function $Q ( s , a )$ and its historical minimum value $\hat { Q } ( s , a )$ . $N _ { t } ( s , a )$ denotes the number of times that $( s , a )$ is experienced before time step $t$ ; $\tau ( s , a , k )$ denotes the time step $t$ at which $( s _ { t } , a _ { t } ) = ( s , a )$ for the $k$ -th time; if this state-action pair is not visited that many times, $\tau ( s , a , k ) = \infty$ . $Q _ { t } ( s , a )$ and $\hat { Q } _ { t } ( s , a )$ denotes the $Q$ and $\hat { Q }$ value of $( s , a )$ that the algorithm maintains when arriving at $s _ { t }$ respectively.
82
+
83
+ # 3.2 SAMPLE COMPLEXITY OF EXPLORATION
84
+
85
+ Our main result is the following sample complexity of exploration bound.
86
+
87
+ Theorem 1. For any $\epsilon > 0$ , $\delta > 0 , 1 / 2 < \gamma < 1$ , with probability $1 - \delta$ , the sample complexity of exploration (i.e., the number of time steps t such that $\pi _ { t }$ is not $\epsilon$ -optimal at $s _ { t . }$ ) of Algorithm 1 is at most
88
+
89
+ $$
90
+ \tilde { \mathcal { O } } \left( \frac { S A \ln { 1 / \delta } } { \epsilon ^ { 2 } \left( 1 - \gamma \right) ^ { 7 } } \right) ,
91
+ $$
92
+
93
+ where $\tilde { \mathcal { O } }$ suppresses logarithmic factors of $1 / \epsilon , 1 / ( 1 - \gamma )$ and $S A$ .
94
+
95
+ We first point out the obstacles for proving the theorem and reasons why the techniques in Jin et al.
96
+ (2018) do not directly apply here. We then give a high level description of the ideas of our approach.
97
+
98
+ One important issue is caused by the difference in the definition of sample complexity for finite and infinite horizon MDP. In finite horizon settings, sample complexity (and regret) is determined in the first $T$ timesteps, and only measures the performance at the initial state $s _ { 1 }$ (i.e. $( V ^ { * } - V ^ { \pi } ) ( s _ { 1 } ) )$ . However, in the infinite horizon setting, the agent may enter under-explored regions at any time period, and sample complexity of exploration characterizes the performance at all states the agent enters.
99
+
100
+ The following example clearly illustrates the key difference between infinite-horizon and finitehorizon. Consider an MDP with a starting state $s _ { 1 }$ where the probability of leaving $s _ { 1 }$ is $o ( T ^ { - 1 } )$ . In this case, with high probability, it would take more than $T$ timesteps to leave $s _ { 1 }$ . Hence, guarantees about the learning in the first $T$ timesteps or about the performance at $s _ { 1 }$ imply almost nothing about the number of mistakes the algorithm would make in the rest of the MDP (i.e. the sample complexity of exploration of the algorithm). As a result, the analysis for finite horizon MDPs cannot be directly applied to infinite horizon setting.
101
+
102
+ This calls for techniques for counting mistakes along the entire trajectory, such as those employed by Strehl et al. (2006). In particular, we need to establish convenient sufficient conditions for being $\epsilon$ -optimal at timestep $t$ and state $s _ { t }$ , i.e. $V ^ { \ast } ( s _ { t } ) - V ^ { \pi _ { t } } ( s _ { t } ) \leq \epsilon$ . Then, bounding the number of violations of such conditions gives a bound on sample complexity.
103
+
104
+ Another technical reason why the proof in Jin et al. (2018) cannot be directly applied to our problem is the following: In finite horizon settings, Jin et al. (2018) decomposed the learning error at episode $k$ and time $h$ as errors from a set of consecutive episodes before $k$ at time $h + 1$ using a clever design of learning rate. However, in the infinite horizon setting, this property does not hold. Suppose at time $t$ the agent is at state $s _ { t }$ and takes action $a _ { t }$ . Then the learning error at $t$ only depends on those previous time steps such that the agent encountered the same state as $s _ { t }$ and took the same action as $a _ { t }$ . Thus the learning error at time $t$ cannot be decomposed as errors from a set of consecutive time steps before $t$ , but errors from a set of non-consecutive time steps without any structure. Therefore, we have to control the sum of learning errors over an unstructured set of time steps. This makes the analysis more challenging.
105
+
106
+ Now we give a brief road map of the proof of Theorem 1. Our first goal is to establish a sufficient condition so that $\pi _ { t }$ learned at step $t$ is $\epsilon$ -optimal for state $s _ { t }$ . As an intermediate step we show that a sufficient condition for $V ^ { * } ( s _ { t } ) - V ^ { \pi _ { t } } ( s _ { t } ) \leq \epsilon$ is that $V ^ { \ast } ( s _ { t ^ { \prime } } ) - Q ^ { \ast } ( s _ { t ^ { \prime } } , a _ { t ^ { \prime } } )$ is small for a few time steps $t ^ { \prime }$ within an interval $[ t , t + R ]$ for a carefully chosen $R$ (Condition 1). Then we show the desired sufficient condition (Condition 2) implies Condition 1. We then bound the total number of bad time steps on which $V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } )$ is large for the whole MDP; this implies a bound on the number of violations of Condition 2. This in turn relies on a key technical lemma (Lemma 2).
107
+
108
+ The remaining part of this section is organized as follows. We establish the sufficient condition for $\epsilon$ -optimality in Section 3.3. The key lemma is presented in Section 3.4. Finally we prove Theorem 1 in Section 3.5.
109
+
110
+ # 3.3 SUFFICIENT CONDITION FOR $\epsilon$ -OPTIMALITY
111
+
112
+ In this section, we establish a sufficient condition (Condition 2) for $\epsilon$ -optimality at time step $t$ .
113
+
114
+ For a fixed $s _ { t }$ , let TRAJ $( R )$ be the set of length- $R$ trajectories starting from $s _ { t }$ . Our goal is to give a sufficient condition so that $\pi _ { t }$ , the policy learned at step $t$ , is $\epsilon$ -optimal. For any $\epsilon _ { 2 } > 0$ , define $\begin{array} { r } { R : = \lceil \ln \frac { 1 } { \epsilon _ { 2 } ( 1 - \gamma ) } / ( 1 - \gamma ) \rceil } \end{array}$ . Denote $V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } )$ by $\Delta _ { t }$ . We have
115
+
116
+ $$
117
+ \begin{array} { r l } & { \quad V ^ { * } ( s _ { t } ) - V ^ { \pi } ( s _ { t } ) } \\ & { = V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) + Q ^ { * } ( s _ { t } , a _ { t } ) - V ^ { \pi } ( s _ { t } ) } \\ & { = V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) + \gamma \mathbb { P } ( V ^ { * } - V ^ { \pi } ) ( s _ { t } , \pi _ { t } ( s _ { t } ) ) } \\ & { = V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) + \gamma \sum _ { s + 1 } ^ { \infty } p ( s _ { t + 1 } | s _ { t } , \pi _ { t } ( s _ { t } ) ) \cdot [ V ^ { * } ( s _ { t + 1 } ) - Q ^ { * } ( s _ { t + 1 } , a _ { t + 1 } ) ] + } \\ & { \quad \Big . \Big . \Big . \Big . \Big . \Big . } \\ & { \quad \quad \Big . \gamma _ { s + 1 , s ^ { * } + 2 } \mathrm { ~ } p ( s _ { t + 2 } | s _ { t + 1 } , \pi _ { t + 1 } ( s _ { t + 1 } ) ) \cdot p ( s _ { t + 1 } | s _ { t } , \pi _ { t } ( s _ { t } ) ) \big [ V ^ { * } ( s _ { t + 2 } ) - Q ^ { * } ( s _ { t + 2 } , a _ { t + 2 } ) \Big ] } \\ & { \quad \quad \cdot \dots } \\ & { \le \epsilon _ { 2 } + \displaystyle \sum _ { s ^ { \prime } = s ^ { \prime } } p ( t r a _ { t } ) \cdot [ \frac { n - 1 } { \lambda _ { 2 } } \gamma ^ { 2 } \Delta _ { t + 2 } ] , } \\ & { \quad \quad \pi _ { s \lambda ^ { ( 2 ) } ( L ) } ^ { R , a } } \end{array}
118
+ $$
119
+
120
+ where the last inequality holds because $\frac { \gamma ^ { R } } { 1 - \gamma } \leq \epsilon _ { 2 }$ , which follows from the definition of $R$
121
+
122
+ For any fixed trajectory of length $R$ starting from $s _ { t }$ , consider the sequence $\left( \Delta _ { t ^ { \prime } } \right) _ { t \leq t ^ { \prime } < t + R }$ . Let $X _ { t } ^ { ( i ) }$ be the $i$ -th largest item of $\left( \Delta _ { t ^ { \prime } } \right) _ { t \leq t ^ { \prime } < t + R }$ . Rearranging Eq. (1), we obtain
123
+
124
+ $$
125
+ V ^ { \ast } ( s _ { t } ) - V ^ { \pi _ { t } } ( s _ { t } ) \leq \epsilon _ { 2 } + E _ { t r a j } \left[ \sum _ { i = 1 } ^ { R } \gamma ^ { i - 1 } X _ { t } ^ { ( i ) } \right] .
126
+ $$
127
+
128
+ We first prove that Condition 1 implies $\epsilon$ -optimality at time step $t$ when $\epsilon _ { 2 } = \epsilon / 3$
129
+
130
+ Condition 1. Let $\begin{array} { r } { \xi _ { i } : = \frac { 1 } { 2 ^ { i + 2 } } \epsilon _ { 2 } \left( \ln \frac { 1 } { 1 - \gamma } \right) ^ { - 1 } } \end{array}$ . For all $0 \leq i \leq \lfloor \log _ { 2 } R \rfloor$
131
+
132
+ $$
133
+ E [ X _ { t } ^ { ( 2 ^ { i } ) } ] \leq \xi _ { i } .
134
+ $$
135
+
136
+ Claim 1. If Condition $^ { l }$ is satisfied at time step $t$ , the policy $\pi _ { t }$ is $\epsilon$ -optimal at state $s _ { t }$ , i.e. $V ^ { \ast } ( s _ { t } ) -$
137
+ $V ^ { \pi _ { t } } ( s _ { t } ) \leq \epsilon$ .
138
+
139
+ Proof. Note that $E [ X _ { t } ^ { ( 2 ^ { \lfloor \log _ { 2 } i \rfloor } ) } ]$ t. Eq. (3) implies that for $X _ { t } ^ { ( i ) }$ is monotonically decreasing with respect to $1 / 2 < \gamma < 1$ , $i$ . Therefore, $E [ X _ { t } ^ { ( i ) } ] \ \leq$
140
+
141
+ $$
142
+ \begin{array} { r l } & { E \left[ \displaystyle \sum _ { i = 1 } ^ { R } \gamma ^ { i - 1 } X _ { t } ^ { ( i ) } \right] = \displaystyle \sum _ { i = 1 } ^ { R } \gamma ^ { i - 1 } E [ X _ { t } ^ { ( i ) } ] \leq \displaystyle \sum _ { i = 1 } ^ { R } \gamma ^ { i - 1 } E [ X _ { t } ^ { ( 2 ^ { \lfloor \log _ { 2 } i \rfloor } ) } ] } \\ & { \leq \displaystyle \sum _ { i = 1 } ^ { R } \gamma ^ { i - 1 } 2 ^ { - \lfloor \log _ { 2 } i \rfloor - 2 } \epsilon _ { 2 } \left( \ln \frac { 1 } { 1 - \gamma } \right) ^ { - 1 } \leq \displaystyle \sum _ { i = 1 } ^ { R } \frac { \gamma ^ { i - 1 } } { i } \epsilon _ { 2 } \left( \ln \frac { 1 } { 1 - \gamma } \right) ^ { - 1 } \leq 2 \epsilon _ { 2 } , } \end{array}
143
+ $$
144
+
145
+ where the last inequality follows from the fact that $\begin{array} { r } { \sum _ { i = 1 } ^ { \infty } \frac { \gamma ^ { i - 1 } } { i } = \frac { 1 } { \gamma } \ln \frac { 1 } { 1 - \gamma } } \end{array}$ and $\gamma > 1 / 2$
146
+
147
+ Combining with Eq. 2, we have, $\begin{array} { r } { V ^ { \ast } ( s _ { t } ) - V ^ { \pi _ { t } } ( s _ { t } ) \leq \epsilon _ { 2 } + E \left[ \sum _ { i = 1 } ^ { R } \gamma ^ { i - 1 } X _ { t } ^ { ( i ) } \right] \leq 3 \epsilon _ { 2 } = \epsilon . } \end{array}$
148
+
149
+ Next we show that given $i , t$ , Condition 2 implies Eq. (3).
150
+
151
+ Condition 2. Define $L = \lfloor \log _ { 2 } R \rfloor$ . Let $\begin{array} { r } { M = \operatorname* { m a x } \left\{ \lceil 2 \log _ { 2 } \frac { 1 } { \xi _ { L } ( 1 - \gamma ) } \rceil , 1 0 \right\} } \end{array}$ , and $\begin{array} { r } { \eta _ { j } = \frac { \xi _ { i } } { M } \cdot 2 ^ { j - 1 } } \end{array}$ .
152
+ For all $\begin{array} { r } { \because j \le M , \eta _ { j } \operatorname* { P r } [ X _ { t } ^ { ( 2 ^ { i } ) } > \eta _ { j - 1 } ] \le \frac { \xi _ { i } } { M } , } \end{array}$ .
153
+
154
+ Claim 2. Given i, t, Eq. (3) holds if Condition 2 is satisfied.
155
+
156
+ Proof. The reason behind the choice of $M$ is to ensure that $\eta _ { M } > 1 / ( 1 - \gamma )$ 1. It follows that, assuming Condition 2 holds, for $1 \leq j \leq M$ ,
157
+
158
+ $$
159
+ E \left[ { X _ { t } ^ { ( 2 ^ { i } ) } } \right] = \int _ { 0 } ^ { 1 / ( 1 - \gamma ) } \operatorname* { P r } \left[ { X _ { t } ^ { ( 2 ^ { i } ) } } > x \right] d x \le \eta _ { 1 } + \sum _ { j = 2 } ^ { M } \eta _ { j } \operatorname* { P r } [ { X _ { t } ^ { ( 2 ^ { i } ) } } > \eta _ { j - 1 } ] \le \xi _ { i } .
160
+ $$
161
+
162
+ Therefore, if a time step $t$ is not $\epsilon _ { 2 }$ -optimal, there exists $0 \leq i < \lfloor \log _ { 2 } R \rfloor$ and $2 \leq j \leq M$ such that
163
+
164
+ $$
165
+ \eta _ { j } \mathrm { P r } [ X _ { t } ^ { ( 2 ^ { i } ) } > \eta _ { j - 1 } ] > \frac { \xi _ { i } } { M } .
166
+ $$
167
+
168
+ Now, the sample complexity can be bounded by the number of $( t , i , j )$ pairs that Eq. (4) is violated. Following the approach of Strehl et al. (2006), for a fixed $( i , j )$ -pair, instead of directly counting the number of time steps $t$ such that $\begin{array} { r } { \operatorname* { P r } [ X _ { t } ^ { ( 2 ^ { i } ) } > \eta _ { j - 1 } ] > \frac { \xi _ { i } } { M \eta _ { j } } } \end{array}$ , we count the number of time steps that $X _ { t } ^ { ( 2 ^ { i } ) } > \eta _ { j - 1 }$ . Lemma 1 provides an upper bound of the number of such $t$ .
169
+
170
+ # 3.4 KEY LEMMAS
171
+
172
+ In this section, we present two key lemmas. Lemma 1 bounds the number of sub-optimal actions, which in turn, bounds the sample complexity of our algorithm. Lemma 2 bounds the weighted sum of learning error, i.e. $( \hat { Q } _ { t } - Q ^ { * } ) ( s , a )$ , with the sum and maximum of weights. Then, we show that Lemma 1 follows from Lemma 2.
173
+
174
+ Lemma 1. For fixed $t$ and $\eta > 0$ , let ${ B } _ { \eta } ^ { ( t ) }$ be the event that $\begin{array} { r } { V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) > \frac { \eta } { 1 - \gamma } } \end{array}$ in step t. If $\eta > 2 \epsilon _ { 1 }$ , then with probability at least $1 - \delta / 2$ ,
175
+
176
+ $$
177
+ \sum _ { t = 1 } ^ { t = \infty } I \left[ B _ { \eta } ^ { ( t ) } \right] \leq \frac { S A \ln S A \ln 1 / \delta } { \eta ^ { 2 } ( 1 - \gamma ) ^ { 3 } } \cdot p o l y l o g \left( \frac { 1 } { \epsilon _ { 1 } } , \frac { 1 } { 1 - \gamma } \right) ,
178
+ $$
179
+
180
+ where $I [ \cdot ]$ is the indicator function.
181
+
182
+ Before presenting Lemma 2, we define a class of sequence that occurs in the proof.
183
+
184
+ Definition 3. A sequence $( w _ { t } ) _ { t \geq 1 }$ is said to be a $( C , w )$ -sequence for $C , w > 0$ , $i f 0 \le w _ { t } \le w$ for all $t \geq 1$ , and $\begin{array} { r } { \sum _ { t \geq 1 } w _ { t } \leq C } \end{array}$ .
185
+
186
+ Lemma 2. For every $( C , w )$ -sequence $( w _ { t } ) _ { t \geq 1 }$ , with probability $1 - \delta / 2$ , the following holds:
187
+
188
+ $$
189
+ \sum _ { t \ge 1 } w _ { t } ( \hat { Q } _ { t } - Q ^ { * } ) ( s _ { t } , a _ { t } ) \le \frac { C \epsilon _ { 1 } } { 1 - \gamma } + \mathcal { O } \left( \frac { \sqrt { w S A C \ell ( C ) } } { ( 1 - \gamma ) ^ { 2 . 5 } } + \frac { w S A \ln C } { ( 1 - \gamma ) ^ { 3 } } \ln \frac { 1 } { ( 1 - \gamma ) \epsilon _ { 1 } } \right) .
190
+ $$
191
+
192
+ $\begin{array} { r } { \ell ( C ) = \iota ( C ) \ln { \frac { 1 } { ( 1 - \gamma ) \epsilon _ { 1 } } } } \end{array}$
193
+
194
+ Proof of Lemma 2 is quite technical, and is therefore deferred to supplementary materials.
195
+
196
+ Now, we briefly explain how to prove Lemma 1 with Lemma 2. (Full proof can be found in supplementary materials.) Note that since $\hat { Q } _ { t } \geq Q ^ { * }$ and $a _ { t } = \arg \operatorname* { m a x } _ { a } \hat { Q } _ { t } ( s _ { t } , a )$ ,
197
+
198
+ $$
199
+ V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) \leq \hat { Q } _ { t } ( s _ { t } , a _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) .
200
+ $$
201
+
202
+ We now consider a set $J = \{ t : \ V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) > \eta ( 1 - \gamma ) ^ { - 1 } \}$ , and consider the $( | J | , 1 )$ - weight sequence defined by $w _ { t } ~ = ~ I \left[ t \in J \right]$ . We can now apply Lemma 2 to weighted sum $\begin{array} { r } { \sum _ { t \geq 1 } \dot { w } _ { t } \left[ \bar { V } ^ { \ast } ( s _ { t } ) - Q ^ { \ast } ( s _ { t } , \dot { a } _ { t } ) \right] , } \end{array}$ . On the one hand, this quantity is obviously at least $| J | \bar { \eta ( 1 - \gamma ) } ^ { - 1 }$ . On the other hand, by lemma 2, it is upper bounded by the weighted sum of $( \hat { Q } - Q ^ { * } ) ( s _ { t } , a _ { t } )$ . Thus we get
203
+
204
+ $$
205
+ | J | \eta ( 1 - \gamma ) ^ { - 1 } \leq \frac { C \epsilon _ { 1 } } { 1 - \gamma } + \mathcal { O } \left( \frac { \sqrt { S A | J | \ell ( | J | ) } } { ( 1 - \gamma ) ^ { 2 . 5 } } + \frac { w S A \ln | J | } { ( 1 - \gamma ) ^ { 3 } } \ln \frac { 1 } { ( 1 - \gamma ) \epsilon _ { 1 } } \right) .
206
+ $$
207
+
208
+ Now focus on the dependence on $| J |$ . The left-hand-side has linear dependence on $| J |$ , whereas the left-hand-side has a $\tilde { \mathcal { O } } \left( \sqrt { | J | } \right)$ dependence. This allows us to solve out an upper bound on $| J |$ with quadratic dependence on $1 / \eta$ .
209
+
210
+ # 3.5 PROOF FOR THEOREM 1
211
+
212
+ We prove the theorem by stitching Lemma 1 and Condition 2.
213
+
214
+ Proof. (Proof for Theorem 1)
215
+
216
+ By lemma 1, for any $2 \leq j \leq M , \sum _ { t = 1 } ^ { \infty } I \left[ V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) > \eta _ { j - 1 } \right] \leq C$ , where $C = \frac { S A \ln S A \ln 1 / \delta } { \eta _ { j - 1 } ^ { 2 } ( 1 - \gamma ) ^ { 5 } } \cdot \tilde { P } .$
217
+
218
+ Here $\tilde { P }$ is a shorthand for polylog $\begin{array} { r } { \left( \frac { 1 } { \epsilon _ { 1 } } , \frac { 1 } { 1 - \gamma } \right) } \end{array}$
219
+
220
+ Let $A _ { t } = I [ X _ { t } ^ { ( 2 ^ { i } ) } \geq \eta _ { j - 1 } ]$ be a Bernoulli random variable, and $\{ \mathcal { F } _ { t } \} _ { t \ge 1 }$ be the filtration generated by random variables $\bar { \{ ( s _ { \tau } , a _ { \tau } ) : 1 \leq \tau \leq t \} }$ . Since $A _ { t }$ is $\mathcal { F } _ { t + R }$ −measurable, for any $0 \leq k < R$ , $\{ \dot { A } _ { k + t R } - E [ A _ { k + t R } \ | \ \mathcal { F } _ { k + t R } ] \} _ { t \geq 0 }$ is a martingale difference sequence. For now, consider a fixed $0 \leq k < R$ . By Azuma-Hoeffiding inequality, after $\begin{array} { r } { T = \mathcal { O } \left( \frac { C } { 2 ^ { i } } \cdot \frac { M \eta _ { j } } { \xi _ { i } } \ln ( R M L ) \right) } \end{array}$ · M ηjξ ln(RM L) time steps (if it happens that many times) with
221
+
222
+ $$
223
+ \operatorname* { P r } \left[ X _ { k + t R } ^ { ( 2 ^ { i } ) } \geq \eta _ { j - 1 } \right] = \mathbb { E } [ A _ { k + t R } ] > \frac { \xi _ { i } } { M \eta _ { j } } ,
224
+ $$
225
+
226
+ we have $\textstyle \sum _ { t } A _ { k + t R } \geq C / 2 ^ { i }$ with probability at least $1 - \delta / ( 2 M R L )$ .
227
+
228
+ On the other hand, if $A _ { k + t R }$ happens, within $[ k + t R , k + t R + R - 1 ]$ , there must be at least $2 ^ { i }$ time steps at which $V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) > ^ { \mathsf { ^ { * } } } \eta _ { j - 1 }$ . The latter event happens at most $C$ times, and the $[ k + t R , k + t R + R - 1 ]$ are disjoint. Tppens at most erefore, times f $\textstyle \sum _ { t = 0 } ^ { \infty } A _ { k + t R } \leq C / 2 ^ { i }$ . This suggests that a union bound on $T$ $i$ $j$ $0 \leq k < R$ , we can show that with probability $1 - \delta / ( 2 M L )$ , there are at most $R T$ time steps where $\mathrm { P r } \left[ X _ { t } ^ { ( 2 ^ { i } ) } \geq \eta _ { j - 1 } \right] > \xi _ { i } / ( M \eta _ { j } )$ . Thus, the number of sub-optimal steps is bounded by,
229
+
230
+ $$
231
+ \begin{array} { r l r } { { \sum _ { t = 1 } ^ { \ell - 1 } I [ V ^ { * } ( s _ { t } ) - V ^ { \pi _ { t } } ( s _ { t } ) > \epsilon ] } } \\ & { \leq \sum _ { t = 1 } ^ { \infty } \sum _ { i = 0 } ^ { L } \sum _ { j = 2 } ^ { M } I [ \eta _ { j } \operatorname* { P r } [ X _ { t } ^ { ( 2 ^ { i } ) } > \eta _ { j - 1 } ] > \frac { \xi _ { i } } { M } ] = \sum _ { i = 0 } ^ { L } \sum _ { j = 2 } ^ { M } \sum _ { t = 1 } ^ { \infty } I [ \operatorname* { P r } [ X _ { t } ^ { ( 2 ^ { i } ) } > \eta _ { j - 1 } ] > \frac { \xi _ { i } } { \eta _ { j } M } ] } \\ & { \leq \sum _ { i = 0 } ^ { L } \sum _ { j = 2 } ^ { M } \frac { S A M R \ln 1 / \delta \ln S A } { \eta _ { j } \xi _ { i } \cdot 2 ^ { i } ( 1 - \gamma ) ^ { 5 } } \tilde { P } \leq \sum _ { i = 0 } ^ { L } \frac { S A \cdot 2 ^ { i + 4 } \ln S A \ln 1 / \delta } { \epsilon _ { 2 } ^ { 2 } ( 1 - \gamma ) ^ { 6 } } \tilde { P } \mathrm { ( B y ~ d e f i n i t i o n ~ o f } \xi _ { i } \mathrm { ~ a n d } \eta _ { j } ) } \\ & { \leq \frac { S A R \ln S A \ln 1 / \delta } { \epsilon _ { 2 } ^ { 2 } ( 1 - \gamma ) ^ { 6 } } \tilde { P } \leq \frac { S A \ln S A \ln 1 / \delta } { \epsilon _ { 2 } ^ { 2 } ( 1 - \gamma ) ^ { 7 } } \tilde { P } . } & { \mathrm { ( B y ~ d e f i n i t i o n ~ o f } \hbar ) } \end{array}
232
+ $$
233
+
234
+ It should be stressed that throughout the lines, $\tilde { P }$ is a shorthand for an asymptotic expression, instead of an exact value. Our final choice of 2 and 1 are 2 = 3 , and 1 = 24RM ln . It is not hard 1−γ to see that $\ln 1 / \epsilon _ { 1 } = \mathrm { p o l y } ( \ln \textstyle \frac { 1 } { \epsilon } , \ln \frac { 1 } { 1 - \gamma } )$ . This immediately implies that with probability $1 - \delta$ , the number of time steps such that $\left( V ^ { * } - \dot { V } ^ { \pi } \right) \left( s _ { t } \right) > \epsilon$ is
235
+
236
+ $$
237
+ \tilde { \mathcal { O } } \left( \frac { S A \ln 1 / \delta } { \epsilon ^ { 2 } ( 1 - \gamma ) ^ { 7 } } \right) ,
238
+ $$
239
+
240
+ where hidden factors are $\begin{array} { r } { \operatorname { p o l y } ( \ln { \frac { 1 } { \epsilon } } , \ln { \frac { 1 } { 1 - \gamma } } , \ln S A ) } \end{array}$ .
241
+
242
+ # 4 DISCUSSION
243
+
244
+ In this section, we discuss the implication of our results, and present some interesting properties of our algorithm beyond its sample complexity bound.
245
+
246
+ # 4.1 COMPARISON WITH PREVIOUS RESULTS
247
+
248
+ Lower bound To the best of our knowledge, the current best lower bound for worst-case sample complexity is  SA2(1−γ)3 ln 1/δ due to Lattimore & Hutter (2012). The gap between our results and this lower bound lies only in the dependence on $1 / ( 1 - \gamma )$ and logarithmic terms of $\mathrm { { } } ^ { \mathrm { { 3 } } A , 1 / ( 1 - \gamma ) }$ and $1 / \epsilon$ .
249
+
250
+ Model-free algorithms Previously, the best sample complexity bound for a model-free algorithm is $\begin{array} { r } { \tilde { \mathcal O } \left( \frac { S A } { \epsilon ^ { 4 } ( 1 - \gamma ) ^ { 8 } } \right) } \end{array}$ (suppressing all logarithmic terms), achieved by Delayed Q-learning Strehl et al. (2006). Our results improve this upper bound by a factor of $\frac { 1 } { \epsilon ^ { 2 } ( 1 - \gamma ) }$ , and closes the quadratic gap in $1 / \epsilon$ between Delayed Q-learning’s result and the lower bound. In fact, the following theorem shows that UCB Q-learning can indeed outperform Delayed Q-learning.
251
+
252
+ Theorem 2. There exists a family of MDPs with constant $S$ and $A$ , in which with probability $1 - \delta$ , Delayed $Q$ -learning incurs sample complexity of exploration of $\Omega \left( \frac { \epsilon ^ { - 3 } } { \ln ( 1 / \delta ) } \right)$ , assuming that $\ln ( 1 / \delta ) < \epsilon ^ { - 2 }$ .
253
+
254
+ The construction of this hard MDP family is given in the supplementary material.
255
+
256
+ Model-based algorithms For model-based algorithms, better sample complexity results in infinite horizon settings have been claimed Szita & Szepesvári (2010). To the best of our knowledge, the best published result without further restrictions on MDPs is $\begin{array} { r } { \tilde { \mathcal O } \left( \frac { S A } { \epsilon ^ { 2 } ( 1 - \gamma ) ^ { 6 } } \right) } \end{array}$ claimed by Szita & Szepesvári (2010), which is $( 1 - \gamma )$ smaller than our upper bound. From the space complexity point of view, our algorithm is much more memory-efficient. Our algorithm stores $O ( S A )$ values, whereas the algorithm in Szita & Szepesvári (2010) needs $\Omega ( S ^ { 2 } A )$ memory to store the transition model.
257
+
258
+ # 4.2 EXTENSION TO OTHER SETTINGS
259
+
260
+ Due to length limits, detailed discussion in this section is deferred to supplementary materials.
261
+
262
+ Finite horizon MDP The sample complexity of exploration bounds of UCB Q-learning implies $\tilde { \mathcal { O } } \left( \epsilon ^ { - 2 } \right)$ PAC sample complexity and a $\bar { \mathcal { O } } \left( T ^ { 1 / 2 } \right)$ regret bound in finite horizon MDPs. That is, our algorithm implies a PAC algorithm for finite horizon MDPs. We are not aware of reductions of the opposite direction (from finite horizon sample complexity to infinite horizon sample complexity of exploration).
263
+
264
+ Regret The reason why our results can imply an $\tilde { \mathcal { O } } ( { \sqrt { T } } )$ regret is that, after choosing $\epsilon _ { 1 }$ , it follows from the argument of Theorem 1 that with probability $1 - \delta$ , for all $\epsilon _ { 2 } > \tilde { \mathcal { O } } ( \epsilon _ { 1 } / ( 1 - \gamma ) )$ , the number of $\epsilon _ { 2 }$ -suboptimal steps is bounded by
265
+
266
+ $$
267
+ \mathcal { O } \left( \frac { S A \ln S A \ln 1 / \delta } { \epsilon _ { 2 } ^ { 2 } ( 1 - \gamma ) ^ { 7 } } \mathrm { p o l y l o g } \left( \frac { 1 } { \epsilon _ { 1 } } , \frac { 1 } { 1 - \gamma } \right) \right) .
268
+ $$
269
+
270
+ In contrast, Delayed Q-learning Strehl et al. (2006) can only give an upper bound on $\epsilon _ { 1 }$ -suboptimal steps after setting parameter $\epsilon _ { 1 }$ .
271
+
272
+ # 5 CONCLUSION
273
+
274
+ Infinite-horizon MDP with discounted reward is a setting that is arguably more difficult than other popular settings, such as finite-horizon MDP. Previously, the best samby model-free reinforcement learning algorithms in this setting is $\tilde { \cal O } \big ( { \textstyle \frac { S A } { \epsilon ^ { 4 } ( 1 - \gamma _ { _ { - } } ) ^ { 8 } } } \big )$ y bound achieved, due to Delayed Q-learning Strehl et al. (2006). In this paper, we propose a variant of Q-learning that incorporates upper confidence bound, and show that it has a sample complexity of $\begin{array} { r } { \tilde { \mathcal { O } } \big ( \frac { S A } { \epsilon ^ { 2 } ( 1 - \gamma ) ^ { 7 } } \big ) } \end{array}$ . This matches the best lower bound except in dependence on $1 / ( 1 - \gamma )$ and logarithmic factors.
275
+
276
+ # 6 ACKNOWLEDGEMENTS
277
+
278
+ The authors thank Chi Jin and Chongjie Zhang for helpful discussions. This work is supported by National Basic Research Program of China (973 Program) (grant no. 2015CB352502), NSFC (61573026), BJNSF (L172037) and Beijing Acedemy of Artificial Intelligence.
279
+
280
+ # REFERENCES
281
+
282
+ Mohammad Gheshlaghi Azar, Remi Munos, Mohammad Ghavamzadeh, and Hilbert Kappen. Speedy q-learning. In Advances in neural information processing systems, 2011.
283
+
284
+ Mohammad Gheshlaghi Azar, Ian Osband, and Rémi Munos. Minimax regret bounds for reinforcement learning. arXiv preprint arXiv:1703.05449, 2017.
285
+
286
+ Ronen I. Brafman and Moshe Tennenholtz. R-max - a general polynomial time algorithm for near-optimal reinforcement learning. J. Mach. Learn. Res., 3:213–231, March 2003. ISSN 1532-4435. doi: 10.1162/153244303765208377. URL https://doi.org/10.1162/ 153244303765208377.
287
+
288
+ Christoph Dann, Tor Lattimore, and Emma Brunskill. Unifying pac and regret: Uniform pac bounds for episodic reinforcement learning. In Advances in Neural Information Processing Systems, pp. 5713–5723, 2017.
289
+
290
+ Eyal Even-Dar and Yishay Mansour. Learning rates for q-learning. Journal of Machine Learning Research, 5(Dec):1–25, 2003.
291
+
292
+ Thomas Jaksch, Ronald Ortner, and Peter Auer. Near-optimal regret bounds for reinforcement learning. Journal of Machine Learning Research, 11(Apr):1563–1600, 2010.
293
+
294
+ Chi Jin, Zeyuan Allen-Zhu, Sebastien Bubeck, and Michael I Jordan. Is q-learning provably efficient? In Advances in Neural Information Processing Systems, pp. 4864–4874, 2018.
295
+
296
+ Sham Machandranath Kakade et al. On the sample complexity of reinforcement learning. PhD thesis, University of London London, England, 2003.
297
+
298
+ Tor Lattimore and Marcus Hutter. Pac bounds for discounted mdps. In International Conference on Algorithmic Learning Theory, pp. 320–334. Springer, 2012.
299
+
300
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin Riedmiller. Playing atari with deep reinforcement learning. arXiv preprint arXiv:1312.5602, 2013.
301
+
302
+ 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.
303
+
304
+ John Schulman, Sergey Levine, Pieter Abbeel, Michael Jordan, and Philipp Moritz. Trust region policy optimization. In International Conference on Machine Learning, pp. 1889–1897, 2015.
305
+
306
+ Aaron Sidford, Mengdi Wang, Xian Wu, Lin Yang, and Yinyu Ye. Near-optimal time and sample complexities for solving markov decision processes with a generative model. In Advances in Neural Information Processing Systems, pp. 5186–5196, 2018a.
307
+
308
+ Aaron Sidford, Mengdi Wang, Xian Wu, and Yinyu Ye. Variance reduced value iteration and faster algorithms for solving markov decision processes. In Proceedings of the Twenty-Ninth Annual ACM-SIAM Symposium on Discrete Algorithms, pp. 770–787. Society for Industrial and Applied Mathematics, 2018b.
309
+
310
+ Alexander L Strehl and Michael L Littman. An analysis of model-based interval estimation for markov decision processes. Journal of Computer and System Sciences, 74(8):1309–1331, 2008.
311
+
312
+ Alexander L Strehl, Lihong Li, Eric Wiewiora, John Langford, and Michael L Littman. Pac modelfree reinforcement learning. In Proceedings of the 23rd international conference on Machine learning, pp. 881–888. ACM, 2006.
313
+
314
+ István Szita and Csaba Szepesvári. Model-based reinforcement learning with nearly tight exploration complexity bounds. In Proceedings of the 27th International Conference on Machine Learning (ICML-10), pp. 1031–1038, 2010.
315
+
316
+ # A PROOF OF LEMMA 1
317
+
318
+ Lemma 1. For fixed t and $\eta > 0$ , let $B _ { \eta } ^ { ( t ) }$ be the event that $\begin{array} { r } { V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) > \frac { \eta } { 1 - \gamma } } \end{array}$ in step t. If $\eta > 2 \epsilon _ { 1 }$ , then with probability at least $1 - \delta / 2$ ,
319
+
320
+ $$
321
+ \sum _ { t = 1 } ^ { t = \infty } I \left[ B _ { \eta } ^ { ( t ) } \right] \leq \frac { S A \ln S A \ln 1 / \delta } { \eta ^ { 2 } ( 1 - \gamma ) ^ { 3 } } \cdot p o l y l o g \left( \frac { 1 } { \epsilon _ { 1 } } , \frac { 1 } { 1 - \gamma } \right) ,
322
+ $$
323
+
324
+ where $I [ \cdot ]$ is the indicator function.
325
+
326
+ Proof. When $\eta > 1$ the lemma holds trivially. Now consider the case that $\eta \leq 1$ .
327
+
328
+ Let $\begin{array} { r } { I = \{ t \colon V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) > \frac { \eta } { 1 - \gamma } \} } \end{array}$ . By lemma 2, with probability $1 - \delta$
329
+
330
+ $$
331
+ \begin{array} { r l } & { \frac { \eta | I | } { 1 - \gamma } \leq \displaystyle \sum _ { t \in I } \left( V ^ { * } ( s _ { t } ) - Q ^ { * } ( s _ { t } , a _ { t } ) \right) \leq \displaystyle \sum _ { t \in I } \left[ \left( \hat { Q } _ { t } - Q ^ { * } \right) ( s _ { t } , a _ { t } ) \right] } \\ & { \qquad \leq \displaystyle \frac { | I | \epsilon _ { 1 } } { 1 - \gamma } + \mathcal { O } \left( \frac { 1 } { ( 1 - \gamma ) ^ { 5 / 2 } } \sqrt { S A | I | \ell | ( I | ) } + \frac { S A } { ( 1 - \gamma ) ^ { 3 } } \ln | I | \ln \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \right) } \\ & { \qquad \leq \displaystyle \frac { | I | \epsilon _ { 1 } } { 1 - \gamma } + \mathcal { O } \left( \ln \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \cdot \left( \frac { \sqrt { S A | I | \ln \frac { S A | I | } { \delta } } } { ( 1 - \gamma ) ^ { 5 / 2 } } + \frac { S A \ln | I | } { ( 1 - \gamma ) ^ { 3 } } \right) \right) } \\ & { \qquad \leq \displaystyle \frac { | I | \epsilon _ { 1 } } { 1 - \gamma } + \mathcal { O } \left( \sqrt { \ln \frac { 1 } { \delta } } \ln \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \cdot \left( \frac { \sqrt { S A | I | \ln S A | I | } } { ( 1 - \gamma ) ^ { 5 / 2 } } + \frac { S A \ln | I | } { ( 1 - \gamma ) ^ { 3 } } \right) \right) } \end{array}
332
+ $$
333
+
334
+ Suppose that $\begin{array} { r } { | I | = \frac { S A k ^ { 2 } } { \eta ^ { 2 } ( 1 - \gamma ) ^ { 3 } } \ln S A } \end{array}$ , for some $k > 1$ . Then it follows that for some constant $C _ { 1 }$ ,
335
+
336
+ $$
337
+ \begin{array} { r l } & { \frac { \eta | I | } { 1 - \gamma } = \cfrac { k ^ { 2 } S A \ln S A } { ( 1 - \gamma ) ^ { 4 } \eta } \leq 2 \cfrac { ( \eta - \epsilon _ { 1 } ) | I | } { 1 - \gamma } } \\ & { \qquad \leq C _ { 1 } \sqrt { \ln \frac { 1 } { \delta } } \ln \cfrac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \left( \cfrac { \sqrt { S A | I | \ln \left( S A | I | \right) } } { ( 1 - \gamma ) ^ { 5 / 2 } } + \cfrac { S A \ln | I | } { ( 1 - \gamma ) ^ { 3 } } \right) } \\ & { \qquad \leq C _ { 1 } \sqrt { \ln \frac { 1 } { \delta } } \ln \cfrac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \left( \cfrac { S A k } { \eta ( 1 - \gamma ) ^ { 4 } } \sqrt { \ln S A \cdot ( \ln S A + \ln | I | ) } + \cfrac { S A \ln | I | } { ( 1 - \gamma ) ^ { 3 } } \right) . } \end{array}
338
+ $$
339
+
340
+ Therefore
341
+
342
+ $$
343
+ \begin{array} { r l } & { k ^ { 2 } \ln ( S A ) \le C _ { 1 } \sqrt { \ln \displaystyle \frac { 1 } { \delta } } \ln \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \left( k \left( \ln S A + \ln | I | \right) + \eta ( 1 - \gamma ) \ln | I | \right) } \\ & { \qquad \le k C _ { 1 } \sqrt { \ln \displaystyle \frac { 1 } { \delta } } \ln \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \cdot \left( \ln S A + 2 \ln | I | \right) } \\ & { \qquad \le k C _ { 1 } \sqrt { \ln \displaystyle \frac { 1 } { \delta } } \ln \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \cdot \left( 3 \ln S A + 4 \ln k + 6 \ln \frac { 1 } { \eta ( 1 - \gamma ) } \right) } \\ & { \qquad \le 6 k C _ { 1 } \sqrt { \ln \displaystyle \frac { 1 } { \delta } } \ln ^ { 2 } \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \left( \ln S A + \ln \epsilon k \right) . } \end{array}
344
+ $$
345
+
346
+ Let $\begin{array} { r } { C ^ { \prime } = \operatorname* { m a x } \lbrace 2 , 6 C _ { 1 } \sqrt { \ln \frac { 1 } { \delta } } \ln ^ { 2 } \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } \rbrace } \end{array}$ . Then
347
+
348
+ $$
349
+ k \leq C ^ { \prime } ( 2 + \ln k ) .
350
+ $$
351
+
352
+ If $k \geq 1 0 C ^ { \prime } \ln C ^ { \prime }$ , then
353
+
354
+ $$
355
+ \begin{array} { c } { k - C ^ { \prime } \left( 2 + \ln k \right) \geq 8 C ^ { \prime } \ln C ^ { \prime } - ( 2 + \ln 1 0 ) C ^ { \prime } } \\ { \geq 4 C ^ { \prime } \left( 2 \ln C ^ { \prime } - 4 \right) \geq 0 , } \end{array}
356
+ $$
357
+
358
+ which means violation of (9). Therefore, since $C ^ { \prime } \geq 2$
359
+
360
+ $$
361
+ k \leq 1 0 C ^ { \prime } \ln C ^ { \prime } \leq 3 6 0 C _ { 1 } ^ { 2 } \operatorname* { m a x } \{ \ln ^ { 4 } { \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } } , 2 0 \ln 2 \} .
362
+ $$
363
+
364
+ It immediately follows that
365
+
366
+ $$
367
+ \begin{array} { r l r } { { \vert I \vert = \frac { S A k ^ { 2 } } { \eta ^ { 2 } ( 1 - \gamma ) ^ { 3 } } \ln S A } } \\ & { \leq \frac { S A \ln S A } { \eta ^ { 2 } ( 1 - \gamma ) ^ { 5 } } \cdot \ln \frac { 1 } { \delta } \cdot \mathcal { O } ( \ln ^ { 8 } \frac { 1 } { \epsilon _ { 1 } ( 1 - \gamma ) } ) . } \end{array}
368
+ $$
369
+
370
+ # B PROOF OF LEMMA 2
371
+
372
+ Lemma 2. For every $( C , w )$ -sequence $( w _ { t } ) _ { t \geq 1 }$ , with probability $1 - \delta / 2$ , the following holds:
373
+
374
+ $$
375
+ \sum _ { t \ge 1 } w _ { t } ( \hat { Q } _ { t } - Q ^ { * } ) ( s _ { t } , a _ { t } ) \le \frac { C \epsilon _ { 1 } } { 1 - \gamma } + \mathcal { O } \left( \frac { \sqrt { w S A C \ell ( C ) } } { ( 1 - \gamma ) ^ { 2 . 5 } } + \frac { w S A \ln C } { ( 1 - \gamma ) ^ { 3 } } \ln \frac { 1 } { ( 1 - \gamma ) \epsilon _ { 1 } } \right) .
376
+ $$
377
+
378
+ where $\begin{array} { r } { \ell ( C ) = \iota ( C ) \ln { \frac { 1 } { ( 1 - \gamma ) \epsilon _ { 1 } } } } \end{array}$ is a log-factor.
379
+
380
+ Fact 1. (1) The following statement holds throughout the algorithm,
381
+
382
+ $$
383
+ \hat { Q } _ { p + 1 } ( s , a ) \leq Q _ { p + 1 } ( s , a ) .
384
+ $$
385
+
386
+ (2) For any $p$ , there exists $p ^ { \prime } \leq p$ such that
387
+
388
+ $$
389
+ { \hat { Q } } _ { p + 1 } ( s , a ) \geq Q _ { p ^ { \prime } + 1 } ( s , a ) .
390
+ $$
391
+
392
+ Proof. Both properties are results of the update rule at line 11 of Algorithm 1.
393
+
394
+ Before proving lemma 2, we will prove two auxiliary lemmas.
395
+
396
+ Lemma 3. The following properties hold for $\alpha _ { t } ^ { i }$ :
397
+
398
+ 1. $\begin{array} { r } { \sqrt { \frac { 1 } { t } } \leq \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \sqrt { \frac { 1 } { i } } \leq 2 \sqrt { \frac { 1 } { t } } } \end{array}$ for every $t \geq 1 , c > 0$ .
399
+
400
+ 2. $\begin{array} { r } { \operatorname* { m a x } _ { i \in [ t ] } \alpha _ { t } ^ { i } \leq \frac { 2 H } { t } } \end{array}$ and $\begin{array} { r } { \sum _ { i = 1 } ^ { t } ( \alpha _ { t } ^ { i } ) ^ { 2 } \le \frac { 2 H } { t } } \end{array}$ for every $t \geq 1$
401
+
402
+ 3. $\textstyle \sum _ { t = i } ^ { \infty } \alpha _ { t } ^ { i } = 1 + 1 / H$ , for every $i \geq 1$
403
+
404
+ Proof. Recall that
405
+
406
+ $$
407
+ \alpha _ { t } = \frac { H + 1 } { H + t } , \quad \alpha _ { t } ^ { 0 } = \prod _ { j = 1 } ^ { t } ( 1 - \alpha _ { j } ) , \quad \alpha _ { t } ^ { i } = \alpha _ { i } \prod _ { j = i + 1 } ^ { t } ( 1 - \alpha _ { j } ) .
408
+ $$
409
+
410
+ Properties 1-3 are proven by Jin et al. (2018). Now we prove the last property.
411
+
412
+ On the one hand,
413
+
414
+ $$
415
+ \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \sqrt { \frac { \iota ( i ) } { i } } \leq \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \sqrt { \frac { \iota ( t ) } { i } } \leq 2 \sqrt { \frac { \iota ( t ) } { t } } ,
416
+ $$
417
+
418
+ where the last inequality follows from property 1.
419
+
420
+ The left-hand side is proven by induction on $t$ . For the base case, when $t = 1 , \alpha _ { t } ^ { t } = 1$ . For $t \geq 2$ , we have $\alpha _ { t } ^ { i } = ( 1 - \alpha _ { t } ) \dot { \alpha _ { t - 1 } ^ { i } }$ for $1 \leq i \leq t - 1$ . It follows that
421
+
422
+ $$
423
+ \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \sqrt { \frac { \iota ( i ) } { i } } = \alpha _ { t } \sqrt { \frac { \iota ( t ) } { t } } + ( 1 - \alpha _ { t } ) \sum _ { i = 1 } ^ { t - 1 } \alpha _ { t - 1 } ^ { i } \sqrt { \frac { \iota ( i ) } { i } } \geq \alpha _ { t } \sqrt { \frac { \iota ( t ) } { t } } + ( 1 - \alpha _ { t } ) \sqrt { \frac { \iota ( t - 1 ) } { t - 1 } } .
424
+ $$
425
+
426
+ Since function $f ( t ) = \iota ( t ) / t$ is monotonically decreasing for $t \geq 1 , c \geq 1$ , we have
427
+
428
+ $$
429
+ \alpha _ { t } \sqrt { \frac { \iota ( t ) } { t } } + ( 1 - \alpha _ { t } ) \sqrt { \frac { \iota ( t - 1 ) } { t - 1 } } \geq \alpha _ { t } \sqrt { \frac { \iota ( t ) } { t } } + ( 1 - \alpha _ { t } ) \sqrt { \frac { \iota ( t ) } { t } } \geq \sqrt { \frac { \iota ( t ) } { t } } .
430
+ $$
431
+
432
+ Lemma 4. With probability at least $1 - \delta / 2$ , for all $p \geq 0$ and $( s , a )$ -pair,
433
+
434
+ $$
435
+ \begin{array} { r l } & { 0 \le ( Q _ { p } - Q ^ { * } ) ( s , a ) \le \displaystyle \frac { \alpha _ { t } ^ { 0 } } { 1 - \gamma } + \displaystyle \sum _ { i = 1 } ^ { t } \gamma \alpha _ { t } ^ { i } ( { \hat { V } } _ { t _ { i } } - V ^ { * } ) ( s _ { t _ { i } + 1 } ) + \beta _ { t } , } \\ & { 0 \le ( { \hat { Q } } _ { p } - Q ^ { * } ) ( s , a ) , } \end{array}
436
+ $$
437
+
438
+ where $t = N _ { p } ( s , a ) , t _ { i } = \tau ( s , a , i )$ and $\beta _ { t } = c _ { 3 } \sqrt { H \iota ( t ) / ( ( 1 - \gamma ) ^ { 2 } t ) }$ .
439
+
440
+ Proof. Recall that
441
+
442
+ $$
443
+ \alpha _ { t } ^ { 0 } = \prod _ { j = 1 } ^ { t } ( 1 - \alpha _ { j } ) , \quad \alpha _ { t } ^ { i } = \alpha _ { i } \prod _ { j = i + 1 } ^ { t } ( 1 - \alpha _ { j } ) .
444
+ $$
445
+
446
+ From the update rule, it can be seen that our algorithm maintains the following $Q ( s , a )$ :
447
+
448
+ $$
449
+ Q _ { p } ( s , a ) = \alpha _ { t } ^ { 0 } \frac { 1 } { 1 - \gamma } + \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \left[ r ( s , a ) + b _ { i } + \gamma \hat { V } _ { t _ { i } } ( s _ { t _ { i } + 1 } ) \right] .
450
+ $$
451
+
452
+ Bellman optimality equation gives:
453
+
454
+ $$
455
+ Q ^ { * } ( s , a ) = r ( s , a ) + \gamma \mathbb { P } V ^ { * } ( s , a ) = \alpha _ { t } ^ { 0 } Q ^ { * } ( s , a ) + \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \left[ r ( s , a ) + \gamma \mathbb { P } V ^ { * } ( s , a ) \right] .
456
+ $$
457
+
458
+ Subtracting the two equations gives
459
+
460
+ $$
461
+ Q _ { p } - Q ^ { * } ) ( s , a ) = \alpha _ { t } ^ { 0 } ( \frac { 1 } { 1 - \gamma } - Q ^ { * } ( s , a ) ) + \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \left[ b _ { i } + \gamma \left( V _ { t _ { i } } - V ^ { * } \right) \left( s _ { t _ { i } + 1 } \right) + \gamma \left( V ^ { * } \left( s _ { t _ { i } + 1 } \right) - \mathbb { P } V ^ { * } \right) \right] ,
462
+ $$
463
+
464
+ The identity above holds for arbitrary $p , s$ and $a$ . Now fix $s \in S$ , $a \in A$ and $p \in \mathbb N$ . Let $t = N _ { p } ( s , a )$ , $t _ { i } = \tau ( s , a , i )$ . The $t = 0$ case is trivial; we assume $t \geq 1$ below. Now consider an arbitrary fixed $k$ . Define
465
+
466
+ $$
467
+ \Delta _ { i } = \left( \alpha _ { k } ^ { i } \cdot I [ t _ { i } < \infty ] \cdot \left( \mathbb { P } V ^ { * } - \mathbb { \hat { P } } _ { t _ { i } } V ^ { * } \right) ( s , a ) \right)
468
+ $$
469
+
470
+ Let $F _ { i }$ be the $\sigma$ -Field generated by random variables $( s _ { 1 } , a _ { 1 } , . . . , s _ { t _ { i } } , a _ { t _ { i } } )$ . It can be seen that $\mathbb { E } \left[ \Delta _ { i } | F _ { i } \right] = 0$ , while $\Delta _ { i }$ is measurable in $F _ { i + 1 }$ . Also, since $\textstyle 0 \leq V ^ { \ast } ( s , { \bar { a } } ) \leq { \frac { 1 } { 1 - \gamma } }$ , $\begin{array} { r } { | \Delta _ { i } | \le \frac { 2 } { 1 - \gamma } } \end{array}$ . Therefore, $\Delta _ { i }$ is a martingale difference sequence; by the Azuma-Hoeffding inequality,
471
+
472
+ $$
473
+ \mathrm { P r } \left[ \left| \sum _ { i = 1 } ^ { k } \Delta _ { i } \right| > \eta \right] \leq 2 \exp \left\{ - \frac { \eta ^ { 2 } } { 8 \left( 1 - \gamma \right) ^ { - 2 } \sum _ { i = 1 } ^ { k } ( \alpha _ { k } ^ { i } ) ^ { 2 } } \right\} .
474
+ $$
475
+
476
+ By choosing $\eta$ , we can show that with probability $1 - \delta / \left[ S A ( k + 1 ) ( k + 2 ) \right]$ ,
477
+
478
+ $$
479
+ \left| \sum _ { i = 1 } ^ { k } \Delta _ { i } \right| \leq \frac { 2 \sqrt { 2 } } { 1 - \gamma } \cdot \sqrt { \sum _ { i = 1 } ^ { k } ( \alpha _ { k } ^ { i } ) ^ { 2 } \cdot \ln \frac { 2 ( k + 1 ) ( k + 2 ) S A } { \delta } } \leq \frac { c _ { 2 } } { 1 - \gamma } \sqrt { \frac { H \iota ( k ) } { k } } .
480
+ $$
481
+
482
+ Here $c _ { 2 } = 4 \sqrt { 2 }$ , $\begin{array} { r } { \iota ( k ) = \ln { \frac { ( k + 1 ) ( k + 2 ) S A } { \delta } } } \end{array}$ . By a union bound for all $k$ , this holds for arbitrary $k > 0$ arbitrary $s \in S , a \in A$ simultaneously with probability
483
+
484
+ $$
485
+ 1 - \sum _ { s ^ { \prime } \in S , a ^ { \prime } \in A } \sum _ { k = 1 } ^ { \infty } \frac { \delta } { 2 S A ( k + 1 ) ( k + 2 ) } = 1 - \frac { \delta } { 2 } .
486
+ $$
487
+
488
+ Therefore, we conclude that (16) holds for the random variable $t = N _ { p } ( s , a )$ and for all $p$ , with probability $1 - \delta / 2$ as well.
489
+
490
+ Proof of the right hand side of (13): We also know that $\begin{array} { r } { ( b _ { k } = \frac { c _ { 2 } } { 1 - \gamma } \sqrt { \frac { H \iota ( k ) } { k } } ) } \end{array}$
491
+
492
+ $$
493
+ \frac { c _ { 2 } } { 1 - \gamma } \sqrt { \frac { H \iota ( k ) } { k } } \leq \sum _ { i = 1 } ^ { k } \alpha _ { k } ^ { i } b _ { i } \leq \frac { 2 c _ { 2 } } { 1 - \gamma } \sqrt { \frac { H \iota ( k ) } { k } } .
494
+ $$
495
+
496
+ It is implied by (16) that
497
+
498
+ $$
499
+ \begin{array} { r l } & { ( Q _ { p } - Q ^ { * } ) ( s , a ) \leq \displaystyle \frac { \alpha _ { t } ^ { 0 } } { 1 - \gamma } + \gamma \left| \displaystyle \sum _ { i = 1 } ^ { t } \Delta _ { i } \right| + \displaystyle \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \left[ \gamma ( \hat { V } _ { t _ { i } } - V ^ { * } ) ( x _ { t _ { i } + 1 } ) + b _ { i } \right] } \\ & { \qquad \leq \displaystyle \frac { \alpha _ { t } ^ { 0 } } { 1 - \gamma } + \displaystyle \frac { 3 c _ { 2 } } { 1 - \gamma } \sqrt { \frac { H \iota ( t ) } { t } } + \displaystyle \sum _ { i = 1 } ^ { t } \gamma \alpha _ { t } ^ { i } ( \hat { V } ^ { t _ { i } } - V ^ { * } ) ( x _ { t _ { i } + 1 } ) } \end{array}
500
+ $$
501
+
502
+ $$
503
+ \leq \frac { \alpha _ { t } ^ { 0 } } { 1 - \gamma } + \sum _ { i = 1 } ^ { t } \gamma \alpha _ { t } ^ { i } ( { \hat { V } } ^ { t _ { i } } - V ^ { * } ) ( x _ { t _ { i } + 1 } ) + \beta _ { t } .
504
+ $$
505
+
506
+ Note that $\beta _ { t } = c _ { 3 } ( 1 - \gamma ) ^ { - 1 } \sqrt { H \iota ( t ) / t }$ ; $c _ { 3 } = 3 c _ { 2 } = 1 2 { \sqrt { 2 } } .$ .
507
+
508
+ Proof of the left hand side of (13): Now, we assume that event that (16) holds. We assert that $Q _ { p } \geq Q ^ { * }$ for all $( s , a )$ and $p \leq p ^ { \prime }$ . This assertion is obviously true when $p ^ { \prime } = 0$ . Then
509
+
510
+ $$
511
+ \begin{array} { c l } { ( Q _ { p } - Q ^ { * } ) ( s , a ) \geq - \gamma \displaystyle \left| \displaystyle \sum _ { i = 1 } ^ { t } \Delta _ { i } \right| + \displaystyle \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } \left[ \gamma ( \hat { V } _ { t _ { i } } - V ^ { * } ) ( x _ { t _ { i } + 1 } ) + b _ { i } \right] } \\ { \geq \displaystyle \sum _ { i = 1 } ^ { t } \alpha _ { t } ^ { i } b _ { i } - \gamma \displaystyle \left| \displaystyle \sum _ { i = 1 } ^ { t } \Delta _ { i } \right| \geq 0 . } \end{array}
512
+ $$
513
+
514
+ Therefore the assertion holds for $p ^ { \prime } + 1$ as well. By induction, it holds for all $p$ .
515
+
516
+ We now see that (13) holds for probability $1 - \delta / 2$ for all $p , s , a$ . Since $\hat { Q } _ { p } ( s , a )$ is always greater than $Q _ { p ^ { \prime } } ( s , a )$ for some $p ^ { \prime } \leq p$ , we know that $\hat { Q } _ { p } ( s , a ) \geq Q _ { p ^ { \prime } } ( s , a ) \geq Q ^ { * } ( s , a )$ , thus proving (14).
517
+
518
+ We now give a proof for lemma 2. Recall the definition for a $( C , w )$ -sequence. A sequence $( w _ { t } ) _ { t \geq 1 }$ is said to be a $( C , w )$ -sequence for $C , w > 0$ , if $0 \leq w _ { t } \leq w$ for all $t \geq 1$ , and $\textstyle \sum _ { t \geq 1 } w _ { t } \leq C$ .
519
+
520
+ Proof. Let $n _ { t } = N _ { t } ( s _ { t } , a _ { t } )$ for simplicity; we have
521
+
522
+ $$
523
+ \begin{array} { r l } { { \sum _ { t \geq 1 } w _ { t } ( \hat { Q } _ { t } - Q ^ { * } ) ( s _ { t } , a _ { t } ) } } \\ & { \leq \sum _ { t \geq 1 } w _ { t } ( Q _ { t } - Q ^ { * } ) ( s _ { t } , a _ { t } ) } \\ & { \leq \sum _ { t \geq 1 } w _ { t } [ \cfrac { \alpha _ { n _ { t } } ^ { 0 } } { 1 - \gamma } + \beta _ { n _ { t } } + \gamma \sum _ { i = 1 } ^ { n _ { t } } \alpha _ { n _ { t } } ^ { i } ( \hat { V } _ { \tau ( s _ { t } , a _ { t } , i ) } - V ^ { * } ) ( s _ { \tau ( s _ { t } , a _ { t } , i ) + 1 } ) ] } \end{array}
524
+ $$
525
+
526
+ The last inequality is due to lemma 4. Note that $\alpha _ { n _ { t } } ^ { 0 } = \mathbb { I } [ n _ { t } = 0 ]$ , the first term in the summation can be bounded by,
527
+
528
+ $$
529
+ \sum _ { t \geq 1 } w _ { t } \frac { \alpha _ { n _ { t } } ^ { 0 } } { 1 - \gamma } \leq \frac { S A w } { 1 - \gamma } .
530
+ $$
531
+
532
+ For the second term, define $u ( s , a ) = \operatorname* { s u p } _ { t } N _ { t } ( s , a )$ .2 It follows that,
533
+
534
+ $$
535
+ \begin{array} { l } { \displaystyle \sum _ { t \geq 1 } w _ { t } \beta _ { n _ { t } } = \sum _ { s , o } ^ { u ( s , o ) } w _ { \tau ( s , a , i ) } \beta _ { i } } \\ { \displaystyle \qquad \leq \sum _ { s , a } ( 1 - \gamma ) ^ { - 1 } c _ { 3 } \sum _ { i = 1 } ^ { C _ { s , a } / w } \sqrt { \frac { H \iota ( i ) } { i } } w } \\ { \displaystyle \qquad \leq 2 \sum _ { s , a } ( 1 - \gamma ) ^ { - 1 } c _ { 3 } \sqrt { \iota ( C ) H C _ { s , a } w } } \\ { \displaystyle \qquad \leq 2 c _ { 3 } ( 1 - \gamma ) ^ { - 1 } \sqrt { w S A H C \iota ( C ) } . } \end{array}
536
+ $$
537
+
538
+ Where $\begin{array} { r } { C _ { s , a } = \sum _ { t \geq 1 , ( s _ { t } , a _ { t } ) = ( s , a ) } w _ { t } } \end{array}$ . Inequality (19) follows from rearrangement inequality, since $\iota ( x ) / x$ is monotonically decreasing. Inequality (21) follows from Jensen’s inequality.
539
+
540
+ For the third term of the summation, we have
541
+
542
+ $$
543
+ \begin{array} { c } { { \displaystyle \sum _ { t \ge 1 } w _ { t } \sum _ { i = 1 } ^ { n _ { t } } \alpha _ { n _ { t } } ^ { i } \left( \hat { V } _ { \tau ( s _ { t } , a _ { t } , i ) } - V ^ { * } \right) \left( s _ { \tau ( s _ { t } , a _ { t } , i ) + 1 } \right) } } \\ { { \displaystyle \le \sum _ { t ^ { \prime } \ge 1 } \left( \hat { V } _ { t ^ { \prime } } - V ^ { * } \right) \left( s _ { t ^ { \prime } + 1 } \right) \left( \sum _ { t = t ^ { \prime } + 1 } ^ { \infty } \alpha _ { n _ { t } } ^ { n _ { t ^ { \prime } } } w _ { t } \right) . } } \end{array}
544
+ $$
545
+
546
+ Define
547
+
548
+ $$
549
+ w _ { t ^ { \prime } + 1 } ^ { \prime } = \left( \sum _ { \stackrel { t = t ^ { \prime } + 1 } { ( s _ { t } , a _ { t } ) = ( s _ { t } ^ { \prime } , a _ { t } ^ { \prime } ) } } ^ { \infty } \alpha _ { n _ { t } } ^ { n _ { t ^ { \prime } } } w _ { t } \right) .
550
+ $$
551
+
552
+ We claim that $w _ { t + 1 } ^ { \prime }$ is a $\textstyle ( C , ( 1 + { \frac { 1 } { H } } ) w )$ -sequence. We now prove this claim. By lemma 3, for any $t ^ { \prime } \geq 0$ ,
553
+
554
+ $$
555
+ w _ { t ^ { \prime } + 1 } ^ { \prime } \leq w \sum _ { j = n _ { t ^ { \prime } } } ^ { \infty } \alpha _ { j } ^ { n _ { t ^ { \prime } } } = ( 1 + 1 / H ) w .
556
+ $$
557
+
558
+ By $\textstyle \sum _ { j = 0 } ^ { i } \alpha _ { i } ^ { j } = 1$ , we have $\begin{array} { r } { \sum _ { t ^ { \prime } \geq 1 } w _ { t ^ { \prime } + 1 } ^ { \prime } \leq \sum _ { t \geq 1 } w _ { t } \leq C . } \end{array}$ . This proves the assertion. It follows from (22) that
559
+
560
+ $$
561
+ \begin{array} { r l } & { \quad \underset { t \geq 1 } { \sum \sigma } u _ { t + 1 } ^ { \prime } \left( \hat { V } _ { t } - V ^ { * } \right) \left( s _ { t + 1 } \right) } \\ & { = \underset { t \geq 1 } { \sum \sigma } u _ { t + 1 } ^ { \prime } \left( \hat { V } _ { t + 1 } - V ^ { * } \right) \left( s _ { t + 1 } \right) + \underset { t \geq 1 } { \sum \sigma } u _ { t + 1 } ^ { \prime } \left( \hat { V } _ { t } - \hat { V } _ { t + 1 } \right) \left( s _ { t + 1 } \right) } \\ & { \quad \leq \underset { t \geq 1 } { \sum \sigma } u _ { t + 1 } ^ { \prime } \left( \hat { V } _ { t + 1 } - V ^ { * } \right) \left( s _ { t + 1 } \right) + \underset { t \geq 1 } { \sum \sigma } u _ { t + 1 } ^ { \prime } \left( 2 \alpha _ { n _ { t } + 1 } \frac { 1 } { 1 - \gamma } \right) } \\ & { \quad \leq \underset { t \geq 1 } { \sum \sigma } w _ { t + 1 } ^ { \prime } \left( \hat { V } _ { t + 1 } - V ^ { * } \right) \left( s _ { t + 1 } \right) + \mathcal { O } \left( \frac { w S A H } { 1 - \gamma } \ln { C } \right) } \\ & { \quad \leq \underset { t \geq 1 } { \sum \sigma } w _ { t + 1 } ^ { \prime } \left( \hat { Q } _ { t + 1 } - Q ^ { * } \right) \left( s _ { t + 1 } , a _ { t + 1 } \right) + \mathcal { O } \left( \frac { w S A H } { 1 - \gamma } \ln { C } \right) } \end{array}
562
+ $$
563
+
564
+ Inequality (25) comes from the update rule of our algorithm. Inequality (26) comes from the fact that $\dot { \alpha } _ { t } = ( H + 1 ) / ( H + t ) \overset { \cdot } { \leq } H / t$ and Jensen’s Inequality. More specifically, let $C _ { s , a } ^ { \prime } =$ $\scriptstyle \sum _ { t \geq 1 , ( s _ { t } , a _ { t } = s , a } w _ { t + 1 } ^ { \prime }$ , $w ^ { \prime } = w ( 1 + 1 / H )$ . Then
565
+
566
+ $$
567
+ \sum _ { t \geq 1 } w _ { t + 1 } ^ { \prime } \alpha _ { n _ { t } + 1 } \leq \sum _ { s , a } \sum _ { n = 1 } ^ { C _ { s , a } ^ { \prime } / w ^ { \prime } } w ^ { \prime } \frac { H } { n } \leq \sum _ { s , a } H w ^ { \prime } \ln ( C _ { s , a } ^ { \prime } / w ) \leq 2 S A H w \ln C .
568
+ $$
569
+
570
+ Putting (18), (21) and (27) together, we have,
571
+
572
+ $$
573
+ \begin{array} { r l } & { \displaystyle \sum _ { t \geq 1 } w _ { t } ( \hat { Q } _ { t } - Q ^ { * } ) ( s _ { t } , a _ { t } ) } \\ & { \leq 2 c _ { 3 } \frac { \sqrt { w S A H C \iota ( C ) } } { 1 - \gamma } + \mathcal { O } \left( \frac { w S A H } { 1 - \gamma } \ln C \right) + \gamma \displaystyle \sum _ { t \geq 1 } w _ { t + 1 } ^ { \prime } \left( \hat { Q } _ { t + 1 } - Q ^ { * } \right) ( s _ { t + 1 } , a _ { t + 1 } ) . } \end{array}
574
+ $$
575
+
576
+ Observe that the third term is another weighted sum with the same form as (17). Therefore, we can unroll this term repetitively with changing weight sequences.Suppose that our original weight sequence is also denoted by $\{ \bar { w _ { t } ^ { ( 0 ) } } \} _ { t \ge 1 }$ , while $\{ w _ { t } ^ { ( k ) } \} _ { t \ge 1 }$ denotes the weight sequence after unrolling for $k$ times. Let $w ^ { ( k ) }$ be $w \cdot \left( 1 + 1 / H \right) ^ { k }$ . Then we can see that $\{ w _ { t } ^ { ( k ) } \} _ { t \ge 1 }$ is a $( C , w ^ { ( k ) } )$ -sequence. Suppose that we unroll for $H$ times. Then
577
+
578
+ $$
579
+ \begin{array} { r l } & { \displaystyle \sum _ { t \geq 1 } w _ { t } ( \hat { Q } _ { t } - Q ^ { * } ) ( s _ { t } , a _ { t } ) } \\ & { \leq 2 c _ { 3 } \frac { \sqrt { w ^ { ( H ) } S A H C \iota ( C ) } } { ( 1 - \gamma ) ^ { 2 } } + \mathcal { O } \left( \frac { w ^ { ( H ) } S A H } { ( 1 - \gamma ) ^ { 2 } } \ln C \right) + \gamma ^ { H } \displaystyle \sum _ { t \geq 1 } w _ { t } ^ { ( H ) } \left( \hat { Q } _ { t } - Q ^ { * } \right) ( s _ { t } , a _ { t } ) } \\ & { \leq 2 c _ { 3 } \frac { \sqrt { w ^ { ( H ) } S A H C \iota ( C ) } } { ( 1 - \gamma ) ^ { 2 } } + \mathcal { O } \left( \frac { w ^ { ( H ) } S A H } { ( 1 - \gamma ) ^ { 2 } } \ln C \right) + \gamma ^ { H } \frac { C } { 1 - \gamma } . } \end{array}
580
+ $$
581
+
582
+ We set $\begin{array} { r } { H = \frac { \ln 1 / ( ( 1 - \gamma ) \epsilon _ { 1 } ) } { \ln 1 / \gamma } \leq \frac { \ln 1 / ( ( 1 - \gamma ) \epsilon _ { 1 } ) } { 1 - \gamma } , } \end{array}$ . It follows that $w ^ { ( H ) } = ( 1 + 1 / H ) ^ { H } w ^ { ( 0 ) } \leq e w ^ { ( 0 ) }$ , and that γH C1−γ $\gamma ^ { H } \frac { C } { 1 - \gamma } \leq C \epsilon _ { 1 }$ . Also, let $\ell ( C ) = \iota ( C ) \ln ( ( 1 - \gamma ) ^ { - 1 } \epsilon _ { 1 } ^ { - 1 } )$ . Therefore,
583
+
584
+ $$
585
+ \sum _ { t \geq 1 } w _ { t } ( \hat { Q } _ { t } - Q ^ { * } ) ( s _ { t } , a _ { t } ) \leq \frac { C \epsilon _ { 1 } } { 1 - \gamma } + \mathcal { O } \left( \frac { \sqrt { w S A C \ell ( C ) } } { ( 1 - \gamma ) ^ { 2 . 5 } } + \frac { w S A } { ( 1 - \gamma ) ^ { 3 } } \ln C \ln \frac { 1 } { ( 1 - \gamma ) \epsilon _ { 1 } } \right) .
586
+ $$
587
+
588
+ # C EXTENSION TO OTHER SETTINGS
589
+
590
+ First we define a mapping from a finite horizon MDP to an infinite horizon MDP so that our algorithm can be applied. For an arbitrary finite horizon MDP $\mathcal { M } = ( S , A , H , r _ { h } ( s _ { \perp } a ) , p _ { h } ( s ^ { \prime } \mid s , a ) )$ where $H$ is the length of episode, the corresponding infinite horizon MDP $\mathcal { M } = ( S , A , \gamma , \bar { r } ( \bar { s } , \bar { a } ) , \bar { p } ( \bar { s } ^ { \prime } \mid \bar { s } , \bar { a } ) )$ is defined as,
591
+
592
+ $\begin{array} { l } { { \bullet \ { \bar { S } } = S \times H , { \bar { A } } = A ; } } \\ { { \bullet \ \gamma = ( 1 - 1 / H ) ; } } \end{array}$ • for a state $s$ at step $h$ , let $\bar { s } _ { s , h }$ be the corresponding state. For any action $a$ and next state $s ^ { \prime }$ , define $\bar { r } ( \bar { s } _ { s , h } , a ) = \gamma ^ { H - h + 1 } r _ { h } ( s , a )$ and $\bar { p } ( \bar { s } _ { s ^ { \prime } , h + 1 } \mid \bar { s } _ { s , h } , a ) = p _ { h } ( s ^ { \prime } \mid s , h )$ . And for $h = H$ , set $\bar { r } ( \bar { s } _ { s , h } , a ) = 0$ and $\bar { p } ( \bar { s } _ { s ^ { \prime } , 1 } \mid \bar { s } _ { s , h } , a ) = I [ s ^ { \prime } = s _ { 1 } ]$ for a fixed starting state $s _ { 1 }$ .
593
+
594
+ Let $\bar { V } _ { t }$ be the value function in $\bar { \mathcal { M } }$ at time $t$ and $V _ { h } ^ { k }$ the value function in $\mathcal { M }$ at episode $k$ , step $h$ . It follows that $\begin{array} { r } { \bar { V } ^ { \ast } ( \bar { s } _ { s _ { 1 } , 1 } ) = \frac { \gamma ^ { H } } { 1 - \gamma ^ { H } } V _ { 1 } ^ { \ast } ( s _ { 1 } ) } \end{array}$ . And the policy mapping is defined as $\pi _ { h } ( s ) = \bar { \pi } ( \bar { s } _ { s , h } )$ for policy $\bar { \pi }$ in $\bar { \mathcal { M } }$ . Value functions in MDP $\mathcal { M }$ and $\bar { \mathcal { M } }$ are closely related in a sense that, any $\epsilon$ -optimal policy $\bar { \pi }$ of $\bar { \mathcal { M } }$ corresponding to an $( \epsilon / \gamma ^ { H } )$ -optimal policy $\pi$ in $\mathcal { M }$ (see section C.1 for proof). Note that here $\gamma ^ { H } = ( 1 - \dot { 1 } / H ) ^ { \tilde { H } } = \mathcal { O } ( \dot { 1 } )$ is a constant.
595
+
596
+ For any visited a $\epsilon > 0$ g our algorithm on times, and at most $\bar { M }$ for of $\tilde { \mathcal O } \big ( \frac { 3 S A H ^ { 9 } } { \epsilon ^ { 2 } } \big )$ tt me steps, the starting state -optimal. If we select the p $s _ { 1 }$ iscy $\tilde { \mathcal O } \big ( { \textstyle { \frac { 3 S A H ^ { 8 } } { \epsilon ^ { 2 } } } } \big )$ $1 / 3$ $\epsilon$ uniformly randomly from the policy $\pi ^ { t H + 1 }$ for $0 \leq t < T / H$ , with probability at least $2 / 3$ we can get an $\epsilon$ -optimal policy. Therefore the PAC sample complexity is $\tilde { \mathcal { O } } \left( \epsilon ^ { - 2 } \right)$ after hiding $S , A , H$ terms.
597
+
598
+ On the other hand, we want to show that for any $K$ episodes,
599
+
600
+ $$
601
+ \mathrm { R e g r e t } ( T ) = \sum _ { k = 1 } ^ { T / H } \left[ V ^ { * } ( s _ { 1 } ) - V _ { 1 } ^ { k } ( s _ { 1 } ) \right] \propto T ^ { 1 / 2 } .
602
+ $$
603
+
604
+ The reason why our algorithm can have a better reduction from regret to PAC is that, after choosing $\epsilon _ { 1 }$ , it follows from the argument of theorem 1 that for all $\epsilon _ { 2 } > \tilde { \mathcal { O } } ( \epsilon _ { 1 } / ( 1 - \gamma ) )$ , the number of $\epsilon _ { 2 }$ -suboptimal steps is bounded by
605
+
606
+ $$
607
+ \mathcal { O } \left( \frac { S A \ln S A \ln 1 / \delta } { \epsilon _ { 2 } ^ { 2 } ( 1 - \gamma ) ^ { 7 } } \mathrm { p o l y l o g } \left( \frac { 1 } { \epsilon _ { 1 } } , \frac { 1 } { 1 - \gamma } \right) \right)
608
+ $$
609
+
610
+ with probability $1 - \delta$ . In contrast, delayed Q-learning can only give an upper bound on $\epsilon _ { 1 }$ -suboptimal steps after setting parameter $\epsilon _ { 1 }$ .
611
+
612
+ Formally, let $X _ { k } = V ^ { \ast } ( s _ { 1 } ) - V _ { 1 } ^ { k } ( s _ { 1 } )$ be the regret of $k$ -th episode. For any $T$ , set $\epsilon = \sqrt { S A / T }$ and $\epsilon _ { 2 } = \tilde { \mathcal { O } } ( \epsilon _ { 1 } / ( 1 - \gamma ) )$ . Let $\begin{array} { r } { M = \lceil \log _ { 2 } \frac { 1 } { \epsilon _ { 2 } ( 1 - \gamma ) } \rceil } \end{array}$ . It follows that,
613
+
614
+ $$
615
+ \begin{array} { r l r } { { \operatorname { R e g r e t } ( T ) \le T \epsilon _ { 2 } + \sum _ { i = 1 } ^ { M } ( | k : \{ X _ { k } \ge \epsilon _ { 2 } \cdot 2 ^ { i - 1 } \} | ) \epsilon _ { 2 } \cdot 2 ^ { i } } } \\ & { } & \\ & { } & { \le \tilde { \mathcal { O } } ( T \epsilon _ { 2 } + \sum _ { i = 1 } ^ { M } \frac { S A \ln 1 / \delta } { \epsilon _ { 2 } \cdot 2 ^ { i - 2 } } ) } \\ & { } & { \le \tilde { \mathcal { O } } ( \sqrt { S A T } \ln 1 / \delta ) } \end{array}
616
+ $$
617
+
618
+ with probability $1 - \delta$ . Note that the $\tilde { \mathcal { O } }$ notation hides the poly $( 1 / ( 1 - \gamma ) , \log { 1 / \epsilon _ { 1 } } )$ which is, by our reduction, poly $( H , \log T , \log S , \log A )$ .
619
+
620
+ # C.1 CONNECTION BETWEEN VALUE FUNCTIONS
621
+
622
+ Recall that our MDP mapping from $\begin{array} { r c l } { \mathcal { M } } & { = } & { ( S , A , H , r _ { h } ( s , a ) , p _ { h } ( s ^ { \prime } \mathrm { ~ ~ \chi ~ } | \mathrm { ~ ~ \chi ~ } s , a ) ) } \end{array}$ to $\begin{array} { r l } { \bar { \mathcal { M } } } & { { } = } \end{array}$ $( \bar { S } , \bar { A } , \gamma , \bar { r } ( \bar { s } , \bar { a } ) , \bar { p } ( \bar { s } ^ { \prime } \mid \bar { s } , \bar { a } ) )$ is defined as,
623
+
624
+ • $\bar { S } = S \times H , \bar { A } = A$ ;
625
+ • $\gamma = ( 1 - 1 / H )$ ;
626
+ • for a state $s$ at step $h$ , let $\bar { s } _ { s , h }$ be the corresponding state. For any action $a$ and next state $s ^ { \prime }$ , define $\bar { r } ( \bar { s } _ { s , h } , a ) = \gamma ^ { H - h + 1 } r _ { h } ( s , a )$ and $\bar { p } ( \bar { s } _ { s ^ { \prime } , h + 1 } \mid \bar { s } _ { s , h } , a ) = p _ { h } ( s , h )$ . And for $h = H$ , set $\bar { r } ( \bar { s } _ { s , h } , a ) = 0$ and $\bar { p } ( \bar { s } _ { s ^ { \prime } , 1 } \mid \bar { s } _ { s , h } , a ) = I [ s ^ { \prime } = s _ { 1 } ]$ for a fixed starting state $s _ { 1 }$ .
627
+
628
+ For a trajectory $\left\{ { \left( { \bar { s } } _ { s _ { 1 } , 1 } , { \bar { a } } _ { 1 } \right) } , { \left( { \bar { s } } _ { s _ { 2 } , 2 } , { \bar { a } } _ { 2 } \right) } , \cdot \cdot \cdot \right\}$ in $\bar { \mathcal { M } }$ , let $\{ ( s _ { 1 } , a _ { 1 } ) , ( s _ { 2 } , a _ { 2 } ) , \cdot \cdot \cdot \}$ be the corresponding trajectory in $\mathcal { M }$ . Note that $\mathcal { M }$ has a unique fixed starting state $s _ { 1 }$ , which means that $s _ { t H + 1 } = s _ { 1 }$ for all $t \geq 0$ . Denote the corresponding policy of $\bar { \pi } ^ { t }$ as $\pi ^ { t }$ (may be non-stationary), then we have
629
+
630
+ $$
631
+ \begin{array} { r l } & { \bar { \gamma } ^ { \pi ^ { t } } ( \bar { s } _ { s _ { 1 } , 1 } ) = \mathbb { E } \left[ \bar { r } ( \bar { s } _ { s _ { 1 } , 1 } , \bar { a } _ { 1 } ) + \gamma \bar { r } ( \bar { s } _ { s _ { 2 } , 2 } , \bar { a } _ { 2 } ) + \cdot \cdot \cdot + \gamma ^ { H - 1 } \bar { r } ( \bar { s } _ { s _ { H - 1 } , H - 1 } , \bar { a } _ { H - 1 } ) + \gamma ^ { H } \bar { V } ^ { \pi _ { t + H - 1 } } ( \bar { s } _ { s _ { H + 1 } , 1 } ) \right] } \\ & { \phantom { \frac { 1 } { 1 } } = \gamma ^ { H } \mathbb { E } \left[ r _ { 1 } ( s _ { 1 } , a _ { 1 } ) + r _ { 2 } ( s _ { 2 } , a _ { 2 } ) + \cdot \cdot \cdot + r _ { H - 1 } ( s _ { H - 1 } , a _ { H - 1 } ) + \bar { V } ^ { \pi _ { t + H } } ( \bar { s } _ { s _ { H + 1 } , 1 } ) \right] } \\ & { \phantom { \frac { 1 } { 1 } } = \gamma ^ { H } V ^ { \pi ^ { t } } ( s _ { 1 } ) + \gamma ^ { H } \bar { V } ^ { \pi + H } ( \bar { s } _ { s _ { 1 } , 1 } ) . } \end{array}
632
+ $$
633
+
634
+ Then for a stationary policy $\bar { \pi }$ , we can conclude $\begin{array} { r } { \bar { V } ^ { \bar { \pi } } ( \bar { s } _ { s _ { 1 } , 1 } ) = \frac { \gamma ^ { H } } { 1 - \gamma ^ { H } } V ^ { \pi } ( s _ { 1 } ) } \end{array}$ . Since the optimal policy $\bar { \pi } ^ { * }$ is stationary, we have $\begin{array} { r } { \bar { V } ^ { \ast } ( \bar { s } _ { s _ { 1 } , 1 } ) = \frac { \gamma ^ { H } } { 1 - \gamma ^ { H } } V ^ { \ast } ( s _ { 1 } ) } \end{array}$ .
635
+
636
+ By definition, $\bar { \pi }$ is $\epsilon$ -optimal at time step $t$ means that
637
+
638
+ $$
639
+ \begin{array} { r } { \bar { V } ^ { \bar { \pi } ^ { t } } ( \bar { s } _ { s _ { 1 } , 1 } ) \geq \bar { V } ^ { * } ( \bar { s } _ { s _ { 1 } , 1 } ) - \epsilon . } \end{array}
640
+ $$
641
+
642
+ It follows that
643
+
644
+ $$
645
+ \gamma ^ { H } V ^ { \pi ^ { t } } ( s _ { 1 } ) + \gamma ^ { H } \bar { V } ^ { \pi _ { t + H } } ( \bar { s } _ { s _ { 1 } , 1 } ) = \bar { V } ^ { \bar { \pi } } ( \bar { s } _ { s _ { 1 } , 1 } ) \geq \bar { V } ^ { * } ( \bar { s } _ { s _ { 1 } , 1 } ) - \epsilon ,
646
+ $$
647
+
648
+ hence
649
+
650
+ $$
651
+ ^ { H } V ^ { \pi ^ { \varepsilon } } ( s _ { 1 } ) \geq ( 1 - \gamma ^ { H } ) \bar { V } ^ { * } ( \bar { s } _ { s _ { 1 } , 1 } ) + \gamma ^ { H } ( \bar { V } ^ { * } ( \bar { s } _ { s _ { 1 } , 1 } ) - \bar { V } ^ { \pi _ { t + H } } ( \bar { s } _ { s _ { 1 } , 1 } ) ) - \epsilon \geq ( 1 - \gamma ^ { H } ) \bar { V } ^ { * } ( \bar { s } _ { s _ { 1 } , 1 } ) - \epsilon .
652
+ $$
653
+
654
+ Therefore we have
655
+
656
+ $$
657
+ { V ^ { \pi } } ^ { t } ( s _ { 1 } ) \ge \frac { 1 - \gamma ^ { H } } { \gamma ^ { H } } \bar { V } ^ { * } ( \bar { s } _ { s 1 , 1 } ) - \epsilon / \gamma ^ { H } = V ^ { * } ( s _ { 1 } ) - \epsilon / \gamma ^ { H } ,
658
+ $$
659
+
660
+ which means that $\pi ^ { t }$ is an $( \epsilon / \gamma ^ { H } )$ -optimal policy.
661
+
662
+ # D A HARD INSTANCE FOR DELAYED Q-LEARNING
663
+
664
+ In this section, we prove Theorem 2 regarding the performance of Delayed Q-learning.
665
+
666
+ Theorem 2. There exists a family of MDPs with constant $S$ and $A$ , in which with probability $1 - \delta$ , Delayed $Q$ -learning incurs sample complexity of exploration of $\Omega \left( \frac { \epsilon ^ { - 3 } } { \ln ( 1 / \delta ) } \right)$ , assuming that $\ln ( 1 / \delta ) < \epsilon ^ { - 2 }$ .
667
+
668
+ ![](images/d5ea7466679255528080a8e623d46ab5efe02c60983c67939e2c04d8974b3167.jpg)
669
+ Figure 1: The MDP family. Actions are denoted by arrows. Actions with red color have reward 1, and reward 0 otherwise.
670
+
671
+ Proof. For each $0 < \epsilon < \frac { 1 } { 1 0 }$ , consider the following MDP (see also Fig. 1): state space is ${ \boldsymbol { s } } =$ $\{ a , b , c \}$ while action set is $\overset { \vartriangle } { \mathcal { A } } = \{ \ v { x } , \ v { y } \}$ ; transition probabilities are $P ( b | a , y ) = 1 - 1 0 \epsilon$ , $P ( c | a , y ) =$ 10, $P ( b | a , x ) = 1$ , $P ( a | b , \cdot ) = P ( a | c , \cdot ) = 1$ . Rewards are all 1, except $R ( c , \cdot ) = 0$ .
672
+
673
+ Assume that Delayed Q-learning is called for this MDP starting from state $a$ , with discount $\begin{array} { r } { \gamma > \frac { 1 } { 2 } } \end{array}$ and precision set as $\epsilon$ . Denote the $Q$ value maintained by the algorithm by $\hat { Q }$ . Without loss of generality, assume that the initial tie-breaking favors action $y$ when comparing $\hat { Q } ( a , x )$ and $\hat { Q } ( a , y )$ . In that case, unless $\hat { Q } ( a , y )$ is updated, the agent will always choose $y$ in state $a$ . Since $Q ( a , x ) - Q ( a , y ) = 1 0 \epsilon \gamma > \epsilon$ for any policy, choosing $y$ at state $a$ implies that the timestep is not $\epsilon$ -optimal. In other words, sample complexity for exploration is at least the number of times the agent visits $a$ before the first update of $\hat { Q } ( a , y )$ .
674
+
675
+ In the Delayed Q-learning algorithm, $\hat { Q } ( \cdot , \cdot )$ are initialized to $1 / ( 1 - \gamma )$ . Therefore, $\hat { Q } ( a , y )$ could only be updated if max $\hat { Q } ( c , \cdot )$ is updated (and becomes smaller than $1 / ( 1 - \gamma ) )$ . According to the algorithm, this can only happen if $c$ is visited $\begin{array} { r } { m = \Omega \left( \frac { 1 } { \epsilon ^ { 2 } } \right) } \end{array}$ times.
676
+
677
+ However, each time the agent visits $a$ , there is less than $1 0 \epsilon$ probability of transiting to $c$ . Let $t _ { 0 } = m / ( 1 0 \epsilon C )$ , where $\begin{array} { r } { C ^ { ' } = 3 \ln \frac { 1 } { \delta } + 1 } \end{array}$ . $\delta$ is chosen such that $C \leq m$ . In the first $2 t _ { 0 }$ timesteps, $a$ will be visited $t _ { 0 }$ times. By Chernoff’s bound, with probability $1 - \delta$ , state $c$ will be visited less than $m$ times. In that case, $\hat { Q } ( a , y )$ will not be updated in the first $2 t _ { 0 }$ timesteps. Therefore, with probability $1 - \delta$ , sample complexity of exploration is at least
678
+
679
+ $$
680
+ t _ { 0 } = \Omega \left( { \frac { 1 } { \epsilon ^ { 3 } \left( \ln { 1 / \delta } \right) } } \right) .
681
+ $$
682
+
683
+ When $\ln ( 1 / \delta ) < \epsilon ^ { - 2 }$ , it can be seen that $\begin{array} { r } { C = 3 \ln \frac { 1 } { \delta } + 1 < \frac { 4 } { \epsilon ^ { 2 } } < m } \end{array}$
parse/train/BkglSTNFDB/BkglSTNFDB_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/BkglSTNFDB/BkglSTNFDB_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/BkglSTNFDB/BkglSTNFDB_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/LAKplpLMbP8/LAKplpLMbP8.md ADDED
@@ -0,0 +1,387 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Repulsive Deep Ensembles are Bayesian
2
+
3
+ Francesco D’Angelo ETH Zürich Zürich, Switzerland dngfra@gmail.com
4
+
5
+ Vincent Fortuin
6
+ ETH Zürich
7
+ Zürich, Switzerland
8
+ fortuin@inf.ethz.ch
9
+
10
+ # Abstract
11
+
12
+ Deep ensembles have recently gained popularity in the deep learning community for their conceptual simplicity and efficiency. However, maintaining functional diversity between ensemble members that are independently trained with gradient descent is challenging. This can lead to pathologies when adding more ensemble members, such as a saturation of the ensemble performance, which converges to the performance of a single model. Moreover, this does not only affect the quality of its predictions, but even more so the uncertainty estimates of the ensemble, and thus its performance on out-of-distribution data. We hypothesize that this limitation can be overcome by discouraging different ensemble members from collapsing to the same function. To this end, we introduce a kernelized repulsive term in the update rule of the deep ensembles. We show that this simple modification not only enforces and maintains diversity among the members but, even more importantly, transforms the maximum a posteriori inference into proper Bayesian inference. Namely, we show that the training dynamics of our proposed repulsive ensembles follow a Wasserstein gradient flow of the KL divergence to the true posterior. We study repulsive terms in weight and function space and empirically compare their performance to standard ensembles and Bayesian baselines on synthetic and real-world prediction tasks.
13
+
14
+ # 1 Introduction
15
+
16
+ There have been many recent advances on the theoretical properties of sampling algorithms for approximate Bayesian inference, which changed our interpretation and understanding of them. Particularly worth mentioning is the work of Jordan et al. [38], who reinterpret Markov Chain Monte Carlo (MCMC) as a gradient flow of the KL divergence over the Wasserstein space of probability measures. This new formulation allowed for a deeper understanding of approximate inference methods but also inspired the inception of new and more efficient inference strategies. Following this direction, Liu and Wang $\pmb { \mathbb { B } } \mathbf { \mathbb { 1 } }$ recently proposed the Stein Variational Gradient Descent (SVGD) method to perform approximate Wasserstein gradient descent. Conceptually, this method, which belongs to the family of particle-optimization variational inference (POVI), introduces a repulsive force through a kernel acting in the parameter space to evolve a set of samples towards high-density regions of the target distribution without collapsing to a point estimate.
17
+
18
+ Another method which has achieved great success recently are ensembles of neural networks (socalled deep ensembles), which work well both in terms of predictive performance $\pm 2 \sqrt { 8 0 }$ as well as uncertainty estimation $\begin{array} { r l } { { \| 6 5 \| } } \end{array}$ , and have also been proposed as a way to perform approximate inference in Bayesian neural networks [82, 36]. That being said, while they might allow for the averaging of predictions over several hypotheses, they do not offer any guarantees for the diversity between those hypotheses nor do they provably converge to the true Bayesian posterior under any meaningful limit. In this work, we show how the introduction of a repulsive term between the members in the ensemble, inspired by SVGD, not only naïvely guarantees the diversity among the members, avoiding their collapse in parameter space, but also allows for a reformulation of the method as a gradient flow of the KL divergence in the Wasserstein space of distributions. It thus allows to endow deep ensembles with convergence guarantees to the true Bayesian posterior.
19
+
20
+ ![](images/c87b35667fe31cb24e44c323fe8bffeb4df13996d7df41a00bfd504161843062.jpg)
21
+ Figure 1: BNN 1D regression. The function-space methods (SVGD and WGD) approach the HMC posterior more closely, while the standard deep ensembles and weight-space methods fail to properly account for the uncertainty, especially the in-between uncertainty.
22
+
23
+ An additional problem is that BNN inference in weight space can lead to degenerate solutions, due to the overparametrization of these models. That is, several samples could have very different weights but map to the same function, thus giving a false sense of diversity in the ensemble. This property, that we will refer to as non-identifiability of neural networks (see Appendix $\boxed { \mathrm { A } }$ , can lead to redundancies in the posterior distribution. It implies that methods like MCMC sampling, deep ensembles, and SVGD waste computation in local modes that account for equivalent functions. Predictive distributions approximated using samples from these modes do not improve over a simple point estimate and lead to a poor uncertainty estimation. Following this idea, Wang et al. $\mathbb { \left[ \left] \right. \right]} 2 $ introduced a new method to extend POVI methods to function space, overcoming this limitation. Here, we also study an update rule that allows for an approximation of the gradient flow of the KL divergence in function space in our proposed repulsive ensembles.
24
+
25
+ We make the following contributions:
26
+
27
+ • We derive several different repulsion terms that can be added as regularizers to the gradient updates of deep ensembles to endow them with Bayesian convergence properties.
28
+ • We show that these terms approximate Wasserstein gradient flows of the KL divergence and can be used both in weight space and function space.
29
+ • We compare these proposed methods theoretically to standard deep ensembles and SVGD and highlight their different guarantees.
30
+ • We assess all these methods on synthetic and real-world deep learning tasks and show that our proposed repulsive ensembles can achieve competitive performance and improved uncertainty estimation.
31
+
32
+ # 2 Repulsive Deep Ensembles
33
+
34
+ In supervised deep learning, we typically consider a likelihood function $p ( \pmb { y } | f ( \pmb { x } ; \mathbf { w } ) )$ (e.g., Gaussian for regression or Categorical for classification) parameterized by a neural network $f ( \pmb { x } ; \mathbf { w } )$ and training data $\textit { D } = \{ ( \boldsymbol { \mathbf { { x } } } _ { i } , \boldsymbol { \mathbf { { y } } } _ { i } ) \} _ { i = 1 } ^ { n }$ with $\textbf { \textit { x } } \in \textbf { \textit { X } }$ and $\textbf { \textit { y } } \in \textbf { \textit { y } }$ . In Bayesian neural networks (BNNs), we are interested in the posterior distribution of all likely networks given by $\begin{array} { r } { p ( \mathbf { w } | \mathcal { D } ) \propto \prod _ { i = 1 } ^ { n } p ( \pmb { y } _ { i } | f ( \pmb { x } _ { i } ; \mathbf { w } ) ) p ( \mathbf { w } ) } \end{array}$ , where $p ( \mathbf { w } )$ is the prior distribution over weights. Crucially, when making a prediction on a test point $\mathbf { \boldsymbol { x } } ^ { * }$ , in the Bayesian approach we do not only use a single parameter $\widehat { \bf w }$ to predict ${ \pmb y } ^ { * } = f ( { \pmb x } ^ { * } ; \widehat { \mathbf { w } } )$ , but we marginalize over the whole posterior, thus taking all possible explanations of the data into account:
35
+
36
+ $$
37
+ p ( \pmb { y } ^ { * } | \pmb { x } ^ { * } , \mathcal { D } ) = \int p ( \pmb { y } ^ { * } | f ( \pmb { x } ^ { * } ; \mathbf { w } ) ) p ( \mathbf { w } | \mathcal { D } ) \mathrm { d } \mathbf { w }
38
+ $$
39
+
40
+ While approximating the posterior of Bayesian neural networks (or sampling from it) is a challenging task, performing maximum a posteriori (MAP) estimation, which corresponds to finding the mode of the posterior, is usually simple. Ensembles of neural networks use the non-convexity of the MAP optimization problem to create a collection of $K$ independent—and possibly different— solutions. Considering $n$ weight configurations of a neural network $\{ { \bf w } _ { i } \} _ { i = 1 } ^ { n }$ with ${ \bf w } _ { i } \in \mathbb { R } ^ { d }$ , the dynamics of the ensemble under the gradient of the posterior lead to the following update rule at iteration $t$ :
41
+
42
+ $$
43
+ \begin{array} { r l } & { \mathbf { w } _ { i } ^ { t + 1 } \mathbf { w } _ { i } ^ { t } + \epsilon _ { t } \phi ( \mathbf { w } _ { i } ^ { t } ) } \\ { \mathrm { w i t h } \quad } & { \phi ( \mathbf { w } _ { i } ^ { t } ) = \nabla _ { \mathbf { w } _ { i } ^ { t } } \log p ( \mathbf { w } _ { i } ^ { t } | \mathcal { D } ) , } \end{array}
44
+ $$
45
+
46
+ with step size $\epsilon _ { t }$ . Ensemble methods have a long history [e.g., 45, 26, 6] and were recently revisited for neural networks $\pm 2 \|$ and coined deep ensembles. The predictions of the different members are combined to create a predictive distribution by using the solutions to compute the Bayesian model average (BMA) in Eq. $\mathbb { D }$ . Recent works $\mathbb { \lVert \rVert }$ have shown that deep ensembles can outperform some of the Bayesian approaches for uncertainty estimation. Even more recently, Wilson and Izmailov $\pmb { \Vert 8 2 \Vert }$ argued that deep ensembles can be considered a compelling approach to Bayesian model averaging. Despite these ideas, the ability of deep ensembles to efficiently average over multiple hypotheses and to explore the functional landscape of the posterior distribution studied in $[ \overline { { 1 8 } } ]$ does not guarantee sampling from the right distribution. Indeed, the additional Langevin noise introduced in $\mathbb { [ \breve { ] { ] \mathrm { ~ Z ~ Z ~ } ] } } }$ , which is not considered in deep ensembles, is crucial to ensure samples from the true Bayesian posterior.
47
+
48
+ From a practical standpoint, since the quality of an ensemble hinges on the diversity of its members, many methods were recently proposed to improve this diversity without compromising the individual accuracy. For instance, Wenzel et al. [80] propose hyper-deep ensembles that combine deep networks with different hyperparameters. Similarly, cyclical learning-rate schedules can explore several local minima for the ensemble members $\pmb { \mathbb { B 3 } }$ . Alternatively, Rame and Cord $ { \mathbb { I } } { \mathbb { I } }$ proposed an informationtheoretic framework to avoid redundancy in the members and Oswald et al. $\overline { { \| 6 3 \| } }$ studied possible interactions between members based on weight sharing. However, the absence of a constraint that prevents particles from converging to the same mode limits the possibility of improvement by introducing more ensemble members. This means that any hopes to converge to different modes must exclusively rely on:
49
+
50
+ 1. the randomness of the initialization
51
+ 2. the noise in the estimation of the gradients due to minibatching
52
+ 3. the number of local optima that might be reached during gradient descent.
53
+
54
+ Moreover, the recent study of Geiger et al. $\pmb { \left. \pmb { \left. \bar { 2 5 } \right. } \right. }$ showed how the empirical test error of the ensemble converges to the one of a single trained model when the number of parameters goes to infinity, leading to deterioration of the performance. In other words, the bigger the model, the harder it is to maintain diversity in the ensemble and avoid collapse to the same solution. This is intuitively due to the fact that bigger models are less sensitive to the initialization. Namely, in order for them to get stuck in a local minimum, they must have second derivatives that are positive simultaneously in all directions. As the number of hidden units gets larger, this becomes less likely.
55
+
56
+ # 2.1 Repulsive force in weight space
57
+
58
+ To overcome the aforementioned limitations of standard deep ensembles, we introduce, inspired by SVGD $\mathbb { \left[ \left[ 5 1 \right] \right] }$ , a deep ensemble with members that interact with each other through a repulsive component. Using a kernel function to model this interaction, the single models repel each other based on their position in the weight space, so that two members can never assume the same weights. Considering a stationary kernel $\bar { k } ( \cdot , \cdot ) : \mathbb { R } ^ { d } \times \mathbb { R } ^ { d } \to \mathbb { R }$ acting in the parameter space of the neural network, a repulsive term $\mathcal { R }$ can be parameterized through its gradient:
59
+
60
+ $$
61
+ \phi ( \mathbf { w } _ { i } ^ { t } ) = \nabla _ { \mathbf { w } _ { i } ^ { t } } \log p ( \mathbf { w } _ { i } ^ { t } | \mathcal { D } ) - \mathcal { R } \left( \left\{ \nabla _ { \mathbf { w } _ { i } ^ { t } } k ( \mathbf { w } _ { i } ^ { t } , \mathbf { w } _ { j } ^ { t } ) \right\} _ { j = 1 } ^ { n } \right) .
62
+ $$
63
+
64
+ To get an intuition for the behavior of this repulsive term and its gradients, we can consider the RBF kernel $\begin{array} { r } { k ( \mathbf { w } _ { i } , \mathbf { w } _ { j } ) = \exp \big ( - \frac { 1 } { h } | | \mathbf { w } _ { i } - \mathbf { w } _ { j } | | ^ { 2 } \big ) } \end{array}$ with lengthscale $h$ and notice how its gradient
65
+
66
+ $$
67
+ \nabla _ { \mathbf { w } _ { i } ^ { t } } k ( \mathbf { w } _ { i } ^ { t } , \mathbf { w } _ { j } ^ { t } ) = \frac { 2 } { h } ( \mathbf { w } _ { j } ^ { t } - \mathbf { w } _ { i } ^ { t } ) k ( \mathbf { w } _ { i } ^ { t } , \mathbf { w } _ { j } ^ { t } )
68
+ $$
69
+
70
+ drives $\mathbf { w } _ { i }$ away from its neighboring members ${ \bf w } _ { j }$ , thus creating a repulsive effect. Naturally, not all the choices of $\mathcal { R }$ induce this effect. One of the simplest formulations to obtain it is via a linear combination of the kernel gradients scaled by a positive factor, that is, $\begin{array} { r } { \beta \sum _ { j = 1 } ^ { n } \nabla _ { \mathbf { w } _ { i } ^ { t } } k ( \mathbf { w } _ { i } ^ { t } , \mathbf { w } _ { j } ^ { t } ) } \end{array}$ with $\beta \in \mathbb { R } _ { * } ^ { + }$ . We will see in Section $\begin{array} { l } { 3 } \\ { . } \end{array}$ how the choice of $\beta$ can be justified in order to obtain convergence to the Bayesian posterior together with alternative possible formulations of $\mathcal { R }$ that preserve this convergence.
71
+
72
+ # 2.2 Repulsive force in function space
73
+
74
+ To overcome the aforementioned overparameterization issue, the update in Eq. $\textcircled { 3 }$ can be formulated in function space instead of weight space. Let $f : \mathbf { w } \mapsto f ( \cdot ; \mathbf { w } )$ be the map that maps a configuration of weights $\mathbf { w } \in \mathbb { R } ^ { d }$ to the corresponding neural network regression function and denote as $f _ { i } : = f ( \cdot ; { \mathbf w } _ { i } )$ the function with a certain configuration of weights $\mathbf { w } _ { i }$ . We can now consider $n$ particles in function space $\{ f _ { i } \} _ { i = 1 } ^ { n }$ with $\pmb { f } \in \mathcal { F }$ and model their interaction with a general positive definite kernel $k ( \cdot , \cdot )$ . We also consider the implicit functional likelihood $p ( \pmb { y } | \pmb { x } , \pmb { f } )$ , determined by the measure $p ( \pmb { y } | \pmb { x } , \mathbf { w } )$ in the weight space, as well as the functional prior $p ( f )$ , which can either be defined separately (e.g., using a GP) or modeled as a push-forward measure of the weight-space prior $p ( \mathbf { w } )$ . Together, they determine the posterior in function space $p ( \pmb { f } | \mathcal { D } )$ . The functional evolution of a particle can then be written as:
75
+
76
+ $$
77
+ \begin{array} { r l } & { f _ { i } ^ { t + 1 } \gets f _ { i } ^ { t } + \epsilon _ { t } \phi ( f _ { i } ^ { t } ) } \\ { \mathrm { t h } \quad } & { \phi ( f _ { i } ^ { t } ) = \nabla _ { f _ { i } ^ { t } } \log p ( f _ { i } ^ { t } | \mathcal { D } ) - \mathcal { R } \left( \left\{ \nabla _ { f _ { i } ^ { t } } k ( f _ { i } ^ { t } , f _ { j } ^ { t } ) \right\} _ { j = 1 } ^ { n } \right) . } \end{array}
78
+ $$
79
+
80
+ However, computing the update in function space is neither tractable nor practical, which is why two additional considerations are needed. The first one regards the infinite dimensionality of function space, which we circumvent using a canonical projection into a subspace:
81
+
82
+ Definition 1 (Canonical projection). For any $A \subset { \mathcal { X } }$ , we define $\pi _ { A } : \mathbb { R } ^ { \mathcal { X } } \to \mathbb { R } ^ { A }$ as the canonical projection onto $A$ , that is, $\pi _ { A } ( f ) = \{ f ( a ) \} _ { a \in A }$ .
83
+
84
+ In other words, the kernel will not be evaluated directly in function space, but on the projection $k \big ( \pi _ { B } ( f ) , \pi _ { B } ( f ^ { \prime } ) \big )$ , with $B$ being a subset of the input space given by a batch of training data points. The second consideration is to project this update back into the parameter space and evolve a set of particles there, because ultimately we are interested in representing the functions by parameterized neural networks. For this purpose, we can use the Jacobian of the $i$ -th particle as a projector:
85
+
86
+ $$
87
+ \phi ( { \mathbf w } _ { i } ^ { t } ) = \left( \frac { \partial f _ { i } ^ { t } } { \partial { \mathbf w } _ { i } ^ { t } } \right) ^ { \top } \left[ \nabla _ { f _ { i } ^ { t } } \log p ( f _ { i } ^ { t } | { \mathcal D } ) - { \mathcal R } \left( \left\{ \nabla _ { f _ { i } ^ { t } } k ( \pi _ { B } ( f _ { i } ^ { t } ) , \pi _ { B } ( f _ { j } ^ { t } ) ) \right\} _ { j = 1 } ^ { n } \right) \right] .
88
+ $$
89
+
90
+ # 2.3 Comparison to Stein variational gradient descent
91
+
92
+ Note that our update is reminiscent of SVGD $\mathbb { \left[ 5 1 \right] }$ , which in parameter space can be written as:
93
+
94
+ $$
95
+ \phi ( \mathbf { w } _ { i } ^ { t } ) = \sum _ { j = 1 } ^ { n } k ( \mathbf { w } _ { i } ^ { t } , \mathbf { w } _ { j } ^ { t } ) \nabla _ { \mathbf { w } _ { i } ^ { t } } \log p ( \mathbf { w } _ { i } ^ { t } | \mathcal { D } ) + \sum _ { j = 1 } ^ { n } \nabla _ { \mathbf { w } _ { j } ^ { t } } k ( \mathbf { w } _ { j } ^ { t } , \mathbf { w } _ { i } ^ { t } ) .
96
+ $$
97
+
98
+ It is important to notice that here, the gradients are averaged across all the particles using the kernel matrix. Interestingly, SVGD can be asymptotically interpreted as gradient flow of the KL divergence under a new metric induced by the Stein operator [16, 50] (see Appendix D for more details). Moving the inference from parameter to function space $\pmb { \mathbb { Z } } 6 \|$ leads to the update rule
99
+
100
+ $$
101
+ \phi ( \mathbf { w } _ { i } ^ { t } ) = \left( \frac { \partial f _ { i } ^ { t } } { \partial \mathbf { w } _ { i } ^ { t } } \right) ^ { \top } \left( \frac { 1 } { n } \sum _ { j = 1 } ^ { n } k ( f _ { i } ^ { t } , f _ { j } ^ { t } ) \nabla _ { f _ { j } ^ { t } } \log p ( f _ { j } ^ { t } | \mathcal { D } ) + \nabla _ { f _ { j } ^ { t } } k ( f _ { i } ^ { t } , f _ { j } ^ { t } ) \right) .
102
+ $$
103
+
104
+ This way of averaging gradients using a kernel can be dangerous in high-dimensional settings, where kernel methods often suffer from the curse of dimensionality. Moreover, in Eq. $\textcircled{6}$ , the posterior gradients of the particles are averaged using their similarity in weight space, which can be misleading in multi-modal posteriors. Worse yet, in Eq. $\textcircled{7}$ , the gradients are averaged in function space and are then projected back using exclusively the $i$ -th Jacobian, which can be harmful given that it is not guaranteed that distances between functions evaluated on a subset of their input space resemble their true distance. Our proposed method, on the other hand, does not employ any averaging of the posterior gradients and thus comes closest to the true particle gradients in deep ensembles.
105
+
106
+ # 3 Repulsive deep ensembles are Bayesian
107
+
108
+ So far, we represented the repulsive force as a general function of the gradients of a kernel. In this section, we show how to determine the explicit form of the repulsive term, such that the resulting update rule is equivalent to the discretization of the gradient flow dynamics of the KL divergence in Wasserstein space. We begin by introducing the concepts of particle approximation and gradient flow.
109
+
110
+ # 3.1 Particle approximation
111
+
112
+ A particle-based approximation of a target measure depends on a set of weighted samples $\{ ( \bar { x _ { i } } , w _ { i } ) \} _ { i = 1 } ^ { n }$ , for which an empirical measure can be defined as
113
+
114
+ $$
115
+ \rho ( x ) = \sum _ { i = 1 } ^ { n } w _ { i } \delta ( x - x _ { i } ) ,
116
+ $$
117
+
118
+ where $\delta ( \cdot )$ is the Dirac delta function and the weights $w _ { i }$ satisfy $w _ { i } \in [ 0 , 1 ]$ and $\textstyle \sum _ { i = 1 } ^ { n } w _ { i } = 1$ . To approximate a target distribution $\pi ( x )$ using the empirical measure, the particles and their weights need to be selected in a principled manner that minimizes some measure of distance between $\pi ( x )$ and $\rho ( x )$ (e.g., a set of $N$ samples with weights $w _ { i } = 1 / N$ obtained using an MCMC method).
119
+
120
+ # 3.2 Gradient flow in parameter space
121
+
122
+ Given a smooth function $J : \mathbb { R } ^ { d } \mathbb { R }$ in Euclidean space, we can minimize it by creating a path that follows its negative gradient starting from some initial conditions $x _ { 0 }$ . The curve $x ( t )$ with starting point $x _ { 0 }$ described by that path is called gradient flow. The dynamics and evolution in time of a considered point in the space under this minimization problem can be described as the ODE1
123
+
124
+ $$
125
+ \frac { d \boldsymbol { x } } { d t } = - \boldsymbol { \nabla } J ( \boldsymbol { x } ) .
126
+ $$
127
+
128
+ We can extend this concept to the space of probability distributions (Wasserstein gradient flow) [3]. Let us consider the space of probability measures $\mathcal { P } _ { 2 } ( \mathcal { M } )$ , that is, the set of probability measures with finite second moments defined on the manifold $\mathcal { M }$ :
129
+
130
+ $$
131
+ \mathcal { P } _ { 2 } ( \mathcal { M } ) = \left\{ \varphi : \mathcal { M } \to [ 0 , \infty ) \bigg | \int _ { \mathcal { M } } \mathrm { d } \varphi = 1 , ~ \int _ { \mathcal { M } } | x | ^ { 2 } \varphi ( x ) \mathrm { d } x < + \infty \right\} .
132
+ $$
133
+
134
+ Taking $\Pi ( \mu , \nu )$ as the set of joint probability measures with marginals $\mu , \nu$ , we can define the Wasserstein metric on the space $\mathcal { P } _ { 2 } ( \mathcal { M } )$ as:
135
+
136
+ $$
137
+ W _ { 2 } ^ { 2 } ( \mu , \nu ) = \operatorname* { i n f } _ { \pi \in \Pi ( \mu , \nu ) } \int | x - y | ^ { 2 } { \mathrm { d } } \pi ( x , y ) .
138
+ $$
139
+
140
+ Considering the optimization problem of a functional $J : \mathcal { P } _ { 2 } ( \mathcal { M } ) \mathbb { R }$ , such as the $\mathrm { K L }$ divergence between the particle approximation in Eq. $\textcircled { 8 }$ and the target posterior $\pi ( x )$ ,
141
+
142
+ $$
143
+ \operatorname* { i n f } _ { \rho \in \mathcal { P } _ { 2 } ( \mathcal { M } ) } D _ { K L } ( \rho , \pi ) = \int _ { \mathcal { M } } ( \log \rho ( x ) - \log \pi ( x ) ) \rho ( x ) \mathrm { d } x ,
144
+ $$
145
+
146
+ the evolution in time of the measure $\rho$ under the equivalent of the gradient, the Wasserstein gradient flow, is described by the Liouville equation2 [38, 3, 64]:
147
+
148
+ $$
149
+ \begin{array} { l } { \displaystyle \frac { \partial \rho ( \boldsymbol { x } ) } { \partial t } = \nabla \cdot \left( \rho ( \boldsymbol { x } ) \nabla \frac { \delta } { \delta \rho } D _ { K L } ( \rho , \pi ) \right) } \\ { \displaystyle = \nabla \cdot \left( \rho ( \boldsymbol { x } ) \nabla \big ( \log \rho ( \boldsymbol { x } ) - \log \pi ( \boldsymbol { x } ) \big ) \right) , } \end{array}
150
+ $$
151
+
152
+ where $\nabla _ { \delta \rho } ^ { \delta } D _ { K L } ( \rho , \pi ) \ = : \ \nabla _ { \mathcal { W } _ { 2 } } D _ { K L } ( \rho , \pi )$ is the Wasserstein gradient and the operator $\frac { \delta } { \delta \rho }$ $\mathcal { P } _ { 2 } ( \mathcal { M } ) \stackrel { \cdot } { } \mathbb { R }$ represents the functional derivative or first variation (see Appendix $\boxed { \mathsf { C } }$ for more details). In the particular case of the KL functional, we can recover the Fokker-Planck equation,
153
+
154
+ $$
155
+ \begin{array} { r l r } & { } & { \frac { \partial \rho ( x ) } { \partial t } = \nabla \cdot \left( \rho ( x ) \nabla ( \log \rho ( x ) - \log \pi ( x ) ) \right) } \\ & { } & { = - \nabla \cdot \left( \rho ( x ) \nabla \log \pi ( x ) \right) + \nabla ^ { 2 } \rho ( x ) , } \end{array}
156
+ $$
157
+
158
+ that admits as unique stationary distribution the posterior $\pi ( x )$ . The deterministic particle dynamics ODE $\left[ \left[ 2 \right] \right]$ related to Eq. $\mathbb { ( 1 1 ) }$ , namely mean-field Wasserstein dynamics, is then given by:
159
+
160
+ $$
161
+ \frac { d x } { d t } = - \nabla \big ( \log \rho ( x ) - \log \pi ( x ) \big ) .
162
+ $$
163
+
164
+ Considering a discretization of Eq. (12) for a particle system $\{ x \} _ { i = 1 } ^ { n }$ and small stepsize $\epsilon _ { t }$ , we can rewrite Eq. $\mathbb { \underline { { ( 1 2 ) } } }$ as:
165
+
166
+ $$
167
+ x _ { i } ^ { t + 1 } = x _ { i } ^ { t } + \epsilon _ { t } \bigl ( \nabla \log \pi ( x _ { i } ^ { t } ) - \nabla \log \rho ( x _ { i } ^ { t } ) \bigr ) .
168
+ $$
169
+
170
+ Unfortunately, we do not have access to the analytical form of the gradient $\nabla \log \rho$ , so an approximation is needed. At this point, it is crucial to observe the similarity between the discretization of the Wasserstein gradient flow in Eq. $\textcircled { 1 3 }$ and the repulsive update in Eq. $( 3 )$ to notice how, if the kernelized repulsion is an approximation of the gradient of the empirical particle measure, the update rule minimizes the KL divergence between the particle measure and the target posterior. Different sample-based approximations of the gradient that use a kernel function have been recently studied. The simplest one is given by the kernel density estimation (KDE) (details in Appendix $\dot { \mathrm { ~ E ~ } } )$ $\begin{array} { r } { \tilde { \rho } _ { t } ( x ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \dot { k } ( x , x _ { t } ^ { i } ) } \end{array}$ , where $\boldsymbol { k } ( \cdot , \cdot ) : \mathbb { R } ^ { d } \times \mathbb { R } ^ { d } \dot { \mathbb { R } }$ and the gradient of its log density is given by $\mathbb { \ m }$ :
171
+
172
+ $$
173
+ \nabla \log \rho ( x _ { i } ^ { t } ) \approx \frac { \sum _ { j = 1 } ^ { n } \nabla _ { x _ { i } ^ { t } } k ( x _ { i } ^ { t } , x _ { j } ^ { t } ) } { \sum _ { j = 1 } ^ { n } k ( x _ { i } ^ { t } , x _ { j } ^ { t } ) } .
174
+ $$
175
+
176
+ Using this approximation in Eq. $( 1 3 )$ we obtain:
177
+
178
+ $$
179
+ x _ { i } ^ { t + 1 } = x _ { i } ^ { t } + \epsilon _ { t } \Bigg ( \nabla \log \pi ( x _ { i } ^ { t } ) - \frac { \sum _ { j = 1 } ^ { n } \nabla _ { x _ { i } ^ { t } } k ( x _ { i } ^ { t } , x _ { j } ^ { t } ) } { \sum _ { j = 1 } ^ { n } k ( x _ { i } ^ { t } , x _ { j } ^ { t } ) } \Bigg ) ,
180
+ $$
181
+
182
+ where, if we substitute the posterior for $\pi$ , we obtain an expression for the repulsive force in Eq. $\textcircled{3}$ . This shows that if the repulsive term in Eq. $( 3 )$ is the normalized sum of the gradients $\mathcal { R } =$ $\begin{array} { r } { \left( \bar { \sum _ { j = 1 } ^ { n } } k ( \mathbf { w } _ { i } ^ { t } , \mathbf { w } _ { j } ^ { t } ) \right) ^ { - 1 } \sum _ { j = 1 } ^ { n } \nabla _ { \mathbf { w } _ { i } ^ { t } } k ( \mathbf { w } _ { i } ^ { t } , \mathbf { w } _ { j } ^ { t } ) } \end{array}$ , we do not only encourage diversity of the ensemble members and thus avoid collapse, but surprisingly—in the asymptotic limit of , where the KDE approximation is exact $\left[ \left[ 6 6 \right] \right]$ —also converge to the true Bayesian posterior!
183
+
184
+ Nevertheless, approximating the gradient of the empirical measure with the KDE can lead to suboptimal performance, as already studied by Li and Turner $[ \overline { { | 4 6 | } }$ . They instead introduced a new Stein gradient estimator (SGE) that offers better performance, while maintaining the same computational cost. Even more recently, Shi et al. $\mathbb { \left. \boldsymbol { \mathfrak { G } } \boldsymbol { \mathfrak { A } } \right. }$ introduced a spectral method for gradient estimation (SSGE), that also allows for a simple estimation on out-of-sample points. These two estimators can be used in Eq. $\textcircled { 1 3 }$ , to formulate the following update rules with two alternative repulsive forces. The one using the Stein estimator, that we will call SGE-WGD, is:
185
+
186
+ $$
187
+ x _ { i } ^ { t + 1 } = x _ { i } ^ { t } + \epsilon _ { t } \bigg ( \nabla \log \pi ( x _ { i } ^ { t } ) + \sum _ { j = 1 } ^ { n } ( K + \eta \mathbb { I } ) _ { i j } ^ { - 1 } \sum _ { k = 1 } ^ { n } \nabla _ { x _ { k } ^ { t } } k ( x _ { k } ^ { t } , x _ { j } ^ { t } ) \bigg ) ,
188
+ $$
189
+
190
+ where $K$ is the kernel Gram matrix, $\eta$ a small constant, and I the identity matrix. We can notice an important difference between KDE and SGE, in that the former is only considering the interaction of the $i$ -th particle being updated with all the others, while the latter is simultaneously considering also the interactions between the remaining particles. The spectral method, that we will call SSGE-WGD, leads to the following update rule:
191
+
192
+ $$
193
+ x _ { t + 1 } ^ { i } = x _ { t } ^ { i } + \epsilon _ { t } \bigg ( \nabla \log \pi ( x _ { t } ^ { i } ) + \sum _ { j = 1 } ^ { J } \frac { 1 } { \lambda _ { j } ^ { 2 } } \sum _ { m = 1 } ^ { n } \sum _ { k = 1 } ^ { n } u _ { j k } \nabla _ { x _ { m } } k ( x _ { m } ^ { t } , x _ { k } ^ { t } ) \cdot \sum _ { l = 1 } ^ { n } u _ { j l } k ( x _ { i } ^ { t } , x _ { l } ^ { t } ) \bigg )
194
+ $$
195
+
196
+ where $\lambda _ { j }$ is the $j$ -th eigenvalue of the kernel matrix and $u _ { j k }$ is the $k$ -th component of the $j$ -th eigenvector. Computationally, both SSGE and SGE have a cost of $\mathcal { O } ( M ^ { 3 } + M ^ { 2 } d )$ , with $M$ being the number of points and $d$ their dimensionality. SSGE has an additional cost for predictions of $\mathcal { O } ( M ( d + J ) )$ , where $J$ is the number of eigenvalues.
197
+
198
+ ![](images/909c60e208223cd54336af828c72fc5777f5cbee78dd1b5dffc27345c64eca36.jpg)
199
+ Figure 2: Single Gaussian. We show samples from SVGD, KDE-WGD, SGE-WGD, and SSGEWGD (from left to right). The upper and right plots show the empirical one-dimensional marginal distributions obtained using KDE on the samples (red) and on the particles (blue).
200
+
201
+ # 3.3 Gradient flow in function space
202
+
203
+ To theoretically justify the update rule introduced in function space in Eq. $\textcircled{5}$ , we can rewrite the Liouville equation for the gradient flow in Eq. $\textcircled { 1 1 }$ in function space as
204
+
205
+ $$
206
+ \begin{array} { l } { \displaystyle \frac { \partial \rho ( { \pmb f } ) } { \partial t } = \nabla \cdot \left( \rho ( { \pmb f } ) \nabla \frac { \delta } { \delta \rho } D _ { K L } ( \rho , \pi ) \right) } \\ { \displaystyle = \nabla \cdot \left( \rho ( { \pmb f } ) \nabla \big ( \log \rho ( { \pmb f } ) - \log \pi ( { \pmb f } ) \big ) \right) . } \end{array}
207
+ $$
208
+
209
+ Following this update, the mean field functional dynamics are
210
+
211
+ $$
212
+ \frac { d \pmb f } { d t } = - \nabla \big ( \log \rho ( \pmb f ) - \log \pi ( \pmb f ) \big ) .
213
+ $$
214
+
215
+ Using the same KDE approximation as above, we can obtain a discretized evolution in function space and with it an explicit form for the repulsive force in Eq. $\textcircled{4}$ as
216
+
217
+ $$
218
+ \pmb { f } _ { t + 1 } ^ { i } = \pmb { f } _ { t } ^ { i } + \epsilon _ { t } \bigg ( \nabla _ { \pmb { f } } \log \pi ( \pmb { f } _ { t } ^ { i } ) - \frac { \sum _ { j = 1 } ^ { n } \nabla _ { \pmb { f } _ { i } ^ { t } } k ( \pmb { f } _ { i } ^ { t } , \pmb { f } _ { j } ^ { t } ) } { \sum _ { j = 1 } ^ { n } k ( \pmb { f } _ { i } ^ { t } , \pmb { f } _ { j } ^ { t } ) } \bigg ) .
219
+ $$
220
+
221
+ The update rules using the SGE and SSGE approximations follow as for the parametric case. It is important to notice that this update rule requires the function space prior gradient: $\nabla _ { f _ { j } } \log { p ( f _ { j } | x , y ) } =$ $\nabla _ { f _ { j } } \log p ( \pmb { y } | \pmb { x } , \pmb { f _ { j } } ) + \nabla _ { f _ { j } } \log p ( \pmb { f _ { j } } )$ . If one wants to use an implicit prior defined in weight space, an additional estimator is needed due to its analytical intractability. We again adopted the SSGE, introduced by Shi et al. $\mathbb { \lVert \boldsymbol { 6 9 } \rVert }$ , which was already used for a similar purpose in Sun et al. $\pmb { \mathbb { Z } 1 }$ . It is also interesting to note that the update rule in Eq. $\textcircled { 1 2 0 }$ readily allows for the use of alternative priors that have an analytical form, such as Gaussian processes. This is an important feature of our method that allows for an explicit encoding of function space properties that can be useful for example in achieving better out of distribution detection capabilities $\checkmark$ .
222
+
223
+ # 3.4 The choice of the kernel
224
+
225
+ A repulsive effect can always be created in the ensemble by means of the gradient of any kernel function that is measuring the similarity between two members. Nevertheless, it is important to keep in mind that to ensure the asymptotic convergence to the Bayesian posterior, the repulsive component must be a consistent estimator of the gradient in Eq. $( 1 3 )$ , as shown in Section $\checkmark$ . Therefore, some important constraints over the kernel choice are needed. In particular, the SGE and SSGE need a kernel function belonging to the Stein class (see Shi et al. $\dot { \overline { { \vert 6 9 \vert } } }$ for more details). On the other hand, for the KDE, any symmetric probability density function can be used. On this subject, the work of Aggarwal et al. [1] has shown how the Manhattan distance metric (L1 norm) might be preferable over the Euclidean distance metric (L2 norm) for high-dimensional settings. We performed some additional experiments using the L1 norm (Laplace kernel) for the KDE but we could not observe any substantial difference compared to using the L2 norm. Further investigations regarding this hypothesis are left for future research.
226
+
227
+ ![](images/094ed7ba5611118de5688c3ddd1545168ced55dff3ababfdac0ee5e88615b714.jpg)
228
+ Figure 3: BNN 2D classification. We show the entropy of the predictive posteriors. Again, the function-space methods capture the uncertainty better than the weight-space ones, thus approaching the gold-standard HMC posterior.
229
+
230
+ # 4 Experiments
231
+
232
+ In this section, we compare the different proposed WGD methods with deep ensembles and SVGD on synthetic sampling, regression, and classification tasks and real-world image classification tasks. We use an RBF kernel (except where otherwise specified) with the popular median heuristic $\mathbb { \left[ \left[ 5 1 \right] \right] }$ to choose the kernel bandwidth. In our experiments, an adaptive bandwidth leads to better performance than fixing and tuning a single constant value for the entire evolution of the particles. We also quantitatively assess the uncertainty estimation of the methods in terms of calibration and OOD detection. In our experiments, we report the test accuracy, negative log-likelihood (NLL), and the expected calibration error (ECE) [58]. To assert the robustness on out-of-distribution (OOD) data, we report the ratio between predictive entropy on OOD and test data points $( H _ { o } / H _ { t } )$ , and the OOD detection area under the ROC curve AUROC(H) $\mathbb { H }$ . Moreover, to assess the diversity of the ensemble generated by the different methods in function space, we measure the functional diversity using the model disagreement (MD) (details in Appendix $\bar { \bigtriangledown } \bar { \bigtriangledown }$ . In particular, we report the ratio between the average model disagreement on the OOD and test data points $( M D _ { o } / M D _ { t } )$ and additionally the OOD detection AUROC(MD) computed using this measure instead of the entropy.
233
+
234
+ Sampling from synthetic distributions As a sanity check, we first assessed the ability of our different approximations for Wasserstein gradient descent (using KDE, SGE, and SSGE) to sample from a two-dimensional Gaussian distribution (Figure $^ { 2 ) }$ . We see that our SGE-WGD, SSGE-WGD and the SVGD fit the target almost perfectly. We also tested the different methods in a more complex two-dimensional Funnel distribution $\mathbb { \left[ \left[ 5 9 \right] \right] }$ and present the results in Figure $\mathrm { F . l }$ in the Appendix. There, SGE-WGD and SVGD also perform best.
235
+
236
+ BNN 1D regression We then assessed the different methods in fitting a BNN posterior on a synthetically generated one-dimensional regression task. The results are reported in Figure 1 consisting of the mean prediction and $\pm 1 , 2 , 3$ standard deviations of the predictive distribution. We can see that all methods performing inference in the weight space (DE, w-SVGD, WGD) are unable to capture the epistemic uncertainty between the two clusters of training data points. Conversely, the functional methods (f-SVGD, fWGD) are perfectly able to infer the diversity of the hypotheses in this region due to the lack of training evidence. They thereby achieve a predictive posterior that very closely resembles the one obtained with the gold-standard HMC sampling.
237
+
238
+ BNN 2D classification Next, we investigated the predictive performance and quality of uncertainty estimation of the methods in a two-dimensional synthetic classification setting. The results are displayed in Figure $\textcircled { 3 }$ We can clearly observe that the weight-space methods are overconfident and do not capture the uncertainty well. Moreover, all the functions seems to collapse to the optimal classifier. These methods thus only account for uncertainty close to the decision boundaries and to the origin region, for which the uncertainty is purely aleatoric. In this setting, f-SVGD suffers from similar issues as the weight space methods, being overconfident away from the training data. Conversely, our fWGD methods are confident (low entropy) around the data but not out-of-distribution, thus representing the epistemic uncertainty better. This suggests that the functional diversity captured by this method naturally leads to a distance-aware uncertainty estimation $\mathbb { H 9 } \mathbb { L O }$ , a property that translates into confident predictions only in the proximity of the training data, allowing for a principled OOD detection.
239
+
240
+ Table 1: BNN image classification. AUROC $\mathbf { ( H ) }$ is the AUROC computed using the entropy whereas AUROC(MD) is computed using the model disagreement. $\mathbf { H _ { o } / H _ { t } }$ is the ratio of the entropies on OOD and test points respectively and $\mathbf { M D _ { o } / M D _ { t } }$ is the ratio for model disagreement. We see that the best accuracy is achieved by our WGD methods, while our fWGD methods yield the best OOD detection and funtional diversity. All our proposed methods improve over standard deep ensembles in terms of accuracy and diversity, highlighting the effect of our repulsion.
241
+
242
+ <table><tr><td rowspan="11">Prroiiiie</td><td></td><td>AUROC(H)</td><td>AUROC(MD)</td><td>Accuracy</td><td>H/Ht</td><td>MD/MDt</td><td>ECE</td><td>NLL</td></tr><tr><td>Deep ensemble 4</td><td>0.958±0.001</td><td>0.975±0.001</td><td>91.122±0.013</td><td>6.257±0.005</td><td>6.394±0.001</td><td>0.012±0.001</td><td>0.129±0.001</td></tr><tr><td>SVGD [51</td><td>0.960±0.001</td><td>0.973±0.001</td><td>91.134±0.024</td><td>6.315±0.019</td><td>6.395±0.018</td><td>0.014±0.001</td><td>0.127±0.001</td></tr><tr><td>f-SVGD [76</td><td>0.956±0.001</td><td>0.975±0.001</td><td>89.884±0.015</td><td>5.652±0.009</td><td>6.531±0.005</td><td>0.013±0.001</td><td>0.150±0.001</td></tr><tr><td>hyper-DE [80]</td><td>0.968±0.001</td><td>0.981±0.001</td><td>91.160±0.007</td><td>6.682±0.065</td><td>7.059±0.152</td><td>0.014±0.001</td><td>0.128±0.001</td></tr><tr><td>kde-WGD (ours)</td><td>0.960±0.001</td><td>0.970±0.001</td><td>91.238±0.019</td><td>6.587±0.019</td><td>6.379±0.018</td><td>0.014±0.001</td><td>0.128±0.001</td></tr><tr><td>sge-WGD (ours)</td><td>0.960±0.001</td><td>0.970±0.001</td><td>91.312±0.016</td><td>6.562±0.007</td><td>6.363±0.009</td><td>0.012±0.001</td><td>0.128±0.001</td></tr><tr><td>ssge-WGD (ours)</td><td>0.968±0.001</td><td>0.979±0.001</td><td>91.198±0.024</td><td>6.522±0.009</td><td>6.610±0.012</td><td>0.012±0.001</td><td>0.130±0.001</td></tr><tr><td>kde-fWGD (ours)</td><td>0.971±0.001</td><td>0.980±0.001</td><td>91.260±0.011</td><td>7.079±0.016</td><td>6.887±0.015</td><td>0.015±0.001</td><td>0.125±0.001</td></tr><tr><td>sge-fWGD (ours)</td><td>0.969±0.001</td><td>0.978±0.001</td><td>91.192±0.013</td><td>7.076±0.004</td><td>6.900±0.005</td><td>0.015±0.001</td><td>0.125±0.001</td></tr><tr><td>ssge-fWGD (ours)</td><td>0.971±0.001</td><td>0.980±0.001</td><td>91.240±0.022</td><td>7.129±0.006</td><td>6.951±0.005</td><td>0.016±0.001</td><td>0.124±0.001</td></tr><tr><td rowspan="11">CITIIIO</td><td>Deep ensemble 42</td><td>0.843±0.004</td><td>0.736±0.005</td><td>85,552±0.076</td><td>2.244±0.006</td><td>1.667±0.008</td><td>0.049±0.001</td><td>0.277±0.001</td></tr><tr><td>SVGD [51</td><td>0.825±0.001</td><td>0.710±0.002</td><td>85.142±0.017</td><td>2.106±0.003</td><td>1.567±0.004</td><td>0.052±0.001</td><td>0.287±0.001</td></tr><tr><td>fSVGD 回</td><td>0.783±0.001</td><td>0.712±0.001</td><td>84.510±0.031</td><td>1.968±0.004</td><td>1.624±0.003</td><td>0.049±0.001</td><td>0.292±0.001</td></tr><tr><td>hyper-DE [80]</td><td>0.789±0.001</td><td>0.743±0.001</td><td>84.743±0.011</td><td>1.951±0.010</td><td>1.690±0.015</td><td>0.046±0.001</td><td>0.288±0.001</td></tr><tr><td>kde-WGD (ours)</td><td>0.838±0.001</td><td>0.735±0.004</td><td>85.904±0.030</td><td>2.205±0.003</td><td>1.661±0.008</td><td>0.053±0.001</td><td>0.276±0.001</td></tr><tr><td>sge-WGD (ours)</td><td>0.837±0.003</td><td>0.725±0.004</td><td>85.792±0.035</td><td>2.214±0.010</td><td>1.634±0.004</td><td>0.051±0.001</td><td>0.275±0.001</td></tr><tr><td>ssge-WGD (ours)</td><td>0.832±0.003</td><td>0.731±0.005</td><td>85.638±0.038</td><td>2.182±0.015</td><td>1.655±0.001</td><td>0.049±0.001</td><td>0.276±0.001</td></tr><tr><td>kde-fWGD (ours)</td><td>0.791±0.002</td><td>0.758±0.002</td><td>84.888±0.030</td><td>1.970±0.004</td><td>1.749±0.005</td><td>0.044±0.001</td><td>0.282±0.001</td></tr><tr><td>sge-fWGD (ours)</td><td>0.795±0.001</td><td>0.754±0.002</td><td>84.766±0.060</td><td>1.984±0.003</td><td>1.729±0.002</td><td>0.047±0.001</td><td>0.288±0.001</td></tr><tr><td>ssge-fWGD (ours)</td><td>0.792±0.002</td><td>0.752±0.002</td><td>84.762±0.034</td><td>1.970±0.006</td><td>1.723±0.005</td><td>0.046±0.001</td><td>0.286±0.001</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
243
+
244
+ FashionMNIST classification Moving on to real-world data, we used an image classification setting using the FashionMNIST dataset $\dot { \left[ \left| 8 3 \right| \right] }$ for training and the MNIST dataset $\bar { \mathbb { E } 3 } \mathbb { I }$ as an out-ofdistribution (OOD) task. The results are reported in Table $^ 1 { } _ { . }$ (top). We can see that all our methods improve upon standard deep ensembles and SVGD, highlighting the effectiveness of our proposed repulsion terms when training neural network ensembles. In particular, the sge-WGD offers the best accuracy, whereas the methods in function space all offer a better OOD detection. This is probably due to the fact that these methods achieve a higher entropy ratio and functional diversity measured via the model disagreement when compared to their weight-space counterparts. Interestingly, they also reach the lowest NLL values. We can also notice how the model disagreement (MD) not only serves its purpose as a metric for the functional heterogeneity of the ensemble but also allows for a better OOD detection in comparison to the entropy. To the best of our knowledge, this insight has not been described before, although it has been used in continual learning $\pmb { \mathbb { B } } \mathbf { \mathbb { 1 } }$ . Interestingly, using this metric, the hyper-deep ensemble $[ \textcircled { 8 0 } ]$ shows OOD detection performance comparable with our repulsive ensemble in function space.
245
+
246
+ CIFAR classification Finally, we use a ResNet32 architecture $\mathbb { \left| \left[ 2 9 \right] \right| }$ on CIFAR-10 [41] with the SVHN dataset $\mathbb { \left[ 6 1 \right] }$ as OOD data. The results are reported in Table 1 (bottom). We can see that in this case, the weight-space methods achieve better performance in accuracy and OOD detection using the entropy than the ones in function space. Nevertheless, all our repulsive ensembles improve functional diversity, accuracy, and OOD detection when compared to standard SVGD, whereas the standard deep ensemble achieves the best OOD detection using the entropy.
247
+
248
+ # 5 Related Work
249
+
250
+ The theoretical and empirical properties of SVGD have been well studied [40, 48, 13] and it can also be seen as a Wasserstein gradient flow of the KL divergence in the Stein geometry [16, 50] (see Appendix D for more details). Interestingly, a gradient flow interpretation is also possible for (stochastic gradient) MCMC-type algorithms $\dot { \left. \overline { { 4 8 } } \right. }$ , which can be unified under a general particle inference framework [10]. Moreover, our Wasserstein gradient descent using the SGE approximation can also be derived using an alternative formulation as a gradient flow with smoothed test functions [48]. A projected version of WGD has been studied in Wang et al. $\mathbb { \left. \overline { { \boldsymbol { \mathscr { Q } } \boldsymbol { \cdot } \boldsymbol { \cdot } } } \right. }$ , which could also be readily applied in our framework. Besides particle methods, Bayesian neural networks $\pm \pm \infty$ have gained popularity recently [79, 22, 19, 36], using modern MCMC [59, 79, 22, 24, 21] and variational inference techniques [5, 72, 17, 34]. On the other hand, ensemble methods have also been extensively studied [42, 18, 82, 23, 80, 32, 85, 78].Moreover, repulsive interactions between the members have also been studied in Wabartha et al. [74]. Moreover, providing Bayesian interpretations for deep ensembles has been previously attempted through the lenses of stationary SGD distributions $[ \sqrt { 5 6 } , \sqrt ] { 8 } ]$ , ensembles of linear models $\dot { \bigtriangledown } 5 7 \big |$ , additional random functions $\boxed { 6 2 } , \boxed { 1 2 } , \boxed { 2 7 }$ , approximate inference $\lVert 8 2 \rVert$ , Stein variational inference [15], and marginal likelihood lower bounds $\bar { \| 5 3 \| }$ , and ensembles have also been shown to provide good approximations to the true BNN posterior in some settings $\left[ \left[ 3 6 \right] \right]$ . Furthermore, variational inference in function space has recently gained attention $\mathbb { \ m }$ and the limitations of the KL divergence have been studied in Burt et al. [7].
251
+
252
+ # 6 Conclusion
253
+
254
+ We have presented a simple and principled way to improve upon standard deep ensemble methods. To this end, we have shown that the introduction of a kernelized repulsion between members of the ensemble not only improves the accuracy of the predictions but—even more importantly—can be seen as Wasserstein gradient descent on the KL divergence, thus transforming the MAP inference of deep ensembles into proper Bayesian inference. Moreover, we have shown that incorporating functional repulsion between ensemble members can improve the quality of the estimated uncertainties on simple synthetic examples and OOD detection on real-world data and can approach the true Bayesian posterior more closely.
255
+
256
+ In future work, it will be interesting to study the impact of the Jacobian in the fWGD update and its implications on the Liouville equation in more detail, also compared to other neural network Jacobian methods, such as neural tangent kernels $\pmb { \Vert 3 7 } \Vert$ and generalized Gauss-Newton approximations $\boldsymbol { \left[ \left[ 3 5 \right] \right] }$ . Moreover, it would be interesting to derive explicit convergence bounds for our proposed method and compare them to the existing bounds for SVGD [40].
257
+
258
+ # Acknowledgments
259
+
260
+ VF would like to acknowledge financial support from the Strategic Focus Area “Personalized Health and Related Technologies” of the ETH Domain through the grant #2017-110 and from the Swiss Data Science Center through a PhD fellowship. We thank Florian Wenzel, Alexander Immer, Andrew Gordon Wilson, Pavel Izmailov, Christian Henning, and Johannes von Oswald for helpful discussions. We also thank Dr. Sheldon Cooper, Dr. Leonard Hofstadter and Penny Hofstadter for their support and inspiration.
261
+
262
+ # References
263
+
264
+ [1] Charu C Aggarwal, Alexander Hinneburg, and Daniel A Keim. On the surprising behavior of distance metrics in high dimensional space. In International conference on database theory, pages 420–434. Springer, 2001.
265
+ [2] Luigi Ambrosio and Gianluca Crippa. Continuity equations and ode flows with non-smooth velocity. Proceedings of the Royal Society of Edinburgh: Section A Mathematics, 144(6): 1191–1244, 2014.
266
+ [3] Luigi Ambrosio, Nicola Gigli, and Giuseppe Savaré. Gradient flows: in metric spaces and in the space of probability measures. Springer Science & Business Media, 2008.
267
+ [4] Vijay Badrinarayanan, Bamdev Mishra, and Roberto Cipolla. Symmetry-invariant optimization in deep networks. arXiv preprint arXiv:1511.01754, 2015.
268
+ [5] Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural networks. arXiv preprint arXiv:1505.05424, 2015.
269
+
270
+ [6] Leo Breiman. Bagging predictors. Machine learning, 24(2):123–140, 1996.
271
+
272
+ [7] David R Burt, Sebastian W Ober, Adrià Garriga-Alonso, and Mark van der Wilk. Understanding variational inference in function-space. arXiv preprint arXiv:2011.09421, 2020.
273
+
274
+ [8] Pratik Chaudhari and Stefano Soatto. Stochastic gradient descent performs variational inference, converges to limit cycles for deep networks. In 2018 Information Theory and Applications Workshop (ITA), pages 1–10. IEEE, 2018.
275
+
276
+ [9] An Mei Chen, Haw-minn Lu, and Robert Hecht-Nielsen. On the geometry of feedforward neural network error surfaces. Neural computation, 5(6):910–927, 1993.
277
+
278
+ [10] Changyou Chen, Ruiyi Zhang, Wenlin Wang, Bai Li, and Liqun Chen. A unified particleoptimization framework for scalable bayesian sampling. arXiv preprint arXiv:1805.11659, 2018.
279
+
280
+ [11] Jiefeng Chen, Xi Wu, Yingyu Liang, Somesh Jha, et al. Robust out-of-distribution detection in neural networks. arXiv preprint arXiv:2003.09711, 2020.
281
+
282
+ [12] Kamil Ciosek, Vincent Fortuin, Ryota Tomioka, Katja Hofmann, and Richard Turner. Conservative uncertainty estimation by fitting prior networks. In International Conference on Learning Representations, 2019.
283
+
284
+ [13] Francesco D’Angelo and Vincent Fortuin. Annealed stein variational gradient descent. arXiv preprint arXiv:2101.09815, 2021.
285
+
286
+ [14] Francesco D’Angelo and Christian Henning. Uncertainty-based out-of-distribution detection requires suitable function space priors. arXiv preprint arXiv:2110.06020, 2021.
287
+
288
+ [15] Francesco D’Angelo, Vincent Fortuin, and Florian Wenzel. On stein variational neural network ensembles. arXiv preprint arXiv:2106.10760, 2021.
289
+
290
+ [16] A Duncan, Nikolas Nuesken, and Lukasz Szpruch. On the geometry of stein variational gradient descent. arXiv preprint arXiv:1912.00894, 2019.
291
+
292
+ [17] Michael W Dusenberry, Ghassen Jerfel, Yeming Wen, Yi-an Ma, Jasper Snoek, Katherine Heller, Balaji Lakshminarayanan, and Dustin Tran. Efficient and scalable bayesian neural nets with rank-1 factors. arXiv preprint arXiv:2005.07186, 2020.
293
+
294
+ [18] Stanislav Fort, Huiyi Hu, and Balaji Lakshminarayanan. Deep ensembles: A loss landscape perspective. arXiv preprint arXiv:1912.02757, 2019.
295
+
296
+ [19] Vincent Fortuin. Priors in bayesian deep learning: A review. arXiv preprint arXiv:2105.06868, 2021.
297
+
298
+ [20] Vincent Fortuin, Mark Collier, Florian Wenzel, James Allingham, Jeremiah Liu, Dustin Tran, Balaji Lakshminarayanan, Jesse Berent, Rodolphe Jenatton, and Effrosyni Kokiopoulou. Deep classifiers with label noise modeling and distance awareness. arXiv preprint arXiv:2110.02609, 2021.
299
+
300
+ [21] Vincent Fortuin, Adrià Garriga-Alonso, Mark van der Wilk, and Laurence Aitchison. Bnnpriors: A library for bayesian neural network inference with different prior distributions. Software Impacts, page 100079, 2021.
301
+
302
+ [22] Vincent Fortuin, Adrià Garriga-Alonso, Florian Wenzel, Gunnar Rätsch, Richard Turner, Mark van der Wilk, and Laurence Aitchison. Bayesian neural network priors revisited. arXiv preprint arXiv:2102.06571, 2021.
303
+
304
+ [23] Timur Garipov, Pavel Izmailov, Dmitrii Podoprikhin, Dmitry Vetrov, and Andrew Gordon Wilson. Loss surfaces, mode connectivity, and fast ensembling of dnns. arXiv preprint arXiv:1802.10026, 2018.
305
+
306
+ [24] Adrià Garriga-Alonso and Vincent Fortuin. Exact langevin dynamics with stochastic gradients. arXiv preprint arXiv:2102.01691, 2021.
307
+
308
+ [25] Mario Geiger, Arthur Jacot, Stefano Spigler, Franck Gabriel, Levent Sagun, Stéphane d’Ascoli, Giulio Biroli, Clément Hongler, and Matthieu Wyart. Scaling description of generalization with number of parameters in deep learning. Journal of Statistical Mechanics: Theory and Experiment, 2020(2):023401, 2020.
309
+ [26] L. K. Hansen and P. Salamon. Neural network ensembles. IEEE Trans. Pattern Anal. Mach. Intell., 12(10):993–1001, October 1990. ISSN 0162-8828. doi: 10.1109/34.58871. URL https://doi.org/10.1109/34.58871.
310
+ [27] Bobby He, Balaji Lakshminarayanan, and Yee Whye Teh. Bayesian deep ensembles via the neural tangent kernel. arXiv preprint arXiv:2007.05864, 2020.
311
+ [28] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pages 1026–1034, 2015.
312
+ [29] 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.
313
+ [30] Robert Hecht-Nielsen. On the algebraic structure of feedforward network weight spaces. In Advanced Neural Computers, pages 129–135. Elsevier, 1990.
314
+ [31] Christian Henning, Maria R Cervera, Francesco D’Angelo, Johannes von Oswald, Regina Traber, Benjamin Ehret, Seijin Kobayashi, João Sacramento, and Benjamin F Grewe. Posterior meta-replay for continual learning. arXiv preprint arXiv:2103.01133, 2021.
315
+ [32] Gao Huang, Yixuan Li, Geoff Pleiss, Zhuang Liu, John E Hopcroft, and Kilian Q Weinberger. Snapshot ensembles: Train 1, get m for free. arXiv preprint arXiv:1704.00109, 2017.
316
+ [33] Gao Huang, Yixuan Li, Geoff Pleiss, Zhuang Liu, John E. Hopcroft, and Kilian Q. Weinberger. Snapshot ensembles: Train 1, get M for free. CoRR, abs/1704.00109, 2017. URL http: //arxiv.org/abs/1704.00109.
317
+ [34] Alexander Immer, Matthias Bauer, Vincent Fortuin, Gunnar Rätsch, and Mohammad Emtiyaz Khan. Scalable marginal likelihood estimation for model selection in deep learning. arXiv preprint arXiv:2104.04975, 2021.
318
+ [35] Alexander Immer, Maciej Korzepa, and Matthias Bauer. Improving predictions of bayesian neural nets via local linearization. In International Conference on Artificial Intelligence and Statistics, pages 703–711. PMLR, 2021.
319
+ [36] Pavel Izmailov, Sharad Vikram, Matthew D Hoffman, and Andrew Gordon Wilson. What are bayesian neural network posteriors really like? arXiv preprint arXiv:2104.14421, 2021.
320
+ [37] Arthur Jacot, Franck Gabriel, and Clément Hongler. Neural tangent kernel: convergence and generalization in neural networks. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, pages 8580–8589, 2018.
321
+ [38] Richard Jordan, David Kinderlehrer, and Felix Otto. The variational formulation of the fokker– planck equation. SIAM journal on mathematical analysis, 29(1):1–17, 1998.
322
+ [39] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
323
+ [40] Anna Korba, Adil Salim, Michael Arbel, Giulia Luise, and Arthur Gretton. A non-asymptotic analysis for stein variational gradient descent. Advances in Neural Information Processing Systems, 33, 2020.
324
+ [41] Alex Krizhevsky et al. Learning multiple layers of features from tiny images. 2009.
325
+ [42] Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In Advances in neural information processing systems, pages 6402–6413, 2017.
326
+ [43] Yann LeCun. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/, 1998.
327
+ [44] 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.
328
+ [45] E. Levin, N. Tishby, and S. A. Solla. A statistical approach to learning and generalization in layered neural networks. Proc. of the IEEE – Special issue on Neural Networks, 1990.
329
+ [46] Yingzhen Li and Richard E Turner. Gradient estimators for implicit models. arXiv preprint arXiv:1705.07107, 2017.
330
+ [47] Shiyu Liang, Yixuan Li, and Rayadurgam Srikant. Enhancing the reliability of out-ofdistribution image detection in neural networks. arXiv preprint arXiv:1706.02690, 2017.
331
+ [48] Chang Liu, Jingwei Zhuo, Pengyu Cheng, Ruiyi Zhang, and Jun Zhu. Understanding and accelerating particle-based variational inference. In International Conference on Machine Learning, pages 4082–4092. PMLR, 2019.
332
+ [49] Jeremiah Zhe Liu, Zi Lin, Shreyas Padhy, Dustin Tran, Tania Bedrax-Weiss, and Balaji Lakshminarayanan. Simple and principled uncertainty estimation with deterministic deep learning via distance awareness. arXiv preprint arXiv:2006.10108, 2020.
333
+ [50] Qiang Liu. Stein variational gradient descent as gradient flow. In Advances in neural information processing systems, pages 3115–3123, 2017.
334
+ [51] Qiang Liu and Dilin Wang. Stein variational gradient descent: A general purpose bayesian inference algorithm. In Advances in neural information processing systems, pages 2378–2386, 2016.
335
+ [52] Qiang Liu, Jason Lee, and Michael Jordan. A kernelized stein discrepancy for goodness-of-fit tests. In International conference on machine learning, pages 276–284. PMLR, 2016.
336
+ [53] Clare Lyle, Lisa Schut, Robin Ru, Yarin Gal, and Mark van der Wilk. A bayesian perspective on training speed and model selection. Advances in Neural Information Processing Systems, 33, 2020.
337
+ [54] David JC MacKay. A practical bayesian framework for backpropagation networks. Neural computation, 4(3):448–472, 1992.
338
+ [55] Andrey Malinin, Bruno Mlodozeniec, and Mark Gales. Ensemble distribution distillation. arXiv preprint arXiv:1905.00076, 2019.
339
+ [56] Stephan Mandt, Matthew D Hoffman, and David M Blei. Stochastic gradient descent as approximate bayesian inference. arXiv preprint arXiv:1704.04289, 2017.
340
+ [57] Alexander G de G Matthews, Jiri Hron, Richard E Turner, and Zoubin Ghahramani. Samplethen-optimize posterior sampling for bayesian linear models. In NeurIPS Workshop on Advances in Approximate Bayesian Inference, 2017.
341
+ [58] Mahdi Pakdaman Naeini, Gregory Cooper, and Milos Hauskrecht. Obtaining well calibrated probabilities using bayesian binning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 29, 2015.
342
+ [59] Radford M Neal. Bayesian learning for neural networks. 1995.
343
+ [60] Radford M Neal. Bayesian learning for neural networks, volume 118. Springer Science & Business Media, 2012.
344
+ [61] Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. 2011.
345
+ [62] Ian Osband, Benjamin Van Roy, Daniel J Russo, Zheng Wen, et al. Deep exploration via randomized value functions. J. Mach. Learn. Res., 20(124):1–62, 2019.
346
+
347
+ [63] Johannes Von Oswald, Seijin Kobayashi, Joao Sacramento, Alexander Meulemans, Christian Henning, and Benjamin F Grewe. Neural networks with late-phase weights. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum? id=C0qJUx5dxFb.
348
+
349
+ [64] Felix Otto. The geometry of dissipative evolution equations: the porous medium equation. 2001.
350
+
351
+ [65] Yaniv Ovadia, Emily Fertig, Jie Ren, Zachary Nado, David Sculley, Sebastian Nowozin, Joshua Dillon, Balaji Lakshminarayanan, and Jasper Snoek. Can you trust your model’s uncertainty? evaluating predictive uncertainty under dataset shift. In Advances in Neural Information Processing Systems, pages 13991–14002, 2019.
352
+
353
+ [66] Emanuel Parzen. On estimation of a probability density function and mode. The annals of mathematical statistics, 33(3):1065–1076, 1962.
354
+
355
+ [67] Alexandre Rame and Matthieu Cord. Dice: Diversity in deep ensembles via conditional redundancy adversarial estimation. arXiv preprint arXiv:2101.05544, 2021.
356
+
357
+ [68] Geoffrey Roeder, Luke Metz, and Diederik P Kingma. On linear identifiability of learned representations. arXiv preprint arXiv:2007.00810, 2020.
358
+
359
+ [69] Jiaxin Shi, Shengyang Sun, and Jun Zhu. A spectral approach to gradient estimation for implicit distributions. In International Conference on Machine Learning, pages 4644–4653. PMLR, 2018.
360
+
361
+ [70] Radhey S Singh. Improvement on some known nonparametric uniformly consistent estimators of derivatives of a density. The Annals of Statistics, pages 394–399, 1977.
362
+
363
+ [71] Shengyang Sun, Guodong Zhang, Jiaxin Shi, and Roger Grosse. Functional variational bayesian neural networks. arXiv preprint arXiv:1903.05779, 2019.
364
+
365
+ [72] Jakub Swiatkowski, Kevin Roth, Bastiaan S Veeling, Linh Tran, Joshua V Dillon, Stephan Mandt, Jasper Snoek, Tim Salimans, Rodolphe Jenatton, and Sebastian Nowozin. The k-tied normal distribution: A compact parameterization of gaussian mean field posteriors in bayesian neural networks. arXiv preprint arXiv:2002.02655, 2020.
366
+
367
+ [73] Johannes von Oswald, Christian Henning, João Sacramento, and Benjamin F. Grewe. Continual learning with hypernetworks. In International Conference on Learning Representations, 2020. URL https://arxiv.org/abs/1906.00695.
368
+
369
+ [74] Maxime Wabartha, Audrey Durand, Vincent François-Lavet, and Joelle Pineau. Handling black swan events in deep learning with diversely extrapolated neural networks. In IJCAI, pages 2140–2147, 2020.
370
+
371
+ [75] Yifei Wang, Peng Chen, and Wuchen Li. Projected wasserstein gradient descent for highdimensional bayesian inference. arXiv preprint arXiv:2102.06350, 2021.
372
+
373
+ [76] Ziyu Wang, Tongzheng Ren, Jun Zhu, and Bo Zhang. Function space particle optimization for bayesian neural networks. arXiv preprint arXiv:1902.09754, 2019.
374
+
375
+ [77] 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), pages 681–688, 2011.
376
+
377
+ [78] Yeming Wen, Dustin Tran, and Jimmy Ba. Batchensemble: an alternative approach to efficient ensemble and lifelong learning. arXiv preprint arXiv:2002.06715, 2020.
378
+
379
+ [79] Florian Wenzel, Kevin Roth, Bastiaan S Veeling, Jakub Swiatkowski, Linh Tran, Stephan Mandt, ´ Jasper Snoek, Tim Salimans, Rodolphe Jenatton, and Sebastian Nowozin. How good is the bayes posterior in deep neural networks really? arXiv preprint arXiv:2002.02405, 2020.
380
+
381
+ [80] Florian Wenzel, Jasper Snoek, Dustin Tran, and Rodolphe Jenatton. Hyperparameter ensembles for robustness and uncertainty quantification. In Advances in Neural Information Processing Systems, 2020.
382
+
383
+ [81] Christopher KI Williams. Computation with infinite neural networks. Neural Computation, 10 (5):1203–1216, 1998.
384
+ [82] Andrew Gordon Wilson and Pavel Izmailov. Bayesian deep learning and a probabilistic perspective of generalization. arXiv preprint arXiv:2002.08791, 2020.
385
+ [83] Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017.
386
+ [84] Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint arXiv:1611.03530, 2016.
387
+ [85] Ruqi Zhang, Chunyuan Li, Jianyi Zhang, Changyou Chen, and Andrew Gordon Wilson. Cyclical stochastic gradient mcmc for bayesian deep learning. arXiv preprint arXiv:1902.03932, 2019.
parse/train/LAKplpLMbP8/LAKplpLMbP8_content_list.json ADDED
@@ -0,0 +1,1690 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Repulsive Deep Ensembles are Bayesian ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 254,
8
+ 122,
9
+ 743,
10
+ 147
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Francesco D’Angelo ETH Zürich Zürich, Switzerland dngfra@gmail.com ",
17
+ "bbox": [
18
+ 285,
19
+ 200,
20
+ 429,
21
+ 257
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Vincent Fortuin \nETH Zürich \nZürich, Switzerland \nfortuin@inf.ethz.ch ",
28
+ "bbox": [
29
+ 547,
30
+ 202,
31
+ 712,
32
+ 256
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "Abstract ",
39
+ "text_level": 1,
40
+ "bbox": [
41
+ 462,
42
+ 292,
43
+ 535,
44
+ 308
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "Deep ensembles have recently gained popularity in the deep learning community for their conceptual simplicity and efficiency. However, maintaining functional diversity between ensemble members that are independently trained with gradient descent is challenging. This can lead to pathologies when adding more ensemble members, such as a saturation of the ensemble performance, which converges to the performance of a single model. Moreover, this does not only affect the quality of its predictions, but even more so the uncertainty estimates of the ensemble, and thus its performance on out-of-distribution data. We hypothesize that this limitation can be overcome by discouraging different ensemble members from collapsing to the same function. To this end, we introduce a kernelized repulsive term in the update rule of the deep ensembles. We show that this simple modification not only enforces and maintains diversity among the members but, even more importantly, transforms the maximum a posteriori inference into proper Bayesian inference. Namely, we show that the training dynamics of our proposed repulsive ensembles follow a Wasserstein gradient flow of the KL divergence to the true posterior. We study repulsive terms in weight and function space and empirically compare their performance to standard ensembles and Bayesian baselines on synthetic and real-world prediction tasks. ",
51
+ "bbox": [
52
+ 233,
53
+ 325,
54
+ 766,
55
+ 573
56
+ ],
57
+ "page_idx": 0
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "1 Introduction ",
62
+ "text_level": 1,
63
+ "bbox": [
64
+ 174,
65
+ 599,
66
+ 310,
67
+ 616
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "There have been many recent advances on the theoretical properties of sampling algorithms for approximate Bayesian inference, which changed our interpretation and understanding of them. Particularly worth mentioning is the work of Jordan et al. [38], who reinterpret Markov Chain Monte Carlo (MCMC) as a gradient flow of the KL divergence over the Wasserstein space of probability measures. This new formulation allowed for a deeper understanding of approximate inference methods but also inspired the inception of new and more efficient inference strategies. Following this direction, Liu and Wang $\\pmb { \\mathbb { B } } \\mathbf { \\mathbb { 1 } }$ recently proposed the Stein Variational Gradient Descent (SVGD) method to perform approximate Wasserstein gradient descent. Conceptually, this method, which belongs to the family of particle-optimization variational inference (POVI), introduces a repulsive force through a kernel acting in the parameter space to evolve a set of samples towards high-density regions of the target distribution without collapsing to a point estimate. ",
74
+ "bbox": [
75
+ 174,
76
+ 631,
77
+ 825,
78
+ 784
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "Another method which has achieved great success recently are ensembles of neural networks (socalled deep ensembles), which work well both in terms of predictive performance $\\pm 2 \\sqrt { 8 0 }$ as well as uncertainty estimation $\\begin{array} { r l } { { \\| 6 5 \\| } } \\end{array}$ , and have also been proposed as a way to perform approximate inference in Bayesian neural networks [82, 36]. That being said, while they might allow for the averaging of predictions over several hypotheses, they do not offer any guarantees for the diversity between those hypotheses nor do they provably converge to the true Bayesian posterior under any meaningful limit. In this work, we show how the introduction of a repulsive term between the members in the ensemble, inspired by SVGD, not only naïvely guarantees the diversity among the members, avoiding their collapse in parameter space, but also allows for a reformulation of the method as a gradient flow of the KL divergence in the Wasserstein space of distributions. It thus allows to endow deep ensembles with convergence guarantees to the true Bayesian posterior. ",
85
+ "bbox": [
86
+ 174,
87
+ 790,
88
+ 825,
89
+ 900
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "image",
95
+ "img_path": "images/c87b35667fe31cb24e44c323fe8bffeb4df13996d7df41a00bfd504161843062.jpg",
96
+ "image_caption": [
97
+ "Figure 1: BNN 1D regression. The function-space methods (SVGD and WGD) approach the HMC posterior more closely, while the standard deep ensembles and weight-space methods fail to properly account for the uncertainty, especially the in-between uncertainty. "
98
+ ],
99
+ "image_footnote": [],
100
+ "bbox": [
101
+ 196,
102
+ 85,
103
+ 805,
104
+ 251
105
+ ],
106
+ "page_idx": 1
107
+ },
108
+ {
109
+ "type": "text",
110
+ "text": "",
111
+ "bbox": [
112
+ 176,
113
+ 327,
114
+ 821,
115
+ 369
116
+ ],
117
+ "page_idx": 1
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "An additional problem is that BNN inference in weight space can lead to degenerate solutions, due to the overparametrization of these models. That is, several samples could have very different weights but map to the same function, thus giving a false sense of diversity in the ensemble. This property, that we will refer to as non-identifiability of neural networks (see Appendix $\\boxed { \\mathrm { A } }$ , can lead to redundancies in the posterior distribution. It implies that methods like MCMC sampling, deep ensembles, and SVGD waste computation in local modes that account for equivalent functions. Predictive distributions approximated using samples from these modes do not improve over a simple point estimate and lead to a poor uncertainty estimation. Following this idea, Wang et al. $\\mathbb { \\left[ \\left] \\right. \\right]} 2 $ introduced a new method to extend POVI methods to function space, overcoming this limitation. Here, we also study an update rule that allows for an approximation of the gradient flow of the KL divergence in function space in our proposed repulsive ensembles. ",
122
+ "bbox": [
123
+ 173,
124
+ 375,
125
+ 825,
126
+ 527
127
+ ],
128
+ "page_idx": 1
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "We make the following contributions: ",
133
+ "bbox": [
134
+ 176,
135
+ 534,
136
+ 421,
137
+ 549
138
+ ],
139
+ "page_idx": 1
140
+ },
141
+ {
142
+ "type": "text",
143
+ "text": "• We derive several different repulsion terms that can be added as regularizers to the gradient updates of deep ensembles to endow them with Bayesian convergence properties. \n• We show that these terms approximate Wasserstein gradient flows of the KL divergence and can be used both in weight space and function space. \n• We compare these proposed methods theoretically to standard deep ensembles and SVGD and highlight their different guarantees. \n• We assess all these methods on synthetic and real-world deep learning tasks and show that our proposed repulsive ensembles can achieve competitive performance and improved uncertainty estimation. ",
144
+ "bbox": [
145
+ 217,
146
+ 560,
147
+ 825,
148
+ 705
149
+ ],
150
+ "page_idx": 1
151
+ },
152
+ {
153
+ "type": "text",
154
+ "text": "2 Repulsive Deep Ensembles ",
155
+ "text_level": 1,
156
+ "bbox": [
157
+ 174,
158
+ 732,
159
+ 428,
160
+ 750
161
+ ],
162
+ "page_idx": 1
163
+ },
164
+ {
165
+ "type": "text",
166
+ "text": "In supervised deep learning, we typically consider a likelihood function $p ( \\pmb { y } | f ( \\pmb { x } ; \\mathbf { w } ) )$ (e.g., Gaussian for regression or Categorical for classification) parameterized by a neural network $f ( \\pmb { x } ; \\mathbf { w } )$ and training data $\\textit { D } = \\{ ( \\boldsymbol { \\mathbf { { x } } } _ { i } , \\boldsymbol { \\mathbf { { y } } } _ { i } ) \\} _ { i = 1 } ^ { n }$ with $\\textbf { \\textit { x } } \\in \\textbf { \\textit { X } }$ and $\\textbf { \\textit { y } } \\in \\textbf { \\textit { y } }$ . In Bayesian neural networks (BNNs), we are interested in the posterior distribution of all likely networks given by $\\begin{array} { r } { p ( \\mathbf { w } | \\mathcal { D } ) \\propto \\prod _ { i = 1 } ^ { n } p ( \\pmb { y } _ { i } | f ( \\pmb { x } _ { i } ; \\mathbf { w } ) ) p ( \\mathbf { w } ) } \\end{array}$ , where $p ( \\mathbf { w } )$ is the prior distribution over weights. Crucially, when making a prediction on a test point $\\mathbf { \\boldsymbol { x } } ^ { * }$ , in the Bayesian approach we do not only use a single parameter $\\widehat { \\bf w }$ to predict ${ \\pmb y } ^ { * } = f ( { \\pmb x } ^ { * } ; \\widehat { \\mathbf { w } } )$ , but we marginalize over the whole posterior, thus taking all possible explanations of the data into account: ",
167
+ "bbox": [
168
+ 173,
169
+ 763,
170
+ 826,
171
+ 876
172
+ ],
173
+ "page_idx": 1
174
+ },
175
+ {
176
+ "type": "equation",
177
+ "img_path": "images/ea58bf85c2893e1394390263ae7f97e3c6d3270c2715a883b91057d7c53c61ba.jpg",
178
+ "text": "$$\np ( \\pmb { y } ^ { * } | \\pmb { x } ^ { * } , \\mathcal { D } ) = \\int p ( \\pmb { y } ^ { * } | f ( \\pmb { x } ^ { * } ; \\mathbf { w } ) ) p ( \\mathbf { w } | \\mathcal { D } ) \\mathrm { d } \\mathbf { w }\n$$",
179
+ "text_format": "latex",
180
+ "bbox": [
181
+ 343,
182
+ 883,
183
+ 653,
184
+ 916
185
+ ],
186
+ "page_idx": 1
187
+ },
188
+ {
189
+ "type": "text",
190
+ "text": "While approximating the posterior of Bayesian neural networks (or sampling from it) is a challenging task, performing maximum a posteriori (MAP) estimation, which corresponds to finding the mode of the posterior, is usually simple. Ensembles of neural networks use the non-convexity of the MAP optimization problem to create a collection of $K$ independent—and possibly different— solutions. Considering $n$ weight configurations of a neural network $\\{ { \\bf w } _ { i } \\} _ { i = 1 } ^ { n }$ with ${ \\bf w } _ { i } \\in \\mathbb { R } ^ { d }$ , the dynamics of the ensemble under the gradient of the posterior lead to the following update rule at iteration $t$ : ",
191
+ "bbox": [
192
+ 173,
193
+ 90,
194
+ 826,
195
+ 175
196
+ ],
197
+ "page_idx": 2
198
+ },
199
+ {
200
+ "type": "equation",
201
+ "img_path": "images/dec175f126457d7570141af68aa834ee6aa688fa0490be6f7e2b319f4c374697.jpg",
202
+ "text": "$$\n\\begin{array} { r l } & { \\mathbf { w } _ { i } ^ { t + 1 } \\mathbf { w } _ { i } ^ { t } + \\epsilon _ { t } \\phi ( \\mathbf { w } _ { i } ^ { t } ) } \\\\ { \\mathrm { w i t h } \\quad } & { \\phi ( \\mathbf { w } _ { i } ^ { t } ) = \\nabla _ { \\mathbf { w } _ { i } ^ { t } } \\log p ( \\mathbf { w } _ { i } ^ { t } | \\mathcal { D } ) , } \\end{array}\n$$",
203
+ "text_format": "latex",
204
+ "bbox": [
205
+ 372,
206
+ 179,
207
+ 625,
208
+ 223
209
+ ],
210
+ "page_idx": 2
211
+ },
212
+ {
213
+ "type": "text",
214
+ "text": "with step size $\\epsilon _ { t }$ . Ensemble methods have a long history [e.g., 45, 26, 6] and were recently revisited for neural networks $\\pm 2 \\|$ and coined deep ensembles. The predictions of the different members are combined to create a predictive distribution by using the solutions to compute the Bayesian model average (BMA) in Eq. $\\mathbb { D }$ . Recent works $\\mathbb { \\lVert \\rVert }$ have shown that deep ensembles can outperform some of the Bayesian approaches for uncertainty estimation. Even more recently, Wilson and Izmailov $\\pmb { \\Vert 8 2 \\Vert }$ argued that deep ensembles can be considered a compelling approach to Bayesian model averaging. Despite these ideas, the ability of deep ensembles to efficiently average over multiple hypotheses and to explore the functional landscape of the posterior distribution studied in $[ \\overline { { 1 8 } } ]$ does not guarantee sampling from the right distribution. Indeed, the additional Langevin noise introduced in $\\mathbb { [ \\breve { ] { ] \\mathrm { ~ Z ~ Z ~ } ] } } }$ , which is not considered in deep ensembles, is crucial to ensure samples from the true Bayesian posterior. ",
215
+ "bbox": [
216
+ 173,
217
+ 224,
218
+ 825,
219
+ 364
220
+ ],
221
+ "page_idx": 2
222
+ },
223
+ {
224
+ "type": "text",
225
+ "text": "From a practical standpoint, since the quality of an ensemble hinges on the diversity of its members, many methods were recently proposed to improve this diversity without compromising the individual accuracy. For instance, Wenzel et al. [80] propose hyper-deep ensembles that combine deep networks with different hyperparameters. Similarly, cyclical learning-rate schedules can explore several local minima for the ensemble members $\\pmb { \\mathbb { B 3 } }$ . Alternatively, Rame and Cord $ { \\mathbb { I } } { \\mathbb { I } }$ proposed an informationtheoretic framework to avoid redundancy in the members and Oswald et al. $\\overline { { \\| 6 3 \\| } }$ studied possible interactions between members based on weight sharing. However, the absence of a constraint that prevents particles from converging to the same mode limits the possibility of improvement by introducing more ensemble members. This means that any hopes to converge to different modes must exclusively rely on: ",
226
+ "bbox": [
227
+ 174,
228
+ 371,
229
+ 826,
230
+ 510
231
+ ],
232
+ "page_idx": 2
233
+ },
234
+ {
235
+ "type": "text",
236
+ "text": "1. the randomness of the initialization \n2. the noise in the estimation of the gradients due to minibatching \n3. the number of local optima that might be reached during gradient descent. ",
237
+ "bbox": [
238
+ 210,
239
+ 520,
240
+ 717,
241
+ 573
242
+ ],
243
+ "page_idx": 2
244
+ },
245
+ {
246
+ "type": "text",
247
+ "text": "Moreover, the recent study of Geiger et al. $\\pmb { \\left. \\pmb { \\left. \\bar { 2 5 } \\right. } \\right. }$ showed how the empirical test error of the ensemble converges to the one of a single trained model when the number of parameters goes to infinity, leading to deterioration of the performance. In other words, the bigger the model, the harder it is to maintain diversity in the ensemble and avoid collapse to the same solution. This is intuitively due to the fact that bigger models are less sensitive to the initialization. Namely, in order for them to get stuck in a local minimum, they must have second derivatives that are positive simultaneously in all directions. As the number of hidden units gets larger, this becomes less likely. ",
248
+ "bbox": [
249
+ 174,
250
+ 582,
251
+ 826,
252
+ 680
253
+ ],
254
+ "page_idx": 2
255
+ },
256
+ {
257
+ "type": "text",
258
+ "text": "2.1 Repulsive force in weight space ",
259
+ "text_level": 1,
260
+ "bbox": [
261
+ 176,
262
+ 695,
263
+ 429,
264
+ 712
265
+ ],
266
+ "page_idx": 2
267
+ },
268
+ {
269
+ "type": "text",
270
+ "text": "To overcome the aforementioned limitations of standard deep ensembles, we introduce, inspired by SVGD $\\mathbb { \\left[ \\left[ 5 1 \\right] \\right] }$ , a deep ensemble with members that interact with each other through a repulsive component. Using a kernel function to model this interaction, the single models repel each other based on their position in the weight space, so that two members can never assume the same weights. Considering a stationary kernel $\\bar { k } ( \\cdot , \\cdot ) : \\mathbb { R } ^ { d } \\times \\mathbb { R } ^ { d } \\to \\mathbb { R }$ acting in the parameter space of the neural network, a repulsive term $\\mathcal { R }$ can be parameterized through its gradient: ",
271
+ "bbox": [
272
+ 173,
273
+ 720,
274
+ 826,
275
+ 805
276
+ ],
277
+ "page_idx": 2
278
+ },
279
+ {
280
+ "type": "equation",
281
+ "img_path": "images/52631e0ed6e1a61e9e013d38c7585cc4709cd85b719f28114ba1570f9f671c2a.jpg",
282
+ "text": "$$\n\\phi ( \\mathbf { w } _ { i } ^ { t } ) = \\nabla _ { \\mathbf { w } _ { i } ^ { t } } \\log p ( \\mathbf { w } _ { i } ^ { t } | \\mathcal { D } ) - \\mathcal { R } \\left( \\left\\{ \\nabla _ { \\mathbf { w } _ { i } ^ { t } } k ( \\mathbf { w } _ { i } ^ { t } , \\mathbf { w } _ { j } ^ { t } ) \\right\\} _ { j = 1 } ^ { n } \\right) .\n$$",
283
+ "text_format": "latex",
284
+ "bbox": [
285
+ 299,
286
+ 810,
287
+ 699,
288
+ 845
289
+ ],
290
+ "page_idx": 2
291
+ },
292
+ {
293
+ "type": "text",
294
+ "text": "To get an intuition for the behavior of this repulsive term and its gradients, we can consider the RBF kernel $\\begin{array} { r } { k ( \\mathbf { w } _ { i } , \\mathbf { w } _ { j } ) = \\exp \\big ( - \\frac { 1 } { h } | | \\mathbf { w } _ { i } - \\mathbf { w } _ { j } | | ^ { 2 } \\big ) } \\end{array}$ with lengthscale $h$ and notice how its gradient ",
295
+ "bbox": [
296
+ 173,
297
+ 849,
298
+ 825,
299
+ 881
300
+ ],
301
+ "page_idx": 2
302
+ },
303
+ {
304
+ "type": "equation",
305
+ "img_path": "images/f23cff6e6b3dc3c8e61b222583d646eef0fa3e0251332d45f77faee6e2130a87.jpg",
306
+ "text": "$$\n\\nabla _ { \\mathbf { w } _ { i } ^ { t } } k ( \\mathbf { w } _ { i } ^ { t } , \\mathbf { w } _ { j } ^ { t } ) = \\frac { 2 } { h } ( \\mathbf { w } _ { j } ^ { t } - \\mathbf { w } _ { i } ^ { t } ) k ( \\mathbf { w } _ { i } ^ { t } , \\mathbf { w } _ { j } ^ { t } )\n$$",
307
+ "text_format": "latex",
308
+ "bbox": [
309
+ 357,
310
+ 886,
311
+ 638,
312
+ 916
313
+ ],
314
+ "page_idx": 2
315
+ },
316
+ {
317
+ "type": "text",
318
+ "text": "drives $\\mathbf { w } _ { i }$ away from its neighboring members ${ \\bf w } _ { j }$ , thus creating a repulsive effect. Naturally, not all the choices of $\\mathcal { R }$ induce this effect. One of the simplest formulations to obtain it is via a linear combination of the kernel gradients scaled by a positive factor, that is, $\\begin{array} { r } { \\beta \\sum _ { j = 1 } ^ { n } \\nabla _ { \\mathbf { w } _ { i } ^ { t } } k ( \\mathbf { w } _ { i } ^ { t } , \\mathbf { w } _ { j } ^ { t } ) } \\end{array}$ with $\\beta \\in \\mathbb { R } _ { * } ^ { + }$ . We will see in Section $\\begin{array} { l } { 3 } \\\\ { . } \\end{array}$ how the choice of $\\beta$ can be justified in order to obtain convergence to the Bayesian posterior together with alternative possible formulations of $\\mathcal { R }$ that preserve this convergence. ",
319
+ "bbox": [
320
+ 173,
321
+ 90,
322
+ 826,
323
+ 178
324
+ ],
325
+ "page_idx": 3
326
+ },
327
+ {
328
+ "type": "text",
329
+ "text": "2.2 Repulsive force in function space ",
330
+ "text_level": 1,
331
+ "bbox": [
332
+ 176,
333
+ 193,
334
+ 441,
335
+ 208
336
+ ],
337
+ "page_idx": 3
338
+ },
339
+ {
340
+ "type": "text",
341
+ "text": "To overcome the aforementioned overparameterization issue, the update in Eq. $\\textcircled { 3 }$ can be formulated in function space instead of weight space. Let $f : \\mathbf { w } \\mapsto f ( \\cdot ; \\mathbf { w } )$ be the map that maps a configuration of weights $\\mathbf { w } \\in \\mathbb { R } ^ { d }$ to the corresponding neural network regression function and denote as $f _ { i } : = f ( \\cdot ; { \\mathbf w } _ { i } )$ the function with a certain configuration of weights $\\mathbf { w } _ { i }$ . We can now consider $n$ particles in function space $\\{ f _ { i } \\} _ { i = 1 } ^ { n }$ with $\\pmb { f } \\in \\mathcal { F }$ and model their interaction with a general positive definite kernel $k ( \\cdot , \\cdot )$ . We also consider the implicit functional likelihood $p ( \\pmb { y } | \\pmb { x } , \\pmb { f } )$ , determined by the measure $p ( \\pmb { y } | \\pmb { x } , \\mathbf { w } )$ in the weight space, as well as the functional prior $p ( f )$ , which can either be defined separately (e.g., using a GP) or modeled as a push-forward measure of the weight-space prior $p ( \\mathbf { w } )$ . Together, they determine the posterior in function space $p ( \\pmb { f } | \\mathcal { D } )$ . The functional evolution of a particle can then be written as: ",
342
+ "bbox": [
343
+ 173,
344
+ 218,
345
+ 826,
346
+ 358
347
+ ],
348
+ "page_idx": 3
349
+ },
350
+ {
351
+ "type": "equation",
352
+ "img_path": "images/6e9ccd562a52a4d7474eb2dbb571b766cb26754c555d1761309dd914491e04b8.jpg",
353
+ "text": "$$\n\\begin{array} { r l } & { f _ { i } ^ { t + 1 } \\gets f _ { i } ^ { t } + \\epsilon _ { t } \\phi ( f _ { i } ^ { t } ) } \\\\ { \\mathrm { t h } \\quad } & { \\phi ( f _ { i } ^ { t } ) = \\nabla _ { f _ { i } ^ { t } } \\log p ( f _ { i } ^ { t } | \\mathcal { D } ) - \\mathcal { R } \\left( \\left\\{ \\nabla _ { f _ { i } ^ { t } } k ( f _ { i } ^ { t } , f _ { j } ^ { t } ) \\right\\} _ { j = 1 } ^ { n } \\right) . } \\end{array}\n$$",
354
+ "text_format": "latex",
355
+ "bbox": [
356
+ 297,
357
+ 362,
358
+ 720,
359
+ 419
360
+ ],
361
+ "page_idx": 3
362
+ },
363
+ {
364
+ "type": "text",
365
+ "text": "However, computing the update in function space is neither tractable nor practical, which is why two additional considerations are needed. The first one regards the infinite dimensionality of function space, which we circumvent using a canonical projection into a subspace: ",
366
+ "bbox": [
367
+ 178,
368
+ 422,
369
+ 823,
370
+ 465
371
+ ],
372
+ "page_idx": 3
373
+ },
374
+ {
375
+ "type": "text",
376
+ "text": "Definition 1 (Canonical projection). For any $A \\subset { \\mathcal { X } }$ , we define $\\pi _ { A } : \\mathbb { R } ^ { \\mathcal { X } } \\to \\mathbb { R } ^ { A }$ as the canonical projection onto $A$ , that is, $\\pi _ { A } ( f ) = \\{ f ( a ) \\} _ { a \\in A }$ . ",
377
+ "bbox": [
378
+ 174,
379
+ 468,
380
+ 821,
381
+ 500
382
+ ],
383
+ "page_idx": 3
384
+ },
385
+ {
386
+ "type": "text",
387
+ "text": "In other words, the kernel will not be evaluated directly in function space, but on the projection $k \\big ( \\pi _ { B } ( f ) , \\pi _ { B } ( f ^ { \\prime } ) \\big )$ , with $B$ being a subset of the input space given by a batch of training data points. The second consideration is to project this update back into the parameter space and evolve a set of particles there, because ultimately we are interested in representing the functions by parameterized neural networks. For this purpose, we can use the Jacobian of the $i$ -th particle as a projector: ",
388
+ "bbox": [
389
+ 174,
390
+ 507,
391
+ 825,
392
+ 578
393
+ ],
394
+ "page_idx": 3
395
+ },
396
+ {
397
+ "type": "equation",
398
+ "img_path": "images/d7dea1ea5314c734775cfe499bded9ea6e655f30206ef90295c8a3d5d82d37d3.jpg",
399
+ "text": "$$\n\\phi ( { \\mathbf w } _ { i } ^ { t } ) = \\left( \\frac { \\partial f _ { i } ^ { t } } { \\partial { \\mathbf w } _ { i } ^ { t } } \\right) ^ { \\top } \\left[ \\nabla _ { f _ { i } ^ { t } } \\log p ( f _ { i } ^ { t } | { \\mathcal D } ) - { \\mathcal R } \\left( \\left\\{ \\nabla _ { f _ { i } ^ { t } } k ( \\pi _ { B } ( f _ { i } ^ { t } ) , \\pi _ { B } ( f _ { j } ^ { t } ) ) \\right\\} _ { j = 1 } ^ { n } \\right) \\right] .\n$$",
400
+ "text_format": "latex",
401
+ "bbox": [
402
+ 230,
403
+ 593,
404
+ 767,
405
+ 631
406
+ ],
407
+ "page_idx": 3
408
+ },
409
+ {
410
+ "type": "text",
411
+ "text": "2.3 Comparison to Stein variational gradient descent ",
412
+ "text_level": 1,
413
+ "bbox": [
414
+ 173,
415
+ 645,
416
+ 555,
417
+ 661
418
+ ],
419
+ "page_idx": 3
420
+ },
421
+ {
422
+ "type": "text",
423
+ "text": "Note that our update is reminiscent of SVGD $\\mathbb { \\left[ 5 1 \\right] }$ , which in parameter space can be written as: ",
424
+ "bbox": [
425
+ 173,
426
+ 669,
427
+ 795,
428
+ 685
429
+ ],
430
+ "page_idx": 3
431
+ },
432
+ {
433
+ "type": "equation",
434
+ "img_path": "images/ed4ba25f1f792a3ef21feee9794a7aaba9ed6181f2313384dd85bba5b6760967.jpg",
435
+ "text": "$$\n\\phi ( \\mathbf { w } _ { i } ^ { t } ) = \\sum _ { j = 1 } ^ { n } k ( \\mathbf { w } _ { i } ^ { t } , \\mathbf { w } _ { j } ^ { t } ) \\nabla _ { \\mathbf { w } _ { i } ^ { t } } \\log p ( \\mathbf { w } _ { i } ^ { t } | \\mathcal { D } ) + \\sum _ { j = 1 } ^ { n } \\nabla _ { \\mathbf { w } _ { j } ^ { t } } k ( \\mathbf { w } _ { j } ^ { t } , \\mathbf { w } _ { i } ^ { t } ) .\n$$",
436
+ "text_format": "latex",
437
+ "bbox": [
438
+ 282,
439
+ 690,
440
+ 715,
441
+ 734
442
+ ],
443
+ "page_idx": 3
444
+ },
445
+ {
446
+ "type": "text",
447
+ "text": "It is important to notice that here, the gradients are averaged across all the particles using the kernel matrix. Interestingly, SVGD can be asymptotically interpreted as gradient flow of the KL divergence under a new metric induced by the Stein operator [16, 50] (see Appendix D for more details). Moving the inference from parameter to function space $\\pmb { \\mathbb { Z } } 6 \\|$ leads to the update rule ",
448
+ "bbox": [
449
+ 173,
450
+ 738,
451
+ 826,
452
+ 795
453
+ ],
454
+ "page_idx": 3
455
+ },
456
+ {
457
+ "type": "equation",
458
+ "img_path": "images/da910223233132ed75eba544433552d88de5b055ed7c20ab997ee811df84045c.jpg",
459
+ "text": "$$\n\\phi ( \\mathbf { w } _ { i } ^ { t } ) = \\left( \\frac { \\partial f _ { i } ^ { t } } { \\partial \\mathbf { w } _ { i } ^ { t } } \\right) ^ { \\top } \\left( \\frac { 1 } { n } \\sum _ { j = 1 } ^ { n } k ( f _ { i } ^ { t } , f _ { j } ^ { t } ) \\nabla _ { f _ { j } ^ { t } } \\log p ( f _ { j } ^ { t } | \\mathcal { D } ) + \\nabla _ { f _ { j } ^ { t } } k ( f _ { i } ^ { t } , f _ { j } ^ { t } ) \\right) .\n$$",
460
+ "text_format": "latex",
461
+ "bbox": [
462
+ 251,
463
+ 799,
464
+ 746,
465
+ 843
466
+ ],
467
+ "page_idx": 3
468
+ },
469
+ {
470
+ "type": "text",
471
+ "text": "This way of averaging gradients using a kernel can be dangerous in high-dimensional settings, where kernel methods often suffer from the curse of dimensionality. Moreover, in Eq. $\\textcircled{6}$ , the posterior gradients of the particles are averaged using their similarity in weight space, which can be misleading in multi-modal posteriors. Worse yet, in Eq. $\\textcircled{7}$ , the gradients are averaged in function space and are then projected back using exclusively the $i$ -th Jacobian, which can be harmful given that it is not guaranteed that distances between functions evaluated on a subset of their input space resemble their true distance. Our proposed method, on the other hand, does not employ any averaging of the posterior gradients and thus comes closest to the true particle gradients in deep ensembles. ",
472
+ "bbox": [
473
+ 174,
474
+ 854,
475
+ 825,
476
+ 912
477
+ ],
478
+ "page_idx": 3
479
+ },
480
+ {
481
+ "type": "text",
482
+ "text": "",
483
+ "bbox": [
484
+ 174,
485
+ 90,
486
+ 825,
487
+ 147
488
+ ],
489
+ "page_idx": 4
490
+ },
491
+ {
492
+ "type": "text",
493
+ "text": "3 Repulsive deep ensembles are Bayesian ",
494
+ "text_level": 1,
495
+ "bbox": [
496
+ 174,
497
+ 165,
498
+ 532,
499
+ 183
500
+ ],
501
+ "page_idx": 4
502
+ },
503
+ {
504
+ "type": "text",
505
+ "text": "So far, we represented the repulsive force as a general function of the gradients of a kernel. In this section, we show how to determine the explicit form of the repulsive term, such that the resulting update rule is equivalent to the discretization of the gradient flow dynamics of the KL divergence in Wasserstein space. We begin by introducing the concepts of particle approximation and gradient flow. ",
506
+ "bbox": [
507
+ 173,
508
+ 195,
509
+ 826,
510
+ 252
511
+ ],
512
+ "page_idx": 4
513
+ },
514
+ {
515
+ "type": "text",
516
+ "text": "3.1 Particle approximation ",
517
+ "text_level": 1,
518
+ "bbox": [
519
+ 174,
520
+ 267,
521
+ 374,
522
+ 282
523
+ ],
524
+ "page_idx": 4
525
+ },
526
+ {
527
+ "type": "text",
528
+ "text": "A particle-based approximation of a target measure depends on a set of weighted samples $\\{ ( \\bar { x _ { i } } , w _ { i } ) \\} _ { i = 1 } ^ { n }$ , for which an empirical measure can be defined as ",
529
+ "bbox": [
530
+ 173,
531
+ 292,
532
+ 823,
533
+ 321
534
+ ],
535
+ "page_idx": 4
536
+ },
537
+ {
538
+ "type": "equation",
539
+ "img_path": "images/b51a8eebc42b5a02f34979b6c46328fac936b6561c35ce4b3a464937651a8dd3.jpg",
540
+ "text": "$$\n\\rho ( x ) = \\sum _ { i = 1 } ^ { n } w _ { i } \\delta ( x - x _ { i } ) ,\n$$",
541
+ "text_format": "latex",
542
+ "bbox": [
543
+ 413,
544
+ 325,
545
+ 584,
546
+ 366
547
+ ],
548
+ "page_idx": 4
549
+ },
550
+ {
551
+ "type": "text",
552
+ "text": "where $\\delta ( \\cdot )$ is the Dirac delta function and the weights $w _ { i }$ satisfy $w _ { i } \\in [ 0 , 1 ]$ and $\\textstyle \\sum _ { i = 1 } ^ { n } w _ { i } = 1$ . To approximate a target distribution $\\pi ( x )$ using the empirical measure, the particles and their weights need to be selected in a principled manner that minimizes some measure of distance between $\\pi ( x )$ and $\\rho ( x )$ (e.g., a set of $N$ samples with weights $w _ { i } = 1 / N$ obtained using an MCMC method). ",
553
+ "bbox": [
554
+ 173,
555
+ 369,
556
+ 825,
557
+ 426
558
+ ],
559
+ "page_idx": 4
560
+ },
561
+ {
562
+ "type": "text",
563
+ "text": "3.2 Gradient flow in parameter space ",
564
+ "text_level": 1,
565
+ "bbox": [
566
+ 176,
567
+ 441,
568
+ 446,
569
+ 457
570
+ ],
571
+ "page_idx": 4
572
+ },
573
+ {
574
+ "type": "text",
575
+ "text": "Given a smooth function $J : \\mathbb { R } ^ { d } \\mathbb { R }$ in Euclidean space, we can minimize it by creating a path that follows its negative gradient starting from some initial conditions $x _ { 0 }$ . The curve $x ( t )$ with starting point $x _ { 0 }$ described by that path is called gradient flow. The dynamics and evolution in time of a considered point in the space under this minimization problem can be described as the ODE1 ",
576
+ "bbox": [
577
+ 173,
578
+ 465,
579
+ 825,
580
+ 522
581
+ ],
582
+ "page_idx": 4
583
+ },
584
+ {
585
+ "type": "equation",
586
+ "img_path": "images/4af9c8caebc8dd0f4bb240ad868ba49b8044f29f61003074e861ae4833cdfbee.jpg",
587
+ "text": "$$\n\\frac { d \\boldsymbol { x } } { d t } = - \\boldsymbol { \\nabla } J ( \\boldsymbol { x } ) .\n$$",
588
+ "text_format": "latex",
589
+ "bbox": [
590
+ 442,
591
+ 526,
592
+ 555,
593
+ 556
594
+ ],
595
+ "page_idx": 4
596
+ },
597
+ {
598
+ "type": "text",
599
+ "text": "We can extend this concept to the space of probability distributions (Wasserstein gradient flow) [3]. Let us consider the space of probability measures $\\mathcal { P } _ { 2 } ( \\mathcal { M } )$ , that is, the set of probability measures with finite second moments defined on the manifold $\\mathcal { M }$ : ",
600
+ "bbox": [
601
+ 173,
602
+ 558,
603
+ 825,
604
+ 599
605
+ ],
606
+ "page_idx": 4
607
+ },
608
+ {
609
+ "type": "equation",
610
+ "img_path": "images/c1e5d77c719b4d2fa7a0247805d6e0144779c241f5db03b43a6f1d113276ff19.jpg",
611
+ "text": "$$\n\\mathcal { P } _ { 2 } ( \\mathcal { M } ) = \\left\\{ \\varphi : \\mathcal { M } \\to [ 0 , \\infty ) \\bigg | \\int _ { \\mathcal { M } } \\mathrm { d } \\varphi = 1 , ~ \\int _ { \\mathcal { M } } | x | ^ { 2 } \\varphi ( x ) \\mathrm { d } x < + \\infty \\right\\} .\n$$",
612
+ "text_format": "latex",
613
+ "bbox": [
614
+ 259,
615
+ 601,
616
+ 736,
617
+ 636
618
+ ],
619
+ "page_idx": 4
620
+ },
621
+ {
622
+ "type": "text",
623
+ "text": "Taking $\\Pi ( \\mu , \\nu )$ as the set of joint probability measures with marginals $\\mu , \\nu$ , we can define the Wasserstein metric on the space $\\mathcal { P } _ { 2 } ( \\mathcal { M } )$ as: ",
624
+ "bbox": [
625
+ 178,
626
+ 638,
627
+ 820,
628
+ 667
629
+ ],
630
+ "page_idx": 4
631
+ },
632
+ {
633
+ "type": "equation",
634
+ "img_path": "images/22875a9421a3c955c184f36bee03fad9988e4e0d847133375befe3e5951b4f25.jpg",
635
+ "text": "$$\nW _ { 2 } ^ { 2 } ( \\mu , \\nu ) = \\operatorname* { i n f } _ { \\pi \\in \\Pi ( \\mu , \\nu ) } \\int | x - y | ^ { 2 } { \\mathrm { d } } \\pi ( x , y ) .\n$$",
636
+ "text_format": "latex",
637
+ "bbox": [
638
+ 354,
639
+ 670,
640
+ 642,
641
+ 703
642
+ ],
643
+ "page_idx": 4
644
+ },
645
+ {
646
+ "type": "text",
647
+ "text": "Considering the optimization problem of a functional $J : \\mathcal { P } _ { 2 } ( \\mathcal { M } ) \\mathbb { R }$ , such as the $\\mathrm { K L }$ divergence between the particle approximation in Eq. $\\textcircled { 8 }$ and the target posterior $\\pi ( x )$ , ",
648
+ "bbox": [
649
+ 173,
650
+ 707,
651
+ 823,
652
+ 736
653
+ ],
654
+ "page_idx": 4
655
+ },
656
+ {
657
+ "type": "equation",
658
+ "img_path": "images/202eca2cfd27979881321c7e7947951e3cc456330188130d02fcab3cc4c0abde.jpg",
659
+ "text": "$$\n\\operatorname* { i n f } _ { \\rho \\in \\mathcal { P } _ { 2 } ( \\mathcal { M } ) } D _ { K L } ( \\rho , \\pi ) = \\int _ { \\mathcal { M } } ( \\log \\rho ( x ) - \\log \\pi ( x ) ) \\rho ( x ) \\mathrm { d } x ,\n$$",
660
+ "text_format": "latex",
661
+ "bbox": [
662
+ 305,
663
+ 739,
664
+ 691,
665
+ 772
666
+ ],
667
+ "page_idx": 4
668
+ },
669
+ {
670
+ "type": "text",
671
+ "text": "the evolution in time of the measure $\\rho$ under the equivalent of the gradient, the Wasserstein gradient flow, is described by the Liouville equation2 [38, 3, 64]: ",
672
+ "bbox": [
673
+ 174,
674
+ 775,
675
+ 825,
676
+ 804
677
+ ],
678
+ "page_idx": 4
679
+ },
680
+ {
681
+ "type": "equation",
682
+ "img_path": "images/319c5dba11def8b47c62bbed7e518cec22d2bb6447df21ccd8c8f0ceacda0468.jpg",
683
+ "text": "$$\n\\begin{array} { l } { \\displaystyle \\frac { \\partial \\rho ( \\boldsymbol { x } ) } { \\partial t } = \\nabla \\cdot \\left( \\rho ( \\boldsymbol { x } ) \\nabla \\frac { \\delta } { \\delta \\rho } D _ { K L } ( \\rho , \\pi ) \\right) } \\\\ { \\displaystyle = \\nabla \\cdot \\left( \\rho ( \\boldsymbol { x } ) \\nabla \\big ( \\log \\rho ( \\boldsymbol { x } ) - \\log \\pi ( \\boldsymbol { x } ) \\big ) \\right) , } \\end{array}\n$$",
684
+ "text_format": "latex",
685
+ "bbox": [
686
+ 339,
687
+ 806,
688
+ 656,
689
+ 877
690
+ ],
691
+ "page_idx": 4
692
+ },
693
+ {
694
+ "type": "text",
695
+ "text": "where $\\nabla _ { \\delta \\rho } ^ { \\delta } D _ { K L } ( \\rho , \\pi ) \\ = : \\ \\nabla _ { \\mathcal { W } _ { 2 } } D _ { K L } ( \\rho , \\pi )$ is the Wasserstein gradient and the operator $\\frac { \\delta } { \\delta \\rho }$ $\\mathcal { P } _ { 2 } ( \\mathcal { M } ) \\stackrel { \\cdot } { } \\mathbb { R }$ represents the functional derivative or first variation (see Appendix $\\boxed { \\mathsf { C } }$ for more details). In the particular case of the KL functional, we can recover the Fokker-Planck equation, ",
696
+ "bbox": [
697
+ 173,
698
+ 89,
699
+ 826,
700
+ 136
701
+ ],
702
+ "page_idx": 5
703
+ },
704
+ {
705
+ "type": "equation",
706
+ "img_path": "images/bc5069e97a8be7662b9fea29c7dc30021ca7cea5d088b0d8d45da5c537562e37.jpg",
707
+ "text": "$$\n\\begin{array} { r l r } & { } & { \\frac { \\partial \\rho ( x ) } { \\partial t } = \\nabla \\cdot \\left( \\rho ( x ) \\nabla ( \\log \\rho ( x ) - \\log \\pi ( x ) ) \\right) } \\\\ & { } & { = - \\nabla \\cdot \\left( \\rho ( x ) \\nabla \\log \\pi ( x ) \\right) + \\nabla ^ { 2 } \\rho ( x ) , } \\end{array}\n$$",
708
+ "text_format": "latex",
709
+ "bbox": [
710
+ 348,
711
+ 137,
712
+ 647,
713
+ 189
714
+ ],
715
+ "page_idx": 5
716
+ },
717
+ {
718
+ "type": "text",
719
+ "text": "that admits as unique stationary distribution the posterior $\\pi ( x )$ . The deterministic particle dynamics ODE $\\left[ \\left[ 2 \\right] \\right]$ related to Eq. $\\mathbb { ( 1 1 ) }$ , namely mean-field Wasserstein dynamics, is then given by: ",
720
+ "bbox": [
721
+ 173,
722
+ 189,
723
+ 823,
724
+ 217
725
+ ],
726
+ "page_idx": 5
727
+ },
728
+ {
729
+ "type": "equation",
730
+ "img_path": "images/dd2081dc85db6793f99ac9a48cbba2bf3fdd0b388e3458acd6fdadb5a243ac7b.jpg",
731
+ "text": "$$\n\\frac { d x } { d t } = - \\nabla \\big ( \\log \\rho ( x ) - \\log \\pi ( x ) \\big ) .\n$$",
732
+ "text_format": "latex",
733
+ "bbox": [
734
+ 385,
735
+ 218,
736
+ 612,
737
+ 247
738
+ ],
739
+ "page_idx": 5
740
+ },
741
+ {
742
+ "type": "text",
743
+ "text": "Considering a discretization of Eq. (12) for a particle system $\\{ x \\} _ { i = 1 } ^ { n }$ and small stepsize $\\epsilon _ { t }$ , we can rewrite Eq. $\\mathbb { \\underline { { ( 1 2 ) } } }$ as: ",
744
+ "bbox": [
745
+ 171,
746
+ 253,
747
+ 823,
748
+ 284
749
+ ],
750
+ "page_idx": 5
751
+ },
752
+ {
753
+ "type": "equation",
754
+ "img_path": "images/8a84c16f9a2296b238e38136d0db6478f4239c987d86ac3eef254ae1bde2a3a0.jpg",
755
+ "text": "$$\nx _ { i } ^ { t + 1 } = x _ { i } ^ { t } + \\epsilon _ { t } \\bigl ( \\nabla \\log \\pi ( x _ { i } ^ { t } ) - \\nabla \\log \\rho ( x _ { i } ^ { t } ) \\bigr ) .\n$$",
756
+ "text_format": "latex",
757
+ "bbox": [
758
+ 348,
759
+ 281,
760
+ 648,
761
+ 300
762
+ ],
763
+ "page_idx": 5
764
+ },
765
+ {
766
+ "type": "text",
767
+ "text": "Unfortunately, we do not have access to the analytical form of the gradient $\\nabla \\log \\rho$ , so an approximation is needed. At this point, it is crucial to observe the similarity between the discretization of the Wasserstein gradient flow in Eq. $\\textcircled { 1 3 }$ and the repulsive update in Eq. $( 3 )$ to notice how, if the kernelized repulsion is an approximation of the gradient of the empirical particle measure, the update rule minimizes the KL divergence between the particle measure and the target posterior. Different sample-based approximations of the gradient that use a kernel function have been recently studied. The simplest one is given by the kernel density estimation (KDE) (details in Appendix $\\dot { \\mathrm { ~ E ~ } } )$ $\\begin{array} { r } { \\tilde { \\rho } _ { t } ( x ) = \\frac { 1 } { n } \\sum _ { i = 1 } ^ { n } \\dot { k } ( x , x _ { t } ^ { i } ) } \\end{array}$ , where $\\boldsymbol { k } ( \\cdot , \\cdot ) : \\mathbb { R } ^ { d } \\times \\mathbb { R } ^ { d } \\dot { \\mathbb { R } }$ and the gradient of its log density is given by $\\mathbb { \\ m }$ : ",
768
+ "bbox": [
769
+ 173,
770
+ 299,
771
+ 826,
772
+ 422
773
+ ],
774
+ "page_idx": 5
775
+ },
776
+ {
777
+ "type": "equation",
778
+ "img_path": "images/690e51dceea0054b390381bde15c30e9e687f9c712f52307c2e07985d9200e39.jpg",
779
+ "text": "$$\n\\nabla \\log \\rho ( x _ { i } ^ { t } ) \\approx \\frac { \\sum _ { j = 1 } ^ { n } \\nabla _ { x _ { i } ^ { t } } k ( x _ { i } ^ { t } , x _ { j } ^ { t } ) } { \\sum _ { j = 1 } ^ { n } k ( x _ { i } ^ { t } , x _ { j } ^ { t } ) } .\n$$",
780
+ "text_format": "latex",
781
+ "bbox": [
782
+ 377,
783
+ 421,
784
+ 620,
785
+ 460
786
+ ],
787
+ "page_idx": 5
788
+ },
789
+ {
790
+ "type": "text",
791
+ "text": "Using this approximation in Eq. $( 1 3 )$ we obtain: ",
792
+ "bbox": [
793
+ 174,
794
+ 458,
795
+ 488,
796
+ 473
797
+ ],
798
+ "page_idx": 5
799
+ },
800
+ {
801
+ "type": "equation",
802
+ "img_path": "images/371ffb0715cb9a3b57e74ec4c78b9d2ce1313431a8e5f80ccc30135a0cfa4053.jpg",
803
+ "text": "$$\nx _ { i } ^ { t + 1 } = x _ { i } ^ { t } + \\epsilon _ { t } \\Bigg ( \\nabla \\log \\pi ( x _ { i } ^ { t } ) - \\frac { \\sum _ { j = 1 } ^ { n } \\nabla _ { x _ { i } ^ { t } } k ( x _ { i } ^ { t } , x _ { j } ^ { t } ) } { \\sum _ { j = 1 } ^ { n } k ( x _ { i } ^ { t } , x _ { j } ^ { t } ) } \\Bigg ) ,\n$$",
804
+ "text_format": "latex",
805
+ "bbox": [
806
+ 315,
807
+ 473,
808
+ 681,
809
+ 512
810
+ ],
811
+ "page_idx": 5
812
+ },
813
+ {
814
+ "type": "text",
815
+ "text": "where, if we substitute the posterior for $\\pi$ , we obtain an expression for the repulsive force in Eq. $\\textcircled{3}$ . This shows that if the repulsive term in Eq. $( 3 )$ is the normalized sum of the gradients $\\mathcal { R } =$ $\\begin{array} { r } { \\left( \\bar { \\sum _ { j = 1 } ^ { n } } k ( \\mathbf { w } _ { i } ^ { t } , \\mathbf { w } _ { j } ^ { t } ) \\right) ^ { - 1 } \\sum _ { j = 1 } ^ { n } \\nabla _ { \\mathbf { w } _ { i } ^ { t } } k ( \\mathbf { w } _ { i } ^ { t } , \\mathbf { w } _ { j } ^ { t } ) } \\end{array}$ , we do not only encourage diversity of the ensemble members and thus avoid collapse, but surprisingly—in the asymptotic limit of , where the KDE approximation is exact $\\left[ \\left[ 6 6 \\right] \\right]$ —also converge to the true Bayesian posterior! ",
816
+ "bbox": [
817
+ 173,
818
+ 512,
819
+ 825,
820
+ 594
821
+ ],
822
+ "page_idx": 5
823
+ },
824
+ {
825
+ "type": "text",
826
+ "text": "Nevertheless, approximating the gradient of the empirical measure with the KDE can lead to suboptimal performance, as already studied by Li and Turner $[ \\overline { { | 4 6 | } }$ . They instead introduced a new Stein gradient estimator (SGE) that offers better performance, while maintaining the same computational cost. Even more recently, Shi et al. $\\mathbb { \\left. \\boldsymbol { \\mathfrak { G } } \\boldsymbol { \\mathfrak { A } } \\right. }$ introduced a spectral method for gradient estimation (SSGE), that also allows for a simple estimation on out-of-sample points. These two estimators can be used in Eq. $\\textcircled { 1 3 }$ , to formulate the following update rules with two alternative repulsive forces. The one using the Stein estimator, that we will call SGE-WGD, is: ",
827
+ "bbox": [
828
+ 173,
829
+ 598,
830
+ 826,
831
+ 696
832
+ ],
833
+ "page_idx": 5
834
+ },
835
+ {
836
+ "type": "equation",
837
+ "img_path": "images/fc8beab1c532557f6b4c53d364e88ab075d4917c7571f2c182526373978fd6c4.jpg",
838
+ "text": "$$\nx _ { i } ^ { t + 1 } = x _ { i } ^ { t } + \\epsilon _ { t } \\bigg ( \\nabla \\log \\pi ( x _ { i } ^ { t } ) + \\sum _ { j = 1 } ^ { n } ( K + \\eta \\mathbb { I } ) _ { i j } ^ { - 1 } \\sum _ { k = 1 } ^ { n } \\nabla _ { x _ { k } ^ { t } } k ( x _ { k } ^ { t } , x _ { j } ^ { t } ) \\bigg ) ,\n$$",
839
+ "text_format": "latex",
840
+ "bbox": [
841
+ 269,
842
+ 696,
843
+ 725,
844
+ 738
845
+ ],
846
+ "page_idx": 5
847
+ },
848
+ {
849
+ "type": "text",
850
+ "text": "where $K$ is the kernel Gram matrix, $\\eta$ a small constant, and I the identity matrix. We can notice an important difference between KDE and SGE, in that the former is only considering the interaction of the $i$ -th particle being updated with all the others, while the latter is simultaneously considering also the interactions between the remaining particles. The spectral method, that we will call SSGE-WGD, leads to the following update rule: ",
851
+ "bbox": [
852
+ 174,
853
+ 739,
854
+ 825,
855
+ 809
856
+ ],
857
+ "page_idx": 5
858
+ },
859
+ {
860
+ "type": "equation",
861
+ "img_path": "images/22b05cdc924e14a9f81460eed44ce5ae2949169ff1032670bb23204d0bc3d3f9.jpg",
862
+ "text": "$$\nx _ { t + 1 } ^ { i } = x _ { t } ^ { i } + \\epsilon _ { t } \\bigg ( \\nabla \\log \\pi ( x _ { t } ^ { i } ) + \\sum _ { j = 1 } ^ { J } \\frac { 1 } { \\lambda _ { j } ^ { 2 } } \\sum _ { m = 1 } ^ { n } \\sum _ { k = 1 } ^ { n } u _ { j k } \\nabla _ { x _ { m } } k ( x _ { m } ^ { t } , x _ { k } ^ { t } ) \\cdot \\sum _ { l = 1 } ^ { n } u _ { j l } k ( x _ { i } ^ { t } , x _ { l } ^ { t } ) \\bigg )\n$$",
863
+ "text_format": "latex",
864
+ "bbox": [
865
+ 197,
866
+ 809,
867
+ 772,
868
+ 853
869
+ ],
870
+ "page_idx": 5
871
+ },
872
+ {
873
+ "type": "text",
874
+ "text": "where $\\lambda _ { j }$ is the $j$ -th eigenvalue of the kernel matrix and $u _ { j k }$ is the $k$ -th component of the $j$ -th eigenvector. Computationally, both SSGE and SGE have a cost of $\\mathcal { O } ( M ^ { 3 } + M ^ { 2 } d )$ , with $M$ being the number of points and $d$ their dimensionality. SSGE has an additional cost for predictions of $\\mathcal { O } ( M ( d + J ) )$ , where $J$ is the number of eigenvalues. ",
875
+ "bbox": [
876
+ 174,
877
+ 854,
878
+ 825,
879
+ 912
880
+ ],
881
+ "page_idx": 5
882
+ },
883
+ {
884
+ "type": "image",
885
+ "img_path": "images/909c60e208223cd54336af828c72fc5777f5cbee78dd1b5dffc27345c64eca36.jpg",
886
+ "image_caption": [
887
+ "Figure 2: Single Gaussian. We show samples from SVGD, KDE-WGD, SGE-WGD, and SSGEWGD (from left to right). The upper and right plots show the empirical one-dimensional marginal distributions obtained using KDE on the samples (red) and on the particles (blue). "
888
+ ],
889
+ "image_footnote": [],
890
+ "bbox": [
891
+ 181,
892
+ 85,
893
+ 820,
894
+ 212
895
+ ],
896
+ "page_idx": 6
897
+ },
898
+ {
899
+ "type": "text",
900
+ "text": "3.3 Gradient flow in function space ",
901
+ "text_level": 1,
902
+ "bbox": [
903
+ 174,
904
+ 287,
905
+ 429,
906
+ 303
907
+ ],
908
+ "page_idx": 6
909
+ },
910
+ {
911
+ "type": "text",
912
+ "text": "To theoretically justify the update rule introduced in function space in Eq. $\\textcircled{5}$ , we can rewrite the Liouville equation for the gradient flow in Eq. $\\textcircled { 1 1 }$ in function space as ",
913
+ "bbox": [
914
+ 173,
915
+ 314,
916
+ 823,
917
+ 344
918
+ ],
919
+ "page_idx": 6
920
+ },
921
+ {
922
+ "type": "equation",
923
+ "img_path": "images/5c17155651b4b8a9222af9e3b20c3d19517ca6b37f38c6cba7442ed799860e6c.jpg",
924
+ "text": "$$\n\\begin{array} { l } { \\displaystyle \\frac { \\partial \\rho ( { \\pmb f } ) } { \\partial t } = \\nabla \\cdot \\left( \\rho ( { \\pmb f } ) \\nabla \\frac { \\delta } { \\delta \\rho } D _ { K L } ( \\rho , \\pi ) \\right) } \\\\ { \\displaystyle = \\nabla \\cdot \\left( \\rho ( { \\pmb f } ) \\nabla \\big ( \\log \\rho ( { \\pmb f } ) - \\log \\pi ( { \\pmb f } ) \\big ) \\right) . } \\end{array}\n$$",
925
+ "text_format": "latex",
926
+ "bbox": [
927
+ 336,
928
+ 352,
929
+ 663,
930
+ 422
931
+ ],
932
+ "page_idx": 6
933
+ },
934
+ {
935
+ "type": "text",
936
+ "text": "Following this update, the mean field functional dynamics are ",
937
+ "bbox": [
938
+ 173,
939
+ 429,
940
+ 580,
941
+ 444
942
+ ],
943
+ "page_idx": 6
944
+ },
945
+ {
946
+ "type": "equation",
947
+ "img_path": "images/6ec49c1866059fd222d901856c6fd87a5e5117e19a3da56886cb693721fd87d0.jpg",
948
+ "text": "$$\n\\frac { d \\pmb f } { d t } = - \\nabla \\big ( \\log \\rho ( \\pmb f ) - \\log \\pi ( \\pmb f ) \\big ) .\n$$",
949
+ "text_format": "latex",
950
+ "bbox": [
951
+ 382,
952
+ 452,
953
+ 616,
954
+ 483
955
+ ],
956
+ "page_idx": 6
957
+ },
958
+ {
959
+ "type": "text",
960
+ "text": "Using the same KDE approximation as above, we can obtain a discretized evolution in function space and with it an explicit form for the repulsive force in Eq. $\\textcircled{4}$ as ",
961
+ "bbox": [
962
+ 171,
963
+ 489,
964
+ 825,
965
+ 520
966
+ ],
967
+ "page_idx": 6
968
+ },
969
+ {
970
+ "type": "equation",
971
+ "img_path": "images/413dc39054cf2ffe58aac203b1f546f1178b0fd741a1e970d847b042475c73d1.jpg",
972
+ "text": "$$\n\\pmb { f } _ { t + 1 } ^ { i } = \\pmb { f } _ { t } ^ { i } + \\epsilon _ { t } \\bigg ( \\nabla _ { \\pmb { f } } \\log \\pi ( \\pmb { f } _ { t } ^ { i } ) - \\frac { \\sum _ { j = 1 } ^ { n } \\nabla _ { \\pmb { f } _ { i } ^ { t } } k ( \\pmb { f } _ { i } ^ { t } , \\pmb { f } _ { j } ^ { t } ) } { \\sum _ { j = 1 } ^ { n } k ( \\pmb { f } _ { i } ^ { t } , \\pmb { f } _ { j } ^ { t } ) } \\bigg ) .\n$$",
973
+ "text_format": "latex",
974
+ "bbox": [
975
+ 307,
976
+ 526,
977
+ 691,
978
+ 568
979
+ ],
980
+ "page_idx": 6
981
+ },
982
+ {
983
+ "type": "text",
984
+ "text": "The update rules using the SGE and SSGE approximations follow as for the parametric case. It is important to notice that this update rule requires the function space prior gradient: $\\nabla _ { f _ { j } } \\log { p ( f _ { j } | x , y ) } =$ $\\nabla _ { f _ { j } } \\log p ( \\pmb { y } | \\pmb { x } , \\pmb { f _ { j } } ) + \\nabla _ { f _ { j } } \\log p ( \\pmb { f _ { j } } )$ . If one wants to use an implicit prior defined in weight space, an additional estimator is needed due to its analytical intractability. We again adopted the SSGE, introduced by Shi et al. $\\mathbb { \\lVert \\boldsymbol { 6 9 } \\rVert }$ , which was already used for a similar purpose in Sun et al. $\\pmb { \\mathbb { Z } 1 }$ . It is also interesting to note that the update rule in Eq. $\\textcircled { 1 2 0 }$ readily allows for the use of alternative priors that have an analytical form, such as Gaussian processes. This is an important feature of our method that allows for an explicit encoding of function space properties that can be useful for example in achieving better out of distribution detection capabilities $\\checkmark$ . ",
985
+ "bbox": [
986
+ 173,
987
+ 574,
988
+ 826,
989
+ 700
990
+ ],
991
+ "page_idx": 6
992
+ },
993
+ {
994
+ "type": "text",
995
+ "text": "3.4 The choice of the kernel ",
996
+ "text_level": 1,
997
+ "bbox": [
998
+ 174,
999
+ 718,
1000
+ 379,
1001
+ 733
1002
+ ],
1003
+ "page_idx": 6
1004
+ },
1005
+ {
1006
+ "type": "text",
1007
+ "text": "A repulsive effect can always be created in the ensemble by means of the gradient of any kernel function that is measuring the similarity between two members. Nevertheless, it is important to keep in mind that to ensure the asymptotic convergence to the Bayesian posterior, the repulsive component must be a consistent estimator of the gradient in Eq. $( 1 3 )$ , as shown in Section $\\checkmark$ . Therefore, some important constraints over the kernel choice are needed. In particular, the SGE and SSGE need a kernel function belonging to the Stein class (see Shi et al. $\\dot { \\overline { { \\vert 6 9 \\vert } } }$ for more details). On the other hand, for the KDE, any symmetric probability density function can be used. On this subject, the work of Aggarwal et al. [1] has shown how the Manhattan distance metric (L1 norm) might be preferable over the Euclidean distance metric (L2 norm) for high-dimensional settings. We performed some additional experiments using the L1 norm (Laplace kernel) for the KDE but we could not observe any substantial difference compared to using the L2 norm. Further investigations regarding this hypothesis are left for future research. ",
1008
+ "bbox": [
1009
+ 173,
1010
+ 744,
1011
+ 825,
1012
+ 911
1013
+ ],
1014
+ "page_idx": 6
1015
+ },
1016
+ {
1017
+ "type": "image",
1018
+ "img_path": "images/094ed7ba5611118de5688c3ddd1545168ced55dff3ababfdac0ee5e88615b714.jpg",
1019
+ "image_caption": [
1020
+ "Figure 3: BNN 2D classification. We show the entropy of the predictive posteriors. Again, the function-space methods capture the uncertainty better than the weight-space ones, thus approaching the gold-standard HMC posterior. "
1021
+ ],
1022
+ "image_footnote": [],
1023
+ "bbox": [
1024
+ 196,
1025
+ 93,
1026
+ 831,
1027
+ 292
1028
+ ],
1029
+ "page_idx": 7
1030
+ },
1031
+ {
1032
+ "type": "text",
1033
+ "text": "4 Experiments ",
1034
+ "text_level": 1,
1035
+ "bbox": [
1036
+ 174,
1037
+ 373,
1038
+ 312,
1039
+ 391
1040
+ ],
1041
+ "page_idx": 7
1042
+ },
1043
+ {
1044
+ "type": "text",
1045
+ "text": "In this section, we compare the different proposed WGD methods with deep ensembles and SVGD on synthetic sampling, regression, and classification tasks and real-world image classification tasks. We use an RBF kernel (except where otherwise specified) with the popular median heuristic $\\mathbb { \\left[ \\left[ 5 1 \\right] \\right] }$ to choose the kernel bandwidth. In our experiments, an adaptive bandwidth leads to better performance than fixing and tuning a single constant value for the entire evolution of the particles. We also quantitatively assess the uncertainty estimation of the methods in terms of calibration and OOD detection. In our experiments, we report the test accuracy, negative log-likelihood (NLL), and the expected calibration error (ECE) [58]. To assert the robustness on out-of-distribution (OOD) data, we report the ratio between predictive entropy on OOD and test data points $( H _ { o } / H _ { t } )$ , and the OOD detection area under the ROC curve AUROC(H) $\\mathbb { H }$ . Moreover, to assess the diversity of the ensemble generated by the different methods in function space, we measure the functional diversity using the model disagreement (MD) (details in Appendix $\\bar { \\bigtriangledown } \\bar { \\bigtriangledown }$ . In particular, we report the ratio between the average model disagreement on the OOD and test data points $( M D _ { o } / M D _ { t } )$ and additionally the OOD detection AUROC(MD) computed using this measure instead of the entropy. ",
1046
+ "bbox": [
1047
+ 174,
1048
+ 405,
1049
+ 825,
1050
+ 599
1051
+ ],
1052
+ "page_idx": 7
1053
+ },
1054
+ {
1055
+ "type": "text",
1056
+ "text": "Sampling from synthetic distributions As a sanity check, we first assessed the ability of our different approximations for Wasserstein gradient descent (using KDE, SGE, and SSGE) to sample from a two-dimensional Gaussian distribution (Figure $^ { 2 ) }$ . We see that our SGE-WGD, SSGE-WGD and the SVGD fit the target almost perfectly. We also tested the different methods in a more complex two-dimensional Funnel distribution $\\mathbb { \\left[ \\left[ 5 9 \\right] \\right] }$ and present the results in Figure $\\mathrm { F . l }$ in the Appendix. There, SGE-WGD and SVGD also perform best. ",
1057
+ "bbox": [
1058
+ 173,
1059
+ 616,
1060
+ 825,
1061
+ 699
1062
+ ],
1063
+ "page_idx": 7
1064
+ },
1065
+ {
1066
+ "type": "text",
1067
+ "text": "BNN 1D regression We then assessed the different methods in fitting a BNN posterior on a synthetically generated one-dimensional regression task. The results are reported in Figure 1 consisting of the mean prediction and $\\pm 1 , 2 , 3$ standard deviations of the predictive distribution. We can see that all methods performing inference in the weight space (DE, w-SVGD, WGD) are unable to capture the epistemic uncertainty between the two clusters of training data points. Conversely, the functional methods (f-SVGD, fWGD) are perfectly able to infer the diversity of the hypotheses in this region due to the lack of training evidence. They thereby achieve a predictive posterior that very closely resembles the one obtained with the gold-standard HMC sampling. ",
1068
+ "bbox": [
1069
+ 173,
1070
+ 714,
1071
+ 825,
1072
+ 825
1073
+ ],
1074
+ "page_idx": 7
1075
+ },
1076
+ {
1077
+ "type": "text",
1078
+ "text": "BNN 2D classification Next, we investigated the predictive performance and quality of uncertainty estimation of the methods in a two-dimensional synthetic classification setting. The results are displayed in Figure $\\textcircled { 3 }$ We can clearly observe that the weight-space methods are overconfident and do not capture the uncertainty well. Moreover, all the functions seems to collapse to the optimal classifier. These methods thus only account for uncertainty close to the decision boundaries and to the origin region, for which the uncertainty is purely aleatoric. In this setting, f-SVGD suffers from similar issues as the weight space methods, being overconfident away from the training data. Conversely, our fWGD methods are confident (low entropy) around the data but not out-of-distribution, thus representing the epistemic uncertainty better. This suggests that the functional diversity captured by this method naturally leads to a distance-aware uncertainty estimation $\\mathbb { H 9 } \\mathbb { L O }$ , a property that translates into confident predictions only in the proximity of the training data, allowing for a principled OOD detection. ",
1079
+ "bbox": [
1080
+ 174,
1081
+ 842,
1082
+ 825,
1083
+ 911
1084
+ ],
1085
+ "page_idx": 7
1086
+ },
1087
+ {
1088
+ "type": "table",
1089
+ "img_path": "images/c10e7e6db9d6afe7b283337a217b0daf6bdc8ff99b073aef9c58623cfb518d7c.jpg",
1090
+ "table_caption": [
1091
+ "Table 1: BNN image classification. AUROC $\\mathbf { ( H ) }$ is the AUROC computed using the entropy whereas AUROC(MD) is computed using the model disagreement. $\\mathbf { H _ { o } / H _ { t } }$ is the ratio of the entropies on OOD and test points respectively and $\\mathbf { M D _ { o } / M D _ { t } }$ is the ratio for model disagreement. We see that the best accuracy is achieved by our WGD methods, while our fWGD methods yield the best OOD detection and funtional diversity. All our proposed methods improve over standard deep ensembles in terms of accuracy and diversity, highlighting the effect of our repulsion. "
1092
+ ],
1093
+ "table_footnote": [],
1094
+ "table_body": "<table><tr><td rowspan=\"11\">Prroiiiie</td><td></td><td>AUROC(H)</td><td>AUROC(MD)</td><td>Accuracy</td><td>H/Ht</td><td>MD/MDt</td><td>ECE</td><td>NLL</td></tr><tr><td>Deep ensemble 4</td><td>0.958±0.001</td><td>0.975±0.001</td><td>91.122±0.013</td><td>6.257±0.005</td><td>6.394±0.001</td><td>0.012±0.001</td><td>0.129±0.001</td></tr><tr><td>SVGD [51</td><td>0.960±0.001</td><td>0.973±0.001</td><td>91.134±0.024</td><td>6.315±0.019</td><td>6.395±0.018</td><td>0.014±0.001</td><td>0.127±0.001</td></tr><tr><td>f-SVGD [76</td><td>0.956±0.001</td><td>0.975±0.001</td><td>89.884±0.015</td><td>5.652±0.009</td><td>6.531±0.005</td><td>0.013±0.001</td><td>0.150±0.001</td></tr><tr><td>hyper-DE [80]</td><td>0.968±0.001</td><td>0.981±0.001</td><td>91.160±0.007</td><td>6.682±0.065</td><td>7.059±0.152</td><td>0.014±0.001</td><td>0.128±0.001</td></tr><tr><td>kde-WGD (ours)</td><td>0.960±0.001</td><td>0.970±0.001</td><td>91.238±0.019</td><td>6.587±0.019</td><td>6.379±0.018</td><td>0.014±0.001</td><td>0.128±0.001</td></tr><tr><td>sge-WGD (ours)</td><td>0.960±0.001</td><td>0.970±0.001</td><td>91.312±0.016</td><td>6.562±0.007</td><td>6.363±0.009</td><td>0.012±0.001</td><td>0.128±0.001</td></tr><tr><td>ssge-WGD (ours)</td><td>0.968±0.001</td><td>0.979±0.001</td><td>91.198±0.024</td><td>6.522±0.009</td><td>6.610±0.012</td><td>0.012±0.001</td><td>0.130±0.001</td></tr><tr><td>kde-fWGD (ours)</td><td>0.971±0.001</td><td>0.980±0.001</td><td>91.260±0.011</td><td>7.079±0.016</td><td>6.887±0.015</td><td>0.015±0.001</td><td>0.125±0.001</td></tr><tr><td>sge-fWGD (ours)</td><td>0.969±0.001</td><td>0.978±0.001</td><td>91.192±0.013</td><td>7.076±0.004</td><td>6.900±0.005</td><td>0.015±0.001</td><td>0.125±0.001</td></tr><tr><td>ssge-fWGD (ours)</td><td>0.971±0.001</td><td>0.980±0.001</td><td>91.240±0.022</td><td>7.129±0.006</td><td>6.951±0.005</td><td>0.016±0.001</td><td>0.124±0.001</td></tr><tr><td rowspan=\"11\">CITIIIO</td><td>Deep ensemble 42</td><td>0.843±0.004</td><td>0.736±0.005</td><td>85,552±0.076</td><td>2.244±0.006</td><td>1.667±0.008</td><td>0.049±0.001</td><td>0.277±0.001</td></tr><tr><td>SVGD [51</td><td>0.825±0.001</td><td>0.710±0.002</td><td>85.142±0.017</td><td>2.106±0.003</td><td>1.567±0.004</td><td>0.052±0.001</td><td>0.287±0.001</td></tr><tr><td>fSVGD 回</td><td>0.783±0.001</td><td>0.712±0.001</td><td>84.510±0.031</td><td>1.968±0.004</td><td>1.624±0.003</td><td>0.049±0.001</td><td>0.292±0.001</td></tr><tr><td>hyper-DE [80]</td><td>0.789±0.001</td><td>0.743±0.001</td><td>84.743±0.011</td><td>1.951±0.010</td><td>1.690±0.015</td><td>0.046±0.001</td><td>0.288±0.001</td></tr><tr><td>kde-WGD (ours)</td><td>0.838±0.001</td><td>0.735±0.004</td><td>85.904±0.030</td><td>2.205±0.003</td><td>1.661±0.008</td><td>0.053±0.001</td><td>0.276±0.001</td></tr><tr><td>sge-WGD (ours)</td><td>0.837±0.003</td><td>0.725±0.004</td><td>85.792±0.035</td><td>2.214±0.010</td><td>1.634±0.004</td><td>0.051±0.001</td><td>0.275±0.001</td></tr><tr><td>ssge-WGD (ours)</td><td>0.832±0.003</td><td>0.731±0.005</td><td>85.638±0.038</td><td>2.182±0.015</td><td>1.655±0.001</td><td>0.049±0.001</td><td>0.276±0.001</td></tr><tr><td>kde-fWGD (ours)</td><td>0.791±0.002</td><td>0.758±0.002</td><td>84.888±0.030</td><td>1.970±0.004</td><td>1.749±0.005</td><td>0.044±0.001</td><td>0.282±0.001</td></tr><tr><td>sge-fWGD (ours)</td><td>0.795±0.001</td><td>0.754±0.002</td><td>84.766±0.060</td><td>1.984±0.003</td><td>1.729±0.002</td><td>0.047±0.001</td><td>0.288±0.001</td></tr><tr><td>ssge-fWGD (ours)</td><td>0.792±0.002</td><td>0.752±0.002</td><td>84.762±0.034</td><td>1.970±0.006</td><td>1.723±0.005</td><td>0.046±0.001</td><td>0.286±0.001</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>",
1095
+ "bbox": [
1096
+ 174,
1097
+ 180,
1098
+ 825,
1099
+ 393
1100
+ ],
1101
+ "page_idx": 8
1102
+ },
1103
+ {
1104
+ "type": "text",
1105
+ "text": "",
1106
+ "bbox": [
1107
+ 173,
1108
+ 421,
1109
+ 825,
1110
+ 518
1111
+ ],
1112
+ "page_idx": 8
1113
+ },
1114
+ {
1115
+ "type": "text",
1116
+ "text": "FashionMNIST classification Moving on to real-world data, we used an image classification setting using the FashionMNIST dataset $\\dot { \\left[ \\left| 8 3 \\right| \\right] }$ for training and the MNIST dataset $\\bar { \\mathbb { E } 3 } \\mathbb { I }$ as an out-ofdistribution (OOD) task. The results are reported in Table $^ 1 { } _ { . }$ (top). We can see that all our methods improve upon standard deep ensembles and SVGD, highlighting the effectiveness of our proposed repulsion terms when training neural network ensembles. In particular, the sge-WGD offers the best accuracy, whereas the methods in function space all offer a better OOD detection. This is probably due to the fact that these methods achieve a higher entropy ratio and functional diversity measured via the model disagreement when compared to their weight-space counterparts. Interestingly, they also reach the lowest NLL values. We can also notice how the model disagreement (MD) not only serves its purpose as a metric for the functional heterogeneity of the ensemble but also allows for a better OOD detection in comparison to the entropy. To the best of our knowledge, this insight has not been described before, although it has been used in continual learning $\\pmb { \\mathbb { B } } \\mathbf { \\mathbb { 1 } }$ . Interestingly, using this metric, the hyper-deep ensemble $[ \\textcircled { 8 0 } ]$ shows OOD detection performance comparable with our repulsive ensemble in function space. ",
1117
+ "bbox": [
1118
+ 173,
1119
+ 536,
1120
+ 825,
1121
+ 729
1122
+ ],
1123
+ "page_idx": 8
1124
+ },
1125
+ {
1126
+ "type": "text",
1127
+ "text": "CIFAR classification Finally, we use a ResNet32 architecture $\\mathbb { \\left| \\left[ 2 9 \\right] \\right| }$ on CIFAR-10 [41] with the SVHN dataset $\\mathbb { \\left[ 6 1 \\right] }$ as OOD data. The results are reported in Table 1 (bottom). We can see that in this case, the weight-space methods achieve better performance in accuracy and OOD detection using the entropy than the ones in function space. Nevertheless, all our repulsive ensembles improve functional diversity, accuracy, and OOD detection when compared to standard SVGD, whereas the standard deep ensemble achieves the best OOD detection using the entropy. ",
1128
+ "bbox": [
1129
+ 174,
1130
+ 746,
1131
+ 825,
1132
+ 829
1133
+ ],
1134
+ "page_idx": 8
1135
+ },
1136
+ {
1137
+ "type": "text",
1138
+ "text": "5 Related Work ",
1139
+ "text_level": 1,
1140
+ "bbox": [
1141
+ 174,
1142
+ 849,
1143
+ 321,
1144
+ 867
1145
+ ],
1146
+ "page_idx": 8
1147
+ },
1148
+ {
1149
+ "type": "text",
1150
+ "text": "The theoretical and empirical properties of SVGD have been well studied [40, 48, 13] and it can also be seen as a Wasserstein gradient flow of the KL divergence in the Stein geometry [16, 50] (see Appendix D for more details). Interestingly, a gradient flow interpretation is also possible for (stochastic gradient) MCMC-type algorithms $\\dot { \\left. \\overline { { 4 8 } } \\right. }$ , which can be unified under a general particle inference framework [10]. Moreover, our Wasserstein gradient descent using the SGE approximation can also be derived using an alternative formulation as a gradient flow with smoothed test functions [48]. A projected version of WGD has been studied in Wang et al. $\\mathbb { \\left. \\overline { { \\boldsymbol { \\mathscr { Q } } \\boldsymbol { \\cdot } \\boldsymbol { \\cdot } } } \\right. }$ , which could also be readily applied in our framework. Besides particle methods, Bayesian neural networks $\\pm \\pm \\infty$ have gained popularity recently [79, 22, 19, 36], using modern MCMC [59, 79, 22, 24, 21] and variational inference techniques [5, 72, 17, 34]. On the other hand, ensemble methods have also been extensively studied [42, 18, 82, 23, 80, 32, 85, 78].Moreover, repulsive interactions between the members have also been studied in Wabartha et al. [74]. Moreover, providing Bayesian interpretations for deep ensembles has been previously attempted through the lenses of stationary SGD distributions $[ \\sqrt { 5 6 } , \\sqrt ] { 8 } ]$ , ensembles of linear models $\\dot { \\bigtriangledown } 5 7 \\big |$ , additional random functions $\\boxed { 6 2 } , \\boxed { 1 2 } , \\boxed { 2 7 }$ , approximate inference $\\lVert 8 2 \\rVert$ , Stein variational inference [15], and marginal likelihood lower bounds $\\bar { \\| 5 3 \\| }$ , and ensembles have also been shown to provide good approximations to the true BNN posterior in some settings $\\left[ \\left[ 3 6 \\right] \\right]$ . Furthermore, variational inference in function space has recently gained attention $\\mathbb { \\ m }$ and the limitations of the KL divergence have been studied in Burt et al. [7]. ",
1151
+ "bbox": [
1152
+ 174,
1153
+ 882,
1154
+ 821,
1155
+ 911
1156
+ ],
1157
+ "page_idx": 8
1158
+ },
1159
+ {
1160
+ "type": "text",
1161
+ "text": "",
1162
+ "bbox": [
1163
+ 174,
1164
+ 90,
1165
+ 825,
1166
+ 313
1167
+ ],
1168
+ "page_idx": 9
1169
+ },
1170
+ {
1171
+ "type": "text",
1172
+ "text": "6 Conclusion ",
1173
+ "text_level": 1,
1174
+ "bbox": [
1175
+ 174,
1176
+ 330,
1177
+ 299,
1178
+ 348
1179
+ ],
1180
+ "page_idx": 9
1181
+ },
1182
+ {
1183
+ "type": "text",
1184
+ "text": "We have presented a simple and principled way to improve upon standard deep ensemble methods. To this end, we have shown that the introduction of a kernelized repulsion between members of the ensemble not only improves the accuracy of the predictions but—even more importantly—can be seen as Wasserstein gradient descent on the KL divergence, thus transforming the MAP inference of deep ensembles into proper Bayesian inference. Moreover, we have shown that incorporating functional repulsion between ensemble members can improve the quality of the estimated uncertainties on simple synthetic examples and OOD detection on real-world data and can approach the true Bayesian posterior more closely. ",
1185
+ "bbox": [
1186
+ 174,
1187
+ 361,
1188
+ 825,
1189
+ 472
1190
+ ],
1191
+ "page_idx": 9
1192
+ },
1193
+ {
1194
+ "type": "text",
1195
+ "text": "In future work, it will be interesting to study the impact of the Jacobian in the fWGD update and its implications on the Liouville equation in more detail, also compared to other neural network Jacobian methods, such as neural tangent kernels $\\pmb { \\Vert 3 7 } \\Vert$ and generalized Gauss-Newton approximations $\\boldsymbol { \\left[ \\left[ 3 5 \\right] \\right] }$ . Moreover, it would be interesting to derive explicit convergence bounds for our proposed method and compare them to the existing bounds for SVGD [40]. ",
1196
+ "bbox": [
1197
+ 174,
1198
+ 478,
1199
+ 825,
1200
+ 547
1201
+ ],
1202
+ "page_idx": 9
1203
+ },
1204
+ {
1205
+ "type": "text",
1206
+ "text": "Acknowledgments ",
1207
+ "text_level": 1,
1208
+ "bbox": [
1209
+ 176,
1210
+ 563,
1211
+ 303,
1212
+ 578
1213
+ ],
1214
+ "page_idx": 9
1215
+ },
1216
+ {
1217
+ "type": "text",
1218
+ "text": "VF would like to acknowledge financial support from the Strategic Focus Area “Personalized Health and Related Technologies” of the ETH Domain through the grant #2017-110 and from the Swiss Data Science Center through a PhD fellowship. We thank Florian Wenzel, Alexander Immer, Andrew Gordon Wilson, Pavel Izmailov, Christian Henning, and Johannes von Oswald for helpful discussions. We also thank Dr. Sheldon Cooper, Dr. Leonard Hofstadter and Penny Hofstadter for their support and inspiration. ",
1219
+ "bbox": [
1220
+ 174,
1221
+ 588,
1222
+ 825,
1223
+ 671
1224
+ ],
1225
+ "page_idx": 9
1226
+ },
1227
+ {
1228
+ "type": "text",
1229
+ "text": "References ",
1230
+ "text_level": 1,
1231
+ "bbox": [
1232
+ 174,
1233
+ 690,
1234
+ 266,
1235
+ 707
1236
+ ],
1237
+ "page_idx": 9
1238
+ },
1239
+ {
1240
+ "type": "text",
1241
+ "text": "[1] Charu C Aggarwal, Alexander Hinneburg, and Daniel A Keim. On the surprising behavior of distance metrics in high dimensional space. In International conference on database theory, pages 420–434. Springer, 2001. \n[2] Luigi Ambrosio and Gianluca Crippa. Continuity equations and ode flows with non-smooth velocity. Proceedings of the Royal Society of Edinburgh: Section A Mathematics, 144(6): 1191–1244, 2014. \n[3] Luigi Ambrosio, Nicola Gigli, and Giuseppe Savaré. Gradient flows: in metric spaces and in the space of probability measures. Springer Science & Business Media, 2008. \n[4] Vijay Badrinarayanan, Bamdev Mishra, and Roberto Cipolla. Symmetry-invariant optimization in deep networks. arXiv preprint arXiv:1511.01754, 2015. \n[5] Charles Blundell, Julien Cornebise, Koray Kavukcuoglu, and Daan Wierstra. Weight uncertainty in neural networks. arXiv preprint arXiv:1505.05424, 2015. ",
1242
+ "bbox": [
1243
+ 179,
1244
+ 713,
1245
+ 826,
1246
+ 911
1247
+ ],
1248
+ "page_idx": 9
1249
+ },
1250
+ {
1251
+ "type": "text",
1252
+ "text": "[6] Leo Breiman. Bagging predictors. Machine learning, 24(2):123–140, 1996. ",
1253
+ "bbox": [
1254
+ 179,
1255
+ 90,
1256
+ 707,
1257
+ 107
1258
+ ],
1259
+ "page_idx": 10
1260
+ },
1261
+ {
1262
+ "type": "text",
1263
+ "text": "[7] David R Burt, Sebastian W Ober, Adrià Garriga-Alonso, and Mark van der Wilk. Understanding variational inference in function-space. arXiv preprint arXiv:2011.09421, 2020. ",
1264
+ "bbox": [
1265
+ 178,
1266
+ 114,
1267
+ 823,
1268
+ 145
1269
+ ],
1270
+ "page_idx": 10
1271
+ },
1272
+ {
1273
+ "type": "text",
1274
+ "text": "[8] Pratik Chaudhari and Stefano Soatto. Stochastic gradient descent performs variational inference, converges to limit cycles for deep networks. In 2018 Information Theory and Applications Workshop (ITA), pages 1–10. IEEE, 2018. ",
1275
+ "bbox": [
1276
+ 178,
1277
+ 152,
1278
+ 823,
1279
+ 195
1280
+ ],
1281
+ "page_idx": 10
1282
+ },
1283
+ {
1284
+ "type": "text",
1285
+ "text": "[9] An Mei Chen, Haw-minn Lu, and Robert Hecht-Nielsen. On the geometry of feedforward neural network error surfaces. Neural computation, 5(6):910–927, 1993. ",
1286
+ "bbox": [
1287
+ 178,
1288
+ 204,
1289
+ 825,
1290
+ 234
1291
+ ],
1292
+ "page_idx": 10
1293
+ },
1294
+ {
1295
+ "type": "text",
1296
+ "text": "[10] Changyou Chen, Ruiyi Zhang, Wenlin Wang, Bai Li, and Liqun Chen. A unified particleoptimization framework for scalable bayesian sampling. arXiv preprint arXiv:1805.11659, 2018. ",
1297
+ "bbox": [
1298
+ 173,
1299
+ 242,
1300
+ 825,
1301
+ 285
1302
+ ],
1303
+ "page_idx": 10
1304
+ },
1305
+ {
1306
+ "type": "text",
1307
+ "text": "[11] Jiefeng Chen, Xi Wu, Yingyu Liang, Somesh Jha, et al. Robust out-of-distribution detection in neural networks. arXiv preprint arXiv:2003.09711, 2020. ",
1308
+ "bbox": [
1309
+ 173,
1310
+ 294,
1311
+ 825,
1312
+ 323
1313
+ ],
1314
+ "page_idx": 10
1315
+ },
1316
+ {
1317
+ "type": "text",
1318
+ "text": "[12] Kamil Ciosek, Vincent Fortuin, Ryota Tomioka, Katja Hofmann, and Richard Turner. Conservative uncertainty estimation by fitting prior networks. In International Conference on Learning Representations, 2019. ",
1319
+ "bbox": [
1320
+ 174,
1321
+ 332,
1322
+ 823,
1323
+ 375
1324
+ ],
1325
+ "page_idx": 10
1326
+ },
1327
+ {
1328
+ "type": "text",
1329
+ "text": "[13] Francesco D’Angelo and Vincent Fortuin. Annealed stein variational gradient descent. arXiv preprint arXiv:2101.09815, 2021. ",
1330
+ "bbox": [
1331
+ 173,
1332
+ 382,
1333
+ 821,
1334
+ 412
1335
+ ],
1336
+ "page_idx": 10
1337
+ },
1338
+ {
1339
+ "type": "text",
1340
+ "text": "[14] Francesco D’Angelo and Christian Henning. Uncertainty-based out-of-distribution detection requires suitable function space priors. arXiv preprint arXiv:2110.06020, 2021. ",
1341
+ "bbox": [
1342
+ 173,
1343
+ 421,
1344
+ 821,
1345
+ 450
1346
+ ],
1347
+ "page_idx": 10
1348
+ },
1349
+ {
1350
+ "type": "text",
1351
+ "text": "[15] Francesco D’Angelo, Vincent Fortuin, and Florian Wenzel. On stein variational neural network ensembles. arXiv preprint arXiv:2106.10760, 2021. ",
1352
+ "bbox": [
1353
+ 174,
1354
+ 458,
1355
+ 823,
1356
+ 488
1357
+ ],
1358
+ "page_idx": 10
1359
+ },
1360
+ {
1361
+ "type": "text",
1362
+ "text": "[16] A Duncan, Nikolas Nuesken, and Lukasz Szpruch. On the geometry of stein variational gradient descent. arXiv preprint arXiv:1912.00894, 2019. ",
1363
+ "bbox": [
1364
+ 173,
1365
+ 496,
1366
+ 823,
1367
+ 526
1368
+ ],
1369
+ "page_idx": 10
1370
+ },
1371
+ {
1372
+ "type": "text",
1373
+ "text": "[17] Michael W Dusenberry, Ghassen Jerfel, Yeming Wen, Yi-an Ma, Jasper Snoek, Katherine Heller, Balaji Lakshminarayanan, and Dustin Tran. Efficient and scalable bayesian neural nets with rank-1 factors. arXiv preprint arXiv:2005.07186, 2020. ",
1374
+ "bbox": [
1375
+ 174,
1376
+ 535,
1377
+ 823,
1378
+ 578
1379
+ ],
1380
+ "page_idx": 10
1381
+ },
1382
+ {
1383
+ "type": "text",
1384
+ "text": "[18] Stanislav Fort, Huiyi Hu, and Balaji Lakshminarayanan. Deep ensembles: A loss landscape perspective. arXiv preprint arXiv:1912.02757, 2019. ",
1385
+ "bbox": [
1386
+ 174,
1387
+ 587,
1388
+ 823,
1389
+ 616
1390
+ ],
1391
+ "page_idx": 10
1392
+ },
1393
+ {
1394
+ "type": "text",
1395
+ "text": "[19] Vincent Fortuin. Priors in bayesian deep learning: A review. arXiv preprint arXiv:2105.06868, 2021. ",
1396
+ "bbox": [
1397
+ 173,
1398
+ 625,
1399
+ 823,
1400
+ 654
1401
+ ],
1402
+ "page_idx": 10
1403
+ },
1404
+ {
1405
+ "type": "text",
1406
+ "text": "[20] Vincent Fortuin, Mark Collier, Florian Wenzel, James Allingham, Jeremiah Liu, Dustin Tran, Balaji Lakshminarayanan, Jesse Berent, Rodolphe Jenatton, and Effrosyni Kokiopoulou. Deep classifiers with label noise modeling and distance awareness. arXiv preprint arXiv:2110.02609, 2021. ",
1407
+ "bbox": [
1408
+ 174,
1409
+ 661,
1410
+ 826,
1411
+ 718
1412
+ ],
1413
+ "page_idx": 10
1414
+ },
1415
+ {
1416
+ "type": "text",
1417
+ "text": "[21] Vincent Fortuin, Adrià Garriga-Alonso, Mark van der Wilk, and Laurence Aitchison. Bnnpriors: A library for bayesian neural network inference with different prior distributions. Software Impacts, page 100079, 2021. ",
1418
+ "bbox": [
1419
+ 173,
1420
+ 727,
1421
+ 823,
1422
+ 771
1423
+ ],
1424
+ "page_idx": 10
1425
+ },
1426
+ {
1427
+ "type": "text",
1428
+ "text": "[22] Vincent Fortuin, Adrià Garriga-Alonso, Florian Wenzel, Gunnar Rätsch, Richard Turner, Mark van der Wilk, and Laurence Aitchison. Bayesian neural network priors revisited. arXiv preprint arXiv:2102.06571, 2021. ",
1429
+ "bbox": [
1430
+ 174,
1431
+ 779,
1432
+ 823,
1433
+ 821
1434
+ ],
1435
+ "page_idx": 10
1436
+ },
1437
+ {
1438
+ "type": "text",
1439
+ "text": "[23] Timur Garipov, Pavel Izmailov, Dmitrii Podoprikhin, Dmitry Vetrov, and Andrew Gordon Wilson. Loss surfaces, mode connectivity, and fast ensembling of dnns. arXiv preprint arXiv:1802.10026, 2018. ",
1440
+ "bbox": [
1441
+ 174,
1442
+ 830,
1443
+ 821,
1444
+ 875
1445
+ ],
1446
+ "page_idx": 10
1447
+ },
1448
+ {
1449
+ "type": "text",
1450
+ "text": "[24] Adrià Garriga-Alonso and Vincent Fortuin. Exact langevin dynamics with stochastic gradients. arXiv preprint arXiv:2102.01691, 2021. ",
1451
+ "bbox": [
1452
+ 173,
1453
+ 882,
1454
+ 820,
1455
+ 911
1456
+ ],
1457
+ "page_idx": 10
1458
+ },
1459
+ {
1460
+ "type": "text",
1461
+ "text": "[25] Mario Geiger, Arthur Jacot, Stefano Spigler, Franck Gabriel, Levent Sagun, Stéphane d’Ascoli, Giulio Biroli, Clément Hongler, and Matthieu Wyart. Scaling description of generalization with number of parameters in deep learning. Journal of Statistical Mechanics: Theory and Experiment, 2020(2):023401, 2020. \n[26] L. K. Hansen and P. Salamon. Neural network ensembles. IEEE Trans. Pattern Anal. Mach. Intell., 12(10):993–1001, October 1990. ISSN 0162-8828. doi: 10.1109/34.58871. URL https://doi.org/10.1109/34.58871. \n[27] Bobby He, Balaji Lakshminarayanan, and Yee Whye Teh. Bayesian deep ensembles via the neural tangent kernel. arXiv preprint arXiv:2007.05864, 2020. \n[28] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of the IEEE international conference on computer vision, pages 1026–1034, 2015. \n[29] 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. \n[30] Robert Hecht-Nielsen. On the algebraic structure of feedforward network weight spaces. In Advanced Neural Computers, pages 129–135. Elsevier, 1990. \n[31] Christian Henning, Maria R Cervera, Francesco D’Angelo, Johannes von Oswald, Regina Traber, Benjamin Ehret, Seijin Kobayashi, João Sacramento, and Benjamin F Grewe. Posterior meta-replay for continual learning. arXiv preprint arXiv:2103.01133, 2021. \n[32] Gao Huang, Yixuan Li, Geoff Pleiss, Zhuang Liu, John E Hopcroft, and Kilian Q Weinberger. Snapshot ensembles: Train 1, get m for free. arXiv preprint arXiv:1704.00109, 2017. \n[33] Gao Huang, Yixuan Li, Geoff Pleiss, Zhuang Liu, John E. Hopcroft, and Kilian Q. Weinberger. Snapshot ensembles: Train 1, get M for free. CoRR, abs/1704.00109, 2017. URL http: //arxiv.org/abs/1704.00109. \n[34] Alexander Immer, Matthias Bauer, Vincent Fortuin, Gunnar Rätsch, and Mohammad Emtiyaz Khan. Scalable marginal likelihood estimation for model selection in deep learning. arXiv preprint arXiv:2104.04975, 2021. \n[35] Alexander Immer, Maciej Korzepa, and Matthias Bauer. Improving predictions of bayesian neural nets via local linearization. In International Conference on Artificial Intelligence and Statistics, pages 703–711. PMLR, 2021. \n[36] Pavel Izmailov, Sharad Vikram, Matthew D Hoffman, and Andrew Gordon Wilson. What are bayesian neural network posteriors really like? arXiv preprint arXiv:2104.14421, 2021. \n[37] Arthur Jacot, Franck Gabriel, and Clément Hongler. Neural tangent kernel: convergence and generalization in neural networks. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, pages 8580–8589, 2018. \n[38] Richard Jordan, David Kinderlehrer, and Felix Otto. The variational formulation of the fokker– planck equation. SIAM journal on mathematical analysis, 29(1):1–17, 1998. \n[39] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. \n[40] Anna Korba, Adil Salim, Michael Arbel, Giulia Luise, and Arthur Gretton. A non-asymptotic analysis for stein variational gradient descent. Advances in Neural Information Processing Systems, 33, 2020. \n[41] Alex Krizhevsky et al. Learning multiple layers of features from tiny images. 2009. \n[42] Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In Advances in neural information processing systems, pages 6402–6413, 2017. \n[43] Yann LeCun. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/, 1998. \n[44] 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. \n[45] E. Levin, N. Tishby, and S. A. Solla. A statistical approach to learning and generalization in layered neural networks. Proc. of the IEEE – Special issue on Neural Networks, 1990. \n[46] Yingzhen Li and Richard E Turner. Gradient estimators for implicit models. arXiv preprint arXiv:1705.07107, 2017. \n[47] Shiyu Liang, Yixuan Li, and Rayadurgam Srikant. Enhancing the reliability of out-ofdistribution image detection in neural networks. arXiv preprint arXiv:1706.02690, 2017. \n[48] Chang Liu, Jingwei Zhuo, Pengyu Cheng, Ruiyi Zhang, and Jun Zhu. Understanding and accelerating particle-based variational inference. In International Conference on Machine Learning, pages 4082–4092. PMLR, 2019. \n[49] Jeremiah Zhe Liu, Zi Lin, Shreyas Padhy, Dustin Tran, Tania Bedrax-Weiss, and Balaji Lakshminarayanan. Simple and principled uncertainty estimation with deterministic deep learning via distance awareness. arXiv preprint arXiv:2006.10108, 2020. \n[50] Qiang Liu. Stein variational gradient descent as gradient flow. In Advances in neural information processing systems, pages 3115–3123, 2017. \n[51] Qiang Liu and Dilin Wang. Stein variational gradient descent: A general purpose bayesian inference algorithm. In Advances in neural information processing systems, pages 2378–2386, 2016. \n[52] Qiang Liu, Jason Lee, and Michael Jordan. A kernelized stein discrepancy for goodness-of-fit tests. In International conference on machine learning, pages 276–284. PMLR, 2016. \n[53] Clare Lyle, Lisa Schut, Robin Ru, Yarin Gal, and Mark van der Wilk. A bayesian perspective on training speed and model selection. Advances in Neural Information Processing Systems, 33, 2020. \n[54] David JC MacKay. A practical bayesian framework for backpropagation networks. Neural computation, 4(3):448–472, 1992. \n[55] Andrey Malinin, Bruno Mlodozeniec, and Mark Gales. Ensemble distribution distillation. arXiv preprint arXiv:1905.00076, 2019. \n[56] Stephan Mandt, Matthew D Hoffman, and David M Blei. Stochastic gradient descent as approximate bayesian inference. arXiv preprint arXiv:1704.04289, 2017. \n[57] Alexander G de G Matthews, Jiri Hron, Richard E Turner, and Zoubin Ghahramani. Samplethen-optimize posterior sampling for bayesian linear models. In NeurIPS Workshop on Advances in Approximate Bayesian Inference, 2017. \n[58] Mahdi Pakdaman Naeini, Gregory Cooper, and Milos Hauskrecht. Obtaining well calibrated probabilities using bayesian binning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 29, 2015. \n[59] Radford M Neal. Bayesian learning for neural networks. 1995. \n[60] Radford M Neal. Bayesian learning for neural networks, volume 118. Springer Science & Business Media, 2012. \n[61] Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. 2011. \n[62] Ian Osband, Benjamin Van Roy, Daniel J Russo, Zheng Wen, et al. Deep exploration via randomized value functions. J. Mach. Learn. Res., 20(124):1–62, 2019. ",
1462
+ "bbox": [
1463
+ 168,
1464
+ 42,
1465
+ 828,
1466
+ 915
1467
+ ],
1468
+ "page_idx": 11
1469
+ },
1470
+ {
1471
+ "type": "text",
1472
+ "text": "",
1473
+ "bbox": [
1474
+ 171,
1475
+ 56,
1476
+ 828,
1477
+ 919
1478
+ ],
1479
+ "page_idx": 12
1480
+ },
1481
+ {
1482
+ "type": "text",
1483
+ "text": "[63] Johannes Von Oswald, Seijin Kobayashi, Joao Sacramento, Alexander Meulemans, Christian Henning, and Benjamin F Grewe. Neural networks with late-phase weights. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum? id=C0qJUx5dxFb. ",
1484
+ "bbox": [
1485
+ 174,
1486
+ 90,
1487
+ 826,
1488
+ 148
1489
+ ],
1490
+ "page_idx": 13
1491
+ },
1492
+ {
1493
+ "type": "text",
1494
+ "text": "[64] Felix Otto. The geometry of dissipative evolution equations: the porous medium equation. 2001. ",
1495
+ "bbox": [
1496
+ 169,
1497
+ 155,
1498
+ 825,
1499
+ 184
1500
+ ],
1501
+ "page_idx": 13
1502
+ },
1503
+ {
1504
+ "type": "text",
1505
+ "text": "[65] Yaniv Ovadia, Emily Fertig, Jie Ren, Zachary Nado, David Sculley, Sebastian Nowozin, Joshua Dillon, Balaji Lakshminarayanan, and Jasper Snoek. Can you trust your model’s uncertainty? evaluating predictive uncertainty under dataset shift. In Advances in Neural Information Processing Systems, pages 13991–14002, 2019. ",
1506
+ "bbox": [
1507
+ 174,
1508
+ 193,
1509
+ 825,
1510
+ 248
1511
+ ],
1512
+ "page_idx": 13
1513
+ },
1514
+ {
1515
+ "type": "text",
1516
+ "text": "[66] Emanuel Parzen. On estimation of a probability density function and mode. The annals of mathematical statistics, 33(3):1065–1076, 1962. ",
1517
+ "bbox": [
1518
+ 173,
1519
+ 256,
1520
+ 823,
1521
+ 285
1522
+ ],
1523
+ "page_idx": 13
1524
+ },
1525
+ {
1526
+ "type": "text",
1527
+ "text": "[67] Alexandre Rame and Matthieu Cord. Dice: Diversity in deep ensembles via conditional redundancy adversarial estimation. arXiv preprint arXiv:2101.05544, 2021. ",
1528
+ "bbox": [
1529
+ 173,
1530
+ 292,
1531
+ 823,
1532
+ 321
1533
+ ],
1534
+ "page_idx": 13
1535
+ },
1536
+ {
1537
+ "type": "text",
1538
+ "text": "[68] Geoffrey Roeder, Luke Metz, and Diederik P Kingma. On linear identifiability of learned representations. arXiv preprint arXiv:2007.00810, 2020. ",
1539
+ "bbox": [
1540
+ 173,
1541
+ 329,
1542
+ 823,
1543
+ 359
1544
+ ],
1545
+ "page_idx": 13
1546
+ },
1547
+ {
1548
+ "type": "text",
1549
+ "text": "[69] Jiaxin Shi, Shengyang Sun, and Jun Zhu. A spectral approach to gradient estimation for implicit distributions. In International Conference on Machine Learning, pages 4644–4653. PMLR, 2018. ",
1550
+ "bbox": [
1551
+ 173,
1552
+ 366,
1553
+ 825,
1554
+ 409
1555
+ ],
1556
+ "page_idx": 13
1557
+ },
1558
+ {
1559
+ "type": "text",
1560
+ "text": "[70] Radhey S Singh. Improvement on some known nonparametric uniformly consistent estimators of derivatives of a density. The Annals of Statistics, pages 394–399, 1977. ",
1561
+ "bbox": [
1562
+ 173,
1563
+ 416,
1564
+ 823,
1565
+ 446
1566
+ ],
1567
+ "page_idx": 13
1568
+ },
1569
+ {
1570
+ "type": "text",
1571
+ "text": "[71] Shengyang Sun, Guodong Zhang, Jiaxin Shi, and Roger Grosse. Functional variational bayesian neural networks. arXiv preprint arXiv:1903.05779, 2019. ",
1572
+ "bbox": [
1573
+ 173,
1574
+ 454,
1575
+ 823,
1576
+ 483
1577
+ ],
1578
+ "page_idx": 13
1579
+ },
1580
+ {
1581
+ "type": "text",
1582
+ "text": "[72] Jakub Swiatkowski, Kevin Roth, Bastiaan S Veeling, Linh Tran, Joshua V Dillon, Stephan Mandt, Jasper Snoek, Tim Salimans, Rodolphe Jenatton, and Sebastian Nowozin. The k-tied normal distribution: A compact parameterization of gaussian mean field posteriors in bayesian neural networks. arXiv preprint arXiv:2002.02655, 2020. ",
1583
+ "bbox": [
1584
+ 174,
1585
+ 491,
1586
+ 826,
1587
+ 546
1588
+ ],
1589
+ "page_idx": 13
1590
+ },
1591
+ {
1592
+ "type": "text",
1593
+ "text": "[73] Johannes von Oswald, Christian Henning, João Sacramento, and Benjamin F. Grewe. Continual learning with hypernetworks. In International Conference on Learning Representations, 2020. URL https://arxiv.org/abs/1906.00695. ",
1594
+ "bbox": [
1595
+ 178,
1596
+ 555,
1597
+ 823,
1598
+ 598
1599
+ ],
1600
+ "page_idx": 13
1601
+ },
1602
+ {
1603
+ "type": "text",
1604
+ "text": "[74] Maxime Wabartha, Audrey Durand, Vincent François-Lavet, and Joelle Pineau. Handling black swan events in deep learning with diversely extrapolated neural networks. In IJCAI, pages 2140–2147, 2020. ",
1605
+ "bbox": [
1606
+ 176,
1607
+ 606,
1608
+ 823,
1609
+ 647
1610
+ ],
1611
+ "page_idx": 13
1612
+ },
1613
+ {
1614
+ "type": "text",
1615
+ "text": "[75] Yifei Wang, Peng Chen, and Wuchen Li. Projected wasserstein gradient descent for highdimensional bayesian inference. arXiv preprint arXiv:2102.06350, 2021. ",
1616
+ "bbox": [
1617
+ 174,
1618
+ 656,
1619
+ 823,
1620
+ 685
1621
+ ],
1622
+ "page_idx": 13
1623
+ },
1624
+ {
1625
+ "type": "text",
1626
+ "text": "[76] Ziyu Wang, Tongzheng Ren, Jun Zhu, and Bo Zhang. Function space particle optimization for bayesian neural networks. arXiv preprint arXiv:1902.09754, 2019. ",
1627
+ "bbox": [
1628
+ 173,
1629
+ 693,
1630
+ 825,
1631
+ 722
1632
+ ],
1633
+ "page_idx": 13
1634
+ },
1635
+ {
1636
+ "type": "text",
1637
+ "text": "[77] 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), pages 681–688, 2011. ",
1638
+ "bbox": [
1639
+ 176,
1640
+ 729,
1641
+ 825,
1642
+ 772
1643
+ ],
1644
+ "page_idx": 13
1645
+ },
1646
+ {
1647
+ "type": "text",
1648
+ "text": "[78] Yeming Wen, Dustin Tran, and Jimmy Ba. Batchensemble: an alternative approach to efficient ensemble and lifelong learning. arXiv preprint arXiv:2002.06715, 2020. ",
1649
+ "bbox": [
1650
+ 171,
1651
+ 780,
1652
+ 825,
1653
+ 809
1654
+ ],
1655
+ "page_idx": 13
1656
+ },
1657
+ {
1658
+ "type": "text",
1659
+ "text": "[79] Florian Wenzel, Kevin Roth, Bastiaan S Veeling, Jakub Swiatkowski, Linh Tran, Stephan Mandt, ´ Jasper Snoek, Tim Salimans, Rodolphe Jenatton, and Sebastian Nowozin. How good is the bayes posterior in deep neural networks really? arXiv preprint arXiv:2002.02405, 2020. ",
1660
+ "bbox": [
1661
+ 173,
1662
+ 818,
1663
+ 825,
1664
+ 861
1665
+ ],
1666
+ "page_idx": 13
1667
+ },
1668
+ {
1669
+ "type": "text",
1670
+ "text": "[80] Florian Wenzel, Jasper Snoek, Dustin Tran, and Rodolphe Jenatton. Hyperparameter ensembles for robustness and uncertainty quantification. In Advances in Neural Information Processing Systems, 2020. ",
1671
+ "bbox": [
1672
+ 174,
1673
+ 869,
1674
+ 825,
1675
+ 911
1676
+ ],
1677
+ "page_idx": 13
1678
+ },
1679
+ {
1680
+ "type": "text",
1681
+ "text": "[81] Christopher KI Williams. Computation with infinite neural networks. Neural Computation, 10 (5):1203–1216, 1998. \n[82] Andrew Gordon Wilson and Pavel Izmailov. Bayesian deep learning and a probabilistic perspective of generalization. arXiv preprint arXiv:2002.08791, 2020. \n[83] Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017. \n[84] Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. arXiv preprint arXiv:1611.03530, 2016. \n[85] Ruqi Zhang, Chunyuan Li, Jianyi Zhang, Changyou Chen, and Andrew Gordon Wilson. Cyclical stochastic gradient mcmc for bayesian deep learning. arXiv preprint arXiv:1902.03932, 2019. ",
1682
+ "bbox": [
1683
+ 173,
1684
+ 90,
1685
+ 828,
1686
+ 271
1687
+ ],
1688
+ "page_idx": 14
1689
+ }
1690
+ ]
parse/train/LAKplpLMbP8/LAKplpLMbP8_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/LAKplpLMbP8/LAKplpLMbP8_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/Xh5eMZVONGF/Xh5eMZVONGF.md ADDED
@@ -0,0 +1,501 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LANGUAGE-AGNOSTIC REPRESENTATION LEARNING OF SOURCE CODE FROM STRUCTURE AND CONTEXT
2
+
3
+ Daniel Zugner, Tobias Kirschstein ¨ Technical University of Munich {zuegnerd,kirschto}@in.tum.de
4
+
5
+ Michele Catasta
6
+ Stanford University
7
+ pirroh@cs.stanford.edu
8
+
9
+ Jure Leskovec Stanford University jure@cs.stanford.edu
10
+
11
+ Stephan Gunnemann ¨ Technical University of Munich guennemann@in.tum.de
12
+
13
+ # ABSTRACT
14
+
15
+ Source code (Context) and its parsed abstract syntax tree (AST; Structure) are two complementary representations of the same computer program. Traditionally, designers of machine learning models have relied predominantly either on Structure or Context. We propose a new model, which jointly learns on Context and Structure of source code. In contrast to previous approaches, our model uses only language-agnostic features, i.e., source code and features that can be computed directly from the AST. Besides obtaining state-of-the-art on monolingual code summarization on all five programming languages considered in this work, we propose the first multilingual code summarization model. We show that jointly training on non-parallel data from multiple programming languages improves results on all individual languages, where the strongest gains are on low-resource languages. Remarkably, multilingual training only from Context does not lead to the same improvements, highlighting the benefits of combining Structure and Context for representation learning on code.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Machine learning for code is an active and growing area of research which aims at building models that can learn semantically meaningful representations of programs. These embeddings can be used on downstream tasks, such as code generation, bug detection, or code summarization. We focus our work on two complementary data representations of programs: the source code (referred to as Context in this work), and the abstract syntax tree (AST; referred to as Structure). Traditionally, researchers and practitioners have decided to predominantly leverage either Structure or Context in their machine learning models. In this work, we show that jointly learning on Context and Structure improves representation learning on source code (see Fig. 1).
20
+
21
+ The source code representation naturally lends itself to models from natural language processing (NLP), e.g., long short-term memory networks (Hochreiter & Schmidhuber, 1997) (LSTM) or Transformers (Vaswani et al., 2017; Radford et al., 2019; Dai et al., 2019; Yang et al., 2019; Shaw et al., 2018). On the other hand, models leveraging the structure representations are typically based on graph neural networks (GNNs) (Kipf & Welling, 2017; Xu et al., 2019; Velickovi ˇ c et al., 2018; ´ You et al., 2019; Hamilton et al., 2017; Li et al., 2015; Klicpera et al., 2020). While the AST representation makes the highly structured nature of source code explicit to the models, since most GNNs use the message-passing framework, their learned representations are inherently local and struggle to leverage long-range interactions.
22
+
23
+ Recently, Hellendoorn et al. (2020) have explored models that can leverage several representations, including both Structure and Context. Their Graph Relational Embedding Attention Transformer (GREAT) extends Shaw et al. (2018), which biases the self-attention computation in a localized way given the underlying graph. The language-specific representations used by GREAT include a combination of the data flow graph, control flow graph, syntactic edges (inspired by Allamanis et al. (2018)), etc. which require specialized pipelines and static analysis tools to be obtained.
24
+
25
+ ![](images/7701ebd563c4ccbab0fb3932736f0a3f5ce8408d760ee36d22e78173cbc12d18.jpg)
26
+ Figure 1: Context and Structure both encapsulate valuable information about source code. In this realistic example, token 1 and 4 are distant in the sequence of tokens (Context), but only 5 hops away when traversing the Abstract Syntax Tree (Structure). As such, a method that relies only on the sequence of tokens could neglect the relationship between a method name and its return variable. Conversely, token 1 and 2 showcase the opposite setting. Hence, unifying Structure and Context leads to a more powerful representation of source code.
27
+
28
+ We propose the CODE TRANSFORMER1, which combines distances computed on Structure and Context in the self-attention operation. In contrast to the localized treatment via edges described above, we make the full Structure accessible to the model at each layer by computing pairwise distances on the AST, such as shortest path lengths. To this end, we draw inspiration from the XLNet architecture (Yang et al., 2019), which uses relative distances instead of absolute positions in the attention computation. Importantly, all our features are language-agnostic2, i.e., can easily be computed for any programming language based on the source code and AST.
29
+
30
+ We use two datasets comprising 5 different programming languages in total, and evaluate the representations learned by our model on the task of code summarization, where the model predicts a method’s name based on its body. Besides setting the state-of-the-art on all five languages for singlelanguage training, we also train the first multilingual model for code summarization. This is enabled by the fact that our model uses only language-agnostic features that can easily be obtained for any programming language. Remarkably, training our model on multiple programming languages substantially improves the performance on all languages. Moreover, multilingual training only from Context does not lead to the same improvements, highlighting the benefits of combining Structure and Context for representation learning on code.
31
+
32
+ # 2 RELATED WORK
33
+
34
+ Machine Learning for Code. Early research learned language models on raw text data, e.g., (Wang et al., 2016; Raychev et al., 2014; Dam et al., 2016), providing evidence for the naturalness assumption (Hindle et al., 2012). For example, Allamanis et al. (2015) learned distributed representations of variables and methods, finding that they were indeed able to encode common semantic properties from the regularities present in source code. Alon et al. (2019b) also found evidence of semantic arithmetic in their embedding space, dubbed code2vec. These representations—and their variants like (Mou et al., 2016)—can then be used to predict sequences of identifier sub-tokens (Allamanis et al., 2015) or API calls (Acharya et al., 2007; Nguyen et al., 2017). They can be used as advanced auto-completion tools (Hindle et al., 2012; Bhoopchand et al., 2016), including for user-provided tokens like Variable Names (Raychev et al., 2014; Allamanis et al., 2014). These are useful for deobfuscating Android applications (Bichsel et al., 2016) for example.
35
+
36
+ Several works leverage structured graphical models for probabilistic models of source code, usually through parse trees (Maddison & Tarlow, 2014; Bielik et al., 2016). Unlike previous works where hand-crafted features were used as node features (Raychev et al., 2014) or as explicit semantic edges (Allamanis et al., 2018), our work does not augment the existing syntactic relationships between the different elements to enhance the predictive capabilities of the model. Other approaches (Alon et al., 2018; Li et al., 2017) also leverage the AST structure, but linearize the graph by first traversing it.
37
+
38
+ Learning representations of structured languages. While models of language have dramatically improved in their ability to learn structure (syntax) and semantics from scratch, it can be argued that directly providing the model with the underlying structure of the language can help with generalization (Battaglia et al., 2018), managing long-ranging dependencies (Tai et al., 2015), or representing the compositional aspect of natural language (Socher et al., 2013). Notably, tree structures have shown promising results and inspired new architectures (Shen et al., 2019), including in the domain of source code (Fernandes et al., 2019), where the underlying syntax is directly available. Our work pursues this line of research, showing the benefits of explicitly integrating structural information as an inductive bias. Shiv & Quirk (2019) propose positional encodings for nodes on trees; however, their approach assumes regular trees, which is an unrealistic assumption when working with Abstract Syntax Trees, as an AST node can have arbitrarily many children, e.g., the arguments of a function.
39
+
40
+ Graph Neural Networks. GNNs provide a powerful tool for machine learning on graphs, thanks to their ability to recursively incorporate information from neighboring nodes in the network (Battaglia et al., 2018), naturally capturing the graph structure simultaneously with the nodes’ features. (Gori et al., 2005; Scarselli et al., 2008) are able to learn vector representations of nodes and graphs in an end-to-end fashion, encoding structural and feature information in the embedding space. Under this model, GNNs have achieved state-of-the-art performance across a variety of tasks, such as node classification (Kipf & Welling, 2017; Hamilton et al., 2017; Klicpera et al., 2019a), link prediction (Zhang & Chen, 2018; Schlichtkrull et al., 2018), graph clustering (Defferrard et al., 2016; Ying et al., 2018) or graph classification (Ying et al., 2018; Dai et al., 2016; Duvenaud et al., 2015).
41
+
42
+ # 3 INTEGRATING STRUCTURE AND CONTEXT IN THE CODE TRANSFORMER
43
+
44
+ Self-attention is the core operation powering the Transformer. It enables the model to selectively focus on relevant parts of the input. The matrix form equation for attention with a single head is
45
+
46
+ $$
47
+ { \mathrm { A t t e n t i o n } } ( Q , K , V ) = { \mathrm { s o f t m a x } } \left( { \frac { Q K ^ { T } } { \sqrt { d _ { k } } } } \right) V ,
48
+ $$
49
+
50
+ where $Q , K \in \mathbb { R } ^ { N \times d _ { k } }$ and $V \in \mathbb { R } ^ { N \times d _ { v } }$ . $N$ is the number of input tokens, $d _ { k }$ the key dimension, and $d _ { v }$ the value dimension (typically we have $d _ { k } = d _ { v }$ ). The attention score of query $Q _ { i }$ and key $K _ { j }$ before softmax is
51
+
52
+ $$
53
+ \pmb { A } _ { i j } = \pmb { Q } _ { i } ^ { T } \pmb { K } _ { j } = \pmb { E } _ { i } ^ { T } \pmb { W } _ { q } ^ { T } \pmb { W } _ { k } \pmb { E } _ { j } ,
54
+ $$
55
+
56
+ where $E _ { i } , E _ { j } \in \mathbb { R } ^ { d }$ are the $d$ -dimensional embeddings of tokens $i$ and $j$ , and $W _ { q }$ , $W _ { k } \in \mathbb { R } ^ { d _ { k } \times d }$ are the query and key projection matrices, respectively.
57
+
58
+ Observe that Eq. (2) contains no assumption about potential structure in the input domain: in the attention operation we compute all dot products of query and key vectors equally, effectively viewing them as unordered sets of vectors. This means, however, that the model is oblivious to structured inputs (such as text or graphs) and therefore is unable to distinguish, for example, a variable name occurring as an argument and in the return statement of a method.
59
+
60
+ In NLP, it is common to bias Transformers towards sequential inputs by adding positional encodings to the token embeddings. These positional encodings are obtained by applying an encoding function $\phi : \mathbb { R } \to \mathbb { R } ^ { d }$ to each token’s position $p _ { i }$ . These positional encodings make the information about the sequence of tokens available to the model. Eq. (2) becomes:
61
+
62
+ $$
63
+ A _ { i j } = ( E _ { i } + \phi ( p _ { i } ) ) ^ { T } W _ { q } ^ { T } W _ { k } ( E _ { j } + \phi ( p _ { j } ) ) , ,
64
+ $$
65
+
66
+ which factorizes into
67
+
68
+ $$
69
+ A _ { i j } = \underbrace { { E } _ { i } ^ { T } W _ { q } ^ { T } W _ { k } } _ { ( \mathrm { u } ) { A } _ { i j } ^ { \mathrm { c e } } } { + \underbrace { { E } _ { i } ^ { T } W _ { q } ^ { T } W _ { k } { \phi } ( p _ { j } ) } _ { ( \mathrm { b } ) { A } _ { i j } ^ { \mathrm { c p } } } } + \underbrace { { \phi } ( p _ { i } ) ^ { T } W _ { q } ^ { T } W _ { k } { E } _ { j } } _ { ( \mathrm { c } ) { A } _ { i j } ^ { \mathrm { c e } } } { + \underbrace { { { \phi } ( p _ { i } ) } ^ { T } W _ { q } ^ { T } W _ { k } { \phi } ( p _ { j } ) } _ { ( \mathrm { d } ) { A } _ { i j } ^ { \mathrm { p } } } } .
70
+ $$
71
+
72
+ We can interpret the terms (a)-(d) as follows. (a) ${ \cal { A } } _ { i j } ^ { \mathrm { c c } }$ is the contribution from the ‘match’ between the content embeddings of tokens $i$ and $j$ ; (b) $A _ { i j } ^ { \mathrm { c p } }$ steers the attention towards certain positions based
73
+
74
+ on the content of token $i$ ; (c) $A _ { i j } ^ { \mathrm { p c } }$ biases towards content embeddings based on the position of token $i$ ; (d) $A _ { i j } ^ { \mathrm { p p } }$ controls which positions should attend to which other positions.
75
+
76
+ In our model, we adopt the formulation of Dai et al. (2019); Yang et al. (2019). They modify Eq. (4) by replacing the absolute position encodings $\phi ( p _ { i } )$ with relative position encodings $\phi ( r _ { i \to j } )$ :
77
+
78
+ $$
79
+ \begin{array} { r } { A _ { i j } ^ { \mathrm { r e l } } = \ E _ { i } ^ { T } W _ { q } ^ { T } W _ { k } E _ { j } + E _ { i } ^ { T } W _ { q } ^ { T } W _ { r } \phi ( r _ { i j } ) + u ^ { T } W _ { k } E _ { j } + v ^ { T } W _ { r } \phi ( r _ { i j } ) , } \end{array}
80
+ $$
81
+
82
+ where $r _ { i \to j }$ is the relative distance from token $i$ to token $j$ in the sequence, $\boldsymbol { u } , \boldsymbol { v } \in \mathbb { R } ^ { d _ { k } }$ are learnable bias vectors, and $W _ { r }$ is a key projection matrix for the relative distances. Besides fixing issues with absolute position encodings such as ambiguity when processing two sentences at a time, Eq. (5) enables native application of the powerful self-attention operation on domains such as graphs, where absolute coordinates are not available. We adopt the (non-trainable) sinusoidal encoding function proposed by (Vaswani et al., 2017) for all relations; see Appendix A.1 for details on the distance encoding function.
83
+
84
+ # 3.1 INTEGRATING SOURCE CODE AND AST REPRESENTATIONS OF PROGRAMS.
85
+
86
+ To enable the model to integrate information both the Context and Structure of programs, we modify Eq. (5) to be able to incorporate multiple different relations. To this end, we use one key projection matrix W (s)r per relation $s$ , and sum their contributions in the raw attention score. This enables the CODE TRANSFORMER to combine information from multiple relations between tokens in the attention computation. Besides the token distance in the Context, we include pairwise relations based on the AST as described in the following. See Fig. 2 for a visualization of the Structure distances we use.
87
+
88
+ Shortest path length. We include the number of hops required to reach node $j$ starting from node $i$ and vice versa. Here, we treat the AST as an undirected graph, since otherwise most distances would be undefined: e.g., all other nodes in the AST would be unreachable from the leaves.
89
+
90
+ Similar to the distance of two tokens on the source code sequence, the shortestpath length is a global distance. This makes the whole graph structure acces
91
+
92
+ ![](images/971f2174ff96f3b5b7aea4b5cb4f59f9af4bf791dc6a632edbb218691a5d22cf.jpg)
93
+ Figure 2: Structure distances used by our model.
94
+
95
+ sible to the model at each layer. In contrast, Hellendoorn et al. (2020) add bias terms to the attention computation only for edges (i.e. shortest-path distance of 1), which is a local operation that only exchanges information between immediate neighbors (similar to message passing in GNNs). The equivalent localized operation on the source code sequence would be to treat the sequence as a chain graph and only compute attention terms for neighboring tokens, which in turn highlights the benefit of non-local attention operations.
96
+
97
+ Ancestor distance. Since we treat the ASTs as undirected for the computation of the shortest-path length, we lose the direction information of the edges. To avoid this, we also include the distance on the ordered set of ancestors and descendants of a node in the AST (red arrow in Fig. 2). Again, we include number of (vertical) hops to avoid locality in the attention computation. For example, a node $r _ { i \to j } = 2$ for “grand-children” $j$ of $i$ , and $r _ { j i } = - 2$ in the other direction.
98
+
99
+ Sibling distance. The neighbor sets in graphs are typically considered to be unordered, but in an AST, the order of children encodes their order of occurrence in the source code. To avoid information loss when encoding the AST, we further include the distance on the ordered set of siblings $\{ v _ { i } \}$ of a node, where we again avoid locality by encoding the number of hops, i.e. $r _ { v _ { 1 } v _ { 3 } } ~ = ~ 2$ and rv3→v1 = −2.
100
+
101
+ Personalized PageRank (Page et al., 1999) (PPR). PPR is a well-studied proximity measure which has been shown to be very effective in learning with graphs (Klicpera et al., 2019a;b; Bojchevski et al., 2020). PPR captures the local graph structure around a pair of nodes $( i , j )$ . E.g., if $i$ has many neighbors, its PPR score for $j$ will be low even when they are only few hops apart, which complements the purely hop-based distances described above.
102
+
103
+ ![](images/2ae4d77322414ffc49b55c0b5e39c6d3b3d0f5b89a9cfca8c5f81d4390780d66.jpg)
104
+ Figure 3: Left: Sequence (Context) and AST (Structure) representation of an input code snippet. Center: The CODE TRANSFORMER jointly leverages the sequence of tokens and the Abstract Syntax Tree to learn expressive representations of source code. In addition to the input token and node embeddings the model uses different distances between the tokens, e.g., shortest paths on the AST or personalized PageRank, to reason about their relative positions. The output embeddings can be used for downstream tasks such as code summarization (right).
105
+
106
+ Input embeddings to the model. To combine the Context and Structure information, we assign each token in the sequence to an AST node by selecting the AST node whose range in the source code is the shortest one containing the token. We concatenate the (sub-) token embeddings with the embedding of the token’s assigned AST node type as well as the token type returned by the tokenizer. That is, among all the internal nodes, we use as input only those corresponding to a token in the sequence; however, the remaining internal nodes can used by the model since their presence affects the distances between the remaining AST nodes. See Appendices A.3 and A.4 for details.
107
+
108
+ # 3.2 EFFICIENT RELATIVE ATTENTION COMPUTATION.
109
+
110
+ Na¨ıvely, we need to compute and materialize a tensor of dimension $N \times N \times d$ to hold all pairwise relative position encodings $\phi ( r _ { i \to j } )$ in Eq. (5) , where $N$ is the input length. This is prohibitive for fast GPU training. While for discrete distance values (e.g., sequence distance or shortest-path length on a graph) we only need to compute unique distance values occurring in the input, this does not generalize to continuous distances such as PPR. Therefore, we propose a constant-time approximation of the relational attention computation by grouping the values into $k \ll N ^ { 2 }$ bins. Since closer samples are typically more relevant for a query sample, we increase the bin widths exponentially with growing distance values. Throughout our experiments we have found the CODE TRANSFORMER to be relatively insensitive to the number of bins; we thus set $k = 3 2$ in our experiments.
111
+
112
+ # 4 EXPERIMENTAL SETUP
113
+
114
+ Code summarization is one of the most popular tasks in machine learning for code. Given the body of a function, the task is to predict the function’s name. As observed by Alon et al. (2019b) and Allamanis et al. (2016), this is a useful benchmark as method names in open-source projects tend to be precise and descriptive, and functions typically form complete logical units. See Fig. 3 (right) for a visual overview of the task. We use two complementary representations of programs: the source code as a sequence of tokens (Context) and the AST (Structure). As shown in Fig. 3 (left), tokens that are far away on the sequence may be very close on the AST and vice versa. In this task we make use of the CODE TRANSFORMER’s ability jointly leverage both Structure and Context and show that it improves learning. Further, we show the benefit of using only language-agnostic features in our model by training the first multilingual model for code summarization.
115
+
116
+ Datasets. To highlight the benefit of only relying on language-agnostic representations such as source code and abstract syntax trees, we evaluate on challenging datasets in four programming languages introduced in the CodeSearchNet (CSN) Challenge (Husain et al., 2019): Python, Javascript, Go, and Ruby. Similar to Java-small, the datasets from CodeSearchNet have been carefully deduplicated by the creators to avoid data leakage from the training set, e.g., via copy-and-paste code.
117
+
118
+ We further evaluate on Java-small (Allamanis et al., 2016), a popular and challenging code summarization dataset. It contains 11 open-source Java projects. We use the split as in Alon et al. (2019a), where 9 of these projects are used for training, one for validation, and one for test. The dataset contains roughly 700K samples (function definitions). Moreover, we also experiment with pre-training our model on Java-medium and Java-large (Alon et al., 2019a) before fine-tuning on Java-small, making sure to avoid leakage by removing the test and validation projects of Java-small from the pre-training dataset. See Table 1 for a summary of the datasets we use in this work.
119
+
120
+ <table><tr><td></td><td colspan="3">Samples per partition</td></tr><tr><td>Dataset</td><td>Train</td><td>Val.</td><td>Test</td></tr><tr><td>CSN-Python</td><td>412,178</td><td>23,107</td><td>22,176</td></tr><tr><td>CSN-Javascript</td><td>123,889</td><td>8,253</td><td>6,483</td></tr><tr><td>CSN-Ruby</td><td>48,791</td><td>2,209</td><td>2,279</td></tr><tr><td>CSN-Go</td><td>317,832</td><td>14,242</td><td>14,291</td></tr><tr><td>Java-small</td><td>691,974</td><td>23,844</td><td>57,088</td></tr></table>
121
+
122
+ Table 1: Dataset statistics.
123
+
124
+ Preprocessing. Each token of the source code is split into subtokens respective to code naming conventions, i.e., get TrainingData is converted to [get, training, data]. Following Alon et al. (2019a) we use at most six subtokens for the method names, truncating longer function names if necessary. In addition to the tokenized source code we produce an AST for each method using the open-source AST parser Semantic3. We limit the vocabulary to subtokens with at least 100 occurrences in the training set, and only consider snippets with 512 or fewer tokens (after removing punctuation). We refer the reader to the appendix for further details on the data preprocessing.
125
+
126
+ Pointer network. We add a pointer network (Vinyals et al., 2015) (as described in Fernandes et al. (2019)) to the decoders of all Transformer-based models. This enables them to enhance their predictions by pointing at positions in the input sequence. For instance, when predicting the method name get url, the model can point directly to occurrences of the variable url. This often improves results for less frequent tokens, and even enables the model to predict tokens which are not in the vocabulary by pointing at their positions in the input.
127
+
128
+ Baselines. We compare with code2seq (Alon et al., 2019a), the Graph Relational Embedding Attention Transformer (GREAT) (Hellendoorn et al., 2020), and the BiLSTM+GNN LSTM+Pointer model presented in Fernandes et al. (2019). Code2seq is a non-Transformer model and state of the art for code summarization using only AST information. GREAT is a recent Transformer model using the framework presented in (Shaw et al., 2018) to bias the attention via edges. In the original formulation, GREAT additionally uses hand-crafted, language-specific edges such as dataflow, ‘computed from’, or ‘next lexical use’ edges, which require specialized preprocessing and static analysis tools. While this approach of leveraging language-specific features can certainly improve results on specific tasks and programming languages, our goal is to have a flexible model that can be used on any programming language. Since the specialized preprocessing used by GREAT is proprietary and not public, we produce the results for GREAT using edges from the AST instead, i.e. it has access to the same information as our proposed model. Note that the preprocessing of Fernandes et al. (2019) is language specific, which is why we only compare with their results on Java-small.
129
+
130
+ # 5 RESULTS
131
+
132
+ # 5.1 MONOLINGUAL CODE SUMMARIZATION
133
+
134
+ CSN dataset. First, we study the performance (measured by F1 score) of our model and the baselines on the traditional setting, where training and evaluation are performed on a single programming language. The results are shown in the upper part of Table 2. The CODE TRANSFORMER (without multi-language training) substantially outperforms all other models on all but one language, highlighting the effectiveness of jointly learning from Structure and Context. The only exception is Ruby, where it performs on par with its Context-only variant. We attribute this to the fact that there are relatively few samples in the Ruby dataset, and that Ruby is an dynamically typed language, which could make the Structure less powerful for learning. Interestingly, the Context-only CODE TRANSFORMER outperforms GREAT on all languages. We attribute this to the fact that GREAT uses the Structure of the programs only in a localized way (see Sec. 3.1). Another noteworthy finding is that code2seq performs comparably to the Transformer-based baselines on Go. We hypothesize that ASTs are more informative on Go since it is a compiled and strongly typed language.
135
+
136
+ Table 2: Code summarization results on the CSN dataset (micro F1).
137
+
138
+ <table><tr><td rowspan="2">Model</td><td colspan="3">Python</td><td colspan="3">Javascript</td><td colspan="3">Ruby</td><td colspan="3">Go</td></tr><tr><td>Prec.</td><td>Rec.</td><td>F1</td><td>Prec.</td><td>Rec.</td><td>F1</td><td>Prec.</td><td>Rec.</td><td>F1</td><td>Prec.</td><td>Rec.</td><td>F1</td></tr><tr><td>code2seq</td><td>35.79</td><td>24.85</td><td>29.34</td><td>30.18</td><td>19.88</td><td>23.97</td><td>23.23</td><td>10.31</td><td>14.28</td><td>52.30</td><td>43.43</td><td>47.45</td></tr><tr><td>GREAT</td><td>35.07</td><td>31.59</td><td>33.24</td><td>31.20</td><td>26.84</td><td>28.86</td><td>24.64</td><td>22.23</td><td>23.38</td><td>50.01</td><td>46.51</td><td>48.20</td></tr><tr><td>Ours w/o structure</td><td>37.38</td><td>31.98</td><td>34.47</td><td>33.17</td><td>26.70</td><td>29.59</td><td>29.85</td><td>25.87</td><td>27.72</td><td>51.78</td><td>47.57</td><td>49.59</td></tr><tr><td>Ours w/o pointer net</td><td>37.74</td><td>31.85</td><td>34.55</td><td>33.12</td><td>28.70</td><td>30.75</td><td>23.32</td><td>25.21</td><td>24.23</td><td>54.31</td><td>50.12</td><td>52.13</td></tr><tr><td>Ours</td><td>36.40</td><td>33.66</td><td>34.97</td><td>35.06</td><td>29.61</td><td>32.11</td><td>31.42</td><td>24.46</td><td>27.50</td><td>55.10</td><td>48.05</td><td>51.34</td></tr><tr><td>code2seq (Multilanguage)</td><td>34.49</td><td>25.49</td><td>29.32</td><td>31.62</td><td>22.16</td><td>26.06</td><td>23.97</td><td>17.06</td><td>19.93</td><td>52.70</td><td>44.36</td><td>48.17</td></tr><tr><td>GREAT (Multilanguage)</td><td>36.75</td><td>31.54</td><td>33.94</td><td>33.58</td><td>27.78</td><td>30.41</td><td>30.05</td><td>24.33</td><td>26.89</td><td>52.65</td><td>48.30</td><td>50.38</td></tr><tr><td>Ours w/o structure (Mult.)</td><td>38.48</td><td>30.14</td><td>33.80</td><td>35.38</td><td>27.41</td><td>30.89</td><td>32.61</td><td>26.76</td><td>29.40</td><td>55.03</td><td>47.34</td><td>50.90</td></tr><tr><td>Ours w/o pointer (Mult.)</td><td>38.91</td><td>33.12</td><td>35.78</td><td>37.21</td><td>29.75</td><td>33.07</td><td>34.52</td><td>27.31</td><td>30.50</td><td>56.07</td><td>50.76</td><td>53.28</td></tr><tr><td>Ours (Multilanguage)</td><td>38.89</td><td>33.82</td><td>36.18</td><td>36.95</td><td>29.98</td><td>33.10</td><td>33.93</td><td>28.94</td><td>31.24</td><td>56.00</td><td>50.44</td><td>53.07</td></tr><tr><td>Ours (Mult.+ Finetune)</td><td>39.85</td><td>32.79</td><td>35.98</td><td>37.00</td><td>29.79</td><td>33.00</td><td>35.85</td><td>27.75</td><td>31.28</td><td>55.63</td><td>51.12</td><td>53.28</td></tr><tr><td>Ours (Mult. + LM Pretrain)</td><td>39.67</td><td>35.29</td><td>37.35</td><td>37.06</td><td>31.94</td><td>34.31</td><td>35.19</td><td>29.36</td><td>32.01</td><td>57.73</td><td>51.89</td><td>54.65</td></tr></table>
139
+
140
+ Java-small results. In Table 3 we present code summarization results on the Java-small dataset. Among all models equipped with a pointer network, the CODE TRANSFORMER (without pretraining) obtains state-of-the-art on code summarization, outperforming all baselines, including the previous state-of-the-art on Java-small proposed by Fernandes et al. (2019). Further, pre-training on Java-medium and Java-large on the permutation language modeling objective (Yang et al., 2019) substantially improves precision, recall, and F1 score after fine-tuning on Java-small. To avoid leakage, we exclude the projects used in the validation and test splits of Java-small from pre-training.
141
+
142
+ Ablation study. We further perform ablations where we remove our model’s access to the Context or Structure, also presented in Table 3.
143
+
144
+ With pointer network. We find that both ablations lead to a substantial drop in performance, highlighting the benefit of learning jointly from Structure and Context. Interestingly, the model without access to the Structure performs slightly better than the variant without Context. Note that our model without Structure is related to the XLNet (Yang et al., 2019) model, where we add a pointer network to the decoder and concatenate the token types to their respective input tokens (see Appendix A.4). Without pointer network. We repeat the ablation on the variants without pointer network. Here, the variant without Context performs better than the variant without Structure,
145
+
146
+ <table><tr><td>Model</td><td>Prec.</td><td>Rec.</td><td>F1</td></tr><tr><td>Without pointer net code2seq Ours w/o structure Ours w/o context</td><td>51.23 50.70 51.81</td><td>37.31 45.49 46.04</td><td>43.18 47.96</td></tr><tr><td>Ours With pointer net</td><td>50.33</td><td>46.80</td><td>48.75 48.50</td></tr><tr><td>Fernandes et al. (2019)</td><td>=</td><td>1</td><td>51.4</td></tr><tr><td>GREAT Ours w/o structure</td><td>53.60</td><td>46.41</td><td>49.75</td></tr><tr><td>Ours w/o context</td><td>55.48</td><td>46.07</td><td>50.34</td></tr><tr><td></td><td>54.45</td><td>45.29</td><td>49.45</td></tr><tr><td>Ours</td><td>54.85</td><td>49.84</td><td>52.22</td></tr><tr><td>Ours + Pretrain</td><td>57.02</td><td>50.87</td><td>53.77</td></tr></table>
147
+
148
+ Table 3: Results on Java-small and ablation study.
149
+
150
+ indicating that the pointer network helps to compensate for the lack of access to Structure. The Structure-only variant (w/o pointer net) of our model even outperforms the full variant in this scenario. Inspection of the results revealed that the Structure-only variant has better performance on longer method names, which have an outsize influence on the micro-F1 score used in this work.
151
+
152
+ Ablation of the AST-based distances. In Table 4 we compare the performance of our model when trained with each of the four different AST distances (sibling shortest paths, ancestor shortest paths, shortest paths, personalized PageRank; see Section 3.1). Here, the model is trained on Java-small in the Structure-only setting and without pointer network. For reference, we also show the results of training our model using all four AST distance functions (c.f. Table 3). We find that, while the personalized PageRank distance performs best on its own, each of the individual distances on their own performs substantially worse than their combination, highlighting the usefulness of combining the distances in our model as well as their complementary nature.
153
+
154
+ # 5.2 MULTILINGUAL CODE SUMMARIZATION
155
+
156
+ Setup. A key contribution of our proposed architecture is that it only uses language-agnostic features, i.e. the source code and features that can be directly computed from the AST. We use this fact to study the first multilanguage code summarization model. We train our model jointly on Python, Javascript, Ruby, and Go. The shared sub-token vocabulary is the union of the individual vocabularies, enabling us to evaluate the multi-language model on the individual languages and compare with the single-language models. As proposed by Conneau & Lample (2019), we add a learned language embedding to each input embedding.
157
+
158
+ Table 4: AST distance ablation study.
159
+
160
+ <table><tr><td>AST distance</td><td>F1 score</td></tr><tr><td>Sibling shortest paths</td><td>46.17</td></tr><tr><td>Ancestor shortest paths</td><td>47.89</td></tr><tr><td>Shortest paths</td><td>47.76</td></tr><tr><td>Personalized PageRank</td><td>48.47</td></tr><tr><td>All the above (c.f. Table 3)</td><td>48.75</td></tr></table>
161
+
162
+ Results. In the lower part of Table 2 we can see the results of training our CODE TRANSFORMER jointly on all four programming languages. Our multi-lingual variants substantially outperform the mono-lingual models on all languages. The strongest improvement is on Ruby, which is also the programming language with the smallest number of samples in the dataset. Fine-tuning on the individual languages after joint training on code summarization only has a marginal effect on performance, indicating that the multilingual objective is well-aligned with the individual languages. In the last row, we have a variant of our model where we pre-train on the multi-lingual masked language modeling task, followed by finetuning on code summarization on the individual languages.
163
+
164
+ Further, we observe that similar to the results on Java-small, removing the pointer network generally leads to weaker performance. One notable exception is Go, where the variant without the pointer network performs better in terms of F1 score. Our investigation revealed that there seems to be some violation of the i.i.d. assumption in the split provided by the creators of the dataset. In Figure 7 we show that in the test partition of the Go dataset, the share of tokens from the labels also occurring in the methods’ bodies – exactly the scenario where the pointer network can improve predictions – is substantially lower compared to the train/validation partitions.
165
+
166
+ Remarkably, the multi-language Context-only variant (i.e. without access to the Structure) performs substantially worse than the full multi-language variant. This highlights that Structure is crucial to exploit the commonalities of different programming languages. Also notably, the GREAT baseline’s results also improve substantially when trained in the multi-language setting, though it is still outperformed by our model. However, our results indicate that any representation learning model for code can benefit from multi-language training, especially when evaluating on low-resource languages.
167
+
168
+ In Table 16 we present results using the sample-F1 score. At the time of submission, our monolingual model on Python outperforms the state of the art on the ogbg-code $2 ^ { 4 }$ (Hu et al., 2020) leaderboard by $112 \%$ , and our multilanguage variant with LM pretraining outperforms it by $122 \%$ .
169
+
170
+ Qualitative analysis of multilingual representations. Learning the CODE TRANSFORMER on multiple programming languages jointly provides us with embeddings in a shared representation space. In Fig. 4 we show a t-SNE (Maaten & Hinton, 2008) visualization of the ca. 40,000 snippets from the validation sets of four programming languages from the CSN dataset. For the embedding of a snippet, we use the representation of the method name in the final layer of the encoder. Note that the true method names are masked, i.e., inaccessible to the model. Further, note that in contrast to the monolingual embeddings learned by Kanade et al. (2020), the embeddings we evaluate are learned on the task of code summarization (though a similar study could be performed by using our model that was trained on the traditional language modeling pretraining task on multiple languages).
171
+
172
+ While snippets from the same language tend to be grouped together, there are interesting intersections of the different programming languages. For example, we highlight all methods whose names start with the subtoken parse or main. We see that snippets starting with parse are predominantly in an intersection region of Python and Javascript. From these snippets, we display the cross-language pair with smallest Euclidean embedding distance in Fig. 5. Remarkably, both snippets are effectively the same method in Javascript and Python – it is worth reminding that the model has never seen any parallel data during training. On the other hand, snippets starting with main tend to lie at an intersectional region of Python, Javascript, and Go. In Table 6 in the appendix we show additional cross-lingual pairs with similar embeddings, including a failure case of a main function, where embedding distance is not representative of semantic similarity. We attribute this to the fact that we used the encoder output embedding of the masked method name – the representation used by the decoder to predict the method name – as a snippet’s representation. Thus, snippets with completely different semantics (as is to be expected for very generic method names starting with main) have similar representations because they are predictive of the method name.
173
+
174
+ ![](images/e875f6f92fb5baf876c7eada99cff2f2f6a1ae4c2907de273c6e3de07dd8a6a8.jpg)
175
+ Figure 4: t-SNE visualization of the CODE TRANSFORMER’s learned multilingual representations.
176
+
177
+ ![](images/b4f73ecaf41d7a935e9b22345a3d4464c58d6b6b17f19a5180425db1c0483a08.jpg)
178
+ Figure 5: Example snippet starting with parse (left) and its best embedding match from other languages (right). Both methods parse an input string to convert it into a boolean value. Note that even though they are semantically very similar, their method names are not; nonetheless, their representations in the CODE TRANSFORMER encoder reflect their semantic similarity.
179
+
180
+ As another qualitative insight into the representations learned by the CODE TRANSFORMER we have found that the language embeddings of languages with similar roots in language design are close; see Table 5 in the appendix for the pairwise similarity matrix of the learned language embeddings.
181
+
182
+ # 6 CONCLUSION
183
+
184
+ We present the CODE TRANSFORMER, which learns jointly from Structure and Context of programs while only relying on language-agnostic features. Our model obtains state-of-the-art performance on code summarization on five different programming languages. Besides these results for training on individual languages, the language-agnostic nature of our model allows us to train it jointly on multiple programming languages. The resulting multilingual model substantially outperforms its mono-lingual variant on all programming languages, setting the state of the art on each language. We observe the largest improvement from multilingual training on the language with fewest resources, indicating that multilingual training can improve learning for less widely used programming languages. Remarkably, multilingual training only from Context does not lead to the same improvements, highlighting the benefits of combining Structure and Context.
185
+
186
+ # REFERENCES
187
+
188
+ Mithun Acharya, Tao Xie, Jian Pei, and Jun Xu. Mining api patterns as partial orders from source code: From usage scenarios to specifications. In Proceedings of the the 6th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on The Foundations of Software Engineering, ESEC-FSE ’07, pp. 25–34, New York, NY, USA, 2007. Association for Computing Machinery. ISBN 9781595938114. doi: 10.1145/1287624.1287630. URL https://doi.org/10.1145/1287624.1287630.
189
+
190
+ Miltiadis Allamanis, Earl T. Barr, Christian Bird, and Charles Sutton. Learning natural coding conventions. In Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering, FSE 2014, pp. 281–293, New York, NY, USA, 2014. Association for Computing Machinery. ISBN 9781450330565. doi: 10.1145/2635868.2635883. URL https://doi.org/10.1145/2635868.2635883.
191
+
192
+ Miltiadis Allamanis, Earl T. Barr, Christian Bird, and Charles Sutton. Suggesting accurate method and class names. In Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering, ESEC/FSE 2015, pp. 38–49, New York, NY, USA, 2015. Association for Computing Machinery. ISBN 9781450336758. doi: 10.1145/2786805.2786849. URL https://doi. org/10.1145/2786805.2786849.
193
+
194
+ Miltiadis Allamanis, Hao Peng, and Charles Sutton. A convolutional attention network for extreme summarization of source code. In International conference on machine learning, pp. 2091–2100, 2016.
195
+
196
+ Miltiadis Allamanis, Marc Brockschmidt, and Mahmoud Khademi. Learning to represent programs with graphs. In International Conference on Learning Representations, 2018. URL https: //openreview.net/forum?id $=$ BJOFETxR-.
197
+
198
+ Uri Alon, Meital Zilberstein, Omer Levy, and Eran Yahav. A general path-based representation for predicting program properties. In Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2018, pp. 404–419, New York, NY, USA, 2018. Association for Computing Machinery. ISBN 9781450356985. doi: 10.1145/3192366.3192412. URL https://doi.org/10.1145/3192366.3192412.
199
+
200
+ Uri Alon, Shaked Brody, Omer Levy, and Eran Yahav. code2seq: Generating sequences from structured representations of code. In International Conference on Learning Representations, 2019a. URL https://openreview.net/forum?id $=$ H1gKYo09tX.
201
+
202
+ Uri Alon, Meital Zilberstein, Omer Levy, and Eran Yahav. code2vec: Learning distributed representations of code. Proceedings of the ACM on Programming Languages, 3(POPL):1–29, 2019b.
203
+
204
+ Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. arXiv preprint arXiv:1806.01261, 2018.
205
+
206
+ Avishkar Bhoopchand, Tim Rocktaschel, Earl Barr, and Sebastian Riedel. Learning python code ¨ suggestion with a sparse pointer network. arXiv preprint arXiv:1611.08307, 2016.
207
+
208
+ Benjamin Bichsel, Veselin Raychev, Petar Tsankov, and Martin Vechev. Statistical deobfuscation of android applications. In Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security, CCS ’16, pp. 343–355, New York, NY, USA, 2016. Association for Computing Machinery. ISBN 9781450341394. doi: 10.1145/2976749.2978422. URL https: //doi.org/10.1145/2976749.2978422.
209
+
210
+ Pavol Bielik, Veselin Raychev, and Martin Vechev. Phog: probabilistic model for code. In International Conference on Machine Learning, pp. 2933–2942, 2016.
211
+
212
+ Aleksandar Bojchevski, Johannes Klicpera, Bryan Perozzi, Amol Kapoor, Martin Blais, Benedek Rozemberczki, Michal Lukasik, and Stephan G ´ unnemann. Scaling graph neural networks with ¨ approximate pagerank. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery amp; Data Mining, KDD ’20, pp. 2464–2473, New York, NY, USA, 2020.
213
+
214
+ Association for Computing Machinery. ISBN 9781450379984. doi: 10.1145/3394486.3403296.
215
+ URL https://doi.org/10.1145/3394486.3403296.
216
+
217
+ Dylan Bourgeois. Learning representations of source code from structure and context. 2019. URL http://infoscience.epfl.ch/record/277163.
218
+
219
+ Alexis Conneau and Guillaume Lample. Cross-lingual language model pretraining. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-Buc, E. Fox, and ´ R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 7059– 7069. Curran Associates, Inc., 2019. URL http://papers.nips.cc/paper/ 8928-cross-lingual-language-model-pretraining.pdf.
220
+
221
+ Hanjun Dai, Bo Dai, and Le Song. Discriminative embeddings of latent variable models for structured data. In International conference on machine learning, pp. 2702–2711, 2016.
222
+
223
+ Zihang Dai, Zhilin Yang, Yiming Yang, Jaime Carbonell, Quoc V Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. arXiv preprint arXiv:1901.02860, 2019.
224
+
225
+ Hoa Khanh Dam, Truyen Tran, and Trang Pham. A deep language model for software code. In FSE 2016: Proceedings of the Foundations Software Engineering International Symposium [The Conference], 2016.
226
+
227
+ Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on ¨ graphs with fast localized spectral filtering. In Advances in neural information processing systems, pp. 3844–3852, 2016.
228
+
229
+ David K Duvenaud, Dougal Maclaurin, Jorge Iparraguirre, Rafael Bombarell, Timothy Hirzel, Alan´ Aspuru-Guzik, and Ryan P Adams. Convolutional networks on graphs for learning molecular fingerprints. In Advances in neural information processing systems, pp. 2224–2232, 2015.
230
+
231
+ Patrick Fernandes, Miltiadis Allamanis, and Marc Brockschmidt. Structured neural summarization. In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id $=$ H1ersoRqtm.
232
+
233
+ Marco Gori, Gabriele Monfardini, and Franco Scarselli. A new model for learning in graph domains. In Proceedings. 2005 IEEE International Joint Conference on Neural Networks, 2005., volume 2, pp. 729–734. IEEE, 2005.
234
+
235
+ William L. Hamilton, Rex Ying, and Jure Leskovec. Inductive representation learning on large graphs. In NIPS, 2017.
236
+
237
+ Vincent J. Hellendoorn, Charles Sutton, Rishabh Singh, Petros Maniatis, and David Bieber. Global relational models of source code. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $=$ B1lnbRNtwr.
238
+
239
+ Abram Hindle, Earl T. Barr, Zhendong Su, Mark Gabel, and Premkumar Devanbu. On the naturalness of software. In Proceedings of the 34th International Conference on Software Engineering, ICSE ’12, pp. 837–847. IEEE Press, 2012. ISBN 9781467310673.
240
+
241
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
242
+
243
+ Weihua Hu, Matthias Fey, Marinka Zitnik, Yuxiao Dong, Hongyu Ren, Bowen Liu, Michele Catasta, and Jure Leskovec. Open graph benchmark: Datasets for machine learning on graphs. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 22118–22133. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/file/ fb60d411a5c5b72b2e7d3527cfc84fd0-Paper.pdf.
244
+
245
+ Hamel Husain, Ho-Hsiang Wu, Tiferet Gazit, Miltiadis Allamanis, and Marc Brockschmidt. Codesearchnet challenge: Evaluating the state of semantic code search. arXiv preprint arXiv:1909.09436, 2019.
246
+
247
+ Aditya Kanade, Petros Maniatis, Gogul Balakrishnan, and Kensen Shi. Learning and evaluating contextual embedding of source code. In Proceedings of the 37th International Conference on Machine Learning, 2020.
248
+
249
+ Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In International Conference on Learning Representations (ICLR), 2017.
250
+
251
+ Johannes Klicpera, Aleksandar Bojchevski, and Stephan Gunnemann. Predict then propagate: ¨ Graph neural networks meet personalized pagerank. In International Conference on Learning Representations (ICLR), 2019a.
252
+
253
+ Johannes Klicpera, Stefan Weißenberger, and Stephan Gunnemann. Diffusion improves graph learn-¨ ing. In Conference on Neural Information Processing Systems (NeurIPS), 2019b.
254
+
255
+ Johannes Klicpera, Janek Groß, and Stephan Gunnemann. Directional message passing for molec- ¨ ular graphs. In International Conference on Learning Representations (ICLR), 2020.
256
+
257
+ Jian Li, Yue Wang, Michael R Lyu, and Irwin King. Code completion with neural attention and pointer networks. arXiv preprint arXiv:1711.09573, 2017.
258
+
259
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks. arXiv preprint arXiv:1511.05493, 2015.
260
+
261
+ Laurens van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 9(Nov):2579–2605, 2008.
262
+
263
+ Chris Maddison and Daniel Tarlow. Structured generative models of natural source code. In International Conference on Machine Learning, pp. 649–657, 2014.
264
+
265
+ Lili Mou, Ge Li, Lu Zhang, Tao Wang, and Zhi Jin. Convolutional neural networks over tree structures for programming language processing. In Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, AAAI’16, pp. 1287–1293. AAAI Press, 2016.
266
+
267
+ Trong Duc Nguyen, Anh Tuan Nguyen, Hung Dang Phan, and Tien N. Nguyen. Exploring api embedding for api usages and applications. In Proceedings of the 39th International Conference on Software Engineering, ICSE ’17, pp. 438–449. IEEE Press, 2017. ISBN 9781538638682. doi: 10.1109/ICSE.2017.47. URL https://doi.org/10.1109/ICSE.2017.47.
268
+
269
+ Lawrence Page, Sergey Brin, Rajeev Motwani, and Terry Winograd. The pagerank citation ranking: Bringing order to the web. Technical report, Stanford InfoLab, 1999.
270
+
271
+ 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.
272
+
273
+ Veselin Raychev, Martin Vechev, and Eran Yahav. Code completion with statistical language models. In Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’14, pp. 419–428, New York, NY, USA, 2014. Association for Computing Machinery. ISBN 9781450327848. doi: 10.1145/2594291.2594321. URL https://doi. org/10.1145/2594291.2594321.
274
+
275
+ Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 20(1):61–80, 2008.
276
+
277
+ Michael Schlichtkrull, Thomas N. Kipf, Peter Bloem, Rianne van den Berg, Ivan Titov, and Max Welling. Modeling relational data with graph convolutional networks. In Aldo Gangemi, Roberto Navigli, Maria-Esther Vidal, Pascal Hitzler, Raphael Troncy, Laura Hollink, Anna Tordai, and ¨ Mehwish Alam (eds.), The Semantic Web, pp. 593–607, Cham, 2018. Springer International Publishing. ISBN 978-3-319-93417-4.
278
+
279
+ Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. Self-attention with relative position representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pp. 464–468, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-2074. URL https://www.aclweb.org/anthology/N18-2074.
280
+
281
+ Yikang Shen, Shawn Tan, Alessandro Sordoni, and Aaron Courville. Ordered neurons: Integrating tree structures into recurrent neural networks. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id ${ . } =$ B1l6qiR5F7.
282
+
283
+ Vighnesh Shiv and Chris Quirk. Novel positional encodings to enable tree-based transformers. In Advances in Neural Information Processing Systems, pp. 12081–12091, 2019.
284
+
285
+ Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Y Ng, and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pp. 1631–1642, 2013.
286
+
287
+ Kai Sheng Tai, Richard Socher, and Christopher D Manning. Improved semantic representations from tree-structured long short-term memory networks. arXiv preprint arXiv:1503.00075, 2015.
288
+
289
+ 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.
290
+
291
+ Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Li ´ o, and Yoshua \` Bengio. Graph Attention Networks. International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $=$ rJXMpikCZ.
292
+
293
+ Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Advances in neural information processing systems, pp. 2692–2700, 2015.
294
+
295
+ Song Wang, Devin Chollak, Dana Movshovitz-Attias, and Lin Tan. Bugram: Bug detection with n-gram language models. In Proceedings of the 31st IEEE/ACM International Conference on Automated Software Engineering, ASE 2016, pp. 708–719, New York, NY, USA, 2016. Association for Computing Machinery. ISBN 9781450338455. doi: 10.1145/2970276.2970341. URL https://doi.org/10.1145/2970276.2970341.
296
+
297
+ Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id $=$ ryGs6iA5Km.
298
+
299
+ Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in neural information processing systems, pp. 5754–5764, 2019.
300
+
301
+ Zhitao Ying, Jiaxuan You, Christopher Morris, Xiang Ren, Will Hamilton, and Jure Leskovec. Hierarchical graph representation learning with differentiable pooling. In Advances in neural information processing systems, pp. 4800–4810, 2018.
302
+
303
+ Jiaxuan You, Rex Ying, and Jure Leskovec. Position-aware graph neural networks. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pp. 7134– 7143. PMLR, 09–15 Jun 2019. URL http://proceedings.mlr.press/v97/you19b. html.
304
+
305
+ Muhan Zhang and Yixin Chen. Link prediction based on graph neural networks. In Advances in Neural Information Processing Systems, pp. 5165–5175, 2018.
306
+
307
+ Table 5: Pairwise cosine similarities of the learned language embeddings of the CODE TRANSFORMER.
308
+
309
+ <table><tr><td></td><td>Python</td><td>Javascript</td><td>Go</td><td>Ruby</td></tr><tr><td>Python</td><td>1.00</td><td>0.43</td><td>0.42</td><td>0.79</td></tr><tr><td>Javascript</td><td>0.43</td><td>1.00</td><td>0.84</td><td>0.39</td></tr><tr><td>Go</td><td>0.43</td><td>0.84</td><td>1.00</td><td>0.38</td></tr><tr><td>Ruby</td><td>0.79</td><td>0.39</td><td>0.38</td><td>1.00</td></tr></table>
310
+
311
+ # ACKNOWLEDGEMENTS
312
+
313
+ We are grateful to Dylan Bourgeois for having paved the way to this research contribution with his thesis work (Bourgeois, 2019). We further thank Simon Geisler for his helpful suggestions and proofreading the paper, as well as the anonymous reviewers for their constructive feedback and fruitful discussions.
314
+
315
+ This research was supported by the TUM International Graduate School of Science and Engineering (IGSSE). Stanford University is supported by DARPA under Nos. N660011924033 (MCS); ARO under Nos. W911NF-16-1- 0342 (MURI), W911NF-16-1-0171 (DURIP); NSF under Nos. OAC1835598 (CINES), OAC-1934578 (HDR), CCF-1918940 (Expeditions), IIS-2030477 (RAPID); Stanford Data Science Initiative, Wu Tsai Neurosciences Institute, Chan Zuckerberg Biohub, Amazon, JPMorgan Chase, Docomo, Hitachi, JD.com, KDDI, NVIDIA, Dell, Toshiba, Intel, and UnitedHealth Group. Jure Leskovec is a Chan Zuckerberg Biohub investigator.
316
+
317
+ # A APPENDIX
318
+
319
+ # A.1 DISTANCE ENCODING FUNCTION
320
+
321
+ For encoding scalar relation values via vectors we employ encoding functions $\phi : \mathbb { R } \to \mathbb { R } ^ { d }$ , where $d$ is the model’s embedding dimension. We choose the popular sinusoidal encoding function presented in Vaswani et al. (2017):
322
+
323
+ $$
324
+ \phi ( r _ { i j } ) _ { 2 k } = \sin ( \frac { r _ { i j } } { M ^ { 2 k / d } } ) \qquad \phi ( r _ { i j } ) _ { 2 k + 1 } = \cos ( \frac { r _ { i j } } { M ^ { 2 k / d } } ) ,
325
+ $$
326
+
327
+ where $1 \leq k < d / 2$ is the position in the encoding vector and $M$ is some constant; we adopt $M = 1 0 , 0 0 0$ as chosen by (Vaswani et al., 2017). Note that the distance encoding functions have no trainable parameters.
328
+
329
+ # A.2 MULTILINGUAL REPRESENTATION ANALYSIS
330
+
331
+ In Table 5, we show the pairwise cosine similarities of the learned language embeddings of the CODE TRANSFORMER. We can see that the pairs Python-Ruby and Javascript-Go have similar language embeddings. This aligns well with roots of language design and common use cases of the languages.
332
+
333
+ Moreover, in Table 6, we show selected snippets starting with is, main, or load (left) and their best embedding matches from other languages (right).
334
+
335
+ # A.3 DATA PREPROCESSING
336
+
337
+ # A.3.1 TEXTUAL CODE SNIPPET PREPROCESSING
338
+
339
+ 1. Tokenize code snippets with Pygments language-specific tokenizer.
340
+
341
+ 2. Remove comments (both multi-line, single-line and doc comments). The comment token types. pygments.token.Comment and pygments.token.Literal.String.Doc that are generated by Pygments are used to identify comments.
342
+
343
+ <table><tr><td colspan="2">Published as a conference paper at ICLR 2021</td></tr><tr><td></td><td></td></tr><tr><td>function isEqualArray(a,b){ if (a return true;</td><td></td></tr><tr><td>if ((a === undefined) undefined)){ return false;</td><td>func areSameFloat32Array(a,b []float32) bool if len(a) != len(b){ return false</td></tr><tr><td>var =a.length; if (i !== b.length){ return false;</td><td>for i := O;i &lt; len(a);i++{ if a[i]!=b[i]{ return false J</td></tr><tr><td>while (i--){ if(a[i] !== b[i]){ return false; }</td><td>return true</td></tr><tr><td>return true;</td><td></td></tr><tr><td>function main() var rawData $(&#x27; .HeaderTexture[data-login- user-email]&#x27;) .data() ;</td><td>func TaskSayHello(t *tasking.T){</td></tr><tr><td>if (rawData) 1 me={</td><td>username := t.Flags.String(&quot;name&quot;) if username user, := user.Current ()</td></tr><tr><td>name:rawData.loginUserName, mail: rawData.loginUserEmail };</td><td>username = user.Name</td></tr><tr><td>getCartId(function (cart){ me.cart = cart;</td><td>} ift.Flags.Bool(&quot;verbose&quot;)</td></tr><tr><td>injectMenu(); refreshUsers(actions.updateUsers); listenOnChanges(onChange);</td><td>t.Logf(&quot;Hello %s, the time now is %s\n&quot;, username,time.Now())</td></tr><tr><td>listenonorderConfirm(onConfirm); );</td><td>}else{ t.Logf(&quot;Hello %s\n&quot;,username)</td></tr><tr><td>} else{ caliback(&#x27;no user&#x27;);</td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td>func Backup(filename string)error{</td></tr><tr><td></td><td></td></tr><tr><td></td><td>info,err := os.Stat(filename) if err != nil</td></tr><tr><td></td><td>if os.IsNotExist(err){</td></tr><tr><td></td><td>return nil</td></tr><tr><td></td><td>return err</td></tr><tr><td></td><td></td></tr><tr><td>def _load_rule_file(self, filename):</td><td>if info.Size() == 0{ return nil</td></tr><tr><td>if not (os.path.exists(filename)):</td><td>}</td></tr><tr><td>sys.stderr.write(</td><td>files,err := filepath.Glob(</td></tr><tr><td>&quot;rflint: %s: No such file or &quot;directory\n&quot; % filename</td><td>filename + _BACKUP_SUFFIX</td></tr><tr><td>return</td><td>) if err nil 1</td></tr><tr><td>try:</td><td>return err</td></tr><tr><td>basename = os.path.basename(filename)</td><td>}</td></tr><tr><td>(name,ext)= os.path.splitext(basename) imp.load_source(name,filename)</td><td> numBackup := byte(1)</td></tr><tr><td>except Exception as e: sys.stderr.write(</td><td>if len(files) !=0{</td></tr><tr><td>&quot;rflint: %s: exception while</td><td>lastFile := files[len(files)-1]</td></tr><tr><td>&quot;loading:%s\n&quot; % (filename, str(e))</td><td>numBackup = lastFile[len(lastFile)-2] + 1</td></tr><tr><td></td><td>if numBackup &gt;</td></tr><tr><td></td><td>numBackup = &#x27;1&#x27;</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td>else{</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td>&#x27;1&#x27;</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td>numBackup =</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td>return Copy (filename,</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td>fmt.Sprintf(&quot;%s+%s~&quot;,</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td>string(numBackup)))</td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr><tr><td></td><td></td></tr></table>
344
+
345
+ Table 6: Selected snippets starting with is, main, or load (left) and their best embedding matches from other languages (right).
346
+
347
+ ![](images/e37f9cb44d930542340c5ad3d88619f8535c0f5512daf8c0c8d8a050432bff4b.jpg)
348
+ Figure 6: Example snippet and its corresponding AST obtained from GitHub Semantic.
349
+
350
+ 3. Empty lines are removed.
351
+
352
+ 4. Hard coded strings and numbers are replaced with a special [MASK STRING] and [MASK NUMBER] token.
353
+
354
+ 5. Indentation style of the code snippet is detected and whitespace characters at the beginning of a line are replaced with a single [INDENT] or [DEDENT] token when indentation changes.
355
+
356
+ 6. Tokens are further split into sub tokens, e.g., setBottomHeight [‘set’, ‘bottom’, ‘height’]. Throughout our experiments, we use 5 input sub tokens. If a token consists of less than 5 sub tokens, the remaining spaces are filled with a special [PAD] token.
357
+
358
+ 7. Any remaining tokens that only consist of white spaces are removed. The only white space characters that are kept are line breaks $^ { \bullet } \backslash \boldsymbol { \mathrm { n } } ^ { \prime }$ .
359
+
360
+ 8. Any code snippets where the Pygments tokenizer cannot parse a token are discarded.
361
+
362
+ # A.3.2 STAGE 1 PREPROCESSING (GENERATION OF ASTS)
363
+
364
+ 1. Stripped code snippets are used to generate language-specific ASTs. For Java, we use the AST parser from the java-parser project. The ASTs contain node types and source ranges. For Python, JavaScript, Ruby and Go, we use semantic.
365
+
366
+ 2. Snippets that lead to an AST parse error are discarded.
367
+
368
+ 3. We calculate a mapping between tokens and nodes in the AST. Every token is assigned to the node in the AST with shortest source range that still encompasses the source range of the token.
369
+
370
+ To find such a node, we originally intended to make use of the assumption that source ranges of child nodes do not overlap. Then, one could easily find the node with smallest encompassing source range by greedily selecting at every layer in the AST the child that encompasses the token’s source range (there can only be at most one child that fulfills this). However, this assumption does not hold for all ASTs (see Figure 6 for an example). As a heuristic, we greedily select the child node with the shorter source range in case there were multiple child nodes with encompassing source ranges. This approximation seems to be sufficient in our case, and limits runtime as we do not have to consider multiple paths in the AST. It is also sufficient to stop when no child node encompasses the source range of the token, as in ASTs the source ranges of child nodes are always contained in the source ranges of their parent.
371
+
372
+ 1. Tokens are vocabularized. Any token occurring less than 100 times in the training set is replaced by an <unk $>$ token.
373
+
374
+ 2. We calculate multiple pair-wise relations between nodes in the AST:
375
+
376
+ • Personalized Page Rank (PPR) We interpret the negative logarithm of PPR as a distance. We use a teleport probability of $\alpha = 0 . 1 5$ and a threshold of $e ^ { - 5 }$ , i.e., anything with $- \log P P R > 5$ is considered unreachable
377
+ • Shortest path length between two nodes
378
+ • Ancestor shortest paths (bidirectional). That is, the parent has an ancestor shortest path distance of 1 to all its children and the child has a distance of -1 to its parents. We consider nodes that are not ancestors or descendants of a node (i.e. not reachable by following only parent or only child relations) as not connected in the ancestor shortest paths relation. We encode this with a very large value in their distance; we have found a value of $1 , 0 0 0$ to work well in practice.
379
+ • Next sibling shortest paths (bidirectional, analogous to the ancestor shortest paths)
380
+
381
+ Note that the ancestor shortest paths and next sibling shortest paths are required because treating the AST as a normal graph leads to ambiguity. In a graph, the neighbors of a node have no ordering; however in the AST, the order of the children of a node reflects their order in the code. Therefore, we explicitly include the next sibling shortest paths. The ancestor shortest paths would not be required if we treated the AST as a directed graph; in this case, however, a leaf node could not reach any other node in the AST, and therefore both PPR and shortest path length are not useful in this case. Therefore, we model the AST as undirected and inject the ancestor / child edges to avoid ambiguity.
382
+
383
+ 3. Distance values are binned into 32 bins using area-based exponential binning with a growth factor of 1.3, i.e., the area of a bin’s rectangle ( $x$ : bin range, $y$ : number of values in bin) will be approximately 1.3 times bigger for the next bin (going away from the bin that contains the zero value). Additionally, for discrete distance measures (such as sequence distance or shortest path length), we hard-code 9 values around 0 to have their own bins. For instance, on the sequence distance the values $- 4 , - 3 , \dots , 4$ have their individual bins, and around those values we employ the exponential binning.
384
+
385
+ 4. Punctuation tokens (such as points or brackets) are removed from the input sequence, as experiments showed that their presence does not improve performance but slows down training due to bigger input sizes.
386
+
387
+ 5. Snippets that are longer than MAX NUM TOKENS after punctuation tokens are removed are discarded from the training set. Throughout our experiments, we use MAX NUM TOKENS $= ~ 5 1 2$ . During evaluation on the test set, we use MAX NUM TOKENS $= ~ 1 0 0 0$ .
388
+
389
+ # A.4 INPUT EMBEDDINGS TO THE MODEL
390
+
391
+ Besides its five subtokens (e.g., [‘get’, ‘data’, ‘[PAD]’, ‘[PAD]’, ‘[PAD]’]), each input token has a token type (coming from the Pygments tokenizer) and an AST node type. The AST node type is the type of the node assigned to each respective token, as described in Section A.3.2. We concatenate the embeddings of the five subtokens, the token type, and the AST node type. Then, we apply a linear layer (without activation function) to project down to the model’s embedding dimension.
392
+
393
+ # A.5 INPUT TO THE GREAT BASELINE
394
+
395
+ As mentioned in the main text, we also compare with GREAT Hellendoorn et al. (2020). Since their preprocessing pipeline is proprietary and could not be shared with us even after contacting the authors, we provide to GREAT the same AST distances as our model. Since GREAT uses edges instead of distances to encode relations in the Structure, we essentially threshold the ancestor, sibling, and shortest-paths distances and provide the edges where the distances are equal to 1 (including their edge types) to the model.
396
+
397
+ (a) CODE TRANSFORMER
398
+ Table 7: Code Summarization hyperparameters
399
+
400
+ <table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Activation</td><td>GELU</td></tr><tr><td>Input Nonlinearity</td><td>tanh</td></tr><tr><td>Num. layers</td><td>3</td></tr><tr><td>d</td><td>1024</td></tr><tr><td>dFF</td><td>2048</td></tr><tr><td>Pdropout</td><td>0.2</td></tr><tr><td>Num.heads</td><td>8</td></tr></table>
401
+
402
+ (b) GREAT (Hellendoorn et al., 2020)
403
+
404
+ <table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Activation</td><td>GELU</td></tr><tr><td>Num. layers</td><td>3</td></tr><tr><td>d</td><td>1024</td></tr><tr><td>dFF</td><td>2048</td></tr><tr><td>Pdropout</td><td>0.2</td></tr><tr><td>Num.heads</td><td>8</td></tr></table>
405
+
406
+ # A.6 EXPERIMENTAL SETUP
407
+
408
+ Table 7 shows hyperparameters of our models for code summarization. For all our experiments, we use a Transformer Decoder with one layer and teacher forcing to generate 6 output sub tokens. We also employ label smoothing of 0.1. As optimizer, we use Adam with a learning rate of $8 e ^ { - 5 }$ and weight decay of $3 e ^ { - 5 }$ . Batch size during training is 8 with a simulated batch size of 128 achieved by gradient accumulation.
409
+
410
+ Apart from comparing the CODE TRANSFORMER to baselines, we performed the following hyperparameter comparisons and ablation studies:
411
+
412
+ • CODE TRANSFORMER (structure-only) Using only AST information as input, i.e., masking all tokens that do not correspond to a leaf of the AST, and removing the token distance as a relation to be used by the model. Further, token types are not fed into the model.
413
+ • CODE TRANSFORMER (context-only) Here, we do not include any information on the AST (i.e. node types and distances on the AST). This is effectively the XLNet backbone plus encoding of the token type returned by the tokenizer.
414
+ • CODE TRANSFORMER (Max-Dist.) Applying a Max Distance Mask of 5 to the shortest paths distance (i.e., model cannot see a node that is more than 5 hops away no matter how small the other distances are). Early results showed that, as expected, results deteriorate substantially when limiting our model’s receptive field. Hence, we do not include these results in this work.
415
+ • Using 16 and 64 bins instead of 32 bins. This had no noticeable effect on performance.
416
+
417
+ # A.7 CODE SUMMARIZATION EXAMPLES
418
+
419
+ In the Tables 8, 9, 10, 11, 12, 13, 14 and 15 we present example functions from the Java-small dataset along with the different models’ predictions for the function name.
420
+
421
+ public Summation next() { return parts $[ \dot { 1 } + + ]$ ; }
422
+
423
+ Table 8: The CODE TRANSFORMER is the only model to correctly identify the notion of getting the next entry.
424
+
425
+ <table><tr><td>Model</td><td>Prediction</td></tr><tr><td>GREAT</td><td> get x map</td></tr><tr><td>code2seq</td><td> get parts</td></tr><tr><td>Ours w/o structure</td><td>get</td></tr><tr><td>CODE TRANSFORMER</td><td>get next</td></tr><tr><td>Ground Truth</td><td>next</td></tr></table>
426
+
427
+ private Path findCacheFile(Path[] cacheFiles, String fileName) { if (cacheFiles $! =$ null && cacheFiles.length $> 0$ ) { for (Path file : cacheFiles) { if (file.getName().equals(fileName)) { return file; } return null;
428
+ }
429
+
430
+ <table><tr><td>Model</td><td>Prediction</td></tr><tr><td>GREAT</td><td>get path</td></tr><tr><td>code2seq</td><td>find file</td></tr><tr><td>Ours w/o structure</td><td>get file</td></tr><tr><td>CODE TRANSFORMER</td><td>find cache</td></tr><tr><td>Ground Truth</td><td>find cache file</td></tr></table>
431
+
432
+ Table 9: The CODE TRANSFORMER is the only model to both recognize that the task is to find a file as well as the fact that it is about the cache. However, it did not correctly predict the file part of the method name.
433
+
434
+ public int compare(Pair<LoggedJob, JobTraceReader> p1, Pair<LoggedJob, JobTraceReader> p2) { LoggedJob $\ j 1 \ = \ \mathtt { p 1 }$ .first(); LoggedJob $\begin{array} { r } { \dot { \bf { \ j } } 2 { \bf { \nu } } = { \bf { \ p } } 2 } \end{array}$ .first(); return (j1.getSubmitTime() $<$ j2.getSubmitTime()) ? -1 : (j1.getSubmitTime() $= =$ j2.getSubmitTime()) ? 0 : 1; }
435
+
436
+ <table><tr><td>Model</td><td>Prediction</td></tr><tr><td>GREAT</td><td>run</td></tr><tr><td>code2seq</td><td> get submit time</td></tr><tr><td>Ours w/o structure</td><td>compare</td></tr><tr><td>CODE TRANSFORMER</td><td>compare</td></tr><tr><td>Ground Truth</td><td>compare</td></tr></table>
437
+
438
+ Table 10: The CODE TRANSFORMER and the its context-only variant are the only models correctly recognizing the ‘compare’ template in the method body.
439
+
440
+ public static MNTPROC fromValue(int value) { if (value $< ~ 0$ || value $> =$ values().length) { return null; } return values()[value];
441
+ }
442
+
443
+ <table><tr><td>Model</td><td>Prediction</td></tr><tr><td>GREAT</td><td> get value</td></tr><tr><td>code2seq</td><td> get value</td></tr><tr><td>Ours w/o structure</td><td>to</td></tr><tr><td>CODE TRANSFORMER</td><td>from value</td></tr><tr><td>Ground Truth</td><td>from value</td></tr></table>
444
+
445
+ Table 11: The CODE TRANSFORMER is the only model to recognize that the snippet is similar to a static factory method which is often preceded with from.
446
+
447
+ private Iterable<ListBlobItem> listRootBlobs(String aPrefix,
448
+
449
+ boolean useFlatBlobListing,
450
+ EnumSet<BlobListingDetails> listingDetails,
451
+ BlobRequestOptions options,
452
+ OperationContext opContext)
453
+
454
+ throws StorageException, URISyntaxException {
455
+
456
+ CloudBlobDirectoryWrapper directory $=$ this.container.getDirectoryReference(aPrefix); return directory.listBlobs(null, useFlatBlobListing, listingDetails, options, opContext);
457
+
458
+ }
459
+
460
+ <table><tr><td>Model</td><td>Prediction</td></tr><tr><td>GREAT</td><td>list blobs</td></tr><tr><td>code2seq</td><td>list blobs</td></tr><tr><td>Ours w/o structure</td><td>list blobs</td></tr><tr><td>CODE TRANSFORMER</td><td>list blobs by prefix</td></tr><tr><td>Ground Truth</td><td>list root blobs</td></tr></table>
461
+
462
+ Table 12: All models could correctly identify the listBlobs() call in the return statement. However, the CODE TRANSFORMER additionally comprehended that the specified prefix is quite important.
463
+
464
+ private static void dumpOpCounts(EnumMap $<$ FSEditLogOpCodes, Holder $<$ <Integer>> opCounts) { StringBuilder sb $=$ new StringBuilder(); sb.append("Summary of operations loaded from edit log:\n "); Joiner.on("\n ").withKeyValueSeparator(" $^ { 1 1 } =$ ").appendTo(sb, opCounts); FSImage.LOG.debug(sb.toString());
465
+ }
466
+
467
+ Table 13: Only the CODE TRANSFORMER could correctly identify that it is the op counts that should be logged.
468
+
469
+ <table><tr><td>Model</td><td>Prediction</td></tr><tr><td>GREAT</td><td>append</td></tr><tr><td>code2seq</td><td>add</td></tr><tr><td>Ours w/o structure</td><td>log</td></tr><tr><td>CODE TRANSFORMER</td><td>log op counts</td></tr><tr><td>Ground Truth</td><td>dump op counts</td></tr></table>
470
+
471
+ static String execCommand(File f, String... cmd) throws IOException { String[] args $=$ new String[cmd.length $^ +$ 1]; System.arraycopy(cmd, 0, args, 0, cmd.length); args[cmd.length] $=$ f.getCanonicalPath(); String output $=$ Shell.execCommand(args); return output;
472
+
473
+ Table 14: Only the CODE TRANSFORMER and code2seq could identify that the relevant part of the method is concerned with executing a command instead of returning something.
474
+
475
+ <table><tr><td>Model</td><td>Prediction</td></tr><tr><td>GREAT</td><td>get canonical path</td></tr><tr><td>code2seq</td><td>exec</td></tr><tr><td>Ours w/o structure</td><td> get output</td></tr><tr><td>CODE TRANSFORMER</td><td>exec command</td></tr><tr><td>Ground Truth</td><td>exec command</td></tr></table>
476
+
477
+ # protected void subView(Class<? extends SubView> cls) {
478
+
479
+ indent(of(ENDTAG));
480
+ sb.setLength(0);
481
+ out.print(sb.append('[').append(cls.getName()).append(']').toString());
482
+ out.println();
483
+
484
+ Table 15: Only the CODE TRANSFORMER was able to link the print functionality to the object that should be printed, which can only be inferred from the object’s class in the method parameters.
485
+
486
+ <table><tr><td>Model</td><td>Prediction</td></tr><tr><td>GREAT</td><td>print</td></tr><tr><td>code2seq</td><td>print</td></tr><tr><td>Ours w/o structure</td><td>print</td></tr><tr><td>CODE TRANSFORMER</td><td>print sub view</td></tr><tr><td>Ground Truth</td><td>sub view</td></tr></table>
487
+
488
+ ![](images/1225dc2212652b0900da96594dc1baedeb731793c2a7f99b2f39f0a306a759b8.jpg)
489
+ Figure 7: Share of tokens in the labels also occurring in the bodies of methods.
490
+
491
+ Table 16: Code summarization results on the CSN dataset (sample-F1).
492
+
493
+ <table><tr><td rowspan="2">Model</td><td colspan="2">Python</td><td colspan="3">Javascript</td><td colspan="2"></td><td colspan="2">Ruby</td><td colspan="3">Go</td></tr><tr><td>Prec.</td><td>Rec.</td><td>F1</td><td>Prec.</td><td>Rec.</td><td>F1</td><td>Prec.</td><td>Rec.</td><td>F1</td><td>Prec.</td><td>Rec.</td><td>F1</td></tr><tr><td>code2seq</td><td>1</td><td>1</td><td>1</td><td>-</td><td>1</td><td>1</td><td>=</td><td>1</td><td>1</td><td>1</td><td>1</td><td>-</td></tr><tr><td>GREAT</td><td>34.93</td><td>31.12</td><td>31.61</td><td>29.69</td><td>24.24</td><td>25.55</td><td>25.69</td><td>21.49</td><td>22.18</td><td>48.38</td><td>45.97</td><td>45.71</td></tr><tr><td>Ours w/o structure</td><td>36.87</td><td>32.17</td><td>32.97</td><td>31.30</td><td>25.03</td><td>26.64</td><td>31.43</td><td>25.34</td><td>26.63</td><td>49.78</td><td>46.73</td><td>46.69</td></tr><tr><td>Ours w/o pointer net</td><td>38.77</td><td>31.72</td><td>33.27</td><td>32.70</td><td>25.50</td><td>27.33</td><td>32.12</td><td>30.17</td><td>29.36</td><td>53.09</td><td>48.70</td><td>49.26</td></tr><tr><td>Ours</td><td>36.68</td><td>33.86</td><td>33.84</td><td>33.36</td><td>27.55</td><td>29.02</td><td>31.53</td><td>24.72</td><td>26.43</td><td>52.00</td><td>47.35</td><td>47.93</td></tr><tr><td>code2seq (Multilanguage)</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>GREAT (Multilanguage)</td><td>35.73</td><td>30.81</td><td>31.74</td><td>31.49</td><td>26.17</td><td>27.41</td><td>29.72</td><td>24.20</td><td>25.43</td><td>50.32</td><td>47.94</td><td>47.66</td></tr><tr><td>Ours w/o structure (Mult.)</td><td>36.78</td><td>29.92</td><td>31.58</td><td>32.60</td><td>26.02</td><td>27.74</td><td>31.71</td><td>26.07</td><td>27.24</td><td>51.91</td><td>47.58</td><td>48.15</td></tr><tr><td>Ours w/o pointer (Mult.)</td><td>37.18</td><td>30.52</td><td>32.04</td><td>33.95</td><td>25.92</td><td>28.11</td><td>32.76</td><td>25.04</td><td>27.01</td><td>53.50</td><td>48.54</td><td>49.35</td></tr><tr><td>Ours (Multilanguage)</td><td>38.10</td><td>33.32</td><td>34.18</td><td>34.29</td><td>28.69</td><td>30.08</td><td>33.30</td><td>28.33</td><td>29.29</td><td>53.86</td><td>50.46</td><td>50.61</td></tr><tr><td>Ours (Mult. + Finetune)</td><td>38.29</td><td>32.41</td><td>33.65</td><td>34.43</td><td>28.28</td><td>29.91</td><td>32.89</td><td>27.15</td><td>28.49</td><td>53.85</td><td>50.85</td><td></td></tr><tr><td>Ours (Mult.+ LMPretrain)</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>50.81</td></tr><tr><td></td><td>38.97</td><td>34.77</td><td>35.34</td><td>35.23</td><td>30.26</td><td>31.38</td><td>33.73</td><td>29.15</td><td>29.94</td><td>55.31</td><td>52.03</td><td>52.13</td></tr></table>
494
+
495
+ # A.8 ESTIMATION OF POINTER NETWORK POTENTIAL
496
+
497
+ In Table 2 we observe that the pointer network improves the F1 score for all languages except Go, where counterintuitively it leads to reduced performance as measured by F1 score on the test set (while it improves by about 3 points on validation). To investigate this, in Figure 7 we plot the share of tokens in the labels also occurring in the bodies of methods in the different languages. Intuitively, this gives an indication on how much gain we can expect from using a pointer network. If the share were zero, then no token in the labels ever occur in the bodies of the methods, so the pointer network cannot improve the prediction by pointing at the input. We see that for Go, there is a strong mismatch between the test partition and the train/validation partitions, which much fewer tokens from the labels occurring in the bodies of methods on test compared to train/validation. Thus, we attribute the drop in performance observed by adding a pointer network on Go to this apparent violation of the i.i.d. assumption.
498
+
499
+ # A.9 CODE SUMMARIZATION RESULTS ON THE CSN DATASET (SAMPLE-F1)
500
+
501
+ In Table 16, we present our results on the CSN dataset as measured by the sample-F1 score.
parse/train/Xh5eMZVONGF/Xh5eMZVONGF_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/Xh5eMZVONGF/Xh5eMZVONGF_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/Xh5eMZVONGF/Xh5eMZVONGF_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/rJerHlrYwH/rJerHlrYwH.md ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DATA-EFFICIENT IMAGE RECOGNITION WITH CONTRASTIVE PREDICTIVE CODING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Human observers can learn to recognize new categories of objects from a handful of examples, yet doing so with machine perception remains an open challenge. We hypothesize that data-efficient recognition is enabled by representations which make the variability in natural signals more predictable, as suggested by recent perceptual evidence. We therefore revisit and improve Contrastive Predictive Coding, a recently-proposed unsupervised learning framework, and arrive at a representation which enables generalization from small amounts of labeled data. When provided with only $1 \%$ of ImageNet labels (i.e. 13 per class), this model retains a strong classification performance, $73 \%$ Top-5 accuracy, outperforming supervised networks by $28 \%$ (a $65 \%$ relative improvement) and state-of-the-art semisupervised methods by $14 \%$ . We also find this representation to serve as a useful substrate for object detection on the PASCAL-VOC 2007 dataset, approaching the performance of representations trained with a fully annotated ImageNet dataset.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Deep neural networks excel at perceptual tasks when labeled data are abundant, yet their performance degrades substantially when provided with limited supervision (Fig. 1, red). In contrast, humans and animals can quickly learn about new classes of objects from few examples (Landau et al., 1988; Markman, 1989). What accounts for this monumental difference in data-efficiency between biological and machine vision? While highly-structured representations (e.g. as proposed by Lake et al., 2015) may improve data-efficiency, it remains unclear how to program explicit structures that capture the enormous complexity of real visual scenes like those in ImageNet (Russakovsky et al., 2015). An alternative hypothesis has proposed that intelligent systems need not be structured a priori, but can instead learn about the structure of the world in an unsupervised manner (Barlow, 1989; Hinton et al., 1999; LeCun et al., 2015). Choosing an appropriate training objective is an open problem, but a promising guiding principle has emerged recently: good representations should make the spatio-temporal variability in natural signals more predictable. Indeed, human perceptual representations have been shown to linearize
12
+
13
+ ![](images/7b8ed316aeaae9bdfe3d3d7e12974b01335c33b7eb790b24e724753c0422fb2e.jpg)
14
+ Figure 1: Data-efficient image recognition with Contrastive Predictive Coding. With decreasing amounts of labeled data, supervised networks trained on pixels fail to generalize (red). When trained on unsupervised representations learned with CPC, these networks retain a much higher accuracy in this low-data regime (blue). Equivalently, the accuracy of supervised networks can be matched with significantly fewer labels.
15
+
16
+ (or ‘straighten’) the temporal transformations found in natural videos, a property lacking from current supervised image recognition models (Henaff et al., 2019), and theories of both spatial and tem- ´ poral predictability have succeeded in describing properties of early visual areas (Rao & Ballard,
17
+
18
+ 1999; Palmer et al., 2015). In this work, we hypothesize that spatially predictable representations may allow artificial systems to benefit from human-like data-efficiency.
19
+
20
+ Contrastive Predictive Coding (CPC, van den Oord et al., 2018) is an unsupervised objective which learns such predictable representations. CPC is a general technique that only requires in its definition that observations be ordered along e.g. temporal or spatial dimensions, and as such has been applied to a variety of different modalities including speech, natural language and images. This generality, combined with the strong performance of its representations in downstream linear classification tasks, makes CPC a promising candidate for investigating the efficacy of predictable representations for data-efficient image recognition.
21
+
22
+ Our work makes the following contributions:
23
+
24
+ • We revisit CPC in terms of its architecture and training methodology, and arrive at a new implementation of CPC with dramatically-improved ability to linearly separate image classes $+ 1 7 \%$ Top-1 ImageNet classification accuracy).
25
+ We then train deep networks on top of the resulting CPC representations using very few labeled images (e.g. $1 \%$ of the ImageNet dataset), and demonstrate test-time classification accuracy far above networks trained on raw pixels ( $73 \%$ Top-5 accuracy, a $28 \%$ absolute improvement), outperforming all other unsupervised representation learning methods $( + 1 5 \%$ Top-5 accuracy over the previous state-of-the-art (Zhai et al., 2019)). Surprisingly, this representation also surpasses supervised methods when given the entire ImageNet dataset $+ 1 \%$ Top-5 accuracy).
26
+ We isolate the contributions of different components of the final model to such downstream tasks. Interestingly, we find that linear classification accuracy is not always predictive of low-data classification accuracy, emphasizing the importance of this metric as a stand-alone benchmark for unsupervised learning.
27
+ • Finally, we assess the generality of CPC representations by transferring them to a new task and dataset: object detection on PASCAL-VOC 2007. Consistent with the results from the previous section, we find CPC to give state-of-the-art performance in this setting.
28
+
29
+ # 2 EXPERIMENTAL SETUP
30
+
31
+ We first review the CPC architecture and learning objective in section 2.1, before detailing how we use its resulting representations for image recognition tasks in section 2.2.
32
+
33
+ # 2.1 CONTRASTIVE PREDICTIVE CODING
34
+
35
+ Contrastive Predictive Coding as formulated in (van den Oord et al., 2018) learns representations by training neural networks to predict the representations of future observations from those of past ones. When applied to images, the original formulation of CPC operates by predicting the representations of patches below a certain position from those above it (Fig. 2, left). These predictions are evaluated using a contrastive loss, in which the network must correctly classify the ‘future’ representation amongst a set of unrelated ‘negative’ representations. This avoids trivial solutions such as representing all patches with a constant vector, as would be the case with a mean squared error loss.
36
+
37
+ In the CPC architecture, each input image is first divided into a set of overlapping patches $\mathbf { \delta } _ { \mathbf { x } _ { i , j } }$ , each of which is encoded with a neural network $f _ { \theta }$ into a single vector $z _ { i , j } = f _ { \theta } ( \pmb { x } _ { i , j } )$ . To make predictions, a masked convolutional network $g _ { \phi }$ is then applied to the grid of feature vectors. The masks are such that the receptive field of each resulting context vector $c _ { i , j }$ only includes feature vectors that lie above it in the image (i.e. $\{ z _ { u , v } \} _ { u \leq i , v } )$ . The prediction task then consists o predicting ‘future’ feature vectors $z _ { i + k , j }$ from current context vectors $c _ { i , j }$ , where $k > 0$ . The predictions are made linearly: given a context vector $c _ { i , j }$ , a prediction length $k > 0$ , and a prediction matrix $W _ { k }$ , the predicted feature vector is $\hat { \boldsymbol { z } } _ { i + k , j } = \boldsymbol { W } _ { k } \boldsymbol { c } _ { i , j }$ .
38
+
39
+ The quality of this prediction is then evaluated using a contrastive loss. Specifically, the goal is to correctly recognize the target $z _ { i + k , j }$ among a set of randomly sampled feature vectors $\{ z _ { l } \}$ from the dataset. We compute the probability assigned to the target using a softmax, and evaluate this probability using the usual cross-entropy loss. Summing this loss over locations and prediction offsets, we arrive at the CPC objective as defined in (van den Oord et al., 2018):
40
+
41
+ ![](images/e21408d1a55db66ba2cac6a3f4d98b0d1a13c2f1211e3956f93d67bae89bbaae.jpg)
42
+ Figure 2: Overview of the framework for semi-supervised learning with Contrastive Predictive Coding. Left: unsupervised pre-training with the spatial prediction task (See Section 2.1). First, an image is divided into a grid of overlapping patches. Each patch is encoded independently from the rest with a feature extractor (blue) which terminates with a mean-pooling operation, yielding a single feature vector for that patch. Doing so for all patches yields a field of such feature vectors (wireframe vectors). Feature vectors above a certain level (in this case, the center of the image) are then aggregated with a context network (red), yielding a row of context vectors which are used to linearly predict features vectors below. Right: using the CPC representation for a classification task. Having trained the encoder network, the context network (red) is discarded and replaced by a classifier network (green) which can be trained in a supervised manner. For some experiments, we also fine-tune the encoder network (blue) for the classification task. When applying the encoder to cropped patches (as opposed to the full image) we refer to it as a patched ResNet in the figure.
43
+
44
+ $$
45
+ \mathcal { L } _ { \mathrm { C P C } } = - \sum _ { i , j , k } \log p ( z _ { i + k , j } | \hat { z } _ { i + k , j } , \{ z _ { l } \} ) = - \sum _ { i , j , k } \log \frac { \exp ( \hat { z } _ { i + k , j } ^ { T } z _ { i + k , j } ) } { \exp ( \hat { z } _ { i + k , j } ^ { T } z _ { i + k , j } ) + \sum _ { l } \exp ( \hat { z } _ { i + k , j } ^ { T } z _ { l } ) }
46
+ $$
47
+
48
+ The negative samples $\left\{ z _ { l } \right\}$ are taken from other locations in the image and other images in the minibatch. This loss is called InfoNCE (van den Oord et al., 2018) as it is inspired by Noise-Contrastive Estimation (Gutmann $\&$ Hyvarinen, 2010; Mnih & Kavukcuoglu, 2013) and has been shown to ¨ maximize the mutual information between $\mathbf { } _ { c _ { i , j } }$ and $z _ { i + k , j }$ (van den Oord et al., 2018).
49
+
50
+ # 2.2 EVALUATION PROTOCOL
51
+
52
+ Having trained an encoder network $f _ { \theta }$ , a context network $g _ { \phi }$ , and a set of linear predictors $\{ W _ { k } \}$ using the CPC objective, we use the latents $z = f _ { \boldsymbol { \theta } } ( \pmb { x } )$ as a representation of new observations $x$ for downstream tasks, and discard the rest. We then train a model $h _ { \psi }$ to classify these representations given a dataset of labeled images. More formally, given a dataset of $N$ unlabeled images $\mathbb { D } _ { u } =$ $\left\{ x _ { n } \right\}$ , and a (potentially much smaller) dataset of $M$ labeled images $\mathbb { D } _ { l } = \{ x _ { m } , y _ { m } \}$ :
53
+
54
+ $$
55
+ \theta ^ { * } = \arg \operatorname* { m i n } _ { \theta } \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \mathcal { L } _ { \mathrm { C P C } } [ f _ { \theta } ( x _ { n } ) ] , \quad \psi ^ { * } = \arg \operatorname* { m i n } _ { \psi } \frac { 1 } { M } \sum _ { m = 1 } ^ { M } \mathcal { L } _ { \mathrm { S u p } } [ h _ { \psi } \circ f _ { \theta ^ { * } } ( x _ { m } ) , y _ { m } ]
56
+ $$
57
+
58
+ In all cases, the dataset of unlabeled images $\mathbb { D } _ { u }$ we pre-train on is the full ImageNet ILSVRC 2012 training set (Russakovsky et al., 2015). We consider three labeled datasets $\mathbb { D } _ { l }$ for evaluation, each with an associated classifier $h _ { \psi }$ and supervised losse $\mathcal { L } _ { \mathrm { { S u p } } }$ (see Fig. 2, right). This protocol is sufficiently generic to allow us to later compare the CPC representation to other methods which have their own means of learning a feature extractor $f _ { \theta }$ .
59
+
60
+ Linear classification is the standard benchmark for evaluating the quality of unsupervised image representations. In this regime, the classification network $h _ { \psi }$ is restricted to mean pooling followed by a single linear layer, and the parameters of $f _ { \theta }$ are kept fixed. The labeled dataset $\mathbb { D } _ { l }$ is the entire ImageNet dataset, and the supervised loss $\mathcal { L } _ { \mathrm { { S u p } } }$ is standard cross-entropy. We use the same dataaugmentation as in the unsupervised learning phase for training, and none at test time and evaluate with a single crop.
61
+
62
+ Efficient classification directly tests whether the CPC representation enables visual learning from few labels. For this task, the classifier $h _ { \psi }$ is an arbitrary deep neural network (we use an 11-block ResNet architecture with 4096-dimensional feature maps and 1024-dimensional bottleneck layers). The labeled dataset $\mathbb { D } _ { l }$ is a subset of the ImageNet dataset: we investigated using $1 \%$ , $2 \%$ , $5 \%$ , $10 \%$ , $20 \%$ , $50 \%$ and $100 \%$ of the ImageNet dataset. The supervised loss $\mathcal { L } _ { \mathrm { { S u p } } }$ is again cross-entropy. In addition to random color-dropping we use the Inception data-augmentation scheme (Szegedy et al., 2014) for training, no augmentation at test-time and evaluate with a single crop.
63
+
64
+ Transfer learning tests the generality of the representation by applying it to a new task and dataset. For this we chose image detection on the PASCAL-2007 dataset, a standard benchmark in computer vision (Everingham et al., 2007). As such $\mathbb { D } _ { l }$ is the entire PASCAL-2007 dataset (comprised of 5011 labeled images); $h _ { \psi }$ and $\mathcal { L } _ { \mathrm { { S u p } } }$ are the Faster-RCNN architecture and loss (Ren et al., 2015). In addition to color-dropping, we use scale-augmentation (Doersch et al., 2015) for training.
65
+
66
+ For linear classification, we keep the feature extractor $f _ { \theta }$ fixed to assess the representation in absolute terms. For efficient classification and transfer learning, we additionally explore fine-tuning the feature extractor for the supervised objective. In this regime, we initialize the feature extractor and classifier with the solutions $\theta ^ { * } , \psi ^ { * }$ found in the previous learning phase, and train them both for the supervised objective. To ensure that the feature extractor does not deviate too much from the solution dictated by the CPC objective, we use a smaller learning rate and early-stopping.
67
+
68
+ # 3 RELATED WORK
69
+
70
+ Data-efficient learning has typically been approached by two complementary methods, both of which seek to make use of more plentiful unlabeled data: representation learning and semisupervised learning. The former formulates an objective to learn a feature extractor $f _ { \theta }$ in an unsupervised manner, whereas the latter directly constrains the classifier $h _ { \psi }$ using the unlabeled data.
71
+
72
+ Representation learning saw early success using generative modeling (Kingma et al., 2014), but likelihood-based models have yet to generalize to more complex stimulus classes. Generative adversarial models have also been harnessed for representation learning (Donahue et al., 2016), and large-scale implementations have recently achieved corresponding gains in linear classification accuracy (Donahue & Simonyan, 2019).
73
+
74
+ In contrast to generative models which require the reconstruction of observations, self-supervised techniques directly formulate tasks involving the learned representation. For example, simply asking a network to recognize the spatial layout of an image led to representations that transferred to popular vision tasks such as classification and detection (Doersch et al., 2015; Noroozi & Favaro, 2016). Other works showed that prediction of color (Zhang et al., 2016; Larsson et al., 2017) and image orientation (Gidaris et al., 2018), and invariance to data augmentation (Dosovitskiy et al., 2014) can provide useful self-supervised tasks. Beyond single images, works have leveraged video cues such as object tracking (Wang & Gupta, 2015), frame ordering (Misra et al., 2016), and object boundary cues (Li et al., 2016; Pathak et al., 2016). Non-visual information can be equally powerful; information about camera motion (Agrawal et al., 2015; Jayaraman & Grauman, 2015), scene geometry (Zamir et al., 2016), or sound (Arandjelovic & Zisserman, 2017; 2018) can all serve as natural sources of supervision.
75
+
76
+ While many of these tasks require predicting fixed quantities computed from the data, another class of contrastive methods formulate their objectives in the learned representations themselves. CPC is a contrastive representation learning method that maximizes the mutual information between spatially removed latent representations with InfoNCE (van den Oord et al., 2018), a loss function based on Noise-Contrastive Estimation (Gutmann & Hyvarinen, 2010; Mnih & Kavukcuoglu, 2013). Two ¨ other methods have recently been proposed using the same loss function, but with different associated prediction tasks. Contrastive Multiview Coding (Tian et al., 2019) maximizes the mutual information between representations of different views of the same observation. Augmented Multiscale Deep InfoMax (AMDIM, Bachman et al., 2019) is most similar to CPC in that it makes predictions across space, but differs in that it also predicts representations across layers in the model. In addition, AMDIM limits the receptive field of its representation, but does this by constraining the number of spatial convolutions in the network architecture rather than using image patches.
77
+
78
+ A common alternative approach for improving data efficiency is label-propagation (Zhu & Ghahramani, 2002), where a classifier is trained on a subset of labeled data, then used to label parts of the unlabeled dataset, after which the process is repeated. This label-propagation can either be discrete (as in pseudo-labeling, Lee, 2013) or continuous (as in entropy minimization, Grandvalet & Bengio, 2005). The predictions of this classifier are often constrained to be smooth with respect to certain deformations, such as data-augmentation (Xie et al., 2019) or adversarial perturbation (Miyato et al., 2018). Representation learning and semi-supervised learning have been shown to be complementary and can be combined to great effect (Zhai et al., 2019), which is why we focus solely on representation learning in this paper.
79
+
80
+ # 4 RESULTS
81
+
82
+ When asking whether CPC enables data-efficient learning, we wish to use the best possible representative of this model class. Unfortunately, purely unsupervised metrics tell us little about downstream performance, and implementation details have been shown to matter enormously (Doersch & Zisserman, 2017; Kolesnikov et al., 2019). Since many design choices (e.g. network architecture and datapreprocessing) have been previously evaluated using linear classification, we use this benchmark in section 4.1 to align the CPC model with best practices in representation learning and compare to published results. In section 4.2 we select the best performing model from the previous section and assess whether it enables efficient classification. We also investigate to what extent the first, more common metric (linear classification accuracy) is predictive of efficient classification. Finally, in section 4.3 we investigate the generality of our results through transfer learning to PASCAL-2007.
83
+
84
+ # 4.1 FROM CPC V1 TO CPC V2
85
+
86
+ The overarching principle behind our new model design is to increase the scale and efficiency of the encoder architecture while also maximizing the supervisory signal we obtain from each image. At the same time, it is important not to allow the network to solve the problem trivially, i.e., without learning semantics. To this end, we seek to remove low-level cues common across patches by augmenting individual patches independently, using standard stochastic data-processing techniques from supervised and self-supervised learning.
87
+
88
+ We identify four axes for model capacity and task setup that could impact the model’s performance. The first axis increases model capacity by increasing depth and width, while the second improves training efficiency capacity by introducing layer normalization. The third axis increases task complexity by making predictions in all four directions, and the fourth does so by performing more extensive patch-based augmentation.
89
+
90
+ Model capacity. Recent work has shown that networks and more effective training improves self-supervised learning (Doersch & Zisserman, 2017; Kolesnikov et al., 2019), but the original CPC model used only the first 3 stacks of a ResNet-101 (He et al., 2016a) architecture (i.e. a ResNet-92). Therefore, we converted the third residual stack of ResNet-101 (originally containing 23 blocks, 1024-dimensional feature maps, and 256-dimensional bottleneck layers), to use 46 blocks, with 4096-dimensional feature maps and 512-dimensional bottleneck layers. We call the resulting network ResNet-161. Consistent with prior results, this new architecture delivers better performance regardless of
91
+
92
+ ![](images/3eeded7c7663fc17771caa90292cc1343662124f1094d06f22d9ca255036f2a3.jpg)
93
+ Figure 3: Linear classification performance of new variants of CPC, which incrementally add a series of modifications. BU: bottum up spatial predictions. HF: randomly flipping patches horizontally. LN: layer normalization. RC: random color-dropping. TL: tuned prediction lengths. HP: horizontal spatial predictions. We use color to indicate the number of spatial predictions used (orange, green, blue for 1, 2 and 4 directions).
94
+
95
+ Table 1: Linear classifier $h _ { \psi }$ trained with $100 \%$ of labels. Comparison to linear separability of other self-supervised methods. In all cases a feature extractor is optimized in an unsupervised manner, and a linear classifier is trained on top using all labels in the ImageNet dataset.
96
+
97
+ <table><tr><td>Method</td><td>Top-1</td><td>Top-5</td></tr><tr><td>Motion Segmentation (MS) (Pathak et al., 2016) Exemplar (Ex) (Dosovitskiy et al.,2014) Relative Position (RP) (Doersch et al.,2015) Colorization (Col) (Zhang et al., 2016) Combination of MS + Ex + RP+ Col (Doersch &amp; Zisserman,2017) CPC v1 (van den Oord et al., 2018) Rotation (Kolesnikov et al., 2019)</td><td>27.6 31.5 36.2 39.6 1 48.7 55.4</td><td>48.3 53.1 59.2 62.5 69.3 73.6</td></tr><tr><td>CMC (Tian et al., 2019) Local Aggregation (Zhuang et al., 2019)</td><td>60.1 60.2</td><td>82.8 1 =</td></tr><tr><td>BigBiGAN (Donahue &amp; Simonyan,2019) AMDIM (Bachman et al., 2019) CPC v2 (ours) 65.9</td><td>61.3 68.1</td><td>81.9</td></tr></table>
98
+
99
+ other design choices. Interestingly, a larger architecture delivers larger improvements with more efficient training, more self-supervised losses, and more patch-based augmentations (Fig. 3, $+5 \%$ Top-1 accuracy with original training scheme, $+ 1 0 \%$ accuracy with new one).
100
+
101
+ Layer normalization. Large architectures are more difficult to train efficiently. Early works on context prediction with patches used batch normalization (Ioffe & Szegedy, 2015; Doersch et al., 2015) to speed training. However, with CPC we find that batch normalization actually harms downstream performance of large models. We hypothesize that batch normalization allows large models to find a trivial solution to CPC: it introduces a dependency between patches (through the batch statistics) that can be exploited to bypass the constraints on the receptive field. We find that we can reclaim much of batch normalization’s training efficiency using layer normalization (Ba et al., 2016), which leads to a small gain for the smaller architecture $+ 1 \%$ accuracy over equivalent architectures that use neither normalization) and a larger gain for the larger architecture $( + 2 . 5 \%$ accuracy).
102
+
103
+ Prediction lengths and directions. Larger architectures also run a greater risk of overfitting. We address this by asking more from the network: specifically, whereas van den Oord et al. (2018) predicted each patch using only context from spatially beneath it, we repeatedly predict the patch using context from above, to the right, and to the left, resulting in up to four times as many prediction tasks. Combining top-to-bottom with bottom-to-top helps both model architectures $42 \%$ accuracy for both), but using all 4 spatial directions only benefits the larger model (an additional $+ 1 . 5 \%$ for the larger model, ${ \bf - 1 \% }$ for the smaller), consistent with the idea that model capacity and amount of supervision must go hand-in-hand. We also hypothesized that prediction “length”—i.e. offset between the predicted patch and the aggregated context—might affect performance, as distant patches might lie on distinct objects, encouraging the network to memorize images. Indeed, limiting the range of the prediction length $k$ to $\{ 2 , 3 \}$ performed better than $\{ 2 , \ldots , 5 \}$ as was used originally $+ 1 \%$ for the larger model).
104
+
105
+ Patch-based augmentation. If the network can solve CPC using low-level patterns (e.g. straight lines continuing between patches, chromatic aberration), it need not learn semantically meaningful content. Augmenting the low-level variability across patches can remove such low level cues. The original CPC model spatially jitters individual patches independently. We further this logic by adopting the ‘color dropping’ method of Doersch et al. (2015), which randomly drops two of the three color channels in each patch, and find it to delivers systematic gains $( + 1 \%$ for the small model, $+3 \%$ for the larger one). We also randomly flip patches horizontally, but find it only benefits the smaller model $( + 1 \% )$ .
106
+
107
+ Combined. Cumulatively, these fairly straightforward implementation changes lead to a substantial improvement to the original CPC model $6 5 . 9 \%$ Top-1 accuracy, a $17 \%$ improvement), making it competitive with recent approaches and outperforming prior methods (see table 1). Interestingly, if we train the same patch-based architecture from scratch in a fully supervised manner, we obtain $6 6 . 4 \%$ Top-1 accuracy (with batch normalization; $6 2 . 5 \%$ without), suggesting that CPC is now nearly saturating the architecture’s representational power despite not using labels. These results illustrate how architecture and data have an outsized impact on the linear classification performance of self-supervised representations, and are interesting to compare with with previous results. For example, in AMDIM, different settings of data augmentation alone can result in a nearly $10 \%$ absolute increase in performance on ImageNet linear classification.
108
+
109
+ # 4.2 EFFICIENT IMAGE CLASSIFICATION
110
+
111
+ toWe now turn to our original question of whether CPC can enable data-efficient image recognition. We start by evaluating the performance of purely-supervised networks as the size of the labeled dataset $\mathbb { D } _ { l }$ varies from $1 \%$ to $100 \%$ of ImageNet, training separate classifiers on each subset. We found that a ResNet-152 to works best across all data-regimes (see Appendix). Despite our efforts to tune the supervised model for low-data classification (including network depth, regularization, and optimization parameters), the accuracy of the best model only reaches $4 4 . 1 \%$ Top-5 accuracy when trained on $1 \%$ of the dataset (compared to $9 3 . 9 \%$ when trained on the entire dataset, see Fig. 1, red).
112
+
113
+ Contrastive Predictive Coding. We now address our central question of whether CPC enables data-efficient learning. We follow the same paradigm as for the supervised baseline (training and evaluating a separate classifier for each size subset), stacking a neural network classifier on top of the CPC latents $\begin{array} { r l r } { z } & { { } = } & { f _ { \theta } ( { \pmb x } ) } \end{array}$ rather than the raw image pixels $_ { \textbf { \em x } }$ (see section 2.2, efficient classification, and Appendix). This representation, which we selected for its improved linear classification performance (CPC v2 in Fig. 3), leads to a significant increase in data-efficiency compared to purely supervised networks (Fig. 1, blue curve). This classifier yields $7 2 . 9 \%$ Top-5 accuracy with only $1 \%$ of the labels, a $2 9 \%$ absolute improvement $65 \%$ relative) over purely-supervised methods. Surprisingly, when given the entire dataset, this classifier reaches $8 0 . 6 \% / 9 5 . 2 \%$ Top1/Top5 accuracy, surpassing our supervised baseline (ResNet-152: $7 8 . 0 \% / 9 3 . 9 \%$ accuracy) and published results (ResNet-200: $7 9 . 9 \% / 9 5 . 2 \%$ , He et al. (2016b)). We find similar results in all other data-regimes we considered (see Fig. 1).
114
+
115
+ How important are the model specifications described in Section 4.1 for low-data classification? We hypothesized that predictable representations might enable data-efficient classifi
116
+
117
+ ![](images/106f2252ad377e16a329cfb21360459a72fdc1d09e4f745b26572da1cf6d5d14.jpg)
118
+ Figure 4: Relationship between linear classification accuracy and low-data classification, for different variants of the CPC model. Left: CPC variants with the same architecture but different training protocols. Orange, green, and blue dots correspond to CPC models making predictions in 1, 2, and 4 spatial directions respectively. Within a color group, different models correspond to other implementation details (e.g. layer norm and patch augmentation, and combinations thereof).
119
+
120
+ cation, and therefore expect that increasing the amount of ‘predictability’ in the representation should also increase its ability to learn from small amounts of data. Fig. 4 shows evidence for this by ablating model parameters and comparing linear classification performance against low-data classification. Consistent with our hypothesis, increasing the number of spatial directions in the CPC prediction task (which increased linear classification performance) systematically increases low-data classification performance (Fig. 4, left, different color groups). As a control, we asked if all modifications that improve linear classification also improve low-data classification. We did not find evidence in favor of this: improvements in linear classification as a result of changing other model parameters (patch-based data-augmentation, layer normalization, and combinations thereof) seem uncorrelated to performance in other tasks (Fig. 4, left, within green group: $R ^ { 2 } = 0 . 1 7 , p = 0 . 3 6$ ). Different architectural specifications also produced different changes in both tasks (Fig. 4, right). Whereas increasing the depth of the encoding network greatly improves both metrics, increasing the network width (and therefore the number of features used for linear classification) only improves linear classification accuracy.
121
+
122
+ Table 2: ResNet classifier $h _ { \psi }$ trained with $1 \%$ or $10 \%$ of labels. Comparison to other methods for semi-supervised learning using $1 \%$ or $10 \%$ of labeled data. Representation learning methods use a classifier to discriminate an unsupervised representation, and optimize it solely for the supervised objective on labeled data. Label-propagation methods on the other hand further constrain the classifier with smoothness and entropy criteria on unlabeled data, making the additional assumption that all training images fit into a single (unknown) testing category. $\dagger$ denotes methods implemented in this work, fixed and fine-tuned denote whether the feature extractor is allowed to accommodate the supervised objective.
123
+
124
+ <table><tr><td>Labeled data 1% 10% 100% Method Top-5 accuracy</td></tr><tr><td></td></tr><tr><td>Supervised baseline 44.1 82.1 93.9 Methods using label-propagation:</td></tr><tr><td>Pseudolabeling (Zhai et al., 2019) 51.6 82.4 VAT + Entropy Minimization (Zhai et al., 2019) 47.0 83.4 Unsup. Data Augmentation (Xie et al., 2019) 88.5</td></tr><tr><td>Rotation+ VAT+Ent.Min. (Zhai et al.,2019) 91.2 95.0 =</td></tr><tr><td>Methods using representation learning only:</td></tr><tr><td>Instance Discrimination (Wu et al., 2018) 39.2 77.4</td></tr><tr><td>Rotation (Zhai et al., 2019) 57.5 86.4</td></tr><tr><td>+ResNet trained on BigBiGAN (fixed) 55.2 78.8 87.0</td></tr><tr><td>+ResNet trained on AMDIM (fixed) 67.4 85.8 92.2</td></tr><tr><td>+ResNet trained on CPC v2 (fixed) 72.3 89.1 94.4 +ResNet trained on CPC v2 (fine-tuned) 72.9 89.5 95.2</td></tr></table>
125
+
126
+ Other unsupervised representations. How well does the CPC representation compare to other representations that have been learned in an unsupervised manner? If predictable representations are uniquely suited for efficient classification, we would expect other methods within this family to perform similarly, and other model classes less so. Table 2 compares our best model with other works on efficient recognition. We consider three objectives from different model classes: self-supervised learning with rotation prediction (Zhai et al., 2019), large-scale adversarial feature learning (BigBiGAN, Donahue & Simonyan, 2019), and another contrastive prediction objective (AMDIM, Bachman et al., 2019). Zhai et al. (2019) evaluate the low-data classification performance of representations learned with rotation prediction using a similar paradigm and architecture (ResNet-152), hence we report their results directly. Given $1 \%$ of ImageNet, their method achieves $5 7 . 5 \%$ Top-5 accuracy, consistently with the reduced accuracy of a linear classifier ( $5 5 . 4 \%$ vs $6 5 . 9 \%$ for CPC)1.
127
+
128
+ Because BigBiGAN and AMDIM achieve stronger linear classification accuracy than rotation prediction $6 1 . 3 \%$ and $6 8 . 1 \%$ Top-1 accuracy, respectively), we might expect better performance on efficient classification as well. Since their authors do not report results on efficient classification we evaluated these representations using the same paradigm we used for evaluating CPC, stacking a ResNet classifier on top of the $7 \times 7 \times 8 1 9 2$ latents of the BigBiGAN and the $7 \times 7 \times 2 5 6 0$ grid of feature vectors of AMDIM. We found fine-tuned representations to yield only marginal gains over fixed ones $7 2 . 9 \%$ compared to $7 2 . 3 \%$ Top-5 accuracy given $1 \%$ of labels), hence for simplicity we evaluate BigBiGAN and AMDIM on this task while keeping them fixed. We re-tune the hyper-parameters of the classifier (including optimization, regularization, etc.) for each of these representations separately. Although these methods achieve similar performance in terms of linear classification, we find them to achieve very different results in efficient classification. Given $1 \%$ of ImageNet, classifiers trained on top of BigBiGAN achieve $5 5 . 2 \%$ Top-5 accuracy, similarly to rotation prediction $( 5 7 . 5 \% )$ , despite its increased linear classification accuracy $( + 6 \%$ relative to rotation prediction). In contrast, AMDIM (which also belongs to the family of contrastive prediction methods) achieves $6 7 . 4 \%$ on this same task. Again, its increased linear classification accuracy did not entail an increase in data-efficiency. Nevertheless, in line with our initial hypothesis, we find that contrastive prediction methods such as CPC surpass other approaches in our efficient classification experiments, and that linear classification performance is not perfectly correlated with these results.
129
+
130
+ Other semi-supervised techniques A separate class of methods for low-data classification attempts to propagate the knowledge extracted from the subset of labeled examples to unlabeled examples while being invariant to augmentation or other perturbations. These methods generally depend on the quality of the classifier’s predictions, and as such tend to fare well when given intermediate amounts of data. Although not sufficient in themselves (Unsupervised Data Augmentation (Xie et al., 2019), Virtual Adversarial Training (Miyato et al., 2018) and entropy minimization (Grandvalet & Bengio, 2005), and pseudo-labeling (Lee, 2013) achieve $8 5 . 8 \%$ , $8 3 . 4 \%$ , and $8 2 . 4 \%$ Top-5 accuracy with $10 \%$ of labels, compared to our $8 9 . 4 \%$ ) when combined with representation learning (e.g. rotation prediction Zhai et al., 2019) they can provide considerable gains $9 1 . 2 \%$ Top5 accuracy). It is therefore surprising that CPC representations alone can enable accuracy that is comparable to that of these methods, and investigating to what extent they can be combined would be an interesting topic of future work.
131
+
132
+ # 4.3 TRANSFER LEARNING: IMAGE DETECTION ON PASCAL VOC 2007
133
+
134
+ We next investigate transfer performance on object detection on the PASCAL-2007 dataset, which reflects the practical scenario where a representation must be trained on a dataset with different statistics than the dataset of interest. This dataset also tests the efficiency of the representation as it only contains 5011 labeled images to train from. In this setting, we replaced the neural network classifier $h _ { \psi }$ used previously with a Faster-RCNN (Ren et al., 2015) image detection architecture, and use the pre-trained feature extractor on ImageNet. As before, we first trained the Faster-RCNN model while keeping the feature extractor fixed, then fine-tuned the entire model end-to-end. Table 3 displays our results compared to other methods. Most competing methods, which optimize a single unsupervised objective on ImageNet before fine-tuning on PASCAL detection, attain around $65 \%$ mean average precision. Leveraging larger unlabeled datasets increases their performance up to $6 7 . 8 \%$ (Caron et al., 2019). Combining multiple forms of self-supervision enables them to reach $7 0 . 5 \%$ (Doersch & Zisserman, 2017). The proposed method, which learns only from ImageNet data using a single unsupervised objective, reaches $7 0 . 6 \%$ when equipped with a ResNet-101 feature extractor $f _ { \theta }$ (as for most competing methods (Doersch & Zisserman, 2017) but not all (Caron et al., 2018; 2019). Equipped with the more powerful ResNet-161 feature extractor $f _ { \theta }$ , our method reaches $7 2 . 7 \%$ . Importantly, this result is only $2 \%$ short of the performance attained by purely supervised transfer learning, which we obtain by using all ImageNet labels before transferring to PASCAL.
135
+
136
+ # 5 DISCUSSION
137
+
138
+ We asked whether CPC could enable data-efficient image recognition, and found that it indeed greatly improves the accuracy of classifiers and object detectors when given small amounts of labeled data. Surprisingly, CPC even improves results given ImageNet-scale labels. Our results show that there is still room for improvement using relatively straightforward changes such as augmentation, optimization, and network architecture. Furthermore, we found that the standard method for evaluating unsupervised representations—linear classification—is only partially predictive of efficient recognition performance, suggesting that further research should focus on efficient recognition as a standalone benchmark. Overall, these results open the door toward research on problems where data is naturally limited, e.g. medical imaging or robotics.
139
+
140
+ Table 3: Faster-RCNN $h _ { \psi }$ trained with $100 \%$ of PASCAL labels. Comparison of PASCAL 2007 image detection accuracy to other transfer methods. The supervised baseline learns from the entire labeled ImageNet dataset and fine-tunes for PASCAL detection. The second class of methods learns from the same unlabeled images before transferring. All of these methods pre-train on the ImageNet dataset, except for DeeperCluster which learns from the larger, but uncurated, YFCC100M dataset (Thomee et al., 2015). All results are reported in terms of mean average precision (mAP). $\dagger$ denotes methods implemented in this work.
141
+
142
+ <table><tr><td>Method</td><td>mAP</td></tr><tr><td>Transfer from labeled data: Supervised - ResNet-152</td><td>74.7</td></tr><tr><td>Transfer from unlabeled data: Exemplar (Ex) (Dosovitskiy et al., 2014) Motion Segmentation (MS) (Pathak et al.,2016)</td><td>60.9</td></tr><tr><td>Colorization (Col) (Zhang et al.,2016) Relative Position (RP) (Doersch et al.,2015)</td><td>61.1 65.5</td></tr><tr><td>Combination of Ex + MS + Col +RP (Doersch &amp; Zisserman,2017)</td><td>66.8 70.5</td></tr><tr><td>Instance Discrimination (Wu et al., 2018)</td><td>65.4</td></tr><tr><td>Deep Cluster (Caron et al., 2018) Deeper Cluster (Caron et al., 2019)</td><td>65.9</td></tr></table>
143
+
144
+ Furthermore, images are far from the only domain where unsupervised representation learning is important: for example, unsupervised learning is already a critical step in language (Mikolov et al., 2013; Devlin et al., 2018), and shows promise in domains like audio (van den Oord et al., 2018; Arandjelovic & Zisserman, 2018; 2017), video (Jing & Tian, 2018; Misra et al., 2016), and robotic manipulation (Pinto & Gupta, 2016; Pinto et al., 2016; Sermanet et al., 2018). Currently much self-supervised work builds upon tasks tailored for a specific domain (often images), which may not be easily adapted to other domains. Contrastive prediction methods, including the techniques suggested in this paper, are task agnostic and could therefore serve as a unifying framework for integrating these tasks and modalities. This generality is particularly useful given that many realworld environments are inherently multimodal, e.g. robotic environments which can have vision, audio, touch, proprioception, action, and more over long temporal sequences. Given the importance of increasing the amounts of self-supervision (via additional directions of prediction), integrating these modalities and tasks could lead to unsupervised representations which rival the efficiency and effectiveness of biological ones.
145
+
146
+ # REFERENCES
147
+
148
+ Pulkit Agrawal, Joao Carreira, and Jitendra Malik. Learning to see by moving. In ICCV, 2015.
149
+
150
+ Relja Arandjelovic and Andrew Zisserman. Look, listen and learn. In Proceedings of the IEEE International Conference on Computer Vision, pp. 609–617, 2017.
151
+
152
+ Relja Arandjelovic and Andrew Zisserman. Objects that sound. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 435–451, 2018.
153
+
154
+ Lei Jimmy Ba, Ryan Kiros, and Geoffrey E. Hinton. Layer normalization. CoRR, abs/1607.06450, 2016.
155
+
156
+ Philip Bachman, R Devon Hjelm, and William Buchwalter. Learning representations by maximizing mutual information across views. arXiv preprint arXiv:1906.00910, 2019.
157
+
158
+ H.B. Barlow. Unsupervised learning. Neural Computation, 1(3):295–311, 1989. doi: 10.1162/neco. 1989.1.3.295.
159
+
160
+ Mathilde Caron, Piotr Bojanowski, Armand Joulin, and Matthijs Douze. Deep clustering for unsupervised learning of visual features. In The European Conference on Computer Vision (ECCV), September 2018.
161
+
162
+ Mathilde Caron, Piotr Bojanowski, Julien Mairal, and Armand Joulin. Leveraging large-scale uncurated data for unsupervised pre-training of visual features. 2019.
163
+
164
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. CoRR, abs/1810.04805, 2018.
165
+
166
+ Carl Doersch and Andrew Zisserman. Multi-task self-supervised visual learning. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2051–2060, 2017.
167
+
168
+ Carl Doersch, Abhinav Gupta, and Alexei A Efros. Unsupervised visual representation learning by context prediction. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1422–1430, 2015.
169
+
170
+ Jeff Donahue and Karen Simonyan. Large scale adversarial representation learning. arXiv preprint arXiv:1907.02544, 2019.
171
+
172
+ Jeff Donahue, Philipp Krahenb ¨ uhl, and Trevor Darrell. Adversarial feature learning. ¨ arXiv preprint arXiv:1605.09782, 2016.
173
+
174
+ Alexey Dosovitskiy, Jost Tobias Springenberg, Martin Riedmiller, and Thomas Brox. Discriminative unsupervised feature learning with convolutional neural networks. In Advances in neural information processing systems, pp. 766–774, 2014.
175
+
176
+ Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes challenge 2007 (voc2007) results. 2007.
177
+
178
+ Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. arXiv preprint arXiv:1803.07728, 2018.
179
+
180
+ Yves Grandvalet and Yoshua Bengio. Semi-supervised learning by entropy minimization. In Advances in neural information processing systems, pp. 529–536, 2005.
181
+
182
+ Michael Gutmann and Aapo Hyvarinen. Noise-contrastive estimation: A new estimation principle ¨ for unnormalized statistical models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 297–304, 2010.
183
+
184
+ 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.
185
+
186
+ 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.
187
+
188
+ G.E. Hinton, T.J. Sejnowski, H.H.M.I.C.N.L.T.J. Sejnowski, and T.A. Poggio. Unsupervised Learning: Foundations of Neural Computation. A Bradford Book. MIT Press, 1999. ISBN 9780262581684.
189
+
190
+ Olivier J. Henaff, Robbe L. T. Goris, and Eero P. Simoncelli. Perceptual straightening of natural ´ videos. Nature Neuroscience, Apr 2019.
191
+
192
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015.
193
+
194
+ Dinesh Jayaraman and Kristen Grauman. Learning image representations tied to ego-motion. In ICCV, 2015.
195
+
196
+ Longlong Jing and Yingli Tian. Self-supervised spatiotemporal feature learning by video geometric transformations. arXiv preprint arXiv:1811.11387, 2018.
197
+
198
+ Durk P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In Advances in neural information processing systems, pp. 3581–3589, 2014.
199
+
200
+ Alexander Kolesnikov, Xiaohua Zhai, and Lucas Beyer. Revisiting self-supervised visual representation learning. CoRR, abs/1901.09005, 2019. URL http://arxiv.org/abs/1901.09005.
201
+
202
+ Brenden M Lake, Ruslan Salakhutdinov, and Joshua B Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015.
203
+
204
+ Barbara Landau, Linda B Smith, and Susan S Jones. The importance of shape in early lexical learning. Cognitive development, 3(3):299–321, 1988.
205
+
206
+ Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Colorization as a proxy task for visual understanding. In CVPR, pp. 6874–6883, 2017.
207
+
208
+ Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. nature, 521(7553):436, 2015.
209
+
210
+ Dong-Hyun Lee. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In Workshop on Challenges in Representation Learning, ICML, volume 3, pp. 2, 2013.
211
+
212
+ Yin Li, Manohar Paluri, James M Rehg, and Piotr Dollar. Unsupervised learning of edges. In ´ CVPR, 2016.
213
+
214
+ Ellen M Markman. Categorization and naming in children: Problems of induction. mit Press, 1989.
215
+
216
+ Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In C. J. C. Burges, L. Bottou, M. Welling, Z. Ghahramani, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 26, pp. 3111–3119. Curran Associates, Inc., 2013.
217
+
218
+ Ishan Misra, C Lawrence Zitnick, and Martial Hebert. Shuffle and learn: unsupervised learning using temporal order verification. In ECCV, 2016.
219
+
220
+ Takeru Miyato, Shin-ichi Maeda, Shin Ishii, and Masanori Koyama. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. IEEE transactions on pattern analysis and machine intelligence, 2018.
221
+
222
+ Andriy Mnih and Koray Kavukcuoglu. Learning word embeddings efficiently with noise-contrastive estimation. In Advances in neural information processing systems, pp. 2265–2273, 2013.
223
+
224
+ 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.
225
+
226
+ Stephanie E Palmer, Olivier Marre, Michael J Berry, and William Bialek. Predictive information in a sensory population. Proceedings of the National Academy of Sciences, 112(22):6908–6913, 2015.
227
+
228
+ Deepak Pathak, Ross Girshick, Piotr Dollar, Trevor Darrell, and Bharath Hariharan. Learning fea-´ tures by watching objects move. arXiv preprint arXiv:1612.06370, 2016.
229
+
230
+ Lerrel Pinto and Abhinav Gupta. Supersizing self-supervision: Learning to grasp from 50k tries and 700 robot hours. In ICRA, 2016.
231
+
232
+ Lerrel Pinto, James Davidson, and Abhinav Gupta. Supervision via competition: Robot adversaries for learning tasks. arXiv preprint arXiv:1610.01685, 2016.
233
+
234
+ Rajesh PN Rao and Dana H Ballard. Predictive coding in the visual cortex: a functional interpretation of some extra-classical receptive-field effects. Nature neuroscience, 2(1):79, 1999.
235
+
236
+ 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.
237
+
238
+ 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.
239
+
240
+ Pierre Sermanet, Corey Lynch, Yevgen Chebotar, Jasmine Hsu, Eric Jang, Stefan Schaal, Sergey Levine, and Google Brain. Time-contrastive networks: Self-supervised learning from video. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 1134–1141. IEEE, 2018.
241
+
242
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929–1958, 2014.
243
+
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. CoRR, abs/1409.4842, 2014. URL http://arxiv.org/abs/1409.4842.
245
+
246
+ Bart Thomee, David A Shamma, Gerald Friedland, Benjamin Elizalde, Karl Ni, Douglas Poland, Damian Borth, and Li-Jia Li. Yfcc100m: The new data in multimedia research. arXiv preprint arXiv:1503.01817, 2015.
247
+
248
+ Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. arXiv preprint arXiv:1906.05849, 2019.
249
+
250
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
251
+
252
+ Xiaolong Wang and Abhinav Gupta. Unsupervised learning of visual representations using videos. In ICCV, 2015.
253
+
254
+ 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.
255
+
256
+ Qizhe Xie, Zihang Dai, Eduard Hovy, Minh-Thang Luong, and Quoc V. Le. Unsupervised Data Augmentation. arXiv e-prints, art. arXiv:1904.12848, Apr 2019.
257
+
258
+ Amir R Zamir, Tilman Wekel, Pulkit Agrawal, Colin Wei, Jitendra Malik, and Silvio Savarese. Generic 3D representation via pose estimation and matching. In ECCV, 2016.
259
+
260
+ Xiaohua Zhai, Avital Oliver, Alexander Kolesnikov, and Lucas Beyer. $S ^ { 4 } L$ : Self-supervised semisupervised learning. arXiv preprint arXiv:1905.03670, 2019.
261
+
262
+ Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In European conference on computer vision, pp. 649–666. Springer, 2016.
263
+
264
+ Xiaojin Zhu and Zoubin Ghahramani. Learning from labeled and unlabeled data with label propagation. In Technical Report CMU-CALD-02-107, Carnegie Mellon University, 2002.
265
+
266
+ Chengxu Zhuang, Alex Lin Zhai, and Daniel Yamins. Local aggregation for unsupervised learning of visual embeddings. arXiv preprint arXiv:1903.12355, 2019.
267
+
268
+ # A APPENDIX
269
+
270
+ # A.1 ADDITIONAL RESULTS
271
+
272
+ Table 4: Data efficient classification results with Top-1 accuracy.
273
+
274
+ <table><tr><td>Labeled data Method</td><td>1%</td><td>2%</td><td>5%</td><td>10% Top-1 accuracy</td><td>20%</td><td>50%</td><td>100%</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Supervised trained on pixels</td><td>23.1</td><td>34.8</td><td>50.2</td><td>60.0</td><td>67.6</td><td>74.4</td><td>78.0</td></tr><tr><td>ReseNet trained on CPC v2 (fine-tuned)</td><td>46.3</td><td>54.7</td><td>64.1</td><td>69.7</td><td>73.0</td><td>77.3</td><td>80.6</td></tr></table>
275
+
276
+ Table 5: Data efficient classification results with Top-5 accuracy (data in Fig. 1).
277
+
278
+ <table><tr><td>Labeled data Method</td><td>1%</td><td>2%</td><td>5%</td><td>10% Top-5 accuracy</td><td>20%</td><td>50%</td><td>100%</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Supervised trained on pixels</td><td>44.1</td><td>59.9</td><td>75.2</td><td>82.1</td><td>87.9</td><td>91.8</td><td>93.8</td></tr><tr><td>ReseNet trained on CPC v2 (fine-tuned)</td><td>72.9</td><td>79.6</td><td>86.1</td><td>89.5</td><td>91.4</td><td>93.6</td><td>95.2</td></tr></table>
279
+
280
+ # A.2 INFONCE IMPLEMENTATION
281
+
282
+ For completeness, we provide pseudo-code for the main calculations involved in the InfoNCE objective, loosely modeled after Tensorflow operations. We suppose we have just calculated a set of latents $z _ { i , j } = f _ { \theta } ( \pmb { x } _ { i , j } )$ for $i , j \in \{ 1 , . . . , 7 \}$ , each one being e.g. a 4096-dimensional vector. Assuming we do so for a batch of $B$ images $\{ { \pmb x } \}$ , the set of latents is a tensor of size $B \times 7 \times 7 \times 4 0 9 6$ .
283
+
284
+ def pixelCNN(latents): # latents: [B, H, W, D] cres $=$ latents cres_dim $=$ cres.shape[-1] for in range(5): c $=$ Conv2D(output_channels $= 2 5 6$ , kernel_shape $=$ (1, 1))(cres) c = ReLU(c) c = Conv2D(output_channels $= 2 5 6$ , kernel_shape $=$ (1, 3))(c) c = Pad(c, [[0, 0], [1, 0], [0, 0], [0, 0]]) c = Conv2D(output_channels $= 2 5 6$ , kernel_shape $=$ (2, 1), type $= ^ { \parallel }$ VALID')(c) c $=$ ReLU(c) c $=$ Conv2D(output_channels $=$ cres_dim, kernel_shape $=$ (1, 1))(c) cres $=$ cres + c cres $=$ ReLU(cres) return cres
285
+
286
+ # A.3 LINEAR CLASSIFICATION
287
+
288
+ • Model architecture: Having extracted $8 0 \mathrm { x } 8 0$ patches with a stride of $3 2 \mathrm { x } 3 2 $ from a $2 4 0 \times 2 4 0$ shaped input image, we end up with a grid of 6x6 features (each of which is obtained from our ResNet-161 architecture). This gives us a [6,6,4096] tensor for the image. We then use a Batch-Normalization layer to normalize the features (without scale parameter) followed by a 1x1 convolution mapping each feature in the grid to the 1000 logits for ImageNet classification. We then spatially-mean-pool these logits to end up with the final log probabilities for the linear classification.
289
+ • We use the Inception preprocessing (Szegedy et al., 2014) to extract $2 4 0 \times 2 4 0$ crops from the raw image. The image is divided into subcrops as per CPC data-preprocessing used for CPC pre-training.
290
+ • Optimization details: We use Adam Optimizer with a learning rate of 5e-4. We train the model on a batch size of 512 images with 32 images per core spread over 16 workers.
291
+
292
+ A.4 EFFICIENT CLASSIFICATION: PURELY SUPERVISED
293
+
294
+ In order to find the best model within this class, we vary the following hyperparameters:
295
+
296
+ • Model architecture: We investigate using ResNet-50, ResNet-101, and ResNet-152 model architectures, all of them using the $\mathbf { \hat { v } } _ { \mathbf { \Delta } } 2 \mathbf { \hat { \mu } }$ variant (He et al., 2016b), and find larger architecture to perform better, even when given smaller amounts of data. We insert a DropOut layer before the final linear classification layer (Srivastava et al., 2014). • Data pre-processing: We use the Inception pre-processing pipeline (Szegedy et al., 2014). • Optimization details: We vary the learning rate in $\{ 0 . 0 5 , 0 . 1 , 0 . 2 \}$ , the weight decay logarithmically from $1 0 ^ { - 5 }$ to $1 0 ^ { - 2 }$ , the DropOut linearly from 0 to 1, and the batch size per worker in $\{ 1 6 , 3 2 \}$ .
297
+
298
+ We chose the best performing model for each training subset $\mathbb { D } _ { l }$ of labeled ImageNet (using a separate validation set), and report its accuracy on the test set (i.e. the publicly available ILSVRC-2012 validation set).
parse/train/rJerHlrYwH/rJerHlrYwH_content_list.json ADDED
@@ -0,0 +1,1615 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "DATA-EFFICIENT IMAGE RECOGNITION WITH CONTRASTIVE PREDICTIVE CODING ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 174,
8
+ 98,
9
+ 684,
10
+ 146
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Anonymous authors Paper under double-blind review ",
17
+ "bbox": [
18
+ 183,
19
+ 170,
20
+ 398,
21
+ 198
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "ABSTRACT ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 454,
31
+ 234,
32
+ 544,
33
+ 251
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "Human observers can learn to recognize new categories of objects from a handful of examples, yet doing so with machine perception remains an open challenge. We hypothesize that data-efficient recognition is enabled by representations which make the variability in natural signals more predictable, as suggested by recent perceptual evidence. We therefore revisit and improve Contrastive Predictive Coding, a recently-proposed unsupervised learning framework, and arrive at a representation which enables generalization from small amounts of labeled data. When provided with only $1 \\%$ of ImageNet labels (i.e. 13 per class), this model retains a strong classification performance, $73 \\%$ Top-5 accuracy, outperforming supervised networks by $28 \\%$ (a $65 \\%$ relative improvement) and state-of-the-art semisupervised methods by $14 \\%$ . We also find this representation to serve as a useful substrate for object detection on the PASCAL-VOC 2007 dataset, approaching the performance of representations trained with a fully annotated ImageNet dataset. ",
40
+ "bbox": [
41
+ 233,
42
+ 267,
43
+ 764,
44
+ 446
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "1 INTRODUCTION ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 178,
54
+ 476,
55
+ 334,
56
+ 492
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "Deep neural networks excel at perceptual tasks when labeled data are abundant, yet their performance degrades substantially when provided with limited supervision (Fig. 1, red). In contrast, humans and animals can quickly learn about new classes of objects from few examples (Landau et al., 1988; Markman, 1989). What accounts for this monumental difference in data-efficiency between biological and machine vision? While highly-structured representations (e.g. as proposed by Lake et al., 2015) may improve data-efficiency, it remains unclear how to program explicit structures that capture the enormous complexity of real visual scenes like those in ImageNet (Russakovsky et al., 2015). An alternative hypothesis has proposed that intelligent systems need not be structured a priori, but can instead learn about the structure of the world in an unsupervised manner (Barlow, 1989; Hinton et al., 1999; LeCun et al., 2015). Choosing an appropriate training objective is an open problem, but a promising guiding principle has emerged recently: good representations should make the spatio-temporal variability in natural signals more predictable. Indeed, human perceptual representations have been shown to linearize ",
63
+ "bbox": [
64
+ 174,
65
+ 510,
66
+ 483,
67
+ 881
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "image",
73
+ "img_path": "images/7b8ed316aeaae9bdfe3d3d7e12974b01335c33b7eb790b24e724753c0422fb2e.jpg",
74
+ "image_caption": [
75
+ "Figure 1: Data-efficient image recognition with Contrastive Predictive Coding. With decreasing amounts of labeled data, supervised networks trained on pixels fail to generalize (red). When trained on unsupervised representations learned with CPC, these networks retain a much higher accuracy in this low-data regime (blue). Equivalently, the accuracy of supervised networks can be matched with significantly fewer labels. "
76
+ ],
77
+ "image_footnote": [],
78
+ "bbox": [
79
+ 500,
80
+ 512,
81
+ 820,
82
+ 733
83
+ ],
84
+ "page_idx": 0
85
+ },
86
+ {
87
+ "type": "text",
88
+ "text": "(or ‘straighten’) the temporal transformations found in natural videos, a property lacking from current supervised image recognition models (Henaff et al., 2019), and theories of both spatial and tem- ´ poral predictability have succeeded in describing properties of early visual areas (Rao & Ballard, ",
89
+ "bbox": [
90
+ 176,
91
+ 882,
92
+ 823,
93
+ 924
94
+ ],
95
+ "page_idx": 0
96
+ },
97
+ {
98
+ "type": "text",
99
+ "text": "1999; Palmer et al., 2015). In this work, we hypothesize that spatially predictable representations may allow artificial systems to benefit from human-like data-efficiency. ",
100
+ "bbox": [
101
+ 171,
102
+ 103,
103
+ 823,
104
+ 132
105
+ ],
106
+ "page_idx": 1
107
+ },
108
+ {
109
+ "type": "text",
110
+ "text": "Contrastive Predictive Coding (CPC, van den Oord et al., 2018) is an unsupervised objective which learns such predictable representations. CPC is a general technique that only requires in its definition that observations be ordered along e.g. temporal or spatial dimensions, and as such has been applied to a variety of different modalities including speech, natural language and images. This generality, combined with the strong performance of its representations in downstream linear classification tasks, makes CPC a promising candidate for investigating the efficacy of predictable representations for data-efficient image recognition. ",
111
+ "bbox": [
112
+ 174,
113
+ 138,
114
+ 825,
115
+ 236
116
+ ],
117
+ "page_idx": 1
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "Our work makes the following contributions: ",
122
+ "bbox": [
123
+ 174,
124
+ 243,
125
+ 468,
126
+ 257
127
+ ],
128
+ "page_idx": 1
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "• We revisit CPC in terms of its architecture and training methodology, and arrive at a new implementation of CPC with dramatically-improved ability to linearly separate image classes $+ 1 7 \\%$ Top-1 ImageNet classification accuracy). \nWe then train deep networks on top of the resulting CPC representations using very few labeled images (e.g. $1 \\%$ of the ImageNet dataset), and demonstrate test-time classification accuracy far above networks trained on raw pixels ( $73 \\%$ Top-5 accuracy, a $28 \\%$ absolute improvement), outperforming all other unsupervised representation learning methods $( + 1 5 \\%$ Top-5 accuracy over the previous state-of-the-art (Zhai et al., 2019)). Surprisingly, this representation also surpasses supervised methods when given the entire ImageNet dataset $+ 1 \\%$ Top-5 accuracy). \nWe isolate the contributions of different components of the final model to such downstream tasks. Interestingly, we find that linear classification accuracy is not always predictive of low-data classification accuracy, emphasizing the importance of this metric as a stand-alone benchmark for unsupervised learning. \n• Finally, we assess the generality of CPC representations by transferring them to a new task and dataset: object detection on PASCAL-VOC 2007. Consistent with the results from the previous section, we find CPC to give state-of-the-art performance in this setting. ",
133
+ "bbox": [
134
+ 217,
135
+ 270,
136
+ 825,
137
+ 522
138
+ ],
139
+ "page_idx": 1
140
+ },
141
+ {
142
+ "type": "text",
143
+ "text": "2 EXPERIMENTAL SETUP ",
144
+ "text_level": 1,
145
+ "bbox": [
146
+ 174,
147
+ 541,
148
+ 398,
149
+ 558
150
+ ],
151
+ "page_idx": 1
152
+ },
153
+ {
154
+ "type": "text",
155
+ "text": "We first review the CPC architecture and learning objective in section 2.1, before detailing how we use its resulting representations for image recognition tasks in section 2.2. ",
156
+ "bbox": [
157
+ 176,
158
+ 574,
159
+ 825,
160
+ 602
161
+ ],
162
+ "page_idx": 1
163
+ },
164
+ {
165
+ "type": "text",
166
+ "text": "2.1 CONTRASTIVE PREDICTIVE CODING ",
167
+ "text_level": 1,
168
+ "bbox": [
169
+ 176,
170
+ 618,
171
+ 467,
172
+ 633
173
+ ],
174
+ "page_idx": 1
175
+ },
176
+ {
177
+ "type": "text",
178
+ "text": "Contrastive Predictive Coding as formulated in (van den Oord et al., 2018) learns representations by training neural networks to predict the representations of future observations from those of past ones. When applied to images, the original formulation of CPC operates by predicting the representations of patches below a certain position from those above it (Fig. 2, left). These predictions are evaluated using a contrastive loss, in which the network must correctly classify the ‘future’ representation amongst a set of unrelated ‘negative’ representations. This avoids trivial solutions such as representing all patches with a constant vector, as would be the case with a mean squared error loss. ",
179
+ "bbox": [
180
+ 174,
181
+ 645,
182
+ 825,
183
+ 742
184
+ ],
185
+ "page_idx": 1
186
+ },
187
+ {
188
+ "type": "text",
189
+ "text": "In the CPC architecture, each input image is first divided into a set of overlapping patches $\\mathbf { \\delta } _ { \\mathbf { x } _ { i , j } }$ , each of which is encoded with a neural network $f _ { \\theta }$ into a single vector $z _ { i , j } = f _ { \\theta } ( \\pmb { x } _ { i , j } )$ . To make predictions, a masked convolutional network $g _ { \\phi }$ is then applied to the grid of feature vectors. The masks are such that the receptive field of each resulting context vector $c _ { i , j }$ only includes feature vectors that lie above it in the image (i.e. $\\{ z _ { u , v } \\} _ { u \\leq i , v } )$ . The prediction task then consists o predicting ‘future’ feature vectors $z _ { i + k , j }$ from current context vectors $c _ { i , j }$ , where $k > 0$ . The predictions are made linearly: given a context vector $c _ { i , j }$ , a prediction length $k > 0$ , and a prediction matrix $W _ { k }$ , the predicted feature vector is $\\hat { \\boldsymbol { z } } _ { i + k , j } = \\boldsymbol { W } _ { k } \\boldsymbol { c } _ { i , j }$ . ",
190
+ "bbox": [
191
+ 174,
192
+ 750,
193
+ 825,
194
+ 862
195
+ ],
196
+ "page_idx": 1
197
+ },
198
+ {
199
+ "type": "text",
200
+ "text": "The quality of this prediction is then evaluated using a contrastive loss. Specifically, the goal is to correctly recognize the target $z _ { i + k , j }$ among a set of randomly sampled feature vectors $\\{ z _ { l } \\}$ from the dataset. We compute the probability assigned to the target using a softmax, and evaluate this probability using the usual cross-entropy loss. Summing this loss over locations and prediction offsets, we arrive at the CPC objective as defined in (van den Oord et al., 2018): ",
201
+ "bbox": [
202
+ 174,
203
+ 867,
204
+ 823,
205
+ 924
206
+ ],
207
+ "page_idx": 1
208
+ },
209
+ {
210
+ "type": "image",
211
+ "img_path": "images/e21408d1a55db66ba2cac6a3f4d98b0d1a13c2f1211e3956f93d67bae89bbaae.jpg",
212
+ "image_caption": [
213
+ "Figure 2: Overview of the framework for semi-supervised learning with Contrastive Predictive Coding. Left: unsupervised pre-training with the spatial prediction task (See Section 2.1). First, an image is divided into a grid of overlapping patches. Each patch is encoded independently from the rest with a feature extractor (blue) which terminates with a mean-pooling operation, yielding a single feature vector for that patch. Doing so for all patches yields a field of such feature vectors (wireframe vectors). Feature vectors above a certain level (in this case, the center of the image) are then aggregated with a context network (red), yielding a row of context vectors which are used to linearly predict features vectors below. Right: using the CPC representation for a classification task. Having trained the encoder network, the context network (red) is discarded and replaced by a classifier network (green) which can be trained in a supervised manner. For some experiments, we also fine-tune the encoder network (blue) for the classification task. When applying the encoder to cropped patches (as opposed to the full image) we refer to it as a patched ResNet in the figure. "
214
+ ],
215
+ "image_footnote": [],
216
+ "bbox": [
217
+ 174,
218
+ 104,
219
+ 823,
220
+ 294
221
+ ],
222
+ "page_idx": 2
223
+ },
224
+ {
225
+ "type": "text",
226
+ "text": "",
227
+ "bbox": [
228
+ 173,
229
+ 486,
230
+ 696,
231
+ 502
232
+ ],
233
+ "page_idx": 2
234
+ },
235
+ {
236
+ "type": "equation",
237
+ "img_path": "images/7113b15debaadf2fc32b7ca0c3e55fb0689eecd2935810917cee824de20f6604.jpg",
238
+ "text": "$$\n\\mathcal { L } _ { \\mathrm { C P C } } = - \\sum _ { i , j , k } \\log p ( z _ { i + k , j } | \\hat { z } _ { i + k , j } , \\{ z _ { l } \\} ) = - \\sum _ { i , j , k } \\log \\frac { \\exp ( \\hat { z } _ { i + k , j } ^ { T } z _ { i + k , j } ) } { \\exp ( \\hat { z } _ { i + k , j } ^ { T } z _ { i + k , j } ) + \\sum _ { l } \\exp ( \\hat { z } _ { i + k , j } ^ { T } z _ { l } ) }\n$$",
239
+ "text_format": "latex",
240
+ "bbox": [
241
+ 186,
242
+ 503,
243
+ 808,
244
+ 546
245
+ ],
246
+ "page_idx": 2
247
+ },
248
+ {
249
+ "type": "text",
250
+ "text": "The negative samples $\\left\\{ z _ { l } \\right\\}$ are taken from other locations in the image and other images in the minibatch. This loss is called InfoNCE (van den Oord et al., 2018) as it is inspired by Noise-Contrastive Estimation (Gutmann $\\&$ Hyvarinen, 2010; Mnih & Kavukcuoglu, 2013) and has been shown to ¨ maximize the mutual information between $\\mathbf { } _ { c _ { i , j } }$ and $z _ { i + k , j }$ (van den Oord et al., 2018). ",
251
+ "bbox": [
252
+ 174,
253
+ 547,
254
+ 825,
255
+ 606
256
+ ],
257
+ "page_idx": 2
258
+ },
259
+ {
260
+ "type": "text",
261
+ "text": "2.2 EVALUATION PROTOCOL ",
262
+ "text_level": 1,
263
+ "bbox": [
264
+ 174,
265
+ 621,
266
+ 383,
267
+ 635
268
+ ],
269
+ "page_idx": 2
270
+ },
271
+ {
272
+ "type": "text",
273
+ "text": "Having trained an encoder network $f _ { \\theta }$ , a context network $g _ { \\phi }$ , and a set of linear predictors $\\{ W _ { k } \\}$ using the CPC objective, we use the latents $z = f _ { \\boldsymbol { \\theta } } ( \\pmb { x } )$ as a representation of new observations $x$ for downstream tasks, and discard the rest. We then train a model $h _ { \\psi }$ to classify these representations given a dataset of labeled images. More formally, given a dataset of $N$ unlabeled images $\\mathbb { D } _ { u } =$ $\\left\\{ x _ { n } \\right\\}$ , and a (potentially much smaller) dataset of $M$ labeled images $\\mathbb { D } _ { l } = \\{ x _ { m } , y _ { m } \\}$ : ",
274
+ "bbox": [
275
+ 174,
276
+ 646,
277
+ 825,
278
+ 717
279
+ ],
280
+ "page_idx": 2
281
+ },
282
+ {
283
+ "type": "equation",
284
+ "img_path": "images/c6df6158bc3640c41b4e80de8a77924da143cb3d171b2d5421986f303ad176ed.jpg",
285
+ "text": "$$\n\\theta ^ { * } = \\arg \\operatorname* { m i n } _ { \\theta } \\frac { 1 } { N } \\sum _ { n = 1 } ^ { N } \\mathcal { L } _ { \\mathrm { C P C } } [ f _ { \\theta } ( x _ { n } ) ] , \\quad \\psi ^ { * } = \\arg \\operatorname* { m i n } _ { \\psi } \\frac { 1 } { M } \\sum _ { m = 1 } ^ { M } \\mathcal { L } _ { \\mathrm { S u p } } [ h _ { \\psi } \\circ f _ { \\theta ^ { * } } ( x _ { m } ) , y _ { m } ]\n$$",
286
+ "text_format": "latex",
287
+ "bbox": [
288
+ 217,
289
+ 718,
290
+ 781,
291
+ 762
292
+ ],
293
+ "page_idx": 2
294
+ },
295
+ {
296
+ "type": "text",
297
+ "text": "In all cases, the dataset of unlabeled images $\\mathbb { D } _ { u }$ we pre-train on is the full ImageNet ILSVRC 2012 training set (Russakovsky et al., 2015). We consider three labeled datasets $\\mathbb { D } _ { l }$ for evaluation, each with an associated classifier $h _ { \\psi }$ and supervised losse $\\mathcal { L } _ { \\mathrm { { S u p } } }$ (see Fig. 2, right). This protocol is sufficiently generic to allow us to later compare the CPC representation to other methods which have their own means of learning a feature extractor $f _ { \\theta }$ . ",
298
+ "bbox": [
299
+ 173,
300
+ 763,
301
+ 825,
302
+ 834
303
+ ],
304
+ "page_idx": 2
305
+ },
306
+ {
307
+ "type": "text",
308
+ "text": "Linear classification is the standard benchmark for evaluating the quality of unsupervised image representations. In this regime, the classification network $h _ { \\psi }$ is restricted to mean pooling followed by a single linear layer, and the parameters of $f _ { \\theta }$ are kept fixed. The labeled dataset $\\mathbb { D } _ { l }$ is the entire ImageNet dataset, and the supervised loss $\\mathcal { L } _ { \\mathrm { { S u p } } }$ is standard cross-entropy. We use the same dataaugmentation as in the unsupervised learning phase for training, and none at test time and evaluate with a single crop. ",
309
+ "bbox": [
310
+ 173,
311
+ 839,
312
+ 825,
313
+ 924
314
+ ],
315
+ "page_idx": 2
316
+ },
317
+ {
318
+ "type": "text",
319
+ "text": "Efficient classification directly tests whether the CPC representation enables visual learning from few labels. For this task, the classifier $h _ { \\psi }$ is an arbitrary deep neural network (we use an 11-block ResNet architecture with 4096-dimensional feature maps and 1024-dimensional bottleneck layers). The labeled dataset $\\mathbb { D } _ { l }$ is a subset of the ImageNet dataset: we investigated using $1 \\%$ , $2 \\%$ , $5 \\%$ , $10 \\%$ , $20 \\%$ , $50 \\%$ and $100 \\%$ of the ImageNet dataset. The supervised loss $\\mathcal { L } _ { \\mathrm { { S u p } } }$ is again cross-entropy. In addition to random color-dropping we use the Inception data-augmentation scheme (Szegedy et al., 2014) for training, no augmentation at test-time and evaluate with a single crop. ",
320
+ "bbox": [
321
+ 174,
322
+ 103,
323
+ 825,
324
+ 202
325
+ ],
326
+ "page_idx": 3
327
+ },
328
+ {
329
+ "type": "text",
330
+ "text": "Transfer learning tests the generality of the representation by applying it to a new task and dataset. For this we chose image detection on the PASCAL-2007 dataset, a standard benchmark in computer vision (Everingham et al., 2007). As such $\\mathbb { D } _ { l }$ is the entire PASCAL-2007 dataset (comprised of 5011 labeled images); $h _ { \\psi }$ and $\\mathcal { L } _ { \\mathrm { { S u p } } }$ are the Faster-RCNN architecture and loss (Ren et al., 2015). In addition to color-dropping, we use scale-augmentation (Doersch et al., 2015) for training. ",
331
+ "bbox": [
332
+ 174,
333
+ 208,
334
+ 825,
335
+ 279
336
+ ],
337
+ "page_idx": 3
338
+ },
339
+ {
340
+ "type": "text",
341
+ "text": "For linear classification, we keep the feature extractor $f _ { \\theta }$ fixed to assess the representation in absolute terms. For efficient classification and transfer learning, we additionally explore fine-tuning the feature extractor for the supervised objective. In this regime, we initialize the feature extractor and classifier with the solutions $\\theta ^ { * } , \\psi ^ { * }$ found in the previous learning phase, and train them both for the supervised objective. To ensure that the feature extractor does not deviate too much from the solution dictated by the CPC objective, we use a smaller learning rate and early-stopping. ",
342
+ "bbox": [
343
+ 174,
344
+ 285,
345
+ 825,
346
+ 368
347
+ ],
348
+ "page_idx": 3
349
+ },
350
+ {
351
+ "type": "text",
352
+ "text": "3 RELATED WORK ",
353
+ "text_level": 1,
354
+ "bbox": [
355
+ 176,
356
+ 402,
357
+ 343,
358
+ 419
359
+ ],
360
+ "page_idx": 3
361
+ },
362
+ {
363
+ "type": "text",
364
+ "text": "Data-efficient learning has typically been approached by two complementary methods, both of which seek to make use of more plentiful unlabeled data: representation learning and semisupervised learning. The former formulates an objective to learn a feature extractor $f _ { \\theta }$ in an unsupervised manner, whereas the latter directly constrains the classifier $h _ { \\psi }$ using the unlabeled data. ",
365
+ "bbox": [
366
+ 174,
367
+ 444,
368
+ 823,
369
+ 500
370
+ ],
371
+ "page_idx": 3
372
+ },
373
+ {
374
+ "type": "text",
375
+ "text": "Representation learning saw early success using generative modeling (Kingma et al., 2014), but likelihood-based models have yet to generalize to more complex stimulus classes. Generative adversarial models have also been harnessed for representation learning (Donahue et al., 2016), and large-scale implementations have recently achieved corresponding gains in linear classification accuracy (Donahue & Simonyan, 2019). ",
376
+ "bbox": [
377
+ 174,
378
+ 507,
379
+ 823,
380
+ 577
381
+ ],
382
+ "page_idx": 3
383
+ },
384
+ {
385
+ "type": "text",
386
+ "text": "In contrast to generative models which require the reconstruction of observations, self-supervised techniques directly formulate tasks involving the learned representation. For example, simply asking a network to recognize the spatial layout of an image led to representations that transferred to popular vision tasks such as classification and detection (Doersch et al., 2015; Noroozi & Favaro, 2016). Other works showed that prediction of color (Zhang et al., 2016; Larsson et al., 2017) and image orientation (Gidaris et al., 2018), and invariance to data augmentation (Dosovitskiy et al., 2014) can provide useful self-supervised tasks. Beyond single images, works have leveraged video cues such as object tracking (Wang & Gupta, 2015), frame ordering (Misra et al., 2016), and object boundary cues (Li et al., 2016; Pathak et al., 2016). Non-visual information can be equally powerful; information about camera motion (Agrawal et al., 2015; Jayaraman & Grauman, 2015), scene geometry (Zamir et al., 2016), or sound (Arandjelovic & Zisserman, 2017; 2018) can all serve as natural sources of supervision. ",
387
+ "bbox": [
388
+ 174,
389
+ 583,
390
+ 825,
391
+ 750
392
+ ],
393
+ "page_idx": 3
394
+ },
395
+ {
396
+ "type": "text",
397
+ "text": "While many of these tasks require predicting fixed quantities computed from the data, another class of contrastive methods formulate their objectives in the learned representations themselves. CPC is a contrastive representation learning method that maximizes the mutual information between spatially removed latent representations with InfoNCE (van den Oord et al., 2018), a loss function based on Noise-Contrastive Estimation (Gutmann & Hyvarinen, 2010; Mnih & Kavukcuoglu, 2013). Two ¨ other methods have recently been proposed using the same loss function, but with different associated prediction tasks. Contrastive Multiview Coding (Tian et al., 2019) maximizes the mutual information between representations of different views of the same observation. Augmented Multiscale Deep InfoMax (AMDIM, Bachman et al., 2019) is most similar to CPC in that it makes predictions across space, but differs in that it also predicts representations across layers in the model. In addition, AMDIM limits the receptive field of its representation, but does this by constraining the number of spatial convolutions in the network architecture rather than using image patches. ",
398
+ "bbox": [
399
+ 174,
400
+ 757,
401
+ 825,
402
+ 924
403
+ ],
404
+ "page_idx": 3
405
+ },
406
+ {
407
+ "type": "text",
408
+ "text": "A common alternative approach for improving data efficiency is label-propagation (Zhu & Ghahramani, 2002), where a classifier is trained on a subset of labeled data, then used to label parts of the unlabeled dataset, after which the process is repeated. This label-propagation can either be discrete (as in pseudo-labeling, Lee, 2013) or continuous (as in entropy minimization, Grandvalet & Bengio, 2005). The predictions of this classifier are often constrained to be smooth with respect to certain deformations, such as data-augmentation (Xie et al., 2019) or adversarial perturbation (Miyato et al., 2018). Representation learning and semi-supervised learning have been shown to be complementary and can be combined to great effect (Zhai et al., 2019), which is why we focus solely on representation learning in this paper. ",
409
+ "bbox": [
410
+ 174,
411
+ 103,
412
+ 825,
413
+ 229
414
+ ],
415
+ "page_idx": 4
416
+ },
417
+ {
418
+ "type": "text",
419
+ "text": "4 RESULTS ",
420
+ "text_level": 1,
421
+ "bbox": [
422
+ 176,
423
+ 251,
424
+ 281,
425
+ 267
426
+ ],
427
+ "page_idx": 4
428
+ },
429
+ {
430
+ "type": "text",
431
+ "text": "When asking whether CPC enables data-efficient learning, we wish to use the best possible representative of this model class. Unfortunately, purely unsupervised metrics tell us little about downstream performance, and implementation details have been shown to matter enormously (Doersch & Zisserman, 2017; Kolesnikov et al., 2019). Since many design choices (e.g. network architecture and datapreprocessing) have been previously evaluated using linear classification, we use this benchmark in section 4.1 to align the CPC model with best practices in representation learning and compare to published results. In section 4.2 we select the best performing model from the previous section and assess whether it enables efficient classification. We also investigate to what extent the first, more common metric (linear classification accuracy) is predictive of efficient classification. Finally, in section 4.3 we investigate the generality of our results through transfer learning to PASCAL-2007. ",
432
+ "bbox": [
433
+ 174,
434
+ 284,
435
+ 825,
436
+ 422
437
+ ],
438
+ "page_idx": 4
439
+ },
440
+ {
441
+ "type": "text",
442
+ "text": "4.1 FROM CPC V1 TO CPC V2 ",
443
+ "text_level": 1,
444
+ "bbox": [
445
+ 176,
446
+ 441,
447
+ 400,
448
+ 455
449
+ ],
450
+ "page_idx": 4
451
+ },
452
+ {
453
+ "type": "text",
454
+ "text": "The overarching principle behind our new model design is to increase the scale and efficiency of the encoder architecture while also maximizing the supervisory signal we obtain from each image. At the same time, it is important not to allow the network to solve the problem trivially, i.e., without learning semantics. To this end, we seek to remove low-level cues common across patches by augmenting individual patches independently, using standard stochastic data-processing techniques from supervised and self-supervised learning. ",
455
+ "bbox": [
456
+ 174,
457
+ 468,
458
+ 825,
459
+ 553
460
+ ],
461
+ "page_idx": 4
462
+ },
463
+ {
464
+ "type": "text",
465
+ "text": "We identify four axes for model capacity and task setup that could impact the model’s performance. The first axis increases model capacity by increasing depth and width, while the second improves training efficiency capacity by introducing layer normalization. The third axis increases task complexity by making predictions in all four directions, and the fourth does so by performing more extensive patch-based augmentation. ",
466
+ "bbox": [
467
+ 174,
468
+ 559,
469
+ 485,
470
+ 698
471
+ ],
472
+ "page_idx": 4
473
+ },
474
+ {
475
+ "type": "text",
476
+ "text": "Model capacity. Recent work has shown that networks and more effective training improves self-supervised learning (Doersch & Zisserman, 2017; Kolesnikov et al., 2019), but the original CPC model used only the first 3 stacks of a ResNet-101 (He et al., 2016a) architecture (i.e. a ResNet-92). Therefore, we converted the third residual stack of ResNet-101 (originally containing 23 blocks, 1024-dimensional feature maps, and 256-dimensional bottleneck layers), to use 46 blocks, with 4096-dimensional feature maps and 512-dimensional bottleneck layers. We call the resulting network ResNet-161. Consistent with prior results, this new architecture delivers better performance regardless of ",
477
+ "bbox": [
478
+ 174,
479
+ 715,
480
+ 483,
481
+ 922
482
+ ],
483
+ "page_idx": 4
484
+ },
485
+ {
486
+ "type": "image",
487
+ "img_path": "images/3eeded7c7663fc17771caa90292cc1343662124f1094d06f22d9ca255036f2a3.jpg",
488
+ "image_caption": [
489
+ "Figure 3: Linear classification performance of new variants of CPC, which incrementally add a series of modifications. BU: bottum up spatial predictions. HF: randomly flipping patches horizontally. LN: layer normalization. RC: random color-dropping. TL: tuned prediction lengths. HP: horizontal spatial predictions. We use color to indicate the number of spatial predictions used (orange, green, blue for 1, 2 and 4 directions). "
490
+ ],
491
+ "image_footnote": [],
492
+ "bbox": [
493
+ 501,
494
+ 566,
495
+ 818,
496
+ 777
497
+ ],
498
+ "page_idx": 4
499
+ },
500
+ {
501
+ "type": "table",
502
+ "img_path": "images/fa1f65edaf71df9800daca9c26a7999e93d74856116a87cc357e08cc713a4be7.jpg",
503
+ "table_caption": [
504
+ "Table 1: Linear classifier $h _ { \\psi }$ trained with $100 \\%$ of labels. Comparison to linear separability of other self-supervised methods. In all cases a feature extractor is optimized in an unsupervised manner, and a linear classifier is trained on top using all labels in the ImageNet dataset. "
505
+ ],
506
+ "table_footnote": [],
507
+ "table_body": "<table><tr><td>Method</td><td>Top-1</td><td>Top-5</td></tr><tr><td>Motion Segmentation (MS) (Pathak et al., 2016) Exemplar (Ex) (Dosovitskiy et al.,2014) Relative Position (RP) (Doersch et al.,2015) Colorization (Col) (Zhang et al., 2016) Combination of MS + Ex + RP+ Col (Doersch &amp; Zisserman,2017) CPC v1 (van den Oord et al., 2018) Rotation (Kolesnikov et al., 2019)</td><td>27.6 31.5 36.2 39.6 1 48.7 55.4</td><td>48.3 53.1 59.2 62.5 69.3 73.6</td></tr><tr><td>CMC (Tian et al., 2019) Local Aggregation (Zhuang et al., 2019)</td><td>60.1 60.2</td><td>82.8 1 =</td></tr><tr><td>BigBiGAN (Donahue &amp; Simonyan,2019) AMDIM (Bachman et al., 2019) CPC v2 (ours) 65.9</td><td>61.3 68.1</td><td>81.9</td></tr></table>",
508
+ "bbox": [
509
+ 204,
510
+ 159,
511
+ 794,
512
+ 371
513
+ ],
514
+ "page_idx": 5
515
+ },
516
+ {
517
+ "type": "text",
518
+ "text": "other design choices. Interestingly, a larger architecture delivers larger improvements with more efficient training, more self-supervised losses, and more patch-based augmentations (Fig. 3, $+5 \\%$ Top-1 accuracy with original training scheme, $+ 1 0 \\%$ accuracy with new one). ",
519
+ "bbox": [
520
+ 176,
521
+ 410,
522
+ 823,
523
+ 452
524
+ ],
525
+ "page_idx": 5
526
+ },
527
+ {
528
+ "type": "text",
529
+ "text": "Layer normalization. Large architectures are more difficult to train efficiently. Early works on context prediction with patches used batch normalization (Ioffe & Szegedy, 2015; Doersch et al., 2015) to speed training. However, with CPC we find that batch normalization actually harms downstream performance of large models. We hypothesize that batch normalization allows large models to find a trivial solution to CPC: it introduces a dependency between patches (through the batch statistics) that can be exploited to bypass the constraints on the receptive field. We find that we can reclaim much of batch normalization’s training efficiency using layer normalization (Ba et al., 2016), which leads to a small gain for the smaller architecture $+ 1 \\%$ accuracy over equivalent architectures that use neither normalization) and a larger gain for the larger architecture $( + 2 . 5 \\%$ accuracy). ",
530
+ "bbox": [
531
+ 174,
532
+ 474,
533
+ 825,
534
+ 599
535
+ ],
536
+ "page_idx": 5
537
+ },
538
+ {
539
+ "type": "text",
540
+ "text": "Prediction lengths and directions. Larger architectures also run a greater risk of overfitting. We address this by asking more from the network: specifically, whereas van den Oord et al. (2018) predicted each patch using only context from spatially beneath it, we repeatedly predict the patch using context from above, to the right, and to the left, resulting in up to four times as many prediction tasks. Combining top-to-bottom with bottom-to-top helps both model architectures $42 \\%$ accuracy for both), but using all 4 spatial directions only benefits the larger model (an additional $+ 1 . 5 \\%$ for the larger model, ${ \\bf - 1 \\% }$ for the smaller), consistent with the idea that model capacity and amount of supervision must go hand-in-hand. We also hypothesized that prediction “length”—i.e. offset between the predicted patch and the aggregated context—might affect performance, as distant patches might lie on distinct objects, encouraging the network to memorize images. Indeed, limiting the range of the prediction length $k$ to $\\{ 2 , 3 \\}$ performed better than $\\{ 2 , \\ldots , 5 \\}$ as was used originally $+ 1 \\%$ for the larger model). ",
541
+ "bbox": [
542
+ 173,
543
+ 622,
544
+ 825,
545
+ 790
546
+ ],
547
+ "page_idx": 5
548
+ },
549
+ {
550
+ "type": "text",
551
+ "text": "Patch-based augmentation. If the network can solve CPC using low-level patterns (e.g. straight lines continuing between patches, chromatic aberration), it need not learn semantically meaningful content. Augmenting the low-level variability across patches can remove such low level cues. The original CPC model spatially jitters individual patches independently. We further this logic by adopting the ‘color dropping’ method of Doersch et al. (2015), which randomly drops two of the three color channels in each patch, and find it to delivers systematic gains $( + 1 \\%$ for the small model, $+3 \\%$ for the larger one). We also randomly flip patches horizontally, but find it only benefits the smaller model $( + 1 \\% )$ . ",
552
+ "bbox": [
553
+ 174,
554
+ 811,
555
+ 825,
556
+ 924
557
+ ],
558
+ "page_idx": 5
559
+ },
560
+ {
561
+ "type": "text",
562
+ "text": "Combined. Cumulatively, these fairly straightforward implementation changes lead to a substantial improvement to the original CPC model $6 5 . 9 \\%$ Top-1 accuracy, a $17 \\%$ improvement), making it competitive with recent approaches and outperforming prior methods (see table 1). Interestingly, if we train the same patch-based architecture from scratch in a fully supervised manner, we obtain $6 6 . 4 \\%$ Top-1 accuracy (with batch normalization; $6 2 . 5 \\%$ without), suggesting that CPC is now nearly saturating the architecture’s representational power despite not using labels. These results illustrate how architecture and data have an outsized impact on the linear classification performance of self-supervised representations, and are interesting to compare with with previous results. For example, in AMDIM, different settings of data augmentation alone can result in a nearly $10 \\%$ absolute increase in performance on ImageNet linear classification. ",
563
+ "bbox": [
564
+ 173,
565
+ 103,
566
+ 825,
567
+ 242
568
+ ],
569
+ "page_idx": 6
570
+ },
571
+ {
572
+ "type": "text",
573
+ "text": "4.2 EFFICIENT IMAGE CLASSIFICATION ",
574
+ "text_level": 1,
575
+ "bbox": [
576
+ 178,
577
+ 262,
578
+ 455,
579
+ 276
580
+ ],
581
+ "page_idx": 6
582
+ },
583
+ {
584
+ "type": "text",
585
+ "text": "toWe now turn to our original question of whether CPC can enable data-efficient image recognition. We start by evaluating the performance of purely-supervised networks as the size of the labeled dataset $\\mathbb { D } _ { l }$ varies from $1 \\%$ to $100 \\%$ of ImageNet, training separate classifiers on each subset. We found that a ResNet-152 to works best across all data-regimes (see Appendix). Despite our efforts to tune the supervised model for low-data classification (including network depth, regularization, and optimization parameters), the accuracy of the best model only reaches $4 4 . 1 \\%$ Top-5 accuracy when trained on $1 \\%$ of the dataset (compared to $9 3 . 9 \\%$ when trained on the entire dataset, see Fig. 1, red). ",
586
+ "bbox": [
587
+ 174,
588
+ 287,
589
+ 825,
590
+ 386
591
+ ],
592
+ "page_idx": 6
593
+ },
594
+ {
595
+ "type": "text",
596
+ "text": "Contrastive Predictive Coding. We now address our central question of whether CPC enables data-efficient learning. We follow the same paradigm as for the supervised baseline (training and evaluating a separate classifier for each size subset), stacking a neural network classifier on top of the CPC latents $\\begin{array} { r l r } { z } & { { } = } & { f _ { \\theta } ( { \\pmb x } ) } \\end{array}$ rather than the raw image pixels $_ { \\textbf { \\em x } }$ (see section 2.2, efficient classification, and Appendix). This representation, which we selected for its improved linear classification performance (CPC v2 in Fig. 3), leads to a significant increase in data-efficiency compared to purely supervised networks (Fig. 1, blue curve). This classifier yields $7 2 . 9 \\%$ Top-5 accuracy with only $1 \\%$ of the labels, a $2 9 \\%$ absolute improvement $65 \\%$ relative) over purely-supervised methods. Surprisingly, when given the entire dataset, this classifier reaches $8 0 . 6 \\% / 9 5 . 2 \\%$ Top1/Top5 accuracy, surpassing our supervised baseline (ResNet-152: $7 8 . 0 \\% / 9 3 . 9 \\%$ accuracy) and published results (ResNet-200: $7 9 . 9 \\% / 9 5 . 2 \\%$ , He et al. (2016b)). We find similar results in all other data-regimes we considered (see Fig. 1). ",
597
+ "bbox": [
598
+ 174,
599
+ 404,
600
+ 483,
601
+ 750
602
+ ],
603
+ "page_idx": 6
604
+ },
605
+ {
606
+ "type": "text",
607
+ "text": "How important are the model specifications described in Section 4.1 for low-data classification? We hypothesized that predictable representations might enable data-efficient classifi",
608
+ "bbox": [
609
+ 174,
610
+ 757,
611
+ 482,
612
+ 813
613
+ ],
614
+ "page_idx": 6
615
+ },
616
+ {
617
+ "type": "image",
618
+ "img_path": "images/106f2252ad377e16a329cfb21360459a72fdc1d09e4f745b26572da1cf6d5d14.jpg",
619
+ "image_caption": [
620
+ "Figure 4: Relationship between linear classification accuracy and low-data classification, for different variants of the CPC model. Left: CPC variants with the same architecture but different training protocols. Orange, green, and blue dots correspond to CPC models making predictions in 1, 2, and 4 spatial directions respectively. Within a color group, different models correspond to other implementation details (e.g. layer norm and patch augmentation, and combinations thereof). "
621
+ ],
622
+ "image_footnote": [],
623
+ "bbox": [
624
+ 503,
625
+ 409,
626
+ 810,
627
+ 657
628
+ ],
629
+ "page_idx": 6
630
+ },
631
+ {
632
+ "type": "text",
633
+ "text": "cation, and therefore expect that increasing the amount of ‘predictability’ in the representation should also increase its ability to learn from small amounts of data. Fig. 4 shows evidence for this by ablating model parameters and comparing linear classification performance against low-data classification. Consistent with our hypothesis, increasing the number of spatial directions in the CPC prediction task (which increased linear classification performance) systematically increases low-data classification performance (Fig. 4, left, different color groups). As a control, we asked if all modifications that improve linear classification also improve low-data classification. We did not find evidence in favor of this: improvements in linear classification as a result of changing other model parameters (patch-based data-augmentation, layer normalization, and combinations thereof) seem uncorrelated to performance in other tasks (Fig. 4, left, within green group: $R ^ { 2 } = 0 . 1 7 , p = 0 . 3 6$ ). Different architectural specifications also produced different changes in both tasks (Fig. 4, right). Whereas increasing the depth of the encoding network greatly improves both metrics, increasing the network width (and therefore the number of features used for linear classification) only improves linear classification accuracy. ",
634
+ "bbox": [
635
+ 174,
636
+ 813,
637
+ 825,
638
+ 924
639
+ ],
640
+ "page_idx": 6
641
+ },
642
+ {
643
+ "type": "table",
644
+ "img_path": "images/e969618e28fc2ffa8c76067cea0310a604dd1bb350cd5a5534dd7265b81333a6.jpg",
645
+ "table_caption": [
646
+ "Table 2: ResNet classifier $h _ { \\psi }$ trained with $1 \\%$ or $10 \\%$ of labels. Comparison to other methods for semi-supervised learning using $1 \\%$ or $10 \\%$ of labeled data. Representation learning methods use a classifier to discriminate an unsupervised representation, and optimize it solely for the supervised objective on labeled data. Label-propagation methods on the other hand further constrain the classifier with smoothness and entropy criteria on unlabeled data, making the additional assumption that all training images fit into a single (unknown) testing category. $\\dagger$ denotes methods implemented in this work, fixed and fine-tuned denote whether the feature extractor is allowed to accommodate the supervised objective. "
647
+ ],
648
+ "table_footnote": [],
649
+ "table_body": "<table><tr><td>Labeled data 1% 10% 100% Method Top-5 accuracy</td></tr><tr><td></td></tr><tr><td>Supervised baseline 44.1 82.1 93.9 Methods using label-propagation:</td></tr><tr><td>Pseudolabeling (Zhai et al., 2019) 51.6 82.4 VAT + Entropy Minimization (Zhai et al., 2019) 47.0 83.4 Unsup. Data Augmentation (Xie et al., 2019) 88.5</td></tr><tr><td>Rotation+ VAT+Ent.Min. (Zhai et al.,2019) 91.2 95.0 =</td></tr><tr><td>Methods using representation learning only:</td></tr><tr><td>Instance Discrimination (Wu et al., 2018) 39.2 77.4</td></tr><tr><td>Rotation (Zhai et al., 2019) 57.5 86.4</td></tr><tr><td>+ResNet trained on BigBiGAN (fixed) 55.2 78.8 87.0</td></tr><tr><td>+ResNet trained on AMDIM (fixed) 67.4 85.8 92.2</td></tr><tr><td>+ResNet trained on CPC v2 (fixed) 72.3 89.1 94.4 +ResNet trained on CPC v2 (fine-tuned) 72.9 89.5 95.2</td></tr></table>",
650
+ "bbox": [
651
+ 250,
652
+ 228,
653
+ 745,
654
+ 487
655
+ ],
656
+ "page_idx": 7
657
+ },
658
+ {
659
+ "type": "text",
660
+ "text": "",
661
+ "bbox": [
662
+ 174,
663
+ 531,
664
+ 825,
665
+ 614
666
+ ],
667
+ "page_idx": 7
668
+ },
669
+ {
670
+ "type": "text",
671
+ "text": "Other unsupervised representations. How well does the CPC representation compare to other representations that have been learned in an unsupervised manner? If predictable representations are uniquely suited for efficient classification, we would expect other methods within this family to perform similarly, and other model classes less so. Table 2 compares our best model with other works on efficient recognition. We consider three objectives from different model classes: self-supervised learning with rotation prediction (Zhai et al., 2019), large-scale adversarial feature learning (BigBiGAN, Donahue & Simonyan, 2019), and another contrastive prediction objective (AMDIM, Bachman et al., 2019). Zhai et al. (2019) evaluate the low-data classification performance of representations learned with rotation prediction using a similar paradigm and architecture (ResNet-152), hence we report their results directly. Given $1 \\%$ of ImageNet, their method achieves $5 7 . 5 \\%$ Top-5 accuracy, consistently with the reduced accuracy of a linear classifier ( $5 5 . 4 \\%$ vs $6 5 . 9 \\%$ for CPC)1. ",
672
+ "bbox": [
673
+ 173,
674
+ 631,
675
+ 825,
676
+ 796
677
+ ],
678
+ "page_idx": 7
679
+ },
680
+ {
681
+ "type": "text",
682
+ "text": "Because BigBiGAN and AMDIM achieve stronger linear classification accuracy than rotation prediction $6 1 . 3 \\%$ and $6 8 . 1 \\%$ Top-1 accuracy, respectively), we might expect better performance on efficient classification as well. Since their authors do not report results on efficient classification we evaluated these representations using the same paradigm we used for evaluating CPC, stacking a ResNet classifier on top of the $7 \\times 7 \\times 8 1 9 2$ latents of the BigBiGAN and the $7 \\times 7 \\times 2 5 6 0$ grid of feature vectors of AMDIM. We found fine-tuned representations to yield only marginal gains over fixed ones $7 2 . 9 \\%$ compared to $7 2 . 3 \\%$ Top-5 accuracy given $1 \\%$ of labels), hence for simplicity we evaluate BigBiGAN and AMDIM on this task while keeping them fixed. We re-tune the hyper-parameters of the classifier (including optimization, regularization, etc.) for each of these representations separately. Although these methods achieve similar performance in terms of linear classification, we find them to achieve very different results in efficient classification. Given $1 \\%$ of ImageNet, classifiers trained on top of BigBiGAN achieve $5 5 . 2 \\%$ Top-5 accuracy, similarly to rotation prediction $( 5 7 . 5 \\% )$ , despite its increased linear classification accuracy $( + 6 \\%$ relative to rotation prediction). In contrast, AMDIM (which also belongs to the family of contrastive prediction methods) achieves $6 7 . 4 \\%$ on this same task. Again, its increased linear classification accuracy did not entail an increase in data-efficiency. Nevertheless, in line with our initial hypothesis, we find that contrastive prediction methods such as CPC surpass other approaches in our efficient classification experiments, and that linear classification performance is not perfectly correlated with these results. ",
683
+ "bbox": [
684
+ 173,
685
+ 803,
686
+ 825,
687
+ 888
688
+ ],
689
+ "page_idx": 7
690
+ },
691
+ {
692
+ "type": "text",
693
+ "text": "",
694
+ "bbox": [
695
+ 174,
696
+ 103,
697
+ 825,
698
+ 270
699
+ ],
700
+ "page_idx": 8
701
+ },
702
+ {
703
+ "type": "text",
704
+ "text": "Other semi-supervised techniques A separate class of methods for low-data classification attempts to propagate the knowledge extracted from the subset of labeled examples to unlabeled examples while being invariant to augmentation or other perturbations. These methods generally depend on the quality of the classifier’s predictions, and as such tend to fare well when given intermediate amounts of data. Although not sufficient in themselves (Unsupervised Data Augmentation (Xie et al., 2019), Virtual Adversarial Training (Miyato et al., 2018) and entropy minimization (Grandvalet & Bengio, 2005), and pseudo-labeling (Lee, 2013) achieve $8 5 . 8 \\%$ , $8 3 . 4 \\%$ , and $8 2 . 4 \\%$ Top-5 accuracy with $10 \\%$ of labels, compared to our $8 9 . 4 \\%$ ) when combined with representation learning (e.g. rotation prediction Zhai et al., 2019) they can provide considerable gains $9 1 . 2 \\%$ Top5 accuracy). It is therefore surprising that CPC representations alone can enable accuracy that is comparable to that of these methods, and investigating to what extent they can be combined would be an interesting topic of future work. ",
705
+ "bbox": [
706
+ 174,
707
+ 290,
708
+ 823,
709
+ 455
710
+ ],
711
+ "page_idx": 8
712
+ },
713
+ {
714
+ "type": "text",
715
+ "text": "4.3 TRANSFER LEARNING: IMAGE DETECTION ON PASCAL VOC 2007 ",
716
+ "text_level": 1,
717
+ "bbox": [
718
+ 176,
719
+ 477,
720
+ 681,
721
+ 491
722
+ ],
723
+ "page_idx": 8
724
+ },
725
+ {
726
+ "type": "text",
727
+ "text": "We next investigate transfer performance on object detection on the PASCAL-2007 dataset, which reflects the practical scenario where a representation must be trained on a dataset with different statistics than the dataset of interest. This dataset also tests the efficiency of the representation as it only contains 5011 labeled images to train from. In this setting, we replaced the neural network classifier $h _ { \\psi }$ used previously with a Faster-RCNN (Ren et al., 2015) image detection architecture, and use the pre-trained feature extractor on ImageNet. As before, we first trained the Faster-RCNN model while keeping the feature extractor fixed, then fine-tuned the entire model end-to-end. Table 3 displays our results compared to other methods. Most competing methods, which optimize a single unsupervised objective on ImageNet before fine-tuning on PASCAL detection, attain around $65 \\%$ mean average precision. Leveraging larger unlabeled datasets increases their performance up to $6 7 . 8 \\%$ (Caron et al., 2019). Combining multiple forms of self-supervision enables them to reach $7 0 . 5 \\%$ (Doersch & Zisserman, 2017). The proposed method, which learns only from ImageNet data using a single unsupervised objective, reaches $7 0 . 6 \\%$ when equipped with a ResNet-101 feature extractor $f _ { \\theta }$ (as for most competing methods (Doersch & Zisserman, 2017) but not all (Caron et al., 2018; 2019). Equipped with the more powerful ResNet-161 feature extractor $f _ { \\theta }$ , our method reaches $7 2 . 7 \\%$ . Importantly, this result is only $2 \\%$ short of the performance attained by purely supervised transfer learning, which we obtain by using all ImageNet labels before transferring to PASCAL. ",
728
+ "bbox": [
729
+ 174,
730
+ 505,
731
+ 825,
732
+ 741
733
+ ],
734
+ "page_idx": 8
735
+ },
736
+ {
737
+ "type": "text",
738
+ "text": "5 DISCUSSION ",
739
+ "text_level": 1,
740
+ "bbox": [
741
+ 176,
742
+ 765,
743
+ 310,
744
+ 780
745
+ ],
746
+ "page_idx": 8
747
+ },
748
+ {
749
+ "type": "text",
750
+ "text": "We asked whether CPC could enable data-efficient image recognition, and found that it indeed greatly improves the accuracy of classifiers and object detectors when given small amounts of labeled data. Surprisingly, CPC even improves results given ImageNet-scale labels. Our results show that there is still room for improvement using relatively straightforward changes such as augmentation, optimization, and network architecture. Furthermore, we found that the standard method for evaluating unsupervised representations—linear classification—is only partially predictive of efficient recognition performance, suggesting that further research should focus on efficient recognition as a standalone benchmark. Overall, these results open the door toward research on problems where data is naturally limited, e.g. medical imaging or robotics. ",
751
+ "bbox": [
752
+ 173,
753
+ 799,
754
+ 825,
755
+ 924
756
+ ],
757
+ "page_idx": 8
758
+ },
759
+ {
760
+ "type": "table",
761
+ "img_path": "images/d005a0a972800a539ffdecef950a4659796c2a8300a3ab9b860336449e53c88e.jpg",
762
+ "table_caption": [
763
+ "Table 3: Faster-RCNN $h _ { \\psi }$ trained with $100 \\%$ of PASCAL labels. Comparison of PASCAL 2007 image detection accuracy to other transfer methods. The supervised baseline learns from the entire labeled ImageNet dataset and fine-tunes for PASCAL detection. The second class of methods learns from the same unlabeled images before transferring. All of these methods pre-train on the ImageNet dataset, except for DeeperCluster which learns from the larger, but uncurated, YFCC100M dataset (Thomee et al., 2015). All results are reported in terms of mean average precision (mAP). $\\dagger$ denotes methods implemented in this work. "
764
+ ],
765
+ "table_footnote": [],
766
+ "table_body": "<table><tr><td>Method</td><td>mAP</td></tr><tr><td>Transfer from labeled data: Supervised - ResNet-152</td><td>74.7</td></tr><tr><td>Transfer from unlabeled data: Exemplar (Ex) (Dosovitskiy et al., 2014) Motion Segmentation (MS) (Pathak et al.,2016)</td><td>60.9</td></tr><tr><td>Colorization (Col) (Zhang et al.,2016) Relative Position (RP) (Doersch et al.,2015)</td><td>61.1 65.5</td></tr><tr><td>Combination of Ex + MS + Col +RP (Doersch &amp; Zisserman,2017)</td><td>66.8 70.5</td></tr><tr><td>Instance Discrimination (Wu et al., 2018)</td><td>65.4</td></tr><tr><td>Deep Cluster (Caron et al., 2018) Deeper Cluster (Caron et al., 2019)</td><td>65.9</td></tr></table>",
767
+ "bbox": [
768
+ 240,
769
+ 214,
770
+ 758,
771
+ 457
772
+ ],
773
+ "page_idx": 9
774
+ },
775
+ {
776
+ "type": "text",
777
+ "text": "Furthermore, images are far from the only domain where unsupervised representation learning is important: for example, unsupervised learning is already a critical step in language (Mikolov et al., 2013; Devlin et al., 2018), and shows promise in domains like audio (van den Oord et al., 2018; Arandjelovic & Zisserman, 2018; 2017), video (Jing & Tian, 2018; Misra et al., 2016), and robotic manipulation (Pinto & Gupta, 2016; Pinto et al., 2016; Sermanet et al., 2018). Currently much self-supervised work builds upon tasks tailored for a specific domain (often images), which may not be easily adapted to other domains. Contrastive prediction methods, including the techniques suggested in this paper, are task agnostic and could therefore serve as a unifying framework for integrating these tasks and modalities. This generality is particularly useful given that many realworld environments are inherently multimodal, e.g. robotic environments which can have vision, audio, touch, proprioception, action, and more over long temporal sequences. Given the importance of increasing the amounts of self-supervision (via additional directions of prediction), integrating these modalities and tasks could lead to unsupervised representations which rival the efficiency and effectiveness of biological ones. ",
778
+ "bbox": [
779
+ 173,
780
+ 486,
781
+ 825,
782
+ 680
783
+ ],
784
+ "page_idx": 9
785
+ },
786
+ {
787
+ "type": "text",
788
+ "text": "REFERENCES ",
789
+ "text_level": 1,
790
+ "bbox": [
791
+ 174,
792
+ 702,
793
+ 285,
794
+ 717
795
+ ],
796
+ "page_idx": 9
797
+ },
798
+ {
799
+ "type": "text",
800
+ "text": "Pulkit Agrawal, Joao Carreira, and Jitendra Malik. Learning to see by moving. In ICCV, 2015. ",
801
+ "bbox": [
802
+ 171,
803
+ 724,
804
+ 794,
805
+ 739
806
+ ],
807
+ "page_idx": 9
808
+ },
809
+ {
810
+ "type": "text",
811
+ "text": "Relja Arandjelovic and Andrew Zisserman. Look, listen and learn. In Proceedings of the IEEE International Conference on Computer Vision, pp. 609–617, 2017. ",
812
+ "bbox": [
813
+ 173,
814
+ 747,
815
+ 823,
816
+ 776
817
+ ],
818
+ "page_idx": 9
819
+ },
820
+ {
821
+ "type": "text",
822
+ "text": "Relja Arandjelovic and Andrew Zisserman. Objects that sound. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 435–451, 2018. ",
823
+ "bbox": [
824
+ 173,
825
+ 784,
826
+ 823,
827
+ 813
828
+ ],
829
+ "page_idx": 9
830
+ },
831
+ {
832
+ "type": "text",
833
+ "text": "Lei Jimmy Ba, Ryan Kiros, and Geoffrey E. Hinton. Layer normalization. CoRR, abs/1607.06450, 2016. ",
834
+ "bbox": [
835
+ 173,
836
+ 820,
837
+ 823,
838
+ 849
839
+ ],
840
+ "page_idx": 9
841
+ },
842
+ {
843
+ "type": "text",
844
+ "text": "Philip Bachman, R Devon Hjelm, and William Buchwalter. Learning representations by maximizing mutual information across views. arXiv preprint arXiv:1906.00910, 2019. ",
845
+ "bbox": [
846
+ 173,
847
+ 858,
848
+ 823,
849
+ 887
850
+ ],
851
+ "page_idx": 9
852
+ },
853
+ {
854
+ "type": "text",
855
+ "text": "H.B. Barlow. Unsupervised learning. Neural Computation, 1(3):295–311, 1989. doi: 10.1162/neco. 1989.1.3.295. ",
856
+ "bbox": [
857
+ 174,
858
+ 895,
859
+ 821,
860
+ 922
861
+ ],
862
+ "page_idx": 9
863
+ },
864
+ {
865
+ "type": "text",
866
+ "text": "Mathilde Caron, Piotr Bojanowski, Armand Joulin, and Matthijs Douze. Deep clustering for unsupervised learning of visual features. In The European Conference on Computer Vision (ECCV), September 2018. ",
867
+ "bbox": [
868
+ 173,
869
+ 103,
870
+ 823,
871
+ 146
872
+ ],
873
+ "page_idx": 10
874
+ },
875
+ {
876
+ "type": "text",
877
+ "text": "Mathilde Caron, Piotr Bojanowski, Julien Mairal, and Armand Joulin. Leveraging large-scale uncurated data for unsupervised pre-training of visual features. 2019. ",
878
+ "bbox": [
879
+ 173,
880
+ 156,
881
+ 820,
882
+ 185
883
+ ],
884
+ "page_idx": 10
885
+ },
886
+ {
887
+ "type": "text",
888
+ "text": "Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. CoRR, abs/1810.04805, 2018. ",
889
+ "bbox": [
890
+ 173,
891
+ 195,
892
+ 821,
893
+ 224
894
+ ],
895
+ "page_idx": 10
896
+ },
897
+ {
898
+ "type": "text",
899
+ "text": "Carl Doersch and Andrew Zisserman. Multi-task self-supervised visual learning. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2051–2060, 2017. ",
900
+ "bbox": [
901
+ 174,
902
+ 234,
903
+ 823,
904
+ 265
905
+ ],
906
+ "page_idx": 10
907
+ },
908
+ {
909
+ "type": "text",
910
+ "text": "Carl Doersch, Abhinav Gupta, and Alexei A Efros. Unsupervised visual representation learning by context prediction. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1422–1430, 2015. ",
911
+ "bbox": [
912
+ 173,
913
+ 273,
914
+ 826,
915
+ 318
916
+ ],
917
+ "page_idx": 10
918
+ },
919
+ {
920
+ "type": "text",
921
+ "text": "Jeff Donahue and Karen Simonyan. Large scale adversarial representation learning. arXiv preprint arXiv:1907.02544, 2019. ",
922
+ "bbox": [
923
+ 169,
924
+ 327,
925
+ 823,
926
+ 357
927
+ ],
928
+ "page_idx": 10
929
+ },
930
+ {
931
+ "type": "text",
932
+ "text": "Jeff Donahue, Philipp Krahenb ¨ uhl, and Trevor Darrell. Adversarial feature learning. ¨ arXiv preprint arXiv:1605.09782, 2016. ",
933
+ "bbox": [
934
+ 171,
935
+ 367,
936
+ 823,
937
+ 396
938
+ ],
939
+ "page_idx": 10
940
+ },
941
+ {
942
+ "type": "text",
943
+ "text": "Alexey Dosovitskiy, Jost Tobias Springenberg, Martin Riedmiller, and Thomas Brox. Discriminative unsupervised feature learning with convolutional neural networks. In Advances in neural information processing systems, pp. 766–774, 2014. ",
944
+ "bbox": [
945
+ 174,
946
+ 406,
947
+ 825,
948
+ 450
949
+ ],
950
+ "page_idx": 10
951
+ },
952
+ {
953
+ "type": "text",
954
+ "text": "Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes challenge 2007 (voc2007) results. 2007. ",
955
+ "bbox": [
956
+ 178,
957
+ 459,
958
+ 823,
959
+ 489
960
+ ],
961
+ "page_idx": 10
962
+ },
963
+ {
964
+ "type": "text",
965
+ "text": "Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. arXiv preprint arXiv:1803.07728, 2018. ",
966
+ "bbox": [
967
+ 174,
968
+ 498,
969
+ 823,
970
+ 529
971
+ ],
972
+ "page_idx": 10
973
+ },
974
+ {
975
+ "type": "text",
976
+ "text": "Yves Grandvalet and Yoshua Bengio. Semi-supervised learning by entropy minimization. In Advances in neural information processing systems, pp. 529–536, 2005. ",
977
+ "bbox": [
978
+ 171,
979
+ 539,
980
+ 823,
981
+ 568
982
+ ],
983
+ "page_idx": 10
984
+ },
985
+ {
986
+ "type": "text",
987
+ "text": "Michael Gutmann and Aapo Hyvarinen. Noise-contrastive estimation: A new estimation principle ¨ for unnormalized statistical models. In Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, pp. 297–304, 2010. ",
988
+ "bbox": [
989
+ 176,
990
+ 577,
991
+ 825,
992
+ 621
993
+ ],
994
+ "page_idx": 10
995
+ },
996
+ {
997
+ "type": "text",
998
+ "text": "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. ",
999
+ "bbox": [
1000
+ 174,
1001
+ 631,
1002
+ 825,
1003
+ 674
1004
+ ],
1005
+ "page_idx": 10
1006
+ },
1007
+ {
1008
+ "type": "text",
1009
+ "text": "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. ",
1010
+ "bbox": [
1011
+ 173,
1012
+ 684,
1013
+ 825,
1014
+ 714
1015
+ ],
1016
+ "page_idx": 10
1017
+ },
1018
+ {
1019
+ "type": "text",
1020
+ "text": "G.E. Hinton, T.J. Sejnowski, H.H.M.I.C.N.L.T.J. Sejnowski, and T.A. Poggio. Unsupervised Learning: Foundations of Neural Computation. A Bradford Book. MIT Press, 1999. ISBN 9780262581684. ",
1021
+ "bbox": [
1022
+ 173,
1023
+ 723,
1024
+ 825,
1025
+ 766
1026
+ ],
1027
+ "page_idx": 10
1028
+ },
1029
+ {
1030
+ "type": "text",
1031
+ "text": "Olivier J. Henaff, Robbe L. T. Goris, and Eero P. Simoncelli. Perceptual straightening of natural ´ videos. Nature Neuroscience, Apr 2019. ",
1032
+ "bbox": [
1033
+ 171,
1034
+ 776,
1035
+ 825,
1036
+ 806
1037
+ ],
1038
+ "page_idx": 10
1039
+ },
1040
+ {
1041
+ "type": "text",
1042
+ "text": "Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. arXiv preprint arXiv:1502.03167, 2015. ",
1043
+ "bbox": [
1044
+ 171,
1045
+ 816,
1046
+ 823,
1047
+ 845
1048
+ ],
1049
+ "page_idx": 10
1050
+ },
1051
+ {
1052
+ "type": "text",
1053
+ "text": "Dinesh Jayaraman and Kristen Grauman. Learning image representations tied to ego-motion. In ICCV, 2015. ",
1054
+ "bbox": [
1055
+ 171,
1056
+ 856,
1057
+ 823,
1058
+ 885
1059
+ ],
1060
+ "page_idx": 10
1061
+ },
1062
+ {
1063
+ "type": "text",
1064
+ "text": "Longlong Jing and Yingli Tian. Self-supervised spatiotemporal feature learning by video geometric transformations. arXiv preprint arXiv:1811.11387, 2018. ",
1065
+ "bbox": [
1066
+ 173,
1067
+ 895,
1068
+ 821,
1069
+ 924
1070
+ ],
1071
+ "page_idx": 10
1072
+ },
1073
+ {
1074
+ "type": "text",
1075
+ "text": "Durk P Kingma, Shakir Mohamed, Danilo Jimenez Rezende, and Max Welling. Semi-supervised learning with deep generative models. In Advances in neural information processing systems, pp. 3581–3589, 2014. ",
1076
+ "bbox": [
1077
+ 173,
1078
+ 103,
1079
+ 823,
1080
+ 146
1081
+ ],
1082
+ "page_idx": 11
1083
+ },
1084
+ {
1085
+ "type": "text",
1086
+ "text": "Alexander Kolesnikov, Xiaohua Zhai, and Lucas Beyer. Revisiting self-supervised visual representation learning. CoRR, abs/1901.09005, 2019. URL http://arxiv.org/abs/1901.09005. ",
1087
+ "bbox": [
1088
+ 173,
1089
+ 155,
1090
+ 823,
1091
+ 184
1092
+ ],
1093
+ "page_idx": 11
1094
+ },
1095
+ {
1096
+ "type": "text",
1097
+ "text": "Brenden M Lake, Ruslan Salakhutdinov, and Joshua B Tenenbaum. Human-level concept learning through probabilistic program induction. Science, 350(6266):1332–1338, 2015. ",
1098
+ "bbox": [
1099
+ 173,
1100
+ 193,
1101
+ 823,
1102
+ 222
1103
+ ],
1104
+ "page_idx": 11
1105
+ },
1106
+ {
1107
+ "type": "text",
1108
+ "text": "Barbara Landau, Linda B Smith, and Susan S Jones. The importance of shape in early lexical learning. Cognitive development, 3(3):299–321, 1988. ",
1109
+ "bbox": [
1110
+ 171,
1111
+ 231,
1112
+ 823,
1113
+ 261
1114
+ ],
1115
+ "page_idx": 11
1116
+ },
1117
+ {
1118
+ "type": "text",
1119
+ "text": "Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Colorization as a proxy task for visual understanding. In CVPR, pp. 6874–6883, 2017. ",
1120
+ "bbox": [
1121
+ 174,
1122
+ 268,
1123
+ 820,
1124
+ 299
1125
+ ],
1126
+ "page_idx": 11
1127
+ },
1128
+ {
1129
+ "type": "text",
1130
+ "text": "Yann LeCun, Yoshua Bengio, and Geoffrey Hinton. Deep learning. nature, 521(7553):436, 2015. ",
1131
+ "bbox": [
1132
+ 173,
1133
+ 306,
1134
+ 810,
1135
+ 323
1136
+ ],
1137
+ "page_idx": 11
1138
+ },
1139
+ {
1140
+ "type": "text",
1141
+ "text": "Dong-Hyun Lee. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In Workshop on Challenges in Representation Learning, ICML, volume 3, pp. 2, 2013. ",
1142
+ "bbox": [
1143
+ 173,
1144
+ 332,
1145
+ 825,
1146
+ 375
1147
+ ],
1148
+ "page_idx": 11
1149
+ },
1150
+ {
1151
+ "type": "text",
1152
+ "text": "Yin Li, Manohar Paluri, James M Rehg, and Piotr Dollar. Unsupervised learning of edges. In ´ CVPR, 2016. ",
1153
+ "bbox": [
1154
+ 174,
1155
+ 382,
1156
+ 821,
1157
+ 412
1158
+ ],
1159
+ "page_idx": 11
1160
+ },
1161
+ {
1162
+ "type": "text",
1163
+ "text": "Ellen M Markman. Categorization and naming in children: Problems of induction. mit Press, 1989. ",
1164
+ "bbox": [
1165
+ 171,
1166
+ 421,
1167
+ 821,
1168
+ 438
1169
+ ],
1170
+ "page_idx": 11
1171
+ },
1172
+ {
1173
+ "type": "text",
1174
+ "text": "Tomas Mikolov, Ilya Sutskever, Kai Chen, Greg S Corrado, and Jeff Dean. Distributed representations of words and phrases and their compositionality. In C. J. C. Burges, L. Bottou, M. Welling, Z. Ghahramani, and K. Q. Weinberger (eds.), Advances in Neural Information Processing Systems 26, pp. 3111–3119. Curran Associates, Inc., 2013. ",
1175
+ "bbox": [
1176
+ 173,
1177
+ 444,
1178
+ 825,
1179
+ 502
1180
+ ],
1181
+ "page_idx": 11
1182
+ },
1183
+ {
1184
+ "type": "text",
1185
+ "text": "Ishan Misra, C Lawrence Zitnick, and Martial Hebert. Shuffle and learn: unsupervised learning using temporal order verification. In ECCV, 2016. ",
1186
+ "bbox": [
1187
+ 174,
1188
+ 511,
1189
+ 823,
1190
+ 540
1191
+ ],
1192
+ "page_idx": 11
1193
+ },
1194
+ {
1195
+ "type": "text",
1196
+ "text": "Takeru Miyato, Shin-ichi Maeda, Shin Ishii, and Masanori Koyama. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. IEEE transactions on pattern analysis and machine intelligence, 2018. ",
1197
+ "bbox": [
1198
+ 173,
1199
+ 549,
1200
+ 825,
1201
+ 592
1202
+ ],
1203
+ "page_idx": 11
1204
+ },
1205
+ {
1206
+ "type": "text",
1207
+ "text": "Andriy Mnih and Koray Kavukcuoglu. Learning word embeddings efficiently with noise-contrastive estimation. In Advances in neural information processing systems, pp. 2265–2273, 2013. ",
1208
+ "bbox": [
1209
+ 173,
1210
+ 601,
1211
+ 821,
1212
+ 631
1213
+ ],
1214
+ "page_idx": 11
1215
+ },
1216
+ {
1217
+ "type": "text",
1218
+ "text": "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. ",
1219
+ "bbox": [
1220
+ 173,
1221
+ 638,
1222
+ 821,
1223
+ 669
1224
+ ],
1225
+ "page_idx": 11
1226
+ },
1227
+ {
1228
+ "type": "text",
1229
+ "text": "Stephanie E Palmer, Olivier Marre, Michael J Berry, and William Bialek. Predictive information in a sensory population. Proceedings of the National Academy of Sciences, 112(22):6908–6913, 2015. ",
1230
+ "bbox": [
1231
+ 178,
1232
+ 676,
1233
+ 823,
1234
+ 719
1235
+ ],
1236
+ "page_idx": 11
1237
+ },
1238
+ {
1239
+ "type": "text",
1240
+ "text": "Deepak Pathak, Ross Girshick, Piotr Dollar, Trevor Darrell, and Bharath Hariharan. Learning fea-´ tures by watching objects move. arXiv preprint arXiv:1612.06370, 2016. ",
1241
+ "bbox": [
1242
+ 171,
1243
+ 728,
1244
+ 823,
1245
+ 758
1246
+ ],
1247
+ "page_idx": 11
1248
+ },
1249
+ {
1250
+ "type": "text",
1251
+ "text": "Lerrel Pinto and Abhinav Gupta. Supersizing self-supervision: Learning to grasp from 50k tries and 700 robot hours. In ICRA, 2016. ",
1252
+ "bbox": [
1253
+ 171,
1254
+ 767,
1255
+ 825,
1256
+ 796
1257
+ ],
1258
+ "page_idx": 11
1259
+ },
1260
+ {
1261
+ "type": "text",
1262
+ "text": "Lerrel Pinto, James Davidson, and Abhinav Gupta. Supervision via competition: Robot adversaries for learning tasks. arXiv preprint arXiv:1610.01685, 2016. ",
1263
+ "bbox": [
1264
+ 171,
1265
+ 805,
1266
+ 823,
1267
+ 834
1268
+ ],
1269
+ "page_idx": 11
1270
+ },
1271
+ {
1272
+ "type": "text",
1273
+ "text": "Rajesh PN Rao and Dana H Ballard. Predictive coding in the visual cortex: a functional interpretation of some extra-classical receptive-field effects. Nature neuroscience, 2(1):79, 1999. ",
1274
+ "bbox": [
1275
+ 171,
1276
+ 843,
1277
+ 823,
1278
+ 872
1279
+ ],
1280
+ "page_idx": 11
1281
+ },
1282
+ {
1283
+ "type": "text",
1284
+ "text": "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. ",
1285
+ "bbox": [
1286
+ 174,
1287
+ 881,
1288
+ 825,
1289
+ 924
1290
+ ],
1291
+ "page_idx": 11
1292
+ },
1293
+ {
1294
+ "type": "text",
1295
+ "text": "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. ",
1296
+ "bbox": [
1297
+ 178,
1298
+ 103,
1299
+ 821,
1300
+ 146
1301
+ ],
1302
+ "page_idx": 12
1303
+ },
1304
+ {
1305
+ "type": "text",
1306
+ "text": "Pierre Sermanet, Corey Lynch, Yevgen Chebotar, Jasmine Hsu, Eric Jang, Stefan Schaal, Sergey Levine, and Google Brain. Time-contrastive networks: Self-supervised learning from video. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pp. 1134–1141. IEEE, 2018. ",
1307
+ "bbox": [
1308
+ 174,
1309
+ 155,
1310
+ 825,
1311
+ 210
1312
+ ],
1313
+ "page_idx": 12
1314
+ },
1315
+ {
1316
+ "type": "text",
1317
+ "text": "Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929–1958, 2014. ",
1318
+ "bbox": [
1319
+ 176,
1320
+ 219,
1321
+ 823,
1322
+ 263
1323
+ ],
1324
+ "page_idx": 12
1325
+ },
1326
+ {
1327
+ "type": "text",
1328
+ "text": "Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott E. Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. CoRR, abs/1409.4842, 2014. URL http://arxiv.org/abs/1409.4842. ",
1329
+ "bbox": [
1330
+ 173,
1331
+ 271,
1332
+ 825,
1333
+ 315
1334
+ ],
1335
+ "page_idx": 12
1336
+ },
1337
+ {
1338
+ "type": "text",
1339
+ "text": "Bart Thomee, David A Shamma, Gerald Friedland, Benjamin Elizalde, Karl Ni, Douglas Poland, Damian Borth, and Li-Jia Li. Yfcc100m: The new data in multimedia research. arXiv preprint arXiv:1503.01817, 2015. ",
1340
+ "bbox": [
1341
+ 174,
1342
+ 323,
1343
+ 823,
1344
+ 366
1345
+ ],
1346
+ "page_idx": 12
1347
+ },
1348
+ {
1349
+ "type": "text",
1350
+ "text": "Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. arXiv preprint arXiv:1906.05849, 2019. ",
1351
+ "bbox": [
1352
+ 173,
1353
+ 375,
1354
+ 823,
1355
+ 404
1356
+ ],
1357
+ "page_idx": 12
1358
+ },
1359
+ {
1360
+ "type": "text",
1361
+ "text": "Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. ",
1362
+ "bbox": [
1363
+ 173,
1364
+ 412,
1365
+ 823,
1366
+ 441
1367
+ ],
1368
+ "page_idx": 12
1369
+ },
1370
+ {
1371
+ "type": "text",
1372
+ "text": "Xiaolong Wang and Abhinav Gupta. Unsupervised learning of visual representations using videos. In ICCV, 2015. ",
1373
+ "bbox": [
1374
+ 173,
1375
+ 450,
1376
+ 823,
1377
+ 479
1378
+ ],
1379
+ "page_idx": 12
1380
+ },
1381
+ {
1382
+ "type": "text",
1383
+ "text": "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. ",
1384
+ "bbox": [
1385
+ 173,
1386
+ 488,
1387
+ 823,
1388
+ 531
1389
+ ],
1390
+ "page_idx": 12
1391
+ },
1392
+ {
1393
+ "type": "text",
1394
+ "text": "Qizhe Xie, Zihang Dai, Eduard Hovy, Minh-Thang Luong, and Quoc V. Le. Unsupervised Data Augmentation. arXiv e-prints, art. arXiv:1904.12848, Apr 2019. ",
1395
+ "bbox": [
1396
+ 169,
1397
+ 540,
1398
+ 823,
1399
+ 569
1400
+ ],
1401
+ "page_idx": 12
1402
+ },
1403
+ {
1404
+ "type": "text",
1405
+ "text": "Amir R Zamir, Tilman Wekel, Pulkit Agrawal, Colin Wei, Jitendra Malik, and Silvio Savarese. Generic 3D representation via pose estimation and matching. In ECCV, 2016. ",
1406
+ "bbox": [
1407
+ 169,
1408
+ 577,
1409
+ 821,
1410
+ 607
1411
+ ],
1412
+ "page_idx": 12
1413
+ },
1414
+ {
1415
+ "type": "text",
1416
+ "text": "Xiaohua Zhai, Avital Oliver, Alexander Kolesnikov, and Lucas Beyer. $S ^ { 4 } L$ : Self-supervised semisupervised learning. arXiv preprint arXiv:1905.03670, 2019. ",
1417
+ "bbox": [
1418
+ 173,
1419
+ 614,
1420
+ 821,
1421
+ 645
1422
+ ],
1423
+ "page_idx": 12
1424
+ },
1425
+ {
1426
+ "type": "text",
1427
+ "text": "Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In European conference on computer vision, pp. 649–666. Springer, 2016. ",
1428
+ "bbox": [
1429
+ 173,
1430
+ 652,
1431
+ 821,
1432
+ 683
1433
+ ],
1434
+ "page_idx": 12
1435
+ },
1436
+ {
1437
+ "type": "text",
1438
+ "text": "Xiaojin Zhu and Zoubin Ghahramani. Learning from labeled and unlabeled data with label propagation. In Technical Report CMU-CALD-02-107, Carnegie Mellon University, 2002. ",
1439
+ "bbox": [
1440
+ 171,
1441
+ 690,
1442
+ 821,
1443
+ 720
1444
+ ],
1445
+ "page_idx": 12
1446
+ },
1447
+ {
1448
+ "type": "text",
1449
+ "text": "Chengxu Zhuang, Alex Lin Zhai, and Daniel Yamins. Local aggregation for unsupervised learning of visual embeddings. arXiv preprint arXiv:1903.12355, 2019. ",
1450
+ "bbox": [
1451
+ 173,
1452
+ 728,
1453
+ 823,
1454
+ 758
1455
+ ],
1456
+ "page_idx": 12
1457
+ },
1458
+ {
1459
+ "type": "text",
1460
+ "text": "A APPENDIX ",
1461
+ "text_level": 1,
1462
+ "bbox": [
1463
+ 176,
1464
+ 103,
1465
+ 299,
1466
+ 117
1467
+ ],
1468
+ "page_idx": 13
1469
+ },
1470
+ {
1471
+ "type": "text",
1472
+ "text": "A.1 ADDITIONAL RESULTS ",
1473
+ "text_level": 1,
1474
+ "bbox": [
1475
+ 174,
1476
+ 133,
1477
+ 377,
1478
+ 148
1479
+ ],
1480
+ "page_idx": 13
1481
+ },
1482
+ {
1483
+ "type": "table",
1484
+ "img_path": "images/cd16abc0799fc70d1a375836e8cc04ff4651be0d7ba68507f20886a5866fd0b3.jpg",
1485
+ "table_caption": [
1486
+ "Table 4: Data efficient classification results with Top-1 accuracy. "
1487
+ ],
1488
+ "table_footnote": [],
1489
+ "table_body": "<table><tr><td>Labeled data Method</td><td>1%</td><td>2%</td><td>5%</td><td>10% Top-1 accuracy</td><td>20%</td><td>50%</td><td>100%</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Supervised trained on pixels</td><td>23.1</td><td>34.8</td><td>50.2</td><td>60.0</td><td>67.6</td><td>74.4</td><td>78.0</td></tr><tr><td>ReseNet trained on CPC v2 (fine-tuned)</td><td>46.3</td><td>54.7</td><td>64.1</td><td>69.7</td><td>73.0</td><td>77.3</td><td>80.6</td></tr></table>",
1490
+ "bbox": [
1491
+ 184,
1492
+ 193,
1493
+ 815,
1494
+ 267
1495
+ ],
1496
+ "page_idx": 13
1497
+ },
1498
+ {
1499
+ "type": "table",
1500
+ "img_path": "images/ef57c53b71083a6069724c7b7ef7e00273991c3de17438cac7824c7e459eff57.jpg",
1501
+ "table_caption": [
1502
+ "Table 5: Data efficient classification results with Top-5 accuracy (data in Fig. 1). "
1503
+ ],
1504
+ "table_footnote": [],
1505
+ "table_body": "<table><tr><td>Labeled data Method</td><td>1%</td><td>2%</td><td>5%</td><td>10% Top-5 accuracy</td><td>20%</td><td>50%</td><td>100%</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Supervised trained on pixels</td><td>44.1</td><td>59.9</td><td>75.2</td><td>82.1</td><td>87.9</td><td>91.8</td><td>93.8</td></tr><tr><td>ReseNet trained on CPC v2 (fine-tuned)</td><td>72.9</td><td>79.6</td><td>86.1</td><td>89.5</td><td>91.4</td><td>93.6</td><td>95.2</td></tr></table>",
1506
+ "bbox": [
1507
+ 184,
1508
+ 321,
1509
+ 815,
1510
+ 397
1511
+ ],
1512
+ "page_idx": 13
1513
+ },
1514
+ {
1515
+ "type": "text",
1516
+ "text": "A.2 INFONCE IMPLEMENTATION ",
1517
+ "text_level": 1,
1518
+ "bbox": [
1519
+ 176,
1520
+ 429,
1521
+ 418,
1522
+ 444
1523
+ ],
1524
+ "page_idx": 13
1525
+ },
1526
+ {
1527
+ "type": "text",
1528
+ "text": "For completeness, we provide pseudo-code for the main calculations involved in the InfoNCE objective, loosely modeled after Tensorflow operations. We suppose we have just calculated a set of latents $z _ { i , j } = f _ { \\theta } ( \\pmb { x } _ { i , j } )$ for $i , j \\in \\{ 1 , . . . , 7 \\}$ , each one being e.g. a 4096-dimensional vector. Assuming we do so for a batch of $B$ images $\\{ { \\pmb x } \\}$ , the set of latents is a tensor of size $B \\times 7 \\times 7 \\times 4 0 9 6$ . ",
1529
+ "bbox": [
1530
+ 173,
1531
+ 455,
1532
+ 825,
1533
+ 512
1534
+ ],
1535
+ "page_idx": 13
1536
+ },
1537
+ {
1538
+ "type": "text",
1539
+ "text": "def pixelCNN(latents): # latents: [B, H, W, D] cres $=$ latents cres_dim $=$ cres.shape[-1] for in range(5): c $=$ Conv2D(output_channels $= 2 5 6$ , kernel_shape $=$ (1, 1))(cres) c = ReLU(c) c = Conv2D(output_channels $= 2 5 6$ , kernel_shape $=$ (1, 3))(c) c = Pad(c, [[0, 0], [1, 0], [0, 0], [0, 0]]) c = Conv2D(output_channels $= 2 5 6$ , kernel_shape $=$ (2, 1), type $= ^ { \\parallel }$ VALID')(c) c $=$ ReLU(c) c $=$ Conv2D(output_channels $=$ cres_dim, kernel_shape $=$ (1, 1))(c) cres $=$ cres + c cres $=$ ReLU(cres) return cres ",
1540
+ "bbox": [
1541
+ 176,
1542
+ 119,
1543
+ 663,
1544
+ 398
1545
+ ],
1546
+ "page_idx": 14
1547
+ },
1548
+ {
1549
+ "type": "text",
1550
+ "text": "A.3 LINEAR CLASSIFICATION ",
1551
+ "text_level": 1,
1552
+ "bbox": [
1553
+ 176,
1554
+ 421,
1555
+ 392,
1556
+ 435
1557
+ ],
1558
+ "page_idx": 14
1559
+ },
1560
+ {
1561
+ "type": "text",
1562
+ "text": "• Model architecture: Having extracted $8 0 \\mathrm { x } 8 0$ patches with a stride of $3 2 \\mathrm { x } 3 2 $ from a $2 4 0 \\times 2 4 0$ shaped input image, we end up with a grid of 6x6 features (each of which is obtained from our ResNet-161 architecture). This gives us a [6,6,4096] tensor for the image. We then use a Batch-Normalization layer to normalize the features (without scale parameter) followed by a 1x1 convolution mapping each feature in the grid to the 1000 logits for ImageNet classification. We then spatially-mean-pool these logits to end up with the final log probabilities for the linear classification. \n• We use the Inception preprocessing (Szegedy et al., 2014) to extract $2 4 0 \\times 2 4 0$ crops from the raw image. The image is divided into subcrops as per CPC data-preprocessing used for CPC pre-training. \n• Optimization details: We use Adam Optimizer with a learning rate of 5e-4. We train the model on a batch size of 512 images with 32 images per core spread over 16 workers. ",
1563
+ "bbox": [
1564
+ 217,
1565
+ 443,
1566
+ 826,
1567
+ 619
1568
+ ],
1569
+ "page_idx": 14
1570
+ },
1571
+ {
1572
+ "type": "text",
1573
+ "text": "A.4 EFFICIENT CLASSIFICATION: PURELY SUPERVISED ",
1574
+ "bbox": [
1575
+ 174,
1576
+ 637,
1577
+ 565,
1578
+ 650
1579
+ ],
1580
+ "page_idx": 14
1581
+ },
1582
+ {
1583
+ "type": "text",
1584
+ "text": "In order to find the best model within this class, we vary the following hyperparameters: ",
1585
+ "bbox": [
1586
+ 171,
1587
+ 661,
1588
+ 750,
1589
+ 676
1590
+ ],
1591
+ "page_idx": 14
1592
+ },
1593
+ {
1594
+ "type": "text",
1595
+ "text": "• Model architecture: We investigate using ResNet-50, ResNet-101, and ResNet-152 model architectures, all of them using the $\\mathbf { \\hat { v } } _ { \\mathbf { \\Delta } } 2 \\mathbf { \\hat { \\mu } }$ variant (He et al., 2016b), and find larger architecture to perform better, even when given smaller amounts of data. We insert a DropOut layer before the final linear classification layer (Srivastava et al., 2014). • Data pre-processing: We use the Inception pre-processing pipeline (Szegedy et al., 2014). • Optimization details: We vary the learning rate in $\\{ 0 . 0 5 , 0 . 1 , 0 . 2 \\}$ , the weight decay logarithmically from $1 0 ^ { - 5 }$ to $1 0 ^ { - 2 }$ , the DropOut linearly from 0 to 1, and the batch size per worker in $\\{ 1 6 , 3 2 \\}$ . ",
1596
+ "bbox": [
1597
+ 217,
1598
+ 689,
1599
+ 823,
1600
+ 811
1601
+ ],
1602
+ "page_idx": 14
1603
+ },
1604
+ {
1605
+ "type": "text",
1606
+ "text": "We chose the best performing model for each training subset $\\mathbb { D } _ { l }$ of labeled ImageNet (using a separate validation set), and report its accuracy on the test set (i.e. the publicly available ILSVRC-2012 validation set). ",
1607
+ "bbox": [
1608
+ 178,
1609
+ 821,
1610
+ 825,
1611
+ 864
1612
+ ],
1613
+ "page_idx": 14
1614
+ }
1615
+ ]
parse/train/rJerHlrYwH/rJerHlrYwH_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/rJerHlrYwH/rJerHlrYwH_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/tqc8n6oHCtZ/tqc8n6oHCtZ.md ADDED
@@ -0,0 +1,232 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LENGTH-ADAPTIVE TRANSFORMER: TRAIN ONCE WITH LENGTH DROP, USE ANYTIME WITH SEARCH
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Although transformers have achieved impressive accuracies in various tasks in natural language processing, they often come with a prohibitive computational cost, that prevents their use in scenarios with limited computational resources for inference. This need for computational efficiency in inference has been addressed by for instance PoWER-BERT (Goyal et al., 2020) which gradually decreases the length of a sequence as it is passed through layers. These approaches however often assume that the target computational complexity is known in advance at the time of training. This implies that a separate model must be trained for each inference scenario with its distinct computational budget. In this paper, we extend PoWER-BERT to address this issue of inefficiency and redundancy. The proposed extension enables us to train a large-scale transformer, called Length-Adaptive Transformer, once and uses it for various inference scenarios without re-training it. To do so, we train a transformer with LengthDrop, a structural variant of dropout, which stochastically determines the length of a sequence at each layer. We then use a multi-objective evolutionary search to find a length configuration that maximizes the accuracy and minimizes the computational complexity under any given computational budget. Additionally, we significantly extend the applicability of PoWER-BERT beyond sequence-level classification into token-level classification such as span-based question-answering, by introducing the idea of Drop-and-Restore. With Drop-and-Restore, word-vectors are dropped temporarily in intermediate layers and restored at the last layer if necessary. We empirically verify the utility of the proposed approach by demonstrating the superior accuracyefficiency trade-off under various setups, including SQuAD 1.1, MNLI-m, and SST-2. Upon publication, the code to reproduce our work will be open-sourced.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Pretrained language models (Peters et al., 2018; Devlin et al., 2018; Radford et al., 2019; Yang et al., 2019) have achieved notable improvements in various natural language processing (NLP) tasks. Most of them rely on transformers (Vaswani et al., 2017), and the number of model parameters ranges from hundreds of millions to billions (Shoeybi et al., 2019; Raffel et al., 2019; Kaplan et al., 2020; Brown et al., 2020). Despite this high accuracy, excessive computational overhead during inference, both in terms of time and memory, has hindered its use in real applications. This level of excessive computation has further raised the concern over energy consumption as well (Schwartz et al., 2019; Strubell et al., 2019).
12
+
13
+ Recent studies have attempted at addressing these concerns regarding large-scale transformers’ computational and energy efficiency (see $\ S 6$ for a more extensive discussion.) Among these, we focus on PoWER-BERT (Goyal et al., 2020) which progressively reduces sequence length by eliminating word-vectors based on the attention values as passing layers. PoWER-BERT establishes the superiority of accuracy-time trade-off over earlier approaches (Sanh et al., 2019; Sun et al., 2019; Michel et al., 2019). It however requires us to train a separate model for each efficiency constraint. In this paper, we thus develop a framework based on PoWER-BERT such that we can train a single model that can be adapted in the inference time to meet any given efficiency target.
14
+
15
+ In order to train a transformer to cope with a diverse set of computational budgets in the inference time, we propose to train one while reducing the sequence length with a random proportion at each layer. We refer to this procedure as LengthDrop which was motivated by the nested dropout (Rippel et al., 2014). We can extract sub-models of shared weights with any length configuration without requiring extra post-processing nor additional finetuning.
16
+
17
+ Once a transformer is trained with the proposed LengthDrop, we search for the length configuration that maximizes the accuracy given a computational budget. Because this search is combinatorial and has multiple objectives (accuracy and efficiency), we use an evolutionary search algorithm, which further allows us to obtain a full Pareto frontier of accuracy-efficiency trade-off of each model.
18
+
19
+ It is not trivial to find an optimal length configuration given the inference-time computational budget, although it is extremely important in order to deploy these large-scale transformers in practice. In this work, we propose to use evolutionary search to find a length configuration that maximizes the accuracy within a given computational budget. We can further compute the Pareto frontier of accuracy-efficiency trade-off to obtain a sequence of length configurations with varying efficiency profiles.
20
+
21
+ PoWER-BERT, which forms the foundation of the proposed two-stage procedure, is only applicable to sequence-level classification, because by design it eliminates some of the word vectors at each layer. In other words, it cannot be used for token-level tasks such as span-based question answering (Rajpurkar et al., 2016), because these tasks require hidden representations of the entire input sequence at the final layer. We thus propose to extend PoWER-BERT with a novel Drop-and-Restore process (§3.3), which eliminates this inherent limitation. Word vectors are dropped and set aside, rather than eliminated, in intermediate layers to maintain the saving of computational cost, as was with the original PoWER-BERT. These set-aside vectors are then restored at the final hidden layer and provided as an input to a subsequent task-specific layer, which is unlike the original PoWER-BERT.
22
+
23
+ The main contributions of this work are two-fold. First, we introduce LengthDrop, a structured variant of dropout for training a single Length-Adaptive Transformer model that allows us to automatically derive multiple sub-models with different length configurations in the inference time using evolutionary search, without requiring any re-training. Second, we design Drop-and-Restore process that makes PoWER-BERT applicable beyond classification, which enables PoWER-BERT to be applicable to a wider range of NLP tasks such as span-based question answering. We empirically verify Length-Adaptive Transformer works quite well using the variants of BERT on a diverse set of NLP tasks, including SQuAD 1.1 (Rajpurkar et al., 2016) and two sequence-level classification tasks in GLUE benchmark (Wang et al., 2018). Our experiments reveal that the proposed approach grants us a fine-grained control of computational efficiency and a superior accuracy-efficiency trade-off in the inference time, compared to existing approaches.
24
+
25
+ # 2 BACKGROUND: TRANSFORMERS AND POWER-BERT
26
+
27
+ Before we describe our main approach, we review some of the building blocks in this section. In particular, we review transformers, which are a standard backbone used in natural language processing these days, and PoWER-BERT, which was recently proposed as an effective way to train a large-scale, but highly efficient transformer for sequence-level classification.
28
+
29
+ # 2.1 TRANSFORMERS AND BERT
30
+
31
+ A transformer is a particular neural network that has been designed to work with a variable-length sequence input and is implemented as a stack of self-attention and fully-connected layers (Vaswani et al., 2017). Here, we give a brief overview of the transformer which is the basic building block of the proposed approach.
32
+
33
+ Each token $x _ { t }$ in a sequence of tokens ${ \boldsymbol x } = ( x _ { 1 } , \dots , x _ { N } )$ , representing input text, is first turned into a continuous vector $h _ { t } ^ { 0 } \in \mathbb { R } ^ { H }$ which is the sum of the token and position embedding vectors. This sequence is fed into the first transformer layer which returns another sequence of the same length $\dot { h ^ { 1 } } \in \mathbb { R } ^ { N \times H }$ . We repeat this procedure $L$ times, for a transformer with $L$ layers, to obtain $h ^ { L } = ( h _ { 1 } ^ { L } , \ldots , h _ { N } ^ { L } )$ . We refer to each vector in the hidden sequence at each layer as a word vector to emphasize that there exists a correspondence between each such vector and one of the input words.
34
+
35
+ Although the transformer was first introduced for the problem of machine translation, Devlin et al.
36
+ (2018) demonstrated that the transformer can be trained and used as a masked language model.
37
+
38
+ More specifically, Devlin et al. (2018) showed that the transformer-based masked language model, called BERT, learns a universally useful parameter set that can be finetuned for any downstream task including sequence-level and token-level classification.
39
+
40
+ In the case of sequence-level classification, a softmax classifier is attached to the word vector $h _ { 1 } ^ { L }$ associated with the special token [CLS], and the entire network, including the softmax classifier and BERT, is finetuned. For token-level classification, we use each $h _ { t } ^ { L }$ as the final hidden reprsentation of the associated $t$ -th word in the input sequence. This strategy of pretraining followed by finetuning, often referred to as transfer learning, has recently become a dominant approach to classification in natural language processing.
41
+
42
+ # 2.2 POWER-BERT
43
+
44
+ PoWER-BERT keeps only the topmost $l _ { j }$ word vectors at each layer $j$ by eliminating redundant ones based on the significance score, which is the total amount of attention imposed by a word on the other words (Goyal et al., 2020). $l _ { j }$ is the hyper-parameter determines how many vectors to keep at layer $j$ PoWER-BERT has the same model parameters with BERT, but the extraction layers are interspersed after the self-attention layer in every transformer blocks (Vaswani et al., 2017).
45
+
46
+ PoWER-BERT reduces inference time successfully, achieving better accuracy-time trade-off than DistilBERT (Sanh et al., 2019), BERT-PKD (Sun et al., 2019), and Head-Prune (Michel et al., 2019). Despite the original intention of maximizing the inference efficiency with the minimal loss in accuracy, it is possible to set up PoWER-BERT to be both more efficient and more accurate compared to the original BERT, which was observed but largely overlooked by Goyal et al. (2020).
47
+
48
+ Training a PoWER-BERT model consists of three steps: (1) finetuning, (2) length configuration search, and (3) re-training. The finetuning step is just like the standard finetuning step of BERT given a target task. A length configuration is a sequence of retention parameters $\left( l _ { 1 } , \cdots l _ { L } \right)$ , each of which corresponds to the number of word vectors that are kept at each layer. These retention parameters are learned along with all the other parameters to minimize the original task loss together with an extra term that approximately measures the number of retained word vectors across layers. In the re-training step, PoWER-BERT is finetuned with the length configuration fixed to its learned one.
49
+
50
+ For each computational budget, we must train a separate model going through all three steps described above. Moreover, the length configuration search step above is only approximate, as it relies on relaxation of retention parameters which are inherently discrete. This leads to the lack of guaranteed correlation between the success of this stage and true run-time. Even worse, it is a delicate act to tune the length configuration given a target computational budget, because trade-off is implicitly made via a regularization coefficient. Furthermore, PoWER-BERT has an inherent limitation in that it only applies to sequence-level classification because it eliminates word vectors in intermediate layers.
51
+
52
+ # 3 LENGTH-ADAPTIVE TRANSFORMER
53
+
54
+ In this section, we explain our proposed framework which results in a transformer that reduces the length of a sequence at each layer with an arbitrary rate. We call such a resulting transformer a Length-Adaptive Transformer. We train Length-Adaptive Transformer with LengthDrop which randomly samples the number of hidden vectors to be dropped at each layer with the goal of making the final model robust to such drop in the inference time. Once the model is trained, we search for the optimal trade-off between accuracy and efficiency using multi-objective evolutionary search, which allows us to use the model for any given computational budget without finetuning nor re-training. At the end of this section, we describe Drop-and-Restore process as a way to greatly increase the applicability of PoWER-BERT which forms a building block of the proposed framework.
55
+
56
+ In short, we train a Length-Adaptive Transformer once with LengthDrop and Drop-and-Restore, and use it with an automatically determined length configuration for inference with any target computational budget, on both sequence-level and token-level tasks.
57
+
58
+ # 3.1 LENGTHDROP
59
+
60
+ Earlier approaches to efficient inference with transformers have focused on a scenario where the target computational budget for inference is known in advance Sanh et al. (2019); Goyal et al. (2020). This greatly increases the cost of deploying transformers, as it requires us to train a separate transformer for each scenario. Instead, we propose to train one model that could be used for a diverse set of target computational budgets without retraining.
61
+
62
+ LengthDrop randomly generates a length configuration by sequentially sampling a sequence length $l _ { i + 1 }$ at the $( i + 1 )$ -th layer based on the previous layer’s sequence length $l _ { i }$ , following the uniform distribution $\mathcal { U } ( \lceil ( 1 - p ) l _ { i } \rceil , l _ { i } )$ , where $l _ { 0 }$ is set to the length of the input sequence, and $p$ is the LengthDrop probability. This sequential sampling results in a length configuration $( l _ { 1 } , \cdots , l _ { L } )$ . Length-Adaptive Transformer can be thought of as consisting of a full model and many sub-models corresponding to different length configuration, similarly to a neural network trained with dropout (Srivastava et al., 2014).
63
+
64
+ LayerDrop From the perspective of each word vector, the proposed LengthDrop could be thought of as skipping the layers between when it was set aside and the final layer where it was restored. The word vector however does not have any information based on which it can determine whether it would be dropped at any particular layer. In our preliminary experiments, we found that this greatly hinders optimization. We address this issue by using LayerDrop (Fan et al., 2019) which skips each layer of a transformer uniformly at random. The LayerDrop encourages each word vector to be agnostic to skipping any number of layers between when it is dropped and when it is restored, just like dropout (Srivastava et al., 2014) prevents hidden neurons from co-adapting with each other by randomly dropping them.
65
+
66
+ Sandwich Rule and Inplace Distillation We observed that standard supervised training with LengthDrop does not work well in the preliminary experiments. We instead borrow a pair of training techniques developed by Yu & Huang (2019) which are sandwich rule and inplace distillation, for better optimization as well as final generalization. At each update, we update the full model without LengthDrop as usual to minimize the supervised loss function. We simultaneously update $n _ { s }$ randomly-sampled sub-models (which are called sandwiches) and the smallest-possible submodel, which corresponds to keeping only $\lceil ( 1 - p ) l _ { i } \rceil$ word vectors at each layer $i$ , using knowledge distillation (Hinton et al., 2015) from the full model. Here, sub-models mean models with length reduction. They are trained to their prediction close to the full model’s prediction (inplace distillation).
67
+
68
+ # 3.2 EVOLUTIONARY SEARCH OF LENGTH CONFIGURATIONS
69
+
70
+ After training a Length-Adaptive Transformer with LengthDrop, we search for appropriate length configurations for possible target computational budgets that will be given at inference time. The length configuration determines the model performance in terms of both accuracy and efficiency. In order to search for the optimal length configuration, we propose to use evolutionary search, similarly to Cai et al. (2019) and Wang et al. (2020). This procedure is efficient, as it only requires a single pass through the relatively small validation set for each length configuration, unlike re-training for a new computational budget which requires multiple passes through a significantly larger training set for each budget.
71
+
72
+ We initialize the population with constant-ratio configurations. Each configuration is created by $l _ { i + 1 } = \lceil ( 1 - r ) \bar { l _ { i } } \rceil$ for each layer $i$ with $r$ so that the amount of computation within the initial population is uniformly distributed between those of the smallest and full models. At each iteration, we evolve the population to consist only of configurations lie on a newly updated efficiencyaccuracy Pareto frontier by mutation and cross-over. Mutation alters an original length configuration $( l _ { 1 } , \cdots , l _ { L } )$ to $( l _ { 1 } ^ { \prime } , \cdots , l _ { L } ^ { \prime } )$ by sampling $l _ { i } ^ { \prime }$ from the uniform distribution $\bar { \mathcal { U } } ( l _ { i - 1 } ^ { \prime } , l _ { i + 1 } )$ with the probability $p _ { m }$ or keeping the original length ${ \bar { l } } _ { i } ^ { \prime } = l _ { i }$ , sweeping the layers from $i = 1$ to $i = L$ . Crossover takes two length configurations and averages the lengths at each layer. Both of these operations are performed while ensuring the monotonicity of the lengths over the layers. We repeat this iteration $G$ times, while maintaining $n _ { m }$ mutated configurations and $n _ { c }$ crossover’d configurations. Repeating this procedure pushes the Pareto frontier further to identify the best trade-off between two objectives, efficiency and accuracy, without requiring any continuous relaxation of length configurations nor using a proxy objective function.
73
+
74
+ ![](images/320388afaf5c944756a7b3f52eddc7583af0fdd53b75f8ac7bf8c3063dd11f2f.jpg)
75
+ Figure 1: Illustration of (a) word-vector elimination process in PoWER-BERT (Goyal et al., 2020) and (b) Drop-and-Restore process in Length-Adaptive Transformer. Yellow box and blue boxes imply the output of embedding layer and transformer layers, respectively. Green boxes mean vectors dropped in lower layers and restored at the last layer. Red box is the task-specific layer. Though word-vectors in the middle could be eliminated (or dropped), remaining vectors are left-aligned for the better illustration. In this case, the number of transformer layers is four.
76
+
77
+ # 3.3 DROP-AND-RESTORE PROCESS
78
+
79
+ The applicability of the PoWER-BERT, based on which our main contribution above was made, is limited to sequence-level classification, because it eliminates word vectors at each layer. In addition to our main contribution above, we thus propose to extend the PoWER-BERT so that it is applicable to token-level classification, such as span-based question-answering. Our proposal, to which we refer as Drop-and-Restore, does not eliminate word vectors at each layer according to the length configuration but instead sets them aside until the final hidden layer. At the final hidden layer, these word vectors are brought back to form the full hidden sequence, as illustrated graphically in Fig. 1.
80
+
81
+ # 4 EXPERIMENT SETUP
82
+
83
+ Datasets We test the proposed approach on both sequence-level and token-level tasks, the latter of which could not have been done with the original PoWER-BERT unless for the proposed Dropand-Restore. We use MNLI-m and SST-2 from GLUE benchmark (Wang et al., 2018), as was done to test PoWER-BERT earlier, for sequence-level classification. We choose them because consistent accuracy scores from standard training on them due to their sufficiently large training set imply that they are reliable to verify our approach. We use SQuAD 1.1 (Rajpurkar et al., 2016) for token-level classification.
84
+
85
+ Evaluation metrics We use the number of floating operations (FLOPs) as a main metric to measure the inference efficiency given any length configuration, as it is agnostic to the choice of underlying hardware, unlike other alternatives such as hardware-aware latency (Wang et al., 2020) or energy consumption (Henderson et al., 2020). We later demonstrate that FLOPs and wall-clock time on GPU and CPU correlate well with the proposed approach, which is not necessarily the case for other approaches, such as unstructured weight pruning (Han et al., 2015; See et al., 2016).
86
+
87
+ Pretrained transformers Since BERT was introduced by Devlin et al. (2018), it has become a standard practice to start from a pretrained (masked) language model and finetune it for each downstream task. We follow the same strategy in this paper and test two pretrained transformerbased language models; BERTBASE (Devlin et al., 2018) and DistilBERT (Sanh et al., 2019), which allows us to demonstrate that the usefulness and applicability of our approach are not tied to any specific architectural choice, such as the number of layers and the maximum length of input sequence. Although we focus on BERT-based masked language models here, the proposed approach is readily applicable to any transformer-based models.
88
+
89
+ Learning We train a Length-Adaptive Transformer with LengthDrop probability and LayerDrop probability both set to 0.2. We use $n _ { s } = 2$ randomly sampled intermediate sub-models in addition to the full model and smallest model for applying the sandwich learning rule.
90
+
91
+ We start finetuning the pretrained transformer without Drop-and-Restore first, just as Goyal et al. (2020) did with PoWER-BERT. We then continue finetuning it for another five epochs with Drop-andRestore. This is unlike the recommended three epochs by Devlin et al. (2018), as learning progresses slower due to a higher level of stochasticity introduced by LengthDrop and LayerDrop. We use the batch size of 32, the learning rate of $5 e - 5$ for SQuAD v1.1 and $2 e - 5$ for MNLI-m and SST, and the maximum sequence length of 384 for SQuAD v1.1 and 128 for MNLI-m and SST.
92
+
93
+ ![](images/3ea54ad6f6a4d01240155dd50bd06714bd078c67453a78cfd7ce1b9404ef27c2.jpg)
94
+ Figure 2: Pareto curves of F1 score and FLOPs on SQuAD 1.1 (Rajpurkar et al., 2016). We apply the proposed method to $\mathbf { B E R T _ { B a s e } }$ (solid lines) and DistilBERT (dotted lines). For each model, we draw three curves using (1) standard finetuned transformer with constant-rate length reduction, (2) Length-Adaptive Transformer with constant-rate length reduction, and (3) Length-Adaptive Transformer with length configurations obtained from the evolutionary search.
95
+
96
+ ![](images/4608176aa7c7dba0b4748567c1c64abe798b711bebf826c4b323894a4bfb2b12.jpg)
97
+ Figure 3: Correlation between FLOPs and latency with different length configurations.
98
+
99
+ Search We run up to $G = 3 0$ iterations of evolutionary search, using $n _ { m } = 3 0$ mutated configurations with mutation probability $p _ { m } = 0 . 5$ and $n _ { c } = 3 0$ crossover’d configurations, to find the Pareto frontier of accuracy and efficiency.
100
+
101
+ # 5 RESULTS AND ANALYSIS
102
+
103
+ Efficiency-accuracy trade-off We use SQuAD 1.1 to examine the effect of the proposed approach on the efficiency-accuracy trade-off. When the underlying classifier was not trained with LengthDrop, as proposed in this paper, the accuracy drops even more dramatically as more word vectors are dropped at each layer. The difference between standard transformer and Length-Adaptive Transformer is stark in Fig. 2. This verifies the importance of training a transformer in a way that makes it malleable for inference-time re-configuration.
104
+
105
+ When the model was trained with the proposed LengthDrop, we notice the efficacy of the proposed approach of using evolutionary search to find the optimal trade-off between inference efficiency and accuracy. The trade-off curve from the proposed search strategy has a larger area-under-curve (AUC) than when constant-rate length reduction was used to meet a target computational budget. It demonstrates the importance of using both LengthDrop and evolutionary search.
106
+
107
+ We make a minor observation that the proposed approach ends up with a significantly higher accuracy than DistillBERT when enough computational budget is allowed for inference $( \log { \mathrm { F L O P s } } > 1 0 )$ . This makes our approach desirable in a wide array of scenarios, as it does not require any additional pretraining stage, as does DistilBERT. With a severe constraint on the computational budget, the proposed approach could be used on DistilBERT to significantly improve the efficiency without compromising the accuracy.
108
+
109
+ Maximizing inference efficiency We consider all three tasks, SQuAD 1.1, MNLI-m and SST-2, and investigate how much efficiency can be gained by the proposed approach with minimal sacrifice of accuracy. First, we look at how much efficiency could be gained without losing on the accuracy. That is, we use the length configuration that maximizes the inference efficiency (i.e., minimize the FLOPs) while ensuring that the accuracy is above or same as the accuracy of the standard approach without any drop of word vectors. The results are presented in the rows marked with Length-Adaptive† from Table 1. For example, in the case of $\mathbf { B E R T _ { B a s e } }$ , the proposed approach reduce FLOPs by more than half across all three tasks.
110
+
111
+ Table 1: Comparison results of standard Transformer and LengthAdaptive Transformer. Among length configurations on the Pareto frontier of Length-Adaptive Transformer, we pick two representative points: Length-Adaptive? and Length-Adaptive† as the most efficient one while having the highest accuracy and the accuracy higher than (or equal to) standard Transformer, respectively.
112
+
113
+ <table><tr><td colspan="2">Model</td><td colspan="2">SQuAD 1.1</td><td colspan="2">MNLI-m</td><td colspan="2">SST-2</td></tr><tr><td>Pretrained Transformer</td><td>Method</td><td>F1</td><td>FLOPs</td><td>Acc</td><td>FLOPs</td><td>Acc</td><td>FLOPs</td></tr><tr><td rowspan="2">BERTBase</td><td>Standard</td><td>88.5</td><td>1.00x</td><td>84.4</td><td>1.00x</td><td>92.8</td><td>1.00x</td></tr><tr><td>Length-Adaptive*</td><td>89.6</td><td>0.89x</td><td>85.0</td><td>0.58x</td><td>93.1</td><td>0.36x</td></tr><tr><td rowspan="2"></td><td>Length-Adaptivet</td><td>88.7</td><td>0.45x</td><td>84.4</td><td>0.35x</td><td>92.8</td><td>0.35x</td></tr><tr><td>Standard</td><td>85.8</td><td>1.00x</td><td>80.9</td><td>1.00x</td><td>90.6</td><td>1.00x</td></tr><tr><td rowspan="2">DistilBERT1</td><td>Length-Adaptive*</td><td>86.3</td><td>0.81x</td><td>81.5</td><td>0.56x</td><td>92.0</td><td>0.55x</td></tr><tr><td>Length-Adaptive†</td><td>85.9</td><td>0.59x</td><td>81.3</td><td>0.54x</td><td>91.7</td><td>0.54x</td></tr></table>
114
+
115
+ ![](images/e4a6ecfc1cdcda5b3130f2509429e44b544d994935e6b44f36893f811295f752.jpg)
116
+ Figure 4: Example of area under Pareto curve as the evolutionary search of lenth configurations proceeds.
117
+
118
+ From Fig. 2, we have observed that the proposed Length-Adaptive Transformer generalize better than the standard, base model in some cases. We thus try to maximize both the inference efficiency and accuracy, in order to see whether it is possible for the proposed algorithm to find a length configuration that both maximizes inference efficiency and improves accuracy. We present the results in the rows marked with Length-Adaptive? from Table 1. For all cases, Length-Adaptive Transformer achieves higher accuracy than a standard transformer does while reducing FLOPs significantly. Although it is not apparent from the table, tor MNLI-m and SST-2, the accuracy of the smallest sub-model is already greater than or equal to that of a standard transformer.
119
+
120
+ FLOPs vs. Latency As has been discussed in recent literature (see, e.g., (Li et al., 2020; Chin et al., 2020)), FLOPs is not a perfect indicator of the real latency measured in wall-clock time, as the latter is affected by the combination of hardware choice and network architecture. To understand the real-world impact of the proposed approach, we study the relationship between FLOPs, obtained by the proposed procedure, and wall-clock time measured on both CPU and GPU by measuring them while varying length configurations. As shown in Fig. 3, FLOPs and latency exhibit near-linear correlation on GPU, when the minibatch size is $\geq 1 6$ , and regardless of the minibatch size, on CPU. In other words, the reduction in FLOPs with the proposed approach directly implies the reduction in wall-clock time.
121
+
122
+ Convergence of search Although the proposed approach is efficient in that it requires only one round of training, it needs a separate search stage for each target budget. It is important for evolutionary search to converge quickly in the number of forward sweeps of a validation set. As exemplified in Fig. 4, evolutionary search converges after about fifteen iterations.
123
+
124
+ # 6 RELATED WORK
125
+
126
+ The main purpose of the proposed algorithm is to improve the inference efficiency of a large-scale transformer. This goal has been pursued from various directions, and in this section, we provide a brief overview of these earlier, and some concurrent, attempts in the context of the proposed approach.
127
+
128
+ Weight pruning Weight pruning (Han et al., 2015) focuses on reducing the number of parameters which directly reflects the memory footprint of a model and indirectly correlates with inference speed. However, their actual speed-up in runtime is usually not significant, especially while executing a model with parallel computation using GPU devices (Tang et al., 2018; Li et al., 2020).
129
+
130
+ Adaptive architecture There are three major axes along which computation can be reduced in a neural network; (1) input size/length, (2) network depth and (3) network width. The proposed approach, based on PoWER-BERT, adaptively reduces the input length as the input sequence is processed by the transformer layers. In our knowledge, Goyal et al. (2020) is the first work in this direction for transformers. More recently, Funnel-Transformer (Dai et al., 2020) and multi-scale transformer language models (Subramanian et al., 2020) also successfully reduce sequence length in the middle and rescale to full length for the final computation. However, their inference complexity is fixed unlike PoWER-BERT because they are not designed for the control of efficiency.
131
+
132
+ LayerDrop (Fan et al., 2019) drops random layers during the training to be robust to pruning inspired by Huang et al. (2016). Word-level adaptive depth in Elbayad et al. (2019) might seemingly resemble with length reduction, but word vectors reached the maximal layer are used for self-attention computation without updating themselves. Escaping a network early (Teerapittayanon et al., 2016; Huang et al., 2017) based on the confidence of the prediction (Xin et al., 2020; Schwartz et al., 2020; Liu et al., 2020) also offers a control over accuracy-efficiency trade-off, but it is difficult to tune a threshold for a desired computational budget because of the example-wise adaptive computation.
133
+
134
+ DynaBERT (Hou et al., 2020) can run at adaptive width (the number of attention heads and intermediate hidden dimension) and depth. Hardware-aware Transformers (Wang et al., 2020) construct a design space with arbitrary encoder-decoder attention and heterogeneous layers in terms of different numbers of layers, attention heads, hidden dimension, and embedding dimension.
135
+
136
+ Structured dropout A major innovation we introduce over the existing PoWER-BERT is the use of stochastic, structured regularization to make a transformer robust to the choice of length configuration in the inference time. Rippel et al. (2014) proposes a nested dropout to learn ordered representations. Similar to LengthDrop, it samples an index form a prior distribution and drops all units having a larger index than sampled one.
137
+
138
+ Search There have been a series of attempts at finding the optimal network configuration by solving a combinatorial optimization problem. In computer vision, Once-for-All (Cai et al., 2019) use an evolutionary search (Real et al., 2019) to find a better configuration in dimensions of depth, width, kernel size, and resolution given computational budget. Similarly but differently, our evolutionary search is mutli-objective to find length configurations on the Pareto accuracy-efficiency frontier to cope with any possible computational budgets. Moreover, we only change the sequence length of hidden vectors instead of architectural model size like dimensions.
139
+
140
+ # 7 CONCLUSION AND FUTURE WORK
141
+
142
+ In this work, we propose a new framework for training a transformer once and using it for efficient inference under any computational budget. With the help of training with LengthDrop and Drop-andRestore process followed by the evolutionary search, our proposed Length-Adaptive Transformer allows any given transformer models to be used with any inference-time computational budget for both sequence-level and token-level classification tasks. Our experiments, on SQuAD 1.1, MNLI-m and SST-2, have revealed that the proposed algorithmic framework significantly pushes a better Pareto frontier on the trade-off between inference efficiency and accuracy. Furthermore, we have observed that the proposed Length-Adaptive Transformer could achieve up to $3 \mathbf { x }$ speed-up over the standard transformer without sacrificing accuracy, both in terms of FLOPs and wallclock time.
143
+
144
+ Although our approach finds an optimal length configuration of a trained classifier per computational budget, it leaves open a question whether the proposed approach could be further extended to support per-instance length configuration by for instance training a small, auxiliary neural network for each computational budget. Yet another aspect we have not investigated in this paper is the applicability of the proposed approach to sequence generation, such as machine translation. We leave both of these research directions for the future.
145
+
146
+ Our approach is effective, as we have shown in this paper, and also quite simple to implement on top of existing language models. We will release our implementation, which is based on HuggingFace’s Transformers library (Wolf et al., 2019), publicly and plan to adapt it for a broader set of transformerbased models and downstream tasks.
147
+
148
+ # REFERENCES
149
+
150
+ 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.
151
+
152
+ Han Cai, Chuang Gan, and Song Han. Once for all: Train one network and specialize it for efficient deployment. arXiv preprint arXiv:1908.09791, 2019.
153
+
154
+ Ting-Wu Chin, Ruizhou Ding, Cha Zhang, and Diana Marculescu. Towards efficient model compression via learned global ranking. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1518–1528, 2020.
155
+
156
+ Zihang Dai, Guokun Lai, Yiming Yang, and Quoc V Le. Funnel-transformer: Filtering out sequential redundancy for efficient language processing. arXiv preprint arXiv:2006.03236, 2020.
157
+
158
+ 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.
159
+
160
+ Maha Elbayad, Jiatao Gu, Edouard Grave, and Michael Auli. Depth-adaptive transformer. arXiv preprint arXiv:1910.10073, 2019.
161
+
162
+ Angela Fan, Edouard Grave, and Armand Joulin. Reducing transformer depth on demand with structured dropout. arXiv preprint arXiv:1909.11556, 2019.
163
+
164
+ Saurabh Goyal, Anamitra Roy Choudhary, Venkatesan Chakaravarthy, Saurabh ManishRaje, Yogish Sabharwal, and Ashish Verma. Power-bert: Accelerating bert inference for classification tasks. arXiv preprint arXiv:2001.08950, 2020.
165
+
166
+ Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015.
167
+
168
+ Peter Henderson, Jieru Hu, Joshua Romoff, Emma Brunskill, Dan Jurafsky, and Joelle Pineau. Towards the systematic reporting of the energy and carbon footprints of machine learning. arXiv preprint arXiv:2002.05651, 2020.
169
+
170
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
171
+
172
+ Lu Hou, Lifeng Shang, Xin Jiang, and Qun Liu. Dynabert: Dynamic bert with adaptive width and depth. arXiv preprint arXiv:2004.04037, 2020.
173
+
174
+ Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In European conference on computer vision, pp. 646–661. Springer, 2016.
175
+
176
+ Gao Huang, Danlu Chen, Tianhong Li, Felix Wu, Laurens van der Maaten, and Kilian Q Weinberger. Multi-scale dense networks for resource efficient image classification. arXiv preprint arXiv:1703.09844, 2017.
177
+
178
+ Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
179
+
180
+ Zhuohan Li, Eric Wallace, Sheng Shen, Kevin Lin, Kurt Keutzer, Dan Klein, and Joseph E Gonzalez. Train large, then compress: Rethinking model size for efficient training and inference of transformers. arXiv preprint arXiv:2002.11794, 2020.
181
+
182
+ Weijie Liu, Peng Zhou, Zhe Zhao, Zhiruo Wang, Haotang Deng, and Qi Ju. Fastbert: a self-distilling bert with adaptive inference time. arXiv preprint arXiv:2004.02178, 2020.
183
+
184
+ Paul Michel, Omer Levy, and Graham Neubig. Are sixteen heads really better than one? In Advances in Neural Information Processing Systems, pp. 14014–14024, 2019.
185
+
186
+ 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.
187
+
188
+ 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.
189
+
190
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683, 2019.
191
+
192
+ Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250, 2016.
193
+
194
+ Esteban Real, Alok Aggarwal, Yanping Huang, and Quoc V Le. Regularized evolution for image classifier architecture search. In Proceedings of the aaai conference on artificial intelligence, volume 33, pp. 4780–4789, 2019.
195
+
196
+ Oren Rippel, Michael Gelbart, and Ryan Adams. Learning ordered representations with nested dropout. In International Conference on Machine Learning, pp. 1746–1754, 2014.
197
+
198
+ 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.
199
+
200
+ Roy Schwartz, Jesse Dodge, Noah A Smith, and Oren Etzioni. Green ai. arXiv preprint arXiv:1907.10597, 2019.
201
+
202
+ Roy Schwartz, Gabi Stanovsky, Swabha Swayamdipta, Jesse Dodge, and Noah A Smith. The right tool for the job: Matching model and instance complexities. arXiv preprint arXiv:2004.07453, 2020.
203
+
204
+ Abigail See, Minh-Thang Luong, and Christopher D Manning. Compression of neural machine translation models via pruning. arXiv preprint arXiv:1606.09274, 2016.
205
+
206
+ Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, and Bryan Catanzaro. Megatron-lm: Training multi-billion parameter language models using gpu model parallelism. arXiv preprint arXiv:1909.08053, 2019.
207
+
208
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929–1958, 2014.
209
+
210
+ Emma Strubell, Ananya Ganesh, and Andrew McCallum. Energy and policy considerations for deep learning in nlp. arXiv preprint arXiv:1906.02243, 2019.
211
+
212
+ Sandeep Subramanian, Ronan Collobert, Marc’Aurelio Ranzato, and Y-Lan Boureau. Multi-scale transformer language models. arXiv preprint arXiv:2005.00581, 2020.
213
+
214
+ Siqi Sun, Yu Cheng, Zhe Gan, and Jingjing Liu. Patient knowledge distillation for bert model compression. arXiv preprint arXiv:1908.09355, 2019.
215
+
216
+ Raphael Tang, Ashutosh Adhikari, and Jimmy Lin. Flops as a direct optimization objective for learning sparse neural networks. arXiv preprint arXiv:1811.03060, 2018.
217
+
218
+ Surat Teerapittayanon, Bradley McDanel, and Hsiang-Tsung Kung. Branchynet: Fast inference via early exiting from deep neural networks. In 2016 23rd International Conference on Pattern Recognition (ICPR), pp. 2464–2469. IEEE, 2016.
219
+
220
+ 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.
221
+
222
+ Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. arXiv preprint arXiv:1804.07461, 2018.
223
+
224
+ Hanrui Wang, Zhanghao Wu, Zhijian Liu, Han Cai, Ligeng Zhu, Chuang Gan, and Song Han. Hat: Hardware-aware transformers for efficient natural language processing. arXiv preprint arXiv:2005.14187, 2020.
225
+
226
+ Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, et al. Transformers: State-of-the-art ´ natural language processing. arXiv preprint arXiv:1910.03771, 2019.
227
+
228
+ Ji Xin, Raphael Tang, Jaejun Lee, Yaoliang Yu, and Jimmy Lin. Deebert: Dynamic early exiting for accelerating bert inference. arXiv preprint arXiv:2004.12993, 2020.
229
+
230
+ Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in neural information processing systems, pp. 5754–5764, 2019.
231
+
232
+ Jiahui Yu and Thomas S Huang. Universally slimmable networks and improved training techniques. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1803–1811, 2019.
parse/train/tqc8n6oHCtZ/tqc8n6oHCtZ_content_list.json ADDED
@@ -0,0 +1,1314 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "LENGTH-ADAPTIVE TRANSFORMER: TRAIN ONCE WITH LENGTH DROP, USE ANYTIME WITH SEARCH ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 174,
8
+ 98,
9
+ 823,
10
+ 147
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Anonymous authors Paper under double-blind review ",
17
+ "bbox": [
18
+ 183,
19
+ 174,
20
+ 398,
21
+ 200
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "ABSTRACT ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 454,
31
+ 238,
32
+ 544,
33
+ 253
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "Although transformers have achieved impressive accuracies in various tasks in natural language processing, they often come with a prohibitive computational cost, that prevents their use in scenarios with limited computational resources for inference. This need for computational efficiency in inference has been addressed by for instance PoWER-BERT (Goyal et al., 2020) which gradually decreases the length of a sequence as it is passed through layers. These approaches however often assume that the target computational complexity is known in advance at the time of training. This implies that a separate model must be trained for each inference scenario with its distinct computational budget. In this paper, we extend PoWER-BERT to address this issue of inefficiency and redundancy. The proposed extension enables us to train a large-scale transformer, called Length-Adaptive Transformer, once and uses it for various inference scenarios without re-training it. To do so, we train a transformer with LengthDrop, a structural variant of dropout, which stochastically determines the length of a sequence at each layer. We then use a multi-objective evolutionary search to find a length configuration that maximizes the accuracy and minimizes the computational complexity under any given computational budget. Additionally, we significantly extend the applicability of PoWER-BERT beyond sequence-level classification into token-level classification such as span-based question-answering, by introducing the idea of Drop-and-Restore. With Drop-and-Restore, word-vectors are dropped temporarily in intermediate layers and restored at the last layer if necessary. We empirically verify the utility of the proposed approach by demonstrating the superior accuracyefficiency trade-off under various setups, including SQuAD 1.1, MNLI-m, and SST-2. Upon publication, the code to reproduce our work will be open-sourced. ",
40
+ "bbox": [
41
+ 232,
42
+ 270,
43
+ 766,
44
+ 602
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "1 INTRODUCTION ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 176,
54
+ 627,
55
+ 336,
56
+ 643
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "Pretrained language models (Peters et al., 2018; Devlin et al., 2018; Radford et al., 2019; Yang et al., 2019) have achieved notable improvements in various natural language processing (NLP) tasks. Most of them rely on transformers (Vaswani et al., 2017), and the number of model parameters ranges from hundreds of millions to billions (Shoeybi et al., 2019; Raffel et al., 2019; Kaplan et al., 2020; Brown et al., 2020). Despite this high accuracy, excessive computational overhead during inference, both in terms of time and memory, has hindered its use in real applications. This level of excessive computation has further raised the concern over energy consumption as well (Schwartz et al., 2019; Strubell et al., 2019). ",
63
+ "bbox": [
64
+ 174,
65
+ 659,
66
+ 826,
67
+ 770
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "Recent studies have attempted at addressing these concerns regarding large-scale transformers’ computational and energy efficiency (see $\\ S 6$ for a more extensive discussion.) Among these, we focus on PoWER-BERT (Goyal et al., 2020) which progressively reduces sequence length by eliminating word-vectors based on the attention values as passing layers. PoWER-BERT establishes the superiority of accuracy-time trade-off over earlier approaches (Sanh et al., 2019; Sun et al., 2019; Michel et al., 2019). It however requires us to train a separate model for each efficiency constraint. In this paper, we thus develop a framework based on PoWER-BERT such that we can train a single model that can be adapted in the inference time to meet any given efficiency target. ",
74
+ "bbox": [
75
+ 174,
76
+ 777,
77
+ 825,
78
+ 888
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "In order to train a transformer to cope with a diverse set of computational budgets in the inference time, we propose to train one while reducing the sequence length with a random proportion at each layer. We refer to this procedure as LengthDrop which was motivated by the nested dropout (Rippel et al., 2014). We can extract sub-models of shared weights with any length configuration without requiring extra post-processing nor additional finetuning. ",
85
+ "bbox": [
86
+ 173,
87
+ 895,
88
+ 821,
89
+ 924
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "",
96
+ "bbox": [
97
+ 174,
98
+ 103,
99
+ 823,
100
+ 146
101
+ ],
102
+ "page_idx": 1
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "Once a transformer is trained with the proposed LengthDrop, we search for the length configuration that maximizes the accuracy given a computational budget. Because this search is combinatorial and has multiple objectives (accuracy and efficiency), we use an evolutionary search algorithm, which further allows us to obtain a full Pareto frontier of accuracy-efficiency trade-off of each model. ",
107
+ "bbox": [
108
+ 174,
109
+ 152,
110
+ 823,
111
+ 208
112
+ ],
113
+ "page_idx": 1
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "It is not trivial to find an optimal length configuration given the inference-time computational budget, although it is extremely important in order to deploy these large-scale transformers in practice. In this work, we propose to use evolutionary search to find a length configuration that maximizes the accuracy within a given computational budget. We can further compute the Pareto frontier of accuracy-efficiency trade-off to obtain a sequence of length configurations with varying efficiency profiles. ",
118
+ "bbox": [
119
+ 174,
120
+ 215,
121
+ 825,
122
+ 299
123
+ ],
124
+ "page_idx": 1
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "PoWER-BERT, which forms the foundation of the proposed two-stage procedure, is only applicable to sequence-level classification, because by design it eliminates some of the word vectors at each layer. In other words, it cannot be used for token-level tasks such as span-based question answering (Rajpurkar et al., 2016), because these tasks require hidden representations of the entire input sequence at the final layer. We thus propose to extend PoWER-BERT with a novel Drop-and-Restore process (§3.3), which eliminates this inherent limitation. Word vectors are dropped and set aside, rather than eliminated, in intermediate layers to maintain the saving of computational cost, as was with the original PoWER-BERT. These set-aside vectors are then restored at the final hidden layer and provided as an input to a subsequent task-specific layer, which is unlike the original PoWER-BERT. ",
129
+ "bbox": [
130
+ 174,
131
+ 306,
132
+ 825,
133
+ 431
134
+ ],
135
+ "page_idx": 1
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "The main contributions of this work are two-fold. First, we introduce LengthDrop, a structured variant of dropout for training a single Length-Adaptive Transformer model that allows us to automatically derive multiple sub-models with different length configurations in the inference time using evolutionary search, without requiring any re-training. Second, we design Drop-and-Restore process that makes PoWER-BERT applicable beyond classification, which enables PoWER-BERT to be applicable to a wider range of NLP tasks such as span-based question answering. We empirically verify Length-Adaptive Transformer works quite well using the variants of BERT on a diverse set of NLP tasks, including SQuAD 1.1 (Rajpurkar et al., 2016) and two sequence-level classification tasks in GLUE benchmark (Wang et al., 2018). Our experiments reveal that the proposed approach grants us a fine-grained control of computational efficiency and a superior accuracy-efficiency trade-off in the inference time, compared to existing approaches. ",
140
+ "bbox": [
141
+ 174,
142
+ 438,
143
+ 825,
144
+ 590
145
+ ],
146
+ "page_idx": 1
147
+ },
148
+ {
149
+ "type": "text",
150
+ "text": "2 BACKGROUND: TRANSFORMERS AND POWER-BERT ",
151
+ "text_level": 1,
152
+ "bbox": [
153
+ 174,
154
+ 611,
155
+ 651,
156
+ 627
157
+ ],
158
+ "page_idx": 1
159
+ },
160
+ {
161
+ "type": "text",
162
+ "text": "Before we describe our main approach, we review some of the building blocks in this section. In particular, we review transformers, which are a standard backbone used in natural language processing these days, and PoWER-BERT, which was recently proposed as an effective way to train a large-scale, but highly efficient transformer for sequence-level classification. ",
163
+ "bbox": [
164
+ 174,
165
+ 643,
166
+ 825,
167
+ 699
168
+ ],
169
+ "page_idx": 1
170
+ },
171
+ {
172
+ "type": "text",
173
+ "text": "2.1 TRANSFORMERS AND BERT ",
174
+ "text_level": 1,
175
+ "bbox": [
176
+ 176,
177
+ 715,
178
+ 413,
179
+ 729
180
+ ],
181
+ "page_idx": 1
182
+ },
183
+ {
184
+ "type": "text",
185
+ "text": "A transformer is a particular neural network that has been designed to work with a variable-length sequence input and is implemented as a stack of self-attention and fully-connected layers (Vaswani et al., 2017). Here, we give a brief overview of the transformer which is the basic building block of the proposed approach. ",
186
+ "bbox": [
187
+ 174,
188
+ 742,
189
+ 825,
190
+ 797
191
+ ],
192
+ "page_idx": 1
193
+ },
194
+ {
195
+ "type": "text",
196
+ "text": "Each token $x _ { t }$ in a sequence of tokens ${ \\boldsymbol x } = ( x _ { 1 } , \\dots , x _ { N } )$ , representing input text, is first turned into a continuous vector $h _ { t } ^ { 0 } \\in \\mathbb { R } ^ { H }$ which is the sum of the token and position embedding vectors. This sequence is fed into the first transformer layer which returns another sequence of the same length $\\dot { h ^ { 1 } } \\in \\mathbb { R } ^ { N \\times H }$ . We repeat this procedure $L$ times, for a transformer with $L$ layers, to obtain $h ^ { L } = ( h _ { 1 } ^ { L } , \\ldots , h _ { N } ^ { L } )$ . We refer to each vector in the hidden sequence at each layer as a word vector to emphasize that there exists a correspondence between each such vector and one of the input words. ",
197
+ "bbox": [
198
+ 174,
199
+ 804,
200
+ 825,
201
+ 888
202
+ ],
203
+ "page_idx": 1
204
+ },
205
+ {
206
+ "type": "text",
207
+ "text": "Although the transformer was first introduced for the problem of machine translation, Devlin et al. \n(2018) demonstrated that the transformer can be trained and used as a masked language model. ",
208
+ "bbox": [
209
+ 173,
210
+ 895,
211
+ 823,
212
+ 924
213
+ ],
214
+ "page_idx": 1
215
+ },
216
+ {
217
+ "type": "text",
218
+ "text": "More specifically, Devlin et al. (2018) showed that the transformer-based masked language model, called BERT, learns a universally useful parameter set that can be finetuned for any downstream task including sequence-level and token-level classification. ",
219
+ "bbox": [
220
+ 176,
221
+ 103,
222
+ 823,
223
+ 145
224
+ ],
225
+ "page_idx": 2
226
+ },
227
+ {
228
+ "type": "text",
229
+ "text": "In the case of sequence-level classification, a softmax classifier is attached to the word vector $h _ { 1 } ^ { L }$ associated with the special token [CLS], and the entire network, including the softmax classifier and BERT, is finetuned. For token-level classification, we use each $h _ { t } ^ { L }$ as the final hidden reprsentation of the associated $t$ -th word in the input sequence. This strategy of pretraining followed by finetuning, often referred to as transfer learning, has recently become a dominant approach to classification in natural language processing. ",
230
+ "bbox": [
231
+ 174,
232
+ 152,
233
+ 825,
234
+ 237
235
+ ],
236
+ "page_idx": 2
237
+ },
238
+ {
239
+ "type": "text",
240
+ "text": "2.2 POWER-BERT ",
241
+ "text_level": 1,
242
+ "bbox": [
243
+ 174,
244
+ 273,
245
+ 323,
246
+ 287
247
+ ],
248
+ "page_idx": 2
249
+ },
250
+ {
251
+ "type": "text",
252
+ "text": "PoWER-BERT keeps only the topmost $l _ { j }$ word vectors at each layer $j$ by eliminating redundant ones based on the significance score, which is the total amount of attention imposed by a word on the other words (Goyal et al., 2020). $l _ { j }$ is the hyper-parameter determines how many vectors to keep at layer $j$ PoWER-BERT has the same model parameters with BERT, but the extraction layers are interspersed after the self-attention layer in every transformer blocks (Vaswani et al., 2017). ",
253
+ "bbox": [
254
+ 174,
255
+ 308,
256
+ 825,
257
+ 378
258
+ ],
259
+ "page_idx": 2
260
+ },
261
+ {
262
+ "type": "text",
263
+ "text": "PoWER-BERT reduces inference time successfully, achieving better accuracy-time trade-off than DistilBERT (Sanh et al., 2019), BERT-PKD (Sun et al., 2019), and Head-Prune (Michel et al., 2019). Despite the original intention of maximizing the inference efficiency with the minimal loss in accuracy, it is possible to set up PoWER-BERT to be both more efficient and more accurate compared to the original BERT, which was observed but largely overlooked by Goyal et al. (2020). ",
264
+ "bbox": [
265
+ 174,
266
+ 385,
267
+ 825,
268
+ 455
269
+ ],
270
+ "page_idx": 2
271
+ },
272
+ {
273
+ "type": "text",
274
+ "text": "Training a PoWER-BERT model consists of three steps: (1) finetuning, (2) length configuration search, and (3) re-training. The finetuning step is just like the standard finetuning step of BERT given a target task. A length configuration is a sequence of retention parameters $\\left( l _ { 1 } , \\cdots l _ { L } \\right)$ , each of which corresponds to the number of word vectors that are kept at each layer. These retention parameters are learned along with all the other parameters to minimize the original task loss together with an extra term that approximately measures the number of retained word vectors across layers. In the re-training step, PoWER-BERT is finetuned with the length configuration fixed to its learned one. ",
275
+ "bbox": [
276
+ 174,
277
+ 462,
278
+ 825,
279
+ 559
280
+ ],
281
+ "page_idx": 2
282
+ },
283
+ {
284
+ "type": "text",
285
+ "text": "For each computational budget, we must train a separate model going through all three steps described above. Moreover, the length configuration search step above is only approximate, as it relies on relaxation of retention parameters which are inherently discrete. This leads to the lack of guaranteed correlation between the success of this stage and true run-time. Even worse, it is a delicate act to tune the length configuration given a target computational budget, because trade-off is implicitly made via a regularization coefficient. Furthermore, PoWER-BERT has an inherent limitation in that it only applies to sequence-level classification because it eliminates word vectors in intermediate layers. ",
286
+ "bbox": [
287
+ 174,
288
+ 566,
289
+ 825,
290
+ 664
291
+ ],
292
+ "page_idx": 2
293
+ },
294
+ {
295
+ "type": "text",
296
+ "text": "3 LENGTH-ADAPTIVE TRANSFORMER ",
297
+ "text_level": 1,
298
+ "bbox": [
299
+ 174,
300
+ 705,
301
+ 504,
302
+ 722
303
+ ],
304
+ "page_idx": 2
305
+ },
306
+ {
307
+ "type": "text",
308
+ "text": "In this section, we explain our proposed framework which results in a transformer that reduces the length of a sequence at each layer with an arbitrary rate. We call such a resulting transformer a Length-Adaptive Transformer. We train Length-Adaptive Transformer with LengthDrop which randomly samples the number of hidden vectors to be dropped at each layer with the goal of making the final model robust to such drop in the inference time. Once the model is trained, we search for the optimal trade-off between accuracy and efficiency using multi-objective evolutionary search, which allows us to use the model for any given computational budget without finetuning nor re-training. At the end of this section, we describe Drop-and-Restore process as a way to greatly increase the applicability of PoWER-BERT which forms a building block of the proposed framework. ",
309
+ "bbox": [
310
+ 174,
311
+ 748,
312
+ 825,
313
+ 875
314
+ ],
315
+ "page_idx": 2
316
+ },
317
+ {
318
+ "type": "text",
319
+ "text": "In short, we train a Length-Adaptive Transformer once with LengthDrop and Drop-and-Restore, and use it with an automatically determined length configuration for inference with any target computational budget, on both sequence-level and token-level tasks. ",
320
+ "bbox": [
321
+ 176,
322
+ 882,
323
+ 823,
324
+ 922
325
+ ],
326
+ "page_idx": 2
327
+ },
328
+ {
329
+ "type": "text",
330
+ "text": "3.1 LENGTHDROP ",
331
+ "text_level": 1,
332
+ "bbox": [
333
+ 174,
334
+ 103,
335
+ 313,
336
+ 117
337
+ ],
338
+ "page_idx": 3
339
+ },
340
+ {
341
+ "type": "text",
342
+ "text": "Earlier approaches to efficient inference with transformers have focused on a scenario where the target computational budget for inference is known in advance Sanh et al. (2019); Goyal et al. (2020). This greatly increases the cost of deploying transformers, as it requires us to train a separate transformer for each scenario. Instead, we propose to train one model that could be used for a diverse set of target computational budgets without retraining. ",
343
+ "bbox": [
344
+ 174,
345
+ 128,
346
+ 825,
347
+ 199
348
+ ],
349
+ "page_idx": 3
350
+ },
351
+ {
352
+ "type": "text",
353
+ "text": "LengthDrop randomly generates a length configuration by sequentially sampling a sequence length $l _ { i + 1 }$ at the $( i + 1 )$ -th layer based on the previous layer’s sequence length $l _ { i }$ , following the uniform distribution $\\mathcal { U } ( \\lceil ( 1 - p ) l _ { i } \\rceil , l _ { i } )$ , where $l _ { 0 }$ is set to the length of the input sequence, and $p$ is the LengthDrop probability. This sequential sampling results in a length configuration $( l _ { 1 } , \\cdots , l _ { L } )$ . Length-Adaptive Transformer can be thought of as consisting of a full model and many sub-models corresponding to different length configuration, similarly to a neural network trained with dropout (Srivastava et al., 2014). ",
354
+ "bbox": [
355
+ 173,
356
+ 207,
357
+ 825,
358
+ 304
359
+ ],
360
+ "page_idx": 3
361
+ },
362
+ {
363
+ "type": "text",
364
+ "text": "LayerDrop From the perspective of each word vector, the proposed LengthDrop could be thought of as skipping the layers between when it was set aside and the final layer where it was restored. The word vector however does not have any information based on which it can determine whether it would be dropped at any particular layer. In our preliminary experiments, we found that this greatly hinders optimization. We address this issue by using LayerDrop (Fan et al., 2019) which skips each layer of a transformer uniformly at random. The LayerDrop encourages each word vector to be agnostic to skipping any number of layers between when it is dropped and when it is restored, just like dropout (Srivastava et al., 2014) prevents hidden neurons from co-adapting with each other by randomly dropping them. ",
365
+ "bbox": [
366
+ 173,
367
+ 318,
368
+ 825,
369
+ 444
370
+ ],
371
+ "page_idx": 3
372
+ },
373
+ {
374
+ "type": "text",
375
+ "text": "Sandwich Rule and Inplace Distillation We observed that standard supervised training with LengthDrop does not work well in the preliminary experiments. We instead borrow a pair of training techniques developed by Yu & Huang (2019) which are sandwich rule and inplace distillation, for better optimization as well as final generalization. At each update, we update the full model without LengthDrop as usual to minimize the supervised loss function. We simultaneously update $n _ { s }$ randomly-sampled sub-models (which are called sandwiches) and the smallest-possible submodel, which corresponds to keeping only $\\lceil ( 1 - p ) l _ { i } \\rceil$ word vectors at each layer $i$ , using knowledge distillation (Hinton et al., 2015) from the full model. Here, sub-models mean models with length reduction. They are trained to their prediction close to the full model’s prediction (inplace distillation). ",
376
+ "bbox": [
377
+ 174,
378
+ 457,
379
+ 825,
380
+ 583
381
+ ],
382
+ "page_idx": 3
383
+ },
384
+ {
385
+ "type": "text",
386
+ "text": "3.2 EVOLUTIONARY SEARCH OF LENGTH CONFIGURATIONS ",
387
+ "text_level": 1,
388
+ "bbox": [
389
+ 176,
390
+ 598,
391
+ 604,
392
+ 613
393
+ ],
394
+ "page_idx": 3
395
+ },
396
+ {
397
+ "type": "text",
398
+ "text": "After training a Length-Adaptive Transformer with LengthDrop, we search for appropriate length configurations for possible target computational budgets that will be given at inference time. The length configuration determines the model performance in terms of both accuracy and efficiency. In order to search for the optimal length configuration, we propose to use evolutionary search, similarly to Cai et al. (2019) and Wang et al. (2020). This procedure is efficient, as it only requires a single pass through the relatively small validation set for each length configuration, unlike re-training for a new computational budget which requires multiple passes through a significantly larger training set for each budget. ",
399
+ "bbox": [
400
+ 174,
401
+ 625,
402
+ 825,
403
+ 736
404
+ ],
405
+ "page_idx": 3
406
+ },
407
+ {
408
+ "type": "text",
409
+ "text": "We initialize the population with constant-ratio configurations. Each configuration is created by $l _ { i + 1 } = \\lceil ( 1 - r ) \\bar { l _ { i } } \\rceil$ for each layer $i$ with $r$ so that the amount of computation within the initial population is uniformly distributed between those of the smallest and full models. At each iteration, we evolve the population to consist only of configurations lie on a newly updated efficiencyaccuracy Pareto frontier by mutation and cross-over. Mutation alters an original length configuration $( l _ { 1 } , \\cdots , l _ { L } )$ to $( l _ { 1 } ^ { \\prime } , \\cdots , l _ { L } ^ { \\prime } )$ by sampling $l _ { i } ^ { \\prime }$ from the uniform distribution $\\bar { \\mathcal { U } } ( l _ { i - 1 } ^ { \\prime } , l _ { i + 1 } )$ with the probability $p _ { m }$ or keeping the original length ${ \\bar { l } } _ { i } ^ { \\prime } = l _ { i }$ , sweeping the layers from $i = 1$ to $i = L$ . Crossover takes two length configurations and averages the lengths at each layer. Both of these operations are performed while ensuring the monotonicity of the lengths over the layers. We repeat this iteration $G$ times, while maintaining $n _ { m }$ mutated configurations and $n _ { c }$ crossover’d configurations. Repeating this procedure pushes the Pareto frontier further to identify the best trade-off between two objectives, efficiency and accuracy, without requiring any continuous relaxation of length configurations nor using a proxy objective function. ",
410
+ "bbox": [
411
+ 173,
412
+ 743,
413
+ 826,
414
+ 924
415
+ ],
416
+ "page_idx": 3
417
+ },
418
+ {
419
+ "type": "image",
420
+ "img_path": "images/320388afaf5c944756a7b3f52eddc7583af0fdd53b75f8ac7bf8c3063dd11f2f.jpg",
421
+ "image_caption": [
422
+ "Figure 1: Illustration of (a) word-vector elimination process in PoWER-BERT (Goyal et al., 2020) and (b) Drop-and-Restore process in Length-Adaptive Transformer. Yellow box and blue boxes imply the output of embedding layer and transformer layers, respectively. Green boxes mean vectors dropped in lower layers and restored at the last layer. Red box is the task-specific layer. Though word-vectors in the middle could be eliminated (or dropped), remaining vectors are left-aligned for the better illustration. In this case, the number of transformer layers is four. "
423
+ ],
424
+ "image_footnote": [],
425
+ "bbox": [
426
+ 194,
427
+ 111,
428
+ 803,
429
+ 198
430
+ ],
431
+ "page_idx": 4
432
+ },
433
+ {
434
+ "type": "text",
435
+ "text": "3.3 DROP-AND-RESTORE PROCESS ",
436
+ "text_level": 1,
437
+ "bbox": [
438
+ 176,
439
+ 314,
440
+ 429,
441
+ 328
442
+ ],
443
+ "page_idx": 4
444
+ },
445
+ {
446
+ "type": "text",
447
+ "text": "The applicability of the PoWER-BERT, based on which our main contribution above was made, is limited to sequence-level classification, because it eliminates word vectors at each layer. In addition to our main contribution above, we thus propose to extend the PoWER-BERT so that it is applicable to token-level classification, such as span-based question-answering. Our proposal, to which we refer as Drop-and-Restore, does not eliminate word vectors at each layer according to the length configuration but instead sets them aside until the final hidden layer. At the final hidden layer, these word vectors are brought back to form the full hidden sequence, as illustrated graphically in Fig. 1. ",
448
+ "bbox": [
449
+ 174,
450
+ 340,
451
+ 825,
452
+ 438
453
+ ],
454
+ "page_idx": 4
455
+ },
456
+ {
457
+ "type": "text",
458
+ "text": "4 EXPERIMENT SETUP ",
459
+ "text_level": 1,
460
+ "bbox": [
461
+ 176,
462
+ 459,
463
+ 377,
464
+ 474
465
+ ],
466
+ "page_idx": 4
467
+ },
468
+ {
469
+ "type": "text",
470
+ "text": "Datasets We test the proposed approach on both sequence-level and token-level tasks, the latter of which could not have been done with the original PoWER-BERT unless for the proposed Dropand-Restore. We use MNLI-m and SST-2 from GLUE benchmark (Wang et al., 2018), as was done to test PoWER-BERT earlier, for sequence-level classification. We choose them because consistent accuracy scores from standard training on them due to their sufficiently large training set imply that they are reliable to verify our approach. We use SQuAD 1.1 (Rajpurkar et al., 2016) for token-level classification. ",
471
+ "bbox": [
472
+ 174,
473
+ 491,
474
+ 825,
475
+ 588
476
+ ],
477
+ "page_idx": 4
478
+ },
479
+ {
480
+ "type": "text",
481
+ "text": "Evaluation metrics We use the number of floating operations (FLOPs) as a main metric to measure the inference efficiency given any length configuration, as it is agnostic to the choice of underlying hardware, unlike other alternatives such as hardware-aware latency (Wang et al., 2020) or energy consumption (Henderson et al., 2020). We later demonstrate that FLOPs and wall-clock time on GPU and CPU correlate well with the proposed approach, which is not necessarily the case for other approaches, such as unstructured weight pruning (Han et al., 2015; See et al., 2016). ",
482
+ "bbox": [
483
+ 174,
484
+ 604,
485
+ 825,
486
+ 689
487
+ ],
488
+ "page_idx": 4
489
+ },
490
+ {
491
+ "type": "text",
492
+ "text": "Pretrained transformers Since BERT was introduced by Devlin et al. (2018), it has become a standard practice to start from a pretrained (masked) language model and finetune it for each downstream task. We follow the same strategy in this paper and test two pretrained transformerbased language models; BERTBASE (Devlin et al., 2018) and DistilBERT (Sanh et al., 2019), which allows us to demonstrate that the usefulness and applicability of our approach are not tied to any specific architectural choice, such as the number of layers and the maximum length of input sequence. Although we focus on BERT-based masked language models here, the proposed approach is readily applicable to any transformer-based models. ",
493
+ "bbox": [
494
+ 174,
495
+ 704,
496
+ 825,
497
+ 815
498
+ ],
499
+ "page_idx": 4
500
+ },
501
+ {
502
+ "type": "text",
503
+ "text": "Learning We train a Length-Adaptive Transformer with LengthDrop probability and LayerDrop probability both set to 0.2. We use $n _ { s } = 2$ randomly sampled intermediate sub-models in addition to the full model and smallest model for applying the sandwich learning rule. ",
504
+ "bbox": [
505
+ 174,
506
+ 833,
507
+ 825,
508
+ 875
509
+ ],
510
+ "page_idx": 4
511
+ },
512
+ {
513
+ "type": "text",
514
+ "text": "We start finetuning the pretrained transformer without Drop-and-Restore first, just as Goyal et al. (2020) did with PoWER-BERT. We then continue finetuning it for another five epochs with Drop-andRestore. This is unlike the recommended three epochs by Devlin et al. (2018), as learning progresses slower due to a higher level of stochasticity introduced by LengthDrop and LayerDrop. We use the batch size of 32, the learning rate of $5 e - 5$ for SQuAD v1.1 and $2 e - 5$ for MNLI-m and SST, and the maximum sequence length of 384 for SQuAD v1.1 and 128 for MNLI-m and SST. ",
515
+ "bbox": [
516
+ 176,
517
+ 882,
518
+ 825,
519
+ 924
520
+ ],
521
+ "page_idx": 4
522
+ },
523
+ {
524
+ "type": "image",
525
+ "img_path": "images/3ea54ad6f6a4d01240155dd50bd06714bd078c67453a78cfd7ce1b9404ef27c2.jpg",
526
+ "image_caption": [
527
+ "Figure 2: Pareto curves of F1 score and FLOPs on SQuAD 1.1 (Rajpurkar et al., 2016). We apply the proposed method to $\\mathbf { B E R T _ { B a s e } }$ (solid lines) and DistilBERT (dotted lines). For each model, we draw three curves using (1) standard finetuned transformer with constant-rate length reduction, (2) Length-Adaptive Transformer with constant-rate length reduction, and (3) Length-Adaptive Transformer with length configurations obtained from the evolutionary search. "
528
+ ],
529
+ "image_footnote": [],
530
+ "bbox": [
531
+ 181,
532
+ 99,
533
+ 638,
534
+ 349
535
+ ],
536
+ "page_idx": 5
537
+ },
538
+ {
539
+ "type": "image",
540
+ "img_path": "images/4608176aa7c7dba0b4748567c1c64abe798b711bebf826c4b323894a4bfb2b12.jpg",
541
+ "image_caption": [
542
+ "Figure 3: Correlation between FLOPs and latency with different length configurations. "
543
+ ],
544
+ "image_footnote": [],
545
+ "bbox": [
546
+ 666,
547
+ 102,
548
+ 812,
549
+ 375
550
+ ],
551
+ "page_idx": 5
552
+ },
553
+ {
554
+ "type": "text",
555
+ "text": "",
556
+ "bbox": [
557
+ 173,
558
+ 473,
559
+ 823,
560
+ 516
561
+ ],
562
+ "page_idx": 5
563
+ },
564
+ {
565
+ "type": "text",
566
+ "text": "Search We run up to $G = 3 0$ iterations of evolutionary search, using $n _ { m } = 3 0$ mutated configurations with mutation probability $p _ { m } = 0 . 5$ and $n _ { c } = 3 0$ crossover’d configurations, to find the Pareto frontier of accuracy and efficiency. ",
567
+ "bbox": [
568
+ 174,
569
+ 532,
570
+ 825,
571
+ 575
572
+ ],
573
+ "page_idx": 5
574
+ },
575
+ {
576
+ "type": "text",
577
+ "text": "5 RESULTS AND ANALYSIS ",
578
+ "text_level": 1,
579
+ "bbox": [
580
+ 176,
581
+ 595,
582
+ 413,
583
+ 612
584
+ ],
585
+ "page_idx": 5
586
+ },
587
+ {
588
+ "type": "text",
589
+ "text": "Efficiency-accuracy trade-off We use SQuAD 1.1 to examine the effect of the proposed approach on the efficiency-accuracy trade-off. When the underlying classifier was not trained with LengthDrop, as proposed in this paper, the accuracy drops even more dramatically as more word vectors are dropped at each layer. The difference between standard transformer and Length-Adaptive Transformer is stark in Fig. 2. This verifies the importance of training a transformer in a way that makes it malleable for inference-time re-configuration. ",
590
+ "bbox": [
591
+ 174,
592
+ 627,
593
+ 825,
594
+ 712
595
+ ],
596
+ "page_idx": 5
597
+ },
598
+ {
599
+ "type": "text",
600
+ "text": "When the model was trained with the proposed LengthDrop, we notice the efficacy of the proposed approach of using evolutionary search to find the optimal trade-off between inference efficiency and accuracy. The trade-off curve from the proposed search strategy has a larger area-under-curve (AUC) than when constant-rate length reduction was used to meet a target computational budget. It demonstrates the importance of using both LengthDrop and evolutionary search. ",
601
+ "bbox": [
602
+ 174,
603
+ 718,
604
+ 825,
605
+ 789
606
+ ],
607
+ "page_idx": 5
608
+ },
609
+ {
610
+ "type": "text",
611
+ "text": "We make a minor observation that the proposed approach ends up with a significantly higher accuracy than DistillBERT when enough computational budget is allowed for inference $( \\log { \\mathrm { F L O P s } } > 1 0 )$ . This makes our approach desirable in a wide array of scenarios, as it does not require any additional pretraining stage, as does DistilBERT. With a severe constraint on the computational budget, the proposed approach could be used on DistilBERT to significantly improve the efficiency without compromising the accuracy. ",
612
+ "bbox": [
613
+ 174,
614
+ 795,
615
+ 825,
616
+ 878
617
+ ],
618
+ "page_idx": 5
619
+ },
620
+ {
621
+ "type": "text",
622
+ "text": "Maximizing inference efficiency We consider all three tasks, SQuAD 1.1, MNLI-m and SST-2, and investigate how much efficiency can be gained by the proposed approach with minimal sacrifice of accuracy. First, we look at how much efficiency could be gained without losing on the accuracy. That is, we use the length configuration that maximizes the inference efficiency (i.e., minimize the FLOPs) while ensuring that the accuracy is above or same as the accuracy of the standard approach without any drop of word vectors. The results are presented in the rows marked with Length-Adaptive† from Table 1. For example, in the case of $\\mathbf { B E R T _ { B a s e } }$ , the proposed approach reduce FLOPs by more than half across all three tasks. ",
623
+ "bbox": [
624
+ 174,
625
+ 895,
626
+ 821,
627
+ 924
628
+ ],
629
+ "page_idx": 5
630
+ },
631
+ {
632
+ "type": "table",
633
+ "img_path": "images/f0829b1fbd9636baa6152ad5a45e5f7dbf08c6a7333b2fd362453dfa90284833.jpg",
634
+ "table_caption": [
635
+ "Table 1: Comparison results of standard Transformer and LengthAdaptive Transformer. Among length configurations on the Pareto frontier of Length-Adaptive Transformer, we pick two representative points: Length-Adaptive? and Length-Adaptive† as the most efficient one while having the highest accuracy and the accuracy higher than (or equal to) standard Transformer, respectively. "
636
+ ],
637
+ "table_footnote": [],
638
+ "table_body": "<table><tr><td colspan=\"2\">Model</td><td colspan=\"2\">SQuAD 1.1</td><td colspan=\"2\">MNLI-m</td><td colspan=\"2\">SST-2</td></tr><tr><td>Pretrained Transformer</td><td>Method</td><td>F1</td><td>FLOPs</td><td>Acc</td><td>FLOPs</td><td>Acc</td><td>FLOPs</td></tr><tr><td rowspan=\"2\">BERTBase</td><td>Standard</td><td>88.5</td><td>1.00x</td><td>84.4</td><td>1.00x</td><td>92.8</td><td>1.00x</td></tr><tr><td>Length-Adaptive*</td><td>89.6</td><td>0.89x</td><td>85.0</td><td>0.58x</td><td>93.1</td><td>0.36x</td></tr><tr><td rowspan=\"2\"></td><td>Length-Adaptivet</td><td>88.7</td><td>0.45x</td><td>84.4</td><td>0.35x</td><td>92.8</td><td>0.35x</td></tr><tr><td>Standard</td><td>85.8</td><td>1.00x</td><td>80.9</td><td>1.00x</td><td>90.6</td><td>1.00x</td></tr><tr><td rowspan=\"2\">DistilBERT1</td><td>Length-Adaptive*</td><td>86.3</td><td>0.81x</td><td>81.5</td><td>0.56x</td><td>92.0</td><td>0.55x</td></tr><tr><td>Length-Adaptive†</td><td>85.9</td><td>0.59x</td><td>81.3</td><td>0.54x</td><td>91.7</td><td>0.54x</td></tr></table>",
639
+ "bbox": [
640
+ 183,
641
+ 101,
642
+ 643,
643
+ 239
644
+ ],
645
+ "page_idx": 6
646
+ },
647
+ {
648
+ "type": "image",
649
+ "img_path": "images/e4a6ecfc1cdcda5b3130f2509429e44b544d994935e6b44f36893f811295f752.jpg",
650
+ "image_caption": [
651
+ "Figure 4: Example of area under Pareto curve as the evolutionary search of lenth configurations proceeds. "
652
+ ],
653
+ "image_footnote": [],
654
+ "bbox": [
655
+ 669,
656
+ 108,
657
+ 813,
658
+ 229
659
+ ],
660
+ "page_idx": 6
661
+ },
662
+ {
663
+ "type": "text",
664
+ "text": "",
665
+ "bbox": [
666
+ 174,
667
+ 344,
668
+ 826,
669
+ 429
670
+ ],
671
+ "page_idx": 6
672
+ },
673
+ {
674
+ "type": "text",
675
+ "text": "From Fig. 2, we have observed that the proposed Length-Adaptive Transformer generalize better than the standard, base model in some cases. We thus try to maximize both the inference efficiency and accuracy, in order to see whether it is possible for the proposed algorithm to find a length configuration that both maximizes inference efficiency and improves accuracy. We present the results in the rows marked with Length-Adaptive? from Table 1. For all cases, Length-Adaptive Transformer achieves higher accuracy than a standard transformer does while reducing FLOPs significantly. Although it is not apparent from the table, tor MNLI-m and SST-2, the accuracy of the smallest sub-model is already greater than or equal to that of a standard transformer. ",
676
+ "bbox": [
677
+ 173,
678
+ 435,
679
+ 825,
680
+ 547
681
+ ],
682
+ "page_idx": 6
683
+ },
684
+ {
685
+ "type": "text",
686
+ "text": "FLOPs vs. Latency As has been discussed in recent literature (see, e.g., (Li et al., 2020; Chin et al., 2020)), FLOPs is not a perfect indicator of the real latency measured in wall-clock time, as the latter is affected by the combination of hardware choice and network architecture. To understand the real-world impact of the proposed approach, we study the relationship between FLOPs, obtained by the proposed procedure, and wall-clock time measured on both CPU and GPU by measuring them while varying length configurations. As shown in Fig. 3, FLOPs and latency exhibit near-linear correlation on GPU, when the minibatch size is $\\geq 1 6$ , and regardless of the minibatch size, on CPU. In other words, the reduction in FLOPs with the proposed approach directly implies the reduction in wall-clock time. ",
687
+ "bbox": [
688
+ 174,
689
+ 561,
690
+ 825,
691
+ 688
692
+ ],
693
+ "page_idx": 6
694
+ },
695
+ {
696
+ "type": "text",
697
+ "text": "Convergence of search Although the proposed approach is efficient in that it requires only one round of training, it needs a separate search stage for each target budget. It is important for evolutionary search to converge quickly in the number of forward sweeps of a validation set. As exemplified in Fig. 4, evolutionary search converges after about fifteen iterations. ",
698
+ "bbox": [
699
+ 174,
700
+ 703,
701
+ 825,
702
+ 758
703
+ ],
704
+ "page_idx": 6
705
+ },
706
+ {
707
+ "type": "text",
708
+ "text": "6 RELATED WORK ",
709
+ "text_level": 1,
710
+ "bbox": [
711
+ 176,
712
+ 779,
713
+ 344,
714
+ 795
715
+ ],
716
+ "page_idx": 6
717
+ },
718
+ {
719
+ "type": "text",
720
+ "text": "The main purpose of the proposed algorithm is to improve the inference efficiency of a large-scale transformer. This goal has been pursued from various directions, and in this section, we provide a brief overview of these earlier, and some concurrent, attempts in the context of the proposed approach. ",
721
+ "bbox": [
722
+ 174,
723
+ 810,
724
+ 825,
725
+ 852
726
+ ],
727
+ "page_idx": 6
728
+ },
729
+ {
730
+ "type": "text",
731
+ "text": "Weight pruning Weight pruning (Han et al., 2015) focuses on reducing the number of parameters which directly reflects the memory footprint of a model and indirectly correlates with inference speed. However, their actual speed-up in runtime is usually not significant, especially while executing a model with parallel computation using GPU devices (Tang et al., 2018; Li et al., 2020). ",
732
+ "bbox": [
733
+ 176,
734
+ 867,
735
+ 825,
736
+ 924
737
+ ],
738
+ "page_idx": 6
739
+ },
740
+ {
741
+ "type": "text",
742
+ "text": "Adaptive architecture There are three major axes along which computation can be reduced in a neural network; (1) input size/length, (2) network depth and (3) network width. The proposed approach, based on PoWER-BERT, adaptively reduces the input length as the input sequence is processed by the transformer layers. In our knowledge, Goyal et al. (2020) is the first work in this direction for transformers. More recently, Funnel-Transformer (Dai et al., 2020) and multi-scale transformer language models (Subramanian et al., 2020) also successfully reduce sequence length in the middle and rescale to full length for the final computation. However, their inference complexity is fixed unlike PoWER-BERT because they are not designed for the control of efficiency. ",
743
+ "bbox": [
744
+ 174,
745
+ 103,
746
+ 825,
747
+ 214
748
+ ],
749
+ "page_idx": 7
750
+ },
751
+ {
752
+ "type": "text",
753
+ "text": "LayerDrop (Fan et al., 2019) drops random layers during the training to be robust to pruning inspired by Huang et al. (2016). Word-level adaptive depth in Elbayad et al. (2019) might seemingly resemble with length reduction, but word vectors reached the maximal layer are used for self-attention computation without updating themselves. Escaping a network early (Teerapittayanon et al., 2016; Huang et al., 2017) based on the confidence of the prediction (Xin et al., 2020; Schwartz et al., 2020; Liu et al., 2020) also offers a control over accuracy-efficiency trade-off, but it is difficult to tune a threshold for a desired computational budget because of the example-wise adaptive computation. ",
754
+ "bbox": [
755
+ 174,
756
+ 222,
757
+ 825,
758
+ 319
759
+ ],
760
+ "page_idx": 7
761
+ },
762
+ {
763
+ "type": "text",
764
+ "text": "DynaBERT (Hou et al., 2020) can run at adaptive width (the number of attention heads and intermediate hidden dimension) and depth. Hardware-aware Transformers (Wang et al., 2020) construct a design space with arbitrary encoder-decoder attention and heterogeneous layers in terms of different numbers of layers, attention heads, hidden dimension, and embedding dimension. ",
765
+ "bbox": [
766
+ 174,
767
+ 327,
768
+ 825,
769
+ 382
770
+ ],
771
+ "page_idx": 7
772
+ },
773
+ {
774
+ "type": "text",
775
+ "text": "Structured dropout A major innovation we introduce over the existing PoWER-BERT is the use of stochastic, structured regularization to make a transformer robust to the choice of length configuration in the inference time. Rippel et al. (2014) proposes a nested dropout to learn ordered representations. Similar to LengthDrop, it samples an index form a prior distribution and drops all units having a larger index than sampled one. ",
776
+ "bbox": [
777
+ 174,
778
+ 397,
779
+ 825,
780
+ 467
781
+ ],
782
+ "page_idx": 7
783
+ },
784
+ {
785
+ "type": "text",
786
+ "text": "Search There have been a series of attempts at finding the optimal network configuration by solving a combinatorial optimization problem. In computer vision, Once-for-All (Cai et al., 2019) use an evolutionary search (Real et al., 2019) to find a better configuration in dimensions of depth, width, kernel size, and resolution given computational budget. Similarly but differently, our evolutionary search is mutli-objective to find length configurations on the Pareto accuracy-efficiency frontier to cope with any possible computational budgets. Moreover, we only change the sequence length of hidden vectors instead of architectural model size like dimensions. ",
787
+ "bbox": [
788
+ 174,
789
+ 482,
790
+ 825,
791
+ 580
792
+ ],
793
+ "page_idx": 7
794
+ },
795
+ {
796
+ "type": "text",
797
+ "text": "7 CONCLUSION AND FUTURE WORK ",
798
+ "text_level": 1,
799
+ "bbox": [
800
+ 176,
801
+ 601,
802
+ 495,
803
+ 617
804
+ ],
805
+ "page_idx": 7
806
+ },
807
+ {
808
+ "type": "text",
809
+ "text": "In this work, we propose a new framework for training a transformer once and using it for efficient inference under any computational budget. With the help of training with LengthDrop and Drop-andRestore process followed by the evolutionary search, our proposed Length-Adaptive Transformer allows any given transformer models to be used with any inference-time computational budget for both sequence-level and token-level classification tasks. Our experiments, on SQuAD 1.1, MNLI-m and SST-2, have revealed that the proposed algorithmic framework significantly pushes a better Pareto frontier on the trade-off between inference efficiency and accuracy. Furthermore, we have observed that the proposed Length-Adaptive Transformer could achieve up to $3 \\mathbf { x }$ speed-up over the standard transformer without sacrificing accuracy, both in terms of FLOPs and wallclock time. ",
810
+ "bbox": [
811
+ 174,
812
+ 632,
813
+ 825,
814
+ 757
815
+ ],
816
+ "page_idx": 7
817
+ },
818
+ {
819
+ "type": "text",
820
+ "text": "Although our approach finds an optimal length configuration of a trained classifier per computational budget, it leaves open a question whether the proposed approach could be further extended to support per-instance length configuration by for instance training a small, auxiliary neural network for each computational budget. Yet another aspect we have not investigated in this paper is the applicability of the proposed approach to sequence generation, such as machine translation. We leave both of these research directions for the future. ",
821
+ "bbox": [
822
+ 174,
823
+ 765,
824
+ 825,
825
+ 848
826
+ ],
827
+ "page_idx": 7
828
+ },
829
+ {
830
+ "type": "text",
831
+ "text": "Our approach is effective, as we have shown in this paper, and also quite simple to implement on top of existing language models. We will release our implementation, which is based on HuggingFace’s Transformers library (Wolf et al., 2019), publicly and plan to adapt it for a broader set of transformerbased models and downstream tasks. ",
832
+ "bbox": [
833
+ 176,
834
+ 854,
835
+ 825,
836
+ 910
837
+ ],
838
+ "page_idx": 7
839
+ },
840
+ {
841
+ "type": "text",
842
+ "text": "REFERENCES ",
843
+ "text_level": 1,
844
+ "bbox": [
845
+ 176,
846
+ 102,
847
+ 287,
848
+ 117
849
+ ],
850
+ "page_idx": 8
851
+ },
852
+ {
853
+ "type": "text",
854
+ "text": "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. ",
855
+ "bbox": [
856
+ 176,
857
+ 126,
858
+ 825,
859
+ 169
860
+ ],
861
+ "page_idx": 8
862
+ },
863
+ {
864
+ "type": "text",
865
+ "text": "Han Cai, Chuang Gan, and Song Han. Once for all: Train one network and specialize it for efficient deployment. arXiv preprint arXiv:1908.09791, 2019. ",
866
+ "bbox": [
867
+ 171,
868
+ 179,
869
+ 823,
870
+ 208
871
+ ],
872
+ "page_idx": 8
873
+ },
874
+ {
875
+ "type": "text",
876
+ "text": "Ting-Wu Chin, Ruizhou Ding, Cha Zhang, and Diana Marculescu. Towards efficient model compression via learned global ranking. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1518–1528, 2020. ",
877
+ "bbox": [
878
+ 174,
879
+ 218,
880
+ 823,
881
+ 262
882
+ ],
883
+ "page_idx": 8
884
+ },
885
+ {
886
+ "type": "text",
887
+ "text": "Zihang Dai, Guokun Lai, Yiming Yang, and Quoc V Le. Funnel-transformer: Filtering out sequential redundancy for efficient language processing. arXiv preprint arXiv:2006.03236, 2020. ",
888
+ "bbox": [
889
+ 173,
890
+ 272,
891
+ 823,
892
+ 303
893
+ ],
894
+ "page_idx": 8
895
+ },
896
+ {
897
+ "type": "text",
898
+ "text": "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. ",
899
+ "bbox": [
900
+ 173,
901
+ 311,
902
+ 823,
903
+ 342
904
+ ],
905
+ "page_idx": 8
906
+ },
907
+ {
908
+ "type": "text",
909
+ "text": "Maha Elbayad, Jiatao Gu, Edouard Grave, and Michael Auli. Depth-adaptive transformer. arXiv preprint arXiv:1910.10073, 2019. ",
910
+ "bbox": [
911
+ 173,
912
+ 351,
913
+ 823,
914
+ 381
915
+ ],
916
+ "page_idx": 8
917
+ },
918
+ {
919
+ "type": "text",
920
+ "text": "Angela Fan, Edouard Grave, and Armand Joulin. Reducing transformer depth on demand with structured dropout. arXiv preprint arXiv:1909.11556, 2019. ",
921
+ "bbox": [
922
+ 169,
923
+ 390,
924
+ 825,
925
+ 420
926
+ ],
927
+ "page_idx": 8
928
+ },
929
+ {
930
+ "type": "text",
931
+ "text": "Saurabh Goyal, Anamitra Roy Choudhary, Venkatesan Chakaravarthy, Saurabh ManishRaje, Yogish Sabharwal, and Ashish Verma. Power-bert: Accelerating bert inference for classification tasks. arXiv preprint arXiv:2001.08950, 2020. ",
932
+ "bbox": [
933
+ 176,
934
+ 430,
935
+ 823,
936
+ 473
937
+ ],
938
+ "page_idx": 8
939
+ },
940
+ {
941
+ "type": "text",
942
+ "text": "Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. arXiv preprint arXiv:1510.00149, 2015. ",
943
+ "bbox": [
944
+ 173,
945
+ 483,
946
+ 821,
947
+ 513
948
+ ],
949
+ "page_idx": 8
950
+ },
951
+ {
952
+ "type": "text",
953
+ "text": "Peter Henderson, Jieru Hu, Joshua Romoff, Emma Brunskill, Dan Jurafsky, and Joelle Pineau. Towards the systematic reporting of the energy and carbon footprints of machine learning. arXiv preprint arXiv:2002.05651, 2020. ",
954
+ "bbox": [
955
+ 174,
956
+ 522,
957
+ 823,
958
+ 566
959
+ ],
960
+ "page_idx": 8
961
+ },
962
+ {
963
+ "type": "text",
964
+ "text": "Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. ",
965
+ "bbox": [
966
+ 171,
967
+ 577,
968
+ 823,
969
+ 606
970
+ ],
971
+ "page_idx": 8
972
+ },
973
+ {
974
+ "type": "text",
975
+ "text": "Lu Hou, Lifeng Shang, Xin Jiang, and Qun Liu. Dynabert: Dynamic bert with adaptive width and depth. arXiv preprint arXiv:2004.04037, 2020. ",
976
+ "bbox": [
977
+ 171,
978
+ 616,
979
+ 825,
980
+ 645
981
+ ],
982
+ "page_idx": 8
983
+ },
984
+ {
985
+ "type": "text",
986
+ "text": "Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In European conference on computer vision, pp. 646–661. Springer, 2016. ",
987
+ "bbox": [
988
+ 171,
989
+ 655,
990
+ 823,
991
+ 685
992
+ ],
993
+ "page_idx": 8
994
+ },
995
+ {
996
+ "type": "text",
997
+ "text": "Gao Huang, Danlu Chen, Tianhong Li, Felix Wu, Laurens van der Maaten, and Kilian Q Weinberger. Multi-scale dense networks for resource efficient image classification. arXiv preprint arXiv:1703.09844, 2017. ",
998
+ "bbox": [
999
+ 173,
1000
+ 695,
1001
+ 825,
1002
+ 738
1003
+ ],
1004
+ "page_idx": 8
1005
+ },
1006
+ {
1007
+ "type": "text",
1008
+ "text": "Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020. ",
1009
+ "bbox": [
1010
+ 171,
1011
+ 748,
1012
+ 826,
1013
+ 791
1014
+ ],
1015
+ "page_idx": 8
1016
+ },
1017
+ {
1018
+ "type": "text",
1019
+ "text": "Zhuohan Li, Eric Wallace, Sheng Shen, Kevin Lin, Kurt Keutzer, Dan Klein, and Joseph E Gonzalez. Train large, then compress: Rethinking model size for efficient training and inference of transformers. arXiv preprint arXiv:2002.11794, 2020. ",
1020
+ "bbox": [
1021
+ 173,
1022
+ 803,
1023
+ 823,
1024
+ 844
1025
+ ],
1026
+ "page_idx": 8
1027
+ },
1028
+ {
1029
+ "type": "text",
1030
+ "text": "Weijie Liu, Peng Zhou, Zhe Zhao, Zhiruo Wang, Haotang Deng, and Qi Ju. Fastbert: a self-distilling bert with adaptive inference time. arXiv preprint arXiv:2004.02178, 2020. ",
1031
+ "bbox": [
1032
+ 171,
1033
+ 856,
1034
+ 823,
1035
+ 885
1036
+ ],
1037
+ "page_idx": 8
1038
+ },
1039
+ {
1040
+ "type": "text",
1041
+ "text": "Paul Michel, Omer Levy, and Graham Neubig. Are sixteen heads really better than one? In Advances in Neural Information Processing Systems, pp. 14014–14024, 2019. ",
1042
+ "bbox": [
1043
+ 173,
1044
+ 895,
1045
+ 821,
1046
+ 924
1047
+ ],
1048
+ "page_idx": 8
1049
+ },
1050
+ {
1051
+ "type": "text",
1052
+ "text": "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. ",
1053
+ "bbox": [
1054
+ 176,
1055
+ 103,
1056
+ 823,
1057
+ 146
1058
+ ],
1059
+ "page_idx": 9
1060
+ },
1061
+ {
1062
+ "type": "text",
1063
+ "text": "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. ",
1064
+ "bbox": [
1065
+ 173,
1066
+ 154,
1067
+ 823,
1068
+ 184
1069
+ ],
1070
+ "page_idx": 9
1071
+ },
1072
+ {
1073
+ "type": "text",
1074
+ "text": "Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683, 2019. ",
1075
+ "bbox": [
1076
+ 178,
1077
+ 191,
1078
+ 823,
1079
+ 234
1080
+ ],
1081
+ "page_idx": 9
1082
+ },
1083
+ {
1084
+ "type": "text",
1085
+ "text": "Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250, 2016. ",
1086
+ "bbox": [
1087
+ 171,
1088
+ 242,
1089
+ 825,
1090
+ 271
1091
+ ],
1092
+ "page_idx": 9
1093
+ },
1094
+ {
1095
+ "type": "text",
1096
+ "text": "Esteban Real, Alok Aggarwal, Yanping Huang, and Quoc V Le. Regularized evolution for image classifier architecture search. In Proceedings of the aaai conference on artificial intelligence, volume 33, pp. 4780–4789, 2019. ",
1097
+ "bbox": [
1098
+ 176,
1099
+ 279,
1100
+ 825,
1101
+ 321
1102
+ ],
1103
+ "page_idx": 9
1104
+ },
1105
+ {
1106
+ "type": "text",
1107
+ "text": "Oren Rippel, Michael Gelbart, and Ryan Adams. Learning ordered representations with nested dropout. In International Conference on Machine Learning, pp. 1746–1754, 2014. ",
1108
+ "bbox": [
1109
+ 173,
1110
+ 329,
1111
+ 823,
1112
+ 359
1113
+ ],
1114
+ "page_idx": 9
1115
+ },
1116
+ {
1117
+ "type": "text",
1118
+ "text": "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. ",
1119
+ "bbox": [
1120
+ 171,
1121
+ 367,
1122
+ 823,
1123
+ 396
1124
+ ],
1125
+ "page_idx": 9
1126
+ },
1127
+ {
1128
+ "type": "text",
1129
+ "text": "Roy Schwartz, Jesse Dodge, Noah A Smith, and Oren Etzioni. Green ai. arXiv preprint arXiv:1907.10597, 2019. ",
1130
+ "bbox": [
1131
+ 171,
1132
+ 404,
1133
+ 823,
1134
+ 433
1135
+ ],
1136
+ "page_idx": 9
1137
+ },
1138
+ {
1139
+ "type": "text",
1140
+ "text": "Roy Schwartz, Gabi Stanovsky, Swabha Swayamdipta, Jesse Dodge, and Noah A Smith. The right tool for the job: Matching model and instance complexities. arXiv preprint arXiv:2004.07453, 2020. ",
1141
+ "bbox": [
1142
+ 174,
1143
+ 440,
1144
+ 823,
1145
+ 483
1146
+ ],
1147
+ "page_idx": 9
1148
+ },
1149
+ {
1150
+ "type": "text",
1151
+ "text": "Abigail See, Minh-Thang Luong, and Christopher D Manning. Compression of neural machine translation models via pruning. arXiv preprint arXiv:1606.09274, 2016. ",
1152
+ "bbox": [
1153
+ 171,
1154
+ 492,
1155
+ 823,
1156
+ 521
1157
+ ],
1158
+ "page_idx": 9
1159
+ },
1160
+ {
1161
+ "type": "text",
1162
+ "text": "Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, and Bryan Catanzaro. Megatron-lm: Training multi-billion parameter language models using gpu model parallelism. arXiv preprint arXiv:1909.08053, 2019. ",
1163
+ "bbox": [
1164
+ 178,
1165
+ 529,
1166
+ 821,
1167
+ 571
1168
+ ],
1169
+ "page_idx": 9
1170
+ },
1171
+ {
1172
+ "type": "text",
1173
+ "text": "Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1):1929–1958, 2014. ",
1174
+ "bbox": [
1175
+ 176,
1176
+ 579,
1177
+ 823,
1178
+ 623
1179
+ ],
1180
+ "page_idx": 9
1181
+ },
1182
+ {
1183
+ "type": "text",
1184
+ "text": "Emma Strubell, Ananya Ganesh, and Andrew McCallum. Energy and policy considerations for deep learning in nlp. arXiv preprint arXiv:1906.02243, 2019. ",
1185
+ "bbox": [
1186
+ 169,
1187
+ 631,
1188
+ 823,
1189
+ 660
1190
+ ],
1191
+ "page_idx": 9
1192
+ },
1193
+ {
1194
+ "type": "text",
1195
+ "text": "Sandeep Subramanian, Ronan Collobert, Marc’Aurelio Ranzato, and Y-Lan Boureau. Multi-scale transformer language models. arXiv preprint arXiv:2005.00581, 2020. ",
1196
+ "bbox": [
1197
+ 173,
1198
+ 667,
1199
+ 823,
1200
+ 696
1201
+ ],
1202
+ "page_idx": 9
1203
+ },
1204
+ {
1205
+ "type": "text",
1206
+ "text": "Siqi Sun, Yu Cheng, Zhe Gan, and Jingjing Liu. Patient knowledge distillation for bert model compression. arXiv preprint arXiv:1908.09355, 2019. ",
1207
+ "bbox": [
1208
+ 173,
1209
+ 704,
1210
+ 823,
1211
+ 734
1212
+ ],
1213
+ "page_idx": 9
1214
+ },
1215
+ {
1216
+ "type": "text",
1217
+ "text": "Raphael Tang, Ashutosh Adhikari, and Jimmy Lin. Flops as a direct optimization objective for learning sparse neural networks. arXiv preprint arXiv:1811.03060, 2018. ",
1218
+ "bbox": [
1219
+ 171,
1220
+ 742,
1221
+ 823,
1222
+ 771
1223
+ ],
1224
+ "page_idx": 9
1225
+ },
1226
+ {
1227
+ "type": "text",
1228
+ "text": "Surat Teerapittayanon, Bradley McDanel, and Hsiang-Tsung Kung. Branchynet: Fast inference via early exiting from deep neural networks. In 2016 23rd International Conference on Pattern Recognition (ICPR), pp. 2464–2469. IEEE, 2016. ",
1229
+ "bbox": [
1230
+ 176,
1231
+ 780,
1232
+ 823,
1233
+ 821
1234
+ ],
1235
+ "page_idx": 9
1236
+ },
1237
+ {
1238
+ "type": "text",
1239
+ "text": "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. ",
1240
+ "bbox": [
1241
+ 174,
1242
+ 830,
1243
+ 823,
1244
+ 873
1245
+ ],
1246
+ "page_idx": 9
1247
+ },
1248
+ {
1249
+ "type": "text",
1250
+ "text": "Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. arXiv preprint arXiv:1804.07461, 2018. ",
1251
+ "bbox": [
1252
+ 174,
1253
+ 882,
1254
+ 823,
1255
+ 922
1256
+ ],
1257
+ "page_idx": 9
1258
+ },
1259
+ {
1260
+ "type": "text",
1261
+ "text": "Hanrui Wang, Zhanghao Wu, Zhijian Liu, Han Cai, Ligeng Zhu, Chuang Gan, and Song Han. Hat: Hardware-aware transformers for efficient natural language processing. arXiv preprint arXiv:2005.14187, 2020. ",
1262
+ "bbox": [
1263
+ 174,
1264
+ 103,
1265
+ 825,
1266
+ 145
1267
+ ],
1268
+ "page_idx": 10
1269
+ },
1270
+ {
1271
+ "type": "text",
1272
+ "text": "Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, et al. Transformers: State-of-the-art ´ natural language processing. arXiv preprint arXiv:1910.03771, 2019. ",
1273
+ "bbox": [
1274
+ 174,
1275
+ 155,
1276
+ 823,
1277
+ 198
1278
+ ],
1279
+ "page_idx": 10
1280
+ },
1281
+ {
1282
+ "type": "text",
1283
+ "text": "Ji Xin, Raphael Tang, Jaejun Lee, Yaoliang Yu, and Jimmy Lin. Deebert: Dynamic early exiting for accelerating bert inference. arXiv preprint arXiv:2004.12993, 2020. ",
1284
+ "bbox": [
1285
+ 171,
1286
+ 205,
1287
+ 825,
1288
+ 234
1289
+ ],
1290
+ "page_idx": 10
1291
+ },
1292
+ {
1293
+ "type": "text",
1294
+ "text": "Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in neural information processing systems, pp. 5754–5764, 2019. ",
1295
+ "bbox": [
1296
+ 174,
1297
+ 244,
1298
+ 823,
1299
+ 287
1300
+ ],
1301
+ "page_idx": 10
1302
+ },
1303
+ {
1304
+ "type": "text",
1305
+ "text": "Jiahui Yu and Thomas S Huang. Universally slimmable networks and improved training techniques. In Proceedings of the IEEE International Conference on Computer Vision, pp. 1803–1811, 2019. ",
1306
+ "bbox": [
1307
+ 174,
1308
+ 295,
1309
+ 823,
1310
+ 324
1311
+ ],
1312
+ "page_idx": 10
1313
+ }
1314
+ ]
parse/train/tqc8n6oHCtZ/tqc8n6oHCtZ_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/tqc8n6oHCtZ/tqc8n6oHCtZ_model.json ADDED
The diff for this file is too large to render. See raw diff
 
vlm/dev/3R3Pz5i0tye/0.png ADDED

Git LFS Details

  • SHA256: 0fedea5ebf224830e980138ab2805408ec9c2919c021ed65485ee4232476a7ac
  • Pointer size: 131 Bytes
  • Size of remote file: 531 kB
vlm/dev/3R3Pz5i0tye/1.png ADDED

Git LFS Details

  • SHA256: 5af5c40541bae7458bc7a6c84d7b49d747336d9c7b1c136bfe6feafc39cb6ddc
  • Pointer size: 131 Bytes
  • Size of remote file: 737 kB
vlm/dev/3R3Pz5i0tye/10.png ADDED

Git LFS Details

  • SHA256: ea44a07953166ad1d7d53e848c5f2376863ccb735a150bdbb6e2d058526c6f38
  • Pointer size: 131 Bytes
  • Size of remote file: 556 kB
vlm/dev/3R3Pz5i0tye/11.png ADDED

Git LFS Details

  • SHA256: 05ef0c283885073235f393638c38fc82cc740942318e912693dc3129c1f62b32
  • Pointer size: 131 Bytes
  • Size of remote file: 592 kB
vlm/dev/3R3Pz5i0tye/12.png ADDED

Git LFS Details

  • SHA256: 4c3e47d6bbad42b548bfcc3bb92408386a6ce44ac93b096d29699d204d2dea95
  • Pointer size: 131 Bytes
  • Size of remote file: 564 kB
vlm/dev/3R3Pz5i0tye/13.png ADDED

Git LFS Details

  • SHA256: 788886d16ad08cc425fdb53b47ce7de91e25efa200805886f7f65f602b1d774d
  • Pointer size: 131 Bytes
  • Size of remote file: 188 kB
vlm/dev/3R3Pz5i0tye/2.png ADDED

Git LFS Details

  • SHA256: 7ed759c58fd3c0f934574cac5ef5daca8838bc22628092d29e03d8643232c666
  • Pointer size: 131 Bytes
  • Size of remote file: 791 kB
vlm/dev/3R3Pz5i0tye/3.png ADDED

Git LFS Details

  • SHA256: 130ca474d2f54d025c5053482d929c4ffe7579eb97b3f689692b0aac14051443
  • Pointer size: 131 Bytes
  • Size of remote file: 849 kB
vlm/dev/3R3Pz5i0tye/4.png ADDED

Git LFS Details

  • SHA256: 7883dff7602e331313cd4a9cf77e27960a1cbf8132438969588c73055a1e2d8a
  • Pointer size: 131 Bytes
  • Size of remote file: 588 kB
vlm/dev/3R3Pz5i0tye/5.png ADDED

Git LFS Details

  • SHA256: 9700d6b7eaec132f5a94ec2e171a31751c193c45cc7cd9c91a6af5588ac270ee
  • Pointer size: 131 Bytes
  • Size of remote file: 583 kB
vlm/dev/3R3Pz5i0tye/6.png ADDED

Git LFS Details

  • SHA256: 6634af8ec27c75bfbd1de2bc1547523597bd5e83a5257ff6620f30387fe57ea6
  • Pointer size: 131 Bytes
  • Size of remote file: 573 kB
vlm/dev/3R3Pz5i0tye/7.png ADDED

Git LFS Details

  • SHA256: 9337bb4cb139f8b19fef175dab27a40f5fcf34a3c7e1f391390d752e7c7d6769
  • Pointer size: 131 Bytes
  • Size of remote file: 807 kB
vlm/dev/3R3Pz5i0tye/8.png ADDED

Git LFS Details

  • SHA256: e0a972f625b62d1e720f52153197d6c62bcb131602975b00442cd9477ba84eb5
  • Pointer size: 131 Bytes
  • Size of remote file: 528 kB
vlm/dev/3R3Pz5i0tye/9.png ADDED

Git LFS Details

  • SHA256: b940293ca7dd6ae051a82ce0d59e918ed19a67ab5a9deb7293ada6ad7b2776db
  • Pointer size: 131 Bytes
  • Size of remote file: 575 kB
vlm/dev/401LFvBGIb/0.png ADDED

Git LFS Details

  • SHA256: 92e8ef8ccdf626f7de2962a7f2d353c7f5d174b7bfadfcb871572103bb579996
  • Pointer size: 131 Bytes
  • Size of remote file: 437 kB
vlm/dev/401LFvBGIb/1.png ADDED

Git LFS Details

  • SHA256: 6c05f53f9b3230745adef239e7909271b8659bd10a9f02d2c335c9752c36a529
  • Pointer size: 131 Bytes
  • Size of remote file: 490 kB
vlm/dev/401LFvBGIb/2.png ADDED

Git LFS Details

  • SHA256: 060f02880e069b1148ca3f72286189f965f38497ce6b5fd5910c9f1fc890ef26
  • Pointer size: 131 Bytes
  • Size of remote file: 423 kB
vlm/dev/401LFvBGIb/3.png ADDED

Git LFS Details

  • SHA256: 00f9671aa6cfede300d117ef74e91ac4ac81cb9624a892918c623cccc22c36e9
  • Pointer size: 131 Bytes
  • Size of remote file: 405 kB
vlm/dev/401LFvBGIb/4.png ADDED

Git LFS Details

  • SHA256: ccec683eb69f8af84206e2b487b1c9657eaed9fd0fe46b547ec6abd9c9ab7ecd
  • Pointer size: 131 Bytes
  • Size of remote file: 527 kB
vlm/dev/401LFvBGIb/5.png ADDED

Git LFS Details

  • SHA256: 4d0fcaf14dcb61f1ae029973bbe8129553195a12a73dd4a41cf9fbd25ad18caa
  • Pointer size: 130 Bytes
  • Size of remote file: 60.4 kB
vlm/dev/401LFvBGIb/6.png ADDED

Git LFS Details

  • SHA256: 02da432c19b7c3827ea22ac5b70441d19436eccc0b83259953adbca395baab55
  • Pointer size: 131 Bytes
  • Size of remote file: 516 kB
vlm/dev/401LFvBGIb/7.png ADDED

Git LFS Details

  • SHA256: 2d618261683ad6d755572cf8440b16bfa8798914bd62ceab113add6f7d35e982
  • Pointer size: 131 Bytes
  • Size of remote file: 499 kB
vlm/dev/401LFvBGIb/8.png ADDED

Git LFS Details

  • SHA256: baa92d69ad1c5eb41909f8581e47c20f1e7898a7d0bd45254c01e3bb9100cf23
  • Pointer size: 131 Bytes
  • Size of remote file: 479 kB
vlm/dev/6u6N8WWwYSM/0.png ADDED

Git LFS Details

  • SHA256: 43b167799284084da274ca211c50ec0f0d4b3c66fae6c613b6f7082b36d95a12
  • Pointer size: 131 Bytes
  • Size of remote file: 603 kB
vlm/dev/6u6N8WWwYSM/1.png ADDED

Git LFS Details

  • SHA256: 6063abddd0db2e2d53aff682ccc02d810d98a728a56bb39451d511e072f0acb9
  • Pointer size: 131 Bytes
  • Size of remote file: 615 kB
vlm/dev/6u6N8WWwYSM/10.png ADDED

Git LFS Details

  • SHA256: 536e8c2341aded40def944cba8491aa3b94e166926638ce65a8193e3c8321cec
  • Pointer size: 131 Bytes
  • Size of remote file: 568 kB
vlm/dev/6u6N8WWwYSM/11.png ADDED

Git LFS Details

  • SHA256: 8b30724b7ba3dbd929d71d18a131ce610abf6da3e463a25456c4c7256770d7b6
  • Pointer size: 131 Bytes
  • Size of remote file: 383 kB
vlm/dev/6u6N8WWwYSM/12.png ADDED

Git LFS Details

  • SHA256: 4bced22b9be5e198a4920a6f8373e0a56ca153efb211fdc5e18a40d574dd77a8
  • Pointer size: 131 Bytes
  • Size of remote file: 527 kB
vlm/dev/6u6N8WWwYSM/13.png ADDED

Git LFS Details

  • SHA256: 3d5832f058e645823efd5a6143f004c25b3374934a5de74ee308c59eb4883071
  • Pointer size: 131 Bytes
  • Size of remote file: 411 kB
vlm/dev/6u6N8WWwYSM/14.png ADDED

Git LFS Details

  • SHA256: 42ad05681c507232a4b03584d5347747fb8b0181dd19f609e974108104a44b92
  • Pointer size: 132 Bytes
  • Size of remote file: 1.44 MB